Fix: bug into edition of extrafields
This commit is contained in:
parent
83d441f8ff
commit
8a89997c79
@ -51,7 +51,16 @@ if (empty($reshook) && ! empty($extrafields->attribute_label))
|
|||||||
print '>' . $label . '</td>';
|
print '>' . $label . '</td>';
|
||||||
|
|
||||||
//TODO Improve element and rights detection
|
//TODO Improve element and rights detection
|
||||||
if (($object->statut == 0 || $extrafields->attribute_alwayseditable[$key]) && ($object->element=='order_supplier'?$user->rights->fournisseur>commande:($object->element=='invoice_supplier'?$user->rights->fournisseur>facture:$user->rights->{$object->element}->creer)) && ($action != 'edit_extras' || GETPOST('attribute') != $key))
|
//var_dump($user->rights);
|
||||||
|
$permok=false;
|
||||||
|
$keyforperm=$object->element;
|
||||||
|
if ($object->element == 'fichinter') $keyforperm='ficheinter';
|
||||||
|
if (isset($user->rights->$keyforperm)) $permok=$user->rights->$keyforperm->creer||$user->rights->$keyforperm->create||$user->rights->$keyforperm->write;
|
||||||
|
if ($object->element=='order_supplier') $permok=$user->rights->fournisseur->commande->creer;
|
||||||
|
if ($object->element=='invoice_supplier') $permok=$user->rights->fournisseur->facture->creer;
|
||||||
|
|
||||||
|
if (($object->statut == 0 || $extrafields->attribute_alwayseditable[$key])
|
||||||
|
&& $permok && ($action != 'edit_extras' || GETPOST('attribute') != $key))
|
||||||
print '<td align="right"><a href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=edit_extras&attribute=' . $key . '">' . img_edit().'</a></td>';
|
print '<td align="right"><a href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=edit_extras&attribute=' . $key . '">' . img_edit().'</a></td>';
|
||||||
|
|
||||||
print '</tr></table>';
|
print '</tr></table>';
|
||||||
@ -63,7 +72,7 @@ if (empty($reshook) && ! empty($extrafields->attribute_label))
|
|||||||
}
|
}
|
||||||
|
|
||||||
//TODO Improve element and rights detection
|
//TODO Improve element and rights detection
|
||||||
if ($action == 'edit_extras' && ($object->element=='order_supplier'?$user->rights->fournisseur>commande:($object->element=='invoice_supplier'?$user->rights->fournisseur>facture:$user->rights->{$object->element}->creer)) && GETPOST('attribute') == $key)
|
if ($action == 'edit_extras' && $permok && GETPOST('attribute') == $key)
|
||||||
{
|
{
|
||||||
print '<form enctype="multipart/form-data" action="' . $_SERVER["PHP_SELF"] . '" method="post" name="formextra">';
|
print '<form enctype="multipart/form-data" action="' . $_SERVER["PHP_SELF"] . '" method="post" name="formextra">';
|
||||||
print '<input type="hidden" name="action" value="update_extras">';
|
print '<input type="hidden" name="action" value="update_extras">';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user