From 1ab2bea2f1ef39008208508a79b2c3fbb45521b3 Mon Sep 17 00:00:00 2001 From: Andreas Palm Date: Tue, 2 Apr 2024 23:36:04 +0200 Subject: [PATCH 1/3] Fix broken ShopUpdates after move to "versandpakete" --- .../Modules/Onlineshop/Data/OrderStatus.php | 15 ++ .../Data/OrderStatusUpdateRequest.php | 48 +++++ classes/Modules/Onlineshop/Data/Shipment.php | 30 +++ cronjobs/shop_rueckmeldungen.php | 15 +- www/lib/class.remote.php | 185 ++++++------------ www/pages/shopimporter_presta.php | 14 +- www/pages/shopimporter_shopify.php | 30 +-- www/pages/shopimporter_shopware.php | 41 ++-- www/pages/shopimporter_shopware6.php | 19 +- www/pages/shopimporter_woocommerce.php | 62 +++--- 10 files changed, 233 insertions(+), 226 deletions(-) create mode 100644 classes/Modules/Onlineshop/Data/OrderStatus.php create mode 100644 classes/Modules/Onlineshop/Data/OrderStatusUpdateRequest.php create mode 100644 classes/Modules/Onlineshop/Data/Shipment.php diff --git a/classes/Modules/Onlineshop/Data/OrderStatus.php b/classes/Modules/Onlineshop/Data/OrderStatus.php new file mode 100644 index 00000000..d09390d3 --- /dev/null +++ b/classes/Modules/Onlineshop/Data/OrderStatus.php @@ -0,0 +1,15 @@ +shipments as $shipment) { + if (!empty($shipment->trackingNumber)) + $list[] = $shipment->trackingNumber; + } + return $list; + } + + public function getTrackingUrlList() : array { + $list = []; + foreach ($this->shipments as $shipment) { + if (!empty($shipment->trackingUrl)) + $list[] = $shipment->trackingUrl; + } + return $list; + } +} \ No newline at end of file diff --git a/classes/Modules/Onlineshop/Data/Shipment.php b/classes/Modules/Onlineshop/Data/Shipment.php new file mode 100644 index 00000000..87daeed5 --- /dev/null +++ b/classes/Modules/Onlineshop/Data/Shipment.php @@ -0,0 +1,30 @@ +erp->RunHook('shop_rueckmeldung', 2, $join, $where); - $sql = "SELECT a.id,apro.zeit, a.shop, l.id as lieferschein, v.id as versandid, l.projekt - FROM auftrag AS a - LEFT JOIN lieferschein AS l on l.auftragid = a.id - LEFT JOIN auftrag_protokoll AS apro ON a.id = apro.auftrag AND apro.grund LIKE 'Auftrag importiert vom Shop' - LEFT JOIN projekt AS pr ON l.projekt = pr.id - LEFT JOIN versand AS v ON v.lieferschein = l.id + $sql = "SELECT DISTINCT a.id, a.shop + FROM auftrag a + LEFT JOIN lieferschein l on l.auftragid = a.id + LEFT JOIN projekt pr ON l.projekt = pr.id + LEFT JOIN lieferschein_position lp ON lp.lieferschein = l.id + LEFT JOIN versandpaket_lieferschein_position vlp ON vlp.lieferschein_position = lp.id + LEFT JOIN versandpakete v ON (v.lieferschein_ohne_pos = l.id OR v.id = vlp.versandpaket) $join WHERE a.status = 'abgeschlossen' AND $subwhere AND - DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 2 WEEK),'%Y-%m-%d') < a.datum AND + DATE_SUB(NOW(),INTERVAL 2 WEEK) < a.datum AND a.shopextstatus <> 'abgeschlossen' AND a.shop > 0 AND ( ( v.tracking <> '' AND l.status = 'versendet') OR diff --git a/www/lib/class.remote.php b/www/lib/class.remote.php index 0eb67ede..6f287e26 100644 --- a/www/lib/class.remote.php +++ b/www/lib/class.remote.php @@ -1,6 +1,6 @@ app->DB->SelectRow("SELECT * FROM `auftrag` WHERE `id` = {$orderId} LIMIT 1"); - $status = $orderArr['status']; - $zahlungsweise = $orderArr['zahlungsweise']; - $shopextid = $orderArr['shopextid']; - $internet = $orderArr['internet']; - $deliveryNoteArr = $this->app->DB->SelectRow( - "SELECT `id`, `versandart` FROM `lieferschein` WHERE `auftragid` = {$orderId} LIMIT 1" - ); - $trackingArr = null; - $versandart = ''; - $tracking = ''; - $shippingProduct = null; - if(!empty($deliveryNoteArr)) { - $deliveryNoteId = $deliveryNoteArr['id']; - $versandart = $deliveryNoteArr['versandart']; - $query = - "SELECT * - FROM `shopexport_versandarten` - WHERE `aktiv`=1 AND `versandart_wawision` = '{$versandart}' AND `shop` = {$shopId} AND `versandart_wawision` <> '' - LIMIT 1"; - $shippingMapping = $this->app->DB->SelectRow($query); - $versandartAusgehend = $shippingMapping['versandart_ausgehend'] ?? null; - $shippingProduct = $shippingMapping['produkt_ausgehend'] ?? null; + $orderArr = $this->app->DB->SelectRow("SELECT `zahlungsweise`, `shopextid` FROM `auftrag` WHERE `id` = $orderId LIMIT 1"); + if (empty($orderArr)) + return null; - if(!empty($versandartAusgehend)){ - $versandart = $versandartAusgehend; - } - $trackingArr = $this->app->DB->SelectPairs( - sprintf( - "SELECT `id`, `tracking` - FROM `versand` - WHERE `lieferschein` = {$deliveryNoteId} AND `tracking` <> '' - ORDER BY `id` DESC" - ) - ); - $tracking = ''; - if(!empty($trackingArr)) { - $tracking = reset($trackingArr); + $data = new OrderStatusUpdateRequest(); + $data->orderId = $orderId; + $data->shopOrderId = $orderArr['shopextid']; + + $statusArr = $this->app->DB->SelectFirstCols("SELECT DISTINCT status FROM auftrag WHERE id = $orderId OR teillieferungvon = $orderId"); + if (in_array('storniert', $statusArr)) + $data->orderStatus = OrderStatus::Cancelled; + if (in_array('abgeschlossen', $statusArr)) + $data->orderStatus = OrderStatus::Completed; + if (in_array('freigegeben', $statusArr)) + $data->orderStatus = OrderStatus::InProgress; + if (in_array('angelegt', $statusArr)) + $data->orderStatus = OrderStatus::Imported; + + $sql = " + SELECT + v.id, + v.tracking, + v.tracking_link, + COALESCE(sv.versandart_ausgehend, sv.versandart_shop, v.versandart) versandart + FROM + auftrag a + LEFT JOIN lieferschein l ON + l.auftragid = a.id + LEFT JOIN lieferschein_position lp ON + lp.lieferschein = l.id + LEFT JOIN versandpaket_lieferschein_position vlp ON + vlp.lieferschein_position = lp.id + LEFT JOIN versandpakete v ON + vlp.versandpaket = v.id OR v.lieferschein_ohne_pos = l.id + LEFT JOIN shopexport_versandarten sv ON + sv.versandart_wawision = v.versandart AND sv.shop = $shopId + WHERE a.id = $orderId OR a.teillieferungvon = $orderId + ORDER BY v.id"; + + $shipments = $this->app->DB->SelectArr($sql); + foreach ($shipments as $shipment) { + $item = new Shipment(); + $item->id = $shipment['id']; + $item->trackingNumber = $shipment['tracking']; + $item->trackingUrl = $shipment['tracking_link']; + $item->shippingMethod = $shipment['versandart']; + $data->shipments[] = $item; } - $positionen = $this->app->DB->SelectArr( - "SELECT ap.webid, trim(lp.geliefert)+0 AS `geliefert`, trim(lp.menge)+0 AS `menge`, lp.id - FROM `lieferschein_position` AS `lp` - INNER JOIN `lieferschein` AS `l` ON l.id = lp.lieferschein - INNER JOIN `auftrag` AS `a` ON a.id = l.auftragid - INNER JOIN `auftrag_position` AS `ap` ON ap.id = lp.auftrag_position_id - WHERE l.id = {$deliveryNoteId} AND ap.webid <> '' " - ); - $allPositions = false; - if(!empty($positionen)) { - $allPositions = true; - foreach($positionen as $position) { - if($position['geliefert'] > 0) { - $itemlist[] = array('webid'=>$position['webid'],'quantity'=>$position['geliefert']); - if($position['geliefert'] < $position['menge']) { - $allPositions = false; - } - } - elseif($this->app->DB->Select("SELECT trim(sum(geliefert))+0 - FROM lieferschein_position - WHERE explodiert_parent = '".$position['id']."' AND lieferschein = '$deliveryNoteId'")) { - $itemlist[] = array('webid'=>$position['webid'],'quantity'=>$position['menge']); - } - else { - $allPositions = false; - } - } - if($allPositions && (!empty($itemlist)?count($itemlist):0) < - $this->app->DB->Select( - sprintf('SELECT count(id) FROM auftrag_position WHERE auftrag = %d', $orderId) - ) - ) { - $allPositions = false; - } - } - } - if(!empty($itemlist)) { - $data['itemlist'] = $itemlist; - if($allPositions) { - $data['allpositions'] = 1; - } - } - - $data['orderId'] = $orderId; - $data['auftrag'] = $shopextid; - $data['internet'] = $internet; - $data['zahlungsweise'] = $zahlungsweise; - $data['versandart'] = $versandart; - if(!empty($trackingArr)) { - $data['trackinglist'] = $trackingArr; - } - if($status==='abgeschlossen') { - $data['versand']='1'; - $data['zahlung']='1'; - if($shippingProduct !== null) { - $data['shipping_product'] = $shippingProduct; - } - if($tracking!='') { - $data['tracking']=$tracking; - $lastShippingId = (int)$this->app->DB->Select( - sprintf( - "SELECT `id` FROM `versand` WHERE `lieferschein` = %d AND `lieferschein` > 0 - ORDER BY `id` DESC LIMIT 1", - $deliveryNoteId - ) - ); - $trackinglink = $lastShippingId > 0 && method_exists($this->app->erp,'GetTrackinglink') - ?$this->app->erp->GetTrackinglink($lastShippingId):''; - if($trackinglink) { - $data['trackinglink'] = $trackinglink; - if(!empty($trackingArr)) { - foreach($trackingArr as $versandId => $track) { - $data['trackinglinklist'][$versandId] = $this->app->erp->GetTrackinglink($versandId); - } - } - } - $trackinglinkRaw = $lastShippingId > 0 && method_exists($this->app->erp,'GetTrackingRawLink') - ?$this->app->erp->GetTrackingRawLink($lastShippingId):''; - if(!empty($trackinglinkRaw)) { - $data['trackinglinkraw'] = $trackinglinkRaw; - } - } - } - - return $data; + return $data; } /** @@ -2438,9 +2367,10 @@ class Remote */ public function RemoteUpdateAuftrag($shopId, $orderId) { - $data = $this->getDataToSendForUpdateOrder((int)$shopId, (int)$orderId); - if($data['versand']=='1' || $data['zahlung']=='1') - { + $data = $this->getDataToSendForUpdateOrder((int)$shopId, (int)$orderId); + if($data?->orderStatus !== OrderStatus::Completed) + return; + $bearbeiter = 'Cronjob'; if(isset($this->app->User)){ $bearbeiter = $this->app->DB->real_escape_string($this->app->User->GetName()); @@ -2465,7 +2395,6 @@ class Remote $this->app->erp->AuftragProtokoll($orderId, 'Versandmeldung an Shop übertragen', $bearbeiter); $this->app->DB->Update("UPDATE `auftrag` SET `shopextstatus` = 'abgeschlossen' WHERE `id` = $orderId LIMIT 1"); - } } /** diff --git a/www/pages/shopimporter_presta.php b/www/pages/shopimporter_presta.php index c669f07c..356a064b 100644 --- a/www/pages/shopimporter_presta.php +++ b/www/pages/shopimporter_presta.php @@ -6,6 +6,9 @@ * SPDX-License-Identifier: LicenseRef-EGPL-3.1 */ +use Xentral\Modules\Onlineshop\Data\OrderStatus; +use Xentral\Modules\Onlineshop\Data\OrderStatusUpdateRequest; + class Shopimporter_Presta extends ShopimporterBase { private $app; @@ -161,18 +164,21 @@ class Shopimporter_Presta extends ShopimporterBase public function ImportUpdateAuftrag() { - $auftrag = $this->data['auftrag']; + /** @var OrderStatusUpdateRequest $data */ + $data = $this->CatchRemoteCommand('data'); + if ($data->orderStatus !== OrderStatus::Completed) + return; $obj = $this->prestaRequest('GET', 'order_histories?schema=blank'); - $obj->order_history->id_order = $auftrag; + $obj->order_history->id_order = $data->shopOrderId; $obj->order_history->id_order_state = $this->idabgeschlossen; $this->prestaRequest('POST', 'order_histories', $obj->asXML()); - $req = $this->prestaRequest('GET', "order_carriers?filter[id_order]=$auftrag&display=[id]"); + $req = $this->prestaRequest('GET', "order_carriers?filter[id_order]=$data->shopOrderId&display=[id]"); $orderCarrierId = strval($req->order_carriers->order_carrier[0]->id); $req = $this->prestaRequest('GET', "order_carriers/$orderCarrierId"); - $req->order_carrier->tracking_number = $this->data['tracking']; + $req->order_carrier->tracking_number = join(',', $data->getTrackingNumberList()); $this->prestaRequest('PUT', "order_carriers/$orderCarrierId", $req->asXML()); } diff --git a/www/pages/shopimporter_shopify.php b/www/pages/shopimporter_shopify.php index 62b5cd7d..026eb443 100644 --- a/www/pages/shopimporter_shopify.php +++ b/www/pages/shopimporter_shopify.php @@ -14,6 +14,8 @@ ?> CatchRemoteCommand('data'); + /** @var OrderStatusUpdateRequest $req */ + $req = $this->CatchRemoteCommand('data'); + if ($req->orderStatus !== OrderStatus::Completed) + return; // pruefe ob $tmp[datei] vorhanden wenn nicht lege an sonst update [inhalt] und [checksum] - $auftrag = $tmp['auftrag']; + $auftrag = $req->shopOrderId; if(!empty($auftrag)){ - $zahlungok = $tmp['zahlung']; - $versandok = $tmp['versand']; - $tracking = $tmp['tracking']; - $versandart = $tmp['versandart']; $data = array(); - $data['fulfillment'] = array('tracking_number' => $tracking, 'tracking_company' => $versandart, 'notify_customer' => false); + $data['fulfillment'] = [ + 'tracking_numbers' => $req->getTrackingNumberList(), + 'tracking_company' => $req->shipments[0]?->shippingMethod, + 'notify_customer' => false, + 'tracking_urls' => $req->getTrackingUrlList() + ]; if(!empty($this->location)){ $data['fulfillment']['location_id'] = $this->location; } @@ -3410,16 +3416,10 @@ class Shopimporter_Shopify extends ShopimporterBase if($this->shopifytracking){ $data['fulfillment']['notify_customer'] = true; } - if(!empty($tmp['trackinglinkraw'])) { - $data['fulfillment']['tracking_urls'] = [$tmp['trackinglinkraw']]; - } - elseif(!empty($tmp['trackinglink'])){ - $data['fulfillment']['tracking_urls'] = [$tmp['trackinglink']]; - } $result = $this->adapter->call('orders/' . $auftrag . '/fulfillments.json', 'POST', $data); if($this->logging){ - $this->app->erp->LogFile(array($tmp, $auftrag, $data, $result['data'])); + $this->app->erp->LogFile(array($data, $auftrag, $data, $result['data'])); } $this->adapter->call('orders/' . $auftrag . '/metafields.json', 'POST', array('metafield' => [ 'key' => 'sync_status', @@ -3429,7 +3429,7 @@ class Shopimporter_Shopify extends ShopimporterBase ])); }else{ if($this->logging){ - $this->app->erp->LogFile(array($tmp, $auftrag,'Kein Auftrag')); + $this->app->erp->LogFile(array($data, $auftrag,'Kein Auftrag')); } } return 'OK'; diff --git a/www/pages/shopimporter_shopware.php b/www/pages/shopimporter_shopware.php index 8307218f..e042139b 100644 --- a/www/pages/shopimporter_shopware.php +++ b/www/pages/shopimporter_shopware.php @@ -1,4 +1,4 @@ - +*/ +?> CatchRemoteCommand('data'); + /** @var OrderStatusUpdateRequest $data */ + $data = $this->CatchRemoteCommand('data'); + if ($data->orderStatus !== OrderStatus::Completed) + return; // pruefe ob $tmp[datei] vorhanden wenn nicht lege an sonst update [inhalt] und [checksum] - $auftrag = $tmp['auftrag']; - $zahlungok = $tmp['zahlung']; - $versandok = $tmp['versand']; - $tracking = $tmp['tracking']; + $auftrag = $data->shopOrderId; - /*if($zahlungok=='ok' || $zahlungok=='1') - $status_zahlung=12; - else - $status_zahlung=1; - - if($versandok=='ok' || $versandok=='1') - $status_versand=7; - else - $status_versand=1;*/ - /* - $date = new DateTime(); - $date->modify('+10 days'); - $date = $date->format(DateTime::ISO8601); - */ $result = $this->adapter->put('orders/'.$auftrag, array( - // 'paymentStatusId' => $status_zahlung, - 'orderStatusId' => $this->abgeschlossenStatusId,//$status_versand, - 'trackingCode' => $tracking - //'comment' => 'Neuer Kommentar', - //'transactionId' => '0', - // 'clearedDate' => $date, + 'orderStatusId' => $this->abgeschlossenStatusId, + 'trackingCode' => join(',', $data->getTrackingNumberList()) )); $this->ShopwareLog("Abschlussstatusrückmeldung für Auftrag: $auftrag", print_r($result,true)); - //$this->app->DB->Delete("DELETE FROM auftraege WHERE id='$auftrag' LIMIT 1"); return 'ok'; } diff --git a/www/pages/shopimporter_shopware6.php b/www/pages/shopimporter_shopware6.php index 21b1216e..f500540d 100644 --- a/www/pages/shopimporter_shopware6.php +++ b/www/pages/shopimporter_shopware6.php @@ -15,6 +15,8 @@ CatchRemoteCommand('data'); - $auftrag = $tmp['auftrag']; - $tracking = $tmp['tracking']; + /** @var OrderStatusUpdateRequest $data */ + $data = $this->CatchRemoteCommand('data'); + if ($data->orderStatus !== OrderStatus::Completed) + return; + + $auftrag = $data->shopOrderId; $this->shopwareRequest('POST', '_action/order/'.$auftrag.'/state/complete'); @@ -3421,17 +3426,17 @@ class Shopimporter_Shopware6 extends ShopimporterBase $this->shopwareRequest('POST', '_action/order_delivery/'.$deliveryId.'/state/ship'); $deliveryData = [ - 'trackingCodes' => [$tracking] + 'trackingCodes' => [$data->getTrackingNumberList()] ]; $this->shopwareRequest('PATCH', 'order-delivery/'.$deliveryId,$deliveryData); } $this->sendInvoce($auftrag); - $this->addCustomFieldToOrder((string)$auftrag); - if(empty($tmp['orderId'])) { + $this->addCustomFieldToOrder($auftrag); + if(empty($data->orderId)) { return; } - $this->updateStorageForOrderIntId((int)$tmp['orderId']); + $this->updateStorageForOrderIntId($data->orderId); } public function ImportStorniereAuftrag() diff --git a/www/pages/shopimporter_woocommerce.php b/www/pages/shopimporter_woocommerce.php index 313c11c4..e1a30aed 100644 --- a/www/pages/shopimporter_woocommerce.php +++ b/www/pages/shopimporter_woocommerce.php @@ -1,4 +1,4 @@ - +*/ +?> CatchRemoteCommand('data'); + /** @var OrderStatusUpdateRequest $data */ + $data = $this->CatchRemoteCommand('data'); + if ($data->orderStatus !== OrderStatus::Completed) + return; - $orderId = $tmp['auftrag']; - $paymentOk = $tmp['zahlung']; - $shippingOk = $tmp['versand']; - $trackingCode = $tmp['tracking']; - $carrier = $tmp['versandart']; - - if ($paymentOk === 'ok' || $paymentOk === '1'){ - $paymentOk = true; - } - - if ($shippingOk === 'ok' || $shippingOk === '1'){ - $shippingOk = true; - } + $trackingCode = $data->shipments[0]?->trackingNumber; if (!empty($trackingCode)) { - $this->client->post('orders/'.$orderId.'/notes', [ + $this->client->post('orders/'.$data->orderId.'/notes', [ 'note' => 'Tracking Code: ' . $trackingCode ]); - $this->WooCommerceLog("Tracking Code Rückmeldung für Auftrag: $orderId", $trackingCode); + $this->WooCommerceLog("Tracking Code Rückmeldung für Auftrag: $data->orderId", $trackingCode); } - if ($paymentOk && $shippingOk) { - $updateData = [ - 'status' => $this->statusCompleted, - 'meta_data' => [ - [ - 'key' => 'tracking_code', - 'value' => $trackingCode - ], - [ - 'key' => 'shipping_carrier', - 'value' => $carrier - ] + $updateData = [ + 'status' => $this->statusCompleted, + 'meta_data' => [ + [ + 'key' => 'tracking_code', + 'value' => $data->shipments[0]?->trackingNumber ], - ]; - $this->client->put('orders/'.$orderId, $updateData); - $this->WooCommerceLog("Statusrückmeldung 'completed' für Auftrag: $orderId",$this->statusCompleted ); - } - + [ + 'key' => 'shipping_carrier', + 'value' => $data->shipments[0]?->shippingMethod + ] + ], + ]; + $this->client->put('orders/'.$data->orderId, $updateData); + $this->WooCommerceLog("Statusrückmeldung 'completed' für Auftrag: $data->orderId", $this->statusCompleted ); return 'ok'; } From bca6aa04ef52becbc27fb1143996355b45f2398f Mon Sep 17 00:00:00 2001 From: Andreas Palm Date: Wed, 3 Apr 2024 17:01:53 +0200 Subject: [PATCH 2/3] Remove old unused code from erpapi --- www/lib/class.erpapi.php | 121 --------------------------------------- 1 file changed, 121 deletions(-) diff --git a/www/lib/class.erpapi.php b/www/lib/class.erpapi.php index 7a62a6b2..49be95e9 100644 --- a/www/lib/class.erpapi.php +++ b/www/lib/class.erpapi.php @@ -15888,127 +15888,6 @@ function Gegenkonto($ust_befreit,$ustid='', $doctype = '', $doctypeId = 0) $this->app->Tpl->Parse('PAGE','emptytab.tpl'); } - /** - * @param int $id - * - * @return string - * - */ - public function GetTrackingRawLink($id) - { - return $this->GetTrackinglink($id, true); - } - - /** - * @param int $id - * @param bool $returnRaw - * - * @return string - */ - public function GetTrackinglink($id, $returnRaw = false) - { - if($id > 0) - { - $versandarr = $this->app->DB->SelectRow("SELECT * FROM versand WHERE id='$id' LIMIT 1"); - } - if(empty($versandarr)) - { - return ''; - } - $adresse = $versandarr['adresse']; - $lieferscheinid = $versandarr['lieferschein']; - if($lieferscheinid > 0){ - $lieferscheinarr = $this->app->DB->SelectRow("SELECT auftragid,projekt FROM lieferschein WHERE id='$lieferscheinid' LIMIT 1"); - } - if(!empty($lieferscheinarr)) - { - $auftrag = $lieferscheinarr['auftragid']; - $projekt = $lieferscheinarr['projekt']; - }else{ - $auftrag = 0; - $projekt = 0; - } - $auftragarr = $this->app->DB->SelectRow("SELECT belegnr,internet,ihrebestellnummer,DATE_FORMAT(datum,'%d.%m.%Y') as datum_de FROM auftrag WHERE id='$auftrag' LIMIT 1"); - if(!empty($auftragarr)){ - $auftragbelegnr = $auftragarr['belegnr']; - $auftraginternet = $auftragarr['internet']; - $ihrebestellnummer = $auftragarr['ihrebestellnummer']; - $auftragdatum = $auftragarr['datum_de']; - }else{ - $auftragbelegnr = ''; - $auftraginternet = ''; - $ihrebestellnummer = ''; - $auftragdatum = ''; - } - - $tracking = $versandarr['tracking']; - $versandunternehmen = $versandarr['versandunternehmen']; - - // FIX fuer selbstabholer Mail - $versandart = $versandarr['versandart']; - if($versandart=='selbstabholer') { - $versandunternehmen='selbstabholer'; - } - - if($versandunternehmen=='dhl' || $versandunternehmen=="dhlpremium" || $versandunternehmen=="intraship"){ - $versandmodul = false; - } - - $typ = $versandunternehmen; - if($typ === ''){ - $typ = $versandart; - } - //$versandartenmodul = $this->app->DB->SelectArr("SELECT id, modul FROM versanddienstleister WHERE aktiv = 1 AND modul = '".$this->app->DB->real_escape_string($typ)."' AND (projekt = 0 OR projekt = '$projekt') ORDER BY projekt DESC LIMIT 1"); - $versandartenmodul = $this->app->DB->SelectArr("SELECT * FROM versandarten WHERE aktiv = 1 AND ausprojekt = 0 AND modul != '' AND type = '".$this->app->DB->real_escape_string($typ)."' AND modul != '' AND (projekt = 0 OR projekt = '$projekt') ORDER BY projekt DESC LIMIT 1"); - $standard = true; - if($versandartenmodul && @is_file(dirname(__FILE__).'/versandarten/'.$versandartenmodul[0]['modul'].'.php')) - { - $obj = $this->LoadVersandModul($versandartenmodul[0]['modul'], $versandartenmodul[0]['id']); - if(!empty($obj) && method_exists($obj, 'Trackinglink')) - { - if($obj->Trackinglink($tracking, $notsend, $link, $rawlink)) - { - if($returnRaw) { - return $rawlink; - } - return $link; - } - } - }elseif($versandartenmodul2 = $this->app->DB->SelectArr("SELECT * FROM versandarten WHERE aktiv = 1 AND ausprojekt = 0 AND type = '".$this->app->DB->real_escape_string($typ)."' AND (projekt = 0 OR projekt = '$projekt') ORDER BY projekt DESC LIMIT 1")) - { - $obj = $this->LoadVersandModul($versandartenmodul2[0]['modul'], $versandartenmodul2[0]['id']); - if(!empty($obj) && method_exists($obj, 'Trackinglink')) - { - if($obj->Trackinglink($tracking, $notsend, $link, $rawlink)) - { - if($returnRaw) { - return $rawlink; - } - return $link; - } - } - } - if(!$versandmodul && $standard) - { - if($versandunternehmen=="dhl" || $versandunternehmen=="dhlpremium" || $versandunternehmen=="intraship") - { - return 'http://nolp.dhl.de/nextt-online-public/set_identcodes.do?lang=de&idc='.$tracking; - } - else if ($versandunternehmen=="logoix") - { - return 'http://www.logoix.com/cgi-bin/tnt.pl?q='.$tracking; - } - else if ($versandunternehmen=="dpd") - { - return 'https://tracking.dpd.de/parcelstatus/?locale=de_DE&query='.$tracking; - } - else if ($versandunternehmen=="gls") - { - return 'https://www.gls-group.eu/276-I-PORTAL-WEB/content/GLS/DE03/DE/5004.htm?txtRefNo='.$tracking; - } - } - } - /** * @param int $id */ From 3836b2ed0e91a4175333ef0bb9232c40b6f23f69 Mon Sep 17 00:00:00 2001 From: Andreas Palm Date: Wed, 3 Apr 2024 21:34:01 +0200 Subject: [PATCH 3/3] Prestashop: Fix property accessor --- www/pages/shopimporter_presta.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/pages/shopimporter_presta.php b/www/pages/shopimporter_presta.php index 356a064b..7fce9ab3 100644 --- a/www/pages/shopimporter_presta.php +++ b/www/pages/shopimporter_presta.php @@ -14,7 +14,7 @@ class Shopimporter_Presta extends ShopimporterBase private $app; private $intern; private $shopid; - private $data; + var $data; private $protocol; private $apiKey; private $shopUrl;