From 7d3c1767273cced5da49c75bc65d9c1cefe64b8a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 17 Jun 2020 12:45:56 +0200 Subject: [PATCH] Prepare convertion of field "montant" into "amount" --- htdocs/accountancy/bookkeeping/card.php | 15 +++++++---- htdocs/accountancy/bookkeeping/list.php | 5 ++-- .../accountancy/class/bookkeeping.class.php | 6 +++++ htdocs/cashdesk/affContenu.php | 2 +- htdocs/cashdesk/class/Facturation.class.php | 26 +++++++++---------- htdocs/cashdesk/facturation.php | 4 +-- htdocs/cashdesk/tpl/facturation1.tpl.php | 2 +- htdocs/cashdesk/tpl/ticket.tpl.php | 6 ++--- htdocs/cashdesk/tpl/validation1.tpl.php | 14 +++++----- htdocs/cashdesk/validation_verif.php | 24 ++++++++--------- .../box_accountancy_last_manual_entries.php | 4 +-- .../doc/pdf_standard.modules.php | 8 +++--- htdocs/fourn/class/paiementfourn.class.php | 2 +- htdocs/fourn/paiement/card.php | 4 +-- 14 files changed, 67 insertions(+), 55 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 1fcce431b24..3f612b6fffe 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -114,11 +114,13 @@ if ($action == "confirm_update") { $object->credit = $credit; if (floatval($debit) != 0.0) { - $object->montant = $debit; + $object->montant = $debit; // deprecated + $object->amount = $debit; $object->sens = 'D'; } if (floatval($credit) != 0.0) { - $object->montant = $credit; + $object->montant = $credit; // deprecated + $object->amount = $credit; $object->sens = 'C'; } @@ -173,12 +175,14 @@ if ($action == "confirm_update") { $object->fk_docdet = (int) GETPOST('fk_docdet', 'int'); if (floatval($debit) != 0.0) { - $object->montant = $debit; + $object->montant = $debit; // deprecated + $object->amount = $debit; $object->sens = 'D'; } if (floatval($credit) != 0.0) { - $object->montant = $credit; + $object->montant = $credit; // deprecated + $object->amount = $credit; $object->sens = 'C'; } @@ -241,7 +245,8 @@ if ($action == "confirm_update") { $object->journal_label = $journal_label; $object->fk_doc = 0; $object->fk_docdet = 0; - $object->montant = 0; + $object->montant = 0; // deprecated + $object->amount = 0; $result = $object->createStd($user, 0, $mode); if ($result < 0) { diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 3282f7f363f..9a623287fc2 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -412,7 +412,7 @@ $sql .= " t.label_operation,"; $sql .= " t.debit,"; $sql .= " t.credit,"; $sql .= " t.lettering_code,"; -$sql .= " t.montant,"; +$sql .= " t.montant as amount,"; $sql .= " t.sens,"; $sql .= " t.fk_user_author,"; $sql .= " t.import_key,"; @@ -860,7 +860,8 @@ while ($i < min($num, $limit)) $line->label_operation = $obj->label_operation; $line->debit = $obj->debit; $line->credit = $obj->credit; - $line->montant = $obj->montant; + $line->montant = $obj->amount; // deprecated + $line->amount = $obj->amount; $line->sens = $obj->sens; $line->lettering_code = $obj->lettering_code; $line->fk_user_author = $obj->fk_user_author; diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 713d5175d31..0e81448fc05 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -129,9 +129,15 @@ class BookKeeping extends CommonObject /** * @var float FEC:Amount (Not necessary) + * @deprecated Use $amount */ public $montant; + /** + * @var float FEC:Amount (Not necessary) + */ + public $amount; + /** * @var string FEC:Sens (Not necessary) */ diff --git a/htdocs/cashdesk/affContenu.php b/htdocs/cashdesk/affContenu.php index 799c95b6b5b..7b513ada33c 100644 --- a/htdocs/cashdesk/affContenu.php +++ b/htdocs/cashdesk/affContenu.php @@ -45,7 +45,7 @@ if (isset($_SESSION['serObjFacturation'])) $obj_facturation->calculTotaux(); // Redefine prix_total_ttc, prix_total_ht et montant_tva from $_SESSION['poscart'] -$total_ttc = $obj_facturation->prixTotalTtc(); +$total_ttc = $obj_facturation->amountWithTax(); /*var_dump($obj_facturation); var_dump($_SESSION['poscart']); diff --git a/htdocs/cashdesk/class/Facturation.class.php b/htdocs/cashdesk/class/Facturation.class.php index 2fc93b0d155..f2223b0b45d 100644 --- a/htdocs/cashdesk/class/Facturation.class.php +++ b/htdocs/cashdesk/class/Facturation.class.php @@ -140,7 +140,7 @@ class Facturation $remise_percent = 0; } $montant_remise_ht = ($resultarray[6] - $resultarray[0]); - $this->montantRemise($montant_remise_ht); + $this->amountDiscount($montant_remise_ht); $newcartarray = $_SESSION['poscart']; @@ -256,7 +256,7 @@ class Facturation $this->qte('RESET'); $this->stock('RESET'); $this->remisePercent('RESET'); - $this->montantRemise('RESET'); + $this->amountDiscount('RESET'); $this->prix('RESET'); $this->tva('RESET'); } @@ -270,13 +270,13 @@ class Facturation { $this->numInvoice('RESET'); $this->getSetPaymentMode('RESET'); - $this->montantEncaisse('RESET'); - $this->montantRendu('RESET'); + $this->amountCollected('RESET'); + $this->amountReturned('RESET'); $this->paiementLe('RESET'); - $this->prixTotalHt('RESET'); - $this->montantTva('RESET'); - $this->prixTotalTtc('RESET'); + $this->amountWithoutTax('RESET'); + $this->amountVat('RESET'); + $this->amountWithTax('RESET'); } @@ -387,7 +387,7 @@ class Facturation * @param int $aMontantRemise Amount * @return string Amount */ - public function montantRemise($aMontantRemise = null) + public function amountDiscount($aMontantRemise = null) { if (is_null($aMontantRemise)) { @@ -475,7 +475,7 @@ class Facturation * @param int $aMontantEncaisse Amount * @return int Amount */ - public function montantEncaisse($aMontantEncaisse = null) + public function amountCollected($aMontantEncaisse = null) { if (is_null($aMontantEncaisse)) { @@ -493,7 +493,7 @@ class Facturation * @param int $aMontantRendu Amount * @return int Amount */ - public function montantRendu($aMontantRendu = null) + public function amountReturned($aMontantRendu = null) { if (is_null($aMontantRendu)) { @@ -528,7 +528,7 @@ class Facturation * @param int $aTotalHt Total amount * @return int Total amount */ - public function prixTotalHt($aTotalHt = null) + public function amountWithoutTax($aTotalHt = null) { if (is_null($aTotalHt)) { return $this->prix_total_ht; @@ -545,7 +545,7 @@ class Facturation * @param int $aMontantTva Amount vat * @return int Amount vat */ - public function montantTva($aMontantTva = null) + public function amountVat($aMontantTva = null) { if (is_null($aMontantTva)) { return $this->montant_tva; @@ -562,7 +562,7 @@ class Facturation * @param int $aTotalTtc Amount ttc * @return int Amount ttc */ - public function prixTotalTtc($aTotalTtc = null) + public function amountWithTax($aTotalTtc = null) { if (is_null($aTotalTtc)) { diff --git a/htdocs/cashdesk/facturation.php b/htdocs/cashdesk/facturation.php index 48032c3e840..e1a42aed012 100644 --- a/htdocs/cashdesk/facturation.php +++ b/htdocs/cashdesk/facturation.php @@ -145,8 +145,8 @@ $i = 0; // Reinitialisation du mode de paiement, en cas de retour aux achats apres validation $obj_facturation->getSetPaymentMode('RESET'); -$obj_facturation->montantEncaisse('RESET'); -$obj_facturation->montantRendu('RESET'); +$obj_facturation->amountCollected('RESET'); +$obj_facturation->amountReturned('RESET'); $obj_facturation->paiementLe('RESET'); diff --git a/htdocs/cashdesk/tpl/facturation1.tpl.php b/htdocs/cashdesk/tpl/facturation1.tpl.php index 0d81f6e947e..e1dc53ed6e8 100644 --- a/htdocs/cashdesk/tpl/facturation1.tpl.php +++ b/htdocs/cashdesk/tpl/facturation1.tpl.php @@ -149,7 +149,7 @@ for ($i = 0; $i < $nbtoshow; $i++) trans("TotalTicket"); ?>trans("Received"); ?>trans("Change"); ?> - + diff --git a/htdocs/cashdesk/tpl/ticket.tpl.php b/htdocs/cashdesk/tpl/ticket.tpl.php index 8c97796f430..b5994456252 100644 --- a/htdocs/cashdesk/tpl/ticket.tpl.php +++ b/htdocs/cashdesk/tpl/ticket.tpl.php @@ -102,13 +102,13 @@ $object->fetch($facid); - + - + - +
trans("TotalHT"); ?>prixTotalHt(), 'MT'), '', $langs, 0, -1, -1, $conf->currency)."\n"; ?>amountWithoutTax(), 'MT'), '', $langs, 0, -1, -1, $conf->currency)."\n"; ?>
trans("TotalVAT").''.price(price2num($obj_facturation->montantTva(), 'MT'), '', $langs, 0, -1, -1, $conf->currency)."\n"; ?>trans("TotalVAT").''.price(price2num($obj_facturation->amountVat(), 'MT'), '', $langs, 0, -1, -1, $conf->currency)."\n"; ?>
trans("TotalTTC").''.price(price2num($obj_facturation->prixTotalTtc(), 'MT'), '', $langs, 0, -1, -1, $conf->currency)."\n"; ?>trans("TotalTTC").''.price(price2num($obj_facturation->amountWithTax(), 'MT'), '', $langs, 0, -1, -1, $conf->currency)."\n"; ?>
diff --git a/htdocs/cashdesk/tpl/validation1.tpl.php b/htdocs/cashdesk/tpl/validation1.tpl.php index 6fe42b35aa4..0434473d359 100644 --- a/htdocs/cashdesk/tpl/validation1.tpl.php +++ b/htdocs/cashdesk/tpl/validation1.tpl.php @@ -35,16 +35,16 @@ $langs->loadLangs(array("main", "bills", "banks")); - + montantTva()) { - echo (''); +if ($obj_facturation->amountVat()) { + echo (''); } else { echo (''); } ?> - + '); } else { - echo (''); + echo (''); } // Affichage du montant rendu (reglement en especes) -if ($obj_facturation->montantRendu()) { - echo (''); +if ($obj_facturation->amountReturned()) { + echo (''); } ?> diff --git a/htdocs/cashdesk/validation_verif.php b/htdocs/cashdesk/validation_verif.php index b2711479596..3253d6d5d3e 100644 --- a/htdocs/cashdesk/validation_verif.php +++ b/htdocs/cashdesk/validation_verif.php @@ -83,19 +83,19 @@ switch ($action) // Si paiement autre qu'en especes, montant encaisse = prix total $mode_reglement = $obj_facturation->getSetPaymentMode(); if ($mode_reglement != 'ESP') { - $montant = $obj_facturation->prixTotalTtc(); + $montant = $obj_facturation->amountWithTax(); } else { $montant = $_POST['txtEncaisse']; } if ($mode_reglement != 'DIF') { - $obj_facturation->montantEncaisse($montant); + $obj_facturation->amountCollected($montant); //Determination de la somme rendue - $total = $obj_facturation->prixTotalTtc(); - $encaisse = $obj_facturation->montantEncaisse(); + $total = $obj_facturation->amountWithTax(); + $encaisse = $obj_facturation->amountCollected(); - $obj_facturation->montantRendu($encaisse - $total); + $obj_facturation->amountReturned($encaisse - $total); } else { //$txtDatePaiement=$_POST['txtDatePaiement']; $datePaiement = dol_mktime(0, 0, 0, $_POST['txtDatePaiementmonth'], $_POST['txtDatePaiementday'], $_POST['txtDatePaiementyear']); @@ -137,8 +137,8 @@ switch ($action) $mode_reglement_id = dol_getIdFromCode($db, 'LIQ', 'c_paiement', 'code', 'id', 1); $cond_reglement_id = 0; $note .= $langs->trans("Cash")."\n"; - $note .= $langs->trans("Received").' : '.$obj_facturation->montantEncaisse()." ".$conf->currency."\n"; - $note .= $langs->trans("Rendu").' : '.$obj_facturation->montantRendu()." ".$conf->currency."\n"; + $note .= $langs->trans("Received").' : '.$obj_facturation->amountCollected()." ".$conf->currency."\n"; + $note .= $langs->trans("Rendu").' : '.$obj_facturation->amountReturned()." ".$conf->currency."\n"; $note .= "\n"; $note .= '--------------------------------------'."\n\n"; break; @@ -207,9 +207,9 @@ switch ($action) $invoice->date_creation = $now; $invoice->date = $now; $invoice->date_lim_reglement = 0; - $invoice->total_ht = $obj_facturation->prixTotalHt(); - $invoice->total_tva = $obj_facturation->montantTva(); - $invoice->total_ttc = $obj_facturation->prixTotalTtc(); + $invoice->total_ht = $obj_facturation->amountWithoutTax(); + $invoice->total_tva = $obj_facturation->amountVat(); + $invoice->total_ttc = $obj_facturation->amountWithTax(); $invoice->note_private = $note; $invoice->cond_reglement_id = $cond_reglement_id; $invoice->mode_reglement_id = $mode_reglement_id; @@ -295,7 +295,7 @@ switch ($action) $payment = new Paiement($db); $payment->datepaye = $now; $payment->bank_account = $conf_fkaccount; - $payment->amounts[$invoice->id] = $obj_facturation->prixTotalTtc(); + $payment->amounts[$invoice->id] = $obj_facturation->amountWithTax(); $payment->note = $langs->trans("Payment").' '.$langs->trans("Invoice").' '.$obj_facturation->numInvoice(); $payment->paiementid = $invoice->mode_reglement_id; $payment->num_paiement = ''; @@ -316,7 +316,7 @@ switch ($action) if (!$error) { - if ($invoice->total_ttc == $obj_facturation->prixTotalTtc() + if ($invoice->total_ttc == $obj_facturation->amountWithTax() && $obj_facturation->getSetPaymentMode() != 'DIFF') { // We set status to payed diff --git a/htdocs/core/boxes/box_accountancy_last_manual_entries.php b/htdocs/core/boxes/box_accountancy_last_manual_entries.php index 6198c90e663..76c3fa5eb47 100644 --- a/htdocs/core/boxes/box_accountancy_last_manual_entries.php +++ b/htdocs/core/boxes/box_accountancy_last_manual_entries.php @@ -84,7 +84,7 @@ class box_accountancy_last_manual_entries extends ModeleBoxes $sql = "SELECT DISTINCT b.piece_num"; $sql .= ", b.doc_date as date_movement"; $sql .= ", b.label_operation"; - $sql .= ", b.montant"; + $sql .= ", b.montant as amount"; $sql .= ", b.code_journal"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as b"; $sql .= " WHERE b.fk_doc = 0"; @@ -103,7 +103,7 @@ class box_accountancy_last_manual_entries extends ModeleBoxes $date = $this->db->jdate($objp->date_movement); $journal = $objp->code_journal; $label = $objp->label_operation; - $amount = $objp->montant; + $amount = $objp->amount; $bookkeepingstatic->id = $objp->id; $bookkeepingstatic->piece_num = $objp->piece_num; diff --git a/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php index d5ae49114f6..5aeaf6577da 100644 --- a/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php @@ -223,7 +223,7 @@ class pdf_standard extends ModelePDFSuppliersPayments } } - $total = $object->montant; + $total = $object->amount; // Definition of $dir and $file if ($object->specimen) @@ -534,12 +534,12 @@ class pdf_standard extends ModelePDFSuppliersPayments // Total payments $pdf->SetXY($this->page_largeur - $this->marge_droite - 50, $posy); - $pdf->MultiCell(50, 4, price($object->montant), 0, 'R', 1); + $pdf->MultiCell(50, 4, price($object->amount), 0, 'R', 1); $posy += 20; // translate amount $currency = $conf->currency; - $translateinletter = strtoupper(dol_convertToWord($object->montant, $outputlangs, $currency)); + $translateinletter = strtoupper(dol_convertToWord($object->amount, $outputlangs, $currency)); $pdf->SetXY($this->marge_gauche + 50, $posy); $pdf->MultiCell(90, 8, $translateinletter, 0, 'L', 1); $posy += 8; @@ -549,7 +549,7 @@ class pdf_standard extends ModelePDFSuppliersPayments $pdf->MultiCell(150, 4, $object->thirdparty->nom, 0, 'L', 1); $pdf->SetXY($this->page_largeur - $this->marge_droite - 30, $posy); - $pdf->MultiCell(35, 4, str_pad(price($object->montant).' '.$currency, 18, '*', STR_PAD_LEFT), 0, 'R', 1); + $pdf->MultiCell(35, 4, str_pad(price($object->amount).' '.$currency, 18, '*', STR_PAD_LEFT), 0, 'R', 1); $posy += 10; diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php index a2df6ba9b74..ddfc3b1f8a4 100644 --- a/htdocs/fourn/class/paiementfourn.class.php +++ b/htdocs/fourn/class/paiementfourn.class.php @@ -123,7 +123,7 @@ class PaiementFourn extends Paiement $this->bank_account = $obj->fk_account; $this->fk_account = $obj->fk_account; $this->bank_line = $obj->fk_bank; - $this->montant = $obj->amount; + $this->montant = $obj->amount; // deprecated $this->amount = $obj->amount; $this->note = $obj->note; $this->note_private = $obj->note; diff --git a/htdocs/fourn/paiement/card.php b/htdocs/fourn/paiement/card.php index a93d093022c..8801d400afc 100644 --- a/htdocs/fourn/paiement/card.php +++ b/htdocs/fourn/paiement/card.php @@ -189,7 +189,7 @@ if ($result > 0) // Payment mode $labeltype = $langs->trans("PaymentType".$object->type_code) != ("PaymentType".$object->type_code) ? $langs->trans("PaymentType".$object->type_code) : $object->type_label; print ''; // Payment numero @@ -200,7 +200,7 @@ if ($result > 0) */ // Amount - print ''; + print ''; if (!empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) {
trans("Invoice"); ?>numInvoice(); ?>
trans("TotalHT"); ?>prixTotalHt(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency); ?>
trans("TotalHT"); ?>amountWithoutTax(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency); ?>
'.$langs->trans("VAT").''.price(price2num($obj_facturation->montantTva(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency).'
'.$langs->trans("VAT").''.price(price2num($obj_facturation->amountVat(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency).'
'.$langs->trans("VAT").''.$langs->trans("NoVAT").'
trans("TotalTTC"); ?> prixTotalTtc(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency); ?>
trans("TotalTTC"); ?> amountWithTax(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency); ?>
trans("PaymentMode"); ?> getSetPaymentMode()) @@ -85,12 +85,12 @@ if ($obj_facturation->montantTva()) { if ($obj_facturation->getsetPaymentMode() == 'DIF') { echo ('
'.$langs->trans("DateDue").''.$obj_facturation->paiementLe().'
'.$langs->trans("Received").''.price(price2num($obj_facturation->montantEncaisse(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency).'
'.$langs->trans("Received").''.price(price2num($obj_facturation->amountCollected(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency).'
'.$langs->trans("Change").''.price(price2num($obj_facturation->montantRendu(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency).'
'.$langs->trans("Change").''.price(price2num($obj_facturation->amountReturned(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency).'
'.$langs->trans('PaymentMode').''.$labeltype; - print $object->num_paiement ? ' - '.$object->num_paiement : ''; + print $object->num_payment ? ' - '.$object->num_payment : ''; print '
'.$langs->trans('Amount').''.price($object->montant, '', $langs, 0, 0, -1, $conf->currency).'
'.$langs->trans('Amount').''.price($object->amount, '', $langs, 0, 0, -1, $conf->currency).'