first commit
This commit is contained in:
153
modules/pocztapolskaen/CHANGELOG
Normal file
153
modules/pocztapolskaen/CHANGELOG
Normal file
@@ -0,0 +1,153 @@
|
||||
#1.2.3
|
||||
- dodanie obsługi Pocztex 2021 Kurier oraz Pocztex 2021 Na Dziś (#248)
|
||||
#1.2.2
|
||||
- uzupełnianie daty nadania przesyłki planowaną datą nadania zbioru. (#154)
|
||||
- moduł akceptuje zarówno numer telefonu komórkowego jak i zwykły numer telefonu. (#151)
|
||||
|
||||
#1.2.1
|
||||
- przekazywanie wygenerowanego numeru listu przewozowego do przewoźników PrestaShop (#40)
|
||||
- zmiana sposobu generowania przycisku "Wybierz z mapy" dla PrestaShop 1.7 (#129)
|
||||
|
||||
#1.2.0
|
||||
- poprawienie przekazywania parametru: Sprawdzenie zawartości przez odbiorcę w Pocztex 48 (#28)
|
||||
|
||||
#1.1.6
|
||||
- poprawienie sposobu generowania formularza wysyłki na karcie zamówienia.
|
||||
- dodanie fraz w j. polskim w ten sposób, aby można je było przetłumaczyć na inne języki w panelu administracyjnym.
|
||||
|
||||
#1.1.5 Raport RZT-PRESTA_EN-161.xls
|
||||
- 2: Pojawia się błąd, po wejściu w zamówienia/zbiory w moduł Poczta Polska.
|
||||
- 4: Dokonałem jednego zamówienia i jednej płatności czekiem.
|
||||
Wtyczka pokazała je w 4 pozycjach - moim zdaniem to błąd wymagający analizy.
|
||||
może to się przyda: "Nie zapomnij podać identyfikatora Twojego zamówienia QTUOQDNZH."
|
||||
Przy kolejnym zamówieniu powtórka z rozrywki - 5 pozycji
|
||||
Nie zapomnij podać identyfikatora Twojego zamówienia YXPNVNIMY.
|
||||
- 5: Po utworzeniu przesyłki prezentowany jest identyczny numer dla zdublowanych pozycji.
|
||||
- 6: Możliwość dodania wiadomości dodatkowej na etykiecie:
|
||||
w ustawieniach w polu "Opis przesyłki" wkleiłem zmienną {message} - brak wiadomościMożliwość dodania wiadomości dodatkowej na etykiecie:
|
||||
w ustawieniach w polu "Opis przesyłki" wkleiłem zmienną {message} - brak wiadomości
|
||||
- 7: Dodałem wiadomość w komentarzu podczas składania zamówienia, niestety przy tworzeniu przesyłki jest inna, pomimo innych ustawień
|
||||
|
||||
#1.1.4
|
||||
-https://pp.softdeco.pl/issues/1538 #1538 #PrestaEN nieprawidłowe działanie mapy punktu odbioru
|
||||
-https://pp.softdeco.pl/issues/1497 #1497 #PrestaEN Możliwość dodania wiadomości dodatkowej na etykiecie-N0PC0
|
||||
-https://pp.softdeco.pl/issues/1501 #1501 #PrestaEN wymagalność dodania numeru telefonu przy Odbiorze w Punkcie-N0PC0
|
||||
-https://pp.softdeco.pl/issues/1505 #1505 #PrestaEN zmiana nazwy przycisku-N0PC0
|
||||
-https://pp.softdeco.pl/issues/1506 #1506 #PrestaEN odczytywanie statusów przesyłek i przekazywanie do modułu-N0PC0
|
||||
-https://pp.softdeco.pl/issues/1544 #1544 #PrestaEN dostosowanie do modyfikacji systemu EN, w wersji 11-N0PC0
|
||||
-https://pp.softdeco.pl/issues/1584 #1584 #PrestaEN - Pobranie adresu do mapy placówek punktu odbioru-N0PC0
|
||||
|
||||
#1.1.3
|
||||
-https://pp.softdeco.pl/issues/1538 #1538 #PrestaEN nieprawidłowe działanie mapy punktu odbioru
|
||||
|
||||
#1.1.2
|
||||
-https://pp.softdeco.pl/issues/1500 #1500 #PrestaEN brak możliwości wpisania firmy
|
||||
-https://pp.softdeco.pl/issues/1515 #1515 #PrestaEN Błąd w przesyłkach za pobraniem
|
||||
|
||||
#1.1.1
|
||||
- Brak blokady przejścia dalej przy wyborze punktu odbioru (#214)
|
||||
|
||||
#1.1.0
|
||||
- Zmiana numeracji paczki
|
||||
- Wyrzucenie zbędnych komentarzy w kodzie
|
||||
- Dopisanie brakujacych komentarzy przy metodach
|
||||
- Usunięcie błędu związanego z usuwaniem przeterminowanych zbiorów starszych niż 30 dni - wraz z usunięciem zbioru usunięte były wysłane przesyłki z tego zbioru
|
||||
|
||||
#1.0.13
|
||||
- Przesyłka firmowa polecona(#207) (A - RzTA_4696_PrestaSHOP_1.0.12.docx)
|
||||
- Pocztex Kurier 48 - wartość ubezpieczenia(#208) (B - RzTA_4696_PrestaSHOP_1.0.12.docx)
|
||||
- Interfejs do dodawania przesyłek (#172) (C - RzTA_4696_PrestaSHOP_1.0.12.docx)
|
||||
- W trybie debugu bład przy wejściu do wtyczki (F - RzTA_4696_PrestaSHOP_1.0.12.docx)
|
||||
- Zbiór nie zmienia statusu (G - RzTA_4696_PrestaSHOP_1.0.12.docx)
|
||||
|
||||
#1.0.12
|
||||
- Zaznaczanie aktywnego zbioru kolorem (#184)
|
||||
- Interfejs do dodawania przesyłek (#172)
|
||||
- Zamówienie dodanie przycisku Pobierz Etykietę (#189)
|
||||
- Zmiana wysyłania przesyłek (#205)
|
||||
- Zmiana symboli przesyłek (#206)
|
||||
- Obowiązek RODO we wtyczce(#202)
|
||||
- Kwestia powiadomienia o odinstalowaniu wtyczki (#204)
|
||||
- testy automatyczne zostały wykonane na wersjach 1.6.0.11,1.6.1.19,1.7.5.0
|
||||
|
||||
#1.0.11
|
||||
- Przy zmianie nie aktualnym Haśle występuje błąd (#190)
|
||||
- testy automatyczne zostały wykonane na wersjach 1.6.0.11,1.6.1.19,1.7.5.0
|
||||
|
||||
#1.0.10
|
||||
- MIEJSCE ODBIORU (#198)
|
||||
- Aktualizacja dokumentacji do wersji 1.7 (#196)
|
||||
- Opcja wielopaczkowości w usłudze Odbiór w Punkcie (#194)
|
||||
- Wielopaczkowość, nie przenosi parametrów (#193)
|
||||
- Brak urzędu nadania w na liście (#191)
|
||||
- Przy zmianie nie aktualnym Haśle występuje błąd (#190)
|
||||
- testy automatyczne zostały wykonane na wersjach 1.6.0.11,1.6.1.19,1.7.5.0
|
||||
|
||||
#1.0.9
|
||||
- Brak odświeżenia widoku po usunięciu przesyłki (#185)
|
||||
- Błąd weryfikacji numerLokalu wersja 1.7 (#181)
|
||||
- błedy dla php 7.3
|
||||
- testy automatyczne zostały wykonane na wersjach 1.6.0.11 oraz 1.6.1.19
|
||||
|
||||
#1.0.8
|
||||
- Okna nadawania przesyłki w zakładce Zamówieniaa (#183)
|
||||
- brak reakcji na zmianę urzędu nadania (#181)
|
||||
- masa przesyłki - separator dzięsiętny (#180)
|
||||
- Zamówienia - opcja spakuj (#179)
|
||||
- Usługi - przesyłka firmowa polecona - obszar (#178)
|
||||
- Zmiana adresu @ wysyłki informacji (#146)
|
||||
- Dodanie instrukcji PDF (#144)
|
||||
- Opcje dodatkowe Pocztex (#117)
|
||||
- Zamówienia/Widok Zamówienia (#65)
|
||||
- Dostosowanie paczki do Presta 1.7.x
|
||||
- testy automatyczne zostały wykonane na wersjach 1.6.0.11 oraz 1.6.1.19
|
||||
|
||||
#1.0.7
|
||||
- Przenoszenie numeru zamówienia (#173)
|
||||
- Ukrycie hasła (#170)
|
||||
- Powstanie dwóch zbiorów z tą samą nazwą z jednego dnia (#166)
|
||||
- Domyślna masa przesłek listowych (#163)
|
||||
- Filtrowanie Zbiory (#162)
|
||||
- Podgląd zbioru dodanie nazwy zbioru (#158)
|
||||
- Zmiana adresu @ wysyłki informacji (#146)
|
||||
- Dodanie instrukcji PDF (#144)
|
||||
- Zamówienia/Widok Zamówienia (#65)
|
||||
- testy automatyczne zostały wykonane na wersjach 1.6.0.11 oraz 1.6.1.19
|
||||
|
||||
#1.0.6
|
||||
- Wybranie z działania masowego pobierz Etykiety (#165)
|
||||
- Zamów Kuriera Brak czynności (#154)
|
||||
- Tworzenie Pakowanie przesyłek (#141)
|
||||
- testy automatyczne zostały wykonane na wersjach 1.6.0.11 oraz 1.6.1.19
|
||||
|
||||
#1.0.5
|
||||
- Usunięcie atrybutów dla przesyłki polecone (#164)
|
||||
- Wprowadzenie panelu z linkiem do ślezdenie w podglądzie zamówienia (#160)
|
||||
- Pojawianie się "O" w numerze zamówienia (#159)
|
||||
- Sapkuj nie działa na jednym zamówieniu (#157)
|
||||
- Brak Mapy OwP (#156)
|
||||
- Zamów Kuriera Brak czynności - zmiana przycisku na Wyślij oraz zmiana na kg (#154)
|
||||
- Zmiana nazwy buttona 1.0.3 (#151)
|
||||
- testy automatyczne zostały wykonane na wersjach 1.6.0.11 oraz 1.6.1.19
|
||||
|
||||
#1.0.4
|
||||
- poprawione zostały wyskakujace notice i warninigi (#152)
|
||||
- poprawione została obsługa przesyłek dla 1.6.0.x (kłopot z krajami zawierającymi dziwne prefixy)
|
||||
- testy automatyczne zostały wykonane na wersjach 1.6.0.11 oraz 1.6.1.19
|
||||
|
||||
#1.0.3
|
||||
- poprawione zostały wyskakujace notice i warninigi (#147)
|
||||
- poprawiona została synchronizacja zbiorów usuniętych z en (#149)
|
||||
- poprawiona została optymalizacja zarządzania sesją w której trzymamy parametry do synchronizacji danych
|
||||
- optymalizacja wyświetlania listy zamówień]
|
||||
|
||||
#1.0.2
|
||||
- poprawione zostały wyskakujace notice i warninigi (screenshot z czerwonymi ekranami od klienta)
|
||||
- ujednolicone zostały metody do wykorzystania danych z formularzy (fatal error ze zgłoszenie klienta)
|
||||
- poprawione zostały błędy które wyszły podczas testowania (nie zapisywały się: Ustawienia->Usługi->Global Express pole: Zawartość przesyłki, źle odczytywał się parametr Ustawienia->Dostawa->Pocztex->Odbiór w punkcie dla przesyłek pobraniowych )
|
||||
- poprawione zostało wyświetlanie informacji o paczce w podglądzie zamówienia
|
||||
|
||||
#1.0.1
|
||||
#1.0.0
|
||||
- poprawione zostało wyświetlanie wyskakującego okna do wyboru w punkcie
|
||||
- poprawiona została obsługa dodania wielupaczek w przypadku gdy nie jest aktywny żaden zbiór (błąd dodawania zbioru per paczka)
|
||||
144
modules/pocztapolskaen/classes/PPCourier.php
Normal file
144
modules/pocztapolskaen/classes/PPCourier.php
Normal file
@@ -0,0 +1,144 @@
|
||||
<?php
|
||||
|
||||
class PPCourier extends ObjectModel {
|
||||
|
||||
public $sender_name;
|
||||
public $sender_street;
|
||||
public $sender_home_number;
|
||||
public $sender_local_number;
|
||||
public $sender_place;
|
||||
public $sender_postal_code;
|
||||
public $sender_country;
|
||||
public $sender_email;
|
||||
public $sender_mobile_phone;
|
||||
public $customer_name;
|
||||
public $customer_street;
|
||||
public $customer_home_number;
|
||||
public $customer_local_number;
|
||||
public $customer_place;
|
||||
public $customer_postal_code;
|
||||
public $customer_country;
|
||||
public $customer_email;
|
||||
public $customer_mobile_phone;
|
||||
public $receipt_date;
|
||||
public $shipment_mass;
|
||||
public $shipment_quantity;
|
||||
public $receipt_hour;
|
||||
public $confirm_email;
|
||||
public static $definition = array(
|
||||
'table' => '',
|
||||
'fields' => array(
|
||||
'sender_name' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true),
|
||||
'sender_street' => array('type' => self::TYPE_STRING, 'validate' => 'isString', 'required' => true),
|
||||
'sender_home_number' => array('type' => self::TYPE_STRING, 'validate' => 'isString'),
|
||||
'sender_local_number' => array('type' => self::TYPE_STRING, 'validate' => 'isString'),
|
||||
'sender_place' => array('type' => self::TYPE_STRING, 'validate' => 'isString', 'required' => true),
|
||||
'sender_postal_code' => array('type' => self::TYPE_INT, 'validate' => 'isString', 'required' => true),
|
||||
'sender_country' => array('type' => self::TYPE_STRING, 'validate' => 'isString', 'required' => true),
|
||||
'sender_email' => array('type' => self::TYPE_STRING, 'validate' => 'isEmail'),
|
||||
'sender_mobile_phone' => array('type' => self::TYPE_STRING, 'validate' => 'isPhoneNumber', 'size' => 16),
|
||||
'customer_name' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true),
|
||||
'customer_street' => array('type' => self::TYPE_STRING, 'validate' => 'isString', 'required' => true),
|
||||
'customer_home_number' => array('type' => self::TYPE_STRING, 'validate' => 'isString',),
|
||||
'customer_local_number' => array('type' => self::TYPE_STRING, 'validate' => 'isString',),
|
||||
'customer_place' => array('type' => self::TYPE_STRING, 'validate' => 'isString', 'required' => true),
|
||||
'customer_postal_code' => array('type' => self::TYPE_INT, 'validate' => 'isString', 'required' => true),
|
||||
'customer_country' => array('type' => self::TYPE_STRING, 'validate' => 'isString', 'required' => true),
|
||||
'customer_email' => array('type' => self::TYPE_STRING, 'validate' => 'isEmail'),
|
||||
'customer_mobile_phone' => array('type' => self::TYPE_STRING, 'validate' => 'isPhoneNumber', 'size' => 16),
|
||||
'shipment_mass' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat', 'required' => true),
|
||||
'receipt_date' => array('type' => self::TYPE_DATE, 'validate' => 'isDate', 'required' => true),
|
||||
'shipment_quantity' => array('type' => self::TYPE_INT, 'validate' => 'isInt', 'required' => true),
|
||||
'receipt_hour' => array('type' => self::TYPE_INT, 'validate' => 'isString', 'required' => true),
|
||||
'confirm_email' => array('type' => self::TYPE_STRING, 'validate' => 'isEmail', 'required' => true),
|
||||
),
|
||||
);
|
||||
|
||||
public function __construct($id = null, $id_lang = null, $id_shop = null) {
|
||||
$class_name = get_class($this);
|
||||
if (!isset(ObjectModel::$loaded_classes[$class_name])) {
|
||||
$this->def = ObjectModel::getDefinition($class_name);
|
||||
$this->setDefinitionRetrocompatibility();
|
||||
|
||||
ObjectModel::$loaded_classes[$class_name] = get_object_vars($this);
|
||||
} else {
|
||||
foreach (ObjectModel::$loaded_classes[$class_name] as $key => $value) {
|
||||
$this->{$key} = $value;
|
||||
}
|
||||
}
|
||||
|
||||
if ($id_lang !== null) {
|
||||
$this->id_lang = (Language::getLanguage($id_lang) !== false) ? $id_lang : Configuration::get('PS_LANG_DEFAULT');
|
||||
}
|
||||
|
||||
$this->_setFieldsFromProfil();
|
||||
}
|
||||
|
||||
/**
|
||||
* Ustawia pola z profilu ENadawcy
|
||||
*/
|
||||
protected function _setFieldsFromProfil(){
|
||||
$account = ENadawca::Account();
|
||||
$user_info = $account->getMyAccount();
|
||||
if ($account->hasErrors()) {
|
||||
$this->errors = $account->getErrors();
|
||||
} else {
|
||||
if (!empty($user_info)) {
|
||||
foreach (array('sender', 'customer') as $v) {
|
||||
$this->{$v . '_name'} = isset($user_info['domyslnyProfil']['nazwa'])?$user_info['domyslnyProfil']['nazwa']:'';
|
||||
$this->{$v . '_street'} = isset($user_info['domyslnyProfil']['ulica'])?$user_info['domyslnyProfil']['ulica']:'';
|
||||
$this->{$v . '_home_number'} = isset($user_info['domyslnyProfil']['numerDomu'])?$user_info['domyslnyProfil']['numerDomu']:'';
|
||||
$this->{$v . '_local_number'} = isset($user_info['domyslnyProfil']['numerLokalu'])?$user_info['domyslnyProfil']['numerLokalu']:'';
|
||||
$this->{$v . '_place'} = isset($user_info['domyslnyProfil']['miejscowosc'])?$user_info['domyslnyProfil']['miejscowosc']:'';
|
||||
$this->{$v . '_postal_code'} = isset($user_info['domyslnyProfil']['kodPocztowy'])?$user_info['domyslnyProfil']['kodPocztowy']:'';
|
||||
$this->{$v . '_country'} = isset($user_info['domyslnyProfil']['kraj'])?$user_info['domyslnyProfil']['kraj']:'';
|
||||
$this->{$v . '_email'} = isset($user_info['email'])?$user_info['email']:'';
|
||||
$this->{$v . '_mobile_phone'} = isset($user_info['domyslnyProfil']['mobile'])?$user_info['domyslnyProfil']['mobile']:'';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda komunikuje sie ENadawca i wykonuje operacje zamow kuriera
|
||||
*/
|
||||
public function add($auto_date = true, $null_values = false) {
|
||||
$courier = ENadawca::Kurier();
|
||||
$fields = $this->getFields();
|
||||
$courier->zamow(
|
||||
$fields['receipt_date'], PocztaPolskaEn::getReceptionTime($fields['receipt_hour']), $fields['shipment_quantity'], $fields['shipment_mass'], $fields['confirm_email'], Adres::get(
|
||||
array(
|
||||
'nazwa' => $fields['customer_name'],
|
||||
'nazwa2' => $fields['customer_name'],
|
||||
'ulica' => $fields['customer_street'],
|
||||
'numerDomu' => $fields['customer_home_number'],
|
||||
'numerLokalu' => $fields['customer_local_number'],
|
||||
'miejscowosc' => $fields['customer_place'],
|
||||
'kodPocztowy' => $fields['customer_postal_code'],
|
||||
'kraj' => $fields['customer_country'],
|
||||
'mobile' => $fields['customer_mobile_phone'],
|
||||
'email' => $fields['customer_email'],
|
||||
)
|
||||
), Adres::get(
|
||||
array(
|
||||
'nazwa' => $fields['sender_name'],
|
||||
'nazwa2' => $fields['sender_name'],
|
||||
'ulica' => $fields['sender_street'],
|
||||
'numerDomu' => $fields['sender_home_number'],
|
||||
'numerLokalu' => $fields['sender_local_number'],
|
||||
'miejscowosc' => $fields['sender_place'],
|
||||
'kodPocztowy' => $fields['sender_postal_code'],
|
||||
'kraj' => $fields['sender_country'],
|
||||
'mobile' => $fields['sender_mobile_phone'],
|
||||
'email' => $fields['sender_email'],
|
||||
)
|
||||
)
|
||||
);
|
||||
if ($courier->hasErrors()) {
|
||||
$this->errors = $courier->getErrors();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
206
modules/pocztapolskaen/classes/PPOrder.php
Normal file
206
modules/pocztapolskaen/classes/PPOrder.php
Normal file
@@ -0,0 +1,206 @@
|
||||
<?php
|
||||
|
||||
class PPOrder extends ObjectModel {
|
||||
|
||||
public $id_order;
|
||||
public $id_shipment;
|
||||
public $shipment_number;
|
||||
public $order_date;
|
||||
public $send_date;
|
||||
public $post_date;
|
||||
public $shipment_type;
|
||||
public $id_buffor;
|
||||
public $date_add;
|
||||
public $date_upd;
|
||||
public $pni;
|
||||
public $id_cart;
|
||||
public $id_carrier;
|
||||
public $point;
|
||||
public $cod;
|
||||
public static $definition = array(
|
||||
'table' => 'pocztapolskaen_order',
|
||||
'primary' => 'id_pp_order',
|
||||
'fields' => array(
|
||||
'id_order' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
|
||||
'id_cart' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'id_carrier' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'id_shipment' => array('type' => self::TYPE_STRING, 'validate' => 'isString', 'required' => true),
|
||||
'shipment_number' => array('type' => self::TYPE_STRING, 'validate' => 'isString', 'allow_null' => true),
|
||||
'shipment_type' => array('type' => self::TYPE_STRING, 'validate' => 'isString', 'allow_null' => true),
|
||||
'send_date' => array('type' => self::TYPE_DATE, 'allow_null' => true),
|
||||
'post_date' => array('type' => self::TYPE_DATE, 'allow_null' => true),
|
||||
'id_buffor' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
|
||||
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
'point' => array('type' => self::TYPE_STRING, 'validate' => 'isString', 'allow_null' => true),
|
||||
'pni' => array('type' => self::TYPE_INT, 'validate' => 'isInt', 'allow_null' => true),
|
||||
'cod' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||
),
|
||||
'associations' => array(
|
||||
'buffor' => array('type' => self::HAS_ONE, 'field' => 'id_buffor', 'foreign_field' => 'id_en', 'object' => 'PPOrderSet'),
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* Metoda pobiera wszystkie przesyłki pogrupowane wzgledem id zbioru
|
||||
*/
|
||||
public static function getCollection() {
|
||||
$arr = array();
|
||||
$collection = new PrestaShopCollection('PPOrder');
|
||||
foreach ($collection as $c) {
|
||||
$arr[$c->id_en] = $c;
|
||||
}
|
||||
return $arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda pobiera przesylke po identyfikatorze zamowienia
|
||||
*/
|
||||
public static function findByOrder($idOrder) {
|
||||
$orders = new PrestaShopCollection('PPOrder');
|
||||
$orders->where('id_order', '=', $idOrder);
|
||||
if ($orders->count() > 0) {
|
||||
return $orders[0];
|
||||
}
|
||||
$object = new self;
|
||||
$object->id_order = $idOrder;
|
||||
return $object;
|
||||
}
|
||||
|
||||
public static function findByBuffor($idBuffor) {
|
||||
$orders = new PrestaShopCollection('PPOrder');
|
||||
$orders->where('id_buffor', '=', $idBuffor);
|
||||
if ($orders->count() > 0) {
|
||||
return $orders[0];
|
||||
}
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda pobiera przesylki o podanych w parametrze identyfikatorach
|
||||
*/
|
||||
public static function getOrders($ordersIds, $isSent = true, $isShipment = false) {
|
||||
$orders = new PrestaShopCollection('PPOrder');
|
||||
//$orders->join('buffor');
|
||||
$orders->where('id_order', 'in', $ordersIds);
|
||||
/*if ($isSent) {
|
||||
$orders->where('buffor.id_envelope', '>', '0');
|
||||
}*/
|
||||
if ($isShipment) {
|
||||
$orders->where('id_shipment', '>', '0');
|
||||
}
|
||||
return $orders;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda ustawia status zamowienia w zależnosci od zdefiniowanych ustawien
|
||||
*/
|
||||
public function setOrderStatus($name) {
|
||||
$order = new Order($this->id_order);
|
||||
$order_status = PPSetting::getStatusValue($name);
|
||||
if (!empty($order_status)) {
|
||||
$order->setCurrentState($order_status);
|
||||
$order->save();
|
||||
}
|
||||
}
|
||||
|
||||
public function setOrderShipment(){
|
||||
$order = new Order($this->id_order);
|
||||
$orderCarrier = new OrderCarrier($order->getIdOrderCarrier());
|
||||
$orderCarrier->tracking_number = $this->shipment_number;
|
||||
$orderCarrier->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda zwraca adres dostawy zamowienia
|
||||
*/
|
||||
public function getOrderAddress() {
|
||||
$order = new Order($this->id_order);
|
||||
$address = new Address($order->id_address_delivery);
|
||||
return $address;
|
||||
}
|
||||
|
||||
public function getOrderCustomer() {
|
||||
$order = new Order($this->id_order);
|
||||
return $order->getCustomer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda zwraca przesylki pogrupowane wzgledem id zbioru
|
||||
*/
|
||||
public static function getGroupedByBuffer($ordersIds = array()) {
|
||||
$orders = new PrestaShopCollection('PPOrder');
|
||||
$orders->where('id_order', 'in', $ordersIds);
|
||||
$arr = array();
|
||||
if (!empty($orders)) {
|
||||
foreach ($orders as $order) {
|
||||
$arr[$order->id_buffor]['orders'][] = $order;
|
||||
$arr[$order->id_buffor]['guids'][] = $order->id_shipment;
|
||||
}
|
||||
}
|
||||
return $arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda zwraca przesylke wzgledem id koszyka
|
||||
*/
|
||||
public static function findByCart($idCart, $return_object = true) {
|
||||
|
||||
$row = Db::getInstance()->getRow('
|
||||
SELECT `id_pp_order` as id
|
||||
FROM `' . _DB_PREFIX_ . 'pocztapolskaen_order` pp
|
||||
WHERE pp.`id_cart` = ' . (int) $idCart, false
|
||||
);
|
||||
|
||||
if (isset($row['id'])) {
|
||||
return new self($row['id']);
|
||||
} else {
|
||||
if ($return_object) {
|
||||
$ppOrder = new PPOrder();
|
||||
$ppOrder->id_cart = $idCart;
|
||||
$ppOrder->id_order = 0;
|
||||
$ppOrder->id_shipment = 0;
|
||||
$ppOrder->shipment_number = '';
|
||||
$ppOrder->save();
|
||||
return $ppOrder;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda zwraca zbior powiazany z przesylka
|
||||
*/
|
||||
public function getOrderSet() {
|
||||
$ppOrders = new PrestaShopCollection('PPOrderSet');
|
||||
$ppOrders->where('id_en', '=', $this->id_buffor);
|
||||
return $ppOrders[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda resetuje pola zwiazane z przesylka
|
||||
*/
|
||||
public function clearShipment() {
|
||||
$this->clearOrderShipment();
|
||||
if(!empty($this->pni)){
|
||||
$this->id_shipment = 0;
|
||||
$this->id_buffor = 0;
|
||||
$this->shipment_type = '';
|
||||
$this->send_date = null;
|
||||
$this->shipment_number = '';
|
||||
$this->save();
|
||||
} else {
|
||||
$this->delete();
|
||||
}
|
||||
}
|
||||
|
||||
public function clearOrderShipment(){
|
||||
$order = new Order($this->id_order);
|
||||
$orderCarrier = new OrderCarrier($order->getIdOrderCarrier());
|
||||
if($orderCarrier->tracking_number == $this->shipment_number){
|
||||
$orderCarrier->tracking_number = '';
|
||||
$orderCarrier->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
314
modules/pocztapolskaen/classes/PPOrderSet.php
Normal file
314
modules/pocztapolskaen/classes/PPOrderSet.php
Normal file
@@ -0,0 +1,314 @@
|
||||
<?php
|
||||
|
||||
class PPOrderSet extends ObjectModel {
|
||||
|
||||
public $name;
|
||||
public $sender_home_number;
|
||||
public $envelope_status;
|
||||
public $id_post_office;
|
||||
public $post_office;
|
||||
public $post_date;
|
||||
public $id_en;
|
||||
public $id_envelope;
|
||||
public $date_add;
|
||||
public $date_upd;
|
||||
public $active;
|
||||
public $_errors;
|
||||
private static $expiredSets = null;
|
||||
public static $definition = array(
|
||||
'table' => 'pocztapolskaen_order_set',
|
||||
'primary' => 'id_order_set',
|
||||
'fields' => array(
|
||||
'name' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true),
|
||||
'active' => array('type' => self::TYPE_BOOL),
|
||||
'id_post_office' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
|
||||
'post_date' => array('type' => self::TYPE_DATE, 'validate' => 'isDate', 'required' => true),
|
||||
'id_en' => array('type' => self::TYPE_INT, 'validate' => 'isInt','allow_null'=>true),
|
||||
'id_envelope' => array('type' => self::TYPE_INT, 'validate' => 'isInt','allow_null'=>true),
|
||||
'envelope_status' => array('type' => self::TYPE_STRING, 'validate' => 'isString','allow_null'=>true),
|
||||
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* Metoda sprawdza czy istnieje zbiór domyślny i jeśli nie tworzy nowy
|
||||
*/
|
||||
public static function createDefault($defoffice) {
|
||||
$now = date('Y-m-d');
|
||||
if(!is_object($defoffice)||!isset($defoffice->id_en)||empty($defoffice->id_en)){
|
||||
$defoffice = new PrestaShopCollection('PPPostOffice');
|
||||
if(isset($defoffice[0])){
|
||||
$defoffice = $defoffice[0];
|
||||
}
|
||||
}
|
||||
$sets = PPOrderSet::getActiveByOffice($defoffice);
|
||||
if ($sets->count() <= 0 && isset($defoffice->id_en)&& !empty($defoffice->id_en)) {
|
||||
$buffor = ENadawca::EnvelopeBuffor();
|
||||
$object = new PPOrderSet();
|
||||
|
||||
$result = $buffor->create($now, $defoffice->id_en, self::getDefaultName());
|
||||
if (!$buffor->hasErrors()) {
|
||||
$object->name = self::getDefaultName();
|
||||
PPSetting::setNumberOrderSet(PPSetting::getNextNumberForOrderSet());
|
||||
$object->id_en = $result['createdBufor']['idBufor'];
|
||||
$object->active = 1;
|
||||
$object->post_date = $now;
|
||||
$object->id_post_office = $defoffice->id;
|
||||
$object->envelope_status = 'niewyslany';
|
||||
$object->save();
|
||||
return $object;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function getDefaultName(){
|
||||
return date('Y-m-d').'/'.PPSetting::getNextNumberForOrderSet();
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda synchronizuje zbiory ze zbiorami ENadawcy
|
||||
*/
|
||||
public static function reloadData($deleteExpired = false) {
|
||||
$buffors = ENadawca::EnvelopeBuffor()->getList();
|
||||
if(!is_array($buffors)){
|
||||
$buffors = array();
|
||||
//return false;
|
||||
}
|
||||
|
||||
$offices = PPPostOffice::getCollection();
|
||||
$objects = self::getCollection();
|
||||
|
||||
$idBufor = array();
|
||||
$bufforsToDelete = array();
|
||||
$bufforsENId = array();
|
||||
foreach ($buffors as $b) {
|
||||
if (isset($objects[$b['idBufor']])) {
|
||||
$idBufor[$b['idBufor']] = $objects[$b['idBufor']];
|
||||
}
|
||||
$bufforsENId[$b['idBufor']] = $b['idBufor'];
|
||||
}
|
||||
foreach ($objects as $id=>$obj) {
|
||||
if(!in_array($id,$bufforsENId)&&empty($obj->id_envelope) && !$obj->isSendByOffice()){
|
||||
$bufforsToDelete[] = $obj;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if($deleteExpired){
|
||||
$expired = self::getExpired();
|
||||
foreach ($expired as $object) {
|
||||
$object->delete(false);
|
||||
$object->deleteEnvelopeBuffor();
|
||||
}
|
||||
}
|
||||
foreach ($buffors as $buffor) {
|
||||
$obj = (isset($idBufor[$buffor['idBufor']]) && is_object($idBufor[$buffor['idBufor']])) ? $idBufor[$buffor['idBufor']] : new PPOrderSet();
|
||||
if (!isset($buffor['urzadNadania']) || !isset($offices[$buffor['urzadNadania']])) {
|
||||
continue;
|
||||
}
|
||||
$obj->force_id = false;
|
||||
$obj->id_en = (int) $buffor['idBufor'];
|
||||
$obj->name = empty($buffor['opis']) ? ' - ' : $buffor['opis'];
|
||||
$obj->active = $buffor['active'];
|
||||
$obj->id_post_office = $offices[$buffor['urzadNadania']]->id;
|
||||
$obj->post_date = $buffor['dataNadania'];
|
||||
$obj->envelope_status = 'niewyslany';
|
||||
$obj->save();
|
||||
}
|
||||
//synchronizacja usunietych z EN
|
||||
foreach ($bufforsToDelete as $obj) {
|
||||
$obj->delete();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
/**
|
||||
* Metoda pobiera zbiory przeterminowane
|
||||
*/
|
||||
public static function getExpired($col = '') {
|
||||
if(is_null(self::$expiredSets)){
|
||||
$setsCollection = new PrestaShopCollection('PPOrderSet');
|
||||
$setsCollection->where('post_date', '<=', date('Y-m-d', strtotime('-'.PocztaPolskaEn::SET_EXPIRED_DAYS.' days')));
|
||||
$setsCollection->where('id_en', '>', '0');
|
||||
self::$expiredSets = $setsCollection;
|
||||
}
|
||||
if(!empty($col)){
|
||||
$arr = array();
|
||||
foreach($setsCollection as $set){
|
||||
$arr[] = $set->{$col};
|
||||
}
|
||||
return $arr;
|
||||
}
|
||||
return self::$expiredSets;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda zwraca wszystkie zbiory
|
||||
*/
|
||||
public static function getCollection() {
|
||||
$arr = array();
|
||||
$collection = new PrestaShopCollection('PPOrderSet');
|
||||
foreach ($collection as $c) {
|
||||
$arr[$c->id_en] = $c;
|
||||
}
|
||||
return $arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda zwraca nie wysłane zbiory
|
||||
*/
|
||||
public static function getActiveCollection() {
|
||||
$setsCollection = new PrestaShopCollection('PPOrderSet');
|
||||
$setsCollection->sqlWhere('(a0.id_envelope is null OR a0.id_envelope=0) and a0.active = 1');
|
||||
return $setsCollection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda zwraca zbiory aktualne po urzedzie nadania
|
||||
*/
|
||||
public static function getActiveByOffice($office) {
|
||||
$setsCollection = new PrestaShopCollection('PPOrderSet');
|
||||
$setsCollection->sqlWhere('(a0.id_envelope is null OR a0.id_envelope=0) AND a0.active = 1');
|
||||
if(is_object($office)&&isset($office->id)&&!empty($office->id)){
|
||||
$setsCollection->where('id_post_office','=',$office->id);
|
||||
}
|
||||
return $setsCollection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda tworzy zbior w ENadawcy z lokalengo zbioru
|
||||
*/
|
||||
public function addEnvelopeBuffor() {
|
||||
$buffor = ENadawca::EnvelopeBuffor();
|
||||
$fields = $this->getFields();
|
||||
$office = new PPPostOffice($fields['id_post_office']);
|
||||
$result = $buffor->create($fields['post_date'], $office->id_en, $fields['name']);
|
||||
if ($buffor->hasErrors()) {
|
||||
$this->_errors = $buffor->getErrors();
|
||||
return false;
|
||||
}
|
||||
$this->id_en = $result['createdBufor']['idBufor'];
|
||||
$this->envelope_status = 'niewyslany';
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Metoda aktualizuje zbior w ENadawcy z lokalengo zbioru
|
||||
*/
|
||||
public function updateEnvelopeBuffor() {
|
||||
$buffor = ENadawca::EnvelopeBuffor();
|
||||
$fields = $this->getFields();
|
||||
$office = new PPPostOffice($fields['id_post_office']);
|
||||
$buffor->update($fields['id_en'], $fields['post_date'], $office->id_en, $fields['name']);
|
||||
if ($buffor->hasErrors()) {
|
||||
$this->_errors = $buffor->getErrors();
|
||||
return false;
|
||||
}
|
||||
$this->id_en = $fields['id_en'];
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Metoda usuwa zbior w ENadawcy powiazany z lokalenym zbiorem
|
||||
*/
|
||||
public function deleteEnvelopeBuffor() {
|
||||
$buffor = ENadawca::EnvelopeBuffor();
|
||||
$buffor->clear($this->id_en);
|
||||
if ($buffor->hasErrors()) {
|
||||
$this->_errors = $buffor->getErrors();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda pobiera urzad nadania
|
||||
*/
|
||||
public function getPostOffice() {
|
||||
if (!empty($this->id_post_office)) {
|
||||
$object = new PPPostOffice($this->id_post_office);
|
||||
if (!empty($object->id)) {
|
||||
return $object;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda zwraca wszystkie przesyłki wzgledem id zbioru przekazanego w parametrze
|
||||
*/
|
||||
public function getOrdersByBuffor($idBuffor) {
|
||||
$ppOrders = new PrestaShopCollection('PPOrder');
|
||||
$ppOrders->where('id_buffor', '=', $idBuffor);
|
||||
return $ppOrders;
|
||||
}
|
||||
/**
|
||||
* Metoda zwraca zbior wzgledem id zbioru przekazanego w parametrze
|
||||
*/
|
||||
public static function getByBuffor($idBuffor) {
|
||||
$ppOrderSet = new PrestaShopCollection('PPOrderSet');
|
||||
$ppOrderSet->where('id_en', '=', $idBuffor);
|
||||
if(isset($ppOrderSet[0])){
|
||||
return $ppOrderSet[0];
|
||||
}
|
||||
return new self;
|
||||
}
|
||||
/**
|
||||
* Metoda pobiera identyfikatory przesylek wzgledem id zbioru przekazanego w parametrze
|
||||
*/
|
||||
public function getOrdersGuidsByBuffor($idBuffor) {
|
||||
$ppOrders = $this->getOrdersByBuffor($idBuffor);
|
||||
$guids = array();
|
||||
foreach ($ppOrders as $order) {
|
||||
$guids[] = $order->id_shipment;
|
||||
}
|
||||
return $guids;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda usuwa przesylki powiazane z buforem
|
||||
*/
|
||||
public function delete($removeShippment = true) {
|
||||
if($removeShippment){
|
||||
$orders = $this->getOrdersByBuffor($this->id_en);
|
||||
foreach ($orders as $order) {
|
||||
$order->clearShipment();
|
||||
}
|
||||
}
|
||||
|
||||
$result = parent::delete();
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function isSendByOffice(){
|
||||
$packages = PPOrder::findByBuffor($this->id_en);
|
||||
|
||||
if(!empty($packages)){
|
||||
$first_package = (is_object($packages)?$packages:$packages[0]);
|
||||
$send_buffors = ENadawca::Envelope()->get(date('Y-m-d',strtotime('-1 week')),date('Y-m-d'));
|
||||
|
||||
if(isset($send_buffors['envelopes']['idEnvelope'])){
|
||||
$send_buffors['envelopes'] = array($send_buffors['envelopes']);
|
||||
}
|
||||
if(isset($send_buffors['envelopes'])) {
|
||||
foreach($send_buffors['envelopes'] as $envelop){
|
||||
$shipments = ENadawca::Envelope()->getContentShort($envelop['idEnvelope']);
|
||||
if(isset($shipments['przesylka']['guid'])){
|
||||
$shipments['przesylka'] = array($shipments['przesylka']);
|
||||
}
|
||||
if(array_search($first_package->id_shipment, array_column($shipments['przesylka'], 'guid')) !== false){
|
||||
$this->id_envelope = $envelop['idEnvelope'];
|
||||
$this->envelope_status = 'wyslany';
|
||||
$this->update();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
1250
modules/pocztapolskaen/classes/PPPackage.php
Normal file
1250
modules/pocztapolskaen/classes/PPPackage.php
Normal file
File diff suppressed because it is too large
Load Diff
86
modules/pocztapolskaen/classes/PPPostOffice.php
Normal file
86
modules/pocztapolskaen/classes/PPPostOffice.php
Normal file
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
class PPPostOffice extends ObjectModel {
|
||||
|
||||
public $name;
|
||||
public $description;
|
||||
public $id_en;
|
||||
public $id_post_office;
|
||||
public $date_add;
|
||||
public $date_upd;
|
||||
public static $definition = array(
|
||||
'table' => 'pocztapolskaen_post_office',
|
||||
'primary' => 'id_post_office',
|
||||
'fields' => array(
|
||||
'name' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true),
|
||||
'description' => array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml'),
|
||||
'id_en' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
|
||||
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
),
|
||||
);
|
||||
private static $_data = null;
|
||||
/**
|
||||
* Metoda synchronizuje urzendy nadania z urzendami nadania ENadawcy
|
||||
*/
|
||||
public static function reloadData() {
|
||||
$offices = ENadawca::UrzedyNadania()->get();
|
||||
if (isset($offices['urzadNadania'])) {
|
||||
$offices = array($offices);
|
||||
}
|
||||
if(!is_array($offices)){
|
||||
$offices = array();
|
||||
return false;
|
||||
}
|
||||
$idOffices = array();
|
||||
foreach ($offices as $o) {
|
||||
$idOffices[$o['urzadNadania']] = new PPPostOffice();
|
||||
}
|
||||
$objects = self::getCollection();
|
||||
foreach ($objects as $object) {
|
||||
if (!isset($idOffices[$object->id_en]) && !empty($object->id_post_office)) {
|
||||
$object->delete();
|
||||
} else{
|
||||
$idOffices[$object->id_en] = $object;
|
||||
}
|
||||
}
|
||||
foreach ($offices as $o) {
|
||||
$obj = $idOffices[$o['urzadNadania']];
|
||||
$obj->id_en = (int) $o['urzadNadania'];
|
||||
$obj->name = $o['nazwaWydruk'];
|
||||
$obj->description = $o['opis'];
|
||||
$obj->save();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda pobiera wszytskie urzedny nadania grupujac po id ENadawcy
|
||||
*/
|
||||
public static function getCollection($query = false) {
|
||||
$arr = array();
|
||||
if(is_null(self::$_data)){
|
||||
self::$_data = new PrestaShopCollection('PPPostOffice');
|
||||
}
|
||||
$collection = self::$_data;
|
||||
foreach ($collection as $c) {
|
||||
if(!$query){
|
||||
$arr[$c->id_en] = $c;
|
||||
}
|
||||
else{
|
||||
$arr[] = array('id' => $c->id_post_office,'id_en'=> $c->id_en, 'name' => $c->name);
|
||||
}
|
||||
}
|
||||
return $arr;
|
||||
}
|
||||
|
||||
public static function clearCollection(){
|
||||
self::$_data = null;
|
||||
}
|
||||
|
||||
public static function getDefaultOffice(){
|
||||
$default = new PPPostOffice(PPSetting::getSettingsValue(PPSetting::PP_DEFAULT_URZAD_ID));
|
||||
return $default;
|
||||
}
|
||||
}
|
||||
108
modules/pocztapolskaen/classes/PPProfileAddress.php
Normal file
108
modules/pocztapolskaen/classes/PPProfileAddress.php
Normal file
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
|
||||
class PPProfileAddress extends ObjectModel {
|
||||
|
||||
public $id_profile_address;
|
||||
public $name;
|
||||
public $friendly_name;
|
||||
public $id_en;
|
||||
public $street;
|
||||
public $house_number;
|
||||
public $premises_number;
|
||||
public $city;
|
||||
public $postal_code;
|
||||
public $date_add;
|
||||
public $date_upd;
|
||||
public static $definition = array(
|
||||
'table' => 'pocztapolskaen_profile_address',
|
||||
'primary' => 'id_profile_address',
|
||||
'fields' => array(
|
||||
'name' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true),
|
||||
'friendly_name' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
||||
'street' => array('type' => self::TYPE_STRING),
|
||||
'house_number' => array('type' => self::TYPE_STRING),
|
||||
'premises_number' => array('type' => self::TYPE_STRING),
|
||||
'city' => array('type' => self::TYPE_STRING),
|
||||
'postal_code' => array('type' => self::TYPE_STRING),
|
||||
'id_en' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
|
||||
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
),
|
||||
);
|
||||
private static $_data = null;
|
||||
/**
|
||||
* Metoda synchronizuje profile adresow dla zwroconych dokuumentow
|
||||
*/
|
||||
public static function reloadData() {
|
||||
$profiles = ENadawca::Profil()->getReturnDocumentsProfileList();
|
||||
if(empty($profiles)) {
|
||||
return false;
|
||||
}
|
||||
if (!isset($profiles['profile'][0])) {
|
||||
$profiles = array($profiles['profile']);
|
||||
} else {
|
||||
$profiles = $profiles['profile'];
|
||||
}
|
||||
if(!is_array($profiles)){
|
||||
return false;
|
||||
}
|
||||
$idProfiles = array();
|
||||
foreach ($profiles as $o) {
|
||||
$idProfiles[$o['idProfile']] = new PPProfileAddress();
|
||||
}
|
||||
$objects = self::getCollection();
|
||||
foreach ($objects as $object) {
|
||||
if (!isset($idProfiles[$object->id_en]) && !empty($object->id_profile_address)) {
|
||||
$object->delete();
|
||||
} else{
|
||||
$idProfiles[$object->id_en] = $object;
|
||||
}
|
||||
}
|
||||
foreach ($profiles as $o) {
|
||||
if(is_array($o)) {
|
||||
$obj = $idProfiles[$o['idProfile']];
|
||||
$obj->id_en = (int) $o['idProfile'];
|
||||
$obj->name = $o['name'];
|
||||
$obj->friendly_name = $o['friendlyName'];
|
||||
$obj->street = $o['street'];
|
||||
$obj->house_number = $o['houseNumber'];
|
||||
$obj->premises_number = isset($o['premisesNumber'])?$o['premisesNumber']:'';
|
||||
$obj->city = $o['city'];
|
||||
$obj->postal_code = $o['postalCode'];
|
||||
$obj->save();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda pobiera wszytskie profile adresow
|
||||
*/
|
||||
public static function getCollection($query = false) {
|
||||
$arr = array();
|
||||
if(is_null(self::$_data)){
|
||||
self::$_data = new PrestaShopCollection('PPProfileAddress');
|
||||
}
|
||||
$collection = self::$_data;
|
||||
foreach ($collection as $c) {
|
||||
if(!$query){
|
||||
$arr[$c->id_en] = $c;
|
||||
}
|
||||
else{
|
||||
$arr[] = array('id' => $c->id_profile_address,'id_en'=> $c->id_en, 'name' => $c->name,
|
||||
'friendly_name' => $c->friendly_name, 'street' => $c->street,
|
||||
'house_number' => $c->house_number, 'premisses_number' => $c->premises_number,
|
||||
'city' => $c->city, 'postal_code' => $c->postal_code,
|
||||
);
|
||||
}
|
||||
}
|
||||
return $arr;
|
||||
}
|
||||
|
||||
public static function clearCollection(){
|
||||
self::$_data = null;
|
||||
}
|
||||
|
||||
}
|
||||
255
modules/pocztapolskaen/classes/PPSetting.php
Normal file
255
modules/pocztapolskaen/classes/PPSetting.php
Normal file
@@ -0,0 +1,255 @@
|
||||
<?php
|
||||
|
||||
class PPSetting {
|
||||
const PP_SEPARATOR = ',';
|
||||
const PP_USER = 'pp_user';
|
||||
const PP_PASSWORD = 'pp_password';
|
||||
const PP_TEST_URL = 'pp_test_url';
|
||||
const PP_PASSWORD_NEW = 'pp_password_new';
|
||||
const PP_PASSWORD_NEW_REPEAT = 'pp_password_new_repeat';
|
||||
const PP_HELP_SUBJECT = 'pp_help_subject';
|
||||
const PP_HELP_NAME_SURNAME = 'pp_help_name_surname';
|
||||
const PP_HELP_EMAIL = 'pp_help_email';
|
||||
const PP_HELP_TEXT = 'pp_help_text';
|
||||
const PP_IS_STATUS_CREATE = 'pp_is_status_create';
|
||||
const PP_STATUS_CREATE = 'pp_status_create';
|
||||
const PP_IS_STATUS_PRINT_LABEL = 'pp_is_status_print_label';
|
||||
const PP_STATUS_PRINT_LABEL = 'pp_status_print_label';
|
||||
const PP_IS_STATUS_OFFICE_SEND = 'pp_is_status_office_send';
|
||||
const PP_STATUS_OFFICE_SEND = 'pp_status_office_send';
|
||||
const PP_DEFAULT_KARTA_ID ='pp_default_karta_id';
|
||||
const PP_DEFAULT_URZAD_ID ='pp_default_urzad_id';
|
||||
const PP_DEFAULT_KARTA_NAME = 'pp_default_karta_name';
|
||||
const PP_SUPPORT_EMAIL = 'moduly.en@poczta-polska.pl';
|
||||
const PP_SAVE_SETTINGS_SEND_EMAIL = 'pp_save_settings_send_email';
|
||||
const PP_SAVE_SETTINGS_EMAIL_TEXT = 'pp_save_settings_email_text';
|
||||
const PP_COUNT_ORDER_SET = 'pp_count_order_set';
|
||||
const PP_COUNT_ORDER_SET_DATE = 'pp_count_order_set_date';
|
||||
const PP_IS_CONNECTED = 'pp_is_connected';
|
||||
const PP_PROCESS_DATA_RODO = 'pp_process_data_rodo';
|
||||
const PP_PROCESS_INFORMATION_RODO = 'pp_process_information_rodo';
|
||||
|
||||
/**
|
||||
* metoda zwracajaca status do ustawienia na zamowieniu podczas operacji na zbiorach
|
||||
* @param $name
|
||||
* @return string
|
||||
*/
|
||||
public static function getStatusValue($name) {
|
||||
$isEnable = false;
|
||||
switch ($name) {
|
||||
case self::PP_STATUS_CREATE:
|
||||
$isEnable = Configuration::get(self::PP_IS_STATUS_CREATE);
|
||||
break;
|
||||
case self::PP_STATUS_PRINT_LABEL:
|
||||
$isEnable = Configuration::get(self::PP_IS_STATUS_PRINT_LABEL);
|
||||
break;
|
||||
case self::PP_STATUS_OFFICE_SEND:
|
||||
$isEnable = Configuration::get(self::PP_IS_STATUS_OFFICE_SEND);
|
||||
break;
|
||||
}
|
||||
|
||||
return ($isEnable) ? Configuration::get($name) : '';
|
||||
}
|
||||
|
||||
public static function getSettingsValue($name){
|
||||
return Tools::getIsset($name)?Tools::getValue($name):Configuration::get($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* metoda zwracajaca dostawce dla Odbioru w Punkcie
|
||||
*
|
||||
* @param bool $cod
|
||||
* @return array
|
||||
*/
|
||||
public static function getPickupUpAtPoint($cod = false){
|
||||
$pickup = array();
|
||||
|
||||
if(Configuration::get(PPPackage::PP_POCZTEX_48_IS_PICKUP_AT_POINT)){
|
||||
if(!$cod){
|
||||
$pickup = explode(self::PP_SEPARATOR, Configuration::get(PPPackage::PP_POCZTEX_48_PICKUP_AT_POINT_STANDARD));
|
||||
} else {
|
||||
$pickup = explode(self::PP_SEPARATOR, Configuration::get(PPPackage::PP_POCZTEX_48_PICKUP_AT_POINT_COD));
|
||||
}
|
||||
|
||||
}
|
||||
if(Configuration::get(PPPackage::PP_POCZTEX_IS_PICKUP_AT_POINT)){
|
||||
if(!$cod){
|
||||
$pickup = array_merge($pickup, explode(self::PP_SEPARATOR, Configuration::get(PPPackage::PP_POCZTEX_PICKUP_AT_POINT_STANDARD)));
|
||||
} else {
|
||||
$pickup = array_merge($pickup, explode(self::PP_SEPARATOR, Configuration::get(PPPackage::PP_POCZTEX_PICKUP_AT_POINT_COD)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(Configuration::get(PPPackage::PP_POCZTEX_2021_KURIER_IS_PICKUP_AT_POINT)){
|
||||
if(!$cod){
|
||||
$pickup = array_merge($pickup, explode(self::PP_SEPARATOR, Configuration::get(PPPackage::PP_POCZTEX_2021_KURIER_PICKUP_AT_POINT_STANDARD)));
|
||||
} else {
|
||||
$pickup = array_merge($pickup, explode(self::PP_SEPARATOR, Configuration::get(PPPackage::PP_POCZTEX_2021_KURIER_PICKUP_AT_POINT_COD)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
foreach($pickup as $key => $value){
|
||||
if($value == ''){
|
||||
$pickup[$key] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return $pickup;
|
||||
}
|
||||
|
||||
/**
|
||||
* metoda zwracajaca domyslne wartosci dla poszczegolnych przesylek PP
|
||||
* @return array
|
||||
*/
|
||||
public static function getDefaultValues(){
|
||||
$default_values = array();
|
||||
$reflection = new ReflectionClass('PPPackage');
|
||||
$staticProperties = $reflection->getConstants();
|
||||
foreach($staticProperties as $key=>$value){
|
||||
$default_values[$value] = Configuration::get($value);
|
||||
}
|
||||
return $default_values;
|
||||
}
|
||||
|
||||
/**
|
||||
* metoda zwracaja Karty dla danego uzytkownika API
|
||||
* @return array
|
||||
*/
|
||||
public static function getCarts(){
|
||||
$cart = ENadawca::Karta();
|
||||
$carts = $cart->get();
|
||||
$tab = array();
|
||||
|
||||
if($carts !== false){
|
||||
foreach($carts as $value){
|
||||
$tab[] = array('id'=>$value['idKarta'], 'name'=>$value['opis'].'('.$value['idKarta'].')');
|
||||
}
|
||||
}
|
||||
return $tab;
|
||||
}
|
||||
|
||||
/**
|
||||
* metoda zwracaja rodzaje przesylek PP
|
||||
* @return array
|
||||
*/
|
||||
public static function getPPDelivery(){
|
||||
$reflection = new ReflectionClass('PPPackage');
|
||||
$staticProperties = $reflection->getConstants();
|
||||
$tab = array();
|
||||
foreach($staticProperties as $key=>$value){
|
||||
if(strpos($value,'delivery') !== false){
|
||||
$con = Configuration::get($value);
|
||||
if(!empty($con)){
|
||||
$tab = array_merge($tab,explode(PPSetting::PP_SEPARATOR,Configuration::get($value)));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return array_unique($tab);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* metoda zwracajaca rodzaj przesylki PP dla podanego id dostawcy
|
||||
* @param $carrierId
|
||||
* @param bool $delivery_cod
|
||||
* @return mixed|string
|
||||
*/
|
||||
public static function getPackageByOrderDelvery($carrierId,$delivery_cod = false){
|
||||
$reflection = new ReflectionClass('PPPackage');
|
||||
$staticProperties = $reflection->getConstants();
|
||||
$tab = array();
|
||||
foreach($staticProperties as $key=>$value){
|
||||
if(strpos($value,'delivery') !== false){
|
||||
if(in_array($carrierId,explode(PPSetting::PP_SEPARATOR,Configuration::get($value)))){
|
||||
return str_replace(array('_delivery','_standard','_cod','_pickup_at_point'),'',$value);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* metoda sprawdzajaca czy podany id dostawcy posiada obsluge za pobraniem
|
||||
* @param $carierId
|
||||
* @return bool
|
||||
*/
|
||||
public static function isCarrierIsCod($carierId){
|
||||
return in_array($carierId, array_merge(
|
||||
explode(PPSetting::PP_SEPARATOR, Configuration::get(PPPackage::PP_POCZTEX_DELIVERY_COD)),
|
||||
explode(PPSetting::PP_SEPARATOR, Configuration::get(PPPackage::PP_POCZTEX_PICKUP_AT_POINT_COD)),
|
||||
explode(PPSetting::PP_SEPARATOR, Configuration::get(PPPackage::PP_POCZTEX_48_DELIVERY_COD)),
|
||||
explode(PPSetting::PP_SEPARATOR, Configuration::get(PPPackage::PP_POCZTEX_48_PICKUP_AT_POINT_COD)),
|
||||
explode(PPSetting::PP_SEPARATOR, Configuration::get(PPPackage::PP_POCZTEX_2021_KURIER_DELIVERY_COD)),
|
||||
explode(PPSetting::PP_SEPARATOR, Configuration::get(PPPackage::PP_POCZTEX_2021_KURIER_PICKUP_AT_POINT_COD)),
|
||||
explode(PPSetting::PP_SEPARATOR, Configuration::get(PPPackage::PP_POCZTEX_2021_DZIS_DELIVERY_COD))
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* metoda zwracajaca roznice pomiedzy 2 datami
|
||||
* @param $date1
|
||||
* @param $date2
|
||||
* @return int
|
||||
*/
|
||||
public static function dateDiff($date1, $date2){
|
||||
$dateObj1 = new DateTime($date1);
|
||||
$dateObj2 = new DateTime($date2);
|
||||
$interval = $dateObj1->diff($dateObj2);
|
||||
|
||||
return (int)$interval->format('%r%a');
|
||||
}
|
||||
|
||||
/**
|
||||
* metoda zwracajaca table POST i GET
|
||||
* @return array
|
||||
*/
|
||||
public static function getAllValues()
|
||||
{
|
||||
return $_POST + $_GET;
|
||||
}
|
||||
|
||||
/**
|
||||
* metoda zwracaja bezpieczny string bez zbednych niebezpiecznych elementow
|
||||
* @param $text
|
||||
* @return string
|
||||
*/
|
||||
public static function safeString($text){
|
||||
return trim(preg_replace('/[^(\x20-\x7F)\x0A\x0D]*/','', $text));
|
||||
}
|
||||
|
||||
/**
|
||||
* metoda zwracajaca z textu tylko cyfry
|
||||
* @param $text
|
||||
* @return mixed
|
||||
*/
|
||||
public static function onlyNumbers($text){
|
||||
return preg_replace("/[^0-9]/", "",$text);
|
||||
}
|
||||
|
||||
/**
|
||||
* metoda zwracajaca kolejny numer do numeracji zbiorow
|
||||
* @return int
|
||||
*/
|
||||
public static function getNextNumberForOrderSet(){
|
||||
if(!Configuration::get(PPSetting::PP_COUNT_ORDER_SET) || Configuration::get(PPSetting::PP_COUNT_ORDER_SET_DATE) != date('Y-m-d')){
|
||||
return 1;
|
||||
}
|
||||
|
||||
return (int)Configuration::get(PPSetting::PP_COUNT_ORDER_SET) + 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* metoda zapamietujaca w ustawieniach numeracje zbiorow dla danej daty
|
||||
* @param $number
|
||||
*/
|
||||
public static function setNumberOrderSet($number){
|
||||
|
||||
Configuration::updateValue(PPSetting::PP_COUNT_ORDER_SET, $number);
|
||||
Configuration::updateValue(PPSetting::PP_COUNT_ORDER_SET_DATE, date('Y-m-d'));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ .'/../Log/ENadawcaErrorLogger.php';
|
||||
|
||||
/**
|
||||
* Klasa odpowiedzialna za przechwytywanie,obsługę błędów i wyjątków
|
||||
*/
|
||||
class ErrorHandler {
|
||||
|
||||
/**
|
||||
* Obiekt wyjątku
|
||||
* @var type
|
||||
*/
|
||||
public $exception;
|
||||
|
||||
/**
|
||||
* Obiekt do logowania błedów
|
||||
* @var type
|
||||
*/
|
||||
private $_logger = null;
|
||||
|
||||
/**
|
||||
* Konstruktor klasy, w którym tworzony jest obiekt do logowania błedów
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->_logger = new ENadawcaErrorLogger();
|
||||
}
|
||||
|
||||
/**
|
||||
* Metodą odpowiedzialna za rejsterowanie funkcji wyłapujących błedy
|
||||
*/
|
||||
public function register() {
|
||||
// ini_set('display_errors', false);
|
||||
set_exception_handler(array($this, 'handleException'));
|
||||
set_error_handler(array($this, 'handleError'));
|
||||
register_shutdown_function(array($this, 'handleFatalError'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiedziala na wyrejestrowanie fukcji wyłapujacych błedy
|
||||
*/
|
||||
public function unregister() {
|
||||
restore_error_handler();
|
||||
restore_exception_handler();
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiedzialna za logowanie błedów PHP
|
||||
* @param type $code
|
||||
* @param type $message
|
||||
* @param type $file
|
||||
* @param type $line
|
||||
* @return boolean
|
||||
* @throws Exception
|
||||
*/
|
||||
public function handleError($code, $message, $file, $line) {
|
||||
if ($code) {
|
||||
throw new Exception($message, $code);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiedzialna za logowanie wyjątków
|
||||
* @param type $exception
|
||||
*/
|
||||
public function handleException($exception) {
|
||||
$this->exception = $exception;
|
||||
$this->unregister();
|
||||
$this->_logger->logException($exception);
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiedzialna za logowanie błedów krytycznych PHP
|
||||
* @param type $exception
|
||||
*/
|
||||
public function handleFatalError() {
|
||||
$error = error_get_last();
|
||||
if(isset($error['message'])){
|
||||
$exception = new Exception($error['message']);
|
||||
$this->exception = $exception;
|
||||
$this->_logger->logException($exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
119
modules/pocztapolskaen/classes/enadawca/ENadawca.php
Normal file
119
modules/pocztapolskaen/classes/enadawca/ENadawca.php
Normal file
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
|
||||
require_once 'Exception/MissingResourceException.php';
|
||||
require_once 'Log/ENadawcaLogger.php';
|
||||
require_once 'Common/ErrorHandler.php';
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class ENadawca {
|
||||
|
||||
/**
|
||||
*
|
||||
* @var type
|
||||
*/
|
||||
private static $_instance = null;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var type
|
||||
*/
|
||||
private $_resources = array(
|
||||
'UrzedyNadania', 'Envelope', 'EnvelopeBuffor', 'Profil', 'Password', 'Kurier', 'Document', 'Shipment', 'PdfContent','Karta','JednostkaOrganizacyjna','Account'
|
||||
);
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function __construct() {
|
||||
$this->_registerAutoLoad();
|
||||
//$this->_registerErrorHandler();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public static function getInstance() {
|
||||
if (is_null(self::$_instance)) {
|
||||
self::$_instance = new ENadawca();
|
||||
}
|
||||
return self::$_instance;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param type $className
|
||||
* @return \className
|
||||
*/
|
||||
public function get($className) {
|
||||
$instance = self::getInstance();
|
||||
$instance->_checkResource($className);
|
||||
if (class_exists($className)) {
|
||||
$object = new $className();
|
||||
$object->init();
|
||||
return $object;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param type $className
|
||||
* @throws MissingResourceException
|
||||
*/
|
||||
protected function _checkResource($className) {
|
||||
if (!in_array($className, $this->_resources)) {
|
||||
throw new MissingResourceException('Resource `' . $className . '` nor exists. Available resources:' . implode(',', $this->_resources));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param type $name
|
||||
* @param type $arguments
|
||||
* @return type
|
||||
*/
|
||||
public static function __callStatic($name, $arguments) {
|
||||
return self::getInstance()->get($name);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param type $className
|
||||
* @return type
|
||||
*/
|
||||
protected function _autoload($className) {
|
||||
$path = $this->_getPath($className);
|
||||
if (!file_exists($path)) {
|
||||
return;
|
||||
}
|
||||
require_once $path;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param type $className
|
||||
* @return string
|
||||
*/
|
||||
protected function _getPath($className) {
|
||||
$path = dirname(__FILE__) . '/Resource/' . str_replace('_', '/', $className) . '.php';
|
||||
return $path;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected function _registerAutoload() {
|
||||
spl_autoload_register(array($this, '_autoload'));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected function _registerErrorHandler() {
|
||||
$this->_errorHandler = new ErrorHandler();
|
||||
$this->_errorHandler->register();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
require_once 'ENadawcaException.php';
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class ClientException extends ENadawcaException {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class ENadawcaException extends Exception {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class MissingResourceException extends RuntimeException {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Kalasa odpowiedzialana za logowanie błedów
|
||||
*/
|
||||
class ENadawcaErrorLogger extends ENadawcaLogger{
|
||||
/**
|
||||
* Nazwa pliku z błędami
|
||||
* @var type
|
||||
*/
|
||||
protected $_logfile = 'error';
|
||||
}
|
||||
110
modules/pocztapolskaen/classes/enadawca/Log/ENadawcaLogger.php
Normal file
110
modules/pocztapolskaen/classes/enadawca/Log/ENadawcaLogger.php
Normal file
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class ENadawcaLogger {
|
||||
|
||||
/**
|
||||
* Nanzwa pliku
|
||||
* @var type
|
||||
*/
|
||||
protected $_logfile = 'debug';
|
||||
|
||||
/**
|
||||
* Rozszerzenie pliku
|
||||
* @var type
|
||||
*/
|
||||
protected $_ext = '.log';
|
||||
|
||||
/**
|
||||
* Maksymalna wielkość pliku
|
||||
* @var type
|
||||
*/
|
||||
protected $_logSize = '10MB';
|
||||
|
||||
/**
|
||||
* Uchwyt do pliku
|
||||
* @var type
|
||||
*/
|
||||
protected $_fileHandle = false;
|
||||
|
||||
/**
|
||||
* Konstruktor klasy
|
||||
* @param type $logfile
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiedzilna zatworzenie,usuwanie pliku log
|
||||
*/
|
||||
public function init() {
|
||||
$this->full_log_file = __DIR__ . '/../logs/' . $this->_logfile . $this->_ext;
|
||||
if (!file_exists($this->full_log_file)) {
|
||||
@touch($this->full_log_file);
|
||||
}
|
||||
$this->_removeLogFile();
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiedzialna za zapis komunikatu do pliku
|
||||
* @param type $message
|
||||
* @return type
|
||||
*/
|
||||
public function log($message, $extras = array()) {
|
||||
if (!file_exists($this->full_log_file)) {
|
||||
return;
|
||||
}
|
||||
if (!$this->_fileHandle) {
|
||||
$this->_fileHandle = fopen($this->full_log_file, 'a');
|
||||
}
|
||||
if (is_array($message) && count($message) == 1) {
|
||||
$message = array_shift($message);
|
||||
}
|
||||
if (is_array($message)) {
|
||||
$message = print_r($message, true);
|
||||
}
|
||||
if (!empty($extras)) {
|
||||
$message .= ' ' . print_r($extras, true);
|
||||
}
|
||||
fwrite($this->_fileHandle, strftime('%c') . ' [' . getmypid() . '] ' . $message . "\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiedzialna za logowanie wyjątków
|
||||
* @param type $exception
|
||||
*/
|
||||
public function logException($exception) {
|
||||
$this->log($exception);
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiedzialna za usuwanie pliku jesli przekroczony dopuszczalny rozmiar pliku
|
||||
* @return type
|
||||
*/
|
||||
protected function _removeLogFile() {
|
||||
if (!file_exists($this->full_log_file) || empty($this->_logSize)) {
|
||||
return false;
|
||||
}
|
||||
$megs = substr($this->_logSize, 0, strlen($this->_logSize) - 2);
|
||||
$rollAt = (int) $megs * 1024 * 1024;
|
||||
if (filesize($this->full_log_file) >= $rollAt) {
|
||||
if (file_exists($this->full_log_file)) {
|
||||
unlink($this->full_log_file);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* metoda wywolywana podczas usuwania obiektu
|
||||
*/
|
||||
public function __destruct() {
|
||||
if ($this->_fileHandle) {
|
||||
fclose($this->_fileHandle);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
68
modules/pocztapolskaen/classes/enadawca/README
Normal file
68
modules/pocztapolskaen/classes/enadawca/README
Normal file
@@ -0,0 +1,68 @@
|
||||
###########################################################################################################################################################
|
||||
$shipment = ENadawca::Shipment();
|
||||
$adres = Adres::get(
|
||||
array(
|
||||
'nazwa' => 'test',
|
||||
'nazwa2' => 'test',
|
||||
'ulica' => 'test',
|
||||
'numerDomu' => 'test',
|
||||
'numerLokalu' => 'test',
|
||||
'miejscowosc' => 'test',
|
||||
'kodPocztowy' => '21030',
|
||||
'kraj' => 'test',
|
||||
'telefon' => 'test',
|
||||
'email' => 'test',
|
||||
'mobile' => 'test',
|
||||
'osobaKontaktowa' => 'test',
|
||||
'email' => 'test@test.pl',
|
||||
'nip' => 'test',
|
||||
)
|
||||
);
|
||||
$shipment->addPaczkaPocztowa($adres, ShipmentCategory::EKONOMICZNA, Gabaryt::A, 1230, 1, 1);
|
||||
$shipment->add();
|
||||
###########################################################################################################################################################
|
||||
ENadawca::EnvelopeBuffor()->get();
|
||||
ENadawca::EnvelopeBuffor()->getList();
|
||||
###########################################################################################################################################################
|
||||
ENadawca::Profil()->create(
|
||||
'Test sp. z o.o.',
|
||||
'ul. Test',
|
||||
14,
|
||||
18,
|
||||
'LUBLIN',
|
||||
20023,
|
||||
'Polska',
|
||||
'test'
|
||||
);
|
||||
###########################################################################################################################################################
|
||||
ENadawca::Profil()->get();
|
||||
###########################################################################################################################################################
|
||||
ENadawca::EnvelopeBuffor()->getList();
|
||||
###########################################################################################################################################################
|
||||
ENadawca::EnvelopeBuffor()->create(
|
||||
'2018-07-09',
|
||||
260628,
|
||||
true,
|
||||
'test'
|
||||
);
|
||||
###########################################################################################################################################################
|
||||
ENadawca::Envelope()->get('2018-01-01','2019-01-01')
|
||||
###########################################################################################################################################################
|
||||
ENadawca::Envelope()->clearByGuids(array('1','12'))
|
||||
###########################################################################################################################################################
|
||||
ENadawca::Envelope()->send('743378');
|
||||
ENadawca::Envelope()->send();
|
||||
###########################################################################################################################################################
|
||||
$envelope = ENadawca::Envelope();
|
||||
$envelope->get('2018-01-01','2019-01-01'));
|
||||
$envelope->getStatus('334243'));
|
||||
$envelope->getContentShort('334243'));
|
||||
$envelope->getContentFull('334243'));
|
||||
###########################################################################################################################################################
|
||||
$shipment = ENadawca::Shipment();
|
||||
$shipment->move();
|
||||
###########################################################################################################################################################
|
||||
ENadawca::PdfContent()->getBlankietPobraniaByGuids(12222)
|
||||
###########################################################################################################################################################
|
||||
ENadawca::Password()->change('qwerty123');
|
||||
###########################################################################################################################################################
|
||||
44
modules/pocztapolskaen/classes/enadawca/Resource/Account.php
Normal file
44
modules/pocztapolskaen/classes/enadawca/Resource/Account.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
class Account extends Resource{
|
||||
/**
|
||||
* metoda pobierajaca dane o profilach uzytkownika API
|
||||
* @return array
|
||||
*/
|
||||
public function get(){
|
||||
$result = $this->_callWebservice ('getAccountList');
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* metoda odpowiedzialna za pobranie z API informacji o profilu
|
||||
* @return array
|
||||
*/
|
||||
public function getMyAccount(){
|
||||
$result = $this->_callWebService('getAccountList');
|
||||
|
||||
if(isset($result['account'])){
|
||||
if(isset($result['account']['domyslnyProfil'])){
|
||||
return $result['account'];
|
||||
}
|
||||
foreach($result['account'] as $key=>$account){
|
||||
if($account['userName'] == Configuration::get(PPSetting::PP_USER) ){
|
||||
return $account;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* metoda sprawdzajaca czy dany uzytkownika API prawidlowo jest zalogowany
|
||||
* @return bool
|
||||
*/
|
||||
public function hello(){
|
||||
$params['in'] = 'hello';
|
||||
$result = $this->_callWebService('hello',$params);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
101
modules/pocztapolskaen/classes/enadawca/Resource/Envelope.php
Normal file
101
modules/pocztapolskaen/classes/enadawca/Resource/Envelope.php
Normal file
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Klasa odpowidająca zarządzanie wysyłką przesyłek
|
||||
*/
|
||||
class Envelope extends Resource {
|
||||
|
||||
/**
|
||||
* Metoda czyszcząca pakiet z przesyłek. Usuwa bufor wraz ze wszystkimi informacjami o przesyłkach, które zostały dodane
|
||||
* @return array
|
||||
*/
|
||||
public function clear($idBuffor = '') {
|
||||
$params = array();
|
||||
if (!empty($idBuffor)) {
|
||||
$params['idBufor'] = $idBuffor;
|
||||
}
|
||||
$result = $this->_callWebservice('clearEnvelope', $params);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda pozwala na wybiórcze usunięcie przesyłek z bufora. Parametrem wejściowym jest tablica guidów przesyłek do usunięcia
|
||||
* @param array $guid
|
||||
* @return array
|
||||
*/
|
||||
public function clearByGuids($guid,$idBuffor = '') {
|
||||
$params = array('guid' => $guid);
|
||||
if (!empty($idBuffor)) {
|
||||
$params['idBufor'] = $idBuffor;
|
||||
}
|
||||
$result = $this->_callWebservice('clearEnvelopeByGuids', $params);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda pozwalająca wysłać wszystkie przesyłki
|
||||
* @param type $urzadNadania
|
||||
* @param type $idBuffor
|
||||
* @return type
|
||||
*/
|
||||
public function send($urzadNadania, $idBuffor = '') {
|
||||
$params = array(
|
||||
'urzadNadania' => $urzadNadania,
|
||||
);
|
||||
if (!empty($idBuffor)) {
|
||||
$params['idBufor'] = $idBuffor;
|
||||
}
|
||||
$result = $this->_callWebservice('sendEnvelope', $params);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda pozwala pobrać status przekazanego pakietu przesyłek
|
||||
* @param integer $idEnvelope
|
||||
* @return array
|
||||
*/
|
||||
public function getStatus($idEnvelope) {
|
||||
$result = $this->_callWebservice('getEnvelopeStatus', array('idEnvelope' => $idEnvelope));
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda pozwalająca pobrać informacje zwrotne o nadanych przesyłkach w wersji skróconej.
|
||||
* @param type $idEnvelope
|
||||
* @return type
|
||||
*/
|
||||
public function getContentShort($idEnvelope) {
|
||||
$result = $this->_callWebservice('getEnvelopeContentShort', array('idEnvelope' => $idEnvelope));
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda pozwalająca pobrać informacje zwrotne o nadanych przesyłkach w wersji pełnej.
|
||||
* @param type $idEnvelope
|
||||
* @return type
|
||||
*/
|
||||
public function getContentFull($idEnvelope) {
|
||||
$result = $this->_callWebservice('getEnvelopeContentFull', array('idEnvelope' => $idEnvelope));
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda pozwalająca pobrać listę pakietów, które są dostępne do pobrania wraz ze statusami
|
||||
* @param type $startDate
|
||||
* @param type $endDate
|
||||
* @return type
|
||||
*/
|
||||
public function get($startDate, $endDate) {
|
||||
$result = $this->_callWebservice('getEnvelopeList', array('startDate' => $startDate, 'endDate' => $endDate));
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getStatuses() {
|
||||
$arr = array(
|
||||
'wyslany' => 'Wysłany',
|
||||
'niewyslany'=>'Niewysłany'
|
||||
);
|
||||
return $arr;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Klasa odpowiadająca za zarządzanie danymi w buforze
|
||||
*/
|
||||
class EnvelopeBuffor extends Resource {
|
||||
|
||||
/**
|
||||
* Metoda pozwala pobrać informacje o przesyłkach znajdujących się w buforze
|
||||
* @param type $idBufor
|
||||
* @return array
|
||||
*/
|
||||
public function get($idBufor = '') {
|
||||
$params = array();
|
||||
if (!empty($idBufor)) {
|
||||
$params = array('idBufor' => $idBufor);
|
||||
}
|
||||
$result = $this->_callWebservice('getEnvelopeBufor', $params);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda pozwalająca pobrać listę buforów zdefiniowanych poprzez web api
|
||||
* @return array
|
||||
*/
|
||||
public function getList() {
|
||||
$result = $this->_callWebservice('getEnvelopeBuforList');
|
||||
if (!$this->hasErrors()) {
|
||||
if (isset($result['bufor']['idBufor'])) {
|
||||
$result = array($result['bufor']);
|
||||
} else {
|
||||
$result = array_shift($result);
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda umożliwiająca zmianę danych bufora, w tym daty nadania czy urzędu nadania
|
||||
* @param type $idBufor
|
||||
* @param type $dataNadania
|
||||
* @param type $urzadNadania
|
||||
* @param type $active
|
||||
* @param type $opis
|
||||
* @return array
|
||||
*/
|
||||
public function update($idBufor, $dataNadania, $urzadNadania, $opis) {
|
||||
$params = array(
|
||||
'idBufor' => $idBufor,
|
||||
'dataNadania' => $dataNadania,
|
||||
'urzadNadania' => $urzadNadania,
|
||||
'opis' => $opis,
|
||||
);
|
||||
$result = $this->_callWebservice('updateEnvelopeBufor', array('bufor' => $params));
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda umożliwiająca stworzenie nowego bufora. Możliwe jest stworzenie w jednym wywołaniu kilku buforów.
|
||||
* @param type $dataNadania
|
||||
* @param type $urzadNadania
|
||||
* @param type $active
|
||||
* @param type $opis
|
||||
* @return type
|
||||
*/
|
||||
public function create($dataNadania, $urzadNadania, $opis) {
|
||||
$params = array(
|
||||
'dataNadania' => $dataNadania,
|
||||
'urzadNadania' => $urzadNadania,
|
||||
'active' => true,
|
||||
'opis' => $opis,
|
||||
);
|
||||
$result = $this->_callWebservice('createEnvelopeBufor', array('bufor' => $params));
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function clear($idBuffor) {
|
||||
$result = $this->_callWebservice('clearEnvelope', array('idBufor' => $idBuffor));
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Klasa odpowiadajaca za zarzadzanie jednostkami ograzniacyjnymi
|
||||
*/
|
||||
class JednostkaOrganizacyjna extends Resource {
|
||||
|
||||
/**
|
||||
* Metoda pozwala pobrać informacje o jednostce organizacyjnej
|
||||
* @return array
|
||||
*/
|
||||
public function get() {
|
||||
$result = $this->_callWebservice ('getJednostkaOrganizacyjna');
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
49
modules/pocztapolskaen/classes/enadawca/Resource/Karta.php
Normal file
49
modules/pocztapolskaen/classes/enadawca/Resource/Karta.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Klasa odpowiadajaca za zarzadzanie kartami umowy
|
||||
*/
|
||||
class Karta extends Resource {
|
||||
|
||||
/**
|
||||
* Metoda pozwala pobrać wszystkie karty umowy
|
||||
* @return array
|
||||
*/
|
||||
public function getList() {
|
||||
$result = $this->_callWebservice ('getKarty');
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* metoda umozliwa pobranie informacji na temat wybranej karty
|
||||
* @param string $idKarty
|
||||
* @return array
|
||||
*/
|
||||
public function get($idKarty = ''){
|
||||
$result = $this->_callWebservice ('getKarty');
|
||||
if(isset($result['karta']['idKarta'])){
|
||||
$result['karta'] = array($result['karta']);
|
||||
}
|
||||
foreach($result['karta'] as $karta){
|
||||
if($karta['idKarta'] == $idKarty){
|
||||
return $karta;
|
||||
}
|
||||
}
|
||||
return $result['karta'];
|
||||
}
|
||||
|
||||
/**
|
||||
* metoda pozwalajaca umozliwienie domyslane karty dla uztykownika api
|
||||
* @param $idKarty
|
||||
* @return bool
|
||||
*/
|
||||
public function setDefault($idKarty){
|
||||
$result = false;
|
||||
if(!empty($idKarty)){
|
||||
$result = $this->_callWebservice('setAktywnaKarta',array('idKarta'=>$idKarty));
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
37
modules/pocztapolskaen/classes/enadawca/Resource/Kurier.php
Normal file
37
modules/pocztapolskaen/classes/enadawca/Resource/Kurier.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Klasa odpowiadająca za zamawianie kuriera
|
||||
*/
|
||||
class Kurier extends Resource {
|
||||
|
||||
/**
|
||||
* Metoda umożliwiająca zamówienie kuriera po odbiór przesyłek od klienta
|
||||
* @param type $oczekiwanaDataOdbioru
|
||||
* @param type $oczekiwanaGodzinaOdbioru
|
||||
* @param type $szacowanaIloscPrzeslek
|
||||
* @param type $szacowanaLacznaMasaPrzesylek
|
||||
* @param type $PotwierdzenieZamowieniaEmail
|
||||
* @param type $miejsceOdbioru
|
||||
* @param type $nadawca
|
||||
* @return type
|
||||
*/
|
||||
public function zamow($oczekiwanaDataOdbioru, $oczekiwanaGodzinaOdbioru, $szacowanaIloscPrzeslek, $szacowanaLacznaMasaPrzesylek, $PotwierdzenieZamowieniaEmail, $miejsceOdbioru = array(), $nadawca = array()) {
|
||||
$params = array(
|
||||
'oczekiwanaDataOdbioru' => $oczekiwanaDataOdbioru,
|
||||
'oczekiwanaGodzinaOdbioru' => $oczekiwanaGodzinaOdbioru,
|
||||
'szacowanaIloscPrzeslek' => $szacowanaIloscPrzeslek,
|
||||
'szacowanaLacznaMasaPrzesylek' => $szacowanaLacznaMasaPrzesylek,
|
||||
'PotwierdzenieZamowieniaEmail' => $PotwierdzenieZamowieniaEmail
|
||||
);
|
||||
if (!empty($miejsceOdbioru)) {
|
||||
$params['miejsceOdbioru'] = $miejsceOdbioru;
|
||||
}
|
||||
if (!empty($nadawca)) {
|
||||
$params['nadawca'] = $nadawca;
|
||||
}
|
||||
$result = $this->_callWebservice('zamowKuriera', $params);
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Klasa odpowiadajaca za zarzadzanie hasłem
|
||||
*/
|
||||
class Password extends Resource {
|
||||
|
||||
/**
|
||||
* Metoda pozwalająca na zmianę hasła dostępu do systemu EN.
|
||||
* @param type $newPassword
|
||||
* @return array
|
||||
*/
|
||||
public function change($newPassword) {
|
||||
$result = $this->_callWebservice ('changePassword', array('newPassword' => $newPassword));
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda pozwalająca pobrać czas ważności hasła
|
||||
* @return array
|
||||
*/
|
||||
public function getExpiredDate() {
|
||||
$result = $this->_callWebservice ('getPasswordExpiredDate');
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
145
modules/pocztapolskaen/classes/enadawca/Resource/PdfContent.php
Normal file
145
modules/pocztapolskaen/classes/enadawca/Resource/PdfContent.php
Normal file
@@ -0,0 +1,145 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Klasa odpowiadająca za generowanie wydruków w formacie PDF
|
||||
*/
|
||||
class PdfContent extends Resource {
|
||||
|
||||
var $_options = array('cache_wsdl' => WSDL_CACHE_NONE);
|
||||
|
||||
/**
|
||||
* Metoda umożliwia pobranie samego blankietu pobrania dla przesyłek z pobraniem dla zbiorów jeszcze nie wysłanych
|
||||
* @param type $guid
|
||||
* @param type $idBufor
|
||||
*/
|
||||
public function getBlankietPobraniaByGuids($guid, $idBufor = '') {
|
||||
$params = array('guid' => $guid);
|
||||
if (!empty($idBufor)) {
|
||||
$params['idBufor'] = $idBufor;
|
||||
}
|
||||
$result = $this->_callWebservice('getBlankietPobraniaByGuids', $params);
|
||||
if (!$this->hasErrors()) {
|
||||
if (isset($result['content']['pdfContent'])) {
|
||||
return $result['content']['pdfContent'];
|
||||
} else {
|
||||
if (is_array($result['content'])) {
|
||||
$content = '';
|
||||
foreach ($result['content'] as $c) {
|
||||
$content .= $c['pdfContent'];
|
||||
}
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda po zwalająca pobrać wydruk Książki Nadawczej. Wydruk prezentowany jest w formacie PDF
|
||||
* @param type $idEnvelope - zwracane przez send z obiektu Envelope
|
||||
* @param boolean $includeNierejestrowane
|
||||
*/
|
||||
public function getOutboxBook($idEnvelope, $includeNierejestrowane = true) {
|
||||
$result = $this->_callWebservice('getOutboxBook', array('idEnvelope' => $idEnvelope, 'includeNierejestrowane' => $includeNierejestrowane));
|
||||
if (isset($result['pdfContent'])) {
|
||||
return $result['pdfContent'];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda pozwalająca pobrać wydruk zestawiania dla Firmowej Poczty. Wydruk jest w formacie PDF
|
||||
* @param type $idEnvelope - zwracane przez send z obiektu Envelope
|
||||
*/
|
||||
public function getFirmowaPocztaBook($idEnvelope) {
|
||||
$result = $this->_callWebservice('getFirmowaPocztaBook', array('idEnvelope' => $idEnvelope));
|
||||
if (isset($result['pdfContent'])) {
|
||||
return $result['pdfContent'];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda pozwalająca pobrać nalepki adresowe. Wydruk jest w formacie PDF.
|
||||
* @param type $idEnvelope - zwracane przez send z obiektu Envelope
|
||||
*/
|
||||
public function getAddresLabel($idEnvelope,$guid='') {
|
||||
$result = $this->_callWebservice('getAddressLabel', array('idEnvelope' => $idEnvelope));
|
||||
if (isset($result['content']['pdfContent'])) {
|
||||
return $result['content']['pdfContent'];
|
||||
}
|
||||
if(!empty($guid)&&isset($result['content'])&&is_array($result['content'])){
|
||||
foreach($result['content'] as $content){
|
||||
if($content['guid'] == $guid){
|
||||
return $content['pdfContent'];
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda umożliwia pobranie kompletu nalepek adresowych w jednym pliku w formacie pdf.
|
||||
* Pobranie nalepek jest możliwe po wywołaniu metody send z obiektu Envelope
|
||||
* @param type $idEnvelope - zwracane przez send z obiektu Envelope
|
||||
*/
|
||||
public function getAddresLabelCompact($idEnvelope) {
|
||||
$result = $this->_callWebservice('getAddresLabelCompact', array('idEnvelope' => $idEnvelope));
|
||||
if (isset($result['pdfContent'])) {
|
||||
return $result['pdfContent'];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda umożliwia pobranie nalepek adresowych w jednym pliku w formacie pdf dla przekazanego zakresu guidów przesyłek
|
||||
* @param type $guid
|
||||
* @param type $idBufor
|
||||
*/
|
||||
public function getAddresLabelByGuid($guid, $idBufor = '') {
|
||||
$params = array('guid' => $guid);
|
||||
if (!empty($idBufor)) {
|
||||
$params['idBufor'] = $idBufor;
|
||||
}
|
||||
$result = $this->_callWebservice('getAddresLabelByGuid', $params);
|
||||
if (isset($result['content']['pdfContent'])) {
|
||||
return $result['content']['pdfContent'];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda umożliwia pobranie nalepek adresowych w jednym pliku w formacie pdf dla przekazanego zakresu guidów przesyłek
|
||||
* @param type $guid
|
||||
* @param type $idBufor
|
||||
*/
|
||||
public function getAddresLabelByGuidCompact($guid, $idBufor = '') {
|
||||
$params = array('guid' => $guid);
|
||||
if (!empty($idBufor)) {
|
||||
$params['idBufor'] = $idBufor;
|
||||
}
|
||||
$result = $this->_callWebservice('getAddresLabelByGuidCompact', $params);
|
||||
if (isset($result['pdfContent'])) {
|
||||
return $result['pdfContent'];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda umożliwia pobranie nalepek adresowych w jednym pliku w formacie pdf dla przekazanego zakresu guidów przesyłek
|
||||
* @param type $guid
|
||||
*/
|
||||
public function getPrintForParcel($guid) {
|
||||
$params = array('guid' => $guid);
|
||||
//$type = new PrintType();
|
||||
$params['type'] = array('kind'=>'ADDRESS_LABEL','method'=>'ALL_PARCELS_IN_ONE_FILE');
|
||||
|
||||
$result = $this->_callWebservice('getPrintForParcel', $params);
|
||||
|
||||
if (isset($result['printResult']['print'])) {
|
||||
return $result['printResult']['print'];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
101
modules/pocztapolskaen/classes/enadawca/Resource/Profil.php
Normal file
101
modules/pocztapolskaen/classes/enadawca/Resource/Profil.php
Normal file
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Klasa odpowiadajaca za zarzadzanie profilami nadawcy
|
||||
*/
|
||||
class Profil extends Resource {
|
||||
|
||||
/**
|
||||
* Metoda umożliwia pobranie listy dostępnych profili nadawcy
|
||||
* @return array
|
||||
*/
|
||||
public function getList() {
|
||||
$result = $this->_callWebservice ('getProfilList');
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* metoda zwracajaca list profili dla zwrotu dokumentow
|
||||
* @return array
|
||||
*/
|
||||
public function getReturnDocumentsProfileList() {
|
||||
$result = $this->_callWebservice ('getReturnDocumentsProfileList');
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda umożliwia pobranie profilu nadawcy
|
||||
* @return array
|
||||
*/
|
||||
public function get($idProfil = '') {
|
||||
$result = $this->_callWebservice ('getProfilList');
|
||||
if (!empty($result) && isset($result['profil'])) {
|
||||
return array_shift($result['profil']);
|
||||
}
|
||||
if(!empty($idProfil)&&!empty($result) && isset($result['profil'])){
|
||||
foreach($result['profil'] as $v){
|
||||
if(isset($v['idProfil']) && $v['idProfil'] === $idProfil){
|
||||
return $v;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda umożliwia utworzenie nowego profilu nadawcy
|
||||
* @param type $nazwa
|
||||
* @param type $ulica
|
||||
* @param type $numerDomu
|
||||
* @param type $numerLokalu
|
||||
* @param type $miejscowosc
|
||||
* @param type $kodPocztowy
|
||||
* @param type $kraj
|
||||
* @param type $nazwSkrocona
|
||||
* @return array
|
||||
*/
|
||||
public function create($nazwa, $ulica, $numerDomu, $numerLokalu, $miejscowosc, $kodPocztowy, $kraj, $nazwSkrocona) {
|
||||
$params = array(
|
||||
'nazwa' => $nazwa,
|
||||
'ulica' => $ulica,
|
||||
'numerDomu' => $numerDomu,
|
||||
'numerLokalu' => $numerLokalu,
|
||||
'miejscowosc' => $miejscowosc,
|
||||
'kodPocztowy' => $kodPocztowy,
|
||||
'kraj' => $kraj,
|
||||
'nazwaSkrocona' => $nazwSkrocona
|
||||
);
|
||||
$result = $this->_callWebservice ('createProfil', array('profil' => $params));
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda umożliwia zmianę profilu nadawcy
|
||||
* @param type $idProfil
|
||||
* @param type $nazwa
|
||||
* @param type $ulica
|
||||
* @param type $numerDomu
|
||||
* @param type $numerLokalu
|
||||
* @param type $miejscowosc
|
||||
* @param type $kodPocztowy
|
||||
* @param type $kraj
|
||||
* @param type $nazwSkrocona
|
||||
* @return array
|
||||
*/
|
||||
public function update($idProfil, $nazwa, $ulica, $numerDomu, $numerLokalu, $miejscowosc, $kodPocztowy, $kraj, $nazwSkrocona) {
|
||||
$params = array(
|
||||
'nazwa' => $nazwa,
|
||||
'ulica' => $ulica,
|
||||
'numerDomu' => $numerDomu,
|
||||
'numerLokalu' => $numerLokalu,
|
||||
'miejscowosc' => $miejscowosc,
|
||||
'kodPocztowy' => $kodPocztowy,
|
||||
'kraj' => $kraj,
|
||||
'idProfil' => $idProfil,
|
||||
'nazwaSkrocona' => $nazwSkrocona
|
||||
);
|
||||
$result = $this->_callWebservice ('updatePrrofil', array('profil' => $params));
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
719
modules/pocztapolskaen/classes/enadawca/Resource/Resource.php
Normal file
719
modules/pocztapolskaen/classes/enadawca/Resource/Resource.php
Normal file
@@ -0,0 +1,719 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ .'/../Soap/Client.php';
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
abstract class Resource {
|
||||
|
||||
/**
|
||||
*
|
||||
* @var type
|
||||
*/
|
||||
private static $_webService = null;
|
||||
|
||||
private static $api_url = "https://e-nadawca.poczta-polska.pl/websrv/labs.wsdl";
|
||||
|
||||
private static $api_url_endpoint = "https://e-nadawca.poczta-polska.pl/websrv/labs.php";
|
||||
|
||||
public static $test_api_url = "https://en-testwebapi2.poczta-polska.pl/websrv/labs.wsdl";
|
||||
|
||||
public static $test_api_url_endpoint = "https://en-testwebapi2.poczta-polska.pl/websrv/labs.php";
|
||||
|
||||
/**
|
||||
*
|
||||
* @var type
|
||||
*/
|
||||
private $_url = '';
|
||||
|
||||
/**
|
||||
*
|
||||
* @var type
|
||||
*/
|
||||
private $_username = '';
|
||||
|
||||
/**
|
||||
*
|
||||
* @var type
|
||||
*/
|
||||
private $_password = '';
|
||||
|
||||
/**
|
||||
*
|
||||
* @var type
|
||||
*/
|
||||
private $_location = '';
|
||||
|
||||
/**
|
||||
*
|
||||
* @var type
|
||||
*/
|
||||
private $_debug = false;
|
||||
|
||||
protected $_options = array();
|
||||
|
||||
/**
|
||||
*
|
||||
* @var type
|
||||
*/
|
||||
protected $_errorHandler = null;
|
||||
private $_logger = null;
|
||||
private $_errors = array();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param type $class
|
||||
* @return type
|
||||
*/
|
||||
public static function autoload($class) {
|
||||
$path = dirname(__FILE__) . '/' . str_replace('_', '/', $class) . '.php';
|
||||
if (!file_exists($path)) {
|
||||
return;
|
||||
}
|
||||
require_once $path;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
protected function _getWebservice() {
|
||||
if (is_null(self::$_webService)) {
|
||||
self::$_webService = new Client($this->_url, $this->_username, $this->_password, $this->_location, $this->_debug, $this->_options);
|
||||
}
|
||||
return self::$_webService;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function init() {
|
||||
$this->_setConnectionParams();
|
||||
$this->_logger = new ENadawcaErrorLogger();
|
||||
}
|
||||
|
||||
public function resetWebservice(){
|
||||
self::$_webService = null;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function _setConnectionParams() {
|
||||
$this->_url = Configuration::get(PPSetting::PP_TEST_URL)?self::$test_api_url:self::$api_url;
|
||||
$this->_location = Configuration::get(PPSetting::PP_TEST_URL)?self::$test_api_url_endpoint:self::$api_url_endpoint;
|
||||
$this->_username = Configuration::get(PPSetting::PP_USER);
|
||||
$this->_password = Configuration::get(PPSetting::PP_PASSWORD);
|
||||
}
|
||||
|
||||
protected function _callWebService($function_name, $parameters = array(), array $options = null) {
|
||||
try {
|
||||
$this->_errors = array();
|
||||
return $this->_getWebservice()->call($function_name, $parameters, $options);
|
||||
} catch (ClientException $e) {
|
||||
$this->_errors[] = Translate::getAdminTranslation('Wystąpił błąd komunikacji z Elektronicznym Nadawcą');
|
||||
$this->_logger->logException($e);
|
||||
} catch (ENadawcaException $e) {
|
||||
$this->_errors[] = Translate::getAdminTranslation($e->getMessage());
|
||||
$this->_logger->logException($e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getErrors() {
|
||||
$errors = $this->_errors;
|
||||
return $errors;
|
||||
}
|
||||
|
||||
public function hasErrors() {
|
||||
return !empty($this->_errors);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function createGuid() {
|
||||
mt_srand((double) microtime() * 10000);
|
||||
$charid = strtoupper(md5(uniqid(rand(), true)));
|
||||
$retval = substr($charid, 0, 32);
|
||||
return $retval;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
abstract class ShipmentCategory {
|
||||
|
||||
const EKONOMICZNA = 'EKONOMICZNA';
|
||||
const PRIORYTETOWA = 'PRIORYTETOWA';
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
abstract class Gabaryt {
|
||||
|
||||
const A = 'GABARYT_A';
|
||||
const B = 'GABARYT_B';
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class paczkaPocztowaPLUSType {
|
||||
|
||||
public $posteRestante; // boolean
|
||||
public $iloscPotwierdzenOdbioru; // iloscPotwierdzenOdbioruType
|
||||
public $kategoria; // kategoriaType
|
||||
public $gabaryt; // gabarytType
|
||||
public $wartosc; // wartoscType
|
||||
public $masa; // masaType
|
||||
public $zwrotDoslanie; // boolean
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class przesylkaPobraniowaType {
|
||||
|
||||
public $pobranie; // pobranieType
|
||||
public $posteRestante; // boolean
|
||||
public $iloscPotwierdzenOdbioru; // iloscPotwierdzenOdbioruType
|
||||
public $kategoria; // kategoriaType
|
||||
public $gabaryt; // gabarytType
|
||||
public $ostroznie; // boolean
|
||||
public $wartosc; // wartoscType
|
||||
public $masa; // masaType
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class przesylkaNaWarunkachSzczegolnychType {
|
||||
|
||||
public $posteRestante; // boolean
|
||||
public $iloscPotwierdzenOdbioru; // iloscPotwierdzenOdbioruType
|
||||
public $kategoria; // kategoriaType
|
||||
public $wartosc; // wartoscType
|
||||
public $masa; // masaType
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class przesylkaPoleconaKrajowaType {
|
||||
|
||||
public $epo; // EPOType
|
||||
public $zasadySpecjalne; // zasadySpecjalneEnum
|
||||
public $posteRestante; // boolean
|
||||
public $iloscPotwierdzenOdbioru; // iloscPotwierdzenOdbioruType
|
||||
public $kategoria; // kategoriaType
|
||||
public $gabaryt; // gabarytType
|
||||
public $format;
|
||||
public $masa; // masaType
|
||||
public $egzemplarzBiblioteczny; // boolean
|
||||
public $dlaOciemnialych; // boolean
|
||||
public $obszarMiasto; // boolean
|
||||
public $miejscowa; // boolean
|
||||
public $opis;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class przesylkaHandlowaType {
|
||||
|
||||
public $posteRestante; // boolean
|
||||
public $masa; // masaType
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class przesylkaListowaZadeklarowanaWartoscType {
|
||||
|
||||
public $posteRestante; // boolean
|
||||
public $wartosc; // wartoscType
|
||||
public $iloscPotwierdzenOdbioru; // iloscPotwierdzenOdbioruType
|
||||
public $kategoria; // kategoriaType
|
||||
public $gabaryt; // gabarytType
|
||||
public $masa; // masaType
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class przesylkaFullType {
|
||||
|
||||
public $przesylkaShort; // przesylkaShortType
|
||||
public $przesylkaFull; // przesylkaType
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class przesylkaZagranicznaType {
|
||||
|
||||
public $posteRestante; // boolean
|
||||
public $kategoria; // kategoriaType
|
||||
public $masa; // masaType
|
||||
public $ekspres; // boolean
|
||||
public $kraj; // string
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class przesylkaRejestrowanaType {
|
||||
|
||||
public $adres; // adresType
|
||||
public $nadawca; // adresType
|
||||
public $relatedToAllegro; // relatedToAllegroType
|
||||
public $numerNadania; // numerNadaniaType
|
||||
public $sygnatura; // sygnaturaType
|
||||
public $terminSprawy; // terminType
|
||||
public $rodzaj; // rodzajType
|
||||
public $weryfikacjaPlatnosci; // boolean
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class przesylkaNieRejestrowanaType {
|
||||
|
||||
public $ilosc; // anonymous97
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class paczkaPocztowaType {
|
||||
|
||||
public $epo; // EPOType
|
||||
public $zasadySpecjalne; // zasadySpecjalneEnum
|
||||
public $posteRestante; // boolean
|
||||
public $iloscPotwierdzenOdbioru; // iloscPotwierdzenOdbioruType
|
||||
public $kategoria; // kategoriaType
|
||||
public $gabaryt; // gabarytType
|
||||
public $masa; // masaType
|
||||
public $wartosc; // wartoscType
|
||||
public $zwrotDoslanie; // boolean
|
||||
public $egzemplarzBiblioteczny; // boolean
|
||||
public $dlaOciemnialych; // boolean
|
||||
public $opis;//string
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class Adres {
|
||||
|
||||
public $nazwa;
|
||||
public $nazwa2;
|
||||
public $ulica;
|
||||
public $numerDomu;
|
||||
public $numerLokalu;
|
||||
public $miejscowosc;
|
||||
public $kodPocztowy;
|
||||
public $kraj;
|
||||
public $telefon;
|
||||
public $email;
|
||||
public $mobile;
|
||||
public $osobaKontaktowa;
|
||||
public $nip;
|
||||
|
||||
public static function get($params = array()) {
|
||||
$self = new self;
|
||||
foreach ($params as $k => $v) {
|
||||
$self->$k = $v;
|
||||
}
|
||||
return (array) $self;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class Pobranie {
|
||||
|
||||
public $sposobPobrania;
|
||||
public $kwotaPobrania;
|
||||
public $nrb;
|
||||
public $tytulem;
|
||||
public $sprawdzenieZawartosciPrzesylkiPrzezOdbiorce;
|
||||
|
||||
const SPOSOB_POBRANIA_PRZEKAZ = 'PRZEKAZ';
|
||||
const SPOSOB_POBRANIA_RACHUNEK_BANKOWY = 'RACHUNEK_BANKOWY';
|
||||
|
||||
}
|
||||
|
||||
class Ubezpieczenie {
|
||||
|
||||
public $rodzaj;
|
||||
public $kwota;
|
||||
|
||||
const RODZAJ_STANDARD = 'STANDARD';
|
||||
const RODZAJ_PRECJOZA = 'PRECJOZA';
|
||||
|
||||
}
|
||||
|
||||
class globalExpresType {
|
||||
|
||||
public $ubezpieczenie; // ubezpieczenieType
|
||||
public $potwierdzenieDoreczenia; // potwierdzenieDoreczeniaType
|
||||
public $masa; // masaType
|
||||
public $posteRestante; // boolean
|
||||
public $zawartosc; // string
|
||||
public $kategoria; // kategoriaType
|
||||
public $numerPrzesylkiKlienta; // string
|
||||
|
||||
}
|
||||
|
||||
class przesylkaFirmowaPoleconaType {
|
||||
|
||||
public $epo; // EPOType
|
||||
public $zasadySpecjalne; // zasadySpecjalneEnum
|
||||
public $posteRestante; // boolean
|
||||
public $iloscPotwierdzenOdbioru; // iloscPotwierdzenOdbioruType
|
||||
public $masa; // masaType
|
||||
public $miejscowa; // boolean
|
||||
public $obszarMiasto; // boolean
|
||||
public $kategoria; // kategoriaType
|
||||
public $gabaryt; // gabarytType
|
||||
public $opis;
|
||||
|
||||
}
|
||||
|
||||
class EMSType {
|
||||
|
||||
public $ubezpieczenie; // ubezpieczenieType
|
||||
public $deklaracjaCelna; // deklaracjaCelnaType
|
||||
public $potwierdzenieDoreczenia; //potwierdzenieDoreczeniaType
|
||||
public $typOpakowania; // EMSTypOpakowaniaType
|
||||
public $masa; // masaType
|
||||
public $zalaczoneDokumenty; // boolean
|
||||
public $opis;
|
||||
|
||||
}
|
||||
|
||||
class paczkaZagranicznaType {
|
||||
|
||||
public $zwrot; // zwrotType
|
||||
public $deklaracjaCelna; // deklaracjaCelnaType
|
||||
public $posteRestante; // boolean
|
||||
public $masa; // masaType
|
||||
public $wartosc; // wartoscType
|
||||
public $kategoria; // kategoriaType
|
||||
public $iloscPotwierdzenOdbioru; // iloscPotwierdzenOdbioruType
|
||||
public $utrudnionaManipulacja; // boolean
|
||||
public $ekspres; // boolean
|
||||
public $numerReferencyjnyCelny; // string
|
||||
public $opis;
|
||||
|
||||
}
|
||||
|
||||
class przesylkaPoleconaZagranicznaType {
|
||||
|
||||
public $posteRestante;
|
||||
public $kategoria;
|
||||
public $masa;
|
||||
public $iloscPotwierdzenOdbioru;
|
||||
public $ekspres;
|
||||
public $opis;
|
||||
|
||||
}
|
||||
|
||||
class PotwierdzenieDoreczenia {
|
||||
|
||||
public $sposob; // sposobDoreczeniaPotwierdzeniaType
|
||||
public $kontakt; // string
|
||||
|
||||
}
|
||||
|
||||
class przesylkaBiznesowaType {
|
||||
|
||||
public $pobranie; // pobranieType
|
||||
public $urzadWydaniaEPrzesylki; // urzadWydaniaEPrzesylkiType
|
||||
public $subPrzesylka; // subPrzesylkaBiznesowaType
|
||||
public $ubezpieczenie; // ubezpieczenieType
|
||||
public $epo; // EPOType
|
||||
public $adresDlaZwrotu; //adresDlaZwrotuType
|
||||
public $zasadySpecjalne; // zasadySpecjalneEnum
|
||||
public $masa; // masaType
|
||||
public $gabaryt; // gabarytBiznesowaType
|
||||
public $wartosc; // wartoscType
|
||||
public $ostroznie; // boolean
|
||||
public $numerTransakcjiOdbioru; // numerTransakcjiOdbioruType
|
||||
public $opis;
|
||||
public $guid;
|
||||
public $niestandardowa;
|
||||
public $potwierdzenieOdbioru;
|
||||
public $doreczenie;
|
||||
public $zwrotDokumentow;
|
||||
public $sprawdzenieZawartosciPrzesylkiPrzezOdbiorce; // boolean
|
||||
|
||||
}
|
||||
class pocztexKrajowyType {
|
||||
public $pobranie; // pobranieType
|
||||
public $odbiorPrzesylkiOdNadawcy; // odbiorPrzesylkiOdNadawcyType
|
||||
public $doreczenie; // doreczenieType
|
||||
public $zwrotDokumentow; // zwrotDokumentowType
|
||||
public $potwierdzenieOdbioru; // potwierdzenieOdbioruType
|
||||
public $potwierdzenieDoreczenia; // potwierdzenieDoreczeniaType
|
||||
public $ubezpieczenie; // ubezpieczenieType
|
||||
public $posteRestante; // boolean
|
||||
public $terminRodzaj; // terminRodzajType
|
||||
public $kopertaFirmowa; // boolean
|
||||
public $masa; // masaType
|
||||
public $wartosc; // wartoscType
|
||||
public $ostroznie; // boolean
|
||||
public $ponadgabaryt; // boolean
|
||||
public $uiszczaOplate; // uiszczaOplateType
|
||||
public $odleglosc; // int
|
||||
public $zawartosc; // string
|
||||
public $sprawdzenieZawartosciPrzesylkiPrzezOdbiorce; // boolean
|
||||
}
|
||||
|
||||
class uslugaKurierskaType {
|
||||
|
||||
public $pobranie; // pobranieType
|
||||
public $odbiorPrzesylkiOdNadawcy; // odbiorPrzesylkiOdNadawcyType
|
||||
public $potwierdzenieDoreczenia; // potwierdzenieDoreczeniaType
|
||||
public $urzadWydaniaEPrzesylki; // urzadWydaniaEPrzesylkiType
|
||||
public $subPrzesylka; // subUslugaKurierskaType
|
||||
public $potwierdzenieOdbioru; // potwierdzenieOdbioruKurierskaType
|
||||
public $ubezpieczenie; // ubezpieczenieType
|
||||
public $zwrotDokumentow; // zwrotDokumentowKurierskaType
|
||||
public $idDokumentyZwrotneAdresy;
|
||||
public $doreczenie; // doreczenieUslugaKurierskaType
|
||||
public $epo; // EPOType
|
||||
public $adresDlaZwrotu;
|
||||
public $zasadySpecjalne; // zasadySpecjalneEnum
|
||||
public $masa; // masaType
|
||||
public $wartosc; // wartoscType
|
||||
public $ponadgabaryt; // boolean
|
||||
public $odleglosc; // int
|
||||
public $zawartosc; // string
|
||||
public $sprawdzenieZawartosciPrzesylkiPrzezOdbiorce; // boolean
|
||||
public $ostroznie; // boolean
|
||||
public $uiszczaOplate; // uiszczaOplateType
|
||||
public $termin; // terminKurierskaType
|
||||
public $opakowanie; // opakowanieKurierskaType
|
||||
public $numerPrzesylkiKlienta; // string
|
||||
public $numerTransakcjiOdbioru; // numerTransakcjiOdbioruType
|
||||
public $opis;
|
||||
|
||||
}
|
||||
|
||||
class PlacowkaPocztowa {
|
||||
public $lokalizacjaGeograficzna; // lokalizacjaGeograficznaType
|
||||
public $id; // int
|
||||
public $prefixNazwy; // string
|
||||
public $nazwa; // string
|
||||
public $wojewodztwo; // string
|
||||
public $powiat; // string
|
||||
public $miejsce; // string
|
||||
public $kodPocztowy; // anonymous127
|
||||
public $miejscowosc; // anonymous128
|
||||
public $ulica; // string
|
||||
public $numerDomu; // string
|
||||
public $numerLokalu; // string
|
||||
public $nazwaWydruk; // string
|
||||
public $punktWydaniaEPrzesylki; // boolean
|
||||
public $powiadomienieSMS; // boolean
|
||||
public $punktWydaniaPrzesylkiBiznesowejPlus; // boolean
|
||||
public $punktWydaniaPrzesylkiBiznesowej; // boolean
|
||||
public $siecPlacowek; // siecPlacowekEnum
|
||||
public $idZPO; // string
|
||||
|
||||
}
|
||||
|
||||
|
||||
class TerminRodzaj {
|
||||
const MIEJSKI_DO_3H_DO_5KM = 'MIEJSKI_DO_3H_DO_5KM';
|
||||
const MIEJSKI_DO_3H_DO_10KM = 'MIEJSKI_DO_3H_DO_10KM';
|
||||
const MIEJSKI_DO_3H_DO_15KM = 'MIEJSKI_DO_3H_DO_15KM';
|
||||
const MIEJSKI_DO_3H_POWYZEJ_15KM = 'MIEJSKI_DO_3H_POWYZEJ_15KM';
|
||||
const MIEJSKI_DO_4H_DO_10KM = 'MIEJSKI_DO_4H_DO_10KM';
|
||||
const MIEJSKI_DO_4H_DO_15KM = 'MIEJSKI_DO_4H_DO_15KM';
|
||||
const MIEJSKI_DO_4H_DO_20KM = 'MIEJSKI_DO_4H_DO_20KM';
|
||||
const MIEJSKI_DO_4H_DO_30KM = 'MIEJSKI_DO_4H_DO_30KM';
|
||||
const MIEJSKI_DO_4H_DO_40KM = 'MIEJSKI_DO_4H_DO_40KM';
|
||||
const KRAJOWY = 'KRAJOWY';
|
||||
const BEZPOSREDNI_DO_20KG = 'BEZPOSREDNI_DO_20KG';
|
||||
const BEZPOSREDNI_DO_30KG = 'BEZPOSREDNI_DO_30KG';
|
||||
const BEZPOSREDNI_OD_30KG_DO_100KG = 'BEZPOSREDNI_OD_30KG_DO_100KG';
|
||||
const EKSPRES24 = 'EKSPRES24';
|
||||
}
|
||||
|
||||
class UiszczaOplate{
|
||||
const NADAWCA = 'NADAWCA';
|
||||
const ADRESAT = 'ADRESAT';
|
||||
}
|
||||
|
||||
class DoreczenieUslugaKurierska {
|
||||
public $oczekiwanyTerminDoreczenia; // date
|
||||
public $oczekiwanaGodzinaDoreczenia; // oczekiwanaGodzinaDoreczeniaUslugiType
|
||||
public $wSobote; // boolean
|
||||
public $w90Minut; // boolean
|
||||
public $wNiedzieleLubSwieto; // boolean
|
||||
public $doRakWlasnych; // boolean
|
||||
public $wGodzinachOd20Do7; // boolean
|
||||
public $po17; // boolean
|
||||
}
|
||||
|
||||
|
||||
class PotwierdzenieOdbioru {
|
||||
public $ilosc;
|
||||
public $sposob;
|
||||
}
|
||||
|
||||
|
||||
class OdbiorPrzesylkiOdNadawcy{
|
||||
public $wSobote; // boolean
|
||||
public $wNiedzieleLubSwieto; // boolean
|
||||
public $wGodzinachOd20Do7; // boolean
|
||||
}
|
||||
|
||||
class ZwrotDokumentowKurierska {
|
||||
public $rodzajPocztex; // terminZwrotDokumentowKurierskaType
|
||||
public $rodzajPaczka; // terminZwrotDokumentowPaczkowaType
|
||||
public $rodzajList; // rodzajListType
|
||||
}
|
||||
|
||||
class rodzajListType {
|
||||
public $polecony; // boolean
|
||||
public $kategoria; // kategoriaType
|
||||
}
|
||||
|
||||
class Zwrot {
|
||||
public $zwrotPoLiczbieDni; // int
|
||||
public $traktowacJakPorzucona; // boolean
|
||||
public $sposobZwrotu; // sposobZwrotuType
|
||||
}
|
||||
|
||||
class subPrzesylkaBiznesowaType {
|
||||
public $ubezpieczenie; // ubezpieczenieType
|
||||
public $numerNadania; // numerNadaniaType
|
||||
public $masa; // masaType
|
||||
public $gabaryt; // gabarytBiznesowaType
|
||||
public $wartosc; // wartoscType
|
||||
public $ostroznie; // boolean
|
||||
public $guid; // guid paczki
|
||||
}
|
||||
|
||||
class subUslugaKurierskaType {
|
||||
public $pobranie; // pobranieType
|
||||
public $ubezpieczenie; // ubezpieczenieType
|
||||
public $numerNadania; // numerNadaniaType
|
||||
public $masa; // masaType
|
||||
public $wartosc; // wartoscType
|
||||
public $ostroznie; // boolean
|
||||
public $opakowanie; // opakowanieKurierskaType
|
||||
public $ponadgabaryt; // boolean
|
||||
public $numerPrzesylkiKlienta; // string
|
||||
}
|
||||
|
||||
class kartaType {
|
||||
public $idKarta; // int
|
||||
public $opis; // string
|
||||
public $aktywna; // boolean
|
||||
}
|
||||
class doreczenieBiznesowaType {
|
||||
public $doRakWlasnych;
|
||||
}
|
||||
class zwrotDokumentowBiznesowaType {
|
||||
public $rodzaj;
|
||||
public $idDokumentyZwrotneAdresy;
|
||||
}
|
||||
|
||||
class pocztex2021KurierType
|
||||
{
|
||||
public $subPrzesylka;
|
||||
public $punktOdbioru;
|
||||
public $punktNadania;
|
||||
public $kopertaPocztex;
|
||||
public $godzinaDoreczenia;
|
||||
public $doreczenieWeWskazanymDniu;
|
||||
}
|
||||
|
||||
class subPocztex2021KurierType
|
||||
{
|
||||
public $pobranie;
|
||||
public $ubezpieczenie;
|
||||
public $numerNadania;
|
||||
public $masa;
|
||||
public $wartosc;
|
||||
public $ostroznie;
|
||||
public $ponadgabaryt;
|
||||
public $format;
|
||||
public $numerPrzesylkiKlienta;
|
||||
}
|
||||
|
||||
class pocztex2021NaDzisType
|
||||
{
|
||||
public $subPrzesylka;
|
||||
public $odleglosc;
|
||||
public $obszar;
|
||||
}
|
||||
|
||||
class subPocztex2021NaDzisType
|
||||
{
|
||||
public $pobranie;
|
||||
public $ubezpieczenie;
|
||||
public $numerNadania;
|
||||
public $masa;
|
||||
public $wartosc;
|
||||
public $ostroznie;
|
||||
public $ponadgabaryt;
|
||||
public $format;
|
||||
public $numerPrzesylkiKlienta;
|
||||
}
|
||||
|
||||
class zawartoscPocztex2021Type {
|
||||
public $zawartoscSpecjalna;
|
||||
public $zawartoscInna;
|
||||
}
|
||||
|
||||
class potwierdzenieEDoreczeniaType {
|
||||
public $sposob;
|
||||
public $kontakt;
|
||||
}
|
||||
|
||||
class placowkaPocztowaType {
|
||||
public $id; // int
|
||||
public $prefixNazwy; // string
|
||||
public $nazwa; // string
|
||||
public $siecPlacowek;
|
||||
public $wojewodztwo; // string
|
||||
public $powiat; // string
|
||||
public $miejsce; // string
|
||||
public $kodPocztowy; // anonymous127
|
||||
public $miejscowosc; // anonymous128
|
||||
public $ulica; // string
|
||||
public $numerDomu; // string
|
||||
public $numerLokalu; // string
|
||||
public $nazwaWydruk; // string
|
||||
public $punktWydaniaEPrzesylki; // boolean
|
||||
public $powiadomienieSMS; // boolean
|
||||
public $punktWydaniaPrzesylkiBiznesowejPlus; // boolean
|
||||
public $lokalizacjaGeograficzna;
|
||||
public $punktWydaniaPrzesylkiBiznesowej; // boolean
|
||||
public $deliveryPath;
|
||||
|
||||
}
|
||||
574
modules/pocztapolskaen/classes/enadawca/Resource/Shipment.php
Normal file
574
modules/pocztapolskaen/classes/enadawca/Resource/Shipment.php
Normal file
@@ -0,0 +1,574 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Klasa odpowiadajaca za dodawanie przesyłek
|
||||
*/
|
||||
class Shipment extends Resource {
|
||||
|
||||
/**
|
||||
* tablica przesyłek do dodania
|
||||
* @var array
|
||||
*/
|
||||
private $_przesylki = array();
|
||||
|
||||
/**
|
||||
* Metoda umozliwiająca dodanie paczkki Pocztowej
|
||||
* @param $adres
|
||||
* @param type $kategoria
|
||||
* @param type $gabaryt
|
||||
* @param type $masa
|
||||
* @param type $wartosc
|
||||
* @param type $zwrotDoslanie
|
||||
* @param type $posteRestante
|
||||
* @param type $iloscPotwierdzenOdbioru
|
||||
* @param type $egzemplarzBiblioteczny
|
||||
* @param type $dlaOciemnialych
|
||||
* @return boolean
|
||||
*/
|
||||
public function addPaczkaPocztowa($adres, $kategoria, $gabaryt, $masa, $wartosc, $zwrotDoslanie, $posteRestante = false, $iloscPotwierdzenOdbioru = 0, $egzemplarzBiblioteczny = false, $dlaOciemnialych = false, $opis = '') {
|
||||
$paczka = new paczkaPocztowaType();
|
||||
$paczka->adres = $adres;
|
||||
$paczka->epo = false;
|
||||
$paczka->posteRestante = $posteRestante;
|
||||
$paczka->iloscPotwierdzenOdbioru = $iloscPotwierdzenOdbioru;
|
||||
$paczka->kategoria = $kategoria;
|
||||
$paczka->gabaryt = $gabaryt;
|
||||
$paczka->wartosc = $wartosc;
|
||||
$paczka->masa = $masa;
|
||||
$paczka->zwrotDoslanie = $zwrotDoslanie;
|
||||
$paczka->guid = $this->createGuid();
|
||||
$paczka->egzemplarzBiblioteczny = $egzemplarzBiblioteczny;
|
||||
$paczka->dlaOciemnialych = $dlaOciemnialych;
|
||||
$paczka->opis = $opis;
|
||||
$this->_przesylki[] = $paczka;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda umozliwiająca dodanie przesyłki listownej
|
||||
* @param $adres
|
||||
* @param type $kategoria
|
||||
* @param type $gabaryt
|
||||
* @param type $masa
|
||||
* @param type $wartosc
|
||||
* @param type $posteRestante
|
||||
* @param type $iloscPotwierdzenOdbioru
|
||||
* @return boolean
|
||||
*/
|
||||
public function addPrzesylkaListowa($adres, $kategoria, $gabaryt, $masa, $wartosc, $posteRestante = false, $iloscPotwierdzenOdbioru = 0) {
|
||||
$paczka = new przesylkaListowaZadeklarowanaWartoscType();
|
||||
$paczka->adres = $adres;
|
||||
$paczka->posteRestante = $posteRestante;
|
||||
$paczka->iloscPotwierdzenOdbioru = $iloscPotwierdzenOdbioru;
|
||||
$paczka->kategoria = $kategoria;
|
||||
$paczka->gabaryt = $gabaryt;
|
||||
$paczka->wartosc = $wartosc;
|
||||
$paczka->masa = $masa;
|
||||
$paczka->guid = $this->createGuid();
|
||||
$this->_przesylki[] = $paczka;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda umozliwia dodanie przesylki biznesowej
|
||||
* @param $adres
|
||||
* @param $gabaryt
|
||||
* @param $opis
|
||||
* @param $pobranie
|
||||
* @param $ubezpieczenie
|
||||
* @param $urzadWydaniaEPrzesylki
|
||||
* @param $masa
|
||||
* @param $wartosc
|
||||
* @param $ostroznie
|
||||
* @param int $wielopaczkowosc_ilosc
|
||||
* @param $niestandardowa
|
||||
* @param $potwierdzenieOdbioru
|
||||
* @param $doreczenie
|
||||
* @param $zwrotDokumentow
|
||||
* @param $odbiorca
|
||||
* @return bool
|
||||
*/
|
||||
public function addPrzesylkaBiznesowa($adres, $gabaryt, $opis, $pobranie, $ubezpieczenie, $urzadWydaniaEPrzesylki, $masa, $wartosc, $ostroznie, $wielopaczkowosc_ilosc = 0, $niestandardowa, $potwierdzenieOdbioru, $doreczenie, $zwrotDokumentow, $odbiorca) {
|
||||
$package = new przesylkaBiznesowaType();
|
||||
$package->pobranie = $pobranie;
|
||||
$package->adres = $adres;
|
||||
$package->gabaryt = $gabaryt;
|
||||
$package->masa = $masa;
|
||||
$package->wartosc = $wartosc;
|
||||
$package->sprawdzenieZawartosciPrzesylkiPrzezOdbiorce = $odbiorca;
|
||||
$package->opis = $opis;
|
||||
$package->ostroznie = $ostroznie;
|
||||
$package->guid = $this->createGuid();
|
||||
$package->urzadWydaniaEPrzesylki = $urzadWydaniaEPrzesylki;
|
||||
$package->ubezpieczenie = $ubezpieczenie;
|
||||
$package->niestandardowa = $niestandardowa;
|
||||
$package->doreczenie = $doreczenie;
|
||||
$package->potwierdzenieOdbioru = $potwierdzenieOdbioru;
|
||||
$package->zwrotDokumentow = $zwrotDokumentow;
|
||||
if($wielopaczkowosc_ilosc>0){
|
||||
unset($package->urzadWydaniaEPrzesylki);
|
||||
$this->addSubPrzesylkaBiznesowa($wielopaczkowosc_ilosc,$package);
|
||||
}
|
||||
$this->_przesylki[] = $package;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda umozliwa dodanie podprzesyłki do przesylki biznesowej
|
||||
* @param $losc
|
||||
* @param $parentPackage
|
||||
*/
|
||||
public function addSubPrzesylkaBiznesowa($losc, $parentPackage){
|
||||
$packages = array();
|
||||
for($i=0;$i<$losc-1;$i++){
|
||||
$package = new subPrzesylkaBiznesowaType();
|
||||
$package->guid = $this->createGuid();
|
||||
$package->ubezpieczenie = $parentPackage->ubezpieczenie;
|
||||
$package->masa = $parentPackage->masa;
|
||||
$package->gabaryt = $parentPackage->gabaryt;
|
||||
$package->wartosc = $parentPackage->wartosc;
|
||||
$package->ostroznie = $parentPackage->ostroznie;
|
||||
$packages[] = $package;
|
||||
}
|
||||
if(!empty($packages)){
|
||||
$parentPackage->subPrzesylka = $packages;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function addSubPocztex2021($ilosc, $parentPackage){
|
||||
$packages = array();
|
||||
for($i=0;$i<$ilosc-1;$i++){
|
||||
$package = new subPocztex2021KurierType();
|
||||
$package->guid = $this->createGuid();
|
||||
$package->ubezpieczenie = $parentPackage->ubezpieczenie;
|
||||
$package->masa = $parentPackage->masa;
|
||||
$package->gabaryt = $parentPackage->gabaryt;
|
||||
$package->wartosc = $parentPackage->wartosc;
|
||||
$package->ostroznie = $parentPackage->ostroznie;
|
||||
$package->ponadgabaryt = $parentPackage->ponadgabaryt;
|
||||
$package->format = $parentPackage->format;
|
||||
$packages[] = $package;
|
||||
}
|
||||
if(!empty($packages)){
|
||||
$parentPackage->subPrzesylka = $packages;
|
||||
}
|
||||
}
|
||||
|
||||
public function addSubPocztex2021Dzis($ilosc, $parentPackage){
|
||||
$packages = array();
|
||||
for($i=0;$i<$ilosc-1;$i++){
|
||||
$package = new subPocztex2021NaDzisType();
|
||||
$package->guid = $this->createGuid();
|
||||
$package->ubezpieczenie = $parentPackage->ubezpieczenie;
|
||||
$package->masa = $parentPackage->masa;
|
||||
$package->gabaryt = $parentPackage->gabaryt;
|
||||
$package->wartosc = $parentPackage->wartosc;
|
||||
$package->ostroznie = $parentPackage->ostroznie;
|
||||
$package->ponadgabaryt = $parentPackage->ponadgabaryt;
|
||||
$package->format = $parentPackage->format;
|
||||
$packages[] = $package;
|
||||
}
|
||||
if(!empty($packages)){
|
||||
$parentPackage->subPrzesylka = $packages;
|
||||
}
|
||||
}
|
||||
|
||||
public function addPocztex2021Kurier($adres, $format, $pobranie, $masa, $wartosc, $odbiorca, $opis, $ostroznie, $koperta, $sobota, $godzinaDoreczenia, $ponadgabaryt, $zawartosc, $punktOdbioru, $ubezpieczenie, $wielopaczkowosc_ilosc, $dzien, $potwierdzenieDoreczenia, $punktNadania){
|
||||
$package = new pocztex2021KurierType();
|
||||
$package->pobranie = $pobranie;
|
||||
$package->adres = $adres;
|
||||
$package->format = $format;
|
||||
|
||||
$package->masa = $masa;
|
||||
$package->wartosc = $wartosc;
|
||||
$package->sprawdzenieZawartosciPrzesylkiPrzezOdbiorce = $odbiorca;
|
||||
$package->opis = $opis;
|
||||
$package->ostroznie = $ostroznie;
|
||||
$package->guid = $this->createGuid();
|
||||
$package->kopertaPocztex = $koperta;
|
||||
$package->godzinaDoreczenia = $godzinaDoreczenia;
|
||||
$package->ponadgabaryt = $ponadgabaryt;
|
||||
$package->odbiorWSobote = $sobota;
|
||||
$package->zawartosc = $zawartosc;
|
||||
$package->punktOdbioru = $punktOdbioru;
|
||||
$package->ubezpieczenie = $ubezpieczenie;
|
||||
$package->doreczenieWeWskazanymDniu = $dzien;
|
||||
$package->potwierdzenieDoreczenia = $potwierdzenieDoreczenia;
|
||||
$package->punktNadania = $punktNadania;
|
||||
|
||||
if($wielopaczkowosc_ilosc>0){
|
||||
$this->addSubPocztex2021($wielopaczkowosc_ilosc,$package);
|
||||
}
|
||||
|
||||
$this->_przesylki[] = $package;
|
||||
return true;
|
||||
}
|
||||
|
||||
public function addPocztex2021Dzis($adres, $format, $pobranie, $masa, $wartosc, $odbiorca, $opis, $ostroznie, $sobota, $zawartosc, $ubezpieczenie, $wielopaczkowosc_ilosc, $odleglosc, $obszar, $potwierdzenieDoreczenia){
|
||||
$package = new pocztex2021NaDzisType();
|
||||
$package->pobranie = $pobranie;
|
||||
$package->adres = $adres;
|
||||
$package->masa = $masa;
|
||||
$package->wartosc = $wartosc;
|
||||
$package->sprawdzenieZawartosciPrzesylkiPrzezOdbiorce = $odbiorca;
|
||||
$package->opis = $opis;
|
||||
$package->ostroznie = $ostroznie;
|
||||
$package->guid = $this->createGuid();
|
||||
$package->odbiorWSobote = $sobota;
|
||||
$package->zawartosc = $zawartosc;
|
||||
$package->ubezpieczenie = $ubezpieczenie;
|
||||
|
||||
$package->obszar = $obszar;
|
||||
if($obszar == 'MIASTO'){
|
||||
$package->odleglosc = $odleglosc;
|
||||
$package->format = $format;
|
||||
}
|
||||
|
||||
$package->potwierdzenieDoreczenia = $potwierdzenieDoreczenia;
|
||||
|
||||
if($wielopaczkowosc_ilosc>0 && $obszar == 'KRAJ'){
|
||||
unset($package->urzadWydaniaEPrzesylki);
|
||||
$this->addSubPocztex2021Dzis($wielopaczkowosc_ilosc,$package);
|
||||
}
|
||||
|
||||
$this->_przesylki[] = $package;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda umożliwia dodanie usługi kurierskiej
|
||||
* @param $adres
|
||||
* @param $termin
|
||||
* @param $opis
|
||||
* @param $zawartosc
|
||||
* @param $masa
|
||||
* @param $ostroznie
|
||||
* @param $niestandardowa
|
||||
* @param $sprawdzenie
|
||||
* @param $urzadWydaniaEPrzesylki
|
||||
* @param $uiszczaOplate
|
||||
* @param $doreczenie
|
||||
* @param $pobranie
|
||||
* @param $wartosc
|
||||
* @param $ubezpieczenie
|
||||
* @param $potwierdzenieOdbioru
|
||||
* @param $potwierdzenieDoreczenia
|
||||
* @param $odbiorPrzesylkiOdNadawcy
|
||||
* @param $zasadySpecjalne
|
||||
* @param int $wielopaczkowosc_ilosc
|
||||
* @param $zwrotDokumentow
|
||||
* @param $odleglosc
|
||||
* @return bool
|
||||
*/
|
||||
public function addUslugaKurierska($adres, $termin, $opis, $zawartosc, $masa, $ostroznie, $niestandardowa, $sprawdzenie, $urzadWydaniaEPrzesylki, $uiszczaOplate, $doreczenie, $pobranie, $wartosc, $ubezpieczenie, $potwierdzenieOdbioru, $potwierdzenieDoreczenia, $odbiorPrzesylkiOdNadawcy, $zasadySpecjalne, $wielopaczkowosc_ilosc = 0, $zwrotDokumentow,$odleglosc) {
|
||||
$package = new uslugaKurierskaType();
|
||||
$package->pobranie = $pobranie;
|
||||
$package->adres = $adres;
|
||||
$package->termin = $termin;
|
||||
$package->masa = $masa;
|
||||
$package->wartosc = $wartosc;
|
||||
$package->opis = $opis;
|
||||
$package->ostroznie = $ostroznie;
|
||||
$package->zawartosc = $zawartosc;
|
||||
$package->uiszczaOplate = $uiszczaOplate;
|
||||
$package->guid = $this->createGuid();
|
||||
$package->urzadWydaniaEPrzesylki = $urzadWydaniaEPrzesylki;
|
||||
if($wielopaczkowosc_ilosc>0){
|
||||
unset($package->urzadWydaniaEPrzesylki);
|
||||
$this->addSubUslugaKurierska($wielopaczkowosc_ilosc,$package);
|
||||
}
|
||||
$package->ponadgabaryt = $niestandardowa;
|
||||
$package->sprawdzenieZawartosciPrzesylkiPrzezOdbiorce = $sprawdzenie;
|
||||
$package->ubezpieczenie = $ubezpieczenie;
|
||||
$package->doreczenie = $doreczenie;
|
||||
$package->ubezpieczenie = $ubezpieczenie;
|
||||
$package->wartosc = $wartosc;
|
||||
$package->pobranie = $pobranie;
|
||||
$package->potwierdzenieOdbioru = $potwierdzenieOdbioru;
|
||||
$package->potwierdzenieDoreczenia = $potwierdzenieDoreczenia;
|
||||
$package->odbiorPrzesylkiOdNadawcy = $odbiorPrzesylkiOdNadawcy;
|
||||
$package->zasadySpecjalne = $zasadySpecjalne;
|
||||
$package->zwrotDokumentow = $zwrotDokumentow;
|
||||
$package->odleglosc = $odleglosc;
|
||||
$this->_przesylki[] = $package;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* metoda umożliwia ustawienie pod przesylki dla uslugi kurierskiej
|
||||
* @param $losc
|
||||
* @param $parentPackage
|
||||
*/
|
||||
public function addSubUslugaKurierska($losc, $parentPackage){
|
||||
$packages = array();
|
||||
for($i=0;$i<$losc-1;$i++){
|
||||
$package = new subUslugaKurierskaType();
|
||||
$package->guid = $this->createGuid();
|
||||
$package->ubezpieczenie = $parentPackage->ubezpieczenie;
|
||||
$package->masa = $parentPackage->masa;
|
||||
$package->gabaryt = $parentPackage->gabaryt;
|
||||
$package->wartosc = $parentPackage->wartosc;
|
||||
$package->ostroznie = $parentPackage->ostroznie;
|
||||
$package->ponadgabaryt = $parentPackage->ponadgabaryt;
|
||||
$packages[] = $package;
|
||||
}
|
||||
if(!empty($packages)){
|
||||
$parentPackage->subPrzesylka = $packages;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* metoda umożliwia ustawienie przesylki Global Express
|
||||
* @param $adres
|
||||
* @param $masa
|
||||
* @param $zawartosc
|
||||
* @param string $numer
|
||||
* @param null $potwierdzenie
|
||||
* @param string $opis
|
||||
* @return bool
|
||||
*/
|
||||
public function addGlobalExpres($adres, $masa, $zawartosc, $numer = '', $potwierdzenie = null, $opis = '') {
|
||||
$package = new globalExpresType();
|
||||
$package->adres = $adres;
|
||||
$package->guid = $this->createGuid();
|
||||
$package->potwierdzenieDoreczenia = $potwierdzenie;
|
||||
$package->masa = $masa;
|
||||
$package->zawartosc = $zawartosc;
|
||||
$package->numerPrzesylkiKlienta = $numer;
|
||||
$package->opis = $opis;
|
||||
$this->_przesylki[] = $package;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda umozliwa dodanie przesylki poleconej krajowej
|
||||
* @param $adres
|
||||
* @param $kategoria
|
||||
* @param $format
|
||||
* @param $masa
|
||||
* @param bool $obszarMiasto
|
||||
* @param bool $miejscowa
|
||||
* @param int $iloscPotwierdzenOdbioru
|
||||
* @param string $numer
|
||||
* @param bool $dlaOciemnialych
|
||||
* @param bool $egzemplarzBiblioteczny
|
||||
* @param string $opis
|
||||
* @param bool $posteRestante
|
||||
* @return bool
|
||||
*/
|
||||
public function addPrzesylkaPoleconaKrajowa($adres, $kategoria, $format, $masa, $obszarMiasto = true, $miejscowa = true, $iloscPotwierdzenOdbioru = 0, $numer = '', $dlaOciemnialych = false, $egzemplarzBiblioteczny = false, $opis = '', $posteRestante = false) {
|
||||
$package = new przesylkaPoleconaKrajowaType();
|
||||
$package->adres = $adres;
|
||||
$package->posteRestante = $posteRestante;
|
||||
$package->dlaOciemnialych = $dlaOciemnialych;
|
||||
$package->egzemplarzBiblioteczny = $egzemplarzBiblioteczny;
|
||||
$package->iloscPotwierdzenOdbioru = $iloscPotwierdzenOdbioru;
|
||||
$package->masa = $masa;
|
||||
//$package->miejscowa = $miejscowa;
|
||||
//$package->obszarMiasto = $obszarMiasto;
|
||||
$package->kategoria = $kategoria;
|
||||
$package->format = $format;
|
||||
$package->guid = $this->createGuid();
|
||||
$package->opis = $opis;
|
||||
$this->_przesylki[] = $package;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda umozliwa dodanie przesylki poleconej firmowej
|
||||
* @param $adres
|
||||
* @param $opis
|
||||
* @param $kategoria
|
||||
* @param $gabaryt
|
||||
* @param $masa
|
||||
* @param bool $miejscowa
|
||||
* @param int $iloscPotwierdzenOdbioru
|
||||
* @param string $zasadySpecjalne
|
||||
* @param bool $posteRestante
|
||||
* @return bool
|
||||
*/
|
||||
public function addPrzesylkaPoleconaFirmowa($adres, $opis, $kategoria, $gabaryt,$masa, $miejscowa = true, $iloscPotwierdzenOdbioru = 0, $zasadySpecjalne = '', $posteRestante = false) {
|
||||
$package = new przesylkaFirmowaPoleconaType();
|
||||
$package->adres = $adres;
|
||||
$package->zasadySpecjalne = $zasadySpecjalne;
|
||||
$package->posteRestante = $posteRestante;
|
||||
$package->iloscPotwierdzenOdbioru = $iloscPotwierdzenOdbioru;
|
||||
$package->masa = $masa;
|
||||
$package->opis = $opis;
|
||||
$package->miejscowa = $miejscowa;
|
||||
$package->kategoria = $kategoria;
|
||||
$package->gabaryt = $gabaryt;
|
||||
$package->guid = $this->createGuid();
|
||||
$this->_przesylki[] = $package;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda umozliwiajaca dodanie przesylki poleconej zagranicznej
|
||||
* @param $adres
|
||||
* @param $opis
|
||||
* @param $masa
|
||||
* @param int $iloscPotwierdzenOdbioru
|
||||
* @param bool $posteRestante
|
||||
* @return bool
|
||||
*/
|
||||
public function addPrzesylkaPoleconaZagraniczna($adres, $opis, $masa, $iloscPotwierdzenOdbioru = 0, $posteRestante = false) {
|
||||
$package = new przesylkaPoleconaZagranicznaType();
|
||||
$package->adres = $adres;
|
||||
$package->posteRestante = $posteRestante;
|
||||
$package->masa = $masa;
|
||||
$package->opis = $opis;
|
||||
$package->iloscPotwierdzenOdbioru = $iloscPotwierdzenOdbioru;
|
||||
$package->guid = $this->createGuid();
|
||||
$this->_przesylki[] = $package;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda uzmowliwajaca dodanie paczki zagaranicznej
|
||||
* @param $adres
|
||||
* @param $masa
|
||||
* @param $opis
|
||||
* @param $kategoria
|
||||
* @param $wartosc
|
||||
* @param int $iloscPotwierdzenOdbioru
|
||||
* @param $zwrot
|
||||
* @return bool
|
||||
*/
|
||||
public function addPaczkaZagraniczna($adres, $masa, $opis, $kategoria, $wartosc, $iloscPotwierdzenOdbioru = 0, $zwrot) {
|
||||
$package = new paczkaZagranicznaType();
|
||||
$package->adres = $adres;
|
||||
$package->masa = $masa;
|
||||
$package->opis = $opis;
|
||||
$package->wartosc = $wartosc;
|
||||
$package->kategoria = $kategoria;
|
||||
// $package->numerReferencyjnyCelny = $numer;
|
||||
$package->iloscPotwierdzenOdbioru = $iloscPotwierdzenOdbioru;
|
||||
$package->zwrot = $zwrot;
|
||||
$package->guid = $this->createGuid();
|
||||
$this->_przesylki[] = $package;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda umozliwajaca dodanie paczki EMS
|
||||
* @param $adres
|
||||
* @param $masa
|
||||
* @param $opis
|
||||
* @param $typ
|
||||
* @param $ubezpieczenie
|
||||
* @param $potwierdzenieDoreczenia
|
||||
* @return bool
|
||||
*/
|
||||
public function addEMS($adres, $masa, $opis, $typ, $ubezpieczenie, $potwierdzenieDoreczenia) {
|
||||
$package = new EMSType();
|
||||
$package->adres = $adres;
|
||||
$package->typOpakowania = $typ;
|
||||
$package->masa = $masa;
|
||||
$package->ubezpieczenie = $ubezpieczenie;
|
||||
$package->opis = $opis;
|
||||
$package->guid = $this->createGuid();
|
||||
$package->potwierdzenieDoreczenia = $potwierdzenieDoreczenia;
|
||||
$this->_przesylki[] = $package;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda umożliwiająca przesuwanie przesyłek pomiędzy buforami
|
||||
* @param integer $idBuforFrom
|
||||
* @param iteger $idBuforTo
|
||||
* @param array $guids
|
||||
* @return array
|
||||
*/
|
||||
public function move($idBuforFrom, $idBuforTo, array $guids) {
|
||||
$result = false;
|
||||
if ($idBuforFrom != $idBuforTo) {
|
||||
if (!$this->isFull($idBuforTo)) {
|
||||
$size = $this->getRemained($idBuforTo);
|
||||
if ($size > count($guids)) {
|
||||
$result = $this->_callWebservice('moveShipments', array('idBuforFrom' => $idBuforFrom, 'idBuforTo' => $idBuforTo, 'guid' => $guids));
|
||||
} else {
|
||||
$this->errors[] = Translate::getAdminTranslation(sprintf('Do bufora docelowego można przesunąć %s przesyłki', $size));
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = Translate::getAdminTranslation('Bufor docelowy jest pełny');
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda pozwalająca dodać przesyłki
|
||||
* @return array
|
||||
*/
|
||||
public function add($idBufor = '') {
|
||||
if (empty($idBufor) || $idBufor == 0 || $idBufor == '') {
|
||||
$idBufor = $this->getNextBufor();
|
||||
}
|
||||
$params = array('przesylki' => $this->_przesylki,'idBufor'=>$idBufor);
|
||||
if ($this->isFull($idBufor)) {
|
||||
$idBufor = $params['idBufor'] = $this->getNextBufor();
|
||||
}
|
||||
$result = $this->_callWebservice('addShipment', $params);
|
||||
if (isset($result['retval'])) {
|
||||
$result['retval']['id_buffor'] = $idBufor;
|
||||
return $result['retval'];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda sprawdzajaca czy bufor jest przepelniony > 500
|
||||
* @param string $idBufor
|
||||
* @return bool
|
||||
*/
|
||||
public function isFull($idBufor = '') {
|
||||
$packages = ENadawca::EnvelopeBuffor()->get($idBufor);
|
||||
return count($packages) > 500;
|
||||
}
|
||||
|
||||
/**
|
||||
* metoda zwracajaca iloc przesylek w buforze
|
||||
* @param string $idBufor
|
||||
* @return int
|
||||
*/
|
||||
public function getSize($idBufor = '') {
|
||||
$packages = ENadawca::EnvelopeBuffor()->get($idBufor);
|
||||
return count($packages);
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda zwraca ile jeszcze moze sie zmiescie w buforze
|
||||
* @param string $idBufor
|
||||
* @return int
|
||||
*/
|
||||
public function getRemained($idBufor = '') {
|
||||
$packages = ENadawca::EnvelopeBuffor()->get($idBufor);
|
||||
$number = 500 - count($packages);
|
||||
if ($number <= 0) {
|
||||
$number = 0;
|
||||
}
|
||||
return $number;
|
||||
}
|
||||
|
||||
/**
|
||||
* metoda zwracajaca wolny bufor
|
||||
* @return string
|
||||
*/
|
||||
public function getNextBufor() {
|
||||
$list = ENadawca::EnvelopeBuffor()->getList();
|
||||
$officesList = ENadawca::UrzedyNadania()->get();
|
||||
$offices = array();
|
||||
foreach ($officesList as $office) {
|
||||
$offices[$office['urzadNadania']] = $office['urzadNadania'];
|
||||
}
|
||||
foreach ($list as $buffor) {
|
||||
if (isset($offices[$buffor['urzadNadania']]) && !$this->isFull($buffor['idBufor'])) {
|
||||
return $buffor['idBufor'];
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Klasa odpowiadajaca za pobieranie urzędów nadania
|
||||
*/
|
||||
class UrzedyNadania extends Resource {
|
||||
|
||||
/**
|
||||
* Metoda pozwala pobrać wszystkie urzędy nadania, dla których nadający ma podpisaną umowę z PP
|
||||
* @param type $param
|
||||
* @return array
|
||||
*/
|
||||
public function get($param = '') {
|
||||
$result = $this->_callWebservice('getUrzedyNadania');
|
||||
if (isset($result['urzedyNadania']['urzadNadania'])) {
|
||||
$result['urzedyNadania'] = array($result['urzedyNadania']);
|
||||
}
|
||||
if (!empty($param) && isset($result[$param])) {
|
||||
foreach ($result as $v) {
|
||||
if (isset($v['urzadNadania']) && $v['urzadNadania'] === $param) {
|
||||
return $v;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $result['urzedyNadania'];
|
||||
}
|
||||
|
||||
}
|
||||
146
modules/pocztapolskaen/classes/enadawca/Soap/Client.php
Normal file
146
modules/pocztapolskaen/classes/enadawca/Soap/Client.php
Normal file
@@ -0,0 +1,146 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../Exception/ClientException.php';
|
||||
|
||||
/**
|
||||
* Klasa odpowiedzialna za łacznie się z web api PP
|
||||
*/
|
||||
class Client extends SoapClient {
|
||||
|
||||
/**
|
||||
* Mapa klas typów przesyłek
|
||||
* @var type
|
||||
*/
|
||||
public static $classmap = array(
|
||||
'przesylkaType' => 'przesylkaType',
|
||||
'paczkaPocztowaType' => 'paczkaPocztowaType',
|
||||
'przesylkaBiznesowaType' => 'przesylkaBiznesowaType',
|
||||
'uslugaKurierskaType' => 'uslugaKurierskaType',
|
||||
'globalExpresType' => 'globalExpresType',
|
||||
'przesylkaPoleconaZagranicznaType' => 'przesylkaPoleconaZagranicznaType',
|
||||
'przesylkaFirmowaPoleconaType' => 'przesylkaFirmowaPoleconaType',
|
||||
'paczkaZagranicznaType' => 'paczkaZagranicznaType',
|
||||
'EMSType' => 'EMSType',
|
||||
'paczkaPocztowaPLUSType' => 'paczkaPocztowaPLUSType',
|
||||
'przesylkaPobraniowaType' => 'przesylkaPobraniowaType',
|
||||
'przesylkaNaWarunkachSzczegolnychType' => 'przesylkaNaWarunkachSzczegolnychType',
|
||||
'przesylkaPoleconaKrajowaType' => 'przesylkaPoleconaKrajowaType',
|
||||
'przesylkaHandlowaType' => 'przesylkaHandlowaType',
|
||||
'przesylkaListowaZadeklarowanaWartoscType' => 'przesylkaListowaZadeklarowanaWartoscType',
|
||||
'przesylkaFullType' => 'przesylkaFullType',
|
||||
'przesylkaRejestrowanaType' => 'przesylkaRejestrowanaType',
|
||||
'subUslugaKurierskaType' => 'subUslugaKurierskaType',
|
||||
'subPrzesylkaBiznesowaType' =>'subPrzesylkaBiznesowaType',
|
||||
|
||||
'kartaType' => 'kartaType',
|
||||
'rodzajListType' => 'rodzajListType',
|
||||
'pocztex2021KurierType' => 'pocztex2021KurierType',
|
||||
'subPocztex2021KurierType' => 'subPocztex2021KurierType',
|
||||
'pocztex2021NaDzisType' => 'pocztex2021NaDzisType',
|
||||
'subPocztex2021NaDzisType' => 'subPocztex2021NaDzisType',
|
||||
'potwierdzenieEDoreczeniaType' => 'potwierdzenieEDoreczeniaType',
|
||||
'placowkaPocztowaType' => 'placowkaPocztowaType',
|
||||
);
|
||||
|
||||
/**
|
||||
* Obiekt loggera
|
||||
* @var type
|
||||
*/
|
||||
private $_logger = null;
|
||||
|
||||
/**
|
||||
* Konstruktor
|
||||
* @param type $url
|
||||
* @param type $login
|
||||
* @param type $password
|
||||
* @param type $debug
|
||||
* @param type $options
|
||||
*/
|
||||
public function __construct($url, $login, $password, $location, $debug = false, $options = array()) {
|
||||
$this->url = $url;
|
||||
$this->debug = $debug;
|
||||
$options['login'] = $login;
|
||||
$options['password'] = $password;
|
||||
$options['uri'] = $url;
|
||||
$options['location'] = $location;
|
||||
$options['cache_wsdl'] = WSDL_CACHE_NONE;
|
||||
$this->_logger = new ENadawcaLogger();
|
||||
foreach (self::$classmap as $key => $value) {
|
||||
if (!isset($options['classmap'][$key])) {
|
||||
$options['classmap'][$key] = $value;
|
||||
}
|
||||
}
|
||||
parent::__construct($url, $options);
|
||||
}
|
||||
|
||||
private function _normalizeResponse($data) {
|
||||
if (is_object($data)) {
|
||||
$data = get_object_vars($data);
|
||||
}
|
||||
if (is_array($data)) {
|
||||
foreach ($data as &$v) {
|
||||
$v = $this->_normalizeResponse($v);
|
||||
}
|
||||
return $data;
|
||||
} else {
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
private function _checkErrors($data) {
|
||||
if (isset($data['error'])&&is_array($data['error'])) {
|
||||
if (!isset($data['error']['errorNumber'])) {
|
||||
$errors = array();
|
||||
foreach ($data['error'] as $v) {
|
||||
$errors[] = $v['errorDesc'];
|
||||
}
|
||||
return implode("\n", $errors);
|
||||
} else {
|
||||
return $data['error']['errorDesc'];
|
||||
}
|
||||
} else {
|
||||
if (is_array($data)) {
|
||||
$errors = array();
|
||||
foreach ($data as $d) {
|
||||
$error = $this->_checkErrors($d);
|
||||
if (!empty($error)) {
|
||||
$errors[] = $error;
|
||||
}
|
||||
}
|
||||
return implode("\n", $errors);
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Metodą odpowiedzialna za wywołanie funkcji z api
|
||||
* @param type $function_name
|
||||
* @param type $parameters
|
||||
* @param array $options
|
||||
* @return type
|
||||
*/
|
||||
public function call($function_name, $parameters = array(), array $options = null) {
|
||||
$response = false;
|
||||
try {
|
||||
$options['uri'] = $this->url;
|
||||
if($this->debug){
|
||||
$this->_logger->log("Call webserwice function " . $function_name, array('parameters' => $parameters, 'options' => $options));
|
||||
}
|
||||
|
||||
$response = $this->_normalizeResponse($this->__soapCall($function_name, array($parameters), $options));
|
||||
$errors = $this->_checkErrors($response);
|
||||
if (!empty($errors)) {
|
||||
throw new ENadawcaException($errors);
|
||||
}
|
||||
if($this->debug){
|
||||
$this->_logger->log("Result webserwice function " . $function_name, $response);
|
||||
}
|
||||
|
||||
} catch (SoapFault $e) {
|
||||
throw new ClientException($e);
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
}
|
||||
12
modules/pocztapolskaen/config_pl.xml
Normal file
12
modules/pocztapolskaen/config_pl.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<module>
|
||||
<name>pocztapolskaen</name>
|
||||
<displayName><![CDATA[Poczta Polska Elektroniczny Nadawca]]></displayName>
|
||||
<version><![CDATA[1.2.3]]></version>
|
||||
<description><![CDATA[Plugin odpowiedzialny za synchronizację z Poczta Polska Elektroniczny Nadawca.]]></description>
|
||||
<author><![CDATA[Poczta Polska]]></author>
|
||||
<tab><![CDATA[shipping_logistics]]></tab>
|
||||
<is_configurable>0</is_configurable>
|
||||
<need_instance>0</need_instance>
|
||||
<limited_countries></limited_countries>
|
||||
</module>
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
class AdminPocztaPolskaController extends AdminController {
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
$this->module = Module::getInstanceByName('pocztapolskaen');
|
||||
$this->bootstrap = true;
|
||||
$this->context = Context::getContext();
|
||||
$this->_conf[33] = $this->l('Operacja Wyślij do Urzędu została wykonana pomyślnie');
|
||||
$this->_conf[34] = $this->l('Operacja Przeniesienia przesyłek została wykonana pomyślnie');
|
||||
$this->_conf[35] = sprintf($this->l('Zostało wysłane zamówienie po Kuriera data: %s godzina: %s. Kurier skontaktuje się z Państwem w celu ustalenia sczegółow przybycia.'), date('d-m-Y'), date('H:i:s'));
|
||||
$this->_conf[36] = $this->l('Przesyłki zostały usunięte');
|
||||
$this->_conf[41] = $this->l('Zbiór został usunięty');
|
||||
$this->_conf[43] = $this->l('Zbiór został utworzony');
|
||||
$this->_conf[44] = $this->l('Zbiór został zaktualizowany');
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiedzialna za inicjalizacje procesów
|
||||
*/
|
||||
public function initProcess() {
|
||||
parent::initProcess();
|
||||
$action = Tools::getValue('action', '');
|
||||
if (!empty($action)) {
|
||||
$this->action = $action;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,334 @@
|
||||
<?php
|
||||
|
||||
require_once(__DIR__ . '/AdminPocztaPolskaController.php');
|
||||
/**
|
||||
* Klasa odpowiadajaca za obsluge zamawiania kuriera
|
||||
*/
|
||||
class AdminPocztaPolskaCouriersController extends AdminPocztaPolskaController {
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
$this->module = Module::getInstanceByName('pocztapolskaen');
|
||||
$this->bootstrap = true;
|
||||
$this->context = Context::getContext();
|
||||
$this->table = 'pp_courier';
|
||||
$this->list_id = 'pp_courier';
|
||||
$this->identifier = 'id_pp_courier';
|
||||
$this->className = 'PPCourier';
|
||||
$this->lang = true;
|
||||
$this->_defaultOrderBy = '';
|
||||
$this->display = 'add';
|
||||
$this->multiple_fieldsets = true;
|
||||
$this->page_header_toolbar_title = $this->l('Dodaj nowe zamówienie');
|
||||
$this->_prepareFormFields();
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiedzialna za przygotowanie pol formularza
|
||||
*/
|
||||
protected function _prepareFormFields() {
|
||||
$this->fields_form[0] = array(
|
||||
'form' => array(
|
||||
'panelClass' => 'col-lg-12',
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Szacowana masa przesyłek'),
|
||||
'name' => 'shipment_mass',
|
||||
'required' => true,
|
||||
'class' => 'fixed-width-xxl',
|
||||
'col' => '9',
|
||||
'suffix' => 'kg',
|
||||
),
|
||||
array(
|
||||
'type' => 'date',
|
||||
'label' => $this->l('Data odbioru'),
|
||||
'name' => 'receipt_date',
|
||||
'maxlength' => 10,
|
||||
'required' => true,
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Szacowana ilość przesyłek'),
|
||||
'name' => 'shipment_quantity',
|
||||
'class' => 'fixed-width-xxl',
|
||||
'required' => true,
|
||||
'col' => '9',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Oczekiwana godzina odbioru'),
|
||||
'name' => 'receipt_hour',
|
||||
'required' => true,
|
||||
'col' => '9',
|
||||
'default_value' => 0,
|
||||
'options' => array(
|
||||
'query' => PocztaPolskaEn::getReceptionTime(),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
),
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Adres email do potwierdzenia kuriera'),
|
||||
'name' => 'confirm_email',
|
||||
'class' => 'fixed-width-xxl',
|
||||
'col' => '9',
|
||||
'required' => true,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
$this->fields_form[1] = array(
|
||||
'form' => array(
|
||||
'panelClass' => 'col-lg-6',
|
||||
'legend' => array(
|
||||
'title' => $this->l('Nadawca'),
|
||||
),
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Nazwa'),
|
||||
'name' => 'sender_name',
|
||||
'required' => true,
|
||||
'col' => '9',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Ulica'),
|
||||
'name' => 'sender_street',
|
||||
'required' => true,
|
||||
'col' => '9',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Numer domu'),
|
||||
'name' => 'sender_home_number',
|
||||
'col' => '9',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Numer mieszkania'),
|
||||
'name' => 'sender_local_number',
|
||||
'col' => '9',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Kod pocztowy'),
|
||||
'name' => 'sender_postal_code',
|
||||
'required' => true,
|
||||
'col' => '9',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Miejscowość'),
|
||||
'name' => 'sender_place',
|
||||
'required' => true,
|
||||
'col' => '9',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Kraj'),
|
||||
'name' => 'sender_country',
|
||||
'required' => true,
|
||||
'col' => '9',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Email'),
|
||||
'name' => 'sender_email',
|
||||
'col' => '9',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Telefon kom'),
|
||||
'name' => 'sender_mobile_phone',
|
||||
'col' => '9',
|
||||
),
|
||||
)
|
||||
),
|
||||
);
|
||||
$this->fields_form[2] = array(
|
||||
'form' => array(
|
||||
'panelClass' => 'col-lg-6',
|
||||
'legend' => array(
|
||||
'title' => $this->l('Miejsce odbioru'),
|
||||
),
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Nazwa'),
|
||||
'name' => 'customer_name',
|
||||
'required' => true,
|
||||
'col' => '9',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Ulica'),
|
||||
'name' => 'customer_street',
|
||||
'required' => true,
|
||||
'col' => '9',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Numer domu'),
|
||||
'name' => 'customer_home_number',
|
||||
'col' => '9',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Numer mieszkania'),
|
||||
'name' => 'customer_local_number',
|
||||
'col' => '9',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Kod pocztowy'),
|
||||
'name' => 'customer_postal_code',
|
||||
'required' => true,
|
||||
'col' => '9',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Miejscowość'),
|
||||
'name' => 'customer_place',
|
||||
'required' => true,
|
||||
'col' => '9',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Kraj'),
|
||||
'name' => 'customer_country',
|
||||
'required' => true,
|
||||
'col' => '9',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Email'),
|
||||
'name' => 'customer_email',
|
||||
'col' => '9',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Telefon kom'),
|
||||
'name' => 'customer_mobile_phone',
|
||||
'col' => '9',
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
$this->fields_form[3] = array(
|
||||
'form' => array(
|
||||
'panelClass' => 'col-lg-12',
|
||||
'submit' => array(
|
||||
'title' => $this->l('Wyślij'),
|
||||
)
|
||||
),
|
||||
);
|
||||
$this->fields_value = array(
|
||||
'receipt_date' => date('Y-m-d'),
|
||||
);
|
||||
$this->base_tpl_form = 'views/templates/admin/controllers/couriers/form.tpl';
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiedzialna za renderowanie formularza
|
||||
*/
|
||||
public function renderForm() {
|
||||
if (!$this->default_form_language) {
|
||||
$this->getLanguages();
|
||||
}
|
||||
|
||||
if (Tools::getValue('submitFormAjax')) {
|
||||
$this->content .= $this->context->smarty->fetch('form_submit_ajax.tpl');
|
||||
}
|
||||
|
||||
if ($this->fields_form && is_array($this->fields_form)) {
|
||||
if (!$this->multiple_fieldsets) {
|
||||
$this->fields_form = array(array('form' => $this->fields_form));
|
||||
}
|
||||
|
||||
// For add a fields via an override of $fields_form, use $fields_form_override
|
||||
if (is_array($this->fields_form_override) && !empty($this->fields_form_override)) {
|
||||
$this->fields_form[0]['form']['input'] = array_merge($this->fields_form[0]['form']['input'], $this->fields_form_override);
|
||||
}
|
||||
|
||||
$fields_value = $this->getFieldsValue($this->object);
|
||||
|
||||
Hook::exec('action' . $this->controller_name . 'FormModifier', array(
|
||||
'fields' => &$this->fields_form,
|
||||
'fields_value' => &$fields_value,
|
||||
'form_vars' => &$this->tpl_form_vars,
|
||||
));
|
||||
|
||||
$helper = new HelperForm($this);
|
||||
$helper->base_folder = _PS_MODULE_DIR_ . $this->module->name . DIRECTORY_SEPARATOR;
|
||||
$this->setHelperDisplay($helper);
|
||||
$helper->fields_value = $fields_value;
|
||||
$helper->submit_action = $this->submit_action;
|
||||
$helper->tpl_vars = $this->getTemplateFormVars();
|
||||
$helper->show_cancel_button = (isset($this->show_form_cancel_button)) ? $this->show_form_cancel_button : ($this->display == 'add' || $this->display == 'edit');
|
||||
|
||||
$back = Tools::safeOutput(Tools::getValue('back', ''));
|
||||
if (empty($back)) {
|
||||
$back = self::$currentIndex . '&token=' . $this->token;
|
||||
}
|
||||
if (!Validate::isCleanHtml($back)) {
|
||||
die(Tools::displayError());
|
||||
}
|
||||
|
||||
$helper->back_url = $back;
|
||||
!is_null($this->base_tpl_form) ? $helper->base_tpl = $this->base_tpl_form : '';
|
||||
if ($this->tabAccess['view']) {
|
||||
if (Tools::getValue('back')) {
|
||||
$helper->tpl_vars['back'] = Tools::safeOutput(Tools::getValue('back'));
|
||||
} else {
|
||||
$helper->tpl_vars['back'] = Tools::safeOutput(Tools::getValue(self::$currentIndex . '&token=' . $this->token));
|
||||
}
|
||||
}
|
||||
$form = $helper->generateForm($this->fields_form);
|
||||
|
||||
return $form;
|
||||
}
|
||||
}
|
||||
|
||||
public function setMedia($isNewTheme = false) {
|
||||
parent::setMedia();
|
||||
$this->addCSS(__PS_BASE_URI__ . 'modules/' . $this->module->name . '/views/templates/admin/css/couriers.css');
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiedzialna za zapis kuriera
|
||||
*/
|
||||
public function processSave() {
|
||||
if (!isset($this->className) || empty($this->className)) {
|
||||
return false;
|
||||
}
|
||||
$this->validateRules();
|
||||
if (count($this->errors) <= 0) {
|
||||
$this->object = new $this->className();
|
||||
|
||||
$this->copyFromPost($this->object, $this->table);
|
||||
$this->beforeAdd($this->object);
|
||||
if (!$this->object->add()) {
|
||||
$this->errors = $this->object->errors;
|
||||
}
|
||||
}
|
||||
$this->display = 'add';
|
||||
$this->errors = array_unique($this->errors);
|
||||
if (!empty($this->errors)) {
|
||||
|
||||
$temp = $this->errors;
|
||||
$this->errors = array();
|
||||
|
||||
foreach ($temp as $error) {
|
||||
$this->errors[] = $error;
|
||||
}
|
||||
|
||||
return $this->errors;
|
||||
}
|
||||
$this->redirect_after = self::$currentIndex . '&conf=35&token=' . $this->token;
|
||||
return $this->object;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,947 @@
|
||||
<?php
|
||||
|
||||
require_once(__DIR__ . '/AdminPocztaPolskaController.php');
|
||||
|
||||
/**
|
||||
* Klasa odpowiadajaca za obsulge przesyłek
|
||||
*/
|
||||
class AdminPocztaPolskaOrdersController extends AdminPocztaPolskaController {
|
||||
|
||||
public $toolbar_title;
|
||||
protected $statuses_array = array();
|
||||
protected $actions_available = array('view', 'deleteshipment', 'pack', 'downloadlabel', 'printlabel');
|
||||
protected $actions = array('view', 'deleteshipment', 'pack', 'downloadlabel', 'printlabel');
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
|
||||
$this->module = Module::getInstanceByName('pocztapolskaen');
|
||||
$this->bootstrap = true;
|
||||
$this->table = 'orders';
|
||||
$this->className = 'PPOrder';
|
||||
$this->identifier = 'id_pp_order';
|
||||
$this->lang = false;
|
||||
$this->explicitSelect = true;
|
||||
$this->allow_export = false;
|
||||
$this->multiple_fieldsets = true;
|
||||
$this->context = Context::getContext();
|
||||
$this->_use_found_rows = true;
|
||||
$this->_prepareOrderStatuses();
|
||||
$this->_prepareListFields();
|
||||
$this->_prepareListQuery();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiedzialana za generowanie listy jaka ma sie wyswietlic
|
||||
*/
|
||||
public function renderList() {
|
||||
$this->_prepareMassActions();
|
||||
$this->tpl_list_vars['order_statuses'] = $this->statuses_array;
|
||||
if (!($this->fields_list && is_array($this->fields_list))) {
|
||||
return false;
|
||||
}
|
||||
if (!isset($this->context->cookie->pocztapolska_en_reload_data_ts) || time() >= $this->context->cookie->pocztapolska_en_reload_data_ts) {
|
||||
|
||||
|
||||
|
||||
if((int)Configuration::get(PPSetting::PP_IS_CONNECTED)){
|
||||
PPPostOffice::reloadData();
|
||||
PPOrderSet::reloadData();
|
||||
PPProfileAddress::reloadData();
|
||||
}
|
||||
|
||||
$this->context->cookie->pocztapolska_en_reload_data_ts = time() + PocztaPolskaEn::RELOAD_DATA_INTERVAL;
|
||||
|
||||
}
|
||||
$this->getList($this->context->language->id);
|
||||
|
||||
// If list has 'active' field, we automatically create bulk action
|
||||
if (isset($this->fields_list) && is_array($this->fields_list) && array_key_exists('active', $this->fields_list) && !empty($this->fields_list['active'])) {
|
||||
if (!is_array($this->bulk_actions)) {
|
||||
$this->bulk_actions = array();
|
||||
}
|
||||
|
||||
$this->bulk_actions = array_merge(array(
|
||||
'enableSelection' => array(
|
||||
'text' => $this->l('Enable selection'),
|
||||
'icon' => 'icon-power-off text-success'
|
||||
),
|
||||
'disableSelection' => array(
|
||||
'text' => $this->l('Disable selection'),
|
||||
'icon' => 'icon-power-off text-danger'
|
||||
),
|
||||
'divider' => array(
|
||||
'text' => 'divider'
|
||||
)
|
||||
), $this->bulk_actions);
|
||||
}
|
||||
$helper = new HelperList();
|
||||
$helper->module = $this->module;
|
||||
// Empty list is ok
|
||||
if (!is_array($this->_list)) {
|
||||
$this->displayWarning($this->l('Bad SQL query', 'Helper') . '<br />' . htmlspecialchars($this->_list_error));
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->setHelperDisplay($helper);
|
||||
$helper->_default_pagination = $this->_default_pagination;
|
||||
$helper->_pagination = $this->_pagination;
|
||||
$helper->tpl_vars = $this->getTemplateListVars();
|
||||
$helper->tpl_delete_link_vars = $this->tpl_delete_link_vars;
|
||||
|
||||
// For compatibility reasons, we have to check standard actions in class attributes
|
||||
foreach ($this->actions_available as $action) {
|
||||
if (!in_array($action, $this->actions) && isset($this->$action) && $this->$action) {
|
||||
$this->actions[] = $action;
|
||||
}
|
||||
}
|
||||
$helper->tpl_vars['fields_hidden'] = $this->_getOrderDetail();
|
||||
$helper->is_cms = $this->is_cms;
|
||||
$list = $helper->generateList($this->_list, $this->fields_list);
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowedzialna za przekazanie dodatkowych informacji do listy dla każdego rekordu
|
||||
*/
|
||||
private function _getOrderDetail() {
|
||||
$arr = array();
|
||||
$url = Context::getContext()->link->getAdminLink('AdminOrders');
|
||||
|
||||
foreach ($this->_list as $k => $item) {
|
||||
$arr[$k]['id_order'] = $item['id_order'];
|
||||
$arr[$k]['point'] = $item['point'];
|
||||
$arr[$k]['pni'] = $item['pni'];
|
||||
$arr[$k]['weight'] = $item['weight'];
|
||||
$arr[$k]['amount'] = $item['amount'];
|
||||
$arr[$k]['amount_number'] = $item['amount_number'];
|
||||
$arr[$k]['total'] = $item['total'];
|
||||
$arr[$k]['name'] = $item['name'];
|
||||
$arr[$k]['shipment_number'] = $item['number'];
|
||||
$arr[$k]['id_envelope'] = $item['id_envelope'];
|
||||
$arr[$k]['reference'] = $item['reference'];
|
||||
$arr[$k]['package'] = PPSetting::getPackageByOrderDelvery($item['id_carrier']);
|
||||
$arr[$k]['is_cod'] = PPSetting::isCarrierIsCod($item['id_carrier']);
|
||||
$arr[$k]['url'] = $url . '&vieworder&id_order=' . $arr[$k]['id_order'];
|
||||
$arr[$k]['message'] = $item['message'];
|
||||
$arr[$k]['address'] = $item['address_pickup'];
|
||||
}
|
||||
return $arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiedzialna za kontrukcje url do generowania etykiety
|
||||
*/
|
||||
public function displayDownloadlabelLink($token = null, $id) {
|
||||
if (!array_key_exists('downloadlabel', self::$cache_lang)) {
|
||||
self::$cache_lang['downloadlabel'] = $this->l('Pobierz etykietę');
|
||||
}
|
||||
if (!isset($this->_shipments[$id])) {
|
||||
return '';
|
||||
}
|
||||
$this->context->smarty->assign(array(
|
||||
'href' => self::$currentIndex .
|
||||
'&' . $this->identifier . '=' . $id .
|
||||
'&action=downloadlabel&token=' . ($token != null ? $token : $this->token),
|
||||
'class' => 'downloadlabel',
|
||||
'action' => self::$cache_lang['downloadlabel'],
|
||||
));
|
||||
|
||||
return $this->context->smarty->fetch('helpers/list/list_action_default.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiedzialna za kontrukcje url do wydruku etykiety
|
||||
*/
|
||||
public function displayPrintlabelLink($token = null, $id) {
|
||||
if (!array_key_exists('printlabel', self::$cache_lang)) {
|
||||
self::$cache_lang['printlabel'] = $this->l('Drukuj etykietę');
|
||||
}
|
||||
if (!isset($this->_shipments[$id])) {
|
||||
return '';
|
||||
}
|
||||
$this->context->smarty->assign(array(
|
||||
'href' => self::$currentIndex .
|
||||
'&' . $this->identifier . '=' . $id .
|
||||
'&action=printlabel&token=' . ($token != null ? $token : $this->token),
|
||||
'class' => 'printlabel',
|
||||
'action' => self::$cache_lang['printlabel'],
|
||||
));
|
||||
return $this->context->smarty->fetch(_PS_MODULE_DIR_ . $this->module->name . DIRECTORY_SEPARATOR . 'views/templates/admin/list_action_pack_inline.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiedzialna za konstrukcje url do podglądu zamówienia
|
||||
*/
|
||||
public function displayViewLink($token = null, $id) {
|
||||
if (!array_key_exists('view', self::$cache_lang)) {
|
||||
self::$cache_lang['view'] = $this->l('Zobacz');
|
||||
}
|
||||
if($this->module->is1770()){
|
||||
$href = Context::getContext()->link->getAdminLink('AdminOrders', true, [], ['id_order'=> $id, 'action' => 'vieworder']);
|
||||
}
|
||||
else{
|
||||
$href = Context::getContext()->link->getAdminLink('AdminOrders', true) .
|
||||
'&id_order=' . $id .
|
||||
'&vieworder';
|
||||
}
|
||||
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'href' => $href,
|
||||
'action' => self::$cache_lang['view'],
|
||||
));
|
||||
|
||||
return $this->context->smarty->fetch('helpers/list/list_action_view.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiedzialna za konstrukcje url do akcji pakowania przesyłki
|
||||
*/
|
||||
public function displayPackLink($token = null, $id) {
|
||||
if (!array_key_exists('pack', self::$cache_lang)) {
|
||||
self::$cache_lang['pack'] = $this->l('Spakuj');
|
||||
}
|
||||
if (isset($this->_shipments[$id])) {
|
||||
return '';
|
||||
}
|
||||
$this->context->smarty->assign(array(
|
||||
'href' => '#',
|
||||
'class' => 'pack_inline_action',
|
||||
'action' => self::$cache_lang['pack'],
|
||||
));
|
||||
|
||||
return $this->context->smarty->fetch(_PS_MODULE_DIR_ . $this->module->name . DIRECTORY_SEPARATOR . 'views/templates/admin/list_action_default.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
* metoda inicjujaca toolbar w adminie dla danego controllera
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function initToolbar() {
|
||||
parent::initToolbar();
|
||||
unset($this->toolbar_btn['new']);
|
||||
$this->toolbar_btn[''] = array('desc' => '');
|
||||
return $this->toolbar_btn;
|
||||
}
|
||||
|
||||
/**
|
||||
* metoda odpowiedziala na obsluge zadan dla danego controllera
|
||||
*/
|
||||
public function initProcess() {
|
||||
parent::initProcess();
|
||||
if (Tools::isSubmit('submitBulkdownloadLabelsorders')) {
|
||||
$this->action = 'bulkDownloadLabels';
|
||||
} else if (Tools::isSubmit('submitBulkprintLabelsorders')) {
|
||||
$this->action = 'bulkPrintLabels';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* metoda odpowiedzialna za obsluge zadania po jego wykonaniu
|
||||
* @return mixed
|
||||
*/
|
||||
public function postProcess() {
|
||||
if ($this->action == 'view') {
|
||||
$href = Context::getContext()->link->getAdminLink('AdminOrders');
|
||||
$href .= '&vieworder&id_order=' . Tools::getValue($this->identifier);
|
||||
Tools::redirectAdmin($href);
|
||||
return;
|
||||
}
|
||||
return parent::postProcess();
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiedzialna za knstrukcje zapytania sql listy
|
||||
*/
|
||||
protected function _prepareListQuery() {
|
||||
$deliveries = PPSetting::getPPDelivery();
|
||||
$this->_select = '
|
||||
a.id_order,
|
||||
a.id_order as id_pp_order,
|
||||
o.shipment_number as number,
|
||||
o.id_buffor as id_buffor,
|
||||
o.id_shipment,
|
||||
o.shipment_type,
|
||||
o.send_date,
|
||||
a.date_add as order_date,
|
||||
osl.`name` AS `osname`,
|
||||
os.`color`,
|
||||
a.date_add as order_date,
|
||||
CONCAT(LEFT(c.`firstname`, 1), \'. \', c.`lastname`) AS `customer`,
|
||||
osl.`name` AS `osname`,
|
||||
CONCAT(address.address1," ",address.address2,",",address.postcode," ",address.city,",",country_lang.name) as address,
|
||||
CONCAT(address.address1," ",address.address2,","," ",address.city) as address_pickup,
|
||||
o.point,
|
||||
o.pni,
|
||||
oc.`weight`,
|
||||
"10000" as amount,
|
||||
"123" as amount_number,
|
||||
a.`total_paid_tax_incl` as total,
|
||||
oset.`id_envelope`,
|
||||
a.`id_customer`,
|
||||
a.`reference`,
|
||||
oc.id_carrier,
|
||||
(SELECT `message` FROM `'._DB_PREFIX_.'message` WHERE `id_order` = a.id_order ORDER BY `id_message` LIMIT 1) as message
|
||||
';
|
||||
$this->_join = '
|
||||
LEFT JOIN `' . _DB_PREFIX_ . 'pocztapolskaen_order` o ON (o.`id_order` = a.`id_order`)
|
||||
LEFT JOIN `' . _DB_PREFIX_ . 'pocztapolskaen_order_set` oset ON (oset.`id_en` = o.`id_buffor`)
|
||||
LEFT JOIN `' . _DB_PREFIX_ . 'customer` c ON (c.`id_customer` = a.`id_customer`)
|
||||
LEFT JOIN `' . _DB_PREFIX_ . 'address` address ON address.id_address = a.id_address_delivery
|
||||
LEFT JOIN `' . _DB_PREFIX_ . 'order_carrier` oc ON (a.`id_order` = oc.`id_order`)
|
||||
LEFT JOIN `' . _DB_PREFIX_ . 'country` country ON address.id_country = country.id_country
|
||||
LEFT JOIN `' . _DB_PREFIX_ . 'country_lang` country_lang ON (country.`id_country` = country_lang.`id_country` AND country_lang.`id_lang` = ' . (int) $this->context->language->id . ')
|
||||
LEFT JOIN `' . _DB_PREFIX_ . 'order_state` os ON (os.`id_order_state` = a.`current_state`)
|
||||
LEFT JOIN `' . _DB_PREFIX_ . 'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = ' . (int) $this->context->language->id . ')';
|
||||
$this->_orderBy = 'a.id_order';
|
||||
$this->_orderWay = 'DESC';
|
||||
$this->_where .= !empty($deliveries) ? ' and (a.id_carrier in(' . implode(PPSetting::PP_SEPARATOR, $deliveries) . ') or not o.id_order is null)' : 'and not o.id_order is null ';
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda bydująca tabliece statusów zamówień
|
||||
*/
|
||||
protected function _prepareOrderStatuses() {
|
||||
$statuses = OrderState::getOrderStates((int) $this->context->language->id);
|
||||
foreach ($statuses as $status) {
|
||||
$this->statuses_array[$status['id_order_state']] = $status['name'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiedzialna za przygotowanie kolumn listy
|
||||
*/
|
||||
protected function _prepareListFields() {
|
||||
$this->fields_list = array(
|
||||
'id_order' => array(
|
||||
'title' => $this->l('ID'),
|
||||
'align' => 'text-center',
|
||||
'class' => 'fixed-width-xs',
|
||||
'filter_key' => 'o!id_order'
|
||||
),
|
||||
'shipment_type' => array(
|
||||
'title' => $this->l('Rodzaj przesyłki'),
|
||||
'havingFilter' => true,
|
||||
'filter_key' => 'o!shipment_type',
|
||||
'type' => 'select',
|
||||
'list' => PocztaPolskaEn::getPPPackages(false),
|
||||
),
|
||||
'customer' => array(
|
||||
'title' => $this->l('Klient'),
|
||||
'havingFilter' => true,
|
||||
'type' => 'html',
|
||||
),
|
||||
'address' => array(
|
||||
'title' => $this->l('Adres dostawy'),
|
||||
'havingFilter' => true,
|
||||
),
|
||||
'osname' => array(
|
||||
'title' => $this->l('Status'),
|
||||
'type' => 'select',
|
||||
'color' => 'color',
|
||||
'list' => $this->statuses_array,
|
||||
'filter_key' => 'os!id_order_state',
|
||||
'filter_type' => 'int',
|
||||
'order_key' => 'osname',
|
||||
'class' => 'fixed-width-xl',
|
||||
'width' => '100'
|
||||
),
|
||||
'number' => array(
|
||||
'title' => $this->l('Numer przesyłki'),
|
||||
'havingFilter' => true,
|
||||
'filter_key' => 'o!shipment_number',
|
||||
),
|
||||
'order_date' => array(
|
||||
'title' => $this->l('Data zamówienia'),
|
||||
'type' => 'datetime',
|
||||
'filter_key' => 'a!date_add'
|
||||
),
|
||||
'send_date' => array(//ad shipment
|
||||
'title' => $this->l('Data utworzenia'),
|
||||
'type' => 'datetime',
|
||||
'filter_key' => 'o!send_date'
|
||||
),
|
||||
'post_date' => array(//send envelope
|
||||
'title' => $this->l('Data nadania'),
|
||||
'type' => 'date',
|
||||
'filter_key' => 'o!post_date'
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiedzialna za przygotowanie akcji grupowych
|
||||
*/
|
||||
protected function _prepareMassActions() {
|
||||
$this->bulk_actions = array(
|
||||
'pack' => array(
|
||||
'text' => $this->l('Spakuj'),
|
||||
'html' => '<a href="#" id="action_pack_modal"><i class="icon-send"></i> ' . $this->l('Spakuj') . '</a>'
|
||||
),
|
||||
'downloadLabels' => array(
|
||||
'text' => $this->l('Pobierz etykiety'),
|
||||
'icon' => 'icon-send',
|
||||
),
|
||||
'printLabels' => array(
|
||||
'text' => $this->l('Drukuj etykiety'),
|
||||
'icon' => 'icon-send',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda incjująca okna modalne
|
||||
*/
|
||||
public function initModal() {
|
||||
$this->_initPackModal();
|
||||
parent::initModal();
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiadajaca za przekazanie modal do widoku
|
||||
*/
|
||||
public function renderModal() {
|
||||
$modal_render = '';
|
||||
if (is_array($this->modals) && count($this->modals)) {
|
||||
foreach ($this->modals as $modal) {
|
||||
$this->context->smarty->assign($modal);
|
||||
if ($modal['modal_id'] == 'packModal') {
|
||||
$modal_render .= $this->context->smarty->fetch(_PS_MODULE_DIR_ . $this->module->name . DIRECTORY_SEPARATOR . 'views/templates/admin/controllers/orders/pack_modal.tpl');
|
||||
} else {
|
||||
$modal_render .= $this->context->smarty->fetch('modal.tpl');
|
||||
}
|
||||
}
|
||||
}
|
||||
return $modal_render;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda incjująca okno modalne do pakowania przesyłek
|
||||
*/
|
||||
protected function _initPackModal() {
|
||||
$this->setMedia();
|
||||
require_once(__DIR__ . '/../../helper/AdminPocztaPolskaOrdersHelperForm.php');
|
||||
$helper = new AdminPocztaPolskaOrdersHelperForm();
|
||||
$content = $helper->generateForm();
|
||||
$this->modals[] = array(
|
||||
'currentToken' => $this->token,
|
||||
'modal_id' => 'packModal',
|
||||
'modal_class' => 'modal-lg',
|
||||
'modal_title' => $this->l('Dodawanie nowej przesyłki dla zamówienia:'),
|
||||
'modal_content' => '<div id="services" class="modal-body" style="max-height: 70vh;overflow-y: auto;">' . $content . '</div>',
|
||||
'modal_actions' => array(
|
||||
array(
|
||||
'type' => 'link',
|
||||
'label' => $this->l('Utwórz przesyłkę'),
|
||||
'href' => '#',
|
||||
'class' => 'btn btn-primary pack_modal_next_button'
|
||||
)
|
||||
)
|
||||
);
|
||||
Context::getContext()->override_controller_name_for_translations = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* metoda odpowiedzialna za dolaczenie dotatkowych plikow do widoku
|
||||
* @param bool $isNewTheme
|
||||
*/
|
||||
public function setMedia($isNewTheme = false) {
|
||||
parent::setMedia();
|
||||
$this->addJS(__PS_BASE_URI__ . 'modules/' . $this->module->name . '/views/templates/admin/js/settings.js');
|
||||
$this->addJS(__PS_BASE_URI__ . 'modules/' . $this->module->name . '/views/templates/admin/js/pack.js');
|
||||
$this->addJS('https://mapa.ecommerce.poczta-polska.pl/widget/scripts/ppwidget.js');
|
||||
$this->addCSS(__PS_BASE_URI__ . 'modules/' . $this->module->name . '/views/templates/admin/css/orders.css');
|
||||
$this->addJS(__PS_BASE_URI__ . 'modules/' . $this->module->name . '/views/templates/admin/js/orders.js');
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowidająca za waliadacje paczki
|
||||
*/
|
||||
public function ajaxProcessValidatePackage() {
|
||||
$pp_package = Tools::getValue('pp_packages', '');
|
||||
$id = Tools::getValue('id_order', '');
|
||||
$values = PPPackage::getValues($pp_package, PPSetting::getAllValues());
|
||||
$ppOrder = PPOrder::findByOrder($id);
|
||||
$package = new PPPackage($pp_package, $ppOrder);
|
||||
$package->loadFromArray($values);
|
||||
$result['errors'] = $package->validateFields();
|
||||
die(Tools::jsonEncode($result));
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowidająca za akcje pakowanie paczki.
|
||||
*/
|
||||
public function ajaxProcessPackOrder() {
|
||||
$result = array('success' => true, 'errors' => array(), 'id_buffor' => '', 'id_en' => '');
|
||||
$id = Tools::getValue('id_order', array());
|
||||
$order = new Order($id);
|
||||
$pp_package = Tools::getValue('pp_packages', '');
|
||||
$ppOrder = PPOrder::findByOrder($id);
|
||||
$values = PPPackage::getValues($pp_package, PPSetting::getAllValues());
|
||||
$package = new PPPackage($pp_package, $ppOrder);
|
||||
$package->loadFromArray($values);
|
||||
$packageResult = $package->save();
|
||||
if ($packageResult === false) {
|
||||
$result['errors'] = $package->errors;
|
||||
$result['success'] = false;
|
||||
} else {
|
||||
if (isset($packageResult[0]['guid'])) {
|
||||
$ppOrder->id_shipment = $packageResult[0]['guid'];
|
||||
$ppOrder->shipment_number = $packageResult[0]['numerNadania'];
|
||||
} else {
|
||||
$ppOrder->id_shipment = $packageResult['guid'];
|
||||
$ppOrder->shipment_number = $packageResult['numerNadania'];
|
||||
}
|
||||
$ppOrder->id_buffor = $packageResult['id_buffor'];
|
||||
$ppOrder->shipment_type = $pp_package;
|
||||
$ppOrder->send_date = date('Y-m-d H:i:s');
|
||||
$ppOrder->post_date = null;
|
||||
$ppOrder->id_order = $id;
|
||||
$ppOrder->id_cart = $order->id_cart;
|
||||
if ($package->isOdbiorWPunkcie()) {
|
||||
$ppOrder->pni = $package->pni;
|
||||
$ppOrder->point = $package->pokaz_mape;
|
||||
}
|
||||
if (!$ppOrder->save()) {
|
||||
$result['errors'] = Tools::displayError($this->l('Błąd zapisu zamówienia'));
|
||||
$result['success'] = true;
|
||||
} else {
|
||||
$result['id_buffor'] = $ppOrder->getOrderSet()->id;
|
||||
$result['id_en'] = $ppOrder->id_buffor;
|
||||
$ppOrder->setOrderStatus(PPSetting::PP_STATUS_CREATE);
|
||||
$ppOrder->setOrderShipment();
|
||||
}
|
||||
}
|
||||
die(Tools::jsonEncode($result));
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiadajaca ca pobranie grupowe etykiet
|
||||
*/
|
||||
public function processBulkDownloadLabels() {
|
||||
$ids = Tools::getValue('ordersBox', array());
|
||||
if (empty($ids)) {
|
||||
$this->errors = $this->l('Nie można pobrać etykiet');
|
||||
return;
|
||||
}
|
||||
$pporders = PPOrder::getOrders($ids, false, true);
|
||||
if ($pporders->count() <= 0) {
|
||||
$this->errors = $this->l('Nie można pobrać etykiet');
|
||||
return;
|
||||
}
|
||||
$shipments = array();
|
||||
foreach ($pporders as $order) {
|
||||
$shipments[] = $order->id_shipment;
|
||||
}
|
||||
$pdf = ENadawca::PdfContent();
|
||||
//$content = $pdf->getAddresLabelByGuidCompact($shipments);
|
||||
$content = $pdf->getPrintForParcel($shipments);
|
||||
if ($pdf->hasErrors()) {
|
||||
$this->errors = $pdf->getErrors();
|
||||
} else {
|
||||
foreach ($pporders as $pporder) {
|
||||
$pporder->setOrderStatus(PPSetting::PP_STATUS_PRINT_LABEL);
|
||||
}
|
||||
header('Content-type: application/pdf');
|
||||
header('Content-Disposition: attachment; filename="Nalepki adresowe.pdf"');
|
||||
echo $content;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiadajaca za drukowanie grupowe etykiet
|
||||
*/
|
||||
public function processBulkPrintLabels() {
|
||||
$ids = Tools::getValue('ordersBox', array());
|
||||
if (empty($ids)) {
|
||||
$this->errors = $this->l('Nie można pobrać etykiet');
|
||||
return;
|
||||
}
|
||||
$pporders = PPOrder::getOrders($ids, false, true);
|
||||
if ($pporders->count() <= 0) {
|
||||
$this->errors = $this->l('Nie można pobrać etykiet');
|
||||
return;
|
||||
}
|
||||
$shipments = array();
|
||||
foreach ($pporders as $order) {
|
||||
$shipments[] = $order->id_shipment;
|
||||
}
|
||||
$pdf = ENadawca::PdfContent();
|
||||
//$content = $pdf->getAddresLabelByGuidCompact($shipments);
|
||||
$content = $pdf->getPrintForParcel($shipments);
|
||||
if ($pdf->hasErrors()) {
|
||||
$this->errors = $pdf->getErrors();
|
||||
} else {
|
||||
foreach ($pporders as $pporder) {
|
||||
$pporder->setOrderStatus(PPSetting::PP_STATUS_PRINT_LABEL);
|
||||
}
|
||||
header('Content-type: application/pdf');
|
||||
header('Content-Disposition: inline; filename="Nalepki adresowe.pdf"');
|
||||
header('Content-Transfer-Encoding: binary');
|
||||
header('Accept-Ranges: bytes');
|
||||
echo $content;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiadajaca za pobranie danych do wwygenrownia listy
|
||||
*/
|
||||
public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false) {
|
||||
parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop);
|
||||
$types = PocztaPolskaEn::getPPPackages(false);
|
||||
$sets = array();
|
||||
$buffors = new PrestaShopCollection('PPOrderSet');
|
||||
$buffors->sqlWhere('(a0.id_envelope is null OR a0.id_envelope=0)');
|
||||
foreach ($buffors as $c) {
|
||||
$sets[$c->id_en] = $c;
|
||||
}
|
||||
foreach ($this->_list as &$item) {
|
||||
if (!empty($item['id_shipment'])) {
|
||||
$this->_shipments[$item['id_order']] = array(
|
||||
'id_shipment' => $item['id_shipment']
|
||||
);
|
||||
}
|
||||
if (!empty($item['id_buffor']) && isset($sets[$item['id_buffor']])) {
|
||||
$this->_buffors[$item['id_order']] = $sets[$item['id_buffor']];
|
||||
}
|
||||
$item['shipment_type'] = isset($types[$item['shipment_type']]) ? $types[$item['shipment_type']] : $item['shipment_type'];
|
||||
$item['name'] = $item['reference'] . ', #' . $item['id_order'] . ', ' . $item['customer'] . '<br/>' . $item['address'];
|
||||
$item['total'] = Tools::ps_round($item['total'], _PS_PRICE_DISPLAY_PRECISION_);
|
||||
$item['weight'] = sprintf("%.3f ", $item['weight']);
|
||||
|
||||
if(!$this->module->is16()){
|
||||
$customerUrl = $this->context->link->getAdminLink('AdminCustomers', true, [], ['id_customer'=> $item['id_customer'], 'action' => 'viewcustomer']);
|
||||
}
|
||||
else{
|
||||
$customerUrl = $this->context->link->getAdminLink('AdminCustomers') . '&viewcustomer&id_customer=' . $item['id_customer'];
|
||||
}
|
||||
|
||||
|
||||
$item['customer'] = "<a href='{$customerUrl}' traget='_blank' title='{$item['customer']}'>{$item['customer']}</a>";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Metodą odpowiadająca za usuwanie przesyłek
|
||||
*/
|
||||
public function processDeleteshipment() {
|
||||
if (Validate::isLoadedObject($object = $this->loadObject())) {
|
||||
$envelope = ENadawca::Envelope();
|
||||
$envelope->clearByGuids($object->id_shipment, $object->id_buffor);
|
||||
if ($envelope->hasErrors()) {
|
||||
$this->errors = $envelope->getErrors();
|
||||
} else {
|
||||
$object->clearShipment();
|
||||
}
|
||||
}
|
||||
if (empty($this->errors)) {
|
||||
$this->redirect_after = self::$currentIndex . '&conf=36&token=' . $this->token;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowidająca za konstrukcje linku do usuwanie przesyłek
|
||||
*/
|
||||
public function displayDeleteshipmentLink($token = null, $id) {
|
||||
if (!array_key_exists('deleteshipment', self::$cache_lang)) {
|
||||
self::$cache_lang['deleteshipment'] = $this->l('Usuń przesyłki');
|
||||
}
|
||||
if (!isset($this->_shipments[$id])) {
|
||||
return '';
|
||||
}
|
||||
if (!isset($this->_buffors[$id])) {
|
||||
return '';
|
||||
}
|
||||
$this->context->smarty->assign(array(
|
||||
'href' => self::$currentIndex .
|
||||
'&' . $this->identifier . '=' . $id .
|
||||
'&action=deleteshipment&token=' . ($token != null ? $token : $this->token),
|
||||
'class' => 'deleteshipment',
|
||||
'action' => self::$cache_lang['deleteshipment'],
|
||||
));
|
||||
|
||||
return $this->context->smarty->fetch('helpers/list/list_action_default.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowidająca za ładowanie pojedyńczego rekordy
|
||||
*/
|
||||
protected function loadObject($opt = false) {
|
||||
if (!isset($this->className) || empty($this->className)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$id = (int) Tools::getValue($this->identifier);
|
||||
if ($id && Validate::isUnsignedId($id)) {
|
||||
$order = new Order($id);
|
||||
if (!$this->object) {
|
||||
$this->object = PPOrder::findByOrder($order->id);
|
||||
}
|
||||
if (Validate::isLoadedObject($this->object)) {
|
||||
return $this->object;
|
||||
}
|
||||
// throw exception
|
||||
$this->errors[] = Tools::displayError($this->l('The object cannot be loaded (or found)'));
|
||||
return false;
|
||||
} elseif ($opt) {
|
||||
if (!$this->object) {
|
||||
$this->object = new $this->className();
|
||||
}
|
||||
return $this->object;
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError($this->l('The object cannot be loaded (the identifier is missing or invalid)'));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiadajaca za pobranie pojedynczej etykiety
|
||||
*/
|
||||
public function processDownloadlabel() {
|
||||
if (Validate::isLoadedObject($object = $this->loadObject())) {
|
||||
$pdf = ENadawca::PdfContent();
|
||||
$content = $pdf->getPrintForParcel(array($object->id_shipment));
|
||||
if ($pdf->hasErrors()) {
|
||||
$this->errors = $pdf->getErrors();
|
||||
} else {
|
||||
$object->setOrderStatus(PPSetting::PP_STATUS_PRINT_LABEL);
|
||||
header('Content-type: application/pdf');
|
||||
header('Content-Disposition: attachment; filename="Nalepki adresowe.pdf"');
|
||||
echo $content;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function ajaxProcessPocztaPolskaOrderForm(){
|
||||
$idOrder = Tools::getValue('id_order', 0);
|
||||
|
||||
require_once($this->module->getLocalPath().'helper/AdminPocztaPolskaOrdersHelperForm.php');
|
||||
$helper = new AdminPocztaPolskaOrdersHelperForm();
|
||||
$content = $helper->generateForm();
|
||||
|
||||
$modal_conf = array(
|
||||
'currentToken' => Tools::getAdminTokenLite('AdminPocztaPolskaOrders'),
|
||||
'modal_id' => 'packModal',
|
||||
'modal_class' => 'modal-lg',
|
||||
'modal_title' => $this->l('Dodawanie nowej przesyłki dla zamówienia:'),
|
||||
'modal_content' => '<div id="services" class="modal-body" style="max-height: 70vh;overflow-y: auto;">' . $content . '</div>',
|
||||
'modal_actions' => array(
|
||||
array(
|
||||
'type' => 'link',
|
||||
'label' => $this->l('Utwórz przesyłkę'),
|
||||
'href' => '#',
|
||||
'class' => 'btn btn-primary pack_modal_next_button'
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$this->context->smarty->assign($modal_conf);
|
||||
$modal_render = '';
|
||||
$modal_render = $this->context->smarty->fetch(_PS_MODULE_DIR_ . $this->module->name . DIRECTORY_SEPARATOR . 'views/templates/admin/controllers/orders/pack_modal.tpl');
|
||||
|
||||
$module = Module::getInstanceByName('pocztapolskaen');
|
||||
|
||||
$order = new Order((int)$idOrder, (int)Configuration::get('PS_LANG_DEFAULT'));
|
||||
$pp_order = PPOrder::findByCart($order->id_cart, false);
|
||||
$delivery_address = new Address($order->id_address_delivery);
|
||||
$shipping = $order->getShipping();
|
||||
$tab_order = array();
|
||||
$customer = $order->getCustomer();
|
||||
$tab_order['name'] = "#".$order->id." ".$order->reference.' '.$this->l('od'). ' '.$customer->firstname.' '.$customer->lastname;
|
||||
$tab_order['id_order'] = $order->id;
|
||||
$tab_order['reference'] = $order->reference;
|
||||
$tab_order['total'] = Tools::ps_round($order->total_paid, _PS_PRICE_DISPLAY_PRECISION_);
|
||||
$tab_order['weight'] = sprintf("%.3f", $shipping[0]['weight']);
|
||||
$tab_order['package'] = PPSetting::getPackageByOrderDelvery($order->id_carrier);
|
||||
$tab_order['is_cod'] = PPSetting::isCarrierIsCod($order->id_carrier);
|
||||
$tab_order['pni'] = !is_null($pp_order)&&!is_null($pp_order->pni)?$pp_order->pni:'';
|
||||
$tab_order['point'] = !is_null($pp_order)&&is_string($pp_order->point)?$pp_order->point:'';
|
||||
$tab_order['shipment_number'] = !is_null($pp_order)&&!empty($pp_order->shipment_number)?$pp_order->shipment_number:'';
|
||||
$tab_order['message'] = $order->getFirstMessage();
|
||||
$tab_order['address'] = $delivery_address->address1.' '.$delivery_address->address2.', '.$delivery_address->city;
|
||||
|
||||
|
||||
$tabs = array();
|
||||
|
||||
if(!is_null($pp_order)){
|
||||
if(!empty($pp_order->point)){
|
||||
$tabs[0] = $this->l('ODBIÓR W PUNKCIE');
|
||||
}
|
||||
if(!empty($pp_order->shipment_number)){
|
||||
$tabs[1] = $this->l('POCZTA POLSKA PRZESYŁKA');
|
||||
}
|
||||
if(empty($pp_order->shipment_number) && empty($pp_order->point)){
|
||||
$tabs[2] = $this->l('POCZTA POLSKA - NADAJ PRZESYŁKĘ');
|
||||
}
|
||||
} else {
|
||||
$tabs[2] = $this->l('POCZTA POLSKA - NADAJ PRZESYŁKĘ');
|
||||
}
|
||||
|
||||
$content = '';
|
||||
foreach ($tabs as $k => $v) {
|
||||
$helper = new HelperForm();
|
||||
$helper->name_controller = 'pocztapolskaen_form';
|
||||
$helper->multiple_fieldsets = false;
|
||||
$helper->show_toolbar = false;
|
||||
$helper->module = $module;
|
||||
$helper->fields_value = $this->_getFieldsValue($pp_order);
|
||||
$helper->default_form_language = $this->context->language->id;
|
||||
$helper->tpl_vars['active_tab'] = '';
|
||||
$fields = $this->_getOrderFields($v, $k, $tab_order, $modal_render);
|
||||
$content .= $helper->generateForm($fields);
|
||||
}
|
||||
die($content);
|
||||
}
|
||||
|
||||
/**
|
||||
* metoda zwracaja dodatkowe informacje na temat przesylki PP
|
||||
* @param $pp_order
|
||||
* @return array
|
||||
*/
|
||||
private function _getFieldsValue($pp_order) {
|
||||
$module = Module::getInstanceByName('pocztapolskaen');
|
||||
|
||||
$tab = array();
|
||||
$packages = $module::getPPPackages(false);
|
||||
$orderSet = new PPOrderSet();
|
||||
|
||||
if(!is_null($pp_order)){
|
||||
$buffor = $orderSet->getByBuffor($pp_order->id_buffor);
|
||||
$tab = array(
|
||||
'wybrano_punkt' => $pp_order->point,
|
||||
'numer_nadania' => $pp_order->shipment_number,
|
||||
'rodzaj' => !empty($pp_order->shipment_type)?$packages[$pp_order->shipment_type]:'',
|
||||
'data_nadania' =>$buffor->post_date,
|
||||
//'link' => 'http://emonitoring.poczta-polska.pl/?numer='.$pp_order->shipment_number,
|
||||
);
|
||||
}
|
||||
return $tab;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda przygotowujaca dane do formularza wyswietlajacego podglad przesylki PP w zamowieniu
|
||||
* @param $title
|
||||
* @param $tab
|
||||
* @param $order
|
||||
* @param $modal
|
||||
* @return array
|
||||
*/
|
||||
protected function _getOrderFields($title, $tab, $order, $modal) {
|
||||
$fields = array();
|
||||
|
||||
switch ($tab) {
|
||||
case 0:
|
||||
$fields[]['form'] = array(
|
||||
'legend' => array(
|
||||
'icon' => 'icon-plane',
|
||||
'title' => $this->l($title),
|
||||
),
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'wybrano_punkt',
|
||||
'label' => $this->l('Wybrano punkt'),
|
||||
'disabled' => true
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'html_data',
|
||||
'label' => '',
|
||||
'html_content' => (empty($order['shipment_number'])?'<button type="button" data-id_order="'.$order['id_order'].'" data-point="'.$order['point'].'" data-pni="'.$order['pni'].'" data-weight="'.$order['weight'].'" data-total="'.$order['total'].'" data-name="'.$order['name'].'" data-reference="'.$order['reference'].'" data-package="'.$order['package'].'" data-is_cod="'.$order['is_cod'].'" data-message="'.$order['message'].'" data-address="'.$order['address'].'" class="btn btn-primary btn_add_package">' . $this->l('Utwórz przesyłkę') . '</button><div class="bootstrap">'.$modal.'</div>':''),
|
||||
),
|
||||
),
|
||||
);
|
||||
break;
|
||||
case 1:
|
||||
$fields[]['form'] = array(
|
||||
'legend' => array(
|
||||
'icon' => 'icon-globe',
|
||||
'title' => $this->l($title),
|
||||
),
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'html_data',
|
||||
'label' => '<b>' . $this->l('Przesyłki powiązane z tym zamówieniem') . '</b><hr>',
|
||||
'html_content' => '<a class="btn btn-default" href="'.$this->context->link->getAdminLink('AdminPocztaPolskaOrders', true).'&id_pp_order='.$order['id_order'].'&action=downloadlabel" >'.$this->l('Pobierz etykietę').'</a> <a class="btn btn-default" href="'.$this->context->link->getAdminLink('AdminPocztaPolskaOrders', true).'&id_pp_order='.$order['id_order'].'&action=printlabel" target="_blank">'.$this->l('Drukuj etykietę').'</a>',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'numer_nadania',
|
||||
'label' => $this->l('Numer nadania'),
|
||||
'disabled' => true
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'rodzaj',
|
||||
'label' => $this->l('Rodzaj'),
|
||||
'disabled' => true
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'data_nadania',
|
||||
'label' => $this->l('Data nadania'),
|
||||
'disabled' => true
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name'=>'link',
|
||||
'html_content' =>'<div style="height:30px; margin-top:8px;"><a target="_blank" style="padding-top:5px;" href="http://emonitoring.poczta-polska.pl/?numer=?'.$order['shipment_number'].'">http://emonitoring.poczta-polska.pl/?numer='.$order['shipment_number'].'</a></div>',
|
||||
'label' => $this->l('Link do śledzenia'),
|
||||
),
|
||||
),
|
||||
);
|
||||
break;
|
||||
case 2:
|
||||
$fields[]['form'] = array(
|
||||
'legend' => array(
|
||||
'icon' => 'icon-plane',
|
||||
'title' => $this->l($title),
|
||||
),
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'html_data',
|
||||
'label' => '',
|
||||
'html_content' => '<button type="button" data-id_order="'.$order['id_order'].'" data-point="'.$order['point'].'" data-pni="'.$order['pni'].'" data-weight="'.$order['weight'].'" data-total="'.$order['total'].'" data-name="'.$order['name'].'" data-reference="'.$order['reference'].'" data-package="'.$order['package'].'" data-is_cod="'.$order['is_cod'].'" data-message="'.$order['message'].'" data-address="'.$order['address'].'" class="btn btn-primary btn_add_package">' . $this->l('Utwórz przesyłkę') . '</button><div class="bootstrap">'.$modal.'</div>',
|
||||
),
|
||||
),
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiadajaca za drukowanie pojedynczej etykiety
|
||||
*/
|
||||
public function processPrintlabel() {
|
||||
if (Validate::isLoadedObject($object = $this->loadObject())) {
|
||||
$pdf = ENadawca::PdfContent();
|
||||
$content = $pdf->getPrintForParcel(array($object->id_shipment));
|
||||
|
||||
if ($pdf->hasErrors()) {
|
||||
$this->errors = $pdf->getErrors();
|
||||
} else {
|
||||
$object->setOrderStatus(PPSetting::PP_STATUS_PRINT_LABEL);
|
||||
|
||||
header('Content-type: application/pdf');
|
||||
header('Content-Disposition: inline; filename="Nalepki adresowe.pdf"');
|
||||
header('Content-Transfer-Encoding: binary');
|
||||
header('Accept-Ranges: bytes');
|
||||
echo $content;
|
||||
echo '<script type="text/javascript">alert("ASd");window.print();</script>';
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,776 @@
|
||||
<?php
|
||||
|
||||
require_once(__DIR__ . '/AdminPocztaPolskaController.php');
|
||||
|
||||
/**
|
||||
* Klasa odpowiadajaca za obsulge zbiorow
|
||||
*/
|
||||
class AdminPocztaPolskaOrdersSetsController extends AdminPocztaPolskaController {
|
||||
|
||||
public $toolbar_title;
|
||||
protected $statuses_array = array();
|
||||
protected $actions = array('view','edit', 'delete', 'sendoffice', 'downloadlabel', 'outboxbook', 'transfershipments', 'firmpocztabook', 'setactive');
|
||||
protected $actions_available = array('view','edit', 'delete', 'sendoffice', 'downloadlabel', 'outboxbook', 'firmpocztabook', 'transfershipments');
|
||||
public $offices_array;
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
|
||||
$this->module = Module::getInstanceByName('pocztapolskaen');
|
||||
$this->bootstrap = true;
|
||||
$this->table = 'pocztapolskaen_order_set';
|
||||
$this->className = 'PPOrderSet';
|
||||
$this->lang = false;
|
||||
$this->explicitSelect = true;
|
||||
$this->allow_export = false;
|
||||
$this->context = Context::getContext();
|
||||
$this->identifier = 'id_order_set';
|
||||
$offices = PPPostOffice::getCollection();
|
||||
foreach ($offices as $office) {
|
||||
$this->offices_array[$office->id_post_office] = $office->name;
|
||||
}
|
||||
$this->_prepareListQuery();
|
||||
$this->_prepareFieldsForm();
|
||||
$this->_prepareListFields();
|
||||
|
||||
}
|
||||
public function postProcess() {
|
||||
if ($this->action == 'view') {
|
||||
$href = Context::getContext()->link->getAdminLink('AdminPocztaPolskaOrdersSetsView', true);
|
||||
$href .= '&' . $this->identifier . '=' . Tools::getValue($this->identifier);
|
||||
Tools::redirectAdmin($href);
|
||||
return;
|
||||
}
|
||||
return parent::postProcess();
|
||||
}
|
||||
/**
|
||||
* Metoda odpowiedzialna za knstrukcje zapytania sql listy
|
||||
*/
|
||||
protected function _prepareListQuery() {
|
||||
$this->_select = 'a.`name`,a.`id_envelope`,if(a.active = 1 && a.id_envelope is null,"highlighted","") as class,a.`envelope_status`,po.`name` as post_office,(select COUNT(*) from ' . _DB_PREFIX_ . 'pocztapolskaen_order o WHERE o.`id_buffor` is not null AND o.`id_buffor` = a.`id_en`) as shipment_count';
|
||||
$this->_join = 'LEFT JOIN `' . _DB_PREFIX_ . 'pocztapolskaen_post_office` po ON (po.`id_post_office` = a.`id_post_office`)';
|
||||
$this->_orderBy = 'a.post_date';
|
||||
$this->_orderWay = 'DESC';
|
||||
$this->_use_found_rows = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiedzialna za przygotowanie kolumn listy
|
||||
*/
|
||||
protected function _prepareListFields() {
|
||||
$statuses = ENadawca::Envelope()->getStatuses();
|
||||
$this->fields_list = array(
|
||||
'id_order_set' => array(
|
||||
'title' => $this->l('ID'),
|
||||
'align' => 'text-center',
|
||||
'class' => 'fixed-width-xs'
|
||||
),
|
||||
'name' => array(
|
||||
'title' => $this->l('Nazwa'),
|
||||
'havingFilter' => true,
|
||||
),
|
||||
'shipment_count' => array(
|
||||
'title' => $this->l('Ilość przesyłek'),
|
||||
'havingFilter' => true,
|
||||
),
|
||||
'envelope_status' => array(
|
||||
'title' => $this->l('Status'),
|
||||
'type' => 'select',
|
||||
'filter_key' => 'a!envelope_status',
|
||||
'list' => is_array($statuses)?$statuses:array()
|
||||
),
|
||||
'post_office' => array(
|
||||
'title' => $this->l('Urząd nadania'),
|
||||
'type' => 'select',
|
||||
'filter_key' => 'po!id_post_office',
|
||||
'list' => is_array($this->offices_array)?$this->offices_array:array(),
|
||||
),
|
||||
'post_date' => array(
|
||||
'title' => $this->l('Data nadania'),
|
||||
'type' => 'date',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiedzialna za przygotowanie pol formularza
|
||||
*/
|
||||
protected function _prepareFieldsForm() {
|
||||
$this->fields_form = array(
|
||||
'legend' => array(
|
||||
'title' => $this->l('Zbiór'),
|
||||
),
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Nazwa zbioru'),
|
||||
'name' => 'name',
|
||||
'required' => true,
|
||||
'col' => '9',
|
||||
),
|
||||
array(
|
||||
'type' => 'date',
|
||||
'label' => $this->l('Planowana data nadania'),
|
||||
'name' => 'post_date',
|
||||
'maxlength' => 10,
|
||||
'required' => true,
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Urząd nadania'),
|
||||
'name' => 'id_post_office',
|
||||
'required' => true,
|
||||
'col' => '9',
|
||||
'options' => array(
|
||||
'query' => PPPostOffice::getCollection(true),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
),
|
||||
),
|
||||
array(
|
||||
'type' => 'hidden',
|
||||
'name' => 'set_date',
|
||||
),
|
||||
array(
|
||||
'type' => 'hidden',
|
||||
'name' => 'change_parcels',
|
||||
),
|
||||
),
|
||||
'submit' => array(
|
||||
'title' => $this->l('Save'),
|
||||
'id' =>'OrderSetSave'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiedzialana za generowanie listy jaka ma sie wyswietlic
|
||||
*/
|
||||
public function renderList() {
|
||||
if (!($this->fields_list && is_array($this->fields_list))) {
|
||||
return false;
|
||||
}
|
||||
if (!isset($this->context->cookie->pocztapolska_en_reload_data_ts) || time() >= $this->context->cookie->pocztapolska_en_reload_data_ts) {
|
||||
$expiredSets = PPOrderSet::getExpired('name');
|
||||
PPPostOffice::reloadData();
|
||||
PPOrderSet::reloadData(true);
|
||||
PPProfileAddress::reloadData();
|
||||
$this->context->cookie->pocztapolska_en_reload_data_ts = time() + PocztaPolskaEn::RELOAD_DATA_INTERVAL;
|
||||
if (!empty($expiredSets)) {
|
||||
$this->displayWarning(sprintf($this->l('Następujące zbiory zostały usunięte, ponieważ ich data nadania była starsza niż %s dni: %s'), PocztaPolskaEn::SET_EXPIRED_DAYS, implode(', ', $expiredSets)));
|
||||
}
|
||||
}
|
||||
|
||||
$this->getList($this->context->language->id);
|
||||
|
||||
// If list has 'active' field, we automatically create bulk action
|
||||
if (isset($this->fields_list) && is_array($this->fields_list) && array_key_exists('active', $this->fields_list) && !empty($this->fields_list['active'])) {
|
||||
if (!is_array($this->bulk_actions)) {
|
||||
$this->bulk_actions = array();
|
||||
}
|
||||
|
||||
$this->bulk_actions = array_merge(array(
|
||||
'enableSelection' => array(
|
||||
'text' => $this->l('Enable selection'),
|
||||
'icon' => 'icon-power-off text-success'
|
||||
),
|
||||
'disableSelection' => array(
|
||||
'text' => $this->l('Disable selection'),
|
||||
'icon' => 'icon-power-off text-danger'
|
||||
),
|
||||
'divider' => array(
|
||||
'text' => 'divider'
|
||||
)
|
||||
), $this->bulk_actions);
|
||||
}
|
||||
$helper = new HelperList();
|
||||
$helper->module = $this->module;
|
||||
// Empty list is ok
|
||||
if (!is_array($this->_list)) {
|
||||
$this->displayWarning($this->l('Bad SQL query', 'Helper') . '<br />' . htmlspecialchars($this->_list_error));
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->setHelperDisplay($helper);
|
||||
$helper->_default_pagination = $this->_default_pagination;
|
||||
$helper->_pagination = $this->_pagination;
|
||||
$helper->tpl_vars = $this->getTemplateListVars();
|
||||
$helper->tpl_delete_link_vars = $this->tpl_delete_link_vars;
|
||||
|
||||
// For compatibility reasons, we have to check standard actions in class attributes
|
||||
foreach ($this->actions_available as $action) {
|
||||
if (!in_array($action, $this->actions) && isset($this->$action) && $this->$action) {
|
||||
$this->actions[] = $action;
|
||||
}
|
||||
}
|
||||
|
||||
$helper->is_cms = $this->is_cms;
|
||||
$helper->sql = false;
|
||||
$list = $helper->generateList($this->_list, $this->fields_list);
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiedzialna za wysyłanie przesyłek
|
||||
*/
|
||||
public function processSendoffice() {
|
||||
if (Validate::isLoadedObject($object = $this->loadObject())) {
|
||||
$postOffice = $object->getPostOffice();
|
||||
$envelope = ENadawca::Envelope();
|
||||
if(PPSetting::dateDiff('now',$object->post_date) >=0){
|
||||
if (!empty($postOffice)) {
|
||||
$result = $envelope->send($postOffice->id_en, $object->id_en);
|
||||
if ($envelope->hasErrors()) {
|
||||
$this->errors = $envelope->getErrors();
|
||||
} else {
|
||||
$object->id_envelope = $result['idEnvelope'];
|
||||
$object->envelope_status = strtolower($result['envelopeStatus']);
|
||||
$object->save();
|
||||
$ppOrders = $object->getOrdersByBuffor($object->id_en);
|
||||
foreach ($ppOrders as $ppOrder) {
|
||||
$ppOrder->setOrderStatus(PPSetting::PP_STATUS_OFFICE_SEND);
|
||||
$ppOrder->post_date = $object->post_date;
|
||||
$ppOrder->save();
|
||||
}
|
||||
PPOrderSet::reloadData();
|
||||
$this->redirect_after = self::$currentIndex . '&conf=33&id_buffor='.$object->id.'&token=' . $this->token;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = $this->l('Data nadania do urzędu nie może być wsteczna. Przejdź od edycji obiektu i zmień datę nadania');
|
||||
}
|
||||
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError($this->l('An error occurred while updating an object.')) .
|
||||
' <b>' . $this->table . '</b> ' . Tools::displayError($this->l('(cannot load object)'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiadajaca za pobranie pojedynczej etykiety
|
||||
*/
|
||||
public function processDownloadLabel() {
|
||||
if (Validate::isLoadedObject($object = $this->loadObject())) {
|
||||
$pdf = ENadawca::PdfContent();
|
||||
$guids = $object->getOrdersGuidsByBuffor($object->id_en);
|
||||
$content = $pdf->getPrintForParcel($guids);
|
||||
//$content = $pdf->getAddresLabelCompact($object->id_envelope);
|
||||
if ($pdf->hasErrors()) {
|
||||
$this->errors = $pdf->getErrors();
|
||||
} else {
|
||||
$ppOrders = $object->getOrdersByBuffor($object->id_en);
|
||||
foreach ($ppOrders as $ppOrder) {
|
||||
$ppOrder->setOrderStatus(PPSetting::PP_STATUS_PRINT_LABEL);
|
||||
}
|
||||
header('Content-type: application/pdf');
|
||||
header('Content-Disposition: attachment; filename="Nalepka_adresowa.pdf"');
|
||||
echo $content;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiadajaca za pobranie pojedynczej poczty firmowej
|
||||
*/
|
||||
public function processFirmpocztabook() {
|
||||
if (Validate::isLoadedObject($object = $this->loadObject())) {
|
||||
$pdf = ENadawca::PdfContent();
|
||||
$content = $pdf->getFirmowaPocztaBook($object->id_envelope);
|
||||
if ($pdf->hasErrors()) {
|
||||
$this->errors = $pdf->getErrors();
|
||||
} else {
|
||||
header('Content-type: application/pdf');
|
||||
header('Content-Disposition: attachment; filename="Poczta_firmowa.pdf"');
|
||||
echo $content;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiadajaca za konstrukcje linku do pobrania poczty firmowej
|
||||
*/
|
||||
public function displayFirmpocztabookLink($token = null, $id) {
|
||||
if (!array_key_exists('firmpocztabook', self::$cache_lang)) {
|
||||
self::$cache_lang['firmpocztabook'] = $this->l('Poczta firmowa');
|
||||
}
|
||||
if (!isset($this->_envelopes[$id])) {
|
||||
return '';
|
||||
}
|
||||
$this->context->smarty->assign(array(
|
||||
'href' => self::$currentIndex .
|
||||
'&' . $this->identifier . '=' . $id .
|
||||
'&action=firmpocztabook&token=' . ($token != null ? $token : $this->token),
|
||||
'action' => self::$cache_lang['firmpocztabook'],
|
||||
));
|
||||
|
||||
return $this->context->smarty->fetch('helpers/list/list_action_default.tpl');
|
||||
}
|
||||
|
||||
public function displaySetactiveLink($token = null, $id) {
|
||||
if (!array_key_exists('setactive', self::$cache_lang)) {
|
||||
self::$cache_lang['setactive'] = $this->l('Ustaw jako domyślny');
|
||||
}
|
||||
if (!isset($this->_envelopes[$id])) {
|
||||
$this->context->smarty->assign(array(
|
||||
'href' => self::$currentIndex .
|
||||
'&' . $this->identifier . '=' . $id .
|
||||
'&action=setactive&token=' . ($token != null ? $token : $this->token),
|
||||
'action' => self::$cache_lang['setactive'],
|
||||
));
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
return $this->context->smarty->fetch('helpers/list/list_action_default.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
* metoda odpowiedzialna za ustawienia wybranego zbioru jako aktywnego
|
||||
*/
|
||||
public function processSetactive(){
|
||||
if (Validate::isLoadedObject($object = $this->loadObject())) {
|
||||
$active = $object::getActiveCollection();
|
||||
$buffor = $active->getFirst();
|
||||
|
||||
if(is_object($buffor)){
|
||||
$buffor->active = 0;
|
||||
$buffor->update();
|
||||
}
|
||||
$object->active = 1;
|
||||
$object->update();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiadajaca za pobranie ksiazki nadawczej
|
||||
*/
|
||||
public function processOutboxBook() {
|
||||
if (Validate::isLoadedObject($object = $this->loadObject())) {
|
||||
$pdf = ENadawca::PdfContent();
|
||||
$content = $pdf->getOutboxBook($object->id_envelope);
|
||||
if ($pdf->hasErrors()) {
|
||||
$this->errors = $pdf->getErrors();
|
||||
} else {
|
||||
header('Content-type: application/pdf');
|
||||
header('Content-Disposition: attachment; filename="Ksiazka_nadawcza.pdf"');
|
||||
echo $content;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiadajaca za konstrukcje linku do pobrania ksiazki nadawczej
|
||||
*/
|
||||
public function displayOutboxbookLink($token = null, $id) {
|
||||
if (!array_key_exists('outboxbook', self::$cache_lang)) {
|
||||
self::$cache_lang['outboxbook'] = $this->l('Książka nadawcza');
|
||||
}
|
||||
if (!isset($this->_envelopes[$id])) {
|
||||
return '';
|
||||
}
|
||||
$this->context->smarty->assign(array(
|
||||
'href' => self::$currentIndex .
|
||||
'&' . $this->identifier . '=' . $id .
|
||||
'&action=outboxbook&token=' . ($token != null ? $token : $this->token),
|
||||
'action' => self::$cache_lang['outboxbook'],
|
||||
));
|
||||
|
||||
return $this->context->smarty->fetch('helpers/list/list_action_default.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiadajaca za konstrukcje linku do przenoszenia przesyłek
|
||||
*/
|
||||
public function displayTransfershipmentsLink($token = null, $id) {
|
||||
if (!array_key_exists('transfershipments', self::$cache_lang)) {
|
||||
self::$cache_lang['transfershipments'] = $this->l('Przenieś przesyłki');
|
||||
}
|
||||
if (isset($this->_envelopes[$id])) {
|
||||
return '';
|
||||
}
|
||||
$href = Context::getContext()->link->getAdminLink('AdminPocztaPolskaTransferSets', true);
|
||||
$this->context->smarty->assign(array(
|
||||
'href' => $href .
|
||||
'&' . $this->identifier . '=' . $id,
|
||||
'action' => self::$cache_lang['transfershipments'],
|
||||
));
|
||||
|
||||
return $this->context->smarty->fetch('helpers/list/list_action_default.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiadajaca za konstrukcje linku do wysylki przesyłek do urzendu
|
||||
*/
|
||||
public function displaySendofficeLink($token = null, $id) {
|
||||
if (!array_key_exists('sendoffice', self::$cache_lang)) {
|
||||
self::$cache_lang['sendoffice'] = $this->l('Wyślij do urzędu');
|
||||
}
|
||||
if (isset($this->_envelopes[$id])) {
|
||||
return '';
|
||||
}
|
||||
if ($this->_shipments[$id]['shipment_count'] <= 0) {
|
||||
return '';
|
||||
}
|
||||
$this->context->smarty->assign(array(
|
||||
'href' => self::$currentIndex .
|
||||
'&' . $this->identifier . '=' . $id .
|
||||
'&action=sendoffice&token=' . ($token != null ? $token : $this->token),
|
||||
'action' => self::$cache_lang['sendoffice'],
|
||||
));
|
||||
|
||||
return $this->context->smarty->fetch('helpers/list/list_action_default.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiadajaca za konstrukcje linku do pobieranie etykiety
|
||||
*/
|
||||
public function displayDownloadlabelLink($token = null, $id) {
|
||||
if (!array_key_exists('downloadlabel', self::$cache_lang)) {
|
||||
self::$cache_lang['downloadlabel'] = $this->l('Pobierz etykiete');
|
||||
}
|
||||
if (!isset($this->_envelopes[$id])) {
|
||||
return '';
|
||||
}
|
||||
$this->context->smarty->assign(array(
|
||||
'href' => self::$currentIndex .
|
||||
'&' . $this->identifier . '=' . $id .
|
||||
'&action=downloadlabel&token=' . ($token != null ? $token : $this->token),
|
||||
'action' => self::$cache_lang['downloadlabel'],
|
||||
));
|
||||
|
||||
return $this->context->smarty->fetch('helpers/list/list_action_default.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiadajaca za dodanie nowego zbioru
|
||||
*/
|
||||
public function processAdd() {
|
||||
|
||||
if (!isset($this->className) || empty($this->className)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->validateRules();
|
||||
if (count($this->errors) <= 0) {
|
||||
$this->object = new $this->className();
|
||||
|
||||
$this->copyFromPost($this->object, $this->table);
|
||||
$this->beforeAdd($this->object);
|
||||
if (!$this->object->addEnvelopeBuffor()) {
|
||||
$this->errors = $this->object->_errors;
|
||||
$this->display = 'edit';
|
||||
return false;
|
||||
}
|
||||
if (method_exists($this->object, 'add') && !$this->object->add()) {
|
||||
$this->errors[] = Tools::displayError($this->l('An error occurred while creating an object.')) .
|
||||
' <b>' . $this->table . ' (' . Db::getInstance()->getMsgError() . ')</b>';
|
||||
} elseif (($_POST[$this->identifier] = $this->object->id /* voluntary do affectation here */) && $this->postImage($this->object->id) && !count($this->errors) && $this->_redirect) {
|
||||
PrestaShopLogger::addLog(sprintf($this->l('%s addition', 'AdminTab', false, false), $this->className), 1, null, $this->className, (int) $this->object->id, true, (int) $this->context->employee->id);
|
||||
$parent_id = (int) Tools::getValue('id_parent', 1);
|
||||
$this->afterAdd($this->object);
|
||||
$this->updateAssoShop($this->object->id);
|
||||
// Save and stay on same form
|
||||
if (empty($this->redirect_after) && $this->redirect_after !== false && Tools::isSubmit('submitAdd' . $this->table . 'AndStay')) {
|
||||
$this->redirect_after = self::$currentIndex . '&' . $this->identifier . '=' . $this->object->id . '&conf=43&update' . $this->table . '&token=' . $this->token;
|
||||
}
|
||||
// Save and back to parent
|
||||
if (empty($this->redirect_after) && $this->redirect_after !== false && Tools::isSubmit('submitAdd' . $this->table . 'AndBackToParent')) {
|
||||
$this->redirect_after = self::$currentIndex . '&' . $this->identifier . '=' . $parent_id . '&conf=43&token=' . $this->token;
|
||||
}
|
||||
// Default behavior (save and back)
|
||||
if (empty($this->redirect_after) && $this->redirect_after !== false) {
|
||||
$this->redirect_after = self::$currentIndex. '&' . $this->identifier . '=' . $this->object->id . '&conf=43&token=' . $this->token.'&id_en='.$this->object->id_en;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->errors = array_unique($this->errors);
|
||||
if (!empty($this->errors)) {
|
||||
// if we have errors, we stay on the form instead of going back to the list
|
||||
$this->display = 'edit';
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiadajaca za aktyalizacje zbioru
|
||||
*/
|
||||
public function processUpdate() {
|
||||
/* Checking fields validity */
|
||||
$this->validateRules();
|
||||
if (empty($this->errors)) {
|
||||
$id = (int) Tools::getValue($this->identifier);
|
||||
|
||||
/* Object update */
|
||||
if (isset($id) && !empty($id)) {
|
||||
/** @var ObjectModel $object */
|
||||
$object = new $this->className($id);
|
||||
if (Validate::isLoadedObject($object)) {
|
||||
$this->copyFromPost($object, $this->table);
|
||||
if (!$object->updateEnvelopeBuffor()) {
|
||||
$this->errors = $object->_errors;
|
||||
$this->display = 'edit';
|
||||
return false;
|
||||
}
|
||||
/* Specific to objects which must not be deleted */
|
||||
if ($this->deleted && $this->beforeDelete($object)) {
|
||||
// Create new one with old objet values
|
||||
/** @var ObjectModel $object_new */
|
||||
$object_new = $object->duplicateObject();
|
||||
if (Validate::isLoadedObject($object_new)) {
|
||||
// Update old object to deleted
|
||||
$object->deleted = 1;
|
||||
$object->update();
|
||||
|
||||
// Update new object with post values
|
||||
$this->copyFromPost($object_new, $this->table);
|
||||
$result = $object_new->update();
|
||||
if (Validate::isLoadedObject($object_new)) {
|
||||
$this->afterDelete($object_new, $object->id);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->copyFromPost($object, $this->table);
|
||||
$result = $object->update();
|
||||
$this->afterUpdate($object);
|
||||
}
|
||||
|
||||
if ($object->id) {
|
||||
$this->updateAssoShop($object->id);
|
||||
}
|
||||
|
||||
if (!$result) {
|
||||
$this->errors[] = Tools::displayError($this->l('An error occurred while updating an object.')) .
|
||||
' <b>' . $this->table . '</b> (' . Db::getInstance()->getMsgError() . ')';
|
||||
} elseif ($this->postImage($object->id) && !count($this->errors) && $this->_redirect) {
|
||||
$parent_id = (int) Tools::getValue('id_parent', 1);
|
||||
// Specific back redirect
|
||||
if ($back = Tools::getValue('back')) {
|
||||
$this->redirect_after = urldecode($back) . '&conf=44';
|
||||
}
|
||||
// Specific scene feature
|
||||
// @todo change stay_here submit name (not clear for redirect to scene ... )
|
||||
if (Tools::getValue('stay_here') == 'on' || Tools::getValue('stay_here') == 'true' || Tools::getValue('stay_here') == '1') {
|
||||
$this->redirect_after = self::$currentIndex . '&' . $this->identifier . '=' . $object->id . '&conf=44&updatescene&token=' . $this->token;
|
||||
}
|
||||
// Save and stay on same form
|
||||
// @todo on the to following if, we may prefer to avoid override redirect_after previous value
|
||||
if (Tools::isSubmit('submitAdd' . $this->table . 'AndStay')) {
|
||||
$this->redirect_after = self::$currentIndex . '&' . $this->identifier . '=' . $object->id . '&conf=44&update' . $this->table . '&token=' . $this->token;
|
||||
}
|
||||
// Save and back to parent
|
||||
if (Tools::isSubmit('submitAdd' . $this->table . 'AndBackToParent')) {
|
||||
$this->redirect_after = self::$currentIndex . '&' . $this->identifier . '=' . $parent_id . '&conf=4&token=' . $this->token;
|
||||
}
|
||||
|
||||
// Default behavior (save and back)
|
||||
if (empty($this->redirect_after) && $this->redirect_after !== false) {
|
||||
$this->redirect_after = self::$currentIndex . ($parent_id ? '&' . $this->identifier . '=' . $object->id : '') . '&conf=44&token=' . $this->token;
|
||||
}
|
||||
}
|
||||
PrestaShopLogger::addLog(sprintf($this->l('%s modification', 'AdminTab', false, false), $this->className), 1, null, $this->className, (int) $object->id, true, (int) $this->context->employee->id);
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError($this->l('An error occurred while updating an object.')) .
|
||||
' <b>' . $this->table . '</b> ' . Tools::displayError($this->l('(cannot load object)'));
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->errors = array_unique($this->errors);
|
||||
if (!empty($this->errors)) {
|
||||
// if we have errors, we stay on the form instead of going back to the list
|
||||
$this->display = 'edit';
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isset($object)) {
|
||||
return $object;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiadajaca za usuwanie zbioru
|
||||
*/
|
||||
public function processDelete() {
|
||||
if (Validate::isLoadedObject($object = $this->loadObject())) {
|
||||
$res = true;
|
||||
// check if request at least one object with noZeroObject
|
||||
if (isset($object->noZeroObject) && count(call_user_func(array($this->className, $object->noZeroObject))) <= 1) {
|
||||
$this->errors[] = Tools::displayError($this->l('You need at least one object.')) .
|
||||
' <b>' . $this->table . '</b><br />' .
|
||||
Tools::displayError($this->l('You cannot delete all of the items.'));
|
||||
} elseif (array_key_exists('delete', $this->list_skip_actions) && in_array($object->id, $this->list_skip_actions['delete'])) { //check if some ids are in list_skip_actions and forbid deletion
|
||||
$this->errors[] = Tools::displayError($this->l('You cannot delete this item.'));
|
||||
} else {
|
||||
if (!$object->deleteEnvelopeBuffor()) {
|
||||
$this->errors = $object->_errors;
|
||||
return false;
|
||||
}
|
||||
if ($this->deleted) {
|
||||
if (!empty($this->fieldImageSettings)) {
|
||||
$res = $object->deleteImage();
|
||||
}
|
||||
|
||||
if (!$res) {
|
||||
$this->errors[] = Tools::displayError($this->l('Unable to delete associated images.'));
|
||||
}
|
||||
|
||||
$object->deleted = 1;
|
||||
if ($res = $object->update()) {
|
||||
$this->redirect_after = self::$currentIndex . '&conf=41&token=' . $this->token;
|
||||
}
|
||||
} elseif ($res = $object->delete()) {
|
||||
PPOrderSet::reloadData();
|
||||
$this->redirect_after = self::$currentIndex . '&conf=41&token=' . $this->token;
|
||||
}
|
||||
$this->errors[] = Tools::displayError($this->l('An error occurred during deletion.'));
|
||||
if ($res) {
|
||||
PrestaShopLogger::addLog(sprintf($this->l('%s deletion', 'AdminTab', false, false), $this->className), 1, null, $this->className, (int) $this->object->id, true, (int) $this->context->employee->id);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError($this->l('An error occurred while deleting the object.')) .
|
||||
' <b>' . $this->table . '</b> ' .
|
||||
Tools::displayError($this->l('(cannot load object)'));
|
||||
}
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiadajaca za pobranie danych do wwygenrownia listy
|
||||
*/
|
||||
public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false) {
|
||||
parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop);
|
||||
$statuses = ENadawca::Envelope()->getStatuses();
|
||||
foreach ($this->_list as &$item) {
|
||||
if (!empty($item['id_envelope'])) {
|
||||
$this->_envelopes[$item['id_order_set']] = array(
|
||||
'id_envelope' => $item['id_envelope']
|
||||
);
|
||||
}
|
||||
$this->_shipments[$item['id_order_set']] = array(
|
||||
'shipment_count' => $item['shipment_count']
|
||||
);
|
||||
$item['envelope_status'] = isset($statuses[$item['envelope_status']]) ? $statuses[$item['envelope_status']] : $item['envelope_status'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiedzialna za konstrukcje url do podglądu zbioru
|
||||
*/
|
||||
public function displayViewLink($token = null, $id) {
|
||||
$href = Context::getContext()->link->getAdminLink('AdminPocztaPolskaOrdersSetsView', true);
|
||||
$href .= '&' . $this->identifier . '=' . $id;
|
||||
if (!array_key_exists('view', self::$cache_lang)) {
|
||||
self::$cache_lang['view'] = $this->l('Zobacz');
|
||||
}
|
||||
$this->context->smarty->assign(array(
|
||||
'href' => $href,
|
||||
'action' => self::$cache_lang['view'],
|
||||
));
|
||||
|
||||
return $this->context->smarty->fetch('helpers/list/list_action_view.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiadajaca za konstrukcje liku do edycji zbioru
|
||||
*/
|
||||
public function displayEditLink($token = null, $id, $name = null) {
|
||||
if (!array_key_exists('Edit', self::$cache_lang)) {
|
||||
self::$cache_lang['Edit'] = $this->l('Edit', 'Helper');
|
||||
}
|
||||
if (isset($this->_envelopes[$id])) {
|
||||
return '';
|
||||
}
|
||||
$this->context->smarty->assign(array(
|
||||
'href' => self::$currentIndex . '&' . $this->identifier . '=' . $id . '&update' . $this->table .'&token=' . ($token != null ? $token : $this->token),
|
||||
'action' => self::$cache_lang['Edit'],
|
||||
'id' => $id
|
||||
));
|
||||
|
||||
return $this->context->smarty->fetch(_PS_MODULE_DIR_ . $this->module->name . DIRECTORY_SEPARATOR . 'views/templates/admin/list_action_edit.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiadajaca za konstrukcje liku do usuwania zbioru
|
||||
*/
|
||||
public function displayDeleteLink($token = null, $id, $name = null) {
|
||||
if (!array_key_exists('Delete', self::$cache_lang)) {
|
||||
self::$cache_lang['Delete'] = $this->l('Delete', 'Helper');
|
||||
}
|
||||
|
||||
if (!array_key_exists('DeleteItem', self::$cache_lang)) {
|
||||
self::$cache_lang['DeleteItem'] = $this->l('Delete selected item?', 'Helper', true, false);
|
||||
}
|
||||
|
||||
if (!array_key_exists('Name', self::$cache_lang)) {
|
||||
self::$cache_lang['Name'] = $this->l('Name:', 'Helper', true, false);
|
||||
}
|
||||
if (isset($this->_envelopes[$id])) {
|
||||
return '';
|
||||
}
|
||||
if (!is_null($name)) {
|
||||
$name = addcslashes('\n\n' . self::$cache_lang['Name'] . ' ' . $name, '\'');
|
||||
}
|
||||
|
||||
$data = array(
|
||||
$this->identifier => $id,
|
||||
'href' => self::$currentIndex . '&' . $this->identifier . '=' . $id . '&delete' . $this->table . '&token=' . ($token != null ? $token : $this->token),
|
||||
'action' => self::$cache_lang['Delete'],
|
||||
);
|
||||
|
||||
if ($this->specificConfirmDelete !== false) {
|
||||
$data['confirm'] = !is_null($this->specificConfirmDelete) ? '\r' . $this->specificConfirmDelete : Tools::safeOutput(self::$cache_lang['DeleteItem'] . $name);
|
||||
}
|
||||
|
||||
$this->context->smarty->assign(array_merge($this->tpl_delete_link_vars, $data));
|
||||
|
||||
return $this->context->smarty->fetch(_PS_MODULE_DIR_ . $this->module->name . DIRECTORY_SEPARATOR . 'views/templates/admin/list_action_delete.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
* metoda inicjujaca toolbar w adminie dla danego controllera
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function initToolbar() {
|
||||
parent::initToolbar();
|
||||
$this->toolbar_btn['reload'] = array(
|
||||
'href' => self::$currentIndex . '&action=reload&' . $this->table . '&token=' . $this->token,
|
||||
'desc' => $this->l('Odśwież'),
|
||||
'imgclass' => 'refresh'
|
||||
);
|
||||
return $this->toolbar_btn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiada za powtorne zaladowanie danych z EN - zbiory i urzendy nadania
|
||||
*/
|
||||
public function processReload() {
|
||||
$this->context->cookie->pocztapolska_en_reload_data_ts = 0;
|
||||
Tools::redirectAdmin(self::$currentIndex . '&token=' . $this->token);
|
||||
}
|
||||
|
||||
public function setMedia($isNewTheme = false) {
|
||||
parent::setMedia();
|
||||
$this->addJS(__PS_BASE_URI__ . 'modules/' . $this->module->name . '/views/templates/admin/js/sets.js');
|
||||
}
|
||||
public function getFieldsValue($obj) {
|
||||
parent::getFieldsValue($obj);
|
||||
|
||||
$this->fields_value['set_date'] = $obj->post_date;
|
||||
|
||||
if(empty($this->fields_value['change_parcels'])) {
|
||||
$this->fields_value['change_parcels'] = 0;
|
||||
}
|
||||
|
||||
return $this->fields_value ;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
require_once(__DIR__ . '/AdminPocztaPolskaController.php');
|
||||
require_once(__DIR__ . '/AdminPocztaPolskaTransferSets.php');
|
||||
|
||||
class AdminPocztaPolskaOrdersSetsViewController extends AdminPocztaPolskaTransferSetsController {
|
||||
|
||||
/**
|
||||
* metoda odpowiedzialna za renderowanie listy w widoku dla controllera
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function renderList() {
|
||||
if (!($this->fields_list && is_array($this->fields_list))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$id_order_set = Tools::getValue('id_order_set', '');
|
||||
if (empty($id_order_set)) {
|
||||
Tools::redirectAdmin(Context::getContext()->link->getAdminLink('AdminPocztaPolskaOrdersSets'));
|
||||
}
|
||||
$orderSet = new PPOrderSet(Tools::getValue('id_order_set'));
|
||||
$this->_where = ' AND o.`id_buffor`=' . $orderSet->id_en;
|
||||
|
||||
$this->page_header_toolbar_title = $this->l('Podgląd przesyłek zbioru').' '.$orderSet->name;
|
||||
|
||||
$this->getList($this->context->language->id);
|
||||
|
||||
// If list has 'active' field, we automatically create bulk action
|
||||
if (isset($this->fields_list) && is_array($this->fields_list) && array_key_exists('active', $this->fields_list) && !empty($this->fields_list['active'])) {
|
||||
if (!is_array($this->bulk_actions)) {
|
||||
$this->bulk_actions = array();
|
||||
}
|
||||
|
||||
$this->bulk_actions = array();
|
||||
}
|
||||
$helper = new HelperList();
|
||||
$helper->module = $this->module;
|
||||
// Empty list is ok
|
||||
if (!is_array($this->_list)) {
|
||||
$this->displayWarning($this->l('Bad SQL query', 'Helper') . '<br />' . htmlspecialchars($this->_list_error));
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->setHelperDisplay($helper);
|
||||
$helper->_default_pagination = $this->_default_pagination;
|
||||
$helper->_pagination = $this->_pagination;
|
||||
$helper->tpl_vars = $this->getTemplateListVars();
|
||||
$helper->tpl_delete_link_vars = $this->tpl_delete_link_vars;
|
||||
// For compatibility reasons, we have to check standard actions in class attributes
|
||||
foreach ($this->actions_available as $action) {
|
||||
if (!in_array($action, $this->actions) && isset($this->$action) && $this->$action) {
|
||||
$this->actions[] = $action;
|
||||
}
|
||||
}
|
||||
$helper->actions = [];
|
||||
$helper->bulk_actions = [];
|
||||
$helper->is_cms = $this->is_cms;
|
||||
$helper->sql = $this->_listsql;
|
||||
$helper->simple_header = true;
|
||||
$list = $helper->generateList($this->_list, $this->fields_list);
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,373 @@
|
||||
<?php
|
||||
|
||||
require_once(__DIR__ . '/AdminPocztaPolskaController.php');
|
||||
|
||||
/**
|
||||
* Klasa odpowiadajaca za przenoszenie przesyłek pomiedzy zbiorami
|
||||
*/
|
||||
class AdminPocztaPolskaTransferSetsController extends AdminPocztaPolskaController {
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
|
||||
$this->module = Module::getInstanceByName('pocztapolskaen');
|
||||
$this->bootstrap = true;
|
||||
$this->table = 'orders';
|
||||
$this->className = 'PPOrder';
|
||||
$this->identifier = 'id_order';
|
||||
$this->lang = false;
|
||||
$this->explicitSelect = true;
|
||||
$this->allow_export = false;
|
||||
$this->context = Context::getContext();
|
||||
$this->force_show_bulk_actions = true;
|
||||
$this->_use_found_rows = true;
|
||||
$this->_prepareOrderStatuses();
|
||||
$this->_prepareListFields();
|
||||
$this->_prepareListQuery();
|
||||
$this->_prepareFieldsForm();
|
||||
$this->_prepareMassActions();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda bydująca tabliece statusów zamówień
|
||||
*/
|
||||
protected function _prepareOrderStatuses() {
|
||||
$statuses = OrderState::getOrderStates((int) $this->context->language->id);
|
||||
foreach ($statuses as $status) {
|
||||
$this->statuses_array[$status['id_order_state']] = $status['name'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiedzialna za przygotowanie kolumn listy
|
||||
*/
|
||||
protected function _prepareListFields() {
|
||||
$this->fields_list = array(
|
||||
'id_order' => array(
|
||||
'title' => $this->l('ID'),
|
||||
'align' => 'text-center',
|
||||
'class' => 'fixed-width-xs',
|
||||
'filter_key' => 'o!id_order',
|
||||
'remove_onclick' => true
|
||||
),
|
||||
'shipment_type' => array(
|
||||
'title' => $this->l('Rodzaj przesyłki'),
|
||||
'havingFilter' => true,
|
||||
'filter_key' => 'o!shipment_type',
|
||||
'type' => 'select',
|
||||
'list' => PocztaPolskaEn::getPPPackages(false),
|
||||
'remove_onclick' => true
|
||||
),
|
||||
'customer' => array(
|
||||
'title' => $this->l('Klient'),
|
||||
'havingFilter' => true,
|
||||
'type' => 'html',
|
||||
'remove_onclick' => true
|
||||
),
|
||||
'address' => array(
|
||||
'title' => $this->l('Adres dostawy'),
|
||||
'havingFilter' => true,
|
||||
'remove_onclick' => true
|
||||
),
|
||||
'osname' => array(
|
||||
'title' => $this->l('Status'),
|
||||
'type' => 'select',
|
||||
'color' => 'color',
|
||||
'list' => $this->statuses_array,
|
||||
'filter_key' => 'os!id_order_state',
|
||||
'filter_type' => 'int',
|
||||
'order_key' => 'osname',
|
||||
'remove_onclick' => true
|
||||
),
|
||||
'number' => array(
|
||||
'title' => $this->l('Numer przesyłki'),
|
||||
'havingFilter' => true,
|
||||
'filter_key' => 'o!shipment_number',
|
||||
'remove_onclick' => true
|
||||
),
|
||||
'order_date' => array(
|
||||
'title' => $this->l('Data zamówienia'),
|
||||
'type' => 'datetime',
|
||||
'filter_key' => 'a!date_add',
|
||||
'remove_onclick' => true
|
||||
),
|
||||
'send_date' => array(//ad shipment
|
||||
'title' => $this->l('Data utworzenia'),
|
||||
'type' => 'datetime',
|
||||
'filter_key' => 'o!send_date',
|
||||
'remove_onclick' => true
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiedzialna za knstrukcje zapytania sql listy
|
||||
*/
|
||||
protected function _prepareListQuery() {
|
||||
$deliveries = PPSetting::getPPDelivery();
|
||||
$this->_select = '
|
||||
a.id_order,
|
||||
o.id_pp_order,
|
||||
o.shipment_number as number,
|
||||
o.id_buffor as id_buffor,
|
||||
o.id_shipment,
|
||||
o.shipment_type,
|
||||
o.send_date,
|
||||
a.date_add as order_date,
|
||||
osl.`name` AS `osname`,
|
||||
os.`color`,
|
||||
a.date_add as order_date,
|
||||
CONCAT(LEFT(c.`firstname`, 1), \'. \', c.`lastname`) AS `customer`,
|
||||
osl.`name` AS `osname`,
|
||||
CONCAT_WS(" ",address.address1,address.address2,address.postcode,address.city,country_lang.name) as address,
|
||||
o.point,
|
||||
o.pni,
|
||||
oc.`weight`,
|
||||
"10000" as amount,
|
||||
"123" as amount_number,
|
||||
a.`total_paid_tax_incl` as total,
|
||||
oset.`id_envelope`,
|
||||
a.`id_customer`,
|
||||
a.`reference`,
|
||||
oc.id_carrier
|
||||
';
|
||||
$this->_join = '
|
||||
LEFT JOIN `' . _DB_PREFIX_ . 'pocztapolskaen_order` o ON (o.`id_order` = a.`id_order`)
|
||||
LEFT JOIN `' . _DB_PREFIX_ . 'pocztapolskaen_order_set` oset ON (oset.`id_en` = o.`id_buffor`)
|
||||
LEFT JOIN `' . _DB_PREFIX_ . 'customer` c ON (c.`id_customer` = a.`id_customer`)
|
||||
LEFT JOIN `' . _DB_PREFIX_ . 'address` address ON address.id_address = a.id_address_delivery
|
||||
LEFT JOIN `' . _DB_PREFIX_ . 'order_carrier` oc ON (a.`id_order` = oc.`id_order`)
|
||||
LEFT JOIN `' . _DB_PREFIX_ . 'country` country ON address.id_country = country.id_country
|
||||
LEFT JOIN `' . _DB_PREFIX_ . 'country_lang` country_lang ON (country.`id_country` = country_lang.`id_country` AND country_lang.`id_lang` = ' . (int) $this->context->language->id . ')
|
||||
LEFT JOIN `' . _DB_PREFIX_ . 'order_state` os ON (os.`id_order_state` = a.`current_state`)
|
||||
LEFT JOIN `' . _DB_PREFIX_ . 'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = ' . (int) $this->context->language->id . ')';
|
||||
$this->_orderBy = 'a.id_order';
|
||||
$this->_orderWay = 'DESC';
|
||||
$this->_where .= !empty($deliveries) ? ' and (a.id_carrier in(' . implode(PPSetting::PP_SEPARATOR, $deliveries) . ') or not o.id_order is null)' : 'and not o.id_order is null ';
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiedzialna za przygotowanie akcji grupowych
|
||||
*/
|
||||
protected function _prepareMassActions() {
|
||||
$this->bulk_actions = array(
|
||||
'transferSets' => array(
|
||||
'text' => $this->l('Przenieś przesyłki'),
|
||||
'icon' => 'icon-send',
|
||||
'onclick' => 'ppSet.toggle(\'transfer_sets_action\');'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function setMedia($isNewTheme = false) {
|
||||
parent::setMedia();
|
||||
$this->addJS(__PS_BASE_URI__ . 'modules/' . $this->module->name . '/views/templates/admin/js/sets.js');
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiedzialna za przygotowanie pol formularza
|
||||
*/
|
||||
protected function _prepareFieldsForm() {
|
||||
$this->fields_form = array(
|
||||
'legend' => array(
|
||||
'title' => $this->l('Zbiór'),
|
||||
),
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Nazwa zbioru'),
|
||||
'name' => 'name',
|
||||
'required' => true,
|
||||
'col' => '9',
|
||||
),
|
||||
array(
|
||||
'type' => 'date',
|
||||
'label' => $this->l('Planowana data nadania'),
|
||||
'name' => 'date_from',
|
||||
'maxlength' => 10,
|
||||
'required' => true,
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Urząd nadania'),
|
||||
'name' => 'customer_name',
|
||||
'required' => true,
|
||||
'col' => '9',
|
||||
'default_value' => (int) $this->context->country->id,
|
||||
'options' => array(
|
||||
'query' => PPPostOffice::getCollection(true),
|
||||
'id' => 'id_en',
|
||||
'name' => 'name'
|
||||
),
|
||||
),
|
||||
),
|
||||
'submit' => array(
|
||||
'title' => $this->l('Zapisz'),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiedzialana za generowanie listy jaka ma sie wyswietlic
|
||||
*/
|
||||
public function renderList() {
|
||||
if (!($this->fields_list && is_array($this->fields_list))) {
|
||||
return false;
|
||||
}
|
||||
$id_order_set = Tools::getValue('id_order_set', '');
|
||||
if (empty($id_order_set)) {
|
||||
Tools::redirectAdmin(Context::getContext()->link->getAdminLink('AdminPocztaPolskaOrdersSets'));
|
||||
}
|
||||
$orderSet = new PPOrderSet(Tools::getValue('id_order_set'));
|
||||
$this->_where = ' AND o.`id_buffor`=' . $orderSet->id_en;
|
||||
|
||||
$this->getList($this->context->language->id);
|
||||
|
||||
// If list has 'active' field, we automatically create bulk action
|
||||
if (isset($this->fields_list) && is_array($this->fields_list) && array_key_exists('active', $this->fields_list) && !empty($this->fields_list['active'])) {
|
||||
if (!is_array($this->bulk_actions)) {
|
||||
$this->bulk_actions = array();
|
||||
}
|
||||
|
||||
$this->bulk_actions = array_merge(array(
|
||||
'enableSelection' => array(
|
||||
'text' => $this->l('Enable selection'),
|
||||
'icon' => 'icon-power-off text-success'
|
||||
),
|
||||
'disableSelection' => array(
|
||||
'text' => $this->l('Disable selection'),
|
||||
'icon' => 'icon-power-off text-danger'
|
||||
),
|
||||
'divider' => array(
|
||||
'text' => 'divider'
|
||||
)
|
||||
), $this->bulk_actions);
|
||||
}
|
||||
$helper = new HelperList();
|
||||
$helper->module = $this->module;
|
||||
$helper->force_show_bulk_actions = $this->force_show_bulk_actions;
|
||||
// Empty list is ok
|
||||
if (!is_array($this->_list)) {
|
||||
$this->displayWarning($this->l('Bad SQL query', 'Helper') . '<br />' . htmlspecialchars($this->_list_error));
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->setHelperDisplay($helper);
|
||||
$helper->_default_pagination = $this->_default_pagination;
|
||||
$helper->_pagination = $this->_pagination;
|
||||
$helper->tpl_vars = $this->getTemplateListVars();
|
||||
$helper->tpl_delete_link_vars = $this->tpl_delete_link_vars;
|
||||
// For compatibility reasons, we have to check standard actions in class attributes
|
||||
foreach ($this->actions_available as $action) {
|
||||
if (!in_array($action, $this->actions) && isset($this->$action) && $this->$action) {
|
||||
$this->actions[] = $action;
|
||||
}
|
||||
}
|
||||
|
||||
$helper->is_cms = $this->is_cms;
|
||||
$helper->sql = $this->_listsql;
|
||||
$helper->simple_header = true;
|
||||
$list = $helper->generateList($this->_list, $this->fields_list);
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* metoda zwracaja dostakowe parametry do zaladowania w Smarty
|
||||
*
|
||||
* @return array - lista parametrow
|
||||
*/
|
||||
public function getTemplateListVars() {
|
||||
$id_order_set = Tools::getValue('id_order_set', '');
|
||||
$setsCollection = new PrestaShopCollection('PPOrderSet');
|
||||
$setsCollection->sqlWhere('(a0.id_envelope is null OR a0.id_envelope=0) AND a0.post_date>=CURDATE()');
|
||||
$setsCollection->where('id_order_set', '<>', $id_order_set);
|
||||
$sets = array();
|
||||
foreach ($setsCollection as $set) {
|
||||
$sets[$set->id_en] = $set->name;
|
||||
}
|
||||
$this->tpl_list_vars['id_buffors'] = $sets;
|
||||
$this->tpl_list_vars['id_order_set'] = $id_order_set;
|
||||
|
||||
return $this->tpl_list_vars;
|
||||
}
|
||||
/**
|
||||
* metoda inicjujaca toolbar w adminie dla danego controllera
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function initToolbar() {
|
||||
parent::initToolbar();
|
||||
unset($this->toolbar_btn['new']);
|
||||
$this->toolbar_btn[''] = array('desc' => '');
|
||||
return $this->toolbar_btn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiadająca za przenoszenie zbiorów
|
||||
*/
|
||||
public function processBulktransferSets() {
|
||||
$ordersIds = Tools::getValue('ordersBox', array());
|
||||
$idBufforTo = Tools::getValue('id_buffor', '');
|
||||
$id_order_set = Tools::getValue('id_order_set', '');
|
||||
$set = PPOrderSet::getByBuffor($idBufforTo);
|
||||
if (!empty($ordersIds)) {
|
||||
if (!empty($idBufforTo)) {
|
||||
$orders = PPOrder::getGroupedByBuffer($ordersIds);
|
||||
$shipment = ENadawca::Shipment();
|
||||
if (!empty($orders)) {
|
||||
foreach ($orders as $idBuffor => $v) {
|
||||
$result = $shipment->move($idBuffor, $idBufforTo, $v['guids']);
|
||||
$notMovedGuid = array();
|
||||
if ($result['notMovedGuid']) {
|
||||
$notMovedGuid = (!is_array($result['notMovedGuid'])) ? array($result['notMovedGuid']) : $result['notMovedGuid'];
|
||||
}
|
||||
if (!empty($notMovedGuid)) {
|
||||
|
||||
}
|
||||
if (!$shipment->hasErrors()) {
|
||||
foreach ($v['orders'] as $order) {
|
||||
if (!in_array($order->id_shipment, $notMovedGuid)) {
|
||||
$order->id_buffor = $idBufforTo;
|
||||
$order->post_date = null;
|
||||
$order->save();
|
||||
} else {
|
||||
$this->errors[] = sprintf($this->l('Przesyłka nr %s nie została przeniesiona'), $order->shipment_number);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$errors = $shipment->getErrors();
|
||||
foreach ($errors as $error) {
|
||||
$this->errors[] = $error;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = $this->l('Brak przesyłek');
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = $this->l('Nie wybrano bufora docelowego');
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = $this->l('Nie wybrano przesyłek');
|
||||
}
|
||||
if (!empty($this->errors)) {
|
||||
return false;
|
||||
}
|
||||
Tools::redirectAdmin(Context::getContext()->link->getAdminLink('AdminPocztaPolskaOrdersSets') . '&conf=34&id_buffor=' . $set->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda odpowiadajaca za pobranie danych do wwygenrownia listy
|
||||
*/
|
||||
public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false) {
|
||||
parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop);
|
||||
$types = PocztaPolskaEn::getPPPackages(false);
|
||||
foreach ($this->_list as &$item) {
|
||||
$item['shipment_type'] = isset($types[$item['shipment_type']]) ? $types[$item['shipment_type']] : $item['shipment_type'];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
29
modules/pocztapolskaen/controllers/front/addpoint.php
Normal file
29
modules/pocztapolskaen/controllers/front/addpoint.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
class PocztapolskaenAddpointModuleFrontController extends ModuleFrontController
|
||||
{
|
||||
/**
|
||||
* metoda umożliwiajaca wyswietlenie widoku dla controllera
|
||||
*/
|
||||
public function displayContent()
|
||||
{
|
||||
parent::displayContent();
|
||||
}
|
||||
|
||||
/**
|
||||
* metoda umowliwiajaca wyswietlenie zadania ajax dla controllera,
|
||||
* zapisuje wybrany przez klienta punkt odbioru przez klienta
|
||||
*/
|
||||
public function displayAjax()
|
||||
{
|
||||
|
||||
$id_cart = Context::getContext()->cart->id;
|
||||
$ppOrder = PPOrder::findByCart($id_cart);
|
||||
$ppOrder->pni = Tools::getValue('pni');
|
||||
$ppOrder->point = Tools::getValue('point');
|
||||
$ppOrder->cod = Tools::getValue('cod');
|
||||
$ppOrder->id_carrier = Context::getContext()->cart->id_carrier;
|
||||
$ppOrder->save();
|
||||
|
||||
}
|
||||
}
|
||||
9
modules/pocztapolskaen/css/tab.css
Normal file
9
modules/pocztapolskaen/css/tab.css
Normal file
@@ -0,0 +1,9 @@
|
||||
.icon-AdminPocztaPolskaSettings:before, .icon-AdminPocztaPolskaSettings:before { position: relative;top:2px;content: url(../img/logo_menu_icon.png); }
|
||||
#ui-datepicker-div {z-index: 9999999;}
|
||||
#subtab-AdminPocztaPolskaSettings .material-icons,#subtab-AdminPocztaPolskaOrders .material-icons,#subtab-AdminPocztaPolskaCouriers .material-icons{
|
||||
display: none;
|
||||
}
|
||||
#subtab-AdminPocztaPolskaSettings a:before,#subtab-AdminPocztaPolskaOrders a:before,#subtab-AdminPocztaPolskaCouriers a:before{
|
||||
position: relative;top:2px;content: url(../img/logo_menu_icon.png);
|
||||
}
|
||||
|
||||
2209
modules/pocztapolskaen/helper/AdminPocztaPolskaOrdersHelperForm.php
Normal file
2209
modules/pocztapolskaen/helper/AdminPocztaPolskaOrdersHelperForm.php
Normal file
File diff suppressed because it is too large
Load Diff
BIN
modules/pocztapolskaen/img/logo_menu_icon.png
Normal file
BIN
modules/pocztapolskaen/img/logo_menu_icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 581 B |
35
modules/pocztapolskaen/index.php
Normal file
35
modules/pocztapolskaen/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2014 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2014 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../');
|
||||
exit;
|
||||
BIN
modules/pocztapolskaen/logo.png
Normal file
BIN
modules/pocztapolskaen/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.5 KiB |
69
modules/pocztapolskaen/mails/pl/help.html
Normal file
69
modules/pocztapolskaen/mails/pl/help.html
Normal file
@@ -0,0 +1,69 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
|
||||
<title>Wiadomość support</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
<div class="content">
|
||||
<table width="600px">
|
||||
<tr>
|
||||
<td>Od:</td>
|
||||
<td>{name_surname}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Adres e-mail nadawcy:</td>
|
||||
<td>{email}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Temat:</td>
|
||||
<td>{subject}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
--------------------------------------------------------------------------- <br>
|
||||
{content}<br>
|
||||
--------------------------------------------------------------------------- <br>
|
||||
|
||||
<table width="600px">
|
||||
<tr><td colspan="2">Tylko do użytku wewnętrznego</td></tr>
|
||||
<tr>
|
||||
<td>Numer karty:</td>
|
||||
<td>{karta}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Adres sklepu:</td>
|
||||
<td>{www}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Nazwa sklepu:</td>
|
||||
<td>{shop_name}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Data i czas:</td>
|
||||
<td>{date_time}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Wersja wtyczki:</td>
|
||||
<td>{version}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Data wtyczki:</td>
|
||||
<td>{date_version}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Wersja PrestaShop:</td>
|
||||
<td>{prestashop_version}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Wersja PHP:</td>
|
||||
<td>{php_version}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
18
modules/pocztapolskaen/mails/pl/help.txt
Normal file
18
modules/pocztapolskaen/mails/pl/help.txt
Normal file
@@ -0,0 +1,18 @@
|
||||
Od: {name_surname}
|
||||
Adres e-mail nadawcy:{email}
|
||||
Temat: {subject}
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
{content}
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Numer karty: {karta}
|
||||
Adres sklepu: {www}
|
||||
Nazwa sklepu: {shop_name}
|
||||
Data i czas: {date_time}
|
||||
Wersja wtyczki: {version}
|
||||
Data wtyczki: {date_version}
|
||||
Wersja PrestaShop: {prestashop_version}
|
||||
Wersja PHP: {php_version}
|
||||
50
modules/pocztapolskaen/mails/pl/install.html
Normal file
50
modules/pocztapolskaen/mails/pl/install.html
Normal file
@@ -0,0 +1,50 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
|
||||
<title>Wiadomość support</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
<div class="content">
|
||||
<table width="600px">
|
||||
<tr>
|
||||
<td>Od:</td>
|
||||
<td>{name_surname}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Adres e-mail nadawcy:</td>
|
||||
<td>{email}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Temat:</td>
|
||||
<td>{subject}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
--------------------------------------------------------------------------- <br>
|
||||
|
||||
<table width="600px">
|
||||
<tr><td colspan="2">Tylko do użytku wewnętrznego</td></tr>
|
||||
<tr>
|
||||
<td>Numer karty:</td>
|
||||
<td>{karta}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Wersja wtyczki:</td>
|
||||
<td>{version}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Strona www:</td>
|
||||
<td>{www}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
||||
9
modules/pocztapolskaen/mails/pl/install.txt
Normal file
9
modules/pocztapolskaen/mails/pl/install.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
Od: {name_surname}
|
||||
Adres e-mail nadawcy:{email}
|
||||
Temat: {subject}
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
Numer karty: {karta}
|
||||
Wersja wtyczki: {version}
|
||||
Strona www: {www}
|
||||
|
||||
53
modules/pocztapolskaen/mails/pl/rodo.html
Normal file
53
modules/pocztapolskaen/mails/pl/rodo.html
Normal file
@@ -0,0 +1,53 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
|
||||
<title>Wiadomość support</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
<div class="content">
|
||||
<table width="600px">
|
||||
<tr>
|
||||
<td>Od:</td>
|
||||
<td>{name_surname}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Adres e-mail nadawcy:</td>
|
||||
<td>{email}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Temat:</td>
|
||||
<td>{subject}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
--------------------------------------------------------------------------- <br>
|
||||
|
||||
<table width="600px">
|
||||
<tr><td colspan="2">Tylko do użytku wewnętrznego</td></tr>
|
||||
<tr>
|
||||
<td>Numer karty:</td>
|
||||
<td>{karta}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Wersja wtyczki:</td>
|
||||
<td>{version}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Strona www:</td>
|
||||
<td>{www}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<div>{extra_text_content}: TAK</div>
|
||||
<br>
|
||||
<div><b>{extra_text_footer}</b></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
||||
13
modules/pocztapolskaen/mails/pl/rodo.txt
Normal file
13
modules/pocztapolskaen/mails/pl/rodo.txt
Normal file
@@ -0,0 +1,13 @@
|
||||
Od: {name_surname}
|
||||
Adres e-mail nadawcy:{email}
|
||||
Temat: {subject}
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
Numer karty: {karta}
|
||||
Wersja wtyczki: {version}
|
||||
Strona www: {www}
|
||||
|
||||
{extra_text_content}: TAK
|
||||
|
||||
{extra_text_footer}
|
||||
|
||||
56
modules/pocztapolskaen/mails/pl/uninstall.html
Normal file
56
modules/pocztapolskaen/mails/pl/uninstall.html
Normal file
@@ -0,0 +1,56 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
|
||||
<title>Wiadomość support</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
<div class="content">
|
||||
<table width="600px">
|
||||
<tr>
|
||||
<td>Od:</td>
|
||||
<td>{name_surname}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Adres e-mail nadawcy:</td>
|
||||
<td>{email}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Temat:</td>
|
||||
<td>{subject}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
--------------------------------------------------------------------------- <br>
|
||||
|
||||
<table width="600px">
|
||||
<tr><td colspan="2">Tylko do użytku wewnętrznego</td></tr>
|
||||
<tr>
|
||||
<td>Numer karty:</td>
|
||||
<td>{karta}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Wersja wtyczki:</td>
|
||||
<td>{version}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Strona www:</td>
|
||||
<td>{www}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<div>Wycofanie zgody na przetwarzanie danych osobwych: TAK</div>
|
||||
<br>
|
||||
<div>Wycofanie zgody na otrzymywanie powiadomień: TAK</div>
|
||||
<br>
|
||||
<div>Pamiętaj o zaprzestaniu przetwarzania i usunięciu wszystkich danych klienta w ramach wtyczki do Prestashop!</div>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
||||
15
modules/pocztapolskaen/mails/pl/uninstall.txt
Normal file
15
modules/pocztapolskaen/mails/pl/uninstall.txt
Normal file
@@ -0,0 +1,15 @@
|
||||
Od: {name_surname}
|
||||
Adres e-mail nadawcy:{email}
|
||||
Temat: {subject}
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
Numer karty: {karta}
|
||||
Wersja wtyczki: {version}
|
||||
Strona www: {www}
|
||||
|
||||
Wycofanie zgody na przetwarzanie danych osobwych: TAK
|
||||
Wycofanie zgody na otrzymywanie powiadomień: TAK
|
||||
|
||||
Pamiętaj o zaprzestaniu przetwarzania i usunięciu wszystkich danych klienta w ramach wtyczki do Prestashop
|
||||
|
||||
|
||||
1135
modules/pocztapolskaen/pocztapolskaen.php
Normal file
1135
modules/pocztapolskaen/pocztapolskaen.php
Normal file
File diff suppressed because it is too large
Load Diff
65
modules/pocztapolskaen/sql/install.php
Normal file
65
modules/pocztapolskaen/sql/install.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
$sql = array();
|
||||
|
||||
$sql[] = "CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."pocztapolskaen_order_set` (
|
||||
`id_order_set` int(11) unsigned NOT NULL auto_increment,
|
||||
`name` varchar(255) DEFAULT NULL,
|
||||
`active` tinyint(1) DEFAULT '0',
|
||||
`id_post_office` int(11) unsigned DEFAULT NULL,
|
||||
`post_date` date DEFAULT NULL,
|
||||
`id_en` int(11) NOT NULL,
|
||||
`id_envelope` int(11) DEFAULT NULL,
|
||||
`envelope_status` varchar(255) DEFAULT NULL,
|
||||
`date_add` datetime DEFAULT NULL,
|
||||
`date_upd` datetime DEFAULT NULL,
|
||||
PRIMARY KEY (`id_order_set`)
|
||||
) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8";
|
||||
|
||||
$sql[] = "CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."pocztapolskaen_post_office` (
|
||||
`id_post_office` int(11) unsigned NOT NULL auto_increment,
|
||||
`id_en` int(11) DEFAULT NULL,
|
||||
`name` varchar(255) DEFAULT NULL,
|
||||
`description` text,
|
||||
`date_add` datetime DEFAULT NULL,
|
||||
`date_upd` datetime DEFAULT NULL,
|
||||
PRIMARY KEY (`id_post_office`)
|
||||
) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8";
|
||||
|
||||
$sql[] = "CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."pocztapolskaen_order` (
|
||||
`id_pp_order` int(11) unsigned NOT NULL auto_increment,
|
||||
`id_order` int(11) unsigned DEFAULT NULL,
|
||||
`id_cart` int(11) unsigned DEFAULT NULL,
|
||||
`id_shipment` varchar(255) DEFAULT NULL,
|
||||
`shipment_number` varchar(255) DEFAULT NULL,
|
||||
`shipment_type` varchar(255) DEFAULT NULL,
|
||||
`point` varchar(255) DEFAULT NULL,
|
||||
`pni` int(11) unsigned DEFAULT NULL,
|
||||
`cod` tinyint(1) unsigned NOT NULL DEFAULT '0',
|
||||
`id_buffor` int(11) DEFAULT NULL,
|
||||
`post_date` date DEFAULT NULL,
|
||||
`send_date` datetime DEFAULT NULL,
|
||||
`date_add` datetime DEFAULT NULL,
|
||||
`date_upd` datetime DEFAULT NULL,
|
||||
`id_carrier` int(11) unsigned DEFAULT NULL,
|
||||
PRIMARY KEY (`id_pp_order`)
|
||||
) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8";
|
||||
|
||||
$sql[] = "CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."pocztapolskaen_profile_address` (
|
||||
`id_profile_address` int(11) unsigned NOT NULL auto_increment,
|
||||
`id_en` int(11) DEFAULT NULL,
|
||||
`name` varchar(255) DEFAULT NULL,
|
||||
`friendly_name` varchar(255) DEFAULT NULL,
|
||||
`street` varchar(255) DEFAULT NULL,
|
||||
`house_number` varchar(128) DEFAULT NULL,
|
||||
`premises_number` varchar(128) DEFAULT NULL,
|
||||
`city` varchar(255) DEFAULT NULL,
|
||||
`postal_code` varchar(8) DEFAULT NULL,
|
||||
`date_add` datetime DEFAULT NULL,
|
||||
`date_upd` datetime DEFAULT NULL,
|
||||
PRIMARY KEY (`id_profile_address`)
|
||||
) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8";
|
||||
|
||||
|
||||
foreach ($sql as $query)
|
||||
if (Db::getInstance()->execute($query) == false)
|
||||
return false;
|
||||
35
modules/pocztapolskaen/translations/index.php
Normal file
35
modules/pocztapolskaen/translations/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2014 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2014 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
8
modules/pocztapolskaen/translations/pl.php
Normal file
8
modules/pocztapolskaen/translations/pl.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = array();
|
||||
$_MODULE['<{pocztapolskaen}prestashop>adminpocztapolskaordershelperform_8518d14966efb90d1e0034fc7dc10cc0'] = 'Numer rachunku pobrania';
|
||||
$_MODULE['<{pocztapolskaen}prestashop>adminpocztapolskasettings_8518d14966efb90d1e0034fc7dc10cc0'] = 'Numer rachunku pobrania';
|
||||
$_MODULE['<{pocztapolskaen}prestashop>carrier_1fcdd5454b46086efb2ea6672cf595b2'] = 'Wybierz z mapy';
|
||||
$_MODULE['<{pocztapolskaen}prestashop>carrier_220749ef2fd92abe1c880a09c452a51c'] = 'Wybrany punkt: ';
|
||||
34
modules/pocztapolskaen/upgrade/upgrade-1.1.0.php
Normal file
34
modules/pocztapolskaen/upgrade/upgrade-1.1.0.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_'))
|
||||
exit;
|
||||
|
||||
function upgrade_module_1_1_0($module)
|
||||
{
|
||||
$module->sendInformationEmail(false);
|
||||
return true;
|
||||
}
|
||||
37
modules/pocztapolskaen/upgrade/upgrade-1.1.1.php
Normal file
37
modules/pocztapolskaen/upgrade/upgrade-1.1.1.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_'))
|
||||
exit;
|
||||
|
||||
function upgrade_module_1_1_1($module)
|
||||
{
|
||||
$module->sendInformationEmail(false);
|
||||
|
||||
$sql = 'ALTER TABLE `'._DB_PREFIX_.'pocztapolskaen_order` ADD `id_carrier` INT(11) DEFAULT NULL';
|
||||
if (Db::getInstance()->execute($sql))
|
||||
return true;
|
||||
}
|
||||
34
modules/pocztapolskaen/upgrade/upgrade-1.1.2.php
Normal file
34
modules/pocztapolskaen/upgrade/upgrade-1.1.2.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_'))
|
||||
exit;
|
||||
|
||||
function upgrade_module_1_1_2($module)
|
||||
{
|
||||
$module->sendInformationEmail(false);
|
||||
return true;
|
||||
}
|
||||
34
modules/pocztapolskaen/upgrade/upgrade-1.1.3.php
Normal file
34
modules/pocztapolskaen/upgrade/upgrade-1.1.3.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_'))
|
||||
exit;
|
||||
|
||||
function upgrade_module_1_1_3($module)
|
||||
{
|
||||
$module->sendInformationEmail(false);
|
||||
return true;
|
||||
}
|
||||
49
modules/pocztapolskaen/upgrade/upgrade-1.1.4.php
Normal file
49
modules/pocztapolskaen/upgrade/upgrade-1.1.4.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_'))
|
||||
exit;
|
||||
|
||||
function upgrade_module_1_1_4($module)
|
||||
{
|
||||
$module->sendInformationEmail(false);
|
||||
$sql = "CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."pocztapolskaen_profile_address` (
|
||||
`id_profile_address` int(11) unsigned NOT NULL auto_increment,
|
||||
`id_en` int(11) DEFAULT NULL,
|
||||
`name` varchar(255) DEFAULT NULL,
|
||||
`friendly_name` varchar(255) DEFAULT NULL,
|
||||
`street` varchar(255) DEFAULT NULL,
|
||||
`house_number` varchar(128) DEFAULT NULL,
|
||||
`premises_number` varchar(128) DEFAULT NULL,
|
||||
`city` varchar(255) DEFAULT NULL,
|
||||
`postal_code` varchar(8) DEFAULT NULL,
|
||||
`date_add` datetime DEFAULT NULL,
|
||||
`date_upd` datetime DEFAULT NULL,
|
||||
PRIMARY KEY (`id_profile_address`)
|
||||
) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8";
|
||||
if (Db::getInstance()->execute($sql))
|
||||
return true;
|
||||
}
|
||||
49
modules/pocztapolskaen/upgrade/upgrade-1.1.5.php
Normal file
49
modules/pocztapolskaen/upgrade/upgrade-1.1.5.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_'))
|
||||
exit;
|
||||
|
||||
function upgrade_module_1_1_5($module)
|
||||
{
|
||||
$module->sendInformationEmail(false);
|
||||
$sql = "CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."pocztapolskaen_profile_address` (
|
||||
`id_profile_address` int(11) unsigned NOT NULL auto_increment,
|
||||
`id_en` int(11) DEFAULT NULL,
|
||||
`name` varchar(255) DEFAULT NULL,
|
||||
`friendly_name` varchar(255) DEFAULT NULL,
|
||||
`street` varchar(255) DEFAULT NULL,
|
||||
`house_number` varchar(128) DEFAULT NULL,
|
||||
`premises_number` varchar(128) DEFAULT NULL,
|
||||
`city` varchar(255) DEFAULT NULL,
|
||||
`postal_code` varchar(8) DEFAULT NULL,
|
||||
`date_add` datetime DEFAULT NULL,
|
||||
`date_upd` datetime DEFAULT NULL,
|
||||
PRIMARY KEY (`id_profile_address`)
|
||||
) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8";
|
||||
if (Db::getInstance()->execute($sql))
|
||||
return true;
|
||||
}
|
||||
34
modules/pocztapolskaen/upgrade/upgrade-1.1.6.php
Normal file
34
modules/pocztapolskaen/upgrade/upgrade-1.1.6.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_'))
|
||||
exit;
|
||||
|
||||
function upgrade_module_1_1_6($module)
|
||||
{
|
||||
$module->sendInformationEmail(false);
|
||||
return true;
|
||||
}
|
||||
34
modules/pocztapolskaen/upgrade/upgrade-1.2.0.php
Normal file
34
modules/pocztapolskaen/upgrade/upgrade-1.2.0.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_'))
|
||||
exit;
|
||||
|
||||
function upgrade_module_1_2_0($module)
|
||||
{
|
||||
$module->sendInformationEmail(false);
|
||||
return true;
|
||||
}
|
||||
37
modules/pocztapolskaen/upgrade/upgrade-1.2.1.php
Normal file
37
modules/pocztapolskaen/upgrade/upgrade-1.2.1.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_'))
|
||||
exit;
|
||||
|
||||
function upgrade_module_1_2_1($module)
|
||||
{
|
||||
$module->registerHook('displayCarrierExtraContent');
|
||||
$module->registerHook('displayHeader');
|
||||
$module->reloadSelectedCarrierConfig();
|
||||
$module->sendInformationEmail(false);
|
||||
return true;
|
||||
}
|
||||
34
modules/pocztapolskaen/upgrade/upgrade-1.2.2.php
Normal file
34
modules/pocztapolskaen/upgrade/upgrade-1.2.2.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_'))
|
||||
exit;
|
||||
|
||||
function upgrade_module_1_2_2($module)
|
||||
{
|
||||
$module->sendInformationEmail(false);
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,857 @@
|
||||
{extends file="helpers/form/form.tpl"}
|
||||
{block name="fieldset"}
|
||||
{capture name='fieldset_name'}{counter name='fieldset_name'}{/capture}
|
||||
<div class="panel {if isset($fieldset.form.panelClass)}{$fieldset.form.panelClass}{/if}" id="fieldset_{$f}{if isset($smarty.capture.identifier_count) && $smarty.capture.identifier_count}_{$smarty.capture.identifier_count|intval}{/if}{if $smarty.capture.fieldset_name > 1}_{($smarty.capture.fieldset_name - 1)|intval}{/if}">
|
||||
{foreach $fieldset.form as $key => $field}
|
||||
{if $key == 'legend'}
|
||||
{block name="legend"}
|
||||
<div class="panel-heading">
|
||||
{if isset($field.image) && isset($field.title)}<img src="{$field.image}" alt="{$field.title|escape:'html':'UTF-8'}" />{/if}
|
||||
{if isset($field.icon)}<i class="{$field.icon}"></i>{/if}
|
||||
{$field.title}
|
||||
</div>
|
||||
{/block}
|
||||
{elseif $key == 'description' && $field}
|
||||
<div class="alert alert-info">{$field}</div>
|
||||
{elseif $key == 'warning' && $field}
|
||||
<div class="alert alert-warning">{$field}</div>
|
||||
{elseif $key == 'success' && $field}
|
||||
<div class="alert alert-success">{$field}</div>
|
||||
{elseif $key == 'error' && $field}
|
||||
<div class="alert alert-danger">{$field}</div>
|
||||
{elseif $key == 'input'}
|
||||
<div class="form-wrapper">
|
||||
{foreach $field as $fieldCounter=>$input}
|
||||
{block name="input_row"}
|
||||
<div class="form-group{if isset($input.form_group_class)} {$input.form_group_class}{/if}{if $input.type == 'hidden'} hide{/if}"{if $input.name == 'id_state'} id="contains_states"{if !$contains_states} style="display:none;"{/if}{/if}{if isset($tabs) && isset($input.tab)} data-tab-id="{$input.tab}"{/if}>
|
||||
{if $input.type == 'hidden'}
|
||||
<input type="hidden" name="{$input.name}" id="{$input.name}" value="{$fields_value[$input.name]|escape:'html':'UTF-8'}" />
|
||||
{else}
|
||||
{block name="label"}
|
||||
{if isset($input.label)}
|
||||
<label class="control-label col-lg-4{if isset($input.required) && $input.required && $input.type != 'radio'} required{/if}">
|
||||
{if isset($input.hint)}
|
||||
<span class="label-tooltip" data-toggle="tooltip" data-html="true" title="{if is_array($input.hint)}
|
||||
{foreach $input.hint as $hint}
|
||||
{if is_array($hint)}
|
||||
{$hint.text|escape:'quotes'}
|
||||
{else}
|
||||
{$hint|escape:'quotes'}
|
||||
{/if}
|
||||
{/foreach}
|
||||
{else}
|
||||
{$input.hint|escape:'quotes'}
|
||||
{/if}">
|
||||
{/if}
|
||||
{$input.label}
|
||||
{if isset($input.hint)}
|
||||
</span>
|
||||
{/if}
|
||||
</label>
|
||||
{/if}
|
||||
{/block}
|
||||
|
||||
{block name="field"}
|
||||
<div class="col-lg-{if isset($input.col)}{$input.col|intval}{else}8{/if}{if !isset($input.label)&& !isset($input.hide_label)} col-lg-offset-3{/if}">
|
||||
{block name="input"}
|
||||
{if $input.type == 'text' || $input.type == 'tags'}
|
||||
{if isset($input.lang) AND $input.lang}
|
||||
{if $languages|count > 1}
|
||||
<div class="form-group">
|
||||
{/if}
|
||||
{foreach $languages as $language}
|
||||
{assign var='value_text' value=$fields_value[$input.name][$language.id_lang]}
|
||||
{if $languages|count > 1}
|
||||
<div class="translatable-field lang-{$language.id_lang}" {if $language.id_lang != $defaultFormLanguage}style="display:none"{/if}>
|
||||
<div class="col-lg-9">
|
||||
{/if}
|
||||
{if $input.type == 'tags'}
|
||||
{literal}
|
||||
<script type="text/javascript">
|
||||
$().ready(function () {
|
||||
var input_id = '{/literal}{if isset($input.id)}{$input.id}_{$language.id_lang}{else}{$input.name}_{$language.id_lang}{/if}{literal}';
|
||||
$('#'+input_id).tagify({delimiters: [13,44], addTagPrompt: '{/literal}{l s='Add tag' js=1}{literal}'});
|
||||
$({/literal}'#{$table}{literal}_form').submit( function() {
|
||||
$(this).find('#'+input_id).val($('#'+input_id).tagify('serialize'));
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{/literal}
|
||||
{/if}
|
||||
{if isset($input.maxchar) || isset($input.prefix) || isset($input.suffix)}
|
||||
<div class="input-group{if isset($input.class)} {$input.class}{/if}">
|
||||
{/if}
|
||||
{if isset($input.maxchar) && $input.maxchar}
|
||||
<span id="{if isset($input.id)}{$input.id}_{$language.id_lang}{else}{$input.name}_{$language.id_lang}{/if}_counter" class="input-group-addon">
|
||||
<span class="text-count-down">{$input.maxchar|intval}</span>
|
||||
</span>
|
||||
{/if}
|
||||
{if isset($input.prefix)}
|
||||
<span class="input-group-addon">
|
||||
{$input.prefix}
|
||||
</span>
|
||||
{/if}
|
||||
<input type="text"
|
||||
id="{if isset($input.id)}{$input.id}_{$language.id_lang}{else}{$input.name}_{$language.id_lang}{/if}"
|
||||
name="{$input.name}_{$language.id_lang}"
|
||||
class="{if isset($input.class)}{$input.class}{/if}{if $input.type == 'tags'} tagify{/if}"
|
||||
value="{if isset($input.string_format) && $input.string_format}{$value_text|string_format:$input.string_format|escape:'html':'UTF-8'}{else}{$value_text|escape:'html':'UTF-8'}{/if}"
|
||||
onkeyup="if (isArrowKey(event)) return ;updateFriendlyURL();"
|
||||
{if isset($input.size)} size="{$input.size}"{/if}
|
||||
{if isset($input.maxchar) && $input.maxchar} data-maxchar="{$input.maxchar|intval}"{/if}
|
||||
{if isset($input.maxlength) && $input.maxlength} maxlength="{$input.maxlength|intval}"{/if}
|
||||
{if isset($input.readonly) && $input.readonly} readonly="readonly"{/if}
|
||||
{if isset($input.disabled) && $input.disabled} disabled="disabled"{/if}
|
||||
{if isset($input.autocomplete) && !$input.autocomplete} autocomplete="off"{/if}
|
||||
{if isset($input.required) && $input.required} required="required" {/if}
|
||||
{if isset($input.placeholder) && $input.placeholder} placeholder="{$input.placeholder}"{/if} />
|
||||
{if isset($input.suffix)}
|
||||
<span class="input-group-addon">
|
||||
{$input.suffix}
|
||||
</span>
|
||||
{/if}
|
||||
{if isset($input.maxchar) || isset($input.prefix) || isset($input.suffix)}
|
||||
</div>
|
||||
{/if}
|
||||
{if $languages|count > 1}
|
||||
</div>
|
||||
<div class="col-lg-2">
|
||||
<button type="button" class="btn btn-default dropdown-toggle" tabindex="-1" data-toggle="dropdown">
|
||||
{$language.iso_code}
|
||||
<i class="icon-caret-down"></i>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
{foreach from=$languages item=language}
|
||||
<li><a href="javascript:hideOtherLanguage({$language.id_lang});" tabindex="-1">{$language.name}</a></li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/foreach}
|
||||
{if isset($input.maxchar) && $input.maxchar}
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
{foreach from=$languages item=language}
|
||||
countDown($("#{if isset($input.id)}{$input.id}_{$language.id_lang}{else}{$input.name}_{$language.id_lang}{/if}"), $("#{if isset($input.id)}{$input.id}_{$language.id_lang}{else}{$input.name}_{$language.id_lang}{/if}_counter"));
|
||||
{/foreach}
|
||||
});
|
||||
</script>
|
||||
{/if}
|
||||
{if $languages|count > 1}
|
||||
</div>
|
||||
{/if}
|
||||
{else}
|
||||
{if $input.type == 'tags'}
|
||||
{literal}
|
||||
<script type="text/javascript">
|
||||
$().ready(function () {
|
||||
var input_id = '{/literal}{if isset($input.id)}{$input.id}{else}{$input.name}{/if}{literal}';
|
||||
$('#'+input_id).tagify({delimiters: [13,44], addTagPrompt: '{/literal}{l s='Add tag'}{literal}'});
|
||||
$({/literal}'#{$table}{literal}_form').submit( function() {
|
||||
$(this).find('#'+input_id).val($('#'+input_id).tagify('serialize'));
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{/literal}
|
||||
{/if}
|
||||
{assign var='value_text' value=$fields_value[$input.name]}
|
||||
{if isset($input.maxchar) || isset($input.prefix) || isset($input.suffix)}
|
||||
<div class="input-group{if isset($input.class)} {$input.class}{/if}">
|
||||
{/if}
|
||||
{if isset($input.maxchar) && $input.maxchar}
|
||||
<span id="{if isset($input.id)}{$input.id}{else}{$input.name}{/if}_counter" class="input-group-addon"><span class="text-count-down">{$input.maxchar|intval}</span></span>
|
||||
{/if}
|
||||
{if isset($input.prefix)}
|
||||
<span class="input-group-addon">
|
||||
{$input.prefix}
|
||||
</span>
|
||||
{/if}
|
||||
<input type="text"
|
||||
name="{$input.name}"
|
||||
id="{if isset($input.id)}{$input.id}{else}{$input.name}{/if}"
|
||||
value="{if isset($input.string_format) && $input.string_format}{$value_text|string_format:$input.string_format|escape:'html':'UTF-8'}{else}{$value_text|escape:'html':'UTF-8'}{/if}"
|
||||
class="{if isset($input.class)}{$input.class}{/if}{if $input.type == 'tags'} tagify{/if}"
|
||||
{if isset($input.size)} size="{$input.size}"{/if}
|
||||
{if isset($input.maxchar) && $input.maxchar} data-maxchar="{$input.maxchar|intval}"{/if}
|
||||
{if isset($input.maxlength) && $input.maxlength} maxlength="{$input.maxlength|intval}"{/if}
|
||||
{if isset($input.readonly) && $input.readonly} readonly="readonly"{/if}
|
||||
{if isset($input.disabled) && $input.disabled} disabled="disabled"{/if}
|
||||
{if isset($input.autocomplete) && !$input.autocomplete} autocomplete="off"{/if}
|
||||
{if isset($input.required) && $input.required } required="required" {/if}
|
||||
{if isset($input.placeholder) && $input.placeholder } placeholder="{$input.placeholder}"{/if}
|
||||
/>
|
||||
{if isset($input.suffix)}
|
||||
<span class="input-group-addon">
|
||||
{$input.suffix}
|
||||
</span>
|
||||
{/if}
|
||||
|
||||
{if isset($input.maxchar) || isset($input.prefix) || isset($input.suffix)}
|
||||
</div>
|
||||
{/if}
|
||||
{if isset($input.maxchar) && $input.maxchar}
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
countDown($("#{if isset($input.id)}{$input.id}{else}{$input.name}{/if}"), $("#{if isset($input.id)}{$input.id}{else}{$input.name}{/if}_counter"));
|
||||
});
|
||||
</script>
|
||||
{/if}
|
||||
{/if}
|
||||
{elseif $input.type == 'textbutton'}
|
||||
{assign var='value_text' value=$fields_value[$input.name]}
|
||||
<div class="row">
|
||||
<div class="col-lg-9">
|
||||
{if isset($input.maxchar)}
|
||||
<div class="input-group">
|
||||
<span id="{if isset($input.id)}{$input.id}{else}{$input.name}{/if}_counter" class="input-group-addon">
|
||||
<span class="text-count-down">{$input.maxchar|intval}</span>
|
||||
</span>
|
||||
{/if}
|
||||
<input type="text"
|
||||
name="{$input.name}"
|
||||
id="{if isset($input.id)}{$input.id}{else}{$input.name}{/if}"
|
||||
value="{if isset($input.string_format) && $input.string_format}{$value_text|string_format:$input.string_format|escape:'html':'UTF-8'}{else}{$value_text|escape:'html':'UTF-8'}{/if}"
|
||||
class="{if isset($input.class)}{$input.class}{/if}{if $input.type == 'tags'} tagify{/if}"
|
||||
{if isset($input.size)} size="{$input.size}"{/if}
|
||||
{if isset($input.maxchar) && $input.maxchar} data-maxchar="{$input.maxchar|intval}"{/if}
|
||||
{if isset($input.maxlength) && $input.maxlength} maxlength="{$input.maxlength|intval}"{/if}
|
||||
{if isset($input.readonly) && $input.readonly} readonly="readonly"{/if}
|
||||
{if isset($input.disabled) && $input.disabled} disabled="disabled"{/if}
|
||||
{if isset($input.autocomplete) && !$input.autocomplete} autocomplete="off"{/if}
|
||||
{if isset($input.placeholder) && $input.placeholder } placeholder="{$input.placeholder}"{/if}
|
||||
/>
|
||||
{if isset($input.suffix)}{$input.suffix}{/if}
|
||||
{if isset($input.maxchar) && $input.maxchar}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="col-lg-2">
|
||||
<button type="button" class="btn btn-default{if isset($input.button.attributes['class'])} {$input.button.attributes['class']}{/if}{if isset($input.button.class)} {$input.button.class}{/if}"
|
||||
{foreach from=$input.button.attributes key=name item=value}
|
||||
{if $name|lower != 'class'}
|
||||
{$name|escape:'html':'UTF-8'}="{$value|escape:'html':'UTF-8'}"
|
||||
{/if}
|
||||
{/foreach} >
|
||||
{$input.button.label}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{if isset($input.maxchar) && $input.maxchar}
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
countDown($("#{if isset($input.id)}{$input.id}{else}{$input.name}{/if}"), $("#{if isset($input.id)}{$input.id}{else}{$input.name}{/if}_counter"));
|
||||
});
|
||||
</script>
|
||||
{/if}
|
||||
{elseif $input.type == 'swap'}
|
||||
<div class="form-group">
|
||||
<div class="col-lg-9">
|
||||
<div class="form-control-static row">
|
||||
<div class="col-xs-6">
|
||||
<select {if isset($input.size)}size="{$input.size|escape:'html':'utf-8'}"{/if}{if isset($input.onchange)} onchange="{$input.onchange|escape:'html':'utf-8'}"{/if} class="{if isset($input.class)}{$input.class|escape:'html':'utf-8'}{/if}" id="availableSwap" name="{$input.name|escape:'html':'utf-8'}_available[]" multiple="multiple">
|
||||
{foreach $input.options.query AS $option}
|
||||
{if is_object($option)}
|
||||
{if !in_array($option->$input.options.id, $fields_value[$input.name])}
|
||||
<option value="{$option->$input.options.id}">{$option->$input.options.name}</option>
|
||||
{/if}
|
||||
{elseif $option == "-"}
|
||||
<option value="">-</option>
|
||||
{else}
|
||||
{if !in_array($option[$input.options.id], $fields_value[$input.name])}
|
||||
<option value="{$option[$input.options.id]}">{$option[$input.options.name]}</option>
|
||||
{/if}
|
||||
{/if}
|
||||
{/foreach}
|
||||
</select>
|
||||
<a href="#" id="addSwap" class="btn btn-default btn-block">{l s='Add'} <i class="icon-arrow-right"></i></a>
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
<select {if isset($input.size)}size="{$input.size|escape:'html':'utf-8'}"{/if}{if isset($input.onchange)} onchange="{$input.onchange|escape:'html':'utf-8'}"{/if} class="{if isset($input.class)}{$input.class|escape:'html':'utf-8'}{/if}" id="selectedSwap" name="{$input.name|escape:'html':'utf-8'}_selected[]" multiple="multiple">
|
||||
{foreach $input.options.query AS $option}
|
||||
{if is_object($option)}
|
||||
{if in_array($option->$input.options.id, $fields_value[$input.name])}
|
||||
<option value="{$option->$input.options.id}">{$option->$input.options.name}</option>
|
||||
{/if}
|
||||
{elseif $option == "-"}
|
||||
<option value="">-</option>
|
||||
{else}
|
||||
{if in_array($option[$input.options.id], $fields_value[$input.name])}
|
||||
<option value="{$option[$input.options.id]}">{$option[$input.options.name]}</option>
|
||||
{/if}
|
||||
{/if}
|
||||
{/foreach}
|
||||
</select>
|
||||
<a href="#" id="removeSwap" class="btn btn-default btn-block"><i class="icon-arrow-left"></i> {l s='Remove'}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{elseif $input.type == 'select'}
|
||||
{if isset($input.options.query) && !$input.options.query && isset($input.empty_message)}
|
||||
{$input.empty_message}
|
||||
{$input.required = false}
|
||||
{$input.desc = null}
|
||||
{else}
|
||||
<select name="{$input.name|escape:'html':'utf-8'}"
|
||||
class="{if isset($input.class)}{$input.class|escape:'html':'utf-8'} {else}fixed-width-xl{/if} "
|
||||
id="{if isset($input.id)}{$input.id|escape:'html':'utf-8'}{else}{$input.name|escape:'html':'utf-8'}{/if}"
|
||||
{if isset($input.multiple) && $input.multiple} multiple="multiple"{/if}
|
||||
{if isset($input.size)} size="{$input.size|escape:'html':'utf-8'}"{/if}
|
||||
{if isset($input.onchange)} onchange="{$input.onchange|escape:'html':'utf-8'}"{/if}
|
||||
{if isset($input.disabled) && $input.disabled} disabled="disabled"{/if}>
|
||||
{if isset($input.options.default)}
|
||||
<option value="{$input.options.default.value|escape:'html':'utf-8'}">{$input.options.default.label|escape:'html':'utf-8'}</option>
|
||||
{/if}
|
||||
{if isset($input.options.optiongroup)}
|
||||
{foreach $input.options.optiongroup.query AS $optiongroup}
|
||||
<optgroup label="{$optiongroup[$input.options.optiongroup.label]}">
|
||||
{foreach $optiongroup[$input.options.options.query] as $option}
|
||||
<option value="{$option[$input.options.options.id]}"
|
||||
{if isset($input.multiple)}
|
||||
{foreach $fields_value[$input.name] as $field_value}
|
||||
{if $field_value == $option[$input.options.options.id]}selected="selected"{/if}
|
||||
{/foreach}
|
||||
{else}
|
||||
{if $fields_value[$input.name] == $option[$input.options.options.id]}selected="selected"{/if}
|
||||
{/if}
|
||||
>{$option[$input.options.options.name]}</option>
|
||||
{/foreach}
|
||||
</optgroup>
|
||||
{/foreach}
|
||||
{else}
|
||||
{foreach $input.options.query AS $option}
|
||||
{if is_object($option)}
|
||||
<option value="{$option->$input.options.id}"
|
||||
{if isset($input.multiple)}
|
||||
{foreach $fields_value[$input.name] as $field_value}
|
||||
{if $field_value == $option->$input.options.id}
|
||||
selected="selected"
|
||||
{/if}
|
||||
{/foreach}
|
||||
{else}
|
||||
{if $fields_value[$input.name] == $option->$input.options.id}
|
||||
selected="selected"
|
||||
{/if}
|
||||
{/if}
|
||||
>{$option->$input.options.name}</option>
|
||||
{elseif $option == "-"}
|
||||
<option value="">-</option>
|
||||
{else}
|
||||
<option value="{$option[$input.options.id]}"
|
||||
{if isset($input.multiple)}
|
||||
{foreach $fields_value[$input.name] as $field_value}
|
||||
{if $field_value == $option[$input.options.id]}
|
||||
selected="selected"
|
||||
{/if}
|
||||
{/foreach}
|
||||
{else}
|
||||
{if $fields_value[$input.name] == $option[$input.options.id]}
|
||||
selected="selected"
|
||||
{/if}
|
||||
{/if}
|
||||
>{$option[$input.options.name]}</option>
|
||||
|
||||
{/if}
|
||||
{/foreach}
|
||||
{/if}
|
||||
</select>
|
||||
{/if}
|
||||
{elseif $input.type == 'radio'}
|
||||
{foreach $input.values as $value}
|
||||
<div class="radio {if isset($input.class)}{$input.class}{/if}">
|
||||
{strip}
|
||||
<label>
|
||||
<input type="radio" name="{$input.name}" id="{$value.id}" value="{$value.value|escape:'html':'UTF-8'}"{if $fields_value[$input.name] == $value.value} checked="checked"{/if}{if isset($input.disabled) && $input.disabled} disabled="disabled"{/if}/>
|
||||
{$value.label}
|
||||
</label>
|
||||
{/strip}
|
||||
</div>
|
||||
{if isset($value.p) && $value.p}<p class="help-block">{$value.p}</p>{/if}
|
||||
{/foreach}
|
||||
{elseif $input.type == 'switch'}
|
||||
<span class="switch prestashop-switch fixed-width-lg">
|
||||
{foreach $input.values as $value}
|
||||
<input type="radio" name="{$input.name}"{if $value.value == 1} id="{$input.name}_on"{else} id="{$input.name}_off"{/if} value="{$value.value}"{if $fields_value[$input.name] == $value.value} checked="checked"{/if}{if isset($input.disabled) && $input.disabled} disabled="disabled"{/if}/>
|
||||
{strip}
|
||||
<label {if $value.value == 1} for="{$input.name}_on"{else} for="{$input.name}_off"{/if}>
|
||||
{if $value.value == 1}
|
||||
{l s='Yes' d='Admin.Global'}
|
||||
{else}
|
||||
{l s='No' d='Admin.Global'}
|
||||
{/if}
|
||||
</label>
|
||||
{/strip}
|
||||
{/foreach}
|
||||
<a class="slide-button btn"></a>
|
||||
</span>
|
||||
{elseif $input.type == 'textarea'}
|
||||
{if isset($input.maxchar) && $input.maxchar}<div class="input-group">{/if}
|
||||
{assign var=use_textarea_autosize value=true}
|
||||
{if isset($input.lang) AND $input.lang}
|
||||
{foreach $languages as $language}
|
||||
{if $languages|count > 1}
|
||||
<div class="form-group translatable-field lang-{$language.id_lang}"{if $language.id_lang != $defaultFormLanguage} style="display:none;"{/if}>
|
||||
<div class="col-lg-9">
|
||||
{/if}
|
||||
{if isset($input.maxchar) && $input.maxchar}
|
||||
<span id="{if isset($input.id)}{$input.id}_{$language.id_lang}{else}{$input.name}_{$language.id_lang}{/if}_counter" class="input-group-addon">
|
||||
<span class="text-count-down">{$input.maxchar|intval}</span>
|
||||
</span>
|
||||
{/if}
|
||||
<textarea{if isset($input.readonly) && $input.readonly} readonly="readonly"{/if} name="{$input.name}_{$language.id_lang}" id="{if isset($input.id)}{$input.id}{else}{$input.name}{/if}_{$language.id_lang}" class="{if isset($input.autoload_rte) && $input.autoload_rte}rte autoload_rte{else}textarea-autosize{/if}{if isset($input.class)} {$input.class}{/if}"{if isset($input.maxlength) && $input.maxlength} maxlength="{$input.maxlength|intval}"{/if}{if isset($input.maxchar) && $input.maxchar} data-maxchar="{$input.maxchar|intval}"{/if}>{$fields_value[$input.name][$language.id_lang]|escape:'html':'UTF-8'}</textarea>
|
||||
{if $languages|count > 1}
|
||||
</div>
|
||||
<div class="col-lg-2">
|
||||
<button type="button" class="btn btn-default dropdown-toggle" tabindex="-1" data-toggle="dropdown">
|
||||
{$language.iso_code}
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
{foreach from=$languages item=language}
|
||||
<li>
|
||||
<a href="javascript:hideOtherLanguage({$language.id_lang});" tabindex="-1">{$language.name}</a>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/foreach}
|
||||
{if isset($input.maxchar) && $input.maxchar}
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
{foreach from=$languages item=language}
|
||||
countDown($("#{if isset($input.id)}{$input.id}_{$language.id_lang}{else}{$input.name}_{$language.id_lang}{/if}"), $("#{if isset($input.id)}{$input.id}_{$language.id_lang}{else}{$input.name}_{$language.id_lang}{/if}_counter"));
|
||||
{/foreach}
|
||||
});
|
||||
</script>
|
||||
{/if}
|
||||
{else}
|
||||
{if isset($input.maxchar) && $input.maxchar}
|
||||
<span id="{if isset($input.id)}{$input.id}_{$language.id_lang}{else}{$input.name}_{$language.id_lang}{/if}_counter" class="input-group-addon">
|
||||
<span class="text-count-down">{$input.maxchar|intval}</span>
|
||||
</span>
|
||||
{/if}
|
||||
<textarea{if isset($input.readonly) && $input.readonly} readonly="readonly"{/if} name="{$input.name}" id="{if isset($input.id)}{$input.id}{else}{$input.name}{/if}" {if isset($input.cols)}cols="{$input.cols}"{/if} {if isset($input.rows)}rows="{$input.rows}"{/if} class="{if isset($input.autoload_rte) && $input.autoload_rte}rte autoload_rte{else}textarea-autosize{/if}{if isset($input.class)} {$input.class}{/if}"{if isset($input.maxlength) && $input.maxlength} maxlength="{$input.maxlength|intval}"{/if}{if isset($input.maxchar) && $input.maxchar} data-maxchar="{$input.maxchar|intval}"{/if}>{$fields_value[$input.name]|escape:'html':'UTF-8'}</textarea>
|
||||
{if isset($input.maxchar) && $input.maxchar}
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
countDown($("#{if isset($input.id)}{$input.id}{else}{$input.name}{/if}"), $("#{if isset($input.id)}{$input.id}{else}{$input.name}{/if}_counter"));
|
||||
});
|
||||
</script>
|
||||
{/if}
|
||||
{/if}
|
||||
{if isset($input.maxchar) && $input.maxchar}</div>{/if}
|
||||
{elseif $input.type == 'checkbox'}
|
||||
{if isset($input.expand)}
|
||||
<a class="btn btn-default show_checkbox{if strtolower($input.expand.default) == 'hide'} hidden{/if}" href="#">
|
||||
<i class="icon-{$input.expand.show.icon}"></i>
|
||||
{$input.expand.show.text}
|
||||
{if isset($input.expand.print_total) && $input.expand.print_total > 0}
|
||||
<span class="badge">{$input.expand.print_total}</span>
|
||||
{/if}
|
||||
</a>
|
||||
<a class="btn btn-default hide_checkbox{if strtolower($input.expand.default) == 'show'} hidden{/if}" href="#">
|
||||
<i class="icon-{$input.expand.hide.icon}"></i>
|
||||
{$input.expand.hide.text}
|
||||
{if isset($input.expand.print_total) && $input.expand.print_total > 0}
|
||||
<span class="badge">{$input.expand.print_total}</span>
|
||||
{/if}
|
||||
</a>
|
||||
{/if}
|
||||
{foreach $input.values.query as $value}
|
||||
{assign var=id_checkbox value=$value[$input.values.id]}
|
||||
|
||||
{strip}
|
||||
<span class="{if isset($value.class)}{$value.class}{/if}">
|
||||
<label for="{$id_checkbox}" class="{if isset($value.label_class)}{$value.label_class}{/if}">
|
||||
<input type="checkbox" name="{$id_checkbox}" id="{$id_checkbox}" class="{if isset($input.class)}{$input.class}{/if}"{if isset($value.val)} value="{$value.val|escape:'html':'UTF-8'}"{/if}{if isset($fields_value[$id_checkbox]) && $fields_value[$id_checkbox]} checked="checked"{/if} />
|
||||
{$value[$input.values.name]}
|
||||
</label>
|
||||
</span>
|
||||
{/strip}
|
||||
|
||||
{/foreach}
|
||||
{elseif $input.type == 'change-password'}
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<button type="button" id="{$input.name}-btn-change" class="btn btn-default">
|
||||
<i class="icon-lock"></i>
|
||||
{l s='Change password...'}
|
||||
</button>
|
||||
<div id="{$input.name}-change-container" class="form-password-change well hide">
|
||||
<div class="form-group">
|
||||
<label for="old_passwd" class="control-label col-lg-2 required">
|
||||
{l s='Current password'}
|
||||
</label>
|
||||
<div class="col-lg-10">
|
||||
<div class="input-group fixed-width-lg">
|
||||
<span class="input-group-addon">
|
||||
<i class="icon-unlock"></i>
|
||||
</span>
|
||||
<input type="password" id="old_passwd" name="old_passwd" class="form-control" value="" required="required" autocomplete="off">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr />
|
||||
<div class="form-group">
|
||||
<label for="{$input.name}" class="required control-label col-lg-2">
|
||||
<span class="label-tooltip" data-toggle="tooltip" data-html="true" title="" data-original-title="{l s='Password should be at least 8 characters long.'}">
|
||||
{l s='New password'}
|
||||
</span>
|
||||
</label>
|
||||
<div class="col-lg-9">
|
||||
<div class="input-group fixed-width-lg">
|
||||
<span class="input-group-addon">
|
||||
<i class="icon-key"></i>
|
||||
</span>
|
||||
<input type="password" id="{$input.name}" name="{$input.name}" class="{if isset($input.class)}{$input.class}{/if}" value="" required="required" autocomplete="off"/>
|
||||
</div>
|
||||
<span id="{$input.name}-output"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="{$input.name}2" class="required control-label col-lg-2">
|
||||
{l s='Confirm password'}
|
||||
</label>
|
||||
<div class="col-lg-4">
|
||||
<div class="input-group fixed-width-lg">
|
||||
<span class="input-group-addon">
|
||||
<i class="icon-key"></i>
|
||||
</span>
|
||||
<input type="password" id="{$input.name}2" name="{$input.name}2" class="{if isset($input.class)}{$input.class}{/if}" value="" autocomplete="off"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-lg-10 col-lg-offset-2">
|
||||
<input type="text" class="form-control fixed-width-md pull-left" id="{$input.name}-generate-field" disabled="disabled">
|
||||
<button type="button" id="{$input.name}-generate-btn" class="btn btn-default">
|
||||
<i class="icon-random"></i>
|
||||
{l s='Generate password'}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-lg-10 col-lg-offset-2">
|
||||
<p class="checkbox">
|
||||
<label for="{$input.name}-checkbox-mail">
|
||||
<input name="passwd_send_email" id="{$input.name}-checkbox-mail" type="checkbox" checked="checked">
|
||||
{l s='Send me this new password by Email'}
|
||||
</label>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<button type="button" id="{$input.name}-cancel-btn" class="btn btn-default">
|
||||
<i class="icon-remove"></i>
|
||||
{l s='Cancel'}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(function(){
|
||||
var $oldPwd = $('#old_passwd');
|
||||
var $passwordField = $('#{$input.name}');
|
||||
var $output = $('#{$input.name}-output');
|
||||
var $generateBtn = $('#{$input.name}-generate-btn');
|
||||
var $generateField = $('#{$input.name}-generate-field');
|
||||
var $cancelBtn = $('#{$input.name}-cancel-btn');
|
||||
|
||||
var feedback = [
|
||||
{ badge: 'text-danger', text: '{l s="Invalid" js=1}' },
|
||||
{ badge: 'text-warning', text: '{l s="Okay" js=1}' },
|
||||
{ badge: 'text-success', text: '{l s="Good" js=1}' },
|
||||
{ badge: 'text-success', text: '{l s="Fabulous" js=1}' }
|
||||
];
|
||||
$.passy.requirements.length.min = 8;
|
||||
$.passy.requirements.characters = 'DIGIT';
|
||||
$passwordField.passy(function(strength, valid) {
|
||||
$output.text(feedback[strength].text);
|
||||
$output.removeClass('text-danger').removeClass('text-warning').removeClass('text-success');
|
||||
$output.addClass(feedback[strength].badge);
|
||||
if (valid){
|
||||
$output.show();
|
||||
}
|
||||
else {
|
||||
$output.hide();
|
||||
}
|
||||
});
|
||||
var $container = $('#{$input.name}-change-container');
|
||||
var $changeBtn = $('#{$input.name}-btn-change');
|
||||
var $confirmPwd = $('#{$input.name}2');
|
||||
|
||||
$changeBtn.on('click',function(){
|
||||
$container.removeClass('hide');
|
||||
$changeBtn.addClass('hide');
|
||||
});
|
||||
$generateBtn.click(function() {
|
||||
$generateField.passy( 'generate', 8 );
|
||||
var generatedPassword = $generateField.val();
|
||||
$passwordField.val(generatedPassword);
|
||||
$confirmPwd.val(generatedPassword);
|
||||
});
|
||||
$cancelBtn.on('click',function() {
|
||||
$container.find("input").val("");
|
||||
$container.addClass('hide');
|
||||
$changeBtn.removeClass('hide');
|
||||
});
|
||||
|
||||
$.validator.addMethod('password_same', function(value, element) {
|
||||
return $passwordField.val() == $confirmPwd.val();
|
||||
}, '{l s="Invalid password confirmation" js=1}');
|
||||
|
||||
$('#employee_form').validate({
|
||||
rules: {
|
||||
"email": {
|
||||
email: true
|
||||
},
|
||||
"{$input.name}" : {
|
||||
minlength: 8
|
||||
},
|
||||
"{$input.name}2": {
|
||||
password_same: true
|
||||
},
|
||||
"old_passwd" : {},
|
||||
},
|
||||
// override jquery validate plugin defaults for bootstrap 3
|
||||
highlight: function(element) {
|
||||
$(element).closest('.form-group').addClass('has-error');
|
||||
},
|
||||
unhighlight: function(element) {
|
||||
$(element).closest('.form-group').removeClass('has-error');
|
||||
},
|
||||
errorElement: 'span',
|
||||
errorClass: 'help-block',
|
||||
errorPlacement: function(error, element) {
|
||||
if(element.parent('.input-group').length) {
|
||||
error.insertAfter(element.parent());
|
||||
} else {
|
||||
error.insertAfter(element);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{elseif $input.type == 'password'}
|
||||
<div class="input-group fixed-width-lg">
|
||||
<span class="input-group-addon">
|
||||
<i class="icon-key"></i>
|
||||
</span>
|
||||
<input type="password"
|
||||
id="{if isset($input.id)}{$input.id}{else}{$input.name}{/if}"
|
||||
name="{$input.name}"
|
||||
class="{if isset($input.class)}{$input.class}{/if}"
|
||||
value="{$fields_value[$input.name]}"
|
||||
{if isset($input.autocomplete) && !$input.autocomplete}autocomplete="off"{/if}
|
||||
{if isset($input.required) && $input.required } required="required" {/if} />
|
||||
</div>
|
||||
|
||||
{elseif $input.type == 'birthday'}
|
||||
<div class="form-group">
|
||||
{foreach $input.options as $key => $select}
|
||||
<div class="col-lg-2">
|
||||
<select name="{$key}" class="fixed-width-lg{if isset($input.class)} {$input.class}{/if}">
|
||||
<option value="">-</option>
|
||||
{if $key == 'months'}
|
||||
{*
|
||||
This comment is useful to the translator tools /!\ do not remove them
|
||||
{l s='January'}
|
||||
{l s='February'}
|
||||
{l s='March'}
|
||||
{l s='April'}
|
||||
{l s='May'}
|
||||
{l s='June'}
|
||||
{l s='July'}
|
||||
{l s='August'}
|
||||
{l s='September'}
|
||||
{l s='October'}
|
||||
{l s='November'}
|
||||
{l s='December'}
|
||||
*}
|
||||
{foreach $select as $k => $v}
|
||||
<option value="{$k}" {if $k == $fields_value[$key]}selected="selected"{/if}>{l s=$v}</option>
|
||||
{/foreach}
|
||||
{else}
|
||||
{foreach $select as $v}
|
||||
<option value="{$v}" {if $v == $fields_value[$key]}selected="selected"{/if}>{$v}</option>
|
||||
{/foreach}
|
||||
{/if}
|
||||
</select>
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
{elseif $input.type == 'group'}
|
||||
{assign var=groups value=$input.values}
|
||||
{include file='helpers/form/form_group.tpl'}
|
||||
{elseif $input.type == 'shop'}
|
||||
{$input.html}
|
||||
{elseif $input.type == 'categories'}
|
||||
{$categories_tree}
|
||||
{elseif $input.type == 'file'}
|
||||
{$input.file}
|
||||
{elseif $input.type == 'categories_select'}
|
||||
{$input.category_tree}
|
||||
{elseif $input.type == 'asso_shop' && isset($asso_shop) && $asso_shop}
|
||||
{$asso_shop}
|
||||
{elseif $input.type == 'color'}
|
||||
<div class="form-group">
|
||||
<div class="col-lg-2">
|
||||
<div class="row">
|
||||
<div class="input-group">
|
||||
<input type="color"
|
||||
data-hex="true"
|
||||
{if isset($input.class)} class="{$input.class}"
|
||||
{else} class="color mColorPickerInput"{/if}
|
||||
name="{$input.name}"
|
||||
value="{$fields_value[$input.name]|escape:'html':'UTF-8'}" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{elseif $input.type == 'date'}
|
||||
<div class="row">
|
||||
<div class="input-group col-lg-4">
|
||||
<input
|
||||
id="{if isset($input.id)}{$input.id}{else}{$input.name}{/if}"
|
||||
type="text"
|
||||
data-hex="true"
|
||||
{if isset($input.class)} class="{$input.class}"
|
||||
{else}class="datepicker"{/if}
|
||||
name="{$input.name}"
|
||||
value="{$fields_value[$input.name]|escape:'html':'UTF-8'}" />
|
||||
<span class="input-group-addon">
|
||||
<i class="icon-calendar-empty"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
{elseif $input.type == 'datetime'}
|
||||
<div class="row">
|
||||
<div class="input-group col-lg-4">
|
||||
<input
|
||||
id="{if isset($input.id)}{$input.id}{else}{$input.name}{/if}"
|
||||
type="text"
|
||||
data-hex="true"
|
||||
{if isset($input.class)} class="{$input.class}"
|
||||
{else} class="datetimepicker"{/if}
|
||||
name="{$input.name}"
|
||||
value="{$fields_value[$input.name]|escape:'html':'UTF-8'}" />
|
||||
<span class="input-group-addon">
|
||||
<i class="icon-calendar-empty"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
{elseif $input.type == 'free'}
|
||||
{$fields_value[$input.name]}
|
||||
{elseif $input.type == 'html'}
|
||||
{if isset($input.html_content)}
|
||||
{$input.html_content}
|
||||
{else}
|
||||
{$input.name}
|
||||
{/if}
|
||||
{/if}
|
||||
{/block}{* end block input *}
|
||||
{block name="description"}
|
||||
{if isset($input.desc) && !empty($input.desc)}
|
||||
<p class="help-block">
|
||||
{if is_array($input.desc)}
|
||||
{foreach $input.desc as $p}
|
||||
{if is_array($p)}
|
||||
<span id="{$p.id}">{$p.text}</span><br />
|
||||
{else}
|
||||
{$p}<br />
|
||||
{/if}
|
||||
{/foreach}
|
||||
{else}
|
||||
{$input.desc}
|
||||
{/if}
|
||||
</p>
|
||||
{/if}
|
||||
{/block}
|
||||
</div>
|
||||
{/block}{* end block field *}
|
||||
{/if}
|
||||
</div>
|
||||
{/block}
|
||||
{/foreach}
|
||||
{hook h='displayAdminForm' fieldset=$f}
|
||||
{if isset($name_controller)}
|
||||
{capture name=hookName assign=hookName}display{$name_controller|ucfirst}Form{/capture}
|
||||
{hook h=$hookName fieldset=$f}
|
||||
{elseif isset($smarty.get.controller)}
|
||||
{capture name=hookName assign=hookName}display{$smarty.get.controller|ucfirst|htmlentities}Form{/capture}
|
||||
{hook h=$hookName fieldset=$f}
|
||||
{/if}
|
||||
</div><!-- /.form-wrapper -->
|
||||
|
||||
{elseif $key == 'desc'}
|
||||
<div class="alert alert-info col-lg-offset-3">
|
||||
{if is_array($field)}
|
||||
{foreach $field as $k => $p}
|
||||
{if is_array($p)}
|
||||
<span{if isset($p.id)} id="{$p.id}"{/if}>{$p.text}</span><br />
|
||||
{else}
|
||||
{$p}
|
||||
{if isset($field[$k+1])}<br />{/if}
|
||||
{/if}
|
||||
{/foreach}
|
||||
{else}
|
||||
{$field}
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
{block name="other_input"}{/block}
|
||||
{/foreach}
|
||||
{block name="footer"}
|
||||
{capture name='form_submit_btn'}{counter name='form_submit_btn'}{/capture}
|
||||
{if isset($fieldset['form']['submit']) || isset($fieldset['form']['buttons'])}
|
||||
<div>
|
||||
{if isset($fieldset['form']['submit']) && !empty($fieldset['form']['submit'])}
|
||||
<button type="submit" value="1" id="{if isset($fieldset['form']['submit']['id'])}{$fieldset['form']['submit']['id']}{else}{$table}_form_submit_btn{/if}{if $smarty.capture.form_submit_btn > 1}_{($smarty.capture.form_submit_btn - 1)|intval}{/if}" name="{if isset($fieldset['form']['submit']['name'])}{$fieldset['form']['submit']['name']}{else}{$submit_action}{/if}{if isset($fieldset['form']['submit']['stay']) && $fieldset['form']['submit']['stay']}AndStay{/if}" class="{if isset($fieldset['form']['submit']['class'])}{$fieldset['form']['submit']['class']}{else}btn btn-default pull-right{/if}">
|
||||
<i class="{if isset($fieldset['form']['submit']['icon'])}{$fieldset['form']['submit']['icon']}{else}process-icon-save{/if}"></i> {$fieldset['form']['submit']['title']}
|
||||
</button>
|
||||
{/if}
|
||||
{if isset($show_cancel_button) && $show_cancel_button}
|
||||
<a href="{$back_url|escape:'html':'UTF-8'}" class="btn btn-default" onclick="window.history.back();">
|
||||
<i class="process-icon-cancel"></i> {l s='Cancel'}
|
||||
</a>
|
||||
{/if}
|
||||
{if isset($fieldset['form']['reset'])}
|
||||
<button
|
||||
type="reset"
|
||||
id="{if isset($fieldset['form']['reset']['id'])}{$fieldset['form']['reset']['id']}{else}{$table}_form_reset_btn{/if}"
|
||||
class="{if isset($fieldset['form']['reset']['class'])}{$fieldset['form']['reset']['class']}{else}btn btn-default{/if}"
|
||||
>
|
||||
{if isset($fieldset['form']['reset']['icon'])}<i class="{$fieldset['form']['reset']['icon']}"></i> {/if} {$fieldset['form']['reset']['title']}
|
||||
</button>
|
||||
{/if}
|
||||
{if isset($fieldset['form']['buttons'])}
|
||||
{foreach from=$fieldset['form']['buttons'] item=btn key=k}
|
||||
{if isset($btn.href) && trim($btn.href) != ''}
|
||||
<a href="{$btn.href}" {if isset($btn['id'])}id="{$btn['id']}"{/if} class="btn btn-default{if isset($btn['class'])} {$btn['class']}{/if}" {if isset($btn.js) && $btn.js} onclick="{$btn.js}"{/if}>{if isset($btn['icon'])}<i class="{$btn['icon']}" ></i> {/if}{$btn.title}</a>
|
||||
{else}
|
||||
<button type="{if isset($btn['type'])}{$btn['type']}{else}button{/if}" {if isset($btn['id'])}id="{$btn['id']}"{/if} class="btn btn-default{if isset($btn['class'])} {$btn['class']}{/if}" name="{if isset($btn['name'])}{$btn['name']}{else}submitOptions{$table}{/if}"{if isset($btn.js) && $btn.js} onclick="{$btn.js}"{/if}>{if isset($btn['icon'])}<i class="{$btn['icon']}" ></i> {/if}{$btn.title}</button>
|
||||
{/if}
|
||||
{/foreach}
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
{/block}
|
||||
</div>
|
||||
{/block}
|
||||
{block name="script"}
|
||||
var active_tab = '{$active_tab}';
|
||||
{literal}
|
||||
$(document).ready(function () {
|
||||
if($('#formAddPaymentPanel').length > 0){
|
||||
$(".pocztapolskaen_form").insertAfter('#formAddPaymentPanel');
|
||||
}
|
||||
});
|
||||
|
||||
{/literal}
|
||||
{/block}
|
||||
@@ -0,0 +1,15 @@
|
||||
<div class="panel">
|
||||
<div class="productTabs">
|
||||
<ul class="tab nav nav-tabs">
|
||||
<li class="tab-row {if $smarty.get.controller=='AdminPocztaPolskaOrders'} active{/if}">
|
||||
<a class="tab-page" id="pp_link_orders" href="{$link->getAdminLink('AdminPocztaPolskaOrders',true)|escape:'html'}"><i class="icon-info"></i> {l s='Zamówienia'}</a>
|
||||
</li>
|
||||
<li class="tab-row {if $smarty.get.controller=='AdminPocztaPolskaOrdersSets'} active{/if}">
|
||||
<a class="tab-page" id="pp_link_sets" href="{$link->getAdminLink('AdminPocztaPolskaOrdersSets',true)|escape:'html'}"><i class="icon-random"></i> {l s='Zbiory'}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
{$header}
|
||||
{$content}
|
||||
{$footer}
|
||||
</div>
|
||||
@@ -0,0 +1,209 @@
|
||||
{*
|
||||
* 2007-2017 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2017 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
{capture name='tr_count'}{counter name='tr_count'}{/capture}
|
||||
<tbody>
|
||||
{if count($list)}
|
||||
{foreach $list AS $index => $tr}
|
||||
<tr{if $position_identifier} id="tr_{$position_group_identifier}_{$tr.$identifier}_{if isset($tr.position['position'])}{$tr.position['position']}{else}0{/if}"{/if} class="{if isset($tr.class)}{$tr.class}{/if} {if $tr@iteration is odd by 1}odd{/if}"{if isset($tr.color) && $color_on_bg} style="background-color: {$tr.color}"{/if}
|
||||
{foreach $fields_hidden[$index] AS $field => $value}
|
||||
data-{$field} = "{$value}"
|
||||
{/foreach}>
|
||||
{if $bulk_actions && $has_bulk_actions}
|
||||
<td class="row-selector text-center">
|
||||
{if isset($list_skip_actions.delete)}
|
||||
{if !in_array($tr.$identifier, $list_skip_actions.delete)}
|
||||
<input {if !empty($fields_hidden[$index]['id_envelope'])}disabled="disabled"{/if} type="checkbox" name="{$list_id}Box[]" value="{$tr.$identifier}"{if isset($checked_boxes) && is_array($checked_boxes) && in_array({$tr.$identifier}, $checked_boxes)} checked="checked"{/if} class="noborder" />
|
||||
{/if}
|
||||
{else}
|
||||
<input {if !empty($fields_hidden[$index]['id_envelope'])}disabled="disabled"{/if} type="checkbox" name="{$list_id}Box[]" value="{$tr.$identifier}"{if isset($checked_boxes) && is_array($checked_boxes) && in_array({$tr.$identifier}, $checked_boxes)} checked="checked"{/if} class="noborder" />
|
||||
{/if}
|
||||
</td>
|
||||
{/if}
|
||||
{foreach $fields_display AS $key => $params}
|
||||
{block name="open_td"}
|
||||
<td
|
||||
{if isset($params.position)}
|
||||
id="td_{if !empty($position_group_identifier)}{$position_group_identifier}{else}0{/if}_{$tr.$identifier}{if $smarty.capture.tr_count > 1}_{($smarty.capture.tr_count - 1)|intval}{/if}"
|
||||
{/if}
|
||||
class="{strip}{if !$no_link}pointer{/if}
|
||||
{if isset($params.position) && $order_by == 'position' && $order_way != 'DESC'} dragHandle{/if}
|
||||
{if isset($params.class)} {$params.class}{/if}
|
||||
{if isset($params.align)} {$params.align}{/if}{/strip}"
|
||||
{if (!isset($params.position) && !$no_link && !isset($params.remove_onclick))}
|
||||
onclick="document.location = '{$fields_hidden[$index]['url']}'">
|
||||
{else}
|
||||
>
|
||||
{/if}
|
||||
{/block}
|
||||
{block name="td_content"}
|
||||
{if isset($params.prefix)}{$params.prefix}{/if}
|
||||
{if isset($params.badge_success) && $params.badge_success && isset($tr.badge_success) && $tr.badge_success == $params.badge_success}<span class="badge badge-success">{/if}
|
||||
{if isset($params.badge_warning) && $params.badge_warning && isset($tr.badge_warning) && $tr.badge_warning == $params.badge_warning}<span class="badge badge-warning">{/if}
|
||||
{if isset($params.badge_danger) && $params.badge_danger && isset($tr.badge_danger) && $tr.badge_danger == $params.badge_danger}<span class="badge badge-danger">{/if}
|
||||
{if isset($params.color) && isset($tr[$params.color])}
|
||||
<span class="label color_field" style="display:block;width:100px;white-space: normal;background-color:{$tr[$params.color]};color:{if Tools::getBrightness($tr[$params.color]) < 128}white{else}#383838{/if}">
|
||||
{/if}
|
||||
{if isset($tr.$key)}
|
||||
{if isset($params.active)}
|
||||
{$tr.$key}
|
||||
{elseif isset($params.callback)}
|
||||
{if isset($params.maxlength) && Tools::strlen($tr.$key) > $params.maxlength}
|
||||
<span title="{$tr.$key}">{$tr.$key|truncate:$params.maxlength:'...'}</span>
|
||||
{else}
|
||||
{$tr.$key}
|
||||
{/if}
|
||||
{elseif isset($params.activeVisu)}
|
||||
{if $tr.$key}
|
||||
<i class="icon-check-ok"></i> {l s='Enabled'}
|
||||
{else}
|
||||
<i class="icon-remove"></i> {l s='Disabled'}
|
||||
{/if}
|
||||
{elseif isset($params.position)}
|
||||
{if !$filters_has_value && $order_by == 'position' && $order_way != 'DESC'}
|
||||
<div class="dragGroup">
|
||||
<div class="positions">
|
||||
{$tr.$key.position + 1}
|
||||
</div>
|
||||
</div>
|
||||
{else}
|
||||
{$tr.$key.position + 1}
|
||||
{/if}
|
||||
{elseif isset($params.image)}
|
||||
{$tr.$key}
|
||||
{elseif isset($params.icon)}
|
||||
{if is_array($tr[$key])}
|
||||
{if isset($tr[$key]['class'])}
|
||||
<i class="{$tr[$key]['class']}"></i>
|
||||
{else}
|
||||
<img src="../img/admin/{$tr[$key]['src']}" alt="{$tr[$key]['alt']}" title="{$tr[$key]['alt']}" />
|
||||
{/if}
|
||||
{/if}
|
||||
{elseif isset($params.type) && $params.type == 'price'}
|
||||
{if isset($tr.id_currency)}
|
||||
{displayPrice price=$tr.$key currency=$tr.id_currency}
|
||||
{else}
|
||||
{displayPrice price=$tr.$key}
|
||||
{/if}
|
||||
{elseif isset($params.float)}
|
||||
{$tr.$key}
|
||||
{elseif isset($params.type) && $params.type == 'date'}
|
||||
{dateFormat date=$tr.$key full=0}
|
||||
{elseif isset($params.type) && $params.type == 'datetime'}
|
||||
{dateFormat date=$tr.$key full=1}
|
||||
{elseif isset($params.type) && $params.type == 'decimal'}
|
||||
{$tr.$key|string_format:"%.2f"}
|
||||
{elseif isset($params.type) && $params.type == 'percent'}
|
||||
{$tr.$key} {l s='%'}
|
||||
{elseif isset($params.type) && $params.type == 'html'}
|
||||
{$tr.$key}
|
||||
{* If type is 'editable', an input is created *}
|
||||
{elseif isset($params.type) && $params.type == 'editable' && isset($tr.id)}
|
||||
<input type="text" name="{$key}_{$tr.id}" value="{$tr.$key|escape:'html':'UTF-8'}" class="{$key}" />
|
||||
{elseif $key == 'color'}
|
||||
{if !is_array($tr.$key)}
|
||||
<div style="background-color: {$tr.$key};" class="attributes-color-container"></div>
|
||||
{else} {*TEXTURE*}
|
||||
<img src="{$tr.$key.texture}" alt="{$tr.name}" class="attributes-color-container" />
|
||||
{/if}
|
||||
{elseif isset($params.maxlength) && Tools::strlen($tr.$key) > $params.maxlength}
|
||||
<span title="{$tr.$key|escape:'html':'UTF-8'}">{$tr.$key|truncate:$params.maxlength:'...'|escape:'html':'UTF-8'}</span>
|
||||
{else}
|
||||
{$tr.$key|escape:'html':'UTF-8'}
|
||||
{/if}
|
||||
{else}
|
||||
{block name="default_field"}--{/block}
|
||||
{/if}
|
||||
{if isset($params.suffix)}{$params.suffix}{/if}
|
||||
{if isset($params.color) && isset($tr.color)}
|
||||
</span>
|
||||
{/if}
|
||||
{if isset($params.badge_danger) && $params.badge_danger && isset($tr.badge_danger) && $tr.badge_danger == $params.badge_danger}</span>{/if}
|
||||
{if isset($params.badge_warning) && $params.badge_warning && isset($tr.badge_warning) && $tr.badge_warning == $params.badge_warning}</span>{/if}
|
||||
{if isset($params.badge_success) && $params.badge_success && isset($tr.badge_success) && $tr.badge_success == $params.badge_success}</span>{/if}
|
||||
{/block}
|
||||
{block name="close_td"}
|
||||
</td>
|
||||
{/block}
|
||||
{/foreach}
|
||||
|
||||
{if $shop_link_type}
|
||||
<td title="{$tr.shop_name}">
|
||||
{if isset($tr.shop_short_name)}
|
||||
{$tr.shop_short_name}
|
||||
{else}
|
||||
{$tr.shop_name}
|
||||
{/if}
|
||||
</td>
|
||||
{/if}
|
||||
{if $has_actions}
|
||||
<td class="text-right">
|
||||
{assign var='compiled_actions' value=array()}
|
||||
{foreach $actions AS $key => $action}
|
||||
{if isset($tr.$action)}
|
||||
{if $key == 0}
|
||||
{assign var='action' value=$action}
|
||||
{/if}
|
||||
{if $action == 'delete' && $actions|@count > 2}
|
||||
{$compiled_actions[] = 'divider'}
|
||||
{/if}
|
||||
{$compiled_actions[] = $tr.$action}
|
||||
{/if}
|
||||
{/foreach}
|
||||
{if $compiled_actions|count > 0}
|
||||
{if $compiled_actions|count > 1}<div class="btn-group-action">{/if}
|
||||
<div class="btn-group pull-right">
|
||||
{$compiled_actions[0]}
|
||||
{if $compiled_actions|count > 1}
|
||||
<button class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
||||
<i class="icon-caret-down"></i>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
{foreach $compiled_actions AS $key => $action}
|
||||
{if $key != 0}
|
||||
<li{if $action == 'divider' && $compiled_actions|count > 3} class="divider"{/if}>
|
||||
{if $action != 'divider'}{$action}{/if}
|
||||
</li>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</ul>
|
||||
{/if}
|
||||
</div>
|
||||
{if $compiled_actions|count > 1}</div>{/if}
|
||||
{/if}
|
||||
</td>
|
||||
{/if}
|
||||
</tr>
|
||||
{/foreach}
|
||||
{else}
|
||||
<tr>
|
||||
<td class="list-empty" colspan="{count($fields_display)+1}">
|
||||
<div class="list-empty-msg">
|
||||
<i class="icon-warning-sign list-empty-icon"></i>
|
||||
{l s='No records found'}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
</tbody>
|
||||
@@ -0,0 +1,176 @@
|
||||
{*
|
||||
* 2007-2017 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2017 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
</table>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
{if $bulk_actions && $has_bulk_actions}
|
||||
<div class="btn-group bulk-actions dropup">
|
||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
||||
{l s='Bulk actions' d='Admin.Global'} <span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li>
|
||||
<a href="#" onclick="javascript:checkDelBoxes($(this).closest('form').get(0), '{$list_id}Box[]', true);return false;">
|
||||
<i class="icon-check-sign"></i> {l s='Select all'}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" onclick="javascript:checkDelBoxes($(this).closest('form').get(0), '{$list_id}Box[]', false);return false;">
|
||||
<i class="icon-check-empty"></i> {l s='Unselect all'}
|
||||
</a>
|
||||
</li>
|
||||
<li class="divider"></li>
|
||||
{foreach $bulk_actions as $key => $params}
|
||||
<li{if $params.text == 'divider'} class="divider"{/if}>
|
||||
|
||||
{if $params.text != 'divider'}
|
||||
{if isset($params.html)}
|
||||
{$params.html}
|
||||
{else}
|
||||
<a href="#" onclick="{if isset($params.onclick)}{$params.onclick};return false;{/if}{if isset($params.confirm)}if (confirm('{$params.confirm}')){/if}sendBulkAction($(this).closest('form').get(0), 'submitBulk{$key}{$table}');">
|
||||
{if isset($params.icon)}<i class="{$params.icon}"></i>{/if} {$params.text}
|
||||
</a>
|
||||
{/if}
|
||||
{/if}
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
<span class="loader btn" style="display:none;"><i class="icon-refresh icon-spin"></i></span>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{if !$simple_header && $list_total > $pagination[0]}
|
||||
<div class="col-lg-6">
|
||||
{* Choose number of results per page *}
|
||||
<div class="pagination">
|
||||
{l s='Display'}
|
||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
||||
{$selected_pagination}
|
||||
<i class="icon-caret-down"></i>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
{foreach $pagination AS $value}
|
||||
<li>
|
||||
<a href="javascript:void(0);" class="pagination-items-page" data-items="{$value|intval}" data-list-id="{$list_id}">{$value}</a>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
/ {$list_total} {l s='result(s)'}
|
||||
<input type="hidden" id="{$list_id}-pagination-items-page" name="{$list_id}_pagination" value="{$selected_pagination|intval}" />
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$('.pagination-items-page').on('click',function(e){
|
||||
e.preventDefault();
|
||||
$('#'+$(this).data("list-id")+'-pagination-items-page').val($(this).data("items")).closest("form").submit();
|
||||
});
|
||||
</script>
|
||||
<ul class="pagination pull-right">
|
||||
<li {if $page <= 1}class="disabled"{/if}>
|
||||
<a href="javascript:void(0);" class="pagination-link" data-page="1" data-list-id="{$list_id}">
|
||||
<i class="icon-double-angle-left"></i>
|
||||
</a>
|
||||
</li>
|
||||
<li {if $page <= 1}class="disabled"{/if}>
|
||||
<a href="javascript:void(0);" class="pagination-link" data-page="{$page - 1}" data-list-id="{$list_id}">
|
||||
<i class="icon-angle-left"></i>
|
||||
</a>
|
||||
</li>
|
||||
{assign p 0}
|
||||
{while $p++ < $total_pages}
|
||||
{if $p < $page-2}
|
||||
<li class="disabled">
|
||||
<a href="javascript:void(0);">…</a>
|
||||
</li>
|
||||
{assign p $page-3}
|
||||
{elseif $p > $page+2}
|
||||
<li class="disabled">
|
||||
<a href="javascript:void(0);">…</a>
|
||||
</li>
|
||||
{assign p $total_pages}
|
||||
{else}
|
||||
<li {if $p == $page}class="active"{/if}>
|
||||
<a href="javascript:void(0);" class="pagination-link" data-page="{$p}" data-list-id="{$list_id}">{$p}</a>
|
||||
</li>
|
||||
{/if}
|
||||
{/while}
|
||||
<li {if $page >= $total_pages}class="disabled"{/if}>
|
||||
<a href="javascript:void(0);" class="pagination-link" data-page="{$page + 1}" data-list-id="{$list_id}">
|
||||
<i class="icon-angle-right"></i>
|
||||
</a>
|
||||
</li>
|
||||
<li {if $page >= $total_pages}class="disabled"{/if}>
|
||||
<a href="javascript:void(0);" class="pagination-link" data-page="{$total_pages}" data-list-id="{$list_id}">
|
||||
<i class="icon-double-angle-right"></i>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<script type="text/javascript">
|
||||
$('.pagination-link').on('click',function(e){
|
||||
e.preventDefault();
|
||||
|
||||
if (!$(this).parent().hasClass('disabled'))
|
||||
$('#submitFilter'+$(this).data("list-id")).val($(this).data("page")).closest("form").submit();
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{block name="footer"}
|
||||
{foreach from=$toolbar_btn item=btn key=k}
|
||||
{if $k == 'back'}
|
||||
{assign 'back_button' $btn}
|
||||
{break}
|
||||
{/if}
|
||||
{/foreach}
|
||||
{if isset($back_button)}
|
||||
<div class="panel-footer">
|
||||
<a id="desc-{$table}-{if isset($back_button.imgclass)}{$back_button.imgclass}{else}{$k}{/if}" class="btn btn-default{if isset($back_button.target) && $back_button.target} _blank{/if}"{if isset($back_button.href)} href="{$back_button.href|escape:'html':'UTF-8'}"{/if}{if isset($back_button.js) && $back_button.js} onclick="{$back_button.js}"{/if}>
|
||||
<i class="process-icon-back {if isset($back_button.class)}{$back_button.class}{/if}" ></i> <span {if isset($back_button.force_desc) && $back_button.force_desc == true } class="locked" {/if}>{$back_button.desc}</span>
|
||||
</a>
|
||||
</div>
|
||||
{/if}
|
||||
{/block}
|
||||
{if !$simple_header}
|
||||
<input type="hidden" name="token" value="{$token|escape:'html':'UTF-8'}" />
|
||||
</div>
|
||||
{else}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{hook h='displayAdminListAfter'}
|
||||
{if isset($name_controller)}
|
||||
{capture name=hookName assign=hookName}display{$name_controller|ucfirst}ListAfter{/capture}
|
||||
{hook h=$hookName}
|
||||
{elseif isset($smarty.get.controller)}
|
||||
{capture name=hookName assign=hookName}display{$smarty.get.controller|ucfirst|htmlentities}ListAfter{/capture}
|
||||
{hook h=$hookName}
|
||||
{/if}
|
||||
|
||||
{block name="endForm"}
|
||||
</form>
|
||||
{/block}
|
||||
|
||||
{block name="after"}{/block}
|
||||
@@ -0,0 +1,15 @@
|
||||
<div class="panel">
|
||||
<div class="productTabs">
|
||||
<ul class="tab nav nav-tabs">
|
||||
<li class="tab-row {if $smarty.get.controller=='AdminPocztaPolskaOrders'} active{/if}">
|
||||
<a class="tab-page" id="pp_link_orders" href="{$link->getAdminLink('AdminPocztaPolskaOrders',true)|escape:'html'}"><i class="icon-info"></i> {l s='Zamówienia'}</a>
|
||||
</li>
|
||||
<li class="tab-row {if $smarty.get.controller=='AdminPocztaPolskaOrdersSets'} active{/if}">
|
||||
<a class="tab-page" id="pp_link_sets" href="{$link->getAdminLink('AdminPocztaPolskaOrdersSets',true)|escape:'html'}"><i class="icon-random"></i> {l s='Zbiory'}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
{$header}
|
||||
{$content}
|
||||
{$footer}
|
||||
</div>
|
||||
@@ -0,0 +1,387 @@
|
||||
{*
|
||||
* 2007-2017 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2017 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
{if $ajax}
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
$(".ajax_table_link").click(function () {
|
||||
var link = $(this);
|
||||
$.post($(this).attr('href'), function (data) {
|
||||
if (data.success == 1) {
|
||||
showSuccessMessage(data.text);
|
||||
if (link.hasClass('action-disabled')){
|
||||
link.removeClass('action-disabled').addClass('action-enabled');
|
||||
} else {
|
||||
link.removeClass('action-enabled').addClass('action-disabled');
|
||||
}
|
||||
link.children().each(function () {
|
||||
if ($(this).hasClass('hidden')) {
|
||||
$(this).removeClass('hidden');
|
||||
} else {
|
||||
$(this).addClass('hidden');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
showErrorMessage(data.text);
|
||||
}
|
||||
}, 'json');
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{/if}
|
||||
{* Display column names and arrows for ordering (ASC, DESC) *}
|
||||
{if $is_order_position}
|
||||
<script type="text/javascript" src="../js/jquery/plugins/jquery.tablednd.js"></script>
|
||||
<script type="text/javascript">
|
||||
var come_from = '{$list_id|addslashes}';
|
||||
var alternate = {if $order_way == 'DESC'}'1'{else}'0'{/if};
|
||||
</script>
|
||||
<script type="text/javascript" src="../js/admin/dnd.js"></script>
|
||||
{/if}
|
||||
{if !$simple_header}
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
$('table.{$list_id} .filter').keypress(function(e){
|
||||
var key = (e.keyCode ? e.keyCode : e.which);
|
||||
if (key == 13)
|
||||
{
|
||||
e.preventDefault();
|
||||
formSubmit(e, 'submitFilterButton{$list_id}');
|
||||
}
|
||||
})
|
||||
$('#submitFilterButton{$list_id}').click(function() {
|
||||
$('#submitFilter{$list_id}').val(1);
|
||||
});
|
||||
|
||||
if ($("table .datepicker").length > 0) {
|
||||
$("table .datepicker").datepicker({
|
||||
prevText: '',
|
||||
nextText: '',
|
||||
altFormat: 'yy-mm-dd'
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{/if}
|
||||
|
||||
{if !$simple_header}
|
||||
<div class="leadin">
|
||||
{block name="leadin"}{/block}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{block name="override_header"}{/block}
|
||||
|
||||
{hook h='displayAdminListBefore'}
|
||||
|
||||
{if isset($name_controller)}
|
||||
{capture name=hookName assign=hookName}display{$name_controller|ucfirst}ListBefore{/capture}
|
||||
{hook h=$hookName}
|
||||
{elseif isset($smarty.get.controller)}
|
||||
{capture name=hookName assign=hookName}display{$smarty.get.controller|ucfirst|htmlentities}ListBefore{/capture}
|
||||
{hook h=$hookName}
|
||||
{/if}
|
||||
|
||||
<div class="alert alert-warning" id="{$list_id}-empty-filters-alert" style="display:none;">{l s='Please fill at least one field to perform a search in this list.'}</div>
|
||||
{if isset($sql) && $sql}
|
||||
<form id="sql_form_{$list_id|escape:'html':'UTF-8'}" action="{$link->getAdminLink('AdminRequestSql')|escape}&addrequest_sql" method="post" class="hide">
|
||||
<input type="hidden" id="sql_query_{$list_id|escape:'html':'UTF-8'}" name="sql" value="{$sql|escape}"/>
|
||||
<input type="hidden" id="sql_name_{$list_id|escape:'html':'UTF-8'}" name="name" value=""/>
|
||||
</form>
|
||||
{/if}
|
||||
|
||||
{block name="startForm"}
|
||||
<form method="post" action="{$action|escape:'html':'UTF-8'}" class="form-horizontal clearfix" id="form-{$list_id}">
|
||||
{/block}
|
||||
|
||||
{if !$simple_header}
|
||||
<input type="hidden" id="submitFilter{$list_id}" name="submitFilter{$list_id}" value="0"/>
|
||||
<input type="hidden" name="page" value="{$page|intval}"/>
|
||||
<input type="hidden" name="selected_pagination" value="{$selected_pagination|intval}"/>
|
||||
{block name="override_form_extra"}{/block}
|
||||
<div class="panel col-lg-12">
|
||||
<div class="panel-heading">
|
||||
{if isset($icon)}<i class="{$icon}"></i> {/if}{if is_array($title)}{$title|end}{else}{$title}{/if}
|
||||
{if isset($toolbar_btn) && count($toolbar_btn) >0}
|
||||
<span class="badge">{$list_total}</span>
|
||||
<span class="panel-heading-action">
|
||||
{foreach from=$toolbar_btn item=btn key=k}
|
||||
{if $k != 'modules-list' && $k != 'back'}
|
||||
<a id="desc-{$table}-{if isset($btn.imgclass)}{$btn.imgclass}{else}{$k}{/if}" class="list-toolbar-btn{if isset($btn.target) && $btn.target} _blank{/if}"{if isset($btn.href)} href="{$btn.href|escape:'html':'UTF-8'}"{/if}{if isset($btn.js) && $btn.js} onclick="{$btn.js}"{/if}>
|
||||
<span title="" data-toggle="tooltip" class="label-tooltip" data-original-title="{l s=$btn.desc}" data-html="true" data-placement="top">
|
||||
<i class="process-icon-{if isset($btn.imgclass)}{$btn.imgclass}{else}{$k}{/if}{if isset($btn.class)} {$btn.class}{/if}"></i>
|
||||
</span>
|
||||
</a>
|
||||
{/if}
|
||||
{/foreach}
|
||||
{if isset($sql) && $sql}
|
||||
{assign var=sql_manager value=Profile::getProfileAccess(Context::getContext()->employee->id_profile, Tab::getIdFromClassName('AdminRequestSql'))}
|
||||
|
||||
{if $sql_manager.view == 1}
|
||||
<a class="list-toolbar-btn" href="javascript:void(0);" onclick="$('.leadin').first().append('<div class=\'alert alert-info\'>' + $('#sql_query_{$list_id|escape:'html':'UTF-8'}').val() + '</div>'); $(this).attr('onclick', '');">
|
||||
<span class="label-tooltip" data-toggle="tooltip" data-original-title="{l s='Show SQL query'}" data-html="true" data-placement="top" >
|
||||
<i class="process-icon-terminal"></i>
|
||||
</span>
|
||||
</a>
|
||||
<a class="list-toolbar-btn" href="javascript:void(0);" onclick="$('#sql_name_{$list_id|escape:'html':'UTF-8'}').val(createSqlQueryName()); $('#sql_query_{$list_id|escape:'html':'UTF-8'}').val($('#sql_query_{$list_id|escape:'html':'UTF-8'}').val().replace(/\s+limit\s+[0-9,\s]+$/ig, '').trim()); $('#sql_form_{$list_id|escape:'html':'UTF-8'}').submit();">
|
||||
<span class="label-tooltip" data-toggle="tooltip" data-original-title="{l s='Export to SQL Manager'}" data-html="true" data-placement="top" >
|
||||
<i class="process-icon-database"></i>
|
||||
</span>
|
||||
</a>
|
||||
{/if}
|
||||
{/if}
|
||||
</span>
|
||||
{/if}
|
||||
</div>
|
||||
{if $show_toolbar}
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
var submited = false;
|
||||
$(function() {
|
||||
//get reference on save link
|
||||
btn_save = $('i[class~="process-icon-save"]').parent();
|
||||
//get reference on form submit button
|
||||
btn_submit = $('#{$table}_form_submit_btn');
|
||||
if (btn_save.length > 0 && btn_submit.length > 0) {
|
||||
//get reference on save and stay link
|
||||
btn_save_and_stay = $('i[class~="process-icon-save-and-stay"]').parent();
|
||||
//get reference on current save link label
|
||||
lbl_save = $('#desc-{$table}-save div');
|
||||
//override save link label with submit button value
|
||||
if (btn_submit.val().length > 0) {
|
||||
lbl_save.html(btn_submit.attr("value"));
|
||||
}
|
||||
if (btn_save_and_stay.length > 0) {
|
||||
//get reference on current save link label
|
||||
lbl_save_and_stay = $('#desc-{$table}-save-and-stay div');
|
||||
//override save and stay link label with submit button value
|
||||
if (btn_submit.val().length > 0 && lbl_save_and_stay && !lbl_save_and_stay.hasClass('locked')) {
|
||||
lbl_save_and_stay.html(btn_submit.val() + " {l s='and stay'} ");
|
||||
}
|
||||
}
|
||||
//hide standard submit button
|
||||
btn_submit.hide();
|
||||
//bind enter key press to validate form
|
||||
$('#{$table}_form').keypress(function (e) {
|
||||
if (e.which == 13 && e.target.localName != 'textarea') {
|
||||
$('#desc-{$table}-save').click();
|
||||
}
|
||||
});
|
||||
//submit the form
|
||||
{block name=formSubmit}
|
||||
btn_save.click(function() {
|
||||
// Avoid double click
|
||||
if (submited) {
|
||||
return false;
|
||||
}
|
||||
submited = true;
|
||||
//add hidden input to emulate submit button click when posting the form -> field name posted
|
||||
btn_submit.before('<input type="hidden" name="'+btn_submit.attr("name")+'" value="1" />');
|
||||
$('#{$table}_form').submit();
|
||||
return false;
|
||||
});
|
||||
if (btn_save_and_stay) {
|
||||
btn_save_and_stay.click(function() {
|
||||
//add hidden input to emulate submit button click when posting the form -> field name posted
|
||||
btn_submit.before('<input type="hidden" name="'+btn_submit.attr("name")+'AndStay" value="1" />');
|
||||
$('#{$table}_form').submit();
|
||||
return false;
|
||||
});
|
||||
}
|
||||
{/block}
|
||||
}
|
||||
});
|
||||
//]]>
|
||||
</script>
|
||||
{/if}
|
||||
{elseif $simple_header}
|
||||
<div class="panel col-lg-12">
|
||||
{if isset($title)}<h3>{if isset($icon)}<i class="{$icon}"></i> {/if}{if is_array($title)}{$title|end}{else}{$title}{/if}</h3>{/if}
|
||||
{/if}
|
||||
|
||||
|
||||
{if $bulk_actions && $has_bulk_actions}
|
||||
{assign var=y value=2}
|
||||
{else}
|
||||
{assign var=y value=1}
|
||||
{/if}
|
||||
<style>
|
||||
@media (max-width: 992px) {
|
||||
{foreach from=$fields_display item=param name=params}
|
||||
.table-responsive-row td:nth-of-type({math equation="x+y" x=$smarty.foreach.params.index y=$y}):before {
|
||||
content: "{$param.title}";
|
||||
}
|
||||
{/foreach}
|
||||
}
|
||||
</style>
|
||||
|
||||
{block name="preTable"}{/block}
|
||||
<div class="table-responsive-row clearfix{if isset($use_overflow) && $use_overflow} overflow-y{/if}">
|
||||
<table{if $table_id} id="table-{$table_id}"{/if} class="table{if $table_dnd} tableDnD{/if} {$table}" >
|
||||
<thead>
|
||||
<tr class="nodrag nodrop">
|
||||
{if $bulk_actions && $has_bulk_actions}
|
||||
<th class="center fixed-width-xs"></th>
|
||||
{/if}
|
||||
{foreach $fields_display AS $key => $params}
|
||||
<th class="{if isset($params.class)}{$params.class}{/if}{if isset($params.align)} {$params.align}{/if}">
|
||||
<span class="title_box{if isset($order_by) && ($key == $order_by)} active{/if}">
|
||||
{if isset($params.hint)}
|
||||
<span class="label-tooltip" data-toggle="tooltip"
|
||||
title="
|
||||
{if is_array($params.hint)}
|
||||
{foreach $params.hint as $hint}
|
||||
{if is_array($hint)}
|
||||
{$hint.text}
|
||||
{else}
|
||||
{$hint}
|
||||
{/if}
|
||||
{/foreach}
|
||||
{else}
|
||||
{$params.hint}
|
||||
{/if}
|
||||
">
|
||||
{$params.title}
|
||||
</span>
|
||||
{else}
|
||||
{$params.title}
|
||||
{/if}
|
||||
{if (!isset($params.orderby) || $params.orderby) && !$simple_header && $show_filters}
|
||||
<a {if isset($order_by) && ($key == $order_by) && ($order_way == 'DESC')}class="active"{/if} href="{$currentIndex|escape:'html':'UTF-8'}&{$list_id}Orderby={$key|urlencode}&{$list_id}Orderway=desc&token={$token|escape:'html':'UTF-8'}{if isset($smarty.get.$identifier)}&{$identifier}={$smarty.get.$identifier|intval}{/if}">
|
||||
<i class="icon-caret-down"></i>
|
||||
</a>
|
||||
<a {if isset($order_by) && ($key == $order_by) && ($order_way == 'ASC')}class="active"{/if} href="{$currentIndex|escape:'html':'UTF-8'}&{$list_id}Orderby={$key|urlencode}&{$list_id}Orderway=asc&token={$token|escape:'html':'UTF-8'}{if isset($smarty.get.$identifier)}&{$identifier}={$smarty.get.$identifier|intval}{/if}">
|
||||
<i class="icon-caret-up"></i>
|
||||
</a>
|
||||
{/if}
|
||||
</span>
|
||||
</th>
|
||||
{/foreach}
|
||||
{if $shop_link_type}
|
||||
<th>
|
||||
<span class="title_box">
|
||||
{if $shop_link_type == 'shop'}
|
||||
{l s='Shop'}
|
||||
{else}
|
||||
{l s='Shop group'}
|
||||
{/if}
|
||||
</span>
|
||||
</th>
|
||||
{/if}
|
||||
{if $has_actions || $show_filters}
|
||||
<th>{if !$simple_header}{/if}</th>
|
||||
{/if}
|
||||
</tr>
|
||||
{if !$simple_header && $show_filters}
|
||||
<tr class="nodrag nodrop filter {if $row_hover}row_hover{/if}">
|
||||
{if $has_bulk_actions}
|
||||
<th class="text-center">
|
||||
--
|
||||
</th>
|
||||
{/if}
|
||||
{* Filters (input, select, date or bool) *}
|
||||
{foreach $fields_display AS $key => $params}
|
||||
<th {if isset($params.align)} class="{$params.align}" {/if}>
|
||||
{if isset($params.search) && !$params.search}
|
||||
--
|
||||
{else}
|
||||
{if $params.type == 'bool'}
|
||||
<select class="filter fixed-width-sm center" name="{$list_id}Filter_{if isset($params.filter_key)}{$params.filter_key}{else}{$key}{/if}">
|
||||
<option value="">-</option>
|
||||
<option value="1" {if $params.value == 1} selected="selected" {/if}>{l s='Yes'}</option>
|
||||
<option value="0" {if $params.value == 0 && $params.value != ''} selected="selected" {/if}>{l s='No'}</option>
|
||||
</select>
|
||||
{elseif $params.type == 'date' || $params.type == 'datetime'}
|
||||
<div class="date_range row">
|
||||
<div class="input-group fixed-width-md center">
|
||||
<input type="text" class="filter datepicker date-input form-control" id="local_{$params.id_date}_0" name="local_{$params.name_date}[0]" placeholder="{l s='From'}" />
|
||||
<input type="hidden" id="{$params.id_date}_0" name="{$params.name_date}[0]" value="{if isset($params.value.0)}{$params.value.0}{/if}">
|
||||
<span class="input-group-addon">
|
||||
<i class="icon-calendar"></i>
|
||||
</span>
|
||||
</div>
|
||||
<div class="input-group fixed-width-md center">
|
||||
<input type="text" class="filter datepicker date-input form-control" id="local_{$params.id_date}_1" name="local_{$params.name_date}[1]" placeholder="{l s='To'}" />
|
||||
<input type="hidden" id="{$params.id_date}_1" name="{$params.name_date}[1]" value="{if isset($params.value.1)}{$params.value.1}{/if}">
|
||||
<span class="input-group-addon">
|
||||
<i class="icon-calendar"></i>
|
||||
</span>
|
||||
</div>
|
||||
<script>
|
||||
$(function() {
|
||||
var dateStart = parseDate($("#{$params.id_date}_0").val());
|
||||
var dateEnd = parseDate($("#{$params.id_date}_1").val());
|
||||
$("#local_{$params.id_date}_0").datepicker("option", "altField", "#{$params.id_date}_0");
|
||||
$("#local_{$params.id_date}_1").datepicker("option", "altField", "#{$params.id_date}_1");
|
||||
if (dateStart !== null){
|
||||
$("#local_{$params.id_date}_0").datepicker("setDate", dateStart);
|
||||
}
|
||||
if (dateEnd !== null){
|
||||
$("#local_{$params.id_date}_1").datepicker("setDate", dateEnd);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
{elseif $params.type == 'select'}
|
||||
{if isset($params.filter_key)}
|
||||
<select class="filter{if isset($params.align) && $params.align == 'center'}center{/if}" onchange="$('#submitFilterButton{$list_id}').focus();$('#submitFilterButton{$list_id}').click();" name="{$list_id}Filter_{$params.filter_key}" {if isset($params.width)} style="width:{$params.width}px"{/if}>
|
||||
<option value="" {if $params.value == ''} selected="selected" {/if}>-</option>
|
||||
{if isset($params.list) && is_array($params.list)}
|
||||
{foreach $params.list AS $option_value => $option_display}
|
||||
<option value="{$option_value}" {if (string)$option_display === (string)$params.value || (string)$option_value === (string)$params.value} selected="selected"{/if}>{$option_display}</option>
|
||||
{/foreach}
|
||||
{/if}
|
||||
</select>
|
||||
{/if}
|
||||
{else}
|
||||
<input type="text" class="filter" name="{$list_id}Filter_{if isset($params.filter_key)}{$params.filter_key}{else}{$key}{/if}" value="{$params.value|escape:'html':'UTF-8'}" {if isset($params.width) && $params.width != 'auto'} style="width:{$params.width}px"{/if} />
|
||||
{/if}
|
||||
{/if}
|
||||
</th>
|
||||
{/foreach}
|
||||
|
||||
{if $shop_link_type}
|
||||
<th>--</th>
|
||||
{/if}
|
||||
{if $has_actions || $show_filters}
|
||||
<th class="actions">
|
||||
{if $show_filters}
|
||||
<span class="pull-right">
|
||||
{*Search must be before reset for default form submit*}
|
||||
<button type="submit" id="submitFilterButton{$list_id}" name="submitFilter" class="btn btn-default" data-list-id="{$list_id}">
|
||||
<i class="icon-search"></i> {l s='Search' d="Admin.Actions"}
|
||||
</button>
|
||||
{if $filters_has_value}
|
||||
<button type="submit" name="submitReset{$list_id}" class="btn btn-warning">
|
||||
<i class="icon-eraser"></i> {l s='Reset'}
|
||||
</button>
|
||||
{/if}
|
||||
</span>
|
||||
{/if}
|
||||
</th>
|
||||
{/if}
|
||||
</tr>
|
||||
{/if}
|
||||
</thead>
|
||||
@@ -0,0 +1,191 @@
|
||||
{*
|
||||
* 2007-2017 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2017 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
</table>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
{if $bulk_actions && $has_bulk_actions}
|
||||
<div class="btn-group bulk-actions dropup">
|
||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
||||
{l s='Bulk actions' d='Admin.Global'} <span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li>
|
||||
<a href="#" onclick="javascript:checkDelBoxes($(this).closest('form').get(0), '{$list_id}Box[]', true);return false;">
|
||||
<i class="icon-check-sign"></i> {l s='Select all'}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" onclick="javascript:checkDelBoxes($(this).closest('form').get(0), '{$list_id}Box[]', false);return false;">
|
||||
<i class="icon-check-empty"></i> {l s='Unselect all'}
|
||||
</a>
|
||||
</li>
|
||||
<li class="divider"></li>
|
||||
{foreach $bulk_actions as $key => $params}
|
||||
<li{if $params.text == 'divider'} class="divider"{/if}>
|
||||
{if $params.text != 'divider'}
|
||||
<a href="#" onclick="{if isset($params.onclick)}{$params.onclick};return false;{/if}{if isset($params.confirm)}if (confirm('{$params.confirm}')){/if}sendBulkAction($(this).closest('form').get(0), 'submitBulk{$key}{$table}');">
|
||||
{if isset($params.icon)}<i class="{$params.icon}"></i>{/if} {$params.text}
|
||||
</a>
|
||||
{/if}
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{if !$simple_header && $list_total > $pagination[0]}
|
||||
<div class="col-lg-6">
|
||||
{* Choose number of results per page *}
|
||||
<div class="pagination">
|
||||
{l s='Display'}
|
||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
||||
{$selected_pagination}
|
||||
<i class="icon-caret-down"></i>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
{foreach $pagination AS $value}
|
||||
<li>
|
||||
<a href="javascript:void(0);" class="pagination-items-page" data-items="{$value|intval}" data-list-id="{$list_id}">{$value}</a>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
/ {$list_total} {l s='result(s)'}
|
||||
<input type="hidden" id="{$list_id}-pagination-items-page" name="{$list_id}_pagination" value="{$selected_pagination|intval}" />
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$('.pagination-items-page').on('click',function(e){
|
||||
e.preventDefault();
|
||||
$('#'+$(this).data("list-id")+'-pagination-items-page').val($(this).data("items")).closest("form").submit();
|
||||
});
|
||||
</script>
|
||||
<ul class="pagination pull-right">
|
||||
<li {if $page <= 1}class="disabled"{/if}>
|
||||
<a href="javascript:void(0);" class="pagination-link" data-page="1" data-list-id="{$list_id}">
|
||||
<i class="icon-double-angle-left"></i>
|
||||
</a>
|
||||
</li>
|
||||
<li {if $page <= 1}class="disabled"{/if}>
|
||||
<a href="javascript:void(0);" class="pagination-link" data-page="{$page - 1}" data-list-id="{$list_id}">
|
||||
<i class="icon-angle-left"></i>
|
||||
</a>
|
||||
</li>
|
||||
{assign p 0}
|
||||
{while $p++ < $total_pages}
|
||||
{if $p < $page-2}
|
||||
<li class="disabled">
|
||||
<a href="javascript:void(0);">…</a>
|
||||
</li>
|
||||
{assign p $page-3}
|
||||
{elseif $p > $page+2}
|
||||
<li class="disabled">
|
||||
<a href="javascript:void(0);">…</a>
|
||||
</li>
|
||||
{assign p $total_pages}
|
||||
{else}
|
||||
<li {if $p == $page}class="active"{/if}>
|
||||
<a href="javascript:void(0);" class="pagination-link" data-page="{$p}" data-list-id="{$list_id}">{$p}</a>
|
||||
</li>
|
||||
{/if}
|
||||
{/while}
|
||||
<li {if $page >= $total_pages}class="disabled"{/if}>
|
||||
<a href="javascript:void(0);" class="pagination-link" data-page="{$page + 1}" data-list-id="{$list_id}">
|
||||
<i class="icon-angle-right"></i>
|
||||
</a>
|
||||
</li>
|
||||
<li {if $page >= $total_pages}class="disabled"{/if}>
|
||||
<a href="javascript:void(0);" class="pagination-link" data-page="{$total_pages}" data-list-id="{$list_id}">
|
||||
<i class="icon-double-angle-right"></i>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<script type="text/javascript">
|
||||
$('.pagination-link').on('click',function(e){
|
||||
e.preventDefault();
|
||||
|
||||
if (!$(this).parent().hasClass('disabled'))
|
||||
$('#submitFilter'+$(this).data("list-id")).val($(this).data("page")).closest("form").submit();
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="row" id="transfer_sets_action" style="display:none;">
|
||||
<hr/>
|
||||
<div class="col-lg-12">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-lg-1">
|
||||
{l s='Przenieś do'}
|
||||
</label>
|
||||
<div class="col-lg-1">
|
||||
<select id="id_buffor" name="id_buffor">
|
||||
{foreach from=$id_buffors key=k item=label}
|
||||
<option value="{$k}">{$label}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-lg-10">
|
||||
<input type="hidden" name="id_order_set" value="{$id_order_set}" />
|
||||
<input type="submit" class="btn btn-default" name="submitBulk{$key}{$table}" value="{$params.text}" {if isset($params.confirm)}onclick="return confirm('{$params.confirm}');"{/if} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{block name="footer"}
|
||||
{foreach from=$toolbar_btn item=btn key=k}
|
||||
{if $k == 'back'}
|
||||
{assign 'back_button' $btn}
|
||||
{break}
|
||||
{/if}
|
||||
{/foreach}
|
||||
{if isset($back_button)}
|
||||
<div class="panel-footer">
|
||||
<a id="desc-{$table}-{if isset($back_button.imgclass)}{$back_button.imgclass}{else}{$k}{/if}" class="btn btn-default{if isset($back_button.target) && $back_button.target} _blank{/if}"{if isset($back_button.href)} href="{$back_button.href|escape:'html':'UTF-8'}"{/if}{if isset($back_button.js) && $back_button.js} onclick="{$back_button.js}"{/if}>
|
||||
<i class="process-icon-back {if isset($back_button.class)}{$back_button.class}{/if}" ></i> <span {if isset($back_button.force_desc) && $back_button.force_desc == true } class="locked" {/if}>{$back_button.desc}</span>
|
||||
</a>
|
||||
</div>
|
||||
{/if}
|
||||
{/block}
|
||||
{if !$simple_header}
|
||||
<input type="hidden" name="token" value="{$token|escape:'html':'UTF-8'}" />
|
||||
</div>
|
||||
{else}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{hook h='displayAdminListAfter'}
|
||||
{if isset($name_controller)}
|
||||
{capture name=hookName assign=hookName}display{$name_controller|ucfirst}ListAfter{/capture}
|
||||
{hook h=$hookName}
|
||||
{elseif isset($smarty.get.controller)}
|
||||
{capture name=hookName assign=hookName}display{$smarty.get.controller|ucfirst|htmlentities}ListAfter{/capture}
|
||||
{hook h=$hookName}
|
||||
{/if}
|
||||
|
||||
{block name="endForm"}
|
||||
</form>
|
||||
{/block}
|
||||
|
||||
{block name="after"}{/block}
|
||||
@@ -0,0 +1,844 @@
|
||||
{extends file="helpers/form/form.tpl"}
|
||||
{block name="fieldset"}
|
||||
{capture name='fieldset_name'}{counter name='fieldset_name'}{/capture}
|
||||
<div class="panel {if isset($fieldset.form.panelClass)}{$fieldset.form.panelClass}{/if}" id="fieldset_{$f}{if isset($smarty.capture.identifier_count) && $smarty.capture.identifier_count}_{$smarty.capture.identifier_count|intval}{/if}{if $smarty.capture.fieldset_name > 1}_{($smarty.capture.fieldset_name - 1)|intval}{/if}">
|
||||
{foreach $fieldset.form as $key => $field}
|
||||
{if $key == 'legend'}
|
||||
{block name="legend"}
|
||||
<div class="panel-heading">
|
||||
{if isset($field.image) && isset($field.title)}<img src="{$field.image}" alt="{$field.title|escape:'html':'UTF-8'}" />{/if}
|
||||
{if isset($field.icon)}<i class="{$field.icon}"></i>{/if}
|
||||
{$field.title}
|
||||
</div>
|
||||
{/block}
|
||||
{elseif $key == 'description' && $field}
|
||||
<div class="alert alert-info">{$field}</div>
|
||||
{elseif $key == 'warning' && $field}
|
||||
<div class="alert alert-warning">{$field}</div>
|
||||
{elseif $key == 'success' && $field}
|
||||
<div class="alert alert-success">{$field}</div>
|
||||
{elseif $key == 'error' && $field}
|
||||
<div class="alert alert-danger">{$field}</div>
|
||||
{elseif $key == 'input'}
|
||||
<div class="form-wrapper">
|
||||
{foreach $field as $fieldCounter=>$input}
|
||||
{block name="input_row"}
|
||||
<div class="form-group{if isset($input.form_group_class)} {$input.form_group_class}{/if}{if $input.type == 'hidden'} hide{/if}"{if $input.name == 'id_state'} id="contains_states"{if !$contains_states} style="display:none;"{/if}{/if}{if isset($tabs) && isset($input.tab)} data-tab-id="{$input.tab}"{/if}>
|
||||
{if $input.type == 'hidden'}
|
||||
<input type="hidden" name="{$input.name}" id="{$input.name}" value="{$fields_value[$input.name]|escape:'html':'UTF-8'}" />
|
||||
{else}
|
||||
{block name="label"}
|
||||
{if isset($input.label)}
|
||||
<label class="control-label col-lg-3{if isset($input.required) && $input.required && $input.type != 'radio'} required{/if}">
|
||||
{if isset($input.hint)}
|
||||
<span class="label-tooltip" data-toggle="tooltip" data-html="true" title="{if is_array($input.hint)}
|
||||
{foreach $input.hint as $hint}
|
||||
{if is_array($hint)}
|
||||
{$hint.text|escape:'quotes'}
|
||||
{else}
|
||||
{$hint|escape:'quotes'}
|
||||
{/if}
|
||||
{/foreach}
|
||||
{else}
|
||||
{$input.hint|escape:'quotes'}
|
||||
{/if}">
|
||||
{/if}
|
||||
{$input.label}
|
||||
{if isset($input.hint)}
|
||||
</span>
|
||||
{/if}
|
||||
</label>
|
||||
{/if}
|
||||
{/block}
|
||||
|
||||
{block name="field"}
|
||||
<div class="col-lg-{if isset($input.col)}{$input.col|intval}{else}9{/if}{if !isset($input.label)} col-lg-offset-3{/if}">
|
||||
{block name="input"}
|
||||
{if $input.type == 'text' || $input.type == 'tags'}
|
||||
{if isset($input.lang) AND $input.lang}
|
||||
{if $languages|count > 1}
|
||||
<div class="form-group">
|
||||
{/if}
|
||||
{foreach $languages as $language}
|
||||
{assign var='value_text' value=$fields_value[$input.name][$language.id_lang]}
|
||||
{if $languages|count > 1}
|
||||
<div class="translatable-field lang-{$language.id_lang}" {if $language.id_lang != $defaultFormLanguage}style="display:none"{/if}>
|
||||
<div class="col-lg-9">
|
||||
{/if}
|
||||
{if $input.type == 'tags'}
|
||||
{literal}
|
||||
<script type="text/javascript">
|
||||
$().ready(function () {
|
||||
var input_id = '{/literal}{if isset($input.id)}{$input.id}_{$language.id_lang}{else}{$input.name}_{$language.id_lang}{/if}{literal}';
|
||||
$('#'+input_id).tagify({delimiters: [13,44], addTagPrompt: '{/literal}{l s='Add tag' js=1}{literal}'});
|
||||
$({/literal}'#{$table}{literal}_form').submit( function() {
|
||||
$(this).find('#'+input_id).val($('#'+input_id).tagify('serialize'));
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{/literal}
|
||||
{/if}
|
||||
{if isset($input.maxchar) || isset($input.prefix) || isset($input.suffix)}
|
||||
<div class="input-group{if isset($input.class)} {$input.class}{/if}">
|
||||
{/if}
|
||||
{if isset($input.maxchar) && $input.maxchar}
|
||||
<span id="{if isset($input.id)}{$input.id}_{$language.id_lang}{else}{$input.name}_{$language.id_lang}{/if}_counter" class="input-group-addon">
|
||||
<span class="text-count-down">{$input.maxchar|intval}</span>
|
||||
</span>
|
||||
{/if}
|
||||
{if isset($input.prefix)}
|
||||
<span class="input-group-addon">
|
||||
{$input.prefix}
|
||||
</span>
|
||||
{/if}
|
||||
<input type="text"
|
||||
id="{if isset($input.id)}{$input.id}_{$language.id_lang}{else}{$input.name}_{$language.id_lang}{/if}"
|
||||
name="{$input.name}_{$language.id_lang}"
|
||||
class="{if isset($input.class)}{$input.class}{/if}{if $input.type == 'tags'} tagify{/if}"
|
||||
value="{if isset($input.string_format) && $input.string_format}{$value_text|string_format:$input.string_format|escape:'html':'UTF-8'}{else}{$value_text|escape:'html':'UTF-8'}{/if}"
|
||||
onkeyup="if (isArrowKey(event)) return ;updateFriendlyURL();"
|
||||
{if isset($input.size)} size="{$input.size}"{/if}
|
||||
{if isset($input.maxchar) && $input.maxchar} data-maxchar="{$input.maxchar|intval}"{/if}
|
||||
{if isset($input.maxlength) && $input.maxlength} maxlength="{$input.maxlength|intval}"{/if}
|
||||
{if isset($input.readonly) && $input.readonly} readonly="readonly"{/if}
|
||||
{if isset($input.disabled) && $input.disabled} disabled="disabled"{/if}
|
||||
{if isset($input.autocomplete) && !$input.autocomplete} autocomplete="off"{/if}
|
||||
{if isset($input.required) && $input.required} required="required" {/if}
|
||||
{if isset($input.placeholder) && $input.placeholder} placeholder="{$input.placeholder}"{/if} />
|
||||
{if isset($input.suffix)}
|
||||
<span class="input-group-addon">
|
||||
{$input.suffix}
|
||||
</span>
|
||||
{/if}
|
||||
{if isset($input.maxchar) || isset($input.prefix) || isset($input.suffix)}
|
||||
</div>
|
||||
{/if}
|
||||
{if $languages|count > 1}
|
||||
</div>
|
||||
<div class="col-lg-2">
|
||||
<button type="button" class="btn btn-default dropdown-toggle" tabindex="-1" data-toggle="dropdown">
|
||||
{$language.iso_code}
|
||||
<i class="icon-caret-down"></i>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
{foreach from=$languages item=language}
|
||||
<li><a href="javascript:hideOtherLanguage({$language.id_lang});" tabindex="-1">{$language.name}</a></li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/foreach}
|
||||
{if isset($input.maxchar) && $input.maxchar}
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
{foreach from=$languages item=language}
|
||||
countDown($("#{if isset($input.id)}{$input.id}_{$language.id_lang}{else}{$input.name}_{$language.id_lang}{/if}"), $("#{if isset($input.id)}{$input.id}_{$language.id_lang}{else}{$input.name}_{$language.id_lang}{/if}_counter"));
|
||||
{/foreach}
|
||||
});
|
||||
</script>
|
||||
{/if}
|
||||
{if $languages|count > 1}
|
||||
</div>
|
||||
{/if}
|
||||
{else}
|
||||
{if $input.type == 'tags'}
|
||||
{literal}
|
||||
<script type="text/javascript">
|
||||
$().ready(function () {
|
||||
var input_id = '{/literal}{if isset($input.id)}{$input.id}{else}{$input.name}{/if}{literal}';
|
||||
$('#'+input_id).tagify({delimiters: [13,44], addTagPrompt: '{/literal}{l s='Add tag'}{literal}'});
|
||||
$({/literal}'#{$table}{literal}_form').submit( function() {
|
||||
$(this).find('#'+input_id).val($('#'+input_id).tagify('serialize'));
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{/literal}
|
||||
{/if}
|
||||
{assign var='value_text' value=$fields_value[$input.name]}
|
||||
{if isset($input.maxchar) || isset($input.prefix) || isset($input.suffix)}
|
||||
<div class="input-group{if isset($input.class)} {$input.class}{/if}">
|
||||
{/if}
|
||||
{if isset($input.maxchar) && $input.maxchar}
|
||||
<span id="{if isset($input.id)}{$input.id}{else}{$input.name}{/if}_counter" class="input-group-addon"><span class="text-count-down">{$input.maxchar|intval}</span></span>
|
||||
{/if}
|
||||
{if isset($input.prefix)}
|
||||
<span class="input-group-addon">
|
||||
{$input.prefix}
|
||||
</span>
|
||||
{/if}
|
||||
<input type="text"
|
||||
name="{$input.name}"
|
||||
id="{if isset($input.id)}{$input.id}{else}{$input.name}{/if}"
|
||||
value="{if isset($input.string_format) && $input.string_format}{$value_text|string_format:$input.string_format|escape:'html':'UTF-8'}{else}{$value_text|escape:'html':'UTF-8'}{/if}"
|
||||
class="{if isset($input.class)}{$input.class}{/if}{if $input.type == 'tags'} tagify{/if}"
|
||||
{if isset($input.size)} size="{$input.size}"{/if}
|
||||
{if isset($input.maxchar) && $input.maxchar} data-maxchar="{$input.maxchar|intval}"{/if}
|
||||
{if isset($input.maxlength) && $input.maxlength} maxlength="{$input.maxlength|intval}"{/if}
|
||||
{if isset($input.readonly) && $input.readonly} readonly="readonly"{/if}
|
||||
{if isset($input.disabled) && $input.disabled} disabled="disabled"{/if}
|
||||
{if isset($input.autocomplete) && !$input.autocomplete} autocomplete="off"{/if}
|
||||
{if isset($input.required) && $input.required } required="required" {/if}
|
||||
{if isset($input.placeholder) && $input.placeholder } placeholder="{$input.placeholder}"{/if}
|
||||
/>
|
||||
{if isset($input.suffix)}
|
||||
<span class="input-group-addon">
|
||||
{$input.suffix}
|
||||
</span>
|
||||
{/if}
|
||||
|
||||
{if isset($input.maxchar) || isset($input.prefix) || isset($input.suffix)}
|
||||
</div>
|
||||
{/if}
|
||||
{if isset($input.maxchar) && $input.maxchar}
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
countDown($("#{if isset($input.id)}{$input.id}{else}{$input.name}{/if}"), $("#{if isset($input.id)}{$input.id}{else}{$input.name}{/if}_counter"));
|
||||
});
|
||||
</script>
|
||||
{/if}
|
||||
{/if}
|
||||
{elseif $input.type == 'textbutton'}
|
||||
{assign var='value_text' value=$fields_value[$input.name]}
|
||||
<div class="row">
|
||||
<div class="col-lg-9">
|
||||
{if isset($input.maxchar)}
|
||||
<div class="input-group">
|
||||
<span id="{if isset($input.id)}{$input.id}{else}{$input.name}{/if}_counter" class="input-group-addon">
|
||||
<span class="text-count-down">{$input.maxchar|intval}</span>
|
||||
</span>
|
||||
{/if}
|
||||
<input type="text"
|
||||
name="{$input.name}"
|
||||
id="{if isset($input.id)}{$input.id}{else}{$input.name}{/if}"
|
||||
value="{if isset($input.string_format) && $input.string_format}{$value_text|string_format:$input.string_format|escape:'html':'UTF-8'}{else}{$value_text|escape:'html':'UTF-8'}{/if}"
|
||||
class="{if isset($input.class)}{$input.class}{/if}{if $input.type == 'tags'} tagify{/if}"
|
||||
{if isset($input.size)} size="{$input.size}"{/if}
|
||||
{if isset($input.maxchar) && $input.maxchar} data-maxchar="{$input.maxchar|intval}"{/if}
|
||||
{if isset($input.maxlength) && $input.maxlength} maxlength="{$input.maxlength|intval}"{/if}
|
||||
{if isset($input.readonly) && $input.readonly} readonly="readonly"{/if}
|
||||
{if isset($input.disabled) && $input.disabled} disabled="disabled"{/if}
|
||||
{if isset($input.autocomplete) && !$input.autocomplete} autocomplete="off"{/if}
|
||||
{if isset($input.placeholder) && $input.placeholder } placeholder="{$input.placeholder}"{/if}
|
||||
/>
|
||||
{if isset($input.suffix)}{$input.suffix}{/if}
|
||||
{if isset($input.maxchar) && $input.maxchar}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="col-lg-2">
|
||||
<button type="button" class="btn btn-default{if isset($input.button.attributes['class'])} {$input.button.attributes['class']}{/if}{if isset($input.button.class)} {$input.button.class}{/if}"
|
||||
{foreach from=$input.button.attributes key=name item=value}
|
||||
{if $name|lower != 'class'}
|
||||
{$name|escape:'html':'UTF-8'}="{$value|escape:'html':'UTF-8'}"
|
||||
{/if}
|
||||
{/foreach} >
|
||||
{$input.button.label}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{if isset($input.maxchar) && $input.maxchar}
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
countDown($("#{if isset($input.id)}{$input.id}{else}{$input.name}{/if}"), $("#{if isset($input.id)}{$input.id}{else}{$input.name}{/if}_counter"));
|
||||
});
|
||||
</script>
|
||||
{/if}
|
||||
{elseif $input.type == 'swap'}
|
||||
<div class="form-group">
|
||||
<div class="col-lg-9">
|
||||
<div class="form-control-static row">
|
||||
<div class="col-xs-6">
|
||||
<select {if isset($input.size)}size="{$input.size|escape:'html':'utf-8'}"{/if}{if isset($input.onchange)} onchange="{$input.onchange|escape:'html':'utf-8'}"{/if} class="{if isset($input.class)}{$input.class|escape:'html':'utf-8'}{/if}" id="availableSwap" name="{$input.name|escape:'html':'utf-8'}_available[]" multiple="multiple">
|
||||
{foreach $input.options.query AS $option}
|
||||
{if is_object($option)}
|
||||
{if !in_array($option->$input.options.id, $fields_value[$input.name])}
|
||||
<option value="{$option->$input.options.id}">{$option->$input.options.name}</option>
|
||||
{/if}
|
||||
{elseif $option == "-"}
|
||||
<option value="">-</option>
|
||||
{else}
|
||||
{if !in_array($option[$input.options.id], $fields_value[$input.name])}
|
||||
<option value="{$option[$input.options.id]}">{$option[$input.options.name]}</option>
|
||||
{/if}
|
||||
{/if}
|
||||
{/foreach}
|
||||
</select>
|
||||
<a href="#" id="addSwap" class="btn btn-default btn-block">{l s='Add'} <i class="icon-arrow-right"></i></a>
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
<select {if isset($input.size)}size="{$input.size|escape:'html':'utf-8'}"{/if}{if isset($input.onchange)} onchange="{$input.onchange|escape:'html':'utf-8'}"{/if} class="{if isset($input.class)}{$input.class|escape:'html':'utf-8'}{/if}" id="selectedSwap" name="{$input.name|escape:'html':'utf-8'}_selected[]" multiple="multiple">
|
||||
{foreach $input.options.query AS $option}
|
||||
{if is_object($option)}
|
||||
{if in_array($option->$input.options.id, $fields_value[$input.name])}
|
||||
<option value="{$option->$input.options.id}">{$option->$input.options.name}</option>
|
||||
{/if}
|
||||
{elseif $option == "-"}
|
||||
<option value="">-</option>
|
||||
{else}
|
||||
{if in_array($option[$input.options.id], $fields_value[$input.name])}
|
||||
<option value="{$option[$input.options.id]}">{$option[$input.options.name]}</option>
|
||||
{/if}
|
||||
{/if}
|
||||
{/foreach}
|
||||
</select>
|
||||
<a href="#" id="removeSwap" class="btn btn-default btn-block"><i class="icon-arrow-left"></i> {l s='Remove'}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{elseif $input.type == 'select'}
|
||||
{if isset($input.options.query) && !$input.options.query && isset($input.empty_message)}
|
||||
{$input.empty_message}
|
||||
{$input.required = false}
|
||||
{$input.desc = null}
|
||||
{else}
|
||||
<select name="{$input.name|escape:'html':'utf-8'}"
|
||||
class="{if isset($input.class)}{$input.class|escape:'html':'utf-8'}{/if} fixed-width-xl"
|
||||
id="{if isset($input.id)}{$input.id|escape:'html':'utf-8'}{else}{$input.name|escape:'html':'utf-8'}{/if}"
|
||||
{if isset($input.multiple) && $input.multiple} multiple="multiple"{/if}
|
||||
{if isset($input.size)} size="{$input.size|escape:'html':'utf-8'}"{/if}
|
||||
{if isset($input.onchange)} onchange="{$input.onchange|escape:'html':'utf-8'}"{/if}
|
||||
{if isset($input.disabled) && $input.disabled} disabled="disabled"{/if}>
|
||||
{if isset($input.options.default)}
|
||||
<option value="{$input.options.default.value|escape:'html':'utf-8'}">{$input.options.default.label|escape:'html':'utf-8'}</option>
|
||||
{/if}
|
||||
{if isset($input.options.optiongroup)}
|
||||
{foreach $input.options.optiongroup.query AS $optiongroup}
|
||||
<optgroup label="{$optiongroup[$input.options.optiongroup.label]}">
|
||||
{foreach $optiongroup[$input.options.options.query] as $option}
|
||||
<option value="{$option[$input.options.options.id]}"
|
||||
{if isset($input.multiple)}
|
||||
{foreach $fields_value[$input.name] as $field_value}
|
||||
{if $field_value == $option[$input.options.options.id]}selected="selected"{/if}
|
||||
{/foreach}
|
||||
{else}
|
||||
{if $fields_value[$input.name] == $option[$input.options.options.id]}selected="selected"{/if}
|
||||
{/if}
|
||||
>{$option[$input.options.options.name]}</option>
|
||||
{/foreach}
|
||||
</optgroup>
|
||||
{/foreach}
|
||||
{else}
|
||||
{foreach $input.options.query AS $option}
|
||||
{if is_object($option)}
|
||||
<option value="{$option->$input.options.id}"
|
||||
{if isset($input.multiple)}
|
||||
{foreach $fields_value[$input.name] as $field_value}
|
||||
{if $field_value == $option->$input.options.id}
|
||||
selected="selected"
|
||||
{/if}
|
||||
{/foreach}
|
||||
{else}
|
||||
{if $fields_value[$input.name] == $option->$input.options.id}
|
||||
selected="selected"
|
||||
{/if}
|
||||
{/if}
|
||||
>{$option->$input.options.name}</option>
|
||||
{elseif $option == "-"}
|
||||
<option value="">-</option>
|
||||
{else}
|
||||
<option value="{$option[$input.options.id]}"
|
||||
{if isset($input.multiple)}
|
||||
{foreach $fields_value[$input.name] as $field_value}
|
||||
{if $field_value == $option[$input.options.id]}
|
||||
selected="selected"
|
||||
{/if}
|
||||
{/foreach}
|
||||
{else}
|
||||
{if $fields_value[$input.name] == $option[$input.options.id]}
|
||||
selected="selected"
|
||||
{/if}
|
||||
{/if}
|
||||
>{$option[$input.options.name]}</option>
|
||||
|
||||
{/if}
|
||||
{/foreach}
|
||||
{/if}
|
||||
</select>
|
||||
{/if}
|
||||
{elseif $input.type == 'radio'}
|
||||
{foreach $input.values as $value}
|
||||
<div class="radio {if isset($input.class)}{$input.class}{/if}">
|
||||
{strip}
|
||||
<label>
|
||||
<input type="radio" name="{$input.name}" id="{$value.id}" value="{$value.value|escape:'html':'UTF-8'}"{if $fields_value[$input.name] == $value.value} checked="checked"{/if}{if isset($input.disabled) && $input.disabled} disabled="disabled"{/if}/>
|
||||
{$value.label}
|
||||
</label>
|
||||
{/strip}
|
||||
</div>
|
||||
{if isset($value.p) && $value.p}<p class="help-block">{$value.p}</p>{/if}
|
||||
{/foreach}
|
||||
{elseif $input.type == 'switch'}
|
||||
<span class="switch prestashop-switch fixed-width-lg">
|
||||
{foreach $input.values as $value}
|
||||
<input type="radio" name="{$input.name}"{if $value.value == 1} id="{$input.name}_on"{else} id="{$input.name}_off"{/if} value="{$value.value}"{if $fields_value[$input.name] == $value.value} checked="checked"{/if}{if isset($input.disabled) && $input.disabled} disabled="disabled"{/if}/>
|
||||
{strip}
|
||||
<label {if $value.value == 1} for="{$input.name}_on"{else} for="{$input.name}_off"{/if}>
|
||||
{if $value.value == 1}
|
||||
{l s='Yes'}
|
||||
{else}
|
||||
{l s='No'}
|
||||
{/if}
|
||||
</label>
|
||||
{/strip}
|
||||
{/foreach}
|
||||
<a class="slide-button btn"></a>
|
||||
</span>
|
||||
{elseif $input.type == 'textarea'}
|
||||
{if isset($input.maxchar) && $input.maxchar}<div class="input-group">{/if}
|
||||
{assign var=use_textarea_autosize value=true}
|
||||
{if isset($input.lang) AND $input.lang}
|
||||
{foreach $languages as $language}
|
||||
{if $languages|count > 1}
|
||||
<div class="form-group translatable-field lang-{$language.id_lang}"{if $language.id_lang != $defaultFormLanguage} style="display:none;"{/if}>
|
||||
<div class="col-lg-9">
|
||||
{/if}
|
||||
{if isset($input.maxchar) && $input.maxchar}
|
||||
<span id="{if isset($input.id)}{$input.id}_{$language.id_lang}{else}{$input.name}_{$language.id_lang}{/if}_counter" class="input-group-addon">
|
||||
<span class="text-count-down">{$input.maxchar|intval}</span>
|
||||
</span>
|
||||
{/if}
|
||||
<textarea{if isset($input.readonly) && $input.readonly} readonly="readonly"{/if} name="{$input.name}_{$language.id_lang}" id="{if isset($input.id)}{$input.id}{else}{$input.name}{/if}_{$language.id_lang}" class="{if isset($input.autoload_rte) && $input.autoload_rte}rte autoload_rte{else}textarea-autosize{/if}{if isset($input.class)} {$input.class}{/if}"{if isset($input.maxlength) && $input.maxlength} maxlength="{$input.maxlength|intval}"{/if}{if isset($input.maxchar) && $input.maxchar} data-maxchar="{$input.maxchar|intval}"{/if}>{$fields_value[$input.name][$language.id_lang]|escape:'html':'UTF-8'}</textarea>
|
||||
{if $languages|count > 1}
|
||||
</div>
|
||||
<div class="col-lg-2">
|
||||
<button type="button" class="btn btn-default dropdown-toggle" tabindex="-1" data-toggle="dropdown">
|
||||
{$language.iso_code}
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
{foreach from=$languages item=language}
|
||||
<li>
|
||||
<a href="javascript:hideOtherLanguage({$language.id_lang});" tabindex="-1">{$language.name}</a>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/foreach}
|
||||
{if isset($input.maxchar) && $input.maxchar}
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
{foreach from=$languages item=language}
|
||||
countDown($("#{if isset($input.id)}{$input.id}_{$language.id_lang}{else}{$input.name}_{$language.id_lang}{/if}"), $("#{if isset($input.id)}{$input.id}_{$language.id_lang}{else}{$input.name}_{$language.id_lang}{/if}_counter"));
|
||||
{/foreach}
|
||||
});
|
||||
</script>
|
||||
{/if}
|
||||
{else}
|
||||
{if isset($input.maxchar) && $input.maxchar}
|
||||
<span id="{if isset($input.id)}{$input.id}_{$language.id_lang}{else}{$input.name}_{$language.id_lang}{/if}_counter" class="input-group-addon">
|
||||
<span class="text-count-down">{$input.maxchar|intval}</span>
|
||||
</span>
|
||||
{/if}
|
||||
<textarea{if isset($input.readonly) && $input.readonly} readonly="readonly"{/if} name="{$input.name}" id="{if isset($input.id)}{$input.id}{else}{$input.name}{/if}" {if isset($input.cols)}cols="{$input.cols}"{/if} {if isset($input.rows)}rows="{$input.rows}"{/if} class="{if isset($input.autoload_rte) && $input.autoload_rte}rte autoload_rte{else}textarea-autosize{/if}{if isset($input.class)} {$input.class}{/if}"{if isset($input.maxlength) && $input.maxlength} maxlength="{$input.maxlength|intval}"{/if}{if isset($input.maxchar) && $input.maxchar} data-maxchar="{$input.maxchar|intval}"{/if}>{$fields_value[$input.name]|escape:'html':'UTF-8'}</textarea>
|
||||
{if isset($input.maxchar) && $input.maxchar}
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
countDown($("#{if isset($input.id)}{$input.id}{else}{$input.name}{/if}"), $("#{if isset($input.id)}{$input.id}{else}{$input.name}{/if}_counter"));
|
||||
});
|
||||
</script>
|
||||
{/if}
|
||||
{/if}
|
||||
{if isset($input.maxchar) && $input.maxchar}</div>{/if}
|
||||
{elseif $input.type == 'checkbox'}
|
||||
{if isset($input.expand)}
|
||||
<a class="btn btn-default show_checkbox{if strtolower($input.expand.default) == 'hide'} hidden{/if}" href="#">
|
||||
<i class="icon-{$input.expand.show.icon}"></i>
|
||||
{$input.expand.show.text}
|
||||
{if isset($input.expand.print_total) && $input.expand.print_total > 0}
|
||||
<span class="badge">{$input.expand.print_total}</span>
|
||||
{/if}
|
||||
</a>
|
||||
<a class="btn btn-default hide_checkbox{if strtolower($input.expand.default) == 'show'} hidden{/if}" href="#">
|
||||
<i class="icon-{$input.expand.hide.icon}"></i>
|
||||
{$input.expand.hide.text}
|
||||
{if isset($input.expand.print_total) && $input.expand.print_total > 0}
|
||||
<span class="badge">{$input.expand.print_total}</span>
|
||||
{/if}
|
||||
</a>
|
||||
{/if}
|
||||
{foreach $input.values.query as $value}
|
||||
{assign var=id_checkbox value=$input.name|cat:'_'|cat:$value[$input.values.id]}
|
||||
<div class="checkbox{if isset($input.expand) && strtolower($input.expand.default) == 'show'} hidden{/if}">
|
||||
{strip}
|
||||
<label for="{$id_checkbox}">
|
||||
<input type="checkbox" name="{$id_checkbox}" id="{$id_checkbox}" class="{if isset($input.class)}{$input.class}{/if}"{if isset($value.val)} value="{$value.val|escape:'html':'UTF-8'}"{/if}{if isset($fields_value[$id_checkbox]) && $fields_value[$id_checkbox]} checked="checked"{/if} />
|
||||
{$value[$input.values.name]}
|
||||
</label>
|
||||
{/strip}
|
||||
</div>
|
||||
{/foreach}
|
||||
{elseif $input.type == 'change-password'}
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<button type="button" id="{$input.name}-btn-change" class="btn btn-default">
|
||||
<i class="icon-lock"></i>
|
||||
{l s='Change password...'}
|
||||
</button>
|
||||
<div id="{$input.name}-change-container" class="form-password-change well hide">
|
||||
<div class="form-group">
|
||||
<label for="old_passwd" class="control-label col-lg-2 required">
|
||||
{l s='Current password'}
|
||||
</label>
|
||||
<div class="col-lg-10">
|
||||
<div class="input-group fixed-width-lg">
|
||||
<span class="input-group-addon">
|
||||
<i class="icon-unlock"></i>
|
||||
</span>
|
||||
<input type="password" id="old_passwd" name="old_passwd" class="form-control" value="" required="required" autocomplete="off">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr />
|
||||
<div class="form-group">
|
||||
<label for="{$input.name}" class="required control-label col-lg-2">
|
||||
<span class="label-tooltip" data-toggle="tooltip" data-html="true" title="" data-original-title="{l s='Password should be at least 8 characters long.'}">
|
||||
{l s='New password'}
|
||||
</span>
|
||||
</label>
|
||||
<div class="col-lg-9">
|
||||
<div class="input-group fixed-width-lg">
|
||||
<span class="input-group-addon">
|
||||
<i class="icon-key"></i>
|
||||
</span>
|
||||
<input type="password" id="{$input.name}" name="{$input.name}" class="{if isset($input.class)}{$input.class}{/if}" value="" required="required" autocomplete="off"/>
|
||||
</div>
|
||||
<span id="{$input.name}-output"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="{$input.name}2" class="required control-label col-lg-2">
|
||||
{l s='Confirm password'}
|
||||
</label>
|
||||
<div class="col-lg-4">
|
||||
<div class="input-group fixed-width-lg">
|
||||
<span class="input-group-addon">
|
||||
<i class="icon-key"></i>
|
||||
</span>
|
||||
<input type="password" id="{$input.name}2" name="{$input.name}2" class="{if isset($input.class)}{$input.class}{/if}" value="" autocomplete="off"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-lg-10 col-lg-offset-2">
|
||||
<input type="text" class="form-control fixed-width-md pull-left" id="{$input.name}-generate-field" disabled="disabled">
|
||||
<button type="button" id="{$input.name}-generate-btn" class="btn btn-default">
|
||||
<i class="icon-random"></i>
|
||||
{l s='Generate password'}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-lg-10 col-lg-offset-2">
|
||||
<p class="checkbox">
|
||||
<label for="{$input.name}-checkbox-mail">
|
||||
<input name="passwd_send_email" id="{$input.name}-checkbox-mail" type="checkbox" checked="checked">
|
||||
{l s='Send me this new password by Email'}
|
||||
</label>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<button type="button" id="{$input.name}-cancel-btn" class="btn btn-default">
|
||||
<i class="icon-remove"></i>
|
||||
{l s='Cancel'}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(function(){
|
||||
var $oldPwd = $('#old_passwd');
|
||||
var $passwordField = $('#{$input.name}');
|
||||
var $output = $('#{$input.name}-output');
|
||||
var $generateBtn = $('#{$input.name}-generate-btn');
|
||||
var $generateField = $('#{$input.name}-generate-field');
|
||||
var $cancelBtn = $('#{$input.name}-cancel-btn');
|
||||
|
||||
var feedback = [
|
||||
{ badge: 'text-danger', text: '{l s="Invalid" js=1}' },
|
||||
{ badge: 'text-warning', text: '{l s="Okay" js=1}' },
|
||||
{ badge: 'text-success', text: '{l s="Good" js=1}' },
|
||||
{ badge: 'text-success', text: '{l s="Fabulous" js=1}' }
|
||||
];
|
||||
$.passy.requirements.length.min = 8;
|
||||
$.passy.requirements.characters = 'DIGIT';
|
||||
$passwordField.passy(function(strength, valid) {
|
||||
$output.text(feedback[strength].text);
|
||||
$output.removeClass('text-danger').removeClass('text-warning').removeClass('text-success');
|
||||
$output.addClass(feedback[strength].badge);
|
||||
if (valid){
|
||||
$output.show();
|
||||
}
|
||||
else {
|
||||
$output.hide();
|
||||
}
|
||||
});
|
||||
var $container = $('#{$input.name}-change-container');
|
||||
var $changeBtn = $('#{$input.name}-btn-change');
|
||||
var $confirmPwd = $('#{$input.name}2');
|
||||
|
||||
$changeBtn.on('click',function(){
|
||||
$container.removeClass('hide');
|
||||
$changeBtn.addClass('hide');
|
||||
});
|
||||
$generateBtn.click(function() {
|
||||
$generateField.passy( 'generate', 8 );
|
||||
var generatedPassword = $generateField.val();
|
||||
$passwordField.val(generatedPassword);
|
||||
$confirmPwd.val(generatedPassword);
|
||||
});
|
||||
$cancelBtn.on('click',function() {
|
||||
$container.find("input").val("");
|
||||
$container.addClass('hide');
|
||||
$changeBtn.removeClass('hide');
|
||||
});
|
||||
|
||||
$.validator.addMethod('password_same', function(value, element) {
|
||||
return $passwordField.val() == $confirmPwd.val();
|
||||
}, '{l s="Invalid password confirmation" js=1}');
|
||||
|
||||
$('#employee_form').validate({
|
||||
rules: {
|
||||
"email": {
|
||||
email: true
|
||||
},
|
||||
"{$input.name}" : {
|
||||
minlength: 8
|
||||
},
|
||||
"{$input.name}2": {
|
||||
password_same: true
|
||||
},
|
||||
"old_passwd" : {},
|
||||
},
|
||||
// override jquery validate plugin defaults for bootstrap 3
|
||||
highlight: function(element) {
|
||||
$(element).closest('.form-group').addClass('has-error');
|
||||
},
|
||||
unhighlight: function(element) {
|
||||
$(element).closest('.form-group').removeClass('has-error');
|
||||
},
|
||||
errorElement: 'span',
|
||||
errorClass: 'help-block',
|
||||
errorPlacement: function(error, element) {
|
||||
if(element.parent('.input-group').length) {
|
||||
error.insertAfter(element.parent());
|
||||
} else {
|
||||
error.insertAfter(element);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{elseif $input.type == 'password'}
|
||||
<div class="input-group fixed-width-lg">
|
||||
<span class="input-group-addon">
|
||||
<i class="icon-key"></i>
|
||||
</span>
|
||||
<input type="password"
|
||||
id="{if isset($input.id)}{$input.id}{else}{$input.name}{/if}"
|
||||
name="{$input.name}"
|
||||
class="{if isset($input.class)}{$input.class}{/if}"
|
||||
value=""
|
||||
{if isset($input.autocomplete) && !$input.autocomplete}autocomplete="off"{/if}
|
||||
{if isset($input.required) && $input.required } required="required" {/if} />
|
||||
</div>
|
||||
|
||||
{elseif $input.type == 'birthday'}
|
||||
<div class="form-group">
|
||||
{foreach $input.options as $key => $select}
|
||||
<div class="col-lg-2">
|
||||
<select name="{$key}" class="fixed-width-lg{if isset($input.class)} {$input.class}{/if}">
|
||||
<option value="">-</option>
|
||||
{if $key == 'months'}
|
||||
{*
|
||||
This comment is useful to the translator tools /!\ do not remove them
|
||||
{l s='January'}
|
||||
{l s='February'}
|
||||
{l s='March'}
|
||||
{l s='April'}
|
||||
{l s='May'}
|
||||
{l s='June'}
|
||||
{l s='July'}
|
||||
{l s='August'}
|
||||
{l s='September'}
|
||||
{l s='October'}
|
||||
{l s='November'}
|
||||
{l s='December'}
|
||||
*}
|
||||
{foreach $select as $k => $v}
|
||||
<option value="{$k}" {if $k == $fields_value[$key]}selected="selected"{/if}>{l s=$v}</option>
|
||||
{/foreach}
|
||||
{else}
|
||||
{foreach $select as $v}
|
||||
<option value="{$v}" {if $v == $fields_value[$key]}selected="selected"{/if}>{$v}</option>
|
||||
{/foreach}
|
||||
{/if}
|
||||
</select>
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
{elseif $input.type == 'group'}
|
||||
{assign var=groups value=$input.values}
|
||||
{include file='helpers/form/form_group.tpl'}
|
||||
{elseif $input.type == 'shop'}
|
||||
{$input.html}
|
||||
{elseif $input.type == 'categories'}
|
||||
{$categories_tree}
|
||||
{elseif $input.type == 'file'}
|
||||
{$input.file}
|
||||
{elseif $input.type == 'categories_select'}
|
||||
{$input.category_tree}
|
||||
{elseif $input.type == 'asso_shop' && isset($asso_shop) && $asso_shop}
|
||||
{$asso_shop}
|
||||
{elseif $input.type == 'color'}
|
||||
<div class="form-group">
|
||||
<div class="col-lg-2">
|
||||
<div class="row">
|
||||
<div class="input-group">
|
||||
<input type="color"
|
||||
data-hex="true"
|
||||
{if isset($input.class)} class="{$input.class}"
|
||||
{else} class="color mColorPickerInput"{/if}
|
||||
name="{$input.name}"
|
||||
value="{$fields_value[$input.name]|escape:'html':'UTF-8'}" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{elseif $input.type == 'date'}
|
||||
<div class="row">
|
||||
<div class="input-group col-lg-4">
|
||||
<input
|
||||
id="{if isset($input.id)}{$input.id}{else}{$input.name}{/if}"
|
||||
type="text"
|
||||
data-hex="true"
|
||||
{if isset($input.class)} class="{$input.class}"
|
||||
{else}class="datepicker"{/if}
|
||||
name="{$input.name}"
|
||||
value="{$fields_value[$input.name]|escape:'html':'UTF-8'}" />
|
||||
<span class="input-group-addon">
|
||||
<i class="icon-calendar-empty"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
{elseif $input.type == 'datetime'}
|
||||
<div class="row">
|
||||
<div class="input-group col-lg-4">
|
||||
<input
|
||||
id="{if isset($input.id)}{$input.id}{else}{$input.name}{/if}"
|
||||
type="text"
|
||||
data-hex="true"
|
||||
{if isset($input.class)} class="{$input.class}"
|
||||
{else} class="datetimepicker"{/if}
|
||||
name="{$input.name}"
|
||||
value="{$fields_value[$input.name]|escape:'html':'UTF-8'}" />
|
||||
<span class="input-group-addon">
|
||||
<i class="icon-calendar-empty"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
{elseif $input.type == 'free'}
|
||||
{$fields_value[$input.name]}
|
||||
{elseif $input.type == 'html'}
|
||||
{if isset($input.html_content)}
|
||||
{$input.html_content}
|
||||
{else}
|
||||
{$input.name}
|
||||
{/if}
|
||||
{/if}
|
||||
{/block}{* end block input *}
|
||||
{block name="description"}
|
||||
{if isset($input.desc) && !empty($input.desc)}
|
||||
<p class="help-block">
|
||||
{if is_array($input.desc)}
|
||||
{foreach $input.desc as $p}
|
||||
{if is_array($p)}
|
||||
<span id="{$p.id}">{$p.text}</span><br />
|
||||
{else}
|
||||
{$p}<br />
|
||||
{/if}
|
||||
{/foreach}
|
||||
{else}
|
||||
{$input.desc}
|
||||
{/if}
|
||||
</p>
|
||||
{/if}
|
||||
{/block}
|
||||
</div>
|
||||
{/block}{* end block field *}
|
||||
{/if}
|
||||
</div>
|
||||
{/block}
|
||||
{/foreach}
|
||||
{hook h='displayAdminForm' fieldset=$f}
|
||||
{if isset($name_controller)}
|
||||
{capture name=hookName assign=hookName}display{$name_controller|ucfirst}Form{/capture}
|
||||
{hook h=$hookName fieldset=$f}
|
||||
{elseif isset($smarty.get.controller)}
|
||||
{capture name=hookName assign=hookName}display{$smarty.get.controller|ucfirst|htmlentities}Form{/capture}
|
||||
{hook h=$hookName fieldset=$f}
|
||||
{/if}
|
||||
</div><!-- /.form-wrapper -->
|
||||
|
||||
{elseif $key == 'desc'}
|
||||
<div class="alert alert-info col-lg-offset-3">
|
||||
{if is_array($field)}
|
||||
{foreach $field as $k => $p}
|
||||
{if is_array($p)}
|
||||
<span{if isset($p.id)} id="{$p.id}"{/if}>{$p.text}</span><br />
|
||||
{else}
|
||||
{$p}
|
||||
{if isset($field[$k+1])}<br />{/if}
|
||||
{/if}
|
||||
{/foreach}
|
||||
{else}
|
||||
{$field}
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
{block name="other_input"}{/block}
|
||||
{/foreach}
|
||||
{block name="footer"}
|
||||
{capture name='form_submit_btn'}{counter name='form_submit_btn'}{/capture}
|
||||
{if isset($fieldset['form']['submit']) || isset($fieldset['form']['buttons'])}
|
||||
<div>
|
||||
{if isset($fieldset['form']['submit']) && !empty($fieldset['form']['submit'])}
|
||||
<button type="submit" value="1" id="{if isset($fieldset['form']['submit']['id'])}{$fieldset['form']['submit']['id']}{else}{$table}_form_submit_btn{/if}{if $smarty.capture.form_submit_btn > 1}_{($smarty.capture.form_submit_btn - 1)|intval}{/if}" name="{if isset($fieldset['form']['submit']['name'])}{$fieldset['form']['submit']['name']}{else}{$submit_action}{/if}{if isset($fieldset['form']['submit']['stay']) && $fieldset['form']['submit']['stay']}AndStay{/if}" class="{if isset($fieldset['form']['submit']['class'])}{$fieldset['form']['submit']['class']}{else}btn btn-default pull-right{/if}">
|
||||
<i class="{if isset($fieldset['form']['submit']['icon'])}{$fieldset['form']['submit']['icon']}{else}process-icon-save{/if}"></i> {$fieldset['form']['submit']['title']}
|
||||
</button>
|
||||
{/if}
|
||||
{if isset($show_cancel_button) && $show_cancel_button}
|
||||
<a href="{$back_url|escape:'html':'UTF-8'}" class="btn btn-default" onclick="window.history.back();">
|
||||
<i class="process-icon-cancel"></i> {l s='Cancel'}
|
||||
</a>
|
||||
{/if}
|
||||
{if isset($fieldset['form']['reset'])}
|
||||
<button
|
||||
type="reset"
|
||||
id="{if isset($fieldset['form']['reset']['id'])}{$fieldset['form']['reset']['id']}{else}{$table}_form_reset_btn{/if}"
|
||||
class="{if isset($fieldset['form']['reset']['class'])}{$fieldset['form']['reset']['class']}{else}btn btn-default{/if}"
|
||||
>
|
||||
{if isset($fieldset['form']['reset']['icon'])}<i class="{$fieldset['form']['reset']['icon']}"></i> {/if} {$fieldset['form']['reset']['title']}
|
||||
</button>
|
||||
{/if}
|
||||
{if isset($fieldset['form']['buttons'])}
|
||||
{foreach from=$fieldset['form']['buttons'] item=btn key=k}
|
||||
{if isset($btn.href) && trim($btn.href) != ''}
|
||||
<a href="{$btn.href}" {if isset($btn['id'])}id="{$btn['id']}"{/if} class="btn btn-default{if isset($btn['class'])} {$btn['class']}{/if}" {if isset($btn.js) && $btn.js} onclick="{$btn.js}"{/if}>{if isset($btn['icon'])}<i class="{$btn['icon']}" ></i> {/if}{$btn.title}</a>
|
||||
{else}
|
||||
<button type="{if isset($btn['type'])}{$btn['type']}{else}button{/if}" {if isset($btn['id'])}id="{$btn['id']}"{/if} class="btn btn-default{if isset($btn['class'])} {$btn['class']}{/if}" name="{if isset($btn['name'])}{$btn['name']}{else}submitOptions{$table}{/if}"{if isset($btn.js) && $btn.js} onclick="{$btn.js}"{/if}>{if isset($btn['icon'])}<i class="{$btn['icon']}" ></i> {/if}{$btn.title}</button>
|
||||
{/if}
|
||||
{/foreach}
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
{/block}
|
||||
</div>
|
||||
{/block}
|
||||
@@ -0,0 +1,75 @@
|
||||
{*
|
||||
* 2007-2017 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2017 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
<div class="modal fade" id="{$modal_id}" tabindex="-1">
|
||||
<div class="modal-dialog {if isset($modal_class)}{$modal_class}{/if}">
|
||||
<div class="modal-content">
|
||||
{if isset($modal_title)}
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 class="modal-title">{$modal_title} <span class="loader" style="display:none;"><i class="icon-refresh icon-spin"></i></span></h4>
|
||||
<div class="row">
|
||||
<div class="col-lg-9">
|
||||
<h4 id="modal_order_info" class="modal-title"></h4>
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
<div class="alert alert-info" role="alert" style="display:none">
|
||||
{l s='Pozostało w kolejce'}: <span id="orders_counter"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="alert alert-danger" style="display:none">
|
||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
||||
<ol></ol>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{$modal_content}
|
||||
|
||||
{if isset($modal_actions)}
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">{l s='Close'}</button>
|
||||
{foreach $modal_actions as $action}
|
||||
{if $action.type == 'link'}
|
||||
<a href="{$action.href}" class="btn {$action.class}" data-label_one="{$action.label}" data-label_multi="{l s='Następne zamówienie'}">{$action.label}</a>
|
||||
{elseif $action.type == 'button'}
|
||||
<button type="button" value="{$action.value}" class="btn {$action.class}">
|
||||
{$action.label}
|
||||
</button>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
ppPack.init('{$currentToken}');
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
{include file="./modal_content.tpl"}
|
||||
|
||||
<div class="checkbox">
|
||||
<label class="required" for="pp_process_data_rodo_modal"><input type="checkbox" name="pp_process_data_rodo_modal" id="pp_process_data_rodo_modal" value="1">{l s='Wyrażam zgodę na przetwarzanie moich danych osobowych w zakresie i w sposób określony w pkt II.' mod='pocztapolskaen'}</label>
|
||||
</div>
|
||||
<div class="checkbox">
|
||||
<label for="pp_process_information_rodo_modal"><input type="checkbox" name="pp_process_information_rodo_modal" id="pp_process_information_rodo_modal" value="1"">{l s='Wyrażam zgodę na otrzymywanie powiadomień o nowych wersjach oprogramowania na mój adres e-mail. ' mod='pocztapolskaen'}</label>
|
||||
</div>
|
||||
<div style="margin-left:10px;margin-top: 1px;margin-bottom:1px;">{l s='Pełna informacja na temat przetwarzania danych osobowych przez Pocztę Polską:' mod='pocztapolskaen'} <a href="http://bip.poczta-polska.pl/iinformacja-o-zbieraniu-danych-osobowych/">http://bip.poczta-polska.pl/iinformacja-o-zbieraniu-danych-osobowych/</a></div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-3 col-lg-offset-4">
|
||||
<div class="form-group">
|
||||
<button id="pocztapolskaen_login_button" class="btn btn-primary btn-block btn-sm" type="submit">
|
||||
<i class="icon-unlock"></i> {l s='Przejdź do logowania' mod='pocztapolskaen'}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var error_continue_msg = '{l s='OK' js=1}';
|
||||
</script>
|
||||
@@ -0,0 +1,35 @@
|
||||
|
||||
<h4>{l s='Informacja o przetwarzanych danych osobowych w ramach oprogramowania' mod='pocztapolskaen'}</h4>
|
||||
|
||||
<h4>{l s='Szanowni Państwo,' mod='pocztapolskaen'}</h4>
|
||||
<div style="color:red;">{l s='dziękujemy za instalację wtyczki i wybór usług Poczty Polskiej S.A.' mod='pocztapolskaen'}</div>
|
||||
<ol style="list-style-type: upper-roman;padding-top: 1px;">
|
||||
<li>{l s='Zgodnie z wymaganiami Rozporządzenia o Ochronie Danych Osobowych [RODO], pragniemy poinformować, że Państwa dane osobowe (jako nadawcy) oraz dane osobowe odbiorców są przetwarzane przez Pocztę Polska S.A. w celu realizacji usług dostępnych w aplikacji Elektroniczny Nadawca. Pełną informacje o sposobie przetwarzania danych i przysługujących Państwu prawach znajdą Państwo pod adresem:' mod='pocztapolskaen'}<br>
|
||||
<a href="https://e-nadawca.poczta-polska.pl/info/">https://e-nadawca.poczta-polska.pl/info/</a>
|
||||
<br>{l s='(Informacja dostępna jest w zakładce Start po zalogowaniu do aplikacji.)' mod='pocztapolskaen'}
|
||||
</li>
|
||||
|
||||
<li>{l s='Instalacja niniejszego oprogramowania wiąże się z również z przetwarzaniem danych osobowych w zakresie:' mod='pocztapolskaen'}
|
||||
<ul>
|
||||
<li>{l s='adres email' mod='pocztapolskaen'}</li>
|
||||
<li style="color:red;">{l s='login' mod='pocztapolskaen'}</li>
|
||||
<li style="color:red;">{l s='numer karty Elektronicznego Nadawcy' mod='pocztapolskaen'}</li>
|
||||
<li>{l s='adres www Państwa sklepu internetowego' mod='pocztapolskaen'}</li>
|
||||
</ul>
|
||||
|
||||
{l s='w dodatkowych celach: udzielania pomocy w przypadku zgłoszenia przez Państwa problemów z wtyczką oraz statystycznym. W związku z tym, uprzejmie informujemy, że:' mod='pocztapolskaen'}
|
||||
<ul style="list-style-type: decimal">
|
||||
<li>{l s='Administratorem danych osobowych wymienionych powyżej jest Poczta Polska S.A. z siedzibą w Warszawie przy ul. Rodziny Hiszpańskich 8, 00 - 940 Warszawa.' mod='pocztapolskaen'}</li>
|
||||
<li>{l s='Kontakt z Inspektorem ochrony danych: Inspektor ochrony danych Poczta Polska S.A., ul. Rodziny Hiszpańskich 8, 00-940 Warszawa, e-mail:' mod='pocztapolskaen'} <a href="mailto:inspektorodo@poczta-polska.pl">inspektorodo@poczta-polska.pl</a></li>
|
||||
<li>{l s='Dane osobowe, o których mowa w pkt II., są przetwarzane na podstawie art. 6 ust. 1 lit. a Rozporządzenia Parlamentu Europejskiego i Rady (UE) 2016/679 z 27 kwietnia 2016 r. w sprawie ochrony osób fizycznych w związku z przetwarzaniem danych osobowych i w sprawie swobodnego przepływu takich danych oraz uchylenia dyrektywy 95/46/WE (Ogólne rozporządzenie o ochronie danych) (Dz. Urz. UE L 119 z 4.05.2016)' mod='pocztapolskaen'}</li>
|
||||
<li>{l s='Państwa dane osobowe są przechowywane na serwerach zlokalizowanych w Unii Europejskiej i mogą być przekazane - na podstawie standardowych klauzul ochrony danych - do państwa trzeciego w związku z korzystaniem przez administratora z rozwiązań chmurowych dostarczanych przez firmę Microsoft. Stosowane przez Microsoft standardowe klauzule umowne zgodne z wzorcami zatwierdzonymi przez Komisję Europejską, dostępne są pod adresem:' mod='pocztapolskaen'}
|
||||
<a href="https://www.microsoft.com/en-us/licensing/product-licensing/products.aspx">https://www.microsoft.com/en-us/licensing/product-licensing/products.aspx</a>{l s=' w części Online Services Terms (OST).' mod='pocztapolskaen'}</li>
|
||||
<li>{l s='Państwa dane przechowywane będą do momentu wycofania przez Państwa zgody lub zakończenia wsparcia dla niniejszego oprogramowania.' mod='pocztapolskaen'}</li>
|
||||
<li>{l s='Przysługuje Państwu prawo dostępu do danych osobowych, ich sprostowania, usunięcia lub ograniczenia przetwarzania.' mod='pocztapolskaen'}</li>
|
||||
<li>{l s='Przysługuje Państwu prawo do cofnięcia zgody w dowolnym momencie bez wpływu na zgodność z prawem przetwarzania, którego dokonano na podstawie zgody przed jej cofnięciem.' mod='pocztapolskaen'}
|
||||
<div style="color:green">{l s='Wycofania zgody dotyczącej przetwarzania danych wskazanych w punkcie II. dokonać mogą Państwo z poziomu oprogramowania poprzez odznaczenie właściwej zgody w zakładce "Moje konto".' mod='pocztapolskaen'}</div></li>
|
||||
<li>{l s='Osobie, której dane dotyczą przysługuje prawo wniesienia skargi do Prezesa Urzędu Ochrony Danych Osobowych.' mod='pocztapolskaen'}</li>
|
||||
<li>{l s='Podanie danych osobowych jest niezbędne do prawidłowego działania i obsługi oprogramowania.' mod='pocztapolskaen'}</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ol>
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
349
modules/pocztapolskaen/views/templates/admin/css/order1770.css
Normal file
349
modules/pocztapolskaen/views/templates/admin/css/order1770.css
Normal file
@@ -0,0 +1,349 @@
|
||||
.datepicker.hasDatepicker .ui-datepicker-inline {display:none !important;}
|
||||
|
||||
#pocztapolskaen_order_detail .panel
|
||||
{
|
||||
background-color: #fff;
|
||||
border: 1px solid #d3d8db;
|
||||
border-radius: 5px;
|
||||
margin-bottom: 20px;
|
||||
padding: 20px;
|
||||
position: relative;
|
||||
box-shadow: 0 1px 1px rgba(0,0,0,.05);
|
||||
box-sizing: border-box;
|
||||
}
|
||||
#pocztapolskaen_order_detail .panel .panel-heading
|
||||
{
|
||||
border:none;
|
||||
font-weight: 600;
|
||||
border-bottom:1px solid #eee;
|
||||
font-size:1rem;
|
||||
line-height: 2.3rem;
|
||||
margin:-20px -16px 15px;
|
||||
padding:0 0 0 5px;
|
||||
}
|
||||
|
||||
#pocztapolskaen_order_detail .panel .panel-heading i {
|
||||
font-family: Material Icons;
|
||||
font-weight: 400;
|
||||
font-style: normal;
|
||||
font-size: 24px;
|
||||
font-size: 1.5rem;
|
||||
line-height: 1;
|
||||
text-transform: none;
|
||||
letter-spacing: normal;
|
||||
word-wrap: normal;
|
||||
white-space: nowrap;
|
||||
direction: ltr;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
text-rendering: optimizeLegibility;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
-webkit-font-feature-settings: "liga";
|
||||
font-feature-settings: "liga";
|
||||
margin:7px 10px 0px 0px;
|
||||
float:left;
|
||||
}
|
||||
|
||||
#pocztapolskaen_order_detail .icon-plane::before {
|
||||
content: "local_shipping";
|
||||
}
|
||||
|
||||
#pocztapolskaen_order_detail .form-horizontal .form-group::after, #pocztapolskaen_order_detail .form-horizontal .form-group::before {
|
||||
content: " ";
|
||||
display: table;
|
||||
}
|
||||
|
||||
#pocztapolskaen_order_detail label.control-label {
|
||||
color: #666;
|
||||
font-size: 13px;
|
||||
font-weight: 400;
|
||||
float:left;
|
||||
}
|
||||
|
||||
#pocztapolskaen_order_detail .form-horizontal .control-label {
|
||||
margin-bottom: 0;
|
||||
padding-top: 7px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#pocztapolskaen_order_detail .col-lg-8 {display:inline-block;}
|
||||
|
||||
#pocztapolskaen_order_detail .form-control,
|
||||
#pocztapolskaen_order_detail input[type="password"],
|
||||
#pocztapolskaen_order_detail input[type="search"],
|
||||
#pocztapolskaen_order_detail input[type="text"],
|
||||
#pocztapolskaen_order_detail select,
|
||||
#pocztapolskaen_order_detail textarea {
|
||||
-webkit-transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;
|
||||
-webkit-transition: border-color .15s ease-in-out,-webkit-box-shadow .15s ease-in-out;
|
||||
background-color: #f5f8f9;
|
||||
background-image: none;
|
||||
border: 1px solid #c7d6db;
|
||||
border-radius: 3px;
|
||||
color: #555;
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
height: 31px;
|
||||
line-height: 1.42857;
|
||||
padding: 6px 8px;
|
||||
transition: border-color .15s ease-in-out,-webkit-box-shadow .15s ease-in-out;
|
||||
transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;
|
||||
transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out,-webkit-box-shadow .15s ease-in-out;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#pocztapolskaen_order_detail input[type="email"],
|
||||
#pocztapolskaen_order_detail input[type="password"],
|
||||
#pocztapolskaen_order_detail input[type="search"],
|
||||
#pocztapolskaen_order_detail input[type="tel"],
|
||||
#pocztapolskaen_order_detail input[type="text"] {
|
||||
font-family: Open Sans,Helvetica,Arial,FontAwesome,sans-serif !important;
|
||||
}
|
||||
|
||||
#pocztapolskaen_order_detail .input-group .form-control,
|
||||
#pocztapolskaen_order_detail .input-group input[type="password"],
|
||||
#pocztapolskaen_order_detail .input-group input[type="search"],
|
||||
#pocztapolskaen_order_detail .input-group input[type="text"],
|
||||
#pocztapolskaen_order_detail .input-group select,
|
||||
#pocztapolskaen_order_detail .input-group textarea {
|
||||
float: left;
|
||||
margin-bottom: 0;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
|
||||
#pocztapolskaen_order_detail .form-control[disabled],
|
||||
#pocztapolskaen_order_detail .form-control[readonly],
|
||||
#pocztapolskaen_order_detail input[disabled][type="password"],
|
||||
#pocztapolskaen_order_detail input[disabled][type="search"],
|
||||
#pocztapolskaen_order_detail input[disabled][type="text"],
|
||||
#pocztapolskaen_order_detail input[readonly][type="password"],
|
||||
#pocztapolskaen_order_detail input[readonly][type="search"],
|
||||
#pocztapolskaen_order_detail input[readonly][type="text"],
|
||||
#pocztapolskaen_order_detail select[disabled],
|
||||
#pocztapolskaen_order_detail select[readonly],
|
||||
#pocztapolskaen_order_detail textarea[disabled],
|
||||
#pocztapolskaen_order_detail textarea[readonly]
|
||||
{
|
||||
background-color: #eee;
|
||||
cursor: not-allowed;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
#pocztapolskaen_order_detail .close {
|
||||
color: #000;
|
||||
filter: alpha(opacity=20);
|
||||
float: right;
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
line-height: 1;
|
||||
opacity: .2;
|
||||
text-shadow: 0 1px 0 #fff;
|
||||
}
|
||||
|
||||
#pocztapolskaen_order_detail .modal-header .close {
|
||||
margin-top: -2px;
|
||||
}
|
||||
|
||||
#pocztapolskaen_order_detail button.close {
|
||||
-webkit-appearance: none;
|
||||
background: transparent;
|
||||
border: 0;
|
||||
cursor: pointer;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#pocztapolskaen_order_detail .close:focus, #pocztapolskaen_order_detail .close:hover {
|
||||
color: #000;
|
||||
cursor: pointer;
|
||||
filter: alpha(opacity=50);
|
||||
opacity: .5;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#pocztapolskaen_order_detail button.close
|
||||
{
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 10px;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
#pocztapolskaen_order_detail .modal-header {
|
||||
border-bottom: 1px solid #e5e5e5;
|
||||
display:block;
|
||||
padding:10px 5px;
|
||||
}
|
||||
|
||||
#pocztapolskaen_order_detail .modal-header h4 {font-size:15px;font-weight:400}
|
||||
|
||||
#pocztapolskaen_order_detail .modal-footer {
|
||||
border-top: 1px solid #e5e5e5;
|
||||
padding: 15px 5px 0px 5px;
|
||||
}
|
||||
|
||||
#pocztapolskaen_order_detail .modal-title {width:100%;clear:both;}
|
||||
|
||||
#pocztapolskaen_order_detail .modal-body {padding:5px;}
|
||||
#packModal .panel {float:left;}
|
||||
#packModal .form-group {clear:both;}
|
||||
|
||||
|
||||
#pocztapolskaen_order_detail #services .panel-heading {margin:0px -5px;font-size:14px;}
|
||||
#pocztapolskaen_order_detail #services label.control-label {padding-left:5px;padding-right:5px;}
|
||||
|
||||
|
||||
#pocztapolskaen_order_detail .help-block {
|
||||
color: #959595;
|
||||
display: block;
|
||||
margin-bottom: 10px;
|
||||
margin-top: 5px;
|
||||
font-style: italic;
|
||||
font-size:12px;
|
||||
}
|
||||
|
||||
#pocztapolskaen_order_detail .fixed-width-lg {width: 160px !important;}
|
||||
#pocztapolskaen_order_detail .fixed-width-xxl {width: 200px !important;}
|
||||
|
||||
#pocztapolskaen_order_detail .switch {display: block;height: 26px;position: relative;}
|
||||
#pocztapolskaen_order_detail .prestashop-switch {-webkit-box-shadow: rgba(0,0,0,.15) 0 1px 4px 1px inset;background-color: #eee;border-radius: 3px;box-shadow: inset 0 1px 4px 1px rgba(0,0,0,.15);color: #333;margin-top: 3px;text-align: center;}
|
||||
#pocztapolskaen_order_detail .switch input {
|
||||
opacity: 0;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
#pocztapolskaen_order_detail label {
|
||||
display: inline-block;
|
||||
font-weight: 700;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
#pocztapolskaen_order_detail .switch * {
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
#pocztapolskaen_order_detail .prestashop-switch * {
|
||||
outline: 0 !important;
|
||||
}
|
||||
|
||||
#pocztapolskaen_order_detail .switch > span,
|
||||
#pocztapolskaen_order_detail .switch label {
|
||||
line-height: 26px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
#pocztapolskaen_order_detail .switch label {
|
||||
float: left;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
position: relative;
|
||||
text-align: center;
|
||||
width: 50%;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
#pocztapolskaen_order_detail .prestashop-switch label {
|
||||
-webkit-transition: color .2s ease-out;
|
||||
color: #bbb;
|
||||
cursor: pointer;
|
||||
font-weight: 400;
|
||||
text-transform: uppercase;
|
||||
transition: color .2s ease-out;
|
||||
}
|
||||
|
||||
#pocztapolskaen_order_detail .prestashop-switch input:checked + label {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
#pocztapolskaen_order_detail .switch a {
|
||||
-webkit-transition: all .3s ease-out;
|
||||
display: block;
|
||||
transition: all .3s ease-out;
|
||||
}
|
||||
|
||||
#pocztapolskaen_order_detail .switch a {
|
||||
-webkit-box-shadow: "#1B7088" 0 -1px 0 inset;
|
||||
background-color: #2eacce;
|
||||
border: 1px solid #279cbb;
|
||||
box-shadow: inset 0 -1px 0 "#1B7088";
|
||||
color: #fff;
|
||||
height: 100%;
|
||||
left: 0;
|
||||
padding: 0;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
width: 50%;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
#pocztapolskaen_order_detail .switch input:last-of-type:checked ~ a {
|
||||
-webkit-box-shadow: "#5C5C5C" 0 -1px 0 inset;
|
||||
background-color: #e08f95;
|
||||
border: 1px solid #ca6f6f;
|
||||
box-shadow: inset 0 -1px 0 "#5C5C5C";
|
||||
left: 50%;
|
||||
}
|
||||
|
||||
#pocztapolskaen_order_detail .switch input:disabled ~ a {
|
||||
-webkit-box-shadow: #b3b3b3 0 -1px 0 inset !important;
|
||||
background-color: #cdcdcd !important;
|
||||
border: 1px solid #b3b3b3 !important;
|
||||
box-shadow: inset 0 -1px 0 #b3b3b3 !important;
|
||||
}
|
||||
|
||||
#pocztapolskaen_order_detail .input-group {border-collapse: separate;display: table;position: relative;}
|
||||
|
||||
#pocztapolskaen_order_detail .input-group-addon,
|
||||
#pocztapolskaen_order_detail .input-group-btn,
|
||||
#pocztapolskaen_order_detail .input-group .form-control,
|
||||
#pocztapolskaen_order_detail .input-group input[type="password"],
|
||||
#pocztapolskaen_order_detail .input-group input[type="search"],
|
||||
#pocztapolskaen_order_detail .input-group input[type="text"],
|
||||
#pocztapolskaen_order_detail .input-group select,
|
||||
#pocztapolskaen_order_detail .input-group textarea {
|
||||
display: table-cell;
|
||||
}
|
||||
|
||||
#pocztapolskaen_order_detail .input-group-addon,
|
||||
#pocztapolskaen_order_detail .input-group-btn {
|
||||
vertical-align: middle;
|
||||
white-space: nowrap;
|
||||
width: 1%;
|
||||
}
|
||||
|
||||
#pocztapolskaen_order_detail .input-group-addon {
|
||||
background-color: #f5f8f9;
|
||||
border: 1px solid #c7d6db;
|
||||
border-left-color: rgb(199, 214, 219);
|
||||
border-left-style: solid;
|
||||
border-left-width: 1px;
|
||||
border-radius: 3px;
|
||||
border-top-left-radius: 3px;
|
||||
border-bottom-left-radius: 3px;
|
||||
color: #555;
|
||||
font-size: 12px;
|
||||
font-weight: 400;
|
||||
line-height: 1;
|
||||
padding: 6px 8px;
|
||||
text-align: center;
|
||||
}
|
||||
#pocztapolskaen_order_detail .input-group input:first-child[type="text"] {
|
||||
border-bottom-right-radius: 0;
|
||||
border-top-right-radius: 0;
|
||||
}
|
||||
#pocztapolskaen_order_detail .input-group-addon:last-child {
|
||||
border-bottom-left-radius: 0;
|
||||
border-top-left-radius: 0;
|
||||
}
|
||||
|
||||
#pocztapolskaen_order_detail .input-group-addon:last-child {
|
||||
border-left: 0;
|
||||
}
|
||||
|
||||
#pocztapolskaen_order_detail .btn-default {
|
||||
background-color: #fff;
|
||||
border-color: #dedede;
|
||||
color: #363a41;
|
||||
}
|
||||
20
modules/pocztapolskaen/views/templates/admin/css/orders.css
Normal file
20
modules/pocztapolskaen/views/templates/admin/css/orders.css
Normal file
@@ -0,0 +1,20 @@
|
||||
#packModal .panel{
|
||||
border: 0 !important;
|
||||
box-shadow: none !important;
|
||||
margin-bottom: 2px !important;
|
||||
padding: 5px !important;
|
||||
|
||||
}
|
||||
#packModal .panel-heading{
|
||||
border: 0 !important;
|
||||
padding: 5px !important;
|
||||
}
|
||||
#packModal hr{
|
||||
margin: 0 !important;
|
||||
}
|
||||
#packModal .form-group {
|
||||
margin-bottom: 10px !important;
|
||||
}
|
||||
#packModal span label{
|
||||
font-weight: normal;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
.fixed-width-xxxl{width:300px !important;}
|
||||
.checkbox{
|
||||
padding-left: 60px;
|
||||
margin-top: 2px !important;
|
||||
margin-bottom: 2px !important;
|
||||
|
||||
}
|
||||
.checkbox label{
|
||||
font-weight: bold !important;
|
||||
}
|
||||
.bootstrap .row{
|
||||
margin:auto;
|
||||
}
|
||||
|
||||
.bootstrap h4{
|
||||
margin-top: 2px !important;
|
||||
margin-bottom: 2px !important;
|
||||
}
|
||||
|
||||
36
modules/pocztapolskaen/views/templates/admin/form.tpl
Normal file
36
modules/pocztapolskaen/views/templates/admin/form.tpl
Normal file
@@ -0,0 +1,36 @@
|
||||
<div class="panel">
|
||||
<h3><i class="icon-tag"></i> {l s='Ustawienia'}</h3>
|
||||
<div class="productTabs">
|
||||
<ul class="tab nav nav-tabs">
|
||||
<li class="tab-row">
|
||||
<a class="tab-page" id="pp_link_settings" href="javascript:displayTab('settings');"> {l s='Moje konto'}</a>
|
||||
</li>
|
||||
<li class="tab-row">
|
||||
<a class="tab-page" id="pp_link_statuses" href="javascript:displayTab('statuses');"> {l s='Statusy'}</a>
|
||||
</li>
|
||||
<li class="tab-row">
|
||||
<a class="tab-page" id="pp_link_delivery" href="javascript:displayTab('delivery');"> {l s='Dostawa'}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<form action="" id="cart_rule_form" class="form-horizontal" method="post">
|
||||
<input type="hidden" id="currentFormTab" name="currentFormTab" value="informations" />
|
||||
<div id="pp_settings" class="panel pp_tab">
|
||||
{include file='./settings.tpl'}
|
||||
</div>
|
||||
<div id="pp_statuses" class="panel pp_tab">
|
||||
{include file='./statuses.tpl'}
|
||||
</div>
|
||||
<div id="pp_delivery" class="panel pp_tab">
|
||||
{include file='./delivery.tpl'}
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
<script type="text/javascript">
|
||||
{*var currentToken = '{$currentToken|escape:'quotes'}';*}
|
||||
var currentFormTab = '{if isset($smarty.post.currentFormTab)}{$smarty.post.currentFormTab|escape:'quotes'}{else}settings{/if}';
|
||||
|
||||
</script>
|
||||
<script type="text/javascript" src="{$module_dir|escape:'htmlall':'UTF-8'}/views/templates/admin/js/settings.js"></script>
|
||||
</div>
|
||||
@@ -0,0 +1,8 @@
|
||||
<div id='pocztapolskaen_order_detail'>
|
||||
|
||||
|
||||
<script type='text/javascript'>
|
||||
loadPocztaPolskaOrderForm('{$getFormLink}')
|
||||
</script>
|
||||
|
||||
</div>
|
||||
33
modules/pocztapolskaen/views/templates/admin/js/orders.js
Normal file
33
modules/pocztapolskaen/views/templates/admin/js/orders.js
Normal file
@@ -0,0 +1,33 @@
|
||||
function sendBulkAction(form, action)
|
||||
{
|
||||
String.prototype.splice = function(index, remove, string) {
|
||||
return (this.slice(0, index) + string + this.slice(index + Math.abs(remove)));
|
||||
};
|
||||
|
||||
var form_action = $(form).attr('action');
|
||||
|
||||
if (form_action.replace(/(?:(?:^|\n)\s+|\s+(?:$|\n))/g,'').replace(/\s+/g,' ') == '')
|
||||
return false;
|
||||
|
||||
if(action === 'submitBulkprintLabelsorders'){
|
||||
$(form).attr('target', '_blank');
|
||||
}
|
||||
if (form_action.indexOf('#') == -1)
|
||||
$(form).attr('action', form_action + '&' + action);
|
||||
else
|
||||
$(form).attr('action', form_action.splice(form_action.lastIndexOf('&'), 0, '&' + action));
|
||||
|
||||
$(form).submit();
|
||||
$(form).removeAttr('target');
|
||||
}
|
||||
|
||||
function checkDelBoxes(pForm, boxName, parent)
|
||||
{
|
||||
for (i = 0; i < pForm.elements.length; i++){
|
||||
if (pForm.elements[i].name == boxName){
|
||||
if(!pForm.elements[i].disabled){
|
||||
pForm.elements[i].checked = parent;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
384
modules/pocztapolskaen/views/templates/admin/js/pack.js
Normal file
384
modules/pocztapolskaen/views/templates/admin/js/pack.js
Normal file
@@ -0,0 +1,384 @@
|
||||
var ppPack = {
|
||||
currentToken: '',
|
||||
orders: [],
|
||||
currentOrder: '',
|
||||
formDefaultValues: [],
|
||||
msg: '',
|
||||
ids: [],
|
||||
loading: false,
|
||||
package: '',
|
||||
init: function (currentToken) {
|
||||
var $this = this;
|
||||
if (typeof (currentToken) !== 'undefined') {
|
||||
this.currentToken = currentToken;
|
||||
}
|
||||
$("#action_pack_modal").click(function () {
|
||||
$this.ids = $this.getIds();
|
||||
$this.orders = [];
|
||||
$this.currentOrder = '';
|
||||
ppPack.getOrders();
|
||||
});
|
||||
$(".pack_modal_next_button").click(function () {
|
||||
$this.beforeProcess();
|
||||
setTimeout(function(){
|
||||
$this.next();
|
||||
$this.afterProcess();
|
||||
}, 100);
|
||||
return false;
|
||||
});
|
||||
$(".pack_inline_action").click(function () {
|
||||
var id = $(this).closest('tr').data('id_order');
|
||||
$this.ids = [id];
|
||||
$this.orders = [];
|
||||
$this.currentOrder = '';
|
||||
$this.getOrders();
|
||||
});
|
||||
$(".btn_add_package").click(function () {
|
||||
var id = $(this).data('id_order');
|
||||
$this.ids = [id];
|
||||
$this.orders = [];
|
||||
$this.currentOrder = '';
|
||||
$this.getOrders();
|
||||
});
|
||||
$("#packModal").on('shown.bs.modal', function () {
|
||||
$this.currentOrder = $this.getOrder();
|
||||
$this.setOrderTitle(ppPack.currentOrder);
|
||||
$this.setButtonLabel();
|
||||
$this.setPackage();
|
||||
$this.setFields();
|
||||
$this.setDatePicker();
|
||||
//ppSetting.toggleCombo($this.package);
|
||||
$('#pp_packages').on('change', function () {
|
||||
$this.package = $(this).val();
|
||||
$this.setFields();
|
||||
});
|
||||
});
|
||||
|
||||
$this.formDefaultValues = $('#packModal select,input,textarea').serializeArray();
|
||||
$this.setNextButton();
|
||||
},
|
||||
setNextButton: function (disabled) {
|
||||
var disabled = disabled || false;
|
||||
$('.pack_modal_next_button').attr('disabled', disabled);
|
||||
},
|
||||
next: function () {
|
||||
var $this = this;
|
||||
var errors = $this.validate();
|
||||
if (errors.length <= 0) {
|
||||
$("#packModal").find('.alert-danger').hide();
|
||||
$this.packOrder(function () {
|
||||
if ($this.isEmpty()) {
|
||||
$("#packModal").modal('hide');
|
||||
window.location.reload();
|
||||
} else {
|
||||
$this.clearErrors();
|
||||
var order = $this.getOrder();
|
||||
$this.setOrderTitle(order);
|
||||
$this.setButtonLabel();
|
||||
$this.restoreDefault();
|
||||
$this.setPackage();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$this.displayErrors(errors)
|
||||
}
|
||||
},
|
||||
skipOrder: function (callback) {
|
||||
callback();
|
||||
},
|
||||
packOrder: function (callback) {
|
||||
var $this = this;
|
||||
if (typeof ($this.currentOrder.id_order) != undefined && $this.currentOrder.id_order !== '') {
|
||||
var $this = this;
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
cache: false,
|
||||
url: 'index.php',
|
||||
async: false,
|
||||
dataType: 'json',
|
||||
data: $('#packModal select,input,textarea').serialize() + '&controller=AdminPocztaPolskaOrders&action=packOrder&id_order=' + $this.currentOrder.id_order + '&ajax=1&token=' + $this.currentToken,
|
||||
beforeSend: function () {
|
||||
//$this.beforeProcess();
|
||||
},
|
||||
error: function () {
|
||||
//$this.beforeProcess();
|
||||
},
|
||||
success: function (res)
|
||||
{
|
||||
if (res.success) {
|
||||
if (typeof (callback) !== 'undefined') {
|
||||
callback();
|
||||
}
|
||||
} else {
|
||||
$this.displayErrors(res.errors);
|
||||
}
|
||||
//$this.afterProcess();
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
restoreDefault: function () {
|
||||
$("#packModal").find('.alert-danger').hide();
|
||||
for (var i in this.formDefaultValues) {
|
||||
var el = $('#packModal').find('[name="' + this.formDefaultValues[i].name + '"]');
|
||||
if (el.is(':radio')) {
|
||||
$('#packModal').find('[name="' + this.formDefaultValues[i].name + '"][value="' + this.formDefaultValues[i].value + '"]').attr('checked', true);
|
||||
} else {
|
||||
el.val(this.formDefaultValues[i].value);
|
||||
}
|
||||
}
|
||||
$('#packModal').find('#pp_packages').trigger('change');
|
||||
},
|
||||
replaceDefaultVariables: function(){
|
||||
var $this = this;
|
||||
var package = $this.getPackage();
|
||||
desc = $('#' + package + '_opis_przesylki').val();
|
||||
|
||||
if(typeof(desc) !== 'undefined'){
|
||||
$('#' + package + '_opis_przesylki').val(desc.replace('{reference}',$this.currentOrder.reference).replace('{id_order}',$this.currentOrder.id_order).replace('{message}',$this.currentOrder.message));
|
||||
}
|
||||
|
||||
},
|
||||
setOrderTitle: function(order) {
|
||||
var text = '<a href="'+order.url+'" target="_blank">'+order.name+'</a>';
|
||||
$('#modal_order_info').html(text);
|
||||
var counter = this.getOrdersCount();
|
||||
if(counter>1){
|
||||
$('#orders_counter').parent().show();
|
||||
$('#orders_counter').html(counter);
|
||||
}
|
||||
else{
|
||||
$('#orders_counter').parent().hide();
|
||||
}
|
||||
},
|
||||
setButtonLabel: function(){
|
||||
var counter = this.getOrdersCount();
|
||||
var label;
|
||||
if(counter>1){
|
||||
label = $('.pack_modal_next_button').data('label_multi');
|
||||
}
|
||||
else{
|
||||
label = $('.pack_modal_next_button').data('label_one');
|
||||
}
|
||||
$('.pack_modal_next_button').html(label);
|
||||
},
|
||||
getOrdersCount: function(){
|
||||
var i = 1;
|
||||
for (var id in this.orders) {
|
||||
i++;
|
||||
}
|
||||
return i;
|
||||
},
|
||||
getOrder: function () {
|
||||
var $this = this;
|
||||
if (!$this.isEmpty()) {
|
||||
var i = 0;
|
||||
for (var id in $this.orders) {
|
||||
if (i === 0) {
|
||||
$this.currentOrder = $this.orders[id];
|
||||
delete $this.orders[id];
|
||||
i++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $this.currentOrder;
|
||||
},
|
||||
isEmpty: function () {
|
||||
return $.isEmptyObject(ppPack.orders);
|
||||
},
|
||||
isChecked: function () {
|
||||
return $('[name="pocztapolskaen_orderBox[]"]:checked').length;
|
||||
},
|
||||
beforeProcess: function () {
|
||||
$('.loader').show();
|
||||
this.setNextButton(true);
|
||||
},
|
||||
afterProcess: function () {
|
||||
var $this = this;
|
||||
$this.setNextButton(false);
|
||||
$('.loader').hide();
|
||||
},
|
||||
validate: function () {
|
||||
var $this = this;
|
||||
var errors = [];
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
cache: false,
|
||||
url: 'index.php',
|
||||
async: false,
|
||||
dataType: 'json',
|
||||
data: $('#packModal select,input,textarea').serialize() + '&controller=AdminPocztaPolskaOrders&action=validatePackage&id_order=' + $this.currentOrder.id_order + '&ajax=1&token=' + $this.currentToken,
|
||||
beforeSend: function () {
|
||||
//$this.beforeProcess();
|
||||
},
|
||||
error: function (xhr, textStatus, errorThrown) {
|
||||
$this.beforeProcess();
|
||||
//window.location.reload();
|
||||
},
|
||||
success: function (res)
|
||||
{
|
||||
for (var i in res.errors) {
|
||||
errors.push(res.errors[i]);
|
||||
}
|
||||
//$this.afterProcess();
|
||||
}
|
||||
});
|
||||
|
||||
return errors;
|
||||
},
|
||||
getIds: function () {
|
||||
var ids = [];
|
||||
$('[name="ordersBox[]"]:checked').each(function () {
|
||||
var id = $(this).val();
|
||||
var shipment_number = $('[data-id_order="' + id + '"]').data('shipment_number');
|
||||
if (shipment_number === '' || shipment_number == 0) {
|
||||
ids.push(id);
|
||||
}
|
||||
});
|
||||
return ids;
|
||||
},
|
||||
displayErrors: function (errors) {
|
||||
this.clearErrors();
|
||||
for (var i in errors) {
|
||||
var li = $('<li></li>').html(errors[i]);
|
||||
$("#packModal").find('.alert-danger ol').append(li);
|
||||
}
|
||||
$("#packModal").find('.alert-danger').show();
|
||||
},
|
||||
clearErrors: function () {
|
||||
$("#packModal").find('.alert-danger ol').html('');
|
||||
},
|
||||
setDatePicker: function(){
|
||||
$(".datepicker_modal").datepicker({
|
||||
prevText: '',
|
||||
nextText: '',
|
||||
dateFormat: 'yy-mm-dd',
|
||||
beforeShow: function() {
|
||||
setTimeout(function(){
|
||||
$('.ui-datepicker').css('z-index', 99999999999999);
|
||||
}, 0);
|
||||
}
|
||||
});
|
||||
},
|
||||
setFields: function () {
|
||||
var $this = this;
|
||||
$this.setPni();
|
||||
$this.setWeight();
|
||||
$this.setAmountNumber();
|
||||
$this.setDeclarationValue();
|
||||
$this.replaceDefaultVariables();
|
||||
},
|
||||
setWeight: function () {
|
||||
var $this = this;
|
||||
var package = $this.getPackage();
|
||||
if ($('#' + package + '_masa').val() === ''||$('#' + package + '_masa').val()<=0 || $this.currentOrder.weight >0) {
|
||||
$('#' + package + '_masa').val($.trim($this.currentOrder.weight));
|
||||
}
|
||||
},
|
||||
setAmountNumber: function () {
|
||||
var $this = this;
|
||||
var package = $this.getPackage();
|
||||
$('input[name="' + package + '_rodzaj"]').on('click', function () {
|
||||
if ($(this).val() === 'pobranie') {
|
||||
if ($('#' + package + '_kwota_pobrania_zl').val() === '') {
|
||||
$('#' + package + '_kwota_pobrania_zl').val($this.currentOrder.total);
|
||||
}
|
||||
if ($('#' + package + '_numer_rachunku').val() === '') {
|
||||
$('#' + package + '_numer_rachunku').val($this.currentOrder.amount_number);
|
||||
}
|
||||
}
|
||||
});
|
||||
if($this.currentOrder.is_cod){
|
||||
$('#' + package + '_pobranie_on').trigger('click');
|
||||
}
|
||||
|
||||
//if ($('input[name="' + package + '_rodzaj"][value="1"]').is(':checked')) {
|
||||
if ($('#' + package + '_kwota_pobrania_zl').val() === '') {
|
||||
$('#' + package + '_kwota_pobrania_zl').val($this.currentOrder.total);
|
||||
}
|
||||
if ($('#' + package + '_numer_rachunku').val() === '') {
|
||||
$('#' + package + '_numer_rachunku').val($this.currentOrder.amount_number);
|
||||
//}
|
||||
}
|
||||
},
|
||||
setDeclarationValue: function () {
|
||||
var $this = this;
|
||||
var package = $this.getPackage();
|
||||
$('input[name="' + package + '_deklaracja_wartosci"]').on('click', function () {
|
||||
if ($(this).val() === '1') {
|
||||
if ($('#' + package + '_wartosc_zl').val() === ''||$('#' + package + '_wartosc_zl').val()<=0) {
|
||||
$('#' + package + '_wartosc_zl').val($this.currentOrder.total);
|
||||
}
|
||||
if ($('#' + package + '_wartosc_kg').val() === ''||$('#' + package + '_wartosc_kg').val()<=0 || $this.currentOrder.weight >0) {
|
||||
$('#' + package + '_wartosc_kg').val($this.currentOrder.weight);
|
||||
}
|
||||
}
|
||||
});
|
||||
//if ($('input[name="' + package + '_deklaracja_wartosci"][value="1"]').is(':checked')) {
|
||||
if ($('#' + package + '_wartosc_zl').val() === '' || $('#' + package + '_wartosc_zl').val() <= 0) {
|
||||
$('#' + package + '_wartosc_zl').val($this.currentOrder.total);
|
||||
//}
|
||||
//if ($('#' + package + '_wartosc_kg').val() === ''||$('#' + package + '_wartosc_kg').val() <=0 ) {
|
||||
if($this.currentOrder.weight > 0){
|
||||
$('#' + package + '_wartosc_kg').val($this.currentOrder.weight);
|
||||
}
|
||||
|
||||
//}
|
||||
}
|
||||
},
|
||||
setPni: function () {
|
||||
var $this = this;
|
||||
var package = $this.getPackage();
|
||||
$('input[name="' + package + '_odbior_w_punkcie"]').on('click', function () {
|
||||
if ($(this).val() === '1') {
|
||||
if ($('#' + package + '_pokaz_mape').val() === '') {
|
||||
$('#' + package + '_pokaz_mape').val($this.currentOrder.point);
|
||||
}
|
||||
if ($('#' + package + '_pni').val() === '') {
|
||||
$('#' + package + '_pni').val($this.currentOrder.pni);
|
||||
}
|
||||
}
|
||||
});
|
||||
if($this.currentOrder.point !=''){
|
||||
$('#' + package + '_odbior_w_punkcie_on').trigger('click');
|
||||
}
|
||||
if ($('input[name="' + package + '_odbior_w_punkcie"][value="1"]').is(':checked')) {
|
||||
if ($('#' + package + '_pokaz_mape').val() === '') {
|
||||
$('#' + package + '_pokaz_mape').val($this.currentOrder.point);
|
||||
}
|
||||
if ($('#' + package + '_pni').val() === '') {
|
||||
$('#' + package + '_pni').val($this.currentOrder.pni);
|
||||
}
|
||||
}
|
||||
},
|
||||
showPackModal: function () {
|
||||
this.restoreDefault();
|
||||
$("#packModal").modal('show');
|
||||
},
|
||||
getPackage: function () {
|
||||
if (this.package === '') {
|
||||
this.package = $('#pp_packages').val();
|
||||
}
|
||||
return this.package;
|
||||
},
|
||||
getOrders: function () {
|
||||
var $this = this;
|
||||
for (var i in $this.ids) {
|
||||
var id = $this.ids[i];
|
||||
$this.orders[id] = $('[data-id_order="' + id + '"]').data();
|
||||
}
|
||||
if ($this.orders.length > 0) {
|
||||
$this.showPackModal();
|
||||
}
|
||||
},
|
||||
selectPickup: function(params){
|
||||
var point = params.name +', ' + params.street + ', ' + params.zipCode +' ' +params.city;
|
||||
var package = ppPack.getPackage();
|
||||
$('#' + package + '_pokaz_mape').val(point);
|
||||
$('#' + package + '_pni').val(params.pni);
|
||||
},
|
||||
setPackage: function(){
|
||||
$('#pp_packages').val(this.currentOrder.package).trigger('change');
|
||||
}
|
||||
}
|
||||
5
modules/pocztapolskaen/views/templates/admin/js/sets.js
Normal file
5
modules/pocztapolskaen/views/templates/admin/js/sets.js
Normal file
@@ -0,0 +1,5 @@
|
||||
var ppSet = {
|
||||
toggle: function(selector){
|
||||
$("#"+selector).toggle();
|
||||
}
|
||||
}
|
||||
230
modules/pocztapolskaen/views/templates/admin/js/settings.js
Normal file
230
modules/pocztapolskaen/views/templates/admin/js/settings.js
Normal file
@@ -0,0 +1,230 @@
|
||||
var ppSetting = {
|
||||
toggleRows: function (package_name) {
|
||||
if (package_name !== '') {
|
||||
$('.' + package_name + '.toggle_rows').find('*').change(function () {
|
||||
var val = $(this).val();
|
||||
var name = $(this).attr('name');
|
||||
var is_checked = $(this).attr('type') == 'radio' ? $(this).is(':checked') : 0;
|
||||
|
||||
if (typeof (name) !== 'undefined' && val !== '') {
|
||||
if(is_checked){
|
||||
$('.' + package_name + '.' + name).hide();
|
||||
$('.' + package_name + '.' + name + '.' + val).trigger('change').show();
|
||||
$('.' + package_name + '.' + name + '.' + val).find('*').trigger('change',package_name);
|
||||
}
|
||||
}
|
||||
}).trigger('change');
|
||||
|
||||
$('.toggle_panel.' + package_name).show();
|
||||
}
|
||||
},
|
||||
toggleCombo: function (package_name) {
|
||||
if(package_name !== ''){
|
||||
$('.' + package_name + '.toggle_combo').find('input,select').change(function(event){
|
||||
val = $(this).val();
|
||||
name = $(this).attr('name');
|
||||
var is_checked = $(this).attr('type') == 'radio' ? $(this).is(':checked') : 1;
|
||||
if(is_checked){
|
||||
$('.' + package_name +'.' + name).hide();
|
||||
$('.' + package_name +'.' + name + '.' + val).trigger('change').show();
|
||||
if(typeof (event.isTrigger) == 'undefined'){
|
||||
$('.' + package_name +'.' + name).find('input[type="text"]').val('');
|
||||
$('.' + package_name +'.' + name).find('[id$="off"]').trigger('click').attr('checked',true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}).trigger('change');
|
||||
}
|
||||
},
|
||||
packageChnage: function () {
|
||||
$('#pp_packages,#pp_packages_con').change(function () {
|
||||
var val = $(this).val();
|
||||
$('.toggle_panel').hide();
|
||||
$(this).closest('.tab-pane').find('.form-group').hide();
|
||||
$('.packages').show();
|
||||
if (val !== '') {
|
||||
$('.' + val).show();
|
||||
ppSetting.toggleRows(val);
|
||||
ppSetting.toggleCombo(val);
|
||||
}
|
||||
$('.btn-delivery').show();
|
||||
}).trigger('change');
|
||||
},
|
||||
myAccountRender: function () {
|
||||
var settings = $('#settings').clone(true);
|
||||
$('#settings').html('<div id="my_account_settings" class="col-lg-5"></div><div id="my_account_info" class="col-lg-7"></div>');
|
||||
$('#my_account_settings').append(settings);
|
||||
$('#settings').addClass('clearfix');
|
||||
$('.my_account_info').each(function () {
|
||||
$('#my_account_info').append($(this));
|
||||
});
|
||||
$('.my_account_info2').each(function () {
|
||||
$('#my_account_info').append($(this));
|
||||
});
|
||||
},
|
||||
showPassword: function(){
|
||||
$('.icon-key').parent().click(function(){
|
||||
if($('#pp_password').attr('type') == 'password'){
|
||||
$('#pp_password').attr('type','text');
|
||||
} else {
|
||||
$('#pp_password').attr('type','password');
|
||||
}
|
||||
})
|
||||
},
|
||||
setRodoButtons: function(){
|
||||
$('#pocztapolskaen_login_button').click(function () {
|
||||
if($('#pp_process_data_rodo_modal').is(':checked')){
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
cache: false,
|
||||
url: 'index.php',
|
||||
async: false,
|
||||
dataType: 'json',
|
||||
data: 'controller=AdminPocztaPolskaSettings&action=saveRodo&ajax=1&pp_process_data_rodo='+Number($('#pp_process_data_rodo_modal').is(':checked'))+'&pp_process_information_rodo='+Number($('#pp_process_information_rodo_modal').is(':checked'))+'&token='+token,
|
||||
success: function (res)
|
||||
{
|
||||
if (res.success) {
|
||||
$("#pp_process_data_rodo").prop('checked',$('#pp_process_data_rodo_modal').is(':checked'));
|
||||
$("#pp_process_information_rodo").prop('checked',$('#pp_process_information_rodo_modal').is(':checked'));
|
||||
$('#modal_rodo_information').modal('hide');
|
||||
|
||||
} else {
|
||||
alert('Błąd zapisu');
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
error_modal('Błąd','Zaznacz wymagane zgody');
|
||||
}
|
||||
|
||||
});
|
||||
},
|
||||
showRODOForm: function(){
|
||||
if(!$('#pp_process_data_rodo').is(':checked')){
|
||||
$('#modal_rodo_information').modal({
|
||||
backdrop: 'static',
|
||||
keyboard: false
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
sendSettingForm: function(){
|
||||
$('#configuration_form').submit();
|
||||
},
|
||||
closeConfirmation:function(){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
function change(val) {
|
||||
$('.toggle_panel').hide();
|
||||
$('#services .form-group').hide();
|
||||
$('.services_packages').show();
|
||||
if (val !== '') {
|
||||
$('.' + val).show();
|
||||
ppSetting.toggleRows(val);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function setSettingsButtons() {
|
||||
$('.btn-settings').click(function () {
|
||||
$('form input[name="action"]').val($(this).attr('data-name'));
|
||||
if($(this).attr('data-name') == 'settings' && !$('#pp_process_data_rodo').is(':checked')){
|
||||
confirm_modal('Czy na pewno?','W przypadku wycofania zgody nastąpi wylogowanie z wtyczki i ' +
|
||||
'konieczne będzie ponowne zalogowanie i wyrażenie zgody','OK','Anuluj',ppSetting.sendSettingForm,ppSetting.closeConfirmation);
|
||||
} else {
|
||||
$(this).parents('form').submit();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
function setPassword() {
|
||||
if ($('form input[name="pp_password_new"]').val() != '') {
|
||||
$('.new_pass').show();
|
||||
} else {
|
||||
$('.new_pass').hide();
|
||||
}
|
||||
$('.show-password').click(function () {
|
||||
$('.new_pass').show();
|
||||
});
|
||||
}
|
||||
|
||||
function setKarta() {
|
||||
if ($('#pp_default_karta_id').val() == null) {
|
||||
$('.default_karta').hide();
|
||||
} else {
|
||||
$('.default_karta').show();
|
||||
}
|
||||
}
|
||||
function setUrzad() {
|
||||
if ($('#pp_default_urzad_id').val() == null) {
|
||||
$('.default_urzad').hide();
|
||||
} else {
|
||||
$('.default_urzad').show();
|
||||
}
|
||||
}
|
||||
/*function setKurierSerwis() {
|
||||
$('.pp_pocztex_serwis').change(function () {
|
||||
if ($(this).val() == 'EKSPRES24') {
|
||||
if ($('#pp_pocztex_wartosc_ubezpieczenia').find('option[value="1000"]').attr('selected')) {
|
||||
$('#pp_pocztex_wartosc_ubezpieczenia').find('option[value="5000"]').attr('selected', true);
|
||||
}
|
||||
$('#pp_pocztex_wartosc_ubezpieczenia').find('option[value="1000"]').attr('disabled', true);
|
||||
} else {
|
||||
$('#pp_pocztex_wartosc_ubezpieczenia').find('option[value="1000"]').attr('disabled', false);
|
||||
}
|
||||
}).trigger('change');
|
||||
}*/
|
||||
|
||||
function setTabs() {
|
||||
if (typeof (active_tab) != undefined && active_tab != '') {
|
||||
$('.active').removeClass('active');
|
||||
$('a[href="#' + active_tab + '"]').parent().addClass('active');
|
||||
$('#' + active_tab).addClass('active');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function ppLoadScripts(){
|
||||
ppSetting.packageChnage();
|
||||
ppSetting.toggleRows('statuses');
|
||||
ppSetting.toggleRows('delivery');
|
||||
ppSetting.toggleCombo();
|
||||
ppSetting.showPassword();
|
||||
setSettingsButtons();
|
||||
setPassword();
|
||||
setKarta();
|
||||
setUrzad();
|
||||
setTabs();
|
||||
ppSetting.setRodoButtons();
|
||||
ppSetting.showRODOForm();
|
||||
//setKurierSerwis();
|
||||
ppSetting.myAccountRender();
|
||||
|
||||
//$('#modal_rodo_information').modal('show');
|
||||
//confirm_modal('test','test2','OK','Anuluj');
|
||||
}
|
||||
|
||||
function loadPocztaPolskaOrderForm(link){
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
cache: false,
|
||||
url: link,
|
||||
async: false,
|
||||
dataType: 'html',
|
||||
success: function (res)
|
||||
{
|
||||
$('#pocztapolskaen_order_detail').html(res);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
ppLoadScripts();
|
||||
});
|
||||
@@ -0,0 +1,27 @@
|
||||
{*
|
||||
* 2007-2017 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2017 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
<a href="{$href|escape:'html':'UTF-8'}" title="{$action}"{if isset($name)} name="{$name|escape:'html':'UTF-8'}"{/if} {if isset($class)} class="{$class|escape:'html':'UTF-8'}"{/if} class="default">
|
||||
<i class="icon-asterisk"></i> {$action}
|
||||
</a>
|
||||
@@ -0,0 +1,27 @@
|
||||
{*
|
||||
* 2007-2017 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2017 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
<a href="{$href|escape:'html':'UTF-8'}"{if isset($confirm)} onclick="if (confirm('{$confirm}')){ldelim}return true;{rdelim}else{ldelim}event.stopPropagation(); event.preventDefault();{rdelim};"{/if} title="{$action|escape:'html':'UTF-8'}" class="delete">
|
||||
<i class="icon-trash"></i> {$action|escape:'html':'UTF-8'}
|
||||
</a>
|
||||
@@ -0,0 +1,27 @@
|
||||
{*
|
||||
* 2007-2017 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2017 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
<a href="{$href|escape:'html':'UTF-8'}" title="{$action|escape:'html':'UTF-8'}" class="edit">
|
||||
<i class="icon-pencil"></i> {$action|escape:'html':'UTF-8'}
|
||||
</a>
|
||||
@@ -0,0 +1,27 @@
|
||||
{*
|
||||
* 2007-2017 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2017 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
<a href="{$href|escape:'html':'UTF-8'}" target="_blank" title="{$action}"{if isset($name)} name="{$name|escape:'html':'UTF-8'}"{/if} {if isset($class)} class="{$class|escape:'html':'UTF-8'}"{/if} class="default">
|
||||
<i class="icon-asterisk"></i> {$action}
|
||||
</a>
|
||||
@@ -0,0 +1,7 @@
|
||||
<div style="width:100%;border:2px solid #D52B1E;padding:10px;text-align:center;margin-bottom:20px;">
|
||||
<div class="pp_pickup_at_point_{if $isCod}cod{else}standard{/if}">
|
||||
<button type="button" class="btn btn-default" onclick="PPWidgetApp.toggleMap({if $isCod}selectPointCod{else}selectPoint{/if}, {if $isCod}true{else}false{/if}, address);checkRadioCarrier($(this));">{l s='Wybierz z mapy' mod='pocztapolskaen'}</button>
|
||||
<div class="pickup_info{if $isCod}_cod{/if}" style="font-weight:bold;padding:10px 0px">{$deliveryPointInfo}</div>
|
||||
<input type="hidden" id="{if $isCod}pp_pni_pickup_cod{else}pp_pni_pickup{/if}" value="{$deliveryPoint}">
|
||||
</div>
|
||||
</div>
|
||||
206
modules/pocztapolskaen/views/templates/hook/carrier.tpl
Normal file
206
modules/pocztapolskaen/views/templates/hook/carrier.tpl
Normal file
@@ -0,0 +1,206 @@
|
||||
{if $ps16}
|
||||
<div class="pp_pickup_at_point_standard" style="display: none;">
|
||||
<button type="button" class="btn btn-default" onclick="PPWidgetApp.toggleMap(selectPoint, false, address);checkRadioCarrier($(this));">{l s='Wybierz z mapy' mod='pocztapolskaen'}</button>
|
||||
<div class="pickup_info">{$pickup_standard_point}</div>
|
||||
<input type="hidden" id="pp_pni_pickup" value="{$pni}">
|
||||
</div>
|
||||
<div class="pp_pickup_at_point_cod" style="display: none;">
|
||||
<button type="button" class="btn btn-default" onclick="PPWidgetApp.toggleMap(selectPointCod, true, address);checkRadioCarrier($(this));">{l s='Wybierz z mapy' mod='pocztapolskaen'}</button>
|
||||
<div class="pickup_info_cod">{$pickup_cod_point}</div>
|
||||
<input type="hidden" id="pp_pni_pickup_cod" value="{$pni_cod}">
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<style type="text/css">#overlay{literal}{z-index:1000000}{/literal}</style>
|
||||
|
||||
<script>
|
||||
var pickup_at_point_standard = {$pickup_at_point_standard};
|
||||
var pickup_at_point_cod = {$pickup_at_point_cod};
|
||||
var baseUrl = "{$baseUrl}";
|
||||
var ajaxAddPointLink = "{$ajaxAddPointLink nofilter}";
|
||||
var address_has_telephone = {$has_telephone};
|
||||
var address = "{$address}";
|
||||
var ps16 = "{$ps16}";
|
||||
|
||||
var pp_message_point = "{l s='Wybrany punkt: ' mod='pocztapolskaen'}";
|
||||
var pp_message_error = "{l s='Wystąpił błąd: ' mod='pocztapolskaen'}";
|
||||
var pp_message_choose_point = "{l s='Wybierz punkt odbioru' mod='pocztapolskaen'}";
|
||||
var pp_message_add_phone = "{l s='Wprowadź numer telefonu' mod='pocztapolskaen'}";
|
||||
var pp_message_add_mobile_phone = "{l s='Wprowadź numer telefonu komórkowego do danych adresowych' mod='pocztapolskaen'}";
|
||||
|
||||
|
||||
function selectPoint(params, cod){
|
||||
var pni= params.pni;
|
||||
var point = params.name +', ' + params.street + ', ' + params.zipCode +' ' +params.city;
|
||||
var cod_info = (typeof cod === 'undefined' ? 0: cod);
|
||||
|
||||
$('.pickup_info').html('');
|
||||
$('.pickup_info_cod').html('');
|
||||
$('.pickup_info'+(cod?'_cod':'')).html('<b>' + pp_message_point + '<b>' + point);
|
||||
$('#pp_pni_pickup'+(cod?'_cod':'')).val(pni);
|
||||
$.ajax({
|
||||
url: ajaxAddPointLink,
|
||||
type: 'POST',
|
||||
dataType: "text",
|
||||
data: 'ajax=true&pni=' + pni +'&point='+point+'&cod='+cod_info,
|
||||
success: function(result){
|
||||
if (result.hasError){
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||
alert(pp_message_error + XMLHttpRequest + "\n" + 'Status: ' + textStatus);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function selectPointCod(params){
|
||||
selectPoint(params, 1);
|
||||
}
|
||||
|
||||
function addPickupAtPoint(){
|
||||
|
||||
if($( ".pickup_at_point_standard").length == 0){
|
||||
$.each(pickup_at_point_standard, function(i,val){
|
||||
if(val != ''){
|
||||
|
||||
//target = $("input[data-key='"+val+",']").closest('tr').find('td.delivery_option_logo').next('td');
|
||||
target = $("input[value='"+val+",']").parents('.delivery_option').find('.delivery_option_logo').next();
|
||||
if(target.length == 0){
|
||||
target = $("input[value='"+val+",']").closest('.delivery-option').find('.carrier-name');
|
||||
}
|
||||
|
||||
obj = $(".pp_pickup_at_point_standard").clone();
|
||||
obj.removeClass('pp_pickup_at_point_standard');
|
||||
obj.addClass('pickup_at_point_standard');
|
||||
obj.show();
|
||||
obj.appendTo(target);
|
||||
}
|
||||
});
|
||||
}
|
||||
if($('.pickup_at_point_cod').length == 0){
|
||||
$.each(pickup_at_point_cod, function(i,val){
|
||||
if(val != ''){
|
||||
//target = $("input[data-key='"+val+",']").closest('tr').find('td.delivery_option_logo').next('td');
|
||||
target = $("input[value='"+val+",']").parents('.delivery_option').find('.delivery_option_logo').next();
|
||||
if(target.length == 0){
|
||||
target = $("input[value='"+val+",']").closest('.delivery-option').find('.carrier-name');
|
||||
}
|
||||
obj = $(".pp_pickup_at_point_cod").clone();
|
||||
obj.removeClass('pp_pickup_at_point_cod');
|
||||
obj.addClass('pickup_at_point_cod');
|
||||
obj.show();
|
||||
obj.appendTo(target);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function checkRadioCarrier(obj){
|
||||
radio = obj.closest('tr').find("input[type='radio']");
|
||||
if(radio.length == 0){
|
||||
radio = obj.closest('.delivery-option').find("input[type='radio']");
|
||||
}
|
||||
//console.log(obj.closest("input[type='radio']"));
|
||||
if(ps16){
|
||||
radio.prop('checked',true).trigger('click').trigger('change');
|
||||
} else {
|
||||
radio.prop('checked',true);
|
||||
}
|
||||
|
||||
$('#overlay').css('z-index','10000000');
|
||||
}
|
||||
{if $ps16}
|
||||
$(document).ready(function () {
|
||||
addPickupAtPoint();
|
||||
{else}
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
{/if}
|
||||
|
||||
if($("[name='confirmDeliveryOption']").length > 0){
|
||||
$('#js-delivery').append($( "<div class='alert-danger'></div>"));
|
||||
}
|
||||
|
||||
$("[name='confirmDeliveryOption']").click(function(){
|
||||
id = parseInt($("input[name*='delivery_option']:checked").val());
|
||||
error = [];
|
||||
if ($.inArray(id, pickup_at_point_standard) != -1){
|
||||
|
||||
|
||||
if($('#pp_pni_pickup').val()==''){
|
||||
error.push(pp_message_choose_point);
|
||||
}
|
||||
|
||||
if(!address_has_telephone){
|
||||
error.push(pp_message_add_phone);
|
||||
}
|
||||
|
||||
}
|
||||
if ($.inArray(id, pickup_at_point_cod) != -1){
|
||||
if($('#pp_pni_pickup_cod').val()==''){
|
||||
error.push(pp_message_choose_point);
|
||||
}
|
||||
|
||||
if(!address_has_telephone){
|
||||
error.push(pp_message_add_phone)
|
||||
}
|
||||
}
|
||||
|
||||
if(error.length > 0){
|
||||
$('.alert-danger').html(error.join('<br>'));
|
||||
$('.alert-danger').fadeIn();
|
||||
setTimeout(function(){
|
||||
$('.alert-danger').fadeOut();
|
||||
}, 3000);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
$(".payment_module").click(function(e){
|
||||
e.preventDefault();
|
||||
|
||||
id = parseInt($("input[name*='delivery_option']:checked").val());
|
||||
error_data = [];
|
||||
if ($.inArray(id, pickup_at_point_standard) != -1){
|
||||
|
||||
|
||||
if($('#pp_pni_pickup').val()==''){
|
||||
error_data.push(pp_message_choose_point);
|
||||
}
|
||||
|
||||
if(!address_has_telephone){
|
||||
error_data.push(pp_message_add_phone);
|
||||
}
|
||||
|
||||
}
|
||||
if ($.inArray(id, pickup_at_point_cod) != -1){
|
||||
if($('#pp_pni_pickup_cod').val()==''){
|
||||
error_data.push(pp_message_choose_point);
|
||||
}
|
||||
|
||||
if(!address_has_telephone){
|
||||
error_data.push(pp_message_add_mobile_phone);
|
||||
}
|
||||
}
|
||||
|
||||
if(error_data.length > 0){
|
||||
var errors = '';
|
||||
for (error in error_data) {
|
||||
errors += $('<div />').html(error_data[error]).text() + "\n";
|
||||
}
|
||||
|
||||
alert(errors);
|
||||
|
||||
} else {
|
||||
window.location = $(this).find('a').attr('href');
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
</script>
|
||||
1
modules/pocztapolskaen/views/templates/hook/header.tpl
Normal file
1
modules/pocztapolskaen/views/templates/hook/header.tpl
Normal file
@@ -0,0 +1 @@
|
||||
<script src="https://mapa.ecommerce.poczta-polska.pl/widget/scripts/ppwidget.js"></script>
|
||||
Reference in New Issue
Block a user