deprecate non camelCaps functions

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

View File

@ -379,12 +379,26 @@ class Loan extends CommonObject
/** /**
* Tag loan as paid completely * Tag loan as paid completely
* *
* @deprecated
* @see setPaid()
* @param User $user Object user making change * @param User $user Object user making change
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function set_paid($user) public function set_paid($user)
{ {
// phpcs:enable // phpcs:enable
dol_syslog(get_class($this)."::set_paid is deprecated, use setPaid instead", LOG_NOTICE);
$this->setPaid($user);
}
/**
* Tag loan as paid completely
*
* @param User $user Object user making change
* @return int <0 if KO, >0 if OK
*/
public function setPaid($user)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."loan SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."loan SET";
$sql .= " paid = ".$this::STATUS_PAID; $sql .= " paid = ".$this::STATUS_PAID;
$sql .= " WHERE rowid = ".$this->id; $sql .= " WHERE rowid = ".$this->id;
@ -399,14 +413,28 @@ class Loan extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Tag loan as payement started * Tag loan as payment started
* *
* @deprecated
* @see setStarted()
* @param User $user Object user making change * @param User $user Object user making change
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function set_started($user) public function set_started($user)
{ {
// phpcs:enable // phpcs:enable
dol_syslog(get_class($this)."::set_started is deprecated, use setStarted instead", LOG_NOTICE);
$this->setStarted($user);
}
/**
* Tag loan as payment started
*
* @param User $user Object user making change
* @return int <0 if KO, >0 if OK
*/
public function setStarted($user)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."loan SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."loan SET";
$sql .= " paid = ".$this::STATUS_STARTED; $sql .= " paid = ".$this::STATUS_STARTED;
$sql .= " WHERE rowid = ".$this->id; $sql .= " WHERE rowid = ".$this->id;
@ -422,13 +450,26 @@ class Loan extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Tag loan as payement as unpaid * Tag loan as payement as unpaid
* * @deprecated
* @see setUnpaid()
* @param User $user Object user making change * @param User $user Object user making change
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function set_unpaid($user) public function set_unpaid($user)
{ {
// phpcs:enable // phpcs:enable
dol_syslog(get_class($this)."::set_unpaid is deprecated, use setUnpaid instead", LOG_NOTICE);
$this->setUnpaid($user);
}
/**
* Tag loan as payement as unpaid
*
* @param User $user Object user making change
* @return int <0 if KO, >0 if OK
*/
public function setUnpaid($user)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."loan SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."loan SET";
$sql .= " paid = ".$this::STATUS_UNPAID; $sql .= " paid = ".$this::STATUS_UNPAID;
$sql .= " WHERE rowid = ".$this->id; $sql .= " WHERE rowid = ".$this->id;

View File

@ -377,8 +377,7 @@ class PaymentLoan extends CommonObject
if ($sum_payment == 0) if ($sum_payment == 0)
{ {
dol_syslog(get_class($this)."::delete : set loan to unpaid", LOG_DEBUG); dol_syslog(get_class($this)."::delete : set loan to unpaid", LOG_DEBUG);
if ($loan->set_unpaid($user) < 1) if ($loan->setUnpaid($user) < 1) {
{
$error++; $error++;
dol_print_error($this->db); dol_print_error($this->db);
} }