From 17d1fa190f0cf80635b767a5624e6edd262ce0db Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 1 Jan 2022 15:27:20 +0100 Subject: [PATCH 1/5] Fix : Fatal error: Uncaught Error: Call to a member function deleteFromShipment() on null in /home/httpd/vhosts/doliweb.com/httpdocs/expedition/class/expedition.class.php on line 1463 --- htdocs/expedition/class/expedition.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index dd0022b09dc..bd6c27f6771 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1460,6 +1460,7 @@ class Expedition extends CommonObject // delete batch expedition line if (!$error) { + $shipmentlinebatch = new ExpeditionLineBatch($this->db); if ($shipmentlinebatch->deleteFromShipment($this->id) < 0) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } From e73573d7c488e05e21730a327fef6dc20c759eb5 Mon Sep 17 00:00:00 2001 From: BENKE Charlene <1179011+defrance@users.noreply.github.com> Date: Tue, 4 Jan 2022 09:18:28 +0100 Subject: [PATCH 2/5] fix : allow create from other external modules --- htdocs/fourn/commande/card.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 510ed4f699a..597905768f9 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -8,7 +8,8 @@ * Copyright (C) 2012-2016 Marcos García * Copyright (C) 2013 Florian Henry * Copyright (C) 2014 Ion Agorria - * Copyright (C) 2018-2019 Frédéric France + * Copyright (C) 2018-2019 Frédéric France + * Copyright (C) 2022 Charlene Benke * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1211,13 +1212,15 @@ if (empty($reshook)) { if (!$error) { // If creation from another object of another module (Example: origin=propal, originid=1) if (!empty($origin) && !empty($originid)) { + $element = $subelement = $origin; + $classname = ucfirst($subelement); if ($origin == 'propal' || $origin == 'proposal') { - $classname = 'Propal'; $element = 'comm/propal'; $subelement = 'propal'; - } elseif ($origin == 'order' || $origin == 'commande') { - $classname = 'Commande'; + } + if ($origin == 'order' || $origin == 'commande') { $element = $subelement = 'commande'; - } else { + } + if ($origin == 'supplier_proposal') { $classname = 'SupplierProposal'; $element = 'supplier_proposal'; $subelement = 'supplier_proposal'; From 4e1d4ea1cac06bd73c78004fb1fe797270872c3e Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 4 Jan 2022 08:23:49 +0000 Subject: [PATCH 3/5] Fixing style errors. --- htdocs/fourn/commande/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 597905768f9..eab53861f34 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1216,10 +1216,10 @@ if (empty($reshook)) { $classname = ucfirst($subelement); if ($origin == 'propal' || $origin == 'proposal') { $element = 'comm/propal'; $subelement = 'propal'; - } + } if ($origin == 'order' || $origin == 'commande') { $element = $subelement = 'commande'; - } + } if ($origin == 'supplier_proposal') { $classname = 'SupplierProposal'; $element = 'supplier_proposal'; From 0bc33ef3b3b5acab6ec02bd00ae2f0c2c667f9d4 Mon Sep 17 00:00:00 2001 From: BENKE Charlene <1179011+defrance@users.noreply.github.com> Date: Tue, 4 Jan 2022 09:26:10 +0100 Subject: [PATCH 4/5] Create card.php --- htdocs/fourn/commande/card.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index eab53861f34..aa31178d546 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1216,10 +1216,12 @@ if (empty($reshook)) { $classname = ucfirst($subelement); if ($origin == 'propal' || $origin == 'proposal') { $element = 'comm/propal'; $subelement = 'propal'; - } + $classname = 'Propal'; + } if ($origin == 'order' || $origin == 'commande') { $element = $subelement = 'commande'; - } + $classname = 'Commande'; + } if ($origin == 'supplier_proposal') { $classname = 'SupplierProposal'; $element = 'supplier_proposal'; @@ -1541,15 +1543,19 @@ if ($action == 'create') { if ($origin == 'propal' || $origin == 'proposal') { $classname = 'Propal'; $element = 'comm/propal'; $subelement = 'propal'; - } elseif ($origin == 'order' || $origin == 'commande') { + } + if ($origin == 'order' || $origin == 'commande') { $classname = 'Commande'; $element = $subelement = 'commande'; - } else { + } + if ($origin == 'supplier_proposal') { $classname = 'SupplierProposal'; $element = 'supplier_proposal'; $subelement = 'supplier_proposal'; } + + dol_include_once('/'.$element.'/class/'.$subelement.'.class.php'); $objectsrc = new $classname($db); From 883d6bd63a391255eeb5e38ceeba1aec6034efcf Mon Sep 17 00:00:00 2001 From: BENKE Charlene <1179011+defrance@users.noreply.github.com> Date: Tue, 4 Jan 2022 09:32:27 +0100 Subject: [PATCH 5/5] Update card.php --- htdocs/fourn/commande/card.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index aa31178d546..1fc43e846be 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1534,6 +1534,7 @@ if ($action == 'create') { if (!empty($origin) && !empty($originid)) { // Parse element/subelement (ex: project_task) $element = $subelement = $origin; + $classname = ucfirst($subelement); $regs = array(); if (preg_match('/^([^_]+)_([^_]+)/i', $origin, $regs)) { $element = $regs[1];