From 40a8fe3e796ee5e8f30e85b37ab34a11f0bfe6ba Mon Sep 17 00:00:00 2001 From: fuhraih Date: Fri, 27 Sep 2019 14:32:29 +0200 Subject: [PATCH 1/3] FIX #11554 Extrafields: members autosubscription formular issue --- htdocs/core/class/commonobject.class.php | 17 +++++++++++++---- htdocs/core/tpl/extrafields_add.tpl.php | 3 ++- htdocs/public/members/new.php | 1 + 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 817713f221b..aefdad868b5 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6583,10 +6583,19 @@ abstract class CommonObject $out .= 'attributes[$this->table_element]['required'][$key])) $out .= ' fieldrequired'; - $out .= '">'; - if (! empty($extrafields->attributes[$this->table_element]['help'][$key])) $out .= $form->textwithpicto($labeltoshow, $extrafields->attributes[$this->table_element]['help'][$key]); - else $out .= $labeltoshow; + // BUG #11554 : For public page, use red dot for required fields, instead of bold label + $context = isset($params["context"]) ? $params["context"] : "none"; + if ($context=="public") { // Public page : red dot instead of bold ble characters + $out .= '">'; + if (! empty($extrafields->attributes[$this->table_element]['help'][$key])) $out .= $form->textwithpicto($labeltoshow, $extrafields->attributes[$this->table_element]['help'][$key]); + else $out .= $labeltoshow; + if ($mode != 'view' && ! empty($extrafields->attributes[$this->table_element]['required'][$key])) $out .= ' *'; + } else { + if ($mode != 'view' && ! empty($extrafields->attributes[$this->table_element]['required'][$key])) $out .= ' fieldrequired'; + $out .= '">'; + if (! empty($extrafields->attributes[$this->table_element]['help'][$key])) $out .= $form->textwithpicto($labeltoshow, $extrafields->attributes[$this->table_element]['help'][$key]); + else $out .= $labeltoshow; + } $out .= ''; $html_id = !empty($this->id) ? $this->element.'_extras_'.$key.'_'.$this->id : ''; diff --git a/htdocs/core/tpl/extrafields_add.tpl.php b/htdocs/core/tpl/extrafields_add.tpl.php index f4f74d35428..7e146b63fe0 100644 --- a/htdocs/core/tpl/extrafields_add.tpl.php +++ b/htdocs/core/tpl/extrafields_add.tpl.php @@ -41,7 +41,8 @@ $parameters = array(); $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (empty($reshook)) { - print $object->showOptionals($extrafields, 'edit'); + $params = isset($tpl_context) ? array('context' => $tpl_context) : array(); // BUG #11554 : Add context in params + print $object->showOptionals($extrafields, 'edit', $params); // BUG #11554 : Add context in params } ?> diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 873a6858a1a..2abbd60aa68 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -645,6 +645,7 @@ print ''.$langs->trans("URLPhoto").''."\n"; // Other attributes +$tpl_context = 'public'; //BUG #11554 : define templae context to public include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; // Comments print ''; From 5757159c3002953e10ad7029e9f76db4b520c77c Mon Sep 17 00:00:00 2001 From: fuhraih Date: Fri, 27 Sep 2019 22:29:12 +0200 Subject: [PATCH 2/3] FIX #7533 Infinite loop in Agenda per user view if workinghours not set correctly Remove the spaces in the Working_hours and Working_days stored --- htdocs/comm/action/peruser.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index d4020f4df92..4204224faa5 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -109,6 +109,7 @@ if ($dateselect > 0) } $tmp=empty($conf->global->MAIN_DEFAULT_WORKING_HOURS)?'9-18':$conf->global->MAIN_DEFAULT_WORKING_HOURS; +$tmp=str_replace(' ', '', $tmp); // FIX 7533 $tmparray=explode('-', $tmp); $begin_h = GETPOST('begin_h', 'int')!=''?GETPOST('begin_h', 'int'):($tmparray[0] != '' ? $tmparray[0] : 9); $end_h = GETPOST('end_h', 'int')?GETPOST('end_h', 'int'):($tmparray[1] != '' ? $tmparray[1] : 18); @@ -117,6 +118,7 @@ if ($end_h < 1 || $end_h > 24) $end_h = 18; if ($end_h <= $begin_h) $end_h = $begin_h + 1; $tmp=empty($conf->global->MAIN_DEFAULT_WORKING_DAYS)?'1-5':$conf->global->MAIN_DEFAULT_WORKING_DAYS; +$tmp=str_replace(' ', '', $tmp); // FIX 7533 $tmparray=explode('-', $tmp); $begin_d = GETPOST('begin_d', 'int')?GETPOST('begin_d', 'int'):($tmparray[0] != '' ? $tmparray[0] : 1); $end_d = GETPOST('end_d', 'int')?GETPOST('end_d', 'int'):($tmparray[1] != '' ? $tmparray[1] : 5); From 103efbbe5b266c23fc21f8d102275e4845b3fca0 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sat, 28 Sep 2019 20:55:58 +0000 Subject: [PATCH 3/3] Fixing style errors. --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index c3a30e2966a..b18bade5fa4 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6588,7 +6588,7 @@ abstract class CommonObject $out .= '