deprecate non camelCaps functions

This commit is contained in:
Frédéric FRANCE 2021-02-09 13:10:11 +01:00
parent f394e55ade
commit 04c25a01af
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
8 changed files with 54 additions and 13 deletions

View File

@ -767,7 +767,7 @@ if (empty($reshook))
$close_code = GETPOST("close_code", 'restricthtml');
$close_note = GETPOST("close_note", 'restricthtml');
if ($close_code) {
$result = $object->set_canceled($user, $close_code, $close_note);
$result = $object->setCanceled($user, $close_code, $close_note);
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
} else {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Reason")), null, 'errors');

View File

@ -2432,6 +2432,8 @@ class Facture extends CommonInvoice
* Warning, if option to decrease stock on invoice was set, this function does not change stock (it might be a cancel because
* of no payment even if merchandises were sent).
*
* @deprecated
* @see setCanceled()
* @param User $user Object user making change
* @param string $close_code Code of closing invoice (CLOSECODE_REPLACED, CLOSECODE_...)
* @param string $close_note Comment
@ -2440,8 +2442,23 @@ class Facture extends CommonInvoice
public function set_canceled($user, $close_code = '', $close_note = '')
{
// phpcs:enable
dol_syslog(get_class($this)."::set_canceled is deprecated, use setCanceled instead", LOG_NOTICE);
return $this->setCanceled($user, $close_code, $close_note);
}
dol_syslog(get_class($this)."::set_canceled rowid=".$this->id, LOG_DEBUG);
/**
* Tag invoice as canceled, with no payment on it (example for replacement invoice or payment never received) + call trigger BILL_CANCEL
* Warning, if option to decrease stock on invoice was set, this function does not change stock (it might be a cancel because
* of no payment even if merchandises were sent).
*
* @param User $user Object user making change
* @param string $close_code Code of closing invoice (CLOSECODE_REPLACED, CLOSECODE_...)
* @param string $close_note Comment
* @return int <0 if KO, >0 if OK
*/
public function setCanceled($user, $close_code = '', $close_note = '')
{
dol_syslog(get_class($this)."::setCanceled rowid=".$this->id, LOG_DEBUG);
$this->db->begin();
@ -2575,7 +2592,7 @@ class Facture extends CommonInvoice
return -12;
}
$result = $facreplaced->set_canceled($user, self::CLOSECODE_REPLACED, '');
$result = $facreplaced->setCanceled($user, self::CLOSECODE_REPLACED, '');
if ($result < 0)
{
$this->error = $facreplaced->error;

View File

@ -307,7 +307,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
dol_syslog("Amount of linked proposals = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht), LOG_DEBUG);
if ($totalonlinkedelements == $object->total_ht) {
foreach ($object->linkedObjects['reception'] as $element) {
$ret = $element->set_billed();
$ret = $element->setBilled();
}
}
}

View File

@ -523,7 +523,7 @@ if (empty($reshook))
} elseif ($action == 'classifybilled')
{
$object->fetch($id);
$result = $object->set_billed();
$result = $object->setBilled();
if ($result >= 0) {
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
exit();

View File

@ -2307,11 +2307,24 @@ class Expedition extends CommonObject
/**
* Classify the shipping as invoiced (used when WORKFLOW_BILL_ON_SHIPMENT is on)
*
* @deprecated
* @see setBilled()
* @return int <0 if ko, >0 if ok
*/
public function set_billed()
{
// phpcs:enable
dol_syslog(get_class($this)."::set_billed is deprecated, use setBilled instead", LOG_NOTICE);
return $this->setBilled();
}
/**
* Classify the shipping as invoiced (used when WORKFLOW_BILL_ON_SHIPMENT is on)
*
* @return int <0 if ko, >0 if ok
*/
public function setBilled()
{
global $user;
$error = 0;

View File

@ -506,7 +506,7 @@ if (empty($reshook))
} elseif ($action == 'classifybilled')
{
$object->fetch($id);
$result = $object->set_billed();
$result = $object->setBilled();
if ($result >= 0) {
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
exit();

View File

@ -1551,11 +1551,24 @@ class Reception extends CommonObject
/**
* Classify the reception as invoiced (used when WORKFLOW_BILL_ON_RECEPTION is on)
*
* @deprecated
* @see setBilled()
* @return int <0 if ko, >0 if ok
*/
public function set_billed()
{
// phpcs:enable
dol_syslog(get_class($this)."::set_billed is deprecated, use setBilled instead", LOG_NOTICE);
return $this->setBilled();
}
/**
* Classify the reception as invoiced (used when WORKFLOW_BILL_ON_RECEPTION is on)
*
* @return int <0 if ko, >0 if ok
*/
public function setBilled()
{
global $user;
$error = 0;

View File

@ -780,13 +780,13 @@ function updateInvoice($authentication, $invoice)
if ($invoice['status'] == Facture::STATUS_CLOSED) {
$result = $object->setPaid($fuser, $invoice['close_code'], $invoice['close_note']);
}
if ($invoice['status'] == Facture::STATUS_ABANDONED)
$result = $object->set_canceled($fuser, $invoice['close_code'], $invoice['close_note']);
if ($invoice['status'] == Facture::STATUS_ABANDONED) {
$result = $object->setCanceled($fuser, $invoice['close_code'], $invoice['close_note']);
}
}
}
if ((!$error) && ($objectfound))
{
if ((!$error) && ($objectfound)) {
$db->commit();
$objectresp = array(
'result'=>array('result_code'=>'OK', 'result_label'=>''),
@ -794,9 +794,7 @@ function updateInvoice($authentication, $invoice)
'ref'=>$object->ref,
'ref_ext'=>$object->ref_ext
);
}
elseif ($objectfound)
{
} elseif ($objectfound) {
$db->rollback();
$error++;
$errorcode = 'KO';