@@ -10,8 +10,8 @@ discard block |
||
10 | 10 | dol_include_once('/supplier_proposal/class/supplier_proposal.class.php'); |
11 | 11 | dol_include_once('/fourn/class/fournisseur.facture.class.php'); |
12 | 12 | |
13 | - $get=GETPOST('get'); |
|
14 | - $set=GETPOST('set'); |
|
13 | + $get = GETPOST('get'); |
|
14 | + $set = GETPOST('set'); |
|
15 | 15 | |
16 | 16 | switch ($get) { |
17 | 17 | default: |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | |
21 | 21 | switch ($set) { |
22 | 22 | case 'updateLineNC': // Gestion du Compris/Non Compris via les titres et/ou lignes |
23 | - echo json_encode( _updateLineNC(GETPOST('element'), GETPOST('elementid'), GETPOST('lineid'), GETPOST('subtotal_nc')) ); |
|
23 | + echo json_encode(_updateLineNC(GETPOST('element'), GETPOST('elementid'), GETPOST('lineid'), GETPOST('subtotal_nc'))); |
|
24 | 24 | |
25 | 25 | break; |
26 | 26 | default: |
@@ -36,68 +36,68 @@ discard block |
||
36 | 36 | class Interfacesubtotaltrigger |
37 | 37 | { |
38 | 38 | |
39 | - private $db; |
|
40 | - |
|
41 | - /** |
|
42 | - * Constructor |
|
43 | - * |
|
44 | - * @param DoliDB $db Database handler |
|
45 | - */ |
|
46 | - public function __construct($db) |
|
47 | - { |
|
48 | - $this->db = $db; |
|
49 | - |
|
50 | - $this->name = preg_replace('/^Interface/i', '', get_class($this)); |
|
51 | - $this->family = "demo"; |
|
52 | - $this->description = "Triggers of this module are empty functions." |
|
53 | - . "They have no effect." |
|
54 | - . "They are provided for tutorial purpose only."; |
|
55 | - // 'development', 'experimental', 'dolibarr' or version |
|
56 | - $this->version = 'development'; |
|
57 | - $this->picto = 'titre@titre'; |
|
58 | - } |
|
59 | - |
|
60 | - /** |
|
61 | - * Trigger name |
|
62 | - * |
|
63 | - * @return string Name of trigger file |
|
64 | - */ |
|
65 | - public function getName() |
|
66 | - { |
|
67 | - return $this->name; |
|
68 | - } |
|
69 | - |
|
70 | - /** |
|
71 | - * Trigger description |
|
72 | - * |
|
73 | - * @return string Description of trigger file |
|
74 | - */ |
|
75 | - public function getDesc() |
|
76 | - { |
|
77 | - return $this->description; |
|
78 | - } |
|
79 | - |
|
80 | - /** |
|
81 | - * Trigger version |
|
82 | - * |
|
83 | - * @return string Version of trigger file |
|
84 | - */ |
|
85 | - public function getVersion() |
|
86 | - { |
|
87 | - global $langs; |
|
88 | - $langs->load("admin"); |
|
89 | - |
|
90 | - if ($this->version == 'development') { |
|
91 | - return $langs->trans("Development"); |
|
92 | - } elseif ($this->version == 'experimental') |
|
93 | - |
|
94 | - return $langs->trans("Experimental"); |
|
95 | - elseif ($this->version == 'dolibarr') return DOL_VERSION; |
|
96 | - elseif ($this->version) return $this->version; |
|
97 | - else { |
|
98 | - return $langs->trans("Unknown"); |
|
99 | - } |
|
100 | - } |
|
39 | + private $db; |
|
40 | + |
|
41 | + /** |
|
42 | + * Constructor |
|
43 | + * |
|
44 | + * @param DoliDB $db Database handler |
|
45 | + */ |
|
46 | + public function __construct($db) |
|
47 | + { |
|
48 | + $this->db = $db; |
|
49 | + |
|
50 | + $this->name = preg_replace('/^Interface/i', '', get_class($this)); |
|
51 | + $this->family = "demo"; |
|
52 | + $this->description = "Triggers of this module are empty functions." |
|
53 | + . "They have no effect." |
|
54 | + . "They are provided for tutorial purpose only."; |
|
55 | + // 'development', 'experimental', 'dolibarr' or version |
|
56 | + $this->version = 'development'; |
|
57 | + $this->picto = 'titre@titre'; |
|
58 | + } |
|
59 | + |
|
60 | + /** |
|
61 | + * Trigger name |
|
62 | + * |
|
63 | + * @return string Name of trigger file |
|
64 | + */ |
|
65 | + public function getName() |
|
66 | + { |
|
67 | + return $this->name; |
|
68 | + } |
|
69 | + |
|
70 | + /** |
|
71 | + * Trigger description |
|
72 | + * |
|
73 | + * @return string Description of trigger file |
|
74 | + */ |
|
75 | + public function getDesc() |
|
76 | + { |
|
77 | + return $this->description; |
|
78 | + } |
|
79 | + |
|
80 | + /** |
|
81 | + * Trigger version |
|
82 | + * |
|
83 | + * @return string Version of trigger file |
|
84 | + */ |
|
85 | + public function getVersion() |
|
86 | + { |
|
87 | + global $langs; |
|
88 | + $langs->load("admin"); |
|
89 | + |
|
90 | + if ($this->version == 'development') { |
|
91 | + return $langs->trans("Development"); |
|
92 | + } elseif ($this->version == 'experimental') |
|
93 | + |
|
94 | + return $langs->trans("Experimental"); |
|
95 | + elseif ($this->version == 'dolibarr') return DOL_VERSION; |
|
96 | + elseif ($this->version) return $this->version; |
|
97 | + else { |
|
98 | + return $langs->trans("Unknown"); |
|
99 | + } |
|
100 | + } |
|
101 | 101 | |
102 | 102 | public function addToBegin(&$parent, &$object, $rang) |
103 | 103 | { |
@@ -147,27 +147,27 @@ discard block |
||
147 | 147 | } |
148 | 148 | } |
149 | 149 | |
150 | - /** |
|
151 | - * Function called when a Dolibarrr business event is done. |
|
152 | - * All functions "run_trigger" are triggered if file |
|
153 | - * is inside directory core/triggers |
|
154 | - * |
|
155 | - * @param string $action Event action code |
|
156 | - * @param Object $object Object |
|
157 | - * @param User $user Object user |
|
158 | - * @param Translate $langs Object langs |
|
159 | - * @param conf $conf Object conf |
|
160 | - * @return int <0 if KO, 0 if no triggered ran, >0 if OK |
|
161 | - */ |
|
162 | - public function run_trigger($action, $object, $user, $langs, $conf) |
|
163 | - { |
|
164 | - // Put here code you want to execute when a Dolibarr business events occurs. |
|
165 | - // Data and type of action are stored into $object and $action |
|
166 | - // Users |
|
167 | - dol_include_once('/subtotal/class/subtotal.class.php'); |
|
168 | - $langs->load('subtotal@subtotal'); |
|
150 | + /** |
|
151 | + * Function called when a Dolibarrr business event is done. |
|
152 | + * All functions "run_trigger" are triggered if file |
|
153 | + * is inside directory core/triggers |
|
154 | + * |
|
155 | + * @param string $action Event action code |
|
156 | + * @param Object $object Object |
|
157 | + * @param User $user Object user |
|
158 | + * @param Translate $langs Object langs |
|
159 | + * @param conf $conf Object conf |
|
160 | + * @return int <0 if KO, 0 if no triggered ran, >0 if OK |
|
161 | + */ |
|
162 | + public function run_trigger($action, $object, $user, $langs, $conf) |
|
163 | + { |
|
164 | + // Put here code you want to execute when a Dolibarr business events occurs. |
|
165 | + // Data and type of action are stored into $object and $action |
|
166 | + // Users |
|
167 | + dol_include_once('/subtotal/class/subtotal.class.php'); |
|
168 | + $langs->load('subtotal@subtotal'); |
|
169 | 169 | |
170 | - if (!empty($conf->global->SUBTOTAL_ALLOW_ADD_LINE_UNDER_TITLE) && in_array($action, array('LINEPROPAL_INSERT', 'LINEORDER_INSERT', 'LINEBILL_INSERT'))) |
|
170 | + if (!empty($conf->global->SUBTOTAL_ALLOW_ADD_LINE_UNDER_TITLE) && in_array($action, array('LINEPROPAL_INSERT', 'LINEORDER_INSERT', 'LINEBILL_INSERT'))) |
|
171 | 171 | { |
172 | 172 | |
173 | 173 | $rang = GETPOST('under_title', 'int'); // Rang du titre |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | } |
200 | 200 | |
201 | 201 | |
202 | - if ($action == 'LINEBILL_INSERT' && $object->special_code != TSubtotal::$module_number) |
|
202 | + if ($action == 'LINEBILL_INSERT' && $object->special_code != TSubtotal::$module_number) |
|
203 | 203 | { |
204 | 204 | $subtotal_add_title_bloc_from_orderstoinvoice = GETPOST('subtotal_add_title_bloc_from_orderstoinvoice'); |
205 | 205 | if (!empty($subtotal_add_title_bloc_from_orderstoinvoice)) |
@@ -307,173 +307,173 @@ discard block |
||
307 | 307 | } |
308 | 308 | |
309 | 309 | |
310 | - if ($action == 'USER_LOGIN') { |
|
311 | - dol_syslog( |
|
312 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
313 | - ); |
|
314 | - } elseif ($action == 'USER_UPDATE_SESSION') { |
|
315 | - // Warning: To increase performances, this action is triggered only if |
|
316 | - // constant MAIN_ACTIVATE_UPDATESESSIONTRIGGER is set to 1. |
|
317 | - dol_syslog( |
|
318 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
319 | - ); |
|
320 | - } elseif ($action == 'USER_CREATE') { |
|
321 | - dol_syslog( |
|
322 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
323 | - ); |
|
324 | - } elseif ($action == 'USER_CREATE_FROM_CONTACT') { |
|
325 | - dol_syslog( |
|
326 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
327 | - ); |
|
328 | - } elseif ($action == 'USER_MODIFY') { |
|
329 | - dol_syslog( |
|
330 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
331 | - ); |
|
332 | - } elseif ($action == 'USER_NEW_PASSWORD') { |
|
333 | - dol_syslog( |
|
334 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
335 | - ); |
|
336 | - } elseif ($action == 'USER_ENABLEDISABLE') { |
|
337 | - dol_syslog( |
|
338 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
339 | - ); |
|
340 | - } elseif ($action == 'USER_DELETE') { |
|
341 | - dol_syslog( |
|
342 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
343 | - ); |
|
344 | - } elseif ($action == 'USER_LOGOUT') { |
|
345 | - dol_syslog( |
|
346 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
347 | - ); |
|
348 | - } elseif ($action == 'USER_SETINGROUP') { |
|
349 | - dol_syslog( |
|
350 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
351 | - ); |
|
352 | - } elseif ($action == 'USER_REMOVEFROMGROUP') { |
|
353 | - dol_syslog( |
|
354 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
355 | - ); |
|
356 | - } |
|
357 | - |
|
358 | - // Groups |
|
359 | - elseif ($action == 'GROUP_CREATE') { |
|
360 | - dol_syslog( |
|
361 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
362 | - ); |
|
363 | - } elseif ($action == 'GROUP_MODIFY') { |
|
364 | - dol_syslog( |
|
365 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
366 | - ); |
|
367 | - } elseif ($action == 'GROUP_DELETE') { |
|
368 | - dol_syslog( |
|
369 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
370 | - ); |
|
371 | - } |
|
372 | - |
|
373 | - // Companies |
|
374 | - elseif ($action == 'COMPANY_CREATE') { |
|
375 | - dol_syslog( |
|
376 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
377 | - ); |
|
378 | - } elseif ($action == 'COMPANY_MODIFY') { |
|
379 | - dol_syslog( |
|
380 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
381 | - ); |
|
382 | - } elseif ($action == 'COMPANY_DELETE') { |
|
383 | - dol_syslog( |
|
384 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
385 | - ); |
|
386 | - } |
|
387 | - |
|
388 | - // Contacts |
|
389 | - elseif ($action == 'CONTACT_CREATE') { |
|
390 | - dol_syslog( |
|
391 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
392 | - ); |
|
393 | - } elseif ($action == 'CONTACT_MODIFY') { |
|
394 | - dol_syslog( |
|
395 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
396 | - ); |
|
397 | - } elseif ($action == 'CONTACT_DELETE') { |
|
398 | - dol_syslog( |
|
399 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
400 | - ); |
|
401 | - } |
|
402 | - |
|
403 | - // Products |
|
404 | - elseif ($action == 'PRODUCT_CREATE') { |
|
405 | - dol_syslog( |
|
406 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
407 | - ); |
|
408 | - } elseif ($action == 'PRODUCT_MODIFY') { |
|
409 | - dol_syslog( |
|
410 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
411 | - ); |
|
412 | - } elseif ($action == 'PRODUCT_DELETE') { |
|
413 | - dol_syslog( |
|
414 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
415 | - ); |
|
416 | - } |
|
417 | - |
|
418 | - // Customer orders |
|
419 | - elseif ($action == 'ORDER_CREATE') { |
|
420 | - dol_syslog( |
|
421 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
422 | - ); |
|
423 | - } elseif ($action == 'ORDER_VALIDATE') { |
|
424 | - dol_syslog( |
|
425 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
426 | - ); |
|
427 | - } elseif ($action == 'ORDER_DELETE') { |
|
428 | - dol_syslog( |
|
429 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
430 | - ); |
|
431 | - } elseif ($action == 'ORDER_BUILDDOC') { |
|
432 | - dol_syslog( |
|
433 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
434 | - ); |
|
435 | - } elseif ($action == 'ORDER_SENTBYMAIL') { |
|
436 | - dol_syslog( |
|
437 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
438 | - ); |
|
439 | - } elseif ($action == 'LINEORDER_INSERT') { |
|
440 | - dol_syslog( |
|
441 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
442 | - ); |
|
443 | - } elseif ($action == 'LINEORDER_DELETE') { |
|
444 | - dol_syslog( |
|
445 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
446 | - ); |
|
447 | - } |
|
448 | - |
|
449 | - // Supplier orders |
|
450 | - elseif ($action == 'ORDER_SUPPLIER_CREATE') { |
|
451 | - dol_syslog( |
|
452 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
453 | - ); |
|
454 | - } elseif ($action == 'ORDER_SUPPLIER_VALIDATE') { |
|
455 | - dol_syslog( |
|
456 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
457 | - ); |
|
458 | - } elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') { |
|
459 | - dol_syslog( |
|
460 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
461 | - ); |
|
462 | - } elseif ($action == 'SUPPLIER_ORDER_BUILDDOC') { |
|
463 | - dol_syslog( |
|
464 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
465 | - ); |
|
466 | - } |
|
467 | - |
|
468 | - // Proposals |
|
469 | - elseif ($action == 'PROPAL_CREATE') { |
|
470 | - dol_syslog( |
|
471 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
472 | - ); |
|
473 | - } elseif (in_array($action, array('PROPAL_CLONE', 'ORDER_CLONE', 'BILL_CLONE'))) { |
|
474 | - dol_syslog( |
|
475 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
476 | - ); |
|
310 | + if ($action == 'USER_LOGIN') { |
|
311 | + dol_syslog( |
|
312 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
313 | + ); |
|
314 | + } elseif ($action == 'USER_UPDATE_SESSION') { |
|
315 | + // Warning: To increase performances, this action is triggered only if |
|
316 | + // constant MAIN_ACTIVATE_UPDATESESSIONTRIGGER is set to 1. |
|
317 | + dol_syslog( |
|
318 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
319 | + ); |
|
320 | + } elseif ($action == 'USER_CREATE') { |
|
321 | + dol_syslog( |
|
322 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
323 | + ); |
|
324 | + } elseif ($action == 'USER_CREATE_FROM_CONTACT') { |
|
325 | + dol_syslog( |
|
326 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
327 | + ); |
|
328 | + } elseif ($action == 'USER_MODIFY') { |
|
329 | + dol_syslog( |
|
330 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
331 | + ); |
|
332 | + } elseif ($action == 'USER_NEW_PASSWORD') { |
|
333 | + dol_syslog( |
|
334 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
335 | + ); |
|
336 | + } elseif ($action == 'USER_ENABLEDISABLE') { |
|
337 | + dol_syslog( |
|
338 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
339 | + ); |
|
340 | + } elseif ($action == 'USER_DELETE') { |
|
341 | + dol_syslog( |
|
342 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
343 | + ); |
|
344 | + } elseif ($action == 'USER_LOGOUT') { |
|
345 | + dol_syslog( |
|
346 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
347 | + ); |
|
348 | + } elseif ($action == 'USER_SETINGROUP') { |
|
349 | + dol_syslog( |
|
350 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
351 | + ); |
|
352 | + } elseif ($action == 'USER_REMOVEFROMGROUP') { |
|
353 | + dol_syslog( |
|
354 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
355 | + ); |
|
356 | + } |
|
357 | + |
|
358 | + // Groups |
|
359 | + elseif ($action == 'GROUP_CREATE') { |
|
360 | + dol_syslog( |
|
361 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
362 | + ); |
|
363 | + } elseif ($action == 'GROUP_MODIFY') { |
|
364 | + dol_syslog( |
|
365 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
366 | + ); |
|
367 | + } elseif ($action == 'GROUP_DELETE') { |
|
368 | + dol_syslog( |
|
369 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
370 | + ); |
|
371 | + } |
|
372 | + |
|
373 | + // Companies |
|
374 | + elseif ($action == 'COMPANY_CREATE') { |
|
375 | + dol_syslog( |
|
376 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
377 | + ); |
|
378 | + } elseif ($action == 'COMPANY_MODIFY') { |
|
379 | + dol_syslog( |
|
380 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
381 | + ); |
|
382 | + } elseif ($action == 'COMPANY_DELETE') { |
|
383 | + dol_syslog( |
|
384 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
385 | + ); |
|
386 | + } |
|
387 | + |
|
388 | + // Contacts |
|
389 | + elseif ($action == 'CONTACT_CREATE') { |
|
390 | + dol_syslog( |
|
391 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
392 | + ); |
|
393 | + } elseif ($action == 'CONTACT_MODIFY') { |
|
394 | + dol_syslog( |
|
395 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
396 | + ); |
|
397 | + } elseif ($action == 'CONTACT_DELETE') { |
|
398 | + dol_syslog( |
|
399 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
400 | + ); |
|
401 | + } |
|
402 | + |
|
403 | + // Products |
|
404 | + elseif ($action == 'PRODUCT_CREATE') { |
|
405 | + dol_syslog( |
|
406 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
407 | + ); |
|
408 | + } elseif ($action == 'PRODUCT_MODIFY') { |
|
409 | + dol_syslog( |
|
410 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
411 | + ); |
|
412 | + } elseif ($action == 'PRODUCT_DELETE') { |
|
413 | + dol_syslog( |
|
414 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
415 | + ); |
|
416 | + } |
|
417 | + |
|
418 | + // Customer orders |
|
419 | + elseif ($action == 'ORDER_CREATE') { |
|
420 | + dol_syslog( |
|
421 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
422 | + ); |
|
423 | + } elseif ($action == 'ORDER_VALIDATE') { |
|
424 | + dol_syslog( |
|
425 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
426 | + ); |
|
427 | + } elseif ($action == 'ORDER_DELETE') { |
|
428 | + dol_syslog( |
|
429 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
430 | + ); |
|
431 | + } elseif ($action == 'ORDER_BUILDDOC') { |
|
432 | + dol_syslog( |
|
433 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
434 | + ); |
|
435 | + } elseif ($action == 'ORDER_SENTBYMAIL') { |
|
436 | + dol_syslog( |
|
437 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
438 | + ); |
|
439 | + } elseif ($action == 'LINEORDER_INSERT') { |
|
440 | + dol_syslog( |
|
441 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
442 | + ); |
|
443 | + } elseif ($action == 'LINEORDER_DELETE') { |
|
444 | + dol_syslog( |
|
445 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
446 | + ); |
|
447 | + } |
|
448 | + |
|
449 | + // Supplier orders |
|
450 | + elseif ($action == 'ORDER_SUPPLIER_CREATE') { |
|
451 | + dol_syslog( |
|
452 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
453 | + ); |
|
454 | + } elseif ($action == 'ORDER_SUPPLIER_VALIDATE') { |
|
455 | + dol_syslog( |
|
456 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
457 | + ); |
|
458 | + } elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') { |
|
459 | + dol_syslog( |
|
460 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
461 | + ); |
|
462 | + } elseif ($action == 'SUPPLIER_ORDER_BUILDDOC') { |
|
463 | + dol_syslog( |
|
464 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
465 | + ); |
|
466 | + } |
|
467 | + |
|
468 | + // Proposals |
|
469 | + elseif ($action == 'PROPAL_CREATE') { |
|
470 | + dol_syslog( |
|
471 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
472 | + ); |
|
473 | + } elseif (in_array($action, array('PROPAL_CLONE', 'ORDER_CLONE', 'BILL_CLONE'))) { |
|
474 | + dol_syslog( |
|
475 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
476 | + ); |
|
477 | 477 | |
478 | 478 | $doli_action = GETPOST('action'); |
479 | 479 | |
@@ -506,277 +506,277 @@ discard block |
||
506 | 506 | if (!empty($line)) $object->update_price(1); |
507 | 507 | } |
508 | 508 | |
509 | - } elseif ($action == 'PROPAL_MODIFY') { |
|
510 | - dol_syslog( |
|
511 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
512 | - ); |
|
513 | - } elseif ($action == 'PROPAL_VALIDATE') { |
|
514 | - dol_syslog( |
|
515 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
516 | - ); |
|
517 | - } elseif ($action == 'PROPAL_BUILDDOC') { |
|
518 | - dol_syslog( |
|
519 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
520 | - ); |
|
521 | - } elseif ($action == 'PROPAL_SENTBYMAIL') { |
|
522 | - dol_syslog( |
|
523 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
524 | - ); |
|
525 | - } elseif ($action == 'PROPAL_CLOSE_SIGNED') { |
|
526 | - dol_syslog( |
|
527 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
528 | - ); |
|
529 | - } elseif ($action == 'PROPAL_CLOSE_REFUSED') { |
|
530 | - dol_syslog( |
|
531 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
532 | - ); |
|
533 | - } elseif ($action == 'PROPAL_DELETE') { |
|
534 | - dol_syslog( |
|
535 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
536 | - ); |
|
537 | - } elseif ($action == 'LINEPROPAL_INSERT') { |
|
538 | - dol_syslog( |
|
539 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
540 | - ); |
|
541 | - } elseif ($action == 'LINEPROPAL_MODIFY') { |
|
542 | - dol_syslog( |
|
543 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
544 | - ); |
|
545 | - } elseif ($action == 'LINEPROPAL_DELETE') { |
|
546 | - dol_syslog( |
|
547 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
548 | - ); |
|
549 | - } |
|
550 | - |
|
551 | - // Contracts |
|
552 | - elseif ($action == 'CONTRACT_CREATE') { |
|
553 | - dol_syslog( |
|
554 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
555 | - ); |
|
556 | - } elseif ($action == 'CONTRACT_MODIFY') { |
|
557 | - dol_syslog( |
|
558 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
559 | - ); |
|
560 | - } elseif ($action == 'CONTRACT_ACTIVATE') { |
|
561 | - dol_syslog( |
|
562 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
563 | - ); |
|
564 | - } elseif ($action == 'CONTRACT_CANCEL') { |
|
565 | - dol_syslog( |
|
566 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
567 | - ); |
|
568 | - } elseif ($action == 'CONTRACT_CLOSE') { |
|
569 | - dol_syslog( |
|
570 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
571 | - ); |
|
572 | - } elseif ($action == 'CONTRACT_DELETE') { |
|
573 | - dol_syslog( |
|
574 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
575 | - ); |
|
576 | - } |
|
509 | + } elseif ($action == 'PROPAL_MODIFY') { |
|
510 | + dol_syslog( |
|
511 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
512 | + ); |
|
513 | + } elseif ($action == 'PROPAL_VALIDATE') { |
|
514 | + dol_syslog( |
|
515 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
516 | + ); |
|
517 | + } elseif ($action == 'PROPAL_BUILDDOC') { |
|
518 | + dol_syslog( |
|
519 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
520 | + ); |
|
521 | + } elseif ($action == 'PROPAL_SENTBYMAIL') { |
|
522 | + dol_syslog( |
|
523 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
524 | + ); |
|
525 | + } elseif ($action == 'PROPAL_CLOSE_SIGNED') { |
|
526 | + dol_syslog( |
|
527 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
528 | + ); |
|
529 | + } elseif ($action == 'PROPAL_CLOSE_REFUSED') { |
|
530 | + dol_syslog( |
|
531 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
532 | + ); |
|
533 | + } elseif ($action == 'PROPAL_DELETE') { |
|
534 | + dol_syslog( |
|
535 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
536 | + ); |
|
537 | + } elseif ($action == 'LINEPROPAL_INSERT') { |
|
538 | + dol_syslog( |
|
539 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
540 | + ); |
|
541 | + } elseif ($action == 'LINEPROPAL_MODIFY') { |
|
542 | + dol_syslog( |
|
543 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
544 | + ); |
|
545 | + } elseif ($action == 'LINEPROPAL_DELETE') { |
|
546 | + dol_syslog( |
|
547 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
548 | + ); |
|
549 | + } |
|
550 | + |
|
551 | + // Contracts |
|
552 | + elseif ($action == 'CONTRACT_CREATE') { |
|
553 | + dol_syslog( |
|
554 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
555 | + ); |
|
556 | + } elseif ($action == 'CONTRACT_MODIFY') { |
|
557 | + dol_syslog( |
|
558 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
559 | + ); |
|
560 | + } elseif ($action == 'CONTRACT_ACTIVATE') { |
|
561 | + dol_syslog( |
|
562 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
563 | + ); |
|
564 | + } elseif ($action == 'CONTRACT_CANCEL') { |
|
565 | + dol_syslog( |
|
566 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
567 | + ); |
|
568 | + } elseif ($action == 'CONTRACT_CLOSE') { |
|
569 | + dol_syslog( |
|
570 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
571 | + ); |
|
572 | + } elseif ($action == 'CONTRACT_DELETE') { |
|
573 | + dol_syslog( |
|
574 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
575 | + ); |
|
576 | + } |
|
577 | 577 | |
578 | 578 | elseif ($action == 'BILL_MODIFY') { |
579 | - dol_syslog( |
|
580 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
581 | - ); |
|
582 | - } elseif ($action == 'BILL_VALIDATE') { |
|
583 | - dol_syslog( |
|
584 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
585 | - ); |
|
586 | - } elseif ($action == 'BILL_BUILDDOC') { |
|
587 | - dol_syslog( |
|
588 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
589 | - ); |
|
590 | - } elseif ($action == 'BILL_SENTBYMAIL') { |
|
591 | - dol_syslog( |
|
592 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
593 | - ); |
|
594 | - } elseif ($action == 'BILL_CANCEL') { |
|
595 | - dol_syslog( |
|
596 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
597 | - ); |
|
598 | - } elseif ($action == 'BILL_DELETE') { |
|
599 | - dol_syslog( |
|
600 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
601 | - ); |
|
602 | - } elseif ($action == 'LINEBILL_INSERT') { |
|
579 | + dol_syslog( |
|
580 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
581 | + ); |
|
582 | + } elseif ($action == 'BILL_VALIDATE') { |
|
583 | + dol_syslog( |
|
584 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
585 | + ); |
|
586 | + } elseif ($action == 'BILL_BUILDDOC') { |
|
587 | + dol_syslog( |
|
588 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
589 | + ); |
|
590 | + } elseif ($action == 'BILL_SENTBYMAIL') { |
|
591 | + dol_syslog( |
|
592 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
593 | + ); |
|
594 | + } elseif ($action == 'BILL_CANCEL') { |
|
595 | + dol_syslog( |
|
596 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
597 | + ); |
|
598 | + } elseif ($action == 'BILL_DELETE') { |
|
599 | + dol_syslog( |
|
600 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
601 | + ); |
|
602 | + } elseif ($action == 'LINEBILL_INSERT') { |
|
603 | 603 | |
604 | - dol_syslog( |
|
605 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
606 | - ); |
|
607 | - } elseif ($action == 'LINEBILL_DELETE') { |
|
608 | - dol_syslog( |
|
609 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
610 | - ); |
|
611 | - } |
|
612 | - |
|
613 | - // Payments |
|
614 | - elseif ($action == 'PAYMENT_CUSTOMER_CREATE') { |
|
615 | - dol_syslog( |
|
616 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
617 | - ); |
|
618 | - } elseif ($action == 'PAYMENT_SUPPLIER_CREATE') { |
|
619 | - dol_syslog( |
|
620 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
621 | - ); |
|
622 | - } elseif ($action == 'PAYMENT_ADD_TO_BANK') { |
|
623 | - dol_syslog( |
|
624 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
625 | - ); |
|
626 | - } elseif ($action == 'PAYMENT_DELETE') { |
|
627 | - dol_syslog( |
|
628 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
629 | - ); |
|
630 | - } |
|
631 | - |
|
632 | - // Interventions |
|
633 | - elseif ($action == 'FICHEINTER_CREATE') { |
|
634 | - dol_syslog( |
|
635 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
636 | - ); |
|
637 | - } elseif ($action == 'FICHEINTER_MODIFY') { |
|
638 | - dol_syslog( |
|
639 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
640 | - ); |
|
641 | - } elseif ($action == 'FICHEINTER_VALIDATE') { |
|
642 | - dol_syslog( |
|
643 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
644 | - ); |
|
645 | - } elseif ($action == 'FICHEINTER_DELETE') { |
|
646 | - dol_syslog( |
|
647 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
648 | - ); |
|
649 | - } |
|
650 | - |
|
651 | - // Members |
|
652 | - elseif ($action == 'MEMBER_CREATE') { |
|
653 | - dol_syslog( |
|
654 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
655 | - ); |
|
656 | - } elseif ($action == 'MEMBER_VALIDATE') { |
|
657 | - dol_syslog( |
|
658 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
659 | - ); |
|
660 | - } elseif ($action == 'MEMBER_SUBSCRIPTION') { |
|
661 | - dol_syslog( |
|
662 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
663 | - ); |
|
664 | - } elseif ($action == 'MEMBER_MODIFY') { |
|
665 | - dol_syslog( |
|
666 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
667 | - ); |
|
668 | - } elseif ($action == 'MEMBER_NEW_PASSWORD') { |
|
669 | - dol_syslog( |
|
670 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
671 | - ); |
|
672 | - } elseif ($action == 'MEMBER_RESILIATE') { |
|
673 | - dol_syslog( |
|
674 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
675 | - ); |
|
676 | - } elseif ($action == 'MEMBER_DELETE') { |
|
677 | - dol_syslog( |
|
678 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
679 | - ); |
|
680 | - } |
|
681 | - |
|
682 | - // Categories |
|
683 | - elseif ($action == 'CATEGORY_CREATE') { |
|
684 | - dol_syslog( |
|
685 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
686 | - ); |
|
687 | - } elseif ($action == 'CATEGORY_MODIFY') { |
|
688 | - dol_syslog( |
|
689 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
690 | - ); |
|
691 | - } elseif ($action == 'CATEGORY_DELETE') { |
|
692 | - dol_syslog( |
|
693 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
694 | - ); |
|
695 | - } |
|
696 | - |
|
697 | - // Projects |
|
698 | - elseif ($action == 'PROJECT_CREATE') { |
|
699 | - dol_syslog( |
|
700 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
701 | - ); |
|
702 | - } elseif ($action == 'PROJECT_MODIFY') { |
|
703 | - dol_syslog( |
|
704 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
705 | - ); |
|
706 | - } elseif ($action == 'PROJECT_DELETE') { |
|
707 | - dol_syslog( |
|
708 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
709 | - ); |
|
710 | - } |
|
711 | - |
|
712 | - // Project tasks |
|
713 | - elseif ($action == 'TASK_CREATE') { |
|
714 | - dol_syslog( |
|
715 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
716 | - ); |
|
717 | - } elseif ($action == 'TASK_MODIFY') { |
|
718 | - dol_syslog( |
|
719 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
720 | - ); |
|
721 | - } elseif ($action == 'TASK_DELETE') { |
|
722 | - dol_syslog( |
|
723 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
724 | - ); |
|
725 | - } |
|
726 | - |
|
727 | - // Task time spent |
|
728 | - elseif ($action == 'TASK_TIMESPENT_CREATE') { |
|
729 | - dol_syslog( |
|
730 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
731 | - ); |
|
732 | - } elseif ($action == 'TASK_TIMESPENT_MODIFY') { |
|
733 | - dol_syslog( |
|
734 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
735 | - ); |
|
736 | - } elseif ($action == 'TASK_TIMESPENT_DELETE') { |
|
737 | - dol_syslog( |
|
738 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
739 | - ); |
|
740 | - } |
|
741 | - |
|
742 | - // Shipping |
|
743 | - elseif ($action == 'SHIPPING_CREATE') { |
|
744 | - dol_syslog( |
|
745 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
746 | - ); |
|
747 | - } elseif ($action == 'SHIPPING_MODIFY') { |
|
748 | - dol_syslog( |
|
749 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
750 | - ); |
|
751 | - } elseif ($action == 'SHIPPING_VALIDATE') { |
|
752 | - dol_syslog( |
|
753 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
754 | - ); |
|
755 | - } elseif ($action == 'SHIPPING_SENTBYMAIL') { |
|
756 | - dol_syslog( |
|
757 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
758 | - ); |
|
759 | - } elseif ($action == 'SHIPPING_DELETE') { |
|
760 | - dol_syslog( |
|
761 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
762 | - ); |
|
763 | - } elseif ($action == 'SHIPPING_BUILDDOC') { |
|
764 | - dol_syslog( |
|
765 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
766 | - ); |
|
767 | - } |
|
768 | - |
|
769 | - // File |
|
770 | - elseif ($action == 'FILE_UPLOAD') { |
|
771 | - dol_syslog( |
|
772 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
773 | - ); |
|
774 | - } elseif ($action == 'FILE_DELETE') { |
|
775 | - dol_syslog( |
|
776 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
777 | - ); |
|
778 | - } |
|
779 | - |
|
780 | - return 0; |
|
781 | - } |
|
604 | + dol_syslog( |
|
605 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
606 | + ); |
|
607 | + } elseif ($action == 'LINEBILL_DELETE') { |
|
608 | + dol_syslog( |
|
609 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
610 | + ); |
|
611 | + } |
|
612 | + |
|
613 | + // Payments |
|
614 | + elseif ($action == 'PAYMENT_CUSTOMER_CREATE') { |
|
615 | + dol_syslog( |
|
616 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
617 | + ); |
|
618 | + } elseif ($action == 'PAYMENT_SUPPLIER_CREATE') { |
|
619 | + dol_syslog( |
|
620 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
621 | + ); |
|
622 | + } elseif ($action == 'PAYMENT_ADD_TO_BANK') { |
|
623 | + dol_syslog( |
|
624 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
625 | + ); |
|
626 | + } elseif ($action == 'PAYMENT_DELETE') { |
|
627 | + dol_syslog( |
|
628 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
629 | + ); |
|
630 | + } |
|
631 | + |
|
632 | + // Interventions |
|
633 | + elseif ($action == 'FICHEINTER_CREATE') { |
|
634 | + dol_syslog( |
|
635 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
636 | + ); |
|
637 | + } elseif ($action == 'FICHEINTER_MODIFY') { |
|
638 | + dol_syslog( |
|
639 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
640 | + ); |
|
641 | + } elseif ($action == 'FICHEINTER_VALIDATE') { |
|
642 | + dol_syslog( |
|
643 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
644 | + ); |
|
645 | + } elseif ($action == 'FICHEINTER_DELETE') { |
|
646 | + dol_syslog( |
|
647 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
648 | + ); |
|
649 | + } |
|
650 | + |
|
651 | + // Members |
|
652 | + elseif ($action == 'MEMBER_CREATE') { |
|
653 | + dol_syslog( |
|
654 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
655 | + ); |
|
656 | + } elseif ($action == 'MEMBER_VALIDATE') { |
|
657 | + dol_syslog( |
|
658 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
659 | + ); |
|
660 | + } elseif ($action == 'MEMBER_SUBSCRIPTION') { |
|
661 | + dol_syslog( |
|
662 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
663 | + ); |
|
664 | + } elseif ($action == 'MEMBER_MODIFY') { |
|
665 | + dol_syslog( |
|
666 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
667 | + ); |
|
668 | + } elseif ($action == 'MEMBER_NEW_PASSWORD') { |
|
669 | + dol_syslog( |
|
670 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
671 | + ); |
|
672 | + } elseif ($action == 'MEMBER_RESILIATE') { |
|
673 | + dol_syslog( |
|
674 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
675 | + ); |
|
676 | + } elseif ($action == 'MEMBER_DELETE') { |
|
677 | + dol_syslog( |
|
678 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
679 | + ); |
|
680 | + } |
|
681 | + |
|
682 | + // Categories |
|
683 | + elseif ($action == 'CATEGORY_CREATE') { |
|
684 | + dol_syslog( |
|
685 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
686 | + ); |
|
687 | + } elseif ($action == 'CATEGORY_MODIFY') { |
|
688 | + dol_syslog( |
|
689 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
690 | + ); |
|
691 | + } elseif ($action == 'CATEGORY_DELETE') { |
|
692 | + dol_syslog( |
|
693 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
694 | + ); |
|
695 | + } |
|
696 | + |
|
697 | + // Projects |
|
698 | + elseif ($action == 'PROJECT_CREATE') { |
|
699 | + dol_syslog( |
|
700 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
701 | + ); |
|
702 | + } elseif ($action == 'PROJECT_MODIFY') { |
|
703 | + dol_syslog( |
|
704 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
705 | + ); |
|
706 | + } elseif ($action == 'PROJECT_DELETE') { |
|
707 | + dol_syslog( |
|
708 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
709 | + ); |
|
710 | + } |
|
711 | + |
|
712 | + // Project tasks |
|
713 | + elseif ($action == 'TASK_CREATE') { |
|
714 | + dol_syslog( |
|
715 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
716 | + ); |
|
717 | + } elseif ($action == 'TASK_MODIFY') { |
|
718 | + dol_syslog( |
|
719 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
720 | + ); |
|
721 | + } elseif ($action == 'TASK_DELETE') { |
|
722 | + dol_syslog( |
|
723 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
724 | + ); |
|
725 | + } |
|
726 | + |
|
727 | + // Task time spent |
|
728 | + elseif ($action == 'TASK_TIMESPENT_CREATE') { |
|
729 | + dol_syslog( |
|
730 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
731 | + ); |
|
732 | + } elseif ($action == 'TASK_TIMESPENT_MODIFY') { |
|
733 | + dol_syslog( |
|
734 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
735 | + ); |
|
736 | + } elseif ($action == 'TASK_TIMESPENT_DELETE') { |
|
737 | + dol_syslog( |
|
738 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
739 | + ); |
|
740 | + } |
|
741 | + |
|
742 | + // Shipping |
|
743 | + elseif ($action == 'SHIPPING_CREATE') { |
|
744 | + dol_syslog( |
|
745 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
746 | + ); |
|
747 | + } elseif ($action == 'SHIPPING_MODIFY') { |
|
748 | + dol_syslog( |
|
749 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
750 | + ); |
|
751 | + } elseif ($action == 'SHIPPING_VALIDATE') { |
|
752 | + dol_syslog( |
|
753 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
754 | + ); |
|
755 | + } elseif ($action == 'SHIPPING_SENTBYMAIL') { |
|
756 | + dol_syslog( |
|
757 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
758 | + ); |
|
759 | + } elseif ($action == 'SHIPPING_DELETE') { |
|
760 | + dol_syslog( |
|
761 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
762 | + ); |
|
763 | + } elseif ($action == 'SHIPPING_BUILDDOC') { |
|
764 | + dol_syslog( |
|
765 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
766 | + ); |
|
767 | + } |
|
768 | + |
|
769 | + // File |
|
770 | + elseif ($action == 'FILE_UPLOAD') { |
|
771 | + dol_syslog( |
|
772 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
773 | + ); |
|
774 | + } elseif ($action == 'FILE_DELETE') { |
|
775 | + dol_syslog( |
|
776 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
777 | + ); |
|
778 | + } |
|
779 | + |
|
780 | + return 0; |
|
781 | + } |
|
782 | 782 | } |
783 | 783 | \ No newline at end of file |
@@ -107,13 +107,13 @@ discard block |
||
107 | 107 | if ($object->id != $line->id && $line->rang > $rang) |
108 | 108 | { |
109 | 109 | // Update du rang de toutes les lignes suivant mon titre |
110 | - $parent->updateRangOfLine($line->id, $line->rang+1); |
|
110 | + $parent->updateRangOfLine($line->id, $line->rang + 1); |
|
111 | 111 | } |
112 | 112 | } |
113 | 113 | |
114 | 114 | // Update du rang de la ligne fraichement ajouté pour la déplacer sous mon titre |
115 | - $parent->updateRangOfLine($object->id, $rang+1); |
|
116 | - $object->rang = $rang+1; |
|
115 | + $parent->updateRangOfLine($object->id, $rang + 1); |
|
116 | + $object->rang = $rang + 1; |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | public function addToEnd(&$parent, &$object, $rang) |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | |
137 | 137 | if ($subtotal_line_found) |
138 | 138 | { |
139 | - $parent->updateRangOfLine($line->id, $line->rang+1); |
|
139 | + $parent->updateRangOfLine($line->id, $line->rang + 1); |
|
140 | 140 | } |
141 | 141 | } |
142 | 142 | |
@@ -257,10 +257,10 @@ discard block |
||
257 | 257 | { |
258 | 258 | $doli_action = GETPOST('action'); |
259 | 259 | $set = GETPOST('set'); |
260 | - if ( (in_array($doli_action, array('updateligne', 'updateline', 'addline', 'add')) || $set == 'defaultTVA') && !TSubtotal::isTitle($object) && !TSubtotal::isSubtotal($object) && in_array($object->element, array('propaldet', 'commandedet', 'facturedet'))) |
|
260 | + if ((in_array($doli_action, array('updateligne', 'updateline', 'addline', 'add')) || $set == 'defaultTVA') && !TSubtotal::isTitle($object) && !TSubtotal::isSubtotal($object) && in_array($object->element, array('propaldet', 'commandedet', 'facturedet'))) |
|
261 | 261 | { |
262 | 262 | dol_syslog( |
263 | - "[SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS] Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". object=".$object->element." id=" . $object->id |
|
263 | + "[SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS] Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". object=".$object->element." id=".$object->id |
|
264 | 264 | ); |
265 | 265 | |
266 | 266 | $TTitle = TSubtotal::getAllTitleFromLine($object); |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | } |
281 | 281 | |
282 | 282 | // $object correspond à la ligne ajoutée |
283 | - if(! empty($object->array_options['options_subtotal_nc'])) { |
|
283 | + if (!empty($object->array_options['options_subtotal_nc'])) { |
|
284 | 284 | $object->total_ht = $object->total_tva = $object->total_ttc = $object->total_localtax1 = $object->total_localtax2 = |
285 | 285 | $object->multicurrency_total_ht = $object->multicurrency_total_tva = $object->multicurrency_total_ttc = 0; |
286 | 286 | |
@@ -294,12 +294,12 @@ discard block |
||
294 | 294 | |
295 | 295 | // Les lignes libres (y compris les sous-totaux) créées à partir d'une facture modèle n'ont pas la TVA de la ligne du modèle mais la TVA par défaut |
296 | 296 | if ($action == 'BILL_CREATE' && $object->fac_rec > 0) { |
297 | - dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); |
|
297 | + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
|
298 | 298 | |
299 | 299 | $object->fetch_lines(); // Lignes pas rajoutées à $object->lines par les appels à addline(); |
300 | 300 | |
301 | - foreach($object->lines as &$line) { |
|
302 | - if(TSubtotal::isSubtotal($line) && ! empty($line->tva_tx)) { |
|
301 | + foreach ($object->lines as &$line) { |
|
302 | + if (TSubtotal::isSubtotal($line) && !empty($line->tva_tx)) { |
|
303 | 303 | $line->tva_tx = 0; |
304 | 304 | $line->update(); |
305 | 305 | } |
@@ -309,170 +309,170 @@ discard block |
||
309 | 309 | |
310 | 310 | if ($action == 'USER_LOGIN') { |
311 | 311 | dol_syslog( |
312 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
312 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
313 | 313 | ); |
314 | 314 | } elseif ($action == 'USER_UPDATE_SESSION') { |
315 | 315 | // Warning: To increase performances, this action is triggered only if |
316 | 316 | // constant MAIN_ACTIVATE_UPDATESESSIONTRIGGER is set to 1. |
317 | 317 | dol_syslog( |
318 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
318 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
319 | 319 | ); |
320 | 320 | } elseif ($action == 'USER_CREATE') { |
321 | 321 | dol_syslog( |
322 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
322 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
323 | 323 | ); |
324 | 324 | } elseif ($action == 'USER_CREATE_FROM_CONTACT') { |
325 | 325 | dol_syslog( |
326 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
326 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
327 | 327 | ); |
328 | 328 | } elseif ($action == 'USER_MODIFY') { |
329 | 329 | dol_syslog( |
330 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
330 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
331 | 331 | ); |
332 | 332 | } elseif ($action == 'USER_NEW_PASSWORD') { |
333 | 333 | dol_syslog( |
334 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
334 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
335 | 335 | ); |
336 | 336 | } elseif ($action == 'USER_ENABLEDISABLE') { |
337 | 337 | dol_syslog( |
338 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
338 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
339 | 339 | ); |
340 | 340 | } elseif ($action == 'USER_DELETE') { |
341 | 341 | dol_syslog( |
342 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
342 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
343 | 343 | ); |
344 | 344 | } elseif ($action == 'USER_LOGOUT') { |
345 | 345 | dol_syslog( |
346 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
346 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
347 | 347 | ); |
348 | 348 | } elseif ($action == 'USER_SETINGROUP') { |
349 | 349 | dol_syslog( |
350 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
350 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
351 | 351 | ); |
352 | 352 | } elseif ($action == 'USER_REMOVEFROMGROUP') { |
353 | 353 | dol_syslog( |
354 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
354 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
355 | 355 | ); |
356 | 356 | } |
357 | 357 | |
358 | 358 | // Groups |
359 | 359 | elseif ($action == 'GROUP_CREATE') { |
360 | 360 | dol_syslog( |
361 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
361 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
362 | 362 | ); |
363 | 363 | } elseif ($action == 'GROUP_MODIFY') { |
364 | 364 | dol_syslog( |
365 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
365 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
366 | 366 | ); |
367 | 367 | } elseif ($action == 'GROUP_DELETE') { |
368 | 368 | dol_syslog( |
369 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
369 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
370 | 370 | ); |
371 | 371 | } |
372 | 372 | |
373 | 373 | // Companies |
374 | 374 | elseif ($action == 'COMPANY_CREATE') { |
375 | 375 | dol_syslog( |
376 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
376 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
377 | 377 | ); |
378 | 378 | } elseif ($action == 'COMPANY_MODIFY') { |
379 | 379 | dol_syslog( |
380 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
380 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
381 | 381 | ); |
382 | 382 | } elseif ($action == 'COMPANY_DELETE') { |
383 | 383 | dol_syslog( |
384 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
384 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
385 | 385 | ); |
386 | 386 | } |
387 | 387 | |
388 | 388 | // Contacts |
389 | 389 | elseif ($action == 'CONTACT_CREATE') { |
390 | 390 | dol_syslog( |
391 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
391 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
392 | 392 | ); |
393 | 393 | } elseif ($action == 'CONTACT_MODIFY') { |
394 | 394 | dol_syslog( |
395 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
395 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
396 | 396 | ); |
397 | 397 | } elseif ($action == 'CONTACT_DELETE') { |
398 | 398 | dol_syslog( |
399 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
399 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
400 | 400 | ); |
401 | 401 | } |
402 | 402 | |
403 | 403 | // Products |
404 | 404 | elseif ($action == 'PRODUCT_CREATE') { |
405 | 405 | dol_syslog( |
406 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
406 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
407 | 407 | ); |
408 | 408 | } elseif ($action == 'PRODUCT_MODIFY') { |
409 | 409 | dol_syslog( |
410 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
410 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
411 | 411 | ); |
412 | 412 | } elseif ($action == 'PRODUCT_DELETE') { |
413 | 413 | dol_syslog( |
414 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
414 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
415 | 415 | ); |
416 | 416 | } |
417 | 417 | |
418 | 418 | // Customer orders |
419 | 419 | elseif ($action == 'ORDER_CREATE') { |
420 | 420 | dol_syslog( |
421 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
421 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
422 | 422 | ); |
423 | 423 | } elseif ($action == 'ORDER_VALIDATE') { |
424 | 424 | dol_syslog( |
425 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
425 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
426 | 426 | ); |
427 | 427 | } elseif ($action == 'ORDER_DELETE') { |
428 | 428 | dol_syslog( |
429 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
429 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
430 | 430 | ); |
431 | 431 | } elseif ($action == 'ORDER_BUILDDOC') { |
432 | 432 | dol_syslog( |
433 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
433 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
434 | 434 | ); |
435 | 435 | } elseif ($action == 'ORDER_SENTBYMAIL') { |
436 | 436 | dol_syslog( |
437 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
437 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
438 | 438 | ); |
439 | 439 | } elseif ($action == 'LINEORDER_INSERT') { |
440 | 440 | dol_syslog( |
441 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
441 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
442 | 442 | ); |
443 | 443 | } elseif ($action == 'LINEORDER_DELETE') { |
444 | 444 | dol_syslog( |
445 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
445 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
446 | 446 | ); |
447 | 447 | } |
448 | 448 | |
449 | 449 | // Supplier orders |
450 | 450 | elseif ($action == 'ORDER_SUPPLIER_CREATE') { |
451 | 451 | dol_syslog( |
452 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
452 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
453 | 453 | ); |
454 | 454 | } elseif ($action == 'ORDER_SUPPLIER_VALIDATE') { |
455 | 455 | dol_syslog( |
456 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
456 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
457 | 457 | ); |
458 | 458 | } elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') { |
459 | 459 | dol_syslog( |
460 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
460 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
461 | 461 | ); |
462 | 462 | } elseif ($action == 'SUPPLIER_ORDER_BUILDDOC') { |
463 | 463 | dol_syslog( |
464 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
464 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
465 | 465 | ); |
466 | 466 | } |
467 | 467 | |
468 | 468 | // Proposals |
469 | 469 | elseif ($action == 'PROPAL_CREATE') { |
470 | 470 | dol_syslog( |
471 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
471 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
472 | 472 | ); |
473 | 473 | } elseif (in_array($action, array('PROPAL_CLONE', 'ORDER_CLONE', 'BILL_CLONE'))) { |
474 | 474 | dol_syslog( |
475 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
475 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
476 | 476 | ); |
477 | 477 | |
478 | 478 | $doli_action = GETPOST('action'); |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && in_array($doli_action, array('confirm_clone'))) |
481 | 481 | { |
482 | 482 | dol_syslog( |
483 | - "[SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS] Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". object=".$object->element." id=" . $object->id |
|
483 | + "[SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS] Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". object=".$object->element." id=".$object->id |
|
484 | 484 | ); |
485 | 485 | |
486 | 486 | // En fonction de l'objet et de la version, les lignes conservent l'id de l'objet d'origine |
@@ -508,272 +508,272 @@ discard block |
||
508 | 508 | |
509 | 509 | } elseif ($action == 'PROPAL_MODIFY') { |
510 | 510 | dol_syslog( |
511 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
511 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
512 | 512 | ); |
513 | 513 | } elseif ($action == 'PROPAL_VALIDATE') { |
514 | 514 | dol_syslog( |
515 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
515 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
516 | 516 | ); |
517 | 517 | } elseif ($action == 'PROPAL_BUILDDOC') { |
518 | 518 | dol_syslog( |
519 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
519 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
520 | 520 | ); |
521 | 521 | } elseif ($action == 'PROPAL_SENTBYMAIL') { |
522 | 522 | dol_syslog( |
523 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
523 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
524 | 524 | ); |
525 | 525 | } elseif ($action == 'PROPAL_CLOSE_SIGNED') { |
526 | 526 | dol_syslog( |
527 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
527 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
528 | 528 | ); |
529 | 529 | } elseif ($action == 'PROPAL_CLOSE_REFUSED') { |
530 | 530 | dol_syslog( |
531 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
531 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
532 | 532 | ); |
533 | 533 | } elseif ($action == 'PROPAL_DELETE') { |
534 | 534 | dol_syslog( |
535 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
535 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
536 | 536 | ); |
537 | 537 | } elseif ($action == 'LINEPROPAL_INSERT') { |
538 | 538 | dol_syslog( |
539 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
539 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
540 | 540 | ); |
541 | 541 | } elseif ($action == 'LINEPROPAL_MODIFY') { |
542 | 542 | dol_syslog( |
543 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
543 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
544 | 544 | ); |
545 | 545 | } elseif ($action == 'LINEPROPAL_DELETE') { |
546 | 546 | dol_syslog( |
547 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
547 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
548 | 548 | ); |
549 | 549 | } |
550 | 550 | |
551 | 551 | // Contracts |
552 | 552 | elseif ($action == 'CONTRACT_CREATE') { |
553 | 553 | dol_syslog( |
554 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
554 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
555 | 555 | ); |
556 | 556 | } elseif ($action == 'CONTRACT_MODIFY') { |
557 | 557 | dol_syslog( |
558 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
558 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
559 | 559 | ); |
560 | 560 | } elseif ($action == 'CONTRACT_ACTIVATE') { |
561 | 561 | dol_syslog( |
562 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
562 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
563 | 563 | ); |
564 | 564 | } elseif ($action == 'CONTRACT_CANCEL') { |
565 | 565 | dol_syslog( |
566 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
566 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
567 | 567 | ); |
568 | 568 | } elseif ($action == 'CONTRACT_CLOSE') { |
569 | 569 | dol_syslog( |
570 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
570 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
571 | 571 | ); |
572 | 572 | } elseif ($action == 'CONTRACT_DELETE') { |
573 | 573 | dol_syslog( |
574 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
574 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
575 | 575 | ); |
576 | 576 | } |
577 | 577 | |
578 | 578 | elseif ($action == 'BILL_MODIFY') { |
579 | 579 | dol_syslog( |
580 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
580 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
581 | 581 | ); |
582 | 582 | } elseif ($action == 'BILL_VALIDATE') { |
583 | 583 | dol_syslog( |
584 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
584 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
585 | 585 | ); |
586 | 586 | } elseif ($action == 'BILL_BUILDDOC') { |
587 | 587 | dol_syslog( |
588 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
588 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
589 | 589 | ); |
590 | 590 | } elseif ($action == 'BILL_SENTBYMAIL') { |
591 | 591 | dol_syslog( |
592 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
592 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
593 | 593 | ); |
594 | 594 | } elseif ($action == 'BILL_CANCEL') { |
595 | 595 | dol_syslog( |
596 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
596 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
597 | 597 | ); |
598 | 598 | } elseif ($action == 'BILL_DELETE') { |
599 | 599 | dol_syslog( |
600 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
600 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
601 | 601 | ); |
602 | 602 | } elseif ($action == 'LINEBILL_INSERT') { |
603 | 603 | |
604 | 604 | dol_syslog( |
605 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
605 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
606 | 606 | ); |
607 | 607 | } elseif ($action == 'LINEBILL_DELETE') { |
608 | 608 | dol_syslog( |
609 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
609 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
610 | 610 | ); |
611 | 611 | } |
612 | 612 | |
613 | 613 | // Payments |
614 | 614 | elseif ($action == 'PAYMENT_CUSTOMER_CREATE') { |
615 | 615 | dol_syslog( |
616 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
616 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
617 | 617 | ); |
618 | 618 | } elseif ($action == 'PAYMENT_SUPPLIER_CREATE') { |
619 | 619 | dol_syslog( |
620 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
620 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
621 | 621 | ); |
622 | 622 | } elseif ($action == 'PAYMENT_ADD_TO_BANK') { |
623 | 623 | dol_syslog( |
624 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
624 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
625 | 625 | ); |
626 | 626 | } elseif ($action == 'PAYMENT_DELETE') { |
627 | 627 | dol_syslog( |
628 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
628 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
629 | 629 | ); |
630 | 630 | } |
631 | 631 | |
632 | 632 | // Interventions |
633 | 633 | elseif ($action == 'FICHEINTER_CREATE') { |
634 | 634 | dol_syslog( |
635 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
635 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
636 | 636 | ); |
637 | 637 | } elseif ($action == 'FICHEINTER_MODIFY') { |
638 | 638 | dol_syslog( |
639 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
639 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
640 | 640 | ); |
641 | 641 | } elseif ($action == 'FICHEINTER_VALIDATE') { |
642 | 642 | dol_syslog( |
643 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
643 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
644 | 644 | ); |
645 | 645 | } elseif ($action == 'FICHEINTER_DELETE') { |
646 | 646 | dol_syslog( |
647 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
647 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
648 | 648 | ); |
649 | 649 | } |
650 | 650 | |
651 | 651 | // Members |
652 | 652 | elseif ($action == 'MEMBER_CREATE') { |
653 | 653 | dol_syslog( |
654 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
654 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
655 | 655 | ); |
656 | 656 | } elseif ($action == 'MEMBER_VALIDATE') { |
657 | 657 | dol_syslog( |
658 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
658 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
659 | 659 | ); |
660 | 660 | } elseif ($action == 'MEMBER_SUBSCRIPTION') { |
661 | 661 | dol_syslog( |
662 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
662 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
663 | 663 | ); |
664 | 664 | } elseif ($action == 'MEMBER_MODIFY') { |
665 | 665 | dol_syslog( |
666 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
666 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
667 | 667 | ); |
668 | 668 | } elseif ($action == 'MEMBER_NEW_PASSWORD') { |
669 | 669 | dol_syslog( |
670 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
670 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
671 | 671 | ); |
672 | 672 | } elseif ($action == 'MEMBER_RESILIATE') { |
673 | 673 | dol_syslog( |
674 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
674 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
675 | 675 | ); |
676 | 676 | } elseif ($action == 'MEMBER_DELETE') { |
677 | 677 | dol_syslog( |
678 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
678 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
679 | 679 | ); |
680 | 680 | } |
681 | 681 | |
682 | 682 | // Categories |
683 | 683 | elseif ($action == 'CATEGORY_CREATE') { |
684 | 684 | dol_syslog( |
685 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
685 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
686 | 686 | ); |
687 | 687 | } elseif ($action == 'CATEGORY_MODIFY') { |
688 | 688 | dol_syslog( |
689 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
689 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
690 | 690 | ); |
691 | 691 | } elseif ($action == 'CATEGORY_DELETE') { |
692 | 692 | dol_syslog( |
693 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
693 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
694 | 694 | ); |
695 | 695 | } |
696 | 696 | |
697 | 697 | // Projects |
698 | 698 | elseif ($action == 'PROJECT_CREATE') { |
699 | 699 | dol_syslog( |
700 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
700 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
701 | 701 | ); |
702 | 702 | } elseif ($action == 'PROJECT_MODIFY') { |
703 | 703 | dol_syslog( |
704 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
704 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
705 | 705 | ); |
706 | 706 | } elseif ($action == 'PROJECT_DELETE') { |
707 | 707 | dol_syslog( |
708 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
708 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
709 | 709 | ); |
710 | 710 | } |
711 | 711 | |
712 | 712 | // Project tasks |
713 | 713 | elseif ($action == 'TASK_CREATE') { |
714 | 714 | dol_syslog( |
715 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
715 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
716 | 716 | ); |
717 | 717 | } elseif ($action == 'TASK_MODIFY') { |
718 | 718 | dol_syslog( |
719 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
719 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
720 | 720 | ); |
721 | 721 | } elseif ($action == 'TASK_DELETE') { |
722 | 722 | dol_syslog( |
723 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
723 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
724 | 724 | ); |
725 | 725 | } |
726 | 726 | |
727 | 727 | // Task time spent |
728 | 728 | elseif ($action == 'TASK_TIMESPENT_CREATE') { |
729 | 729 | dol_syslog( |
730 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
730 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
731 | 731 | ); |
732 | 732 | } elseif ($action == 'TASK_TIMESPENT_MODIFY') { |
733 | 733 | dol_syslog( |
734 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
734 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
735 | 735 | ); |
736 | 736 | } elseif ($action == 'TASK_TIMESPENT_DELETE') { |
737 | 737 | dol_syslog( |
738 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
738 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
739 | 739 | ); |
740 | 740 | } |
741 | 741 | |
742 | 742 | // Shipping |
743 | 743 | elseif ($action == 'SHIPPING_CREATE') { |
744 | 744 | dol_syslog( |
745 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
745 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
746 | 746 | ); |
747 | 747 | } elseif ($action == 'SHIPPING_MODIFY') { |
748 | 748 | dol_syslog( |
749 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
749 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
750 | 750 | ); |
751 | 751 | } elseif ($action == 'SHIPPING_VALIDATE') { |
752 | 752 | dol_syslog( |
753 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
753 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
754 | 754 | ); |
755 | 755 | } elseif ($action == 'SHIPPING_SENTBYMAIL') { |
756 | 756 | dol_syslog( |
757 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
757 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
758 | 758 | ); |
759 | 759 | } elseif ($action == 'SHIPPING_DELETE') { |
760 | 760 | dol_syslog( |
761 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
761 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
762 | 762 | ); |
763 | 763 | } elseif ($action == 'SHIPPING_BUILDDOC') { |
764 | 764 | dol_syslog( |
765 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
765 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
766 | 766 | ); |
767 | 767 | } |
768 | 768 | |
769 | 769 | // File |
770 | 770 | elseif ($action == 'FILE_UPLOAD') { |
771 | 771 | dol_syslog( |
772 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
772 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
773 | 773 | ); |
774 | 774 | } elseif ($action == 'FILE_DELETE') { |
775 | 775 | dol_syslog( |
776 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
776 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
777 | 777 | ); |
778 | 778 | } |
779 | 779 |
@@ -89,12 +89,14 @@ discard block |
||
89 | 89 | |
90 | 90 | if ($this->version == 'development') { |
91 | 91 | return $langs->trans("Development"); |
92 | - } elseif ($this->version == 'experimental') |
|
93 | - |
|
92 | + } elseif ($this->version == 'experimental') { |
|
93 | + |
|
94 | 94 | return $langs->trans("Experimental"); |
95 | - elseif ($this->version == 'dolibarr') return DOL_VERSION; |
|
96 | - elseif ($this->version) return $this->version; |
|
97 | - else { |
|
95 | + } elseif ($this->version == 'dolibarr') { |
|
96 | + return DOL_VERSION; |
|
97 | + } elseif ($this->version) { |
|
98 | + return $this->version; |
|
99 | + } else { |
|
98 | 100 | return $langs->trans("Unknown"); |
99 | 101 | } |
100 | 102 | } |
@@ -122,14 +124,18 @@ discard block |
||
122 | 124 | $subtotal_line_found = false; |
123 | 125 | foreach ($parent->lines as $k => &$line) |
124 | 126 | { |
125 | - if ($line->rang < $rang) continue; |
|
126 | - elseif ($line->rang == $rang) // Je suis sur la ligne de titre où je souhaite ajouter ma nouvelle ligne en fin de bloc |
|
127 | + if ($line->rang < $rang) { |
|
128 | + continue; |
|
129 | + } elseif ($line->rang == $rang) { |
|
130 | + // Je suis sur la ligne de titre où je souhaite ajouter ma nouvelle ligne en fin de bloc |
|
127 | 131 | { |
128 | 132 | $title_level = $line->qty; |
129 | 133 | } |
130 | - elseif (!$subtotal_line_found && $title_level > -1 && ($line->qty == 100 - $title_level)) // Le level de mon titre a été trouvé avant, donc maintenant je vais m'arrêter jusqu'à trouver un sous-total |
|
134 | + } elseif (!$subtotal_line_found && $title_level > -1 && ($line->qty == 100 - $title_level)) { |
|
135 | + // Le level de mon titre a été trouvé avant, donc maintenant je vais m'arrêter jusqu'à trouver un sous-total |
|
131 | 136 | { |
132 | 137 | $subtotal_line_found = true; |
138 | + } |
|
133 | 139 | $rang = $line->rang; |
134 | 140 | } |
135 | 141 | |
@@ -191,8 +197,11 @@ discard block |
||
191 | 197 | break; |
192 | 198 | } |
193 | 199 | |
194 | - if (!empty($conf->global->SUBTOTAL_ADD_LINE_UNDER_TITLE_AT_END_BLOCK)) $this->addToEnd($parent, $object, $rang); |
|
195 | - else $this->addToBegin($parent, $object, $rang); |
|
200 | + if (!empty($conf->global->SUBTOTAL_ADD_LINE_UNDER_TITLE_AT_END_BLOCK)) { |
|
201 | + $this->addToEnd($parent, $object, $rang); |
|
202 | + } else { |
|
203 | + $this->addToBegin($parent, $object, $rang); |
|
204 | + } |
|
196 | 205 | |
197 | 206 | } |
198 | 207 | |
@@ -220,7 +229,9 @@ discard block |
||
220 | 229 | $commande->fetch($current_fk_commande); |
221 | 230 | |
222 | 231 | $label = $conf->global->SUBTOTAL_TEXT_FOR_TITLE_ORDETSTOINVOICE; |
223 | - if (empty($label)) $label = 'Commande [__REFORDER__] - Référence client : [__REFCUSTOMER__]'; |
|
232 | + if (empty($label)) { |
|
233 | + $label = 'Commande [__REFORDER__] - Référence client : [__REFCUSTOMER__]'; |
|
234 | + } |
|
224 | 235 | $label = str_replace(array('__REFORDER__', '__REFCUSTOMER__'), array($commande->ref, $commande->ref_client), $label); |
225 | 236 | |
226 | 237 | TSubtotal::addTitle($facture, $label, 1, $rang); |
@@ -271,10 +282,15 @@ discard block |
||
271 | 282 | $object->total_ht = $object->total_tva = $object->total_ttc = $object->total_localtax1 = $object->total_localtax2 = |
272 | 283 | $object->multicurrency_total_ht = $object->multicurrency_total_tva = $object->multicurrency_total_ttc = 0; |
273 | 284 | |
274 | - if ($object->element == 'propal') $res = $object->update(1); |
|
275 | - else $res = $object->update($user, 1); |
|
285 | + if ($object->element == 'propal') { |
|
286 | + $res = $object->update(1); |
|
287 | + } else { |
|
288 | + $res = $object->update($user, 1); |
|
289 | + } |
|
276 | 290 | |
277 | - if ($res > 0) setEventMessage($langs->trans('subtotal_update_nc_success')); |
|
291 | + if ($res > 0) { |
|
292 | + setEventMessage($langs->trans('subtotal_update_nc_success')); |
|
293 | + } |
|
278 | 294 | break; |
279 | 295 | } |
280 | 296 | } |
@@ -284,10 +300,15 @@ discard block |
||
284 | 300 | $object->total_ht = $object->total_tva = $object->total_ttc = $object->total_localtax1 = $object->total_localtax2 = |
285 | 301 | $object->multicurrency_total_ht = $object->multicurrency_total_tva = $object->multicurrency_total_ttc = 0; |
286 | 302 | |
287 | - if ($object->element == 'propaldet') $res = $object->update(1); |
|
288 | - else $res = $object->update($user, 1); |
|
303 | + if ($object->element == 'propaldet') { |
|
304 | + $res = $object->update(1); |
|
305 | + } else { |
|
306 | + $res = $object->update($user, 1); |
|
307 | + } |
|
289 | 308 | |
290 | - if ($res > 0) setEventMessage($langs->trans('subtotal_update_nc_success')); |
|
309 | + if ($res > 0) { |
|
310 | + setEventMessage($langs->trans('subtotal_update_nc_success')); |
|
311 | + } |
|
291 | 312 | } |
292 | 313 | } |
293 | 314 | } |
@@ -484,26 +505,38 @@ discard block |
||
484 | 505 | ); |
485 | 506 | |
486 | 507 | // En fonction de l'objet et de la version, les lignes conservent l'id de l'objet d'origine |
487 | - if (method_exists($object, 'fetch_lines')) $object->fetch_lines(); |
|
488 | - else $object->fetch($object->id); |
|
508 | + if (method_exists($object, 'fetch_lines')) { |
|
509 | + $object->fetch_lines(); |
|
510 | + } else { |
|
511 | + $object->fetch($object->id); |
|
512 | + } |
|
489 | 513 | |
490 | 514 | foreach ($object->lines as &$line) |
491 | 515 | { |
492 | - if (empty($line->array_options)) $line->fetch_optionals(); |
|
516 | + if (empty($line->array_options)) { |
|
517 | + $line->fetch_optionals(); |
|
518 | + } |
|
493 | 519 | |
494 | 520 | if (!TSubtotal::isModSubtotalLine($line) && !empty($line->array_options['options_subtotal_nc'])) |
495 | 521 | { |
496 | 522 | $line->total_ht = $line->total_tva = $line->total_ttc = $line->total_localtax1 = $line->total_localtax2 = |
497 | 523 | $line->multicurrency_total_ht = $line->multicurrency_total_tva = $line->multicurrency_total_ttc = 0; |
498 | 524 | |
499 | - if ($line->element == 'propaldet') $res = $line->update(1); |
|
500 | - else $res = $line->update($user, 1); |
|
525 | + if ($line->element == 'propaldet') { |
|
526 | + $res = $line->update(1); |
|
527 | + } else { |
|
528 | + $res = $line->update($user, 1); |
|
529 | + } |
|
501 | 530 | |
502 | - if ($res > 0) setEventMessage($langs->trans('subtotal_update_nc_success')); |
|
531 | + if ($res > 0) { |
|
532 | + setEventMessage($langs->trans('subtotal_update_nc_success')); |
|
533 | + } |
|
503 | 534 | } |
504 | 535 | } |
505 | 536 | |
506 | - if (!empty($line)) $object->update_price(1); |
|
537 | + if (!empty($line)) { |
|
538 | + $object->update_price(1); |
|
539 | + } |
|
507 | 540 | } |
508 | 541 | |
509 | 542 | } elseif ($action == 'PROPAL_MODIFY') { |
@@ -573,9 +606,7 @@ discard block |
||
573 | 606 | dol_syslog( |
574 | 607 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
575 | 608 | ); |
576 | - } |
|
577 | - |
|
578 | - elseif ($action == 'BILL_MODIFY') { |
|
609 | + } elseif ($action == 'BILL_MODIFY') { |
|
579 | 610 | dol_syslog( |
580 | 611 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
581 | 612 | ); |
@@ -25,25 +25,25 @@ discard block |
||
25 | 25 | |
26 | 26 | function subtotalAdminPrepareHead() |
27 | 27 | { |
28 | - global $langs, $conf; |
|
28 | + global $langs, $conf; |
|
29 | 29 | |
30 | - $langs->load("subtotal@subtotal"); |
|
30 | + $langs->load("subtotal@subtotal"); |
|
31 | 31 | |
32 | - $h = 0; |
|
33 | - $head = array(); |
|
32 | + $h = 0; |
|
33 | + $head = array(); |
|
34 | 34 | |
35 | - $head[$h][0] = dol_buildpath("/subtotal/admin/subtotal_setup.php", 1); |
|
36 | - $head[$h][1] = $langs->trans("Parameters"); |
|
37 | - $head[$h][2] = 'settings'; |
|
38 | - $h++; |
|
39 | - $head[$h][0] = dol_buildpath("/subtotal/admin/subtotal_about.php", 1); |
|
40 | - $head[$h][1] = $langs->trans("About"); |
|
41 | - $head[$h][2] = 'about'; |
|
42 | - $h++; |
|
35 | + $head[$h][0] = dol_buildpath("/subtotal/admin/subtotal_setup.php", 1); |
|
36 | + $head[$h][1] = $langs->trans("Parameters"); |
|
37 | + $head[$h][2] = 'settings'; |
|
38 | + $h++; |
|
39 | + $head[$h][0] = dol_buildpath("/subtotal/admin/subtotal_about.php", 1); |
|
40 | + $head[$h][1] = $langs->trans("About"); |
|
41 | + $head[$h][2] = 'about'; |
|
42 | + $h++; |
|
43 | 43 | |
44 | - complete_head_from_modules($conf, $langs, $object, $head, $h, 'subtotal', $showLabel=false); |
|
44 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'subtotal', $showLabel=false); |
|
45 | 45 | |
46 | - return $head; |
|
46 | + return $head; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | function getHtmlSelectTitle(&$object, $showLabel=false) |
@@ -242,17 +242,17 @@ discard block |
||
242 | 242 | $classname = ucfirst($element); |
243 | 243 | |
244 | 244 | switch ($element) { |
245 | - case 'supplier_proposal': |
|
246 | - $classname = 'SupplierProposal'; |
|
247 | - break; |
|
245 | + case 'supplier_proposal': |
|
246 | + $classname = 'SupplierProposal'; |
|
247 | + break; |
|
248 | 248 | |
249 | - case 'order_supplier': |
|
250 | - $classname = 'CommandeFournisseur'; |
|
251 | - break; |
|
249 | + case 'order_supplier': |
|
250 | + $classname = 'CommandeFournisseur'; |
|
251 | + break; |
|
252 | 252 | |
253 | - case 'invoice_supplier': |
|
254 | - $classname = 'FactureFournisseur'; |
|
255 | - break; |
|
253 | + case 'invoice_supplier': |
|
254 | + $classname = 'FactureFournisseur'; |
|
255 | + break; |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | $object = new $classname($db); // Propal | Commande | Facture |
@@ -325,14 +325,14 @@ discard block |
||
325 | 325 | else $res = $line->update($user); |
326 | 326 | } |
327 | 327 | else { |
328 | - if(in_array($object->element, array('invoice_supplier', 'order_supplier', 'supplier_proposal'))) { |
|
329 | - if(empty($line->label)) $line->label = $line->description; // supplier lines don't have the field label |
|
328 | + if(in_array($object->element, array('invoice_supplier', 'order_supplier', 'supplier_proposal'))) { |
|
329 | + if(empty($line->label)) $line->label = $line->description; // supplier lines don't have the field label |
|
330 | 330 | |
331 | - require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); |
|
332 | - $extrafields=new ExtraFields($object->db); |
|
333 | - $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true); |
|
334 | - $line->fetch_optionals($line->id,$extralabels); |
|
335 | - } |
|
331 | + require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); |
|
332 | + $extrafields=new ExtraFields($object->db); |
|
333 | + $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true); |
|
334 | + $line->fetch_optionals($line->id,$extralabels); |
|
335 | + } |
|
336 | 336 | $line->array_options['options_subtotal_nc'] = 0; |
337 | 337 | if($object->element == 'order_supplier') $line->update($user); |
338 | 338 | $res = TSubtotal::doUpdateLine($object, $line->id, $line->desc, $line->subprice, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->product_type, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->fk_parent_line, $line->skip_update_total, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit); |
@@ -41,21 +41,21 @@ discard block |
||
41 | 41 | $head[$h][2] = 'about'; |
42 | 42 | $h++; |
43 | 43 | |
44 | - complete_head_from_modules($conf, $langs, $object, $head, $h, 'subtotal', $showLabel=false); |
|
44 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'subtotal', $showLabel = false); |
|
45 | 45 | |
46 | 46 | return $head; |
47 | 47 | } |
48 | 48 | |
49 | -function getHtmlSelectTitle(&$object, $showLabel=false) |
|
49 | +function getHtmlSelectTitle(&$object, $showLabel = false) |
|
50 | 50 | { |
51 | 51 | global $langs; |
52 | 52 | |
53 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php'; |
|
53 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php'; |
|
54 | 54 | dol_include_once('/subtotal/class/subtotal.class.php'); |
55 | 55 | $TTitle = TSubtotal::getAllTitleFromDocument($object); |
56 | 56 | $html = ''; |
57 | - if ($showLabel) $html.= '<label for="under_title">'.$langs->trans('subtotalLabelForUnderTitle').'</label>'; |
|
58 | - $html.= '<select onChange="$(\'select[name=under_title]\').val(this.value);" name="under_title" class="under_title minwidth200"><option value="-1"></option>'; |
|
57 | + if ($showLabel) $html .= '<label for="under_title">'.$langs->trans('subtotalLabelForUnderTitle').'</label>'; |
|
58 | + $html .= '<select onChange="$(\'select[name=under_title]\').val(this.value);" name="under_title" class="under_title minwidth200"><option value="-1"></option>'; |
|
59 | 59 | |
60 | 60 | $nbsp = ' '; |
61 | 61 | foreach ($TTitle as &$line) |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | function getTFreeText() |
72 | 72 | { |
73 | - global $db,$conf; |
|
73 | + global $db, $conf; |
|
74 | 74 | |
75 | 75 | $TFreeText = array(); |
76 | 76 | |
@@ -88,19 +88,19 @@ discard block |
||
88 | 88 | return $TFreeText; |
89 | 89 | } |
90 | 90 | |
91 | -function getHtmlSelectFreeText($withEmpty=true) |
|
91 | +function getHtmlSelectFreeText($withEmpty = true) |
|
92 | 92 | { |
93 | 93 | global $langs; |
94 | 94 | |
95 | 95 | $TFreeText = getTFreeText(); |
96 | 96 | $html = '<label for="free_text">'.$langs->trans('subtotalLabelForFreeText').'</label>'; |
97 | - $html.= '<select onChange="getTFreeText($(this));" name="free_text" class="minwidth200">'; |
|
98 | - if ($withEmpty) $html.= '<option value=""></option>'; |
|
97 | + $html .= '<select onChange="getTFreeText($(this));" name="free_text" class="minwidth200">'; |
|
98 | + if ($withEmpty) $html .= '<option value=""></option>'; |
|
99 | 99 | |
100 | 100 | $TFreeTextContents = array(); |
101 | 101 | foreach ($TFreeText as $id => $tab) |
102 | 102 | { |
103 | - $html.= '<option value="'.$id.'">'.$tab->label.'</option>'; |
|
103 | + $html .= '<option value="'.$id.'">'.$tab->label.'</option>'; |
|
104 | 104 | $TFreeTextContents[$id] = $tab->content; |
105 | 105 | } |
106 | 106 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | function _updateSubtotalLine(&$object, &$line) |
129 | 129 | { |
130 | 130 | $label = GETPOST('line-title'); |
131 | - $description = ($line->qty>90) ? '' : GETPOST('line-description'); |
|
131 | + $description = ($line->qty > 90) ? '' : GETPOST('line-description'); |
|
132 | 132 | $pagebreak = (int) GETPOST('line-pagebreak'); |
133 | 133 | |
134 | 134 | $level = GETPOST('subtotal_level', 'int'); |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | |
146 | 146 | function _updateSubtotalBloc($object, $line) |
147 | 147 | { |
148 | - global $conf,$langs; |
|
148 | + global $conf, $langs; |
|
149 | 149 | |
150 | 150 | $subtotal_tva_tx = $subtotal_tva_tx_init = GETPOST('subtotal_tva_tx', 'int'); |
151 | 151 | $subtotal_progress = $subtotal_progress_init = GETPOST('subtotal_progress', 'int'); |
@@ -224,9 +224,9 @@ discard block |
||
224 | 224 | * @param $lineid = title lineid |
225 | 225 | * @param $subtotal_nc 0 = "Compris" prise en compte des totaux des lignes; 1 = "Non compris" non prise en compte des totaux du bloc; null = update de toutes les lignes |
226 | 226 | */ |
227 | -function _updateLineNC($element, $elementid, $lineid, $subtotal_nc=null) |
|
227 | +function _updateLineNC($element, $elementid, $lineid, $subtotal_nc = null) |
|
228 | 228 | { |
229 | - global $db,$langs,$tmp_object_nc; |
|
229 | + global $db, $langs, $tmp_object_nc; |
|
230 | 230 | |
231 | 231 | $error = 0; |
232 | 232 | if (empty($element)) $error++; |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | { |
267 | 267 | foreach ($object->lines as &$l) |
268 | 268 | { |
269 | - if($l->id == $lineid) { |
|
269 | + if ($l->id == $lineid) { |
|
270 | 270 | $line = $l; |
271 | 271 | break; |
272 | 272 | } |
@@ -276,12 +276,12 @@ discard block |
||
276 | 276 | { |
277 | 277 | $db->begin(); |
278 | 278 | |
279 | - if(TSubtotal::isModSubtotalLine($line)) |
|
279 | + if (TSubtotal::isModSubtotalLine($line)) |
|
280 | 280 | { |
281 | - if(TSubtotal::isTitle($line)) { |
|
281 | + if (TSubtotal::isTitle($line)) { |
|
282 | 282 | // Update le contenu du titre (ainsi que le titre lui même) |
283 | 283 | $TTitleBlock = TSubtotal::getLinesFromTitleId($object, $lineid, true); |
284 | - foreach($TTitleBlock as &$line_block) |
|
284 | + foreach ($TTitleBlock as &$line_block) |
|
285 | 285 | { |
286 | 286 | $res = doUpdate($object, $line_block, $subtotal_nc); |
287 | 287 | } |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | |
316 | 316 | if (TSubtotal::isFreeText($line) || TSubtotal::isSubtotal($line)) return 1; |
317 | 317 | // Update extrafield et total |
318 | - if(! empty($subtotal_nc)) { |
|
318 | + if (!empty($subtotal_nc)) { |
|
319 | 319 | $line->total_ht = $line->total_tva = $line->total_ttc = $line->total_localtax1 = $line->total_localtax2 = |
320 | 320 | $line->multicurrency_total_ht = $line->multicurrency_total_tva = $line->multicurrency_total_ttc = 0; |
321 | 321 | |
@@ -325,16 +325,16 @@ discard block |
||
325 | 325 | else $res = $line->update($user); |
326 | 326 | } |
327 | 327 | else { |
328 | - if(in_array($object->element, array('invoice_supplier', 'order_supplier', 'supplier_proposal'))) { |
|
329 | - if(empty($line->label)) $line->label = $line->description; // supplier lines don't have the field label |
|
328 | + if (in_array($object->element, array('invoice_supplier', 'order_supplier', 'supplier_proposal'))) { |
|
329 | + if (empty($line->label)) $line->label = $line->description; // supplier lines don't have the field label |
|
330 | 330 | |
331 | 331 | require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); |
332 | - $extrafields=new ExtraFields($object->db); |
|
333 | - $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true); |
|
334 | - $line->fetch_optionals($line->id,$extralabels); |
|
332 | + $extrafields = new ExtraFields($object->db); |
|
333 | + $extralabels = $extrafields->fetch_name_optionals_label($object->table_element_line, true); |
|
334 | + $line->fetch_optionals($line->id, $extralabels); |
|
335 | 335 | } |
336 | 336 | $line->array_options['options_subtotal_nc'] = 0; |
337 | - if($object->element == 'order_supplier') $line->update($user); |
|
337 | + if ($object->element == 'order_supplier') $line->update($user); |
|
338 | 338 | $res = TSubtotal::doUpdateLine($object, $line->id, $line->desc, $line->subprice, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->product_type, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->fk_parent_line, $line->skip_update_total, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit); |
339 | 339 | } |
340 | 340 |
@@ -54,7 +54,9 @@ discard block |
||
54 | 54 | dol_include_once('/subtotal/class/subtotal.class.php'); |
55 | 55 | $TTitle = TSubtotal::getAllTitleFromDocument($object); |
56 | 56 | $html = ''; |
57 | - if ($showLabel) $html.= '<label for="under_title">'.$langs->trans('subtotalLabelForUnderTitle').'</label>'; |
|
57 | + if ($showLabel) { |
|
58 | + $html.= '<label for="under_title">'.$langs->trans('subtotalLabelForUnderTitle').'</label>'; |
|
59 | + } |
|
58 | 60 | $html.= '<select onChange="$(\'select[name=under_title]\').val(this.value);" name="under_title" class="under_title minwidth200"><option value="-1"></option>'; |
59 | 61 | |
60 | 62 | $nbsp = ' '; |
@@ -95,7 +97,9 @@ discard block |
||
95 | 97 | $TFreeText = getTFreeText(); |
96 | 98 | $html = '<label for="free_text">'.$langs->trans('subtotalLabelForFreeText').'</label>'; |
97 | 99 | $html.= '<select onChange="getTFreeText($(this));" name="free_text" class="minwidth200">'; |
98 | - if ($withEmpty) $html.= '<option value=""></option>'; |
|
100 | + if ($withEmpty) { |
|
101 | + $html.= '<option value=""></option>'; |
|
102 | + } |
|
99 | 103 | |
100 | 104 | $TFreeTextContents = array(); |
101 | 105 | foreach ($TFreeText as $id => $tab) |
@@ -134,8 +138,13 @@ discard block |
||
134 | 138 | $level = GETPOST('subtotal_level', 'int'); |
135 | 139 | if (!empty($level)) |
136 | 140 | { |
137 | - if ($line->qty > 90) $line->qty = 100 - $level; // Si on edit une ligne sous-total |
|
138 | - else $line->qty = $level; |
|
141 | + if ($line->qty > 90) { |
|
142 | + $line->qty = 100 - $level; |
|
143 | + } |
|
144 | + // Si on edit une ligne sous-total |
|
145 | + else { |
|
146 | + $line->qty = $level; |
|
147 | + } |
|
139 | 148 | } |
140 | 149 | |
141 | 150 | $res = TSubtotal::doUpdateLine($object, $line->id, $description, 0, $line->qty, 0, '', '', 0, 9, 0, 0, 'HT', $pagebreak, 0, 1, null, 0, $label, TSubtotal::$module_number, $line->array_options); |
@@ -162,13 +171,18 @@ discard block |
||
162 | 171 | { |
163 | 172 | $subtotal_tva_tx = $subtotal_tva_tx_init; // ré-init car la variable peut évoluer |
164 | 173 | |
165 | - if (!empty($showBlockExtrafields)) $line->array_options = $array_options; |
|
166 | - if ($subtotal_tva_tx == '') $subtotal_tva_tx = $line->tva_tx; |
|
174 | + if (!empty($showBlockExtrafields)) { |
|
175 | + $line->array_options = $array_options; |
|
176 | + } |
|
177 | + if ($subtotal_tva_tx == '') { |
|
178 | + $subtotal_tva_tx = $line->tva_tx; |
|
179 | + } |
|
167 | 180 | if ($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) |
168 | 181 | { |
169 | 182 | $subtotal_progress = $subtotal_progress_init; |
170 | - if ($subtotal_progress == '') $subtotal_progress = $line->situation_percent; |
|
171 | - else |
|
183 | + if ($subtotal_progress == '') { |
|
184 | + $subtotal_progress = $line->situation_percent; |
|
185 | + } else |
|
172 | 186 | { |
173 | 187 | $prev_percent = $line->get_prev_progress($object->id); |
174 | 188 | if ($subtotal_progress < $prev_percent) |
@@ -181,14 +195,21 @@ discard block |
||
181 | 195 | |
182 | 196 | $res = TSubtotal::doUpdateLine($object, $line->id, $line->desc, $line->subprice, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $subtotal_tva_tx, $line->product_type, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->fk_parent_line, $line->skip_update_total, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $subtotal_progress, $line->fk_unit); |
183 | 197 | |
184 | - if ($res > 0) $success_updated_line++; |
|
185 | - else $error_updated_line++; |
|
198 | + if ($res > 0) { |
|
199 | + $success_updated_line++; |
|
200 | + } else { |
|
201 | + $error_updated_line++; |
|
202 | + } |
|
186 | 203 | } |
187 | 204 | } |
188 | 205 | |
189 | - if ($nb_progress_not_updated > 0) setEventMessage($langs->trans('subtotal_nb_progress_not_updated', $nb_progress_not_updated), 'warnings'); |
|
206 | + if ($nb_progress_not_updated > 0) { |
|
207 | + setEventMessage($langs->trans('subtotal_nb_progress_not_updated', $nb_progress_not_updated), 'warnings'); |
|
208 | + } |
|
190 | 209 | |
191 | - if ($success_updated_line > 0) setEventMessage($langs->trans('subtotal_success_updated_line', $success_updated_line)); |
|
210 | + if ($success_updated_line > 0) { |
|
211 | + setEventMessage($langs->trans('subtotal_success_updated_line', $success_updated_line)); |
|
212 | + } |
|
192 | 213 | if ($error_updated_line > 0) |
193 | 214 | { |
194 | 215 | setEventMessage($langs->trans('subtotal_error_updated_line', $error_updated_line), 'errors'); |
@@ -229,15 +250,16 @@ discard block |
||
229 | 250 | global $db,$langs,$tmp_object_nc; |
230 | 251 | |
231 | 252 | $error = 0; |
232 | - if (empty($element)) $error++; |
|
253 | + if (empty($element)) { |
|
254 | + $error++; |
|
255 | + } |
|
233 | 256 | |
234 | 257 | if (!$error) |
235 | 258 | { |
236 | 259 | if (!empty($tmp_object_nc) && $tmp_object_nc->element == $element && $tmp_object_nc->id == $elementid) |
237 | 260 | { |
238 | 261 | $object = $tmp_object_nc; |
239 | - } |
|
240 | - else |
|
262 | + } else |
|
241 | 263 | { |
242 | 264 | $classname = ucfirst($element); |
243 | 265 | |
@@ -257,8 +279,11 @@ discard block |
||
257 | 279 | |
258 | 280 | $object = new $classname($db); // Propal | Commande | Facture |
259 | 281 | $res = $object->fetch($elementid); |
260 | - if ($res < 0) $error++; |
|
261 | - else $tmp_object_nc = $object; |
|
282 | + if ($res < 0) { |
|
283 | + $error++; |
|
284 | + } else { |
|
285 | + $tmp_object_nc = $object; |
|
286 | + } |
|
262 | 287 | } |
263 | 288 | } |
264 | 289 | |
@@ -286,21 +311,21 @@ discard block |
||
286 | 311 | $res = doUpdate($object, $line_block, $subtotal_nc); |
287 | 312 | } |
288 | 313 | } |
289 | - } |
|
290 | - else |
|
314 | + } else |
|
291 | 315 | { |
292 | 316 | $res = doUpdate($object, $line, $subtotal_nc); |
293 | 317 | } |
294 | 318 | |
295 | 319 | $res = $object->update_price(1); |
296 | - if ($res <= 0) $error++; |
|
320 | + if ($res <= 0) { |
|
321 | + $error++; |
|
322 | + } |
|
297 | 323 | |
298 | 324 | if (!$error) |
299 | 325 | { |
300 | 326 | setEventMessage($langs->trans('subtotal_update_nc_success')); |
301 | 327 | $db->commit(); |
302 | - } |
|
303 | - else |
|
328 | + } else |
|
304 | 329 | { |
305 | 330 | setEventMessage($langs->trans('subtotal_update_nc_error'), 'errors'); |
306 | 331 | $db->rollback(); |
@@ -313,7 +338,9 @@ discard block |
||
313 | 338 | { |
314 | 339 | global $user; |
315 | 340 | |
316 | - if (TSubtotal::isFreeText($line) || TSubtotal::isSubtotal($line)) return 1; |
|
341 | + if (TSubtotal::isFreeText($line) || TSubtotal::isSubtotal($line)) { |
|
342 | + return 1; |
|
343 | + } |
|
317 | 344 | // Update extrafield et total |
318 | 345 | if(! empty($subtotal_nc)) { |
319 | 346 | $line->total_ht = $line->total_tva = $line->total_ttc = $line->total_localtax1 = $line->total_localtax2 = |
@@ -321,12 +348,17 @@ discard block |
||
321 | 348 | |
322 | 349 | $line->array_options['options_subtotal_nc'] = 1; |
323 | 350 | |
324 | - if ($line->element == 'propaldet') $res = $line->update(); |
|
325 | - else $res = $line->update($user); |
|
326 | - } |
|
327 | - else { |
|
351 | + if ($line->element == 'propaldet') { |
|
352 | + $res = $line->update(); |
|
353 | + } else { |
|
354 | + $res = $line->update($user); |
|
355 | + } |
|
356 | + } else { |
|
328 | 357 | if(in_array($object->element, array('invoice_supplier', 'order_supplier', 'supplier_proposal'))) { |
329 | - if(empty($line->label)) $line->label = $line->description; // supplier lines don't have the field label |
|
358 | + if(empty($line->label)) { |
|
359 | + $line->label = $line->description; |
|
360 | + } |
|
361 | + // supplier lines don't have the field label |
|
330 | 362 | |
331 | 363 | require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); |
332 | 364 | $extrafields=new ExtraFields($object->db); |
@@ -334,7 +366,9 @@ discard block |
||
334 | 366 | $line->fetch_optionals($line->id,$extralabels); |
335 | 367 | } |
336 | 368 | $line->array_options['options_subtotal_nc'] = 0; |
337 | - if($object->element == 'order_supplier') $line->update($user); |
|
369 | + if($object->element == 'order_supplier') { |
|
370 | + $line->update($user); |
|
371 | + } |
|
338 | 372 | $res = TSubtotal::doUpdateLine($object, $line->id, $line->desc, $line->subprice, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->product_type, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->fk_parent_line, $line->skip_update_total, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit); |
339 | 373 | } |
340 | 374 |
@@ -47,11 +47,11 @@ discard block |
||
47 | 47 | * @return void |
48 | 48 | */ |
49 | 49 | |
50 | - var $module_number = 104777; |
|
50 | + var $module_number = 104777; |
|
51 | 51 | |
52 | - function formObjectOptions($parameters, &$object, &$action, $hookmanager) |
|
53 | - { |
|
54 | - global $langs,$db,$user, $conf; |
|
52 | + function formObjectOptions($parameters, &$object, &$action, $hookmanager) |
|
53 | + { |
|
54 | + global $langs,$db,$user, $conf; |
|
55 | 55 | |
56 | 56 | $langs->load('subtotal@subtotal'); |
57 | 57 | |
@@ -66,10 +66,10 @@ discard block |
||
66 | 66 | $createRight = $user->rights->facture->creer; |
67 | 67 | } elseif($object->element == 'order_supplier' ) |
68 | 68 | { |
69 | - $createRight = $user->rights->fournisseur->commande->creer; |
|
69 | + $createRight = $user->rights->fournisseur->commande->creer; |
|
70 | 70 | } elseif($object->element == 'invoice_supplier' ) |
71 | 71 | { |
72 | - $createRight = $user->rights->fournisseur->facture->creer; |
|
72 | + $createRight = $user->rights->fournisseur->facture->creer; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | if ($object->statut == 0 && $createRight) { |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | |
120 | 120 | if (!empty($conf->global->SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE) && $qty < 10) TSubtotal::addSubtotalMissing($object, $qty); |
121 | 121 | |
122 | - TSubtotal::addSubTotalLine($object, $title, $qty); |
|
122 | + TSubtotal::addSubTotalLine($object, $title, $qty); |
|
123 | 123 | } |
124 | 124 | else if($action==='ask_deleteallline') { |
125 | 125 | $form=new Form($db); |
@@ -341,36 +341,36 @@ discard block |
||
341 | 341 | $TContext = explode(':',$parameters['context']); |
342 | 342 | if ( |
343 | 343 | in_array('invoicecard',$TContext) |
344 | - || in_array('invoicesuppliercard',$TContext) |
|
344 | + || in_array('invoicesuppliercard',$TContext) |
|
345 | 345 | || in_array('propalcard',$TContext) |
346 | 346 | || in_array('ordercard',$TContext) |
347 | - || in_array('ordersuppliercard',$TContext) |
|
347 | + || in_array('ordersuppliercard',$TContext) |
|
348 | 348 | || in_array('invoicereccard',$TContext) |
349 | 349 | ) |
350 | - { |
|
350 | + { |
|
351 | 351 | $hideInnerLines = isset( $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']] ) ? $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']] : 0; |
352 | 352 | $hidedetails = isset( $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']] ) ? $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']] : 0; |
353 | 353 | $hidepricesDefaultConf = !empty($conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED)?$conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED:0; |
354 | 354 | $hideprices= isset( $_SESSION['subtotal_hideprices_'.$parameters['modulepart']] ) ? $_SESSION['subtotal_hideprices_'.$parameters['modulepart']] : $hidepricesDefaultConf; |
355 | 355 | |
356 | 356 | $var=false; |
357 | - $out.= '<tr '.$bc[$var].'> |
|
357 | + $out.= '<tr '.$bc[$var].'> |
|
358 | 358 | <td colspan="4" align="right"> |
359 | 359 | <label for="hideInnerLines">'.$langs->trans('HideInnerLines').'</label> |
360 | 360 | <input type="checkbox" onclick="if($(this).is(\':checked\')) { $(\'#hidedetails\').prop(\'checked\', \'checked\') }" id="hideInnerLines" name="hideInnerLines" value="1" '.(( $hideInnerLines ) ? 'checked="checked"' : '' ).' /> |
361 | 361 | </td> |
362 | 362 | </tr>'; |
363 | 363 | |
364 | - $var=!$var; |
|
365 | - $out.= '<tr '.$bc[$var].'> |
|
364 | + $var=!$var; |
|
365 | + $out.= '<tr '.$bc[$var].'> |
|
366 | 366 | <td colspan="4" align="right"> |
367 | 367 | <label for="hidedetails">'.$langs->trans('SubTotalhidedetails').'</label> |
368 | 368 | <input type="checkbox" id="hidedetails" name="hidedetails" value="1" '.(( $hidedetails ) ? 'checked="checked"' : '' ).' /> |
369 | 369 | </td> |
370 | 370 | </tr>'; |
371 | 371 | |
372 | - $var=!$var; |
|
373 | - $out.= '<tr '.$bc[$var].'> |
|
372 | + $var=!$var; |
|
373 | + $out.= '<tr '.$bc[$var].'> |
|
374 | 374 | <td colspan="4" align="right"> |
375 | 375 | <label for="hidedetails">'.$langs->trans('SubTotalhidePrice').'</label> |
376 | 376 | <input type="checkbox" id="hideprices" name="hideprices" value="1" '.(( $hideprices ) ? 'checked="checked"' : '' ).' /> |
@@ -382,9 +382,9 @@ discard block |
||
382 | 382 | if ( |
383 | 383 | (in_array('propalcard',$TContext) && !empty($conf->global->SUBTOTAL_PROPAL_ADD_RECAP)) |
384 | 384 | || (in_array('ordercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
385 | - || (in_array('ordersuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
385 | + || (in_array('ordersuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
386 | 386 | || (in_array('invoicecard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
387 | - || (in_array('invoicesuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
387 | + || (in_array('invoicesuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
388 | 388 | || (in_array('invoicereccard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP )) |
389 | 389 | ) |
390 | 390 | { |
@@ -403,19 +403,19 @@ discard block |
||
403 | 403 | } |
404 | 404 | |
405 | 405 | |
406 | - return 1; |
|
406 | + return 1; |
|
407 | 407 | } |
408 | 408 | |
409 | - function formEditProductOptions($parameters, &$object, &$action, $hookmanager) |
|
410 | - { |
|
409 | + function formEditProductOptions($parameters, &$object, &$action, $hookmanager) |
|
410 | + { |
|
411 | 411 | |
412 | - if (in_array('invoicecard',explode(':',$parameters['context']))) |
|
413 | - { |
|
412 | + if (in_array('invoicecard',explode(':',$parameters['context']))) |
|
413 | + { |
|
414 | 414 | |
415 | - } |
|
415 | + } |
|
416 | 416 | |
417 | - return 0; |
|
418 | - } |
|
417 | + return 0; |
|
418 | + } |
|
419 | 419 | |
420 | 420 | function ODTSubstitutionLine(&$parameters, &$object, $action, $hookmanager) { |
421 | 421 | global $conf; |
@@ -464,11 +464,11 @@ discard block |
||
464 | 464 | |
465 | 465 | if ( |
466 | 466 | in_array('invoicecard',explode(':',$parameters['context'])) |
467 | - || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
467 | + || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
468 | 468 | || in_array('propalcard',explode(':',$parameters['context'])) |
469 | - || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
469 | + || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
470 | 470 | || in_array('ordercard',explode(':',$parameters['context'])) |
471 | - || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
471 | + || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
472 | 472 | || in_array('invoicereccard',explode(':',$parameters['context'])) |
473 | 473 | ) { |
474 | 474 | |
@@ -547,20 +547,20 @@ discard block |
||
547 | 547 | in_array('invoicecard',explode(':',$parameters['context'])) |
548 | 548 | || in_array('propalcard',explode(':',$parameters['context'])) |
549 | 549 | || in_array('ordercard',explode(':',$parameters['context'])) |
550 | - || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
551 | - || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
552 | - || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
550 | + || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
551 | + || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
552 | + || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
553 | 553 | ) |
554 | - { |
|
554 | + { |
|
555 | 555 | if(in_array('invoicecard',explode(':',$parameters['context']))) { |
556 | 556 | $sessname = 'subtotal_hideInnerLines_facture'; |
557 | 557 | $sessname2 = 'subtotal_hidedetails_facture'; |
558 | 558 | $sessname3 = 'subtotal_hideprices_facture'; |
559 | 559 | } |
560 | 560 | elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) { |
561 | - $sessname = 'subtotal_hideInnerLines_facture_fournisseur'; |
|
562 | - $sessname2 = 'subtotal_hidedetails_facture_fournisseur'; |
|
563 | - $sessname3 = 'subtotal_hideprices_facture_fournisseur'; |
|
561 | + $sessname = 'subtotal_hideInnerLines_facture_fournisseur'; |
|
562 | + $sessname2 = 'subtotal_hidedetails_facture_fournisseur'; |
|
563 | + $sessname3 = 'subtotal_hideprices_facture_fournisseur'; |
|
564 | 564 | } |
565 | 565 | elseif(in_array('propalcard',explode(':',$parameters['context']))) { |
566 | 566 | $sessname = 'subtotal_hideInnerLines_propal'; |
@@ -568,9 +568,9 @@ discard block |
||
568 | 568 | $sessname3 = 'subtotal_hideprices_propal'; |
569 | 569 | } |
570 | 570 | elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) { |
571 | - $sessname = 'subtotal_hideInnerLines_supplier_proposal'; |
|
572 | - $sessname2 = 'subtotal_hidedetails_supplier_proposal'; |
|
573 | - $sessname3 = 'subtotal_hideprices_supplier_proposal'; |
|
571 | + $sessname = 'subtotal_hideInnerLines_supplier_proposal'; |
|
572 | + $sessname2 = 'subtotal_hidedetails_supplier_proposal'; |
|
573 | + $sessname3 = 'subtotal_hideprices_supplier_proposal'; |
|
574 | 574 | } |
575 | 575 | elseif(in_array('ordercard',explode(':',$parameters['context']))) { |
576 | 576 | $sessname = 'subtotal_hideInnerLines_commande'; |
@@ -578,9 +578,9 @@ discard block |
||
578 | 578 | $sessname3 = 'subtotal_hideprices_commande'; |
579 | 579 | } |
580 | 580 | elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) { |
581 | - $sessname = 'subtotal_hideInnerLines_commande_fournisseur'; |
|
582 | - $sessname2 = 'subtotal_hidedetails_commande_fournisseur'; |
|
583 | - $sessname3 = 'subtotal_hideprices_commande_fournisseur'; |
|
581 | + $sessname = 'subtotal_hideInnerLines_commande_fournisseur'; |
|
582 | + $sessname2 = 'subtotal_hidedetails_commande_fournisseur'; |
|
583 | + $sessname3 = 'subtotal_hideprices_commande_fournisseur'; |
|
584 | 584 | } |
585 | 585 | else { |
586 | 586 | $sessname = 'subtotal_hideInnerLines_unknown'; |
@@ -602,17 +602,17 @@ discard block |
||
602 | 602 | foreach($object->lines as &$line) { |
603 | 603 | if ($line->product_type == 9 && $line->special_code == $this->module_number) { |
604 | 604 | |
605 | - if($line->qty>=90) { |
|
606 | - $line->modsubtotal_total = 1; |
|
607 | - } |
|
608 | - else{ |
|
609 | - $line->modsubtotal_title = 1; |
|
610 | - } |
|
605 | + if($line->qty>=90) { |
|
606 | + $line->modsubtotal_total = 1; |
|
607 | + } |
|
608 | + else{ |
|
609 | + $line->modsubtotal_title = 1; |
|
610 | + } |
|
611 | 611 | |
612 | 612 | $line->total_ht = $this->getTotalLineFromObject($object, $line, ''); |
613 | 613 | } |
614 | - } |
|
615 | - } |
|
614 | + } |
|
615 | + } |
|
616 | 616 | |
617 | 617 | } |
618 | 618 | else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') { |
@@ -629,7 +629,7 @@ discard block |
||
629 | 629 | */ |
630 | 630 | else if($object->element=='invoice_supplier') |
631 | 631 | { |
632 | - $object->deleteline($idLine); |
|
632 | + $object->deleteline($idLine); |
|
633 | 633 | } |
634 | 634 | /** |
635 | 635 | * @var $object Propal |
@@ -652,7 +652,7 @@ discard block |
||
652 | 652 | */ |
653 | 653 | else if($object->element=='order_supplier') |
654 | 654 | { |
655 | - $object->deleteline($idLine); |
|
655 | + $object->deleteline($idLine); |
|
656 | 656 | } |
657 | 657 | /** |
658 | 658 | * @var $object Facturerec |
@@ -696,7 +696,7 @@ discard block |
||
696 | 696 | |
697 | 697 | foreach($object->lines as $l) { |
698 | 698 | |
699 | - $lid = (!empty($l->rowid) ? $l->rowid : $l->id); |
|
699 | + $lid = (!empty($l->rowid) ? $l->rowid : $l->id); |
|
700 | 700 | if($lid == $lineid) { |
701 | 701 | |
702 | 702 | $found = true; |
@@ -705,7 +705,7 @@ discard block |
||
705 | 705 | |
706 | 706 | if($found) { |
707 | 707 | |
708 | - $Tab[] = (!empty($l->rowid) ? $l->rowid : $l->id); |
|
708 | + $Tab[] = (!empty($l->rowid) ? $l->rowid : $l->id); |
|
709 | 709 | |
710 | 710 | if($l->special_code==$this->module_number && (($l->qty==99 && $qty_line==1) || ($l->qty==98 && $qty_line==2)) ) { |
711 | 711 | break; // end of story |
@@ -784,17 +784,17 @@ discard block |
||
784 | 784 | if($l->rang>=$rang) { |
785 | 785 | return price($total); |
786 | 786 | } |
787 | - if (TSubtotal::isSubtotal($l)){ |
|
788 | - $total = 0; |
|
789 | - } else if ($l->situation_percent > 0 ){ |
|
787 | + if (TSubtotal::isSubtotal($l)){ |
|
788 | + $total = 0; |
|
789 | + } else if ($l->situation_percent > 0 ){ |
|
790 | 790 | |
791 | 791 | |
792 | 792 | $prev_progress = $l->get_prev_progress($object->id); |
793 | 793 | $progress = ($l->situation_percent - $prev_progress) /100; |
794 | - $total += ($l->total_ht/($l->situation_percent/100)) * $progress; |
|
794 | + $total += ($l->total_ht/($l->situation_percent/100)) * $progress; |
|
795 | 795 | |
796 | - } |
|
797 | - } |
|
796 | + } |
|
797 | + } |
|
798 | 798 | |
799 | 799 | return price($total); |
800 | 800 | } |
@@ -826,7 +826,7 @@ discard block |
||
826 | 826 | if(method_exists('Closure','bind')) { |
827 | 827 | $pageBreakOriginalValue = $pdf->AcceptPageBreak(); |
828 | 828 | $sweetsThief = function ($pdf) { |
829 | - return $pdf->bMargin ; |
|
829 | + return $pdf->bMargin ; |
|
830 | 830 | }; |
831 | 831 | $sweetsThief = Closure::bind($sweetsThief, null, $pdf); |
832 | 832 | |
@@ -889,11 +889,11 @@ discard block |
||
889 | 889 | else |
890 | 890 | { |
891 | 891 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
892 | - if(get_class($object) == 'Facture' && $object->type==Facture::TYPE_SITUATION){//Facture de situation |
|
893 | - $total_to_print = $this->getTotalToPrintSituation($object, $line); |
|
894 | - } else { |
|
895 | - $total_to_print = price($total); |
|
896 | - } |
|
892 | + if(get_class($object) == 'Facture' && $object->type==Facture::TYPE_SITUATION){//Facture de situation |
|
893 | + $total_to_print = $this->getTotalToPrintSituation($object, $line); |
|
894 | + } else { |
|
895 | + $total_to_print = price($total); |
|
896 | + } |
|
897 | 897 | |
898 | 898 | $line->total_ht = $total; |
899 | 899 | $line->total = $total; |
@@ -1044,7 +1044,7 @@ discard block |
||
1044 | 1044 | } |
1045 | 1045 | |
1046 | 1046 | function pdf_getlinetotalexcltax($parameters=array(), &$object, &$action='') { |
1047 | - global $conf, $hideprices, $ThidepricesExceptionList; |
|
1047 | + global $conf, $hideprices, $ThidepricesExceptionList; |
|
1048 | 1048 | |
1049 | 1049 | if($this->isModSubtotalLine($parameters,$object) ){ |
1050 | 1050 | |
@@ -1083,28 +1083,28 @@ discard block |
||
1083 | 1083 | } |
1084 | 1084 | } |
1085 | 1085 | if ((int)GETPOST('hideInnerLines') && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)){ |
1086 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1087 | - else $i = (int)$parameters; |
|
1088 | - $this->resprints = price($object->lines[$i]->total_ht); |
|
1086 | + if(is_array($parameters)) $i = & $parameters['i']; |
|
1087 | + else $i = (int)$parameters; |
|
1088 | + $this->resprints = price($object->lines[$i]->total_ht); |
|
1089 | 1089 | } |
1090 | 1090 | if (!empty($hideprices) |
1091 | - || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1092 | - ) |
|
1091 | + || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1092 | + ) |
|
1093 | 1093 | { |
1094 | - if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
1095 | - { |
|
1094 | + if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
1095 | + { |
|
1096 | 1096 | |
1097 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1098 | - else $i = (int)$parameters; |
|
1097 | + if(is_array($parameters)) $i = & $parameters['i']; |
|
1098 | + else $i = (int)$parameters; |
|
1099 | 1099 | |
1100 | - // Check if a title exist for this line && if the title have subtotal |
|
1101 | - $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
1102 | - if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
1103 | - { |
|
1104 | - $this->resprints = ' '; |
|
1105 | - return 1; |
|
1106 | - } |
|
1107 | - } |
|
1100 | + // Check if a title exist for this line && if the title have subtotal |
|
1101 | + $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
1102 | + if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
1103 | + { |
|
1104 | + $this->resprints = ' '; |
|
1105 | + return 1; |
|
1106 | + } |
|
1107 | + } |
|
1108 | 1108 | } |
1109 | 1109 | |
1110 | 1110 | return 0; |
@@ -1384,11 +1384,11 @@ discard block |
||
1384 | 1384 | $hidedetails = (int)GETPOST('hidedetails'); |
1385 | 1385 | |
1386 | 1386 | if ($hideInnerLines) { // si c une ligne de titre |
1387 | - $fk_parent_line=0; |
|
1387 | + $fk_parent_line=0; |
|
1388 | 1388 | $TLines =array(); |
1389 | 1389 | |
1390 | 1390 | $original_count=count($object->lines); |
1391 | - $TTvas = array(); // tableau de tva |
|
1391 | + $TTvas = array(); // tableau de tva |
|
1392 | 1392 | |
1393 | 1393 | foreach($object->lines as $k=>&$line) |
1394 | 1394 | { |
@@ -1418,48 +1418,48 @@ discard block |
||
1418 | 1418 | |
1419 | 1419 | if ($hideInnerLines) |
1420 | 1420 | { |
1421 | - if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
1422 | - { |
|
1423 | - if($line->tva_tx != '0.000' && $line->product_type!=9){ |
|
1421 | + if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
1422 | + { |
|
1423 | + if($line->tva_tx != '0.000' && $line->product_type!=9){ |
|
1424 | 1424 | |
1425 | - // on remplit le tableau de tva pour substituer les lignes cachées |
|
1426 | - $TTvas[$line->tva_tx]['total_tva'] += $line->total_tva; |
|
1427 | - $TTvas[$line->tva_tx]['total_ht'] += $line->total_ht; |
|
1428 | - $TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; |
|
1429 | - } |
|
1430 | - if($line->product_type==9 && $line->rowid>0) |
|
1431 | - { |
|
1432 | - //Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres |
|
1433 | - // génère des lignes d'affichage des montants HT soumis à tva |
|
1434 | - $nbtva = count($TTvas); |
|
1435 | - if(!empty($nbtva)){ |
|
1436 | - foreach ($TTvas as $tx =>$val){ |
|
1437 | - $l = clone $line; |
|
1438 | - $l->product_type = 1; |
|
1439 | - $l->special_code = ''; |
|
1440 | - $l->qty = 1; |
|
1441 | - $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx)); |
|
1442 | - $l->tva_tx = $tx; |
|
1443 | - $l->total_ht = $val['total_ht']; |
|
1444 | - $l->total_tva = $val['total_tva']; |
|
1445 | - $l->total = $line->total_ht; |
|
1446 | - $l->total_ttc = $val['total_ttc']; |
|
1447 | - $TLines[] = $l; |
|
1448 | - array_shift($TTvas); |
|
1449 | - } |
|
1450 | - } |
|
1425 | + // on remplit le tableau de tva pour substituer les lignes cachées |
|
1426 | + $TTvas[$line->tva_tx]['total_tva'] += $line->total_tva; |
|
1427 | + $TTvas[$line->tva_tx]['total_ht'] += $line->total_ht; |
|
1428 | + $TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; |
|
1429 | + } |
|
1430 | + if($line->product_type==9 && $line->rowid>0) |
|
1431 | + { |
|
1432 | + //Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres |
|
1433 | + // génère des lignes d'affichage des montants HT soumis à tva |
|
1434 | + $nbtva = count($TTvas); |
|
1435 | + if(!empty($nbtva)){ |
|
1436 | + foreach ($TTvas as $tx =>$val){ |
|
1437 | + $l = clone $line; |
|
1438 | + $l->product_type = 1; |
|
1439 | + $l->special_code = ''; |
|
1440 | + $l->qty = 1; |
|
1441 | + $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx)); |
|
1442 | + $l->tva_tx = $tx; |
|
1443 | + $l->total_ht = $val['total_ht']; |
|
1444 | + $l->total_tva = $val['total_tva']; |
|
1445 | + $l->total = $line->total_ht; |
|
1446 | + $l->total_ttc = $val['total_ttc']; |
|
1447 | + $TLines[] = $l; |
|
1448 | + array_shift($TTvas); |
|
1449 | + } |
|
1450 | + } |
|
1451 | 1451 | |
1452 | - // ajoute la ligne de sous-total |
|
1453 | - $TLines[] = $line; |
|
1454 | - } |
|
1455 | - } else { |
|
1452 | + // ajoute la ligne de sous-total |
|
1453 | + $TLines[] = $line; |
|
1454 | + } |
|
1455 | + } else { |
|
1456 | 1456 | |
1457 | - if($line->product_type==9 && $line->rowid>0) |
|
1458 | - { |
|
1459 | - // ajoute la ligne de sous-total |
|
1460 | - $TLines[] = $line; |
|
1461 | - } |
|
1462 | - } |
|
1457 | + if($line->product_type==9 && $line->rowid>0) |
|
1458 | + { |
|
1459 | + // ajoute la ligne de sous-total |
|
1460 | + $TLines[] = $line; |
|
1461 | + } |
|
1462 | + } |
|
1463 | 1463 | |
1464 | 1464 | |
1465 | 1465 | } |
@@ -1484,20 +1484,20 @@ discard block |
||
1484 | 1484 | $nbtva = count($TTvas); |
1485 | 1485 | if(!empty($nbtva) && $hideInnerLines && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
1486 | 1486 | { |
1487 | - foreach ($TTvas as $tx =>$val){ |
|
1488 | - $l = clone $line; |
|
1489 | - $l->product_type = 1; |
|
1490 | - $l->special_code = ''; |
|
1491 | - $l->qty = 1; |
|
1492 | - $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx)); |
|
1493 | - $l->tva_tx = $tx; |
|
1494 | - $l->total_ht = $val['total_ht']; |
|
1495 | - $l->total_tva = $val['total_tva']; |
|
1496 | - $l->total = $line->total_ht; |
|
1497 | - $l->total_ttc = $val['total_ttc']; |
|
1498 | - $TLines[] = $l; |
|
1499 | - array_shift($TTvas); |
|
1500 | - } |
|
1487 | + foreach ($TTvas as $tx =>$val){ |
|
1488 | + $l = clone $line; |
|
1489 | + $l->product_type = 1; |
|
1490 | + $l->special_code = ''; |
|
1491 | + $l->qty = 1; |
|
1492 | + $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx)); |
|
1493 | + $l->tva_tx = $tx; |
|
1494 | + $l->total_ht = $val['total_ht']; |
|
1495 | + $l->total_tva = $val['total_tva']; |
|
1496 | + $l->total = $line->total_ht; |
|
1497 | + $l->total_ttc = $val['total_ttc']; |
|
1498 | + $TLines[] = $l; |
|
1499 | + array_shift($TTvas); |
|
1500 | + } |
|
1501 | 1501 | } |
1502 | 1502 | |
1503 | 1503 | global $nblignes; |
@@ -1509,7 +1509,7 @@ discard block |
||
1509 | 1509 | $this->resprints = ''; |
1510 | 1510 | return 0; |
1511 | 1511 | } |
1512 | - } |
|
1512 | + } |
|
1513 | 1513 | |
1514 | 1514 | return 0; |
1515 | 1515 | } |
@@ -1672,18 +1672,18 @@ discard block |
||
1672 | 1672 | } |
1673 | 1673 | elseif($object->element == 'order_supplier' ) |
1674 | 1674 | { |
1675 | - $createRight = $user->rights->fournisseur->commande->creer; |
|
1675 | + $createRight = $user->rights->fournisseur->commande->creer; |
|
1676 | 1676 | } |
1677 | 1677 | elseif($object->element == 'invoice_supplier' ) |
1678 | 1678 | { |
1679 | - $createRight = $user->rights->fournisseur->facture->creer; |
|
1679 | + $createRight = $user->rights->fournisseur->facture->creer; |
|
1680 | 1680 | } |
1681 | 1681 | |
1682 | 1682 | if($line->special_code!=$this->module_number || $line->product_type!=9) { |
1683 | 1683 | null; |
1684 | 1684 | } |
1685 | 1685 | else if (in_array('invoicecard',$contexts) || in_array('invoicesuppliercard',$contexts) || in_array('propalcard',$contexts) || in_array('supplier_proposalcard',$contexts) || in_array('ordercard',$contexts) || in_array('ordersuppliercard',$contexts) || in_array('invoicereccard',$contexts)) |
1686 | - { |
|
1686 | + { |
|
1687 | 1687 | if($object->element=='facture')$idvar = 'facid'; |
1688 | 1688 | else $idvar='id'; |
1689 | 1689 | |
@@ -1730,7 +1730,7 @@ discard block |
||
1730 | 1730 | //var_dump($line); |
1731 | 1731 | |
1732 | 1732 | // HTML 5 data for js |
1733 | - $data = $this->_getHtmlData($parameters, $object, $action, $hookmanager); |
|
1733 | + $data = $this->_getHtmlData($parameters, $object, $action, $hookmanager); |
|
1734 | 1734 | |
1735 | 1735 | |
1736 | 1736 | ?> |
@@ -1788,8 +1788,8 @@ discard block |
||
1788 | 1788 | } |
1789 | 1789 | |
1790 | 1790 | if ($object->element == 'order_supplier' || $object->element == 'invoice_supplier') { |
1791 | - $line->label = !empty($line->description) ? $line->description : $line->desc; |
|
1792 | - $line->description = ''; |
|
1791 | + $line->label = !empty($line->description) ? $line->description : $line->desc; |
|
1792 | + $line->description = ''; |
|
1793 | 1793 | } |
1794 | 1794 | $newlabel = $line->label; |
1795 | 1795 | if($line->label=='' && !$isFreeText) { |
@@ -2080,17 +2080,17 @@ discard block |
||
2080 | 2080 | if ($object->statut == 0 && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && $action != 'editline') |
2081 | 2081 | { |
2082 | 2082 | |
2083 | - if($object->element == 'invoice_supplier' || $object->element == 'order_supplier') |
|
2084 | - { |
|
2085 | - foreach ($object->lines as $line) |
|
2086 | - { |
|
2087 | - // fetch optionals attributes and labels |
|
2088 | - require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); |
|
2089 | - $extrafields=new ExtraFields($this->db); |
|
2090 | - $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true); |
|
2091 | - $line->fetch_optionals($line->id,$extralabels); |
|
2092 | - } |
|
2093 | - } |
|
2083 | + if($object->element == 'invoice_supplier' || $object->element == 'order_supplier') |
|
2084 | + { |
|
2085 | + foreach ($object->lines as $line) |
|
2086 | + { |
|
2087 | + // fetch optionals attributes and labels |
|
2088 | + require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); |
|
2089 | + $extrafields=new ExtraFields($this->db); |
|
2090 | + $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true); |
|
2091 | + $line->fetch_optionals($line->id,$extralabels); |
|
2092 | + } |
|
2093 | + } |
|
2094 | 2094 | |
2095 | 2095 | $TSubNc = array(); |
2096 | 2096 | foreach ($object->lines as &$l) |
@@ -2181,80 +2181,80 @@ discard block |
||
2181 | 2181 | { |
2182 | 2182 | dol_include_once('/subtotal/class/subtotal.class.php'); |
2183 | 2183 | |
2184 | - $line = &$parameters['line']; |
|
2184 | + $line = &$parameters['line']; |
|
2185 | 2185 | |
2186 | - $ThtmlData['data-id'] = $line->id; |
|
2187 | - $ThtmlData['data-product_type'] = $line->product_type; |
|
2188 | - $ThtmlData['data-qty'] = 0; //$line->qty; |
|
2189 | - $ThtmlData['data-level'] = TSubtotal::getNiveau($line); |
|
2186 | + $ThtmlData['data-id'] = $line->id; |
|
2187 | + $ThtmlData['data-product_type'] = $line->product_type; |
|
2188 | + $ThtmlData['data-qty'] = 0; //$line->qty; |
|
2189 | + $ThtmlData['data-level'] = TSubtotal::getNiveau($line); |
|
2190 | 2190 | |
2191 | - if(TSubtotal::isTitle($line)){ |
|
2192 | - $ThtmlData['data-issubtotal'] = 'title'; |
|
2193 | - }elseif(TSubtotal::isSubtotal($line)){ |
|
2194 | - $ThtmlData['data-issubtotal'] = 'subtotal'; |
|
2195 | - } |
|
2196 | - else{ |
|
2197 | - $ThtmlData['data-issubtotal'] = 'freetext'; |
|
2198 | - } |
|
2191 | + if(TSubtotal::isTitle($line)){ |
|
2192 | + $ThtmlData['data-issubtotal'] = 'title'; |
|
2193 | + }elseif(TSubtotal::isSubtotal($line)){ |
|
2194 | + $ThtmlData['data-issubtotal'] = 'subtotal'; |
|
2195 | + } |
|
2196 | + else{ |
|
2197 | + $ThtmlData['data-issubtotal'] = 'freetext'; |
|
2198 | + } |
|
2199 | 2199 | |
2200 | 2200 | |
2201 | - // Change or add data from hooks |
|
2202 | - $parameters = array_replace($parameters , array( 'ThtmlData' => $ThtmlData ) ); |
|
2201 | + // Change or add data from hooks |
|
2202 | + $parameters = array_replace($parameters , array( 'ThtmlData' => $ThtmlData ) ); |
|
2203 | 2203 | |
2204 | - // hook |
|
2205 | - $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
|
2206 | - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
2207 | - if ($reshook>0) |
|
2208 | - { |
|
2209 | - $ThtmlData = $hookmanager->resArray; |
|
2210 | - } |
|
2211 | - |
|
2212 | - return $this->implodeHtmlData($ThtmlData); |
|
2204 | + // hook |
|
2205 | + $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
|
2206 | + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
2207 | + if ($reshook>0) |
|
2208 | + { |
|
2209 | + $ThtmlData = $hookmanager->resArray; |
|
2210 | + } |
|
2211 | + |
|
2212 | + return $this->implodeHtmlData($ThtmlData); |
|
2213 | 2213 | |
2214 | 2214 | } |
2215 | 2215 | |
2216 | 2216 | |
2217 | 2217 | function implodeHtmlData($ThtmlData = array()) |
2218 | 2218 | { |
2219 | - $data = ''; |
|
2220 | - foreach($ThtmlData as $k => $h ) |
|
2221 | - { |
|
2222 | - if(is_array($h)) |
|
2223 | - { |
|
2224 | - $h = json_encode($h); |
|
2225 | - } |
|
2219 | + $data = ''; |
|
2220 | + foreach($ThtmlData as $k => $h ) |
|
2221 | + { |
|
2222 | + if(is_array($h)) |
|
2223 | + { |
|
2224 | + $h = json_encode($h); |
|
2225 | + } |
|
2226 | 2226 | |
2227 | - $data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" '; |
|
2228 | - } |
|
2227 | + $data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" '; |
|
2228 | + } |
|
2229 | 2229 | |
2230 | - return $data; |
|
2230 | + return $data; |
|
2231 | 2231 | } |
2232 | 2232 | |
2233 | 2233 | function _ajax_block_order_js($object) |
2234 | 2234 | { |
2235 | - global $conf,$tagidfortablednd,$filepath,$langs; |
|
2235 | + global $conf,$tagidfortablednd,$filepath,$langs; |
|
2236 | 2236 | |
2237 | - /* |
|
2237 | + /* |
|
2238 | 2238 | * this part of js is base on dolibarr htdocs/core/tpl/ajaxrow.tpl.php |
2239 | 2239 | * for compatibility reasons we don't use tableDnD but jquery sortable |
2240 | 2240 | */ |
2241 | 2241 | |
2242 | - $id=$object->id; |
|
2243 | - $nboflines=(isset($object->lines)?count($object->lines):0); |
|
2244 | - $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1; |
|
2242 | + $id=$object->id; |
|
2243 | + $nboflines=(isset($object->lines)?count($object->lines):0); |
|
2244 | + $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1; |
|
2245 | 2245 | |
2246 | - $id=$object->id; |
|
2247 | - $fk_element=$object->fk_element; |
|
2248 | - $table_element_line=$object->table_element_line; |
|
2249 | - $nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines)); |
|
2250 | - $tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd); |
|
2251 | - $filepath=(empty($filepath)?'':$filepath); |
|
2246 | + $id=$object->id; |
|
2247 | + $fk_element=$object->fk_element; |
|
2248 | + $table_element_line=$object->table_element_line; |
|
2249 | + $nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines)); |
|
2250 | + $tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd); |
|
2251 | + $filepath=(empty($filepath)?'':$filepath); |
|
2252 | 2252 | |
2253 | 2253 | |
2254 | - if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1) |
|
2255 | - { |
|
2254 | + if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1) |
|
2255 | + { |
|
2256 | 2256 | |
2257 | - ?> |
|
2257 | + ?> |
|
2258 | 2258 | |
2259 | 2259 | |
2260 | 2260 | <script type="text/javascript"> |
@@ -51,43 +51,43 @@ discard block |
||
51 | 51 | |
52 | 52 | function formObjectOptions($parameters, &$object, &$action, $hookmanager) |
53 | 53 | { |
54 | - global $langs,$db,$user, $conf; |
|
54 | + global $langs, $db, $user, $conf; |
|
55 | 55 | |
56 | 56 | $langs->load('subtotal@subtotal'); |
57 | 57 | |
58 | - $contexts = explode(':',$parameters['context']); |
|
58 | + $contexts = explode(':', $parameters['context']); |
|
59 | 59 | |
60 | - if(in_array('ordercard',$contexts) || in_array('ordersuppliercard',$contexts) || in_array('propalcard',$contexts) || in_array('supplier_proposalcard',$contexts) || in_array('invoicecard',$contexts) || in_array('invoicesuppliercard',$contexts) || in_array('invoicereccard',$contexts)) { |
|
60 | + if (in_array('ordercard', $contexts) || in_array('ordersuppliercard', $contexts) || in_array('propalcard', $contexts) || in_array('supplier_proposalcard', $contexts) || in_array('invoicecard', $contexts) || in_array('invoicesuppliercard', $contexts) || in_array('invoicereccard', $contexts)) { |
|
61 | 61 | |
62 | 62 | $createRight = $user->rights->{$object->element}->creer; |
63 | - if($object->element == 'facturerec' ) |
|
63 | + if ($object->element == 'facturerec') |
|
64 | 64 | { |
65 | 65 | $object->statut = 0; // hack for facture rec |
66 | 66 | $createRight = $user->rights->facture->creer; |
67 | - } elseif($object->element == 'order_supplier' ) |
|
67 | + } elseif ($object->element == 'order_supplier') |
|
68 | 68 | { |
69 | 69 | $createRight = $user->rights->fournisseur->commande->creer; |
70 | - } elseif($object->element == 'invoice_supplier' ) |
|
70 | + } elseif ($object->element == 'invoice_supplier') |
|
71 | 71 | { |
72 | 72 | $createRight = $user->rights->fournisseur->facture->creer; |
73 | 73 | } |
74 | 74 | |
75 | - if ($object->statut == 0 && $createRight) { |
|
75 | + if ($object->statut == 0 && $createRight) { |
|
76 | 76 | |
77 | 77 | |
78 | - if($object->element=='facture')$idvar = 'facid'; |
|
79 | - else $idvar='id'; |
|
78 | + if ($object->element == 'facture')$idvar = 'facid'; |
|
79 | + else $idvar = 'id'; |
|
80 | 80 | |
81 | - if(in_array($action, array('add_title_line', 'add_total_line', 'add_subtitle_line', 'add_subtotal_line', 'add_free_text')) ) |
|
81 | + if (in_array($action, array('add_title_line', 'add_total_line', 'add_subtitle_line', 'add_subtotal_line', 'add_free_text'))) |
|
82 | 82 | { |
83 | 83 | $level = GETPOST('level', 'int'); //New avec SUBTOTAL_USE_NEW_FORMAT |
84 | 84 | |
85 | - if($action=='add_title_line') { |
|
85 | + if ($action == 'add_title_line') { |
|
86 | 86 | $title = GETPOST('title'); |
87 | - if(empty($title)) $title = $langs->trans('title'); |
|
88 | - $qty = $level<1 ? 1 : $level ; |
|
87 | + if (empty($title)) $title = $langs->trans('title'); |
|
88 | + $qty = $level < 1 ? 1 : $level; |
|
89 | 89 | } |
90 | - else if($action=='add_free_text') { |
|
90 | + else if ($action == 'add_free_text') { |
|
91 | 91 | $title = GETPOST('title'); |
92 | 92 | |
93 | 93 | if (empty($title)) { |
@@ -99,21 +99,21 @@ discard block |
||
99 | 99 | } |
100 | 100 | } |
101 | 101 | } |
102 | - if(empty($title)) $title = $langs->trans('subtotalAddLineDescription'); |
|
102 | + if (empty($title)) $title = $langs->trans('subtotalAddLineDescription'); |
|
103 | 103 | $qty = 50; |
104 | 104 | } |
105 | - else if($action=='add_subtitle_line') { |
|
105 | + else if ($action == 'add_subtitle_line') { |
|
106 | 106 | $title = GETPOST('title'); |
107 | - if(empty($title)) $title = $langs->trans('subtitle'); |
|
107 | + if (empty($title)) $title = $langs->trans('subtitle'); |
|
108 | 108 | $qty = 2; |
109 | 109 | } |
110 | - else if($action=='add_subtotal_line') { |
|
110 | + else if ($action == 'add_subtotal_line') { |
|
111 | 111 | $title = $langs->trans('SubSubTotal'); |
112 | 112 | $qty = 98; |
113 | 113 | } |
114 | 114 | else { |
115 | 115 | $title = GETPOST('title') ? GETPOST('title') : $langs->trans('SubTotal'); |
116 | - $qty = $level ? 100-$level : 99; |
|
116 | + $qty = $level ? 100 - $level : 99; |
|
117 | 117 | } |
118 | 118 | dol_include_once('/subtotal/class/subtotal.class.php'); |
119 | 119 | |
@@ -121,15 +121,15 @@ discard block |
||
121 | 121 | |
122 | 122 | TSubtotal::addSubTotalLine($object, $title, $qty); |
123 | 123 | } |
124 | - else if($action==='ask_deleteallline') { |
|
125 | - $form=new Form($db); |
|
124 | + else if ($action === 'ask_deleteallline') { |
|
125 | + $form = new Form($db); |
|
126 | 126 | |
127 | - $lineid = GETPOST('lineid','integer'); |
|
127 | + $lineid = GETPOST('lineid', 'integer'); |
|
128 | 128 | $TIdForGroup = $this->getArrayOfLineForAGroup($object, $lineid); |
129 | 129 | |
130 | 130 | $nbLines = count($TIdForGroup); |
131 | 131 | |
132 | - $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('deleteWithAllLines'), $langs->trans('ConfirmDeleteAllThisLines',$nbLines), 'confirm_delete_all_lines','',0,1); |
|
132 | + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('deleteWithAllLines'), $langs->trans('ConfirmDeleteAllThisLines', $nbLines), 'confirm_delete_all_lines', '', 0, 1); |
|
133 | 133 | print $formconfirm; |
134 | 134 | } |
135 | 135 | |
@@ -139,13 +139,13 @@ discard block |
||
139 | 139 | } |
140 | 140 | |
141 | 141 | |
142 | - if($action!='editline') { |
|
142 | + if ($action != 'editline') { |
|
143 | 143 | // New format is for 3.8 |
144 | 144 | $this->printNewFormat($object, $conf, $langs, $idvar); |
145 | 145 | } |
146 | 146 | } |
147 | 147 | } |
148 | - elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice',$contexts)) |
|
148 | + elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice', $contexts)) |
|
149 | 149 | { |
150 | 150 | ?> |
151 | 151 | <script type="text/javascript"> |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | $(document).ready(function() { |
171 | 171 | $('div.fiche div.tabsAction').append('<br />'); |
172 | 172 | |
173 | - $('div.fiche div.tabsAction').append('<div class="inline-block divButAction"><a id="add_title_line" rel="add_title_line" href="javascript:;" class="butAction"><?php echo $langs->trans('AddTitle' )?></a></div>'); |
|
173 | + $('div.fiche div.tabsAction').append('<div class="inline-block divButAction"><a id="add_title_line" rel="add_title_line" href="javascript:;" class="butAction"><?php echo $langs->trans('AddTitle')?></a></div>'); |
|
174 | 174 | $('div.fiche div.tabsAction').append('<div class="inline-block divButAction"><a id="add_total_line" rel="add_total_line" href="javascript:;" class="butAction"><?php echo $langs->trans('AddSubTotal')?></a></div>'); |
175 | 175 | $('div.fiche div.tabsAction').append('<div class="inline-block divButAction"><a id="add_free_text" rel="add_free_text" href="javascript:;" class="butAction"><?php echo $langs->trans('AddFreeText')?></a></div>'); |
176 | 176 | |
@@ -221,9 +221,9 @@ discard block |
||
221 | 221 | $('body').append(dialog_html); |
222 | 222 | |
223 | 223 | <?php |
224 | - $editorTool = empty($conf->global->FCKEDITOR_EDITORNAME)?'ckeditor':$conf->global->FCKEDITOR_EDITORNAME; |
|
225 | - $editorConf = empty($conf->global->FCKEDITOR_ENABLE_DETAILS)?false:$conf->global->FCKEDITOR_ENABLE_DETAILS; |
|
226 | - if($editorConf && in_array($editorTool,array('textarea','ckeditor'))){ |
|
224 | + $editorTool = empty($conf->global->FCKEDITOR_EDITORNAME) ? 'ckeditor' : $conf->global->FCKEDITOR_EDITORNAME; |
|
225 | + $editorConf = empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ?false:$conf->global->FCKEDITOR_ENABLE_DETAILS; |
|
226 | + if ($editorConf && in_array($editorTool, array('textarea', 'ckeditor'))) { |
|
227 | 227 | ?> |
228 | 228 | if (action == 'addTitle' || action == 'addFreeTxt') |
229 | 229 | { |
@@ -338,62 +338,62 @@ discard block |
||
338 | 338 | global $conf, $langs, $bc; |
339 | 339 | |
340 | 340 | $action = GETPOST('action'); |
341 | - $TContext = explode(':',$parameters['context']); |
|
341 | + $TContext = explode(':', $parameters['context']); |
|
342 | 342 | if ( |
343 | - in_array('invoicecard',$TContext) |
|
344 | - || in_array('invoicesuppliercard',$TContext) |
|
345 | - || in_array('propalcard',$TContext) |
|
346 | - || in_array('ordercard',$TContext) |
|
347 | - || in_array('ordersuppliercard',$TContext) |
|
348 | - || in_array('invoicereccard',$TContext) |
|
343 | + in_array('invoicecard', $TContext) |
|
344 | + || in_array('invoicesuppliercard', $TContext) |
|
345 | + || in_array('propalcard', $TContext) |
|
346 | + || in_array('ordercard', $TContext) |
|
347 | + || in_array('ordersuppliercard', $TContext) |
|
348 | + || in_array('invoicereccard', $TContext) |
|
349 | 349 | ) |
350 | 350 | { |
351 | - $hideInnerLines = isset( $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']] ) ? $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']] : 0; |
|
352 | - $hidedetails = isset( $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']] ) ? $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']] : 0; |
|
353 | - $hidepricesDefaultConf = !empty($conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED)?$conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED:0; |
|
354 | - $hideprices= isset( $_SESSION['subtotal_hideprices_'.$parameters['modulepart']] ) ? $_SESSION['subtotal_hideprices_'.$parameters['modulepart']] : $hidepricesDefaultConf; |
|
351 | + $hideInnerLines = isset($_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']]) ? $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']] : 0; |
|
352 | + $hidedetails = isset($_SESSION['subtotal_hidedetails_'.$parameters['modulepart']]) ? $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']] : 0; |
|
353 | + $hidepricesDefaultConf = !empty($conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED) ? $conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED : 0; |
|
354 | + $hideprices = isset($_SESSION['subtotal_hideprices_'.$parameters['modulepart']]) ? $_SESSION['subtotal_hideprices_'.$parameters['modulepart']] : $hidepricesDefaultConf; |
|
355 | 355 | |
356 | - $var=false; |
|
357 | - $out.= '<tr '.$bc[$var].'> |
|
356 | + $var = false; |
|
357 | + $out .= '<tr '.$bc[$var].'> |
|
358 | 358 | <td colspan="4" align="right"> |
359 | 359 | <label for="hideInnerLines">'.$langs->trans('HideInnerLines').'</label> |
360 | - <input type="checkbox" onclick="if($(this).is(\':checked\')) { $(\'#hidedetails\').prop(\'checked\', \'checked\') }" id="hideInnerLines" name="hideInnerLines" value="1" '.(( $hideInnerLines ) ? 'checked="checked"' : '' ).' /> |
|
360 | + <input type="checkbox" onclick="if($(this).is(\':checked\')) { $(\'#hidedetails\').prop(\'checked\', \'checked\') }" id="hideInnerLines" name="hideInnerLines" value="1" '.(($hideInnerLines) ? 'checked="checked"' : '').' /> |
|
361 | 361 | </td> |
362 | 362 | </tr>'; |
363 | 363 | |
364 | - $var=!$var; |
|
365 | - $out.= '<tr '.$bc[$var].'> |
|
364 | + $var = !$var; |
|
365 | + $out .= '<tr '.$bc[$var].'> |
|
366 | 366 | <td colspan="4" align="right"> |
367 | 367 | <label for="hidedetails">'.$langs->trans('SubTotalhidedetails').'</label> |
368 | - <input type="checkbox" id="hidedetails" name="hidedetails" value="1" '.(( $hidedetails ) ? 'checked="checked"' : '' ).' /> |
|
368 | + <input type="checkbox" id="hidedetails" name="hidedetails" value="1" '.(($hidedetails) ? 'checked="checked"' : '').' /> |
|
369 | 369 | </td> |
370 | 370 | </tr>'; |
371 | 371 | |
372 | - $var=!$var; |
|
373 | - $out.= '<tr '.$bc[$var].'> |
|
372 | + $var = !$var; |
|
373 | + $out .= '<tr '.$bc[$var].'> |
|
374 | 374 | <td colspan="4" align="right"> |
375 | 375 | <label for="hidedetails">'.$langs->trans('SubTotalhidePrice').'</label> |
376 | - <input type="checkbox" id="hideprices" name="hideprices" value="1" '.(( $hideprices ) ? 'checked="checked"' : '' ).' /> |
|
376 | + <input type="checkbox" id="hideprices" name="hideprices" value="1" '.(($hideprices) ? 'checked="checked"' : '').' /> |
|
377 | 377 | </td> |
378 | 378 | </tr>'; |
379 | 379 | |
380 | 380 | |
381 | 381 | |
382 | 382 | if ( |
383 | - (in_array('propalcard',$TContext) && !empty($conf->global->SUBTOTAL_PROPAL_ADD_RECAP)) |
|
384 | - || (in_array('ordercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
385 | - || (in_array('ordersuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
386 | - || (in_array('invoicecard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
387 | - || (in_array('invoicesuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
388 | - || (in_array('invoicereccard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP )) |
|
383 | + (in_array('propalcard', $TContext) && !empty($conf->global->SUBTOTAL_PROPAL_ADD_RECAP)) |
|
384 | + || (in_array('ordercard', $TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
385 | + || (in_array('ordersuppliercard', $TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
386 | + || (in_array('invoicecard', $TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
387 | + || (in_array('invoicesuppliercard', $TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
388 | + || (in_array('invoicereccard', $TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
389 | 389 | ) |
390 | 390 | { |
391 | - $var=!$var; |
|
392 | - $out.= ' |
|
391 | + $var = !$var; |
|
392 | + $out .= ' |
|
393 | 393 | <tr '.$bc[$var].'> |
394 | 394 | <td colspan="4" align="right"> |
395 | 395 | <label for="subtotal_add_recap">'.$langs->trans('subtotal_add_recap').'</label> |
396 | - <input type="checkbox" id="subtotal_add_recap" name="subtotal_add_recap" value="1" '.( GETPOST('subtotal_add_recap') ? 'checked="checked"' : '' ).' /> |
|
396 | + <input type="checkbox" id="subtotal_add_recap" name="subtotal_add_recap" value="1" '.(GETPOST('subtotal_add_recap') ? 'checked="checked"' : '').' /> |
|
397 | 397 | </td> |
398 | 398 | </tr>'; |
399 | 399 | } |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | function formEditProductOptions($parameters, &$object, &$action, $hookmanager) |
410 | 410 | { |
411 | 411 | |
412 | - if (in_array('invoicecard',explode(':',$parameters['context']))) |
|
412 | + if (in_array('invoicecard', explode(':', $parameters['context']))) |
|
413 | 413 | { |
414 | 414 | |
415 | 415 | } |
@@ -420,13 +420,13 @@ discard block |
||
420 | 420 | function ODTSubstitutionLine(&$parameters, &$object, $action, $hookmanager) { |
421 | 421 | global $conf; |
422 | 422 | |
423 | - if($action === 'builddoc') { |
|
423 | + if ($action === 'builddoc') { |
|
424 | 424 | |
425 | 425 | $line = &$parameters['line']; |
426 | 426 | $object = &$parameters['object']; |
427 | 427 | $substitutionarray = &$parameters['substitutionarray']; |
428 | 428 | |
429 | - if($line->product_type == 9 && $line->special_code == $this->module_number) { |
|
429 | + if ($line->product_type == 9 && $line->special_code == $this->module_number) { |
|
430 | 430 | $substitutionarray['line_modsubtotal'] = 1; |
431 | 431 | |
432 | 432 | $substitutionarray['line_price_ht'] |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | = $substitutionarray['line_up'] |
438 | 438 | = ''; |
439 | 439 | |
440 | - if($line->qty>90) { |
|
440 | + if ($line->qty > 90) { |
|
441 | 441 | $substitutionarray['line_modsubtotal_total'] = true; |
442 | 442 | |
443 | 443 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | |
452 | 452 | |
453 | 453 | } |
454 | - else{ |
|
454 | + else { |
|
455 | 455 | $substitutionarray['line_not_modsubtotal'] = true; |
456 | 456 | $substitutionarray['line_modsubtotal'] = 0; |
457 | 457 | } |
@@ -463,29 +463,29 @@ discard block |
||
463 | 463 | function createFrom($parameters, &$object, $action, $hookmanager) { |
464 | 464 | |
465 | 465 | if ( |
466 | - in_array('invoicecard',explode(':',$parameters['context'])) |
|
467 | - || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
468 | - || in_array('propalcard',explode(':',$parameters['context'])) |
|
469 | - || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
470 | - || in_array('ordercard',explode(':',$parameters['context'])) |
|
471 | - || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
472 | - || in_array('invoicereccard',explode(':',$parameters['context'])) |
|
466 | + in_array('invoicecard', explode(':', $parameters['context'])) |
|
467 | + || in_array('invoicesuppliercard', explode(':', $parameters['context'])) |
|
468 | + || in_array('propalcard', explode(':', $parameters['context'])) |
|
469 | + || in_array('supplier_proposalcard', explode(':', $parameters['context'])) |
|
470 | + || in_array('ordercard', explode(':', $parameters['context'])) |
|
471 | + || in_array('ordersuppliercard', explode(':', $parameters['context'])) |
|
472 | + || in_array('invoicereccard', explode(':', $parameters['context'])) |
|
473 | 473 | ) { |
474 | 474 | |
475 | 475 | global $db; |
476 | 476 | |
477 | 477 | $objFrom = $parameters['objFrom']; |
478 | 478 | |
479 | - foreach($objFrom->lines as $k=> &$lineOld) { |
|
479 | + foreach ($objFrom->lines as $k=> &$lineOld) { |
|
480 | 480 | |
481 | - if($lineOld->product_type == 9 && $lineOld->info_bits > 0 ) { |
|
481 | + if ($lineOld->product_type == 9 && $lineOld->info_bits > 0) { |
|
482 | 482 | |
483 | 483 | $line = & $object->lines[$k]; |
484 | 484 | |
485 | 485 | $idLine = (int) ($line->id ? $line->id : $line->rowid); |
486 | 486 | |
487 | 487 | $db->query("UPDATE ".MAIN_DB_PREFIX.$line->table_element." |
488 | - SET info_bits=".(int)$lineOld->info_bits." |
|
488 | + SET info_bits=".(int) $lineOld->info_bits." |
|
489 | 489 | WHERE rowid = ".$idLine." |
490 | 490 | "); |
491 | 491 | |
@@ -501,15 +501,15 @@ discard block |
||
501 | 501 | |
502 | 502 | function doActions($parameters, &$object, $action, $hookmanager) |
503 | 503 | { |
504 | - global $db, $conf, $langs,$user; |
|
504 | + global $db, $conf, $langs, $user; |
|
505 | 505 | |
506 | 506 | dol_include_once('/subtotal/class/subtotal.class.php'); |
507 | 507 | dol_include_once('/subtotal/lib/subtotal.lib.php'); |
508 | - require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; |
|
508 | + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; |
|
509 | 509 | |
510 | 510 | $showBlockExtrafields = GETPOST('showBlockExtrafields'); |
511 | 511 | |
512 | - if($object->element=='facture') $idvar = 'facid'; |
|
512 | + if ($object->element == 'facture') $idvar = 'facid'; |
|
513 | 513 | else $idvar = 'id'; |
514 | 514 | |
515 | 515 | if ($action == 'updateligne' || $action == 'updateline') |
@@ -522,7 +522,7 @@ discard block |
||
522 | 522 | if ($line->id == $lineid && TSubtotal::isModSubtotalLine($line)) |
523 | 523 | { |
524 | 524 | $found = true; |
525 | - if(TSubtotal::isTitle($line) && !empty($showBlockExtrafields)) { |
|
525 | + if (TSubtotal::isTitle($line) && !empty($showBlockExtrafields)) { |
|
526 | 526 | $extrafieldsline = new ExtraFields($db); |
527 | 527 | $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); |
528 | 528 | $extrafieldsline->setOptionalsFromPost($extralabelsline, $line); |
@@ -541,43 +541,43 @@ discard block |
||
541 | 541 | exit; // Surtout ne pas laisser Dolibarr faire du traitement sur le updateligne sinon ça plante les données de la ligne |
542 | 542 | } |
543 | 543 | } |
544 | - else if($action === 'builddoc') { |
|
544 | + else if ($action === 'builddoc') { |
|
545 | 545 | |
546 | 546 | if ( |
547 | - in_array('invoicecard',explode(':',$parameters['context'])) |
|
548 | - || in_array('propalcard',explode(':',$parameters['context'])) |
|
549 | - || in_array('ordercard',explode(':',$parameters['context'])) |
|
550 | - || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
551 | - || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
552 | - || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
547 | + in_array('invoicecard', explode(':', $parameters['context'])) |
|
548 | + || in_array('propalcard', explode(':', $parameters['context'])) |
|
549 | + || in_array('ordercard', explode(':', $parameters['context'])) |
|
550 | + || in_array('ordersuppliercard', explode(':', $parameters['context'])) |
|
551 | + || in_array('invoicesuppliercard', explode(':', $parameters['context'])) |
|
552 | + || in_array('supplier_proposalcard', explode(':', $parameters['context'])) |
|
553 | 553 | ) |
554 | 554 | { |
555 | - if(in_array('invoicecard',explode(':',$parameters['context']))) { |
|
555 | + if (in_array('invoicecard', explode(':', $parameters['context']))) { |
|
556 | 556 | $sessname = 'subtotal_hideInnerLines_facture'; |
557 | 557 | $sessname2 = 'subtotal_hidedetails_facture'; |
558 | 558 | $sessname3 = 'subtotal_hideprices_facture'; |
559 | 559 | } |
560 | - elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) { |
|
560 | + elseif (in_array('invoicesuppliercard', explode(':', $parameters['context']))) { |
|
561 | 561 | $sessname = 'subtotal_hideInnerLines_facture_fournisseur'; |
562 | 562 | $sessname2 = 'subtotal_hidedetails_facture_fournisseur'; |
563 | 563 | $sessname3 = 'subtotal_hideprices_facture_fournisseur'; |
564 | 564 | } |
565 | - elseif(in_array('propalcard',explode(':',$parameters['context']))) { |
|
565 | + elseif (in_array('propalcard', explode(':', $parameters['context']))) { |
|
566 | 566 | $sessname = 'subtotal_hideInnerLines_propal'; |
567 | 567 | $sessname2 = 'subtotal_hidedetails_propal'; |
568 | 568 | $sessname3 = 'subtotal_hideprices_propal'; |
569 | 569 | } |
570 | - elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) { |
|
570 | + elseif (in_array('supplier_proposalcard', explode(':', $parameters['context']))) { |
|
571 | 571 | $sessname = 'subtotal_hideInnerLines_supplier_proposal'; |
572 | 572 | $sessname2 = 'subtotal_hidedetails_supplier_proposal'; |
573 | 573 | $sessname3 = 'subtotal_hideprices_supplier_proposal'; |
574 | 574 | } |
575 | - elseif(in_array('ordercard',explode(':',$parameters['context']))) { |
|
575 | + elseif (in_array('ordercard', explode(':', $parameters['context']))) { |
|
576 | 576 | $sessname = 'subtotal_hideInnerLines_commande'; |
577 | 577 | $sessname2 = 'subtotal_hidedetails_commande'; |
578 | 578 | $sessname3 = 'subtotal_hideprices_commande'; |
579 | 579 | } |
580 | - elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) { |
|
580 | + elseif (in_array('ordersuppliercard', explode(':', $parameters['context']))) { |
|
581 | 581 | $sessname = 'subtotal_hideInnerLines_commande_fournisseur'; |
582 | 582 | $sessname2 = 'subtotal_hidedetails_commande_fournisseur'; |
583 | 583 | $sessname3 = 'subtotal_hideprices_commande_fournisseur'; |
@@ -590,22 +590,22 @@ discard block |
||
590 | 590 | |
591 | 591 | global $hideprices; |
592 | 592 | |
593 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
593 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
594 | 594 | $_SESSION[$sessname] = $hideInnerLines; |
595 | 595 | |
596 | - $hidedetails= (int)GETPOST('hidedetails'); |
|
596 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
597 | 597 | $_SESSION[$sessname2] = $hidedetails; |
598 | 598 | |
599 | - $hideprices= (int)GETPOST('hideprices'); |
|
599 | + $hideprices = (int) GETPOST('hideprices'); |
|
600 | 600 | $_SESSION[$sessname3] = $hideprices; |
601 | 601 | |
602 | - foreach($object->lines as &$line) { |
|
602 | + foreach ($object->lines as &$line) { |
|
603 | 603 | if ($line->product_type == 9 && $line->special_code == $this->module_number) { |
604 | 604 | |
605 | - if($line->qty>=90) { |
|
605 | + if ($line->qty >= 90) { |
|
606 | 606 | $line->modsubtotal_total = 1; |
607 | 607 | } |
608 | - else{ |
|
608 | + else { |
|
609 | 609 | $line->modsubtotal_title = 1; |
610 | 610 | } |
611 | 611 | |
@@ -615,34 +615,34 @@ discard block |
||
615 | 615 | } |
616 | 616 | |
617 | 617 | } |
618 | - else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') { |
|
618 | + else if ($action === 'confirm_delete_all_lines' && GETPOST('confirm') == 'yes') { |
|
619 | 619 | |
620 | 620 | $Tab = $this->getArrayOfLineForAGroup($object, GETPOST('lineid')); |
621 | 621 | |
622 | - foreach($Tab as $idLine) { |
|
622 | + foreach ($Tab as $idLine) { |
|
623 | 623 | /** |
624 | 624 | * @var $object Facture |
625 | 625 | */ |
626 | - if($object->element=='facture') $object->deleteline($idLine); |
|
626 | + if ($object->element == 'facture') $object->deleteline($idLine); |
|
627 | 627 | /** |
628 | 628 | * @var $object Facture fournisseur |
629 | 629 | */ |
630 | - else if($object->element=='invoice_supplier') |
|
630 | + else if ($object->element == 'invoice_supplier') |
|
631 | 631 | { |
632 | 632 | $object->deleteline($idLine); |
633 | 633 | } |
634 | 634 | /** |
635 | 635 | * @var $object Propal |
636 | 636 | */ |
637 | - else if($object->element=='propal') $object->deleteline($idLine); |
|
637 | + else if ($object->element == 'propal') $object->deleteline($idLine); |
|
638 | 638 | /** |
639 | 639 | * @var $object Propal Fournisseur |
640 | 640 | */ |
641 | - else if($object->element=='supplier_proposal') $object->deleteline($idLine); |
|
641 | + else if ($object->element == 'supplier_proposal') $object->deleteline($idLine); |
|
642 | 642 | /** |
643 | 643 | * @var $object Commande |
644 | 644 | */ |
645 | - else if($object->element=='commande') |
|
645 | + else if ($object->element == 'commande') |
|
646 | 646 | { |
647 | 647 | if ((float) DOL_VERSION >= 5.0) $object->deleteline($user, $idLine); |
648 | 648 | else $object->deleteline($idLine); |
@@ -650,14 +650,14 @@ discard block |
||
650 | 650 | /** |
651 | 651 | * @var $object Commande fournisseur |
652 | 652 | */ |
653 | - else if($object->element=='order_supplier') |
|
653 | + else if ($object->element == 'order_supplier') |
|
654 | 654 | { |
655 | 655 | $object->deleteline($idLine); |
656 | 656 | } |
657 | 657 | /** |
658 | 658 | * @var $object Facturerec |
659 | 659 | */ |
660 | - else if($object->element=='facturerec') $object->deleteline($idLine); |
|
660 | + else if ($object->element == 'facturerec') $object->deleteline($idLine); |
|
661 | 661 | } |
662 | 662 | |
663 | 663 | header('location:?id='.$object->id); |
@@ -680,7 +680,7 @@ discard block |
||
680 | 680 | return 0; |
681 | 681 | } |
682 | 682 | |
683 | - function formAddObjectLine ($parameters, &$object, &$action, $hookmanager) { |
|
683 | + function formAddObjectLine($parameters, &$object, &$action, $hookmanager) { |
|
684 | 684 | return 0; |
685 | 685 | } |
686 | 686 | |
@@ -692,22 +692,22 @@ discard block |
||
692 | 692 | |
693 | 693 | $found = false; |
694 | 694 | |
695 | - $Tab= array(); |
|
695 | + $Tab = array(); |
|
696 | 696 | |
697 | - foreach($object->lines as $l) { |
|
697 | + foreach ($object->lines as $l) { |
|
698 | 698 | |
699 | 699 | $lid = (!empty($l->rowid) ? $l->rowid : $l->id); |
700 | - if($lid == $lineid) { |
|
700 | + if ($lid == $lineid) { |
|
701 | 701 | |
702 | 702 | $found = true; |
703 | 703 | $qty_line = $l->qty; |
704 | 704 | } |
705 | 705 | |
706 | - if($found) { |
|
706 | + if ($found) { |
|
707 | 707 | |
708 | 708 | $Tab[] = (!empty($l->rowid) ? $l->rowid : $l->id); |
709 | 709 | |
710 | - if($l->special_code==$this->module_number && (($l->qty==99 && $qty_line==1) || ($l->qty==98 && $qty_line==2)) ) { |
|
710 | + if ($l->special_code == $this->module_number && (($l->qty == 99 && $qty_line == 1) || ($l->qty == 98 && $qty_line == 2))) { |
|
711 | 711 | break; // end of story |
712 | 712 | } |
713 | 713 | } |
@@ -736,7 +736,7 @@ discard block |
||
736 | 736 | * |
737 | 737 | * @param $use_level isn't used anymore |
738 | 738 | */ |
739 | - function getTotalLineFromObject(&$object, &$line, $use_level=false, $return_all=0) { |
|
739 | + function getTotalLineFromObject(&$object, &$line, $use_level = false, $return_all = 0) { |
|
740 | 740 | |
741 | 741 | $rang = $line->rang; |
742 | 742 | $qty_line = $line->qty; |
@@ -747,21 +747,21 @@ discard block |
||
747 | 747 | $TTotal_tva = array(); |
748 | 748 | |
749 | 749 | dol_include_once('/subtotal/class/subtotal.class.php'); |
750 | - foreach($object->lines as $l) { |
|
750 | + foreach ($object->lines as $l) { |
|
751 | 751 | //print $l->rang.'>='.$rang.' '.$total.'<br/>'; |
752 | - if($l->rang>=$rang) { |
|
752 | + if ($l->rang >= $rang) { |
|
753 | 753 | //echo 'return!<br>'; |
754 | 754 | if (!$return_all) return $total; |
755 | 755 | else return array($total, $total_tva, $total_ttc, $TTotal_tva); |
756 | 756 | } |
757 | - else if(TSubtotal::isTitle($l, 100 - $qty_line)) |
|
757 | + else if (TSubtotal::isTitle($l, 100 - $qty_line)) |
|
758 | 758 | { |
759 | 759 | $total = 0; |
760 | 760 | $total_tva = 0; |
761 | 761 | $total_ttc = 0; |
762 | 762 | $TTotal_tva = array(); |
763 | 763 | } |
764 | - elseif(!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) { |
|
764 | + elseif (!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) { |
|
765 | 765 | $total += $l->total_ht; |
766 | 766 | $total_tva += $l->total_tva; |
767 | 767 | $TTotal_tva[$l->tva_tx] += $l->total_tva; |
@@ -780,18 +780,18 @@ discard block |
||
780 | 780 | |
781 | 781 | $rang = $line->rang; |
782 | 782 | $total = 0; |
783 | - foreach($object->lines as $l) { |
|
784 | - if($l->rang>=$rang) { |
|
783 | + foreach ($object->lines as $l) { |
|
784 | + if ($l->rang >= $rang) { |
|
785 | 785 | return price($total); |
786 | 786 | } |
787 | - if (TSubtotal::isSubtotal($l)){ |
|
787 | + if (TSubtotal::isSubtotal($l)) { |
|
788 | 788 | $total = 0; |
789 | - } else if ($l->situation_percent > 0 ){ |
|
789 | + } else if ($l->situation_percent > 0) { |
|
790 | 790 | |
791 | 791 | |
792 | 792 | $prev_progress = $l->get_prev_progress($object->id); |
793 | - $progress = ($l->situation_percent - $prev_progress) /100; |
|
794 | - $total += ($l->total_ht/($l->situation_percent/100)) * $progress; |
|
793 | + $progress = ($l->situation_percent - $prev_progress) / 100; |
|
794 | + $total += ($l->total_ht / ($l->situation_percent / 100)) * $progress; |
|
795 | 795 | |
796 | 796 | } |
797 | 797 | } |
@@ -810,10 +810,10 @@ discard block |
||
810 | 810 | * @param $w float width |
811 | 811 | * @param $h float height |
812 | 812 | */ |
813 | - function pdf_add_total(&$pdf,&$object, &$line, $label, $description,$posx, $posy, $w, $h) { |
|
814 | - global $conf,$subtotal_last_title_posy; |
|
813 | + function pdf_add_total(&$pdf, &$object, &$line, $label, $description, $posx, $posy, $w, $h) { |
|
814 | + global $conf, $subtotal_last_title_posy; |
|
815 | 815 | |
816 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
816 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
817 | 817 | if (!empty($conf->global->SUBTOTAL_ONE_LINE_IF_HIDE_INNERLINES) && $hideInnerLines && !empty($subtotal_last_title_posy)) |
818 | 818 | { |
819 | 819 | $posy = $subtotal_last_title_posy; |
@@ -823,34 +823,34 @@ discard block |
||
823 | 823 | $hidePriceOnSubtotalLines = (int) GETPOST('hide_price_on_subtotal_lines'); |
824 | 824 | |
825 | 825 | $set_pagebreak_margin = false; |
826 | - if(method_exists('Closure','bind')) { |
|
826 | + if (method_exists('Closure', 'bind')) { |
|
827 | 827 | $pageBreakOriginalValue = $pdf->AcceptPageBreak(); |
828 | - $sweetsThief = function ($pdf) { |
|
829 | - return $pdf->bMargin ; |
|
828 | + $sweetsThief = function($pdf) { |
|
829 | + return $pdf->bMargin; |
|
830 | 830 | }; |
831 | 831 | $sweetsThief = Closure::bind($sweetsThief, null, $pdf); |
832 | 832 | |
833 | - $bMargin = $sweetsThief($pdf); |
|
833 | + $bMargin = $sweetsThief($pdf); |
|
834 | 834 | |
835 | - $pdf->SetAutoPageBreak( false ); |
|
835 | + $pdf->SetAutoPageBreak(false); |
|
836 | 836 | |
837 | 837 | $set_pagebreak_margin = true; |
838 | 838 | } |
839 | 839 | |
840 | 840 | |
841 | - if($line->qty==99) |
|
842 | - $pdf->SetFillColor(220,220,220); |
|
843 | - elseif ($line->qty==98) |
|
844 | - $pdf->SetFillColor(230,230,230); |
|
841 | + if ($line->qty == 99) |
|
842 | + $pdf->SetFillColor(220, 220, 220); |
|
843 | + elseif ($line->qty == 98) |
|
844 | + $pdf->SetFillColor(230, 230, 230); |
|
845 | 845 | else |
846 | - $pdf->SetFillColor(240,240,240); |
|
846 | + $pdf->SetFillColor(240, 240, 240); |
|
847 | 847 | |
848 | 848 | $style = 'B'; |
849 | 849 | if (!empty($conf->global->SUBTOTAL_SUBTOTAL_STYLE)) $style = $conf->global->SUBTOTAL_SUBTOTAL_STYLE; |
850 | 850 | |
851 | 851 | $pdf->SetFont('', $style, 9); |
852 | 852 | |
853 | - $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'R',true); |
|
853 | + $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'R', true); |
|
854 | 854 | // var_dump($bMargin); |
855 | 855 | $pageAfter = $pdf->getPage(); |
856 | 856 | |
@@ -875,7 +875,7 @@ discard block |
||
875 | 875 | } |
876 | 876 | } |
877 | 877 | |
878 | - if($total_to_print) { |
|
878 | + if ($total_to_print) { |
|
879 | 879 | |
880 | 880 | if (GETPOST('hideInnerLines')) |
881 | 881 | { |
@@ -889,7 +889,7 @@ discard block |
||
889 | 889 | else |
890 | 890 | { |
891 | 891 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
892 | - if(get_class($object) == 'Facture' && $object->type==Facture::TYPE_SITUATION){//Facture de situation |
|
892 | + if (get_class($object) == 'Facture' && $object->type == Facture::TYPE_SITUATION) {//Facture de situation |
|
893 | 893 | $total_to_print = $this->getTotalToPrintSituation($object, $line); |
894 | 894 | } else { |
895 | 895 | $total_to_print = price($total); |
@@ -903,11 +903,11 @@ discard block |
||
903 | 903 | } |
904 | 904 | |
905 | 905 | $pdf->SetXY($pdf->postotalht, $posy); |
906 | - if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
907 | - $pdf->MultiCell($pdf->page_largeur-$pdf->marge_droite-$pdf->postotalht, 3, $total_to_print, 0, 'R', 0); |
|
906 | + if ($set_pagebreak_margin) $pdf->SetAutoPageBreak($pageBreakOriginalValue, $bMargin); |
|
907 | + $pdf->MultiCell($pdf->page_largeur - $pdf->marge_droite - $pdf->postotalht, 3, $total_to_print, 0, 'R', 0); |
|
908 | 908 | } |
909 | - else{ |
|
910 | - if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
909 | + else { |
|
910 | + if ($set_pagebreak_margin) $pdf->SetAutoPageBreak($pageBreakOriginalValue, $bMargin); |
|
911 | 911 | } |
912 | 912 | |
913 | 913 | $posy = $posy + $cell_height; |
@@ -927,22 +927,22 @@ discard block |
||
927 | 927 | * @param $w float width |
928 | 928 | * @param $h float height |
929 | 929 | */ |
930 | - function pdf_add_title(&$pdf,&$object, &$line, $label, $description,$posx, $posy, $w, $h) { |
|
930 | + function pdf_add_title(&$pdf, &$object, &$line, $label, $description, $posx, $posy, $w, $h) { |
|
931 | 931 | |
932 | - global $db,$conf,$subtotal_last_title_posy; |
|
932 | + global $db, $conf, $subtotal_last_title_posy; |
|
933 | 933 | |
934 | 934 | $subtotal_last_title_posy = $posy; |
935 | - $pdf->SetXY ($posx, $posy); |
|
935 | + $pdf->SetXY($posx, $posy); |
|
936 | 936 | |
937 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
937 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
938 | 938 | |
939 | 939 | |
940 | 940 | |
941 | - $style = ($line->qty==1) ? 'BU' : 'BUI'; |
|
941 | + $style = ($line->qty == 1) ? 'BU' : 'BUI'; |
|
942 | 942 | if (!empty($conf->global->SUBTOTAL_TITLE_STYLE)) $style = $conf->global->SUBTOTAL_TITLE_STYLE; |
943 | 943 | |
944 | - if($hideInnerLines) { |
|
945 | - if($line->qty==1)$pdf->SetFont('', $style, 9); |
|
944 | + if ($hideInnerLines) { |
|
945 | + if ($line->qty == 1)$pdf->SetFont('', $style, 9); |
|
946 | 946 | else |
947 | 947 | { |
948 | 948 | if (!empty($conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES)) $style = $conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES; |
@@ -951,43 +951,43 @@ discard block |
||
951 | 951 | } |
952 | 952 | else { |
953 | 953 | |
954 | - if($line->qty==1)$pdf->SetFont('', $style, 9); //TODO if super utile |
|
954 | + if ($line->qty == 1)$pdf->SetFont('', $style, 9); //TODO if super utile |
|
955 | 955 | else $pdf->SetFont('', $style, 9); |
956 | 956 | |
957 | 957 | } |
958 | 958 | |
959 | 959 | if ($label === strip_tags($label) && $label === dol_html_entity_decode($label, ENT_QUOTES)) $pdf->MultiCell($w, $h, $label, 0, 'L'); // Pas de HTML dans la chaine |
960 | - else $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J',true); // et maintenant avec du HTML |
|
960 | + else $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J', true); // et maintenant avec du HTML |
|
961 | 961 | |
962 | - if($description && !$hidedesc) { |
|
962 | + if ($description && !$hidedesc) { |
|
963 | 963 | $posy = $pdf->GetY(); |
964 | 964 | |
965 | 965 | $pdf->SetFont('', '', 8); |
966 | 966 | |
967 | - $pdf->writeHTMLCell($w, $h, $posx, $posy, $description, 0, 1, false, true, 'J',true); |
|
967 | + $pdf->writeHTMLCell($w, $h, $posx, $posy, $description, 0, 1, false, true, 'J', true); |
|
968 | 968 | |
969 | 969 | } |
970 | 970 | |
971 | 971 | } |
972 | 972 | |
973 | - function pdf_writelinedesc_ref($parameters=array(), &$object, &$action='') { |
|
973 | + function pdf_writelinedesc_ref($parameters = array(), &$object, &$action = '') { |
|
974 | 974 | // ultimate PDF hook O_o |
975 | 975 | |
976 | - return $this->pdf_writelinedesc($parameters,$object,$action); |
|
976 | + return $this->pdf_writelinedesc($parameters, $object, $action); |
|
977 | 977 | |
978 | 978 | } |
979 | 979 | |
980 | 980 | function isModSubtotalLine(&$parameters, &$object) { |
981 | 981 | |
982 | - if(is_array($parameters)) { |
|
982 | + if (is_array($parameters)) { |
|
983 | 983 | $i = & $parameters['i']; |
984 | 984 | } |
985 | 985 | else { |
986 | - $i = (int)$parameters; |
|
986 | + $i = (int) $parameters; |
|
987 | 987 | } |
988 | 988 | |
989 | 989 | |
990 | - if($object->lines[$i]->special_code == $this->module_number && $object->lines[$i]->product_type == 9) { |
|
990 | + if ($object->lines[$i]->special_code == $this->module_number && $object->lines[$i]->product_type == 9) { |
|
991 | 991 | return true; |
992 | 992 | } |
993 | 993 | |
@@ -995,43 +995,43 @@ discard block |
||
995 | 995 | |
996 | 996 | } |
997 | 997 | |
998 | - function pdf_getlineqty($parameters=array(), &$object, &$action='') { |
|
999 | - global $conf,$hideprices; |
|
998 | + function pdf_getlineqty($parameters = array(), &$object, &$action = '') { |
|
999 | + global $conf, $hideprices; |
|
1000 | 1000 | |
1001 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1001 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1002 | 1002 | |
1003 | 1003 | $this->resprints = ' '; |
1004 | 1004 | |
1005 | - if((float)DOL_VERSION<=3.6) { |
|
1005 | + if ((float) DOL_VERSION <= 3.6) { |
|
1006 | 1006 | return ''; |
1007 | 1007 | } |
1008 | - else if((float)DOL_VERSION>=3.8) { |
|
1008 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1009 | 1009 | return 1; |
1010 | 1010 | } |
1011 | 1011 | |
1012 | 1012 | } |
1013 | - elseif(!empty($hideprices)) { |
|
1013 | + elseif (!empty($hideprices)) { |
|
1014 | 1014 | $this->resprints = $object->lines[$parameters['i']]->qty; |
1015 | 1015 | return 1; |
1016 | 1016 | } |
1017 | 1017 | elseif (!empty($conf->global->SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY)) |
1018 | 1018 | { |
1019 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
1020 | - $hidedetails = (int)GETPOST('hidedetails'); |
|
1019 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
1020 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
1021 | 1021 | if (empty($hideInnerLines) && !empty($hidedetails)) |
1022 | 1022 | { |
1023 | 1023 | $this->resprints = $object->lines[$parameters['i']]->qty; |
1024 | 1024 | } |
1025 | 1025 | } |
1026 | 1026 | |
1027 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1028 | - else $i = (int)$parameters; |
|
1027 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1028 | + else $i = (int) $parameters; |
|
1029 | 1029 | |
1030 | 1030 | if (empty($object->lines[$i])) return 0; // hideInnerLines => override $object->lines et Dolibarr ne nous permet pas de mettre à jour la variable qui conditionne la boucle sur les lignes (PR faite pour 6.0) |
1031 | 1031 | |
1032 | - if(empty($object->lines[$i]->array_options)) $object->lines[$i]->fetch_optionals(); |
|
1032 | + if (empty($object->lines[$i]->array_options)) $object->lines[$i]->fetch_optionals(); |
|
1033 | 1033 | |
1034 | - if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1034 | + if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
1035 | 1035 | { |
1036 | 1036 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
1037 | 1037 | { |
@@ -1043,25 +1043,25 @@ discard block |
||
1043 | 1043 | return 0; |
1044 | 1044 | } |
1045 | 1045 | |
1046 | - function pdf_getlinetotalexcltax($parameters=array(), &$object, &$action='') { |
|
1046 | + function pdf_getlinetotalexcltax($parameters = array(), &$object, &$action = '') { |
|
1047 | 1047 | global $conf, $hideprices, $ThidepricesExceptionList; |
1048 | 1048 | |
1049 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1049 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1050 | 1050 | |
1051 | 1051 | $this->resprints = ' '; |
1052 | 1052 | |
1053 | - if((float)DOL_VERSION<=3.6) { |
|
1053 | + if ((float) DOL_VERSION <= 3.6) { |
|
1054 | 1054 | return ''; |
1055 | 1055 | } |
1056 | - else if((float)DOL_VERSION>=3.8) { |
|
1056 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1057 | 1057 | return 1; |
1058 | 1058 | } |
1059 | 1059 | |
1060 | 1060 | } |
1061 | 1061 | elseif (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS)) |
1062 | 1062 | { |
1063 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1064 | - else $i = (int)$parameters; |
|
1063 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1064 | + else $i = (int) $parameters; |
|
1065 | 1065 | |
1066 | 1066 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
1067 | 1067 | { |
@@ -1082,24 +1082,24 @@ discard block |
||
1082 | 1082 | } |
1083 | 1083 | } |
1084 | 1084 | } |
1085 | - if ((int)GETPOST('hideInnerLines') && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)){ |
|
1086 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1087 | - else $i = (int)$parameters; |
|
1085 | + if ((int) GETPOST('hideInnerLines') && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) { |
|
1086 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1087 | + else $i = (int) $parameters; |
|
1088 | 1088 | $this->resprints = price($object->lines[$i]->total_ht); |
1089 | 1089 | } |
1090 | 1090 | if (!empty($hideprices) |
1091 | - || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1091 | + || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
1092 | 1092 | ) |
1093 | 1093 | { |
1094 | 1094 | if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
1095 | 1095 | { |
1096 | 1096 | |
1097 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1098 | - else $i = (int)$parameters; |
|
1097 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1098 | + else $i = (int) $parameters; |
|
1099 | 1099 | |
1100 | 1100 | // Check if a title exist for this line && if the title have subtotal |
1101 | 1101 | $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
1102 | - if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
1102 | + if (TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
1103 | 1103 | { |
1104 | 1104 | $this->resprints = ' '; |
1105 | 1105 | return 1; |
@@ -1110,25 +1110,25 @@ discard block |
||
1110 | 1110 | return 0; |
1111 | 1111 | } |
1112 | 1112 | |
1113 | - function pdf_getlinetotalwithtax($parameters=array(), &$object, &$action='') { |
|
1113 | + function pdf_getlinetotalwithtax($parameters = array(), &$object, &$action = '') { |
|
1114 | 1114 | global $conf; |
1115 | 1115 | |
1116 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1116 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1117 | 1117 | |
1118 | 1118 | $this->resprints = ' '; |
1119 | 1119 | |
1120 | - if((float)DOL_VERSION<=3.6) { |
|
1120 | + if ((float) DOL_VERSION <= 3.6) { |
|
1121 | 1121 | return ''; |
1122 | 1122 | } |
1123 | - else if((float)DOL_VERSION>=3.8) { |
|
1123 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1124 | 1124 | return 1; |
1125 | 1125 | } |
1126 | 1126 | } |
1127 | 1127 | |
1128 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1129 | - else $i = (int)$parameters; |
|
1128 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1129 | + else $i = (int) $parameters; |
|
1130 | 1130 | |
1131 | - if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1131 | + if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
1132 | 1132 | { |
1133 | 1133 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
1134 | 1134 | { |
@@ -1140,24 +1140,24 @@ discard block |
||
1140 | 1140 | return 0; |
1141 | 1141 | } |
1142 | 1142 | |
1143 | - function pdf_getlineunit($parameters=array(), &$object, &$action='') { |
|
1143 | + function pdf_getlineunit($parameters = array(), &$object, &$action = '') { |
|
1144 | 1144 | global $conf; |
1145 | 1145 | |
1146 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1146 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1147 | 1147 | $this->resprints = ' '; |
1148 | 1148 | |
1149 | - if((float)DOL_VERSION<=3.6) { |
|
1149 | + if ((float) DOL_VERSION <= 3.6) { |
|
1150 | 1150 | return ''; |
1151 | 1151 | } |
1152 | - else if((float)DOL_VERSION>=3.8) { |
|
1152 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1153 | 1153 | return 1; |
1154 | 1154 | } |
1155 | 1155 | } |
1156 | 1156 | |
1157 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1158 | - else $i = (int)$parameters; |
|
1157 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1158 | + else $i = (int) $parameters; |
|
1159 | 1159 | |
1160 | - if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1160 | + if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
1161 | 1161 | { |
1162 | 1162 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
1163 | 1163 | { |
@@ -1169,24 +1169,24 @@ discard block |
||
1169 | 1169 | return 0; |
1170 | 1170 | } |
1171 | 1171 | |
1172 | - function pdf_getlineupexcltax($parameters=array(), &$object, &$action='') { |
|
1173 | - global $conf,$hideprices; |
|
1172 | + function pdf_getlineupexcltax($parameters = array(), &$object, &$action = '') { |
|
1173 | + global $conf, $hideprices; |
|
1174 | 1174 | |
1175 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1175 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1176 | 1176 | $this->resprints = ' '; |
1177 | 1177 | |
1178 | - if((float)DOL_VERSION<=3.6) { |
|
1178 | + if ((float) DOL_VERSION <= 3.6) { |
|
1179 | 1179 | return ''; |
1180 | 1180 | } |
1181 | - else if((float)DOL_VERSION>=3.8) { |
|
1181 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1182 | 1182 | return 1; |
1183 | 1183 | } |
1184 | 1184 | } |
1185 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1186 | - else $i = (int)$parameters; |
|
1185 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1186 | + else $i = (int) $parameters; |
|
1187 | 1187 | |
1188 | 1188 | if (!empty($hideprices) |
1189 | - || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1189 | + || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
1190 | 1190 | ) |
1191 | 1191 | { |
1192 | 1192 | if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
@@ -1199,24 +1199,24 @@ discard block |
||
1199 | 1199 | return 0; |
1200 | 1200 | } |
1201 | 1201 | |
1202 | - function pdf_getlineupwithtax($parameters=array(), &$object, &$action='') { |
|
1203 | - global $conf,$hideprices; |
|
1202 | + function pdf_getlineupwithtax($parameters = array(), &$object, &$action = '') { |
|
1203 | + global $conf, $hideprices; |
|
1204 | 1204 | |
1205 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1205 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1206 | 1206 | $this->resprints = ' '; |
1207 | - if((float)DOL_VERSION<=3.6) { |
|
1207 | + if ((float) DOL_VERSION <= 3.6) { |
|
1208 | 1208 | return ''; |
1209 | 1209 | } |
1210 | - else if((float)DOL_VERSION>=3.8) { |
|
1210 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1211 | 1211 | return 1; |
1212 | 1212 | } |
1213 | 1213 | } |
1214 | 1214 | |
1215 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1216 | - else $i = (int)$parameters; |
|
1215 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1216 | + else $i = (int) $parameters; |
|
1217 | 1217 | |
1218 | 1218 | if (!empty($hideprices) |
1219 | - || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1219 | + || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
1220 | 1220 | ) |
1221 | 1221 | { |
1222 | 1222 | if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
@@ -1229,27 +1229,27 @@ discard block |
||
1229 | 1229 | return 0; |
1230 | 1230 | } |
1231 | 1231 | |
1232 | - function pdf_getlinevatrate($parameters=array(), &$object, &$action='') { |
|
1232 | + function pdf_getlinevatrate($parameters = array(), &$object, &$action = '') { |
|
1233 | 1233 | global $conf; |
1234 | 1234 | |
1235 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1235 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1236 | 1236 | $this->resprints = ' '; |
1237 | 1237 | |
1238 | - if((float)DOL_VERSION<=3.6) { |
|
1238 | + if ((float) DOL_VERSION <= 3.6) { |
|
1239 | 1239 | return ''; |
1240 | 1240 | } |
1241 | - else if((float)DOL_VERSION>=3.8) { |
|
1241 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1242 | 1242 | return 1; |
1243 | 1243 | } |
1244 | 1244 | } |
1245 | 1245 | |
1246 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1247 | - else $i = (int)$parameters; |
|
1246 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1247 | + else $i = (int) $parameters; |
|
1248 | 1248 | |
1249 | 1249 | if (empty($object->lines[$i])) return 0; // hideInnerLines => override $object->lines et Dolibarr ne nous permet pas de mettre à jour la variable qui conditionne la boucle sur les lignes (PR faite pour 6.0) |
1250 | 1250 | |
1251 | 1251 | $object->lines[$i]->fetch_optionals(); |
1252 | - if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1252 | + if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
1253 | 1253 | { |
1254 | 1254 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
1255 | 1255 | { |
@@ -1261,23 +1261,23 @@ discard block |
||
1261 | 1261 | return 0; |
1262 | 1262 | } |
1263 | 1263 | |
1264 | - function pdf_getlineprogress($parameters=array(), &$object, &$action) { |
|
1264 | + function pdf_getlineprogress($parameters = array(), &$object, &$action) { |
|
1265 | 1265 | global $conf; |
1266 | 1266 | |
1267 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1267 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1268 | 1268 | $this->resprints = ' '; |
1269 | - if((float)DOL_VERSION<=3.6) { |
|
1269 | + if ((float) DOL_VERSION <= 3.6) { |
|
1270 | 1270 | return ''; |
1271 | 1271 | } |
1272 | - else if((float)DOL_VERSION>=3.8) { |
|
1272 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1273 | 1273 | return 1; |
1274 | 1274 | } |
1275 | 1275 | } |
1276 | 1276 | |
1277 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1278 | - else $i = (int)$parameters; |
|
1277 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1278 | + else $i = (int) $parameters; |
|
1279 | 1279 | |
1280 | - if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1280 | + if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
1281 | 1281 | { |
1282 | 1282 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
1283 | 1283 | { |
@@ -1292,12 +1292,12 @@ discard block |
||
1292 | 1292 | function add_numerotation(&$object) { |
1293 | 1293 | global $conf; |
1294 | 1294 | |
1295 | - if(!empty($conf->global->SUBTOTAL_USE_NUMEROTATION)) { |
|
1295 | + if (!empty($conf->global->SUBTOTAL_USE_NUMEROTATION)) { |
|
1296 | 1296 | |
1297 | 1297 | $TLevelTitre = array(); |
1298 | 1298 | $prevlevel = 0; |
1299 | 1299 | |
1300 | - foreach($object->lines as $k=>&$line) |
|
1300 | + foreach ($object->lines as $k=>&$line) |
|
1301 | 1301 | { |
1302 | 1302 | if ($line->id > 0 && $this->isModSubtotalLine($k, $object) && $line->qty <= 10) |
1303 | 1303 | { |
@@ -1311,12 +1311,12 @@ discard block |
||
1311 | 1311 | } |
1312 | 1312 | |
1313 | 1313 | // TODO ne gère pas encore la numération des lignes "Totaux" |
1314 | - private function formatNumerotation(&$TLineTitle, $line_reference='', $level=1, $prefix_num=0) |
|
1314 | + private function formatNumerotation(&$TLineTitle, $line_reference = '', $level = 1, $prefix_num = 0) |
|
1315 | 1315 | { |
1316 | 1316 | $TTitle = array(); |
1317 | 1317 | |
1318 | - $i=1; |
|
1319 | - $j=0; |
|
1318 | + $i = 1; |
|
1319 | + $j = 0; |
|
1320 | 1320 | foreach ($TLineTitle as $k => &$line) |
1321 | 1321 | { |
1322 | 1322 | if (!empty($line_reference) && $line->rang <= $line_reference->rang) continue; |
@@ -1326,7 +1326,7 @@ discard block |
||
1326 | 1326 | { |
1327 | 1327 | $TTitle[$j]['numerotation'] = ($prefix_num == 0) ? $i : $prefix_num.'.'.$i; |
1328 | 1328 | //var_dump('Prefix == '.$prefix_num.' // '.$line->desc.' ==> numerotation == '.$TTitle[$j]['numerotation'].' ### '.$line->qty .'=='. $level); |
1329 | - if (empty($line->label) && (float)DOL_VERSION < 6) |
|
1329 | + if (empty($line->label) && (float) DOL_VERSION < 6) |
|
1330 | 1330 | { |
1331 | 1331 | $line->label = !empty($line->desc) ? $line->desc : $line->description; |
1332 | 1332 | $line->desc = $line->description = ''; |
@@ -1352,26 +1352,26 @@ discard block |
||
1352 | 1352 | |
1353 | 1353 | function setDocTVA(&$pdf, &$object) { |
1354 | 1354 | |
1355 | - $hidedetails = (int)GETPOST('hidedetails'); |
|
1355 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
1356 | 1356 | |
1357 | - if(empty($hidedetails)) return false; |
|
1357 | + if (empty($hidedetails)) return false; |
|
1358 | 1358 | |
1359 | 1359 | // TODO can't add VAT to document without lines... :-/ |
1360 | 1360 | |
1361 | 1361 | return true; |
1362 | 1362 | } |
1363 | 1363 | |
1364 | - function beforePDFCreation($parameters=array(), &$object, &$action) |
|
1364 | + function beforePDFCreation($parameters = array(), &$object, &$action) |
|
1365 | 1365 | { |
1366 | 1366 | /** |
1367 | 1367 | * @var $pdf TCPDF |
1368 | 1368 | */ |
1369 | - global $pdf,$conf, $langs; |
|
1369 | + global $pdf, $conf, $langs; |
|
1370 | 1370 | |
1371 | 1371 | // var_dump($object->lines); |
1372 | 1372 | dol_include_once('/subtotal/class/subtotal.class.php'); |
1373 | 1373 | |
1374 | - foreach($parameters as $key=>$value) { |
|
1374 | + foreach ($parameters as $key=>$value) { |
|
1375 | 1375 | ${$key} = $value; |
1376 | 1376 | } |
1377 | 1377 | |
@@ -1380,25 +1380,25 @@ discard block |
||
1380 | 1380 | $this->add_numerotation($object); |
1381 | 1381 | |
1382 | 1382 | |
1383 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
1384 | - $hidedetails = (int)GETPOST('hidedetails'); |
|
1383 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
1384 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
1385 | 1385 | |
1386 | 1386 | if ($hideInnerLines) { // si c une ligne de titre |
1387 | - $fk_parent_line=0; |
|
1388 | - $TLines =array(); |
|
1387 | + $fk_parent_line = 0; |
|
1388 | + $TLines = array(); |
|
1389 | 1389 | |
1390 | - $original_count=count($object->lines); |
|
1390 | + $original_count = count($object->lines); |
|
1391 | 1391 | $TTvas = array(); // tableau de tva |
1392 | 1392 | |
1393 | - foreach($object->lines as $k=>&$line) |
|
1393 | + foreach ($object->lines as $k=>&$line) |
|
1394 | 1394 | { |
1395 | 1395 | |
1396 | - if($line->product_type==9 && $line->rowid>0) |
|
1396 | + if ($line->product_type == 9 && $line->rowid > 0) |
|
1397 | 1397 | { |
1398 | 1398 | $fk_parent_line = $line->rowid; |
1399 | 1399 | |
1400 | 1400 | // Fix tk7201 - si on cache le détail, la TVA est renseigné au niveau du sous-total, l'erreur c'est s'il y a plusieurs sous-totaux pour les même lignes, ça va faire la somme |
1401 | - if(TSubtotal::isSubtotal($line)) |
|
1401 | + if (TSubtotal::isSubtotal($line)) |
|
1402 | 1402 | { |
1403 | 1403 | /*$total = $this->getTotalLineFromObject($object, $line, ''); |
1404 | 1404 | |
@@ -1418,22 +1418,22 @@ discard block |
||
1418 | 1418 | |
1419 | 1419 | if ($hideInnerLines) |
1420 | 1420 | { |
1421 | - if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
1421 | + if (!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
1422 | 1422 | { |
1423 | - if($line->tva_tx != '0.000' && $line->product_type!=9){ |
|
1423 | + if ($line->tva_tx != '0.000' && $line->product_type != 9) { |
|
1424 | 1424 | |
1425 | 1425 | // on remplit le tableau de tva pour substituer les lignes cachées |
1426 | 1426 | $TTvas[$line->tva_tx]['total_tva'] += $line->total_tva; |
1427 | 1427 | $TTvas[$line->tva_tx]['total_ht'] += $line->total_ht; |
1428 | 1428 | $TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; |
1429 | 1429 | } |
1430 | - if($line->product_type==9 && $line->rowid>0) |
|
1430 | + if ($line->product_type == 9 && $line->rowid > 0) |
|
1431 | 1431 | { |
1432 | 1432 | //Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres |
1433 | 1433 | // génère des lignes d'affichage des montants HT soumis à tva |
1434 | 1434 | $nbtva = count($TTvas); |
1435 | - if(!empty($nbtva)){ |
|
1436 | - foreach ($TTvas as $tx =>$val){ |
|
1435 | + if (!empty($nbtva)) { |
|
1436 | + foreach ($TTvas as $tx =>$val) { |
|
1437 | 1437 | $l = clone $line; |
1438 | 1438 | $l->product_type = 1; |
1439 | 1439 | $l->special_code = ''; |
@@ -1454,7 +1454,7 @@ discard block |
||
1454 | 1454 | } |
1455 | 1455 | } else { |
1456 | 1456 | |
1457 | - if($line->product_type==9 && $line->rowid>0) |
|
1457 | + if ($line->product_type == 9 && $line->rowid > 0) |
|
1458 | 1458 | { |
1459 | 1459 | // ajoute la ligne de sous-total |
1460 | 1460 | $TLines[] = $line; |
@@ -1482,9 +1482,9 @@ discard block |
||
1482 | 1482 | |
1483 | 1483 | // cas incongru où il y aurait des produits en dessous du dernier sous-total |
1484 | 1484 | $nbtva = count($TTvas); |
1485 | - if(!empty($nbtva) && $hideInnerLines && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
1485 | + if (!empty($nbtva) && $hideInnerLines && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
1486 | 1486 | { |
1487 | - foreach ($TTvas as $tx =>$val){ |
|
1487 | + foreach ($TTvas as $tx =>$val) { |
|
1488 | 1488 | $l = clone $line; |
1489 | 1489 | $l->product_type = 1; |
1490 | 1490 | $l->special_code = ''; |
@@ -1501,11 +1501,11 @@ discard block |
||
1501 | 1501 | } |
1502 | 1502 | |
1503 | 1503 | global $nblignes; |
1504 | - $nblignes=count($TLines); |
|
1504 | + $nblignes = count($TLines); |
|
1505 | 1505 | |
1506 | 1506 | $object->lines = $TLines; |
1507 | 1507 | |
1508 | - if($i>count($object->lines)) { |
|
1508 | + if ($i > count($object->lines)) { |
|
1509 | 1509 | $this->resprints = ''; |
1510 | 1510 | return 0; |
1511 | 1511 | } |
@@ -1514,59 +1514,59 @@ discard block |
||
1514 | 1514 | return 0; |
1515 | 1515 | } |
1516 | 1516 | |
1517 | - function pdf_writelinedesc($parameters=array(), &$object, &$action) |
|
1517 | + function pdf_writelinedesc($parameters = array(), &$object, &$action) |
|
1518 | 1518 | { |
1519 | 1519 | /** |
1520 | 1520 | * @var $pdf TCPDF |
1521 | 1521 | */ |
1522 | - global $pdf,$conf; |
|
1522 | + global $pdf, $conf; |
|
1523 | 1523 | |
1524 | - foreach($parameters as $key=>$value) { |
|
1524 | + foreach ($parameters as $key=>$value) { |
|
1525 | 1525 | ${$key} = $value; |
1526 | 1526 | } |
1527 | 1527 | |
1528 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
1529 | - $hidedetails = (int)GETPOST('hidedetails'); |
|
1528 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
1529 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
1530 | 1530 | |
1531 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1531 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1532 | 1532 | |
1533 | 1533 | global $hideprices; |
1534 | 1534 | |
1535 | - if(!empty($hideprices)) { |
|
1536 | - foreach($object->lines as &$line) { |
|
1537 | - if($line->fk_product_type!=9) $line->fk_parent_line = -1; |
|
1535 | + if (!empty($hideprices)) { |
|
1536 | + foreach ($object->lines as &$line) { |
|
1537 | + if ($line->fk_product_type != 9) $line->fk_parent_line = -1; |
|
1538 | 1538 | } |
1539 | 1539 | } |
1540 | 1540 | |
1541 | 1541 | $line = &$object->lines[$i]; |
1542 | 1542 | |
1543 | - if($line->info_bits>0) { // PAGE BREAK |
|
1543 | + if ($line->info_bits > 0) { // PAGE BREAK |
|
1544 | 1544 | $pdf->addPage(); |
1545 | 1545 | $posy = $pdf->GetY(); |
1546 | 1546 | } |
1547 | 1547 | |
1548 | 1548 | $label = $line->label; |
1549 | - $description= !empty($line->desc) ? $outputlangs->convToOutputCharset($line->desc) : $outputlangs->convToOutputCharset($line->description); |
|
1549 | + $description = !empty($line->desc) ? $outputlangs->convToOutputCharset($line->desc) : $outputlangs->convToOutputCharset($line->description); |
|
1550 | 1550 | |
1551 | - if(empty($label)) { |
|
1551 | + if (empty($label)) { |
|
1552 | 1552 | $label = $description; |
1553 | - $description=''; |
|
1553 | + $description = ''; |
|
1554 | 1554 | } |
1555 | 1555 | |
1556 | - if($line->qty>90) { |
|
1556 | + if ($line->qty > 90) { |
|
1557 | 1557 | |
1558 | 1558 | if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) $label .= ' '.$this->getTitle($object, $line); |
1559 | 1559 | |
1560 | 1560 | $pageBefore = $pdf->getPage(); |
1561 | - $this->pdf_add_total($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
|
1561 | + $this->pdf_add_total($pdf, $object, $line, $label, $description, $posx, $posy, $w, $h); |
|
1562 | 1562 | $pageAfter = $pdf->getPage(); |
1563 | 1563 | |
1564 | - if($pageAfter>$pageBefore) { |
|
1564 | + if ($pageAfter > $pageBefore) { |
|
1565 | 1565 | //print "ST $pageAfter>$pageBefore<br>"; |
1566 | 1566 | $pdf->rollbackTransaction(true); |
1567 | - $pdf->addPage('','', true); |
|
1567 | + $pdf->addPage('', '', true); |
|
1568 | 1568 | $posy = $pdf->GetY(); |
1569 | - $this->pdf_add_total($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
|
1569 | + $this->pdf_add_total($pdf, $object, $line, $label, $description, $posx, $posy, $w, $h); |
|
1570 | 1570 | $posy = $pdf->GetY(); |
1571 | 1571 | //print 'add ST'.$pdf->getPage().'<br />'; |
1572 | 1572 | } |
@@ -1577,7 +1577,7 @@ discard block |
||
1577 | 1577 | else if ($line->qty < 10) { |
1578 | 1578 | $pageBefore = $pdf->getPage(); |
1579 | 1579 | |
1580 | - $this->pdf_add_title($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
|
1580 | + $this->pdf_add_title($pdf, $object, $line, $label, $description, $posx, $posy, $w, $h); |
|
1581 | 1581 | $pageAfter = $pdf->getPage(); |
1582 | 1582 | |
1583 | 1583 | |
@@ -1652,9 +1652,9 @@ discard block |
||
1652 | 1652 | * @param $hookmanager HookManager |
1653 | 1653 | * @return int |
1654 | 1654 | */ |
1655 | - function printObjectLine ($parameters, &$object, &$action, $hookmanager){ |
|
1655 | + function printObjectLine($parameters, &$object, &$action, $hookmanager) { |
|
1656 | 1656 | |
1657 | - global $conf,$langs,$user,$db,$bc; |
|
1657 | + global $conf, $langs, $user, $db, $bc; |
|
1658 | 1658 | |
1659 | 1659 | $num = &$parameters['num']; |
1660 | 1660 | $line = &$parameters['line']; |
@@ -1662,32 +1662,32 @@ discard block |
||
1662 | 1662 | |
1663 | 1663 | $var = &$parameters['var']; |
1664 | 1664 | |
1665 | - $contexts = explode(':',$parameters['context']); |
|
1665 | + $contexts = explode(':', $parameters['context']); |
|
1666 | 1666 | |
1667 | 1667 | $createRight = $user->rights->{$object->element}->creer; |
1668 | - if($object->element == 'facturerec' ) |
|
1668 | + if ($object->element == 'facturerec') |
|
1669 | 1669 | { |
1670 | 1670 | $object->statut = 0; // hack for facture rec |
1671 | 1671 | $createRight = $user->rights->facture->creer; |
1672 | 1672 | } |
1673 | - elseif($object->element == 'order_supplier' ) |
|
1673 | + elseif ($object->element == 'order_supplier') |
|
1674 | 1674 | { |
1675 | 1675 | $createRight = $user->rights->fournisseur->commande->creer; |
1676 | 1676 | } |
1677 | - elseif($object->element == 'invoice_supplier' ) |
|
1677 | + elseif ($object->element == 'invoice_supplier') |
|
1678 | 1678 | { |
1679 | 1679 | $createRight = $user->rights->fournisseur->facture->creer; |
1680 | 1680 | } |
1681 | 1681 | |
1682 | - if($line->special_code!=$this->module_number || $line->product_type!=9) { |
|
1682 | + if ($line->special_code != $this->module_number || $line->product_type != 9) { |
|
1683 | 1683 | null; |
1684 | 1684 | } |
1685 | - else if (in_array('invoicecard',$contexts) || in_array('invoicesuppliercard',$contexts) || in_array('propalcard',$contexts) || in_array('supplier_proposalcard',$contexts) || in_array('ordercard',$contexts) || in_array('ordersuppliercard',$contexts) || in_array('invoicereccard',$contexts)) |
|
1685 | + else if (in_array('invoicecard', $contexts) || in_array('invoicesuppliercard', $contexts) || in_array('propalcard', $contexts) || in_array('supplier_proposalcard', $contexts) || in_array('ordercard', $contexts) || in_array('ordersuppliercard', $contexts) || in_array('invoicereccard', $contexts)) |
|
1686 | 1686 | { |
1687 | - if($object->element=='facture')$idvar = 'facid'; |
|
1688 | - else $idvar='id'; |
|
1687 | + if ($object->element == 'facture')$idvar = 'facid'; |
|
1688 | + else $idvar = 'id'; |
|
1689 | 1689 | |
1690 | - if((float)DOL_VERSION <= 3.4) |
|
1690 | + if ((float) DOL_VERSION <= 3.4) |
|
1691 | 1691 | { |
1692 | 1692 | ?> |
1693 | 1693 | <script type="text/javascript"> |
@@ -1711,20 +1711,20 @@ discard block |
||
1711 | 1711 | <?php |
1712 | 1712 | } |
1713 | 1713 | |
1714 | - if(empty($line->description)) $line->description = $line->desc; |
|
1714 | + if (empty($line->description)) $line->description = $line->desc; |
|
1715 | 1715 | |
1716 | 1716 | $colspan = 5; |
1717 | - if($object->element == 'facturerec' ) $colspan = 3; |
|
1718 | - if($object->element == 'order_supplier') $colspan = 3; |
|
1719 | - if($object->element == 'invoice_supplier') $colspan = 4; |
|
1720 | - if($object->element == 'supplier_proposal') $colspan = 4; |
|
1721 | - if(!empty($conf->multicurrency->enabled)) $colspan+=2; |
|
1722 | - if($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) $colspan++; |
|
1723 | - if(!empty($conf->margin->enabled)) $colspan++; |
|
1724 | - if(!empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; |
|
1725 | - if(!empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; |
|
1726 | - if($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) $colspan++; |
|
1727 | - if(!empty($conf->global->PRODUCT_USE_UNITS)) $colspan++; |
|
1717 | + if ($object->element == 'facturerec') $colspan = 3; |
|
1718 | + if ($object->element == 'order_supplier') $colspan = 3; |
|
1719 | + if ($object->element == 'invoice_supplier') $colspan = 4; |
|
1720 | + if ($object->element == 'supplier_proposal') $colspan = 4; |
|
1721 | + if (!empty($conf->multicurrency->enabled)) $colspan += 2; |
|
1722 | + if ($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) $colspan++; |
|
1723 | + if (!empty($conf->margin->enabled)) $colspan++; |
|
1724 | + if (!empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; |
|
1725 | + if (!empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; |
|
1726 | + if ($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) $colspan++; |
|
1727 | + if (!empty($conf->global->PRODUCT_USE_UNITS)) $colspan++; |
|
1728 | 1728 | |
1729 | 1729 | /* Titre */ |
1730 | 1730 | //var_dump($line); |
@@ -1734,35 +1734,35 @@ discard block |
||
1734 | 1734 | |
1735 | 1735 | |
1736 | 1736 | ?> |
1737 | - <tr <?php echo $bc[$var]; $var=!$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
|
1737 | + <tr <?php echo $bc[$var]; $var = !$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
|
1738 | 1738 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT)) |
1739 | 1739 | { |
1740 | - if($line->qty==99) print 'background:#adadcf'; |
|
1741 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
1742 | - else if($line->qty<=97 && $line->qty>=91) print 'background:#eeeeff;'; |
|
1743 | - else if($line->qty==1) print 'background:#adadcf;'; |
|
1744 | - else if($line->qty==2) print 'background:#ddddff;'; |
|
1745 | - else if($line->qty==50) print ''; |
|
1740 | + if ($line->qty == 99) print 'background:#adadcf'; |
|
1741 | + else if ($line->qty == 98) print 'background:#ddddff;'; |
|
1742 | + else if ($line->qty <= 97 && $line->qty >= 91) print 'background:#eeeeff;'; |
|
1743 | + else if ($line->qty == 1) print 'background:#adadcf;'; |
|
1744 | + else if ($line->qty == 2) print 'background:#ddddff;'; |
|
1745 | + else if ($line->qty == 50) print ''; |
|
1746 | 1746 | else print 'background:#eeeeff;'; |
1747 | 1747 | |
1748 | 1748 | //A compléter si on veux plus de nuances de couleurs avec les niveau 4,5,6,7,8 et 9 |
1749 | 1749 | } |
1750 | 1750 | else |
1751 | 1751 | { |
1752 | - if($line->qty==99) print 'background:#ddffdd'; |
|
1753 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
1754 | - else if($line->qty==2) print 'background:#eeeeff; '; |
|
1755 | - else if($line->qty==50) print ''; |
|
1756 | - else print 'background:#eeffee;' ; |
|
1752 | + if ($line->qty == 99) print 'background:#ddffdd'; |
|
1753 | + else if ($line->qty == 98) print 'background:#ddddff;'; |
|
1754 | + else if ($line->qty == 2) print 'background:#eeeeff; '; |
|
1755 | + else if ($line->qty == 50) print ''; |
|
1756 | + else print 'background:#eeffee;'; |
|
1757 | 1757 | } |
1758 | 1758 | |
1759 | 1759 | ?>;"> |
1760 | 1760 | |
1761 | - <td colspan="<?php echo $colspan; ?>" style="<?php TSubtotal::isFreeText($line) ? '' : 'font-weight:bold;'; ?> <?php echo ($line->qty>90)?'text-align:right':'' ?> "><?php |
|
1762 | - if($action=='editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line) ) { |
|
1761 | + <td colspan="<?php echo $colspan; ?>" style="<?php TSubtotal::isFreeText($line) ? '' : 'font-weight:bold;'; ?> <?php echo ($line->qty > 90) ? 'text-align:right' : '' ?> "><?php |
|
1762 | + if ($action == 'editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line)) { |
|
1763 | 1763 | |
1764 | - $params=array('line'=>$line); |
|
1765 | - $reshook=$hookmanager->executeHooks('formEditProductOptions',$params,$object,$action); |
|
1764 | + $params = array('line'=>$line); |
|
1765 | + $reshook = $hookmanager->executeHooks('formEditProductOptions', $params, $object, $action); |
|
1766 | 1766 | |
1767 | 1767 | echo '<div id="line_'.$line->id.'"></div>'; // Imitation Dolibarr |
1768 | 1768 | echo '<input type="hidden" value="'.$line->id.'" name="lineid">'; |
@@ -1770,7 +1770,7 @@ discard block |
||
1770 | 1770 | echo '<input id="product_id" type="hidden" value="'.$line->fk_product.'" name="type">'; |
1771 | 1771 | echo '<input id="special_code" type="hidden" value="'.$line->special_code.'" name="type">'; |
1772 | 1772 | |
1773 | - $isFreeText=false; |
|
1773 | + $isFreeText = false; |
|
1774 | 1774 | if (TSubtotal::isTitle($line)) |
1775 | 1775 | { |
1776 | 1776 | $qty_displayed = $line->qty; |
@@ -1792,13 +1792,13 @@ discard block |
||
1792 | 1792 | $line->description = ''; |
1793 | 1793 | } |
1794 | 1794 | $newlabel = $line->label; |
1795 | - if($line->label=='' && !$isFreeText) { |
|
1796 | - if(TSubtotal::isSubtotal($line)) { |
|
1795 | + if ($line->label == '' && !$isFreeText) { |
|
1796 | + if (TSubtotal::isSubtotal($line)) { |
|
1797 | 1797 | $newlabel = $line->description.' '.$this->getTitle($object, $line); |
1798 | - $line->description=''; |
|
1799 | - } elseif( (float)DOL_VERSION < 6 ) { |
|
1800 | - $newlabel= $line->description; |
|
1801 | - $line->description=''; |
|
1798 | + $line->description = ''; |
|
1799 | + } elseif ((float) DOL_VERSION < 6) { |
|
1800 | + $newlabel = $line->description; |
|
1801 | + $line->description = ''; |
|
1802 | 1802 | } |
1803 | 1803 | } |
1804 | 1804 | |
@@ -1807,10 +1807,10 @@ discard block |
||
1807 | 1807 | |
1808 | 1808 | if (!$isFreeText) echo '<input type="text" name="line-title" id-line="'.$line->id.'" value="'.$newlabel.'" size="80" '.$readonlyForSituation.'/> '; |
1809 | 1809 | |
1810 | - if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT) && (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) ) |
|
1810 | + if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT) && (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line))) |
|
1811 | 1811 | { |
1812 | 1812 | $select = '<select name="subtotal_level">'; |
1813 | - for ($j=1; $j<10; $j++) |
|
1813 | + for ($j = 1; $j < 10; $j++) |
|
1814 | 1814 | { |
1815 | 1815 | if (!empty($readonlyForSituation)) { |
1816 | 1816 | if ($qty_displayed == $j) $select .= '<option selected="selected" value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
@@ -1823,7 +1823,7 @@ discard block |
||
1823 | 1823 | |
1824 | 1824 | |
1825 | 1825 | echo '<div class="subtotal_underline" style="margin-left:24px;">'; |
1826 | - echo '<label for="subtotal-pagebreak">'.$langs->trans('AddBreakPageBefore').'</label> <input style="vertical-align:sub;" type="checkbox" name="line-pagebreak" id="subtotal-pagebreak" value="8" '.(($line->info_bits > 0) ? 'checked="checked"' : '') .' /> '; |
|
1826 | + echo '<label for="subtotal-pagebreak">'.$langs->trans('AddBreakPageBefore').'</label> <input style="vertical-align:sub;" type="checkbox" name="line-pagebreak" id="subtotal-pagebreak" value="8" '.(($line->info_bits > 0) ? 'checked="checked"' : '').' /> '; |
|
1827 | 1827 | |
1828 | 1828 | if (TSubtotal::isTitle($line)) |
1829 | 1829 | { |
@@ -1841,9 +1841,9 @@ discard block |
||
1841 | 1841 | else if ($isFreeText) echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation); |
1842 | 1842 | echo '</div>'; |
1843 | 1843 | |
1844 | - if($line->qty<10) { |
|
1844 | + if ($line->qty < 10) { |
|
1845 | 1845 | // WYSIWYG editor |
1846 | - require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; |
|
1846 | + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
|
1847 | 1847 | $nbrows = ROWS_2; |
1848 | 1848 | $cked_enabled = (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0); |
1849 | 1849 | if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) { |
@@ -1863,25 +1863,25 @@ discard block |
||
1863 | 1863 | |
1864 | 1864 | if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) |
1865 | 1865 | { |
1866 | - if(TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) |
|
1866 | + if (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) |
|
1867 | 1867 | { |
1868 | - echo str_repeat(' ', $line->qty-1); |
|
1868 | + echo str_repeat(' ', $line->qty - 1); |
|
1869 | 1869 | |
1870 | 1870 | if (TSubtotal::isTitle($line)) print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
1871 | - else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
1871 | + else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100 - $line->qty).'</span> '; |
|
1872 | 1872 | } |
1873 | 1873 | } |
1874 | 1874 | else |
1875 | 1875 | { |
1876 | - if($line->qty<=1) print img_picto('', 'subtotal@subtotal'); |
|
1877 | - else if($line->qty==2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
1876 | + if ($line->qty <= 1) print img_picto('', 'subtotal@subtotal'); |
|
1877 | + else if ($line->qty == 2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
1878 | 1878 | } |
1879 | 1879 | |
1880 | 1880 | |
1881 | 1881 | // Get display styles and apply them |
1882 | 1882 | $titleStyleItalic = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'I') === false ? '' : ' font-style: italic;'; |
1883 | - $titleStyleBold = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'B') === false ? '' : ' font-weight:bold;'; |
|
1884 | - $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
|
1883 | + $titleStyleBold = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'B') === false ? '' : ' font-weight:bold;'; |
|
1884 | + $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
|
1885 | 1885 | |
1886 | 1886 | if (empty($line->label)) { |
1887 | 1887 | if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) print $line->description.' '.$this->getTitle($object, $line); |
@@ -1889,16 +1889,16 @@ discard block |
||
1889 | 1889 | } |
1890 | 1890 | else { |
1891 | 1891 | |
1892 | - if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
|
1892 | + if (!empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
|
1893 | 1893 | print '<span class="subtotal_label" style="'.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" >'.$line->label.'</span><br><div class="subtotal_desc">'.dol_htmlentitiesbr($line->description).'</div>'; |
1894 | 1894 | } |
1895 | - else{ |
|
1895 | + else { |
|
1896 | 1896 | print '<span class="subtotal_label classfortooltip '.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" title="'.$line->description.'">'.$line->label.'</span>'; |
1897 | 1897 | } |
1898 | 1898 | |
1899 | 1899 | } |
1900 | - if($line->qty>90) print ' : '; |
|
1901 | - if($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
1900 | + if ($line->qty > 90) print ' : '; |
|
1901 | + if ($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
1902 | 1902 | |
1903 | 1903 | |
1904 | 1904 | |
@@ -1907,7 +1907,7 @@ discard block |
||
1907 | 1907 | ?></td> |
1908 | 1908 | |
1909 | 1909 | <?php |
1910 | - if($line->qty>90) { |
|
1910 | + if ($line->qty > 90) { |
|
1911 | 1911 | /* Total */ |
1912 | 1912 | $total_line = $this->getTotalLineFromObject($object, $line, ''); |
1913 | 1913 | echo '<td class="nowrap liencolht" align="right" style="font-weight:bold;" rel="subtotal_total">'.price($total_line).'</td>'; |
@@ -1920,7 +1920,7 @@ discard block |
||
1920 | 1920 | <?php |
1921 | 1921 | if ($action != 'selectlines') { |
1922 | 1922 | |
1923 | - if($action=='editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line) ) { |
|
1923 | + if ($action == 'editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line)) { |
|
1924 | 1924 | ?> |
1925 | 1925 | <input id="savelinebutton" class="button" type="submit" name="save" value="<?php echo $langs->trans('Save') ?>" /> |
1926 | 1926 | <br /> |
@@ -1936,13 +1936,13 @@ discard block |
||
1936 | 1936 | <?php |
1937 | 1937 | |
1938 | 1938 | } |
1939 | - else{ |
|
1940 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) && $object->element !== 'invoice_supplier') |
|
1939 | + else { |
|
1940 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) && $object->element !== 'invoice_supplier') |
|
1941 | 1941 | { |
1942 | - if(TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref) ) echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=duplicate&lineid='.$line->id.'">'. img_picto($langs->trans('Duplicate'), 'duplicate@subtotal').'</a>'; |
|
1942 | + if (TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref)) echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=duplicate&lineid='.$line->id.'">'.img_picto($langs->trans('Duplicate'), 'duplicate@subtotal').'</a>'; |
|
1943 | 1943 | } |
1944 | 1944 | |
1945 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_EDIT_BLOCK)) |
|
1945 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_EDIT_BLOCK)) |
|
1946 | 1946 | { |
1947 | 1947 | echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=editline&lineid='.$line->id.'">'.img_edit().'</a>'; |
1948 | 1948 | } |
@@ -1957,7 +1957,7 @@ discard block |
||
1957 | 1957 | <?php |
1958 | 1958 | |
1959 | 1959 | if ($action != 'editline' && $action != 'selectlines') { |
1960 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK)) |
|
1960 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK)) |
|
1961 | 1961 | { |
1962 | 1962 | |
1963 | 1963 | if ($object->situation_counter == 1 || !$object->situation_cycle_ref) |
@@ -1965,7 +1965,7 @@ discard block |
||
1965 | 1965 | echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=ask_deleteline&lineid='.$line->id.'">'.img_delete().'</a>'; |
1966 | 1966 | } |
1967 | 1967 | |
1968 | - if(TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref) ) |
|
1968 | + if (TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref)) |
|
1969 | 1969 | { |
1970 | 1970 | $img_delete = ((float) DOL_VERSION >= 3.8) ? img_picto($langs->trans('deleteWithAllLines'), 'delete_all.3.8@subtotal') : img_picto($langs->trans('deleteWithAllLines'), 'delete_all@subtotal'); |
1971 | 1971 | echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=ask_deleteallline&lineid='.$line->id.'">'.$img_delete.'</a>'; |
@@ -1976,7 +1976,7 @@ discard block |
||
1976 | 1976 | </td> |
1977 | 1977 | |
1978 | 1978 | <?php |
1979 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && TSubtotal::isTitle($line) && $action != 'editline') |
|
1979 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && TSubtotal::isTitle($line) && $action != 'editline') |
|
1980 | 1980 | { |
1981 | 1981 | echo '<td class="subtotal_nc">'; |
1982 | 1982 | echo '<input id="subtotal_nc-'.$line->id.'" class="subtotal_nc_chkbx" data-lineid="'.$line->id.'" type="checkbox" name="subtotal_nc" value="1" '.(!empty($line->array_options['options_subtotal_nc']) ? 'checked="checked"' : '').' />'; |
@@ -1987,11 +1987,11 @@ discard block |
||
1987 | 1987 | <td align="center" class="tdlineupdown"> |
1988 | 1988 | </td> |
1989 | 1989 | <?php } else { ?> |
1990 | - <td align="center"<?php echo ((empty($conf->browser->phone) && ($object->statut == 0 && $createRight ))?' class="tdlineupdown"':''); ?>></td> |
|
1990 | + <td align="center"<?php echo ((empty($conf->browser->phone) && ($object->statut == 0 && $createRight)) ? ' class="tdlineupdown"' : ''); ?>></td> |
|
1991 | 1991 | <?php } ?> |
1992 | 1992 | |
1993 | - <?php if($action == 'selectlines'){ // dolibarr 8 ?> |
|
1994 | - <td class="linecolcheck" align="center"><input type="checkbox" class="linecheckbox" name="line_checkbox[<?php echo $i+1; ?>]" value="<?php echo $line->id; ?>" ></td> |
|
1993 | + <?php if ($action == 'selectlines') { // dolibarr 8 ?> |
|
1994 | + <td class="linecolcheck" align="center"><input type="checkbox" class="linecheckbox" name="line_checkbox[<?php echo $i + 1; ?>]" value="<?php echo $line->id; ?>" ></td> |
|
1995 | 1995 | <?php } ?> |
1996 | 1996 | |
1997 | 1997 | </tr> |
@@ -1999,29 +1999,29 @@ discard block |
||
1999 | 1999 | |
2000 | 2000 | |
2001 | 2001 | // Affichage des extrafields à la Dolibarr (car sinon non affiché sur les titres) |
2002 | - if(TSubtotal::isTitle($line) && !empty($conf->global->SUBTOTAL_ALLOW_EXTRAFIELDS_ON_TITLE)) { |
|
2002 | + if (TSubtotal::isTitle($line) && !empty($conf->global->SUBTOTAL_ALLOW_EXTRAFIELDS_ON_TITLE)) { |
|
2003 | 2003 | |
2004 | - require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; |
|
2004 | + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; |
|
2005 | 2005 | |
2006 | 2006 | // Extrafields |
2007 | 2007 | $extrafieldsline = new ExtraFields($db); |
2008 | 2008 | $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); |
2009 | 2009 | |
2010 | - $colspan+=3; $mode = 'view'; |
|
2011 | - if($action === 'editline' && $line->rowid == GETPOST('lineid')) $mode = 'edit'; |
|
2010 | + $colspan += 3; $mode = 'view'; |
|
2011 | + if ($action === 'editline' && $line->rowid == GETPOST('lineid')) $mode = 'edit'; |
|
2012 | 2012 | |
2013 | 2013 | $ex_element = $line->element; |
2014 | 2014 | $line->element = 'tr_extrafield_title '.$line->element; // Pour pouvoir manipuler ces tr |
2015 | - print $line->showOptionals($extrafieldsline, $mode, array('style'=>' style="background:#eeffee;" ','colspan'=>$colspan)); |
|
2015 | + print $line->showOptionals($extrafieldsline, $mode, array('style'=>' style="background:#eeffee;" ', 'colspan'=>$colspan)); |
|
2016 | 2016 | $isExtraSelected = false; |
2017 | - foreach($line->array_options as $option) { |
|
2018 | - if(!empty($option) && $option != "-1") { |
|
2017 | + foreach ($line->array_options as $option) { |
|
2018 | + if (!empty($option) && $option != "-1") { |
|
2019 | 2019 | $isExtraSelected = true; |
2020 | 2020 | break; |
2021 | 2021 | } |
2022 | 2022 | } |
2023 | 2023 | |
2024 | - if($mode === 'edit') { |
|
2024 | + if ($mode === 'edit') { |
|
2025 | 2025 | ?> |
2026 | 2026 | <script> |
2027 | 2027 | $(document).ready(function(){ |
@@ -2029,7 +2029,7 @@ discard block |
||
2029 | 2029 | var all_tr_extrafields = $("tr.tr_extrafield_title"); |
2030 | 2030 | <?php |
2031 | 2031 | // Si un extrafield est rempli alors on affiche directement les extrafields |
2032 | - if(!$isExtraSelected) { |
|
2032 | + if (!$isExtraSelected) { |
|
2033 | 2033 | echo 'all_tr_extrafields.hide();'; |
2034 | 2034 | echo 'var trad = "'.$langs->trans('showExtrafields').'";'; |
2035 | 2035 | echo 'var extra = 0;'; |
@@ -2075,20 +2075,20 @@ discard block |
||
2075 | 2075 | |
2076 | 2076 | |
2077 | 2077 | function addMoreActionsButtons($parameters, &$object, &$action, $hookmanager) { |
2078 | - global $conf,$langs; |
|
2078 | + global $conf, $langs; |
|
2079 | 2079 | |
2080 | 2080 | if ($object->statut == 0 && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && $action != 'editline') |
2081 | 2081 | { |
2082 | 2082 | |
2083 | - if($object->element == 'invoice_supplier' || $object->element == 'order_supplier') |
|
2083 | + if ($object->element == 'invoice_supplier' || $object->element == 'order_supplier') |
|
2084 | 2084 | { |
2085 | 2085 | foreach ($object->lines as $line) |
2086 | 2086 | { |
2087 | 2087 | // fetch optionals attributes and labels |
2088 | 2088 | require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); |
2089 | - $extrafields=new ExtraFields($this->db); |
|
2090 | - $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true); |
|
2091 | - $line->fetch_optionals($line->id,$extralabels); |
|
2089 | + $extrafields = new ExtraFields($this->db); |
|
2090 | + $extralabels = $extrafields->fetch_name_optionals_label($object->table_element_line, true); |
|
2091 | + $line->fetch_optionals($line->id, $extralabels); |
|
2092 | 2092 | } |
2093 | 2093 | } |
2094 | 2094 | |
@@ -2188,23 +2188,23 @@ discard block |
||
2188 | 2188 | $ThtmlData['data-qty'] = 0; //$line->qty; |
2189 | 2189 | $ThtmlData['data-level'] = TSubtotal::getNiveau($line); |
2190 | 2190 | |
2191 | - if(TSubtotal::isTitle($line)){ |
|
2191 | + if (TSubtotal::isTitle($line)) { |
|
2192 | 2192 | $ThtmlData['data-issubtotal'] = 'title'; |
2193 | - }elseif(TSubtotal::isSubtotal($line)){ |
|
2193 | + }elseif (TSubtotal::isSubtotal($line)) { |
|
2194 | 2194 | $ThtmlData['data-issubtotal'] = 'subtotal'; |
2195 | 2195 | } |
2196 | - else{ |
|
2196 | + else { |
|
2197 | 2197 | $ThtmlData['data-issubtotal'] = 'freetext'; |
2198 | 2198 | } |
2199 | 2199 | |
2200 | 2200 | |
2201 | 2201 | // Change or add data from hooks |
2202 | - $parameters = array_replace($parameters , array( 'ThtmlData' => $ThtmlData ) ); |
|
2202 | + $parameters = array_replace($parameters, array('ThtmlData' => $ThtmlData)); |
|
2203 | 2203 | |
2204 | 2204 | // hook |
2205 | - $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
|
2205 | + $reshook = $hookmanager->executeHooks('subtotalLineHtmlData', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
|
2206 | 2206 | if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
2207 | - if ($reshook>0) |
|
2207 | + if ($reshook > 0) |
|
2208 | 2208 | { |
2209 | 2209 | $ThtmlData = $hookmanager->resArray; |
2210 | 2210 | } |
@@ -2217,14 +2217,14 @@ discard block |
||
2217 | 2217 | function implodeHtmlData($ThtmlData = array()) |
2218 | 2218 | { |
2219 | 2219 | $data = ''; |
2220 | - foreach($ThtmlData as $k => $h ) |
|
2220 | + foreach ($ThtmlData as $k => $h) |
|
2221 | 2221 | { |
2222 | - if(is_array($h)) |
|
2222 | + if (is_array($h)) |
|
2223 | 2223 | { |
2224 | 2224 | $h = json_encode($h); |
2225 | 2225 | } |
2226 | 2226 | |
2227 | - $data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" '; |
|
2227 | + $data .= $k.'="'.dol_htmlentities($h, ENT_QUOTES).'" '; |
|
2228 | 2228 | } |
2229 | 2229 | |
2230 | 2230 | return $data; |
@@ -2232,26 +2232,26 @@ discard block |
||
2232 | 2232 | |
2233 | 2233 | function _ajax_block_order_js($object) |
2234 | 2234 | { |
2235 | - global $conf,$tagidfortablednd,$filepath,$langs; |
|
2235 | + global $conf, $tagidfortablednd, $filepath, $langs; |
|
2236 | 2236 | |
2237 | 2237 | /* |
2238 | 2238 | * this part of js is base on dolibarr htdocs/core/tpl/ajaxrow.tpl.php |
2239 | 2239 | * for compatibility reasons we don't use tableDnD but jquery sortable |
2240 | 2240 | */ |
2241 | 2241 | |
2242 | - $id=$object->id; |
|
2243 | - $nboflines=(isset($object->lines)?count($object->lines):0); |
|
2244 | - $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1; |
|
2242 | + $id = $object->id; |
|
2243 | + $nboflines = (isset($object->lines) ?count($object->lines) : 0); |
|
2244 | + $forcereloadpage = empty($conf->global->MAIN_FORCE_RELOAD_PAGE) ? 0 : 1; |
|
2245 | 2245 | |
2246 | - $id=$object->id; |
|
2247 | - $fk_element=$object->fk_element; |
|
2248 | - $table_element_line=$object->table_element_line; |
|
2249 | - $nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines)); |
|
2250 | - $tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd); |
|
2251 | - $filepath=(empty($filepath)?'':$filepath); |
|
2246 | + $id = $object->id; |
|
2247 | + $fk_element = $object->fk_element; |
|
2248 | + $table_element_line = $object->table_element_line; |
|
2249 | + $nboflines = (isset($object->lines) ?count($object->lines) : (empty($nboflines) ? 0 : $nboflines)); |
|
2250 | + $tagidfortablednd = (empty($tagidfortablednd) ? 'tablelines' : $tagidfortablednd); |
|
2251 | + $filepath = (empty($filepath) ? '' : $filepath); |
|
2252 | 2252 | |
2253 | 2253 | |
2254 | - if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1) |
|
2254 | + if (GETPOST('action', 'aZ09') != 'editline' && $nboflines > 1) |
|
2255 | 2255 | { |
2256 | 2256 | |
2257 | 2257 | ?> |
@@ -2269,7 +2269,7 @@ discard block |
||
2269 | 2269 | moveBlockCol.disableSelection(); // prevent selection |
2270 | 2270 | <?php if ($object->statut == 0) { ?> |
2271 | 2271 | // apply some graphical stuff |
2272 | - moveBlockCol.css("background-image",'url(<?php echo dol_buildpath('subtotal/img/grip_all.png',2); ?>)'); |
|
2272 | + moveBlockCol.css("background-image",'url(<?php echo dol_buildpath('subtotal/img/grip_all.png', 2); ?>)'); |
|
2273 | 2273 | moveBlockCol.css("background-repeat","no-repeat"); |
2274 | 2274 | moveBlockCol.css("background-position","center center"); |
2275 | 2275 | moveBlockCol.css("cursor","move"); |
@@ -75,8 +75,11 @@ discard block |
||
75 | 75 | if ($object->statut == 0 && $createRight) { |
76 | 76 | |
77 | 77 | |
78 | - if($object->element=='facture')$idvar = 'facid'; |
|
79 | - else $idvar='id'; |
|
78 | + if($object->element=='facture') { |
|
79 | + $idvar = 'facid'; |
|
80 | + } else { |
|
81 | + $idvar='id'; |
|
82 | + } |
|
80 | 83 | |
81 | 84 | if(in_array($action, array('add_title_line', 'add_total_line', 'add_subtitle_line', 'add_subtotal_line', 'add_free_text')) ) |
82 | 85 | { |
@@ -84,10 +87,11 @@ discard block |
||
84 | 87 | |
85 | 88 | if($action=='add_title_line') { |
86 | 89 | $title = GETPOST('title'); |
87 | - if(empty($title)) $title = $langs->trans('title'); |
|
90 | + if(empty($title)) { |
|
91 | + $title = $langs->trans('title'); |
|
92 | + } |
|
88 | 93 | $qty = $level<1 ? 1 : $level ; |
89 | - } |
|
90 | - else if($action=='add_free_text') { |
|
94 | + } else if($action=='add_free_text') { |
|
91 | 95 | $title = GETPOST('title'); |
92 | 96 | |
93 | 97 | if (empty($title)) { |
@@ -99,29 +103,31 @@ discard block |
||
99 | 103 | } |
100 | 104 | } |
101 | 105 | } |
102 | - if(empty($title)) $title = $langs->trans('subtotalAddLineDescription'); |
|
106 | + if(empty($title)) { |
|
107 | + $title = $langs->trans('subtotalAddLineDescription'); |
|
108 | + } |
|
103 | 109 | $qty = 50; |
104 | - } |
|
105 | - else if($action=='add_subtitle_line') { |
|
110 | + } else if($action=='add_subtitle_line') { |
|
106 | 111 | $title = GETPOST('title'); |
107 | - if(empty($title)) $title = $langs->trans('subtitle'); |
|
112 | + if(empty($title)) { |
|
113 | + $title = $langs->trans('subtitle'); |
|
114 | + } |
|
108 | 115 | $qty = 2; |
109 | - } |
|
110 | - else if($action=='add_subtotal_line') { |
|
116 | + } else if($action=='add_subtotal_line') { |
|
111 | 117 | $title = $langs->trans('SubSubTotal'); |
112 | 118 | $qty = 98; |
113 | - } |
|
114 | - else { |
|
119 | + } else { |
|
115 | 120 | $title = GETPOST('title') ? GETPOST('title') : $langs->trans('SubTotal'); |
116 | 121 | $qty = $level ? 100-$level : 99; |
117 | 122 | } |
118 | 123 | dol_include_once('/subtotal/class/subtotal.class.php'); |
119 | 124 | |
120 | - if (!empty($conf->global->SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE) && $qty < 10) TSubtotal::addSubtotalMissing($object, $qty); |
|
125 | + if (!empty($conf->global->SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE) && $qty < 10) { |
|
126 | + TSubtotal::addSubtotalMissing($object, $qty); |
|
127 | + } |
|
121 | 128 | |
122 | 129 | TSubtotal::addSubTotalLine($object, $title, $qty); |
123 | - } |
|
124 | - else if($action==='ask_deleteallline') { |
|
130 | + } else if($action==='ask_deleteallline') { |
|
125 | 131 | $form=new Form($db); |
126 | 132 | |
127 | 133 | $lineid = GETPOST('lineid','integer'); |
@@ -144,8 +150,7 @@ discard block |
||
144 | 150 | $this->printNewFormat($object, $conf, $langs, $idvar); |
145 | 151 | } |
146 | 152 | } |
147 | - } |
|
148 | - elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice',$contexts)) |
|
153 | + } elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice',$contexts)) |
|
149 | 154 | { |
150 | 155 | ?> |
151 | 156 | <script type="text/javascript"> |
@@ -163,8 +168,13 @@ discard block |
||
163 | 168 | |
164 | 169 | function printNewFormat(&$object, &$conf, &$langs, $idvar) |
165 | 170 | { |
166 | - if (empty($conf->global->SUBTOTAL_ALLOW_ADD_BLOCK)) return false; |
|
167 | - if (!empty($object->situation_cycle_ref) && $object->situation_counter > 1) return false; // Si facture de situation |
|
171 | + if (empty($conf->global->SUBTOTAL_ALLOW_ADD_BLOCK)) { |
|
172 | + return false; |
|
173 | + } |
|
174 | + if (!empty($object->situation_cycle_ref) && $object->situation_counter > 1) { |
|
175 | + return false; |
|
176 | + } |
|
177 | + // Si facture de situation |
|
168 | 178 | ?> |
169 | 179 | <script type="text/javascript"> |
170 | 180 | $(document).ready(function() { |
@@ -450,8 +460,7 @@ discard block |
||
450 | 460 | } |
451 | 461 | |
452 | 462 | |
453 | - } |
|
454 | - else{ |
|
463 | + } else{ |
|
455 | 464 | $substitutionarray['line_not_modsubtotal'] = true; |
456 | 465 | $substitutionarray['line_modsubtotal'] = 0; |
457 | 466 | } |
@@ -509,8 +518,11 @@ discard block |
||
509 | 518 | |
510 | 519 | $showBlockExtrafields = GETPOST('showBlockExtrafields'); |
511 | 520 | |
512 | - if($object->element=='facture') $idvar = 'facid'; |
|
513 | - else $idvar = 'id'; |
|
521 | + if($object->element=='facture') { |
|
522 | + $idvar = 'facid'; |
|
523 | + } else { |
|
524 | + $idvar = 'id'; |
|
525 | + } |
|
514 | 526 | |
515 | 527 | if ($action == 'updateligne' || $action == 'updateline') |
516 | 528 | { |
@@ -540,8 +552,7 @@ discard block |
||
540 | 552 | header('Location: '.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id); |
541 | 553 | exit; // Surtout ne pas laisser Dolibarr faire du traitement sur le updateligne sinon ça plante les données de la ligne |
542 | 554 | } |
543 | - } |
|
544 | - else if($action === 'builddoc') { |
|
555 | + } else if($action === 'builddoc') { |
|
545 | 556 | |
546 | 557 | if ( |
547 | 558 | in_array('invoicecard',explode(':',$parameters['context'])) |
@@ -556,33 +567,27 @@ discard block |
||
556 | 567 | $sessname = 'subtotal_hideInnerLines_facture'; |
557 | 568 | $sessname2 = 'subtotal_hidedetails_facture'; |
558 | 569 | $sessname3 = 'subtotal_hideprices_facture'; |
559 | - } |
|
560 | - elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) { |
|
570 | + } elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) { |
|
561 | 571 | $sessname = 'subtotal_hideInnerLines_facture_fournisseur'; |
562 | 572 | $sessname2 = 'subtotal_hidedetails_facture_fournisseur'; |
563 | 573 | $sessname3 = 'subtotal_hideprices_facture_fournisseur'; |
564 | - } |
|
565 | - elseif(in_array('propalcard',explode(':',$parameters['context']))) { |
|
574 | + } elseif(in_array('propalcard',explode(':',$parameters['context']))) { |
|
566 | 575 | $sessname = 'subtotal_hideInnerLines_propal'; |
567 | 576 | $sessname2 = 'subtotal_hidedetails_propal'; |
568 | 577 | $sessname3 = 'subtotal_hideprices_propal'; |
569 | - } |
|
570 | - elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) { |
|
578 | + } elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) { |
|
571 | 579 | $sessname = 'subtotal_hideInnerLines_supplier_proposal'; |
572 | 580 | $sessname2 = 'subtotal_hidedetails_supplier_proposal'; |
573 | 581 | $sessname3 = 'subtotal_hideprices_supplier_proposal'; |
574 | - } |
|
575 | - elseif(in_array('ordercard',explode(':',$parameters['context']))) { |
|
582 | + } elseif(in_array('ordercard',explode(':',$parameters['context']))) { |
|
576 | 583 | $sessname = 'subtotal_hideInnerLines_commande'; |
577 | 584 | $sessname2 = 'subtotal_hidedetails_commande'; |
578 | 585 | $sessname3 = 'subtotal_hideprices_commande'; |
579 | - } |
|
580 | - elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) { |
|
586 | + } elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) { |
|
581 | 587 | $sessname = 'subtotal_hideInnerLines_commande_fournisseur'; |
582 | 588 | $sessname2 = 'subtotal_hidedetails_commande_fournisseur'; |
583 | 589 | $sessname3 = 'subtotal_hideprices_commande_fournisseur'; |
584 | - } |
|
585 | - else { |
|
590 | + } else { |
|
586 | 591 | $sessname = 'subtotal_hideInnerLines_unknown'; |
587 | 592 | $sessname2 = 'subtotal_hidedetails_unknown'; |
588 | 593 | $sessname3 = 'subtotal_hideprices_unknown'; |
@@ -604,8 +609,7 @@ discard block |
||
604 | 609 | |
605 | 610 | if($line->qty>=90) { |
606 | 611 | $line->modsubtotal_total = 1; |
607 | - } |
|
608 | - else{ |
|
612 | + } else{ |
|
609 | 613 | $line->modsubtotal_title = 1; |
610 | 614 | } |
611 | 615 | |
@@ -614,8 +618,7 @@ discard block |
||
614 | 618 | } |
615 | 619 | } |
616 | 620 | |
617 | - } |
|
618 | - else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') { |
|
621 | + } else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') { |
|
619 | 622 | |
620 | 623 | $Tab = $this->getArrayOfLineForAGroup($object, GETPOST('lineid')); |
621 | 624 | |
@@ -623,7 +626,9 @@ discard block |
||
623 | 626 | /** |
624 | 627 | * @var $object Facture |
625 | 628 | */ |
626 | - if($object->element=='facture') $object->deleteline($idLine); |
|
629 | + if($object->element=='facture') { |
|
630 | + $object->deleteline($idLine); |
|
631 | + } |
|
627 | 632 | /** |
628 | 633 | * @var $object Facture fournisseur |
629 | 634 | */ |
@@ -634,18 +639,25 @@ discard block |
||
634 | 639 | /** |
635 | 640 | * @var $object Propal |
636 | 641 | */ |
637 | - else if($object->element=='propal') $object->deleteline($idLine); |
|
642 | + else if($object->element=='propal') { |
|
643 | + $object->deleteline($idLine); |
|
644 | + } |
|
638 | 645 | /** |
639 | 646 | * @var $object Propal Fournisseur |
640 | 647 | */ |
641 | - else if($object->element=='supplier_proposal') $object->deleteline($idLine); |
|
648 | + else if($object->element=='supplier_proposal') { |
|
649 | + $object->deleteline($idLine); |
|
650 | + } |
|
642 | 651 | /** |
643 | 652 | * @var $object Commande |
644 | 653 | */ |
645 | 654 | else if($object->element=='commande') |
646 | 655 | { |
647 | - if ((float) DOL_VERSION >= 5.0) $object->deleteline($user, $idLine); |
|
648 | - else $object->deleteline($idLine); |
|
656 | + if ((float) DOL_VERSION >= 5.0) { |
|
657 | + $object->deleteline($user, $idLine); |
|
658 | + } else { |
|
659 | + $object->deleteline($idLine); |
|
660 | + } |
|
649 | 661 | } |
650 | 662 | /** |
651 | 663 | * @var $object Commande fournisseur |
@@ -657,21 +669,26 @@ discard block |
||
657 | 669 | /** |
658 | 670 | * @var $object Facturerec |
659 | 671 | */ |
660 | - else if($object->element=='facturerec') $object->deleteline($idLine); |
|
672 | + else if($object->element=='facturerec') { |
|
673 | + $object->deleteline($idLine); |
|
674 | + } |
|
661 | 675 | } |
662 | 676 | |
663 | 677 | header('location:?id='.$object->id); |
664 | 678 | exit; |
665 | 679 | |
666 | - } |
|
667 | - else if ($action == 'duplicate') |
|
680 | + } else if ($action == 'duplicate') |
|
668 | 681 | { |
669 | 682 | $lineid = GETPOST('lineid', 'int'); |
670 | 683 | $nbDuplicate = TSubtotal::duplicateLines($object, $lineid, true); |
671 | 684 | |
672 | - if ($nbDuplicate > 0) setEventMessage($langs->trans('subtotal_duplicate_success', $nbDuplicate)); |
|
673 | - elseif ($nbDuplicate == 0) setEventMessage($langs->trans('subtotal_duplicate_lineid_not_found'), 'warnings'); |
|
674 | - else setEventMessage($langs->trans('subtotal_duplicate_error'), 'errors'); |
|
685 | + if ($nbDuplicate > 0) { |
|
686 | + setEventMessage($langs->trans('subtotal_duplicate_success', $nbDuplicate)); |
|
687 | + } elseif ($nbDuplicate == 0) { |
|
688 | + setEventMessage($langs->trans('subtotal_duplicate_lineid_not_found'), 'warnings'); |
|
689 | + } else { |
|
690 | + setEventMessage($langs->trans('subtotal_duplicate_error'), 'errors'); |
|
691 | + } |
|
675 | 692 | |
676 | 693 | header('Location: ?id='.$object->id); |
677 | 694 | exit; |
@@ -751,17 +768,18 @@ discard block |
||
751 | 768 | //print $l->rang.'>='.$rang.' '.$total.'<br/>'; |
752 | 769 | if($l->rang>=$rang) { |
753 | 770 | //echo 'return!<br>'; |
754 | - if (!$return_all) return $total; |
|
755 | - else return array($total, $total_tva, $total_ttc, $TTotal_tva); |
|
756 | - } |
|
757 | - else if(TSubtotal::isTitle($l, 100 - $qty_line)) |
|
771 | + if (!$return_all) { |
|
772 | + return $total; |
|
773 | + } else { |
|
774 | + return array($total, $total_tva, $total_ttc, $TTotal_tva); |
|
775 | + } |
|
776 | + } else if(TSubtotal::isTitle($l, 100 - $qty_line)) |
|
758 | 777 | { |
759 | 778 | $total = 0; |
760 | 779 | $total_tva = 0; |
761 | 780 | $total_ttc = 0; |
762 | 781 | $TTotal_tva = array(); |
763 | - } |
|
764 | - elseif(!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) { |
|
782 | + } elseif(!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) { |
|
765 | 783 | $total += $l->total_ht; |
766 | 784 | $total_tva += $l->total_tva; |
767 | 785 | $TTotal_tva[$l->tva_tx] += $l->total_tva; |
@@ -769,8 +787,11 @@ discard block |
||
769 | 787 | } |
770 | 788 | |
771 | 789 | } |
772 | - if (!$return_all) return $total; |
|
773 | - else return array($total, $total_tva, $total_ttc, $TTotal_tva); |
|
790 | + if (!$return_all) { |
|
791 | + return $total; |
|
792 | + } else { |
|
793 | + return array($total, $total_tva, $total_ttc, $TTotal_tva); |
|
794 | + } |
|
774 | 795 | } |
775 | 796 | |
776 | 797 | /* |
@@ -838,15 +859,18 @@ discard block |
||
838 | 859 | } |
839 | 860 | |
840 | 861 | |
841 | - if($line->qty==99) |
|
842 | - $pdf->SetFillColor(220,220,220); |
|
843 | - elseif ($line->qty==98) |
|
844 | - $pdf->SetFillColor(230,230,230); |
|
845 | - else |
|
846 | - $pdf->SetFillColor(240,240,240); |
|
862 | + if($line->qty==99) { |
|
863 | + $pdf->SetFillColor(220,220,220); |
|
864 | + } elseif ($line->qty==98) { |
|
865 | + $pdf->SetFillColor(230,230,230); |
|
866 | + } else { |
|
867 | + $pdf->SetFillColor(240,240,240); |
|
868 | + } |
|
847 | 869 | |
848 | 870 | $style = 'B'; |
849 | - if (!empty($conf->global->SUBTOTAL_SUBTOTAL_STYLE)) $style = $conf->global->SUBTOTAL_SUBTOTAL_STYLE; |
|
871 | + if (!empty($conf->global->SUBTOTAL_SUBTOTAL_STYLE)) { |
|
872 | + $style = $conf->global->SUBTOTAL_SUBTOTAL_STYLE; |
|
873 | + } |
|
850 | 874 | |
851 | 875 | $pdf->SetFont('', $style, 9); |
852 | 876 | |
@@ -885,8 +909,7 @@ discard block |
||
885 | 909 | // $line->total_tva |
886 | 910 | // $line->total |
887 | 911 | // $line->total_ttc |
888 | - } |
|
889 | - else |
|
912 | + } else |
|
890 | 913 | { |
891 | 914 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
892 | 915 | if(get_class($object) == 'Facture' && $object->type==Facture::TYPE_SITUATION){//Facture de situation |
@@ -903,11 +926,14 @@ discard block |
||
903 | 926 | } |
904 | 927 | |
905 | 928 | $pdf->SetXY($pdf->postotalht, $posy); |
906 | - if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
929 | + if($set_pagebreak_margin) { |
|
930 | + $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
931 | + } |
|
907 | 932 | $pdf->MultiCell($pdf->page_largeur-$pdf->marge_droite-$pdf->postotalht, 3, $total_to_print, 0, 'R', 0); |
908 | - } |
|
909 | - else{ |
|
910 | - if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
933 | + } else{ |
|
934 | + if($set_pagebreak_margin) { |
|
935 | + $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
936 | + } |
|
911 | 937 | } |
912 | 938 | |
913 | 939 | $posy = $posy + $cell_height; |
@@ -939,25 +965,40 @@ discard block |
||
939 | 965 | |
940 | 966 | |
941 | 967 | $style = ($line->qty==1) ? 'BU' : 'BUI'; |
942 | - if (!empty($conf->global->SUBTOTAL_TITLE_STYLE)) $style = $conf->global->SUBTOTAL_TITLE_STYLE; |
|
968 | + if (!empty($conf->global->SUBTOTAL_TITLE_STYLE)) { |
|
969 | + $style = $conf->global->SUBTOTAL_TITLE_STYLE; |
|
970 | + } |
|
943 | 971 | |
944 | 972 | if($hideInnerLines) { |
945 | - if($line->qty==1)$pdf->SetFont('', $style, 9); |
|
946 | - else |
|
973 | + if($line->qty==1) { |
|
974 | + $pdf->SetFont('', $style, 9); |
|
975 | + } else |
|
947 | 976 | { |
948 | - if (!empty($conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES)) $style = $conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES; |
|
977 | + if (!empty($conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES)) { |
|
978 | + $style = $conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES; |
|
979 | + } |
|
949 | 980 | $pdf->SetFont('', $style, 9); |
950 | 981 | } |
951 | - } |
|
952 | - else { |
|
982 | + } else { |
|
953 | 983 | |
954 | - if($line->qty==1)$pdf->SetFont('', $style, 9); //TODO if super utile |
|
955 | - else $pdf->SetFont('', $style, 9); |
|
984 | + if($line->qty==1) { |
|
985 | + $pdf->SetFont('', $style, 9); |
|
986 | + } |
|
987 | + //TODO if super utile |
|
988 | + else { |
|
989 | + $pdf->SetFont('', $style, 9); |
|
990 | + } |
|
956 | 991 | |
957 | 992 | } |
958 | 993 | |
959 | - if ($label === strip_tags($label) && $label === dol_html_entity_decode($label, ENT_QUOTES)) $pdf->MultiCell($w, $h, $label, 0, 'L'); // Pas de HTML dans la chaine |
|
960 | - else $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J',true); // et maintenant avec du HTML |
|
994 | + if ($label === strip_tags($label) && $label === dol_html_entity_decode($label, ENT_QUOTES)) { |
|
995 | + $pdf->MultiCell($w, $h, $label, 0, 'L'); |
|
996 | + } |
|
997 | + // Pas de HTML dans la chaine |
|
998 | + else { |
|
999 | + $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J',true); |
|
1000 | + } |
|
1001 | + // et maintenant avec du HTML |
|
961 | 1002 | |
962 | 1003 | if($description && !$hidedesc) { |
963 | 1004 | $posy = $pdf->GetY(); |
@@ -981,8 +1022,7 @@ discard block |
||
981 | 1022 | |
982 | 1023 | if(is_array($parameters)) { |
983 | 1024 | $i = & $parameters['i']; |
984 | - } |
|
985 | - else { |
|
1025 | + } else { |
|
986 | 1026 | $i = (int)$parameters; |
987 | 1027 | } |
988 | 1028 | |
@@ -1004,17 +1044,14 @@ discard block |
||
1004 | 1044 | |
1005 | 1045 | if((float)DOL_VERSION<=3.6) { |
1006 | 1046 | return ''; |
1007 | - } |
|
1008 | - else if((float)DOL_VERSION>=3.8) { |
|
1047 | + } else if((float)DOL_VERSION>=3.8) { |
|
1009 | 1048 | return 1; |
1010 | 1049 | } |
1011 | 1050 | |
1012 | - } |
|
1013 | - elseif(!empty($hideprices)) { |
|
1051 | + } elseif(!empty($hideprices)) { |
|
1014 | 1052 | $this->resprints = $object->lines[$parameters['i']]->qty; |
1015 | 1053 | return 1; |
1016 | - } |
|
1017 | - elseif (!empty($conf->global->SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY)) |
|
1054 | + } elseif (!empty($conf->global->SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY)) |
|
1018 | 1055 | { |
1019 | 1056 | $hideInnerLines = (int)GETPOST('hideInnerLines'); |
1020 | 1057 | $hidedetails = (int)GETPOST('hidedetails'); |
@@ -1024,12 +1061,20 @@ discard block |
||
1024 | 1061 | } |
1025 | 1062 | } |
1026 | 1063 | |
1027 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1028 | - else $i = (int)$parameters; |
|
1064 | + if(is_array($parameters)) { |
|
1065 | + $i = & $parameters['i']; |
|
1066 | + } else { |
|
1067 | + $i = (int)$parameters; |
|
1068 | + } |
|
1029 | 1069 | |
1030 | - if (empty($object->lines[$i])) return 0; // hideInnerLines => override $object->lines et Dolibarr ne nous permet pas de mettre à jour la variable qui conditionne la boucle sur les lignes (PR faite pour 6.0) |
|
1070 | + if (empty($object->lines[$i])) { |
|
1071 | + return 0; |
|
1072 | + } |
|
1073 | + // hideInnerLines => override $object->lines et Dolibarr ne nous permet pas de mettre à jour la variable qui conditionne la boucle sur les lignes (PR faite pour 6.0) |
|
1031 | 1074 | |
1032 | - if(empty($object->lines[$i]->array_options)) $object->lines[$i]->fetch_optionals(); |
|
1075 | + if(empty($object->lines[$i]->array_options)) { |
|
1076 | + $object->lines[$i]->fetch_optionals(); |
|
1077 | + } |
|
1033 | 1078 | |
1034 | 1079 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
1035 | 1080 | { |
@@ -1052,16 +1097,17 @@ discard block |
||
1052 | 1097 | |
1053 | 1098 | if((float)DOL_VERSION<=3.6) { |
1054 | 1099 | return ''; |
1055 | - } |
|
1056 | - else if((float)DOL_VERSION>=3.8) { |
|
1100 | + } else if((float)DOL_VERSION>=3.8) { |
|
1057 | 1101 | return 1; |
1058 | 1102 | } |
1059 | 1103 | |
1060 | - } |
|
1061 | - elseif (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS)) |
|
1104 | + } elseif (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS)) |
|
1062 | 1105 | { |
1063 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1064 | - else $i = (int)$parameters; |
|
1106 | + if(is_array($parameters)) { |
|
1107 | + $i = & $parameters['i']; |
|
1108 | + } else { |
|
1109 | + $i = (int)$parameters; |
|
1110 | + } |
|
1065 | 1111 | |
1066 | 1112 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
1067 | 1113 | { |
@@ -1083,8 +1129,11 @@ discard block |
||
1083 | 1129 | } |
1084 | 1130 | } |
1085 | 1131 | if ((int)GETPOST('hideInnerLines') && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)){ |
1086 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1087 | - else $i = (int)$parameters; |
|
1132 | + if(is_array($parameters)) { |
|
1133 | + $i = & $parameters['i']; |
|
1134 | + } else { |
|
1135 | + $i = (int)$parameters; |
|
1136 | + } |
|
1088 | 1137 | $this->resprints = price($object->lines[$i]->total_ht); |
1089 | 1138 | } |
1090 | 1139 | if (!empty($hideprices) |
@@ -1094,8 +1143,11 @@ discard block |
||
1094 | 1143 | if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
1095 | 1144 | { |
1096 | 1145 | |
1097 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1098 | - else $i = (int)$parameters; |
|
1146 | + if(is_array($parameters)) { |
|
1147 | + $i = & $parameters['i']; |
|
1148 | + } else { |
|
1149 | + $i = (int)$parameters; |
|
1150 | + } |
|
1099 | 1151 | |
1100 | 1152 | // Check if a title exist for this line && if the title have subtotal |
1101 | 1153 | $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
@@ -1119,14 +1171,16 @@ discard block |
||
1119 | 1171 | |
1120 | 1172 | if((float)DOL_VERSION<=3.6) { |
1121 | 1173 | return ''; |
1122 | - } |
|
1123 | - else if((float)DOL_VERSION>=3.8) { |
|
1174 | + } else if((float)DOL_VERSION>=3.8) { |
|
1124 | 1175 | return 1; |
1125 | 1176 | } |
1126 | 1177 | } |
1127 | 1178 | |
1128 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1129 | - else $i = (int)$parameters; |
|
1179 | + if(is_array($parameters)) { |
|
1180 | + $i = & $parameters['i']; |
|
1181 | + } else { |
|
1182 | + $i = (int)$parameters; |
|
1183 | + } |
|
1130 | 1184 | |
1131 | 1185 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
1132 | 1186 | { |
@@ -1148,14 +1202,16 @@ discard block |
||
1148 | 1202 | |
1149 | 1203 | if((float)DOL_VERSION<=3.6) { |
1150 | 1204 | return ''; |
1151 | - } |
|
1152 | - else if((float)DOL_VERSION>=3.8) { |
|
1205 | + } else if((float)DOL_VERSION>=3.8) { |
|
1153 | 1206 | return 1; |
1154 | 1207 | } |
1155 | 1208 | } |
1156 | 1209 | |
1157 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1158 | - else $i = (int)$parameters; |
|
1210 | + if(is_array($parameters)) { |
|
1211 | + $i = & $parameters['i']; |
|
1212 | + } else { |
|
1213 | + $i = (int)$parameters; |
|
1214 | + } |
|
1159 | 1215 | |
1160 | 1216 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
1161 | 1217 | { |
@@ -1177,13 +1233,15 @@ discard block |
||
1177 | 1233 | |
1178 | 1234 | if((float)DOL_VERSION<=3.6) { |
1179 | 1235 | return ''; |
1180 | - } |
|
1181 | - else if((float)DOL_VERSION>=3.8) { |
|
1236 | + } else if((float)DOL_VERSION>=3.8) { |
|
1182 | 1237 | return 1; |
1183 | 1238 | } |
1184 | 1239 | } |
1185 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1186 | - else $i = (int)$parameters; |
|
1240 | + if(is_array($parameters)) { |
|
1241 | + $i = & $parameters['i']; |
|
1242 | + } else { |
|
1243 | + $i = (int)$parameters; |
|
1244 | + } |
|
1187 | 1245 | |
1188 | 1246 | if (!empty($hideprices) |
1189 | 1247 | || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
@@ -1206,14 +1264,16 @@ discard block |
||
1206 | 1264 | $this->resprints = ' '; |
1207 | 1265 | if((float)DOL_VERSION<=3.6) { |
1208 | 1266 | return ''; |
1209 | - } |
|
1210 | - else if((float)DOL_VERSION>=3.8) { |
|
1267 | + } else if((float)DOL_VERSION>=3.8) { |
|
1211 | 1268 | return 1; |
1212 | 1269 | } |
1213 | 1270 | } |
1214 | 1271 | |
1215 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1216 | - else $i = (int)$parameters; |
|
1272 | + if(is_array($parameters)) { |
|
1273 | + $i = & $parameters['i']; |
|
1274 | + } else { |
|
1275 | + $i = (int)$parameters; |
|
1276 | + } |
|
1217 | 1277 | |
1218 | 1278 | if (!empty($hideprices) |
1219 | 1279 | || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
@@ -1237,16 +1297,21 @@ discard block |
||
1237 | 1297 | |
1238 | 1298 | if((float)DOL_VERSION<=3.6) { |
1239 | 1299 | return ''; |
1240 | - } |
|
1241 | - else if((float)DOL_VERSION>=3.8) { |
|
1300 | + } else if((float)DOL_VERSION>=3.8) { |
|
1242 | 1301 | return 1; |
1243 | 1302 | } |
1244 | 1303 | } |
1245 | 1304 | |
1246 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1247 | - else $i = (int)$parameters; |
|
1305 | + if(is_array($parameters)) { |
|
1306 | + $i = & $parameters['i']; |
|
1307 | + } else { |
|
1308 | + $i = (int)$parameters; |
|
1309 | + } |
|
1248 | 1310 | |
1249 | - if (empty($object->lines[$i])) return 0; // hideInnerLines => override $object->lines et Dolibarr ne nous permet pas de mettre à jour la variable qui conditionne la boucle sur les lignes (PR faite pour 6.0) |
|
1311 | + if (empty($object->lines[$i])) { |
|
1312 | + return 0; |
|
1313 | + } |
|
1314 | + // hideInnerLines => override $object->lines et Dolibarr ne nous permet pas de mettre à jour la variable qui conditionne la boucle sur les lignes (PR faite pour 6.0) |
|
1250 | 1315 | |
1251 | 1316 | $object->lines[$i]->fetch_optionals(); |
1252 | 1317 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
@@ -1268,14 +1333,16 @@ discard block |
||
1268 | 1333 | $this->resprints = ' '; |
1269 | 1334 | if((float)DOL_VERSION<=3.6) { |
1270 | 1335 | return ''; |
1271 | - } |
|
1272 | - else if((float)DOL_VERSION>=3.8) { |
|
1336 | + } else if((float)DOL_VERSION>=3.8) { |
|
1273 | 1337 | return 1; |
1274 | 1338 | } |
1275 | 1339 | } |
1276 | 1340 | |
1277 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1278 | - else $i = (int)$parameters; |
|
1341 | + if(is_array($parameters)) { |
|
1342 | + $i = & $parameters['i']; |
|
1343 | + } else { |
|
1344 | + $i = (int)$parameters; |
|
1345 | + } |
|
1279 | 1346 | |
1280 | 1347 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
1281 | 1348 | { |
@@ -1305,7 +1372,9 @@ discard block |
||
1305 | 1372 | } |
1306 | 1373 | } |
1307 | 1374 | |
1308 | - if (!empty($TLineTitle)) $TTitleNumeroted = $this->formatNumerotation($TLineTitle); |
|
1375 | + if (!empty($TLineTitle)) { |
|
1376 | + $TTitleNumeroted = $this->formatNumerotation($TLineTitle); |
|
1377 | + } |
|
1309 | 1378 | } |
1310 | 1379 | |
1311 | 1380 | } |
@@ -1319,8 +1388,12 @@ discard block |
||
1319 | 1388 | $j=0; |
1320 | 1389 | foreach ($TLineTitle as $k => &$line) |
1321 | 1390 | { |
1322 | - if (!empty($line_reference) && $line->rang <= $line_reference->rang) continue; |
|
1323 | - if (!empty($line_reference) && $line->qty <= $line_reference->qty) break; |
|
1391 | + if (!empty($line_reference) && $line->rang <= $line_reference->rang) { |
|
1392 | + continue; |
|
1393 | + } |
|
1394 | + if (!empty($line_reference) && $line->qty <= $line_reference->qty) { |
|
1395 | + break; |
|
1396 | + } |
|
1324 | 1397 | |
1325 | 1398 | if ($line->qty == $level) |
1326 | 1399 | { |
@@ -1354,7 +1427,9 @@ discard block |
||
1354 | 1427 | |
1355 | 1428 | $hidedetails = (int)GETPOST('hidedetails'); |
1356 | 1429 | |
1357 | - if(empty($hidedetails)) return false; |
|
1430 | + if(empty($hidedetails)) { |
|
1431 | + return false; |
|
1432 | + } |
|
1358 | 1433 | |
1359 | 1434 | // TODO can't add VAT to document without lines... :-/ |
1360 | 1435 | |
@@ -1407,7 +1482,9 @@ discard block |
||
1407 | 1482 | */ |
1408 | 1483 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
1409 | 1484 | |
1410 | - if (TSubtotal::getNiveau($line) == 1) $line->TTotal_tva = $TTotal_tva; |
|
1485 | + if (TSubtotal::getNiveau($line) == 1) { |
|
1486 | + $line->TTotal_tva = $TTotal_tva; |
|
1487 | + } |
|
1411 | 1488 | $line->total_ht = $total; |
1412 | 1489 | $line->total_tva = $total_tva; |
1413 | 1490 | $line->total = $line->total_ht; |
@@ -1462,8 +1539,7 @@ discard block |
||
1462 | 1539 | } |
1463 | 1540 | |
1464 | 1541 | |
1465 | - } |
|
1466 | - elseif ($hidedetails) |
|
1542 | + } elseif ($hidedetails) |
|
1467 | 1543 | { |
1468 | 1544 | $TLines[] = $line; //Cas où je cache uniquement les prix des produits |
1469 | 1545 | } |
@@ -1534,7 +1610,9 @@ discard block |
||
1534 | 1610 | |
1535 | 1611 | if(!empty($hideprices)) { |
1536 | 1612 | foreach($object->lines as &$line) { |
1537 | - if($line->fk_product_type!=9) $line->fk_parent_line = -1; |
|
1613 | + if($line->fk_product_type!=9) { |
|
1614 | + $line->fk_parent_line = -1; |
|
1615 | + } |
|
1538 | 1616 | } |
1539 | 1617 | } |
1540 | 1618 | |
@@ -1555,7 +1633,9 @@ discard block |
||
1555 | 1633 | |
1556 | 1634 | if($line->qty>90) { |
1557 | 1635 | |
1558 | - if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) $label .= ' '.$this->getTitle($object, $line); |
|
1636 | + if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) { |
|
1637 | + $label .= ' '.$this->getTitle($object, $line); |
|
1638 | + } |
|
1559 | 1639 | |
1560 | 1640 | $pageBefore = $pdf->getPage(); |
1561 | 1641 | $this->pdf_add_total($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
@@ -1573,8 +1653,7 @@ discard block |
||
1573 | 1653 | |
1574 | 1654 | $posy = $pdf->GetY(); |
1575 | 1655 | return 1; |
1576 | - } |
|
1577 | - else if ($line->qty < 10) { |
|
1656 | + } else if ($line->qty < 10) { |
|
1578 | 1657 | $pageBefore = $pdf->getPage(); |
1579 | 1658 | |
1580 | 1659 | $this->pdf_add_title($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
@@ -1598,8 +1677,7 @@ discard block |
||
1598 | 1677 | // if($line->rowid==47) exit; |
1599 | 1678 | |
1600 | 1679 | return 0; |
1601 | - } |
|
1602 | - elseif (empty($object->lines[$parameters['i']])) |
|
1680 | + } elseif (empty($object->lines[$parameters['i']])) |
|
1603 | 1681 | { |
1604 | 1682 | $this->resprints = -1; |
1605 | 1683 | } |
@@ -1632,7 +1710,9 @@ discard block |
||
1632 | 1710 | |
1633 | 1711 | foreach ($object->lines as $line) |
1634 | 1712 | { |
1635 | - if ($line->id == $currentLine->id) break; |
|
1713 | + if ($line->id == $currentLine->id) { |
|
1714 | + break; |
|
1715 | + } |
|
1636 | 1716 | |
1637 | 1717 | $qty_search = 100 - $currentLine->qty; |
1638 | 1718 | |
@@ -1669,23 +1749,23 @@ discard block |
||
1669 | 1749 | { |
1670 | 1750 | $object->statut = 0; // hack for facture rec |
1671 | 1751 | $createRight = $user->rights->facture->creer; |
1672 | - } |
|
1673 | - elseif($object->element == 'order_supplier' ) |
|
1752 | + } elseif($object->element == 'order_supplier' ) |
|
1674 | 1753 | { |
1675 | 1754 | $createRight = $user->rights->fournisseur->commande->creer; |
1676 | - } |
|
1677 | - elseif($object->element == 'invoice_supplier' ) |
|
1755 | + } elseif($object->element == 'invoice_supplier' ) |
|
1678 | 1756 | { |
1679 | 1757 | $createRight = $user->rights->fournisseur->facture->creer; |
1680 | 1758 | } |
1681 | 1759 | |
1682 | 1760 | if($line->special_code!=$this->module_number || $line->product_type!=9) { |
1683 | 1761 | null; |
1684 | - } |
|
1685 | - else if (in_array('invoicecard',$contexts) || in_array('invoicesuppliercard',$contexts) || in_array('propalcard',$contexts) || in_array('supplier_proposalcard',$contexts) || in_array('ordercard',$contexts) || in_array('ordersuppliercard',$contexts) || in_array('invoicereccard',$contexts)) |
|
1762 | + } else if (in_array('invoicecard',$contexts) || in_array('invoicesuppliercard',$contexts) || in_array('propalcard',$contexts) || in_array('supplier_proposalcard',$contexts) || in_array('ordercard',$contexts) || in_array('ordersuppliercard',$contexts) || in_array('invoicereccard',$contexts)) |
|
1686 | 1763 | { |
1687 | - if($object->element=='facture')$idvar = 'facid'; |
|
1688 | - else $idvar='id'; |
|
1764 | + if($object->element=='facture') { |
|
1765 | + $idvar = 'facid'; |
|
1766 | + } else { |
|
1767 | + $idvar='id'; |
|
1768 | + } |
|
1689 | 1769 | |
1690 | 1770 | if((float)DOL_VERSION <= 3.4) |
1691 | 1771 | { |
@@ -1711,20 +1791,44 @@ discard block |
||
1711 | 1791 | <?php |
1712 | 1792 | } |
1713 | 1793 | |
1714 | - if(empty($line->description)) $line->description = $line->desc; |
|
1794 | + if(empty($line->description)) { |
|
1795 | + $line->description = $line->desc; |
|
1796 | + } |
|
1715 | 1797 | |
1716 | 1798 | $colspan = 5; |
1717 | - if($object->element == 'facturerec' ) $colspan = 3; |
|
1718 | - if($object->element == 'order_supplier') $colspan = 3; |
|
1719 | - if($object->element == 'invoice_supplier') $colspan = 4; |
|
1720 | - if($object->element == 'supplier_proposal') $colspan = 4; |
|
1721 | - if(!empty($conf->multicurrency->enabled)) $colspan+=2; |
|
1722 | - if($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) $colspan++; |
|
1723 | - if(!empty($conf->margin->enabled)) $colspan++; |
|
1724 | - if(!empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; |
|
1725 | - if(!empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; |
|
1726 | - if($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) $colspan++; |
|
1727 | - if(!empty($conf->global->PRODUCT_USE_UNITS)) $colspan++; |
|
1799 | + if($object->element == 'facturerec' ) { |
|
1800 | + $colspan = 3; |
|
1801 | + } |
|
1802 | + if($object->element == 'order_supplier') { |
|
1803 | + $colspan = 3; |
|
1804 | + } |
|
1805 | + if($object->element == 'invoice_supplier') { |
|
1806 | + $colspan = 4; |
|
1807 | + } |
|
1808 | + if($object->element == 'supplier_proposal') { |
|
1809 | + $colspan = 4; |
|
1810 | + } |
|
1811 | + if(!empty($conf->multicurrency->enabled)) { |
|
1812 | + $colspan+=2; |
|
1813 | + } |
|
1814 | + if($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) { |
|
1815 | + $colspan++; |
|
1816 | + } |
|
1817 | + if(!empty($conf->margin->enabled)) { |
|
1818 | + $colspan++; |
|
1819 | + } |
|
1820 | + if(!empty($conf->global->DISPLAY_MARGIN_RATES)) { |
|
1821 | + $colspan++; |
|
1822 | + } |
|
1823 | + if(!empty($conf->global->DISPLAY_MARK_RATES)) { |
|
1824 | + $colspan++; |
|
1825 | + } |
|
1826 | + if($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) { |
|
1827 | + $colspan++; |
|
1828 | + } |
|
1829 | + if(!empty($conf->global->PRODUCT_USE_UNITS)) { |
|
1830 | + $colspan++; |
|
1831 | + } |
|
1728 | 1832 | |
1729 | 1833 | /* Titre */ |
1730 | 1834 | //var_dump($line); |
@@ -1737,23 +1841,36 @@ discard block |
||
1737 | 1841 | <tr <?php echo $bc[$var]; $var=!$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
1738 | 1842 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT)) |
1739 | 1843 | { |
1740 | - if($line->qty==99) print 'background:#adadcf'; |
|
1741 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
1742 | - else if($line->qty<=97 && $line->qty>=91) print 'background:#eeeeff;'; |
|
1743 | - else if($line->qty==1) print 'background:#adadcf;'; |
|
1744 | - else if($line->qty==2) print 'background:#ddddff;'; |
|
1745 | - else if($line->qty==50) print ''; |
|
1746 | - else print 'background:#eeeeff;'; |
|
1844 | + if($line->qty==99) { |
|
1845 | + print 'background:#adadcf'; |
|
1846 | + } else if($line->qty==98) { |
|
1847 | + print 'background:#ddddff;'; |
|
1848 | + } else if($line->qty<=97 && $line->qty>=91) { |
|
1849 | + print 'background:#eeeeff;'; |
|
1850 | + } else if($line->qty==1) { |
|
1851 | + print 'background:#adadcf;'; |
|
1852 | + } else if($line->qty==2) { |
|
1853 | + print 'background:#ddddff;'; |
|
1854 | + } else if($line->qty==50) { |
|
1855 | + print ''; |
|
1856 | + } else { |
|
1857 | + print 'background:#eeeeff;'; |
|
1858 | + } |
|
1747 | 1859 | |
1748 | 1860 | //A compléter si on veux plus de nuances de couleurs avec les niveau 4,5,6,7,8 et 9 |
1749 | - } |
|
1750 | - else |
|
1861 | + } else |
|
1751 | 1862 | { |
1752 | - if($line->qty==99) print 'background:#ddffdd'; |
|
1753 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
1754 | - else if($line->qty==2) print 'background:#eeeeff; '; |
|
1755 | - else if($line->qty==50) print ''; |
|
1756 | - else print 'background:#eeffee;' ; |
|
1863 | + if($line->qty==99) { |
|
1864 | + print 'background:#ddffdd'; |
|
1865 | + } else if($line->qty==98) { |
|
1866 | + print 'background:#ddddff;'; |
|
1867 | + } else if($line->qty==2) { |
|
1868 | + print 'background:#eeeeff; '; |
|
1869 | + } else if($line->qty==50) { |
|
1870 | + print ''; |
|
1871 | + } else { |
|
1872 | + print 'background:#eeffee;' ; |
|
1873 | + } |
|
1757 | 1874 | } |
1758 | 1875 | |
1759 | 1876 | ?>;"> |
@@ -1776,13 +1893,11 @@ discard block |
||
1776 | 1893 | $qty_displayed = $line->qty; |
1777 | 1894 | print img_picto('', 'subsubtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;color:#0075DE;">'.$qty_displayed.'</span> '; |
1778 | 1895 | |
1779 | - } |
|
1780 | - else if (TSubtotal::isSubtotal($line)) |
|
1896 | + } else if (TSubtotal::isSubtotal($line)) |
|
1781 | 1897 | { |
1782 | 1898 | $qty_displayed = 100 - $line->qty; |
1783 | 1899 | print img_picto('', 'subsubtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;color:#0075DE;">'.$qty_displayed.'</span> '; |
1784 | - } |
|
1785 | - else |
|
1900 | + } else |
|
1786 | 1901 | { |
1787 | 1902 | $isFreeText = true; |
1788 | 1903 | } |
@@ -1803,9 +1918,13 @@ discard block |
||
1803 | 1918 | } |
1804 | 1919 | |
1805 | 1920 | $readonlyForSituation = ''; |
1806 | - if (!empty($object->situation_cycle_ref) && $object->situation_counter > 1) $readonlyForSituation = 'readonly'; |
|
1921 | + if (!empty($object->situation_cycle_ref) && $object->situation_counter > 1) { |
|
1922 | + $readonlyForSituation = 'readonly'; |
|
1923 | + } |
|
1807 | 1924 | |
1808 | - if (!$isFreeText) echo '<input type="text" name="line-title" id-line="'.$line->id.'" value="'.$newlabel.'" size="80" '.$readonlyForSituation.'/> '; |
|
1925 | + if (!$isFreeText) { |
|
1926 | + echo '<input type="text" name="line-title" id-line="'.$line->id.'" value="'.$newlabel.'" size="80" '.$readonlyForSituation.'/> '; |
|
1927 | + } |
|
1809 | 1928 | |
1810 | 1929 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT) && (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) ) |
1811 | 1930 | { |
@@ -1813,8 +1932,12 @@ discard block |
||
1813 | 1932 | for ($j=1; $j<10; $j++) |
1814 | 1933 | { |
1815 | 1934 | if (!empty($readonlyForSituation)) { |
1816 | - if ($qty_displayed == $j) $select .= '<option selected="selected" value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
|
1817 | - } else $select .= '<option '.($qty_displayed == $j ? 'selected="selected"' : '').' value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
|
1935 | + if ($qty_displayed == $j) { |
|
1936 | + $select .= '<option selected="selected" value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
|
1937 | + } |
|
1938 | + } else { |
|
1939 | + $select .= '<option '.($qty_displayed == $j ? 'selected="selected"' : '').' value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
|
1940 | + } |
|
1818 | 1941 | } |
1819 | 1942 | $select .= '</select> '; |
1820 | 1943 | |
@@ -1830,15 +1953,18 @@ discard block |
||
1830 | 1953 | $form = new Form($db); |
1831 | 1954 | echo '<label for="subtotal_tva_tx">'.$form->textwithpicto($langs->trans('subtotal_apply_default_tva'), $langs->trans('subtotal_apply_default_tva_help')).'</label>'; |
1832 | 1955 | echo '<select id="subtotal_tva_tx" name="subtotal_tva_tx" class="flat"><option selected="selected" value="">-</option>'; |
1833 | - if (empty($readonlyForSituation)) echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true)); |
|
1956 | + if (empty($readonlyForSituation)) { |
|
1957 | + echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true)); |
|
1958 | + } |
|
1834 | 1959 | echo '</select> '; |
1835 | 1960 | |
1836 | 1961 | if (!empty($conf->global->INVOICE_USE_SITUATION) && $object->element == 'facture' && $object->type == Facture::TYPE_SITUATION) |
1837 | 1962 | { |
1838 | 1963 | echo '<label for="subtotal_progress">'.$langs->trans('subtotal_apply_progress').'</label> <input id="subtotal_progress" name="subtotal_progress" value="" size="1" />%'; |
1839 | 1964 | } |
1965 | + } else if ($isFreeText) { |
|
1966 | + echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation); |
|
1840 | 1967 | } |
1841 | - else if ($isFreeText) echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation); |
|
1842 | 1968 | echo '</div>'; |
1843 | 1969 | |
1844 | 1970 | if($line->qty<10) { |
@@ -1858,8 +1984,7 @@ discard block |
||
1858 | 1984 | $doleditor->Create(); |
1859 | 1985 | } |
1860 | 1986 | |
1861 | - } |
|
1862 | - else { |
|
1987 | + } else { |
|
1863 | 1988 | |
1864 | 1989 | if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) |
1865 | 1990 | { |
@@ -1867,14 +1992,19 @@ discard block |
||
1867 | 1992 | { |
1868 | 1993 | echo str_repeat(' ', $line->qty-1); |
1869 | 1994 | |
1870 | - if (TSubtotal::isTitle($line)) print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
|
1871 | - else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
1995 | + if (TSubtotal::isTitle($line)) { |
|
1996 | + print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
|
1997 | + } else { |
|
1998 | + print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
1999 | + } |
|
1872 | 2000 | } |
1873 | - } |
|
1874 | - else |
|
2001 | + } else |
|
1875 | 2002 | { |
1876 | - if($line->qty<=1) print img_picto('', 'subtotal@subtotal'); |
|
1877 | - else if($line->qty==2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
2003 | + if($line->qty<=1) { |
|
2004 | + print img_picto('', 'subtotal@subtotal'); |
|
2005 | + } else if($line->qty==2) { |
|
2006 | + print img_picto('', 'subsubtotal@subtotal').' '; |
|
2007 | + } |
|
1878 | 2008 | } |
1879 | 2009 | |
1880 | 2010 | |
@@ -1884,21 +2014,26 @@ discard block |
||
1884 | 2014 | $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
1885 | 2015 | |
1886 | 2016 | if (empty($line->label)) { |
1887 | - if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) print $line->description.' '.$this->getTitle($object, $line); |
|
1888 | - else print $line->description; |
|
1889 | - } |
|
1890 | - else { |
|
2017 | + if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) { |
|
2018 | + print $line->description.' '.$this->getTitle($object, $line); |
|
2019 | + } else { |
|
2020 | + print $line->description; |
|
2021 | + } |
|
2022 | + } else { |
|
1891 | 2023 | |
1892 | 2024 | if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
1893 | 2025 | print '<span class="subtotal_label" style="'.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" >'.$line->label.'</span><br><div class="subtotal_desc">'.dol_htmlentitiesbr($line->description).'</div>'; |
1894 | - } |
|
1895 | - else{ |
|
2026 | + } else{ |
|
1896 | 2027 | print '<span class="subtotal_label classfortooltip '.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" title="'.$line->description.'">'.$line->label.'</span>'; |
1897 | 2028 | } |
1898 | 2029 | |
1899 | 2030 | } |
1900 | - if($line->qty>90) print ' : '; |
|
1901 | - if($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
2031 | + if($line->qty>90) { |
|
2032 | + print ' : '; |
|
2033 | + } |
|
2034 | + if($line->info_bits > 0) { |
|
2035 | + echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
2036 | + } |
|
1902 | 2037 | |
1903 | 2038 | |
1904 | 2039 | |
@@ -1935,11 +2070,12 @@ discard block |
||
1935 | 2070 | </script> |
1936 | 2071 | <?php |
1937 | 2072 | |
1938 | - } |
|
1939 | - else{ |
|
2073 | + } else{ |
|
1940 | 2074 | if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) && $object->element !== 'invoice_supplier') |
1941 | 2075 | { |
1942 | - if(TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref) ) echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=duplicate&lineid='.$line->id.'">'. img_picto($langs->trans('Duplicate'), 'duplicate@subtotal').'</a>'; |
|
2076 | + if(TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref) ) { |
|
2077 | + echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=duplicate&lineid='.$line->id.'">'. img_picto($langs->trans('Duplicate'), 'duplicate@subtotal').'</a>'; |
|
2078 | + } |
|
1943 | 2079 | } |
1944 | 2080 | |
1945 | 2081 | if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_EDIT_BLOCK)) |
@@ -2008,7 +2144,9 @@ discard block |
||
2008 | 2144 | $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); |
2009 | 2145 | |
2010 | 2146 | $colspan+=3; $mode = 'view'; |
2011 | - if($action === 'editline' && $line->rowid == GETPOST('lineid')) $mode = 'edit'; |
|
2147 | + if($action === 'editline' && $line->rowid == GETPOST('lineid')) { |
|
2148 | + $mode = 'edit'; |
|
2149 | + } |
|
2012 | 2150 | |
2013 | 2151 | $ex_element = $line->element; |
2014 | 2152 | $line->element = 'tr_extrafield_title '.$line->element; // Pour pouvoir manipuler ces tr |
@@ -2190,10 +2328,9 @@ discard block |
||
2190 | 2328 | |
2191 | 2329 | if(TSubtotal::isTitle($line)){ |
2192 | 2330 | $ThtmlData['data-issubtotal'] = 'title'; |
2193 | - }elseif(TSubtotal::isSubtotal($line)){ |
|
2331 | + } elseif(TSubtotal::isSubtotal($line)){ |
|
2194 | 2332 | $ThtmlData['data-issubtotal'] = 'subtotal'; |
2195 | - } |
|
2196 | - else{ |
|
2333 | + } else{ |
|
2197 | 2334 | $ThtmlData['data-issubtotal'] = 'freetext'; |
2198 | 2335 | } |
2199 | 2336 | |
@@ -2203,7 +2340,9 @@ discard block |
||
2203 | 2340 | |
2204 | 2341 | // hook |
2205 | 2342 | $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
2206 | - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
2343 | + if ($reshook < 0) { |
|
2344 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
2345 | + } |
|
2207 | 2346 | if ($reshook>0) |
2208 | 2347 | { |
2209 | 2348 | $ThtmlData = $hookmanager->resArray; |