diff --git a/admin/survey/classes/surveyEmails/class.SurveyInvitationsNew.php b/admin/survey/classes/surveyEmails/class.SurveyInvitationsNew.php index 674fc622f..7f87c368f 100644 --- a/admin/survey/classes/surveyEmails/class.SurveyInvitationsNew.php +++ b/admin/survey/classes/surveyEmails/class.SurveyInvitationsNew.php @@ -48,15 +48,13 @@ class SurveyInvitationsNew { $this->surveySettings = SurveyInfo::getInstance()->getSurveyRow(); - #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($sql_string_all); + # koliko respondentov je že v bazi + $sql_query_all = sisplet_query("SELECT count(*) FROM srv_invitations_recipients WHERE ank_id = '".$this->sid."' AND deleted = '0'"); $sql_row_all = mysqli_fetch_row($sql_query_all); $this->count_all = (int)$sql_row_all[0]; - #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($strSelect); + # preverimo ali prikazujemo nov ali star način odvisno od nastavitve v misc + $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)"); list($newTracking) = mysqli_fetch_row($sql_query); $this->newTracking = (int)$newTracking > 0 ? true : false; @@ -274,7 +272,7 @@ class SurveyInvitationsNew { } else if ($action == 'invListEditSave') { $this->invListEditSave(); } else if ($action == 'editRecList') { -# $this->editRecList(); + $doEdit = $_SESSION['inv_edit_rec_profile'][$this->sid] == 'true' ? true : false; if ($doEdit) { $this->showEditRecList(); @@ -8033,15 +8031,13 @@ class SurveyInvitationsNew { // Gorenje tega nima if (!Common::checkModule('gorenje')){ + echo ''; echo '
'.$lang['srv_email_setting_title'].''; echo '
'; echo '
'; - - //echo '

V delu...

'; $this->viewServerSettings(); - echo '
'; echo '
'; @@ -10065,6 +10061,7 @@ class SurveyInvitationsNew { global $global_user_id; global $mysql_database_name; global $aai_instalacija; + $row = SurveyInfo::getInstance()->getSurveyRow(); @@ -10081,7 +10078,35 @@ class SurveyInvitationsNew { // Admini na testu, www in virtualkah imajo 1ka smtp if(($admin_type == 0) && ($mysql_database_name == 'www1kasi' || $mysql_database_name == 'test1kasi' || $mysql_database_name == 'real1kasi')) $enabled1ka = true; + + // Squalo + $squalo = new SurveyInvitationsSqualo($this->sid); + if($squalo->squaloEnabled()){ + + // Vklop squalo + echo '
'; + + echo ''.$lang['srv_squalo'].': '; + + echo ''; + + echo '
'; + + + // Squalo nastavitve... + echo '
'; + + echo $lang['srv_squalo_active']; + + echo '
'; + } + + + // Izbira streznika + echo '
'; + // Opozorilo, ce imamo vklopljena vabila, da gre za iste nastavitve echo '

'.$lang['srv_email_server_settings_warning'].'

'; @@ -10109,10 +10134,13 @@ class SurveyInvitationsNew { echo $lang['srv_email_setting_adapter2'].' '; echo Help :: display('srv_mail_mode'); + + echo '
'; + #1KA $enkaSettings = $MA->get1KASettings($raziskave=true); - echo '
is1KA() ? ' class="displayNone"' : '').'>'; + echo '
is1KA() || $squalo->squaloActive() ? ' class="displayNone"' : '').'>'; echo '
'.$lang['srv_email_setting_settings'].''; echo '
'; # from @@ -10143,7 +10171,7 @@ class SurveyInvitationsNew { #GMAIL - Google $enkaSettings = $MA->getGoogleSettings(); - echo '
isGoogle() ? ' class="displayNone"' : '').'>'; + echo '
isGoogle() || $squalo->squaloActive() ? ' class="displayNone"' : '').'>'; echo '
'.$lang['srv_email_setting_adapter1_note'].'
'; echo '
'.$lang['srv_email_setting_settings'].'
'; # from @@ -10159,7 +10187,7 @@ class SurveyInvitationsNew { #SMTP $enkaSettings = $MA->getSMTPSettings(); - echo '
isSMTP() ? ' class="displayNone"' : '').'>'; + echo '
isSMTP() || $squalo->squaloActive() ? ' class="displayNone"' : '').'>'; echo '
'.$lang['srv_email_setting_adapter2_note'].'
'; echo '
'.$lang['srv_email_setting_settings'].'
'; # from - NICE diff --git a/admin/survey/modules/mod_squalo/class.SqualoApi.php b/admin/survey/modules/mod_squalo/class.SqualoApi.php index ce821357a..3750756b1 100644 --- a/admin/survey/modules/mod_squalo/class.SqualoApi.php +++ b/admin/survey/modules/mod_squalo/class.SqualoApi.php @@ -2,7 +2,7 @@ /** * - * Class ki vsebuje funkcije APIJA (prijava, registracija v 1ko) + * Class ki vsebuje funkcije Squalo APIJA (dodajanje prejemnikov, posiljanje...) * */ @@ -37,15 +37,24 @@ class SqualoApi { // Decode json response $response_array = json_decode($response, true); + // Zalogiramo kaj se je dogajalo + $SL = new SurveyLog(); + // Error if($response_array['errorCode'] != '0'){ $result['error'] = $response_array["errorMessage"]. ' (code '.$response_array["errorCode"].')'; $result['success'] = false; + + $SL->addMessage(SurveyLog::MAILER, "NAPAKA pri SQUALO API klicu ('.$action.')! ".$result['error']); } else{ $result = $response_array; $result['success'] = true; + + $SL->addMessage(SurveyLog::MAILER, "USPEŠEN SQUALO API klic ('.$action.')."); } + + $SL->write(); return $result; } diff --git a/admin/survey/modules/mod_squalo/class.SurveyInvitationsSqualo.php b/admin/survey/modules/mod_squalo/class.SurveyInvitationsSqualo.php new file mode 100644 index 000000000..83379ce2a --- /dev/null +++ b/admin/survey/modules/mod_squalo/class.SurveyInvitationsSqualo.php @@ -0,0 +1,64 @@ +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; + } +} \ No newline at end of file diff --git a/composer.lock b/composer.lock index 79958fab7..ce873ecd5 100644 --- a/composer.lock +++ b/composer.lock @@ -1912,16 +1912,16 @@ "packages-dev": [ { "name": "filp/whoops", - "version": "2.9.2", + "version": "2.10.0", "source": { "type": "git", "url": "https://github.com/filp/whoops.git", - "reference": "df7933820090489623ce0be5e85c7e693638e536" + "reference": "6ecda5217bf048088b891f7403b262906be5a957" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filp/whoops/zipball/df7933820090489623ce0be5e85c7e693638e536", - "reference": "df7933820090489623ce0be5e85c7e693638e536", + "url": "https://api.github.com/repos/filp/whoops/zipball/6ecda5217bf048088b891f7403b262906be5a957", + "reference": "6ecda5217bf048088b891f7403b262906be5a957", "shasum": "" }, "require": { @@ -1969,7 +1969,7 @@ "throwable", "whoops" ], - "time": "2021-01-24 12:00:00" + "time": "2021-03-16 12:00:00" }, { "name": "kint-php/kint", diff --git a/lang/1.php b/lang/1.php index 89ca4de75..a947b3091 100644 --- a/lang/1.php +++ b/lang/1.php @@ -7406,6 +7406,12 @@ $lang = array ( 'srv_export_2_xls_button' => "Izvozi v Excel", '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 // 'srv_narocila' => "Naročila", diff --git a/lang/2.php b/lang/2.php index efff1ce74..64effc641 100644 --- a/lang/2.php +++ b/lang/2.php @@ -7291,6 +7291,14 @@ $lang = array ( 'srv_export_2_xls_button' => "Export to Excel", '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 // 'srv_narocila' => "Orders", diff --git a/sql/update2.sql b/sql/update2.sql index 237917ae7..e53dd106e 100644 --- a/sql/update2.sql +++ b/sql/update2.sql @@ -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 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"; diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 16b646449..2ea0928c1 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -947,6 +947,7 @@ return array( 'SurveyInfo' => $baseDir . '/admin/survey/classes/class.SurveyInfo.php', 'SurveyInspect' => $baseDir . '/admin/survey/classes/class.SurveyInpect.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', 'SurveyLanguageTechnology' => $baseDir . '/admin/survey/classes/class.SurveyLanguageTechnology.php', 'SurveyList' => $baseDir . '/admin/survey/classes/class.SurveyList.php', diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 974b6dd62..24a1f8404 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -1151,6 +1151,7 @@ class ComposerStaticInit6b03163c371c5541881b55b762b8c779 'SurveyInfo' => __DIR__ . '/../..' . '/admin/survey/classes/class.SurveyInfo.php', 'SurveyInspect' => __DIR__ . '/../..' . '/admin/survey/classes/class.SurveyInpect.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', 'SurveyLanguageTechnology' => __DIR__ . '/../..' . '/admin/survey/classes/class.SurveyLanguageTechnology.php', 'SurveyList' => __DIR__ . '/../..' . '/admin/survey/classes/class.SurveyList.php',