diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index bd19293ae43..e768552d8f4 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2293,6 +2293,8 @@ class Facture extends CommonInvoice * Tag the invoice as paid completely (if close_code is filled) => this->fk_statut=2, this->paye=1 * or partialy (if close_code filled) + appel trigger BILL_PAYED => this->fk_statut=2, this->paye stay 0 * + * @deprecated + * @see setPaid() * @param User $user Object user that modify * @param string $close_code Code renseigne si on classe a payee completement alors que paiement incomplet (cas escompte par exemple) * @param string $close_note Commentaire renseigne si on classe a payee alors que paiement incomplet (cas escompte par exemple) @@ -2302,7 +2304,7 @@ class Facture extends CommonInvoice { // phpcs:enable dol_syslog(get_class($this)."::set_paid is deprecated, use setPaid instead", LOG_NOTICE); - $this->setPaid($user, $close_code, $close_note); + return $this->setPaid($user, $close_code, $close_note); } /** @@ -2376,7 +2378,7 @@ class Facture extends CommonInvoice { // phpcs:enable dol_syslog(get_class($this)."::set_unpaid is deprecated, use setUnpaid instead", LOG_NOTICE); - $this->setUnpaid($user); + return $this->setUnpaid($user); } /** diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 83408d9ba6c..56151d661f9 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1250,6 +1250,8 @@ class FactureFournisseur extends CommonInvoice /** * Tag invoice as a paid invoice * + * @deprecated + * @see setPaid() * @param User $user Object user * @param string $close_code Code indicates whether the class has paid in full while payment is incomplete. Not implementd yet. * @param string $close_note Comment informs if the class has been paid while payment is incomplete. Not implementd yet. @@ -1258,6 +1260,20 @@ class FactureFournisseur extends CommonInvoice public function set_paid($user, $close_code = '', $close_note = '') { // phpcs:enable + dol_syslog(get_class($this)."::set_paid is deprecated, use setPaid instead", LOG_NOTICE); + $this->setPaid($user, $close_code, $close_note); + } + + /** + * Tag invoice as a paid invoice + * + * @param User $user Object user + * @param string $close_code Code indicates whether the class has paid in full while payment is incomplete. Not implementd yet. + * @param string $close_note Comment informs if the class has been paid while payment is incomplete. Not implementd yet. + * @return int <0 si ko, >0 si ok + */ + public function setPaid($user, $close_code = '', $close_note = '') + { global $conf, $langs; $error = 0; @@ -1291,8 +1307,24 @@ class FactureFournisseur extends CommonInvoice } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Tag the invoice as not fully paid + trigger call BILL_UNPAYED + * Function used when a direct debit payment is refused, + * or when the invoice was canceled and reopened. + * + * @deprecated + * @see setUnpaid() + * @param User $user Object user that change status + * @return int <0 si ok, >0 si ok + */ + public function set_unpaid($user) + { + // phpcs:enable + dol_syslog(get_class($this)."::set_unpaid is deprecated, use setUnpaid instead", LOG_NOTICE); + $this->setUnpaid($user); + } + /** * Tag the invoice as not fully paid + trigger call BILL_UNPAYED * Function used when a direct debit payment is refused, @@ -1301,9 +1333,8 @@ class FactureFournisseur extends CommonInvoice * @param User $user Object user that change status * @return int <0 si ok, >0 si ok */ - public function set_unpaid($user) + public function setUnpaid($user) { - // phpcs:enable global $conf, $langs; $error = 0; diff --git a/htdocs/loan/class/loan.class.php b/htdocs/loan/class/loan.class.php index cf4a0c876ea..9f2d8297edc 100644 --- a/htdocs/loan/class/loan.class.php +++ b/htdocs/loan/class/loan.class.php @@ -388,7 +388,7 @@ class Loan extends CommonObject { // phpcs:enable dol_syslog(get_class($this)."::set_paid is deprecated, use setPaid instead", LOG_NOTICE); - $this->setPaid($user); + return $this->setPaid($user); } /** @@ -424,7 +424,7 @@ class Loan extends CommonObject { // phpcs:enable dol_syslog(get_class($this)."::set_started is deprecated, use setStarted instead", LOG_NOTICE); - $this->setStarted($user); + return $this->setStarted($user); } /** @@ -459,7 +459,7 @@ class Loan extends CommonObject { // phpcs:enable dol_syslog(get_class($this)."::set_unpaid is deprecated, use setUnpaid instead", LOG_NOTICE); - $this->setUnpaid($user); + return $this->setUnpaid($user); } /** diff --git a/htdocs/loan/class/paymentloan.class.php b/htdocs/loan/class/paymentloan.class.php index 3e32456fb28..aa3f895f314 100644 --- a/htdocs/loan/class/paymentloan.class.php +++ b/htdocs/loan/class/paymentloan.class.php @@ -531,7 +531,7 @@ class PaymentLoan extends CommonObject if ($loan->paid == $loan::STATUS_UNPAID) { dol_syslog(get_class($this)."::addPaymentToBank : set loan payment to started", LOG_DEBUG); - if ($loan->set_started($user) < 1) + if ($loan->setStarted($user) < 1) { $error++; dol_print_error($this->db);