Browse Source

deprecate non camelCaps functions

Frédéric FRANCE 4 years ago
parent
commit
f394e55ade

+ 1 - 1
htdocs/adherents/class/adherent.class.php

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

+ 1 - 1
htdocs/cashdesk/validation_verif.php

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

+ 3 - 3
htdocs/compta/facture/card.php

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

+ 2 - 2
htdocs/compta/facture/class/api_invoices.class.php

@@ -910,7 +910,7 @@ class Invoices extends DolibarrApi
 			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) {
 			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) {
 					// Classe facture
-					$result = $this->invoice->set_paid(DolibarrApiAccess::$user);
+					$result = $this->invoice->setPaid(DolibarrApiAccess::$user);
 					if ($result >= 0)
 					{
 						$this->db->commit();

+ 1 - 1
htdocs/compta/paiement/class/paiement.class.php

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

+ 2 - 2
htdocs/compta/prelevement/class/bonprelevement.class.php

@@ -375,7 +375,7 @@ class BonPrelevement extends CommonObject
 					dol_syslog(get_class($this)."::set_credite set_paid fac ".$facs[$i]);
 					$fac = new Facture($this->db);
 					$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
 					if (price2num($alreadypayed + $facs[$i][1], 'MT') == $fac->total_ttc) {
-						$result = $fac->set_paid($user);
+						$result = $fac->setPaid($user);
 						if ($result < 0) {
 							$this->error = $fac->error;
 							$this->errors = $fac->errors;

+ 2 - 2
htdocs/compta/sociales/card.php

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

+ 32 - 4
htdocs/compta/sociales/class/chargesociales.class.php

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

+ 1 - 1
htdocs/compta/sociales/class/paymentsocialcontribution.class.php

@@ -197,7 +197,7 @@ class PaymentSocialContribution extends CommonObject
 							$remaintopay = price2num($contrib->amount - $paiement - $creditnotes - $deposits, 'MT');
 							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.");
 						}
 					}

+ 1 - 1
htdocs/don/card.php

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

+ 17 - 2
htdocs/don/class/don.class.php

@@ -758,6 +758,22 @@ class Don extends CommonObject
 	}
 
 	// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+	/**
+	 *    Classify the donation as paid, the donation was received
+	 *
+	 *	@deprecated
+	 *  @see setPaid()
+	 *  @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)
+	{
+		// 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
 	 *
@@ -765,9 +781,8 @@ class Don extends CommonObject
 	 *    @param    int		$modepayment   	    mode of payment
 	 *    @return   int      					<0 if KO, >0 if OK
 	 */
-	public function set_paid($id, $modepayment = 0)
+	public function setPaid($id, $modepayment = 0)
 	{
-		// phpcs:enable
 		$sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = 2";
 		if ($modepayment)
 		{

+ 1 - 1
htdocs/expensereport/card.php

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

+ 18 - 2
htdocs/expensereport/class/expensereport.class.php

@@ -634,6 +634,23 @@ class ExpenseReport extends CommonObject
 	}
 
 	// 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
 	 *
@@ -642,9 +659,8 @@ class ExpenseReport extends CommonObject
 	 *    @param    int     $notrigger          Disable triggers
 	 *    @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;
 		$this->db->begin();
 

+ 1 - 1
htdocs/expensereport/payment/payment.php

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

+ 1 - 1
htdocs/fourn/class/paiementfourn.class.php

@@ -241,7 +241,7 @@ class PaiementFourn extends Paiement
 								$remaintopay = price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits, 'MT');
 								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.");
 							}
 

+ 1 - 1
htdocs/loan/card.php

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

+ 1 - 1
htdocs/takepos/invoice.php

@@ -270,7 +270,7 @@ if ($action == 'valid' && $user->rights->facture->creer)
 
 		if ($remaintopay == 0) {
 			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;
 			// set payment method
 			$invoice->setPaymentMethods($paiementid);

+ 1 - 1
htdocs/webservices/server_invoice.php

@@ -778,7 +778,7 @@ function updateInvoice($authentication, $invoice)
 					}
 				}
 				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)
 					$result = $object->set_canceled($fuser, $invoice['close_code'], $invoice['close_note']);

+ 3 - 3
test/phpunit/ChargeSocialesTest.php

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

+ 1 - 1
test/phpunit/LoanTest.php

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