Dodajanje squalo posiljanja v vabila - V DELU

This commit is contained in:
pero1203 2021-03-17 12:09:58 +01:00
parent 6751beb39c
commit 01879e4253
9 changed files with 148 additions and 19 deletions

View File

@ -48,15 +48,13 @@ class SurveyInvitationsNew {
$this->surveySettings = SurveyInfo::getInstance()->getSurveyRow(); $this->surveySettings = SurveyInfo::getInstance()->getSurveyRow();
#koliko respondentov je že v bazi # koliko respondentov je že v bazi
$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);
$sql_row_all = mysqli_fetch_row($sql_query_all); $sql_row_all = mysqli_fetch_row($sql_query_all);
$this->count_all = (int)$sql_row_all[0]; $this->count_all = (int)$sql_row_all[0];
#preverimo ali prikazujemo nov ali star način odvisno od nastavitve v misc # preverimo ali prikazujemo nov ali star način odvisno od nastavitve v misc
$strSelect = "SELECT count(*) FROM srv_anketa AS a WHERE id ='".$this->sid."' AND insert_time > (SELECT value FROM misc WHERE what = 'invitationTrackingStarted' LIMIT 1)"; $sql_query = sisplet_query("SELECT count(*) FROM srv_anketa AS a WHERE id ='".$this->sid."' AND insert_time > (SELECT value FROM misc WHERE what = 'invitationTrackingStarted' LIMIT 1)");
$sql_query = sisplet_query($strSelect);
list($newTracking) = mysqli_fetch_row($sql_query); list($newTracking) = mysqli_fetch_row($sql_query);
$this->newTracking = (int)$newTracking > 0 ? true : false; $this->newTracking = (int)$newTracking > 0 ? true : false;
@ -274,7 +272,7 @@ class SurveyInvitationsNew {
} else if ($action == 'invListEditSave') { } else if ($action == 'invListEditSave') {
$this->invListEditSave(); $this->invListEditSave();
} else if ($action == 'editRecList') { } else if ($action == 'editRecList') {
# $this->editRecList();
$doEdit = $_SESSION['inv_edit_rec_profile'][$this->sid] == 'true' ? true : false; $doEdit = $_SESSION['inv_edit_rec_profile'][$this->sid] == 'true' ? true : false;
if ($doEdit) { if ($doEdit) {
$this->showEditRecList(); $this->showEditRecList();
@ -8033,15 +8031,13 @@ class SurveyInvitationsNew {
// Gorenje tega nima // Gorenje tega nima
if (!Common::checkModule('gorenje')){ if (!Common::checkModule('gorenje')){
echo '<td style="padding-right:10px;vertical-align: top;">'; echo '<td style="padding-right:10px;vertical-align: top;">';
echo '<fieldset class="inv_fieldset"><legend>'.$lang['srv_email_setting_title'].'</legend>'; echo '<fieldset class="inv_fieldset"><legend>'.$lang['srv_email_setting_title'].'</legend>';
echo '<div class="inv_filedset_inline_div">'; echo '<div class="inv_filedset_inline_div">';
echo '<div id="surveyInvitationSettingServer">'; echo '<div id="surveyInvitationSettingServer">';
//echo '<p>V delu...</p>';
$this->viewServerSettings(); $this->viewServerSettings();
echo '</div>'; echo '</div>';
echo '</div>'; echo '</div>';
@ -10066,6 +10062,7 @@ class SurveyInvitationsNew {
global $mysql_database_name; global $mysql_database_name;
global $aai_instalacija; global $aai_instalacija;
$row = SurveyInfo::getInstance()->getSurveyRow(); $row = SurveyInfo::getInstance()->getSurveyRow();
echo '<form name="settingsanketa_' . $row['id'] . '" action="ajax.php?a=editanketasettings&m=inv_server" method="post" autocomplete="off">' . "\n\r"; echo '<form name="settingsanketa_' . $row['id'] . '" action="ajax.php?a=editanketasettings&m=inv_server" method="post" autocomplete="off">' . "\n\r";
@ -10082,6 +10079,34 @@ class SurveyInvitationsNew {
if(($admin_type == 0) && ($mysql_database_name == 'www1kasi' || $mysql_database_name == 'test1kasi' || $mysql_database_name == 'real1kasi')) if(($admin_type == 0) && ($mysql_database_name == 'www1kasi' || $mysql_database_name == 'test1kasi' || $mysql_database_name == 'real1kasi'))
$enabled1ka = true; $enabled1ka = true;
// Squalo
$squalo = new SurveyInvitationsSqualo($this->sid);
if($squalo->squaloEnabled()){
// Vklop squalo
echo '<div class="squalo_switch">';
echo '<span class="bold">'.$lang['srv_squalo'].':</span>&nbsp;';
echo '<label><input type="checkbox" name="SqualoMode" value="1" '.($squalo->squaloActive() ? 'checked ="checked" ' : '').' style="vertical-align:-2px;" onclick="$(\'#send_mail_mode0, #send_mail_mode1\').hide(); $(\'#send_mail_mode2\').show();">';
echo $lang['srv_squalo_sending'].' </label>';
echo '</div>';
// Squalo nastavitve...
echo '<div class="squalo_settings '.(!$squalo->squaloActive() ? ' displayNone' : '').'">';
echo $lang['srv_squalo_active'];
echo '</div>';
}
// Izbira streznika
echo '<div class="mail_mode_switch '.($squalo->squaloActive() ? ' displayNone' : '').'">';
// Opozorilo, ce imamo vklopljena vabila, da gre za iste nastavitve // Opozorilo, ce imamo vklopljena vabila, da gre za iste nastavitve
echo '<p class="red bold">'.$lang['srv_email_server_settings_warning'].'</p>'; echo '<p class="red bold">'.$lang['srv_email_server_settings_warning'].'</p>';
@ -10110,9 +10135,12 @@ class SurveyInvitationsNew {
echo Help :: display('srv_mail_mode'); echo Help :: display('srv_mail_mode');
echo '</div>';
#1KA #1KA
$enkaSettings = $MA->get1KASettings($raziskave=true); $enkaSettings = $MA->get1KASettings($raziskave=true);
echo '<div id="send_mail_mode0" '.(!$MA->is1KA() ? ' class="displayNone"' : '').'>'; echo '<div id="send_mail_mode0" '.(!$MA->is1KA() || $squalo->squaloActive() ? ' class="displayNone"' : '').'>';
echo '<br /><span class="bold">'.$lang['srv_email_setting_settings'].'</span>'; echo '<br /><span class="bold">'.$lang['srv_email_setting_settings'].'</span>';
echo '<br />'; echo '<br />';
# from # from
@ -10143,7 +10171,7 @@ class SurveyInvitationsNew {
#GMAIL - Google #GMAIL - Google
$enkaSettings = $MA->getGoogleSettings(); $enkaSettings = $MA->getGoogleSettings();
echo '<div id="send_mail_mode1" '.(!$MA->isGoogle() ? ' class="displayNone"' : '').'>'; echo '<div id="send_mail_mode1" '.(!$MA->isGoogle() || $squalo->squaloActive() ? ' class="displayNone"' : '').'>';
echo '<br /><span class="italic">'.$lang['srv_email_setting_adapter1_note'].'</span><br />'; echo '<br /><span class="italic">'.$lang['srv_email_setting_adapter1_note'].'</span><br />';
echo '<br /><span class="bold">'.$lang['srv_email_setting_settings'].'</span><br />'; echo '<br /><span class="bold">'.$lang['srv_email_setting_settings'].'</span><br />';
# from # from
@ -10159,7 +10187,7 @@ class SurveyInvitationsNew {
#SMTP #SMTP
$enkaSettings = $MA->getSMTPSettings(); $enkaSettings = $MA->getSMTPSettings();
echo '<div id="send_mail_mode2" '.(!$MA->isSMTP() ? ' class="displayNone"' : '').'>'; echo '<div id="send_mail_mode2" '.(!$MA->isSMTP() || $squalo->squaloActive() ? ' class="displayNone"' : '').'>';
echo '<br /><span class="italic">'.$lang['srv_email_setting_adapter2_note'].'</span><br />'; echo '<br /><span class="italic">'.$lang['srv_email_setting_adapter2_note'].'</span><br />';
echo '<br /><span class="bold">'.$lang['srv_email_setting_settings'].'</span><br />'; echo '<br /><span class="bold">'.$lang['srv_email_setting_settings'].'</span><br />';
# from - NICE # from - NICE

View File

@ -2,7 +2,7 @@
/** /**
* *
* Class ki vsebuje funkcije APIJA (prijava, registracija v 1ko) * Class ki vsebuje funkcije Squalo APIJA (dodajanje prejemnikov, posiljanje...)
* *
*/ */
@ -37,16 +37,25 @@ class SqualoApi {
// Decode json response // Decode json response
$response_array = json_decode($response, true); $response_array = json_decode($response, true);
// Zalogiramo kaj se je dogajalo
$SL = new SurveyLog();
// Error // Error
if($response_array['errorCode'] != '0'){ if($response_array['errorCode'] != '0'){
$result['error'] = $response_array["errorMessage"]. ' (code '.$response_array["errorCode"].')'; $result['error'] = $response_array["errorMessage"]. ' (code '.$response_array["errorCode"].')';
$result['success'] = false; $result['success'] = false;
$SL->addMessage(SurveyLog::MAILER, "NAPAKA pri SQUALO API klicu ('.$action.')! ".$result['error']);
} }
else{ else{
$result = $response_array; $result = $response_array;
$result['success'] = true; $result['success'] = true;
$SL->addMessage(SurveyLog::MAILER, "USPEŠEN SQUALO API klic ('.$action.').");
} }
$SL->write();
return $result; return $result;
} }

View File

@ -0,0 +1,64 @@
<?php
/**
*
* Class ki vsebuje funkcije potrebne za posiljanje vabil preko SQUALO
*
*/
class SurveyInvitationsSqualo {
private $anketa;
private $squaloEnabled;
private $squaloActive;
public function __construct($anketa){
$this->anketa = $anketa;
// Preverimo ce je squalo omogocen na tej instalaciji in anketi
$this->squaloEnabled = $this->checkSqualoEnabled() ? true : false;
// Preverimo ce je squalo vklopljen na anketi
$this->squaloActive = $this->checkSqualoActive() ? true : false;
}
public function squaloEnabled(){
return $this->squaloEnabled;
}
public function squaloActive(){
return $this->squaloActive;
}
// Preverimo ce je squalo omogocen na instalaciji
private function checkSqualoEnabled(){
global $mysql_database_name;
global $admin_type;
global $squalo_user;
global $squalo_key;
// Zaenkrat imajo squalo samo admini
if($admin_type != 0)
return false;
// Squalo je omogocen samo na testu, www in virtualkah
if($mysql_database_name != 'www1kasi' && $mysql_database_name != 'test1kasi' && $mysql_database_name != 'real1kasi')
return false;
// Zaenkrat imajo squalo samo admini
if(!isset($squalo_user) || $squalo_user == '' || !isset($squalo_key) || $squalo_key == '')
return false;
return false;
}
// Preverimo ce je squalo vklopljen na anketi
private function checkSqualoActive(){
return false;
}
}

10
composer.lock generated
View File

@ -1912,16 +1912,16 @@
"packages-dev": [ "packages-dev": [
{ {
"name": "filp/whoops", "name": "filp/whoops",
"version": "2.9.2", "version": "2.10.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/filp/whoops.git", "url": "https://github.com/filp/whoops.git",
"reference": "df7933820090489623ce0be5e85c7e693638e536" "reference": "6ecda5217bf048088b891f7403b262906be5a957"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/filp/whoops/zipball/df7933820090489623ce0be5e85c7e693638e536", "url": "https://api.github.com/repos/filp/whoops/zipball/6ecda5217bf048088b891f7403b262906be5a957",
"reference": "df7933820090489623ce0be5e85c7e693638e536", "reference": "6ecda5217bf048088b891f7403b262906be5a957",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1969,7 +1969,7 @@
"throwable", "throwable",
"whoops" "whoops"
], ],
"time": "2021-01-24 12:00:00" "time": "2021-03-16 12:00:00"
}, },
{ {
"name": "kint-php/kint", "name": "kint-php/kint",

View File

@ -7407,6 +7407,12 @@ $lang = array (
'srv_pc_unavailable' => "Prikaz slike ni mogoč", 'srv_pc_unavailable' => "Prikaz slike ni mogoč",
// SQUALO //
'srv_squalo' => "Squalo",
'srv_squalo_sending' => "Pošiljaj preko aplikacije Squalo",
'srv_squalo_active' => "Squalo pošiljanje je vklopljeno.",
// NAROCILA // // NAROCILA //
'srv_narocila' => "Naročila", 'srv_narocila' => "Naročila",
'srv_narocila_my' => "Moja naročila", 'srv_narocila_my' => "Moja naročila",

View File

@ -7292,6 +7292,14 @@ $lang = array (
'srv_pc_unavailable' => "Image unavailable", 'srv_pc_unavailable' => "Image unavailable",
// SQUALO //
'srv_squalo' => "Squalo",
'srv_squalo_sending' => "Sending with application Squalo",
'srv_squalo_active' => "Sending with Squalo is turned on.",
// NAROCILA // // NAROCILA //
'srv_narocila' => "Orders", 'srv_narocila' => "Orders",
'srv_narocila_my' => "My orders", 'srv_narocila_my' => "My orders",

View File

@ -9471,3 +9471,15 @@ UPDATE srv_gdpr_anketa SET export_legal_eng = export_legal_slo;
UPDATE srv_gdpr_anketa SET note_eng = note_slo; UPDATE srv_gdpr_anketa SET note_eng = note_slo;
UPDATE misc SET value='21.02.16' WHERE what="version"; UPDATE misc SET value='21.02.16' WHERE what="version";
## Squalo nastavitve na anketi
CREATE TABLE srv_squalo_anketa(
id int(11) NOT NULL auto_increment,
ank_id int(11) NOT NULL,
active ENUM('0', '1') NOT NULL DEFAULT '0',
PRIMARY KEY (id),
UNIQUE KEY (ank_id),
CONSTRAINT fk_srv_squalo_anketa_ank_id FOREIGN KEY (ank_id) REFERENCES srv_anketa (id) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
UPDATE misc SET value='21.03.17' WHERE what="version";

View File

@ -947,6 +947,7 @@ return array(
'SurveyInfo' => $baseDir . '/admin/survey/classes/class.SurveyInfo.php', 'SurveyInfo' => $baseDir . '/admin/survey/classes/class.SurveyInfo.php',
'SurveyInspect' => $baseDir . '/admin/survey/classes/class.SurveyInpect.php', 'SurveyInspect' => $baseDir . '/admin/survey/classes/class.SurveyInpect.php',
'SurveyInvitationsNew' => $baseDir . '/admin/survey/classes/surveyEmails/class.SurveyInvitationsNew.php', 'SurveyInvitationsNew' => $baseDir . '/admin/survey/classes/surveyEmails/class.SurveyInvitationsNew.php',
'SurveyInvitationsSqualo' => $baseDir . '/admin/survey/modules/mod_squalo/class.SurveyInvitationsSqualo.php',
'SurveyJsonSurveyData' => $baseDir . '/admin/survey/modules/mod_json_survey_export/class.SurveyJsonSurveyData.php', 'SurveyJsonSurveyData' => $baseDir . '/admin/survey/modules/mod_json_survey_export/class.SurveyJsonSurveyData.php',
'SurveyLanguageTechnology' => $baseDir . '/admin/survey/classes/class.SurveyLanguageTechnology.php', 'SurveyLanguageTechnology' => $baseDir . '/admin/survey/classes/class.SurveyLanguageTechnology.php',
'SurveyList' => $baseDir . '/admin/survey/classes/class.SurveyList.php', 'SurveyList' => $baseDir . '/admin/survey/classes/class.SurveyList.php',

View File

@ -1151,6 +1151,7 @@ class ComposerStaticInit6b03163c371c5541881b55b762b8c779
'SurveyInfo' => __DIR__ . '/../..' . '/admin/survey/classes/class.SurveyInfo.php', 'SurveyInfo' => __DIR__ . '/../..' . '/admin/survey/classes/class.SurveyInfo.php',
'SurveyInspect' => __DIR__ . '/../..' . '/admin/survey/classes/class.SurveyInpect.php', 'SurveyInspect' => __DIR__ . '/../..' . '/admin/survey/classes/class.SurveyInpect.php',
'SurveyInvitationsNew' => __DIR__ . '/../..' . '/admin/survey/classes/surveyEmails/class.SurveyInvitationsNew.php', 'SurveyInvitationsNew' => __DIR__ . '/../..' . '/admin/survey/classes/surveyEmails/class.SurveyInvitationsNew.php',
'SurveyInvitationsSqualo' => __DIR__ . '/../..' . '/admin/survey/modules/mod_squalo/class.SurveyInvitationsSqualo.php',
'SurveyJsonSurveyData' => __DIR__ . '/../..' . '/admin/survey/modules/mod_json_survey_export/class.SurveyJsonSurveyData.php', 'SurveyJsonSurveyData' => __DIR__ . '/../..' . '/admin/survey/modules/mod_json_survey_export/class.SurveyJsonSurveyData.php',
'SurveyLanguageTechnology' => __DIR__ . '/../..' . '/admin/survey/classes/class.SurveyLanguageTechnology.php', 'SurveyLanguageTechnology' => __DIR__ . '/../..' . '/admin/survey/classes/class.SurveyLanguageTechnology.php',
'SurveyList' => __DIR__ . '/../..' . '/admin/survey/classes/class.SurveyList.php', 'SurveyList' => __DIR__ . '/../..' . '/admin/survey/classes/class.SurveyList.php',