From d7d0ebe5d26f4fc17c00f8808a55087c3799da19 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Mar 2023 10:38:38 +0100 Subject: [PATCH] Fix warnings --- .../actions_adherentcard_common.class.php | 17 ++++++----------- .../actions_adherentcard_default.class.php | 1 - .../canvas/actions_contactcard_common.class.php | 2 +- .../actions_contactcard_default.class.php | 1 - htdocs/delivery/class/delivery.class.php | 14 ++++++++++---- .../product/actions_card_product.class.php | 1 - .../service/actions_card_service.class.php | 3 +-- .../company/actions_card_company.class.php | 2 +- 8 files changed, 19 insertions(+), 22 deletions(-) diff --git a/htdocs/adherents/canvas/actions_adherentcard_common.class.php b/htdocs/adherents/canvas/actions_adherentcard_common.class.php index 45d9c4f8fce..eda6f52deb3 100644 --- a/htdocs/adherents/canvas/actions_adherentcard_common.class.php +++ b/htdocs/adherents/canvas/actions_adherentcard_common.class.php @@ -61,20 +61,15 @@ abstract class ActionsAdherentCardCommon */ public function getObject($id) { - //$ret = $this->getInstanceDao(); + $object = new Adherent($this->db); - /*if (is_object($this->object) && method_exists($this->object,'fetch')) - { - if (!empty($id)) $this->object->fetch($id); - } - else - {*/ - $object = new Adherent($this->db); if (!empty($id)) { $object->fetch($id); } - $this->object = $object; - //} + + $this->object = $object; + + return $object; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -83,7 +78,7 @@ abstract class ActionsAdherentCardCommon * * @param string $action Type of action * @param int $id Id - * @return string HTML output + * @return void */ public function assign_values(&$action, $id) { diff --git a/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php b/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php index b6f0489108a..58b414b2511 100644 --- a/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php +++ b/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php @@ -84,7 +84,6 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon public function assign_values(&$action, $id) { // phpcs:enable - global $limit, $offset, $sortfield, $sortorder; global $conf, $db, $langs, $user; global $form; diff --git a/htdocs/contact/canvas/actions_contactcard_common.class.php b/htdocs/contact/canvas/actions_contactcard_common.class.php index 7e73d264480..3c82ae4f99b 100644 --- a/htdocs/contact/canvas/actions_contactcard_common.class.php +++ b/htdocs/contact/canvas/actions_contactcard_common.class.php @@ -86,7 +86,7 @@ abstract class ActionsContactCardCommon * * @param string $action Type of action * @param int $id Id - * @return string HTML output + * @return void */ public function assign_values(&$action, $id) { diff --git a/htdocs/contact/canvas/default/actions_contactcard_default.class.php b/htdocs/contact/canvas/default/actions_contactcard_default.class.php index f126b8c32a0..20be2b468b4 100644 --- a/htdocs/contact/canvas/default/actions_contactcard_default.class.php +++ b/htdocs/contact/canvas/default/actions_contactcard_default.class.php @@ -83,7 +83,6 @@ class ActionsContactCardDefault extends ActionsContactCardCommon public function assign_values(&$action, $id) { // phpcs:enable - global $limit, $offset, $sortfield, $sortorder; global $conf, $db, $langs, $user; global $form; diff --git a/htdocs/delivery/class/delivery.class.php b/htdocs/delivery/class/delivery.class.php index e599268ff03..61309a1cfae 100644 --- a/htdocs/delivery/class/delivery.class.php +++ b/htdocs/delivery/class/delivery.class.php @@ -303,9 +303,11 @@ class Delivery extends CommonObject $result = $line->insertExtraFields(); } - if ($error == 0) { + if (!$error) { return 1; } + + return -1; } /** @@ -519,8 +521,10 @@ class Delivery extends CommonObject } } } + + return -1; } else { - $this->error = "Non autorise"; + $this->error = "NotAllowed"; dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR); return -1; } @@ -639,7 +643,7 @@ class Delivery extends CommonObject * Delete line * * @param int $lineid Line id - * @return integer|null + * @return integer <0 if KO, 0 if nothing done, >0 if OK */ public function deleteline($lineid) { @@ -652,9 +656,11 @@ class Delivery extends CommonObject return 1; } else { - return 0; + return -1; } } + + return 0; } /** diff --git a/htdocs/product/canvas/product/actions_card_product.class.php b/htdocs/product/canvas/product/actions_card_product.class.php index 56ebab13344..d9a20ac7f3e 100644 --- a/htdocs/product/canvas/product/actions_card_product.class.php +++ b/htdocs/product/canvas/product/actions_card_product.class.php @@ -77,7 +77,6 @@ class ActionsCardProduct public function assign_values(&$action, $id = 0, $ref = '') { // phpcs:enable - global $limit, $offset, $sortfield, $sortorder; global $conf, $langs, $user, $mysoc, $canvas; global $form, $formproduct; diff --git a/htdocs/product/canvas/service/actions_card_service.class.php b/htdocs/product/canvas/service/actions_card_service.class.php index 021de9b215e..e639568459e 100644 --- a/htdocs/product/canvas/service/actions_card_service.class.php +++ b/htdocs/product/canvas/service/actions_card_service.class.php @@ -81,9 +81,8 @@ class ActionsCardService public function assign_values(&$action, $id = 0, $ref = '') { // phpcs:enable - global $limit, $offset, $sortfield, $sortorder; global $conf, $langs, $user, $mysoc, $canvas; - global $form, $formproduct; + global $form; $tmpobject = new Product($this->db); if (!empty($id) || !empty($ref)) { diff --git a/htdocs/societe/canvas/company/actions_card_company.class.php b/htdocs/societe/canvas/company/actions_card_company.class.php index 7aa46178235..1e034d46322 100644 --- a/htdocs/societe/canvas/company/actions_card_company.class.php +++ b/htdocs/societe/canvas/company/actions_card_company.class.php @@ -88,7 +88,7 @@ class ActionsCardCompany extends ActionsCardCommon { // phpcs:enable global $conf, $langs, $user, $mysoc; - global $form, $formadmin, $formcompany; + global $form, $formcompany; $ret = $this->getObject($id, $ref);