Fix /categories/info.php navigation

This commit is contained in:
StephaneLesage 2020-11-21 15:57:11 +01:00 committed by Stephane Lesage
parent 7749138a81
commit 49225f3f57
5 changed files with 6 additions and 20 deletions

View File

@ -37,13 +37,14 @@ $langs->loadLangs(array('categories', 'sendings'));
$socid = 0;
$id = GETPOST('id', 'int');
$label = GETPOST('label', 'alpha');
// Security check
if ($user->socid) $socid = $user->socid;
$result = restrictedArea($user, 'categorie', $id, '&category');
$object = new Categorie($db);
$result = $object->fetch($id);
$result = $object->fetch($id, $label);
if ($result <= 0) {
dol_print_error($db, $object->error); exit;
}
@ -64,11 +65,11 @@ llxHeader('', $langs->trans('Categories'), '');
$title = Categorie::$MAP_TYPE_TITLE_AREA[$type];
$head = categories_prepare_head($object, $type);
print dol_get_fiche_head($head, 'info', $langs->trans($title), -1, 'category');
$backtolist = (GETPOST('backtolist') ? GETPOST('backtolist') : DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type);
$linkback = '<a href="'.$backtolist.'">'.$langs->trans("BackToList").'</a>';
$object->next_prev_filter = ' type = '.$type;
$object->next_prev_filter = ' type = '.$object->type;
$object->ref = $object->label;
$morehtmlref = '<br><div class="refidno"><a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("Root").'</a> >> ';
$ways = $object->print_all_ways(" &gt;&gt; ", '', 1);

View File

@ -55,10 +55,6 @@ $result = $object->fetch($id, $label);
if ($result <= 0) {
dol_print_error($db, $object->error); exit;
}
$object->fetch_optionals();
if ($result <= 0) {
dol_print_error($db, $object->error); exit;
}
$type = $object->type;
if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
@ -116,8 +112,6 @@ if ($object->id)
$title = Categorie::$MAP_TYPE_TITLE_AREA[$type];
$head = categories_prepare_head($object, $type);
print dol_get_fiche_head($head, 'photos', $langs->trans($title), -1, 'category');
$linkback = '<a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("BackToList").'</a>';

View File

@ -54,10 +54,6 @@ $result = $object->fetch($id, $label);
if ($result <= 0) {
dol_print_error($db, $object->error); exit;
}
$object->fetch_optionals();
if ($result <= 0) {
dol_print_error($db, $object->error); exit;
}
$type = $object->type;
if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility

View File

@ -76,10 +76,6 @@ $result = $object->fetch($id, $label);
if ($result <= 0) {
dol_print_error($db, $object->error); exit;
}
$object->fetch_optionals();
if ($result <= 0) {
dol_print_error($db, $object->error); exit;
}
$type = $object->type;
if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
@ -216,9 +212,8 @@ llxHeader("", $langs->trans("Categories"), $helpurl, '', 0, 0, $arrayofjs, $arra
$title = Categorie::$MAP_TYPE_TITLE_AREA[$type];
$head = categories_prepare_head($object, $type);
print dol_get_fiche_head($head, 'card', $langs->trans($title), -1, 'category');
$backtolist = (GETPOST('backtolist') ? GETPOST('backtolist') : DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type);
$linkback = '<a href="'.$backtolist.'">'.$langs->trans("BackToList").'</a>';
$object->next_prev_filter = ' type = '.$object->type;

View File

@ -57,7 +57,7 @@ function categories_prepare_head(Categorie $object, $type)
$h++;
}
$head[$h][0] = DOL_URL_ROOT.'/categories/info.php?id='.$object->id;
$head[$h][0] = DOL_URL_ROOT.'/categories/info.php?id='.$object->id.'&amp;type='.$type;
$head[$h][1] = $langs->trans("Info");
$head[$h][2] = 'info';
$h++;