Pri volitvah je v vabilih onemogoceno naknadno posiljanje.

This commit is contained in:
pero1203 2021-03-24 09:25:14 +01:00
parent 8085a663c3
commit 5cb9555865
2 changed files with 67 additions and 39 deletions

View File

@ -2980,40 +2980,51 @@ class SurveyInvitationsNew {
echo '<div id="inv_send_mail">';
# damo v tabelo zaradi prilagajanja oblike levo/desno
echo '<table><tr><td>';
echo '<div>';
echo '<table><tr>';
// Pri volitvah vedno posiljamo samo tistim, katerim se nismo poslali
if(!SurveyInfo::getInstance()->checkSurveyModule('voting')){
echo $lang['srv_inv_send_who_database'].'<br/>';
echo '<span class="floatLeft">';
echo '<label><input type="radio" name="mailsource" value="0" onclick="mailToSourceChange();" checked="checked">'.$lang['srv_inv_send_who_all_units'].'</label>';
echo '</span>';
$this->advancedCondition();
echo '<br class="clr"/>';
echo '<label><input type="radio" name="mailsource" value="1" onclick="mailToSourceChange();">'.$lang['srv_inv_send_who_archive'].'</label>';
echo '<br/><label><input type="radio" name="mailsource" value="2" onclick="mailToSourceChange();">'.$lang['srv_inv_send_who_lists'].'</label>';
echo '<br/>';
echo '<div id="inv_select_mail_to_source_lists">';
$this->displayMailToSourceLists((int)$_POST['source_type']);
echo '</div>'; #id="inv_select_mail_to_source_lists"
echo '</div>';
echo '<td>';
echo '<div>';
# 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'].'<br/>';
echo '<span class="floatLeft">';
echo '<label><input type="radio" name="mailsource" value="0" onclick="mailToSourceChange();" checked="checked">'.$lang['srv_inv_send_who_all_units'].'</label>';
echo '</span>';
$this->advancedCondition();
echo '<br class="clr"/>';
echo '<label><input type="radio" name="mailsource" value="1" onclick="mailToSourceChange();">'.$lang['srv_inv_send_who_archive'].'</label>';
echo '<br/><label><input type="radio" name="mailsource" value="2" onclick="mailToSourceChange();">'.$lang['srv_inv_send_who_lists'].'</label>';
echo '<br/>';
$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 '<span class="inv_error_note">';
echo $lang['srv_invitation_note6'];
echo '</span>';
exit();
}
echo '</td><td>';
echo '<div id="inv_select_mail_to_source_lists">';
$this->displayMailToSourceLists((int)$_POST['source_type']);
echo '</div>'; #id="inv_select_mail_to_source_lists"
echo '</div>';
# 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 '<span class="inv_error_note">';
echo $lang['srv_invitation_note6'];
echo '</span>';
exit();
}
echo '</td>';
}
echo '<td>';
// Ce posiljamo preko navadne poste ali smsov, nimamo sporocila
if($noEmailing == 0){
@ -3038,7 +3049,9 @@ class SurveyInvitationsNew {
echo '</div>'; // inv_select_mail_to_respondents
}
echo '</td></tr></table>';
echo '</td>';
echo '</tr></table>';
echo '</div>'; //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

View File

@ -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.<br>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.<br>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.<br> 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",