rename get_allprev_progress to getAllPrevProgress (#30077)

* fix phpstan

* fix phpstan

* add token

* fix

* add replace

* Update facture.class.php

* Update factureligne.class.php

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
Frédéric FRANCE 2024-09-28 11:10:57 +02:00 committed by GitHub
parent 84183adaaa
commit affdfd304f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 17 additions and 18 deletions

View file

@ -1991,8 +1991,7 @@ if (empty($reshook)) {
$line->fk_prev_id = $line->id;
$line->fetch_optionals();
if (getDolGlobalInt('INVOICE_USE_SITUATION') == 2) {
$line->situation_percent = $line->get_allprev_progress($object->id);
; // get good progress including credit note
$line->situation_percent = $line->getAllPrevProgress($object->id); // get good progress including credit note
} else {
$line->situation_percent = $line->get_prev_progress($object->id); // get good progress including credit note
}
@ -2745,7 +2744,7 @@ if (empty($reshook)) {
// Invoice situation
if (getDolGlobalInt('INVOICE_USE_SITUATION') == 2) {
$previousprogress = $line->get_allprev_progress($line->fk_facture);
$previousprogress = $line->getAllPrevProgress($line->fk_facture);
$fullprogress = price2num(GETPOST('progress', 'alpha'));
if ($fullprogress < $previousprogress) {
@ -2872,7 +2871,7 @@ if (empty($reshook)) {
$all_progress = GETPOSTINT('all_progress');
foreach ($object->lines as $line) {
if (getDolGlobalInt('INVOICE_USE_SITUATION') == 2) {
$percent = $line->get_allprev_progress($object->id);
$percent = $line->getAllPrevProgress($object->id);
} else {
$percent = $line->get_prev_progress($object->id);
}

View file

@ -3624,7 +3624,7 @@ class Facture extends CommonInvoice
$line = $this->lines[$i];
'@phan-var-force FactureLigne $line';
if (getDolGlobalInt('INVOICE_USE_SITUATION') == 2) {
$previousprogress = $line->get_allprev_progress($line->fk_facture);
$previousprogress = $line->getAllPrevProgress($line->fk_facture);
$current_progress = (float) $line->situation_percent;
$full_progress = $previousprogress + $current_progress;
$final = ($full_progress == 100);
@ -4394,7 +4394,7 @@ class Facture extends CommonInvoice
$percent = 100;
}
if (getDolGlobalInt('INVOICE_USE_SITUATION') == 2) {
$previous_progress = $line->get_allprev_progress($line->fk_facture);
$previous_progress = $line->getAllPrevProgress($line->fk_facture);
$current_progress = $percent - $previous_progress;
$line->situation_percent = $current_progress;
$tabprice = calcul_price_total($line->qty, $line->subprice, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 0, 'HT', 0, $line->product_type, $mysoc, array(), $current_progress);

View file

@ -890,7 +890,7 @@ class FactureLigne extends CommonInvoiceLine
* @return float >= 0
* @see get_prev_progress()
*/
public function get_allprev_progress($invoiceid, $include_credit_note = true)
public function getAllPrevProgress($invoiceid, $include_credit_note = true)
{
// phpcs:enable
global $invoicecache;

View file

@ -231,7 +231,7 @@ abstract class CommonInvoice extends CommonObject
$alreadypaid += $this->getSumCreditNotesUsed($multicurrency);
$remaintopay = price2num($this->total_ttc - $alreadypaid, 'MT');
if ($this->statut == self::STATUS_CLOSED && $this->close_code == 'discount_vat') { // If invoice closed with discount for anticipated payment
if ($this->status == self::STATUS_CLOSED && $this->close_code == 'discount_vat') { // If invoice closed with discount for anticipated payment
$remaintopay = 0.0;
}
return $remaintopay;
@ -560,7 +560,7 @@ abstract class CommonInvoice extends CommonObject
// We check if invoice is a temporary number (PROVxxxx)
$tmppart = substr($this->ref, 1, 4);
if ($this->statut == self::STATUS_DRAFT && $tmppart === 'PROV') { // If draft invoice and ref not yet defined
if ($this->status == self::STATUS_DRAFT && $tmppart === 'PROV') { // If draft invoice and ref not yet defined
return 1;
}
@ -779,7 +779,7 @@ abstract class CommonInvoice extends CommonObject
*/
public function getLibStatut($mode = 0, $alreadypaid = -1)
{
return $this->LibStatut($this->paye, $this->statut, $mode, $alreadypaid, $this->type);
return $this->LibStatut($this->paye, $this->status, $mode, $alreadypaid, $this->type);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps

View file

@ -5,10 +5,10 @@
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* 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) 2022 OpenDSI <support@open-dsi.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -304,7 +304,7 @@ $coldisplay++;
$coldisplay++;
if (getDolGlobalInt('INVOICE_USE_SITUATION') == 2) {
$tmp_fieldv = (GETPOSTISSET('progress') ? GETPOST('progress') : $line->situation_percent);
$old_fieldv = $line->get_allprev_progress($line->fk_facture);
$old_fieldv = $line->getAllPrevProgress($line->fk_facture);
$fieldv = $tmp_fieldv + $old_fieldv;
print '<td class="nowrap right linecolcycleref"><input class="right" type="text" size="1" value="'.$fieldv.'" name="progress">%</td>';

View file

@ -7,9 +7,9 @@
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2017 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2022 OpenDSI <support@open-dsi.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -388,7 +388,7 @@ if (isset($this->situation_cycle_ref) && $this->situation_cycle_ref) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
$coldisplay++;
if (getDolGlobalInt('INVOICE_USE_SITUATION') == 2) {
$previous_progress = $line->get_allprev_progress($object->id);
$previous_progress = $line->getAllPrevProgress($object->id);
$current_progress = $previous_progress + floatval($line->situation_percent);
print '<td class="linecolcycleref nowrap right">'.$current_progress.'%</td>';
$coldisplay++;