30require
'../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
44$langs->load(
"categories");
47$ref =
GETPOST(
'ref',
'alphanohtml');
48$action = (
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'edit');
50$cancel =
GETPOST(
'cancel',
'alpha');
51$backtopage =
GETPOST(
'backtopage',
'alpha');
54$label = (string)
GETPOST(
'label',
'alphanohtml');
55$description = (string)
GETPOST(
'description',
'restricthtml');
56$color = preg_replace(
'/^#/',
'', preg_replace(
'/[^0-9a-f#]/i',
'', (
string)
GETPOST(
'color',
'alphanohtml')));
67$hookmanager->initHooks(array(
'categorycard'));
73$result =
$object->fetch($id, $label);
80if (is_numeric($type)) {
81 $type = Categorie::$MAP_ID_TO_CODE[(int) $type];
85$extrafields->fetch_name_optionals_label(
$object->table_element);
93$parameters = array(
'id' => $id,
'ref' => $ref,
'cancel' => $cancel,
'backtopage' => $backtopage,
'socid' => $socid,
'label' => $label,
'description' => $description,
'color' => $color,
'position' => $position,
'visible' => $visible,
'parent' => $parent);
95$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
100if (empty($reshook)) {
103 header(
"Location: ".$backtopage);
106 header(
'Location: '.DOL_URL_ROOT.
'/categories/viewcat.php?id='.
$object->id.
'&type='.$type);
112 if ($action ==
'update' && $user->hasRight(
'categorie',
'creer')) {
119 $object->socid = ($socid > 0 ? $socid : 0);
121 $object->fk_parent = $parent != -1 ? $parent : 0;
126 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Label")),
null,
'errors');
128 if (!$error && empty(
$object->error)) {
129 $ret = $extrafields->setOptionalsFromPost(
null, $object,
'@GETPOSTISSET');
134 if (!$error &&
$object->update($user) > 0) {
136 header(
"Location: ".$backtopage);
139 header(
'Location: '.DOL_URL_ROOT.
'/categories/viewcat.php?id='.
$object->id.
'&type='.$type);
156$form =
new Form($db);
159llxHeader(
"",
"", $langs->trans(
"Categories"));
167print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'">';
168print
'<input type="hidden" name="token" value="'.newToken().
'">';
169print
'<input type="hidden" name="action" value="update">';
170print
'<input type="hidden" name="id" value="'.$object->id.
'">';
171print
'<input type="hidden" name="type" value="'.$type.
'">';
172print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
176print
'<div class="div-table-responsive-no-min">';
177print
'<table class="border centpercent">';
180print
'<tr><td class="titlefieldcreate fieldrequired">';
181print $langs->trans(
"Ref").
'</td>';
182print
'<td><input type="text" size="25" id="label" name ="label" value="'.$object->label.
'" />';
187print
'<td>'.$langs->trans(
"Description").
'</td>';
189require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
190$doleditor =
new DolEditor(
'description',
$object->description,
'', 200,
'dolibarr_notes',
'',
false,
true, isModEnabled(
'fckeditor'), ROWS_6,
'90%');
196print
'<td>'.$langs->trans(
"Color").
'</td>';
198print $formother->selectColor(
$object->color,
'color');
203print $langs->trans(
"Position").
'</td>';
204print
'<td><input type="text" class="width50" id="position" name ="position" value="'.$object->position.
'" />';
208print
'<tr><td>'.$langs->trans(
"In").
'</td><td>';
209print
img_picto(
'',
'category',
'class="pictofixedwidth"');
210print $form->select_all_categories($type,
$object->fk_parent,
'parent', 64,
$object->id, 0, 0,
'widthcentpercentminusx maxwidth500');
214$parameters = array();
215$reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
216print $hookmanager->resPrint;
217if (empty($reshook)) {
218 print
$object->showOptionals($extrafields,
'edit', $parameters);
227print $form->buttonsSaveCancel(
"Save",
"Cancel");
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage categories.
Class to manage a WYSIWYG editor.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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_get_fiche_end($notab=0)
Return tab footer of a card.
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.
dol_clone($object, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.