From 192e62fa5c00e5d82d831aa377c2916e41849806 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Mon, 21 Feb 2022 15:41:41 +0100 Subject: [PATCH 001/165] 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/165] 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/165] 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/165] 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/165] 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/165] 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/165] 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/165] 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/165] 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/165] 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/165] 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/165] 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/165] 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/165] 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 2ec2dc59a40534f78448a9044ce6b9690e802c2f Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Fri, 13 May 2022 14:55:21 +0200 Subject: [PATCH 015/165] New : import fields in societe class --- .../modules/import/import_csv.modules.php | 36 +++++++++++++---- .../modules/import/import_xlsx.modules.php | 39 +++++++++++++++---- htdocs/core/modules/modSociete.class.php | 20 ++++++++++ 3 files changed, 79 insertions(+), 16 deletions(-) diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index e45630df298..62f0ca6d387 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -709,15 +709,35 @@ class ImportCsv extends ModeleImports } // Define $listfields and $listvalues to build SQL request - $listfields[] = $fieldname; - - // Note: arrayrecord (and 'type') is filled with ->import_read_record called by import.php page before calling import_insert - if (empty($newval) && $arrayrecord[($key - 1)]['type'] < 0) { - $listvalues[] = ($newval == '0' ? $newval : "null"); - } elseif (empty($newval) && $arrayrecord[($key - 1)]['type'] == 0) { - $listvalues[] = "''"; + if ($conf->socialnetworks->enabled && strpos($fieldname, "socialnetworks") !== false) { + if (!in_array("socialnetworks", $listfields)) { + $listfields[] = "socialnetworks"; + } + if (!empty($newval) && $arrayrecord[($key - 1)]['type'] > 0) { + $socialkey = array_search("socialnetworks", $listfields); + if (empty($listvalues[$socialkey]) || $listvalues[$socialkey] == "null") { + $socialnetwork = explode("_", $fieldname)[1]; + $newvalue = '\'{ "'.$socialnetwork.'" : "'.$this->db->escape($newval).'" }\''; + $listvalues[$socialkey] = $newvalue; + } else { + $socialnetwork = explode("_", $fieldname)[1]; + $jsondata = $listvalues[$socialkey]; + $jsondata = str_replace("'", "", $jsondata); + $json = json_decode($jsondata); + $json->$socialnetwork = $this->db->escape($newval); + $listvalues[$socialkey] = "'".$this->db->escape(json_encode($json))."'"; + } + } } else { - $listvalues[] = "'".$this->db->escape($newval)."'"; + $listfields[] = $fieldname; + // Note: arrayrecord (and 'type') is filled with ->import_read_record called by import.php page before calling import_insert + if (empty($newval) && $arrayrecord[($key - 1)]['type'] < 0) { + $listvalues[] = ($newval == '0' ? $newval : "null"); + } elseif (empty($newval) && $arrayrecord[($key - 1)]['type'] == 0) { + $listvalues[] = "''"; + } else { + $listvalues[] = "'".$this->db->escape($newval)."'"; + } } } $i++; diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index 9fa5cbf2c44..a64063fa9af 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -363,6 +363,8 @@ class ImportXlsx extends ModeleImports $warning = 0; $this->errors = array(); $this->warnings = array(); + $this->nbinsert = 0; + $this->nbupdate = 0; //dol_syslog("import_csv.modules maxfields=".$maxfields." importid=".$importid); @@ -750,15 +752,36 @@ class ImportXlsx extends ModeleImports } // Define $listfields and $listvalues to build SQL request - $listfields[] = $fieldname; - - // Note: arrayrecord (and 'type') is filled with ->import_read_record called by import.php page before calling import_insert - if (empty($newval) && $arrayrecord[($key)]['type'] < 0) { - $listvalues[] = ($newval == '0' ? $newval : "null"); - } elseif (empty($newval) && $arrayrecord[($key)]['type'] == 0) { - $listvalues[] = "''"; + if ($conf->socialnetworks->enabled && strpos($fieldname, "socialnetworks") !== false) { + if (!in_array("socialnetworks", $listfields)) { + $listfields[] = "socialnetworks"; + } + if (!empty($newval) && $arrayrecord[($key)]['type'] > 0) { + $socialkey = array_search("socialnetworks", $listfields); + if (empty($listvalues[$socialkey]) || $listvalues[$socialkey] == "null") { + $socialnetwork = explode("_", $fieldname)[1]; + $newvalue = '\'{ "'.$socialnetwork.'" : "'.$this->db->escape($newval).'" }\''; + $listvalues[$socialkey] = $newvalue; + } else { + $socialnetwork = explode("_", $fieldname)[1]; + $jsondata = $listvalues[$socialkey]; + $jsondata = str_replace("'", "", $jsondata); + $json = json_decode($jsondata); + $json->$socialnetwork = $this->db->escape($newval); + $listvalues[$socialkey] = "'".$this->db->escape(json_encode($json))."'"; + } + } } else { - $listvalues[] = "'" . $this->db->escape($newval) . "'"; + $listfields[] = $fieldname; + + // Note: arrayrecord (and 'type') is filled with ->import_read_record called by import.php page before calling import_insert + if (empty($newval) && $arrayrecord[($key)]['type'] < 0) { + $listvalues[] = ($newval == '0' ? $newval : "null"); + } elseif (empty($newval) && $arrayrecord[($key)]['type'] == 0) { + $listvalues[] = "''"; + } else { + $listvalues[] = "'" . $this->db->escape($newval) . "'"; + } } } $i++; diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 09089d57563..84a5e97f1bf 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -519,6 +519,16 @@ class modSociete extends DolibarrModules if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) { $this->import_fields_array[$r] += array('s.accountancy_code_sell'=>'ProductAccountancySellCode', 's.accountancy_code_buy'=>'ProductAccountancyBuyCode'); } + // Add social networks fields + if (!empty($conf->socialnetworks->enabled)) { + $sql = "SELECT code, label FROM ".MAIN_DB_PREFIX."c_socialnetworks WHERE active = 1"; + $resql = $this->db->query($sql); + while ($obj = $this->db->fetch_object($resql)) { + $fieldname = 's.socialnetworks_'.$obj->code; + $fieldlabel = ucfirst($obj->label); + $this->import_fields_array[$r][$fieldname] = $fieldlabel; + } + } // Add extra fields $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type <> 'separate' AND elementtype = 'societe' AND entity IN (0, ".$conf->entity.")"; $resql = $this->db->query($sql); @@ -695,6 +705,16 @@ class modSociete extends DolibarrModules 's.note_private' => "NotePrivate", 's.note_public' => "NotePublic" ); + // Add social networks fields + if (!empty($conf->socialnetworks->enabled)) { + $sql = "SELECT code, label FROM ".MAIN_DB_PREFIX."c_socialnetworks WHERE active = 1"; + $resql = $this->db->query($sql); + while ($obj = $this->db->fetch_object($resql)) { + $fieldname = 's.socialnetworks_'.$obj->code; + $fieldlabel = ucfirst($obj->label); + $this->import_fields_array[$r][$fieldname] = $fieldlabel; + } + } // Add extra fields $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type != 'separate' AND elementtype = 'socpeople' AND entity IN (0, ".$conf->entity.")"; $resql = $this->db->query($sql); From cfc8ce2ea86ce423540cfb5536dd9b8de709db0c Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Fri, 13 May 2022 15:02:17 +0200 Subject: [PATCH 016/165] Revert "New : import fields in societe class" This reverts commit 2ec2dc59a40534f78448a9044ce6b9690e802c2f. --- .../modules/import/import_csv.modules.php | 36 ++++------------- .../modules/import/import_xlsx.modules.php | 39 ++++--------------- htdocs/core/modules/modSociete.class.php | 20 ---------- 3 files changed, 16 insertions(+), 79 deletions(-) diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 62f0ca6d387..e45630df298 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -709,35 +709,15 @@ class ImportCsv extends ModeleImports } // Define $listfields and $listvalues to build SQL request - if ($conf->socialnetworks->enabled && strpos($fieldname, "socialnetworks") !== false) { - if (!in_array("socialnetworks", $listfields)) { - $listfields[] = "socialnetworks"; - } - if (!empty($newval) && $arrayrecord[($key - 1)]['type'] > 0) { - $socialkey = array_search("socialnetworks", $listfields); - if (empty($listvalues[$socialkey]) || $listvalues[$socialkey] == "null") { - $socialnetwork = explode("_", $fieldname)[1]; - $newvalue = '\'{ "'.$socialnetwork.'" : "'.$this->db->escape($newval).'" }\''; - $listvalues[$socialkey] = $newvalue; - } else { - $socialnetwork = explode("_", $fieldname)[1]; - $jsondata = $listvalues[$socialkey]; - $jsondata = str_replace("'", "", $jsondata); - $json = json_decode($jsondata); - $json->$socialnetwork = $this->db->escape($newval); - $listvalues[$socialkey] = "'".$this->db->escape(json_encode($json))."'"; - } - } + $listfields[] = $fieldname; + + // Note: arrayrecord (and 'type') is filled with ->import_read_record called by import.php page before calling import_insert + if (empty($newval) && $arrayrecord[($key - 1)]['type'] < 0) { + $listvalues[] = ($newval == '0' ? $newval : "null"); + } elseif (empty($newval) && $arrayrecord[($key - 1)]['type'] == 0) { + $listvalues[] = "''"; } else { - $listfields[] = $fieldname; - // Note: arrayrecord (and 'type') is filled with ->import_read_record called by import.php page before calling import_insert - if (empty($newval) && $arrayrecord[($key - 1)]['type'] < 0) { - $listvalues[] = ($newval == '0' ? $newval : "null"); - } elseif (empty($newval) && $arrayrecord[($key - 1)]['type'] == 0) { - $listvalues[] = "''"; - } else { - $listvalues[] = "'".$this->db->escape($newval)."'"; - } + $listvalues[] = "'".$this->db->escape($newval)."'"; } } $i++; diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index a64063fa9af..9fa5cbf2c44 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -363,8 +363,6 @@ class ImportXlsx extends ModeleImports $warning = 0; $this->errors = array(); $this->warnings = array(); - $this->nbinsert = 0; - $this->nbupdate = 0; //dol_syslog("import_csv.modules maxfields=".$maxfields." importid=".$importid); @@ -752,36 +750,15 @@ class ImportXlsx extends ModeleImports } // Define $listfields and $listvalues to build SQL request - if ($conf->socialnetworks->enabled && strpos($fieldname, "socialnetworks") !== false) { - if (!in_array("socialnetworks", $listfields)) { - $listfields[] = "socialnetworks"; - } - if (!empty($newval) && $arrayrecord[($key)]['type'] > 0) { - $socialkey = array_search("socialnetworks", $listfields); - if (empty($listvalues[$socialkey]) || $listvalues[$socialkey] == "null") { - $socialnetwork = explode("_", $fieldname)[1]; - $newvalue = '\'{ "'.$socialnetwork.'" : "'.$this->db->escape($newval).'" }\''; - $listvalues[$socialkey] = $newvalue; - } else { - $socialnetwork = explode("_", $fieldname)[1]; - $jsondata = $listvalues[$socialkey]; - $jsondata = str_replace("'", "", $jsondata); - $json = json_decode($jsondata); - $json->$socialnetwork = $this->db->escape($newval); - $listvalues[$socialkey] = "'".$this->db->escape(json_encode($json))."'"; - } - } - } else { - $listfields[] = $fieldname; + $listfields[] = $fieldname; - // Note: arrayrecord (and 'type') is filled with ->import_read_record called by import.php page before calling import_insert - if (empty($newval) && $arrayrecord[($key)]['type'] < 0) { - $listvalues[] = ($newval == '0' ? $newval : "null"); - } elseif (empty($newval) && $arrayrecord[($key)]['type'] == 0) { - $listvalues[] = "''"; - } else { - $listvalues[] = "'" . $this->db->escape($newval) . "'"; - } + // Note: arrayrecord (and 'type') is filled with ->import_read_record called by import.php page before calling import_insert + if (empty($newval) && $arrayrecord[($key)]['type'] < 0) { + $listvalues[] = ($newval == '0' ? $newval : "null"); + } elseif (empty($newval) && $arrayrecord[($key)]['type'] == 0) { + $listvalues[] = "''"; + } else { + $listvalues[] = "'" . $this->db->escape($newval) . "'"; } } $i++; diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 84a5e97f1bf..09089d57563 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -519,16 +519,6 @@ class modSociete extends DolibarrModules if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) { $this->import_fields_array[$r] += array('s.accountancy_code_sell'=>'ProductAccountancySellCode', 's.accountancy_code_buy'=>'ProductAccountancyBuyCode'); } - // Add social networks fields - if (!empty($conf->socialnetworks->enabled)) { - $sql = "SELECT code, label FROM ".MAIN_DB_PREFIX."c_socialnetworks WHERE active = 1"; - $resql = $this->db->query($sql); - while ($obj = $this->db->fetch_object($resql)) { - $fieldname = 's.socialnetworks_'.$obj->code; - $fieldlabel = ucfirst($obj->label); - $this->import_fields_array[$r][$fieldname] = $fieldlabel; - } - } // Add extra fields $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type <> 'separate' AND elementtype = 'societe' AND entity IN (0, ".$conf->entity.")"; $resql = $this->db->query($sql); @@ -705,16 +695,6 @@ class modSociete extends DolibarrModules 's.note_private' => "NotePrivate", 's.note_public' => "NotePublic" ); - // Add social networks fields - if (!empty($conf->socialnetworks->enabled)) { - $sql = "SELECT code, label FROM ".MAIN_DB_PREFIX."c_socialnetworks WHERE active = 1"; - $resql = $this->db->query($sql); - while ($obj = $this->db->fetch_object($resql)) { - $fieldname = 's.socialnetworks_'.$obj->code; - $fieldlabel = ucfirst($obj->label); - $this->import_fields_array[$r][$fieldname] = $fieldlabel; - } - } // Add extra fields $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type != 'separate' AND elementtype = 'socpeople' AND entity IN (0, ".$conf->entity.")"; $resql = $this->db->query($sql); From 1e406276c580939be97f4d76fc24bb9052206544 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Fri, 13 May 2022 15:04:30 +0200 Subject: [PATCH 017/165] New : import fields in societe class --- .../modules/import/import_csv.modules.php | 36 +++++++++++++---- .../modules/import/import_xlsx.modules.php | 39 +++++++++++++++---- htdocs/core/modules/modSociete.class.php | 20 ++++++++++ 3 files changed, 79 insertions(+), 16 deletions(-) diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index e45630df298..62f0ca6d387 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -709,15 +709,35 @@ class ImportCsv extends ModeleImports } // Define $listfields and $listvalues to build SQL request - $listfields[] = $fieldname; - - // Note: arrayrecord (and 'type') is filled with ->import_read_record called by import.php page before calling import_insert - if (empty($newval) && $arrayrecord[($key - 1)]['type'] < 0) { - $listvalues[] = ($newval == '0' ? $newval : "null"); - } elseif (empty($newval) && $arrayrecord[($key - 1)]['type'] == 0) { - $listvalues[] = "''"; + if ($conf->socialnetworks->enabled && strpos($fieldname, "socialnetworks") !== false) { + if (!in_array("socialnetworks", $listfields)) { + $listfields[] = "socialnetworks"; + } + if (!empty($newval) && $arrayrecord[($key - 1)]['type'] > 0) { + $socialkey = array_search("socialnetworks", $listfields); + if (empty($listvalues[$socialkey]) || $listvalues[$socialkey] == "null") { + $socialnetwork = explode("_", $fieldname)[1]; + $newvalue = '\'{ "'.$socialnetwork.'" : "'.$this->db->escape($newval).'" }\''; + $listvalues[$socialkey] = $newvalue; + } else { + $socialnetwork = explode("_", $fieldname)[1]; + $jsondata = $listvalues[$socialkey]; + $jsondata = str_replace("'", "", $jsondata); + $json = json_decode($jsondata); + $json->$socialnetwork = $this->db->escape($newval); + $listvalues[$socialkey] = "'".$this->db->escape(json_encode($json))."'"; + } + } } else { - $listvalues[] = "'".$this->db->escape($newval)."'"; + $listfields[] = $fieldname; + // Note: arrayrecord (and 'type') is filled with ->import_read_record called by import.php page before calling import_insert + if (empty($newval) && $arrayrecord[($key - 1)]['type'] < 0) { + $listvalues[] = ($newval == '0' ? $newval : "null"); + } elseif (empty($newval) && $arrayrecord[($key - 1)]['type'] == 0) { + $listvalues[] = "''"; + } else { + $listvalues[] = "'".$this->db->escape($newval)."'"; + } } } $i++; diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index 9fa5cbf2c44..a64063fa9af 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -363,6 +363,8 @@ class ImportXlsx extends ModeleImports $warning = 0; $this->errors = array(); $this->warnings = array(); + $this->nbinsert = 0; + $this->nbupdate = 0; //dol_syslog("import_csv.modules maxfields=".$maxfields." importid=".$importid); @@ -750,15 +752,36 @@ class ImportXlsx extends ModeleImports } // Define $listfields and $listvalues to build SQL request - $listfields[] = $fieldname; - - // Note: arrayrecord (and 'type') is filled with ->import_read_record called by import.php page before calling import_insert - if (empty($newval) && $arrayrecord[($key)]['type'] < 0) { - $listvalues[] = ($newval == '0' ? $newval : "null"); - } elseif (empty($newval) && $arrayrecord[($key)]['type'] == 0) { - $listvalues[] = "''"; + if ($conf->socialnetworks->enabled && strpos($fieldname, "socialnetworks") !== false) { + if (!in_array("socialnetworks", $listfields)) { + $listfields[] = "socialnetworks"; + } + if (!empty($newval) && $arrayrecord[($key)]['type'] > 0) { + $socialkey = array_search("socialnetworks", $listfields); + if (empty($listvalues[$socialkey]) || $listvalues[$socialkey] == "null") { + $socialnetwork = explode("_", $fieldname)[1]; + $newvalue = '\'{ "'.$socialnetwork.'" : "'.$this->db->escape($newval).'" }\''; + $listvalues[$socialkey] = $newvalue; + } else { + $socialnetwork = explode("_", $fieldname)[1]; + $jsondata = $listvalues[$socialkey]; + $jsondata = str_replace("'", "", $jsondata); + $json = json_decode($jsondata); + $json->$socialnetwork = $this->db->escape($newval); + $listvalues[$socialkey] = "'".$this->db->escape(json_encode($json))."'"; + } + } } else { - $listvalues[] = "'" . $this->db->escape($newval) . "'"; + $listfields[] = $fieldname; + + // Note: arrayrecord (and 'type') is filled with ->import_read_record called by import.php page before calling import_insert + if (empty($newval) && $arrayrecord[($key)]['type'] < 0) { + $listvalues[] = ($newval == '0' ? $newval : "null"); + } elseif (empty($newval) && $arrayrecord[($key)]['type'] == 0) { + $listvalues[] = "''"; + } else { + $listvalues[] = "'" . $this->db->escape($newval) . "'"; + } } } $i++; diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index e4cf484df58..3b0a297ae0c 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -519,6 +519,16 @@ class modSociete extends DolibarrModules if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) { $this->import_fields_array[$r] += array('s.accountancy_code_sell'=>'ProductAccountancySellCode', 's.accountancy_code_buy'=>'ProductAccountancyBuyCode'); } + // Add social networks fields + if (!empty($conf->socialnetworks->enabled)) { + $sql = "SELECT code, label FROM ".MAIN_DB_PREFIX."c_socialnetworks WHERE active = 1"; + $resql = $this->db->query($sql); + while ($obj = $this->db->fetch_object($resql)) { + $fieldname = 's.socialnetworks_'.$obj->code; + $fieldlabel = ucfirst($obj->label); + $this->import_fields_array[$r][$fieldname] = $fieldlabel; + } + } // Add extra fields $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type <> 'separate' AND elementtype = 'societe' AND entity IN (0, ".$conf->entity.")"; $resql = $this->db->query($sql); @@ -718,6 +728,16 @@ class modSociete extends DolibarrModules 's.note_private' => "NotePrivate", 's.note_public' => "NotePublic" ); + // Add social networks fields + if (!empty($conf->socialnetworks->enabled)) { + $sql = "SELECT code, label FROM ".MAIN_DB_PREFIX."c_socialnetworks WHERE active = 1"; + $resql = $this->db->query($sql); + while ($obj = $this->db->fetch_object($resql)) { + $fieldname = 's.socialnetworks_'.$obj->code; + $fieldlabel = ucfirst($obj->label); + $this->import_fields_array[$r][$fieldname] = $fieldlabel; + } + } // Add extra fields $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type != 'separate' AND elementtype = 'socpeople' AND entity IN (0, ".$conf->entity.")"; $resql = $this->db->query($sql); From 179716ac004ed0840d29f8b6d13c89b7906da8b6 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Tue, 17 May 2022 09:17:36 +0200 Subject: [PATCH 018/165] 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 019/165] 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 ada81750c10ded375b2697a001043be6207da5d4 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 17 May 2022 12:53:50 +0200 Subject: [PATCH 020/165] NEW: Add Customer Ref on Intervention --- htdocs/fichinter/card.php | 20 ++++- htdocs/fichinter/class/fichinter.class.php | 76 ++++++++++++++++++- htdocs/fichinter/list.php | 29 ++++++- .../install/mysql/migration/15.0.0-16.0.0.sql | 2 + htdocs/install/mysql/tables/llx_fichinter.sql | 1 + 5 files changed, 123 insertions(+), 5 deletions(-) diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 0d7e5278a14..a2271dbb063 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -55,6 +55,7 @@ $langs->loadLangs(array('bills', 'companies', 'interventions', 'stocks')); $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); +$ref_client = GETPOST('ref_client', 'alpha'); $socid = (int) GETPOST('socid', 'int'); $contratid = (int) GETPOST('contratid', 'int'); $action = GETPOST('action', 'alpha'); @@ -222,6 +223,7 @@ if (empty($reshook)) { $object->author = $user->id; $object->description = GETPOST('description', 'restricthtml'); $object->ref = $ref; + $object->ref_client = $ref_client; $object->model_pdf = GETPOST('model', 'alpha'); $object->note_private = GETPOST('note_private', 'restricthtml'); $object->note_public = GETPOST('note_public', 'restricthtml'); @@ -432,6 +434,7 @@ if (empty($reshook)) { $object->author = $user->id; $object->description = GETPOST('description', 'restricthtml'); $object->ref = $ref; + $object->ref_client = $ref_client; $result = $object->update($user); if ($result < 0) { @@ -449,6 +452,12 @@ if (empty($reshook)) { if ($result < 0) { dol_print_error($db, $object->error); } + } elseif ($action == 'setref_client' && $user->rights->ficheinter->creer) { + // Positionne ref client + $result = $object->setRefClient($user, GETPOST('ref_client','alpha')); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } } elseif ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->ficheinter->supprimer) { $result = $object->delete($user); if ($result < 0) { @@ -879,6 +888,11 @@ if ($action == 'create') { // Ref print ''.$langs->trans('Ref').''.$langs->trans("Draft").''; + // Ref customer + print ''.$langs->trans('RefCustomer').''; + print ''; + print ''; + // Description (must be a textarea and not html must be allowed (used in list view) print ''.$langs->trans("Description").''; print ''; @@ -1134,10 +1148,10 @@ if ($action == 'create') { $morehtmlref = '
'; // Ref customer - //$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->fichinter->creer, 'string', '', 0, 1); - //$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->fichinter->creer, 'string', '', null, null, '', 1); + $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->ficheinter->creer, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->ficheinter->creer, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= $langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'customer'); // Project if (!empty($conf->projet->enabled)) { $langs->load("projects"); diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index b5e3a13f3c0..ec603defd62 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -44,6 +44,7 @@ class Fichinter extends CommonObject 'fk_contrat' =>array('type'=>'integer', 'label'=>'Fk contrat', 'enabled'=>1, 'visible'=>-1, 'position'=>25), 'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>30), 'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>35), + 'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>36), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>40, 'index'=>1), 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>45), 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>50), @@ -146,6 +147,12 @@ class Fichinter extends CommonObject */ public $fk_project = 0; + /** + * Customer Ref + * @var string + */ + public $ref_client; + /** * @var array extraparams */ @@ -253,6 +260,9 @@ class Fichinter extends CommonObject if (!is_numeric($this->duration)) { $this->duration = 0; } + if (isset($this->ref_client)) { + $this->ref_client = trim($this->ref_client); + } if ($this->socid <= 0) { $this->error = 'ErrorFicheinterCompanyDoesNotExist'; @@ -271,6 +281,7 @@ class Fichinter extends CommonObject $sql .= "fk_soc"; $sql .= ", datec"; $sql .= ", ref"; + $sql .= ", ref_client"; $sql .= ", entity"; $sql .= ", fk_user_author"; $sql .= ", fk_user_modif"; @@ -286,6 +297,7 @@ class Fichinter extends CommonObject $sql .= $this->socid; $sql .= ", '".$this->db->idate($now)."'"; $sql .= ", '".$this->db->escape($this->ref)."'"; + $sql .= ", '".($this->ref_client ? "'".$this->db->escape($this->ref_client)."'" : "null")."'"; $sql .= ", ".((int) $conf->entity); $sql .= ", ".((int) $user->id); $sql .= ", ".((int) $user->id); @@ -372,6 +384,9 @@ class Fichinter extends CommonObject if (!dol_strlen($this->fk_project)) { $this->fk_project = 0; } + if (isset($this->ref_client)) { + $this->ref_client = trim($this->ref_client); + } $error = 0; @@ -380,6 +395,7 @@ class Fichinter extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."fichinter SET "; $sql .= "description = '".$this->db->escape($this->description)."'"; $sql .= ", duree = ".((int) $this->duration); + $sql .= ", ref_client = ".($this->ref_client ? "'".$this->db->escape($this->ref_client)."'" : "null"); $sql .= ", fk_projet = ".((int) $this->fk_project); $sql .= ", note_private = ".($this->note_private ? "'".$this->db->escape($this->note_private)."'" : "null"); $sql .= ", note_public = ".($this->note_public ? "'".$this->db->escape($this->note_public)."'" : "null"); @@ -422,7 +438,7 @@ class Fichinter extends CommonObject */ public function fetch($rowid, $ref = '') { - $sql = "SELECT f.rowid, f.ref, f.description, f.fk_soc, f.fk_statut,"; + $sql = "SELECT f.rowid, f.ref, f.ref_client, f.description, f.fk_soc, f.fk_statut,"; $sql .= " f.datec, f.dateo, f.datee, f.datet, f.fk_user_author,"; $sql .= " f.date_valid as datev,"; $sql .= " f.tms as datem,"; @@ -443,6 +459,7 @@ class Fichinter extends CommonObject $this->id = $obj->rowid; $this->ref = $obj->ref; + $this->ref_client = $obj->ref_client; $this->description = $obj->description; $this->socid = $obj->fk_soc; $this->statut = $obj->fk_statut; @@ -1289,6 +1306,7 @@ class Fichinter extends CommonObject // Initialise parametres $this->id = 0; $this->ref = 'SPECIMEN'; + $this->ref_client = 'SPECIMEN CLIENT'; $this->specimen = 1; $this->socid = 1; $this->datec = $now; @@ -1377,6 +1395,62 @@ class Fichinter extends CommonObject return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); } + + /** + * Set customer reference number + * + * @param User $user Object user that modify + * @param string $ref_client Customer reference + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers + * @return int <0 if ko, >0 if ok + */ + public function setRefClient($user, $ref_client, $notrigger = 0) + { + // phpcs:enable + if (!empty($user->rights->ficheinter->creer)) { + $error = 0; + + $this->db->begin(); + + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET ref_client = ".(empty($ref_client) ? 'NULL' : "'".$this->db->escape($ref_client)."'"); + $sql .= " WHERE rowid = ".((int) $this->id); + + dol_syslog(__METHOD__.' $this->id='.$this->id.', ref_client='.$ref_client, LOG_DEBUG); + $resql = $this->db->query($sql); + if (!$resql) { + $this->errors[] = $this->db->error(); + $error++; + } + + if (!$error) { + $this->oldcopy = clone $this; + $this->ref_client = $ref_client; + } + + if (!$notrigger && empty($error)) { + // Call trigger + $result = $this->call_trigger('FICHINTER_MODIFY', $user); + if ($result < 0) { + $error++; + } + // End call triggers + } + + if (!$error) { + $this->db->commit(); + return 1; + } else { + foreach ($this->errors as $errmsg) { + dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); + $this->error .= ($this->error ? ', '.$errmsg : $errmsg); + } + $this->db->rollback(); + return -1 * $error; + } + } else { + return -1; + } + } } /** diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index f0e028ea92f..d83a1438f1a 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -58,6 +58,7 @@ $toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'interventionlist'; $search_ref = GETPOST('search_ref') ?GETPOST('search_ref', 'alpha') : GETPOST('search_inter', 'alpha'); +$search_ref_client = GETPOST('search_ref_client', 'alpha'); $search_company = GETPOST('search_company', 'alpha'); $search_desc = GETPOST('search_desc', 'alpha'); $search_projet_ref = GETPOST('search_projet_ref', 'alpha'); @@ -122,6 +123,7 @@ if (!empty($conf->global->FICHINTER_DISABLE_DETAILS)) { // Definition of fields for list $arrayfields = array( 'f.ref'=>array('label'=>'Ref', 'checked'=>1), + 'f.ref_client'=>array('label'=>'RefCustomer', 'checked'=>1), 's.nom'=>array('label'=>'ThirdParty', 'checked'=>1), 'pr.ref'=>array('label'=>'Project', 'checked'=>1, 'enabled'=>(empty($conf->projet->enabled) ? 0 : 1)), 'c.ref'=>array('label'=>'Contract', 'checked'=>1, 'enabled'=>(empty($conf->contrat->enabled) ? 0 : 1)), @@ -166,6 +168,7 @@ if (empty($reshook)) { // Purge search criteria if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers $search_ref = ""; + $search_ref_client = ""; $search_company = ""; $search_projet_ref = ""; $search_contrat_ref = ""; @@ -218,7 +221,7 @@ foreach ($arrayfields as $tmpkey => $tmpval) { } $sql = "SELECT"; -$sql .= " f.ref, f.rowid, f.fk_statut as status, f.description, f.datec as date_creation, f.tms as date_update, f.note_public, f.note_private,"; +$sql .= " f.ref, f.ref_client, f.rowid, f.fk_statut as status, f.description, f.datec as date_creation, f.tms as date_update, f.note_public, f.note_private,"; if (empty($conf->global->FICHINTER_DISABLE_DETAILS) && $atleastonefieldinlines) { $sql .= " fd.rowid as lineid, fd.description as descriptiondetail, fd.date as dp, fd.duree,"; } @@ -267,6 +270,9 @@ $sql .= " AND f.fk_soc = s.rowid"; if ($search_ref) { $sql .= natural_search('f.ref', $search_ref); } +if ($search_ref_client) { + $sql .= natural_search('f.ref_client', $search_ref_client); +} if ($search_company) { $sql .= natural_search('s.nom', $search_company); } @@ -351,6 +357,9 @@ if ($resql) { if ($search_ref) { $param .= "&search_ref=".urlencode($search_ref); } + if ($search_ref_client) { + $param .= "&search_ref_client=".urlencode($search_ref_client); + } if ($search_company) { $param .= "&search_company=".urlencode($search_company); } @@ -447,6 +456,11 @@ if ($resql) { print ''; print ''; } + if (!empty($arrayfields['f.ref_client']['checked'])) { + print ''; + print ''; + print ''; + } if (!empty($arrayfields['s.nom']['checked'])) { print ''; print ''; @@ -526,6 +540,9 @@ if ($resql) { if (!empty($arrayfields['f.ref']['checked'])) { print_liste_field_titre($arrayfields['f.ref']['label'], $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder); } + if (!empty($arrayfields['f.ref_client']['checked'])) { + print_liste_field_titre($arrayfields['f.ref_client']['label'], $_SERVER["PHP_SELF"], "f.ref_client", "", $param, '', $sortfield, $sortorder); + } if (!empty($arrayfields['s.nom']['checked'])) { print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder); } @@ -582,6 +599,7 @@ if ($resql) { $objectstatic->id = $obj->rowid; $objectstatic->ref = $obj->ref; + $objectstatic->ref_client = $obj->ref_client; $objectstatic->statut = $obj->status; $objectstatic->status = $obj->status; @@ -630,6 +648,15 @@ if ($resql) { $totalarray['nbfield']++; } } + if (!empty($arrayfields['f.ref_client']['checked'])) { + // Customer ref + print ''; + print $obj->ref_client; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } if (!empty($arrayfields['s.nom']['checked'])) { print ''; print $companystatic->getNomUrl(1, '', 44); diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index 501aa0fe751..8b00bee9b3c 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -361,4 +361,6 @@ ALTER TABLE llx_c_email_template ADD COLUMN email_to varchar(255); ALTER TABLE llx_c_email_template ADD COLUMN email_tocc varchar(255); ALTER TABLE llx_c_email_template ADD COLUMN email_tobcc varchar(255); +ALTER TABLE llx_fichinter ADD COLUMN ref_client varchar(255) after ref_ext; + diff --git a/htdocs/install/mysql/tables/llx_fichinter.sql b/htdocs/install/mysql/tables/llx_fichinter.sql index 7c1ef4cf184..999dd55b7f3 100644 --- a/htdocs/install/mysql/tables/llx_fichinter.sql +++ b/htdocs/install/mysql/tables/llx_fichinter.sql @@ -25,6 +25,7 @@ create table llx_fichinter fk_contrat integer DEFAULT 0, -- contrat auquel est rattache la fiche ref varchar(30) NOT NULL, -- number ref_ext varchar(255), + ref_client varchar(255), -- customer intervention number entity integer DEFAULT 1 NOT NULL, -- multi company id tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datec datetime, -- date de creation From 8950ae160b563529126169b317f9039db045d4ea Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 17 May 2022 11:00:13 +0000 Subject: [PATCH 021/165] Fixing style errors. --- htdocs/fichinter/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index a2271dbb063..eeb5261ef19 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -454,7 +454,7 @@ if (empty($reshook)) { } } elseif ($action == 'setref_client' && $user->rights->ficheinter->creer) { // Positionne ref client - $result = $object->setRefClient($user, GETPOST('ref_client','alpha')); + $result = $object->setRefClient($user, GETPOST('ref_client', 'alpha')); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } From 978db41f37cd61ef59b0d4a8f383b6c024d899b1 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Tue, 17 May 2022 15:50:45 +0200 Subject: [PATCH 022/165] 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 023/165] 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 024/165] 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 2f959306f78f3c3119a1c9ec9154774eb46915d6 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 17 May 2022 22:50:42 +0200 Subject: [PATCH 025/165] fix travis --- htdocs/install/mysql/migration/15.0.0-16.0.0.sql | 2 -- htdocs/install/mysql/tables/llx_fichinter.sql | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index 8b00bee9b3c..6288a6a2e3a 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -362,5 +362,3 @@ ALTER TABLE llx_c_email_template ADD COLUMN email_tocc varchar(255); ALTER TABLE llx_c_email_template ADD COLUMN email_tobcc varchar(255); ALTER TABLE llx_fichinter ADD COLUMN ref_client varchar(255) after ref_ext; - - diff --git a/htdocs/install/mysql/tables/llx_fichinter.sql b/htdocs/install/mysql/tables/llx_fichinter.sql index 999dd55b7f3..b9f9008f202 100644 --- a/htdocs/install/mysql/tables/llx_fichinter.sql +++ b/htdocs/install/mysql/tables/llx_fichinter.sql @@ -25,7 +25,7 @@ create table llx_fichinter fk_contrat integer DEFAULT 0, -- contrat auquel est rattache la fiche ref varchar(30) NOT NULL, -- number ref_ext varchar(255), - ref_client varchar(255), -- customer intervention number + ref_client varchar(255), -- customer intervention number entity integer DEFAULT 1 NOT NULL, -- multi company id tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datec datetime, -- date de creation From 8c62363ad1b58217e298d1695f17be1ee14bf823 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 18 May 2022 11:14:20 +0200 Subject: [PATCH 026/165] 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 e0c3fa79cb0a616a6c9b894565f6583b742ea0e3 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 18 May 2022 11:39:47 +0200 Subject: [PATCH 027/165] 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 028/165] 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 .= '
'; } if ($user->rights->ficheinter->supprimer) { diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 92b628b9aab..000b654bf72 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -1347,7 +1347,6 @@ class Fichinter extends CommonObject $line->fetch_optionals(); $this->lines[$i] = $line; - $i++; } $this->db->free($resql); diff --git a/htdocs/fichinter/class/fichinterrec.class.php b/htdocs/fichinter/class/fichinterrec.class.php index 4fe35c32a2c..ed43bae8377 100644 --- a/htdocs/fichinter/class/fichinterrec.class.php +++ b/htdocs/fichinter/class/fichinterrec.class.php @@ -349,7 +349,7 @@ class FichinterRec extends Fichinter { // phpcs:enable $sql = 'SELECT l.rowid, l.fk_product, l.product_type, l.label as custom_label, l.description, '; - $sql .= ' l.price, l.qty, l.tva_tx, l.remise, l.remise_percent, l.subprice, l.duree, '; + $sql .= ' l.price, l.qty, l.tva_tx, l.remise, l.remise_percent, l.subprice, l.duree, l.date, '; $sql .= ' l.total_ht, l.total_tva, l.total_ttc,'; $sql .= ' l.rang, l.special_code,'; $sql .= ' l.fk_unit, p.ref as product_ref, p.fk_product_type as fk_product_type,'; @@ -366,7 +366,6 @@ class FichinterRec extends Fichinter while ($i < $num) { $objp = $this->db->fetch_object($result); $line = new FichinterLigne($this->db); - $line->id = $objp->rowid; $line->label = $objp->custom_label; // Label line $line->desc = $objp->description; // Description line @@ -386,8 +385,6 @@ class FichinterRec extends Fichinter $line->fk_product = $objp->fk_product; $line->date_start = $objp->date_start; $line->date_end = $objp->date_end; - $line->date_start = $objp->date_start; - $line->date_end = $objp->date_end; $line->info_bits = $objp->info_bits; $line->total_ht = $objp->total_ht; $line->total_tva = $objp->total_tva; From 945144d5a3ef9cd7c0ea4a18985b5d60aef6e09a Mon Sep 17 00:00:00 2001 From: Giovanni Piemontese <22853912+ynnoig@users.noreply.github.com> Date: Fri, 20 May 2022 18:46:02 +0200 Subject: [PATCH 057/165] Fixed pagination on public ticket list page - ISSUE 19468 --- htdocs/public/ticket/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/public/ticket/list.php b/htdocs/public/ticket/list.php index c52e3e4296a..8d096e6e99e 100644 --- a/htdocs/public/ticket/list.php +++ b/htdocs/public/ticket/list.php @@ -220,7 +220,7 @@ if ($action == "view_ticketlist") { $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); $filter = array(); - $param = 'action=view_ticketlist'; + $param = '&action=view_ticketlist'; if (!empty($entity) && !empty($conf->multicompany->enabled)) { $param .= '&entity='.$entity; } @@ -398,7 +398,7 @@ if ($action == "view_ticketlist") { $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); - print_barre_liste($langs->trans('TicketList'), $page, 'public/list.php', $param, $sortfield, $sortorder, '', $num, $num_total, 'ticket'); + print_barre_liste($langs->trans('TicketList'), $page, '/public/ticket/list.php', $param, $sortfield, $sortorder, '', $num, $num_total, 'ticket'); // Search bar print ''."\n"; From 6e9c1764ad386f88ce4d57ac9935106a3fcedde7 Mon Sep 17 00:00:00 2001 From: Norbert Penel Date: Fri, 20 May 2022 19:08:26 +0200 Subject: [PATCH 058/165] propage tva rate on tva field --- htdocs/core/tpl/objectline_create.tpl.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index f009b80301e..f3a6aa1d6bf 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -948,9 +948,13 @@ if (!empty($usemargins) && $user->rights->margins->creer) { var discount = parseFloat($('option:selected', this).attr('data-discount')); if (isNaN(discount)) { discount = parseFloat(jQuery('#idprodfournprice').attr('data-discount'));} + var tva_tx = parseFloat($('option:selected', this).data('tvatx')); + console.log("We find supplier price :"+up+" qty: "+qty+" discount: "+discount+" for product "+jQuery('#idprodfournprice').val()); jQuery("#price_ht").val(up); + $('#tva_tx option').removeAttr('selected').filter('[value='+tva_tx+']').prop('selected', true); + if (jQuery("#qty").val() < qty) { jQuery("#qty").val(qty); From a3fc71981f92ff55c234652fd35333a84297576d Mon Sep 17 00:00:00 2001 From: Norbert Penel Date: Fri, 20 May 2022 19:09:46 +0200 Subject: [PATCH 059/165] send tva rate --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index bc404f98cbc..2df4f491105 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3508,7 +3508,7 @@ class Form $opt .= ' disabled'; } if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0) { - $opt .= ' data-product-id="'.$objp->rowid.'" data-price-id="'.$objp->idprodfournprice.'" data-qty="'.$objp->quantity.'" data-up="'.$objp->unitprice.'" data-discount="'.$outdiscount.'"'; + $opt .= ' data-product-id="'.$objp->rowid.'" data-price-id="'.$objp->idprodfournprice.'" data-qty="'.$objp->quantity.'" data-up="'.$objp->unitprice.'" data-discount="'.$outdiscount.'" data-tvatx="'.$objp->tva_tx.'"'; } $opt .= ' data-description="'.dol_escape_htmltag($objp->description, 0, 1).'"'; $opt .= ' data-html="'.dol_escape_htmltag($optlabel).'"'; From 18890e2cbb059913c1cfd4b978d1319b8d88e3ed Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 20 May 2022 17:11:36 +0000 Subject: [PATCH 060/165] Fixing style errors. --- htdocs/core/tpl/objectline_create.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index f3a6aa1d6bf..48abc6316f4 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -953,7 +953,7 @@ if (!empty($usemargins) && $user->rights->margins->creer) { console.log("We find supplier price :"+up+" qty: "+qty+" discount: "+discount+" for product "+jQuery('#idprodfournprice').val()); jQuery("#price_ht").val(up); - $('#tva_tx option').removeAttr('selected').filter('[value='+tva_tx+']').prop('selected', true); + $('#tva_tx option').removeAttr('selected').filter('[value='+tva_tx+']').prop('selected', true); if (jQuery("#qty").val() < qty) { From 0533fd4762771f171f778d1a73cdb5987d64e897 Mon Sep 17 00:00:00 2001 From: Norbert Penel Date: Fri, 20 May 2022 19:21:47 +0200 Subject: [PATCH 061/165] scrutinizer https://scrutinizer-ci.com/g/Dolibarr/dolibarr/issues/develop/files/htdocs/adherents/type_translation.php?orderField=path&order=asc&honorSelectedPaths=0 --- htdocs/adherents/class/adherent_type.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index cafc9338ae8..428c44e1bb9 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -122,6 +122,8 @@ class AdherentType extends CommonObject public $members = array(); public $multilangs = array(); + + public $other = array(); /** From 3780718bcfb05893d0c64da03774b85bcd65b272 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 20 May 2022 17:23:54 +0000 Subject: [PATCH 062/165] Fixing style errors. --- htdocs/adherents/class/adherent_type.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 428c44e1bb9..9911021599c 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -122,7 +122,7 @@ class AdherentType extends CommonObject public $members = array(); public $multilangs = array(); - + public $other = array(); From 877b48729865010ad9d2e841e8ff839534563810 Mon Sep 17 00:00:00 2001 From: Norbert Penel Date: Fri, 20 May 2022 19:25:46 +0200 Subject: [PATCH 063/165] Fix scrutinizer https://scrutinizer-ci.com/g/Dolibarr/dolibarr/issues/develop/files/htdocs/asset/card.php?selectedLabels%5B0%5D=9&orderField=path&order=asc&honorSelectedPaths=0 --- htdocs/asset/class/asset.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index 19c15839231..5381b718d6b 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -154,6 +154,7 @@ class Asset extends CommonObject public $import_key; public $model_pdf; public $status; + public $supplier_invoice_id; // /** // * @var string Field with ID of parent key if this object has a parent From 5c01db353ae95a47f69939018d6e65c0473ae128 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 20 May 2022 17:26:17 +0000 Subject: [PATCH 064/165] Fixing style errors. --- htdocs/asset/class/asset.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index 5381b718d6b..2180911d771 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -154,7 +154,7 @@ class Asset extends CommonObject public $import_key; public $model_pdf; public $status; - public $supplier_invoice_id; + public $supplier_invoice_id; // /** // * @var string Field with ID of parent key if this object has a parent From 2a22a530e98bcd574aa59b9da5f0a3821b7eeab3 Mon Sep 17 00:00:00 2001 From: Norbert Penel Date: Fri, 20 May 2022 19:27:15 +0200 Subject: [PATCH 065/165] FIX scrutinizer https://scrutinizer-ci.com/g/Dolibarr/dolibarr/issues/develop/files/htdocs/asset/model/depreciation_options.php?orderField=path&order=asc&honorSelectedPaths=0 --- htdocs/asset/class/assetmodel.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/asset/class/assetmodel.class.php b/htdocs/asset/class/assetmodel.class.php index eae7b5d0fde..6390ad74c18 100644 --- a/htdocs/asset/class/assetmodel.class.php +++ b/htdocs/asset/class/assetmodel.class.php @@ -129,6 +129,7 @@ class AssetModel extends CommonObject public $import_key; public $model_pdf; public $status; + public $asset_depreciation_options; // /** // * @var string Field with ID of parent key if this object has a parent From b21facc3db4d667a99dd4f16f2a22b82f3af8c30 Mon Sep 17 00:00:00 2001 From: Norbert Penel Date: Fri, 20 May 2022 19:32:27 +0200 Subject: [PATCH 066/165] FIX scrutinizer https://scrutinizer-ci.com/g/Dolibarr/dolibarr/issues/develop/files/htdocs/categories/class/api_categories.class.php?orderField=path&order=asc&honorSelectedPaths=0 --- htdocs/categories/class/categorie.class.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 434b994ccd2..c15bbf602ca 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -256,8 +256,14 @@ class Categorie extends CommonObject /** * @var array Mother of table */ - public $motherof = array(); + public $motherof = array(); + + /** + * @var array Childs + */ + public $childs = array(); + /** * Constructor * From 20b74cebc03715b0e0197baef6ea6557367887d9 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 20 May 2022 17:32:58 +0000 Subject: [PATCH 067/165] Fixing style errors. --- htdocs/categories/class/categorie.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index c15bbf602ca..c1d5d241340 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -256,14 +256,14 @@ class Categorie extends CommonObject /** * @var array Mother of table */ - public $motherof = array(); - + public $motherof = array(); + /** * @var array Childs */ public $childs = array(); - + /** * Constructor * From 4162a02cc123defca878f333ef14742bb5476752 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 20 May 2022 20:10:45 +0200 Subject: [PATCH 068/165] Fix deprecated remise must be remove from insert --- htdocs/commande/class/commande.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 5d5e5c2a7c4..4bda73d9f1c 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -4443,7 +4443,7 @@ class OrderLine extends CommonOrderLine $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'commandedet'; $sql .= ' (fk_commande, fk_parent_line, label, description, qty, ref_ext,'; $sql .= ' vat_src_code, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type,'; - $sql .= ' fk_product, product_type, remise_percent, subprice, price, remise, fk_remise_except,'; + $sql .= ' fk_product, product_type, remise_percent, subprice, price, fk_remise_except,'; $sql .= ' special_code, rang, fk_product_fournisseur_price, buy_price_ht,'; $sql .= ' info_bits, total_ht, total_tva, total_localtax1, total_localtax2, total_ttc, date_start, date_end,'; $sql .= ' fk_unit'; @@ -4466,7 +4466,6 @@ class OrderLine extends CommonOrderLine $sql .= " '".price2num($this->remise_percent)."',"; $sql .= " ".(price2num($this->subprice) !== '' ?price2num($this->subprice) : "null").","; $sql .= " ".($this->price != '' ? "'".price2num($this->price)."'" : "null").","; - $sql .= " '".price2num($this->remise)."',"; $sql .= ' '.(!empty($this->fk_remise_except) ? $this->fk_remise_except : "null").','; $sql .= ' '.((int) $this->special_code).','; $sql .= ' '.((int) $this->rang).','; From c887f48deea212852876be93b02cf801e6ea1588 Mon Sep 17 00:00:00 2001 From: Lucas Marcouiller Date: Fri, 20 May 2022 21:12:55 +0200 Subject: [PATCH 069/165] fix in social import --- htdocs/core/lib/functions.lib.php | 2 +- htdocs/core/modules/import/import_csv.modules.php | 8 +++++--- htdocs/core/modules/import/import_xlsx.modules.php | 4 +++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index e6852cdde03..bca479dd910 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2951,7 +2951,7 @@ function dol_print_socialnetworks($value, $cid, $socid, $type, $dictsocialnetwor } else { if (!empty($dictsocialnetworks[$type]['url'])) { $link = str_replace('{socialid}', $value, $dictsocialnetworks[$type]['url']); - $htmllink .= ' '.dol_escape_htmltag($value).''; + $htmllink .= ' '.dol_escape_htmltag($value).''; } else { $htmllink .= dol_escape_htmltag($value); } diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 0ca104c40c4..eef7305e1bc 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -717,14 +717,16 @@ class ImportCsv extends ModeleImports $socialkey = array_search("socialnetworks", $listfields); if (empty($listvalues[$socialkey]) || $listvalues[$socialkey] == "null") { $socialnetwork = explode("_", $fieldname)[1]; - $newvalue = '\'{ "'.$socialnetwork.'" : "'.$this->db->escape($newval).'" }\''; - $listvalues[$socialkey] = $newvalue; + $json = new stdClass(); + $json->$socialnetwork = $newval; + $newvalue = json_encode($json); + $listvalues[$socialkey] = "'".$this->db->escape($newvalue)."'"; } else { $socialnetwork = explode("_", $fieldname)[1]; $jsondata = $listvalues[$socialkey]; $jsondata = str_replace("'", "", $jsondata); $json = json_decode($jsondata); - $json->$socialnetwork = $this->db->escape($newval); + $json->$socialnetwork = $newval; $listvalues[$socialkey] = "'".$this->db->escape(json_encode($json))."'"; } } diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index f80cddf85e8..65985e6856a 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -760,7 +760,9 @@ class ImportXlsx extends ModeleImports $socialkey = array_search("socialnetworks", $listfields); if (empty($listvalues[$socialkey]) || $listvalues[$socialkey] == "null") { $socialnetwork = explode("_", $fieldname)[1]; - $newvalue = '\'{ "'.$socialnetwork.'" : "'.$this->db->escape($newval).'" }\''; + $json = new stdClass(); + $json->$socialnetwork = $newval; + $newvalue = json_encode($json); $listvalues[$socialkey] = $newvalue; } else { $socialnetwork = explode("_", $fieldname)[1]; From 9bb0f639f62bbc9a6edde859209f5063d5129ab6 Mon Sep 17 00:00:00 2001 From: Norbert Penel Date: Fri, 20 May 2022 21:31:14 +0200 Subject: [PATCH 070/165] Update files.lib.php --- htdocs/core/lib/files.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 6b0852e4784..5fc0d20777c 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -2801,7 +2801,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, if ($fuser->rights->facture->{$lire} || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } - if ($fuser->societe_id > 0) { + if ($fuser->socid > 0) { $original_file = $conf->facture->dir_output.'/payments/private/'.$fuser->id.'/'.$original_file; } else { $original_file = $conf->facture->dir_output.'/payments/'.$original_file; From 98af6f8606203dcf9d35f203e555b08005553b64 Mon Sep 17 00:00:00 2001 From: Lucas Marcouiller Date: Fri, 20 May 2022 22:01:39 +0200 Subject: [PATCH 071/165] Fix : import on societe with null status --- htdocs/core/modules/modSociete.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 997c2ac43b1..ec3f978d011 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -467,7 +467,7 @@ class modSociete extends DolibarrModules 's.nom' => "Name*", 's.name_alias' => "AliasNameShort", 's.parent' => "ParentCompany", - 's.status' => "Status", + 's.status' => "Status*", 's.code_client' => "CustomerCode", 's.code_fournisseur' => "SupplierCode", 's.code_compta' => "CustomerAccountancyCode", From b0816499078338f8c20c484f20f8395daf2528ab Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Fri, 20 May 2022 22:05:13 +0200 Subject: [PATCH 072/165] Fix fatal error and missing param --- htdocs/core/class/html.formsetup.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formsetup.class.php b/htdocs/core/class/html.formsetup.class.php index b26438fd9e9..a69135454df 100644 --- a/htdocs/core/class/html.formsetup.class.php +++ b/htdocs/core/class/html.formsetup.class.php @@ -653,7 +653,7 @@ class FormSetupItem public function saveConfValue() { if (!empty($this->saveCallBack) && is_callable($this->saveCallBack)) { - return call_user_func($this->saveCallBack); + return call_user_func($this->saveCallBack, $this); } // Modify constant only if key was posted (avoid resetting key to the null value) @@ -1013,6 +1013,7 @@ class FormSetupItem } $out.= $this->langs->trans($template->label); } elseif (preg_match('/category:/', $this->type)) { + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $c = new Categorie($this->db); $result = $c->fetch($this->fieldValue); if ($result < 0) { From 462a3b17c2bf5c3a4731cb51bdb7226895390ca4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 20 May 2022 22:24:06 +0200 Subject: [PATCH 073/165] Fix regression --- htdocs/core/tpl/objectline_create.tpl.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 48abc6316f4..a3a8e964ee1 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -948,15 +948,14 @@ if (!empty($usemargins) && $user->rights->margins->creer) { var discount = parseFloat($('option:selected', this).attr('data-discount')); if (isNaN(discount)) { discount = parseFloat(jQuery('#idprodfournprice').attr('data-discount'));} - var tva_tx = parseFloat($('option:selected', this).data('tvatx')); + /* var tva_tx = $('option:selected', this).data('tvatx'); */ - console.log("We find supplier price :"+up+" qty: "+qty+" discount: "+discount+" for product "+jQuery('#idprodfournprice').val()); + console.log("We find supplier price :"+up+" qty: "+qty+" tva_tx="+tva_tx+" discount: "+discount+" for product "+jQuery('#idprodfournprice').val()); jQuery("#price_ht").val(up); - $('#tva_tx option').removeAttr('selected').filter('[value='+tva_tx+']').prop('selected', true); - - if (jQuery("#qty").val() < qty) - { + /* $('#tva_tx option').removeAttr('selected').filter('[value='+tva_tx+']').prop('selected', true); */ + + if (jQuery("#qty").val() < qty) { jQuery("#qty").val(qty); } if (jQuery("#remise_percent").val() < discount) From c3e3eab5942799ef8ac14ec80e714e154838f9ed Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Fri, 20 May 2022 22:34:44 +0200 Subject: [PATCH 074/165] Fix missing hooks and fatal error --- htdocs/core/class/html.formsetup.class.php | 32 +++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formsetup.class.php b/htdocs/core/class/html.formsetup.class.php index a69135454df..1ee9812f4fd 100644 --- a/htdocs/core/class/html.formsetup.class.php +++ b/htdocs/core/class/html.formsetup.class.php @@ -240,10 +240,24 @@ class FormSetup * saveConfFromPost * * @param bool $noMessageInUpdate display event message on errors and success - * @return void|null + * @return int -1 if KO, 1 if OK */ public function saveConfFromPost($noMessageInUpdate = false) { + global $hookmanager; + + $parameters = array(); + $reshook = $hookmanager->executeHooks('formSetupBeforeSaveConfFromPost', $parameters, $this); // Note that $action and $object may have been modified by some hooks + if ($reshook < 0) { + $this->setErrors($hookmanager->errors); + return -1; + } + + if ($reshook > 0) { + return $reshook; + } + + if (empty($this->items)) { return null; } @@ -265,11 +279,13 @@ class FormSetup if (empty($noMessageInUpdate)) { setEventMessages($this->langs->trans("SetupSaved"), null); } + return 1; } else { $this->db->rollback(); if (empty($noMessageInUpdate)) { setEventMessages($this->langs->trans("SetupNotSaved"), null, 'errors'); } + return -1; } } @@ -652,6 +668,20 @@ class FormSetupItem */ public function saveConfValue() { + global $hookmanager; + + $parameters = array(); + $reshook = $hookmanager->executeHooks('formSetupBeforeSaveConfValue', $parameters, $this); // Note that $action and $object may have been modified by some hooks + if ($reshook < 0) { + $this->setErrors($hookmanager->errors); + return -1; + } + + if ($reshook > 0) { + return $reshook; + } + + if (!empty($this->saveCallBack) && is_callable($this->saveCallBack)) { return call_user_func($this->saveCallBack, $this); } From 5591ee7e6fd20425ccc402b1b0311ff044621998 Mon Sep 17 00:00:00 2001 From: Norbert Penel Date: Fri, 20 May 2022 22:36:48 +0200 Subject: [PATCH 075/165] Update categorie.class.php --- htdocs/categories/class/categorie.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 434b994ccd2..a1fa2d1982b 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -113,7 +113,7 @@ class Categorie extends CommonObject * * @todo Move to const array when PHP 5.6 will be our minimum target */ - protected $MAP_CAT_FK = array( + public static $MAP_CAT_FK = array( 'customer' => 'soc', 'supplier' => 'soc', 'contact' => 'socpeople', @@ -125,7 +125,7 @@ class Categorie extends CommonObject * * @note Move to const array when PHP 5.6 will be our minimum target */ - protected $MAP_CAT_TABLE = array( + public static $MAP_CAT_TABLE = array( 'customer' => 'societe', 'supplier' => 'fournisseur', 'bank_account'=> 'account', @@ -136,7 +136,7 @@ class Categorie extends CommonObject * * @note Move to const array when PHP 5.6 will be our minimum target */ - protected $MAP_OBJ_CLASS = array( + public static $MAP_OBJ_CLASS = array( 'product' => 'Product', 'customer' => 'Societe', 'supplier' => 'Fournisseur', @@ -178,7 +178,7 @@ class Categorie extends CommonObject * * @note Move to const array when PHP 5.6 will be our minimum target */ - protected $MAP_OBJ_TABLE = array( + public static $MAP_OBJ_TABLE = array( 'customer' => 'societe', 'supplier' => 'societe', 'member' => 'adherent', From 96613424226545a699c9bbf280da878623996a3a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 20 May 2022 23:00:25 +0200 Subject: [PATCH 076/165] Disabled for beta 16. Will be analyzed later. --- htdocs/societe/card.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index dd960583f8c..ca4a8a54775 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1308,8 +1308,13 @@ 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'); + /* Disabled. Must be implenteted by keeping the input text but calling ajax on a keydown of the input and output + data of duplicate into a div under the input. We need to keep the widgetForTranslation also for some countries. + */ + /* print ''; print "\n".' '; + */ print ''; if (!empty($conf->global->SOCIETE_USEPREFIX)) { // Old not used prefix field print ''.$langs->trans('Prefix').''; From bba6a917cb5469216a47be1de36bde8520b969ad Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Fri, 20 May 2022 23:21:08 +0200 Subject: [PATCH 077/165] Fix missing const in recruitment module --- htdocs/core/modules/modRecruitment.class.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/modRecruitment.class.php b/htdocs/core/modules/modRecruitment.class.php index 6da69ed888d..a1a2f7774aa 100644 --- a/htdocs/core/modules/modRecruitment.class.php +++ b/htdocs/core/modules/modRecruitment.class.php @@ -134,9 +134,20 @@ class modRecruitment extends DolibarrModules // Example: $this->const=array(1 => array('RECRUITMENT_MYNEWCONST1', 'chaine', 'myvalue', 'This is a constant to add', 1), // 2 => array('RECRUITMENT_MYNEWCONST2', 'chaine', 'myvalue', 'This is another constant to add', 0, 'current', 1) // ); - $this->const = array( - // 1 => array('RECRUITMENT_MYCONSTANT', 'chaine', 'avalue', 'This is a constant to add', 1, 'allentities', 1) - ); + $r = 0; + $this->const[$r][0] = "RECRUITMENT_RECRUITMENTJOBPOSITION_ADDON"; + $this->const[$r][1] = "chaine"; + $this->const[$r][2] = "mod_recruitmentjobposition_standard"; + $this->const[$r][3] = 'Name of manager to generate recruitment job position ref number'; + $this->const[$r][4] = 0; + $r++; + + $this->const[$r][0] = "RECRUITMENT_RECRUITMENTCANDIDATURE_ADDON"; + $this->const[$r][1] = "chaine"; + $this->const[$r][2] = "mod_recruitmentcandidature_standard"; + $this->const[$r][3] = 'Name of manager to generate recruitment candidature ref number'; + $this->const[$r][4] = 0; + $r++; // Some keys to add into the overwriting translation tables /*$this->overwrite_translation = array( From cff5ec8605866ec454f8b518e6ed50cb293ce0aa Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 21 May 2022 00:08:18 +0200 Subject: [PATCH 078/165] Fix : fields must check module enabled --- htdocs/comm/propal/class/propal.class.php | 8 ++++---- htdocs/commande/class/commande.class.php | 8 ++++---- htdocs/compta/facture/class/facture-rec.class.php | 6 +++--- htdocs/contrat/class/contrat.class.php | 4 ++-- .../class/conferenceorbooth.class.php | 4 ++-- .../class/conferenceorboothattendee.class.php | 6 +++--- htdocs/fichinter/class/fichinter.class.php | 6 +++--- htdocs/fourn/class/fournisseur.commande.class.php | 6 +++--- htdocs/fourn/class/fournisseur.facture-rec.class.php | 6 +++--- htdocs/fourn/class/fournisseur.facture.class.php | 6 +++--- htdocs/modulebuilder/template/class/myobject.class.php | 4 ++-- htdocs/mrp/class/mo.class.php | 10 +++++----- htdocs/product/stock/class/entrepot.class.php | 2 +- htdocs/product/stock/class/mouvementstock.class.php | 2 +- .../recruitment/class/recruitmentjobposition.class.php | 4 ++-- htdocs/ticket/class/ticket.class.php | 2 +- 16 files changed, 42 insertions(+), 42 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index fc1f12afa04..ab2d40a0741 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -296,8 +296,8 @@ class Propal extends CommonObject 'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>20), 'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>22), 'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'RefExt', 'enabled'=>1, 'visible'=>0, 'position'=>40), - 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'position'=>23), - 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>1, 'visible'=>-1, 'position'=>24), + 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'position'=>23), + 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>'$conf->projet->enabled', 'visible'=>-1, 'position'=>24), 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>25), 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>55), 'datep' =>array('type'=>'date', 'label'=>'Date', 'enabled'=>1, 'visible'=>-1, 'position'=>60), @@ -317,7 +317,7 @@ class Propal extends CommonObject 'localtax1' =>array('type'=>'double(24,8)', 'label'=>'LocalTax1', 'enabled'=>1, 'visible'=>-1, 'position'=>135, 'isameasure'=>1), 'localtax2' =>array('type'=>'double(24,8)', 'label'=>'LocalTax2', 'enabled'=>1, 'visible'=>-1, 'position'=>140, 'isameasure'=>1), 'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'TotalTTC', 'enabled'=>1, 'visible'=>-1, 'position'=>145, 'isameasure'=>1), - 'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>1, 'visible'=>-1, 'position'=>150), + 'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>'$conf->banque->enabled', 'visible'=>-1, 'position'=>150), 'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'Currency', 'enabled'=>1, 'visible'=>-1, 'position'=>155), 'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'position'=>160), 'deposit_percent' =>array('type'=>'varchar(63)', 'label'=>'DepositPercent', 'enabled'=>1, 'visible'=>-1, 'position'=>161), @@ -327,7 +327,7 @@ class Propal extends CommonObject 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'PDFTemplate', 'enabled'=>1, 'visible'=>0, 'position'=>180), 'date_livraison' =>array('type'=>'date', 'label'=>'DateDeliveryPlanned', 'enabled'=>1, 'visible'=>-1, 'position'=>185), 'fk_shipping_method' =>array('type'=>'integer', 'label'=>'ShippingMethod', 'enabled'=>1, 'visible'=>-1, 'position'=>190), - 'fk_warehouse' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Fk warehouse', 'enabled'=>1, 'visible'=>-1, 'position'=>191), + 'fk_warehouse' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Fk warehouse', 'enabled'=>'$conf->stock->enabled', 'visible'=>-1, 'position'=>191), 'fk_availability' =>array('type'=>'integer', 'label'=>'Availability', 'enabled'=>1, 'visible'=>-1, 'position'=>195), 'fk_delivery_address' =>array('type'=>'integer', 'label'=>'DeliveryAddress', 'enabled'=>1, 'visible'=>0, 'position'=>200), // deprecated 'fk_input_reason' =>array('type'=>'integer', 'label'=>'InputReason', 'enabled'=>1, 'visible'=>-1, 'position'=>205), diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 4bda73d9f1c..a7d237bc780 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -313,8 +313,8 @@ class Commande extends CommonOrder 'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'RefExt', 'enabled'=>1, 'visible'=>0, 'position'=>26), 'ref_int' =>array('type'=>'varchar(255)', 'label'=>'RefInt', 'enabled'=>1, 'visible'=>0, 'position'=>27), // deprecated 'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>28), - 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>20), - 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>25), + 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>20), + 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>'$conf->projet->enabled', 'visible'=>-1, 'position'=>25), 'date_commande' =>array('type'=>'date', 'label'=>'Date', 'enabled'=>1, 'visible'=>1, 'position'=>60), 'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>62), 'date_cloture' =>array('type'=>'datetime', 'label'=>'DateClosing', 'enabled'=>1, 'visible'=>-1, 'position'=>65), @@ -334,14 +334,14 @@ class Commande extends CommonOrder 'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>155), 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'PDFTemplate', 'enabled'=>1, 'visible'=>0, 'position'=>160), //'facture' =>array('type'=>'tinyint(4)', 'label'=>'ParentInvoice', 'enabled'=>1, 'visible'=>-1, 'position'=>165), - 'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>1, 'visible'=>-1, 'position'=>170), + 'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>'$conf->banque->enabled', 'visible'=>-1, 'position'=>170), 'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'MulticurrencyID', 'enabled'=>1, 'visible'=>-1, 'position'=>175), 'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'position'=>180), 'deposit_percent' =>array('type'=>'varchar(63)', 'label'=>'DepositPercent', 'enabled'=>1, 'visible'=>-1, 'position'=>181), 'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>-1, 'position'=>185), 'date_livraison' =>array('type'=>'date', 'label'=>'DateDeliveryPlanned', 'enabled'=>1, 'visible'=>-1, 'position'=>190), 'fk_shipping_method' =>array('type'=>'integer', 'label'=>'ShippingMethod', 'enabled'=>1, 'visible'=>-1, 'position'=>195), - 'fk_warehouse' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Fk warehouse', 'enabled'=>1, 'visible'=>-1, 'position'=>200), + 'fk_warehouse' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Fk warehouse', 'enabled'=>'$conf->stock->enabled', 'visible'=>-1, 'position'=>200), 'fk_availability' =>array('type'=>'integer', 'label'=>'Availability', 'enabled'=>1, 'visible'=>-1, 'position'=>205), 'fk_input_reason' =>array('type'=>'integer', 'label'=>'InputReason', 'enabled'=>1, 'visible'=>-1, 'position'=>210), //'fk_delivery_address' =>array('type'=>'integer', 'label'=>'DeliveryAddress', 'enabled'=>1, 'visible'=>-1, 'position'=>215), diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index af6d4dc606b..927da1bf17a 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -169,7 +169,7 @@ class FactureRec extends CommonInvoice 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), 'titre' =>array('type'=>'varchar(100)', 'label'=>'Titre', 'enabled'=>1, 'showoncombobox' => 1, 'visible'=>-1, 'position'=>15), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>20, 'index'=>1), - 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>25), + 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>25), 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>30), //'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35), 'remise' =>array('type'=>'double', 'label'=>'Remise', 'enabled'=>1, 'visible'=>-1, 'position'=>40), @@ -181,7 +181,7 @@ class FactureRec extends CommonInvoice 'total_ht' =>array('type'=>'double(24,8)', 'label'=>'Total', 'enabled'=>1, 'visible'=>-1, 'position'=>70, 'isameasure'=>1), 'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'Total ttc', 'enabled'=>1, 'visible'=>-1, 'position'=>75, 'isameasure'=>1), 'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'position'=>80), - 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>1, 'visible'=>-1, 'position'=>85), + 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>'$conf->projet->enabled', 'visible'=>-1, 'position'=>85), 'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'Fk cond reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>90), 'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'Fk mode reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>95), 'date_lim_reglement' =>array('type'=>'date', 'label'=>'Date lim reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>100), @@ -199,7 +199,7 @@ class FactureRec extends CommonInvoice 'revenuestamp' =>array('type'=>'double(24,8)', 'label'=>'RevenueStamp', 'enabled'=>1, 'visible'=>-1, 'position'=>160, 'isameasure'=>1), 'auto_validate' =>array('type'=>'integer', 'label'=>'Auto validate', 'enabled'=>1, 'visible'=>-1, 'position'=>165), 'generate_pdf' =>array('type'=>'integer', 'label'=>'Generate pdf', 'enabled'=>1, 'visible'=>-1, 'position'=>170), - 'fk_account' =>array('type'=>'integer', 'label'=>'Fk account', 'enabled'=>1, 'visible'=>-1, 'position'=>175), + 'fk_account' =>array('type'=>'integer', 'label'=>'Fk account', 'enabled'=>'$conf->banque->enabled', 'visible'=>-1, 'position'=>175), 'fk_multicurrency' =>array('type'=>'integer', 'label'=>'Fk multicurrency', 'enabled'=>1, 'visible'=>-1, 'position'=>180), 'multicurrency_code' =>array('type'=>'varchar(255)', 'label'=>'Multicurrency code', 'enabled'=>1, 'visible'=>-1, 'position'=>185), 'multicurrency_tx' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency tx', 'enabled'=>1, 'visible'=>-1, 'position'=>190, 'isameasure'=>1), diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 494c3cb1369..79f2e8e9e15 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -232,8 +232,8 @@ class Contrat extends CommonObject 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35), 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>40), 'date_contrat' =>array('type'=>'datetime', 'label'=>'Date contrat', 'enabled'=>1, 'visible'=>-1, 'position'=>45), - 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>70), - 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>75), + 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>70), + 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>'$conf->projet->enabled', 'visible'=>-1, 'position'=>75), 'fk_commercial_signature' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative Signature', 'enabled'=>1, 'visible'=>-1, 'position'=>80), 'fk_commercial_suivi' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative follower', 'enabled'=>1, 'visible'=>-1, 'position'=>85), 'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>90), diff --git a/htdocs/eventorganization/class/conferenceorbooth.class.php b/htdocs/eventorganization/class/conferenceorbooth.class.php index fb608eca8ba..292b55d0dc9 100644 --- a/htdocs/eventorganization/class/conferenceorbooth.class.php +++ b/htdocs/eventorganization/class/conferenceorbooth.class.php @@ -106,8 +106,8 @@ class ConferenceOrBooth extends ActionComm 'id' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), 'ref' => array('type'=>'integer', 'label'=>'Ref', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>2, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>0, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'csslist'=>'tdoverflowmax125', 'help'=>"Help text", 'showoncombobox'=>'1',), - 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"LinkToThirparty", 'picto'=>'company', 'css'=>'tdoverflowmax150 maxwidth500'), - 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1:t.usage_organize_event=1', 'label'=>'Project', 'enabled'=>'1', 'position'=>52, 'notnull'=>-1, 'visible'=>-1, 'index'=>1, 'picto'=>'project', 'css'=>'tdoverflowmax150 maxwidth500'), + 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"LinkToThirparty", 'picto'=>'company', 'css'=>'tdoverflowmax150 maxwidth500'), + 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1:t.usage_organize_event=1', 'label'=>'Project', 'enabled'=>'$conf->projet->enabled', 'position'=>52, 'notnull'=>-1, 'visible'=>-1, 'index'=>1, 'picto'=>'project', 'css'=>'tdoverflowmax150 maxwidth500'), 'note' => array('type'=>'text', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>1), 'fk_action' => array('type'=>'sellist:c_actioncomm:libelle:id::module LIKE (\'%@eventorganization\')', 'label'=>'Format', 'enabled'=>'1', 'position'=>60, 'notnull'=>1, 'visible'=>1, 'css'=>'width300'), 'datep' => array('type'=>'datetime', 'label'=>'DateStart', 'enabled'=>'1', 'position'=>70, 'notnull'=>0, 'visible'=>1, 'showoncombobox'=>'2',), diff --git a/htdocs/eventorganization/class/conferenceorboothattendee.class.php b/htdocs/eventorganization/class/conferenceorboothattendee.class.php index 3dfbb2e1a6c..533c9f4e8c0 100644 --- a/htdocs/eventorganization/class/conferenceorboothattendee.class.php +++ b/htdocs/eventorganization/class/conferenceorboothattendee.class.php @@ -104,13 +104,13 @@ class ConferenceOrBoothAttendee extends CommonObject 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>2, 'index'=>1, 'comment'=>"Reference of object"), 'fk_actioncomm' => array('type'=>'integer:ActionComm:comm/action/class/actioncomm.class.php:1', 'label'=>'ConferenceOrBooth', 'enabled'=>'1', 'position'=>55, 'notnull'=>0, 'visible'=>0, 'index'=>1, 'picto'=>'agenda'), - 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>'1', 'position'=>20, 'notnull'=>1, 'visible'=>0, 'index'=>1, 'picto'=>'project', 'css'=>'tdoverflowmax150 maxwidth500'), + 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>'$conf->projet->enabled', 'position'=>20, 'notnull'=>1, 'visible'=>0, 'index'=>1, 'picto'=>'project', 'css'=>'tdoverflowmax150 maxwidth500'), 'email' => array('type'=>'mail', 'label'=>'EmailAttendee', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'autofocusoncreate'=>1, 'searchall'=>1), 'firstname' => array('type'=>'varchar(100)', 'label'=>'Firstname', 'enabled'=>'1', 'position'=>31, 'notnull'=>0, 'visible'=>1, 'index'=>1, 'searchall'=>1), 'lastname' => array('type'=>'varchar(100)', 'label'=>'Lastname', 'enabled'=>'1', 'position'=>32, 'notnull'=>0, 'visible'=>1, 'index'=>1, 'searchall'=>1), - 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status = 1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'1', 'position'=>40, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"OrganizationEventLinkToThirdParty", 'picto'=>'company', 'css'=>'tdoverflowmax150 maxwidth500'), + 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status = 1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'position'=>40, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"OrganizationEventLinkToThirdParty", 'picto'=>'company', 'css'=>'tdoverflowmax150 maxwidth500'), 'date_subscription' => array('type'=>'datetime', 'label'=>'DateOfRegistration', 'enabled'=>'1', 'position'=>56, 'notnull'=>1, 'visible'=>1, 'showoncombobox'=>'1',), - 'fk_invoice' => array('type'=>'integer:Facture:compta/facture/class/facture.class.php', 'label'=>'Invoice', 'enabled'=>'1', 'position'=>57, 'notnull'=>0, 'visible'=>-1, 'index'=>0, 'picto'=>'bill', 'css'=>'tdoverflowmax150 maxwidth500'), + 'fk_invoice' => array('type'=>'integer:Facture:compta/facture/class/facture.class.php', 'label'=>'Invoice', 'enabled'=>'$conf->facture->enabled', 'position'=>57, 'notnull'=>0, 'visible'=>-1, 'index'=>0, 'picto'=>'bill', 'css'=>'tdoverflowmax150 maxwidth500'), 'amount' => array('type'=>'price', 'label'=>'AmountPaid', 'enabled'=>'1', 'position'=>57, 'notnull'=>0, 'visible'=>1, 'default'=>'null', 'isameasure'=>'1', 'help'=>"AmountOfSubscriptionPaid",), 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>3,), 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>'1', 'position'=>62, 'notnull'=>0, 'visible'=>3,), diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 9c27843567a..6da59af6465 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -39,9 +39,9 @@ class Fichinter extends CommonObject public $fields = array( 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), - 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>15), - 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>1, 'visible'=>-1, 'position'=>20), - 'fk_contrat' =>array('type'=>'integer', 'label'=>'Fk contrat', 'enabled'=>1, 'visible'=>-1, 'position'=>25), + 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>15), + 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>'$conf->projet->enabled', 'visible'=>-1, 'position'=>20), + 'fk_contrat' =>array('type'=>'integer', 'label'=>'Fk contrat', 'enabled'=>'$conf->contrat->enabled', 'visible'=>-1, 'position'=>25), 'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>30), 'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>35), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>40, 'index'=>1), diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 16f7cf8d060..1d0e370355f 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -218,7 +218,7 @@ class CommandeFournisseur extends CommonOrder 'ref' =>array('type'=>'varchar(255)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'showoncombobox'=>1, 'position'=>25, 'searchall'=>1), 'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>35), 'ref_supplier' =>array('type'=>'varchar(255)', 'label'=>'RefOrderSupplierShort', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'searchall'=>1), - 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>45), + 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>'$conf->projet->enabled', 'visible'=>-1, 'position'=>45), 'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>60), 'date_approve' =>array('type'=>'datetime', 'label'=>'DateApprove', 'enabled'=>1, 'visible'=>-1, 'position'=>62), 'date_approve2' =>array('type'=>'datetime', 'label'=>'DateApprove2', 'enabled'=>1, 'visible'=>3, 'position'=>64), @@ -243,7 +243,7 @@ class CommandeFournisseur extends CommonOrder 'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>3, 'position'=>175), 'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>3, 'position'=>180), 'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>0, 'position'=>190), - 'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>1, 'visible'=>3, 'position'=>200), + 'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>'$conf->banque->enabled', 'visible'=>3, 'position'=>200), 'fk_incoterms' =>array('type'=>'integer', 'label'=>'IncotermCode', 'enabled'=>1, 'visible'=>3, 'position'=>205), 'location_incoterms' =>array('type'=>'varchar(255)', 'label'=>'IncotermLocation', 'enabled'=>1, 'visible'=>3, 'position'=>210), 'fk_multicurrency' =>array('type'=>'integer', 'label'=>'Fk multicurrency', 'enabled'=>1, 'visible'=>0, 'position'=>215), @@ -253,7 +253,7 @@ class CommandeFournisseur extends CommonOrder 'multicurrency_total_tva' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountVAT', 'enabled'=>'!empty($conf->multicurrency->enabled)', 'visible'=>-1, 'position'=>235), 'multicurrency_total_ttc' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountTTC', 'enabled'=>'!empty($conf->multicurrency->enabled)', 'visible'=>-1, 'position'=>240), 'date_creation' =>array('type'=>'datetime', 'label'=>'Date creation', 'enabled'=>1, 'visible'=>-1, 'position'=>500), - 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>46), + 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>1, 'notnull'=>1, 'position'=>46), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>1000, 'index'=>1), 'tms'=>array('type'=>'datetime', 'label'=>"DateModificationShort", 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>501), 'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>1, 'visible'=>0, 'position'=>700), diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index a43e4a3ff9b..9464c06bd4c 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -181,7 +181,7 @@ class FactureFournisseurRec extends CommonInvoice 'titre' =>array('type'=>'varchar(100)', 'label'=>'Titre', 'enabled'=>1, 'showoncombobox' => 1, 'visible'=>-1, 'position'=>15), 'ref_supplier' =>array('type'=>'varchar(180)', 'label'=>'RefSupplier', 'enabled'=>1, 'showoncombobox' => 1, 'visible'=>-1, 'position'=>20), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>25, 'index'=>1), - 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>30), + 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>30), 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>35), 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>40), 'suspended' =>array('type'=>'integer', 'label'=>'Suspended', 'enabled'=>1, 'visible'=>-1, 'position'=>225), @@ -195,8 +195,8 @@ class FactureFournisseurRec extends CommonInvoice 'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'position'=>80), 'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>210), - 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>1, 'visible'=>-1, 'position'=>85), - 'fk_account' =>array('type'=>'integer', 'label'=>'Fk account', 'enabled'=>1, 'visible'=>-1, 'position'=>175), + 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>'$conf->projet->enabled', 'visible'=>-1, 'position'=>85), + 'fk_account' =>array('type'=>'integer', 'label'=>'Fk account', 'enabled'=>'$conf->banque->enabled', 'visible'=>-1, 'position'=>175), 'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'Fk cond reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>90), 'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'Fk mode reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>95), 'date_lim_reglement' =>array('type'=>'date', 'label'=>'Date lim reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>100), diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 52d9b19bfaf..0630d2df6a4 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -277,7 +277,7 @@ class FactureFournisseur extends CommonInvoice 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>25, 'index'=>1), 'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'RefExt', 'enabled'=>1, 'visible'=>0, 'position'=>30), 'type' =>array('type'=>'smallint(6)', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35), - 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>40), + 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>40), 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>45), 'datef' =>array('type'=>'date', 'label'=>'Date', 'enabled'=>1, 'visible'=>-1, 'position'=>50), 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>55), @@ -297,8 +297,8 @@ class FactureFournisseur extends CommonInvoice 'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>130), 'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>135), 'fk_facture_source' =>array('type'=>'integer', 'label'=>'Fk facture source', 'enabled'=>1, 'visible'=>-1, 'position'=>140), - 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>145), - 'fk_account' =>array('type'=>'integer', 'label'=>'Account', 'enabled'=>1, 'visible'=>-1, 'position'=>150), + 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>'$conf->projet->enabled', 'visible'=>-1, 'position'=>145), + 'fk_account' =>array('type'=>'integer', 'label'=>'Account', 'enabled'=>'$conf->banque->enabled', 'visible'=>-1, 'position'=>150), 'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'position'=>155), 'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>-1, 'position'=>160), 'date_lim_reglement' =>array('type'=>'date', 'label'=>'DateLimReglement', 'enabled'=>1, 'visible'=>-1, 'position'=>165), diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 245d9726048..a0868fa0580 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -108,8 +108,8 @@ class MyObject extends CommonObject 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth300', 'cssview'=>'wordbreak', 'help'=>'Help text', 'showoncombobox'=>2, 'validate'=>1), 'amount' => array('type'=>'price', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'default'=>'null', 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for amount', 'validate'=>1), 'qty' => array('type'=>'real', 'label'=>'Qty', 'enabled'=>1, 'visible'=>1, 'default'=>'0', 'position'=>45, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for quantity', 'css'=>'maxwidth75imp', 'validate'=>1), - 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'picto'=>'company', 'label'=>'ThirdParty', 'visible'=> 1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'help'=>'LinkToThirparty', 'validate'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx'), - 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'picto'=>'project', 'enabled'=>1, 'visible'=>-1, 'position'=>52, 'notnull'=>-1, 'index'=>1, 'validate'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx'), + 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'picto'=>'company', 'label'=>'ThirdParty', 'visible'=> 1, 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'index'=>1, 'help'=>'LinkToThirparty', 'validate'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx'), + 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'picto'=>'project', 'enabled'=>'$conf->projet->enabled', 'visible'=>-1, 'position'=>52, 'notnull'=>-1, 'index'=>1, 'validate'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx'), 'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>3, 'position'=>60, 'validate'=>1), 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61, 'validate'=>1, 'cssview'=>'wordbreak'), 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62, 'validate'=>1, 'cssview'=>'wordbreak'), diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index ecc3684e4fe..67f5fe68161 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -100,14 +100,14 @@ class Mo extends CommonObject 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",), 'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'position'=>5, 'notnull'=>1, 'default'=>'1', 'index'=>1), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'showoncombobox'=>'1', 'noteditable'=>1), - 'fk_bom' => array('type'=>'integer:Bom:bom/class/bom.class.php:0:t.status=1', 'filter'=>'active=1', 'label'=>'BOM', 'enabled'=>1, 'visible'=>1, 'position'=>33, 'notnull'=>-1, 'index'=>1, 'comment'=>"Original BOM", 'css'=>'minwidth100 maxwidth300', 'csslist'=>'nowraponall'), + 'fk_bom' => array('type'=>'integer:Bom:bom/class/bom.class.php:0:t.status=1', 'filter'=>'active=1', 'label'=>'BOM', 'enabled'=>'$conf->bom->enabled', 'visible'=>1, 'position'=>33, 'notnull'=>-1, 'index'=>1, 'comment'=>"Original BOM", 'css'=>'minwidth100 maxwidth300', 'csslist'=>'nowraponall'), 'mrptype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'position'=>34, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing', 1=>'Disassemble'), 'css'=>'minwidth150', 'csslist'=>'minwidth150 center'), - 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:0', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'comment'=>"Product to produce", 'css'=>'maxwidth300', 'csslist'=>'tdoverflowmax100', 'picto'=>'product'), + 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:0', 'label'=>'Product', 'enabled'=>'$conf->product->enabled', 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'comment'=>"Product to produce", 'css'=>'maxwidth300', 'csslist'=>'tdoverflowmax100', 'picto'=>'product'), 'qty' => array('type'=>'real', 'label'=>'QtyToProduce', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'notnull'=>1, 'comment'=>"Qty to produce", 'css'=>'width75', 'default'=>1, 'isameasure'=>1), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>42, 'notnull'=>-1, 'searchall'=>1, 'showoncombobox'=>'2', 'css'=>'maxwidth300', 'csslist'=>'tdoverflowmax200'), - 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1', 'label'=>'ThirdParty', 'picto'=>'company', 'enabled'=>1, 'visible'=>-1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'css'=>'maxwidth400', 'csslist'=>'tdoverflowmax150'), - 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'picto'=>'project', 'enabled'=>1, 'visible'=>-1, 'position'=>51, 'notnull'=>-1, 'index'=>1, 'css'=>'minwidth200 maxwidth400', 'csslist'=>'tdoverflowmax100'), - 'fk_warehouse' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php:0', 'label'=>'WarehouseForProduction', 'picto'=>'stock', 'enabled'=>1, 'visible'=>1, 'position'=>52, 'css'=>'maxwidth400', 'csslist'=>'tdoverflowmax200'), + 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1', 'label'=>'ThirdParty', 'picto'=>'company', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'css'=>'maxwidth400', 'csslist'=>'tdoverflowmax150'), + 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'picto'=>'project', 'enabled'=>'$conf->projet->enabled', 'visible'=>-1, 'position'=>51, 'notnull'=>-1, 'index'=>1, 'css'=>'minwidth200 maxwidth400', 'csslist'=>'tdoverflowmax100'), + 'fk_warehouse' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php:0', 'label'=>'WarehouseForProduction', 'picto'=>'stock', 'enabled'=>'$conf->stock->enabled', 'visible'=>1, 'position'=>52, 'css'=>'maxwidth400', 'csslist'=>'tdoverflowmax200'), 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61, 'notnull'=>-1,), 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62, 'notnull'=>-1,), 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>500, 'notnull'=>1,), diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 155c525de8c..5d1da2b22ab 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -129,7 +129,7 @@ class Entrepot extends CommonObject 'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-2, 'position'=>35, 'searchall'=>1), 'lieu' =>array('type'=>'varchar(64)', 'label'=>'LocationSummary', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'showoncombobox'=>2, 'searchall'=>1), 'fk_parent' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php:1:statut=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ParentWarehouse', 'enabled'=>1, 'visible'=>-2, 'position'=>41), - 'fk_project' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>25), + 'fk_project' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>'$conf->projet->enabled', 'visible'=>-1, 'position'=>25), 'address' =>array('type'=>'varchar(255)', 'label'=>'Address', 'enabled'=>1, 'visible'=>-2, 'position'=>45, 'searchall'=>1), 'zip' =>array('type'=>'varchar(10)', 'label'=>'Zip', 'enabled'=>1, 'visible'=>-2, 'position'=>50, 'searchall'=>1), 'town' =>array('type'=>'varchar(50)', 'label'=>'Town', 'enabled'=>1, 'visible'=>-2, 'position'=>55, 'searchall'=>1), diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 79260263148..735fc3bfa64 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -119,7 +119,7 @@ class MouvementStock extends CommonObject 'fk_origin' =>array('type'=>'integer', 'label'=>'Fk origin', 'enabled'=>1, 'visible'=>-1, 'position'=>60), 'origintype' =>array('type'=>'varchar(32)', 'label'=>'Origintype', 'enabled'=>1, 'visible'=>-1, 'position'=>65), 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>70), - 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>75), + 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>'$conf->projet->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>75), 'inventorycode' =>array('type'=>'varchar(128)', 'label'=>'InventoryCode', 'enabled'=>1, 'visible'=>-1, 'position'=>80), 'batch' =>array('type'=>'varchar(30)', 'label'=>'Batch', 'enabled'=>1, 'visible'=>-1, 'position'=>85), 'eatby' =>array('type'=>'date', 'label'=>'Eatby', 'enabled'=>1, 'visible'=>-1, 'position'=>90), diff --git a/htdocs/recruitment/class/recruitmentjobposition.class.php b/htdocs/recruitment/class/recruitmentjobposition.class.php index 43e20858f69..d978c0fbb94 100644 --- a/htdocs/recruitment/class/recruitmentjobposition.class.php +++ b/htdocs/recruitment/class/recruitmentjobposition.class.php @@ -104,12 +104,12 @@ class RecruitmentJobPosition extends CommonObject 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>4, 'noteditable'=>'1', 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'comment'=>"Reference of object", 'css'=>'nowraponall'), 'label' => array('type'=>'varchar(255)', 'label'=>'JobLabel', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth500', 'csslist'=>'tdoverflowmax300', 'showoncombobox'=>'2', 'autofocusoncreate'=>1), 'qty' => array('type'=>'integer', 'label'=>'NbOfEmployeesExpected', 'enabled'=>'1', 'position'=>45, 'notnull'=>1, 'visible'=>1, 'default'=>'1', 'isameasure'=>'1', 'css'=>'maxwidth75imp'), - 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>'1', 'position'=>52, 'notnull'=>-1, 'visible'=>-1, 'index'=>1, 'css'=>'maxwidth500', 'picto'=>'project'), + 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>'$conf->projet->enabled', 'position'=>52, 'notnull'=>-1, 'visible'=>-1, 'index'=>1, 'css'=>'maxwidth500', 'picto'=>'project'), 'fk_user_recruiter' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'ResponsibleOfRecruitement', 'enabled'=>'1', 'position'=>54, 'notnull'=>1, 'visible'=>1, 'foreignkey'=>'user.rowid', 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax150', 'picto'=>'user'), 'email_recruiter' => array('type'=>'varchar(255)', 'label'=>'EmailRecruiter', 'enabled'=>'1', 'position'=>54, 'notnull'=>0, 'visible'=>-1, 'help'=>'ToUseAGenericEmail', 'picto'=>'email'), 'fk_user_supervisor' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'FutureManager', 'enabled'=>'1', 'position'=>55, 'notnull'=>0, 'visible'=>-1, 'foreignkey'=>'user.rowid', 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax150', 'picto'=>'user'), 'fk_establishment' => array('type'=>'integer:Establishment:hrm/class/establishment.class.php', 'label'=>'Establishment', 'enabled'=>'$conf->hrm->enabled', 'position'=>56, 'notnull'=>0, 'visible'=>-1, 'foreignkey'=>'establishment.rowid',), - 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'WorkPlace', 'enabled'=>'1', 'position'=>57, 'notnull'=>-1, 'visible'=>-1, 'css'=>'maxwidth500', 'index'=>1, 'help'=>"IfJobIsLocatedAtAPartner", 'picto'=>'company'), + 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'WorkPlace', 'enabled'=>'$conf->societe->enabled', 'position'=>57, 'notnull'=>-1, 'visible'=>-1, 'css'=>'maxwidth500', 'index'=>1, 'help'=>"IfJobIsLocatedAtAPartner", 'picto'=>'company'), 'date_planned' => array('type'=>'date', 'label'=>'DateExpected', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>1,), 'remuneration_suggested' => array('type'=>'varchar(255)', 'label'=>'Remuneration', 'enabled'=>'1', 'position'=>62, 'notnull'=>0, 'visible'=>1,), 'description' => array('type'=>'html', 'label'=>'Description', 'enabled'=>'1', 'position'=>65, 'notnull'=>0, 'visible'=>3,), diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 98a9ac23355..e267ffce6c1 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -267,7 +267,7 @@ class Ticket extends CommonObject 'severity_code' => array('type'=>'varchar(32)', 'label'=>'Severity', 'visible'=>1, 'enabled'=>1, 'position'=>22, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth100'), 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>"LinkToThirparty", 'css'=>'tdoverflowmax150 maxwidth150onsmartphone'), 'notify_tiers_at_create' => array('type'=>'integer', 'label'=>'NotifyThirdparty', 'visible'=>-1, 'enabled'=>0, 'position'=>51, 'notnull'=>1, 'index'=>1), - 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php', 'label'=>'Project', 'visible'=>-1, 'enabled'=>1, 'position'=>52, 'notnull'=>-1, 'index'=>1, 'help'=>"LinkToProject"), + 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php', 'label'=>'Project', 'visible'=>-1, 'enabled'=>'$conf->projet->enabled', 'position'=>52, 'notnull'=>-1, 'index'=>1, 'help'=>"LinkToProject"), //'timing' => array('type'=>'varchar(20)', 'label'=>'Timing', 'visible'=>-1, 'enabled'=>1, 'position'=>42, 'notnull'=>-1, 'help'=>""), // what is this ? 'datec' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>1, 'enabled'=>1, 'position'=>500, 'notnull'=>1), 'date_read' => array('type'=>'datetime', 'label'=>'TicketReadOn', 'visible'=>-1, 'enabled'=>1, 'position'=>501, 'notnull'=>1), From 755bce9fe1186070e13913feb7d25cdac513f0f2 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 21 May 2022 00:22:47 +0200 Subject: [PATCH 079/165] Fix : date_creation must have visible=-2 --- htdocs/commande/class/commande.class.php | 2 +- htdocs/fourn/class/fournisseur.commande.class.php | 2 +- htdocs/mrp/class/mo.class.php | 2 +- htdocs/recruitment/class/recruitmentjobposition.class.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index f51c8026672..728e0f62ede 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -347,7 +347,7 @@ class Commande extends CommonOrder 'pos_source' =>array('type'=>'varchar(32)', 'label'=>'POSTerminal', 'enabled'=>1, 'visible'=>-1, 'position'=>280), 'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'position'=>300), 'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>302), - 'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>304), + 'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>304), 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>306), 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>400), 'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Status', 'enabled'=>1, 'visible'=>-1, 'position'=>500), diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index a20075295d9..ce1fffba01e 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -195,7 +195,7 @@ class CommandeFournisseur extends CommonOrder 'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>35), 'ref_supplier' =>array('type'=>'varchar(255)', 'label'=>'RefSupplier', 'enabled'=>1, 'visible'=>-1, 'position'=>40), 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>1, 'visible'=>-1, 'position'=>45), - 'date_creation' =>array('type'=>'datetime', 'label'=>'Date creation', 'enabled'=>1, 'visible'=>-1, 'position'=>50), + 'date_creation' =>array('type'=>'datetime', 'label'=>'Date creation', 'enabled'=>1, 'visible'=>-2, 'position'=>50), 'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>55), 'date_approve' =>array('type'=>'datetime', 'label'=>'Date approve', 'enabled'=>1, 'visible'=>-1, 'position'=>60), 'date_approve2' =>array('type'=>'datetime', 'label'=>'Date approve2', 'enabled'=>1, 'visible'=>-1, 'position'=>65), diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 6f7dfd2260b..92cb819aab3 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -1435,7 +1435,7 @@ class MoLine extends CommonObjectLine 'role' =>array('type'=>'varchar(10)', 'label'=>'Role', 'enabled'=>1, 'visible'=>-1, 'position'=>145), 'fk_mrp_production' =>array('type'=>'integer', 'label'=>'Fk mrp production', 'enabled'=>1, 'visible'=>-1, 'position'=>150), 'fk_stock_movement' =>array('type'=>'integer', 'label'=>'StockMovement', 'enabled'=>1, 'visible'=>-1, 'position'=>155), - 'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>160), + 'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>160), 'tms' =>array('type'=>'timestamp', 'label'=>'Tms', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>165), 'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserCreation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>170), 'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModification', 'enabled'=>1, 'visible'=>-1, 'position'=>175), diff --git a/htdocs/recruitment/class/recruitmentjobposition.class.php b/htdocs/recruitment/class/recruitmentjobposition.class.php index 3b52e5b4fa6..2edd752786b 100644 --- a/htdocs/recruitment/class/recruitmentjobposition.class.php +++ b/htdocs/recruitment/class/recruitmentjobposition.class.php @@ -115,7 +115,7 @@ class RecruitmentJobPosition extends CommonObject 'description' => array('type'=>'html', 'label'=>'Description', 'enabled'=>'1', 'position'=>65, 'notnull'=>0, 'visible'=>3,), 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>101, 'notnull'=>0, 'visible'=>0,), 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>'1', 'position'=>102, 'notnull'=>0, 'visible'=>0,), - 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-4,), + 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,), 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>'1', 'position'=>501, 'notnull'=>0, 'visible'=>-2,), 'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>'1', 'position'=>510, 'notnull'=>1, 'visible'=>-2, 'foreignkey'=>'user.rowid',), 'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>'1', 'position'=>511, 'notnull'=>-1, 'visible'=>-2,), From 72bfedaba15097d4e45f74f00cc79bc76fc0a75e Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Sat, 21 May 2022 00:33:28 +0200 Subject: [PATCH 080/165] Add form setup and backport as default setup builder --- htdocs/modulebuilder/index.php | 27 ++ htdocs/modulebuilder/template/admin/setup.php | 302 ++++-------------- 2 files changed, 95 insertions(+), 234 deletions(-) diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index e8e32f73d0f..0bf2036ec33 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -238,6 +238,33 @@ if ($dirins && $action == 'initmodule' && $modulename) { } } + // Copy last html.formsetup.class.php' to backport folder + $tryToCopyFromSetupClass = true; + $backportDest = $destdir .'/backport/v17/core/class'; + $backportFileSrc = DOL_DOCUMENT_ROOT.'/core/class/html.formsetup.class.php'; + $backportFileDest = $backportDest.'/html.formsetup.class.php'; + $result = dol_mkdir($backportDest); + + if ($result < 0) { + $error++; + $langs->load("errors"); + setEventMessages($langs->trans("ErrorFailToCreateDir", $backportDest), null, 'errors'); + $tryToCopyFromSetupClass = true; + } + + if ($tryToCopyFromSetupClass) { + $result = dol_copy($backportFileSrc, $backportFileDest); + if ($result <= 0) { + if ($result < 0) { + $error++; + $langs->load("errors"); + setEventMessages($langs->trans("ErrorFailToCopyFile", $backportFileSrc, $backportFileDest), null, 'errors'); + } else { + setEventMessages($langs->trans("AllFilesDidAlreadyExist", $backportFileDest), null, 'warnings'); + } + } + } + if (!empty($conf->global->MODULEBUILDER_USE_ABOUT)) { dol_delete_file($destdir.'/admin/about.php'); } diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php index 84b394da808..c353ba420ed 100644 --- a/htdocs/modulebuilder/template/admin/setup.php +++ b/htdocs/modulebuilder/template/admin/setup.php @@ -78,65 +78,70 @@ $label = GETPOST('label', 'alpha'); $scandir = GETPOST('scan_dir', 'alpha'); $type = 'myobject'; -$arrayofparameters = array( - 'MYMODULE_MYPARAM1'=>array('type'=>'string', 'css'=>'minwidth500' ,'enabled'=>1), - 'MYMODULE_MYPARAM2'=>array('type'=>'textarea','enabled'=>1), - //'MYMODULE_MYPARAM3'=>array('type'=>'category:'.Categorie::TYPE_CUSTOMER, 'enabled'=>1), - //'MYMODULE_MYPARAM4'=>array('type'=>'emailtemplate:thirdparty', 'enabled'=>1), - //'MYMODULE_MYPARAM5'=>array('type'=>'yesno', 'enabled'=>1), - //'MYMODULE_MYPARAM5'=>array('type'=>'thirdparty_type', 'enabled'=>1), - //'MYMODULE_MYPARAM6'=>array('type'=>'securekey', 'enabled'=>1), - //'MYMODULE_MYPARAM7'=>array('type'=>'product', 'enabled'=>1), -); $error = 0; $setupnotempty = 0; // Set this to 1 to use the factory to manage constants. Warning, the generated module will be compatible with version v15+ only -$useFormSetup = 0; -// Convert arrayofparameter into a formSetup object -if ($useFormSetup && (float) DOL_VERSION >= 15) { - require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsetup.class.php'; - $formSetup = new FormSetup($db); +$useFormSetup = 1; - // you can use the param convertor - $formSetup->addItemsFromParamsArray($arrayofparameters); - - // or use the new system see exemple as follow (or use both because you can ;-) ) - - /* - // Hôte - $item = $formSetup->newItem('NO_PARAM_JUST_TEXT'); - $item->fieldOverride = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') . $_SERVER['HTTP_HOST']; - $item->cssClass = 'minwidth500'; - - // Setup conf MYMODULE_MYPARAM1 as a simple string input - $item = $formSetup->newItem('MYMODULE_MYPARAM1'); - - // Setup conf MYMODULE_MYPARAM1 as a simple textarea input but we replace the text of field title - $item = $formSetup->newItem('MYMODULE_MYPARAM2'); - $item->nameText = $item->getNameText().' more html text '; - - // Setup conf MYMODULE_MYPARAM3 - $item = $formSetup->newItem('MYMODULE_MYPARAM3'); - $item->setAsThirdpartyType(); - - // Setup conf MYMODULE_MYPARAM4 : exemple of quick define write style - $formSetup->newItem('MYMODULE_MYPARAM4')->setAsYesNo(); - - // Setup conf MYMODULE_MYPARAM5 - $formSetup->newItem('MYMODULE_MYPARAM5')->setAsEmailTemplate('thirdparty'); - - // Setup conf MYMODULE_MYPARAM6 - $formSetup->newItem('MYMODULE_MYPARAM6')->setAsSecureKey()->enabled = 0; // disabled - - // Setup conf MYMODULE_MYPARAM7 - $formSetup->newItem('MYMODULE_MYPARAM7')->setAsProduct(); - */ - - $setupnotempty = count($formSetup->items); +if (!class_exists('FormSetup')) { + // For retrocompatibility Dolibarr < 15.0 + if (versioncompare(explode('.', DOL_VERSION), array(17)) < 0 && !class_exists('FormSetup')) { + require_once __DIR__.'/../backport/v17/core/class/html.formsetup.class.php'; + } else { + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsetup.class.php'; + } } +$formSetup = new FormSetup($db); + + +// Hôte +$item = $formSetup->newItem('NO_PARAM_JUST_TEXT'); +$item->fieldOverride = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') . $_SERVER['HTTP_HOST']; +$item->cssClass = 'minwidth500'; + +// Setup conf MYMODULE_MYPARAM1 as a simple string input +$item = $formSetup->newItem('MYMODULE_MYPARAM1'); + +// Setup conf MYMODULE_MYPARAM1 as a simple textarea input but we replace the text of field title +$item = $formSetup->newItem('MYMODULE_MYPARAM2'); +$item->nameText = $item->getNameText().' more html text '; + +// Setup conf MYMODULE_MYPARAM3 +$item = $formSetup->newItem('MYMODULE_MYPARAM3'); +$item->setAsThirdpartyType(); + +// Setup conf MYMODULE_MYPARAM4 : exemple of quick define write style +$formSetup->newItem('MYMODULE_MYPARAM4')->setAsYesNo(); + +// Setup conf MYMODULE_MYPARAM5 +$formSetup->newItem('MYMODULE_MYPARAM5')->setAsEmailTemplate('thirdparty'); + +// Setup conf MYMODULE_MYPARAM6 +$formSetup->newItem('MYMODULE_MYPARAM6')->setAsSecureKey()->enabled = 0; // disabled + +// Setup conf MYMODULE_MYPARAM7 +$formSetup->newItem('MYMODULE_MYPARAM7')->setAsProduct(); + + +$formSetup->newItem('Title')->setAsTitle(); + +$item = $formSetup->newItem('MYMODULE_MYPARAM8'); +$TField = array( + 'test01' => $langs->trans('test01'), + 'test02' => $langs->trans('test02'), + 'test03' => $langs->trans('test03'), + 'test04' => $langs->trans('test04'), + 'test05' => $langs->trans('test05'), + 'test06' => $langs->trans('test06'), +); +$item->setAsMultiSelect($TField); +$item->helpText = $langs->transnoentities('MYMODULE_MYPARAM8'); + +$setupnotempty =+ count($formSetup->items); + $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); @@ -145,6 +150,11 @@ $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); * Actions */ +// For retrocompatibility Dolibarr < 15.0 +if ( versioncompare(explode('.', DOL_VERSION), array(15)) < 0 && $action == 'update' && !empty($user->admin)) { + $formSetup->saveConfFromPost(); +} + include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; if ($action == 'updateMask') { @@ -271,191 +281,15 @@ echo ''.$langs->trans("MyModuleSetupPage").'< if ($action == 'edit') { - if ($useFormSetup && (float) DOL_VERSION >= 15) { - print $formSetup->generateOutput(true); - } else { - print ''; - print ''; - print ''; - - print ''; - print ''; - - foreach ($arrayofparameters as $constname => $val) { - if ($val['enabled']==1) { - $setupnotempty++; - print ''; - } - } - print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; - $tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : ''); - print ''.$form->textwithpicto($langs->trans($constname), $tooltiphelp, 1, 'info', '', 0, 3, 'tootips'.$constname).''; - print ''; - - if ($val['type'] == 'textarea') { - print '\n"; - } elseif ($val['type']== 'html') { - require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; - $doleditor = new DolEditor($constname, $conf->global->{$constname}, '', 160, 'dolibarr_notes', '', false, false, $conf->fckeditor->enabled, ROWS_5, '90%'); - $doleditor->Create(); - } elseif ($val['type'] == 'yesno') { - print $form->selectyesno($constname, $conf->global->{$constname}, 1); - } elseif (preg_match('/emailtemplate:/', $val['type'])) { - include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; - $formmail = new FormMail($db); - - $tmp = explode(':', $val['type']); - $nboftemplates = $formmail->fetchAllEMailTemplate($tmp[1], $user, null, 1); // We set lang=null to get in priority record with no lang - //$arraydefaultmessage = $formmail->getEMailTemplate($db, $tmp[1], $user, null, 0, 1, ''); - $arrayofmessagename = array(); - if (is_array($formmail->lines_model)) { - foreach ($formmail->lines_model as $modelmail) { - //var_dump($modelmail); - $moreonlabel = ''; - if (!empty($arrayofmessagename[$modelmail->label])) { - $moreonlabel = ' (' . $langs->trans("SeveralLangugeVariatFound") . ')'; - } - // The 'label' is the key that is unique if we exclude the language - $arrayofmessagename[$modelmail->id] = $langs->trans(preg_replace('/\(|\)/', '', $modelmail->label)) . $moreonlabel; - } - } - print $form->selectarray($constname, $arrayofmessagename, $conf->global->{$constname}, 'None', 0, 0, '', 0, 0, 0, '', '', 1); - } elseif (preg_match('/category:/', $val['type'])) { - require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; - require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; - $formother = new FormOther($db); - - $tmp = explode(':', $val['type']); - print img_picto('', 'category', 'class="pictofixedwidth"'); - print $formother->select_categories($tmp[1], $conf->global->{$constname}, $constname, 0, $langs->trans('CustomersProspectsCategoriesShort')); - } elseif (preg_match('/thirdparty_type/', $val['type'])) { - require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; - $formcompany = new FormCompany($db); - print $formcompany->selectProspectCustomerType($conf->global->{$constname}, $constname); - } elseif ($val['type'] == 'securekey') { - print ''; - if (!empty($conf->use_javascript_ajax)) { - print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token'.$constname.'" class="linkobject"'); - } - if (!empty($conf->use_javascript_ajax)) { - print "\n".''; - } - } elseif ($val['type'] == 'product') { - if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) { - $selected = (empty($conf->global->$constname) ? '' : $conf->global->$constname); - $form->select_produits($selected, $constname, '', 0); - } - } else { - print ''; - } - print '
'; - - print '
'; - print ''; - print '
'; - - print ''; - } - + print $formSetup->generateOutput(true); print '
'; +} elseif (!empty($formSetup->items)) { + print $formSetup->generateOutput(); + print '
'; + print ''.$langs->trans("Modify").''; + print '
'; } else { - if ($useFormSetup && (float) DOL_VERSION >= 15) { - if (!empty($formSetup->items)) { - print $formSetup->generateOutput(); - } - } else { - if (!empty($arrayofparameters)) { - print ''; - print ''; - - foreach ($arrayofparameters as $constname => $val) { - if ($val['enabled']==1) { - $setupnotempty++; - print ''; - } - } - - print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; - $tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : ''); - print $form->textwithpicto($langs->trans($constname), $tooltiphelp); - print ''; - - if ($val['type'] == 'textarea') { - print dol_nl2br($conf->global->{$constname}); - } elseif ($val['type']== 'html') { - print $conf->global->{$constname}; - } elseif ($val['type'] == 'yesno') { - print ajax_constantonoff($constname); - } elseif (preg_match('/emailtemplate:/', $val['type'])) { - include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; - $formmail = new FormMail($db); - - $tmp = explode(':', $val['type']); - - $template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs, $conf->global->{$constname}); - if ($template<0) { - setEventMessages(null, $formmail->errors, 'errors'); - } - print $langs->trans($template->label); - } elseif (preg_match('/category:/', $val['type'])) { - $c = new Categorie($db); - $result = $c->fetch($conf->global->{$constname}); - if ($result < 0) { - setEventMessages(null, $c->errors, 'errors'); - } elseif ($result > 0 ) { - $ways = $c->print_all_ways(' >> ', 'none', 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formated text - $toprint = array(); - foreach ($ways as $way) { - $toprint[] = '
  • color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . '
  • '; - } - print '
      ' . implode(' ', $toprint) . '
    '; - } - } elseif (preg_match('/thirdparty_type/', $val['type'])) { - if ($conf->global->{$constname}==2) { - print $langs->trans("Prospect"); - } elseif ($conf->global->{$constname}==3) { - print $langs->trans("ProspectCustomer"); - } elseif ($conf->global->{$constname}==1) { - print $langs->trans("Customer"); - } elseif ($conf->global->{$constname}==0) { - print $langs->trans("NorProspectNorCustomer"); - } - } elseif ($val['type'] == 'product') { - $product = new Product($db); - $resprod = $product->fetch($conf->global->{$constname}); - if ($resprod > 0) { - print $product->ref; - } elseif ($resprod < 0) { - setEventMessages(null, $object->errors, "errors"); - } - } else { - print $conf->global->{$constname}; - } - print '
    '; - } - } - - if ($setupnotempty) { - print '
    '; - print ''.$langs->trans("Modify").''; - print '
    '; - } else { - print '
    '.$langs->trans("NothingToSetup"); - } + print '
    '.$langs->trans("NothingToSetup"); } From f8dcc1daaf6fa789ec3a4e2b5b00eef3bcc467d2 Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Sat, 21 May 2022 00:36:13 +0200 Subject: [PATCH 081/165] Add form setup and backport as default setup builder --- htdocs/modulebuilder/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 0bf2036ec33..44a69c1f5e8 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -249,7 +249,7 @@ if ($dirins && $action == 'initmodule' && $modulename) { $error++; $langs->load("errors"); setEventMessages($langs->trans("ErrorFailToCreateDir", $backportDest), null, 'errors'); - $tryToCopyFromSetupClass = true; + $tryToCopyFromSetupClass = false; } if ($tryToCopyFromSetupClass) { @@ -260,7 +260,7 @@ if ($dirins && $action == 'initmodule' && $modulename) { $langs->load("errors"); setEventMessages($langs->trans("ErrorFailToCopyFile", $backportFileSrc, $backportFileDest), null, 'errors'); } else { - setEventMessages($langs->trans("AllFilesDidAlreadyExist", $backportFileDest), null, 'warnings'); + setEventMessages($langs->trans("FileDidAlreadyExist", $backportFileDest), null, 'warnings'); } } } From 0d7386ab896e51778a5396ad6e04e566e57dbffd Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 21 May 2022 01:23:39 +0200 Subject: [PATCH 082/165] Fix select projet on event creation --- htdocs/comm/action/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index aa513e07794..02f52de7388 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1237,7 +1237,7 @@ if ($action == 'create') { print ''.$langs->trans("Project").''; print img_picto('', 'project', 'class="pictofixedwidth"'); - print $formproject->select_projects((empty($societe->id) ? '' : $societe->id), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx'); + print $formproject->select_projects(($object->socid > 0 ? $object->socid : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx'); print ' '; print ''; From cf321dd8e5489f2d442aac8f931e8390b9b139c1 Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Sat, 21 May 2022 01:26:02 +0200 Subject: [PATCH 083/165] change comment --- 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 c353ba420ed..73cd54100fc 100644 --- a/htdocs/modulebuilder/template/admin/setup.php +++ b/htdocs/modulebuilder/template/admin/setup.php @@ -86,7 +86,7 @@ $setupnotempty = 0; $useFormSetup = 1; if (!class_exists('FormSetup')) { - // For retrocompatibility Dolibarr < 15.0 + // For retrocompatibility Dolibarr < 17.0 if (versioncompare(explode('.', DOL_VERSION), array(17)) < 0 && !class_exists('FormSetup')) { require_once __DIR__.'/../backport/v17/core/class/html.formsetup.class.php'; } else { From c12ae28ad725c974cfeba9f3f305520d58622c15 Mon Sep 17 00:00:00 2001 From: IC-Ilies Date: Sat, 21 May 2022 09:31:33 +0200 Subject: [PATCH 084/165] FIX#20448 missing preg_replace for vat rate when adding a free line --- htdocs/comm/propal/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 54e64c73f99..b40092abfaa 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -838,7 +838,7 @@ if (empty($reshook)) { $prod_entry_mode = GETPOST('prod_entry_mode'); if ($prod_entry_mode == 'free') { $idprod = 0; - $tva_tx = (GETPOST('tva_tx') ? price2num(GETPOST('tva_tx')) : 0); + $tva_tx = (GETPOST('tva_tx') ? price2num(preg_replace('/\s*\(.*\)/', '', GETPOST('tva_tx'))) : 0); } else { $idprod = GETPOST('idprod', 'int'); $tva_tx = ''; From 54e572b94fae7c0642b0a37ac88c42789f9e771a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 21 May 2022 10:25:20 +0200 Subject: [PATCH 085/165] Fix --- htdocs/adherents/class/adherent_type.class.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index f73ff9bf451..3f857ce827b 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -122,12 +122,10 @@ class AdherentType extends CommonObject public $members = array(); /** @var string string other */ - public $other; + public $other = array(); public $multilangs = array(); - public $other = array(); - /** * Constructor From f3ca26576dda8f78e78333bfcb8eb2126ff83e4a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 21 May 2022 14:17:49 +0200 Subject: [PATCH 086/165] Fix regression --- htdocs/categories/class/categorie.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index ef5ea585314..bf9442b82af 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -113,7 +113,7 @@ class Categorie extends CommonObject * * @todo Move to const array when PHP 5.6 will be our minimum target */ - public static $MAP_CAT_FK = array( + public $MAP_CAT_FK = array( 'customer' => 'soc', 'supplier' => 'soc', 'contact' => 'socpeople', @@ -125,7 +125,7 @@ class Categorie extends CommonObject * * @note Move to const array when PHP 5.6 will be our minimum target */ - public static $MAP_CAT_TABLE = array( + public $MAP_CAT_TABLE = array( 'customer' => 'societe', 'supplier' => 'fournisseur', 'bank_account'=> 'account', @@ -136,7 +136,7 @@ class Categorie extends CommonObject * * @note Move to const array when PHP 5.6 will be our minimum target */ - public static $MAP_OBJ_CLASS = array( + public $MAP_OBJ_CLASS = array( 'product' => 'Product', 'customer' => 'Societe', 'supplier' => 'Fournisseur', From b14c04a8f0853109a843b7766a685d26142098c3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 21 May 2022 14:28:35 +0200 Subject: [PATCH 087/165] Fix regression --- htdocs/asset/class/asset.class.php | 1 - htdocs/core/class/commonobject.class.php | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index 710ae7fd3d0..410af398bc7 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -155,7 +155,6 @@ class Asset extends CommonObject public $import_key; public $model_pdf; public $status; - public $supplier_invoice_id; // /** // * @var string Field with ID of parent key if this object has a parent diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index bf33cbe224e..14bca386018 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -116,7 +116,7 @@ abstract class CommonObject public $array_languages = null; // Value is array() when load already tried /** - * @var array To sotre result of ->liste_contact() + * @var array To store result of ->liste_contact() */ public $contacts_ids; From 9ba10202980f2a46c797592b4e15a7278f96c0b2 Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Sat, 21 May 2022 15:03:10 +0200 Subject: [PATCH 088/165] Fix version detect --- htdocs/modulebuilder/template/admin/setup.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php index 73cd54100fc..8128ba7ca52 100644 --- a/htdocs/modulebuilder/template/admin/setup.php +++ b/htdocs/modulebuilder/template/admin/setup.php @@ -86,8 +86,8 @@ $setupnotempty = 0; $useFormSetup = 1; if (!class_exists('FormSetup')) { - // For retrocompatibility Dolibarr < 17.0 - if (versioncompare(explode('.', DOL_VERSION), array(17)) < 0 && !class_exists('FormSetup')) { + // For retrocompatibility Dolibarr < 16.0 + if (floatval(DOL_VERSION) < 16.0 && !class_exists('FormSetup')) { require_once __DIR__.'/../backport/v17/core/class/html.formsetup.class.php'; } else { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsetup.class.php'; @@ -125,9 +125,9 @@ $formSetup->newItem('MYMODULE_MYPARAM6')->setAsSecureKey()->enabled = 0; // disa // Setup conf MYMODULE_MYPARAM7 $formSetup->newItem('MYMODULE_MYPARAM7')->setAsProduct(); - $formSetup->newItem('Title')->setAsTitle(); +// Setup conf MYMODULE_MYPARAM8 $item = $formSetup->newItem('MYMODULE_MYPARAM8'); $TField = array( 'test01' => $langs->trans('test01'), @@ -140,6 +140,11 @@ $TField = array( $item->setAsMultiSelect($TField); $item->helpText = $langs->transnoentities('MYMODULE_MYPARAM8'); + +// Setup conf MYMODULE_MYPARAM9 +$formSetup->newItem('MYMODULE_MYPARAM9')->setAsSelect($TField); + + $setupnotempty =+ count($formSetup->items); From 11da45646ed6ea5281da55f73680c3c3101efd80 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Sat, 21 May 2022 15:30:52 +0200 Subject: [PATCH 089/165] FIX signature online with proposal with n page. --- htdocs/core/ajax/onlineSign.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/core/ajax/onlineSign.php b/htdocs/core/ajax/onlineSign.php index ce9ae57864d..994ba5c42f3 100644 --- a/htdocs/core/ajax/onlineSign.php +++ b/htdocs/core/ajax/onlineSign.php @@ -129,8 +129,12 @@ if ($action == "importSignature") { $pdf->AddPage(); $pagecount = $pdf->setSourceFile($upload_dir.$ref.".pdf"); // original PDF - $tppl = $pdf->importPage(1); - $pdf->useTemplate($tppl); + for ($i=1;$i<($pagecount+1);$i++) { + if ($i>1) $pdf->AddPage(); + $tppl=$pdf->importPage($i); + $pdf->useTemplate($tppl); + } + $pdf->Image($upload_dir.$filename, 129, 239.6, 60, 15); // FIXME Position will be wrong with non A4 format. Use a value from width and height of page minus relative offset. $pdf->Close(); $pdf->Output($newpdffilename, "F"); From 2c2544d471b426eba03c23e92aa9c05f7c8a4533 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 21 May 2022 15:22:08 +0200 Subject: [PATCH 090/165] Fix scrutinizer --- htdocs/comm/propal/class/api_proposals.class.php | 12 ++++++++++-- htdocs/commande/class/api_orders.class.php | 10 ++++++++-- .../compta/facture/class/api_invoices.class.php | 16 ++++++++++++---- 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php index 9c8b3c653e6..258e264c5a7 100644 --- a/htdocs/comm/propal/class/api_proposals.class.php +++ b/htdocs/comm/propal/class/api_proposals.class.php @@ -135,8 +135,13 @@ class Proposals extends DolibarrApi } // Add external contacts ids. - $this->propal->contacts_ids = $this->propal->liste_contact(-1, 'external', $contact_list); + $tmparray = $this->propal->liste_contact(-1, 'external', $contact_list); + if (is_array($tmparray)) { + $this->propal->contacts_ids = $tmparray; + } + $this->propal->fetchObjectLinked(); + return $this->_cleanObjectDatas($this->propal); } @@ -228,7 +233,10 @@ class Proposals extends DolibarrApi $proposal_static = new Propal($this->db); if ($proposal_static->fetch($obj->rowid)) { // Add external contacts ids - $proposal_static->contacts_ids = $proposal_static->liste_contact(-1, 'external', 1); + $tmparray = $proposal_static->liste_contact(-1, 'external', 1); + if (is_array($tmparray)) { + $proposal_static->contacts_ids = $tmparray; + } $obj_ret[] = $this->_cleanObjectDatas($proposal_static); } $i++; diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index 2795c325fba..ac9ce98777d 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -133,7 +133,10 @@ class Orders extends DolibarrApi } // Add external contacts ids - $this->commande->contacts_ids = $this->commande->liste_contact(-1, 'external', $contact_list); + $tmparray = $this->commande->liste_contact(-1, 'external', $contact_list); + if (is_array($tmparray)) { + $this->commande->contacts_ids = $tmparray; + } $this->commande->fetchObjectLinked(); // Add online_payment_url, cf #20477 @@ -234,7 +237,10 @@ class Orders extends DolibarrApi $commande_static = new Commande($this->db); if ($commande_static->fetch($obj->rowid)) { // Add external contacts ids - $commande_static->contacts_ids = $commande_static->liste_contact(-1, 'external', 1); + $tmparray = $commande_static->liste_contact(-1, 'external', 1); + if (is_array($tmparray)) { + $commande_static->contacts_ids = $tmparray; + } // Add online_payment_url, cf #20477 require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; $commande_static->online_payment_url = getOnlinePaymentUrl(0, 'order', $commande_static->ref); diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 51fd8c1dd7a..3dababa3dc3 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -148,7 +148,10 @@ class Invoices extends DolibarrApi // Add external contacts ids if ($contact_list > -1) { - $this->invoice->contacts_ids = $this->invoice->liste_contact(-1, 'external', $contact_list); + $tmparray = $this->invoice->liste_contact(-1, 'external', $contact_list); + if(is_array($tmparray)) { + $this->invoice->contacts_ids = $tmparray; + } } $this->invoice->fetchObjectLinked(); @@ -267,8 +270,10 @@ class Invoices extends DolibarrApi $invoice_static->remaintopay = price2num($invoice_static->total_ttc - $invoice_static->totalpaid - $invoice_static->totalcreditnotes - $invoice_static->totaldeposits, 'MT'); // Add external contacts ids - $invoice_static->contacts_ids = $invoice_static->liste_contact(-1, 'external', 1); - + $tmparray = $invoice_static->liste_contact(-1, 'external', 1); + if (is_array($tmparray)) { + $invoice_static->contacts_ids = $tmparray; + } $obj_ret[] = $this->_cleanObjectDatas($invoice_static); } $i++; @@ -1768,7 +1773,10 @@ class Invoices extends DolibarrApi // Add external contacts ids if ($contact_list > -1) { - $this->template_invoice->contacts_ids = $this->template_invoice->liste_contact(-1, 'external', $contact_list); + $tmparray = $this->template_invoice->liste_contact(-1, 'external', $contact_list); + if (is_array($tmparray)) { + $this->template_invoice->contacts_ids = $tmparray; + } } $this->template_invoice->fetchObjectLinked(); From a65c4c2e057f5570b8614ad1b1223939a80050dc Mon Sep 17 00:00:00 2001 From: Sylvain Legrand Date: Sat, 21 May 2022 16:05:58 +0200 Subject: [PATCH 091/165] field ref_customer in llx_expedition is not varchar(255) #20629 --- htdocs/install/mysql/migration/15.0.0-16.0.0.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index 07a9856a1f9..6a57869bc0d 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -365,3 +365,5 @@ ALTER TABLE llx_c_email_template ADD COLUMN email_tocc varchar(255); ALTER TABLE llx_c_email_template ADD COLUMN email_tobcc varchar(255); ALTER TABLE llx_c_holiday_types ADD COLUMN sortorder smallint; + +ALTER TABLE llx_expedition MODIFY COLUMN ref_customer varchar(255); From 2b6154050ca5888f55e852424ac23960b1912632 Mon Sep 17 00:00:00 2001 From: Nicolas SILOBRE <45969285+ns-info90@users.noreply.github.com> Date: Sat, 21 May 2022 16:16:59 +0200 Subject: [PATCH 092/165] Fix : php warning 8 / backup --- htdocs/admin/tools/dolibarr_export.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index 36136aeef24..83d750e1209 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -257,7 +257,7 @@ if (in_array($type, array('mysql', 'mysqli'))) { } if ($execmethod == 1) { // If we use the "exec" method for shell, we ask if we need to use the alternative low memory exec mode. - print ''; + print ''; print ''; From 1b6e0a9fc0f05d5f6711a014218c9da039bb3584 Mon Sep 17 00:00:00 2001 From: IC-Ilies Date: Sat, 21 May 2022 16:25:47 +0200 Subject: [PATCH 093/165] FIX#20886 : manage durations in list_print_total.tpl.php --- htdocs/core/tpl/list_print_total.tpl.php | 9 ++++++++- htdocs/fichinter/list.php | 7 ++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/htdocs/core/tpl/list_print_total.tpl.php b/htdocs/core/tpl/list_print_total.tpl.php index 929ea2df50f..c103970a26d 100644 --- a/htdocs/core/tpl/list_print_total.tpl.php +++ b/htdocs/core/tpl/list_print_total.tpl.php @@ -13,7 +13,14 @@ if (isset($totalarray['pos'])) { while ($i < $totalarray['nbfield']) { $i++; if (!empty($totalarray['pos'][$i])) { - print ''.price(!empty($totalarray['val'][$totalarray['pos'][$i]])?$totalarray['val'][$totalarray['pos'][$i]]:0).''; + if(!empty($totalarray['type'][$i])){ + if($totalarray['type'][$i] == 'duration'){ + print ''.(!empty($totalarray['val'][$totalarray['pos'][$i]])? convertSecondToTime($totalarray['val'][$totalarray['pos'][$i]]): '00:00').''; + } + } + else { + print '' . price(!empty($totalarray['val'][$totalarray['pos'][$i]]) ? $totalarray['val'][$totalarray['pos'][$i]] : 0) . ''; + } } else { if ($i == 1) { if (is_null($limit) || $num < $limit) { diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index d710d7cd6cc..08c35e2b002 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -132,7 +132,7 @@ $arrayfields = array( 'f.fk_statut'=>array('label'=>'Status', 'checked'=>1, 'position'=>1000), 'fd.description'=>array('label'=>"DescriptionOfLine", 'checked'=>1, 'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS) ? 1 : 0), 'fd.date'=>array('label'=>'DateOfLine', 'checked'=>1, 'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS) ? 1 : 0), - 'fd.duree'=>array('label'=>'DurationOfLine', 'checked'=>1, 'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS) ? 1 : 0), + 'fd.duree'=>array('label'=>'DurationOfLine', 'type'=> 'duration', 'checked'=>1, 'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS) ? 1 : 0), //type duration is here because in database, column 'duree' is double ); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; @@ -737,9 +737,8 @@ if ($resql) { print ''.convertSecondToTime($obj->duree, 'allhourmin').''; if (!$i) { $totalarray['nbfield']++; - } - if (!$i) { $totalarray['pos'][$totalarray['nbfield']] = 'fd.duree'; + $totalarray['type'][$totalarray['nbfield']] = $arrayfields['fd.duree']['type']; //pass the type for the list_print_total.tpl.php to manage durations } $totalarray['val']['fd.duree'] += $obj->duree; } @@ -763,6 +762,8 @@ if ($resql) { $i++; } + + // Show total line include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; From cc904614828239b20ba86d6d998ecf0bdb65a099 Mon Sep 17 00:00:00 2001 From: Nicolas Domenech Date: Sat, 21 May 2022 16:28:32 +0200 Subject: [PATCH 094/165] Fix : Missing description field in function dol_dir_list_in_database --- htdocs/core/lib/files.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 5fc0d20777c..4e972b0be4e 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -272,7 +272,8 @@ function dol_dir_list_in_database($path, $filter = "", $excludefilter = null, $s "cover" => $obj->cover, "position" => (int) $obj->position, "acl" => $obj->acl, - "share" => $obj->share + "share" => $obj->share, + "description" => $obj->description ); } $i++; From 321195ef96b9f6c8d4757b09642e802e4f15d665 Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Sat, 21 May 2022 16:35:10 +0200 Subject: [PATCH 095/165] add color --- htdocs/core/class/html.formsetup.class.php | 83 ++++++++++++++++--- htdocs/modulebuilder/index.php | 2 +- htdocs/modulebuilder/template/admin/setup.php | 17 +++- 3 files changed, 90 insertions(+), 12 deletions(-) diff --git a/htdocs/core/class/html.formsetup.class.php b/htdocs/core/class/html.formsetup.class.php index 1ee9812f4fd..1cfddb588fd 100644 --- a/htdocs/core/class/html.formsetup.class.php +++ b/htdocs/core/class/html.formsetup.class.php @@ -422,7 +422,7 @@ class FormSetup if (!array($this->items)) { return false; } foreach ($this->items as $item) { - $item->reloadValueFromConf(); + $item->loadValueFromConf(); } return true; @@ -587,8 +587,11 @@ class FormSetupItem /** @var string $fieldValue */ public $fieldValue; + /** @var string $defaultFieldValue */ + public $defaultFieldValue = null; + /** @var array $fieldAttr fields attribute only for compatible fields like input text */ - public $fieldAttr; + public $fieldAttr = array(); /** @var bool|string set this var to override field output will override $fieldInputOverride and $fieldOutputOverride too */ public $fieldOverride = false; @@ -648,17 +651,33 @@ class FormSetupItem $this->entity = $conf->entity; $this->confKey = $confKey; - $this->fieldValue = $conf->global->{$this->confKey}; + $this->loadValueFromConf(); } /** - * reload conf value from databases - * @return null + * load conf value from databases + * @return bool + */ + public function loadValueFromConf() + { + global $conf; + if (isset($conf->global->{$this->confKey})) { + $this->fieldValue = $conf->global->{$this->confKey}; + return true; + } else { + $this->fieldValue = null; + return false; + } + } + + /** + * reload conf value from databases is an aliase of loadValueFromConf + * @deprecated + * @return bool */ public function reloadValueFromConf() { - global $conf; - $this->fieldValue = $conf->global->{$this->confKey}; + return $this->loadValueFromConf(); } @@ -791,6 +810,12 @@ class FormSetupItem return $this->fieldInputOverride; } + // Set default value + if (is_null($this->fieldValue)) { + $this->fieldValue = $this->defaultFieldValue; + } + + $this->fieldAttr['name'] = $this->confKey; $this->fieldAttr['id'] = 'setup-'.$this->confKey; $this->fieldAttr['value'] = $this->fieldValue; @@ -807,6 +832,8 @@ class FormSetupItem $out.= $this->generateInputFieldTextarea(); } elseif ($this->type== 'html') { $out.= $this->generateInputFieldHtml(); + } elseif ($this->type== 'color') { + $out.= $this->generateInputFieldColor(); } elseif ($this->type == 'yesno') { $out.= $this->form->selectyesno($this->confKey, $this->fieldValue, 1); } elseif (preg_match('/emailtemplate:/', $this->type)) { @@ -825,14 +852,22 @@ class FormSetupItem $out.= $this->form->select_produits($selected, $this->confKey, '', 0, 0, 1, 2, '', 0, array(), 0, '1', 0, $this->cssClass, 0, '', null, 1); } } else { - if (empty($this->fieldAttr)) { $this->fieldAttr['class'] = 'flat '.(empty($this->cssClass) ? 'minwidth200' : $this->cssClass); } - - $out.= 'fieldAttr).' />'; + $out.= $this->generateInputFieldText(); } return $out; } + /** + * generatec default input field + * @return string + */ + public function generateInputFieldText() + { + if (empty($this->fieldAttr)) { $this->fieldAttr['class'] = 'flat '.(empty($this->cssClass) ? 'minwidth200' : $this->cssClass); } + return 'fieldAttr).' />'; + } + /** * generate input field for textarea * @return string @@ -1029,6 +1064,8 @@ class FormSetupItem $out.= $this->generateOutputFieldSelect(); } elseif ($this->type== 'html') { $out.= $this->fieldValue; + } elseif ($this->type== 'color') { + $out.= $this->generateOutputFieldColor(); } elseif ($this->type == 'yesno') { $out.= ajax_constantonoff($this->confKey); } elseif (preg_match('/emailtemplate:/', $this->type)) { @@ -1102,6 +1139,22 @@ class FormSetupItem return $outPut; } + /** + * @return string + */ + public function generateOutputFieldColor() + { + $this->fieldAttr['disabled']=null; + return $this->generateInputField(); + } + /** + * @return string + */ + public function generateInputFieldColor() + { + $this->fieldAttr['type']= 'color'; + return $this->generateInputFieldText(); + } /** * @return string @@ -1130,6 +1183,16 @@ class FormSetupItem return $this; } + /** + * Set type of input as color + * @return self + */ + public function setAsColor() + { + $this->type = 'color'; + return $this; + } + /** * Set type of input as textarea * @return self diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 69163f94750..10a040ca7e5 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -240,7 +240,7 @@ if ($dirins && $action == 'initmodule' && $modulename) { // Copy last html.formsetup.class.php' to backport folder $tryToCopyFromSetupClass = true; - $backportDest = $destdir .'/backport/v17/core/class'; + $backportDest = $destdir .'/backport/v16/core/class'; $backportFileSrc = DOL_DOCUMENT_ROOT.'/core/class/html.formsetup.class.php'; $backportFileDest = $backportDest.'/html.formsetup.class.php'; $result = dol_mkdir($backportDest); diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php index 8128ba7ca52..1c46028b142 100644 --- a/htdocs/modulebuilder/template/admin/setup.php +++ b/htdocs/modulebuilder/template/admin/setup.php @@ -88,7 +88,7 @@ $useFormSetup = 1; if (!class_exists('FormSetup')) { // For retrocompatibility Dolibarr < 16.0 if (floatval(DOL_VERSION) < 16.0 && !class_exists('FormSetup')) { - require_once __DIR__.'/../backport/v17/core/class/html.formsetup.class.php'; + require_once __DIR__.'/../backport/v16/core/class/html.formsetup.class.php'; } else { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsetup.class.php'; } @@ -104,6 +104,7 @@ $item->cssClass = 'minwidth500'; // Setup conf MYMODULE_MYPARAM1 as a simple string input $item = $formSetup->newItem('MYMODULE_MYPARAM1'); +$item->defaultFieldValue = 'default value'; // Setup conf MYMODULE_MYPARAM1 as a simple textarea input but we replace the text of field title $item = $formSetup->newItem('MYMODULE_MYPARAM2'); @@ -145,6 +146,20 @@ $item->helpText = $langs->transnoentities('MYMODULE_MYPARAM8'); $formSetup->newItem('MYMODULE_MYPARAM9')->setAsSelect($TField); +// Setup conf MYMODULE_MYPARAM10 +$item = $formSetup->newItem('MYMODULE_MYPARAM10'); +$item->setAsColor(); +$item->defaultFieldValue = '#FF0000'; +$item->nameText = $item->getNameText().' more html text '; +$item->fieldInputOverride = ''; +$item->helpText = $langs->transnoentities('AnHelpMessage'); +//$item->fieldValue = ''; +//$item->fieldAttr = array() ; // fields attribute only for compatible fields like input text +//$item->fieldOverride = false; // set this var to override field output will override $fieldInputOverride and $fieldOutputOverride too +//$item->fieldInputOverride = false; // set this var to override field input +//$item->fieldOutputOverride = false; // set this var to override field output + + $setupnotempty =+ count($formSetup->items); From 3fc8adf13e8ea19aa3e7463ce87675a856b772dc Mon Sep 17 00:00:00 2001 From: Sylvain Legrand Date: Sat, 21 May 2022 16:42:27 +0200 Subject: [PATCH 096/165] missing MULTI CURRENCY on recurrent invoices #20664 --- htdocs/compta/facture/class/facture-rec.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 047a66a78b9..17facd188e3 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -1310,6 +1310,11 @@ class FactureRec extends CommonInvoice $facture->status = self::STATUS_DRAFT; $facture->date = (empty($facturerec->date_when) ? $now : $facturerec->date_when); // We could also use dol_now here but we prefer date_when so invoice has real date when we would like even if we generate later. $facture->socid = $facturerec->socid; + if (!empty($facturerec->fk_multicurrency)){ + $facture->fk_multicurrency = $facturerec->fk_multicurrency; + $facture->multicurrency_code = $facturerec->multicurrency_code; + $facture->multicurrency_tx = $facturerec->multicurrency_tx; + } $invoiceidgenerated = $facture->create($user); if ($invoiceidgenerated <= 0) { From bd42680e2ca5c3c4e3fd9778801f83959680c75e Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sat, 21 May 2022 14:43:30 +0000 Subject: [PATCH 097/165] Fixing style errors. --- htdocs/compta/facture/class/facture-rec.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 17facd188e3..63c2a1c687b 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -1310,7 +1310,7 @@ class FactureRec extends CommonInvoice $facture->status = self::STATUS_DRAFT; $facture->date = (empty($facturerec->date_when) ? $now : $facturerec->date_when); // We could also use dol_now here but we prefer date_when so invoice has real date when we would like even if we generate later. $facture->socid = $facturerec->socid; - if (!empty($facturerec->fk_multicurrency)){ + if (!empty($facturerec->fk_multicurrency)) { $facture->fk_multicurrency = $facturerec->fk_multicurrency; $facture->multicurrency_code = $facturerec->multicurrency_code; $facture->multicurrency_tx = $facturerec->multicurrency_tx; From 29dab3b6d10d3f9d675fa725c7ecf2ea35b69e00 Mon Sep 17 00:00:00 2001 From: Lucas Marcouiller Date: Sat, 21 May 2022 17:14:05 +0200 Subject: [PATCH 098/165] Fix : bug on check of main_not_installed --- htdocs/install/check.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/check.php b/htdocs/install/check.php index e9023b6389c..aba44fbe684 100644 --- a/htdocs/install/check.php +++ b/htdocs/install/check.php @@ -440,7 +440,7 @@ if (!file_exists($conffile)) { if (empty($dolibarr_main_db_host)) { // This means install process was not run $allowupgrade = false; } - if (defined("MAIN_NOT_INSTALLED")) { + if (getDolGlobalInt("MAIN_NOT_INSTALLED")) { $allowupgrade = false; } if (GETPOST('allowupgrade')) { From 9ea12664f72e9bed6b5ebf614ea99fa1cf2c2f16 Mon Sep 17 00:00:00 2001 From: IC-Ilies Date: Sat, 21 May 2022 17:14:26 +0200 Subject: [PATCH 099/165] FIX #20487 missing letter D in constant THIRDPARTIES_DISABLE_RELATED_OBJECT_TAB --- htdocs/core/lib/company.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index e98a25ddbee..6b3ced3e621 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -188,7 +188,7 @@ function societe_prepare_head(Societe $object) // Related items if ((!empty($conf->commande->enabled) || !empty($conf->propal->enabled) || !empty($conf->facture->enabled) || !empty($conf->ficheinter->enabled) || (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) - && empty($conf->global->THIRPARTIES_DISABLE_RELATED_OBJECT_TAB)) { + && empty($conf->global->THIRDPARTIES_DISABLE_RELATED_OBJECT_TAB)) { $head[$h][0] = DOL_URL_ROOT.'/societe/consumption.php?socid='.$object->id; $head[$h][1] = $langs->trans("Referers"); $head[$h][2] = 'consumption'; From d51b2f9164c19a04e29a6421d4f89d04f2d53138 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 21 May 2022 17:25:38 +0200 Subject: [PATCH 100/165] Fix migration --- htdocs/install/mysql/migration/15.0.0-16.0.0.sql | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index 07a9856a1f9..02c654dd518 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -30,10 +30,20 @@ -- -- VPGSQL8.2 SELECT dol_util_rebuild_sequences(); -ALTER TABLE llx_holiday ADD COLUMN nb_open_day double(24,8) DEFAULT NULL; -- Missing in v15 or lower +-- VMYSQL4.3 ALTER TABLE llx_c_civility CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT; + +ALTER TABLE llx_c_transport_mode ADD UNIQUE INDEX uk_c_transport_mode (code, entity); + +ALTER TABLE llx_c_shipment_mode MODIFY COLUMN tracking varchar(255) NULL; + +ALTER TABLE llx_holiday ADD COLUMN nb_open_day double(24,8) DEFAULT NULL; + +ALTER TABLE llx_element_tag ADD COLUMN fk_categorie INTEGER; + + insert into llx_c_type_resource (code, label, active) values ('RES_ROOMS', 'Rooms', 1); insert into llx_c_type_resource (code, label, active) values ('RES_CARS', 'Cars', 1); From f9ff16c6f3723bff44c3da61417a62cf02a9be4a Mon Sep 17 00:00:00 2001 From: IC-Ilies Date: Sat, 21 May 2022 17:33:03 +0200 Subject: [PATCH 101/165] fix psr2 --- htdocs/core/tpl/list_print_total.tpl.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/core/tpl/list_print_total.tpl.php b/htdocs/core/tpl/list_print_total.tpl.php index c103970a26d..09768f71ae4 100644 --- a/htdocs/core/tpl/list_print_total.tpl.php +++ b/htdocs/core/tpl/list_print_total.tpl.php @@ -13,12 +13,11 @@ if (isset($totalarray['pos'])) { while ($i < $totalarray['nbfield']) { $i++; if (!empty($totalarray['pos'][$i])) { - if(!empty($totalarray['type'][$i])){ - if($totalarray['type'][$i] == 'duration'){ + if (!empty($totalarray['type'][$i])) { + if ($totalarray['type'][$i] == 'duration') { print ''.(!empty($totalarray['val'][$totalarray['pos'][$i]])? convertSecondToTime($totalarray['val'][$totalarray['pos'][$i]]): '00:00').''; } - } - else { + } else { print '' . price(!empty($totalarray['val'][$totalarray['pos'][$i]]) ? $totalarray['val'][$totalarray['pos'][$i]] : 0) . ''; } } else { From 28540a85f21de86c6d730d191e5d678d8350f38b Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 21 May 2022 17:27:52 +0200 Subject: [PATCH 102/165] FIX php8 compatibility --- htdocs/compta/facture/card.php | 6 +++--- htdocs/compta/facture/contact.php | 2 +- htdocs/compta/facture/info.php | 2 +- htdocs/compta/facture/list.php | 4 ++-- htdocs/compta/facture/note.php | 2 +- htdocs/core/class/html.form.class.php | 12 ++++++------ 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index f2e57c8b536..adf76b0991e 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -142,9 +142,9 @@ if (!empty($conf->global->INVOICE_DISALLOW_REOPEN)) { $usercanunvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($usercancreate)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->facture->invoice_advance->unvalidate))); $usercanproductignorepricemin = ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)); -$usercancreatemargin = $user->rights->margins->creer; -$usercanreadallmargin = $user->rights->margins->liretous; -$usercancreatewithdrarequest = $user->rights->prelevement->bons->creer; +$usercancreatemargin = (!empty($user->rights->margins->creer) ? $user->rights->margins->creer : 0); +$usercanreadallmargin = (!empty($user->rights->margins->liretous) ? $user->rights->margins->liretous : 0); +$usercancreatewithdrarequest = (!empty($user->rights->prelevement->bons->creer) ? $user->rights->prelevement->bons->creer : 0); $permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc.php $permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php index 43897172779..f726baa4934 100644 --- a/htdocs/compta/facture/contact.php +++ b/htdocs/compta/facture/contact.php @@ -52,7 +52,7 @@ if ($user->socid) { $object = new Facture($db); // Load object if ($id > 0 || !empty($ref)) { - $ret = $object->fetch($id, $ref, '', '', $conf->global->INVOICE_USE_SITUATION); + $ret = $object->fetch($id, $ref, '', '', (!empty($conf->global->INVOICE_USE_SITUATION) ? $conf->global->INVOICE_USE_SITUATION : 0)); } $result = restrictedArea($user, 'facture', $object->id); diff --git a/htdocs/compta/facture/info.php b/htdocs/compta/facture/info.php index 60efaf36e3d..33dde25ca97 100644 --- a/htdocs/compta/facture/info.php +++ b/htdocs/compta/facture/info.php @@ -47,7 +47,7 @@ $extrafields->fetch_name_optionals_label($object->table_element); // Load object if ($id > 0 || !empty($ref)) { - $ret = $object->fetch($id, $ref, '', '', $conf->global->INVOICE_USE_SITUATION); + $ret = $object->fetch($id, $ref, '', '', (!empty($conf->global->INVOICE_USE_SITUATION) ? $conf->global->INVOICE_USE_SITUATION : 0)); } // Security check diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 5937eda916c..6fd1e2a7322 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -245,7 +245,7 @@ $arrayfields = array( 'f.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>292), 'multicurrency_dynamount_payed'=>array('label'=>'MulticurrencyAlreadyPaid', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>295), 'multicurrency_rtp'=>array('label'=>'MulticurrencyRemainderToPay', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>296), // Not enabled by default because slow - 'total_pa' => array('label' => ($conf->global->MARGIN_TYPE == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) ? 0 : 1)), + 'total_pa' => array('label' => ((isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == '1') ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) ? 0 : 1)), 'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) ? 0 : 1)), 'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)), 'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)), @@ -1112,7 +1112,7 @@ if ($resql) { if (!empty($user->rights->facture->paiement)) { $arrayofmassactions['makepayment'] = img_picto('', 'payment', 'class="pictofixedwidth"').$langs->trans("MakePaymentAndClassifyPayed"); } - if ($conf->prelevement->enabled && !empty($user->rights->prelevement->bons->creer)) { + if (!empty($conf->prelevement->enabled) && !empty($user->rights->prelevement->bons->creer)) { $langs->load("withdrawals"); $arrayofmassactions['withdrawrequest'] = img_picto('', 'payment', 'class="pictofixedwidth"').$langs->trans("MakeWithdrawRequest"); } diff --git a/htdocs/compta/facture/note.php b/htdocs/compta/facture/note.php index 6f699774d32..887a0281184 100644 --- a/htdocs/compta/facture/note.php +++ b/htdocs/compta/facture/note.php @@ -44,7 +44,7 @@ $action = GETPOST('action', 'aZ09'); $object = new Facture($db); // Load object if ($id > 0 || !empty($ref)) { - $object->fetch($id, $ref, '', '', $conf->global->INVOICE_USE_SITUATION); + $object->fetch($id, $ref, '', '', (!empty($conf->global->INVOICE_USE_SITUATION) ? $conf->global->INVOICE_USE_SITUATION : 0)); } $permissionnote = $user->rights->facture->creer; // Used by the include of actions_setnotes.inc.php diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 2df4f491105..e5aa1175dcc 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -8640,12 +8640,12 @@ class Form 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_customer as ref_client, t.ref_supplier, SUM(td.total_ht) as total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."contrat as t, ".$this->db->prefix()."contratdet as td WHERE t.fk_soc = s.rowid AND td.fk_contrat = t.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('contract').') GROUP BY s.rowid, s.nom, s.client, t.rowid, t.ref, t.ref_customer, t.ref_supplier' ), - 'fichinter'=>array('enabled'=>!empty($conf->ficheinter->enabled) ? $conf->ficheinter->enabled : 0, 'perms'=>1, 'label'=>'LinkToIntervention', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('intervention').')'), - 'supplier_proposal'=>array('enabled'=>$conf->supplier_proposal->enabled, 'perms'=>1, 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('supplier_proposal').')'), - 'order_supplier'=>array('enabled'=>$conf->supplier_order->enabled, 'perms'=>1, 'label'=>'LinkToSupplierOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande_fournisseur').')'), - 'invoice_supplier'=>array('enabled'=>$conf->supplier_invoice->enabled, 'perms'=>1, 'label'=>'LinkToSupplierInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('facture_fourn').')'), - 'ticket'=>array('enabled'=>$conf->ticket->enabled, 'perms'=>1, 'label'=>'LinkToTicket', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.track_id, '0' as total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."ticket as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('ticket').')'), - 'mo'=>array('enabled'=>$conf->mrp->enabled, 'perms'=>1, 'label'=>'LinkToMo', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.rowid, '0' as total_ht FROM ".$this->db->prefix()."societe as s INNER JOIN ".$this->db->prefix()."mrp_mo as t ON t.fk_soc = s.rowid WHERE t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('mo').')') + 'fichinter'=>array('enabled'=>(!empty($conf->ficheinter->enabled) ? $conf->ficheinter->enabled : 0), 'perms'=>1, 'label'=>'LinkToIntervention', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('intervention').')'), + 'supplier_proposal'=>array('enabled'=>(!empty($conf->supplier_proposal->enabled) ? $conf->supplier_proposal->enabled : 0), 'perms'=>1, 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('supplier_proposal').')'), + 'order_supplier'=>array('enabled'=>(!empty($conf->supplier_order->enabled) ? $conf->supplier_order->enabled : 0), 'perms'=>1, 'label'=>'LinkToSupplierOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande_fournisseur').')'), + 'invoice_supplier'=>array('enabled'=>(!empty($conf->supplier_invoice->enabled) ? $conf->supplier_invoice->enabled : 0), 'perms'=>1, 'label'=>'LinkToSupplierInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('facture_fourn').')'), + 'ticket'=>array('enabled'=>(!empty($conf->ticket->enabled) ? $conf->ticket->enabled : 0), 'perms'=>1, 'label'=>'LinkToTicket', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.track_id, '0' as total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."ticket as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('ticket').')'), + 'mo'=>array('enabled'=>(!empty($conf->mrp->enabled) ? $conf->mrp->enabled : 0), 'perms'=>1, 'label'=>'LinkToMo', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.rowid, '0' as total_ht FROM ".$this->db->prefix()."societe as s INNER JOIN ".$this->db->prefix()."mrp_mo as t ON t.fk_soc = s.rowid WHERE t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('mo').')') ); } From 426d8912a7926229a37cab016d2f66a38e3b719e Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 21 May 2022 17:40:14 +0200 Subject: [PATCH 103/165] fix : The property chid does not seem to exist on PaymentSocialContribution --- .../sociales/class/paymentsocialcontribution.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index b6a611a47ee..c6a4851fac1 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -100,6 +100,11 @@ class PaymentSocialContribution extends CommonObject */ public $fk_user_modif; + /** + * @var int ID + */ + public $chid; + /** * Constructor * From c9e812d5ef4f67c24b2c97ebd33f928605ed8554 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 21 May 2022 17:47:25 +0200 Subject: [PATCH 104/165] fix : The property datepaye does not exist on PaymentSocialContribution --- .../sociales/class/paymentsocialcontribution.class.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index c6a4851fac1..23b180da103 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -105,6 +105,12 @@ class PaymentSocialContribution extends CommonObject */ public $chid; + /** + * @var integer|string datepaye + */ + public $datepaye; + + /** * Constructor * From 604a4670e083b12ccc2066089e4bc6e082b75129 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 21 May 2022 17:50:43 +0200 Subject: [PATCH 105/165] fix : The property does not exist on PaymentSocialContribution --- .../sociales/class/paymentsocialcontribution.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index 23b180da103..1b83915714d 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -110,6 +110,11 @@ class PaymentSocialContribution extends CommonObject */ public $datepaye; + /** + * @var integer|string paiementtype + */ + public $paiementtype; + /** * Constructor From bff81ce9bb493e066f555cdb99da00a758896867 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 21 May 2022 18:02:48 +0200 Subject: [PATCH 106/165] fix : The property does not exist on ChargeSociales --- htdocs/compta/sociales/class/chargesociales.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index 70d8da4c27b..41e036ae937 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -113,6 +113,11 @@ class ChargeSociales extends CommonObject */ public $fk_user; + /** + * @var double total + */ + public $total; + const STATUS_UNPAID = 0; const STATUS_PAID = 1; From 8ba445b27c08ad8e4fc53fdc8f649d72d82755cb Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 21 May 2022 18:11:34 +0200 Subject: [PATCH 107/165] fix : The property am does not seem to exist on ChargeSociales --- htdocs/compta/paiement_charge.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index 640ffc78d99..db48b2767f2 100644 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -291,7 +291,7 @@ if ($action == 'create') { print "\n"; $total += $objp->total; $total_ttc += $objp->total_ttc; - $totalrecu += $objp->am; + $totalrecu += $objp->amount; $i++; } if ($i > 1) { From 7cf97cfb93bc5677854f0cd4f4ee43a78a6f9e35 Mon Sep 17 00:00:00 2001 From: Nicolas SILOBRE <45969285+ns-info90@users.noreply.github.com> Date: Sat, 21 May 2022 18:15:44 +0200 Subject: [PATCH 108/165] FIX: warning Php 8 --- htdocs/core/class/html.formfile.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index cbaf59bd311..0e622f897f0 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1330,7 +1330,7 @@ class FormFile if ($file['name'] != '.' && $file['name'] != '..' && !preg_match('/\.meta$/i', $file['name'])) { - if ($filearray[$key]['rowid'] > 0) { + if (array_key_exists('rowid',$filearray[$key]) && $filearray[$key]['rowid'] > 0) { $lastrowid = $filearray[$key]['rowid']; } $filepath = $relativepath.$file['name']; @@ -1339,8 +1339,8 @@ class FormFile $nboflines++; print ''."\n"; // Do we have entry into database ? - print ''."\n"; - print ''; + print ''."\n"; + print ''; // File name print ''; From cc7cc8bb5f1cd734df668cb1a447c71607b272f9 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 21 May 2022 18:18:31 +0200 Subject: [PATCH 109/165] FIX avoid stickler error : Line exceeds 500 characters --- htdocs/core/class/html.form.class.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index e5aa1175dcc..e97fea1d4cb 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -8641,9 +8641,18 @@ class Form FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."contrat as t, ".$this->db->prefix()."contratdet as td WHERE t.fk_soc = s.rowid AND td.fk_contrat = t.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('contract').') GROUP BY s.rowid, s.nom, s.client, t.rowid, t.ref, t.ref_customer, t.ref_supplier' ), 'fichinter'=>array('enabled'=>(!empty($conf->ficheinter->enabled) ? $conf->ficheinter->enabled : 0), 'perms'=>1, 'label'=>'LinkToIntervention', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('intervention').')'), - 'supplier_proposal'=>array('enabled'=>(!empty($conf->supplier_proposal->enabled) ? $conf->supplier_proposal->enabled : 0), 'perms'=>1, 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('supplier_proposal').')'), - 'order_supplier'=>array('enabled'=>(!empty($conf->supplier_order->enabled) ? $conf->supplier_order->enabled : 0), 'perms'=>1, 'label'=>'LinkToSupplierOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande_fournisseur').')'), - 'invoice_supplier'=>array('enabled'=>(!empty($conf->supplier_invoice->enabled) ? $conf->supplier_invoice->enabled : 0), 'perms'=>1, 'label'=>'LinkToSupplierInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('facture_fourn').')'), + 'supplier_proposal'=>array( + 'enabled'=>(!empty($conf->supplier_proposal->enabled) ? $conf->supplier_proposal->enabled : 0), + 'perms'=>1, 'label'=>'LinkToSupplierProposal', + 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('supplier_proposal').')'), + 'order_supplier'=>array( + 'enabled'=>(!empty($conf->supplier_order->enabled) ? $conf->supplier_order->enabled : 0), + 'perms'=>1, 'label'=>'LinkToSupplierOrder', + 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande_fournisseur').')'), + 'invoice_supplier'=>array( + 'enabled'=>(!empty($conf->supplier_invoice->enabled) ? $conf->supplier_invoice->enabled : 0), + 'perms'=>1, 'label'=>'LinkToSupplierInvoice', + 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('facture_fourn').')'), 'ticket'=>array('enabled'=>(!empty($conf->ticket->enabled) ? $conf->ticket->enabled : 0), 'perms'=>1, 'label'=>'LinkToTicket', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.track_id, '0' as total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."ticket as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('ticket').')'), 'mo'=>array('enabled'=>(!empty($conf->mrp->enabled) ? $conf->mrp->enabled : 0), 'perms'=>1, 'label'=>'LinkToMo', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.rowid, '0' as total_ht FROM ".$this->db->prefix()."societe as s INNER JOIN ".$this->db->prefix()."mrp_mo as t ON t.fk_soc = s.rowid WHERE t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('mo').')') ); From 019a68b3bb656edb9dbbaa8e0a2b1fbb79c746c5 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 21 May 2022 18:25:07 +0200 Subject: [PATCH 110/165] FIX clean code --- htdocs/core/class/html.form.class.php | 48 ++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 9 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index e97fea1d4cb..31f69878dda 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -8629,10 +8629,26 @@ class Form } $possiblelinks = array( - 'propal'=>array('enabled'=>$conf->propal->enabled, 'perms'=>1, 'label'=>'LinkToProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('propal').')'), - 'order'=>array('enabled'=>$conf->commande->enabled, 'perms'=>1, 'label'=>'LinkToOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande').')'), - 'invoice'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'), - 'invoice_template'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToTemplateInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.titre as ref, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture_rec as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'), + 'propal'=>array( + 'enabled'=>$conf->propal->enabled, + 'perms'=>1, + 'label'=>'LinkToProposal', + 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('propal').')'), + 'order'=>array( + 'enabled'=>$conf->commande->enabled, + 'perms'=>1, + 'label'=>'LinkToOrder', + 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande').')'), + 'invoice'=>array( + 'enabled'=>$conf->facture->enabled, + 'perms'=>1, + 'label'=>'LinkToInvoice', + 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'), + 'invoice_template'=>array( + 'enabled'=>$conf->facture->enabled, + 'perms'=>1, + 'label'=>'LinkToTemplateInvoice', + 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.titre as ref, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture_rec as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'), 'contrat'=>array( 'enabled'=>$conf->contrat->enabled, 'perms'=>1, @@ -8640,21 +8656,35 @@ class Form 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_customer as ref_client, t.ref_supplier, SUM(td.total_ht) as total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."contrat as t, ".$this->db->prefix()."contratdet as td WHERE t.fk_soc = s.rowid AND td.fk_contrat = t.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('contract').') GROUP BY s.rowid, s.nom, s.client, t.rowid, t.ref, t.ref_customer, t.ref_supplier' ), - 'fichinter'=>array('enabled'=>(!empty($conf->ficheinter->enabled) ? $conf->ficheinter->enabled : 0), 'perms'=>1, 'label'=>'LinkToIntervention', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('intervention').')'), + 'fichinter'=>array( + 'enabled'=>(!empty($conf->ficheinter->enabled) ? $conf->ficheinter->enabled : 0), + 'perms'=>1, + 'label'=>'LinkToIntervention', + 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('intervention').')'), 'supplier_proposal'=>array( 'enabled'=>(!empty($conf->supplier_proposal->enabled) ? $conf->supplier_proposal->enabled : 0), - 'perms'=>1, 'label'=>'LinkToSupplierProposal', + 'perms'=>1, + 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('supplier_proposal').')'), 'order_supplier'=>array( 'enabled'=>(!empty($conf->supplier_order->enabled) ? $conf->supplier_order->enabled : 0), - 'perms'=>1, 'label'=>'LinkToSupplierOrder', + 'perms'=>1, + 'label'=>'LinkToSupplierOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande_fournisseur').')'), 'invoice_supplier'=>array( 'enabled'=>(!empty($conf->supplier_invoice->enabled) ? $conf->supplier_invoice->enabled : 0), 'perms'=>1, 'label'=>'LinkToSupplierInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('facture_fourn').')'), - 'ticket'=>array('enabled'=>(!empty($conf->ticket->enabled) ? $conf->ticket->enabled : 0), 'perms'=>1, 'label'=>'LinkToTicket', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.track_id, '0' as total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."ticket as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('ticket').')'), - 'mo'=>array('enabled'=>(!empty($conf->mrp->enabled) ? $conf->mrp->enabled : 0), 'perms'=>1, 'label'=>'LinkToMo', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.rowid, '0' as total_ht FROM ".$this->db->prefix()."societe as s INNER JOIN ".$this->db->prefix()."mrp_mo as t ON t.fk_soc = s.rowid WHERE t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('mo').')') + 'ticket'=>array( + 'enabled'=>(!empty($conf->ticket->enabled) ? $conf->ticket->enabled : 0), + 'perms'=>1, + 'label'=>'LinkToTicket', + 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.track_id, '0' as total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."ticket as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('ticket').')'), + 'mo'=>array( + 'enabled'=>(!empty($conf->mrp->enabled) ? $conf->mrp->enabled : 0), + 'perms'=>1, + 'label'=>'LinkToMo', + 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.rowid, '0' as total_ht FROM ".$this->db->prefix()."societe as s INNER JOIN ".$this->db->prefix()."mrp_mo as t ON t.fk_soc = s.rowid WHERE t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('mo').')') ); } From aa313f23ad5362dc1b3e8dab6c08dd0ffd9b08a0 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sat, 21 May 2022 16:26:20 +0000 Subject: [PATCH 111/165] Fixing style errors. --- htdocs/core/class/html.formfile.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 0e622f897f0..cb8c70f6e49 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1330,7 +1330,7 @@ class FormFile if ($file['name'] != '.' && $file['name'] != '..' && !preg_match('/\.meta$/i', $file['name'])) { - if (array_key_exists('rowid',$filearray[$key]) && $filearray[$key]['rowid'] > 0) { + if (array_key_exists('rowid', $filearray[$key]) && $filearray[$key]['rowid'] > 0) { $lastrowid = $filearray[$key]['rowid']; } $filepath = $relativepath.$file['name']; @@ -1339,8 +1339,8 @@ class FormFile $nboflines++; print ''."\n"; // Do we have entry into database ? - print ''."\n"; - print ''; + print ''."\n"; + print ''; // File name print ''; From 51041bbea1523c424a504eeafda80fa167abe7a0 Mon Sep 17 00:00:00 2001 From: Lucas Marcouiller Date: Sat, 21 May 2022 18:46:41 +0200 Subject: [PATCH 112/165] Fix : php 8.0 warnings --- htdocs/core/class/commonobject.class.php | 2 +- htdocs/fourn/facture/card.php | 30 ++++++++++++------------ htdocs/projet/card.php | 2 ++ htdocs/projet/tasks.php | 2 +- htdocs/user/list.php | 1 + 5 files changed, 20 insertions(+), 17 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 14bca386018..13bf93e2de4 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -8819,7 +8819,7 @@ abstract class CommonObject } } } else { - $this->{$field} = $obj->{$field}; + $this->{$field} = !empty($obj->{$field}) ? $obj->{$field} : null; } } diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 287327f2a6a..408d70f3468 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1974,10 +1974,10 @@ if ($action == 'create') { $objectsrc->fetch_optionals(); $object->array_options = $objectsrc->array_options; } else { - $cond_reglement_id = $societe->cond_reglement_supplier_id; - $mode_reglement_id = $societe->mode_reglement_supplier_id; - $transport_mode_id = $societe->transport_mode_supplier_id; - $fk_account = $societe->fk_account; + $cond_reglement_id = !empty($societe->cond_reglement_supplier_id) ? $societe->cond_reglement_supplier_id : 0; + $mode_reglement_id = !empty($societe->mode_reglement_supplier_id) ? $societe->mode_reglement_supplier_id : 0; + $transport_mode_id = !empty($societe->transport_mode_supplier_id) ? $societe->transport_mode_supplier_id : 0; + $fk_account = !empty($societe->fk_account) ? $societe->fk_account : 0; $datetmp = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); $dateinvoice = ($datetmp == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : '') : $datetmp); $datetmp = dol_mktime(12, 0, 0, GETPOST('echmonth', 'int'), GETPOST('echday', 'int'), GETPOST('echyear', 'int')); @@ -2004,7 +2004,7 @@ if ($action == 'create') { print '
    '; print ''; print ''; - if ($societe->id > 0) { + if (!empty($societe->id) && $societe->id > 0) { print ''."\n"; } print ''; @@ -2030,12 +2030,12 @@ if ($action == 'create') { print ''.$langs->trans('Supplier').''; print ''; - if ($societe->id > 0 && ($fac_recid <= 0 || !empty($invoice_predefined->frequency))) { + if (!empty($societe->id) && $societe->id > 0 && ($fac_recid <= 0 || !empty($invoice_predefined->frequency))) { $absolute_discount = $societe->getAvailableDiscounts('', '', 0, 1); print $societe->getNomUrl(1, 'supplier'); print ''; } else { - print img_picto('', 'company').$form->select_company($societe->id, 'socid', 's.fournisseur=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300 widthcentpercentminusxx maxwidth500'); + print img_picto('', 'company').$form->select_company(!empty($societe->id) ? $societe->id : 0, 'socid', 's.fournisseur=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300 widthcentpercentminusxx maxwidth500'); // reload page to retrieve supplier informations if (!empty($conf->global->RELOAD_PAGE_ON_SUPPLIER_CHANGE)) { print '