From 459ffbecd2047ee2b596fe6609d235ea58e75fbb Mon Sep 17 00:00:00 2001 From: Jacek Pyziak Date: Wed, 12 Mar 2025 08:05:26 +0100 Subject: [PATCH] =?UTF-8?q?Usuni=C4=99cie=20plik=C3=B3w=20.DS=5FStore=20or?= =?UTF-8?q?az=20poprawa=20obs=C5=82ugi=20kupon=C3=B3w=20w=20klasach=20Shop?= =?UTF-8?q?Order=20i=20Coupon?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autoload/.DS_Store | Bin 6148 -> 0 bytes autoload/admin/controls/class.ShopOrder.php | 2 +- autoload/front/.DS_Store | Bin 6148 -> 0 bytes autoload/front/controls/class.ShopOrder.php | 2 +- autoload/shop/class.Coupon.php | 3 ++- autoload/shop/class.Order.php | 2 +- templates/.DS_Store | Bin 6148 -> 0 bytes 7 files changed, 5 insertions(+), 4 deletions(-) delete mode 100644 autoload/.DS_Store delete mode 100644 autoload/front/.DS_Store delete mode 100644 templates/.DS_Store diff --git a/autoload/.DS_Store b/autoload/.DS_Store deleted file mode 100644 index 3239922a7e1693c4aee135bf32fa7086814704fc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK%}N6?5T4Nr3%&H{F|W`!h-Lc(1-(iw>Y-~&(R-f8*YM`WC-UYuKZ=V1!Glzp zf#jQHX7ckbn`DTH7Y~~`(Ts>X6hRiHA=2G69l7%a$U4UT_GZ4iD#NZZ%wcxP+E3`3 z_EhMOTI>I09ZKJ?w`Gl(?&9_F<>~zSY#cw7%{Lyq+dsz8VScw*RWJ|?1Ovgq&l$j- zEz(U5qYegwfneZ+0XZKMiePrEhI(|M(i8wF&uA6sl1oTTa?Fm^5EckqD9}RLQw+9n z^e6Yrj@8h@i9PvXpZPs`VVxc0Cv_*zhEWFt!N8b-V{6Xj{$JvkX(svOkZ1)1!N5Ob zfG7Q`Utm*yw|?24+_eei5=BJ(swfcXqelQ5a*mv;(d coupon_id ); + $coupon = $order -> coupon_id ? new \shop\Coupon( $order -> coupon_id ) : null; return \Tpl::view( 'shop-order/order-details', [ 'order' => $order, diff --git a/autoload/front/.DS_Store b/autoload/front/.DS_Store deleted file mode 100644 index 7285fd13b00a087a6417494eb5c700e132b02819..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKy-veG47N)IK`b2^Z)5Hogep8iC1z;LpVa6o)PmTu@mMgi_iY&Ye72&51c?cu z%9ecJ#b@8ocTpS@5l^?v3DKB{a;V_w7|nplxM)vCW|2Wob3}Tim(|^5wun7%H~dEi zmab_*8*1HOwQge!$xjr$bq1UPXP{v~z7GK^ zSQyrd>C=HGl>opD<|OD#Eg><%urRC@F#=%?1!^c;iNP8UdoaJkuvXM?Vk-3~NPLApRqeXz<1v_)`YH0K&6M2mk;8 diff --git a/autoload/front/controls/class.ShopOrder.php b/autoload/front/controls/class.ShopOrder.php index ac40287..2c18a2e 100644 --- a/autoload/front/controls/class.ShopOrder.php +++ b/autoload/front/controls/class.ShopOrder.php @@ -145,7 +145,7 @@ class ShopOrder $order = \front\factory\ShopOrder::order_details( \front\factory\ShopOrder::order_id( \S::get( 'order_hash' ) ) ); - $coupon = new \shop\Coupon( $order['coupon_id'] ); + $coupon = (int)$order['coupon_id'] ? new \shop\Coupon( (int)$order['coupon_id'] ) : null; return \Tpl::view( 'shop-order/order-details', [ 'order' => $order, diff --git a/autoload/shop/class.Coupon.php b/autoload/shop/class.Coupon.php index 6453bd7..93d7872 100644 --- a/autoload/shop/class.Coupon.php +++ b/autoload/shop/class.Coupon.php @@ -5,6 +5,7 @@ class Coupon implements \ArrayAccess public function __construct( int $element_id ) { global $mdb; + if ( $element_id ) { $result = $mdb -> get( 'pp_shop_coupon', '*', [ 'id' => $element_id ] ); @@ -46,7 +47,7 @@ class Coupon implements \ArrayAccess public function __get( $variable ) { - if ( array_key_exists( $variable, $this -> data ) ) + if ( is_array( $this -> data ) and array_key_exists( $variable, $this -> data ) ) return $this -> $variable; } diff --git a/autoload/shop/class.Order.php b/autoload/shop/class.Order.php index c74b545..d7179b2 100644 --- a/autoload/shop/class.Order.php +++ b/autoload/shop/class.Order.php @@ -328,7 +328,7 @@ class Order implements \ArrayAccess global $settings; $order = \front\factory\ShopOrder::order_details( $this -> id ); - $coupon = new \shop\Coupon( $order['coupon_id'] ); + $coupon = (int)$order['coupon_id'] ? new \shop\Coupon( (int)$order['coupon_id'] ) : null; $mail_order = \Tpl::view( 'shop-order/mail-summary', [ 'settings' => $settings, diff --git a/templates/.DS_Store b/templates/.DS_Store deleted file mode 100644 index 35bede8d531112e15bff3d5d1313559df4ac3aa3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKu}%Xq47F*8lju+e1Y>@Hp??sn;|nS=qxK{^^pq2{dv<=R6W_&iY|x#0AXpGW zwv;?4u^r!&E{TbVmxpFSG$*18O^`(y5t$xcIy2)bkV}jk>gb6QHFOvW^cSZj_ZdCY z7Fl=H&woSv-Q!}lNp06l{8QUD)%ALp*08N!F0U?*_pi5K#coscBl~W9l1ncwSDgW8 zz!`7`oPlpMfIC~HI#=}G8E^)ife!}cdV93BkhjY3A@9@iv z7WqRLA2|cgz&~Svr}e5{;-l