From 192e62fa5c00e5d82d831aa377c2916e41849806 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Mon, 21 Feb 2022 15:41:41 +0100 Subject: [PATCH 001/115] Fix : fix bug class and sql regeneration in modulebuilder --- htdocs/core/lib/modulebuilder.lib.php | 34 +++++++++++++-------------- htdocs/modulebuilder/index.php | 4 +++- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/htdocs/core/lib/modulebuilder.lib.php b/htdocs/core/lib/modulebuilder.lib.php index 7c32b377bd4..d5d4aa8c2c4 100644 --- a/htdocs/core/lib/modulebuilder.lib.php +++ b/htdocs/core/lib/modulebuilder.lib.php @@ -125,46 +125,46 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir = $texttoinsert .= " 'position'=>".($val['position'] !== '' ? $val['position'] : 50).","; $texttoinsert .= " 'notnull'=>".(empty($val['notnull']) ? 0 : $val['notnull']).","; $texttoinsert .= " 'visible'=>".($val['visible'] !== '' ? $val['visible'] : -1).","; - if ($val['noteditable']) { + if (!empty($val['noteditable'])) { $texttoinsert .= " 'noteditable'=>'".$val['noteditable']."',"; } - if ($val['default'] || $val['default'] === '0') { + if (!empty($val['default']) || (!empty($val['default']) && $val['default'] === '0')) { $texttoinsert .= " 'default'=>'".$val['default']."',"; } - if ($val['index']) { + if (!empty($val['index'])) { $texttoinsert .= " 'index'=>".$val['index'].","; } - if ($val['foreignkey']) { + if (!empty($val['foreignkey'])) { $texttoinsert .= " 'foreignkey'=>'".$val['foreignkey']."',"; } - if ($val['searchall']) { + if (!empty($val['searchall'])) { $texttoinsert .= " 'searchall'=>".$val['searchall'].","; } - if ($val['isameasure']) { + if (!empty($val['isameasure'])) { $texttoinsert .= " 'isameasure'=>'".$val['isameasure']."',"; } - if ($val['css']) { + if (!empty($val['css'])) { $texttoinsert .= " 'css'=>'".$val['css']."',"; } - if ($val['cssview']) { + if (!empty($val['cssview'])) { $texttoinsert .= " 'cssview'=>'".$val['cssview']."',"; } - if ($val['csslist']) { + if (!empty($val['csslist'])) { $texttoinsert .= " 'csslist'=>'".$val['csslist']."',"; } - if ($val['help']) { + if (!empty($val['help'])) { $texttoinsert .= " 'help'=>\"".preg_replace('/"/', '', $val['help'])."\","; } - if ($val['showoncombobox']) { + if (!empty($val['showoncombobox'])) { $texttoinsert .= " 'showoncombobox'=>'".$val['showoncombobox']."',"; } - if ($val['disabled']) { + if (!empty($val['disabled'])) { $texttoinsert .= " 'disabled'=>'".$val['disabled']."',"; } - if ($val['autofocusoncreate']) { + if (!empty($val['autofocusoncreate'])) { $texttoinsert .= " 'autofocusoncreate'=>'".$val['autofocusoncreate']."',"; } - if ($val['arrayofkeyval']) { + if (!empty($val['arrayofkeyval'])) { $texttoinsert .= " 'arrayofkeyval'=>array("; $i = 0; foreach ($val['arrayofkeyval'] as $key2 => $val2) { @@ -176,10 +176,10 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir = } $texttoinsert .= "),"; } - if ($val['validate']) { + if (!empty($val['validate'])) { $texttoinsert .= " 'validate'=>'".$val['validate']."',"; } - if ($val['comment']) { + if (!empty($val['comment'])) { $texttoinsert .= " 'comment'=>\"".preg_replace('/"/', '', $val['comment'])."\""; } @@ -311,7 +311,7 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir = ' if ($key == 'entity') { $texttoinsert .= ' DEFAULT 1'; } else { - if ($val['default'] != '') { + if (!empty($val['default']) && $val['default'] != '') { if (preg_match('/^null$/i', $val['default'])) { $texttoinsert .= " DEFAULT NULL"; } elseif (preg_match('/varchar/', $type)) { diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 60f23cbee1a..e0bd19ab251 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -1309,7 +1309,7 @@ if ($dirins && $action == 'addproperty' && empty($cancel) && !empty($module) && } } - if (!$error) { + if (!$error && !GETPOST('regenerateclasssql')&& !GETPOST('regeneratemissing')) { $addfieldentry = array( 'name'=>GETPOST('propname', 'aZ09'), 'label'=>GETPOST('proplabel', 'alpha'), @@ -1335,6 +1335,8 @@ if ($dirins && $action == 'addproperty' && empty($cancel) && !empty($module) && if (!empty($addfieldentry['arrayofkeyval']) && !is_array($addfieldentry['arrayofkeyval'])) { $addfieldentry['arrayofkeyval'] = json_decode($addfieldentry['arrayofkeyval'], true); } + } else { + $addfieldentry = array(); } /*if (GETPOST('regeneratemissing')) From edbf1bb34b903d3c16c903935cac8b1847f516e3 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Tue, 22 Feb 2022 16:35:10 +0100 Subject: [PATCH 002/115] update to fix PR --- htdocs/core/lib/modulebuilder.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/modulebuilder.lib.php b/htdocs/core/lib/modulebuilder.lib.php index d5d4aa8c2c4..1e4c43b1f90 100644 --- a/htdocs/core/lib/modulebuilder.lib.php +++ b/htdocs/core/lib/modulebuilder.lib.php @@ -311,7 +311,7 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir = ' if ($key == 'entity') { $texttoinsert .= ' DEFAULT 1'; } else { - if (!empty($val['default']) && $val['default'] != '') { + if (!empty($val['default'])) { if (preg_match('/^null$/i', $val['default'])) { $texttoinsert .= " DEFAULT NULL"; } elseif (preg_match('/varchar/', $type)) { From b45aeda14d1d3d37b3f9560f6bcbab74bff6cea4 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 15 Mar 2022 09:41:51 +0000 Subject: [PATCH 003/115] Fixing style errors. --- htdocs/modulebuilder/index.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 240c739e5c0..eddf9b3c7de 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -1332,8 +1332,8 @@ if ($dirins && $action == 'addproperty' && empty($cancel) && !empty($module) && setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Type")), null, 'errors'); } - if (!$error && !GETPOST('regenerateclasssql')&& !GETPOST('regeneratemissing')) { - $addfieldentry = array( + if (!$error && !GETPOST('regenerateclasssql')&& !GETPOST('regeneratemissing')) { + $addfieldentry = array( 'name'=>GETPOST('propname', 'aZ09'), 'label'=>GETPOST('proplabel', 'alpha'), 'type'=>GETPOST('proptype', 'alpha'), @@ -1353,7 +1353,7 @@ if ($dirins && $action == 'addproperty' && empty($cancel) && !empty($module) && 'default'=>GETPOST('propdefault', 'restricthtml'), 'noteditable'=>intval(GETPOST('propnoteditable', 'int')), 'validate' => GETPOST('propvalidate', 'int') - ); + ); if (!empty($addfieldentry['arrayofkeyval']) && !is_array($addfieldentry['arrayofkeyval'])) { From 89eb19bafb4acdcc0b71eb3dafec044682646a1c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Apr 2022 17:51:42 +0200 Subject: [PATCH 004/115] Update modulebuilder.lib.php --- htdocs/core/lib/modulebuilder.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/modulebuilder.lib.php b/htdocs/core/lib/modulebuilder.lib.php index 1e4c43b1f90..27c96c2e972 100644 --- a/htdocs/core/lib/modulebuilder.lib.php +++ b/htdocs/core/lib/modulebuilder.lib.php @@ -128,7 +128,7 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir = if (!empty($val['noteditable'])) { $texttoinsert .= " 'noteditable'=>'".$val['noteditable']."',"; } - if (!empty($val['default']) || (!empty($val['default']) && $val['default'] === '0')) { + if (!empty($val['default']) || (isset($val['default']) && $val['default'] === '0')) { $texttoinsert .= " 'default'=>'".$val['default']."',"; } if (!empty($val['index'])) { From 51837690fe20a92c7a3cde93ac366abc53e76ef0 Mon Sep 17 00:00:00 2001 From: wdammak <26695620+wdammak@users.noreply.github.com> Date: Thu, 7 Apr 2022 01:10:29 +0100 Subject: [PATCH 005/115] Avoid duplicate 3rd partires --- htdocs/societe/card.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 45bbefabdab..b72f41e436a 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1291,8 +1291,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''.$form->editfieldkey('ThirdPartyName', 'name', '', $object, 0).''; } print 'global->SOCIETE_USEPREFIX) ? ' colspan="3"' : '').'>'; - print ''; - print $form->widgetForTranslation("name", $object, $permissiontoadd, 'string', 'alpahnohtml', 'minwidth300'); + //print ''; + //print $form->widgetForTranslation("name", $object, $permissiontoadd, 'string', 'alpahnohtml', 'minwidth300'); + print $form->select_company(0, 'name', '(s.client = 1 OR s.client = 3) AND status=1', ' '); + print ""; print ''; if (!empty($conf->global->SOCIETE_USEPREFIX)) { // Old not used prefix field print ''.$langs->trans('Prefix').''; From 5d9cfaa823e220ec9087f59b64daa90c534b183a Mon Sep 17 00:00:00 2001 From: wdammak <26695620+wdammak@users.noreply.github.com> Date: Wed, 13 Apr 2022 01:09:44 +0100 Subject: [PATCH 006/115] Update card.php --- htdocs/societe/card.php | 86 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 84 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index b72f41e436a..e25d515ff7b 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1293,8 +1293,90 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print 'global->SOCIETE_USEPREFIX) ? ' colspan="3"' : '').'>'; //print ''; //print $form->widgetForTranslation("name", $object, $permissiontoadd, 'string', 'alpahnohtml', 'minwidth300'); - print $form->select_company(0, 'name', '(s.client = 1 OR s.client = 3) AND status=1', ' '); - print ""; + //print $form->select_company(0, 'name', '(s.client = 1 OR s.client = 3) AND status=1', ' '); + //print ""; + print ''; +?> + +'; if (!empty($conf->global->SOCIETE_USEPREFIX)) { // Old not used prefix field print ''.$langs->trans('Prefix').''; From 150a21820f5c0342c7082e604aeb8913921f4258 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 13 Apr 2022 00:14:23 +0000 Subject: [PATCH 007/115] Fixing style errors. --- htdocs/societe/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index e25d515ff7b..83c6975e3c7 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1296,7 +1296,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { //print $form->select_company(0, 'name', '(s.client = 1 OR s.client = 3) AND status=1', ' '); //print ""; print ''; -?> + ?> -'; if (!empty($conf->global->SOCIETE_USEPREFIX)) { // Old not used prefix field print ''.$langs->trans('Prefix').''; From 9c8d21c63aecd42b87801b8e3c3b2856d4884a9a Mon Sep 17 00:00:00 2001 From: wdammak <26695620+wdammak@users.noreply.github.com> Date: Wed, 13 Apr 2022 01:14:36 +0100 Subject: [PATCH 008/115] Create ajaxcompanies.php --- htdocs/core/ajax/ajaxcompanies.php | 126 +++++++++++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 htdocs/core/ajax/ajaxcompanies.php diff --git a/htdocs/core/ajax/ajaxcompanies.php b/htdocs/core/ajax/ajaxcompanies.php new file mode 100644 index 00000000000..aeda242e53e --- /dev/null +++ b/htdocs/core/ajax/ajaxcompanies.php @@ -0,0 +1,126 @@ + + * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2007-2010 Laurent Destailleur + * Copyright (C) 2010 Cyrille de Lambert + * + * 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/core/ajax/ajaxcompanies.php + * \brief File to return Ajax response on third parties request + */ + +if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); // Disables token renewal +if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); +if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); +if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); +if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); +if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); + +require '../../main.inc.php'; + + +/* + * View + */ + +// Ajout directives pour resoudre bug IE +//header('Cache-Control: Public, must-revalidate'); +//header('Pragma: public'); + +//top_htmlhead("", "", 1); // Replaced with top_httphead. An ajax page does not need html header. +top_httphead(); + +//print ''."\n"; + +dol_syslog(join(',', $_GET)); + + +// Generation liste des societes +if (GETPOST('newcompany') || GETPOST('socid', 'int') || GETPOST('id_fourn')) +{ + $return_arr = array(); + + // Define filter on text typed + $socid = $_GET['newcompany'] ? $_GET['newcompany'] : ''; + if (!$socid) $socid = $_GET['socid'] ? $_GET['socid'] : ''; + if (!$socid) $socid = $_GET['id_fourn'] ? $_GET['id_fourn'] : ''; + + $sql = "SELECT s.rowid, s.nom, s.name_alias, s.code_client, s.code_fournisseur, s.address, s.zip, s.town, s.email, s.siren, s.siret, s.ape, s.idprof4, s.client, s.fournisseur, s.datec"; + $sql .= " , c.label as country, d.nom as departement"; + $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = s.fk_pays"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d ON d.rowid = s.fk_departement"; + $sql .= " WHERE s.entity IN (".getEntity('societe').")"; + if ($socid) + { + $sql .= " AND ("; + // Add criteria on name/code + if (!empty($conf->global->COMPANY_DONOTSEARCH_ANYWHERE)) // Can use index + { + $sql .= "s.nom LIKE '".$db->escape($socid)."%'"; + $sql .= " OR s.code_client LIKE '".$db->escape($socid)."%'"; + $sql .= " OR s.code_fournisseur LIKE '".$db->escape($socid)."%'"; + } else { + $sql .= "s.nom LIKE '%".$db->escape($socid)."%'"; + $sql .= " OR s.code_client LIKE '%".$db->escape($socid)."%'"; + $sql .= " OR s.code_fournisseur LIKE '%".$db->escape($socid)."%'"; + } + if (!empty($conf->global->SOCIETE_ALLOW_SEARCH_ON_ROWID)) $sql .= " OR s.rowid = '".$db->escape($socid)."'"; + $sql .= ")"; + } + //if (GETPOST("filter")) $sql.= " AND (".GETPOST("filter", "alpha").")"; // Add other filters + $sql .= " ORDER BY s.nom ASC"; + + //dol_syslog("ajaxcompanies", LOG_DEBUG); + $resql = $db->query($sql); + + if ($resql) + { + while ($row = $db->fetch_array($resql)) + { + $label = $row['nom']; + if ($socid) $label = $label; + $row_array['label'] = $label; + $row_array['value'] = $row['nom']; + $row_array['key'] = $row['rowid']; + $row_array['name_alias'] = $row['name_alias']; + $row_array['code_client'] = $row['code_client']; + $row_array['code_fournisseur'] = $row['code_fournisseur']; + $row_array['address'] = $row['address']; + $row_array['zip'] = $row['zip']; + $row_array['town'] = $row['town']; + $row_array['email'] = $row['email']; + $row_array['siren'] = $row['siren']; + $row_array['siret'] = $row['siret']; + $row_array['ape'] = $row['ape']; + $row_array['idprof4'] = $row['idprof4']; + $row_array['client'] = $row['client']; + $row_array['fournisseur'] = $row['fournisseur']; + $row_array['datec'] = $row['datec']; + $row_array['country'] = $row['country']; + $row_array['departement'] = $row['departement']; + + array_push($return_arr, $row_array); + } + + echo json_encode($return_arr); + } else { + echo json_encode(array('nom'=>'Error', 'label'=>'Error', 'key'=>'Error', 'value'=>'Error')); + } +} else { + echo json_encode(array('nom'=>'ErrorBadParameter', 'label'=>'ErrorBadParameter', 'key'=>'ErrorBadParameter', 'value'=>'ErrorBadParameter')); +} From 02435a616b1250e018f5e4cce217443271faf68e Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 13 Apr 2022 00:19:15 +0000 Subject: [PATCH 009/115] Fixing style errors. --- htdocs/core/ajax/ajaxcompanies.php | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/htdocs/core/ajax/ajaxcompanies.php b/htdocs/core/ajax/ajaxcompanies.php index aeda242e53e..173d176c031 100644 --- a/htdocs/core/ajax/ajaxcompanies.php +++ b/htdocs/core/ajax/ajaxcompanies.php @@ -50,8 +50,7 @@ dol_syslog(join(',', $_GET)); // Generation liste des societes -if (GETPOST('newcompany') || GETPOST('socid', 'int') || GETPOST('id_fourn')) -{ +if (GETPOST('newcompany') || GETPOST('socid', 'int') || GETPOST('id_fourn')) { $return_arr = array(); // Define filter on text typed @@ -65,12 +64,10 @@ if (GETPOST('newcompany') || GETPOST('socid', 'int') || GETPOST('id_fourn')) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = s.fk_pays"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d ON d.rowid = s.fk_departement"; $sql .= " WHERE s.entity IN (".getEntity('societe').")"; - if ($socid) - { + if ($socid) { $sql .= " AND ("; // Add criteria on name/code - if (!empty($conf->global->COMPANY_DONOTSEARCH_ANYWHERE)) // Can use index - { + if (!empty($conf->global->COMPANY_DONOTSEARCH_ANYWHERE)) { // Can use index $sql .= "s.nom LIKE '".$db->escape($socid)."%'"; $sql .= " OR s.code_client LIKE '".$db->escape($socid)."%'"; $sql .= " OR s.code_fournisseur LIKE '".$db->escape($socid)."%'"; @@ -87,11 +84,9 @@ if (GETPOST('newcompany') || GETPOST('socid', 'int') || GETPOST('id_fourn')) //dol_syslog("ajaxcompanies", LOG_DEBUG); $resql = $db->query($sql); - - if ($resql) - { - while ($row = $db->fetch_array($resql)) - { + + if ($resql) { + while ($row = $db->fetch_array($resql)) { $label = $row['nom']; if ($socid) $label = $label; $row_array['label'] = $label; From b07096ad453a4066b4041a9610e53d78086b0eb7 Mon Sep 17 00:00:00 2001 From: wdammak <26695620+wdammak@users.noreply.github.com> Date: Wed, 13 Apr 2022 17:07:23 +0100 Subject: [PATCH 010/115] Update ajaxcompanies.php Add logo --- htdocs/core/ajax/ajaxcompanies.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/ajax/ajaxcompanies.php b/htdocs/core/ajax/ajaxcompanies.php index 173d176c031..350f03398aa 100644 --- a/htdocs/core/ajax/ajaxcompanies.php +++ b/htdocs/core/ajax/ajaxcompanies.php @@ -58,7 +58,7 @@ if (GETPOST('newcompany') || GETPOST('socid', 'int') || GETPOST('id_fourn')) { if (!$socid) $socid = $_GET['socid'] ? $_GET['socid'] : ''; if (!$socid) $socid = $_GET['id_fourn'] ? $_GET['id_fourn'] : ''; - $sql = "SELECT s.rowid, s.nom, s.name_alias, s.code_client, s.code_fournisseur, s.address, s.zip, s.town, s.email, s.siren, s.siret, s.ape, s.idprof4, s.client, s.fournisseur, s.datec"; + $sql = "SELECT s.rowid, s.nom, s.name_alias, s.code_client, s.code_fournisseur, s.address, s.zip, s.town, s.email, s.siren, s.siret, s.ape, s.idprof4, s.client, s.fournisseur, s.datec, s.logo"; $sql .= " , c.label as country, d.nom as departement"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = s.fk_pays"; @@ -106,6 +106,7 @@ if (GETPOST('newcompany') || GETPOST('socid', 'int') || GETPOST('id_fourn')) { $row_array['client'] = $row['client']; $row_array['fournisseur'] = $row['fournisseur']; $row_array['datec'] = $row['datec']; + $row_array['logo'] = $row['logo']; $row_array['country'] = $row['country']; $row_array['departement'] = $row['departement']; From 88a6b6535349314e7f5bbee259cab2a694f0b2e5 Mon Sep 17 00:00:00 2001 From: wdammak <26695620+wdammak@users.noreply.github.com> Date: Wed, 13 Apr 2022 17:11:51 +0100 Subject: [PATCH 011/115] Update card.php Add logo --- htdocs/societe/card.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 83c6975e3c7..363d8e8d69d 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1301,7 +1301,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $(document).ready(function () { $('#name').select2({ ajax: { - url: '/htdocs/core/ajax/ajaxcompanies.php', + url: '/core/ajax/ajaxcompanies.php', dataType: 'json', delay: 250, data: function (params) { @@ -1330,13 +1330,22 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { function formatCustomer (Customer) { - if (Customer.loading) { + if(Customer.label === undefined) { return Customer.text; } + var logo = ''; + if(Customer.logo !== undefined) { + logo = "" + - "
" + - "
" + + "
" + logo + + "
" + "
" + "
" + "
" + From db96173189b72fb1c9a55ae260dfea2cb61ff196 Mon Sep 17 00:00:00 2001 From: wdammak <26695620+wdammak@users.noreply.github.com> Date: Wed, 13 Apr 2022 18:00:24 +0100 Subject: [PATCH 012/115] Update card.php --- htdocs/societe/card.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 363d8e8d69d..03a8bf30fa1 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1340,7 +1340,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { logo += "/viewimage.php?modulepart=societe&entity=1&file=" + Customer.key + "%2Flogos%2Fthumbs%2F" + Customer.logo.replace('.', '_mini.') + "&cache=0"; logo += "' />
"; } else { - logo = '
'; + logo = '
'; } var $container = $("
" + @@ -1365,17 +1365,17 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { ); $container.find('.select2-result-repository__title').text(Customer.label); - $container.find('.select2-result-repository__name_alias').text(Customer.name_alias); - $container.find('.select2-result-repository__code_client').text(Customer.code_client); - $container.find('.select2-result-repository__code_fournisseur').text(Customer.code_fournisseur); - $container.find('.select2-result-repository__email').append('Mail: ' + Customer.email); - $container.find('.select2-result-repository__address').append('Address: ' + Customer.address); - $container.find('.select2-result-repository__country').append('Country: ' + Customer.country); - $container.find('.select2-result-repository__departement').append('Departement: ' + Customer.departement); - $container.find('.select2-result-repository__zip').append('Zip: ' + Customer.zip); - $container.find('.select2-result-repository__town').append('Town: ' + Customer.town); - $container.find('.select2-result-repository__siren').append('Siren: ' + Customer.siren); - $container.find('.select2-result-repository__datec').append('Created: ' + Customer.datec); + $container.find('.select2-result-repository__name_alias').text(Customer.name_alias ? Customer.name_alias : ''); + $container.find('.select2-result-repository__code_client').text(Customer.code_client ? Customer.code_client : ''); + $container.find('.select2-result-repository__code_fournisseur').text((Customer.code_fournisseur!==null) ? Customer.code_fournisseur : ''); + $container.find('.select2-result-repository__email').append('Mail: ' + (Customer.email !== null ? Customer.email : '')); + $container.find('.select2-result-repository__address').append('Address: ' + (Customer.address !== null ? Customer.address : '')); + $container.find('.select2-result-repository__country').append('Country: ' + (Customer.country !== null ? Customer.country : '')); + $container.find('.select2-result-repository__departement').append('Departement: ' + (Customer.departement !== null ? Customer.departement : '')); + $container.find('.select2-result-repository__zip').append('Zip: ' + (Customer.zip !== null ? Customer.zip : '')); + $container.find('.select2-result-repository__town').append('Town: ' + (Customer.town !== null ? Customer.town : '')); + $container.find('.select2-result-repository__siren').append('Siren: ' + (Customer.siren !== null ? Customer.siren : '')); + $container.find('.select2-result-repository__datec').append('Created: ' + (Customer.datec !== null ? Customer.datec : '')); return $container; } From fb2243dacde39ae8ebac2fa3f573d1f4de9b7c82 Mon Sep 17 00:00:00 2001 From: wdammak <26695620+wdammak@users.noreply.github.com> Date: Thu, 14 Apr 2022 16:19:55 +0100 Subject: [PATCH 013/115] Update card.php --- htdocs/societe/card.php | 179 +++++++++++++++++++--------------------- 1 file changed, 87 insertions(+), 92 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 03a8bf30fa1..6ff756b6021 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1293,99 +1293,94 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print 'global->SOCIETE_USEPREFIX) ? ' colspan="3"' : '').'>'; //print ''; //print $form->widgetForTranslation("name", $object, $permissiontoadd, 'string', 'alpahnohtml', 'minwidth300'); - //print $form->select_company(0, 'name', '(s.client = 1 OR s.client = 3) AND status=1', ' '); - //print ""; - print ''; - ?> - - + '; print ''; if (!empty($conf->global->SOCIETE_USEPREFIX)) { // Old not used prefix field print ''.$langs->trans('Prefix').''; From 2af2efacdb68bb8847287fb2ce2966caa87cb2ed Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Fri, 15 Apr 2022 14:42:34 +0200 Subject: [PATCH 014/115] better fix for line 131 in modulebuilder.lib --- htdocs/core/lib/modulebuilder.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/modulebuilder.lib.php b/htdocs/core/lib/modulebuilder.lib.php index 1e4c43b1f90..27c96c2e972 100644 --- a/htdocs/core/lib/modulebuilder.lib.php +++ b/htdocs/core/lib/modulebuilder.lib.php @@ -128,7 +128,7 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir = if (!empty($val['noteditable'])) { $texttoinsert .= " 'noteditable'=>'".$val['noteditable']."',"; } - if (!empty($val['default']) || (!empty($val['default']) && $val['default'] === '0')) { + if (!empty($val['default']) || (isset($val['default']) && $val['default'] === '0')) { $texttoinsert .= " 'default'=>'".$val['default']."',"; } if (!empty($val['index'])) { From 179716ac004ed0840d29f8b6d13c89b7906da8b6 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Tue, 17 May 2022 09:17:36 +0200 Subject: [PATCH 015/115] add constant to hide stock on cart --- htdocs/takepos/invoice.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index eec8ab7d363..6aca4e01a5d 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -1560,7 +1560,7 @@ if ($placeid > 0) { $htmlforlines .= ''; if (!empty($conf->stock->enabled) && !empty($user->rights->stock->mouvement->lire)) { $constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"]; - if (!empty($conf->global->$constantforkey) && $line->fk_product > 0) { + if (!empty($conf->global->$constantforkey) && $line->fk_product > 0 && empty($conf->global->TAKEPOS_HIDE_STOCK_ON_LINE)) { $sql = "SELECT e.rowid, e.ref, e.lieu, e.fk_parent, e.statut, ps.reel, ps.rowid as product_stock_id, p.pmp"; $sql .= " FROM ".MAIN_DB_PREFIX."entrepot as e,"; $sql .= " ".MAIN_DB_PREFIX."product_stock as ps"; From 61f7c4395b7bf598223c5dc1c6385d0cb6e5f1cc Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 17 May 2022 11:55:57 +0200 Subject: [PATCH 016/115] fix: module builder template bad error message affactation --- htdocs/modulebuilder/template/admin/setup.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php index fe92596d228..e94a2678b4a 100644 --- a/htdocs/modulebuilder/template/admin/setup.php +++ b/htdocs/modulebuilder/template/admin/setup.php @@ -436,7 +436,7 @@ if ($action == 'edit') { if ($resprod > 0) { print $product->ref; } elseif ($resprod < 0) { - setEventMessages(null, $object->errors, "errors"); + setEventMessages(null, $product->errors, "errors"); } } else { print $conf->global->{$constname}; From 978db41f37cd61ef59b0d4a8f383b6c024d899b1 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Tue, 17 May 2022 15:50:45 +0200 Subject: [PATCH 017/115] FIX qty received label in Squille PDF model --- .../reception/doc/pdf_squille.modules.php | 28 +++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/htdocs/core/modules/reception/doc/pdf_squille.modules.php b/htdocs/core/modules/reception/doc/pdf_squille.modules.php index 38344a5f486..d81a01bea92 100644 --- a/htdocs/core/modules/reception/doc/pdf_squille.modules.php +++ b/htdocs/core/modules/reception/doc/pdf_squille.modules.php @@ -523,9 +523,9 @@ class pdf_squille extends ModelePdfReception while ($pagenb < $pageposafter) { $pdf->setPage($pagenb); if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object); } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object); } $this->_pagefoot($pdf, $object, $outputlangs, 1); $pagenb++; @@ -534,9 +534,9 @@ class pdf_squille extends ModelePdfReception } if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) { if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object); } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object); } $this->_pagefoot($pdf, $object, $outputlangs, 1); // New page @@ -550,10 +550,10 @@ class pdf_squille extends ModelePdfReception // Show square if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0, $object); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } @@ -719,9 +719,10 @@ class pdf_squille extends ModelePdfReception * @param Translate $outputlangs Langs object * @param int $hidetop Hide top bar of array * @param int $hidebottom Hide bottom bar of array + * @param Object|NULL $object Object reception to generate * @return void */ - protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0) + protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $object = null) { global $conf; @@ -767,7 +768,18 @@ class pdf_squille extends ModelePdfReception $pdf->line($this->posxqtytoship - 1, $tab_top, $this->posxqtytoship - 1, $tab_top + $tab_height); if (empty($hidetop)) { $pdf->SetXY($this->posxqtytoship, $tab_top + 1); - $pdf->MultiCell(($this->posxpuht - $this->posxqtytoship), 2, $outputlangs->transnoentities("QtyToReceive"), '', 'C'); + $statusreceived = Reception::STATUS_CLOSED; + if (getDolGlobalInt("STOCK_CALCULATE_ON_RECEPTION")) { + $statusreceived = Reception::STATUS_VALIDATED; + } + if (getDolGlobalInt("STOCK_CALCULATE_ON_RECEPTION_CLOSE")) { + $statusreceived = Reception::STATUS_CLOSED; + } + if ($object && $object->statut < $statusreceived) { + $pdf->MultiCell(($this->posxpuht - $this->posxqtytoship), 2, $outputlangs->transnoentities('QtyToReceive'), '', 'C'); + } else { + $pdf->MultiCell(($this->posxpuht - $this->posxqtytoship), 2, $outputlangs->transnoentities('QtyReceived'), '', 'C'); + } } if (!empty($conf->global->MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT)) { From f18dc89bdf23dba705aee39ecf4984adf690c6ad Mon Sep 17 00:00:00 2001 From: atm-lena Date: Tue, 17 May 2022 16:26:43 +0200 Subject: [PATCH 018/115] Add ddate signature in fetch propal --- htdocs/comm/propal/class/propal.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index ef193898df7..c18e0e7a6df 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1455,6 +1455,7 @@ class Propal extends CommonObject $sql = "SELECT p.rowid, p.ref, p.entity, p.remise, p.remise_percent, p.remise_absolue, p.fk_soc"; $sql .= ", p.total_ttc, p.total_tva, p.localtax1, p.localtax2, p.total_ht"; $sql .= ", p.datec"; + $sql .= ", p.date_signature as dates"; $sql .= ", p.date_valid as datev"; $sql .= ", p.datep as dp"; $sql .= ", p.fin_validite as dfv"; @@ -1538,6 +1539,7 @@ class Propal extends CommonObject $this->date_creation = $this->db->jdate($obj->datec); //Creation date $this->date_validation = $this->db->jdate($obj->datev); //Validation date $this->date_modification = $this->db->jdate($obj->date_modification); // tms + $this->date_signature = $this->db->jdate($obj->dates); // Signature date $this->date = $this->db->jdate($obj->dp); // Proposal date $this->datep = $this->db->jdate($obj->dp); // deprecated $this->fin_validite = $this->db->jdate($obj->dfv); From 180d94b43c93a5d165f6d7a9d326e84ad9aa8fa3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 17 May 2022 20:31:50 +0200 Subject: [PATCH 019/115] More log --- htdocs/website/index.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 0e192ff0212..b7062b4f599 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2741,6 +2741,7 @@ if (!GETPOST('hide_websitemenu')) { $htmltext .= '
'.$langs->trans("GoTo").' '.$virtualurl.'

'; } if (!empty($conf->global->WEBSITE_REPLACE_INFO_ABOUT_USAGE_WITH_WEBSERVER)) { + $htmltext .= ''; $htmltext .= '
'.$langs->trans($conf->global->WEBSITE_REPLACE_INFO_ABOUT_USAGE_WITH_WEBSERVER); } else { $htmltext .= $langs->trans("SetHereVirtualHost", $dataroot); From ed2e1bda46099dc306631f213e1078482683a6ff Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 May 2022 11:00:43 +0200 Subject: [PATCH 020/115] Clean code v16 --- htdocs/admin/expensereport_ik.php | 13 +- htdocs/admin/expensereport_rules.php | 48 +- .../bank/class/paymentvarious.class.php | 2 +- .../deplacement/class/deplacement.class.php | 2 +- .../facture/class/facture-rec.class.php | 2 +- htdocs/compta/facture/class/facture.class.php | 2 +- .../facture/class/facturestats.class.php | 2 +- .../facture/class/paymentterm.class.php | 2 +- .../sociales/class/chargesociales.class.php | 2 +- .../class/paymentsocialcontribution.class.php | 2 +- htdocs/core/class/coreobject.class.php | 413 ------------------ htdocs/core/customreports.php | 2 +- htdocs/core/db/sqlite3.class.php | 2 +- .../expedition/doc/pdf_espadon.modules.php | 2 +- .../class/expensereport_ik.class.php | 71 ++- .../class/expensereport_rule.class.php | 75 +++- 16 files changed, 183 insertions(+), 459 deletions(-) delete mode 100644 htdocs/core/class/coreobject.class.php diff --git a/htdocs/admin/expensereport_ik.php b/htdocs/admin/expensereport_ik.php index 900754ef4b4..10b14f8ee99 100644 --- a/htdocs/admin/expensereport_ik.php +++ b/htdocs/admin/expensereport_ik.php @@ -36,10 +36,10 @@ $langs->loadLangs(array("admin", "trips", "errors", "other", "dict")); $error = 0; $action = GETPOST('action', 'aZ09'); + $id = GETPOST('id', 'int'); $ikoffset = GETPOST('ikoffset', 'int'); $coef = GETPOST('coef', 'int'); - $fk_c_exp_tax_cat = GETPOST('fk_c_exp_tax_cat'); $fk_range = GETPOST('fk_range', 'int'); @@ -62,9 +62,16 @@ if ($action == 'updateik') { } } - $expIk->setValues($_POST); - $result = $expIk->create($user); + $expIk->coef = $coef; + $expIk->ikoffset = $ikoffset; + $expIk->fk_c_exp_tax_cat = $fk_c_exp_tax_cat; + $expIk->fk_range = $fk_range; + if ($expIk->id > 0) { + $result = $expIk->update($user); + } else { + $result = $expIk->create($user); + } if ($result > 0) { setEventMessages('SetupSaved', null, 'mesgs'); diff --git a/htdocs/admin/expensereport_rules.php b/htdocs/admin/expensereport_rules.php index 62fb097841b..7c27ee6e408 100644 --- a/htdocs/admin/expensereport_rules.php +++ b/htdocs/admin/expensereport_rules.php @@ -34,13 +34,19 @@ require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport_rule.class.ph // Load translation files required by the page $langs->loadLangs(array("admin", "other", "trips", "errors", "dict")); +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('admin', 'dictionaryadmin','expensereport_rules')); + +$object = new ExpenseReportRule($db); + if (!$user->admin) { accessforbidden(); } -// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$hookmanager->initHooks(array('admin', 'dictionaryadmin','expensereport_rules')); +/* + * Action + */ $parameters = array(); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks @@ -51,7 +57,6 @@ if ($reshook < 0) { if (empty($reshook)) { //Init error $error = false; - $message = false; $action = GETPOST('action', 'aZ09'); $id = GETPOST('id', 'int'); @@ -59,21 +64,20 @@ if (empty($reshook)) { $apply_to = GETPOST('apply_to'); $fk_user = GETPOST('fk_user', 'int'); $fk_usergroup = GETPOST('fk_usergroup', 'int'); - - $fk_c_type_fees = GETPOST('fk_c_type_fees'); + $restrictive = GETPOST('restrictive', 'int'); + $fk_c_type_fees = GETPOST('fk_c_type_fees', 'int'); $code_expense_rules_type = GETPOST('code_expense_rules_type'); $dates = dol_mktime(12, 0, 0, GETPOST('startmonth'), GETPOST('startday'), GETPOST('startyear')); $datee = dol_mktime(12, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear')); - $amount = GETPOST('amount'); + $amount = price2num(GETPOST('amount'), 'MT', 2); - $object = new ExpenseReportRule($db); if (!empty($id)) { $result = $object->fetch($id); if ($result < 0) { dol_print_error('', $object->error, $object->errors); } } - // TODO do action + if ($action == 'save') { $error = 0; @@ -104,8 +108,6 @@ if (empty($reshook)) { } if (empty($error)) { - $object->setValues($_POST); - if ($apply_to == 'U') { $object->fk_user = (int) $fk_user; $object->fk_usergroup = 0; @@ -122,18 +124,30 @@ if (empty($reshook)) { $object->dates = $dates; $object->datee = $datee; - + $object->restrictive = $restrictive; + $object->fk_c_type_fees = $fk_c_type_fees; + $object->code_expense_rules_type = $code_expense_rules_type; + $object->amount = $amount; $object->entity = $conf->entity; - $res = $object->create($user); + if ($object->id > 0) { + $res = $object->update($user); + } else { + $res = $object->create($user); + } if ($res > 0) { setEventMessages($langs->trans('ExpenseReportRuleSave'), null); } else { dol_print_error($object->db); + $error++; } - header('Location: ' . $_SERVER['PHP_SELF']); - exit; + if (!$error) { + header('Location: ' . $_SERVER['PHP_SELF']); + exit; + } else { + $action = ''; + } } } elseif ($action == 'delete') { // TODO add confirm @@ -207,7 +221,7 @@ if ($action != 'edit') { echo '' . $form->selectarray('code_expense_rules_type', $tab_rules_type, '', 0) . ''; echo '' . $form->selectDate(strtotime(date('Y-m-01', dol_now())), 'start', '', '', 0, '', 1, 0) . ''; echo ' ' . $conf->currency . ''; + echo ''; echo '' . $form->selectyesno('restrictive', 0, 1) . ''; echo ''; echo ''; @@ -304,10 +318,10 @@ foreach ($rules as $rule) { } echo ''; - + // Amount echo ''; if ($action == 'edit' && $object->id == $rule->id) { - echo '' . $conf->currency; + echo ''; } else { echo price($rule->amount, 0, $langs, 1, -1, -1, $conf->currency); } diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index cdcd26490a3..77aded9c594 100644 --- a/htdocs/compta/bank/class/paymentvarious.class.php +++ b/htdocs/compta/bank/class/paymentvarious.class.php @@ -165,7 +165,7 @@ class PaymentVarious extends CommonObject * * @param DoliDB $db Database handler */ - public function __construct($db) + public function __construct(DoliDB $db) { $this->db = $db; $this->element = 'payment_various'; diff --git a/htdocs/compta/deplacement/class/deplacement.class.php b/htdocs/compta/deplacement/class/deplacement.class.php index e05750918da..c09943540bc 100644 --- a/htdocs/compta/deplacement/class/deplacement.class.php +++ b/htdocs/compta/deplacement/class/deplacement.class.php @@ -121,7 +121,7 @@ class Deplacement extends CommonObject * * @param DoliDB $db Database handler */ - public function __construct($db) + public function __construct(DoliDB $db) { $this->db = $db; diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index a406a48c7f6..af6d4dc606b 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -222,7 +222,7 @@ class FactureRec extends CommonInvoice * * @param DoliDB $db Database handler */ - public function __construct($db) + public function __construct(DoliDB $db) { $this->db = $db; } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index a5cb99c2260..e971262208c 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -428,7 +428,7 @@ class Facture extends CommonInvoice * * @param DoliDB $db Database handler */ - public function __construct($db) + public function __construct(DoliDB $db) { $this->db = $db; } diff --git a/htdocs/compta/facture/class/facturestats.class.php b/htdocs/compta/facture/class/facturestats.class.php index a54cd1a6668..522fe9aa2e2 100644 --- a/htdocs/compta/facture/class/facturestats.class.php +++ b/htdocs/compta/facture/class/facturestats.class.php @@ -57,7 +57,7 @@ class FactureStats extends Stats * @param int $typentid Id typent of thirdpary for filter * @param int $categid Id category of thirdpary for filter */ - public function __construct($db, $socid, $mode, $userid = 0, $typentid = 0, $categid = 0) + public function __construct(DoliDB $db, $socid, $mode, $userid = 0, $typentid = 0, $categid = 0) { global $user, $conf; diff --git a/htdocs/compta/facture/class/paymentterm.class.php b/htdocs/compta/facture/class/paymentterm.class.php index f94ad573a81..a4441804570 100644 --- a/htdocs/compta/facture/class/paymentterm.class.php +++ b/htdocs/compta/facture/class/paymentterm.class.php @@ -68,7 +68,7 @@ class PaymentTerm // extends CommonObject * * @param DoliDB $db Database handler */ - public function __construct($db) + public function __construct(DoliDB $db) { $this->db = $db; } diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index 6996c689922..70d8da4c27b 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -123,7 +123,7 @@ class ChargeSociales extends CommonObject * * @param DoliDB $db Database handler */ - public function __construct($db) + public function __construct(DoliDB $db) { $this->db = $db; } diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index 9a4b50e3474..b6a611a47ee 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -105,7 +105,7 @@ class PaymentSocialContribution extends CommonObject * * @param DoliDB $db Database handler */ - public function __construct($db) + public function __construct(DoliDB $db) { $this->db = $db; } diff --git a/htdocs/core/class/coreobject.class.php b/htdocs/core/class/coreobject.class.php deleted file mode 100644 index 1bb4e92a0c9..00000000000 --- a/htdocs/core/class/coreobject.class.php +++ /dev/null @@ -1,413 +0,0 @@ - - * - * 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/core/class/coreobject.class.php - * \ingroup core - * \brief File of class to manage all object. Might be replace or merge into commonobject - */ - -require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; - -// TODO Remove this class (used in Expensereportik and ExpenseReportRule -/** - * CoreObject - */ -class CoreObject extends CommonObject -{ - public $withChild = true; - - /** - * @var Array $_fields Fields to synchronize with Database - */ - protected $fields = array(); - - /** - * Constructor - * - * @param DoliDB $db Database handler - */ - public function __construct(DoliDB &$db) - { - $this->db = $db; - } - - /** - * Function to init fields - * - * @return bool - */ - protected function init() - { - $this->id = 0; - $this->datec = 0; - $this->tms = 0; - - if (!empty($this->fields)) { - foreach ($this->fields as $field => $info) { - if ($this->isDate($info)) { - $this->{$field} = time(); - } elseif ($this->isArray($info)) { - $this->{$field} = array(); - } elseif ($this->isInt($info)) { - $this->{$field} = (int) 0; - } elseif ($this->isFloat($info)) { - $this->{$field} = (double) 0; - } else { - $this->{$field} = ''; - } - } - - $this->to_delete = false; - $this->is_clone = false; - - return true; - } else { - return false; - } - } - - /** - * Test type of field - * - * @param string $field name of field - * @param string $type type of field to test - * @return boolean value of field or false - */ - private function checkFieldType($field, $type) - { - if (isset($this->fields[$field]) && method_exists($this, 'is_'.$type)) { - return $this->{'is_'.$type}($this->fields[$field]); - } else { - return false; - } - } - - /** - * Get object and children from database - * - * @param int $id Id of object to load - * @param bool $loadChild used to load children from database - * @return int >0 if OK, <0 if KO, 0 if not found - */ - public function fetch($id, $loadChild = true) - { - $res = $this->fetchCommon($id); - if ($res > 0) { - if ($loadChild) { - $this->fetchChild(); - } - } - - return $res; - } - - - /** - * Function to instantiate a new child - * - * @param string $tabName Table name of child - * @param int $id If id is given, we try to return his key if exist or load if we try_to_load - * @param string $key Attribute name of the object id - * @param bool $try_to_load Force the fetch if an id is given - * @return int - */ - public function addChild($tabName, $id = 0, $key = 'id', $try_to_load = false) - { - if (!empty($id)) { - foreach ($this->{$tabName} as $k => &$object) { - if ($object->{$key} === $id) { - return $k; - } - } - } - - $k = count($this->{$tabName}); - - $className = ucfirst($tabName); - $this->{$tabName}[$k] = new $className($this->db); - if ($id > 0 && $key === 'id' && $try_to_load) { - $this->{$tabName}[$k]->fetch($id); - } - - return $k; - } - - - /** - * Function to set a child as to delete - * - * @param string $tabName Table name of child - * @param int $id Id of child to set as to delete - * @param string $key Attribute name of the object id - * @return bool - */ - public function removeChild($tabName, $id, $key = 'id') - { - foreach ($this->{$tabName} as &$object) { - if ($object->{$key} == $id) { - $object->to_delete = true; - return true; - } - } - return false; - } - - - /** - * Function to fetch children objects - * - * @return void - */ - public function fetchChild() - { - if ($this->withChild && !empty($this->childtables) && !empty($this->fk_element)) { - foreach ($this->childtables as &$childTable) { - $className = ucfirst($childTable); - - $this->{$className} = array(); - - $sql = "SELECT rowid FROM ".$this->db->prefix().$childTable." WHERE ".$this->fk_element." = ".((int) $this->id); - $res = $this->db->query($sql); - - if ($res) { - while ($obj = $this->db->fetch_object($res)) { - $o = new $className($this->db); - $o->fetch($obj->rowid); - - $this->{$className}[] = $o; - } - } else { - $this->errors[] = $this->db->lasterror(); - } - } - } - } - - /** - * Function to update children data - * - * @param User $user user object - * @return void - */ - public function saveChild(User &$user) - { - if ($this->withChild && !empty($this->childtables) && !empty($this->fk_element)) { - foreach ($this->childtables as &$childTable) { - $className = ucfirst($childTable); - if (!empty($this->{$className})) { - foreach ($this->{$className} as $i => &$object) { - $object->{$this->fk_element} = $this->id; - - $object->update($user); - if ($this->unsetChildDeleted && isset($object->to_delete) && $object->to_delete == true) { - unset($this->{$className}[$i]); - } - } - } - } - } - } - - - /** - * Function to update object or create or delete if needed - * - * @param User $user User object - * @return int < 0 if KO, > 0 if OK - */ - public function update(User &$user) - { - if (empty($this->id)) { - return $this->create($user); // To test, with that, no need to test on high level object, the core decide it, update just needed - } elseif (isset($this->to_delete) && $this->to_delete == true) { - return $this->delete($user); - } - - $error = 0; - $this->db->begin(); - - $res = $this->updateCommon($user); - if ($res) { - $result = $this->call_trigger(strtoupper($this->element).'_MODIFY', $user); - if ($result < 0) { - $error++; - } else { - $this->saveChild($user); - } - } else { - $error++; - $this->error = $this->db->lasterror(); - $this->errors[] = $this->error; - } - - if (empty($error)) { - $this->db->commit(); - return $this->id; - } else { - $this->db->rollback(); - return -1; - } - } - - /** - * Function to create object in database - * - * @param User $user User object - * @return int < 0 if KO, > 0 if OK - */ - public function create(User $user) - { - if ($this->id > 0) { - return $this->update($user); - } - - $error = 0; - $this->db->begin(); - - $res = $this->createCommon($user); - if ($res) { - $this->id = $this->db->last_insert_id($this->table_element); - - $result = $this->call_trigger(strtoupper($this->element).'_CREATE', $user); - if ($result < 0) { - $error++; - } else { - $this->saveChild($user); - } - } else { - $error++; - $this->error = $this->db->lasterror(); - $this->errors[] = $this->error; - } - - if (empty($error)) { - $this->db->commit(); - return $this->id; - } else { - $this->db->rollback(); - return -1; - } - } - - /** - * Function to delete object in database - * - * @param User $user user object - * @return int < 0 if KO, > 0 if OK - */ - public function delete(User &$user) - { - if ($this->id <= 0) { - return 0; - } - - $error = 0; - $this->db->begin(); - - $result = $this->call_trigger(strtoupper($this->element).'_DELETE', $user); - if ($result < 0) { - $error++; - } - - if (!$error) { - $this->deleteCommon($user); - if ($this->withChild && !empty($this->childtables)) { - foreach ($this->childtables as &$childTable) { - $className = ucfirst($childTable); - if (!empty($this->{$className})) { - foreach ($this->{$className} as &$object) { - $object->delete($user); - } - } - } - } - } - - if (empty($error)) { - $this->db->commit(); - return 1; - } else { - $this->error = $this->db->lasterror(); - $this->errors[] = $this->error; - $this->db->rollback(); - return -1; - } - } - - - /** - * Function to get a formatted date - * - * @param string $field Attribute to return - * @param string $format Output date format - * @return string - */ - public function getDate($field, $format = '') - { - if (empty($this->{$field})) { - return ''; - } else { - return dol_print_date($this->{$field}, $format); - } - } - - /** - * Function to set date in field - * - * @param string $field field to set - * @param string $date formatted date to convert - * @return mixed - */ - public function setDate($field, $date) - { - if (empty($date)) { - $this->{$field} = 0; - } else { - require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; - $this->{$field} = dol_stringtotime($date); - } - - return $this->{$field}; - } - - - /** - * Function to update current object - * - * @param array $Tab Array of values - * @return int - */ - public function setValues(&$Tab) - { - foreach ($Tab as $key => $value) { - if ($this->checkFieldType($key, 'date')) { - $this->setDate($key, $value); - } elseif ($this->checkFieldType($key, 'float')) { - $this->{$key} = (double) price2num($value); - } elseif ($this->checkFieldType($key, 'int')) { - $this->{$key} = (int) price2num($value); - } else { - $this->{$key} = dol_string_nohtmltag($value); - } - } - - return 1; - } -} diff --git a/htdocs/core/customreports.php b/htdocs/core/customreports.php index ace78c5199a..476b1d5a4da 100644 --- a/htdocs/core/customreports.php +++ b/htdocs/core/customreports.php @@ -465,7 +465,7 @@ print '
'; $count = 0; print '
'; print '
'; -print $formother->selectGroupByField($object, $search_groupby, $arrayofgroupby, 'minwidth200 maxwidth250', $langs->trans("GroupBy")); // Fill the array $arrayofgroupby with possible fields +print $formother->selectGroupByField($object, $search_groupby, $arrayofgroupby, 'minwidth250 maxwidth300', $langs->trans("GroupBy")); // Fill the array $arrayofgroupby with possible fields print '
'; diff --git a/htdocs/core/db/sqlite3.class.php b/htdocs/core/db/sqlite3.class.php index 10f9c021c0d..7aabf0eace7 100644 --- a/htdocs/core/db/sqlite3.class.php +++ b/htdocs/core/db/sqlite3.class.php @@ -1026,7 +1026,7 @@ class DoliDBSqlite3 extends DoliDB * * @param string $table Name of table * @param string $field Optionnel : Name of field if we want description of field - * @return SQLite3Result Resource + * @return bool|SQLite3Result Resource */ public function DDLDescTable($table, $field = "") { diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index efc061b9e67..cc2d3f57052 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -120,7 +120,7 @@ class pdf_espadon extends ModelePdfExpedition * * @param DoliDB $db Database handler */ - public function __construct($db = 0) + public function __construct($db) { global $conf, $langs, $mysoc; diff --git a/htdocs/expensereport/class/expensereport_ik.class.php b/htdocs/expensereport/class/expensereport_ik.class.php index 53cf3695b12..49ac0af9857 100644 --- a/htdocs/expensereport/class/expensereport_ik.class.php +++ b/htdocs/expensereport/class/expensereport_ik.class.php @@ -22,12 +22,12 @@ * \brief File of class to manage expense ik */ -require_once DOL_DOCUMENT_ROOT.'/core/class/coreobject.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; /** * Class to manage inventories */ -class ExpenseReportIk extends CoreObject +class ExpenseReportIk extends CommonObject { /** * @var string ID to identify managed object @@ -68,6 +68,7 @@ class ExpenseReportIk extends CoreObject */ public $ikoffset; + /** * Attribute object linked with database * @var array @@ -80,17 +81,75 @@ class ExpenseReportIk extends CoreObject ,'ikoffset'=>array('type'=>'double') ); + /** * Constructor * * @param DoliDB $db Database handler */ - public function __construct(DoliDB &$db) + public function __construct(DoliDB $db) { - parent::__construct($db); - parent::init(); + $this->db = $db; + } - $this->errors = array(); + + /** + * Create object into database + * + * @param User $user User that creates + * @param bool $notrigger false=launch triggers after, true=disable triggers + * @return int <0 if KO, Id of created object if OK + */ + public function create(User $user, $notrigger = false) + { + $resultcreate = $this->createCommon($user, $notrigger); + + //$resultvalidate = $this->validate($user, $notrigger); + + return $resultcreate; + } + + + /** + * Load object in memory from the database + * + * @param int $id Id object + * @param string $ref Ref + * @return int <0 if KO, 0 if not found, >0 if OK + */ + public function fetch($id, $ref = null) + { + $result = $this->fetchCommon($id, $ref); + if ($result > 0 && !empty($this->table_element_line)) { + $this->fetchLines(); + } + return $result; + } + + + /** + * Update object into database + * + * @param User $user User that modifies + * @param bool $notrigger false=launch triggers after, true=disable triggers + * @return int <0 if KO, >0 if OK + */ + public function update(User $user, $notrigger = false) + { + return $this->updateCommon($user, $notrigger); + } + + /** + * Delete object in database + * + * @param User $user User that deletes + * @param bool $notrigger false=launch triggers after, true=disable triggers + * @return int <0 if KO, >0 if OK + */ + public function delete(User $user, $notrigger = false) + { + return $this->deleteCommon($user, $notrigger); + //return $this->deleteCommon($user, $notrigger, 1); } diff --git a/htdocs/expensereport/class/expensereport_rule.class.php b/htdocs/expensereport/class/expensereport_rule.class.php index ae89b4b0f51..02bf8b8ce5c 100644 --- a/htdocs/expensereport/class/expensereport_rule.class.php +++ b/htdocs/expensereport/class/expensereport_rule.class.php @@ -22,12 +22,12 @@ * \brief File of class to manage expense ik */ -require_once DOL_DOCUMENT_ROOT.'/core/class/coreobject.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; /** * Class to manage inventories */ -class ExpenseReportRule extends CoreObject +class ExpenseReportRule extends CommonObject { /** * @var string ID to identify managed object @@ -125,21 +125,78 @@ class ExpenseReportRule extends CoreObject ,'entity'=>array('type'=>'integer') ); + /** * Constructor * * @param DoliDB $db Database handler */ - public function __construct(DoliDB &$db) + public function __construct(DoliDB $db) { - global $conf; - - parent::__construct($db); - parent::init(); - - $this->errors = array(); + $this->db = $db; } + + /** + * Create object into database + * + * @param User $user User that creates + * @param bool $notrigger false=launch triggers after, true=disable triggers + * @return int <0 if KO, Id of created object if OK + */ + public function create(User $user, $notrigger = false) + { + $resultcreate = $this->createCommon($user, $notrigger); + + //$resultvalidate = $this->validate($user, $notrigger); + + return $resultcreate; + } + + + /** + * Load object in memory from the database + * + * @param int $id Id object + * @param string $ref Ref + * @return int <0 if KO, 0 if not found, >0 if OK + */ + public function fetch($id, $ref = null) + { + $result = $this->fetchCommon($id, $ref); + if ($result > 0 && !empty($this->table_element_line)) { + $this->fetchLines(); + } + return $result; + } + + + /** + * Update object into database + * + * @param User $user User that modifies + * @param bool $notrigger false=launch triggers after, true=disable triggers + * @return int <0 if KO, >0 if OK + */ + public function update(User $user, $notrigger = false) + { + return $this->updateCommon($user, $notrigger); + } + + /** + * Delete object in database + * + * @param User $user User that deletes + * @param bool $notrigger false=launch triggers after, true=disable triggers + * @return int <0 if KO, >0 if OK + */ + public function delete(User $user, $notrigger = false) + { + return $this->deleteCommon($user, $notrigger); + //return $this->deleteCommon($user, $notrigger, 1); + } + + /** * Return all rules or filtered by something * From 8c62363ad1b58217e298d1695f17be1ee14bf823 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 18 May 2022 11:14:20 +0200 Subject: [PATCH 021/115] fix deprecated for fk_statut --- htdocs/ticket/card.php | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 99913e6c997..586eff0bca6 100755 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -205,7 +205,7 @@ if (empty($reshook)) { $fk_user_assign = GETPOST("fk_user_assign", 'int'); if ($fk_user_assign > 0) { $object->fk_user_assign = $fk_user_assign; - $object->fk_statut = $object::STATUS_ASSIGNED; + $object->fk_status = $object::STATUS_ASSIGNED; } $object->fk_project = $projectid; @@ -285,7 +285,7 @@ if (empty($reshook)) { } } - if ($action == 'update' && $user->rights->ticket->write && $object->fk_statut < Ticket::STATUS_CLOSED) { + if ($action == 'update' && $user->rights->ticket->write && $object->fk_status < Ticket::STATUS_CLOSED) { $error = 0; $ret = $object->fetch(GETPOST('id', 'int'), GETPOST('ref', 'alpha'), GETPOST('track_id', 'alpha')); @@ -543,7 +543,7 @@ if (empty($reshook)) { if ($action == 'confirm_reopen' && $user->rights->ticket->manage && !GETPOST('cancel')) { if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) { // prevent browser refresh from reopening ticket several times - if ($object->fk_statut == Ticket::STATUS_CLOSED || $object->fk_statut == Ticket::STATUS_CANCELED) { + if ($object->fk_status == Ticket::STATUS_CLOSED || $object->fk_status == Ticket::STATUS_CANCELED) { $res = $object->setStatut(Ticket::STATUS_ASSIGNED); if ($res) { // Log action in ticket logs table @@ -602,7 +602,7 @@ if (empty($reshook)) { // Reopen ticket if ($object->fetch(GETPOST('id', 'int'), GETPOST('track_id', 'alpha')) >= 0) { $new_status = GETPOST('new_status', 'int'); - $old_status = $object->fk_statut; + $old_status = $object->fk_status; $res = $object->setStatut($new_status); if ($res) { // Log action in ticket logs table @@ -721,7 +721,7 @@ if ($action == 'create' || $action == 'presend') { $formticket->withcancel = 1; $formticket->showForm(1, 'create', 0); - /*} elseif ($action == 'edit' && $user->rights->ticket->write && $object->fk_statut < Ticket::STATUS_CLOSED) { + /*} elseif ($action == 'edit' && $user->rights->ticket->write && $object->fk_status < Ticket::STATUS_CLOSED) { $formticket = new FormTicket($db); $head = ticket_prepare_head($object); @@ -934,7 +934,7 @@ if ($action == 'create' || $action == 'presend') { // Thirdparty if (!empty($conf->societe->enabled)) { $morehtmlref .= '
'.$langs->trans('ThirdParty').' '; - if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) { + if ($action != 'editcustomer' && $object->fk_status < 8 && !$user->socid && $user->rights->ticket->write) { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('Edit'), 0).' : '; } if ($action == 'editcustomer') { @@ -1034,7 +1034,7 @@ if ($action == 'create' || $action == 'presend') { print ''; print '
'; print $langs->trans("AssignedTo"); - if ($object->fk_statut < $object::STATUS_CLOSED && GETPOST('set', 'alpha') != "assign_ticket" && $user->rights->ticket->manage) { + if ($object->fk_status < $object::STATUS_CLOSED && GETPOST('set', 'alpha') != "assign_ticket" && $user->rights->ticket->manage) { print ''.img_edit($langs->trans('Modify'), '').''; } print '
'; @@ -1045,7 +1045,7 @@ if ($action == 'create' || $action == 'presend') { } // Show user list to assignate one if status is "read" - if (GETPOST('set', 'alpha') == "assign_ticket" && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) { + if (GETPOST('set', 'alpha') == "assign_ticket" && $object->fk_status < 8 && !$user->socid && $user->rights->ticket->write) { print '
'; print ''; print ''; @@ -1062,7 +1062,7 @@ if ($action == 'create' || $action == 'presend') { print ''; - if ($action != 'progression' && $object->fk_statut < $object::STATUS_CLOSED && !$user->socid) { + if ($action != 'progression' && $object->fk_status < $object::STATUS_CLOSED && !$user->socid) { print ''; } print '
'; print $langs->trans('Progression').''; print ''.img_edit($langs->trans('Modify')).'
'; @@ -1185,7 +1185,7 @@ if ($action == 'create' || $action == 'presend') { print ''; } else { // Button to edit Properties - if ($object->fk_statut < $object::STATUS_NEED_MORE_INFO && $user->rights->ticket->write) { + if ($object->fk_status < $object::STATUS_NEED_MORE_INFO && $user->rights->ticket->write) { print ' '.img_edit($langs->trans('Modify')).''; } } @@ -1244,7 +1244,7 @@ if ($action == 'create' || $action == 'presend') { // Display navbar with links to change ticket status print ''; - if (!$user->socid && $user->rights->ticket->write && $object->fk_statut < $object::STATUS_CLOSED && GETPOST('set') !== 'properties') { + if (!$user->socid && $user->rights->ticket->write && $object->fk_status < $object::STATUS_CLOSED && GETPOST('set') !== 'properties') { $actionobject->viewStatusActions($object); } @@ -1379,7 +1379,7 @@ if ($action == 'create' || $action == 'presend') { if (empty($reshook)) { // Show link to add a message (if read and not closed) - if ($object->fk_statut < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage") { + if ($object->fk_status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage") { print dolGetButtonAction('', $langs->trans('TicketAddMessage'), 'default', $_SERVER["PHP_SELF"].'?action=presend_addmessage&mode=init&token='.newToken().'&track_id='.$object->track_id, ''); } @@ -1388,28 +1388,28 @@ if ($action == 'create' || $action == 'presend') { if (!$object->fk_soc && $user->rights->ficheinter->creer) { print dolGetButtonAction($langs->trans('UnableToCreateInterIfNoSocid'), $langs->trans('TicketAddIntervention'), 'default', $_SERVER['PHP_SELF']. '#', '', false); } - if ($object->fk_soc > 0 && $object->fk_statut < Ticket::STATUS_CLOSED && $user->rights->ficheinter->creer) { + if ($object->fk_soc > 0 && $object->fk_status < Ticket::STATUS_CLOSED && $user->rights->ficheinter->creer) { print dolGetButtonAction('', $langs->trans('TicketAddIntervention'), 'default', DOL_URL_ROOT.'/fichinter/card.php?action=create&token='.newToken().'&socid='. $object->fk_soc.'&origin=ticket_ticket&originid='. $object->id, ''); } /* This is useless. We can already modify each field individually - if ($user->rights->ticket->write && $object->fk_statut < Ticket::STATUS_CLOSED) { + if ($user->rights->ticket->write && $object->fk_status < Ticket::STATUS_CLOSED) { print ''; } */ // Close ticket if statut is read - if ($object->fk_statut > 0 && $object->fk_statut < Ticket::STATUS_CLOSED && $user->rights->ticket->write) { + if ($object->fk_status > 0 && $object->fk_status < Ticket::STATUS_CLOSED && $user->rights->ticket->write) { print dolGetButtonAction('', $langs->trans('CloseTicket'), 'default', $_SERVER["PHP_SELF"].'?action=close&token='.newToken().'&track_id='.$object->track_id, ''); } // Abadon ticket if statut is read - if ($object->fk_statut > 0 && $object->fk_statut < Ticket::STATUS_CLOSED && $user->rights->ticket->write) { + if ($object->fk_status > 0 && $object->fk_status < Ticket::STATUS_CLOSED && $user->rights->ticket->write) { print dolGetButtonAction('', $langs->trans('AbandonTicket'), 'default', $_SERVER["PHP_SELF"].'?action=abandon&token='.newToken().'&track_id='.$object->track_id, ''); } // Re-open ticket - if (!$user->socid && ($object->fk_statut == Ticket::STATUS_CLOSED || $object->fk_statut == Ticket::STATUS_CANCELED) && !$user->socid) { + if (!$user->socid && ($object->fk_status == Ticket::STATUS_CLOSED || $object->fk_status == Ticket::STATUS_CANCELED) && !$user->socid) { print dolGetButtonAction('', $langs->trans('ReOpen'), 'default', $_SERVER["PHP_SELF"].'?action=reopen&token='.newToken().'&track_id='.$object->track_id, ''); } @@ -1513,12 +1513,12 @@ if ($action == 'create' || $action == 'presend') { $morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-list-alt imgforviewmode', $messagingUrl, '', 1); // Show link to add a message (if read and not closed) - $btnstatus = $object->fk_statut < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage" && $action != "add_message"; + $btnstatus = $object->fk_status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage" && $action != "add_message"; $url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init'; $morehtmlright .= dolGetButtonTitle($langs->trans('TicketAddMessage'), '', 'fa fa-comment-dots', $url, 'add-new-ticket-title-button', $btnstatus); // Show link to add event (if read and not closed) - $btnstatus = $object->fk_statut < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage" && $action != "add_message"; ; + $btnstatus = $object->fk_status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage" && $action != "add_message"; ; $url = dol_buildpath('/comm/action/card.php', 1).'?action=create&datep='.date('YmdHi').'&origin=ticket&originid='.$object->id.'&projectid='.$object->fk_project.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id); $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', $url, 'add-new-ticket-even-button', $btnstatus); From 177e8c17fb8c7905c36504199207dec206328601 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 May 2022 11:23:21 +0200 Subject: [PATCH 022/115] Fix scrutinizer --- htdocs/comm/action/class/actioncomm.class.php | 2 +- htdocs/comm/action/index.php | 2 +- htdocs/core/class/commonobject.class.php | 2 +- htdocs/core/class/html.form.class.php | 2 +- htdocs/core/class/utils.class.php | 2 +- htdocs/core/modules/expedition/doc/pdf_espadon.modules.php | 2 +- htdocs/core/modules/expedition/doc/pdf_merou.modules.php | 2 +- htdocs/core/modules/expedition/doc/pdf_rouget.modules.php | 2 +- htdocs/core/modules/reception/doc/pdf_squille.modules.php | 2 +- htdocs/expedition/class/expedition.class.php | 2 +- htdocs/fourn/class/fournisseur.facture-rec.class.php | 7 +++++++ htdocs/install/fileconf.php | 6 +++--- htdocs/product/card.php | 2 +- htdocs/societe/class/societe.class.php | 7 ++++--- 14 files changed, 25 insertions(+), 17 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index f22cea8d04e..aeb20e6c7b4 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1621,7 +1621,7 @@ class ActionComm extends CommonObject $label = $langs->trans("ShowAction"); $linkclose .= ' alt="'.dol_escape_htmltag($tooltip, 1).'"'; } - $linkclose .= ' title="'.dol_escape_htmltag($tooltip, 1, 0, 0, '', 1).'"'; + $linkclose .= ' title="'.dol_escape_htmltag($tooltip, 1, 0, '', 1).'"'; $linkclose .= ' class="'.$classname.' classfortooltip"'; /* $hookmanager->initHooks(array('actiondao')); diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 920fe69025d..f5bbeb6467d 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -110,7 +110,7 @@ $week = GETPOST("week", "int") ?GETPOST("week", "int") : date("W"); $day = GETPOST("day", "int") ?GETPOST("day", "int") : date("d"); $pid = GETPOST("search_projectid", "int", 3) ? GETPOST("search_projectid", "int", 3) : GETPOST("projectid", "int", 3); $status = GETPOSTISSET("search_status") ? GETPOST("search_status", 'aZ09') : GETPOST("status", 'aZ09'); // status may be 0, 50, 100, 'todo' -$type = GETPOSTISSET("search_type", 'aZ09') ? GETPOST("search_type", 'aZ09') : GETPOST("type", 'aZ09'); +$type = GETPOSTISSET("search_type") ? GETPOST("search_type", 'aZ09') : GETPOST("type", 'aZ09'); $maxprint = GETPOSTISSET("maxprint") ? GETPOST("maxprint", 'int') : $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW; $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 6466754f241..b4bac9b1d73 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -201,7 +201,7 @@ abstract class CommonObject public $user; /** - * @var string The type of originating object ('commande', 'facture', ...) + * @var string The type of originating object ('commande', 'facture', ...). Note: on some object this field is called $origin_type * @see fetch_origin() */ public $origin; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 81fbb83b264..c21434b49de 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -7621,7 +7621,7 @@ class Form if (!empty($objecttmp->fields)) { // For object that declare it, it is better to use declared fields (like societe, contact, ...) $tmpfieldstoshow = ''; foreach ($objecttmp->fields as $key => $val) { - if (!dol_eval($val['enabled'], 1, 1, 1, '1')) { + if (!dol_eval($val['enabled'], 1, 1, '1')) { continue; } if (!empty($val['showoncombobox'])) { diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index f3d46e09f30..8b74609bfa3 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -342,7 +342,7 @@ class Utils $handle = ''; - $lowmemorydump = GETPOSTISSET("lowmemorydump", "alpha") ? GETPOST("lowmemorydump") : getDolGlobalString('MAIN_LOW_MEMORY_DUMP'); + $lowmemorydump = GETPOSTISSET("lowmemorydump") ? GETPOST("lowmemorydump") : getDolGlobalString('MAIN_LOW_MEMORY_DUMP'); // Start call method to execute dump $fullcommandcrypted = $command." ".$paramcrypted." 2>&1"; diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index cc2d3f57052..fa47f7be159 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -120,7 +120,7 @@ class pdf_espadon extends ModelePdfExpedition * * @param DoliDB $db Database handler */ - public function __construct($db) + public function __construct(DoliDB $db) { global $conf, $langs, $mysoc; diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php index 9a905422ff1..87098733502 100644 --- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php @@ -121,7 +121,7 @@ class pdf_merou extends ModelePdfExpedition * * @param DoliDB $db Database handler */ - public function __construct($db = 0) + public function __construct(DoliDB $db) { global $conf, $langs, $mysoc; diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index 94e048382dc..64d8a2c65e6 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -121,7 +121,7 @@ class pdf_rouget extends ModelePdfExpedition * * @param DoliDB $db Database handler */ - public function __construct($db = 0) + public function __construct(DoliDB $db) { global $conf, $langs, $mysoc; diff --git a/htdocs/core/modules/reception/doc/pdf_squille.modules.php b/htdocs/core/modules/reception/doc/pdf_squille.modules.php index 9f03abef52c..1ad02edc46b 100644 --- a/htdocs/core/modules/reception/doc/pdf_squille.modules.php +++ b/htdocs/core/modules/reception/doc/pdf_squille.modules.php @@ -44,7 +44,7 @@ class pdf_squille extends ModelePdfReception * * @param DoliDB $db Database handler */ - public function __construct($db = 0) + public function __construct(DoliDB $db) { global $conf, $langs, $mysoc; diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 0dec85b2e4f..acb54dde6f3 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -752,7 +752,7 @@ class Expedition extends CommonObject //var_dump($this->lines[$i]); $mouvS = new MouvementStock($this->db); - $mouvS->origin = dol_clone($this, 1); + //$mouvS->origin = dol_clone($this, 1); $mouvS->setOrigin($this->element, $this->id); if (empty($obj->edbrowid)) { diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index ab68cd3ecc6..a43e4a3ff9b 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -127,6 +127,13 @@ class FactureFournisseurRec extends CommonInvoice public $model_pdf; + /** + * Invoice lines + * @var FactureFournisseurLigneRec[] + */ + public $lines = array(); + + /* Override fields in CommonObject public $entity; public $date_creation; diff --git a/htdocs/install/fileconf.php b/htdocs/install/fileconf.php index 16d8a919dbe..14f1ee2a1cd 100644 --- a/htdocs/install/fileconf.php +++ b/htdocs/install/fileconf.php @@ -143,7 +143,7 @@ if (!empty($force_install_message)) { @@ -178,7 +178,7 @@ if (!empty($force_install_noedit)) { $dolibarr_main_data_root = @$force_install_main_data_root; } if (empty($dolibarr_main_data_root)) { - $dolibarr_main_data_root = GETPOSTISSET('main_data_dir', 'alpha') ? GETPOST('main_data_dir') : detect_dolibarr_main_data_root($dolibarr_main_document_root); + $dolibarr_main_data_root = GETPOSTISSET('main_data_dir') ? GETPOST('main_data_dir') : detect_dolibarr_main_data_root($dolibarr_main_document_root); } ?> @@ -207,7 +207,7 @@ if (!empty($force_install_noedit)) { diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 6040e116fa5..c7d26830ebf 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1461,7 +1461,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if ($type == 1) { print ''.$langs->trans("Duration").''; print ''; - print $formproduct->selectMeasuringUnits("duration_unit", "time", (GETPOSTISSET('duration_value') ? GETPOSTISSET('duration_value', 'alpha') : 'h'), 0, 1); + print $formproduct->selectMeasuringUnits("duration_unit", "time", (GETPOSTISSET('duration_value') ? GETPOST('duration_value', 'alpha') : 'h'), 0, 1); // Mandatory period print '       '; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 30f8515e92c..686c301af79 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -504,18 +504,19 @@ class Societe extends CommonObject /** * Date of last update - * @var string + * @var integer|string */ public $date_modification; /** * User that made last update - * @var string + * @var User */ public $user_modification; /** - * @var integer|string date_creation + * Date of creation + * @var integer|string */ public $date_creation; From 48cb30bd9babad7335121207a5dceab10d85fe99 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 May 2022 11:34:54 +0200 Subject: [PATCH 023/115] Fix scrutinizer --- .../modules/expedition/doc/pdf_espadon.modules.php | 2 +- .../modules/expedition/doc/pdf_merou.modules.php | 2 +- .../core/modules/facture/doc/pdf_crabe.modules.php | 12 ++++++------ .../core/modules/propale/doc/pdf_azur.modules.php | 3 ++- .../supplier_invoice/doc/pdf_canelle.modules.php | 13 +++++++------ .../interface_50_modTicket_TicketEmail.class.php | 2 +- htdocs/install/step5.php | 2 +- 7 files changed, 19 insertions(+), 17 deletions(-) diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index fa47f7be159..a038705ea22 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -642,7 +642,7 @@ class pdf_espadon extends ModelePdfExpedition if ($this->getColumnStatus('weight')) { - $this->printStdColumnContent($pdf, $curY, 'weight', $weighttxt.(($weighttxt && $voltxt) ? '
' : '').$voltxt, array('html'=>1)); + $this->printStdColumnContent($pdf, $curY, 'weight', $weighttxt.(($weighttxt && $voltxt) ? '
' : '').$voltxt); $nexY = max($pdf->GetY(), $nexY); } diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php index 87098733502..69105dd31cc 100644 --- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php @@ -584,7 +584,7 @@ class pdf_merou extends ModelePdfExpedition $origin_id = $object->origin_id; // Add list of linked elements - $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size - 1, $hookmanager); + $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size - 1); //$this->Code39($Xoff+43, $Yoff+1, $object->commande->ref,$ext = true, $cks = false, $w = 0.4, $h = 4, $wide = true); //Definition Location of the Company block diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 8046347e881..091b78d2ed5 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -874,12 +874,12 @@ class pdf_crabe extends ModelePDFFactures /** * Show payments table * - * @param TCPDF $pdf Object PDF - * @param Facture $object Object invoice - * @param int $posy Position y in PDF - * @param Translate $outputlangs Object langs for output - * @param int $heightforfooter height for footer - * @return int <0 if KO, >0 if OK + * @param TCPDF $pdf Object PDF + * @param Facture $object Object invoice + * @param int $posy Position y in PDF + * @param Translate $outputlangs Object langs for output + * @param int $heightforfooter Height for footer + * @return int <0 if KO, >0 if OK */ protected function _tableau_versements(&$pdf, $object, $posy, $outputlangs, $heightforfooter = 0) { diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index c6bb975092d..abf2b843a39 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -1458,9 +1458,10 @@ class pdf_azur extends ModelePDFPropales * @param Propal $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output + * @param Translate $outputlangsbis Object lang for output bis * @return void */ - protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) + protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $outputlangsbis = null) { global $conf, $langs; diff --git a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php index 23a38b961ec..b026a39791c 100644 --- a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php @@ -967,13 +967,14 @@ class pdf_canelle extends ModelePDFSuppliersInvoices /** * Show payments table * - * @param TCPDF $pdf Object PDF - * @param Object $object Object to show - * @param int $posy Position y in PDF - * @param Translate $outputlangs Object langs for output - * @return int <0 if KO, >0 if OK + * @param TCPDF $pdf Object PDF + * @param Object $object Object to show + * @param int $posy Position y in PDF + * @param Translate $outputlangs Object langs for output + * @param int $heightforfooter Height for footer + * @return int <0 if KO, >0 if OK */ - protected function _tableau_versements(&$pdf, $object, $posy, $outputlangs) + protected function _tableau_versements(&$pdf, $object, $posy, $outputlangs, $heightforfooter = 0) { // phpcs:enable global $conf; diff --git a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php index e13328e0a2a..840d6d9c3ba 100644 --- a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php +++ b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php @@ -169,7 +169,7 @@ class InterfaceTicketEmail extends DolibarrTriggers } if ($sendto) { - $this->composeAndSendCustomerMessage($sendto, $subject_customer, $body_customer, $see_ticket_customer, $object, $langs, $conf); + $this->composeAndSendCustomerMessage($sendto, $subject_customer, $body_customer, $see_ticket_customer, $object, $langs); } } diff --git a/htdocs/install/step5.php b/htdocs/install/step5.php index 89681794aeb..ee592007522 100644 --- a/htdocs/install/step5.php +++ b/htdocs/install/step5.php @@ -228,7 +228,7 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i', $action)) { $success = 1; } else { dolibarr_install_syslog('step5: FailedToCreateAdminLogin '.$newuser->error, LOG_ERR); - setEventMessage($langs->trans("FailedToCreateAdminLogin").' '.$newuser->error, null, 'errors'); + setEventMessages($langs->trans("FailedToCreateAdminLogin").' '.$newuser->error, null, 'errors'); //header("Location: step4.php?error=3&selectlang=$setuplang".(isset($login) ? '&login='.$login : '')); print '
'.$langs->trans("FailedToCreateAdminLogin").': '.$newuser->error.'


'; print $langs->trans("ErrorGoBackAndCorrectParameters").'

'; From 86d34af4b0e3687b324b0e3719f26859bf9323df Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 May 2022 11:38:56 +0200 Subject: [PATCH 024/115] Fix deprecated code --- htdocs/compta/deplacement/list.php | 2 +- htdocs/compta/paiement/cheque/list.php | 2 +- htdocs/compta/paiement/rapport.php | 2 +- htdocs/contact/consumption.php | 2 +- htdocs/contrat/list.php | 2 +- htdocs/expensereport/list.php | 4 ++-- htdocs/fourn/facture/rapport.php | 2 +- htdocs/holiday/list.php | 8 ++++---- htdocs/opensurvey/results.php | 2 +- htdocs/projet/list.php | 4 ++-- htdocs/projet/tasks.php | 4 ++-- htdocs/projet/tasks/time.php | 2 +- htdocs/societe/consumption.php | 2 +- htdocs/societe/paymentmodes.php | 4 ++-- 14 files changed, 21 insertions(+), 21 deletions(-) diff --git a/htdocs/compta/deplacement/list.php b/htdocs/compta/deplacement/list.php index 9f92cecc4a7..2aa03441e9b 100644 --- a/htdocs/compta/deplacement/list.php +++ b/htdocs/compta/deplacement/list.php @@ -158,7 +158,7 @@ if ($resql) { print ''; } print ''; - $formother->select_year($year ? $year : -1, 'year', 1, 20, 5); + print $formother->selectyear($year ? $year : -1, 'year', 1, 20, 5); print ''; print ''; print ''; diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index d12caf36bbe..1c3abfe87bd 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -172,7 +172,7 @@ if ($resql) { print ''; } print ''; - $formother->select_year($year ? $year : -1, 'year', 1, 20, 5); + print $formother->selectyear($year ? $year : -1, 'year', 1, 20, 5); print ''; print ''; $form->select_comptes($search_account, 'search_account', 0, '', 1); diff --git a/htdocs/compta/paiement/rapport.php b/htdocs/compta/paiement/rapport.php index cf02c2aeb74..326be7144a8 100644 --- a/htdocs/compta/paiement/rapport.php +++ b/htdocs/compta/paiement/rapport.php @@ -102,7 +102,7 @@ $syear = GETPOST("reyear") ?GETPOST("reyear") : date("Y", time()); print $formother->select_month($cmonth, 'remonth'); -print $formother->select_year($syear, 'reyear'); +print $formother->selectyear($syear, 'reyear'); print ''; print ''; diff --git a/htdocs/contact/consumption.php b/htdocs/contact/consumption.php index 02813cee469..7f1d9bdc64b 100644 --- a/htdocs/contact/consumption.php +++ b/htdocs/contact/consumption.php @@ -410,7 +410,7 @@ if ($sql_select) { print ''; print ''; // date print $formother->select_month($month ? $month : -1, 'month', 1, 0, 'valignmiddle'); - $formother->select_year($year ? $year : -1, 'year', 1, 20, 1); + print $formother->selectyear($year ? $year : -1, 'year', 1, 20, 1); print ''; print ''; print ''; diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 57b4657eab4..e76261010da 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -693,7 +693,7 @@ if (!empty($arrayfields['lower_planned_end_date']['checked'])) { print '
'; print $formother->select_month($search_dfmonth, 'search_dfmonth', 1, 0); print ' '; - $formother->select_year($search_dfyear, 'search_dfyear', 1, 20, 5, 0, 0, ''); + print $formother->selectyear($search_dfyear, 'search_dfyear', 1, 20, 5, 0, 0, ''); print ''; } // Status diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 551957d0a69..24432cb7cf1 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -580,14 +580,14 @@ if ($resql) { if (!empty($arrayfields['d.date_valid']['checked'])) { print ''; //print ''; - //$formother->select_year($year_end,'year_end',1, $min_year, $max_year); + //print $formother->selectyear($year_end,'year_end',1, $min_year, $max_year); print ''; } // Date approve if (!empty($arrayfields['d.date_approve']['checked'])) { print ''; //print ''; - //$formother->select_year($year_end,'year_end',1, $min_year, $max_year); + //print $formother->selectyear($year_end,'year_end',1, $min_year, $max_year); print ''; } // Amount with no tax diff --git a/htdocs/fourn/facture/rapport.php b/htdocs/fourn/facture/rapport.php index 59b92f349c0..f46871b03e9 100644 --- a/htdocs/fourn/facture/rapport.php +++ b/htdocs/fourn/facture/rapport.php @@ -105,7 +105,7 @@ $syear = GETPOST("reyear") ?GETPOST("reyear") : date("Y", time()); print $formother->select_month($cmonth, 'remonth'); -print $formother->select_year($syear, 'reyear'); +print $formother->selectyear($syear, 'reyear'); print ''; print ''; diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 5dc05d1c617..ed6e421d302 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -625,7 +625,7 @@ if ($resql) { if (!empty($arrayfields['cp.date_debut']['checked'])) { print ''; print ''; - $formother->select_year($search_year_start, 'search_year_start', 1, $min_year, $max_year); + print $formother->selectyear($search_year_start, 'search_year_start', 1, $min_year, $max_year); print ''; } @@ -633,7 +633,7 @@ if ($resql) { if (!empty($arrayfields['cp.date_fin']['checked'])) { print ''; print ''; - $formother->select_year($search_year_end, 'search_year_end', 1, $min_year, $max_year); + print $formother->selectyear($search_year_end, 'search_year_end', 1, $min_year, $max_year); print ''; } @@ -654,7 +654,7 @@ if ($resql) { if (!empty($arrayfields['cp.date_create']['checked'])) { print ''; print ''; - $formother->select_year($search_year_create, 'search_year_create', 1, $min_year, 0); + print $formother->selectyear($search_year_create, 'search_year_create', 1, $min_year, 0); print ''; } @@ -662,7 +662,7 @@ if ($resql) { if (!empty($arrayfields['cp.tms']['checked'])) { print ''; print ''; - $formother->select_year($search_year_update, 'search_year_update', 1, $min_year, 0); + print $formother->selectyear($search_year_update, 'search_year_update', 1, $min_year, 0); print ''; } diff --git a/htdocs/opensurvey/results.php b/htdocs/opensurvey/results.php index bb2e3604627..eda16dec32c 100644 --- a/htdocs/opensurvey/results.php +++ b/htdocs/opensurvey/results.php @@ -609,7 +609,7 @@ if (GETPOST('ajoutsujet')) { print ' '; - print $formother->select_year('', 'nouvelleannee', 1, 0, 5, 0, 1); + print $formother->selectyear('', 'nouvelleannee', 1, 0, 5, 0, 1); print '

'.$langs->trans("AddStartHour").':

'."\n"; print ''; } print ''; - $formother->select_year($search_syear ? $search_syear : -1, 'search_syear', 1, 20, 5, 0, 0, '', 'widthauto valignmiddle');*/ + print $formother->selectyear($search_syear ? $search_syear : -1, 'search_syear', 1, 20, 5, 0, 0, '', 'widthauto valignmiddle');*/ print '
'; print $form->selectDate($search_date_start_start ? $search_date_start_start : -1, 'search_date_start_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); print '
'; @@ -914,7 +914,7 @@ if (!empty($arrayfields['p.datee']['checked'])) { print ''; } print ''; - $formother->select_year($search_eyear ? $search_eyear : -1, 'search_eyear', 1, 20, 5, 0, 0, '', 'widthauto valignmiddle');*/ + print $formother->selectyear($search_eyear ? $search_eyear : -1, 'search_eyear', 1, 20, 5, 0, 0, '', 'widthauto valignmiddle');*/ print '
'; print $form->selectDate($search_date_end_start ? $search_date_end_start : -1, 'search_date_end_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); print '
'; diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index eacd507b35c..24f3874301b 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -901,7 +901,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third print ''; /*print ''; print ''; - $formother->select_year($search_dtstartyear ? $search_dtstartyear : -1, 'search_dtstartyear', 1, 20, 5);*/ + print $formother->selectyear($search_dtstartyear ? $search_dtstartyear : -1, 'search_dtstartyear', 1, 20, 5);*/ print '
'; print $form->selectDate($search_date_start_start ? $search_date_start_start : -1, 'search_date_start_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); print '
'; @@ -915,7 +915,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third print ''; /*print ''; print ''; - $formother->select_year($search_dtendyear ? $search_dtendyear : -1, 'search_dtendyear', 1, 20, 5);*/ + print $formother->selectyear($search_dtendyear ? $search_dtendyear : -1, 'search_dtendyear', 1, 20, 5);*/ print '
'; print $form->selectDate($search_date_end_start ? $search_date_end_start : -1, 'search_date_end_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); print '
'; diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index fa987805a25..3718fe55e27 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -1562,7 +1562,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser print ''; } print ''; - $formother->select_year($search_year, 'search_year', 1, 20, 5); + print $formother->selectyear($search_year, 'search_year', 1, 20, 5); print ''; } if (!empty($allprojectforuser)) { diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index 2ab5a836c51..5f997a37e9c 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -443,7 +443,7 @@ if ($sql_select) { print ''; print ''; // date print $formother->select_month($month ? $month : -1, 'month', 1, 0, 'valignmiddle'); - $formother->select_year($year ? $year : -1, 'year', 1, 20, 1, 0, 0, '', 'valignmiddle maxwidth75imp marginleftonly'); + print $formother->selectyear($year ? $year : -1, 'year', 1, 20, 1, 0, 0, '', 'valignmiddle maxwidth75imp marginleftonly'); print ''; print ''; print ''; diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index bdbf7453c35..e2ac40f8770 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -1683,7 +1683,7 @@ if ($socid && $action == 'editcard' && $permissiontoaddupdatepaymentinformation) print ''.$langs->trans("ExpiryDate").''; print ''; print $formother->select_month($companypaymentmode->exp_date_month, 'exp_date_month', 1); - print $formother->select_year($companypaymentmode->exp_date_year, 'exp_date_year', 1, 5, 10, 0, 0, '', 'marginleftonly'); + print $formother->selectyear($companypaymentmode->exp_date_year, 'exp_date_year', 1, 5, 10, 0, 0, '', 'marginleftonly'); print ''; print ''.$langs->trans("CVN").''; @@ -1841,7 +1841,7 @@ if ($socid && $action == 'createcard' && $permissiontoaddupdatepaymentinformatio print ''.$langs->trans("ExpiryDate").''; print ''; print $formother->select_month(GETPOST('exp_date_month', 'int'), 'exp_date_month', 1); - print $formother->select_year(GETPOST('exp_date_year', 'int'), 'exp_date_year', 1, 5, 10, 0, 0, '', 'marginleftonly'); + print $formother->selectyear(GETPOST('exp_date_year', 'int'), 'exp_date_year', 1, 5, 10, 0, 0, '', 'marginleftonly'); print ''; print ''.$langs->trans("CVN").''; From e0c3fa79cb0a616a6c9b894565f6583b742ea0e3 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 18 May 2022 11:39:47 +0200 Subject: [PATCH 025/115] fix : method was undefined and attached files was nok --- htdocs/core/class/html.formticket.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index a7cc3a996b4..b5b15e3634b 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -1267,7 +1267,7 @@ class FormTicket if (GETPOST('mode', 'alpha') == 'init' || (GETPOST('modelmailselected', 'alpha') && GETPOST('modelmailselected', 'alpha') != '-1')) { if (!empty($arraydefaultmessage->joinfiles) && is_array($this->param['fileinit'])) { foreach ($this->param['fileinit'] as $file) { - $this->add_attached_files($file, basename($file), dol_mimetype($file)); + $formmail->add_attached_files($file, basename($file), dol_mimetype($file)); } } } From cf2c46b583311c67c4130158a31dab048cba6bab Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Wed, 18 May 2022 12:31:09 +0200 Subject: [PATCH 026/115] Fix : php 8.0 warnings --- htdocs/adherents/admin/member.php | 14 +++++++------- htdocs/bom/bom_agenda.php | 3 ++- htdocs/bom/bom_document.php | 1 + htdocs/bom/bom_net_needs.php | 1 + htdocs/bom/bom_note.php | 2 +- htdocs/bom/class/bom.class.php | 13 ++++++++----- htdocs/core/actions_addupdatedelete.inc.php | 4 ++-- htdocs/core/class/commonobject.class.php | 6 +++--- .../modules/holiday/mod_holiday_immaculate.php | 4 ++-- 9 files changed, 27 insertions(+), 21 deletions(-) diff --git a/htdocs/adherents/admin/member.php b/htdocs/adherents/admin/member.php index 64197636d0e..ed2453ef793 100644 --- a/htdocs/adherents/admin/member.php +++ b/htdocs/adherents/admin/member.php @@ -248,8 +248,8 @@ if (!empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty( $arraychoices['bankviainvoice'] = $langs->trans("MoreActionBankViaInvoice"); } print ''; -print $form->selectarray('ADHERENT_BANK_USE', $arraychoices, $conf->global->ADHERENT_BANK_USE, 0); -if ($conf->global->ADHERENT_BANK_USE == 'bankdirect' || $conf->global->ADHERENT_BANK_USE == 'bankviainvoice') { +print $form->selectarray('ADHERENT_BANK_USE', $arraychoices, getDolGlobalString('ADHERENT_BANK_USE'), 0); +if (getDolGlobalString('ADHERENT_BANK_USE') == 'bankdirect' || getDolGlobalString('ADHERENT_BANK_USE') == 'bankviainvoice') { print '
'.$langs->trans("ABankAccountMustBeDefinedOnPaymentModeSetup").'
'; } print ''; @@ -378,16 +378,16 @@ foreach ($dirmodels as $reldir) { print ''; } else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir) ? $module->scandir : '').'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } // Defaut print ''; - if ($conf->global->MEMBER_ADDON_PDF == $name) { + if (getDolGlobalString('MEMBER_ADDON_PDF') == $name) { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir) ? $module->scandir : '').'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; @@ -398,8 +398,8 @@ foreach ($dirmodels as $reldir) { $htmltooltip .= '
'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; } $htmltooltip .= '

'.$langs->trans("FeaturesSupported").':'; - $htmltooltip .= '
'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1); - $htmltooltip .= '
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1); + $htmltooltip .= '
'.$langs->trans("Logo").': '.yn(!empty($module->option_logo) ? $module->option_logo : 0, 1, 1); + $htmltooltip .= '
'.$langs->trans("MultiLanguage").': '.yn(!empty($module->option_multilang) ? $module->option_multilang : 0, 1, 1); print ''; diff --git a/htdocs/bom/bom_agenda.php b/htdocs/bom/bom_agenda.php index 2b9c6f57bbd..4bc9095a57e 100644 --- a/htdocs/bom/bom_agenda.php +++ b/htdocs/bom/bom_agenda.php @@ -40,6 +40,7 @@ $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); $cancel = GETPOST('cancel', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); +$socid = GETPOST('socid', 'int'); if (GETPOST('actioncode', 'array')) { $actioncode = GETPOST('actioncode', 'array', 3); @@ -79,7 +80,7 @@ $extrafields->fetch_name_optionals_label($object->table_element); // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals if ($id > 0 || !empty($ref)) { - $upload_dir = $conf->bom->multidir_output[$object->entity]."/".$object->id; + $upload_dir = (!empty($conf->bom->multidir_output[$object->entity]) ? $conf->bom->multidir_output[$object->entity] : $conf->bom->dir_output)."/".$object->id; } // Security check - Protection if external user diff --git a/htdocs/bom/bom_document.php b/htdocs/bom/bom_document.php index 64f3cdbfac1..a0390ef5105 100644 --- a/htdocs/bom/bom_document.php +++ b/htdocs/bom/bom_document.php @@ -104,6 +104,7 @@ $form = new Form($db); $title = $langs->trans("BillOfMaterials").' - '.$langs->trans("Files"); $help_url = 'EN:Module_BOM'; +$morehtmlref = ""; llxHeader('', $title, $help_url); diff --git a/htdocs/bom/bom_net_needs.php b/htdocs/bom/bom_net_needs.php index 30cd6792c55..2b0b9a9def5 100644 --- a/htdocs/bom/bom_net_needs.php +++ b/htdocs/bom/bom_net_needs.php @@ -34,6 +34,7 @@ $langs->loadLangs(array("mrp", "other", "stocks")); // Get parameters $id = GETPOST('id', 'int'); +$lineid = GETPOST('lineid', 'int'); $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); diff --git a/htdocs/bom/bom_note.php b/htdocs/bom/bom_note.php index 8ace40cc900..9984a1498b8 100644 --- a/htdocs/bom/bom_note.php +++ b/htdocs/bom/bom_note.php @@ -54,7 +54,7 @@ $extrafields->fetch_name_optionals_label($object->table_element); // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals if ($id > 0 || !empty($ref)) { - $upload_dir = $conf->bom->multidir_output[$object->entity]."/".$object->id; + $upload_dir = (!empty($conf->bom->multidir_output[$object->entity]) ? $conf->bom->multidir_output[$object->entity] : $conf->bom->dir_output)."/".$object->id; } $permissionnote = $user->rights->bom->write; // Used by the include of actions_setnotes.inc.php diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 86e07ed424d..fb7fd68e13a 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -916,27 +916,27 @@ class BOM extends CommonObject if ($this->db->num_rows($result)) { $obj = $this->db->fetch_object($result); $this->id = $obj->rowid; - if ($obj->fk_user_author) { + if (!empty($obj->fk_user_author)) { $cuser = new User($this->db); $cuser->fetch($obj->fk_user_author); $this->user_creation = $cuser; } - if ($obj->fk_user_valid) { + if (!empty($obj->fk_user_valid)) { $vuser = new User($this->db); $vuser->fetch($obj->fk_user_valid); $this->user_validation = $vuser; } - if ($obj->fk_user_cloture) { + if (!empty($obj->fk_user_cloture)) { $cluser = new User($this->db); $cluser->fetch($obj->fk_user_cloture); $this->user_cloture = $cluser; } $this->date_creation = $this->db->jdate($obj->datec); - $this->date_modification = $this->db->jdate($obj->datem); - $this->date_validation = $this->db->jdate($obj->datev); + $this->date_modification = !empty($obj->datem) ? $this->db->jdate($obj->datem) : ""; + $this->date_validation = !empty($obj->datev) ? $this->db->jdate($obj->datev) : ""; } $this->db->free($result); @@ -1134,6 +1134,9 @@ class BOM extends CommonObject if (! empty($line->childBom)) { foreach ($line->childBom as $childBom) $childBom->getNetNeeds($TNetNeeds, $line->qty*$qty); } else { + if (empty($TNetNeeds[$line->fk_product])) { + $TNetNeeds[$line->fk_product] = 0; + } $TNetNeeds[$line->fk_product] += $line->qty*$qty; } } diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index cec127eeac4..85b854f8ba7 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -101,10 +101,10 @@ if ($action == 'add' && !empty($permissiontoadd)) { //var_dump($key.' '.$value.' '.$object->fields[$key]['type']); $object->$key = $value; - if ($val['notnull'] > 0 && $object->$key == '' && !is_null($val['default']) && $val['default'] == '(PROV)') { + if (!empty($val['notnull']) && $val['notnull'] > 0 && $object->$key == '' && isset($val['default']) && $val['default'] == '(PROV)') { $object->$key = '(PROV)'; } - if ($val['notnull'] > 0 && $object->$key == '' && is_null($val['default'])) { + if (!empty($val['notnull']) && $val['notnull'] > 0 && $object->$key == '' && !isset($val['default'])) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv($val['label'])), null, 'errors'); } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 6466754f241..dc7433f64d7 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4879,7 +4879,7 @@ abstract class CommonObject $product_static->fetch($line->fk_product); $product_static->ref = $line->ref; //can change ref in hook - $product_static->label = $line->label; //can change label in hook + $product_static->label = !empty($line->label) ? $line->label : ""; //can change label in hook $text = $product_static->getNomUrl(1); @@ -4915,7 +4915,7 @@ abstract class CommonObject $description .= (!empty($conf->global->PRODUIT_DESC_IN_FORM) ? '' : dol_htmlentitiesbr($line->description)); // Description is what to show on popup. We shown nothing if already into desc. } - $line->pu_ttc = price2num($line->subprice * (1 + ($line->tva_tx / 100)), 'MU'); + $line->pu_ttc = price2num((!empty($line->subprice) ? $line->subprice : 0) * (1 + ((!empty($line->tva_tx) ? $line->tva_tx : 0) / 100)), 'MU'); // Output template part (modules that overwrite templates must declare this into descriptor) // Use global variables + $dateSelector + $seller and $buyer @@ -6837,7 +6837,7 @@ abstract class CommonObject if ((string) $key == '') { continue; } - list($val, $parent) = explode('|', $val); + if (strpos($val, "|") !== false) list($val, $parent) = explode('|', $val); $out .= ''; } else { - if ($hideunselectables && $disabled && ($selected != $obj->rowid)) { + if ($disabled && ($selected != $obj->rowid)) { $resultat = ''; } else { $resultat = '