Popravek posiljanja vabil - vsak respondent se aktivira posebej po vsakem posiljanju (in ne vec vsi naenkrat na koncu)
This commit is contained in:
parent
ad50ebbd9b
commit
e755d13e08
@ -3651,11 +3651,6 @@ class SurveyInvitationsNew {
|
|||||||
$dont_send_duplicated = true;
|
$dont_send_duplicated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#echo '<div id="inv_send_mail_finish">';
|
|
||||||
|
|
||||||
#$send_type = (int)$_POST['send_type'];
|
|
||||||
#$checkboxes = explode(',',$_POST['checkboxes']);
|
|
||||||
|
|
||||||
$rids = $_POST['rids'];
|
$rids = $_POST['rids'];
|
||||||
|
|
||||||
$return = array();
|
$return = array();
|
||||||
@ -3672,20 +3667,23 @@ class SurveyInvitationsNew {
|
|||||||
echo '<span class="inv_error_note">';
|
echo '<span class="inv_error_note">';
|
||||||
echo $lang['srv_invitation_note6'];
|
echo $lang['srv_invitation_note6'];
|
||||||
echo '</span>';
|
echo '</span>';
|
||||||
exit();
|
|
||||||
} else {
|
|
||||||
# polovimo sporočilo in prejemnike
|
|
||||||
$sql_string_m = "SELECT id, subject_text, body_text, reply_to, isdefault, comment, naslov, url FROM srv_invitations_messages WHERE ank_id = '$this->sid' AND isdefault='1'";
|
|
||||||
|
|
||||||
$sql_query_m = sisplet_query($sql_string_m);
|
exit();
|
||||||
if (mysqli_num_rows($sql_query_m) > 0 ) {
|
}
|
||||||
|
else {
|
||||||
|
// polovimo sporočilo in prejemnike
|
||||||
|
$sql_query_m = sisplet_query("SELECT id, subject_text, body_text, reply_to, isdefault, comment, naslov, url FROM srv_invitations_messages WHERE ank_id = '$this->sid' AND isdefault='1'");
|
||||||
|
|
||||||
|
if (mysqli_num_rows($sql_query_m) > 0 ) {
|
||||||
$sql_row_m = mysqli_fetch_assoc($sql_query_m);
|
$sql_row_m = mysqli_fetch_assoc($sql_query_m);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
#nimamo še vsebine sporočila skreiramo privzeto.
|
#nimamo še vsebine sporočila skreiramo privzeto.
|
||||||
echo '<span class="inv_error_note">';
|
echo '<span class="inv_error_note">';
|
||||||
echo $lang['srv_invitation_note6'];
|
echo $lang['srv_invitation_note6'];
|
||||||
echo '</span>';
|
echo '</span>';
|
||||||
exit();
|
|
||||||
|
exit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3694,29 +3692,41 @@ class SurveyInvitationsNew {
|
|||||||
$body_text = $sql_row_m['body_text'];
|
$body_text = $sql_row_m['body_text'];
|
||||||
$msg_url = $sql_row_m['url'];
|
$msg_url = $sql_row_m['url'];
|
||||||
|
|
||||||
$message_naslov = $sql_row_m['naslov'];
|
$message_naslov = $sql_row_m['naslov'];
|
||||||
# naslov za odgovor je avtor ankete
|
|
||||||
|
// naslov za odgovor je avtor ankete
|
||||||
if ($this->validEmail($sql_row_m['reply_to'])) {
|
if ($this->validEmail($sql_row_m['reply_to'])) {
|
||||||
$reply_to = $sql_row_m['reply_to'];
|
$reply_to = $sql_row_m['reply_to'];
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$reply_to = Common::getInstance()->getReplyToEmail();
|
$reply_to = Common::getInstance()->getReplyToEmail();
|
||||||
}
|
}
|
||||||
# prejeminki besedila
|
|
||||||
$sql_string = "SELECT id,firstname, lastname, email, password, password, cookie, phone, salutation, custom, relation FROM srv_invitations_recipients WHERE ank_id = '".$this->sid."' AND deleted='0' AND id IN(".implode(',',$rids).") order by id";
|
|
||||||
$sql_query = sisplet_query($sql_string);
|
|
||||||
|
|
||||||
# polovimo sistemske spremenljivke z vrednostmi
|
// prejeminki besedila
|
||||||
$strSistemske = "SELECT s.id, s.naslov, s.variable FROM srv_spremenljivka s, srv_grupa g WHERE s.sistem='1' AND s.gru_id=g.id AND g.ank_id='".$this->sid."' AND variable IN("."'" . implode("','",$this->inv_variables)."') ORDER BY g.vrstni_red, s.vrstni_red";
|
$sql_query = sisplet_query("SELECT id, firstname, lastname, email, password, password, cookie, phone, salutation, custom, relation
|
||||||
$qrySistemske = sisplet_query($strSistemske);
|
FROM srv_invitations_recipients
|
||||||
|
WHERE ank_id = '".$this->sid."' AND deleted='0' AND id IN (".implode(',',$rids).")
|
||||||
|
ORDER BY id
|
||||||
|
");
|
||||||
|
|
||||||
|
// polovimo sistemske spremenljivke z vrednostmi
|
||||||
|
$qrySistemske = sisplet_query("SELECT s.id, s.naslov, s.variable
|
||||||
|
FROM srv_spremenljivka s, srv_grupa g
|
||||||
|
WHERE s.sistem='1' AND s.gru_id=g.id AND g.ank_id='".$this->sid."' AND variable IN ("."'" . implode("','",$this->inv_variables)."')
|
||||||
|
ORDER BY g.vrstni_red, s.vrstni_red
|
||||||
|
");
|
||||||
$sys_vars = array();
|
$sys_vars = array();
|
||||||
$sys_vars_ids = array();
|
$sys_vars_ids = array();
|
||||||
while ($row = mysqli_fetch_assoc($qrySistemske)) {
|
|
||||||
|
while ($row = mysqli_fetch_assoc($qrySistemske)) {
|
||||||
$sys_vars[$row['id']] = array('id'=>$row['id'], 'variable'=>$row['variable'],'naslov'=>$row['naslov']);
|
$sys_vars[$row['id']] = array('id'=>$row['id'], 'variable'=>$row['variable'],'naslov'=>$row['naslov']);
|
||||||
$sys_vars_ids[] = $row['id'];
|
$sys_vars_ids[] = $row['id'];
|
||||||
}
|
}
|
||||||
$sqlVrednost = sisplet_query("SELECT spr_id, id AS vre_id, vrstni_red, variable FROM srv_vrednost WHERE spr_id IN(".implode(',',$sys_vars_ids).") ORDER BY vrstni_red ASC ");
|
|
||||||
|
$sqlVrednost = sisplet_query("SELECT spr_id, id AS vre_id, vrstni_red, variable FROM srv_vrednost WHERE spr_id IN(".implode(',',$sys_vars_ids).") ORDER BY vrstni_red ASC ");
|
||||||
while ($row = mysqli_fetch_assoc($sqlVrednost)) {
|
while ($row = mysqli_fetch_assoc($sqlVrednost)) {
|
||||||
// Ce gre za odnos imamo radio
|
|
||||||
|
// Ce gre za odnos imamo radio
|
||||||
if($sys_vars[$row['spr_id']]['variable'] == 'odnos'){
|
if($sys_vars[$row['spr_id']]['variable'] == 'odnos'){
|
||||||
if(!isset($sys_vars[$row['spr_id']]['vre_id'][$row['vrstni_red']]))
|
if(!isset($sys_vars[$row['spr_id']]['vre_id'][$row['vrstni_red']]))
|
||||||
$sys_vars[$row['spr_id']]['vre_id'][$row['variable']] = $row['vre_id'];
|
$sys_vars[$row['spr_id']]['vre_id'][$row['variable']] = $row['vre_id'];
|
||||||
@ -3728,13 +3738,13 @@ class SurveyInvitationsNew {
|
|||||||
|
|
||||||
# zakeširamo user_id za datapiping
|
# zakeširamo user_id za datapiping
|
||||||
$arryDataPiping = array();
|
$arryDataPiping = array();
|
||||||
$strDataPiping = "SELECT id,inv_res_id FROM srv_user WHERE ank_id='$this->sid' AND inv_res_id IS NOT NULL";
|
$qryDataPiping = sisplet_query("SELECT id,inv_res_id FROM srv_user WHERE ank_id='$this->sid' AND inv_res_id IS NOT NULL");
|
||||||
$qryDataPiping = sisplet_query($strDataPiping);
|
|
||||||
while (list($dpUid,$dpInvResId) = mysqli_fetch_row($qryDataPiping)) {
|
while (list($dpUid,$dpInvResId) = mysqli_fetch_row($qryDataPiping)) {
|
||||||
if ((int)$dpInvResId > 0 && (int)$dpUid > 0) {
|
if ((int)$dpInvResId > 0 && (int)$dpUid > 0) {
|
||||||
$arryDataPiping[$dpInvResId] = (int)$dpUid;
|
$arryDataPiping[$dpInvResId] = (int)$dpUid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# array za rezultate
|
# array za rezultate
|
||||||
$send_ok = array();
|
$send_ok = array();
|
||||||
$send_ok_ids = array();
|
$send_ok_ids = array();
|
||||||
@ -3756,62 +3766,64 @@ class SurveyInvitationsNew {
|
|||||||
if (!Common::checkModule('gorenje')){
|
if (!Common::checkModule('gorenje')){
|
||||||
global $site_url, $global_user_id;
|
global $site_url, $global_user_id;
|
||||||
|
|
||||||
$sqlinfo_string = "SELECT email, name, surname FROM users WHERE id = '".$global_user_id."'";
|
$sqlinfo_query = sisplet_query("SELECT email, name, surname FROM users WHERE id = '".$global_user_id."'");
|
||||||
$sqlinfo_query = sisplet_query($sqlinfo_string);
|
|
||||||
list($infoEmail,$infoName,$infoSurname) = mysqli_fetch_row($sqlinfo_query);
|
list($infoEmail,$infoName,$infoSurname) = mysqli_fetch_row($sqlinfo_query);
|
||||||
$infourl = '<a href="'.$site_url.'admin/survey/index.php?anketa='.$this->sid.'">anketi</a>';
|
|
||||||
|
$infourl = '<a href="'.$site_url.'admin/survey/index.php?anketa='.$this->sid.'">anketi</a>';
|
||||||
$format = $lang['srv_inv_send_finish_note'];
|
$format = $lang['srv_inv_send_finish_note'];
|
||||||
|
|
||||||
$info1ka_mass_email_note = sprintf($format, $infoName, $infoSurname, $infoEmail, $infourl, $numRows);
|
$info1ka_mass_email_note = sprintf($format, $infoName, $infoSurname, $infoEmail, $infourl, $numRows);
|
||||||
|
|
||||||
try
|
try{
|
||||||
{
|
|
||||||
$MA = new MailAdapter($this->sid, $type='admin');
|
$MA = new MailAdapter($this->sid, $type='admin');
|
||||||
$MA->addRecipients('info@1ka.si');
|
$MA->addRecipients('info@1ka.si');
|
||||||
$resultX = $MA->sendMail($info1ka_mass_email_note, 'Masovno pošiljanje vabil (poslanih več kot '.NOTIFY_INFO1KA.')');
|
$resultX = $MA->sendMail($info1ka_mass_email_note, 'Masovno pošiljanje vabil (poslanih več kot '.NOTIFY_INFO1KA.')');
|
||||||
}
|
}
|
||||||
catch (Exception $e)
|
catch (Exception $e){
|
||||||
{
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#Pripravimo arhiv pošiljanj, da dobimo arch_id
|
// Pripravimo arhiv pošiljanj, da dobimo arch_id
|
||||||
$sql_string_all = "SELECT count(*) FROM srv_invitations_recipients WHERE ank_id = '".$this->sid."' AND deleted = '0'";
|
$sql_query_all = sisplet_query("SELECT count(*) FROM srv_invitations_recipients WHERE ank_id = '".$this->sid."' AND deleted = '0'");
|
||||||
$sql_query_all = sisplet_query($sql_string_all);
|
|
||||||
list($count_all) = mysqli_fetch_row($sql_query_all);
|
list($count_all) = mysqli_fetch_row($sql_query_all);
|
||||||
|
|
||||||
$archive_naslov = 'mailing_'.date("d.m.Y").', '.date("H:i:s");
|
$archive_naslov = 'mailing_'.date("d.m.Y").', '.date("H:i:s");
|
||||||
$sqlString = "INSERT INTO srv_invitations_archive (id, ank_id, date_send, subject_text, body_text, uid, comment, naslov, rec_in_db)"
|
$sqlQuery = sisplet_query("INSERT INTO srv_invitations_archive
|
||||||
." VALUES (NULL , '$this->sid', '$date_sent', '".addslashes($subject_text)."', '".addslashes($body_text)."', '$global_user_id','$comment','$archive_naslov','$count_all')";
|
(id, ank_id, date_send, subject_text, body_text, uid, comment, naslov, rec_in_db)
|
||||||
$sqlQuery = sisplet_query($sqlString);
|
VALUES
|
||||||
|
(NULL , '$this->sid', '$date_sent', '".addslashes($subject_text)."', '".addslashes($body_text)."', '$global_user_id','$comment','$archive_naslov','$count_all')
|
||||||
|
");
|
||||||
|
|
||||||
$arch_id = mysqli_insert_id($GLOBALS['connect_db']);
|
$arch_id = mysqli_insert_id($GLOBALS['connect_db']);
|
||||||
$duplicated = array();
|
$duplicated = array();
|
||||||
|
|
||||||
while ($sql_row = mysqli_fetch_assoc($sql_query)) {
|
while ($sql_row = mysqli_fetch_assoc($sql_query)) {
|
||||||
#password == code
|
|
||||||
$password = $sql_row['password'];
|
$password = $sql_row['password'];
|
||||||
|
|
||||||
$email = $sql_row['email'];
|
$email = $sql_row['email'];
|
||||||
if ($dont_send_duplicated == true && isset($duplicated[$email])) {
|
if ($dont_send_duplicated == true && isset($duplicated[$email])) {
|
||||||
$duplicated[$email] ++;
|
$duplicated[$email] ++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$duplicated[$email] = 1;
|
|
||||||
$individual = (int)$this->surveySettings['individual_invitation'];
|
|
||||||
if (($individual == 1 && trim($email) != '' && trim($password) != '')
|
|
||||||
|| ($individual == 0 && trim($email) != '' )){
|
|
||||||
|
|
||||||
# odvisno ali imamo url za jezik.
|
$duplicated[$email] = 1;
|
||||||
|
$individual = (int)$this->surveySettings['individual_invitation'];
|
||||||
|
|
||||||
|
if ( ($individual == 1 && trim($email) != '' && trim($password) != '') || ($individual == 0 && trim($email) != '') ){
|
||||||
|
|
||||||
|
// odvisno ali imamo url za jezik.
|
||||||
if ($msg_url != null && trim($msg_url) != '' ) {
|
if ($msg_url != null && trim($msg_url) != '' ) {
|
||||||
$url = $msg_url . ($individual == 1 ? '?code='.$password : '');
|
$url = $msg_url . ($individual == 1 ? '?code='.$password : '');
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$url = $nice_url . ($individual == 1 ? '&code='.$password : '');
|
$url = $nice_url . ($individual == 1 ? '&code='.$password : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
$url .= '&ai='.(int)$arch_id;
|
$url .= '&ai='.(int)$arch_id;
|
||||||
#odjava
|
|
||||||
|
// odjava
|
||||||
$unsubscribe = $site_url . 'admin/survey/unsubscribe.php?anketa=' . $this->sid . '&code='.$password;
|
$unsubscribe = $site_url . 'admin/survey/unsubscribe.php?anketa=' . $this->sid . '&code='.$password;
|
||||||
|
|
||||||
$user_body_text = str_replace(
|
$user_body_text = str_replace(
|
||||||
@ -3847,21 +3859,19 @@ class SurveyInvitationsNew {
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
# naredimo DataPiping;
|
// naredimo DataPiping;
|
||||||
if (isset($arryDataPiping[$sql_row['id']])) {
|
if (isset($arryDataPiping[$sql_row['id']])) {
|
||||||
$user_body_text = Common::getInstance()->dataPiping($user_body_text, $arryDataPiping[$sql_row['id']], 0);
|
$user_body_text = Common::getInstance()->dataPiping($user_body_text, $arryDataPiping[$sql_row['id']], 0);
|
||||||
}
|
}
|
||||||
$resultX = null;
|
$resultX = null;
|
||||||
|
|
||||||
try
|
try{
|
||||||
{
|
|
||||||
$MA = new MailAdapter($this->sid, $type='invitation');
|
$MA = new MailAdapter($this->sid, $type='invitation');
|
||||||
$MA->addRecipients($email);
|
$MA->addRecipients($email);
|
||||||
$resultX = $MA->sendMail($user_body_text, $subject_text);
|
$resultX = $MA->sendMail($user_body_text, $subject_text);
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception $e)
|
catch (Exception $e){
|
||||||
{
|
|
||||||
// todo fajn bi bilo zalogirat kaj se dogaja
|
// todo fajn bi bilo zalogirat kaj se dogaja
|
||||||
$__error = $e->getMessage();
|
$__error = $e->getMessage();
|
||||||
$__errStack = $e->getTraceAsString();
|
$__errStack = $e->getTraceAsString();
|
||||||
@ -3873,54 +3883,108 @@ class SurveyInvitationsNew {
|
|||||||
$send_ok_ids[] = $sql_row['id'];
|
$send_ok_ids[] = $sql_row['id'];
|
||||||
$_user_data['status'] = 1;
|
$_user_data['status'] = 1;
|
||||||
# poslalo ok
|
# poslalo ok
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
// ni poslalo
|
// ni poslalo
|
||||||
$send_error[] = $email;
|
$send_error[] = $email;
|
||||||
$send_error_ids[] = $sql_row['id'];
|
$send_error_ids[] = $sql_row['id'];
|
||||||
$_user_data['status'] = 2;
|
$_user_data['status'] = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
$send_users_data[] = $_user_data;
|
$send_users_data[] = $_user_data;
|
||||||
|
|
||||||
|
|
||||||
|
// 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).")");
|
||||||
|
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')");
|
||||||
|
if (!$sqlQuery) {
|
||||||
|
$error = mysqli_error($GLOBALS['connect_db']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# updejtamo status za errorje
|
||||||
|
if ( count($send_error_ids) > 0) {
|
||||||
|
|
||||||
|
$sqlQuery = sisplet_query("UPDATE srv_invitations_recipients SET last_status = GREATEST(last_status,2) WHERE id IN (".implode(',',$send_error_ids).") AND last_status IN ('0')");
|
||||||
|
if (!$sqlQuery) {
|
||||||
|
$error = mysqli_error($GLOBALS['connect_db']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// če mamo personalizirana email vabila, userje dodamo v bazo
|
||||||
|
if ($individual == 1) {
|
||||||
|
|
||||||
|
// dodamo še userja v srv_user da je kompatibilno s staro logiko
|
||||||
|
$strInsertDataText = array();
|
||||||
|
$strInsertDataVrednost = array();
|
||||||
|
|
||||||
|
$_r = sisplet_query("INSERT INTO srv_user
|
||||||
|
(ank_id, email, cookie, pass, last_status, time_insert, inv_res_id)
|
||||||
|
VALUES
|
||||||
|
('".$this->sid."', '".$_user_data['email']."', '".$_user_data['cookie']."', '".$_user_data['password']."', '".$_user_data['status']."', NOW(), '".$_user_data['id']."') ON DUPLICATE KEY UPDATE cookie = '".$_user_data['cookie']."', pass='".$_user_data['password']."'
|
||||||
|
");
|
||||||
|
$usr_id = mysqli_insert_id($GLOBALS['connect_db']);
|
||||||
|
|
||||||
|
if ($usr_id) {
|
||||||
|
|
||||||
|
// dodamo še srv_userbase in srv userstatus
|
||||||
|
sisplet_query("INSERT INTO srv_userbase (usr_id, tip, datetime, admin_id) VALUES ('".$usr_id."','0',NOW(),'".$global_user_id."')");
|
||||||
|
sisplet_query("INSERT INTO srv_userstatus (usr_id, tip, status, datetime) VALUES ('".$usr_id."', '0', '0', NOW())");
|
||||||
|
|
||||||
|
// dodamo še podatke za posameznega userja za sistemske spremenljivke
|
||||||
|
foreach ($sys_vars AS $sid => $spremenljivka) {
|
||||||
|
|
||||||
|
$_user_variable = $this->inv_variables_link[$spremenljivka['variable']];
|
||||||
|
|
||||||
|
if (trim($_user_data[$_user_variable]) != '' && $_user_data[$_user_variable] != null) {
|
||||||
|
if($spremenljivka['variable'] == 'odnos')
|
||||||
|
$strInsertDataVrednost[] = "('".$sid."','".$spremenljivka['vre_id'][trim($_user_data[$_user_variable])]."','".$usr_id."')";
|
||||||
|
else
|
||||||
|
$strInsertDataText[] = "('".$sid."','".$spremenljivka['vre_id']."','".trim($_user_data[$_user_variable])."','".$usr_id."')";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// lahko da user že obstaja in je šlo za duplicated keys
|
||||||
|
}
|
||||||
|
|
||||||
|
// vstavimo v srv_data_text
|
||||||
|
if (count($strInsertDataText) > 0) {
|
||||||
|
$strInsert = "INSERT INTO srv_data_text".$this->db_table." (spr_id, vre_id, text, usr_id) VALUES ";
|
||||||
|
$strInsert .= implode(',',$strInsertDataText);
|
||||||
|
sisplet_query($strInsert);
|
||||||
|
}
|
||||||
|
// vstavimo v srv_data_vrednost
|
||||||
|
if (count($strInsertDataVrednost) > 0) {
|
||||||
|
$strInsert = "INSERT INTO srv_data_vrednost".$this->db_table." (spr_id, vre_id, usr_id) VALUES ";
|
||||||
|
$strInsert .= implode(',',$strInsertDataVrednost);
|
||||||
|
sisplet_query($strInsert);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# updejtamo userja da mu je bilo poslano
|
|
||||||
if ( count($send_ok_ids) > 0) {
|
|
||||||
$sqlString = "UPDATE srv_invitations_recipients SET sent = '1', date_sent = '".$date_sent."' WHERE id IN (".implode(',',$send_ok_ids).")";
|
|
||||||
$sqlQuery = sisplet_query($sqlString);
|
|
||||||
if (!$sqlQuery) {
|
|
||||||
$error = mysqli_error($GLOBALS['connect_db']);
|
|
||||||
}
|
|
||||||
#statuse popravimo samo če vabilo še ni bilo poslano ali je bila napaka
|
|
||||||
$sqlString = "UPDATE srv_invitations_recipients SET last_status = '1' WHERE id IN (".implode(',',$send_ok_ids).") AND last_status IN ('0','2')";
|
|
||||||
$sqlQuery = sisplet_query($sqlString);
|
|
||||||
if (!$sqlQuery) {
|
|
||||||
$error = mysqli_error($GLOBALS['connect_db']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# updejtamo status za errorje
|
// dodajmo še userje v povezovalno tabelo (arhiv)
|
||||||
if ( count($send_error_ids) > 0) {
|
|
||||||
$sqlString = "UPDATE srv_invitations_recipients SET last_status = GREATEST(last_status,2) WHERE id IN (".implode(',',$send_error_ids).") AND last_status IN ('0')";
|
|
||||||
$sqlQuery = sisplet_query($sqlString);
|
|
||||||
if (!$sqlQuery) {
|
|
||||||
$error = mysqli_error($GLOBALS['connect_db']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$comment = $_POST['comment'];
|
|
||||||
|
|
||||||
#dodajmo še userje v povezovalno tabelo
|
|
||||||
if ($arch_id > 0) {
|
if ($arch_id > 0) {
|
||||||
# updejtamo še tabelo arhivov
|
|
||||||
$sqlString = "UPDATE srv_invitations_archive SET cnt_succsess='".count($send_ok_ids)."', cnt_error='".count($send_error_ids)."' WHERE id ='$arch_id'";
|
// updejtamo še tabelo arhivov
|
||||||
$sqlQuery = sisplet_query($sqlString);
|
$sqlQuery = sisplet_query("UPDATE srv_invitations_archive SET cnt_succsess='".count($send_ok_ids)."', cnt_error='".count($send_error_ids)."' WHERE id ='$arch_id'");
|
||||||
if (!$sqlQuery) {
|
if (!$sqlQuery) {
|
||||||
$error = mysqli_error($GLOBALS['connect_db']);
|
$error = mysqli_error($GLOBALS['connect_db']);
|
||||||
}
|
}
|
||||||
|
|
||||||
# za arhive
|
// za arhive
|
||||||
$_archive_recipients = array();
|
$_archive_recipients = array();
|
||||||
# za tracking
|
// za tracking
|
||||||
$_tracking = array();
|
$_tracking = array();
|
||||||
|
|
||||||
if (count($send_ok_ids) > 0) {
|
if (count($send_ok_ids) > 0) {
|
||||||
@ -3929,7 +3993,8 @@ class SurveyInvitationsNew {
|
|||||||
#status 1=pošta poslana
|
#status 1=pošta poslana
|
||||||
$_tracking[] = "('$arch_id',NOW(),'$id','1')";
|
$_tracking[] = "('$arch_id',NOW(),'$id','1')";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($send_error_ids) > 0) {
|
if (count($send_error_ids) > 0) {
|
||||||
foreach ( $send_error_ids AS $id) {
|
foreach ( $send_error_ids AS $id) {
|
||||||
$_archive_recipients[] = "('$arch_id','$id','0')";
|
$_archive_recipients[] = "('$arch_id','$id','0')";
|
||||||
@ -3942,7 +4007,8 @@ class SurveyInvitationsNew {
|
|||||||
$sqlString = 'INSERT INTO srv_invitations_archive_recipients (arch_id,rec_id,success) VALUES ';
|
$sqlString = 'INSERT INTO srv_invitations_archive_recipients (arch_id,rec_id,success) VALUES ';
|
||||||
$sqlString .= implode(', ', $_archive_recipients);
|
$sqlString .= implode(', ', $_archive_recipients);
|
||||||
$sqlQuery = sisplet_query($sqlString);
|
$sqlQuery = sisplet_query($sqlString);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($_tracking) > 0) {
|
if (count($_tracking) > 0) {
|
||||||
$sqlStrTracking = "INSERT INTO srv_invitations_tracking (inv_arch_id, time_insert, res_id, status) VALUES ";
|
$sqlStrTracking = "INSERT INTO srv_invitations_tracking (inv_arch_id, time_insert, res_id, status) VALUES ";
|
||||||
$sqlStrTracking .= implode(', ', $_tracking);
|
$sqlStrTracking .= implode(', ', $_tracking);
|
||||||
@ -3950,88 +4016,29 @@ class SurveyInvitationsNew {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sisplet_query("COMMIT");
|
|
||||||
|
|
||||||
# če mamo personalizirana email vabila, userje dodamo v bazo
|
|
||||||
if ($individual == 1 && count($send_users_data) > 0) {
|
|
||||||
# dodamo še userja v srv_user da je kompatibilno s staro logiko
|
|
||||||
$strInsertDataText = array();
|
|
||||||
$strInsertUserbase = array();
|
|
||||||
$strInsertUserstatus = array();
|
|
||||||
|
|
||||||
foreach ($send_users_data AS $user_data) {
|
|
||||||
#spodnji query nekako ni dobro naredil updejta ker je zamenjal last_status, po novem po potrebi samo zamenjamo kodo.
|
|
||||||
#$strInsert = "INSERT INTO srv_user (ank_id, email, cookie, pass, last_status, time_insert, inv_res_id) VALUES ('".$this->sid."', '".$user_data['email']."', '".$user_data['cookie']."', '".$user_data['password']."', '".$user_data['status']."', NOW(), '".$user_data['id']."') ON DUPLICATE KEY UPDATE last_status=VALUES(last_status), inv_res_id=VALUES(inv_res_id)";
|
|
||||||
$strInsert = "INSERT INTO srv_user (ank_id, email, cookie, pass, last_status, time_insert, inv_res_id) VALUES ('".$this->sid."', '".$user_data['email']."', '".$user_data['cookie']."', '".$user_data['password']."', '".$user_data['status']."', NOW(), '".$user_data['id']."') ON DUPLICATE KEY UPDATE cookie = '".$user_data['cookie']."', pass='".$user_data['password']."'";
|
|
||||||
$_r = sisplet_query($strInsert);
|
|
||||||
$usr_id = mysqli_insert_id($GLOBALS['connect_db']);
|
|
||||||
sisplet_query("COMMIT");
|
|
||||||
|
|
||||||
if ($usr_id) {
|
|
||||||
# dodamo še srv_userbase in srv userstatus
|
|
||||||
$strInsertUserbase[] = "('".$usr_id."','0',NOW(),'".$global_user_id."')";
|
|
||||||
$strInsertUserstatus[] = "('".$usr_id."', '0', '0', NOW())";
|
|
||||||
|
|
||||||
# dodamo še podatke za posameznega userja za sistemske spremenljivke
|
|
||||||
foreach ($sys_vars AS $sid => $spremenljivka) {
|
|
||||||
$_user_variable = $this->inv_variables_link[$spremenljivka['variable']];
|
|
||||||
if (trim($user_data[$_user_variable]) != '' && $user_data[$_user_variable] != null) {
|
|
||||||
if($spremenljivka['variable'] == 'odnos')
|
|
||||||
$strInsertDataVrednost[] = "('".$sid."','".$spremenljivka['vre_id'][trim($user_data[$_user_variable])]."','".$usr_id."')";
|
|
||||||
else
|
|
||||||
$strInsertDataText[] = "('".$sid."','".$spremenljivka['vre_id']."','".trim($user_data[$_user_variable])."','".$usr_id."')";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// lahko da user že obstaja in je šlo za duplicated keys
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# vstavimo v srv_userbase
|
|
||||||
if (count($strInsertUserbase) > 0) {
|
|
||||||
$strInsert = "INSERT INTO srv_userbase (usr_id, tip, datetime, admin_id) VALUES ";
|
|
||||||
$strInsert .= implode(',',$strInsertUserbase);
|
|
||||||
sisplet_query($strInsert);
|
|
||||||
}
|
|
||||||
# vstavimo v srv_userstatus
|
|
||||||
if (count($strInsertUserstatus) > 0) {
|
|
||||||
$strInsert = "INSERT INTO srv_userstatus (usr_id, tip, status, datetime) VALUES ";
|
|
||||||
$strInsert .= implode(',',$strInsertUserstatus);
|
|
||||||
sisplet_query($strInsert);
|
|
||||||
}
|
|
||||||
# vstavimo v srv_data_text
|
|
||||||
if (count($strInsertDataText) > 0) {
|
|
||||||
$strInsert = "INSERT INTO srv_data_text".$this->db_table." (spr_id, vre_id, text, usr_id) VALUES ";
|
|
||||||
$strInsert .= implode(',',$strInsertDataText);
|
|
||||||
sisplet_query($strInsert);
|
|
||||||
}
|
|
||||||
# vstavimo v srv_data_vrednost
|
|
||||||
if (count($strInsertDataVrednost) > 0) {
|
|
||||||
$strInsert = "INSERT INTO srv_data_vrednost".$this->db_table." (spr_id, vre_id, usr_id) VALUES ";
|
|
||||||
$strInsert .= implode(',',$strInsertDataVrednost);
|
|
||||||
sisplet_query($strInsert);
|
|
||||||
}
|
|
||||||
|
|
||||||
sisplet_query("COMMIT");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
// Izpis rezultatov - errors and successes
|
||||||
if (count($send_error) > 0 ) {
|
if (count($send_error) > 0 ) {
|
||||||
$return['error'] = '1';
|
$return['error'] = '1';
|
||||||
|
|
||||||
$return['msg'] = '<div class="inv_send_message">'.$lang['srv_invitation_note7'].count($send_error).'</div>';
|
$return['msg'] = '<div class="inv_send_message">'.$lang['srv_invitation_note7'].count($send_error).'</div>';
|
||||||
} else if (count($send_ok) > 0 ) {
|
}
|
||||||
list($name,$surname,$email) = mysqli_fetch_row(sisplet_query("SELECT name, surname,email FROM users WHERE id='$global_user_id'"));
|
else if (count($send_ok) > 0 ) {
|
||||||
|
|
||||||
|
list($name,$surname,$email) = mysqli_fetch_row(sisplet_query("SELECT name, surname,email FROM users WHERE id='$global_user_id'"));
|
||||||
$who='';
|
$who='';
|
||||||
if (trim($name) != '') {
|
|
||||||
|
if (trim($name) != '') {
|
||||||
$who = $name;
|
$who = $name;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trim($surname) != '') {
|
if (trim($surname) != '') {
|
||||||
if ($who != '') {
|
if ($who != '') {
|
||||||
$who .=' ';
|
$who .=' ';
|
||||||
}
|
}
|
||||||
$who .= $surname;
|
$who .= $surname;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($email != '') {
|
if ($email != '') {
|
||||||
if ($who != '') {
|
if ($who != '') {
|
||||||
$who .=' ('.$email.')';
|
$who .=' ('.$email.')';
|
||||||
@ -4069,10 +4076,12 @@ class SurveyInvitationsNew {
|
|||||||
|
|
||||||
// Seznam mailov na katere je bilo uspesno poslano
|
// Seznam mailov na katere je bilo uspesno poslano
|
||||||
if (count($send_ok) > 0) {
|
if (count($send_ok) > 0) {
|
||||||
$return['msg'] .= '<div class="inv_send_message">';
|
$return['msg'] .= '<div class="inv_send_message">';
|
||||||
|
|
||||||
foreach ($send_ok AS $email) {
|
foreach ($send_ok AS $email) {
|
||||||
$return['msg'] .= ' '.$email.'<br/>';
|
$return['msg'] .= ' '.$email.'<br/>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$return['msg'] .= '</div>';
|
$return['msg'] .= '</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4113,7 +4122,8 @@ class SurveyInvitationsNew {
|
|||||||
&& isset($_POST['_token'])
|
&& isset($_POST['_token'])
|
||||||
&& $_SESSION['snd_inv_token'][$this->sid] != null
|
&& $_SESSION['snd_inv_token'][$this->sid] != null
|
||||||
&& $_SESSION['snd_inv_token'][$this->sid] == isset($_POST['_token'])) {
|
&& $_SESSION['snd_inv_token'][$this->sid] == isset($_POST['_token'])) {
|
||||||
# na send smo kliknili samo 1x
|
|
||||||
|
# na send smo kliknili samo 1x
|
||||||
unset($_SESSION['snd_inv_token'][$this->sid]);
|
unset($_SESSION['snd_inv_token'][$this->sid]);
|
||||||
|
|
||||||
session_commit();
|
session_commit();
|
||||||
@ -4137,26 +4147,22 @@ class SurveyInvitationsNew {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Preberemo tip posiljanja (navadna posta, sms...)
|
// Preberemo tip posiljanja (navadna posta, sms...)
|
||||||
//$noMail_type = (isset($_POST['noMailType'])) ? $_POST['noMailType'] : '1';
|
|
||||||
$noMail_type = SurveySession::get('inv_noEmailing_type');
|
$noMail_type = SurveySession::get('inv_noEmailing_type');
|
||||||
|
|
||||||
#Pripravimo arhiv pošiljanj, da dobimo arch_id
|
// Pripravimo arhiv pošiljanj, da dobimo arch_id
|
||||||
$sql_string_all = "SELECT count(*) FROM srv_invitations_recipients WHERE ank_id = '".$this->sid."' AND deleted = '0'";
|
$sql_query_all = sisplet_query("SELECT count(*) FROM srv_invitations_recipients WHERE ank_id = '".$this->sid."' AND deleted = '0'");
|
||||||
$sql_query_all = sisplet_query($sql_string_all);
|
|
||||||
list($count_all) = mysqli_fetch_row($sql_query_all);
|
list($count_all) = mysqli_fetch_row($sql_query_all);
|
||||||
|
|
||||||
$date_sent = date ("Y-m-d H:i:s");
|
$date_sent = date ("Y-m-d H:i:s");
|
||||||
$archive_naslov = 'mailing_'.date("d.m.Y").', '.date("H:i:s");
|
$archive_naslov = 'mailing_'.date("d.m.Y").', '.date("H:i:s");
|
||||||
|
|
||||||
// Naslov in body
|
// Naslov in body
|
||||||
//$subject_text = $lang['srv_inv_message_noemailing_subject'];
|
// polovimo sporočilo in prejemnike
|
||||||
//$body_text = '';
|
$sql_query_m = sisplet_query("SELECT id, subject_text, body_text, reply_to, isdefault, comment, naslov, url FROM srv_invitations_messages WHERE ank_id = '$this->sid' AND isdefault='1'");
|
||||||
# polovimo sporočilo in prejemnike
|
|
||||||
$sql_string_m = "SELECT id, subject_text, body_text, reply_to, isdefault, comment, naslov, url FROM srv_invitations_messages WHERE ank_id = '$this->sid' AND isdefault='1'";
|
|
||||||
$sql_query_m = sisplet_query($sql_string_m);
|
|
||||||
if (mysqli_num_rows($sql_query_m) > 0 ) {
|
if (mysqli_num_rows($sql_query_m) > 0 ) {
|
||||||
$sql_row_m = mysqli_fetch_assoc($sql_query_m);
|
$sql_row_m = mysqli_fetch_assoc($sql_query_m);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$subject_text = $lang['srv_inv_message_noemailing_subject'];
|
$subject_text = $lang['srv_inv_message_noemailing_subject'];
|
||||||
$body_text = '';
|
$body_text = '';
|
||||||
}
|
}
|
||||||
@ -4166,26 +4172,33 @@ class SurveyInvitationsNew {
|
|||||||
$msg_url = $sql_row_m['url'];
|
$msg_url = $sql_row_m['url'];
|
||||||
|
|
||||||
// Vstavimo podatke v arhiv
|
// Vstavimo podatke v arhiv
|
||||||
$sqlString = "INSERT INTO srv_invitations_archive (id, ank_id, date_send, subject_text, body_text, tip, uid, comment, naslov, rec_in_db)"
|
$sqlQuery = sisplet_query("INSERT INTO srv_invitations_archive
|
||||||
." VALUES (NULL , '$this->sid', '$date_sent', '".addslashes($subject_text)."', '".addslashes($body_text)."', '$noMail_type', '$global_user_id', '$comment', '$archive_naslov', '$count_all')";
|
(id, ank_id, date_send, subject_text, body_text, tip, uid, comment, naslov, rec_in_db)
|
||||||
$sqlQuery = sisplet_query($sqlString);
|
VALUES
|
||||||
|
(NULL , '$this->sid', '$date_sent', '".addslashes($subject_text)."', '".addslashes($body_text)."', '$noMail_type', '$global_user_id', '$comment', '$archive_naslov', '$count_all')
|
||||||
|
");
|
||||||
|
|
||||||
$arch_id = mysqli_insert_id($GLOBALS['connect_db']);
|
$arch_id = mysqli_insert_id($GLOBALS['connect_db']);
|
||||||
$duplicated = array();
|
$duplicated = array();
|
||||||
|
|
||||||
|
|
||||||
# polovimo sistemske spremenljivke z vrednostmi
|
// polovimo sistemske spremenljivke z vrednostmi
|
||||||
$strSistemske = "SELECT s.id, s.naslov, s.variable FROM srv_spremenljivka s, srv_grupa g WHERE s.sistem='1' AND s.gru_id=g.id AND g.ank_id='".$this->sid."' AND variable IN("."'" . implode("','",$this->inv_variables)."') ORDER BY g.vrstni_red, s.vrstni_red";
|
$qrySistemske = sisplet_query("SELECT s.id, s.naslov, s.variable
|
||||||
$qrySistemske = sisplet_query($strSistemske);
|
FROM srv_spremenljivka s, srv_grupa g
|
||||||
|
WHERE s.sistem='1' AND s.gru_id=g.id AND g.ank_id='".$this->sid."' AND variable IN ("."'" . implode("','",$this->inv_variables)."')
|
||||||
|
ORDER BY g.vrstni_red, s.vrstni_red
|
||||||
|
");
|
||||||
$sys_vars = array();
|
$sys_vars = array();
|
||||||
$sys_vars_ids = array();
|
$sys_vars_ids = array();
|
||||||
while ($row = mysqli_fetch_assoc($qrySistemske)) {
|
while ($row = mysqli_fetch_assoc($qrySistemske)) {
|
||||||
$sys_vars[$row['id']] = array('id'=>$row['id'], 'variable'=>$row['variable'],'naslov'=>$row['naslov']);
|
$sys_vars[$row['id']] = array('id'=>$row['id'], 'variable'=>$row['variable'],'naslov'=>$row['naslov']);
|
||||||
$sys_vars_ids[] = $row['id'];
|
$sys_vars_ids[] = $row['id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$sqlVrednost = sisplet_query("SELECT spr_id, id AS vre_id, vrstni_red, variable FROM srv_vrednost WHERE spr_id IN(".implode(',',$sys_vars_ids).") ORDER BY vrstni_red ASC ");
|
$sqlVrednost = sisplet_query("SELECT spr_id, id AS vre_id, vrstni_red, variable FROM srv_vrednost WHERE spr_id IN(".implode(',',$sys_vars_ids).") ORDER BY vrstni_red ASC ");
|
||||||
while ($row = mysqli_fetch_assoc($sqlVrednost)) {
|
while ($row = mysqli_fetch_assoc($sqlVrednost)) {
|
||||||
// Ce gre za odnos imamo radio
|
|
||||||
|
// Ce gre za odnos imamo radio
|
||||||
if($sys_vars[$row['spr_id']]['variable'] == 'odnos'){
|
if($sys_vars[$row['spr_id']]['variable'] == 'odnos'){
|
||||||
if(!isset($sys_vars[$row['spr_id']]['vre_id'][$row['vrstni_red']]))
|
if(!isset($sys_vars[$row['spr_id']]['vre_id'][$row['vrstni_red']]))
|
||||||
$sys_vars[$row['spr_id']]['vre_id'][$row['variable']] = $row['vre_id'];
|
$sys_vars[$row['spr_id']]['vre_id'][$row['variable']] = $row['vre_id'];
|
||||||
@ -4196,11 +4209,14 @@ class SurveyInvitationsNew {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# prejeminki besedila
|
// prejeminki besedila
|
||||||
$sql_string = "SELECT id,firstname, lastname, email, password, cookie, phone, salutation, custom, relation FROM srv_invitations_recipients WHERE ank_id = '".$this->sid."' AND deleted='0' AND id IN(".implode(',',$rids).") order by id";
|
$sql_query = sisplet_query("SELECT id, firstname, lastname, email, password, cookie, phone, salutation, custom, relation
|
||||||
$sql_query = sisplet_query($sql_string);
|
FROM srv_invitations_recipients
|
||||||
|
WHERE ank_id = '".$this->sid."' AND deleted='0' AND id IN (".implode(',',$rids).")
|
||||||
|
ORDER BY id
|
||||||
|
");
|
||||||
while ($sql_row = mysqli_fetch_assoc($sql_query)) {
|
while ($sql_row = mysqli_fetch_assoc($sql_query)) {
|
||||||
#password == code
|
|
||||||
$password = $sql_row['password'];
|
$password = $sql_row['password'];
|
||||||
|
|
||||||
$email = $sql_row['email'];
|
$email = $sql_row['email'];
|
||||||
@ -4221,16 +4237,16 @@ class SurveyInvitationsNew {
|
|||||||
$send_users_data[] = $_user_data;
|
$send_users_data[] = $_user_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
# updejtamo userja da mu je bilo poslano
|
// updejtamo userja da mu je bilo poslano
|
||||||
if ( count($send_ok_ids) > 0) {
|
if ( count($send_ok_ids) > 0) {
|
||||||
$sqlString = "UPDATE srv_invitations_recipients SET sent = '1', date_sent = '".$date_sent."' WHERE id IN (".implode(',',$send_ok_ids).")";
|
|
||||||
$sqlQuery = sisplet_query($sqlString);
|
$sqlQuery = sisplet_query("UPDATE srv_invitations_recipients SET sent = '1', date_sent = '".$date_sent."' WHERE id IN (".implode(',',$send_ok_ids).")");
|
||||||
if (!$sqlQuery) {
|
if (!$sqlQuery) {
|
||||||
$error = mysqli_error($GLOBALS['connect_db']);
|
$error = mysqli_error($GLOBALS['connect_db']);
|
||||||
}
|
}
|
||||||
#statuse popravimo samo če vabilo še ni bilo poslano ali je bila napaka
|
|
||||||
$sqlString = "UPDATE srv_invitations_recipients SET last_status = '1' WHERE id IN (".implode(',',$send_ok_ids).") AND last_status IN ('0','2')";
|
// statuse popravimo samo če vabilo še ni bilo poslano ali je bila napaka
|
||||||
$sqlQuery = sisplet_query($sqlString);
|
$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) {
|
if (!$sqlQuery) {
|
||||||
$error = mysqli_error($GLOBALS['connect_db']);
|
$error = mysqli_error($GLOBALS['connect_db']);
|
||||||
}
|
}
|
||||||
@ -4238,11 +4254,11 @@ class SurveyInvitationsNew {
|
|||||||
|
|
||||||
$comment = $_POST['comment'];
|
$comment = $_POST['comment'];
|
||||||
|
|
||||||
#dodajmo še userje v povezovalno tabelo
|
// dodajmo še userje v povezovalno tabelo
|
||||||
if ($arch_id > 0) {
|
if ($arch_id > 0) {
|
||||||
# updejtamo še tabelo arhivov
|
|
||||||
$sqlString = "UPDATE srv_invitations_archive SET cnt_succsess='".count($send_ok_ids)."' WHERE id ='$arch_id'";
|
// updejtamo še tabelo arhivov
|
||||||
$sqlQuery = sisplet_query($sqlString);
|
$sqlQuery = sisplet_query("UPDATE srv_invitations_archive SET cnt_succsess='".count($send_ok_ids)."' WHERE id ='$arch_id'");
|
||||||
if (!$sqlQuery) {
|
if (!$sqlQuery) {
|
||||||
$error = mysqli_error($GLOBALS['connect_db']);
|
$error = mysqli_error($GLOBALS['connect_db']);
|
||||||
}
|
}
|
||||||
@ -4282,10 +4298,12 @@ class SurveyInvitationsNew {
|
|||||||
$strInsertUserstatus = array();
|
$strInsertUserstatus = array();
|
||||||
|
|
||||||
foreach ($send_users_data AS $user_data) {
|
foreach ($send_users_data AS $user_data) {
|
||||||
#spodnji query nekako ni dobro naredil updejta ker je zamenjal last_status, po novem po potrebi samo zamenjamo kodo.
|
|
||||||
#$strInsert = "INSERT INTO srv_user (ank_id, email, cookie, pass, last_status, time_insert, inv_res_id) VALUES ('".$this->sid."', '".$user_data['email']."', '".$user_data['cookie']."', '".$user_data['password']."', '".$user_data['status']."', NOW(), '".$user_data['id']."') ON DUPLICATE KEY UPDATE last_status=VALUES(last_status), inv_res_id=VALUES(inv_res_id)";
|
$_r = sisplet_query("INSERT INTO srv_user
|
||||||
$strInsert = "INSERT INTO srv_user (ank_id, email, cookie, pass, last_status, time_insert, inv_res_id) VALUES ('".$this->sid."', '".$user_data['email']."', '".$user_data['cookie']."', '".$user_data['password']."', '".$user_data['status']."', NOW(), '".$user_data['id']."') ON DUPLICATE KEY UPDATE cookie = '".$user_data['cookie']."', pass='".$user_data['password']."'";
|
(ank_id, email, cookie, pass, last_status, time_insert, inv_res_id)
|
||||||
$_r = sisplet_query($strInsert);
|
VALUES
|
||||||
|
('".$this->sid."', '".$user_data['email']."', '".$user_data['cookie']."', '".$user_data['password']."', '".$user_data['status']."', NOW(), '".$user_data['id']."') ON DUPLICATE KEY UPDATE cookie = '".$user_data['cookie']."', pass='".$user_data['password']."'
|
||||||
|
");
|
||||||
$usr_id = mysqli_insert_id($GLOBALS['connect_db']);
|
$usr_id = mysqli_insert_id($GLOBALS['connect_db']);
|
||||||
sisplet_query("COMMIT");
|
sisplet_query("COMMIT");
|
||||||
|
|
||||||
@ -4301,24 +4319,25 @@ class SurveyInvitationsNew {
|
|||||||
$strInsertDataText[] = "('".$sid."','".$spremenljivka['vre_id']."','".trim($user_data[$_user_variable])."','".$usr_id."')";
|
$strInsertDataText[] = "('".$sid."','".$spremenljivka['vre_id']."','".trim($user_data[$_user_variable])."','".$usr_id."')";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
// lahko da user že obstaja in je šlo za duplicated keys
|
// lahko da user že obstaja in je šlo za duplicated keys
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# vstavimo v srv_userbase
|
// vstavimo v srv_userbase
|
||||||
if (count($strInsertUserbase) > 0) {
|
if (count($strInsertUserbase) > 0) {
|
||||||
$strInsert = "INSERT INTO srv_userbase (usr_id, tip, datetime, admin_id) VALUES ";
|
$strInsert = "INSERT INTO srv_userbase (usr_id, tip, datetime, admin_id) VALUES ";
|
||||||
$strInsert .= implode(',',$strInsertUserbase);
|
$strInsert .= implode(',',$strInsertUserbase);
|
||||||
sisplet_query($strInsert);
|
sisplet_query($strInsert);
|
||||||
}
|
}
|
||||||
# vstavimo v srv_userstatus
|
// vstavimo v srv_userstatus
|
||||||
if (count($strInsertUserstatus) > 0) {
|
if (count($strInsertUserstatus) > 0) {
|
||||||
$strInsert = "INSERT INTO srv_userstatus (usr_id, tip, status, datetime) VALUES ";
|
$strInsert = "INSERT INTO srv_userstatus (usr_id, tip, status, datetime) VALUES ";
|
||||||
$strInsert .= implode(',',$strInsertUserstatus);
|
$strInsert .= implode(',',$strInsertUserstatus);
|
||||||
sisplet_query($strInsert);
|
sisplet_query($strInsert);
|
||||||
}
|
}
|
||||||
# vstavimo v srv_data_text
|
// vstavimo v srv_data_text
|
||||||
if (count($strInsertDataText) > 0) {
|
if (count($strInsertDataText) > 0) {
|
||||||
$strInsert = "INSERT INTO srv_data_text".$this->db_table." (spr_id, vre_id, text, usr_id) VALUES ";
|
$strInsert = "INSERT INTO srv_data_text".$this->db_table." (spr_id, vre_id, text, usr_id) VALUES ";
|
||||||
$strInsert .= implode(',',$strInsertDataText);
|
$strInsert .= implode(',',$strInsertDataText);
|
||||||
@ -4330,36 +4349,42 @@ class SurveyInvitationsNew {
|
|||||||
|
|
||||||
|
|
||||||
if (count($send_ok) > 0 ) {
|
if (count($send_ok) > 0 ) {
|
||||||
list($name,$surname,$email) = mysqli_fetch_row(sisplet_query("SELECT name, surname,email FROM users WHERE id='$global_user_id'"));
|
|
||||||
$who='';
|
list($name,$surname,$email) = mysqli_fetch_row(sisplet_query("SELECT name, surname, email FROM users WHERE id='$global_user_id'"));
|
||||||
|
$who='';
|
||||||
|
|
||||||
if (trim($name) != '') {
|
if (trim($name) != '') {
|
||||||
$who = $name;
|
$who = $name;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trim($surname) != '') {
|
if (trim($surname) != '') {
|
||||||
if ($who != '') {
|
if ($who != '') {
|
||||||
$who .=' ';
|
$who .=' ';
|
||||||
}
|
}
|
||||||
$who .= $surname;
|
$who .= $surname;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($email != '') {
|
if ($email != '') {
|
||||||
if ($who != '') {
|
if ($who != '') {
|
||||||
$who .=' ('.$email.')';
|
$who .=' ('.$email.')';
|
||||||
} else {
|
} else {
|
||||||
$who = $email;
|
$who = $email;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$return['error'] = '0';
|
$return['error'] = '0';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$return['error'] = '0';
|
$return['error'] = '0';
|
||||||
$return['msg'] = '<div class="inv_send_message">'.'<strong>'.$lang['srv_invitation_note9'].'</strong></div><br/>';
|
$return['msg'] = '<div class="inv_send_message">'.'<strong>'.$lang['srv_invitation_note9'].'</strong></div><br/>';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
else {
|
||||||
#old session token
|
#old session token
|
||||||
$return['msg'] = '<div class="inv_send_message"><span class="red strong">'.$lang['srv_invitation_note13'].'</span>'.'</div>';
|
$return['msg'] = '<div class="inv_send_message"><span class="red strong">'.$lang['srv_invitation_note13'].'</span>'.'</div>';
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
#nimamo $rids
|
#nimamo $rids
|
||||||
$return['msg'] = '<div class="inv_send_message">'.$lang['srv_invitation_note14'].'</div>';
|
$return['msg'] = '<div class="inv_send_message">'.$lang['srv_invitation_note14'].'</div>';
|
||||||
}
|
}
|
||||||
@ -4368,7 +4393,6 @@ class SurveyInvitationsNew {
|
|||||||
Common::getInstance()->Init($anketa);
|
Common::getInstance()->Init($anketa);
|
||||||
Common::getInstance()->updateEditStamp();
|
Common::getInstance()->updateEditStamp();
|
||||||
|
|
||||||
#$this->viewAarchive($return['msg']);
|
|
||||||
$this->viewSendMailFinish($return['msg']);
|
$this->viewSendMailFinish($return['msg']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user