Clean code

This commit is contained in:
Laurent Destailleur 2024-03-15 10:01:05 +01:00
parent 80e2e59373
commit 777d864151
4 changed files with 2 additions and 11 deletions

View File

@ -178,9 +178,6 @@ class RejetPrelevement
// Make a negative payment
// Amount must be an array (id of invoice -> amount)
$pai->amounts = array();
//var_dump($this->type);exit;
$pai->amounts[$facs[$i][0]] = price2num($amountrejected * -1); // The payment must be negative because it is a refund
$pai->datepaye = $date_rejet;

View File

@ -227,6 +227,7 @@ if (empty($reshook)) {
$paiement->paiementtype = GETPOST("type_payment", 'alphanohtml');
$paiement->num_payment = GETPOST("num_payment", 'alphanohtml');
$paiement->note = GETPOST("note", 'restricthtml');
$paiement->note_private = GETPOST("note", 'restricthtml');
if (!$error) {
$paymentid = $paiement->create($user, (int) GETPOST('closepaidtva'));

View File

@ -161,8 +161,6 @@ class PaymentVAT extends CommonObject
*/
public function create($user, $closepaidvat = 0)
{
global $conf, $langs;
$error = 0;
$now = dol_now();

View File

@ -189,17 +189,12 @@ function createPayment($authentication, $payment)
$soc->fetch($payment['thirdparty_id']);
$new_payment = new Paiement($db);
$new_payment->amount = (float) $payment['amount'];
$new_payment->num_payment = $payment['num_payment'];
$new_payment->fk_account = intval($payment['bank_account']);
$new_payment->paiementid = !empty($payment['payment_mode_id']) ? intval($payment['payment_mode_id']) : $soc->mode_reglement_id;
$new_payment->datepaye = $now;
$new_payment->author = $payment['thirdparty_id'];
$new_payment->amounts = array();
if (intval($payment['invoice_id']) > 0) {
$new_payment->amounts[$payment['invoice_id']] = $new_payment->amount;
}
$new_payment->amounts = array($payment['invoice_id'] => (float) $payment['amount']);
$db->begin();
$result = $new_payment->create($fuser, true);