fix phpstan phpdoc (#31587)

* fix phpstan phpdoc

* fix phpstan phpdoc

* fix phpstan phpdoc

* fix phpstan phpdoc

* fix phpstan phpdoc

* fix phpstan phpdoc
This commit is contained in:
Frédéric FRANCE 2024-10-28 00:40:01 +01:00 committed by GitHub
parent 10935d4fc4
commit e771bbfbe1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 116 additions and 33 deletions

View file

@ -1,10 +1,10 @@
<?php
/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2016-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2016-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.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
@ -39,6 +39,11 @@ class ChargeSociales extends CommonObject
*/
public $element = 'chargesociales';
/**
* @var string Name of table without prefix where object is stored
* @deprecated Use $table_element
* @see $table_element
*/
public $table = 'chargesociales';
/**
@ -65,18 +70,22 @@ class ChargeSociales extends CommonObject
* @var string label
*/
public $label;
/**
* @var int
*/
public $type;
/**
* @var string
*/
public $type_label;
/**
* @var string
*/
public $type_code;
/**
* @var string
*/
@ -86,15 +95,18 @@ class ChargeSociales extends CommonObject
* @var int|string
*/
public $amount;
/**
* @var int<0,1>
*/
public $paye;
/**
* @deprecated Use $period
* @var int|string
*/
public $periode;
/**
* @var int|string
*/
@ -102,7 +114,7 @@ class ChargeSociales extends CommonObject
/**
* @var string
* @deprecated Use label instead
* @deprecated Use $label instead
*/
public $lib;
@ -125,10 +137,12 @@ class ChargeSociales extends CommonObject
* @var int ID
*/
public $mode_reglement_id;
/**
* @var string
*/
public $mode_reglement_code;
/**
* @var string
*/
@ -154,8 +168,14 @@ class ChargeSociales extends CommonObject
*/
public $totalpaid;
/**
* @var int
*/
const STATUS_UNPAID = 0;
/**
* @var int
*/
const STATUS_PAID = 1;

View file

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2014-2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
* Copyright (C) 2015-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2020 Maxime DEMAREST <maxime@indelog.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
@ -108,8 +108,8 @@ if (empty($reshook)) {
if (!$cancel) {
$datestart = dol_mktime(12, 0, 0, GETPOSTINT('startmonth'), GETPOSTINT('startday'), GETPOSTINT('startyear'));
$dateend = dol_mktime(12, 0, 0, GETPOSTINT('endmonth'), GETPOSTINT('endday'), GETPOSTINT('endyear'));
$capital = price2num(GETPOST('capital'));
$rate = price2num(GETPOST('rate'));
$capital = (float) price2num(GETPOST('capital'));
$rate = (float) price2num(GETPOST('rate'));
if (!$capital) {
$error++;
@ -138,7 +138,7 @@ if (empty($reshook)) {
$object->capital = $capital;
$object->datestart = $datestart;
$object->dateend = $dateend;
$object->nbterm = GETPOST('nbterm');
$object->nbterm = (float) price2num(GETPOST('nbterm'));
$object->rate = $rate;
$object->note_private = GETPOST('note_private', 'restricthtml');
$object->note_public = GETPOST('note_public', 'restricthtml');
@ -183,7 +183,7 @@ if (empty($reshook)) {
$datestart = dol_mktime(12, 0, 0, GETPOSTINT('startmonth'), GETPOSTINT('startday'), GETPOSTINT('startyear'));
$dateend = dol_mktime(12, 0, 0, GETPOSTINT('endmonth'), GETPOSTINT('endday'), GETPOSTINT('endyear'));
$capital = price2num(GETPOST('capital'));
$capital = (float) price2num(GETPOST('capital'));
if (!$capital) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("LoanCapital")), null, 'errors');
@ -192,9 +192,9 @@ if (empty($reshook)) {
$object->datestart = $datestart;
$object->dateend = $dateend;
$object->capital = $capital;
$object->nbterm = GETPOSTINT("nbterm");
$object->rate = price2num(GETPOST("rate", 'alpha'));
$object->insurance_amount = price2num(GETPOSTINT('insurance_amount'));
$object->nbterm = (float) price2num(GETPOSTINT("nbterm"));
$object->rate = (float) price2num(GETPOST("rate", 'alpha'));
$object->insurance_amount = (float) price2num(GETPOSTINT('insurance_amount'));
$accountancy_account_capital = GETPOST('accountancy_account_capital');
$accountancy_account_insurance = GETPOST('accountancy_account_insurance');

View file

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2014-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2015-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
/* Copyright (C) 2014-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2015-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
* it under the terms of the GNU General Public License as published by
@ -35,6 +35,11 @@ class Loan extends CommonObject
*/
public $element = 'loan';
/**
* @var string Name of table without prefix where object is stored
* @deprecated Use $table_element
* @see $table_element
*/
public $table = 'loan';
/**
@ -52,7 +57,14 @@ class Loan extends CommonObject
*/
public $rowid;
/**
* @var int|'' date start
*/
public $datestart;
/**
* @var int|''
*/
public $dateend;
/**
@ -60,17 +72,59 @@ class Loan extends CommonObject
*/
public $label;
/**
* @var float capital
*/
public $capital;
/**
* @var float nb terms
*/
public $nbterm;
/**
* @var float rate
*/
public $rate;
/**
* @var int<0,1> paid
*/
public $paid;
/**
* @var string account_capital
*/
public $account_capital;
/**
* @var string account_insurance
*/
public $account_insurance;
/**
* @var string account_interest
*/
public $account_interest;
/**
* @var string accountancy_account_capital
*/
public $accountancy_account_capital;
/**
* @var string accountancy_account_insurance
*/
public $accountancy_account_insurance;
/**
* @var string accountancy_account_interest
*/
public $accountancy_account_interest;
/**
* @var float insurance amount
*/
public $insurance_amount;
/**
@ -98,8 +152,19 @@ class Loan extends CommonObject
*/
public $totalpaid;
/**
* @var int
*/
const STATUS_UNPAID = 0;
/**
* @var int
*/
const STATUS_PAID = 1;
/**
* @var int
*/
const STATUS_STARTED = 2;
@ -135,11 +200,11 @@ class Loan extends CommonObject
$this->id = $obj->rowid;
$this->ref = $obj->rowid;
$this->datestart = $this->db->jdate($obj->datestart);
$this->dateend = $this->db->jdate($obj->dateend);
$this->label = $obj->label;
$this->capital = $obj->capital;
$this->dateend = $this->db->jdate($obj->dateend);
$this->label = $obj->label;
$this->capital = $obj->capital;
$this->nbterm = $obj->nbterm;
$this->rate = $obj->rate;
$this->rate = $obj->rate;
$this->note_private = $obj->note_private;
$this->note_public = $obj->note_public;
$this->insurance_amount = $obj->insurance_amount;
@ -147,8 +212,8 @@ class Loan extends CommonObject
$this->fk_bank = $obj->fk_bank;
$this->account_capital = $obj->accountancy_account_capital;
$this->account_insurance = $obj->accountancy_account_insurance;
$this->account_interest = $obj->accountancy_account_interest;
$this->account_insurance = $obj->accountancy_account_insurance;
$this->account_interest = $obj->accountancy_account_interest;
$this->fk_project = $obj->fk_project;
$this->db->free($resql);
@ -601,8 +666,6 @@ class Loan extends CommonObject
*/
public function initAsSpecimen()
{
global $user, $langs, $conf;
$now = dol_now();
// Initialise parameters
@ -610,13 +673,13 @@ class Loan extends CommonObject
$this->fk_bank = 1;
$this->label = 'SPECIMEN';
$this->specimen = 1;
$this->account_capital = 16;
$this->account_insurance = 616;
$this->account_interest = 518;
$this->account_capital = '16';
$this->account_insurance = '616';
$this->account_interest = '518';
$this->datestart = $now;
$this->dateend = $now + (3600 * 24 * 365);
$this->note_public = 'SPECIMEN';
$this->capital = 20000;
$this->capital = 20000.80;
$this->nbterm = 48;
$this->rate = 4.3;

View file

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2014-2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2015-2018 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2015-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2020 Maxime DEMAREST <maxime@indelog.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -183,7 +183,7 @@ if ($action == 'add_payment' && $permissiontoadd) {
if (!$error && !empty($line)) {
// If payment values are modified, recalculate schedule
if (($line->amount_capital != $pay_amount_capital) || ($line->amount_insurance != $pay_amount_insurance) || ($line->amount_interest != $pay_amount_interest)) {
$arr_term = loanCalcMonthlyPayment(($pay_amount_capital + $pay_amount_interest), $remaindertopay, ($loan->rate / 100), $echance, $loan->nbterm);
$arr_term = loanCalcMonthlyPayment(($pay_amount_capital + $pay_amount_interest), $remaindertopay, ($loan->rate / 100), $echance, (int) $loan->nbterm);
foreach ($arr_term as $k => $v) {
// Update fk_bank for current line
if ($k == $echance) {