clean code contract class (#35245)
* clean code contract class * clean code contract class * clean code contract class * clean code contract class * clean code contract class * clean code contract class * clean code contract class * clean code contract class * clean code contract class * clean code contract class * clean code contract class * clean code contract class * clean code contract class * clean code contract class * clean code contract class * clean code * clean code * clean code * clean code * clean code * fix typo * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix
This commit is contained in:
parent
1583d69cda
commit
e81d5378cd
67 changed files with 166 additions and 269 deletions
|
|
@ -5418,108 +5418,6 @@ parameters:
|
|||
count: 1
|
||||
path: ../../../htdocs/contrat/card.php
|
||||
|
||||
-
|
||||
message: '#^Call to function method_exists\(\) with \$this\(Contrat\) and ''getLibStatut'' will always evaluate to true\.$#'
|
||||
identifier: function.alreadyNarrowedType
|
||||
count: 1
|
||||
path: ../../../htdocs/contrat/class/contrat.class.php
|
||||
|
||||
-
|
||||
message: '#^Call to function method_exists\(\) with \$this\(Contrat\) and ''getNomUrl'' will always evaluate to true\.$#'
|
||||
identifier: function.alreadyNarrowedType
|
||||
count: 1
|
||||
path: ../../../htdocs/contrat/class/contrat.class.php
|
||||
|
||||
-
|
||||
message: '#^Call to function property_exists\(\) with \$this\(Contrat\) and ''date_contrat'' will always evaluate to true\.$#'
|
||||
identifier: function.alreadyNarrowedType
|
||||
count: 1
|
||||
path: ../../../htdocs/contrat/class/contrat.class.php
|
||||
|
||||
-
|
||||
message: '#^Negated boolean expression is always true\.$#'
|
||||
identifier: booleanNot.alwaysTrue
|
||||
count: 4
|
||||
path: ../../../htdocs/contrat/class/contrat.class.php
|
||||
|
||||
-
|
||||
message: '#^Property CommonObject\:\:\$ref \(string\) in isset\(\) is not nullable\.$#'
|
||||
identifier: isset.property
|
||||
count: 2
|
||||
path: ../../../htdocs/contrat/class/contrat.class.php
|
||||
|
||||
-
|
||||
message: '#^Property CommonObject\:\:\$ref_ext \(string\) in isset\(\) is not nullable\.$#'
|
||||
identifier: isset.property
|
||||
count: 2
|
||||
path: ../../../htdocs/contrat/class/contrat.class.php
|
||||
|
||||
-
|
||||
message: '#^Property Contrat\:\:\$fk_commercial_signature \(int\|string\) in isset\(\) is not nullable\.$#'
|
||||
identifier: isset.property
|
||||
count: 2
|
||||
path: ../../../htdocs/contrat/class/contrat.class.php
|
||||
|
||||
-
|
||||
message: '#^Property Contrat\:\:\$fk_commercial_suivi \(int\|string\) in isset\(\) is not nullable\.$#'
|
||||
identifier: isset.property
|
||||
count: 2
|
||||
path: ../../../htdocs/contrat/class/contrat.class.php
|
||||
|
||||
-
|
||||
message: '#^Property Contrat\:\:\$ref_customer \(string\) in isset\(\) is not nullable\.$#'
|
||||
identifier: isset.property
|
||||
count: 2
|
||||
path: ../../../htdocs/contrat/class/contrat.class.php
|
||||
|
||||
-
|
||||
message: '#^Property Contrat\:\:\$ref_supplier \(string\) in isset\(\) is not nullable\.$#'
|
||||
identifier: isset.property
|
||||
count: 2
|
||||
path: ../../../htdocs/contrat/class/contrat.class.php
|
||||
|
||||
-
|
||||
message: '#^Property Contrat\:\:\$socid \(int\) in isset\(\) is not nullable\.$#'
|
||||
identifier: isset.property
|
||||
count: 1
|
||||
path: ../../../htdocs/contrat/class/contrat.class.php
|
||||
|
||||
-
|
||||
message: '#^Property Contrat\:\:\$status \(int\) in isset\(\) is not nullable\.$#'
|
||||
identifier: isset.property
|
||||
count: 2
|
||||
path: ../../../htdocs/contrat/class/contrat.class.php
|
||||
|
||||
-
|
||||
message: '#^Property Contrat\:\:\$statut \(int\) in isset\(\) is not nullable\.$#'
|
||||
identifier: isset.property
|
||||
count: 1
|
||||
path: ../../../htdocs/contrat/class/contrat.class.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$sql might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 1
|
||||
path: ../../../htdocs/contrat/class/contrat.class.php
|
||||
|
||||
-
|
||||
message: '#^Negated boolean expression is always true\.$#'
|
||||
identifier: booleanNot.alwaysTrue
|
||||
count: 1
|
||||
path: ../../../htdocs/contrat/class/contratligne.class.php
|
||||
|
||||
-
|
||||
message: '#^Offset ''label'' on array\{label\: non\-falsy\-string\} in empty\(\) always exists and is not falsy\.$#'
|
||||
identifier: empty.offset
|
||||
count: 1
|
||||
path: ../../../htdocs/contrat/class/contratligne.class.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$label in empty\(\) always exists and is not falsy\.$#'
|
||||
identifier: empty.variable
|
||||
count: 1
|
||||
path: ../../../htdocs/contrat/class/contratligne.class.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$mesg might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
|
|
|
|||
|
|
@ -1412,14 +1412,14 @@ class AccountancyExport
|
|||
$invoice = new Facture($this->db);
|
||||
$invoice->fetch($line->fk_doc);
|
||||
|
||||
$refInvoice = $invoice->ref;
|
||||
$refInvoice = (string) $invoice->ref;
|
||||
} elseif ($line->doc_type == 'supplier_invoice') {
|
||||
// Supplier invoice
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
$invoice = new FactureFournisseur($this->db);
|
||||
$invoice->fetch($line->fk_doc);
|
||||
|
||||
$refInvoice = $invoice->ref_supplier;
|
||||
$refInvoice = (string) $invoice->ref_supplier;
|
||||
}
|
||||
|
||||
$tab = array();
|
||||
|
|
@ -1632,14 +1632,14 @@ class AccountancyExport
|
|||
$invoice = new Facture($this->db);
|
||||
$invoice->fetch($line->fk_doc);
|
||||
|
||||
$refInvoice = $invoice->ref;
|
||||
$refInvoice = (string) $invoice->ref;
|
||||
} elseif ($line->doc_type == 'supplier_invoice') {
|
||||
// Supplier invoice
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
$invoice = new FactureFournisseur($this->db);
|
||||
$invoice->fetch($line->fk_doc);
|
||||
|
||||
$refInvoice = $invoice->ref_supplier;
|
||||
$refInvoice = (string) $invoice->ref_supplier;
|
||||
}
|
||||
|
||||
$tab = array();
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* Copyright (C) 2013-2021 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2018-2025 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
|
||||
|
|
@ -889,7 +889,7 @@ class AccountingAccount extends CommonObject
|
|||
return -1;
|
||||
}
|
||||
|
||||
$code_l = $accountdeposittoventilated->ref;
|
||||
$code_l = (string) $accountdeposittoventilated->ref;
|
||||
$code_p = '';
|
||||
$code_t = '';
|
||||
$suggestedid = $accountdeposittoventilated->rowid;
|
||||
|
|
@ -908,7 +908,7 @@ class AccountingAccount extends CommonObject
|
|||
} elseif ($type == 'supplier') {
|
||||
$accountdeposittoventilated->fetch(0, getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT'), 1);
|
||||
}
|
||||
$code_l = $accountdeposittoventilated->ref;
|
||||
$code_l = (string) $accountdeposittoventilated->ref;
|
||||
$code_p = '';
|
||||
$code_t = '';
|
||||
$suggestedid = $accountdeposittoventilated->rowid;
|
||||
|
|
|
|||
|
|
@ -279,7 +279,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||
if ($ref == 'PROV') {
|
||||
$numref = $object->getNextNumRef();
|
||||
} else {
|
||||
$numref = $object->ref;
|
||||
$numref = (string) $object->ref;
|
||||
}
|
||||
|
||||
$text = $langs->trans('ConfirmValidateAsset', $numref);
|
||||
|
|
|
|||
|
|
@ -1726,7 +1726,7 @@ class Asset extends CommonObject
|
|||
if (/* !$error && */ (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) { // empty should not happened, but when it occurs, the test save life
|
||||
$num = $this->getNextNumRef();
|
||||
} else {
|
||||
$num = $this->ref;
|
||||
$num = (string) $this->ref;
|
||||
}
|
||||
$this->newref = dol_sanitizeFileName($num);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/* Copyright (C) 2017-2023 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2019-2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2019-2025 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2023 Charlene Benke <charlene@patas-monkey.com>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
|
|
@ -319,7 +319,7 @@ $form = new Form($db);
|
|||
$formfile = new FormFile($db);
|
||||
|
||||
if ($object->id > 0) {
|
||||
$title = $object->ref;
|
||||
$title = (string) $object->ref;
|
||||
} else {
|
||||
$title = $langs->trans('BOM');
|
||||
}
|
||||
|
|
@ -409,7 +409,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||
$object->fetch_product();
|
||||
$numref = $object->getNextNumRef($object->product);
|
||||
} else {
|
||||
$numref = $object->ref;
|
||||
$numref = (string) $object->ref;
|
||||
}
|
||||
|
||||
$text = $langs->trans('ConfirmValidateBom', $numref);
|
||||
|
|
|
|||
|
|
@ -940,7 +940,7 @@ class BOM extends CommonObject
|
|||
$this->fetch_product();
|
||||
$num = $this->getNextNumRef($this->product);
|
||||
} else {
|
||||
$num = $this->ref;
|
||||
$num = (string) $this->ref;
|
||||
}
|
||||
$this->newref = dol_sanitizeFileName($num);
|
||||
|
||||
|
|
|
|||
|
|
@ -26,8 +26,6 @@
|
|||
|
||||
// Put here all includes required by your class file
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
|
||||
//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||
//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
||||
|
||||
/**
|
||||
* Class for Availabilities
|
||||
|
|
@ -556,7 +554,7 @@ class Availabilities extends CommonObject
|
|||
if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) { // empty should not happened, but when it occurs, the test save life
|
||||
$num = $this->getNextNumRef();
|
||||
} else {
|
||||
$num = $this->ref;
|
||||
$num = (string) $this->ref;
|
||||
}
|
||||
$this->newref = $num;
|
||||
|
||||
|
|
|
|||
|
|
@ -510,7 +510,7 @@ class Calendar extends CommonObject
|
|||
if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) { // empty should not happened, but when it occurs, the test save life
|
||||
$num = $this->getNextNumRef();
|
||||
} else {
|
||||
$num = $this->ref;
|
||||
$num = (string) $this->ref;
|
||||
}
|
||||
$this->newref = $num;
|
||||
|
||||
|
|
|
|||
|
|
@ -2926,7 +2926,7 @@ if ($action == 'create') {
|
|||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
} else {
|
||||
$numref = $object->ref;
|
||||
$numref = (string) $object->ref;
|
||||
}
|
||||
|
||||
$text = $langs->trans('ConfirmValidateProp', $numref);
|
||||
|
|
|
|||
|
|
@ -2111,7 +2111,7 @@ class Propal extends CommonObject
|
|||
if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) { // empty should not happened, but when it occurs, the test save life
|
||||
$num = $this->getNextNumRef($soc);
|
||||
} else {
|
||||
$num = $this->ref;
|
||||
$num = (string) $this->ref;
|
||||
}
|
||||
$this->newref = dol_sanitizeFileName($num);
|
||||
|
||||
|
|
|
|||
|
|
@ -2633,7 +2633,7 @@ if ($action == 'create' && $usercancreate) {
|
|||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
} else {
|
||||
$numref = $object->ref;
|
||||
$numref = (string) $object->ref;
|
||||
}
|
||||
|
||||
$text = $langs->trans('ConfirmValidateOrder', $numref);
|
||||
|
|
|
|||
|
|
@ -541,7 +541,7 @@ class Commande extends CommonOrder
|
|||
if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) { // empty should not happened, but when it occurs, the test save life
|
||||
$num = $this->getNextNumRef($soc);
|
||||
} else {
|
||||
$num = $this->ref;
|
||||
$num = (string) $this->ref;
|
||||
}
|
||||
$this->newref = dol_sanitizeFileName($num);
|
||||
|
||||
|
|
|
|||
|
|
@ -4904,7 +4904,7 @@ if ($action == 'create') {
|
|||
$numref = $object->getNextNumRef($soc);
|
||||
// $object->date=$savdate;
|
||||
} else {
|
||||
$numref = $object->ref;
|
||||
$numref = (string) $object->ref;
|
||||
}
|
||||
|
||||
$text = $langs->trans('ConfirmValidateBill', $numref);
|
||||
|
|
|
|||
|
|
@ -3672,7 +3672,7 @@ class Facture extends CommonInvoice
|
|||
}
|
||||
$num = $this->getNextNumRef($this->thirdparty);
|
||||
} else {
|
||||
$num = $this->ref;
|
||||
$num = (string) $this->ref;
|
||||
}
|
||||
|
||||
if (!$num) {
|
||||
|
|
|
|||
|
|
@ -1394,7 +1394,7 @@ if ($action == 'create') {
|
|||
if ($ref == 'PROV' && !empty($modCodeContract->code_auto)) {
|
||||
$numref = $object->getNextNumRef($object->thirdparty);
|
||||
} else {
|
||||
$numref = $object->ref;
|
||||
$numref = (string) $object->ref;
|
||||
}
|
||||
$text = $langs->trans('ConfirmValidateContract', $numref);
|
||||
$formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id, $langs->trans("ValidateAContract"), $text, "confirm_valid", '', 0, 1);
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ class Contrat extends CommonObject
|
|||
|
||||
/**
|
||||
* Customer reference of the contract
|
||||
* @var string
|
||||
* @var ?string
|
||||
*/
|
||||
public $ref_customer;
|
||||
|
||||
|
|
@ -99,7 +99,7 @@ class Contrat extends CommonObject
|
|||
|
||||
/**
|
||||
* Supplier reference of the contract
|
||||
* @var string
|
||||
* @var ?string
|
||||
*/
|
||||
public $ref_supplier;
|
||||
|
||||
|
|
@ -123,13 +123,14 @@ class Contrat extends CommonObject
|
|||
|
||||
/**
|
||||
* Status of the contract
|
||||
* @var int
|
||||
* @var ?int
|
||||
* @deprecated
|
||||
*/
|
||||
public $statut = 0;
|
||||
|
||||
/**
|
||||
* Status of the contract (0=Draft, 1=Validated)
|
||||
* @var int
|
||||
* @var ?int
|
||||
*/
|
||||
public $status = 0;
|
||||
|
||||
|
|
@ -168,28 +169,27 @@ class Contrat extends CommonObject
|
|||
public $date_contrat;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
* @var ?int
|
||||
*/
|
||||
public $commercial_signature_id;
|
||||
/**
|
||||
* @var int|string
|
||||
*/
|
||||
public $fk_commercial_signature;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $commercial_suivi_id;
|
||||
/**
|
||||
* @var int|string
|
||||
*/
|
||||
public $fk_commercial_suivi;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
* @deprecated Use fk_project instead
|
||||
* @see $fk_project
|
||||
* @var ?int
|
||||
* @deprecated
|
||||
*/
|
||||
public $fk_projet;
|
||||
public $fk_commercial_signature;
|
||||
|
||||
/**
|
||||
* @var ?int
|
||||
*/
|
||||
public $commercial_suivi_id;
|
||||
|
||||
/**
|
||||
* @var ?int
|
||||
* @deprecated Use $commercial_suivi_id instead
|
||||
* @see $commercial_suivi_id
|
||||
*/
|
||||
public $fk_commercial_suivi;
|
||||
|
||||
/**
|
||||
* @var array<string,string> (Encoded as JSON in database)
|
||||
|
|
@ -337,6 +337,7 @@ class Contrat extends CommonObject
|
|||
|
||||
$obj = new $classname();
|
||||
'@phan-var-force ModelNumRefContracts $obj';
|
||||
/** @var ModelNumRefContracts $obj */
|
||||
$numref = $obj->getNextValue($soc, $this);
|
||||
|
||||
if ($numref != "") {
|
||||
|
|
@ -548,10 +549,10 @@ class Contrat extends CommonObject
|
|||
// Define new ref
|
||||
if ($force_number) {
|
||||
$num = $force_number;
|
||||
} elseif (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) { // empty should not happened, but when it occurs, the test save life
|
||||
} elseif (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) { // empty should not happened, but when it occurs, the test save life
|
||||
$num = $this->getNextNumRef($this->thirdparty);
|
||||
} else {
|
||||
$num = $this->ref;
|
||||
$num = (string) $this->ref;
|
||||
}
|
||||
$this->newref = dol_sanitizeFileName($num);
|
||||
|
||||
|
|
@ -948,7 +949,7 @@ class Contrat extends CommonObject
|
|||
//$line->date_fin_prevue = $this->db->jdate($objp->date_fin_validite);
|
||||
//$line->date_fin_reel = $this->db->jdate($objp->date_cloture);
|
||||
|
||||
$line->rang = $objp->rang;
|
||||
$line->rang = $objp->rang;
|
||||
|
||||
// Retrieve all extrafields for contract line
|
||||
// fetch optionals attributes and labels
|
||||
|
|
@ -1075,7 +1076,8 @@ class Contrat extends CommonObject
|
|||
$result = dol_include_once('/core/modules/contract/'.$module.'.php');
|
||||
if ($result > 0) {
|
||||
$modCodeContract = new $module();
|
||||
'@phan-var-force ModelNumRefContracts $modCodeContrat';
|
||||
'@phan-var-force ModelNumRefContracts $modCodeContract';
|
||||
/** @var ModelNumRefContracts $modCodeContract */
|
||||
|
||||
if (!empty($modCodeContract->code_auto)) {
|
||||
// Force the ref to a draft value if numbering module is an automatic numbering
|
||||
|
|
@ -1088,15 +1090,13 @@ class Contrat extends CommonObject
|
|||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$result = $this->insertExtraFields();
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
$result = $this->insertExtraFields();
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
// Insert business contacts ('SALESREPSIGN','contrat')
|
||||
if (!$error) {
|
||||
if (!$error && !empty($this->commercial_signature_id)) {
|
||||
$result = $this->add_contact($this->commercial_signature_id, 'SALESREPSIGN', 'internal');
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
|
|
@ -1104,7 +1104,7 @@ class Contrat extends CommonObject
|
|||
}
|
||||
|
||||
// Insert business contacts ('SALESREPFOLL','contrat')
|
||||
if (!$error) {
|
||||
if (!$error && !empty($this->commercial_suivi_id)) {
|
||||
$result = $this->add_contact($this->commercial_suivi_id, 'SALESREPFOLL', 'internal');
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
|
|
@ -1117,7 +1117,7 @@ class Contrat extends CommonObject
|
|||
}
|
||||
|
||||
// Add object linked
|
||||
if (!$error && $this->id && !empty($this->linked_objects) && is_array($this->linked_objects)) {
|
||||
if ($this->id && !empty($this->linked_objects) && is_array($this->linked_objects)) {
|
||||
foreach ($this->linked_objects as $origin => $tmp_origin_id) {
|
||||
if (is_array($tmp_origin_id)) { // New behaviour, if linked_object can have several links per type, so is something like array('contract'=>array(id1, id2, ...))
|
||||
foreach ($tmp_origin_id as $origin_id) {
|
||||
|
|
@ -1369,14 +1369,14 @@ class Contrat extends CommonObject
|
|||
if (isset($this->status)) {
|
||||
$this->status = (int) $this->status;
|
||||
}
|
||||
if (isset($this->socid)) {
|
||||
if ((int) $this->socid > 0) {
|
||||
$this->socid = (int) $this->socid;
|
||||
}
|
||||
if (isset($this->fk_commercial_signature)) {
|
||||
$this->fk_commercial_signature = trim($this->fk_commercial_signature);
|
||||
$this->fk_commercial_signature = (int) $this->fk_commercial_signature;
|
||||
}
|
||||
if (isset($this->fk_commercial_suivi)) {
|
||||
$this->fk_commercial_suivi = trim($this->fk_commercial_suivi);
|
||||
$this->fk_commercial_suivi = (int) $this->fk_commercial_suivi;
|
||||
}
|
||||
if (isset($this->note_private)) {
|
||||
$this->note_private = trim($this->note_private);
|
||||
|
|
@ -1487,7 +1487,7 @@ class Contrat extends CommonObject
|
|||
return -1;
|
||||
}
|
||||
|
||||
if ($this->statut >= 0) {
|
||||
if ($this->status >= 0) {
|
||||
// Clean parameters
|
||||
$pu_ht = price2num($pu_ht);
|
||||
$pu_ttc = price2num($pu_ttc);
|
||||
|
|
@ -1640,16 +1640,14 @@ class Contrat extends CommonObject
|
|||
if ($resql) {
|
||||
$contractlineid = $this->db->last_insert_id(MAIN_DB_PREFIX."contratdet");
|
||||
|
||||
if (!$error) {
|
||||
$contractline = new ContratLigne($this->db);
|
||||
$contractline->array_options = $array_options;
|
||||
$contractline->id = $contractlineid;
|
||||
$result = $contractline->insertExtraFields();
|
||||
if ($result < 0) {
|
||||
$this->errors = array_merge($this->errors, $contractline->errors);
|
||||
$this->error = $contractline->error;
|
||||
$error++;
|
||||
}
|
||||
$contractline = new ContratLigne($this->db);
|
||||
$contractline->array_options = $array_options;
|
||||
$contractline->id = $contractlineid;
|
||||
$result = $contractline->insertExtraFields();
|
||||
if ($result < 0) {
|
||||
$this->errors = array_merge($this->errors, $contractline->errors);
|
||||
$this->error = $contractline->error;
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (empty($error)) {
|
||||
|
|
@ -2261,8 +2259,8 @@ class Contrat extends CommonObject
|
|||
/**
|
||||
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
|
||||
*
|
||||
* @param User $user Object user
|
||||
* @param string $mode "inactive" pour services a activer, "expired" pour services expires
|
||||
* @param User $user Object user
|
||||
* @param 'inactive'|'expired'|'active' $mode "inactive" pour services a activer, "expired" pour services expires
|
||||
* @return WorkboardResponse|int Return integer <0 if KO, WorkboardResponse if OK
|
||||
*/
|
||||
public function load_board($user, $mode)
|
||||
|
|
@ -2298,6 +2296,8 @@ class Contrat extends CommonObject
|
|||
$sql .= " AND cd.statut = 4";
|
||||
//$datetouse = dol_now();
|
||||
//$sql.= " AND cd.date_fin_validite < '".$this->db->idate($datetouse)."'";
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
$sql .= " AND c.fk_soc = s.rowid";
|
||||
$sql .= " AND c.entity = ".((int) $conf->entity);
|
||||
|
|
@ -2617,6 +2617,7 @@ class Contrat extends CommonObject
|
|||
|
||||
// Clean data
|
||||
$clonedObj->statut = 0;
|
||||
$clonedObj->status = 0;
|
||||
// Clean extrafields
|
||||
if (is_array($clonedObj->array_options) && count($clonedObj->array_options) > 0) {
|
||||
$extrafields->fetch_name_optionals_label($this->table_element);
|
||||
|
|
@ -2641,6 +2642,7 @@ class Contrat extends CommonObject
|
|||
$obj = getDolGlobalString('CONTRACT_ADDON');
|
||||
$modContract = new $obj();
|
||||
'@phan-var-force ModelNumRefContracts $modContract';
|
||||
/** @var ModelNumRefContracts $modContract */
|
||||
$clonedObj->ref = $modContract->getNextValue($objsoc, $clonedObj);
|
||||
|
||||
// get extrafields so they will be clone
|
||||
|
|
@ -2653,8 +2655,7 @@ class Contrat extends CommonObject
|
|||
$result = $clonedObj->create($user);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
$this->error = $clonedObj->error;
|
||||
$this->errors[] = $clonedObj->error;
|
||||
$this->setErrorsFromObject($clonedObj);
|
||||
} else {
|
||||
// copy external contacts if same company
|
||||
if ($this->socid == $clonedObj->socid) {
|
||||
|
|
@ -2679,8 +2680,8 @@ class Contrat extends CommonObject
|
|||
// Hook of thirdparty module
|
||||
if (is_object($hookmanager)) {
|
||||
$parameters = array(
|
||||
'objFrom' => $this,
|
||||
'clonedObj' => $clonedObj
|
||||
'objFrom' => $this,
|
||||
'clonedObj' => $clonedObj
|
||||
);
|
||||
$action = '';
|
||||
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $clonedObj, $action); // Note that $action and $object may have been modified by some hooks
|
||||
|
|
@ -2916,21 +2917,17 @@ class Contrat extends CommonObject
|
|||
$return .= img_picto('', $this->picto);
|
||||
$return .= '</span>';
|
||||
$return .= '<div class="info-box-content">';
|
||||
$return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>';
|
||||
$return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">' . $this->getNomUrl() . '</span>';
|
||||
if ($selected >= 0) {
|
||||
$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
}
|
||||
if (!empty($arraydata['thirdparty'])) {
|
||||
if (!empty($arraydata['thirdparty']) && $arraydata['thirdparty'] instanceof Societe) {
|
||||
$tmpthirdparty = $arraydata['thirdparty'];
|
||||
'@phan-var-force Societe $tmpthirdparty';
|
||||
$return .= '<br><div class="info-box-label inline-block valignmiddle">'.$tmpthirdparty->getNomUrl(1).'</div>';
|
||||
}
|
||||
if (property_exists($this, 'date_contrat')) {
|
||||
$return .= '<br><span class="opacitymedium valignmiddle">'.$langs->trans("DateContract").' : </span><span class="info-box-label valignmiddle">'.dol_print_date($this->date_contrat, 'day').'</span>';
|
||||
}
|
||||
if (method_exists($this, 'getLibStatut')) {
|
||||
$return .= '<br><div class="info-box-status valignmiddle">'.$this->getLibStatut(7).'</div>';
|
||||
}
|
||||
$return .= '<br><span class="opacitymedium valignmiddle">'.$langs->trans("DateContract").' : </span><span class="info-box-label valignmiddle">'.dol_print_date($this->date_contrat, 'day').'</span>';
|
||||
$return .= '<br><div class="info-box-status valignmiddle">'.$this->getLibStatut(7).'</div>';
|
||||
$return .= '</div>';
|
||||
$return .= '</div>';
|
||||
$return .= '</div>';
|
||||
|
|
|
|||
|
|
@ -395,7 +395,7 @@ class ContratLigne extends CommonObjectLine
|
|||
|
||||
$datas = [];
|
||||
$datas['label'] = $langs->trans("ShowContractOfService").': '.$this->label;
|
||||
if (empty($datas['label'])) {
|
||||
if (empty($this->label)) {
|
||||
$datas['label'] = $this->description;
|
||||
}
|
||||
|
||||
|
|
@ -415,7 +415,7 @@ class ContratLigne extends CommonObjectLine
|
|||
|
||||
$result = '';
|
||||
$label = $langs->trans("ShowContractOfService").': '.$this->label;
|
||||
if (empty($label)) {
|
||||
if (empty($this->label)) {
|
||||
$label = $this->description;
|
||||
}
|
||||
$classfortooltip = 'classfortooltip';
|
||||
|
|
@ -877,12 +877,10 @@ class ContratLigne extends CommonObjectLine
|
|||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'contratdet');
|
||||
|
||||
// Insert of extrafields
|
||||
if (!$error) {
|
||||
$result = $this->insertExtraFields();
|
||||
if ($result < 0) {
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
$result = $this->insertExtraFields();
|
||||
if ($result < 0) {
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!$notrigger) {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2024-2025 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-2025 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
|
||||
|
|
@ -183,6 +183,12 @@ if ($resql) {
|
|||
$colorseries = array();
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
|
||||
/**
|
||||
* @var string $badgeStatus0
|
||||
* @var string $badgeStatus1
|
||||
* @var string $badgeStatus4
|
||||
* @var string $badgeStatus6
|
||||
*/
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder nohover centpercent">';
|
||||
|
|
|
|||
|
|
@ -325,12 +325,12 @@ abstract class CommonObject
|
|||
|
||||
|
||||
/**
|
||||
* @var string The object's reference
|
||||
* @var ?string The object's reference
|
||||
*/
|
||||
public $ref;
|
||||
|
||||
/**
|
||||
* @var string An external reference to the object
|
||||
* @var ?string An external reference to the object
|
||||
*/
|
||||
public $ref_ext;
|
||||
|
||||
|
|
@ -345,7 +345,7 @@ abstract class CommonObject
|
|||
public $ref_next;
|
||||
|
||||
/**
|
||||
* @var string Ref to store on object to save the new ref to use for example when making a validate() of an object
|
||||
* @var ?string Ref to store on object to save the new ref to use for example when making a validate() of an object
|
||||
*/
|
||||
public $newref;
|
||||
|
||||
|
|
@ -2428,7 +2428,7 @@ abstract class CommonObject
|
|||
if ($fieldid == 'rowid') {
|
||||
$sql .= " WHERE te.".$fieldid." < ".((int) $this->id);
|
||||
} else {
|
||||
$sql .= " WHERE te.".$fieldid." < '".$this->db->escape($this->ref)."'"; // ->ref must always be defined (set to id if field does not exists)
|
||||
$sql .= " WHERE te.".$fieldid." < '".$this->db->escape((string) $this->ref)."'"; // ->ref must always be defined (set to id if field does not exists)
|
||||
}
|
||||
if ($restrictiononfksoc == 1 && !$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= " AND sc.fk_user = ".((int) $user->id);
|
||||
|
|
@ -2507,7 +2507,7 @@ abstract class CommonObject
|
|||
if ($fieldid == 'rowid') {
|
||||
$sql .= " WHERE te.".$fieldid." > ".((int) $this->id);
|
||||
} else {
|
||||
$sql .= " WHERE te.".$fieldid." > '".$this->db->escape($this->ref)."'"; // ->ref must always be defined (set to id if field does not exists)
|
||||
$sql .= " WHERE te.".$fieldid." > '".$this->db->escape((string) $this->ref)."'"; // ->ref must always be defined (set to id if field does not exists)
|
||||
}
|
||||
if ($restrictiononfksoc == 1 && !$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= " AND (sc.fk_user = ".((int) $user->id);
|
||||
|
|
|
|||
|
|
@ -326,7 +326,7 @@ class FormTicket
|
|||
$defaultref = $ticketstat->getDefaultRef();
|
||||
|
||||
if ($mode == 'edit') {
|
||||
$defaultref = $object->ref;
|
||||
$defaultref = (string) $object->ref;
|
||||
}
|
||||
print '<tr><td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans("Ref").'</span></td><td>';
|
||||
print '<input type="text" name="ref" value="'.dol_escape_htmltag($defaultref).'">';
|
||||
|
|
|
|||
|
|
@ -1070,7 +1070,7 @@ class Notify
|
|||
}
|
||||
|
||||
// Check notification using fixed email
|
||||
// TODO Move vars NOTIFICATION_FIXEDEMAIL into table llx_notify_def and inclulde the case into previous loop of sql result
|
||||
// TODO Move vars NOTIFICATION_FIXEDEMAIL into table llx_notify_def and include the case into previous loop of sql result
|
||||
if (!$error) {
|
||||
foreach ($conf->global as $key => $val) {
|
||||
$reg = array();
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2023-2025 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2023 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2023-2025 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2023 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
|
||||
|
|
@ -26,8 +26,6 @@
|
|||
|
||||
// Put here all includes required by your class file
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
|
||||
//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||
//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
||||
|
||||
/**
|
||||
* Class for TimeSpent
|
||||
|
|
@ -520,7 +518,7 @@ class TimeSpent extends CommonObject
|
|||
if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) { // empty should not happened, but when it occurs, the test save life
|
||||
$num = $this->getNextNumRef();
|
||||
} else {
|
||||
$num = $this->ref;
|
||||
$num = (string) $this->ref;
|
||||
}
|
||||
$this->newref = $num;
|
||||
|
||||
|
|
@ -556,7 +554,7 @@ class TimeSpent extends CommonObject
|
|||
}
|
||||
|
||||
if (!$error) {
|
||||
$this->oldref = $this->ref;
|
||||
$this->oldref = (string) $this->ref;
|
||||
|
||||
// Rename directory if dir was a temporary ref
|
||||
if (preg_match('/^[\(]?PROV/i', $this->ref)) {
|
||||
|
|
|
|||
|
|
@ -1125,12 +1125,13 @@ class pdf_eagle extends ModelePDFStockTransfer
|
|||
$classname = ucfirst($origin);
|
||||
$linkedobject = new $classname($this->db);
|
||||
'@phan-var-force CommonObject $linkedobject';
|
||||
/** @var CommonObject $linkedobject */
|
||||
$result = $linkedobject->fetch($origin_id);
|
||||
if ($result >= 0) {
|
||||
//$linkedobject->fetchObjectLinked() Get all linked object to the $linkedobject (commonly order) into $linkedobject->linkedObjects
|
||||
|
||||
$pdf->SetFont('', '', $default_font_size - 2);
|
||||
$text = $linkedobject->ref;
|
||||
$text = (string) $linkedobject->ref;
|
||||
if (isset($linkedobject->ref_client) && !empty($linkedobject->ref_client)) {
|
||||
$text .= ' ('.$linkedobject->ref_client.')';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -435,7 +435,7 @@ class Delivery extends CommonObject
|
|||
if (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) { // empty should not happened, but when it occurs, the test save life
|
||||
$numref = $objMod->getNextValue($soc, $this);
|
||||
} else {
|
||||
$numref = $this->ref;
|
||||
$numref = (string) $this->ref;
|
||||
}
|
||||
$this->newref = dol_sanitizeFileName($numref);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2008-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
@ -484,7 +484,7 @@ class EcmDirectory extends CommonObject
|
|||
|
||||
$result = '';
|
||||
//$newref=str_replace('_',' ',$this->ref);
|
||||
$newref = $this->ref;
|
||||
$newref = (string) $this->ref;
|
||||
$label = img_picto('', $this->picto, '', 0, 0, 0, '', 'paddingrightonly') . $langs->trans("ShowECMSection") . ': ' . $newref;
|
||||
$linkclose = '"'.($more ? ' '.$more : '').' title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
|
||||
|
|
|
|||
|
|
@ -2107,7 +2107,7 @@ if ($action == 'create') {
|
|||
if ($objectref == 'PROV') {
|
||||
$numref = $object->getNextNumRef($soc);
|
||||
} else {
|
||||
$numref = $object->ref;
|
||||
$numref = (string) $object->ref;
|
||||
}
|
||||
|
||||
$text = $langs->trans("ConfirmValidateSending", $numref);
|
||||
|
|
|
|||
|
|
@ -990,7 +990,7 @@ class Expedition extends CommonObject
|
|||
if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) { // empty should not happened, but when it occurs, the test save life
|
||||
$numref = $this->getNextNumRef($soc);
|
||||
} elseif (!empty($this->ref)) {
|
||||
$numref = $this->ref;
|
||||
$numref = (string) $this->ref;
|
||||
} else {
|
||||
$numref = "EXP".$this->id;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1349,7 +1349,7 @@ class ExpenseReport extends CommonObject
|
|||
if (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) { // empty should not happened, but when it occurs, the test save life
|
||||
$num = $this->getNextNumRef();
|
||||
} else {
|
||||
$num = $this->ref;
|
||||
$num = (string) $this->ref;
|
||||
}
|
||||
if (empty($num) || $num < 0) {
|
||||
return -1;
|
||||
|
|
|
|||
|
|
@ -1210,7 +1210,7 @@ if ($action == 'create') {
|
|||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
} else {
|
||||
$numref = $object->ref;
|
||||
$numref = (string) $object->ref;
|
||||
}
|
||||
$text = $langs->trans('ConfirmValidateIntervention', $numref);
|
||||
if (isModEnabled('notification')) {
|
||||
|
|
|
|||
|
|
@ -639,7 +639,7 @@ class Fichinter extends CommonObject
|
|||
if ((preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) { // empty should not happened, but when it occurs, the test save life
|
||||
$num = $this->getNextNumRef($this->thirdparty);
|
||||
} else {
|
||||
$num = $this->ref;
|
||||
$num = (string) $this->ref;
|
||||
}
|
||||
$this->newref = dol_sanitizeFileName($num);
|
||||
|
||||
|
|
|
|||
|
|
@ -796,7 +796,7 @@ class CommandeFournisseur extends CommonOrder
|
|||
if (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) { // empty should not happened, but when it occurs, the test save life
|
||||
$num = $this->getNextNumRef($soc);
|
||||
} else {
|
||||
$num = $this->ref;
|
||||
$num = (string) $this->ref;
|
||||
}
|
||||
$this->newref = dol_sanitizeFileName($num);
|
||||
|
||||
|
|
@ -1291,7 +1291,7 @@ class CommandeFournisseur extends CommonOrder
|
|||
if (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) { // empty should not happened, but when it occurs, the test save life
|
||||
$num = $this->getNextNumRef($soc);
|
||||
} else {
|
||||
$num = $this->ref;
|
||||
$num = (string) $this->ref;
|
||||
}
|
||||
$this->newref = dol_sanitizeFileName($num);
|
||||
|
||||
|
|
@ -2964,7 +2964,7 @@ class CommandeFournisseur extends CommonOrder
|
|||
$ref = '';
|
||||
if ($prod->fetch($comclient->lines[$i]->fk_product) > 0) {
|
||||
$label = $prod->label;
|
||||
$ref = $prod->ref;
|
||||
$ref = (string) $prod->ref;
|
||||
}
|
||||
|
||||
$sql = "INSERT INTO ".$this->db->prefix()."commande_fournisseurdet";
|
||||
|
|
|
|||
|
|
@ -1893,7 +1893,7 @@ class FactureFournisseur extends CommonInvoice
|
|||
} elseif (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) { // empty should not happened, but when it occurs, the test save life
|
||||
$num = $this->getNextNumRef($this->thirdparty);
|
||||
} else {
|
||||
$num = $this->ref;
|
||||
$num = (string) $this->ref;
|
||||
}
|
||||
$this->newref = dol_sanitizeFileName($num);
|
||||
|
||||
|
|
|
|||
|
|
@ -1320,7 +1320,7 @@ class ProductFournisseur extends Product
|
|||
$result = '';
|
||||
$label = '';
|
||||
|
||||
$newref = $this->ref;
|
||||
$newref = (string) $this->ref;
|
||||
if ($maxlength) {
|
||||
$newref = dol_trunc($newref, $maxlength, 'middle');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3082,7 +3082,7 @@ if ($action == 'create') {
|
|||
// empty should not happened, but when it occurs, the test save life
|
||||
$numref = $object->getNextNumRef($societe);
|
||||
} else {
|
||||
$numref = $object->ref;
|
||||
$numref = (string) $object->ref;
|
||||
}
|
||||
|
||||
if ($numref < 0) {
|
||||
|
|
|
|||
|
|
@ -789,7 +789,7 @@ class Holiday extends CommonObject
|
|||
if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref) || $this->ref == $this->id)) {
|
||||
$num = $this->getNextNumRef(null);
|
||||
} else {
|
||||
$num = $this->ref;
|
||||
$num = (string) $this->ref;
|
||||
}
|
||||
$this->newref = dol_sanitizeFileName($num);
|
||||
|
||||
|
|
|
|||
|
|
@ -542,7 +542,7 @@ class Evaluation extends CommonObject
|
|||
if (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) { // empty should not happened, but when it occurs, the test save life
|
||||
$num = $this->getNextNumRef();
|
||||
} else {
|
||||
$num = $this->ref;
|
||||
$num = (string) $this->ref;
|
||||
}
|
||||
$this->newref = $num;
|
||||
|
||||
|
|
|
|||
|
|
@ -480,7 +480,7 @@ class Job extends CommonObject
|
|||
if (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) { // empty should not happened, but when it occurs, the test save life
|
||||
$num = $this->getNextNumRef();
|
||||
} else {
|
||||
$num = $this->ref;
|
||||
$num = (string) $this->ref;
|
||||
}
|
||||
$this->newref = $num;
|
||||
|
||||
|
|
|
|||
|
|
@ -537,7 +537,7 @@ class Position extends CommonObject
|
|||
if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) { // empty should not happened, but when it occurs, the test save life
|
||||
$num = $this->getNextNumRef();
|
||||
} else {
|
||||
$num = $this->ref;
|
||||
$num = (string) $this->ref;
|
||||
}
|
||||
$this->newref = $num;
|
||||
|
||||
|
|
|
|||
|
|
@ -599,7 +599,7 @@ class Skill extends CommonObject
|
|||
if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) { // empty should not happened, but when it occurs, the test save life
|
||||
$num = $this->getNextNumRef();
|
||||
} else {
|
||||
$num = $this->ref;
|
||||
$num = (string) $this->ref;
|
||||
}
|
||||
$this->newref = $num;
|
||||
|
||||
|
|
|
|||
|
|
@ -504,7 +504,7 @@ class Skilldet extends CommonObjectLine
|
|||
if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) { // empty should not happened, but when it occurs, the test save life
|
||||
$num = $this->getNextNumRef();
|
||||
} else {
|
||||
$num = $this->ref;
|
||||
$num = (string) $this->ref;
|
||||
}
|
||||
$this->newref = $num;
|
||||
|
||||
|
|
|
|||
|
|
@ -518,7 +518,7 @@ class SkillRank extends CommonObject
|
|||
if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) { // empty should not happened, but when it occurs, the test save life
|
||||
$num = $this->getNextNumRef();
|
||||
} else {
|
||||
$num = $this->ref;
|
||||
$num = (string) $this->ref;
|
||||
}
|
||||
$this->newref = $num;
|
||||
|
||||
|
|
|
|||
|
|
@ -376,7 +376,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
} else {
|
||||
$numref = $object->ref;
|
||||
$numref = (string) $object->ref;
|
||||
}
|
||||
|
||||
$text = $langs->trans('ConfirmValidateEvaluation', $numref);
|
||||
|
|
|
|||
|
|
@ -589,7 +589,7 @@ class KnowledgeRecord extends CommonObject
|
|||
if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) { // empty should not happened, but when it occurs, the test save life
|
||||
$num = $this->getNextNumRef();
|
||||
} else {
|
||||
$num = $this->ref;
|
||||
$num = (string) $this->ref;
|
||||
}
|
||||
$this->newref = $num;
|
||||
|
||||
|
|
|
|||
|
|
@ -600,7 +600,7 @@ class MyObject extends CommonObject
|
|||
if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) { // empty should not happened, but when it occurs, the test save life
|
||||
$num = $this->getNextNumRef();
|
||||
} else {
|
||||
$num = $this->ref;
|
||||
$num = (string) $this->ref;
|
||||
}
|
||||
$this->newref = $num;
|
||||
|
||||
|
|
|
|||
|
|
@ -1117,7 +1117,7 @@ class Mo extends CommonObject
|
|||
$this->fetch_product();
|
||||
$num = $this->getNextNumRef($this->product);
|
||||
} else {
|
||||
$num = $this->ref;
|
||||
$num = (string) $this->ref;
|
||||
}
|
||||
$this->newref = $num;
|
||||
|
||||
|
|
|
|||
|
|
@ -552,7 +552,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||
$object->fetch_product();
|
||||
$numref = $object->getNextNumRef($object->product);
|
||||
} else {
|
||||
$numref = $object->ref;
|
||||
$numref = (string) $object->ref;
|
||||
}
|
||||
|
||||
$text = $langs->trans('ConfirmValidateMo', $numref);
|
||||
|
|
|
|||
|
|
@ -596,7 +596,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||
$object->fetch_product();
|
||||
$numref = $object->getNextNumRef($object->product);
|
||||
} else {
|
||||
$numref = $object->ref;
|
||||
$numref = (string) $object->ref;
|
||||
}
|
||||
|
||||
$text = $langs->trans('ConfirmValidateMo', $numref);
|
||||
|
|
|
|||
|
|
@ -662,7 +662,7 @@ class Partnership extends CommonObject
|
|||
if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) { // empty should not happened, but when it occurs, the test save life
|
||||
$num = $this->getNextNumRef();
|
||||
} else {
|
||||
$num = $this->ref;
|
||||
$num = (string) $this->ref;
|
||||
}
|
||||
$this->newref = $num;
|
||||
|
||||
|
|
@ -794,7 +794,7 @@ class Partnership extends CommonObject
|
|||
if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) { // empty should not happened, but when it occurs, the test save life
|
||||
$num = $this->getNextNumRef();
|
||||
} else {
|
||||
$num = $this->ref;
|
||||
$num = (string) $this->ref;
|
||||
}
|
||||
$this->newref = $num;
|
||||
|
||||
|
|
|
|||
|
|
@ -5866,7 +5866,7 @@ class Product extends CommonObject
|
|||
|
||||
$result = '';
|
||||
|
||||
$newref = $this->ref;
|
||||
$newref = (string) $this->ref;
|
||||
if ($maxlength) {
|
||||
$newref = dol_trunc($newref, $maxlength, 'middle');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -552,7 +552,7 @@ class ProductFournisseurPrice extends CommonObject
|
|||
if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) { // empty should not happened, but when it occurs, the test save life
|
||||
$num = $this->getNextNumRef();
|
||||
} else {
|
||||
$num = $this->ref;
|
||||
$num = (string) $this->ref;
|
||||
}
|
||||
$this->newref = $num;
|
||||
|
||||
|
|
|
|||
|
|
@ -615,7 +615,7 @@ class StockTransfer extends CommonObject
|
|||
if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) { // empty should not happened, but when it occurs, the test save life
|
||||
$num = $this->getNextNumRef();
|
||||
} else {
|
||||
$num = $this->ref;
|
||||
$num = (string) $this->ref;
|
||||
}
|
||||
$this->newref = $num;
|
||||
|
||||
|
|
|
|||
|
|
@ -545,7 +545,7 @@ class StockTransferLine extends CommonObjectLine
|
|||
if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) { // empty should not happened, but when it occurs, the test save life
|
||||
$num = $this->getNextNumRef();
|
||||
} else {
|
||||
$num = $this->ref;
|
||||
$num = (string) $this->ref;
|
||||
}
|
||||
$this->newref = $num;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/* Copyright (C) 2010-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
@ -52,7 +52,7 @@ if (empty($conf) || !is_object($conf)) {
|
|||
$productref = '';
|
||||
if ($object->element == 'product') {
|
||||
/** @var Product $object */
|
||||
$productref = $object->ref;
|
||||
$productref = (string) $object->ref;
|
||||
}
|
||||
|
||||
$langs->load("productbatch");
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/* Copyright (C) 2010-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2018-2025 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
|
||||
|
|
@ -50,7 +50,7 @@ if (empty($conf) || !is_object($conf)) {
|
|||
$productref = '';
|
||||
if ($object->element == 'product') {
|
||||
/** @var Product $object */
|
||||
$productref = $object->ref;
|
||||
$productref = (string) $object->ref;
|
||||
}
|
||||
|
||||
$langs->load("productbatch");
|
||||
|
|
|
|||
|
|
@ -854,7 +854,7 @@ class Project extends CommonObject
|
|||
}
|
||||
}
|
||||
|
||||
return $substitution;
|
||||
return (string) $substitution;
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2006-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024 Vincent de Grandpré <vincent@de-grandpre.quebec>
|
||||
*
|
||||
|
|
@ -307,7 +307,7 @@ $formother = new FormOther($db);
|
|||
$formfile = new FormFile($db);
|
||||
$formproject = new FormProjets($db);
|
||||
|
||||
$title = $object->ref;
|
||||
$title = (string) $object->ref;
|
||||
if (!empty($withproject)) {
|
||||
$title .= ' | ' . $langs->trans("Project") . (!empty($projectstatic->ref) ? ': '.$projectstatic->ref : '') ;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/* Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024-2025 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
|
||||
|
|
@ -184,7 +184,7 @@ if (empty($pageref)) {
|
|||
$objectpage = new WebsitePage($db);
|
||||
$result = $objectpage->fetch($pageid);
|
||||
if ($result > 0) {
|
||||
$pageref = $objectpage->ref;
|
||||
$pageref = (string) $objectpage->ref;
|
||||
}
|
||||
}
|
||||
if (preg_match('/^_(library|service)_page_/', $pageref)) {
|
||||
|
|
|
|||
|
|
@ -1425,7 +1425,7 @@ if ($action == 'create') {
|
|||
if ($objectref == 'PROV') {
|
||||
$numref = $object->getNextNumRef($soc);
|
||||
} else {
|
||||
$numref = $object->ref;
|
||||
$numref = (string) $object->ref;
|
||||
}
|
||||
|
||||
$text = $langs->trans("ConfirmValidateReception", $numref);
|
||||
|
|
|
|||
|
|
@ -588,7 +588,7 @@ class Reception extends CommonObject
|
|||
if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) { // empty should not happened, but when it occurs, the test save life
|
||||
$numref = $this->getNextNumRef($soc);
|
||||
} else {
|
||||
$numref = $this->ref;
|
||||
$numref = (string) $this->ref;
|
||||
}
|
||||
|
||||
$this->newref = dol_sanitizeFileName($numref);
|
||||
|
|
@ -1889,7 +1889,7 @@ class Reception extends CommonObject
|
|||
// If stock increment is done on closing
|
||||
if (!$error && isModEnabled('stock') && getDolGlobalInt('STOCK_CALCULATE_ON_RECEPTION_CLOSE')) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
|
||||
$numref = $this->ref;
|
||||
$numref = (string) $this->ref;
|
||||
$langs->load("agenda");
|
||||
|
||||
// Loop on each product line to add a stock movement
|
||||
|
|
|
|||
|
|
@ -550,7 +550,7 @@ class RecruitmentCandidature extends CommonObject
|
|||
if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) { // empty should not happened, but when it occurs, the test save life
|
||||
$num = $this->getNextNumRef();
|
||||
} else {
|
||||
$num = $this->ref;
|
||||
$num = (string) $this->ref;
|
||||
}
|
||||
$this->newref = $num;
|
||||
|
||||
|
|
|
|||
|
|
@ -556,7 +556,7 @@ class RecruitmentJobPosition extends CommonObject
|
|||
if (/* !$error && */ (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) { // empty should not happened, but when it occurs, the test save life
|
||||
$num = $this->getNextNumRef();
|
||||
} else {
|
||||
$num = $this->ref;
|
||||
$num = (string) $this->ref;
|
||||
}
|
||||
$this->newref = $num;
|
||||
|
||||
|
|
|
|||
|
|
@ -1605,7 +1605,7 @@ if ($action == 'create') {
|
|||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
} else {
|
||||
$numref = $object->ref;
|
||||
$numref = (string) $object->ref;
|
||||
}
|
||||
|
||||
$text = $langs->trans('ConfirmValidateAsk', $numref);
|
||||
|
|
|
|||
|
|
@ -1459,7 +1459,7 @@ class SupplierProposal extends CommonObject
|
|||
if (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) { // empty should not happened, but when it occurs, the test save life
|
||||
$num = $this->getNextNumRef($soc);
|
||||
} else {
|
||||
$num = $this->ref;
|
||||
$num = (string) $this->ref;
|
||||
}
|
||||
$this->newref = dol_sanitizeFileName($num);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2022 Open-Dsi <support@open-dsi.fr>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
|
|
@ -374,7 +374,7 @@ if ($action === 'confirm_deletecombination' && $usercancreate) {
|
|||
|
||||
$product_child = new Product($db);
|
||||
$product_child->fetch($prodcomb->fk_product_child);
|
||||
$reference = $product_child->ref;
|
||||
$reference = (string) $product_child->ref;
|
||||
$weight_impact = $prodcomb->variation_weight;
|
||||
$price_impact = $prodcomb->variation_price;
|
||||
$price_impact_percent = $prodcomb->variation_price_percentage;
|
||||
|
|
|
|||
|
|
@ -596,7 +596,7 @@ class Target extends CommonObject
|
|||
if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) { // empty should not happened, but when it occurs, the test save life
|
||||
$num = $this->getNextNumRef();
|
||||
} else {
|
||||
$num = $this->ref;
|
||||
$num = (string) $this->ref;
|
||||
}
|
||||
$this->newref = $num;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (C) 2023-2024 Lionel Vessiller <lvessiller@easya.solutions>
|
||||
* Copyright (C) 2023-2024 Patrice Andreani <pandreani@easya.solutions>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024-2025 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
|
||||
|
|
@ -1077,7 +1077,7 @@ class FormWebPortal extends Form
|
|||
//
|
||||
if (in_array($key, array('rowid', 'ref'))) {
|
||||
if (property_exists($object, 'ref')) {
|
||||
$value = $object->ref;
|
||||
$value = (string) $object->ref;
|
||||
} elseif (property_exists($object, 'id')) {
|
||||
$value = $object->id;
|
||||
} else {
|
||||
|
|
@ -1357,15 +1357,16 @@ class FormWebPortal extends Form
|
|||
if ($classname && class_exists($classname)) {
|
||||
$object = new $classname($this->db);
|
||||
'@phan-var-force CommonObject $object';
|
||||
/** @var CommonObject $object */
|
||||
$result = $object->fetch($value);
|
||||
$value = '';
|
||||
if ($result > 0) {
|
||||
if (property_exists($object, 'label')) {
|
||||
$value = $object->label; // @phan-suppress-current-line PhanUndeclaredProperty
|
||||
$value = (string) $object->label; // @phan-suppress-current-line PhanUndeclaredProperty
|
||||
} elseif (property_exists($object, 'libelle')) {
|
||||
$value = $object->libelle; // @phan-suppress-current-line PhanUndeclaredProperty
|
||||
$value = (string) $object->libelle; // @phan-suppress-current-line PhanUndeclaredProperty
|
||||
} elseif (property_exists($object, 'nom')) {
|
||||
$value = $object->nom; // @phan-suppress-current-line PhanUndeclaredProperty
|
||||
$value = (string) $object->nom; // @phan-suppress-current-line PhanUndeclaredProperty
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue