From e9526066b7ee8eb2bae3182e9f0be5dfbd240e59 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 8 Jun 2015 14:12:57 +0200 Subject: [PATCH] Prepare edition of field "bydefaultinlist" for extrafields. --- htdocs/core/actions_extrafields.inc.php | 33 +++++++++++++++++-- htdocs/core/tpl/admin_extrafields_add.tpl.php | 10 ++++-- .../core/tpl/admin_extrafields_edit.tpl.php | 9 ++++- htdocs/fichinter/card.php | 4 +-- 4 files changed, 48 insertions(+), 8 deletions(-) diff --git a/htdocs/core/actions_extrafields.inc.php b/htdocs/core/actions_extrafields.inc.php index 03d724b9bba..4c5f0b512d2 100644 --- a/htdocs/core/actions_extrafields.inc.php +++ b/htdocs/core/actions_extrafields.inc.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2011-2015 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 @@ -148,7 +148,21 @@ if ($action == 'add') } } - $result=$extrafields->addExtraField($_POST['attrname'],$_POST['label'],$_POST['type'],$_POST['pos'],$extrasize,$elementtype,(GETPOST('unique')?1:0),(GETPOST('required')?1:0),$default_value,$params,(GETPOST('alwayseditable')?1:0)); + $result=$extrafields->addExtraField( + GETPOST('attrname'), + GETPOST('label'), + GETPOST('type'), + GETPOST('pos'), + $extrasize, + $elementtype, + (GETPOST('unique')?1:0), + (GETPOST('required')?1:0), + $default_value, + $params, + (GETPOST('alwayseditable')?1:0), + (GETPOST('perms')?GETPOST('perms'):''), + (GETPOST('list')?1:0) + ); if ($result > 0) { setEventMessage($langs->trans('SetupSaved')); @@ -285,7 +299,20 @@ if ($action == 'update') $params['options'][$key] = $value; } } - $result=$extrafields->update($_POST['attrname'],$_POST['label'],$_POST['type'],$extrasize,$elementtype,(GETPOST('unique')?1:0),(GETPOST('required')?1:0),$pos,$params,(GETPOST('alwayseditable')?1:0)); + $result=$extrafields->update( + GETPOST('attrname'), + GETPOST('label'), + GETPOST('type'), + $extrasize, + $elementtype, + (GETPOST('unique')?1:0), + (GETPOST('required')?1:0), + $pos, + $params, + (GETPOST('alwayseditable')?1:0), + (GETPOST('perms')?GETPOST('perms'):''), + (GETPOST('list')?1:0) + ); if ($result > 0) { setEventMessage($langs->trans('SetupSaved')); diff --git a/htdocs/core/tpl/admin_extrafields_add.tpl.php b/htdocs/core/tpl/admin_extrafields_add.tpl.php index 44de526942f..fc13acc7072 100644 --- a/htdocs/core/tpl/admin_extrafields_add.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_add.tpl.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2010-2015 Laurent Destailleur * Copyright (C) 2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -20,7 +20,7 @@ * The following vars must be defined * $type2label * $form - * $conf, $lang, + * $conf, $lang, */ ?> @@ -113,6 +113,12 @@ trans("Required"); ?>> trans("AlwaysEditable"); ?>> +global->MAIN_FEATURES_LEVEL >= 2) { ?> + +trans("ByDefaultInList"); ?> +trans("FeatureNotYetSupported")); ?> +> +

">   diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php index 9c283b83867..286eba8c3b7 100644 --- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php @@ -56,6 +56,8 @@ $required=$extrafields->attribute_required[$attrname]; $pos=$extrafields->attribute_pos[$attrname]; $alwayseditable=$extrafields->attribute_alwayseditable[$attrname]; $param=$extrafields->attribute_param[$attrname]; +$perms=$extrafields->attribute_perms[$attrname]; +$list=$extrafields->attribute_list[$attrname]; if((($type == 'select') || ($type == 'checkbox') || ($type == 'radio')) && is_array($param)) { @@ -113,7 +115,12 @@ if(($type == 'select') || ($type == 'sellist') || ($type == 'checkbox') || ($typ trans("Required"); ?>> trans("AlwaysEditable"); ?>> - + +global->MAIN_FEATURES_LEVEL >= 2) { ?> +trans("ByDefaultInList"); ?> +trans("FeatureNotYetSupported")); ?> +> +

">   diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index bc269822da4..3409c075761 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -251,7 +251,7 @@ else if ($action == 'add' && $user->rights->ficheinter->creer) $prod->getMultiLangs(); // We show if duration is present on service (so we get it) $prod->fetch($lines[$i]->fk_product); - if ($prod->duration_value && $prod->duration_unit == 'h' && $conf->global->FICHINTER_USE_SERVICE_DURATION) + if ($prod->duration_value && $prod->duration_unit == 'h' && $conf->global->FICHINTER_USE_SERVICE_DURATION) { $durationproduct=$prod->duration_value * 3600 * $lines[$i]->qty; } @@ -276,7 +276,7 @@ else if ($action == 'add' && $user->rights->ficheinter->creer) $desc = $label; $desc .= ' ('.$langs->trans('Quantity').': '.$lines[$i]->qty.')'; - + } else { $desc = dol_htmlentitiesbr($lines[$i]->desc); $desc .= ' ('.$langs->trans('Quantity').': '.$lines[$i]->qty.')';