add position field into category add view

This commit is contained in:
mohamed daoud 2024-01-19 13:44:20 +01:00
parent f3d97a8a13
commit 31091dd321

View File

@ -53,6 +53,7 @@ $backtopage = GETPOST('backtopage', 'alpha');
$label = (string) GETPOST('label', 'alphanohtml');
$description = (string) GETPOST('description', 'restricthtml');
$color = preg_replace('/[^0-9a-f#]/i', '', (string) GETPOST('color', 'alphanohtml'));
$position = (int) GETPOST('position', 'int');
$visible = (int) GETPOST('visible', 'int');
$parent = (int) GETPOST('parent', 'int');
@ -95,7 +96,7 @@ $error = 0;
/*
* Actions
*/
$parameters = array('socid' => $socid, 'origin' => $origin, 'catorigin' => $catorigin, 'type' => $type, 'urlfrom' => $urlfrom, 'backtopage' => $backtopage, 'label' => $label, 'description' => $description, 'color' => $color, 'visible' => $visible, 'parent' => $parent);
$parameters = array('socid' => $socid, 'origin' => $origin, 'catorigin' => $catorigin, 'type' => $type, 'urlfrom' => $urlfrom, 'backtopage' => $backtopage, 'label' => $label, 'description' => $description, 'color' => $color, 'position' => $position, 'visible' => $visible, 'parent' => $parent);
// Note that $action and $object may be modified by some hooks
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action);
if ($reshook < 0) {
@ -138,6 +139,7 @@ if (empty($reshook)) {
}
$object->label = $label;
$object->color = $color;
$object->position = $position;
$object->description = dol_htmlcleanlastbr($description);
$object->socid = ($socid > 0 ? $socid : 0);
$object->visible = $visible;
@ -259,6 +261,11 @@ if ($user->hasRight('categorie', 'creer')) {
print $formother->selectColor($color, 'color');
print '</td></tr>';
// Position
print '<tr>';
print '<td class="titlefieldcreate">'.$langs->trans("Position").'</td><td><input id="position" class="minwidth100" name="position" value="'.$position.'">';
print'</td></tr>';
// Parent category
print '<tr><td>'.$langs->trans("AddIn").'</td><td>';
print img_picto($langs->trans("ParentCategory"), 'category', 'class="pictofixedwidth"');