deprecate non camelCaps functions

This commit is contained in:
Frédéric FRANCE 2021-02-09 09:40:07 +01:00
parent a3e7c9d4b0
commit 6d961a1f79
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
5 changed files with 35 additions and 4 deletions

View File

@ -193,7 +193,7 @@ if (empty($reshook))
$result = $object->fetch($id);
if ($object->statut == Facture::STATUS_CLOSED || ($object->statut == Facture::STATUS_ABANDONED && ($object->close_code != 'replaced' || $object->getIdReplacingInvoice() == 0)) || ($object->statut == Facture::STATUS_VALIDATED && $object->paye == 1)) { // ($object->statut == 1 && $object->paye == 1) should not happened but can be found when data are corrupted
$result = $object->set_unpaid($user);
$result = $object->setUnpaid($user);
if ($result > 0) {
header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id);
exit();

View File

@ -960,7 +960,7 @@ class Invoices extends DolibarrApi
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$result = $this->invoice->set_unpaid(DolibarrApiAccess::$user);
$result = $this->invoice->setUnpaid(DolibarrApiAccess::$user);
if ($result == 0) {
throw new RestException(304, 'Nothing done');
}

View File

@ -2301,6 +2301,21 @@ class Facture 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 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
*
* @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)
* @return int <0 if KO, >0 if OK
*/
public function setPaid($user, $close_code = '', $close_note = '')
{
$error = 0;
if ($this->paye != 1)
@ -2352,12 +2367,28 @@ class Facture extends CommonInvoice
* Fonction utilisee quand un paiement prelevement est refuse,
* ou quand une facture annulee et reouverte.
*
* @deprecated
* @see setUnpaid()
* @param User $user Object user that change status
* @return int <0 if KO, >0 if 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 la facture comme non payee completement + appel trigger BILL_UNPAYED
* Fonction utilisee quand un paiement prelevement est refuse,
* ou quand une facture annulee et reouverte.
*
* @param User $user Object user that change status
* @return int <0 if KO, >0 if OK
*/
public function setUnpaid($user)
{
$error = 0;
$this->db->begin();

View File

@ -788,7 +788,7 @@ class RemiseCheque extends CommonObject
{
$invoice = new Facture($this->db);
$invoice->fetch($obj->fk_facture);
$invoice->set_unpaid($user);
$invoice->setUnpaid($user);
$rejectedPayment->amounts[$obj->fk_facture] = price2num($obj->amount) * -1;
}

View File

@ -184,7 +184,7 @@ class RejetPrelevement
//Tag invoice as unpaid
dol_syslog("RejetPrelevement::Create set_unpaid fac ".$fac->ref);
$fac->set_unpaid($user);
$fac->setUnpaid($user);
//TODO: Must be managed by notifications module
// Send email to sender of the standing order request