From 9ab12e24551ca712a1a6025ca3d78af540f99d14 Mon Sep 17 00:00:00 2001 From: Antonin MARCHAL Date: Fri, 7 May 2021 17:06:53 +0200 Subject: [PATCH 1/8] add (getNomUrl) --- htdocs/fourn/class/fournisseur.commande.class.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 331e211e5ac..3728771c8aa 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -765,7 +765,7 @@ class CommandeFournisseur extends CommonOrder */ public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = 0) { - global $langs, $conf, $user; + global $langs, $conf, $user, $hookmanager; $result = ''; @@ -774,7 +774,15 @@ class CommandeFournisseur extends CommonOrder if ($user->rights->fournisseur->commande->lire) { $label = ''.$langs->trans("SupplierOrder").''; if (isset($this->statut)) { - $label .= ' '.$this->getLibStatut(5); + $statusText = ' '.$this->getLibStatut(5); + $parameters = array('obj' => $this); + $reshook = $hookmanager->executeHooks('moreHtmlStatus', $parameters, $object); // Note that $action and $object may have been modified by hook + if (empty($reshook)) { + $statusText .= $hookmanager->resPrint; + } else { + $statusText = $hookmanager->resPrint; + } + $label .= $statusText; } if (!empty($this->ref)) { $label .= '
'.$langs->trans('Ref').': '.$this->ref; From c6d646f39e0ad1047493ef2960d4b3155770c3dc Mon Sep 17 00:00:00 2001 From: Antonin MARCHAL Date: Fri, 7 May 2021 17:08:36 +0200 Subject: [PATCH 2/8] add(prop)list --- htdocs/fourn/commande/list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index d32e466444c..a294d2a4712 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -1283,6 +1283,7 @@ if ($resql) { $objectstatic->id = $obj->rowid; $objectstatic->ref = $obj->ref; + $objectstatic->socid = $obj->socid; $objectstatic->ref_supplier = $obj->ref_supplier; $objectstatic->total_ht = $obj->total_ht; $objectstatic->total_tva = $obj->total_tva; From a91d1b2e07d9262c9aeecf53f5777e9b90c6a891 Mon Sep 17 00:00:00 2001 From: Antonin MARCHAL Date: Fri, 7 May 2021 17:09:39 +0200 Subject: [PATCH 3/8] add(list) hook --- htdocs/fourn/commande/list.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index a294d2a4712..0aae47cd7fc 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -1537,7 +1537,15 @@ if ($resql) { } // Status if (!empty($arrayfields['cf.fk_statut']['checked'])) { - print ''.$objectstatic->LibStatut($obj->fk_statut, 5, $obj->billed).''; + $parameters = array('obj' => $obj); + $morehtmlstatus = $objectstatic->LibStatut($obj->fk_statut, 5, $obj->billed); + $reshook = $hookmanager->executeHooks('moreHtmlStatus', $parameters, $object); // Note that $action and $object may have been modified by hook + if (empty($reshook)) { + $morehtmlstatus .= $hookmanager->resPrint; + } else { + $morehtmlstatus = $hookmanager->resPrint; + } + print '' . $morehtmlstatus . ''; if (!$i) { $totalarray['nbfield']++; } From 1bfcfc3a0ca69e8c44fb55d0d8c16b9059843056 Mon Sep 17 00:00:00 2001 From: Antonin MARCHAL Date: Wed, 12 May 2021 16:55:03 +0200 Subject: [PATCH 4/8] rename Hook and moved it into LibStatut method --- htdocs/fourn/class/fournisseur.commande.class.php | 7 ++++++- htdocs/fourn/commande/list.php | 10 +--------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 3728771c8aa..99b64ccead4 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -690,7 +690,7 @@ class CommandeFournisseur extends CommonOrder public function LibStatut($status, $mode = 0, $billed = 0) { // phpcs:enable - global $conf, $langs; + global $conf, $langs, $hookmanager; if (empty($this->statuts) || empty($this->statutshort)) { $langs->load('orders'); @@ -749,6 +749,11 @@ class CommandeFournisseur extends CommonOrder $statusLong = $langs->transnoentitiesnoconv($this->statuts[$status]).$billedtext; $statusShort = $langs->transnoentitiesnoconv($this->statutshort[$status]); + $parameters = array('status' => $status, 'mode' => $mode, 'billed' => $billed, 'obj'=>$this); + $reshook = $hookmanager->executeHooks('diffHtmlStatus', $parameters, $object); // Note that $action and $object may have been modified by hook + if ($reshook > 0) { + return $hookmanager->resPrint; + } return dolGetStatus($statusLong, $statusShort, '', $statusClass, $mode); } diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 0aae47cd7fc..a294d2a4712 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -1537,15 +1537,7 @@ if ($resql) { } // Status if (!empty($arrayfields['cf.fk_statut']['checked'])) { - $parameters = array('obj' => $obj); - $morehtmlstatus = $objectstatic->LibStatut($obj->fk_statut, 5, $obj->billed); - $reshook = $hookmanager->executeHooks('moreHtmlStatus', $parameters, $object); // Note that $action and $object may have been modified by hook - if (empty($reshook)) { - $morehtmlstatus .= $hookmanager->resPrint; - } else { - $morehtmlstatus = $hookmanager->resPrint; - } - print '' . $morehtmlstatus . ''; + print ''.$objectstatic->LibStatut($obj->fk_statut, 5, $obj->billed).''; if (!$i) { $totalarray['nbfield']++; } From ea0d8605930e51a0e84bd38c739cdcf2cc3e3a0e Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 12 May 2021 14:55:32 +0000 Subject: [PATCH 5/8] Fixing style errors. --- htdocs/fourn/class/fournisseur.commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 99b64ccead4..abfe6df1edc 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -753,7 +753,7 @@ class CommandeFournisseur extends CommonOrder $reshook = $hookmanager->executeHooks('diffHtmlStatus', $parameters, $object); // Note that $action and $object may have been modified by hook if ($reshook > 0) { return $hookmanager->resPrint; - } + } return dolGetStatus($statusLong, $statusShort, '', $statusClass, $mode); } From c6aa078892f89198178258484550681ad1762e2b Mon Sep 17 00:00:00 2001 From: Antonin MARCHAL Date: Mon, 17 May 2021 13:46:01 +0200 Subject: [PATCH 6/8] renamed LibStatut hook + removed useless hook --- htdocs/fourn/class/fournisseur.commande.class.php | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index abfe6df1edc..e8d6c0ed9c9 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -750,7 +750,7 @@ class CommandeFournisseur extends CommonOrder $statusShort = $langs->transnoentitiesnoconv($this->statutshort[$status]); $parameters = array('status' => $status, 'mode' => $mode, 'billed' => $billed, 'obj'=>$this); - $reshook = $hookmanager->executeHooks('diffHtmlStatus', $parameters, $object); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('LibStatut', $parameters, $object); // Note that $action and $object may have been modified by hook if ($reshook > 0) { return $hookmanager->resPrint; } @@ -779,15 +779,7 @@ class CommandeFournisseur extends CommonOrder if ($user->rights->fournisseur->commande->lire) { $label = ''.$langs->trans("SupplierOrder").''; if (isset($this->statut)) { - $statusText = ' '.$this->getLibStatut(5); - $parameters = array('obj' => $this); - $reshook = $hookmanager->executeHooks('moreHtmlStatus', $parameters, $object); // Note that $action and $object may have been modified by hook - if (empty($reshook)) { - $statusText .= $hookmanager->resPrint; - } else { - $statusText = $hookmanager->resPrint; - } - $label .= $statusText; + $label = ' '.$this->getLibStatut(5); } if (!empty($this->ref)) { $label .= '
'.$langs->trans('Ref').': '.$this->ref; From 779c868eaede3368a6d5b3f8674942565df26e84 Mon Sep 17 00:00:00 2001 From: Antonin MARCHAL Date: Mon, 17 May 2021 13:48:21 +0200 Subject: [PATCH 7/8] fix mistake and removed hookmanager unused --- htdocs/fourn/class/fournisseur.commande.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index e8d6c0ed9c9..9b643ff1464 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -770,7 +770,7 @@ class CommandeFournisseur extends CommonOrder */ public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = 0) { - global $langs, $conf, $user, $hookmanager; + global $langs, $conf, $user; $result = ''; @@ -779,7 +779,7 @@ class CommandeFournisseur extends CommonOrder if ($user->rights->fournisseur->commande->lire) { $label = ''.$langs->trans("SupplierOrder").''; if (isset($this->statut)) { - $label = ' '.$this->getLibStatut(5); + $label .= ' '.$this->getLibStatut(5); } if (!empty($this->ref)) { $label .= '
'.$langs->trans('Ref').': '.$this->ref; From 6ae4a75ac2405562adbda1a045f5571b6b19cae5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 5 Jun 2021 01:04:09 +0200 Subject: [PATCH 8/8] Update fournisseur.commande.class.php --- htdocs/fourn/class/fournisseur.commande.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 9b643ff1464..be13ad412aa 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -749,8 +749,8 @@ class CommandeFournisseur extends CommonOrder $statusLong = $langs->transnoentitiesnoconv($this->statuts[$status]).$billedtext; $statusShort = $langs->transnoentitiesnoconv($this->statutshort[$status]); - $parameters = array('status' => $status, 'mode' => $mode, 'billed' => $billed, 'obj'=>$this); - $reshook = $hookmanager->executeHooks('LibStatut', $parameters, $object); // Note that $action and $object may have been modified by hook + $parameters = array('status' => $status, 'mode' => $mode, 'billed' => $billed); + $reshook = $hookmanager->executeHooks('LibStatut', $parameters, $this); // Note that $action and $object may have been modified by hook if ($reshook > 0) { return $hookmanager->resPrint; }