From b6012e07d824e0b90a8bafcc2db4067fa688c5cf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Mar 2023 02:35:43 +0100 Subject: [PATCH] FIX Warning on purchase order + Property fk_commande not defined --- htdocs/fourn/class/fournisseur.commande.class.php | 3 ++- htdocs/fourn/commande/card.php | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 2cf0401d6eb..727fc96f0c4 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -489,7 +489,7 @@ class CommandeFournisseur extends CommonOrder $this->lines = array(); - $sql = "SELECT l.rowid, l.ref as ref_supplier, l.fk_product, l.product_type, l.label, l.description, l.qty,"; + $sql = "SELECT l.rowid, l.fk_commande, l.ref as ref_supplier, l.fk_product, l.product_type, l.label, l.description, l.qty,"; $sql .= " l.vat_src_code, l.tva_tx, l.remise_percent, l.subprice,"; $sql .= " l.localtax1_tx, l. localtax2_tx, l.localtax1_type, l. localtax2_type, l.total_localtax1, l.total_localtax2,"; $sql .= " l.total_ht, l.total_tva, l.total_ttc, l.special_code, l.fk_parent_line, l.rang,"; @@ -519,6 +519,7 @@ class CommandeFournisseur extends CommonOrder $line = new CommandeFournisseurLigne($this->db); $line->id = $objp->rowid; + $line->fk_commande = $objp->fk_commande; $line->desc = $objp->description; $line->description = $objp->description; $line->qty = $objp->qty; diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 842352475ad..ad9a204aef7 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -2093,7 +2093,7 @@ if ($action == 'create') { } print ''.$langs->trans("Date").''; print $object->date_commande ? dol_print_date($object->date_commande, $usehourmin ? 'dayhour' : 'day') : ''; - if ($object->hasDelay() && !empty($object->date_delivery) && !empty($object->date_commande)) { + if ($object->hasDelay() && !empty($object->delivery_date) && !empty($object->date_commande)) { print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); } print ""; @@ -2263,7 +2263,7 @@ if ($action == 'create') { $usehourmin = 1; } print $form->selectDate($object->delivery_date ? $object->delivery_date : -1, 'liv_', $usehourmin, $usehourmin, '', "setdate_livraison"); - print ''; + print ''; print ''; } else { $usehourmin = 'day'; @@ -2271,7 +2271,7 @@ if ($action == 'create') { $usehourmin = 'dayhour'; } print $object->delivery_date ? dol_print_date($object->delivery_date, $usehourmin) : ' '; - if ($object->hasDelay() && !empty($object->delivery_date)) { + if ($object->hasDelay() && !empty($object->delivery_date) && ($object->statut == $object::STATUS_ORDERSENT || $object->statut == $object::STATUS_RECEIVED_PARTIALLY)) { print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); } }