From 192e62fa5c00e5d82d831aa377c2916e41849806 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Mon, 21 Feb 2022 15:41:41 +0100 Subject: [PATCH 01/34] 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 02/34] 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 03/34] 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 04/34] 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 05/34] 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 06/34] 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 07/34] 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 08/34] 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 09/34] 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 10/34] 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 11/34] 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 12/34] 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 13/34] 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 14/34] 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 61f7c4395b7bf598223c5dc1c6385d0cb6e5f1cc Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 17 May 2022 11:55:57 +0200 Subject: [PATCH 15/34] fix: module builder template bad error message affactation --- htdocs/modulebuilder/template/admin/setup.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php index fe92596d228..e94a2678b4a 100644 --- a/htdocs/modulebuilder/template/admin/setup.php +++ b/htdocs/modulebuilder/template/admin/setup.php @@ -436,7 +436,7 @@ if ($action == 'edit') { if ($resprod > 0) { print $product->ref; } elseif ($resprod < 0) { - setEventMessages(null, $object->errors, "errors"); + setEventMessages(null, $product->errors, "errors"); } } else { print $conf->global->{$constname}; From 978db41f37cd61ef59b0d4a8f383b6c024d899b1 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Tue, 17 May 2022 15:50:45 +0200 Subject: [PATCH 16/34] 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 17/34] 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 18/34] 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 c2ee562c89c34a9cd5d992cb9754f1bb09fae54c Mon Sep 17 00:00:00 2001 From: atm-greg Date: Wed, 18 May 2022 14:47:12 +0200 Subject: [PATCH 19/34] add missing CMailFile class requirement --- htdocs/core/actions_massactions.inc.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 703fd5d4771..5e803ae3cdf 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1656,6 +1656,7 @@ if (!$error && ($massaction == 'approveleave' || ($action == 'approveleave' && $ $trackid = 'leav'.$objecttmp->id; + require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; $mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 0, '', '', $trackid); // Sending email From b5ff8475723a26f85a7e59dcc43c8cca12dcb50b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 May 2022 22:48:44 +0200 Subject: [PATCH 20/34] Prepare 15.0.3 --- htdocs/filefunc.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 3d03730f9ba..ffc5b7e79de 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -34,7 +34,7 @@ if (!defined('DOL_APPLICATION_TITLE')) { define('DOL_APPLICATION_TITLE', 'Dolibarr'); } if (!defined('DOL_VERSION')) { - define('DOL_VERSION', '15.0.2'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c + define('DOL_VERSION', '15.0.3'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c } if (!defined('EURO')) { From 3d734e8d34aec40ea22051f99b5e9bad79c67ffa Mon Sep 17 00:00:00 2001 From: daraelmin Date: Fri, 20 May 2022 09:22:16 +0200 Subject: [PATCH 21/34] FIX regression PR #20713 Please do not revert with PR #20900 --- htdocs/accountancy/class/bookkeeping.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 5635df3c8e7..5f3def1d3ee 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -1857,7 +1857,7 @@ class BookKeeping extends CommonObject $sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,'; $sql .= ' numero_compte, label_compte, label_operation, debit, credit,'; $sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, '.$next_piecenum.", '".$this->db->idate($now)."'"; - $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity); + $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND numero_compte IS NOT NULL AND entity = ' .((int) $conf->entity); $resql = $this->db->query($sql); if (!$resql) { $error++; From 9a1aa0d5ea71ab8d5f7f9b2f057aefb39ad7dfc4 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Fri, 20 May 2022 17:14:30 +0200 Subject: [PATCH 22/34] FIX Warning on attribut --- htdocs/core/class/CMailFile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index a8986475095..d76f75d8ea5 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -592,7 +592,7 @@ class CMailFile } $sendingmode = $this->sendmode; - if ($this->context == 'emailing' && !empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail') { + if ($this->sendcontext == 'emailing' && !empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail') { // List of sending methods $listofmethods = array(); $listofmethods['mail'] = 'PHP mail function'; From 56d6dd06038a3fd193f239470891e80e81498cf6 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 20 May 2022 17:34:37 +0200 Subject: [PATCH 23/34] FIX scrutinizer --- htdocs/core/class/fileupload.class.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/fileupload.class.php b/htdocs/core/class/fileupload.class.php index ea8618c8b92..552670cc12c 100644 --- a/htdocs/core/class/fileupload.class.php +++ b/htdocs/core/class/fileupload.class.php @@ -1,4 +1,6 @@ * Copyright (C) 2011-2012 Laurent Destailleur * @@ -216,7 +218,7 @@ class FileUpload /** * Set delete url * - * @param string $file Filename + * @param object $file Filename * @return void */ protected function setFileDeleteUrl($file) @@ -301,7 +303,7 @@ class FileUpload * Enter description here ... * * @param string $uploaded_file Uploade file - * @param string $file File + * @param object $file File * @param string $error Error * @param string $index Index * @return boolean True if OK, False if KO @@ -538,7 +540,7 @@ class FileUpload /** * Delete uploaded file * - * @return void + * @return string */ public function delete() { From 334baeffaaf3e086e71be07b44c5579270abcb8b Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 20 May 2022 17:37:36 +0200 Subject: [PATCH 24/34] FIX syntax error --- htdocs/core/class/fileupload.class.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/core/class/fileupload.class.php b/htdocs/core/class/fileupload.class.php index 552670cc12c..8e325fd13e2 100644 --- a/htdocs/core/class/fileupload.class.php +++ b/htdocs/core/class/fileupload.class.php @@ -1,7 +1,5 @@ +/* Copyright (C) 2011-2022 Regis Houssin * Copyright (C) 2011-2012 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify From a302ffa5fb191aba4e61bf6d779ee5983a5a8581 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 20 May 2022 17:51:16 +0200 Subject: [PATCH 25/34] FIX wrong var name --- htdocs/compta/facture/prelevement.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 583626f0220..989fa28b2f0 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -281,8 +281,8 @@ if ($object->id > 0) { } $author = new User($db); - if ($object->user_author) { - $author->fetch($object->user_author); + if ($object->fk_user_author) { + $author->fetch($object->fk_user_author); } if ($type == 'bank-transfer') { From c08c86a9d8bcb5891e8f142f07f8f4d5735b3062 Mon Sep 17 00:00:00 2001 From: IC-Ilies Date: Fri, 20 May 2022 17:52:53 +0200 Subject: [PATCH 26/34] FIX #20828 --- htdocs/fichinter/card-rec.php | 7 ++++--- htdocs/fichinter/class/fichinter.class.php | 1 - htdocs/fichinter/class/fichinterrec.class.php | 5 +---- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/htdocs/fichinter/card-rec.php b/htdocs/fichinter/card-rec.php index 260bff00016..0dd1c4c2d4d 100644 --- a/htdocs/fichinter/card-rec.php +++ b/htdocs/fichinter/card-rec.php @@ -166,7 +166,7 @@ if ($action == 'add') { // on récupère les enregistrements $object->fetch($id); - + $res = $object->fetch_lines(); // on transfert les données de l'un vers l'autre if ($object->socid > 0) { $newinter->socid = $object->socid; @@ -178,6 +178,7 @@ if ($action == 'add') { $newinter->entity = $object->entity; $newinter->duree = $object->duree; + $newinter->datei = $object->date; $newinter->description = $object->description; $newinter->note_private = $object->note_private; @@ -194,7 +195,7 @@ if ($action == 'add') { if ($newfichinterid > 0) { // Now we add line of details foreach ($object->lines as $line) { - $newinter->addline($user, $newfichinterid, $line->desc, '', $line->duree, ''); + $newinter->addline($user, $newfichinterid, $line->desc, $line->datei, $line->duree, ''); } // on update le nombre d'inter crée à partir du modèle @@ -743,7 +744,7 @@ if ($action == 'create') { print ''; + print $langs->trans("AddIntervention").'
'; } 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 27/34] 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 b21facc3db4d667a99dd4f16f2a22b82f3af8c30 Mon Sep 17 00:00:00 2001 From: Norbert Penel Date: Fri, 20 May 2022 19:32:27 +0200 Subject: [PATCH 28/34] 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 29/34] 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 98af6f8606203dcf9d35f203e555b08005553b64 Mon Sep 17 00:00:00 2001 From: Lucas Marcouiller Date: Fri, 20 May 2022 22:01:39 +0200 Subject: [PATCH 30/34] 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 31/34] 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 32/34] 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 33/34] 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 96613424226545a699c9bbf280da878623996a3a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 20 May 2022 23:00:25 +0200 Subject: [PATCH 34/34] 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').'';