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');
45$label = (string)
GETPOST(
'label',
'alphanohtml');
46$description = (string)
GETPOST(
'description',
'restricthtml');
47$color = preg_replace(
'/^#/',
'', preg_replace(
'/[^0-9a-f#]/i',
'', (
string)
GETPOST(
'color',
'alphanohtml')));
58$hookmanager->initHooks(array(
'categorycard'));
64$result =
$object->fetch($id, $label);
71if (is_numeric($type)) {
72 $type = Categorie::$MAP_ID_TO_CODE[$type];
76$extrafields->fetch_name_optionals_label(
$object->table_element);
84$parameters = array(
'id' => $id,
'ref' => $ref,
'cancel'=> $cancel,
'backtopage' => $backtopage,
'socid' => $socid,
'label' => $label,
'description' => $description,
'color' => $color,
'position' => $position,
'visible' => $visible,
'parent' => $parent);
86$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
94 header(
"Location: ".$backtopage);
97 header(
'Location: '.DOL_URL_ROOT.
'/categories/viewcat.php?id='.
$object->id.
'&type='.$type);
103 if ($action ==
'update' && $user->hasRight(
'categorie',
'creer')) {
110 $object->socid = ($socid > 0 ? $socid : 0);
112 $object->fk_parent = $parent != -1 ? $parent : 0;
117 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Label")),
null,
'errors');
119 if (!$error && empty(
$object->error)) {
120 $ret = $extrafields->setOptionalsFromPost(
null, $object,
'@GETPOSTISSET');
125 if (!$error &&
$object->update($user) > 0) {
127 header(
"Location: ".$backtopage);
130 header(
'Location: '.DOL_URL_ROOT.
'/categories/viewcat.php?id='.
$object->id.
'&type='.$type);
147$form =
new Form($db);
150llxHeader(
"",
"", $langs->trans(
"Categories"));
158print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'">';
159print
'<input type="hidden" name="token" value="'.newToken().
'">';
160print
'<input type="hidden" name="action" value="update">';
161print
'<input type="hidden" name="id" value="'.$object->id.
'">';
162print
'<input type="hidden" name="type" value="'.$type.
'">';
163print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
167print
'<div class="div-table-responsive-no-min">';
168print
'<table class="border centpercent">';
171print
'<tr><td class="titlefieldcreate fieldrequired">';
172print $langs->trans(
"Ref").
'</td>';
173print
'<td><input type="text" size="25" id="label" name ="label" value="'.$object->label.
'" />';
178print
'<td>'.$langs->trans(
"Description").
'</td>';
180require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
181$doleditor =
new DolEditor(
'description',
$object->description,
'', 200,
'dolibarr_notes',
'',
false,
true, isModEnabled(
'fckeditor'), ROWS_6,
'90%');
187print
'<td>'.$langs->trans(
"Color").
'</td>';
189print $formother->selectColor(
$object->color,
'color');
194print $langs->trans(
"Position").
'</td>';
195print
'<td><input type="text" class="width50" id="position" name ="position" value="'.$object->position.
'" />';
199print
'<tr><td>'.$langs->trans(
"In").
'</td><td>';
200print
img_picto(
'',
'category',
'class="pictofixedwidth"');
201print $form->select_all_categories($type,
$object->fk_parent,
'parent', 64,
$object->id, 0, 0,
'widthcentpercentminusx maxwidth500');
205$parameters = array();
206$reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
207print $hookmanager->resPrint;
208if (empty($reshook)) {
209 print
$object->showOptionals($extrafields,
'edit', $parameters);
218print
'<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>';
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_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.
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.