From 0e354fd8bba4c6aac46bc73d9d2ec1c1d8ce9100 Mon Sep 17 00:00:00 2001 From: pero1203 Date: Sun, 1 Nov 2020 20:50:45 +0100 Subject: [PATCH 01/77] Popravek includa za placevanje s paypalom --- frontend/payments/classes/class.UserNarocilaPaypal.php | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/payments/classes/class.UserNarocilaPaypal.php b/frontend/payments/classes/class.UserNarocilaPaypal.php index 7b89c6594..a64b9a041 100644 --- a/frontend/payments/classes/class.UserNarocilaPaypal.php +++ b/frontend/payments/classes/class.UserNarocilaPaypal.php @@ -9,6 +9,7 @@ use PayPalCheckoutSdk\Core\PayPalHttpClient; use PayPalCheckoutSdk\Core\SandboxEnvironment; +use PayPalCheckoutSdk\Core\ProductionEnvironment; use PayPalCheckoutSdk\Orders\OrdersCreateRequest; use PayPalCheckoutSdk\Orders\OrdersCaptureRequest; From f125d4a9f28404df136c990a9ec463d161199c0b Mon Sep 17 00:00:00 2001 From: pero1203 Date: Mon, 2 Nov 2020 12:33:09 +0100 Subject: [PATCH 02/77] Nastavitev za onemogocenje naknadnega izpolnjevanja se ignorira tudi pri managerjih --- main/survey/app/Controllers/BodyController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/survey/app/Controllers/BodyController.php b/main/survey/app/Controllers/BodyController.php index 5e19a31e2..6a4f6fee9 100644 --- a/main/survey/app/Controllers/BodyController.php +++ b/main/survey/app/Controllers/BodyController.php @@ -1877,7 +1877,7 @@ class BodyController extends Controller Js::getInstance()->generateBranchingJS(); // Disable odgovorov, ce je ze izpolnjeval to stran in ima vklopljeno nastavitev, da ni dovoljeno naknadno vnasanje odogovorov - if($rowa['subsequent_answers'] == '0' && $admin_type != '0'){ + if($rowa['subsequent_answers'] == '0' && $admin_type != '0' && $admin_type != '1'){ // Preverimo, ce je uporabnik ze bil na strani if(Check::getInstance()->check_subsequent_visit()){ From ac8ef13043f68964a69233a7a0824cd443e92b82 Mon Sep 17 00:00:00 2001 From: pero1203 Date: Wed, 4 Nov 2020 11:29:56 +0100 Subject: [PATCH 03/77] Popravki manjsih bugov pri evoli --- .../organizational_employeeship_meter_form.php | 4 ++-- .../mod_EVOLI/forms/quality_climate_form.php | 4 ++-- .../modules/mod_EVOLI/forms/team_meter_form.php | 4 ++-- .../mod_EVOLI/forms/teamship_meter_form.php | 4 ++-- main/survey/app/Controllers/JsController.php | 15 ++++++++++----- 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/admin/survey/modules/mod_EVOLI/forms/organizational_employeeship_meter_form.php b/admin/survey/modules/mod_EVOLI/forms/organizational_employeeship_meter_form.php index 43e3d7df6..c2b2423cb 100644 --- a/admin/survey/modules/mod_EVOLI/forms/organizational_employeeship_meter_form.php +++ b/admin/survey/modules/mod_EVOLI/forms/organizational_employeeship_meter_form.php @@ -42,7 +42,7 @@ dateFormat: "dd.mm.yy", showAnim: "slideDown", showOn: "button", - buttonImage: "../../script/calendar/calendar.gif", + buttonImage: "../../../script/calendar/calendar.gif", buttonImageOnly: true, buttonText: "" }); @@ -55,7 +55,7 @@ dateFormat: "dd.mm.yy", showAnim: "slideDown", showOn: "button", - buttonImage: "../../script/calendar/calendar.gif", + buttonImage: "../../../script/calendar/calendar.gif", buttonImageOnly: true, buttonText: "" }); diff --git a/admin/survey/modules/mod_EVOLI/forms/quality_climate_form.php b/admin/survey/modules/mod_EVOLI/forms/quality_climate_form.php index 2e155c586..bb589f9ab 100644 --- a/admin/survey/modules/mod_EVOLI/forms/quality_climate_form.php +++ b/admin/survey/modules/mod_EVOLI/forms/quality_climate_form.php @@ -42,7 +42,7 @@ dateFormat: "dd.mm.yy", showAnim: "slideDown", showOn: "button", - buttonImage: "../../script/calendar/calendar.gif", + buttonImage: "../../../script/calendar/calendar.gif", buttonImageOnly: true, buttonText: "" }); @@ -55,7 +55,7 @@ dateFormat: "dd.mm.yy", showAnim: "slideDown", showOn: "button", - buttonImage: "../../script/calendar/calendar.gif", + buttonImage: "../../../script/calendar/calendar.gif", buttonImageOnly: true, buttonText: "" }); diff --git a/admin/survey/modules/mod_EVOLI/forms/team_meter_form.php b/admin/survey/modules/mod_EVOLI/forms/team_meter_form.php index a9d8de946..d9f5d30de 100644 --- a/admin/survey/modules/mod_EVOLI/forms/team_meter_form.php +++ b/admin/survey/modules/mod_EVOLI/forms/team_meter_form.php @@ -42,7 +42,7 @@ dateFormat: "dd.mm.yy", showAnim: "slideDown", showOn: "button", - buttonImage: "../../script/calendar/calendar.gif", + buttonImage: "../../../script/calendar/calendar.gif", buttonImageOnly: true, buttonText: "" }); @@ -55,7 +55,7 @@ dateFormat: "dd.mm.yy", showAnim: "slideDown", showOn: "button", - buttonImage: "../../script/calendar/calendar.gif", + buttonImage: "../../../script/calendar/calendar.gif", buttonImageOnly: true, buttonText: "" }); diff --git a/admin/survey/modules/mod_EVOLI/forms/teamship_meter_form.php b/admin/survey/modules/mod_EVOLI/forms/teamship_meter_form.php index f5d0668c9..4cc45248b 100644 --- a/admin/survey/modules/mod_EVOLI/forms/teamship_meter_form.php +++ b/admin/survey/modules/mod_EVOLI/forms/teamship_meter_form.php @@ -42,7 +42,7 @@ dateFormat: "dd.mm.yy", showAnim: "slideDown", showOn: "button", - buttonImage: "../../script/calendar/calendar.gif", + buttonImage: "../../../script/calendar/calendar.gif", buttonImageOnly: true, buttonText: "" }); @@ -55,7 +55,7 @@ dateFormat: "dd.mm.yy", showAnim: "slideDown", showOn: "button", - buttonImage: "../../script/calendar/calendar.gif", + buttonImage: "../../../script/calendar/calendar.gif", buttonImageOnly: true, buttonText: "" }); diff --git a/main/survey/app/Controllers/JsController.php b/main/survey/app/Controllers/JsController.php index 7b68473be..790c3855f 100644 --- a/main/survey/app/Controllers/JsController.php +++ b/main/survey/app/Controllers/JsController.php @@ -985,11 +985,16 @@ class JsController extends Controller if($evoli_teammeter){ echo ' var obj = document.forms[\'vnos\'].elements[\'evoli_tm_department\']; ' . "\n"; - echo ' if (obj.value == 0) { ' . "\n"; - echo ' hard = false; ' . "\n"; - echo ' submitAlert(\'#spremenljivka_evoli_tm_department\', \'add\', \'require\', \'hard\', validation, false, false, false, false); ' . "\n"; - echo ' } else { ' . "\n"; - echo ' submitAlert(\'#spremenljivka_evoli_tm_department\', \'remove\', \'require\', \'hard\', validation, false, false, false, false); ' . "\n"; + + echo ' if (typeof(obj) != "undefined" && obj != null) { ' . "\n"; + + echo ' if (obj.value == 0) { ' . "\n"; + echo ' hard = false; ' . "\n"; + echo ' submitAlert(\'#spremenljivka_evoli_tm_department\', \'add\', \'require\', \'hard\', validation, false, false, false, false); ' . "\n"; + echo ' } else { ' . "\n"; + echo ' submitAlert(\'#spremenljivka_evoli_tm_department\', \'remove\', \'require\', \'hard\', validation, false, false, false, false); ' . "\n"; + echo ' } ' . "\n"; + echo ' } ' . "\n"; } From 6767ae84d730c7d4b4923960698a2fee812d17de Mon Sep 17 00:00:00 2001 From: pero1203 Date: Wed, 4 Nov 2020 11:30:44 +0100 Subject: [PATCH 04/77] Popravek gumba "Nadgradite paket" --- admin/survey/SurveyAdmin.php | 7 +++++-- lang/1.php | 1 + lang/2.php | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/admin/survey/SurveyAdmin.php b/admin/survey/SurveyAdmin.php index 98a31edc4..d8c605a86 100644 --- a/admin/survey/SurveyAdmin.php +++ b/admin/survey/SurveyAdmin.php @@ -720,13 +720,16 @@ class SurveyAdmin // Preverimo trenuten paket uporabnika $userAccess = UserAccess::getInstance($global_user_id); - if($userAccess->getPackage() != '3'){ + $current_package = $userAccess->getPackage(); + if($current_package != '3'){ $drupal_url = ($lang['id'] == '2') ? $site_url.'d/en/' : $site_url.'d/'; $upgrade_url = $drupal_url.'izvedi-nakup/3/podatki'; + $button_text = ($current_package == '2') ? $lang['srv_access_upgrade2'] : $lang['srv_access_upgrade']; + echo ''; } } diff --git a/lang/1.php b/lang/1.php index 33e5dca21..1a0a18c36 100644 --- a/lang/1.php +++ b/lang/1.php @@ -7475,6 +7475,7 @@ $lang = array ( 'srv_access_package_expire' => "potekel", 'srv_access_package_all' => "Poglej vsa naročila", 'srv_access_upgrade' => "Nadgradite paket", + 'srv_access_upgrade2' => "Nadgradite na paket 3KA", // OBVESTILA O POTEKU PAKETA diff --git a/lang/2.php b/lang/2.php index 0343bd0ab..5e63f381e 100644 --- a/lang/2.php +++ b/lang/2.php @@ -7358,6 +7358,7 @@ $lang = array ( 'srv_access_package_expire' => "expired", 'srv_access_package_all' => "My orders", 'srv_access_upgrade' => "Upgrade", + 'srv_access_upgrade2' => "Upgrade to package 3KA", // OBVESTILA O POTEKU PAKETA From 1110c2ab5e32bbbbfd914b3c45cc2a5857bf7472 Mon Sep 17 00:00:00 2001 From: pero1203 Date: Wed, 4 Nov 2020 11:45:57 +0100 Subject: [PATCH 05/77] Popravek deaktivacije ankete --- admin/survey/script/script.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/admin/survey/script/script.js b/admin/survey/script/script.js index 1ac31cec2..c8440ed43 100644 --- a/admin/survey/script/script.js +++ b/admin/survey/script/script.js @@ -498,7 +498,8 @@ function anketa_active (anketa, state, folders, hierarhija) { } else { - $('#anketa_activation').load('ajax.php?a=anketa_active&ajaxa='+gup("a"), {anketa: anketa, folders: folders}, function() { + //$('#anketa_activation').load('ajax.php?a=anketa_active&ajaxa='+gup("a"), {anketa: anketa, folders: folders}, function() { + $.post('ajax.php?a=anketa_active&ajaxa='+gup("a"), {anketa: anketa, folders: folders}, function() { window.location.reload(); return; }); } From 6f0d9312f1224e9a824606456d0e9c5c49f89c9c Mon Sep 17 00:00:00 2001 From: pero1203 Date: Wed, 4 Nov 2020 13:46:53 +0100 Subject: [PATCH 06/77] Preverjanje pri nakupu ce je podjetje iz EU in zavezanec - potem se mu ne obracuna ddv --- .../payments/classes/class.UserNarocila.php | 97 ++++++++++++++++--- lang/1.php | 2 +- lang/2.php | 2 +- sql/update2.sql | 2 + 4 files changed, 87 insertions(+), 16 deletions(-) diff --git a/frontend/payments/classes/class.UserNarocila.php b/frontend/payments/classes/class.UserNarocila.php index eb01c87d0..56a65c826 100644 --- a/frontend/payments/classes/class.UserNarocila.php +++ b/frontend/payments/classes/class.UserNarocila.php @@ -163,7 +163,7 @@ class UserNarocila{ // Preverimo, ce narocilo slucajno nima ddv-ja (zavezanec za ddv iz tujine) public function isWithoutDDV($narocilo_id){ - $sqlNarocilo = sisplet_query("SELECT podjetje_drzava, podjetje_zavezanec + $sqlNarocilo = sisplet_query("SELECT podjetje_drzava, podjetje_no_ddv FROM user_access_narocilo WHERE id='".$narocilo_id."' "); @@ -171,7 +171,13 @@ class UserNarocila{ $rowNarocilo = mysqli_fetch_array($sqlNarocilo); - if($rowNarocilo['podjetje_drzava'] != 'Slovenija' && $rowNarocilo['podjetje_drzava'] != 'Slovenia' && $rowNarocilo['podjetje_zavezanec'] == '1'){ + // Slovenija ima vedno ddv + if($rowNarocilo['podjetje_drzava'] == 'Slovenija' || $rowNarocilo['podjetje_drzava'] == 'Slovenia'){ + return false; + } + + // Ce ni iz slovenije in ima oznaceno da ne placa ddv-ja + if($rowNarocilo['podjetje_no_ddv'] == '1'){ return true; } } @@ -593,10 +599,10 @@ class UserNarocila{ echo ''; echo '
'; - echo ''.$lang['srv_narocilo_podjetje_zavezanec'].': '; - echo ''; + echo ''; + echo ''; echo ''; echo '
'; @@ -651,17 +657,22 @@ class UserNarocila{ $podjetje_posta = isset($narocilo_data['podjetje_posta']) ? $narocilo_data['podjetje_posta'] : ''; $podjetje_drzava = isset($narocilo_data['podjetje_drzava']) ? $narocilo_data['podjetje_drzava'] : ''; $podjetje_davcna = isset($narocilo_data['podjetje_davcna']) ? $narocilo_data['podjetje_davcna'] : ''; - $podjetje_zavezanec = isset($narocilo_data['podjetje_ddv']) ? $narocilo_data['podjetje_ddv'] : ''; $podjetje_eracun = isset($narocilo_data['podjetje_eracun']) ? '1' : '0'; - + $language = isset($narocilo_data['lang']) ? $narocilo_data['lang'] : 'sl'; - + if($usr_id <= 0){ $response['error'] = 'ERROR! Missing user ID.'; $response['success'] = false; - + return $response; } + + // Nastavimo ce placa DDV (zavezanci iz EU ga ne placajo) + if($this->checkPayDDV($podjetje_davcna, $podjetje_drzava)) + $podjetje_no_ddv = '0'; + else + $podjetje_no_ddv = '1'; $brezplacen_preklop = false; @@ -691,9 +702,9 @@ class UserNarocila{ } $sqlNarocilo = sisplet_query("INSERT INTO user_access_narocilo - (usr_id, status, time, package_id, ime, payment_method, discount, trajanje, phone, podjetje_ime, podjetje_naslov, podjetje_postna, podjetje_posta, podjetje_drzava, podjetje_davcna, podjetje_zavezanec, podjetje_eracun, language) + (usr_id, status, time, package_id, ime, payment_method, discount, trajanje, phone, podjetje_ime, podjetje_naslov, podjetje_postna, podjetje_posta, podjetje_drzava, podjetje_davcna, podjetje_no_ddv, podjetje_eracun, language) VALUES - ('".$usr_id."', '".$status."', NOW(), '".$package_id."', '".$ime_na_racunu."', '".$payment_method."', '".$discount."', '".$trajanje."', '".$phone."', '".$podjetje_ime."', '".$podjetje_naslov."', '".$podjetje_postna."', '".$podjetje_posta."', '".$podjetje_drzava."', '".$podjetje_davcna."', '".$podjetje_zavezanec."', '".$podjetje_eracun."', '".$language."') + ('".$usr_id."', '".$status."', NOW(), '".$package_id."', '".$ime_na_racunu."', '".$payment_method."', '".$discount."', '".$trajanje."', '".$phone."', '".$podjetje_ime."', '".$podjetje_naslov."', '".$podjetje_postna."', '".$podjetje_posta."', '".$podjetje_drzava."', '".$podjetje_davcna."', '".$podjetje_no_ddv."', '".$podjetje_eracun."', '".$language."') "); if (!$sqlNarocilo){ $response['error'] = 'ERROR! '.mysqli_error($GLOBALS['connect_db']); @@ -878,7 +889,7 @@ class UserNarocila{ $update .= isset($narocilo_data['podjetje_posta']) ? ', podjetje_posta='.$narocilo_data['podjetje_posta'] : ''; $update .= isset($narocilo_data['podjetje_drzava']) ? ', podjetje_drzava='.$narocilo_data['podjetje_drzava'] : ''; $update .= isset($narocilo_data['podjetje_davcna']) ? ', podjetje_davcna='.$narocilo_data['podjetje_davcna'] : ''; - $update .= isset($narocilo_data['podjetje_ddv']) ? ', podjetje_zavezanec='.$narocilo_data['podjetje_ddv'] : ''; + $update .= isset($narocilo_data['podjetje_no_ddv']) ? ', podjetje_no_ddv='.$narocilo_data['podjetje_no_ddv'] : ''; $update .= isset($narocilo_data['podjetje_eracun']) ? ', podjetje_eracun='.$narocilo_data['podjetje_eracun'] : ''; $update = substr($update, 1); @@ -1176,6 +1187,64 @@ class UserNarocila{ return $response; } + // Izvede api klic kjer preveri davcno stevilko in zavezanost za DDV + private function checkPayDDV($davcna_stevilka, $drzava){ + global $lang; + global $global_user_id; + + // Drzave EU brez slovenije + $countries_eu = array(); + $countries_eu['Austria'] = 'AT'; + $countries_eu['Belgium'] = 'BE'; + $countries_eu['Bulgaria'] = 'BG'; + $countries_eu['Cyprus'] = 'CY'; + $countries_eu['Czech Republic'] = 'CZ'; + $countries_eu['Germany'] = 'DE'; + $countries_eu['Denmark'] = 'DK'; + $countries_eu['Estonia'] = 'EE'; + $countries_eu['Spain'] = 'ES'; + $countries_eu['Finland'] = 'FI'; + $countries_eu['France'] = 'FR'; + $countries_eu['United Kingdom'] = 'GB'; + $countries_eu['Greece'] = 'GR'; + $countries_eu['Hungary'] = 'HU'; + $countries_eu['Croatia'] = 'HR'; + $countries_eu['Ireland'] = 'IE'; + $countries_eu['Italy'] = 'IT'; + $countries_eu['Lithuania'] = 'LT'; + $countries_eu['Luxembourg'] = 'LU'; + $countries_eu['Latvia'] = 'LV'; + $countries_eu['Malta'] = 'MT'; + $countries_eu['Netherlands'] = 'NL'; + $countries_eu['Poland'] = 'PL'; + $countries_eu['Portugal'] = 'PT'; + $countries_eu['Romania'] = 'RO'; + $countries_eu['Sweden'] = 'SE'; + //$countries_eu['Slovenia'] = 'SI'; + $countries_eu['Slovakia'] = 'SK'; + + + // Ce ni drzava s seznama vedno placa DDV + if(!isset($countries_eu[$drzava])) + return true; + + + // Drugace gre za tujca iz EU - preverimo ce je zavezanec + $client = new SoapClient("http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl"); + try{ + $response = $client->checkVat( array('countryCode' => $countries_eu[$drzava], 'vatNumber' => $davcna_stevilka) ); + } + catch (Exception $e) { + return true; + } + + // Je valid zavezanec iz EU + if(isset($response->valid) && $response->valid == true) + return false; + + return true; + } + // Dobimo podatke o vseh paketih private function cachePackages(){ @@ -1221,7 +1290,7 @@ class UserNarocila{ $update .= (isset($_POST['podjetje_posta'])) ? " podjetje_posta='".$_POST['podjetje_posta']."'," : ""; $update .= (isset($_POST['podjetje_drzava'])) ? " podjetje_drzava='".$_POST['podjetje_drzava']."'," : ""; $update .= (isset($_POST['podjetje_davcna'])) ? " podjetje_davcna='".$_POST['podjetje_davcna']."'," : ""; - $update .= (isset($_POST['podjetje_zavezanec'])) ? " podjetje_zavezanec='".$_POST['podjetje_zavezanec']."'," : ""; + $update .= (isset($_POST['podjetje_no_ddv'])) ? " podjetje_no_ddv='".$_POST['podjetje_no_ddv']."'," : ""; $update .= (isset($_POST['podjetje_eracun'])) ? " podjetje_eracun='".$_POST['podjetje_eracun']."'," : ""; if($update != ''){ diff --git a/lang/1.php b/lang/1.php index 1a0a18c36..062c241fe 100644 --- a/lang/1.php +++ b/lang/1.php @@ -7402,7 +7402,7 @@ $lang = array ( 'srv_narocilo_podjetje_posta' => "Pošta", 'srv_narocilo_podjetje_postna' => "Poštna št.", 'srv_narocilo_podjetje_drzava' => "Država", - 'srv_narocilo_podjetje_zavezanec' => "Zavezanec za DDV", + 'srv_narocilo_podjetje_no_ddv' => "Ne plača DDV", 'srv_narocilo_podjetje_eracun' => "E-račun", 'srv_narocilo_placaj' => "Plačaj", diff --git a/lang/2.php b/lang/2.php index 5e63f381e..055ad3d6f 100644 --- a/lang/2.php +++ b/lang/2.php @@ -7285,7 +7285,7 @@ $lang = array ( 'srv_narocilo_podjetje_posta' => "Post", 'srv_narocilo_podjetje_postna' => "Postcode", 'srv_narocilo_podjetje_drzava' => "Country", - 'srv_narocilo_podjetje_zavezanec' => "VAT", + 'srv_narocilo_podjetje_no_ddv' => "Does not pay VAT", 'srv_narocilo_podjetje_eracun' => "E-invoice", 'srv_narocilo_placaj' => "Pay", diff --git a/sql/update2.sql b/sql/update2.sql index ffdf3e6fa..5c4cf4e13 100644 --- a/sql/update2.sql +++ b/sql/update2.sql @@ -9339,3 +9339,5 @@ UPDATE misc SET value='20.10.25' WHERE what="version"; INSERT INTO srv_help (help, what) VALUES ('Pri pošiljanju email vabil na več naslovov je vklopljena zakasnitev, kar pomeni da med e-poštnim sporočilom, poslanim enemu naslovniku, in e-poštnim sporočilom, poslanim naslednjemu naslovniku, preteče najmanj 2 sekundi. Ta čas lahko po potrebi spremenite (glede na zmogljivosti vašega strežnika). ', 'srv_inv_delay'); UPDATE misc SET value='20.10.29' WHERE what="version"; + +ALTER TABLE user_access_narocilo MODIFY COLUMN podjetje_zavezanec podjetje_no_ddv ENUM('0', '1') NOT NULL DEFAULT '0' AFTER podjetje_davcna; From 7ee3948940980f4b0ed8630a368fe6b8313df527 Mon Sep 17 00:00:00 2001 From: pero1203 Date: Wed, 4 Nov 2020 13:48:55 +0100 Subject: [PATCH 07/77] Popravek baze za placila - ddv --- sql/update2.sql | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sql/update2.sql b/sql/update2.sql index 5c4cf4e13..3f556efbc 100644 --- a/sql/update2.sql +++ b/sql/update2.sql @@ -9340,4 +9340,6 @@ INSERT INTO srv_help (help, what) VALUES ('Pri pošiljanju email vabil na ve UPDATE misc SET value='20.10.29' WHERE what="version"; -ALTER TABLE user_access_narocilo MODIFY COLUMN podjetje_zavezanec podjetje_no_ddv ENUM('0', '1') NOT NULL DEFAULT '0' AFTER podjetje_davcna; +ALTER TABLE user_access_narocilo CHANGE COLUMN podjetje_zavezanec podjetje_no_ddv ENUM('0', '1') NOT NULL DEFAULT '0' AFTER podjetje_davcna; + +UPDATE misc SET value='20.11.04' WHERE what="version"; From 061d161076c9fa5c69ed6736765150e836c2b7d2 Mon Sep 17 00:00:00 2001 From: pero1203 Date: Wed, 4 Nov 2020 14:11:20 +0100 Subject: [PATCH 08/77] Popravek urejanja narocila - ddv --- frontend/payments/classes/class.UserNarocila.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/payments/classes/class.UserNarocila.php b/frontend/payments/classes/class.UserNarocila.php index 56a65c826..622fa06e7 100644 --- a/frontend/payments/classes/class.UserNarocila.php +++ b/frontend/payments/classes/class.UserNarocila.php @@ -601,8 +601,8 @@ class UserNarocila{ echo '
'; echo ''.$lang['srv_narocilo_podjetje_no_ddv'].': '; echo ''; echo '
'; From 11dcdf3830f65a545250bfb14524ac2a1cd97e92 Mon Sep 17 00:00:00 2001 From: Robert Date: Thu, 5 Nov 2020 14:37:55 +0100 Subject: [PATCH 09/77] Drupal: frontend API --- .../nakupovanje_1ka/nakupovanje_1ka.module | 56 +- .../sites/all/themes/pro1ka/js/script.js | 35 +- .../all/themes/pro1ka/js/script_old_api.js | 1434 +++++++++++++++++ .../classes/class.ApiNarocilaController.php | 18 +- 4 files changed, 1523 insertions(+), 20 deletions(-) create mode 100755 frontend/drupal/sites/all/themes/pro1ka/js/script_old_api.js diff --git a/frontend/drupal/sites/all/modules/nakupovanje_1ka/nakupovanje_1ka.module b/frontend/drupal/sites/all/modules/nakupovanje_1ka/nakupovanje_1ka.module index 3b1bd4ae1..6d1244be8 100755 --- a/frontend/drupal/sites/all/modules/nakupovanje_1ka/nakupovanje_1ka.module +++ b/frontend/drupal/sites/all/modules/nakupovanje_1ka/nakupovanje_1ka.module @@ -7,10 +7,11 @@ function nakupovanje_1ka_menu() { $items = []; - $items['nakupovanje-api'] = [ + $items['nakupovanje-api/%'] = [ 'title' => 'API', //page title 'page callback' => 'nakupovanje_1ka_api', //callback function which is invoked when menu item is called. - 'access callback' => MENU_CALLBACK, //any user can access this page + 'access callback' => MENU_LOCAL_ACTION, //any user can access this page + //'type' => MENU_CALLBACK, 'page arguments' => [ 1, ], @@ -196,7 +197,56 @@ function nakupovanje_1ka_menu() function nakupovanje_1ka_api() { - return 'success'; + $api_url = 'http://1ka.test/frontend/payments/api.php'; + + // Ime akcije dobimo preko zadnjega GET parametra, ki ga Drupal samo uporabi + $action = arg(1); + + // GET params + $params = 'action='. $action; // Funkcija, ki jo želimo izvesti + + $post_data = $_POST; + + if(!empty($post_data) && sizeof($post_data) > 0){ + $request_method = 'POST'; + $raw_post_data = http_build_query($post_data); + } else { + $request_method = 'GET'; + $raw_post_data = ''; + } + + // Pripravimo stvari za izdelavo tokena + $request_url = $api_url.'?'.$params; + $data = $request_method . $request_url .$raw_post_data; + + // Nastavimo identifier in key userja + $private_key = 'NLFYb67/[pUE%W-s'; + + // Izracunamo hash (token) + $token = hash_hmac('sha256', $data, $private_key); + + + // Pripravimo klic – dodamo parametra »identifikator« in »token« + $ch = curl_init($request.'&token='.$token); + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $request_method); + + if($request_method == 'POST') { + curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($post_data)); // JSON string za POST + curl_setopt($ch, CURLOPT_POST, TRUE); + } + + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_HEADER ,1); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION ,1); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); + curl_setopt($ch, CURLINFO_HEADER_OUT, true); + + // Izvedemo klic + $result = curl_exec($ch); + curl_close($ch); + + print_r($result); + die(); } function nakupovanje_1ka_kosarica() diff --git a/frontend/drupal/sites/all/themes/pro1ka/js/script.js b/frontend/drupal/sites/all/themes/pro1ka/js/script.js index 20789675c..a23500cac 100755 --- a/frontend/drupal/sites/all/themes/pro1ka/js/script.js +++ b/frontend/drupal/sites/all/themes/pro1ka/js/script.js @@ -795,7 +795,7 @@ ) { var parametri = window.location.search.substr(1); - jQuery.post('/frontend/payments/api.php?action=cancel_narocilo_paypal', parametri).done(function (val) { + jQuery.post('/d/nakupovanje-api/cancel_narocilo_paypal', parametri).done(function (val) { val = JSON.parse(val); if (val.error) { @@ -811,7 +811,7 @@ ){ var parametri = window.location.search.substr(1); - jQuery.post('/frontend/payments/api.php?action=capture_narocilo_paypal', parametri).done(function (val) { + jQuery.post('/d/nakupovanje-api/capture_narocilo_paypal', parametri).done(function (val) { val = JSON.parse(val); if (val.error) { @@ -847,12 +847,19 @@ // PRidobimo pakete if (window.location.pathname.indexOf('zasebni-paketi') > -1 || window.location.pathname.indexOf('private-packages') > -1) { - jQuery.post('/frontend/payments/api.php?action=get_paketi').done(function (val) { + jQuery.post('/d/nakupovanje-api/get_paketi').done(function (val) { val = JSON.parse(val); jQuery('[data-price="2"]').text(val.paketi[2].price[12].monthly); jQuery('[data-price="3"]').text(val.paketi[3].price[12].monthly); }); + + // jQuery.post('/frontend/payments/api.php?action=get_paketi').done(function (val) { + // val = JSON.parse(val); + // + // jQuery('[data-price="2"]').text(val.paketi[2].price[12].monthly); + // jQuery('[data-price="3"]').text(val.paketi[3].price[12].monthly); + // }); } @@ -960,8 +967,7 @@ var podatki = jQuery('#narocilo-poslovni-uporabniki').serialize(); - - jQuery.post('/frontend/payments/api.php?action=send_poslovni_uporabniki', podatki).done(function (val) { + jQuery.post('/d/nakupovanje-api/send_poslovni_uporabniki', podatki).done(function (val) { val = JSON.parse(val); if (val.success) { @@ -971,6 +977,17 @@ } }); + + // jQuery.post('/frontend/payments/api.php?action=send_poslovni_uporabniki', podatki).done(function (val) { + // val = JSON.parse(val); + // + // if (val.success) { + // jQuery('#narocilo-poslovni-uporabniki').hide(); + // jQuery('#nakup-1ka-poslovni-uporabniki .uspesno-oddano-narocilo').show(); + // jQuery('.vsebina h1').text('Uspešno oddano naročilo'); + // } + // }); + }); jQuery(window).scroll(function () { @@ -1190,8 +1207,7 @@ function oddajNarociloNaStreznik() { var podatki = jQuery('form#narocilo-paketa-podatki').serialize(); - - jQuery.post('/frontend/payments/api.php?action=create_narocilo', podatki).done(function (val) { + jQuery.post('/d/nakupovanje-api/create_narocilo', podatki).done(function (val) { val = JSON.parse(val); if (val.error) { @@ -1273,7 +1289,8 @@ function posodobiCenoPaketa() { var trajanje = jQuery('[name="trajanje"]:checked').val(); - jQuery.post('/frontend/payments/api.php?action=get_paketi').done(function (val) { + + jQuery.post('/d/nakupovanje-api/get_paketi').done(function (val) { val = JSON.parse(val); var cenaIzpisGledeNaDDV = ''; @@ -1298,7 +1315,7 @@ function posodobiCenoPaketa() { // Preverimo, če ima kak popust od prej jQuery('.podatki-za-placilo-racuna').show(); - jQuery.post('/frontend/payments/api.php?action=get_active_subscription', { + jQuery.post('/d/nakupovanje-api/get_active_subscription', { 'package_id': paket, 'trajanje': trajanje, 'email': jQuery('#narocilo-paketa-podatki #f-email').val(), diff --git a/frontend/drupal/sites/all/themes/pro1ka/js/script_old_api.js b/frontend/drupal/sites/all/themes/pro1ka/js/script_old_api.js new file mode 100755 index 000000000..20789675c --- /dev/null +++ b/frontend/drupal/sites/all/themes/pro1ka/js/script_old_api.js @@ -0,0 +1,1434 @@ +/** + * @file + * A JavaScript file for the theme. + * + * In order for this JavaScript to be loaded on pages, see the instructions in + * the README.txt next to this file. + */ + +// JavaScript should be made compatible with libraries other than jQuery by +// wrapping it with an "anonymous closure". See: +// - https://drupal.org/node/1446420 +// - http://www.adequatelygood.com/2010/3/JavaScript-Module-Pattern-In-Depth +(function ($, Drupal, window, document) { + + 'use strict'; + + + // To understand behaviors, see https://drupal.org/node/756722#behaviors + Drupal.behaviors.my_custom_behavior = { + attach: function (context, settings) { + var adminMenu = ''; + if (jQuery('#admin-menu').length > 0) { + adminMenu = 'fixed-admin'; + } + + jQuery(document).ready(function () { + // Odpremo drop down menu za uporabnika + jQuery('#submenu-login').on('click', function () { + jQuery('#user-menu').toggle(); + }); + + // JEZIK pustimo samo 3 črke + var jezikText = jQuery('.language-link').text().substring(0, 4); + jQuery('.language-link').text(jezikText); + + // Iskalnik v navbaru + // Zapremo iskalnik + jQuery(document).on('click', '.search-close', function () { + jQuery('#iskanje').show('fast'); + jQuery('#iskanje-form').hide('fast'); + jQuery('.burger').css('z-index', ''); + }); + + //Odpremo iskalnik + jQuery('#iskanje').on('click', function () { + jQuery('#iskanje-form').show('fast'); + jQuery('#iskanje').hide('fast'); + jQuery('.burger').css('z-index', '-99'); + }); + + // Preusmerimo na url za iskanje, ko uporabnik pritisne enter + jQuery('#iskanje-input').on('keyup', function (event) { + if (event.keyCode == 13) { + var iskaniNiz = jQuery('#iskanje-input').val(); + + var action = jQuery('#iskanje-form').attr('data-action'); + + window.location.href = action + iskaniNiz; + } + }); + + // if (window.location.pathname.indexOf('/iskanje/') > -1) { + // jQuery('.container-sidenav h1').hide(); + // } + // END Iskalnik + + + /** + * Napredno iskanje + */ + // var drupalLang = 'sl'; + // var drupalButtonName = 'Iskanje po vprašalnikih'; + // if(location.pathname.split("/")[2] == 'en') { + // drupalLang = 'en'; + // drupalButtonName = 'Search surveys'; + // } + + // Dodamo Gumb za napredno iskanje + if (jQuery('#search-api-page-search-form').length > 0) { + // Če je uporabnik prijavljen dodamo opcijo iskanja po mojih anketah + var piskotek = "; " + document.cookie; + + if (piskotek.split("; unam=").length == 2) { + jQuery('#search-api-page-search-form [type="submit"]').after(''); + } + } + + jQuery('#edit-keys').bind('keyup', function () { + jQuery('#prikazi-moje-ankete').attr('href', '/admin/survey/index.php?search=' + jQuery(this).val() + '&lang=' + drupalLang); + }); + + + // Skrijemo napredno iskanje + jQuery(document).on('click', '#prikazi-advance-search', function () { + if (jQuery('.sprites').hasClass('plus')) { + jQuery('.sprites').removeClass('plus').addClass('minus'); + } else { + jQuery('.sprites').removeClass('minus').addClass('plus'); + } + + jQuery('fieldset#edit-advanced').toggle(); + }); + /*** end napredno iskanje ***/ + + + /** + * Quicktabs + */ + // Quick tabs dodamo ikone + jQuery('#quicktabs-tab-tabs_faq_priporocila_video_slo-0, #quicktabs-tab-tabs_faq_manuals_video_eng-0').addClass('tab-povezava').prepend('
' + + '' + + '' + + '' + + '
'); + jQuery('#quicktabs-tab-tabs_faq_priporocila_video_slo-1, #quicktabs-tab-tabs_faq_manuals_video_eng-1').addClass('tab-povezava').prepend('
' + + '' + + '' + + '' + + '
'); + jQuery('#quicktabs-tab-tabs_faq_priporocila_video_slo-2, #quicktabs-tab-tabs_faq_manuals_video_eng-2').addClass('tab-povezava').prepend('
' + + '' + + '' + + '' + + '
'); + + //Dodamo naslove za posamezne tabe + jQuery('[id^=quicktabs-tab-tabs_faq_priporocila_video_slo], [id^=quicktabs-tab-tabs_faq_manuals_video_eng]').each(function () { + var id = jQuery(this).attr('id').slice(14); + var ime = jQuery(this).text(); + + // Če je v imenu active tab potem to odstranimo v naslovu + var isci = ime.search('(active tab)'); + if (isci > 0) { + ime = ime.slice(0, (isci - 1)); + } + + jQuery('#quicktabs-tabpage-' + id + ' .item-list').prepend('

' + ime + '

'); + }); + + // Quick tabs na angleški strani razširi 2 zavihka na 50% + if (jQuery('#quicktabs-tab-tabs_faq_manuals_video_eng-0').length) { + jQuery('.tabs-1ka ul.quicktabs-tabs > li').each(function () { + jQuery(this).addClass('width-50'); + }); + } + + // Quicktabs odpremo ustreznega glede na izbran url + var urlPars = window.location.pathname.split('/'); + + if (urlPars[4] == 'prirocniki' || urlPars[4] == 'manuals') { + jQuery('.quicktabs-tabs li').removeClass('active'); + jQuery('.quicktabs-tabs li:eq(1)').addClass('active'); + jQuery('.quicktabs-tabpage').addClass('quicktabs-hide'); + jQuery('.quicktabs-tabpage:eq(1)').removeClass('quicktabs-hide'); + + } + if (urlPars[4] == 'video') { + jQuery('.quicktabs-tabs li').removeClass('active'); + jQuery('.quicktabs-tabs li:eq(2)').addClass('active'); + jQuery('.quicktabs-tabpage').addClass('quicktabs-hide'); + jQuery('.quicktabs-tabpage:eq(2)').removeClass('quicktabs-hide'); + } + /*** end quictabs ***/ + + // POMOČ + // Skrij moje ankete + if (jQuery('.gumb1kazapri').length > 0) { + jQuery('.menu-630').hide(); + jQuery('.menu-489').hide(); + jQuery('.menu-952').hide(); + } + + // Nova 1ka + // Prijava modal + jQuery('#modal-open-login').on('click', function () { + jQuery('#modal-login').show(); + }); + + //Registracija modal + jQuery('#modal-open-registration, .brezplacni-nakup-samo-registracija').on('click', function () { + jQuery('#modal-registration').show(); + }); + + jQuery('.closemodal').on('click', function () { + jQuery('.rexister-modal').hide(); + jQuery('.w-input').val(''); + jQuery('.w-checkbox-input').prop('checked', false); + + //Odstranimo piskotek za nakup paketa in skrijemo tekst + document.cookie = "nakup=1;expires=Thu, 01 Jan 1970 00:00:01 GMT"; + jQuery('.nakup-prijava').hide(); + }); + + // Če gr za napako pri loginu + if (window.location.search.indexOf('?a=login') > -1) { + jQuery('#modal-login').show(); + jQuery('.w-form-fail').show(); + } + + jQuery('#gdpr-more').on('click', function () { + jQuery('#gdpr-vec-text').toggle(); + }); + + jQuery('.checkbox-field .checkbox-display').on('click', function () { + var oznacen = true; + if (jQuery(this).siblings('input:checked').length > 0) + oznacen = false; + + jQuery(this).siblings('input').prop('checked', oznacen); + }); + + + // Forma za registracijo + jQuery('#registracija-uporabnika .submit-btn').on('click', function (event) { + jQuery('.error-field').removeClass('error-field'); + jQuery('.error').removeClass('error'); + + // Obravnamo manjkajoča polja + if (jQuery('#register-form [name="email"]').val().length < 2) { + jQuery('#register-form [name="email"]').addClass('error error-field'); + } + + if (jQuery('#register-form [name="ime"]').val().length < 2) { + jQuery('#register-form [name="ime"]').addClass('error error-field'); + } + + if (!jQuery('#register-form [name="agree"]').is(':checked')) { + jQuery('#register-form [name="agree"]').addClass('error').siblings('#agreelabel, .checkbox-display').addClass('error'); + } + + if (jQuery('#register-form [name="email"]').val().length == 0 || jQuery('#register-form [name="ime"]').val().length == 0 || !jQuery('#register-form [name="agree"]').is(':checked')) { + return false; + } + + event.preventDefault(); + + var sendVariables = jQuery('#registracija-uporabnika').serialize(); + sendVariables += '&ajax=1'; + + jQuery.post('/frontend/api/api.php?action=register', sendVariables, function (data) { + var response = JSON.parse(data); + jQuery('.error-field').removeClass('error-field'); + + if (response.success && response.success == 1) { + jQuery('#reg-confirm-email').text(jQuery('#register-form [name="email"]').val()); + jQuery('#reg-confirm-ime').text(jQuery('#register-form [name="ime"]').val()); + jQuery('#reg-confirm-geslo').text('****'); + jQuery('#reg-confirm-gdpr').text('NE'); + + if (window.location.href.search('/d/en') > 0) { + if (jQuery('#GdprAgree').is(':checked')) { + jQuery('#reg-confirm-gdpr').text('YES'); + } else { + jQuery('#reg-confirm-gdpr').text('NO'); + } + } else { + if (jQuery('#GdprAgree').is(':checked')) { + jQuery('#reg-confirm-gdpr').text('DA'); + } + } + + if (jQuery('#register-form [name="geslo"]').val().length == 0) { + jQuery('#reg-confirm-geslo').text('/'); + } + + jQuery('#register-form').hide(); + jQuery('.glavni-naslov').hide(); + jQuery('#register-form-confirm').show(); + + + } else { + // Izpišemo napake + if (response.napaka && response.napaka.length > 0) { + jQuery('.napaka-registracija').show(); + + var napake = ''; + jQuery.each(response.napaka, function (key, val) { + napake += '
' + val + '
'; + }); + + jQuery('.napaka-registracija').html(napake); + } + + if (response.error_email) { + jQuery('#register-form [name="email"]').addClass('error-field'); + } + + if (response.error_ime) { + jQuery('#register-form [name="ime"]').addClass('error-field'); + } + + if (response.error_geslo) { + jQuery('#register-form [name="geslo"]').addClass('error-field'); + jQuery('#register-form [name="geslo2"]').addClass('error-field'); + } + + if (response.new_username.length > 0) { + jQuery('#register-form #registracija-vzdevek').val(response.new_username); + } + + //Ponastavi reCaptcho + if (grecaptcha) { + grecaptcha.reset(); + } + } + }); + + }); + + // Pri potrditvi omogočimo gum nazaj + jQuery('#reg-confirm-back').on('click', function () { + jQuery('#register-form-confirm').hide(); + jQuery('#register-form').show(); + }); + + //Pošljemo potrditven email + jQuery('#reg-confirm-next').on('click', function (event) { + event.preventDefault(); + + var sendVariables = jQuery('#registracija-uporabnika').serialize(); + sendVariables += '&ajax=1'; + + jQuery.post('/frontend/api/api.php?action=register_confirm', sendVariables, function (data) { + var response = JSON.parse(data); + + if (response.success && response.success == 1) { + var text = jQuery('#register-form-email-sent').html().replace("SFMAIL", jQuery('#reg-confirm-email').text()); + jQuery('#register-form-email-sent').html(text); + + jQuery('#reg-confirm-email').text(''); + jQuery('#reg-confirm-ime').text(''); + jQuery('#reg-confirm-geslo').text(''); + jQuery('#reg-confirm-gdpr').text(''); + + // Počistimo formo + jQuery(':input', '#register-form') + .not(':button, :submit') + .val('') + .removeAttr('checked'); + + jQuery('#register-form-confirm').hide(); + jQuery('#register-form-email-sent').show(); + + } + }); + + }); + + + // GUmbi na desni front + jQuery('#odpri-prijavo, .odpri-prijavo').on('click', function () { + jQuery('.rexister-modal').hide(); + jQuery('#modal-login').show(); + }); + jQuery(document).on('click', "#odpri-registracijo", function () { + jQuery('.rexister-modal').hide(); + jQuery('.w-form-fail').html('').hide(); + jQuery('#modal-registration').show(); + }); + + if (window.location.hash == '#neregistriran-uporabnik') { + jQuery('#spletna-uporaba-modal').show(); + } + + jQuery(document).on('click', '#gumb-spletna-uporaba, .gumb-spletna-uporaba', function (e) { + e.preventDefault(); + jQuery('#spletna-uporaba-modal').show(); + }); + jQuery('#gumb-lastna-namestitev').on('click', function () { + jQuery('#lastna-namestitev-modal').show(); + }); + + + // Izgubljeno geslo + jQuery('#open-modal-lost-password').on('click', function () { + jQuery('#modal-login').hide(); + jQuery('#modal-lost-password').show(); + }); + jQuery('#submit-lost-password').on('click', function () { + jQuery('.w-form-fail').hide(); + + var emailObnovitev = jQuery('#obnovitev-gesla').val(); + var jezik = jQuery('#modal-lost-password [name="jezik"]').val(); + + if (emailObnovitev.length == 0 || emailObnovitev.length > 1 && (emailObnovitev.search('@') == -1 || emailObnovitev.indexOf('.') == -1)) { + jQuery('#error-lost-password').show(); + + return false; + } + + // V kolikor je vse ok poljemo POST request, da preverimo v bazi + jQuery.post('/frontend/api/api.php?action=reset_password', { + email: emailObnovitev, + ajax: true, + jezik: jezik + }).done(function (val) { + val = JSON.parse(val); + + jQuery('#modal-lost-password .w-form-done').html('').hide(); + jQuery('#modal-lost-password .w-form-fail').hide(); + + if (val.type == 'success') { + jQuery('#modal-lost-password .w-form-done').html('
' + val.text + '
').show(); + + // Če je bil email uspešno poslal potem okno zapremo po 5 sekundah + setTimeout(function () { + jQuery("#modal-lost-password").hide(); + jQuery('#modal-lost-password .w-form-done').hide(); + jQuery("#obnovitev-gesla").val(''); + }, 2000); + + } else { + + // Napaka, če email ne obstaja v bazi + jQuery('#modal-lost-password .w-form-fail').html('
' + val.text + '
').show(); + + } + }); + }); + + // AKtivacija izgubljenega gesla + if (window.location.hash == '#aktivacija-gesla') { + jQuery('#modal-lost-password-activate').show(); + } + jQuery('#submit-lost-password-activation').on('click', function () { + jQuery('.w-form-fail').hide(); + jQuery('.error').removeClass('error'); + + var email = jQuery('#aktivacija-email').val(); + var geslo = jQuery('#aktivacija-geslo').val(); + var koda = ''; + var jezik = jQuery('#modal-lost-password [name="jezik"]').val(); + + var results = new RegExp('[\?&]code=([^&#]*)').exec(window.location.href); + if (results[1].length > 10) + koda = results[1]; + + if (email.length == 0 || geslo.length == 0 || koda.length == 0) { + jQuery('#error-aktivacija-gesla').show(); + + if (email.length == 0) { + jQuery('#aktivacija-email').addClass('error'); + } + + if (geslo.length == 0) { + jQuery('#aktivacija-geslo').addClass('error'); + } + + return false; + } + + + // V kolikor je vse ok poljemo POST request, da preverimo v bazi + jQuery.post('/frontend/api/api.php?action=reset_password_activate', { + email: email, + pass: geslo, + code: koda, + ajax: true, + lang: jezik + }).done(function (val) { + val = JSON.parse(val); + + jQuery('#error-aktivacija-gesla').removeClass('w-form-fail').removeClass('w-form-done').html('').hide(); + + if (val.type == 'success') { + jQuery('#error-aktivacija-gesla').addClass('w-form-done').html('
' + val.text + '
').show(); + + // Če je bil email uspešno poslal potem okno zapremo po 5 sekundah + setTimeout(function () { + window.location.href = val.action; + }, 5000); + + } else { + + // Napaka, če email ne obstaja v bazi + jQuery('#error-aktivacija-gesla').addClass('w-form-fail').html('
' + val.text + '
').show(); + + } + }); + }); + + //Prijava z ostalimi računi + jQuery('#agreelabel, #cutom-login-agree, .checkbox-agree').on('click', function () { + if (jQuery('#cutom-login-agree').is(':checked')) { + jQuery('#submit-other-login').show(); + } else { + jQuery('#submit-other-login').hide(); + } + }); + + jQuery('.prijava-ostale-nazaj').on('click', function () { + jQuery('#modal-other-login').hide() + jQuery('.rexister-modal').show(); + jQuery('#modal-other-login h3').show(); + }); + + jQuery('.ikona-custom-login').on('click', function () { + var atribut = jQuery(this).attr('data-login'); + + + jQuery('.aai-obvestilo').hide(); + jQuery('#submit-other-login').hide(); + + jQuery('.rexister-modal').hide(); + jQuery('#modal-other-login h3').hide(); + + jQuery('#cutom-login-agree').attr('checked', false); + + // Če obstaja piškotek, potemgumb naprej prikažemo + if (document.cookie.indexOf('remember-me=') > 0) { + jQuery('#cutom-login-agree').attr('checked', true); + jQuery('#submit-other-login').show(); + } + + if (atribut == 'aai') { + jQuery('.aai-obvestilo').show(); + } + + + jQuery('#modal-other-login #login-' + atribut + '-title').show(); + jQuery('#submit-other-login').attr('data-redirect', 'url-' + atribut); + jQuery('#modal-other-login').show(); + }); + + jQuery('#modal-other-login #submit-other-login').on('click', function () { + var ikona = jQuery(this).attr('data-redirect'); + var url = jQuery('[name="' + ikona + '"]').val(); + + //Preverimo, če gre za zapomni se me (remember) + if (jQuery('#custom-login-remember-me').attr('checked')) { + var date = new Date(new Date().setFullYear(new Date().getFullYear() + 1)); + document.cookie = 'remember-me=1; expires=' + date + '; path=/' + } + + document.location.href = url; + }); + /**end prijava z ostalimi računi **/ + + // Če uporabnik ni prijavljen potem moje ankete odprejo možnost za prijavo + if (jQuery('[href*="/admin/survey/index.php?lang="]').length > 0 || jQuery('[data-href*="/admin/survey/index.php?lang="]').length > 0) { + + // preverimo če obstaja piškot, da je uporabnik prijavljen + if (document.cookie.indexOf('unam=') > 0) { + var dataHref = jQuery('[data-href*="/admin/survey/index.php?lang="]'); + + if (dataHref.length > 0) { + dataHref.attr('href', dataHref.attr('data-href')); + + jQuery('#gumb-spletna-uporaba').attr('href', dataHref.attr('data-href')).attr('id', ''); + + dataHref.attr('data-href', ''); + } + + var href = jQuery('[href*="/admin/survey/index.php?lang="]'); + if (href.length > 0 && dataHref.length < 1) { + jQuery('#gumb-spletna-uporaba').attr('href', href.attr('href')).attr('id', ''); + } + + + jQuery('[href*="/admin/survey/index.php?lang="]').removeClass('gumb-spletna-uporaba'); + + } else { + var href = jQuery('[href*="/admin/survey/index.php?lang="]'); + + if (href.length > 0) { + href.attr('data-href', href.attr('href')).attr('href', '#'); + } + + jQuery('[data-href*="/admin/survey/index.php?lang="]').addClass('gumb-spletna-uporaba'); + } + } + + + // Meni za mobilnike + jQuery('.burger').on('click', function () { + + if (jQuery('.nav-container .navulwrap').css('display') == 'block') { + + jQuery('.nav-container .navulwrap').hide(); + jQuery(this).css('border-color', '#979797'); + jQuery('.div-block-13').css('background-color', '#979797'); + jQuery('.logolink').css('z-index', ''); + jQuery('.navwrapinner').css('position', ''); + + } else { + + jQuery('.nav-container .navulwrap').show(); + jQuery('.nav-ul-2').appendTo('.glavni-meni > li.active > a.active').show(); + jQuery(this).css('border-color', 'transparent'); + jQuery('.div-block-13').css('background-color', '#979797'); + jQuery('.logolink').css('z-index', '-9'); + jQuery('.navwrapinner').css('position', 'fixed'); + + } + + // jQuery('ul.nav-ul').show(); + // jQuery('ul.nav-ul').prepend(''); + // if (jQuery('.nav-ul > li.active-trail').length > 0) { + // jQuery('.nav-ul > li.active-trail').append(jQuery('aside.nav-ul-2 .menu-level-2').html()); + // jQuery('.nav-ul > li.active-trail > .menu').addClass('nav-ul-2-mobile'); + // } + }); + jQuery(document).on('click', '#mobile-menu-close', function () { + jQuery('ul.nav-ul').hide(); + jQuery('.nav-ul-2-mobile').remove(); + jQuery(this).remove(); + }); + + + jQuery('.nakup-brez-registracije').on('click', function () { + jQuery('#modal-login').show(); + jQuery('.nakup-prijava').show(); + + var paket = jQuery(this).attr('data-paket'); + + var cas = new Date(); + cas.setMinutes(cas.getMinutes() + 30); + document.cookie = "nakup=1; expires=" + cas + ";path=/"; + document.cookie = "paket=" + paket + "; expires=" + cas + ";path=/"; + }); + + // Naročila + jQuery('.racun-na-podjetje').on('click', function () { + jQuery('.podatki-za-podjetje').toggle(); + + if (jQuery('#racun-na-podjetje').is(':checked')) { + jQuery('.polje-za-podjetje').attr('required', 'required'); + } else { + jQuery('.polje-za-podjetje').removeAttr('required'); + jQuery('.polje-za-podjetje').val(''); + jQuery('#zavezanec-za-ddv').prop('checked', false); + } + }); + + jQuery('#zavezanec-za-ddv, .checkbox-zavezanec-za-ddv, [name="podjetje_drzava"]').on('click', function () { + posodobiCenoPaketa(); + }); + + // V kolikor gre za e-račun + jQuery('[name="podjetje_eracun"]').on('click', function(){ + if(jQuery('[name="podjetje_eracun"]').is(':checked')){ + jQuery('.p-e-racun').show(); + } else { + jQuery('.p-e-racun').hide(); + } + }); + + jQuery('#narocilo-paketa-podatki .naprej').on('click', function (e) { + e.preventDefault(); + + jQuery('.error-field').removeClass('error-field'); + jQuery('.error-color').removeClass('error-color'); + + if (!jQuery('[name="payment_method"]').is(":checked")) { + jQuery('[name="payment_method"]').siblings().addClass('error-field'); + } + + if(!jQuery('[name="trajanje"]').is(":checked")){ + jQuery('[name="trajanje"]').siblings().addClass('error-field'); + } + + // Dodamo opozorilov input polja in tudi sklop obarvamo rdeče + jQuery(':input[required]:visible').each(function () { + if (jQuery(this).val() == '') { + jQuery(this).addClass('error-field'); + } + } + ); + + + jQuery('.error-field') + .parents('.accordion-toggle') + .siblings('.accordion-head') + .find('.accordion-title') + .addClass('error-color'); + + if (jQuery('.error-field').length > 0) { + return ''; + } + + // Pri trajanju je pomembno,da pravilno sklanjamo + var trajanje = jQuery('[name="trajanje"]:checked').val(); + if (trajanje == 12) { + trajanje += ' mesecev'; + } else if (trajanje == 3) { + trajanje += ' mesece'; + } else { + trajanje += ' mesec'; + } + + jQuery('#forma-trajanje').text(trajanje); + + + jQuery('#forma-email').text(jQuery('#f-email').val()); + jQuery('#forma-ime').text(jQuery('#f-ime').val()); + if (jQuery('#f-telefon').val().length > 0) { + jQuery('#forma-telefon').text(jQuery('#f-telefon').val()); + jQuery('#col-forma-telefon').show(); + } + + // Iz forme poberemo pdoatke o podjetju + if (jQuery('#racun-na-podjetje').is(':checked')) { + jQuery('#forma-p-naziv').text(jQuery('[name="podjetje_ime"]').val()); + jQuery('#forma-p-ddv').text(jQuery('[name="podjetje_davcna"]').val()); + jQuery('#forma-d-naslov').text(jQuery('[name="podjetje_naslov"]').val()); + jQuery('#forma-d-postna-st').text(jQuery('[name="podjetje_postna"]').val()); + jQuery('#forma-d-posta-ime').text(jQuery('[name="podjetje_posta"]').val()); + jQuery('#forma-d-drzava').text(jQuery('[name="podjetje_drzava"] :selected').val()); + } + + var placilo = ""; + if (jQuery('[name="lang"]').val() == 'sl') { + + switch (jQuery('[name="payment_method"]:checked').val()) { + case "2": + placilo = "Plačilo preko PayPal računa"; + break; + case "3": + placilo = "Plačilo s kreditno kartico"; + break; + default: + placilo = "Plačilo po predračunu"; + } + + } else { + + switch (jQuery('[name="payment_method"]:checked').val()) { + case "2": + placilo = "Payment via PayPal account"; + break; + case "3": + placilo = "Credit card payment"; + break; + default: + placilo = "Payment by pro forma invoice"; + } + + } + + jQuery('#forma-nacin-placila').text(placilo); + + jQuery('#nakup-1ka').hide(); + jQuery('#predogled-nakupa-1ka').show(); + }); + + // Vremo se en korak prej pri izbiri naročila + jQuery('#nazaj-na-nakup-1ka').on('click', function () { + jQuery('#nakup-1ka').show(); + jQuery('#predogled-nakupa-1ka').hide(); + }); + + // Oddamo naročilo + jQuery('#oddaj-narocilo').on('click', function (e) { + e.preventDefault(); + + oddajNarociloNaStreznik(); + }); + + jQuery('#button-placilo-po-predracunu').on('click', function () { + + jQuery('.vrsta-placila').hide(); + jQuery('.obvestila').html('Obdelujem . . .'); + + + var narocilo = jQuery('#izbria-nacina-placila-1ka [name="narocilo_id"]').val(); + }); + + //Pri menjavi placila prikazemo ustrezno polje + jQuery('[name="payment_method"]').on('change', function () { + //Plačilo preko Stripa + preverimoZaVrstoPlacila(); + }); + + // Uspešno oddan predračun ali plačilo preko spleta + if (jQuery('.narocilo-1ka-pdf').length > 0) { + if (document.cookie.indexOf('pdf=') < 1) { + return window.location.href = '/'; + } + + var piskotek = ";" + document.cookie; + + if (piskotek.indexOf("; pdf=") > 0) { + + // Pobrišemo vse nastavljene piškotke povezane z nakupom + document.cookie = "pdf=1;expires=Thu, 01 Jan 1970 00:00:01 GMT;path=/"; + document.cookie = "vrsta_placila=0;expires=Thu, 01 Jan 1970 00:00:01 GMT;path=/"; + document.cookie = "brezplacen_preklop=0;expires=Thu, 01 Jan 1970 00:00:01 GMT;path=/"; + + } + } + + if ( + (window.location.pathname.indexOf('/narocilo/paypal-cancel') > -1 && location.search.split('narocilo_id=').length > 1) || + (window.location.pathname.indexOf('/paypal-purchase/cancel') > -1 && location.search.split('narocilo_id=').length > 1) + ) { + var parametri = window.location.search.substr(1); + + jQuery.post('/frontend/payments/api.php?action=cancel_narocilo_paypal', parametri).done(function (val) { + val = JSON.parse(val); + + if (val.error) { + return jQuery('.procesiram-narocilo').text(val.error); + } + + }); + } + + if ( + (window.location.href.indexOf('/narocilo/paypal?narocilo_id') > -1 && location.search.split('narocilo_id=').length > 1) || + (window.location.href.indexOf('/paypal-purchase/success?narocilo_id') > -1 && location.search.split('narocilo_id=').length > 1) + ){ + var parametri = window.location.search.substr(1); + + jQuery.post('/frontend/payments/api.php?action=capture_narocilo_paypal', parametri).done(function (val) { + val = JSON.parse(val); + + if (val.error) { + return jQuery('.procesiram-narocilo').text(val.error); + } + + }); + } + + // jQuery('.accordion-head').on('click', function(){ + // var st = jQuery(this).attr("data-open"); + // + // jQuery('.data-'+st).toggle(); + // }); + + //Odpiranje funkcionalnosti pri paketih + jQuery('.accordion-head').on('click', function () { + jQuery(this).toggleClass('active'); + jQuery(this).siblings().toggleClass('active').removeStyle(); + }); + + jQuery('.razpri-zapri-vse').on('click', function () { + jQuery(this).toggleClass('active'); + + if (jQuery(this).hasClass('active')) { + jQuery('.accordion-head').addClass('active'); + jQuery('.accordion-head').siblings().addClass('active'); + } else { + jQuery('.accordion-head').removeClass('active'); + jQuery('.accordion-head').siblings().removeClass('active'); + } + }); + + // PRidobimo pakete + if (window.location.pathname.indexOf('zasebni-paketi') > -1 || window.location.pathname.indexOf('private-packages') > -1) { + jQuery.post('/frontend/payments/api.php?action=get_paketi').done(function (val) { + val = JSON.parse(val); + + jQuery('[data-price="2"]').text(val.paketi[2].price[12].monthly); + jQuery('[data-price="3"]').text(val.paketi[3].price[12].monthly); + }); + } + + + if (window.location.pathname.indexOf('izvedi-nakup') > -1 || window.location.pathname.indexOf('/purchase/') > -1) { + // Če uporabnik ni prijavljen + if (document.cookie.indexOf('unam=') < 1) { + return window.location.href = '/'; + } + + //Nastavimo prevzeto plačevanje s karticam + jQuery('[name="payment_method"][value="3"]').prop('checked', true); + preverimoZaVrstoPlacila(); + + posodobiCenoPaketa(); + } + + jQuery('#nakup-1ka .izbira').on('change', function () { + posodobiCenoPaketa(); + }); + + jQuery('#nakup-1ka #polje-drzava').on('change', function(){ + if(jQuery(this).val() == 'Slovenija' || jQuery(this).val() == 'Slovenia'){ + jQuery('#nakup-1ka #polje-podjetje-eracun').show(); + } else { + jQuery('#nakup-1ka #polje-podjetje-eracun').hide(); + jQuery('[name="podjetje_eracun"]').prop('checked', false); + } + }); + + jQuery('[name="podjetje_davcna"]').keyup(function () { + var davcna = jQuery('[name="podjetje_davcna"]').val().replace(/\D/g, ''); // samo številke + + // if(davcna.length == 8) { + // $("#obvestilceDavcna").val("Iščemo ime podjetja s to davčno številko ..."); + // $.ajax({ + // url: "https://www.go-tel.si/tecaji/poizvedba.php", + // type: "post", + // data: { + // davcna:davcna + // }, + // headers: { + // "accept": "application/json", + // "Access-Control-Allow-Origin":"*" + // }, + // success: function(response) { + // if(response!=undefined) { + // var rez=JSON.parse(response); + // return console.log(rez); + // + // // if(rez!=undefined) { + // // if(rez.naziv) { + // // $("#firma_naziv").val(rez.naziv); + // // $("#firma_naslov").val(rez.naslov); + // // $("#firma_postna").val(rez.posta); + // // $("#firma_posta").val(rez.kraj); + // // } + // // else + // // $("#obvestilceDavcna").html("V bazi ne najdemo podjetja s to davčno številko ... Podatke vnesite ročno."); + // // } + // // else + // // $("#obvestilceDavcna").html("V bazi ne najdemo podjetja s to davčno številko ... Podatke vnesite ročno."); + // } + // }, + // error: function() { + // // pocistiPolja(); + // } + // }); + // } + }); + + /* + * Posredujemo podatke za poslovne uporabnike + */ + jQuery('#narocilo-poslovni-uporabniki .submit-btn').on('click', function (e) { + e.preventDefault(); + + + jQuery('.error-field').removeClass('error-field'); + jQuery('.error-color').removeClass('error-color'); + + if (!jQuery('[name="vrsta_domene"]').is(":checked")) { + jQuery('[name="vrsta_domene"]').siblings('span').addClass('error-color'); + } + + if (!jQuery('#strinjanje_s_pogoji').is(":checked")) { + jQuery('#strinjanje_s_pogoji').siblings('span').addClass('error-color'); + } + + // Dodamo opozorilov input polja in tudi sklop obarvamo rdeče + jQuery(':input[required]:visible').each(function () { + if (jQuery(this).val() == '') { + jQuery(this).addClass('error-field'); + } + } + ); + + if (jQuery('.error-field, .error-color').length > 0) { + return ''; + } + + //Onemogočimo dvojno pošiljanje + var pocakaj = jQuery(this).attr('data-wait'); + jQuery(this).val(pocakaj).attr('disabled', 'disabled'); + + + var podatki = jQuery('#narocilo-poslovni-uporabniki').serialize(); + + + jQuery.post('/frontend/payments/api.php?action=send_poslovni_uporabniki', podatki).done(function (val) { + val = JSON.parse(val); + + if (val.success) { + jQuery('#narocilo-poslovni-uporabniki').hide(); + jQuery('#nakup-1ka-poslovni-uporabniki .uspesno-oddano-narocilo').show(); + jQuery('.vsebina h1').text('Uspešno oddano naročilo'); + } + }); + + }); + + jQuery(window).scroll(function () { + var scroll = jQuery('.nav-container').offset().top; + + if (scroll > 50) { + jQuery('.nav-container').addClass('nav-sticky'); + } else { + jQuery('.nav-container').removeClass('nav-sticky'); + } + }); + + // BREADCRUM ZAMENJAMO ZNAK + jQuery('.breadcrumb__separator').text(''); + + + // //Mnenje uporabnikom - dodamo manjkajoč DIV + jQuery('.slidearrow-mnenja.w-slider-arrow-right').on('click', function () { + // var width = jQuery('.w-slider-mask').width(); + // var dataWidth = jQuery('.slide-mnenje').attr('data-width') || 0; + // + // var sumWidth = -width + +dataWidth; + // if((jQuery('.slide-mnenje').length/2 - 1)*width == -dataWidth){ + // sumWidth = 0; + // } + // + // jQuery('.slide-mnenje').css({ transform: "translateX("+sumWidth+"px)", opacity: 1, transition: "transform 500ms ease 0s" }); + // jQuery('.slide-mnenje').attr('data-width', sumWidth); + + jQuery.each(jQuery('[data-show]'), function (i, val) { + var st = jQuery(this).attr('data-show'); + jQuery(this).removeAttr('data-show').hide(); + + st = +st + 1; + + if (st > 9) { + jQuery('.slide-mnenje').eq(0).attr('data-show', 1).show(); + jQuery('.slide-mnenje').eq(1).attr('data-show', 2).show(); + } else { + jQuery('.slide-mnenje').eq(st).attr('data-show', st + 1).show(); + } + }); + + }); + + jQuery('.slidearrow-mnenja.w-slider-arrow-left').on('click', function () { + // var width = jQuery('.w-slider-mask').width(); + // var dataWidth = jQuery('.slide-mnenje').attr('data-width') || 0; + // + // var sumWidth = +dataWidth + +width; + // if(dataWidth == 0){ + // sumWidth = - (jQuery('.slide-mnenje').length/2 - 1) * width; + // } + // + // jQuery('.slide-mnenje').css({ transform: "translateX("+sumWidth+"px)", opacity: 1, transition: "transform 500ms ease 0s" }); + // jQuery('.slide-mnenje').attr('data-width', sumWidth); + + jQuery.each(jQuery('[data-show]'), function (i, val) { + var st = jQuery(this).attr('data-show'); + jQuery(this).removeAttr('data-show').hide(); + + st = +st - 2; + + if (st < 1) { + jQuery('.slide-mnenje').eq(8).attr('data-show', 9).show(); + jQuery('.slide-mnenje').eq(9).attr('data-show', 10).show(); + } else { + jQuery('.slide-mnenje').eq(st - 1).attr('data-show', st).show(); + } + }) + }); + + // Prikaz novic + if (jQuery('.submitted span').attr('content')) { + var letoNovice = (new Date(jQuery('.submitted span').attr('content'))).getFullYear(); + + jQuery('.breadcrumb a[href="/d/en/news"]').text('News'); + jQuery('.breadcrumb a[href="/d/en/news/' + letoNovice + '"]').text(letoNovice); + + jQuery('.breadcrumb a[href="/d/sl/novice"]').text('Novice'); + jQuery('.breadcrumb a[href="/d/sl/novice/' + letoNovice + '"]').text(letoNovice); + } + + }); + } + + + }; + +})(jQuery, Drupal, this, this.document); + +function CheckEmail(text) { + jQuery('#modal-registration .w-form-fail').html('').hide(); + jQuery('.w-input').removeClass('error'); + + var text = text || 'Prosimo, popravite email'; + var Email = jQuery('#register-form [name="email"]').val(); + + if (Email.length > 1 && (Email.search('@') == -1 || Email.indexOf('.') == -1)) { + jQuery('#modal-registration .w-form-fail').html('
' + text + '
').show(); + jQuery('#modal-registration [type="email"]').addClass('error'); + + + return false; + } + + return true; +} + +function InsertName() { + var Email = jQuery('#register-form [name="email"]').val(); + var lokacija = Email.search('@'); + + if (Email.search('@') == -1) { + lokacija = Email.length; + } + + var Ime = Email.substring(0, lokacija); + if (jQuery('#register-form [name="ime"]').val().length < 2) { + jQuery('#register-form [name="ime"]').val(Ime); + } +} + +function CheckEmailTypo(text) { + var email = jQuery('#register-form [name="email"]').val(); + var domains = ['gmail.com', 'hotmail.com', 'guest.arnes.si', 'siol.net']; + + var splitEmail = email.split('@'); + + for (var i = 0; i < domains.length; i++) { + var domain = domains[i]; + + if (preveriZaTipkarskoNapakoVemailu(splitEmail[1], domain)) { + jQuery('#modal-registration .w-form-fail').html('
' + text + ' @' + domain + '?
').show(); + return jQuery('#modal-registration [type="email"]').addClass('error'); + } + } + + return ''; +} + + +function preveriZaTipkarskoNapakoVemailu(uporabnikovaDomena, domena) { + // Domeni se ujemata + if (uporabnikovaDomena && domena && uporabnikovaDomena.includes(domena)) + return false; + + //Preverimo če vsebuje dve piki ali vejico + if (new RegExp('(\\.{2})|(\,)').test(uporabnikovaDomena) && uporabnikovaDomena.substring(0, 3) == domena.substring(0, 3)) { + return true; + } + + // domeno razbijemo, da preverimo napake za posamezne črke gm|ail + for (var i = 1; i < domena.length; i++) { + var prviDel = domena.substring(0, i); + var preostenekBesede = domena.substring(i); + + + // preverimo, če so črke napačne + if (new RegExp(prviDel + '.' + preostenekBesede.substring(1)).test(uporabnikovaDomena)) { + return true; + } + + // preverimo, če je dodana črka preveč + if (new RegExp(prviDel + '.' + preostenekBesede).test(uporabnikovaDomena)) { + return true; + } + + // majkajoča črka + if (preostenekBesede !== 'mail' && new RegExp('(' + prviDel + '{0}' + preostenekBesede + ')|(' + domena + '{0})').test(uporabnikovaDomena)) { + return true; + } + + if (domena == 'gmail.com' && new RegExp('gmail.si|gmail.net').test(uporabnikovaDomena) || + domena == 'guest.arnes.si' && new RegExp('arnes.si').test(uporabnikovaDomena) || + domena == 'siol.net' && new RegExp('siol.com').test(uporabnikovaDomena)) { + return true; + } + + if (domena == 'hotmail.com' && new RegExp('hotmail.si').test(uporabnikovaDomena)) { + return true; + } + + // test for switched letters + var switchedLetters = [ + domena.substring(0, i - 1), + domena.charAt(i), + domena.charAt(i - 1), + domena.substring(i + 1) + ].join(''); + + if (uporabnikovaDomena.includes(switchedLetters)) { + return true; + } + } + + return false; +} + +//Fro APP install banner +window.addEventListener('beforeinstallprompt', function (e) { + var piskotek = "; " + document.cookie + ";"; + //if cookies are not accepted, dont show install banner (because install banner covers cookie banner) + if (piskotek.split("; cookie-agreed=2").length != 2) { + e.preventDefault(); + } +}); + +function oddajNarociloNaStreznik() { + jQuery('.pregled-narocila').hide(); + jQuery('.procesiram-narocilo').show(); + + // V kolikor je omenjeno polje izpolnjeno potem gre za robota in preusmerimo na začetno stran + if (jQuery('[name="narocilo-robotsko-narocilo"]').val().length > 0) { + return window.location = '/'; + } + + var podatki = jQuery('form#narocilo-paketa-podatki').serialize(); + + + jQuery.post('/frontend/payments/api.php?action=create_narocilo', podatki).done(function (val) { + val = JSON.parse(val); + + if (val.error) { + jQuery('.procesiram-narocilo').text(val.error).css('color', 'red'); + + return setTimeout(function(){ + jQuery('.pregled-narocila').show(); + if(jQuery('[name="payment_method"]:checked').val() == 3){ + jQuery('#oddaj-stripe').show(); + } else { + jQuery('#oddaj-narocilo').show(); + } + jQuery('.submit-btn.naprej').show(); + jQuery('#nazaj-na-nakup-1ka').show(); + jQuery('.procesiram-narocilo').hide(); + jQuery('.procesiram-narocilo').text('Poteka obdelava').css('color', 'black'); + }, 3000); + } + + var cas = new Date(); + cas.setMinutes(cas.getMinutes() + 30); + + document.cookie = "vrsta_placila=" + jQuery('[name="payment_method"]:checked').val() + ";expires=" + cas + ";path=/"; + + if(val.success) { + var paymentMethod = jQuery('[name="payment_method"]:checked').val(); + var paymentLang = jQuery('#narocilo-paketa-podatki [name="lang"]').val(); + var urlRedirect = '/'; + + if (paymentMethod == 1) { + document.cookie = "pdf=" + val.payment_link + ";expires=" + cas + ";path=/"; + + // Glede na jezik preusmerimo na slovensko oz. angleško verzijo + var urlRedirect = "/d/narocilo-pregled/predracun/pdf"; + if (paymentLang == 'en') { + urlRedirect = "/d/en/purchase/payment-details/pdf"; + } + + } else if (paymentMethod == 2) { + + urlRedirect = val.paypal_link; + + } else if (paymentMethod > 1) { + document.cookie = "pdf=" + val.racun + ";expires=" + cas + ";path=/"; + + // Glede na jezik preusmerimo na slovensko oz. angleško verzijo + var urlRedirect = "/d/narocilo-pregled/racun/pdf"; + if (paymentLang == 'en') { + urlRedirect = "/d/en/purchase/invoice/pdf"; + } + } + + window.location = urlRedirect; + } + + + }); +} + +function preverimoZaVrstoPlacila() { + + if (jQuery('[name="payment_method"]:checked').val() == 3) { + + jQuery('.placilo-kartica').show(); + jQuery('#oddaj-stripe').show(); + jQuery('#oddaj-narocilo').hide(); + + } else { + + jQuery('.placilo-kartica').hide(); + jQuery('#oddaj-stripe').hide(); + jQuery('#oddaj-narocilo').show(); + + } +} + +function posodobiCenoPaketa() { + var paket = jQuery('[name="package_id"]:checked').val(); + var trajanje = jQuery('[name="trajanje"]:checked').val(); + + + jQuery.post('/frontend/payments/api.php?action=get_paketi').done(function (val) { + val = JSON.parse(val); + + var cenaIzpisGledeNaDDV = ''; + jQuery('.cena-z-ddv-text').show(); + jQuery('.zavezanec-za-ddv').hide(); + if (jQuery('#zavezanec-za-ddv').is(':checked') && jQuery('#racun-na-podjetje').is(':checked') && jQuery('[name="podjetje_drzava"] :selected').val() != 'Slovenija' && jQuery('[name="podjetje_drzava"] :selected').val() != 'Slovenia') { + cenaIzpisGledeNaDDV = '_without_tax'; + jQuery('.cena-z-ddv-text').hide(); + jQuery('.zavezanec-za-ddv').show(); + } + + if(val.paketi[paket] && trajanje > 0) { + jQuery('#nakup-1ka .ime-paketa, #predogled-nakupa-1ka .ime-paketa').text(val.paketi[paket].name); + jQuery('#nakup-1ka .cena-paketa, #predogled-nakupa-1ka .cena-paketa').text(val.paketi[paket].price[trajanje]['final' + cenaIzpisGledeNaDDV]); + } + + jQuery('#cena-trajanje1m').text(val.paketi[paket].price[1]['monthly' + cenaIzpisGledeNaDDV]); + jQuery('#cena-trajanje3m').text(val.paketi[paket].price[3]['monthly' + cenaIzpisGledeNaDDV]); + jQuery('#cena-trajanje12m').text(val.paketi[paket].price[12]['monthly' + cenaIzpisGledeNaDDV]); + + + // Preverimo, če ima kak popust od prej + jQuery('.podatki-za-placilo-racuna').show(); + + jQuery.post('/frontend/payments/api.php?action=get_active_subscription', { + 'package_id': paket, + 'trajanje': trajanje, + 'email': jQuery('#narocilo-paketa-podatki #f-email').val(), + }).done(function (response) { + response = JSON.parse(response); + + jQuery('#nakup-1ka .cena-brez-popusta-sklop, #predogled-nakupa-1ka .cena-brez-popusta-sklop').hide(); + + // V kolikor se cena s popustom razlikuje od privzete cene, potem prikažemo še končno ceno s popustom + if (response['final'] !== response['full']) { + jQuery('#nakup-1ka .cena-brez-popusta, #predogled-nakupa-1ka .cena-brez-popusta').text(response['full' + cenaIzpisGledeNaDDV]); + jQuery('#nakup-1ka .cena-brez-popusta-sklop, #predogled-nakupa-1ka .cena-brez-popusta-sklop').show(); + + jQuery('#nakup-1ka .cena-paketa, #predogled-nakupa-1ka .cena-paketa').text(response['final' + cenaIzpisGledeNaDDV]); + + // Če je cena s popustom 0 potem onemogočimo izbiro plačila + if (response['final'] == 0) { + jQuery('.podatki-za-placilo-racuna').hide(); + jQuery('[name="payment_method"][value="1"]').prop('checked', true); + preverimoZaVrstoPlacila(); + } + } + }); + }); +} + +function lang() { + return jQuery('[name="lang"]').val(); +} + +//Stripe payment +function cardValidation() { + var valid = true; + + jQuery('.error-field').removeClass('error-field'); + + var name = jQuery('.placilo-kartica #stripe-name'); + var email = jQuery('#narocilo-paketa-podatki [name="email"]'); + var cardNumber = jQuery('.placilo-kartica #stripe-card-number'); + var month = jQuery('.placilo-kartica #stripe-month'); + var year = jQuery('.placilo-kartica #stripe-year'); + var cvc = jQuery('.placilo-kartica #stripe-cvc'); + + jQuery("#stripe-error-message").html("").hide(); + + if (name.val().trim() == "") { + name.addClass('error-field'); + valid = false; + } + if (email.val().trim() == "") { + valid = false; + } + + if (cardNumber.val().trim() == "") { + cardNumber.addClass('error-field'); + valid = false; + } + + if (month.val().trim() == "") { + month.addClass('error-field'); + valid = false; + } + if (year.val().trim() == "") { + year.addClass('error-field'); + valid = false; + } + if (cvc.val().trim() == "") { + cvc.addClass('error-field'); + valid = false; + } + + if (valid == false) { + var opozorilo = "Vsa polja so obvezna!"; + if (lang() == 'en') { + opozorilo = "All Fields are required!"; + } + jQuery("#stripe-error-message").html(opozorilo).show(); + } + + return valid; +} + + +function stripePay(e) { + e.preventDefault(); + + // V kolikor je omenjeno polje izpolnjeno potem gre za robota in preusmerimo na začetno stran + if (jQuery('[name="stripe-robotsko-narocilo"]').val().length > 0) { + return window.location = '/'; + } + + var valid = cardValidation(); + + if (valid == true) { + jQuery(".submit-btn").hide(); + jQuery("#nazaj-na-nakup-1ka").hide(); + // jQuery( "#loader" ).css("display", "inline-block"); + + Stripe.setPublishableKey(jQuery('.placilo-kartica #stripe-token').val()); + + Stripe.createToken({ + number: jQuery('.placilo-kartica #stripe-card-number').val(), + cvc: jQuery('.placilo-kartica #stripe-cvc').val(), + exp_month: jQuery('.placilo-kartica #stripe-month').val(), + exp_year: jQuery('.placilo-kartica #stripe-year').val() + }, stripeResponseHandler); + + //submit from callback + return false; + } +} + +//callback to handle the response from stripe +function stripeResponseHandler(status, response) { + if (response.error) { + //enable the submit button + jQuery('#oddaj-stripe').show(); + + jQuery("#loader").css("display", "none"); + + //display the errors on the form + jQuery("#stripe-error-message").html(response.error.message).show(); + } else { + //get token id + var token = response['id']; + + //insert the token into the form + jQuery('#narocilo-paketa-podatki').append(""); + + //submit form to the server + oddajNarociloNaStreznik(); + } +} diff --git a/frontend/payments/classes/class.ApiNarocilaController.php b/frontend/payments/classes/class.ApiNarocilaController.php index b5a7bcc02..43f803a6b 100644 --- a/frontend/payments/classes/class.ApiNarocilaController.php +++ b/frontend/payments/classes/class.ApiNarocilaController.php @@ -24,11 +24,11 @@ class ApiNarocilaController{ // Preverimo, ce je klic ok (token) - //if($this->checkToken()){ + if($this->checkToken()){ // Izvedemo akcijo $this->executeAction(); - //} + } // Logiramo response klica @@ -75,7 +75,6 @@ class ApiNarocilaController{ } private function checkToken(){ - $raw_post_data = ''; if($this->method == 'POST' && $this->data){ @@ -83,16 +82,19 @@ class ApiNarocilaController{ } // Dobimo request (brez id in token) - $request = ($_SERVER["HTTPS"] == 'on') ? 'https://'.$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"] : 'http://'.$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; + $request_url = ($_SERVER["HTTPS"] == 'on') ? 'https://'.$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"] : 'http://'.$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; + if(!isset($_SERVER['HTTP_IDENTIFIER'])) - $request = preg_replace('/([?&])identifier=[^&]+(&|$)/', '$1', $request); + $request_url = preg_replace('/([?&])identifier=[^&]+(&|$)/', '$1', $request_url); + if(!isset($_SERVER['HTTP_TOKEN'])) - $request = preg_replace('/([?&])token=[^&]+(&|$)/', '$1', $request); + $request_url = preg_replace('/([?&])token=[^&]+(&|$)/', '$1', $request_url); + if(!isset($_SERVER['HTTP_TOKEN']) || !isset($_SERVER['HTTP_IDENTIFIER'])) - $request = substr($request, 0, -1); + $request_url = substr($request_url, 0, -1); // Na nasi strani naredimo hmac podatkov z ustreznim private key-em - $data = $this->method . $request . $raw_post_data; + $data = $this->method . $request_url . $raw_post_data; $token = hash_hmac('sha256', $data, $this->private_key); if($this->params['token'] == $token) From e90dec4cb428ac9cd262338d36e8cf05d96710c0 Mon Sep 17 00:00:00 2001 From: Robert Date: Thu, 5 Nov 2020 14:47:57 +0100 Subject: [PATCH 10/77] Drupal: popravek request_url --- .../sites/all/modules/nakupovanje_1ka/nakupovanje_1ka.module | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/drupal/sites/all/modules/nakupovanje_1ka/nakupovanje_1ka.module b/frontend/drupal/sites/all/modules/nakupovanje_1ka/nakupovanje_1ka.module index 6d1244be8..2af7c9feb 100755 --- a/frontend/drupal/sites/all/modules/nakupovanje_1ka/nakupovanje_1ka.module +++ b/frontend/drupal/sites/all/modules/nakupovanje_1ka/nakupovanje_1ka.module @@ -227,7 +227,7 @@ function nakupovanje_1ka_api() // Pripravimo klic – dodamo parametra »identifikator« in »token« - $ch = curl_init($request.'&token='.$token); + $ch = curl_init($request_url.'&token='.$token); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $request_method); if($request_method == 'POST') { From 781e3b1086e9cd7321eafcaa808479e8784f42a4 Mon Sep 17 00:00:00 2001 From: Robert Date: Thu, 5 Nov 2020 15:11:37 +0100 Subject: [PATCH 11/77] Drupal: popravek dinamicnega vpisa domene. --- .../sites/all/modules/nakupovanje_1ka/nakupovanje_1ka.module | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/drupal/sites/all/modules/nakupovanje_1ka/nakupovanje_1ka.module b/frontend/drupal/sites/all/modules/nakupovanje_1ka/nakupovanje_1ka.module index 2af7c9feb..27f2519df 100755 --- a/frontend/drupal/sites/all/modules/nakupovanje_1ka/nakupovanje_1ka.module +++ b/frontend/drupal/sites/all/modules/nakupovanje_1ka/nakupovanje_1ka.module @@ -197,7 +197,9 @@ function nakupovanje_1ka_menu() function nakupovanje_1ka_api() { - $api_url = 'http://1ka.test/frontend/payments/api.php'; + require($_SERVER['DOCUMENT_ROOT'] . '/settings.php'); + + $api_url = $site_url . 'frontend/payments/api.php'; // Ime akcije dobimo preko zadnjega GET parametra, ki ga Drupal samo uporabi $action = arg(1); @@ -225,7 +227,6 @@ function nakupovanje_1ka_api() // Izracunamo hash (token) $token = hash_hmac('sha256', $data, $private_key); - // Pripravimo klic – dodamo parametra »identifikator« in »token« $ch = curl_init($request_url.'&token='.$token); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $request_method); From 806b6cd3e9fb8a6f6f2f49905645282e3d249daf Mon Sep 17 00:00:00 2001 From: Robert Date: Thu, 5 Nov 2020 15:24:32 +0100 Subject: [PATCH 12/77] Drupal: popravek cUrl responsa --- .../all/modules/nakupovanje_1ka/nakupovanje_1ka.module | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/drupal/sites/all/modules/nakupovanje_1ka/nakupovanje_1ka.module b/frontend/drupal/sites/all/modules/nakupovanje_1ka/nakupovanje_1ka.module index 27f2519df..0c03ac1bd 100755 --- a/frontend/drupal/sites/all/modules/nakupovanje_1ka/nakupovanje_1ka.module +++ b/frontend/drupal/sites/all/modules/nakupovanje_1ka/nakupovanje_1ka.module @@ -237,16 +237,16 @@ function nakupovanje_1ka_api() } curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt($ch, CURLOPT_HEADER ,1); - curl_setopt($ch, CURLOPT_FOLLOWLOCATION ,1); + //curl_setopt($ch, CURLOPT_HEADER ,1); + //curl_setopt($ch, CURLOPT_FOLLOWLOCATION ,1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); - curl_setopt($ch, CURLINFO_HEADER_OUT, true); + //curl_setopt($ch, CURLINFO_HEADER_OUT, true); //Vrne header, kar ni ok, ker drual direktno sprejmo echo // Izvedemo klic $result = curl_exec($ch); curl_close($ch); - print_r($result); + echo $result; die(); } From 14705a6e3f98055eff59ae42476a06572d4b79c1 Mon Sep 17 00:00:00 2001 From: Robert Date: Thu, 5 Nov 2020 15:33:19 +0100 Subject: [PATCH 13/77] Drupal: odstranitev polja "Zavezanec za DDV" --- .../nakupovanje-1ka-kosarica.tpl.php | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/frontend/drupal/sites/all/themes/pro1ka/templates/nakupovanje-1ka-kosarica.tpl.php b/frontend/drupal/sites/all/themes/pro1ka/templates/nakupovanje-1ka-kosarica.tpl.php index 95a741862..eed3f0df0 100644 --- a/frontend/drupal/sites/all/themes/pro1ka/templates/nakupovanje-1ka-kosarica.tpl.php +++ b/frontend/drupal/sites/all/themes/pro1ka/templates/nakupovanje-1ka-kosarica.tpl.php @@ -211,23 +211,23 @@ -
-
-
- - - - - -
-
-
+ + + + + + + +language == 'sl'): ?> + + + + + + + + +
@@ -641,14 +641,14 @@ /
-
- language == 'sl'): ?> - ID za DDV podjetja: - - Company VAT ID: - - / (language == 'sl' ? 'podjetje je zavezanec za DDV' : 'VAT-registered user'); ?>) -
+ +language == 'sl'): ?> + + + + +language == 'sl' ? 'podjetje je zavezanec za DDV' : 'VAT-registered user'); ?> + -
-
- language == 'sl'): ?> - Kreditna kartica - - Credit card - -
- -
+ + +language == 'sl'): ?> + + + + + + + - - - -
-
- -
-
- -
-
- -
-
- -
-
-
- - - - - - -
-
- - - -
-
-
-
-
-
+ + + + + + + + + +language == 'sl' ? 'Ime uporabnika kartice' : 'Card Holder Name'); ?> + + + + + + + + + +language == 'sl' ? 'Številka kartice' : 'Card Number'); ?> + + + + + + +language == 'sl' ? 'Mesec / Leto izteka' : 'Expiry Month / Year'); ?> + + + + + + + + + + + + + + + + + + + + + + + + +
- +language == 'sl' ? 'Oddaj naročilo' : 'Submit order'); ?>

From a2d18cffbaaf2dc2eafe28b2dce1d0bb06e88691 Mon Sep 17 00:00:00 2001 From: Robert Date: Mon, 16 Nov 2020 15:56:49 +0100 Subject: [PATCH 24/77] Drupal: "Stripe za Drupal v3 popravek" --- .../all/modules/nakupovanje_1ka/nakupovanje_1ka.module | 10 ++++++++++ frontend/drupal/sites/all/themes/pro1ka/js/script.js | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/frontend/drupal/sites/all/modules/nakupovanje_1ka/nakupovanje_1ka.module b/frontend/drupal/sites/all/modules/nakupovanje_1ka/nakupovanje_1ka.module index 2cacf3275..4dde3e6bd 100755 --- a/frontend/drupal/sites/all/modules/nakupovanje_1ka/nakupovanje_1ka.module +++ b/frontend/drupal/sites/all/modules/nakupovanje_1ka/nakupovanje_1ka.module @@ -370,6 +370,16 @@ function nakupovanje_1ka_theme($existing, $type, $theme, $path) 'path' => $path_to_theme.'/templates/', ]; + $themes['nakupovanje_1ka_stripe_return'] = [ + 'template' => 'nakupovanje-1ka-stripe-return', + 'path' => $path_to_theme.'/templates/', + ]; + + $themes['nakupovanje_1ka_stripe_cancel'] = [ + 'template' => 'nakupovanje-1ka-stripe-cancel', + 'path' => $path_to_theme.'/templates/', + ]; + $themes['nakupovanje_1ka_cenik_paketov_zasebni_uporabniki'] = [ 'template' => 'nakupovanje-1ka-cenik-zasebni-uporabniki', 'path' => $path_to_theme.'/templates/', diff --git a/frontend/drupal/sites/all/themes/pro1ka/js/script.js b/frontend/drupal/sites/all/themes/pro1ka/js/script.js index deb1113df..ecbcd1ea9 100755 --- a/frontend/drupal/sites/all/themes/pro1ka/js/script.js +++ b/frontend/drupal/sites/all/themes/pro1ka/js/script.js @@ -1274,7 +1274,7 @@ function oddajNarociloNaStreznik() { } else if (paymentMethod == 3) { // Nastavimo Stripe instanco - var stripe = Stripe(jQuery('.placilo-kartica #stripe-token').val()); + var stripe = Stripe(jQuery('#stripe-token').val()); return stripe.redirectToCheckout({ sessionId: val.session_id }); } From d8fbc5bcafddb1bc6b89331bf29cd08d4cefb1e4 Mon Sep 17 00:00:00 2001 From: Robert Date: Tue, 17 Nov 2020 07:03:30 +0100 Subject: [PATCH 25/77] Drupal: tekstovni popravek --- .../sites/all/modules/nakupovanje_1ka/nakupovanje_1ka.module | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/drupal/sites/all/modules/nakupovanje_1ka/nakupovanje_1ka.module b/frontend/drupal/sites/all/modules/nakupovanje_1ka/nakupovanje_1ka.module index 4dde3e6bd..c54727cba 100755 --- a/frontend/drupal/sites/all/modules/nakupovanje_1ka/nakupovanje_1ka.module +++ b/frontend/drupal/sites/all/modules/nakupovanje_1ka/nakupovanje_1ka.module @@ -60,7 +60,7 @@ function nakupovanje_1ka_menu() //Stripe cancel $items['narocilo/stripe-cancel'] = [ - 'title' => 'Preklicano plačilo preko Stripe ssistema', //page title + 'title' => 'Preklicano plačilo preko Stripe sistema', //page title 'description' => 'Uporabnik je preklical plačilo', 'page callback' => 'nakupovanje_1ka_stripe_cancel', //callback function which is invoked when menu item is called. 'access callback' => true, //any user can access this page From fb60069221ab27d8ee2f8bd09aab34ed54747199 Mon Sep 17 00:00:00 2001 From: pero1203 Date: Tue, 17 Nov 2020 08:11:21 +0100 Subject: [PATCH 26/77] Pobrisan ostanek paypal skript --- frontend/payments/paypal-cancel.php | 171 ---------------------------- frontend/payments/paypal-pay.php | 171 ---------------------------- 2 files changed, 342 deletions(-) delete mode 100644 frontend/payments/paypal-cancel.php delete mode 100644 frontend/payments/paypal-pay.php diff --git a/frontend/payments/paypal-cancel.php b/frontend/payments/paypal-cancel.php deleted file mode 100644 index 52fc9bd74..000000000 --- a/frontend/payments/paypal-cancel.php +++ /dev/null @@ -1,171 +0,0 @@ - $value) { - if($get_magic_quotes_exists == true && get_magic_quotes_gpc() == 1) { - $value = urlencode(stripslashes($value)); - } else { - $value = urlencode($value); - } - $req .= "&$key=$value"; -} - - -// Post IPN data back to PayPal to validate the IPN data is genuine -// Without this step anyone can fake IPN data -if(USE_SANDBOX == true) { - $paypal_url = "https://www.sandbox.paypal.com/cgi-bin/webscr"; -} -else { - $paypal_url = "https://www.paypal.com/cgi-bin/webscr"; -} - -$ch = curl_init($paypal_url); -if ($ch == FALSE) { - return FALSE; -} - - -curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); -curl_setopt($ch, CURLOPT_POST, 1); -curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); -curl_setopt($ch, CURLOPT_POSTFIELDS, $req); -curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1); -curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); -curl_setopt($ch, CURLOPT_FORBID_REUSE, 1); - -if(DEBUG == true) { - curl_setopt($ch, CURLOPT_HEADER, 1); - curl_setopt($ch, CURLINFO_HEADER_OUT, 1); -} - - - -// CONFIG: Optional proxy configuration -//curl_setopt($ch, CURLOPT_PROXY, $proxy); -//curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1); -// Set TCP timeout to 30 seconds -curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30); -curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: Close')); -// CONFIG: Please download 'cacert.pem' from "http://curl.haxx.se/docs/caextract.html" and set the directory path -// of the certificate as shown below. Ensure the file is readable by the webserver. -// This is mandatory for some environments. -//$cert = __DIR__ . "./cacert.pem"; -//curl_setopt($ch, CURLOPT_CAINFO, $cert); -$res = curl_exec($ch); -if (curl_errno($ch) != 0) // cURL error - { - if(DEBUG == true) { - error_log(date('[Y-m-d H:i e] '). "Can't connect to PayPal to validate IPN message: " . curl_error($ch) . PHP_EOL, 3, LOG_FILE); - } - curl_close($ch); - exit; -} -else { - // Log the entire HTTP response if debug is switched on. - if(DEBUG == true) { - error_log(date('[Y-m-d H:i e] '). "HTTP request of validation request:". curl_getinfo($ch, CURLINFO_HEADER_OUT) ." for IPN payload: $req" . PHP_EOL, 3, LOG_FILE); - error_log(date('[Y-m-d H:i e] '). "HTTP response of validation request: $res" . PHP_EOL, 3, LOG_FILE); - } - curl_close($ch); -} - - - -// Inspect IPN validation result and act accordingly -// Split response headers and payload, a better way for strcmp -$tokens = explode("\r\n\r\n", trim($res)); -$res = trim(end($tokens)); -if (strcmp ($res, "VERIFIED") == 0) { - // assign posted variables to local variables - $item_name = $_POST['item_name']; - $item_number = $_POST['item_number']; - $payment_status = $_POST['payment_status']; - $payment_amount = $_POST['mc_gross']; - $payment_currency = $_POST['mc_currency']; - $txn_id = $_POST['txn_id']; - $receiver_email = $_POST['receiver_email']; - $payer_email = $_POST['payer_email']; - - include("DBController.php"); - $db = new DBController(); - - // check whether the payment_status is Completed - $isPaymentCompleted = false; - if($payment_status == "Completed") { - $isPaymentCompleted = true; - } - // check that txn_id has not been previously processed - $isUniqueTxnId = false; - $param_type="s"; - $param_value_array = array($txn_id); - $result = $db->runQuery("SELECT * FROM payment WHERE txn_id = ?",$param_type,$param_value_array); - if(empty($result)) { - $isUniqueTxnId = true; - } - // check that receiver_email is your PayPal email - // check that payment_amount/payment_currency are correct - if($isPaymentCompleted) { - $param_type = "sssdss"; - $param_value_array = array($item_number, $item_name, $payment_status, $payment_amount, $payment_currency, $txn_id); - $payment_id = $db->insert("INSERT INTO payment(item_number, item_name, payment_status, payment_amount, payment_currency, txn_id) VALUES(?, ?, ?, ?, ?, ?)", $param_type, $param_value_array); - - } - // process payment and mark item as paid. - - - if(DEBUG == true) { - error_log(date('[Y-m-d H:i e] '). "Verified IPN: $req ". PHP_EOL, 3, LOG_FILE); - } - -} -else if (strcmp ($res, "INVALID") == 0) { - // log for manual investigation - // Add business logic here which deals with invalid IPN messages - if(DEBUG == true) { - error_log(date('[Y-m-d H:i e] '). "Invalid IPN: $req" . PHP_EOL, 3, LOG_FILE); - } -} - - -?> \ No newline at end of file diff --git a/frontend/payments/paypal-pay.php b/frontend/payments/paypal-pay.php deleted file mode 100644 index 52fc9bd74..000000000 --- a/frontend/payments/paypal-pay.php +++ /dev/null @@ -1,171 +0,0 @@ - $value) { - if($get_magic_quotes_exists == true && get_magic_quotes_gpc() == 1) { - $value = urlencode(stripslashes($value)); - } else { - $value = urlencode($value); - } - $req .= "&$key=$value"; -} - - -// Post IPN data back to PayPal to validate the IPN data is genuine -// Without this step anyone can fake IPN data -if(USE_SANDBOX == true) { - $paypal_url = "https://www.sandbox.paypal.com/cgi-bin/webscr"; -} -else { - $paypal_url = "https://www.paypal.com/cgi-bin/webscr"; -} - -$ch = curl_init($paypal_url); -if ($ch == FALSE) { - return FALSE; -} - - -curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); -curl_setopt($ch, CURLOPT_POST, 1); -curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); -curl_setopt($ch, CURLOPT_POSTFIELDS, $req); -curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1); -curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); -curl_setopt($ch, CURLOPT_FORBID_REUSE, 1); - -if(DEBUG == true) { - curl_setopt($ch, CURLOPT_HEADER, 1); - curl_setopt($ch, CURLINFO_HEADER_OUT, 1); -} - - - -// CONFIG: Optional proxy configuration -//curl_setopt($ch, CURLOPT_PROXY, $proxy); -//curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1); -// Set TCP timeout to 30 seconds -curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30); -curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: Close')); -// CONFIG: Please download 'cacert.pem' from "http://curl.haxx.se/docs/caextract.html" and set the directory path -// of the certificate as shown below. Ensure the file is readable by the webserver. -// This is mandatory for some environments. -//$cert = __DIR__ . "./cacert.pem"; -//curl_setopt($ch, CURLOPT_CAINFO, $cert); -$res = curl_exec($ch); -if (curl_errno($ch) != 0) // cURL error - { - if(DEBUG == true) { - error_log(date('[Y-m-d H:i e] '). "Can't connect to PayPal to validate IPN message: " . curl_error($ch) . PHP_EOL, 3, LOG_FILE); - } - curl_close($ch); - exit; -} -else { - // Log the entire HTTP response if debug is switched on. - if(DEBUG == true) { - error_log(date('[Y-m-d H:i e] '). "HTTP request of validation request:". curl_getinfo($ch, CURLINFO_HEADER_OUT) ." for IPN payload: $req" . PHP_EOL, 3, LOG_FILE); - error_log(date('[Y-m-d H:i e] '). "HTTP response of validation request: $res" . PHP_EOL, 3, LOG_FILE); - } - curl_close($ch); -} - - - -// Inspect IPN validation result and act accordingly -// Split response headers and payload, a better way for strcmp -$tokens = explode("\r\n\r\n", trim($res)); -$res = trim(end($tokens)); -if (strcmp ($res, "VERIFIED") == 0) { - // assign posted variables to local variables - $item_name = $_POST['item_name']; - $item_number = $_POST['item_number']; - $payment_status = $_POST['payment_status']; - $payment_amount = $_POST['mc_gross']; - $payment_currency = $_POST['mc_currency']; - $txn_id = $_POST['txn_id']; - $receiver_email = $_POST['receiver_email']; - $payer_email = $_POST['payer_email']; - - include("DBController.php"); - $db = new DBController(); - - // check whether the payment_status is Completed - $isPaymentCompleted = false; - if($payment_status == "Completed") { - $isPaymentCompleted = true; - } - // check that txn_id has not been previously processed - $isUniqueTxnId = false; - $param_type="s"; - $param_value_array = array($txn_id); - $result = $db->runQuery("SELECT * FROM payment WHERE txn_id = ?",$param_type,$param_value_array); - if(empty($result)) { - $isUniqueTxnId = true; - } - // check that receiver_email is your PayPal email - // check that payment_amount/payment_currency are correct - if($isPaymentCompleted) { - $param_type = "sssdss"; - $param_value_array = array($item_number, $item_name, $payment_status, $payment_amount, $payment_currency, $txn_id); - $payment_id = $db->insert("INSERT INTO payment(item_number, item_name, payment_status, payment_amount, payment_currency, txn_id) VALUES(?, ?, ?, ?, ?, ?)", $param_type, $param_value_array); - - } - // process payment and mark item as paid. - - - if(DEBUG == true) { - error_log(date('[Y-m-d H:i e] '). "Verified IPN: $req ". PHP_EOL, 3, LOG_FILE); - } - -} -else if (strcmp ($res, "INVALID") == 0) { - // log for manual investigation - // Add business logic here which deals with invalid IPN messages - if(DEBUG == true) { - error_log(date('[Y-m-d H:i e] '). "Invalid IPN: $req" . PHP_EOL, 3, LOG_FILE); - } -} - - -?> \ No newline at end of file From 61fbc1aec339337feba62549e43be1458769b6b5 Mon Sep 17 00:00:00 2001 From: pero1203 Date: Tue, 17 Nov 2020 08:43:41 +0100 Subject: [PATCH 27/77] Popravek stripe placil - customer email in popravek potrditve narocila --- frontend/payments/classes/class.UserNarocilaStripe.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/payments/classes/class.UserNarocilaStripe.php b/frontend/payments/classes/class.UserNarocilaStripe.php index bfc78d2c9..30b06bac0 100644 --- a/frontend/payments/classes/class.UserNarocilaStripe.php +++ b/frontend/payments/classes/class.UserNarocilaStripe.php @@ -101,6 +101,8 @@ class UserNarocilaStripe{ 'payment_method_types' => ['card'], 'mode' => 'payment', + 'customer_email' => $this->narocilo['email'], + 'line_items' => [ [ 'price_data' => array( @@ -193,7 +195,7 @@ class UserNarocilaStripe{ $sqlNarocilo = sisplet_query("UPDATE user_access_stripe_charge SET status='PAID' - WHERE transaction_id='".$paypal_response->result->id."' + WHERE session_id='".$paypal_response->result->id."' "); if (!$sqlNarocilo){ $response['error'] = 'ERROR! '.mysqli_error($GLOBALS['connect_db']); From bfb7f22beea0147471c6035df7b236a74ac6d430 Mon Sep 17 00:00:00 2001 From: pero1203 Date: Tue, 17 Nov 2020 09:53:56 +0100 Subject: [PATCH 28/77] Popravek avtomatskega prestevilcevanja pri kopiranju bloka z vsebino (prej se nad 50 vprasanj ni vec prestevilcilo) --- admin/survey/BranchingAjax.php | 2 +- admin/survey/classes/class.Common.php | 8 ++---- admin/survey/script/branching.js | 37 --------------------------- 3 files changed, 3 insertions(+), 44 deletions(-) diff --git a/admin/survey/BranchingAjax.php b/admin/survey/BranchingAjax.php index 0f50220a6..723f355c4 100644 --- a/admin/survey/BranchingAjax.php +++ b/admin/survey/BranchingAjax.php @@ -182,7 +182,7 @@ class BranchingAjax { $b->repare_vrstni_red(); - Common::getInstance()->prestevilci($spremenljivka, $all); + Common::getInstance()->prestevilci($spremenljivka, $all=true); // Zacasno shranimo zadnji ustvarjen if, da vemo katerega odpreti echo ''; diff --git a/admin/survey/classes/class.Common.php b/admin/survey/classes/class.Common.php index 84f8db941..a901453f9 100644 --- a/admin/survey/classes/class.Common.php +++ b/admin/survey/classes/class.Common.php @@ -55,7 +55,8 @@ class Common { static function prestevilci ($spremenljivka = 0, $all = false, $force = false) { // Preverimo ce imamo izklopljeno atomatsko prestevilcevanje - SurveySetting::getInstance()->Init(self::$anketa); + SurveySetting::getInstance()->Init(self::$anketa); + $enumerate = SurveySetting::getInstance()->getSurveyMiscSetting('enumerate'); if ($enumerate == '') $enumerate = 1; if($enumerate == 0 && $all != true) return; @@ -66,7 +67,6 @@ class Common { $i = 1; - //sisplet_query("BEGIN"); $sql = sisplet_query("SELECT s.id, variable, variable_custom, s.tip AS tip FROM srv_spremenljivka s, srv_grupa g WHERE s.gru_id=g.id AND g.ank_id='".self::$anketa."' AND s.tip!='9' ORDER BY g.vrstni_red, s.vrstni_red"); // ce je vec kot 50 spremenljivk nimamo avtomatskega prestevilcevanja @@ -107,8 +107,6 @@ class Common { $variable_array2 = $variable_array; // Loop cez vsa vprasanja v anketi po vrstnem redu - //mysqli_data_seek($sql, 0); - //while ($row = mysqli_fetch_array($sql)) { foreach($variable_array2 as $row) { // Ce vprasanje nima custom variable jo lahko prestevilcimo @@ -141,8 +139,6 @@ class Common { array_push($val_array, $row['id']); } - //sisplet_query("COMMIT"); - // prestevilcimo se variable znotraj posameznih vprasanja - prestevilci moramo poklicati sele za zgornjim INSERTom! foreach ($val_array AS $key => $val) { self::prestevilci($val); diff --git a/admin/survey/script/branching.js b/admin/survey/script/branching.js index 85befc093..0448062ef 100644 --- a/admin/survey/script/branching.js +++ b/admin/survey/script/branching.js @@ -378,45 +378,8 @@ function branching_click(event) { /* inline edit vprasanja */ inline_bind_click(event); - - /* to smo dal (zaenkrat) ven - // opcije na levi - // dodajanje spremenljivke - if (ta.is('a.newspr')) { - var spr = ta.parent().attr('spr'); - var _if = ta.parent().attr('if'); - var endif = ta.parent().attr('endif'); - spremenljivka_new(spr, _if, endif); - return false; - } - - // dodajanje ifa - if (ta.is('a.newif')) { - var spr = ta.parent().attr('spr'); - var _if = ta.parent().attr('if'); - var endif = ta.parent().attr('endif'); - if_new(spr, _if, endif, '0'); - return false; - } - - // dodajanje bloka (tip=1) - if (ta.is('a.newblock')) { - var spr = ta.parent().attr('spr'); - var _if = ta.parent().attr('if'); - var endif = ta.parent().attr('endif'); - if_new(spr, _if, endif, '1'); - return false; - } - - // pagebreak - if (ta.is('a.pb')) { - var spr = ta.parent().attr('spr'); - pagebreak(spr); - return false; - }*/ return false; - } // pohendla mouseoverje, ki se lovijo nad branchingom From 819d92e309caa21be570e308636c79d02e3b878c Mon Sep 17 00:00:00 2001 From: pero1203 Date: Tue, 17 Nov 2020 10:17:52 +0100 Subject: [PATCH 29/77] Dodan focus na naslov pri ustvarjanju novega vprasanja, ciscenje nepotrebne kode --- admin/survey/script/branching.js | 3 +++ admin/survey/script/vprasanje.js | 39 ++++++-------------------------- 2 files changed, 10 insertions(+), 32 deletions(-) diff --git a/admin/survey/script/branching.js b/admin/survey/script/branching.js index 0448062ef..1dd4f39c9 100644 --- a/admin/survey/script/branching.js +++ b/admin/survey/script/branching.js @@ -927,6 +927,9 @@ function spremenljivka_new(spremenljivka, _if, endif, copy, tip, podtip, drop) { else { $('#branching').html(data.branching_struktura); vprasanje_fullscreen(data.nova_spremenljivka_id, data.vprasanje_fullscreen); + + // Pri ustvarjanju novega vprasanja izvedemo focus na naslov (da ni potreben dodaten klik) + $('.naslov_inline[spr_id="'+data.nova_spremenljivka_id+'"]').focus(); } } else { diff --git a/admin/survey/script/vprasanje.js b/admin/survey/script/vprasanje.js index 33def94b1..69b44c93d 100644 --- a/admin/survey/script/vprasanje.js +++ b/admin/survey/script/vprasanje.js @@ -11,7 +11,7 @@ function onload_init_vprasanje() { }); } // prikaze fullscreen urejanje vprasanja -function vprasanje_fullscreen (spremenljivka, cache, new_spremenljivka, chart_edit, no_close) { +function vprasanje_fullscreen (spremenljivka, cache, chart_edit, no_close) { if (locked) return; //za ureditev custom opisnih label pri drsniku @@ -80,28 +80,23 @@ function vprasanje_fullscreen (spremenljivka, cache, new_spremenljivka, chart_ed vprasanje_pozicija(spremenljivka); } - - /* - // v primeru nove spremenljivke, refreshamo tudi branching - if (new_spremenljivka == 1) { - refreshLeft(spremenljivka); - }*/ - + // pri skrcenem nacinu moramo se prikazat polni predogled vprasanja if ($('#branching').hasClass('collapsed')) { - if (spremenljivka > 0) { + + if (spremenljivka > 0) { $('#branching_'+spremenljivka).load('ajax.php?t=branching&a=vprasanje_full', {spremenljivka: spremenljivka, anketa:srv_meta_anketa_id}, function () { vprasanje_pozicija(spremenljivka); }); - } else { + } + else { $('#'+spremenljivka).load('ajax.php?t=branching&a=vprasanje_full', {spremenljivka: spremenljivka, anketa:srv_meta_anketa_id}, function () { vprasanje_pozicija(spremenljivka); }); } } - } /** @@ -605,8 +600,7 @@ function change_subtype_number (spremenljivka) { function change_tip(spremenljivka, tip) { $.post('ajax.php?t=vprasanje&a=change_tip', {spremenljivka: spremenljivka, tip: tip, anketa: srv_meta_anketa_id}, function (data) { - vprasanje_fullscreen(spremenljivka, data, false, false, true); - //vprasanje_refresh(spremenljivka, true); + vprasanje_fullscreen(spremenljivka, data, false, true); vprasanje_save(true); }); } @@ -741,25 +735,6 @@ function get_editor_close(id) { } } -//preveri polje drugo in moznost dodajanja polja drugo -//function check_drugo(value, spremenljivka) { -function check_drugo(value, spremenljivka) { - - // preklop na dropdown - if(value == 4){ - //document.getElementById('add_drugo').style.display = 'none'; - - // $('.li_other').remove(); - // $.post('ajax.php?t=vprasanje&a=vrednosti_other_delete', {spremenljivka: spremenljivka, anketa: srv_meta_anketa_id}, function () { - // vprasanje_fullscreen(spremenljivka); - // }); - } - - else{ - //document.getElementById('add_drugo').style.display = 'inline'; - } - -} // prikaze field da manager doda nek komentar obstojecemu komentarju na vprasanje function comment_on_comment (id) { From 29f739629edd3f82ada7ce5a64a686f3c8f9b0ed Mon Sep 17 00:00:00 2001 From: Robert Date: Tue, 17 Nov 2020 12:44:53 +0100 Subject: [PATCH 30/77] =?UTF-8?q?Drupal:=20izbris=20odve=C4=8Dne=20kode=20?= =?UTF-8?q?in=20popravek=20funkcije=20za=20prekic=20Stripe=20naro=C4=8Dila?= =?UTF-8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sites/all/themes/pro1ka/js/script.js | 118 +----------------- 1 file changed, 1 insertion(+), 117 deletions(-) diff --git a/frontend/drupal/sites/all/themes/pro1ka/js/script.js b/frontend/drupal/sites/all/themes/pro1ka/js/script.js index ecbcd1ea9..ee3a9b2af 100755 --- a/frontend/drupal/sites/all/themes/pro1ka/js/script.js +++ b/frontend/drupal/sites/all/themes/pro1ka/js/script.js @@ -822,7 +822,7 @@ ) { var parametri = window.location.search.substr(1); - jQuery.post('/d/nakupovanje-api/cancel_narocilo_stripe', parametri).done(function (val) { + jQuery.post('/d/nakupovanje-api/stripe_checkout_cancel', parametri).done(function (val) { val = JSON.parse(val); if (val.error) { @@ -848,12 +848,6 @@ }); } - // jQuery('.accordion-head').on('click', function(){ - // var st = jQuery(this).attr("data-open"); - // - // jQuery('.data-'+st).toggle(); - // }); - //Odpiranje funkcionalnosti pri paketih jQuery('.accordion-head').on('click', function () { jQuery(this).toggleClass('active'); @@ -1278,15 +1272,6 @@ function oddajNarociloNaStreznik() { return stripe.redirectToCheckout({ sessionId: val.session_id }); } - // else if (paymentMethod > 1) { - // document.cookie = "pdf=" + val.racun + ";expires=" + cas + ";path=/"; - // - // // Glede na jezik preusmerimo na slovensko oz. angleško verzijo - // var urlRedirect = "/d/narocilo-pregled/racun/pdf"; - // if (paymentLang == 'en') { - // urlRedirect = "/d/en/purchase/invoice/pdf"; - // } - // } window.location = urlRedirect; } @@ -1295,23 +1280,6 @@ function oddajNarociloNaStreznik() { }); } -// function preverimoZaVrstoPlacila() { -// -// if (jQuery('[name="payment_method"]:checked').val() == 3) { -// -// jQuery('.placilo-kartica').show(); -// jQuery('#oddaj-stripe').show(); -// jQuery('#oddaj-narocilo').hide(); -// -// } else { -// -// jQuery('.placilo-kartica').hide(); -// jQuery('#oddaj-stripe').hide(); -// jQuery('#oddaj-narocilo').show(); -// -// } -// } - function posodobiCenoPaketa() { var paket = jQuery('[name="package_id"]:checked').val(); var trajanje = jQuery('[name="trajanje"]:checked').val(); @@ -1372,87 +1340,3 @@ function posodobiCenoPaketa() { function lang() { return jQuery('[name="lang"]').val(); } - -//Stripe payment -// function cardValidation() { -// var valid = true; -// -// jQuery('.error-field').removeClass('error-field'); -// -// var name = jQuery('.placilo-kartica #stripe-name'); -// var email = jQuery('#narocilo-paketa-podatki [name="email"]'); -// var cardNumber = jQuery('.placilo-kartica #stripe-card-number'); -// var month = jQuery('.placilo-kartica #stripe-month'); -// var year = jQuery('.placilo-kartica #stripe-year'); -// var cvc = jQuery('.placilo-kartica #stripe-cvc'); -// -// jQuery("#stripe-error-message").html("").hide(); -// -// if (name.val().trim() == "") { -// name.addClass('error-field'); -// valid = false; -// } -// if (email.val().trim() == "") { -// valid = false; -// } -// -// if (cardNumber.val().trim() == "") { -// cardNumber.addClass('error-field'); -// valid = false; -// } -// -// if (month.val().trim() == "") { -// month.addClass('error-field'); -// valid = false; -// } -// if (year.val().trim() == "") { -// year.addClass('error-field'); -// valid = false; -// } -// if (cvc.val().trim() == "") { -// cvc.addClass('error-field'); -// valid = false; -// } -// -// if (valid == false) { -// var opozorilo = "Vsa polja so obvezna!"; -// if (lang() == 'en') { -// opozorilo = "All Fields are required!"; -// } -// jQuery("#stripe-error-message").html(opozorilo).show(); -// } -// -// return valid; -// } - - -// function stripePay(narociloId) { -// var narociloId = narociloId || 0; -// -// // Create an instance of the Stripe object with your publishable API key -// var stripe = Stripe(jQuery('.placilo-kartica #stripe-token').val()); -// -// return stripe.redirectToCheckout({ sessionId: narociloId }); -// } - -//callback to handle the response from stripe -// function stripeResponseHandler(status, response) { -// if (response.error) { -// //enable the submit button -// jQuery('#oddaj-stripe').show(); -// -// jQuery("#loader").css("display", "none"); -// -// //display the errors on the form -// jQuery("#stripe-error-message").html(response.error.message).show(); -// } else { -// //get token id -// var token = response['id']; -// -// //insert the token into the form -// jQuery('#narocilo-paketa-podatki').append(""); -// -// //submit form to the server -// oddajNarociloNaStreznik(); -// } -// } From fd72e4109136568154ed2b14a525510b9cf32c5a Mon Sep 17 00:00:00 2001 From: pero1203 Date: Wed, 18 Nov 2020 10:01:11 +0100 Subject: [PATCH 31/77] Pobrisan klic js, ki se ne uporablja --- admin/survey/classes/class.Vprasanje.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/survey/classes/class.Vprasanje.php b/admin/survey/classes/class.Vprasanje.php index 762c711fb..99363b201 100644 --- a/admin/survey/classes/class.Vprasanje.php +++ b/admin/survey/classes/class.Vprasanje.php @@ -3369,7 +3369,7 @@ class Vprasanje { echo '

'; echo ''.$lang['srv_orientacija'].': '; - echo ''; echo ''; echo ''; echo ''; From 24b410f338319b9b34663a446da6ef2f28c3a0d5 Mon Sep 17 00:00:00 2001 From: pero1203 Date: Wed, 18 Nov 2020 10:15:59 +0100 Subject: [PATCH 32/77] Sprememba cen paketov --- .../payments/classes/class.UserNarocila.php | 48 ++++++++++++++----- sql/update2.sql | 6 +++ 2 files changed, 42 insertions(+), 12 deletions(-) diff --git a/frontend/payments/classes/class.UserNarocila.php b/frontend/payments/classes/class.UserNarocila.php index b91b1db97..570e69899 100644 --- a/frontend/payments/classes/class.UserNarocila.php +++ b/frontend/payments/classes/class.UserNarocila.php @@ -66,15 +66,29 @@ class UserNarocila{ $package_price = $this->packages[$package_name]['price']; // Mesecno ceno zmanjsamo glede na trajanje - if((int)$trajanje >= 12){ - $cena['monthly'] = number_format($package_price - 2, 2, '.', ''); + if($package_name == '2ka'){ + if((int)$trajanje >= 12){ + $cena['monthly'] = number_format($package_price - 4, 2, '.', ''); + } + elseif((int)$trajanje >= 3){ + $cena['monthly'] = number_format($package_price - 2, 2, '.', ''); + } + else{ + $cena['monthly'] = number_format($package_price, 2, '.', ''); + } } - elseif((int)$trajanje >= 3){ - $cena['monthly'] = number_format($package_price - 1, 2, '.', ''); - } - else{ - $cena['monthly'] = number_format($package_price, 2, '.', ''); + elseif($package_name == '3ka'){ + if((int)$trajanje >= 12){ + $cena['monthly'] = number_format($package_price - 3, 2, '.', ''); + } + elseif((int)$trajanje >= 3){ + $cena['monthly'] = number_format($package_price - 1.5, 2, '.', ''); + } + else{ + $cena['monthly'] = number_format($package_price, 2, '.', ''); + } } + // Se brez davka za monthly $cena['monthly_without_tax'] = number_format(floatval($cena['monthly']) / 1.22, 2, '.', ''); @@ -133,7 +147,7 @@ class UserNarocila{ if( isset($user_access['package_name']) && (($user_access['package_name'] == '2ka' && $package_name == '3ka') || ($user_access['package_name'] == '3ka' && $package_name == '2ka')) ){ // Mesecna cena obstojecega paketa - $package_price = (int)$this->packages[$user_access['package_name']]['price']; + $package_price = floatval($this->packages[$user_access['package_name']]['price']); // Stevilo dni dokler je obstojeci paket se veljaven $now = time(); @@ -141,11 +155,21 @@ class UserNarocila{ $expire_in_days = floor(($expire - $now) / (60 * 60 * 24)); // Popravimo ceno, ce ima veljaven paket se za 3 mesece ali vec (pomeni, da je imel popust pri nakupu kar upostevamo) - if($expire_in_days > 92){ - $package_price = number_format($package_price - 2, 2, '.', ''); + if($package_name == '2ka'){ + if($expire_in_days > 92){ + $package_price = number_format($package_price - 4, 2, '.', ''); + } + elseif($expire_in_days > 31){ + $package_price = number_format($package_price - 2, 2, '.', ''); + } } - elseif($expire_in_days > 31){ - $package_price = number_format($package_price - 1, 2, '.', ''); + elseif($package_name == '3ka'){ + if($expire_in_days > 92){ + $package_price = number_format($package_price - 3, 2, '.', ''); + } + elseif($expire_in_days > 31){ + $package_price = number_format($package_price - 1.5, 2, '.', ''); + } } // Popust izracunamo kot delez cene paketa in diff --git a/sql/update2.sql b/sql/update2.sql index 6b24b433b..7bcee3a1b 100644 --- a/sql/update2.sql +++ b/sql/update2.sql @@ -9396,3 +9396,9 @@ CREATE TABLE restrict_fk_srv_if ( INSERT INTO restrict_fk_srv_if (if_id) VALUES (0); UPDATE misc SET value='20.11.16' WHERE what="version"; + +## Spremenba cen paketov +UPDATE user_access_paket SET price='13.90' WHERE name='2ka'; +UPDATE user_access_paket SET price='19.90' WHERE name='3ka'; + +UPDATE misc SET value='20.11.16' WHERE what="version"; \ No newline at end of file From 5c57311d95c2f6ba9607e67b54daffee05a054b7 Mon Sep 17 00:00:00 2001 From: pero1203 Date: Thu, 19 Nov 2020 10:36:22 +0100 Subject: [PATCH 33/77] =?UTF-8?q?Po=C4=8Di=C5=A1=C4=8Deni=20nekateri=20fil?= =?UTF-8?q?i=20v=20git-u?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/survey/modules/Evalvacija/class.GC.php | 10 +- composer.lock | 309 +++++------ frontend/payments/api_test.php | 19 +- main/survey/skins/1045_1kaBlue.css | 529 ------------------- 4 files changed, 138 insertions(+), 729 deletions(-) delete mode 100644 main/survey/skins/1045_1kaBlue.css diff --git a/admin/survey/modules/Evalvacija/class.GC.php b/admin/survey/modules/Evalvacija/class.GC.php index 1424d2017..2f3b189da 100644 --- a/admin/survey/modules/Evalvacija/class.GC.php +++ b/admin/survey/modules/Evalvacija/class.GC.php @@ -183,15 +183,15 @@ class GC{ '4_1' => 'predmeti' ); - $reports_id = '30102020'; - $report_type = '3_1'; - $fak_id = '3000043'; + $reports_id = '11112020'; + $report_type = '2_2'; + $fak_id = '3000027'; $zip_name = ''; // Nastavimo pot do pdf-jev - //$this->pdf_path = 'modules/Evalvacija/pdf/unzipped/'; + $this->pdf_path = 'modules/Evalvacija/pdf/unzipped/'; //$this->pdf_path = 'modules/Evalvacija/pdf/unzipped/'.$fakultete[$fak_id]['kratica'].'/'; - $this->pdf_path = 'modules/Evalvacija/pdf/unzipped/'.$fakultete[$fak_id]['kratica'].'/'.$report_type_array[$report_type].'/'; + //$this->pdf_path = 'modules/Evalvacija/pdf/unzipped/'.$fakultete[$fak_id]['kratica'].'/'.$report_type_array[$report_type].'/'; echo 'Parametri:'; echo '

  • ID: '.$reports_id.'
  • '; diff --git a/composer.lock b/composer.lock index 54c328891..0f35bb0c7 100644 --- a/composer.lock +++ b/composer.lock @@ -65,16 +65,16 @@ }, { "name": "fgrosse/phpasn1", - "version": "v2.1.1", + "version": "v2.2.0", "source": { "type": "git", "url": "https://github.com/fgrosse/PHPASN1.git", - "reference": "7ebf2a09084a7bbdb7b879c66fdf7ad80461bbe8" + "reference": "d1978f7abd580f3fc33561e7f71d4c12c7531fad" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fgrosse/PHPASN1/zipball/7ebf2a09084a7bbdb7b879c66fdf7ad80461bbe8", - "reference": "7ebf2a09084a7bbdb7b879c66fdf7ad80461bbe8", + "url": "https://api.github.com/repos/fgrosse/PHPASN1/zipball/d1978f7abd580f3fc33561e7f71d4c12c7531fad", + "reference": "d1978f7abd580f3fc33561e7f71d4c12c7531fad", "shasum": "" }, "require": { @@ -85,8 +85,10 @@ "satooshi/php-coveralls": "~2.0" }, "suggest": { + "ext-bcmath": "BCmath is the fallback extension for big integer calculations", + "ext-curl": "For loading OID information from the web if they have not bee defined statically", "ext-gmp": "GMP is the preferred extension for big integer calculations", - "php-curl": "For loading OID information from the web if they have not bee defined statically" + "phpseclib/bcmath_compat": "BCmath polyfill for servers where neither GMP nor BCmath is available" }, "type": "library", "extra": { @@ -130,31 +132,31 @@ "x509", "x690" ], - "time": "2018-12-02 01:34:34" + "time": "2020-10-11 16:28:18" }, { "name": "geoip2/geoip2", - "version": "v2.10.0", + "version": "v2.11.0", "source": { "type": "git", "url": "https://github.com/maxmind/GeoIP2-php.git", - "reference": "419557cd21d9fe039721a83490701a58c8ce784a" + "reference": "d01be5894a5c1a3381c58c9b1795cd07f96c30f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/maxmind/GeoIP2-php/zipball/419557cd21d9fe039721a83490701a58c8ce784a", - "reference": "419557cd21d9fe039721a83490701a58c8ce784a", + "url": "https://api.github.com/repos/maxmind/GeoIP2-php/zipball/d01be5894a5c1a3381c58c9b1795cd07f96c30f7", + "reference": "d01be5894a5c1a3381c58c9b1795cd07f96c30f7", "shasum": "" }, "require": { "ext-json": "*", - "maxmind-db/reader": "~1.5", - "maxmind/web-service-common": "~0.6", - "php": ">=5.6" + "maxmind-db/reader": "~1.8", + "maxmind/web-service-common": "~0.8", + "php": ">=7.2" }, "require-dev": { "friendsofphp/php-cs-fixer": "2.*", - "phpunit/phpunit": "5.*", + "phpunit/phpunit": "^8.0 || ^9.0", "squizlabs/php_codesniffer": "3.*" }, "type": "library", @@ -183,7 +185,7 @@ "geolocation", "maxmind" ], - "time": "2019-12-12 18:48:39" + "time": "2020-10-01 18:48:34" }, { "name": "guzzlehttp/guzzle", @@ -254,23 +256,23 @@ }, { "name": "guzzlehttp/promises", - "version": "v1.3.1", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646" + "reference": "60d379c243457e073cff02bc323a2a86cb355631" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646", - "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "url": "https://api.github.com/repos/guzzle/promises/zipball/60d379c243457e073cff02bc323a2a86cb355631", + "reference": "60d379c243457e073cff02bc323a2a86cb355631", "shasum": "" }, "require": { - "php": ">=5.5.0" + "php": ">=5.5" }, "require-dev": { - "phpunit/phpunit": "^4.0" + "symfony/phpunit-bridge": "^4.4 || ^5.1" }, "type": "library", "extra": { @@ -301,20 +303,20 @@ "keywords": [ "promise" ], - "time": "2016-12-20 10:07:11" + "time": "2020-09-30 07:37:28" }, { "name": "guzzlehttp/psr7", - "version": "1.6.1", + "version": "1.7.0", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "239400de7a173fe9901b9ac7c06497751f00727a" + "reference": "53330f47520498c0ae1f61f7e2c90f55690c06a3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/239400de7a173fe9901b9ac7c06497751f00727a", - "reference": "239400de7a173fe9901b9ac7c06497751f00727a", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/53330f47520498c0ae1f61f7e2c90f55690c06a3", + "reference": "53330f47520498c0ae1f61f7e2c90f55690c06a3", "shasum": "" }, "require": { @@ -327,15 +329,15 @@ }, "require-dev": { "ext-zlib": "*", - "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8" + "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.8 || ^9.3.10" }, "suggest": { - "zendframework/zend-httphandlerrunner": "Emit PSR-7 responses" + "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.6-dev" + "dev-master": "1.7-dev" } }, "autoload": { @@ -372,27 +374,27 @@ "uri", "url" ], - "time": "2019-07-01 23:21:34" + "time": "2020-09-30 07:37:11" }, { "name": "maxmind-db/reader", - "version": "v1.7.0", + "version": "v1.8.0", "source": { "type": "git", "url": "https://github.com/maxmind/MaxMind-DB-Reader-php.git", - "reference": "942553da239f12051275f9c666538b5dd09e2908" + "reference": "b566d429ac9aec10594b0935be8ff38302f8d5c8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/maxmind/MaxMind-DB-Reader-php/zipball/942553da239f12051275f9c666538b5dd09e2908", - "reference": "942553da239f12051275f9c666538b5dd09e2908", + "url": "https://api.github.com/repos/maxmind/MaxMind-DB-Reader-php/zipball/b566d429ac9aec10594b0935be8ff38302f8d5c8", + "reference": "b566d429ac9aec10594b0935be8ff38302f8d5c8", "shasum": "" }, "require": { "php": ">=7.2" }, "conflict": { - "ext-maxminddb": "<1.7.0,>=2.0.0" + "ext-maxminddb": "<1.8.0,>=2.0.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "2.*", @@ -432,31 +434,31 @@ "geolocation", "maxmind" ], - "time": "2020-08-07 22:10:05" + "time": "2020-10-01 17:30:21" }, { "name": "maxmind/web-service-common", - "version": "v0.7.0", + "version": "v0.8.1", "source": { "type": "git", "url": "https://github.com/maxmind/web-service-common-php.git", - "reference": "74c996c218ada5c639c8c2f076756e059f5552fc" + "reference": "32f274051c543fc865e5a84d3a2c703913641ea8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/maxmind/web-service-common-php/zipball/74c996c218ada5c639c8c2f076756e059f5552fc", - "reference": "74c996c218ada5c639c8c2f076756e059f5552fc", + "url": "https://api.github.com/repos/maxmind/web-service-common-php/zipball/32f274051c543fc865e5a84d3a2c703913641ea8", + "reference": "32f274051c543fc865e5a84d3a2c703913641ea8", "shasum": "" }, "require": { "composer/ca-bundle": "^1.0.3", "ext-curl": "*", "ext-json": "*", - "php": ">=5.6" + "php": ">=7.2" }, "require-dev": { "friendsofphp/php-cs-fixer": "2.*", - "phpunit/phpunit": "^4.8.36 || ^5.7 || ^6.5 || ^7.0", + "phpunit/phpunit": "^8.0 || ^9.0", "squizlabs/php_codesniffer": "3.*" }, "type": "library", @@ -478,7 +480,7 @@ ], "description": "Internal MaxMind Web Service API", "homepage": "https://github.com/maxmind/web-service-common-php", - "time": "2020-05-06 14:07:26" + "time": "2020-11-02 17:00:53" }, { "name": "minishlink/web-push", @@ -538,20 +540,20 @@ }, { "name": "paragonie/random_compat", - "version": "v9.99.99", + "version": "v9.99.100", "source": { "type": "git", "url": "https://github.com/paragonie/random_compat.git", - "reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95" + "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paragonie/random_compat/zipball/84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95", - "reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/996434e5492cb4c3edcb9168db6fbb1359ef965a", + "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a", "shasum": "" }, "require": { - "php": "^7" + "php": ">= 7" }, "require-dev": { "phpunit/phpunit": "4.*|5.*", @@ -579,7 +581,7 @@ "pseudorandom", "random" ], - "time": "2018-07-02 15:55:56" + "time": "2020-10-15 08:29:30" }, { "name": "paragonie/sodium_compat", @@ -754,21 +756,22 @@ }, { "name": "phpmailer/phpmailer", - "version": "v6.1.7", + "version": "v6.1.8", "source": { "type": "git", "url": "https://github.com/PHPMailer/PHPMailer.git", - "reference": "2c2370ba3df7034f9eb7b8f387c97b52b2ba5ad0" + "reference": "917ab212fa00dc6eacbb26e8bc387ebe40993bc1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/2c2370ba3df7034f9eb7b8f387c97b52b2ba5ad0", - "reference": "2c2370ba3df7034f9eb7b8f387c97b52b2ba5ad0", + "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/917ab212fa00dc6eacbb26e8bc387ebe40993bc1", + "reference": "917ab212fa00dc6eacbb26e8bc387ebe40993bc1", "shasum": "" }, "require": { "ext-ctype": "*", "ext-filter": "*", + "ext-hash": "*", "php": ">=5.5.0" }, "require-dev": { @@ -812,7 +815,7 @@ } ], "description": "PHPMailer is a full-featured email creation and transfer class for PHP", - "time": "2020-07-14 18:50:27" + "time": "2020-10-09 14:55:58" }, { "name": "psr/http-message", @@ -963,29 +966,28 @@ }, { "name": "spomky-labs/base64url", - "version": "v2.0.3", + "version": "v2.0.4", "source": { "type": "git", "url": "https://github.com/Spomky-Labs/base64url.git", - "reference": "48ea8ff600cefe56b82d3d5b768b6f4f3bfe05a1" + "reference": "7752ce931ec285da4ed1f4c5aa27e45e097be61d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Spomky-Labs/base64url/zipball/48ea8ff600cefe56b82d3d5b768b6f4f3bfe05a1", - "reference": "48ea8ff600cefe56b82d3d5b768b6f4f3bfe05a1", + "url": "https://api.github.com/repos/Spomky-Labs/base64url/zipball/7752ce931ec285da4ed1f4c5aa27e45e097be61d", + "reference": "7752ce931ec285da4ed1f4c5aa27e45e097be61d", "shasum": "" }, "require": { "php": ">=7.1" }, "require-dev": { - "php-coveralls/php-coveralls": "^2.0", - "phpstan/phpstan": "^0.11", - "phpstan/phpstan-beberlei-assert": "^0.11.0", - "phpstan/phpstan-deprecation-rules": "^0.11", - "phpstan/phpstan-phpunit": "^0.11", - "phpstan/phpstan-strict-rules": "^0.11", - "phpunit/phpunit": "^7.0|^8.0|^9.0" + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "^0.11|^0.12", + "phpstan/phpstan-beberlei-assert": "^0.11|^0.12", + "phpstan/phpstan-deprecation-rules": "^0.11|^0.12", + "phpstan/phpstan-phpunit": "^0.11|^0.12", + "phpstan/phpstan-strict-rules": "^0.11|^0.12" }, "type": "library", "autoload": { @@ -1011,20 +1013,20 @@ "safe", "url" ], - "time": "2020-08-30 13:35:33" + "time": "2020-11-03 09:10:25" }, { "name": "stripe/stripe-php", - "version": "v7.52.0", + "version": "v7.61.0", "source": { "type": "git", "url": "https://github.com/stripe/stripe-php.git", - "reference": "51e95c514aff45616dff09791ca5b2f10cf5c4e8" + "reference": "51c6cd18cb51740101c940a3fefc876ef7cd8cae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/stripe/stripe-php/zipball/51e95c514aff45616dff09791ca5b2f10cf5c4e8", - "reference": "51e95c514aff45616dff09791ca5b2f10cf5c4e8", + "url": "https://api.github.com/repos/stripe/stripe-php/zipball/51c6cd18cb51740101c940a3fefc876ef7cd8cae", + "reference": "51c6cd18cb51740101c940a3fefc876ef7cd8cae", "shasum": "" }, "require": { @@ -1068,26 +1070,25 @@ "payment processing", "stripe" ], - "time": "2020-09-08 19:29:20" + "time": "2020-10-20 20:01:45" }, { "name": "symfony/polyfill-intl-idn", - "version": "v1.18.1", + "version": "v1.20.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-idn.git", - "reference": "5dcab1bc7146cf8c1beaa4502a3d9be344334251" + "reference": "3b75acd829741c768bc8b1f84eb33265e7cc5117" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/5dcab1bc7146cf8c1beaa4502a3d9be344334251", - "reference": "5dcab1bc7146cf8c1beaa4502a3d9be344334251", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/3b75acd829741c768bc8b1f84eb33265e7cc5117", + "reference": "3b75acd829741c768bc8b1f84eb33265e7cc5117", "shasum": "" }, "require": { - "php": ">=5.3.3", + "php": ">=7.1", "symfony/polyfill-intl-normalizer": "^1.10", - "symfony/polyfill-php70": "^1.10", "symfony/polyfill-php72": "^1.10" }, "suggest": { @@ -1096,7 +1097,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.18-dev" + "dev-main": "1.20-dev" }, "thanks": { "name": "symfony/polyfill", @@ -1139,24 +1140,24 @@ "portable", "shim" ], - "time": "2020-08-04 06:02:08" + "time": "2020-10-23 14:02:19" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.18.1", + "version": "v1.20.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "37078a8dd4a2a1e9ab0231af7c6cb671b2ed5a7e" + "reference": "727d1096295d807c309fb01a851577302394c897" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/37078a8dd4a2a1e9ab0231af7c6cb671b2ed5a7e", - "reference": "37078a8dd4a2a1e9ab0231af7c6cb671b2ed5a7e", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/727d1096295d807c309fb01a851577302394c897", + "reference": "727d1096295d807c309fb01a851577302394c897", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1" }, "suggest": { "ext-intl": "For best performance" @@ -1164,7 +1165,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.18-dev" + "dev-main": "1.20-dev" }, "thanks": { "name": "symfony/polyfill", @@ -1206,92 +1207,29 @@ "portable", "shim" ], - "time": "2020-07-14 12:35:20" - }, - { - "name": "symfony/polyfill-php70", - "version": "v1.18.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php70.git", - "reference": "0dd93f2c578bdc9c72697eaa5f1dd25644e618d3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/0dd93f2c578bdc9c72697eaa5f1dd25644e618d3", - "reference": "0dd93f2c578bdc9c72697eaa5f1dd25644e618d3", - "shasum": "" - }, - "require": { - "paragonie/random_compat": "~1.0|~2.0|~9.99", - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.18-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php70\\": "" - }, - "files": [ - "bootstrap.php" - ], - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "time": "2020-07-14 12:35:20" + "time": "2020-10-23 14:02:19" }, { "name": "symfony/polyfill-php72", - "version": "v1.18.1", + "version": "v1.20.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "639447d008615574653fb3bc60d1986d7172eaae" + "reference": "cede45fcdfabdd6043b3592e83678e42ec69e930" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/639447d008615574653fb3bc60d1986d7172eaae", - "reference": "639447d008615574653fb3bc60d1986d7172eaae", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/cede45fcdfabdd6043b3592e83678e42ec69e930", + "reference": "cede45fcdfabdd6043b3592e83678e42ec69e930", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.18-dev" + "dev-main": "1.20-dev" }, "thanks": { "name": "symfony/polyfill", @@ -1328,7 +1266,7 @@ "portable", "shim" ], - "time": "2020-07-14 12:35:20" + "time": "2020-10-23 14:02:19" }, { "name": "web-token/jwt-core", @@ -1970,25 +1908,25 @@ "packages-dev": [ { "name": "filp/whoops", - "version": "2.7.3", + "version": "2.9.1", "source": { "type": "git", "url": "https://github.com/filp/whoops.git", - "reference": "5d5fe9bb3d656b514d455645b3addc5f7ba7714d" + "reference": "307fb34a5ab697461ec4c9db865b20ff2fd40771" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filp/whoops/zipball/5d5fe9bb3d656b514d455645b3addc5f7ba7714d", - "reference": "5d5fe9bb3d656b514d455645b3addc5f7ba7714d", + "url": "https://api.github.com/repos/filp/whoops/zipball/307fb34a5ab697461ec4c9db865b20ff2fd40771", + "reference": "307fb34a5ab697461ec4c9db865b20ff2fd40771", "shasum": "" }, "require": { - "php": "^5.5.9 || ^7.0", + "php": "^5.5.9 || ^7.0 || ^8.0", "psr/log": "^1.0.1" }, "require-dev": { "mockery/mockery": "^0.9 || ^1.0", - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0", + "phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.8 || ^9.3.3", "symfony/var-dumper": "^2.6 || ^3.0 || ^4.0 || ^5.0" }, "suggest": { @@ -1998,7 +1936,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.6-dev" + "dev-master": "2.7-dev" } }, "autoload": { @@ -2027,7 +1965,7 @@ "throwable", "whoops" ], - "time": "2020-06-14 09:00:00" + "time": "2020-11-01 12:00:00" }, { "name": "kint-php/kint", @@ -2190,20 +2128,20 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.18.1", + "version": "v1.20.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "a6977d63bf9a0ad4c65cd352709e230876f9904a" + "reference": "39d483bdf39be819deabf04ec872eb0b2410b531" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/a6977d63bf9a0ad4c65cd352709e230876f9904a", - "reference": "a6977d63bf9a0ad4c65cd352709e230876f9904a", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/39d483bdf39be819deabf04ec872eb0b2410b531", + "reference": "39d483bdf39be819deabf04ec872eb0b2410b531", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1" }, "suggest": { "ext-mbstring": "For best performance" @@ -2211,7 +2149,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.18-dev" + "dev-main": "1.20-dev" }, "thanks": { "name": "symfony/polyfill", @@ -2249,29 +2187,29 @@ "portable", "shim" ], - "time": "2020-07-14 12:35:20" + "time": "2020-10-23 14:02:19" }, { "name": "symfony/polyfill-php80", - "version": "v1.18.1", + "version": "v1.20.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "d87d5766cbf48d72388a9f6b85f280c8ad51f981" + "reference": "e70aa8b064c5b72d3df2abd5ab1e90464ad009de" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/d87d5766cbf48d72388a9f6b85f280c8ad51f981", - "reference": "d87d5766cbf48d72388a9f6b85f280c8ad51f981", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/e70aa8b064c5b72d3df2abd5ab1e90464ad009de", + "reference": "e70aa8b064c5b72d3df2abd5ab1e90464ad009de", "shasum": "" }, "require": { - "php": ">=7.0.8" + "php": ">=7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.18-dev" + "dev-main": "1.20-dev" }, "thanks": { "name": "symfony/polyfill", @@ -2315,20 +2253,20 @@ "portable", "shim" ], - "time": "2020-07-14 12:35:20" + "time": "2020-10-23 14:02:19" }, { "name": "symfony/var-dumper", - "version": "v4.4.13", + "version": "v4.4.16", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "1bef32329f3166486ab7cb88599cae4875632b99" + "reference": "3718e18b68d955348ad860e505991802c09f5f73" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/1bef32329f3166486ab7cb88599cae4875632b99", - "reference": "1bef32329f3166486ab7cb88599cae4875632b99", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/3718e18b68d955348ad860e505991802c09f5f73", + "reference": "3718e18b68d955348ad860e505991802c09f5f73", "shasum": "" }, "require": { @@ -2356,11 +2294,6 @@ "Resources/bin/var-dump-server" ], "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.4-dev" - } - }, "autoload": { "files": [ "Resources/functions/dump.php" @@ -2392,7 +2325,7 @@ "debug", "dump" ], - "time": "2020-08-17 07:31:35" + "time": "2020-10-26 20:47:51" } ], "aliases": [], diff --git a/frontend/payments/api_test.php b/frontend/payments/api_test.php index 09edc41d0..2b2f1f349 100644 --- a/frontend/payments/api_test.php +++ b/frontend/payments/api_test.php @@ -15,6 +15,8 @@ $private_key = 'NLFYb67/[pUE%W-s'; // Nastavimo parametre $action = 'create_narocilo'; +$action = 'stripe_checkout_success'; +$action = 'check_ddv'; //$action = 'get_predracun'; //$action = 'placaj_narocilo'; //$action = 'get_paketi'; @@ -89,11 +91,11 @@ function executePOST(){ $params = 'action='.$action; // Funkcija, ki jo želimo izvesti // POST data - $post_data = array( + /*$post_data = array( "email" => 'peter.hrvatin@gmail.com', "status" => '0', "package_id" => '3', - "payment_method" => '1', + "payment_method" => '3', //"discount" => '5.90', "trajanje" => '12', "lang" => 'sl', @@ -104,12 +106,15 @@ function executePOST(){ "podjetje_postna" => '1000', "podjetje_posta" => 'Ljubljanačšžćčxxx', "podjetje_davcna" => '11122233', - - "stripe_id" => 'tok_1H4KLxJ2wzLbozFIyzmcM2kC' - ); - /*$post_data = array( - "narocilo_id" => '1' );*/ + /*$post_data = array( + "narocilo_id" => '33' + );*/ + $post_data = array( + "podjetje_drzava" => 'Germany', + "podjetje_davcna" => '115235681', + "cena" => '24.28' + ); /*$post_data = array( "ime" => 'Peter Hrvatin', "organizacija" => 'Ikea d.o.o.', diff --git a/main/survey/skins/1045_1kaBlue.css b/main/survey/skins/1045_1kaBlue.css deleted file mode 100644 index c144e30ef..000000000 --- a/main/survey/skins/1045_1kaBlue.css +++ /dev/null @@ -1,529 +0,0 @@ -/* - Default tema ankete - 1ka - Modra barva -*/ -/* Barve */ -/* Import osnovne postavitve */ -/* - Osnovna tema ankete - 1ka - brez definiranih barv -*/ -/* Fonti */ -body { - margin: 0; - padding: 0; - color: #505050; - font-size: 100%; - font-family: Montserrat, Arial, Sans-Serif !important; - background: #ffffff; -} - -body.preview, body.testdata { - margin-top: 26px; -} - -#outercontainer { - width: 100%; - margin: 0 auto; -} -#outercontainer .outercontainer_header { - position: absolute; - width: 100%; - height: 80px; - border-bottom: 6px #1e88e5 solid; -} -#outercontainer #container { - position: relative; - width: 100%; - max-width: 1200px; - margin: 0px auto 10px; -} - -/* Warning bar (preview, cookie) */ -#cookie_alert, -#test_alert { - height: 26px; - font-size: 15px; - line-height: 25px; - color: #ffffff; - background-color: #ffa608; - border-bottom: 1px solid #ffa608; -} -#cookie_alert a, -#test_alert a { - text-decoration: none; - font-weight: bold; - color: #ffffff; -} -#cookie_alert a:hover, -#test_alert a:hover { - text-decoration: underline; -} -#cookie_alert span, -#test_alert span { - color: #ffffff; -} -#cookie_alert span a, -#test_alert span a { - color: #ffffff; - font-weight: normal; -} - -/* Header - logo, naslov, progressbar */ -h1 { - margin: 0px auto 30px; - padding: 120px 0 50px 0; - font-size: 28px; - color: #1e88e5; - text-align: center; - border-bottom: 1px solid #ddeffd; -} - -h1.evalvacija { - margin-bottom: 0; -} - -#logo { - right: auto; - left: 25px; - top: 13px; - max-height: 56px !important; - background: url("../../../public/img/logo/1ka_slo.svg"); - background-repeat: no-repeat !important; - background-size: auto 100% !important; -} -#logo a { - width: 250px; - height: 56px; -} - -#logo.english { - background: url("../../../public/img/logo/1ka_eng.svg"); -} - -.header_settings_holder { - top: 0px; - right: 20px; - left: auto; -} -.header_settings_holder .progress_bar span { - float: left !important; - /* ie6,7 doesnt support inline-block */ - display: block; - width: 20px; - font-size: 11px; - color: #6D87AF; -} -.header_settings_holder .progress_bar div { - height: 10px; - width: 130px; - padding: 2px; - margin: 0 5px; - border: 1px #cccccc solid; - background-color: #ffffff; -} -.header_settings_holder .progress_bar div span { - height: 10px; - background-color: #1e88e5; -} -.header_settings_holder .progress_bar p a { - color: #1e88e5; - text-decoration: none; -} -.header_settings_holder .progress_bar p a:hover { - color: #ffa608; -} -.header_settings_holder .continue_later_setting a { - color: #1e88e5; -} -.header_settings_holder .continue_later_setting a:hover { - color: #ffa608; -} -.header_settings_holder .tawk_chat a { - color: #1e88e5; -} -.header_settings_holder .tawk_chat a:hover { - color: #ffa608; -} - -/* Spremenljivke */ -.spremenljivka { - margin: 20px 10px 20px 10px; - padding: 20px 2px 50px 12px !important; - border-bottom: 1px #ddeffd solid; -} -.spremenljivka .naslov { - padding: 5px 0 15px 5px; - font-size: 18px; - font-weight: 600; -} -.spremenljivka .naslov .spremenljivka_info { - font-size: 14px; - font-weight: 400; - padding-top: 7px; -} -.spremenljivka .sequence_number { - background-color: #ddeffd; - color: #42A5F5; -} -.spremenljivka .sequence_number:hover { - background-color: #add8fb; -} -.spremenljivka .sequence_number.active { - background-color: #42A5F5; - color: #ffffff; -} -.spremenljivka .counter { - font-size: 18px; -} -.spremenljivka #dynamic_count { - color: #1e88e5; -} -.spremenljivka .arrow { - color: #1e88e5; -} -.spremenljivka .arrow:hover { - color: #ffa608; -} - -.spremenljivka.limited { - outline: 1px #F15A24 solid; -} - -.required, .required_require, .required_limit { - outline: 1px #F15A24 solid; -} - -div.variabla, -td.variabla, -td.question, -td.differential, -.variabla_sum label { - font-size: 14px; -} - -div.variable_holder { - padding: 10px 0 0 0; -} -div.variable_holder thead, -div.variable_holder tr.table-header { - font-weight: normal; - font-size: 14px; -} -div.variable_holder thead td, -div.variable_holder tr.table-header td { - padding: 10px 5px; -} - -table.grid_table thead tr td { - border-bottom: 2px #42A5F5 solid; -} -table.grid_table thead tr.middle_row td { - border-top: 2px #42A5F5 solid; -} -table.grid_table tbody tr.table-header td { - border-bottom: 2px #42A5F5 solid; - border-top: 2px #42A5F5 solid; - background-color: #ffffff; -} -table.grid_table tbody tr:nth-child(2n+1) { - background-color: #ffffff; -} -table.grid_table tbody tr:nth-child(2n) { - background-color: #ddeffd; -} -table.grid_table td { - padding: 10px 10px; -} - -span.reminder { - left: 3px; -} - -/* Textboxi, textarea, select */ -input, textarea, select { - font-family: Montserrat, Arial, Sans-Serif !important; -} - -input[type=text], textarea, select { - padding: 10px 15px; - border-radius: 3px; - border: 1px solid #d1d1d1; - border-radius: 3px; - background-color: #fff; -} - -/* ranking */ -.dropzone { - border-top: 1px #ddeffd solid; - margin-top: 12px; - padding-top: 17px; -} - -table.ranking_table ul { - margin-top: 19px; -} - -.ranking, -.ranking_long, -.handle, -.handle_long, -.ime, -.izbran, -.frame_ranking, -.frame_ranking_hover, -.frame_dropping, -.frame_dropping_hover, -.frame_moving { - font-size: 13px; - padding: 7px 10px 9px; - border: 2px solid #1e88e5; - background-color: #ffffff; -} - -.ranking:hover { - background-color: #f5fafe; -} - -div.variable_holder .frame_ranking_hover { - border: 2px #1e88e5 solid; - background-color: #ddeffd; -} - -div.variable_holder .frame_ranking, -div.variable_holder .frame_moving, -div.variable_holder .frame_dropping, -div.variable_holder .frame_dropping_hover { - text-indent: -35px; - border: 2px #42A5F5 solid; - background-color: #ddeffd; -} - -table.ranking_table b { - font-size: 13px; - font-weight: 600; -} - -/* Photo upload button */ -button.record_foto { - border: 2px solid #1e88e5; -} -button.record_foto::before { - color: #1e88e5; -} -button.record_foto:hover, button.record_foto:focus { - border-color: #ffa608; -} -button.record_foto:hover::before, button.record_foto:focus::before { - color: #ffa608; -} - -/* Koledar */ -.ui-datepicker { - font-size: 14px; -} - -button.ui-datepicker-trigger { - color: #1e88e5; -} -button.ui-datepicker-trigger:hover, button.ui-datepicker-trigger:focus { - color: #ffa608; -} - -/* Slider */ -.grupa .spremenljivka .ui-slider-pips .ui-slider-pip { - color: #505050; -} -.grupa .spremenljivka .slider.ui-widget-content { - /*background-color: $color_light !important;*/ - background-image: none !important; - border: 0; -} -.grupa .spremenljivka .ui-slider-horizontal { - height: 8px; -} -.grupa .spremenljivka .ui-slider-handle { - cursor: pointer; - height: 10px !important; - width: 18px !important; - margin-top: 1px; - border: 0; - border-radius: 15px 15px !important; - background-color: #1e88e5 !important; - background-image: none !important; -} -.grupa .spremenljivka .ui-slider-handle:active { - background-color: #1e88e5 !important; -} -.grupa .spremenljivka .sliderText { - padding-top: 2px; - color: #505050; - background-color: #42A5F5; - border: 0; -} -.grupa .spremenljivka .sliderText::after { - border-color: #42A5F5 transparent; -} - -/* Warning levo od vprasanja */ -.validation_alert { - position: absolute; - z-index: 51; - top: 20px; - left: -150px; - width: 130px; - min-height: 29px; - margin: 0; - text-align: center; - font-size: 11px; - line-height: 14px; - background-color: #ddeffd; - border: 2px solid red; - padding: 4px 7px; - border-radius: 4px; - box-shadow: none; -} - -/* Gumbi na dnu */ -div.buttons { - padding: 20px 20px 35px; - margin: 0 10px; -} -div.buttons input { - cursor: pointer; - margin: 8px 10px; - /*padding: 7px 11px;*/ - padding: 10px 20px; - text-align: center; - font-size: 12px; - letter-spacing: 1px; - font-weight: 600; - color: #FFFFFF; - border-radius: 20px; - border: 0; -} -div.buttons input.next { - background-color: #1e88e5; - border: 1px solid #1e88e5; -} -div.buttons input.next:hover, div.buttons input.next:focus { - background-color: #ffa608; - border: 1px solid #ffa608; -} -div.buttons input.prev { - color: #1e88e5; - background-color: #fff; - border: 1px solid #1e88e5; -} -div.buttons input.prev:hover, div.buttons input.prev:focus { - color: #fff; - background-color: #1e88e5; -} - -/* Footer */ -#footer_survey { - padding: 40px; - background-color: #ffffff; - border-top: 1px #ddeffd solid; -} -#footer_survey p, #footer_survey a, #footer_survey a:visited { - color: #505050; - font-size: 14px; - line-height: 25px; - font-weight: 400; - text-decoration: none; -} -#footer_survey a:hover, #footer_survey a:active { - text-decoration: none; -} - -/* awesome radio in checkboxi */ -input[type=checkbox] + span.enka-checkbox-radio, -input[type=radio] + span.enka-checkbox-radio, -.custom_radio_picture.obarvan > label > span.enka-custom-radio:before, -.visual-radio-scale.checked .enka-vizualna-skala { - color: #42A5F5; - font-size: 20px; - vertical-align: -1px; -} - -input[type=checkbox]:focus + span.enka-checkbox-radio:before, -input[type=radio]:focus + span.enka-checkbox-radio:before, -input[type=radio]:focus + span.enka-custom-radio:before, -input[type=radio]:focus + span.enka-vizualna-skala::before { - color: #0965ae; -} - -input[type=text]:focus, -input[type=number]:focus, -input[type=email]:focus, -input[type=password]:focus, -textarea:focus { - border-color: #42A5F5; -} - -/* Ranking drag drop */ -.drag_and_drop { - top: -9px; - left: -12px; -} - -.drag_and_drop_right { - top: -9px !important; - left: -12px !important; -} - -.frame_dropping_titles { - width: 240px; - padding: 5px; - margin: 0px auto 0px auto; - height: 15px; - text-align: center; - background-color: #FFFFFF; - border-top: 2px solid #b9c5d9; - border-left: 2px solid #b9c5d9; - border-right: 2px solid #b9c5d9; - font-size: 13px; -} - -.drag_and_drop_box { - top: -9px; - left: -12px; -} -.drag_and_drop_box img { - display: block; - margin-left: auto; - margin-right: auto; -} - -.drag_and_drop_box_right { - top: 19px !important; - left: -12px !important; -} - -.drag_and_drop_box_right_after_refresh { - /*top: 44px!important;*/ - left: -12px !important; -} - -.drag_and_drop_box_right_over { - left: -12px !important; -} - -.frame_dropping_titles_box { - width: 240px; - padding: 5px; - margin: 0px auto 0px auto; - height: 15px; - text-align: center; - background-color: #FFFFFF; - font-size: 13px; -} - -.frame_dropping { - padding: 7px 10px 9px; -} - -.frame_dropping_box { - padding: 7px 10px 9px; -} - -/*# sourceMappingURL=1kaBlue.css.map */ From 6345317e54695df4b75229afa595b2e58a63147c Mon Sep 17 00:00:00 2001 From: pero1203 Date: Thu, 19 Nov 2020 11:15:32 +0100 Subject: [PATCH 34/77] Vabila - popravek dodajanja emailov preko datoteke --- .../classes/class.SurveyInvitationsNew.php | 30 ++-- admin/survey/script/invitations.js | 150 +++++++----------- 2 files changed, 66 insertions(+), 114 deletions(-) diff --git a/admin/survey/classes/class.SurveyInvitationsNew.php b/admin/survey/classes/class.SurveyInvitationsNew.php index 72e4273cd..4ae70995c 100644 --- a/admin/survey/classes/class.SurveyInvitationsNew.php +++ b/admin/survey/classes/class.SurveyInvitationsNew.php @@ -533,12 +533,6 @@ class SurveyInvitationsNew { $default_fields['inv_field_relation'] = 0; } - // pri personaliziranih aporočilih je e-mail obvezno polje - //if (!in_array('inv_field_email',$fields)) { - // array_push($fields, 'inv_field_email'); - //} - - # skreiramo nov vrstni red polj if (count($fields) > 0) { foreach ($fields as $key=>$field) { @@ -558,10 +552,9 @@ class SurveyInvitationsNew { $import_type = isset($_POST['import_type']) ? (int)$_POST['import_type'] : 2; session_start(); $checked = (isset($_SESSION['inv_rec_only_this_survey']) && (int)$_SESSION['inv_rec_only_this_survey'] == 1) ? '1' : '0'; - # profili respondentov - #echo '
    '; + + # profili respondentov echo '
    '; - # echo '
    '; echo '
    '; echo '
    '; @@ -578,18 +571,20 @@ class SurveyInvitationsNew { list($sysUserToAdd) = mysqli_fetch_row($sysUserToAddQuery); } - # echo ''; echo ''; echo ''; echo ''; - echo Help::display('inv_recipiens_from_system'); + + echo Help::display('inv_recipiens_from_system'); + + echo '
    '; echo '
    '; - echo '
    '; - if ($import_type == 3) { - #$this->displayFromSystemVariables(); + + if ($import_type == 3) { $this->createSystemVariablesMapping(); - } else { + } + else { # sporočilo za personalizirana e-vabila in respondente iz baze @@ -8858,10 +8853,7 @@ class SurveyInvitationsNew { } # pri personaliziranih aporočilih je e-mail obvezno polje - //if (!in_array('inv_field_email',$fields)) { - array_push($fields, 'inv_field_email'); - #} - + array_push($fields, 'inv_field_email'); # skreiramo nov vrstni red polj if (count($fields) > 0) { diff --git a/admin/survey/script/invitations.js b/admin/survey/script/invitations.js index 863c0059a..e84fccc69 100644 --- a/admin/survey/script/invitations.js +++ b/admin/survey/script/invitations.js @@ -3,8 +3,6 @@ function deleteRecipient_confirm(inv_rid) { $('#fade').fadeTo('slow', 1); $('#fullscreen').html('').fadeIn('slow'); $("#fullscreen").load('ajax.php?t=invitations&a=delete_recipient_confirm', {anketa:srv_meta_anketa_id, inv_rid:inv_rid,noNavi:'true'}); - - //#$(".anketa_edit_main").load('ajax.php?t=invitations&a=delete_recipient', {anketa:srv_meta_anketa_id, inv_rid:inv_rid}); } function inv_delete_recipient() { var inv_rid = $("#inv_delete_rec_confirm input#inv_rid").val(); @@ -32,7 +30,8 @@ function inv_arch_recipients_close() { function inv_arch_save_comment() { var aid = $("#inv_arch_id").val(); var comment = $("#inv_arch_comment").val(); - $.post('ajax.php?t=invitations&a=arch_save_comment', {anketa:srv_meta_anketa_id, aid:aid, comment:comment, noNavi:'true'}, function(data) { + + $.post('ajax.php?t=invitations&a=arch_save_comment', {anketa:srv_meta_anketa_id, aid:aid, comment:comment, noNavi:'true'}, function(data) { // to ni vredu.window.location.reload(); $('#fade').fadeOut('slow'); $('#fullscreen').fadeOut('slow').html(''); @@ -48,7 +47,7 @@ function inv_arch_recipients_send() { checkboxes = checkboxes+prefix+$(this).val(); prefix = ","; }); - //$("#inv_send_mail_finish").html('Pošiljam...'); + $('#fullscreen').load('ajax.php?t=invitations&a=send_mail', {anketa:srv_meta_anketa_id, noNavi:'true',send_type:send_type, checkboxes:checkboxes} ); @@ -56,15 +55,18 @@ function inv_arch_recipients_send() { function inv_change_import_type() { var import_type = $('input[name=inv_import_type]:checked').val(); - $("#inv_import").load('ajax.php?t=invitations&a=change_import_type', {anketa:srv_meta_anketa_id, import_type:import_type,noNavi:'true'}); + $("#inv_import").load('ajax.php?t=invitations&a=change_import_type', {anketa:srv_meta_anketa_id, import_type:import_type,noNavi:'true'}, function(){ + refreshFieldsList(); + }); } function toggleInvCheckbox(what) { var id = $(what).attr("id"); if ( $(what).is(":checked") ) { - $(what).parent().addClass('inv_field_enabled'); - } else { - $(what).parent().removeClass('inv_field_enabled'); + $(what).parent().addClass('inv_field_enabled'); + } + else { + $(what).parent().removeClass('inv_field_enabled'); } refreshFieldsList(); @@ -193,47 +195,18 @@ function inv_save_recipient() { $.post('ajax.php?t=invitations&a=save_recipient', {anketa:srv_meta_anketa_id, inv_rid:inv_rid, rec_email:rec_email, rec_password:rec_password, rec_firstname:rec_firstname, rec_lastname:rec_lastname, rec_salutation:rec_salutation, rec_phone:rec_phone, rec_custom:rec_custom, rec_relation:rec_relation, noNavi:'true'}, function(data) { - data = jQuery.parseJSON(data); - if (data.error == "0") { + + data = jQuery.parseJSON(data); + + if (data.error == "0") { // smo shranli lahko zapremo okno in refrešamo podatke $('#fade').fadeOut('slow'); $('#fullscreen').fadeOut('slow').html(''); // Refreshamo celotno stran - location.reload(); - - // zamenjamo samo podatke v izbrani vrstici - TO NE DELA - //$(".anketa_edit_main").load('ajax.php?t=invitations&a=view_recipients', {anketa:srv_meta_anketa_id}); - /*var tr = $('#tbl_recipients_list tr td input[value="'+data.rid+'"]').closest('tr'); - - emailHtml= ''+data.rec.email+''; - // email = 7 - if ($('#tbl_recipients_list tr th:nth-child(5)').html()==('EMAIL')) { - $(tr).find(':nth-child(7)').html(emailHtml); - } - // geslo = 8 - if ($('#tbl_recipients_list tr th:nth-child(6)').html()==('PASSWORD')) - $(tr).find(':nth-child(8)').html(data.rec.password); - // email = 9 - if ($('#tbl_recipients_list tr th:nth-child(7)').html()==('FIRSTNAME')) - $(tr).find(':nth-child(9)').html(data.rec.firstname); - // geslo = 10 - if ($('#tbl_recipients_list tr th:nth-child(8)').html()==('LASTNAME')) - $(tr).find(':nth-child(10)').html(data.rec.lastname); - // email = 11 - if ($('#tbl_recipients_list tr th:nth-child(9)').html()==('SALUTATION')) - $(tr).find(':nth-child(11)').html(data.rec.salutation); - // geslo = 12 - if ($('#tbl_recipients_list tr th:nth-child(10)').html()==('PHONE')) - $(tr).find(':nth-child(12)').html(data.rec.phone); - // geslo = 13 - if ($('#tbl_recipients_list tr th:nth-child(11)').html()==('CUSTOM')) - $(tr).find(':nth-child(13)').html(data.rec.custom); - // odnos - if ($('#tbl_recipients_list tr th:nth-child(12)').html()==('RELATION')) - $(tr).find(':nth-child(14)').html(data.rec.relation); */ - - } else { + location.reload(); + } + else { // prikažemo obvestilo o napaki $("#inv_error_note").html(data.msg); $("#inv_error_note").show(); @@ -377,16 +350,20 @@ function mailToSourceChange() { } function mailToSourceCheckboxChange() { + var send_type = $('input[name=mailto]:checked').val(); var prefix = ""; - var checkboxes = ""; + var checkboxes = ""; + $('input[name="mailto_status[]"]:checked').each(function(el) { checkboxes = checkboxes+prefix+$(this).val(); prefix = ","; - }); + }); + var source_type = $('input[name=mailsource]:checked').val(); var source_lists = ""; - var prefix = ""; + var prefix = ""; + $('input[name="mailsource_lists[]"]:checked').each(function(el) { source_lists = source_lists+prefix+$(this).val(); prefix = ","; @@ -394,36 +371,43 @@ function mailToSourceCheckboxChange() { $("#inv_select_mail_to_respondents").load('ajax.php?t=invitations&a=view_send_recipients', {anketa:srv_meta_anketa_id, noNavi:'true',send_type:send_type, checkboxes:checkboxes, source_type:source_type, source_lists:source_lists}, function(){ var cb = $('#tbl_recipients_send_list tr td').length; - if (cb > 0 ) { + + if (cb > 0 ) { $("#inv_send_mail_btn").show(); - } else { + } + else { $("#inv_send_mail_btn").hide(); } - if (cb > 4999 ) { + + if (cb > 4999 ) { $("#inv_send_mail_limit").show(); - } else { + } + else { $("#inv_send_mail_limit").hide(); } - }); - } function mailTocheCheckboxChange() { + // izberemo rado za status $('#mailto4').attr('checked', true); - var send_type = $('input[name=mailto]:checked').val(); + + var send_type = $('input[name=mailto]:checked').val(); var prefix = ""; var checkboxes = ""; - $('input[name="mailto_status[]"]:checked').each(function(el) { + + $('input[name="mailto_status[]"]:checked').each(function(el) { checkboxes = checkboxes+prefix+$(this).val(); prefix = ","; }); - var source_type = $('input[name=mailsource]:checked').val(); + + var source_type = $('input[name=mailsource]:checked').val(); var source_lists = ""; var prefix = ""; - $('input[name="mailsource_lists[]"]:checked').each(function(el) { + + $('input[name="mailsource_lists[]"]:checked').each(function(el) { source_lists = source_lists+prefix+$(this).val(); prefix = ","; }); @@ -440,13 +424,14 @@ function mailTocheCheckboxChange() { } else { $("#inv_send_mail_limit").hide(); } - }); }; function invitations_init() { + $(".inv_checkbox").live('change', function(event) { toggleInvCheckbox(this); - }); + }); + $("#inv_upload_recipients").live('click', function(event) { var inv_iid = $("#inv_iid").val(); $("#inv_recipients_upload_form").submit(); @@ -970,19 +955,23 @@ function invSendMail() { }; */ function inv_del_rec_profile() { - var pid = $("#inv_import_list_profiles ol li.active").attr("pid"); + + var pid = $("#inv_import_list_profiles ol li.active").attr("pid"); + if (confirm(lang['srv_inv_recipients_delete_profile_confirm'])) { + $.post('ajax.php?t=invitations&a=delete_rec_profile', {anketa:srv_meta_anketa_id, pid:pid, noNavi:'true'}, function(data) { - // osvežimo polja - //inv_change_import_type(); - var new_pid = $("#inv_import_list_profiles ol li").first().attr('pid'); - // če je slučajno isti kot smo ga zbrisli izberemo nasledenjega + + // osvežimo polja + var new_pid = $("#inv_import_list_profiles ol li").first().attr('pid'); + + // če je slučajno isti kot smo ga zbrisli izberemo nasledenjega if (new_pid == pid) { var new_pid = $("#inv_import_list_profiles ol li").first().next().attr('pid'); - } + } + $(".anketa_edit_main").load('ajax.php?t=invitations&a=use_recipients_list', {anketa:srv_meta_anketa_id, pid:new_pid }); }); - } } @@ -1554,36 +1543,7 @@ function mailSourceMesageChange(what) { $("#inv_select_mail_preview").load('ajax.php?t=invitations&a=make_default_from_preview', {anketa:srv_meta_anketa_id, mid:mid,noNavi:'true'}); } } -/* -function inv_add_sysusers() { - // polovimo izbrane sistemske variable in prikazemo podatke - var sysVariables = $("#inv_sys_container ul.connectedSortable").sortable('toArray'); - $(".anketa_edit_main").load('ajax.php?t=invitations&a=addSysusers', {anketa:srv_meta_anketa_id, sysVariables:sysVariables}); -} -function inv_sysvar_change(what) { - var elChecked = $(what).is(':checked'); - var elSprId = $(what).attr('spr_id'); - var elId = $(what).attr('id'); - var elNaslov = $(what).attr('naslov'); - //odvisno ali checkbox obkljukamo ali odstranimo, osvežimo izbor polij - if (elChecked) { - // element dodamo na konec - $("#inv_sys_container ul.connectedSortable") - .append('
  • '+elNaslov+'
  • '); - } else { - $('#invSysVarLi_'+elSprId).remove(); - } - inv_sysvar_refresh_data(); -} - -function inv_sysvar_refresh_data() { - // polovimo izbrane sistemske variable in prikazemo podatke - var sysVariables = $("#inv_sys_container ul.connectedSortable").sortable('toArray'); - //alert(sysVariables); - $("#inv_sys_user_list").load('ajax.php?t=invitations&a=showSysUsers', {anketa:srv_meta_anketa_id,noNavi:'true', sysVariables:sysVariables}); -} -*/ function inv_set_sort_field(field,type) { $.post('ajax.php?t=invitations&a=setSortField', {anketa:srv_meta_anketa_id,noNavi:'true', field:field,type:type}, function() { $(".anketa_edit_main").load('ajax.php?t=invitations&a=view_recipients', {anketa:srv_meta_anketa_id}); From b8a1b54ff9236305c393ee328181b72dd290a71a Mon Sep 17 00:00:00 2001 From: pero1203 Date: Thu, 19 Nov 2020 12:18:05 +0100 Subject: [PATCH 35/77] Vabila - popravek belezenja v arhiv, ce je v textu znak quote --- .../classes/class.SurveyInvitationsNew.php | 36 +++++++++---------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/admin/survey/classes/class.SurveyInvitationsNew.php b/admin/survey/classes/class.SurveyInvitationsNew.php index 4ae70995c..74ea91701 100644 --- a/admin/survey/classes/class.SurveyInvitationsNew.php +++ b/admin/survey/classes/class.SurveyInvitationsNew.php @@ -3781,9 +3781,9 @@ class SurveyInvitationsNew { $sql_query_all = sisplet_query($sql_string_all); list($count_all) = mysqli_fetch_row($sql_query_all); - $arvhive_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)" - ." VALUES (NULL , '$this->sid', '$date_sent', '$subject_text', '$body_text', '$global_user_id','$comment','$arvhive_naslov','$count_all')"; + $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)" + ." VALUES (NULL , '$this->sid', '$date_sent', '".addslashes($subject_text)."', '".addslashes($body_text)."', '$global_user_id','$comment','$archive_naslov','$count_all')"; $sqlQuery = sisplet_query($sqlString); $arch_id = mysqli_insert_id($GLOBALS['connect_db']); @@ -4146,7 +4146,7 @@ class SurveyInvitationsNew { list($count_all) = mysqli_fetch_row($sql_query_all); $date_sent = date ("Y-m-d H:i:s"); - $arvhive_naslov = 'mailing_'.date("d.m.Y").', '.date("H:i:s"); + $archive_naslov = 'mailing_'.date("d.m.Y").', '.date("H:i:s"); // Naslov in body //$subject_text = $lang['srv_inv_message_noemailing_subject']; @@ -4167,7 +4167,7 @@ class SurveyInvitationsNew { // 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)" - ." VALUES (NULL , '$this->sid', '$date_sent', '$subject_text', '$body_text', '$noMail_type', '$global_user_id', '$comment', '$arvhive_naslov', '$count_all')"; + ." VALUES (NULL , '$this->sid', '$date_sent', '".addslashes($subject_text)."', '".addslashes($body_text)."', '$noMail_type', '$global_user_id', '$comment', '$archive_naslov', '$count_all')"; $sqlQuery = sisplet_query($sqlString); $arch_id = mysqli_insert_id($GLOBALS['connect_db']); @@ -5925,33 +5925,31 @@ class SurveyInvitationsNew { # 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).")"; + + $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) { + + if (!$sqlQuery) { $error = mysqli_error($GLOBALS['connect_db']); - } + } + $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) { + + if (!$sqlQuery) { $error = mysqli_error($GLOBALS['connect_db']); } - } - # updejtamo še tabelo arhivov - #$sqlString = "INSERT INTO srv_invitations_archive (id, ank_id, date_send, subject_text,body_text,cnt_succsess,cnt_error)" - #." VALUES (NULL , '$this->sid', '$date_sent', '$subject_text', '$body_text','".count($send_ok_ids)."','".count($send_error_ids)."')"; - #$sqlQuery = sisplet_query($sqlString); - - #$arch_id = mysqli_insert_id($GLOBALS['connect_db']); - $msg = array($lang['srv_inv_activate_respondents']. count($send_ok_ids)); - if (count($send_error_ids) > 0) { + + if (count($send_error_ids) > 0) { print_r("
    ");
     			print_r($lang['srv_inv_error0']);
     			print_r($send_error_ids);
     			print_r("
    "); - } + } + # popravimo timestamp za regeneracijo dashboarda Common::getInstance()->Init($anketa); Common::getInstance()->updateEditStamp(); From ad50ebbd9baaf82d17652f2e319d5d8e339905f1 Mon Sep 17 00:00:00 2001 From: Robert Date: Fri, 20 Nov 2020 13:59:13 +0100 Subject: [PATCH 36/77] Drupal: Stripe popravki. --- .../sites/all/themes/pro1ka/js/script.js | 11 +++++++++++ .../templates/nakupovanje-1ka-kosarica.tpl.php | 18 ++++++++++++++++-- .../nakupovanje-1ka-stripe-return.tpl.php | 5 +++-- 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/frontend/drupal/sites/all/themes/pro1ka/js/script.js b/frontend/drupal/sites/all/themes/pro1ka/js/script.js index ee3a9b2af..a6556952e 100755 --- a/frontend/drupal/sites/all/themes/pro1ka/js/script.js +++ b/frontend/drupal/sites/all/themes/pro1ka/js/script.js @@ -1218,7 +1218,18 @@ window.addEventListener('beforeinstallprompt', function (e) { function oddajNarociloNaStreznik() { jQuery('.pregled-narocila').hide(); + jQuery('.procesiram-posamezno-narocilo').hide(); + jQuery('.procesiram-narocilo').show(); + var nacinPlacila = jQuery('[name="payment_method"]:checked').val(); + jQuery('.procesiram-narocilo .procesiram-narocilo-'+nacinPlacila).show(); + if(nacinPlacila == 2){ + jQuery('.procesiram-narocilo .procesiram-narocilo-ime').text('PayPal'); + } else if (nacinPlacila == 3){ + jQuery('.procesiram-narocilo .procesiram-narocilo-ime').text('Stripe'); + } + + // V kolikor je omenjeno polje izpolnjeno potem gre za robota in preusmerimo na začetno stran if (jQuery('[name="narocilo-robotsko-narocilo"]').val().length > 0) { diff --git a/frontend/drupal/sites/all/themes/pro1ka/templates/nakupovanje-1ka-kosarica.tpl.php b/frontend/drupal/sites/all/themes/pro1ka/templates/nakupovanje-1ka-kosarica.tpl.php index 1c844dec6..292ab4b79 100644 --- a/frontend/drupal/sites/all/themes/pro1ka/templates/nakupovanje-1ka-kosarica.tpl.php +++ b/frontend/drupal/sites/all/themes/pro1ka/templates/nakupovanje-1ka-kosarica.tpl.php @@ -781,9 +781,23 @@
    language == 'sl'): ?> - Naročilo se obdeluje. Prosimo počakajte trenutek +
    + Naročilo se obdeluje. Prosimo počakajte trenutek +
    + +
    + Sedaj vas bomo preusmerili na platformo Stripe, kjer boste vnesli podatke za plačilo. + Po uspešnem plačilu vas bo preusmerilo nazaj na spletno mesto 1KA. Prosimo počakajte trenutek +
    - The order is being processed. Please wait a moment +
    + The order is being processed. Please wait a moment +
    + +
    + We will now redirect you to the Stripe platform, where you will enter your payment information. + After a successful payment, you will be redirected back to the 1KA website. Please, wait a moment +
diff --git a/frontend/drupal/sites/all/themes/pro1ka/templates/nakupovanje-1ka-stripe-return.tpl.php b/frontend/drupal/sites/all/themes/pro1ka/templates/nakupovanje-1ka-stripe-return.tpl.php index a803fe7f6..bcfcfd821 100644 --- a/frontend/drupal/sites/all/themes/pro1ka/templates/nakupovanje-1ka-stripe-return.tpl.php +++ b/frontend/drupal/sites/all/themes/pro1ka/templates/nakupovanje-1ka-stripe-return.tpl.php @@ -6,9 +6,10 @@

language == 'sl'): ?> - Zahvaljujemo se vam za vaš nakup preko Stripe plačilnea sistema. Vaš novi paket je aktiven in ga lahko pričnete uporabljati. + Zahvaljujemo se vam za vaš nakup. Plačilo preko Stripe plačilnega sistema je bilo uspešno izvedeno. + Vaš novi paket je aktiviran in ga lahko pričnete uporabljati. - Thank you for your purchase using Strpe! Your new package is now active and you can use it. + Thank you for your purchase. Payment using Stripe system was successful. Your new package is now activated and ready to use.

From e755d13e085949a158d2e2a7614cb1fb51535db2 Mon Sep 17 00:00:00 2001 From: pero1203 Date: Mon, 23 Nov 2020 10:54:27 +0100 Subject: [PATCH 37/77] Popravek posiljanja vabil - vsak respondent se aktivira posebej po vsakem posiljanju (in ne vec vsi naenkrat na koncu) --- .../classes/class.SurveyInvitationsNew.php | 452 +++++++++--------- 1 file changed, 238 insertions(+), 214 deletions(-) diff --git a/admin/survey/classes/class.SurveyInvitationsNew.php b/admin/survey/classes/class.SurveyInvitationsNew.php index 74ea91701..fc425a41e 100644 --- a/admin/survey/classes/class.SurveyInvitationsNew.php +++ b/admin/survey/classes/class.SurveyInvitationsNew.php @@ -3651,11 +3651,6 @@ class SurveyInvitationsNew { $dont_send_duplicated = true; } - #echo '
'; - - #$send_type = (int)$_POST['send_type']; - #$checkboxes = explode(',',$_POST['checkboxes']); - $rids = $_POST['rids']; $return = array(); @@ -3672,20 +3667,23 @@ class SurveyInvitationsNew { echo ''; echo $lang['srv_invitation_note6']; echo ''; - 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); - if (mysqli_num_rows($sql_query_m) > 0 ) { + + exit(); + } + 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); - } else { + } + else { #nimamo še vsebine sporočila skreiramo privzeto. echo ''; echo $lang['srv_invitation_note6']; echo ''; - exit(); + + exit(); } } @@ -3694,29 +3692,41 @@ class SurveyInvitationsNew { $body_text = $sql_row_m['body_text']; $msg_url = $sql_row_m['url']; - $message_naslov = $sql_row_m['naslov']; - # naslov za odgovor je avtor ankete + $message_naslov = $sql_row_m['naslov']; + + // naslov za odgovor je avtor ankete if ($this->validEmail($sql_row_m['reply_to'])) { $reply_to = $sql_row_m['reply_to']; - } else { + } + else { $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); + } + + // prejeminki besedila + $sql_query = sisplet_query("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 + "); - # 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($strSistemske); + // 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_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_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)) { - // Ce gre za odnos imamo radio + + // Ce gre za odnos imamo radio if($sys_vars[$row['spr_id']]['variable'] == 'odnos'){ if(!isset($sys_vars[$row['spr_id']]['vre_id'][$row['vrstni_red']])) $sys_vars[$row['spr_id']]['vre_id'][$row['variable']] = $row['vre_id']; @@ -3728,13 +3738,13 @@ class SurveyInvitationsNew { # zakeširamo user_id za datapiping $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($strDataPiping); + $qryDataPiping = sisplet_query("SELECT id,inv_res_id FROM srv_user WHERE ank_id='$this->sid' AND inv_res_id IS NOT NULL"); while (list($dpUid,$dpInvResId) = mysqli_fetch_row($qryDataPiping)) { if ((int)$dpInvResId > 0 && (int)$dpUid > 0) { $arryDataPiping[$dpInvResId] = (int)$dpUid; } - } + } + # array za rezultate $send_ok = array(); $send_ok_ids = array(); @@ -3756,62 +3766,64 @@ class SurveyInvitationsNew { if (!Common::checkModule('gorenje')){ global $site_url, $global_user_id; - $sqlinfo_string = "SELECT email, name, surname FROM users WHERE id = '".$global_user_id."'"; - $sqlinfo_query = sisplet_query($sqlinfo_string); + $sqlinfo_query = sisplet_query("SELECT email, name, surname FROM users WHERE id = '".$global_user_id."'"); list($infoEmail,$infoName,$infoSurname) = mysqli_fetch_row($sqlinfo_query); - $infourl = 'anketi'; + + $infourl = 'anketi'; $format = $lang['srv_inv_send_finish_note']; $info1ka_mass_email_note = sprintf($format, $infoName, $infoSurname, $infoEmail, $infourl, $numRows); - try - { + try{ $MA = new MailAdapter($this->sid, $type='admin'); $MA->addRecipients('info@1ka.si'); $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 - $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); + // Pripravimo arhiv pošiljanj, da dobimo arch_id + $sql_query_all = sisplet_query("SELECT count(*) FROM srv_invitations_recipients WHERE ank_id = '".$this->sid."' AND deleted = '0'"); list($count_all) = mysqli_fetch_row($sql_query_all); $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)" - ." VALUES (NULL , '$this->sid', '$date_sent', '".addslashes($subject_text)."', '".addslashes($body_text)."', '$global_user_id','$comment','$archive_naslov','$count_all')"; - $sqlQuery = sisplet_query($sqlString); + $sqlQuery = sisplet_query("INSERT INTO srv_invitations_archive + (id, ank_id, date_send, subject_text, body_text, uid, comment, naslov, rec_in_db) + 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']); $duplicated = array(); while ($sql_row = mysqli_fetch_assoc($sql_query)) { - #password == code + $password = $sql_row['password']; $email = $sql_row['email']; if ($dont_send_duplicated == true && isset($duplicated[$email])) { $duplicated[$email] ++; continue; - } + } + $duplicated[$email] = 1; - $individual = (int)$this->surveySettings['individual_invitation']; - if (($individual == 1 && trim($email) != '' && trim($password) != '') - || ($individual == 0 && trim($email) != '' )){ + $individual = (int)$this->surveySettings['individual_invitation']; + + if ( ($individual == 1 && trim($email) != '' && trim($password) != '') || ($individual == 0 && trim($email) != '') ){ - # odvisno ali imamo url za jezik. + // odvisno ali imamo url za jezik. if ($msg_url != null && trim($msg_url) != '' ) { $url = $msg_url . ($individual == 1 ? '?code='.$password : ''); - } else { + } + else { $url = $nice_url . ($individual == 1 ? '&code='.$password : ''); } $url .= '&ai='.(int)$arch_id; - #odjava + + // odjava $unsubscribe = $site_url . 'admin/survey/unsubscribe.php?anketa=' . $this->sid . '&code='.$password; $user_body_text = str_replace( @@ -3847,21 +3859,19 @@ class SurveyInvitationsNew { ); - # naredimo DataPiping; + // naredimo DataPiping; if (isset($arryDataPiping[$sql_row['id']])) { $user_body_text = Common::getInstance()->dataPiping($user_body_text, $arryDataPiping[$sql_row['id']], 0); } $resultX = null; - try - { + try{ $MA = new MailAdapter($this->sid, $type='invitation'); $MA->addRecipients($email); $resultX = $MA->sendMail($user_body_text, $subject_text); } - catch (Exception $e) - { + catch (Exception $e){ // todo fajn bi bilo zalogirat kaj se dogaja $__error = $e->getMessage(); $__errStack = $e->getTraceAsString(); @@ -3873,54 +3883,108 @@ class SurveyInvitationsNew { $send_ok_ids[] = $sql_row['id']; $_user_data['status'] = 1; # poslalo ok - } else { + } + else { // ni poslalo $send_error[] = $email; $send_error_ids[] = $sql_row['id']; $_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 - 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 + // dodajmo še userje v povezovalno tabelo (arhiv) 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'"; - $sqlQuery = sisplet_query($sqlString); + + // updejtamo še tabelo arhivov + $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) { $error = mysqli_error($GLOBALS['connect_db']); } - # za arhive + // za arhive $_archive_recipients = array(); - # za tracking + // za tracking $_tracking = array(); if (count($send_ok_ids) > 0) { @@ -3929,7 +3993,8 @@ class SurveyInvitationsNew { #status 1=pošta poslana $_tracking[] = "('$arch_id',NOW(),'$id','1')"; } - } + } + if (count($send_error_ids) > 0) { foreach ( $send_error_ids AS $id) { $_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 .= implode(', ', $_archive_recipients); $sqlQuery = sisplet_query($sqlString); - } + } + if (count($_tracking) > 0) { $sqlStrTracking = "INSERT INTO srv_invitations_tracking (inv_arch_id, time_insert, res_id, status) VALUES "; $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 ) { $return['error'] = '1'; $return['msg'] = '
'.$lang['srv_invitation_note7'].count($send_error).'
'; - } 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=''; - if (trim($name) != '') { + + if (trim($name) != '') { $who = $name; - } + } + if (trim($surname) != '') { if ($who != '') { $who .=' '; } $who .= $surname; - } + } + if ($email != '') { if ($who != '') { $who .=' ('.$email.')'; @@ -4069,10 +4076,12 @@ class SurveyInvitationsNew { // Seznam mailov na katere je bilo uspesno poslano if (count($send_ok) > 0) { - $return['msg'] .= '
'; + $return['msg'] .= '
'; + foreach ($send_ok AS $email) { $return['msg'] .= ' '.$email.'
'; - } + } + $return['msg'] .= '
'; } } @@ -4113,7 +4122,8 @@ class SurveyInvitationsNew { && isset($_POST['_token']) && $_SESSION['snd_inv_token'][$this->sid] != null && $_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]); session_commit(); @@ -4137,26 +4147,22 @@ class SurveyInvitationsNew { } // Preberemo tip posiljanja (navadna posta, sms...) - //$noMail_type = (isset($_POST['noMailType'])) ? $_POST['noMailType'] : '1'; $noMail_type = SurveySession::get('inv_noEmailing_type'); - #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($sql_string_all); + // Pripravimo arhiv pošiljanj, da dobimo arch_id + $sql_query_all = sisplet_query("SELECT count(*) FROM srv_invitations_recipients WHERE ank_id = '".$this->sid."' AND deleted = '0'"); list($count_all) = mysqli_fetch_row($sql_query_all); $date_sent = date ("Y-m-d H:i:s"); $archive_naslov = 'mailing_'.date("d.m.Y").', '.date("H:i:s"); // Naslov in body - //$subject_text = $lang['srv_inv_message_noemailing_subject']; - //$body_text = ''; - # 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); + // 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); - } else { + } + else { $subject_text = $lang['srv_inv_message_noemailing_subject']; $body_text = ''; } @@ -4166,26 +4172,33 @@ class SurveyInvitationsNew { $msg_url = $sql_row_m['url']; // 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)" - ." VALUES (NULL , '$this->sid', '$date_sent', '".addslashes($subject_text)."', '".addslashes($body_text)."', '$noMail_type', '$global_user_id', '$comment', '$archive_naslov', '$count_all')"; - $sqlQuery = sisplet_query($sqlString); + $sqlQuery = sisplet_query("INSERT INTO srv_invitations_archive + (id, ank_id, date_send, subject_text, body_text, tip, uid, comment, naslov, rec_in_db) + 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']); $duplicated = array(); - # 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($strSistemske); + // 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_ids = array(); while ($row = mysqli_fetch_assoc($qrySistemske)) { $sys_vars[$row['id']] = array('id'=>$row['id'], 'variable'=>$row['variable'],'naslov'=>$row['naslov']); $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 "); 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(!isset($sys_vars[$row['spr_id']]['vre_id'][$row['vrstni_red']])) $sys_vars[$row['spr_id']]['vre_id'][$row['variable']] = $row['vre_id']; @@ -4196,11 +4209,14 @@ class SurveyInvitationsNew { } - # 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($sql_string); + // prejeminki besedila + $sql_query = sisplet_query("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 + "); while ($sql_row = mysqli_fetch_assoc($sql_query)) { - #password == code + $password = $sql_row['password']; $email = $sql_row['email']; @@ -4221,16 +4237,16 @@ class SurveyInvitationsNew { $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) { - $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) { $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); + } + + // 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']); } @@ -4238,11 +4254,11 @@ class SurveyInvitationsNew { $comment = $_POST['comment']; - #dodajmo še userje v povezovalno tabelo + // dodajmo še userje v povezovalno tabelo if ($arch_id > 0) { - # updejtamo še tabelo arhivov - $sqlString = "UPDATE srv_invitations_archive SET cnt_succsess='".count($send_ok_ids)."' WHERE id ='$arch_id'"; - $sqlQuery = sisplet_query($sqlString); + + // updejtamo še tabelo arhivov + $sqlQuery = sisplet_query("UPDATE srv_invitations_archive SET cnt_succsess='".count($send_ok_ids)."' WHERE id ='$arch_id'"); if (!$sqlQuery) { $error = mysqli_error($GLOBALS['connect_db']); } @@ -4282,10 +4298,12 @@ class SurveyInvitationsNew { $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); + + $_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']); sisplet_query("COMMIT"); @@ -4301,24 +4319,25 @@ class SurveyInvitationsNew { $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 } } - # vstavimo v srv_userbase + // 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 + // 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 + // 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); @@ -4330,36 +4349,42 @@ class SurveyInvitationsNew { 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) != '') { $who = $name; - } + } + if (trim($surname) != '') { if ($who != '') { $who .=' '; } $who .= $surname; - } + } + if ($email != '') { if ($who != '') { $who .=' ('.$email.')'; } else { $who = $email; } - } + } + $return['error'] = '0'; } else { $return['error'] = '0'; $return['msg'] = '
'.''.$lang['srv_invitation_note9'].'

'; - } - - } else { + } + } + else { #old session token $return['msg'] = '
'.$lang['srv_invitation_note13'].''.'
'; } - } else { + } + else { #nimamo $rids $return['msg'] = '
'.$lang['srv_invitation_note14'].'
'; } @@ -4368,7 +4393,6 @@ class SurveyInvitationsNew { Common::getInstance()->Init($anketa); Common::getInstance()->updateEditStamp(); - #$this->viewAarchive($return['msg']); $this->viewSendMailFinish($return['msg']); } From 5831aad30d1d30f6f730a78652cf94b753cf4ee0 Mon Sep 17 00:00:00 2001 From: pero1203 Date: Mon, 23 Nov 2020 11:00:03 +0100 Subject: [PATCH 38/77] Popravek za mysql 8 - po novem je "system" rezervirana beseda --- admin/survey/classes/class.SurveyExportProfiles.php | 2 +- admin/survey/classes/class.SurveyMissingProfiles.php | 8 ++++---- admin/survey/classes/class.SurveyStatusCasi.php | 6 +++--- admin/survey/classes/class.SurveyStatusProfiles.php | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/admin/survey/classes/class.SurveyExportProfiles.php b/admin/survey/classes/class.SurveyExportProfiles.php index 5baf30cad..7b5cef81a 100644 --- a/admin/survey/classes/class.SurveyExportProfiles.php +++ b/admin/survey/classes/class.SurveyExportProfiles.php @@ -256,7 +256,7 @@ class SurveyExportProfiles if ($profileId == 0 ) { // seja - unset($_SESSION['variables_profile'][self::getSurveyId()]); } else { - $deleteString = "DELETE FROM srv_variable_profiles WHERE id = '" . $profileId . "' AND system != '1'"; + $deleteString = "DELETE FROM srv_variable_profiles WHERE id = '" . $profileId . "' AND `system` != '1'"; $sqlDelete = sisplet_query($deleteString); } diff --git a/admin/survey/classes/class.SurveyMissingProfiles.php b/admin/survey/classes/class.SurveyMissingProfiles.php index 2e2a81002..d8aa97840 100644 --- a/admin/survey/classes/class.SurveyMissingProfiles.php +++ b/admin/survey/classes/class.SurveyMissingProfiles.php @@ -52,7 +52,7 @@ class SurveyMissingProfiles self :: addSystemProfiles(); # preberemo podatke vseh porfilov ki so na voljo in jih dodamo v array - $stringSelect = "SELECT * FROM srv_missing_profiles WHERE uid = '".self::getGlobalUserId()."' OR (uid = '0' AND system = 1) ORDER BY id"; + $stringSelect = "SELECT * FROM srv_missing_profiles WHERE uid = '".self::getGlobalUserId()."' OR (uid = '0' AND `system` = 1) ORDER BY id"; $querySelect = sisplet_query($stringSelect); if (mysqli_num_rows($querySelect)) { @@ -392,7 +392,7 @@ class SurveyMissingProfiles if (isset($pid) && $pid != null) { # ce mamo sistemski profil ga ne shranjujemo - $checkSelect = "SELECT * as cnt FROM srv_missing_profiles WHERE id = '".$pid."' and system = 1"; + $checkSelect = "SELECT * as cnt FROM srv_missing_profiles WHERE id = '".$pid."' and `system` = 1"; $checkQry = sisplet_query($checkSelect); if (mysqli_num_rows($checkQry) > 0) { return $pid; @@ -419,7 +419,7 @@ class SurveyMissingProfiles # imamo podatke, updejtamo profil v bazi (profili z id 1,2,3 so sitemski) if ($pid > 3) { # shranimo morebitno spremembo nastavitve display_mv_type - $updateString = "UPDATE srv_missing_profiles SET display_mv_type='".$display_mv_type."', show_zerro='".$show_zerro."', merge_missing='".$merge_missing."' WHERE id='".$pid."' AND system = 0"; + $updateString = "UPDATE srv_missing_profiles SET display_mv_type='".$display_mv_type."', show_zerro='".$show_zerro."', merge_missing='".$merge_missing."' WHERE id='".$pid."' AND `system` = 0"; $updatequery = sisplet_query($updateString); # najprej pobrišemo stare podatke za ta profil @@ -526,7 +526,7 @@ class SurveyMissingProfiles # izbrišemo lahko samo nesistemske profile if (self::$profiles[$pid]['system'] != 1) { # zaradi ključev se avtomatsko pobriše tudi: srv_missing_profiles_values - $sqlDelete = sisplet_query("DELETE FROM srv_missing_profiles WHERE id = '$pid' AND system != '1'"); + $sqlDelete = sisplet_query("DELETE FROM srv_missing_profiles WHERE id = '$pid' AND `system` != '1'"); } } diff --git a/admin/survey/classes/class.SurveyStatusCasi.php b/admin/survey/classes/class.SurveyStatusCasi.php index 930b47fd6..9c44e0201 100644 --- a/admin/survey/classes/class.SurveyStatusCasi.php +++ b/admin/survey/classes/class.SurveyStatusCasi.php @@ -28,7 +28,7 @@ class SurveyStatusCasi static function RefreshData() { # preberemo podatke vseh porfilov ki so na voljo in jih dodamo v array - $stringSelect = "SELECT * FROM srv_status_casi WHERE uid = '".self::getGlobalUserId()."' OR (uid = '0' AND system =1) ORDER BY id"; + $stringSelect = "SELECT * FROM srv_status_casi WHERE uid = '".self::getGlobalUserId()."' OR (uid = '0' AND `system` =1) ORDER BY id"; $querySelect = sisplet_query($stringSelect); while ( $rowSelect = mysqli_fetch_assoc($querySelect) ) { @@ -330,8 +330,8 @@ class SurveyStatusCasi static function Delete($pid) { if ($pid != 1) { - $sqlDelete = sisplet_query("DELETE FROM srv_status_casi WHERE id = '$pid' AND system != '1'"); - print_r("DELETE FROM srv_status_casi WHERE id = '$pid' AND system != '1'"); + $sqlDelete = sisplet_query("DELETE FROM srv_status_casi WHERE id = '$pid' AND `system` != '1'"); + print_r("DELETE FROM srv_status_casi WHERE id = '$pid' AND `system` != '1'"); } } diff --git a/admin/survey/classes/class.SurveyStatusProfiles.php b/admin/survey/classes/class.SurveyStatusProfiles.php index 1af212941..383258571 100644 --- a/admin/survey/classes/class.SurveyStatusProfiles.php +++ b/admin/survey/classes/class.SurveyStatusProfiles.php @@ -79,7 +79,7 @@ class SurveyStatusProfiles self::$profiles[$_SESSION['statusProfile']['id']] = $_SESSION['statusProfile']; } # preberemo podatke vseh porfilov ki so na voljo in jih dodamo v array - $stringSelect = "SELECT * FROM srv_status_profile WHERE uid='".self::getGlobalUserId()."' OR ank_id = '".self::$sid."' OR (uid = '0' AND system =1) ORDER BY id"; + $stringSelect = "SELECT * FROM srv_status_profile WHERE uid='".self::getGlobalUserId()."' OR ank_id = '".self::$sid."' OR (uid = '0' AND `system`=1) ORDER BY id"; $querySelect = sisplet_query($stringSelect); while ( $rowSelect = mysqli_fetch_assoc($querySelect) ) { @@ -923,7 +923,7 @@ class SurveyStatusProfiles } # izbrišemo lahko samo nesistemske profile if (self::$profiles[$pid]['system'] != 1) { - $sqlDelete = sisplet_query("DELETE FROM srv_status_profile WHERE id = '$pid' AND system != '1'"); + $sqlDelete = sisplet_query("DELETE FROM srv_status_profile WHERE id = '$pid' AND `system` != '1'"); } self::setDefaultProfileId(); @@ -945,7 +945,7 @@ class SurveyStatusProfiles # preimenujemo lahko samo nesistemske profile if (self::$profiles[$pid]['system'] != 1) { - $sqlRename = sisplet_query("UPDATE srv_status_profile SET name='$name' WHERE id = '$pid' AND system != '1'"); + $sqlRename = sisplet_query("UPDATE srv_status_profile SET name='$name' WHERE id = '$pid' AND `system` != '1'"); } } } From b19a964651b1909e1f0f2b77a449f1c7e7a9db7e Mon Sep 17 00:00:00 2001 From: Peter Hrvatin Date: Wed, 25 Nov 2020 10:26:10 +0100 Subject: [PATCH 39/77] Dodano filtriranje narocil po statusu, popravek racunanja DDV (3. drzave ga nimajo), dodan clen za brez DDV na predracun in racun --- admin/survey/script/narocila.js | 15 ++++- .../cebelica/InvoiceFox/cebelcaApi.php | 19 +++++- .../payments/classes/class.UserNarocila.php | 64 +++++++++++++++++-- lang/1.php | 4 ++ lang/2.php | 4 ++ public/css/admin.css | 6 ++ resources/sass/admin/payments.scss | 8 +++ 7 files changed, 112 insertions(+), 8 deletions(-) diff --git a/admin/survey/script/narocila.js b/admin/survey/script/narocila.js index 7752e7288..64345a2d4 100644 --- a/admin/survey/script/narocila.js +++ b/admin/survey/script/narocila.js @@ -106,8 +106,8 @@ function prepareNarocilaTableAdmin(){ exportOptions: { columns: ':visible' } - }, - 'colvis' + }/*, + 'colvis'*/ ] }); } @@ -300,4 +300,15 @@ function stornirajPlacilo(placilo_id){ if(confirm('Ste prepričani?')){ $("#placila").load('ajax.php?t=userPlacila&a=stornirajPlacilo', {placilo_id: placilo_id}); } +} + +// Nastavi filtriranje po statusu +function filterNarocila(status, checked){ + + if(checked) + var value = 1; + else + var value = 0; + + $("#narocila").load('ajax.php?t=userNarocila&a=filterNarocila', {status: status, value: value}); } \ No newline at end of file diff --git a/frontend/payments/cebelica/InvoiceFox/cebelcaApi.php b/frontend/payments/cebelica/InvoiceFox/cebelcaApi.php index c8e4424c1..9c5a64699 100644 --- a/frontend/payments/cebelica/InvoiceFox/cebelcaApi.php +++ b/frontend/payments/cebelica/InvoiceFox/cebelcaApi.php @@ -135,13 +135,28 @@ function ustvariPredracun($api,$podatki,$lang='si') { $clientId=0; if(isset($clientIdA[0]['id'])) $clientId = $clientIdA[0]['id']; - + + + // Sklic na člen glede DDV + $pub_notes = ''; + + // Podjetje, ki nima ddv (EU zavezanec oz. katerakoli 3. drzava) + if($podatki['podjetjeime'] != "" && $podatki['ddv'] != 1) { + $pub_notes = 'V skladu s členom 25/1 ZDDV-1 ni obračunan DDV.'; + } + + // Fizicna oseba iz 3. drzave, ki nima ddv + if($podatki['podjetjeime'] == "" && $podatki['ddv'] != 1) { + $pub_notes = 'V skladu s členom 30.d/1 ZDDV-1 ni obračunan DDV.'; + } + + $glava = array ( 'title' => date("y")."-".$clientId, 'date_sent' => date("d.m.Y"), 'days_valid' => $podatki['veljavnost'], 'id_partner' => $clientId, - 'pub_notes' => '', + 'pub_notes' => $pub_notes, 'date_served' => date("d.m.Y"), 'date_to_pay' => date("d.m.Y"), 'date_payed' => date("d.m.Y"), diff --git a/frontend/payments/classes/class.UserNarocila.php b/frontend/payments/classes/class.UserNarocila.php index 570e69899..f9614378b 100644 --- a/frontend/payments/classes/class.UserNarocila.php +++ b/frontend/payments/classes/class.UserNarocila.php @@ -12,11 +12,23 @@ class UserNarocila{ // Array z vsemi paketi private $packages = array(); + // Filter narocil + private $narocila_filter = array('neplacana' => 1, 'pacana' => 0, 'stornirana' => 0); + function __construct(){ // Zakesiramo vse pakete $this->cachePackages(); + + if(isset($_SESSION['narocila_filter']['neplacana']) && $_SESSION['narocila_filter']['neplacana'] == '0') + $this->narocila_filter['neplacana'] = 0; + + if(isset($_SESSION['narocila_filter']['placana']) && $_SESSION['narocila_filter']['placana'] == '1') + $this->narocila_filter['placana'] = 1; + + if(isset($_SESSION['narocila_filter']['stornirana']) && $_SESSION['narocila_filter']['stornirana'] == '1') + $this->narocila_filter['stornirana'] = 1; } @@ -29,10 +41,18 @@ class UserNarocila{ // Vsa narocila lahko pregledujejo samo admini if($admin_type == 0 && $usr_id == 0){ - // Loop po vseh narocilih v sistemu + // Filter po statusu + $status = ' AND un.status IN ('; + $status .= ($this->narocila_filter['neplacana'] == 1) ? '0,' : ''; + $status .= ($this->narocila_filter['placana'] == 1) ? '1,' : ''; + $status .= ($this->narocila_filter['stornirana'] == 1) ? '2,' : ''; + $status = substr($status, 0, -1); + $status .= ') '; + + // Loop po vseh narocilih v sistemu $sqlNarocilo = sisplet_query("SELECT un.*, u.name, u.surname, u.email, up.name AS package_name, up.description AS package_description, up.price AS package_price FROM user_access_narocilo un, users u, user_access_paket up - WHERE un.usr_id=u.id AND un.package_id=up.id + WHERE un.usr_id=u.id AND un.package_id=up.id ".$status." ORDER BY un.id DESC "); while($rowNarocilo = mysqli_fetch_array($sqlNarocilo)){ @@ -343,6 +363,13 @@ class UserNarocila{ // Admini vidijo vsa narocila $data = $this->getNarocila(); + // Filtri po statusu + echo '
'; + echo ''; + echo ''; + echo ''; + echo '
'; + echo ''; // Glava tabele @@ -1228,10 +1255,13 @@ class UserNarocila{ $countries_eu['Slovakia'] = 'SK'; - // Ce ni drzava s seznama vedno placa DDV - if(!isset($countries_eu[$drzava])) + // Slovenija - vedno placa DDV + if($drzava == 'Slovenija' || $drzava == 'Slovenia') return true; + // Ce ni drzava s seznama in ni Slovenija - po novem nikoli ne placa DDV + if(!isset($countries_eu[$drzava])) + return false; // Drugace gre za tujca iz EU - preverimo ce je zavezanec $client = new SoapClient("http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl"); @@ -1336,5 +1366,31 @@ class UserNarocila{ $sqlNarocilo = sisplet_query("DELETE FROM user_access_narocilo WHERE id='".$narocilo_id."'"); } } + + // Filter narocil + if($_GET['a'] == 'filterNarocila') { + + $status = (isset($_POST['status'])) ? $_POST['status'] : ''; + $value = (isset($_POST['value'])) ? $_POST['value'] : ''; + + if($status != '' && $value != ''){ + + if($status == '0'){ + $_SESSION['narocila_filter']['neplacana'] = $value; + $this->narocila_filter['neplacana'] = $value; + } + elseif($status == '1'){ + $_SESSION['narocila_filter']['placana'] = $value; + $this->narocila_filter['placana'] = $value; + } + elseif($status == '2'){ + $_SESSION['narocila_filter']['stornirana'] = $value; + $this->narocila_filter['stornirana'] = $value; + } + } + + // Na novo izrisemo tabelo z narocili + $this->displayNarocilaTableAdmin(); + } } } \ No newline at end of file diff --git a/lang/1.php b/lang/1.php index 062c241fe..5db863005 100644 --- a/lang/1.php +++ b/lang/1.php @@ -7410,6 +7410,10 @@ $lang = array ( 'srv_narocilo_status_1' => "Plačano", 'srv_narocilo_status_2' => "Stornirano", + 'srv_narocilo_filter_status_0' => "Neplačana", + 'srv_narocilo_filter_status_1' => "Plačana", + 'srv_narocilo_filter_status_2' => "Stornirana", + 'srv_narocilo_email_predracun_subject' => "Oddano naročilo št. ", 'srv_narocilo_email_predracun_content1' => "Hvala za oddano naročilo.", 'srv_narocilo_email_predracun_content2' => "Predračun za plačilo je dostopen na spodnji povezavi:", diff --git a/lang/2.php b/lang/2.php index 055ad3d6f..15aa7b002 100644 --- a/lang/2.php +++ b/lang/2.php @@ -7293,6 +7293,10 @@ $lang = array ( 'srv_narocilo_status_1' => "Paid", 'srv_narocilo_status_2' => "Canceled", + 'srv_narocilo_filter_status_0' => "Unpaid", + 'srv_narocilo_filter_status_1' => "Paid", + 'srv_narocilo_filter_status_2' => "Canceled", + 'srv_narocilo_email_predracun_subject' => "Order no. ", 'srv_narocilo_email_predracun_content1' => "Thank you for your order.", 'srv_narocilo_email_predracun_content2' => "Invoice for payment is availible here:", diff --git a/public/css/admin.css b/public/css/admin.css index bda092d82..4d3e0536a 100644 --- a/public/css/admin.css +++ b/public/css/admin.css @@ -26922,6 +26922,12 @@ label.user_access_locked:hover, #narocila a.ovalbutton { line-height: 18px; } +#narocila .narocila_filters { + margin-bottom: 15px; +} +#narocila .narocila_filters label { + margin-right: 10px; +} #narocila table.dataTable.user_narocila_admin { padding: 20px 0; } diff --git a/resources/sass/admin/payments.scss b/resources/sass/admin/payments.scss index 565bd13b2..8d1a51236 100644 --- a/resources/sass/admin/payments.scss +++ b/resources/sass/admin/payments.scss @@ -203,6 +203,14 @@ label.user_access_locked, } // Narocila - tabele + .narocila_filters{ + margin-bottom: 15px; + + label{ + margin-right: 10px; + } + } + table.dataTable.user_narocila_admin{ padding: 20px 0; From b4655d068442e01c688a7d8006d6cb4cf7a46b31 Mon Sep 17 00:00:00 2001 From: Peter Hrvatin Date: Wed, 25 Nov 2020 10:48:02 +0100 Subject: [PATCH 40/77] Pri dodajanju prejemnikov vabil iz datoteke, se shranijo v seznam (prej pri uploadu ni ustvarilo novega seznama) --- .../classes/class.SurveyInvitationsNew.php | 38 +++++++++++-------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/admin/survey/classes/class.SurveyInvitationsNew.php b/admin/survey/classes/class.SurveyInvitationsNew.php index fc425a41e..2abe389e7 100644 --- a/admin/survey/classes/class.SurveyInvitationsNew.php +++ b/admin/survey/classes/class.SurveyInvitationsNew.php @@ -4401,21 +4401,21 @@ class SurveyInvitationsNew { echo $msg; - /*echo '
'; - echo $lang['srv_invitation_note11'].''.$lang['srv_invitation_note11_link'].'';*/ - echo '
'; echo '
'; } function uploadRecipients() { - global $lang; + global $lang; + $errors = array(); $allowedExtensions = array("txt","csv","dat"); - $_fields = trim($_POST['fields']); + + $_fields = trim($_POST['fields']); if ($_fields != null && $_fields != '') { $fields = explode(',',$_fields); - } else { + } + else { $fields = array(); } @@ -4451,17 +4451,22 @@ class SurveyInvitationsNew { # če so napake jih prikažemo če ne obdelamo datoteko if (count($errors) > 0) { + echo '
'; + + echo ''.$lang['srv_inv_recipiens_upload_error'].''; + echo '
'; - echo ''.$lang['srv_inv_recipiens_upload_error'].''; - echo '
'; - echo '
'; + echo '
'; + echo ''; - foreach($errors as $error) { + foreach($errors as $error) { echo '* '.$error.'
'; } - echo '
'; + echo ''; + $this->addRecipientsView($fields, $invalid_recipiens_array); - } else { + } + else { $fh = @fopen($file_tmp, "rb"); if ($fh) { @@ -4473,10 +4478,13 @@ class SurveyInvitationsNew { // Vejica NI kul, ker se uporablja pri nazivih in v custom poljih Za interni delimiter naj bo recimo " | "... $recipients_list = str_replace ($_POST['recipientsDelimiter'], "|~|", $recipients_list); - #dodamo polja - $result = $this->addMassRecipients($recipients_list, $fields); + // Dodamo polja + $result = $this->addMassRecipients($recipients_list, $fields); + + // Shranimo v seznam + $pid = $this->saveAppendRecipientList($pid=0, $fields, $recipients_list, $profileName='', $profileComment=''); - # prikažemo napake + // Prikažemo napake $invalid_recipiens_array = $this->displayRecipentsErrors($result); $this->addRecipientsView($fields, $invalid_recipiens_array); From be8d1052d790fa5de2358b972cab5bb96785cba2 Mon Sep 17 00:00:00 2001 From: Peter Hrvatin Date: Wed, 25 Nov 2020 11:07:19 +0100 Subject: [PATCH 41/77] Dodan angleski prevod komentarja na predracunu ce ni ddv-ja --- frontend/payments/cebelica/InvoiceFox/cebelcaApi.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/frontend/payments/cebelica/InvoiceFox/cebelcaApi.php b/frontend/payments/cebelica/InvoiceFox/cebelcaApi.php index 9c5a64699..dabdbeabc 100644 --- a/frontend/payments/cebelica/InvoiceFox/cebelcaApi.php +++ b/frontend/payments/cebelica/InvoiceFox/cebelcaApi.php @@ -142,12 +142,20 @@ function ustvariPredracun($api,$podatki,$lang='si') { // Podjetje, ki nima ddv (EU zavezanec oz. katerakoli 3. drzava) if($podatki['podjetjeime'] != "" && $podatki['ddv'] != 1) { - $pub_notes = 'V skladu s členom 25/1 ZDDV-1 ni obračunan DDV.'; + + if($lang == 'si') + $pub_notes = 'V skladu s členom 25/1 ZDDV-1 ni obračunan DDV.'; + else + $pub_notes = 'According to article 25/1 ZDDV-1 VAT is not included.'; } // Fizicna oseba iz 3. drzave, ki nima ddv if($podatki['podjetjeime'] == "" && $podatki['ddv'] != 1) { - $pub_notes = 'V skladu s členom 30.d/1 ZDDV-1 ni obračunan DDV.'; + + if($lang == 'si') + $pub_notes = 'V skladu s členom 30.d/1 ZDDV-1 ni obračunan DDV.'; + else + $pub_notes = 'According to article 30.d/1 ZDDV-1 VAT is not included.'; } From 34cceb83e590fec67df65bcc5f869f5f0e9343e4 Mon Sep 17 00:00:00 2001 From: Peter Hrvatin Date: Thu, 26 Nov 2020 09:08:33 +0100 Subject: [PATCH 42/77] Manjsi popravek pri oznacevanju ddv-ja pri nakupu paketa --- frontend/payments/classes/class.UserNarocila.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frontend/payments/classes/class.UserNarocila.php b/frontend/payments/classes/class.UserNarocila.php index f9614378b..a3deb4de4 100644 --- a/frontend/payments/classes/class.UserNarocila.php +++ b/frontend/payments/classes/class.UserNarocila.php @@ -1255,6 +1255,10 @@ class UserNarocila{ $countries_eu['Slovakia'] = 'SK'; + // Ce drzava ni oznacena - placa DDV + if($drzava == '') + return true; + // Slovenija - vedno placa DDV if($drzava == 'Slovenija' || $drzava == 'Slovenia') return true; From a209c666b48916a84f6a539f11e3f10fb3286b08 Mon Sep 17 00:00:00 2001 From: Peter Hrvatin Date: Thu, 26 Nov 2020 09:56:48 +0100 Subject: [PATCH 43/77] Popravek seznama pri vabilih pri uvozu respondentov iz datoteke --- .../classes/class.SurveyInvitationsNew.php | 153 +++++++----------- 1 file changed, 56 insertions(+), 97 deletions(-) diff --git a/admin/survey/classes/class.SurveyInvitationsNew.php b/admin/survey/classes/class.SurveyInvitationsNew.php index 2abe389e7..ce2f8aa25 100644 --- a/admin/survey/classes/class.SurveyInvitationsNew.php +++ b/admin/survey/classes/class.SurveyInvitationsNew.php @@ -3050,15 +3050,19 @@ class SurveyInvitationsNew { } function displayMailToSourceLists($source_type) { - global $lang,$site_url; - $canShowSubOption = false; + global $lang, $site_url; + + $canShowSubOption = false; + echo '

'; echo $lang['srv_inv_send_who_create1'].''.$lang['srv_inv_send_who_create2'].'
'; - if ((int)$source_type == 0) { + + if ((int)$source_type == 0) { # vsi respondenti v bazi echo $lang['srv_inv_send_who_database_note']; $canShowSubOption = true; - } elseif ((int)$source_type == 1) { + } + elseif ((int)$source_type == 1) { # Arhivi pošiljanja # poiščemo arhiv mailingov @@ -3067,8 +3071,10 @@ class SurveyInvitationsNew { $sql_query_arc = sisplet_query($sql_string_arc); if (mysqli_num_rows($sql_query_arc) > 0) { - $canShowSubOption = true; - echo $lang['srv_inv_send_who_archive_note']; + + $canShowSubOption = true; + + echo $lang['srv_inv_send_who_archive_note']; echo '

'; echo ''; echo ''; @@ -3076,29 +3082,40 @@ class SurveyInvitationsNew { echo ''; echo ''; echo ''; - while ($row_arc = mysqli_fetch_assoc($sql_query_arc)) { + + while ($row_arc = mysqli_fetch_assoc($sql_query_arc)) { echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; - } + } + echo '
 '.$lang['srv_inv_send_who_table_respondents'].''.$lang['srv_inv_send_who_table_date_create'].'
'.$row_arc['naslov'].''.((int)$row_arc['cnt_succsess']+(int)$row_arc['cnt_error']).''.$row_arc['ds'].'
'; - } else{ + } + else{ echo $lang['srv_inv_send_who_archive_no_archive']; - } - - } elseif ((int)$source_type == 2) { + } + } + elseif ((int)$source_type == 2) { # seznami respondentov # zloopamo skozi posamezne sezname respondentov - $sql_string_arc ="SELECT list_id as id, COUNT(*) as cnt_succsess, list_id, sirp.name as naslov, DATE_FORMAT(sirp.insert_time,'%d.%m.%Y, %T') AS ds FROM srv_invitations_recipients AS sir LEFT JOIN srv_invitations_recipients_profiles AS sirp ON sir.list_id = sirp.pid WHERE ank_id ='".$this->sid."' AND sir.deleted ='0' group BY list_id"; - #$sql_string_arc = "SELECT sia.*, DATE_FORMAT(sia.date_send,'%d.%m.%Y, %T') AS ds, u.name, u.surname, u.email FROM srv_invitations_archive AS sia LEFT JOIN users AS u ON sia.uid = u.id WHERE ank_id = '".$this->sid."' ORDER BY sia.date_send ASC;"; - $sql_query_arc = sisplet_query($sql_string_arc); - if (mysqli_num_rows($sql_query_arc) > 0) { - $canShowSubOption = true; - echo $lang['srv_inv_send_who_all_units_note']; + $sql_string_arc =""; + $sql_query_arc = sisplet_query("SELECT list_id as id, COUNT(*) as cnt_succsess, list_id, sirp.name as naslov, DATE_FORMAT(sirp.insert_time,'%d.%m.%Y, %T') AS ds + FROM srv_invitations_recipients AS sir + LEFT JOIN srv_invitations_recipients_profiles AS sirp + ON sir.list_id = sirp.pid + WHERE ank_id ='".$this->sid."' AND sir.deleted ='0' group BY list_id + "); + + if (mysqli_num_rows($sql_query_arc) > 0) { + + $canShowSubOption = true; + + echo $lang['srv_inv_send_who_all_units_note']; + echo ''; echo ''; echo ''; @@ -3107,20 +3124,26 @@ class SurveyInvitationsNew { echo ''; echo ''; while ($row_arc = mysqli_fetch_assoc($sql_query_arc)) { - if ($row_arc['id'] > 0 && $row_arc['naslov'] == '') { + + if ($row_arc['id'] > 0 && $row_arc['naslov'] == '') { # če ni imena in je id < 0 je bil izbrisan - } else { + } + else { if ($row_arc['id'] > 0) { if ($row_arc['naslov'] != '') { $_naslov = $row_arc['naslov']; - } else { + } + else { $_naslov = $lang['srv_inv_send_who_table_list_deleted']; } - } else if ($row_arc['id'] == 0) { + } + else if ($row_arc['id'] == 0) { $_naslov = $lang['srv_inv_send_who_table_list_temporary']; - } else if ($row_arc['id'] < 0) { + } + else if ($row_arc['id'] < 0) { $_naslov = $lang['srv_inv_send_who_table_list_noname']; - } + } + echo ''; echo ''; echo ''; @@ -3130,14 +3153,15 @@ class SurveyInvitationsNew { } } echo '
 '.$lang['srv_inv_send_who_table_date_create'].'
'.$_naslov.'
'; - } else{ + } + else{ echo $lang['srv_inv_send_who_no_lists']; } - } echo '

'; if ($canShowSubOption == true) { + echo ''; echo ''.$lang['srv_inv_send_note'].'
'; echo '
'; @@ -4477,13 +4501,13 @@ class SurveyInvitationsNew { # po potrebi zamenjamo delimiter iz (;) v (,) // Vejica NI kul, ker se uporablja pri nazivih in v custom poljih Za interni delimiter naj bo recimo " | "... $recipients_list = str_replace ($_POST['recipientsDelimiter'], "|~|", $recipients_list); - - // Dodamo polja - $result = $this->addMassRecipients($recipients_list, $fields); - + // Shranimo v seznam $pid = $this->saveAppendRecipientList($pid=0, $fields, $recipients_list, $profileName='', $profileComment=''); - + + // Dodamo polja + $result = $this->addMassRecipients($recipients_list, $fields, $pid); + // Prikažemo napake $invalid_recipiens_array = $this->displayRecipentsErrors($result); @@ -5084,75 +5108,10 @@ class SurveyInvitationsNew { function getProfileName() { echo 'DEPRECATED'; - /* - global $lang,$site_url, $global_user_id; - - $array_profiles = array(); - #ne vem če je fino da lahko dodaja kar na vse sezname - session_start(); - $_only_this_survey = (isset($_SESSION['inv_rec_only_this_survey']) && $_SESSION['inv_rec_only_this_survey'] == false) ? '' : " AND from_survey = '".$this->sid. "'" ; - - # polovimo še ostale porfile - $sql_string = "SELECT pid, name,comment FROM srv_invitations_recipients_profiles WHERE uid in('0', '".$global_user_id."')".$_only_this_survey; - $sql_query = sisplet_query($sql_string); - while ($sql_row = mysqli_fetch_assoc($sql_query)) { - $array_profiles[$sql_row['pid']] = array('name' => $sql_row['name'], 'comment'=>$sql_row['comment']); - } - - #echo '
'; - echo ''; - echo $lang[''].'Izberite seznam kamor želite dodati prejemnike. Izbirate lahko med:
  • \'Nov seznam\' - prejemniki se dodajo v nov seznam, kateremu določite ime
  • \'Začasen seznam\' - seznam obstaja samo v času seje brskalnika
  • ali izberete obstoječ seznam, h kateremu se bodo dodali prejemniki

'; - echo '
'; - echo $lang['srv_invitation_recipients_list_add'].': '; - echo ''; - echo ' 0 ? ' class="displayNone"' : '' ).'>'; - echo '

'; - echo ''; - echo '
'; - echo '

'; - echo $lang['srv_inv_recipient_list_comment']; - - echo ''; - - echo '

'; - echo ''.$lang['srv_cancel'].''; - echo ''.$lang['save'].''; - echo '
'; - #echo '
'; # id="inv_view_arch_recipients" - echo ''; -*/ } function saveRecProfile() { - global $lang,$site_url, $global_user_id; + global $lang, $site_url, $global_user_id; $return = array('error'=>'0'); $profile_id = isset($_POST['profile_id'])? (int)$_POST['profile_id'] : -1; From a5cfb3f90dc1cfac8b240fb351ae8001c17fb161 Mon Sep 17 00:00:00 2001 From: Peter Hrvatin Date: Thu, 26 Nov 2020 10:46:42 +0100 Subject: [PATCH 44/77] Popravek obvestila da nima dostopa do funkcionalnosti, ce avtor ankete nima zakupljenega paketa in uporabnik ni avtor. --- admin/survey/SurveyAdmin.php | 2 +- admin/survey/script/narocila.js | 6 +-- .../payments/classes/class.UserAccess.php | 48 +++++++++++++++---- lang/1.php | 1 + lang/2.php | 1 + 5 files changed, 46 insertions(+), 12 deletions(-) diff --git a/admin/survey/SurveyAdmin.php b/admin/survey/SurveyAdmin.php index d8c605a86..9cf037a1e 100644 --- a/admin/survey/SurveyAdmin.php +++ b/admin/survey/SurveyAdmin.php @@ -721,7 +721,7 @@ class SurveyAdmin // Preverimo trenuten paket uporabnika $userAccess = UserAccess::getInstance($global_user_id); $current_package = $userAccess->getPackage(); - if($current_package != '3'){ + if($current_package != '3' && !$userAccess->userNotAuthor()){ $drupal_url = ($lang['id'] == '2') ? $site_url.'d/en/' : $site_url.'d/'; $upgrade_url = $drupal_url.'izvedi-nakup/3/podatki'; diff --git a/admin/survey/script/narocila.js b/admin/survey/script/narocila.js index 64345a2d4..dbab3b024 100644 --- a/admin/survey/script/narocila.js +++ b/admin/survey/script/narocila.js @@ -36,9 +36,9 @@ function userAccessFilters(){ // Prikaz popupa da funkcionalnost ni na voljo v paketu function popupUserAccess(what) { - - $('#fade').fadeTo('slow', 1); - $("#popup_user_access").load('ajax.php?t=userAccess&a=displayNoAccessPopup', {what: what}); + + $('#fade').fadeTo('slow', 1); + $("#popup_user_access").load('ajax.php?t=userAccess&a=displayNoAccessPopup', {what: what, anketa: srv_meta_anketa_id}); $("#popup_user_access").show(); } diff --git a/frontend/payments/classes/class.UserAccess.php b/frontend/payments/classes/class.UserAccess.php index abbf4fec9..056669fe1 100644 --- a/frontend/payments/classes/class.UserAccess.php +++ b/frontend/payments/classes/class.UserAccess.php @@ -13,6 +13,7 @@ class UserAccess{ private $usr_id; private $user_access; + private $user_not_author = false; private $anketa_old = false; // Pri starih anketah ne upostevamo paketov in so na voljo vse funkcionalnosti private $anketa_old_date = '2020-07-01'; // Anketa je stara, ce je bila ustvarjena pred tem datumom @@ -219,6 +220,10 @@ class UserAccess{ return $this->anketa_old; } + public function userNotAuthor(){ + return $this->user_not_author; + } + // Preverimo ce ima uporabnik dostop do neke funkcionalnosti public function checkUserAccess($what=''){ @@ -297,22 +302,28 @@ class UserAccess{ // Preverimo, ce smo znotraj dolocene ankete in ce je usr_id enak id-ju avtorja ankete private function checkSurveyAuthor(){ + // Nastavimo id ankete + if(isset($_GET['anketa'])){ + $ank_id = $_GET['anketa']; + } + elseif(isset($_POST['anketa']) && $_POST['anketa'] != 'undefined'){ + $ank_id = $_POST['anketa']; + } // Ce nismo znotraj ankete je vse ok - if(!isset($_GET['anketa'])){ + else{ return; } - // Nastavimo id ankete - $ank_id = $_GET['anketa']; - // Ce smo znotraj ankete, preverimo, ce je usr_id enak avtorju ankete $sqlA = sisplet_query("SELECT insert_uid FROM srv_anketa WHERE id='".$ank_id."'"); if(mysqli_num_rows($sqlA) > 0){ $rowA = mysqli_fetch_array($sqlA); // Ce user ni avtor, preverjamo za avtorja - if($this->usr_id != $rowA['insert_uid']) + if($this->usr_id != $rowA['insert_uid']){ $this->usr_id = $rowA['insert_uid']; + $this->user_not_author = true; + } } return; @@ -340,8 +351,14 @@ class UserAccess{ echo '
'; + // Ce user ni avtor ankete + if($this->user_not_author){ + echo '

'.$lang['srv_access_no_access_not_author'].'

'; + } + echo '

'.$lang['srv_access_no_access'].' "'.$package_required_name.'".

'; - echo ''; + if(!$this->user_not_author) + echo ''; echo '
'; } @@ -360,8 +377,14 @@ class UserAccess{ else $drupal_url = $site_url.'d/izvedi-nakup/'.$package_required.'/podatki'; + // Ce user ni avtor ankete + if($this->user_not_author){ + echo '

'.$lang['srv_access_no_access_not_author'].'

'; + } + echo '

'.$lang['srv_access_no_access'].' "'.$package_required_name.'".

'; - echo ''; + if(!$this->user_not_author) + echo ''; echo ''; } @@ -378,7 +401,16 @@ class UserAccess{ $package_required = (isset($this->functionality_package[$what])) ? $this->functionality_package[$what] : 3; $package_required_name = $this->packages[$package_required]['name']; - echo '

'.$lang['srv_access_no_access'].' "'.$package_required_name.'".

'; + echo '

'; + + // Ce user ni avtor ankete + if($this->user_not_author){ + echo $lang['srv_access_no_access_not_author'].'

'; + } + + echo $lang['srv_access_no_access'].' "'.$package_required_name.'"'; + + echo '

'; } diff --git a/lang/1.php b/lang/1.php index 5db863005..9eebbd552 100644 --- a/lang/1.php +++ b/lang/1.php @@ -7472,6 +7472,7 @@ $lang = array ( // DOSTOP GLEDE NA PAKET + 'srv_access_no_access_not_author' => "Avtor ankete nima zakupljenega ustreznega paketa, ki vključuje to funkcionalnost.", 'srv_access_no_access' => "Funkcionalnost je na voljo samo v plačljivi verziji 1ke v paketu", 'srv_access_package' => "Aktivni paket", 'srv_access_package_free' => "brezplačno", diff --git a/lang/2.php b/lang/2.php index 15aa7b002..55c23ef26 100644 --- a/lang/2.php +++ b/lang/2.php @@ -7355,6 +7355,7 @@ $lang = array ( // DOSTOP GLEDE NA PAKET + 'srv_access_no_access_not_author' => "Survey author does not have sufficient package for this functionality.", 'srv_access_no_access' => "Functionality is available only in paid version of 1ka in package", 'srv_access_package' => "Active package", 'srv_access_package_free' => "free", From 54cb49d2eecbd41dc51b6a723c3b6a8834f3642e Mon Sep 17 00:00:00 2001 From: Robert Date: Fri, 27 Nov 2020 10:17:29 +0100 Subject: [PATCH 45/77] Drupal: Stripe in PayPal 2s zakasnitev pred preusmeritvijo na njihov placilni sistem. --- frontend/drupal/sites/all/themes/pro1ka/js/script.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/frontend/drupal/sites/all/themes/pro1ka/js/script.js b/frontend/drupal/sites/all/themes/pro1ka/js/script.js index a6556952e..e8cfe58fc 100755 --- a/frontend/drupal/sites/all/themes/pro1ka/js/script.js +++ b/frontend/drupal/sites/all/themes/pro1ka/js/script.js @@ -1275,13 +1275,17 @@ function oddajNarociloNaStreznik() { } else if (paymentMethod == 2) { - urlRedirect = val.paypal_link; + setTimeout(function() { + urlRedirect = val.paypal_link; + }, 2000); } else if (paymentMethod == 3) { // Nastavimo Stripe instanco var stripe = Stripe(jQuery('#stripe-token').val()); - return stripe.redirectToCheckout({ sessionId: val.session_id }); + setTimeout(function(){ + return stripe.redirectToCheckout({ sessionId: val.session_id }); + }, 2000); } window.location = urlRedirect; From 4abf1297fe402d08bfe6b9168b0b0321897574d2 Mon Sep 17 00:00:00 2001 From: Robert Date: Fri, 27 Nov 2020 14:20:39 +0100 Subject: [PATCH 46/77] =?UTF-8?q?Drupal:=20Polje=20dr=C5=BEava=20je=20obve?= =?UTF-8?q?zno=20za=20vse,=20dinami=C4=8Dno=20preverjanje,=20=C4=8De=20je?= =?UTF-8?q?=20zavezanec=20za=20DDV.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sites/all/themes/pro1ka/js/script.js | 42 +++- .../nakupovanje-1ka-kosarica.tpl.php | 179 +++++++++--------- 2 files changed, 128 insertions(+), 93 deletions(-) diff --git a/frontend/drupal/sites/all/themes/pro1ka/js/script.js b/frontend/drupal/sites/all/themes/pro1ka/js/script.js index e8cfe58fc..43df4a37e 100755 --- a/frontend/drupal/sites/all/themes/pro1ka/js/script.js +++ b/frontend/drupal/sites/all/themes/pro1ka/js/script.js @@ -622,6 +622,7 @@ // Naročila jQuery('.racun-na-podjetje').on('click', function () { jQuery('.podatki-za-podjetje').toggle(); + prikaziPoljeEracun(); if (jQuery('#racun-na-podjetje').is(':checked')) { jQuery('.polje-za-podjetje').attr('required', 'required'); @@ -678,6 +679,19 @@ return ''; } + //Pridobi API klic, če gre za davčnega zavezanca + jQuery.post('/frontend/api/api.php?action=check_ddv', { + cena: jQuery('#predogled-nakupa-1ka .cena-paketa').text(), + podjetje_drzava: jQuery('[name="podjetje_drzava"] :selected').val(), + podjetje_davcna: jQuery('[name="podjetje_davcna"]').val() + }).done(function (val) { + val = JSON.parse(val); + + if (val.success && val.cena > 0) { + jQuery('#predogled-nakupa-1ka .cena-paketa').text(val.cena); + } + }); + // Pri trajanju je pomembno,da pravilno sklanjamo var trajanje = jQuery('[name="trajanje"]:checked').val(); if (trajanje == 12) { @@ -697,6 +711,7 @@ jQuery('#forma-telefon').text(jQuery('#f-telefon').val()); jQuery('#col-forma-telefon').show(); } + jQuery('#forma-d-drzava').text(jQuery('[name="podjetje_drzava"] :selected').val()); // Iz forme poberemo pdoatke o podjetju if (jQuery('#racun-na-podjetje').is(':checked')) { @@ -705,7 +720,6 @@ jQuery('#forma-d-naslov').text(jQuery('[name="podjetje_naslov"]').val()); jQuery('#forma-d-postna-st').text(jQuery('[name="podjetje_postna"]').val()); jQuery('#forma-d-posta-ime').text(jQuery('[name="podjetje_posta"]').val()); - jQuery('#forma-d-drzava').text(jQuery('[name="podjetje_drzava"] :selected').val()); } var placilo = ""; @@ -901,12 +915,7 @@ }); jQuery('#nakup-1ka #polje-drzava').on('change', function(){ - if(jQuery(this).val() == 'Slovenija' || jQuery(this).val() == 'Slovenia'){ - jQuery('#nakup-1ka #polje-podjetje-eracun').show(); - } else { - jQuery('#nakup-1ka #polje-podjetje-eracun').hide(); - jQuery('[name="podjetje_eracun"]').prop('checked', false); - } + prikaziPoljeEracun(); }); jQuery('[name="podjetje_davcna"]').keyup(function () { @@ -1355,3 +1364,22 @@ function posodobiCenoPaketa() { function lang() { return jQuery('[name="lang"]').val(); } + +/** + * Prikažemo polje za Slovenijo v kolikor je uporabnik proračunski uporabnik + */ +function prikaziPoljeEracun(){ + + if(jQuery('#racun-na-podjetje').is(':checked') && + (jQuery('#nakup-1ka #polje-drzava').val() == 'Slovenija' || jQuery('#nakup-1ka #polje-drzava').val() == 'Slovenia')){ + + jQuery('#nakup-1ka #polje-podjetje-eracun').show(); + + } else { + + jQuery('#nakup-1ka #polje-podjetje-eracun').hide(); + jQuery('[name="podjetje_eracun"]').prop('checked', false); + + } + +} diff --git a/frontend/drupal/sites/all/themes/pro1ka/templates/nakupovanje-1ka-kosarica.tpl.php b/frontend/drupal/sites/all/themes/pro1ka/templates/nakupovanje-1ka-kosarica.tpl.php index 292ab4b79..13fad0324 100644 --- a/frontend/drupal/sites/all/themes/pro1ka/templates/nakupovanje-1ka-kosarica.tpl.php +++ b/frontend/drupal/sites/all/themes/pro1ka/templates/nakupovanje-1ka-kosarica.tpl.php @@ -184,85 +184,10 @@
-
-
-
- - - - - -
-
-
+ language == 'sl' ? 'Slovenija' : 'Slovenia'); -
-
-
- -
-
- - - - - - - - -language == 'sl'): ?> - - - - - - - - - - -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- - language == 'sl' ? 'Slovenija' : 'Slovenia'); - - $country_list = array( + $country_list = array( "Afghanistan", "Albania", "Algeria", @@ -456,18 +381,92 @@ "Yemen", "Zambia", "Zimbabwe" - );?> + );?> +
+
+ +
+
+ +
+
+
+ + + + + +
+
+
+ +
- +
+ + + + + + + +language == 'sl'): ?> + + + + + + + + + + +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
@@ -630,6 +629,14 @@ /
+
+ language == 'sl'): ?> + Država: + + Country: + + / +
@@ -665,7 +672,7 @@ Address: , , + id="forma-d-posta-ime">
From ddafd5512743c87b2ecd14232c7db5a39fc8dc48 Mon Sep 17 00:00:00 2001 From: pero1203 Date: Sat, 28 Nov 2020 10:14:44 +0100 Subject: [PATCH 47/77] Popravek api klica za preverjanje ddv-ja --- frontend/payments/classes/class.ApiNarocilaController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/payments/classes/class.ApiNarocilaController.php b/frontend/payments/classes/class.ApiNarocilaController.php index 018daf81b..ff5d769dd 100644 --- a/frontend/payments/classes/class.ApiNarocilaController.php +++ b/frontend/payments/classes/class.ApiNarocilaController.php @@ -290,7 +290,7 @@ class ApiNarocilaController{ $podjetje_davcna = isset($this->data['podjetje_davcna']) ? $this->data['podjetje_davcna'] : ''; $cena = isset($this->data['cena']) ? $this->data['cena'] : ''; - if($podjetje_drzava != '' && $podjetje_davcna != '' && $cena != ''){ + if($podjetje_drzava != '' && $cena != ''){ // Mora placati ddv - cena ostane ista if(UserNarocila::checkPayDDV($podjetje_davcna, $podjetje_drzava)){ From fc34fc6002cb9bd0eda54d275abe162e22396f23 Mon Sep 17 00:00:00 2001 From: pero1203 Date: Tue, 1 Dec 2020 10:08:42 +0100 Subject: [PATCH 48/77] Popravek js errorja - jezik editorja --- admin/survey/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/survey/index.php b/admin/survey/index.php index ef63d341f..2a581d5a2 100644 --- a/admin/survey/index.php +++ b/admin/survey/index.php @@ -98,7 +98,7 @@ echo ''; // END CKEDITOR From 1a42e36bc6bef3b82056d551a3ef14c556d58faa Mon Sep 17 00:00:00 2001 From: pero1203 Date: Tue, 1 Dec 2020 10:09:05 +0100 Subject: [PATCH 49/77] Dodan filter po paketu pri aktivnosti --- .../survey/classes/class.SurveyAktivnost.php | 277 +++++++++++++----- 1 file changed, 209 insertions(+), 68 deletions(-) diff --git a/admin/survey/classes/class.SurveyAktivnost.php b/admin/survey/classes/class.SurveyAktivnost.php index a765af926..a0b0405e2 100644 --- a/admin/survey/classes/class.SurveyAktivnost.php +++ b/admin/survey/classes/class.SurveyAktivnost.php @@ -15,8 +15,7 @@ class SurveyAktivnost{ * @desc prikaze diagnostiko anket */ public function diagnostics() { - global $lang; - global $global_user_id, $admin_type; + global $lang, $global_user_id, $admin_type, $app_settings; $sum = 0; $sum_survey = 0; @@ -42,7 +41,7 @@ class SurveyAktivnost{ echo '
'; echo ''; - + $testdata = (isset($_GET['testdata']) && $_GET['testdata']=='1') ? 1 : 0; $testdataauto = (isset($_GET['testdataauto']) && $_GET['testdataauto']=='1') ? 1 : 0; $uvoz = (isset($_GET['uvoz']) && $_GET['uvoz']=='1') ? 1 : 0; @@ -53,7 +52,25 @@ class SurveyAktivnost{ $mailsent = (isset($_GET['mailsent']) && $_GET['mailsent']=='1') ? 1 : 0; $language = (isset($_GET['language'])) ? $_GET['language'] : 0; - + + if(isset($app_settings['commercial_packages']) && $app_settings['commercial_packages'] == true){ + + $package_1ka = (isset($_GET['package_1ka']) && $_GET['package_1ka']=='0') ? 0 : 1; + $package_2ka = (isset($_GET['package_2ka']) && $_GET['package_2ka']=='0') ? 0 : 1; + $package_3ka = (isset($_GET['package_3ka']) && $_GET['package_3ka']=='0') ? 0 : 1; + + echo ''.$lang['srv_narocilo_paket'].':'; + + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + + echo '|'; + } + echo ''; echo ''; echo ''; @@ -163,25 +180,28 @@ class SurveyAktivnost{ $interval ) AS grupe, srv_anketa WHERE grupe.ank_id=srv_anketa.id - AND (srv_anketa.dostop >= '" . $admin_type . "' OR srv_anketa.id IN - (SELECT ank_id FROM srv_dostop WHERE uid='" . $global_user_id . "')) + AND (srv_anketa.dostop >= '" . $admin_type . "' OR srv_anketa.id IN + (SELECT ank_id FROM srv_dostop WHERE uid='" . $global_user_id . "')) GROUP BY grupe.ank_id ORDER BY responses DESC "); } elseif ($type == 'users') { - $filter = $this->diagnostics_get_user_settings(); + $filter = $this->diagnostics_get_user_settings(); + $filter_package = $this->diagnostics_get_user_package(); $filter_lang = $this->diagnostics_get_lang_filter(); $sql = sisplet_query(" - SELECT COUNT(srv_user.id) AS responses, users.email, srv_user.ank_id, srv_anketa.naslov - FROM srv_user, srv_anketa, users - WHERE ".$filter." AND ".$filter_lang." srv_user.ank_id > '0' - AND srv_anketa.id=srv_user.ank_id - AND (srv_anketa.dostop >= '" . $admin_type . "' OR srv_anketa.id IN - (SELECT ank_id FROM srv_dostop WHERE uid='" . $global_user_id . "')) - $interval - AND srv_anketa.insert_uid = users.id + SELECT COUNT(srv_user.id) AS responses, users.email, srv_user.ank_id, srv_anketa.naslov, user_access.package_id + FROM srv_user, srv_anketa, users + LEFT JOIN user_access + ON user_access.usr_id=users.id + WHERE ".$filter." AND ".$filter_lang." ".$filter_package." srv_user.ank_id > '0' + AND srv_anketa.id=srv_user.ank_id + AND (srv_anketa.dostop >= '" . $admin_type . "' OR srv_anketa.id IN + (SELECT ank_id FROM srv_dostop WHERE uid='" . $global_user_id . "')) + $interval + AND srv_anketa.insert_uid = users.id GROUP BY ank_id ORDER BY responses DESC "); @@ -191,11 +211,11 @@ class SurveyAktivnost{ SELECT COUNT(srv_tracking_active.ank_id) AS responses, srv_tracking_active.ank_id, srv_anketa.naslov FROM srv_tracking_active, srv_anketa WHERE srv_anketa.id = srv_tracking_active.ank_id - AND (`get` LIKE '%analiza%' OR `get` LIKE '%analysis%' ) - AND NOT (`get` LIKE '%charts%') - AND (srv_anketa.dostop >= '" . $admin_type . "' OR srv_anketa.id IN - (SELECT ank_id FROM srv_dostop WHERE uid='" . $global_user_id . "')) - $interval + AND (`get` LIKE '%analiza%' OR `get` LIKE '%analysis%' ) + AND NOT (`get` LIKE '%charts%') + AND (srv_anketa.dostop >= '" . $admin_type . "' OR srv_anketa.id IN + (SELECT ank_id FROM srv_dostop WHERE uid='" . $global_user_id . "')) + $interval GROUP BY ank_id ORDER BY responses DESC "); @@ -206,11 +226,11 @@ class SurveyAktivnost{ SELECT COUNT(srv_tracking_active.ank_id) AS responses, srv_tracking_active.ank_id, srv_anketa.naslov FROM srv_tracking_active, srv_anketa WHERE srv_anketa.id = srv_tracking_active.ank_id - AND (`get` LIKE '%analiza%' OR `get` LIKE '%analysis%' ) - AND (`get` LIKE '%charts%') - AND (srv_anketa.dostop >= '" . $admin_type . "' OR srv_anketa.id IN - (SELECT ank_id FROM srv_dostop WHERE uid='" . $global_user_id . "')) - $interval + AND (`get` LIKE '%analiza%' OR `get` LIKE '%analysis%' ) + AND (`get` LIKE '%charts%') + AND (srv_anketa.dostop >= '" . $admin_type . "' OR srv_anketa.id IN + (SELECT ank_id FROM srv_dostop WHERE uid='" . $global_user_id . "')) + $interval GROUP BY ank_id ORDER BY responses DESC "); @@ -221,9 +241,9 @@ class SurveyAktivnost{ SELECT COUNT(srv_tracking_active.ank_id) AS responses, srv_tracking_active.ank_id, srv_anketa.naslov FROM srv_tracking_active, srv_anketa WHERE srv_anketa.id = srv_tracking_active.ank_id - AND (srv_anketa.dostop >= '" . $admin_type . "' OR srv_anketa.id IN - (SELECT ank_id FROM srv_dostop WHERE uid='" . $global_user_id . "')) - $interval + AND (srv_anketa.dostop >= '" . $admin_type . "' OR srv_anketa.id IN + (SELECT ank_id FROM srv_dostop WHERE uid='" . $global_user_id . "')) + $interval GROUP BY ank_id ORDER BY responses DESC "); @@ -234,9 +254,9 @@ class SurveyAktivnost{ SELECT COUNT(srv_invitations_recipients.id) AS responses, srv_invitations_recipients.ank_id, srv_anketa.naslov FROM srv_invitations_recipients, srv_anketa WHERE srv_anketa.id = srv_invitations_recipients.ank_id AND srv_invitations_recipients.sent = '1' - AND (srv_anketa.dostop >= '" . $admin_type . "' OR srv_anketa.id IN - (SELECT ank_id FROM srv_dostop WHERE uid='" . $global_user_id . "')) - $interval + AND (srv_anketa.dostop >= '" . $admin_type . "' OR srv_anketa.id IN + (SELECT ank_id FROM srv_dostop WHERE uid='" . $global_user_id . "')) + $interval GROUP BY ank_id ORDER BY responses DESC "); @@ -255,7 +275,7 @@ class SurveyAktivnost{ while ($row = mysqli_fetch_array($sql)) { if ($max == -1) - $max = max($row['responses'], $max)*1.3; + $max = max($row['responses'], $max)*1.3; echo ''; echo '' . $row['naslov'] . ''; @@ -263,9 +283,7 @@ class SurveyAktivnost{ $sum = $sum + $row['responses']; $sum_survey = $sum_survey + 1; echo '
 
 '.$row['responses'].'
'; - echo ' - '; - //$sum_survey = sizeof($row); + echo ''; } echo '