29 require
'../../main.inc.php';
30 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/lib/treeview.lib.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
35 $langs->loadLangs(array(
"main"),
"categories",
"takepos",
"printing");
41 $catname =
GETPOST(
'catname',
'alpha');
42 $action =
GETPOST(
'action',
'aZ09');
43 $printer1 =
GETPOST(
'printer1',
'alpha');
44 $printer2 =
GETPOST(
'printer2',
'alpha');
45 $printer3 =
GETPOST(
'printer3',
'alpha');
47 if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type];
52 if ($action ==
"SavePrinter1") {
53 $printedcategories =
";";
54 if (is_array($printer1))
foreach ($printer1 as $cat) {
55 $printedcategories = $printedcategories.$cat.
";";
57 dolibarr_set_const($db,
"TAKEPOS_PRINTED_CATEGORIES_1", $printedcategories,
'chaine', 0,
'', $conf->entity);
60 if ($action ==
"SavePrinter2") {
61 $printedcategories =
";";
62 if (is_array($printer2))
foreach ($printer2 as $cat) {
63 $printedcategories = $printedcategories.$cat.
";";
65 dolibarr_set_const($db,
"TAKEPOS_PRINTED_CATEGORIES_2", $printedcategories,
'chaine', 0,
'', $conf->entity);
68 if ($action ==
"SavePrinter3") {
69 $printedcategories =
";";
70 if (is_array($printer3))
foreach ($printer3 as $cat) {
71 $printedcategories = $printedcategories.$cat.
";";
73 dolibarr_set_const($db,
"TAKEPOS_PRINTED_CATEGORIES_3", $printedcategories,
'chaine', 0,
'', $conf->entity);
82 $form =
new Form($db);
84 if ($type == Categorie::TYPE_PRODUCT) {
85 $title = $langs->trans(
"ProductsCategoriesArea");
86 $typetext =
'product';
87 } elseif ($type == Categorie::TYPE_SUPPLIER) {
88 $title = $langs->trans(
"SuppliersCategoriesArea");
89 $typetext =
'supplier';
90 } elseif ($type == Categorie::TYPE_CUSTOMER) {
91 $title = $langs->trans(
"CustomersCategoriesArea");
92 $typetext =
'customer';
93 } elseif ($type == Categorie::TYPE_MEMBER) {
94 $title = $langs->trans(
"MembersCategoriesArea");
96 } elseif ($type == Categorie::TYPE_CONTACT) {
97 $title = $langs->trans(
"ContactsCategoriesArea");
98 $typetext =
'contact';
99 } elseif ($type == Categorie::TYPE_ACCOUNT) {
100 $title = $langs->trans(
"AccountsCategoriesArea");
101 $typetext =
'bank_account';
102 } elseif ($type == Categorie::TYPE_PROJECT) {
103 $title = $langs->trans(
"ProjectsCategoriesArea");
104 $typetext =
'project';
105 } elseif ($type == Categorie::TYPE_USER) {
106 $title = $langs->trans(
"UsersCategoriesArea");
109 $title = $langs->trans(
"CategoriesArea");
110 $typetext =
'unknown';
114 '/includes/jquery/plugins/jquerytreeview/jquery.treeview.js',
115 '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js',
117 $arrayofcss = array(
'/includes/jquery/plugins/jquerytreeview/jquery.treeview.css');
119 llxHeader(
'', $title,
'',
'', 0, 0, $arrayofjs, $arrayofcss);
126 print '<div class="fichecenter"><div class="fichethirdleft">';
130 print
'</div><div class="fichetwothirdright"><div class="ficheaddleft">';
134 print
'</div></div></div>';
136 print
'<div class="fichecenter"><br>';
140 $cate_arbo = $categstatic->get_full_arbo($typetext);
143 $fulltree = $cate_arbo;
147 $data[] = array(
'rowid'=>0,
'fk_menu'=>-1,
'title'=>
"racine",
'mainmenu'=>
'',
'leftmenu'=>
'',
'fk_mainmenu'=>
'',
'fk_leftmenu'=>
'');
148 foreach ($fulltree as $key => $val)
150 $categstatic->id = $val[
'id'];
151 $categstatic->ref = $val[
'label'];
152 $categstatic->color = $val[
'color'];
153 $categstatic->type = $type;
154 $li = $categstatic->getNomUrl(1,
'', 60);
158 'rowid'=>$val[
'rowid'],
159 'fk_menu'=>$val[
'fk_menu'],
160 'fk_menu'=>$val[
'fk_parent'],
161 'label'=>$val[
'label']
166 print
'<table class="liste nohover" width="100%">';
167 print
'<tr class="liste_titre"><td>'.$langs->trans(
"Printer").
' 1</td><td></td><td class="right">';
169 $nbofentries = (count($data) - 1);
170 print
'<form action="orderprinters.php">';
171 if ($nbofentries > 0)
173 print
'<tr class="pair"><td colspan="3">';
174 print
'<input type="hidden" name="action" value="SavePrinter1">';
175 foreach ($data as $row) {
176 if (strpos($conf->global->TAKEPOS_PRINTED_CATEGORIES_1,
';'.$row[
"rowid"].
';') !==
false) $checked =
'checked';
else $checked =
'';
177 if ($row[
"fk_menu"] == 0) print
'<input type="checkbox" name="printer1[]" value="'.$row[
"rowid"].
'" '.$checked.
'>'.$row[
"label"].
'<br>';
181 print
'<tr class="pair">';
182 print
'<td colspan="3"><table class="nobordernopadding"><tr class="nobordernopadding"><td>'.img_picto_common(
'',
'treemenu/branchbottom.gif').
'</td>';
183 print
'<td valign="middle">';
184 print $langs->trans(
"NoCategoryYet");
186 print
'<td> </td>';
187 print
'</table></td>';
191 print
'<input type="submit" class="button button-save" value="'.$langs->trans(
"Save").
'"></form><br><br>';
194 print
'<table class="liste nohover" width="100%">';
195 print
'<tr class="liste_titre"><td>'.$langs->trans(
"Printer").
' 2</td><td></td><td class="right">';
197 $nbofentries = (count($data) - 1);
198 print
'<form action="orderprinters.php">';
199 if ($nbofentries > 0)
201 print
'<tr class="pair"><td colspan="3">';
202 print
'<input type="hidden" name="action" value="SavePrinter2">';
203 foreach ($data as $row) {
204 if (strpos($conf->global->TAKEPOS_PRINTED_CATEGORIES_2,
';'.$row[
"rowid"].
';') !==
false) $checked =
'checked';
else $checked =
'';
205 if ($row[
"fk_menu"] == 0) print
'<input type="checkbox" name="printer2[]" value="'.$row[
"rowid"].
'" '.$checked.
'>'.$row[
"label"].
'<br>';
209 print
'<tr class="pair">';
210 print
'<td colspan="3"><table class="nobordernopadding"><tr class="nobordernopadding"><td>'.img_picto_common(
'',
'treemenu/branchbottom.gif').
'</td>';
211 print
'<td valign="middle">';
212 print $langs->trans(
"NoCategoryYet");
214 print
'<td> </td>';
215 print
'</table></td>';
219 print
'<input type="submit" class="button button-save" value="'.$langs->trans(
"Save").
'"></form>';
222 print
'<table class="liste nohover" width="100%">';
223 print
'<tr class="liste_titre"><td>'.$langs->trans(
"Printer").
' 3</td><td></td><td class="right">';
225 $nbofentries = (count($data) - 1);
226 print
'<form action="orderprinters.php">';
227 if ($nbofentries > 0)
229 print
'<tr class="pair"><td colspan="3">';
230 print
'<input type="hidden" name="action" value="SavePrinter3">';
231 foreach ($data as $row) {
232 if (strpos($conf->global->TAKEPOS_PRINTED_CATEGORIES_3,
';'.$row[
"rowid"].
';') !==
false) $checked =
'checked';
else $checked =
'';
233 if ($row[
"fk_menu"] == 0) print
'<input type="checkbox" name="printer3[]" value="'.$row[
"rowid"].
'" '.$checked.
'>'.$row[
"label"].
'<br>';
237 print
'<tr class="pair">';
238 print
'<td colspan="3"><table class="nobordernopadding"><tr class="nobordernopadding"><td>'.img_picto_common(
'',
'treemenu/branchbottom.gif').
'</td>';
239 print
'<td valign="middle">';
240 print $langs->trans(
"NoCategoryYet");
242 print
'<td> </td>';
243 print
'</table></td>';
248 print
'<input type="submit" class="button button-save" value="'.$langs->trans(
"Save").
'"></form>';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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).
Class to manage categories.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
print
Draft customers invoices.
dol_htmlcleanlastbr($stringtodecode)
This function remove all ending and br at end.