From d375aca2c852085141cfa724d2aca095bab168ca Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 4 Nov 2022 11:29:52 +0100 Subject: [PATCH 1/3] fix bad SQL parenthesis in notification --- htdocs/core/ajax/check_notifications.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/ajax/check_notifications.php b/htdocs/core/ajax/check_notifications.php index 35d10af49b6..4f5290b8826 100644 --- a/htdocs/core/ajax/check_notifications.php +++ b/htdocs/core/ajax/check_notifications.php @@ -152,7 +152,7 @@ if (empty($_SESSION['auto_check_events_not_before']) || $time >= $_SESSION['auto $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'actioncomm_reminder as ar ON a.id = ar.fk_actioncomm AND ar.fk_user = '.$user->id; $sql .= ' WHERE a.code <> "AC_OTH_AUTO"'; $sql .= ' AND ('; - $sql .= " (ar.typeremind = 'browser' AND ar.dateremind < '".$db->idate(dol_now())."' AND ar.status = 0 AND ar.entity = ".$conf->entity; + $sql .= " ar.typeremind = 'browser' AND ar.dateremind < '".$db->idate(dol_now())."' AND ar.status = 0 AND ar.entity = ".$conf->entity; $sql .= ' )'; } else { $sql .= ' JOIN '.MAIN_DB_PREFIX.'actioncomm_reminder as ar ON a.id = ar.fk_actioncomm AND ar.fk_user = '.$user->id; From 73b857c1b3ab3e754e94848457738622947f95dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Courtier?= Date: Tue, 8 Nov 2022 16:21:32 +0100 Subject: [PATCH 2/3] FIX: Add Missing "LibStatut" hook in propal, commande, facture --- htdocs/comm/propal/class/propal.class.php | 10 +++++++++- htdocs/commande/class/commande.class.php | 15 ++++++++++++++- htdocs/core/class/commoninvoice.class.php | 18 +++++++++++++++++- 3 files changed, 40 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index f36b8027461..06bd79ea618 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3243,7 +3243,7 @@ class Propal extends CommonObject public function LibStatut($status, $mode = 1) { // phpcs:enable - global $conf; + global $conf, $hookmanager; // Init/load array of translation of status if (empty($this->labelStatus) || empty($this->labelStatusShort)) { @@ -3273,7 +3273,15 @@ class Propal extends CommonObject } elseif ($status == self::STATUS_BILLED) { $statusType = 'status6'; } + + $parameters = array('status' => $status, 'mode' => $mode); + $reshook = $hookmanager->executeHooks('LibStatut', $parameters, $this); // Note that $action and $object may have been modified by hook + + if ($reshook > 0) { + return $hookmanager->resPrint; + } + return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); } diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 54e50baa9f7..b43b29a43cc 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3591,7 +3591,7 @@ class Commande extends CommonOrder public function LibStatut($status, $billed, $mode, $donotshowbilled = 0) { // phpcs:enable - global $langs, $conf; + global $langs, $conf, $hookmanager; $billedtext = ''; if (empty($donotshowbilled)) { @@ -3636,6 +3636,19 @@ class Commande extends CommonOrder $mode = 0; } + $parameters = array( + 'status' => $status, + 'mode' => $mode, + 'billed' => $billed, + 'donotshowbilled' => $donotshowbilled + ); + + $reshook = $hookmanager->executeHooks('LibStatut', $parameters, $this); // Note that $action and $object may have been modified by hook + + if ($reshook > 0) { + return $hookmanager->resPrint; + } + return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode, '', array('tooltip' => $labelTooltip)); } diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index f6edbd3f8d4..af143b324c4 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -532,7 +532,7 @@ abstract class CommonInvoice extends CommonObject public function LibStatut($paye, $status, $mode = 0, $alreadypaid = -1, $type = -1) { // phpcs:enable - global $langs; + global $langs, $hookmanager; $langs->load('bills'); if ($type == -1) { @@ -576,6 +576,22 @@ abstract class CommonInvoice extends CommonObject $labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusPaid'); } } + + $parameters = array( + 'status' => $status, + 'mode' => $mode, + 'paye' => $paye, + 'alreadypaid' => $alreadypaid, + 'type' => $type + ); + + $reshook = $hookmanager->executeHooks('LibStatut', $parameters, $this); // Note that $action and $object may have been modified by hook + + if ($reshook > 0) { + return $hookmanager->resPrint; + } + + return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode); } From 89876d8d529899d1b552bbeb102eb823872145a6 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 8 Nov 2022 15:24:05 +0000 Subject: [PATCH 3/3] Fixing style errors. --- htdocs/comm/propal/class/propal.class.php | 8 ++++---- htdocs/commande/class/commande.class.php | 18 +++++++++--------- htdocs/core/class/commoninvoice.class.php | 20 ++++++++++---------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 06bd79ea618..005fdfa77bb 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3273,15 +3273,15 @@ class Propal extends CommonObject } elseif ($status == self::STATUS_BILLED) { $statusType = 'status6'; } - - $parameters = array('status' => $status, 'mode' => $mode); + + $parameters = array('status' => $status, 'mode' => $mode); $reshook = $hookmanager->executeHooks('LibStatut', $parameters, $this); // Note that $action and $object may have been modified by hook - if ($reshook > 0) { + if ($reshook > 0) { return $hookmanager->resPrint; } - + return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); } diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index b43b29a43cc..e0275eb4308 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3636,19 +3636,19 @@ class Commande extends CommonOrder $mode = 0; } - $parameters = array( - 'status' => $status, - 'mode' => $mode, - 'billed' => $billed, - 'donotshowbilled' => $donotshowbilled - ); + $parameters = array( + 'status' => $status, + 'mode' => $mode, + 'billed' => $billed, + 'donotshowbilled' => $donotshowbilled + ); - $reshook = $hookmanager->executeHooks('LibStatut', $parameters, $this); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('LibStatut', $parameters, $this); // Note that $action and $object may have been modified by hook - if ($reshook > 0) { + if ($reshook > 0) { return $hookmanager->resPrint; } - + return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode, '', array('tooltip' => $labelTooltip)); } diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index af143b324c4..8cc9f944ef1 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -576,18 +576,18 @@ abstract class CommonInvoice extends CommonObject $labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusPaid'); } } - - $parameters = array( - 'status' => $status, - 'mode' => $mode, - 'paye' => $paye, - 'alreadypaid' => $alreadypaid, - 'type' => $type - ); - $reshook = $hookmanager->executeHooks('LibStatut', $parameters, $this); // Note that $action and $object may have been modified by hook + $parameters = array( + 'status' => $status, + 'mode' => $mode, + 'paye' => $paye, + 'alreadypaid' => $alreadypaid, + 'type' => $type + ); - if ($reshook > 0) { + $reshook = $hookmanager->executeHooks('LibStatut', $parameters, $this); // Note that $action and $object may have been modified by hook + + if ($reshook > 0) { return $hookmanager->resPrint; }