From 6b264733e44dcb6d3cbac58243fb52b9e66b7548 Mon Sep 17 00:00:00 2001 From: BB2A Anthony Berton Date: Fri, 15 Apr 2022 11:21:02 +0200 Subject: [PATCH 1/7] Move-checkbox-column-as-first-column-on-modulebuilder --- .../modulebuilder/template/myobject_list.php | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 0ecd42bda26..5317c581952 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -536,7 +536,7 @@ if (!empty($moreforfilter)) { } $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; -$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, 'left'); // This also change content of $arrayfields $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table @@ -546,6 +546,11 @@ print ''; +// Action column +print ''; foreach ($object->fields as $key => $val) { $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); if ($key == 'status') { @@ -590,11 +595,6 @@ print $hookmanager->resPrint; /*if (!empty($arrayfields['anotherfield']['checked'])) { print ''; }*/ -// Action column -print ''; print ''."\n"; $totalarray = array(); @@ -603,6 +603,7 @@ $totalarray['nbfield'] = 0; // Fields title label // -------------------------------------------------------------------- print ''; +print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; foreach ($object->fields as $key => $val) { $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); if ($key == 'status') { @@ -630,7 +631,6 @@ print $hookmanager->resPrint; $totalarray['nbfield']++; }*/ // Action column -print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; $totalarray['nbfield']++; print ''."\n"; @@ -676,6 +676,16 @@ while ($i < $imaxinloop) { // Show here line of result $j = 0; print ''; + // Action column + print ''; foreach ($object->fields as $key => $val) { $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { @@ -731,16 +741,6 @@ while ($i < $imaxinloop) { /*if (!empty($arrayfields['anotherfield']['checked'])) { print ''; }*/ - // Action column - print ''; if (!$i) { $totalarray['nbfield']++; } From 4688b96d93a52c1ef95bcf7ff1d20d26ae74d1b3 Mon Sep 17 00:00:00 2001 From: BB2A Anthony Berton Date: Fri, 15 Apr 2022 15:19:14 +0200 Subject: [PATCH 2/7] Add option MAIN_CHECKBOX_LEFT_COLUMN --- .../modulebuilder/template/myobject_list.php | 60 ++++++++++++++----- 1 file changed, 46 insertions(+), 14 deletions(-) diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 5317c581952..8a3b65af292 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -536,8 +536,12 @@ if (!empty($moreforfilter)) { } $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; -$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, 'left'); // This also change content of $arrayfields -$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); +if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, 'left'); // This also change content of $arrayfields +} else { + $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +} + $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print '
'; +$searchpicto = $form->showFilterButtons('left'); +print $searchpicto; +print ''; -$searchpicto = $form->showFilterButtons(); -print $searchpicto; -print '
'; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($object->id, $arrayofselected)) { + $selected = 1; + } + print ''; + } + print ''.$obj->anotherfield.''; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($object->id, $arrayofselected)) { - $selected = 1; - } - print ''; - } - print '
'."\n"; @@ -547,10 +551,12 @@ print '
'; // Action column -print ''; +if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; +} foreach ($object->fields as $key => $val) { $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); if ($key == 'status') { @@ -595,6 +601,13 @@ print $hookmanager->resPrint; /*if (!empty($arrayfields['anotherfield']['checked'])) { print ''; }*/ +// Action column +if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; +} print ''."\n"; $totalarray = array(); @@ -603,7 +616,9 @@ $totalarray['nbfield'] = 0; // Fields title label // -------------------------------------------------------------------- print ''; -print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; +if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; +} foreach ($object->fields as $key => $val) { $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); if ($key == 'status') { @@ -631,6 +646,9 @@ print $hookmanager->resPrint; $totalarray['nbfield']++; }*/ // Action column +if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; +} $totalarray['nbfield']++; print ''."\n"; @@ -677,15 +695,17 @@ while ($i < $imaxinloop) { $j = 0; print ''; // Action column - print ''; } - print ''; foreach ($object->fields as $key => $val) { $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { @@ -741,6 +761,18 @@ while ($i < $imaxinloop) { /*if (!empty($arrayfields['anotherfield']['checked'])) { print ''; }*/ + // Action column + if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + } if (!$i) { $totalarray['nbfield']++; } From ff696acab821791441aa157c2abe555301f6e50e Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Wed, 4 May 2022 08:43:14 +0200 Subject: [PATCH 3/7] Update myobject_list.php --- htdocs/modulebuilder/template/myobject_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 8a3b65af292..8dd614bd227 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -536,7 +536,7 @@ if (!empty($moreforfilter)) { } $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; -if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { +if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, 'left'); // This also change content of $arrayfields } else { $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields From 2467dd06151ac320d054b1427148260678813a3b Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 4 May 2022 09:18:46 +0200 Subject: [PATCH 4/7] fix : do not display html tags into list --- htdocs/commande/list.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 5a85038bddc..e1a08d47f3f 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -2290,8 +2290,8 @@ if ($resql) { // Note public if (!empty($arrayfields['c.note_public']['checked'])) { - print ''; if (!$i) { $totalarray['nbfield']++; @@ -2300,8 +2300,8 @@ if ($resql) { // Note private if (!empty($arrayfields['c.note_private']['checked'])) { - print ''; if (!$i) { $totalarray['nbfield']++; From 0fd2e91ccc127f2a0791e2e9eb57504acba0d025 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Wed, 4 May 2022 14:37:54 +0200 Subject: [PATCH 5/7] Fix : extrafields attrname regex --- htdocs/core/actions_extrafields.inc.php | 2 +- htdocs/core/tpl/admin_extrafields_add.tpl.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/actions_extrafields.inc.php b/htdocs/core/actions_extrafields.inc.php index 48e52316faf..7a7ab380e29 100644 --- a/htdocs/core/actions_extrafields.inc.php +++ b/htdocs/core/actions_extrafields.inc.php @@ -147,7 +147,7 @@ if ($action == 'add') { if (!$error) { // attrname must be alphabetical and lower case only - if (GETPOSTISSET("attrname") && preg_match("/^[a-z0-9-_]+$/", GETPOST('attrname', 'aZ09')) && !is_numeric(GETPOST('attrname', 'aZ09'))) { + if (GETPOSTISSET("attrname") && preg_match("/^[a-z0-9_]+$/", GETPOST('attrname', 'aZ09')) && !is_numeric(GETPOST('attrname', 'aZ09'))) { // Construct array for parameter (value of select list) $default_value = GETPOST('default_value', 'alpha'); $parameters = $param; diff --git a/htdocs/core/tpl/admin_extrafields_add.tpl.php b/htdocs/core/tpl/admin_extrafields_add.tpl.php index 438e3d3f93e..1dbc0861adb 100644 --- a/htdocs/core/tpl/admin_extrafields_add.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_add.tpl.php @@ -147,7 +147,7 @@ $listofexamplesforlink = 'Societe:societe/class/societe.class.php
Contact:con
- +
'; -$searchpicto = $form->showFilterButtons('left'); -print $searchpicto; -print ''; + $searchpicto = $form->showFilterButtons('left'); + print $searchpicto; + print ''; + $searchpicto = $form->showFilterButtons(); + print $searchpicto; + print '
'; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($object->id, $arrayofselected)) { - $selected = 1; + if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($object->id, $arrayofselected)) { + $selected = 1; + } + print ''; } - print ''; + print ''.$obj->anotherfield.''; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($object->id, $arrayofselected)) { + $selected = 1; + } + print ''; + } + print ''; - print dol_escape_htmltag($obj->note_public); + print ''; + print dol_string_nohtmltag($obj->note_public); print ''; - print dol_escape_htmltag($obj->note_private); + print ''; + print dol_string_nohtmltag($obj->note_private); print '
trans("LabelOrTranslationKey"); ?>
trans("AttributeCode"); ?> (trans("AlphaNumOnlyLowerCharsAndNoSpace"); ?>)
trans("AttributeCode"); ?> (trans("AlphaNumOnlyLowerCharsAndNoSpace"); ?>)
trans("Type"); ?> selectarray('type', $type2label, GETPOST('type', 'alpha'), 0, 0, 0, '', 0, 0, 0, '', '', 1); ?> From 089289d13b72dfb666ba539847ed35c441f2bbaa Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 4 May 2022 14:55:03 +0200 Subject: [PATCH 6/7] NEW: extrafields computed numeric and totalizable are correctly calculated in total table row --- htdocs/core/tpl/extrafields_list_print_fields.tpl.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php index 00c2739e3f8..aeafac07962 100644 --- a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php +++ b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php @@ -39,6 +39,9 @@ if (!empty($extrafieldsobjectkey) && !empty($extrafields->attributes[$extrafield //var_dump($obj); //var_dump($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key]); $value = dol_eval($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key], 1, 1, '0'); + if (is_numeric(price2num($value)) && $extrafields->attributes[$extrafieldsobjectkey]['totalizable'][$key]) { + $obj->$tmpkey = price2num($value); + } //var_dump($value); } From 35748640625050fa3b49db6cba7e9bd3eea96564 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 4 May 2022 15:07:50 +0200 Subject: [PATCH 7/7] Add email_company --- htdocs/install/mysql/migration/15.0.0-16.0.0.sql | 2 +- .../llx_eventorganization_conferenceorboothattendee.sql | 5 +++-- 2 files changed, 4 insertions(+), 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 c910cf45022..daa0e755865 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 @@ -342,5 +342,5 @@ ALTER TABLE llx_c_partnership_type ADD COLUMN keyword varchar(128); ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD COLUMN firstname varchar(100); ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD COLUMN lastname varchar(100); - +ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD COLUMN email_company varchar(128) after email; diff --git a/htdocs/install/mysql/tables/llx_eventorganization_conferenceorboothattendee.sql b/htdocs/install/mysql/tables/llx_eventorganization_conferenceorboothattendee.sql index fa8894987a0..973c738a076 100644 --- a/htdocs/install/mysql/tables/llx_eventorganization_conferenceorboothattendee.sql +++ b/htdocs/install/mysql/tables/llx_eventorganization_conferenceorboothattendee.sql @@ -1,4 +1,4 @@ --- Copyright (C) ---Put here your own copyright and developer email--- +-- Copyright (C) 2021-2022 Laurent Destailleur -- -- 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 @@ -22,7 +22,8 @@ CREATE TABLE llx_eventorganization_conferenceorboothattendee( fk_actioncomm integer, fk_project integer NOT NULL, fk_invoice integer NULL, - email varchar(100), + email varchar(128), + email_company varchar(128), firstname varchar(100), lastname varchar(100), date_subscription datetime,