28 require
'../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
34 $langs->load(
"categories");
37 $ref =
GETPOST(
'ref',
'alphanohtml');
38 $type =
GETPOST(
'type',
'aZ09');
39 $action = (
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'edit');
41 $cancel =
GETPOST(
'cancel',
'alpha');
43 $socid = (int)
GETPOST(
'socid',
'int');
44 $label = (string)
GETPOST(
'label',
'alphanohtml');
45 $description = (string)
GETPOST(
'description',
'restricthtml');
46 $color = preg_replace(
'/[^0-9a-f#]/i',
'', (
string)
GETPOST(
'color',
'alphanohtml'));
47 $visible = (int)
GETPOST(
'visible',
'int');
48 $parent = (int)
GETPOST(
'parent',
'int');
60 $result = $object->fetch($id);
64 $extrafields->fetch_name_optionals_label($object->table_element);
67 $hookmanager->initHooks(array(
'categorycard'));
77 header(
'Location: '.DOL_URL_ROOT.
'/categories/viewcat.php?id='.$object->id.
'&type='.$type);
82 if ($action ==
'update' && $user->rights->categorie->creer) {
84 $object->label = $label;
86 $object->color = $color;
87 $object->socid = ($socid > 0 ? $socid : 0);
88 $object->visible = $visible;
89 $object->fk_parent = $parent != -1 ? $parent : 0;
92 if (empty($object->label)) {
95 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Label")), null,
'errors');
97 if (!$error && empty($object->error)) {
98 $ret = $extrafields->setOptionalsFromPost(null, $object);
99 if ($ret < 0) $error++;
101 if (!$error && $object->update($user) > 0) {
102 header(
'Location: '.DOL_URL_ROOT.
'/categories/viewcat.php?id='.$object->id.
'&type='.$type);
118 $form =
new Form($db);
121 llxHeader(
"",
"", $langs->trans(
"Categories"));
129 print '<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'">';
130 print '<input type="hidden" name="token" value="'.newToken().
'">';
131 print '<input type="hidden" name="action" value="update">';
132 print '<input type="hidden" name="id" value="'.$object->id.
'">';
133 print '<input type="hidden" name="type" value="'.$type.
'">';
137 print '<table class="border centpercent">';
140 print '<tr><td class="titlefieldcreate fieldrequired">';
141 print $langs->trans(
"Ref").
'</td>';
142 print '<td><input type="text" size="25" id="label" name ="label" value="'.$object->label.
'" />';
147 print '<td>'.$langs->trans(
"Description").
'</td>';
149 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
150 $doleditor =
new DolEditor(
'description', $object->description,
'', 200,
'dolibarr_notes',
'',
false,
true, $conf->fckeditor->enabled, ROWS_6,
'90%');
151 $doleditor->Create();
156 print '<td>'.$langs->trans(
"Color").
'</td>';
158 print $formother->selectColor($object->color,
'color');
162 print '<tr><td>'.$langs->trans(
"In").
'</td><td>';
163 print $form->select_all_categories($type, $object->fk_parent,
'parent', 64, $object->id);
166 $parameters = array();
167 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
168 print $hookmanager->resPrint;
169 if (empty($reshook)) {
170 print $object->showOptionals($extrafields,
'edit', $parameters);
179 print '<div class="center"><input type="submit" class="button" name"submit" value="'.$langs->trans(
"Modify").
'"> <input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'"></div>';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_clone($object, $native=0)
Create a clone of instance of object (new instance with same value for properties) With native = 0: P...
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
Class to manage categories.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
dol_htmlcleanlastbr($stringtodecode)
This function remove all ending and br at end.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Class to manage a WYSIWYG editor.