From 7909d2560f78d965db7fe2cd72016c79d0ef3e29 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 Jul 2023 10:58:53 +0200 Subject: [PATCH] Debug v18 --- htdocs/core/class/html.form.class.php | 11 +++++++---- htdocs/user/bank.php | 22 ++++++++++++++++++---- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 9d2825e1eed..39a0d9754e0 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -199,7 +199,7 @@ class Form * @param string $value Value to show/edit * @param object $object Object (that we want to show) * @param boolean $perm Permission to allow button to edit parameter - * @param string $typeofdata Type of data ('string' by default, 'checkbox', 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols%', 'datepicker' ('day' do not work, don't know why), 'dayhour' or 'datehourpicker', 'ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols', 'select;xkey:xval,ykey:yval,...') + * @param string $typeofdata Type of data ('string' by default, 'checkbox', 'email', 'phone', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols%', 'datepicker' ('day' do not work, don't know why), 'dayhour' or 'datehourpicker', 'ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols', 'select;xkey:xval,ykey:yval,...') * @param string $editvalue When in edit mode, use this value as $value instead of value (for example, you can provide here a formated price instead of numeric value, or a select combo). Use '' to use same than $value * @param object $extObject External object ??? * @param mixed $custommsg String or Array of custom messages : eg array('success' => 'MyMessage', 'error' => 'MyMessage') @@ -257,7 +257,7 @@ class Form if (empty($notabletag)) { $ret .= ''; } - if (preg_match('/^(string|safehtmlstring|email|url)/', $typeofdata)) { + if (preg_match('/^(string|safehtmlstring|email|phone|url)/', $typeofdata)) { $tmp = explode(':', $typeofdata); $ret .= ''; } elseif (preg_match('/^(integer)/', $typeofdata)) { @@ -339,13 +339,15 @@ class Form } $ret .= '' . "\n"; } else { - if (preg_match('/^(email)/', $typeofdata)) { + if (preg_match('/^email/', $typeofdata)) { $ret .= dol_print_email($value, 0, 0, 0, 0, 1); + } elseif (preg_match('/^phone/', $typeofdata)) { + $ret .= dol_print_phone($value, '_blank', 32, 1); } elseif (preg_match('/^url/', $typeofdata)) { $ret .= dol_print_url($value, '_blank', 32, 1); } elseif (preg_match('/^(amount|numeric)/', $typeofdata)) { $ret .= ($value != '' ? price($value, '', $langs, 0, -1, -1, $conf->currency) : ''); - } elseif (preg_match('/^(checkbox)/', $typeofdata)) { + } elseif (preg_match('/^checkbox/', $typeofdata)) { $tmp = explode(':', $typeofdata); $ret .= ''; } elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) { @@ -391,6 +393,7 @@ class Form } } + // Custom format if parameter $formatfunc has been provided if ($formatfunc && method_exists($object, $formatfunc)) { $ret = $object->$formatfunc($ret); } diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index 51e6b8181e1..c5b93a665fd 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -211,6 +211,15 @@ if ($action == 'setpersonal_mobile' && $canadduser && !$cancel) { } } +// update accountancy_code +if ($action == 'setaccountancy_code' && $canadduser && !$cancel) { + $object->accountancy_code = (string) GETPOST('accountancy_code', 'alphanohtml'); + $result = $object->update($user); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } +} + // update ref_employee if ($action == 'setref_employee' && $canadduser && !$cancel) { $object->ref_employee = (string) GETPOST('ref_employee', 'alphanohtml'); @@ -482,7 +491,7 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac print ''; print $form->editfieldkey("UserPersonalEmail", 'personal_email', $object->personal_email, $object, $user->hasRight('user', 'user', 'creer') || $user->rights->hrm->write_personal_information->write); print ''; - print $form->editfieldval("UserPersonalEmail", 'personal_email', $object->personal_email, $object, $user->hasRight('user', 'user', 'creer') || $user->rights->hrm->write_personal_information->write, 'email', '', null, null, '', 0, 'dol_print_email'); + print $form->editfieldval("UserPersonalEmail", 'personal_email', $object->personal_email, $object, $user->hasRight('user', 'user', 'creer') || $user->rights->hrm->write_personal_information->write, 'email', '', null, null, '', 0, ''); print ''; print ''; } @@ -493,7 +502,7 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac print ''; print $form->editfieldkey("UserPersonalMobile", 'personal_mobile', $object->personal_mobile, $object, $user->hasRight('user', 'user', 'creer') || $user->rights->hrm->write_personal_information->write); print ''; - print $form->editfieldval("UserPersonalMobile", 'personal_mobile', $object->personal_mobile, $object, $user->hasRight('user', 'user', 'creer') || $user->rights->hrm->write_personal_information->write, 'string', '', null, null, '', 0, 'dol_print_phone'); + print $form->editfieldval("UserPersonalMobile", 'personal_mobile', $object->personal_mobile, $object, $user->hasRight('user', 'user', 'creer') || $user->rights->hrm->write_personal_information->write, 'phone', '', null, null, '', 0, ''); print ''; print ''; } @@ -548,8 +557,13 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac // Accountancy code if (isModEnabled('accounting')) { - print ''.$langs->trans("AccountancyCode").''; - print ''.$object->accountancy_code.''; + print ''; + print ''; + print $form->editfieldkey("AccountancyCode", 'accountancy_code', $object->accountancy_code, $object, $user->hasRight('user', 'user', 'creer')); + print ''; + print $form->editfieldval("AccountancyCode", 'accountancy_code', $object->accountancy_code, $object, $user->hasRight('user', 'user', 'creer'), 'string', '', null, null, '', 0, ''); + print ''; + print ''; } // Employee Number