diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 55b851c12de..e3610846bdd 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -2640,12 +2640,6 @@ parameters: count: 2 path: ../../htdocs/asset/class/assetmodel.class.php - - - message: '#^Property AssetModel\:\:\$fields \(array\\|string, position\: int, notnull\?\: int, visible\: int\<\-2, 5\>\|string, noteditable\?\: int\<0, 1\>, default\?\: string, \.\.\.\}\>\) does not accept default value of type array\{rowid\: array\{type\: ''integer'', label\: ''TechnicalID'', enabled\: 1, position\: 1, notnull\: 1, visible\: 0, noteditable\: 1, index\: 1, \.\.\.\}, ref\: array\{type\: ''varchar\(128\)'', label\: ''Ref'', enabled\: 1, position\: 20, notnull\: 1, visible\: 1, index\: 1, searchall\: 1, \.\.\.\}, label\: array\{type\: ''varchar\(255\)'', label\: ''Label'', enabled\: 1, position\: 30, notnull\: 1, visible\: 1, searchall\: 1, css\: ''minwidth300'', \.\.\.\}, asset_type\: array\{type\: ''smallint'', label\: ''AssetType'', enabled\: 1, position\: 40, notnull\: 1, visible\: 1, arrayofkeyval\: array\{''AssetTypeIntangible'', ''AssetTypeTangible'', ''AssetTypeInProgress'', ''AssetTypeFinancial''\}, validate\: 1\}, note_public\: array\{type\: ''html'', label\: ''NotePublic'', enabled\: 1, position\: 300, notnull\: 0, visible\: 0, validate\: 1\}, note_private\: array\{type\: ''html'', label\: ''NotePrivate'', enabled\: 1, position\: 301, notnull\: 0, visible\: 0, validate\: 1\}, date_creation\: array\{type\: ''datetime'', label\: ''DateCreation'', enabled\: 1, position\: 500, notnull\: 1, visible\: \-2\}, tms\: array\{type\: ''timestamp'', label\: ''DateModification'', enabled\: 1, position\: 501, notnull\: 0, visible\: \-2\}, \.\.\.\}\.$#' - identifier: property.defaultValue - count: 1 - path: ../../htdocs/asset/class/assetmodel.class.php - - message: '#^Property AssetModel\:\:\$status \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -6732,42 +6726,6 @@ parameters: count: 2 path: ../../htdocs/compta/paiement.php - - - message: '#^Variable \$multicurrency_creditnotes might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/paiement.php - - - - message: '#^Variable \$multicurrency_deposits might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/paiement.php - - - - message: '#^Variable \$multicurrency_payment might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/paiement.php - - - - message: '#^Variable \$multicurrency_remaintopay might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../htdocs/compta/paiement.php - - - - message: '#^Variable \$sign might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../htdocs/compta/paiement.php - - - - message: '#^Variable \$text might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../htdocs/compta/paiement.php - - message: '#^Variable \$marginInfo might not be defined\.$#' identifier: variable.undefined @@ -6780,12 +6738,6 @@ parameters: count: 2 path: ../../htdocs/compta/paiement/card.php - - - message: '#^Variable \$site_account_payment might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/compta/paiement/card.php - - message: '#^Ternary operator condition is always false\.$#' identifier: ternary.alwaysFalse @@ -6798,12 +6750,6 @@ parameters: count: 3 path: ../../htdocs/compta/paiement/cheque/card.php - - - message: '#^Variable \$paiement might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/compta/paiement/cheque/card.php - - message: '#^Call to function method_exists\(\) with \$this\(RemiseCheque\) and ''LibStatut'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -6984,12 +6930,6 @@ parameters: count: 1 path: ../../htdocs/compta/paiement_charge.php - - - message: '#^Variable \$sumpaid might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../htdocs/compta/paiement_charge.php - - message: '#^Comparison operation "\>" between 1 and 1 is always false\.$#' identifier: greater.alwaysFalse @@ -7002,18 +6942,6 @@ parameters: count: 2 path: ../../htdocs/compta/paiement_vat.php - - - message: '#^Variable \$sumpaid might not be defined\.$#' - identifier: variable.undefined - count: 4 - path: ../../htdocs/compta/paiement_vat.php - - - - message: '#^Variable \$outputlangs might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/payment_vat/card.php - - message: '#^Variable \$sortfield in empty\(\) always exists and is not falsy\.$#' identifier: empty.variable @@ -7026,18 +6954,6 @@ parameters: count: 1 path: ../../htdocs/compta/prelevement/card.php - - - message: '#^Variable \$thirdparty might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/prelevement/card.php - - - - message: '#^Variable \$userSalary might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/prelevement/card.php - - message: '#^Call to function method_exists\(\) with \$this\(BonPrelevement\) and ''LibStatut'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -7134,18 +7050,6 @@ parameters: count: 1 path: ../../htdocs/compta/prelevement/demandes.php - - - message: '#^Variable \$invoicetmpcustomer might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/prelevement/factures.php - - - - message: '#^Variable \$invoicetmpsupplier might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/prelevement/factures.php - - message: '#^Variable \$contextpage in empty\(\) always exists and is not falsy\.$#' identifier: empty.variable @@ -7158,30 +7062,6 @@ parameters: count: 1 path: ../../htdocs/compta/prelevement/orders_list.php - - - message: '#^Variable \$nbignored might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/prelevement/orders_list.php - - - - message: '#^Variable \$nbok might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/compta/prelevement/orders_list.php - - - - message: '#^Variable \$nbtotal might not be defined\.$#' - identifier: variable.undefined - count: 4 - path: ../../htdocs/compta/prelevement/stats.php - - - - message: '#^Variable \$total might not be defined\.$#' - identifier: variable.undefined - count: 4 - path: ../../htdocs/compta/prelevement/stats.php - - message: '#^Offset ''checked'' on array\{label\: ''Date'', checked\: 1\} in empty\(\) always exists and is not falsy\.$#' identifier: empty.offset @@ -7212,40 +7092,16 @@ parameters: count: 1 path: ../../htdocs/compta/resultat/clientfourn.php - - - message: '#^Variable \$builddate might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/resultat/index.php - - message: '#^Variable \$description might not be defined\.$#' identifier: variable.undefined count: 1 path: ../../htdocs/compta/resultat/index.php - - - message: '#^Variable \$name might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/resultat/index.php - - - - message: '#^Variable \$period might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/resultat/index.php - - - - message: '#^Variable \$periodlink might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/resultat/index.php - - message: '#^Variable \$sql might not be defined\.$#' identifier: variable.undefined - count: 6 + count: 5 path: ../../htdocs/compta/resultat/index.php - @@ -7260,18 +7116,6 @@ parameters: count: 1 path: ../../htdocs/compta/resultat/result.php - - - message: '#^Variable \$builddate might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/resultat/result.php - - - - message: '#^Variable \$calcmode might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/resultat/result.php - - message: '#^Variable \$code might not be defined\.$#' identifier: variable.undefined @@ -7284,18 +7128,6 @@ parameters: count: 1 path: ../../htdocs/compta/resultat/result.php - - - message: '#^Variable \$name might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/resultat/result.php - - - - message: '#^Variable \$period might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/resultat/result.php - - message: '#^Variable \$sommes in empty\(\) always exists and is not falsy\.$#' identifier: empty.variable @@ -7506,30 +7338,12 @@ parameters: count: 1 path: ../../htdocs/compta/stats/cabyprodserv.php - - - message: '#^Variable \$builddate might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/stats/cabyprodserv.php - - - - message: '#^Variable \$calcmode might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/stats/cabyprodserv.php - - message: '#^Variable \$description might not be defined\.$#' identifier: variable.undefined count: 1 path: ../../htdocs/compta/stats/cabyprodserv.php - - - message: '#^Variable \$name might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/stats/cabyprodserv.php - - message: '#^Variable \$searchCategorySocieteList in empty\(\) always exists and is not falsy\.$#' identifier: empty.variable @@ -7560,30 +7374,12 @@ parameters: count: 1 path: ../../htdocs/compta/stats/cabyuser.php - - - message: '#^Variable \$builddate might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/stats/cabyuser.php - - - - message: '#^Variable \$calcmode might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/stats/cabyuser.php - - message: '#^Variable \$description might not be defined\.$#' identifier: variable.undefined count: 1 path: ../../htdocs/compta/stats/cabyuser.php - - - message: '#^Variable \$name might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/stats/cabyuser.php - - message: '#^Variable \$sql might not be defined\.$#' identifier: variable.undefined @@ -7596,30 +7392,12 @@ parameters: count: 1 path: ../../htdocs/compta/stats/casoc.php - - - message: '#^Variable \$builddate might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/stats/casoc.php - - - - message: '#^Variable \$calcmode might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/stats/casoc.php - - message: '#^Variable \$description might not be defined\.$#' identifier: variable.undefined count: 1 path: ../../htdocs/compta/stats/casoc.php - - - message: '#^Variable \$name might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/stats/casoc.php - - message: '#^Variable \$sql might not be defined\.$#' identifier: variable.undefined @@ -7638,18 +7416,6 @@ parameters: count: 1 path: ../../htdocs/compta/stats/index.php - - - message: '#^Variable \$name might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/stats/index.php - - - - message: '#^Variable \$periodlink might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/stats/index.php - - message: '#^Variable \$sql might not be defined\.$#' identifier: variable.undefined @@ -7668,18 +7434,6 @@ parameters: count: 1 path: ../../htdocs/compta/stats/supplier_turnover.php - - - message: '#^Variable \$name might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/stats/supplier_turnover.php - - - - message: '#^Variable \$periodlink might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/stats/supplier_turnover.php - - message: '#^Variable \$sql might not be defined\.$#' identifier: variable.undefined @@ -7692,30 +7446,12 @@ parameters: count: 1 path: ../../htdocs/compta/stats/supplier_turnover_by_prodserv.php - - - message: '#^Variable \$calcmode might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/stats/supplier_turnover_by_prodserv.php - - message: '#^Variable \$description might not be defined\.$#' identifier: variable.undefined count: 1 path: ../../htdocs/compta/stats/supplier_turnover_by_prodserv.php - - - message: '#^Variable \$name might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/stats/supplier_turnover_by_prodserv.php - - - - message: '#^Variable \$q might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/stats/supplier_turnover_by_prodserv.php - - message: '#^Variable \$result might not be defined\.$#' identifier: variable.undefined @@ -7746,24 +7482,12 @@ parameters: count: 1 path: ../../htdocs/compta/stats/supplier_turnover_by_thirdparty.php - - - message: '#^Variable \$calcmode might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/stats/supplier_turnover_by_thirdparty.php - - message: '#^Variable \$description might not be defined\.$#' identifier: variable.undefined count: 1 path: ../../htdocs/compta/stats/supplier_turnover_by_thirdparty.php - - - message: '#^Variable \$name might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/stats/supplier_turnover_by_thirdparty.php - - message: '#^Variable \$result might not be defined\.$#' identifier: variable.undefined @@ -7794,18 +7518,6 @@ parameters: count: 1 path: ../../htdocs/compta/tva/card.php - - - message: '#^Variable \$accountline might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/compta/tva/card.php - - - - message: '#^Variable \$resteapayer might not be defined\.$#' - identifier: variable.undefined - count: 4 - path: ../../htdocs/compta/tva/card.php - - message: '#^Property PaymentVAT\:\:\$amount \(float\|int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -8280,12 +7992,6 @@ parameters: count: 1 path: ../../htdocs/contact/consumption.php - - - message: '#^Variable \$documentstaticline might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/contact/consumption.php - - message: '#^Variable \$newlang in empty\(\) always exists and is always falsy\.$#' identifier: empty.variable @@ -8952,12 +8658,6 @@ parameters: count: 2 path: ../../htdocs/core/actions_massactions.inc.php - - - message: '#^Variable \$pagecount might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/actions_massactions.inc.php - - message: '#^Variable \$permissiontoadd might not be defined\.$#' identifier: variable.undefined @@ -9036,12 +8736,6 @@ parameters: count: 1 path: ../../htdocs/core/actions_sendmails.inc.php - - - message: '#^Variable \$sendtosocid might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/actions_sendmails.inc.php - - message: '#^Variable \$thirdparty might not be defined\.$#' identifier: variable.undefined @@ -9126,12 +8820,6 @@ parameters: count: 1 path: ../../htdocs/core/ajax/ajaxdirpreview.php - - - message: '#^Property User\:\:\$lastname \(string\) does not accept int\.$#' - identifier: assign.propertyType - count: 1 - path: ../../htdocs/core/ajax/ajaxdirtree.php - - message: '#^Variable \$action might not be defined\.$#' identifier: variable.undefined @@ -9144,12 +8832,6 @@ parameters: count: 2 path: ../../htdocs/core/ajax/ajaxdirtree.php - - - message: '#^Variable \$fullpathpreopened might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/ajax/ajaxdirtree.php - - message: '#^Variable \$module might not be defined\.$#' identifier: variable.undefined @@ -9222,12 +8904,6 @@ parameters: count: 1 path: ../../htdocs/core/ajax/selectobject.php - - - message: '#^Variable \$objecttmp might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../htdocs/core/ajax/selectobject.php - - message: '#^Constructor of class box_accountancy_last_manual_entries has an unused parameter \$param\.$#' identifier: constructor.unusedParameter @@ -24618,48 +24294,6 @@ parameters: count: 1 path: ../../htdocs/knowledgemanagement/knowledgerecord_list.php - - - message: '#^Variable \$staytopay might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../htdocs/loan/card.php - - - - message: '#^Call to function method_exists\(\) with \$this\(Loan\) and ''LibStatut'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../htdocs/loan/class/loan.class.php - - - - message: '#^Call to function method_exists\(\) with \$this\(Loan\) and ''getNomUrl'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../htdocs/loan/class/loan.class.php - - - - message: '#^Call to function property_exists\(\) with \$this\(Loan\) and ''capital'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../htdocs/loan/class/loan.class.php - - - - message: '#^Call to function property_exists\(\) with \$this\(Loan\) and ''dateend'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../htdocs/loan/class/loan.class.php - - - - message: '#^Call to function property_exists\(\) with \$this\(Loan\) and ''datestart'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../htdocs/loan/class/loan.class.php - - - - message: '#^Parameter \#2 \$alreadypaid of method Loan\:\:getLibStatut\(\) expects int, float given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/loan/class/loan.class.php - - message: '#^Property Loan\:\:\$account_capital \(string\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -34038,12 +33672,6 @@ parameters: count: 3 path: ../../htdocs/takepos/pay.php - - - message: '#^Variable \$servicestatus might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../htdocs/takepos/pay.php - - message: '#^Variable \$stripeacc might not be defined\.$#' identifier: variable.undefined diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index 3b62584644b..413f32e1257 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -75,6 +75,7 @@ $object = new Loan($db); $permissiontoadd = $user->hasRight('loan', 'write'); $error = 0; +$staytopay = 0; /* diff --git a/htdocs/loan/class/loan.class.php b/htdocs/loan/class/loan.class.php index 97c87aaf641..a764f141a90 100644 --- a/htdocs/loan/class/loan.class.php +++ b/htdocs/loan/class/loan.class.php @@ -526,7 +526,7 @@ class Loan extends CommonObject * Return label of loan status (unpaid, paid) * * @param int $mode 0=label, 1=short label, 2=Picto + Short label, 3=Picto, 4=Picto + Label - * @param integer $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommend to put here amount paid if you have it, 1 otherwise) + * @param float $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommend to put here amount paid if you have it, 1 otherwise) * @return string Label */ public function getLibStatut($mode = 0, $alreadypaid = -1) @@ -540,7 +540,7 @@ class Loan extends CommonObject * * @param int $status Id status * @param int $mode 0=Label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Label, 5=Short label + Picto - * @param integer $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommend to put here amount paid if you have it, 1 otherwise) + * @param float $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommend to put here amount paid if you have it, 1 otherwise) * @return string Label */ public function LibStatut($status, $mode = 0, $alreadypaid = -1) @@ -606,6 +606,12 @@ class Loan extends CommonObject if (!empty($this->label)) { $label .= '
'.$langs->trans('Label').': '.$this->label; } + if (isDolTms($this->datestart)) { + $label .= '
'.$langs->trans("DateStart").': '.dol_print_date($this->datestart, 'day'); + } + if (isDolTms($this->dateend)) { + $label .= '
'.$langs->trans("DateEnd").': '.dol_print_date($this->dateend, 'day'); + } $url = DOL_URL_ROOT.'/loan/card.php?id='.$this->id; @@ -775,26 +781,25 @@ class Loan extends CommonObject $return .= img_picto('', $this->picto); $return .= ''; $return .= '
'; - $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; + $return .= ''.$this->getNomUrl(1).''; if ($selected >= 0) { $return .= ''; } - if (property_exists($this, 'capital')) { + if (!empty($this->capital)) { $return .= ' | '.$langs->trans("Amount").' : '.price($this->capital).''; } - if (property_exists($this, 'datestart')) { - $return .= '
'.$langs->trans("DateStart").' : '.dol_print_date($this->db->jdate($this->datestart), 'day').''; + if (isDolTms($this->datestart)) { + $return .= '
'.$langs->trans("DateStart").' : '.dol_print_date($this->datestart, 'day').''; } - if (property_exists($this, 'dateend')) { - $return .= '
'.$langs->trans("DateEnd").' : '.dol_print_date($this->db->jdate($this->dateend), 'day').''; + if (isDolTms($this->dateend)) { + $return .= '
'.$langs->trans("DateEnd").' : '.dol_print_date($this->dateend, 'day').''; } - if (method_exists($this, 'LibStatut')) { - $return .= '
'.$this->getLibStatut(3, $this->alreadypaid).'
'; - } + $return .= '
'.$this->getLibStatut(3, $this->alreadypaid).'
'; $return .= '
'; $return .= ''; $return .= ''; + return $return; } } diff --git a/htdocs/loan/list.php b/htdocs/loan/list.php index f2fa046923b..e0dd7cb4b98 100644 --- a/htdocs/loan/list.php +++ b/htdocs/loan/list.php @@ -417,7 +417,8 @@ while ($i < $imaxinloop) { $object->ref = $obj->rowid; $object->label = $obj->label; $object->paid = $obj->paid; - + $object->datestart= $db->jdate($obj->datestart); + $object->dateend = $db->jdate($obj->dateend); if ($mode == 'kanban') { if ($i == 0) { @@ -425,8 +426,6 @@ while ($i < $imaxinloop) { print '
'; } // Output Kanban - $object->datestart= $obj->datestart; - $object->dateend = $obj->dateend; $object->capital = $obj->capital; $object->totalpaid = $obj->paid;