Prepare edition of field "bydefaultinlist" for extrafields.

This commit is contained in:
Laurent Destailleur 2015-06-08 14:12:57 +02:00
parent 4a18b730b5
commit e9526066b7
4 changed files with 48 additions and 8 deletions

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2011-2012 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2011-2015 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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'));

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2010-2012 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2010-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
*
* 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 @@
<tr><td><?php echo $langs->trans("Required"); ?></td><td class="valeur"><input id="required" type="checkbox" name="required" <?php echo (GETPOST('required')?' checked':''); ?>></td></tr>
<!-- Always editable -->
<tr><td><?php echo $langs->trans("AlwaysEditable"); ?></td><td class="valeur"><input id="alwayseditable" type="checkbox" name="alwayseditable" <?php echo (GETPOST('alwayseditable')?' checked':''); ?>></td></tr>
<?php if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { ?>
<!-- By default visible into list -->
<tr><td><?php echo $langs->trans("ByDefaultInList"); ?>
<?php echo img_info($langs->trans("FeatureNotYetSupported")); ?>
</td><td class="valeur"><input id="list" type="checkbox" name="list" <?php echo (GETPOST('list')?' checked':''); ?>></td></tr>
<?php } ?>
</table>
<div align="center"><br><input type="submit" name="button" class="button" value="<?php echo $langs->trans("Save"); ?>"> &nbsp;

View File

@ -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
<tr><td><?php echo $langs->trans("Required"); ?></td><td class="valeur"><input id="required" type="checkbox" name="required" <?php echo ($required?' checked':''); ?>></td></tr>
<!-- Always editable -->
<tr><td><?php echo $langs->trans("AlwaysEditable"); ?></td><td class="valeur"><input id="alwayseditable" type="checkbox" name="alwayseditable" <?php echo ($alwayseditable?' checked':''); ?>></td></tr>
<!-- By default visible into list -->
<?php if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { ?>
<tr><td><?php echo $langs->trans("ByDefaultInList"); ?>
<?php echo img_info($langs->trans("FeatureNotYetSupported")); ?>
</td><td class="valeur"><input id="list" type="checkbox" name="list" <?php echo ($list?' checked':''); ?>></td></tr>
<?php } ?>
</table>
<div align="center"><br><input type="submit" name="button" class="button" value="<?php echo $langs->trans("Save"); ?>"> &nbsp;

View File

@ -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.')';