30require
'../../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/lib/treeview.lib.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
36$langs->loadLangs(array(
"main",
"categories",
"takepos",
"printing"));
40$catname =
GETPOST(
'catname',
'alpha');
41$action =
GETPOST(
'action',
'aZ09');
42$printer1 =
GETPOST(
'printer1',
'alpha');
43$printer2 =
GETPOST(
'printer2',
'alpha');
44$printer3 =
GETPOST(
'printer3',
'alpha');
46if (is_numeric($type)) {
47 $type = Categorie::$MAP_ID_TO_CODE[$type];
50if (!$user->hasRight(
'categorie',
'lire')) {
59if ($action ==
"SavePrinter1") {
60 $printedcategories =
";";
61 if (is_array($printer1)) {
62 foreach ($printer1 as $cat) {
63 $printedcategories = $printedcategories.$cat.
";";
66 dolibarr_set_const($db,
"TAKEPOS_PRINTED_CATEGORIES_1", $printedcategories,
'chaine', 0,
'', $conf->entity);
69if ($action ==
"SavePrinter2") {
70 $printedcategories =
";";
71 if (is_array($printer2)) {
72 foreach ($printer2 as $cat) {
73 $printedcategories = $printedcategories.$cat.
";";
76 dolibarr_set_const($db,
"TAKEPOS_PRINTED_CATEGORIES_2", $printedcategories,
'chaine', 0,
'', $conf->entity);
79if ($action ==
"SavePrinter3") {
80 $printedcategories =
";";
81 if (is_array($printer3)) {
82 foreach ($printer3 as $cat) {
83 $printedcategories = $printedcategories.$cat.
";";
86 dolibarr_set_const($db,
"TAKEPOS_PRINTED_CATEGORIES_3", $printedcategories,
'chaine', 0,
'', $conf->entity);
97if ($type == Categorie::TYPE_PRODUCT) {
98 $title = $langs->trans(
"ProductsCategoriesArea");
99 $typetext =
'product';
100} elseif ($type == Categorie::TYPE_SUPPLIER) {
101 $title = $langs->trans(
"SuppliersCategoriesArea");
102 $typetext =
'supplier';
103} elseif ($type == Categorie::TYPE_CUSTOMER) {
104 $title = $langs->trans(
"CustomersCategoriesArea");
105 $typetext =
'customer';
106} elseif ($type == Categorie::TYPE_MEMBER) {
107 $title = $langs->trans(
"MembersCategoriesArea");
108 $typetext =
'member';
109} elseif ($type == Categorie::TYPE_CONTACT) {
110 $title = $langs->trans(
"ContactsCategoriesArea");
111 $typetext =
'contact';
112} elseif ($type == Categorie::TYPE_ACCOUNT) {
113 $title = $langs->trans(
"AccountsCategoriesArea");
114 $typetext =
'bank_account';
115} elseif ($type == Categorie::TYPE_PROJECT) {
116 $title = $langs->trans(
"ProjectsCategoriesArea");
117 $typetext =
'project';
118} elseif ($type == Categorie::TYPE_USER) {
119 $title = $langs->trans(
"UsersCategoriesArea");
122 $title = $langs->trans(
"CategoriesArea");
123 $typetext =
'unknown';
127 '/includes/jquery/plugins/jquerytreeview/jquery.treeview.js',
128 '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js',
130$arrayofcss = array(
'/includes/jquery/plugins/jquerytreeview/jquery.treeview.css');
132llxHeader(
'', $title,
'',
'', 0, 0, $arrayofjs, $arrayofcss);
139print
'<div class="fichecenter"><div class="fichethirdleft">';
141print
'</div><div class="fichetwothirdright">';
146print
'<div class="fichecenter"><br>';
150$cate_arbo = $categstatic->get_full_arbo($typetext);
153$fulltree = $cate_arbo;
157$data[] = array(
'rowid'=>0,
'fk_menu'=>-1,
'title'=>
"racine",
'mainmenu'=>
'',
'leftmenu'=>
'',
'fk_mainmenu'=>
'',
'fk_leftmenu'=>
'');
158foreach ($fulltree as $key => $val) {
159 $categstatic->id = $val[
'id'];
160 $categstatic->ref = $val[
'label'];
161 $categstatic->color = $val[
'color'];
162 $categstatic->type = $type;
164 $li = $categstatic->getNomUrl(1,
'', 60);
169 'rowid'=>$val[
'rowid'],
170 'fk_menu'=>$val[
'fk_menu'],
171 'fk_parent'=>$val[
'fk_parent'],
172 'label'=>$val[
'label']
177print
'<table class="liste nohover" width="100%">';
178print
'<tr class="liste_titre"><td>'.$langs->trans(
"Printer").
' 1</td><td></td><td class="right">';
180$nbofentries = (count($data) - 1);
181print
'<form action="orderprinters.php">';
182print
'<input type="hidden" name="token" value="'.newToken().
'">';
183if ($nbofentries > 0) {
184 print
'<tr class="pair"><td colspan="3">';
185 print
'<input type="hidden" name="action" value="SavePrinter1">';
186 foreach ($data as $row) {
187 if (strpos($conf->global->TAKEPOS_PRINTED_CATEGORIES_1,
';'.$row[
"rowid"].
';') !==
false) {
188 $checked =
'checked';
192 if ($row[
"fk_menu"] >= 0) {
193 print
'<input type="checkbox" name="printer1[]" value="'.$row[
"rowid"].
'" '.$checked.
'>'.$row[
"label"].
'<br>';
198 print
'<tr class="pair">';
199 print
'<td colspan="3"><table class="nobordernopadding"><tr class="nobordernopadding"><td>'.img_picto_common(
'',
'treemenu/branchbottom.gif').
'</td>';
200 print
'<td valign="middle">';
201 print $langs->trans(
"NoCategoryYet");
203 print
'<td> </td>';
204 print
'</table></td>';
208print
'<input type="submit" class="button button-save" value="'.$langs->trans(
"Save").
'"></form><br><br>';
211print
'<table class="liste nohover" width="100%">';
212print
'<tr class="liste_titre"><td>'.$langs->trans(
"Printer").
' 2</td><td></td><td class="right">';
214$nbofentries = (count($data) - 1);
215print
'<form action="orderprinters.php">';
216print
'<input type="hidden" name="token" value="'.newToken().
'">';
217if ($nbofentries > 0) {
218 print
'<tr class="pair"><td colspan="3">';
219 print
'<input type="hidden" name="action" value="SavePrinter2">';
220 foreach ($data as $row) {
221 if (strpos($conf->global->TAKEPOS_PRINTED_CATEGORIES_2,
';'.$row[
"rowid"].
';') !==
false) {
222 $checked =
'checked';
226 if ($row[
"fk_menu"] >= 0) {
227 print
'<input type="checkbox" name="printer2[]" value="'.$row[
"rowid"].
'" '.$checked.
'>'.$row[
"label"].
'<br>';
232 print
'<tr class="pair">';
233 print
'<td colspan="3"><table class="nobordernopadding"><tr class="nobordernopadding"><td>'.img_picto_common(
'',
'treemenu/branchbottom.gif').
'</td>';
234 print
'<td valign="middle">';
235 print $langs->trans(
"NoCategoryYet");
237 print
'<td> </td>';
238 print
'</table></td>';
242print
'<input type="submit" class="button button-save" value="'.$langs->trans(
"Save").
'"></form>';
245print
'<table class="liste nohover" width="100%">';
246print
'<tr class="liste_titre"><td>'.$langs->trans(
"Printer").
' 3</td><td></td><td class="right">';
248$nbofentries = (count($data) - 1);
249print
'<form action="orderprinters.php">';
250print
'<input type="hidden" name="token" value="'.newToken().
'">';
251if ($nbofentries > 0) {
252 print
'<tr class="pair"><td colspan="3">';
253 print
'<input type="hidden" name="action" value="SavePrinter3">';
254 foreach ($data as $row) {
255 if (strpos($conf->global->TAKEPOS_PRINTED_CATEGORIES_3,
';'.$row[
"rowid"].
';') !==
false) {
256 $checked =
'checked';
260 if ($row[
"fk_menu"] >= 0) {
261 print
'<input type="checkbox" name="printer3[]" value="'.$row[
"rowid"].
'" '.$checked.
'>'.$row[
"label"].
'<br>';
266 print
'<tr class="pair">';
267 print
'<td colspan="3"><table class="nobordernopadding"><tr class="nobordernopadding"><td>'.img_picto_common(
'',
'treemenu/branchbottom.gif').
'</td>';
268 print
'<td valign="middle">';
269 print $langs->trans(
"NoCategoryYet");
271 print
'<td> </td>';
272 print
'</table></td>';
277print
'<input type="submit" class="button button-save" value="'.$langs->trans(
"Save").
'"></form>';
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage categories.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.