forked from Wavyzz/dolibarr
WIP Addapage to edit all categories.
This commit is contained in:
@@ -193,13 +193,14 @@ class Categorie extends CommonObject
|
||||
'user' => 'Users',
|
||||
'account' => 'Accounts', // old for bank account
|
||||
'bank_account' => 'BankAccounts',
|
||||
'bank_line' => 'BankTransactions',
|
||||
'project' => 'Projects',
|
||||
'warehouse' => 'Warehouse',
|
||||
'actioncomm' => 'AgendaEvents',
|
||||
'website_page' => 'WebsitePages',
|
||||
'ticket' => 'Tickets',
|
||||
'knowledgemanagement' => 'KnowledgeRecords',
|
||||
'fichinter' => 'Fichinters',
|
||||
'fichinter' => 'Interventions',
|
||||
'order' => 'Orders',
|
||||
'invoice' => 'Invoices',
|
||||
'supplier_order' => 'SuppliersOrders',
|
||||
|
||||
@@ -45,21 +45,14 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("accountancy", "agenda", "banks", "bills", "categories", "contracts", "interventions"));
|
||||
$langs->loadLangs(array("knowledgemanagement", "members", "orders", "products", "stocks", "suppliers", "tickets"));
|
||||
$langs->loadLangs(array("knowledgemanagement", "members", "orders", "products", "stocks", "suppliers", "tickets", "website"));
|
||||
|
||||
$mode = GETPOST('mode', 'aZ09');
|
||||
if (empty($mode)) {
|
||||
$mode = 'hierarchy';
|
||||
}
|
||||
$id = GETPOSTINT('id');
|
||||
$type = (GETPOST('type', 'aZ09') ? GETPOST('type', 'aZ09') : Categorie::TYPE_PRODUCT);
|
||||
$catname = GETPOST('catname', 'alpha');
|
||||
$nosearch = GETPOSTINT('nosearch');
|
||||
|
||||
$categstatic = new Categorie($db);
|
||||
if (is_numeric($type)) {
|
||||
$type = array_search($type, $categstatic->MAP_ID); // For backward compatibility
|
||||
}
|
||||
|
||||
// Initialize a technical object to manage hooks. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('categoryindex'));
|
||||
@@ -75,48 +68,78 @@ if (!$permissiontoread) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
$nbtotalofrecords = 99;
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$title = $langs->trans("Categories");
|
||||
$title .= ' ('.$langs->trans(empty(Categorie::$MAP_TYPE_TITLE_AREA[$type]) ? ucfirst($type) : Categorie::$MAP_TYPE_TITLE_AREA[$type]).')';
|
||||
|
||||
|
||||
// Output page
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
llxHeader('', $title, '', '', 0, 0, '', '');
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print_barre_liste($title, 0, $_SERVER["PHP_SELF"], '', '', '', '', -1, 0, $categstatic->picto, 0, '', '', -1, 0, 1, 1);
|
||||
|
||||
print '<span class="opacitymedium">';
|
||||
print $langs->trans("CategorieListOfType").'<br>';
|
||||
print '</span>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<div class="aaa">';
|
||||
|
||||
print '<table class="liste nohover centpercent noborder">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Categories").'</td><td></td><td class="right">';
|
||||
if ($morethan1level && !empty($conf->use_javascript_ajax)) {
|
||||
print '<div id="iddivjstreecontrol">';
|
||||
print '<a class="notasortlink" href="#">'.img_picto('', 'folder', 'class="paddingright"').'<span class="hideonsmartphone">'.$langs->trans("UndoExpandAll").'</span></a>';
|
||||
print ' | ';
|
||||
print '<a class="notasortlink" href="#">'.img_picto('', 'folder-open', 'class="paddingright"').'<span class="hideonsmartphone">'.$langs->trans("ExpandAll").'</span></a>';
|
||||
print '</div>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
if ($nbofentries > 0) {
|
||||
print '<tr class="oddeven nohover"><td colspan="3">';
|
||||
tree_recur($data, $data[0], 0);
|
||||
print '</td></tr>';
|
||||
} else {
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Type").'</td>';
|
||||
print '<td>'.$langs->trans("NumberOfCategories").'</td>';
|
||||
print '<td></td>';
|
||||
print '</tr>';
|
||||
|
||||
$arrayofcateg = array();
|
||||
foreach ($categstatic->MAP_ID as $key => $id) {
|
||||
$arrayofcateg[$key]['key'] = $key;
|
||||
$arrayofcateg[$key]['label'] = $langs->transnoentitiesnoconv($categstatic::$MAP_TYPE_TITLE_AREA[$key]);
|
||||
$arrayofcateg[$key]['labelwithoutaccent'] = dol_string_unaccent($langs->transnoentitiesnoconv($categstatic::$MAP_TYPE_TITLE_AREA[$key]));
|
||||
}
|
||||
|
||||
$arrayofcateg = dol_sort_array($arrayofcateg, 'labelwithoutaccent', 'asc', 1);
|
||||
|
||||
foreach ($arrayofcateg as $key => $val) {
|
||||
$tmparray = getElementProperties($key);
|
||||
|
||||
$classname = $tmparray['classname'];
|
||||
$classpath = $tmparray['classpath'];
|
||||
$classfile = $tmparray['classfile'];
|
||||
$module = $tmparray['module'];
|
||||
$fullpath = DOL_DOCUMENT_ROOT.'/'.$classpath.'/'.$classfile.'.class.php';
|
||||
|
||||
if (!isModEnabled($module)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td colspan="3"><table class="nobordernopadding"><tr class="nobordernopadding"><td>'.img_picto_common('', 'treemenu/branchbottom.gif').'</td>';
|
||||
print '<td class="valignmiddle">';
|
||||
print $langs->trans("NoCategoryYet");
|
||||
print '<td>';
|
||||
|
||||
$tmpobject = null;
|
||||
include_once $fullpath;
|
||||
if (class_exists($classname)) {
|
||||
$tmpobject = new $classname($db);
|
||||
}
|
||||
//print "key=".$key." fullpath=".$fullpath." classname=".$classname." classpath=".$classpath." classfile=".$classfile;
|
||||
|
||||
if ($tmpobject) {
|
||||
print img_picto('', $tmpobject->picto, 'class="pictofixedwidth"');
|
||||
} else {
|
||||
print img_picto('', 'generic', 'class="pictofixedwidth"');
|
||||
}
|
||||
print dolPrintHTML($arrayofcateg[$key]['label']);
|
||||
print '</td>';
|
||||
print '<td> </td>';
|
||||
print '</table></td>';
|
||||
print '<td>';
|
||||
$nb = 'todo';
|
||||
print $nb;
|
||||
print '</td>';
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/categories/categorie_list.php?mode=hierarchy&type='.urlencode($key).'">'.img_picto('', 'edit').'</a></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
@@ -1870,7 +1870,7 @@ function dol_sanitizeKeyCode($str)
|
||||
/**
|
||||
* Clean a string from all accent characters to be used as ref, login or by dol_sanitizeFileName
|
||||
*
|
||||
* @param string $str String to clean
|
||||
* @param string $str String to clean. Must be an ascii or utf8 string without any htmlentities.
|
||||
* @return string Cleaned string
|
||||
*
|
||||
* @see dol_sanitizeFilename(), dol_string_nospecial()
|
||||
@@ -13711,6 +13711,11 @@ function getElementProperties($elementType)
|
||||
$module = 'bank'; // We need $conf->bank->dir_output and not $conf->banque->dir_output
|
||||
$classfile = 'account';
|
||||
$classname = 'Account';
|
||||
} elseif ($elementType == 'bank_line') {
|
||||
$classpath = 'compta/bank/class';
|
||||
$module = 'bank'; // We need $conf->bank->dir_output and not $conf->banque->dir_output
|
||||
$classfile = 'account';
|
||||
$classname = 'AccountLine';
|
||||
} elseif ($elementType == 'category') {
|
||||
$classpath = 'categories/class';
|
||||
$module = 'categorie';
|
||||
@@ -13730,7 +13735,7 @@ function getElementProperties($elementType)
|
||||
$classpath = 'product/inventory/class';
|
||||
$table_element = 'inventorydet';
|
||||
$parent_element = 'inventory';
|
||||
} elseif ($elementType == 'stock' || $elementType == 'entrepot') {
|
||||
} elseif ($elementType == 'stock' || $elementType == 'entrepot' || $elementType == 'warehouse') {
|
||||
$module = 'stock';
|
||||
$classpath = 'product/stock/class';
|
||||
$classfile = 'entrepot';
|
||||
@@ -13884,7 +13889,7 @@ function getElementProperties($elementType)
|
||||
$classpath = 'opensurvey/class';
|
||||
$module = 'opensurvey';
|
||||
$subelement = 'opensurveysondage';
|
||||
} elseif ($elementType == 'order_supplier' || $elementType == 'commande_fournisseur' || $elementType == 'commandefournisseur') {
|
||||
} elseif ($elementType == 'order_supplier' || $elementType == 'supplier_order' ||$elementType == 'commande_fournisseur' || $elementType == 'commandefournisseur') {
|
||||
$classpath = 'fourn/class';
|
||||
$module = 'fournisseur';
|
||||
$classfile = 'fournisseur.commande';
|
||||
@@ -13901,7 +13906,7 @@ function getElementProperties($elementType)
|
||||
$classname = 'CommandeFournisseurLigne';
|
||||
$table_element = 'commande_fournisseurdet';
|
||||
$parent_element = 'commande_fournisseur';
|
||||
} elseif ($elementType == 'invoice_supplier') {
|
||||
} elseif ($elementType == 'invoice_supplier' || $elementType == 'supplier_invoice') {
|
||||
$classpath = 'fourn/class';
|
||||
$module = 'fournisseur';
|
||||
$classfile = 'fournisseur.facture';
|
||||
@@ -13943,7 +13948,7 @@ function getElementProperties($elementType)
|
||||
$classfile = 'societeaccount';
|
||||
$classname = 'SocieteAccount';
|
||||
$module = 'societe';
|
||||
} elseif ($elementType == 'websitepage') {
|
||||
} elseif ($elementType == 'websitepage' || $elementType == 'website_page') {
|
||||
$classpath = 'website/class';
|
||||
$classfile = 'websitepage';
|
||||
$classname = 'Websitepage';
|
||||
@@ -13994,15 +13999,30 @@ function getElementProperties($elementType)
|
||||
$classname = 'Ecmfiles';
|
||||
$table_element = 'ecmfiles';
|
||||
$subelement = '';
|
||||
} elseif ($elementType == 'knowledgerecord') {
|
||||
} elseif ($elementType == 'knowledgerecord' || $elementType == 'knowledgemanagement') {
|
||||
$module = '';
|
||||
$classpath = 'knowledgemanagement/class';
|
||||
$classfile = 'knowledgerecord';
|
||||
$classname = 'KnowledgeRecord';
|
||||
$table_element = 'knowledgemanagement_knowledgerecord';
|
||||
$subelement = '';
|
||||
} elseif ($elementType == 'customer') {
|
||||
$module = 'thirdparty';
|
||||
$classpath = 'societe/class';
|
||||
$classfile = 'client';
|
||||
$classname = 'Client';
|
||||
$table_element = 'societe';
|
||||
$subelement = '';
|
||||
} elseif ($elementType == 'fournisseur' || $elementType == 'supplier') {
|
||||
$module = 'thirdparty';
|
||||
$classpath = 'fourn/class';
|
||||
$classfile = 'fournisseur';
|
||||
$classname = 'Fournisseur';
|
||||
$table_element = 'societe';
|
||||
$subelement = '';
|
||||
}
|
||||
|
||||
|
||||
if (empty($classfile)) {
|
||||
$classfile = strtolower($subelement);
|
||||
}
|
||||
|
||||
@@ -100,3 +100,5 @@ ChooseCategory=Choose category
|
||||
UseOrOperatorForCategories=Use 'OR' operator for categories
|
||||
AddObjectIntoCategory=Assign to the category
|
||||
AddTicketIntoCategory=Assign the category to the ticket
|
||||
CategorieListOfType=Select the type of the categories/tags you want to view or edit
|
||||
NumberOfCategories=Number of tags/categories
|
||||
|
||||
@@ -30,6 +30,7 @@ EditPageMeta=Edit page/container properties
|
||||
EditInLine=Edit inline
|
||||
AddWebsite=Add website
|
||||
WebsitePage=Website page
|
||||
WebsitePages=Website pages
|
||||
Webpage=Web page/container
|
||||
AddPage=Add page/container
|
||||
PageContainer=Page
|
||||
|
||||
Reference in New Issue
Block a user