@@ -4,9 +4,9 @@ |
||
4 | 4 | * Alxarafe. Development of PHP applications in a flash! |
5 | 5 | * Copyright (C) 2018 Alxarafe <[email protected]> |
6 | 6 | */ |
7 | -define('BASE_PATH', __DIR__ . DIRECTORY_SEPARATOR); |
|
7 | +define('BASE_PATH', __DIR__.DIRECTORY_SEPARATOR); |
|
8 | 8 | |
9 | -include BASE_PATH . 'config/constants.php'; |
|
10 | -include BASE_PATH . 'vendor/autoload.php'; |
|
9 | +include BASE_PATH.'config/constants.php'; |
|
10 | +include BASE_PATH.'vendor/autoload.php'; |
|
11 | 11 | |
12 | 12 | include('dolibarr/htdocs/index.php'); |
@@ -4,13 +4,13 @@ discard block |
||
4 | 4 | * Alxarafe. Development of PHP applications in a flash! |
5 | 5 | * Copyright (C) 2018 Alxarafe <[email protected]> |
6 | 6 | */ |
7 | -$_appURI = trim(pathinfo(filter_input(INPUT_SERVER, 'SCRIPT_NAME'), PATHINFO_DIRNAME), ' /') . '/'; |
|
8 | -define('APP_URI', $_appURI === '/' ? $_appURI : '/' . $_appURI); |
|
7 | +$_appURI = trim(pathinfo(filter_input(INPUT_SERVER, 'SCRIPT_NAME'), PATHINFO_DIRNAME), ' /').'/'; |
|
8 | +define('APP_URI', $_appURI === '/' ? $_appURI : '/'.$_appURI); |
|
9 | 9 | |
10 | 10 | define('SERVER_NAME', filter_input(INPUT_SERVER, 'SERVER_NAME')); |
11 | 11 | define('APP_PROTOCOL', filter_input(INPUT_SERVER, 'REQUEST_SCHEME')); |
12 | -define('SITE_URL', APP_PROTOCOL . '://' . SERVER_NAME); |
|
13 | -define('BASE_URI', SITE_URL . APP_URI); |
|
12 | +define('SITE_URL', APP_PROTOCOL.'://'.SERVER_NAME); |
|
13 | +define('BASE_URI', SITE_URL.APP_URI); |
|
14 | 14 | |
15 | 15 | define('CORE_FOLDER', 'core/'); |
16 | 16 | define('CONFIG_FOLDER', 'core/'); |
@@ -23,13 +23,13 @@ discard block |
||
23 | 23 | define('CACHE_FOLDER', '../cache/'); |
24 | 24 | define('VENDOR_FOLDER', '../vendor/'); |
25 | 25 | |
26 | -define('CORE_PATH', BASE_PATH . CORE_FOLDER); |
|
27 | -define('CONFIG_PATH', BASE_PATH . CONFIG_FOLDER); |
|
28 | -define('CONTROLLERS_PATH', BASE_PATH . CONTROLLERS_FOLDER); |
|
29 | -define('HELPERS_PATH', BASE_PATH . HELPERS_FOLDER); |
|
30 | -define('MODELS_PATH', BASE_PATH . MODELS_FOLDER); |
|
31 | -define('SKINS_PATH', BASE_PATH . SKINS_FOLDER); |
|
32 | -define('TEMPLATES_PATH', BASE_PATH . TEMPLATES_FOLDER); |
|
33 | -define('PLUGINS_PATH', BASE_PATH . PLUGINS_FOLDER); |
|
34 | -define('CACHE_PATH', BASE_PATH . CACHE_FOLDER); |
|
35 | -define('VENDOR_PATH', BASE_PATH . VENDOR_FOLDER); |
|
26 | +define('CORE_PATH', BASE_PATH.CORE_FOLDER); |
|
27 | +define('CONFIG_PATH', BASE_PATH.CONFIG_FOLDER); |
|
28 | +define('CONTROLLERS_PATH', BASE_PATH.CONTROLLERS_FOLDER); |
|
29 | +define('HELPERS_PATH', BASE_PATH.HELPERS_FOLDER); |
|
30 | +define('MODELS_PATH', BASE_PATH.MODELS_FOLDER); |
|
31 | +define('SKINS_PATH', BASE_PATH.SKINS_FOLDER); |
|
32 | +define('TEMPLATES_PATH', BASE_PATH.TEMPLATES_FOLDER); |
|
33 | +define('PLUGINS_PATH', BASE_PATH.PLUGINS_FOLDER); |
|
34 | +define('CACHE_PATH', BASE_PATH.CACHE_FOLDER); |
|
35 | +define('VENDOR_PATH', BASE_PATH.VENDOR_FOLDER); |
@@ -44,47 +44,47 @@ discard block |
||
44 | 44 | require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; |
45 | 45 | require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; |
46 | 46 | require_once DOL_DOCUMENT_ROOT.'/product/stock/class/productlot.class.php'; |
47 | -if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
|
48 | -if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; |
|
49 | -if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; |
|
50 | -if (! empty($conf->productbatch->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/productbatch.class.php'; |
|
51 | -if (! empty($conf->projet->enabled)) { |
|
47 | +if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
|
48 | +if (!empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; |
|
49 | +if (!empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; |
|
50 | +if (!empty($conf->productbatch->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/productbatch.class.php'; |
|
51 | +if (!empty($conf->projet->enabled)) { |
|
52 | 52 | require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
53 | 53 | require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; |
54 | 54 | } |
55 | 55 | |
56 | 56 | // Load translation files required by the page |
57 | -$langs->loadLangs(array("sendings","companies","bills",'deliveries','orders','stocks','other','propal')); |
|
57 | +$langs->loadLangs(array("sendings", "companies", "bills", 'deliveries', 'orders', 'stocks', 'other', 'propal')); |
|
58 | 58 | |
59 | 59 | if (!empty($conf->incoterm->enabled)) $langs->load('incoterm'); |
60 | -if (! empty($conf->productbatch->enabled)) $langs->load('productbatch'); |
|
60 | +if (!empty($conf->productbatch->enabled)) $langs->load('productbatch'); |
|
61 | 61 | |
62 | -$origin = GETPOST('origin','alpha')?GETPOST('origin','alpha'):'expedition'; // Example: commande, propal |
|
63 | -$origin_id = GETPOST('id','int')?GETPOST('id','int'):''; |
|
62 | +$origin = GETPOST('origin', 'alpha') ?GETPOST('origin', 'alpha') : 'expedition'; // Example: commande, propal |
|
63 | +$origin_id = GETPOST('id', 'int') ?GETPOST('id', 'int') : ''; |
|
64 | 64 | $id = $origin_id; |
65 | -if (empty($origin_id)) $origin_id = GETPOST('origin_id','int'); // Id of order or propal |
|
66 | -if (empty($origin_id)) $origin_id = GETPOST('object_id','int'); // Id of order or propal |
|
67 | -$ref=GETPOST('ref','alpha'); |
|
68 | -$line_id = GETPOST('lineid','int')?GETPOST('lineid','int'):''; |
|
65 | +if (empty($origin_id)) $origin_id = GETPOST('origin_id', 'int'); // Id of order or propal |
|
66 | +if (empty($origin_id)) $origin_id = GETPOST('object_id', 'int'); // Id of order or propal |
|
67 | +$ref = GETPOST('ref', 'alpha'); |
|
68 | +$line_id = GETPOST('lineid', 'int') ?GETPOST('lineid', 'int') : ''; |
|
69 | 69 | |
70 | 70 | // Security check |
71 | -$socid=''; |
|
72 | -if ($user->societe_id) $socid=$user->societe_id; |
|
71 | +$socid = ''; |
|
72 | +if ($user->societe_id) $socid = $user->societe_id; |
|
73 | 73 | |
74 | -if ($origin == 'expedition') $result=restrictedArea($user, $origin, $id); |
|
74 | +if ($origin == 'expedition') $result = restrictedArea($user, $origin, $id); |
|
75 | 75 | else { |
76 | - $result=restrictedArea($user, 'expedition'); |
|
76 | + $result = restrictedArea($user, 'expedition'); |
|
77 | 77 | if (empty($user->rights->{$origin}->lire) && empty($user->rights->{$origin}->read)) accessforbidden(); |
78 | 78 | } |
79 | 79 | |
80 | -$action = GETPOST('action','alpha'); |
|
81 | -$confirm = GETPOST('confirm','alpha'); |
|
82 | -$cancel = GETPOST('cancel','alpha'); |
|
80 | +$action = GETPOST('action', 'alpha'); |
|
81 | +$confirm = GETPOST('confirm', 'alpha'); |
|
82 | +$cancel = GETPOST('cancel', 'alpha'); |
|
83 | 83 | |
84 | 84 | |
85 | -$hidedetails = (GETPOST('hidedetails','int') ? GETPOST('hidedetails','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); |
|
86 | -$hidedesc = (GETPOST('hidedesc','int') ? GETPOST('hidedesc','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0)); |
|
87 | -$hideref = (GETPOST('hideref','int') ? GETPOST('hideref','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0)); |
|
85 | +$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); |
|
86 | +$hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0)); |
|
87 | +$hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0)); |
|
88 | 88 | |
89 | 89 | $object = new Expedition($db); |
90 | 90 | $extrafields = new ExtraFields($db); |
@@ -94,16 +94,16 @@ discard block |
||
94 | 94 | $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); |
95 | 95 | |
96 | 96 | // fetch optionals attributes lines and labels |
97 | -$extralabelslines=$extrafieldsline->fetch_name_optionals_label($object->table_element_line); |
|
97 | +$extralabelslines = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); |
|
98 | 98 | |
99 | 99 | |
100 | 100 | // Load object. Make an object->fetch |
101 | -include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once |
|
101 | +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once |
|
102 | 102 | |
103 | 103 | // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context |
104 | -$hookmanager->initHooks(array('expeditioncard','globalcard')); |
|
104 | +$hookmanager->initHooks(array('expeditioncard', 'globalcard')); |
|
105 | 105 | |
106 | -$permissiondellink=$user->rights->expedition->livraison->creer; // Used by the include of actions_dellink.inc.php |
|
106 | +$permissiondellink = $user->rights->expedition->livraison->creer; // Used by the include of actions_dellink.inc.php |
|
107 | 107 | //var_dump($object->lines[0]->detail_batch); |
108 | 108 | |
109 | 109 | |
@@ -111,8 +111,8 @@ discard block |
||
111 | 111 | * Actions |
112 | 112 | */ |
113 | 113 | |
114 | -$parameters=array(); |
|
115 | -$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks |
|
114 | +$parameters = array(); |
|
115 | +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
116 | 116 | if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
117 | 117 | |
118 | 118 | if (empty($reshook)) |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | $object->fetch($id); // show shipment also after canceling modification |
124 | 124 | } |
125 | 125 | |
126 | - include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once |
|
126 | + include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once |
|
127 | 127 | |
128 | 128 | // Actions to build doc |
129 | 129 | $upload_dir = $conf->expedition->dir_output.'/sending'; |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | setEventMessages($object->error, $object->errors, 'errors'); |
151 | 151 | } |
152 | 152 | |
153 | - $result = $object->setValueFrom('ref_customer', GETPOST('ref_customer','alpha'), '', null, 'text', '', $user, 'SHIPMENT_MODIFY'); |
|
153 | + $result = $object->setValueFrom('ref_customer', GETPOST('ref_customer', 'alpha'), '', null, 'text', '', $user, 'SHIPMENT_MODIFY'); |
|
154 | 154 | if ($result < 0) { |
155 | 155 | setEventMessages($object->error, $object->errors, 'errors'); |
156 | 156 | $action = 'editref_customer'; |
@@ -166,10 +166,10 @@ discard block |
||
166 | 166 | |
167 | 167 | // Fill array 'array_options' with data from update form |
168 | 168 | $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); |
169 | - $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute','none')); |
|
169 | + $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute', 'none')); |
|
170 | 170 | if ($ret < 0) $error++; |
171 | 171 | |
172 | - if (! $error) |
|
172 | + if (!$error) |
|
173 | 173 | { |
174 | 174 | // Actions on extra fields |
175 | 175 | $result = $object->insertExtraFields('SHIPMENT_MODIFY'); |
@@ -187,23 +187,23 @@ discard block |
||
187 | 187 | // Create shipment |
188 | 188 | if ($action == 'add' && $user->rights->expedition->creer) |
189 | 189 | { |
190 | - $error=0; |
|
191 | - $predef=''; |
|
190 | + $error = 0; |
|
191 | + $predef = ''; |
|
192 | 192 | |
193 | 193 | $db->begin(); |
194 | 194 | |
195 | - $object->note = GETPOST('note','alpha'); |
|
195 | + $object->note = GETPOST('note', 'alpha'); |
|
196 | 196 | $object->origin = $origin; |
197 | - $object->origin_id = $origin_id; |
|
198 | - $object->fk_project = GETPOST('projectid','int'); |
|
199 | - $object->weight = GETPOST('weight','int')==''?"NULL":GETPOST('weight','int'); |
|
200 | - $object->sizeH = GETPOST('sizeH','int')==''?"NULL":GETPOST('sizeH','int'); |
|
201 | - $object->sizeW = GETPOST('sizeW','int')==''?"NULL":GETPOST('sizeW','int'); |
|
202 | - $object->sizeS = GETPOST('sizeS','int')==''?"NULL":GETPOST('sizeS','int'); |
|
203 | - $object->size_units = GETPOST('size_units','int'); |
|
204 | - $object->weight_units = GETPOST('weight_units','int'); |
|
197 | + $object->origin_id = $origin_id; |
|
198 | + $object->fk_project = GETPOST('projectid', 'int'); |
|
199 | + $object->weight = GETPOST('weight', 'int') == '' ? "NULL" : GETPOST('weight', 'int'); |
|
200 | + $object->sizeH = GETPOST('sizeH', 'int') == '' ? "NULL" : GETPOST('sizeH', 'int'); |
|
201 | + $object->sizeW = GETPOST('sizeW', 'int') == '' ? "NULL" : GETPOST('sizeW', 'int'); |
|
202 | + $object->sizeS = GETPOST('sizeS', 'int') == '' ? "NULL" : GETPOST('sizeS', 'int'); |
|
203 | + $object->size_units = GETPOST('size_units', 'int'); |
|
204 | + $object->weight_units = GETPOST('weight_units', 'int'); |
|
205 | 205 | |
206 | - $date_delivery = dol_mktime(GETPOST('date_deliveryhour','int'), GETPOST('date_deliverymin','int'), 0, GETPOST('date_deliverymonth','int'), GETPOST('date_deliveryday','int'), GETPOST('date_deliveryyear','int')); |
|
206 | + $date_delivery = dol_mktime(GETPOST('date_deliveryhour', 'int'), GETPOST('date_deliverymin', 'int'), 0, GETPOST('date_deliverymonth', 'int'), GETPOST('date_deliveryday', 'int'), GETPOST('date_deliveryyear', 'int')); |
|
207 | 207 | |
208 | 208 | // On va boucler sur chaque ligne du document d'origine pour completer objet expedition |
209 | 209 | // avec info diverses + qte a livrer |
@@ -211,36 +211,36 @@ discard block |
||
211 | 211 | $objectsrc = new $classname($db); |
212 | 212 | $objectsrc->fetch($object->origin_id); |
213 | 213 | |
214 | - $object->socid = $objectsrc->socid; |
|
215 | - $object->ref_customer = GETPOST('ref_customer','alpha'); |
|
216 | - $object->model_pdf = GETPOST('model'); |
|
217 | - $object->date_delivery = $date_delivery; // Date delivery planed |
|
214 | + $object->socid = $objectsrc->socid; |
|
215 | + $object->ref_customer = GETPOST('ref_customer', 'alpha'); |
|
216 | + $object->model_pdf = GETPOST('model'); |
|
217 | + $object->date_delivery = $date_delivery; // Date delivery planed |
|
218 | 218 | $object->fk_delivery_address = $objectsrc->fk_delivery_address; |
219 | - $object->shipping_method_id = GETPOST('shipping_method_id','int'); |
|
220 | - $object->tracking_number = GETPOST('tracking_number','alpha'); |
|
221 | - $object->ref_int = GETPOST('ref_int','alpha'); |
|
222 | - $object->note_private = GETPOST('note_private','none'); |
|
223 | - $object->note_public = GETPOST('note_public','none'); |
|
224 | - $object->fk_incoterms = GETPOST('incoterm_id', 'int'); |
|
225 | - $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); |
|
219 | + $object->shipping_method_id = GETPOST('shipping_method_id', 'int'); |
|
220 | + $object->tracking_number = GETPOST('tracking_number', 'alpha'); |
|
221 | + $object->ref_int = GETPOST('ref_int', 'alpha'); |
|
222 | + $object->note_private = GETPOST('note_private', 'none'); |
|
223 | + $object->note_public = GETPOST('note_public', 'none'); |
|
224 | + $object->fk_incoterms = GETPOST('incoterm_id', 'int'); |
|
225 | + $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); |
|
226 | 226 | |
227 | 227 | $batch_line = array(); |
228 | 228 | $stockLine = array(); |
229 | - $array_options=array(); |
|
229 | + $array_options = array(); |
|
230 | 230 | |
231 | - $num=count($objectsrc->lines); |
|
232 | - $totalqty=0; |
|
231 | + $num = count($objectsrc->lines); |
|
232 | + $totalqty = 0; |
|
233 | 233 | |
234 | 234 | for ($i = 0; $i < $num; $i++) |
235 | 235 | { |
236 | - $idl="idl".$i; |
|
236 | + $idl = "idl".$i; |
|
237 | 237 | |
238 | - $sub_qty=array(); |
|
239 | - $subtotalqty=0; |
|
238 | + $sub_qty = array(); |
|
239 | + $subtotalqty = 0; |
|
240 | 240 | |
241 | - $j=0; |
|
242 | - $batch="batchl".$i."_0"; |
|
243 | - $stockLocation="ent1".$i."_0"; |
|
241 | + $j = 0; |
|
242 | + $batch = "batchl".$i."_0"; |
|
243 | + $stockLocation = "ent1".$i."_0"; |
|
244 | 244 | $qty = "qtyl".$i; |
245 | 245 | |
246 | 246 | if ($objectsrc->lines[$i]->product_tobatch) // If product need a batch number |
@@ -252,27 +252,27 @@ discard block |
||
252 | 252 | while (isset($_POST[$batch])) |
253 | 253 | { |
254 | 254 | // save line of detail into sub_qty |
255 | - $sub_qty[$j]['q']=GETPOST($qty,'int'); // the qty we want to move for this stock record |
|
256 | - $sub_qty[$j]['id_batch']=GETPOST($batch,'int'); // the id into llx_product_batch of stock record to move |
|
257 | - $subtotalqty+=$sub_qty[$j]['q']; |
|
255 | + $sub_qty[$j]['q'] = GETPOST($qty, 'int'); // the qty we want to move for this stock record |
|
256 | + $sub_qty[$j]['id_batch'] = GETPOST($batch, 'int'); // the id into llx_product_batch of stock record to move |
|
257 | + $subtotalqty += $sub_qty[$j]['q']; |
|
258 | 258 | |
259 | 259 | //var_dump($qty);var_dump($batch);var_dump($sub_qty[$j]['q']);var_dump($sub_qty[$j]['id_batch']); |
260 | 260 | |
261 | 261 | $j++; |
262 | - $batch="batchl".$i."_".$j; |
|
262 | + $batch = "batchl".$i."_".$j; |
|
263 | 263 | $qty = "qtyl".$i.'_'.$j; |
264 | 264 | } |
265 | 265 | |
266 | - $batch_line[$i]['detail']=$sub_qty; // array of details |
|
267 | - $batch_line[$i]['qty']=$subtotalqty; |
|
268 | - $batch_line[$i]['ix_l']=GETPOST($idl,'int'); |
|
266 | + $batch_line[$i]['detail'] = $sub_qty; // array of details |
|
267 | + $batch_line[$i]['qty'] = $subtotalqty; |
|
268 | + $batch_line[$i]['ix_l'] = GETPOST($idl, 'int'); |
|
269 | 269 | |
270 | - $totalqty+=$subtotalqty; |
|
270 | + $totalqty += $subtotalqty; |
|
271 | 271 | } |
272 | 272 | else |
273 | 273 | { |
274 | 274 | // No detail were provided for lots |
275 | - if (! empty($_POST[$qty])) |
|
275 | + if (!empty($_POST[$qty])) |
|
276 | 276 | { |
277 | 277 | // We try to set an amount |
278 | 278 | // Case we dont use the list of available qty for each warehouse/lot |
@@ -288,14 +288,14 @@ discard block |
||
288 | 288 | while (isset($_POST[$stockLocation])) |
289 | 289 | { |
290 | 290 | // save sub line of warehouse |
291 | - $stockLine[$i][$j]['qty']=GETPOST($qty,'int'); |
|
292 | - $stockLine[$i][$j]['warehouse_id']=GETPOST($stockLocation,'int'); |
|
293 | - $stockLine[$i][$j]['ix_l']=GETPOST($idl,'int'); |
|
291 | + $stockLine[$i][$j]['qty'] = GETPOST($qty, 'int'); |
|
292 | + $stockLine[$i][$j]['warehouse_id'] = GETPOST($stockLocation, 'int'); |
|
293 | + $stockLine[$i][$j]['ix_l'] = GETPOST($idl, 'int'); |
|
294 | 294 | |
295 | - $totalqty+=GETPOST($qty,'int'); |
|
295 | + $totalqty += GETPOST($qty, 'int'); |
|
296 | 296 | |
297 | 297 | $j++; |
298 | - $stockLocation="ent1".$i."_".$j; |
|
298 | + $stockLocation = "ent1".$i."_".$j; |
|
299 | 299 | $qty = "qtyl".$i.'_'.$j; |
300 | 300 | } |
301 | 301 | } |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | { |
304 | 304 | //var_dump(GETPOST($qty,'int')); var_dump($_POST); var_dump($batch);exit; |
305 | 305 | //shipment line for product with no batch management and no multiple stock location |
306 | - if (GETPOST($qty,'int') > 0) $totalqty+=GETPOST($qty,'int'); |
|
306 | + if (GETPOST($qty, 'int') > 0) $totalqty += GETPOST($qty, 'int'); |
|
307 | 307 | } |
308 | 308 | |
309 | 309 | // Extrafields |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | if (is_array($extralabelsline)) { |
314 | 314 | // Get extra fields |
315 | 315 | foreach ($extralabelsline as $key => $value) { |
316 | - unset($_POST["options_" . $key]); |
|
316 | + unset($_POST["options_".$key]); |
|
317 | 317 | } |
318 | 318 | } |
319 | 319 | } |
@@ -326,18 +326,18 @@ discard block |
||
326 | 326 | for ($i = 0; $i < $num; $i++) |
327 | 327 | { |
328 | 328 | $qty = "qtyl".$i; |
329 | - if (! isset($batch_line[$i])) |
|
329 | + if (!isset($batch_line[$i])) |
|
330 | 330 | { |
331 | 331 | // not batch mode |
332 | 332 | if (isset($stockLine[$i])) |
333 | 333 | { |
334 | 334 | //shipment from multiple stock locations |
335 | 335 | $nbstockline = count($stockLine[$i]); |
336 | - for($j = 0; $j < $nbstockline; $j++) |
|
336 | + for ($j = 0; $j < $nbstockline; $j++) |
|
337 | 337 | { |
338 | - if ($stockLine[$i][$j]['qty']>0) |
|
338 | + if ($stockLine[$i][$j]['qty'] > 0) |
|
339 | 339 | { |
340 | - $ret=$object->addline($stockLine[$i][$j]['warehouse_id'], $stockLine[$i][$j]['ix_l'], $stockLine[$i][$j]['qty'], $array_options[$i]); |
|
340 | + $ret = $object->addline($stockLine[$i][$j]['warehouse_id'], $stockLine[$i][$j]['ix_l'], $stockLine[$i][$j]['qty'], $array_options[$i]); |
|
341 | 341 | if ($ret < 0) |
342 | 342 | { |
343 | 343 | setEventMessages($object->error, $object->errors, 'errors'); |
@@ -348,15 +348,15 @@ discard block |
||
348 | 348 | } |
349 | 349 | else |
350 | 350 | { |
351 | - if (GETPOST($qty,'int') > 0 || (GETPOST($qty,'int') == 0 && $conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS)) |
|
351 | + if (GETPOST($qty, 'int') > 0 || (GETPOST($qty, 'int') == 0 && $conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS)) |
|
352 | 352 | { |
353 | 353 | $ent = "entl".$i; |
354 | 354 | $idl = "idl".$i; |
355 | - $entrepot_id = is_numeric(GETPOST($ent,'int'))?GETPOST($ent,'int'):GETPOST('entrepot_id','int'); |
|
356 | - if ($entrepot_id < 0) $entrepot_id=''; |
|
357 | - if (! ($objectsrc->lines[$i]->fk_product > 0)) $entrepot_id = 0; |
|
355 | + $entrepot_id = is_numeric(GETPOST($ent, 'int')) ?GETPOST($ent, 'int') : GETPOST('entrepot_id', 'int'); |
|
356 | + if ($entrepot_id < 0) $entrepot_id = ''; |
|
357 | + if (!($objectsrc->lines[$i]->fk_product > 0)) $entrepot_id = 0; |
|
358 | 358 | |
359 | - $ret=$object->addline($entrepot_id, GETPOST($idl,'int'), GETPOST($qty,'int'), $array_options[$i]); |
|
359 | + $ret = $object->addline($entrepot_id, GETPOST($idl, 'int'), GETPOST($qty, 'int'), $array_options[$i]); |
|
360 | 360 | if ($ret < 0) |
361 | 361 | { |
362 | 362 | setEventMessages($object->error, $object->errors, 'errors'); |
@@ -368,9 +368,9 @@ discard block |
||
368 | 368 | else |
369 | 369 | { |
370 | 370 | // batch mode |
371 | - if ($batch_line[$i]['qty']>0) |
|
371 | + if ($batch_line[$i]['qty'] > 0) |
|
372 | 372 | { |
373 | - $ret=$object->addline_batch($batch_line[$i],$array_options[$i]); |
|
373 | + $ret = $object->addline_batch($batch_line[$i], $array_options[$i]); |
|
374 | 374 | if ($ret < 0) |
375 | 375 | { |
376 | 376 | setEventMessages($object->error, $object->errors, 'errors'); |
@@ -383,9 +383,9 @@ discard block |
||
383 | 383 | $ret = $extrafields->setOptionalsFromPost($extralabels, $object); |
384 | 384 | if ($ret < 0) $error++; |
385 | 385 | |
386 | - if (! $error) |
|
386 | + if (!$error) |
|
387 | 387 | { |
388 | - $ret=$object->create($user); // This create shipment (like Odoo picking) and line of shipments. Stock movement will when validating shipment. |
|
388 | + $ret = $object->create($user); // This create shipment (like Odoo picking) and line of shipments. Stock movement will when validating shipment. |
|
389 | 389 | if ($ret <= 0) |
390 | 390 | { |
391 | 391 | setEventMessages($object->error, $object->errors, 'errors'); |
@@ -395,11 +395,11 @@ discard block |
||
395 | 395 | } |
396 | 396 | else |
397 | 397 | { |
398 | - setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("QtyToShip").'/'.$langs->transnoentitiesnoconv("Warehouse")), null, 'errors'); |
|
398 | + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("QtyToShip").'/'.$langs->transnoentitiesnoconv("Warehouse")), null, 'errors'); |
|
399 | 399 | $error++; |
400 | 400 | } |
401 | 401 | |
402 | - if (! $error) |
|
402 | + if (!$error) |
|
403 | 403 | { |
404 | 404 | $db->commit(); |
405 | 405 | header("Location: card.php?id=".$object->id); |
@@ -408,8 +408,8 @@ discard block |
||
408 | 408 | else |
409 | 409 | { |
410 | 410 | $db->rollback(); |
411 | - $_GET["commande_id"]=GETPOST('commande_id','int'); |
|
412 | - $action='create'; |
|
411 | + $_GET["commande_id"] = GETPOST('commande_id', 'int'); |
|
412 | + $action = 'create'; |
|
413 | 413 | } |
414 | 414 | } |
415 | 415 | |
@@ -431,8 +431,8 @@ discard block |
||
431 | 431 | } |
432 | 432 | |
433 | 433 | else if ($action == 'confirm_valid' && $confirm == 'yes' && |
434 | - ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->expedition->creer)) |
|
435 | - || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->expedition->shipping_advance->validate))) |
|
434 | + ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->creer)) |
|
435 | + || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->shipping_advance->validate))) |
|
436 | 436 | ) |
437 | 437 | { |
438 | 438 | $object->fetch_thirdparty(); |
@@ -451,17 +451,17 @@ discard block |
||
451 | 451 | { |
452 | 452 | $outputlangs = $langs; |
453 | 453 | $newlang = ''; |
454 | - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09'); |
|
454 | + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); |
|
455 | 455 | if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; |
456 | - if (! empty($newlang)) { |
|
456 | + if (!empty($newlang)) { |
|
457 | 457 | $outputlangs = new Translate("", $conf); |
458 | 458 | $outputlangs->setDefaultLang($newlang); |
459 | 459 | } |
460 | - $model=$object->modelpdf; |
|
460 | + $model = $object->modelpdf; |
|
461 | 461 | $ret = $object->fetch($id); // Reload to get new records |
462 | 462 | |
463 | - $result=$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
464 | - if ($result < 0) dol_print_error($db,$result); |
|
463 | + $result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
464 | + if ($result < 0) dol_print_error($db, $result); |
|
465 | 465 | } |
466 | 466 | } |
467 | 467 | } |
@@ -492,10 +492,10 @@ discard block |
||
492 | 492 | else if ($action == 'setdate_livraison' && $user->rights->expedition->creer) |
493 | 493 | { |
494 | 494 | //print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year']; |
495 | - $datedelivery=dol_mktime(GETPOST('liv_hour','int'), GETPOST('liv_min','int'), 0, GETPOST('liv_month','int'), GETPOST('liv_day','int'), GETPOST('liv_year','int')); |
|
495 | + $datedelivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int')); |
|
496 | 496 | |
497 | 497 | $object->fetch($id); |
498 | - $result=$object->set_date_livraison($user,$datedelivery); |
|
498 | + $result = $object->set_date_livraison($user, $datedelivery); |
|
499 | 499 | if ($result < 0) |
500 | 500 | { |
501 | 501 | setEventMessages($object->error, $object->errors, 'errors'); |
@@ -514,23 +514,23 @@ discard block |
||
514 | 514 | && $user->rights->expedition->creer |
515 | 515 | ) |
516 | 516 | { |
517 | - $error=0; |
|
517 | + $error = 0; |
|
518 | 518 | |
519 | - if ($action == 'settracking_number') $object->tracking_number = trim(GETPOST('tracking_number','alpha')); |
|
520 | - if ($action == 'settracking_url') $object->tracking_url = trim(GETPOST('tracking_url','int')); |
|
521 | - if ($action == 'settrueWeight') { |
|
522 | - $object->trueWeight = trim(GETPOST('trueWeight','int')); |
|
523 | - $object->weight_units = GETPOST('weight_units','int'); |
|
519 | + if ($action == 'settracking_number') $object->tracking_number = trim(GETPOST('tracking_number', 'alpha')); |
|
520 | + if ($action == 'settracking_url') $object->tracking_url = trim(GETPOST('tracking_url', 'int')); |
|
521 | + if ($action == 'settrueWeight') { |
|
522 | + $object->trueWeight = trim(GETPOST('trueWeight', 'int')); |
|
523 | + $object->weight_units = GETPOST('weight_units', 'int'); |
|
524 | 524 | } |
525 | - if ($action == 'settrueWidth') $object->trueWidth = trim(GETPOST('trueWidth','int')); |
|
526 | - if ($action == 'settrueHeight'){ |
|
527 | - $object->trueHeight = trim(GETPOST('trueHeight','int')); |
|
528 | - $object->size_units = GETPOST('size_units','int'); |
|
525 | + if ($action == 'settrueWidth') $object->trueWidth = trim(GETPOST('trueWidth', 'int')); |
|
526 | + if ($action == 'settrueHeight') { |
|
527 | + $object->trueHeight = trim(GETPOST('trueHeight', 'int')); |
|
528 | + $object->size_units = GETPOST('size_units', 'int'); |
|
529 | 529 | } |
530 | - if ($action == 'settrueDepth') $object->trueDepth = trim(GETPOST('trueDepth','int')); |
|
531 | - if ($action == 'setshipping_method_id') $object->shipping_method_id = trim(GETPOST('shipping_method_id','int')); |
|
530 | + if ($action == 'settrueDepth') $object->trueDepth = trim(GETPOST('trueDepth', 'int')); |
|
531 | + if ($action == 'setshipping_method_id') $object->shipping_method_id = trim(GETPOST('shipping_method_id', 'int')); |
|
532 | 532 | |
533 | - if (! $error) |
|
533 | + if (!$error) |
|
534 | 534 | { |
535 | 535 | if ($object->update($user) >= 0) |
536 | 536 | { |
@@ -540,15 +540,15 @@ discard block |
||
540 | 540 | setEventMessages($object->error, $object->errors, 'errors'); |
541 | 541 | } |
542 | 542 | |
543 | - $action=""; |
|
543 | + $action = ""; |
|
544 | 544 | } |
545 | 545 | |
546 | 546 | elseif ($action == 'classifybilled') |
547 | 547 | { |
548 | 548 | $object->fetch($id); |
549 | 549 | $result = $object->set_billed(); |
550 | - if($result >= 0) { |
|
551 | - header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id); |
|
550 | + if ($result >= 0) { |
|
551 | + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); |
|
552 | 552 | exit(); |
553 | 553 | } |
554 | 554 | } |
@@ -557,8 +557,8 @@ discard block |
||
557 | 557 | { |
558 | 558 | $object->fetch($id); |
559 | 559 | $result = $object->setClosed(); |
560 | - if($result >= 0) { |
|
561 | - header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id); |
|
560 | + if ($result >= 0) { |
|
561 | + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); |
|
562 | 562 | exit(); |
563 | 563 | } |
564 | 564 | } |
@@ -566,14 +566,14 @@ discard block |
||
566 | 566 | /* |
567 | 567 | * delete a line |
568 | 568 | */ |
569 | - elseif ($action == 'deleteline' && ! empty($line_id)) |
|
569 | + elseif ($action == 'deleteline' && !empty($line_id)) |
|
570 | 570 | { |
571 | 571 | $object->fetch($id); |
572 | 572 | $lines = $object->lines; |
573 | 573 | $line = new ExpeditionLigne($db); |
574 | 574 | |
575 | 575 | $num_prod = count($lines); |
576 | - for ($i = 0 ; $i < $num_prod ; $i++) |
|
576 | + for ($i = 0; $i < $num_prod; $i++) |
|
577 | 577 | { |
578 | 578 | if ($lines[$i]->id == $line_id) |
579 | 579 | { |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | // delete multi warehouse lines |
583 | 583 | foreach ($lines[$i]->details_entrepot as $details_entrepot) { |
584 | 584 | $line->id = $details_entrepot->line_id; |
585 | - if (! $error && $line->delete($user) < 0) |
|
585 | + if (!$error && $line->delete($user) < 0) |
|
586 | 586 | { |
587 | 587 | $error++; |
588 | 588 | } |
@@ -592,7 +592,7 @@ discard block |
||
592 | 592 | { |
593 | 593 | // delete single warehouse line |
594 | 594 | $line->id = $line_id; |
595 | - if (! $error && $line->delete($user) < 0) |
|
595 | + if (!$error && $line->delete($user) < 0) |
|
596 | 596 | { |
597 | 597 | $error++; |
598 | 598 | } |
@@ -601,8 +601,8 @@ discard block |
||
601 | 601 | unset($_POST["lineid"]); |
602 | 602 | } |
603 | 603 | |
604 | - if(! $error) { |
|
605 | - header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id); |
|
604 | + if (!$error) { |
|
605 | + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); |
|
606 | 606 | exit(); |
607 | 607 | } |
608 | 608 | else |
@@ -617,13 +617,13 @@ discard block |
||
617 | 617 | else if ($action == 'updateline' && $user->rights->expedition->creer && GETPOST('save')) |
618 | 618 | { |
619 | 619 | // Clean parameters |
620 | - $qty=0; |
|
620 | + $qty = 0; |
|
621 | 621 | $entrepot_id = 0; |
622 | 622 | $batch_id = 0; |
623 | 623 | |
624 | 624 | $lines = $object->lines; |
625 | 625 | $num_prod = count($lines); |
626 | - for ($i = 0 ; $i < $num_prod ; $i++) |
|
626 | + for ($i = 0; $i < $num_prod; $i++) |
|
627 | 627 | { |
628 | 628 | if ($lines[$i]->id == $line_id) // we have found line to update |
629 | 629 | { |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | // Unset extrafield POST Data |
636 | 636 | if (is_array($extralabelsline)) { |
637 | 637 | foreach ($extralabelsline as $key => $value) { |
638 | - unset($_POST["options_" . $key]); |
|
638 | + unset($_POST["options_".$key]); |
|
639 | 639 | } |
640 | 640 | } |
641 | 641 | $line->fk_product = $lines[$i]->fk_product; |
@@ -645,11 +645,11 @@ discard block |
||
645 | 645 | foreach ($lines[$i]->detail_batch as $detail_batch) |
646 | 646 | { |
647 | 647 | $lotStock = new Productbatch($db); |
648 | - $batch="batchl".$detail_batch->fk_expeditiondet."_".$detail_batch->fk_origin_stock; |
|
648 | + $batch = "batchl".$detail_batch->fk_expeditiondet."_".$detail_batch->fk_origin_stock; |
|
649 | 649 | $qty = "qtyl".$detail_batch->fk_expeditiondet.'_'.$detail_batch->id; |
650 | - $batch_id = GETPOST($batch,'int'); |
|
650 | + $batch_id = GETPOST($batch, 'int'); |
|
651 | 651 | $batch_qty = GETPOST($qty, 'int'); |
652 | - if (! empty($batch_id) && ($batch_id != $detail_batch->fk_origin_stock || $batch_qty != $detail_batch->qty)) |
|
652 | + if (!empty($batch_id) && ($batch_id != $detail_batch->fk_origin_stock || $batch_qty != $detail_batch->qty)) |
|
653 | 653 | { |
654 | 654 | if ($lotStock->fetch($batch_id) > 0 && $line->fetch($detail_batch->fk_expeditiondet) > 0) // $line is ExpeditionLine |
655 | 655 | { |
@@ -660,7 +660,7 @@ discard block |
||
660 | 660 | } |
661 | 661 | |
662 | 662 | // detail_batch can be an object with keys, or an array of ExpeditionLineBatch |
663 | - if (empty($line->detail_batch)) $line->detail_batch=new stdClass(); |
|
663 | + if (empty($line->detail_batch)) $line->detail_batch = new stdClass(); |
|
664 | 664 | |
665 | 665 | $line->detail_batch->fk_origin_stock = $batch_id; |
666 | 666 | $line->detail_batch->batch = $lotStock->batch; |
@@ -683,12 +683,12 @@ discard block |
||
683 | 683 | } |
684 | 684 | // add new batch |
685 | 685 | $lotStock = new Productbatch($db); |
686 | - $batch="batchl".$line_id."_0"; |
|
686 | + $batch = "batchl".$line_id."_0"; |
|
687 | 687 | $qty = "qtyl".$line_id."_0"; |
688 | - $batch_id = GETPOST($batch,'int'); |
|
688 | + $batch_id = GETPOST($batch, 'int'); |
|
689 | 689 | $batch_qty = GETPOST($qty, 'int'); |
690 | 690 | $lineIdToAddLot = 0; |
691 | - if ($batch_qty > 0 && ! empty($batch_id)) |
|
691 | + if ($batch_qty > 0 && !empty($batch_id)) |
|
692 | 692 | { |
693 | 693 | if ($lotStock->fetch($batch_id) > 0) |
694 | 694 | { |
@@ -764,10 +764,10 @@ discard block |
||
764 | 764 | if ($lines[$i]->entrepot_id > 0) |
765 | 765 | { |
766 | 766 | // single warehouse shipment line |
767 | - $stockLocation="entl".$line_id; |
|
767 | + $stockLocation = "entl".$line_id; |
|
768 | 768 | $qty = "qtyl".$line_id; |
769 | 769 | $line->id = $line_id; |
770 | - $line->entrepot_id = GETPOST($stockLocation,'int'); |
|
770 | + $line->entrepot_id = GETPOST($stockLocation, 'int'); |
|
771 | 771 | $line->qty = GETPOST($qty, 'int'); |
772 | 772 | if ($line->update($user) < 0) { |
773 | 773 | setEventMessages($line->error, $line->errors, 'errors'); |
@@ -781,10 +781,10 @@ discard block |
||
781 | 781 | // multi warehouse shipment lines |
782 | 782 | foreach ($lines[$i]->details_entrepot as $detail_entrepot) |
783 | 783 | { |
784 | - if (! $error) { |
|
785 | - $stockLocation="entl".$detail_entrepot->line_id; |
|
784 | + if (!$error) { |
|
785 | + $stockLocation = "entl".$detail_entrepot->line_id; |
|
786 | 786 | $qty = "qtyl".$detail_entrepot->line_id; |
787 | - $warehouse = GETPOST($stockLocation,'int'); |
|
787 | + $warehouse = GETPOST($stockLocation, 'int'); |
|
788 | 788 | if (!empty ($warehouse)) |
789 | 789 | { |
790 | 790 | $line->id = $detail_entrepot->line_id; |
@@ -819,16 +819,16 @@ discard block |
||
819 | 819 | |
820 | 820 | unset($_POST["lineid"]); |
821 | 821 | |
822 | - if (! $error) { |
|
822 | + if (!$error) { |
|
823 | 823 | if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { |
824 | 824 | // Define output language |
825 | 825 | $outputlangs = $langs; |
826 | 826 | $newlang = ''; |
827 | - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) |
|
828 | - $newlang = GETPOST('lang_id','aZ09'); |
|
827 | + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) |
|
828 | + $newlang = GETPOST('lang_id', 'aZ09'); |
|
829 | 829 | if ($conf->global->MAIN_MULTILANGS && empty($newlang)) |
830 | 830 | $newlang = $object->thirdparty->default_lang; |
831 | - if (! empty($newlang)) { |
|
831 | + if (!empty($newlang)) { |
|
832 | 832 | $outputlangs = new Translate("", $conf); |
833 | 833 | $outputlangs->setDefaultLang($newlang); |
834 | 834 | } |
@@ -839,24 +839,24 @@ discard block |
||
839 | 839 | } |
840 | 840 | else |
841 | 841 | { |
842 | - header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $object->id); // Pour reaffichage de la fiche en cours d'edition |
|
842 | + header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id); // Pour reaffichage de la fiche en cours d'edition |
|
843 | 843 | exit(); |
844 | 844 | } |
845 | 845 | } |
846 | 846 | |
847 | - else if ($action == 'updateline' && $user->rights->expedition->creer && GETPOST('cancel','alpha') == $langs->trans('Cancel')) { |
|
848 | - header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $object->id); // Pour reaffichage de la fiche en cours d'edition |
|
847 | + else if ($action == 'updateline' && $user->rights->expedition->creer && GETPOST('cancel', 'alpha') == $langs->trans('Cancel')) { |
|
848 | + header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id); // Pour reaffichage de la fiche en cours d'edition |
|
849 | 849 | exit(); |
850 | 850 | } |
851 | 851 | |
852 | 852 | include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; |
853 | 853 | |
854 | 854 | // Actions to send emails |
855 | - if (empty($id)) $id=$facid; |
|
856 | - $trigger_name='SHIPPING_SENTBYMAIL'; |
|
857 | - $paramname='id'; |
|
858 | - $mode='emailfromshipment'; |
|
859 | - $trackid='shi'.$object->id; |
|
855 | + if (empty($id)) $id = $facid; |
|
856 | + $trigger_name = 'SHIPPING_SENTBYMAIL'; |
|
857 | + $paramname = 'id'; |
|
858 | + $mode = 'emailfromshipment'; |
|
859 | + $trackid = 'shi'.$object->id; |
|
860 | 860 | include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; |
861 | 861 | } |
862 | 862 | |
@@ -865,12 +865,12 @@ discard block |
||
865 | 865 | * View |
866 | 866 | */ |
867 | 867 | |
868 | -llxHeader('',$langs->trans('Shipment'),'Expedition'); |
|
868 | +llxHeader('', $langs->trans('Shipment'), 'Expedition'); |
|
869 | 869 | |
870 | 870 | $form = new Form($db); |
871 | 871 | $formfile = new FormFile($db); |
872 | 872 | $formproduct = new FormProduct($db); |
873 | -if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } |
|
873 | +if (!empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } |
|
874 | 874 | |
875 | 875 | $product_static = new Product($db); |
876 | 876 | $shipment_static = new Expedition($db); |
@@ -880,7 +880,7 @@ discard block |
||
880 | 880 | { |
881 | 881 | print load_fiche_titre($langs->trans("CreateShipment")).'<br>'; |
882 | 882 | print $langs->trans("ShipmentCreationIsDoneFromOrder"); |
883 | - $action=''; $id=''; $ref=''; |
|
883 | + $action = ''; $id = ''; $ref = ''; |
|
884 | 884 | } |
885 | 885 | |
886 | 886 | // Mode creation. |
@@ -889,7 +889,7 @@ discard block |
||
889 | 889 | $expe = new Expedition($db); |
890 | 890 | |
891 | 891 | print load_fiche_titre($langs->trans("CreateShipment")); |
892 | - if (! $origin) |
|
892 | + if (!$origin) |
|
893 | 893 | { |
894 | 894 | setEventMessages($langs->trans("ErrorBadParameters"), null, 'errors'); |
895 | 895 | } |
@@ -907,7 +907,7 @@ discard block |
||
907 | 907 | $author = new User($db); |
908 | 908 | $author->fetch($object->user_author_id); |
909 | 909 | |
910 | - if (! empty($conf->stock->enabled)) $entrepot = new Entrepot($db); |
|
910 | + if (!empty($conf->stock->enabled)) $entrepot = new Entrepot($db); |
|
911 | 911 | |
912 | 912 | print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">'; |
913 | 913 | print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
@@ -915,9 +915,9 @@ discard block |
||
915 | 915 | print '<input type="hidden" name="origin" value="'.$origin.'">'; |
916 | 916 | print '<input type="hidden" name="origin_id" value="'.$object->id.'">'; |
917 | 917 | print '<input type="hidden" name="ref_int" value="'.$object->ref_int.'">'; |
918 | - if (GETPOST('entrepot_id','int')) |
|
918 | + if (GETPOST('entrepot_id', 'int')) |
|
919 | 919 | { |
920 | - print '<input type="hidden" name="entrepot_id" value="'.GETPOST('entrepot_id','int').'">'; |
|
920 | + print '<input type="hidden" name="entrepot_id" value="'.GETPOST('entrepot_id', 'int').'">'; |
|
921 | 921 | } |
922 | 922 | |
923 | 923 | dol_fiche_head(''); |
@@ -926,13 +926,13 @@ discard block |
||
926 | 926 | |
927 | 927 | // Ref |
928 | 928 | print '<tr><td class="titlefieldcreate fieldrequired">'; |
929 | - if ($origin == 'commande' && ! empty($conf->commande->enabled)) |
|
929 | + if ($origin == 'commande' && !empty($conf->commande->enabled)) |
|
930 | 930 | { |
931 | - print $langs->trans("RefOrder").'</td><td colspan="3"><a href="'.DOL_URL_ROOT.'/commande/card.php?id='.$object->id.'">'.img_object($langs->trans("ShowOrder"),'order').' '.$object->ref; |
|
931 | + print $langs->trans("RefOrder").'</td><td colspan="3"><a href="'.DOL_URL_ROOT.'/commande/card.php?id='.$object->id.'">'.img_object($langs->trans("ShowOrder"), 'order').' '.$object->ref; |
|
932 | 932 | } |
933 | - if ($origin == 'propal' && ! empty($conf->propal->enabled)) |
|
933 | + if ($origin == 'propal' && !empty($conf->propal->enabled)) |
|
934 | 934 | { |
935 | - print $langs->trans("RefProposal").'</td><td colspan="3"><a href="'.DOL_URL_ROOT.'/comm/card.php?id='.$object->id.'">'.img_object($langs->trans("ShowProposal"),'propal').' '.$object->ref; |
|
935 | + print $langs->trans("RefProposal").'</td><td colspan="3"><a href="'.DOL_URL_ROOT.'/comm/card.php?id='.$object->id.'">'.img_object($langs->trans("ShowProposal"), 'propal').' '.$object->ref; |
|
936 | 936 | } |
937 | 937 | print '</a></td>'; |
938 | 938 | print "</tr>\n"; |
@@ -953,17 +953,17 @@ discard block |
||
953 | 953 | print '</tr>'; |
954 | 954 | |
955 | 955 | // Project |
956 | - if (! empty($conf->projet->enabled)) |
|
956 | + if (!empty($conf->projet->enabled)) |
|
957 | 957 | { |
958 | - $projectid = GETPOST('projectid','int')?GETPOST('projectid','int'):0; |
|
959 | - if(empty($projectid) && ! empty($object->fk_project)) $projectid = $object->fk_project; |
|
958 | + $projectid = GETPOST('projectid', 'int') ?GETPOST('projectid', 'int') : 0; |
|
959 | + if (empty($projectid) && !empty($object->fk_project)) $projectid = $object->fk_project; |
|
960 | 960 | if ($origin == 'project') $projectid = ($originid ? $originid : 0); |
961 | 961 | |
962 | 962 | $langs->load("projects"); |
963 | 963 | print '<tr>'; |
964 | - print '<td>' . $langs->trans("Project") . '</td><td colspan="2">'; |
|
964 | + print '<td>'.$langs->trans("Project").'</td><td colspan="2">'; |
|
965 | 965 | $numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0); |
966 | - print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'">' . $langs->trans("AddProject") . '</a>'; |
|
966 | + print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$soc->id.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'">'.$langs->trans("AddProject").'</a>'; |
|
967 | 967 | print '</td>'; |
968 | 968 | print '</tr>'; |
969 | 969 | } |
@@ -972,8 +972,8 @@ discard block |
||
972 | 972 | print '<tr><td>'.$langs->trans("DateDeliveryPlanned").'</td>'; |
973 | 973 | print '<td colspan="3">'; |
974 | 974 | //print dol_print_date($object->date_livraison,"day"); // date_livraison come from order and will be stored into date_delivery planed. |
975 | - $date_delivery = ($date_delivery?$date_delivery:$object->date_livraison); // $date_delivery comes from GETPOST |
|
976 | - print $form->selectDate($date_delivery?$date_delivery:-1, 'date_delivery', 1, 1, 1); |
|
975 | + $date_delivery = ($date_delivery ? $date_delivery : $object->date_livraison); // $date_delivery comes from GETPOST |
|
976 | + print $form->selectDate($date_delivery ? $date_delivery : -1, 'date_delivery', 1, 1, 1); |
|
977 | 977 | print "</td>\n"; |
978 | 978 | print '</tr>'; |
979 | 979 | |
@@ -985,7 +985,7 @@ discard block |
||
985 | 985 | print "</td></tr>"; |
986 | 986 | |
987 | 987 | // Note Private |
988 | - if ($object->note_private && ! $user->societe_id) |
|
988 | + if ($object->note_private && !$user->societe_id) |
|
989 | 989 | { |
990 | 990 | print '<tr><td>'.$langs->trans("NotePrivate").'</td>'; |
991 | 991 | print '<td colspan="3">'; |
@@ -997,20 +997,20 @@ discard block |
||
997 | 997 | // Weight |
998 | 998 | print '<tr><td>'; |
999 | 999 | print $langs->trans("Weight"); |
1000 | - print '</td><td colspan="3"><input name="weight" size="4" value="'.GETPOST('weight','int').'"> '; |
|
1001 | - $text=$formproduct->select_measuring_units("weight_units","weight",GETPOST('weight_units','int')); |
|
1002 | - $htmltext=$langs->trans("KeepEmptyForAutoCalculation"); |
|
1000 | + print '</td><td colspan="3"><input name="weight" size="4" value="'.GETPOST('weight', 'int').'"> '; |
|
1001 | + $text = $formproduct->select_measuring_units("weight_units", "weight", GETPOST('weight_units', 'int')); |
|
1002 | + $htmltext = $langs->trans("KeepEmptyForAutoCalculation"); |
|
1003 | 1003 | print $form->textwithpicto($text, $htmltext); |
1004 | 1004 | print '</td></tr>'; |
1005 | 1005 | // Dim |
1006 | 1006 | print '<tr><td>'; |
1007 | 1007 | print $langs->trans("Width").' x '.$langs->trans("Height").' x '.$langs->trans("Depth"); |
1008 | - print ' </td><td colspan="3"><input name="sizeW" size="4" value="'.GETPOST('sizeW','int').'">'; |
|
1009 | - print ' x <input name="sizeH" size="4" value="'.GETPOST('sizeH','int').'">'; |
|
1010 | - print ' x <input name="sizeS" size="4" value="'.GETPOST('sizeS','int').'">'; |
|
1008 | + print ' </td><td colspan="3"><input name="sizeW" size="4" value="'.GETPOST('sizeW', 'int').'">'; |
|
1009 | + print ' x <input name="sizeH" size="4" value="'.GETPOST('sizeH', 'int').'">'; |
|
1010 | + print ' x <input name="sizeS" size="4" value="'.GETPOST('sizeS', 'int').'">'; |
|
1011 | 1011 | print ' '; |
1012 | - $text=$formproduct->select_measuring_units("size_units","size"); |
|
1013 | - $htmltext=$langs->trans("KeepEmptyForAutoCalculation"); |
|
1012 | + $text = $formproduct->select_measuring_units("size_units", "size"); |
|
1013 | + $htmltext = $langs->trans("KeepEmptyForAutoCalculation"); |
|
1014 | 1014 | print $form->textwithpicto($text, $htmltext); |
1015 | 1015 | print '</td></tr>'; |
1016 | 1016 | |
@@ -1018,19 +1018,19 @@ discard block |
||
1018 | 1018 | print "<tr><td>".$langs->trans("DeliveryMethod")."</td>"; |
1019 | 1019 | print '<td colspan="3">'; |
1020 | 1020 | $expe->fetch_delivery_methods(); |
1021 | - print $form->selectarray("shipping_method_id", $expe->meths, GETPOST('shipping_method_id','int'),1,0,0,"",1); |
|
1022 | - if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); |
|
1021 | + print $form->selectarray("shipping_method_id", $expe->meths, GETPOST('shipping_method_id', 'int'), 1, 0, 0, "", 1); |
|
1022 | + if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
1023 | 1023 | print "</td></tr>\n"; |
1024 | 1024 | |
1025 | 1025 | // Tracking number |
1026 | 1026 | print "<tr><td>".$langs->trans("TrackingNumber")."</td>"; |
1027 | 1027 | print '<td colspan="3">'; |
1028 | - print '<input name="tracking_number" size="20" value="'.GETPOST('tracking_number','alpha').'">'; |
|
1028 | + print '<input name="tracking_number" size="20" value="'.GETPOST('tracking_number', 'alpha').'">'; |
|
1029 | 1029 | print "</td></tr>\n"; |
1030 | 1030 | |
1031 | 1031 | // Other attributes |
1032 | 1032 | $parameters = array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"', 'socid'=>$socid); |
1033 | - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$expe,$action); // Note that $action and $object may have been modified by hook |
|
1033 | + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $expe, $action); // Note that $action and $object may have been modified by hook |
|
1034 | 1034 | print $hookmanager->resPrint; |
1035 | 1035 | |
1036 | 1036 | if (empty($reshook)) { |
@@ -1050,12 +1050,12 @@ discard block |
||
1050 | 1050 | print '<tr>'; |
1051 | 1051 | print '<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans("IncotermLabel"), $object->libelle_incoterms, 1).'</label></td>'; |
1052 | 1052 | print '<td colspan="3" class="maxwidthonsmartphone">'; |
1053 | - print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:'')); |
|
1053 | + print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : '')); |
|
1054 | 1054 | print '</td></tr>'; |
1055 | 1055 | } |
1056 | 1056 | |
1057 | 1057 | // Document model |
1058 | - include_once DOL_DOCUMENT_ROOT . '/core/modules/expedition/modules_expedition.php'; |
|
1058 | + include_once DOL_DOCUMENT_ROOT.'/core/modules/expedition/modules_expedition.php'; |
|
1059 | 1059 | $liste = ModelePdfExpedition::liste_modeles($db); |
1060 | 1060 | if (count($liste) > 1) |
1061 | 1061 | { |
@@ -1077,16 +1077,16 @@ discard block |
||
1077 | 1077 | print '<script type="text/javascript" language="javascript"> |
1078 | 1078 | jQuery(document).ready(function() { |
1079 | 1079 | jQuery("#autofill").click(function() {'; |
1080 | - $i=0; |
|
1081 | - while($i < $numAsked) |
|
1080 | + $i = 0; |
|
1081 | + while ($i < $numAsked) |
|
1082 | 1082 | { |
1083 | 1083 | print 'jQuery("#qtyl'.$i.'").val(jQuery("#qtyasked'.$i.'").val() - jQuery("#qtydelivered'.$i.'").val());'."\n"; |
1084 | 1084 | $i++; |
1085 | 1085 | } |
1086 | 1086 | print '}); |
1087 | 1087 | jQuery("#autoreset").click(function() {'; |
1088 | - $i=0; |
|
1089 | - while($i < $numAsked) |
|
1088 | + $i = 0; |
|
1089 | + while ($i < $numAsked) |
|
1090 | 1090 | { |
1091 | 1091 | print 'jQuery("#qtyl'.$i.'").val(0);'."\n"; |
1092 | 1092 | $i++; |
@@ -1118,7 +1118,7 @@ discard block |
||
1118 | 1118 | print ' / <a href="#" id="autoreset">'.$langs->trans("Reset").'</a>)'; |
1119 | 1119 | } |
1120 | 1120 | print '</td>'; |
1121 | - if (! empty($conf->stock->enabled)) |
|
1121 | + if (!empty($conf->stock->enabled)) |
|
1122 | 1122 | { |
1123 | 1123 | if (empty($conf->productbatch->enabled)) |
1124 | 1124 | { |
@@ -1141,11 +1141,11 @@ discard block |
||
1141 | 1141 | |
1142 | 1142 | |
1143 | 1143 | // Show product and description |
1144 | - $type=$line->product_type?$line->product_type:$line->fk_product_type; |
|
1144 | + $type = $line->product_type ? $line->product_type : $line->fk_product_type; |
|
1145 | 1145 | // Try to enhance type detection using date_start and date_end for free lines where type |
1146 | 1146 | // was not saved. |
1147 | - if (! empty($line->date_start)) $type=1; |
|
1148 | - if (! empty($line->date_end)) $type=1; |
|
1147 | + if (!empty($line->date_start)) $type = 1; |
|
1148 | + if (!empty($line->date_end)) $type = 1; |
|
1149 | 1149 | |
1150 | 1150 | print '<!-- line '.$line->rowid.' for product -->'."\n"; |
1151 | 1151 | print '<tr class="oddeven">'."\n"; |
@@ -1154,29 +1154,29 @@ discard block |
||
1154 | 1154 | if ($line->fk_product > 0) // If predefined product |
1155 | 1155 | { |
1156 | 1156 | $product->fetch($line->fk_product); |
1157 | - $product->load_stock('warehouseopen'); // Load all $product->stock_warehouse[idwarehouse]->detail_batch |
|
1157 | + $product->load_stock('warehouseopen'); // Load all $product->stock_warehouse[idwarehouse]->detail_batch |
|
1158 | 1158 | //var_dump($product->stock_warehouse[1]); |
1159 | 1159 | |
1160 | 1160 | print '<td>'; |
1161 | 1161 | print '<a name="'.$line->rowid.'"></a>'; // ancre pour retourner sur la ligne |
1162 | 1162 | |
1163 | 1163 | // Show product and description |
1164 | - $product_static->type=$line->fk_product_type; |
|
1165 | - $product_static->id=$line->fk_product; |
|
1166 | - $product_static->ref=$line->ref; |
|
1167 | - $product_static->status_batch=$line->product_tobatch; |
|
1168 | - $text=$product_static->getNomUrl(1); |
|
1169 | - $text.= ' - '.(! empty($line->label)?$line->label:$line->product_label); |
|
1170 | - $description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($line->desc)); |
|
1171 | - print $form->textwithtooltip($text,$description,3,'','',$i); |
|
1164 | + $product_static->type = $line->fk_product_type; |
|
1165 | + $product_static->id = $line->fk_product; |
|
1166 | + $product_static->ref = $line->ref; |
|
1167 | + $product_static->status_batch = $line->product_tobatch; |
|
1168 | + $text = $product_static->getNomUrl(1); |
|
1169 | + $text .= ' - '.(!empty($line->label) ? $line->label : $line->product_label); |
|
1170 | + $description = ($conf->global->PRODUIT_DESC_IN_FORM ? '' : dol_htmlentitiesbr($line->desc)); |
|
1171 | + print $form->textwithtooltip($text, $description, 3, '', '', $i); |
|
1172 | 1172 | |
1173 | 1173 | // Show range |
1174 | - print_date_range($db->jdate($line->date_start),$db->jdate($line->date_end)); |
|
1174 | + print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end)); |
|
1175 | 1175 | |
1176 | 1176 | // Add description in form |
1177 | - if (! empty($conf->global->PRODUIT_DESC_IN_FORM)) |
|
1177 | + if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) |
|
1178 | 1178 | { |
1179 | - print ($line->desc && $line->desc!=$line->product_label)?'<br>'.dol_htmlentitiesbr($line->desc):''; |
|
1179 | + print ($line->desc && $line->desc != $line->product_label) ? '<br>'.dol_htmlentitiesbr($line->desc) : ''; |
|
1180 | 1180 | } |
1181 | 1181 | |
1182 | 1182 | print '</td>'; |
@@ -1184,18 +1184,18 @@ discard block |
||
1184 | 1184 | else |
1185 | 1185 | { |
1186 | 1186 | print "<td>"; |
1187 | - if ($type==1) $text = img_object($langs->trans('Service'),'service'); |
|
1188 | - else $text = img_object($langs->trans('Product'),'product'); |
|
1187 | + if ($type == 1) $text = img_object($langs->trans('Service'), 'service'); |
|
1188 | + else $text = img_object($langs->trans('Product'), 'product'); |
|
1189 | 1189 | |
1190 | - if (! empty($line->label)) { |
|
1191 | - $text.= ' <strong>'.$line->label.'</strong>'; |
|
1192 | - print $form->textwithtooltip($text,$line->desc,3,'','',$i); |
|
1190 | + if (!empty($line->label)) { |
|
1191 | + $text .= ' <strong>'.$line->label.'</strong>'; |
|
1192 | + print $form->textwithtooltip($text, $line->desc, 3, '', '', $i); |
|
1193 | 1193 | } else { |
1194 | 1194 | print $text.' '.nl2br($line->desc); |
1195 | 1195 | } |
1196 | 1196 | |
1197 | 1197 | // Show range |
1198 | - print_date_range($db->jdate($line->date_start),$db->jdate($line->date_end)); |
|
1198 | + print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end)); |
|
1199 | 1199 | print "</td>\n"; |
1200 | 1200 | } |
1201 | 1201 | |
@@ -1203,7 +1203,7 @@ discard block |
||
1203 | 1203 | print '<td align="center">'.$line->qty; |
1204 | 1204 | print '<input name="qtyasked'.$indiceAsked.'" id="qtyasked'.$indiceAsked.'" type="hidden" value="'.$line->qty.'">'; |
1205 | 1205 | print '</td>'; |
1206 | - $qtyProdCom=$line->qty; |
|
1206 | + $qtyProdCom = $line->qty; |
|
1207 | 1207 | |
1208 | 1208 | // Qty already shipped |
1209 | 1209 | print '<td align="center">'; |
@@ -1222,23 +1222,23 @@ discard block |
||
1222 | 1222 | { |
1223 | 1223 | $quantityToBeDelivered = $quantityAsked - $quantityDelivered; |
1224 | 1224 | } |
1225 | - $warehouse_id = GETPOST('entrepot_id','int'); |
|
1225 | + $warehouse_id = GETPOST('entrepot_id', 'int'); |
|
1226 | 1226 | |
1227 | 1227 | $warehouseObject = null; |
1228 | - if ($warehouse_id > 0 || ! ($line->fk_product > 0) || empty($conf->stock->enabled)) // If warehouse was already selected or if product is not a predefined, we go into this part with no multiwarehouse selection |
|
1228 | + if ($warehouse_id > 0 || !($line->fk_product > 0) || empty($conf->stock->enabled)) // If warehouse was already selected or if product is not a predefined, we go into this part with no multiwarehouse selection |
|
1229 | 1229 | { |
1230 | 1230 | print '<!-- Case warehouse already known or product not a predefined product -->'; |
1231 | 1231 | //ship from preselected location |
1232 | 1232 | $stock = + $product->stock_warehouse[$warehouse_id]->real; // Convert to number |
1233 | - $deliverableQty=min($quantityToBeDelivered, $stock); |
|
1233 | + $deliverableQty = min($quantityToBeDelivered, $stock); |
|
1234 | 1234 | if ($deliverableQty < 0) $deliverableQty = 0; |
1235 | - if (empty($conf->productbatch->enabled) || ! $product->hasbatch()) |
|
1235 | + if (empty($conf->productbatch->enabled) || !$product->hasbatch()) |
|
1236 | 1236 | { |
1237 | 1237 | // Quantity to send |
1238 | 1238 | print '<td align="center">'; |
1239 | - if ($line->product_type == Product::TYPE_PRODUCT || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) |
|
1239 | + if ($line->product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) |
|
1240 | 1240 | { |
1241 | - if (GETPOST('qtyl'.$indiceAsked, 'int')) $deliverableQty=GETPOST('qtyl'.$indiceAsked, 'int'); |
|
1241 | + if (GETPOST('qtyl'.$indiceAsked, 'int')) $deliverableQty = GETPOST('qtyl'.$indiceAsked, 'int'); |
|
1242 | 1242 | print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">'; |
1243 | 1243 | print '<input name="qtyl'.$indiceAsked.'" id="qtyl'.$indiceAsked.'" type="text" size="4" value="'.$deliverableQty.'">'; |
1244 | 1244 | } |
@@ -1246,15 +1246,15 @@ discard block |
||
1246 | 1246 | print '</td>'; |
1247 | 1247 | |
1248 | 1248 | // Stock |
1249 | - if (! empty($conf->stock->enabled)) |
|
1249 | + if (!empty($conf->stock->enabled)) |
|
1250 | 1250 | { |
1251 | 1251 | print '<td align="left">'; |
1252 | - if ($line->product_type == Product::TYPE_PRODUCT || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) // Type of product need stock change ? |
|
1252 | + if ($line->product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) // Type of product need stock change ? |
|
1253 | 1253 | { |
1254 | 1254 | // Show warehouse combo list |
1255 | 1255 | $ent = "entl".$indiceAsked; |
1256 | 1256 | $idl = "idl".$indiceAsked; |
1257 | - $tmpentrepot_id = is_numeric(GETPOST($ent,'int'))?GETPOST($ent,'int'):$warehouse_id; |
|
1257 | + $tmpentrepot_id = is_numeric(GETPOST($ent, 'int')) ?GETPOST($ent, 'int') : $warehouse_id; |
|
1258 | 1258 | if ($line->fk_product > 0) |
1259 | 1259 | { |
1260 | 1260 | print '<!-- Show warehouse selection -->'; |
@@ -1264,7 +1264,7 @@ discard block |
||
1264 | 1264 | //print $stock.' '.$quantityToBeDelivered; |
1265 | 1265 | if ($stock < $quantityToBeDelivered) |
1266 | 1266 | { |
1267 | - print ' '.img_warning($langs->trans("StockTooLow")); // Stock too low for this $warehouse_id but you can change warehouse |
|
1267 | + print ' '.img_warning($langs->trans("StockTooLow")); // Stock too low for this $warehouse_id but you can change warehouse |
|
1268 | 1268 | } |
1269 | 1269 | } |
1270 | 1270 | } |
@@ -1279,19 +1279,19 @@ discard block |
||
1279 | 1279 | print "</tr>\n"; |
1280 | 1280 | |
1281 | 1281 | // Show subproducts of product |
1282 | - if (! empty($conf->global->PRODUIT_SOUSPRODUITS) && $line->fk_product > 0) |
|
1282 | + if (!empty($conf->global->PRODUIT_SOUSPRODUITS) && $line->fk_product > 0) |
|
1283 | 1283 | { |
1284 | 1284 | $product->get_sousproduits_arbo(); |
1285 | 1285 | $prods_arbo = $product->get_arbo_each_prod($qtyProdCom); |
1286 | - if(count($prods_arbo) > 0) |
|
1286 | + if (count($prods_arbo) > 0) |
|
1287 | 1287 | { |
1288 | - foreach($prods_arbo as $key => $value) |
|
1288 | + foreach ($prods_arbo as $key => $value) |
|
1289 | 1289 | { |
1290 | 1290 | //print $value[0]; |
1291 | - $img=''; |
|
1291 | + $img = ''; |
|
1292 | 1292 | if ($value['stock'] < $value['stock_alert']) |
1293 | 1293 | { |
1294 | - $img=img_warning($langs->trans("StockTooLow")); |
|
1294 | + $img = img_warning($langs->trans("StockTooLow")); |
|
1295 | 1295 | } |
1296 | 1296 | print "<tr class=\"oddeven\"><td> -> |
1297 | 1297 | <a href=\"".DOL_URL_ROOT."/product/card.php?id=".$value['id']."\">".$value['fullpath']." |
@@ -1304,15 +1304,15 @@ discard block |
||
1304 | 1304 | else |
1305 | 1305 | { |
1306 | 1306 | // Product need lot |
1307 | - print '<td></td><td></td></tr>'; // end line and start a new one for lot/serial |
|
1307 | + print '<td></td><td></td></tr>'; // end line and start a new one for lot/serial |
|
1308 | 1308 | print '<!-- Case product need lot -->'; |
1309 | 1309 | |
1310 | - $staticwarehouse=new Entrepot($db); |
|
1310 | + $staticwarehouse = new Entrepot($db); |
|
1311 | 1311 | if ($warehouse_id > 0) $staticwarehouse->fetch($warehouse_id); |
1312 | 1312 | |
1313 | - $subj=0; |
|
1313 | + $subj = 0; |
|
1314 | 1314 | // Define nb of lines suggested for this order line |
1315 | - $nbofsuggested=0; |
|
1315 | + $nbofsuggested = 0; |
|
1316 | 1316 | if (is_object($product->stock_warehouse[$warehouse_id]) && count($product->stock_warehouse[$warehouse_id]->detail_batch)) |
1317 | 1317 | { |
1318 | 1318 | foreach ($product->stock_warehouse[$warehouse_id]->detail_batch as $dbatch) |
@@ -1326,9 +1326,9 @@ discard block |
||
1326 | 1326 | foreach ($product->stock_warehouse[$warehouse_id]->detail_batch as $dbatch) // $dbatch is instance of Productbatch |
1327 | 1327 | { |
1328 | 1328 | //var_dump($dbatch); |
1329 | - $batchStock = + $dbatch->qty; // To get a numeric |
|
1330 | - $deliverableQty = min($quantityToBeDelivered,$batchStock); |
|
1331 | - print '<!-- subj='.$subj.'/'.$nbofsuggested.' --><tr '.((($subj + 1) == $nbofsuggested)?$bc[$var]:'').'>'; |
|
1329 | + $batchStock = + $dbatch->qty; // To get a numeric |
|
1330 | + $deliverableQty = min($quantityToBeDelivered, $batchStock); |
|
1331 | + print '<!-- subj='.$subj.'/'.$nbofsuggested.' --><tr '.((($subj + 1) == $nbofsuggested) ? $bc[$var] : '').'>'; |
|
1332 | 1332 | print '<td colspan="3" ></td><td align="center">'; |
1333 | 1333 | print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="'.$deliverableQty.'">'; |
1334 | 1334 | print '</td>'; |
@@ -1340,12 +1340,12 @@ discard block |
||
1340 | 1340 | |
1341 | 1341 | print '<input name="batchl'.$indiceAsked.'_'.$subj.'" type="hidden" value="'.$dbatch->id.'">'; |
1342 | 1342 | |
1343 | - $detail=''; |
|
1344 | - $detail.= $langs->trans("Batch").': '.$dbatch->batch; |
|
1345 | - $detail.= ' - '.$langs->trans("SellByDate").': '.dol_print_date($dbatch->sellby,"day"); |
|
1346 | - $detail.= ' - '.$langs->trans("EatByDate").': '.dol_print_date($dbatch->eatby,"day"); |
|
1347 | - $detail.= ' - '.$langs->trans("Qty").': '.$dbatch->qty; |
|
1348 | - $detail.= '<br>'; |
|
1343 | + $detail = ''; |
|
1344 | + $detail .= $langs->trans("Batch").': '.$dbatch->batch; |
|
1345 | + $detail .= ' - '.$langs->trans("SellByDate").': '.dol_print_date($dbatch->sellby, "day"); |
|
1346 | + $detail .= ' - '.$langs->trans("EatByDate").': '.dol_print_date($dbatch->eatby, "day"); |
|
1347 | + $detail .= ' - '.$langs->trans("Qty").': '.$dbatch->qty; |
|
1348 | + $detail .= '<br>'; |
|
1349 | 1349 | print $detail; |
1350 | 1350 | |
1351 | 1351 | $quantityToBeDelivered -= $deliverableQty; |
@@ -1373,15 +1373,15 @@ discard block |
||
1373 | 1373 | else |
1374 | 1374 | { |
1375 | 1375 | // ship from multiple locations |
1376 | - if (empty($conf->productbatch->enabled) || ! $product->hasbatch()) |
|
1376 | + if (empty($conf->productbatch->enabled) || !$product->hasbatch()) |
|
1377 | 1377 | { |
1378 | 1378 | print '<!-- Case warehouse not already known and product does not need lot -->'; |
1379 | - print '<td></td><td></td></tr>'."\n"; // end line and start a new one for each warehouse |
|
1379 | + print '<td></td><td></td></tr>'."\n"; // end line and start a new one for each warehouse |
|
1380 | 1380 | |
1381 | 1381 | print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">'; |
1382 | - $subj=0; |
|
1382 | + $subj = 0; |
|
1383 | 1383 | // Define nb of lines suggested for this order line |
1384 | - $nbofsuggested=0; |
|
1384 | + $nbofsuggested = 0; |
|
1385 | 1385 | foreach ($product->stock_warehouse as $warehouse_id=>$stock_warehouse) |
1386 | 1386 | { |
1387 | 1387 | if ($stock_warehouse->real > 0) |
@@ -1389,19 +1389,19 @@ discard block |
||
1389 | 1389 | $nbofsuggested++; |
1390 | 1390 | } |
1391 | 1391 | } |
1392 | - $tmpwarehouseObject=new Entrepot($db); |
|
1392 | + $tmpwarehouseObject = new Entrepot($db); |
|
1393 | 1393 | foreach ($product->stock_warehouse as $warehouse_id=>$stock_warehouse) // $stock_warehouse is product_stock |
1394 | 1394 | { |
1395 | 1395 | $tmpwarehouseObject->fetch($warehouse_id); |
1396 | 1396 | if ($stock_warehouse->real > 0) |
1397 | 1397 | { |
1398 | 1398 | $stock = + $stock_warehouse->real; // Convert it to number |
1399 | - $deliverableQty = min($quantityToBeDelivered,$stock); |
|
1399 | + $deliverableQty = min($quantityToBeDelivered, $stock); |
|
1400 | 1400 | $deliverableQty = max(0, $deliverableQty); |
1401 | 1401 | // Quantity to send |
1402 | - print '<!-- subj='.$subj.'/'.$nbofsuggested.' --><tr '.((($subj + 1) == $nbofsuggested)?$bc[$var]:'').'>'; |
|
1402 | + print '<!-- subj='.$subj.'/'.$nbofsuggested.' --><tr '.((($subj + 1) == $nbofsuggested) ? $bc[$var] : '').'>'; |
|
1403 | 1403 | print '<td colspan="3" ></td><td align="center"><!-- qty to ship (no lot management for product line indiceAsked='.$indiceAsked.') -->'; |
1404 | - if ($line->product_type == Product::TYPE_PRODUCT || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) |
|
1404 | + if ($line->product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) |
|
1405 | 1405 | { |
1406 | 1406 | print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'" type="text" size="4" value="'.$deliverableQty.'">'; |
1407 | 1407 | print '<input name="ent1'.$indiceAsked.'_'.$subj.'" type="hidden" value="'.$warehouse_id.'">'; |
@@ -1410,10 +1410,10 @@ discard block |
||
1410 | 1410 | print '</td>'; |
1411 | 1411 | |
1412 | 1412 | // Stock |
1413 | - if (! empty($conf->stock->enabled)) |
|
1413 | + if (!empty($conf->stock->enabled)) |
|
1414 | 1414 | { |
1415 | 1415 | print '<td align="left">'; |
1416 | - if ($line->product_type == Product::TYPE_PRODUCT || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) |
|
1416 | + if ($line->product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) |
|
1417 | 1417 | { |
1418 | 1418 | print $tmpwarehouseObject->getNomUrl(0).' '; |
1419 | 1419 | |
@@ -1436,19 +1436,19 @@ discard block |
||
1436 | 1436 | } |
1437 | 1437 | } |
1438 | 1438 | // Show subproducts of product (not recommanded) |
1439 | - if (! empty($conf->global->PRODUIT_SOUSPRODUITS) && $line->fk_product > 0) |
|
1439 | + if (!empty($conf->global->PRODUIT_SOUSPRODUITS) && $line->fk_product > 0) |
|
1440 | 1440 | { |
1441 | 1441 | $product->get_sousproduits_arbo(); |
1442 | 1442 | $prods_arbo = $product->get_arbo_each_prod($qtyProdCom); |
1443 | 1443 | if (count($prods_arbo) > 0) |
1444 | 1444 | { |
1445 | - foreach($prods_arbo as $key => $value) |
|
1445 | + foreach ($prods_arbo as $key => $value) |
|
1446 | 1446 | { |
1447 | 1447 | //print $value[0]; |
1448 | - $img=''; |
|
1448 | + $img = ''; |
|
1449 | 1449 | if ($value['stock'] < $value['stock_alert']) |
1450 | 1450 | { |
1451 | - $img=img_warning($langs->trans("StockTooLow")); |
|
1451 | + $img = img_warning($langs->trans("StockTooLow")); |
|
1452 | 1452 | } |
1453 | 1453 | print '<tr class"oddeven"><td>'; |
1454 | 1454 | print " -> |
@@ -1463,15 +1463,15 @@ discard block |
||
1463 | 1463 | else |
1464 | 1464 | { |
1465 | 1465 | print '<!-- Case warehouse not already known and product need lot -->'; |
1466 | - print '<td></td><td></td></tr>'; // end line and start a new one for lot/serial |
|
1466 | + print '<td></td><td></td></tr>'; // end line and start a new one for lot/serial |
|
1467 | 1467 | |
1468 | - $subj=0; |
|
1468 | + $subj = 0; |
|
1469 | 1469 | print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">'; |
1470 | 1470 | |
1471 | - $tmpwarehouseObject=new Entrepot($db); |
|
1472 | - $productlotObject=new Productlot($db); |
|
1471 | + $tmpwarehouseObject = new Entrepot($db); |
|
1472 | + $productlotObject = new Productlot($db); |
|
1473 | 1473 | // Define nb of lines suggested for this order line |
1474 | - $nbofsuggested=0; |
|
1474 | + $nbofsuggested = 0; |
|
1475 | 1475 | foreach ($product->stock_warehouse as $warehouse_id=>$stock_warehouse) |
1476 | 1476 | { |
1477 | 1477 | if (($stock_warehouse->real > 0) && (count($stock_warehouse->detail_batch))) { |
@@ -1488,10 +1488,10 @@ discard block |
||
1488 | 1488 | foreach ($stock_warehouse->detail_batch as $dbatch) |
1489 | 1489 | { |
1490 | 1490 | //var_dump($dbatch); |
1491 | - $batchStock = + $dbatch->qty; // To get a numeric |
|
1492 | - $deliverableQty = min($quantityToBeDelivered,$batchStock); |
|
1491 | + $batchStock = + $dbatch->qty; // To get a numeric |
|
1492 | + $deliverableQty = min($quantityToBeDelivered, $batchStock); |
|
1493 | 1493 | if ($deliverableQty < 0) $deliverableQty = 0; |
1494 | - print '<!-- subj='.$subj.'/'.$nbofsuggested.' --><tr '.((($subj + 1) == $nbofsuggested)?$bc[$var]:'').'><td colspan="3"></td><td align="center">'; |
|
1494 | + print '<!-- subj='.$subj.'/'.$nbofsuggested.' --><tr '.((($subj + 1) == $nbofsuggested) ? $bc[$var] : '').'><td colspan="3"></td><td align="center">'; |
|
1495 | 1495 | print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="'.$deliverableQty.'">'; |
1496 | 1496 | print '</td>'; |
1497 | 1497 | |
@@ -1524,14 +1524,14 @@ discard block |
||
1524 | 1524 | { |
1525 | 1525 | print '<!-- line not shown yet, we show it -->'; |
1526 | 1526 | print '<tr class="oddeven"><td colspan="3" ></td><td align="center">'; |
1527 | - if ($line->product_type == Product::TYPE_PRODUCT || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) |
|
1527 | + if ($line->product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) |
|
1528 | 1528 | { |
1529 | - $disabled=''; |
|
1530 | - if (! empty($conf->productbatch->enabled) && $product->hasbatch()) |
|
1529 | + $disabled = ''; |
|
1530 | + if (!empty($conf->productbatch->enabled) && $product->hasbatch()) |
|
1531 | 1531 | { |
1532 | - $disabled='disabled="disabled"'; |
|
1532 | + $disabled = 'disabled="disabled"'; |
|
1533 | 1533 | } |
1534 | - print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="0"'.($disabled?' '.$disabled:'').'> '; |
|
1534 | + print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="0"'.($disabled ? ' '.$disabled : '').'> '; |
|
1535 | 1535 | } |
1536 | 1536 | else |
1537 | 1537 | { |
@@ -1540,12 +1540,12 @@ discard block |
||
1540 | 1540 | print '</td>'; |
1541 | 1541 | |
1542 | 1542 | print '<td align="left">'; |
1543 | - if ($line->product_type == Product::TYPE_PRODUCT || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) |
|
1543 | + if ($line->product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) |
|
1544 | 1544 | { |
1545 | - $warehouse_selected_id = GETPOST('entrepot_id','int'); |
|
1545 | + $warehouse_selected_id = GETPOST('entrepot_id', 'int'); |
|
1546 | 1546 | if ($warehouse_selected_id > 0) |
1547 | 1547 | { |
1548 | - $warehouseObject=new Entrepot($db); |
|
1548 | + $warehouseObject = new Entrepot($db); |
|
1549 | 1549 | $warehouseObject->fetch($warehouse_selected_id); |
1550 | 1550 | print img_warning().' '.$langs->trans("NoProductToShipFoundIntoStock", $warehouseObject->libelle); |
1551 | 1551 | } |
@@ -1566,9 +1566,9 @@ discard block |
||
1566 | 1566 | |
1567 | 1567 | |
1568 | 1568 | //Display lines extrafields |
1569 | - if (is_array($extralabelslines) && count($extralabelslines)>0) |
|
1569 | + if (is_array($extralabelslines) && count($extralabelslines) > 0) |
|
1570 | 1570 | { |
1571 | - $colspan=5; |
|
1571 | + $colspan = 5; |
|
1572 | 1572 | $orderLineExtrafields = new Extrafields($db); |
1573 | 1573 | $orderLineExtrafieldLabels = $orderLineExtrafields->fetch_name_optionals_label($object->table_element_line); |
1574 | 1574 | $srcLine = new OrderLine($db); |
@@ -1577,7 +1577,7 @@ discard block |
||
1577 | 1577 | //$line->fetch_optionals($line->id); |
1578 | 1578 | $line->array_options = array_merge($line->array_options, $srcLine->array_options); |
1579 | 1579 | print '<tr class="oddeven">'; |
1580 | - print $line->showOptionals($extrafieldsline, 'edit', array('style'=>$bc[$var], 'colspan'=>$colspan),$indiceAsked); |
|
1580 | + print $line->showOptionals($extrafieldsline, 'edit', array('style'=>$bc[$var], 'colspan'=>$colspan), $indiceAsked); |
|
1581 | 1581 | print '</tr>'; |
1582 | 1582 | } |
1583 | 1583 | |
@@ -1591,7 +1591,7 @@ discard block |
||
1591 | 1591 | print '<div class="center">'; |
1592 | 1592 | print '<input type="submit" class="button" name="add" value="'.dol_escape_htmltag($langs->trans("Create")).'">'; |
1593 | 1593 | print ' '; |
1594 | - print '<input type="'.($backtopage?"submit":"button").'" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'"'.($backtopage?'':' onclick="javascript:history.go(-1)"').'>'; // Cancel for create does not post form if we don't know the backtopage |
|
1594 | + print '<input type="'.($backtopage ? "submit" : "button").'" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'"'.($backtopage ? '' : ' onclick="javascript:history.go(-1)"').'>'; // Cancel for create does not post form if we don't know the backtopage |
|
1595 | 1595 | print '</div>'; |
1596 | 1596 | |
1597 | 1597 | print '</form>'; |
@@ -1622,7 +1622,7 @@ discard block |
||
1622 | 1622 | $typeobject = $object->origin; |
1623 | 1623 | $origin = $object->origin; |
1624 | 1624 | $origin_id = $object->origin_id; |
1625 | - $object->fetch_origin(); // Load property $object->commande, $object->propal, ... |
|
1625 | + $object->fetch_origin(); // Load property $object->commande, $object->propal, ... |
|
1626 | 1626 | } |
1627 | 1627 | |
1628 | 1628 | $soc = new Societe($db); |
@@ -1630,15 +1630,15 @@ discard block |
||
1630 | 1630 | |
1631 | 1631 | $res = $object->fetch_optionals(); |
1632 | 1632 | |
1633 | - $head=shipping_prepare_head($object); |
|
1633 | + $head = shipping_prepare_head($object); |
|
1634 | 1634 | dol_fiche_head($head, 'shipping', $langs->trans("Shipment"), -1, 'sending'); |
1635 | 1635 | |
1636 | - $formconfirm=''; |
|
1636 | + $formconfirm = ''; |
|
1637 | 1637 | |
1638 | 1638 | // Confirm deleteion |
1639 | 1639 | if ($action == 'delete') |
1640 | 1640 | { |
1641 | - $formconfirm=$form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('DeleteSending'),$langs->trans("ConfirmDeleteSending",$object->ref),'confirm_delete','',0,1); |
|
1641 | + $formconfirm = $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('DeleteSending'), $langs->trans("ConfirmDeleteSending", $object->ref), 'confirm_delete', '', 0, 1); |
|
1642 | 1642 | } |
1643 | 1643 | |
1644 | 1644 | // Confirmation validation |
@@ -1654,29 +1654,29 @@ discard block |
||
1654 | 1654 | $numref = $object->ref; |
1655 | 1655 | } |
1656 | 1656 | |
1657 | - $text = $langs->trans("ConfirmValidateSending",$numref); |
|
1657 | + $text = $langs->trans("ConfirmValidateSending", $numref); |
|
1658 | 1658 | |
1659 | - if (! empty($conf->notification->enabled)) |
|
1659 | + if (!empty($conf->notification->enabled)) |
|
1660 | 1660 | { |
1661 | - require_once DOL_DOCUMENT_ROOT .'/core/class/notify.class.php'; |
|
1662 | - $notify=new Notify($db); |
|
1663 | - $text.='<br>'; |
|
1664 | - $text.=$notify->confirmMessage('SHIPPING_VALIDATE',$object->socid, $object); |
|
1661 | + require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php'; |
|
1662 | + $notify = new Notify($db); |
|
1663 | + $text .= '<br>'; |
|
1664 | + $text .= $notify->confirmMessage('SHIPPING_VALIDATE', $object->socid, $object); |
|
1665 | 1665 | } |
1666 | 1666 | |
1667 | - $formconfirm=$form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('ValidateSending'),$text,'confirm_valid','',0,1); |
|
1667 | + $formconfirm = $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('ValidateSending'), $text, 'confirm_valid', '', 0, 1); |
|
1668 | 1668 | } |
1669 | 1669 | // Confirm cancelation |
1670 | 1670 | if ($action == 'annuler') |
1671 | 1671 | { |
1672 | - $formconfirm=$form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('CancelSending'),$langs->trans("ConfirmCancelSending",$object->ref),'confirm_cancel','',0,1); |
|
1672 | + $formconfirm = $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('CancelSending'), $langs->trans("ConfirmCancelSending", $object->ref), 'confirm_cancel', '', 0, 1); |
|
1673 | 1673 | } |
1674 | 1674 | |
1675 | 1675 | // Call Hook formConfirm |
1676 | 1676 | $parameters = array(); |
1677 | 1677 | $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
1678 | - if (empty($reshook)) $formconfirm.=$hookmanager->resPrint; |
|
1679 | - elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint; |
|
1678 | + if (empty($reshook)) $formconfirm .= $hookmanager->resPrint; |
|
1679 | + elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint; |
|
1680 | 1680 | |
1681 | 1681 | // Print form confirm |
1682 | 1682 | print $formconfirm; |
@@ -1684,57 +1684,57 @@ discard block |
||
1684 | 1684 | |
1685 | 1685 | // Calculate totalWeight and totalVolume for all products |
1686 | 1686 | // by adding weight and volume of each product line. |
1687 | - $tmparray=$object->getTotalWeightVolume(); |
|
1688 | - $totalWeight=$tmparray['weight']; |
|
1689 | - $totalVolume=$tmparray['volume']; |
|
1687 | + $tmparray = $object->getTotalWeightVolume(); |
|
1688 | + $totalWeight = $tmparray['weight']; |
|
1689 | + $totalVolume = $tmparray['volume']; |
|
1690 | 1690 | |
1691 | 1691 | |
1692 | - if ($typeobject == 'commande' && $object->$typeobject->id && ! empty($conf->commande->enabled)) |
|
1692 | + if ($typeobject == 'commande' && $object->$typeobject->id && !empty($conf->commande->enabled)) |
|
1693 | 1693 | { |
1694 | - $objectsrc=new Commande($db); |
|
1694 | + $objectsrc = new Commande($db); |
|
1695 | 1695 | $objectsrc->fetch($object->$typeobject->id); |
1696 | 1696 | } |
1697 | - if ($typeobject == 'propal' && $object->$typeobject->id && ! empty($conf->propal->enabled)) |
|
1697 | + if ($typeobject == 'propal' && $object->$typeobject->id && !empty($conf->propal->enabled)) |
|
1698 | 1698 | { |
1699 | - $objectsrc=new Propal($db); |
|
1699 | + $objectsrc = new Propal($db); |
|
1700 | 1700 | $objectsrc->fetch($object->$typeobject->id); |
1701 | 1701 | } |
1702 | 1702 | |
1703 | 1703 | // Shipment card |
1704 | - $linkback = '<a href="'.DOL_URL_ROOT.'/expedition/list.php?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">'.$langs->trans("BackToList").'</a>'; |
|
1705 | - $morehtmlref='<div class="refidno">'; |
|
1704 | + $linkback = '<a href="'.DOL_URL_ROOT.'/expedition/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>'; |
|
1705 | + $morehtmlref = '<div class="refidno">'; |
|
1706 | 1706 | // Ref customer shipment |
1707 | - $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', 0, 1); |
|
1708 | - $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', null, null, '', 1); |
|
1707 | + $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', 0, 1); |
|
1708 | + $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', null, null, '', 1); |
|
1709 | 1709 | // Thirdparty |
1710 | - $morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); |
|
1710 | + $morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); |
|
1711 | 1711 | // Project |
1712 | - if (! empty($conf->projet->enabled)) { |
|
1712 | + if (!empty($conf->projet->enabled)) { |
|
1713 | 1713 | $langs->load("projects"); |
1714 | - $morehtmlref .= '<br>' . $langs->trans('Project') . ' '; |
|
1714 | + $morehtmlref .= '<br>'.$langs->trans('Project').' '; |
|
1715 | 1715 | if (0) { // Do not change on shipment |
1716 | 1716 | if ($action != 'classify') { |
1717 | - $morehtmlref .= '<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; |
|
1717 | + $morehtmlref .= '<a href="'.$_SERVER['PHP_SELF'].'?action=classify&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : '; |
|
1718 | 1718 | } |
1719 | 1719 | if ($action == 'classify') { |
1720 | 1720 | // $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); |
1721 | - $morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '">'; |
|
1721 | + $morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">'; |
|
1722 | 1722 | $morehtmlref .= '<input type="hidden" name="action" value="classin">'; |
1723 | - $morehtmlref .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
|
1723 | + $morehtmlref .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
1724 | 1724 | $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); |
1725 | - $morehtmlref .= '<input type="submit" class="button" value="' . $langs->trans("Modify") . '">'; |
|
1725 | + $morehtmlref .= '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'; |
|
1726 | 1726 | $morehtmlref .= '</form>'; |
1727 | 1727 | } else { |
1728 | - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); |
|
1728 | + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); |
|
1729 | 1729 | } |
1730 | 1730 | } else { |
1731 | 1731 | // We don't have project on shipment, so we will use the project or source object instead |
1732 | 1732 | // TODO Add project on shipment |
1733 | 1733 | $morehtmlref .= ' : '; |
1734 | - if (! empty($objectsrc->fk_project)) { |
|
1734 | + if (!empty($objectsrc->fk_project)) { |
|
1735 | 1735 | $proj = new Project($db); |
1736 | 1736 | $proj->fetch($objectsrc->fk_project); |
1737 | - $morehtmlref .= '<a href="' . DOL_URL_ROOT . '/projet/card.php?id=' . $objectsrc->fk_project . '" title="' . $langs->trans('ShowProject') . '">'; |
|
1737 | + $morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$objectsrc->fk_project.'" title="'.$langs->trans('ShowProject').'">'; |
|
1738 | 1738 | $morehtmlref .= $proj->ref; |
1739 | 1739 | $morehtmlref .= '</a>'; |
1740 | 1740 | } else { |
@@ -1742,7 +1742,7 @@ discard block |
||
1742 | 1742 | } |
1743 | 1743 | } |
1744 | 1744 | } |
1745 | - $morehtmlref.='</div>'; |
|
1745 | + $morehtmlref .= '</div>'; |
|
1746 | 1746 | |
1747 | 1747 | |
1748 | 1748 | dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); |
@@ -1755,28 +1755,28 @@ discard block |
||
1755 | 1755 | print '<table class="border" width="100%">'; |
1756 | 1756 | |
1757 | 1757 | // Linked documents |
1758 | - if ($typeobject == 'commande' && $object->$typeobject->id && ! empty($conf->commande->enabled)) |
|
1758 | + if ($typeobject == 'commande' && $object->$typeobject->id && !empty($conf->commande->enabled)) |
|
1759 | 1759 | { |
1760 | 1760 | print '<tr><td>'; |
1761 | 1761 | print $langs->trans("RefOrder").'</td>'; |
1762 | 1762 | print '<td colspan="3">'; |
1763 | - print $objectsrc->getNomUrl(1,'commande'); |
|
1763 | + print $objectsrc->getNomUrl(1, 'commande'); |
|
1764 | 1764 | print "</td>\n"; |
1765 | 1765 | print '</tr>'; |
1766 | 1766 | } |
1767 | - if ($typeobject == 'propal' && $object->$typeobject->id && ! empty($conf->propal->enabled)) |
|
1767 | + if ($typeobject == 'propal' && $object->$typeobject->id && !empty($conf->propal->enabled)) |
|
1768 | 1768 | { |
1769 | 1769 | print '<tr><td>'; |
1770 | 1770 | print $langs->trans("RefProposal").'</td>'; |
1771 | 1771 | print '<td colspan="3">'; |
1772 | - print $objectsrc->getNomUrl(1,'expedition'); |
|
1772 | + print $objectsrc->getNomUrl(1, 'expedition'); |
|
1773 | 1773 | print "</td>\n"; |
1774 | 1774 | print '</tr>'; |
1775 | 1775 | } |
1776 | 1776 | |
1777 | 1777 | // Date creation |
1778 | 1778 | print '<tr><td class="titlefield">'.$langs->trans("DateCreation").'</td>'; |
1779 | - print '<td colspan="3">'.dol_print_date($object->date_creation,"dayhour")."</td>\n"; |
|
1779 | + print '<td colspan="3">'.dol_print_date($object->date_creation, "dayhour")."</td>\n"; |
|
1780 | 1780 | print '</tr>'; |
1781 | 1781 | |
1782 | 1782 | // Delivery date planned |
@@ -1785,7 +1785,7 @@ discard block |
||
1785 | 1785 | print $langs->trans('DateDeliveryPlanned'); |
1786 | 1786 | print '</td>'; |
1787 | 1787 | |
1788 | - if ($action != 'editdate_livraison') print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdate_livraison&id='.$object->id.'">'.img_edit($langs->trans('SetDeliveryDate'),1).'</a></td>'; |
|
1788 | + if ($action != 'editdate_livraison') print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdate_livraison&id='.$object->id.'">'.img_edit($langs->trans('SetDeliveryDate'), 1).'</a></td>'; |
|
1789 | 1789 | print '</tr></table>'; |
1790 | 1790 | print '</td><td colspan="2">'; |
1791 | 1791 | if ($action == 'editdate_livraison') |
@@ -1793,30 +1793,30 @@ discard block |
||
1793 | 1793 | print '<form name="setdate_livraison" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">'; |
1794 | 1794 | print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
1795 | 1795 | print '<input type="hidden" name="action" value="setdate_livraison">'; |
1796 | - print $form->selectDate($object->date_delivery?$object->date_delivery:-1, 'liv_', 1, 1, '', "setdate_livraison", 1, 0); |
|
1796 | + print $form->selectDate($object->date_delivery ? $object->date_delivery : -1, 'liv_', 1, 1, '', "setdate_livraison", 1, 0); |
|
1797 | 1797 | print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">'; |
1798 | 1798 | print '</form>'; |
1799 | 1799 | } |
1800 | 1800 | else |
1801 | 1801 | { |
1802 | - print $object->date_delivery ? dol_print_date($object->date_delivery,'dayhour') : ' '; |
|
1802 | + print $object->date_delivery ? dol_print_date($object->date_delivery, 'dayhour') : ' '; |
|
1803 | 1803 | } |
1804 | 1804 | print '</td>'; |
1805 | 1805 | print '</tr>'; |
1806 | 1806 | |
1807 | 1807 | // Weight |
1808 | 1808 | print '<tr><td>'; |
1809 | - print $form->editfieldkey("Weight",'trueWeight',$object->trueWeight,$object,$user->rights->expedition->creer); |
|
1809 | + print $form->editfieldkey("Weight", 'trueWeight', $object->trueWeight, $object, $user->rights->expedition->creer); |
|
1810 | 1810 | print '</td><td colspan="3">'; |
1811 | 1811 | |
1812 | - if ($action=='edittrueWeight') |
|
1812 | + if ($action == 'edittrueWeight') |
|
1813 | 1813 | { |
1814 | 1814 | print '<form name="settrueweight" action="'.$_SERVER["PHP_SELF"].'" method="post">'; |
1815 | 1815 | print '<input name="action" value="settrueWeight" type="hidden">'; |
1816 | 1816 | print '<input name="id" value="'.$object->id.'" type="hidden">'; |
1817 | 1817 | print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
1818 | 1818 | print '<input id="trueWeight" name="trueWeight" value="'.$object->trueWeight.'" type="text">'; |
1819 | - print $formproduct->select_measuring_units("weight_units","weight",$object->weight_units); |
|
1819 | + print $formproduct->select_measuring_units("weight_units", "weight", $object->weight_units); |
|
1820 | 1820 | print ' <input class="button" name="modify" value="'.$langs->trans("Modify").'" type="submit">'; |
1821 | 1821 | print ' <input class="button" name="cancel" value="'.$langs->trans("Cancel").'" type="submit">'; |
1822 | 1822 | print '</form>'; |
@@ -1824,7 +1824,7 @@ discard block |
||
1824 | 1824 | else |
1825 | 1825 | { |
1826 | 1826 | print $object->trueWeight; |
1827 | - print ($object->trueWeight && $object->weight_units!='')?' '.measuring_units_string($object->weight_units,"weight"):''; |
|
1827 | + print ($object->trueWeight && $object->weight_units != '') ? ' '.measuring_units_string($object->weight_units, "weight") : ''; |
|
1828 | 1828 | } |
1829 | 1829 | |
1830 | 1830 | // Calculated |
@@ -1832,28 +1832,28 @@ discard block |
||
1832 | 1832 | { |
1833 | 1833 | if (!empty($object->trueWeight)) print ' ('.$langs->trans("SumOfProductWeights").': '; |
1834 | 1834 | //print $totalWeight.' '.measuring_units_string(0,"weight"); |
1835 | - print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND)?$conf->global->MAIN_WEIGHT_DEFAULT_ROUND:-1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?$conf->global->MAIN_WEIGHT_DEFAULT_UNIT:'no'); |
|
1835 | + print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND) ? $conf->global->MAIN_WEIGHT_DEFAULT_ROUND : -1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT) ? $conf->global->MAIN_WEIGHT_DEFAULT_UNIT : 'no'); |
|
1836 | 1836 | //if (empty($object->trueWeight)) print ' ('.$langs->trans("Calculated").')'; |
1837 | 1837 | if (!empty($object->trueWeight)) print ')'; |
1838 | 1838 | } |
1839 | 1839 | print '</td></tr>'; |
1840 | 1840 | |
1841 | 1841 | // Width |
1842 | - print '<tr><td>'.$form->editfieldkey("Width",'trueWidth',$object->trueWidth,$object,$user->rights->expedition->creer).'</td><td colspan="3">'; |
|
1843 | - print $form->editfieldval("Width",'trueWidth',$object->trueWidth,$object,$user->rights->expedition->creer); |
|
1844 | - print ($object->trueWidth && $object->width_units!='')?' '.measuring_units_string($object->width_units,"size"):''; |
|
1842 | + print '<tr><td>'.$form->editfieldkey("Width", 'trueWidth', $object->trueWidth, $object, $user->rights->expedition->creer).'</td><td colspan="3">'; |
|
1843 | + print $form->editfieldval("Width", 'trueWidth', $object->trueWidth, $object, $user->rights->expedition->creer); |
|
1844 | + print ($object->trueWidth && $object->width_units != '') ? ' '.measuring_units_string($object->width_units, "size") : ''; |
|
1845 | 1845 | print '</td></tr>'; |
1846 | 1846 | |
1847 | 1847 | // Height |
1848 | - print '<tr><td>'.$form->editfieldkey("Height",'trueHeight',$object->trueHeight,$object,$user->rights->expedition->creer).'</td><td colspan="3">'; |
|
1849 | - if($action=='edittrueHeight') |
|
1848 | + print '<tr><td>'.$form->editfieldkey("Height", 'trueHeight', $object->trueHeight, $object, $user->rights->expedition->creer).'</td><td colspan="3">'; |
|
1849 | + if ($action == 'edittrueHeight') |
|
1850 | 1850 | { |
1851 | 1851 | print '<form name="settrueHeight" action="'.$_SERVER["PHP_SELF"].'" method="post">'; |
1852 | 1852 | print '<input name="action" value="settrueHeight" type="hidden">'; |
1853 | 1853 | print '<input name="id" value="'.$object->id.'" type="hidden">'; |
1854 | 1854 | print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
1855 | 1855 | print '<input id="trueHeight" name="trueHeight" value="'.$object->trueHeight.'" type="text">'; |
1856 | - print $formproduct->select_measuring_units("size_units","size",$object->size_units); |
|
1856 | + print $formproduct->select_measuring_units("size_units", "size", $object->size_units); |
|
1857 | 1857 | print ' <input class="button" name="modify" value="'.$langs->trans("Modify").'" type="submit">'; |
1858 | 1858 | print ' <input class="button" name="cancel" value="'.$langs->trans("Cancel").'" type="submit">'; |
1859 | 1859 | print '</form>'; |
@@ -1861,15 +1861,15 @@ discard block |
||
1861 | 1861 | else |
1862 | 1862 | { |
1863 | 1863 | print $object->trueHeight; |
1864 | - print ($object->trueHeight && $object->height_units!='')?' '.measuring_units_string($object->height_units,"size"):''; |
|
1864 | + print ($object->trueHeight && $object->height_units != '') ? ' '.measuring_units_string($object->height_units, "size") : ''; |
|
1865 | 1865 | } |
1866 | 1866 | |
1867 | 1867 | print '</td></tr>'; |
1868 | 1868 | |
1869 | 1869 | // Depth |
1870 | - print '<tr><td>'.$form->editfieldkey("Depth",'trueDepth',$object->trueDepth,$object,$user->rights->expedition->creer).'</td><td colspan="3">'; |
|
1871 | - print $form->editfieldval("Depth",'trueDepth',$object->trueDepth,$object,$user->rights->expedition->creer); |
|
1872 | - print ($object->trueDepth && $object->depth_units!='')?' '.measuring_units_string($object->depth_units,"size"):''; |
|
1870 | + print '<tr><td>'.$form->editfieldkey("Depth", 'trueDepth', $object->trueDepth, $object, $user->rights->expedition->creer).'</td><td colspan="3">'; |
|
1871 | + print $form->editfieldval("Depth", 'trueDepth', $object->trueDepth, $object, $user->rights->expedition->creer); |
|
1872 | + print ($object->trueDepth && $object->depth_units != '') ? ' '.measuring_units_string($object->depth_units, "size") : ''; |
|
1873 | 1873 | print '</td></tr>'; |
1874 | 1874 | |
1875 | 1875 | // Volume |
@@ -1877,12 +1877,12 @@ discard block |
||
1877 | 1877 | print $langs->trans("Volume"); |
1878 | 1878 | print '</td>'; |
1879 | 1879 | print '<td colspan="3">'; |
1880 | - $calculatedVolume=0; |
|
1881 | - $volumeUnit=0; |
|
1880 | + $calculatedVolume = 0; |
|
1881 | + $volumeUnit = 0; |
|
1882 | 1882 | if ($object->trueWidth && $object->trueHeight && $object->trueDepth) |
1883 | 1883 | { |
1884 | - $calculatedVolume=($object->trueWidth * $object->trueHeight * $object->trueDepth); |
|
1885 | - $volumeUnit=$object->size_units * 3; |
|
1884 | + $calculatedVolume = ($object->trueWidth * $object->trueHeight * $object->trueDepth); |
|
1885 | + $volumeUnit = $object->size_units * 3; |
|
1886 | 1886 | } |
1887 | 1887 | // If sending volume not defined we use sum of products |
1888 | 1888 | if ($calculatedVolume > 0) |
@@ -1890,15 +1890,15 @@ discard block |
||
1890 | 1890 | if ($volumeUnit < 50) |
1891 | 1891 | { |
1892 | 1892 | //print $calculatedVolume.' '.measuring_units_string($volumeUnit,"volume"); |
1893 | - print showDimensionInBestUnit($calculatedVolume, $volumeUnit, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no'); |
|
1893 | + print showDimensionInBestUnit($calculatedVolume, $volumeUnit, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND) ? $conf->global->MAIN_VOLUME_DEFAULT_ROUND : -1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT) ? $conf->global->MAIN_VOLUME_DEFAULT_UNIT : 'no'); |
|
1894 | 1894 | } |
1895 | - else print $calculatedVolume.' '.measuring_units_string($volumeUnit,"volume"); |
|
1895 | + else print $calculatedVolume.' '.measuring_units_string($volumeUnit, "volume"); |
|
1896 | 1896 | } |
1897 | 1897 | if ($totalVolume > 0) |
1898 | 1898 | { |
1899 | 1899 | if ($calculatedVolume) print ' ('.$langs->trans("SumOfProductVolumes").': '; |
1900 | 1900 | //print $totalVolume.' '.measuring_units_string(0,"volume"); |
1901 | - print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no'); |
|
1901 | + print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND) ? $conf->global->MAIN_VOLUME_DEFAULT_ROUND : -1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT) ? $conf->global->MAIN_VOLUME_DEFAULT_UNIT : 'no'); |
|
1902 | 1902 | //if (empty($calculatedVolume)) print ' ('.$langs->trans("Calculated").')'; |
1903 | 1903 | if ($calculatedVolume) print ')'; |
1904 | 1904 | } |
@@ -1907,7 +1907,7 @@ discard block |
||
1907 | 1907 | |
1908 | 1908 | // Other attributes |
1909 | 1909 | $cols = 2; |
1910 | - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; |
|
1910 | + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; |
|
1911 | 1911 | |
1912 | 1912 | print '</table>'; |
1913 | 1913 | |
@@ -1924,7 +1924,7 @@ discard block |
||
1924 | 1924 | print $langs->trans('SendingMethod'); |
1925 | 1925 | print '</td>'; |
1926 | 1926 | |
1927 | - if ($action != 'editshipping_method_id') print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editshipping_method_id&id='.$object->id.'">'.img_edit($langs->trans('SetSendingMethod'),1).'</a></td>'; |
|
1927 | + if ($action != 'editshipping_method_id') print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editshipping_method_id&id='.$object->id.'">'.img_edit($langs->trans('SetSendingMethod'), 1).'</a></td>'; |
|
1928 | 1928 | print '</tr></table>'; |
1929 | 1929 | print '</td><td colspan="2">'; |
1930 | 1930 | if ($action == 'editshipping_method_id') |
@@ -1933,8 +1933,8 @@ discard block |
||
1933 | 1933 | print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
1934 | 1934 | print '<input type="hidden" name="action" value="setshipping_method_id">'; |
1935 | 1935 | $object->fetch_delivery_methods(); |
1936 | - print $form->selectarray("shipping_method_id",$object->meths,$object->shipping_method_id,1,0,0,"",1); |
|
1937 | - if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); |
|
1936 | + print $form->selectarray("shipping_method_id", $object->meths, $object->shipping_method_id, 1, 0, 0, "", 1); |
|
1937 | + if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
1938 | 1938 | print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">'; |
1939 | 1939 | print '</form>'; |
1940 | 1940 | } |
@@ -1943,7 +1943,7 @@ discard block |
||
1943 | 1943 | if ($object->shipping_method_id > 0) |
1944 | 1944 | { |
1945 | 1945 | // Get code using getLabelFromKey |
1946 | - $code=$langs->getLabelFromKey($db,$object->shipping_method_id,'c_shipment_mode','rowid','code'); |
|
1946 | + $code = $langs->getLabelFromKey($db, $object->shipping_method_id, 'c_shipment_mode', 'rowid', 'code'); |
|
1947 | 1947 | print $langs->trans("SendingMethod".strtoupper($code)); |
1948 | 1948 | } |
1949 | 1949 | } |
@@ -1951,8 +1951,8 @@ discard block |
||
1951 | 1951 | print '</tr>'; |
1952 | 1952 | |
1953 | 1953 | // Tracking Number |
1954 | - print '<tr><td class="titlefield">'.$form->editfieldkey("TrackingNumber",'tracking_number',$object->tracking_number,$object,$user->rights->expedition->creer).'</td><td colspan="3">'; |
|
1955 | - print $form->editfieldval("TrackingNumber",'tracking_number',$object->tracking_url,$object,$user->rights->expedition->creer,'string',$object->tracking_number); |
|
1954 | + print '<tr><td class="titlefield">'.$form->editfieldkey("TrackingNumber", 'tracking_number', $object->tracking_number, $object, $user->rights->expedition->creer).'</td><td colspan="3">'; |
|
1955 | + print $form->editfieldval("TrackingNumber", 'tracking_number', $object->tracking_url, $object, $user->rights->expedition->creer, 'string', $object->tracking_number); |
|
1956 | 1956 | print '</td></tr>'; |
1957 | 1957 | |
1958 | 1958 | // Incoterms |
@@ -1973,7 +1973,7 @@ discard block |
||
1973 | 1973 | } |
1974 | 1974 | else |
1975 | 1975 | { |
1976 | - print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:''), $_SERVER['PHP_SELF'].'?id='.$object->id); |
|
1976 | + print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''), $_SERVER['PHP_SELF'].'?id='.$object->id); |
|
1977 | 1977 | } |
1978 | 1978 | print '</td></tr>'; |
1979 | 1979 | } |
@@ -1991,11 +1991,11 @@ discard block |
||
1991 | 1991 | |
1992 | 1992 | if ($action == 'editline') |
1993 | 1993 | { |
1994 | - print ' <form name="updateline" id="updateline" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&lineid=' . $line_id . '" method="POST"> |
|
1995 | - <input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '"> |
|
1994 | + print ' <form name="updateline" id="updateline" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$line_id.'" method="POST"> |
|
1995 | + <input type="hidden" name="token" value="' . $_SESSION ['newtoken'].'"> |
|
1996 | 1996 | <input type="hidden" name="action" value="updateline"> |
1997 | 1997 | <input type="hidden" name="mode" value=""> |
1998 | - <input type="hidden" name="id" value="' . $object->id . '"> |
|
1998 | + <input type="hidden" name="id" value="' . $object->id.'"> |
|
1999 | 1999 | '; |
2000 | 2000 | } |
2001 | 2001 | print '<br>'; |
@@ -2004,7 +2004,7 @@ discard block |
||
2004 | 2004 | print '<table class="noborder" width="100%">'; |
2005 | 2005 | print '<tr class="liste_titre">'; |
2006 | 2006 | // Adds a line numbering column |
2007 | - if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) |
|
2007 | + if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) |
|
2008 | 2008 | { |
2009 | 2009 | print '<td width="5" align="center"> </td>'; |
2010 | 2010 | } |
@@ -2021,7 +2021,7 @@ discard block |
||
2021 | 2021 | $editColspan = 3; |
2022 | 2022 | if (empty($conf->stock->enabled)) $editColspan--; |
2023 | 2023 | if (empty($conf->productbatch->enabled)) $editColspan--; |
2024 | - print '<td align="center" colspan="'. $editColspan . '">'; |
|
2024 | + print '<td align="center" colspan="'.$editColspan.'">'; |
|
2025 | 2025 | if ($object->statut <= 1) |
2026 | 2026 | { |
2027 | 2027 | print $langs->trans("QtyToShip").' - '; |
@@ -2030,11 +2030,11 @@ discard block |
||
2030 | 2030 | { |
2031 | 2031 | print $langs->trans("QtyShipped").' - '; |
2032 | 2032 | } |
2033 | - if (! empty($conf->stock->enabled)) |
|
2033 | + if (!empty($conf->stock->enabled)) |
|
2034 | 2034 | { |
2035 | 2035 | print $langs->trans("WarehouseSource").' - '; |
2036 | 2036 | } |
2037 | - if (! empty($conf->productbatch->enabled)) |
|
2037 | + if (!empty($conf->productbatch->enabled)) |
|
2038 | 2038 | { |
2039 | 2039 | print $langs->trans("Batch"); |
2040 | 2040 | } |
@@ -2050,12 +2050,12 @@ discard block |
||
2050 | 2050 | { |
2051 | 2051 | print '<td align="center">'.$langs->trans("QtyShipped").'</td>'; |
2052 | 2052 | } |
2053 | - if (! empty($conf->stock->enabled)) |
|
2053 | + if (!empty($conf->stock->enabled)) |
|
2054 | 2054 | { |
2055 | 2055 | print '<td align="left">'.$langs->trans("WarehouseSource").'</td>'; |
2056 | 2056 | } |
2057 | 2057 | |
2058 | - if (! empty($conf->productbatch->enabled)) |
|
2058 | + if (!empty($conf->productbatch->enabled)) |
|
2059 | 2059 | { |
2060 | 2060 | print '<td align="left">'.$langs->trans("Batch").'</td>'; |
2061 | 2061 | } |
@@ -2070,18 +2070,18 @@ discard block |
||
2070 | 2070 | } |
2071 | 2071 | print "</tr>\n"; |
2072 | 2072 | |
2073 | - $var=false; |
|
2073 | + $var = false; |
|
2074 | 2074 | |
2075 | - if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) |
|
2075 | + if (!empty($conf->global->MAIN_MULTILANGS) && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) |
|
2076 | 2076 | { |
2077 | 2077 | $object->fetch_thirdparty(); |
2078 | 2078 | $outputlangs = $langs; |
2079 | - $newlang=''; |
|
2080 | - if (empty($newlang) && GETPOST('lang_id','aZ09')) $newlang=GETPOST('lang_id','aZ09'); |
|
2081 | - if (empty($newlang)) $newlang=$object->thirdparty->default_lang; |
|
2082 | - if (! empty($newlang)) |
|
2079 | + $newlang = ''; |
|
2080 | + if (empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); |
|
2081 | + if (empty($newlang)) $newlang = $object->thirdparty->default_lang; |
|
2082 | + if (!empty($newlang)) |
|
2083 | 2083 | { |
2084 | - $outputlangs = new Translate("",$conf); |
|
2084 | + $outputlangs = new Translate("", $conf); |
|
2085 | 2085 | $outputlangs->setDefaultLang($newlang); |
2086 | 2086 | } |
2087 | 2087 | } |
@@ -2091,22 +2091,22 @@ discard block |
||
2091 | 2091 | if ($origin && $origin_id > 0) |
2092 | 2092 | { |
2093 | 2093 | $sql = "SELECT obj.rowid, obj.fk_product, obj.label, obj.description, obj.product_type as fk_product_type, obj.qty as qty_asked, obj.date_start, obj.date_end"; |
2094 | - $sql.= ", ed.rowid as shipmentline_id, ed.qty as qty_shipped, ed.fk_expedition as expedition_id, ed.fk_origin_line, ed.fk_entrepot"; |
|
2095 | - $sql.= ", e.rowid as shipment_id, e.ref as shipment_ref, e.date_creation, e.date_valid, e.date_delivery, e.date_expedition"; |
|
2094 | + $sql .= ", ed.rowid as shipmentline_id, ed.qty as qty_shipped, ed.fk_expedition as expedition_id, ed.fk_origin_line, ed.fk_entrepot"; |
|
2095 | + $sql .= ", e.rowid as shipment_id, e.ref as shipment_ref, e.date_creation, e.date_valid, e.date_delivery, e.date_expedition"; |
|
2096 | 2096 | //if ($conf->livraison_bon->enabled) $sql .= ", l.rowid as livraison_id, l.ref as livraison_ref, l.date_delivery, ld.qty as qty_received"; |
2097 | - $sql.= ', p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.tobatch as product_tobatch'; |
|
2098 | - $sql.= ', p.description as product_desc'; |
|
2099 | - $sql.= " FROM ".MAIN_DB_PREFIX."expeditiondet as ed"; |
|
2100 | - $sql.= ", ".MAIN_DB_PREFIX."expedition as e"; |
|
2101 | - $sql.= ", ".MAIN_DB_PREFIX.$origin."det as obj"; |
|
2097 | + $sql .= ', p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.tobatch as product_tobatch'; |
|
2098 | + $sql .= ', p.description as product_desc'; |
|
2099 | + $sql .= " FROM ".MAIN_DB_PREFIX."expeditiondet as ed"; |
|
2100 | + $sql .= ", ".MAIN_DB_PREFIX."expedition as e"; |
|
2101 | + $sql .= ", ".MAIN_DB_PREFIX.$origin."det as obj"; |
|
2102 | 2102 | //if ($conf->livraison_bon->enabled) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."livraison as l ON l.fk_expedition = e.rowid LEFT JOIN ".MAIN_DB_PREFIX."livraisondet as ld ON ld.fk_livraison = l.rowid AND obj.rowid = ld.fk_origin_line"; |
2103 | - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON obj.fk_product = p.rowid"; |
|
2104 | - $sql.= " WHERE e.entity IN (".getEntity('expedition').")"; |
|
2105 | - $sql.= " AND obj.fk_".$origin." = ".$origin_id; |
|
2106 | - $sql.= " AND obj.rowid = ed.fk_origin_line"; |
|
2107 | - $sql.= " AND ed.fk_expedition = e.rowid"; |
|
2103 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON obj.fk_product = p.rowid"; |
|
2104 | + $sql .= " WHERE e.entity IN (".getEntity('expedition').")"; |
|
2105 | + $sql .= " AND obj.fk_".$origin." = ".$origin_id; |
|
2106 | + $sql .= " AND obj.rowid = ed.fk_origin_line"; |
|
2107 | + $sql .= " AND ed.fk_expedition = e.rowid"; |
|
2108 | 2108 | //if ($filter) $sql.= $filter; |
2109 | - $sql.= " ORDER BY obj.fk_product"; |
|
2109 | + $sql .= " ORDER BY obj.fk_product"; |
|
2110 | 2110 | |
2111 | 2111 | dol_syslog("get list of shipment lines", LOG_DEBUG); |
2112 | 2112 | $resql = $db->query($sql); |
@@ -2115,13 +2115,13 @@ discard block |
||
2115 | 2115 | $num = $db->num_rows($resql); |
2116 | 2116 | $i = 0; |
2117 | 2117 | |
2118 | - while($i < $num) |
|
2118 | + while ($i < $num) |
|
2119 | 2119 | { |
2120 | 2120 | $obj = $db->fetch_object($resql); |
2121 | 2121 | if ($obj) |
2122 | 2122 | { |
2123 | 2123 | // $obj->rowid is rowid in $origin."det" table |
2124 | - $alreadysent[$obj->rowid][$obj->shipmentline_id]=array('shipment_ref'=>$obj->shipment_ref, 'shipment_id'=>$obj->shipment_id, 'warehouse'=>$obj->fk_entrepot, 'qty_shipped'=>$obj->qty_shipped, 'date_valid'=>$obj->date_valid, 'date_delivery'=>$obj->date_delivery); |
|
2124 | + $alreadysent[$obj->rowid][$obj->shipmentline_id] = array('shipment_ref'=>$obj->shipment_ref, 'shipment_id'=>$obj->shipment_id, 'warehouse'=>$obj->fk_entrepot, 'qty_shipped'=>$obj->qty_shipped, 'date_valid'=>$obj->date_valid, 'date_delivery'=>$obj->date_delivery); |
|
2125 | 2125 | } |
2126 | 2126 | $i++; |
2127 | 2127 | } |
@@ -2130,62 +2130,62 @@ discard block |
||
2130 | 2130 | } |
2131 | 2131 | |
2132 | 2132 | // Loop on each product to send/sent |
2133 | - for ($i = 0 ; $i < $num_prod ; $i++) |
|
2133 | + for ($i = 0; $i < $num_prod; $i++) |
|
2134 | 2134 | { |
2135 | 2135 | print '<!-- origin line id = '.$lines[$i]->origin_line_id.' -->'; // id of order line |
2136 | 2136 | print '<tr class="oddeven">'; |
2137 | 2137 | |
2138 | 2138 | // Adds a line numbering column |
2139 | - if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) |
|
2139 | + if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) |
|
2140 | 2140 | { |
2141 | - print '<td align="center">'.($i+1).'</td>'; |
|
2141 | + print '<td align="center">'.($i + 1).'</td>'; |
|
2142 | 2142 | } |
2143 | 2143 | |
2144 | 2144 | // Predefined product or service |
2145 | 2145 | if ($lines[$i]->fk_product > 0) |
2146 | 2146 | { |
2147 | 2147 | // Define output language |
2148 | - if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) |
|
2148 | + if (!empty($conf->global->MAIN_MULTILANGS) && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) |
|
2149 | 2149 | { |
2150 | 2150 | $prod = new Product($db); |
2151 | 2151 | $prod->fetch($lines[$i]->fk_product); |
2152 | - $label = ( ! empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $lines[$i]->product_label; |
|
2152 | + $label = (!empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $lines[$i]->product_label; |
|
2153 | 2153 | } |
2154 | 2154 | else |
2155 | - $label = (! empty($lines[$i]->label)?$lines[$i]->label:$lines[$i]->product_label); |
|
2155 | + $label = (!empty($lines[$i]->label) ? $lines[$i]->label : $lines[$i]->product_label); |
|
2156 | 2156 | |
2157 | 2157 | print '<td>'; |
2158 | 2158 | |
2159 | 2159 | // Show product and description |
2160 | - $product_static->type=$lines[$i]->fk_product_type; |
|
2161 | - $product_static->id=$lines[$i]->fk_product; |
|
2162 | - $product_static->ref=$lines[$i]->ref; |
|
2163 | - $product_static->status_batch=$lines[$i]->product_tobatch; |
|
2164 | - $text=$product_static->getNomUrl(1); |
|
2165 | - $text.= ' - '.$label; |
|
2166 | - $description=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($lines[$i]->description)); |
|
2167 | - print $form->textwithtooltip($text,$description,3,'','',$i); |
|
2168 | - print_date_range($lines[$i]->date_start,$lines[$i]->date_end); |
|
2169 | - if (! empty($conf->global->PRODUIT_DESC_IN_FORM)) |
|
2160 | + $product_static->type = $lines[$i]->fk_product_type; |
|
2161 | + $product_static->id = $lines[$i]->fk_product; |
|
2162 | + $product_static->ref = $lines[$i]->ref; |
|
2163 | + $product_static->status_batch = $lines[$i]->product_tobatch; |
|
2164 | + $text = $product_static->getNomUrl(1); |
|
2165 | + $text .= ' - '.$label; |
|
2166 | + $description = (!empty($conf->global->PRODUIT_DESC_IN_FORM) ? '' : dol_htmlentitiesbr($lines[$i]->description)); |
|
2167 | + print $form->textwithtooltip($text, $description, 3, '', '', $i); |
|
2168 | + print_date_range($lines[$i]->date_start, $lines[$i]->date_end); |
|
2169 | + if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) |
|
2170 | 2170 | { |
2171 | - print (! empty($lines[$i]->description) && $lines[$i]->description!=$lines[$i]->product)?'<br>'.dol_htmlentitiesbr($lines[$i]->description):''; |
|
2171 | + print (!empty($lines[$i]->description) && $lines[$i]->description != $lines[$i]->product) ? '<br>'.dol_htmlentitiesbr($lines[$i]->description) : ''; |
|
2172 | 2172 | } |
2173 | 2173 | print "</td>\n"; |
2174 | 2174 | } |
2175 | 2175 | else |
2176 | 2176 | { |
2177 | 2177 | print "<td>"; |
2178 | - if ($lines[$i]->product_type == Product::TYPE_SERVICE) $text = img_object($langs->trans('Service'),'service'); |
|
2179 | - else $text = img_object($langs->trans('Product'),'product'); |
|
2178 | + if ($lines[$i]->product_type == Product::TYPE_SERVICE) $text = img_object($langs->trans('Service'), 'service'); |
|
2179 | + else $text = img_object($langs->trans('Product'), 'product'); |
|
2180 | 2180 | |
2181 | - if (! empty($lines[$i]->label)) { |
|
2182 | - $text.= ' <strong>'.$lines[$i]->label.'</strong>'; |
|
2183 | - print $form->textwithtooltip($text,$lines[$i]->description,3,'','',$i); |
|
2181 | + if (!empty($lines[$i]->label)) { |
|
2182 | + $text .= ' <strong>'.$lines[$i]->label.'</strong>'; |
|
2183 | + print $form->textwithtooltip($text, $lines[$i]->description, 3, '', '', $i); |
|
2184 | 2184 | } else { |
2185 | 2185 | print $text.' '.nl2br($lines[$i]->description); |
2186 | 2186 | } |
2187 | 2187 | |
2188 | - print_date_range($lines[$i]->date_start,$lines[$i]->date_end); |
|
2188 | + print_date_range($lines[$i]->date_start, $lines[$i]->date_end); |
|
2189 | 2189 | print "</td>\n"; |
2190 | 2190 | } |
2191 | 2191 | |
@@ -2201,7 +2201,7 @@ discard block |
||
2201 | 2201 | if ($lines[$i]->fk_origin_line == $key) |
2202 | 2202 | { |
2203 | 2203 | $j = 0; |
2204 | - foreach($val as $shipmentline_id=> $shipmentline_var) |
|
2204 | + foreach ($val as $shipmentline_id=> $shipmentline_var) |
|
2205 | 2205 | { |
2206 | 2206 | if ($shipmentline_var['shipment_id'] == $lines[$i]->fk_expedition) continue; // We want to show only "other shipments" |
2207 | 2207 | |
@@ -2210,8 +2210,8 @@ discard block |
||
2210 | 2210 | $shipment_static->fetch($shipmentline_var['shipment_id']); |
2211 | 2211 | print $shipment_static->getNomUrl(1); |
2212 | 2212 | print ' - '.$shipmentline_var['qty_shipped']; |
2213 | - $htmltext=$langs->trans("DateValidation").' : '.(empty($shipmentline_var['date_valid'])?$langs->trans("Draft"):dol_print_date($shipmentline_var['date_valid'], 'dayhour')); |
|
2214 | - if (! empty($conf->stock->enabled) && $shipmentline_var['warehouse'] > 0) |
|
2213 | + $htmltext = $langs->trans("DateValidation").' : '.(empty($shipmentline_var['date_valid']) ? $langs->trans("Draft") : dol_print_date($shipmentline_var['date_valid'], 'dayhour')); |
|
2214 | + if (!empty($conf->stock->enabled) && $shipmentline_var['warehouse'] > 0) |
|
2215 | 2215 | { |
2216 | 2216 | $warehousestatic->fetch($shipmentline_var['warehouse']); |
2217 | 2217 | $htmltext .= '<br>'.$langs->trans("From").' : '.$warehousestatic->getNomUrl(1); |
@@ -2235,25 +2235,25 @@ discard block |
||
2235 | 2235 | { |
2236 | 2236 | print '<tr>'; |
2237 | 2237 | // Qty to ship or shipped |
2238 | - print '<td>' . '<input name="qtyl'.$detail_batch->fk_expeditiondet.'_'.$detail_batch->id.'" id="qtyl'.$line_id.'_'.$detail_batch->id.'" type="text" size="4" value="'.$detail_batch->qty.'">' . '</td>'; |
|
2238 | + print '<td>'.'<input name="qtyl'.$detail_batch->fk_expeditiondet.'_'.$detail_batch->id.'" id="qtyl'.$line_id.'_'.$detail_batch->id.'" type="text" size="4" value="'.$detail_batch->qty.'">'.'</td>'; |
|
2239 | 2239 | // Batch number managment |
2240 | 2240 | if ($lines[$i]->entrepot_id == 0) |
2241 | 2241 | { |
2242 | 2242 | // only show lot numbers from src warehouse when shipping from multiple warehouses |
2243 | 2243 | $line->fetch($detail_batch->fk_expeditiondet); |
2244 | 2244 | } |
2245 | - print '<td>' . $formproduct->selectLotStock($detail_batch->fk_origin_stock, 'batchl'.$detail_batch->fk_expeditiondet.'_'.$detail_batch->fk_origin_stock, '', 1, 0, $lines[$i]->fk_product, $line->entrepot_id). '</td>'; |
|
2245 | + print '<td>'.$formproduct->selectLotStock($detail_batch->fk_origin_stock, 'batchl'.$detail_batch->fk_expeditiondet.'_'.$detail_batch->fk_origin_stock, '', 1, 0, $lines[$i]->fk_product, $line->entrepot_id).'</td>'; |
|
2246 | 2246 | print '</tr>'; |
2247 | 2247 | } |
2248 | 2248 | // add a 0 qty lot row to be able to add a lot |
2249 | 2249 | print '<tr>'; |
2250 | 2250 | // Qty to ship or shipped |
2251 | - print '<td>' . '<input name="qtyl'.$line_id.'_0" id="qtyl'.$line_id.'_0" type="text" size="4" value="0">' . '</td>'; |
|
2251 | + print '<td>'.'<input name="qtyl'.$line_id.'_0" id="qtyl'.$line_id.'_0" type="text" size="4" value="0">'.'</td>'; |
|
2252 | 2252 | // Batch number managment |
2253 | - print '<td>' . $formproduct->selectLotStock('', 'batchl'.$line_id.'_0', '', 1, 0, $lines[$i]->fk_product). '</td>'; |
|
2253 | + print '<td>'.$formproduct->selectLotStock('', 'batchl'.$line_id.'_0', '', 1, 0, $lines[$i]->fk_product).'</td>'; |
|
2254 | 2254 | print '</tr>'; |
2255 | 2255 | } |
2256 | - else if (! empty($conf->stock->enabled)) |
|
2256 | + else if (!empty($conf->stock->enabled)) |
|
2257 | 2257 | { |
2258 | 2258 | if ($lines[$i]->fk_product > 0) |
2259 | 2259 | { |
@@ -2262,11 +2262,11 @@ discard block |
||
2262 | 2262 | print '<!-- case edit 2 -->'; |
2263 | 2263 | print '<tr>'; |
2264 | 2264 | // Qty to ship or shipped |
2265 | - print '<td>' . '<input name="qtyl'.$line_id.'" id="qtyl'.$line_id.'" type="text" size="4" value="'.$lines[$i]->qty_shipped.'">' . '</td>'; |
|
2265 | + print '<td>'.'<input name="qtyl'.$line_id.'" id="qtyl'.$line_id.'" type="text" size="4" value="'.$lines[$i]->qty_shipped.'">'.'</td>'; |
|
2266 | 2266 | // Warehouse source |
2267 | - print '<td>' . $formproduct->selectWarehouses($lines[$i]->entrepot_id, 'entl'.$line_id, '', 1, 0, $lines[$i]->fk_product, '', 1). '</td>'; |
|
2267 | + print '<td>'.$formproduct->selectWarehouses($lines[$i]->entrepot_id, 'entl'.$line_id, '', 1, 0, $lines[$i]->fk_product, '', 1).'</td>'; |
|
2268 | 2268 | // Batch number managment |
2269 | - print '<td> - ' . $langs->trans("NA") . '</td>'; |
|
2269 | + print '<td> - '.$langs->trans("NA").'</td>'; |
|
2270 | 2270 | print '</tr>'; |
2271 | 2271 | } |
2272 | 2272 | else if (count($lines[$i]->details_entrepot) > 1) |
@@ -2276,11 +2276,11 @@ discard block |
||
2276 | 2276 | { |
2277 | 2277 | print '<tr>'; |
2278 | 2278 | // Qty to ship or shipped |
2279 | - print '<td>' . '<input name="qtyl'.$detail_entrepot->line_id.'" id="qtyl'.$detail_entrepot->line_id.'" type="text" size="4" value="'.$detail_entrepot->qty_shipped.'">' . '</td>'; |
|
2279 | + print '<td>'.'<input name="qtyl'.$detail_entrepot->line_id.'" id="qtyl'.$detail_entrepot->line_id.'" type="text" size="4" value="'.$detail_entrepot->qty_shipped.'">'.'</td>'; |
|
2280 | 2280 | // Warehouse source |
2281 | - print '<td>' . $formproduct->selectWarehouses($detail_entrepot->entrepot_id, 'entl'.$detail_entrepot->line_id, '', 1, 0, $lines[$i]->fk_product, '', 1) . '</td>'; |
|
2281 | + print '<td>'.$formproduct->selectWarehouses($detail_entrepot->entrepot_id, 'entl'.$detail_entrepot->line_id, '', 1, 0, $lines[$i]->fk_product, '', 1).'</td>'; |
|
2282 | 2282 | // Batch number managment |
2283 | - print '<td> - ' . $langs->trans("NA") . '</td>'; |
|
2283 | + print '<td> - '.$langs->trans("NA").'</td>'; |
|
2284 | 2284 | print '</tr>'; |
2285 | 2285 | } |
2286 | 2286 | } |
@@ -2295,11 +2295,11 @@ discard block |
||
2295 | 2295 | print '<!-- case edit 5 -->'; |
2296 | 2296 | print '<tr>'; |
2297 | 2297 | // Qty to ship or shipped |
2298 | - print '<td>' . '<input name="qtyl'.$line_id.'" id="qtyl'.$line_id.'" type="text" size="4" value="'.$lines[$i]->qty_shipped.'">' . '</td>'; |
|
2298 | + print '<td>'.'<input name="qtyl'.$line_id.'" id="qtyl'.$line_id.'" type="text" size="4" value="'.$lines[$i]->qty_shipped.'">'.'</td>'; |
|
2299 | 2299 | // Warehouse source |
2300 | - print '<td>' . '</td>'; |
|
2300 | + print '<td>'.'</td>'; |
|
2301 | 2301 | // Batch number managment |
2302 | - print '<td>' . '</td>'; |
|
2302 | + print '<td>'.'</td>'; |
|
2303 | 2303 | print '</tr>'; |
2304 | 2304 | } |
2305 | 2305 | } |
@@ -2311,7 +2311,7 @@ discard block |
||
2311 | 2311 | print '<td align="center">'.$lines[$i]->qty_shipped.'</td>'; |
2312 | 2312 | |
2313 | 2313 | // Warehouse source |
2314 | - if (! empty($conf->stock->enabled)) |
|
2314 | + if (!empty($conf->stock->enabled)) |
|
2315 | 2315 | { |
2316 | 2316 | print '<td align="left">'; |
2317 | 2317 | if ($lines[$i]->entrepot_id > 0) |
@@ -2329,16 +2329,16 @@ discard block |
||
2329 | 2329 | { |
2330 | 2330 | $entrepot = new Entrepot($db); |
2331 | 2331 | $entrepot->fetch($detail_entrepot->entrepot_id); |
2332 | - $detail.= $langs->trans("DetailWarehouseFormat",$entrepot->libelle,$detail_entrepot->qty_shipped).'<br/>'; |
|
2332 | + $detail .= $langs->trans("DetailWarehouseFormat", $entrepot->libelle, $detail_entrepot->qty_shipped).'<br/>'; |
|
2333 | 2333 | } |
2334 | 2334 | } |
2335 | - print $form->textwithtooltip(img_picto('', 'object_stock').' '.$langs->trans("DetailWarehouseNumber"),$detail); |
|
2335 | + print $form->textwithtooltip(img_picto('', 'object_stock').' '.$langs->trans("DetailWarehouseNumber"), $detail); |
|
2336 | 2336 | } |
2337 | 2337 | print '</td>'; |
2338 | 2338 | } |
2339 | 2339 | |
2340 | 2340 | // Batch number managment |
2341 | - if (! empty($conf->productbatch->enabled)) |
|
2341 | + if (!empty($conf->productbatch->enabled)) |
|
2342 | 2342 | { |
2343 | 2343 | if (isset($lines[$i]->detail_batch)) |
2344 | 2344 | { |
@@ -2349,13 +2349,13 @@ discard block |
||
2349 | 2349 | $detail = ''; |
2350 | 2350 | foreach ($lines[$i]->detail_batch as $dbatch) // $dbatch is instance of ExpeditionLineBatch |
2351 | 2351 | { |
2352 | - $detail.= $langs->trans("Batch").': '.$dbatch->batch; |
|
2353 | - $detail.= ' - '.$langs->trans("SellByDate").': '.dol_print_date($dbatch->sellby,"day"); |
|
2354 | - $detail.= ' - '.$langs->trans("EatByDate").': '.dol_print_date($dbatch->eatby,"day"); |
|
2355 | - $detail.= ' - '.$langs->trans("Qty").': '.$dbatch->qty; |
|
2356 | - $detail.= '<br>'; |
|
2352 | + $detail .= $langs->trans("Batch").': '.$dbatch->batch; |
|
2353 | + $detail .= ' - '.$langs->trans("SellByDate").': '.dol_print_date($dbatch->sellby, "day"); |
|
2354 | + $detail .= ' - '.$langs->trans("EatByDate").': '.dol_print_date($dbatch->eatby, "day"); |
|
2355 | + $detail .= ' - '.$langs->trans("Qty").': '.$dbatch->qty; |
|
2356 | + $detail .= '<br>'; |
|
2357 | 2357 | } |
2358 | - print $form->textwithtooltip(img_picto('', 'object_barcode').' '.$langs->trans("DetailBatchNumber"),$detail); |
|
2358 | + print $form->textwithtooltip(img_picto('', 'object_barcode').' '.$langs->trans("DetailBatchNumber"), $detail); |
|
2359 | 2359 | } |
2360 | 2360 | else |
2361 | 2361 | { |
@@ -2370,13 +2370,13 @@ discard block |
||
2370 | 2370 | |
2371 | 2371 | // Weight |
2372 | 2372 | print '<td align="center">'; |
2373 | - if ($lines[$i]->fk_product_type == Product::TYPE_PRODUCT) print $lines[$i]->weight*$lines[$i]->qty_shipped.' '.measuring_units_string($lines[$i]->weight_units,"weight"); |
|
2373 | + if ($lines[$i]->fk_product_type == Product::TYPE_PRODUCT) print $lines[$i]->weight * $lines[$i]->qty_shipped.' '.measuring_units_string($lines[$i]->weight_units, "weight"); |
|
2374 | 2374 | else print ' '; |
2375 | 2375 | print '</td>'; |
2376 | 2376 | |
2377 | 2377 | // Volume |
2378 | 2378 | print '<td align="center">'; |
2379 | - if ($lines[$i]->fk_product_type == Product::TYPE_PRODUCT) print $lines[$i]->volume*$lines[$i]->qty_shipped.' '.measuring_units_string($lines[$i]->volume_units,"volume"); |
|
2379 | + if ($lines[$i]->fk_product_type == Product::TYPE_PRODUCT) print $lines[$i]->volume * $lines[$i]->qty_shipped.' '.measuring_units_string($lines[$i]->volume_units, "volume"); |
|
2380 | 2380 | else print ' '; |
2381 | 2381 | print '</td>'; |
2382 | 2382 | |
@@ -2386,21 +2386,21 @@ discard block |
||
2386 | 2386 | if ($action == 'editline' && $lines[$i]->id == $line_id) |
2387 | 2387 | { |
2388 | 2388 | print '<td align="center" colspan="2" valign="middle">'; |
2389 | - print '<input type="submit" class="button" id="savelinebutton" name="save" value="' . $langs->trans("Save") . '"><br>'; |
|
2390 | - print '<input type="submit" class="button" id="cancellinebutton" name="cancel" value="' . $langs->trans("Cancel") . '"><br>'; |
|
2389 | + print '<input type="submit" class="button" id="savelinebutton" name="save" value="'.$langs->trans("Save").'"><br>'; |
|
2390 | + print '<input type="submit" class="button" id="cancellinebutton" name="cancel" value="'.$langs->trans("Cancel").'"><br>'; |
|
2391 | 2391 | } |
2392 | 2392 | else if ($object->statut == 0) |
2393 | 2393 | { |
2394 | 2394 | // edit-delete buttons |
2395 | 2395 | print '<td class="linecoledit" align="center">'; |
2396 | - print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=editline&lineid=' . $lines[$i]->id . '">' . img_edit() . '</a>'; |
|
2396 | + print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=editline&lineid='.$lines[$i]->id.'">'.img_edit().'</a>'; |
|
2397 | 2397 | print '</td>'; |
2398 | 2398 | print '<td class="linecoldelete" width="10">'; |
2399 | - print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=deleteline&lineid=' . $lines[$i]->id . '">' . img_delete() . '</a>'; |
|
2399 | + print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=deleteline&lineid='.$lines[$i]->id.'">'.img_delete().'</a>'; |
|
2400 | 2400 | print '</td>'; |
2401 | 2401 | |
2402 | 2402 | // Display lines extrafields |
2403 | - if (! empty($rowExtrafieldsStart)) |
|
2403 | + if (!empty($rowExtrafieldsStart)) |
|
2404 | 2404 | { |
2405 | 2405 | print $rowExtrafieldsStart; |
2406 | 2406 | print $rowExtrafieldsView; |
@@ -2410,18 +2410,18 @@ discard block |
||
2410 | 2410 | print "</tr>"; |
2411 | 2411 | |
2412 | 2412 | // Display lines extrafields |
2413 | - if (is_array($extralabelslines) && count($extralabelslines)>0) { |
|
2414 | - $colspan= empty($conf->productbatch->enabled) ? 5 : 6; |
|
2413 | + if (is_array($extralabelslines) && count($extralabelslines) > 0) { |
|
2414 | + $colspan = empty($conf->productbatch->enabled) ? 5 : 6; |
|
2415 | 2415 | $line = new ExpeditionLigne($db); |
2416 | 2416 | $line->fetch_optionals($lines[$i]->id); |
2417 | 2417 | print '<tr class="oddeven">'; |
2418 | 2418 | if ($action == 'editline' && $lines[$i]->id == $line_id) |
2419 | 2419 | { |
2420 | - print $line->showOptionals($extrafieldsline, 'edit', array('style'=>$bc[$var], 'colspan'=>$colspan),$indiceAsked); |
|
2420 | + print $line->showOptionals($extrafieldsline, 'edit', array('style'=>$bc[$var], 'colspan'=>$colspan), $indiceAsked); |
|
2421 | 2421 | } |
2422 | 2422 | else |
2423 | 2423 | { |
2424 | - print $line->showOptionals($extrafieldsline, 'view', array('style'=>$bc[$var], 'colspan'=>$colspan),$indiceAsked); |
|
2424 | + print $line->showOptionals($extrafieldsline, 'view', array('style'=>$bc[$var], 'colspan'=>$colspan), $indiceAsked); |
|
2425 | 2425 | } |
2426 | 2426 | print '</tr>'; |
2427 | 2427 | } |
@@ -2437,14 +2437,14 @@ discard block |
||
2437 | 2437 | dol_fiche_end(); |
2438 | 2438 | |
2439 | 2439 | |
2440 | - $object->fetchObjectLinked($object->id,$object->element); |
|
2440 | + $object->fetchObjectLinked($object->id, $object->element); |
|
2441 | 2441 | |
2442 | 2442 | |
2443 | 2443 | /* |
2444 | 2444 | * Boutons actions |
2445 | 2445 | */ |
2446 | 2446 | |
2447 | - if (($user->societe_id == 0) && ($action!='presend')) |
|
2447 | + if (($user->societe_id == 0) && ($action != 'presend')) |
|
2448 | 2448 | { |
2449 | 2449 | print '<div class="tabsAction">'; |
2450 | 2450 | |
@@ -2456,8 +2456,8 @@ discard block |
||
2456 | 2456 | |
2457 | 2457 | if ($object->statut == Expedition::STATUS_DRAFT && $num_prod > 0) |
2458 | 2458 | { |
2459 | - if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->expedition->creer)) |
|
2460 | - || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->expedition->shipping_advance->validate))) |
|
2459 | + if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->creer)) |
|
2460 | + || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->shipping_advance->validate))) |
|
2461 | 2461 | { |
2462 | 2462 | print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=valid">'.$langs->trans("Validate").'</a>'; |
2463 | 2463 | } |
@@ -2471,7 +2471,7 @@ discard block |
||
2471 | 2471 | // 0=draft, 1=validated, 2=billed, we miss a status "delivered" (only available on order) |
2472 | 2472 | if ($object->statut == Expedition::STATUS_CLOSED && $user->rights->expedition->creer) |
2473 | 2473 | { |
2474 | - if (! empty($conf->facture->enabled) && ! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) // Quand l'option est on, il faut avoir le bouton en plus et non en remplacement du Close ? |
|
2474 | + if (!empty($conf->facture->enabled) && !empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) // Quand l'option est on, il faut avoir le bouton en plus et non en remplacement du Close ? |
|
2475 | 2475 | { |
2476 | 2476 | print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen">'.$langs->trans("ClassifyUnbilled").'</a>'; |
2477 | 2477 | } |
@@ -2492,7 +2492,7 @@ discard block |
||
2492 | 2492 | } |
2493 | 2493 | |
2494 | 2494 | // Create bill |
2495 | - if (! empty($conf->facture->enabled) && ($object->statut == Expedition::STATUS_VALIDATED || $object->statut == Expedition::STATUS_CLOSED)) |
|
2495 | + if (!empty($conf->facture->enabled) && ($object->statut == Expedition::STATUS_VALIDATED || $object->statut == Expedition::STATUS_CLOSED)) |
|
2496 | 2496 | { |
2497 | 2497 | if ($user->rights->facture->creer) |
2498 | 2498 | { |
@@ -2511,14 +2511,14 @@ discard block |
||
2511 | 2511 | // Close |
2512 | 2512 | if ($object->statut == Expedition::STATUS_VALIDATED) |
2513 | 2513 | { |
2514 | - if ($user->rights->expedition->creer && $object->statut > 0 && ! $object->billed) |
|
2514 | + if ($user->rights->expedition->creer && $object->statut > 0 && !$object->billed) |
|
2515 | 2515 | { |
2516 | - $label="Close"; $paramaction='classifyclosed'; // = Transferred/Received |
|
2516 | + $label = "Close"; $paramaction = 'classifyclosed'; // = Transferred/Received |
|
2517 | 2517 | // Label here should be "Close" or "ClassifyBilled" if we decided to make bill on shipments instead of orders |
2518 | - if (! empty($conf->facture->enabled) && ! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) // Quand l'option est on, il faut avoir le bouton en plus et non en remplacement du Close ? |
|
2518 | + if (!empty($conf->facture->enabled) && !empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) // Quand l'option est on, il faut avoir le bouton en plus et non en remplacement du Close ? |
|
2519 | 2519 | { |
2520 | - $label="ClassifyBilled"; |
|
2521 | - $paramaction='classifybilled'; |
|
2520 | + $label = "ClassifyBilled"; |
|
2521 | + $paramaction = 'classifybilled'; |
|
2522 | 2522 | } |
2523 | 2523 | print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action='.$paramaction.'">'.$langs->trans($label).'</a>'; |
2524 | 2524 | } |
@@ -2543,14 +2543,14 @@ discard block |
||
2543 | 2543 | print '<div class="fichecenter"><div class="fichehalfleft">'; |
2544 | 2544 | |
2545 | 2545 | $objectref = dol_sanitizeFileName($object->ref); |
2546 | - $filedir = $conf->expedition->dir_output . "/sending/" .$objectref; |
|
2546 | + $filedir = $conf->expedition->dir_output."/sending/".$objectref; |
|
2547 | 2547 | |
2548 | 2548 | $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; |
2549 | 2549 | |
2550 | - $genallowed=$user->rights->expedition->lire; |
|
2551 | - $delallowed=$user->rights->expedition->creer; |
|
2550 | + $genallowed = $user->rights->expedition->lire; |
|
2551 | + $delallowed = $user->rights->expedition->creer; |
|
2552 | 2552 | |
2553 | - print $formfile->showdocuments('expedition',$objectref,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'','','',$soc->default_lang); |
|
2553 | + print $formfile->showdocuments('expedition', $objectref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang); |
|
2554 | 2554 | |
2555 | 2555 | |
2556 | 2556 | // Show links to link elements |
@@ -2562,8 +2562,8 @@ discard block |
||
2562 | 2562 | |
2563 | 2563 | // List of actions on element |
2564 | 2564 | include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; |
2565 | - $formactions=new FormActions($db); |
|
2566 | - $somethingshown = $formactions->showactions($object,'shipping',$socid,1); |
|
2565 | + $formactions = new FormActions($db); |
|
2566 | + $somethingshown = $formactions->showactions($object, 'shipping', $socid, 1); |
|
2567 | 2567 | |
2568 | 2568 | print '</div></div></div>'; |
2569 | 2569 | } |
@@ -2579,9 +2579,9 @@ discard block |
||
2579 | 2579 | } |
2580 | 2580 | |
2581 | 2581 | // Presend form |
2582 | - $modelmail='shipping_send'; |
|
2583 | - $defaulttopic='SendShippingRef'; |
|
2584 | - $diroutput = $conf->expedition->dir_output. '/sending'; |
|
2582 | + $modelmail = 'shipping_send'; |
|
2583 | + $defaulttopic = 'SendShippingRef'; |
|
2584 | + $diroutput = $conf->expedition->dir_output.'/sending'; |
|
2585 | 2585 | $trackid = 'shi'.$object->id; |
2586 | 2586 | |
2587 | 2587 | include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; |
@@ -33,25 +33,25 @@ discard block |
||
33 | 33 | require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php'; |
34 | 34 | require_once DOL_DOCUMENT_ROOT.'/core/lib/sendings.lib.php'; |
35 | 35 | require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; |
36 | -if (! empty($conf->projet->enabled)) { |
|
37 | - require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
|
38 | - require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; |
|
36 | +if (!empty($conf->projet->enabled)) { |
|
37 | + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
|
38 | + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; |
|
39 | 39 | } |
40 | -if (! empty($conf->stock->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; |
|
41 | -if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; |
|
42 | -if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
|
40 | +if (!empty($conf->stock->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; |
|
41 | +if (!empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; |
|
42 | +if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
|
43 | 43 | |
44 | 44 | // Load translation files required by the page |
45 | -$langs->loadLangs(array('orders',"companies","bills",'propal','deliveries','stocks',"productbatch",'incoterm')); |
|
45 | +$langs->loadLangs(array('orders', "companies", "bills", 'propal', 'deliveries', 'stocks', "productbatch", 'incoterm')); |
|
46 | 46 | |
47 | -$id=GETPOST('id','int'); // id of order |
|
48 | -$ref= GETPOST('ref','alpha'); |
|
49 | -$action=GETPOST('action','alpha'); |
|
47 | +$id = GETPOST('id', 'int'); // id of order |
|
48 | +$ref = GETPOST('ref', 'alpha'); |
|
49 | +$action = GETPOST('action', 'alpha'); |
|
50 | 50 | |
51 | 51 | // Security check |
52 | -$socid=0; |
|
53 | -if (! empty($user->societe_id)) $socid=$user->societe_id; |
|
54 | -$result=restrictedArea($user,'commande',$id); |
|
52 | +$socid = 0; |
|
53 | +if (!empty($user->societe_id)) $socid = $user->societe_id; |
|
54 | +$result = restrictedArea($user, 'commande', $id); |
|
55 | 55 | |
56 | 56 | $object = new Commande($db); |
57 | 57 | $extrafields = new ExtraFields($db); |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); |
61 | 61 | |
62 | 62 | // Load object |
63 | -include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once |
|
63 | +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once |
|
64 | 64 | |
65 | 65 | |
66 | 66 | |
@@ -80,10 +80,10 @@ discard block |
||
80 | 80 | { |
81 | 81 | $object = new Commande($db); |
82 | 82 | $object->fetch($id); |
83 | - $object->setProject(GETPOST('projectid','int')); |
|
83 | + $object->setProject(GETPOST('projectid', 'int')); |
|
84 | 84 | } |
85 | 85 | |
86 | - if ($action == 'confirm_cloture' && GETPOST('confirm','alpha') == 'yes') |
|
86 | + if ($action == 'confirm_cloture' && GETPOST('confirm', 'alpha') == 'yes') |
|
87 | 87 | { |
88 | 88 | $object = new Commande($db); |
89 | 89 | $object->fetch($id); |
@@ -102,11 +102,11 @@ discard block |
||
102 | 102 | if ($action == 'setdatedelivery' && $user->rights->commande->creer) |
103 | 103 | { |
104 | 104 | //print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year']; |
105 | - $datelivraison=dol_mktime(0, 0, 0, GETPOST('liv_month','int'), GETPOST('liv_day','int'),GETPOST('liv_year','int')); |
|
105 | + $datelivraison = dol_mktime(0, 0, 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int')); |
|
106 | 106 | |
107 | 107 | $object = new Commande($db); |
108 | 108 | $object->fetch($id); |
109 | - $result=$object->set_date_livraison($user,$datelivraison); |
|
109 | + $result = $object->set_date_livraison($user, $datelivraison); |
|
110 | 110 | if ($result < 0) |
111 | 111 | setEventMessages($object->error, $object->errors, 'errors'); |
112 | 112 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | { |
125 | 125 | $object = new Commande($db); |
126 | 126 | $object->fetch($id); |
127 | - $result = $object->setPaymentMethods(GETPOST('mode_reglement_id','int')); |
|
127 | + $result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int')); |
|
128 | 128 | if ($result < 0) |
129 | 129 | setEventMessages($object->error, $object->errors, 'errors'); |
130 | 130 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | if ($action == 'setavailability' && $user->rights->commande->creer) { |
133 | 133 | $object = new Commande($db); |
134 | 134 | $object->fetch($id); |
135 | - $result=$object->availability(GETPOST('availability_id')); |
|
135 | + $result = $object->availability(GETPOST('availability_id')); |
|
136 | 136 | if ($result < 0) |
137 | 137 | setEventMessages($object->error, $object->errors, 'errors'); |
138 | 138 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | if ($action == 'setdemandreason' && $user->rights->commande->creer) { |
141 | 141 | $object = new Commande($db); |
142 | 142 | $object->fetch($id); |
143 | - $result=$object->demand_reason(GETPOST('demand_reason_id')); |
|
143 | + $result = $object->demand_reason(GETPOST('demand_reason_id')); |
|
144 | 144 | if ($result < 0) |
145 | 145 | setEventMessages($object->error, $object->errors, 'errors'); |
146 | 146 | } |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | { |
150 | 150 | $object = new Commande($db); |
151 | 151 | $object->fetch($id); |
152 | - $result=$object->setPaymentTerms(GETPOST('cond_reglement_id','int')); |
|
152 | + $result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int')); |
|
153 | 153 | if ($result < 0) |
154 | 154 | setEventMessages($object->error, $object->errors, 'errors'); |
155 | 155 | } |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | if ($action == 'setshippingmethod' && $user->rights->commande->creer) { |
168 | 168 | $object = new Commande($db); |
169 | 169 | $object->fetch($id); |
170 | - $result=$object->setShippingMethod(GETPOST('shipping_method_id', 'int')); |
|
170 | + $result = $object->setShippingMethod(GETPOST('shipping_method_id', 'int')); |
|
171 | 171 | if ($result < 0) |
172 | 172 | setEventMessages($object->error, $object->errors, 'errors'); |
173 | 173 | } |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute', 'none')); |
191 | 191 | if ($ret < 0) $error++; |
192 | 192 | |
193 | - if (! $error) |
|
193 | + if (!$error) |
|
194 | 194 | { |
195 | 195 | // Actions on extra fields |
196 | 196 | $result = $object->insertExtraFields('SHIPMENT_MODIFY'); |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | $object->fetch($id); |
211 | 211 | $object->setValueFrom('fk_soc', $socid, '', '', 'date', '', $user, 'ORDER_MODIFY'); |
212 | 212 | |
213 | - header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id); |
|
213 | + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); |
|
214 | 214 | exit(); |
215 | 215 | } |
216 | 216 | |
@@ -224,19 +224,19 @@ discard block |
||
224 | 224 | $form = new Form($db); |
225 | 225 | $formfile = new FormFile($db); |
226 | 226 | $formproduct = new FormProduct($db); |
227 | -if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } |
|
227 | +if (!empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } |
|
228 | 228 | |
229 | -llxHeader('',$langs->trans('OrderCard'),''); |
|
229 | +llxHeader('', $langs->trans('OrderCard'), ''); |
|
230 | 230 | |
231 | 231 | |
232 | -if ($id > 0 || ! empty($ref)) |
|
232 | +if ($id > 0 || !empty($ref)) |
|
233 | 233 | { |
234 | 234 | $object = new Commande($db); |
235 | - if ( $object->fetch($id,$ref) > 0) |
|
235 | + if ($object->fetch($id, $ref) > 0) |
|
236 | 236 | { |
237 | 237 | $object->loadExpeditions(1); |
238 | 238 | |
239 | - $product_static=new Product($db); |
|
239 | + $product_static = new Product($db); |
|
240 | 240 | |
241 | 241 | $soc = new Societe($db); |
242 | 242 | $soc->fetch($object->socid); |
@@ -255,14 +255,14 @@ discard block |
||
255 | 255 | // Confirm validation |
256 | 256 | if ($action == 'cloture') |
257 | 257 | { |
258 | - $formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=".$id,$langs->trans("CloseShipment"),$langs->trans("ConfirmCloseShipment"),"confirm_cloture"); |
|
258 | + $formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=".$id, $langs->trans("CloseShipment"), $langs->trans("ConfirmCloseShipment"), "confirm_cloture"); |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | // Call Hook formConfirm |
262 | 262 | $parameters = array(); |
263 | 263 | $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
264 | - if (empty($reshook)) $formconfirm.=$hookmanager->resPrint; |
|
265 | - elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint; |
|
264 | + if (empty($reshook)) $formconfirm .= $hookmanager->resPrint; |
|
265 | + elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint; |
|
266 | 266 | |
267 | 267 | // Print form confirm |
268 | 268 | print $formconfirm; |
@@ -270,48 +270,48 @@ discard block |
||
270 | 270 | |
271 | 271 | // Order card |
272 | 272 | |
273 | - $linkback = '<a href="' . DOL_URL_ROOT . '/commande/list.php?restore_lastsearch_values=1' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>'; |
|
273 | + $linkback = '<a href="'.DOL_URL_ROOT.'/commande/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '?socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>'; |
|
274 | 274 | |
275 | 275 | |
276 | - $morehtmlref='<div class="refidno">'; |
|
276 | + $morehtmlref = '<div class="refidno">'; |
|
277 | 277 | // Ref customer |
278 | - $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', 0, 1); |
|
279 | - $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', null, null, '', 1); |
|
278 | + $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', 0, 1); |
|
279 | + $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', null, null, '', 1); |
|
280 | 280 | // Thirdparty |
281 | - $morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1); |
|
281 | + $morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$soc->getNomUrl(1); |
|
282 | 282 | // Project |
283 | - if (! empty($conf->projet->enabled)) |
|
283 | + if (!empty($conf->projet->enabled)) |
|
284 | 284 | { |
285 | 285 | $langs->load("projects"); |
286 | - $morehtmlref.='<br>'.$langs->trans('Project') . ' '; |
|
286 | + $morehtmlref .= '<br>'.$langs->trans('Project').' '; |
|
287 | 287 | if ($user->rights->commande->creer) |
288 | 288 | { |
289 | 289 | if ($action != 'classify') |
290 | - $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; |
|
290 | + $morehtmlref .= '<a href="'.$_SERVER['PHP_SELF'].'?action=classify&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : '; |
|
291 | 291 | if ($action == 'classify') { |
292 | 292 | //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); |
293 | - $morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">'; |
|
294 | - $morehtmlref.='<input type="hidden" name="action" value="classin">'; |
|
295 | - $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
296 | - $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); |
|
297 | - $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; |
|
298 | - $morehtmlref.='</form>'; |
|
293 | + $morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">'; |
|
294 | + $morehtmlref .= '<input type="hidden" name="action" value="classin">'; |
|
295 | + $morehtmlref .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
296 | + $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); |
|
297 | + $morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; |
|
298 | + $morehtmlref .= '</form>'; |
|
299 | 299 | } else { |
300 | - $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); |
|
300 | + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); |
|
301 | 301 | } |
302 | 302 | } else { |
303 | - if (! empty($object->fk_project)) { |
|
303 | + if (!empty($object->fk_project)) { |
|
304 | 304 | $proj = new Project($db); |
305 | 305 | $proj->fetch($object->fk_project); |
306 | - $morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">'; |
|
307 | - $morehtmlref.=$proj->ref; |
|
308 | - $morehtmlref.='</a>'; |
|
306 | + $morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">'; |
|
307 | + $morehtmlref .= $proj->ref; |
|
308 | + $morehtmlref .= '</a>'; |
|
309 | 309 | } else { |
310 | - $morehtmlref.=''; |
|
310 | + $morehtmlref .= ''; |
|
311 | 311 | } |
312 | 312 | } |
313 | 313 | } |
314 | - $morehtmlref.='</div>'; |
|
314 | + $morehtmlref .= '</div>'; |
|
315 | 315 | |
316 | 316 | |
317 | 317 | dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | print '<table class="border" width="100%">'; |
325 | 325 | |
326 | 326 | // Discounts for third party |
327 | - if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { |
|
327 | + if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { |
|
328 | 328 | $filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice |
329 | 329 | $filtercreditnote = "fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice |
330 | 330 | } else { |
@@ -334,14 +334,14 @@ discard block |
||
334 | 334 | |
335 | 335 | print '<tr><td class="titlefield">'.$langs->trans('Discounts').'</td><td colspan="3">'; |
336 | 336 | |
337 | - $absolute_discount=$soc->getAvailableDiscounts('',$filterabsolutediscount); |
|
338 | - $absolute_creditnote=$soc->getAvailableDiscounts('',$filtercreditnote); |
|
339 | - $absolute_discount=price2num($absolute_discount,'MT'); |
|
340 | - $absolute_creditnote=price2num($absolute_creditnote,'MT'); |
|
337 | + $absolute_discount = $soc->getAvailableDiscounts('', $filterabsolutediscount); |
|
338 | + $absolute_creditnote = $soc->getAvailableDiscounts('', $filtercreditnote); |
|
339 | + $absolute_discount = price2num($absolute_discount, 'MT'); |
|
340 | + $absolute_creditnote = price2num($absolute_creditnote, 'MT'); |
|
341 | 341 | |
342 | 342 | $thirdparty = $soc; |
343 | 343 | $discount_type = 0; |
344 | - $backtopage = urlencode($_SERVER["PHP_SELF"] . '?id=' . $object->id); |
|
344 | + $backtopage = urlencode($_SERVER["PHP_SELF"].'?id='.$object->id); |
|
345 | 345 | $cannotApplyDiscount = 1; |
346 | 346 | include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php'; |
347 | 347 | print '</td></tr>'; |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | // Date |
350 | 350 | print '<tr><td>'.$langs->trans('Date').'</td>'; |
351 | 351 | print '<td colspan="2">'; |
352 | - print dol_print_date($object->date,'daytext'); |
|
352 | + print dol_print_date($object->date, 'daytext'); |
|
353 | 353 | if ($object->hasDelay() && empty($object->date_livraison)) { |
354 | 354 | print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); |
355 | 355 | } |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | print $langs->trans('DateDeliveryPlanned'); |
363 | 363 | print '</td>'; |
364 | 364 | |
365 | - if ($action != 'editdate_livraison') print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdate_livraison&id='.$object->id.'">'.img_edit($langs->trans('SetDeliveryDate'),1).'</a></td>'; |
|
365 | + if ($action != 'editdate_livraison') print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdate_livraison&id='.$object->id.'">'.img_edit($langs->trans('SetDeliveryDate'), 1).'</a></td>'; |
|
366 | 366 | print '</tr></table>'; |
367 | 367 | print '</td><td colspan="2">'; |
368 | 368 | if ($action == 'editdate_livraison') |
@@ -370,14 +370,14 @@ discard block |
||
370 | 370 | print '<form name="setdate_livraison" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">'; |
371 | 371 | print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
372 | 372 | print '<input type="hidden" name="action" value="setdatedelivery">'; |
373 | - print $form->selectDate($object->date_livraison>0?$object->date_livraison:-1, 'liv_', '', '', '', "setdatedelivery"); |
|
373 | + print $form->selectDate($object->date_livraison > 0 ? $object->date_livraison : -1, 'liv_', '', '', '', "setdatedelivery"); |
|
374 | 374 | print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">'; |
375 | 375 | print '</form>'; |
376 | 376 | } |
377 | 377 | else |
378 | 378 | { |
379 | - print dol_print_date($object->date_livraison,'daytext'); |
|
380 | - if ($object->hasDelay() && ! empty($object->date_livraison)) { |
|
379 | + print dol_print_date($object->date_livraison, 'daytext'); |
|
380 | + if ($object->hasDelay() && !empty($object->date_livraison)) { |
|
381 | 381 | print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); |
382 | 382 | } |
383 | 383 | } |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | print $langs->trans('SendingMethod'); |
395 | 395 | print '</td>'; |
396 | 396 | if ($action != 'editshippingmethod' && $user->rights->expedition->creer) |
397 | - print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editshippingmethod&id='.$object->id.'">'.img_edit($langs->trans('SetShippingMode'),1).'</a></td>'; |
|
397 | + print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editshippingmethod&id='.$object->id.'">'.img_edit($langs->trans('SetShippingMode'), 1).'</a></td>'; |
|
398 | 398 | print '</tr></table>'; |
399 | 399 | print '</td><td colspan="2">'; |
400 | 400 | if ($action == 'editshippingmethod') { |
@@ -406,15 +406,15 @@ discard block |
||
406 | 406 | print '</tr>'; |
407 | 407 | |
408 | 408 | // Warehouse |
409 | - if (! empty($conf->stock->enabled) && ! empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { |
|
409 | + if (!empty($conf->stock->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { |
|
410 | 410 | require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; |
411 | - $formproduct=new FormProduct($db); |
|
411 | + $formproduct = new FormProduct($db); |
|
412 | 412 | print '<tr><td>'; |
413 | 413 | print '<table width="100%" class="nobordernopadding"><tr><td>'; |
414 | 414 | print $langs->trans('Warehouse'); |
415 | 415 | print '</td>'; |
416 | 416 | if ($action != 'editwarehouse' && $user->rights->commande->creer) |
417 | - print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editwarehouse&id='.$object->id.'">'.img_edit($langs->trans('SetWarehouse'),1).'</a></td>'; |
|
417 | + print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editwarehouse&id='.$object->id.'">'.img_edit($langs->trans('SetWarehouse'), 1).'</a></td>'; |
|
418 | 418 | print '</tr></table>'; |
419 | 419 | print '</td><td colspan="2">'; |
420 | 420 | if ($action == 'editwarehouse') { |
@@ -470,13 +470,13 @@ discard block |
||
470 | 470 | print $langs->trans('AvailabilityPeriod'); |
471 | 471 | print '</td>'; |
472 | 472 | if ($action != 'editavailability') |
473 | - print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editavailability&id=' . $object->id . '">' . img_edit($langs->trans('SetAvailability'), 1) . '</a></td>'; |
|
473 | + print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editavailability&id='.$object->id.'">'.img_edit($langs->trans('SetAvailability'), 1).'</a></td>'; |
|
474 | 474 | print '</tr></table>'; |
475 | 475 | print '</td><td colspan="3">'; |
476 | 476 | if ($action == 'editavailability') { |
477 | - $form->form_availability($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->availability_id, 'availability_id', 1); |
|
477 | + $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, $object->availability_id, 'availability_id', 1); |
|
478 | 478 | } else { |
479 | - $form->form_availability($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->availability_id, 'none', 1); |
|
479 | + $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, $object->availability_id, 'none', 1); |
|
480 | 480 | } |
481 | 481 | print '</td></tr>'; |
482 | 482 | |
@@ -486,27 +486,27 @@ discard block |
||
486 | 486 | print $langs->trans('Source'); |
487 | 487 | print '</td>'; |
488 | 488 | if ($action != 'editdemandreason') |
489 | - print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editdemandreason&id=' . $object->id . '">' . img_edit($langs->trans('SetDemandReason'), 1) . '</a></td>'; |
|
489 | + print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdemandreason&id='.$object->id.'">'.img_edit($langs->trans('SetDemandReason'), 1).'</a></td>'; |
|
490 | 490 | print '</tr></table>'; |
491 | 491 | print '</td><td colspan="3">'; |
492 | 492 | if ($action == 'editdemandreason') { |
493 | - $form->formInputReason($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->demand_reason_id, 'demand_reason_id', 1); |
|
493 | + $form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, $object->demand_reason_id, 'demand_reason_id', 1); |
|
494 | 494 | } else { |
495 | - $form->formInputReason($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->demand_reason_id, 'none'); |
|
495 | + $form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, $object->demand_reason_id, 'none'); |
|
496 | 496 | } |
497 | 497 | |
498 | - $tmparray=$object->getTotalWeightVolume(); |
|
499 | - $totalWeight=$tmparray['weight']; |
|
500 | - $totalVolume=$tmparray['volume']; |
|
498 | + $tmparray = $object->getTotalWeightVolume(); |
|
499 | + $totalWeight = $tmparray['weight']; |
|
500 | + $totalVolume = $tmparray['volume']; |
|
501 | 501 | if ($totalWeight || $totalVolume) |
502 | 502 | { |
503 | 503 | print '<tr><td>'.$langs->trans("CalculatedWeight").'</td>'; |
504 | 504 | print '<td>'; |
505 | - print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND)?$conf->global->MAIN_WEIGHT_DEFAULT_ROUND:-1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?$conf->global->MAIN_WEIGHT_DEFAULT_UNIT:'no'); |
|
505 | + print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND) ? $conf->global->MAIN_WEIGHT_DEFAULT_ROUND : -1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT) ? $conf->global->MAIN_WEIGHT_DEFAULT_UNIT : 'no'); |
|
506 | 506 | print '</td></tr>'; |
507 | 507 | print '<tr><td>'.$langs->trans("CalculatedVolume").'</td>'; |
508 | 508 | print '<td>'; |
509 | - print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no'); |
|
509 | + print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND) ? $conf->global->MAIN_VOLUME_DEFAULT_ROUND : -1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT) ? $conf->global->MAIN_VOLUME_DEFAULT_UNIT : 'no'); |
|
510 | 510 | print '</td></tr>'; |
511 | 511 | } |
512 | 512 | |
@@ -530,14 +530,14 @@ discard block |
||
530 | 530 | } |
531 | 531 | else |
532 | 532 | { |
533 | - print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:''), $_SERVER['PHP_SELF'].'?id='.$object->id); |
|
533 | + print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''), $_SERVER['PHP_SELF'].'?id='.$object->id); |
|
534 | 534 | } |
535 | 535 | print '</td></tr>'; |
536 | 536 | } |
537 | 537 | |
538 | 538 | // Other attributes |
539 | 539 | $cols = 2; |
540 | - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; |
|
540 | + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; |
|
541 | 541 | |
542 | 542 | print '</table>'; |
543 | 543 | |
@@ -551,18 +551,18 @@ discard block |
||
551 | 551 | if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) |
552 | 552 | { |
553 | 553 | // Multicurrency Amount HT |
554 | - print '<tr><td class="titlefieldmiddle">' . $form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0) . '</td>'; |
|
555 | - print '<td class="nowrap">' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>'; |
|
554 | + print '<tr><td class="titlefieldmiddle">'.$form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0).'</td>'; |
|
555 | + print '<td class="nowrap">'.price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>'; |
|
556 | 556 | print '</tr>'; |
557 | 557 | |
558 | 558 | // Multicurrency Amount VAT |
559 | - print '<tr><td>' . $form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0) . '</td>'; |
|
560 | - print '<td class="nowrap">' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>'; |
|
559 | + print '<tr><td>'.$form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0).'</td>'; |
|
560 | + print '<td class="nowrap">'.price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>'; |
|
561 | 561 | print '</tr>'; |
562 | 562 | |
563 | 563 | // Multicurrency Amount TTC |
564 | - print '<tr><td>' . $form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0) . '</td>'; |
|
565 | - print '<td class="nowrap">' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>'; |
|
564 | + print '<tr><td>'.$form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0).'</td>'; |
|
565 | + print '<td class="nowrap">'.price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>'; |
|
566 | 566 | print '</tr>'; |
567 | 567 | } |
568 | 568 | |
@@ -578,13 +578,13 @@ discard block |
||
578 | 578 | // Amount Local Taxes |
579 | 579 | if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) // Localtax1 |
580 | 580 | { |
581 | - print '<tr><td>' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td>'; |
|
582 | - print '<td>' . price($object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>'; |
|
581 | + print '<tr><td>'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td>'; |
|
582 | + print '<td>'.price($object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>'; |
|
583 | 583 | } |
584 | 584 | if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) // Localtax2 IRPF |
585 | 585 | { |
586 | - print '<tr><td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>'; |
|
587 | - print '<td>' . price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>'; |
|
586 | + print '<tr><td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td>'; |
|
587 | + print '<td>'.price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>'; |
|
588 | 588 | } |
589 | 589 | |
590 | 590 | // Total TTC |
@@ -608,15 +608,15 @@ discard block |
||
608 | 608 | print '<table class="noborder noshadow" width="100%">'; |
609 | 609 | |
610 | 610 | $sql = "SELECT cd.rowid, cd.fk_product, cd.product_type as type, cd.label, cd.description,"; |
611 | - $sql.= " cd.price, cd.tva_tx, cd.subprice,"; |
|
612 | - $sql.= " cd.qty,"; |
|
613 | - $sql.= ' cd.date_start,'; |
|
614 | - $sql.= ' cd.date_end,'; |
|
615 | - $sql.= ' p.rowid as prodid, p.label as product_label, p.entity, p.ref, p.fk_product_type as product_type, p.description as product_desc'; |
|
616 | - $sql.= " FROM ".MAIN_DB_PREFIX."commandedet as cd"; |
|
617 | - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid"; |
|
618 | - $sql.= " WHERE cd.fk_commande = ".$object->id; |
|
619 | - $sql.= " ORDER BY cd.rang, cd.rowid"; |
|
611 | + $sql .= " cd.price, cd.tva_tx, cd.subprice,"; |
|
612 | + $sql .= " cd.qty,"; |
|
613 | + $sql .= ' cd.date_start,'; |
|
614 | + $sql .= ' cd.date_end,'; |
|
615 | + $sql .= ' p.rowid as prodid, p.label as product_label, p.entity, p.ref, p.fk_product_type as product_type, p.description as product_desc'; |
|
616 | + $sql .= " FROM ".MAIN_DB_PREFIX."commandedet as cd"; |
|
617 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid"; |
|
618 | + $sql .= " WHERE cd.fk_commande = ".$object->id; |
|
619 | + $sql .= " ORDER BY cd.rang, cd.rowid"; |
|
620 | 620 | |
621 | 621 | //print $sql; |
622 | 622 | dol_syslog("shipment.php", LOG_DEBUG); |
@@ -631,7 +631,7 @@ discard block |
||
631 | 631 | print '<td align="center">'.$langs->trans("QtyOrdered").'</td>'; |
632 | 632 | print '<td align="center">'.$langs->trans("QtyShipped").'</td>'; |
633 | 633 | print '<td align="center">'.$langs->trans("KeepToShip").'</td>'; |
634 | - if (! empty($conf->stock->enabled)) |
|
634 | + if (!empty($conf->stock->enabled)) |
|
635 | 635 | { |
636 | 636 | print '<td align="center">'.$langs->trans("RealStock").'</td>'; |
637 | 637 | } |
@@ -641,20 +641,20 @@ discard block |
||
641 | 641 | } |
642 | 642 | print "</tr>\n"; |
643 | 643 | |
644 | - $toBeShipped=array(); |
|
645 | - $toBeShippedTotal=0; |
|
644 | + $toBeShipped = array(); |
|
645 | + $toBeShippedTotal = 0; |
|
646 | 646 | while ($i < $num) |
647 | 647 | { |
648 | 648 | $objp = $db->fetch_object($resql); |
649 | 649 | |
650 | 650 | |
651 | 651 | // Show product and description |
652 | - $type=isset($objp->type)?$objp->type:$objp->product_type; |
|
652 | + $type = isset($objp->type) ? $objp->type : $objp->product_type; |
|
653 | 653 | |
654 | 654 | // Try to enhance type detection using date_start and date_end for free lines where type |
655 | 655 | // was not saved. |
656 | - if (! empty($objp->date_start)) $type=1; |
|
657 | - if (! empty($objp->date_end)) $type=1; |
|
656 | + if (!empty($objp->date_start)) $type = 1; |
|
657 | + if (!empty($objp->date_end)) $type = 1; |
|
658 | 658 | |
659 | 659 | print '<tr class="oddeven">'; |
660 | 660 | |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | if ($objp->fk_product > 0) |
663 | 663 | { |
664 | 664 | // Define output language |
665 | - if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) |
|
665 | + if (!empty($conf->global->MAIN_MULTILANGS) && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) |
|
666 | 666 | { |
667 | 667 | $object->fetch_thirdparty(); |
668 | 668 | |
@@ -672,41 +672,41 @@ discard block |
||
672 | 672 | $prod->getMultiLangs(); |
673 | 673 | |
674 | 674 | $outputlangs = $langs; |
675 | - $newlang=''; |
|
676 | - if (empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; |
|
677 | - if (empty($newlang)) $newlang=$object->thirdparty->default_lang; |
|
678 | - if (! empty($newlang)) |
|
675 | + $newlang = ''; |
|
676 | + if (empty($newlang) && !empty($_REQUEST['lang_id'])) $newlang = $_REQUEST['lang_id']; |
|
677 | + if (empty($newlang)) $newlang = $object->thirdparty->default_lang; |
|
678 | + if (!empty($newlang)) |
|
679 | 679 | { |
680 | - $outputlangs = new Translate("",$conf); |
|
680 | + $outputlangs = new Translate("", $conf); |
|
681 | 681 | $outputlangs->setDefaultLang($newlang); |
682 | 682 | } |
683 | 683 | |
684 | - $label = (! empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $objp->product_label; |
|
684 | + $label = (!empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $objp->product_label; |
|
685 | 685 | } |
686 | 686 | else |
687 | - $label = (! empty($objp->label)?$objp->label:$objp->product_label); |
|
687 | + $label = (!empty($objp->label) ? $objp->label : $objp->product_label); |
|
688 | 688 | |
689 | 689 | print '<td>'; |
690 | 690 | print '<a name="'.$objp->rowid.'"></a>'; // ancre pour retourner sur la ligne |
691 | 691 | |
692 | 692 | // Show product and description |
693 | - $product_static->type=$type; |
|
694 | - $product_static->id=$objp->fk_product; |
|
695 | - $product_static->ref=$objp->ref; |
|
693 | + $product_static->type = $type; |
|
694 | + $product_static->id = $objp->fk_product; |
|
695 | + $product_static->ref = $objp->ref; |
|
696 | 696 | $product_static->entity = $objp->entity; |
697 | - $text=$product_static->getNomUrl(1); |
|
698 | - $text.= ' - '.$label; |
|
699 | - $description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($objp->description)).'<br>'; |
|
700 | - $description.= $product_static->show_photos('product', $conf->product->multidir_output[$product_static->entity], 1, 1, 0, 0, 0, 80); |
|
701 | - print $form->textwithtooltip($text,$description,3,'','',$i); |
|
697 | + $text = $product_static->getNomUrl(1); |
|
698 | + $text .= ' - '.$label; |
|
699 | + $description = ($conf->global->PRODUIT_DESC_IN_FORM ? '' : dol_htmlentitiesbr($objp->description)).'<br>'; |
|
700 | + $description .= $product_static->show_photos('product', $conf->product->multidir_output[$product_static->entity], 1, 1, 0, 0, 0, 80); |
|
701 | + print $form->textwithtooltip($text, $description, 3, '', '', $i); |
|
702 | 702 | |
703 | 703 | // Show range |
704 | - print_date_range($db->jdate($objp->date_start),$db->jdate($objp->date_end)); |
|
704 | + print_date_range($db->jdate($objp->date_start), $db->jdate($objp->date_end)); |
|
705 | 705 | |
706 | 706 | // Add description in form |
707 | - if (! empty($conf->global->PRODUIT_DESC_IN_FORM)) |
|
707 | + if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) |
|
708 | 708 | { |
709 | - print ($objp->description && $objp->description!=$objp->product_label)?'<br>'.dol_htmlentitiesbr($objp->description):''; |
|
709 | + print ($objp->description && $objp->description != $objp->product_label) ? '<br>'.dol_htmlentitiesbr($objp->description) : ''; |
|
710 | 710 | } |
711 | 711 | |
712 | 712 | print '</td>'; |
@@ -714,35 +714,35 @@ discard block |
||
714 | 714 | else |
715 | 715 | { |
716 | 716 | print "<td>"; |
717 | - if ($type==1) $text = img_object($langs->trans('Service'),'service'); |
|
718 | - else $text = img_object($langs->trans('Product'),'product'); |
|
717 | + if ($type == 1) $text = img_object($langs->trans('Service'), 'service'); |
|
718 | + else $text = img_object($langs->trans('Product'), 'product'); |
|
719 | 719 | |
720 | - if (! empty($objp->label)) { |
|
721 | - $text.= ' <strong>'.$objp->label.'</strong>'; |
|
722 | - print $form->textwithtooltip($text,$objp->description,3,'','',$i); |
|
720 | + if (!empty($objp->label)) { |
|
721 | + $text .= ' <strong>'.$objp->label.'</strong>'; |
|
722 | + print $form->textwithtooltip($text, $objp->description, 3, '', '', $i); |
|
723 | 723 | } else { |
724 | 724 | print $text.' '.nl2br($objp->description); |
725 | 725 | } |
726 | 726 | |
727 | 727 | // Show range |
728 | - print_date_range($db->jdate($objp->date_start),$db->jdate($objp->date_end)); |
|
728 | + print_date_range($db->jdate($objp->date_start), $db->jdate($objp->date_end)); |
|
729 | 729 | print "</td>\n"; |
730 | 730 | } |
731 | 731 | |
732 | 732 | // Qty ordered |
733 | - print '<td align="center">' . $objp->qty . '</td>'; |
|
733 | + print '<td align="center">'.$objp->qty.'</td>'; |
|
734 | 734 | |
735 | 735 | // Qty already shipped |
736 | - $qtyProdCom=$objp->qty; |
|
736 | + $qtyProdCom = $objp->qty; |
|
737 | 737 | print '<td align="center">'; |
738 | 738 | // Nb of sending products for this line of order |
739 | - $qtyAlreadyShipped = (! empty($object->expeditions[$objp->rowid])?$object->expeditions[$objp->rowid]:0); |
|
739 | + $qtyAlreadyShipped = (!empty($object->expeditions[$objp->rowid]) ? $object->expeditions[$objp->rowid] : 0); |
|
740 | 740 | print $qtyAlreadyShipped; |
741 | 741 | print '</td>'; |
742 | 742 | |
743 | 743 | // Qty remains to ship |
744 | 744 | print '<td align="center">'; |
745 | - if ($type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) |
|
745 | + if ($type == 0 || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) |
|
746 | 746 | { |
747 | 747 | $toBeShipped[$objp->fk_product] = $objp->qty - $qtyAlreadyShipped; |
748 | 748 | $toBeShippedTotal += $toBeShipped[$objp->fk_product]; |
@@ -761,7 +761,7 @@ discard block |
||
761 | 761 | $product->load_stock('warehouseopen'); |
762 | 762 | } |
763 | 763 | |
764 | - if ($objp->fk_product > 0 && ($type == Product::TYPE_PRODUCT || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) && ! empty($conf->stock->enabled)) |
|
764 | + if ($objp->fk_product > 0 && ($type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) && !empty($conf->stock->enabled)) |
|
765 | 765 | { |
766 | 766 | print '<td align="center">'; |
767 | 767 | print $product->stock_reel; |
@@ -778,7 +778,7 @@ discard block |
||
778 | 778 | print "</tr>\n"; |
779 | 779 | |
780 | 780 | // Show subproducts lines |
781 | - if ($objp->fk_product > 0 && ! empty($conf->global->PRODUIT_SOUSPRODUITS)) |
|
781 | + if ($objp->fk_product > 0 && !empty($conf->global->PRODUIT_SOUSPRODUITS)) |
|
782 | 782 | { |
783 | 783 | // Set tree of subproducts in product->sousprods |
784 | 784 | $product->get_sousproduits_arbo(); |
@@ -789,12 +789,12 @@ discard block |
||
789 | 789 | //var_dump($prods_arbo); |
790 | 790 | if (count($prods_arbo) > 0) |
791 | 791 | { |
792 | - foreach($prods_arbo as $key => $value) |
|
792 | + foreach ($prods_arbo as $key => $value) |
|
793 | 793 | { |
794 | - $img=''; |
|
794 | + $img = ''; |
|
795 | 795 | if ($value['stock'] < $value['stock_alert']) |
796 | 796 | { |
797 | - $img=img_warning($langs->trans("StockTooLow")); |
|
797 | + $img = img_warning($langs->trans("StockTooLow")); |
|
798 | 798 | } |
799 | 799 | print '<tr class="oddeven"><td> -> <a href="'.DOL_URL_ROOT."/product/card.php?id=".$value['id'].'">'.$value['fullpath'].'</a> ('.$value['nb'].')</td>'; |
800 | 800 | print '<td align="center"> '.$value['nb_total'].'</td>'; |
@@ -809,7 +809,7 @@ discard block |
||
809 | 809 | } |
810 | 810 | $db->free($resql); |
811 | 811 | |
812 | - if (! $num) |
|
812 | + if (!$num) |
|
813 | 813 | { |
814 | 814 | print '<tr '.$bc[false].'><td colspan="5">'.$langs->trans("NoArticleOfTypeProduct").'<br>'; |
815 | 815 | } |
@@ -854,12 +854,12 @@ discard block |
||
854 | 854 | |
855 | 855 | // Bouton expedier avec gestion des stocks |
856 | 856 | |
857 | - if (! empty($conf->stock->enabled) && $object->statut == Commande::STATUS_DRAFT) |
|
857 | + if (!empty($conf->stock->enabled) && $object->statut == Commande::STATUS_DRAFT) |
|
858 | 858 | { |
859 | 859 | print $langs->trans("ValidateOrderFirstBeforeShipment"); |
860 | 860 | } |
861 | 861 | |
862 | - if (! empty($conf->stock->enabled) && ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED)) |
|
862 | + if (!empty($conf->stock->enabled) && ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED)) |
|
863 | 863 | { |
864 | 864 | if ($user->rights->expedition->creer) |
865 | 865 | { |
@@ -879,13 +879,13 @@ discard block |
||
879 | 879 | |
880 | 880 | //print '<tr>'; |
881 | 881 | |
882 | - if (! empty($conf->stock->enabled)) |
|
882 | + if (!empty($conf->stock->enabled)) |
|
883 | 883 | { |
884 | 884 | //print '<td>'; |
885 | 885 | print $langs->trans("WarehouseSource"); |
886 | 886 | //print '</td>'; |
887 | 887 | //print '<td>'; |
888 | - print $formproduct->selectWarehouses(! empty($object->warehouse_id)?$object->warehouse_id:-1, 'entrepot_id', '', 1, 0, 0, '', 0, 0, array(), 'minwidth200'); |
|
888 | + print $formproduct->selectWarehouses(!empty($object->warehouse_id) ? $object->warehouse_id : -1, 'entrepot_id', '', 1, 0, 0, '', 0, 0, array(), 'minwidth200'); |
|
889 | 889 | if (count($formproduct->cache_warehouses) <= 0) |
890 | 890 | { |
891 | 891 | print ' '.$langs->trans("WarehouseSourceNotDefined").' <a href="'.DOL_URL_ROOT.'/product/stock/card.php?action=create">'.$langs->trans("AddOne").'</a>'; |
@@ -905,7 +905,7 @@ discard block |
||
905 | 905 | |
906 | 906 | print '</div>'; |
907 | 907 | |
908 | - $somethingshown=1; |
|
908 | + $somethingshown = 1; |
|
909 | 909 | } |
910 | 910 | else |
911 | 911 | { |
@@ -915,7 +915,7 @@ discard block |
||
915 | 915 | } |
916 | 916 | } |
917 | 917 | |
918 | - show_list_sending_receive('commande',$object->id); |
|
918 | + show_list_sending_receive('commande', $object->id); |
|
919 | 919 | } |
920 | 920 | else |
921 | 921 | { |
@@ -32,17 +32,17 @@ discard block |
||
32 | 32 | require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; |
33 | 33 | require_once DOL_DOCUMENT_ROOT.'/core/lib/sendings.lib.php'; |
34 | 34 | require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; |
35 | -require_once DOL_DOCUMENT_ROOT .'/expedition/class/expedition.class.php'; |
|
36 | -if (! empty($conf->projet->enabled)) { |
|
37 | - require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
|
35 | +require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; |
|
36 | +if (!empty($conf->projet->enabled)) { |
|
37 | + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | // Load translation files required by the page |
41 | 41 | $langs->loadLangs(array('companies', 'other')); |
42 | 42 | |
43 | -$action = GETPOST('action','aZ09'); |
|
43 | +$action = GETPOST('action', 'aZ09'); |
|
44 | 44 | $confirm = GETPOST('confirm'); |
45 | -$id = GETPOST('id','int'); |
|
45 | +$id = GETPOST('id', 'int'); |
|
46 | 46 | $ref = GETPOST('ref'); |
47 | 47 | |
48 | 48 | // Security check |
@@ -50,18 +50,18 @@ discard block |
||
50 | 50 | { |
51 | 51 | $socid = $user->societe_id; |
52 | 52 | } |
53 | -$result=restrictedArea($user,'expedition',$id,''); |
|
53 | +$result = restrictedArea($user, 'expedition', $id, ''); |
|
54 | 54 | |
55 | 55 | // Get parameters |
56 | -$sortfield = GETPOST("sortfield",'alpha'); |
|
57 | -$sortorder = GETPOST("sortorder",'alpha'); |
|
58 | -$page = GETPOST("page",'int'); |
|
56 | +$sortfield = GETPOST("sortfield", 'alpha'); |
|
57 | +$sortorder = GETPOST("sortorder", 'alpha'); |
|
58 | +$page = GETPOST("page", 'int'); |
|
59 | 59 | if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 |
60 | 60 | $offset = $conf->liste_limit * $page; |
61 | 61 | $pageprev = $page - 1; |
62 | 62 | $pagenext = $page + 1; |
63 | -if (! $sortorder) $sortorder="ASC"; |
|
64 | -if (! $sortfield) $sortfield="name"; |
|
63 | +if (!$sortorder) $sortorder = "ASC"; |
|
64 | +if (!$sortfield) $sortfield = "name"; |
|
65 | 65 | |
66 | 66 | $object = new Expedition($db); |
67 | 67 | |
@@ -72,22 +72,22 @@ discard block |
||
72 | 72 | if ($object->fetch($id)) |
73 | 73 | { |
74 | 74 | $object->fetch_thirdparty(); |
75 | - $upload_dir = $conf->expedition->dir_output . "/sending/" . dol_sanitizeFileName($object->ref); |
|
75 | + $upload_dir = $conf->expedition->dir_output."/sending/".dol_sanitizeFileName($object->ref); |
|
76 | 76 | } |
77 | 77 | |
78 | -include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; |
|
78 | +include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; |
|
79 | 79 | |
80 | 80 | |
81 | 81 | /* |
82 | 82 | * View |
83 | 83 | */ |
84 | 84 | |
85 | -llxHeader('',$langs->trans('Order'),'EN:Customers_Orders|FR:expeditions_Clients|ES:Pedidos de clientes'); |
|
85 | +llxHeader('', $langs->trans('Order'), 'EN:Customers_Orders|FR:expeditions_Clients|ES:Pedidos de clientes'); |
|
86 | 86 | |
87 | 87 | $form = new Form($db); |
88 | 88 | |
89 | -if ($id > 0 || ! empty($ref)){ |
|
90 | - if ($object->fetch($id, $ref)){ |
|
89 | +if ($id > 0 || !empty($ref)) { |
|
90 | + if ($object->fetch($id, $ref)) { |
|
91 | 91 | $object->fetch_thirdparty(); |
92 | 92 | |
93 | 93 | $upload_dir = $conf->expedition->dir_output.'/sending/'.dol_sanitizeFileName($object->ref); |
@@ -97,50 +97,50 @@ discard block |
||
97 | 97 | |
98 | 98 | |
99 | 99 | // Build file list |
100 | - $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview.*\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); |
|
101 | - $totalsize=0; |
|
102 | - foreach($filearray as $key => $file){ |
|
103 | - $totalsize+=$file['size']; |
|
100 | + $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1); |
|
101 | + $totalsize = 0; |
|
102 | + foreach ($filearray as $key => $file) { |
|
103 | + $totalsize += $file['size']; |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | // Shipment card |
107 | - $linkback = '<a href="'.DOL_URL_ROOT.'/expedition/list.php?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">'.$langs->trans("BackToList").'</a>'; |
|
107 | + $linkback = '<a href="'.DOL_URL_ROOT.'/expedition/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>'; |
|
108 | 108 | |
109 | 109 | |
110 | - $morehtmlref='<div class="refidno">'; |
|
110 | + $morehtmlref = '<div class="refidno">'; |
|
111 | 111 | // Ref customer |
112 | - $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); |
|
113 | - $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); |
|
112 | + $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); |
|
113 | + $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); |
|
114 | 114 | // Thirdparty |
115 | - $morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); |
|
115 | + $morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); |
|
116 | 116 | |
117 | 117 | // Project |
118 | - if (! empty($conf->projet->enabled)) { |
|
118 | + if (!empty($conf->projet->enabled)) { |
|
119 | 119 | $langs->load("projects"); |
120 | - $morehtmlref .= '<br>' . $langs->trans('Project') . ' '; |
|
120 | + $morehtmlref .= '<br>'.$langs->trans('Project').' '; |
|
121 | 121 | if (0) { // Do not change on shipment |
122 | 122 | if ($action != 'classify') { |
123 | - $morehtmlref .= '<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; |
|
123 | + $morehtmlref .= '<a href="'.$_SERVER['PHP_SELF'].'?action=classify&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : '; |
|
124 | 124 | } |
125 | 125 | if ($action == 'classify') { |
126 | 126 | // $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); |
127 | - $morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '">'; |
|
127 | + $morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">'; |
|
128 | 128 | $morehtmlref .= '<input type="hidden" name="action" value="classin">'; |
129 | - $morehtmlref .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
|
129 | + $morehtmlref .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
130 | 130 | $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); |
131 | - $morehtmlref .= '<input type="submit" class="button" value="' . $langs->trans("Modify") . '">'; |
|
131 | + $morehtmlref .= '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'; |
|
132 | 132 | $morehtmlref .= '</form>'; |
133 | 133 | } else { |
134 | - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); |
|
134 | + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); |
|
135 | 135 | } |
136 | 136 | } else { |
137 | 137 | // We don't have project on shipment, so we will use the project or source object instead |
138 | 138 | // TODO Add project on shipment |
139 | 139 | $morehtmlref .= ' : '; |
140 | - if (! empty($objectsrc->fk_project)) { |
|
140 | + if (!empty($objectsrc->fk_project)) { |
|
141 | 141 | $proj = new Project($db); |
142 | 142 | $proj->fetch($objectsrc->fk_project); |
143 | - $morehtmlref .= '<a href="' . DOL_URL_ROOT . '/projet/card.php?id=' . $objectsrc->fk_project . '" title="' . $langs->trans('ShowProject') . '">'; |
|
143 | + $morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$objectsrc->fk_project.'" title="'.$langs->trans('ShowProject').'">'; |
|
144 | 144 | $morehtmlref .= $proj->ref; |
145 | 145 | $morehtmlref .= '</a>'; |
146 | 146 | } else { |
@@ -148,11 +148,11 @@ discard block |
||
148 | 148 | } |
149 | 149 | } |
150 | 150 | } |
151 | - $morehtmlref.='</div>'; |
|
151 | + $morehtmlref .= '</div>'; |
|
152 | 152 | |
153 | 153 | // Order card |
154 | 154 | |
155 | - $linkback = '<a href="' . DOL_URL_ROOT . '/expedition/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>'; |
|
155 | + $linkback = '<a href="'.DOL_URL_ROOT.'/expedition/list.php'.(!empty($socid) ? '?socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>'; |
|
156 | 156 | |
157 | 157 | dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); |
158 | 158 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | print '<table class="border" width="100%">'; |
163 | 163 | |
164 | 164 | print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>'; |
165 | - print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.dol_print_size($totalsize,1,1).'</td></tr>'; |
|
165 | + print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.dol_print_size($totalsize, 1, 1).'</td></tr>'; |
|
166 | 166 | |
167 | 167 | print "</table>\n"; |
168 | 168 | |
@@ -173,14 +173,14 @@ discard block |
||
173 | 173 | $modulepart = 'expedition'; |
174 | 174 | $permission = $user->rights->expedition->creer; |
175 | 175 | $permtoedit = $user->rights->expedition->creer; |
176 | - $param = '&id=' . $object->id; |
|
177 | - include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; |
|
176 | + $param = '&id='.$object->id; |
|
177 | + include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; |
|
178 | 178 | } |
179 | - else{ |
|
179 | + else { |
|
180 | 180 | dol_print_error($db); |
181 | 181 | } |
182 | 182 | } |
183 | -else{ |
|
183 | +else { |
|
184 | 184 | header('Location: index.php'); |
185 | 185 | exit; |
186 | 186 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | require '../main.inc.php'; |
28 | 28 | require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; |
29 | 29 | require_once DOL_DOCUMENT_ROOT.'/core/lib/sendings.lib.php'; |
30 | -if (! empty($conf->projet->enabled)) { |
|
30 | +if (!empty($conf->projet->enabled)) { |
|
31 | 31 | require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
32 | 32 | require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; |
33 | 33 | } |
@@ -35,17 +35,17 @@ discard block |
||
35 | 35 | // Load translation files required by the page |
36 | 36 | $langs->loadLangs(array('sendings', 'companies', 'bills', 'deliveries', 'orders', 'stocks', 'other', 'propal')); |
37 | 37 | |
38 | -$id=(GETPOST('id','int')?GETPOST('id','int'):GETPOST('facid','int')); // For backward compatibility |
|
39 | -$ref=GETPOST('ref','alpha'); |
|
40 | -$action=GETPOST('action','alpha'); |
|
38 | +$id = (GETPOST('id', 'int') ?GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility |
|
39 | +$ref = GETPOST('ref', 'alpha'); |
|
40 | +$action = GETPOST('action', 'alpha'); |
|
41 | 41 | |
42 | 42 | // Security check |
43 | -$socid=''; |
|
44 | -if ($user->societe_id) $socid=$user->societe_id; |
|
45 | -$result=restrictedArea($user, $origin, $origin_id); |
|
43 | +$socid = ''; |
|
44 | +if ($user->societe_id) $socid = $user->societe_id; |
|
45 | +$result = restrictedArea($user, $origin, $origin_id); |
|
46 | 46 | |
47 | 47 | $object = new Expedition($db); |
48 | -if ($id > 0 || ! empty($ref)) |
|
48 | +if ($id > 0 || !empty($ref)) |
|
49 | 49 | { |
50 | 50 | $object->fetch($id, $ref); |
51 | 51 | $object->fetch_thirdparty(); |
@@ -58,26 +58,26 @@ discard block |
||
58 | 58 | } |
59 | 59 | |
60 | 60 | // Linked documents |
61 | - if ($typeobject == 'commande' && $object->$typeobject->id && ! empty($conf->commande->enabled)) |
|
61 | + if ($typeobject == 'commande' && $object->$typeobject->id && !empty($conf->commande->enabled)) |
|
62 | 62 | { |
63 | - $objectsrc=new Commande($db); |
|
63 | + $objectsrc = new Commande($db); |
|
64 | 64 | $objectsrc->fetch($object->$typeobject->id); |
65 | 65 | } |
66 | - if ($typeobject == 'propal' && $object->$typeobject->id && ! empty($conf->propal->enabled)) |
|
66 | + if ($typeobject == 'propal' && $object->$typeobject->id && !empty($conf->propal->enabled)) |
|
67 | 67 | { |
68 | - $objectsrc=new Propal($db); |
|
68 | + $objectsrc = new Propal($db); |
|
69 | 69 | $objectsrc->fetch($object->$typeobject->id); |
70 | 70 | } |
71 | 71 | } |
72 | 72 | |
73 | -$permissionnote=$user->rights->expedition->creer; // Used by the include of actions_setnotes.inc.php |
|
73 | +$permissionnote = $user->rights->expedition->creer; // Used by the include of actions_setnotes.inc.php |
|
74 | 74 | |
75 | 75 | |
76 | 76 | /* |
77 | 77 | * Actions |
78 | 78 | */ |
79 | 79 | |
80 | -include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once |
|
80 | +include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once |
|
81 | 81 | |
82 | 82 | |
83 | 83 | /* |
@@ -88,49 +88,49 @@ discard block |
||
88 | 88 | |
89 | 89 | $form = new Form($db); |
90 | 90 | |
91 | -if ($id > 0 || ! empty($ref)) |
|
91 | +if ($id > 0 || !empty($ref)) |
|
92 | 92 | { |
93 | 93 | |
94 | - $head=shipping_prepare_head($object); |
|
94 | + $head = shipping_prepare_head($object); |
|
95 | 95 | dol_fiche_head($head, 'note', $langs->trans("Shipment"), -1, 'sending'); |
96 | 96 | |
97 | 97 | |
98 | 98 | // Shipment card |
99 | - $linkback = '<a href="'.DOL_URL_ROOT.'/expedition/list.php?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">'.$langs->trans("BackToList").'</a>'; |
|
99 | + $linkback = '<a href="'.DOL_URL_ROOT.'/expedition/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>'; |
|
100 | 100 | |
101 | - $morehtmlref='<div class="refidno">'; |
|
101 | + $morehtmlref = '<div class="refidno">'; |
|
102 | 102 | // Ref customer shipment |
103 | - $morehtmlref.=$form->editfieldkey("RefCustomer", '', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', 0, 1); |
|
104 | - $morehtmlref.=$form->editfieldval("RefCustomer", '', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', null, null, '', 1); |
|
103 | + $morehtmlref .= $form->editfieldkey("RefCustomer", '', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', 0, 1); |
|
104 | + $morehtmlref .= $form->editfieldval("RefCustomer", '', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', null, null, '', 1); |
|
105 | 105 | // Thirdparty |
106 | - $morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); |
|
106 | + $morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); |
|
107 | 107 | // Project |
108 | - if (! empty($conf->projet->enabled)) { |
|
108 | + if (!empty($conf->projet->enabled)) { |
|
109 | 109 | $langs->load("projects"); |
110 | - $morehtmlref .= '<br>' . $langs->trans('Project') . ' '; |
|
110 | + $morehtmlref .= '<br>'.$langs->trans('Project').' '; |
|
111 | 111 | if (0) { // Do not change on shipment |
112 | 112 | if ($action != 'classify') { |
113 | - $morehtmlref .= '<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; |
|
113 | + $morehtmlref .= '<a href="'.$_SERVER['PHP_SELF'].'?action=classify&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : '; |
|
114 | 114 | } |
115 | 115 | if ($action == 'classify') { |
116 | 116 | // $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); |
117 | - $morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '">'; |
|
117 | + $morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">'; |
|
118 | 118 | $morehtmlref .= '<input type="hidden" name="action" value="classin">'; |
119 | - $morehtmlref .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
|
119 | + $morehtmlref .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
120 | 120 | $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); |
121 | - $morehtmlref .= '<input type="submit" class="button" value="' . $langs->trans("Modify") . '">'; |
|
121 | + $morehtmlref .= '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'; |
|
122 | 122 | $morehtmlref .= '</form>'; |
123 | 123 | } else { |
124 | - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); |
|
124 | + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); |
|
125 | 125 | } |
126 | 126 | } else { |
127 | 127 | // We don't have project on shipment, so we will use the project or source object instead |
128 | 128 | // TODO Add project on shipment |
129 | 129 | $morehtmlref .= ' : '; |
130 | - if (! empty($objectsrc->fk_project)) { |
|
130 | + if (!empty($objectsrc->fk_project)) { |
|
131 | 131 | $proj = new Project($db); |
132 | 132 | $proj->fetch($objectsrc->fk_project); |
133 | - $morehtmlref .= '<a href="' . DOL_URL_ROOT . '/projet/card.php?id=' . $objectsrc->fk_project . '" title="' . $langs->trans('ShowProject') . '">'; |
|
133 | + $morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$objectsrc->fk_project.'" title="'.$langs->trans('ShowProject').'">'; |
|
134 | 134 | $morehtmlref .= $proj->ref; |
135 | 135 | $morehtmlref .= '</a>'; |
136 | 136 | } else { |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | } |
139 | 139 | } |
140 | 140 | } |
141 | - $morehtmlref.='</div>'; |
|
141 | + $morehtmlref .= '</div>'; |
|
142 | 142 | |
143 | 143 | |
144 | 144 | dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | |
147 | 147 | print '<div class="underbanner clearboth"></div>'; |
148 | 148 | |
149 | - $cssclass='titlefield'; |
|
149 | + $cssclass = 'titlefield'; |
|
150 | 150 | include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; |
151 | 151 | |
152 | 152 | dol_fiche_end(); |
@@ -34,12 +34,12 @@ discard block |
||
34 | 34 | * View |
35 | 35 | */ |
36 | 36 | |
37 | -$orderstatic=new Commande($db); |
|
38 | -$companystatic=new Societe($db); |
|
39 | -$shipment=new Expedition($db); |
|
37 | +$orderstatic = new Commande($db); |
|
38 | +$companystatic = new Societe($db); |
|
39 | +$shipment = new Expedition($db); |
|
40 | 40 | |
41 | -$helpurl='EN:Module_Shipments|FR:Module_Expéditions|ES:Módulo_Expediciones'; |
|
42 | -llxHeader('',$langs->trans("Shipment"),$helpurl); |
|
41 | +$helpurl = 'EN:Module_Shipments|FR:Module_Expéditions|ES:Módulo_Expediciones'; |
|
42 | +llxHeader('', $langs->trans("Shipment"), $helpurl); |
|
43 | 43 | |
44 | 44 | print load_fiche_titre($langs->trans("SendingsArea")); |
45 | 45 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | print '<div class="fichecenter"><div class="fichethirdleft">'; |
48 | 48 | |
49 | 49 | |
50 | -if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is useless due to the global search combo |
|
50 | +if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is useless due to the global search combo |
|
51 | 51 | { |
52 | 52 | print '<form method="post" action="list.php">'; |
53 | 53 | print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
@@ -64,23 +64,23 @@ discard block |
||
64 | 64 | $clause = " WHERE "; |
65 | 65 | |
66 | 66 | $sql = "SELECT e.rowid, e.ref, e.ref_customer,"; |
67 | -$sql.= " s.nom as name, s.rowid as socid,"; |
|
68 | -$sql.= " c.ref as commande_ref, c.rowid as commande_id"; |
|
69 | -$sql.= " FROM ".MAIN_DB_PREFIX."expedition as e"; |
|
70 | -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON e.rowid = el.fk_target AND el.targettype = 'shipping'"; |
|
71 | -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."commande as c ON el.fk_source = c.rowid"; |
|
72 | -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc"; |
|
67 | +$sql .= " s.nom as name, s.rowid as socid,"; |
|
68 | +$sql .= " c.ref as commande_ref, c.rowid as commande_id"; |
|
69 | +$sql .= " FROM ".MAIN_DB_PREFIX."expedition as e"; |
|
70 | +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON e.rowid = el.fk_target AND el.targettype = 'shipping'"; |
|
71 | +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."commande as c ON el.fk_source = c.rowid"; |
|
72 | +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc"; |
|
73 | 73 | if (!$user->rights->societe->client->voir && !$socid) |
74 | 74 | { |
75 | - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON e.fk_soc = sc.fk_soc"; |
|
76 | - $sql.= $clause." sc.fk_user = " .$user->id; |
|
75 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON e.fk_soc = sc.fk_soc"; |
|
76 | + $sql .= $clause." sc.fk_user = ".$user->id; |
|
77 | 77 | $clause = " AND "; |
78 | 78 | } |
79 | -$sql.= $clause." e.fk_statut = 0"; |
|
80 | -$sql.= " AND e.entity IN (".getEntity('expedition').")"; |
|
81 | -if ($socid) $sql.= " AND c.fk_soc = ".$socid; |
|
79 | +$sql .= $clause." e.fk_statut = 0"; |
|
80 | +$sql .= " AND e.entity IN (".getEntity('expedition').")"; |
|
81 | +if ($socid) $sql .= " AND c.fk_soc = ".$socid; |
|
82 | 82 | |
83 | -$resql=$db->query($sql); |
|
83 | +$resql = $db->query($sql); |
|
84 | 84 | if ($resql) |
85 | 85 | { |
86 | 86 | $num = $db->num_rows($resql); |
@@ -94,9 +94,9 @@ discard block |
||
94 | 94 | { |
95 | 95 | $obj = $db->fetch_object($resql); |
96 | 96 | |
97 | - $shipment->id=$obj->rowid; |
|
98 | - $shipment->ref=$obj->ref; |
|
99 | - $shipment->ref_customer=$obj->ref_customer; |
|
97 | + $shipment->id = $obj->rowid; |
|
98 | + $shipment->ref = $obj->ref; |
|
99 | + $shipment->ref_customer = $obj->ref_customer; |
|
100 | 100 | |
101 | 101 | print '<tr class="oddeven"><td class="nowrap">'; |
102 | 102 | print $shipment->getNomUrl(1); |
@@ -118,17 +118,17 @@ discard block |
||
118 | 118 | * Commandes a traiter |
119 | 119 | */ |
120 | 120 | $sql = "SELECT c.rowid, c.ref, c.ref_client as ref_customer, c.fk_statut, s.nom as name, s.rowid as socid"; |
121 | -$sql.= " FROM ".MAIN_DB_PREFIX."commande as c,"; |
|
122 | -$sql.= " ".MAIN_DB_PREFIX."societe as s"; |
|
123 | -if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; |
|
124 | -$sql.= " WHERE c.fk_soc = s.rowid"; |
|
125 | -$sql.= " AND c.entity = ".$conf->entity; |
|
126 | -$sql.= " AND c.fk_statut = 1"; |
|
127 | -if ($socid) $sql.= " AND c.fk_soc = ".$socid; |
|
128 | -if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; |
|
129 | -$sql.= " ORDER BY c.rowid ASC"; |
|
130 | - |
|
131 | -$resql=$db->query($sql); |
|
121 | +$sql .= " FROM ".MAIN_DB_PREFIX."commande as c,"; |
|
122 | +$sql .= " ".MAIN_DB_PREFIX."societe as s"; |
|
123 | +if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; |
|
124 | +$sql .= " WHERE c.fk_soc = s.rowid"; |
|
125 | +$sql .= " AND c.entity = ".$conf->entity; |
|
126 | +$sql .= " AND c.fk_statut = 1"; |
|
127 | +if ($socid) $sql .= " AND c.fk_soc = ".$socid; |
|
128 | +if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; |
|
129 | +$sql .= " ORDER BY c.rowid ASC"; |
|
130 | + |
|
131 | +$resql = $db->query($sql); |
|
132 | 132 | if ($resql) |
133 | 133 | { |
134 | 134 | $num = $db->num_rows($resql); |
@@ -144,21 +144,21 @@ discard block |
||
144 | 144 | { |
145 | 145 | $obj = $db->fetch_object($resql); |
146 | 146 | |
147 | - $orderstatic->id=$obj->rowid; |
|
148 | - $orderstatic->ref=$obj->ref; |
|
149 | - $orderstatic->ref_customer=$obj->ref_customer; |
|
150 | - $orderstatic->statut=$obj->fk_statut; |
|
151 | - $orderstatic->billed=0; |
|
147 | + $orderstatic->id = $obj->rowid; |
|
148 | + $orderstatic->ref = $obj->ref; |
|
149 | + $orderstatic->ref_customer = $obj->ref_customer; |
|
150 | + $orderstatic->statut = $obj->fk_statut; |
|
151 | + $orderstatic->billed = 0; |
|
152 | 152 | |
153 | - $companystatic->name=$obj->name; |
|
154 | - $companystatic->id=$obj->socid; |
|
153 | + $companystatic->name = $obj->name; |
|
154 | + $companystatic->id = $obj->socid; |
|
155 | 155 | |
156 | 156 | print '<tr class="oddeven">'; |
157 | 157 | print '<td class="nowrap">'; |
158 | 158 | print $orderstatic->getNomUrl(1); |
159 | 159 | print '</td>'; |
160 | 160 | print '<td>'; |
161 | - print $companystatic->getNomUrl(1,'customer',32); |
|
161 | + print $companystatic->getNomUrl(1, 'customer', 32); |
|
162 | 162 | print '</td>'; |
163 | 163 | print '<td align="right">'; |
164 | 164 | print $orderstatic->getLibStatut(3); |
@@ -179,17 +179,17 @@ discard block |
||
179 | 179 | * Commandes en traitement |
180 | 180 | */ |
181 | 181 | $sql = "SELECT c.rowid, c.ref, c.ref_client as ref_customer, c.fk_statut as status, c.facture as billed, s.nom as name, s.rowid as socid"; |
182 | -$sql.= " FROM ".MAIN_DB_PREFIX."commande as c,"; |
|
183 | -$sql.= " ".MAIN_DB_PREFIX."societe as s"; |
|
184 | -if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; |
|
185 | -$sql.= " WHERE c.fk_soc = s.rowid"; |
|
186 | -$sql.= " AND c.entity = ".$conf->entity; |
|
187 | -$sql.= " AND c.fk_statut = 2"; |
|
188 | -if ($socid) $sql.= " AND c.fk_soc = ".$socid; |
|
189 | -if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; |
|
182 | +$sql .= " FROM ".MAIN_DB_PREFIX."commande as c,"; |
|
183 | +$sql .= " ".MAIN_DB_PREFIX."societe as s"; |
|
184 | +if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; |
|
185 | +$sql .= " WHERE c.fk_soc = s.rowid"; |
|
186 | +$sql .= " AND c.entity = ".$conf->entity; |
|
187 | +$sql .= " AND c.fk_statut = 2"; |
|
188 | +if ($socid) $sql .= " AND c.fk_soc = ".$socid; |
|
189 | +if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; |
|
190 | 190 | |
191 | 191 | $resql = $db->query($sql); |
192 | -if ( $resql ) |
|
192 | +if ($resql) |
|
193 | 193 | { |
194 | 194 | $langs->load("orders"); |
195 | 195 | |
@@ -204,20 +204,20 @@ discard block |
||
204 | 204 | { |
205 | 205 | $obj = $db->fetch_object($resql); |
206 | 206 | |
207 | - $orderstatic->id=$obj->rowid; |
|
208 | - $orderstatic->ref=$obj->ref; |
|
209 | - $orderstatic->ref_customer=$obj->ref_customer; |
|
210 | - $orderstatic->statut=$obj->status; |
|
211 | - $orderstatic->billed=$obj->billed; |
|
207 | + $orderstatic->id = $obj->rowid; |
|
208 | + $orderstatic->ref = $obj->ref; |
|
209 | + $orderstatic->ref_customer = $obj->ref_customer; |
|
210 | + $orderstatic->statut = $obj->status; |
|
211 | + $orderstatic->billed = $obj->billed; |
|
212 | 212 | |
213 | - $companystatic->name=$obj->name; |
|
214 | - $companystatic->id=$obj->socid; |
|
213 | + $companystatic->name = $obj->name; |
|
214 | + $companystatic->id = $obj->socid; |
|
215 | 215 | |
216 | 216 | print '<tr class="oddeven"><td>'; |
217 | 217 | print $orderstatic->getNomUrl(1); |
218 | 218 | print '</td>'; |
219 | 219 | print '<td>'; |
220 | - print $companystatic->getNomUrl(1,'customer'); |
|
220 | + print $companystatic->getNomUrl(1, 'customer'); |
|
221 | 221 | print '</td>'; |
222 | 222 | print '<td align="right">'; |
223 | 223 | print $orderstatic->getLibStatut(3); |
@@ -235,19 +235,19 @@ discard block |
||
235 | 235 | * Last shipments |
236 | 236 | */ |
237 | 237 | $sql = "SELECT e.rowid, e.ref, e.ref_customer,"; |
238 | -$sql.= " s.nom as name, s.rowid as socid,"; |
|
239 | -$sql.= " c.ref as commande_ref, c.rowid as commande_id"; |
|
240 | -$sql.= " FROM ".MAIN_DB_PREFIX."expedition as e"; |
|
241 | -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON e.rowid = el.fk_target AND el.targettype = 'shipping' AND el.sourcetype IN ('commande')"; |
|
242 | -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."commande as c ON el.fk_source = c.rowid AND el.sourcetype IN ('commande') AND el.targettype = 'shipping'"; |
|
243 | -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc"; |
|
244 | -if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON e.fk_soc = sc.fk_soc"; |
|
245 | -$sql.= " WHERE e.entity IN (".getEntity('expedition').")"; |
|
246 | -if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND sc.fk_user = " .$user->id; |
|
247 | -$sql.= " AND e.fk_statut = 1"; |
|
248 | -if ($socid) $sql.= " AND c.fk_soc = ".$socid; |
|
249 | -$sql.= " ORDER BY e.date_delivery DESC"; |
|
250 | -$sql.= $db->plimit(5, 0); |
|
238 | +$sql .= " s.nom as name, s.rowid as socid,"; |
|
239 | +$sql .= " c.ref as commande_ref, c.rowid as commande_id"; |
|
240 | +$sql .= " FROM ".MAIN_DB_PREFIX."expedition as e"; |
|
241 | +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON e.rowid = el.fk_target AND el.targettype = 'shipping' AND el.sourcetype IN ('commande')"; |
|
242 | +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."commande as c ON el.fk_source = c.rowid AND el.sourcetype IN ('commande') AND el.targettype = 'shipping'"; |
|
243 | +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc"; |
|
244 | +if (!$user->rights->societe->client->voir && !$socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON e.fk_soc = sc.fk_soc"; |
|
245 | +$sql .= " WHERE e.entity IN (".getEntity('expedition').")"; |
|
246 | +if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND sc.fk_user = ".$user->id; |
|
247 | +$sql .= " AND e.fk_statut = 1"; |
|
248 | +if ($socid) $sql .= " AND c.fk_soc = ".$socid; |
|
249 | +$sql .= " ORDER BY e.date_delivery DESC"; |
|
250 | +$sql .= $db->plimit(5, 0); |
|
251 | 251 | |
252 | 252 | $resql = $db->query($sql); |
253 | 253 | if ($resql) |
@@ -263,19 +263,19 @@ discard block |
||
263 | 263 | { |
264 | 264 | $obj = $db->fetch_object($resql); |
265 | 265 | |
266 | - $shipment->id=$obj->rowid; |
|
267 | - $shipment->ref=$obj->ref; |
|
268 | - $shipment->ref_customer=$obj->ref_customer; |
|
266 | + $shipment->id = $obj->rowid; |
|
267 | + $shipment->ref = $obj->ref; |
|
268 | + $shipment->ref_customer = $obj->ref_customer; |
|
269 | 269 | |
270 | 270 | print '<tr class="oddeven"><td>'; |
271 | 271 | print $shipment->getNomUrl(1); |
272 | 272 | print '</td>'; |
273 | - print '<td><a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->name.'</a></td>'; |
|
273 | + print '<td><a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"), "company").' '.$obj->name.'</a></td>'; |
|
274 | 274 | print '<td>'; |
275 | 275 | if ($obj->commande_id > 0) |
276 | 276 | { |
277 | - $orderstatic->id=$obj->commande_id; |
|
278 | - $orderstatic->ref=$obj->commande_ref; |
|
277 | + $orderstatic->id = $obj->commande_id; |
|
278 | + $orderstatic->ref = $obj->commande_ref; |
|
279 | 279 | print $orderstatic->getNomUrl(1); |
280 | 280 | } |
281 | 281 | else print ' '; |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | require_once DOL_DOCUMENT_ROOT.'/core/lib/sendings.lib.php'; |
30 | 30 | require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; |
31 | 31 | require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; |
32 | -if (! empty($conf->projet->enabled)) { |
|
32 | +if (!empty($conf->projet->enabled)) { |
|
33 | 33 | require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
34 | 34 | require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; |
35 | 35 | } |
@@ -37,16 +37,16 @@ discard block |
||
37 | 37 | // Load translation files required by the page |
38 | 38 | $langs->loadLangs(array('orders', 'sendings', 'companies')); |
39 | 39 | |
40 | -$id=GETPOST('id','int'); |
|
41 | -$ref=GETPOST('ref','alpha'); |
|
42 | -$action=GETPOST('action','alpha'); |
|
40 | +$id = GETPOST('id', 'int'); |
|
41 | +$ref = GETPOST('ref', 'alpha'); |
|
42 | +$action = GETPOST('action', 'alpha'); |
|
43 | 43 | |
44 | 44 | // Security check |
45 | -if ($user->societe_id) $socid=$user->societe_id; |
|
46 | -$result = restrictedArea($user, 'expedition', $id,''); |
|
45 | +if ($user->societe_id) $socid = $user->societe_id; |
|
46 | +$result = restrictedArea($user, 'expedition', $id, ''); |
|
47 | 47 | |
48 | 48 | $object = new Expedition($db); |
49 | -if ($id > 0 || ! empty($ref)) |
|
49 | +if ($id > 0 || !empty($ref)) |
|
50 | 50 | { |
51 | 51 | $object->fetch($id, $ref); |
52 | 52 | $object->fetch_thirdparty(); |
@@ -59,14 +59,14 @@ discard block |
||
59 | 59 | } |
60 | 60 | |
61 | 61 | // Linked documents |
62 | - if ($typeobject == 'commande' && $object->$typeobject->id && ! empty($conf->commande->enabled)) |
|
62 | + if ($typeobject == 'commande' && $object->$typeobject->id && !empty($conf->commande->enabled)) |
|
63 | 63 | { |
64 | - $objectsrc=new Commande($db); |
|
64 | + $objectsrc = new Commande($db); |
|
65 | 65 | $objectsrc->fetch($object->$typeobject->id); |
66 | 66 | } |
67 | - if ($typeobject == 'propal' && $object->$typeobject->id && ! empty($conf->propal->enabled)) |
|
67 | + if ($typeobject == 'propal' && $object->$typeobject->id && !empty($conf->propal->enabled)) |
|
68 | 68 | { |
69 | - $objectsrc=new Propal($db); |
|
69 | + $objectsrc = new Propal($db); |
|
70 | 70 | $objectsrc->fetch($object->$typeobject->id); |
71 | 71 | } |
72 | 72 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | // bascule du statut d'un contact |
106 | 106 | else if ($action == 'swapstatut' && $user->rights->expedition->creer) |
107 | 107 | { |
108 | - $result=$objectsrc->swapContactStatus(GETPOST('ligne')); |
|
108 | + $result = $objectsrc->swapContactStatus(GETPOST('ligne')); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | // Efface un contact |
@@ -135,13 +135,13 @@ discard block |
||
135 | 135 | * View |
136 | 136 | */ |
137 | 137 | |
138 | -llxHeader('',$langs->trans('Order'),'EN:Customers_Orders|FR:expeditions_Clients|ES:Pedidos de clientes'); |
|
138 | +llxHeader('', $langs->trans('Order'), 'EN:Customers_Orders|FR:expeditions_Clients|ES:Pedidos de clientes'); |
|
139 | 139 | |
140 | 140 | $form = new Form($db); |
141 | 141 | $formcompany = new FormCompany($db); |
142 | 142 | $formother = new FormOther($db); |
143 | -$contactstatic=new Contact($db); |
|
144 | -$userstatic=new User($db); |
|
143 | +$contactstatic = new Contact($db); |
|
144 | +$userstatic = new User($db); |
|
145 | 145 | |
146 | 146 | |
147 | 147 | /* *************************************************************************** */ |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | /* */ |
151 | 151 | /* *************************************************************************** */ |
152 | 152 | |
153 | -if ($id > 0 || ! empty($ref)) |
|
153 | +if ($id > 0 || !empty($ref)) |
|
154 | 154 | { |
155 | 155 | $langs->trans("OrderCard"); |
156 | 156 | |
@@ -159,41 +159,41 @@ discard block |
||
159 | 159 | |
160 | 160 | |
161 | 161 | // Shipment card |
162 | - $linkback = '<a href="'.DOL_URL_ROOT.'/expedition/list.php?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">'.$langs->trans("BackToList").'</a>'; |
|
162 | + $linkback = '<a href="'.DOL_URL_ROOT.'/expedition/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>'; |
|
163 | 163 | |
164 | - $morehtmlref='<div class="refidno">'; |
|
164 | + $morehtmlref = '<div class="refidno">'; |
|
165 | 165 | // Ref customer shipment |
166 | - $morehtmlref.=$form->editfieldkey("RefCustomer", '', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', 0, 1); |
|
167 | - $morehtmlref.=$form->editfieldval("RefCustomer", '', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', null, null, '', 1); |
|
166 | + $morehtmlref .= $form->editfieldkey("RefCustomer", '', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', 0, 1); |
|
167 | + $morehtmlref .= $form->editfieldval("RefCustomer", '', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', null, null, '', 1); |
|
168 | 168 | // Thirdparty |
169 | - $morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); |
|
169 | + $morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); |
|
170 | 170 | // Project |
171 | - if (! empty($conf->projet->enabled)) { |
|
171 | + if (!empty($conf->projet->enabled)) { |
|
172 | 172 | $langs->load("projects"); |
173 | - $morehtmlref .= '<br>' . $langs->trans('Project') . ' '; |
|
173 | + $morehtmlref .= '<br>'.$langs->trans('Project').' '; |
|
174 | 174 | if (0) { // Do not change on shipment |
175 | 175 | if ($action != 'classify') { |
176 | - $morehtmlref .= '<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; |
|
176 | + $morehtmlref .= '<a href="'.$_SERVER['PHP_SELF'].'?action=classify&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : '; |
|
177 | 177 | } |
178 | 178 | if ($action == 'classify') { |
179 | 179 | // $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); |
180 | - $morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '">'; |
|
180 | + $morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">'; |
|
181 | 181 | $morehtmlref .= '<input type="hidden" name="action" value="classin">'; |
182 | - $morehtmlref .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
|
182 | + $morehtmlref .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
183 | 183 | $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); |
184 | - $morehtmlref .= '<input type="submit" class="button" value="' . $langs->trans("Modify") . '">'; |
|
184 | + $morehtmlref .= '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'; |
|
185 | 185 | $morehtmlref .= '</form>'; |
186 | 186 | } else { |
187 | - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); |
|
187 | + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); |
|
188 | 188 | } |
189 | 189 | } else { |
190 | 190 | // We don't have project on shipment, so we will use the project or source object instead |
191 | 191 | // TODO Add project on shipment |
192 | 192 | $morehtmlref .= ' : '; |
193 | - if (! empty($objectsrc->fk_project)) { |
|
193 | + if (!empty($objectsrc->fk_project)) { |
|
194 | 194 | $proj = new Project($db); |
195 | 195 | $proj->fetch($objectsrc->fk_project); |
196 | - $morehtmlref .= '<a href="' . DOL_URL_ROOT . '/projet/card.php?id=' . $objectsrc->fk_project . '" title="' . $langs->trans('ShowProject') . '">'; |
|
196 | + $morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$objectsrc->fk_project.'" title="'.$langs->trans('ShowProject').'">'; |
|
197 | 197 | $morehtmlref .= $proj->ref; |
198 | 198 | $morehtmlref .= '</a>'; |
199 | 199 | } else { |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | } |
202 | 202 | } |
203 | 203 | } |
204 | - $morehtmlref.='</div>'; |
|
204 | + $morehtmlref .= '</div>'; |
|
205 | 205 | |
206 | 206 | |
207 | 207 | dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); |
@@ -214,25 +214,25 @@ discard block |
||
214 | 214 | print '<table class="border centpercent">'; |
215 | 215 | |
216 | 216 | // Linked documents |
217 | - if ($typeobject == 'commande' && $object->$typeobject->id && ! empty($conf->commande->enabled)) |
|
217 | + if ($typeobject == 'commande' && $object->$typeobject->id && !empty($conf->commande->enabled)) |
|
218 | 218 | { |
219 | 219 | print '<tr><td class="titlefield">'; |
220 | - $objectsrc=new Commande($db); |
|
220 | + $objectsrc = new Commande($db); |
|
221 | 221 | $objectsrc->fetch($object->$typeobject->id); |
222 | 222 | print $langs->trans("RefOrder").'</td>'; |
223 | 223 | print '<td colspan="3">'; |
224 | - print $objectsrc->getNomUrl(1,'commande'); |
|
224 | + print $objectsrc->getNomUrl(1, 'commande'); |
|
225 | 225 | print "</td>\n"; |
226 | 226 | print '</tr>'; |
227 | 227 | } |
228 | - if ($typeobject == 'propal' && $object->$typeobject->id && ! empty($conf->propal->enabled)) |
|
228 | + if ($typeobject == 'propal' && $object->$typeobject->id && !empty($conf->propal->enabled)) |
|
229 | 229 | { |
230 | 230 | print '<tr><td class="titlefield">'; |
231 | - $objectsrc=new Propal($db); |
|
231 | + $objectsrc = new Propal($db); |
|
232 | 232 | $objectsrc->fetch($object->$typeobject->id); |
233 | 233 | print $langs->trans("RefProposal").'</td>'; |
234 | 234 | print '<td colspan="3">'; |
235 | - print $objectsrc->getNomUrl(1,'expedition'); |
|
235 | + print $objectsrc->getNomUrl(1, 'expedition'); |
|
236 | 236 | print "</td>\n"; |
237 | 237 | print '</tr>'; |
238 | 238 | } |
@@ -259,10 +259,10 @@ discard block |
||
259 | 259 | echo '<br>'; |
260 | 260 | |
261 | 261 | // Contacts lines (modules that overwrite templates must declare this into descriptor) |
262 | - $dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl')); |
|
263 | - foreach($dirtpls as $reldir) |
|
262 | + $dirtpls = array_merge($conf->modules_parts['tpl'], array('/core/tpl')); |
|
263 | + foreach ($dirtpls as $reldir) |
|
264 | 264 | { |
265 | - $res=@include dol_buildpath($reldir.'/contacts.tpl.php'); |
|
265 | + $res = @include dol_buildpath($reldir.'/contacts.tpl.php'); |
|
266 | 266 | if ($res) break; |
267 | 267 | } |
268 | 268 | } |
@@ -31,43 +31,43 @@ discard block |
||
31 | 31 | require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; |
32 | 32 | |
33 | 33 | // Load translation files required by the page |
34 | -$langs->loadLangs(array("sendings","deliveries",'companies','bills')); |
|
34 | +$langs->loadLangs(array("sendings", "deliveries", 'companies', 'bills')); |
|
35 | 35 | |
36 | -$contextpage= GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'shipmentlist'; // To manage different context of search |
|
36 | +$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'shipmentlist'; // To manage different context of search |
|
37 | 37 | |
38 | -$socid=GETPOST('socid','int'); |
|
38 | +$socid = GETPOST('socid', 'int'); |
|
39 | 39 | // Security check |
40 | -$expeditionid = GETPOST('id','int'); |
|
41 | -if ($user->societe_id) $socid=$user->societe_id; |
|
42 | -$result = restrictedArea($user, 'expedition',$expeditionid,''); |
|
40 | +$expeditionid = GETPOST('id', 'int'); |
|
41 | +if ($user->societe_id) $socid = $user->societe_id; |
|
42 | +$result = restrictedArea($user, 'expedition', $expeditionid, ''); |
|
43 | 43 | |
44 | -$diroutputmassaction=$conf->expedition->dir_output . '/temp/massgeneration/'.$user->id; |
|
44 | +$diroutputmassaction = $conf->expedition->dir_output.'/temp/massgeneration/'.$user->id; |
|
45 | 45 | |
46 | 46 | $search_ref_exp = GETPOST("search_ref_exp", 'alpha'); |
47 | 47 | $search_ref_liv = GETPOST('search_ref_liv', 'alpha'); |
48 | 48 | $search_ref_customer = GETPOST('search_ref_customer', 'alpha'); |
49 | 49 | $search_company = GETPOST("search_company", 'alpha'); |
50 | -$search_town=GETPOST('search_town','alpha'); |
|
51 | -$search_zip=GETPOST('search_zip','alpha'); |
|
52 | -$search_state=trim(GETPOST("search_state")); |
|
53 | -$search_country=GETPOST("search_country",'int'); |
|
54 | -$search_type_thirdparty=GETPOST("search_type_thirdparty",'int'); |
|
55 | -$search_billed=GETPOST("search_billed",'int'); |
|
56 | -$sall = trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml')); |
|
57 | -$optioncss = GETPOST('optioncss','alpha'); |
|
58 | - |
|
59 | -$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; |
|
60 | -$sortfield = GETPOST('sortfield','alpha'); |
|
61 | -$sortorder = GETPOST('sortorder','alpha'); |
|
62 | -$page = GETPOST('page','int'); |
|
63 | -if (! $sortfield) $sortfield="e.ref"; |
|
64 | -if (! $sortorder) $sortorder="DESC"; |
|
50 | +$search_town = GETPOST('search_town', 'alpha'); |
|
51 | +$search_zip = GETPOST('search_zip', 'alpha'); |
|
52 | +$search_state = trim(GETPOST("search_state")); |
|
53 | +$search_country = GETPOST("search_country", 'int'); |
|
54 | +$search_type_thirdparty = GETPOST("search_type_thirdparty", 'int'); |
|
55 | +$search_billed = GETPOST("search_billed", 'int'); |
|
56 | +$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); |
|
57 | +$optioncss = GETPOST('optioncss', 'alpha'); |
|
58 | + |
|
59 | +$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; |
|
60 | +$sortfield = GETPOST('sortfield', 'alpha'); |
|
61 | +$sortorder = GETPOST('sortorder', 'alpha'); |
|
62 | +$page = GETPOST('page', 'int'); |
|
63 | +if (!$sortfield) $sortfield = "e.ref"; |
|
64 | +if (!$sortorder) $sortorder = "DESC"; |
|
65 | 65 | if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 |
66 | 66 | $offset = $limit * $page; |
67 | 67 | $pageprev = $page - 1; |
68 | 68 | $pagenext = $page + 1; |
69 | 69 | |
70 | -$viewstatut=GETPOST('viewstatut'); |
|
70 | +$viewstatut = GETPOST('viewstatut'); |
|
71 | 71 | |
72 | 72 | $object = new Expedition($db); |
73 | 73 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | // fetch optionals attributes and labels |
79 | 79 | $extralabels = $extrafields->fetch_name_optionals_label('expedition'); |
80 | -$search_array_options=$extrafields->getOptionalsFromPost($object->table_element,'','search_'); |
|
80 | +$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); |
|
81 | 81 | |
82 | 82 | // List of fields to search into when doing a "search in all" |
83 | 83 | $fieldstosearchall = array( |
@@ -85,10 +85,10 @@ discard block |
||
85 | 85 | 's.nom'=>"ThirdParty", |
86 | 86 | 'e.note_public'=>'NotePublic', |
87 | 87 | ); |
88 | -if (empty($user->socid)) $fieldstosearchall["e.note_private"]="NotePrivate"; |
|
88 | +if (empty($user->socid)) $fieldstosearchall["e.note_private"] = "NotePrivate"; |
|
89 | 89 | |
90 | -$checkedtypetiers=0; |
|
91 | -$arrayfields=array( |
|
90 | +$checkedtypetiers = 0; |
|
91 | +$arrayfields = array( |
|
92 | 92 | 'e.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), |
93 | 93 | 'e.ref_customer'=>array('label'=>$langs->trans("RefCustomer"), 'checked'=>1), |
94 | 94 | 's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1), |
@@ -101,17 +101,17 @@ discard block |
||
101 | 101 | 'e.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), |
102 | 102 | 'e.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), |
103 | 103 | 'e.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), |
104 | - 'l.ref'=>array('label'=>$langs->trans("DeliveryRef"), 'checked'=>1, 'enabled'=>(empty($conf->livraison_bon->enabled)?0:1)), |
|
105 | - 'l.date_delivery'=>array('label'=>$langs->trans("DateReceived"), 'checked'=>1, 'enabled'=>(empty($conf->livraison_bon->enabled)?0:1)), |
|
104 | + 'l.ref'=>array('label'=>$langs->trans("DeliveryRef"), 'checked'=>1, 'enabled'=>(empty($conf->livraison_bon->enabled) ? 0 : 1)), |
|
105 | + 'l.date_delivery'=>array('label'=>$langs->trans("DateReceived"), 'checked'=>1, 'enabled'=>(empty($conf->livraison_bon->enabled) ? 0 : 1)), |
|
106 | 106 | 'e.billed'=>array('label'=>$langs->trans("Billed"), 'checked'=>1, 'position'=>1000, 'enabled'=>(!empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) |
107 | 107 | ); |
108 | 108 | |
109 | 109 | // Extra fields |
110 | 110 | if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) |
111 | 111 | { |
112 | - foreach($extrafields->attribute_label as $key => $val) |
|
112 | + foreach ($extrafields->attribute_label as $key => $val) |
|
113 | 113 | { |
114 | - 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])); |
|
114 | + 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])); |
|
115 | 115 | } |
116 | 116 | } |
117 | 117 | |
@@ -120,46 +120,46 @@ discard block |
||
120 | 120 | * Actions |
121 | 121 | */ |
122 | 122 | |
123 | -if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; } |
|
124 | -if (! GETPOST('confirmmassaction','alpha')) { $massaction=''; } |
|
123 | +if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; } |
|
124 | +if (!GETPOST('confirmmassaction', 'alpha')) { $massaction = ''; } |
|
125 | 125 | |
126 | -$parameters=array('socid'=>$socid); |
|
127 | -$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks |
|
126 | +$parameters = array('socid'=>$socid); |
|
127 | +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
128 | 128 | if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
129 | 129 | |
130 | 130 | include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; |
131 | 131 | |
132 | 132 | // Purge search criteria |
133 | -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 |
|
133 | +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 |
|
134 | 134 | { |
135 | - $search_ref_exp=''; |
|
136 | - $search_ref_liv=''; |
|
137 | - $search_ref_customer=''; |
|
138 | - $search_company=''; |
|
139 | - $search_town=''; |
|
140 | - $search_zip=""; |
|
141 | - $search_state=""; |
|
142 | - $search_type=''; |
|
143 | - $search_country=''; |
|
144 | - $search_type_thirdparty=''; |
|
145 | - $search_billed=''; |
|
146 | - $viewstatut=''; |
|
147 | - $search_array_options=array(); |
|
135 | + $search_ref_exp = ''; |
|
136 | + $search_ref_liv = ''; |
|
137 | + $search_ref_customer = ''; |
|
138 | + $search_company = ''; |
|
139 | + $search_town = ''; |
|
140 | + $search_zip = ""; |
|
141 | + $search_state = ""; |
|
142 | + $search_type = ''; |
|
143 | + $search_country = ''; |
|
144 | + $search_type_thirdparty = ''; |
|
145 | + $search_billed = ''; |
|
146 | + $viewstatut = ''; |
|
147 | + $search_array_options = array(); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | if (empty($reshook)) |
151 | 151 | { |
152 | 152 | // Mass actions. Controls on number of lines checked |
153 | - $maxformassaction=1000; |
|
154 | - $numtoselect = (is_array($toselect)?count($toselect):0); |
|
155 | - if (! empty($massaction) && $numtoselect < 1) |
|
153 | + $maxformassaction = 1000; |
|
154 | + $numtoselect = (is_array($toselect) ?count($toselect) : 0); |
|
155 | + if (!empty($massaction) && $numtoselect < 1) |
|
156 | 156 | { |
157 | 157 | $error++; |
158 | 158 | setEventMessages($langs->trans("NoLineChecked"), null, "warnings"); |
159 | 159 | } |
160 | - if (! $error && $numtoselect > $maxformassaction) |
|
160 | + if (!$error && $numtoselect > $maxformassaction) |
|
161 | 161 | { |
162 | - setEventMessages($langs->trans('TooManyRecordForMassAction',$maxformassaction), null, 'errors'); |
|
162 | + setEventMessages($langs->trans('TooManyRecordForMassAction', $maxformassaction), null, 'errors'); |
|
163 | 163 | $error++; |
164 | 164 | } |
165 | 165 | } |
@@ -171,55 +171,55 @@ discard block |
||
171 | 171 | * View |
172 | 172 | */ |
173 | 173 | |
174 | -$form=new Form($db); |
|
175 | -$companystatic=new Societe($db); |
|
176 | -$shipment=new Expedition($db); |
|
177 | -$formcompany=new FormCompany($db); |
|
174 | +$form = new Form($db); |
|
175 | +$companystatic = new Societe($db); |
|
176 | +$shipment = new Expedition($db); |
|
177 | +$formcompany = new FormCompany($db); |
|
178 | 178 | |
179 | -$helpurl='EN:Module_Shipments|FR:Module_Expéditions|ES:Módulo_Expediciones'; |
|
180 | -llxHeader('',$langs->trans('ListOfSendings'),$helpurl); |
|
179 | +$helpurl = 'EN:Module_Shipments|FR:Module_Expéditions|ES:Módulo_Expediciones'; |
|
180 | +llxHeader('', $langs->trans('ListOfSendings'), $helpurl); |
|
181 | 181 | |
182 | 182 | $sql = "SELECT e.rowid, e.ref, e.ref_customer, e.date_expedition as date_expedition, e.date_delivery as date_livraison, l.date_delivery as date_reception, e.fk_statut, e.billed,"; |
183 | -$sql.= ' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, '; |
|
184 | -$sql.= " typent.code as typent_code,"; |
|
185 | -$sql.= " state.code_departement as state_code, state.nom as state_name,"; |
|
186 | -$sql.= ' e.date_creation as date_creation, e.tms as date_update'; |
|
183 | +$sql .= ' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, '; |
|
184 | +$sql .= " typent.code as typent_code,"; |
|
185 | +$sql .= " state.code_departement as state_code, state.nom as state_name,"; |
|
186 | +$sql .= ' e.date_creation as date_creation, e.tms as date_update'; |
|
187 | 187 | // Add fields from extrafields |
188 | -foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); |
|
188 | +foreach ($extrafields->attribute_label as $key => $val) $sql .= ($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); |
|
189 | 189 | // Add fields from hooks |
190 | -$parameters=array(); |
|
191 | -$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook |
|
192 | -$sql.=$hookmanager->resPrint; |
|
193 | -$sql.= " FROM ".MAIN_DB_PREFIX."expedition as e"; |
|
194 | -if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."expedition_extrafields as ef on (e.rowid = ef.fk_object)"; |
|
195 | -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc"; |
|
196 | -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)"; |
|
197 | -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)"; |
|
198 | -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)"; |
|
199 | -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as ee ON e.rowid = ee.fk_source AND ee.sourcetype = 'shipping' AND ee.targettype = 'delivery'"; |
|
200 | -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."livraison as l ON l.rowid = ee.fk_target"; |
|
190 | +$parameters = array(); |
|
191 | +$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook |
|
192 | +$sql .= $hookmanager->resPrint; |
|
193 | +$sql .= " FROM ".MAIN_DB_PREFIX."expedition as e"; |
|
194 | +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."expedition_extrafields as ef on (e.rowid = ef.fk_object)"; |
|
195 | +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc"; |
|
196 | +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)"; |
|
197 | +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)"; |
|
198 | +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)"; |
|
199 | +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as ee ON e.rowid = ee.fk_source AND ee.sourcetype = 'shipping' AND ee.targettype = 'delivery'"; |
|
200 | +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."livraison as l ON l.rowid = ee.fk_target"; |
|
201 | 201 | if (!$user->rights->societe->client->voir && !$socid) // Internal user with no permission to see all |
202 | 202 | { |
203 | - $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; |
|
203 | + $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; |
|
204 | 204 | } |
205 | -$sql.= " WHERE e.entity IN (".getEntity('expedition').")"; |
|
205 | +$sql .= " WHERE e.entity IN (".getEntity('expedition').")"; |
|
206 | 206 | if (!$user->rights->societe->client->voir && !$socid) // Internal user with no permission to see all |
207 | 207 | { |
208 | - $sql.= " AND e.fk_soc = sc.fk_soc"; |
|
209 | - $sql.= " AND sc.fk_user = " .$user->id; |
|
208 | + $sql .= " AND e.fk_soc = sc.fk_soc"; |
|
209 | + $sql .= " AND sc.fk_user = ".$user->id; |
|
210 | 210 | } |
211 | 211 | if ($socid) |
212 | 212 | { |
213 | - $sql.= " AND e.fk_soc = ".$socid; |
|
213 | + $sql .= " AND e.fk_soc = ".$socid; |
|
214 | 214 | } |
215 | 215 | if ($viewstatut <> '' && $viewstatut >= 0) { |
216 | - $sql.= " AND e.fk_statut = ".$viewstatut; |
|
216 | + $sql .= " AND e.fk_statut = ".$viewstatut; |
|
217 | 217 | } |
218 | -if ($search_ref_customer != '') $sql.=natural_search('e.ref_customer', $search_ref_customer); |
|
219 | -if ($search_billed != '' && $search_billed >= 0) $sql.=' AND e.billed = '.$search_billed; |
|
220 | -if ($search_town) $sql.= natural_search('s.town', $search_town); |
|
221 | -if ($search_zip) $sql.= natural_search("s.zip",$search_zip); |
|
222 | -if ($search_state) $sql.= natural_search("state.nom",$search_state); |
|
218 | +if ($search_ref_customer != '') $sql .= natural_search('e.ref_customer', $search_ref_customer); |
|
219 | +if ($search_billed != '' && $search_billed >= 0) $sql .= ' AND e.billed = '.$search_billed; |
|
220 | +if ($search_town) $sql .= natural_search('s.town', $search_town); |
|
221 | +if ($search_zip) $sql .= natural_search("s.zip", $search_zip); |
|
222 | +if ($search_state) $sql .= natural_search("state.nom", $search_state); |
|
223 | 223 | if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')'; |
224 | 224 | if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')'; |
225 | 225 | if ($search_ref_exp) $sql .= natural_search('e.ref', $search_ref_exp); |
@@ -231,11 +231,11 @@ discard block |
||
231 | 231 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; |
232 | 232 | |
233 | 233 | // Add where from hooks |
234 | -$parameters=array(); |
|
235 | -$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook |
|
236 | -$sql.=$hookmanager->resPrint; |
|
234 | +$parameters = array(); |
|
235 | +$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook |
|
236 | +$sql .= $hookmanager->resPrint; |
|
237 | 237 | |
238 | -$sql.= $db->order($sortfield,$sortorder); |
|
238 | +$sql .= $db->order($sortfield, $sortorder); |
|
239 | 239 | |
240 | 240 | $nbtotalofrecords = ''; |
241 | 241 | if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) |
@@ -249,39 +249,39 @@ discard block |
||
249 | 249 | } |
250 | 250 | } |
251 | 251 | |
252 | -$sql.= $db->plimit($limit + 1,$offset); |
|
252 | +$sql .= $db->plimit($limit + 1, $offset); |
|
253 | 253 | |
254 | 254 | //print $sql; |
255 | -$resql=$db->query($sql); |
|
255 | +$resql = $db->query($sql); |
|
256 | 256 | if ($resql) |
257 | 257 | { |
258 | 258 | $num = $db->num_rows($resql); |
259 | 259 | |
260 | 260 | $expedition = new Expedition($db); |
261 | 261 | |
262 | - $param=''; |
|
263 | - if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); |
|
264 | - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); |
|
265 | - if ($sall) $param.= "&sall=".urlencode($sall); |
|
266 | - if ($search_ref_exp) $param.= "&search_ref_exp=".urlencode($search_ref_exp); |
|
267 | - if ($search_ref_liv) $param.= "&search_ref_liv=".urlencode($search_ref_liv); |
|
268 | - if ($search_ref_customer) $param.= "&search_ref_customer=".urlencode($search_ref_customer); |
|
269 | - if ($search_company) $param.= "&search_company=".urlencode($search_company); |
|
270 | - if ($search_town) $param.= '&search_town='.urlencode($search_town); |
|
271 | - if ($search_zip) $param.= '&search_zip='.urlencode($search_zip); |
|
272 | - if ($viewstatut != '') $param.= '&viewstatut='.urlencode($viewstatut); |
|
273 | - if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); |
|
262 | + $param = ''; |
|
263 | + if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); |
|
264 | + if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); |
|
265 | + if ($sall) $param .= "&sall=".urlencode($sall); |
|
266 | + if ($search_ref_exp) $param .= "&search_ref_exp=".urlencode($search_ref_exp); |
|
267 | + if ($search_ref_liv) $param .= "&search_ref_liv=".urlencode($search_ref_liv); |
|
268 | + if ($search_ref_customer) $param .= "&search_ref_customer=".urlencode($search_ref_customer); |
|
269 | + if ($search_company) $param .= "&search_company=".urlencode($search_company); |
|
270 | + if ($search_town) $param .= '&search_town='.urlencode($search_town); |
|
271 | + if ($search_zip) $param .= '&search_zip='.urlencode($search_zip); |
|
272 | + if ($viewstatut != '') $param .= '&viewstatut='.urlencode($viewstatut); |
|
273 | + if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); |
|
274 | 274 | // Add $param from extra fields |
275 | 275 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; |
276 | 276 | |
277 | 277 | //$massactionbutton=$form->selectMassAction('', $massaction == 'presend' ? array() : array('presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge"))); |
278 | 278 | |
279 | - $newcardbutton=''; |
|
279 | + $newcardbutton = ''; |
|
280 | 280 | if ($user->rights->expedition->creer) |
281 | 281 | { |
282 | - $newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/expedition/card.php?action=create2"><span class="valignmiddle">'.$langs->trans('NewSending').'</span>'; |
|
283 | - $newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>'; |
|
284 | - $newcardbutton.= '</a>'; |
|
282 | + $newcardbutton = '<a class="butActionNew" href="'.DOL_URL_ROOT.'/expedition/card.php?action=create2"><span class="valignmiddle">'.$langs->trans('NewSending').'</span>'; |
|
283 | + $newcardbutton .= '<span class="fa fa-plus-circle valignmiddle"></span>'; |
|
284 | + $newcardbutton .= '</a>'; |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | $i = 0; |
@@ -294,92 +294,92 @@ discard block |
||
294 | 294 | print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; |
295 | 295 | print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; |
296 | 296 | |
297 | - print_barre_liste($langs->trans('ListOfSendings'), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num, $nbtotalofrecords, '', 0, $newcardbutton, '', $limit); |
|
297 | + print_barre_liste($langs->trans('ListOfSendings'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '', 0, $newcardbutton, '', $limit); |
|
298 | 298 | |
299 | 299 | if ($sall) |
300 | 300 | { |
301 | - foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); |
|
302 | - print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'</div>'; |
|
301 | + foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val); |
|
302 | + print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'</div>'; |
|
303 | 303 | } |
304 | 304 | |
305 | - $moreforfilter=''; |
|
306 | - if (! empty($moreforfilter)) |
|
305 | + $moreforfilter = ''; |
|
306 | + if (!empty($moreforfilter)) |
|
307 | 307 | { |
308 | 308 | print '<div class="liste_titre liste_titre_bydiv centpercent">'; |
309 | 309 | print $moreforfilter; |
310 | - $parameters=array('type'=>$type); |
|
311 | - $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook |
|
310 | + $parameters = array('type'=>$type); |
|
311 | + $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook |
|
312 | 312 | print $hookmanager->resPrint; |
313 | 313 | print '</div>'; |
314 | 314 | } |
315 | 315 | |
316 | - $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; |
|
317 | - $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields |
|
316 | + $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; |
|
317 | + $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields |
|
318 | 318 | |
319 | 319 | print '<div class="div-table-responsive">'; |
320 | - print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n"; |
|
320 | + print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n"; |
|
321 | 321 | |
322 | 322 | // Lignes des champs de filtre |
323 | 323 | print '<tr class="liste_titre_filter">'; |
324 | 324 | // Ref |
325 | - if (! empty($arrayfields['e.ref']['checked'])) |
|
325 | + if (!empty($arrayfields['e.ref']['checked'])) |
|
326 | 326 | { |
327 | 327 | print '<td class="liste_titre">'; |
328 | 328 | print '<input class="flat" size="6" type="text" name="search_ref_exp" value="'.$search_ref_exp.'">'; |
329 | 329 | print '</td>'; |
330 | 330 | } |
331 | 331 | // Ref customer |
332 | - if (! empty($arrayfields['e.ref_customer']['checked'])) |
|
332 | + if (!empty($arrayfields['e.ref_customer']['checked'])) |
|
333 | 333 | { |
334 | 334 | print '<td class="liste_titre">'; |
335 | 335 | print '<input class="flat" size="6" type="text" name="search_ref_customer" value="'.$search_ref_customer.'">'; |
336 | 336 | print '</td>'; |
337 | 337 | } |
338 | 338 | // Thirdparty |
339 | - if (! empty($arrayfields['s.nom']['checked'])) |
|
339 | + if (!empty($arrayfields['s.nom']['checked'])) |
|
340 | 340 | { |
341 | 341 | print '<td class="liste_titre" align="left">'; |
342 | 342 | print '<input class="flat" type="text" size="8" name="search_company" value="'.dol_escape_htmltag($search_company).'">'; |
343 | 343 | print '</td>'; |
344 | 344 | } |
345 | 345 | // Town |
346 | - if (! empty($arrayfields['s.town']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.$search_town.'"></td>'; |
|
346 | + if (!empty($arrayfields['s.town']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.$search_town.'"></td>'; |
|
347 | 347 | // Zip |
348 | - if (! empty($arrayfields['s.zip']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_zip" value="'.$search_zip.'"></td>'; |
|
348 | + if (!empty($arrayfields['s.zip']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_zip" value="'.$search_zip.'"></td>'; |
|
349 | 349 | // State |
350 | - if (! empty($arrayfields['state.nom']['checked'])) |
|
350 | + if (!empty($arrayfields['state.nom']['checked'])) |
|
351 | 351 | { |
352 | 352 | print '<td class="liste_titre">'; |
353 | 353 | print '<input class="flat" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">'; |
354 | 354 | print '</td>'; |
355 | 355 | } |
356 | 356 | // Country |
357 | - if (! empty($arrayfields['country.code_iso']['checked'])) |
|
357 | + if (!empty($arrayfields['country.code_iso']['checked'])) |
|
358 | 358 | { |
359 | 359 | print '<td class="liste_titre" align="center">'; |
360 | - print $form->select_country($search_country,'search_country','',0,'maxwidth100'); |
|
360 | + print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth100'); |
|
361 | 361 | print '</td>'; |
362 | 362 | } |
363 | 363 | // Company type |
364 | - if (! empty($arrayfields['typent.code']['checked'])) |
|
364 | + if (!empty($arrayfields['typent.code']['checked'])) |
|
365 | 365 | { |
366 | 366 | print '<td class="liste_titre maxwidthonsmartphone" align="center">'; |
367 | - 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)); |
|
367 | + 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)); |
|
368 | 368 | print '</td>'; |
369 | 369 | } |
370 | 370 | // Date delivery planned |
371 | - if (! empty($arrayfields['e.date_delivery']['checked'])) |
|
371 | + if (!empty($arrayfields['e.date_delivery']['checked'])) |
|
372 | 372 | { |
373 | 373 | print '<td class="liste_titre"> </td>'; |
374 | 374 | } |
375 | - if (! empty($arrayfields['l.ref']['checked'])) |
|
375 | + if (!empty($arrayfields['l.ref']['checked'])) |
|
376 | 376 | { |
377 | 377 | // Delivery ref |
378 | 378 | print '<td class="liste_titre">'; |
379 | 379 | print '<input class="flat" size="10" type="text" name="search_ref_liv" value="'.$search_ref_liv.'"'; |
380 | 380 | print '</td>'; |
381 | 381 | } |
382 | - if (! empty($arrayfields['l.date_delivery']['checked'])) |
|
382 | + if (!empty($arrayfields['l.date_delivery']['checked'])) |
|
383 | 383 | { |
384 | 384 | // Date received |
385 | 385 | print '<td class="liste_titre"> </td>'; |
@@ -388,30 +388,30 @@ discard block |
||
388 | 388 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; |
389 | 389 | |
390 | 390 | // Fields from hook |
391 | - $parameters=array('arrayfields'=>$arrayfields); |
|
392 | - $reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook |
|
391 | + $parameters = array('arrayfields'=>$arrayfields); |
|
392 | + $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook |
|
393 | 393 | print $hookmanager->resPrint; |
394 | 394 | // Date creation |
395 | - if (! empty($arrayfields['e.datec']['checked'])) |
|
395 | + if (!empty($arrayfields['e.datec']['checked'])) |
|
396 | 396 | { |
397 | 397 | print '<td class="liste_titre">'; |
398 | 398 | print '</td>'; |
399 | 399 | } |
400 | 400 | // Date modification |
401 | - if (! empty($arrayfields['e.tms']['checked'])) |
|
401 | + if (!empty($arrayfields['e.tms']['checked'])) |
|
402 | 402 | { |
403 | 403 | print '<td class="liste_titre">'; |
404 | 404 | print '</td>'; |
405 | 405 | } |
406 | 406 | // Status |
407 | - if (! empty($arrayfields['e.fk_statut']['checked'])) |
|
407 | + if (!empty($arrayfields['e.fk_statut']['checked'])) |
|
408 | 408 | { |
409 | 409 | print '<td class="liste_titre maxwidthonsmartphone" align="right">'; |
410 | - print $form->selectarray('viewstatut', array('0'=>$langs->trans('StatusSendingDraftShort'),'1'=>$langs->trans('StatusSendingValidatedShort'),'2'=>$langs->trans('StatusSendingProcessedShort')),$viewstatut,1); |
|
410 | + print $form->selectarray('viewstatut', array('0'=>$langs->trans('StatusSendingDraftShort'), '1'=>$langs->trans('StatusSendingValidatedShort'), '2'=>$langs->trans('StatusSendingProcessedShort')), $viewstatut, 1); |
|
411 | 411 | print '</td>'; |
412 | 412 | } |
413 | 413 | // Status billed |
414 | - if (! empty($arrayfields['e.billed']['checked'])) |
|
414 | + if (!empty($arrayfields['e.billed']['checked'])) |
|
415 | 415 | { |
416 | 416 | print '<td class="liste_titre maxwidthonsmartphone" align="center">'; |
417 | 417 | print $form->selectyesno('search_billed', $search_billed, 1, 0, 1); |
@@ -419,136 +419,136 @@ discard block |
||
419 | 419 | } |
420 | 420 | // Action column |
421 | 421 | print '<td class="liste_titre" align="middle">'; |
422 | - $searchpicto=$form->showFilterAndCheckAddButtons(0); |
|
422 | + $searchpicto = $form->showFilterAndCheckAddButtons(0); |
|
423 | 423 | print $searchpicto; |
424 | 424 | print '</td>'; |
425 | 425 | print "</tr>\n"; |
426 | 426 | |
427 | 427 | print '<tr class="liste_titre">'; |
428 | - if (! empty($arrayfields['e.ref']['checked'])) print_liste_field_titre($arrayfields['e.ref']['label'], $_SERVER["PHP_SELF"],"e.ref","",$param,'',$sortfield,$sortorder); |
|
429 | - if (! empty($arrayfields['e.ref_customer']['checked'])) print_liste_field_titre($arrayfields['e.ref_customer']['label'], $_SERVER["PHP_SELF"],"e.ref_customer","",$param,'',$sortfield,$sortorder); |
|
430 | - if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"],"s.nom", "", $param,'align="left"',$sortfield,$sortorder); |
|
431 | - if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'],$_SERVER["PHP_SELF"],'s.town','',$param,'',$sortfield,$sortorder); |
|
432 | - if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'],$_SERVER["PHP_SELF"],'s.zip','',$param,'',$sortfield,$sortorder); |
|
433 | - if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'],$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder); |
|
434 | - 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); |
|
435 | - if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'],$_SERVER["PHP_SELF"],"typent.code","",$param,'align="center"',$sortfield,$sortorder); |
|
436 | - if (! empty($arrayfields['e.date_delivery']['checked'])) print_liste_field_titre($arrayfields['e.date_delivery']['label'], $_SERVER["PHP_SELF"],"e.date_delivery","",$param, 'align="center"',$sortfield,$sortorder); |
|
437 | - if (! empty($arrayfields['l.ref']['checked'])) print_liste_field_titre($arrayfields['l.ref']['label'], $_SERVER["PHP_SELF"],"l.ref","",$param, '',$sortfield,$sortorder); |
|
438 | - if (! empty($arrayfields['l.date_delivery']['checked'])) print_liste_field_titre($arrayfields['l.date_delivery']['label'], $_SERVER["PHP_SELF"],"l.date_delivery","",$param, 'align="center"',$sortfield,$sortorder); |
|
428 | + if (!empty($arrayfields['e.ref']['checked'])) print_liste_field_titre($arrayfields['e.ref']['label'], $_SERVER["PHP_SELF"], "e.ref", "", $param, '', $sortfield, $sortorder); |
|
429 | + if (!empty($arrayfields['e.ref_customer']['checked'])) print_liste_field_titre($arrayfields['e.ref_customer']['label'], $_SERVER["PHP_SELF"], "e.ref_customer", "", $param, '', $sortfield, $sortorder); |
|
430 | + if (!empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, 'align="left"', $sortfield, $sortorder); |
|
431 | + if (!empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder); |
|
432 | + if (!empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder); |
|
433 | + if (!empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder); |
|
434 | + 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); |
|
435 | + if (!empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, 'align="center"', $sortfield, $sortorder); |
|
436 | + if (!empty($arrayfields['e.date_delivery']['checked'])) print_liste_field_titre($arrayfields['e.date_delivery']['label'], $_SERVER["PHP_SELF"], "e.date_delivery", "", $param, 'align="center"', $sortfield, $sortorder); |
|
437 | + if (!empty($arrayfields['l.ref']['checked'])) print_liste_field_titre($arrayfields['l.ref']['label'], $_SERVER["PHP_SELF"], "l.ref", "", $param, '', $sortfield, $sortorder); |
|
438 | + if (!empty($arrayfields['l.date_delivery']['checked'])) print_liste_field_titre($arrayfields['l.date_delivery']['label'], $_SERVER["PHP_SELF"], "l.date_delivery", "", $param, 'align="center"', $sortfield, $sortorder); |
|
439 | 439 | // Extra fields |
440 | 440 | if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) |
441 | 441 | { |
442 | - foreach($extrafields->attribute_label as $key => $val) |
|
442 | + foreach ($extrafields->attribute_label as $key => $val) |
|
443 | 443 | { |
444 | - if (! empty($arrayfields["ef.".$key]['checked'])) |
|
444 | + if (!empty($arrayfields["ef.".$key]['checked'])) |
|
445 | 445 | { |
446 | - $align=$extrafields->getAlignFlag($key); |
|
446 | + $align = $extrafields->getAlignFlag($key); |
|
447 | 447 | $sortonfield = "ef.".$key; |
448 | - if (! empty($extrafields->attribute_computed[$key])) $sortonfield=''; |
|
449 | - print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); |
|
448 | + if (!empty($extrafields->attribute_computed[$key])) $sortonfield = ''; |
|
449 | + print_liste_field_titre($extralabels[$key], $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align ? 'align="'.$align.'"' : ''), $sortfield, $sortorder); |
|
450 | 450 | } |
451 | 451 | } |
452 | 452 | } |
453 | 453 | // Hook fields |
454 | - $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); |
|
455 | - $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook |
|
454 | + $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); |
|
455 | + $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook |
|
456 | 456 | print $hookmanager->resPrint; |
457 | - if (! empty($arrayfields['e.datec']['checked'])) print_liste_field_titre($arrayfields['e.datec']['label'],$_SERVER["PHP_SELF"],"e.date_creation","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); |
|
458 | - if (! empty($arrayfields['e.tms']['checked'])) print_liste_field_titre($arrayfields['e.tms']['label'],$_SERVER["PHP_SELF"],"e.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); |
|
459 | - if (! empty($arrayfields['e.fk_statut']['checked'])) print_liste_field_titre($arrayfields['e.fk_statut']['label'],$_SERVER["PHP_SELF"],"e.fk_statut","",$param,'align="right"',$sortfield,$sortorder); |
|
460 | - if (! empty($arrayfields['e.billed']['checked'])) print_liste_field_titre($arrayfields['e.billed']['label'],$_SERVER["PHP_SELF"],"e.billed","",$param,'align="center"',$sortfield,$sortorder); |
|
461 | - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); |
|
457 | + if (!empty($arrayfields['e.datec']['checked'])) print_liste_field_titre($arrayfields['e.datec']['label'], $_SERVER["PHP_SELF"], "e.date_creation", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); |
|
458 | + if (!empty($arrayfields['e.tms']['checked'])) print_liste_field_titre($arrayfields['e.tms']['label'], $_SERVER["PHP_SELF"], "e.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); |
|
459 | + if (!empty($arrayfields['e.fk_statut']['checked'])) print_liste_field_titre($arrayfields['e.fk_statut']['label'], $_SERVER["PHP_SELF"], "e.fk_statut", "", $param, 'align="right"', $sortfield, $sortorder); |
|
460 | + if (!empty($arrayfields['e.billed']['checked'])) print_liste_field_titre($arrayfields['e.billed']['label'], $_SERVER["PHP_SELF"], "e.billed", "", $param, 'align="center"', $sortfield, $sortorder); |
|
461 | + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); |
|
462 | 462 | print "</tr>\n"; |
463 | 463 | |
464 | - $i=0; |
|
465 | - $totalarray=array(); |
|
466 | - while ($i < min($num,$limit)) |
|
464 | + $i = 0; |
|
465 | + $totalarray = array(); |
|
466 | + while ($i < min($num, $limit)) |
|
467 | 467 | { |
468 | 468 | $obj = $db->fetch_object($resql); |
469 | 469 | |
470 | - $shipment->id=$obj->rowid; |
|
471 | - $shipment->ref=$obj->ref; |
|
470 | + $shipment->id = $obj->rowid; |
|
471 | + $shipment->ref = $obj->ref; |
|
472 | 472 | |
473 | - $companystatic->id=$obj->socid; |
|
474 | - $companystatic->ref=$obj->name; |
|
475 | - $companystatic->name=$obj->name; |
|
473 | + $companystatic->id = $obj->socid; |
|
474 | + $companystatic->ref = $obj->name; |
|
475 | + $companystatic->name = $obj->name; |
|
476 | 476 | |
477 | 477 | |
478 | 478 | print '<tr class="oddeven">'; |
479 | 479 | |
480 | 480 | // Ref |
481 | - if (! empty($arrayfields['e.ref']['checked'])) |
|
481 | + if (!empty($arrayfields['e.ref']['checked'])) |
|
482 | 482 | { |
483 | 483 | print "<td>"; |
484 | 484 | print $shipment->getNomUrl(1); |
485 | 485 | print "</td>\n"; |
486 | - if (! $i) $totalarray['nbfield']++; |
|
486 | + if (!$i) $totalarray['nbfield']++; |
|
487 | 487 | } |
488 | 488 | |
489 | 489 | // Ref customer |
490 | - if (! empty($arrayfields['e.ref_customer']['checked'])) |
|
490 | + if (!empty($arrayfields['e.ref_customer']['checked'])) |
|
491 | 491 | { |
492 | 492 | print "<td>"; |
493 | 493 | print $obj->ref_customer; |
494 | 494 | print "</td>\n"; |
495 | - if (! $i) $totalarray['nbfield']++; |
|
495 | + if (!$i) $totalarray['nbfield']++; |
|
496 | 496 | } |
497 | 497 | |
498 | 498 | // Third party |
499 | - if (! empty($arrayfields['s.nom']['checked'])) |
|
499 | + if (!empty($arrayfields['s.nom']['checked'])) |
|
500 | 500 | { |
501 | 501 | print '<td>'; |
502 | 502 | print $companystatic->getNomUrl(1); |
503 | 503 | print '</td>'; |
504 | - if (! $i) $totalarray['nbfield']++; |
|
504 | + if (!$i) $totalarray['nbfield']++; |
|
505 | 505 | } |
506 | 506 | // Town |
507 | - if (! empty($arrayfields['s.town']['checked'])) |
|
507 | + if (!empty($arrayfields['s.town']['checked'])) |
|
508 | 508 | { |
509 | 509 | print '<td class="nocellnopadd">'; |
510 | 510 | print $obj->town; |
511 | 511 | print '</td>'; |
512 | - if (! $i) $totalarray['nbfield']++; |
|
512 | + if (!$i) $totalarray['nbfield']++; |
|
513 | 513 | } |
514 | 514 | // Zip |
515 | - if (! empty($arrayfields['s.zip']['checked'])) |
|
515 | + if (!empty($arrayfields['s.zip']['checked'])) |
|
516 | 516 | { |
517 | 517 | print '<td class="nocellnopadd">'; |
518 | 518 | print $obj->zip; |
519 | 519 | print '</td>'; |
520 | - if (! $i) $totalarray['nbfield']++; |
|
520 | + if (!$i) $totalarray['nbfield']++; |
|
521 | 521 | } |
522 | 522 | // State |
523 | - if (! empty($arrayfields['state.nom']['checked'])) |
|
523 | + if (!empty($arrayfields['state.nom']['checked'])) |
|
524 | 524 | { |
525 | 525 | print "<td>".$obj->state_name."</td>\n"; |
526 | - if (! $i) $totalarray['nbfield']++; |
|
526 | + if (!$i) $totalarray['nbfield']++; |
|
527 | 527 | } |
528 | 528 | // Country |
529 | - if (! empty($arrayfields['country.code_iso']['checked'])) |
|
529 | + if (!empty($arrayfields['country.code_iso']['checked'])) |
|
530 | 530 | { |
531 | 531 | print '<td align="center">'; |
532 | - $tmparray=getCountry($obj->fk_pays,'all'); |
|
532 | + $tmparray = getCountry($obj->fk_pays, 'all'); |
|
533 | 533 | print $tmparray['label']; |
534 | 534 | print '</td>'; |
535 | - if (! $i) $totalarray['nbfield']++; |
|
535 | + if (!$i) $totalarray['nbfield']++; |
|
536 | 536 | } |
537 | 537 | // Type ent |
538 | - if (! empty($arrayfields['typent.code']['checked'])) |
|
538 | + if (!empty($arrayfields['typent.code']['checked'])) |
|
539 | 539 | { |
540 | 540 | print '<td align="center">'; |
541 | - if (count($typenArray)==0) $typenArray = $formcompany->typent_array(1); |
|
541 | + if (count($typenArray) == 0) $typenArray = $formcompany->typent_array(1); |
|
542 | 542 | print $typenArray[$obj->typent_code]; |
543 | 543 | print '</td>'; |
544 | - if (! $i) $totalarray['nbfield']++; |
|
544 | + if (!$i) $totalarray['nbfield']++; |
|
545 | 545 | } |
546 | 546 | |
547 | 547 | // Date delivery planed |
548 | - if (! empty($arrayfields['e.date_delivery']['checked'])) |
|
548 | + if (!empty($arrayfields['e.date_delivery']['checked'])) |
|
549 | 549 | { |
550 | 550 | print '<td align="center">'; |
551 | - print dol_print_date($db->jdate($obj->date_livraison),"day"); |
|
551 | + print dol_print_date($db->jdate($obj->date_livraison), "day"); |
|
552 | 552 | /*$now = time(); |
553 | 553 | if ( ($now - $db->jdate($obj->date_expedition)) > $conf->warnings->lim && $obj->statutid == 1 ) |
554 | 554 | { |
@@ -556,13 +556,13 @@ discard block |
||
556 | 556 | print "</td>\n"; |
557 | 557 | } |
558 | 558 | |
559 | - if (! empty($arrayfields['l.ref']['checked']) || ! empty($arrayfields['l.date_delivery']['checked'])) |
|
559 | + if (!empty($arrayfields['l.ref']['checked']) || !empty($arrayfields['l.date_delivery']['checked'])) |
|
560 | 560 | { |
561 | - $shipment->fetchObjectLinked($shipment->id,$shipment->element); |
|
562 | - $receiving=''; |
|
563 | - if (is_array($shipment->linkedObjects['delivery']) && count($shipment->linkedObjects['delivery']) > 0) $receiving=reset($shipment->linkedObjects['delivery']); |
|
561 | + $shipment->fetchObjectLinked($shipment->id, $shipment->element); |
|
562 | + $receiving = ''; |
|
563 | + if (is_array($shipment->linkedObjects['delivery']) && count($shipment->linkedObjects['delivery']) > 0) $receiving = reset($shipment->linkedObjects['delivery']); |
|
564 | 564 | |
565 | - if (! empty($arrayfields['l.ref']['checked'])) |
|
565 | + if (!empty($arrayfields['l.ref']['checked'])) |
|
566 | 566 | { |
567 | 567 | // Ref |
568 | 568 | print '<td>'; |
@@ -570,11 +570,11 @@ discard block |
||
570 | 570 | print '</td>'; |
571 | 571 | } |
572 | 572 | |
573 | - if (! empty($arrayfields['l.date_delivery']['checked'])) |
|
573 | + if (!empty($arrayfields['l.date_delivery']['checked'])) |
|
574 | 574 | { |
575 | 575 | // Date received |
576 | 576 | print '<td align="center">'; |
577 | - print dol_print_date($db->jdate($obj->date_reception),"day"); |
|
577 | + print dol_print_date($db->jdate($obj->date_reception), "day"); |
|
578 | 578 | print '</td>'."\n"; |
579 | 579 | } |
580 | 580 | } |
@@ -582,41 +582,41 @@ discard block |
||
582 | 582 | // Extra fields |
583 | 583 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; |
584 | 584 | // Fields from hook |
585 | - $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); |
|
586 | - $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook |
|
585 | + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj); |
|
586 | + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook |
|
587 | 587 | print $hookmanager->resPrint; |
588 | 588 | // Date creation |
589 | - if (! empty($arrayfields['e.datec']['checked'])) |
|
589 | + if (!empty($arrayfields['e.datec']['checked'])) |
|
590 | 590 | { |
591 | 591 | print '<td align="center" class="nowrap">'; |
592 | 592 | print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); |
593 | 593 | print '</td>'; |
594 | - if (! $i) $totalarray['nbfield']++; |
|
594 | + if (!$i) $totalarray['nbfield']++; |
|
595 | 595 | } |
596 | 596 | // Date modification |
597 | - if (! empty($arrayfields['e.tms']['checked'])) |
|
597 | + if (!empty($arrayfields['e.tms']['checked'])) |
|
598 | 598 | { |
599 | 599 | print '<td align="center" class="nowrap">'; |
600 | 600 | print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); |
601 | 601 | print '</td>'; |
602 | - if (! $i) $totalarray['nbfield']++; |
|
602 | + if (!$i) $totalarray['nbfield']++; |
|
603 | 603 | } |
604 | 604 | // Status |
605 | - if (! empty($arrayfields['e.fk_statut']['checked'])) |
|
605 | + if (!empty($arrayfields['e.fk_statut']['checked'])) |
|
606 | 606 | { |
607 | - print '<td align="right" class="nowrap">'.$shipment->LibStatut($obj->fk_statut,5).'</td>'; |
|
608 | - if (! $i) $totalarray['nbfield']++; |
|
607 | + print '<td align="right" class="nowrap">'.$shipment->LibStatut($obj->fk_statut, 5).'</td>'; |
|
608 | + if (!$i) $totalarray['nbfield']++; |
|
609 | 609 | } |
610 | 610 | // Billed |
611 | - if (! empty($arrayfields['e.billed']['checked'])) |
|
611 | + if (!empty($arrayfields['e.billed']['checked'])) |
|
612 | 612 | { |
613 | 613 | print '<td align="center">'.yn($obj->billed).'</td>'; |
614 | - if (! $i) $totalarray['nbfield']++; |
|
614 | + if (!$i) $totalarray['nbfield']++; |
|
615 | 615 | } |
616 | 616 | |
617 | 617 | // Action column |
618 | 618 | print '<td></td>'; |
619 | - if (! $i) $totalarray['nbfield']++; |
|
619 | + if (!$i) $totalarray['nbfield']++; |
|
620 | 620 | |
621 | 621 | print "</tr>\n"; |
622 | 622 |