mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-13 11:15:21 +01:00
@@ -189,7 +189,7 @@ class PaymentVAT extends CommonObject
|
||||
$this->fk_tva = (int) $this->fk_tva;
|
||||
}
|
||||
if (isset($this->amount)) {
|
||||
$this->amount = trim($this->amount);
|
||||
$this->amount = (float) $this->amount;
|
||||
}
|
||||
if (isset($this->fk_typepaiement)) {
|
||||
$this->fk_typepaiement = (int) $this->fk_typepaiement;
|
||||
@@ -215,11 +215,11 @@ class PaymentVAT extends CommonObject
|
||||
|
||||
$totalamount = 0;
|
||||
foreach ($this->amounts as $key => $value) { // How payment is dispatch
|
||||
$newvalue = price2num($value, 'MT');
|
||||
$newvalue = (float) price2num($value, 'MT');
|
||||
$this->amounts[$key] = $newvalue;
|
||||
$totalamount += $newvalue;
|
||||
}
|
||||
$totalamount = price2num($totalamount);
|
||||
// $totalamount = price2num($totalamount);
|
||||
|
||||
// Check parameters
|
||||
if ($totalamount == 0) {
|
||||
@@ -246,7 +246,7 @@ class PaymentVAT extends CommonObject
|
||||
foreach ($this->amounts as $key => $amount) {
|
||||
$contribid = $key;
|
||||
if (is_numeric($amount) && $amount != 0) {
|
||||
$amount = price2num($amount);
|
||||
$amount = (float) price2num($amount);
|
||||
|
||||
// If we want to closed paid invoices
|
||||
if ($closepaidvat) {
|
||||
@@ -257,8 +257,8 @@ class PaymentVAT extends CommonObject
|
||||
$creditnotes = 0;
|
||||
//$deposits=$contrib->getSumDepositsUsed();
|
||||
$deposits = 0;
|
||||
$alreadypayed = price2num($paiement + $creditnotes + $deposits, 'MT');
|
||||
$remaintopay = price2num($contrib->amount - $paiement - $creditnotes - $deposits, 'MT');
|
||||
$alreadypayed = (float) price2num($paiement + $creditnotes + $deposits, 'MT');
|
||||
$remaintopay = (float) price2num($contrib->amount - $paiement - $creditnotes - $deposits, 'MT');
|
||||
if ($remaintopay == 0) {
|
||||
$result = $contrib->setPaid($user);
|
||||
} else {
|
||||
@@ -374,7 +374,7 @@ class PaymentVAT extends CommonObject
|
||||
$this->fk_tva = (int) $this->fk_tva;
|
||||
}
|
||||
if (isset($this->amount)) {
|
||||
$this->amount = trim($this->amount);
|
||||
$this->amount = (float) $this->amount;
|
||||
}
|
||||
if (isset($this->fk_typepaiement)) {
|
||||
$this->fk_typepaiement = (int) $this->fk_typepaiement;
|
||||
|
||||
@@ -160,7 +160,7 @@ class PaymentExpenseReport extends CommonObject
|
||||
$this->fk_expensereport = (int) $this->fk_expensereport;
|
||||
}
|
||||
if (isset($this->amount)) {
|
||||
$this->amount = trim($this->amount);
|
||||
$this->amount = (float) $this->amount;
|
||||
}
|
||||
if (isset($this->fk_typepayment)) {
|
||||
$this->fk_typepayment = (int) $this->fk_typepayment;
|
||||
@@ -189,11 +189,11 @@ class PaymentExpenseReport extends CommonObject
|
||||
|
||||
$totalamount = 0;
|
||||
foreach ($this->amounts as $key => $value) { // How payment is dispatch
|
||||
$newvalue = price2num($value, 'MT');
|
||||
$newvalue = (float) price2num($value, 'MT');
|
||||
$this->amounts[$key] = $newvalue;
|
||||
$totalamount += $newvalue;
|
||||
}
|
||||
$totalamount = price2num($totalamount);
|
||||
// $totalamount = (float) price2num($totalamount);
|
||||
|
||||
// Check parameters
|
||||
if ($totalamount == 0) {
|
||||
@@ -315,7 +315,7 @@ class PaymentExpenseReport extends CommonObject
|
||||
$this->fk_expensereport = (int) $this->fk_expensereport;
|
||||
}
|
||||
if (isset($this->amount)) {
|
||||
$this->amount = trim($this->amount);
|
||||
$this->amount = (float) $this->amount;
|
||||
}
|
||||
if (isset($this->fk_typepayment)) {
|
||||
$this->fk_typepayment = (int) $this->fk_typepayment;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -85,14 +85,14 @@ if ($action == 'add_payment') {
|
||||
|
||||
if (!$error) {
|
||||
$paymentid = 0;
|
||||
$total = 0;
|
||||
// $total = 0;
|
||||
|
||||
// Read possible payments
|
||||
foreach ($_POST as $key => $value) {
|
||||
if (substr($key, 0, 7) == 'amount_') {
|
||||
if (GETPOST($key)) {
|
||||
$amounts[$expensereport->fk_user_author] = price2num(GETPOST($key));
|
||||
$total += price2num(GETPOST($key));
|
||||
$amounts[$expensereport->fk_user_author] = (float) price2num(GETPOST($key));
|
||||
// $total += price2num(GETPOST($key));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -109,8 +109,9 @@ if ($action == 'add_payment') {
|
||||
$payment = new PaymentExpenseReport($db);
|
||||
$payment->fk_expensereport = $expensereport->id;
|
||||
$payment->datep = $datepaid;
|
||||
$payment->amounts = $amounts; // Tableau de montant
|
||||
$payment->total = $total;
|
||||
$payment->amounts = $amounts; // array of amounts
|
||||
// total is calculated in class
|
||||
// $payment->total = $total;
|
||||
$payment->fk_typepayment = GETPOSTINT("fk_typepayment");
|
||||
$payment->num_payment = GETPOST("num_payment", 'alphanohtml');
|
||||
$payment->note_public = GETPOST("note_public", 'restricthtml');
|
||||
|
||||
Reference in New Issue
Block a user