From 0997a7960de65df903263506e0d944a6c2cf2069 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 28 Sep 2014 12:52:35 +0200 Subject: [PATCH 1/2] Fix: uniformize code --- htdocs/admin/commande.php | 39 ++++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index 1d05efa8e995d..e5b2e5e6b1d0b 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -4,7 +4,7 @@ * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2004 Andre Cianfarani - * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2005-2014 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2011-2013 Juanjo Menent * Copyright (C) 2011-2013 Philippe Grand @@ -117,6 +117,35 @@ } } +// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...) +if ($action == 'setModuleOptions') +{ + $post_size=count($_POST); + + $db->begin(); + + for($i=0;$i < $post_size;$i++) + { + if (array_key_exists('param'.$i,$_POST)) + { + $param=GETPOST("param".$i,'alpha'); + $value=GETPOST("value".$i,'alpha'); + if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity); + if (! $res > 0) $error++; + } + } + if (! $error) + { + $db->commit(); + setEventMessage($langs->trans("SetupSaved")); + } + else + { + $db->rollback(); + setEventMessage($langs->trans("Error"),'errors'); + } +} + // Activate a model if ($action == 'set') { @@ -192,14 +221,6 @@ setEventMessage($langs->trans("Error"),'errors'); } } -else if ($action=='setModuleOptions') { - if (dolibarr_set_const($db, "COMMANDE_ADDON_PDF_ODT_PATH",GETPOST('value1'),'chaine',0,'',$conf->entity)) - { - // La constante qui a ete lue en avant du nouveau set - // on passe donc par une variable pour avoir un affichage coherent - $conf->global->COMMANDE_ADDON_PDF_ODT_PATH = GETPOST('value1'); - } -} /* From f527602753c1f2b2fd43ae65aee6e9913432359d Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 28 Sep 2014 13:12:04 +0200 Subject: [PATCH 2/2] Fix: use specific css style instead, this causes a shift problem --- htdocs/core/class/html.form.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 2658f292913b9..8b6b656417ed6 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2830,8 +2830,8 @@ function formconfirm($page, $title, $question, $action, $formquestion='', $selec } else if ($input['type'] == 'select') { - $more.=''; - if (! empty($input['label'])) $more.=$input['label'].''; + $more.=''; + if (! empty($input['label'])) $more.=$input['label'].''; $more.=$this->selectarray($input['name'],$input['values'],$input['default'],1); $more.=''."\n"; }