";
- $accountoshow = length_accountg(getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT'));
+ $accountoshow = length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_EXPENSEREPORT'));
if (($accountoshow == "") || $accountoshow == 'NotDefined') {
print ''.$langs->trans("MainAccountForUsersNotDefined").'';
} else {
diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php
index c6ce7429708..f71fa705c3f 100644
--- a/htdocs/adherents/class/adherent.class.php
+++ b/htdocs/adherents/class/adherent.class.php
@@ -560,12 +560,13 @@ class Adherent extends CommonObject
* Return translated label by the nature of a adherent (physical or moral)
*
* @param string $morphy Nature of the adherent (physical or moral)
- * @param int $addbadge Add badge (1=Full label, 2=First letters only)
+ * @param int<0,2> $addbadge Add badge (1=Full label, 2=First letters only)
* @return string Label
*/
public function getmorphylib($morphy = '', $addbadge = 0)
{
global $langs;
+ $s = '';
// Clean var
if (!$morphy) {
@@ -573,7 +574,6 @@ class Adherent extends CommonObject
}
if ($addbadge) {
- $s = '';
$labeltoshowm = $langs->trans("Moral");
$labeltoshowp = $langs->trans("Physical");
if ($morphy == 'phy') {
diff --git a/htdocs/adherents/class/adherentstats.class.php b/htdocs/adherents/class/adherentstats.class.php
index f99b20f86d5..612f408edd9 100644
--- a/htdocs/adherents/class/adherentstats.class.php
+++ b/htdocs/adherents/class/adherentstats.class.php
@@ -3,6 +3,7 @@
* Copyright (c) 2005-2011 Laurent Destailleur
* Copyright (C) 2005-2009 Regis Houssin
* Copyright (C) 2023 Waël Almoman
+ * Copyright (C) 2024 MDW
*
* 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
@@ -168,15 +169,15 @@ class AdherentStats extends Stats
/**
* Return count of member by status group by adh type, total and average
*
- * @param int $numberYears Number of years to scan (0 = all)
- * @return array Array with total of draft, pending, uptodate, expired, resiliated for each member type
+ * @param int $numberYears Number of years to scan (0 = all)
+ * @return array Array with total of draft, pending, uptodate, expired, resiliated for each member type
*/
public function countMembersByTypeAndStatus($numberYears = 0)
{
global $user;
$now = dol_now();
- $endYear = date('Y');
+ $endYear = (int) date('Y');
$startYear = $endYear - $numberYears;
$sql = "SELECT t.rowid as fk_adherent_type, t.libelle as label";
@@ -224,7 +225,7 @@ class AdherentStats extends Stats
'members_resiliated' => (int) $objp->members_resiliated
);
$totalrow = 0;
- foreach ($MembersCountArray[$objp->fk_adherent_type] as $key=>$nb) {
+ foreach ($MembersCountArray[$objp->fk_adherent_type] as $key => $nb) {
if ($key != 'label') {
$totalrow += $nb;
$totalstatus[$key] += $nb;
@@ -244,16 +245,17 @@ class AdherentStats extends Stats
/**
* Return count of member by status group by adh type, total and average
*
- * @param int $numberYears Number of years to scan (0 = all)
- * @return array Array with total of draft, pending, uptodate, expired, resiliated for each member tag
+ * @param int $numberYears Number of years to scan (0 = all)
+ * @return array Array with total of draft, pending, uptodate, expired, resiliated for each member tag
*/
public function countMembersByTagAndStatus($numberYears = 0)
{
global $user;
$now = dol_now();
- $endYear = date('Y');
+ $endYear = (int) date('Y');
$startYear = $endYear - $numberYears;
+ $MembersCountArray = [];
$sql = "SELECT c.rowid as fk_categorie, c.label as label";
$sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_DRAFT, "'members_draft'", 'NULL').") as members_draft";
@@ -282,7 +284,6 @@ class AdherentStats extends Stats
if ($result) {
$num = $this->db->num_rows($result);
$i = 0;
- $MembersCountArray = [];
$totalstatus = array(
'label' => 'Total',
'members_draft' => 0,
@@ -304,7 +305,7 @@ class AdherentStats extends Stats
'members_resiliated' => (int) $objp->members_resiliated
);
$totalrow = 0;
- foreach ($MembersCountArray[$objp->fk_categorie] as $key=>$nb) {
+ foreach ($MembersCountArray[$objp->fk_categorie] as $key => $nb) {
if ($key != 'label') {
$totalrow += $nb;
$totalstatus[$key] += $nb;
diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php
index e8d85f21c76..47bded0df29 100644
--- a/htdocs/adherents/list.php
+++ b/htdocs/adherents/list.php
@@ -6,6 +6,7 @@
* Copyright (C) 2014-2016 Juanjo Menent
* Copyright (C) 2018 Alexandre Spangaro
* Copyright (C) 2021-2023 Frédéric France
+ * Copyright (C) 2024 MDW
*
* 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
@@ -203,6 +204,7 @@ foreach ($object->fields as $key => $val) {
}
}
$arrayfields = dol_sort_array($arrayfields, 'position');
+'@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
//var_dump($arrayfields);exit;
// Security check
diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php
index d895854ab2c..da9b0271b15 100644
--- a/htdocs/admin/dict.php
+++ b/htdocs/admin/dict.php
@@ -13,6 +13,7 @@
* Copyright (C) 2016 Raphaël Doursenaud
* Copyright (C) 2019-2022 Frédéric France
* Copyright (C) 2020-2022 Open-Dsi
+ * Copyright (C) 2024 Charlene Benke
*
* 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
@@ -2130,6 +2131,11 @@ if ($id > 0) {
$canbemodified = 1;
}
+ if ($tabname[$id] == "c_product_nature" && in_array($obj->code, array(0, 1))) {
+ $canbedisabled = 0;
+ $canbemodified = 0;
+ $iserasable = 0;
+ }
// Build Url. The table is id=, the id of line is rowid=
$rowidcol = empty($tabrowid[$id]) ? 'rowid' : $tabrowid[$id];
// If rowidcol not defined
diff --git a/htdocs/admin/system/about.php b/htdocs/admin/system/about.php
index a9c87ca61a3..14ea98ccc00 100644
--- a/htdocs/admin/system/about.php
+++ b/htdocs/admin/system/about.php
@@ -90,31 +90,31 @@ print '';
if (preg_match('/^fr_/i', $langs->getDefaultLang()))
{
print '
';
diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php
index 9bbc5e75018..b6f50754c6b 100644
--- a/htdocs/core/class/html.formprojet.class.php
+++ b/htdocs/core/class/html.formprojet.class.php
@@ -3,6 +3,7 @@
* Copyright (C) 2015 Marcos García
* Copyright (C) 2018 Charlene Benke
* Copyright (C) 2024 Frédéric France
+ * Copyright (C) 2024 MDW
*
* 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
@@ -686,7 +687,7 @@ class FormProjets extends Form
* @param string $morecss Add more css
* @param int $noadmininfo 0=Add admin info, 1=Disable admin info
* @param int $addcombojs 1=Add a js combo
- * @return int|string The HTML select list of element or '' if nothing or -1 if KO
+ * @return int<-1,-1>|string The HTML select list of element or '' if nothing or -1 if KO
*/
public function selectOpportunityStatus($htmlname, $preselected = '-1', $showempty = 1, $useshortlabel = 0, $showallnone = 0, $showpercent = 0, $morecss = '', $noadmininfo = 0, $addcombojs = 0)
{
@@ -701,6 +702,7 @@ class FormProjets extends Form
if ($resql) {
$num = $this->db->num_rows($resql);
$i = 0;
+ $sellist = '';
if ($num > 0) {
$sellist = '
'; // Dispatch column
print '
'; // Warehouse column
- /*$sql = "SELECT cfd.rowid, cfd.qty, cfd.fk_entrepot, cfd.batch, cfd.eatby, cfd.sellby, cfd.fk_product";
- $sql .= " FROM ".MAIN_DB_PREFIX."receptiondet_batch as cfd";
- $sql .= " WHERE cfd.fk_commandefourndet = ".(int) $objp->rowid;*/
-
$sql = "SELECT ed.rowid, ed.qty, ed.fk_entrepot,";
$sql .= " eb.batch, eb.eatby, eb.sellby, cd.fk_product";
$sql .= " FROM ".MAIN_DB_PREFIX."expeditiondet as ed";
diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php
index 69980c72d1e..0e0fedc9c5d 100644
--- a/htdocs/expedition/list.php
+++ b/htdocs/expedition/list.php
@@ -6,6 +6,7 @@
* Copyright (C) 2019 Nicolas ZABOURI
* Copyright (C) 2020 Thibault FOUCART
* Copyright (C) 2023 Christophe Battarel
+ * Copyright (C) 2024 MDW
*
* 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
@@ -145,6 +146,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
$object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
+'@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
// Security check
$expeditionid = GETPOSTINT('id');
diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php
index 551390582f4..b7aced293b3 100644
--- a/htdocs/expensereport/class/expensereport.class.php
+++ b/htdocs/expensereport/class/expensereport.class.php
@@ -1729,7 +1729,7 @@ class ExpenseReport extends CommonObject
$dir = dol_buildpath($reldir."core/modules/expensereport/");
// Load file with numbering class (if found)
- $mybool |= @include_once $dir.$file;
+ $mybool = ((bool) @include_once $dir.$file) || $mybool;
}
if ($mybool === false) {
diff --git a/htdocs/expensereport/payment/list.php b/htdocs/expensereport/payment/list.php
index c1f474af0db..88431f01682 100644
--- a/htdocs/expensereport/payment/list.php
+++ b/htdocs/expensereport/payment/list.php
@@ -112,6 +112,7 @@ $arrayfields = array(
'pndf.amount' => array('label' => "Amount", 'checked' => 1, 'position' => 70),
);
$arrayfields = dol_sort_array($arrayfields, 'position');
+'@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('paymentexpensereportlist'));
diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php
index f5b57037c0d..d54497125c1 100644
--- a/htdocs/fichinter/class/fichinter.class.php
+++ b/htdocs/fichinter/class/fichinter.class.php
@@ -200,17 +200,17 @@ class Fichinter extends CommonObject
/*
* Signed by sender
*/
- CONST STATUS_SIGNED_SENDER = 1;
+ const STATUS_SIGNED_SENDER = 1;
/*
* Signed by receiver
*/
- CONST STATUS_SIGNED_RECEIVER = 2;
+ const STATUS_SIGNED_RECEIVER = 2;
/*
* Signed by all
*/
- CONST STATUS_SIGNED_ALL = 9; // To handle future kind of signature (ex: tripartite contract)
+ const STATUS_SIGNED_ALL = 9; // To handle future kind of signature (ex: tripartite contract)
/**
* Date delivery
@@ -1010,7 +1010,7 @@ class Fichinter extends CommonObject
$dir = dol_buildpath($reldir."core/modules/fichinter/");
// Load file with numbering class (if found)
- $mybool |= @include_once $dir.$file;
+ $mybool = ((bool) @include_once $dir.$file) || $mybool;
}
if ($mybool === false) {
diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php
index 20878a34e16..a04b89bef02 100644
--- a/htdocs/fichinter/list.php
+++ b/htdocs/fichinter/list.php
@@ -9,6 +9,7 @@
* Copyright (C) 2021-2023 Frédéric France
* Copyright (C) 2022 Charlène Benke
* Copyright (C) 2024 William Mead
+ * Copyright (C) 2024 MDW
*
* 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
@@ -149,6 +150,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
$object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
+'@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
// Security check
$id = GETPOSTINT('id');
diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php
index d9f7863c16c..b018cda619d 100644
--- a/htdocs/fourn/class/fournisseur.commande.class.php
+++ b/htdocs/fourn/class/fournisseur.commande.class.php
@@ -1129,7 +1129,7 @@ class CommandeFournisseur extends CommonOrder
$dir = dol_buildpath($reldir."core/modules/supplier_order/");
// Load file with numbering class (if found)
- $mybool |= @include_once $dir.$file;
+ $mybool = ((bool) @include_once $dir.$file) || $mybool;
}
if ($mybool === false) {
@@ -2252,7 +2252,7 @@ class CommandeFournisseur extends CommonOrder
$this->db->begin();
$sql = "INSERT INTO ".$this->db->prefix()."receptiondet_batch";
- $sql .= " (fk_commande, fk_product, qty, fk_entrepot, fk_user, datec, fk_commandefourndet, status, comment, eatby, sellby, batch, fk_reception) VALUES";
+ $sql .= " (fk_element, fk_product, qty, fk_entrepot, fk_user, datec, fk_elementdet, status, comment, eatby, sellby, batch, fk_reception) VALUES";
$sql .= " ('".$this->id."','".$product."','".$qty."',".($entrepot > 0 ? "'".$entrepot."'" : "null").",'".$user->id."','".$this->db->idate($now)."','".$fk_commandefourndet."', ".$dispatchstatus.", '".$this->db->escape($comment)."', ";
$sql .= ($eatby ? "'".$this->db->idate($eatby)."'" : "null").", ".($sellby ? "'".$this->db->idate($sellby)."'" : "null").", ".($batch ? "'".$this->db->escape($batch)."'" : "null").", ".($fk_reception > 0 ? "'".$this->db->escape($fk_reception)."'" : "null");
$sql .= ")";
@@ -2497,11 +2497,11 @@ class CommandeFournisseur extends CommonOrder
// List of already dispatched lines
$sql = "SELECT p.ref, p.label,";
$sql .= " e.rowid as warehouse_id, e.ref as entrepot,";
- $sql .= " cfd.rowid as dispatchedlineid, cfd.fk_product, cfd.qty, cfd.eatby, cfd.sellby, cfd.batch, cfd.comment, cfd.status, cfd.fk_commandefourndet";
+ $sql .= " cfd.rowid as dispatchedlineid, cfd.fk_product, cfd.qty, cfd.eatby, cfd.sellby, cfd.batch, cfd.comment, cfd.status, cfd.fk_elementdet";
$sql .= " FROM ".$this->db->prefix()."product as p,";
$sql .= " ".$this->db->prefix()."receptiondet_batch as cfd";
$sql .= " LEFT JOIN ".$this->db->prefix()."entrepot as e ON cfd.fk_entrepot = e.rowid";
- $sql .= " WHERE cfd.fk_commande = ".((int) $this->id);
+ $sql .= " WHERE cfd.fk_element = ".((int) $this->id);
$sql .= " AND cfd.fk_product = p.rowid";
if ($status >= 0) {
$sql .= " AND cfd.status = ".((int) $status);
@@ -2521,7 +2521,7 @@ class CommandeFournisseur extends CommonOrder
'productid' => $objp->fk_product,
'warehouseid' => $objp->warehouse_id,
'qty' => $objp->qty,
- 'orderlineid' => $objp->fk_commandefourndet
+ 'orderlineid' => $objp->fk_elementdet
);
}
@@ -3534,7 +3534,7 @@ class CommandeFournisseur extends CommonOrder
$supplierorderdispatch = new CommandeFournisseurDispatch($this->db);
- $filter = array('t.fk_commande' => $this->id);
+ $filter = array('t.fk_element' => $this->id);
if (getDolGlobalString('SUPPLIER_ORDER_USE_DISPATCH_STATUS')) {
$filter['t.status'] = 1; // Restrict to lines with status validated
}
@@ -3670,7 +3670,7 @@ class CommandeFournisseur extends CommonOrder
if ($filtre_statut >= 0) {
$sql .= ' cfd.fk_reception = e.rowid AND';
}
- $sql .= ' cfd.fk_commandefourndet = cd.rowid';
+ $sql .= ' cfd.fk_elementdet = cd.rowid';
$sql .= ' AND cd.fk_commande ='.((int) $this->id);
if (isset($this->fk_product) && !empty($this->fk_product) > 0) {
$sql .= ' AND cd.fk_product = '.((int) $this->fk_product);
diff --git a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php
index 84d76aadd93..06408ce0fa5 100644
--- a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php
+++ b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php
@@ -3,6 +3,7 @@
* Copyright (C) 2014 Juanjo Menent
* Copyright (C) 2024 Frédéric France
* Copyright (C) 2024 MDW
+ * Copyright (C) 2024 Christophe Battarel
*
* 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,118 +27,28 @@
*/
// Put here all includes required by your class file
-require_once DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php";
-require_once DOL_DOCUMENT_ROOT."/reception/class/reception.class.php";
+require_once DOL_DOCUMENT_ROOT."/reception/class/receptionlinebatch.class.php";
/**
- * Class to manage table commandefournisseurdispatch
+ * Class to manage table ReceptionLineBatch.
+ * Old name was CommandeFournisseurDispatch. This is a transition class.
*/
-class CommandeFournisseurDispatch extends CommonObjectLine
+class CommandeFournisseurDispatch extends ReceptionLineBatch
{
- /**
- * @var DoliDB Database handler.
- */
- public $db;
-
- /**
- * @var string Error code (or message)
- */
- public $error;
-
- /**
- * @var string[] Error codes (or messages)
- */
- public $errors = array();
-
/**
* @var string ID to identify managed object
*/
public $element = 'commandefournisseurdispatch';
-
- /**
- * @var string Name of table without prefix where object is stored
- */
- public $table_element = 'receptiondet_batch'; //!< Name of table without prefix where object is stored
- public $lines = array();
-
- /**
- * @var int ID
- */
- public $id;
-
/**
* @var int ID
*/
public $fk_commande;
-
/**
* @var int ID
*/
- public $fk_product;
-
- /**
- * @var int ID. Should be named fk_origin_line ?
- */
public $fk_commandefourndet;
- public $fk_reception;
-
-
- public $qty;
- public $qty_asked;
-
- public $libelle;
- public $label;
- public $desc;
- public $tva_tx;
- public $vat_src_code;
- public $ref_supplier;
-
- /**
- * @var int ID
- */
- public $fk_entrepot;
-
- /**
- * @var int User ID
- */
- public $fk_user;
-
- public $datec = '';
- public $comment;
-
- /**
- * @var int Status
- */
- public $status;
-
- public $batch;
- public $eatby = '';
- public $sellby = '';
- public $cost_price = 0;
-
-
-
-
- /**
- * Constructor
- *
- * @param DoliDB $db Database handler
- */
- public function __construct($db)
- {
- $this->db = $db;
-
- // List of language codes for status
- $this->labelStatus[0] = 'Received';
- $this->labelStatus[1] = 'Verified';
- $this->labelStatus[2] = 'Denied';
- $this->labelStatusShort[0] = 'Received';
- $this->labelStatusShort[1] = 'Verified';
- $this->labelStatusShort[2] = 'Denied';
- }
-
/**
* Create object into database
@@ -148,126 +59,12 @@ class CommandeFournisseurDispatch extends CommonObjectLine
*/
public function create($user, $notrigger = 0)
{
- global $conf, $langs, $hookmanager;
- $error = 0;
+ $this->fk_element = $this->fk_commande;
+ $this->fk_elementdet = $this->fk_commandefourndet;
- // Clean parameters
-
- if (isset($this->fk_commande)) {
- $this->fk_commande = (int) $this->fk_commande;
- }
- if (isset($this->fk_product)) {
- $this->fk_product = (int) $this->fk_product;
- }
- if (isset($this->fk_commandefourndet)) {
- $this->fk_commandefourndet = (int) $this->fk_commandefourndet;
- }
- if (isset($this->qty)) {
- $this->qty = trim((string) $this->qty);
- }
- if (isset($this->fk_entrepot)) {
- $this->fk_entrepot = (int) $this->fk_entrepot;
- }
- if (isset($this->fk_user)) {
- $this->fk_user = (int) $this->fk_user;
- }
- if (isset($this->comment)) {
- $this->comment = trim($this->comment);
- }
- if (isset($this->status)) {
- $this->status = (int) $this->status;
- }
- if (isset($this->batch)) {
- $this->batch = trim($this->batch);
- }
- if (empty($this->datec)) {
- $this->datec = dol_now();
- }
-
-
- // Check parameters
- // Put here code to add control on parameters values
-
- // Insert request
- $sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element."(";
- $sql .= "fk_commande,";
- $sql .= "fk_product,";
- $sql .= "fk_commandefourndet,";
- $sql .= "qty,";
- $sql .= "fk_entrepot,";
- $sql .= "fk_user,";
- $sql .= "datec,";
- $sql .= "comment,";
- $sql .= "status,";
- $sql .= "batch,";
- $sql .= "eatby,";
- $sql .= "sellby,";
- $sql .= "fk_reception,";
- $sql .= "cost_price";
-
-
- $sql .= ") VALUES (";
- $sql .= " ".(!isset($this->fk_commande) ? 'NULL' : "'".$this->db->escape($this->fk_commande)."'").",";
- $sql .= " ".(!isset($this->fk_product) ? 'NULL' : "'".$this->db->escape($this->fk_product)."'").",";
- $sql .= " ".(!isset($this->fk_commandefourndet) ? 'NULL' : "'".$this->db->escape($this->fk_commandefourndet)."'").",";
- $sql .= " ".(!isset($this->qty) ? 'NULL' : "'".$this->db->escape($this->qty)."'").",";
- $sql .= " ".(!isset($this->fk_entrepot) ? 'NULL' : "'".$this->db->escape($this->fk_entrepot)."'").",";
- $sql .= " ".(!isset($this->fk_user) ? 'NULL' : "'".$this->db->escape($this->fk_user)."'").",";
- $sql .= " ".(!isset($this->datec) || dol_strlen($this->datec) == 0 ? 'NULL' : "'".$this->db->idate($this->datec)."'").",";
- $sql .= " ".(!isset($this->comment) ? 'NULL' : "'".$this->db->escape($this->comment)."'").",";
- $sql .= " ".(!isset($this->status) ? 'NULL' : "'".$this->db->escape($this->status)."'").",";
- $sql .= " ".(!isset($this->batch) ? 'NULL' : "'".$this->db->escape($this->batch)."'").",";
- $sql .= " ".(!isset($this->eatby) || dol_strlen($this->eatby) == 0 ? 'NULL' : "'".$this->db->idate($this->eatby)."'").",";
- $sql .= " ".(!isset($this->sellby) || dol_strlen($this->sellby) == 0 ? 'NULL' : "'".$this->db->idate($this->sellby)."'").",";
- $sql .= " ".(!isset($this->fk_reception) ? 'NULL' : "'".$this->db->escape($this->fk_reception)."'").",";
- $sql .= " ".(!isset($this->cost_price) ? '0' : "'".$this->db->escape($this->cost_price)."'");
- $sql .= ")";
-
- $this->db->begin();
-
- dol_syslog(__METHOD__, LOG_DEBUG);
- $resql = $this->db->query($sql);
- if (!$resql) {
- $error++;
- $this->errors[] = "Error ".$this->db->lasterror();
- }
-
- if (!$error) {
- $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element);
-
- if (!$notrigger) {
- // Call triggers
- $result = $this->call_trigger('LINERECEPTION_CREATE', $user);
- if ($result < 0) {
- $error++;
- }
- // End call triggers
- }
- }
-
- // Create extrafields
- if (!$error) {
- $result = $this->insertExtraFields();
- if ($result < 0) {
- $error++;
- }
- }
-
- // Commit or rollback
- if ($error) {
- foreach ($this->errors as $errmsg) {
- dol_syslog(__METHOD__." ".$errmsg, LOG_ERR);
- $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
- }
- $this->db->rollback();
- return -1 * $error;
- } else {
- $this->db->commit();
- return $this->id;
- }
+ return parent::create($user, $notrigger);
}
-
/**
* Load object in memory from the database
*
@@ -277,68 +74,14 @@ class CommandeFournisseurDispatch extends CommonObjectLine
*/
public function fetch($id, $ref = '')
{
- global $langs;
- $sql = "SELECT";
- $sql .= " t.rowid,";
-
- $sql .= " t.fk_commande,";
- $sql .= " t.fk_product,";
- $sql .= " t.fk_commandefourndet,";
- $sql .= " t.qty,";
- $sql .= " t.fk_entrepot,";
- $sql .= " t.fk_user,";
- $sql .= " t.datec,";
- $sql .= " t.comment,";
- $sql .= " t.status,";
- $sql .= " t.tms,";
- $sql .= " t.batch,";
- $sql .= " t.eatby,";
- $sql .= " t.sellby,";
- $sql .= " t.fk_reception";
-
-
- $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element." as t";
- if ($ref) {
- $sql .= " WHERE t.ref = '".$this->db->escape($ref)."'";
- } else {
- $sql .= " WHERE t.rowid = ".((int) $id);
- }
-
- dol_syslog(get_class($this)."::fetch");
- $resql = $this->db->query($sql);
- if ($resql) {
- if ($this->db->num_rows($resql)) {
- $obj = $this->db->fetch_object($resql);
-
- $this->id = $obj->rowid;
-
- $this->fk_commande = $obj->fk_commande;
- $this->fk_product = $obj->fk_product;
- $this->fk_commandefourndet = $obj->fk_commandefourndet;
- $this->qty = $obj->qty;
- $this->fk_entrepot = $obj->fk_entrepot;
- $this->fk_user = $obj->fk_user;
- $this->datec = $this->db->jdate($obj->datec);
- $this->comment = $obj->comment;
- $this->status = $obj->status;
- $this->tms = $this->db->jdate($obj->tms);
- $this->batch = $obj->batch;
- $this->eatby = $this->db->jdate($obj->eatby);
- $this->sellby = $this->db->jdate($obj->sellby);
- $this->fk_reception = $obj->fk_reception;
-
- $this->fetch_optionals();
- }
- $this->db->free($resql);
-
- return 1;
- } else {
- $this->error = "Error ".$this->db->lasterror();
- return -1;
+ $ret = parent::fetch($id, $ref);
+ if ($ret > 0) {
+ $this->fk_commande = $this->fk_element;
+ $this->fk_commandefourndet = $this->fk_elementdet;
}
+ return $ret;
}
-
/**
* Update object into database
*
@@ -348,408 +91,9 @@ class CommandeFournisseurDispatch extends CommonObjectLine
*/
public function update($user, $notrigger = 0)
{
- $error = 0;
+ $this->fk_element = $this->fk_commande;
+ $this->fk_elementdet = $this->fk_commandefourndet;
- // Clean parameters
-
- if (isset($this->fk_commande)) {
- $this->fk_commande = (int) $this->fk_commande;
- }
- if (isset($this->fk_product)) {
- $this->fk_product = (int) $this->fk_product;
- }
- if (isset($this->fk_commandefourndet)) {
- $this->fk_commandefourndet = (int) $this->fk_commandefourndet;
- }
- if (isset($this->qty)) {
- $this->qty = trim($this->qty);
- }
- if (isset($this->fk_entrepot)) {
- $this->fk_entrepot = (int) $this->fk_entrepot;
- }
- if (isset($this->fk_user)) {
- $this->fk_user = (int) $this->fk_user;
- }
- if (isset($this->comment)) {
- $this->comment = trim($this->comment);
- }
- if (isset($this->status)) {
- $this->status = (int) $this->status;
- }
- if (isset($this->batch)) {
- $this->batch = trim($this->batch);
- }
-
-
-
- // Check parameters
- // Put here code to add a control on parameters values
-
- // Update request
- $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET";
- $sql .= " fk_commande=".(isset($this->fk_commande) ? $this->fk_commande : "null").",";
- $sql .= " fk_product=".(isset($this->fk_product) ? $this->fk_product : "null").",";
- $sql .= " fk_commandefourndet=".(isset($this->fk_commandefourndet) ? $this->fk_commandefourndet : "null").",";
- $sql .= " qty=".(isset($this->qty) ? $this->qty : "null").",";
- $sql .= " fk_entrepot=".(isset($this->fk_entrepot) ? $this->fk_entrepot : "null").",";
- $sql .= " fk_user=".(isset($this->fk_user) ? $this->fk_user : "null").",";
- $sql .= " datec=".(dol_strlen($this->datec) != 0 ? "'".$this->db->idate($this->datec)."'" : 'null').",";
- $sql .= " comment=".(isset($this->comment) ? "'".$this->db->escape($this->comment)."'" : "null").",";
- $sql .= " status=".(isset($this->status) ? $this->status : "null").",";
- $sql .= " tms=".(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').",";
- $sql .= " batch=".(isset($this->batch) ? "'".$this->db->escape($this->batch)."'" : "null").",";
- $sql .= " eatby=".(dol_strlen($this->eatby) != 0 ? "'".$this->db->idate($this->eatby)."'" : 'null').",";
- $sql .= " sellby=".(dol_strlen($this->sellby) != 0 ? "'".$this->db->idate($this->sellby)."'" : 'null');
- $sql .= " WHERE rowid=".((int) $this->id);
-
- $this->db->begin();
-
- dol_syslog(__METHOD__);
- $resql = $this->db->query($sql);
- if (!$resql) {
- $error++;
- $this->errors[] = "Error ".$this->db->lasterror();
- }
-
- if (!$error) {
- if (!$error) {
- if (empty($this->id) && !empty($this->rowid)) {
- $this->id = $this->rowid;
- }
- $result = $this->insertExtraFields();
- if ($result < 0) {
- $error++;
- }
- }
-
- if (!$notrigger) {
- // Call triggers
- $result = $this->call_trigger('LINERECEPTION_MODIFY', $user);
- if ($result < 0) {
- $error++;
- }
- // End call triggers
- }
- }
-
- // Commit or rollback
- if ($error) {
- foreach ($this->errors as $errmsg) {
- dol_syslog(__METHOD__." ".$errmsg, LOG_ERR);
- $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
- }
- $this->db->rollback();
- return -1 * $error;
- } else {
- $this->db->commit();
- return 1;
- }
- }
-
-
- /**
- * Delete object in database
- *
- * @param User $user User that deletes
- * @param int $notrigger 0=launch triggers after, 1=disable triggers
- * @return int Return integer <0 if KO, >0 if OK
- */
- public function delete($user, $notrigger = 0)
- {
- $error = 0;
-
- $this->db->begin();
-
- if (!$error) {
- if (!$notrigger) {
- // Call triggers
- $result = $this->call_trigger('LINERECEPTION_DELETE', $user);
- if ($result < 0) {
- $error++;
- }
- // End call triggers
- }
- }
-
- // Remove extrafields
- if (!$error) {
- $result = $this->deleteExtraFields();
- if ($result < 0) {
- $error++;
- dol_syslog(get_class($this)."::delete error deleteExtraFields ".$this->error, LOG_ERR);
- }
- }
-
- if (!$error) {
- $sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element;
- $sql .= " WHERE rowid=".((int) $this->id);
-
- dol_syslog(__METHOD__);
- $resql = $this->db->query($sql);
- if (!$resql) {
- $error++;
- $this->errors[] = "Error ".$this->db->lasterror();
- }
- }
-
- // Commit or rollback
- if ($error) {
- foreach ($this->errors as $errmsg) {
- dol_syslog(__METHOD__." ".$errmsg, LOG_ERR);
- $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
- }
- $this->db->rollback();
- return -1 * $error;
- } else {
- $this->db->commit();
- return 1;
- }
- }
-
-
- /**
- * Load an object from its id and create a new one in database
- *
- * @param User $user User making the clone
- * @param int $fromid Id of object to clone
- * @return int New id of clone
- */
- public function createFromClone(User $user, $fromid)
- {
- $error = 0;
-
- $object = new CommandeFournisseurDispatch($this->db);
-
- $this->db->begin();
-
- // Load source object
- $object->fetch($fromid);
- $object->id = 0;
- $object->statut = 0;
-
- // Clear fields
- // ...
-
- // Create clone
- $object->context['createfromclone'] = 'createfromclone';
- $result = $object->create($user);
-
- // Other options
- if ($result < 0) {
- $this->error = $object->error;
- $error++;
- }
-
- if (!$error) {
- }
-
- unset($object->context['createfromclone']);
-
- // End
- if (!$error) {
- $this->db->commit();
- return $object->id;
- } else {
- $this->db->rollback();
- return -1;
- }
- }
-
-
-
- /**
- * Return label of the status of object
- *
- * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto
- * @return string Label
- */
- public function getLibStatut($mode = 0)
- {
- return $this->LibStatut($this->status, $mode);
- }
-
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
- /**
- * Return label of a status
- *
- * @param int $status Id status
- * @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto
- * @return string Label of status
- */
- public function LibStatut($status, $mode = 0)
- {
- // phpcs:enable
- global $langs;
- $langs->load('orders');
-
- if ($mode == 0) {
- return $langs->trans($this->labelStatus[$status]);
- } elseif ($mode == 1) {
- return $langs->trans($this->labelStatusShort[$status]);
- } elseif ($mode == 2) {
- return $langs->trans($this->labelStatus[$status]);
- } elseif ($mode == 3) {
- if ($status == 0) {
- return img_picto($langs->trans($this->labelStatus[$status]), 'statut0');
- } elseif ($status == 1) {
- return img_picto($langs->trans($this->labelStatus[$status]), 'statut4');
- } elseif ($status == 2) {
- return img_picto($langs->trans($this->labelStatus[$status]), 'statut8');
- }
- } elseif ($mode == 4) {
- if ($status == 0) {
- return img_picto($langs->trans($this->labelStatus[$status]), 'statut0').' '.$langs->trans($this->labelStatus[$status]);
- } elseif ($status == 1) {
- return img_picto($langs->trans($this->labelStatus[$status]), 'statut4').' '.$langs->trans($this->labelStatus[$status]);
- } elseif ($status == 2) {
- return img_picto($langs->trans($this->labelStatus[$status]), 'statut8').' '.$langs->trans($this->labelStatus[$status]);
- }
- } elseif ($mode == 5) {
- if ($status == 0) {
- return ''.$langs->trans($this->labelStatusShort[$status]).' '.img_picto($langs->trans($this->labelStatus[$status]), 'statut0');
- } elseif ($status == 1) {
- return ''.$langs->trans($this->labelStatusShort[$status]).' '.img_picto($langs->trans($this->labelStatus[$status]), 'statut4');
- } elseif ($status == 2) {
- return ''.$langs->trans($this->labelStatusShort[$status]).' '.img_picto($langs->trans($this->labelStatus[$status]), 'statut8');
- }
- }
- return "";
- }
-
-
- /**
- * Initialise object with example values
- * Id must be 0 if object instance is a specimen
- *
- * @return int
- */
- public function initAsSpecimen()
- {
- $this->id = 0;
-
- $this->fk_commande = 0;
- $this->fk_product = 0;
- $this->fk_commandefourndet = 0;
- $this->qty = '';
- $this->fk_entrepot = 0;
- $this->fk_user = 0;
- $this->datec = '';
- $this->comment = '';
- $this->status = 0;
- $this->tms = dol_now();
- $this->batch = '';
- $this->eatby = '';
- $this->sellby = '';
-
- return 1;
- }
-
- /**
- * Load object in memory from the database
- *
- * @param string $sortorder Sort Order
- * @param string $sortfield Sort field
- * @param int $limit limit
- * @param int $offset offset limit
- * @param string|array $filter filter array
- * @param string $filtermode filter mode (AND or OR)
- * @return int Return integer <0 if KO, >0 if OK
- */
- public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = '', $filtermode = 'AND')
- {
- dol_syslog(__METHOD__, LOG_DEBUG);
-
- $sql = "SELECT";
- $sql .= " t.rowid,";
- $sql .= " t.fk_commande,";
- $sql .= " t.fk_product,";
- $sql .= " t.fk_commandefourndet,";
- $sql .= " t.qty,";
- $sql .= " t.fk_entrepot,";
- $sql .= " t.fk_user,";
- $sql .= " t.datec,";
- $sql .= " t.comment,";
- $sql .= " t.status,";
- $sql .= " t.tms,";
- $sql .= " t.batch,";
- $sql .= " t.eatby,";
- $sql .= " t.sellby";
- $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element." as t";
-
- // Manage filter
- if (is_array($filter)) {
- $sqlwhere = array();
- if (count($filter) > 0) {
- foreach ($filter as $key => $value) {
- if ($key == 't.comment') {
- $sqlwhere [] = $this->db->sanitize($key)." LIKE '%".$this->db->escape($this->db->escapeforlike($value))."%'";
- } elseif ($key == 't.datec' || $key == 't.tms' || $key == 't.eatby' || $key == 't.sellby' || $key == 't.batch') {
- $sqlwhere [] = $this->db->sanitize($key)." = '".$this->db->escape($value)."'";
- } elseif ($key == 'qty') {
- $sqlwhere [] = $this->db->sanitize($key)." = ".((float) $value);
- } else {
- $sqlwhere [] = $this->db->sanitize($key)." = ".((int) $value);
- }
- }
- }
- if (count($sqlwhere) > 0) {
- $sql .= ' WHERE '.implode(' '.$this->db->escape($filtermode).' ', $sqlwhere);
- }
-
- $filter = '';
- }
-
- // Manage filter
- $errormessage = '';
- $sql .= forgeSQLFromUniversalSearchCriteria($filter, $errormessage);
- if ($errormessage) {
- $this->errors[] = $errormessage;
- dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
- return -1;
- }
-
- if (!empty($sortfield)) {
- $sql .= $this->db->order($sortfield, $sortorder);
- }
- if (!empty($limit)) {
- $sql .= $this->db->plimit($limit, $offset);
- }
- $this->lines = array();
-
- $resql = $this->db->query($sql);
- if ($resql) {
- $num = $this->db->num_rows($resql);
-
- while ($obj = $this->db->fetch_object($resql)) {
- $line = new self($this->db);
-
- $line->id = $obj->rowid;
-
- $line->fk_commande = $obj->fk_commande;
- $line->fk_product = $obj->fk_product;
- $line->fk_commandefourndet = $obj->fk_commandefourndet;
- $line->qty = $obj->qty;
- $line->fk_entrepot = $obj->fk_entrepot;
- $line->fk_user = $obj->fk_user;
- $line->datec = $this->db->jdate($obj->datec);
- $line->comment = $obj->comment;
- $line->status = $obj->status;
- $line->tms = $this->db->jdate($obj->tms);
- $line->batch = $obj->batch;
- $line->eatby = $this->db->jdate($obj->eatby);
- $line->sellby = $this->db->jdate($obj->sellby);
- $line->fetch_optionals();
-
- $this->lines[$line->id] = $line;
- }
- $this->db->free($resql);
-
- return $num;
- } else {
- $this->errors[] = 'Error '.$this->db->lasterror();
- dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
-
- return -1;
- }
+ return parent::update($user, $notrigger);
}
}
diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php
index 7c733bc8f5a..576645afab4 100644
--- a/htdocs/fourn/class/fournisseur.facture.class.php
+++ b/htdocs/fourn/class/fournisseur.facture.class.php
@@ -2963,7 +2963,7 @@ class FactureFournisseur extends CommonInvoice
$dir = dol_buildpath($reldir."core/modules/supplier_invoice/");
// Load file with numbering class (if found)
- $mybool |= @include_once $dir.$file;
+ $mybool = ((bool) @include_once $dir.$file) || $mybool;
}
if ($mybool === false) {
diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php
index c01feb22892..8c221fff4d9 100644
--- a/htdocs/fourn/class/paiementfourn.class.php
+++ b/htdocs/fourn/class/paiementfourn.class.php
@@ -10,6 +10,7 @@
* Copyright (C) 2023 Joachim Kueter
* Copyright (C) 2023 Sylvain Legrand
* Copyright (C) 2024 Frédéric France
+ * Copyright (C) 2024 MDW
*
* 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
@@ -279,9 +280,9 @@ class PaiementFourn extends Paiement
// If we want to closed paid invoices
if ($closepaidinvoices) {
$paiement = $invoice->getSommePaiement();
- $creditnotes=$invoice->getSumCreditNotesUsed();
+ $creditnotes = $invoice->getSumCreditNotesUsed();
//$creditnotes = 0;
- $deposits=$invoice->getSumDepositsUsed();
+ $deposits = $invoice->getSumDepositsUsed();
//$deposits = 0;
$alreadypayed = price2num($paiement + $creditnotes + $deposits, 'MT');
$remaintopay = price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits, 'MT');
@@ -712,7 +713,7 @@ class PaiementFourn extends Paiement
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
- $parameters = array('id'=>$this->id, 'getnomurl' => &$result);
+ $parameters = array('id' => $this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
@@ -783,7 +784,7 @@ class PaiementFourn extends Paiement
// Load file with numbering class (if found)
if (is_file($dir.$file) && is_readable($dir.$file)) {
- $mybool |= include_once $dir.$file;
+ $mybool = (include_once $dir.$file) || $mybool;
}
}
@@ -798,7 +799,7 @@ class PaiementFourn extends Paiement
// Load file with numbering class (if found)
if (is_file($dir.$file) && is_readable($dir.$file)) {
- $mybool |= include_once $dir.$file;
+ $mybool = (include_once $dir.$file) || $mybool;
}
}
}
diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php
index 90da456e660..f9ec2a67379 100644
--- a/htdocs/fourn/commande/dispatch.php
+++ b/htdocs/fourn/commande/dispatch.php
@@ -669,8 +669,8 @@ if ($id > 0 || !empty($ref)) {
$products_dispatched = array();
$sql = "SELECT l.rowid, cfd.fk_product, sum(cfd.qty) as qty";
$sql .= " FROM ".MAIN_DB_PREFIX."receptiondet_batch as cfd";
- $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."commande_fournisseurdet as l on l.rowid = cfd.fk_commandefourndet";
- $sql .= " WHERE cfd.fk_commande = ".((int) $object->id);
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."commande_fournisseurdet as l on l.rowid = cfd.fk_elementdet";
+ $sql .= " WHERE cfd.fk_element = ".((int) $object->id);
$sql .= " GROUP BY l.rowid, cfd.fk_product";
$resql = $db->query($sql);
@@ -1172,12 +1172,12 @@ if ($id > 0 || !empty($ref)) {
}
$sql .= " FROM ".MAIN_DB_PREFIX."product as p,";
$sql .= " ".MAIN_DB_PREFIX."receptiondet_batch as cfd";
- $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."commande_fournisseurdet as cd ON cd.rowid = cfd.fk_commandefourndet";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."commande_fournisseurdet as cd ON cd.rowid = cfd.fk_elementdet";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."entrepot as e ON cfd.fk_entrepot = e.rowid";
if ($conf->reception->enabled) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."reception as r ON cfd.fk_reception = r.rowid";
}
- $sql .= " WHERE cfd.fk_commande = ".((int) $object->id);
+ $sql .= " WHERE cfd.fk_element = ".((int) $object->id);
$sql .= " AND cfd.fk_product = p.rowid";
$sql .= " ORDER BY cfd.rowid ASC";
diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php
index 1bab50ecddd..e42b0e326eb 100644
--- a/htdocs/fourn/commande/list.php
+++ b/htdocs/fourn/commande/list.php
@@ -10,6 +10,7 @@
* Copyright (C) 2018-2022 Charlene Benke
* Copyright (C) 2019 Nicolas Zabouri
* Copyright (C) 2021-2023 Alexandre Spangaro
+ * Copyright (C) 2024 MDW
*
* 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
@@ -211,6 +212,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
$object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
+'@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
$error = 0;
diff --git a/htdocs/fourn/facture/list-rec.php b/htdocs/fourn/facture/list-rec.php
index 62531e8a569..cfa3fbdc457 100644
--- a/htdocs/fourn/facture/list-rec.php
+++ b/htdocs/fourn/facture/list-rec.php
@@ -8,6 +8,7 @@
* Copyright (C) 2012 Cedric Salvador
* Copyright (C) 2015-2021 Alexandre Spangaro
* Copyright (C) 2016 Meziane Sof
+ * Copyright (C) 2024 MDW
*
* 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
@@ -159,6 +160,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
$object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
+'@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
if ($socid > 0) {
$tmpthirdparty = new Societe($db);
diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php
index 4772ddea4e8..6cf9a81433d 100644
--- a/htdocs/fourn/facture/list.php
+++ b/htdocs/fourn/facture/list.php
@@ -212,6 +212,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
$object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
+'@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
if (!isModEnabled('supplier_invoice')) {
accessforbidden();
diff --git a/htdocs/fourn/paiement/list.php b/htdocs/fourn/paiement/list.php
index aa328d13024..a354a15f3bc 100644
--- a/htdocs/fourn/paiement/list.php
+++ b/htdocs/fourn/paiement/list.php
@@ -12,6 +12,7 @@
* Copyright (C) 2018-2021 Frédéric France
* Copyright (C) 2020 Tobias Sekan
* Copyright (C) 2021 Ferran Marcet
+ * Copyright (C) 2024 MDW
*
* 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
@@ -107,6 +108,7 @@ $arrayfields = array(
'p.amount' => array('label' => "Amount", 'checked' => 1, 'position' => 70),
);
$arrayfields = dol_sort_array($arrayfields, 'position');
+'@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('paymentsupplierlist'));
diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php
index e5afa1e524a..6608cbbbb34 100644
--- a/htdocs/holiday/class/holiday.class.php
+++ b/htdocs/holiday/class/holiday.class.php
@@ -232,7 +232,7 @@ class Holiday extends CommonObject
$dir = dol_buildpath($reldir."core/modules/holiday/");
// Load file with numbering class (if found)
- $mybool |= @include_once $dir.$file;
+ $mybool = ((bool) @include_once $dir.$file) || $mybool;
}
if ($mybool === false) {
diff --git a/htdocs/hrm/class/evaluation.class.php b/htdocs/hrm/class/evaluation.class.php
index 7b551e80d99..0598a8cf46b 100644
--- a/htdocs/hrm/class/evaluation.class.php
+++ b/htdocs/hrm/class/evaluation.class.php
@@ -952,7 +952,7 @@ class Evaluation extends CommonObject
$dir = dol_buildpath($reldir."core/modules/hrm/");
// Load file with numbering class (if found)
- $mybool |= @include_once $dir.$file;
+ $mybool = ((bool) @include_once $dir.$file) || $mybool;
}
if ($mybool === false) {
diff --git a/htdocs/hrm/class/evaluationdet.class.php b/htdocs/hrm/class/evaluationdet.class.php
index 992e7fa4ce0..0c6b5149f8a 100644
--- a/htdocs/hrm/class/evaluationdet.class.php
+++ b/htdocs/hrm/class/evaluationdet.class.php
@@ -922,7 +922,7 @@ class EvaluationLine extends CommonObjectLine
$dir = dol_buildpath($reldir."core/modules/hrm/");
// Load file with numbering class (if found)
- $mybool |= @include_once $dir.$file;
+ $mybool = ((bool) @include_once $dir.$file) || $mybool;
}
if ($mybool === false) {
diff --git a/htdocs/hrm/class/job.class.php b/htdocs/hrm/class/job.class.php
index 5c2f34a5588..ec9cbea1b91 100644
--- a/htdocs/hrm/class/job.class.php
+++ b/htdocs/hrm/class/job.class.php
@@ -961,7 +961,7 @@ class Job extends CommonObject
$dir = dol_buildpath($reldir."core/modules/hrm/");
// Load file with numbering class (if found)
- $mybool |= @include_once $dir.$file;
+ $mybool = ((bool) @include_once $dir.$file) || $mybool;
}
if ($mybool === false) {
diff --git a/htdocs/hrm/class/position.class.php b/htdocs/hrm/class/position.class.php
index bcd91410fda..197ac19eb5b 100644
--- a/htdocs/hrm/class/position.class.php
+++ b/htdocs/hrm/class/position.class.php
@@ -1001,7 +1001,7 @@ class Position extends CommonObject
$dir = dol_buildpath($reldir . "core/modules/hrm/");
// Load file with numbering class (if found)
- $mybool |= @include_once $dir . $file;
+ $mybool = ((bool) @include_once $dir.$file) || $mybool;
}
if ($mybool === false) {
diff --git a/htdocs/hrm/class/skill.class.php b/htdocs/hrm/class/skill.class.php
index b6759336016..4ce76501127 100644
--- a/htdocs/hrm/class/skill.class.php
+++ b/htdocs/hrm/class/skill.class.php
@@ -1001,7 +1001,7 @@ class Skill extends CommonObject
$dir = dol_buildpath($reldir."core/modules/hrm/");
// Load file with numbering class (if found)
- $mybool |= @include_once $dir.$file;
+ $mybool = ((bool) @include_once $dir.$file) || $mybool;
}
if ($mybool === false) {
diff --git a/htdocs/hrm/class/skilldet.class.php b/htdocs/hrm/class/skilldet.class.php
index 6c02ca26c50..9190c413bcc 100644
--- a/htdocs/hrm/class/skilldet.class.php
+++ b/htdocs/hrm/class/skilldet.class.php
@@ -889,7 +889,7 @@ class Skilldet extends CommonObjectLine
$dir = dol_buildpath($reldir."core/modules/hrm/");
// Load file with numbering class (if found)
- $mybool |= @include_once $dir.$file;
+ $mybool = ((bool) @include_once $dir.$file) || $mybool;
}
if ($mybool === false) {
diff --git a/htdocs/hrm/class/skillrank.class.php b/htdocs/hrm/class/skillrank.class.php
index 3cde6ae6476..7640049c4f5 100644
--- a/htdocs/hrm/class/skillrank.class.php
+++ b/htdocs/hrm/class/skillrank.class.php
@@ -965,7 +965,7 @@ class SkillRank extends CommonObject
$dir = dol_buildpath($reldir."core/modules/hrm/");
// Load file with numbering class (if found)
- $mybool |= @include_once $dir.$file;
+ $mybool = ((bool) @include_once $dir.$file) || $mybool;
}
if ($mybool === false) {
diff --git a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql
index 9b8183b49c4..f0e6b72901c 100644
--- a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql
+++ b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql
@@ -283,3 +283,6 @@ ALTER TABLE llx_societe ADD COLUMN fk_parent integer NULL;
ALTER TABLE llx_expeditiondet ADD COLUMN fk_element integer;
ALTER TABLE llx_expeditiondet ADD COLUMN element_type varchar(50) DEFAULT 'order' NOT NULL;
+
+ALTER TABLE llx_receptiondet_batch CHANGE COLUMN fk_commande fk_element integer;
+ALTER TABLE llx_receptiondet_batch CHANGE COLUMN fk_commandefourndet fk_elementdet integer;
diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql
index 6b48ef5ac16..2c0e43dc3fe 100644
--- a/htdocs/install/mysql/migration/repair.sql
+++ b/htdocs/install/mysql/migration/repair.sql
@@ -1,10 +1,10 @@
--
-- Script to repair some fatal errors due to database corruption
--- when current version is 2.6.0 or higher.
+-- when current version is 2.6.0 or higher.
--
--- Replace xxx with your IP Address
+-- Replace xxx with your IP Address
-- bind-address = xxx.xxx.xxx.xxx
-- CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'mypass';
-- CREATE USER 'myuser'@'%' IDENTIFIED BY 'mypass';
@@ -65,10 +65,10 @@
-- VMYSQL4.1 INSERT IGNORE INTO llx_product_lot (entity, fk_product, batch, eatby, sellby, datec, fk_user_creat, fk_user_modif) SELECT DISTINCT e.entity, ps.fk_product, pb.batch, pb.eatby, pb.sellby, pb.tms, e.fk_user_author, e.fk_user_author from llx_product_batch as pb, llx_product_stock as ps, llx_entrepot as e WHERE pb.fk_product_stock = ps.rowid AND ps.fk_entrepot = e.rowid;
-- -- a tester VPGSQL9.5 INSERT IGNORE INTO llx_product_lot (entity, fk_product, batch, eatby, sellby, datec, fk_user_creat, fk_user_modif) SELECT DISTINCT e.entity, ps.fk_product, pb.batch, pb.eatby, pb.sellby, pb.tms, e.fk_user_author, e.fk_user_author from llx_product_batch as pb, llx_product_stock as ps, llx_entrepot as e WHERE pb.fk_product_stock = ps.rowid AND ps.fk_entrepot = e.rowid ON CONFLICT DO NOTHING;
-- -- avant 9.5 faire en variant x pour qu'au 2eme passage, le premier doublon soit dans la tabel cible
--- -- INSERT INTO llx_product_lot (entity, fk_product, batch, eatby, sellby, datec, fk_user_creat, fk_user_modif)
--- -- SELECT DISTINCT e.entity, ps.fk_product, pb.batch, pb.eatby, pb.sellby, pb.tms, e.fk_user_author, e.fk_user_author
+-- -- INSERT INTO llx_product_lot (entity, fk_product, batch, eatby, sellby, datec, fk_user_creat, fk_user_modif)
+-- -- SELECT DISTINCT e.entity, ps.fk_product, pb.batch, pb.eatby, pb.sellby, pb.tms, e.fk_user_author, e.fk_user_author
-- -- from llx_product_batch as pb, llx_product_stock as ps, llx_entrepot as e
--- -- WHERE pb.fk_product_stock = ps.rowid AND ps.fk_entrepot = e.rowid
+-- -- WHERE pb.fk_product_stock = ps.rowid AND ps.fk_entrepot = e.rowid
-- -- AND NOT EXISTS (SELECT 1 FROM llx_product_lot as b WHERE b.fk_product=ps.fk_product and pb.batch=b.batch) LIMIT x
@@ -145,13 +145,13 @@ update llx_product_batch set batch = '' where batch = 'Non défini';
update llx_stock_mouvement set batch = null where batch = 'Non défini';
update llx_stock_mouvement set batch = null where batch = 'Non défini';
-DELETE FROM llx_product_lot WHERE fk_product NOT IN (select rowid from llx_product);
-DELETE FROM llx_product_stock WHERE fk_product NOT IN (select rowid from llx_product);
+DELETE FROM llx_product_lot WHERE fk_product NOT IN (select rowid from llx_product);
+DELETE FROM llx_product_stock WHERE fk_product NOT IN (select rowid from llx_product);
DELETE FROM llx_product_stock WHERE reel = 0 AND rowid NOT IN (SELECT fk_product_stock FROM llx_product_batch as pb);
--- Merge splitted lines into one in table llx_product_batch
+-- Merge splitted lines into one in table llx_product_batch
DROP TABLE tmp_llx_product_batch;
DROP TABLE tmp_llx_product_batch2;
CREATE TABLE tmp_llx_product_batch AS select fk_product_stock, eatby, sellby, batch, SUM(qty) as qty, COUNT(rowid) as nb FROM llx_product_batch GROUP BY fk_product_stock, eatby, sellby, batch HAVING COUNT(rowid) > 1;
@@ -175,7 +175,7 @@ delete from llx_product_association where fk_product_fils NOT IN (select rowid f
-- Fix: delete category child with no category parent.
drop table tmp_categorie;
-create table tmp_categorie as select * from llx_categorie;
+create table tmp_categorie as select * from llx_categorie;
-- select * from llx_categorie where fk_parent not in (select rowid from tmp_categorie) and fk_parent is not null and fk_parent <> 0;
delete from llx_categorie where fk_parent not in (select rowid from tmp_categorie) and fk_parent is not null and fk_parent <> 0;
drop table tmp_categorie;
@@ -397,7 +397,7 @@ update llx_facturedet set product_type = 1 where product_type = 2;
update llx_propal set fk_statut = 1 where fk_statut = -1;
-delete from llx_commande_fournisseur_dispatch where fk_commandefourndet = 0 or fk_commandefourndet IS NULL;
+delete from llx_receptiondet_batch where fk_elementdet = 0 or fk_elementdet IS NULL;
delete from llx_menu where menu_handler = 'smartphone';
@@ -408,7 +408,7 @@ update llx_expedition set date_valid = NOW() where fk_statut = 1 and date_valid
-- Detect bad consistency between duraction_effective of a task and sum of time of tasks
-- select pt.rowid, pt.duration_effective, SUM(ptt.element_duration) as y from llx_projet_task as pt, llx_element_time as ptt where ptt.fk_element = pt.rowid and ptt.elementtype = 'task' group by pt.rowid, pt.duration_effective having pt.duration_effective <> y;
update llx_projet_task as pt set pt.duration_effective = (select SUM(ptt.element_duration) as y from llx_element_time as ptt where ptt.fk_element = pt.rowid and ptt.elementtype = 'task') where pt.duration_effective <> (select SUM(ptt.element_duration) as y from llx_element_time as ptt where ptt.fk_element = pt.rowid and ptt.elementtype = 'task');
-
+
-- Remove duplicate of shipment mode (keep the one with tracking defined)
drop table tmp_c_shipment_mode;
@@ -443,9 +443,9 @@ UPDATE llx_expensereport_det SET fk_code_ventilation = 0 WHERE fk_code_ventilati
-- Clean product prices
---delete from llx_product_price where date_price between '2017-04-20 06:51:00' and '2017-04-20 06:51:05';
+--delete from llx_product_price where date_price between '2017-04-20 06:51:00' and '2017-04-20 06:51:05';
-- Set product prices into llx_product with last price into llx_product_prices
---update llx_product as p set
+--update llx_product as p set
-- p.price = (select pp.price from llx_product_price as pp where pp.price_level = 1 and pp.fk_product = p.rowid order by pp.tms desc limit 1),
-- p.price_ttc = (select pp.price_ttc from llx_product_price as pp where pp.price_level = 1 and pp.fk_product = p.rowid order by pp.tms desc limit 1),
-- p.price_min = (select pp.price_min from llx_product_price as pp where pp.price_level = 1 and pp.fk_product = p.rowid order by pp.tms desc limit 1),
@@ -503,7 +503,7 @@ UPDATE llx_chargesociales SET date_creation = tms WHERE date_creation IS NULL;
--ALTER TABLE llx_table modify column columnname datetime DEFAULT CURRENT_TIMESTAMP;
--- Backport a change of value into the hourly rate.
+-- Backport a change of value into the hourly rate.
-- update llx_element_time as ptt set ptt.thm = (SELECT thm from llx_user as u where ptt.fk_user = u.rowid) where (ptt.thm is null)
@@ -513,14 +513,14 @@ update llx_facturedet set product_type = 1 where product_type = 0 AND fk_product
update llx_facture_fourn_det set product_type = 0 where product_type = 1 AND fk_product > 0 AND fk_product IN (SELECT rowid FROM llx_product WHERE fk_product_type = 0);
update llx_facture_fourn_det set product_type = 1 where product_type = 0 AND fk_product > 0 AND fk_product IN (SELECT rowid FROM llx_product WHERE fk_product_type = 1);
-
+
DELETE FROM llx_mrp_production where qty = 0;
UPDATE llx_accounting_bookkeeping set date_creation = tms where date_creation IS NULL;
-
+
-- UPDATE llx_contratdet set label = NULL WHERE label IS NOT NULL;
-- UPDATE llx_facturedet_rec set label = NULL WHERE label IS NOT NULL;
@@ -528,21 +528,21 @@ UPDATE llx_accounting_bookkeeping set date_creation = tms where date_creation IS
--Fix bad sign on multicompany column for customer invoice lines
UPDATE llx_facturedet SET multicurrency_subprice = -multicurrency_subprice WHERE ((multicurrency_subprice < 0 and subprice > 0) OR (multicurrency_subprice > 0 and subprice < 0));
UPDATE llx_facturedet SET multicurrency_total_ht = -multicurrency_total_ht WHERE ((multicurrency_total_ht < 0 and total_ht > 0) OR (multicurrency_total_ht > 0 and total_ht < 0));
-UPDATE llx_facturedet SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and total_tva > 0) OR (multicurrency_total_tva > 0 and total_tva < 0));
-UPDATE llx_facturedet SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0));
+UPDATE llx_facturedet SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and total_tva > 0) OR (multicurrency_total_tva > 0 and total_tva < 0));
+UPDATE llx_facturedet SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0));
--Fix bad sign on multicompany column for customer invoices
-UPDATE llx_facture SET multicurrency_total_ht = -multicurrency_total_ht WHERE ((multicurrency_total_ht < 0 and total_ht > 0) OR (multicurrency_total_ht > 0 and total_ht < 0));
-UPDATE llx_facture SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and total_tva > 0) OR (multicurrency_total_tva > 0 and total_tva < 0));
-UPDATE llx_facture SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0));
+UPDATE llx_facture SET multicurrency_total_ht = -multicurrency_total_ht WHERE ((multicurrency_total_ht < 0 and total_ht > 0) OR (multicurrency_total_ht > 0 and total_ht < 0));
+UPDATE llx_facture SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and total_tva > 0) OR (multicurrency_total_tva > 0 and total_tva < 0));
+UPDATE llx_facture SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0));
--Fix bad sign on multicurrency column for supplier invoice lines
UPDATE llx_facture_fourn_det SET multicurrency_subprice = -multicurrency_subprice WHERE ((multicurrency_subprice < 0 and pu_ht > 0) OR (multicurrency_subprice > 0 and pu_ht < 0));
UPDATE llx_facture_fourn_det SET multicurrency_total_ht = -multicurrency_total_ht WHERE ((multicurrency_total_ht < 0 and total_ht > 0) OR (multicurrency_total_ht > 0 and total_ht < 0));
-UPDATE llx_facture_fourn_det SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and tva > 0) OR (multicurrency_total_tva > 0 and tva < 0));
-UPDATE llx_facture_fourn_det SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0));
+UPDATE llx_facture_fourn_det SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and tva > 0) OR (multicurrency_total_tva > 0 and tva < 0));
+UPDATE llx_facture_fourn_det SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0));
--Fix bad sign on multicompany column for customer invoices
-UPDATE llx_facture_fourn SET multicurrency_total_ht = -multicurrency_total_ht WHERE ((multicurrency_total_ht < 0 and total_ht > 0) OR (multicurrency_total_ht > 0 and total_ht < 0));
-UPDATE llx_facture_fourn SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and total_tva > 0) OR (multicurrency_total_tva > 0 and total_tva < 0));
-UPDATE llx_facture_fourn SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0));
+UPDATE llx_facture_fourn SET multicurrency_total_ht = -multicurrency_total_ht WHERE ((multicurrency_total_ht < 0 and total_ht > 0) OR (multicurrency_total_ht > 0 and total_ht < 0));
+UPDATE llx_facture_fourn SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and total_tva > 0) OR (multicurrency_total_tva > 0 and total_tva < 0));
+UPDATE llx_facture_fourn SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0));
UPDATE llx_facturedet SET situation_percent = 100 WHERE situation_percent IS NULL AND fk_prev_id IS NULL;
@@ -558,7 +558,7 @@ UPDATE llx_facturedet SET situation_percent = 100 WHERE situation_percent IS NUL
--update llx_facture set paye = 1, fk_statut = 2 where rowid in (select rowid from tmp_invoice_deposit_mark_as_available);
--- TODO We should fix multicurrency_amount that are empty into llx_societe_remise_except, but we can't because we don't know what is the rate
+-- TODO We should fix multicurrency_amount that are empty into llx_societe_remise_except, but we can't because we don't know what is the rate
-- We may retreive info fro minvoice line by using fk_facture_line or fk_facture_supplier_line
-- select * from llx_societe_remise_except where multicurrency_amount_ht = 0 and amount_ht <> 0;
@@ -586,7 +586,7 @@ DELETE FROM llx_rights_def WHERE module = 'hrm' AND perms = 'employee';
-- Sequence to fix the content of llx_bank.amount_main_currency (value was empty and should not for payment on bank account with a different currency so when amount_main_currency is different than amount)
-- Note: amount is amount in the currency of the bank account
-- Note: pamount is always amount into the main currency
--- Note: pmulticurrencyamount is in the currency of invoice
+-- Note: pmulticurrencyamount is in the currency of invoice
-- Note: amount_main_currency must be NULL or amount in main currency of company (we set it when the currency of the bank account differs from main currency)
-- DROP TABLE tmp_bank;
-- CREATE TABLE tmp_bank SELECT b.rowid, b.amount, p.rowid as pid, p.amount as pamount, p.multicurrency_amount as pmulticurrencyamount, b.datec FROM llx_bank as b INNER JOIN llx_bank_url as bu ON bu.fk_bank=b.rowid AND bu.type = 'payment' INNER JOIN llx_paiement as p ON bu.url_id = p.rowid WHERE p.multicurrency_amount <> 0 AND p.multicurrency_amount <> p.amount;
diff --git a/htdocs/install/mysql/tables/llx_receptiondet_batch.key.sql b/htdocs/install/mysql/tables/llx_receptiondet_batch.key.sql
index 0c92a0d8302..4470247061b 100644
--- a/htdocs/install/mysql/tables/llx_receptiondet_batch.key.sql
+++ b/htdocs/install/mysql/tables/llx_receptiondet_batch.key.sql
@@ -20,4 +20,4 @@ ALTER TABLE llx_receptiondet_batch ADD INDEX idx_receptiondet_batch_fk_commande
ALTER TABLE llx_receptiondet_batch ADD INDEX idx_receptiondet_batch_fk_reception (fk_reception);
ALTER TABLE llx_receptiondet_batch ADD CONSTRAINT fk_receptiondet_batch_fk_reception FOREIGN KEY (fk_reception) REFERENCES llx_reception (rowid);
ALTER TABLE llx_receptiondet_batch ADD INDEX idx_receptiondet_batch_fk_product (fk_product);
-ALTER TABLE llx_receptiondet_batch ADD INDEX idx_receptiondet_batch_fk_commandefourndet (fk_commandefourndet);
+ALTER TABLE llx_receptiondet_batch ADD INDEX idx_receptiondet_batch_fk_elementdet (fk_elementdet);
diff --git a/htdocs/install/mysql/tables/llx_receptiondet_batch.sql b/htdocs/install/mysql/tables/llx_receptiondet_batch.sql
index f5f7f7deb39..e8b414510d1 100644
--- a/htdocs/install/mysql/tables/llx_receptiondet_batch.sql
+++ b/htdocs/install/mysql/tables/llx_receptiondet_batch.sql
@@ -28,8 +28,8 @@ create table llx_receptiondet_batch
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
fk_reception integer DEFAULT NULL, -- ID of parent object
- fk_commande integer, -- ID of main source object. TODO should be renamed into fk_element
- fk_commandefourndet integer, -- ID of line of main source object. TODO should be renamed into fk_elementdet
+ fk_element integer, -- ID of main source object. TODO should be renamed into fk_element
+ fk_elementdet integer, -- ID of line of main source object. TODO should be renamed into fk_elementdet
element_type varchar(50) DEFAULT 'supplier_order' NOT NULL, -- Type of source object ('supplier_order', ...)
fk_product integer,
qty float, -- qty to move
diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php
index 51d0164541a..d9c5a808bb5 100644
--- a/htdocs/install/repair.php
+++ b/htdocs/install/repair.php
@@ -1488,7 +1488,7 @@ if ($ok && GETPOST('repair_link_dispatch_lines_supplier_order_lines')) {
echo '
Repair llx_receptiondet_batch.fk_commandefourndet
';
echo '
Repair in progress. This may take a while.
';
- $sql_dispatch = 'SELECT * FROM '.MAIN_DB_PREFIX.'receptiondet_batch WHERE COALESCE(fk_commandefourndet, 0) = 0';
+ $sql_dispatch = 'SELECT * FROM '.MAIN_DB_PREFIX.'receptiondet_batch WHERE COALESCE(fk_elementdet, 0) = 0';
$db->begin();
$resql_dispatch = $db->query($sql_dispatch);
$n_processed_rows = 0;
@@ -1529,12 +1529,12 @@ if ($ok && GETPOST('repair_link_dispatch_lines_supplier_order_lines')) {
$qty_for_line = min($remaining_qty, $obj_line->qty);
if ($first_iteration) {
$sql_attach = 'UPDATE '.MAIN_DB_PREFIX.'receptiondet_batch';
- $sql_attach .= ' SET fk_commandefourndet = '.((int) $obj_line->rowid).', qty = '.((float) $qty_for_line);
+ $sql_attach .= ' SET fk_elementdet = '.((int) $obj_line->rowid).', qty = '.((float) $qty_for_line);
$sql_attach .= ' WHERE rowid = '.((int) $obj_dispatch->rowid);
$first_iteration = false;
} else {
$sql_attach_values = array(
- (string) ((int) $obj_dispatch->fk_commande),
+ (string) ((int) $obj_dispatch->fk_element),
(string) ((int) $obj_dispatch->fk_product),
(string) ((int) $obj_line->rowid),
(string) ((float) $qty_for_line),
@@ -1551,8 +1551,8 @@ if ($ok && GETPOST('repair_link_dispatch_lines_supplier_order_lines')) {
$sql_attach_values = implode(', ', $sql_attach_values);
$sql_attach = 'INSERT INTO '.MAIN_DB_PREFIX.'receptiondet_batch';
- $sql_attach .= ' (fk_commande, fk_product, fk_commandefourndet, qty, fk_entrepot, fk_user, datec, comment, status, tms, batch, eatby, sellby)';
- $sql_attach .= " VALUES (".$sql_attach_values.")";
+ $sql_attach .= ' (fk_element, fk_product, fk_elementdet, qty, fk_entrepot, fk_user, datec, comment, status, tms, batch, eatby, sellby)';
+ $sql_attach .= " VALUES (".$sql_attach_values.")"; // The string is already sanitized
}
if ($repair_link_dispatch_lines_supplier_order_lines == 'confirmed') {
diff --git a/htdocs/intracommreport/list.php b/htdocs/intracommreport/list.php
index 132163b1f89..cbdd0838d0c 100644
--- a/htdocs/intracommreport/list.php
+++ b/htdocs/intracommreport/list.php
@@ -1,6 +1,7 @@
* Copyright (C) 2019-2020 Open-DSI
+ * Copyright (C) 2024 MDW
*
* 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
@@ -143,6 +144,7 @@ if (isset($extrafields->attributes[$object->table_element]['label']) && is_array
$object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
+'@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
// Security check
if ($search_type == '0') {
diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php
index 1bb1040553a..402e41c7d76 100644
--- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php
+++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php
@@ -1027,7 +1027,7 @@ class KnowledgeRecord extends CommonObject
$dir = dol_buildpath($reldir."core/modules/knowledgemanagement/");
// Load file with numbering class (if found)
- $mybool |= @include_once $dir.$file;
+ $mybool = ((bool) @include_once $dir.$file) || $mybool;
}
if ($mybool === false) {
diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang
index cee9b17d6c0..d8b67a715cd 100644
--- a/htdocs/langs/en_US/accountancy.lang
+++ b/htdocs/langs/en_US/accountancy.lang
@@ -178,6 +178,7 @@ ACCOUNTING_SELL_JOURNAL=Sales journal - sales and returns
ACCOUNTING_PURCHASE_JOURNAL=Purchase journal - purchase and returns
ACCOUNTING_BANK_JOURNAL=Cash journal - receipts and disbursements
ACCOUNTING_EXPENSEREPORT_JOURNAL=Expense report journal
+ACCOUNTING_ACCOUNT_EXPENSEREPORT=Default accounting account for "expense reports"
ACCOUNTING_MISCELLANEOUS_JOURNAL=General journal
ACCOUNTING_HAS_NEW_JOURNAL=Has new Journal
ACCOUNTING_INVENTORY_JOURNAL=Inventory journal
diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang
index 136ee7edb0b..4c1a5a08f0a 100644
--- a/htdocs/langs/en_US/mails.lang
+++ b/htdocs/langs/en_US/mails.lang
@@ -187,7 +187,6 @@ EmailOptedOut=Email owner has requested to not contact him with this email anymo
EvenUnsubscribe=Include opt-out emails
EvenUnsubscribeDesc=Include opt-out emails when you select emails as targets. Useful for mandatory service emails for example.
XEmailsDoneYActionsDone=%s emails pre-qualified, %s emails successfully processed (for %s record/actions done)
-helpWithAi=Generate message from AI
YouCanMakeSomeInstructionForEmail=You can make some instructions for your Email (Example: generate image in email template...)
ModelTemplate=Email template
YouCanChooseAModelForYouMailContent= You can choose one of template models or generate one with AI
diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang
index b61db89919d..0f0faf90c05 100644
--- a/htdocs/langs/en_US/ticket.lang
+++ b/htdocs/langs/en_US/ticket.lang
@@ -69,7 +69,6 @@ Read=Read
Assigned=Assigned
NeedMoreInformation=Waiting for reporter feedback
NeedMoreInformationShort=Waiting for feedback
-TicketAnswered=Answered
Waiting=Waiting
SolvedClosed=Solved
Deleted=Deleted
@@ -135,7 +134,7 @@ TicketsActivatePublicInterfaceHelp=Public interface allow any visitors to create
TicketsAutoAssignTicket=Automatically assign the user who created the ticket
TicketsAutoAssignTicketHelp=When creating a ticket, the user can be automatically assigned to the ticket.
TicketNumberingModules=Tickets numbering module
-TicketsModelModule=Document templates for tickets
+TicketsModelModule=Document templates for tickets
TicketNotifyTiersAtCreation=Notify third party at creation
TicketsDisableCustomerEmail=Always disable emails when a ticket is created from public interface
TicketsPublicNotificationNewMessage=Send email(s) when a new message/comment is added to a ticket
diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php
index c8589a3f4ba..c82f54d4568 100644
--- a/htdocs/mrp/class/mo.class.php
+++ b/htdocs/mrp/class/mo.class.php
@@ -1020,7 +1020,7 @@ class Mo extends CommonObject
$dir = dol_buildpath($reldir."core/modules/mrp/");
// Load file with numbering class (if found)
- $mybool |= @include_once $dir.$file;
+ $mybool = ((bool) @include_once $dir.$file) || $mybool;
}
if ($mybool === false) {
diff --git a/htdocs/multicurrency/multicurrency_rate.php b/htdocs/multicurrency/multicurrency_rate.php
index 836b3de06de..430dda9ec0a 100644
--- a/htdocs/multicurrency/multicurrency_rate.php
+++ b/htdocs/multicurrency/multicurrency_rate.php
@@ -12,6 +12,7 @@
* Copyright (C) 2015 Jean-François Ferry
* Copyright (C) 2016 Ferran Marcet
* Copyright (C) 2023 Lenin Rivas
+ * Copyright (C) 2024 MDW
*
* 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
@@ -93,23 +94,24 @@ if (empty($action)) {
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array(
- 'cr.date_sync'=>"date_sync",
- 'cr.rate'=>"rate",
- 'cr.rate_indirect'=>"rate_indirect",
- 'm.code'=>"code",
+ 'cr.date_sync' => "date_sync",
+ 'cr.rate' => "rate",
+ 'cr.rate_indirect' => "rate_indirect",
+ 'm.code' => "code",
);
// Definition of fields for lists
$arrayfields = array(
- 'cr.date_sync'=>array('label'=>'Date', 'checked'=>1),
- 'cr.rate'=>array('label'=>'Rate', 'checked'=>1),
- 'cr.rate_indirect'=>array('label'=>'RateIndirect', 'checked'=>0, 'enabled'=>(!getDolGlobalString('MULTICURRENCY_USE_RATE_INDIRECT') ? 0 : 1)),
- 'm.code'=>array('label'=>'Code', 'checked'=>1),
+ 'cr.date_sync' => array('label' => 'Date', 'checked' => 1),
+ 'cr.rate' => array('label' => 'Rate', 'checked' => 1),
+ 'cr.rate_indirect' => array('label' => 'RateIndirect', 'checked' => 0, 'enabled' => (!getDolGlobalString('MULTICURRENCY_USE_RATE_INDIRECT') ? 0 : 1)),
+ 'm.code' => array('label' => 'Code', 'checked' => 1),
);
$object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
+'@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
// Access control
// TODO Open this page to a given permission so a sale representative can modify change rates. Permission should be added into module multicurrency.
@@ -242,7 +244,7 @@ if (empty($reshook)) {
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
$sall = "";
$search_date_sync = "";
- $search_date_sync_end="";
+ $search_date_sync_end = "";
$search_rate = "";
$search_code = "";
$search_array_options = array();
@@ -403,13 +405,13 @@ if ($resql) {
$param = "&search_date_sync=".$search_date_sync;
}
if ($search_date_sync_end) {
- $param="&search_date_sync_end=".$search_date_sync_end;
+ $param = "&search_date_sync_end=".$search_date_sync_end;
}
if ($search_rate) {
$param = "&search_rate=".urlencode($search_rate);
}
if ($search_code != '') {
- $param.="&search_code=".urlencode($search_code);
+ $param .= "&search_code=".urlencode($search_code);
}
// Add $param from extra fields
@@ -504,7 +506,7 @@ if ($resql) {
}
// Fields from hook
- $parameters = array('arrayfields'=>$arrayfields);
+ $parameters = array('arrayfields' => $arrayfields);
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
@@ -533,7 +535,7 @@ if ($resql) {
}
// Hook fields
- $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
+ $parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
@@ -669,5 +671,5 @@ if ($resql) {
}
- llxFooter();
- $db->close();
+llxFooter();
+$db->close();
diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php
index 7d26d35cb44..68ffaeb291c 100644
--- a/htdocs/partnership/class/partnership.class.php
+++ b/htdocs/partnership/class/partnership.class.php
@@ -1230,7 +1230,7 @@ class Partnership extends CommonObject
$dir = dol_buildpath($reldir."core/modules/partnership/");
// Load file with numbering class (if found)
- $mybool |= @include_once $dir.$file;
+ $mybool = ((bool) @include_once $dir.$file) || $mybool;
}
if ($mybool === false) {
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index cca1aa2b4bd..040f4d77183 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -1898,13 +1898,13 @@ class Product extends CommonObject
while ($obj = $this->db->fetch_object($result)) {
//print 'lang='.$obj->lang.' current='.$current_lang.' ';
if ($obj->lang == $current_lang) { // si on a les traduct. dans la langue courante on les charge en infos principales.
- $this->label = $obj->label;
+ $this->label = $obj->label;
$this->description = $obj->description;
- $this->other = $obj->other;
+ $this->other = $obj->other;
}
- $this->multilangs["$obj->lang"]["label"] = $obj->label;
- $this->multilangs["$obj->lang"]["description"] = $obj->description;
- $this->multilangs["$obj->lang"]["other"] = $obj->other;
+ $this->multilangs[(string) $obj->lang]["label"] = $obj->label;
+ $this->multilangs[(string) $obj->lang]["description"] = $obj->description;
+ $this->multilangs[(string) $obj->lang]["other"] = $obj->other;
}
return 1;
} else {
@@ -3501,7 +3501,7 @@ class Product extends CommonObject
if (!$user->hasRight('societe', 'client', 'voir') && !$forVirtualStock) {
$sql .= ", ".$this->db->prefix()."societe_commerciaux as sc";
}
- $sql .= " WHERE cf.rowid = fd.fk_commande";
+ $sql .= " WHERE cf.rowid = fd.fk_element";
$sql .= " AND cf.fk_soc = s.rowid";
$sql .= " AND cf.entity IN (".getEntity($forVirtualStock && getDolGlobalString('STOCK_CALCULATE_VIRTUAL_STOCK_TRANSVERSE_MODE') ? 'stock' : 'supplier_order').")";
$sql .= " AND fd.fk_product = ".((int) $this->id);
diff --git a/htdocs/product/class/productfournisseurprice.class.php b/htdocs/product/class/productfournisseurprice.class.php
index 6e3b15405d0..93666b0431b 100644
--- a/htdocs/product/class/productfournisseurprice.class.php
+++ b/htdocs/product/class/productfournisseurprice.class.php
@@ -824,7 +824,7 @@ class ProductFournisseurPrice extends CommonObject
$dir = dol_buildpath($reldir."core/modules/buypricehistory/");
// Load file with numbering class (if found)
- $mybool |= @include_once $dir.$file;
+ $mybool = ((bool) @include_once $dir.$file) || $mybool;
}
if ($mybool === false) {
diff --git a/htdocs/product/list.php b/htdocs/product/list.php
index 7d387457b23..d7f5d7450ba 100644
--- a/htdocs/product/list.php
+++ b/htdocs/product/list.php
@@ -308,6 +308,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
$object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
+'@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
// Security check
if ($search_type == '0') {
diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php
index 3d46b4ff41e..edbf9be17b8 100644
--- a/htdocs/product/stock/class/productlot.class.php
+++ b/htdocs/product/stock/class/productlot.class.php
@@ -855,7 +855,7 @@ class Productlot extends CommonObject
$sql = "SELECT COUNT(DISTINCT cf.fk_soc) as nb_customers, COUNT(DISTINCT cf.rowid) as nb,";
$sql .= " COUNT(cfd.rowid) as nb_rows, SUM(cfdi.qty) as qty";
$sql .= " FROM ".$this->db->prefix()."receptiondet_batch as cfdi";
- $sql .= " INNER JOIN ".$this->db->prefix()."commande_fournisseurdet as cfd ON (cfd.rowid = cfdi.fk_commandefourndet)";
+ $sql .= " INNER JOIN ".$this->db->prefix()."commande_fournisseurdet as cfd ON (cfd.rowid = cfdi.fk_elementdet)";
$sql .= " INNER JOIN ".$this->db->prefix()."commande_fournisseur as cf ON (cf.rowid = cfd.fk_commande)";
// $sql .= ", ".$this->db->prefix()."societe as s";
if (!$user->hasRight('societe', 'client', 'voir')) {
diff --git a/htdocs/product/stock/movement_card.php b/htdocs/product/stock/movement_card.php
index eae9deb3ef0..ae3f0f0f621 100644
--- a/htdocs/product/stock/movement_card.php
+++ b/htdocs/product/stock/movement_card.php
@@ -973,10 +973,10 @@ if ($resql) {
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (!empty($arrayfields['m.datec']['checked'])) {
- print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
+ print_liste_field_titre($arrayfields['m.datec']['label'], $_SERVER["PHP_SELF"], "m.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
}
if (!empty($arrayfields['m.tms']['checked'])) {
- print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
+ print_liste_field_titre($arrayfields['m.tms']['label'], $_SERVER["PHP_SELF"], "m.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
}
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
print "
\n";
diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php
index 9a054d18375..34c08a3186f 100644
--- a/htdocs/product/stock/movement_list.php
+++ b/htdocs/product/stock/movement_list.php
@@ -1365,10 +1365,10 @@ $parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $warehouse, $action); // Note that $action and $warehouse may have been modified by hook
print $hookmanager->resPrint;
if (!empty($arrayfields['m.datec']['checked'])) {
- print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
+ print_liste_field_titre($arrayfields['m.datec']['label'], $_SERVER["PHP_SELF"], "m.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
}
if (!empty($arrayfields['m.tms']['checked'])) {
- print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
+ print_liste_field_titre($arrayfields['m.tms']['label'], $_SERVER["PHP_SELF"], "m.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
}
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
diff --git a/htdocs/product/stock/stats/commande_fournisseur.php b/htdocs/product/stock/stats/commande_fournisseur.php
index e179a65e1e1..a2e40c1db92 100644
--- a/htdocs/product/stock/stats/commande_fournisseur.php
+++ b/htdocs/product/stock/stats/commande_fournisseur.php
@@ -224,7 +224,7 @@ if ($id > 0 || !empty($ref)) {
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."commande_fournisseur as cf ON (cf.fk_soc = s.rowid)";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."commande_fournisseurdet as cfd ON (cfd.fk_commande = cf.rowid)";
- $sql .= " INNER JOIN ".MAIN_DB_PREFIX."receptiondet_batch as cfdi ON (cfdi.fk_commandefourndet = cfd.rowid)";
+ $sql .= " INNER JOIN ".MAIN_DB_PREFIX."receptiondet_batch as cfdi ON (cfdi.fk_elementdet = cfd.rowid)";
if (!$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
diff --git a/htdocs/product/stock/stocktransfer/class/stocktransfer.class.php b/htdocs/product/stock/stocktransfer/class/stocktransfer.class.php
index 4bf107d58f3..a8e1267175d 100644
--- a/htdocs/product/stock/stocktransfer/class/stocktransfer.class.php
+++ b/htdocs/product/stock/stocktransfer/class/stocktransfer.class.php
@@ -975,7 +975,7 @@ class StockTransfer extends CommonObject
$dir = dol_buildpath($reldir."core/modules/stocktransfer/");
// Load file with numbering class (if found)
- $mybool |= @include_once $dir.$file;
+ $mybool = ((bool) @include_once $dir.$file) || $mybool;
}
if ($mybool === false) {
diff --git a/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php b/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php
index ac930e58b94..cd77a955806 100644
--- a/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php
+++ b/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php
@@ -939,7 +939,7 @@ class StockTransferLine extends CommonObjectLine
$dir = dol_buildpath($reldir."core/modules/stocktransfer/");
// Load file with numbering class (if found)
- $mybool |= @include_once $dir.$file;
+ $mybool = ((bool) @include_once $dir.$file) || $mybool;
}
if ($mybool === false) {
diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php
index f1355fc7a85..779f4995f51 100644
--- a/htdocs/projet/class/project.class.php
+++ b/htdocs/projet/class/project.class.php
@@ -1697,6 +1697,7 @@ class Project extends CommonObject
global $langs, $conf;
$error = 0;
+ $clone_project_id = 0; // For static toolcheck
dol_syslog("createFromClone clone_contact=".json_encode($clone_contact)." clone_task=".json_encode($clone_task)." clone_project_file=".json_encode($clone_project_file)." clone_note=".json_encode($clone_note)." move_date=".json_encode($move_date), LOG_DEBUG);
@@ -1900,7 +1901,7 @@ class Project extends CommonObject
unset($clone_project->context['createfromclone']);
- if (!$error) {
+ if (!$error && $clone_project_id != 0) {
$this->db->commit();
return $clone_project_id;
} else {
diff --git a/htdocs/projet/class/projectstats.class.php b/htdocs/projet/class/projectstats.class.php
index b671f147636..4a789b17d8b 100644
--- a/htdocs/projet/class/projectstats.class.php
+++ b/htdocs/projet/class/projectstats.class.php
@@ -1,6 +1,7 @@
+ * Copyright (C) 2024 MDW
*
* 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
@@ -289,7 +290,7 @@ class ProjectStats extends Stats
* @param int $startyear End year
* @param int $cachedelay Delay we accept for cache file (0=No read, no save of cache, -1=No read but save)
* @param int $wonlostfilter Add a filter on status won/lost
- * @return array|int Array of values or <0 if error
+ * @return array|int<-1,-1> Array of values or <0 if error
*/
public function getWeightedAmountByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0, $wonlostfilter = 1)
{
@@ -328,6 +329,7 @@ class ProjectStats extends Stats
if ($foundintocache) { // Cache file found and is not too old
dol_syslog(get_class($this).'::'.__FUNCTION__." read data from cache file ".$newpathofdestfile." ".$filedate.".");
$data = json_decode(file_get_contents($newpathofdestfile), true);
+ '@phan-var-force array $data'; // Phan can not interpret json_decode
} else {
$year = $startyear;
while ($year <= $endyear) {
@@ -438,6 +440,7 @@ class ProjectStats extends Stats
if ($foundintocache) { // Cache file found and is not too old
dol_syslog(get_class($this).'::'.__FUNCTION__." read data from cache file ".$newpathofdestfile." ".$filedate.".");
$data = json_decode(file_get_contents($newpathofdestfile), true);
+ '@phan-var-force array $data'; // Phan can not interpret json_decode
} else {
$year = $startyear;
while ($year <= $endyear) {
diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php
index 45dcad80025..84d78726599 100644
--- a/htdocs/projet/class/task.class.php
+++ b/htdocs/projet/class/task.class.php
@@ -2051,9 +2051,10 @@ class Task extends CommonObjectLine
$this->error = $clone_task->error;
$error++;
}
-
// End
- if (!$error) {
+ if ($error) {
+ $clone_task_id = 0; // For static tool check
+ } else {
$clone_task_id = $clone_task->id;
$clone_task_ref = $clone_task->ref;
diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php
index 4e0f40d0127..9b07083156d 100644
--- a/htdocs/projet/list.php
+++ b/htdocs/projet/list.php
@@ -261,6 +261,7 @@ if (GETPOST('search_usage_event_organization')) {
$object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
+'@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
/*
diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php
index c3e91e95c88..a093682ecde 100644
--- a/htdocs/projet/tasks.php
+++ b/htdocs/projet/tasks.php
@@ -177,6 +177,7 @@ $extrafieldsobjectprefix = 'efpt.';
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
$arrayfields = dol_sort_array($arrayfields, 'position');
+'@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php
index a7a5c47d757..eda19a63dab 100644
--- a/htdocs/projet/tasks/list.php
+++ b/htdocs/projet/tasks/list.php
@@ -5,6 +5,7 @@
* Copyright (C) 2018 Ferran Marcet
* Copyright (C) 2021 Alexandre Spangaro
* Copyright (C) 2023 Gauthier VERDOL
+ * Copyright (C) 2024 MDW
*
* 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
@@ -182,6 +183,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
$object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
+'@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
$permissiontoread = $user->hasRight('projet', 'lire');
$permissiontocreate = $user->hasRight('projet', 'creer');
diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php
index c48a6f296cc..f12a06e2560 100644
--- a/htdocs/projet/tasks/time.php
+++ b/htdocs/projet/tasks/time.php
@@ -1288,6 +1288,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_array_fields.tpl.php';
$arrayfields = dol_sort_array($arrayfields, 'position');
+ '@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
$param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php
index feec219703d..ad4b0d1bdd8 100644
--- a/htdocs/public/payment/newpayment.php
+++ b/htdocs/public/payment/newpayment.php
@@ -2152,7 +2152,7 @@ if ($action != 'dopayment') {
if (getDolGlobalString('PAYPAL_API_INTEGRAL_OR_PAYPALONLY') != 'integral') {
print '
';
}
- print ' ';
+ print ' ';
if (getDolGlobalString('PAYPAL_API_INTEGRAL_OR_PAYPALONLY') == 'integral') {
print ' ';
print ''.$langs->trans("CreditOrDebitCard").' - ';
diff --git a/htdocs/public/payment/paymentko.php b/htdocs/public/payment/paymentko.php
index 3df08fffe53..8e60a9adea9 100644
--- a/htdocs/public/payment/paymentko.php
+++ b/htdocs/public/payment/paymentko.php
@@ -120,6 +120,7 @@ $object = new stdClass(); // For triggers
* Actions
*/
+// None
@@ -127,6 +128,10 @@ $object = new stdClass(); // For triggers
* View
*/
+// TODO check if we have redirtodomain to do.
+$doactionsthenrediret = 0;
+
+
dol_syslog("Callback url when an online payment is refused or canceled. query_string=".(empty($_SERVER["QUERY_STRING"]) ? '' : $_SERVER["QUERY_STRING"])." script_uri=".(empty($_SERVER["SCRIPT_URI"]) ? '' : $_SERVER["SCRIPT_URI"]), LOG_DEBUG, 0, '_payment');
$tracepost = "";
@@ -165,10 +170,7 @@ if (!empty($_SESSION['ipaddress'])) { // To avoid to make action twice
}
// Send an email
- $sendemail = '';
- if (getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL')) {
- $sendemail = getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL');
- }
+ $sendemail = getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL');
// Send warning of error to administrator
if ($sendemail) {
@@ -208,89 +210,99 @@ if (!empty($_SESSION['ipaddress'])) { // To avoid to make action twice
unset($_SESSION['ipaddress']);
}
-$head = '';
-if (getDolGlobalString('ONLINE_PAYMENT_CSS_URL')) {
- $head = ''."\n";
-}
-
-$conf->dol_hide_topmenu = 1;
-$conf->dol_hide_leftmenu = 1;
-
-$replacemainarea = (empty($conf->dol_hide_leftmenu) ? '
';
+ // Show logo (search order: logo defined by PAYMENT_LOGO_suffix, then PAYMENT_LOGO, then small company logo, large company logo, theme logo, common logo)
+ // Define logo and logosmall
+ $logosmall = $mysoc->logo_small;
+ $logo = $mysoc->logo;
+ $paramlogo = 'ONLINE_PAYMENT_LOGO_'.$suffix;
+ if (!empty($conf->global->$paramlogo)) {
+ $logosmall = getDolGlobalString($paramlogo);
+ } elseif (getDolGlobalString('ONLINE_PAYMENT_LOGO')) {
+ $logosmall = getDolGlobalString('ONLINE_PAYMENT_LOGO');
}
- print '
';
+ }
+ if (getDolGlobalString('MAIN_IMAGE_PUBLIC_PAYMENT')) {
+ print '
';
+ print '';
+ print '
';
+ }
+
+
+ print '
';
}
-print '
';
-
-
+// Validate the payment (for payment mode that need another step after the callback return for this).
if (isModEnabled('paypal')) {
if ($paymentmethod === 'paypal') { // We call this page only if payment is ok on payment system
if ($PAYPALTOKEN) {
@@ -391,7 +394,7 @@ dol_syslog("ispaymentok=".$ispaymentok." tmptag=".var_export($tmptag, true), LOG
$appli = $mysoc->name;
-// Make complementary actions
+// Make complementary actions (post payment actions if payment is ok)
$ispostactionok = 0;
$postactionmessages = array();
if ($ispaymentok) {
@@ -1821,7 +1824,6 @@ if ($ispaymentok) {
}
}
-
if ($ispaymentok) {
// Get on url call
$onlinetoken = empty($PAYPALTOKEN) ? $_SESSION['onlinetoken'] : $PAYPALTOKEN;
@@ -1847,18 +1849,39 @@ if ($ispaymentok) {
$error++;
}
}
+}
- print $langs->trans("YourPaymentHasBeenRecorded")." \n";
- if ($TRANSACTIONID) {
- print $langs->trans("ThisIsTransactionId", $TRANSACTIONID)."
\n";
+
+// Show result message
+if (empty($doactionsthenrediret)) {
+ if ($ispaymentok) {
+ print $langs->trans("YourPaymentHasBeenRecorded")." \n";
+ if ($TRANSACTIONID) {
+ print $langs->trans("ThisIsTransactionId", $TRANSACTIONID)."
\n";
+ }
+
+ // Show a custom message
+ $key = 'ONLINE_PAYMENT_MESSAGE_OK';
+ if (getDolGlobalString($key)) {
+ print ' ';
+ print getDolGlobalString($key);
+ }
+ } else {
+ print $langs->trans('DoExpressCheckoutPaymentAPICallFailed')." \n";
+ print $langs->trans('DetailedErrorMessage').": ".$ErrorLongMsg." \n";
+ print $langs->trans('ShortErrorMessage').": ".$ErrorShortMsg." \n";
+ print $langs->trans('ErrorCode').": ".$ErrorCode." \n";
+ print $langs->trans('ErrorSeverityCode').": ".$ErrorSeverityCode." \n";
+
+ if ($mysoc->email) {
+ print "\nPlease, send a screenshot of this page to ".$mysoc->email." \n";
+ }
}
+}
- $key = 'ONLINE_PAYMENT_MESSAGE_OK';
- if (!empty($conf->global->$key)) {
- print ' ';
- print $conf->global->$key;
- }
+// Send email
+if ($ispaymentok) {
$sendemail = getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL');
$tmptag = dolExplodeIntoArray($fulltag, '.', '=');
@@ -1954,6 +1977,8 @@ if ($ispaymentok) {
}
}
} else {
+ $sendemail = getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL');
+
// Get on url call
$onlinetoken = empty($PAYPALTOKEN) ? $_SESSION['onlinetoken'] : $PAYPALTOKEN;
$payerID = empty($PAYPALPAYERID) ? $_SESSION['payerID'] : $PAYPALPAYERID;
@@ -1971,29 +1996,6 @@ if ($ispaymentok) {
// End call triggers
}
- print $langs->trans('DoExpressCheckoutPaymentAPICallFailed')." \n";
- print $langs->trans('DetailedErrorMessage').": ".$ErrorLongMsg." \n";
- print $langs->trans('ShortErrorMessage').": ".$ErrorShortMsg." \n";
- print $langs->trans('ErrorCode').": ".$ErrorCode." \n";
- print $langs->trans('ErrorSeverityCode').": ".$ErrorSeverityCode." \n";
-
- if ($mysoc->email) {
- print "\nPlease, send a screenshot of this page to ".$mysoc->email." \n";
- }
-
- $sendemail = '';
- if (getDolGlobalString('PAYMENTONLINE_SENDEMAIL')) {
- $sendemail = getDolGlobalString('PAYMENTONLINE_SENDEMAIL');
- }
- // TODO Remove local option to keep only the generic one ?
- if ($paymentmethod == 'paypal' && getDolGlobalString('PAYPAL_PAYONLINE_SENDEMAIL')) {
- $sendemail = getDolGlobalString('PAYPAL_PAYONLINE_SENDEMAIL');
- } elseif ($paymentmethod == 'paybox' && getDolGlobalString('PAYBOX_PAYONLINE_SENDEMAIL')) {
- $sendemail = getDolGlobalString('PAYBOX_PAYONLINE_SENDEMAIL');
- } elseif ($paymentmethod == 'stripe' && getDolGlobalString('STRIPE_PAYONLINE_SENDEMAIL')) {
- $sendemail = getDolGlobalString('STRIPE_PAYONLINE_SENDEMAIL');
- }
-
// Send warning of error to administrator
if ($sendemail) {
$companylangs = new Translate('', $conf);
@@ -2036,19 +2038,37 @@ if ($ispaymentok) {
}
-print "\n
\n";
-
-print "\n";
-
-
-htmlPrintOnlineFooter($mysoc, $langs, 0, $suffix);
-
-
// Clean session variables to avoid duplicate actions if post is resent
unset($_SESSION["FinalPaymentAmt"]);
unset($_SESSION["TRANSACTIONID"]);
-llxFooter('', 'public');
+// Close page content id="dolpaymentdiv"
+if (empty($doactionsthenrediret)) {
+ print "\n
\n";
+
+ print "\n";
+}
+
+
+// Show footer
+if (empty($doactionsthenrediret)) {
+ htmlPrintOnlineFooter($mysoc, $langs, 0, $suffix);
+
+ llxFooter('', 'public');
+}
+
$db->close();
+
+
+// If option to do a redirect somewhere else.
+if (empty($doactionsthenrediret)) {
+ if ($ispaymentok) {
+ // Do the redirect to a success page
+ // TODO
+ } else {
+ // Do the redirect to an error page
+ // TODO
+ }
+}
diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php
index b3362854db6..28e7c1933f4 100644
--- a/htdocs/reception/card.php
+++ b/htdocs/reception/card.php
@@ -1825,7 +1825,7 @@ if ($action == 'create') {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON obj.fk_product = p.rowid";
$sql .= " WHERE e.entity IN (".getEntity('reception').")";
$sql .= " AND obj.fk_commande = ".((int) $origin_id);
- $sql .= " AND obj.rowid = ed.fk_commandefourndet";
+ $sql .= " AND obj.rowid = ed.fk_elementdet";
$sql .= " AND ed.fk_reception = e.rowid";
$sql .= " AND ed.fk_reception !=".((int) $object->id);
//if ($filter) $sql.= $filter;
diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php
index 8ba93145914..b91c791bb9d 100644
--- a/htdocs/reception/class/reception.class.php
+++ b/htdocs/reception/class/reception.class.php
@@ -180,7 +180,7 @@ class Reception extends CommonObject
$dir = dol_buildpath($reldir."core/modules/reception/");
// Load file with numbering class (if found)
- $mybool |= @include_once $dir.$file;
+ $mybool = ((bool) @include_once $dir.$file) || $mybool;
}
if (!$mybool) {
@@ -562,7 +562,7 @@ class Reception extends CommonObject
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd,";
$sql .= " ".MAIN_DB_PREFIX."receptiondet_batch as ed";
$sql .= " WHERE ed.fk_reception = ".((int) $this->id);
- $sql .= " AND cd.rowid = ed.fk_commandefourndet";
+ $sql .= " AND cd.rowid = ed.fk_elementdet";
dol_syslog(get_class($this)."::valid select details", LOG_DEBUG);
$resql = $this->db->query($sql);
@@ -747,7 +747,7 @@ class Reception extends CommonObject
$qty_wished = array();
$supplierorderdispatch = new CommandeFournisseurDispatch($this->db);
- $filter = array('t.fk_commande' => $this->origin_id);
+ $filter = array('t.fk_element' => $this->origin_id);
if (getDolGlobalInt('SUPPLIER_ORDER_USE_DISPATCH_STATUS')) {
$filter['t.status'] = 1; // Restrict to lines with status validated
}
@@ -1071,7 +1071,7 @@ class Reception extends CommonObject
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd,";
$sql .= " ".MAIN_DB_PREFIX."receptiondet_batch as ed";
$sql .= " WHERE ed.fk_reception = ".((int) $this->id);
- $sql .= " AND cd.rowid = ed.fk_commandefourndet";
+ $sql .= " AND cd.rowid = ed.fk_elementdet";
dol_syslog(get_class($this)."::delete select details", LOG_DEBUG);
$resql = $this->db->query($sql);
@@ -1660,7 +1660,7 @@ class Reception extends CommonObject
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd,";
$sql .= " ".MAIN_DB_PREFIX."receptiondet_batch as ed";
$sql .= " WHERE ed.fk_reception = ".((int) $this->id);
- $sql .= " AND cd.rowid = ed.fk_commandefourndet";
+ $sql .= " AND cd.rowid = ed.fk_elementdet";
dol_syslog(get_class($this)."::valid select details", LOG_DEBUG);
$resql = $this->db->query($sql);
@@ -1818,7 +1818,7 @@ class Reception extends CommonObject
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd,";
$sql .= " ".MAIN_DB_PREFIX."receptiondet_batch as ed";
$sql .= " WHERE ed.fk_reception = ".((int) $this->id);
- $sql .= " AND cd.rowid = ed.fk_commandefourndet";
+ $sql .= " AND cd.rowid = ed.fk_elementdet";
dol_syslog(get_class($this)."::valid select details", LOG_DEBUG);
$resql = $this->db->query($sql);
@@ -1952,7 +1952,7 @@ class Reception extends CommonObject
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd,";
$sql .= " ".MAIN_DB_PREFIX."receptiondet_batch as ed";
$sql .= " WHERE ed.fk_reception = ".((int) $this->id);
- $sql .= " AND cd.rowid = ed.fk_commandefourndet";
+ $sql .= " AND cd.rowid = ed.fk_elementdet";
dol_syslog(get_class($this)."::valid select details", LOG_DEBUG);
$resql = $this->db->query($sql);
diff --git a/htdocs/reception/class/receptionlinebatch.class.php b/htdocs/reception/class/receptionlinebatch.class.php
new file mode 100644
index 00000000000..81f93a32f37
--- /dev/null
+++ b/htdocs/reception/class/receptionlinebatch.class.php
@@ -0,0 +1,754 @@
+
+ * Copyright (C) 2014 Juanjo Menent
+ * Copyright (C) 2024 Frédéric France
+ * Copyright (C) 2024 Christophe Battarel
+ * 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
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+/**
+ * \file htdocs/fourn/class/fournisseur.commande.dispatch.class.php
+ * \ingroup fournisseur stock
+ * \brief This file is an example for a CRUD class file (Create/Read/Update/Delete)
+ * Initially built by build_class_from_table on 2015-02-24 10:38
+ */
+
+// Put here all includes required by your class file
+require_once DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php";
+require_once DOL_DOCUMENT_ROOT."/reception/class/reception.class.php";
+
+
+/**
+ * Class to manage table commandefournisseurdispatch
+ */
+class ReceptionLineBatch extends CommonObjectLine
+{
+ /**
+ * @var DoliDB Database handler.
+ */
+ public $db;
+
+ /**
+ * @var string Error code (or message)
+ */
+ public $error;
+
+ /**
+ * @var string[] Error codes (or messages)
+ */
+ public $errors = array();
+
+ /**
+ * @var string ID to identify managed object
+ */
+ public $element = 'receptionlinebatch';
+
+ /**
+ * @var string Name of table without prefix where object is stored
+ */
+ public $table_element = 'receptiondet_batch'; //!< Name of table without prefix where object is stored
+ public $lines = array();
+
+ /**
+ * @var int ID
+ */
+ public $id;
+
+ /**
+ * @var int ID
+ */
+ public $fk_element;
+
+ /**
+ * @var int ID
+ */
+ public $fk_product;
+
+ /**
+ * @var int ID
+ */
+ public $fk_elementdet;
+
+ public $fk_reception;
+
+
+ public $qty;
+ public $qty_asked;
+
+ public $libelle;
+ public $label;
+ public $desc;
+ public $tva_tx;
+ public $vat_src_code;
+ public $ref_supplier;
+
+ /**
+ * @var int ID
+ */
+ public $fk_entrepot;
+
+ /**
+ * @var int User ID
+ */
+ public $fk_user;
+
+ public $datec = '';
+ public $comment;
+
+ /**
+ * @var int Status
+ */
+ public $status;
+
+ public $batch;
+ public $eatby = '';
+ public $sellby = '';
+ public $cost_price = 0;
+
+
+
+
+ /**
+ * Constructor
+ *
+ * @param DoliDB $db Database handler
+ */
+ public function __construct($db)
+ {
+ $this->db = $db;
+
+ // List of language codes for status
+ $this->labelStatus[0] = 'Received';
+ $this->labelStatus[1] = 'Verified';
+ $this->labelStatus[2] = 'Denied';
+ $this->labelStatusShort[0] = 'Received';
+ $this->labelStatusShort[1] = 'Verified';
+ $this->labelStatusShort[2] = 'Denied';
+ }
+
+
+ /**
+ * Create object into database
+ *
+ * @param User $user User that creates
+ * @param int $notrigger 0=launch triggers after, 1=disable triggers
+ * @return int Return integer <0 if KO, Id of created object if OK
+ */
+ public function create($user, $notrigger = 0)
+ {
+ global $conf, $langs, $hookmanager;
+ $error = 0;
+
+ // Clean parameters
+
+ if (isset($this->fk_element)) {
+ $this->fk_element = (int) $this->fk_element;
+ }
+ if (isset($this->fk_product)) {
+ $this->fk_product = (int) $this->fk_product;
+ }
+ if (isset($this->fk_elementdet)) {
+ $this->fk_elementdet = (int) $this->fk_elementdet;
+ }
+ if (isset($this->qty)) {
+ $this->qty = trim($this->qty);
+ }
+ if (isset($this->fk_entrepot)) {
+ $this->fk_entrepot = (int) $this->fk_entrepot;
+ }
+ if (isset($this->fk_user)) {
+ $this->fk_user = (int) $this->fk_user;
+ }
+ if (isset($this->comment)) {
+ $this->comment = trim($this->comment);
+ }
+ if (isset($this->status)) {
+ $this->status = (int) $this->status;
+ }
+ if (isset($this->batch)) {
+ $this->batch = trim($this->batch);
+ }
+ if (empty($this->datec)) {
+ $this->datec = dol_now();
+ }
+
+
+ // Check parameters
+ // Put here code to add control on parameters values
+
+ // Insert request
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element."(";
+ $sql .= "fk_element,";
+ $sql .= "fk_product,";
+ $sql .= "fk_elementdet,";
+ $sql .= "qty,";
+ $sql .= "fk_entrepot,";
+ $sql .= "fk_user,";
+ $sql .= "datec,";
+ $sql .= "comment,";
+ $sql .= "status,";
+ $sql .= "batch,";
+ $sql .= "eatby,";
+ $sql .= "sellby,";
+ $sql .= "fk_reception,";
+ $sql .= "cost_price";
+
+
+ $sql .= ") VALUES (";
+ $sql .= " ".(!isset($this->fk_element) ? 'NULL' : "'".$this->db->escape($this->fk_element)."'").",";
+ $sql .= " ".(!isset($this->fk_product) ? 'NULL' : "'".$this->db->escape($this->fk_product)."'").",";
+ $sql .= " ".(!isset($this->fk_elementdet) ? 'NULL' : "'".$this->db->escape($this->fk_elementdet)."'").",";
+ $sql .= " ".(!isset($this->qty) ? 'NULL' : "'".$this->db->escape($this->qty)."'").",";
+ $sql .= " ".(!isset($this->fk_entrepot) ? 'NULL' : "'".$this->db->escape($this->fk_entrepot)."'").",";
+ $sql .= " ".(!isset($this->fk_user) ? 'NULL' : "'".$this->db->escape($this->fk_user)."'").",";
+ $sql .= " ".(!isset($this->datec) || dol_strlen($this->datec) == 0 ? 'NULL' : "'".$this->db->idate($this->datec)."'").",";
+ $sql .= " ".(!isset($this->comment) ? 'NULL' : "'".$this->db->escape($this->comment)."'").",";
+ $sql .= " ".(!isset($this->status) ? 'NULL' : "'".$this->db->escape($this->status)."'").",";
+ $sql .= " ".(!isset($this->batch) ? 'NULL' : "'".$this->db->escape($this->batch)."'").",";
+ $sql .= " ".(!isset($this->eatby) || dol_strlen($this->eatby) == 0 ? 'NULL' : "'".$this->db->idate($this->eatby)."'").",";
+ $sql .= " ".(!isset($this->sellby) || dol_strlen($this->sellby) == 0 ? 'NULL' : "'".$this->db->idate($this->sellby)."'").",";
+ $sql .= " ".(!isset($this->fk_reception) ? 'NULL' : "'".$this->db->escape($this->fk_reception)."'").",";
+ $sql .= " ".(!isset($this->cost_price) ? '0' : "'".$this->db->escape($this->cost_price)."'");
+ $sql .= ")";
+
+ $this->db->begin();
+
+ dol_syslog(__METHOD__, LOG_DEBUG);
+ $resql = $this->db->query($sql);
+ if (!$resql) {
+ $error++;
+ $this->errors[] = "Error ".$this->db->lasterror();
+ }
+
+ if (!$error) {
+ $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element);
+
+ if (!$notrigger) {
+ // Call triggers
+ $result = $this->call_trigger('LINERECEPTION_CREATE', $user);
+ if ($result < 0) {
+ $error++;
+ }
+ // End call triggers
+ }
+ }
+
+ // Create extrafields
+ if (!$error) {
+ $result = $this->insertExtraFields();
+ if ($result < 0) {
+ $error++;
+ }
+ }
+
+ // Commit or rollback
+ if ($error) {
+ foreach ($this->errors as $errmsg) {
+ dol_syslog(__METHOD__." ".$errmsg, LOG_ERR);
+ $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
+ }
+ $this->db->rollback();
+ return -1 * $error;
+ } else {
+ $this->db->commit();
+ return $this->id;
+ }
+ }
+
+
+ /**
+ * Load object in memory from the database
+ *
+ * @param int $id Id object
+ * @param string $ref Ref
+ * @return int Return integer <0 if KO, >0 if OK
+ */
+ public function fetch($id, $ref = '')
+ {
+ global $langs;
+ $sql = "SELECT";
+ $sql .= " t.rowid,";
+
+ $sql .= " t.fk_element,";
+ $sql .= " t.fk_product,";
+ $sql .= " t.fk_elementdet,";
+ $sql .= " t.qty,";
+ $sql .= " t.fk_entrepot,";
+ $sql .= " t.fk_user,";
+ $sql .= " t.datec,";
+ $sql .= " t.comment,";
+ $sql .= " t.status,";
+ $sql .= " t.tms,";
+ $sql .= " t.batch,";
+ $sql .= " t.eatby,";
+ $sql .= " t.sellby,";
+ $sql .= " t.fk_reception";
+
+
+ $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element." as t";
+ if ($ref) {
+ $sql .= " WHERE t.ref = '".$this->db->escape($ref)."'";
+ } else {
+ $sql .= " WHERE t.rowid = ".((int) $id);
+ }
+
+ dol_syslog(get_class($this)."::fetch");
+ $resql = $this->db->query($sql);
+ if ($resql) {
+ if ($this->db->num_rows($resql)) {
+ $obj = $this->db->fetch_object($resql);
+
+ $this->id = $obj->rowid;
+
+ $this->fk_element = $obj->fk_element;
+ $this->fk_product = $obj->fk_product;
+ $this->fk_elementdet = $obj->fk_elementdet;
+ $this->qty = $obj->qty;
+ $this->fk_entrepot = $obj->fk_entrepot;
+ $this->fk_user = $obj->fk_user;
+ $this->datec = $this->db->jdate($obj->datec);
+ $this->comment = $obj->comment;
+ $this->status = $obj->status;
+ $this->tms = $this->db->jdate($obj->tms);
+ $this->batch = $obj->batch;
+ $this->eatby = $this->db->jdate($obj->eatby);
+ $this->sellby = $this->db->jdate($obj->sellby);
+ $this->fk_reception = $obj->fk_reception;
+
+ $this->fetch_optionals();
+ }
+ $this->db->free($resql);
+
+ return 1;
+ } else {
+ $this->error = "Error ".$this->db->lasterror();
+ return -1;
+ }
+ }
+
+
+ /**
+ * Update object into database
+ *
+ * @param User $user User that modifies
+ * @param int $notrigger 0=launch triggers after, 1=disable triggers
+ * @return int Return integer <0 if KO, >0 if OK
+ */
+ public function update($user, $notrigger = 0)
+ {
+ $error = 0;
+
+ // Clean parameters
+
+ if (isset($this->fk_element)) {
+ $this->fk_element = (int) $this->fk_element;
+ }
+ if (isset($this->fk_product)) {
+ $this->fk_product = (int) $this->fk_product;
+ }
+ if (isset($this->fk_elementdet)) {
+ $this->fk_elementdet = (int) $this->fk_elementdet;
+ }
+ if (isset($this->qty)) {
+ $this->qty = trim($this->qty);
+ }
+ if (isset($this->fk_entrepot)) {
+ $this->fk_entrepot = (int) $this->fk_entrepot;
+ }
+ if (isset($this->fk_user)) {
+ $this->fk_user = (int) $this->fk_user;
+ }
+ if (isset($this->comment)) {
+ $this->comment = trim($this->comment);
+ }
+ if (isset($this->status)) {
+ $this->status = (int) $this->status;
+ }
+ if (isset($this->batch)) {
+ $this->batch = trim($this->batch);
+ }
+
+
+
+ // Check parameters
+ // Put here code to add a control on parameters values
+
+ // Update request
+ $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET";
+ $sql .= " fk_element=".(isset($this->fk_element) ? $this->fk_element : "null").",";
+ $sql .= " fk_product=".(isset($this->fk_product) ? $this->fk_product : "null").",";
+ $sql .= " fk_elementdet=".(isset($this->fk_elementdet) ? $this->fk_elementdet : "null").",";
+ $sql .= " qty=".(isset($this->qty) ? $this->qty : "null").",";
+ $sql .= " fk_entrepot=".(isset($this->fk_entrepot) ? $this->fk_entrepot : "null").",";
+ $sql .= " fk_user=".(isset($this->fk_user) ? $this->fk_user : "null").",";
+ $sql .= " datec=".(dol_strlen($this->datec) != 0 ? "'".$this->db->idate($this->datec)."'" : 'null').",";
+ $sql .= " comment=".(isset($this->comment) ? "'".$this->db->escape($this->comment)."'" : "null").",";
+ $sql .= " status=".(isset($this->status) ? $this->status : "null").",";
+ $sql .= " tms=".(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').",";
+ $sql .= " batch=".(isset($this->batch) ? "'".$this->db->escape($this->batch)."'" : "null").",";
+ $sql .= " eatby=".(dol_strlen($this->eatby) != 0 ? "'".$this->db->idate($this->eatby)."'" : 'null').",";
+ $sql .= " sellby=".(dol_strlen($this->sellby) != 0 ? "'".$this->db->idate($this->sellby)."'" : 'null');
+ $sql .= " WHERE rowid=".((int) $this->id);
+
+ $this->db->begin();
+
+ dol_syslog(__METHOD__);
+ $resql = $this->db->query($sql);
+ if (!$resql) {
+ $error++;
+ $this->errors[] = "Error ".$this->db->lasterror();
+ }
+
+ if (!$error) {
+ if (!$error) {
+ if (empty($this->id) && !empty($this->rowid)) {
+ $this->id = $this->rowid;
+ }
+ $result = $this->insertExtraFields();
+ if ($result < 0) {
+ $error++;
+ }
+ }
+
+ if (!$notrigger) {
+ // Call triggers
+ $result = $this->call_trigger('LINERECEPTION_MODIFY', $user);
+ if ($result < 0) {
+ $error++;
+ }
+ // End call triggers
+ }
+ }
+
+ // Commit or rollback
+ if ($error) {
+ foreach ($this->errors as $errmsg) {
+ dol_syslog(__METHOD__." ".$errmsg, LOG_ERR);
+ $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
+ }
+ $this->db->rollback();
+ return -1 * $error;
+ } else {
+ $this->db->commit();
+ return 1;
+ }
+ }
+
+
+ /**
+ * Delete object in database
+ *
+ * @param User $user User that deletes
+ * @param int $notrigger 0=launch triggers after, 1=disable triggers
+ * @return int Return integer <0 if KO, >0 if OK
+ */
+ public function delete($user, $notrigger = 0)
+ {
+ $error = 0;
+
+ $this->db->begin();
+
+ if (!$error) {
+ if (!$notrigger) {
+ // Call triggers
+ $result = $this->call_trigger('LINERECEPTION_DELETE', $user);
+ if ($result < 0) {
+ $error++;
+ }
+ // End call triggers
+ }
+ }
+
+ // Remove extrafields
+ if (!$error) {
+ $result = $this->deleteExtraFields();
+ if ($result < 0) {
+ $error++;
+ dol_syslog(get_class($this)."::delete error deleteExtraFields ".$this->error, LOG_ERR);
+ }
+ }
+
+ if (!$error) {
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element;
+ $sql .= " WHERE rowid=".((int) $this->id);
+
+ dol_syslog(__METHOD__);
+ $resql = $this->db->query($sql);
+ if (!$resql) {
+ $error++;
+ $this->errors[] = "Error ".$this->db->lasterror();
+ }
+ }
+
+ // Commit or rollback
+ if ($error) {
+ foreach ($this->errors as $errmsg) {
+ dol_syslog(__METHOD__." ".$errmsg, LOG_ERR);
+ $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
+ }
+ $this->db->rollback();
+ return -1 * $error;
+ } else {
+ $this->db->commit();
+ return 1;
+ }
+ }
+
+
+ /**
+ * Load an object from its id and create a new one in database
+ *
+ * @param User $user User making the clone
+ * @param int $fromid Id of object to clone
+ * @return int New id of clone
+ */
+ public function createFromClone(User $user, $fromid)
+ {
+ $error = 0;
+
+ $object = new ReceptionLineBatch($this->db);
+
+ $this->db->begin();
+
+ // Load source object
+ $object->fetch($fromid);
+ $object->id = 0;
+ $object->statut = 0;
+
+ // Clear fields
+ // ...
+
+ // Create clone
+ $object->context['createfromclone'] = 'createfromclone';
+ $result = $object->create($user);
+
+ // Other options
+ if ($result < 0) {
+ $this->error = $object->error;
+ $error++;
+ }
+
+ if (!$error) {
+ }
+
+ unset($object->context['createfromclone']);
+
+ // End
+ if (!$error) {
+ $this->db->commit();
+ return $object->id;
+ } else {
+ $this->db->rollback();
+ return -1;
+ }
+ }
+
+
+
+ /**
+ * Return label of the status of object
+ *
+ * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto
+ * @return string Label
+ */
+ public function getLibStatut($mode = 0)
+ {
+ return $this->LibStatut($this->status, $mode);
+ }
+
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * Return label of a status
+ *
+ * @param int $status Id status
+ * @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto
+ * @return string Label of status
+ */
+ public function LibStatut($status, $mode = 0)
+ {
+ // phpcs:enable
+ global $langs;
+ $langs->load('orders');
+
+ if ($mode == 0) {
+ return $langs->trans($this->labelStatus[$status]);
+ } elseif ($mode == 1) {
+ return $langs->trans($this->labelStatusShort[$status]);
+ } elseif ($mode == 2) {
+ return $langs->trans($this->labelStatus[$status]);
+ } elseif ($mode == 3) {
+ if ($status == 0) {
+ return img_picto($langs->trans($this->labelStatus[$status]), 'statut0');
+ } elseif ($status == 1) {
+ return img_picto($langs->trans($this->labelStatus[$status]), 'statut4');
+ } elseif ($status == 2) {
+ return img_picto($langs->trans($this->labelStatus[$status]), 'statut8');
+ }
+ } elseif ($mode == 4) {
+ if ($status == 0) {
+ return img_picto($langs->trans($this->labelStatus[$status]), 'statut0').' '.$langs->trans($this->labelStatus[$status]);
+ } elseif ($status == 1) {
+ return img_picto($langs->trans($this->labelStatus[$status]), 'statut4').' '.$langs->trans($this->labelStatus[$status]);
+ } elseif ($status == 2) {
+ return img_picto($langs->trans($this->labelStatus[$status]), 'statut8').' '.$langs->trans($this->labelStatus[$status]);
+ }
+ } elseif ($mode == 5) {
+ if ($status == 0) {
+ return ''.$langs->trans($this->labelStatusShort[$status]).' '.img_picto($langs->trans($this->labelStatus[$status]), 'statut0');
+ } elseif ($status == 1) {
+ return ''.$langs->trans($this->labelStatusShort[$status]).' '.img_picto($langs->trans($this->labelStatus[$status]), 'statut4');
+ } elseif ($status == 2) {
+ return ''.$langs->trans($this->labelStatusShort[$status]).' '.img_picto($langs->trans($this->labelStatus[$status]), 'statut8');
+ }
+ }
+ return "";
+ }
+
+
+ /**
+ * Initialise object with example values
+ * Id must be 0 if object instance is a specimen
+ *
+ * @return int
+ */
+ public function initAsSpecimen()
+ {
+ $this->id = 0;
+
+ $this->fk_element = 0;
+ $this->fk_product = 0;
+ $this->fk_elementdet = 0;
+ $this->qty = '';
+ $this->fk_entrepot = 0;
+ $this->fk_user = 0;
+ $this->datec = '';
+ $this->comment = '';
+ $this->status = 0;
+ $this->tms = dol_now();
+ $this->batch = '';
+ $this->eatby = '';
+ $this->sellby = '';
+
+ return 1;
+ }
+
+ /**
+ * Load object in memory from the database
+ *
+ * @param string $sortorder Sort Order
+ * @param string $sortfield Sort field
+ * @param int $limit limit
+ * @param int $offset offset limit
+ * @param string|array $filter filter array
+ * @param string $filtermode filter mode (AND or OR)
+ * @return int Return integer <0 if KO, >0 if OK
+ */
+ public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = '', $filtermode = 'AND')
+ {
+ dol_syslog(__METHOD__, LOG_DEBUG);
+
+ $sql = "SELECT";
+ $sql .= " t.rowid,";
+ $sql .= " t.fk_element,";
+ $sql .= " t.fk_product,";
+ $sql .= " t.fk_elementdet,";
+ $sql .= " t.qty,";
+ $sql .= " t.fk_entrepot,";
+ $sql .= " t.fk_user,";
+ $sql .= " t.datec,";
+ $sql .= " t.comment,";
+ $sql .= " t.status,";
+ $sql .= " t.tms,";
+ $sql .= " t.batch,";
+ $sql .= " t.eatby,";
+ $sql .= " t.sellby";
+ $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element." as t";
+
+ // Manage filter
+ if (is_array($filter)) {
+ $sqlwhere = array();
+ if (count($filter) > 0) {
+ foreach ($filter as $key => $value) {
+ if ($key == 't.comment') {
+ $sqlwhere [] = $this->db->sanitize($key)." LIKE '%".$this->db->escape($this->db->escapeforlike($value))."%'";
+ } elseif ($key == 't.datec' || $key == 't.tms' || $key == 't.eatby' || $key == 't.sellby' || $key == 't.batch') {
+ $sqlwhere [] = $this->db->sanitize($key)." = '".$this->db->escape($value)."'";
+ } elseif ($key == 'qty') {
+ $sqlwhere [] = $this->db->sanitize($key)." = ".((float) $value);
+ } else {
+ $sqlwhere [] = $this->db->sanitize($key)." = ".((int) $value);
+ }
+ }
+ }
+ if (count($sqlwhere) > 0) {
+ $sql .= ' WHERE '.implode(' '.$this->db->escape($filtermode).' ', $sqlwhere);
+ }
+
+ $filter = '';
+ }
+
+ // Manage filter
+ $errormessage = '';
+ $sql .= forgeSQLFromUniversalSearchCriteria($filter, $errormessage);
+ if ($errormessage) {
+ $this->errors[] = $errormessage;
+ dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
+ return -1;
+ }
+
+ if (!empty($sortfield)) {
+ $sql .= $this->db->order($sortfield, $sortorder);
+ }
+ if (!empty($limit)) {
+ $sql .= $this->db->plimit($limit, $offset);
+ }
+ $this->lines = array();
+
+ $resql = $this->db->query($sql);
+ if ($resql) {
+ $num = $this->db->num_rows($resql);
+
+ while ($obj = $this->db->fetch_object($resql)) {
+ $line = new self($this->db);
+
+ $line->id = $obj->rowid;
+
+ $line->fk_element = $obj->fk_element;
+ $line->fk_product = $obj->fk_product;
+ $line->fk_elementdet = $obj->fk_elementdet;
+ $line->qty = $obj->qty;
+ $line->fk_entrepot = $obj->fk_entrepot;
+ $line->fk_user = $obj->fk_user;
+ $line->datec = $this->db->jdate($obj->datec);
+ $line->comment = $obj->comment;
+ $line->status = $obj->status;
+ $line->tms = $this->db->jdate($obj->tms);
+ $line->batch = $obj->batch;
+ $line->eatby = $this->db->jdate($obj->eatby);
+ $line->sellby = $this->db->jdate($obj->sellby);
+ $line->fetch_optionals();
+
+ $this->lines[$line->id] = $line;
+ }
+ $this->db->free($resql);
+
+ return $num;
+ } else {
+ $this->errors[] = 'Error '.$this->db->lasterror();
+ dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
+
+ return -1;
+ }
+ }
+}
diff --git a/htdocs/reception/dispatch.php b/htdocs/reception/dispatch.php
index b48ea7b4164..3d2ed4bd36c 100644
--- a/htdocs/reception/dispatch.php
+++ b/htdocs/reception/dispatch.php
@@ -462,7 +462,7 @@ if ($id > 0 || !empty($ref)) {
$products_dispatched = array();
$sql = "SELECT l.rowid, cfd.fk_product, sum(cfd.qty) as qty";
$sql .= " FROM ".MAIN_DB_PREFIX."receptiondet_batch as cfd";
- $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."commande_fournisseurdet as l on l.rowid = cfd.fk_commandefourndet";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."receptiondet_batch as l on l.rowid = cfd.fk_elementdet";
$sql .= " WHERE cfd.fk_reception = ".((int) $object->id);
$sql .= " GROUP BY l.rowid, cfd.fk_product";
@@ -690,8 +690,8 @@ if ($id > 0 || !empty($ref)) {
$sql = "SELECT cfd.rowid, cfd.qty, cfd.fk_entrepot, cfd.batch, cfd.eatby, cfd.sellby, cfd.fk_product";
$sql .= " FROM ".MAIN_DB_PREFIX."receptiondet_batch as cfd"; // commande_fournisseur_dispatch should be named receptiondet_batch
$sql .= " WHERE cfd.fk_reception = ".((int) $object->id);
- $sql .= " AND cfd.fk_commande = ".((int) $objectsrc->id);
- $sql .= " AND cfd.fk_commandefourndet = ".(int) $objp->rowid;
+ $sql .= " AND cfd.fk_element = ".((int) $objectsrc->id);
+ $sql .= " AND cfd.fk_elementdet = ".(int) $objp->rowid;
//print $sql;
$resultsql = $db->query($sql);
diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php
index 20b9262923f..e30f152fc61 100644
--- a/htdocs/reception/list.php
+++ b/htdocs/reception/list.php
@@ -140,6 +140,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
$object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
+'@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
$error = 0;
diff --git a/htdocs/recruitment/class/recruitmentcandidature.class.php b/htdocs/recruitment/class/recruitmentcandidature.class.php
index f80911e4381..59c152cac47 100644
--- a/htdocs/recruitment/class/recruitmentcandidature.class.php
+++ b/htdocs/recruitment/class/recruitmentcandidature.class.php
@@ -953,7 +953,7 @@ class RecruitmentCandidature extends CommonObject
$dir = dol_buildpath($reldir."core/modules/recruitment/");
// Load file with numbering class (if found)
- $mybool |= @include_once $dir.$file;
+ $mybool = ((bool) @include_once $dir.$file) || $mybool;
}
if ($mybool === false) {
diff --git a/htdocs/recruitment/class/recruitmentjobposition.class.php b/htdocs/recruitment/class/recruitmentjobposition.class.php
index 90fe44b212d..dbc9e11cce1 100644
--- a/htdocs/recruitment/class/recruitmentjobposition.class.php
+++ b/htdocs/recruitment/class/recruitmentjobposition.class.php
@@ -1010,7 +1010,7 @@ class RecruitmentJobPosition extends CommonObject
$dir = dol_buildpath($reldir."core/modules/recruitment/");
// Load file with numbering class (if found)
- $mybool |= @include_once $dir.$file;
+ $mybool = ((bool) @include_once $dir.$file) || $mybool;
}
if ($mybool === false) {
diff --git a/htdocs/resource/list.php b/htdocs/resource/list.php
index 33f21aa75bb..7f09a9d6b3a 100644
--- a/htdocs/resource/list.php
+++ b/htdocs/resource/list.php
@@ -3,6 +3,7 @@
* Copyright (C) 2018 Nicolas ZABOURI
* Copyright (C) 2018-2021 Frédéric France
* Copyright (C) 2024 William Mead
+ * Copyright (C) 2024 MDW
*
* 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
@@ -157,6 +158,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
$object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
+'@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
@@ -703,7 +705,7 @@ if ($num == 0) {
$db->free($resql);
-$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
+$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php
index 498b869c92b..73fdb35e5af 100644
--- a/htdocs/societe/list.php
+++ b/htdocs/societe/list.php
@@ -319,6 +319,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
$object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
+'@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
// Security check
$socid = GETPOSTINT('socid');
diff --git a/htdocs/societe/notify/card.php b/htdocs/societe/notify/card.php
index e79ccda49a0..4962c150888 100644
--- a/htdocs/societe/notify/card.php
+++ b/htdocs/societe/notify/card.php
@@ -260,7 +260,7 @@ if ($result > 0) {
// Add notification form
//print load_fiche_titre($titlelist.' ('.$num.')', '', '');
$num = $nbtotalofrecords;
- print_barre_liste($titlelist, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, empty($nbtotalofrecords) ? -1 : $nbtotalofrecords, 'email', 0, $newcardbutton, '', $limit, 0, 0, 1);
+ print_barre_liste($titlelist, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, (empty($nbtotalofrecords) ? -1 : $nbtotalofrecords), 'email', 0, $newcardbutton, '', $limit, 0, 0, 1);
print '