diff --git a/htdocs/adherents/admin/member_emails.php b/htdocs/adherents/admin/member_emails.php index 207a913d841..45756ec2691 100644 --- a/htdocs/adherents/admin/member_emails.php +++ b/htdocs/adherents/admin/member_emails.php @@ -69,9 +69,24 @@ $constantes = array( // if ($action == 'updateall') { $db->begin(); - $res1 = $res2 = $res3 = $res4 = $res5 = $res6 = 0; - $res1 = dolibarr_set_const($db, 'XXXX', GETPOST('ADHERENT_LOGIN_NOT_REQUIRED', 'alpha'), 'chaine', 0, '', $conf->entity); - if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0 || $res5 < 0 || $res6 < 0) { + + $res = 0; + foreach ($constantes as $constname => $value) { + $constvalue = (GETPOSTISSET('constvalue_'.$constname) ? GETPOST('constvalue_'.$constname, 'alphanohtml') : GETPOST('constvalue')); + $consttype = (GETPOSTISSET('consttype_'.$constname) ? GETPOST('consttype_'.$constname, 'alphanohtml') : GETPOST('consttype')); + $constnote = (GETPOSTISSET('constnote_'.$constname) ? GETPOST('constnote_'.$constname, 'restricthtml') : GETPOST('constnote')); + + $typetouse = empty($oldtypetonewone[$consttype]) ? $consttype : $oldtypetonewone[$consttype]; + $constvalue = preg_replace('/:member$/', '', $constvalue); + + $res = dolibarr_set_const($db, $constname, $constvalue, $consttype, 0, $constnote, $conf->entity); + if ($res <= 0) { + $error++; + $action = 'list'; + } + } + + if ($error > 0) { setEventMessages('ErrorFailedToSaveDate', null, 'errors'); $db->rollback(); } else { @@ -126,19 +141,19 @@ $head = member_admin_prepare_head(); print dol_get_fiche_head($head, 'emails', $langs->trans("Members"), -1, 'user'); // TODO Use global form -//print '
'; -//print ''; -//print ''; +print ''; +print ''; +print ''; $helptext = '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'
'; $helptext .= '__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, '; $helptext .= '__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, '; //$helptext.='__YEAR__, __MONTH__, __DAY__'; // Not supported -form_constantes($constantes, 0, $helptext); +form_constantes($constantes, 3, $helptext); -//print '
'; -//print '
'; +print '
'; +print ''; print dol_get_fiche_end(); diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php index 1192034e052..e1cf115626f 100644 --- a/htdocs/admin/notification.php +++ b/htdocs/admin/notification.php @@ -92,7 +92,7 @@ if ($action == 'settemplates') { if ($action == 'setvalue' && $user->admin) { $db->begin(); - $result = dolibarr_set_const($db, "NOTIFICATION_EMAIL_FROM", GETPOST("email_from", "restricthtml"), 'chaine', 0, '', $conf->entity); + $result = dolibarr_set_const($db, "NOTIFICATION_EMAIL_FROM", GETPOST("email_from", "alphawithlgt"), 'chaine', 0, '', $conf->entity); if ($result < 0) { $error++; } @@ -270,7 +270,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { } $helptext = ''; - form_constantes($constantes, 2, $helptext); + form_constantes($constantes, 3, $helptext); } else { print ''; print ''; diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 678c895edf6..72de6036e8f 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -1488,7 +1488,7 @@ function complete_elementList_with_modules(&$elementList) * * @param array $tableau Array of constants array('key'=>array('type'=>type, 'label'=>label) * where type can be 'string', 'text', 'textarea', 'html', 'yesno', 'emailtemplate:xxx', ... - * @param int $strictw3c 0=Include form into table (deprecated), 1=Form is outside table to respect W3C (deprecated), 2=No form nor button at all (form is output by caller, recommended) + * @param int $strictw3c 0=Include form into table (deprecated), 1=Form is outside table to respect W3C (deprecated), 2=No form nor button at all, 3=No form nor button at all and each field has a unique name (form is output by caller, recommended) * @param string $helptext Help * @return void */ @@ -1614,24 +1614,24 @@ function form_constantes($tableau, $strictw3c = 0, $helptext = '') foreach (array_keys($_Avery_Labels) as $codecards) { $arrayoflabels[$codecards] = $_Avery_Labels[$codecards]['name']; } - print $form->selectarray('constvalue'.(empty($strictw3c) ? '' : '[]'), $arrayoflabels, ($obj->value ? $obj->value : 'CARD'), 1, 0, 0); + print $form->selectarray('constvalue'.(empty($strictw3c) ? '' : ($strictw3c == 3 ? '_'.$const : '[]')), $arrayoflabels, ($obj->value ? $obj->value : 'CARD'), 1, 0, 0); print ''; print ''; print ''; } else { print ''; }
'; - print ''; - print ''; + print ''; + print ''; if ($obj->type == 'textarea' || in_array($const, array('ADHERENT_CARD_TEXT', 'ADHERENT_CARD_TEXT_RIGHT', 'ADHERENT_ETIQUETTE_TEXT'))) { - print '\n"; } elseif ($obj->type == 'html') { require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor('constvalue_'.$const.(empty($strictw3c) ? '' : '[]'), $obj->value, '', 160, 'dolibarr_notes', '', false, false, $conf->fckeditor->enabled, ROWS_5, '90%'); + $doleditor = new DolEditor('constvalue'.(empty($strictw3c) ? '' : ($strictw3c == 3 ? '_'.$const : '[]')), $obj->value, '', 160, 'dolibarr_notes', '', false, false, $conf->fckeditor->enabled, ROWS_5, '90%'); $doleditor->Create(); } elseif ($obj->type == 'yesno') { - print $form->selectyesno('constvalue'.(empty($strictw3c) ? '' : '[]'), $obj->value, 1); + print $form->selectyesno('constvalue'.(empty($strictw3c) ? '' : ($strictw3c == 3 ? '_'.$const : '[]')), $obj->value, 1); } elseif (preg_match('/emailtemplate/', $obj->type)) { include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; $formmail = new FormMail($db); @@ -1654,10 +1654,9 @@ function form_constantes($tableau, $strictw3c = 0, $helptext = '') } //var_dump($arraydefaultmessage); //var_dump($arrayofmessagename); - print $form->selectarray('constvalue_'.$obj->name, $arrayofmessagename, $obj->value.':'.$tmp[1], 'None', 0, 0, '', 0, 0, 0, '', '', 1); - } else // type = 'string' ou 'chaine' - { - print ''; + print $form->selectarray('constvalue'.(empty($strictw3c) ? '' : ($strictw3c == 3 ? '_'.$const : '[]')), $arrayofmessagename, $obj->value.':'.$tmp[1], 'None', 0, 0, '', 0, 0, 0, '', '', 1); + } else { // type = 'string' ou 'chaine' + print ''; } print '