29require
'../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
35$langs->load(
"categories");
38$ref =
GETPOST(
'ref',
'alphanohtml');
39$action = (
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'edit');
41$cancel =
GETPOST(
'cancel',
'alpha');
42$backtopage =
GETPOST(
'backtopage',
'alpha');
44$socid = (int)
GETPOST(
'socid',
'int');
45$label = (string)
GETPOST(
'label',
'alphanohtml');
46$description = (string)
GETPOST(
'description',
'restricthtml');
47$color = preg_replace(
'/[^0-9a-f#]/i',
'', (
string)
GETPOST(
'color',
'alphanohtml'));
48$visible = (int)
GETPOST(
'visible',
'int');
49$parent = (int)
GETPOST(
'parent',
'int');
60$result = $object->fetch($id, $label);
66if (is_numeric($type)) {
67 $type = Categorie::$MAP_ID_TO_CODE[$type];
71$extrafields->fetch_name_optionals_label($object->table_element);
74$hookmanager->initHooks(array(
'categorycard'));
82$parameters = array(
'id' => $id,
'ref' => $ref,
'cancel'=> $cancel,
'backtopage' => $backtopage,
'socid' => $socid,
'label' => $label,
'description' => $description,
'color' => $color,
'visible' => $visible,
'parent' => $parent);
84$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
92 header(
"Location: ".$backtopage);
95 header(
'Location: '.DOL_URL_ROOT.
'/categories/viewcat.php?id='.$object->id.
'&type='.$type);
101 if ($action ==
'update' && $user->rights->categorie->creer) {
103 $object->label = $label;
105 $object->color = $color;
106 $object->socid = ($socid > 0 ? $socid : 0);
107 $object->visible = $visible;
108 $object->fk_parent = $parent != -1 ? $parent : 0;
110 if (empty($object->label)) {
113 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Label")),
null,
'errors');
115 if (!$error && empty($object->error)) {
116 $ret = $extrafields->setOptionalsFromPost(
null, $object,
'@GETPOSTISSET');
121 if (!$error && $object->update($user) > 0) {
123 header(
"Location: ".$backtopage);
126 header(
'Location: '.DOL_URL_ROOT.
'/categories/viewcat.php?id='.$object->id.
'&type='.$type);
144$form =
new Form($db);
147llxHeader(
"",
"", $langs->trans(
"Categories"));
155print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'">';
156print
'<input type="hidden" name="token" value="'.newToken().
'">';
157print
'<input type="hidden" name="action" value="update">';
158print
'<input type="hidden" name="id" value="'.$object->id.
'">';
159print
'<input type="hidden" name="type" value="'.$type.
'">';
160print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
164print
'<table class="border centpercent">';
167print
'<tr><td class="titlefieldcreate fieldrequired">';
168print $langs->trans(
"Ref").
'</td>';
169print
'<td><input type="text" size="25" id="label" name ="label" value="'.$object->label.
'" />';
174print
'<td>'.$langs->trans(
"Description").
'</td>';
176require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
177$doleditor =
new DolEditor(
'description', $object->description,
'', 200,
'dolibarr_notes',
'',
false,
true, isModEnabled(
'fckeditor'), ROWS_6,
'90%');
183print
'<td>'.$langs->trans(
"Color").
'</td>';
185print $formother->selectColor($object->color,
'color');
189print
'<tr><td>'.$langs->trans(
"In").
'</td><td>';
190print
img_picto(
'',
'category',
'class="pictofixedwidth"');
191print $form->select_all_categories($type, $object->fk_parent,
'parent', 64, $object->id);
195$parameters = array();
196$reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
197print $hookmanager->resPrint;
198if (empty($reshook)) {
199 print $object->showOptionals($extrafields,
'edit', $parameters);
208print
'<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>';
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage categories.
Class to manage a WYSIWYG editor.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
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.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_clone($object, $native=0)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_htmlcleanlastbr($stringtodecode)
This function remove all ending and br at end.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.