From 5cb955586572f6fb3e19d3db5c3d04ff70017c07 Mon Sep 17 00:00:00 2001 From: pero1203 Date: Wed, 24 Mar 2021 09:25:14 +0100 Subject: [PATCH] Pri volitvah je v vabilih onemogoceno naknadno posiljanje. --- .../class.SurveyInvitationsNew.php | 100 +++++++++++------- lang/2.php | 6 +- 2 files changed, 67 insertions(+), 39 deletions(-) diff --git a/admin/survey/classes/surveyEmails/class.SurveyInvitationsNew.php b/admin/survey/classes/surveyEmails/class.SurveyInvitationsNew.php index 1812fa136..1285e82d2 100644 --- a/admin/survey/classes/surveyEmails/class.SurveyInvitationsNew.php +++ b/admin/survey/classes/surveyEmails/class.SurveyInvitationsNew.php @@ -2980,40 +2980,51 @@ class SurveyInvitationsNew { echo '
'; # damo v tabelo zaradi prilagajanja oblike levo/desno - echo ''; + + echo '
'; - echo '
'; + echo ''; + + // Pri volitvah vedno posiljamo samo tistim, katerim se nismo poslali + if(!SurveyInfo::getInstance()->checkSurveyModule('voting')){ - echo $lang['srv_inv_send_who_database'].'
'; - echo ''; - echo ''; - echo ''; - - $this->advancedCondition(); - echo '
'; - - echo ''; - echo '
'; - echo '
'; - echo '
'; - $this->displayMailToSourceLists((int)$_POST['source_type']); - echo '
'; #id="inv_select_mail_to_source_lists" - echo ''; + echo ''; + } + + echo '
'; + + echo '
'; - # polovimo sporočilo in prejemnike - $sql_string_m = "SELECT id, naslov, subject_text, body_text, reply_to, isdefault, comment, url FROM srv_invitations_messages WHERE ank_id = '$this->sid' AND isdefault='1'"; + echo $lang['srv_inv_send_who_database'].'
'; + echo ''; + echo ''; + echo ''; + + $this->advancedCondition(); + echo '
'; + + echo ''; + echo '
'; + echo '
'; - $sql_query_m = sisplet_query($sql_string_m); - if (mysqli_num_rows($sql_query_m) > 0 ) { - $preview_message = mysqli_fetch_assoc($sql_query_m); - } else { - #nimamo še vsebine sporočila skreiramo privzeto. - echo ''; - echo $lang['srv_invitation_note6']; - echo ''; - exit(); - } - - echo '
'; + echo '
'; + $this->displayMailToSourceLists((int)$_POST['source_type']); + echo '
'; #id="inv_select_mail_to_source_lists" + + echo ''; + + # polovimo sporočilo in prejemnike + $sql_query_m = sisplet_query("SELECT id, naslov, subject_text, body_text, reply_to, isdefault, comment, url FROM srv_invitations_messages WHERE ank_id = '$this->sid' AND isdefault='1'"); + if (mysqli_num_rows($sql_query_m) > 0 ) { + $preview_message = mysqli_fetch_assoc($sql_query_m); + } + else { + #nimamo še vsebine sporočila skreiramo privzeto. + echo ''; + echo $lang['srv_invitation_note6']; + echo ''; + + exit(); + } + + echo '
'; // Ce posiljamo preko navadne poste ali smsov, nimamo sporocila if($noEmailing == 0){ @@ -3038,7 +3049,9 @@ class SurveyInvitationsNew { echo ''; // inv_select_mail_to_respondents } - echo '
'; + echo '
'; echo '
'; //inv_send_mail } @@ -3215,7 +3228,7 @@ class SurveyInvitationsNew { $source_type = (int)$_POST['source_type']; $source_lists = trim($_POST['source_lists']); - $respondents = $this->getRespondents2Send($send_type,$checkboxes, $source_type, $source_lists); + $respondents = $this->getRespondents2Send($send_type, $checkboxes, $source_type, $source_lists); #koliko strani imamp $numRespondents = count($respondents); $pages = ceil($numRespondents / $this->rec_send_page_limit); @@ -3918,16 +3931,27 @@ class SurveyInvitationsNew { // updejtamo userja da mu je bilo poslano - PO NOVEM TO DELAMO SPROTI if ( count($send_ok_ids) > 0) { - $sqlQuery = sisplet_query("UPDATE srv_invitations_recipients SET sent = '1', date_sent = '".$date_sent."' WHERE id IN (".implode(',',$send_ok_ids).")"); + $sqlQuery = sisplet_query("UPDATE srv_invitations_recipients SET sent='1', date_sent='".$date_sent."' WHERE id IN (".implode(',',$send_ok_ids).")"); if (!$sqlQuery) { $error = mysqli_error($GLOBALS['connect_db']); } // statuse popravimo samo če vabilo še ni bilo poslano ali je bila napaka - $sqlQuery = sisplet_query("UPDATE srv_invitations_recipients SET last_status = '1' WHERE id IN (".implode(',',$send_ok_ids).") AND last_status IN ('0','2')"); + $sqlQuery = sisplet_query("UPDATE srv_invitations_recipients SET last_status='1' WHERE id IN (".implode(',',$send_ok_ids).") AND last_status IN ('0','2')"); if (!$sqlQuery) { $error = mysqli_error($GLOBALS['connect_db']); } + + // Pri volitvah za sabo pobrisemo podatke preko katerih bi lahko povezali prejemnike z responsi + if($voting){ + $sqlQuery = sisplet_query("UPDATE srv_invitations_recipients + SET cookie='', password='' + WHERE id IN (".implode(',',$send_ok_ids).") AND sent='1' AND last_status='1' AND ank_id='".$this->sid."' + "); + if (!$sqlQuery) { + $error = mysqli_error($GLOBALS['connect_db']); + } + } } # updejtamo status za errorje @@ -6201,6 +6225,9 @@ class SurveyInvitationsNew { $sql_sub_condition = " AND i.last_status IN (".$_POST['checkboxes'].")"; } } + + // Ce imamo vklopljene volitve potem posiljamo samo tistim, katerim še nismo poslali vabila (ponovno posiljanje ni mogoce) + $sql_voting_condition = (SurveyInfo::getInstance()->checkSurveyModule('voting')) ? " AND i.sent = '0' AND i.cookie != '' AND i.password != ''" : ""; // Ce imamo posiljanje brez emaila, ni potrebno da je email vnesen za posameznega respondenta if($noEmailing == 1){ @@ -6225,11 +6252,12 @@ class SurveyInvitationsNew { else{ $sql_fields = "SELECT DISTINCT i.password, i.id, i.email, i.last_status, i.list_id FROM srv_invitations_recipients AS i"; $sql_main_condition = " WHERE i.ank_id = '".$this->sid."' AND i.deleted = '0' AND i.unsubscribed = '0' AND i.email IS NOT NULL"; - $sql_sort = " ORDER BY i.id ASC"; + $sql_sort = " ORDER BY i.id ASC"; $sql_string = $sql_fields . $advancedConditionJoin . $sql_main_condition + . $sql_voting_condition . $advancedCondition . $sql_sub_condition . $sub_query diff --git a/lang/2.php b/lang/2.php index 433d21dab..26b709855 100644 --- a/lang/2.php +++ b/lang/2.php @@ -3081,14 +3081,14 @@ $lang = array ( "srv_kviz_interpretacije" => "Different interpretations", "srv_zakljucek_vprasalnika" => "Survey end", "srv_kviz_konec_note" => "If no option is selected, only administrator can view results", - "srv_voting" => "Election", - "srv_voting_info" => "The election module allows you to send invitations by turning off all paraadata and without any possibility of associating data with e-mail addresses and other identifiers.
After switching on, switching off the module is no longer possible!", + "srv_voting" => "Voting", + "srv_voting_info" => "The Voting module allows you to send invitations by turning off all paraadata and without any possibility of associating data with e-mail addresses and other identifiers.
After switching on, switching off the module is no longer possible!", "srv_voting_edit1" => "You can edit the questionnaire in a tab", "srv_voting_edit2" => "Edit", "srv_voting_invitations1" => "Email invitations are edited in", "srv_voting_invitations2" => "Email invitations interface", "srv_voting_warning" => "Invitations are individualized for the purpose of sending invitations only. Invitation settings cannot be changed.
Once the invitations are sent, the link between the e-mail address and the respondent's answers is not possible.", - "srv_voting_warning_paradata" => "Because you sent email invitations with the Elections module turned on, you can no longer change these settings.", + "srv_voting_warning_paradata" => "Because you sent email invitations with the Voting module turned on, you can no longer change these settings.", "srv_advanced_paradata" => "Advanced paradata", "srv_advanced_paradata_collect_post_time" => "Collect \"post time\"", "srv_json_survey_export" => "JSON survey export",