Merge pull request #16232 from frederic34/paymentvat
use camelCaps name
This commit is contained in:
commit
89bda722bf
@ -1749,7 +1749,7 @@ class Adherent extends CommonObject
|
||||
|
||||
if (!$error) {
|
||||
// Set invoice as paid
|
||||
$invoice->set_paid($user);
|
||||
$invoice->setPaid($user);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -501,7 +501,7 @@ if (empty($reshook))
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
} elseif ($action == 'setremise' && $usercancreate) {
|
||||
$result = $object->set_remise($user, GETPOST('remise'));
|
||||
$result = $object->setDiscount($user, GETPOST('remise'));
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
@ -607,7 +607,7 @@ if (empty($reshook))
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
} elseif ($action == 'setremisepercent' && $usercancreate) {
|
||||
$result = $object->set_remise($user, price2num(GETPOST('remise_percent'), 2));
|
||||
$result = $object->setDiscount($user, price2num(GETPOST('remise_percent'), 2));
|
||||
} elseif ($action == 'setremiseabsolue' && $usercancreate) {
|
||||
$result = $object->set_remise_absolue($user, price2num(GETPOST('remise_absolue'), 'MU'));
|
||||
} elseif ($action == 'addline' && GETPOST('submitforalllines', 'alpha') && GETPOST('vatforalllines', 'alpha')) {
|
||||
|
||||
@ -2359,6 +2359,8 @@ class Commande extends CommonOrder
|
||||
/**
|
||||
* Applique une remise relative
|
||||
*
|
||||
* @deprecated
|
||||
* @see setDiscount()
|
||||
* @param User $user User qui positionne la remise
|
||||
* @param float $remise Discount (percent)
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||
@ -2367,6 +2369,20 @@ class Commande extends CommonOrder
|
||||
public function set_remise($user, $remise, $notrigger = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
dol_syslog(get_class($this)."::set_remise is deprecated, use setDiscount instead", LOG_NOTICE);
|
||||
return $this->setDiscount($user, $remise, $notrigger);
|
||||
}
|
||||
|
||||
/**
|
||||
* Applique une remise relative
|
||||
*
|
||||
* @param User $user User qui positionne la remise
|
||||
* @param float $remise Discount (percent)
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function setDiscount($user, $remise, $notrigger = 0)
|
||||
{
|
||||
$remise = trim($remise) ?trim($remise) : 0;
|
||||
|
||||
if ($user->rights->commande->creer)
|
||||
|
||||
@ -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();
|
||||
@ -483,7 +483,7 @@ if (empty($reshook))
|
||||
$result = $object->setBankAccount(GETPOST('fk_account', 'int'));
|
||||
} elseif ($action == 'setremisepercent' && $usercancreate) {
|
||||
$object->fetch($id);
|
||||
$result = $object->set_remise($user, price2num(GETPOST('remise_percent'), 2));
|
||||
$result = $object->setDiscount($user, price2num(GETPOST('remise_percent'), 2));
|
||||
} elseif ($action == "setabsolutediscount" && $usercancreate) {
|
||||
// POST[remise_id] or POST[remise_id_for_payment]
|
||||
|
||||
@ -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');
|
||||
@ -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');
|
||||
@ -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();
|
||||
|
||||
@ -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');
|
||||
}
|
||||
@ -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');
|
||||
}
|
||||
@ -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();
|
||||
|
||||
@ -2293,6 +2293,8 @@ class Facture extends CommonInvoice
|
||||
* 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
|
||||
*
|
||||
* @deprecated
|
||||
* @see setPaid()
|
||||
* @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)
|
||||
@ -2301,6 +2303,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);
|
||||
return $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 +2369,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);
|
||||
return $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();
|
||||
@ -2399,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
|
||||
@ -2407,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();
|
||||
|
||||
@ -2542,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;
|
||||
@ -3567,6 +3617,8 @@ class Facture extends CommonInvoice
|
||||
/**
|
||||
* Set percent discount
|
||||
*
|
||||
* @deprecated
|
||||
* @see setDiscount()
|
||||
* @param User $user User that set discount
|
||||
* @param double $remise Discount
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||
@ -3575,6 +3627,20 @@ class Facture extends CommonInvoice
|
||||
public function set_remise($user, $remise, $notrigger = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
dol_syslog(get_class($this)."::set_remise is deprecated, use setDiscount instead", LOG_NOTICE);
|
||||
return $this->setDiscount($user, $remise, $notrigger);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set percent discount
|
||||
*
|
||||
* @param User $user User that set discount
|
||||
* @param double $remise Discount
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||
* @return int <0 if ko, >0 if ok
|
||||
*/
|
||||
public function setDiscount($user, $remise, $notrigger = 0)
|
||||
{
|
||||
// Clean parameters
|
||||
if (empty($remise)) $remise = 0;
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -111,14 +111,14 @@ if ($action == 'setbankaccount' && $user->rights->tax->charges->creer) {
|
||||
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);
|
||||
|
||||
@ -194,7 +194,7 @@ class PaymentVAT 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.");
|
||||
}
|
||||
|
||||
@ -246,14 +246,14 @@ class Tva extends CommonObject
|
||||
* @param User $user Object user making change
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function set_paid($user)
|
||||
public function setPaid($user)
|
||||
{
|
||||
// phpcs:enable
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."tva SET";
|
||||
$sql .= " paye = 1";
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
$return = $this->db->query($sql);
|
||||
if ($return) return 1;
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) return 1;
|
||||
else return -1;
|
||||
}
|
||||
|
||||
@ -263,14 +263,14 @@ class Tva extends CommonObject
|
||||
* @param User $user Object user making change
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function set_unpaid($user)
|
||||
public function setUnpaid($user)
|
||||
{
|
||||
// phpcs:enable
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."tva SET";
|
||||
$sql .= " paye = 0";
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
$return = $this->db->query($sql);
|
||||
if ($return) return 1;
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) return 1;
|
||||
else return -1;
|
||||
}
|
||||
|
||||
|
||||
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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');
|
||||
|
||||
@ -761,13 +761,28 @@ class Don extends CommonObject
|
||||
/**
|
||||
* 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
|
||||
* @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
|
||||
*
|
||||
* @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";
|
||||
if ($modepayment)
|
||||
{
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -953,7 +953,7 @@ if (empty($reshook))
|
||||
$object = new ExpenseReport($db);
|
||||
$object->fetch($id);
|
||||
|
||||
$result = $object->set_unpaid($user);
|
||||
$result = $object->setUnpaid($user);
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -1492,6 +1508,8 @@ class ExpenseReport extends CommonObject
|
||||
/**
|
||||
* set_unpaid
|
||||
*
|
||||
* @deprecated
|
||||
* @see setUnpaid()
|
||||
* @param User $fuser User
|
||||
* @param int $notrigger Disable triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
@ -1499,6 +1517,19 @@ class ExpenseReport extends CommonObject
|
||||
public function set_unpaid($fuser, $notrigger = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
dol_syslog(get_class($this)."::set_unpaid is deprecated, use setUnpaid instead", LOG_NOTICE);
|
||||
return $this->setUnpaid($fuser, $notrigger);
|
||||
}
|
||||
|
||||
/**
|
||||
* set_unpaid
|
||||
*
|
||||
* @param User $fuser User
|
||||
* @param int $notrigger Disable triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function setUnpaid($fuser, $notrigger = 0)
|
||||
{
|
||||
$error = 0;
|
||||
|
||||
if ($this->paid)
|
||||
|
||||
@ -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++;
|
||||
|
||||
@ -1250,6 +1250,8 @@ class FactureFournisseur extends CommonInvoice
|
||||
/**
|
||||
* Tag invoice as a paid invoice
|
||||
*
|
||||
* @deprecated
|
||||
* @see setPaid()
|
||||
* @param User $user Object user
|
||||
* @param string $close_code Code indicates whether the class has paid in full while payment is incomplete. Not implementd yet.
|
||||
* @param string $close_note Comment informs if the class has been paid while payment is incomplete. Not implementd yet.
|
||||
@ -1258,6 +1260,20 @@ class FactureFournisseur 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);
|
||||
return $this->setPaid($user, $close_code, $close_note);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tag invoice as a paid invoice
|
||||
*
|
||||
* @param User $user Object user
|
||||
* @param string $close_code Code indicates whether the class has paid in full while payment is incomplete. Not implementd yet.
|
||||
* @param string $close_note Comment informs if the class has been paid while payment is incomplete. Not implementd yet.
|
||||
* @return int <0 si ko, >0 si ok
|
||||
*/
|
||||
public function setPaid($user, $close_code = '', $close_note = '')
|
||||
{
|
||||
global $conf, $langs;
|
||||
$error = 0;
|
||||
|
||||
@ -1291,8 +1307,24 @@ class FactureFournisseur extends CommonInvoice
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Tag the invoice as not fully paid + trigger call BILL_UNPAYED
|
||||
* Function used when a direct debit payment is refused,
|
||||
* or when the invoice was canceled and reopened.
|
||||
*
|
||||
* @deprecated
|
||||
* @see setUnpaid()
|
||||
* @param User $user Object user that change status
|
||||
* @return int <0 si ok, >0 si 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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tag the invoice as not fully paid + trigger call BILL_UNPAYED
|
||||
* Function used when a direct debit payment is refused,
|
||||
@ -1301,9 +1333,8 @@ class FactureFournisseur extends CommonInvoice
|
||||
* @param User $user Object user that change status
|
||||
* @return int <0 si ok, >0 si ok
|
||||
*/
|
||||
public function set_unpaid($user)
|
||||
public function setUnpaid($user)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf, $langs;
|
||||
$error = 0;
|
||||
|
||||
|
||||
@ -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.");
|
||||
}
|
||||
|
||||
|
||||
@ -277,7 +277,7 @@ if (empty($reshook))
|
||||
$discount->unlink_invoice();
|
||||
} elseif ($action == 'confirm_paid' && $confirm == 'yes' && $usercancreate) {
|
||||
$object->fetch($id);
|
||||
$result = $object->set_paid($user);
|
||||
$result = $object->setPaid($user);
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
@ -605,7 +605,7 @@ if (empty($reshook))
|
||||
{
|
||||
if ($object->type != FactureFournisseur::TYPE_DEPOSIT) {
|
||||
// Classe facture
|
||||
$result = $object->set_paid($user);
|
||||
$result = $object->setPaid($user);
|
||||
if ($result >= 0)
|
||||
{
|
||||
$db->commit();
|
||||
@ -1545,7 +1545,7 @@ if (empty($reshook))
|
||||
if ($object->statut == FactureFournisseur::STATUS_CLOSED
|
||||
|| ($object->statut == FactureFournisseur::STATUS_ABANDONED && $object->close_code != 'replaced'))
|
||||
{
|
||||
$result = $object->set_unpaid($user);
|
||||
$result = $object->setUnpaid($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
|
||||
|
||||
@ -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');
|
||||
|
||||
@ -379,12 +379,26 @@ class Loan extends CommonObject
|
||||
/**
|
||||
* Tag loan as paid completely
|
||||
*
|
||||
* @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 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 .= " paid = ".$this::STATUS_PAID;
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
@ -399,14 +413,28 @@ class Loan extends CommonObject
|
||||
|
||||
// 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
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function set_started($user)
|
||||
{
|
||||
// phpcs:enable
|
||||
dol_syslog(get_class($this)."::set_started is deprecated, use setStarted instead", LOG_NOTICE);
|
||||
return $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 .= " paid = ".$this::STATUS_STARTED;
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
@ -422,13 +450,26 @@ class Loan extends CommonObject
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Tag loan as payement as unpaid
|
||||
*
|
||||
* @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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 .= " paid = ".$this::STATUS_UNPAID;
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
|
||||
@ -377,8 +377,7 @@ class PaymentLoan extends CommonObject
|
||||
if ($sum_payment == 0)
|
||||
{
|
||||
dol_syslog(get_class($this)."::delete : set loan to unpaid", LOG_DEBUG);
|
||||
if ($loan->set_unpaid($user) < 1)
|
||||
{
|
||||
if ($loan->setUnpaid($user) < 1) {
|
||||
$error++;
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
@ -532,7 +531,7 @@ class PaymentLoan extends CommonObject
|
||||
if ($loan->paid == $loan::STATUS_UNPAID)
|
||||
{
|
||||
dol_syslog(get_class($this)."::addPaymentToBank : set loan payment to started", LOG_DEBUG);
|
||||
if ($loan->set_started($user) < 1)
|
||||
if ($loan->setStarted($user) < 1)
|
||||
{
|
||||
$error++;
|
||||
dol_print_error($this->db);
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -778,15 +778,15 @@ 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->setCanceled($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 ((!$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';
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user