@@ -19,11 +19,21 @@ discard block |
||
19 | 19 | //if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language |
20 | 20 | //if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); |
21 | 21 | //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); |
22 | -if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); |
|
23 | -if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); |
|
24 | -if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); |
|
25 | -if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); |
|
26 | -if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); |
|
22 | +if (! defined('NOCSRFCHECK')) { |
|
23 | + define('NOCSRFCHECK','1'); |
|
24 | +} |
|
25 | +if (! defined('NOTOKENRENEWAL')) { |
|
26 | + define('NOTOKENRENEWAL','1'); |
|
27 | +} |
|
28 | +if (! defined('NOREQUIREMENU')) { |
|
29 | + define('NOREQUIREMENU','1'); |
|
30 | +} |
|
31 | +if (! defined('NOREQUIREHTML')) { |
|
32 | + define('NOREQUIREHTML','1'); |
|
33 | +} |
|
34 | +if (! defined('NOREQUIREAJAX')) { |
|
35 | + define('NOREQUIREAJAX','1'); |
|
36 | +} |
|
27 | 37 | |
28 | 38 | $_GET['theme']="md"; // Force theme. MD theme provides better look and feel to TakePOS |
29 | 39 | |
@@ -32,7 +42,9 @@ discard block |
||
32 | 42 | $langs->loadLangs(array("bills","orders","commercial","cashdesk")); |
33 | 43 | |
34 | 44 | $floor=GETPOST('floor','alpha'); |
35 | -if ($floor=="") $floor=1; |
|
45 | +if ($floor=="") { |
|
46 | + $floor=1; |
|
47 | +} |
|
36 | 48 | $id = GETPOST('id','int'); |
37 | 49 | $action = GETPOST('action','alpha'); |
38 | 50 | $left = GETPOST('left','alpha'); |
@@ -54,16 +66,26 @@ discard block |
||
54 | 66 | |
55 | 67 | if ($action=="update") |
56 | 68 | { |
57 | - if ($left>95) $left=95; |
|
58 | - if ($top>95) $top=95; |
|
59 | - if ($left>3 or $top>4) $db->query("update ".MAIN_DB_PREFIX."takepos_floor_tables set leftpos=$left, toppos=$top where label='$place'"); |
|
60 | - else $db->query("delete from ".MAIN_DB_PREFIX."takepos_floor_tables where label='$place'"); |
|
61 | -} |
|
69 | + if ($left>95) { |
|
70 | + $left=95; |
|
71 | + } |
|
72 | + if ($top>95) { |
|
73 | + $top=95; |
|
74 | + } |
|
75 | + if ($left>3 or $top>4) { |
|
76 | + $db->query("update ".MAIN_DB_PREFIX."takepos_floor_tables set leftpos=$left, toppos=$top where label='$place'"); |
|
77 | + } else { |
|
78 | + $db->query("delete from ".MAIN_DB_PREFIX."takepos_floor_tables where label='$place'"); |
|
79 | + } |
|
80 | + } |
|
62 | 81 | |
63 | 82 | if ($action=="updatename") |
64 | 83 | { |
65 | 84 | $newname = preg_replace("/[^a-zA-Z0-9\s]/", "", $newname); // Only English chars |
66 | - if (strlen($newname) > 3) $newname = substr($newname, 0, 3); // Only 3 chars |
|
85 | + if (strlen($newname) > 3) { |
|
86 | + $newname = substr($newname, 0, 3); |
|
87 | + } |
|
88 | + // Only 3 chars |
|
67 | 89 | $db->query("update ".MAIN_DB_PREFIX."takepos_floor_tables set label='$newname' where label='$place'"); |
68 | 90 | } |
69 | 91 | |
@@ -75,7 +97,9 @@ discard block |
||
75 | 97 | |
76 | 98 | // Title |
77 | 99 | $title='TakePOS - Dolibarr '.DOL_VERSION; |
78 | -if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title='TakePOS - '.$conf->global->MAIN_APPLICATION_TITLE; |
|
100 | +if (! empty($conf->global->MAIN_APPLICATION_TITLE)) { |
|
101 | + $title='TakePOS - '.$conf->global->MAIN_APPLICATION_TITLE; |
|
102 | +} |
|
79 | 103 | top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); |
80 | 104 | ?> |
81 | 105 | <link rel="stylesheet" href="css/pos.css?a=xxx"> |
@@ -147,8 +171,7 @@ discard block |
||
147 | 171 | $('#'+val.label).draggable().bind('click', function(){ |
148 | 172 | $(this).focus(); |
149 | 173 | }) |
150 | - <?php } |
|
151 | - else {?> |
|
174 | + <?php } else {?> |
|
152 | 175 | $('body').append('<div class="tablediv" onclick="LoadPlace('+val.label+');" style="position: absolute; left: '+val.leftpos+'%; top: '+val.toppos+'%;" id="'+val.label+'">'+val.label+'</div>'); |
153 | 176 | <?php } ?> |
154 | 177 | }); |
@@ -171,7 +194,10 @@ discard block |
||
171 | 194 | |
172 | 195 | <div style="position: absolute; left: 25%; bottom: 8%; width:50%; height:3%;"> |
173 | 196 | <center> |
174 | - <h1><img src="./img/arrow-prev.png" width="5%" onclick="location.href='floors.php?floor=<?php if ($floor>1) { $floor--; echo $floor; $floor++;} else echo "1"; ?>';"><?php echo $langs->trans("Floor")." ".$floor; ?><img src="./img/arrow-next.png" width="5%" onclick="location.href='floors.php?floor=<?php $floor++; echo $floor; ?>';"></h1> |
|
197 | + <h1><img src="./img/arrow-prev.png" width="5%" onclick="location.href='floors.php?floor=<?php if ($floor>1) { $floor--; echo $floor; $floor++;} else { |
|
198 | + echo "1"; |
|
199 | +} |
|
200 | +?>';"><?php echo $langs->trans("Floor")." ".$floor; ?><img src="./img/arrow-next.png" width="5%" onclick="location.href='floors.php?floor=<?php $floor++; echo $floor; ?>';"></h1> |
|
175 | 201 | </center> |
176 | 202 | </div> |
177 | 203 | </body> |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | // Copyright (C) 2018 Alxarafe/Alixar <[email protected]> |
32 | 32 | defined('BASE_PATH') or die('Single entry point through the index.php of the main folder'); |
33 | 33 | require DOL_BASE_PATH . '/main.inc.php'; |
34 | - // Load $user and permissions |
|
34 | + // Load $user and permissions |
|
35 | 35 | |
36 | 36 | $langs->loadLangs(array("bills","orders","commercial","cashdesk")); |
37 | 37 | |
@@ -66,15 +66,15 @@ discard block |
||
66 | 66 | |
67 | 67 | if ($action=="updatename") |
68 | 68 | { |
69 | - $newname = preg_replace("/[^a-zA-Z0-9\s]/", "", $newname); // Only English chars |
|
70 | - if (strlen($newname) > 3) $newname = substr($newname, 0, 3); // Only 3 chars |
|
69 | + $newname = preg_replace("/[^a-zA-Z0-9\s]/", "", $newname); // Only English chars |
|
70 | + if (strlen($newname) > 3) $newname = substr($newname, 0, 3); // Only 3 chars |
|
71 | 71 | $db->query("update ".MAIN_DB_PREFIX."takepos_floor_tables set label='$newname' where label='$place'"); |
72 | 72 | } |
73 | 73 | |
74 | 74 | if ($action=="add") |
75 | 75 | { |
76 | 76 | $asdf=$db->query("insert into ".MAIN_DB_PREFIX."takepos_floor_tables values ('', '', '', '45', '45', $floor)"); |
77 | - $db->query("update ".MAIN_DB_PREFIX."takepos_floor_tables set label=rowid where label=''"); // No empty table names |
|
77 | + $db->query("update ".MAIN_DB_PREFIX."takepos_floor_tables set label=rowid where label=''"); // No empty table names |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | // Title |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | $(this).focus(); |
153 | 153 | }) |
154 | 154 | <?php } |
155 | - else {?> |
|
155 | + else {?> |
|
156 | 156 | $('body').append('<div class="tablediv" onclick="LoadPlace('+val.label+');" style="position: absolute; left: '+val.leftpos+'%; top: '+val.toppos+'%;" id="'+val.label+'">'+val.label+'</div>'); |
157 | 157 | <?php } ?> |
158 | 158 | }); |
@@ -19,67 +19,67 @@ discard block |
||
19 | 19 | //if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language |
20 | 20 | //if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); |
21 | 21 | //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); |
22 | -if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); |
|
23 | -if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); |
|
24 | -if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); |
|
25 | -if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); |
|
26 | -if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); |
|
22 | +if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); |
|
23 | +if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); |
|
24 | +if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); |
|
25 | +if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); |
|
26 | +if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); |
|
27 | 27 | |
28 | -$_GET['theme']="md"; // Force theme. MD theme provides better look and feel to TakePOS |
|
28 | +$_GET['theme'] = "md"; // Force theme. MD theme provides better look and feel to TakePOS |
|
29 | 29 | |
30 | 30 | |
31 | 31 | // Copyright (C) 2018 Alxarafe/Alixar <[email protected]> |
32 | 32 | defined('BASE_PATH') or die('Single entry point through the index.php of the main folder'); |
33 | -require DOL_BASE_PATH . '/main.inc.php'; |
|
33 | +require DOL_BASE_PATH.'/main.inc.php'; |
|
34 | 34 | // Load $user and permissions |
35 | 35 | |
36 | -$langs->loadLangs(array("bills","orders","commercial","cashdesk")); |
|
36 | +$langs->loadLangs(array("bills", "orders", "commercial", "cashdesk")); |
|
37 | 37 | |
38 | -$floor=GETPOST('floor','alpha'); |
|
39 | -if ($floor=="") $floor=1; |
|
40 | -$id = GETPOST('id','int'); |
|
41 | -$action = GETPOST('action','alpha'); |
|
42 | -$left = GETPOST('left','alpha'); |
|
43 | -$top = GETPOST('top','alpha'); |
|
44 | -$place = GETPOST('place','int'); |
|
38 | +$floor = GETPOST('floor', 'alpha'); |
|
39 | +if ($floor == "") $floor = 1; |
|
40 | +$id = GETPOST('id', 'int'); |
|
41 | +$action = GETPOST('action', 'alpha'); |
|
42 | +$left = GETPOST('left', 'alpha'); |
|
43 | +$top = GETPOST('top', 'alpha'); |
|
44 | +$place = GETPOST('place', 'int'); |
|
45 | 45 | $newname = GETPOST('newname'); |
46 | -$mode = GETPOST('mode','alpha'); |
|
46 | +$mode = GETPOST('mode', 'alpha'); |
|
47 | 47 | |
48 | -if ($action=="getTables"){ |
|
49 | - $sql="SELECT * from ".MAIN_DB_PREFIX."takepos_floor_tables where floor=".$floor; |
|
48 | +if ($action == "getTables") { |
|
49 | + $sql = "SELECT * from ".MAIN_DB_PREFIX."takepos_floor_tables where floor=".$floor; |
|
50 | 50 | $resql = $db->query($sql); |
51 | 51 | $rows = array(); |
52 | - while($row = $db->fetch_array ($resql)){ |
|
52 | + while ($row = $db->fetch_array($resql)) { |
|
53 | 53 | $rows[] = $row; |
54 | 54 | } |
55 | 55 | echo json_encode($rows); |
56 | 56 | exit; |
57 | 57 | } |
58 | 58 | |
59 | -if ($action=="update") |
|
59 | +if ($action == "update") |
|
60 | 60 | { |
61 | - if ($left>95) $left=95; |
|
62 | - if ($top>95) $top=95; |
|
63 | - if ($left>3 or $top>4) $db->query("update ".MAIN_DB_PREFIX."takepos_floor_tables set leftpos=$left, toppos=$top where label='$place'"); |
|
61 | + if ($left > 95) $left = 95; |
|
62 | + if ($top > 95) $top = 95; |
|
63 | + if ($left > 3 or $top > 4) $db->query("update ".MAIN_DB_PREFIX."takepos_floor_tables set leftpos=$left, toppos=$top where label='$place'"); |
|
64 | 64 | else $db->query("delete from ".MAIN_DB_PREFIX."takepos_floor_tables where label='$place'"); |
65 | 65 | } |
66 | 66 | |
67 | -if ($action=="updatename") |
|
67 | +if ($action == "updatename") |
|
68 | 68 | { |
69 | 69 | $newname = preg_replace("/[^a-zA-Z0-9\s]/", "", $newname); // Only English chars |
70 | 70 | if (strlen($newname) > 3) $newname = substr($newname, 0, 3); // Only 3 chars |
71 | 71 | $db->query("update ".MAIN_DB_PREFIX."takepos_floor_tables set label='$newname' where label='$place'"); |
72 | 72 | } |
73 | 73 | |
74 | -if ($action=="add") |
|
74 | +if ($action == "add") |
|
75 | 75 | { |
76 | - $asdf=$db->query("insert into ".MAIN_DB_PREFIX."takepos_floor_tables values ('', '', '', '45', '45', $floor)"); |
|
76 | + $asdf = $db->query("insert into ".MAIN_DB_PREFIX."takepos_floor_tables values ('', '', '', '45', '45', $floor)"); |
|
77 | 77 | $db->query("update ".MAIN_DB_PREFIX."takepos_floor_tables set label=rowid where label=''"); // No empty table names |
78 | 78 | } |
79 | 79 | |
80 | 80 | // Title |
81 | -$title='TakePOS - Dolibarr '.DOL_VERSION; |
|
82 | -if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title='TakePOS - '.$conf->global->MAIN_APPLICATION_TITLE; |
|
81 | +$title = 'TakePOS - Dolibarr '.DOL_VERSION; |
|
82 | +if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $title = 'TakePOS - '.$conf->global->MAIN_APPLICATION_TITLE; |
|
83 | 83 | top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); |
84 | 84 | ?> |
85 | 85 | <link rel="stylesheet" href="css/pos.css?a=xxx"> |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | url: "floors.php", |
111 | 111 | data: { action: "update", left: left, top: top, place: idplace } |
112 | 112 | }).done(function( msg ) { |
113 | - window.location.href='floors.php?mode=edit&floor=<?php echo $floor;?>'; |
|
113 | + window.location.href='floors.php?mode=edit&floor=<?php echo $floor; ?>'; |
|
114 | 114 | }); |
115 | 115 | } |
116 | 116 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | url: "floors.php", |
122 | 122 | data: { action: "updatename", place: before, newname: after } |
123 | 123 | }).done(function( msg ) { |
124 | - window.location.href='floors.php?mode=edit&floor=<?php echo $floor;?>'; |
|
124 | + window.location.href='floors.php?mode=edit&floor=<?php echo $floor; ?>'; |
|
125 | 125 | }); |
126 | 126 | } |
127 | 127 | |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | $( document ).ready(function() { |
134 | 134 | $.getJSON('./floors.php?action=getTables&floor=<?php echo $floor; ?>', function(data) { |
135 | 135 | $.each(data, function(key, val) { |
136 | - <?php if ($mode=="edit"){?> |
|
136 | + <?php if ($mode == "edit") {?> |
|
137 | 137 | $('body').append('<div class="tablediv" contenteditable onblur="updatename('+val.label+');" style="position: absolute; left: '+val.leftpos+'%; top: '+val.toppos+'%;" id="'+val.label+'">'+val.label+'</div>'); |
138 | 138 | $( "#"+val.label ).draggable( |
139 | 139 | { |
@@ -162,12 +162,12 @@ discard block |
||
162 | 162 | </script> |
163 | 163 | </head> |
164 | 164 | <body style="overflow: hidden"> |
165 | -<?php if ($user->admin){?> |
|
165 | +<?php if ($user->admin) {?> |
|
166 | 166 | <div style="position: absolute; left: 0.1%; top: 0.8%; width:8%; height:11%;"> |
167 | -<?php if ($mode=="edit"){?> |
|
168 | -<a id="add" onclick="window.location.href='floors.php?mode=edit&action=add&floor=<?php echo $floor;?>';"><?php echo $langs->trans("AddTable"); ?></a> |
|
167 | +<?php if ($mode == "edit") {?> |
|
168 | +<a id="add" onclick="window.location.href='floors.php?mode=edit&action=add&floor=<?php echo $floor; ?>';"><?php echo $langs->trans("AddTable"); ?></a> |
|
169 | 169 | <?php } else { ?> |
170 | -<a onclick="window.location.href='floors.php?mode=edit&floor=<?php echo $floor;?>';"><?php echo $langs->trans("Edit"); ?></a> |
|
170 | +<a onclick="window.location.href='floors.php?mode=edit&floor=<?php echo $floor; ?>';"><?php echo $langs->trans("Edit"); ?></a> |
|
171 | 171 | <?php } ?> |
172 | 172 | </div> |
173 | 173 | <?php } |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | |
176 | 176 | <div style="position: absolute; left: 25%; bottom: 8%; width:50%; height:3%;"> |
177 | 177 | <center> |
178 | - <h1><img src="./img/arrow-prev.png" width="5%" onclick="location.href='floors.php?floor=<?php if ($floor>1) { $floor--; echo $floor; $floor++;} else echo "1"; ?>';"><?php echo $langs->trans("Floor")." ".$floor; ?><img src="./img/arrow-next.png" width="5%" onclick="location.href='floors.php?floor=<?php $floor++; echo $floor; ?>';"></h1> |
|
178 | + <h1><img src="./img/arrow-prev.png" width="5%" onclick="location.href='floors.php?floor=<?php if ($floor > 1) { $floor--; echo $floor; $floor++; } else echo "1"; ?>';"><?php echo $langs->trans("Floor")." ".$floor; ?><img src="./img/arrow-next.png" width="5%" onclick="location.href='floors.php?floor=<?php $floor++; echo $floor; ?>';"></h1> |
|
179 | 179 | </center> |
180 | 180 | </div> |
181 | 181 | </body> |
@@ -32,7 +32,7 @@ |
||
32 | 32 | |
33 | 33 | // Access control |
34 | 34 | if (! $user->admin) { |
35 | - accessforbidden(); |
|
35 | + accessforbidden(); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | // Parameters |
@@ -25,16 +25,16 @@ discard block |
||
25 | 25 | |
26 | 26 | // Copyright (C) 2018 Alxarafe/Alixar <[email protected]> |
27 | 27 | defined('BASE_PATH') or die('Single entry point through the index.php of the main folder'); |
28 | -require DOL_BASE_PATH . '/main.inc.php'; // Load $user and permissions |
|
28 | +require DOL_BASE_PATH.'/main.inc.php'; // Load $user and permissions |
|
29 | 29 | require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; |
30 | 30 | require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
31 | 31 | require_once '../lib/takepos.lib.php'; |
32 | 32 | |
33 | 33 | // Translations |
34 | -$langs->loadLangs(array("errors","admin","cashdesk")); |
|
34 | +$langs->loadLangs(array("errors", "admin", "cashdesk")); |
|
35 | 35 | |
36 | 36 | // Access control |
37 | -if (! $user->admin) { |
|
37 | +if (!$user->admin) { |
|
38 | 38 | accessforbidden(); |
39 | 39 | } |
40 | 40 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | llxHeader('', $langs->trans($page_name)); |
61 | 61 | |
62 | 62 | // Subheader |
63 | -$linkback = '<a href="'.($backtopage?$backtopage:DOL_URL_ROOT.'/admin/modules.php').'">'.$langs->trans("BackToModuleList").'</a>'; |
|
63 | +$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php').'">'.$langs->trans("BackToModuleList").'</a>'; |
|
64 | 64 | |
65 | 65 | print load_fiche_titre($langs->trans($page_name), $linkback, 'object_takepos@takepos'); |
66 | 66 |
@@ -29,9 +29,9 @@ discard block |
||
29 | 29 | // If socid provided by ajax company selector |
30 | 30 | if (! empty($_REQUEST['CASHDESK_ID_THIRDPARTY_id'])) |
31 | 31 | { |
32 | - $_GET['CASHDESK_ID_THIRDPARTY'] = GETPOST('CASHDESK_ID_THIRDPARTY_id','alpha'); |
|
33 | - $_POST['CASHDESK_ID_THIRDPARTY'] = GETPOST('CASHDESK_ID_THIRDPARTY_id','alpha'); |
|
34 | - $_REQUEST['CASHDESK_ID_THIRDPARTY'] = GETPOST('CASHDESK_ID_THIRDPARTY_id','alpha'); |
|
32 | + $_GET['CASHDESK_ID_THIRDPARTY'] = GETPOST('CASHDESK_ID_THIRDPARTY_id','alpha'); |
|
33 | + $_POST['CASHDESK_ID_THIRDPARTY'] = GETPOST('CASHDESK_ID_THIRDPARTY_id','alpha'); |
|
34 | + $_REQUEST['CASHDESK_ID_THIRDPARTY'] = GETPOST('CASHDESK_ID_THIRDPARTY_id','alpha'); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | // Security check |
@@ -44,35 +44,35 @@ discard block |
||
44 | 44 | */ |
45 | 45 | if (GETPOST('action','alpha') == 'set') |
46 | 46 | { |
47 | - $db->begin(); |
|
48 | - |
|
49 | - if (GETPOST('socid','int') < 0) $_POST["socid"]=''; |
|
50 | - |
|
51 | - $res = dolibarr_set_const($db,"CASHDESK_ID_THIRDPARTY",(GETPOST('socid','int') > 0 ? GETPOST('socid','int') : ''),'chaine',0,'',$conf->entity); |
|
52 | - $res = dolibarr_set_const($db,"CASHDESK_ID_BANKACCOUNT_CASH",(GETPOST('CASHDESK_ID_BANKACCOUNT_CASH','alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CASH','alpha') : ''),'chaine',0,'',$conf->entity); |
|
53 | - $res = dolibarr_set_const($db,"CASHDESK_ID_BANKACCOUNT_CHEQUE",(GETPOST('CASHDESK_ID_BANKACCOUNT_CHEQUE','alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CHEQUE','alpha') : ''),'chaine',0,'',$conf->entity); |
|
54 | - $res = dolibarr_set_const($db,"CASHDESK_ID_BANKACCOUNT_CB",(GETPOST('CASHDESK_ID_BANKACCOUNT_CB','alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CB','alpha') : ''),'chaine',0,'',$conf->entity); |
|
55 | - $res = dolibarr_set_const($db,"CASHDESK_ID_WAREHOUSE",(GETPOST('CASHDESK_ID_WAREHOUSE','alpha') > 0 ? GETPOST('CASHDESK_ID_WAREHOUSE','alpha') : ''),'chaine',0,'',$conf->entity); |
|
56 | - $res = dolibarr_set_const($db,"CASHDESK_NO_DECREASE_STOCK",GETPOST('CASHDESK_NO_DECREASE_STOCK','alpha'),'chaine',0,'',$conf->entity); |
|
57 | - $res = dolibarr_set_const($db,"CASHDESK_SERVICES", GETPOST('CASHDESK_SERVICES','alpha'),'chaine',0,'',$conf->entity); |
|
58 | - $res = dolibarr_set_const($db,"TAKEPOSCONNECTOR", GETPOST('TAKEPOSCONNECTOR','alpha'),'chaine',0,'',$conf->entity); |
|
59 | - $res = dolibarr_set_const($db,"TAKEPOS_BAR_RESTAURANT", GETPOST('TAKEPOS_BAR_RESTAURANT','alpha'),'chaine',0,'',$conf->entity); |
|
47 | + $db->begin(); |
|
48 | + |
|
49 | + if (GETPOST('socid','int') < 0) $_POST["socid"]=''; |
|
50 | + |
|
51 | + $res = dolibarr_set_const($db,"CASHDESK_ID_THIRDPARTY",(GETPOST('socid','int') > 0 ? GETPOST('socid','int') : ''),'chaine',0,'',$conf->entity); |
|
52 | + $res = dolibarr_set_const($db,"CASHDESK_ID_BANKACCOUNT_CASH",(GETPOST('CASHDESK_ID_BANKACCOUNT_CASH','alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CASH','alpha') : ''),'chaine',0,'',$conf->entity); |
|
53 | + $res = dolibarr_set_const($db,"CASHDESK_ID_BANKACCOUNT_CHEQUE",(GETPOST('CASHDESK_ID_BANKACCOUNT_CHEQUE','alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CHEQUE','alpha') : ''),'chaine',0,'',$conf->entity); |
|
54 | + $res = dolibarr_set_const($db,"CASHDESK_ID_BANKACCOUNT_CB",(GETPOST('CASHDESK_ID_BANKACCOUNT_CB','alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CB','alpha') : ''),'chaine',0,'',$conf->entity); |
|
55 | + $res = dolibarr_set_const($db,"CASHDESK_ID_WAREHOUSE",(GETPOST('CASHDESK_ID_WAREHOUSE','alpha') > 0 ? GETPOST('CASHDESK_ID_WAREHOUSE','alpha') : ''),'chaine',0,'',$conf->entity); |
|
56 | + $res = dolibarr_set_const($db,"CASHDESK_NO_DECREASE_STOCK",GETPOST('CASHDESK_NO_DECREASE_STOCK','alpha'),'chaine',0,'',$conf->entity); |
|
57 | + $res = dolibarr_set_const($db,"CASHDESK_SERVICES", GETPOST('CASHDESK_SERVICES','alpha'),'chaine',0,'',$conf->entity); |
|
58 | + $res = dolibarr_set_const($db,"TAKEPOSCONNECTOR", GETPOST('TAKEPOSCONNECTOR','alpha'),'chaine',0,'',$conf->entity); |
|
59 | + $res = dolibarr_set_const($db,"TAKEPOS_BAR_RESTAURANT", GETPOST('TAKEPOS_BAR_RESTAURANT','alpha'),'chaine',0,'',$conf->entity); |
|
60 | 60 | $res = dolibarr_set_const($db,"TAKEPOS_PRINT_SERVER", GETPOST('TAKEPOS_PRINT_SERVER','alpha'),'chaine',0,'',$conf->entity); |
61 | - $res = dolibarr_set_const($db,"TAKEPOS_ORDER_PRINTERS", GETPOST('TAKEPOS_ORDER_PRINTERS','alpha'),'chaine',0,'',$conf->entity); |
|
61 | + $res = dolibarr_set_const($db,"TAKEPOS_ORDER_PRINTERS", GETPOST('TAKEPOS_ORDER_PRINTERS','alpha'),'chaine',0,'',$conf->entity); |
|
62 | 62 | |
63 | - dol_syslog("admin/cashdesk: level ".GETPOST('level','alpha')); |
|
63 | + dol_syslog("admin/cashdesk: level ".GETPOST('level','alpha')); |
|
64 | 64 | |
65 | - if (! $res > 0) $error++; |
|
65 | + if (! $res > 0) $error++; |
|
66 | 66 | |
67 | - if (! $error) |
|
67 | + if (! $error) |
|
68 | 68 | { |
69 | 69 | $db->commit(); |
70 | - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); |
|
70 | + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); |
|
71 | 71 | } |
72 | 72 | else |
73 | 73 | { |
74 | 74 | $db->rollback(); |
75 | - setEventMessages($langs->trans("Error"), null, 'errors'); |
|
75 | + setEventMessages($langs->trans("Error"), null, 'errors'); |
|
76 | 76 | } |
77 | 77 | } |
78 | 78 | |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | |
104 | 104 | if (! empty($conf->service->enabled)) |
105 | 105 | { |
106 | - print '<tr class="oddeven"><td>'; |
|
107 | - print $langs->trans("CashdeskShowServices"); |
|
108 | - print '<td colspan="2">'; |
|
109 | - print $form->selectyesno("CASHDESK_SERVICES",$conf->global->CASHDESK_SERVICES,1); |
|
110 | - print "</td></tr>\n"; |
|
106 | + print '<tr class="oddeven"><td>'; |
|
107 | + print $langs->trans("CashdeskShowServices"); |
|
108 | + print '<td colspan="2">'; |
|
109 | + print $form->selectyesno("CASHDESK_SERVICES",$conf->global->CASHDESK_SERVICES,1); |
|
110 | + print "</td></tr>\n"; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | // Use Takepos printing |
@@ -118,11 +118,11 @@ discard block |
||
118 | 118 | print "</td></tr>\n"; |
119 | 119 | |
120 | 120 | if ($conf->global->TAKEPOSCONNECTOR){ |
121 | - print '<tr class="oddeven value"><td>'; |
|
122 | - print $langs->trans("IPAddress").' (<a href="http://en.takepos.com/connector">'.$langs->trans("TakeposConnectorNecesary").'</a>)'; |
|
123 | - print '<td colspan="2">'; |
|
124 | - print '<input type="text" size="20" id="TAKEPOS_PRINT_SERVER" name="TAKEPOS_PRINT_SERVER" value="'.$conf->global->TAKEPOS_PRINT_SERVER.'">'; |
|
125 | - print '</td></tr>'; |
|
121 | + print '<tr class="oddeven value"><td>'; |
|
122 | + print $langs->trans("IPAddress").' (<a href="http://en.takepos.com/connector">'.$langs->trans("TakeposConnectorNecesary").'</a>)'; |
|
123 | + print '<td colspan="2">'; |
|
124 | + print '<input type="text" size="20" id="TAKEPOS_PRINT_SERVER" name="TAKEPOS_PRINT_SERVER" value="'.$conf->global->TAKEPOS_PRINT_SERVER.'">'; |
|
125 | + print '</td></tr>'; |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | // Bar Restaurant mode |
@@ -133,11 +133,11 @@ discard block |
||
133 | 133 | print "</td></tr>\n"; |
134 | 134 | |
135 | 135 | if ($conf->global->TAKEPOS_BAR_RESTAURANT && $conf->global->TAKEPOSCONNECTOR){ |
136 | - print '<tr class="oddeven value"><td>'; |
|
137 | - print $langs->trans("OrderPrinters").' (<a href="orderprinters.php?leftmenu=setup">'.$langs->trans("Setup").'</a>)'; |
|
138 | - print '<td colspan="2">'; |
|
139 | - print $form->selectyesno("TAKEPOS_ORDER_PRINTERS",$conf->global->TAKEPOS_ORDER_PRINTERS,1); |
|
140 | - print '</td></tr>'; |
|
136 | + print '<tr class="oddeven value"><td>'; |
|
137 | + print $langs->trans("OrderPrinters").' (<a href="orderprinters.php?leftmenu=setup">'.$langs->trans("Setup").'</a>)'; |
|
138 | + print '<td colspan="2">'; |
|
139 | + print $form->selectyesno("TAKEPOS_ORDER_PRINTERS",$conf->global->TAKEPOS_ORDER_PRINTERS,1); |
|
140 | + print '</td></tr>'; |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | print '</table>'; |
@@ -157,57 +157,57 @@ discard block |
||
157 | 157 | if (! empty($conf->banque->enabled)) |
158 | 158 | { |
159 | 159 | |
160 | - print '<tr class="oddeven"><td>'.$langs->trans("CashDeskBankAccountForSell").'</td>'; |
|
161 | - print '<td colspan="2">'; |
|
162 | - $form->select_comptes($conf->global->CASHDESK_ID_BANKACCOUNT_CASH,'CASHDESK_ID_BANKACCOUNT_CASH',0,"courant=2",1); |
|
163 | - print '</td></tr>'; |
|
160 | + print '<tr class="oddeven"><td>'.$langs->trans("CashDeskBankAccountForSell").'</td>'; |
|
161 | + print '<td colspan="2">'; |
|
162 | + $form->select_comptes($conf->global->CASHDESK_ID_BANKACCOUNT_CASH,'CASHDESK_ID_BANKACCOUNT_CASH',0,"courant=2",1); |
|
163 | + print '</td></tr>'; |
|
164 | 164 | |
165 | 165 | |
166 | - print '<tr class="oddeven"><td>'.$langs->trans("CashDeskBankAccountForCheque").'</td>'; |
|
167 | - print '<td colspan="2">'; |
|
168 | - $form->select_comptes($conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE,'CASHDESK_ID_BANKACCOUNT_CHEQUE',0,"courant=1",1); |
|
169 | - print '</td></tr>'; |
|
166 | + print '<tr class="oddeven"><td>'.$langs->trans("CashDeskBankAccountForCheque").'</td>'; |
|
167 | + print '<td colspan="2">'; |
|
168 | + $form->select_comptes($conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE,'CASHDESK_ID_BANKACCOUNT_CHEQUE',0,"courant=1",1); |
|
169 | + print '</td></tr>'; |
|
170 | 170 | |
171 | 171 | |
172 | - print '<tr class="oddeven"><td>'.$langs->trans("CashDeskBankAccountForCB").'</td>'; |
|
173 | - print '<td colspan="2">'; |
|
174 | - $form->select_comptes($conf->global->CASHDESK_ID_BANKACCOUNT_CB,'CASHDESK_ID_BANKACCOUNT_CB',0,"courant=1",1); |
|
175 | - print '</td></tr>'; |
|
172 | + print '<tr class="oddeven"><td>'.$langs->trans("CashDeskBankAccountForCB").'</td>'; |
|
173 | + print '<td colspan="2">'; |
|
174 | + $form->select_comptes($conf->global->CASHDESK_ID_BANKACCOUNT_CB,'CASHDESK_ID_BANKACCOUNT_CB',0,"courant=1",1); |
|
175 | + print '</td></tr>'; |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | if (! empty($conf->stock->enabled)) |
179 | 179 | { |
180 | 180 | |
181 | - print '<tr class="oddeven"><td>'.$langs->trans("CashDeskDoNotDecreaseStock").'</td>'; // Force warehouse (this is not a default value) |
|
182 | - print '<td colspan="2">'; |
|
183 | - if (empty($conf->productbatch->enabled)) { |
|
184 | - print $form->selectyesno('CASHDESK_NO_DECREASE_STOCK',$conf->global->CASHDESK_NO_DECREASE_STOCK,1); |
|
185 | - } |
|
186 | - else |
|
187 | - { |
|
188 | - if (!$conf->global->CASHDESK_NO_DECREASE_STOCK) { |
|
189 | - $res = dolibarr_set_const($db,"CASHDESK_NO_DECREASE_STOCK",1,'chaine',0,'',$conf->entity); |
|
190 | - } |
|
191 | - print $langs->trans("Yes").'<br>'; |
|
192 | - print '<span class="opacitymedium">'.$langs->trans('StockDecreaseForPointOfSaleDisabledbyBatch').'</span>'; |
|
193 | - } |
|
194 | - print '</td></tr>'; |
|
195 | - |
|
196 | - $disabled=$conf->global->CASHDESK_NO_DECREASE_STOCK; |
|
197 | - |
|
198 | - |
|
199 | - print '<tr class="oddeven"><td>'.$langs->trans("CashDeskIdWareHouse").'</td>'; // Force warehouse (this is not a default value) |
|
200 | - print '<td colspan="2">'; |
|
201 | - if (! $disabled) |
|
202 | - { |
|
203 | - print $formproduct->selectWarehouses($conf->global->CASHDESK_ID_WAREHOUSE,'CASHDESK_ID_WAREHOUSE','',1,$disabled); |
|
204 | - print ' <a href="'.DOL_URL_ROOT.'/product/stock/card.php?action=create&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">('.$langs->trans("Create").')</a>'; |
|
205 | - } |
|
206 | - else |
|
207 | - { |
|
208 | - print '<span class="opacitymedium">'.$langs->trans("StockDecreaseForPointOfSaleDisabled").'</span>'; |
|
209 | - } |
|
210 | - print '</td></tr>'; |
|
181 | + print '<tr class="oddeven"><td>'.$langs->trans("CashDeskDoNotDecreaseStock").'</td>'; // Force warehouse (this is not a default value) |
|
182 | + print '<td colspan="2">'; |
|
183 | + if (empty($conf->productbatch->enabled)) { |
|
184 | + print $form->selectyesno('CASHDESK_NO_DECREASE_STOCK',$conf->global->CASHDESK_NO_DECREASE_STOCK,1); |
|
185 | + } |
|
186 | + else |
|
187 | + { |
|
188 | + if (!$conf->global->CASHDESK_NO_DECREASE_STOCK) { |
|
189 | + $res = dolibarr_set_const($db,"CASHDESK_NO_DECREASE_STOCK",1,'chaine',0,'',$conf->entity); |
|
190 | + } |
|
191 | + print $langs->trans("Yes").'<br>'; |
|
192 | + print '<span class="opacitymedium">'.$langs->trans('StockDecreaseForPointOfSaleDisabledbyBatch').'</span>'; |
|
193 | + } |
|
194 | + print '</td></tr>'; |
|
195 | + |
|
196 | + $disabled=$conf->global->CASHDESK_NO_DECREASE_STOCK; |
|
197 | + |
|
198 | + |
|
199 | + print '<tr class="oddeven"><td>'.$langs->trans("CashDeskIdWareHouse").'</td>'; // Force warehouse (this is not a default value) |
|
200 | + print '<td colspan="2">'; |
|
201 | + if (! $disabled) |
|
202 | + { |
|
203 | + print $formproduct->selectWarehouses($conf->global->CASHDESK_ID_WAREHOUSE,'CASHDESK_ID_WAREHOUSE','',1,$disabled); |
|
204 | + print ' <a href="'.DOL_URL_ROOT.'/product/stock/card.php?action=create&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">('.$langs->trans("Create").')</a>'; |
|
205 | + } |
|
206 | + else |
|
207 | + { |
|
208 | + print '<span class="opacitymedium">'.$langs->trans("StockDecreaseForPointOfSaleDisabled").'</span>'; |
|
209 | + } |
|
210 | + print '</td></tr>'; |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | print '</table>'; |
@@ -35,7 +35,9 @@ discard block |
||
35 | 35 | } |
36 | 36 | |
37 | 37 | // Security check |
38 | -if (!$user->admin) accessforbidden(); |
|
38 | +if (!$user->admin) { |
|
39 | + accessforbidden(); |
|
40 | +} |
|
39 | 41 | |
40 | 42 | $langs->loadLangs(array("admin", "cashdesk")); |
41 | 43 | |
@@ -46,7 +48,9 @@ discard block |
||
46 | 48 | { |
47 | 49 | $db->begin(); |
48 | 50 | |
49 | - if (GETPOST('socid','int') < 0) $_POST["socid"]=''; |
|
51 | + if (GETPOST('socid','int') < 0) { |
|
52 | + $_POST["socid"]=''; |
|
53 | + } |
|
50 | 54 | |
51 | 55 | $res = dolibarr_set_const($db,"CASHDESK_ID_THIRDPARTY",(GETPOST('socid','int') > 0 ? GETPOST('socid','int') : ''),'chaine',0,'',$conf->entity); |
52 | 56 | $res = dolibarr_set_const($db,"CASHDESK_ID_BANKACCOUNT_CASH",(GETPOST('CASHDESK_ID_BANKACCOUNT_CASH','alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CASH','alpha') : ''),'chaine',0,'',$conf->entity); |
@@ -62,14 +66,15 @@ discard block |
||
62 | 66 | |
63 | 67 | dol_syslog("admin/cashdesk: level ".GETPOST('level','alpha')); |
64 | 68 | |
65 | - if (! $res > 0) $error++; |
|
69 | + if (! $res > 0) { |
|
70 | + $error++; |
|
71 | + } |
|
66 | 72 | |
67 | 73 | if (! $error) |
68 | 74 | { |
69 | 75 | $db->commit(); |
70 | 76 | setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); |
71 | - } |
|
72 | - else |
|
77 | + } else |
|
73 | 78 | { |
74 | 79 | $db->rollback(); |
75 | 80 | setEventMessages($langs->trans("Error"), null, 'errors'); |
@@ -182,8 +187,7 @@ discard block |
||
182 | 187 | print '<td colspan="2">'; |
183 | 188 | if (empty($conf->productbatch->enabled)) { |
184 | 189 | print $form->selectyesno('CASHDESK_NO_DECREASE_STOCK',$conf->global->CASHDESK_NO_DECREASE_STOCK,1); |
185 | - } |
|
186 | - else |
|
190 | + } else |
|
187 | 191 | { |
188 | 192 | if (!$conf->global->CASHDESK_NO_DECREASE_STOCK) { |
189 | 193 | $res = dolibarr_set_const($db,"CASHDESK_NO_DECREASE_STOCK",1,'chaine',0,'',$conf->entity); |
@@ -202,8 +206,7 @@ discard block |
||
202 | 206 | { |
203 | 207 | print $formproduct->selectWarehouses($conf->global->CASHDESK_ID_WAREHOUSE,'CASHDESK_ID_WAREHOUSE','',1,$disabled); |
204 | 208 | print ' <a href="'.DOL_URL_ROOT.'/product/stock/card.php?action=create&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">('.$langs->trans("Create").')</a>'; |
205 | - } |
|
206 | - else |
|
209 | + } else |
|
207 | 210 | { |
208 | 211 | print '<span class="opacitymedium">'.$langs->trans("StockDecreaseForPointOfSaleDisabled").'</span>'; |
209 | 212 | } |
@@ -25,16 +25,16 @@ discard block |
||
25 | 25 | |
26 | 26 | // Copyright (C) 2018 Alxarafe/Alixar <[email protected]> |
27 | 27 | defined('BASE_PATH') or die('Single entry point through the index.php of the main folder'); |
28 | -require DOL_BASE_PATH . '/main.inc.php'; // Load $user and permissions |
|
28 | +require DOL_BASE_PATH.'/main.inc.php'; // Load $user and permissions |
|
29 | 29 | require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; |
30 | 30 | require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; |
31 | 31 | |
32 | 32 | // If socid provided by ajax company selector |
33 | -if (! empty($_REQUEST['CASHDESK_ID_THIRDPARTY_id'])) |
|
33 | +if (!empty($_REQUEST['CASHDESK_ID_THIRDPARTY_id'])) |
|
34 | 34 | { |
35 | - $_GET['CASHDESK_ID_THIRDPARTY'] = GETPOST('CASHDESK_ID_THIRDPARTY_id','alpha'); |
|
36 | - $_POST['CASHDESK_ID_THIRDPARTY'] = GETPOST('CASHDESK_ID_THIRDPARTY_id','alpha'); |
|
37 | - $_REQUEST['CASHDESK_ID_THIRDPARTY'] = GETPOST('CASHDESK_ID_THIRDPARTY_id','alpha'); |
|
35 | + $_GET['CASHDESK_ID_THIRDPARTY'] = GETPOST('CASHDESK_ID_THIRDPARTY_id', 'alpha'); |
|
36 | + $_POST['CASHDESK_ID_THIRDPARTY'] = GETPOST('CASHDESK_ID_THIRDPARTY_id', 'alpha'); |
|
37 | + $_REQUEST['CASHDESK_ID_THIRDPARTY'] = GETPOST('CASHDESK_ID_THIRDPARTY_id', 'alpha'); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | // Security check |
@@ -45,29 +45,29 @@ discard block |
||
45 | 45 | /* |
46 | 46 | * Actions |
47 | 47 | */ |
48 | -if (GETPOST('action','alpha') == 'set') |
|
48 | +if (GETPOST('action', 'alpha') == 'set') |
|
49 | 49 | { |
50 | 50 | $db->begin(); |
51 | 51 | |
52 | - if (GETPOST('socid','int') < 0) $_POST["socid"]=''; |
|
52 | + if (GETPOST('socid', 'int') < 0) $_POST["socid"] = ''; |
|
53 | 53 | |
54 | - $res = dolibarr_set_const($db,"CASHDESK_ID_THIRDPARTY",(GETPOST('socid','int') > 0 ? GETPOST('socid','int') : ''),'chaine',0,'',$conf->entity); |
|
55 | - $res = dolibarr_set_const($db,"CASHDESK_ID_BANKACCOUNT_CASH",(GETPOST('CASHDESK_ID_BANKACCOUNT_CASH','alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CASH','alpha') : ''),'chaine',0,'',$conf->entity); |
|
56 | - $res = dolibarr_set_const($db,"CASHDESK_ID_BANKACCOUNT_CHEQUE",(GETPOST('CASHDESK_ID_BANKACCOUNT_CHEQUE','alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CHEQUE','alpha') : ''),'chaine',0,'',$conf->entity); |
|
57 | - $res = dolibarr_set_const($db,"CASHDESK_ID_BANKACCOUNT_CB",(GETPOST('CASHDESK_ID_BANKACCOUNT_CB','alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CB','alpha') : ''),'chaine',0,'',$conf->entity); |
|
58 | - $res = dolibarr_set_const($db,"CASHDESK_ID_WAREHOUSE",(GETPOST('CASHDESK_ID_WAREHOUSE','alpha') > 0 ? GETPOST('CASHDESK_ID_WAREHOUSE','alpha') : ''),'chaine',0,'',$conf->entity); |
|
59 | - $res = dolibarr_set_const($db,"CASHDESK_NO_DECREASE_STOCK",GETPOST('CASHDESK_NO_DECREASE_STOCK','alpha'),'chaine',0,'',$conf->entity); |
|
60 | - $res = dolibarr_set_const($db,"CASHDESK_SERVICES", GETPOST('CASHDESK_SERVICES','alpha'),'chaine',0,'',$conf->entity); |
|
61 | - $res = dolibarr_set_const($db,"TAKEPOSCONNECTOR", GETPOST('TAKEPOSCONNECTOR','alpha'),'chaine',0,'',$conf->entity); |
|
62 | - $res = dolibarr_set_const($db,"TAKEPOS_BAR_RESTAURANT", GETPOST('TAKEPOS_BAR_RESTAURANT','alpha'),'chaine',0,'',$conf->entity); |
|
63 | - $res = dolibarr_set_const($db,"TAKEPOS_PRINT_SERVER", GETPOST('TAKEPOS_PRINT_SERVER','alpha'),'chaine',0,'',$conf->entity); |
|
64 | - $res = dolibarr_set_const($db,"TAKEPOS_ORDER_PRINTERS", GETPOST('TAKEPOS_ORDER_PRINTERS','alpha'),'chaine',0,'',$conf->entity); |
|
54 | + $res = dolibarr_set_const($db, "CASHDESK_ID_THIRDPARTY", (GETPOST('socid', 'int') > 0 ? GETPOST('socid', 'int') : ''), 'chaine', 0, '', $conf->entity); |
|
55 | + $res = dolibarr_set_const($db, "CASHDESK_ID_BANKACCOUNT_CASH", (GETPOST('CASHDESK_ID_BANKACCOUNT_CASH', 'alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CASH', 'alpha') : ''), 'chaine', 0, '', $conf->entity); |
|
56 | + $res = dolibarr_set_const($db, "CASHDESK_ID_BANKACCOUNT_CHEQUE", (GETPOST('CASHDESK_ID_BANKACCOUNT_CHEQUE', 'alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CHEQUE', 'alpha') : ''), 'chaine', 0, '', $conf->entity); |
|
57 | + $res = dolibarr_set_const($db, "CASHDESK_ID_BANKACCOUNT_CB", (GETPOST('CASHDESK_ID_BANKACCOUNT_CB', 'alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CB', 'alpha') : ''), 'chaine', 0, '', $conf->entity); |
|
58 | + $res = dolibarr_set_const($db, "CASHDESK_ID_WAREHOUSE", (GETPOST('CASHDESK_ID_WAREHOUSE', 'alpha') > 0 ? GETPOST('CASHDESK_ID_WAREHOUSE', 'alpha') : ''), 'chaine', 0, '', $conf->entity); |
|
59 | + $res = dolibarr_set_const($db, "CASHDESK_NO_DECREASE_STOCK", GETPOST('CASHDESK_NO_DECREASE_STOCK', 'alpha'), 'chaine', 0, '', $conf->entity); |
|
60 | + $res = dolibarr_set_const($db, "CASHDESK_SERVICES", GETPOST('CASHDESK_SERVICES', 'alpha'), 'chaine', 0, '', $conf->entity); |
|
61 | + $res = dolibarr_set_const($db, "TAKEPOSCONNECTOR", GETPOST('TAKEPOSCONNECTOR', 'alpha'), 'chaine', 0, '', $conf->entity); |
|
62 | + $res = dolibarr_set_const($db, "TAKEPOS_BAR_RESTAURANT", GETPOST('TAKEPOS_BAR_RESTAURANT', 'alpha'), 'chaine', 0, '', $conf->entity); |
|
63 | + $res = dolibarr_set_const($db, "TAKEPOS_PRINT_SERVER", GETPOST('TAKEPOS_PRINT_SERVER', 'alpha'), 'chaine', 0, '', $conf->entity); |
|
64 | + $res = dolibarr_set_const($db, "TAKEPOS_ORDER_PRINTERS", GETPOST('TAKEPOS_ORDER_PRINTERS', 'alpha'), 'chaine', 0, '', $conf->entity); |
|
65 | 65 | |
66 | - dol_syslog("admin/cashdesk: level ".GETPOST('level','alpha')); |
|
66 | + dol_syslog("admin/cashdesk: level ".GETPOST('level', 'alpha')); |
|
67 | 67 | |
68 | - if (! $res > 0) $error++; |
|
68 | + if (!$res > 0) $error++; |
|
69 | 69 | |
70 | - if (! $error) |
|
70 | + if (!$error) |
|
71 | 71 | { |
72 | 72 | $db->commit(); |
73 | 73 | setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); |
@@ -83,13 +83,13 @@ discard block |
||
83 | 83 | * View |
84 | 84 | */ |
85 | 85 | |
86 | -$form=new Form($db); |
|
87 | -$formproduct=new FormProduct($db); |
|
86 | +$form = new Form($db); |
|
87 | +$formproduct = new FormProduct($db); |
|
88 | 88 | |
89 | -llxHeader('',$langs->trans("CashDeskSetup")); |
|
89 | +llxHeader('', $langs->trans("CashDeskSetup")); |
|
90 | 90 | |
91 | -$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>'; |
|
92 | -print load_fiche_titre($langs->trans("CashDeskSetup").' (TakePOS)',$linkback,'title_setup'); |
|
91 | +$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>'; |
|
92 | +print load_fiche_titre($langs->trans("CashDeskSetup").' (TakePOS)', $linkback, 'title_setup'); |
|
93 | 93 | print '<br>'; |
94 | 94 | |
95 | 95 | |
@@ -104,12 +104,12 @@ discard block |
||
104 | 104 | print '<td>'.$langs->trans("Parameters").'</td><td>'.$langs->trans("Value").'</td>'; |
105 | 105 | print "</tr>\n"; |
106 | 106 | |
107 | -if (! empty($conf->service->enabled)) |
|
107 | +if (!empty($conf->service->enabled)) |
|
108 | 108 | { |
109 | 109 | print '<tr class="oddeven"><td>'; |
110 | 110 | print $langs->trans("CashdeskShowServices"); |
111 | 111 | print '<td colspan="2">'; |
112 | - print $form->selectyesno("CASHDESK_SERVICES",$conf->global->CASHDESK_SERVICES,1); |
|
112 | + print $form->selectyesno("CASHDESK_SERVICES", $conf->global->CASHDESK_SERVICES, 1); |
|
113 | 113 | print "</td></tr>\n"; |
114 | 114 | } |
115 | 115 | |
@@ -117,10 +117,10 @@ discard block |
||
117 | 117 | print '<tr class="oddeven"><td>'; |
118 | 118 | print $langs->trans("DolibarrReceiptPrinter").' (<a href="http://en.takepos.com/connector">'.$langs->trans("TakeposConnectorNecesary").'</a>)'; |
119 | 119 | print '<td colspan="2">'; |
120 | -print $form->selectyesno("TAKEPOSCONNECTOR",$conf->global->TAKEPOSCONNECTOR,1); |
|
120 | +print $form->selectyesno("TAKEPOSCONNECTOR", $conf->global->TAKEPOSCONNECTOR, 1); |
|
121 | 121 | print "</td></tr>\n"; |
122 | 122 | |
123 | -if ($conf->global->TAKEPOSCONNECTOR){ |
|
123 | +if ($conf->global->TAKEPOSCONNECTOR) { |
|
124 | 124 | print '<tr class="oddeven value"><td>'; |
125 | 125 | print $langs->trans("IPAddress").' (<a href="http://en.takepos.com/connector">'.$langs->trans("TakeposConnectorNecesary").'</a>)'; |
126 | 126 | print '<td colspan="2">'; |
@@ -132,14 +132,14 @@ discard block |
||
132 | 132 | print '<tr class="oddeven"><td>'; |
133 | 133 | print 'Bar Restaurant'; |
134 | 134 | print '<td colspan="2">'; |
135 | -print $form->selectyesno("TAKEPOS_BAR_RESTAURANT",$conf->global->TAKEPOS_BAR_RESTAURANT,1); |
|
135 | +print $form->selectyesno("TAKEPOS_BAR_RESTAURANT", $conf->global->TAKEPOS_BAR_RESTAURANT, 1); |
|
136 | 136 | print "</td></tr>\n"; |
137 | 137 | |
138 | -if ($conf->global->TAKEPOS_BAR_RESTAURANT && $conf->global->TAKEPOSCONNECTOR){ |
|
138 | +if ($conf->global->TAKEPOS_BAR_RESTAURANT && $conf->global->TAKEPOSCONNECTOR) { |
|
139 | 139 | print '<tr class="oddeven value"><td>'; |
140 | 140 | print $langs->trans("OrderPrinters").' (<a href="orderprinters.php?leftmenu=setup">'.$langs->trans("Setup").'</a>)'; |
141 | 141 | print '<td colspan="2">'; |
142 | - print $form->selectyesno("TAKEPOS_ORDER_PRINTERS",$conf->global->TAKEPOS_ORDER_PRINTERS,1); |
|
142 | + print $form->selectyesno("TAKEPOS_ORDER_PRINTERS", $conf->global->TAKEPOS_ORDER_PRINTERS, 1); |
|
143 | 143 | print '</td></tr>'; |
144 | 144 | } |
145 | 145 | |
@@ -157,53 +157,53 @@ discard block |
||
157 | 157 | print '<td colspan="2">'; |
158 | 158 | print $form->select_company($conf->global->CASHDESK_ID_THIRDPARTY, 'socid', 's.client in (1,3) AND s.status = 1', 1, 0, 0, array(), 0); |
159 | 159 | print '</td></tr>'; |
160 | -if (! empty($conf->banque->enabled)) |
|
160 | +if (!empty($conf->banque->enabled)) |
|
161 | 161 | { |
162 | 162 | |
163 | 163 | print '<tr class="oddeven"><td>'.$langs->trans("CashDeskBankAccountForSell").'</td>'; |
164 | 164 | print '<td colspan="2">'; |
165 | - $form->select_comptes($conf->global->CASHDESK_ID_BANKACCOUNT_CASH,'CASHDESK_ID_BANKACCOUNT_CASH',0,"courant=2",1); |
|
165 | + $form->select_comptes($conf->global->CASHDESK_ID_BANKACCOUNT_CASH, 'CASHDESK_ID_BANKACCOUNT_CASH', 0, "courant=2", 1); |
|
166 | 166 | print '</td></tr>'; |
167 | 167 | |
168 | 168 | |
169 | 169 | print '<tr class="oddeven"><td>'.$langs->trans("CashDeskBankAccountForCheque").'</td>'; |
170 | 170 | print '<td colspan="2">'; |
171 | - $form->select_comptes($conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE,'CASHDESK_ID_BANKACCOUNT_CHEQUE',0,"courant=1",1); |
|
171 | + $form->select_comptes($conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE, 'CASHDESK_ID_BANKACCOUNT_CHEQUE', 0, "courant=1", 1); |
|
172 | 172 | print '</td></tr>'; |
173 | 173 | |
174 | 174 | |
175 | 175 | print '<tr class="oddeven"><td>'.$langs->trans("CashDeskBankAccountForCB").'</td>'; |
176 | 176 | print '<td colspan="2">'; |
177 | - $form->select_comptes($conf->global->CASHDESK_ID_BANKACCOUNT_CB,'CASHDESK_ID_BANKACCOUNT_CB',0,"courant=1",1); |
|
177 | + $form->select_comptes($conf->global->CASHDESK_ID_BANKACCOUNT_CB, 'CASHDESK_ID_BANKACCOUNT_CB', 0, "courant=1", 1); |
|
178 | 178 | print '</td></tr>'; |
179 | 179 | } |
180 | 180 | |
181 | -if (! empty($conf->stock->enabled)) |
|
181 | +if (!empty($conf->stock->enabled)) |
|
182 | 182 | { |
183 | 183 | |
184 | - print '<tr class="oddeven"><td>'.$langs->trans("CashDeskDoNotDecreaseStock").'</td>'; // Force warehouse (this is not a default value) |
|
184 | + print '<tr class="oddeven"><td>'.$langs->trans("CashDeskDoNotDecreaseStock").'</td>'; // Force warehouse (this is not a default value) |
|
185 | 185 | print '<td colspan="2">'; |
186 | 186 | if (empty($conf->productbatch->enabled)) { |
187 | - print $form->selectyesno('CASHDESK_NO_DECREASE_STOCK',$conf->global->CASHDESK_NO_DECREASE_STOCK,1); |
|
187 | + print $form->selectyesno('CASHDESK_NO_DECREASE_STOCK', $conf->global->CASHDESK_NO_DECREASE_STOCK, 1); |
|
188 | 188 | } |
189 | 189 | else |
190 | 190 | { |
191 | 191 | if (!$conf->global->CASHDESK_NO_DECREASE_STOCK) { |
192 | - $res = dolibarr_set_const($db,"CASHDESK_NO_DECREASE_STOCK",1,'chaine',0,'',$conf->entity); |
|
192 | + $res = dolibarr_set_const($db, "CASHDESK_NO_DECREASE_STOCK", 1, 'chaine', 0, '', $conf->entity); |
|
193 | 193 | } |
194 | 194 | print $langs->trans("Yes").'<br>'; |
195 | 195 | print '<span class="opacitymedium">'.$langs->trans('StockDecreaseForPointOfSaleDisabledbyBatch').'</span>'; |
196 | 196 | } |
197 | 197 | print '</td></tr>'; |
198 | 198 | |
199 | - $disabled=$conf->global->CASHDESK_NO_DECREASE_STOCK; |
|
199 | + $disabled = $conf->global->CASHDESK_NO_DECREASE_STOCK; |
|
200 | 200 | |
201 | 201 | |
202 | - print '<tr class="oddeven"><td>'.$langs->trans("CashDeskIdWareHouse").'</td>'; // Force warehouse (this is not a default value) |
|
202 | + print '<tr class="oddeven"><td>'.$langs->trans("CashDeskIdWareHouse").'</td>'; // Force warehouse (this is not a default value) |
|
203 | 203 | print '<td colspan="2">'; |
204 | - if (! $disabled) |
|
204 | + if (!$disabled) |
|
205 | 205 | { |
206 | - print $formproduct->selectWarehouses($conf->global->CASHDESK_ID_WAREHOUSE,'CASHDESK_ID_WAREHOUSE','',1,$disabled); |
|
206 | + print $formproduct->selectWarehouses($conf->global->CASHDESK_ID_WAREHOUSE, 'CASHDESK_ID_WAREHOUSE', '', 1, $disabled); |
|
207 | 207 | print ' <a href="'.DOL_URL_ROOT.'/product/stock/card.php?action=create&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">('.$langs->trans("Create").')</a>'; |
208 | 208 | } |
209 | 209 | else |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | print '</tr>'; |
232 | 232 | |
233 | 233 | print "<tr class=\"oddeven\">\n"; |
234 | -$url='https://www.dolistore.com/en/modules/980-TakePOS-7-mobile.html'; |
|
234 | +$url = 'https://www.dolistore.com/en/modules/980-TakePOS-7-mobile.html'; |
|
235 | 235 | print '<td align="left"><a href="'.$url.'" target="_blank" rel="external"><img border="0" class="imgautosize imgmaxwidth180" src="../img/marketplace/takeposmobile.jpg"></a></td>'; |
236 | 236 | print '<td>TakePOS for mobile devices</td>'; |
237 | 237 | print '<td><a href="'.$url.'" target="_blank" rel="external">'.$url.'</a></td>'; |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | print '</tr>'; |
249 | 249 | |
250 | 250 | print "<tr class=\"oddeven\">\n"; |
251 | -$url='http://www.takepos.com'; |
|
251 | +$url = 'http://www.takepos.com'; |
|
252 | 252 | print '<td align="left"><a href="'.$url.'" target="_blank" rel="external"><img border="0" class="imgautosize imgmaxwidth180" src="../img/takepos.png"></a></td>'; |
253 | 253 | print '<td>TakePOS original developers</td>'; |
254 | 254 | print '<td><a href="'.$url.'" target="_blank" rel="external">'.$url.'</a></td>'; |
@@ -49,19 +49,19 @@ discard block |
||
49 | 49 | * Actions |
50 | 50 | */ |
51 | 51 | if ($action=="SavePrinter1"){ |
52 | - $printedcategories=";"; |
|
53 | - if (is_array($printer1)) foreach ($printer1 as $cat){ |
|
54 | - $printedcategories=$printedcategories.$cat.";"; |
|
55 | - } |
|
56 | - dolibarr_set_const($db,"TAKEPOS_PRINTED_CATEGORIES_1", $printedcategories,'chaine',0,'',$conf->entity); |
|
52 | + $printedcategories=";"; |
|
53 | + if (is_array($printer1)) foreach ($printer1 as $cat){ |
|
54 | + $printedcategories=$printedcategories.$cat.";"; |
|
55 | + } |
|
56 | + dolibarr_set_const($db,"TAKEPOS_PRINTED_CATEGORIES_1", $printedcategories,'chaine',0,'',$conf->entity); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | if ($action=="SavePrinter2"){ |
60 | - $printedcategories=";"; |
|
61 | - if (is_array($printer2)) foreach ($printer2 as $cat){ |
|
62 | - $printedcategories=$printedcategories.$cat.";"; |
|
63 | - } |
|
64 | - dolibarr_set_const($db,"TAKEPOS_PRINTED_CATEGORIES_2", $printedcategories,'chaine',0,'',$conf->entity); |
|
60 | + $printedcategories=";"; |
|
61 | + if (is_array($printer2)) foreach ($printer2 as $cat){ |
|
62 | + $printedcategories=$printedcategories.$cat.";"; |
|
63 | + } |
|
64 | + dolibarr_set_const($db,"TAKEPOS_PRINTED_CATEGORIES_2", $printedcategories,'chaine',0,'',$conf->entity); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | |
@@ -116,19 +116,19 @@ discard block |
||
116 | 116 | $data[] = array('rowid'=>0,'fk_menu'=>-1,'title'=>"racine",'mainmenu'=>'','leftmenu'=>'','fk_mainmenu'=>'','fk_leftmenu'=>''); |
117 | 117 | foreach($fulltree as $key => $val) |
118 | 118 | { |
119 | - $categstatic->id=$val['id']; |
|
120 | - $categstatic->ref=$val['label']; |
|
121 | - $categstatic->color=$val['color']; |
|
122 | - $categstatic->type=$type; |
|
123 | - $li=$categstatic->getNomUrl(1,'',60); |
|
124 | - $desc=dol_htmlcleanlastbr($val['description']); |
|
125 | - |
|
126 | - $data[] = array( |
|
127 | - 'rowid'=>$val['rowid'], |
|
128 | - 'fk_menu'=>$val['fk_menu'], |
|
129 | - 'fk_menu'=>$val['fk_parent'], |
|
130 | - 'label'=>$val['label'] |
|
131 | - ); |
|
119 | + $categstatic->id=$val['id']; |
|
120 | + $categstatic->ref=$val['label']; |
|
121 | + $categstatic->color=$val['color']; |
|
122 | + $categstatic->type=$type; |
|
123 | + $li=$categstatic->getNomUrl(1,'',60); |
|
124 | + $desc=dol_htmlcleanlastbr($val['description']); |
|
125 | + |
|
126 | + $data[] = array( |
|
127 | + 'rowid'=>$val['rowid'], |
|
128 | + 'fk_menu'=>$val['fk_menu'], |
|
129 | + 'fk_menu'=>$val['fk_parent'], |
|
130 | + 'label'=>$val['label'] |
|
131 | + ); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | //Printer1 |
@@ -139,24 +139,24 @@ discard block |
||
139 | 139 | print '<form action="orderprinters.php">'; |
140 | 140 | if ($nbofentries > 0) |
141 | 141 | { |
142 | - print '<tr class="pair"><td colspan="3">'; |
|
143 | - print '<input type="hidden" name="action" value="SavePrinter1">'; |
|
144 | - foreach ($data as $row) { |
|
145 | - if (strpos($conf->global->TAKEPOS_PRINTED_CATEGORIES_1, ';'.$row["rowid"].';') !== false) $checked='checked'; else $checked=''; |
|
146 | - if ($row["fk_menu"]==0) print '<input type="checkbox" name="printer1[]" value="'.$row["rowid"].'" '.$checked.'>'.$row["label"].'<br>'; |
|
147 | - } |
|
148 | - print '</td></tr>'; |
|
142 | + print '<tr class="pair"><td colspan="3">'; |
|
143 | + print '<input type="hidden" name="action" value="SavePrinter1">'; |
|
144 | + foreach ($data as $row) { |
|
145 | + if (strpos($conf->global->TAKEPOS_PRINTED_CATEGORIES_1, ';'.$row["rowid"].';') !== false) $checked='checked'; else $checked=''; |
|
146 | + if ($row["fk_menu"]==0) print '<input type="checkbox" name="printer1[]" value="'.$row["rowid"].'" '.$checked.'>'.$row["label"].'<br>'; |
|
147 | + } |
|
148 | + print '</td></tr>'; |
|
149 | 149 | } |
150 | 150 | else |
151 | 151 | { |
152 | - print '<tr class="pair">'; |
|
153 | - print '<td colspan="3"><table class="nobordernopadding"><tr class="nobordernopadding"><td>'.img_picto_common('','treemenu/branchbottom.gif').'</td>'; |
|
154 | - print '<td valign="middle">'; |
|
155 | - print $langs->trans("NoCategoryYet"); |
|
156 | - print '</td>'; |
|
157 | - print '<td> </td>'; |
|
158 | - print '</table></td>'; |
|
159 | - print '</tr>'; |
|
152 | + print '<tr class="pair">'; |
|
153 | + print '<td colspan="3"><table class="nobordernopadding"><tr class="nobordernopadding"><td>'.img_picto_common('','treemenu/branchbottom.gif').'</td>'; |
|
154 | + print '<td valign="middle">'; |
|
155 | + print $langs->trans("NoCategoryYet"); |
|
156 | + print '</td>'; |
|
157 | + print '<td> </td>'; |
|
158 | + print '</table></td>'; |
|
159 | + print '</tr>'; |
|
160 | 160 | } |
161 | 161 | print "</table>"; |
162 | 162 | print '<input type="submit" value="'.$langs->trans("Save").'"></form><br><br>'; |
@@ -169,24 +169,24 @@ discard block |
||
169 | 169 | print '<form action="orderprinters.php">'; |
170 | 170 | if ($nbofentries > 0) |
171 | 171 | { |
172 | - print '<tr class="pair"><td colspan="3">'; |
|
173 | - print '<input type="hidden" name="action" value="SavePrinter2">'; |
|
174 | - foreach ($data as $row) { |
|
175 | - if (strpos($conf->global->TAKEPOS_PRINTED_CATEGORIES_2, ';'.$row["rowid"].';') !== false) $checked='checked'; else $checked=''; |
|
176 | - if ($row["fk_menu"]==0) print '<input type="checkbox" name="printer2[]" value="'.$row["rowid"].'" '.$checked.'>'.$row["label"].'<br>'; |
|
177 | - } |
|
178 | - print '</td></tr>'; |
|
172 | + print '<tr class="pair"><td colspan="3">'; |
|
173 | + print '<input type="hidden" name="action" value="SavePrinter2">'; |
|
174 | + foreach ($data as $row) { |
|
175 | + if (strpos($conf->global->TAKEPOS_PRINTED_CATEGORIES_2, ';'.$row["rowid"].';') !== false) $checked='checked'; else $checked=''; |
|
176 | + if ($row["fk_menu"]==0) print '<input type="checkbox" name="printer2[]" value="'.$row["rowid"].'" '.$checked.'>'.$row["label"].'<br>'; |
|
177 | + } |
|
178 | + print '</td></tr>'; |
|
179 | 179 | } |
180 | 180 | else |
181 | 181 | { |
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"); |
|
186 | - print '</td>'; |
|
187 | - print '<td> </td>'; |
|
188 | - print '</table></td>'; |
|
189 | - print '</tr>'; |
|
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"); |
|
186 | + print '</td>'; |
|
187 | + print '<td> </td>'; |
|
188 | + print '</table></td>'; |
|
189 | + print '</tr>'; |
|
190 | 190 | } |
191 | 191 | print "</table>"; |
192 | 192 | print '<input type="submit" value="'.$langs->trans("Save").'"></form>'; |
@@ -34,7 +34,9 @@ discard block |
||
34 | 34 | |
35 | 35 | $langs->loadLangs(array("main"), "categories", "takepos", "printing"); |
36 | 36 | |
37 | -if (! $user->rights->categorie->lire) accessforbidden(); |
|
37 | +if (! $user->rights->categorie->lire) { |
|
38 | + accessforbidden(); |
|
39 | +} |
|
38 | 40 | |
39 | 41 | $id=GETPOST('id','int'); |
40 | 42 | $type=(GETPOST('type','aZ09') ? GETPOST('type','aZ09') : Categorie::TYPE_PRODUCT); |
@@ -43,24 +45,31 @@ discard block |
||
43 | 45 | $printer1=GETPOST('printer1','alpha'); |
44 | 46 | $printer2=GETPOST('printer2','alpha'); |
45 | 47 | |
46 | -if (is_numeric($type)) $type=Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility |
|
48 | +if (is_numeric($type)) { |
|
49 | + $type=Categorie::$MAP_ID_TO_CODE[$type]; |
|
50 | +} |
|
51 | +// For backward compatibility |
|
47 | 52 | |
48 | 53 | /* |
49 | 54 | * Actions |
50 | 55 | */ |
51 | 56 | if ($action=="SavePrinter1"){ |
52 | 57 | $printedcategories=";"; |
53 | - if (is_array($printer1)) foreach ($printer1 as $cat){ |
|
58 | + if (is_array($printer1)) { |
|
59 | + foreach ($printer1 as $cat){ |
|
54 | 60 | $printedcategories=$printedcategories.$cat.";"; |
55 | 61 | } |
62 | + } |
|
56 | 63 | dolibarr_set_const($db,"TAKEPOS_PRINTED_CATEGORIES_1", $printedcategories,'chaine',0,'',$conf->entity); |
57 | 64 | } |
58 | 65 | |
59 | 66 | if ($action=="SavePrinter2"){ |
60 | 67 | $printedcategories=";"; |
61 | - if (is_array($printer2)) foreach ($printer2 as $cat){ |
|
68 | + if (is_array($printer2)) { |
|
69 | + foreach ($printer2 as $cat){ |
|
62 | 70 | $printedcategories=$printedcategories.$cat.";"; |
63 | 71 | } |
72 | + } |
|
64 | 73 | dolibarr_set_const($db,"TAKEPOS_PRINTED_CATEGORIES_2", $printedcategories,'chaine',0,'',$conf->entity); |
65 | 74 | } |
66 | 75 | |
@@ -72,15 +81,7 @@ discard block |
||
72 | 81 | $categstatic = new Categorie($db); |
73 | 82 | $form = new Form($db); |
74 | 83 | |
75 | -if ($type == Categorie::TYPE_PRODUCT) { $title=$langs->trans("ProductsCategoriesArea"); $typetext='product'; } |
|
76 | -elseif ($type == Categorie::TYPE_SUPPLIER) { $title=$langs->trans("SuppliersCategoriesArea"); $typetext='supplier'; } |
|
77 | -elseif ($type == Categorie::TYPE_CUSTOMER) { $title=$langs->trans("CustomersCategoriesArea"); $typetext='customer'; } |
|
78 | -elseif ($type == Categorie::TYPE_MEMBER) { $title=$langs->trans("MembersCategoriesArea"); $typetext='member'; } |
|
79 | -elseif ($type == Categorie::TYPE_CONTACT) { $title=$langs->trans("ContactsCategoriesArea"); $typetext='contact'; } |
|
80 | -elseif ($type == Categorie::TYPE_ACCOUNT) { $title=$langs->trans("AccountsCategoriesArea"); $typetext='bank_account'; } |
|
81 | -elseif ($type == Categorie::TYPE_PROJECT) { $title=$langs->trans("ProjectsCategoriesArea"); $typetext='project'; } |
|
82 | -elseif ($type == Categorie::TYPE_USER) { $title=$langs->trans("UsersCategoriesArea"); $typetext='user'; } |
|
83 | -else { $title=$langs->trans("CategoriesArea"); $typetext='unknown'; } |
|
84 | +if ($type == Categorie::TYPE_PRODUCT) { $title=$langs->trans("ProductsCategoriesArea"); $typetext='product'; } elseif ($type == Categorie::TYPE_SUPPLIER) { $title=$langs->trans("SuppliersCategoriesArea"); $typetext='supplier'; } elseif ($type == Categorie::TYPE_CUSTOMER) { $title=$langs->trans("CustomersCategoriesArea"); $typetext='customer'; } elseif ($type == Categorie::TYPE_MEMBER) { $title=$langs->trans("MembersCategoriesArea"); $typetext='member'; } elseif ($type == Categorie::TYPE_CONTACT) { $title=$langs->trans("ContactsCategoriesArea"); $typetext='contact'; } elseif ($type == Categorie::TYPE_ACCOUNT) { $title=$langs->trans("AccountsCategoriesArea"); $typetext='bank_account'; } elseif ($type == Categorie::TYPE_PROJECT) { $title=$langs->trans("ProjectsCategoriesArea"); $typetext='project'; } elseif ($type == Categorie::TYPE_USER) { $title=$langs->trans("UsersCategoriesArea"); $typetext='user'; } else { $title=$langs->trans("CategoriesArea"); $typetext='unknown'; } |
|
84 | 85 | |
85 | 86 | $arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js'); |
86 | 87 | $arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css'); |
@@ -142,12 +143,17 @@ discard block |
||
142 | 143 | print '<tr class="pair"><td colspan="3">'; |
143 | 144 | print '<input type="hidden" name="action" value="SavePrinter1">'; |
144 | 145 | foreach ($data as $row) { |
145 | - if (strpos($conf->global->TAKEPOS_PRINTED_CATEGORIES_1, ';'.$row["rowid"].';') !== false) $checked='checked'; else $checked=''; |
|
146 | - if ($row["fk_menu"]==0) print '<input type="checkbox" name="printer1[]" value="'.$row["rowid"].'" '.$checked.'>'.$row["label"].'<br>'; |
|
146 | + if (strpos($conf->global->TAKEPOS_PRINTED_CATEGORIES_1, ';'.$row["rowid"].';') !== false) { |
|
147 | + $checked='checked'; |
|
148 | + } else { |
|
149 | + $checked=''; |
|
150 | + } |
|
151 | + if ($row["fk_menu"]==0) { |
|
152 | + print '<input type="checkbox" name="printer1[]" value="'.$row["rowid"].'" '.$checked.'>'.$row["label"].'<br>'; |
|
153 | + } |
|
147 | 154 | } |
148 | 155 | print '</td></tr>'; |
149 | -} |
|
150 | -else |
|
156 | +} else |
|
151 | 157 | { |
152 | 158 | print '<tr class="pair">'; |
153 | 159 | print '<td colspan="3"><table class="nobordernopadding"><tr class="nobordernopadding"><td>'.img_picto_common('','treemenu/branchbottom.gif').'</td>'; |
@@ -172,12 +178,17 @@ discard block |
||
172 | 178 | print '<tr class="pair"><td colspan="3">'; |
173 | 179 | print '<input type="hidden" name="action" value="SavePrinter2">'; |
174 | 180 | foreach ($data as $row) { |
175 | - if (strpos($conf->global->TAKEPOS_PRINTED_CATEGORIES_2, ';'.$row["rowid"].';') !== false) $checked='checked'; else $checked=''; |
|
176 | - if ($row["fk_menu"]==0) print '<input type="checkbox" name="printer2[]" value="'.$row["rowid"].'" '.$checked.'>'.$row["label"].'<br>'; |
|
181 | + if (strpos($conf->global->TAKEPOS_PRINTED_CATEGORIES_2, ';'.$row["rowid"].';') !== false) { |
|
182 | + $checked='checked'; |
|
183 | + } else { |
|
184 | + $checked=''; |
|
185 | + } |
|
186 | + if ($row["fk_menu"]==0) { |
|
187 | + print '<input type="checkbox" name="printer2[]" value="'.$row["rowid"].'" '.$checked.'>'.$row["label"].'<br>'; |
|
188 | + } |
|
177 | 189 | } |
178 | 190 | print '</td></tr>'; |
179 | -} |
|
180 | -else |
|
191 | +} else |
|
181 | 192 | { |
182 | 193 | print '<tr class="pair">'; |
183 | 194 | print '<td colspan="3"><table class="nobordernopadding"><tr class="nobordernopadding"><td>'.img_picto_common('','treemenu/branchbottom.gif').'</td>'; |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | // Copyright (C) 2018 Alxarafe/Alixar <[email protected]> |
31 | 31 | defined('BASE_PATH') or die('Single entry point through the index.php of the main folder'); |
32 | -require DOL_BASE_PATH . '/main.inc.php'; // Load $user and permissions |
|
32 | +require DOL_BASE_PATH.'/main.inc.php'; // Load $user and permissions |
|
33 | 33 | require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
34 | 34 | require_once DOL_DOCUMENT_ROOT.'/core/lib/treeview.lib.php'; |
35 | 35 | require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
@@ -37,34 +37,34 @@ discard block |
||
37 | 37 | |
38 | 38 | $langs->loadLangs(array("main"), "categories", "takepos", "printing"); |
39 | 39 | |
40 | -if (! $user->rights->categorie->lire) accessforbidden(); |
|
40 | +if (!$user->rights->categorie->lire) accessforbidden(); |
|
41 | 41 | |
42 | -$id=GETPOST('id','int'); |
|
43 | -$type=(GETPOST('type','aZ09') ? GETPOST('type','aZ09') : Categorie::TYPE_PRODUCT); |
|
44 | -$catname=GETPOST('catname','alpha'); |
|
45 | -$action=GETPOST('action','alpha'); |
|
46 | -$printer1=GETPOST('printer1','alpha'); |
|
47 | -$printer2=GETPOST('printer2','alpha'); |
|
42 | +$id = GETPOST('id', 'int'); |
|
43 | +$type = (GETPOST('type', 'aZ09') ? GETPOST('type', 'aZ09') : Categorie::TYPE_PRODUCT); |
|
44 | +$catname = GETPOST('catname', 'alpha'); |
|
45 | +$action = GETPOST('action', 'alpha'); |
|
46 | +$printer1 = GETPOST('printer1', 'alpha'); |
|
47 | +$printer2 = GETPOST('printer2', 'alpha'); |
|
48 | 48 | |
49 | -if (is_numeric($type)) $type=Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility |
|
49 | +if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility |
|
50 | 50 | |
51 | 51 | /* |
52 | 52 | * Actions |
53 | 53 | */ |
54 | -if ($action=="SavePrinter1"){ |
|
55 | - $printedcategories=";"; |
|
56 | - if (is_array($printer1)) foreach ($printer1 as $cat){ |
|
57 | - $printedcategories=$printedcategories.$cat.";"; |
|
54 | +if ($action == "SavePrinter1") { |
|
55 | + $printedcategories = ";"; |
|
56 | + if (is_array($printer1)) foreach ($printer1 as $cat) { |
|
57 | + $printedcategories = $printedcategories.$cat.";"; |
|
58 | 58 | } |
59 | - dolibarr_set_const($db,"TAKEPOS_PRINTED_CATEGORIES_1", $printedcategories,'chaine',0,'',$conf->entity); |
|
59 | + dolibarr_set_const($db, "TAKEPOS_PRINTED_CATEGORIES_1", $printedcategories, 'chaine', 0, '', $conf->entity); |
|
60 | 60 | } |
61 | 61 | |
62 | -if ($action=="SavePrinter2"){ |
|
63 | - $printedcategories=";"; |
|
64 | - if (is_array($printer2)) foreach ($printer2 as $cat){ |
|
65 | - $printedcategories=$printedcategories.$cat.";"; |
|
62 | +if ($action == "SavePrinter2") { |
|
63 | + $printedcategories = ";"; |
|
64 | + if (is_array($printer2)) foreach ($printer2 as $cat) { |
|
65 | + $printedcategories = $printedcategories.$cat.";"; |
|
66 | 66 | } |
67 | - dolibarr_set_const($db,"TAKEPOS_PRINTED_CATEGORIES_2", $printedcategories,'chaine',0,'',$conf->entity); |
|
67 | + dolibarr_set_const($db, "TAKEPOS_PRINTED_CATEGORIES_2", $printedcategories, 'chaine', 0, '', $conf->entity); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | |
@@ -75,20 +75,20 @@ discard block |
||
75 | 75 | $categstatic = new Categorie($db); |
76 | 76 | $form = new Form($db); |
77 | 77 | |
78 | -if ($type == Categorie::TYPE_PRODUCT) { $title=$langs->trans("ProductsCategoriesArea"); $typetext='product'; } |
|
79 | -elseif ($type == Categorie::TYPE_SUPPLIER) { $title=$langs->trans("SuppliersCategoriesArea"); $typetext='supplier'; } |
|
80 | -elseif ($type == Categorie::TYPE_CUSTOMER) { $title=$langs->trans("CustomersCategoriesArea"); $typetext='customer'; } |
|
81 | -elseif ($type == Categorie::TYPE_MEMBER) { $title=$langs->trans("MembersCategoriesArea"); $typetext='member'; } |
|
82 | -elseif ($type == Categorie::TYPE_CONTACT) { $title=$langs->trans("ContactsCategoriesArea"); $typetext='contact'; } |
|
83 | -elseif ($type == Categorie::TYPE_ACCOUNT) { $title=$langs->trans("AccountsCategoriesArea"); $typetext='bank_account'; } |
|
84 | -elseif ($type == Categorie::TYPE_PROJECT) { $title=$langs->trans("ProjectsCategoriesArea"); $typetext='project'; } |
|
85 | -elseif ($type == Categorie::TYPE_USER) { $title=$langs->trans("UsersCategoriesArea"); $typetext='user'; } |
|
86 | -else { $title=$langs->trans("CategoriesArea"); $typetext='unknown'; } |
|
78 | +if ($type == Categorie::TYPE_PRODUCT) { $title = $langs->trans("ProductsCategoriesArea"); $typetext = 'product'; } |
|
79 | +elseif ($type == Categorie::TYPE_SUPPLIER) { $title = $langs->trans("SuppliersCategoriesArea"); $typetext = 'supplier'; } |
|
80 | +elseif ($type == Categorie::TYPE_CUSTOMER) { $title = $langs->trans("CustomersCategoriesArea"); $typetext = 'customer'; } |
|
81 | +elseif ($type == Categorie::TYPE_MEMBER) { $title = $langs->trans("MembersCategoriesArea"); $typetext = 'member'; } |
|
82 | +elseif ($type == Categorie::TYPE_CONTACT) { $title = $langs->trans("ContactsCategoriesArea"); $typetext = 'contact'; } |
|
83 | +elseif ($type == Categorie::TYPE_ACCOUNT) { $title = $langs->trans("AccountsCategoriesArea"); $typetext = 'bank_account'; } |
|
84 | +elseif ($type == Categorie::TYPE_PROJECT) { $title = $langs->trans("ProjectsCategoriesArea"); $typetext = 'project'; } |
|
85 | +elseif ($type == Categorie::TYPE_USER) { $title = $langs->trans("UsersCategoriesArea"); $typetext = 'user'; } |
|
86 | +else { $title = $langs->trans("CategoriesArea"); $typetext = 'unknown'; } |
|
87 | 87 | |
88 | -$arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js'); |
|
89 | -$arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css'); |
|
88 | +$arrayofjs = array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js'); |
|
89 | +$arrayofcss = array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css'); |
|
90 | 90 | |
91 | -llxHeader('',$title,'','',0,0,$arrayofjs,$arrayofcss); |
|
91 | +llxHeader('', $title, '', '', 0, 0, $arrayofjs, $arrayofcss); |
|
92 | 92 | |
93 | 93 | |
94 | 94 | print load_fiche_titre($langs->trans("OrderPrinters")); |
@@ -112,19 +112,19 @@ discard block |
||
112 | 112 | $cate_arbo = $categstatic->get_full_arbo($typetext); |
113 | 113 | |
114 | 114 | // Define fulltree array |
115 | -$fulltree=$cate_arbo; |
|
115 | +$fulltree = $cate_arbo; |
|
116 | 116 | |
117 | 117 | // Define data (format for treeview) |
118 | -$data=array(); |
|
119 | -$data[] = array('rowid'=>0,'fk_menu'=>-1,'title'=>"racine",'mainmenu'=>'','leftmenu'=>'','fk_mainmenu'=>'','fk_leftmenu'=>''); |
|
120 | -foreach($fulltree as $key => $val) |
|
118 | +$data = array(); |
|
119 | +$data[] = array('rowid'=>0, 'fk_menu'=>-1, 'title'=>"racine", 'mainmenu'=>'', 'leftmenu'=>'', 'fk_mainmenu'=>'', 'fk_leftmenu'=>''); |
|
120 | +foreach ($fulltree as $key => $val) |
|
121 | 121 | { |
122 | - $categstatic->id=$val['id']; |
|
123 | - $categstatic->ref=$val['label']; |
|
124 | - $categstatic->color=$val['color']; |
|
125 | - $categstatic->type=$type; |
|
126 | - $li=$categstatic->getNomUrl(1,'',60); |
|
127 | - $desc=dol_htmlcleanlastbr($val['description']); |
|
122 | + $categstatic->id = $val['id']; |
|
123 | + $categstatic->ref = $val['label']; |
|
124 | + $categstatic->color = $val['color']; |
|
125 | + $categstatic->type = $type; |
|
126 | + $li = $categstatic->getNomUrl(1, '', 60); |
|
127 | + $desc = dol_htmlcleanlastbr($val['description']); |
|
128 | 128 | |
129 | 129 | $data[] = array( |
130 | 130 | 'rowid'=>$val['rowid'], |
@@ -138,22 +138,22 @@ discard block |
||
138 | 138 | print '<table class="liste nohover" width="100%">'; |
139 | 139 | print '<tr class="liste_titre"><td>'.$langs->trans("Printer").' 1</td><td></td><td align="right">'; |
140 | 140 | print '</td></tr>'; |
141 | -$nbofentries=(count($data) - 1); |
|
141 | +$nbofentries = (count($data) - 1); |
|
142 | 142 | print '<form action="orderprinters.php">'; |
143 | 143 | if ($nbofentries > 0) |
144 | 144 | { |
145 | 145 | print '<tr class="pair"><td colspan="3">'; |
146 | 146 | print '<input type="hidden" name="action" value="SavePrinter1">'; |
147 | 147 | foreach ($data as $row) { |
148 | - if (strpos($conf->global->TAKEPOS_PRINTED_CATEGORIES_1, ';'.$row["rowid"].';') !== false) $checked='checked'; else $checked=''; |
|
149 | - if ($row["fk_menu"]==0) print '<input type="checkbox" name="printer1[]" value="'.$row["rowid"].'" '.$checked.'>'.$row["label"].'<br>'; |
|
148 | + if (strpos($conf->global->TAKEPOS_PRINTED_CATEGORIES_1, ';'.$row["rowid"].';') !== false) $checked = 'checked'; else $checked = ''; |
|
149 | + if ($row["fk_menu"] == 0) print '<input type="checkbox" name="printer1[]" value="'.$row["rowid"].'" '.$checked.'>'.$row["label"].'<br>'; |
|
150 | 150 | } |
151 | 151 | print '</td></tr>'; |
152 | 152 | } |
153 | 153 | else |
154 | 154 | { |
155 | 155 | print '<tr class="pair">'; |
156 | - print '<td colspan="3"><table class="nobordernopadding"><tr class="nobordernopadding"><td>'.img_picto_common('','treemenu/branchbottom.gif').'</td>'; |
|
156 | + print '<td colspan="3"><table class="nobordernopadding"><tr class="nobordernopadding"><td>'.img_picto_common('', 'treemenu/branchbottom.gif').'</td>'; |
|
157 | 157 | print '<td valign="middle">'; |
158 | 158 | print $langs->trans("NoCategoryYet"); |
159 | 159 | print '</td>'; |
@@ -168,22 +168,22 @@ discard block |
||
168 | 168 | print '<table class="liste nohover" width="100%">'; |
169 | 169 | print '<tr class="liste_titre"><td>'.$langs->trans("Printer").' 2</td><td></td><td align="right">'; |
170 | 170 | print '</td></tr>'; |
171 | -$nbofentries=(count($data) - 1); |
|
171 | +$nbofentries = (count($data) - 1); |
|
172 | 172 | print '<form action="orderprinters.php">'; |
173 | 173 | if ($nbofentries > 0) |
174 | 174 | { |
175 | 175 | print '<tr class="pair"><td colspan="3">'; |
176 | 176 | print '<input type="hidden" name="action" value="SavePrinter2">'; |
177 | 177 | foreach ($data as $row) { |
178 | - if (strpos($conf->global->TAKEPOS_PRINTED_CATEGORIES_2, ';'.$row["rowid"].';') !== false) $checked='checked'; else $checked=''; |
|
179 | - if ($row["fk_menu"]==0) print '<input type="checkbox" name="printer2[]" value="'.$row["rowid"].'" '.$checked.'>'.$row["label"].'<br>'; |
|
178 | + if (strpos($conf->global->TAKEPOS_PRINTED_CATEGORIES_2, ';'.$row["rowid"].';') !== false) $checked = 'checked'; else $checked = ''; |
|
179 | + if ($row["fk_menu"] == 0) print '<input type="checkbox" name="printer2[]" value="'.$row["rowid"].'" '.$checked.'>'.$row["label"].'<br>'; |
|
180 | 180 | } |
181 | 181 | print '</td></tr>'; |
182 | 182 | } |
183 | 183 | else |
184 | 184 | { |
185 | 185 | print '<tr class="pair">'; |
186 | - print '<td colspan="3"><table class="nobordernopadding"><tr class="nobordernopadding"><td>'.img_picto_common('','treemenu/branchbottom.gif').'</td>'; |
|
186 | + print '<td colspan="3"><table class="nobordernopadding"><tr class="nobordernopadding"><td>'.img_picto_common('', 'treemenu/branchbottom.gif').'</td>'; |
|
187 | 187 | print '<td valign="middle">'; |
188 | 188 | print $langs->trans("NoCategoryYet"); |
189 | 189 | print '</td>'; |
@@ -70,7 +70,9 @@ discard block |
||
70 | 70 | |
71 | 71 | // Security check |
72 | 72 | $socid = GETPOST('socid','int'); |
73 | -if ($user->societe_id) $socid=$user->societe_id; |
|
73 | +if ($user->societe_id) { |
|
74 | + $socid=$user->societe_id; |
|
75 | +} |
|
74 | 76 | $result = restrictedArea($user,'societe',$socid,''); |
75 | 77 | |
76 | 78 | $search_all=trim(GETPOST('search_all', 'alphanohtml')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml')); |
@@ -121,8 +123,12 @@ discard block |
||
121 | 123 | $sortfield=GETPOST("sortfield",'alpha'); |
122 | 124 | $sortorder=GETPOST("sortorder",'alpha'); |
123 | 125 | $page=GETPOST("page",'int'); |
124 | -if (! $sortorder) $sortorder="ASC"; |
|
125 | -if (! $sortfield) $sortfield="s.nom"; |
|
126 | +if (! $sortorder) { |
|
127 | + $sortorder="ASC"; |
|
128 | +} |
|
129 | +if (! $sortfield) { |
|
130 | + $sortfield="s.nom"; |
|
131 | +} |
|
126 | 132 | if (empty($page) || $page == -1) { $page = 0; } |
127 | 133 | $offset = $limit * $page; |
128 | 134 | $pageprev = $page - 1; |
@@ -134,9 +140,18 @@ discard block |
||
134 | 140 | if ($search_type == '2,3') { $contextpage='prospectlist'; $type='p'; } |
135 | 141 | if ($search_type == '4') { $contextpage='supplierlist'; $type='f'; } |
136 | 142 | */ |
137 | -if ($type == 'c') { $contextpage='customerlist'; if ($search_type=='') $search_type='1,3'; } |
|
138 | -if ($type == 'p') { $contextpage='prospectlist'; if ($search_type=='') $search_type='2,3'; } |
|
139 | -if ($type == 'f') { $contextpage='supplierlist'; if ($search_type=='') $search_type='4'; } |
|
143 | +if ($type == 'c') { $contextpage='customerlist'; if ($search_type=='') { |
|
144 | + $search_type='1,3'; |
|
145 | +} |
|
146 | +} |
|
147 | +if ($type == 'p') { $contextpage='prospectlist'; if ($search_type=='') { |
|
148 | + $search_type='2,3'; |
|
149 | +} |
|
150 | +} |
|
151 | +if ($type == 'f') { $contextpage='supplierlist'; if ($search_type=='') { |
|
152 | + $search_type='4'; |
|
153 | +} |
|
154 | +} |
|
140 | 155 | |
141 | 156 | // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context |
142 | 157 | $hookmanager->initHooks(array($contextpage)); |
@@ -161,10 +176,18 @@ discard block |
||
161 | 176 | 's.siret'=>"ProfId2", |
162 | 177 | 's.ape'=>"ProfId3", |
163 | 178 | ); |
164 | -if (($tmp = $langs->transnoentities("ProfId4".$mysoc->country_code)) && $tmp != "ProfId4".$mysoc->country_code && $tmp != '-') $fieldstosearchall['s.idprof4']='ProfId4'; |
|
165 | -if (($tmp = $langs->transnoentities("ProfId5".$mysoc->country_code)) && $tmp != "ProfId5".$mysoc->country_code && $tmp != '-') $fieldstosearchall['s.idprof5']='ProfId5'; |
|
166 | -if (($tmp = $langs->transnoentities("ProfId6".$mysoc->country_code)) && $tmp != "ProfId6".$mysoc->country_code && $tmp != '-') $fieldstosearchall['s.idprof6']='ProfId6'; |
|
167 | -if (!empty($conf->barcode->enabled)) $fieldstosearchall['s.barcode']='Gencod'; |
|
179 | +if (($tmp = $langs->transnoentities("ProfId4".$mysoc->country_code)) && $tmp != "ProfId4".$mysoc->country_code && $tmp != '-') { |
|
180 | + $fieldstosearchall['s.idprof4']='ProfId4'; |
|
181 | +} |
|
182 | +if (($tmp = $langs->transnoentities("ProfId5".$mysoc->country_code)) && $tmp != "ProfId5".$mysoc->country_code && $tmp != '-') { |
|
183 | + $fieldstosearchall['s.idprof5']='ProfId5'; |
|
184 | +} |
|
185 | +if (($tmp = $langs->transnoentities("ProfId6".$mysoc->country_code)) && $tmp != "ProfId6".$mysoc->country_code && $tmp != '-') { |
|
186 | + $fieldstosearchall['s.idprof6']='ProfId6'; |
|
187 | +} |
|
188 | +if (!empty($conf->barcode->enabled)) { |
|
189 | + $fieldstosearchall['s.barcode']='Gencod'; |
|
190 | +} |
|
168 | 191 | |
169 | 192 | // Define list of fields to show into list |
170 | 193 | $checkedcustomercode=(in_array($contextpage, array('thirdpartylist', 'customerlist', 'prospectlist')) ? 1 : 0); |
@@ -221,7 +244,9 @@ discard block |
||
221 | 244 | { |
222 | 245 | foreach($extrafields->attribute_label as $key => $val) |
223 | 246 | { |
224 | - if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key])); |
|
247 | + if (! empty($extrafields->attribute_list[$key])) { |
|
248 | + $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key])); |
|
249 | + } |
|
225 | 250 | } |
226 | 251 | } |
227 | 252 | |
@@ -237,7 +262,9 @@ discard block |
||
237 | 262 | |
238 | 263 | $parameters=array(); |
239 | 264 | $reshook=$hookmanager->executeHooks('doActions',$parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
240 | -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
265 | +if ($reshook < 0) { |
|
266 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
267 | +} |
|
241 | 268 | |
242 | 269 | if (empty($reshook)) |
243 | 270 | { |
@@ -245,9 +272,11 @@ discard block |
||
245 | 272 | include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; |
246 | 273 | |
247 | 274 | // Did we click on purge search criteria ? |
248 | - if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers |
|
275 | + if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) { |
|
276 | + // All tests are required to be compatible with all browsers |
|
249 | 277 | { |
250 | 278 | $search_id=''; |
279 | + } |
|
251 | 280 | $search_nom=''; |
252 | 281 | $search_alias=''; |
253 | 282 | $search_categ_cus=0; |
@@ -297,13 +326,18 @@ discard block |
||
297 | 326 | $result=$object->fetch(GETPOST('stcommsocid')); |
298 | 327 | $object->stcomm_id=dol_getIdFromCode($db, GETPOST('stcomm','alpha'), 'c_stcomm'); |
299 | 328 | $result=$object->update($object->id, $user); |
300 | - if ($result < 0) setEventMessages($object->error,$object->errors,'errors'); |
|
329 | + if ($result < 0) { |
|
330 | + setEventMessages($object->error,$object->errors,'errors'); |
|
331 | + } |
|
301 | 332 | |
302 | 333 | $action=''; |
303 | 334 | } |
304 | 335 | } |
305 | 336 | |
306 | -if ($search_status=='') $search_status=1; // always display active thirdparty first |
|
337 | +if ($search_status=='') { |
|
338 | + $search_status=1; |
|
339 | +} |
|
340 | +// always display active thirdparty first |
|
307 | 341 | |
308 | 342 | |
309 | 343 | |
@@ -330,9 +364,15 @@ discard block |
||
330 | 364 | |
331 | 365 | |
332 | 366 | $title=$langs->trans("ListOfThirdParties"); |
333 | -if ($type == 'c' && (empty($search_type) || ($search_type == '1,3'))) $title=$langs->trans("ListOfCustomers"); |
|
334 | -if ($type == 'p' && (empty($search_type) || ($search_type == '2,3'))) $title=$langs->trans("ListOfProspects"); |
|
335 | -if ($type == 'f' && (empty($search_type) || ($search_type == '4'))) $title=$langs->trans("ListOfSuppliers"); |
|
367 | +if ($type == 'c' && (empty($search_type) || ($search_type == '1,3'))) { |
|
368 | + $title=$langs->trans("ListOfCustomers"); |
|
369 | +} |
|
370 | +if ($type == 'p' && (empty($search_type) || ($search_type == '2,3'))) { |
|
371 | + $title=$langs->trans("ListOfProspects"); |
|
372 | +} |
|
373 | +if ($type == 'f' && (empty($search_type) || ($search_type == '4'))) { |
|
374 | + $title=$langs->trans("ListOfSuppliers"); |
|
375 | +} |
|
336 | 376 | |
337 | 377 | // If both parameters are set, search for everything BETWEEN them |
338 | 378 | if ($search_level_from != '' && $search_level_to != '') |
@@ -393,7 +433,9 @@ discard block |
||
393 | 433 | { |
394 | 434 | // Compute level text |
395 | 435 | $level=$langs->trans($obj->code); |
396 | - if ($level == $obj->code) $level=$langs->trans($obj->label); |
|
436 | + if ($level == $obj->code) { |
|
437 | + $level=$langs->trans($obj->label); |
|
438 | + } |
|
397 | 439 | |
398 | 440 | // Put it in the array sorted by sortorder |
399 | 441 | $tab_level[$obj->sortorder] = $level; |
@@ -408,8 +450,9 @@ discard block |
||
408 | 450 | // Implode the $search_levels array so that it can be use in a "IN (...)" where clause. |
409 | 451 | // If no paramters was set, $search_levels will be empty |
410 | 452 | $search_levels = implode(',', $search_levels); |
453 | +} else { |
|
454 | + dol_print_error($db); |
|
411 | 455 | } |
412 | -else dol_print_error($db); |
|
413 | 456 | |
414 | 457 | $sql = "SELECT s.rowid, s.nom as name, s.name_alias, s.barcode, s.town, s.zip, s.datec, s.code_client, s.code_fournisseur, s.logo,"; |
415 | 458 | $sql.= " st.libelle as stcomm, s.fk_stcomm as stcomm_id, s.fk_prospectlevel, s.prefix_comm, s.client, s.fournisseur, s.canvas, s.status as status,"; |
@@ -420,76 +463,182 @@ discard block |
||
420 | 463 | $sql.= " state.code_departement as state_code, state.nom as state_name,"; |
421 | 464 | $sql.= " region.code_region as region_code, region.nom as region_name"; |
422 | 465 | // We'll need these fields in order to filter by sale (including the case where the user can only see his prospects) |
423 | -if ($search_sale) $sql .= ", sc.fk_soc, sc.fk_user"; |
|
466 | +if ($search_sale) { |
|
467 | + $sql .= ", sc.fk_soc, sc.fk_user"; |
|
468 | +} |
|
424 | 469 | // We'll need these fields in order to filter by categ |
425 | -if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc"; |
|
426 | -if ($search_categ_sup) $sql .= ", cs.fk_categorie, cs.fk_soc"; |
|
470 | +if ($search_categ_cus) { |
|
471 | + $sql .= ", cc.fk_categorie, cc.fk_soc"; |
|
472 | +} |
|
473 | +if ($search_categ_sup) { |
|
474 | + $sql .= ", cs.fk_categorie, cs.fk_soc"; |
|
475 | +} |
|
427 | 476 | // Add fields from extrafields |
428 | -foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); |
|
477 | +foreach ($extrafields->attribute_label as $key => $val) { |
|
478 | + $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); |
|
479 | +} |
|
429 | 480 | // Add fields from hooks |
430 | 481 | $parameters=array(); |
431 | 482 | $reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook |
432 | 483 | $sql.=$hookmanager->resPrint; |
433 | 484 | $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; |
434 | -if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_extrafields as ef on (s.rowid = ef.fk_object)"; |
|
485 | +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { |
|
486 | + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_extrafields as ef on (s.rowid = ef.fk_object)"; |
|
487 | +} |
|
435 | 488 | $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)"; |
436 | 489 | $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)"; |
437 | 490 | $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)"; |
438 | 491 | $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as region on (region. code_region = state.fk_region)"; |
439 | 492 | // We'll need this table joined to the select in order to filter by categ |
440 | -if (! empty($search_categ_cus)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ |
|
441 | -if (! empty($search_categ_sup)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_fournisseur as cs ON s.rowid = cs.fk_soc"; // We'll need this table joined to the select in order to filter by categ |
|
493 | +if (! empty($search_categ_cus)) { |
|
494 | + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; |
|
495 | +} |
|
496 | +// We'll need this table joined to the select in order to filter by categ |
|
497 | +if (! empty($search_categ_sup)) { |
|
498 | + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_fournisseur as cs ON s.rowid = cs.fk_soc"; |
|
499 | +} |
|
500 | +// We'll need this table joined to the select in order to filter by categ |
|
442 | 501 | $sql.= " ,".MAIN_DB_PREFIX."c_stcomm as st"; |
443 | 502 | // We'll need this table joined to the select in order to filter by sale |
444 | -if ($search_sale || (!$user->rights->societe->client->voir && !$socid)) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; |
|
503 | +if ($search_sale || (!$user->rights->societe->client->voir && !$socid)) { |
|
504 | + $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; |
|
505 | +} |
|
445 | 506 | $sql.= " WHERE s.fk_stcomm = st.id"; |
446 | 507 | $sql.= " AND s.entity IN (".getEntity('societe').")"; |
447 | -if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; |
|
448 | -if ($socid) $sql.= " AND s.rowid = ".$socid; |
|
449 | -if ($search_sale) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale |
|
450 | -if (! $user->rights->fournisseur->lire) $sql.=" AND (s.fournisseur <> 1 OR s.client <> 0)"; // client=0, fournisseur=0 must be visible |
|
451 | -if ($search_sale) $sql.= " AND sc.fk_user = ".$db->escape($search_sale); |
|
452 | -if ($search_categ_cus > 0) $sql.= " AND cc.fk_categorie = ".$db->escape($search_categ_cus); |
|
453 | -if ($search_categ_sup > 0) $sql.= " AND cs.fk_categorie = ".$db->escape($search_categ_sup); |
|
454 | -if ($search_categ_cus == -2) $sql.= " AND cc.fk_categorie IS NULL"; |
|
455 | -if ($search_categ_sup == -2) $sql.= " AND cs.fk_categorie IS NULL"; |
|
456 | - |
|
457 | -if ($search_all) $sql.= natural_search(array_keys($fieldstosearchall), $search_all); |
|
458 | -if (strlen($search_cti)) $sql.= natural_search('s.phone', $search_cti); |
|
459 | - |
|
460 | -if ($search_id > 0) $sql.= natural_search("s.rowid",$search_id,1); |
|
461 | -if ($search_nom) $sql.= natural_search("s.nom",$search_nom); |
|
462 | -if ($search_alias) $sql.= natural_search("s.name_alias",$search_alias); |
|
463 | -if ($search_nom_only) $sql.= natural_search("s.nom",$search_nom_only); |
|
464 | -if ($search_customer_code) $sql.= natural_search("s.code_client",$search_customer_code); |
|
465 | -if ($search_supplier_code) $sql.= natural_search("s.code_fournisseur",$search_supplier_code); |
|
466 | -if ($search_account_customer_code) $sql.= natural_search("s.code_compta",$search_account_customer_code); |
|
467 | -if ($search_account_supplier_code) $sql.= natural_search("s.code_compta_fournisseur",$search_account_supplier_code); |
|
468 | -if ($search_town) $sql.= natural_search("s.town",$search_town); |
|
469 | -if (strlen($search_zip)) $sql.= natural_search("s.zip",$search_zip); |
|
470 | -if ($search_state) $sql.= natural_search("state.nom",$search_state); |
|
471 | -if ($search_region) $sql.= natural_search("region.nom",$search_region); |
|
472 | -if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')'; |
|
473 | -if ($search_email) $sql.= natural_search("s.email",$search_email); |
|
474 | -if (strlen($search_phone)) $sql.= natural_search("s.phone", $search_phone); |
|
475 | -if ($search_url) $sql.= natural_search("s.url",$search_url); |
|
476 | -if (strlen($search_idprof1)) $sql.= natural_search("s.siren",$search_idprof1); |
|
477 | -if (strlen($search_idprof2)) $sql.= natural_search("s.siret",$search_idprof2); |
|
478 | -if (strlen($search_idprof3)) $sql.= natural_search("s.ape",$search_idprof3); |
|
479 | -if (strlen($search_idprof4)) $sql.= natural_search("s.idprof4",$search_idprof4); |
|
480 | -if (strlen($search_idprof5)) $sql.= natural_search("s.idprof5",$search_idprof5); |
|
481 | -if (strlen($search_idprof6)) $sql.= natural_search("s.idprof6",$search_idprof6); |
|
482 | -if (strlen($search_vat)) $sql.= natural_search("s.tva_intra",$search_vat); |
|
508 | +if (! $user->rights->societe->client->voir && ! $socid) { |
|
509 | + $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; |
|
510 | +} |
|
511 | +if ($socid) { |
|
512 | + $sql.= " AND s.rowid = ".$socid; |
|
513 | +} |
|
514 | +if ($search_sale) { |
|
515 | + $sql.= " AND s.rowid = sc.fk_soc"; |
|
516 | +} |
|
517 | +// Join for the needed table to filter by sale |
|
518 | +if (! $user->rights->fournisseur->lire) { |
|
519 | + $sql.=" AND (s.fournisseur <> 1 OR s.client <> 0)"; |
|
520 | +} |
|
521 | +// client=0, fournisseur=0 must be visible |
|
522 | +if ($search_sale) { |
|
523 | + $sql.= " AND sc.fk_user = ".$db->escape($search_sale); |
|
524 | +} |
|
525 | +if ($search_categ_cus > 0) { |
|
526 | + $sql.= " AND cc.fk_categorie = ".$db->escape($search_categ_cus); |
|
527 | +} |
|
528 | +if ($search_categ_sup > 0) { |
|
529 | + $sql.= " AND cs.fk_categorie = ".$db->escape($search_categ_sup); |
|
530 | +} |
|
531 | +if ($search_categ_cus == -2) { |
|
532 | + $sql.= " AND cc.fk_categorie IS NULL"; |
|
533 | +} |
|
534 | +if ($search_categ_sup == -2) { |
|
535 | + $sql.= " AND cs.fk_categorie IS NULL"; |
|
536 | +} |
|
537 | + |
|
538 | +if ($search_all) { |
|
539 | + $sql.= natural_search(array_keys($fieldstosearchall), $search_all); |
|
540 | +} |
|
541 | +if (strlen($search_cti)) { |
|
542 | + $sql.= natural_search('s.phone', $search_cti); |
|
543 | +} |
|
544 | + |
|
545 | +if ($search_id > 0) { |
|
546 | + $sql.= natural_search("s.rowid",$search_id,1); |
|
547 | +} |
|
548 | +if ($search_nom) { |
|
549 | + $sql.= natural_search("s.nom",$search_nom); |
|
550 | +} |
|
551 | +if ($search_alias) { |
|
552 | + $sql.= natural_search("s.name_alias",$search_alias); |
|
553 | +} |
|
554 | +if ($search_nom_only) { |
|
555 | + $sql.= natural_search("s.nom",$search_nom_only); |
|
556 | +} |
|
557 | +if ($search_customer_code) { |
|
558 | + $sql.= natural_search("s.code_client",$search_customer_code); |
|
559 | +} |
|
560 | +if ($search_supplier_code) { |
|
561 | + $sql.= natural_search("s.code_fournisseur",$search_supplier_code); |
|
562 | +} |
|
563 | +if ($search_account_customer_code) { |
|
564 | + $sql.= natural_search("s.code_compta",$search_account_customer_code); |
|
565 | +} |
|
566 | +if ($search_account_supplier_code) { |
|
567 | + $sql.= natural_search("s.code_compta_fournisseur",$search_account_supplier_code); |
|
568 | +} |
|
569 | +if ($search_town) { |
|
570 | + $sql.= natural_search("s.town",$search_town); |
|
571 | +} |
|
572 | +if (strlen($search_zip)) { |
|
573 | + $sql.= natural_search("s.zip",$search_zip); |
|
574 | +} |
|
575 | +if ($search_state) { |
|
576 | + $sql.= natural_search("state.nom",$search_state); |
|
577 | +} |
|
578 | +if ($search_region) { |
|
579 | + $sql.= natural_search("region.nom",$search_region); |
|
580 | +} |
|
581 | +if ($search_country) { |
|
582 | + $sql .= " AND s.fk_pays IN (".$search_country.')'; |
|
583 | +} |
|
584 | +if ($search_email) { |
|
585 | + $sql.= natural_search("s.email",$search_email); |
|
586 | +} |
|
587 | +if (strlen($search_phone)) { |
|
588 | + $sql.= natural_search("s.phone", $search_phone); |
|
589 | +} |
|
590 | +if ($search_url) { |
|
591 | + $sql.= natural_search("s.url",$search_url); |
|
592 | +} |
|
593 | +if (strlen($search_idprof1)) { |
|
594 | + $sql.= natural_search("s.siren",$search_idprof1); |
|
595 | +} |
|
596 | +if (strlen($search_idprof2)) { |
|
597 | + $sql.= natural_search("s.siret",$search_idprof2); |
|
598 | +} |
|
599 | +if (strlen($search_idprof3)) { |
|
600 | + $sql.= natural_search("s.ape",$search_idprof3); |
|
601 | +} |
|
602 | +if (strlen($search_idprof4)) { |
|
603 | + $sql.= natural_search("s.idprof4",$search_idprof4); |
|
604 | +} |
|
605 | +if (strlen($search_idprof5)) { |
|
606 | + $sql.= natural_search("s.idprof5",$search_idprof5); |
|
607 | +} |
|
608 | +if (strlen($search_idprof6)) { |
|
609 | + $sql.= natural_search("s.idprof6",$search_idprof6); |
|
610 | +} |
|
611 | +if (strlen($search_vat)) { |
|
612 | + $sql.= natural_search("s.tva_intra",$search_vat); |
|
613 | +} |
|
483 | 614 | // Filter on type of thirdparty |
484 | -if ($search_type > 0 && in_array($search_type,array('1,3','2,3'))) $sql .= " AND s.client IN (".$db->escape($search_type).")"; |
|
485 | -if ($search_type > 0 && in_array($search_type,array('4'))) $sql .= " AND s.fournisseur = 1"; |
|
486 | -if ($search_type == '0') $sql .= " AND s.client = 0 AND s.fournisseur = 0"; |
|
487 | -if ($search_status!='' && $search_status >= 0) $sql .= " AND s.status = ".$db->escape($search_status); |
|
488 | -if (!empty($conf->barcode->enabled) && $search_barcode) $sql.= natural_search("s.barcode", $search_barcode); |
|
489 | -if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')'; |
|
490 | -if ($search_levels) $sql .= " AND s.fk_prospectlevel IN (".$search_levels.')'; |
|
491 | -if ($search_stcomm != '' && $search_stcomm != -2) $sql.= natural_search("s.fk_stcomm",$search_stcomm,2); |
|
492 | -if ($search_import_key) $sql.= natural_search("s.import_key",$search_import_key); |
|
615 | +if ($search_type > 0 && in_array($search_type,array('1,3','2,3'))) { |
|
616 | + $sql .= " AND s.client IN (".$db->escape($search_type).")"; |
|
617 | +} |
|
618 | +if ($search_type > 0 && in_array($search_type,array('4'))) { |
|
619 | + $sql .= " AND s.fournisseur = 1"; |
|
620 | +} |
|
621 | +if ($search_type == '0') { |
|
622 | + $sql .= " AND s.client = 0 AND s.fournisseur = 0"; |
|
623 | +} |
|
624 | +if ($search_status!='' && $search_status >= 0) { |
|
625 | + $sql .= " AND s.status = ".$db->escape($search_status); |
|
626 | +} |
|
627 | +if (!empty($conf->barcode->enabled) && $search_barcode) { |
|
628 | + $sql.= natural_search("s.barcode", $search_barcode); |
|
629 | +} |
|
630 | +if ($search_type_thirdparty) { |
|
631 | + $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')'; |
|
632 | +} |
|
633 | +if ($search_levels) { |
|
634 | + $sql .= " AND s.fk_prospectlevel IN (".$search_levels.')'; |
|
635 | +} |
|
636 | +if ($search_stcomm != '' && $search_stcomm != -2) { |
|
637 | + $sql.= natural_search("s.fk_stcomm",$search_stcomm,2); |
|
638 | +} |
|
639 | +if ($search_import_key) { |
|
640 | + $sql.= natural_search("s.import_key",$search_import_key); |
|
641 | +} |
|
493 | 642 | // Add where from extra fields |
494 | 643 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; |
495 | 644 | |
@@ -533,44 +682,120 @@ discard block |
||
533 | 682 | llxHeader('',$langs->trans("ThirdParty"),$help_url); |
534 | 683 | |
535 | 684 | $param=''; |
536 | -if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; |
|
537 | -if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; |
|
538 | -if ($search_all != '') $param = "&sall=".urlencode($search_all); |
|
539 | -if ($sall != '') $param .= "&sall=".urlencode($sall); |
|
540 | -if ($search_categ_cus > 0) $param.='&search_categ_cus='.urlencode($search_categ_cus); |
|
541 | -if ($search_categ_sup > 0) $param.='&search_categ_sup='.urlencode($search_categ_sup); |
|
542 | -if ($search_sale > 0) $param.='&search_sale='.urlencode($search_sale); |
|
543 | -if ($search_id > 0) $param.= "&search_id=".urlencode($search_id); |
|
544 | -if ($search_nom != '') $param.= "&search_nom=".urlencode($search_nom); |
|
545 | -if ($search_alias != '') $param.= "&search_alias=".urlencode($search_alias); |
|
546 | -if ($search_town != '') $param.= "&search_town=".urlencode($search_town); |
|
547 | -if ($search_zip != '') $param.= "&search_zip=".urlencode($search_zip); |
|
548 | -if ($search_phone != '') $param.= "&search_phone=".urlencode($search_phone); |
|
549 | -if ($search_email != '') $param.= "&search_email=".urlencode($search_email); |
|
550 | -if ($search_url != '') $param.= "&search_url=".urlencode($search_url); |
|
551 | -if ($search_state != '') $param.= "&search_state=".urlencode($search_state); |
|
552 | -if ($search_country != '') $param.= "&search_country=".urlencode($search_country); |
|
553 | -if ($search_customer_code != '') $param.= "&search_customer_code=".urlencode($search_customer_code); |
|
554 | -if ($search_supplier_code != '') $param.= "&search_supplier_code=".urlencode($search_supplier_code); |
|
555 | -if ($search_account_customer_code != '') $param.= "&search_account_customer_code=".urlencode($search_account_customer_code); |
|
556 | -if ($search_account_supplier_code != '') $param.= "&search_account_supplier_code=".urlencode($search_account_supplier_code); |
|
557 | -if ($search_barcode != '') $param.= "&search_barcode=".urlencode($search_barcode); |
|
558 | -if ($search_idprof1 != '') $param.= '&search_idprof1='.urlencode($search_idprof1); |
|
559 | -if ($search_idprof2 != '') $param.= '&search_idprof2='.urlencode($search_idprof2); |
|
560 | -if ($search_idprof3 != '') $param.= '&search_idprof3='.urlencode($search_idprof3); |
|
561 | -if ($search_idprof4 != '') $param.= '&search_idprof4='.urlencode($search_idprof4); |
|
562 | -if ($search_idprof5 != '') $param.= '&search_idprof5='.urlencode($search_idprof5); |
|
563 | -if ($search_idprof6 != '') $param.= '&search_idprof6='.urlencode($search_idprof6); |
|
564 | -if ($search_vat != '') $param.= '&search_vat='.urlencode($search_vat); |
|
565 | -if ($search_type_thirdparty != '') $param.='&search_type_thirdparty='.urlencode($search_type_thirdparty); |
|
566 | -if ($search_type != '') $param.='&search_type='.urlencode($search_type); |
|
567 | -if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); |
|
568 | -if ($search_status != '') $param.='&search_status='.urlencode($search_status); |
|
569 | -if ($search_stcomm != '') $param.='&search_stcomm='.urlencode($search_stcomm); |
|
570 | -if ($search_level_from != '') $param.='&search_level_from='.urlencode($search_level_from); |
|
571 | -if ($search_level_to != '') $param.='&search_level_to='.urlencode($search_level_to); |
|
572 | -if ($search_import_key != '') $param.='&search_import_key='.urlencode($search_import_key); |
|
573 | -if ($type != '') $param.='&type='.urlencode($type); |
|
685 | +if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { |
|
686 | + $param.='&contextpage='.$contextpage; |
|
687 | +} |
|
688 | +if ($limit > 0 && $limit != $conf->liste_limit) { |
|
689 | + $param.='&limit='.$limit; |
|
690 | +} |
|
691 | +if ($search_all != '') { |
|
692 | + $param = "&sall=".urlencode($search_all); |
|
693 | +} |
|
694 | +if ($sall != '') { |
|
695 | + $param .= "&sall=".urlencode($sall); |
|
696 | +} |
|
697 | +if ($search_categ_cus > 0) { |
|
698 | + $param.='&search_categ_cus='.urlencode($search_categ_cus); |
|
699 | +} |
|
700 | +if ($search_categ_sup > 0) { |
|
701 | + $param.='&search_categ_sup='.urlencode($search_categ_sup); |
|
702 | +} |
|
703 | +if ($search_sale > 0) { |
|
704 | + $param.='&search_sale='.urlencode($search_sale); |
|
705 | +} |
|
706 | +if ($search_id > 0) { |
|
707 | + $param.= "&search_id=".urlencode($search_id); |
|
708 | +} |
|
709 | +if ($search_nom != '') { |
|
710 | + $param.= "&search_nom=".urlencode($search_nom); |
|
711 | +} |
|
712 | +if ($search_alias != '') { |
|
713 | + $param.= "&search_alias=".urlencode($search_alias); |
|
714 | +} |
|
715 | +if ($search_town != '') { |
|
716 | + $param.= "&search_town=".urlencode($search_town); |
|
717 | +} |
|
718 | +if ($search_zip != '') { |
|
719 | + $param.= "&search_zip=".urlencode($search_zip); |
|
720 | +} |
|
721 | +if ($search_phone != '') { |
|
722 | + $param.= "&search_phone=".urlencode($search_phone); |
|
723 | +} |
|
724 | +if ($search_email != '') { |
|
725 | + $param.= "&search_email=".urlencode($search_email); |
|
726 | +} |
|
727 | +if ($search_url != '') { |
|
728 | + $param.= "&search_url=".urlencode($search_url); |
|
729 | +} |
|
730 | +if ($search_state != '') { |
|
731 | + $param.= "&search_state=".urlencode($search_state); |
|
732 | +} |
|
733 | +if ($search_country != '') { |
|
734 | + $param.= "&search_country=".urlencode($search_country); |
|
735 | +} |
|
736 | +if ($search_customer_code != '') { |
|
737 | + $param.= "&search_customer_code=".urlencode($search_customer_code); |
|
738 | +} |
|
739 | +if ($search_supplier_code != '') { |
|
740 | + $param.= "&search_supplier_code=".urlencode($search_supplier_code); |
|
741 | +} |
|
742 | +if ($search_account_customer_code != '') { |
|
743 | + $param.= "&search_account_customer_code=".urlencode($search_account_customer_code); |
|
744 | +} |
|
745 | +if ($search_account_supplier_code != '') { |
|
746 | + $param.= "&search_account_supplier_code=".urlencode($search_account_supplier_code); |
|
747 | +} |
|
748 | +if ($search_barcode != '') { |
|
749 | + $param.= "&search_barcode=".urlencode($search_barcode); |
|
750 | +} |
|
751 | +if ($search_idprof1 != '') { |
|
752 | + $param.= '&search_idprof1='.urlencode($search_idprof1); |
|
753 | +} |
|
754 | +if ($search_idprof2 != '') { |
|
755 | + $param.= '&search_idprof2='.urlencode($search_idprof2); |
|
756 | +} |
|
757 | +if ($search_idprof3 != '') { |
|
758 | + $param.= '&search_idprof3='.urlencode($search_idprof3); |
|
759 | +} |
|
760 | +if ($search_idprof4 != '') { |
|
761 | + $param.= '&search_idprof4='.urlencode($search_idprof4); |
|
762 | +} |
|
763 | +if ($search_idprof5 != '') { |
|
764 | + $param.= '&search_idprof5='.urlencode($search_idprof5); |
|
765 | +} |
|
766 | +if ($search_idprof6 != '') { |
|
767 | + $param.= '&search_idprof6='.urlencode($search_idprof6); |
|
768 | +} |
|
769 | +if ($search_vat != '') { |
|
770 | + $param.= '&search_vat='.urlencode($search_vat); |
|
771 | +} |
|
772 | +if ($search_type_thirdparty != '') { |
|
773 | + $param.='&search_type_thirdparty='.urlencode($search_type_thirdparty); |
|
774 | +} |
|
775 | +if ($search_type != '') { |
|
776 | + $param.='&search_type='.urlencode($search_type); |
|
777 | +} |
|
778 | +if ($optioncss != '') { |
|
779 | + $param.='&optioncss='.urlencode($optioncss); |
|
780 | +} |
|
781 | +if ($search_status != '') { |
|
782 | + $param.='&search_status='.urlencode($search_status); |
|
783 | +} |
|
784 | +if ($search_stcomm != '') { |
|
785 | + $param.='&search_stcomm='.urlencode($search_stcomm); |
|
786 | +} |
|
787 | +if ($search_level_from != '') { |
|
788 | + $param.='&search_level_from='.urlencode($search_level_from); |
|
789 | +} |
|
790 | +if ($search_level_to != '') { |
|
791 | + $param.='&search_level_to='.urlencode($search_level_to); |
|
792 | +} |
|
793 | +if ($search_import_key != '') { |
|
794 | + $param.='&search_import_key='.urlencode($search_import_key); |
|
795 | +} |
|
796 | +if ($type != '') { |
|
797 | + $param.='&type='.urlencode($type); |
|
798 | +} |
|
574 | 799 | // Add $param from extra fields |
575 | 800 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; |
576 | 801 | |
@@ -586,12 +811,18 @@ discard block |
||
586 | 811 | // 'builddoc'=>$langs->trans("PDFMerge"), |
587 | 812 | ); |
588 | 813 | //if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer"); |
589 | -if ($user->rights->societe->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete"); |
|
590 | -if (GETPOST('nomassaction','int') || in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); |
|
814 | +if ($user->rights->societe->supprimer) { |
|
815 | + $arrayofmassactions['predelete']=$langs->trans("Delete"); |
|
816 | +} |
|
817 | +if (GETPOST('nomassaction','int') || in_array($massaction, array('presend','predelete'))) { |
|
818 | + $arrayofmassactions=array(); |
|
819 | +} |
|
591 | 820 | $massactionbutton=$form->selectMassAction('', $arrayofmassactions); |
592 | 821 | |
593 | 822 | print '<form method="post" action="'.$_SERVER["PHP_SELF"].'" name="formfilter">'; |
594 | -if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; |
|
823 | +if ($optioncss != '') { |
|
824 | + print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; |
|
825 | +} |
|
595 | 826 | print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
596 | 827 | print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; |
597 | 828 | print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; |
@@ -608,7 +839,9 @@ discard block |
||
608 | 839 | $textprofid[$key]=''; |
609 | 840 | if ($label != "ProfId".$key.$mysoc->country_code) |
610 | 841 | { // Get only text between () |
611 | - if (preg_match('/\((.*)\)/i',$label,$reg)) $label=$reg[1]; |
|
842 | + if (preg_match('/\((.*)\)/i',$label,$reg)) { |
|
843 | + $label=$reg[1]; |
|
844 | + } |
|
612 | 845 | $textprofid[$key]=$langs->trans("ProfIdShortDesc",$key,$mysoc->country_code,$label); |
613 | 846 | } |
614 | 847 | } |
@@ -621,7 +854,9 @@ discard block |
||
621 | 854 | |
622 | 855 | if ($search_all) |
623 | 856 | { |
624 | - foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); |
|
857 | + foreach($fieldstosearchall as $key => $val) { |
|
858 | + $fieldstosearchall[$key]=$langs->trans($val); |
|
859 | + } |
|
625 | 860 | print $langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall); |
626 | 861 | } |
627 | 862 | |
@@ -670,9 +905,13 @@ discard block |
||
670 | 905 | |
671 | 906 | $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; |
672 | 907 | $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields |
673 | -if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); |
|
908 | +if ($massactionbutton) { |
|
909 | + $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); |
|
910 | +} |
|
674 | 911 | |
675 | -if (empty($arrayfields['customerorsupplier']['checked'])) print '<input type="hidden" name="type" value="'.$type.'">'; |
|
912 | +if (empty($arrayfields['customerorsupplier']['checked'])) { |
|
913 | + print '<input type="hidden" name="type" value="'.$type.'">'; |
|
914 | +} |
|
676 | 915 | |
677 | 916 | print '<div class="div-table-responsive">'; |
678 | 917 | print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n"; |
@@ -688,7 +927,9 @@ discard block |
||
688 | 927 | if (! empty($arrayfields['s.nom']['checked'])) |
689 | 928 | { |
690 | 929 | print '<td class="liste_titre">'; |
691 | - if (! empty($search_nom_only) && empty($search_nom)) $search_nom=$search_nom_only; |
|
930 | + if (! empty($search_nom_only) && empty($search_nom)) { |
|
931 | + $search_nom=$search_nom_only; |
|
932 | + } |
|
692 | 933 | print '<input class="flat searchstring" type="text" name="search_nom" size="8" value="'.dol_escape_htmltag($search_nom).'">'; |
693 | 934 | print '</td>'; |
694 | 935 | } |
@@ -850,11 +1091,17 @@ discard block |
||
850 | 1091 | if (! empty($arrayfields['customerorsupplier']['checked'])) |
851 | 1092 | { |
852 | 1093 | print '<td class="liste_titre maxwidthonsmartphone" align="middle">'; |
853 | - if ($type != '') print '<input type="hidden" name="type" value="'.$type.'">'; |
|
1094 | + if ($type != '') { |
|
1095 | + print '<input type="hidden" name="type" value="'.$type.'">'; |
|
1096 | + } |
|
854 | 1097 | print '<select class="flat" name="search_type">'; |
855 | 1098 | print '<option value="-1"'.($search_type==''?' selected':'').'> </option>'; |
856 | - if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) print '<option value="1,3"'.($search_type=='1,3'?' selected':'').'>'.$langs->trans('Customer').'</option>'; |
|
857 | - if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) print '<option value="2,3"'.($search_type=='2,3'?' selected':'').'>'.$langs->trans('Prospect').'</option>'; |
|
1099 | + if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) { |
|
1100 | + print '<option value="1,3"'.($search_type=='1,3'?' selected':'').'>'.$langs->trans('Customer').'</option>'; |
|
1101 | + } |
|
1102 | + if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) { |
|
1103 | + print '<option value="2,3"'.($search_type=='2,3'?' selected':'').'>'.$langs->trans('Prospect').'</option>'; |
|
1104 | + } |
|
858 | 1105 | //if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) print '<option value="3"'.($search_type=='3'?' selected':'').'>'.$langs->trans('ProspectCustomer').'</option>'; |
859 | 1106 | print '<option value="4"'.($search_type=='4'?' selected':'').'>'.$langs->trans('Supplier').'</option>'; |
860 | 1107 | print '<option value="0"'.($search_type=='0'?' selected':'').'>'.$langs->trans('Others').'</option>'; |
@@ -941,43 +1188,106 @@ discard block |
||
941 | 1188 | print "</tr>\n"; |
942 | 1189 | |
943 | 1190 | print '<tr class="liste_titre">'; |
944 | -if (! empty($arrayfields['s.rowid']['checked'])) print_liste_field_titre($arrayfields['s.rowid']['label'], $_SERVER["PHP_SELF"],"s.rowid","",$param,"",$sortfield,$sortorder); |
|
945 | -if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder); |
|
946 | -if (! empty($arrayfields['s.name_alias']['checked'])) print_liste_field_titre($arrayfields['s.name_alias']['label'], $_SERVER["PHP_SELF"],"s.name_alias","",$param,"",$sortfield,$sortorder); |
|
947 | -if (! empty($arrayfields['s.barcode']['checked'])) print_liste_field_titre($arrayfields['s.barcode']['label'], $_SERVER["PHP_SELF"], "s.barcode",$param,'','',$sortfield,$sortorder); |
|
948 | -if (! empty($arrayfields['s.code_client']['checked'])) print_liste_field_titre($arrayfields['s.code_client']['label'],$_SERVER["PHP_SELF"],"s.code_client","",$param,'',$sortfield,$sortorder); |
|
949 | -if (! empty($arrayfields['s.code_fournisseur']['checked'])) print_liste_field_titre($arrayfields['s.code_fournisseur']['label'],$_SERVER["PHP_SELF"],"s.code_fournisseur","",$param,'',$sortfield,$sortorder); |
|
950 | -if (! empty($arrayfields['s.code_compta']['checked'])) print_liste_field_titre($arrayfields['s.code_compta']['label'],$_SERVER["PHP_SELF"],"s.code_compta","",$param,'',$sortfield,$sortorder); |
|
951 | -if (! empty($arrayfields['s.code_compta_fournisseur']['checked'])) print_liste_field_titre($arrayfields['s.code_compta_fournisseur']['label'],$_SERVER["PHP_SELF"],"s.code_compta_fournisseur","",$param,'',$sortfield,$sortorder); |
|
952 | -if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'],$_SERVER["PHP_SELF"],"s.town","",$param,'',$sortfield,$sortorder); |
|
953 | -if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'],$_SERVER["PHP_SELF"],"s.zip","",$param,'',$sortfield,$sortorder); |
|
954 | -if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'],$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder); |
|
955 | -if (! empty($arrayfields['region.nom']['checked'])) print_liste_field_titre($arrayfields['region.nom']['label'],$_SERVER["PHP_SELF"],"region.nom","",$param,'',$sortfield,$sortorder); |
|
956 | -if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'],$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder); |
|
957 | -if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'],$_SERVER["PHP_SELF"],"typent.code","",$param,'align="center"',$sortfield,$sortorder); |
|
958 | -if (! empty($arrayfields['s.email']['checked'])) print_liste_field_titre($arrayfields['s.email']['label'],$_SERVER["PHP_SELF"],"s.email","",$param,'',$sortfield,$sortorder); |
|
959 | -if (! empty($arrayfields['s.phone']['checked'])) print_liste_field_titre($arrayfields['s.phone']['label'],$_SERVER["PHP_SELF"],"s.phone","",$param,'',$sortfield,$sortorder); |
|
960 | -if (! empty($arrayfields['s.url']['checked'])) print_liste_field_titre($arrayfields['s.url']['label'],$_SERVER["PHP_SELF"],"s.url","",$param,'',$sortfield,$sortorder); |
|
961 | -if (! empty($arrayfields['s.siren']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId1Short"),$textprofid[1],1,0),$_SERVER["PHP_SELF"],"s.siren","",$param,'class="nowrap"',$sortfield,$sortorder); |
|
962 | -if (! empty($arrayfields['s.siret']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId2Short"),$textprofid[2],1,0),$_SERVER["PHP_SELF"],"s.siret","",$param,'class="nowrap"',$sortfield,$sortorder); |
|
963 | -if (! empty($arrayfields['s.ape']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId3Short"),$textprofid[3],1,0),$_SERVER["PHP_SELF"],"s.ape","",$param,'class="nowrap"',$sortfield,$sortorder); |
|
964 | -if (! empty($arrayfields['s.idprof4']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId4Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof4","",$param,'class="nowrap"',$sortfield,$sortorder); |
|
965 | -if (! empty($arrayfields['s.idprof5']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId5Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof5","",$param,'class="nowrap"',$sortfield,$sortorder); |
|
966 | -if (! empty($arrayfields['s.idprof6']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId6Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof6","",$param,'class="nowrap"',$sortfield,$sortorder); |
|
967 | -if (! empty($arrayfields['s.tva_intra']['checked'])) print_liste_field_titre($arrayfields['s.tva_intra']['label'],$_SERVER["PHP_SELF"],"s.tva_intra","",$param,'class="nowrap"',$sortfield,$sortorder); |
|
968 | -if (! empty($arrayfields['customerorsupplier']['checked'])) print_liste_field_titre(''); // type of customer |
|
969 | -if (! empty($arrayfields['s.fk_prospectlevel']['checked'])) print_liste_field_titre($arrayfields['s.fk_prospectlevel']['label'],$_SERVER["PHP_SELF"],"s.fk_prospectlevel","",$param,'align="center"',$sortfield,$sortorder); |
|
970 | -if (! empty($arrayfields['s.fk_stcomm']['checked'])) print_liste_field_titre($arrayfields['s.fk_stcomm']['label'],$_SERVER["PHP_SELF"],"s.fk_stcomm","",$param,'align="center"',$sortfield,$sortorder); |
|
1191 | +if (! empty($arrayfields['s.rowid']['checked'])) { |
|
1192 | + print_liste_field_titre($arrayfields['s.rowid']['label'], $_SERVER["PHP_SELF"],"s.rowid","",$param,"",$sortfield,$sortorder); |
|
1193 | +} |
|
1194 | +if (! empty($arrayfields['s.nom']['checked'])) { |
|
1195 | + print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder); |
|
1196 | +} |
|
1197 | +if (! empty($arrayfields['s.name_alias']['checked'])) { |
|
1198 | + print_liste_field_titre($arrayfields['s.name_alias']['label'], $_SERVER["PHP_SELF"],"s.name_alias","",$param,"",$sortfield,$sortorder); |
|
1199 | +} |
|
1200 | +if (! empty($arrayfields['s.barcode']['checked'])) { |
|
1201 | + print_liste_field_titre($arrayfields['s.barcode']['label'], $_SERVER["PHP_SELF"], "s.barcode",$param,'','',$sortfield,$sortorder); |
|
1202 | +} |
|
1203 | +if (! empty($arrayfields['s.code_client']['checked'])) { |
|
1204 | + print_liste_field_titre($arrayfields['s.code_client']['label'],$_SERVER["PHP_SELF"],"s.code_client","",$param,'',$sortfield,$sortorder); |
|
1205 | +} |
|
1206 | +if (! empty($arrayfields['s.code_fournisseur']['checked'])) { |
|
1207 | + print_liste_field_titre($arrayfields['s.code_fournisseur']['label'],$_SERVER["PHP_SELF"],"s.code_fournisseur","",$param,'',$sortfield,$sortorder); |
|
1208 | +} |
|
1209 | +if (! empty($arrayfields['s.code_compta']['checked'])) { |
|
1210 | + print_liste_field_titre($arrayfields['s.code_compta']['label'],$_SERVER["PHP_SELF"],"s.code_compta","",$param,'',$sortfield,$sortorder); |
|
1211 | +} |
|
1212 | +if (! empty($arrayfields['s.code_compta_fournisseur']['checked'])) { |
|
1213 | + print_liste_field_titre($arrayfields['s.code_compta_fournisseur']['label'],$_SERVER["PHP_SELF"],"s.code_compta_fournisseur","",$param,'',$sortfield,$sortorder); |
|
1214 | +} |
|
1215 | +if (! empty($arrayfields['s.town']['checked'])) { |
|
1216 | + print_liste_field_titre($arrayfields['s.town']['label'],$_SERVER["PHP_SELF"],"s.town","",$param,'',$sortfield,$sortorder); |
|
1217 | +} |
|
1218 | +if (! empty($arrayfields['s.zip']['checked'])) { |
|
1219 | + print_liste_field_titre($arrayfields['s.zip']['label'],$_SERVER["PHP_SELF"],"s.zip","",$param,'',$sortfield,$sortorder); |
|
1220 | +} |
|
1221 | +if (! empty($arrayfields['state.nom']['checked'])) { |
|
1222 | + print_liste_field_titre($arrayfields['state.nom']['label'],$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder); |
|
1223 | +} |
|
1224 | +if (! empty($arrayfields['region.nom']['checked'])) { |
|
1225 | + print_liste_field_titre($arrayfields['region.nom']['label'],$_SERVER["PHP_SELF"],"region.nom","",$param,'',$sortfield,$sortorder); |
|
1226 | +} |
|
1227 | +if (! empty($arrayfields['country.code_iso']['checked'])) { |
|
1228 | + print_liste_field_titre($arrayfields['country.code_iso']['label'],$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder); |
|
1229 | +} |
|
1230 | +if (! empty($arrayfields['typent.code']['checked'])) { |
|
1231 | + print_liste_field_titre($arrayfields['typent.code']['label'],$_SERVER["PHP_SELF"],"typent.code","",$param,'align="center"',$sortfield,$sortorder); |
|
1232 | +} |
|
1233 | +if (! empty($arrayfields['s.email']['checked'])) { |
|
1234 | + print_liste_field_titre($arrayfields['s.email']['label'],$_SERVER["PHP_SELF"],"s.email","",$param,'',$sortfield,$sortorder); |
|
1235 | +} |
|
1236 | +if (! empty($arrayfields['s.phone']['checked'])) { |
|
1237 | + print_liste_field_titre($arrayfields['s.phone']['label'],$_SERVER["PHP_SELF"],"s.phone","",$param,'',$sortfield,$sortorder); |
|
1238 | +} |
|
1239 | +if (! empty($arrayfields['s.url']['checked'])) { |
|
1240 | + print_liste_field_titre($arrayfields['s.url']['label'],$_SERVER["PHP_SELF"],"s.url","",$param,'',$sortfield,$sortorder); |
|
1241 | +} |
|
1242 | +if (! empty($arrayfields['s.siren']['checked'])) { |
|
1243 | + print_liste_field_titre($form->textwithpicto($langs->trans("ProfId1Short"),$textprofid[1],1,0),$_SERVER["PHP_SELF"],"s.siren","",$param,'class="nowrap"',$sortfield,$sortorder); |
|
1244 | +} |
|
1245 | +if (! empty($arrayfields['s.siret']['checked'])) { |
|
1246 | + print_liste_field_titre($form->textwithpicto($langs->trans("ProfId2Short"),$textprofid[2],1,0),$_SERVER["PHP_SELF"],"s.siret","",$param,'class="nowrap"',$sortfield,$sortorder); |
|
1247 | +} |
|
1248 | +if (! empty($arrayfields['s.ape']['checked'])) { |
|
1249 | + print_liste_field_titre($form->textwithpicto($langs->trans("ProfId3Short"),$textprofid[3],1,0),$_SERVER["PHP_SELF"],"s.ape","",$param,'class="nowrap"',$sortfield,$sortorder); |
|
1250 | +} |
|
1251 | +if (! empty($arrayfields['s.idprof4']['checked'])) { |
|
1252 | + print_liste_field_titre($form->textwithpicto($langs->trans("ProfId4Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof4","",$param,'class="nowrap"',$sortfield,$sortorder); |
|
1253 | +} |
|
1254 | +if (! empty($arrayfields['s.idprof5']['checked'])) { |
|
1255 | + print_liste_field_titre($form->textwithpicto($langs->trans("ProfId5Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof5","",$param,'class="nowrap"',$sortfield,$sortorder); |
|
1256 | +} |
|
1257 | +if (! empty($arrayfields['s.idprof6']['checked'])) { |
|
1258 | + print_liste_field_titre($form->textwithpicto($langs->trans("ProfId6Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof6","",$param,'class="nowrap"',$sortfield,$sortorder); |
|
1259 | +} |
|
1260 | +if (! empty($arrayfields['s.tva_intra']['checked'])) { |
|
1261 | + print_liste_field_titre($arrayfields['s.tva_intra']['label'],$_SERVER["PHP_SELF"],"s.tva_intra","",$param,'class="nowrap"',$sortfield,$sortorder); |
|
1262 | +} |
|
1263 | +if (! empty($arrayfields['customerorsupplier']['checked'])) { |
|
1264 | + print_liste_field_titre(''); |
|
1265 | +} |
|
1266 | +// type of customer |
|
1267 | +if (! empty($arrayfields['s.fk_prospectlevel']['checked'])) { |
|
1268 | + print_liste_field_titre($arrayfields['s.fk_prospectlevel']['label'],$_SERVER["PHP_SELF"],"s.fk_prospectlevel","",$param,'align="center"',$sortfield,$sortorder); |
|
1269 | +} |
|
1270 | +if (! empty($arrayfields['s.fk_stcomm']['checked'])) { |
|
1271 | + print_liste_field_titre($arrayfields['s.fk_stcomm']['label'],$_SERVER["PHP_SELF"],"s.fk_stcomm","",$param,'align="center"',$sortfield,$sortorder); |
|
1272 | +} |
|
971 | 1273 | // Extra fields |
972 | 1274 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; |
973 | 1275 | // Hook fields |
974 | 1276 | $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); |
975 | 1277 | $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook |
976 | 1278 | print $hookmanager->resPrint; |
977 | -if (! empty($arrayfields['s.datec']['checked'])) print_liste_field_titre($arrayfields['s.datec']['label'],$_SERVER["PHP_SELF"],"s.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); |
|
978 | -if (! empty($arrayfields['s.tms']['checked'])) print_liste_field_titre($arrayfields['s.tms']['label'],$_SERVER["PHP_SELF"],"s.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); |
|
979 | -if (! empty($arrayfields['s.status']['checked'])) print_liste_field_titre($arrayfields['s.status']['label'],$_SERVER["PHP_SELF"],"s.status","",$param,'align="center"',$sortfield,$sortorder); |
|
980 | -if (! empty($arrayfields['s.import_key']['checked'])) print_liste_field_titre($arrayfields['s.import_key']['label'],$_SERVER["PHP_SELF"],"s.import_key","",$param,'align="center"',$sortfield,$sortorder); |
|
1279 | +if (! empty($arrayfields['s.datec']['checked'])) { |
|
1280 | + print_liste_field_titre($arrayfields['s.datec']['label'],$_SERVER["PHP_SELF"],"s.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); |
|
1281 | +} |
|
1282 | +if (! empty($arrayfields['s.tms']['checked'])) { |
|
1283 | + print_liste_field_titre($arrayfields['s.tms']['label'],$_SERVER["PHP_SELF"],"s.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); |
|
1284 | +} |
|
1285 | +if (! empty($arrayfields['s.status']['checked'])) { |
|
1286 | + print_liste_field_titre($arrayfields['s.status']['label'],$_SERVER["PHP_SELF"],"s.status","",$param,'align="center"',$sortfield,$sortorder); |
|
1287 | +} |
|
1288 | +if (! empty($arrayfields['s.import_key']['checked'])) { |
|
1289 | + print_liste_field_titre($arrayfields['s.import_key']['label'],$_SERVER["PHP_SELF"],"s.import_key","",$param,'align="center"',$sortfield,$sortorder); |
|
1290 | +} |
|
981 | 1291 | print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); |
982 | 1292 | print "</tr>\n"; |
983 | 1293 | |
@@ -1011,77 +1321,103 @@ discard block |
||
1011 | 1321 | print '<td class="tdoverflowmax50">'; |
1012 | 1322 | print $obj->rowid; |
1013 | 1323 | print "</td>\n"; |
1014 | - if (! $i) $totalarray['nbfield']++; |
|
1324 | + if (! $i) { |
|
1325 | + $totalarray['nbfield']++; |
|
1326 | + } |
|
1015 | 1327 | } |
1016 | 1328 | if (! empty($arrayfields['s.nom']['checked'])) |
1017 | 1329 | { |
1018 | 1330 | $savalias = $obj->name_alias; |
1019 | - if (! empty($arrayfields['s.name_alias']['checked'])) $companystatic->name_alias=''; |
|
1331 | + if (! empty($arrayfields['s.name_alias']['checked'])) { |
|
1332 | + $companystatic->name_alias=''; |
|
1333 | + } |
|
1020 | 1334 | print '<td class="tdoverflowmax200">'; |
1021 | 1335 | print $obj->name; |
1022 | 1336 | print "</td>\n"; |
1023 | - if (! $i) $totalarray['nbfield']++; |
|
1337 | + if (! $i) { |
|
1338 | + $totalarray['nbfield']++; |
|
1339 | + } |
|
1024 | 1340 | } |
1025 | 1341 | if (! empty($arrayfields['s.name_alias']['checked'])) |
1026 | 1342 | { |
1027 | 1343 | print '<td class="tdoverflowmax200">'; |
1028 | 1344 | print $companystatic->name_alias; |
1029 | 1345 | print "</td>\n"; |
1030 | - if (! $i) $totalarray['nbfield']++; |
|
1346 | + if (! $i) { |
|
1347 | + $totalarray['nbfield']++; |
|
1348 | + } |
|
1031 | 1349 | } |
1032 | 1350 | // Barcode |
1033 | 1351 | if (! empty($arrayfields['s.barcode']['checked'])) |
1034 | 1352 | { |
1035 | 1353 | print '<td>'.$obj->barcode.'</td>'; |
1036 | - if (! $i) $totalarray['nbfield']++; |
|
1354 | + if (! $i) { |
|
1355 | + $totalarray['nbfield']++; |
|
1356 | + } |
|
1037 | 1357 | } |
1038 | 1358 | // Customer code |
1039 | 1359 | if (! empty($arrayfields['s.code_client']['checked'])) |
1040 | 1360 | { |
1041 | 1361 | print '<td>'.$obj->code_client.'</td>'; |
1042 | - if (! $i) $totalarray['nbfield']++; |
|
1362 | + if (! $i) { |
|
1363 | + $totalarray['nbfield']++; |
|
1364 | + } |
|
1043 | 1365 | } |
1044 | 1366 | // Supplier code |
1045 | 1367 | if (! empty($arrayfields['s.code_fournisseur']['checked'])) |
1046 | 1368 | { |
1047 | 1369 | print '<td>'.$obj->code_fournisseur.'</td>'; |
1048 | - if (! $i) $totalarray['nbfield']++; |
|
1370 | + if (! $i) { |
|
1371 | + $totalarray['nbfield']++; |
|
1372 | + } |
|
1049 | 1373 | } |
1050 | 1374 | // Account customer code |
1051 | 1375 | if (! empty($arrayfields['s.code_compta']['checked'])) |
1052 | 1376 | { |
1053 | 1377 | print '<td>'.$obj->code_compta.'</td>'; |
1054 | - if (! $i) $totalarray['nbfield']++; |
|
1378 | + if (! $i) { |
|
1379 | + $totalarray['nbfield']++; |
|
1380 | + } |
|
1055 | 1381 | } |
1056 | 1382 | // Account supplier code |
1057 | 1383 | if (! empty($arrayfields['s.code_compta_fournisseur']['checked'])) |
1058 | 1384 | { |
1059 | 1385 | print '<td>'.$obj->code_compta_fournisseur.'</td>'; |
1060 | - if (! $i) $totalarray['nbfield']++; |
|
1386 | + if (! $i) { |
|
1387 | + $totalarray['nbfield']++; |
|
1388 | + } |
|
1061 | 1389 | } |
1062 | 1390 | // Town |
1063 | 1391 | if (! empty($arrayfields['s.town']['checked'])) |
1064 | 1392 | { |
1065 | 1393 | print "<td>".$obj->town."</td>\n"; |
1066 | - if (! $i) $totalarray['nbfield']++; |
|
1394 | + if (! $i) { |
|
1395 | + $totalarray['nbfield']++; |
|
1396 | + } |
|
1067 | 1397 | } |
1068 | 1398 | // Zip |
1069 | 1399 | if (! empty($arrayfields['s.zip']['checked'])) |
1070 | 1400 | { |
1071 | 1401 | print "<td>".$obj->zip."</td>\n"; |
1072 | - if (! $i) $totalarray['nbfield']++; |
|
1402 | + if (! $i) { |
|
1403 | + $totalarray['nbfield']++; |
|
1404 | + } |
|
1073 | 1405 | } |
1074 | 1406 | // State |
1075 | 1407 | if (! empty($arrayfields['state.nom']['checked'])) |
1076 | 1408 | { |
1077 | 1409 | print "<td>".$obj->state_name."</td>\n"; |
1078 | - if (! $i) $totalarray['nbfield']++; |
|
1410 | + if (! $i) { |
|
1411 | + $totalarray['nbfield']++; |
|
1412 | + } |
|
1079 | 1413 | } |
1080 | 1414 | // Region |
1081 | 1415 | if (! empty($arrayfields['region.nom']['checked'])) |
1082 | 1416 | { |
1083 | 1417 | print "<td>".$obj->region_name."</td>\n"; |
1084 | - if (! $i) $totalarray['nbfield']++; |
|
1418 | + if (! $i) { |
|
1419 | + $totalarray['nbfield']++; |
|
1420 | + } |
|
1085 | 1421 | } |
1086 | 1422 | // Country |
1087 | 1423 | if (! empty($arrayfields['country.code_iso']['checked'])) |
@@ -1090,66 +1426,92 @@ discard block |
||
1090 | 1426 | $tmparray=getCountry($obj->fk_pays,'all'); |
1091 | 1427 | print $tmparray['label']; |
1092 | 1428 | print '</td>'; |
1093 | - if (! $i) $totalarray['nbfield']++; |
|
1429 | + if (! $i) { |
|
1430 | + $totalarray['nbfield']++; |
|
1431 | + } |
|
1094 | 1432 | } |
1095 | 1433 | // Type ent |
1096 | 1434 | if (! empty($arrayfields['typent.code']['checked'])) |
1097 | 1435 | { |
1098 | 1436 | print '<td align="center">'; |
1099 | - if (! is_array($typenArray) || count($typenArray)==0) $typenArray = $formcompany->typent_array(1); |
|
1437 | + if (! is_array($typenArray) || count($typenArray)==0) { |
|
1438 | + $typenArray = $formcompany->typent_array(1); |
|
1439 | + } |
|
1100 | 1440 | print $typenArray[$obj->typent_code]; |
1101 | 1441 | print '</td>'; |
1102 | - if (! $i) $totalarray['nbfield']++; |
|
1442 | + if (! $i) { |
|
1443 | + $totalarray['nbfield']++; |
|
1444 | + } |
|
1103 | 1445 | } |
1104 | 1446 | if (! empty($arrayfields['s.email']['checked'])) |
1105 | 1447 | { |
1106 | 1448 | print "<td>".$obj->email."</td>\n"; |
1107 | - if (! $i) $totalarray['nbfield']++; |
|
1449 | + if (! $i) { |
|
1450 | + $totalarray['nbfield']++; |
|
1451 | + } |
|
1108 | 1452 | } |
1109 | 1453 | if (! empty($arrayfields['s.phone']['checked'])) |
1110 | 1454 | { |
1111 | 1455 | print "<td>".$obj->phone."</td>\n"; |
1112 | - if (! $i) $totalarray['nbfield']++; |
|
1456 | + if (! $i) { |
|
1457 | + $totalarray['nbfield']++; |
|
1458 | + } |
|
1113 | 1459 | } |
1114 | 1460 | if (! empty($arrayfields['s.url']['checked'])) |
1115 | 1461 | { |
1116 | 1462 | print "<td>".$obj->url."</td>\n"; |
1117 | - if (! $i) $totalarray['nbfield']++; |
|
1463 | + if (! $i) { |
|
1464 | + $totalarray['nbfield']++; |
|
1465 | + } |
|
1118 | 1466 | } |
1119 | 1467 | if (! empty($arrayfields['s.siren']['checked'])) |
1120 | 1468 | { |
1121 | 1469 | print "<td>".$obj->idprof1."</td>\n"; |
1122 | - if (! $i) $totalarray['nbfield']++; |
|
1470 | + if (! $i) { |
|
1471 | + $totalarray['nbfield']++; |
|
1472 | + } |
|
1123 | 1473 | } |
1124 | 1474 | if (! empty($arrayfields['s.siret']['checked'])) |
1125 | 1475 | { |
1126 | 1476 | print "<td>".$obj->idprof2."</td>\n"; |
1127 | - if (! $i) $totalarray['nbfield']++; |
|
1477 | + if (! $i) { |
|
1478 | + $totalarray['nbfield']++; |
|
1479 | + } |
|
1128 | 1480 | } |
1129 | 1481 | if (! empty($arrayfields['s.ape']['checked'])) |
1130 | 1482 | { |
1131 | 1483 | print "<td>".$obj->idprof3."</td>\n"; |
1132 | - if (! $i) $totalarray['nbfield']++; |
|
1484 | + if (! $i) { |
|
1485 | + $totalarray['nbfield']++; |
|
1486 | + } |
|
1133 | 1487 | } |
1134 | 1488 | if (! empty($arrayfields['s.idprof4']['checked'])) |
1135 | 1489 | { |
1136 | 1490 | print "<td>".$obj->idprof4."</td>\n"; |
1137 | - if (! $i) $totalarray['nbfield']++; |
|
1491 | + if (! $i) { |
|
1492 | + $totalarray['nbfield']++; |
|
1493 | + } |
|
1138 | 1494 | } |
1139 | 1495 | if (! empty($arrayfields['s.idprof5']['checked'])) |
1140 | 1496 | { |
1141 | 1497 | print "<td>".$obj->idprof5."</td>\n"; |
1142 | - if (! $i) $totalarray['nbfield']++; |
|
1498 | + if (! $i) { |
|
1499 | + $totalarray['nbfield']++; |
|
1500 | + } |
|
1143 | 1501 | } |
1144 | 1502 | if (! empty($arrayfields['s.idprof6']['checked'])) |
1145 | 1503 | { |
1146 | 1504 | print "<td>".$obj->idprof6."</td>\n"; |
1147 | - if (! $i) $totalarray['nbfield']++; |
|
1505 | + if (! $i) { |
|
1506 | + $totalarray['nbfield']++; |
|
1507 | + } |
|
1148 | 1508 | } |
1149 | 1509 | if (! empty($arrayfields['s.tva_intra']['checked'])) |
1150 | 1510 | { |
1151 | 1511 | print "<td>".$obj->tva_intra."</td>\n"; |
1152 | - if (! $i) $totalarray['nbfield']++; |
|
1512 | + if (! $i) { |
|
1513 | + $totalarray['nbfield']++; |
|
1514 | + } |
|
1153 | 1515 | } |
1154 | 1516 | // Type |
1155 | 1517 | if (! empty($arrayfields['customerorsupplier']['checked'])) |
@@ -1164,21 +1526,27 @@ discard block |
||
1164 | 1526 | } |
1165 | 1527 | if (($obj->client==2 || $obj->client==3) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) |
1166 | 1528 | { |
1167 | - if ($s) $s.=" / "; |
|
1529 | + if ($s) { |
|
1530 | + $s.=" / "; |
|
1531 | + } |
|
1168 | 1532 | $companystatic->name=$langs->trans("Prospect"); |
1169 | 1533 | $companystatic->name_alias=''; |
1170 | 1534 | $s.=$companystatic->getNomUrl(0,'prospect',0,1); |
1171 | 1535 | } |
1172 | 1536 | if (! empty($conf->fournisseur->enabled) && $obj->fournisseur) |
1173 | 1537 | { |
1174 | - if ($s) $s.=" / "; |
|
1538 | + if ($s) { |
|
1539 | + $s.=" / "; |
|
1540 | + } |
|
1175 | 1541 | $companystatic->name=$langs->trans("Supplier"); |
1176 | 1542 | $companystatic->name_alias=''; |
1177 | 1543 | $s.=$companystatic->getNomUrl(0,'supplier',0,1); |
1178 | 1544 | } |
1179 | 1545 | print $s; |
1180 | 1546 | print '</td>'; |
1181 | - if (! $i) $totalarray['nbfield']++; |
|
1547 | + if (! $i) { |
|
1548 | + $totalarray['nbfield']++; |
|
1549 | + } |
|
1182 | 1550 | } |
1183 | 1551 | |
1184 | 1552 | if (! empty($arrayfields['s.fk_prospectlevel']['checked'])) |
@@ -1187,7 +1555,9 @@ discard block |
||
1187 | 1555 | print '<td align="center">'; |
1188 | 1556 | print $companystatic->getLibProspLevel(); |
1189 | 1557 | print "</td>"; |
1190 | - if (! $i) $totalarray['nbfield']++; |
|
1558 | + if (! $i) { |
|
1559 | + $totalarray['nbfield']++; |
|
1560 | + } |
|
1191 | 1561 | } |
1192 | 1562 | |
1193 | 1563 | if (! empty($arrayfields['s.fk_stcomm']['checked'])) |
@@ -1199,11 +1569,17 @@ discard block |
||
1199 | 1569 | foreach($prospectstatic->cacheprospectstatus as $key => $val) |
1200 | 1570 | { |
1201 | 1571 | $titlealt='default'; |
1202 | - if (! empty($val['code']) && ! in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) $titlealt=$val['label']; |
|
1203 | - if ($obj->stcomm_id != $val['id']) print '<a class="pictosubstatus" href="'.$_SERVER["PHP_SELF"].'?stcommsocid='.$obj->rowid.'&stcomm='.$val['code'].'&action=setstcomm'.$param.($page?'&page='.urlencode($page):'').'">'.img_action($titlealt,$val['code']).'</a>'; |
|
1572 | + if (! empty($val['code']) && ! in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) { |
|
1573 | + $titlealt=$val['label']; |
|
1574 | + } |
|
1575 | + if ($obj->stcomm_id != $val['id']) { |
|
1576 | + print '<a class="pictosubstatus" href="'.$_SERVER["PHP_SELF"].'?stcommsocid='.$obj->rowid.'&stcomm='.$val['code'].'&action=setstcomm'.$param.($page?'&page='.urlencode($page):'').'">'.img_action($titlealt,$val['code']).'</a>'; |
|
1577 | + } |
|
1204 | 1578 | } |
1205 | 1579 | print '</div></div></td>'; |
1206 | - if (! $i) $totalarray['nbfield']++; |
|
1580 | + if (! $i) { |
|
1581 | + $totalarray['nbfield']++; |
|
1582 | + } |
|
1207 | 1583 | } |
1208 | 1584 | // Extra fields |
1209 | 1585 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; |
@@ -1217,7 +1593,9 @@ discard block |
||
1217 | 1593 | print '<td align="center" class="nowrap">'; |
1218 | 1594 | print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); |
1219 | 1595 | print '</td>'; |
1220 | - if (! $i) $totalarray['nbfield']++; |
|
1596 | + if (! $i) { |
|
1597 | + $totalarray['nbfield']++; |
|
1598 | + } |
|
1221 | 1599 | } |
1222 | 1600 | // Date modification |
1223 | 1601 | if (! empty($arrayfields['s.tms']['checked'])) |
@@ -1225,32 +1603,44 @@ discard block |
||
1225 | 1603 | print '<td align="center" class="nowrap">'; |
1226 | 1604 | print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); |
1227 | 1605 | print '</td>'; |
1228 | - if (! $i) $totalarray['nbfield']++; |
|
1606 | + if (! $i) { |
|
1607 | + $totalarray['nbfield']++; |
|
1608 | + } |
|
1229 | 1609 | } |
1230 | 1610 | // Status |
1231 | 1611 | if (! empty($arrayfields['s.status']['checked'])) |
1232 | 1612 | { |
1233 | 1613 | print '<td align="center" class="nowrap">'.$companystatic->getLibStatut(3).'</td>'; |
1234 | - if (! $i) $totalarray['nbfield']++; |
|
1614 | + if (! $i) { |
|
1615 | + $totalarray['nbfield']++; |
|
1616 | + } |
|
1235 | 1617 | } |
1236 | 1618 | if (! empty($arrayfields['s.import_key']['checked'])) |
1237 | 1619 | { |
1238 | 1620 | print '<td class="tdoverflowmax100">'; |
1239 | 1621 | print $obj->import_key; |
1240 | 1622 | print "</td>\n"; |
1241 | - if (! $i) $totalarray['nbfield']++; |
|
1623 | + if (! $i) { |
|
1624 | + $totalarray['nbfield']++; |
|
1625 | + } |
|
1242 | 1626 | } |
1243 | 1627 | |
1244 | 1628 | // Action column |
1245 | 1629 | print '<td class="nowrap" align="center">'; |
1246 | - if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined |
|
1630 | + if ($massactionbutton || $massaction) { |
|
1631 | + // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined |
|
1247 | 1632 | { |
1248 | 1633 | $selected=0; |
1249 | - if (in_array($obj->rowid, $arrayofselected)) $selected=1; |
|
1634 | + } |
|
1635 | + if (in_array($obj->rowid, $arrayofselected)) { |
|
1636 | + $selected=1; |
|
1637 | + } |
|
1250 | 1638 | print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>'; |
1251 | 1639 | } |
1252 | 1640 | print '</td>'; |
1253 | - if (! $i) $totalarray['nbfield']++; |
|
1641 | + if (! $i) { |
|
1642 | + $totalarray['nbfield']++; |
|
1643 | + } |
|
1254 | 1644 | |
1255 | 1645 | print '</tr>'."\n"; |
1256 | 1646 | $i++; |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | // Copyright (C) 2018 Alxarafe/Alixar <[email protected]> |
35 | 35 | defined('BASE_PATH') or die('Single entry point through the index.php of the main folder'); |
36 | 36 | require DOL_BASE_PATH . '/main.inc.php'; |
37 | - // Load $user and permissions |
|
37 | + // Load $user and permissions |
|
38 | 38 | include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; |
39 | 39 | require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; |
40 | 40 | require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; |
@@ -152,18 +152,18 @@ discard block |
||
152 | 152 | |
153 | 153 | // List of fields to search into when doing a "search in all" |
154 | 154 | $fieldstosearchall = array( |
155 | - 's.nom'=>"ThirdPartyName", |
|
156 | - 's.name_alias'=>"AliasNameShort", |
|
157 | - 's.code_client'=>"CustomerCode", |
|
158 | - 's.code_fournisseur'=>"SupplierCode", |
|
159 | - 's.code_compta'=>"CustomerAccountancyCodeShort", |
|
160 | - 's.code_compta_fournisseur'=>"SupplierAccountancyCodeShort", |
|
161 | - 's.email'=>"EMail", |
|
162 | - 's.url'=>"URL", |
|
163 | - 's.tva_intra'=>"VATIntra", |
|
164 | - 's.siren'=>"ProfId1", |
|
165 | - 's.siret'=>"ProfId2", |
|
166 | - 's.ape'=>"ProfId3", |
|
155 | + 's.nom'=>"ThirdPartyName", |
|
156 | + 's.name_alias'=>"AliasNameShort", |
|
157 | + 's.code_client'=>"CustomerCode", |
|
158 | + 's.code_fournisseur'=>"SupplierCode", |
|
159 | + 's.code_compta'=>"CustomerAccountancyCodeShort", |
|
160 | + 's.code_compta_fournisseur'=>"SupplierAccountancyCodeShort", |
|
161 | + 's.email'=>"EMail", |
|
162 | + 's.url'=>"URL", |
|
163 | + 's.tva_intra'=>"VATIntra", |
|
164 | + 's.siren'=>"ProfId1", |
|
165 | + 's.siret'=>"ProfId2", |
|
166 | + 's.ape'=>"ProfId3", |
|
167 | 167 | ); |
168 | 168 | if (($tmp = $langs->transnoentities("ProfId4".$mysoc->country_code)) && $tmp != "ProfId4".$mysoc->country_code && $tmp != '-') $fieldstosearchall['s.idprof4']='ProfId4'; |
169 | 169 | if (($tmp = $langs->transnoentities("ProfId5".$mysoc->country_code)) && $tmp != "ProfId5".$mysoc->country_code && $tmp != '-') $fieldstosearchall['s.idprof5']='ProfId5'; |
@@ -188,45 +188,45 @@ discard block |
||
188 | 188 | $checkprospectlevel=(in_array($contextpage, array('prospectlist')) ? 1 : 0); |
189 | 189 | $checkstcomm=(in_array($contextpage, array('prospectlist')) ? 1 : 0); |
190 | 190 | $arrayfields=array( |
191 | - 's.rowid'=>array('label'=>"TechnicalID", 'checked'=>($conf->global->MAIN_SHOW_TECHNICAL_ID?1:0), 'enabled'=>($conf->global->MAIN_SHOW_TECHNICAL_ID?1:0)), |
|
192 | - 's.nom'=>array('label'=>"ThirdPartyName", 'checked'=>1), |
|
193 | - 's.name_alias'=>array('label'=>"AliasNameShort", 'checked'=>1), |
|
194 | - 's.barcode'=>array('label'=>"Gencod", 'checked'=>1, 'enabled'=>(! empty($conf->barcode->enabled))), |
|
195 | - 's.code_client'=>array('label'=>"CustomerCodeShort", 'checked'=>$checkedcustomercode), |
|
196 | - 's.code_fournisseur'=>array('label'=>"SupplierCodeShort", 'checked'=>$checkedsuppliercode, 'enabled'=>(! empty($conf->fournisseur->enabled))), |
|
197 | - 's.code_compta'=>array('label'=>"CustomerAccountancyCodeShort", 'checked'=>$checkedcustomeraccountcode), |
|
198 | - 's.code_compta_fournisseur'=>array('label'=>"SupplierAccountancyCodeShort", 'checked'=>$checkedsupplieraccountcode, 'enabled'=>(! empty($conf->fournisseur->enabled))), |
|
199 | - 's.town'=>array('label'=>"Town", 'checked'=>1), |
|
200 | - 's.zip'=>array('label'=>"Zip", 'checked'=>1), |
|
201 | - 'state.nom'=>array('label'=>"State", 'checked'=>0), |
|
202 | - 'region.nom'=>array('label'=>"Region", 'checked'=>0), |
|
203 | - 'country.code_iso'=>array('label'=>"Country", 'checked'=>0), |
|
204 | - 's.email'=>array('label'=>"Email", 'checked'=>0), |
|
205 | - 's.url'=>array('label'=>"Url", 'checked'=>0), |
|
206 | - 's.phone'=>array('label'=>"Phone", 'checked'=>1), |
|
207 | - 'typent.code'=>array('label'=>"ThirdPartyType", 'checked'=>$checkedtypetiers), |
|
208 | - 's.siren'=>array('label'=>"ProfId1Short", 'checked'=>$checkedprofid1), |
|
209 | - 's.siret'=>array('label'=>"ProfId2Short", 'checked'=>$checkedprofid2), |
|
210 | - 's.ape'=>array('label'=>"ProfId3Short", 'checked'=>$checkedprofid3), |
|
211 | - 's.idprof4'=>array('label'=>"ProfId4Short", 'checked'=>$checkedprofid4), |
|
212 | - 's.idprof5'=>array('label'=>"ProfId5Short", 'checked'=>$checkedprofid5), |
|
213 | - 's.idprof6'=>array('label'=>"ProfId6Short", 'checked'=>$checkedprofid6), |
|
214 | - 's.tva_intra'=>array('label'=>"VATIntra", 'checked'=>0), |
|
215 | - 'customerorsupplier'=>array('label'=>'Nature', 'checked'=>1), |
|
216 | - 's.fk_prospectlevel'=>array('label'=>"ProspectLevelShort", 'checked'=>$checkprospectlevel), |
|
217 | - 's.fk_stcomm'=>array('label'=>"StatusProsp", 'checked'=>$checkstcomm), |
|
218 | - 's.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500), |
|
219 | - 's.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500), |
|
220 | - 's.status'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000), |
|
221 | - 's.import_key'=>array('label'=>"ImportId", 'checked'=>0, 'position'=>1100), |
|
191 | + 's.rowid'=>array('label'=>"TechnicalID", 'checked'=>($conf->global->MAIN_SHOW_TECHNICAL_ID?1:0), 'enabled'=>($conf->global->MAIN_SHOW_TECHNICAL_ID?1:0)), |
|
192 | + 's.nom'=>array('label'=>"ThirdPartyName", 'checked'=>1), |
|
193 | + 's.name_alias'=>array('label'=>"AliasNameShort", 'checked'=>1), |
|
194 | + 's.barcode'=>array('label'=>"Gencod", 'checked'=>1, 'enabled'=>(! empty($conf->barcode->enabled))), |
|
195 | + 's.code_client'=>array('label'=>"CustomerCodeShort", 'checked'=>$checkedcustomercode), |
|
196 | + 's.code_fournisseur'=>array('label'=>"SupplierCodeShort", 'checked'=>$checkedsuppliercode, 'enabled'=>(! empty($conf->fournisseur->enabled))), |
|
197 | + 's.code_compta'=>array('label'=>"CustomerAccountancyCodeShort", 'checked'=>$checkedcustomeraccountcode), |
|
198 | + 's.code_compta_fournisseur'=>array('label'=>"SupplierAccountancyCodeShort", 'checked'=>$checkedsupplieraccountcode, 'enabled'=>(! empty($conf->fournisseur->enabled))), |
|
199 | + 's.town'=>array('label'=>"Town", 'checked'=>1), |
|
200 | + 's.zip'=>array('label'=>"Zip", 'checked'=>1), |
|
201 | + 'state.nom'=>array('label'=>"State", 'checked'=>0), |
|
202 | + 'region.nom'=>array('label'=>"Region", 'checked'=>0), |
|
203 | + 'country.code_iso'=>array('label'=>"Country", 'checked'=>0), |
|
204 | + 's.email'=>array('label'=>"Email", 'checked'=>0), |
|
205 | + 's.url'=>array('label'=>"Url", 'checked'=>0), |
|
206 | + 's.phone'=>array('label'=>"Phone", 'checked'=>1), |
|
207 | + 'typent.code'=>array('label'=>"ThirdPartyType", 'checked'=>$checkedtypetiers), |
|
208 | + 's.siren'=>array('label'=>"ProfId1Short", 'checked'=>$checkedprofid1), |
|
209 | + 's.siret'=>array('label'=>"ProfId2Short", 'checked'=>$checkedprofid2), |
|
210 | + 's.ape'=>array('label'=>"ProfId3Short", 'checked'=>$checkedprofid3), |
|
211 | + 's.idprof4'=>array('label'=>"ProfId4Short", 'checked'=>$checkedprofid4), |
|
212 | + 's.idprof5'=>array('label'=>"ProfId5Short", 'checked'=>$checkedprofid5), |
|
213 | + 's.idprof6'=>array('label'=>"ProfId6Short", 'checked'=>$checkedprofid6), |
|
214 | + 's.tva_intra'=>array('label'=>"VATIntra", 'checked'=>0), |
|
215 | + 'customerorsupplier'=>array('label'=>'Nature', 'checked'=>1), |
|
216 | + 's.fk_prospectlevel'=>array('label'=>"ProspectLevelShort", 'checked'=>$checkprospectlevel), |
|
217 | + 's.fk_stcomm'=>array('label'=>"StatusProsp", 'checked'=>$checkstcomm), |
|
218 | + 's.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500), |
|
219 | + 's.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500), |
|
220 | + 's.status'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000), |
|
221 | + 's.import_key'=>array('label'=>"ImportId", 'checked'=>0, 'position'=>1100), |
|
222 | 222 | ); |
223 | 223 | // Extra fields |
224 | 224 | if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) |
225 | 225 | { |
226 | - foreach($extrafields->attribute_label as $key => $val) |
|
227 | - { |
|
228 | - if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key])); |
|
229 | - } |
|
226 | + foreach($extrafields->attribute_label as $key => $val) |
|
227 | + { |
|
228 | + if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key])); |
|
229 | + } |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | $object = new Societe($db); |
@@ -245,66 +245,66 @@ discard block |
||
245 | 245 | |
246 | 246 | if (empty($reshook)) |
247 | 247 | { |
248 | - // Selection of new fields |
|
249 | - include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; |
|
250 | - |
|
251 | - // Did we click on purge search criteria ? |
|
252 | - if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers |
|
253 | - { |
|
254 | - $search_id=''; |
|
255 | - $search_nom=''; |
|
256 | - $search_alias=''; |
|
257 | - $search_categ_cus=0; |
|
258 | - $search_categ_sup=0; |
|
259 | - $search_sale=''; |
|
260 | - $search_barcode=""; |
|
261 | - $search_customer_code=''; |
|
262 | - $search_supplier_code=''; |
|
263 | - $search_account_customer_code=''; |
|
264 | - $search_account_supplier_code=''; |
|
265 | - $search_town=""; |
|
266 | - $search_zip=""; |
|
267 | - $search_state=""; |
|
268 | - $search_country=''; |
|
269 | - $search_email=''; |
|
270 | - $search_phone=''; |
|
271 | - $search_url=''; |
|
272 | - $search_idprof1=''; |
|
273 | - $search_idprof2=''; |
|
274 | - $search_idprof3=''; |
|
275 | - $search_idprof4=''; |
|
276 | - $search_idprof5=''; |
|
277 | - $search_idprof6=''; |
|
278 | - $search_vat=''; |
|
279 | - $search_type=''; |
|
280 | - $search_type_thirdparty=''; |
|
281 | - $search_status=-1; |
|
282 | - $search_stcomm=''; |
|
283 | - $search_level_from=''; |
|
284 | - $search_level_to=''; |
|
285 | - $search_import_key=''; |
|
286 | - $toselect=''; |
|
287 | - $search_array_options=array(); |
|
288 | - } |
|
289 | - |
|
290 | - // Mass actions |
|
291 | - $objectclass='Societe'; |
|
292 | - $objectlabel='ThirdParty'; |
|
293 | - $permtoread = $user->rights->societe->lire; |
|
294 | - $permtodelete = $user->rights->societe->supprimer; |
|
295 | - $uploaddir = $conf->societe->dir_output; |
|
296 | - include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; |
|
297 | - |
|
298 | - if ($action == 'setstcomm') |
|
299 | - { |
|
300 | - $object = new Client($db); |
|
301 | - $result=$object->fetch(GETPOST('stcommsocid')); |
|
302 | - $object->stcomm_id=dol_getIdFromCode($db, GETPOST('stcomm','alpha'), 'c_stcomm'); |
|
303 | - $result=$object->update($object->id, $user); |
|
304 | - if ($result < 0) setEventMessages($object->error,$object->errors,'errors'); |
|
305 | - |
|
306 | - $action=''; |
|
307 | - } |
|
248 | + // Selection of new fields |
|
249 | + include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; |
|
250 | + |
|
251 | + // Did we click on purge search criteria ? |
|
252 | + if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers |
|
253 | + { |
|
254 | + $search_id=''; |
|
255 | + $search_nom=''; |
|
256 | + $search_alias=''; |
|
257 | + $search_categ_cus=0; |
|
258 | + $search_categ_sup=0; |
|
259 | + $search_sale=''; |
|
260 | + $search_barcode=""; |
|
261 | + $search_customer_code=''; |
|
262 | + $search_supplier_code=''; |
|
263 | + $search_account_customer_code=''; |
|
264 | + $search_account_supplier_code=''; |
|
265 | + $search_town=""; |
|
266 | + $search_zip=""; |
|
267 | + $search_state=""; |
|
268 | + $search_country=''; |
|
269 | + $search_email=''; |
|
270 | + $search_phone=''; |
|
271 | + $search_url=''; |
|
272 | + $search_idprof1=''; |
|
273 | + $search_idprof2=''; |
|
274 | + $search_idprof3=''; |
|
275 | + $search_idprof4=''; |
|
276 | + $search_idprof5=''; |
|
277 | + $search_idprof6=''; |
|
278 | + $search_vat=''; |
|
279 | + $search_type=''; |
|
280 | + $search_type_thirdparty=''; |
|
281 | + $search_status=-1; |
|
282 | + $search_stcomm=''; |
|
283 | + $search_level_from=''; |
|
284 | + $search_level_to=''; |
|
285 | + $search_import_key=''; |
|
286 | + $toselect=''; |
|
287 | + $search_array_options=array(); |
|
288 | + } |
|
289 | + |
|
290 | + // Mass actions |
|
291 | + $objectclass='Societe'; |
|
292 | + $objectlabel='ThirdParty'; |
|
293 | + $permtoread = $user->rights->societe->lire; |
|
294 | + $permtodelete = $user->rights->societe->supprimer; |
|
295 | + $uploaddir = $conf->societe->dir_output; |
|
296 | + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; |
|
297 | + |
|
298 | + if ($action == 'setstcomm') |
|
299 | + { |
|
300 | + $object = new Client($db); |
|
301 | + $result=$object->fetch(GETPOST('stcommsocid')); |
|
302 | + $object->stcomm_id=dol_getIdFromCode($db, GETPOST('stcomm','alpha'), 'c_stcomm'); |
|
303 | + $result=$object->update($object->id, $user); |
|
304 | + if ($result < 0) setEventMessages($object->error,$object->errors,'errors'); |
|
305 | + |
|
306 | + $action=''; |
|
307 | + } |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | if ($search_status=='') $search_status=1; // always display active thirdparty first |
@@ -341,43 +341,43 @@ discard block |
||
341 | 341 | // If both parameters are set, search for everything BETWEEN them |
342 | 342 | if ($search_level_from != '' && $search_level_to != '') |
343 | 343 | { |
344 | - // Ensure that these parameters are numbers |
|
345 | - $search_level_from = (int) $search_level_from; |
|
346 | - $search_level_to = (int) $search_level_to; |
|
347 | - |
|
348 | - // If from is greater than to, reverse orders |
|
349 | - if ($search_level_from > $search_level_to) |
|
350 | - { |
|
351 | - $tmp = $search_level_to; |
|
352 | - $search_level_to = $search_level_from; |
|
353 | - $search_level_from = $tmp; |
|
354 | - } |
|
355 | - |
|
356 | - // Generate the SQL request |
|
357 | - $sortwhere = '(sortorder BETWEEN '.$search_level_from.' AND '.$search_level_to.') AS is_in_range'; |
|
344 | + // Ensure that these parameters are numbers |
|
345 | + $search_level_from = (int) $search_level_from; |
|
346 | + $search_level_to = (int) $search_level_to; |
|
347 | + |
|
348 | + // If from is greater than to, reverse orders |
|
349 | + if ($search_level_from > $search_level_to) |
|
350 | + { |
|
351 | + $tmp = $search_level_to; |
|
352 | + $search_level_to = $search_level_from; |
|
353 | + $search_level_from = $tmp; |
|
354 | + } |
|
355 | + |
|
356 | + // Generate the SQL request |
|
357 | + $sortwhere = '(sortorder BETWEEN '.$search_level_from.' AND '.$search_level_to.') AS is_in_range'; |
|
358 | 358 | } |
359 | 359 | // If only "from" parameter is set, search for everything GREATER THAN it |
360 | 360 | else if ($search_level_from != '') |
361 | 361 | { |
362 | - // Ensure that this parameter is a number |
|
363 | - $search_level_from = (int) $search_level_from; |
|
362 | + // Ensure that this parameter is a number |
|
363 | + $search_level_from = (int) $search_level_from; |
|
364 | 364 | |
365 | - // Generate the SQL request |
|
366 | - $sortwhere = '(sortorder >= '.$search_level_from.') AS is_in_range'; |
|
365 | + // Generate the SQL request |
|
366 | + $sortwhere = '(sortorder >= '.$search_level_from.') AS is_in_range'; |
|
367 | 367 | } |
368 | 368 | // If only "to" parameter is set, search for everything LOWER THAN it |
369 | 369 | else if ($search_level_to != '') |
370 | 370 | { |
371 | - // Ensure that this parameter is a number |
|
372 | - $search_level_to = (int) $search_level_to; |
|
371 | + // Ensure that this parameter is a number |
|
372 | + $search_level_to = (int) $search_level_to; |
|
373 | 373 | |
374 | - // Generate the SQL request |
|
375 | - $sortwhere = '(sortorder <= '.$search_level_to.') AS is_in_range'; |
|
374 | + // Generate the SQL request |
|
375 | + $sortwhere = '(sortorder <= '.$search_level_to.') AS is_in_range'; |
|
376 | 376 | } |
377 | 377 | // If no parameters are set, dont search for anything |
378 | 378 | else |
379 | 379 | { |
380 | - $sortwhere = '0 as is_in_range'; |
|
380 | + $sortwhere = '0 as is_in_range'; |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | // Select every potentiels, and note each potentiels which fit in search parameters |
@@ -390,28 +390,28 @@ discard block |
||
390 | 390 | $resql = $db->query($sql); |
391 | 391 | if ($resql) |
392 | 392 | { |
393 | - $tab_level = array(); |
|
394 | - $search_levels = array(); |
|
395 | - |
|
396 | - while ($obj = $db->fetch_object($resql)) |
|
397 | - { |
|
398 | - // Compute level text |
|
399 | - $level=$langs->trans($obj->code); |
|
400 | - if ($level == $obj->code) $level=$langs->trans($obj->label); |
|
401 | - |
|
402 | - // Put it in the array sorted by sortorder |
|
403 | - $tab_level[$obj->sortorder] = $level; |
|
404 | - |
|
405 | - // If this potentiel fit in parameters, add its code to the $search_levels array |
|
406 | - if ($obj->is_in_range == 1) |
|
407 | - { |
|
408 | - $search_levels[] = '"'.preg_replace('[^A-Za-z0-9_-]', '', $obj->code).'"'; |
|
409 | - } |
|
410 | - } |
|
411 | - |
|
412 | - // Implode the $search_levels array so that it can be use in a "IN (...)" where clause. |
|
413 | - // If no paramters was set, $search_levels will be empty |
|
414 | - $search_levels = implode(',', $search_levels); |
|
393 | + $tab_level = array(); |
|
394 | + $search_levels = array(); |
|
395 | + |
|
396 | + while ($obj = $db->fetch_object($resql)) |
|
397 | + { |
|
398 | + // Compute level text |
|
399 | + $level=$langs->trans($obj->code); |
|
400 | + if ($level == $obj->code) $level=$langs->trans($obj->label); |
|
401 | + |
|
402 | + // Put it in the array sorted by sortorder |
|
403 | + $tab_level[$obj->sortorder] = $level; |
|
404 | + |
|
405 | + // If this potentiel fit in parameters, add its code to the $search_levels array |
|
406 | + if ($obj->is_in_range == 1) |
|
407 | + { |
|
408 | + $search_levels[] = '"'.preg_replace('[^A-Za-z0-9_-]', '', $obj->code).'"'; |
|
409 | + } |
|
410 | + } |
|
411 | + |
|
412 | + // Implode the $search_levels array so that it can be use in a "IN (...)" where clause. |
|
413 | + // If no paramters was set, $search_levels will be empty |
|
414 | + $search_levels = implode(',', $search_levels); |
|
415 | 415 | } |
416 | 416 | else dol_print_error($db); |
417 | 417 | |
@@ -508,8 +508,8 @@ discard block |
||
508 | 508 | $nbtotalofrecords = ''; |
509 | 509 | if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) |
510 | 510 | { |
511 | - $result = $db->query($sql); |
|
512 | - $nbtotalofrecords = $db->num_rows($result); |
|
511 | + $result = $db->query($sql); |
|
512 | + $nbtotalofrecords = $db->num_rows($result); |
|
513 | 513 | } |
514 | 514 | |
515 | 515 | $sql.= $db->plimit($limit+1, $offset); |
@@ -517,8 +517,8 @@ discard block |
||
517 | 517 | $resql = $db->query($sql); |
518 | 518 | if (! $resql) |
519 | 519 | { |
520 | - dol_print_error($db); |
|
521 | - exit; |
|
520 | + dol_print_error($db); |
|
521 | + exit; |
|
522 | 522 | } |
523 | 523 | |
524 | 524 | $num = $db->num_rows($resql); |
@@ -527,10 +527,10 @@ discard block |
||
527 | 527 | |
528 | 528 | if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && ($search_all != '' || $search_cti != '') && $action != 'list') |
529 | 529 | { |
530 | - $obj = $db->fetch_object($resql); |
|
531 | - $id = $obj->rowid; |
|
532 | - header("Location: ".DOL_URL_ROOT.'/societe/card.php?socid='.$id); |
|
533 | - exit; |
|
530 | + $obj = $db->fetch_object($resql); |
|
531 | + $id = $obj->rowid; |
|
532 | + header("Location: ".DOL_URL_ROOT.'/societe/card.php?socid='.$id); |
|
533 | + exit; |
|
534 | 534 | } |
535 | 535 | |
536 | 536 | $help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; |
@@ -581,12 +581,12 @@ discard block |
||
581 | 581 | // Show delete result message |
582 | 582 | if (GETPOST('delsoc')) |
583 | 583 | { |
584 | - setEventMessages($langs->trans("CompanyDeleted",GETPOST('delsoc')), null, 'mesgs'); |
|
584 | + setEventMessages($langs->trans("CompanyDeleted",GETPOST('delsoc')), null, 'mesgs'); |
|
585 | 585 | } |
586 | 586 | |
587 | 587 | // List of mass actions available |
588 | 588 | $arrayofmassactions = array( |
589 | - 'presend'=>$langs->trans("SendByMail"), |
|
589 | + 'presend'=>$langs->trans("SendByMail"), |
|
590 | 590 | // 'builddoc'=>$langs->trans("PDFMerge"), |
591 | 591 | ); |
592 | 592 | //if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer"); |
@@ -608,13 +608,13 @@ discard block |
||
608 | 608 | $textprofid=array(); |
609 | 609 | foreach(array(1,2,3,4,5,6) as $key) |
610 | 610 | { |
611 | - $label=$langs->transnoentities("ProfId".$key.$mysoc->country_code); |
|
612 | - $textprofid[$key]=''; |
|
613 | - if ($label != "ProfId".$key.$mysoc->country_code) |
|
614 | - { // Get only text between () |
|
615 | - if (preg_match('/\((.*)\)/i',$label,$reg)) $label=$reg[1]; |
|
616 | - $textprofid[$key]=$langs->trans("ProfIdShortDesc",$key,$mysoc->country_code,$label); |
|
617 | - } |
|
611 | + $label=$langs->transnoentities("ProfId".$key.$mysoc->country_code); |
|
612 | + $textprofid[$key]=''; |
|
613 | + if ($label != "ProfId".$key.$mysoc->country_code) |
|
614 | + { // Get only text between () |
|
615 | + if (preg_match('/\((.*)\)/i',$label,$reg)) $label=$reg[1]; |
|
616 | + $textprofid[$key]=$langs->trans("ProfIdShortDesc",$key,$mysoc->country_code,$label); |
|
617 | + } |
|
618 | 618 | } |
619 | 619 | |
620 | 620 | $topicmail="Information"; |
@@ -625,51 +625,51 @@ discard block |
||
625 | 625 | |
626 | 626 | if ($search_all) |
627 | 627 | { |
628 | - foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); |
|
629 | - print $langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall); |
|
628 | + foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); |
|
629 | + print $langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall); |
|
630 | 630 | } |
631 | 631 | |
632 | 632 | // Filter on categories |
633 | 633 | $moreforfilter=''; |
634 | 634 | if (empty($type) || $type == 'c' || $type == 'p') |
635 | 635 | { |
636 | - if (! empty($conf->categorie->enabled)) |
|
637 | - { |
|
638 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
639 | - $moreforfilter.='<div class="divsearchfield">'; |
|
640 | - $moreforfilter.=$langs->trans('CustomersProspectsCategoriesShort').': '; |
|
641 | - $moreforfilter.=$formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1, $langs->trans('CustomersProspectsCategoriesShort')); |
|
642 | - $moreforfilter.='</div>'; |
|
643 | - } |
|
636 | + if (! empty($conf->categorie->enabled)) |
|
637 | + { |
|
638 | + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
639 | + $moreforfilter.='<div class="divsearchfield">'; |
|
640 | + $moreforfilter.=$langs->trans('CustomersProspectsCategoriesShort').': '; |
|
641 | + $moreforfilter.=$formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1, $langs->trans('CustomersProspectsCategoriesShort')); |
|
642 | + $moreforfilter.='</div>'; |
|
643 | + } |
|
644 | 644 | } |
645 | 645 | if (empty($type) || $type == 'f') |
646 | 646 | { |
647 | - if (! empty($conf->categorie->enabled)) |
|
648 | - { |
|
649 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
650 | - $moreforfilter.='<div class="divsearchfield">'; |
|
651 | - $moreforfilter.=$langs->trans('SuppliersCategoriesShort').': '; |
|
652 | - $moreforfilter.=$formother->select_categories('supplier',$search_categ_sup,'search_categ_sup',1); |
|
653 | - $moreforfilter.='</div>'; |
|
654 | - } |
|
647 | + if (! empty($conf->categorie->enabled)) |
|
648 | + { |
|
649 | + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
650 | + $moreforfilter.='<div class="divsearchfield">'; |
|
651 | + $moreforfilter.=$langs->trans('SuppliersCategoriesShort').': '; |
|
652 | + $moreforfilter.=$formother->select_categories('supplier',$search_categ_sup,'search_categ_sup',1); |
|
653 | + $moreforfilter.='</div>'; |
|
654 | + } |
|
655 | 655 | } |
656 | 656 | |
657 | 657 | // If the user can view prospects other than his' |
658 | 658 | if ($user->rights->societe->client->voir || $socid) |
659 | 659 | { |
660 | - $moreforfilter.='<div class="divsearchfield">'; |
|
661 | - $moreforfilter.=$langs->trans('SalesRepresentatives'). ': '; |
|
662 | - $moreforfilter.=$formother->select_salesrepresentatives($search_sale,'search_sale',$user, 0, 1, 'maxwidth300'); |
|
663 | - $moreforfilter.='</div>'; |
|
660 | + $moreforfilter.='<div class="divsearchfield">'; |
|
661 | + $moreforfilter.=$langs->trans('SalesRepresentatives'). ': '; |
|
662 | + $moreforfilter.=$formother->select_salesrepresentatives($search_sale,'search_sale',$user, 0, 1, 'maxwidth300'); |
|
663 | + $moreforfilter.='</div>'; |
|
664 | 664 | } |
665 | 665 | if ($moreforfilter) |
666 | 666 | { |
667 | - print '<div class="liste_titre liste_titre_bydiv centpercent">'; |
|
668 | - print $moreforfilter; |
|
669 | - $parameters=array('type'=>$type); |
|
670 | - $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook |
|
671 | - print $hookmanager->resPrint; |
|
672 | - print '</div>'; |
|
667 | + print '<div class="liste_titre liste_titre_bydiv centpercent">'; |
|
668 | + print $moreforfilter; |
|
669 | + $parameters=array('type'=>$type); |
|
670 | + $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook |
|
671 | + print $hookmanager->resPrint; |
|
672 | + print '</div>'; |
|
673 | 673 | } |
674 | 674 | |
675 | 675 | $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; |
@@ -685,224 +685,224 @@ discard block |
||
685 | 685 | print '<tr class="liste_titre_filter">'; |
686 | 686 | if (! empty($arrayfields['s.rowid']['checked'])) |
687 | 687 | { |
688 | - print '<td class="liste_titre">'; |
|
689 | - print '<input class="flat searchstring" type="text" name="search_id" size="1" value="'.dol_escape_htmltag($search_id).'">'; |
|
690 | - print '</td>'; |
|
688 | + print '<td class="liste_titre">'; |
|
689 | + print '<input class="flat searchstring" type="text" name="search_id" size="1" value="'.dol_escape_htmltag($search_id).'">'; |
|
690 | + print '</td>'; |
|
691 | 691 | } |
692 | 692 | if (! empty($arrayfields['s.nom']['checked'])) |
693 | 693 | { |
694 | - print '<td class="liste_titre">'; |
|
695 | - if (! empty($search_nom_only) && empty($search_nom)) $search_nom=$search_nom_only; |
|
696 | - print '<input class="flat searchstring" type="text" name="search_nom" size="8" value="'.dol_escape_htmltag($search_nom).'">'; |
|
697 | - print '</td>'; |
|
694 | + print '<td class="liste_titre">'; |
|
695 | + if (! empty($search_nom_only) && empty($search_nom)) $search_nom=$search_nom_only; |
|
696 | + print '<input class="flat searchstring" type="text" name="search_nom" size="8" value="'.dol_escape_htmltag($search_nom).'">'; |
|
697 | + print '</td>'; |
|
698 | 698 | } |
699 | 699 | if (! empty($arrayfields['s.name_alias']['checked'])) |
700 | 700 | { |
701 | - print '<td class="liste_titre">'; |
|
702 | - print '<input class="flat searchstring" type="text" name="search_alias" size="8" value="'.dol_escape_htmltag($search_alias).'">'; |
|
703 | - print '</td>'; |
|
701 | + print '<td class="liste_titre">'; |
|
702 | + print '<input class="flat searchstring" type="text" name="search_alias" size="8" value="'.dol_escape_htmltag($search_alias).'">'; |
|
703 | + print '</td>'; |
|
704 | 704 | } |
705 | 705 | // Barcode |
706 | 706 | if (! empty($arrayfields['s.barcode']['checked'])) |
707 | 707 | { |
708 | - print '<td class="liste_titre">'; |
|
709 | - print '<input class="flat searchstring" type="text" name="search_barcode" size="6" value="'.dol_escape_htmltag($search_barcode).'">'; |
|
710 | - print '</td>'; |
|
708 | + print '<td class="liste_titre">'; |
|
709 | + print '<input class="flat searchstring" type="text" name="search_barcode" size="6" value="'.dol_escape_htmltag($search_barcode).'">'; |
|
710 | + print '</td>'; |
|
711 | 711 | } |
712 | 712 | // Customer code |
713 | 713 | if (! empty($arrayfields['s.code_client']['checked'])) |
714 | 714 | { |
715 | - print '<td class="liste_titre">'; |
|
716 | - print '<input class="flat searchstring" size="8" type="text" name="search_customer_code" value="'.dol_escape_htmltag($search_customer_code).'">'; |
|
717 | - print '</td>'; |
|
715 | + print '<td class="liste_titre">'; |
|
716 | + print '<input class="flat searchstring" size="8" type="text" name="search_customer_code" value="'.dol_escape_htmltag($search_customer_code).'">'; |
|
717 | + print '</td>'; |
|
718 | 718 | } |
719 | 719 | // Supplier code |
720 | 720 | if (! empty($arrayfields['s.code_fournisseur']['checked'])) |
721 | 721 | { |
722 | - print '<td class="liste_titre">'; |
|
723 | - print '<input class="flat searchstring" size="8" type="text" name="search_supplier_code" value="'.dol_escape_htmltag($search_supplier_code).'">'; |
|
724 | - print '</td>'; |
|
722 | + print '<td class="liste_titre">'; |
|
723 | + print '<input class="flat searchstring" size="8" type="text" name="search_supplier_code" value="'.dol_escape_htmltag($search_supplier_code).'">'; |
|
724 | + print '</td>'; |
|
725 | 725 | } |
726 | 726 | // Account Customer code |
727 | 727 | if (! empty($arrayfields['s.code_compta']['checked'])) |
728 | 728 | { |
729 | - print '<td class="liste_titre">'; |
|
730 | - print '<input class="flat searchstring" size="8" type="text" name="search_account_customer_code" value="'.dol_escape_htmltag($search_account_customer_code).'">'; |
|
731 | - print '</td>'; |
|
729 | + print '<td class="liste_titre">'; |
|
730 | + print '<input class="flat searchstring" size="8" type="text" name="search_account_customer_code" value="'.dol_escape_htmltag($search_account_customer_code).'">'; |
|
731 | + print '</td>'; |
|
732 | 732 | } |
733 | 733 | // Account Supplier code |
734 | 734 | if (! empty($arrayfields['s.code_compta_fournisseur']['checked'])) |
735 | 735 | { |
736 | - print '<td class="liste_titre">'; |
|
737 | - print '<input class="flat" size="8" type="text" name="search_account_supplier_code" value="'.dol_escape_htmltag($search_account_supplier_code).'">'; |
|
738 | - print '</td>'; |
|
736 | + print '<td class="liste_titre">'; |
|
737 | + print '<input class="flat" size="8" type="text" name="search_account_supplier_code" value="'.dol_escape_htmltag($search_account_supplier_code).'">'; |
|
738 | + print '</td>'; |
|
739 | 739 | } |
740 | 740 | // Town |
741 | 741 | if (! empty($arrayfields['s.town']['checked'])) |
742 | 742 | { |
743 | - print '<td class="liste_titre">'; |
|
744 | - print '<input class="flat searchstring" size="6" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).'">'; |
|
745 | - print '</td>'; |
|
743 | + print '<td class="liste_titre">'; |
|
744 | + print '<input class="flat searchstring" size="6" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).'">'; |
|
745 | + print '</td>'; |
|
746 | 746 | } |
747 | 747 | // Zip |
748 | 748 | if (! empty($arrayfields['s.zip']['checked'])) |
749 | 749 | { |
750 | - print '<td class="liste_titre">'; |
|
751 | - print '<input class="flat searchstring" size="4" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).'">'; |
|
752 | - print '</td>'; |
|
750 | + print '<td class="liste_titre">'; |
|
751 | + print '<input class="flat searchstring" size="4" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).'">'; |
|
752 | + print '</td>'; |
|
753 | 753 | } |
754 | 754 | // State |
755 | 755 | if (! empty($arrayfields['state.nom']['checked'])) |
756 | 756 | { |
757 | - print '<td class="liste_titre">'; |
|
758 | - print '<input class="flat searchstring" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">'; |
|
759 | - print '</td>'; |
|
757 | + print '<td class="liste_titre">'; |
|
758 | + print '<input class="flat searchstring" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">'; |
|
759 | + print '</td>'; |
|
760 | 760 | } |
761 | 761 | // Region |
762 | 762 | if (! empty($arrayfields['region.nom']['checked'])) |
763 | 763 | { |
764 | - print '<td class="liste_titre">'; |
|
765 | - print '<input class="flat searchstring" size="4" type="text" name="search_region" value="'.dol_escape_htmltag($search_region).'">'; |
|
766 | - print '</td>'; |
|
764 | + print '<td class="liste_titre">'; |
|
765 | + print '<input class="flat searchstring" size="4" type="text" name="search_region" value="'.dol_escape_htmltag($search_region).'">'; |
|
766 | + print '</td>'; |
|
767 | 767 | } |
768 | 768 | // Country |
769 | 769 | if (! empty($arrayfields['country.code_iso']['checked'])) |
770 | 770 | { |
771 | - print '<td class="liste_titre" align="center">'; |
|
772 | - print $form->select_country($search_country,'search_country','',0,'maxwidth100'); |
|
773 | - print '</td>'; |
|
771 | + print '<td class="liste_titre" align="center">'; |
|
772 | + print $form->select_country($search_country,'search_country','',0,'maxwidth100'); |
|
773 | + print '</td>'; |
|
774 | 774 | } |
775 | 775 | // Company type |
776 | 776 | if (! empty($arrayfields['typent.code']['checked'])) |
777 | 777 | { |
778 | - print '<td class="liste_titre maxwidthonsmartphone" align="center">'; |
|
779 | - print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT)); |
|
780 | - print '</td>'; |
|
778 | + print '<td class="liste_titre maxwidthonsmartphone" align="center">'; |
|
779 | + print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT)); |
|
780 | + print '</td>'; |
|
781 | 781 | } |
782 | 782 | if (! empty($arrayfields['s.email']['checked'])) |
783 | 783 | { |
784 | ||
785 | - print '<td class="liste_titre">'; |
|
786 | - print '<input class="flat searchemail" size="4" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).'">'; |
|
787 | - print '</td>'; |
|
784 | ||
785 | + print '<td class="liste_titre">'; |
|
786 | + print '<input class="flat searchemail" size="4" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).'">'; |
|
787 | + print '</td>'; |
|
788 | 788 | } |
789 | 789 | if (! empty($arrayfields['s.phone']['checked'])) |
790 | 790 | { |
791 | - // Phone |
|
792 | - print '<td class="liste_titre">'; |
|
793 | - print '<input class="flat searchstring" size="4" type="text" name="search_phone" value="'.dol_escape_htmltag($search_phone).'">'; |
|
794 | - print '</td>'; |
|
791 | + // Phone |
|
792 | + print '<td class="liste_titre">'; |
|
793 | + print '<input class="flat searchstring" size="4" type="text" name="search_phone" value="'.dol_escape_htmltag($search_phone).'">'; |
|
794 | + print '</td>'; |
|
795 | 795 | } |
796 | 796 | if (! empty($arrayfields['s.url']['checked'])) |
797 | 797 | { |
798 | - // Url |
|
799 | - print '<td class="liste_titre">'; |
|
800 | - print '<input class="flat searchstring" size="4" type="text" name="search_url" value="'.dol_escape_htmltag($search_url).'">'; |
|
801 | - print '</td>'; |
|
798 | + // Url |
|
799 | + print '<td class="liste_titre">'; |
|
800 | + print '<input class="flat searchstring" size="4" type="text" name="search_url" value="'.dol_escape_htmltag($search_url).'">'; |
|
801 | + print '</td>'; |
|
802 | 802 | } |
803 | 803 | if (! empty($arrayfields['s.siren']['checked'])) |
804 | 804 | { |
805 | - // IdProf1 |
|
806 | - print '<td class="liste_titre">'; |
|
807 | - print '<input class="flat searchstring" size="4" type="text" name="search_idprof1" value="'.dol_escape_htmltag($search_idprof1).'">'; |
|
808 | - print '</td>'; |
|
805 | + // IdProf1 |
|
806 | + print '<td class="liste_titre">'; |
|
807 | + print '<input class="flat searchstring" size="4" type="text" name="search_idprof1" value="'.dol_escape_htmltag($search_idprof1).'">'; |
|
808 | + print '</td>'; |
|
809 | 809 | } |
810 | 810 | if (! empty($arrayfields['s.siret']['checked'])) |
811 | 811 | { |
812 | - // IdProf2 |
|
813 | - print '<td class="liste_titre">'; |
|
814 | - print '<input class="flat searchstring" size="4" type="text" name="search_idprof2" value="'.dol_escape_htmltag($search_idprof2).'">'; |
|
815 | - print '</td>'; |
|
812 | + // IdProf2 |
|
813 | + print '<td class="liste_titre">'; |
|
814 | + print '<input class="flat searchstring" size="4" type="text" name="search_idprof2" value="'.dol_escape_htmltag($search_idprof2).'">'; |
|
815 | + print '</td>'; |
|
816 | 816 | } |
817 | 817 | if (! empty($arrayfields['s.ape']['checked'])) |
818 | 818 | { |
819 | - // IdProf3 |
|
820 | - print '<td class="liste_titre">'; |
|
821 | - print '<input class="flat searchstring" size="4" type="text" name="search_idprof3" value="'.dol_escape_htmltag($search_idprof3).'">'; |
|
822 | - print '</td>'; |
|
819 | + // IdProf3 |
|
820 | + print '<td class="liste_titre">'; |
|
821 | + print '<input class="flat searchstring" size="4" type="text" name="search_idprof3" value="'.dol_escape_htmltag($search_idprof3).'">'; |
|
822 | + print '</td>'; |
|
823 | 823 | } |
824 | 824 | if (! empty($arrayfields['s.idprof4']['checked'])) |
825 | 825 | { |
826 | - // IdProf4 |
|
827 | - print '<td class="liste_titre">'; |
|
828 | - print '<input class="flat searchstring" size="4" type="text" name="search_idprof4" value="'.dol_escape_htmltag($search_idprof4).'">'; |
|
829 | - print '</td>'; |
|
826 | + // IdProf4 |
|
827 | + print '<td class="liste_titre">'; |
|
828 | + print '<input class="flat searchstring" size="4" type="text" name="search_idprof4" value="'.dol_escape_htmltag($search_idprof4).'">'; |
|
829 | + print '</td>'; |
|
830 | 830 | } |
831 | 831 | if (! empty($arrayfields['s.idprof5']['checked'])) |
832 | 832 | { |
833 | - // IdProf5 |
|
834 | - print '<td class="liste_titre">'; |
|
835 | - print '<input class="flat searchstring" size="4" type="text" name="search_idprof5" value="'.dol_escape_htmltag($search_idprof5).'">'; |
|
836 | - print '</td>'; |
|
833 | + // IdProf5 |
|
834 | + print '<td class="liste_titre">'; |
|
835 | + print '<input class="flat searchstring" size="4" type="text" name="search_idprof5" value="'.dol_escape_htmltag($search_idprof5).'">'; |
|
836 | + print '</td>'; |
|
837 | 837 | } |
838 | 838 | if (! empty($arrayfields['s.idprof6']['checked'])) |
839 | 839 | { |
840 | - // IdProf6 |
|
841 | - print '<td class="liste_titre">'; |
|
842 | - print '<input class="flat searchstring" size="4" type="text" name="search_idprof6" value="'.dol_escape_htmltag($search_idprof6).'">'; |
|
843 | - print '</td>'; |
|
840 | + // IdProf6 |
|
841 | + print '<td class="liste_titre">'; |
|
842 | + print '<input class="flat searchstring" size="4" type="text" name="search_idprof6" value="'.dol_escape_htmltag($search_idprof6).'">'; |
|
843 | + print '</td>'; |
|
844 | 844 | } |
845 | 845 | if (! empty($arrayfields['s.tva_intra']['checked'])) |
846 | 846 | { |
847 | - // Vat number |
|
848 | - print '<td class="liste_titre">'; |
|
849 | - print '<input class="flat searchstring" size="4" type="text" name="search_vat" value="'.dol_escape_htmltag($search_vat).'">'; |
|
850 | - print '</td>'; |
|
847 | + // Vat number |
|
848 | + print '<td class="liste_titre">'; |
|
849 | + print '<input class="flat searchstring" size="4" type="text" name="search_vat" value="'.dol_escape_htmltag($search_vat).'">'; |
|
850 | + print '</td>'; |
|
851 | 851 | } |
852 | 852 | |
853 | 853 | // Type (customer/prospect/supplier) |
854 | 854 | if (! empty($arrayfields['customerorsupplier']['checked'])) |
855 | 855 | { |
856 | - print '<td class="liste_titre maxwidthonsmartphone" align="middle">'; |
|
857 | - if ($type != '') print '<input type="hidden" name="type" value="'.$type.'">'; |
|
858 | - print '<select class="flat" name="search_type">'; |
|
859 | - print '<option value="-1"'.($search_type==''?' selected':'').'> </option>'; |
|
860 | - if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) print '<option value="1,3"'.($search_type=='1,3'?' selected':'').'>'.$langs->trans('Customer').'</option>'; |
|
861 | - if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) print '<option value="2,3"'.($search_type=='2,3'?' selected':'').'>'.$langs->trans('Prospect').'</option>'; |
|
862 | - //if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) print '<option value="3"'.($search_type=='3'?' selected':'').'>'.$langs->trans('ProspectCustomer').'</option>'; |
|
863 | - print '<option value="4"'.($search_type=='4'?' selected':'').'>'.$langs->trans('Supplier').'</option>'; |
|
864 | - print '<option value="0"'.($search_type=='0'?' selected':'').'>'.$langs->trans('Others').'</option>'; |
|
865 | - print '</select></td>'; |
|
856 | + print '<td class="liste_titre maxwidthonsmartphone" align="middle">'; |
|
857 | + if ($type != '') print '<input type="hidden" name="type" value="'.$type.'">'; |
|
858 | + print '<select class="flat" name="search_type">'; |
|
859 | + print '<option value="-1"'.($search_type==''?' selected':'').'> </option>'; |
|
860 | + if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) print '<option value="1,3"'.($search_type=='1,3'?' selected':'').'>'.$langs->trans('Customer').'</option>'; |
|
861 | + if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) print '<option value="2,3"'.($search_type=='2,3'?' selected':'').'>'.$langs->trans('Prospect').'</option>'; |
|
862 | + //if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) print '<option value="3"'.($search_type=='3'?' selected':'').'>'.$langs->trans('ProspectCustomer').'</option>'; |
|
863 | + print '<option value="4"'.($search_type=='4'?' selected':'').'>'.$langs->trans('Supplier').'</option>'; |
|
864 | + print '<option value="0"'.($search_type=='0'?' selected':'').'>'.$langs->trans('Others').'</option>'; |
|
865 | + print '</select></td>'; |
|
866 | 866 | } |
867 | 867 | if (! empty($arrayfields['s.fk_prospectlevel']['checked'])) |
868 | 868 | { |
869 | - // Prospect level |
|
870 | - print '<td class="liste_titre" align="center">'; |
|
871 | - $options_from = '<option value=""> </option>'; // Generate in $options_from the list of each option sorted |
|
872 | - foreach ($tab_level as $tab_level_sortorder => $tab_level_label) |
|
873 | - { |
|
874 | - $options_from .= '<option value="'.$tab_level_sortorder.'"'.($search_level_from == $tab_level_sortorder ? ' selected':'').'>'; |
|
875 | - $options_from .= $langs->trans($tab_level_label); |
|
876 | - $options_from .= '</option>'; |
|
877 | - } |
|
878 | - array_reverse($tab_level, true); // Reverse the list |
|
879 | - $options_to = '<option value=""> </option>'; // Generate in $options_to the list of each option sorted in the reversed order |
|
880 | - foreach ($tab_level as $tab_level_sortorder => $tab_level_label) |
|
881 | - { |
|
882 | - $options_to .= '<option value="'.$tab_level_sortorder.'"'.($search_level_to == $tab_level_sortorder ? ' selected':'').'>'; |
|
883 | - $options_to .= $langs->trans($tab_level_label); |
|
884 | - $options_to .= '</option>'; |
|
885 | - } |
|
886 | - |
|
887 | - // Print these two select |
|
888 | - print $langs->trans("From").' <select class="flat" name="search_level_from">'.$options_from.'</select>'; |
|
889 | - print ' '; |
|
890 | - print $langs->trans("to").' <select class="flat" name="search_level_to">'.$options_to.'</select>'; |
|
891 | - |
|
892 | - print '</td>'; |
|
869 | + // Prospect level |
|
870 | + print '<td class="liste_titre" align="center">'; |
|
871 | + $options_from = '<option value=""> </option>'; // Generate in $options_from the list of each option sorted |
|
872 | + foreach ($tab_level as $tab_level_sortorder => $tab_level_label) |
|
873 | + { |
|
874 | + $options_from .= '<option value="'.$tab_level_sortorder.'"'.($search_level_from == $tab_level_sortorder ? ' selected':'').'>'; |
|
875 | + $options_from .= $langs->trans($tab_level_label); |
|
876 | + $options_from .= '</option>'; |
|
877 | + } |
|
878 | + array_reverse($tab_level, true); // Reverse the list |
|
879 | + $options_to = '<option value=""> </option>'; // Generate in $options_to the list of each option sorted in the reversed order |
|
880 | + foreach ($tab_level as $tab_level_sortorder => $tab_level_label) |
|
881 | + { |
|
882 | + $options_to .= '<option value="'.$tab_level_sortorder.'"'.($search_level_to == $tab_level_sortorder ? ' selected':'').'>'; |
|
883 | + $options_to .= $langs->trans($tab_level_label); |
|
884 | + $options_to .= '</option>'; |
|
885 | + } |
|
886 | + |
|
887 | + // Print these two select |
|
888 | + print $langs->trans("From").' <select class="flat" name="search_level_from">'.$options_from.'</select>'; |
|
889 | + print ' '; |
|
890 | + print $langs->trans("to").' <select class="flat" name="search_level_to">'.$options_to.'</select>'; |
|
891 | + |
|
892 | + print '</td>'; |
|
893 | 893 | } |
894 | 894 | |
895 | 895 | if (! empty($arrayfields['s.fk_stcomm']['checked'])) |
896 | 896 | { |
897 | - // Prospect status |
|
898 | - print '<td class="liste_titre maxwidthonsmartphone" align="center">'; |
|
899 | - $arraystcomm=array(); |
|
900 | - foreach($prospectstatic->cacheprospectstatus as $key => $val) |
|
901 | - { |
|
902 | - $arraystcomm[$val['id']]=($langs->trans("StatusProspect".$val['id']) != "StatusProspect".$val['id'] ? $langs->trans("StatusProspect".$val['id']) : $val['label']); |
|
903 | - } |
|
904 | - print $form->selectarray('search_stcomm', $arraystcomm, $search_stcomm, -2); |
|
905 | - print '</td>'; |
|
897 | + // Prospect status |
|
898 | + print '<td class="liste_titre maxwidthonsmartphone" align="center">'; |
|
899 | + $arraystcomm=array(); |
|
900 | + foreach($prospectstatic->cacheprospectstatus as $key => $val) |
|
901 | + { |
|
902 | + $arraystcomm[$val['id']]=($langs->trans("StatusProspect".$val['id']) != "StatusProspect".$val['id'] ? $langs->trans("StatusProspect".$val['id']) : $val['label']); |
|
903 | + } |
|
904 | + print $form->selectarray('search_stcomm', $arraystcomm, $search_stcomm, -2); |
|
905 | + print '</td>'; |
|
906 | 906 | } |
907 | 907 | // Extra fields |
908 | 908 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; |
@@ -914,27 +914,27 @@ discard block |
||
914 | 914 | // Date creation |
915 | 915 | if (! empty($arrayfields['s.datec']['checked'])) |
916 | 916 | { |
917 | - print '<td class="liste_titre">'; |
|
918 | - print '</td>'; |
|
917 | + print '<td class="liste_titre">'; |
|
918 | + print '</td>'; |
|
919 | 919 | } |
920 | 920 | // Date modification |
921 | 921 | if (! empty($arrayfields['s.tms']['checked'])) |
922 | 922 | { |
923 | - print '<td class="liste_titre">'; |
|
924 | - print '</td>'; |
|
923 | + print '<td class="liste_titre">'; |
|
924 | + print '</td>'; |
|
925 | 925 | } |
926 | 926 | // Status |
927 | 927 | if (! empty($arrayfields['s.status']['checked'])) |
928 | 928 | { |
929 | - print '<td class="liste_titre maxwidthonsmartphone center">'; |
|
930 | - print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')), $search_status, 1); |
|
931 | - print '</td>'; |
|
929 | + print '<td class="liste_titre maxwidthonsmartphone center">'; |
|
930 | + print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')), $search_status, 1); |
|
931 | + print '</td>'; |
|
932 | 932 | } |
933 | 933 | if (! empty($arrayfields['s.import_key']['checked'])) |
934 | 934 | { |
935 | - print '<td class="liste_titre center">'; |
|
936 | - print '<input class="flat searchstring" type="text" name="search_import_key" size="3" value="'.dol_escape_htmltag($search_import_key).'">'; |
|
937 | - print '</td>'; |
|
935 | + print '<td class="liste_titre center">'; |
|
936 | + print '<input class="flat searchstring" type="text" name="search_import_key" size="3" value="'.dol_escape_htmltag($search_import_key).'">'; |
|
937 | + print '</td>'; |
|
938 | 938 | } |
939 | 939 | // Action column |
940 | 940 | print '<td class="liste_titre" align="right">'; |
@@ -990,274 +990,274 @@ discard block |
||
990 | 990 | $totalarray=array(); |
991 | 991 | while ($i < min($num, $limit)) |
992 | 992 | { |
993 | - $obj = $db->fetch_object($resql); |
|
994 | - |
|
995 | - $companystatic->id=$obj->rowid; |
|
996 | - $companystatic->name=$obj->name; |
|
997 | - $companystatic->name_alias=$obj->name_alias; |
|
998 | - $companystatic->logo=$obj->logo; |
|
999 | - $companystatic->canvas=$obj->canvas; |
|
1000 | - $companystatic->client=$obj->client; |
|
1001 | - $companystatic->status=$obj->status; |
|
1002 | - $companystatic->email=$obj->email; |
|
1003 | - $companystatic->fournisseur=$obj->fournisseur; |
|
1004 | - $companystatic->code_client=$obj->code_client; |
|
1005 | - $companystatic->code_fournisseur=$obj->code_fournisseur; |
|
1006 | - |
|
1007 | - $companystatic->code_compta_client=$obj->code_compta; |
|
1008 | - $companystatic->code_compta_fournisseur=$obj->code_compta_fournisseur; |
|
1009 | - |
|
1010 | - $companystatic->fk_prospectlevel=$obj->fk_prospectlevel; |
|
1011 | - |
|
1012 | - print '<tr class="oddeven" onclick="location.href=\'customers.php?action=change&idcustomer='.$obj->rowid.'&place='.$place.'\'">'; |
|
1013 | - if (! empty($arrayfields['s.rowid']['checked'])) |
|
1014 | - { |
|
1015 | - print '<td class="tdoverflowmax50">'; |
|
1016 | - print $obj->rowid; |
|
1017 | - print "</td>\n"; |
|
1018 | - if (! $i) $totalarray['nbfield']++; |
|
1019 | - } |
|
1020 | - if (! empty($arrayfields['s.nom']['checked'])) |
|
1021 | - { |
|
1022 | - $savalias = $obj->name_alias; |
|
1023 | - if (! empty($arrayfields['s.name_alias']['checked'])) $companystatic->name_alias=''; |
|
1024 | - print '<td class="tdoverflowmax200">'; |
|
1025 | - print $obj->name; |
|
1026 | - print "</td>\n"; |
|
993 | + $obj = $db->fetch_object($resql); |
|
994 | + |
|
995 | + $companystatic->id=$obj->rowid; |
|
996 | + $companystatic->name=$obj->name; |
|
997 | + $companystatic->name_alias=$obj->name_alias; |
|
998 | + $companystatic->logo=$obj->logo; |
|
999 | + $companystatic->canvas=$obj->canvas; |
|
1000 | + $companystatic->client=$obj->client; |
|
1001 | + $companystatic->status=$obj->status; |
|
1002 | + $companystatic->email=$obj->email; |
|
1003 | + $companystatic->fournisseur=$obj->fournisseur; |
|
1004 | + $companystatic->code_client=$obj->code_client; |
|
1005 | + $companystatic->code_fournisseur=$obj->code_fournisseur; |
|
1006 | + |
|
1007 | + $companystatic->code_compta_client=$obj->code_compta; |
|
1008 | + $companystatic->code_compta_fournisseur=$obj->code_compta_fournisseur; |
|
1009 | + |
|
1010 | + $companystatic->fk_prospectlevel=$obj->fk_prospectlevel; |
|
1011 | + |
|
1012 | + print '<tr class="oddeven" onclick="location.href=\'customers.php?action=change&idcustomer='.$obj->rowid.'&place='.$place.'\'">'; |
|
1013 | + if (! empty($arrayfields['s.rowid']['checked'])) |
|
1014 | + { |
|
1015 | + print '<td class="tdoverflowmax50">'; |
|
1016 | + print $obj->rowid; |
|
1017 | + print "</td>\n"; |
|
1018 | + if (! $i) $totalarray['nbfield']++; |
|
1019 | + } |
|
1020 | + if (! empty($arrayfields['s.nom']['checked'])) |
|
1021 | + { |
|
1022 | + $savalias = $obj->name_alias; |
|
1023 | + if (! empty($arrayfields['s.name_alias']['checked'])) $companystatic->name_alias=''; |
|
1024 | + print '<td class="tdoverflowmax200">'; |
|
1025 | + print $obj->name; |
|
1026 | + print "</td>\n"; |
|
1027 | + if (! $i) $totalarray['nbfield']++; |
|
1028 | + } |
|
1029 | + if (! empty($arrayfields['s.name_alias']['checked'])) |
|
1030 | + { |
|
1031 | + print '<td class="tdoverflowmax200">'; |
|
1032 | + print $companystatic->name_alias; |
|
1033 | + print "</td>\n"; |
|
1034 | + if (! $i) $totalarray['nbfield']++; |
|
1035 | + } |
|
1036 | + // Barcode |
|
1037 | + if (! empty($arrayfields['s.barcode']['checked'])) |
|
1038 | + { |
|
1039 | + print '<td>'.$obj->barcode.'</td>'; |
|
1040 | + if (! $i) $totalarray['nbfield']++; |
|
1041 | + } |
|
1042 | + // Customer code |
|
1043 | + if (! empty($arrayfields['s.code_client']['checked'])) |
|
1044 | + { |
|
1045 | + print '<td>'.$obj->code_client.'</td>'; |
|
1046 | + if (! $i) $totalarray['nbfield']++; |
|
1047 | + } |
|
1048 | + // Supplier code |
|
1049 | + if (! empty($arrayfields['s.code_fournisseur']['checked'])) |
|
1050 | + { |
|
1051 | + print '<td>'.$obj->code_fournisseur.'</td>'; |
|
1052 | + if (! $i) $totalarray['nbfield']++; |
|
1053 | + } |
|
1054 | + // Account customer code |
|
1055 | + if (! empty($arrayfields['s.code_compta']['checked'])) |
|
1056 | + { |
|
1057 | + print '<td>'.$obj->code_compta.'</td>'; |
|
1058 | + if (! $i) $totalarray['nbfield']++; |
|
1059 | + } |
|
1060 | + // Account supplier code |
|
1061 | + if (! empty($arrayfields['s.code_compta_fournisseur']['checked'])) |
|
1062 | + { |
|
1063 | + print '<td>'.$obj->code_compta_fournisseur.'</td>'; |
|
1064 | + if (! $i) $totalarray['nbfield']++; |
|
1065 | + } |
|
1066 | + // Town |
|
1067 | + if (! empty($arrayfields['s.town']['checked'])) |
|
1068 | + { |
|
1069 | + print "<td>".$obj->town."</td>\n"; |
|
1070 | + if (! $i) $totalarray['nbfield']++; |
|
1071 | + } |
|
1072 | + // Zip |
|
1073 | + if (! empty($arrayfields['s.zip']['checked'])) |
|
1074 | + { |
|
1075 | + print "<td>".$obj->zip."</td>\n"; |
|
1076 | + if (! $i) $totalarray['nbfield']++; |
|
1077 | + } |
|
1078 | + // State |
|
1079 | + if (! empty($arrayfields['state.nom']['checked'])) |
|
1080 | + { |
|
1081 | + print "<td>".$obj->state_name."</td>\n"; |
|
1082 | + if (! $i) $totalarray['nbfield']++; |
|
1083 | + } |
|
1084 | + // Region |
|
1085 | + if (! empty($arrayfields['region.nom']['checked'])) |
|
1086 | + { |
|
1087 | + print "<td>".$obj->region_name."</td>\n"; |
|
1088 | + if (! $i) $totalarray['nbfield']++; |
|
1089 | + } |
|
1090 | + // Country |
|
1091 | + if (! empty($arrayfields['country.code_iso']['checked'])) |
|
1092 | + { |
|
1093 | + print '<td align="center">'; |
|
1094 | + $tmparray=getCountry($obj->fk_pays,'all'); |
|
1095 | + print $tmparray['label']; |
|
1096 | + print '</td>'; |
|
1097 | + if (! $i) $totalarray['nbfield']++; |
|
1098 | + } |
|
1099 | + // Type ent |
|
1100 | + if (! empty($arrayfields['typent.code']['checked'])) |
|
1101 | + { |
|
1102 | + print '<td align="center">'; |
|
1103 | + if (! is_array($typenArray) || count($typenArray)==0) $typenArray = $formcompany->typent_array(1); |
|
1104 | + print $typenArray[$obj->typent_code]; |
|
1105 | + print '</td>'; |
|
1106 | + if (! $i) $totalarray['nbfield']++; |
|
1107 | + } |
|
1108 | + if (! empty($arrayfields['s.email']['checked'])) |
|
1109 | + { |
|
1110 | + print "<td>".$obj->email."</td>\n"; |
|
1111 | + if (! $i) $totalarray['nbfield']++; |
|
1112 | + } |
|
1113 | + if (! empty($arrayfields['s.phone']['checked'])) |
|
1114 | + { |
|
1115 | + print "<td>".$obj->phone."</td>\n"; |
|
1116 | + if (! $i) $totalarray['nbfield']++; |
|
1117 | + } |
|
1118 | + if (! empty($arrayfields['s.url']['checked'])) |
|
1119 | + { |
|
1120 | + print "<td>".$obj->url."</td>\n"; |
|
1121 | + if (! $i) $totalarray['nbfield']++; |
|
1122 | + } |
|
1123 | + if (! empty($arrayfields['s.siren']['checked'])) |
|
1124 | + { |
|
1125 | + print "<td>".$obj->idprof1."</td>\n"; |
|
1126 | + if (! $i) $totalarray['nbfield']++; |
|
1127 | + } |
|
1128 | + if (! empty($arrayfields['s.siret']['checked'])) |
|
1129 | + { |
|
1130 | + print "<td>".$obj->idprof2."</td>\n"; |
|
1131 | + if (! $i) $totalarray['nbfield']++; |
|
1132 | + } |
|
1133 | + if (! empty($arrayfields['s.ape']['checked'])) |
|
1134 | + { |
|
1135 | + print "<td>".$obj->idprof3."</td>\n"; |
|
1136 | + if (! $i) $totalarray['nbfield']++; |
|
1137 | + } |
|
1138 | + if (! empty($arrayfields['s.idprof4']['checked'])) |
|
1139 | + { |
|
1140 | + print "<td>".$obj->idprof4."</td>\n"; |
|
1141 | + if (! $i) $totalarray['nbfield']++; |
|
1142 | + } |
|
1143 | + if (! empty($arrayfields['s.idprof5']['checked'])) |
|
1144 | + { |
|
1145 | + print "<td>".$obj->idprof5."</td>\n"; |
|
1146 | + if (! $i) $totalarray['nbfield']++; |
|
1147 | + } |
|
1148 | + if (! empty($arrayfields['s.idprof6']['checked'])) |
|
1149 | + { |
|
1150 | + print "<td>".$obj->idprof6."</td>\n"; |
|
1151 | + if (! $i) $totalarray['nbfield']++; |
|
1152 | + } |
|
1153 | + if (! empty($arrayfields['s.tva_intra']['checked'])) |
|
1154 | + { |
|
1155 | + print "<td>".$obj->tva_intra."</td>\n"; |
|
1156 | + if (! $i) $totalarray['nbfield']++; |
|
1157 | + } |
|
1158 | + // Type |
|
1159 | + if (! empty($arrayfields['customerorsupplier']['checked'])) |
|
1160 | + { |
|
1161 | + print '<td align="center">'; |
|
1162 | + $s=''; |
|
1163 | + if (($obj->client==1 || $obj->client==3) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) |
|
1164 | + { |
|
1165 | + $companystatic->name=$langs->trans("Customer"); |
|
1166 | + $companystatic->name_alias=''; |
|
1167 | + $s.=$companystatic->getNomUrl(0,'customer',0,1); |
|
1168 | + } |
|
1169 | + if (($obj->client==2 || $obj->client==3) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) |
|
1170 | + { |
|
1171 | + if ($s) $s.=" / "; |
|
1172 | + $companystatic->name=$langs->trans("Prospect"); |
|
1173 | + $companystatic->name_alias=''; |
|
1174 | + $s.=$companystatic->getNomUrl(0,'prospect',0,1); |
|
1175 | + } |
|
1176 | + if (! empty($conf->fournisseur->enabled) && $obj->fournisseur) |
|
1177 | + { |
|
1178 | + if ($s) $s.=" / "; |
|
1179 | + $companystatic->name=$langs->trans("Supplier"); |
|
1180 | + $companystatic->name_alias=''; |
|
1181 | + $s.=$companystatic->getNomUrl(0,'supplier',0,1); |
|
1182 | + } |
|
1183 | + print $s; |
|
1184 | + print '</td>'; |
|
1185 | + if (! $i) $totalarray['nbfield']++; |
|
1186 | + } |
|
1187 | + |
|
1188 | + if (! empty($arrayfields['s.fk_prospectlevel']['checked'])) |
|
1189 | + { |
|
1190 | + // Prospect level |
|
1191 | + print '<td align="center">'; |
|
1192 | + print $companystatic->getLibProspLevel(); |
|
1193 | + print "</td>"; |
|
1194 | + if (! $i) $totalarray['nbfield']++; |
|
1195 | + } |
|
1196 | + |
|
1197 | + if (! empty($arrayfields['s.fk_stcomm']['checked'])) |
|
1198 | + { |
|
1199 | + // Prospect status |
|
1200 | + print '<td align="center" class="nowrap"><div class="nowrap">'; |
|
1201 | + print '<div class="inline-block">'.$companystatic->LibProspCommStatut($obj->stcomm_id,2,$prospectstatic->cacheprospectstatus[$obj->stcomm_id]['label']); |
|
1202 | + print '</div> - <div class="inline-block">'; |
|
1203 | + foreach($prospectstatic->cacheprospectstatus as $key => $val) |
|
1204 | + { |
|
1205 | + $titlealt='default'; |
|
1206 | + if (! empty($val['code']) && ! in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) $titlealt=$val['label']; |
|
1207 | + if ($obj->stcomm_id != $val['id']) print '<a class="pictosubstatus" href="'.$_SERVER["PHP_SELF"].'?stcommsocid='.$obj->rowid.'&stcomm='.$val['code'].'&action=setstcomm'.$param.($page?'&page='.urlencode($page):'').'">'.img_action($titlealt,$val['code']).'</a>'; |
|
1208 | + } |
|
1209 | + print '</div></div></td>'; |
|
1210 | + if (! $i) $totalarray['nbfield']++; |
|
1211 | + } |
|
1212 | + // Extra fields |
|
1213 | + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; |
|
1214 | + // Fields from hook |
|
1215 | + $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); |
|
1216 | + $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook |
|
1217 | + print $hookmanager->resPrint; |
|
1218 | + // Date creation |
|
1219 | + if (! empty($arrayfields['s.datec']['checked'])) |
|
1220 | + { |
|
1221 | + print '<td align="center" class="nowrap">'; |
|
1222 | + print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); |
|
1223 | + print '</td>'; |
|
1224 | + if (! $i) $totalarray['nbfield']++; |
|
1225 | + } |
|
1226 | + // Date modification |
|
1227 | + if (! empty($arrayfields['s.tms']['checked'])) |
|
1228 | + { |
|
1229 | + print '<td align="center" class="nowrap">'; |
|
1230 | + print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); |
|
1231 | + print '</td>'; |
|
1232 | + if (! $i) $totalarray['nbfield']++; |
|
1233 | + } |
|
1234 | + // Status |
|
1235 | + if (! empty($arrayfields['s.status']['checked'])) |
|
1236 | + { |
|
1237 | + print '<td align="center" class="nowrap">'.$companystatic->getLibStatut(3).'</td>'; |
|
1238 | + if (! $i) $totalarray['nbfield']++; |
|
1239 | + } |
|
1240 | + if (! empty($arrayfields['s.import_key']['checked'])) |
|
1241 | + { |
|
1242 | + print '<td class="tdoverflowmax100">'; |
|
1243 | + print $obj->import_key; |
|
1244 | + print "</td>\n"; |
|
1027 | 1245 | if (! $i) $totalarray['nbfield']++; |
1028 | - } |
|
1029 | - if (! empty($arrayfields['s.name_alias']['checked'])) |
|
1030 | - { |
|
1031 | - print '<td class="tdoverflowmax200">'; |
|
1032 | - print $companystatic->name_alias; |
|
1033 | - print "</td>\n"; |
|
1034 | - if (! $i) $totalarray['nbfield']++; |
|
1035 | - } |
|
1036 | - // Barcode |
|
1037 | - if (! empty($arrayfields['s.barcode']['checked'])) |
|
1038 | - { |
|
1039 | - print '<td>'.$obj->barcode.'</td>'; |
|
1040 | - if (! $i) $totalarray['nbfield']++; |
|
1041 | - } |
|
1042 | - // Customer code |
|
1043 | - if (! empty($arrayfields['s.code_client']['checked'])) |
|
1044 | - { |
|
1045 | - print '<td>'.$obj->code_client.'</td>'; |
|
1046 | - if (! $i) $totalarray['nbfield']++; |
|
1047 | - } |
|
1048 | - // Supplier code |
|
1049 | - if (! empty($arrayfields['s.code_fournisseur']['checked'])) |
|
1050 | - { |
|
1051 | - print '<td>'.$obj->code_fournisseur.'</td>'; |
|
1052 | - if (! $i) $totalarray['nbfield']++; |
|
1053 | - } |
|
1054 | - // Account customer code |
|
1055 | - if (! empty($arrayfields['s.code_compta']['checked'])) |
|
1056 | - { |
|
1057 | - print '<td>'.$obj->code_compta.'</td>'; |
|
1058 | - if (! $i) $totalarray['nbfield']++; |
|
1059 | - } |
|
1060 | - // Account supplier code |
|
1061 | - if (! empty($arrayfields['s.code_compta_fournisseur']['checked'])) |
|
1062 | - { |
|
1063 | - print '<td>'.$obj->code_compta_fournisseur.'</td>'; |
|
1064 | - if (! $i) $totalarray['nbfield']++; |
|
1065 | - } |
|
1066 | - // Town |
|
1067 | - if (! empty($arrayfields['s.town']['checked'])) |
|
1068 | - { |
|
1069 | - print "<td>".$obj->town."</td>\n"; |
|
1070 | - if (! $i) $totalarray['nbfield']++; |
|
1071 | - } |
|
1072 | - // Zip |
|
1073 | - if (! empty($arrayfields['s.zip']['checked'])) |
|
1074 | - { |
|
1075 | - print "<td>".$obj->zip."</td>\n"; |
|
1076 | - if (! $i) $totalarray['nbfield']++; |
|
1077 | - } |
|
1078 | - // State |
|
1079 | - if (! empty($arrayfields['state.nom']['checked'])) |
|
1080 | - { |
|
1081 | - print "<td>".$obj->state_name."</td>\n"; |
|
1082 | - if (! $i) $totalarray['nbfield']++; |
|
1083 | - } |
|
1084 | - // Region |
|
1085 | - if (! empty($arrayfields['region.nom']['checked'])) |
|
1086 | - { |
|
1087 | - print "<td>".$obj->region_name."</td>\n"; |
|
1088 | - if (! $i) $totalarray['nbfield']++; |
|
1089 | - } |
|
1090 | - // Country |
|
1091 | - if (! empty($arrayfields['country.code_iso']['checked'])) |
|
1092 | - { |
|
1093 | - print '<td align="center">'; |
|
1094 | - $tmparray=getCountry($obj->fk_pays,'all'); |
|
1095 | - print $tmparray['label']; |
|
1096 | - print '</td>'; |
|
1097 | - if (! $i) $totalarray['nbfield']++; |
|
1098 | - } |
|
1099 | - // Type ent |
|
1100 | - if (! empty($arrayfields['typent.code']['checked'])) |
|
1101 | - { |
|
1102 | - print '<td align="center">'; |
|
1103 | - if (! is_array($typenArray) || count($typenArray)==0) $typenArray = $formcompany->typent_array(1); |
|
1104 | - print $typenArray[$obj->typent_code]; |
|
1105 | - print '</td>'; |
|
1106 | - if (! $i) $totalarray['nbfield']++; |
|
1107 | - } |
|
1108 | - if (! empty($arrayfields['s.email']['checked'])) |
|
1109 | - { |
|
1110 | - print "<td>".$obj->email."</td>\n"; |
|
1111 | - if (! $i) $totalarray['nbfield']++; |
|
1112 | - } |
|
1113 | - if (! empty($arrayfields['s.phone']['checked'])) |
|
1114 | - { |
|
1115 | - print "<td>".$obj->phone."</td>\n"; |
|
1116 | - if (! $i) $totalarray['nbfield']++; |
|
1117 | - } |
|
1118 | - if (! empty($arrayfields['s.url']['checked'])) |
|
1119 | - { |
|
1120 | - print "<td>".$obj->url."</td>\n"; |
|
1121 | - if (! $i) $totalarray['nbfield']++; |
|
1122 | - } |
|
1123 | - if (! empty($arrayfields['s.siren']['checked'])) |
|
1124 | - { |
|
1125 | - print "<td>".$obj->idprof1."</td>\n"; |
|
1126 | - if (! $i) $totalarray['nbfield']++; |
|
1127 | - } |
|
1128 | - if (! empty($arrayfields['s.siret']['checked'])) |
|
1129 | - { |
|
1130 | - print "<td>".$obj->idprof2."</td>\n"; |
|
1131 | - if (! $i) $totalarray['nbfield']++; |
|
1132 | - } |
|
1133 | - if (! empty($arrayfields['s.ape']['checked'])) |
|
1134 | - { |
|
1135 | - print "<td>".$obj->idprof3."</td>\n"; |
|
1136 | - if (! $i) $totalarray['nbfield']++; |
|
1137 | - } |
|
1138 | - if (! empty($arrayfields['s.idprof4']['checked'])) |
|
1139 | - { |
|
1140 | - print "<td>".$obj->idprof4."</td>\n"; |
|
1141 | - if (! $i) $totalarray['nbfield']++; |
|
1142 | - } |
|
1143 | - if (! empty($arrayfields['s.idprof5']['checked'])) |
|
1144 | - { |
|
1145 | - print "<td>".$obj->idprof5."</td>\n"; |
|
1146 | - if (! $i) $totalarray['nbfield']++; |
|
1147 | - } |
|
1148 | - if (! empty($arrayfields['s.idprof6']['checked'])) |
|
1149 | - { |
|
1150 | - print "<td>".$obj->idprof6."</td>\n"; |
|
1151 | - if (! $i) $totalarray['nbfield']++; |
|
1152 | - } |
|
1153 | - if (! empty($arrayfields['s.tva_intra']['checked'])) |
|
1154 | - { |
|
1155 | - print "<td>".$obj->tva_intra."</td>\n"; |
|
1156 | - if (! $i) $totalarray['nbfield']++; |
|
1157 | - } |
|
1158 | - // Type |
|
1159 | - if (! empty($arrayfields['customerorsupplier']['checked'])) |
|
1160 | - { |
|
1161 | - print '<td align="center">'; |
|
1162 | - $s=''; |
|
1163 | - if (($obj->client==1 || $obj->client==3) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) |
|
1164 | - { |
|
1165 | - $companystatic->name=$langs->trans("Customer"); |
|
1166 | - $companystatic->name_alias=''; |
|
1167 | - $s.=$companystatic->getNomUrl(0,'customer',0,1); |
|
1168 | - } |
|
1169 | - if (($obj->client==2 || $obj->client==3) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) |
|
1170 | - { |
|
1171 | - if ($s) $s.=" / "; |
|
1172 | - $companystatic->name=$langs->trans("Prospect"); |
|
1173 | - $companystatic->name_alias=''; |
|
1174 | - $s.=$companystatic->getNomUrl(0,'prospect',0,1); |
|
1175 | - } |
|
1176 | - if (! empty($conf->fournisseur->enabled) && $obj->fournisseur) |
|
1177 | - { |
|
1178 | - if ($s) $s.=" / "; |
|
1179 | - $companystatic->name=$langs->trans("Supplier"); |
|
1180 | - $companystatic->name_alias=''; |
|
1181 | - $s.=$companystatic->getNomUrl(0,'supplier',0,1); |
|
1182 | - } |
|
1183 | - print $s; |
|
1184 | - print '</td>'; |
|
1185 | - if (! $i) $totalarray['nbfield']++; |
|
1186 | - } |
|
1187 | - |
|
1188 | - if (! empty($arrayfields['s.fk_prospectlevel']['checked'])) |
|
1189 | - { |
|
1190 | - // Prospect level |
|
1191 | - print '<td align="center">'; |
|
1192 | - print $companystatic->getLibProspLevel(); |
|
1193 | - print "</td>"; |
|
1194 | - if (! $i) $totalarray['nbfield']++; |
|
1195 | - } |
|
1196 | - |
|
1197 | - if (! empty($arrayfields['s.fk_stcomm']['checked'])) |
|
1198 | - { |
|
1199 | - // Prospect status |
|
1200 | - print '<td align="center" class="nowrap"><div class="nowrap">'; |
|
1201 | - print '<div class="inline-block">'.$companystatic->LibProspCommStatut($obj->stcomm_id,2,$prospectstatic->cacheprospectstatus[$obj->stcomm_id]['label']); |
|
1202 | - print '</div> - <div class="inline-block">'; |
|
1203 | - foreach($prospectstatic->cacheprospectstatus as $key => $val) |
|
1204 | - { |
|
1205 | - $titlealt='default'; |
|
1206 | - if (! empty($val['code']) && ! in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) $titlealt=$val['label']; |
|
1207 | - if ($obj->stcomm_id != $val['id']) print '<a class="pictosubstatus" href="'.$_SERVER["PHP_SELF"].'?stcommsocid='.$obj->rowid.'&stcomm='.$val['code'].'&action=setstcomm'.$param.($page?'&page='.urlencode($page):'').'">'.img_action($titlealt,$val['code']).'</a>'; |
|
1208 | - } |
|
1209 | - print '</div></div></td>'; |
|
1210 | - if (! $i) $totalarray['nbfield']++; |
|
1211 | - } |
|
1212 | - // Extra fields |
|
1213 | - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; |
|
1214 | - // Fields from hook |
|
1215 | - $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); |
|
1216 | - $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook |
|
1217 | - print $hookmanager->resPrint; |
|
1218 | - // Date creation |
|
1219 | - if (! empty($arrayfields['s.datec']['checked'])) |
|
1220 | - { |
|
1221 | - print '<td align="center" class="nowrap">'; |
|
1222 | - print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); |
|
1223 | - print '</td>'; |
|
1224 | - if (! $i) $totalarray['nbfield']++; |
|
1225 | - } |
|
1226 | - // Date modification |
|
1227 | - if (! empty($arrayfields['s.tms']['checked'])) |
|
1228 | - { |
|
1229 | - print '<td align="center" class="nowrap">'; |
|
1230 | - print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); |
|
1231 | - print '</td>'; |
|
1232 | - if (! $i) $totalarray['nbfield']++; |
|
1233 | - } |
|
1234 | - // Status |
|
1235 | - if (! empty($arrayfields['s.status']['checked'])) |
|
1236 | - { |
|
1237 | - print '<td align="center" class="nowrap">'.$companystatic->getLibStatut(3).'</td>'; |
|
1238 | - if (! $i) $totalarray['nbfield']++; |
|
1239 | - } |
|
1240 | - if (! empty($arrayfields['s.import_key']['checked'])) |
|
1241 | - { |
|
1242 | - print '<td class="tdoverflowmax100">'; |
|
1243 | - print $obj->import_key; |
|
1244 | - print "</td>\n"; |
|
1245 | - if (! $i) $totalarray['nbfield']++; |
|
1246 | - } |
|
1247 | - |
|
1248 | - // Action column |
|
1249 | - print '<td class="nowrap" align="center">'; |
|
1250 | - if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined |
|
1251 | - { |
|
1252 | - $selected=0; |
|
1253 | - if (in_array($obj->rowid, $arrayofselected)) $selected=1; |
|
1254 | - print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>'; |
|
1255 | - } |
|
1256 | - print '</td>'; |
|
1257 | - if (! $i) $totalarray['nbfield']++; |
|
1258 | - |
|
1259 | - print '</tr>'."\n"; |
|
1260 | - $i++; |
|
1246 | + } |
|
1247 | + |
|
1248 | + // Action column |
|
1249 | + print '<td class="nowrap" align="center">'; |
|
1250 | + if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined |
|
1251 | + { |
|
1252 | + $selected=0; |
|
1253 | + if (in_array($obj->rowid, $arrayofselected)) $selected=1; |
|
1254 | + print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>'; |
|
1255 | + } |
|
1256 | + print '</td>'; |
|
1257 | + if (! $i) $totalarray['nbfield']++; |
|
1258 | + |
|
1259 | + print '</tr>'."\n"; |
|
1260 | + $i++; |
|
1261 | 1261 | } |
1262 | 1262 | |
1263 | 1263 | $db->free($resql); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | // Copyright (C) 2018 Alxarafe/Alixar <[email protected]> |
35 | 35 | defined('BASE_PATH') or die('Single entry point through the index.php of the main folder'); |
36 | -require DOL_BASE_PATH . '/main.inc.php'; |
|
36 | +require DOL_BASE_PATH.'/main.inc.php'; |
|
37 | 37 | // Load $user and permissions |
38 | 38 | include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; |
39 | 39 | require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; |
@@ -43,13 +43,13 @@ discard block |
||
43 | 43 | |
44 | 44 | $langs->loadLangs(array("companies", "commercial", "customers", "suppliers", "bills", "compta", "categories", "cashdesk")); |
45 | 45 | |
46 | -$action=GETPOST('action','alpha'); |
|
47 | -$massaction=GETPOST('massaction','alpha'); |
|
48 | -$show_files=GETPOST('show_files','int'); |
|
49 | -$confirm=GETPOST('confirm','alpha'); |
|
46 | +$action = GETPOST('action', 'alpha'); |
|
47 | +$massaction = GETPOST('massaction', 'alpha'); |
|
48 | +$show_files = GETPOST('show_files', 'int'); |
|
49 | +$confirm = GETPOST('confirm', 'alpha'); |
|
50 | 50 | $toselect = GETPOST('toselect', 'array'); |
51 | -$idcustomer = GETPOST('idcustomer','int'); |
|
52 | -$place = GETPOST('place','int'); |
|
51 | +$idcustomer = GETPOST('idcustomer', 'int'); |
|
52 | +$place = GETPOST('place', 'int'); |
|
53 | 53 | |
54 | 54 | $_GET['optioncss'] = 'print'; |
55 | 55 | |
@@ -58,12 +58,12 @@ discard block |
||
58 | 58 | * Actions |
59 | 59 | */ |
60 | 60 | |
61 | -if ($action=="change") { |
|
62 | - $sql="UPDATE ".MAIN_DB_PREFIX."facture set fk_soc=".$idcustomer." where ref='(PROV-POS-".$place.")'"; |
|
61 | +if ($action == "change") { |
|
62 | + $sql = "UPDATE ".MAIN_DB_PREFIX."facture set fk_soc=".$idcustomer." where ref='(PROV-POS-".$place.")'"; |
|
63 | 63 | $resql = $db->query($sql); |
64 | 64 | ?> |
65 | 65 | <script> |
66 | - parent.$("#poslines").load("invoice.php?place="+<?php print $place;?>, function() { |
|
66 | + parent.$("#poslines").load("invoice.php?place="+<?php print $place; ?>, function() { |
|
67 | 67 | parent.$("#poslines").scrollTop(parent.$("#poslines")[0].scrollHeight); |
68 | 68 | parent.$.colorbox.close(); |
69 | 69 | }); |
@@ -73,74 +73,74 @@ discard block |
||
73 | 73 | } |
74 | 74 | |
75 | 75 | // Security check |
76 | -$socid = GETPOST('socid','int'); |
|
77 | -if ($user->societe_id) $socid=$user->societe_id; |
|
78 | -$result = restrictedArea($user,'societe',$socid,''); |
|
79 | - |
|
80 | -$search_all=trim(GETPOST('search_all', 'alphanohtml')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml')); |
|
81 | -$search_cti=preg_replace('/^0+/', '', preg_replace('/[^0-9]/', '', GETPOST('search_cti', 'alphanohtml'))); // Phone number without any special chars |
|
82 | - |
|
83 | -$search_id=trim(GETPOST("search_id","int")); |
|
84 | -$search_nom=trim(GETPOST("search_nom")); |
|
85 | -$search_alias=trim(GETPOST("search_alias")); |
|
86 | -$search_nom_only=trim(GETPOST("search_nom_only")); |
|
87 | -$search_barcode=trim(GETPOST("search_barcode")); |
|
88 | -$search_customer_code=trim(GETPOST('search_customer_code')); |
|
89 | -$search_supplier_code=trim(GETPOST('search_supplier_code')); |
|
90 | -$search_account_customer_code=trim(GETPOST('search_account_customer_code')); |
|
91 | -$search_account_supplier_code=trim(GETPOST('search_account_supplier_code')); |
|
92 | -$search_town=trim(GETPOST("search_town")); |
|
93 | -$search_zip=trim(GETPOST("search_zip")); |
|
94 | -$search_state=trim(GETPOST("search_state")); |
|
95 | -$search_region=trim(GETPOST("search_region")); |
|
96 | -$search_email=trim(GETPOST('search_email')); |
|
97 | -$search_phone=trim(GETPOST('search_phone')); |
|
98 | -$search_url=trim(GETPOST('search_url')); |
|
99 | -$search_idprof1=trim(GETPOST('search_idprof1')); |
|
100 | -$search_idprof2=trim(GETPOST('search_idprof2')); |
|
101 | -$search_idprof3=trim(GETPOST('search_idprof3')); |
|
102 | -$search_idprof4=trim(GETPOST('search_idprof4')); |
|
103 | -$search_idprof5=trim(GETPOST('search_idprof5')); |
|
104 | -$search_idprof6=trim(GETPOST('search_idprof6')); |
|
105 | -$search_vat=trim(GETPOST('search_vat')); |
|
106 | -$search_sale=trim(GETPOST("search_sale",'int')); |
|
107 | -$search_categ_cus=trim(GETPOST("search_categ_cus",'int')); |
|
108 | -$search_categ_sup=trim(GETPOST("search_categ_sup",'int')); |
|
109 | -$search_country=GETPOST("search_country",'intcomma'); |
|
110 | -$search_type_thirdparty=GETPOST("search_type_thirdparty",'int'); |
|
111 | -$search_status=GETPOST("search_status",'int'); |
|
112 | -$search_type=GETPOST('search_type','alpha'); |
|
113 | -$search_level_from = GETPOST("search_level_from","alpha"); |
|
114 | -$search_level_to = GETPOST("search_level_to","alpha"); |
|
115 | -$search_stcomm=GETPOST('search_stcomm','int'); |
|
116 | -$search_import_key = GETPOST("search_import_key","alpha"); |
|
117 | - |
|
118 | -$type=GETPOST('type'); |
|
119 | -$optioncss=GETPOST('optioncss','alpha'); |
|
120 | -$mode=GETPOST("mode"); |
|
121 | - |
|
122 | -$diroutputmassaction=$conf->societe->dir_output . '/temp/massgeneration/'.$user->id; |
|
123 | - |
|
124 | -$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; |
|
125 | -$sortfield=GETPOST("sortfield",'alpha'); |
|
126 | -$sortorder=GETPOST("sortorder",'alpha'); |
|
127 | -$page=GETPOST("page",'int'); |
|
128 | -if (! $sortorder) $sortorder="ASC"; |
|
129 | -if (! $sortfield) $sortfield="s.nom"; |
|
76 | +$socid = GETPOST('socid', 'int'); |
|
77 | +if ($user->societe_id) $socid = $user->societe_id; |
|
78 | +$result = restrictedArea($user, 'societe', $socid, ''); |
|
79 | + |
|
80 | +$search_all = trim(GETPOST('search_all', 'alphanohtml') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); |
|
81 | +$search_cti = preg_replace('/^0+/', '', preg_replace('/[^0-9]/', '', GETPOST('search_cti', 'alphanohtml'))); // Phone number without any special chars |
|
82 | + |
|
83 | +$search_id = trim(GETPOST("search_id", "int")); |
|
84 | +$search_nom = trim(GETPOST("search_nom")); |
|
85 | +$search_alias = trim(GETPOST("search_alias")); |
|
86 | +$search_nom_only = trim(GETPOST("search_nom_only")); |
|
87 | +$search_barcode = trim(GETPOST("search_barcode")); |
|
88 | +$search_customer_code = trim(GETPOST('search_customer_code')); |
|
89 | +$search_supplier_code = trim(GETPOST('search_supplier_code')); |
|
90 | +$search_account_customer_code = trim(GETPOST('search_account_customer_code')); |
|
91 | +$search_account_supplier_code = trim(GETPOST('search_account_supplier_code')); |
|
92 | +$search_town = trim(GETPOST("search_town")); |
|
93 | +$search_zip = trim(GETPOST("search_zip")); |
|
94 | +$search_state = trim(GETPOST("search_state")); |
|
95 | +$search_region = trim(GETPOST("search_region")); |
|
96 | +$search_email = trim(GETPOST('search_email')); |
|
97 | +$search_phone = trim(GETPOST('search_phone')); |
|
98 | +$search_url = trim(GETPOST('search_url')); |
|
99 | +$search_idprof1 = trim(GETPOST('search_idprof1')); |
|
100 | +$search_idprof2 = trim(GETPOST('search_idprof2')); |
|
101 | +$search_idprof3 = trim(GETPOST('search_idprof3')); |
|
102 | +$search_idprof4 = trim(GETPOST('search_idprof4')); |
|
103 | +$search_idprof5 = trim(GETPOST('search_idprof5')); |
|
104 | +$search_idprof6 = trim(GETPOST('search_idprof6')); |
|
105 | +$search_vat = trim(GETPOST('search_vat')); |
|
106 | +$search_sale = trim(GETPOST("search_sale", 'int')); |
|
107 | +$search_categ_cus = trim(GETPOST("search_categ_cus", 'int')); |
|
108 | +$search_categ_sup = trim(GETPOST("search_categ_sup", 'int')); |
|
109 | +$search_country = GETPOST("search_country", 'intcomma'); |
|
110 | +$search_type_thirdparty = GETPOST("search_type_thirdparty", 'int'); |
|
111 | +$search_status = GETPOST("search_status", 'int'); |
|
112 | +$search_type = GETPOST('search_type', 'alpha'); |
|
113 | +$search_level_from = GETPOST("search_level_from", "alpha"); |
|
114 | +$search_level_to = GETPOST("search_level_to", "alpha"); |
|
115 | +$search_stcomm = GETPOST('search_stcomm', 'int'); |
|
116 | +$search_import_key = GETPOST("search_import_key", "alpha"); |
|
117 | + |
|
118 | +$type = GETPOST('type'); |
|
119 | +$optioncss = GETPOST('optioncss', 'alpha'); |
|
120 | +$mode = GETPOST("mode"); |
|
121 | + |
|
122 | +$diroutputmassaction = $conf->societe->dir_output.'/temp/massgeneration/'.$user->id; |
|
123 | + |
|
124 | +$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; |
|
125 | +$sortfield = GETPOST("sortfield", 'alpha'); |
|
126 | +$sortorder = GETPOST("sortorder", 'alpha'); |
|
127 | +$page = GETPOST("page", 'int'); |
|
128 | +if (!$sortorder) $sortorder = "ASC"; |
|
129 | +if (!$sortfield) $sortfield = "s.nom"; |
|
130 | 130 | if (empty($page) || $page == -1) { $page = 0; } |
131 | 131 | $offset = $limit * $page; |
132 | 132 | $pageprev = $page - 1; |
133 | 133 | $pagenext = $page + 1; |
134 | 134 | |
135 | 135 | // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context |
136 | -$contextpage='thirdpartylist'; |
|
136 | +$contextpage = 'thirdpartylist'; |
|
137 | 137 | /*if ($search_type == '1,3') { $contextpage='customerlist'; $type='c'; } |
138 | 138 | if ($search_type == '2,3') { $contextpage='prospectlist'; $type='p'; } |
139 | 139 | if ($search_type == '4') { $contextpage='supplierlist'; $type='f'; } |
140 | 140 | */ |
141 | -if ($type == 'c') { $contextpage='customerlist'; if ($search_type=='') $search_type='1,3'; } |
|
142 | -if ($type == 'p') { $contextpage='prospectlist'; if ($search_type=='') $search_type='2,3'; } |
|
143 | -if ($type == 'f') { $contextpage='supplierlist'; if ($search_type=='') $search_type='4'; } |
|
141 | +if ($type == 'c') { $contextpage = 'customerlist'; if ($search_type == '') $search_type = '1,3'; } |
|
142 | +if ($type == 'p') { $contextpage = 'prospectlist'; if ($search_type == '') $search_type = '2,3'; } |
|
143 | +if ($type == 'f') { $contextpage = 'supplierlist'; if ($search_type == '') $search_type = '4'; } |
|
144 | 144 | |
145 | 145 | // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context |
146 | 146 | $hookmanager->initHooks(array($contextpage)); |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | |
149 | 149 | // fetch optionals attributes and labels |
150 | 150 | $extralabels = $extrafields->fetch_name_optionals_label('societe'); |
151 | -$search_array_options=$extrafields->getOptionalsFromPost('societe','','search_'); |
|
151 | +$search_array_options = $extrafields->getOptionalsFromPost('societe', '', 'search_'); |
|
152 | 152 | |
153 | 153 | // List of fields to search into when doing a "search in all" |
154 | 154 | $fieldstosearchall = array( |
@@ -165,37 +165,37 @@ discard block |
||
165 | 165 | 's.siret'=>"ProfId2", |
166 | 166 | 's.ape'=>"ProfId3", |
167 | 167 | ); |
168 | -if (($tmp = $langs->transnoentities("ProfId4".$mysoc->country_code)) && $tmp != "ProfId4".$mysoc->country_code && $tmp != '-') $fieldstosearchall['s.idprof4']='ProfId4'; |
|
169 | -if (($tmp = $langs->transnoentities("ProfId5".$mysoc->country_code)) && $tmp != "ProfId5".$mysoc->country_code && $tmp != '-') $fieldstosearchall['s.idprof5']='ProfId5'; |
|
170 | -if (($tmp = $langs->transnoentities("ProfId6".$mysoc->country_code)) && $tmp != "ProfId6".$mysoc->country_code && $tmp != '-') $fieldstosearchall['s.idprof6']='ProfId6'; |
|
171 | -if (!empty($conf->barcode->enabled)) $fieldstosearchall['s.barcode']='Gencod'; |
|
168 | +if (($tmp = $langs->transnoentities("ProfId4".$mysoc->country_code)) && $tmp != "ProfId4".$mysoc->country_code && $tmp != '-') $fieldstosearchall['s.idprof4'] = 'ProfId4'; |
|
169 | +if (($tmp = $langs->transnoentities("ProfId5".$mysoc->country_code)) && $tmp != "ProfId5".$mysoc->country_code && $tmp != '-') $fieldstosearchall['s.idprof5'] = 'ProfId5'; |
|
170 | +if (($tmp = $langs->transnoentities("ProfId6".$mysoc->country_code)) && $tmp != "ProfId6".$mysoc->country_code && $tmp != '-') $fieldstosearchall['s.idprof6'] = 'ProfId6'; |
|
171 | +if (!empty($conf->barcode->enabled)) $fieldstosearchall['s.barcode'] = 'Gencod'; |
|
172 | 172 | |
173 | 173 | // Define list of fields to show into list |
174 | -$checkedcustomercode=(in_array($contextpage, array('thirdpartylist', 'customerlist', 'prospectlist')) ? 1 : 0); |
|
175 | -$checkedsuppliercode=(in_array($contextpage, array('supplierlist')) ? 1 : 0); |
|
176 | -$checkedcustomeraccountcode=(in_array($contextpage, array('customerlist')) ? 1 : 0); |
|
177 | -$checkedsupplieraccountcode=(in_array($contextpage, array('supplierlist')) ? 1 : 0); |
|
178 | -$checkedtypetiers=1; |
|
179 | -$checkedprofid1=0; |
|
180 | -$checkedprofid2=0; |
|
181 | -$checkedprofid3=0; |
|
182 | -$checkedprofid4=0; |
|
183 | -$checkedprofid5=0; |
|
184 | -$checkedprofid6=0; |
|
174 | +$checkedcustomercode = (in_array($contextpage, array('thirdpartylist', 'customerlist', 'prospectlist')) ? 1 : 0); |
|
175 | +$checkedsuppliercode = (in_array($contextpage, array('supplierlist')) ? 1 : 0); |
|
176 | +$checkedcustomeraccountcode = (in_array($contextpage, array('customerlist')) ? 1 : 0); |
|
177 | +$checkedsupplieraccountcode = (in_array($contextpage, array('supplierlist')) ? 1 : 0); |
|
178 | +$checkedtypetiers = 1; |
|
179 | +$checkedprofid1 = 0; |
|
180 | +$checkedprofid2 = 0; |
|
181 | +$checkedprofid3 = 0; |
|
182 | +$checkedprofid4 = 0; |
|
183 | +$checkedprofid5 = 0; |
|
184 | +$checkedprofid6 = 0; |
|
185 | 185 | //$checkedprofid4=((($tmp = $langs->transnoentities("ProfId4".$mysoc->country_code)) && $tmp != "ProfId4".$mysoc->country_code && $tmp != '-') ? 1 : 0); |
186 | 186 | //$checkedprofid5=((($tmp = $langs->transnoentities("ProfId5".$mysoc->country_code)) && $tmp != "ProfId5".$mysoc->country_code && $tmp != '-') ? 1 : 0); |
187 | 187 | //$checkedprofid6=((($tmp = $langs->transnoentities("ProfId6".$mysoc->country_code)) && $tmp != "ProfId6".$mysoc->country_code && $tmp != '-') ? 1 : 0); |
188 | -$checkprospectlevel=(in_array($contextpage, array('prospectlist')) ? 1 : 0); |
|
189 | -$checkstcomm=(in_array($contextpage, array('prospectlist')) ? 1 : 0); |
|
190 | -$arrayfields=array( |
|
191 | - 's.rowid'=>array('label'=>"TechnicalID", 'checked'=>($conf->global->MAIN_SHOW_TECHNICAL_ID?1:0), 'enabled'=>($conf->global->MAIN_SHOW_TECHNICAL_ID?1:0)), |
|
188 | +$checkprospectlevel = (in_array($contextpage, array('prospectlist')) ? 1 : 0); |
|
189 | +$checkstcomm = (in_array($contextpage, array('prospectlist')) ? 1 : 0); |
|
190 | +$arrayfields = array( |
|
191 | + 's.rowid'=>array('label'=>"TechnicalID", 'checked'=>($conf->global->MAIN_SHOW_TECHNICAL_ID ? 1 : 0), 'enabled'=>($conf->global->MAIN_SHOW_TECHNICAL_ID ? 1 : 0)), |
|
192 | 192 | 's.nom'=>array('label'=>"ThirdPartyName", 'checked'=>1), |
193 | 193 | 's.name_alias'=>array('label'=>"AliasNameShort", 'checked'=>1), |
194 | - 's.barcode'=>array('label'=>"Gencod", 'checked'=>1, 'enabled'=>(! empty($conf->barcode->enabled))), |
|
194 | + 's.barcode'=>array('label'=>"Gencod", 'checked'=>1, 'enabled'=>(!empty($conf->barcode->enabled))), |
|
195 | 195 | 's.code_client'=>array('label'=>"CustomerCodeShort", 'checked'=>$checkedcustomercode), |
196 | - 's.code_fournisseur'=>array('label'=>"SupplierCodeShort", 'checked'=>$checkedsuppliercode, 'enabled'=>(! empty($conf->fournisseur->enabled))), |
|
196 | + 's.code_fournisseur'=>array('label'=>"SupplierCodeShort", 'checked'=>$checkedsuppliercode, 'enabled'=>(!empty($conf->fournisseur->enabled))), |
|
197 | 197 | 's.code_compta'=>array('label'=>"CustomerAccountancyCodeShort", 'checked'=>$checkedcustomeraccountcode), |
198 | - 's.code_compta_fournisseur'=>array('label'=>"SupplierAccountancyCodeShort", 'checked'=>$checkedsupplieraccountcode, 'enabled'=>(! empty($conf->fournisseur->enabled))), |
|
198 | + 's.code_compta_fournisseur'=>array('label'=>"SupplierAccountancyCodeShort", 'checked'=>$checkedsupplieraccountcode, 'enabled'=>(!empty($conf->fournisseur->enabled))), |
|
199 | 199 | 's.town'=>array('label'=>"Town", 'checked'=>1), |
200 | 200 | 's.zip'=>array('label'=>"Zip", 'checked'=>1), |
201 | 201 | 'state.nom'=>array('label'=>"State", 'checked'=>0), |
@@ -223,9 +223,9 @@ discard block |
||
223 | 223 | // Extra fields |
224 | 224 | if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) |
225 | 225 | { |
226 | - foreach($extrafields->attribute_label as $key => $val) |
|
226 | + foreach ($extrafields->attribute_label as $key => $val) |
|
227 | 227 | { |
228 | - if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key])); |
|
228 | + if (!empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key] = array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key] < 0) ? 0 : 1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key]) != 3 && $extrafields->attribute_perms[$key])); |
|
229 | 229 | } |
230 | 230 | } |
231 | 231 | |
@@ -236,11 +236,11 @@ discard block |
||
236 | 236 | * Actions |
237 | 237 | */ |
238 | 238 | |
239 | -if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; } |
|
240 | -if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; } |
|
239 | +if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; } |
|
240 | +if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; } |
|
241 | 241 | |
242 | -$parameters=array(); |
|
243 | -$reshook=$hookmanager->executeHooks('doActions',$parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
242 | +$parameters = array(); |
|
243 | +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
244 | 244 | if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
245 | 245 | |
246 | 246 | if (empty($reshook)) |
@@ -249,47 +249,47 @@ discard block |
||
249 | 249 | include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; |
250 | 250 | |
251 | 251 | // Did we click on purge search criteria ? |
252 | - if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers |
|
252 | + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers |
|
253 | 253 | { |
254 | - $search_id=''; |
|
255 | - $search_nom=''; |
|
256 | - $search_alias=''; |
|
257 | - $search_categ_cus=0; |
|
258 | - $search_categ_sup=0; |
|
259 | - $search_sale=''; |
|
260 | - $search_barcode=""; |
|
261 | - $search_customer_code=''; |
|
262 | - $search_supplier_code=''; |
|
263 | - $search_account_customer_code=''; |
|
264 | - $search_account_supplier_code=''; |
|
265 | - $search_town=""; |
|
266 | - $search_zip=""; |
|
267 | - $search_state=""; |
|
268 | - $search_country=''; |
|
269 | - $search_email=''; |
|
270 | - $search_phone=''; |
|
271 | - $search_url=''; |
|
272 | - $search_idprof1=''; |
|
273 | - $search_idprof2=''; |
|
274 | - $search_idprof3=''; |
|
275 | - $search_idprof4=''; |
|
276 | - $search_idprof5=''; |
|
277 | - $search_idprof6=''; |
|
278 | - $search_vat=''; |
|
279 | - $search_type=''; |
|
280 | - $search_type_thirdparty=''; |
|
281 | - $search_status=-1; |
|
282 | - $search_stcomm=''; |
|
283 | - $search_level_from=''; |
|
284 | - $search_level_to=''; |
|
285 | - $search_import_key=''; |
|
286 | - $toselect=''; |
|
287 | - $search_array_options=array(); |
|
254 | + $search_id = ''; |
|
255 | + $search_nom = ''; |
|
256 | + $search_alias = ''; |
|
257 | + $search_categ_cus = 0; |
|
258 | + $search_categ_sup = 0; |
|
259 | + $search_sale = ''; |
|
260 | + $search_barcode = ""; |
|
261 | + $search_customer_code = ''; |
|
262 | + $search_supplier_code = ''; |
|
263 | + $search_account_customer_code = ''; |
|
264 | + $search_account_supplier_code = ''; |
|
265 | + $search_town = ""; |
|
266 | + $search_zip = ""; |
|
267 | + $search_state = ""; |
|
268 | + $search_country = ''; |
|
269 | + $search_email = ''; |
|
270 | + $search_phone = ''; |
|
271 | + $search_url = ''; |
|
272 | + $search_idprof1 = ''; |
|
273 | + $search_idprof2 = ''; |
|
274 | + $search_idprof3 = ''; |
|
275 | + $search_idprof4 = ''; |
|
276 | + $search_idprof5 = ''; |
|
277 | + $search_idprof6 = ''; |
|
278 | + $search_vat = ''; |
|
279 | + $search_type = ''; |
|
280 | + $search_type_thirdparty = ''; |
|
281 | + $search_status = -1; |
|
282 | + $search_stcomm = ''; |
|
283 | + $search_level_from = ''; |
|
284 | + $search_level_to = ''; |
|
285 | + $search_import_key = ''; |
|
286 | + $toselect = ''; |
|
287 | + $search_array_options = array(); |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | // Mass actions |
291 | - $objectclass='Societe'; |
|
292 | - $objectlabel='ThirdParty'; |
|
291 | + $objectclass = 'Societe'; |
|
292 | + $objectlabel = 'ThirdParty'; |
|
293 | 293 | $permtoread = $user->rights->societe->lire; |
294 | 294 | $permtodelete = $user->rights->societe->supprimer; |
295 | 295 | $uploaddir = $conf->societe->dir_output; |
@@ -298,16 +298,16 @@ discard block |
||
298 | 298 | if ($action == 'setstcomm') |
299 | 299 | { |
300 | 300 | $object = new Client($db); |
301 | - $result=$object->fetch(GETPOST('stcommsocid')); |
|
302 | - $object->stcomm_id=dol_getIdFromCode($db, GETPOST('stcomm','alpha'), 'c_stcomm'); |
|
303 | - $result=$object->update($object->id, $user); |
|
304 | - if ($result < 0) setEventMessages($object->error,$object->errors,'errors'); |
|
301 | + $result = $object->fetch(GETPOST('stcommsocid')); |
|
302 | + $object->stcomm_id = dol_getIdFromCode($db, GETPOST('stcomm', 'alpha'), 'c_stcomm'); |
|
303 | + $result = $object->update($object->id, $user); |
|
304 | + if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); |
|
305 | 305 | |
306 | - $action=''; |
|
306 | + $action = ''; |
|
307 | 307 | } |
308 | 308 | } |
309 | 309 | |
310 | -if ($search_status=='') $search_status=1; // always display active thirdparty first |
|
310 | +if ($search_status == '') $search_status = 1; // always display active thirdparty first |
|
311 | 311 | |
312 | 312 | |
313 | 313 | |
@@ -324,19 +324,19 @@ discard block |
||
324 | 324 | External user socid=x + No permission to see ALL customers => Can see only himself |
325 | 325 | */ |
326 | 326 | |
327 | -$form=new Form($db); |
|
328 | -$formother=new FormOther($db); |
|
329 | -$companystatic=new Societe($db); |
|
330 | -$formcompany=new FormCompany($db); |
|
331 | -$prospectstatic=new Client($db); |
|
332 | -$prospectstatic->client=2; |
|
327 | +$form = new Form($db); |
|
328 | +$formother = new FormOther($db); |
|
329 | +$companystatic = new Societe($db); |
|
330 | +$formcompany = new FormCompany($db); |
|
331 | +$prospectstatic = new Client($db); |
|
332 | +$prospectstatic->client = 2; |
|
333 | 333 | $prospectstatic->loadCacheOfProspStatus(); |
334 | 334 | |
335 | 335 | |
336 | -$title=$langs->trans("ListOfThirdParties"); |
|
337 | -if ($type == 'c' && (empty($search_type) || ($search_type == '1,3'))) $title=$langs->trans("ListOfCustomers"); |
|
338 | -if ($type == 'p' && (empty($search_type) || ($search_type == '2,3'))) $title=$langs->trans("ListOfProspects"); |
|
339 | -if ($type == 'f' && (empty($search_type) || ($search_type == '4'))) $title=$langs->trans("ListOfSuppliers"); |
|
336 | +$title = $langs->trans("ListOfThirdParties"); |
|
337 | +if ($type == 'c' && (empty($search_type) || ($search_type == '1,3'))) $title = $langs->trans("ListOfCustomers"); |
|
338 | +if ($type == 'p' && (empty($search_type) || ($search_type == '2,3'))) $title = $langs->trans("ListOfProspects"); |
|
339 | +if ($type == 'f' && (empty($search_type) || ($search_type == '4'))) $title = $langs->trans("ListOfSuppliers"); |
|
340 | 340 | |
341 | 341 | // If both parameters are set, search for everything BETWEEN them |
342 | 342 | if ($search_level_from != '' && $search_level_to != '') |
@@ -381,11 +381,11 @@ discard block |
||
381 | 381 | } |
382 | 382 | |
383 | 383 | // Select every potentiels, and note each potentiels which fit in search parameters |
384 | -dol_syslog('societe/list.php',LOG_DEBUG); |
|
384 | +dol_syslog('societe/list.php', LOG_DEBUG); |
|
385 | 385 | $sql = "SELECT code, label, sortorder, ".$sortwhere; |
386 | -$sql.= " FROM ".MAIN_DB_PREFIX."c_prospectlevel"; |
|
387 | -$sql.= " WHERE active > 0"; |
|
388 | -$sql.= " ORDER BY sortorder"; |
|
386 | +$sql .= " FROM ".MAIN_DB_PREFIX."c_prospectlevel"; |
|
387 | +$sql .= " WHERE active > 0"; |
|
388 | +$sql .= " ORDER BY sortorder"; |
|
389 | 389 | |
390 | 390 | $resql = $db->query($sql); |
391 | 391 | if ($resql) |
@@ -396,8 +396,8 @@ discard block |
||
396 | 396 | while ($obj = $db->fetch_object($resql)) |
397 | 397 | { |
398 | 398 | // Compute level text |
399 | - $level=$langs->trans($obj->code); |
|
400 | - if ($level == $obj->code) $level=$langs->trans($obj->label); |
|
399 | + $level = $langs->trans($obj->code); |
|
400 | + if ($level == $obj->code) $level = $langs->trans($obj->label); |
|
401 | 401 | |
402 | 402 | // Put it in the array sorted by sortorder |
403 | 403 | $tab_level[$obj->sortorder] = $level; |
@@ -416,93 +416,93 @@ discard block |
||
416 | 416 | else dol_print_error($db); |
417 | 417 | |
418 | 418 | $sql = "SELECT s.rowid, s.nom as name, s.name_alias, s.barcode, s.town, s.zip, s.datec, s.code_client, s.code_fournisseur, s.logo,"; |
419 | -$sql.= " st.libelle as stcomm, s.fk_stcomm as stcomm_id, s.fk_prospectlevel, s.prefix_comm, s.client, s.fournisseur, s.canvas, s.status as status,"; |
|
420 | -$sql.= " s.email, s.phone, s.url, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4 as idprof4, s.idprof5 as idprof5, s.idprof6 as idprof6, s.tva_intra, s.fk_pays,"; |
|
421 | -$sql.= " s.tms as date_update, s.datec as date_creation,"; |
|
422 | -$sql.= " s.code_compta,s.code_compta_fournisseur,"; |
|
423 | -$sql.= " typent.code as typent_code,"; |
|
424 | -$sql.= " state.code_departement as state_code, state.nom as state_name,"; |
|
425 | -$sql.= " region.code_region as region_code, region.nom as region_name"; |
|
419 | +$sql .= " st.libelle as stcomm, s.fk_stcomm as stcomm_id, s.fk_prospectlevel, s.prefix_comm, s.client, s.fournisseur, s.canvas, s.status as status,"; |
|
420 | +$sql .= " s.email, s.phone, s.url, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4 as idprof4, s.idprof5 as idprof5, s.idprof6 as idprof6, s.tva_intra, s.fk_pays,"; |
|
421 | +$sql .= " s.tms as date_update, s.datec as date_creation,"; |
|
422 | +$sql .= " s.code_compta,s.code_compta_fournisseur,"; |
|
423 | +$sql .= " typent.code as typent_code,"; |
|
424 | +$sql .= " state.code_departement as state_code, state.nom as state_name,"; |
|
425 | +$sql .= " region.code_region as region_code, region.nom as region_name"; |
|
426 | 426 | // We'll need these fields in order to filter by sale (including the case where the user can only see his prospects) |
427 | 427 | if ($search_sale) $sql .= ", sc.fk_soc, sc.fk_user"; |
428 | 428 | // We'll need these fields in order to filter by categ |
429 | 429 | if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc"; |
430 | 430 | if ($search_categ_sup) $sql .= ", cs.fk_categorie, cs.fk_soc"; |
431 | 431 | // Add fields from extrafields |
432 | -foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); |
|
432 | +foreach ($extrafields->attribute_label as $key => $val) $sql .= ($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); |
|
433 | 433 | // Add fields from hooks |
434 | -$parameters=array(); |
|
435 | -$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook |
|
436 | -$sql.=$hookmanager->resPrint; |
|
437 | -$sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; |
|
438 | -if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_extrafields as ef on (s.rowid = ef.fk_object)"; |
|
439 | -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)"; |
|
440 | -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)"; |
|
441 | -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)"; |
|
442 | -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as region on (region. code_region = state.fk_region)"; |
|
434 | +$parameters = array(); |
|
435 | +$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook |
|
436 | +$sql .= $hookmanager->resPrint; |
|
437 | +$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; |
|
438 | +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_extrafields as ef on (s.rowid = ef.fk_object)"; |
|
439 | +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)"; |
|
440 | +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)"; |
|
441 | +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)"; |
|
442 | +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as region on (region. code_region = state.fk_region)"; |
|
443 | 443 | // We'll need this table joined to the select in order to filter by categ |
444 | -if (! empty($search_categ_cus)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ |
|
445 | -if (! empty($search_categ_sup)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_fournisseur as cs ON s.rowid = cs.fk_soc"; // We'll need this table joined to the select in order to filter by categ |
|
446 | -$sql.= " ,".MAIN_DB_PREFIX."c_stcomm as st"; |
|
444 | +if (!empty($search_categ_cus)) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ |
|
445 | +if (!empty($search_categ_sup)) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_fournisseur as cs ON s.rowid = cs.fk_soc"; // We'll need this table joined to the select in order to filter by categ |
|
446 | +$sql .= " ,".MAIN_DB_PREFIX."c_stcomm as st"; |
|
447 | 447 | // We'll need this table joined to the select in order to filter by sale |
448 | -if ($search_sale || (!$user->rights->societe->client->voir && !$socid)) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; |
|
449 | -$sql.= " WHERE s.fk_stcomm = st.id"; |
|
450 | -$sql.= " AND s.entity IN (".getEntity('societe').")"; |
|
451 | -if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; |
|
452 | -if ($socid) $sql.= " AND s.rowid = ".$socid; |
|
453 | -if ($search_sale) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale |
|
454 | -if (! $user->rights->fournisseur->lire) $sql.=" AND (s.fournisseur <> 1 OR s.client <> 0)"; // client=0, fournisseur=0 must be visible |
|
455 | -if ($search_sale) $sql.= " AND sc.fk_user = ".$db->escape($search_sale); |
|
456 | -if ($search_categ_cus > 0) $sql.= " AND cc.fk_categorie = ".$db->escape($search_categ_cus); |
|
457 | -if ($search_categ_sup > 0) $sql.= " AND cs.fk_categorie = ".$db->escape($search_categ_sup); |
|
458 | -if ($search_categ_cus == -2) $sql.= " AND cc.fk_categorie IS NULL"; |
|
459 | -if ($search_categ_sup == -2) $sql.= " AND cs.fk_categorie IS NULL"; |
|
460 | - |
|
461 | -if ($search_all) $sql.= natural_search(array_keys($fieldstosearchall), $search_all); |
|
462 | -if (strlen($search_cti)) $sql.= natural_search('s.phone', $search_cti); |
|
463 | - |
|
464 | -if ($search_id > 0) $sql.= natural_search("s.rowid",$search_id,1); |
|
465 | -if ($search_nom) $sql.= natural_search("s.nom",$search_nom); |
|
466 | -if ($search_alias) $sql.= natural_search("s.name_alias",$search_alias); |
|
467 | -if ($search_nom_only) $sql.= natural_search("s.nom",$search_nom_only); |
|
468 | -if ($search_customer_code) $sql.= natural_search("s.code_client",$search_customer_code); |
|
469 | -if ($search_supplier_code) $sql.= natural_search("s.code_fournisseur",$search_supplier_code); |
|
470 | -if ($search_account_customer_code) $sql.= natural_search("s.code_compta",$search_account_customer_code); |
|
471 | -if ($search_account_supplier_code) $sql.= natural_search("s.code_compta_fournisseur",$search_account_supplier_code); |
|
472 | -if ($search_town) $sql.= natural_search("s.town",$search_town); |
|
473 | -if (strlen($search_zip)) $sql.= natural_search("s.zip",$search_zip); |
|
474 | -if ($search_state) $sql.= natural_search("state.nom",$search_state); |
|
475 | -if ($search_region) $sql.= natural_search("region.nom",$search_region); |
|
448 | +if ($search_sale || (!$user->rights->societe->client->voir && !$socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; |
|
449 | +$sql .= " WHERE s.fk_stcomm = st.id"; |
|
450 | +$sql .= " AND s.entity IN (".getEntity('societe').")"; |
|
451 | +if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; |
|
452 | +if ($socid) $sql .= " AND s.rowid = ".$socid; |
|
453 | +if ($search_sale) $sql .= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale |
|
454 | +if (!$user->rights->fournisseur->lire) $sql .= " AND (s.fournisseur <> 1 OR s.client <> 0)"; // client=0, fournisseur=0 must be visible |
|
455 | +if ($search_sale) $sql .= " AND sc.fk_user = ".$db->escape($search_sale); |
|
456 | +if ($search_categ_cus > 0) $sql .= " AND cc.fk_categorie = ".$db->escape($search_categ_cus); |
|
457 | +if ($search_categ_sup > 0) $sql .= " AND cs.fk_categorie = ".$db->escape($search_categ_sup); |
|
458 | +if ($search_categ_cus == -2) $sql .= " AND cc.fk_categorie IS NULL"; |
|
459 | +if ($search_categ_sup == -2) $sql .= " AND cs.fk_categorie IS NULL"; |
|
460 | + |
|
461 | +if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all); |
|
462 | +if (strlen($search_cti)) $sql .= natural_search('s.phone', $search_cti); |
|
463 | + |
|
464 | +if ($search_id > 0) $sql .= natural_search("s.rowid", $search_id, 1); |
|
465 | +if ($search_nom) $sql .= natural_search("s.nom", $search_nom); |
|
466 | +if ($search_alias) $sql .= natural_search("s.name_alias", $search_alias); |
|
467 | +if ($search_nom_only) $sql .= natural_search("s.nom", $search_nom_only); |
|
468 | +if ($search_customer_code) $sql .= natural_search("s.code_client", $search_customer_code); |
|
469 | +if ($search_supplier_code) $sql .= natural_search("s.code_fournisseur", $search_supplier_code); |
|
470 | +if ($search_account_customer_code) $sql .= natural_search("s.code_compta", $search_account_customer_code); |
|
471 | +if ($search_account_supplier_code) $sql .= natural_search("s.code_compta_fournisseur", $search_account_supplier_code); |
|
472 | +if ($search_town) $sql .= natural_search("s.town", $search_town); |
|
473 | +if (strlen($search_zip)) $sql .= natural_search("s.zip", $search_zip); |
|
474 | +if ($search_state) $sql .= natural_search("state.nom", $search_state); |
|
475 | +if ($search_region) $sql .= natural_search("region.nom", $search_region); |
|
476 | 476 | if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')'; |
477 | -if ($search_email) $sql.= natural_search("s.email",$search_email); |
|
478 | -if (strlen($search_phone)) $sql.= natural_search("s.phone", $search_phone); |
|
479 | -if ($search_url) $sql.= natural_search("s.url",$search_url); |
|
480 | -if (strlen($search_idprof1)) $sql.= natural_search("s.siren",$search_idprof1); |
|
481 | -if (strlen($search_idprof2)) $sql.= natural_search("s.siret",$search_idprof2); |
|
482 | -if (strlen($search_idprof3)) $sql.= natural_search("s.ape",$search_idprof3); |
|
483 | -if (strlen($search_idprof4)) $sql.= natural_search("s.idprof4",$search_idprof4); |
|
484 | -if (strlen($search_idprof5)) $sql.= natural_search("s.idprof5",$search_idprof5); |
|
485 | -if (strlen($search_idprof6)) $sql.= natural_search("s.idprof6",$search_idprof6); |
|
486 | -if (strlen($search_vat)) $sql.= natural_search("s.tva_intra",$search_vat); |
|
477 | +if ($search_email) $sql .= natural_search("s.email", $search_email); |
|
478 | +if (strlen($search_phone)) $sql .= natural_search("s.phone", $search_phone); |
|
479 | +if ($search_url) $sql .= natural_search("s.url", $search_url); |
|
480 | +if (strlen($search_idprof1)) $sql .= natural_search("s.siren", $search_idprof1); |
|
481 | +if (strlen($search_idprof2)) $sql .= natural_search("s.siret", $search_idprof2); |
|
482 | +if (strlen($search_idprof3)) $sql .= natural_search("s.ape", $search_idprof3); |
|
483 | +if (strlen($search_idprof4)) $sql .= natural_search("s.idprof4", $search_idprof4); |
|
484 | +if (strlen($search_idprof5)) $sql .= natural_search("s.idprof5", $search_idprof5); |
|
485 | +if (strlen($search_idprof6)) $sql .= natural_search("s.idprof6", $search_idprof6); |
|
486 | +if (strlen($search_vat)) $sql .= natural_search("s.tva_intra", $search_vat); |
|
487 | 487 | // Filter on type of thirdparty |
488 | -if ($search_type > 0 && in_array($search_type,array('1,3','2,3'))) $sql .= " AND s.client IN (".$db->escape($search_type).")"; |
|
489 | -if ($search_type > 0 && in_array($search_type,array('4'))) $sql .= " AND s.fournisseur = 1"; |
|
488 | +if ($search_type > 0 && in_array($search_type, array('1,3', '2,3'))) $sql .= " AND s.client IN (".$db->escape($search_type).")"; |
|
489 | +if ($search_type > 0 && in_array($search_type, array('4'))) $sql .= " AND s.fournisseur = 1"; |
|
490 | 490 | if ($search_type == '0') $sql .= " AND s.client = 0 AND s.fournisseur = 0"; |
491 | -if ($search_status!='' && $search_status >= 0) $sql .= " AND s.status = ".$db->escape($search_status); |
|
492 | -if (!empty($conf->barcode->enabled) && $search_barcode) $sql.= natural_search("s.barcode", $search_barcode); |
|
491 | +if ($search_status != '' && $search_status >= 0) $sql .= " AND s.status = ".$db->escape($search_status); |
|
492 | +if (!empty($conf->barcode->enabled) && $search_barcode) $sql .= natural_search("s.barcode", $search_barcode); |
|
493 | 493 | if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')'; |
494 | 494 | if ($search_levels) $sql .= " AND s.fk_prospectlevel IN (".$search_levels.')'; |
495 | -if ($search_stcomm != '' && $search_stcomm != -2) $sql.= natural_search("s.fk_stcomm",$search_stcomm,2); |
|
496 | -if ($search_import_key) $sql.= natural_search("s.import_key",$search_import_key); |
|
495 | +if ($search_stcomm != '' && $search_stcomm != -2) $sql .= natural_search("s.fk_stcomm", $search_stcomm, 2); |
|
496 | +if ($search_import_key) $sql .= natural_search("s.import_key", $search_import_key); |
|
497 | 497 | // Add where from extra fields |
498 | 498 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; |
499 | 499 | |
500 | 500 | // Add where from hooks |
501 | -$parameters=array(); |
|
502 | -$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook |
|
503 | -$sql.=$hookmanager->resPrint; |
|
501 | +$parameters = array(); |
|
502 | +$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook |
|
503 | +$sql .= $hookmanager->resPrint; |
|
504 | 504 | |
505 | -$sql.= $db->order($sortfield,$sortorder); |
|
505 | +$sql .= $db->order($sortfield, $sortorder); |
|
506 | 506 | |
507 | 507 | // Count total nb of records |
508 | 508 | $nbtotalofrecords = ''; |
@@ -512,10 +512,10 @@ discard block |
||
512 | 512 | $nbtotalofrecords = $db->num_rows($result); |
513 | 513 | } |
514 | 514 | |
515 | -$sql.= $db->plimit($limit+1, $offset); |
|
515 | +$sql .= $db->plimit($limit + 1, $offset); |
|
516 | 516 | |
517 | 517 | $resql = $db->query($sql); |
518 | -if (! $resql) |
|
518 | +if (!$resql) |
|
519 | 519 | { |
520 | 520 | dol_print_error($db); |
521 | 521 | exit; |
@@ -523,9 +523,9 @@ discard block |
||
523 | 523 | |
524 | 524 | $num = $db->num_rows($resql); |
525 | 525 | |
526 | -$arrayofselected=is_array($toselect)?$toselect:array(); |
|
526 | +$arrayofselected = is_array($toselect) ? $toselect : array(); |
|
527 | 527 | |
528 | -if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && ($search_all != '' || $search_cti != '') && $action != 'list') |
|
528 | +if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && ($search_all != '' || $search_cti != '') && $action != 'list') |
|
529 | 529 | { |
530 | 530 | $obj = $db->fetch_object($resql); |
531 | 531 | $id = $obj->rowid; |
@@ -533,66 +533,66 @@ discard block |
||
533 | 533 | exit; |
534 | 534 | } |
535 | 535 | |
536 | -$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; |
|
537 | -llxHeader('',$langs->trans("ThirdParty"),$help_url); |
|
536 | +$help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; |
|
537 | +llxHeader('', $langs->trans("ThirdParty"), $help_url); |
|
538 | 538 | |
539 | -$param=''; |
|
540 | -if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; |
|
541 | -if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; |
|
539 | +$param = ''; |
|
540 | +if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage; |
|
541 | +if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit; |
|
542 | 542 | if ($search_all != '') $param = "&sall=".urlencode($search_all); |
543 | 543 | if ($sall != '') $param .= "&sall=".urlencode($sall); |
544 | -if ($search_categ_cus > 0) $param.='&search_categ_cus='.urlencode($search_categ_cus); |
|
545 | -if ($search_categ_sup > 0) $param.='&search_categ_sup='.urlencode($search_categ_sup); |
|
546 | -if ($search_sale > 0) $param.='&search_sale='.urlencode($search_sale); |
|
547 | -if ($search_id > 0) $param.= "&search_id=".urlencode($search_id); |
|
548 | -if ($search_nom != '') $param.= "&search_nom=".urlencode($search_nom); |
|
549 | -if ($search_alias != '') $param.= "&search_alias=".urlencode($search_alias); |
|
550 | -if ($search_town != '') $param.= "&search_town=".urlencode($search_town); |
|
551 | -if ($search_zip != '') $param.= "&search_zip=".urlencode($search_zip); |
|
552 | -if ($search_phone != '') $param.= "&search_phone=".urlencode($search_phone); |
|
553 | -if ($search_email != '') $param.= "&search_email=".urlencode($search_email); |
|
554 | -if ($search_url != '') $param.= "&search_url=".urlencode($search_url); |
|
555 | -if ($search_state != '') $param.= "&search_state=".urlencode($search_state); |
|
556 | -if ($search_country != '') $param.= "&search_country=".urlencode($search_country); |
|
557 | -if ($search_customer_code != '') $param.= "&search_customer_code=".urlencode($search_customer_code); |
|
558 | -if ($search_supplier_code != '') $param.= "&search_supplier_code=".urlencode($search_supplier_code); |
|
559 | -if ($search_account_customer_code != '') $param.= "&search_account_customer_code=".urlencode($search_account_customer_code); |
|
560 | -if ($search_account_supplier_code != '') $param.= "&search_account_supplier_code=".urlencode($search_account_supplier_code); |
|
561 | -if ($search_barcode != '') $param.= "&search_barcode=".urlencode($search_barcode); |
|
562 | -if ($search_idprof1 != '') $param.= '&search_idprof1='.urlencode($search_idprof1); |
|
563 | -if ($search_idprof2 != '') $param.= '&search_idprof2='.urlencode($search_idprof2); |
|
564 | -if ($search_idprof3 != '') $param.= '&search_idprof3='.urlencode($search_idprof3); |
|
565 | -if ($search_idprof4 != '') $param.= '&search_idprof4='.urlencode($search_idprof4); |
|
566 | -if ($search_idprof5 != '') $param.= '&search_idprof5='.urlencode($search_idprof5); |
|
567 | -if ($search_idprof6 != '') $param.= '&search_idprof6='.urlencode($search_idprof6); |
|
568 | -if ($search_vat != '') $param.= '&search_vat='.urlencode($search_vat); |
|
569 | -if ($search_type_thirdparty != '') $param.='&search_type_thirdparty='.urlencode($search_type_thirdparty); |
|
570 | -if ($search_type != '') $param.='&search_type='.urlencode($search_type); |
|
571 | -if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); |
|
572 | -if ($search_status != '') $param.='&search_status='.urlencode($search_status); |
|
573 | -if ($search_stcomm != '') $param.='&search_stcomm='.urlencode($search_stcomm); |
|
574 | -if ($search_level_from != '') $param.='&search_level_from='.urlencode($search_level_from); |
|
575 | -if ($search_level_to != '') $param.='&search_level_to='.urlencode($search_level_to); |
|
576 | -if ($search_import_key != '') $param.='&search_import_key='.urlencode($search_import_key); |
|
577 | -if ($type != '') $param.='&type='.urlencode($type); |
|
544 | +if ($search_categ_cus > 0) $param .= '&search_categ_cus='.urlencode($search_categ_cus); |
|
545 | +if ($search_categ_sup > 0) $param .= '&search_categ_sup='.urlencode($search_categ_sup); |
|
546 | +if ($search_sale > 0) $param .= '&search_sale='.urlencode($search_sale); |
|
547 | +if ($search_id > 0) $param .= "&search_id=".urlencode($search_id); |
|
548 | +if ($search_nom != '') $param .= "&search_nom=".urlencode($search_nom); |
|
549 | +if ($search_alias != '') $param .= "&search_alias=".urlencode($search_alias); |
|
550 | +if ($search_town != '') $param .= "&search_town=".urlencode($search_town); |
|
551 | +if ($search_zip != '') $param .= "&search_zip=".urlencode($search_zip); |
|
552 | +if ($search_phone != '') $param .= "&search_phone=".urlencode($search_phone); |
|
553 | +if ($search_email != '') $param .= "&search_email=".urlencode($search_email); |
|
554 | +if ($search_url != '') $param .= "&search_url=".urlencode($search_url); |
|
555 | +if ($search_state != '') $param .= "&search_state=".urlencode($search_state); |
|
556 | +if ($search_country != '') $param .= "&search_country=".urlencode($search_country); |
|
557 | +if ($search_customer_code != '') $param .= "&search_customer_code=".urlencode($search_customer_code); |
|
558 | +if ($search_supplier_code != '') $param .= "&search_supplier_code=".urlencode($search_supplier_code); |
|
559 | +if ($search_account_customer_code != '') $param .= "&search_account_customer_code=".urlencode($search_account_customer_code); |
|
560 | +if ($search_account_supplier_code != '') $param .= "&search_account_supplier_code=".urlencode($search_account_supplier_code); |
|
561 | +if ($search_barcode != '') $param .= "&search_barcode=".urlencode($search_barcode); |
|
562 | +if ($search_idprof1 != '') $param .= '&search_idprof1='.urlencode($search_idprof1); |
|
563 | +if ($search_idprof2 != '') $param .= '&search_idprof2='.urlencode($search_idprof2); |
|
564 | +if ($search_idprof3 != '') $param .= '&search_idprof3='.urlencode($search_idprof3); |
|
565 | +if ($search_idprof4 != '') $param .= '&search_idprof4='.urlencode($search_idprof4); |
|
566 | +if ($search_idprof5 != '') $param .= '&search_idprof5='.urlencode($search_idprof5); |
|
567 | +if ($search_idprof6 != '') $param .= '&search_idprof6='.urlencode($search_idprof6); |
|
568 | +if ($search_vat != '') $param .= '&search_vat='.urlencode($search_vat); |
|
569 | +if ($search_type_thirdparty != '') $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty); |
|
570 | +if ($search_type != '') $param .= '&search_type='.urlencode($search_type); |
|
571 | +if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); |
|
572 | +if ($search_status != '') $param .= '&search_status='.urlencode($search_status); |
|
573 | +if ($search_stcomm != '') $param .= '&search_stcomm='.urlencode($search_stcomm); |
|
574 | +if ($search_level_from != '') $param .= '&search_level_from='.urlencode($search_level_from); |
|
575 | +if ($search_level_to != '') $param .= '&search_level_to='.urlencode($search_level_to); |
|
576 | +if ($search_import_key != '') $param .= '&search_import_key='.urlencode($search_import_key); |
|
577 | +if ($type != '') $param .= '&type='.urlencode($type); |
|
578 | 578 | // Add $param from extra fields |
579 | 579 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; |
580 | 580 | |
581 | 581 | // Show delete result message |
582 | 582 | if (GETPOST('delsoc')) |
583 | 583 | { |
584 | - setEventMessages($langs->trans("CompanyDeleted",GETPOST('delsoc')), null, 'mesgs'); |
|
584 | + setEventMessages($langs->trans("CompanyDeleted", GETPOST('delsoc')), null, 'mesgs'); |
|
585 | 585 | } |
586 | 586 | |
587 | 587 | // List of mass actions available |
588 | -$arrayofmassactions = array( |
|
588 | +$arrayofmassactions = array( |
|
589 | 589 | 'presend'=>$langs->trans("SendByMail"), |
590 | 590 | // 'builddoc'=>$langs->trans("PDFMerge"), |
591 | 591 | ); |
592 | 592 | //if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer"); |
593 | -if ($user->rights->societe->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete"); |
|
594 | -if (GETPOST('nomassaction','int') || in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); |
|
595 | -$massactionbutton=$form->selectMassAction('', $arrayofmassactions); |
|
593 | +if ($user->rights->societe->supprimer) $arrayofmassactions['predelete'] = $langs->trans("Delete"); |
|
594 | +if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array(); |
|
595 | +$massactionbutton = $form->selectMassAction('', $arrayofmassactions); |
|
596 | 596 | |
597 | 597 | print '<form method="post" action="'.$_SERVER["PHP_SELF"].'" name="formfilter">'; |
598 | 598 | if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; |
@@ -605,244 +605,244 @@ discard block |
||
605 | 605 | print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit); |
606 | 606 | |
607 | 607 | $langs->load("other"); |
608 | -$textprofid=array(); |
|
609 | -foreach(array(1,2,3,4,5,6) as $key) |
|
608 | +$textprofid = array(); |
|
609 | +foreach (array(1, 2, 3, 4, 5, 6) as $key) |
|
610 | 610 | { |
611 | - $label=$langs->transnoentities("ProfId".$key.$mysoc->country_code); |
|
612 | - $textprofid[$key]=''; |
|
611 | + $label = $langs->transnoentities("ProfId".$key.$mysoc->country_code); |
|
612 | + $textprofid[$key] = ''; |
|
613 | 613 | if ($label != "ProfId".$key.$mysoc->country_code) |
614 | 614 | { // Get only text between () |
615 | - if (preg_match('/\((.*)\)/i',$label,$reg)) $label=$reg[1]; |
|
616 | - $textprofid[$key]=$langs->trans("ProfIdShortDesc",$key,$mysoc->country_code,$label); |
|
615 | + if (preg_match('/\((.*)\)/i', $label, $reg)) $label = $reg[1]; |
|
616 | + $textprofid[$key] = $langs->trans("ProfIdShortDesc", $key, $mysoc->country_code, $label); |
|
617 | 617 | } |
618 | 618 | } |
619 | 619 | |
620 | -$topicmail="Information"; |
|
621 | -$modelmail="thirdparty"; |
|
622 | -$objecttmp=new Societe($db); |
|
623 | -$trackid='thi'.$object->id; |
|
620 | +$topicmail = "Information"; |
|
621 | +$modelmail = "thirdparty"; |
|
622 | +$objecttmp = new Societe($db); |
|
623 | +$trackid = 'thi'.$object->id; |
|
624 | 624 | include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; |
625 | 625 | |
626 | 626 | if ($search_all) |
627 | 627 | { |
628 | - foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); |
|
629 | - print $langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall); |
|
628 | + foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val); |
|
629 | + print $langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall); |
|
630 | 630 | } |
631 | 631 | |
632 | 632 | // Filter on categories |
633 | -$moreforfilter=''; |
|
633 | +$moreforfilter = ''; |
|
634 | 634 | if (empty($type) || $type == 'c' || $type == 'p') |
635 | 635 | { |
636 | - if (! empty($conf->categorie->enabled)) |
|
636 | + if (!empty($conf->categorie->enabled)) |
|
637 | 637 | { |
638 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
639 | - $moreforfilter.='<div class="divsearchfield">'; |
|
640 | - $moreforfilter.=$langs->trans('CustomersProspectsCategoriesShort').': '; |
|
641 | - $moreforfilter.=$formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1, $langs->trans('CustomersProspectsCategoriesShort')); |
|
642 | - $moreforfilter.='</div>'; |
|
638 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
639 | + $moreforfilter .= '<div class="divsearchfield">'; |
|
640 | + $moreforfilter .= $langs->trans('CustomersProspectsCategoriesShort').': '; |
|
641 | + $moreforfilter .= $formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1, $langs->trans('CustomersProspectsCategoriesShort')); |
|
642 | + $moreforfilter .= '</div>'; |
|
643 | 643 | } |
644 | 644 | } |
645 | 645 | if (empty($type) || $type == 'f') |
646 | 646 | { |
647 | - if (! empty($conf->categorie->enabled)) |
|
647 | + if (!empty($conf->categorie->enabled)) |
|
648 | 648 | { |
649 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
650 | - $moreforfilter.='<div class="divsearchfield">'; |
|
651 | - $moreforfilter.=$langs->trans('SuppliersCategoriesShort').': '; |
|
652 | - $moreforfilter.=$formother->select_categories('supplier',$search_categ_sup,'search_categ_sup',1); |
|
653 | - $moreforfilter.='</div>'; |
|
649 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
650 | + $moreforfilter .= '<div class="divsearchfield">'; |
|
651 | + $moreforfilter .= $langs->trans('SuppliersCategoriesShort').': '; |
|
652 | + $moreforfilter .= $formother->select_categories('supplier', $search_categ_sup, 'search_categ_sup', 1); |
|
653 | + $moreforfilter .= '</div>'; |
|
654 | 654 | } |
655 | 655 | } |
656 | 656 | |
657 | 657 | // If the user can view prospects other than his' |
658 | 658 | if ($user->rights->societe->client->voir || $socid) |
659 | 659 | { |
660 | - $moreforfilter.='<div class="divsearchfield">'; |
|
661 | - $moreforfilter.=$langs->trans('SalesRepresentatives'). ': '; |
|
662 | - $moreforfilter.=$formother->select_salesrepresentatives($search_sale,'search_sale',$user, 0, 1, 'maxwidth300'); |
|
663 | - $moreforfilter.='</div>'; |
|
660 | + $moreforfilter .= '<div class="divsearchfield">'; |
|
661 | + $moreforfilter .= $langs->trans('SalesRepresentatives').': '; |
|
662 | + $moreforfilter .= $formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, 1, 'maxwidth300'); |
|
663 | + $moreforfilter .= '</div>'; |
|
664 | 664 | } |
665 | 665 | if ($moreforfilter) |
666 | 666 | { |
667 | 667 | print '<div class="liste_titre liste_titre_bydiv centpercent">'; |
668 | 668 | print $moreforfilter; |
669 | - $parameters=array('type'=>$type); |
|
670 | - $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook |
|
669 | + $parameters = array('type'=>$type); |
|
670 | + $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook |
|
671 | 671 | print $hookmanager->resPrint; |
672 | 672 | print '</div>'; |
673 | 673 | } |
674 | 674 | |
675 | -$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; |
|
676 | -$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields |
|
677 | -if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); |
|
675 | +$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; |
|
676 | +$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields |
|
677 | +if ($massactionbutton) $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); |
|
678 | 678 | |
679 | 679 | if (empty($arrayfields['customerorsupplier']['checked'])) print '<input type="hidden" name="type" value="'.$type.'">'; |
680 | 680 | |
681 | 681 | print '<div class="div-table-responsive">'; |
682 | -print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n"; |
|
682 | +print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n"; |
|
683 | 683 | |
684 | 684 | // Fields title search |
685 | 685 | print '<tr class="liste_titre_filter">'; |
686 | -if (! empty($arrayfields['s.rowid']['checked'])) |
|
686 | +if (!empty($arrayfields['s.rowid']['checked'])) |
|
687 | 687 | { |
688 | 688 | print '<td class="liste_titre">'; |
689 | 689 | print '<input class="flat searchstring" type="text" name="search_id" size="1" value="'.dol_escape_htmltag($search_id).'">'; |
690 | 690 | print '</td>'; |
691 | 691 | } |
692 | -if (! empty($arrayfields['s.nom']['checked'])) |
|
692 | +if (!empty($arrayfields['s.nom']['checked'])) |
|
693 | 693 | { |
694 | 694 | print '<td class="liste_titre">'; |
695 | - if (! empty($search_nom_only) && empty($search_nom)) $search_nom=$search_nom_only; |
|
695 | + if (!empty($search_nom_only) && empty($search_nom)) $search_nom = $search_nom_only; |
|
696 | 696 | print '<input class="flat searchstring" type="text" name="search_nom" size="8" value="'.dol_escape_htmltag($search_nom).'">'; |
697 | 697 | print '</td>'; |
698 | 698 | } |
699 | -if (! empty($arrayfields['s.name_alias']['checked'])) |
|
699 | +if (!empty($arrayfields['s.name_alias']['checked'])) |
|
700 | 700 | { |
701 | 701 | print '<td class="liste_titre">'; |
702 | 702 | print '<input class="flat searchstring" type="text" name="search_alias" size="8" value="'.dol_escape_htmltag($search_alias).'">'; |
703 | 703 | print '</td>'; |
704 | 704 | } |
705 | 705 | // Barcode |
706 | -if (! empty($arrayfields['s.barcode']['checked'])) |
|
706 | +if (!empty($arrayfields['s.barcode']['checked'])) |
|
707 | 707 | { |
708 | 708 | print '<td class="liste_titre">'; |
709 | 709 | print '<input class="flat searchstring" type="text" name="search_barcode" size="6" value="'.dol_escape_htmltag($search_barcode).'">'; |
710 | 710 | print '</td>'; |
711 | 711 | } |
712 | 712 | // Customer code |
713 | -if (! empty($arrayfields['s.code_client']['checked'])) |
|
713 | +if (!empty($arrayfields['s.code_client']['checked'])) |
|
714 | 714 | { |
715 | 715 | print '<td class="liste_titre">'; |
716 | 716 | print '<input class="flat searchstring" size="8" type="text" name="search_customer_code" value="'.dol_escape_htmltag($search_customer_code).'">'; |
717 | 717 | print '</td>'; |
718 | 718 | } |
719 | 719 | // Supplier code |
720 | -if (! empty($arrayfields['s.code_fournisseur']['checked'])) |
|
720 | +if (!empty($arrayfields['s.code_fournisseur']['checked'])) |
|
721 | 721 | { |
722 | 722 | print '<td class="liste_titre">'; |
723 | 723 | print '<input class="flat searchstring" size="8" type="text" name="search_supplier_code" value="'.dol_escape_htmltag($search_supplier_code).'">'; |
724 | 724 | print '</td>'; |
725 | 725 | } |
726 | 726 | // Account Customer code |
727 | -if (! empty($arrayfields['s.code_compta']['checked'])) |
|
727 | +if (!empty($arrayfields['s.code_compta']['checked'])) |
|
728 | 728 | { |
729 | 729 | print '<td class="liste_titre">'; |
730 | 730 | print '<input class="flat searchstring" size="8" type="text" name="search_account_customer_code" value="'.dol_escape_htmltag($search_account_customer_code).'">'; |
731 | 731 | print '</td>'; |
732 | 732 | } |
733 | 733 | // Account Supplier code |
734 | -if (! empty($arrayfields['s.code_compta_fournisseur']['checked'])) |
|
734 | +if (!empty($arrayfields['s.code_compta_fournisseur']['checked'])) |
|
735 | 735 | { |
736 | 736 | print '<td class="liste_titre">'; |
737 | 737 | print '<input class="flat" size="8" type="text" name="search_account_supplier_code" value="'.dol_escape_htmltag($search_account_supplier_code).'">'; |
738 | 738 | print '</td>'; |
739 | 739 | } |
740 | 740 | // Town |
741 | -if (! empty($arrayfields['s.town']['checked'])) |
|
741 | +if (!empty($arrayfields['s.town']['checked'])) |
|
742 | 742 | { |
743 | 743 | print '<td class="liste_titre">'; |
744 | 744 | print '<input class="flat searchstring" size="6" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).'">'; |
745 | 745 | print '</td>'; |
746 | 746 | } |
747 | 747 | // Zip |
748 | -if (! empty($arrayfields['s.zip']['checked'])) |
|
748 | +if (!empty($arrayfields['s.zip']['checked'])) |
|
749 | 749 | { |
750 | 750 | print '<td class="liste_titre">'; |
751 | 751 | print '<input class="flat searchstring" size="4" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).'">'; |
752 | 752 | print '</td>'; |
753 | 753 | } |
754 | 754 | // State |
755 | -if (! empty($arrayfields['state.nom']['checked'])) |
|
755 | +if (!empty($arrayfields['state.nom']['checked'])) |
|
756 | 756 | { |
757 | 757 | print '<td class="liste_titre">'; |
758 | 758 | print '<input class="flat searchstring" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">'; |
759 | 759 | print '</td>'; |
760 | 760 | } |
761 | 761 | // Region |
762 | -if (! empty($arrayfields['region.nom']['checked'])) |
|
762 | +if (!empty($arrayfields['region.nom']['checked'])) |
|
763 | 763 | { |
764 | 764 | print '<td class="liste_titre">'; |
765 | 765 | print '<input class="flat searchstring" size="4" type="text" name="search_region" value="'.dol_escape_htmltag($search_region).'">'; |
766 | 766 | print '</td>'; |
767 | 767 | } |
768 | 768 | // Country |
769 | -if (! empty($arrayfields['country.code_iso']['checked'])) |
|
769 | +if (!empty($arrayfields['country.code_iso']['checked'])) |
|
770 | 770 | { |
771 | 771 | print '<td class="liste_titre" align="center">'; |
772 | - print $form->select_country($search_country,'search_country','',0,'maxwidth100'); |
|
772 | + print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth100'); |
|
773 | 773 | print '</td>'; |
774 | 774 | } |
775 | 775 | // Company type |
776 | -if (! empty($arrayfields['typent.code']['checked'])) |
|
776 | +if (!empty($arrayfields['typent.code']['checked'])) |
|
777 | 777 | { |
778 | 778 | print '<td class="liste_titre maxwidthonsmartphone" align="center">'; |
779 | - print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT)); |
|
779 | + print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT)); |
|
780 | 780 | print '</td>'; |
781 | 781 | } |
782 | -if (! empty($arrayfields['s.email']['checked'])) |
|
782 | +if (!empty($arrayfields['s.email']['checked'])) |
|
783 | 783 | { |
784 | 784 | |
785 | 785 | print '<td class="liste_titre">'; |
786 | 786 | print '<input class="flat searchemail" size="4" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).'">'; |
787 | 787 | print '</td>'; |
788 | 788 | } |
789 | -if (! empty($arrayfields['s.phone']['checked'])) |
|
789 | +if (!empty($arrayfields['s.phone']['checked'])) |
|
790 | 790 | { |
791 | 791 | // Phone |
792 | 792 | print '<td class="liste_titre">'; |
793 | 793 | print '<input class="flat searchstring" size="4" type="text" name="search_phone" value="'.dol_escape_htmltag($search_phone).'">'; |
794 | 794 | print '</td>'; |
795 | 795 | } |
796 | -if (! empty($arrayfields['s.url']['checked'])) |
|
796 | +if (!empty($arrayfields['s.url']['checked'])) |
|
797 | 797 | { |
798 | 798 | // Url |
799 | 799 | print '<td class="liste_titre">'; |
800 | 800 | print '<input class="flat searchstring" size="4" type="text" name="search_url" value="'.dol_escape_htmltag($search_url).'">'; |
801 | 801 | print '</td>'; |
802 | 802 | } |
803 | -if (! empty($arrayfields['s.siren']['checked'])) |
|
803 | +if (!empty($arrayfields['s.siren']['checked'])) |
|
804 | 804 | { |
805 | 805 | // IdProf1 |
806 | 806 | print '<td class="liste_titre">'; |
807 | 807 | print '<input class="flat searchstring" size="4" type="text" name="search_idprof1" value="'.dol_escape_htmltag($search_idprof1).'">'; |
808 | 808 | print '</td>'; |
809 | 809 | } |
810 | -if (! empty($arrayfields['s.siret']['checked'])) |
|
810 | +if (!empty($arrayfields['s.siret']['checked'])) |
|
811 | 811 | { |
812 | 812 | // IdProf2 |
813 | 813 | print '<td class="liste_titre">'; |
814 | 814 | print '<input class="flat searchstring" size="4" type="text" name="search_idprof2" value="'.dol_escape_htmltag($search_idprof2).'">'; |
815 | 815 | print '</td>'; |
816 | 816 | } |
817 | -if (! empty($arrayfields['s.ape']['checked'])) |
|
817 | +if (!empty($arrayfields['s.ape']['checked'])) |
|
818 | 818 | { |
819 | 819 | // IdProf3 |
820 | 820 | print '<td class="liste_titre">'; |
821 | 821 | print '<input class="flat searchstring" size="4" type="text" name="search_idprof3" value="'.dol_escape_htmltag($search_idprof3).'">'; |
822 | 822 | print '</td>'; |
823 | 823 | } |
824 | -if (! empty($arrayfields['s.idprof4']['checked'])) |
|
824 | +if (!empty($arrayfields['s.idprof4']['checked'])) |
|
825 | 825 | { |
826 | 826 | // IdProf4 |
827 | 827 | print '<td class="liste_titre">'; |
828 | 828 | print '<input class="flat searchstring" size="4" type="text" name="search_idprof4" value="'.dol_escape_htmltag($search_idprof4).'">'; |
829 | 829 | print '</td>'; |
830 | 830 | } |
831 | -if (! empty($arrayfields['s.idprof5']['checked'])) |
|
831 | +if (!empty($arrayfields['s.idprof5']['checked'])) |
|
832 | 832 | { |
833 | 833 | // IdProf5 |
834 | 834 | print '<td class="liste_titre">'; |
835 | 835 | print '<input class="flat searchstring" size="4" type="text" name="search_idprof5" value="'.dol_escape_htmltag($search_idprof5).'">'; |
836 | 836 | print '</td>'; |
837 | 837 | } |
838 | -if (! empty($arrayfields['s.idprof6']['checked'])) |
|
838 | +if (!empty($arrayfields['s.idprof6']['checked'])) |
|
839 | 839 | { |
840 | 840 | // IdProf6 |
841 | 841 | print '<td class="liste_titre">'; |
842 | 842 | print '<input class="flat searchstring" size="4" type="text" name="search_idprof6" value="'.dol_escape_htmltag($search_idprof6).'">'; |
843 | 843 | print '</td>'; |
844 | 844 | } |
845 | -if (! empty($arrayfields['s.tva_intra']['checked'])) |
|
845 | +if (!empty($arrayfields['s.tva_intra']['checked'])) |
|
846 | 846 | { |
847 | 847 | // Vat number |
848 | 848 | print '<td class="liste_titre">'; |
@@ -851,35 +851,35 @@ discard block |
||
851 | 851 | } |
852 | 852 | |
853 | 853 | // Type (customer/prospect/supplier) |
854 | -if (! empty($arrayfields['customerorsupplier']['checked'])) |
|
854 | +if (!empty($arrayfields['customerorsupplier']['checked'])) |
|
855 | 855 | { |
856 | 856 | print '<td class="liste_titre maxwidthonsmartphone" align="middle">'; |
857 | 857 | if ($type != '') print '<input type="hidden" name="type" value="'.$type.'">'; |
858 | 858 | print '<select class="flat" name="search_type">'; |
859 | - print '<option value="-1"'.($search_type==''?' selected':'').'> </option>'; |
|
860 | - if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) print '<option value="1,3"'.($search_type=='1,3'?' selected':'').'>'.$langs->trans('Customer').'</option>'; |
|
861 | - if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) print '<option value="2,3"'.($search_type=='2,3'?' selected':'').'>'.$langs->trans('Prospect').'</option>'; |
|
859 | + print '<option value="-1"'.($search_type == '' ? ' selected' : '').'> </option>'; |
|
860 | + if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) print '<option value="1,3"'.($search_type == '1,3' ? ' selected' : '').'>'.$langs->trans('Customer').'</option>'; |
|
861 | + if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) print '<option value="2,3"'.($search_type == '2,3' ? ' selected' : '').'>'.$langs->trans('Prospect').'</option>'; |
|
862 | 862 | //if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) print '<option value="3"'.($search_type=='3'?' selected':'').'>'.$langs->trans('ProspectCustomer').'</option>'; |
863 | - print '<option value="4"'.($search_type=='4'?' selected':'').'>'.$langs->trans('Supplier').'</option>'; |
|
864 | - print '<option value="0"'.($search_type=='0'?' selected':'').'>'.$langs->trans('Others').'</option>'; |
|
863 | + print '<option value="4"'.($search_type == '4' ? ' selected' : '').'>'.$langs->trans('Supplier').'</option>'; |
|
864 | + print '<option value="0"'.($search_type == '0' ? ' selected' : '').'>'.$langs->trans('Others').'</option>'; |
|
865 | 865 | print '</select></td>'; |
866 | 866 | } |
867 | -if (! empty($arrayfields['s.fk_prospectlevel']['checked'])) |
|
867 | +if (!empty($arrayfields['s.fk_prospectlevel']['checked'])) |
|
868 | 868 | { |
869 | 869 | // Prospect level |
870 | 870 | print '<td class="liste_titre" align="center">'; |
871 | - $options_from = '<option value=""> </option>'; // Generate in $options_from the list of each option sorted |
|
871 | + $options_from = '<option value=""> </option>'; // Generate in $options_from the list of each option sorted |
|
872 | 872 | foreach ($tab_level as $tab_level_sortorder => $tab_level_label) |
873 | 873 | { |
874 | - $options_from .= '<option value="'.$tab_level_sortorder.'"'.($search_level_from == $tab_level_sortorder ? ' selected':'').'>'; |
|
874 | + $options_from .= '<option value="'.$tab_level_sortorder.'"'.($search_level_from == $tab_level_sortorder ? ' selected' : '').'>'; |
|
875 | 875 | $options_from .= $langs->trans($tab_level_label); |
876 | 876 | $options_from .= '</option>'; |
877 | 877 | } |
878 | - array_reverse($tab_level, true); // Reverse the list |
|
879 | - $options_to = '<option value=""> </option>'; // Generate in $options_to the list of each option sorted in the reversed order |
|
878 | + array_reverse($tab_level, true); // Reverse the list |
|
879 | + $options_to = '<option value=""> </option>'; // Generate in $options_to the list of each option sorted in the reversed order |
|
880 | 880 | foreach ($tab_level as $tab_level_sortorder => $tab_level_label) |
881 | 881 | { |
882 | - $options_to .= '<option value="'.$tab_level_sortorder.'"'.($search_level_to == $tab_level_sortorder ? ' selected':'').'>'; |
|
882 | + $options_to .= '<option value="'.$tab_level_sortorder.'"'.($search_level_to == $tab_level_sortorder ? ' selected' : '').'>'; |
|
883 | 883 | $options_to .= $langs->trans($tab_level_label); |
884 | 884 | $options_to .= '</option>'; |
885 | 885 | } |
@@ -892,14 +892,14 @@ discard block |
||
892 | 892 | print '</td>'; |
893 | 893 | } |
894 | 894 | |
895 | -if (! empty($arrayfields['s.fk_stcomm']['checked'])) |
|
895 | +if (!empty($arrayfields['s.fk_stcomm']['checked'])) |
|
896 | 896 | { |
897 | 897 | // Prospect status |
898 | 898 | print '<td class="liste_titre maxwidthonsmartphone" align="center">'; |
899 | - $arraystcomm=array(); |
|
900 | - foreach($prospectstatic->cacheprospectstatus as $key => $val) |
|
899 | + $arraystcomm = array(); |
|
900 | + foreach ($prospectstatic->cacheprospectstatus as $key => $val) |
|
901 | 901 | { |
902 | - $arraystcomm[$val['id']]=($langs->trans("StatusProspect".$val['id']) != "StatusProspect".$val['id'] ? $langs->trans("StatusProspect".$val['id']) : $val['label']); |
|
902 | + $arraystcomm[$val['id']] = ($langs->trans("StatusProspect".$val['id']) != "StatusProspect".$val['id'] ? $langs->trans("StatusProspect".$val['id']) : $val['label']); |
|
903 | 903 | } |
904 | 904 | print $form->selectarray('search_stcomm', $arraystcomm, $search_stcomm, -2); |
905 | 905 | print '</td>'; |
@@ -908,29 +908,29 @@ discard block |
||
908 | 908 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; |
909 | 909 | |
910 | 910 | // Fields from hook |
911 | -$parameters=array('arrayfields'=>$arrayfields); |
|
912 | -$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook |
|
911 | +$parameters = array('arrayfields'=>$arrayfields); |
|
912 | +$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook |
|
913 | 913 | print $hookmanager->resPrint; |
914 | 914 | // Date creation |
915 | -if (! empty($arrayfields['s.datec']['checked'])) |
|
915 | +if (!empty($arrayfields['s.datec']['checked'])) |
|
916 | 916 | { |
917 | 917 | print '<td class="liste_titre">'; |
918 | 918 | print '</td>'; |
919 | 919 | } |
920 | 920 | // Date modification |
921 | -if (! empty($arrayfields['s.tms']['checked'])) |
|
921 | +if (!empty($arrayfields['s.tms']['checked'])) |
|
922 | 922 | { |
923 | 923 | print '<td class="liste_titre">'; |
924 | 924 | print '</td>'; |
925 | 925 | } |
926 | 926 | // Status |
927 | -if (! empty($arrayfields['s.status']['checked'])) |
|
927 | +if (!empty($arrayfields['s.status']['checked'])) |
|
928 | 928 | { |
929 | 929 | print '<td class="liste_titre maxwidthonsmartphone center">'; |
930 | - print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')), $search_status, 1); |
|
930 | + print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), $search_status, 1); |
|
931 | 931 | print '</td>'; |
932 | 932 | } |
933 | -if (! empty($arrayfields['s.import_key']['checked'])) |
|
933 | +if (!empty($arrayfields['s.import_key']['checked'])) |
|
934 | 934 | { |
935 | 935 | print '<td class="liste_titre center">'; |
936 | 936 | print '<input class="flat searchstring" type="text" name="search_import_key" size="3" value="'.dol_escape_htmltag($search_import_key).'">'; |
@@ -938,323 +938,323 @@ discard block |
||
938 | 938 | } |
939 | 939 | // Action column |
940 | 940 | print '<td class="liste_titre" align="right">'; |
941 | -$searchpicto=$form->showFilterButtons(); |
|
941 | +$searchpicto = $form->showFilterButtons(); |
|
942 | 942 | print $searchpicto; |
943 | 943 | print '</td>'; |
944 | 944 | |
945 | 945 | print "</tr>\n"; |
946 | 946 | |
947 | 947 | print '<tr class="liste_titre">'; |
948 | -if (! empty($arrayfields['s.rowid']['checked'])) print_liste_field_titre($arrayfields['s.rowid']['label'], $_SERVER["PHP_SELF"],"s.rowid","",$param,"",$sortfield,$sortorder); |
|
949 | -if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder); |
|
950 | -if (! empty($arrayfields['s.name_alias']['checked'])) print_liste_field_titre($arrayfields['s.name_alias']['label'], $_SERVER["PHP_SELF"],"s.name_alias","",$param,"",$sortfield,$sortorder); |
|
951 | -if (! empty($arrayfields['s.barcode']['checked'])) print_liste_field_titre($arrayfields['s.barcode']['label'], $_SERVER["PHP_SELF"], "s.barcode",$param,'','',$sortfield,$sortorder); |
|
952 | -if (! empty($arrayfields['s.code_client']['checked'])) print_liste_field_titre($arrayfields['s.code_client']['label'],$_SERVER["PHP_SELF"],"s.code_client","",$param,'',$sortfield,$sortorder); |
|
953 | -if (! empty($arrayfields['s.code_fournisseur']['checked'])) print_liste_field_titre($arrayfields['s.code_fournisseur']['label'],$_SERVER["PHP_SELF"],"s.code_fournisseur","",$param,'',$sortfield,$sortorder); |
|
954 | -if (! empty($arrayfields['s.code_compta']['checked'])) print_liste_field_titre($arrayfields['s.code_compta']['label'],$_SERVER["PHP_SELF"],"s.code_compta","",$param,'',$sortfield,$sortorder); |
|
955 | -if (! empty($arrayfields['s.code_compta_fournisseur']['checked'])) print_liste_field_titre($arrayfields['s.code_compta_fournisseur']['label'],$_SERVER["PHP_SELF"],"s.code_compta_fournisseur","",$param,'',$sortfield,$sortorder); |
|
956 | -if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'],$_SERVER["PHP_SELF"],"s.town","",$param,'',$sortfield,$sortorder); |
|
957 | -if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'],$_SERVER["PHP_SELF"],"s.zip","",$param,'',$sortfield,$sortorder); |
|
958 | -if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'],$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder); |
|
959 | -if (! empty($arrayfields['region.nom']['checked'])) print_liste_field_titre($arrayfields['region.nom']['label'],$_SERVER["PHP_SELF"],"region.nom","",$param,'',$sortfield,$sortorder); |
|
960 | -if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'],$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder); |
|
961 | -if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'],$_SERVER["PHP_SELF"],"typent.code","",$param,'align="center"',$sortfield,$sortorder); |
|
962 | -if (! empty($arrayfields['s.email']['checked'])) print_liste_field_titre($arrayfields['s.email']['label'],$_SERVER["PHP_SELF"],"s.email","",$param,'',$sortfield,$sortorder); |
|
963 | -if (! empty($arrayfields['s.phone']['checked'])) print_liste_field_titre($arrayfields['s.phone']['label'],$_SERVER["PHP_SELF"],"s.phone","",$param,'',$sortfield,$sortorder); |
|
964 | -if (! empty($arrayfields['s.url']['checked'])) print_liste_field_titre($arrayfields['s.url']['label'],$_SERVER["PHP_SELF"],"s.url","",$param,'',$sortfield,$sortorder); |
|
965 | -if (! empty($arrayfields['s.siren']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId1Short"),$textprofid[1],1,0),$_SERVER["PHP_SELF"],"s.siren","",$param,'class="nowrap"',$sortfield,$sortorder); |
|
966 | -if (! empty($arrayfields['s.siret']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId2Short"),$textprofid[2],1,0),$_SERVER["PHP_SELF"],"s.siret","",$param,'class="nowrap"',$sortfield,$sortorder); |
|
967 | -if (! empty($arrayfields['s.ape']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId3Short"),$textprofid[3],1,0),$_SERVER["PHP_SELF"],"s.ape","",$param,'class="nowrap"',$sortfield,$sortorder); |
|
968 | -if (! empty($arrayfields['s.idprof4']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId4Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof4","",$param,'class="nowrap"',$sortfield,$sortorder); |
|
969 | -if (! empty($arrayfields['s.idprof5']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId5Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof5","",$param,'class="nowrap"',$sortfield,$sortorder); |
|
970 | -if (! empty($arrayfields['s.idprof6']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId6Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof6","",$param,'class="nowrap"',$sortfield,$sortorder); |
|
971 | -if (! empty($arrayfields['s.tva_intra']['checked'])) print_liste_field_titre($arrayfields['s.tva_intra']['label'],$_SERVER["PHP_SELF"],"s.tva_intra","",$param,'class="nowrap"',$sortfield,$sortorder); |
|
972 | -if (! empty($arrayfields['customerorsupplier']['checked'])) print_liste_field_titre(''); // type of customer |
|
973 | -if (! empty($arrayfields['s.fk_prospectlevel']['checked'])) print_liste_field_titre($arrayfields['s.fk_prospectlevel']['label'],$_SERVER["PHP_SELF"],"s.fk_prospectlevel","",$param,'align="center"',$sortfield,$sortorder); |
|
974 | -if (! empty($arrayfields['s.fk_stcomm']['checked'])) print_liste_field_titre($arrayfields['s.fk_stcomm']['label'],$_SERVER["PHP_SELF"],"s.fk_stcomm","",$param,'align="center"',$sortfield,$sortorder); |
|
948 | +if (!empty($arrayfields['s.rowid']['checked'])) print_liste_field_titre($arrayfields['s.rowid']['label'], $_SERVER["PHP_SELF"], "s.rowid", "", $param, "", $sortfield, $sortorder); |
|
949 | +if (!empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, "", $sortfield, $sortorder); |
|
950 | +if (!empty($arrayfields['s.name_alias']['checked'])) print_liste_field_titre($arrayfields['s.name_alias']['label'], $_SERVER["PHP_SELF"], "s.name_alias", "", $param, "", $sortfield, $sortorder); |
|
951 | +if (!empty($arrayfields['s.barcode']['checked'])) print_liste_field_titre($arrayfields['s.barcode']['label'], $_SERVER["PHP_SELF"], "s.barcode", $param, '', '', $sortfield, $sortorder); |
|
952 | +if (!empty($arrayfields['s.code_client']['checked'])) print_liste_field_titre($arrayfields['s.code_client']['label'], $_SERVER["PHP_SELF"], "s.code_client", "", $param, '', $sortfield, $sortorder); |
|
953 | +if (!empty($arrayfields['s.code_fournisseur']['checked'])) print_liste_field_titre($arrayfields['s.code_fournisseur']['label'], $_SERVER["PHP_SELF"], "s.code_fournisseur", "", $param, '', $sortfield, $sortorder); |
|
954 | +if (!empty($arrayfields['s.code_compta']['checked'])) print_liste_field_titre($arrayfields['s.code_compta']['label'], $_SERVER["PHP_SELF"], "s.code_compta", "", $param, '', $sortfield, $sortorder); |
|
955 | +if (!empty($arrayfields['s.code_compta_fournisseur']['checked'])) print_liste_field_titre($arrayfields['s.code_compta_fournisseur']['label'], $_SERVER["PHP_SELF"], "s.code_compta_fournisseur", "", $param, '', $sortfield, $sortorder); |
|
956 | +if (!empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], "s.town", "", $param, '', $sortfield, $sortorder); |
|
957 | +if (!empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], "s.zip", "", $param, '', $sortfield, $sortorder); |
|
958 | +if (!empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder); |
|
959 | +if (!empty($arrayfields['region.nom']['checked'])) print_liste_field_titre($arrayfields['region.nom']['label'], $_SERVER["PHP_SELF"], "region.nom", "", $param, '', $sortfield, $sortorder); |
|
960 | +if (!empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, 'align="center"', $sortfield, $sortorder); |
|
961 | +if (!empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, 'align="center"', $sortfield, $sortorder); |
|
962 | +if (!empty($arrayfields['s.email']['checked'])) print_liste_field_titre($arrayfields['s.email']['label'], $_SERVER["PHP_SELF"], "s.email", "", $param, '', $sortfield, $sortorder); |
|
963 | +if (!empty($arrayfields['s.phone']['checked'])) print_liste_field_titre($arrayfields['s.phone']['label'], $_SERVER["PHP_SELF"], "s.phone", "", $param, '', $sortfield, $sortorder); |
|
964 | +if (!empty($arrayfields['s.url']['checked'])) print_liste_field_titre($arrayfields['s.url']['label'], $_SERVER["PHP_SELF"], "s.url", "", $param, '', $sortfield, $sortorder); |
|
965 | +if (!empty($arrayfields['s.siren']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId1Short"), $textprofid[1], 1, 0), $_SERVER["PHP_SELF"], "s.siren", "", $param, 'class="nowrap"', $sortfield, $sortorder); |
|
966 | +if (!empty($arrayfields['s.siret']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId2Short"), $textprofid[2], 1, 0), $_SERVER["PHP_SELF"], "s.siret", "", $param, 'class="nowrap"', $sortfield, $sortorder); |
|
967 | +if (!empty($arrayfields['s.ape']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId3Short"), $textprofid[3], 1, 0), $_SERVER["PHP_SELF"], "s.ape", "", $param, 'class="nowrap"', $sortfield, $sortorder); |
|
968 | +if (!empty($arrayfields['s.idprof4']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId4Short"), $textprofid[4], 1, 0), $_SERVER["PHP_SELF"], "s.idprof4", "", $param, 'class="nowrap"', $sortfield, $sortorder); |
|
969 | +if (!empty($arrayfields['s.idprof5']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId5Short"), $textprofid[4], 1, 0), $_SERVER["PHP_SELF"], "s.idprof5", "", $param, 'class="nowrap"', $sortfield, $sortorder); |
|
970 | +if (!empty($arrayfields['s.idprof6']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId6Short"), $textprofid[4], 1, 0), $_SERVER["PHP_SELF"], "s.idprof6", "", $param, 'class="nowrap"', $sortfield, $sortorder); |
|
971 | +if (!empty($arrayfields['s.tva_intra']['checked'])) print_liste_field_titre($arrayfields['s.tva_intra']['label'], $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, 'class="nowrap"', $sortfield, $sortorder); |
|
972 | +if (!empty($arrayfields['customerorsupplier']['checked'])) print_liste_field_titre(''); // type of customer |
|
973 | +if (!empty($arrayfields['s.fk_prospectlevel']['checked'])) print_liste_field_titre($arrayfields['s.fk_prospectlevel']['label'], $_SERVER["PHP_SELF"], "s.fk_prospectlevel", "", $param, 'align="center"', $sortfield, $sortorder); |
|
974 | +if (!empty($arrayfields['s.fk_stcomm']['checked'])) print_liste_field_titre($arrayfields['s.fk_stcomm']['label'], $_SERVER["PHP_SELF"], "s.fk_stcomm", "", $param, 'align="center"', $sortfield, $sortorder); |
|
975 | 975 | // Extra fields |
976 | 976 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; |
977 | 977 | // Hook fields |
978 | -$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); |
|
979 | -$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook |
|
978 | +$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); |
|
979 | +$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook |
|
980 | 980 | print $hookmanager->resPrint; |
981 | -if (! empty($arrayfields['s.datec']['checked'])) print_liste_field_titre($arrayfields['s.datec']['label'],$_SERVER["PHP_SELF"],"s.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); |
|
982 | -if (! empty($arrayfields['s.tms']['checked'])) print_liste_field_titre($arrayfields['s.tms']['label'],$_SERVER["PHP_SELF"],"s.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); |
|
983 | -if (! empty($arrayfields['s.status']['checked'])) print_liste_field_titre($arrayfields['s.status']['label'],$_SERVER["PHP_SELF"],"s.status","",$param,'align="center"',$sortfield,$sortorder); |
|
984 | -if (! empty($arrayfields['s.import_key']['checked'])) print_liste_field_titre($arrayfields['s.import_key']['label'],$_SERVER["PHP_SELF"],"s.import_key","",$param,'align="center"',$sortfield,$sortorder); |
|
985 | -print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); |
|
981 | +if (!empty($arrayfields['s.datec']['checked'])) print_liste_field_titre($arrayfields['s.datec']['label'], $_SERVER["PHP_SELF"], "s.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); |
|
982 | +if (!empty($arrayfields['s.tms']['checked'])) print_liste_field_titre($arrayfields['s.tms']['label'], $_SERVER["PHP_SELF"], "s.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); |
|
983 | +if (!empty($arrayfields['s.status']['checked'])) print_liste_field_titre($arrayfields['s.status']['label'], $_SERVER["PHP_SELF"], "s.status", "", $param, 'align="center"', $sortfield, $sortorder); |
|
984 | +if (!empty($arrayfields['s.import_key']['checked'])) print_liste_field_titre($arrayfields['s.import_key']['label'], $_SERVER["PHP_SELF"], "s.import_key", "", $param, 'align="center"', $sortfield, $sortorder); |
|
985 | +print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); |
|
986 | 986 | print "</tr>\n"; |
987 | 987 | |
988 | 988 | |
989 | 989 | $i = 0; |
990 | -$totalarray=array(); |
|
990 | +$totalarray = array(); |
|
991 | 991 | while ($i < min($num, $limit)) |
992 | 992 | { |
993 | 993 | $obj = $db->fetch_object($resql); |
994 | 994 | |
995 | - $companystatic->id=$obj->rowid; |
|
996 | - $companystatic->name=$obj->name; |
|
997 | - $companystatic->name_alias=$obj->name_alias; |
|
998 | - $companystatic->logo=$obj->logo; |
|
999 | - $companystatic->canvas=$obj->canvas; |
|
1000 | - $companystatic->client=$obj->client; |
|
1001 | - $companystatic->status=$obj->status; |
|
1002 | - $companystatic->email=$obj->email; |
|
1003 | - $companystatic->fournisseur=$obj->fournisseur; |
|
1004 | - $companystatic->code_client=$obj->code_client; |
|
1005 | - $companystatic->code_fournisseur=$obj->code_fournisseur; |
|
995 | + $companystatic->id = $obj->rowid; |
|
996 | + $companystatic->name = $obj->name; |
|
997 | + $companystatic->name_alias = $obj->name_alias; |
|
998 | + $companystatic->logo = $obj->logo; |
|
999 | + $companystatic->canvas = $obj->canvas; |
|
1000 | + $companystatic->client = $obj->client; |
|
1001 | + $companystatic->status = $obj->status; |
|
1002 | + $companystatic->email = $obj->email; |
|
1003 | + $companystatic->fournisseur = $obj->fournisseur; |
|
1004 | + $companystatic->code_client = $obj->code_client; |
|
1005 | + $companystatic->code_fournisseur = $obj->code_fournisseur; |
|
1006 | 1006 | |
1007 | - $companystatic->code_compta_client=$obj->code_compta; |
|
1008 | - $companystatic->code_compta_fournisseur=$obj->code_compta_fournisseur; |
|
1007 | + $companystatic->code_compta_client = $obj->code_compta; |
|
1008 | + $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur; |
|
1009 | 1009 | |
1010 | - $companystatic->fk_prospectlevel=$obj->fk_prospectlevel; |
|
1010 | + $companystatic->fk_prospectlevel = $obj->fk_prospectlevel; |
|
1011 | 1011 | |
1012 | 1012 | print '<tr class="oddeven" onclick="location.href=\'customers.php?action=change&idcustomer='.$obj->rowid.'&place='.$place.'\'">'; |
1013 | - if (! empty($arrayfields['s.rowid']['checked'])) |
|
1013 | + if (!empty($arrayfields['s.rowid']['checked'])) |
|
1014 | 1014 | { |
1015 | 1015 | print '<td class="tdoverflowmax50">'; |
1016 | 1016 | print $obj->rowid; |
1017 | 1017 | print "</td>\n"; |
1018 | - if (! $i) $totalarray['nbfield']++; |
|
1018 | + if (!$i) $totalarray['nbfield']++; |
|
1019 | 1019 | } |
1020 | - if (! empty($arrayfields['s.nom']['checked'])) |
|
1020 | + if (!empty($arrayfields['s.nom']['checked'])) |
|
1021 | 1021 | { |
1022 | 1022 | $savalias = $obj->name_alias; |
1023 | - if (! empty($arrayfields['s.name_alias']['checked'])) $companystatic->name_alias=''; |
|
1023 | + if (!empty($arrayfields['s.name_alias']['checked'])) $companystatic->name_alias = ''; |
|
1024 | 1024 | print '<td class="tdoverflowmax200">'; |
1025 | 1025 | print $obj->name; |
1026 | 1026 | print "</td>\n"; |
1027 | - if (! $i) $totalarray['nbfield']++; |
|
1027 | + if (!$i) $totalarray['nbfield']++; |
|
1028 | 1028 | } |
1029 | - if (! empty($arrayfields['s.name_alias']['checked'])) |
|
1029 | + if (!empty($arrayfields['s.name_alias']['checked'])) |
|
1030 | 1030 | { |
1031 | 1031 | print '<td class="tdoverflowmax200">'; |
1032 | 1032 | print $companystatic->name_alias; |
1033 | 1033 | print "</td>\n"; |
1034 | - if (! $i) $totalarray['nbfield']++; |
|
1034 | + if (!$i) $totalarray['nbfield']++; |
|
1035 | 1035 | } |
1036 | 1036 | // Barcode |
1037 | - if (! empty($arrayfields['s.barcode']['checked'])) |
|
1037 | + if (!empty($arrayfields['s.barcode']['checked'])) |
|
1038 | 1038 | { |
1039 | 1039 | print '<td>'.$obj->barcode.'</td>'; |
1040 | - if (! $i) $totalarray['nbfield']++; |
|
1040 | + if (!$i) $totalarray['nbfield']++; |
|
1041 | 1041 | } |
1042 | 1042 | // Customer code |
1043 | - if (! empty($arrayfields['s.code_client']['checked'])) |
|
1043 | + if (!empty($arrayfields['s.code_client']['checked'])) |
|
1044 | 1044 | { |
1045 | 1045 | print '<td>'.$obj->code_client.'</td>'; |
1046 | - if (! $i) $totalarray['nbfield']++; |
|
1046 | + if (!$i) $totalarray['nbfield']++; |
|
1047 | 1047 | } |
1048 | 1048 | // Supplier code |
1049 | - if (! empty($arrayfields['s.code_fournisseur']['checked'])) |
|
1049 | + if (!empty($arrayfields['s.code_fournisseur']['checked'])) |
|
1050 | 1050 | { |
1051 | 1051 | print '<td>'.$obj->code_fournisseur.'</td>'; |
1052 | - if (! $i) $totalarray['nbfield']++; |
|
1052 | + if (!$i) $totalarray['nbfield']++; |
|
1053 | 1053 | } |
1054 | 1054 | // Account customer code |
1055 | - if (! empty($arrayfields['s.code_compta']['checked'])) |
|
1055 | + if (!empty($arrayfields['s.code_compta']['checked'])) |
|
1056 | 1056 | { |
1057 | 1057 | print '<td>'.$obj->code_compta.'</td>'; |
1058 | - if (! $i) $totalarray['nbfield']++; |
|
1058 | + if (!$i) $totalarray['nbfield']++; |
|
1059 | 1059 | } |
1060 | 1060 | // Account supplier code |
1061 | - if (! empty($arrayfields['s.code_compta_fournisseur']['checked'])) |
|
1061 | + if (!empty($arrayfields['s.code_compta_fournisseur']['checked'])) |
|
1062 | 1062 | { |
1063 | 1063 | print '<td>'.$obj->code_compta_fournisseur.'</td>'; |
1064 | - if (! $i) $totalarray['nbfield']++; |
|
1064 | + if (!$i) $totalarray['nbfield']++; |
|
1065 | 1065 | } |
1066 | 1066 | // Town |
1067 | - if (! empty($arrayfields['s.town']['checked'])) |
|
1067 | + if (!empty($arrayfields['s.town']['checked'])) |
|
1068 | 1068 | { |
1069 | 1069 | print "<td>".$obj->town."</td>\n"; |
1070 | - if (! $i) $totalarray['nbfield']++; |
|
1070 | + if (!$i) $totalarray['nbfield']++; |
|
1071 | 1071 | } |
1072 | 1072 | // Zip |
1073 | - if (! empty($arrayfields['s.zip']['checked'])) |
|
1073 | + if (!empty($arrayfields['s.zip']['checked'])) |
|
1074 | 1074 | { |
1075 | 1075 | print "<td>".$obj->zip."</td>\n"; |
1076 | - if (! $i) $totalarray['nbfield']++; |
|
1076 | + if (!$i) $totalarray['nbfield']++; |
|
1077 | 1077 | } |
1078 | 1078 | // State |
1079 | - if (! empty($arrayfields['state.nom']['checked'])) |
|
1079 | + if (!empty($arrayfields['state.nom']['checked'])) |
|
1080 | 1080 | { |
1081 | 1081 | print "<td>".$obj->state_name."</td>\n"; |
1082 | - if (! $i) $totalarray['nbfield']++; |
|
1082 | + if (!$i) $totalarray['nbfield']++; |
|
1083 | 1083 | } |
1084 | 1084 | // Region |
1085 | - if (! empty($arrayfields['region.nom']['checked'])) |
|
1085 | + if (!empty($arrayfields['region.nom']['checked'])) |
|
1086 | 1086 | { |
1087 | 1087 | print "<td>".$obj->region_name."</td>\n"; |
1088 | - if (! $i) $totalarray['nbfield']++; |
|
1088 | + if (!$i) $totalarray['nbfield']++; |
|
1089 | 1089 | } |
1090 | 1090 | // Country |
1091 | - if (! empty($arrayfields['country.code_iso']['checked'])) |
|
1091 | + if (!empty($arrayfields['country.code_iso']['checked'])) |
|
1092 | 1092 | { |
1093 | 1093 | print '<td align="center">'; |
1094 | - $tmparray=getCountry($obj->fk_pays,'all'); |
|
1094 | + $tmparray = getCountry($obj->fk_pays, 'all'); |
|
1095 | 1095 | print $tmparray['label']; |
1096 | 1096 | print '</td>'; |
1097 | - if (! $i) $totalarray['nbfield']++; |
|
1097 | + if (!$i) $totalarray['nbfield']++; |
|
1098 | 1098 | } |
1099 | 1099 | // Type ent |
1100 | - if (! empty($arrayfields['typent.code']['checked'])) |
|
1100 | + if (!empty($arrayfields['typent.code']['checked'])) |
|
1101 | 1101 | { |
1102 | 1102 | print '<td align="center">'; |
1103 | - if (! is_array($typenArray) || count($typenArray)==0) $typenArray = $formcompany->typent_array(1); |
|
1103 | + if (!is_array($typenArray) || count($typenArray) == 0) $typenArray = $formcompany->typent_array(1); |
|
1104 | 1104 | print $typenArray[$obj->typent_code]; |
1105 | 1105 | print '</td>'; |
1106 | - if (! $i) $totalarray['nbfield']++; |
|
1106 | + if (!$i) $totalarray['nbfield']++; |
|
1107 | 1107 | } |
1108 | - if (! empty($arrayfields['s.email']['checked'])) |
|
1108 | + if (!empty($arrayfields['s.email']['checked'])) |
|
1109 | 1109 | { |
1110 | 1110 | print "<td>".$obj->email."</td>\n"; |
1111 | - if (! $i) $totalarray['nbfield']++; |
|
1111 | + if (!$i) $totalarray['nbfield']++; |
|
1112 | 1112 | } |
1113 | - if (! empty($arrayfields['s.phone']['checked'])) |
|
1113 | + if (!empty($arrayfields['s.phone']['checked'])) |
|
1114 | 1114 | { |
1115 | 1115 | print "<td>".$obj->phone."</td>\n"; |
1116 | - if (! $i) $totalarray['nbfield']++; |
|
1116 | + if (!$i) $totalarray['nbfield']++; |
|
1117 | 1117 | } |
1118 | - if (! empty($arrayfields['s.url']['checked'])) |
|
1118 | + if (!empty($arrayfields['s.url']['checked'])) |
|
1119 | 1119 | { |
1120 | 1120 | print "<td>".$obj->url."</td>\n"; |
1121 | - if (! $i) $totalarray['nbfield']++; |
|
1121 | + if (!$i) $totalarray['nbfield']++; |
|
1122 | 1122 | } |
1123 | - if (! empty($arrayfields['s.siren']['checked'])) |
|
1123 | + if (!empty($arrayfields['s.siren']['checked'])) |
|
1124 | 1124 | { |
1125 | 1125 | print "<td>".$obj->idprof1."</td>\n"; |
1126 | - if (! $i) $totalarray['nbfield']++; |
|
1126 | + if (!$i) $totalarray['nbfield']++; |
|
1127 | 1127 | } |
1128 | - if (! empty($arrayfields['s.siret']['checked'])) |
|
1128 | + if (!empty($arrayfields['s.siret']['checked'])) |
|
1129 | 1129 | { |
1130 | 1130 | print "<td>".$obj->idprof2."</td>\n"; |
1131 | - if (! $i) $totalarray['nbfield']++; |
|
1131 | + if (!$i) $totalarray['nbfield']++; |
|
1132 | 1132 | } |
1133 | - if (! empty($arrayfields['s.ape']['checked'])) |
|
1133 | + if (!empty($arrayfields['s.ape']['checked'])) |
|
1134 | 1134 | { |
1135 | 1135 | print "<td>".$obj->idprof3."</td>\n"; |
1136 | - if (! $i) $totalarray['nbfield']++; |
|
1136 | + if (!$i) $totalarray['nbfield']++; |
|
1137 | 1137 | } |
1138 | - if (! empty($arrayfields['s.idprof4']['checked'])) |
|
1138 | + if (!empty($arrayfields['s.idprof4']['checked'])) |
|
1139 | 1139 | { |
1140 | 1140 | print "<td>".$obj->idprof4."</td>\n"; |
1141 | - if (! $i) $totalarray['nbfield']++; |
|
1141 | + if (!$i) $totalarray['nbfield']++; |
|
1142 | 1142 | } |
1143 | - if (! empty($arrayfields['s.idprof5']['checked'])) |
|
1143 | + if (!empty($arrayfields['s.idprof5']['checked'])) |
|
1144 | 1144 | { |
1145 | 1145 | print "<td>".$obj->idprof5."</td>\n"; |
1146 | - if (! $i) $totalarray['nbfield']++; |
|
1146 | + if (!$i) $totalarray['nbfield']++; |
|
1147 | 1147 | } |
1148 | - if (! empty($arrayfields['s.idprof6']['checked'])) |
|
1148 | + if (!empty($arrayfields['s.idprof6']['checked'])) |
|
1149 | 1149 | { |
1150 | 1150 | print "<td>".$obj->idprof6."</td>\n"; |
1151 | - if (! $i) $totalarray['nbfield']++; |
|
1151 | + if (!$i) $totalarray['nbfield']++; |
|
1152 | 1152 | } |
1153 | - if (! empty($arrayfields['s.tva_intra']['checked'])) |
|
1153 | + if (!empty($arrayfields['s.tva_intra']['checked'])) |
|
1154 | 1154 | { |
1155 | 1155 | print "<td>".$obj->tva_intra."</td>\n"; |
1156 | - if (! $i) $totalarray['nbfield']++; |
|
1156 | + if (!$i) $totalarray['nbfield']++; |
|
1157 | 1157 | } |
1158 | 1158 | // Type |
1159 | - if (! empty($arrayfields['customerorsupplier']['checked'])) |
|
1159 | + if (!empty($arrayfields['customerorsupplier']['checked'])) |
|
1160 | 1160 | { |
1161 | 1161 | print '<td align="center">'; |
1162 | - $s=''; |
|
1163 | - if (($obj->client==1 || $obj->client==3) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) |
|
1162 | + $s = ''; |
|
1163 | + if (($obj->client == 1 || $obj->client == 3) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) |
|
1164 | 1164 | { |
1165 | - $companystatic->name=$langs->trans("Customer"); |
|
1166 | - $companystatic->name_alias=''; |
|
1167 | - $s.=$companystatic->getNomUrl(0,'customer',0,1); |
|
1165 | + $companystatic->name = $langs->trans("Customer"); |
|
1166 | + $companystatic->name_alias = ''; |
|
1167 | + $s .= $companystatic->getNomUrl(0, 'customer', 0, 1); |
|
1168 | 1168 | } |
1169 | - if (($obj->client==2 || $obj->client==3) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) |
|
1169 | + if (($obj->client == 2 || $obj->client == 3) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) |
|
1170 | 1170 | { |
1171 | - if ($s) $s.=" / "; |
|
1172 | - $companystatic->name=$langs->trans("Prospect"); |
|
1173 | - $companystatic->name_alias=''; |
|
1174 | - $s.=$companystatic->getNomUrl(0,'prospect',0,1); |
|
1171 | + if ($s) $s .= " / "; |
|
1172 | + $companystatic->name = $langs->trans("Prospect"); |
|
1173 | + $companystatic->name_alias = ''; |
|
1174 | + $s .= $companystatic->getNomUrl(0, 'prospect', 0, 1); |
|
1175 | 1175 | } |
1176 | - if (! empty($conf->fournisseur->enabled) && $obj->fournisseur) |
|
1176 | + if (!empty($conf->fournisseur->enabled) && $obj->fournisseur) |
|
1177 | 1177 | { |
1178 | - if ($s) $s.=" / "; |
|
1179 | - $companystatic->name=$langs->trans("Supplier"); |
|
1180 | - $companystatic->name_alias=''; |
|
1181 | - $s.=$companystatic->getNomUrl(0,'supplier',0,1); |
|
1178 | + if ($s) $s .= " / "; |
|
1179 | + $companystatic->name = $langs->trans("Supplier"); |
|
1180 | + $companystatic->name_alias = ''; |
|
1181 | + $s .= $companystatic->getNomUrl(0, 'supplier', 0, 1); |
|
1182 | 1182 | } |
1183 | 1183 | print $s; |
1184 | 1184 | print '</td>'; |
1185 | - if (! $i) $totalarray['nbfield']++; |
|
1185 | + if (!$i) $totalarray['nbfield']++; |
|
1186 | 1186 | } |
1187 | 1187 | |
1188 | - if (! empty($arrayfields['s.fk_prospectlevel']['checked'])) |
|
1188 | + if (!empty($arrayfields['s.fk_prospectlevel']['checked'])) |
|
1189 | 1189 | { |
1190 | 1190 | // Prospect level |
1191 | 1191 | print '<td align="center">'; |
1192 | 1192 | print $companystatic->getLibProspLevel(); |
1193 | 1193 | print "</td>"; |
1194 | - if (! $i) $totalarray['nbfield']++; |
|
1194 | + if (!$i) $totalarray['nbfield']++; |
|
1195 | 1195 | } |
1196 | 1196 | |
1197 | - if (! empty($arrayfields['s.fk_stcomm']['checked'])) |
|
1197 | + if (!empty($arrayfields['s.fk_stcomm']['checked'])) |
|
1198 | 1198 | { |
1199 | 1199 | // Prospect status |
1200 | 1200 | print '<td align="center" class="nowrap"><div class="nowrap">'; |
1201 | - print '<div class="inline-block">'.$companystatic->LibProspCommStatut($obj->stcomm_id,2,$prospectstatic->cacheprospectstatus[$obj->stcomm_id]['label']); |
|
1201 | + print '<div class="inline-block">'.$companystatic->LibProspCommStatut($obj->stcomm_id, 2, $prospectstatic->cacheprospectstatus[$obj->stcomm_id]['label']); |
|
1202 | 1202 | print '</div> - <div class="inline-block">'; |
1203 | - foreach($prospectstatic->cacheprospectstatus as $key => $val) |
|
1203 | + foreach ($prospectstatic->cacheprospectstatus as $key => $val) |
|
1204 | 1204 | { |
1205 | - $titlealt='default'; |
|
1206 | - if (! empty($val['code']) && ! in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) $titlealt=$val['label']; |
|
1207 | - if ($obj->stcomm_id != $val['id']) print '<a class="pictosubstatus" href="'.$_SERVER["PHP_SELF"].'?stcommsocid='.$obj->rowid.'&stcomm='.$val['code'].'&action=setstcomm'.$param.($page?'&page='.urlencode($page):'').'">'.img_action($titlealt,$val['code']).'</a>'; |
|
1205 | + $titlealt = 'default'; |
|
1206 | + if (!empty($val['code']) && !in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) $titlealt = $val['label']; |
|
1207 | + if ($obj->stcomm_id != $val['id']) print '<a class="pictosubstatus" href="'.$_SERVER["PHP_SELF"].'?stcommsocid='.$obj->rowid.'&stcomm='.$val['code'].'&action=setstcomm'.$param.($page ? '&page='.urlencode($page) : '').'">'.img_action($titlealt, $val['code']).'</a>'; |
|
1208 | 1208 | } |
1209 | 1209 | print '</div></div></td>'; |
1210 | - if (! $i) $totalarray['nbfield']++; |
|
1210 | + if (!$i) $totalarray['nbfield']++; |
|
1211 | 1211 | } |
1212 | 1212 | // Extra fields |
1213 | 1213 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; |
1214 | 1214 | // Fields from hook |
1215 | - $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); |
|
1216 | - $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook |
|
1215 | + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj); |
|
1216 | + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook |
|
1217 | 1217 | print $hookmanager->resPrint; |
1218 | 1218 | // Date creation |
1219 | - if (! empty($arrayfields['s.datec']['checked'])) |
|
1219 | + if (!empty($arrayfields['s.datec']['checked'])) |
|
1220 | 1220 | { |
1221 | 1221 | print '<td align="center" class="nowrap">'; |
1222 | 1222 | print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); |
1223 | 1223 | print '</td>'; |
1224 | - if (! $i) $totalarray['nbfield']++; |
|
1224 | + if (!$i) $totalarray['nbfield']++; |
|
1225 | 1225 | } |
1226 | 1226 | // Date modification |
1227 | - if (! empty($arrayfields['s.tms']['checked'])) |
|
1227 | + if (!empty($arrayfields['s.tms']['checked'])) |
|
1228 | 1228 | { |
1229 | 1229 | print '<td align="center" class="nowrap">'; |
1230 | 1230 | print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); |
1231 | 1231 | print '</td>'; |
1232 | - if (! $i) $totalarray['nbfield']++; |
|
1232 | + if (!$i) $totalarray['nbfield']++; |
|
1233 | 1233 | } |
1234 | 1234 | // Status |
1235 | - if (! empty($arrayfields['s.status']['checked'])) |
|
1235 | + if (!empty($arrayfields['s.status']['checked'])) |
|
1236 | 1236 | { |
1237 | 1237 | print '<td align="center" class="nowrap">'.$companystatic->getLibStatut(3).'</td>'; |
1238 | - if (! $i) $totalarray['nbfield']++; |
|
1238 | + if (!$i) $totalarray['nbfield']++; |
|
1239 | 1239 | } |
1240 | - if (! empty($arrayfields['s.import_key']['checked'])) |
|
1240 | + if (!empty($arrayfields['s.import_key']['checked'])) |
|
1241 | 1241 | { |
1242 | 1242 | print '<td class="tdoverflowmax100">'; |
1243 | 1243 | print $obj->import_key; |
1244 | 1244 | print "</td>\n"; |
1245 | - if (! $i) $totalarray['nbfield']++; |
|
1245 | + if (!$i) $totalarray['nbfield']++; |
|
1246 | 1246 | } |
1247 | 1247 | |
1248 | 1248 | // Action column |
1249 | 1249 | print '<td class="nowrap" align="center">'; |
1250 | 1250 | if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined |
1251 | 1251 | { |
1252 | - $selected=0; |
|
1253 | - if (in_array($obj->rowid, $arrayofselected)) $selected=1; |
|
1254 | - print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>'; |
|
1252 | + $selected = 0; |
|
1253 | + if (in_array($obj->rowid, $arrayofselected)) $selected = 1; |
|
1254 | + print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>'; |
|
1255 | 1255 | } |
1256 | 1256 | print '</td>'; |
1257 | - if (! $i) $totalarray['nbfield']++; |
|
1257 | + if (!$i) $totalarray['nbfield']++; |
|
1258 | 1258 | |
1259 | 1259 | print '</tr>'."\n"; |
1260 | 1260 | $i++; |
@@ -1262,8 +1262,8 @@ discard block |
||
1262 | 1262 | |
1263 | 1263 | $db->free($resql); |
1264 | 1264 | |
1265 | -$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql); |
|
1266 | -$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook |
|
1265 | +$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); |
|
1266 | +$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook |
|
1267 | 1267 | print $hookmanager->resPrint; |
1268 | 1268 | |
1269 | 1269 | print "</table>"; |
@@ -58,7 +58,9 @@ |
||
58 | 58 | <p align="right"> |
59 | 59 | <?php |
60 | 60 | print $langs->trans('Date')." ".dol_print_date($object->date, 'day').'<br>'; |
61 | -if ($mysoc->country_code == 'ES') print "Factura simplificada "; |
|
61 | +if ($mysoc->country_code == 'ES') { |
|
62 | + print "Factura simplificada "; |
|
63 | +} |
|
62 | 64 | print $object->ref; |
63 | 65 | ?> |
64 | 66 | </p> |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | // Copyright (C) 2018 Alxarafe/Alixar <[email protected]> |
23 | 23 | defined('BASE_PATH') or die('Single entry point through the index.php of the main folder'); |
24 | 24 | require DOL_BASE_PATH . '/main.inc.php'; |
25 | - // Load $user and permissions |
|
25 | + // Load $user and permissions |
|
26 | 26 | include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; |
27 | 27 | |
28 | 28 | $langs->loadLangs(array("main", "cashdesk")); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | <br> |
57 | 57 | <p align="left"> |
58 | 58 | <?php print dol_nl2br(dol_format_address($mysoc)).'<br>'.$langs->trans("Phone").': '.$mysoc->phone; |
59 | - ?> |
|
59 | + ?> |
|
60 | 60 | |
61 | 61 | </p> |
62 | 62 | <p align="right"> |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | |
22 | 22 | // Copyright (C) 2018 Alxarafe/Alixar <[email protected]> |
23 | 23 | defined('BASE_PATH') or die('Single entry point through the index.php of the main folder'); |
24 | -require DOL_BASE_PATH . '/main.inc.php'; |
|
24 | +require DOL_BASE_PATH.'/main.inc.php'; |
|
25 | 25 | // Load $user and permissions |
26 | 26 | include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; |
27 | 27 | |
@@ -33,15 +33,15 @@ discard block |
||
33 | 33 | |
34 | 34 | top_httphead('text/html'); |
35 | 35 | |
36 | -$facid=GETPOST('facid','int'); |
|
37 | -$place=GETPOST('place','int'); |
|
38 | -if ($place>0){ |
|
39 | - $sql="SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS-".$place.")'"; |
|
36 | +$facid = GETPOST('facid', 'int'); |
|
37 | +$place = GETPOST('place', 'int'); |
|
38 | +if ($place > 0) { |
|
39 | + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS-".$place.")'"; |
|
40 | 40 | $resql = $db->query($sql); |
41 | - $row = $db->fetch_array ($resql); |
|
42 | - $facid=$row[0]; |
|
41 | + $row = $db->fetch_array($resql); |
|
42 | + $facid = $row[0]; |
|
43 | 43 | } |
44 | -$object=new Facture($db); |
|
44 | +$object = new Facture($db); |
|
45 | 45 | $object->fetch($facid); |
46 | 46 | |
47 | 47 | // IMPORTANT: This file is sended to 'Takepos Printing' application. Keep basic file. No external files as css, js... If you need images use absolut path. |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | <body> |
51 | 51 | <center> |
52 | 52 | <font size="4"> |
53 | -<?php echo '<b>'.$mysoc->name.'</b>';?> |
|
53 | +<?php echo '<b>'.$mysoc->name.'</b>'; ?> |
|
54 | 54 | </font> |
55 | 55 | </center> |
56 | 56 | <br> |
@@ -83,10 +83,10 @@ discard block |
||
83 | 83 | { |
84 | 84 | ?> |
85 | 85 | <tr> |
86 | - <td><?php echo $line->product_label;?></td> |
|
87 | - <td align="right"><?php echo $line->qty;?></td> |
|
88 | - <td align="right"><?php echo $line->total_ttc/$line->qty;?></td> |
|
89 | - <td align="right"><?php echo price($line->total_ttc);?></td> |
|
86 | + <td><?php echo $line->product_label; ?></td> |
|
87 | + <td align="right"><?php echo $line->qty; ?></td> |
|
88 | + <td align="right"><?php echo $line->total_ttc / $line->qty; ?></td> |
|
89 | + <td align="right"><?php echo price($line->total_ttc); ?></td> |
|
90 | 90 | </tr> |
91 | 91 | <?php |
92 | 92 | } |
@@ -96,14 +96,14 @@ discard block |
||
96 | 96 | <br> |
97 | 97 | <table align="right"> |
98 | 98 | <tr> |
99 | - <th align="right"><?php echo $langs->trans("TotalHT");?></th> |
|
100 | - <td align="right"><?php echo price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency)."\n";?></td> |
|
99 | + <th align="right"><?php echo $langs->trans("TotalHT"); ?></th> |
|
100 | + <td align="right"><?php echo price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency)."\n"; ?></td> |
|
101 | 101 | </tr> |
102 | 102 | <tr> |
103 | - <th align="right"><?php echo $langs->trans("TotalVAT").'</th><td align="right">'.price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency)."\n";?></td> |
|
103 | + <th align="right"><?php echo $langs->trans("TotalVAT").'</th><td align="right">'.price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency)."\n"; ?></td> |
|
104 | 104 | </tr> |
105 | 105 | <tr> |
106 | - <th align="right"><?php echo ''.$langs->trans("TotalTTC").'</th><td align="right">'.price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency)."\n";?></td> |
|
106 | + <th align="right"><?php echo ''.$langs->trans("TotalTTC").'</th><td align="right">'.price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency)."\n"; ?></td> |
|
107 | 107 | </tr> |
108 | 108 | </table> |
109 | 109 | <div style="border-top-style: double;"> |
@@ -44,100 +44,100 @@ |
||
44 | 44 | |
45 | 45 | if ($query=="cat") |
46 | 46 | { |
47 | - require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
48 | - require_once DOL_DOCUMENT_ROOT.'/core/lib/categories.lib.php'; |
|
49 | - |
|
50 | - $object = new Categorie($db); |
|
51 | - $result = $object->fetch($id); |
|
52 | - $upload_dir = $conf->categorie->multidir_output[$object->entity]; |
|
53 | - $pdir = get_exdir($object->id,2,0,0,$object,'category') . $object->id ."/photos/"; |
|
54 | - $dir = $upload_dir.'/'.$pdir; |
|
55 | - foreach ($object->liste_photos($dir) as $key => $obj) |
|
56 | - { |
|
57 | - $filename=$obj['photo']; |
|
58 | - } |
|
59 | - |
|
60 | - // The file |
|
61 | - $filename = $dir.$filename; |
|
62 | - if (!file_exists($filename)) $filename="empty.jpg"; |
|
63 | - |
|
64 | - // Dimensions |
|
65 | - list($width, $height) = getimagesize($filename); |
|
66 | - $new_width = $w; |
|
67 | - $new_height = $h; |
|
68 | - |
|
69 | - // Resample |
|
70 | - $image_p = imagecreatetruecolor($new_width, $new_height); |
|
71 | - $image = imagecreatefromjpeg($filename); |
|
72 | - imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); |
|
73 | - |
|
74 | - // Add icon |
|
75 | - $icon = imagecreatefromjpeg('add.jpg'); |
|
76 | - list($width, $height) = getimagesize('add.jpg'); |
|
77 | - $new_width = $w*0.3; |
|
78 | - $new_height = $h*0.3; |
|
79 | - $icon_p = imagecreatetruecolor($new_width, $new_height); |
|
80 | - imagecopyresampled($icon_p, $icon, 0, 0, 0, 0, $new_width, $new_height, $width, $height); |
|
81 | - imagecopymerge($image_p, $icon_p, 0, 0, 0, 0, $new_width, $new_height, 100); |
|
82 | - |
|
83 | - // Output |
|
84 | - imagejpeg($image_p, null, 100); |
|
47 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
48 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/categories.lib.php'; |
|
49 | + |
|
50 | + $object = new Categorie($db); |
|
51 | + $result = $object->fetch($id); |
|
52 | + $upload_dir = $conf->categorie->multidir_output[$object->entity]; |
|
53 | + $pdir = get_exdir($object->id,2,0,0,$object,'category') . $object->id ."/photos/"; |
|
54 | + $dir = $upload_dir.'/'.$pdir; |
|
55 | + foreach ($object->liste_photos($dir) as $key => $obj) |
|
56 | + { |
|
57 | + $filename=$obj['photo']; |
|
58 | + } |
|
59 | + |
|
60 | + // The file |
|
61 | + $filename = $dir.$filename; |
|
62 | + if (!file_exists($filename)) $filename="empty.jpg"; |
|
63 | + |
|
64 | + // Dimensions |
|
65 | + list($width, $height) = getimagesize($filename); |
|
66 | + $new_width = $w; |
|
67 | + $new_height = $h; |
|
68 | + |
|
69 | + // Resample |
|
70 | + $image_p = imagecreatetruecolor($new_width, $new_height); |
|
71 | + $image = imagecreatefromjpeg($filename); |
|
72 | + imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); |
|
73 | + |
|
74 | + // Add icon |
|
75 | + $icon = imagecreatefromjpeg('add.jpg'); |
|
76 | + list($width, $height) = getimagesize('add.jpg'); |
|
77 | + $new_width = $w*0.3; |
|
78 | + $new_height = $h*0.3; |
|
79 | + $icon_p = imagecreatetruecolor($new_width, $new_height); |
|
80 | + imagecopyresampled($icon_p, $icon, 0, 0, 0, 0, $new_width, $new_height, $width, $height); |
|
81 | + imagecopymerge($image_p, $icon_p, 0, 0, 0, 0, $new_width, $new_height, 100); |
|
82 | + |
|
83 | + // Output |
|
84 | + imagejpeg($image_p, null, 100); |
|
85 | 85 | } |
86 | 86 | else if ($query=="pro") |
87 | 87 | { |
88 | - require_once DOL_DOCUMENT_ROOT."/product/class/product.class.php"; |
|
89 | - |
|
90 | - $objProd = new Product($db); |
|
91 | - $objProd->fetch($id); |
|
92 | - |
|
93 | - $dir .= get_exdir(0,0,0,0,$objProd,'product').$objProd->ref.'/'; |
|
94 | - $pdir .= get_exdir(0,0,0,0,$objProd,'product').$objProd->ref.'/'; |
|
95 | - |
|
96 | - foreach ($objProd->liste_photos($dir) as $key => $obj) |
|
97 | - { |
|
98 | - $filename=$obj['photo']; |
|
99 | - } |
|
100 | - $filename = $dir.$filename; |
|
101 | - |
|
102 | - if (!file_exists($filename)){ |
|
103 | - $dir = $conf->product->multidir_output[$objProd->entity].'/'.$pdir; |
|
104 | - foreach ($objProd->liste_photos($dir) as $key => $obj) |
|
105 | - { |
|
106 | - $filename=$obj['photo']; |
|
107 | - } |
|
108 | - $filename = $dir.$filename; |
|
109 | - } |
|
110 | - |
|
111 | - if (!file_exists($filename)) $filename="empty.jpg"; |
|
112 | - |
|
113 | - // Dimensions |
|
114 | - list($width, $height) = getimagesize($filename); |
|
115 | - $new_width = $w; |
|
116 | - $new_height = $h; |
|
117 | - |
|
118 | - // Resample |
|
119 | - $image_p = imagecreatetruecolor($new_width, $new_height); |
|
120 | - $image = imagecreatefromjpeg($filename); |
|
121 | - imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); |
|
122 | - |
|
123 | - // Output |
|
124 | - imagejpeg($image_p, null, 100); |
|
88 | + require_once DOL_DOCUMENT_ROOT."/product/class/product.class.php"; |
|
89 | + |
|
90 | + $objProd = new Product($db); |
|
91 | + $objProd->fetch($id); |
|
92 | + |
|
93 | + $dir .= get_exdir(0,0,0,0,$objProd,'product').$objProd->ref.'/'; |
|
94 | + $pdir .= get_exdir(0,0,0,0,$objProd,'product').$objProd->ref.'/'; |
|
95 | + |
|
96 | + foreach ($objProd->liste_photos($dir) as $key => $obj) |
|
97 | + { |
|
98 | + $filename=$obj['photo']; |
|
99 | + } |
|
100 | + $filename = $dir.$filename; |
|
101 | + |
|
102 | + if (!file_exists($filename)){ |
|
103 | + $dir = $conf->product->multidir_output[$objProd->entity].'/'.$pdir; |
|
104 | + foreach ($objProd->liste_photos($dir) as $key => $obj) |
|
105 | + { |
|
106 | + $filename=$obj['photo']; |
|
107 | + } |
|
108 | + $filename = $dir.$filename; |
|
109 | + } |
|
110 | + |
|
111 | + if (!file_exists($filename)) $filename="empty.jpg"; |
|
112 | + |
|
113 | + // Dimensions |
|
114 | + list($width, $height) = getimagesize($filename); |
|
115 | + $new_width = $w; |
|
116 | + $new_height = $h; |
|
117 | + |
|
118 | + // Resample |
|
119 | + $image_p = imagecreatetruecolor($new_width, $new_height); |
|
120 | + $image = imagecreatefromjpeg($filename); |
|
121 | + imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); |
|
122 | + |
|
123 | + // Output |
|
124 | + imagejpeg($image_p, null, 100); |
|
125 | 125 | } |
126 | 126 | else |
127 | 127 | { |
128 | - // The file |
|
129 | - $filename = $query.".jpg"; |
|
128 | + // The file |
|
129 | + $filename = $query.".jpg"; |
|
130 | 130 | |
131 | - // Dimensions |
|
132 | - list($width, $height) = getimagesize($filename); |
|
133 | - $new_width = $w; |
|
134 | - $new_height = $h; |
|
131 | + // Dimensions |
|
132 | + list($width, $height) = getimagesize($filename); |
|
133 | + $new_width = $w; |
|
134 | + $new_height = $h; |
|
135 | 135 | |
136 | - // Resample |
|
137 | - $image_p = imagecreatetruecolor($new_width, $new_height); |
|
138 | - $image = imagecreatefromjpeg($filename); |
|
139 | - imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); |
|
136 | + // Resample |
|
137 | + $image_p = imagecreatetruecolor($new_width, $new_height); |
|
138 | + $image = imagecreatefromjpeg($filename); |
|
139 | + imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); |
|
140 | 140 | |
141 | - // Output |
|
142 | - imagejpeg($image_p, null, 100); |
|
141 | + // Output |
|
142 | + imagejpeg($image_p, null, 100); |
|
143 | 143 | } |
@@ -17,13 +17,25 @@ discard block |
||
17 | 17 | |
18 | 18 | //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language |
19 | 19 | //if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language |
20 | -if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); |
|
20 | +if (! defined('NOREQUIRESOC')) { |
|
21 | + define('NOREQUIRESOC','1'); |
|
22 | +} |
|
21 | 23 | //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); |
22 | -if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); |
|
23 | -if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); |
|
24 | -if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); |
|
25 | -if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); |
|
26 | -if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); |
|
24 | +if (! defined('NOCSRFCHECK')) { |
|
25 | + define('NOCSRFCHECK','1'); |
|
26 | +} |
|
27 | +if (! defined('NOTOKENRENEWAL')) { |
|
28 | + define('NOTOKENRENEWAL','1'); |
|
29 | +} |
|
30 | +if (! defined('NOREQUIREMENU')) { |
|
31 | + define('NOREQUIREMENU','1'); |
|
32 | +} |
|
33 | +if (! defined('NOREQUIREHTML')) { |
|
34 | + define('NOREQUIREHTML','1'); |
|
35 | +} |
|
36 | +if (! defined('NOREQUIREAJAX')) { |
|
37 | + define('NOREQUIREAJAX','1'); |
|
38 | +} |
|
27 | 39 | |
28 | 40 | |
29 | 41 | // Copyright (C) 2018 Alxarafe/Alixar <[email protected]> |
@@ -62,7 +74,9 @@ discard block |
||
62 | 74 | |
63 | 75 | // The file |
64 | 76 | $filename = $dir.$filename; |
65 | - if (!file_exists($filename)) $filename="empty.jpg"; |
|
77 | + if (!file_exists($filename)) { |
|
78 | + $filename="empty.jpg"; |
|
79 | + } |
|
66 | 80 | |
67 | 81 | // Dimensions |
68 | 82 | list($width, $height) = getimagesize($filename); |
@@ -85,8 +99,7 @@ discard block |
||
85 | 99 | |
86 | 100 | // Output |
87 | 101 | imagejpeg($image_p, null, 100); |
88 | -} |
|
89 | -else if ($query=="pro") |
|
102 | +} else if ($query=="pro") |
|
90 | 103 | { |
91 | 104 | require_once DOL_DOCUMENT_ROOT."/product/class/product.class.php"; |
92 | 105 | |
@@ -111,7 +124,9 @@ discard block |
||
111 | 124 | $filename = $dir.$filename; |
112 | 125 | } |
113 | 126 | |
114 | - if (!file_exists($filename)) $filename="empty.jpg"; |
|
127 | + if (!file_exists($filename)) { |
|
128 | + $filename="empty.jpg"; |
|
129 | + } |
|
115 | 130 | |
116 | 131 | // Dimensions |
117 | 132 | list($width, $height) = getimagesize($filename); |
@@ -125,8 +140,7 @@ discard block |
||
125 | 140 | |
126 | 141 | // Output |
127 | 142 | imagejpeg($image_p, null, 100); |
128 | -} |
|
129 | -else |
|
143 | +} else |
|
130 | 144 | { |
131 | 145 | // The file |
132 | 146 | $filename = $query.".jpg"; |
@@ -17,23 +17,23 @@ discard block |
||
17 | 17 | |
18 | 18 | //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language |
19 | 19 | //if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language |
20 | -if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); |
|
20 | +if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); |
|
21 | 21 | //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); |
22 | -if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); |
|
23 | -if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); |
|
24 | -if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); |
|
25 | -if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); |
|
26 | -if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); |
|
22 | +if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); |
|
23 | +if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); |
|
24 | +if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); |
|
25 | +if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); |
|
26 | +if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); |
|
27 | 27 | |
28 | 28 | |
29 | 29 | // Copyright (C) 2018 Alxarafe/Alixar <[email protected]> |
30 | 30 | defined('BASE_PATH') or die('Single entry point through the index.php of the main folder'); |
31 | -require DOL_BASE_PATH . '/main.inc.php'; // Load $user and permissions |
|
31 | +require DOL_BASE_PATH.'/main.inc.php'; // Load $user and permissions |
|
32 | 32 | |
33 | -$id= GETPOST('id'); |
|
34 | -$w= GETPOST('w'); |
|
35 | -$h= GETPOST('h'); |
|
36 | -$query= GETPOST('query'); |
|
33 | +$id = GETPOST('id'); |
|
34 | +$w = GETPOST('w'); |
|
35 | +$h = GETPOST('h'); |
|
36 | +$query = GETPOST('query'); |
|
37 | 37 | |
38 | 38 | |
39 | 39 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | header('Cache-Control: max-age=604800, public, must-revalidate'); |
46 | 46 | header('Pragma: cache'); |
47 | 47 | |
48 | -if ($query=="cat") |
|
48 | +if ($query == "cat") |
|
49 | 49 | { |
50 | 50 | require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
51 | 51 | require_once DOL_DOCUMENT_ROOT.'/core/lib/categories.lib.php'; |
@@ -53,16 +53,16 @@ discard block |
||
53 | 53 | $object = new Categorie($db); |
54 | 54 | $result = $object->fetch($id); |
55 | 55 | $upload_dir = $conf->categorie->multidir_output[$object->entity]; |
56 | - $pdir = get_exdir($object->id,2,0,0,$object,'category') . $object->id ."/photos/"; |
|
56 | + $pdir = get_exdir($object->id, 2, 0, 0, $object, 'category').$object->id."/photos/"; |
|
57 | 57 | $dir = $upload_dir.'/'.$pdir; |
58 | 58 | foreach ($object->liste_photos($dir) as $key => $obj) |
59 | 59 | { |
60 | - $filename=$obj['photo']; |
|
60 | + $filename = $obj['photo']; |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | // The file |
64 | 64 | $filename = $dir.$filename; |
65 | - if (!file_exists($filename)) $filename="empty.jpg"; |
|
65 | + if (!file_exists($filename)) $filename = "empty.jpg"; |
|
66 | 66 | |
67 | 67 | // Dimensions |
68 | 68 | list($width, $height) = getimagesize($filename); |
@@ -77,41 +77,41 @@ discard block |
||
77 | 77 | // Add icon |
78 | 78 | $icon = imagecreatefromjpeg('add.jpg'); |
79 | 79 | list($width, $height) = getimagesize('add.jpg'); |
80 | - $new_width = $w*0.3; |
|
81 | - $new_height = $h*0.3; |
|
80 | + $new_width = $w * 0.3; |
|
81 | + $new_height = $h * 0.3; |
|
82 | 82 | $icon_p = imagecreatetruecolor($new_width, $new_height); |
83 | 83 | imagecopyresampled($icon_p, $icon, 0, 0, 0, 0, $new_width, $new_height, $width, $height); |
84 | - imagecopymerge($image_p, $icon_p, 0, 0, 0, 0, $new_width, $new_height, 100); |
|
84 | + imagecopymerge($image_p, $icon_p, 0, 0, 0, 0, $new_width, $new_height, 100); |
|
85 | 85 | |
86 | 86 | // Output |
87 | 87 | imagejpeg($image_p, null, 100); |
88 | 88 | } |
89 | -else if ($query=="pro") |
|
89 | +else if ($query == "pro") |
|
90 | 90 | { |
91 | 91 | require_once DOL_DOCUMENT_ROOT."/product/class/product.class.php"; |
92 | 92 | |
93 | 93 | $objProd = new Product($db); |
94 | 94 | $objProd->fetch($id); |
95 | 95 | |
96 | - $dir .= get_exdir(0,0,0,0,$objProd,'product').$objProd->ref.'/'; |
|
97 | - $pdir .= get_exdir(0,0,0,0,$objProd,'product').$objProd->ref.'/'; |
|
96 | + $dir .= get_exdir(0, 0, 0, 0, $objProd, 'product').$objProd->ref.'/'; |
|
97 | + $pdir .= get_exdir(0, 0, 0, 0, $objProd, 'product').$objProd->ref.'/'; |
|
98 | 98 | |
99 | 99 | foreach ($objProd->liste_photos($dir) as $key => $obj) |
100 | 100 | { |
101 | - $filename=$obj['photo']; |
|
101 | + $filename = $obj['photo']; |
|
102 | 102 | } |
103 | 103 | $filename = $dir.$filename; |
104 | 104 | |
105 | - if (!file_exists($filename)){ |
|
105 | + if (!file_exists($filename)) { |
|
106 | 106 | $dir = $conf->product->multidir_output[$objProd->entity].'/'.$pdir; |
107 | 107 | foreach ($objProd->liste_photos($dir) as $key => $obj) |
108 | 108 | { |
109 | - $filename=$obj['photo']; |
|
109 | + $filename = $obj['photo']; |
|
110 | 110 | } |
111 | 111 | $filename = $dir.$filename; |
112 | 112 | } |
113 | 113 | |
114 | - if (!file_exists($filename)) $filename="empty.jpg"; |
|
114 | + if (!file_exists($filename)) $filename = "empty.jpg"; |
|
115 | 115 | |
116 | 116 | // Dimensions |
117 | 117 | list($width, $height) = getimagesize($filename); |
@@ -19,11 +19,21 @@ discard block |
||
19 | 19 | //if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language |
20 | 20 | //if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); |
21 | 21 | //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); |
22 | -if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); |
|
23 | -if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); |
|
24 | -if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); |
|
25 | -if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); |
|
26 | -if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); |
|
22 | +if (! defined('NOCSRFCHECK')) { |
|
23 | + define('NOCSRFCHECK','1'); |
|
24 | +} |
|
25 | +if (! defined('NOTOKENRENEWAL')) { |
|
26 | + define('NOTOKENRENEWAL','1'); |
|
27 | +} |
|
28 | +if (! defined('NOREQUIREMENU')) { |
|
29 | + define('NOREQUIREMENU','1'); |
|
30 | +} |
|
31 | +if (! defined('NOREQUIREHTML')) { |
|
32 | + define('NOREQUIREHTML','1'); |
|
33 | +} |
|
34 | +if (! defined('NOREQUIREAJAX')) { |
|
35 | + define('NOREQUIREAJAX','1'); |
|
36 | +} |
|
27 | 37 | |
28 | 38 | $_GET['theme']="md"; // Force theme. MD theme provides better look and feel to TakePOS |
29 | 39 | |
@@ -33,7 +43,9 @@ discard block |
||
33 | 43 | require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; |
34 | 44 | |
35 | 45 | $place = GETPOST('place','int'); |
36 | -if ($place=="") $place="0"; |
|
46 | +if ($place=="") { |
|
47 | + $place="0"; |
|
48 | +} |
|
37 | 49 | $action = GETPOST('action','alpha'); |
38 | 50 | |
39 | 51 | $langs->loadLangs(array("bills","orders","commercial","cashdesk","receiptprinter")); |
@@ -45,7 +57,9 @@ discard block |
||
45 | 57 | |
46 | 58 | // Title |
47 | 59 | $title='TakePOS - Dolibarr '.DOL_VERSION; |
48 | -if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title='TakePOS - '.$conf->global->MAIN_APPLICATION_TITLE; |
|
60 | +if (! empty($conf->global->MAIN_APPLICATION_TITLE)) { |
|
61 | + $title='TakePOS - '.$conf->global->MAIN_APPLICATION_TITLE; |
|
62 | +} |
|
49 | 63 | $head='<meta name="apple-mobile-web-app-title" content="TakePOS"/> |
50 | 64 | <meta name="apple-mobile-web-app-capable" content="yes"> |
51 | 65 | <meta name="mobile-web-app-capable" content="yes"> |
@@ -392,8 +406,21 @@ discard block |
||
392 | 406 | while ($count<16) |
393 | 407 | { |
394 | 408 | ?> |
395 | - <div class='wrapper' <?php if ($count==14) echo 'onclick="MoreCategories(\'less\');"'; else if ($count==15) echo 'onclick="MoreCategories(\'more\');"'; else echo 'onclick="LoadProducts('.$count.');"';?> id='catdiv<?php echo $count;?>'> |
|
396 | - <img class='imgwrapper' <?php if ($count==14) echo 'src="img/arrow-prev-top.png"'; if ($count==15) echo 'src="img/arrow-next-top.png"';?> width="98%" id='catimg<?php echo $count;?>'/> |
|
409 | + <div class='wrapper' <?php if ($count==14) { |
|
410 | + echo 'onclick="MoreCategories(\'less\');"'; |
|
411 | +} else if ($count==15) { |
|
412 | + echo 'onclick="MoreCategories(\'more\');"'; |
|
413 | +} else { |
|
414 | + echo 'onclick="LoadProducts('.$count.');"'; |
|
415 | +} |
|
416 | +?> id='catdiv<?php echo $count;?>'> |
|
417 | + <img class='imgwrapper' <?php if ($count==14) { |
|
418 | + echo 'src="img/arrow-prev-top.png"'; |
|
419 | +} |
|
420 | +if ($count==15) { |
|
421 | + echo 'src="img/arrow-next-top.png"'; |
|
422 | +} |
|
423 | +?> width="98%" id='catimg<?php echo $count;?>'/> |
|
397 | 424 | <div class='description'> |
398 | 425 | <div class='description_content' id='catdesc<?php echo $count;?>'></div> |
399 | 426 | </div> |
@@ -410,8 +437,17 @@ discard block |
||
410 | 437 | while ($count<32) |
411 | 438 | { |
412 | 439 | ?> |
413 | - <div class='wrapper2' id='prodiv<?php echo $count;?>' <?php if ($count==30) {?> onclick="MoreProducts('less');" <?php } if ($count==31) {?> onclick="MoreProducts('more');" <?php } else echo 'onclick="ClickProduct('.$count.');"';?>> |
|
414 | - <img class='imgwrapper' <?php if ($count==30) echo 'src="img/arrow-prev-top.png"'; if ($count==31) echo 'src="img/arrow-next-top.png"';?> width="95%" id='proimg<?php echo $count;?>'/> |
|
440 | + <div class='wrapper2' id='prodiv<?php echo $count;?>' <?php if ($count==30) {?> onclick="MoreProducts('less');" <?php } if ($count==31) {?> onclick="MoreProducts('more');" <?php } else { |
|
441 | + echo 'onclick="ClickProduct('.$count.');"'; |
|
442 | +} |
|
443 | +?>> |
|
444 | + <img class='imgwrapper' <?php if ($count==30) { |
|
445 | + echo 'src="img/arrow-prev-top.png"'; |
|
446 | +} |
|
447 | +if ($count==31) { |
|
448 | + echo 'src="img/arrow-next-top.png"'; |
|
449 | +} |
|
450 | +?> width="95%" id='proimg<?php echo $count;?>'/> |
|
415 | 451 | <div class='description'> |
416 | 452 | <div class='description_content' id='prodesc<?php echo $count;?>'></div> |
417 | 453 | </div> |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | // Copyright (C) 2018 Alxarafe/Alixar <[email protected]> |
32 | 32 | defined('BASE_PATH') or die('Single entry point through the index.php of the main folder'); |
33 | 33 | require DOL_BASE_PATH . '/main.inc.php'; |
34 | - // Load $user and permissions |
|
34 | + // Load $user and permissions |
|
35 | 35 | require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; |
36 | 36 | require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
37 | 37 | require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; |
@@ -350,36 +350,36 @@ discard block |
||
350 | 350 | $menus = array(); |
351 | 351 | $r=0; |
352 | 352 | $menus[$r++]=array('title'=>$langs->trans("SearchProduct"), |
353 | - 'action'=>'Search();'); |
|
353 | + 'action'=>'Search();'); |
|
354 | 354 | $menus[$r++]=array('title'=>$langs->trans("FreeZone"), |
355 | - 'action'=>'FreeZone();'); |
|
355 | + 'action'=>'FreeZone();'); |
|
356 | 356 | $menus[$r++]=array('title'=>$langs->trans("Customer"), |
357 | - 'action'=>'Customer();'); |
|
357 | + 'action'=>'Customer();'); |
|
358 | 358 | $menus[$r++]=array('title'=>$langs->trans("BackOffice"), |
359 | - 'action'=>'window.open(\''.DOL_URL_ROOT.'\', \'backoffice\');'); |
|
359 | + 'action'=>'window.open(\''.DOL_URL_ROOT.'\', \'backoffice\');'); |
|
360 | 360 | $menus[$r++]=array('title'=>$langs->trans("ValidateBill"), |
361 | - 'action'=>'CloseBill();'); |
|
361 | + 'action'=>'CloseBill();'); |
|
362 | 362 | $menus[$r++]=array('title'=>$langs->trans("Logout"), |
363 | - 'action'=>'window.location.href=\''.DOL_URL_ROOT.'/user/logout.php\';'); |
|
363 | + 'action'=>'window.location.href=\''.DOL_URL_ROOT.'/user/logout.php\';'); |
|
364 | 364 | |
365 | 365 | //BAR RESTAURANT specified menu |
366 | 366 | if($conf->global->TAKEPOS_BAR_RESTAURANT){ |
367 | - $menus[$r++]=array('title'=>$langs->trans("Floors"), |
|
368 | - 'action'=>'Floors();'); |
|
369 | - if ($conf->global->TAKEPOS_ORDER_PRINTERS){ |
|
370 | - $menus[$r++]=array('title'=>$langs->trans("Order"), |
|
371 | - 'action'=>'TakeposPrintingOrder();'); |
|
372 | - } |
|
373 | - //add temp ticket button |
|
374 | - if ($conf->global->TAKEPOS_ORDER_PRINTERS){ |
|
375 | - $menus[$r++]=array('title'=>$langs->trans("Temporary ticket"), |
|
376 | - 'action'=>'TakeposPrintingTemp();'); |
|
377 | - } |
|
367 | + $menus[$r++]=array('title'=>$langs->trans("Floors"), |
|
368 | + 'action'=>'Floors();'); |
|
369 | + if ($conf->global->TAKEPOS_ORDER_PRINTERS){ |
|
370 | + $menus[$r++]=array('title'=>$langs->trans("Order"), |
|
371 | + 'action'=>'TakeposPrintingOrder();'); |
|
372 | + } |
|
373 | + //add temp ticket button |
|
374 | + if ($conf->global->TAKEPOS_ORDER_PRINTERS){ |
|
375 | + $menus[$r++]=array('title'=>$langs->trans("Temporary ticket"), |
|
376 | + 'action'=>'TakeposPrintingTemp();'); |
|
377 | + } |
|
378 | 378 | } |
379 | 379 | |
380 | 380 | if ($conf->global->TAKEPOSCONNECTOR){ |
381 | - $menus[$r++]=array('title'=>$langs->trans("DOL_OPEN_DRAWER"), |
|
382 | - 'action'=>'OpenDrawer();'); |
|
381 | + $menus[$r++]=array('title'=>$langs->trans("DOL_OPEN_DRAWER"), |
|
382 | + 'action'=>'OpenDrawer();'); |
|
383 | 383 | } |
384 | 384 | ?> |
385 | 385 | <div style="position:absolute; top:1%; left:65.5%; height:37%; width:32.5%;"> |
@@ -392,10 +392,10 @@ discard block |
||
392 | 392 | |
393 | 393 | <div style="position:absolute; top:39%; left:0.3%; height:59%; width:32%;"> |
394 | 394 | <?php |
395 | - $count=0; |
|
396 | - while ($count<16) |
|
397 | - { |
|
398 | - ?> |
|
395 | + $count=0; |
|
396 | + while ($count<16) |
|
397 | + { |
|
398 | + ?> |
|
399 | 399 | <div class='wrapper' <?php if ($count==14) echo 'onclick="MoreCategories(\'less\');"'; else if ($count==15) echo 'onclick="MoreCategories(\'more\');"'; else echo 'onclick="LoadProducts('.$count.');"';?> id='catdiv<?php echo $count;?>'> |
400 | 400 | <img class='imgwrapper' <?php if ($count==14) echo 'src="img/arrow-prev-top.png"'; if ($count==15) echo 'src="img/arrow-next-top.png"';?> width="98%" id='catimg<?php echo $count;?>'/> |
401 | 401 | <div class='description'> |
@@ -404,16 +404,16 @@ discard block |
||
404 | 404 | </div> |
405 | 405 | <?php |
406 | 406 | $count++; |
407 | - } |
|
408 | - ?> |
|
407 | + } |
|
408 | + ?> |
|
409 | 409 | </div> |
410 | 410 | |
411 | 411 | <div style="position:absolute; top:39%; left:32%; height:58%; width:72%;"> |
412 | 412 | <?php |
413 | 413 | $count=0; |
414 | 414 | while ($count<32) |
415 | - { |
|
416 | - ?> |
|
415 | + { |
|
416 | + ?> |
|
417 | 417 | <div class='wrapper2' id='prodiv<?php echo $count;?>' <?php if ($count==30) {?> onclick="MoreProducts('less');" <?php } if ($count==31) {?> onclick="MoreProducts('more');" <?php } else echo 'onclick="ClickProduct('.$count.');"';?>> |
418 | 418 | <img class='imgwrapper' <?php if ($count==30) echo 'src="img/arrow-prev-top.png"'; if ($count==31) echo 'src="img/arrow-next-top.png"';?> width="95%" id='proimg<?php echo $count;?>'/> |
419 | 419 | <div class='description'> |
@@ -421,8 +421,8 @@ discard block |
||
421 | 421 | </div> |
422 | 422 | </div> |
423 | 423 | <?php |
424 | - $count++; |
|
425 | - } |
|
424 | + $count++; |
|
425 | + } |
|
426 | 426 | ?> |
427 | 427 | </div> |
428 | 428 |
@@ -19,28 +19,28 @@ discard block |
||
19 | 19 | //if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language |
20 | 20 | //if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); |
21 | 21 | //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); |
22 | -if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); |
|
23 | -if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); |
|
24 | -if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); |
|
25 | -if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); |
|
26 | -if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); |
|
22 | +if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); |
|
23 | +if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); |
|
24 | +if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); |
|
25 | +if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); |
|
26 | +if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); |
|
27 | 27 | |
28 | -$_GET['theme']="md"; // Force theme. MD theme provides better look and feel to TakePOS |
|
28 | +$_GET['theme'] = "md"; // Force theme. MD theme provides better look and feel to TakePOS |
|
29 | 29 | |
30 | 30 | |
31 | 31 | // Copyright (C) 2018 Alxarafe/Alixar <[email protected]> |
32 | 32 | defined('BASE_PATH') or die('Single entry point through the index.php of the main folder'); |
33 | -require DOL_BASE_PATH . '/main.inc.php'; |
|
33 | +require DOL_BASE_PATH.'/main.inc.php'; |
|
34 | 34 | // Load $user and permissions |
35 | 35 | require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; |
36 | 36 | require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
37 | -require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; |
|
37 | +require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; |
|
38 | 38 | |
39 | -$place = GETPOST('place','int'); |
|
40 | -if ($place=="") $place="0"; |
|
41 | -$action = GETPOST('action','alpha'); |
|
39 | +$place = GETPOST('place', 'int'); |
|
40 | +if ($place == "") $place = "0"; |
|
41 | +$action = GETPOST('action', 'alpha'); |
|
42 | 42 | |
43 | -$langs->loadLangs(array("bills","orders","commercial","cashdesk","receiptprinter")); |
|
43 | +$langs->loadLangs(array("bills", "orders", "commercial", "cashdesk", "receiptprinter")); |
|
44 | 44 | |
45 | 45 | |
46 | 46 | /* |
@@ -48,9 +48,9 @@ discard block |
||
48 | 48 | */ |
49 | 49 | |
50 | 50 | // Title |
51 | -$title='TakePOS - Dolibarr '.DOL_VERSION; |
|
52 | -if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title='TakePOS - '.$conf->global->MAIN_APPLICATION_TITLE; |
|
53 | -$head='<meta name="apple-mobile-web-app-title" content="TakePOS"/> |
|
51 | +$title = 'TakePOS - Dolibarr '.DOL_VERSION; |
|
52 | +if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $title = 'TakePOS - '.$conf->global->MAIN_APPLICATION_TITLE; |
|
53 | +$head = '<meta name="apple-mobile-web-app-title" content="TakePOS"/> |
|
54 | 54 | <meta name="apple-mobile-web-app-capable" content="yes"> |
55 | 55 | <meta name="mobile-web-app-capable" content="yes"> |
56 | 56 | <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>'; |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | $categorie = new Categorie($db); |
67 | 67 | $categories = $categorie->get_full_arbo('product'); |
68 | 68 | ?> |
69 | -var categories = JSON.parse( '<?php echo json_encode($categories);?>' ); |
|
69 | +var categories = JSON.parse( '<?php echo json_encode($categories); ?>' ); |
|
70 | 70 | var currentcat; |
71 | 71 | var pageproducts=0; |
72 | 72 | var pagecategories=0; |
73 | -var place="<?php echo $place;?>"; |
|
73 | +var place="<?php echo $place; ?>"; |
|
74 | 74 | var editaction="qty"; |
75 | 75 | var editnumber=""; |
76 | 76 | function PrintCategories(first){ |
@@ -180,19 +180,19 @@ discard block |
||
180 | 180 | } |
181 | 181 | |
182 | 182 | function Customer(){ |
183 | - $.colorbox({href:"customers.php?nomassaction=1&place="+place, width:"90%", height:"80%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("Customer");?>"}); |
|
183 | + $.colorbox({href:"customers.php?nomassaction=1&place="+place, width:"90%", height:"80%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("Customer"); ?>"}); |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | function CloseBill(){ |
187 | - $.colorbox({href:"pay.php?place="+place, width:"80%", height:"90%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("CloseBill");?>"}); |
|
187 | + $.colorbox({href:"pay.php?place="+place, width:"80%", height:"90%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("CloseBill"); ?>"}); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | function Floors(){ |
191 | - $.colorbox({href:"floors.php?place="+place, width:"90%", height:"90%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("Floors");?>"}); |
|
191 | + $.colorbox({href:"floors.php?place="+place, width:"90%", height:"90%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("Floors"); ?>"}); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | function FreeZone(){ |
195 | - $.colorbox({href:"freezone.php?place="+place, onClosed: function () { Refresh(); },width:"80%", height:"30%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("FreeZone");?>"}); |
|
195 | + $.colorbox({href:"freezone.php?place="+place, onClosed: function () { Refresh(); },width:"80%", height:"30%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("FreeZone"); ?>"}); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | function Refresh(){ |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | function OpenDrawer(){ |
310 | 310 | $.ajax({ |
311 | 311 | type: "POST", |
312 | - url: 'http://<?php print $conf->global->TAKEPOS_PRINT_SERVER;?>:8111/print', |
|
312 | + url: 'http://<?php print $conf->global->TAKEPOS_PRINT_SERVER; ?>:8111/print', |
|
313 | 313 | data: "opendrawer" |
314 | 314 | }); |
315 | 315 | } |
@@ -348,43 +348,43 @@ discard block |
||
348 | 348 | <?php |
349 | 349 | // User menu and external TakePOS modules |
350 | 350 | $menus = array(); |
351 | -$r=0; |
|
352 | -$menus[$r++]=array('title'=>$langs->trans("SearchProduct"), |
|
351 | +$r = 0; |
|
352 | +$menus[$r++] = array('title'=>$langs->trans("SearchProduct"), |
|
353 | 353 | 'action'=>'Search();'); |
354 | -$menus[$r++]=array('title'=>$langs->trans("FreeZone"), |
|
354 | +$menus[$r++] = array('title'=>$langs->trans("FreeZone"), |
|
355 | 355 | 'action'=>'FreeZone();'); |
356 | -$menus[$r++]=array('title'=>$langs->trans("Customer"), |
|
356 | +$menus[$r++] = array('title'=>$langs->trans("Customer"), |
|
357 | 357 | 'action'=>'Customer();'); |
358 | -$menus[$r++]=array('title'=>$langs->trans("BackOffice"), |
|
358 | +$menus[$r++] = array('title'=>$langs->trans("BackOffice"), |
|
359 | 359 | 'action'=>'window.open(\''.DOL_URL_ROOT.'\', \'backoffice\');'); |
360 | -$menus[$r++]=array('title'=>$langs->trans("ValidateBill"), |
|
360 | +$menus[$r++] = array('title'=>$langs->trans("ValidateBill"), |
|
361 | 361 | 'action'=>'CloseBill();'); |
362 | -$menus[$r++]=array('title'=>$langs->trans("Logout"), |
|
362 | +$menus[$r++] = array('title'=>$langs->trans("Logout"), |
|
363 | 363 | 'action'=>'window.location.href=\''.DOL_URL_ROOT.'/user/logout.php\';'); |
364 | 364 | |
365 | 365 | //BAR RESTAURANT specified menu |
366 | -if($conf->global->TAKEPOS_BAR_RESTAURANT){ |
|
367 | - $menus[$r++]=array('title'=>$langs->trans("Floors"), |
|
366 | +if ($conf->global->TAKEPOS_BAR_RESTAURANT) { |
|
367 | + $menus[$r++] = array('title'=>$langs->trans("Floors"), |
|
368 | 368 | 'action'=>'Floors();'); |
369 | - if ($conf->global->TAKEPOS_ORDER_PRINTERS){ |
|
370 | - $menus[$r++]=array('title'=>$langs->trans("Order"), |
|
369 | + if ($conf->global->TAKEPOS_ORDER_PRINTERS) { |
|
370 | + $menus[$r++] = array('title'=>$langs->trans("Order"), |
|
371 | 371 | 'action'=>'TakeposPrintingOrder();'); |
372 | 372 | } |
373 | 373 | //add temp ticket button |
374 | - if ($conf->global->TAKEPOS_ORDER_PRINTERS){ |
|
375 | - $menus[$r++]=array('title'=>$langs->trans("Temporary ticket"), |
|
374 | + if ($conf->global->TAKEPOS_ORDER_PRINTERS) { |
|
375 | + $menus[$r++] = array('title'=>$langs->trans("Temporary ticket"), |
|
376 | 376 | 'action'=>'TakeposPrintingTemp();'); |
377 | 377 | } |
378 | 378 | } |
379 | 379 | |
380 | -if ($conf->global->TAKEPOSCONNECTOR){ |
|
381 | - $menus[$r++]=array('title'=>$langs->trans("DOL_OPEN_DRAWER"), |
|
380 | +if ($conf->global->TAKEPOSCONNECTOR) { |
|
381 | + $menus[$r++] = array('title'=>$langs->trans("DOL_OPEN_DRAWER"), |
|
382 | 382 | 'action'=>'OpenDrawer();'); |
383 | 383 | } |
384 | 384 | ?> |
385 | 385 | <div style="position:absolute; top:1%; left:65.5%; height:37%; width:32.5%;"> |
386 | 386 | <?php |
387 | -foreach($menus as $menu) { |
|
387 | +foreach ($menus as $menu) { |
|
388 | 388 | echo '<button type="button" class="actionbutton" onclick="'.$menu['action'].'">'.$menu['title'].'</button>'; |
389 | 389 | } |
390 | 390 | ?> |
@@ -392,14 +392,14 @@ discard block |
||
392 | 392 | |
393 | 393 | <div style="position:absolute; top:39%; left:0.3%; height:59%; width:32%;"> |
394 | 394 | <?php |
395 | - $count=0; |
|
396 | - while ($count<16) |
|
395 | + $count = 0; |
|
396 | + while ($count < 16) |
|
397 | 397 | { |
398 | 398 | ?> |
399 | - <div class='wrapper' <?php if ($count==14) echo 'onclick="MoreCategories(\'less\');"'; else if ($count==15) echo 'onclick="MoreCategories(\'more\');"'; else echo 'onclick="LoadProducts('.$count.');"';?> id='catdiv<?php echo $count;?>'> |
|
400 | - <img class='imgwrapper' <?php if ($count==14) echo 'src="img/arrow-prev-top.png"'; if ($count==15) echo 'src="img/arrow-next-top.png"';?> width="98%" id='catimg<?php echo $count;?>'/> |
|
399 | + <div class='wrapper' <?php if ($count == 14) echo 'onclick="MoreCategories(\'less\');"'; else if ($count == 15) echo 'onclick="MoreCategories(\'more\');"'; else echo 'onclick="LoadProducts('.$count.');"'; ?> id='catdiv<?php echo $count; ?>'> |
|
400 | + <img class='imgwrapper' <?php if ($count == 14) echo 'src="img/arrow-prev-top.png"'; if ($count == 15) echo 'src="img/arrow-next-top.png"'; ?> width="98%" id='catimg<?php echo $count; ?>'/> |
|
401 | 401 | <div class='description'> |
402 | - <div class='description_content' id='catdesc<?php echo $count;?>'></div> |
|
402 | + <div class='description_content' id='catdesc<?php echo $count; ?>'></div> |
|
403 | 403 | </div> |
404 | 404 | </div> |
405 | 405 | <?php |
@@ -410,14 +410,14 @@ discard block |
||
410 | 410 | |
411 | 411 | <div style="position:absolute; top:39%; left:32%; height:58%; width:72%;"> |
412 | 412 | <?php |
413 | -$count=0; |
|
414 | -while ($count<32) |
|
413 | +$count = 0; |
|
414 | +while ($count < 32) |
|
415 | 415 | { |
416 | 416 | ?> |
417 | - <div class='wrapper2' id='prodiv<?php echo $count;?>' <?php if ($count==30) {?> onclick="MoreProducts('less');" <?php } if ($count==31) {?> onclick="MoreProducts('more');" <?php } else echo 'onclick="ClickProduct('.$count.');"';?>> |
|
418 | - <img class='imgwrapper' <?php if ($count==30) echo 'src="img/arrow-prev-top.png"'; if ($count==31) echo 'src="img/arrow-next-top.png"';?> width="95%" id='proimg<?php echo $count;?>'/> |
|
417 | + <div class='wrapper2' id='prodiv<?php echo $count; ?>' <?php if ($count == 30) {?> onclick="MoreProducts('less');" <?php } if ($count == 31) {?> onclick="MoreProducts('more');" <?php } else echo 'onclick="ClickProduct('.$count.');"'; ?>> |
|
418 | + <img class='imgwrapper' <?php if ($count == 30) echo 'src="img/arrow-prev-top.png"'; if ($count == 31) echo 'src="img/arrow-next-top.png"'; ?> width="95%" id='proimg<?php echo $count; ?>'/> |
|
419 | 419 | <div class='description'> |
420 | - <div class='description_content' id='prodesc<?php echo $count;?>'></div> |
|
420 | + <div class='description_content' id='prodesc<?php echo $count; ?>'></div> |
|
421 | 421 | </div> |
422 | 422 | </div> |
423 | 423 | <?php |
@@ -26,449 +26,449 @@ |
||
26 | 26 | */ |
27 | 27 | class FormAdvTargetEmailing extends Form |
28 | 28 | { |
29 | - /** |
|
29 | + /** |
|
30 | 30 | * @var DoliDB Database handler. |
31 | 31 | */ |
32 | 32 | public $db; |
33 | 33 | |
34 | - /** |
|
35 | - * @var string Error code (or message) |
|
36 | - */ |
|
37 | - public $error=''; |
|
34 | + /** |
|
35 | + * @var string Error code (or message) |
|
36 | + */ |
|
37 | + public $error=''; |
|
38 | 38 | |
39 | - /** |
|
40 | - * Constructor |
|
41 | - * |
|
42 | - * @param DoliDB $db handler |
|
43 | - */ |
|
39 | + /** |
|
40 | + * Constructor |
|
41 | + * |
|
42 | + * @param DoliDB $db handler |
|
43 | + */ |
|
44 | 44 | function __construct($db) |
45 | 45 | { |
46 | - global $langs; |
|
47 | - |
|
48 | - $this->db = $db; |
|
49 | - } |
|
50 | - |
|
51 | - /** |
|
52 | - * Affiche un champs select contenant une liste |
|
53 | - * |
|
54 | - * @param array $selected_array à preselectionner |
|
55 | - * @param string $htmlname select field |
|
56 | - * @return string select field |
|
57 | - */ |
|
46 | + global $langs; |
|
47 | + |
|
48 | + $this->db = $db; |
|
49 | + } |
|
50 | + |
|
51 | + /** |
|
52 | + * Affiche un champs select contenant une liste |
|
53 | + * |
|
54 | + * @param array $selected_array à preselectionner |
|
55 | + * @param string $htmlname select field |
|
56 | + * @return string select field |
|
57 | + */ |
|
58 | 58 | function multiselectProspectionStatus($selected_array = array(), $htmlname = 'cust_prospect_status') |
59 | 59 | { |
60 | - global $conf, $langs; |
|
61 | - $options_array = array(); |
|
62 | - |
|
63 | - $sql = "SELECT code, label"; |
|
64 | - $sql .= " FROM " . MAIN_DB_PREFIX . "c_prospectlevel"; |
|
65 | - $sql .= " WHERE active > 0"; |
|
66 | - $sql .= " ORDER BY sortorder"; |
|
67 | - dol_syslog ( get_class( $this ) . '::multiselectProspectionStatus sql=' . $sql, LOG_DEBUG ); |
|
68 | - $resql = $this->db->query( $sql ); |
|
69 | - if ($resql) { |
|
70 | - $num = $this->db->num_rows( $resql ); |
|
71 | - $i = 0; |
|
72 | - while ( $i < $num ) { |
|
73 | - $obj = $this->db->fetch_object( $resql ); |
|
74 | - |
|
75 | - $level = $langs->trans( $obj->code ); |
|
76 | - if ($level == $obj->code) |
|
77 | - $level = $langs->trans( $obj->label ); |
|
78 | - $options_array[$obj->code] = $level; |
|
79 | - |
|
80 | - $i ++; |
|
81 | - } |
|
82 | - } else { |
|
83 | - dol_print_error($this->db); |
|
84 | - } |
|
85 | - return $this->advMultiselectarray($htmlname, $options_array, $selected_array); |
|
86 | - } |
|
87 | - |
|
88 | - /** |
|
89 | - * Return combo list of activated countries, into language of user |
|
90 | - * |
|
91 | - * @param string $htmlname of html select object |
|
92 | - * @param array $selected_array or Code or Label of preselected country |
|
93 | - * @return string HTML string with select |
|
94 | - */ |
|
60 | + global $conf, $langs; |
|
61 | + $options_array = array(); |
|
62 | + |
|
63 | + $sql = "SELECT code, label"; |
|
64 | + $sql .= " FROM " . MAIN_DB_PREFIX . "c_prospectlevel"; |
|
65 | + $sql .= " WHERE active > 0"; |
|
66 | + $sql .= " ORDER BY sortorder"; |
|
67 | + dol_syslog ( get_class( $this ) . '::multiselectProspectionStatus sql=' . $sql, LOG_DEBUG ); |
|
68 | + $resql = $this->db->query( $sql ); |
|
69 | + if ($resql) { |
|
70 | + $num = $this->db->num_rows( $resql ); |
|
71 | + $i = 0; |
|
72 | + while ( $i < $num ) { |
|
73 | + $obj = $this->db->fetch_object( $resql ); |
|
74 | + |
|
75 | + $level = $langs->trans( $obj->code ); |
|
76 | + if ($level == $obj->code) |
|
77 | + $level = $langs->trans( $obj->label ); |
|
78 | + $options_array[$obj->code] = $level; |
|
79 | + |
|
80 | + $i ++; |
|
81 | + } |
|
82 | + } else { |
|
83 | + dol_print_error($this->db); |
|
84 | + } |
|
85 | + return $this->advMultiselectarray($htmlname, $options_array, $selected_array); |
|
86 | + } |
|
87 | + |
|
88 | + /** |
|
89 | + * Return combo list of activated countries, into language of user |
|
90 | + * |
|
91 | + * @param string $htmlname of html select object |
|
92 | + * @param array $selected_array or Code or Label of preselected country |
|
93 | + * @return string HTML string with select |
|
94 | + */ |
|
95 | 95 | function multiselectCountry($htmlname = 'country_id', $selected_array=array()) |
96 | 96 | { |
97 | - global $conf, $langs; |
|
98 | - |
|
99 | - $langs->load("dict"); |
|
100 | - $maxlength = 0; |
|
101 | - |
|
102 | - $out = ''; |
|
103 | - $countryArray = array(); |
|
104 | - $label = array (); |
|
105 | - |
|
106 | - $options_array = array(); |
|
107 | - |
|
108 | - $sql = "SELECT rowid, code as code_iso, label"; |
|
109 | - $sql .= " FROM " . MAIN_DB_PREFIX . "c_country"; |
|
110 | - $sql .= " WHERE active = 1 AND code<>''"; |
|
111 | - $sql .= " ORDER BY code ASC"; |
|
112 | - |
|
113 | - dol_syslog(get_class($this) . "::select_country sql=" . $sql); |
|
114 | - $resql = $this->db->query($sql); |
|
115 | - if ($resql) { |
|
116 | - |
|
117 | - $num = $this->db->num_rows($resql); |
|
118 | - $i = 0; |
|
119 | - if ($num) { |
|
120 | - $foundselected = false; |
|
121 | - |
|
122 | - while ($i < $num) { |
|
123 | - $obj = $this->db->fetch_object ( $resql ); |
|
124 | - $countryArray [$i] ['rowid'] = $obj->rowid; |
|
125 | - $countryArray [$i] ['code_iso'] = $obj->code_iso; |
|
126 | - $countryArray [$i] ['label'] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country" . $obj->code_iso ) != "Country" . $obj->code_iso ? $langs->transnoentitiesnoconv ( "Country" . $obj->code_iso ) : ($obj->label != '-' ? $obj->label : '')); |
|
127 | - $label[$i] = $countryArray[$i]['label']; |
|
128 | - $i ++; |
|
129 | - } |
|
130 | - |
|
131 | - array_multisort($label, SORT_ASC, $countryArray); |
|
132 | - |
|
133 | - foreach ($countryArray as $row) { |
|
134 | - $label = dol_trunc($row['label'], $maxlength, 'middle'); |
|
135 | - if ($row['code_iso']) |
|
136 | - $label .= ' (' . $row['code_iso'] . ')'; |
|
137 | - |
|
138 | - $options_array[$row['rowid']] = $label; |
|
139 | - } |
|
140 | - } |
|
141 | - } else { |
|
142 | - dol_print_error($this->db); |
|
143 | - } |
|
144 | - |
|
145 | - return $this->advMultiselectarray($htmlname, $options_array, $selected_array); |
|
146 | - } |
|
147 | - |
|
148 | - /** |
|
149 | - * Return select list for categories (to use in form search selectors) |
|
150 | - * |
|
151 | - * @param string $htmlname control name |
|
152 | - * @param array $selected_array array of data |
|
153 | - * @param User $user User action |
|
154 | - * @return string combo list code |
|
155 | - */ |
|
97 | + global $conf, $langs; |
|
98 | + |
|
99 | + $langs->load("dict"); |
|
100 | + $maxlength = 0; |
|
101 | + |
|
102 | + $out = ''; |
|
103 | + $countryArray = array(); |
|
104 | + $label = array (); |
|
105 | + |
|
106 | + $options_array = array(); |
|
107 | + |
|
108 | + $sql = "SELECT rowid, code as code_iso, label"; |
|
109 | + $sql .= " FROM " . MAIN_DB_PREFIX . "c_country"; |
|
110 | + $sql .= " WHERE active = 1 AND code<>''"; |
|
111 | + $sql .= " ORDER BY code ASC"; |
|
112 | + |
|
113 | + dol_syslog(get_class($this) . "::select_country sql=" . $sql); |
|
114 | + $resql = $this->db->query($sql); |
|
115 | + if ($resql) { |
|
116 | + |
|
117 | + $num = $this->db->num_rows($resql); |
|
118 | + $i = 0; |
|
119 | + if ($num) { |
|
120 | + $foundselected = false; |
|
121 | + |
|
122 | + while ($i < $num) { |
|
123 | + $obj = $this->db->fetch_object ( $resql ); |
|
124 | + $countryArray [$i] ['rowid'] = $obj->rowid; |
|
125 | + $countryArray [$i] ['code_iso'] = $obj->code_iso; |
|
126 | + $countryArray [$i] ['label'] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country" . $obj->code_iso ) != "Country" . $obj->code_iso ? $langs->transnoentitiesnoconv ( "Country" . $obj->code_iso ) : ($obj->label != '-' ? $obj->label : '')); |
|
127 | + $label[$i] = $countryArray[$i]['label']; |
|
128 | + $i ++; |
|
129 | + } |
|
130 | + |
|
131 | + array_multisort($label, SORT_ASC, $countryArray); |
|
132 | + |
|
133 | + foreach ($countryArray as $row) { |
|
134 | + $label = dol_trunc($row['label'], $maxlength, 'middle'); |
|
135 | + if ($row['code_iso']) |
|
136 | + $label .= ' (' . $row['code_iso'] . ')'; |
|
137 | + |
|
138 | + $options_array[$row['rowid']] = $label; |
|
139 | + } |
|
140 | + } |
|
141 | + } else { |
|
142 | + dol_print_error($this->db); |
|
143 | + } |
|
144 | + |
|
145 | + return $this->advMultiselectarray($htmlname, $options_array, $selected_array); |
|
146 | + } |
|
147 | + |
|
148 | + /** |
|
149 | + * Return select list for categories (to use in form search selectors) |
|
150 | + * |
|
151 | + * @param string $htmlname control name |
|
152 | + * @param array $selected_array array of data |
|
153 | + * @param User $user User action |
|
154 | + * @return string combo list code |
|
155 | + */ |
|
156 | 156 | function multiselectselectSalesRepresentatives($htmlname, $selected_array, $user) |
157 | 157 | { |
158 | 158 | |
159 | - global $conf; |
|
159 | + global $conf; |
|
160 | 160 | |
161 | - $options_array = array (); |
|
161 | + $options_array = array (); |
|
162 | 162 | |
163 | 163 | $sql_usr = ''; |
164 | - $sql_usr .= "SELECT DISTINCT u2.rowid, u2.lastname as name, u2.firstname, u2.login"; |
|
165 | - $sql_usr .= " FROM " . MAIN_DB_PREFIX . "user as u2, " . MAIN_DB_PREFIX . "societe_commerciaux as sc"; |
|
166 | - $sql_usr .= " WHERE u2.entity IN (0," . $conf->entity . ")"; |
|
167 | - $sql_usr .= " AND u2.rowid = sc.fk_user "; |
|
168 | - |
|
169 | - if (! empty ( $conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX )) |
|
170 | - $sql_usr .= " AND u2.statut<>0 "; |
|
171 | - $sql_usr .= " ORDER BY name ASC"; |
|
172 | - // print $sql_usr;exit; |
|
173 | - |
|
174 | - $resql_usr = $this->db->query ( $sql_usr ); |
|
175 | - if ($resql_usr) { |
|
176 | - while ( $obj_usr = $this->db->fetch_object ( $resql_usr ) ) { |
|
177 | - |
|
178 | - $label = $obj_usr->firstname . " " . $obj_usr->name . " (" . $obj_usr->login . ')'; |
|
179 | - |
|
180 | - $options_array [$obj_usr->rowid] = $label; |
|
181 | - } |
|
182 | - $this->db->free ( $resql_usr ); |
|
183 | - } else { |
|
184 | - dol_print_error ( $this->db ); |
|
185 | - } |
|
186 | - |
|
187 | - return $this->advMultiselectarray ( $htmlname, $options_array, $selected_array ); |
|
188 | - } |
|
189 | - |
|
190 | - /** |
|
191 | - * Return select list for categories (to use in form search selectors) |
|
192 | - * |
|
193 | - * @param string $htmlname of combo list (example: 'search_sale') |
|
194 | - * @param array $selected_array selected array |
|
195 | - * @return string combo list code |
|
196 | - */ |
|
164 | + $sql_usr .= "SELECT DISTINCT u2.rowid, u2.lastname as name, u2.firstname, u2.login"; |
|
165 | + $sql_usr .= " FROM " . MAIN_DB_PREFIX . "user as u2, " . MAIN_DB_PREFIX . "societe_commerciaux as sc"; |
|
166 | + $sql_usr .= " WHERE u2.entity IN (0," . $conf->entity . ")"; |
|
167 | + $sql_usr .= " AND u2.rowid = sc.fk_user "; |
|
168 | + |
|
169 | + if (! empty ( $conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX )) |
|
170 | + $sql_usr .= " AND u2.statut<>0 "; |
|
171 | + $sql_usr .= " ORDER BY name ASC"; |
|
172 | + // print $sql_usr;exit; |
|
173 | + |
|
174 | + $resql_usr = $this->db->query ( $sql_usr ); |
|
175 | + if ($resql_usr) { |
|
176 | + while ( $obj_usr = $this->db->fetch_object ( $resql_usr ) ) { |
|
177 | + |
|
178 | + $label = $obj_usr->firstname . " " . $obj_usr->name . " (" . $obj_usr->login . ')'; |
|
179 | + |
|
180 | + $options_array [$obj_usr->rowid] = $label; |
|
181 | + } |
|
182 | + $this->db->free ( $resql_usr ); |
|
183 | + } else { |
|
184 | + dol_print_error ( $this->db ); |
|
185 | + } |
|
186 | + |
|
187 | + return $this->advMultiselectarray ( $htmlname, $options_array, $selected_array ); |
|
188 | + } |
|
189 | + |
|
190 | + /** |
|
191 | + * Return select list for categories (to use in form search selectors) |
|
192 | + * |
|
193 | + * @param string $htmlname of combo list (example: 'search_sale') |
|
194 | + * @param array $selected_array selected array |
|
195 | + * @return string combo list code |
|
196 | + */ |
|
197 | 197 | function multiselectselectLanguage($htmlname='', $selected_array=array()) |
198 | 198 | { |
199 | 199 | |
200 | - global $conf,$langs; |
|
201 | - |
|
202 | - $options_array = array (); |
|
203 | - |
|
204 | - $langs_available=$langs->get_available_languages(DOL_DOCUMENT_ROOT,12); |
|
205 | - |
|
206 | - foreach ($langs_available as $key => $value) |
|
207 | - { |
|
208 | - $label = $value; |
|
209 | - $options_array[$key] = $label; |
|
210 | - } |
|
211 | - asort($options_array); |
|
212 | - return $this->advMultiselectarray($htmlname, $options_array, $selected_array); |
|
213 | - } |
|
214 | - |
|
215 | - /** |
|
216 | - * Return multiselect list of entities for extrafeild type sellist |
|
217 | - * |
|
218 | - * @param string $htmlname control name |
|
219 | - * @param array $sqlqueryparam array |
|
220 | - * @param array $selected_array array |
|
221 | - * |
|
222 | - * @return string HTML combo |
|
223 | - */ |
|
224 | - function advMultiselectarraySelllist($htmlname, $sqlqueryparam = array(), $selected_array = array()) |
|
225 | - { |
|
226 | - $options_array=array(); |
|
227 | - |
|
228 | - if (is_array($sqlqueryparam)) |
|
229 | - { |
|
230 | - $param_list = array_keys ( $sqlqueryparam ); |
|
231 | - $InfoFieldList = explode ( ":", $param_list [0] ); |
|
232 | - |
|
233 | - // 0 1 : tableName |
|
234 | - // 1 2 : label field name Nom du champ contenant le libelle |
|
235 | - // 2 3 : key fields name (if differ of rowid) |
|
236 | - // 3 4 : where clause filter on column or table extrafield, syntax field='value' or extra.field=value |
|
237 | - |
|
238 | - $keyList = 'rowid'; |
|
239 | - |
|
240 | - if (count ( $InfoFieldList ) >= 3) { |
|
241 | - if (strpos ( $InfoFieldList [3], 'extra.' ) !== false) { |
|
242 | - $keyList = 'main.' . $InfoFieldList [2] . ' as rowid'; |
|
243 | - } else { |
|
244 | - $keyList = $InfoFieldList [2] . ' as rowid'; |
|
245 | - } |
|
246 | - } |
|
247 | - |
|
248 | - $sql = 'SELECT ' . $keyList . ', ' . $InfoFieldList [1]; |
|
249 | - $sql .= ' FROM ' . MAIN_DB_PREFIX . $InfoFieldList [0]; |
|
250 | - if (! empty ( $InfoFieldList [3] )) { |
|
251 | - |
|
252 | - // We have to join on extrafield table |
|
253 | - if (strpos ( $InfoFieldList [3], 'extra' ) !== false) { |
|
254 | - $sql .= ' as main, ' . MAIN_DB_PREFIX . $InfoFieldList [0] . '_extrafields as extra'; |
|
255 | - $sql .= ' WHERE extra.fk_object=main.' . $InfoFieldList [2] . ' AND ' . $InfoFieldList [3]; |
|
256 | - } else { |
|
257 | - $sql .= ' WHERE ' . $InfoFieldList [3]; |
|
258 | - } |
|
259 | - } |
|
260 | - if (! empty($InfoFieldList[1])) { |
|
261 | - $sql .= " ORDER BY nom"; |
|
262 | - } |
|
263 | - // $sql.= ' WHERE entity = '.$conf->entity; |
|
264 | - |
|
265 | - dol_syslog(get_class($this) . "::".__METHOD__,LOG_DEBUG); |
|
266 | - $resql = $this->db->query($sql); |
|
267 | - if ($resql) { |
|
268 | - |
|
269 | - $num = $this->db->num_rows($resql); |
|
270 | - $i = 0; |
|
271 | - if ($num) { |
|
272 | - while ( $i < $num ) { |
|
273 | - $obj = $this->db->fetch_object ( $resql ); |
|
274 | - $labeltoshow = dol_trunc ( $obj->$InfoFieldList [1], 90 ); |
|
275 | - $options_array[$obj->rowid]=$labeltoshow; |
|
276 | - $i ++; |
|
277 | - } |
|
278 | - } |
|
279 | - $this->db->free ( $resql ); |
|
280 | - } |
|
281 | - } |
|
282 | - |
|
283 | - return $this->advMultiselectarray($htmlname, $options_array, $selected_array); |
|
284 | - } |
|
285 | - |
|
286 | - /** |
|
287 | - * Return combo list with people title |
|
288 | - * |
|
289 | - * @param string $htmlname Name of HTML select combo field |
|
290 | - * @param array $selected_array Array |
|
291 | - * @return string HTML combo |
|
292 | - */ |
|
293 | - function multiselectCivility($htmlname='civilite_id',$selected_array = array()) |
|
294 | - { |
|
295 | - global $conf,$langs,$user; |
|
296 | - $langs->load("dict"); |
|
297 | - |
|
298 | - $options_array=array(); |
|
299 | - |
|
300 | - |
|
301 | - $sql = "SELECT rowid, code, label as civilite, active FROM ".MAIN_DB_PREFIX."c_civility"; |
|
302 | - $sql.= " WHERE active = 1"; |
|
303 | - |
|
304 | - dol_syslog(get_class($this)."::".__METHOD__,LOG_DEBUG); |
|
305 | - $resql=$this->db->query($sql); |
|
306 | - if ($resql) |
|
307 | - { |
|
308 | - |
|
309 | - $num = $this->db->num_rows($resql); |
|
310 | - $i = 0; |
|
311 | - if ($num) |
|
312 | - { |
|
313 | - while ($i < $num) |
|
314 | - { |
|
315 | - $obj = $this->db->fetch_object($resql); |
|
316 | - // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut |
|
317 | - $label= ($langs->trans("Civility".$obj->code)!="Civility".$obj->code ? $langs->trans("Civility".$obj->code) : ($obj->civilite!='-'?$obj->civilite:'')); |
|
318 | - |
|
319 | - |
|
320 | - $options_array[$obj->code]=$label; |
|
321 | - |
|
322 | - $i++; |
|
323 | - } |
|
324 | - } |
|
325 | - } |
|
326 | - else |
|
327 | - { |
|
328 | - dol_print_error($this->db); |
|
329 | - } |
|
330 | - |
|
331 | - return $this->advMultiselectarray ( $htmlname, $options_array, $selected_array ); |
|
332 | - } |
|
333 | - |
|
334 | - /** |
|
335 | - * Return multiselect list of entities. |
|
336 | - * |
|
337 | - * @param string $htmlname select |
|
338 | - * @param array $options_array to manage |
|
339 | - * @param array $selected_array to manage |
|
340 | - * @param int $showempty show empty |
|
341 | - * @return string HTML combo |
|
342 | - */ |
|
200 | + global $conf,$langs; |
|
201 | + |
|
202 | + $options_array = array (); |
|
203 | + |
|
204 | + $langs_available=$langs->get_available_languages(DOL_DOCUMENT_ROOT,12); |
|
205 | + |
|
206 | + foreach ($langs_available as $key => $value) |
|
207 | + { |
|
208 | + $label = $value; |
|
209 | + $options_array[$key] = $label; |
|
210 | + } |
|
211 | + asort($options_array); |
|
212 | + return $this->advMultiselectarray($htmlname, $options_array, $selected_array); |
|
213 | + } |
|
214 | + |
|
215 | + /** |
|
216 | + * Return multiselect list of entities for extrafeild type sellist |
|
217 | + * |
|
218 | + * @param string $htmlname control name |
|
219 | + * @param array $sqlqueryparam array |
|
220 | + * @param array $selected_array array |
|
221 | + * |
|
222 | + * @return string HTML combo |
|
223 | + */ |
|
224 | + function advMultiselectarraySelllist($htmlname, $sqlqueryparam = array(), $selected_array = array()) |
|
225 | + { |
|
226 | + $options_array=array(); |
|
227 | + |
|
228 | + if (is_array($sqlqueryparam)) |
|
229 | + { |
|
230 | + $param_list = array_keys ( $sqlqueryparam ); |
|
231 | + $InfoFieldList = explode ( ":", $param_list [0] ); |
|
232 | + |
|
233 | + // 0 1 : tableName |
|
234 | + // 1 2 : label field name Nom du champ contenant le libelle |
|
235 | + // 2 3 : key fields name (if differ of rowid) |
|
236 | + // 3 4 : where clause filter on column or table extrafield, syntax field='value' or extra.field=value |
|
237 | + |
|
238 | + $keyList = 'rowid'; |
|
239 | + |
|
240 | + if (count ( $InfoFieldList ) >= 3) { |
|
241 | + if (strpos ( $InfoFieldList [3], 'extra.' ) !== false) { |
|
242 | + $keyList = 'main.' . $InfoFieldList [2] . ' as rowid'; |
|
243 | + } else { |
|
244 | + $keyList = $InfoFieldList [2] . ' as rowid'; |
|
245 | + } |
|
246 | + } |
|
247 | + |
|
248 | + $sql = 'SELECT ' . $keyList . ', ' . $InfoFieldList [1]; |
|
249 | + $sql .= ' FROM ' . MAIN_DB_PREFIX . $InfoFieldList [0]; |
|
250 | + if (! empty ( $InfoFieldList [3] )) { |
|
251 | + |
|
252 | + // We have to join on extrafield table |
|
253 | + if (strpos ( $InfoFieldList [3], 'extra' ) !== false) { |
|
254 | + $sql .= ' as main, ' . MAIN_DB_PREFIX . $InfoFieldList [0] . '_extrafields as extra'; |
|
255 | + $sql .= ' WHERE extra.fk_object=main.' . $InfoFieldList [2] . ' AND ' . $InfoFieldList [3]; |
|
256 | + } else { |
|
257 | + $sql .= ' WHERE ' . $InfoFieldList [3]; |
|
258 | + } |
|
259 | + } |
|
260 | + if (! empty($InfoFieldList[1])) { |
|
261 | + $sql .= " ORDER BY nom"; |
|
262 | + } |
|
263 | + // $sql.= ' WHERE entity = '.$conf->entity; |
|
264 | + |
|
265 | + dol_syslog(get_class($this) . "::".__METHOD__,LOG_DEBUG); |
|
266 | + $resql = $this->db->query($sql); |
|
267 | + if ($resql) { |
|
268 | + |
|
269 | + $num = $this->db->num_rows($resql); |
|
270 | + $i = 0; |
|
271 | + if ($num) { |
|
272 | + while ( $i < $num ) { |
|
273 | + $obj = $this->db->fetch_object ( $resql ); |
|
274 | + $labeltoshow = dol_trunc ( $obj->$InfoFieldList [1], 90 ); |
|
275 | + $options_array[$obj->rowid]=$labeltoshow; |
|
276 | + $i ++; |
|
277 | + } |
|
278 | + } |
|
279 | + $this->db->free ( $resql ); |
|
280 | + } |
|
281 | + } |
|
282 | + |
|
283 | + return $this->advMultiselectarray($htmlname, $options_array, $selected_array); |
|
284 | + } |
|
285 | + |
|
286 | + /** |
|
287 | + * Return combo list with people title |
|
288 | + * |
|
289 | + * @param string $htmlname Name of HTML select combo field |
|
290 | + * @param array $selected_array Array |
|
291 | + * @return string HTML combo |
|
292 | + */ |
|
293 | + function multiselectCivility($htmlname='civilite_id',$selected_array = array()) |
|
294 | + { |
|
295 | + global $conf,$langs,$user; |
|
296 | + $langs->load("dict"); |
|
297 | + |
|
298 | + $options_array=array(); |
|
299 | + |
|
300 | + |
|
301 | + $sql = "SELECT rowid, code, label as civilite, active FROM ".MAIN_DB_PREFIX."c_civility"; |
|
302 | + $sql.= " WHERE active = 1"; |
|
303 | + |
|
304 | + dol_syslog(get_class($this)."::".__METHOD__,LOG_DEBUG); |
|
305 | + $resql=$this->db->query($sql); |
|
306 | + if ($resql) |
|
307 | + { |
|
308 | + |
|
309 | + $num = $this->db->num_rows($resql); |
|
310 | + $i = 0; |
|
311 | + if ($num) |
|
312 | + { |
|
313 | + while ($i < $num) |
|
314 | + { |
|
315 | + $obj = $this->db->fetch_object($resql); |
|
316 | + // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut |
|
317 | + $label= ($langs->trans("Civility".$obj->code)!="Civility".$obj->code ? $langs->trans("Civility".$obj->code) : ($obj->civilite!='-'?$obj->civilite:'')); |
|
318 | + |
|
319 | + |
|
320 | + $options_array[$obj->code]=$label; |
|
321 | + |
|
322 | + $i++; |
|
323 | + } |
|
324 | + } |
|
325 | + } |
|
326 | + else |
|
327 | + { |
|
328 | + dol_print_error($this->db); |
|
329 | + } |
|
330 | + |
|
331 | + return $this->advMultiselectarray ( $htmlname, $options_array, $selected_array ); |
|
332 | + } |
|
333 | + |
|
334 | + /** |
|
335 | + * Return multiselect list of entities. |
|
336 | + * |
|
337 | + * @param string $htmlname select |
|
338 | + * @param array $options_array to manage |
|
339 | + * @param array $selected_array to manage |
|
340 | + * @param int $showempty show empty |
|
341 | + * @return string HTML combo |
|
342 | + */ |
|
343 | 343 | function advMultiselectarray($htmlname, $options_array = array(), $selected_array = array(), $showempty = 0) |
344 | 344 | { |
345 | - global $conf, $langs; |
|
346 | - |
|
347 | - $form=new Form($this->db); |
|
348 | - $return = $form->multiselectarray($htmlname, $options_array, $selected_array,0,0,'',0,295); |
|
349 | - return $return; |
|
350 | - } |
|
351 | - |
|
352 | - /** |
|
353 | - * Return combo list with customer categories |
|
354 | - * |
|
355 | - * @param string $htmlname Name of categorie |
|
356 | - * @param array $selected_array value selected |
|
357 | - * @return string HTML combo |
|
358 | - */ |
|
359 | - function multiselectCustomerCategories($htmlname='cust_cat',$selected_array = array()) |
|
360 | - { |
|
361 | - return $this->multiselectCategories($htmlname,$selected_array,2); |
|
362 | - } |
|
363 | - |
|
364 | - /** |
|
365 | - * Return combo list with customer contact |
|
366 | - * |
|
367 | - * @param string $htmlname Name of categorie |
|
368 | - * @param array $selected_array value selected |
|
369 | - * @return string HTML combo |
|
370 | - */ |
|
371 | - function multiselectContactCategories($htmlname='contact_cat',$selected_array = array()) |
|
372 | - { |
|
373 | - return $this->multiselectCategories($htmlname,$selected_array,4); |
|
374 | - } |
|
375 | - |
|
376 | - /** |
|
377 | - * Return combo list of categories |
|
378 | - * |
|
379 | - * @param string $htmlname Name of categorie |
|
380 | - * @param array $selected_array Value selected |
|
381 | - * @param int $type Type |
|
382 | - * @return string HTML combo |
|
383 | - */ |
|
384 | - public function multiselectCategories($htmlname='',$selected_array = array(), $type=0) |
|
385 | - { |
|
386 | - global $conf,$langs,$user; |
|
387 | - $langs->load("dict"); |
|
388 | - |
|
389 | - $options_array=array(); |
|
390 | - |
|
391 | - $sql = "SELECT rowid, label FROM ".MAIN_DB_PREFIX."categorie"; |
|
392 | - $sql.= " WHERE type=".$type; |
|
393 | - |
|
394 | - dol_syslog(get_class($this)."::".__METHOD__,LOG_DEBUG); |
|
395 | - $resql=$this->db->query($sql); |
|
396 | - if ($resql) |
|
397 | - { |
|
398 | - |
|
399 | - $num = $this->db->num_rows($resql); |
|
400 | - $i = 0; |
|
401 | - if ($num) |
|
402 | - { |
|
403 | - while ($i < $num) |
|
404 | - { |
|
405 | - $obj = $this->db->fetch_object($resql); |
|
406 | - |
|
407 | - $options_array[$obj->rowid]=$obj->label; |
|
408 | - |
|
409 | - $i++; |
|
410 | - } |
|
411 | - } |
|
412 | - } |
|
413 | - else |
|
414 | - { |
|
415 | - dol_print_error($this->db); |
|
416 | - } |
|
417 | - |
|
418 | - return $this->advMultiselectarray( $htmlname, $options_array, $selected_array ); |
|
419 | - } |
|
420 | - |
|
421 | - /** |
|
422 | - * Return a combo list to select emailing target selector |
|
423 | - * |
|
424 | - * @param string $htmlname control name |
|
425 | - * @param integer $selected defaut selected |
|
426 | - * @param integer $showempty empty lines |
|
427 | - * @param string $type_element Type element. Example: 'mailing' |
|
428 | - * @return string HTML combo |
|
429 | - */ |
|
345 | + global $conf, $langs; |
|
346 | + |
|
347 | + $form=new Form($this->db); |
|
348 | + $return = $form->multiselectarray($htmlname, $options_array, $selected_array,0,0,'',0,295); |
|
349 | + return $return; |
|
350 | + } |
|
351 | + |
|
352 | + /** |
|
353 | + * Return combo list with customer categories |
|
354 | + * |
|
355 | + * @param string $htmlname Name of categorie |
|
356 | + * @param array $selected_array value selected |
|
357 | + * @return string HTML combo |
|
358 | + */ |
|
359 | + function multiselectCustomerCategories($htmlname='cust_cat',$selected_array = array()) |
|
360 | + { |
|
361 | + return $this->multiselectCategories($htmlname,$selected_array,2); |
|
362 | + } |
|
363 | + |
|
364 | + /** |
|
365 | + * Return combo list with customer contact |
|
366 | + * |
|
367 | + * @param string $htmlname Name of categorie |
|
368 | + * @param array $selected_array value selected |
|
369 | + * @return string HTML combo |
|
370 | + */ |
|
371 | + function multiselectContactCategories($htmlname='contact_cat',$selected_array = array()) |
|
372 | + { |
|
373 | + return $this->multiselectCategories($htmlname,$selected_array,4); |
|
374 | + } |
|
375 | + |
|
376 | + /** |
|
377 | + * Return combo list of categories |
|
378 | + * |
|
379 | + * @param string $htmlname Name of categorie |
|
380 | + * @param array $selected_array Value selected |
|
381 | + * @param int $type Type |
|
382 | + * @return string HTML combo |
|
383 | + */ |
|
384 | + public function multiselectCategories($htmlname='',$selected_array = array(), $type=0) |
|
385 | + { |
|
386 | + global $conf,$langs,$user; |
|
387 | + $langs->load("dict"); |
|
388 | + |
|
389 | + $options_array=array(); |
|
390 | + |
|
391 | + $sql = "SELECT rowid, label FROM ".MAIN_DB_PREFIX."categorie"; |
|
392 | + $sql.= " WHERE type=".$type; |
|
393 | + |
|
394 | + dol_syslog(get_class($this)."::".__METHOD__,LOG_DEBUG); |
|
395 | + $resql=$this->db->query($sql); |
|
396 | + if ($resql) |
|
397 | + { |
|
398 | + |
|
399 | + $num = $this->db->num_rows($resql); |
|
400 | + $i = 0; |
|
401 | + if ($num) |
|
402 | + { |
|
403 | + while ($i < $num) |
|
404 | + { |
|
405 | + $obj = $this->db->fetch_object($resql); |
|
406 | + |
|
407 | + $options_array[$obj->rowid]=$obj->label; |
|
408 | + |
|
409 | + $i++; |
|
410 | + } |
|
411 | + } |
|
412 | + } |
|
413 | + else |
|
414 | + { |
|
415 | + dol_print_error($this->db); |
|
416 | + } |
|
417 | + |
|
418 | + return $this->advMultiselectarray( $htmlname, $options_array, $selected_array ); |
|
419 | + } |
|
420 | + |
|
421 | + /** |
|
422 | + * Return a combo list to select emailing target selector |
|
423 | + * |
|
424 | + * @param string $htmlname control name |
|
425 | + * @param integer $selected defaut selected |
|
426 | + * @param integer $showempty empty lines |
|
427 | + * @param string $type_element Type element. Example: 'mailing' |
|
428 | + * @return string HTML combo |
|
429 | + */ |
|
430 | 430 | public function selectAdvtargetemailingTemplate($htmlname='template_id', $selected=0, $showempty=0, $type_element='mailing') |
431 | 431 | { |
432 | - global $conf, $user, $langs; |
|
433 | - |
|
434 | - $out = ''; |
|
435 | - |
|
436 | - $sql = "SELECT c.rowid, c.name, c.fk_element"; |
|
437 | - $sql .= " FROM " . MAIN_DB_PREFIX . "advtargetemailing as c"; |
|
438 | - $sql .= " WHERE type_element='$type_element'"; |
|
439 | - $sql .= " ORDER BY c.name"; |
|
440 | - |
|
441 | - dol_syslog ( get_class ( $this ) . "::".__METHOD__, LOG_DEBUG ); |
|
442 | - $resql = $this->db->query ( $sql ); |
|
443 | - if ($resql) { |
|
444 | - |
|
445 | - |
|
446 | - $out .= '<select id="' . $htmlname . '" class="flat" name="' . $htmlname . '">'; |
|
447 | - if ($showempty) |
|
448 | - $out .= '<option value=""></option>'; |
|
449 | - $num = $this->db->num_rows ( $resql ); |
|
450 | - $i = 0; |
|
451 | - if ($num) { |
|
452 | - while ( $i < $num ) { |
|
453 | - $obj = $this->db->fetch_object ( $resql ); |
|
454 | - $label = $obj->name; |
|
455 | - if (empty($label)) { |
|
456 | - $label=$obj->fk_element; |
|
457 | - } |
|
458 | - |
|
459 | - if ($selected > 0 && $selected == $obj->rowid) { |
|
460 | - $out .= '<option value="' . $obj->rowid . '" selected="selected">' . $label . '</option>'; |
|
461 | - } else { |
|
462 | - $out .= '<option value="' . $obj->rowid . '">' . $label . '</option>'; |
|
463 | - } |
|
464 | - $i ++; |
|
465 | - } |
|
466 | - } |
|
467 | - $out .= '</select>'; |
|
468 | - } else { |
|
469 | - dol_print_error ( $this->db ); |
|
470 | - } |
|
471 | - $this->db->free ( $resql ); |
|
472 | - return $out; |
|
473 | - } |
|
432 | + global $conf, $user, $langs; |
|
433 | + |
|
434 | + $out = ''; |
|
435 | + |
|
436 | + $sql = "SELECT c.rowid, c.name, c.fk_element"; |
|
437 | + $sql .= " FROM " . MAIN_DB_PREFIX . "advtargetemailing as c"; |
|
438 | + $sql .= " WHERE type_element='$type_element'"; |
|
439 | + $sql .= " ORDER BY c.name"; |
|
440 | + |
|
441 | + dol_syslog ( get_class ( $this ) . "::".__METHOD__, LOG_DEBUG ); |
|
442 | + $resql = $this->db->query ( $sql ); |
|
443 | + if ($resql) { |
|
444 | + |
|
445 | + |
|
446 | + $out .= '<select id="' . $htmlname . '" class="flat" name="' . $htmlname . '">'; |
|
447 | + if ($showempty) |
|
448 | + $out .= '<option value=""></option>'; |
|
449 | + $num = $this->db->num_rows ( $resql ); |
|
450 | + $i = 0; |
|
451 | + if ($num) { |
|
452 | + while ( $i < $num ) { |
|
453 | + $obj = $this->db->fetch_object ( $resql ); |
|
454 | + $label = $obj->name; |
|
455 | + if (empty($label)) { |
|
456 | + $label=$obj->fk_element; |
|
457 | + } |
|
458 | + |
|
459 | + if ($selected > 0 && $selected == $obj->rowid) { |
|
460 | + $out .= '<option value="' . $obj->rowid . '" selected="selected">' . $label . '</option>'; |
|
461 | + } else { |
|
462 | + $out .= '<option value="' . $obj->rowid . '">' . $label . '</option>'; |
|
463 | + } |
|
464 | + $i ++; |
|
465 | + } |
|
466 | + } |
|
467 | + $out .= '</select>'; |
|
468 | + } else { |
|
469 | + dol_print_error ( $this->db ); |
|
470 | + } |
|
471 | + $this->db->free ( $resql ); |
|
472 | + return $out; |
|
473 | + } |
|
474 | 474 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | /** |
35 | 35 | * @var string Error code (or message) |
36 | 36 | */ |
37 | - public $error=''; |
|
37 | + public $error = ''; |
|
38 | 38 | |
39 | 39 | /** |
40 | 40 | * Constructor |
@@ -61,23 +61,23 @@ discard block |
||
61 | 61 | $options_array = array(); |
62 | 62 | |
63 | 63 | $sql = "SELECT code, label"; |
64 | - $sql .= " FROM " . MAIN_DB_PREFIX . "c_prospectlevel"; |
|
64 | + $sql .= " FROM ".MAIN_DB_PREFIX."c_prospectlevel"; |
|
65 | 65 | $sql .= " WHERE active > 0"; |
66 | 66 | $sql .= " ORDER BY sortorder"; |
67 | - dol_syslog ( get_class( $this ) . '::multiselectProspectionStatus sql=' . $sql, LOG_DEBUG ); |
|
68 | - $resql = $this->db->query( $sql ); |
|
67 | + dol_syslog(get_class($this).'::multiselectProspectionStatus sql='.$sql, LOG_DEBUG); |
|
68 | + $resql = $this->db->query($sql); |
|
69 | 69 | if ($resql) { |
70 | - $num = $this->db->num_rows( $resql ); |
|
70 | + $num = $this->db->num_rows($resql); |
|
71 | 71 | $i = 0; |
72 | - while ( $i < $num ) { |
|
73 | - $obj = $this->db->fetch_object( $resql ); |
|
72 | + while ($i < $num) { |
|
73 | + $obj = $this->db->fetch_object($resql); |
|
74 | 74 | |
75 | - $level = $langs->trans( $obj->code ); |
|
75 | + $level = $langs->trans($obj->code); |
|
76 | 76 | if ($level == $obj->code) |
77 | - $level = $langs->trans( $obj->label ); |
|
77 | + $level = $langs->trans($obj->label); |
|
78 | 78 | $options_array[$obj->code] = $level; |
79 | 79 | |
80 | - $i ++; |
|
80 | + $i++; |
|
81 | 81 | } |
82 | 82 | } else { |
83 | 83 | dol_print_error($this->db); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | * @param array $selected_array or Code or Label of preselected country |
93 | 93 | * @return string HTML string with select |
94 | 94 | */ |
95 | - function multiselectCountry($htmlname = 'country_id', $selected_array=array()) |
|
95 | + function multiselectCountry($htmlname = 'country_id', $selected_array = array()) |
|
96 | 96 | { |
97 | 97 | global $conf, $langs; |
98 | 98 | |
@@ -101,16 +101,16 @@ discard block |
||
101 | 101 | |
102 | 102 | $out = ''; |
103 | 103 | $countryArray = array(); |
104 | - $label = array (); |
|
104 | + $label = array(); |
|
105 | 105 | |
106 | 106 | $options_array = array(); |
107 | 107 | |
108 | 108 | $sql = "SELECT rowid, code as code_iso, label"; |
109 | - $sql .= " FROM " . MAIN_DB_PREFIX . "c_country"; |
|
109 | + $sql .= " FROM ".MAIN_DB_PREFIX."c_country"; |
|
110 | 110 | $sql .= " WHERE active = 1 AND code<>''"; |
111 | 111 | $sql .= " ORDER BY code ASC"; |
112 | 112 | |
113 | - dol_syslog(get_class($this) . "::select_country sql=" . $sql); |
|
113 | + dol_syslog(get_class($this)."::select_country sql=".$sql); |
|
114 | 114 | $resql = $this->db->query($sql); |
115 | 115 | if ($resql) { |
116 | 116 | |
@@ -120,12 +120,12 @@ discard block |
||
120 | 120 | $foundselected = false; |
121 | 121 | |
122 | 122 | while ($i < $num) { |
123 | - $obj = $this->db->fetch_object ( $resql ); |
|
123 | + $obj = $this->db->fetch_object($resql); |
|
124 | 124 | $countryArray [$i] ['rowid'] = $obj->rowid; |
125 | 125 | $countryArray [$i] ['code_iso'] = $obj->code_iso; |
126 | - $countryArray [$i] ['label'] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country" . $obj->code_iso ) != "Country" . $obj->code_iso ? $langs->transnoentitiesnoconv ( "Country" . $obj->code_iso ) : ($obj->label != '-' ? $obj->label : '')); |
|
126 | + $countryArray [$i] ['label'] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country".$obj->code_iso) != "Country".$obj->code_iso ? $langs->transnoentitiesnoconv("Country".$obj->code_iso) : ($obj->label != '-' ? $obj->label : '')); |
|
127 | 127 | $label[$i] = $countryArray[$i]['label']; |
128 | - $i ++; |
|
128 | + $i++; |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | array_multisort($label, SORT_ASC, $countryArray); |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | foreach ($countryArray as $row) { |
134 | 134 | $label = dol_trunc($row['label'], $maxlength, 'middle'); |
135 | 135 | if ($row['code_iso']) |
136 | - $label .= ' (' . $row['code_iso'] . ')'; |
|
136 | + $label .= ' ('.$row['code_iso'].')'; |
|
137 | 137 | |
138 | 138 | $options_array[$row['rowid']] = $label; |
139 | 139 | } |
@@ -158,33 +158,33 @@ discard block |
||
158 | 158 | |
159 | 159 | global $conf; |
160 | 160 | |
161 | - $options_array = array (); |
|
161 | + $options_array = array(); |
|
162 | 162 | |
163 | - $sql_usr = ''; |
|
163 | + $sql_usr = ''; |
|
164 | 164 | $sql_usr .= "SELECT DISTINCT u2.rowid, u2.lastname as name, u2.firstname, u2.login"; |
165 | - $sql_usr .= " FROM " . MAIN_DB_PREFIX . "user as u2, " . MAIN_DB_PREFIX . "societe_commerciaux as sc"; |
|
166 | - $sql_usr .= " WHERE u2.entity IN (0," . $conf->entity . ")"; |
|
165 | + $sql_usr .= " FROM ".MAIN_DB_PREFIX."user as u2, ".MAIN_DB_PREFIX."societe_commerciaux as sc"; |
|
166 | + $sql_usr .= " WHERE u2.entity IN (0,".$conf->entity.")"; |
|
167 | 167 | $sql_usr .= " AND u2.rowid = sc.fk_user "; |
168 | 168 | |
169 | - if (! empty ( $conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX )) |
|
169 | + if (!empty ($conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX)) |
|
170 | 170 | $sql_usr .= " AND u2.statut<>0 "; |
171 | 171 | $sql_usr .= " ORDER BY name ASC"; |
172 | 172 | // print $sql_usr;exit; |
173 | 173 | |
174 | - $resql_usr = $this->db->query ( $sql_usr ); |
|
174 | + $resql_usr = $this->db->query($sql_usr); |
|
175 | 175 | if ($resql_usr) { |
176 | - while ( $obj_usr = $this->db->fetch_object ( $resql_usr ) ) { |
|
176 | + while ($obj_usr = $this->db->fetch_object($resql_usr)) { |
|
177 | 177 | |
178 | - $label = $obj_usr->firstname . " " . $obj_usr->name . " (" . $obj_usr->login . ')'; |
|
178 | + $label = $obj_usr->firstname." ".$obj_usr->name." (".$obj_usr->login.')'; |
|
179 | 179 | |
180 | 180 | $options_array [$obj_usr->rowid] = $label; |
181 | 181 | } |
182 | - $this->db->free ( $resql_usr ); |
|
182 | + $this->db->free($resql_usr); |
|
183 | 183 | } else { |
184 | - dol_print_error ( $this->db ); |
|
184 | + dol_print_error($this->db); |
|
185 | 185 | } |
186 | 186 | |
187 | - return $this->advMultiselectarray ( $htmlname, $options_array, $selected_array ); |
|
187 | + return $this->advMultiselectarray($htmlname, $options_array, $selected_array); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | /** |
@@ -194,14 +194,14 @@ discard block |
||
194 | 194 | * @param array $selected_array selected array |
195 | 195 | * @return string combo list code |
196 | 196 | */ |
197 | - function multiselectselectLanguage($htmlname='', $selected_array=array()) |
|
197 | + function multiselectselectLanguage($htmlname = '', $selected_array = array()) |
|
198 | 198 | { |
199 | 199 | |
200 | - global $conf,$langs; |
|
200 | + global $conf, $langs; |
|
201 | 201 | |
202 | - $options_array = array (); |
|
202 | + $options_array = array(); |
|
203 | 203 | |
204 | - $langs_available=$langs->get_available_languages(DOL_DOCUMENT_ROOT,12); |
|
204 | + $langs_available = $langs->get_available_languages(DOL_DOCUMENT_ROOT, 12); |
|
205 | 205 | |
206 | 206 | foreach ($langs_available as $key => $value) |
207 | 207 | { |
@@ -223,12 +223,12 @@ discard block |
||
223 | 223 | */ |
224 | 224 | function advMultiselectarraySelllist($htmlname, $sqlqueryparam = array(), $selected_array = array()) |
225 | 225 | { |
226 | - $options_array=array(); |
|
226 | + $options_array = array(); |
|
227 | 227 | |
228 | 228 | if (is_array($sqlqueryparam)) |
229 | 229 | { |
230 | - $param_list = array_keys ( $sqlqueryparam ); |
|
231 | - $InfoFieldList = explode ( ":", $param_list [0] ); |
|
230 | + $param_list = array_keys($sqlqueryparam); |
|
231 | + $InfoFieldList = explode(":", $param_list [0]); |
|
232 | 232 | |
233 | 233 | // 0 1 : tableName |
234 | 234 | // 1 2 : label field name Nom du champ contenant le libelle |
@@ -237,46 +237,46 @@ discard block |
||
237 | 237 | |
238 | 238 | $keyList = 'rowid'; |
239 | 239 | |
240 | - if (count ( $InfoFieldList ) >= 3) { |
|
241 | - if (strpos ( $InfoFieldList [3], 'extra.' ) !== false) { |
|
242 | - $keyList = 'main.' . $InfoFieldList [2] . ' as rowid'; |
|
240 | + if (count($InfoFieldList) >= 3) { |
|
241 | + if (strpos($InfoFieldList [3], 'extra.') !== false) { |
|
242 | + $keyList = 'main.'.$InfoFieldList [2].' as rowid'; |
|
243 | 243 | } else { |
244 | - $keyList = $InfoFieldList [2] . ' as rowid'; |
|
244 | + $keyList = $InfoFieldList [2].' as rowid'; |
|
245 | 245 | } |
246 | 246 | } |
247 | 247 | |
248 | - $sql = 'SELECT ' . $keyList . ', ' . $InfoFieldList [1]; |
|
249 | - $sql .= ' FROM ' . MAIN_DB_PREFIX . $InfoFieldList [0]; |
|
250 | - if (! empty ( $InfoFieldList [3] )) { |
|
248 | + $sql = 'SELECT '.$keyList.', '.$InfoFieldList [1]; |
|
249 | + $sql .= ' FROM '.MAIN_DB_PREFIX.$InfoFieldList [0]; |
|
250 | + if (!empty ($InfoFieldList [3])) { |
|
251 | 251 | |
252 | 252 | // We have to join on extrafield table |
253 | - if (strpos ( $InfoFieldList [3], 'extra' ) !== false) { |
|
254 | - $sql .= ' as main, ' . MAIN_DB_PREFIX . $InfoFieldList [0] . '_extrafields as extra'; |
|
255 | - $sql .= ' WHERE extra.fk_object=main.' . $InfoFieldList [2] . ' AND ' . $InfoFieldList [3]; |
|
253 | + if (strpos($InfoFieldList [3], 'extra') !== false) { |
|
254 | + $sql .= ' as main, '.MAIN_DB_PREFIX.$InfoFieldList [0].'_extrafields as extra'; |
|
255 | + $sql .= ' WHERE extra.fk_object=main.'.$InfoFieldList [2].' AND '.$InfoFieldList [3]; |
|
256 | 256 | } else { |
257 | - $sql .= ' WHERE ' . $InfoFieldList [3]; |
|
257 | + $sql .= ' WHERE '.$InfoFieldList [3]; |
|
258 | 258 | } |
259 | 259 | } |
260 | - if (! empty($InfoFieldList[1])) { |
|
260 | + if (!empty($InfoFieldList[1])) { |
|
261 | 261 | $sql .= " ORDER BY nom"; |
262 | 262 | } |
263 | 263 | // $sql.= ' WHERE entity = '.$conf->entity; |
264 | 264 | |
265 | - dol_syslog(get_class($this) . "::".__METHOD__,LOG_DEBUG); |
|
265 | + dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG); |
|
266 | 266 | $resql = $this->db->query($sql); |
267 | 267 | if ($resql) { |
268 | 268 | |
269 | 269 | $num = $this->db->num_rows($resql); |
270 | 270 | $i = 0; |
271 | 271 | if ($num) { |
272 | - while ( $i < $num ) { |
|
273 | - $obj = $this->db->fetch_object ( $resql ); |
|
274 | - $labeltoshow = dol_trunc ( $obj->$InfoFieldList [1], 90 ); |
|
275 | - $options_array[$obj->rowid]=$labeltoshow; |
|
276 | - $i ++; |
|
272 | + while ($i < $num) { |
|
273 | + $obj = $this->db->fetch_object($resql); |
|
274 | + $labeltoshow = dol_trunc($obj->$InfoFieldList [1], 90); |
|
275 | + $options_array[$obj->rowid] = $labeltoshow; |
|
276 | + $i++; |
|
277 | 277 | } |
278 | 278 | } |
279 | - $this->db->free ( $resql ); |
|
279 | + $this->db->free($resql); |
|
280 | 280 | } |
281 | 281 | } |
282 | 282 | |
@@ -290,19 +290,19 @@ discard block |
||
290 | 290 | * @param array $selected_array Array |
291 | 291 | * @return string HTML combo |
292 | 292 | */ |
293 | - function multiselectCivility($htmlname='civilite_id',$selected_array = array()) |
|
293 | + function multiselectCivility($htmlname = 'civilite_id', $selected_array = array()) |
|
294 | 294 | { |
295 | - global $conf,$langs,$user; |
|
295 | + global $conf, $langs, $user; |
|
296 | 296 | $langs->load("dict"); |
297 | 297 | |
298 | - $options_array=array(); |
|
298 | + $options_array = array(); |
|
299 | 299 | |
300 | 300 | |
301 | 301 | $sql = "SELECT rowid, code, label as civilite, active FROM ".MAIN_DB_PREFIX."c_civility"; |
302 | - $sql.= " WHERE active = 1"; |
|
302 | + $sql .= " WHERE active = 1"; |
|
303 | 303 | |
304 | - dol_syslog(get_class($this)."::".__METHOD__,LOG_DEBUG); |
|
305 | - $resql=$this->db->query($sql); |
|
304 | + dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG); |
|
305 | + $resql = $this->db->query($sql); |
|
306 | 306 | if ($resql) |
307 | 307 | { |
308 | 308 | |
@@ -314,10 +314,10 @@ discard block |
||
314 | 314 | { |
315 | 315 | $obj = $this->db->fetch_object($resql); |
316 | 316 | // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut |
317 | - $label= ($langs->trans("Civility".$obj->code)!="Civility".$obj->code ? $langs->trans("Civility".$obj->code) : ($obj->civilite!='-'?$obj->civilite:'')); |
|
317 | + $label = ($langs->trans("Civility".$obj->code) != "Civility".$obj->code ? $langs->trans("Civility".$obj->code) : ($obj->civilite != '-' ? $obj->civilite : '')); |
|
318 | 318 | |
319 | 319 | |
320 | - $options_array[$obj->code]=$label; |
|
320 | + $options_array[$obj->code] = $label; |
|
321 | 321 | |
322 | 322 | $i++; |
323 | 323 | } |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | dol_print_error($this->db); |
329 | 329 | } |
330 | 330 | |
331 | - return $this->advMultiselectarray ( $htmlname, $options_array, $selected_array ); |
|
331 | + return $this->advMultiselectarray($htmlname, $options_array, $selected_array); |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | /** |
@@ -344,8 +344,8 @@ discard block |
||
344 | 344 | { |
345 | 345 | global $conf, $langs; |
346 | 346 | |
347 | - $form=new Form($this->db); |
|
348 | - $return = $form->multiselectarray($htmlname, $options_array, $selected_array,0,0,'',0,295); |
|
347 | + $form = new Form($this->db); |
|
348 | + $return = $form->multiselectarray($htmlname, $options_array, $selected_array, 0, 0, '', 0, 295); |
|
349 | 349 | return $return; |
350 | 350 | } |
351 | 351 | |
@@ -356,9 +356,9 @@ discard block |
||
356 | 356 | * @param array $selected_array value selected |
357 | 357 | * @return string HTML combo |
358 | 358 | */ |
359 | - function multiselectCustomerCategories($htmlname='cust_cat',$selected_array = array()) |
|
359 | + function multiselectCustomerCategories($htmlname = 'cust_cat', $selected_array = array()) |
|
360 | 360 | { |
361 | - return $this->multiselectCategories($htmlname,$selected_array,2); |
|
361 | + return $this->multiselectCategories($htmlname, $selected_array, 2); |
|
362 | 362 | } |
363 | 363 | |
364 | 364 | /** |
@@ -368,9 +368,9 @@ discard block |
||
368 | 368 | * @param array $selected_array value selected |
369 | 369 | * @return string HTML combo |
370 | 370 | */ |
371 | - function multiselectContactCategories($htmlname='contact_cat',$selected_array = array()) |
|
371 | + function multiselectContactCategories($htmlname = 'contact_cat', $selected_array = array()) |
|
372 | 372 | { |
373 | - return $this->multiselectCategories($htmlname,$selected_array,4); |
|
373 | + return $this->multiselectCategories($htmlname, $selected_array, 4); |
|
374 | 374 | } |
375 | 375 | |
376 | 376 | /** |
@@ -381,18 +381,18 @@ discard block |
||
381 | 381 | * @param int $type Type |
382 | 382 | * @return string HTML combo |
383 | 383 | */ |
384 | - public function multiselectCategories($htmlname='',$selected_array = array(), $type=0) |
|
384 | + public function multiselectCategories($htmlname = '', $selected_array = array(), $type = 0) |
|
385 | 385 | { |
386 | - global $conf,$langs,$user; |
|
386 | + global $conf, $langs, $user; |
|
387 | 387 | $langs->load("dict"); |
388 | 388 | |
389 | - $options_array=array(); |
|
389 | + $options_array = array(); |
|
390 | 390 | |
391 | 391 | $sql = "SELECT rowid, label FROM ".MAIN_DB_PREFIX."categorie"; |
392 | - $sql.= " WHERE type=".$type; |
|
392 | + $sql .= " WHERE type=".$type; |
|
393 | 393 | |
394 | - dol_syslog(get_class($this)."::".__METHOD__,LOG_DEBUG); |
|
395 | - $resql=$this->db->query($sql); |
|
394 | + dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG); |
|
395 | + $resql = $this->db->query($sql); |
|
396 | 396 | if ($resql) |
397 | 397 | { |
398 | 398 | |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | { |
405 | 405 | $obj = $this->db->fetch_object($resql); |
406 | 406 | |
407 | - $options_array[$obj->rowid]=$obj->label; |
|
407 | + $options_array[$obj->rowid] = $obj->label; |
|
408 | 408 | |
409 | 409 | $i++; |
410 | 410 | } |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | dol_print_error($this->db); |
416 | 416 | } |
417 | 417 | |
418 | - return $this->advMultiselectarray( $htmlname, $options_array, $selected_array ); |
|
418 | + return $this->advMultiselectarray($htmlname, $options_array, $selected_array); |
|
419 | 419 | } |
420 | 420 | |
421 | 421 | /** |
@@ -427,48 +427,48 @@ discard block |
||
427 | 427 | * @param string $type_element Type element. Example: 'mailing' |
428 | 428 | * @return string HTML combo |
429 | 429 | */ |
430 | - public function selectAdvtargetemailingTemplate($htmlname='template_id', $selected=0, $showempty=0, $type_element='mailing') |
|
430 | + public function selectAdvtargetemailingTemplate($htmlname = 'template_id', $selected = 0, $showempty = 0, $type_element = 'mailing') |
|
431 | 431 | { |
432 | 432 | global $conf, $user, $langs; |
433 | 433 | |
434 | 434 | $out = ''; |
435 | 435 | |
436 | 436 | $sql = "SELECT c.rowid, c.name, c.fk_element"; |
437 | - $sql .= " FROM " . MAIN_DB_PREFIX . "advtargetemailing as c"; |
|
437 | + $sql .= " FROM ".MAIN_DB_PREFIX."advtargetemailing as c"; |
|
438 | 438 | $sql .= " WHERE type_element='$type_element'"; |
439 | 439 | $sql .= " ORDER BY c.name"; |
440 | 440 | |
441 | - dol_syslog ( get_class ( $this ) . "::".__METHOD__, LOG_DEBUG ); |
|
442 | - $resql = $this->db->query ( $sql ); |
|
441 | + dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG); |
|
442 | + $resql = $this->db->query($sql); |
|
443 | 443 | if ($resql) { |
444 | 444 | |
445 | 445 | |
446 | - $out .= '<select id="' . $htmlname . '" class="flat" name="' . $htmlname . '">'; |
|
446 | + $out .= '<select id="'.$htmlname.'" class="flat" name="'.$htmlname.'">'; |
|
447 | 447 | if ($showempty) |
448 | 448 | $out .= '<option value=""></option>'; |
449 | - $num = $this->db->num_rows ( $resql ); |
|
449 | + $num = $this->db->num_rows($resql); |
|
450 | 450 | $i = 0; |
451 | 451 | if ($num) { |
452 | - while ( $i < $num ) { |
|
453 | - $obj = $this->db->fetch_object ( $resql ); |
|
452 | + while ($i < $num) { |
|
453 | + $obj = $this->db->fetch_object($resql); |
|
454 | 454 | $label = $obj->name; |
455 | 455 | if (empty($label)) { |
456 | - $label=$obj->fk_element; |
|
456 | + $label = $obj->fk_element; |
|
457 | 457 | } |
458 | 458 | |
459 | 459 | if ($selected > 0 && $selected == $obj->rowid) { |
460 | - $out .= '<option value="' . $obj->rowid . '" selected="selected">' . $label . '</option>'; |
|
460 | + $out .= '<option value="'.$obj->rowid.'" selected="selected">'.$label.'</option>'; |
|
461 | 461 | } else { |
462 | - $out .= '<option value="' . $obj->rowid . '">' . $label . '</option>'; |
|
462 | + $out .= '<option value="'.$obj->rowid.'">'.$label.'</option>'; |
|
463 | 463 | } |
464 | - $i ++; |
|
464 | + $i++; |
|
465 | 465 | } |
466 | 466 | } |
467 | 467 | $out .= '</select>'; |
468 | 468 | } else { |
469 | - dol_print_error ( $this->db ); |
|
469 | + dol_print_error($this->db); |
|
470 | 470 | } |
471 | - $this->db->free ( $resql ); |
|
471 | + $this->db->free($resql); |
|
472 | 472 | return $out; |
473 | 473 | } |
474 | 474 | } |
@@ -73,8 +73,9 @@ discard block |
||
73 | 73 | $obj = $this->db->fetch_object( $resql ); |
74 | 74 | |
75 | 75 | $level = $langs->trans( $obj->code ); |
76 | - if ($level == $obj->code) |
|
77 | - $level = $langs->trans( $obj->label ); |
|
76 | + if ($level == $obj->code) { |
|
77 | + $level = $langs->trans( $obj->label ); |
|
78 | + } |
|
78 | 79 | $options_array[$obj->code] = $level; |
79 | 80 | |
80 | 81 | $i ++; |
@@ -132,8 +133,9 @@ discard block |
||
132 | 133 | |
133 | 134 | foreach ($countryArray as $row) { |
134 | 135 | $label = dol_trunc($row['label'], $maxlength, 'middle'); |
135 | - if ($row['code_iso']) |
|
136 | - $label .= ' (' . $row['code_iso'] . ')'; |
|
136 | + if ($row['code_iso']) { |
|
137 | + $label .= ' (' . $row['code_iso'] . ')'; |
|
138 | + } |
|
137 | 139 | |
138 | 140 | $options_array[$row['rowid']] = $label; |
139 | 141 | } |
@@ -166,8 +168,9 @@ discard block |
||
166 | 168 | $sql_usr .= " WHERE u2.entity IN (0," . $conf->entity . ")"; |
167 | 169 | $sql_usr .= " AND u2.rowid = sc.fk_user "; |
168 | 170 | |
169 | - if (! empty ( $conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX )) |
|
170 | - $sql_usr .= " AND u2.statut<>0 "; |
|
171 | + if (! empty ( $conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX )) { |
|
172 | + $sql_usr .= " AND u2.statut<>0 "; |
|
173 | + } |
|
171 | 174 | $sql_usr .= " ORDER BY name ASC"; |
172 | 175 | // print $sql_usr;exit; |
173 | 176 | |
@@ -322,8 +325,7 @@ discard block |
||
322 | 325 | $i++; |
323 | 326 | } |
324 | 327 | } |
325 | - } |
|
326 | - else |
|
328 | + } else |
|
327 | 329 | { |
328 | 330 | dol_print_error($this->db); |
329 | 331 | } |
@@ -409,8 +411,7 @@ discard block |
||
409 | 411 | $i++; |
410 | 412 | } |
411 | 413 | } |
412 | - } |
|
413 | - else |
|
414 | + } else |
|
414 | 415 | { |
415 | 416 | dol_print_error($this->db); |
416 | 417 | } |
@@ -444,8 +445,9 @@ discard block |
||
444 | 445 | |
445 | 446 | |
446 | 447 | $out .= '<select id="' . $htmlname . '" class="flat" name="' . $htmlname . '">'; |
447 | - if ($showempty) |
|
448 | - $out .= '<option value=""></option>'; |
|
448 | + if ($showempty) { |
|
449 | + $out .= '<option value=""></option>'; |
|
450 | + } |
|
449 | 451 | $num = $this->db->num_rows ( $resql ); |
450 | 452 | $i = 0; |
451 | 453 | if ($num) { |