deprecate non camelCaps functions

This commit is contained in:
Frédéric FRANCE 2021-02-09 10:26:17 +01:00
parent 0da942210f
commit f394e55ade
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
20 changed files with 92 additions and 33 deletions

View File

@ -1749,7 +1749,7 @@ class Adherent extends CommonObject
if (!$error) { if (!$error) {
// Set invoice as paid // Set invoice as paid
$invoice->set_paid($user); $invoice->setPaid($user);
} }
} }

View File

@ -319,7 +319,7 @@ switch ($action)
&& $obj_facturation->getSetPaymentMode() != 'DIFF') && $obj_facturation->getSetPaymentMode() != 'DIFF')
{ {
// We set status to paid // We set status to paid
$result = $invoice->set_paid($user); $result = $invoice->setPaid($user);
//print 'set paid';exit; //print 'set paid';exit;
} }
} }

View File

@ -747,7 +747,7 @@ if (empty($reshook))
elseif ($action == 'confirm_paid' && $confirm == 'yes' && $usercanissuepayment) elseif ($action == 'confirm_paid' && $confirm == 'yes' && $usercanissuepayment)
{ {
$object->fetch($id); $object->fetch($id);
$result = $object->set_paid($user); $result = $object->setPaid($user);
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
} // Classif "paid partialy" } // Classif "paid partialy"
elseif ($action == 'confirm_paid_partially' && $confirm == 'yes' && $usercanissuepayment) elseif ($action == 'confirm_paid_partially' && $confirm == 'yes' && $usercanissuepayment)
@ -756,7 +756,7 @@ if (empty($reshook))
$close_code = GETPOST("close_code", 'restricthtml'); $close_code = GETPOST("close_code", 'restricthtml');
$close_note = GETPOST("close_note", 'restricthtml'); $close_note = GETPOST("close_note", 'restricthtml');
if ($close_code) { if ($close_code) {
$result = $object->set_paid($user, $close_code, $close_note); $result = $object->setPaid($user, $close_code, $close_note);
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
} else { } else {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Reason")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Reason")), null, 'errors');
@ -921,7 +921,7 @@ if (empty($reshook))
{ {
if ($object->type != Facture::TYPE_DEPOSIT) { if ($object->type != Facture::TYPE_DEPOSIT) {
// Classe facture // Classe facture
$result = $object->set_paid($user); $result = $object->setPaid($user);
if ($result >= 0) if ($result >= 0)
{ {
$db->commit(); $db->commit();

View File

@ -910,7 +910,7 @@ class Invoices extends DolibarrApi
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
} }
$result = $this->invoice->set_paid(DolibarrApiAccess::$user, $close_code, $close_note); $result = $this->invoice->setPaid(DolibarrApiAccess::$user, $close_code, $close_note);
if ($result == 0) { if ($result == 0) {
throw new RestException(304, 'Error nothing done. May be object is already validated'); throw new RestException(304, 'Error nothing done. May be object is already validated');
} }
@ -1167,7 +1167,7 @@ class Invoices extends DolibarrApi
{ {
if ($this->invoice->type != Facture::TYPE_DEPOSIT) { if ($this->invoice->type != Facture::TYPE_DEPOSIT) {
// Classe facture // Classe facture
$result = $this->invoice->set_paid(DolibarrApiAccess::$user); $result = $this->invoice->setPaid(DolibarrApiAccess::$user);
if ($result >= 0) if ($result >= 0)
{ {
$this->db->commit(); $this->db->commit();

View File

@ -398,7 +398,7 @@ class Paiement extends CommonObject
// Set invoice to paid // Set invoice to paid
if (!$error) if (!$error)
{ {
$result = $invoice->set_paid($user, '', ''); $result = $invoice->setPaid($user, '', '');
if ($result < 0) if ($result < 0)
{ {
$this->error = $invoice->error; $this->error = $invoice->error;

View File

@ -375,7 +375,7 @@ class BonPrelevement extends CommonObject
dol_syslog(get_class($this)."::set_credite set_paid fac ".$facs[$i]); dol_syslog(get_class($this)."::set_credite set_paid fac ".$facs[$i]);
$fac = new Facture($this->db); $fac = new Facture($this->db);
$fac->fetch($facs[$i]); $fac->fetch($facs[$i]);
$result = $fac->set_paid($user); $result = $fac->setPaid($user);
} }
} }
@ -482,7 +482,7 @@ class BonPrelevement extends CommonObject
// @TODO Move this after creation of payment // @TODO Move this after creation of payment
if (price2num($alreadypayed + $facs[$i][1], 'MT') == $fac->total_ttc) { if (price2num($alreadypayed + $facs[$i][1], 'MT') == $fac->total_ttc) {
$result = $fac->set_paid($user); $result = $fac->setPaid($user);
if ($result < 0) { if ($result < 0) {
$this->error = $fac->error; $this->error = $fac->error;
$this->errors = $fac->errors; $this->errors = $fac->errors;

View File

@ -74,14 +74,14 @@ $object = new ChargeSociales($db);
if ($action == 'confirm_paid' && $user->rights->tax->charges->creer && $confirm == 'yes') if ($action == 'confirm_paid' && $user->rights->tax->charges->creer && $confirm == 'yes')
{ {
$object->fetch($id); $object->fetch($id);
$result = $object->set_paid($user); $result = $object->setPaid($user);
} }
if ($action == 'reopen' && $user->rights->tax->charges->creer) { if ($action == 'reopen' && $user->rights->tax->charges->creer) {
$result = $object->fetch($id); $result = $object->fetch($id);
if ($object->paye) if ($object->paye)
{ {
$result = $object->set_unpaid($user); $result = $object->setUnpaid($user);
if ($result > 0) if ($result > 0)
{ {
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);

View File

@ -432,12 +432,26 @@ class ChargeSociales extends CommonObject
/** /**
* Tag social contribution as paid completely * Tag social contribution as paid completely
* *
* @param User $user Object user making change * @deprecated
* @return int <0 if KO, >0 if OK * @see setPaid()
* @param User $user Object user making change
* @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);
return $this->setPaid($user);
}
/**
* Tag social contribution 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."chargesociales SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET";
$sql .= " paye = 1"; $sql .= " paye = 1";
$sql .= " WHERE rowid = ".$this->id; $sql .= " WHERE rowid = ".$this->id;
@ -450,12 +464,26 @@ class ChargeSociales extends CommonObject
/** /**
* Remove tag paid on social contribution * Remove tag paid on social contribution
* *
* @param User $user Object user making change * @deprecated
* @return int <0 if KO, >0 if OK * @see setUnpaid()
* @param User $user Object user making change
* @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);
return $this->setUnpaid($user);
}
/**
* Remove tag paid on social contribution
*
* @param User $user Object user making change
* @return int <0 if KO, >0 if OK
*/
public function setUnpaid($user)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET";
$sql .= " paye = 0"; $sql .= " paye = 0";
$sql .= " WHERE rowid = ".$this->id; $sql .= " WHERE rowid = ".$this->id;

View File

@ -197,7 +197,7 @@ class PaymentSocialContribution extends CommonObject
$remaintopay = price2num($contrib->amount - $paiement - $creditnotes - $deposits, 'MT'); $remaintopay = price2num($contrib->amount - $paiement - $creditnotes - $deposits, 'MT');
if ($remaintopay == 0) if ($remaintopay == 0)
{ {
$result = $contrib->set_paid($user); $result = $contrib->setPaid($user);
} else dol_syslog("Remain to pay for conrib ".$contribid." not null. We do nothing."); } else dol_syslog("Remain to pay for conrib ".$contribid." not null. We do nothing.");
} }
} }

View File

@ -255,7 +255,7 @@ if ($action == 'set_cancel') {
} }
if ($action == 'set_paid') { if ($action == 'set_paid') {
$object->fetch($id); $object->fetch($id);
if ($object->set_paid($id, $modepayment) >= 0) { if ($object->setPaid($id, $modepayment) >= 0) {
$action = ''; $action = '';
} else { } else {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');

View File

@ -761,13 +761,28 @@ class Don extends CommonObject
/** /**
* Classify the donation as paid, the donation was received * Classify the donation as paid, the donation was received
* *
* @param int $id id of donation * @deprecated
* @param int $modepayment mode of payment * @see setPaid()
* @return int <0 if KO, >0 if OK * @param int $id id of donation
* @param int $modepayment mode of payment
* @return int <0 if KO, >0 if OK
*/ */
public function set_paid($id, $modepayment = 0) public function set_paid($id, $modepayment = 0)
{ {
// phpcs:enable // phpcs:enable
dol_syslog(get_class($this)."::set_paid is deprecated, use setPaid instead", LOG_NOTICE);
return $this->setPaid($id, $modepayment);
}
/**
* Classify the donation as paid, the donation was received
*
* @param int $id id of donation
* @param int $modepayment mode of payment
* @return int <0 if KO, >0 if OK
*/
public function setPaid($id, $modepayment = 0)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = 2"; $sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = 2";
if ($modepayment) if ($modepayment)
{ {

View File

@ -981,7 +981,7 @@ if (empty($reshook))
$object = new ExpenseReport($db); $object = new ExpenseReport($db);
$object->fetch($id); $object->fetch($id);
$result = $object->set_paid($id, $user); $result = $object->setPaid($id, $user);
if ($result > 0) if ($result > 0)
{ {

View File

@ -634,6 +634,23 @@ class ExpenseReport extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Classify the expense report as paid
*
* @deprecated
* @see setPaid()
* @param int $id Id of expense report
* @param user $fuser User making change
* @param int $notrigger Disable triggers
* @return int <0 if KO, >0 if OK
*/
public function set_paid($id, $fuser, $notrigger = 0)
{
// phpcs:enable
dol_syslog(get_class($this)."::set_paid is deprecated, use setPaid instead", LOG_NOTICE);
return $this->setPaid($id, $fuser, $notrigger);
}
/** /**
* Classify the expense report as paid * Classify the expense report as paid
* *
@ -642,9 +659,8 @@ class ExpenseReport extends CommonObject
* @param int $notrigger Disable triggers * @param int $notrigger Disable triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function set_paid($id, $fuser, $notrigger = 0) public function setPaid($id, $fuser, $notrigger = 0)
{ {
// phpcs:enable
$error = 0; $error = 0;
$this->db->begin(); $this->db->begin();

View File

@ -144,7 +144,7 @@ if ($action == 'add_payment')
if (!$error) { if (!$error) {
$payment->fetch($paymentid); $payment->fetch($paymentid);
if ($expensereport->total_ttc - $payment->amount == 0) { if ($expensereport->total_ttc - $payment->amount == 0) {
$result = $expensereport->set_paid($expensereport->id, $user); $result = $expensereport->setPaid($expensereport->id, $user);
if (!$result > 0) { if (!$result > 0) {
setEventMessages($payment->error, $payment->errors, 'errors'); setEventMessages($payment->error, $payment->errors, 'errors');
$error++; $error++;

View File

@ -241,7 +241,7 @@ class PaiementFourn extends Paiement
$remaintopay = price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits, 'MT'); $remaintopay = price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits, 'MT');
if ($remaintopay == 0) if ($remaintopay == 0)
{ {
$result = $invoice->set_paid($user, '', ''); $result = $invoice->setPaid($user, '', '');
} else dol_syslog("Remain to pay for invoice ".$facid." not null. We do nothing."); } else dol_syslog("Remain to pay for invoice ".$facid." not null. We do nothing.");
} }

View File

@ -67,7 +67,7 @@ if (empty($reshook))
if ($action == 'confirm_paid' && $confirm == 'yes' && $user->rights->loan->write) if ($action == 'confirm_paid' && $confirm == 'yes' && $user->rights->loan->write)
{ {
$object->fetch($id); $object->fetch($id);
$result = $object->set_paid($user); $result = $object->setPaid($user);
if ($result > 0) if ($result > 0)
{ {
setEventMessages($langs->trans('LoanPaid'), null, 'mesgs'); setEventMessages($langs->trans('LoanPaid'), null, 'mesgs');

View File

@ -270,7 +270,7 @@ if ($action == 'valid' && $user->rights->facture->creer)
if ($remaintopay == 0) { if ($remaintopay == 0) {
dol_syslog("Invoice is paid, so we set it to status Paid"); dol_syslog("Invoice is paid, so we set it to status Paid");
$result = $invoice->set_paid($user); $result = $invoice->setPaid($user);
if ($result > 0) $invoice->paye = 1; if ($result > 0) $invoice->paye = 1;
// set payment method // set payment method
$invoice->setPaymentMethods($paiementid); $invoice->setPaymentMethods($paiementid);

View File

@ -778,7 +778,7 @@ function updateInvoice($authentication, $invoice)
} }
} }
if ($invoice['status'] == Facture::STATUS_CLOSED) { if ($invoice['status'] == Facture::STATUS_CLOSED) {
$result = $object->set_paid($fuser, $invoice['close_code'], $invoice['close_note']); $result = $object->setPaid($fuser, $invoice['close_code'], $invoice['close_note']);
} }
if ($invoice['status'] == Facture::STATUS_ABANDONED) if ($invoice['status'] == Facture::STATUS_ABANDONED)
$result = $object->set_canceled($fuser, $invoice['close_code'], $invoice['close_note']); $result = $object->set_canceled($fuser, $invoice['close_code'], $invoice['close_note']);

View File

@ -174,7 +174,7 @@ class ChargeSocialesTest extends PHPUnit\Framework\TestCase
/** /**
* testChargeSocialesValid * testChargeSocialesValid
* *
* @param Object $localobject Social contribution * @param ChargeSociales $localobject Social contribution
* @return void * @return void
* *
* @depends testChargeSocialesFetch * @depends testChargeSocialesFetch
@ -188,7 +188,7 @@ class ChargeSocialesTest extends PHPUnit\Framework\TestCase
$langs=$this->savlangs; $langs=$this->savlangs;
$db=$this->savdb; $db=$this->savdb;
$result=$localobject->set_paid($user); $result=$localobject->setPaid($user);
print __METHOD__." id=".$localobject->id." result=".$result."\n"; print __METHOD__." id=".$localobject->id." result=".$result."\n";
$this->assertLessThan($result, 0); $this->assertLessThan($result, 0);
@ -198,7 +198,7 @@ class ChargeSocialesTest extends PHPUnit\Framework\TestCase
/** /**
* testChargeSocialesOther * testChargeSocialesOther
* *
* @param Object $localobject Social contribution * @param ChargeSociales $localobject Social contribution
* @return void * @return void
* *
* @depends testChargeSocialesValid * @depends testChargeSocialesValid

View File

@ -189,7 +189,7 @@ class LoanTest extends PHPUnit\Framework\TestCase
$langs=$this->savlangs; $langs=$this->savlangs;
$db=$this->savdb; $db=$this->savdb;
$result=$localobject->set_paid($user); $result=$localobject->setPaid($user);
print __METHOD__." id=".$localobject->id." result=".$result."\n"; print __METHOD__." id=".$localobject->id." result=".$result."\n";
$this->assertLessThan($result, 0); $this->assertLessThan($result, 0);