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',
|
'user' => 'Users',
|
||||||
'account' => 'Accounts', // old for bank account
|
'account' => 'Accounts', // old for bank account
|
||||||
'bank_account' => 'BankAccounts',
|
'bank_account' => 'BankAccounts',
|
||||||
|
'bank_line' => 'BankTransactions',
|
||||||
'project' => 'Projects',
|
'project' => 'Projects',
|
||||||
'warehouse' => 'Warehouse',
|
'warehouse' => 'Warehouse',
|
||||||
'actioncomm' => 'AgendaEvents',
|
'actioncomm' => 'AgendaEvents',
|
||||||
'website_page' => 'WebsitePages',
|
'website_page' => 'WebsitePages',
|
||||||
'ticket' => 'Tickets',
|
'ticket' => 'Tickets',
|
||||||
'knowledgemanagement' => 'KnowledgeRecords',
|
'knowledgemanagement' => 'KnowledgeRecords',
|
||||||
'fichinter' => 'Fichinters',
|
'fichinter' => 'Interventions',
|
||||||
'order' => 'Orders',
|
'order' => 'Orders',
|
||||||
'invoice' => 'Invoices',
|
'invoice' => 'Invoices',
|
||||||
'supplier_order' => 'SuppliersOrders',
|
'supplier_order' => 'SuppliersOrders',
|
||||||
|
|||||||
@@ -45,21 +45,14 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
|||||||
|
|
||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->loadLangs(array("accountancy", "agenda", "banks", "bills", "categories", "contracts", "interventions"));
|
$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');
|
$mode = GETPOST('mode', 'aZ09');
|
||||||
if (empty($mode)) {
|
if (empty($mode)) {
|
||||||
$mode = 'hierarchy';
|
$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);
|
$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
|
// Initialize a technical object to manage hooks. Note that conf->hooks_modules contains array array
|
||||||
$hookmanager->initHooks(array('categoryindex'));
|
$hookmanager->initHooks(array('categoryindex'));
|
||||||
@@ -75,48 +68,78 @@ if (!$permissiontoread) {
|
|||||||
accessforbidden();
|
accessforbidden();
|
||||||
}
|
}
|
||||||
|
|
||||||
$nbtotalofrecords = 99;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$title = $langs->trans("Categories");
|
$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, '', '');
|
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 '<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="liste_titre"><td>'.$langs->trans("Type").'</td>';
|
||||||
print '<tr class="oddeven nohover"><td colspan="3">';
|
print '<td>'.$langs->trans("NumberOfCategories").'</td>';
|
||||||
tree_recur($data, $data[0], 0);
|
print '<td></td>';
|
||||||
print '</td></tr>';
|
print '</tr>';
|
||||||
} else {
|
|
||||||
|
$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 '<tr class="oddeven">';
|
||||||
print '<td colspan="3"><table class="nobordernopadding"><tr class="nobordernopadding"><td>'.img_picto_common('', 'treemenu/branchbottom.gif').'</td>';
|
print '<td>';
|
||||||
print '<td class="valignmiddle">';
|
|
||||||
print $langs->trans("NoCategoryYet");
|
$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>';
|
||||||
print '<td> </td>';
|
print '<td>';
|
||||||
print '</table></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>';
|
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
|
* 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
|
* @return string Cleaned string
|
||||||
*
|
*
|
||||||
* @see dol_sanitizeFilename(), dol_string_nospecial()
|
* @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
|
$module = 'bank'; // We need $conf->bank->dir_output and not $conf->banque->dir_output
|
||||||
$classfile = 'account';
|
$classfile = 'account';
|
||||||
$classname = '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') {
|
} elseif ($elementType == 'category') {
|
||||||
$classpath = 'categories/class';
|
$classpath = 'categories/class';
|
||||||
$module = 'categorie';
|
$module = 'categorie';
|
||||||
@@ -13730,7 +13735,7 @@ function getElementProperties($elementType)
|
|||||||
$classpath = 'product/inventory/class';
|
$classpath = 'product/inventory/class';
|
||||||
$table_element = 'inventorydet';
|
$table_element = 'inventorydet';
|
||||||
$parent_element = 'inventory';
|
$parent_element = 'inventory';
|
||||||
} elseif ($elementType == 'stock' || $elementType == 'entrepot') {
|
} elseif ($elementType == 'stock' || $elementType == 'entrepot' || $elementType == 'warehouse') {
|
||||||
$module = 'stock';
|
$module = 'stock';
|
||||||
$classpath = 'product/stock/class';
|
$classpath = 'product/stock/class';
|
||||||
$classfile = 'entrepot';
|
$classfile = 'entrepot';
|
||||||
@@ -13884,7 +13889,7 @@ function getElementProperties($elementType)
|
|||||||
$classpath = 'opensurvey/class';
|
$classpath = 'opensurvey/class';
|
||||||
$module = 'opensurvey';
|
$module = 'opensurvey';
|
||||||
$subelement = 'opensurveysondage';
|
$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';
|
$classpath = 'fourn/class';
|
||||||
$module = 'fournisseur';
|
$module = 'fournisseur';
|
||||||
$classfile = 'fournisseur.commande';
|
$classfile = 'fournisseur.commande';
|
||||||
@@ -13901,7 +13906,7 @@ function getElementProperties($elementType)
|
|||||||
$classname = 'CommandeFournisseurLigne';
|
$classname = 'CommandeFournisseurLigne';
|
||||||
$table_element = 'commande_fournisseurdet';
|
$table_element = 'commande_fournisseurdet';
|
||||||
$parent_element = 'commande_fournisseur';
|
$parent_element = 'commande_fournisseur';
|
||||||
} elseif ($elementType == 'invoice_supplier') {
|
} elseif ($elementType == 'invoice_supplier' || $elementType == 'supplier_invoice') {
|
||||||
$classpath = 'fourn/class';
|
$classpath = 'fourn/class';
|
||||||
$module = 'fournisseur';
|
$module = 'fournisseur';
|
||||||
$classfile = 'fournisseur.facture';
|
$classfile = 'fournisseur.facture';
|
||||||
@@ -13943,7 +13948,7 @@ function getElementProperties($elementType)
|
|||||||
$classfile = 'societeaccount';
|
$classfile = 'societeaccount';
|
||||||
$classname = 'SocieteAccount';
|
$classname = 'SocieteAccount';
|
||||||
$module = 'societe';
|
$module = 'societe';
|
||||||
} elseif ($elementType == 'websitepage') {
|
} elseif ($elementType == 'websitepage' || $elementType == 'website_page') {
|
||||||
$classpath = 'website/class';
|
$classpath = 'website/class';
|
||||||
$classfile = 'websitepage';
|
$classfile = 'websitepage';
|
||||||
$classname = 'Websitepage';
|
$classname = 'Websitepage';
|
||||||
@@ -13994,15 +13999,30 @@ function getElementProperties($elementType)
|
|||||||
$classname = 'Ecmfiles';
|
$classname = 'Ecmfiles';
|
||||||
$table_element = 'ecmfiles';
|
$table_element = 'ecmfiles';
|
||||||
$subelement = '';
|
$subelement = '';
|
||||||
} elseif ($elementType == 'knowledgerecord') {
|
} elseif ($elementType == 'knowledgerecord' || $elementType == 'knowledgemanagement') {
|
||||||
$module = '';
|
$module = '';
|
||||||
$classpath = 'knowledgemanagement/class';
|
$classpath = 'knowledgemanagement/class';
|
||||||
$classfile = 'knowledgerecord';
|
$classfile = 'knowledgerecord';
|
||||||
$classname = 'KnowledgeRecord';
|
$classname = 'KnowledgeRecord';
|
||||||
$table_element = 'knowledgemanagement_knowledgerecord';
|
$table_element = 'knowledgemanagement_knowledgerecord';
|
||||||
$subelement = '';
|
$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)) {
|
if (empty($classfile)) {
|
||||||
$classfile = strtolower($subelement);
|
$classfile = strtolower($subelement);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,3 +100,5 @@ ChooseCategory=Choose category
|
|||||||
UseOrOperatorForCategories=Use 'OR' operator for categories
|
UseOrOperatorForCategories=Use 'OR' operator for categories
|
||||||
AddObjectIntoCategory=Assign to the category
|
AddObjectIntoCategory=Assign to the category
|
||||||
AddTicketIntoCategory=Assign the category to the ticket
|
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
|
EditInLine=Edit inline
|
||||||
AddWebsite=Add website
|
AddWebsite=Add website
|
||||||
WebsitePage=Website page
|
WebsitePage=Website page
|
||||||
|
WebsitePages=Website pages
|
||||||
Webpage=Web page/container
|
Webpage=Web page/container
|
||||||
AddPage=Add page/container
|
AddPage=Add page/container
|
||||||
PageContainer=Page
|
PageContainer=Page
|
||||||
|
|||||||
Reference in New Issue
Block a user