From 68179c8794daf5063c18d857ea7fb52ac1835d22 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Tue, 14 Oct 2014 16:13:17 +0200 Subject: [PATCH] Always editable option for extrafields on invoice and order --- htdocs/commande/card.php | 19 +++++++++++++------ htdocs/compta/facture.php | 14 ++++++++++---- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 136ade4df3c..f39d827b03e 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -618,7 +618,7 @@ else if ($action == 'addline' && $user->rights->commande->creer) { $filter = array('t.fk_product' => $prod->id,'t.fk_soc' => $object->thirdparty->id); $result = $prodcustprice->fetch_all('', '', 0, 0, $filter); - if ($result >= 0) + if ($result >= 0) { if (count($prodcustprice->lines) > 0) { @@ -628,9 +628,9 @@ else if ($action == 'addline' && $user->rights->commande->creer) { $prod->tva_tx = $prodcustprice->lines [0]->tva_tx; } } - else - { - setEventMessage($prodcustprice->error,'errors'); + else + { + setEventMessage($prodcustprice->error,'errors'); } } @@ -2152,9 +2152,16 @@ if ($action == 'create' && $user->rights->commande->creer) { } else { - print ''; + print 'attribute_required [$key])) print ' class="fieldrequired"'; - print '>' . $label . ''; + if (($object->statut == 0 || $extrafields->attribute_alwayseditable[$key]) && $user->rights->propal->creer && ($action != 'edit_extras' || GETPOST('attribute') != $key)) + print ''; + + print '
'; + print '>' . $label . '' . img_edit().'
'; + print ''; + // Convert date into timestamp format if (in_array($extrafields->attribute_type [$key], array('date','datetime'))) { diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 245f187d166..22246fc8f03 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -3341,10 +3341,16 @@ if ($action == 'create') if ($extrafields->attribute_type [$key] == 'separate') { print $extrafields->showSeparator($key); } else { - print 'attribute_required [$key])) - print ' class="fieldrequired"'; - print '>' . $label . ''; + print ''; + print 'attribute_required [$key])) print ' class="fieldrequired"'; + print '>' . $label . ''; + if (($object->statut == 0 || $extrafields->attribute_alwayseditable[$key]) && $user->rights->propal->creer && ($action != 'edit_extras' || GETPOST('attribute') != $key)) + print ''; + + print '
' . img_edit().'
'; + print ''; + // Convert date into timestamp format if (in_array($extrafields->attribute_type [$key], array('date','datetime'))) { $value = isset($_POST["options_" . $key]) ? dol_mktime($_POST["options_" . $key . "hour"], $_POST["options_" . $key . "min"], 0, $_POST["options_" . $key . "month"], $_POST["options_" . $key . "day"], $_POST["options_" . $key . "year"]) : $db->jdate($object->array_options ['options_' . $key]);