32require
'../../main.inc.php';
40require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/lib/treeview.lib.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
45$langs->loadLangs(array(
"main",
"categories",
"takepos",
"printing"));
49$action =
GETPOST(
'action',
'aZ09');
50$printer1 =
GETPOST(
'printer1',
'alpha');
51$printer2 =
GETPOST(
'printer2',
'alpha');
52$printer3 =
GETPOST(
'printer3',
'alpha');
56if (is_numeric($type)) {
57 $type = array_search($type, $categstatic->MAP_ID);
60if (!$user->hasRight(
'categorie',
'lire')) {
69if ($action ==
"SavePrinter1") {
70 $printedcategories =
";";
71 if (is_array($printer1)) {
72 foreach ($printer1 as $cat) {
73 $printedcategories = $printedcategories.$cat.
";";
76 dolibarr_set_const($db,
"TAKEPOS_PRINTED_CATEGORIES_1", $printedcategories,
'chaine', 0,
'', $conf->entity);
79if ($action ==
"SavePrinter2") {
80 $printedcategories =
";";
81 if (is_array($printer2)) {
82 foreach ($printer2 as $cat) {
83 $printedcategories = $printedcategories.$cat.
";";
86 dolibarr_set_const($db,
"TAKEPOS_PRINTED_CATEGORIES_2", $printedcategories,
'chaine', 0,
'', $conf->entity);
89if ($action ==
"SavePrinter3") {
90 $printedcategories =
";";
91 if (is_array($printer3)) {
92 foreach ($printer3 as $cat) {
93 $printedcategories = $printedcategories.$cat.
";";
96 dolibarr_set_const($db,
"TAKEPOS_PRINTED_CATEGORIES_3", $printedcategories,
'chaine', 0,
'', $conf->entity);
105$form =
new Form($db);
107$title = $langs->trans(
"Categories");
108$title .=
' ('.$langs->trans(empty(Categorie::$MAP_TYPE_TITLE_AREA[$type]) ? ucfirst($type) :
Categorie::$MAP_TYPE_TITLE_AREA[$type]).
')';
111 '/includes/jquery/plugins/jquerytreeview/jquery.treeview.js',
112 '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js',
114$arrayofcss = array(
'/includes/jquery/plugins/jquerytreeview/jquery.treeview.css');
116llxHeader(
'', $title,
'',
'', 0, 0, $arrayofjs, $arrayofcss,
'',
'mod-takepos page-admin_orderprinters');
123print
'<div class="fichecenter"><div class="fichethirdleft">';
125print
'</div><div class="fichetwothirdright">';
130print
'<div class="fichecenter"><br>';
134$cate_arbo = $categstatic->get_full_arbo($type);
137$fulltree = $cate_arbo;
141$data[] = array(
'rowid' => 0,
'fk_menu' => -1,
'title' =>
"racine",
'mainmenu' =>
'',
'leftmenu' =>
'',
'fk_mainmenu' =>
'',
'fk_leftmenu' =>
'');
142foreach ($fulltree as $key => $val) {
143 $categstatic->id = $val[
'id'];
144 $categstatic->ref = $val[
'label'];
145 $categstatic->color = $val[
'color'];
146 $categstatic->type = $type;
148 $li = $categstatic->getNomUrl(1,
'', 60);
153 'rowid' => $val[
'rowid'],
154 'fk_menu' => empty($val[
'fk_menu']) ? 0 : $val[
'fk_menu'],
155 'fk_parent' => $val[
'fk_parent'],
156 'label' => $val[
'label']
161print
'<table class="liste nohover" width="100%">';
162print
'<tr class="liste_titre"><td>'.$langs->trans(
"Printer").
' 1</td><td></td><td class="right">';
164$nbofentries = (count($data) - 1);
165print
'<form action="orderprinters.php">';
166print
'<input type="hidden" name="token" value="'.newToken().
'">';
167if ($nbofentries > 0) {
168 print
'<tr class="pair"><td colspan="3">';
169 print
'<input type="hidden" name="action" value="SavePrinter1">';
170 foreach ($data as $row) {
171 if (strpos(
getDolGlobalString(
'TAKEPOS_PRINTED_CATEGORIES_1'),
';'.$row[
"rowid"].
';') !==
false) {
172 $checked =
'checked';
176 if ($row[
"fk_menu"] >= 0) {
177 print
'<input type="checkbox" name="printer1[]" value="'.$row[
"rowid"].
'" '.$checked.
'>'.$row[
"label"].
'<br>';
182 print
'<tr class="pair">';
183 print
'<td colspan="3"><table class="nobordernopadding"><tr class="nobordernopadding"><td>'.img_picto_common(
'',
'treemenu/branchbottom.gif').
'</td>';
184 print
'<td valign="middle">';
185 print $langs->trans(
"NoCategoryYet");
187 print
'<td> </td>';
188 print
'</table></td>';
192print
'<input type="submit" class="button button-save" value="'.$langs->trans(
"Save").
'"></form><br><br>';
195print
'<table class="liste nohover" width="100%">';
196print
'<tr class="liste_titre"><td>'.$langs->trans(
"Printer").
' 2</td><td></td><td class="right">';
198$nbofentries = (count($data) - 1);
199print
'<form action="orderprinters.php">';
200print
'<input type="hidden" name="token" value="'.newToken().
'">';
201if ($nbofentries > 0) {
202 print
'<tr class="pair"><td colspan="3">';
203 print
'<input type="hidden" name="action" value="SavePrinter2">';
204 foreach ($data as $row) {
205 if (strpos(
getDolGlobalString(
'TAKEPOS_PRINTED_CATEGORIES_2'),
';'.$row[
"rowid"].
';') !==
false) {
206 $checked =
'checked';
210 if ($row[
"fk_menu"] >= 0) {
211 print
'<input type="checkbox" name="printer2[]" value="'.$row[
"rowid"].
'" '.$checked.
'>'.$row[
"label"].
'<br>';
216 print
'<tr class="pair">';
217 print
'<td colspan="3"><table class="nobordernopadding"><tr class="nobordernopadding"><td>'.img_picto_common(
'',
'treemenu/branchbottom.gif').
'</td>';
218 print
'<td valign="middle">';
219 print $langs->trans(
"NoCategoryYet");
221 print
'<td> </td>';
222 print
'</table></td>';
226print
'<input type="submit" class="button button-save" value="'.$langs->trans(
"Save").
'"></form>';
229print
'<table class="liste nohover" width="100%">';
230print
'<tr class="liste_titre"><td>'.$langs->trans(
"Printer").
' 3</td><td></td><td class="right">';
232$nbofentries = (count($data) - 1);
233print
'<form action="orderprinters.php">';
234print
'<input type="hidden" name="token" value="'.newToken().
'">';
235if ($nbofentries > 0) {
236 print
'<tr class="pair"><td colspan="3">';
237 print
'<input type="hidden" name="action" value="SavePrinter3">';
238 foreach ($data as $row) {
239 if (strpos(
getDolGlobalString(
'TAKEPOS_PRINTED_CATEGORIES_3'),
';'.$row[
"rowid"].
';') !==
false) {
240 $checked =
'checked';
244 if ($row[
"fk_menu"] >= 0) {
245 print
'<input type="checkbox" name="printer3[]" value="'.$row[
"rowid"].
'" '.$checked.
'>'.$row[
"label"].
'<br>';
250 print
'<tr class="pair">';
251 print
'<td colspan="3"><table class="nobordernopadding"><tr class="nobordernopadding"><td>'.img_picto_common(
'',
'treemenu/branchbottom.gif').
'</td>';
252 print
'<td valign="middle">';
253 print $langs->trans(
"NoCategoryYet");
255 print
'<td> </td>';
256 print
'</table></td>';
261print
'<input type="submit" class="button button-save" value="'.$langs->trans(
"Save").
'"></form>';
$id
Support class for third parties, contacts, members, users or resources.
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).
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage categories.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.