29require
'../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/lib/categories.lib.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
32require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
37$langs->loadLangs(array(
'categories',
'languages'));
40$label =
GETPOST(
'label',
'alpha');
41$action =
GETPOST(
'action',
'aZ09');
42$cancel =
GETPOST(
'cancel',
'alpha');
44if ($id ==
'' && $label ==
'') {
53$result = $object->fetch($id, $label);
60if (is_numeric($type)) {
61 $type = Categorie::$MAP_ID_TO_CODE[$type];
72if ($cancel == $langs->trans(
"Cancel")) {
78if ($action ==
'vadd' &&
79$cancel != $langs->trans(
"Cancel") &&
80($user->hasRight(
'categorie',
'creer'))) {
82 $current_lang = $langs->getDefaultLang();
85 $forcelangprod =
GETPOST(
'forcelangprod',
'alpha');
86 $libelle =
GETPOST(
'libelle',
'alpha');
87 $desc =
GETPOST(
'desc',
'restricthtml');
89 if (empty($forcelangprod)) {
91 $object->errors[] = $langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Translation'));
95 if (empty($libelle)) {
97 $object->errors[] = $langs->trans(
'Language_'.$forcelangprod).
' : '.$langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Label'));
102 if ($forcelangprod == $current_lang) {
103 $object->label = $libelle;
106 $object->multilangs[$forcelangprod][
"label"] = $libelle;
111 $res = $object->setMultiLangs($user);
127if ($action ==
'vedit' &&
128$cancel != $langs->trans(
"Cancel") &&
129($user->hasRight(
'categorie',
'creer'))) {
131 $current_lang = $langs->getDefaultLang();
133 foreach ($object->multilangs as $key => $value) {
134 $libelle =
GETPOST(
'libelle-'.$key,
'alpha');
135 $desc =
GETPOST(
'desc-'.$key,
'restricthtml');
137 if (empty($libelle)) {
139 $object->errors[] = $langs->trans(
'Language_'.$key).
' : '.$langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Label'));
142 if ($key == $current_lang) {
143 $object->label = $libelle;
146 $object->multilangs[$key][
"label"] = $libelle;
152 $res = $object->setMultiLangs($user);
171$form =
new Form($db);
175llxHeader(
"",
"", $langs->trans(
"Translation"));
177$title = Categorie::$MAP_TYPE_TITLE_AREA[$type];
183if (!empty($object->multilangs)) {
184 foreach ($object->multilangs as $key => $value) {
191$backtolist = (
GETPOST(
'backtolist') ?
GETPOST(
'backtolist') : DOL_URL_ROOT.
'/categories/index.php?leftmenu=cat&type='.urlencode($type));
192$linkback =
'<a href="'.dol_sanitizeUrl($backtolist).
'">'.$langs->trans(
"BackToList").
'</a>';
193$object->next_prev_filter =
'type = '.((int) $object->type);
194$object->ref = $object->label;
195$morehtmlref =
'<br><div class="refidno"><a href="'.DOL_URL_ROOT.
'/categories/index.php?leftmenu=cat&type='.$type.
'">'.$langs->trans(
"Root").
'</a> >> ';
196$ways = $object->print_all_ways(
" >> ",
'', 1);
197foreach ($ways as $way) {
198 $morehtmlref .= $way.
"<br>\n";
200$morehtmlref .=
'</div>';
202dol_banner_tab($object,
'label', $linkback, ($user->socid ? 0 : 1),
'label',
'label', $morehtmlref,
'&type='.$type, 0,
'',
'', 1);
206print
'<div class="fichecenter">';
207print
'<div class="underbanner clearboth"></div>';
209print
'<table class="border centpercent tableforfield">';
212print
'<tr><td class="titlefield notopnoleft">';
213print $langs->trans(
"Description").
'</td><td>';
218print
'<tr><td class="notopnoleft">';
219print $langs->trans(
"Color").
'</td><td>';
220print $formother->showColor($object->color);
234print
"\n<div class=\"tabsAction\">\n";
237 if ($user->hasRight(
'produit',
'creer') || $user->hasRight(
'service',
'creer')) {
238 print
'<a class="butAction" href="'.$_SERVER[
'PHP_SELF'].
'?action=add&token='.newToken().
'&id='.$object->id.
'&type='.$type.
'">'.$langs->trans(
'Add').
'</a>';
239 if ($cnt_trans > 0) {
240 print
'<a class="butAction" href="'.$_SERVER[
'PHP_SELF'].
'?action=edit&token='.newToken().
'&id='.$object->id.
'&type='.$type.
'">'.$langs->trans(
'Update').
'</a>';
249if ($action ==
'edit') {
251 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
253 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
254 print
'<input type="hidden" name="token" value="'.newToken().
'">';
255 print
'<input type="hidden" name="action" value="vedit">';
256 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
257 print
'<input type="hidden" name="type" value="'.$type.
'">';
259 if (!empty($object->multilangs)) {
260 foreach ($object->multilangs as $key => $value) {
261 print
"<br><b><u>".$langs->trans(
'Language_'.$key).
" :</u></b><br>";
262 print
'<table class="border centpercent">';
265 $libelle = (
GETPOST(
'libelle-'.$key,
'alpha') ?
GETPOST(
'libelle-'.$key,
'alpha') : $object->multilangs[$key][
'label']);
266 print
'<tr><td class="titlefield fieldrequired">'.$langs->trans(
'Label').
'</td><td><input name="libelle-'.$key.
'" size="40" value="'.$libelle.
'"></td></tr>';
269 $desc = (
GETPOST(
'desc-'.$key) ?
GETPOST(
'desc-'.$key) : $object->multilangs[$key][
'description']);
270 print
'<tr><td class="tdtop">'.$langs->trans(
'Description').
'</td><td>';
271 $doleditor =
new DolEditor(
"desc-$key", $desc,
'', 160,
'dolibarr_notes',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_SOCIETE'), ROWS_3,
'90%');
272 $doleditor->Create();
282 print $form->buttonsSaveCancel();
285} elseif ($action !=
'add') {
287 print
'<div class="underbanner clearboth"></div>';
290 if (!empty($object->multilangs)) {
291 foreach ($object->multilangs as $key => $value) {
293 print
'<table class="border centpercent">';
294 print
'<tr class="liste_titre"><td colspan="2">'.($s ? $s.
' ' :
'').
" <b>".$langs->trans(
'Language_'.$key).
":</b> ".
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=delete&token='.newToken().
'&langtodelete='.$key.
'&type='.$type.
'">'.
img_delete(
'',
'').
'</a></td></tr>';
295 print
'<tr><td class="titlefield">'.$langs->trans(
'Label').
'</td><td>'.$object->multilangs[$key][
"label"].
'</td></tr>';
296 print
'<tr><td>'.$langs->trans(
'Description').
'</td><td>'.$object->multilangs[$key][
"description"].
'</td></tr>';
298 print
'<tr><td>'.$langs->trans(
'Other').
' ('.$langs->trans(
"NotUsed").
')</td><td>'.$object->multilangs[$key][
"other"].
'</td></tr>';
303 if (!$cnt_trans && $action !=
'add') {
304 print
'<div class="opacitymedium">'.$langs->trans(
'NoTranslation').
'</div>';
313if ($action ==
'add' && ($user->hasRight(
'produit',
'creer') || $user->hasRight(
'service',
'creer'))) {
315 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
318 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
319 print
'<input type="hidden" name="token" value="'.newToken().
'">';
320 print
'<input type="hidden" name="action" value="vadd">';
321 print
'<input type="hidden" name="id" value="'.$id.
'">';
322 print
'<input type="hidden" name="type" value="'.$type.
'">';
324 print
'<table class="border centpercent">';
325 print
'<tr><td class="titlefield fieldrequired">'.$langs->trans(
'Translation').
'</td><td>';
326 print $formadmin->select_language(
GETPOST(
'forcelangprod',
'alpha'),
'forcelangprod', 0, $object->multilangs);
328 print
'<tr><td class="fieldrequired">'.$langs->trans(
'Label').
'</td>';
329 print
'<td><input name="libelle" class="minwidth200 maxwidth300" value="'.GETPOST(
'libelle',
'alpha').
'"></td></tr>';
330 print
'<tr><td>'.$langs->trans(
'Description').
'</td><td>';
331 $doleditor =
new DolEditor(
'desc',
GETPOST(
'desc',
'restricthtml'),
'', 160,
'dolibarr_notes',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_SOCIETE'), ROWS_3,
'90%');
332 $doleditor->Create();
338 print $form->buttonsSaveCancel();
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
categories_prepare_head(Categorie $object, $type)
Prepare array with list of tabs.
Class to manage categories.
Class to manage a WYSIWYG editor.
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
picto_from_langcode($codelang, $moreatt='', $notitlealt=0)
Return img flag of country for a language code or country code.
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
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.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
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.
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
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.