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);
59if (is_numeric($type)) {
60 $type = Categorie::$MAP_ID_TO_CODE[$type];
71if ($cancel == $langs->trans(
"Cancel")) {
77if ($action ==
'vadd' &&
78$cancel != $langs->trans(
"Cancel") &&
79($user->rights->categorie->creer)) {
81 $current_lang = $langs->getDefaultLang();
84 $forcelangprod =
GETPOST(
'forcelangprod',
'alpha');
85 $libelle =
GETPOST(
'libelle',
'alpha');
86 $desc =
GETPOST(
'desc',
'restricthtml');
88 if (empty($forcelangprod)) {
90 $object->errors[] = $langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Translation'));
94 if (empty($libelle)) {
96 $object->errors[] = $langs->trans(
'Language_'.$forcelangprod).
' : '.$langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Label'));
101 if ($forcelangprod == $current_lang) {
102 $object->label = $libelle;
105 $object->multilangs[$forcelangprod][
"label"] = $libelle;
110 $res = $object->setMultiLangs($user);
126if ($action ==
'vedit' &&
127$cancel != $langs->trans(
"Cancel") &&
128($user->rights->categorie->creer)) {
130 $current_lang = $langs->getDefaultLang();
132 foreach ($object->multilangs as $key => $value) {
133 $libelle =
GETPOST(
'libelle-'.$key,
'alpha');
134 $desc =
GETPOST(
'desc-'.$key,
'restricthtml');
136 if (empty($libelle)) {
138 $object->errors[] = $langs->trans(
'Language_'.$key).
' : '.$langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Label'));
141 if ($key == $current_lang) {
142 $object->label = $libelle;
145 $object->multilangs[$key][
"label"] = $libelle;
151 $res = $object->setMultiLangs($user);
170$form =
new Form($db);
174llxHeader(
"",
"", $langs->trans(
"Translation"));
176$title = Categorie::$MAP_TYPE_TITLE_AREA[$type];
182if (!empty($object->multilangs)) {
183 foreach ($object->multilangs as $key => $value) {
190$backtolist = (
GETPOST(
'backtolist') ?
GETPOST(
'backtolist') : DOL_URL_ROOT.
'/categories/index.php?leftmenu=cat&type='.urlencode($type));
191$linkback =
'<a href="'.dol_sanitizeUrl($backtolist).
'">'.$langs->trans(
"BackToList").
'</a>';
192$object->next_prev_filter =
'type = '.((int) $object->type);
193$object->ref = $object->label;
194$morehtmlref =
'<br><div class="refidno"><a href="'.DOL_URL_ROOT.
'/categories/index.php?leftmenu=cat&type='.$type.
'">'.$langs->trans(
"Root").
'</a> >> ';
195$ways = $object->print_all_ways(
" >> ",
'', 1);
196foreach ($ways as $way) {
197 $morehtmlref .= $way.
"<br>\n";
199$morehtmlref .=
'</div>';
201dol_banner_tab($object,
'label', $linkback, ($user->socid ? 0 : 1),
'label',
'label', $morehtmlref,
'&type='.$type, 0,
'',
'', 1);
205print
'<div class="fichecenter">';
206print
'<div class="underbanner clearboth"></div>';
208print
'<table class="border centpercent tableforfield">';
211print
'<tr><td class="titlefield notopnoleft">';
212print $langs->trans(
"Description").
'</td><td>';
217print
'<tr><td class="notopnoleft">';
218print $langs->trans(
"Color").
'</td><td>';
219print $formother->showColor($object->color);
233print
"\n<div class=\"tabsAction\">\n";
236 if ($user->hasRight(
'produit',
'creer') || $user->hasRight(
'service',
'creer')) {
237 print
'<a class="butAction" href="'.$_SERVER[
'PHP_SELF'].
'?action=add&token='.newToken().
'&id='.$object->id.
'&type='.$type.
'">'.$langs->trans(
'Add').
'</a>';
238 if ($cnt_trans > 0) {
239 print
'<a class="butAction" href="'.$_SERVER[
'PHP_SELF'].
'?action=edit&token='.newToken().
'&id='.$object->id.
'&type='.$type.
'">'.$langs->trans(
'Update').
'</a>';
248if ($action ==
'edit') {
250 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
252 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
253 print
'<input type="hidden" name="token" value="'.newToken().
'">';
254 print
'<input type="hidden" name="action" value="vedit">';
255 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
256 print
'<input type="hidden" name="type" value="'.$type.
'">';
258 if (!empty($object->multilangs)) {
259 foreach ($object->multilangs as $key => $value) {
260 print
"<br><b><u>".$langs->trans(
'Language_'.$key).
" :</u></b><br>";
261 print
'<table class="border centpercent">';
264 $libelle = (
GETPOST(
'libelle-'.$key,
'alpha') ?
GETPOST(
'libelle-'.$key,
'alpha') : $object->multilangs[$key][
'label']);
265 print
'<tr><td class="titlefield fieldrequired">'.$langs->trans(
'Label').
'</td><td><input name="libelle-'.$key.
'" size="40" value="'.$libelle.
'"></td></tr>';
268 $desc = (
GETPOST(
'desc-'.$key) ?
GETPOST(
'desc-'.$key) : $object->multilangs[$key][
'description']);
269 print
'<tr><td class="tdtop">'.$langs->trans(
'Description').
'</td><td>';
270 $doleditor =
new DolEditor(
"desc-$key", $desc,
'', 160,
'dolibarr_notes',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_SOCIETE'), ROWS_3,
'90%');
271 $doleditor->Create();
281 print $form->buttonsSaveCancel();
284} elseif ($action !=
'add') {
286 print
'<div class="underbanner clearboth"></div>';
289 if (!empty($object->multilangs)) {
290 foreach ($object->multilangs as $key => $value) {
292 print
'<table class="border centpercent">';
293 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>';
294 print
'<tr><td class="titlefield">'.$langs->trans(
'Label').
'</td><td>'.$object->multilangs[$key][
"label"].
'</td></tr>';
295 print
'<tr><td>'.$langs->trans(
'Description').
'</td><td>'.$object->multilangs[$key][
"description"].
'</td></tr>';
296 if (!empty($conf->global->CATEGORY_USE_OTHER_FIELD_IN_TRANSLATION)) {
297 print
'<tr><td>'.$langs->trans(
'Other').
' ('.$langs->trans(
"NotUsed").
')</td><td>'.$object->multilangs[$key][
"other"].
'</td></tr>';
302 if (!$cnt_trans && $action !=
'add') {
303 print
'<div class="opacitymedium">'.$langs->trans(
'NoTranslation').
'</div>';
312if ($action ==
'add' && ($user->hasRight(
'produit',
'creer') || $user->hasRight(
'service',
'creer'))) {
314 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
317 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
318 print
'<input type="hidden" name="token" value="'.newToken().
'">';
319 print
'<input type="hidden" name="action" value="vadd">';
320 print
'<input type="hidden" name="id" value="'.$id.
'">';
321 print
'<input type="hidden" name="type" value="'.$type.
'">';
323 print
'<table class="border centpercent">';
324 print
'<tr><td class="titlefield fieldrequired">'.$langs->trans(
'Translation').
'</td><td>';
325 print $formadmin->select_language(
GETPOST(
'forcelangprod',
'alpha'),
'forcelangprod', 0, $object->multilangs);
327 print
'<tr><td class="fieldrequired">'.$langs->trans(
'Label').
'</td>';
328 print
'<td><input name="libelle" class="minwidth200 maxwidth300" value="'.GETPOST(
'libelle',
'alpha').
'"></td></tr>';
329 print
'<tr><td>'.$langs->trans(
'Description').
'</td><td>';
330 $doleditor =
new DolEditor(
'desc',
GETPOST(
'desc',
'restricthtml'),
'', 160,
'dolibarr_notes',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_SOCIETE'), ROWS_3,
'90%');
331 $doleditor->Create();
337 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 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...
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.