@@ -6,73 +6,73 @@ |
||
6 | 6 | |
7 | 7 | if((float)DOL_VERSION >= 7) |
8 | 8 | { |
9 | - print "Début de conversion des lignes de propale<br>"; |
|
10 | - $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."propaldet WHERE special_code = 104777 AND qty != 50 AND product_type = 9 AND (label = '' OR label IS NULL)"; |
|
11 | - $res = $db->query($sql); |
|
12 | - if($res) |
|
13 | - { |
|
14 | - print $db->num_rows($res)." lignes à convertir<br>"; |
|
15 | - $i = 0; |
|
16 | - while ($obj = $db->fetch_object($res)) |
|
17 | - { |
|
18 | - $prop = new PropaleLigne($db); |
|
19 | - $prop->fetch($obj->rowid); |
|
20 | - $prop->fetch_optionals(); |
|
21 | - if (empty($prop->label)){ |
|
22 | - $prop->label = strip_tags($prop->desc); |
|
23 | - $prop->desc = ''; |
|
24 | - } |
|
25 | - $ret = $prop->update(1); |
|
26 | - if($ret>0) $i++; |
|
27 | - } |
|
28 | - print $i." lignes converties<br>"; |
|
29 | - } |
|
9 | + print "Début de conversion des lignes de propale<br>"; |
|
10 | + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."propaldet WHERE special_code = 104777 AND qty != 50 AND product_type = 9 AND (label = '' OR label IS NULL)"; |
|
11 | + $res = $db->query($sql); |
|
12 | + if($res) |
|
13 | + { |
|
14 | + print $db->num_rows($res)." lignes à convertir<br>"; |
|
15 | + $i = 0; |
|
16 | + while ($obj = $db->fetch_object($res)) |
|
17 | + { |
|
18 | + $prop = new PropaleLigne($db); |
|
19 | + $prop->fetch($obj->rowid); |
|
20 | + $prop->fetch_optionals(); |
|
21 | + if (empty($prop->label)){ |
|
22 | + $prop->label = strip_tags($prop->desc); |
|
23 | + $prop->desc = ''; |
|
24 | + } |
|
25 | + $ret = $prop->update(1); |
|
26 | + if($ret>0) $i++; |
|
27 | + } |
|
28 | + print $i." lignes converties<br>"; |
|
29 | + } |
|
30 | 30 | |
31 | - print "Début de conversion des lignes de commande<br>"; |
|
32 | - $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."commandedet WHERE special_code = 104777 AND qty != 50 AND product_type = 9 AND (label = '' OR label IS NULL)"; |
|
33 | - $res = $db->query($sql); |
|
34 | - if($res) |
|
35 | - { |
|
36 | - print $db->num_rows($res)." lignes à convertir<br>"; |
|
37 | - $i = 0; |
|
38 | - while ($obj = $db->fetch_object($res)) |
|
39 | - { |
|
40 | - $cdeline = new OrderLine($db); |
|
41 | - $cdeline->fetch($obj->rowid); |
|
42 | - $cdeline->fetch_optionals($obj->rowid); |
|
43 | - if (empty($cdeline->label)){ |
|
44 | - $cdeline->label = strip_tags($cdeline->desc); |
|
45 | - $cdeline->desc = ''; |
|
46 | - } |
|
47 | - $ret = $cdeline->update($user, 1); |
|
48 | - if($ret>0) $i++; |
|
49 | - } |
|
31 | + print "Début de conversion des lignes de commande<br>"; |
|
32 | + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."commandedet WHERE special_code = 104777 AND qty != 50 AND product_type = 9 AND (label = '' OR label IS NULL)"; |
|
33 | + $res = $db->query($sql); |
|
34 | + if($res) |
|
35 | + { |
|
36 | + print $db->num_rows($res)." lignes à convertir<br>"; |
|
37 | + $i = 0; |
|
38 | + while ($obj = $db->fetch_object($res)) |
|
39 | + { |
|
40 | + $cdeline = new OrderLine($db); |
|
41 | + $cdeline->fetch($obj->rowid); |
|
42 | + $cdeline->fetch_optionals($obj->rowid); |
|
43 | + if (empty($cdeline->label)){ |
|
44 | + $cdeline->label = strip_tags($cdeline->desc); |
|
45 | + $cdeline->desc = ''; |
|
46 | + } |
|
47 | + $ret = $cdeline->update($user, 1); |
|
48 | + if($ret>0) $i++; |
|
49 | + } |
|
50 | 50 | |
51 | - print $i." lignes converties<br>"; |
|
52 | - } |
|
51 | + print $i." lignes converties<br>"; |
|
52 | + } |
|
53 | 53 | |
54 | - print "Début de conversion des lignes de facture<br>"; |
|
55 | - $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facturedet WHERE special_code = 104777 AND qty != 50 AND product_type = 9 AND (label = '' OR label IS NULL)"; |
|
54 | + print "Début de conversion des lignes de facture<br>"; |
|
55 | + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facturedet WHERE special_code = 104777 AND qty != 50 AND product_type = 9 AND (label = '' OR label IS NULL)"; |
|
56 | 56 | |
57 | - $res = $db->query($sql); |
|
58 | - if($res) |
|
59 | - { |
|
60 | - print $db->num_rows($res)." lignes à convertir<br>"; |
|
61 | - $i = 0; |
|
62 | - while ($obj = $db->fetch_object($res)) |
|
63 | - { |
|
64 | - $facline = new FactureLigne($db); |
|
65 | - $facline->fetch($obj->rowid); |
|
66 | - $facline->fetch_optionals($obj->rowid); |
|
67 | - if (empty($facline->label)){ |
|
68 | - $facline->label = strip_tags($facline->desc); |
|
69 | - $facline->desc = ''; |
|
70 | - } |
|
71 | - $ret = $facline->update($user, 1); |
|
72 | - if($ret>0) $i++; |
|
73 | - } |
|
57 | + $res = $db->query($sql); |
|
58 | + if($res) |
|
59 | + { |
|
60 | + print $db->num_rows($res)." lignes à convertir<br>"; |
|
61 | + $i = 0; |
|
62 | + while ($obj = $db->fetch_object($res)) |
|
63 | + { |
|
64 | + $facline = new FactureLigne($db); |
|
65 | + $facline->fetch($obj->rowid); |
|
66 | + $facline->fetch_optionals($obj->rowid); |
|
67 | + if (empty($facline->label)){ |
|
68 | + $facline->label = strip_tags($facline->desc); |
|
69 | + $facline->desc = ''; |
|
70 | + } |
|
71 | + $ret = $facline->update($user, 1); |
|
72 | + if($ret>0) $i++; |
|
73 | + } |
|
74 | 74 | |
75 | - print $i." lignes converties<br>"; |
|
76 | - } |
|
75 | + print $i." lignes converties<br>"; |
|
76 | + } |
|
77 | 77 | |
78 | 78 | } |
79 | 79 | \ No newline at end of file |
@@ -4,12 +4,12 @@ discard block |
||
4 | 4 | dol_include_once('/commande/class/commande.class.php'); |
5 | 5 | dol_include_once('/compta/facture/class/facture.class.php'); |
6 | 6 | |
7 | -if((float)DOL_VERSION >= 7) |
|
7 | +if ((float) DOL_VERSION >= 7) |
|
8 | 8 | { |
9 | 9 | print "Début de conversion des lignes de propale<br>"; |
10 | 10 | $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."propaldet WHERE special_code = 104777 AND qty != 50 AND product_type = 9 AND (label = '' OR label IS NULL)"; |
11 | 11 | $res = $db->query($sql); |
12 | - if($res) |
|
12 | + if ($res) |
|
13 | 13 | { |
14 | 14 | print $db->num_rows($res)." lignes à convertir<br>"; |
15 | 15 | $i = 0; |
@@ -18,12 +18,12 @@ discard block |
||
18 | 18 | $prop = new PropaleLigne($db); |
19 | 19 | $prop->fetch($obj->rowid); |
20 | 20 | $prop->fetch_optionals(); |
21 | - if (empty($prop->label)){ |
|
21 | + if (empty($prop->label)) { |
|
22 | 22 | $prop->label = strip_tags($prop->desc); |
23 | 23 | $prop->desc = ''; |
24 | 24 | } |
25 | 25 | $ret = $prop->update(1); |
26 | - if($ret>0) $i++; |
|
26 | + if ($ret > 0) $i++; |
|
27 | 27 | } |
28 | 28 | print $i." lignes converties<br>"; |
29 | 29 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | print "Début de conversion des lignes de commande<br>"; |
32 | 32 | $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."commandedet WHERE special_code = 104777 AND qty != 50 AND product_type = 9 AND (label = '' OR label IS NULL)"; |
33 | 33 | $res = $db->query($sql); |
34 | - if($res) |
|
34 | + if ($res) |
|
35 | 35 | { |
36 | 36 | print $db->num_rows($res)." lignes à convertir<br>"; |
37 | 37 | $i = 0; |
@@ -40,12 +40,12 @@ discard block |
||
40 | 40 | $cdeline = new OrderLine($db); |
41 | 41 | $cdeline->fetch($obj->rowid); |
42 | 42 | $cdeline->fetch_optionals($obj->rowid); |
43 | - if (empty($cdeline->label)){ |
|
43 | + if (empty($cdeline->label)) { |
|
44 | 44 | $cdeline->label = strip_tags($cdeline->desc); |
45 | 45 | $cdeline->desc = ''; |
46 | 46 | } |
47 | 47 | $ret = $cdeline->update($user, 1); |
48 | - if($ret>0) $i++; |
|
48 | + if ($ret > 0) $i++; |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | print $i." lignes converties<br>"; |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facturedet WHERE special_code = 104777 AND qty != 50 AND product_type = 9 AND (label = '' OR label IS NULL)"; |
56 | 56 | |
57 | 57 | $res = $db->query($sql); |
58 | - if($res) |
|
58 | + if ($res) |
|
59 | 59 | { |
60 | 60 | print $db->num_rows($res)." lignes à convertir<br>"; |
61 | 61 | $i = 0; |
@@ -64,12 +64,12 @@ discard block |
||
64 | 64 | $facline = new FactureLigne($db); |
65 | 65 | $facline->fetch($obj->rowid); |
66 | 66 | $facline->fetch_optionals($obj->rowid); |
67 | - if (empty($facline->label)){ |
|
67 | + if (empty($facline->label)) { |
|
68 | 68 | $facline->label = strip_tags($facline->desc); |
69 | 69 | $facline->desc = ''; |
70 | 70 | } |
71 | 71 | $ret = $facline->update($user, 1); |
72 | - if($ret>0) $i++; |
|
72 | + if ($ret > 0) $i++; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | print $i." lignes converties<br>"; |
@@ -23,7 +23,9 @@ discard block |
||
23 | 23 | $prop->desc = ''; |
24 | 24 | } |
25 | 25 | $ret = $prop->update(1); |
26 | - if($ret>0) $i++; |
|
26 | + if($ret>0) { |
|
27 | + $i++; |
|
28 | + } |
|
27 | 29 | } |
28 | 30 | print $i." lignes converties<br>"; |
29 | 31 | } |
@@ -45,7 +47,9 @@ discard block |
||
45 | 47 | $cdeline->desc = ''; |
46 | 48 | } |
47 | 49 | $ret = $cdeline->update($user, 1); |
48 | - if($ret>0) $i++; |
|
50 | + if($ret>0) { |
|
51 | + $i++; |
|
52 | + } |
|
49 | 53 | } |
50 | 54 | |
51 | 55 | print $i." lignes converties<br>"; |
@@ -69,7 +73,9 @@ discard block |
||
69 | 73 | $facline->desc = ''; |
70 | 74 | } |
71 | 75 | $ret = $facline->update($user, 1); |
72 | - if($ret>0) $i++; |
|
76 | + if($ret>0) { |
|
77 | + $i++; |
|
78 | + } |
|
73 | 79 | } |
74 | 80 | |
75 | 81 | print $i." lignes converties<br>"; |
@@ -39,10 +39,10 @@ discard block |
||
39 | 39 | * @var $object Facture fournisseur |
40 | 40 | */ |
41 | 41 | else if($object->element=='invoice_supplier') { |
42 | - $object->special_code = TSubtotal::$module_number; |
|
43 | - $rang = $object->line_max() + 1; |
|
44 | - if($qty==50) $res = $object->addline($desc,0,0,0,0,$qty,0,0,'','',0,0,'HT',9,$rang); |
|
45 | - else $res = $object->addline($label,0,0,0,0,$qty,0,0,'','',0,0,'HT',9,$rang); |
|
42 | + $object->special_code = TSubtotal::$module_number; |
|
43 | + $rang = $object->line_max() + 1; |
|
44 | + if($qty==50) $res = $object->addline($desc,0,0,0,0,$qty,0,0,'','',0,0,'HT',9,$rang); |
|
45 | + else $res = $object->addline($label,0,0,0,0,$qty,0,0,'','',0,0,'HT',9,$rang); |
|
46 | 46 | } |
47 | 47 | /** |
48 | 48 | * @var $object Propal |
@@ -61,8 +61,8 @@ discard block |
||
61 | 61 | * @var $object Commande fournisseur |
62 | 62 | */ |
63 | 63 | else if($object->element=='order_supplier') { |
64 | - $object->special_code = TSubtotal::$module_number; |
|
65 | - $res = $object->addline($label, 0,$qty,0,0,0,0,0,'',0,'HT', 0, 9); |
|
64 | + $object->special_code = TSubtotal::$module_number; |
|
65 | + $res = $object->addline($label, 0,$qty,0,0,0,0,0,'',0,'HT', 0, 9); |
|
66 | 66 | } |
67 | 67 | /** |
68 | 68 | * @var $object Facturerec |
@@ -404,16 +404,16 @@ discard block |
||
404 | 404 | $createRight = $user->rights->{$object->element}->creer; |
405 | 405 | if($object->element == 'facturerec' ) |
406 | 406 | { |
407 | - $object->statut = 0; // hack for facture rec |
|
408 | - $createRight = $user->rights->facture->creer; |
|
407 | + $object->statut = 0; // hack for facture rec |
|
408 | + $createRight = $user->rights->facture->creer; |
|
409 | 409 | } |
410 | 410 | elseif($object->element == 'order_supplier' ) |
411 | 411 | { |
412 | - $createRight = $user->rights->fournisseur->commande->creer; |
|
412 | + $createRight = $user->rights->fournisseur->commande->creer; |
|
413 | 413 | } |
414 | 414 | elseif($object->element == 'invoice_supplier' ) |
415 | 415 | { |
416 | - $createRight = $user->rights->fournisseur->facture->creer; |
|
416 | + $createRight = $user->rights->fournisseur->facture->creer; |
|
417 | 417 | } |
418 | 418 | |
419 | 419 | if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK)) |
@@ -438,8 +438,8 @@ discard block |
||
438 | 438 | break; |
439 | 439 | |
440 | 440 | case 'supplier_proposal': |
441 | - $res = $object->addline($line->desc, $line->subprice, $line->qty, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->fk_product, $line->remise_percent, 'HT', 0, $line->info_bits, $line->product_type, -1, $line->special_code, 0, 0, $line->pa_ht, $line->label, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->origin, $line->origin_id); |
|
442 | - break; |
|
441 | + $res = $object->addline($line->desc, $line->subprice, $line->qty, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->fk_product, $line->remise_percent, 'HT', 0, $line->info_bits, $line->product_type, -1, $line->special_code, 0, 0, $line->pa_ht, $line->label, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->origin, $line->origin_id); |
|
442 | + break; |
|
443 | 443 | |
444 | 444 | case 'commande': |
445 | 445 | //$desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $info_bits=0, $fk_remise_except=0, $price_base_type='HT', $pu_ttc=0, $date_start='', $date_end='', $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht=0, $label='',$array_options=0, $fk_unit=null, $origin='', $origin_id=0) |
@@ -447,10 +447,10 @@ discard block |
||
447 | 447 | break; |
448 | 448 | |
449 | 449 | case 'order_supplier': |
450 | - $object->line = $line; |
|
451 | - $object->line->fk_commande = $object->id; |
|
452 | - $object->line->rang = $object->line_max() +1; |
|
453 | - $res = $object->line->insert(1); |
|
450 | + $object->line = $line; |
|
451 | + $object->line->fk_commande = $object->id; |
|
452 | + $object->line->rang = $object->line_max() +1; |
|
453 | + $res = $object->line->insert(1); |
|
454 | 454 | break; |
455 | 455 | |
456 | 456 | case 'facture': |
@@ -503,8 +503,8 @@ discard block |
||
503 | 503 | $object->db->commit(); |
504 | 504 | foreach ($TLineAdded as &$line) |
505 | 505 | { |
506 | - // ça peut paraitre non optimisé de déclancher la fonction sur toutes les lignes mais ceci est nécessaire pour réappliquer l'état exact de chaque ligne |
|
507 | - _updateLineNC($object->element, $object->id, $line->id, $line->array_options['options_subtotal_nc']); |
|
506 | + // ça peut paraitre non optimisé de déclancher la fonction sur toutes les lignes mais ceci est nécessaire pour réappliquer l'état exact de chaque ligne |
|
507 | + _updateLineNC($object->element, $object->id, $line->id, $line->array_options['options_subtotal_nc']); |
|
508 | 508 | } |
509 | 509 | return count($TLineAdded); |
510 | 510 | } |
@@ -578,33 +578,33 @@ discard block |
||
578 | 578 | |
579 | 579 | switch ($object->element) |
580 | 580 | { |
581 | - case 'propal': |
|
582 | - $res = $object->updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $desc, $price_base_type, $info_bits, $special_code, $fk_parent_line, $skip_update_total, $fk_fournprice, $pa_ht, $label, $type, $date_start, $date_end, $array_options, $fk_unit); |
|
583 | - break; |
|
581 | + case 'propal': |
|
582 | + $res = $object->updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $desc, $price_base_type, $info_bits, $special_code, $fk_parent_line, $skip_update_total, $fk_fournprice, $pa_ht, $label, $type, $date_start, $date_end, $array_options, $fk_unit); |
|
583 | + break; |
|
584 | 584 | |
585 | - case 'supplier_proposal': |
|
586 | - $res = $object->updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $desc, $price_base_type, $info_bits, $special_code, $fk_parent_line, $skip_update_total, $fk_fournprice, $pa_ht, $label, $type, $array_options,'', $fk_unit); |
|
587 | - break; |
|
585 | + case 'supplier_proposal': |
|
586 | + $res = $object->updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $desc, $price_base_type, $info_bits, $special_code, $fk_parent_line, $skip_update_total, $fk_fournprice, $pa_ht, $label, $type, $array_options,'', $fk_unit); |
|
587 | + break; |
|
588 | 588 | |
589 | 589 | case 'commande': |
590 | 590 | $res = $object->updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $price_base_type, $info_bits, $date_start, $date_end, $type, $fk_parent_line, $skip_update_total, $fk_fournprice, $pa_ht, $label, $special_code, $array_options, $fk_unit); |
591 | 591 | break; |
592 | 592 | |
593 | 593 | case 'order_supplier': |
594 | - $object->special_code = SELF::$module_number; |
|
595 | - if (empty($desc)) $desc = $label; |
|
596 | - $res = $object->updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $price_base_type, $info_bits, $type, 0, $date_start, $date_end, $array_options, $fk_unit); |
|
597 | - break; |
|
594 | + $object->special_code = SELF::$module_number; |
|
595 | + if (empty($desc)) $desc = $label; |
|
596 | + $res = $object->updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $price_base_type, $info_bits, $type, 0, $date_start, $date_end, $array_options, $fk_unit); |
|
597 | + break; |
|
598 | 598 | |
599 | 599 | case 'facture': |
600 | 600 | $res = $object->updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1, $txlocaltax2, $price_base_type, $info_bits, $type, $fk_parent_line, $skip_update_total, $fk_fournprice, $pa_ht, $label, $special_code, $array_options, $situation_percent, $fk_unit); |
601 | 601 | break; |
602 | 602 | |
603 | 603 | case 'invoice_supplier': |
604 | - $object->special_code = SELF::$module_number; |
|
605 | - if (empty($desc)) $desc = $label; |
|
606 | - $res = $object->updateline($rowid, $desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, 0, $price_base_type, $info_bits, $type, $remise_percent, 0, $date_start, $date_end, $array_options, $fk_unit); |
|
607 | - break; |
|
604 | + $object->special_code = SELF::$module_number; |
|
605 | + if (empty($desc)) $desc = $label; |
|
606 | + $res = $object->updateline($rowid, $desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, 0, $price_base_type, $info_bits, $type, $remise_percent, 0, $date_start, $date_end, $array_options, $fk_unit); |
|
607 | + break; |
|
608 | 608 | |
609 | 609 | case 'facturerec': |
610 | 610 | // Add extrafields and get rang |
@@ -995,8 +995,8 @@ discard block |
||
995 | 995 | { |
996 | 996 | if (is_readable($logo)) |
997 | 997 | { |
998 | - $height=pdf_getHeightForLogo($logo); |
|
999 | - $pdf->Image($logo, $objmarge->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
998 | + $height=pdf_getHeightForLogo($logo); |
|
999 | + $pdf->Image($logo, $objmarge->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
1000 | 1000 | } |
1001 | 1001 | else |
1002 | 1002 | { |
@@ -1187,13 +1187,13 @@ discard block |
||
1187 | 1187 | * @param int $hidebottom Hide bottom |
1188 | 1188 | * @return void |
1189 | 1189 | */ |
1190 | - private static function printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0) |
|
1191 | - { |
|
1192 | - if (empty($hidetop) || $hidetop==-1) $pdf->line($x, $y, $x+$l, $y); |
|
1193 | - $pdf->line($x+$l, $y, $x+$l, $y+$h); |
|
1194 | - if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h); |
|
1195 | - $pdf->line($x, $y+$h, $x, $y); |
|
1196 | - } |
|
1190 | + private static function printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0) |
|
1191 | + { |
|
1192 | + if (empty($hidetop) || $hidetop==-1) $pdf->line($x, $y, $x+$l, $y); |
|
1193 | + $pdf->line($x+$l, $y, $x+$l, $y+$h); |
|
1194 | + if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h); |
|
1195 | + $pdf->line($x, $y+$h, $x, $y); |
|
1196 | + } |
|
1197 | 1197 | |
1198 | 1198 | |
1199 | 1199 | public static function concat(&$outputlangs, $files, $fileoutput='') |
@@ -1203,14 +1203,14 @@ discard block |
||
1203 | 1203 | if (empty($fileoutput)) $fileoutput = $file[0]; |
1204 | 1204 | |
1205 | 1205 | $pdf=pdf_getInstance(); |
1206 | - if (class_exists('TCPDF')) |
|
1207 | - { |
|
1208 | - $pdf->setPrintHeader(false); |
|
1209 | - $pdf->setPrintFooter(false); |
|
1210 | - } |
|
1211 | - $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
|
1206 | + if (class_exists('TCPDF')) |
|
1207 | + { |
|
1208 | + $pdf->setPrintHeader(false); |
|
1209 | + $pdf->setPrintFooter(false); |
|
1210 | + } |
|
1211 | + $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
|
1212 | 1212 | |
1213 | - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
1213 | + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
1214 | 1214 | |
1215 | 1215 | |
1216 | 1216 | foreach($files as $file) |
@@ -5,28 +5,28 @@ discard block |
||
5 | 5 | |
6 | 6 | static $module_number = 104777; |
7 | 7 | |
8 | - static function addSubTotalLine(&$object, $label, $qty, $rang=-1) { |
|
8 | + static function addSubTotalLine(&$object, $label, $qty, $rang = -1) { |
|
9 | 9 | |
10 | 10 | $res = 0; |
11 | 11 | |
12 | - if( (float)DOL_VERSION <= 3.4 ) { |
|
12 | + if ((float) DOL_VERSION <= 3.4) { |
|
13 | 13 | /** |
14 | 14 | * @var $object Facture |
15 | 15 | */ |
16 | - if($object->element=='facture') $res = $object->addline($object->id, $label, 0,$qty,0,0,0,0,0,'','',0,0,'','HT',0,9,-1, TSubtotal::$module_number); |
|
16 | + if ($object->element == 'facture') $res = $object->addline($object->id, $label, 0, $qty, 0, 0, 0, 0, 0, '', '', 0, 0, '', 'HT', 0, 9, -1, TSubtotal::$module_number); |
|
17 | 17 | /** |
18 | 18 | * @var $object Propal |
19 | 19 | */ |
20 | - else if($object->element=='propal') $res = $object->addline($object->id,$label, 0,$qty,0,0,0,0,0,'HT',0,0,9,-1, TSubtotal::$module_number); |
|
20 | + else if ($object->element == 'propal') $res = $object->addline($object->id, $label, 0, $qty, 0, 0, 0, 0, 0, 'HT', 0, 0, 9, -1, TSubtotal::$module_number); |
|
21 | 21 | /** |
22 | 22 | * @var $object Commande |
23 | 23 | */ |
24 | - else if($object->element=='commande') $res = $object->addline($object->id,$label, 0,$qty,0,0,0,0,0,0,0,'HT',0,'','',9,-1, TSubtotal::$module_number); |
|
24 | + else if ($object->element == 'commande') $res = $object->addline($object->id, $label, 0, $qty, 0, 0, 0, 0, 0, 0, 0, 'HT', 0, '', '', 9, -1, TSubtotal::$module_number); |
|
25 | 25 | |
26 | 26 | } |
27 | 27 | else { |
28 | 28 | $desc = ''; |
29 | - if ((float) DOL_VERSION < 6 || $qty==50) { |
|
29 | + if ((float) DOL_VERSION < 6 || $qty == 50) { |
|
30 | 30 | $desc = $label; |
31 | 31 | $label = ''; |
32 | 32 | } |
@@ -34,40 +34,40 @@ discard block |
||
34 | 34 | /** |
35 | 35 | * @var $object Facture |
36 | 36 | */ |
37 | - if($object->element=='facture') $res = $object->addline($desc, 0,$qty,0,0,0,0,0,'','',0,0,'','HT',0,9,$rang, TSubtotal::$module_number, '', 0, 0, null, 0, $label); |
|
37 | + if ($object->element == 'facture') $res = $object->addline($desc, 0, $qty, 0, 0, 0, 0, 0, '', '', 0, 0, '', 'HT', 0, 9, $rang, TSubtotal::$module_number, '', 0, 0, null, 0, $label); |
|
38 | 38 | /** |
39 | 39 | * @var $object Facture fournisseur |
40 | 40 | */ |
41 | - else if($object->element=='invoice_supplier') { |
|
41 | + else if ($object->element == 'invoice_supplier') { |
|
42 | 42 | $object->special_code = TSubtotal::$module_number; |
43 | 43 | $rang = $object->line_max() + 1; |
44 | - if($qty==50) $res = $object->addline($desc,0,0,0,0,$qty,0,0,'','',0,0,'HT',9,$rang); |
|
45 | - else $res = $object->addline($label,0,0,0,0,$qty,0,0,'','',0,0,'HT',9,$rang); |
|
44 | + if ($qty == 50) $res = $object->addline($desc, 0, 0, 0, 0, $qty, 0, 0, '', '', 0, 0, 'HT', 9, $rang); |
|
45 | + else $res = $object->addline($label, 0, 0, 0, 0, $qty, 0, 0, '', '', 0, 0, 'HT', 9, $rang); |
|
46 | 46 | } |
47 | 47 | /** |
48 | 48 | * @var $object Propal |
49 | 49 | */ |
50 | - else if($object->element=='propal') $res = $object->addline($desc, 0,$qty,0,0,0,0,0,'HT',0,0,9,$rang, TSubtotal::$module_number, 0, 0, 0, $label); |
|
50 | + else if ($object->element == 'propal') $res = $object->addline($desc, 0, $qty, 0, 0, 0, 0, 0, 'HT', 0, 0, 9, $rang, TSubtotal::$module_number, 0, 0, 0, $label); |
|
51 | 51 | /** |
52 | 52 | * @var $object Propal Fournisseur |
53 | 53 | */ |
54 | - else if($object->element=='supplier_proposal') $res = $object->addline($desc, 0,$qty,0,0,0,0,0,'HT',0,0,9,$rang, TSubtotal::$module_number, 0, 0, 0, $label); |
|
54 | + else if ($object->element == 'supplier_proposal') $res = $object->addline($desc, 0, $qty, 0, 0, 0, 0, 0, 'HT', 0, 0, 9, $rang, TSubtotal::$module_number, 0, 0, 0, $label); |
|
55 | 55 | |
56 | 56 | /** |
57 | 57 | * @var $object Commande |
58 | 58 | */ |
59 | - else if($object->element=='commande') $res = $object->addline($desc, 0,$qty,0,0,0,0,0,0,0,'HT',0,'','',9,$rang, TSubtotal::$module_number, 0, null, 0, $label); |
|
59 | + else if ($object->element == 'commande') $res = $object->addline($desc, 0, $qty, 0, 0, 0, 0, 0, 0, 0, 'HT', 0, '', '', 9, $rang, TSubtotal::$module_number, 0, null, 0, $label); |
|
60 | 60 | /** |
61 | 61 | * @var $object Commande fournisseur |
62 | 62 | */ |
63 | - else if($object->element=='order_supplier') { |
|
63 | + else if ($object->element == 'order_supplier') { |
|
64 | 64 | $object->special_code = TSubtotal::$module_number; |
65 | - $res = $object->addline($label, 0,$qty,0,0,0,0,0,'',0,'HT', 0, 9); |
|
65 | + $res = $object->addline($label, 0, $qty, 0, 0, 0, 0, 0, '', 0, 'HT', 0, 9); |
|
66 | 66 | } |
67 | 67 | /** |
68 | 68 | * @var $object Facturerec |
69 | 69 | */ |
70 | - else if($object->element=='facturerec') $res = $object->addline($desc, 0,$qty, 0, 0, 0, 0, 0, 'HT', 0, '', 0, 9, $rang, TSubtotal::$module_number,$label); |
|
70 | + else if ($object->element == 'facturerec') $res = $object->addline($desc, 0, $qty, 0, 0, 0, 0, 0, 'HT', 0, '', 0, 9, $rang, TSubtotal::$module_number, $label); |
|
71 | 71 | |
72 | 72 | } |
73 | 73 | |
@@ -78,20 +78,20 @@ discard block |
||
78 | 78 | |
79 | 79 | public static function generateDoc(&$object) |
80 | 80 | { |
81 | - global $conf,$langs,$db; |
|
81 | + global $conf, $langs, $db; |
|
82 | 82 | |
83 | 83 | if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) |
84 | 84 | { |
85 | - $hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); |
|
86 | - $hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0)); |
|
87 | - $hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0)); |
|
85 | + $hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); |
|
86 | + $hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0)); |
|
87 | + $hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0)); |
|
88 | 88 | |
89 | 89 | // Define output language |
90 | 90 | $outputlangs = $langs; |
91 | 91 | $newlang = GETPOST('lang_id', 'alpha'); |
92 | - if (! empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) |
|
92 | + if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) |
|
93 | 93 | $newlang = !empty($object->client) ? $object->client->default_lang : $object->thirdparty->default_lang; |
94 | - if (! empty($newlang)) { |
|
94 | + if (!empty($newlang)) { |
|
95 | 95 | $outputlangs = new Translate("", $conf); |
96 | 96 | $outputlangs->setDefaultLang($newlang); |
97 | 97 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | } |
106 | 106 | else |
107 | 107 | { |
108 | - if ($object->element!= 'facturerec') $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
108 | + if ($object->element != 'facturerec') $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | } |
@@ -117,11 +117,11 @@ discard block |
||
117 | 117 | * @param type $rang_start |
118 | 118 | * @param type $move_to |
119 | 119 | */ |
120 | - public static function updateRang(&$object, $rang_start, $move_to=1) |
|
120 | + public static function updateRang(&$object, $rang_start, $move_to = 1) |
|
121 | 121 | { |
122 | 122 | if (!class_exists('GenericObject')) require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php'; |
123 | 123 | |
124 | - $row=new GenericObject($object->db); |
|
124 | + $row = new GenericObject($object->db); |
|
125 | 125 | $row->table_element_line = $object->table_element_line; |
126 | 126 | $row->fk_element = $object->fk_element; |
127 | 127 | $row->id = $object->id; |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | { |
131 | 131 | if ($line->rang < $rang_start) continue; |
132 | 132 | |
133 | - $row->updateRangOfLine($line->id, $line->rang+$move_to); |
|
133 | + $row->updateRangOfLine($line->id, $line->rang + $move_to); |
|
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | { |
160 | 160 | if ($rang_to_add != -1) self::updateRang($object, $rang_to_add); |
161 | 161 | |
162 | - self::addSubTotalLine($object, $langs->trans('SubTotal'), 100-$title_niveau, $rang_to_add); |
|
162 | + self::addSubTotalLine($object, $langs->trans('SubTotal'), 100 - $title_niveau, $rang_to_add); |
|
163 | 163 | |
164 | 164 | $object->lines[] = $object->line; // ajout de la ligne dans le tableau de ligne (Dolibarr ne le fait pas) |
165 | 165 | if ($rang_to_add != -1) |
@@ -171,14 +171,14 @@ discard block |
||
171 | 171 | } |
172 | 172 | } |
173 | 173 | |
174 | - public static function addTitle(&$object, $label, $level, $rang=-1) |
|
174 | + public static function addTitle(&$object, $label, $level, $rang = -1) |
|
175 | 175 | { |
176 | 176 | self::addSubTotalLine($object, $label, $level, $rang); |
177 | 177 | } |
178 | 178 | |
179 | - public static function addTotal(&$object, $label, $level, $rang=-1) |
|
179 | + public static function addTotal(&$object, $label, $level, $rang = -1) |
|
180 | 180 | { |
181 | - self::addSubTotalLine($object, $label, (100-$level), $rang); |
|
181 | + self::addSubTotalLine($object, $label, (100 - $level), $rang); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | /** |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | * |
190 | 190 | * @return array |
191 | 191 | */ |
192 | - public static function getAllTitleWithoutTotalFromDocument(&$object, $get_block_total=false) |
|
192 | + public static function getAllTitleWithoutTotalFromDocument(&$object, $get_block_total = false) |
|
193 | 193 | { |
194 | 194 | $TTitle = self::getAllTitleFromDocument($object, $get_block_total); |
195 | 195 | |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | * @param boolean $return_rang_on_false si true alors renvoi le rang où devrait ce trouver le sous-total |
211 | 211 | * @return boolean |
212 | 212 | */ |
213 | - public static function titleHasTotalLine(&$object, &$title_line, $strict_mode=false, $return_rang_on_false=false) |
|
213 | + public static function titleHasTotalLine(&$object, &$title_line, $strict_mode = false, $return_rang_on_false = false) |
|
214 | 214 | { |
215 | 215 | if (empty($object->lines) || !is_array($object->lines)) return false; |
216 | 216 | |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | return ($return_rang_on_false) ? -1 : false; |
237 | 237 | } |
238 | 238 | |
239 | - public static function getAllTitleFromDocument(&$object, $get_block_total=false) |
|
239 | + public static function getAllTitleFromDocument(&$object, $get_block_total = false) |
|
240 | 240 | { |
241 | 241 | $TRes = array(); |
242 | 242 | if (!empty($object->lines)) |
@@ -356,10 +356,10 @@ discard block |
||
356 | 356 | return false; |
357 | 357 | } |
358 | 358 | |
359 | - public static function isTitle(&$line, $level=-1) |
|
359 | + public static function isTitle(&$line, $level = -1) |
|
360 | 360 | { |
361 | 361 | $res = $line->special_code == self::$module_number && $line->product_type == 9 && $line->qty <= 9; |
362 | - if($res && $level > -1) { |
|
362 | + if ($res && $level > -1) { |
|
363 | 363 | return $line->qty == $level; |
364 | 364 | } else return $res; |
365 | 365 | |
@@ -380,43 +380,43 @@ discard block |
||
380 | 380 | return self::isTitle($line) || self::isSubtotal($line) || self::isFreeText($line); |
381 | 381 | } |
382 | 382 | |
383 | - public static function getFreeTextHtml(&$line, $readonly=0) |
|
383 | + public static function getFreeTextHtml(&$line, $readonly = 0) |
|
384 | 384 | { |
385 | 385 | global $conf; |
386 | 386 | |
387 | 387 | // Copie du fichier "objectline_edit.tpl.php" |
388 | 388 | // editeur wysiwyg |
389 | 389 | require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
390 | - $nbrows=ROWS_2; |
|
391 | - if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; |
|
392 | - $enable=(isset($conf->global->FCKEDITOR_ENABLE_DETAILS)?$conf->global->FCKEDITOR_ENABLE_DETAILS:0); |
|
393 | - $toolbarname='dolibarr_details'; |
|
394 | - if (! empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) $toolbarname='dolibarr_notes'; |
|
395 | - $text = !empty($line->description)?$line->description:$line->label; |
|
396 | - $doleditor=new DolEditor('line-description',$text,'',164,$toolbarname,'',false,true,$enable,$nbrows,'98%', $readonly); |
|
390 | + $nbrows = ROWS_2; |
|
391 | + if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT; |
|
392 | + $enable = (isset($conf->global->FCKEDITOR_ENABLE_DETAILS) ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0); |
|
393 | + $toolbarname = 'dolibarr_details'; |
|
394 | + if (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) $toolbarname = 'dolibarr_notes'; |
|
395 | + $text = !empty($line->description) ? $line->description : $line->label; |
|
396 | + $doleditor = new DolEditor('line-description', $text, '', 164, $toolbarname, '', false, true, $enable, $nbrows, '98%', $readonly); |
|
397 | 397 | return $doleditor->Create(1); |
398 | 398 | } |
399 | 399 | |
400 | - public static function duplicateLines(&$object, $lineid, $withBlockLine=false) |
|
400 | + public static function duplicateLines(&$object, $lineid, $withBlockLine = false) |
|
401 | 401 | { |
402 | - global $db,$user,$conf; |
|
402 | + global $db, $user, $conf; |
|
403 | 403 | |
404 | 404 | $createRight = $user->rights->{$object->element}->creer; |
405 | - if($object->element == 'facturerec' ) |
|
405 | + if ($object->element == 'facturerec') |
|
406 | 406 | { |
407 | 407 | $object->statut = 0; // hack for facture rec |
408 | 408 | $createRight = $user->rights->facture->creer; |
409 | 409 | } |
410 | - elseif($object->element == 'order_supplier' ) |
|
410 | + elseif ($object->element == 'order_supplier') |
|
411 | 411 | { |
412 | 412 | $createRight = $user->rights->fournisseur->commande->creer; |
413 | 413 | } |
414 | - elseif($object->element == 'invoice_supplier' ) |
|
414 | + elseif ($object->element == 'invoice_supplier') |
|
415 | 415 | { |
416 | 416 | $createRight = $user->rights->fournisseur->facture->creer; |
417 | 417 | } |
418 | 418 | |
419 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK)) |
|
419 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK)) |
|
420 | 420 | { |
421 | 421 | dol_include_once('/subtotal/lib/subtotal.lib.php'); |
422 | 422 | |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | case 'order_supplier': |
450 | 450 | $object->line = $line; |
451 | 451 | $object->line->fk_commande = $object->id; |
452 | - $object->line->rang = $object->line_max() +1; |
|
452 | + $object->line->rang = $object->line_max() + 1; |
|
453 | 453 | $res = $object->line->insert(1); |
454 | 454 | break; |
455 | 455 | |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | { |
490 | 490 | $object->line_from = $line; |
491 | 491 | // Call trigger |
492 | - $result=$object->call_trigger('LINE_DUPLICATE',$user); // $object->line |
|
492 | + $result = $object->call_trigger('LINE_DUPLICATE', $user); // $object->line |
|
493 | 493 | if ($result < 0) |
494 | 494 | { |
495 | 495 | $object->db->rollback(); |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | } |
520 | 520 | } |
521 | 521 | |
522 | - public static function getLinesFromTitle(&$object, $key_trad, $level=1, $under_title='', $withBlockLine=false, $key_is_id=false) |
|
522 | + public static function getLinesFromTitle(&$object, $key_trad, $level = 1, $under_title = '', $withBlockLine = false, $key_is_id = false) |
|
523 | 523 | { |
524 | 524 | global $langs; |
525 | 525 | |
@@ -531,17 +531,17 @@ discard block |
||
531 | 531 | |
532 | 532 | $TLine = array(); |
533 | 533 | $add_line = false; |
534 | - $under_title_found=false; |
|
534 | + $under_title_found = false; |
|
535 | 535 | |
536 | 536 | foreach ($object->lines as $key => &$line) |
537 | 537 | { |
538 | 538 | if (!$under_title_found && !empty($TTitle_under_search)) |
539 | 539 | { |
540 | - if ($line->product_type == 9 && (in_array($line->desc, $TTitle_under_search) || in_array($line->label, $TTitle_under_search)) ) $under_title_found = true; |
|
540 | + if ($line->product_type == 9 && (in_array($line->desc, $TTitle_under_search) || in_array($line->label, $TTitle_under_search))) $under_title_found = true; |
|
541 | 541 | } |
542 | 542 | else |
543 | 543 | { |
544 | - if ( ($key_is_id && $line->id == $key_trad) || (!$key_is_id && $line->product_type == 9 && $line->qty == $level && (in_array($line->desc, $TTitle_search) || in_array($line->label, $TTitle_search) ))) |
|
544 | + if (($key_is_id && $line->id == $key_trad) || (!$key_is_id && $line->product_type == 9 && $line->qty == $level && (in_array($line->desc, $TTitle_search) || in_array($line->label, $TTitle_search)))) |
|
545 | 545 | { |
546 | 546 | if ($key_is_id) $level = $line->qty; |
547 | 547 | |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | if ($withBlockLine) $TLine[] = $line; |
550 | 550 | continue; |
551 | 551 | } |
552 | - elseif ($add_line && $line->product_type == 9 && (100 - $line->qty == $level) ) // Si on tombe sur un sous-total, il faut que ce soit un du même niveau que le titre |
|
552 | + elseif ($add_line && $line->product_type == 9 && (100 - $line->qty == $level)) // Si on tombe sur un sous-total, il faut que ce soit un du même niveau que le titre |
|
553 | 553 | { |
554 | 554 | if ($withBlockLine) $TLine[] = $line; |
555 | 555 | break; |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | |
558 | 558 | if ($add_line) |
559 | 559 | { |
560 | - if (!$withBlockLine && (self::isTitle($line) || self::isSubtotal($line)) ) continue; |
|
560 | + if (!$withBlockLine && (self::isTitle($line) || self::isSubtotal($line))) continue; |
|
561 | 561 | else $TLine[] = $line; |
562 | 562 | } |
563 | 563 | } |
@@ -566,12 +566,12 @@ discard block |
||
566 | 566 | return $TLine; |
567 | 567 | } |
568 | 568 | |
569 | - public static function getLinesFromTitleId(&$object, $lineid, $withBlockLine=false) |
|
569 | + public static function getLinesFromTitleId(&$object, $lineid, $withBlockLine = false) |
|
570 | 570 | { |
571 | 571 | return self::getLinesFromTitle($object, $lineid, '', '', $withBlockLine, true); |
572 | 572 | } |
573 | 573 | |
574 | - public static function doUpdateLine(&$object, $rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $type, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_options=0, $situation_percent=0, $fk_unit = null) |
|
574 | + public static function doUpdateLine(&$object, $rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $type, $txlocaltax1 = 0, $txlocaltax2 = 0, $price_base_type = 'HT', $info_bits = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $special_code = 0, $array_options = 0, $situation_percent = 0, $fk_unit = null) |
|
575 | 575 | { |
576 | 576 | $res = 0; |
577 | 577 | $object->db->begin(); |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | break; |
584 | 584 | |
585 | 585 | case 'supplier_proposal': |
586 | - $res = $object->updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $desc, $price_base_type, $info_bits, $special_code, $fk_parent_line, $skip_update_total, $fk_fournprice, $pa_ht, $label, $type, $array_options,'', $fk_unit); |
|
586 | + $res = $object->updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $desc, $price_base_type, $info_bits, $special_code, $fk_parent_line, $skip_update_total, $fk_fournprice, $pa_ht, $label, $type, $array_options, '', $fk_unit); |
|
587 | 587 | break; |
588 | 588 | |
589 | 589 | case 'commande': |
@@ -612,9 +612,9 @@ discard block |
||
612 | 612 | $factureRecLine->fetch($rowid); |
613 | 613 | $factureRecLine->array_options = $array_options; |
614 | 614 | $factureRecLine->insertExtraFields(); |
615 | - $rang=$factureRecLine->rang; |
|
615 | + $rang = $factureRecLine->rang; |
|
616 | 616 | |
617 | - $fk_product=0; $fk_remise_except=''; $pu_ttc=0; |
|
617 | + $fk_product = 0; $fk_remise_except = ''; $pu_ttc = 0; |
|
618 | 618 | $res = $object->updateline($rowid, $desc, $pu, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $price_base_type, $info_bits, $fk_remise_except, $pu_ttc, $type, $rang, $special_code, $label, $fk_unit); |
619 | 619 | break; |
620 | 620 | } |
@@ -630,7 +630,7 @@ discard block |
||
630 | 630 | global $db, $object; |
631 | 631 | |
632 | 632 | $TTitle = array(); |
633 | - if(! empty($object->id) && in_array($object->element, array('propal', 'commande', 'facture'))) {} |
|
633 | + if (!empty($object->id) && in_array($object->element, array('propal', 'commande', 'facture'))) {} |
|
634 | 634 | else { |
635 | 635 | if ($origin_line->element == 'propaldet') |
636 | 636 | { |
@@ -710,7 +710,7 @@ discard block |
||
710 | 710 | */ |
711 | 711 | public static function addRecapPage(&$parameters, &$origin_pdf) |
712 | 712 | { |
713 | - global $user,$conf,$langs; |
|
713 | + global $user, $conf, $langs; |
|
714 | 714 | |
715 | 715 | $origin_file = $parameters['file']; |
716 | 716 | $outputlangs = $parameters['outputlangs']; |
@@ -726,21 +726,21 @@ discard block |
||
726 | 726 | $objmarge->marge_droite = 10; |
727 | 727 | |
728 | 728 | $objectref = dol_sanitizeFileName($object->ref); |
729 | - if ($object->element == 'propal') $dir = $conf->propal->dir_output . '/' . $objectref; |
|
730 | - elseif ($object->element == 'commande') $dir = $conf->commande->dir_output . '/' . $objectref; |
|
731 | - elseif ($object->element == 'facture') $dir = $conf->facture->dir_output . '/' . $objectref; |
|
729 | + if ($object->element == 'propal') $dir = $conf->propal->dir_output.'/'.$objectref; |
|
730 | + elseif ($object->element == 'commande') $dir = $conf->commande->dir_output.'/'.$objectref; |
|
731 | + elseif ($object->element == 'facture') $dir = $conf->facture->dir_output.'/'.$objectref; |
|
732 | 732 | elseif ($object->element == 'facturerec') return; // no PDF for facturerec |
733 | 733 | else |
734 | 734 | { |
735 | 735 | setEventMessage($langs->trans('warning_subtotal_recap_object_element_unknown', $object->element), 'warnings'); |
736 | 736 | return -1; |
737 | 737 | } |
738 | - $file = $dir . '/' . $objectref . '_recap.pdf'; |
|
738 | + $file = $dir.'/'.$objectref.'_recap.pdf'; |
|
739 | 739 | |
740 | 740 | // $pdf=pdf_getInstance($origin_pdf->format); |
741 | - $pdf=pdf_getInstance(array(210, 297)); // Format A4 Portrait |
|
742 | - $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance |
|
743 | - $pdf->SetAutoPageBreak(1,0); |
|
741 | + $pdf = pdf_getInstance(array(210, 297)); // Format A4 Portrait |
|
742 | + $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance |
|
743 | + $pdf->SetAutoPageBreak(1, 0); |
|
744 | 744 | |
745 | 745 | if (class_exists('TCPDF')) |
746 | 746 | { |
@@ -749,49 +749,49 @@ discard block |
||
749 | 749 | } |
750 | 750 | $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
751 | 751 | // Set path to the background PDF File |
752 | - if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) |
|
752 | + if (empty($conf->global->MAIN_DISABLE_FPDI) && !empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) |
|
753 | 753 | { |
754 | 754 | $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); |
755 | 755 | $tplidx = $pdf->importPage(1); |
756 | 756 | } |
757 | 757 | |
758 | 758 | $pdf->Open(); |
759 | - $pagenb=0; |
|
760 | - $pdf->SetDrawColor(128,128,128); |
|
759 | + $pagenb = 0; |
|
760 | + $pdf->SetDrawColor(128, 128, 128); |
|
761 | 761 | |
762 | 762 | $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); |
763 | 763 | $pdf->SetSubject($outputlangs->transnoentities("subtotalRecap")); |
764 | 764 | $pdf->SetCreator("Dolibarr ".DOL_VERSION); |
765 | 765 | $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); |
766 | 766 | $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("subtotalRecap")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); |
767 | - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
767 | + if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
768 | 768 | |
769 | - $pdf->SetMargins($objmarge->marge_gauche, $objmarge->marge_haute, $objmarge->marge_droite); // Left, Top, Right |
|
769 | + $pdf->SetMargins($objmarge->marge_gauche, $objmarge->marge_haute, $objmarge->marge_droite); // Left, Top, Right |
|
770 | 770 | |
771 | - $pagenb=0; |
|
772 | - $pdf->SetDrawColor(128,128,128); |
|
771 | + $pagenb = 0; |
|
772 | + $pdf->SetDrawColor(128, 128, 128); |
|
773 | 773 | |
774 | 774 | |
775 | 775 | // New page |
776 | 776 | $pdf->AddPage(); |
777 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
777 | + if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
778 | 778 | $pagenb++; |
779 | 779 | |
780 | 780 | |
781 | 781 | self::pagehead($objmarge, $pdf, $object, 1, $outputlangs); |
782 | - $pdf->SetFont('','', $default_font_size - 1); |
|
783 | - $pdf->MultiCell(0, 3, ''); // Set interline to 3 |
|
784 | - $pdf->SetTextColor(0,0,0); |
|
782 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
783 | + $pdf->MultiCell(0, 3, ''); // Set interline to 3 |
|
784 | + $pdf->SetTextColor(0, 0, 0); |
|
785 | 785 | |
786 | - $heightforinfotot = 25; // Height reserved to output the info and total part |
|
787 | - $heightforfooter = $objmarge->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
|
786 | + $heightforinfotot = 25; // Height reserved to output the info and total part |
|
787 | + $heightforfooter = $objmarge->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
|
788 | 788 | |
789 | 789 | $posx_designation = 25; |
790 | 790 | $posx_options = 150; |
791 | 791 | $posx_montant = 170; |
792 | 792 | |
793 | 793 | $tab_top = 72; |
794 | - $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?72:20); // TODO à vérifier |
|
794 | + $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 72 : 20); // TODO à vérifier |
|
795 | 795 | |
796 | 796 | $TTot = array('total_ht' => 0, 'total_ttc' => 0, 'TTotal_tva' => array()); |
797 | 797 | |
@@ -805,14 +805,14 @@ discard block |
||
805 | 805 | $nexY = $tab_top + 10; |
806 | 806 | |
807 | 807 | $nblignes = count($TLine); |
808 | - foreach($TLine as $i => &$line) |
|
808 | + foreach ($TLine as $i => &$line) |
|
809 | 809 | { |
810 | 810 | $curY = $nexY; |
811 | 811 | |
812 | 812 | if (self::getNiveau($line) == 1) |
813 | 813 | { |
814 | - $pdf->SetFont('','B', $default_font_size - 1); // Into loop to work with multipage |
|
815 | - $curY+=2; |
|
814 | + $pdf->SetFont('', 'B', $default_font_size - 1); // Into loop to work with multipage |
|
815 | + $curY += 2; |
|
816 | 816 | |
817 | 817 | $TTot['total_ht'] += $line->total_ht; |
818 | 818 | $TTot['total_tva'] += $line->total_tva; |
@@ -831,67 +831,67 @@ discard block |
||
831 | 831 | $TTot['TTotal_tva_multicurrency'][$tx] += $amount; |
832 | 832 | } |
833 | 833 | } |
834 | - else $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage |
|
834 | + else $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage |
|
835 | 835 | |
836 | - $pdf->SetTextColor(0,0,0); |
|
836 | + $pdf->SetTextColor(0, 0, 0); |
|
837 | 837 | |
838 | 838 | $pdf->setTopMargin($tab_top_newpage + 10); |
839 | - $pdf->setPageOrientation('', 1, $heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. |
|
840 | - $pageposbefore=$pdf->getPage(); |
|
839 | + $pdf->setPageOrientation('', 1, $heightforfooter + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. |
|
840 | + $pageposbefore = $pdf->getPage(); |
|
841 | 841 | |
842 | - $showpricebeforepagebreak=1; |
|
842 | + $showpricebeforepagebreak = 1; |
|
843 | 843 | |
844 | 844 | $decalage = (self::getNiveau($line) - 1) * 2; |
845 | 845 | |
846 | 846 | // Print: Designation |
847 | 847 | $label = $line->label; |
848 | - if( (float)DOL_VERSION < 6 ) { |
|
848 | + if ((float) DOL_VERSION < 6) { |
|
849 | 849 | $label = !empty($line->label) ? $line->label : $line->desc; |
850 | 850 | } |
851 | 851 | |
852 | 852 | |
853 | 853 | $pdf->startTransaction(); |
854 | - $pdf->writeHTMLCell($posx_options-$posx_designation-$decalage, 3, $posx_designation+$decalage, $curY, $outputlangs->convToOutputCharset($label), 0, 1, false, true, 'J',true); |
|
855 | - $pageposafter=$pdf->getPage(); |
|
854 | + $pdf->writeHTMLCell($posx_options - $posx_designation - $decalage, 3, $posx_designation + $decalage, $curY, $outputlangs->convToOutputCharset($label), 0, 1, false, true, 'J', true); |
|
855 | + $pageposafter = $pdf->getPage(); |
|
856 | 856 | if ($pageposafter > $pageposbefore) // There is a pagebreak |
857 | 857 | { |
858 | 858 | $pdf->rollbackTransaction(true); |
859 | - $pageposafter=$pageposbefore; |
|
859 | + $pageposafter = $pageposbefore; |
|
860 | 860 | //print $pageposafter.'-'.$pageposbefore;exit; |
861 | - $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
|
862 | - $pdf->writeHTMLCell($posx_options-$posx_designation-$decalage, 3, $posx_designation+$decalage, $curY, $outputlangs->convToOutputCharset($label), 0, 1, false, true, 'J',true); |
|
861 | + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
|
862 | + $pdf->writeHTMLCell($posx_options - $posx_designation - $decalage, 3, $posx_designation + $decalage, $curY, $outputlangs->convToOutputCharset($label), 0, 1, false, true, 'J', true); |
|
863 | 863 | |
864 | - $pageposafter=$pdf->getPage(); |
|
865 | - $posyafter=$pdf->GetY(); |
|
864 | + $pageposafter = $pdf->getPage(); |
|
865 | + $posyafter = $pdf->GetY(); |
|
866 | 866 | //var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit; |
867 | - if ($posyafter > ($objmarge->page_hauteur - ($heightforfooter+$heightforinfotot))) // There is no space left for total+free text |
|
867 | + if ($posyafter > ($objmarge->page_hauteur - ($heightforfooter + $heightforinfotot))) // There is no space left for total+free text |
|
868 | 868 | { |
869 | - if ($i == ($nblignes-1)) // No more lines, and no space left to show total, so we create a new page |
|
869 | + if ($i == ($nblignes - 1)) // No more lines, and no space left to show total, so we create a new page |
|
870 | 870 | { |
871 | - $pdf->AddPage('','',true); |
|
872 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
871 | + $pdf->AddPage('', '', true); |
|
872 | + if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
873 | 873 | if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) self::pagehead($objmarge, $pdf, $object, 0, $outputlangs); |
874 | - $pdf->setPage($pageposafter+1); |
|
874 | + $pdf->setPage($pageposafter + 1); |
|
875 | 875 | } |
876 | 876 | } |
877 | 877 | else |
878 | 878 | { |
879 | 879 | // We found a page break |
880 | - $showpricebeforepagebreak=0; |
|
880 | + $showpricebeforepagebreak = 0; |
|
881 | 881 | } |
882 | 882 | } |
883 | 883 | else // No pagebreak |
884 | 884 | { |
885 | 885 | $pdf->commitTransaction(); |
886 | 886 | } |
887 | - $posYAfterDescription=$pdf->GetY(); |
|
887 | + $posYAfterDescription = $pdf->GetY(); |
|
888 | 888 | |
889 | 889 | $nexY = $pdf->GetY(); |
890 | - $pageposafter=$pdf->getPage(); |
|
890 | + $pageposafter = $pdf->getPage(); |
|
891 | 891 | |
892 | 892 | $pdf->setPage($pageposbefore); |
893 | 893 | $pdf->setTopMargin($objmarge->marge_haute); |
894 | - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
894 | + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
895 | 895 | |
896 | 896 | // We suppose that a too long description or photo were moved completely on next page |
897 | 897 | if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { |
@@ -904,14 +904,14 @@ discard block |
||
904 | 904 | if (!empty($line->total_options)) |
905 | 905 | { |
906 | 906 | $pdf->SetXY($posx_options, $curY); |
907 | - $pdf->MultiCell($posx_montant-$posx_options-0.8, 3, price($line->total_options, 0, $outputlangs), 0, 'R', 0); |
|
907 | + $pdf->MultiCell($posx_montant - $posx_options - 0.8, 3, price($line->total_options, 0, $outputlangs), 0, 'R', 0); |
|
908 | 908 | } |
909 | 909 | |
910 | 910 | // Print: Montant |
911 | 911 | $pdf->SetXY($posx_montant, $curY); |
912 | - $pdf->MultiCell($objmarge->page_largeur-$objmarge->marge_droite-$posx_montant-0.8, 3, price($line->total_ht, 0, $outputlangs), 0, 'R', 0); |
|
912 | + $pdf->MultiCell($objmarge->page_largeur - $objmarge->marge_droite - $posx_montant - 0.8, 3, price($line->total_ht, 0, $outputlangs), 0, 'R', 0); |
|
913 | 913 | |
914 | - $nexY+=2; // Passe espace entre les lignes |
|
914 | + $nexY += 2; // Passe espace entre les lignes |
|
915 | 915 | |
916 | 916 | // Detect if some page were added automatically and output _tableau for past pages |
917 | 917 | while ($pagenb < $pageposafter) |
@@ -928,7 +928,7 @@ discard block |
||
928 | 928 | |
929 | 929 | $pagenb++; |
930 | 930 | $pdf->setPage($pagenb); |
931 | - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
931 | + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
932 | 932 | if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) self::pagehead($objmarge, $pdf, $object, 0, $outputlangs); |
933 | 933 | } |
934 | 934 | } |
@@ -938,19 +938,19 @@ discard block |
||
938 | 938 | if ($pagenb == 1) |
939 | 939 | { |
940 | 940 | self::tableau($objmarge, $pdf, $posx_designation, $posx_options, $posx_montant, $tab_top, $objmarge->page_hauteur - $tab_top - $heightforinfotot - $heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code); |
941 | - $bottomlasttab=$objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1; |
|
941 | + $bottomlasttab = $objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1; |
|
942 | 942 | } |
943 | 943 | else |
944 | 944 | { |
945 | 945 | self::tableau($objmarge, $pdf, $posx_designation, $posx_options, $posx_montant, $tab_top_newpage, $objmarge->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfooter, 0, $outputlangs, $hidetop, 0, $object->multicurrency_code); |
946 | - $bottomlasttab=$objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1; |
|
946 | + $bottomlasttab = $objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1; |
|
947 | 947 | } |
948 | 948 | |
949 | 949 | // Affiche zone totaux |
950 | - $posy=self::tableau_tot($objmarge, $pdf, $object, $bottomlasttab, $outputlangs, $TTot); |
|
950 | + $posy = self::tableau_tot($objmarge, $pdf, $object, $bottomlasttab, $outputlangs, $TTot); |
|
951 | 951 | |
952 | 952 | $pdf->Close(); |
953 | - $pdf->Output($file,'F'); |
|
953 | + $pdf->Output($file, 'F'); |
|
954 | 954 | |
955 | 955 | $pagecount = self::concat($outputlangs, array($origin_file, $file), $origin_file); |
956 | 956 | |
@@ -962,7 +962,7 @@ discard block |
||
962 | 962 | $level = $line->qty; // TODO à améliorer |
963 | 963 | |
964 | 964 | $pdf->SetXY($objmarge->marge_gauche, $curY); |
965 | - $pdf->MultiCell($posx_designation-$objmarge->marge_gauche-0.8, 5, $level, 0, 'L', 0); |
|
965 | + $pdf->MultiCell($posx_designation - $objmarge->marge_gauche - 0.8, 5, $level, 0, 'L', 0); |
|
966 | 966 | } |
967 | 967 | |
968 | 968 | /** |
@@ -976,50 +976,50 @@ discard block |
||
976 | 976 | */ |
977 | 977 | private static function pagehead(&$objmarge, &$pdf, &$object, $showdetail, $outputlangs) |
978 | 978 | { |
979 | - global $conf,$mysoc; |
|
979 | + global $conf, $mysoc; |
|
980 | 980 | |
981 | 981 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
982 | 982 | |
983 | - pdf_pagehead($pdf,$outputlangs,$objmarge->page_hauteur); |
|
983 | + pdf_pagehead($pdf, $outputlangs, $objmarge->page_hauteur); |
|
984 | 984 | |
985 | - $pdf->SetTextColor(0,0,60); |
|
986 | - $pdf->SetFont('','B', $default_font_size + 3); |
|
985 | + $pdf->SetTextColor(0, 0, 60); |
|
986 | + $pdf->SetFont('', 'B', $default_font_size + 3); |
|
987 | 987 | |
988 | - $posy=$objmarge->marge_haute; |
|
989 | - $posx=$objmarge->page_largeur-$objmarge->marge_droite-100; |
|
988 | + $posy = $objmarge->marge_haute; |
|
989 | + $posx = $objmarge->page_largeur - $objmarge->marge_droite - 100; |
|
990 | 990 | |
991 | - $pdf->SetXY($objmarge->marge_gauche,$posy); |
|
991 | + $pdf->SetXY($objmarge->marge_gauche, $posy); |
|
992 | 992 | |
993 | - $logo=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo; |
|
993 | + $logo = $conf->mycompany->dir_output.'/logos/'.$mysoc->logo; |
|
994 | 994 | if ($mysoc->logo) |
995 | 995 | { |
996 | 996 | if (is_readable($logo)) |
997 | 997 | { |
998 | - $height=pdf_getHeightForLogo($logo); |
|
999 | - $pdf->Image($logo, $objmarge->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
998 | + $height = pdf_getHeightForLogo($logo); |
|
999 | + $pdf->Image($logo, $objmarge->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
1000 | 1000 | } |
1001 | 1001 | else |
1002 | 1002 | { |
1003 | - $pdf->SetTextColor(200,0,0); |
|
1004 | - $pdf->SetFont('','B',$default_font_size - 2); |
|
1005 | - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L'); |
|
1003 | + $pdf->SetTextColor(200, 0, 0); |
|
1004 | + $pdf->SetFont('', 'B', $default_font_size - 2); |
|
1005 | + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); |
|
1006 | 1006 | $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); |
1007 | 1007 | } |
1008 | 1008 | |
1009 | - $posy+=35; |
|
1009 | + $posy += 35; |
|
1010 | 1010 | } |
1011 | 1011 | else |
1012 | 1012 | { |
1013 | - $text=$mysoc->name; |
|
1013 | + $text = $mysoc->name; |
|
1014 | 1014 | $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); |
1015 | 1015 | |
1016 | - $posy+=15; |
|
1016 | + $posy += 15; |
|
1017 | 1017 | } |
1018 | 1018 | |
1019 | 1019 | |
1020 | - $pdf->SetTextColor(0,0,0); |
|
1021 | - $pdf->SetFont('','B', $default_font_size + 2); |
|
1022 | - $pdf->SetXY($objmarge->marge_gauche,$posy); |
|
1020 | + $pdf->SetTextColor(0, 0, 0); |
|
1021 | + $pdf->SetFont('', 'B', $default_font_size + 2); |
|
1022 | + $pdf->SetXY($objmarge->marge_gauche, $posy); |
|
1023 | 1023 | |
1024 | 1024 | $key = 'subtotalPropalTitle'; |
1025 | 1025 | if ($object->element == 'commande') $key = 'subtotalCommandeTitle'; |
@@ -1028,14 +1028,14 @@ discard block |
||
1028 | 1028 | |
1029 | 1029 | $pdf->MultiCell(150, 4, $outputlangs->transnoentities($key, $object->ref, $object->thirdparty->name), '', 'L'); |
1030 | 1030 | |
1031 | - $pdf->SetFont('','', $default_font_size); |
|
1032 | - $pdf->SetXY($objmarge->page_largeur-$objmarge->marge_droite-40,$posy); |
|
1031 | + $pdf->SetFont('', '', $default_font_size); |
|
1032 | + $pdf->SetXY($objmarge->page_largeur - $objmarge->marge_droite - 40, $posy); |
|
1033 | 1033 | $pdf->MultiCell(40, 4, dol_print_date($object->date, 'daytext'), '', 'R'); |
1034 | 1034 | |
1035 | 1035 | $posy += 8; |
1036 | 1036 | |
1037 | - $pdf->SetFont('','B', $default_font_size + 2); |
|
1038 | - $pdf->SetXY($objmarge->marge_gauche,$posy); |
|
1037 | + $pdf->SetFont('', 'B', $default_font_size + 2); |
|
1038 | + $pdf->SetXY($objmarge->marge_gauche, $posy); |
|
1039 | 1039 | $pdf->MultiCell(70, 4, $outputlangs->transnoentities('subtotalRecapLot'), '', 'L'); |
1040 | 1040 | |
1041 | 1041 | } |
@@ -1053,44 +1053,44 @@ discard block |
||
1053 | 1053 | * @param string $currency Currency code |
1054 | 1054 | * @return void |
1055 | 1055 | */ |
1056 | - private static function tableau(&$objmarge, &$pdf, $posx_designation, $posx_options, $posx_montant, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0, $currency='') |
|
1056 | + private static function tableau(&$objmarge, &$pdf, $posx_designation, $posx_options, $posx_montant, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '') |
|
1057 | 1057 | { |
1058 | 1058 | global $conf; |
1059 | 1059 | |
1060 | 1060 | // Force to disable hidetop and hidebottom |
1061 | - $hidebottom=0; |
|
1062 | - if ($hidetop) $hidetop=-1; |
|
1061 | + $hidebottom = 0; |
|
1062 | + if ($hidetop) $hidetop = -1; |
|
1063 | 1063 | |
1064 | 1064 | $currency = !empty($currency) ? $currency : $conf->currency; |
1065 | 1065 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
1066 | 1066 | |
1067 | 1067 | // Amount in (at tab_top - 1) |
1068 | - $pdf->SetTextColor(0,0,0); |
|
1069 | - $pdf->SetFont('','',$default_font_size); |
|
1068 | + $pdf->SetTextColor(0, 0, 0); |
|
1069 | + $pdf->SetFont('', '', $default_font_size); |
|
1070 | 1070 | |
1071 | 1071 | if (empty($hidetop)) |
1072 | 1072 | { |
1073 | - $titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$currency)); |
|
1074 | - $pdf->SetXY($objmarge->page_largeur - $objmarge->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4.5); |
|
1073 | + $titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency)); |
|
1074 | + $pdf->SetXY($objmarge->page_largeur - $objmarge->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4.5); |
|
1075 | 1075 | $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); |
1076 | 1076 | |
1077 | - if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($objmarge->marge_gauche, $tab_top, $objmarge->page_largeur-$objmarge->marge_droite-$objmarge->marge_gauche, 8, 'F', null, explode(',',$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); |
|
1077 | + if (!empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($objmarge->marge_gauche, $tab_top, $objmarge->page_largeur - $objmarge->marge_droite - $objmarge->marge_gauche, 8, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); |
|
1078 | 1078 | |
1079 | 1079 | |
1080 | - $pdf->line($objmarge->marge_gauche, $tab_top, $objmarge->page_largeur-$objmarge->marge_droite, $tab_top); // line prend une position y en 2eme param et 4eme param |
|
1080 | + $pdf->line($objmarge->marge_gauche, $tab_top, $objmarge->page_largeur - $objmarge->marge_droite, $tab_top); // line prend une position y en 2eme param et 4eme param |
|
1081 | 1081 | |
1082 | - $pdf->SetXY($posx_designation, $tab_top+2); |
|
1083 | - $pdf->MultiCell($posx_options - $posx_designation,2, $outputlangs->transnoentities("Designation"),'','L'); |
|
1084 | - $pdf->SetXY($posx_options, $tab_top+2); |
|
1085 | - $pdf->MultiCell($posx_montant - $posx_options,2, $outputlangs->transnoentities("Options"),'','R'); |
|
1086 | - $pdf->SetXY($posx_montant, $tab_top+2); |
|
1087 | - $pdf->MultiCell($objmarge->page_largeur - $objmarge->marge_droite - $posx_montant,2, $outputlangs->transnoentities("Amount"),'','R'); |
|
1082 | + $pdf->SetXY($posx_designation, $tab_top + 2); |
|
1083 | + $pdf->MultiCell($posx_options - $posx_designation, 2, $outputlangs->transnoentities("Designation"), '', 'L'); |
|
1084 | + $pdf->SetXY($posx_options, $tab_top + 2); |
|
1085 | + $pdf->MultiCell($posx_montant - $posx_options, 2, $outputlangs->transnoentities("Options"), '', 'R'); |
|
1086 | + $pdf->SetXY($posx_montant, $tab_top + 2); |
|
1087 | + $pdf->MultiCell($objmarge->page_largeur - $objmarge->marge_droite - $posx_montant, 2, $outputlangs->transnoentities("Amount"), '', 'R'); |
|
1088 | 1088 | |
1089 | - $pdf->line($objmarge->marge_gauche, $tab_top+8, $objmarge->page_largeur-$objmarge->marge_droite, $tab_top+8); // line prend une position y en 2eme param et 4eme param |
|
1089 | + $pdf->line($objmarge->marge_gauche, $tab_top + 8, $objmarge->page_largeur - $objmarge->marge_droite, $tab_top + 8); // line prend une position y en 2eme param et 4eme param |
|
1090 | 1090 | } |
1091 | 1091 | else |
1092 | 1092 | { |
1093 | - $pdf->line($objmarge->marge_gauche, $tab_top-2, $objmarge->page_largeur-$objmarge->marge_droite, $tab_top-2); // line prend une position y en 2eme param et 4eme param |
|
1093 | + $pdf->line($objmarge->marge_gauche, $tab_top - 2, $objmarge->page_largeur - $objmarge->marge_droite, $tab_top - 2); // line prend une position y en 2eme param et 4eme param |
|
1094 | 1094 | } |
1095 | 1095 | |
1096 | 1096 | } |
@@ -1099,29 +1099,29 @@ discard block |
||
1099 | 1099 | { |
1100 | 1100 | global $conf; |
1101 | 1101 | |
1102 | - $pdf->line($objmarge->marge_gauche, $posy, $objmarge->page_largeur-$objmarge->marge_droite, $posy); // line prend une position y en 2eme param et 4eme param |
|
1102 | + $pdf->line($objmarge->marge_gauche, $posy, $objmarge->page_largeur - $objmarge->marge_droite, $posy); // line prend une position y en 2eme param et 4eme param |
|
1103 | 1103 | |
1104 | 1104 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
1105 | 1105 | |
1106 | - $tab2_top = $posy+2; |
|
1106 | + $tab2_top = $posy + 2; |
|
1107 | 1107 | $tab2_hl = 4; |
1108 | - $pdf->SetFont('','', $default_font_size - 1); |
|
1108 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
1109 | 1109 | |
1110 | 1110 | // Tableau total |
1111 | 1111 | $col1x = 120; $col2x = 170; |
1112 | 1112 | if ($objmarge->page_largeur < 210) // To work with US executive format |
1113 | 1113 | { |
1114 | - $col2x-=20; |
|
1114 | + $col2x -= 20; |
|
1115 | 1115 | } |
1116 | 1116 | $largcol2 = ($objmarge->page_largeur - $objmarge->marge_droite - $col2x); |
1117 | 1117 | |
1118 | - $useborder=0; |
|
1118 | + $useborder = 0; |
|
1119 | 1119 | $index = 0; |
1120 | 1120 | |
1121 | 1121 | // Total HT |
1122 | - $pdf->SetFillColor(255,255,255); |
|
1122 | + $pdf->SetFillColor(255, 255, 255); |
|
1123 | 1123 | $pdf->SetXY($col1x, $tab2_top + 0); |
1124 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); |
|
1124 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); |
|
1125 | 1125 | |
1126 | 1126 | // $total_ht = ($conf->multicurrency->enabled && $object->mylticurrency_tx != 1) ? $TTot['multicurrency_total_ht'] : $TTot['total_ht']; |
1127 | 1127 | $total_ht = $TTot['total_ht']; |
@@ -1129,10 +1129,10 @@ discard block |
||
1129 | 1129 | $pdf->MultiCell($largcol2, $tab2_hl, price($total_ht, 0, $outputlangs), 0, 'R', 1); |
1130 | 1130 | |
1131 | 1131 | // Show VAT by rates and total |
1132 | - $pdf->SetFillColor(248,248,248); |
|
1132 | + $pdf->SetFillColor(248, 248, 248); |
|
1133 | 1133 | |
1134 | - $atleastoneratenotnull=0; |
|
1135 | - foreach($TTot['TTotal_tva'] as $tvakey => $tvaval) |
|
1134 | + $atleastoneratenotnull = 0; |
|
1135 | + foreach ($TTot['TTotal_tva'] as $tvakey => $tvaval) |
|
1136 | 1136 | { |
1137 | 1137 | if ($tvakey != 0) // On affiche pas taux 0 |
1138 | 1138 | { |
@@ -1141,15 +1141,15 @@ discard block |
||
1141 | 1141 | $index++; |
1142 | 1142 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
1143 | 1143 | |
1144 | - $tvacompl=''; |
|
1145 | - if (preg_match('/\*/',$tvakey)) |
|
1144 | + $tvacompl = ''; |
|
1145 | + if (preg_match('/\*/', $tvakey)) |
|
1146 | 1146 | { |
1147 | - $tvakey=str_replace('*','',$tvakey); |
|
1147 | + $tvakey = str_replace('*', '', $tvakey); |
|
1148 | 1148 | $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; |
1149 | 1149 | } |
1150 | - $totalvat =$outputlangs->transnoentities("TotalVAT").' '; |
|
1151 | - $totalvat.=vatrate($tvakey,1).$tvacompl; |
|
1152 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
1150 | + $totalvat = $outputlangs->transnoentities("TotalVAT").' '; |
|
1151 | + $totalvat .= vatrate($tvakey, 1).$tvacompl; |
|
1152 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
1153 | 1153 | |
1154 | 1154 | $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
1155 | 1155 | $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); |
@@ -1159,16 +1159,16 @@ discard block |
||
1159 | 1159 | // Total TTC |
1160 | 1160 | $index++; |
1161 | 1161 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
1162 | - $pdf->SetTextColor(0,0,60); |
|
1163 | - $pdf->SetFillColor(224,224,224); |
|
1164 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); |
|
1162 | + $pdf->SetTextColor(0, 0, 60); |
|
1163 | + $pdf->SetFillColor(224, 224, 224); |
|
1164 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); |
|
1165 | 1165 | |
1166 | 1166 | // $total_ttc = ($conf->multicurrency->enabled && $object->multiccurency_tx != 1) ? $TTot['multicurrency_total_ttc'] : $TTot['total_ttc']; |
1167 | 1167 | $total_ttc = $TTot['total_ttc']; |
1168 | 1168 | $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
1169 | 1169 | $pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc, 0, $outputlangs), $useborder, 'R', 1); |
1170 | 1170 | |
1171 | - $pdf->SetTextColor(0,0,0); |
|
1171 | + $pdf->SetTextColor(0, 0, 0); |
|
1172 | 1172 | |
1173 | 1173 | $index++; |
1174 | 1174 | return ($tab2_top + ($tab2_hl * $index)); |
@@ -1187,22 +1187,22 @@ discard block |
||
1187 | 1187 | * @param int $hidebottom Hide bottom |
1188 | 1188 | * @return void |
1189 | 1189 | */ |
1190 | - private static function printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0) |
|
1190 | + private static function printRect($pdf, $x, $y, $l, $h, $hidetop = 0, $hidebottom = 0) |
|
1191 | 1191 | { |
1192 | - if (empty($hidetop) || $hidetop==-1) $pdf->line($x, $y, $x+$l, $y); |
|
1193 | - $pdf->line($x+$l, $y, $x+$l, $y+$h); |
|
1194 | - if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h); |
|
1195 | - $pdf->line($x, $y+$h, $x, $y); |
|
1192 | + if (empty($hidetop) || $hidetop == -1) $pdf->line($x, $y, $x + $l, $y); |
|
1193 | + $pdf->line($x + $l, $y, $x + $l, $y + $h); |
|
1194 | + if (empty($hidebottom)) $pdf->line($x + $l, $y + $h, $x, $y + $h); |
|
1195 | + $pdf->line($x, $y + $h, $x, $y); |
|
1196 | 1196 | } |
1197 | 1197 | |
1198 | 1198 | |
1199 | - public static function concat(&$outputlangs, $files, $fileoutput='') |
|
1199 | + public static function concat(&$outputlangs, $files, $fileoutput = '') |
|
1200 | 1200 | { |
1201 | 1201 | global $conf; |
1202 | 1202 | |
1203 | 1203 | if (empty($fileoutput)) $fileoutput = $file[0]; |
1204 | 1204 | |
1205 | - $pdf=pdf_getInstance(); |
|
1205 | + $pdf = pdf_getInstance(); |
|
1206 | 1206 | if (class_exists('TCPDF')) |
1207 | 1207 | { |
1208 | 1208 | $pdf->setPrintHeader(false); |
@@ -1210,10 +1210,10 @@ discard block |
||
1210 | 1210 | } |
1211 | 1211 | $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
1212 | 1212 | |
1213 | - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
1213 | + if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
1214 | 1214 | |
1215 | 1215 | |
1216 | - foreach($files as $file) |
|
1216 | + foreach ($files as $file) |
|
1217 | 1217 | { |
1218 | 1218 | $pagecount = $pdf->setSourceFile($file); |
1219 | 1219 | for ($i = 1; $i <= $pagecount; $i++) |
@@ -1225,8 +1225,8 @@ discard block |
||
1225 | 1225 | } |
1226 | 1226 | } |
1227 | 1227 | |
1228 | - $pdf->Output($fileoutput,'F'); |
|
1229 | - if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
1228 | + $pdf->Output($fileoutput, 'F'); |
|
1229 | + if (!empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
1230 | 1230 | |
1231 | 1231 | return $pagecount; |
1232 | 1232 | } |
@@ -1239,7 +1239,7 @@ discard block |
||
1239 | 1239 | */ |
1240 | 1240 | public static function hasNcTitle(&$line) |
1241 | 1241 | { |
1242 | - if(isset($line->has_nc_title)) return $line->has_nc_title; |
|
1242 | + if (isset($line->has_nc_title)) return $line->has_nc_title; |
|
1243 | 1243 | |
1244 | 1244 | $TTitle = self::getAllTitleFromLine($line); |
1245 | 1245 | foreach ($TTitle as &$line_title) |
@@ -13,18 +13,23 @@ discard block |
||
13 | 13 | /** |
14 | 14 | * @var $object Facture |
15 | 15 | */ |
16 | - if($object->element=='facture') $res = $object->addline($object->id, $label, 0,$qty,0,0,0,0,0,'','',0,0,'','HT',0,9,-1, TSubtotal::$module_number); |
|
16 | + if($object->element=='facture') { |
|
17 | + $res = $object->addline($object->id, $label, 0,$qty,0,0,0,0,0,'','',0,0,'','HT',0,9,-1, TSubtotal::$module_number); |
|
18 | + } |
|
17 | 19 | /** |
18 | 20 | * @var $object Propal |
19 | 21 | */ |
20 | - else if($object->element=='propal') $res = $object->addline($object->id,$label, 0,$qty,0,0,0,0,0,'HT',0,0,9,-1, TSubtotal::$module_number); |
|
22 | + else if($object->element=='propal') { |
|
23 | + $res = $object->addline($object->id,$label, 0,$qty,0,0,0,0,0,'HT',0,0,9,-1, TSubtotal::$module_number); |
|
24 | + } |
|
21 | 25 | /** |
22 | 26 | * @var $object Commande |
23 | 27 | */ |
24 | - else if($object->element=='commande') $res = $object->addline($object->id,$label, 0,$qty,0,0,0,0,0,0,0,'HT',0,'','',9,-1, TSubtotal::$module_number); |
|
28 | + else if($object->element=='commande') { |
|
29 | + $res = $object->addline($object->id,$label, 0,$qty,0,0,0,0,0,0,0,'HT',0,'','',9,-1, TSubtotal::$module_number); |
|
30 | + } |
|
25 | 31 | |
26 | - } |
|
27 | - else { |
|
32 | + } else { |
|
28 | 33 | $desc = ''; |
29 | 34 | if ((float) DOL_VERSION < 6 || $qty==50) { |
30 | 35 | $desc = $label; |
@@ -34,29 +39,40 @@ discard block |
||
34 | 39 | /** |
35 | 40 | * @var $object Facture |
36 | 41 | */ |
37 | - if($object->element=='facture') $res = $object->addline($desc, 0,$qty,0,0,0,0,0,'','',0,0,'','HT',0,9,$rang, TSubtotal::$module_number, '', 0, 0, null, 0, $label); |
|
42 | + if($object->element=='facture') { |
|
43 | + $res = $object->addline($desc, 0,$qty,0,0,0,0,0,'','',0,0,'','HT',0,9,$rang, TSubtotal::$module_number, '', 0, 0, null, 0, $label); |
|
44 | + } |
|
38 | 45 | /** |
39 | 46 | * @var $object Facture fournisseur |
40 | 47 | */ |
41 | 48 | else if($object->element=='invoice_supplier') { |
42 | 49 | $object->special_code = TSubtotal::$module_number; |
43 | 50 | $rang = $object->line_max() + 1; |
44 | - if($qty==50) $res = $object->addline($desc,0,0,0,0,$qty,0,0,'','',0,0,'HT',9,$rang); |
|
45 | - else $res = $object->addline($label,0,0,0,0,$qty,0,0,'','',0,0,'HT',9,$rang); |
|
51 | + if($qty==50) { |
|
52 | + $res = $object->addline($desc,0,0,0,0,$qty,0,0,'','',0,0,'HT',9,$rang); |
|
53 | + } else { |
|
54 | + $res = $object->addline($label,0,0,0,0,$qty,0,0,'','',0,0,'HT',9,$rang); |
|
55 | + } |
|
46 | 56 | } |
47 | 57 | /** |
48 | 58 | * @var $object Propal |
49 | 59 | */ |
50 | - else if($object->element=='propal') $res = $object->addline($desc, 0,$qty,0,0,0,0,0,'HT',0,0,9,$rang, TSubtotal::$module_number, 0, 0, 0, $label); |
|
60 | + else if($object->element=='propal') { |
|
61 | + $res = $object->addline($desc, 0,$qty,0,0,0,0,0,'HT',0,0,9,$rang, TSubtotal::$module_number, 0, 0, 0, $label); |
|
62 | + } |
|
51 | 63 | /** |
52 | 64 | * @var $object Propal Fournisseur |
53 | 65 | */ |
54 | - else if($object->element=='supplier_proposal') $res = $object->addline($desc, 0,$qty,0,0,0,0,0,'HT',0,0,9,$rang, TSubtotal::$module_number, 0, 0, 0, $label); |
|
66 | + else if($object->element=='supplier_proposal') { |
|
67 | + $res = $object->addline($desc, 0,$qty,0,0,0,0,0,'HT',0,0,9,$rang, TSubtotal::$module_number, 0, 0, 0, $label); |
|
68 | + } |
|
55 | 69 | |
56 | 70 | /** |
57 | 71 | * @var $object Commande |
58 | 72 | */ |
59 | - else if($object->element=='commande') $res = $object->addline($desc, 0,$qty,0,0,0,0,0,0,0,'HT',0,'','',9,$rang, TSubtotal::$module_number, 0, null, 0, $label); |
|
73 | + else if($object->element=='commande') { |
|
74 | + $res = $object->addline($desc, 0,$qty,0,0,0,0,0,0,0,'HT',0,'','',9,$rang, TSubtotal::$module_number, 0, null, 0, $label); |
|
75 | + } |
|
60 | 76 | /** |
61 | 77 | * @var $object Commande fournisseur |
62 | 78 | */ |
@@ -67,7 +83,9 @@ discard block |
||
67 | 83 | /** |
68 | 84 | * @var $object Facturerec |
69 | 85 | */ |
70 | - else if($object->element=='facturerec') $res = $object->addline($desc, 0,$qty, 0, 0, 0, 0, 0, 'HT', 0, '', 0, 9, $rang, TSubtotal::$module_number,$label); |
|
86 | + else if($object->element=='facturerec') { |
|
87 | + $res = $object->addline($desc, 0,$qty, 0, 0, 0, 0, 0, 'HT', 0, '', 0, 9, $rang, TSubtotal::$module_number,$label); |
|
88 | + } |
|
71 | 89 | |
72 | 90 | } |
73 | 91 | |
@@ -89,8 +107,9 @@ discard block |
||
89 | 107 | // Define output language |
90 | 108 | $outputlangs = $langs; |
91 | 109 | $newlang = GETPOST('lang_id', 'alpha'); |
92 | - if (! empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) |
|
93 | - $newlang = !empty($object->client) ? $object->client->default_lang : $object->thirdparty->default_lang; |
|
110 | + if (! empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) { |
|
111 | + $newlang = !empty($object->client) ? $object->client->default_lang : $object->thirdparty->default_lang; |
|
112 | + } |
|
94 | 113 | if (! empty($newlang)) { |
95 | 114 | $outputlangs = new Translate("", $conf); |
96 | 115 | $outputlangs->setDefaultLang($newlang); |
@@ -99,13 +118,18 @@ discard block |
||
99 | 118 | $ret = $object->fetch($object->id); // Reload to get new records |
100 | 119 | if ((float) DOL_VERSION <= 3.6) |
101 | 120 | { |
102 | - if ($object->element == 'propal') propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
103 | - elseif ($object->element == 'commande') commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
104 | - elseif ($object->element == 'facture') facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
105 | - } |
|
106 | - else |
|
121 | + if ($object->element == 'propal') { |
|
122 | + propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
123 | + } elseif ($object->element == 'commande') { |
|
124 | + commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
125 | + } elseif ($object->element == 'facture') { |
|
126 | + facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
127 | + } |
|
128 | + } else |
|
107 | 129 | { |
108 | - if ($object->element!= 'facturerec') $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
130 | + if ($object->element!= 'facturerec') { |
|
131 | + $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
132 | + } |
|
109 | 133 | } |
110 | 134 | } |
111 | 135 | } |
@@ -119,7 +143,9 @@ discard block |
||
119 | 143 | */ |
120 | 144 | public static function updateRang(&$object, $rang_start, $move_to=1) |
121 | 145 | { |
122 | - if (!class_exists('GenericObject')) require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php'; |
|
146 | + if (!class_exists('GenericObject')) { |
|
147 | + require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php'; |
|
148 | + } |
|
123 | 149 | |
124 | 150 | $row=new GenericObject($object->db); |
125 | 151 | $row->table_element_line = $object->table_element_line; |
@@ -128,7 +154,9 @@ discard block |
||
128 | 154 | |
129 | 155 | foreach ($object->lines as &$line) |
130 | 156 | { |
131 | - if ($line->rang < $rang_start) continue; |
|
157 | + if ($line->rang < $rang_start) { |
|
158 | + continue; |
|
159 | + } |
|
132 | 160 | |
133 | 161 | $row->updateRangOfLine($line->id, $line->rang+$move_to); |
134 | 162 | } |
@@ -151,21 +179,28 @@ discard block |
||
151 | 179 | foreach ($TTitle_reverse as $k => $title_line) |
152 | 180 | { |
153 | 181 | $title_niveau = self::getNiveau($title_line); |
154 | - if ($title_niveau < $level_new_title) break; |
|
182 | + if ($title_niveau < $level_new_title) { |
|
183 | + break; |
|
184 | + } |
|
155 | 185 | |
156 | 186 | $rang_to_add = self::titleHasTotalLine($object, $title_line, true, true); |
157 | 187 | |
158 | 188 | if (is_numeric($rang_to_add)) |
159 | 189 | { |
160 | - if ($rang_to_add != -1) self::updateRang($object, $rang_to_add); |
|
190 | + if ($rang_to_add != -1) { |
|
191 | + self::updateRang($object, $rang_to_add); |
|
192 | + } |
|
161 | 193 | |
162 | 194 | self::addSubTotalLine($object, $langs->trans('SubTotal'), 100-$title_niveau, $rang_to_add); |
163 | 195 | |
164 | 196 | $object->lines[] = $object->line; // ajout de la ligne dans le tableau de ligne (Dolibarr ne le fait pas) |
165 | 197 | if ($rang_to_add != -1) |
166 | 198 | { |
167 | - if (method_exists($object, 'fetch_lines')) $object->fetch_lines(); |
|
168 | - else $object->fetch($object->id); |
|
199 | + if (method_exists($object, 'fetch_lines')) { |
|
200 | + $object->fetch_lines(); |
|
201 | + } else { |
|
202 | + $object->fetch($object->id); |
|
203 | + } |
|
169 | 204 | } |
170 | 205 | } |
171 | 206 | } |
@@ -195,7 +230,9 @@ discard block |
||
195 | 230 | |
196 | 231 | foreach ($TTitle as $k => $title_line) |
197 | 232 | { |
198 | - if (self::titleHasTotalLine($object, $title_line)) unset($TTitle[$k]); |
|
233 | + if (self::titleHasTotalLine($object, $title_line)) { |
|
234 | + unset($TTitle[$k]); |
|
235 | + } |
|
199 | 236 | } |
200 | 237 | |
201 | 238 | return $TTitle; |
@@ -212,23 +249,41 @@ discard block |
||
212 | 249 | */ |
213 | 250 | public static function titleHasTotalLine(&$object, &$title_line, $strict_mode=false, $return_rang_on_false=false) |
214 | 251 | { |
215 | - if (empty($object->lines) || !is_array($object->lines)) return false; |
|
252 | + if (empty($object->lines) || !is_array($object->lines)) { |
|
253 | + return false; |
|
254 | + } |
|
216 | 255 | |
217 | 256 | $title_niveau = self::getNiveau($title_line); |
218 | 257 | foreach ($object->lines as &$line) |
219 | 258 | { |
220 | - if ($line->rang <= $title_line->rang) continue; |
|
221 | - if (self::isTitle($line) && self::getNiveau($line) <= $title_niveau) return false; // Oups on croise un titre d'un niveau inférieur ou égale (exemple : je croise un titre niveau 2 alors que je suis sur un titre de niveau 3) pas lieu de continuer car un nouveau bloc commence |
|
222 | - if (!self::isSubtotal($line)) continue; |
|
259 | + if ($line->rang <= $title_line->rang) { |
|
260 | + continue; |
|
261 | + } |
|
262 | + if (self::isTitle($line) && self::getNiveau($line) <= $title_niveau) { |
|
263 | + return false; |
|
264 | + } |
|
265 | + // Oups on croise un titre d'un niveau inférieur ou égale (exemple : je croise un titre niveau 2 alors que je suis sur un titre de niveau 3) pas lieu de continuer car un nouveau bloc commence |
|
266 | + if (!self::isSubtotal($line)) { |
|
267 | + continue; |
|
268 | + } |
|
223 | 269 | |
224 | 270 | $subtotal_niveau = self::getNiveau($line); |
225 | 271 | |
226 | 272 | // Comparaison du niveau de la ligne de sous-total avec celui du titre |
227 | - if ($subtotal_niveau == $title_niveau) return true; // niveau égale => Ok mon titre a un sous-total |
|
228 | - elseif ($subtotal_niveau < $title_niveau) // niveau inférieur trouvé (exemple : sous-total de niveau 1 contre mon titre de niveau 3) |
|
273 | + if ($subtotal_niveau == $title_niveau) { |
|
274 | + return true; |
|
275 | + } |
|
276 | + // niveau égale => Ok mon titre a un sous-total |
|
277 | + elseif ($subtotal_niveau < $title_niveau) { |
|
278 | + // niveau inférieur trouvé (exemple : sous-total de niveau 1 contre mon titre de niveau 3) |
|
229 | 279 | { |
230 | - if ($strict_mode) return ($return_rang_on_false) ? $line->rang : false; // mode strict niveau pas égale donc faux |
|
231 | - else return true; // mode libre => OK je considère que mon titre à un sous-total |
|
280 | + if ($strict_mode) return ($return_rang_on_false) ? $line->rang : false; |
|
281 | + } |
|
282 | + // mode strict niveau pas égale donc faux |
|
283 | + else { |
|
284 | + return true; |
|
285 | + } |
|
286 | + // mode libre => OK je considère que mon titre à un sous-total |
|
232 | 287 | } |
233 | 288 | } |
234 | 289 | |
@@ -276,16 +331,19 @@ discard block |
||
276 | 331 | |
277 | 332 | foreach ($object->lines as &$l) |
278 | 333 | { |
279 | - if ($l->rang <= $line->rang) continue; |
|
280 | - elseif (self::isSubtotal($l) && self::getNiveau($l) == $line->qty) break; |
|
281 | - elseif (self::isModSubtotalLine($l)) continue; |
|
334 | + if ($l->rang <= $line->rang) { |
|
335 | + continue; |
|
336 | + } elseif (self::isSubtotal($l) && self::getNiveau($l) == $line->qty) { |
|
337 | + break; |
|
338 | + } elseif (self::isModSubtotalLine($l)) { |
|
339 | + continue; |
|
340 | + } |
|
282 | 341 | |
283 | 342 | if (!empty($l->array_options['options_subtotal_nc'])) |
284 | 343 | { |
285 | 344 | $tabprice = calcul_price_total($l->qty, $l->subprice, $l->remise_percent, $l->tva_tx, $l->localtax1_tx, $l->localtax2_tx, 0, 'HT', $l->info_bits, $l->product_type); |
286 | 345 | $TTot['total_options'] += $tabprice[0]; // total ht |
287 | - } |
|
288 | - else |
|
346 | + } else |
|
289 | 347 | { |
290 | 348 | $TTot['total_pa_ht'] += $l->pa_ht * $l->qty; |
291 | 349 | $TTot['total_ht'] += $l->total_ht; |
@@ -304,29 +362,41 @@ discard block |
||
304 | 362 | |
305 | 363 | public static function getOrderIdFromLineId(&$db, $fk_commandedet) |
306 | 364 | { |
307 | - if (empty($fk_commandedet)) return false; |
|
365 | + if (empty($fk_commandedet)) { |
|
366 | + return false; |
|
367 | + } |
|
308 | 368 | |
309 | 369 | $sql = 'SELECT fk_commande FROM '.MAIN_DB_PREFIX.'commandedet WHERE rowid = '.$fk_commandedet; |
310 | 370 | $resql = $db->query($sql); |
311 | 371 | |
312 | - if ($resql && ($row = $db->fetch_object($resql))) return $row->fk_commande; |
|
313 | - else return false; |
|
372 | + if ($resql && ($row = $db->fetch_object($resql))) { |
|
373 | + return $row->fk_commande; |
|
374 | + } else { |
|
375 | + return false; |
|
376 | + } |
|
314 | 377 | } |
315 | 378 | |
316 | 379 | public static function getLastLineOrderId(&$db, $fk_commande) |
317 | 380 | { |
318 | - if (empty($fk_commande)) return false; |
|
381 | + if (empty($fk_commande)) { |
|
382 | + return false; |
|
383 | + } |
|
319 | 384 | |
320 | 385 | $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'commandedet WHERE fk_commande = '.$fk_commande.' ORDER BY rang DESC LIMIT 1'; |
321 | 386 | $resql = $db->query($sql); |
322 | 387 | |
323 | - if ($resql && ($row = $db->fetch_object($resql))) return $row->rowid; |
|
324 | - else return false; |
|
388 | + if ($resql && ($row = $db->fetch_object($resql))) { |
|
389 | + return $row->rowid; |
|
390 | + } else { |
|
391 | + return false; |
|
392 | + } |
|
325 | 393 | } |
326 | 394 | |
327 | 395 | public static function getParentTitleOfLine(&$object, $i) |
328 | 396 | { |
329 | - if ($i <= 0) return false; |
|
397 | + if ($i <= 0) { |
|
398 | + return false; |
|
399 | + } |
|
330 | 400 | |
331 | 401 | $skip_title = 0; |
332 | 402 | // Je parcours les lignes précédentes |
@@ -345,8 +415,7 @@ discard block |
||
345 | 415 | //@INFO J'ai ma ligne titre qui contient ma ligne, par contre je check pas s'il y a un sous-total |
346 | 416 | return $line; |
347 | 417 | break; |
348 | - } |
|
349 | - elseif ($line->product_type == 9 && $line->qty >= 90 && $line->qty <= 99) |
|
418 | + } elseif ($line->product_type == 9 && $line->qty >= 90 && $line->qty <= 99) |
|
350 | 419 | { |
351 | 420 | // Il s'agit d'un sous-total, ça veut dire que le prochain titre théoriquement doit être ignorer (je travail avec un incrément au cas ou je croise plusieurs sous-totaux) |
352 | 421 | $skip_title++; |
@@ -361,7 +430,9 @@ discard block |
||
361 | 430 | $res = $line->special_code == self::$module_number && $line->product_type == 9 && $line->qty <= 9; |
362 | 431 | if($res && $level > -1) { |
363 | 432 | return $line->qty == $level; |
364 | - } else return $res; |
|
433 | + } else { |
|
434 | + return $res; |
|
435 | + } |
|
365 | 436 | |
366 | 437 | } |
367 | 438 | |
@@ -388,10 +459,14 @@ discard block |
||
388 | 459 | // editeur wysiwyg |
389 | 460 | require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
390 | 461 | $nbrows=ROWS_2; |
391 | - if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; |
|
462 | + if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) { |
|
463 | + $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; |
|
464 | + } |
|
392 | 465 | $enable=(isset($conf->global->FCKEDITOR_ENABLE_DETAILS)?$conf->global->FCKEDITOR_ENABLE_DETAILS:0); |
393 | 466 | $toolbarname='dolibarr_details'; |
394 | - if (! empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) $toolbarname='dolibarr_notes'; |
|
467 | + if (! empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) { |
|
468 | + $toolbarname='dolibarr_notes'; |
|
469 | + } |
|
395 | 470 | $text = !empty($line->description)?$line->description:$line->label; |
396 | 471 | $doleditor=new DolEditor('line-description',$text,'',164,$toolbarname,'',false,true,$enable,$nbrows,'98%', $readonly); |
397 | 472 | return $doleditor->Create(1); |
@@ -406,12 +481,10 @@ discard block |
||
406 | 481 | { |
407 | 482 | $object->statut = 0; // hack for facture rec |
408 | 483 | $createRight = $user->rights->facture->creer; |
409 | - } |
|
410 | - elseif($object->element == 'order_supplier' ) |
|
484 | + } elseif($object->element == 'order_supplier' ) |
|
411 | 485 | { |
412 | 486 | $createRight = $user->rights->fournisseur->commande->creer; |
413 | - } |
|
414 | - elseif($object->element == 'invoice_supplier' ) |
|
487 | + } elseif($object->element == 'invoice_supplier' ) |
|
415 | 488 | { |
416 | 489 | $createRight = $user->rights->fournisseur->facture->creer; |
417 | 490 | } |
@@ -484,8 +557,9 @@ discard block |
||
484 | 557 | |
485 | 558 | $TLineAdded[] = $object->line; |
486 | 559 | // Error from addline |
487 | - if ($res <= 0) break; |
|
488 | - else |
|
560 | + if ($res <= 0) { |
|
561 | + break; |
|
562 | + } else |
|
489 | 563 | { |
490 | 564 | $object->line_from = $line; |
491 | 565 | // Call trigger |
@@ -507,8 +581,7 @@ discard block |
||
507 | 581 | _updateLineNC($object->element, $object->id, $line->id, $line->array_options['options_subtotal_nc']); |
508 | 582 | } |
509 | 583 | return count($TLineAdded); |
510 | - } |
|
511 | - else |
|
584 | + } else |
|
512 | 585 | { |
513 | 586 | $object->db->rollback(); |
514 | 587 | return -1; |
@@ -524,10 +597,14 @@ discard block |
||
524 | 597 | global $langs; |
525 | 598 | |
526 | 599 | // Besoin de comparer sur les 2 formes d'écriture |
527 | - if (!$key_is_id) $TTitle_search = array($langs->trans($key_trad), $langs->transnoentitiesnoconv($key_trad)); |
|
600 | + if (!$key_is_id) { |
|
601 | + $TTitle_search = array($langs->trans($key_trad), $langs->transnoentitiesnoconv($key_trad)); |
|
602 | + } |
|
528 | 603 | |
529 | 604 | $TTitle_under_search = array(); |
530 | - if (!empty($under_title)) $TTitle_under_search = array($langs->trans($under_title), $langs->transnoentitiesnoconv($under_title)); |
|
605 | + if (!empty($under_title)) { |
|
606 | + $TTitle_under_search = array($langs->trans($under_title), $langs->transnoentitiesnoconv($under_title)); |
|
607 | + } |
|
531 | 608 | |
532 | 609 | $TLine = array(); |
533 | 610 | $add_line = false; |
@@ -537,28 +614,37 @@ discard block |
||
537 | 614 | { |
538 | 615 | if (!$under_title_found && !empty($TTitle_under_search)) |
539 | 616 | { |
540 | - if ($line->product_type == 9 && (in_array($line->desc, $TTitle_under_search) || in_array($line->label, $TTitle_under_search)) ) $under_title_found = true; |
|
541 | - } |
|
542 | - else |
|
617 | + if ($line->product_type == 9 && (in_array($line->desc, $TTitle_under_search) || in_array($line->label, $TTitle_under_search)) ) { |
|
618 | + $under_title_found = true; |
|
619 | + } |
|
620 | + } else |
|
543 | 621 | { |
544 | 622 | if ( ($key_is_id && $line->id == $key_trad) || (!$key_is_id && $line->product_type == 9 && $line->qty == $level && (in_array($line->desc, $TTitle_search) || in_array($line->label, $TTitle_search) ))) |
545 | 623 | { |
546 | - if ($key_is_id) $level = $line->qty; |
|
624 | + if ($key_is_id) { |
|
625 | + $level = $line->qty; |
|
626 | + } |
|
547 | 627 | |
548 | 628 | $add_line = true; |
549 | - if ($withBlockLine) $TLine[] = $line; |
|
629 | + if ($withBlockLine) { |
|
630 | + $TLine[] = $line; |
|
631 | + } |
|
550 | 632 | continue; |
551 | - } |
|
552 | - elseif ($add_line && $line->product_type == 9 && (100 - $line->qty == $level) ) // Si on tombe sur un sous-total, il faut que ce soit un du même niveau que le titre |
|
633 | + } elseif ($add_line && $line->product_type == 9 && (100 - $line->qty == $level) ) { |
|
634 | + // Si on tombe sur un sous-total, il faut que ce soit un du même niveau que le titre |
|
553 | 635 | { |
554 | 636 | if ($withBlockLine) $TLine[] = $line; |
637 | + } |
|
555 | 638 | break; |
556 | 639 | } |
557 | 640 | |
558 | 641 | if ($add_line) |
559 | 642 | { |
560 | - if (!$withBlockLine && (self::isTitle($line) || self::isSubtotal($line)) ) continue; |
|
561 | - else $TLine[] = $line; |
|
643 | + if (!$withBlockLine && (self::isTitle($line) || self::isSubtotal($line)) ) { |
|
644 | + continue; |
|
645 | + } else { |
|
646 | + $TLine[] = $line; |
|
647 | + } |
|
562 | 648 | } |
563 | 649 | } |
564 | 650 | } |
@@ -592,7 +678,9 @@ discard block |
||
592 | 678 | |
593 | 679 | case 'order_supplier': |
594 | 680 | $object->special_code = SELF::$module_number; |
595 | - if (empty($desc)) $desc = $label; |
|
681 | + if (empty($desc)) { |
|
682 | + $desc = $label; |
|
683 | + } |
|
596 | 684 | $res = $object->updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $price_base_type, $info_bits, $type, 0, $date_start, $date_end, $array_options, $fk_unit); |
597 | 685 | break; |
598 | 686 | |
@@ -602,7 +690,9 @@ discard block |
||
602 | 690 | |
603 | 691 | case 'invoice_supplier': |
604 | 692 | $object->special_code = SELF::$module_number; |
605 | - if (empty($desc)) $desc = $label; |
|
693 | + if (empty($desc)) { |
|
694 | + $desc = $label; |
|
695 | + } |
|
606 | 696 | $res = $object->updateline($rowid, $desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, 0, $price_base_type, $info_bits, $type, $remise_percent, 0, $date_start, $date_end, $array_options, $fk_unit); |
607 | 697 | break; |
608 | 698 | |
@@ -619,8 +709,11 @@ discard block |
||
619 | 709 | break; |
620 | 710 | } |
621 | 711 | |
622 | - if ($res <= 0) $object->db->rollback(); |
|
623 | - else $object->db->commit(); |
|
712 | + if ($res <= 0) { |
|
713 | + $object->db->rollback(); |
|
714 | + } else { |
|
715 | + $object->db->commit(); |
|
716 | + } |
|
624 | 717 | |
625 | 718 | return $res; |
626 | 719 | } |
@@ -630,24 +723,20 @@ discard block |
||
630 | 723 | global $db, $object; |
631 | 724 | |
632 | 725 | $TTitle = array(); |
633 | - if(! empty($object->id) && in_array($object->element, array('propal', 'commande', 'facture'))) {} |
|
634 | - else { |
|
726 | + if(! empty($object->id) && in_array($object->element, array('propal', 'commande', 'facture'))) {} else { |
|
635 | 727 | if ($origin_line->element == 'propaldet') |
636 | 728 | { |
637 | 729 | $object = new Propal($db); |
638 | 730 | $object->fetch($origin_line->fk_propal); |
639 | - } |
|
640 | - else if ($origin_line->element == 'commandedet') |
|
731 | + } else if ($origin_line->element == 'commandedet') |
|
641 | 732 | { |
642 | 733 | $object = new Commande($db); |
643 | 734 | $object->fetch($origin_line->fk_commande); |
644 | - } |
|
645 | - else if ($origin_line->element == 'facturedet') |
|
735 | + } else if ($origin_line->element == 'facturedet') |
|
646 | 736 | { |
647 | 737 | $object = new Facture($db); |
648 | 738 | $object->fetch($origin_line->fk_facture); |
649 | - } |
|
650 | - else |
|
739 | + } else |
|
651 | 740 | { |
652 | 741 | return $TTitle; |
653 | 742 | } |
@@ -657,8 +746,11 @@ discard block |
||
657 | 746 | $i = 0; |
658 | 747 | foreach ($object->lines as &$line) |
659 | 748 | { |
660 | - if ($origin_line->id == $line->id) break; |
|
661 | - else $i++; |
|
749 | + if ($origin_line->id == $line->id) { |
|
750 | + break; |
|
751 | + } else { |
|
752 | + $i++; |
|
753 | + } |
|
662 | 754 | } |
663 | 755 | |
664 | 756 | $i--; // Skip la ligne d'origine |
@@ -673,35 +765,43 @@ discard block |
||
673 | 765 | if (self::isSubtotal($object->lines[$y])) |
674 | 766 | { |
675 | 767 | $next_title_lvl_to_skip = self::getNiveau($object->lines[$y]); |
676 | - } |
|
677 | - elseif (self::isTitle($object->lines[$y])) |
|
768 | + } elseif (self::isTitle($object->lines[$y])) |
|
678 | 769 | { |
679 | 770 | if ($object->lines[$y]->qty == $next_title_lvl_to_skip) |
680 | 771 | { |
681 | 772 | $next_title_lvl_to_skip = 0; |
682 | 773 | continue; |
683 | - } |
|
684 | - else |
|
774 | + } else |
|
685 | 775 | { |
686 | - if (empty($object->lines[$y]->array_options)) $object->lines[$y]->fetch_optionals(); |
|
776 | + if (empty($object->lines[$y]->array_options)) { |
|
777 | + $object->lines[$y]->fetch_optionals(); |
|
778 | + } |
|
687 | 779 | $TTitle[$object->lines[$y]->id] = $object->lines[$y]; |
688 | 780 | |
689 | - if ($object->lines[$y]->qty == 1) break; |
|
781 | + if ($object->lines[$y]->qty == 1) { |
|
782 | + break; |
|
783 | + } |
|
690 | 784 | } |
691 | 785 | } |
692 | 786 | } |
693 | 787 | } |
694 | 788 | |
695 | - if ($reverse) $TTitle = array_reverse($TTitle, true); |
|
789 | + if ($reverse) { |
|
790 | + $TTitle = array_reverse($TTitle, true); |
|
791 | + } |
|
696 | 792 | |
697 | 793 | return $TTitle; |
698 | 794 | } |
699 | 795 | |
700 | 796 | public static function getNiveau(&$line) |
701 | 797 | { |
702 | - if (self::isTitle($line)) return $line->qty; |
|
703 | - elseif (self::isSubtotal($line)) return 100 - $line->qty; |
|
704 | - else return 0; |
|
798 | + if (self::isTitle($line)) { |
|
799 | + return $line->qty; |
|
800 | + } elseif (self::isSubtotal($line)) { |
|
801 | + return 100 - $line->qty; |
|
802 | + } else { |
|
803 | + return 0; |
|
804 | + } |
|
705 | 805 | } |
706 | 806 | |
707 | 807 | /** |
@@ -726,10 +826,16 @@ discard block |
||
726 | 826 | $objmarge->marge_droite = 10; |
727 | 827 | |
728 | 828 | $objectref = dol_sanitizeFileName($object->ref); |
729 | - if ($object->element == 'propal') $dir = $conf->propal->dir_output . '/' . $objectref; |
|
730 | - elseif ($object->element == 'commande') $dir = $conf->commande->dir_output . '/' . $objectref; |
|
731 | - elseif ($object->element == 'facture') $dir = $conf->facture->dir_output . '/' . $objectref; |
|
732 | - elseif ($object->element == 'facturerec') return; // no PDF for facturerec |
|
829 | + if ($object->element == 'propal') { |
|
830 | + $dir = $conf->propal->dir_output . '/' . $objectref; |
|
831 | + } elseif ($object->element == 'commande') { |
|
832 | + $dir = $conf->commande->dir_output . '/' . $objectref; |
|
833 | + } elseif ($object->element == 'facture') { |
|
834 | + $dir = $conf->facture->dir_output . '/' . $objectref; |
|
835 | + } elseif ($object->element == 'facturerec') { |
|
836 | + return; |
|
837 | + } |
|
838 | + // no PDF for facturerec |
|
733 | 839 | else |
734 | 840 | { |
735 | 841 | setEventMessage($langs->trans('warning_subtotal_recap_object_element_unknown', $object->element), 'warnings'); |
@@ -764,7 +870,9 @@ discard block |
||
764 | 870 | $pdf->SetCreator("Dolibarr ".DOL_VERSION); |
765 | 871 | $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); |
766 | 872 | $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("subtotalRecap")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); |
767 | - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
873 | + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { |
|
874 | + $pdf->SetCompression(false); |
|
875 | + } |
|
768 | 876 | |
769 | 877 | $pdf->SetMargins($objmarge->marge_gauche, $objmarge->marge_haute, $objmarge->marge_droite); // Left, Top, Right |
770 | 878 | |
@@ -774,7 +882,9 @@ discard block |
||
774 | 882 | |
775 | 883 | // New page |
776 | 884 | $pdf->AddPage(); |
777 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
885 | + if (! empty($tplidx)) { |
|
886 | + $pdf->useTemplate($tplidx); |
|
887 | + } |
|
778 | 888 | $pagenb++; |
779 | 889 | |
780 | 890 | |
@@ -830,8 +940,10 @@ discard block |
||
830 | 940 | { |
831 | 941 | $TTot['TTotal_tva_multicurrency'][$tx] += $amount; |
832 | 942 | } |
943 | + } else { |
|
944 | + $pdf->SetFont('','', $default_font_size - 1); |
|
833 | 945 | } |
834 | - else $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage |
|
946 | + // Into loop to work with multipage |
|
835 | 947 | |
836 | 948 | $pdf->SetTextColor(0,0,0); |
837 | 949 | |
@@ -853,9 +965,11 @@ discard block |
||
853 | 965 | $pdf->startTransaction(); |
854 | 966 | $pdf->writeHTMLCell($posx_options-$posx_designation-$decalage, 3, $posx_designation+$decalage, $curY, $outputlangs->convToOutputCharset($label), 0, 1, false, true, 'J',true); |
855 | 967 | $pageposafter=$pdf->getPage(); |
856 | - if ($pageposafter > $pageposbefore) // There is a pagebreak |
|
968 | + if ($pageposafter > $pageposbefore) { |
|
969 | + // There is a pagebreak |
|
857 | 970 | { |
858 | 971 | $pdf->rollbackTransaction(true); |
972 | + } |
|
859 | 973 | $pageposafter=$pageposbefore; |
860 | 974 | //print $pageposafter.'-'.$pageposbefore;exit; |
861 | 975 | $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
@@ -864,23 +978,27 @@ discard block |
||
864 | 978 | $pageposafter=$pdf->getPage(); |
865 | 979 | $posyafter=$pdf->GetY(); |
866 | 980 | //var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit; |
867 | - if ($posyafter > ($objmarge->page_hauteur - ($heightforfooter+$heightforinfotot))) // There is no space left for total+free text |
|
981 | + if ($posyafter > ($objmarge->page_hauteur - ($heightforfooter+$heightforinfotot))) { |
|
982 | + // There is no space left for total+free text |
|
868 | 983 | { |
869 | 984 | if ($i == ($nblignes-1)) // No more lines, and no space left to show total, so we create a new page |
870 | 985 | { |
871 | 986 | $pdf->AddPage('','',true); |
872 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
873 | - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) self::pagehead($objmarge, $pdf, $object, 0, $outputlangs); |
|
987 | + } |
|
988 | + if (! empty($tplidx)) { |
|
989 | + $pdf->useTemplate($tplidx); |
|
990 | + } |
|
991 | + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { |
|
992 | + self::pagehead($objmarge, $pdf, $object, 0, $outputlangs); |
|
993 | + } |
|
874 | 994 | $pdf->setPage($pageposafter+1); |
875 | 995 | } |
876 | - } |
|
877 | - else |
|
996 | + } else |
|
878 | 997 | { |
879 | 998 | // We found a page break |
880 | 999 | $showpricebeforepagebreak=0; |
881 | 1000 | } |
882 | - } |
|
883 | - else // No pagebreak |
|
1001 | + } else // No pagebreak |
|
884 | 1002 | { |
885 | 1003 | $pdf->commitTransaction(); |
886 | 1004 | } |
@@ -920,8 +1038,7 @@ discard block |
||
920 | 1038 | if ($pagenb == 1) |
921 | 1039 | { |
922 | 1040 | self::tableau($objmarge, $pdf, $posx_designation, $posx_options, $posx_montant, $tab_top, $objmarge->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code); |
923 | - } |
|
924 | - else |
|
1041 | + } else |
|
925 | 1042 | { |
926 | 1043 | self::tableau($objmarge, $pdf, $posx_designation, $posx_options, $posx_montant, $tab_top_newpage, $objmarge->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code); |
927 | 1044 | } |
@@ -929,7 +1046,9 @@ discard block |
||
929 | 1046 | $pagenb++; |
930 | 1047 | $pdf->setPage($pagenb); |
931 | 1048 | $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
932 | - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) self::pagehead($objmarge, $pdf, $object, 0, $outputlangs); |
|
1049 | + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { |
|
1050 | + self::pagehead($objmarge, $pdf, $object, 0, $outputlangs); |
|
1051 | + } |
|
933 | 1052 | } |
934 | 1053 | } |
935 | 1054 | } |
@@ -939,8 +1058,7 @@ discard block |
||
939 | 1058 | { |
940 | 1059 | self::tableau($objmarge, $pdf, $posx_designation, $posx_options, $posx_montant, $tab_top, $objmarge->page_hauteur - $tab_top - $heightforinfotot - $heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code); |
941 | 1060 | $bottomlasttab=$objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1; |
942 | - } |
|
943 | - else |
|
1061 | + } else |
|
944 | 1062 | { |
945 | 1063 | self::tableau($objmarge, $pdf, $posx_designation, $posx_options, $posx_montant, $tab_top_newpage, $objmarge->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfooter, 0, $outputlangs, $hidetop, 0, $object->multicurrency_code); |
946 | 1064 | $bottomlasttab=$objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1; |
@@ -954,7 +1072,9 @@ discard block |
||
954 | 1072 | |
955 | 1073 | $pagecount = self::concat($outputlangs, array($origin_file, $file), $origin_file); |
956 | 1074 | |
957 | - if (empty($conf->global->SUBTOTAL_KEEP_RECAP_FILE)) unlink($file); |
|
1075 | + if (empty($conf->global->SUBTOTAL_KEEP_RECAP_FILE)) { |
|
1076 | + unlink($file); |
|
1077 | + } |
|
958 | 1078 | } |
959 | 1079 | |
960 | 1080 | private static function printLevel($objmarge, $pdf, $line, $curY, $posx_designation) |
@@ -997,8 +1117,7 @@ discard block |
||
997 | 1117 | { |
998 | 1118 | $height=pdf_getHeightForLogo($logo); |
999 | 1119 | $pdf->Image($logo, $objmarge->marge_gauche, $posy, 0, $height); // width=0 (auto) |
1000 | - } |
|
1001 | - else |
|
1120 | + } else |
|
1002 | 1121 | { |
1003 | 1122 | $pdf->SetTextColor(200,0,0); |
1004 | 1123 | $pdf->SetFont('','B',$default_font_size - 2); |
@@ -1007,8 +1126,7 @@ discard block |
||
1007 | 1126 | } |
1008 | 1127 | |
1009 | 1128 | $posy+=35; |
1010 | - } |
|
1011 | - else |
|
1129 | + } else |
|
1012 | 1130 | { |
1013 | 1131 | $text=$mysoc->name; |
1014 | 1132 | $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); |
@@ -1022,9 +1140,13 @@ discard block |
||
1022 | 1140 | $pdf->SetXY($objmarge->marge_gauche,$posy); |
1023 | 1141 | |
1024 | 1142 | $key = 'subtotalPropalTitle'; |
1025 | - if ($object->element == 'commande') $key = 'subtotalCommandeTitle'; |
|
1026 | - elseif ($object->element == 'facture') $key = 'subtotalInvoiceTitle'; |
|
1027 | - elseif ($object->element == 'facturerec') $key = 'subtotalInvoiceTitle'; |
|
1143 | + if ($object->element == 'commande') { |
|
1144 | + $key = 'subtotalCommandeTitle'; |
|
1145 | + } elseif ($object->element == 'facture') { |
|
1146 | + $key = 'subtotalInvoiceTitle'; |
|
1147 | + } elseif ($object->element == 'facturerec') { |
|
1148 | + $key = 'subtotalInvoiceTitle'; |
|
1149 | + } |
|
1028 | 1150 | |
1029 | 1151 | $pdf->MultiCell(150, 4, $outputlangs->transnoentities($key, $object->ref, $object->thirdparty->name), '', 'L'); |
1030 | 1152 | |
@@ -1059,7 +1181,9 @@ discard block |
||
1059 | 1181 | |
1060 | 1182 | // Force to disable hidetop and hidebottom |
1061 | 1183 | $hidebottom=0; |
1062 | - if ($hidetop) $hidetop=-1; |
|
1184 | + if ($hidetop) { |
|
1185 | + $hidetop=-1; |
|
1186 | + } |
|
1063 | 1187 | |
1064 | 1188 | $currency = !empty($currency) ? $currency : $conf->currency; |
1065 | 1189 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
@@ -1074,7 +1198,9 @@ discard block |
||
1074 | 1198 | $pdf->SetXY($objmarge->page_largeur - $objmarge->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4.5); |
1075 | 1199 | $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); |
1076 | 1200 | |
1077 | - if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($objmarge->marge_gauche, $tab_top, $objmarge->page_largeur-$objmarge->marge_droite-$objmarge->marge_gauche, 8, 'F', null, explode(',',$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); |
|
1201 | + if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) { |
|
1202 | + $pdf->Rect($objmarge->marge_gauche, $tab_top, $objmarge->page_largeur-$objmarge->marge_droite-$objmarge->marge_gauche, 8, 'F', null, explode(',',$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); |
|
1203 | + } |
|
1078 | 1204 | |
1079 | 1205 | |
1080 | 1206 | $pdf->line($objmarge->marge_gauche, $tab_top, $objmarge->page_largeur-$objmarge->marge_droite, $tab_top); // line prend une position y en 2eme param et 4eme param |
@@ -1087,8 +1213,7 @@ discard block |
||
1087 | 1213 | $pdf->MultiCell($objmarge->page_largeur - $objmarge->marge_droite - $posx_montant,2, $outputlangs->transnoentities("Amount"),'','R'); |
1088 | 1214 | |
1089 | 1215 | $pdf->line($objmarge->marge_gauche, $tab_top+8, $objmarge->page_largeur-$objmarge->marge_droite, $tab_top+8); // line prend une position y en 2eme param et 4eme param |
1090 | - } |
|
1091 | - else |
|
1216 | + } else |
|
1092 | 1217 | { |
1093 | 1218 | $pdf->line($objmarge->marge_gauche, $tab_top-2, $objmarge->page_largeur-$objmarge->marge_droite, $tab_top-2); // line prend une position y en 2eme param et 4eme param |
1094 | 1219 | } |
@@ -1109,10 +1234,12 @@ discard block |
||
1109 | 1234 | |
1110 | 1235 | // Tableau total |
1111 | 1236 | $col1x = 120; $col2x = 170; |
1112 | - if ($objmarge->page_largeur < 210) // To work with US executive format |
|
1237 | + if ($objmarge->page_largeur < 210) { |
|
1238 | + // To work with US executive format |
|
1113 | 1239 | { |
1114 | 1240 | $col2x-=20; |
1115 | 1241 | } |
1242 | + } |
|
1116 | 1243 | $largcol2 = ($objmarge->page_largeur - $objmarge->marge_droite - $col2x); |
1117 | 1244 | |
1118 | 1245 | $useborder=0; |
@@ -1134,9 +1261,11 @@ discard block |
||
1134 | 1261 | $atleastoneratenotnull=0; |
1135 | 1262 | foreach($TTot['TTotal_tva'] as $tvakey => $tvaval) |
1136 | 1263 | { |
1137 | - if ($tvakey != 0) // On affiche pas taux 0 |
|
1264 | + if ($tvakey != 0) { |
|
1265 | + // On affiche pas taux 0 |
|
1138 | 1266 | { |
1139 | 1267 | $atleastoneratenotnull++; |
1268 | + } |
|
1140 | 1269 | |
1141 | 1270 | $index++; |
1142 | 1271 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
@@ -1189,9 +1318,13 @@ discard block |
||
1189 | 1318 | */ |
1190 | 1319 | private static function printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0) |
1191 | 1320 | { |
1192 | - if (empty($hidetop) || $hidetop==-1) $pdf->line($x, $y, $x+$l, $y); |
|
1321 | + if (empty($hidetop) || $hidetop==-1) { |
|
1322 | + $pdf->line($x, $y, $x+$l, $y); |
|
1323 | + } |
|
1193 | 1324 | $pdf->line($x+$l, $y, $x+$l, $y+$h); |
1194 | - if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h); |
|
1325 | + if (empty($hidebottom)) { |
|
1326 | + $pdf->line($x+$l, $y+$h, $x, $y+$h); |
|
1327 | + } |
|
1195 | 1328 | $pdf->line($x, $y+$h, $x, $y); |
1196 | 1329 | } |
1197 | 1330 | |
@@ -1200,7 +1333,9 @@ discard block |
||
1200 | 1333 | { |
1201 | 1334 | global $conf; |
1202 | 1335 | |
1203 | - if (empty($fileoutput)) $fileoutput = $file[0]; |
|
1336 | + if (empty($fileoutput)) { |
|
1337 | + $fileoutput = $file[0]; |
|
1338 | + } |
|
1204 | 1339 | |
1205 | 1340 | $pdf=pdf_getInstance(); |
1206 | 1341 | if (class_exists('TCPDF')) |
@@ -1210,7 +1345,9 @@ discard block |
||
1210 | 1345 | } |
1211 | 1346 | $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
1212 | 1347 | |
1213 | - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
1348 | + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { |
|
1349 | + $pdf->SetCompression(false); |
|
1350 | + } |
|
1214 | 1351 | |
1215 | 1352 | |
1216 | 1353 | foreach($files as $file) |
@@ -1226,7 +1363,9 @@ discard block |
||
1226 | 1363 | } |
1227 | 1364 | |
1228 | 1365 | $pdf->Output($fileoutput,'F'); |
1229 | - if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
1366 | + if (! empty($conf->global->MAIN_UMASK)) { |
|
1367 | + @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
1368 | + } |
|
1230 | 1369 | |
1231 | 1370 | return $pagecount; |
1232 | 1371 | } |
@@ -1239,7 +1378,9 @@ discard block |
||
1239 | 1378 | */ |
1240 | 1379 | public static function hasNcTitle(&$line) |
1241 | 1380 | { |
1242 | - if(isset($line->has_nc_title)) return $line->has_nc_title; |
|
1381 | + if(isset($line->has_nc_title)) { |
|
1382 | + return $line->has_nc_title; |
|
1383 | + } |
|
1243 | 1384 | |
1244 | 1385 | $TTitle = self::getAllTitleFromLine($line); |
1245 | 1386 | foreach ($TTitle as &$line_title) |
@@ -1264,7 +1405,9 @@ discard block |
||
1264 | 1405 | public static function getTitleLabel($line) |
1265 | 1406 | { |
1266 | 1407 | $title = $line->label; |
1267 | - if (empty($title)) $title = !empty($line->description) ? $line->description : $line->desc; |
|
1408 | + if (empty($title)) { |
|
1409 | + $title = !empty($line->description) ? $line->description : $line->desc; |
|
1410 | + } |
|
1268 | 1411 | return $title; |
1269 | 1412 | } |
1270 | 1413 | } |
@@ -31,170 +31,170 @@ discard block |
||
31 | 31 | class modSubtotal extends DolibarrModules |
32 | 32 | { |
33 | 33 | |
34 | - /** |
|
35 | - * Constructor. Define names, constants, directories, boxes, permissions |
|
36 | - * |
|
37 | - * @param DoliDB $db Database handler |
|
38 | - */ |
|
34 | + /** |
|
35 | + * Constructor. Define names, constants, directories, boxes, permissions |
|
36 | + * |
|
37 | + * @param DoliDB $db Database handler |
|
38 | + */ |
|
39 | 39 | |
40 | - public function __construct($db) |
|
41 | - { |
|
42 | - global $langs, $conf; |
|
40 | + public function __construct($db) |
|
41 | + { |
|
42 | + global $langs, $conf; |
|
43 | 43 | |
44 | - $this->db = $db; |
|
44 | + $this->db = $db; |
|
45 | 45 | |
46 | 46 | $this->editor_name = 'ATM-Consulting'; |
47 | - // Id for module (must be unique). |
|
48 | - // Use a free id here |
|
49 | - // (See in Home -> System information -> Dolibarr for list of used modules id). |
|
50 | - $this->numero = 104777; // 104000 to 104999 for ATM CONSULTING |
|
51 | - // Key text used to identify module (for permissions, menus, etc...) |
|
52 | - $this->rights_class = 'subtotal'; |
|
47 | + // Id for module (must be unique). |
|
48 | + // Use a free id here |
|
49 | + // (See in Home -> System information -> Dolibarr for list of used modules id). |
|
50 | + $this->numero = 104777; // 104000 to 104999 for ATM CONSULTING |
|
51 | + // Key text used to identify module (for permissions, menus, etc...) |
|
52 | + $this->rights_class = 'subtotal'; |
|
53 | 53 | |
54 | - // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' |
|
55 | - // It is used to group modules in module setup page |
|
56 | - $this->family = "technic"; |
|
57 | - // Module label (no space allowed) |
|
58 | - // used if translation string 'ModuleXXXName' not found |
|
59 | - // (where XXX is value of numeric property 'numero' of module) |
|
60 | - $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
61 | - // Module description |
|
62 | - // used if translation string 'ModuleXXXDesc' not found |
|
63 | - // (where XXX is value of numeric property 'numero' of module) |
|
64 | - $this->description = "Module permettant l'ajout de sous-totaux et sous-totaux intermédiaires et le déplacement d'une ligne aisée de l'un dans l'autre"; |
|
65 | - // Possible values for version are: 'development', 'experimental' or version |
|
66 | - $this->version = '3.1.0'; |
|
67 | - // Key used in llx_const table to save module status enabled/disabled |
|
68 | - // (where MYMODULE is value of property name of module in uppercase) |
|
69 | - $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name); |
|
70 | - // Where to store the module in setup page |
|
71 | - // (0=common,1=interface,2=others,3=very specific) |
|
72 | - $this->special = 2; |
|
73 | - // Name of image file used for this module. |
|
74 | - // If file is in theme/yourtheme/img directory under name object_pictovalue.png |
|
75 | - // use this->picto='pictovalue' |
|
76 | - // If file is in module/img directory under name object_pictovalue.png |
|
77 | - // use this->picto='pictovalue@module' |
|
78 | - $this->picto = 'subtotal@subtotal'; // mypicto@titre |
|
79 | - // Defined all module parts (triggers, login, substitutions, menus, css, etc...) |
|
80 | - // for default path (eg: /titre/core/xxxxx) (0=disable, 1=enable) |
|
81 | - // for specific path of parts (eg: /titre/core/modules/barcode) |
|
82 | - // for specific css file (eg: /titre/css/titre.css.php) |
|
83 | - $this->module_parts = array( |
|
84 | - // Set this to 1 if module has its own trigger directory |
|
85 | - 'triggers' => 1, |
|
86 | - // Set this to 1 if module has its own login method directory |
|
87 | - //'login' => 0, |
|
88 | - // Set this to 1 if module has its own substitution function file |
|
89 | - //'substitutions' => 0, |
|
90 | - // Set this to 1 if module has its own menus handler directory |
|
91 | - //'menus' => 0, |
|
92 | - // Set this to 1 if module has its own barcode directory |
|
93 | - //'barcode' => 0, |
|
94 | - // Set this to 1 if module has its own models directory |
|
95 | - 'models' => 1, |
|
96 | - // Set this to relative path of css if module has its own css file |
|
97 | - //'css' => '/titre/css/mycss.css.php', |
|
98 | - // Set here all hooks context managed by module |
|
99 | - 'hooks' => array('invoicecard', 'invoicesuppliercard','propalcard', 'supplier_proposalcard', 'ordercard', 'ordersuppliercard','odtgeneration','orderstoinvoice','admin','invoicereccard') |
|
100 | - // Set here all workflow context managed by module |
|
101 | - //'workflow' => array('order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE')) |
|
102 | - ); |
|
54 | + // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' |
|
55 | + // It is used to group modules in module setup page |
|
56 | + $this->family = "technic"; |
|
57 | + // Module label (no space allowed) |
|
58 | + // used if translation string 'ModuleXXXName' not found |
|
59 | + // (where XXX is value of numeric property 'numero' of module) |
|
60 | + $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
61 | + // Module description |
|
62 | + // used if translation string 'ModuleXXXDesc' not found |
|
63 | + // (where XXX is value of numeric property 'numero' of module) |
|
64 | + $this->description = "Module permettant l'ajout de sous-totaux et sous-totaux intermédiaires et le déplacement d'une ligne aisée de l'un dans l'autre"; |
|
65 | + // Possible values for version are: 'development', 'experimental' or version |
|
66 | + $this->version = '3.1.0'; |
|
67 | + // Key used in llx_const table to save module status enabled/disabled |
|
68 | + // (where MYMODULE is value of property name of module in uppercase) |
|
69 | + $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name); |
|
70 | + // Where to store the module in setup page |
|
71 | + // (0=common,1=interface,2=others,3=very specific) |
|
72 | + $this->special = 2; |
|
73 | + // Name of image file used for this module. |
|
74 | + // If file is in theme/yourtheme/img directory under name object_pictovalue.png |
|
75 | + // use this->picto='pictovalue' |
|
76 | + // If file is in module/img directory under name object_pictovalue.png |
|
77 | + // use this->picto='pictovalue@module' |
|
78 | + $this->picto = 'subtotal@subtotal'; // mypicto@titre |
|
79 | + // Defined all module parts (triggers, login, substitutions, menus, css, etc...) |
|
80 | + // for default path (eg: /titre/core/xxxxx) (0=disable, 1=enable) |
|
81 | + // for specific path of parts (eg: /titre/core/modules/barcode) |
|
82 | + // for specific css file (eg: /titre/css/titre.css.php) |
|
83 | + $this->module_parts = array( |
|
84 | + // Set this to 1 if module has its own trigger directory |
|
85 | + 'triggers' => 1, |
|
86 | + // Set this to 1 if module has its own login method directory |
|
87 | + //'login' => 0, |
|
88 | + // Set this to 1 if module has its own substitution function file |
|
89 | + //'substitutions' => 0, |
|
90 | + // Set this to 1 if module has its own menus handler directory |
|
91 | + //'menus' => 0, |
|
92 | + // Set this to 1 if module has its own barcode directory |
|
93 | + //'barcode' => 0, |
|
94 | + // Set this to 1 if module has its own models directory |
|
95 | + 'models' => 1, |
|
96 | + // Set this to relative path of css if module has its own css file |
|
97 | + //'css' => '/titre/css/mycss.css.php', |
|
98 | + // Set here all hooks context managed by module |
|
99 | + 'hooks' => array('invoicecard', 'invoicesuppliercard','propalcard', 'supplier_proposalcard', 'ordercard', 'ordersuppliercard','odtgeneration','orderstoinvoice','admin','invoicereccard') |
|
100 | + // Set here all workflow context managed by module |
|
101 | + //'workflow' => array('order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE')) |
|
102 | + ); |
|
103 | 103 | |
104 | - // Data directories to create when module is enabled. |
|
105 | - // Example: this->dirs = array("/titre/temp"); |
|
106 | - $this->dirs = array(); |
|
104 | + // Data directories to create when module is enabled. |
|
105 | + // Example: this->dirs = array("/titre/temp"); |
|
106 | + $this->dirs = array(); |
|
107 | 107 | |
108 | - // Config pages. Put here list of php pages |
|
109 | - // stored into titre/admin directory, used to setup module. |
|
110 | - $this->config_page_url = array("subtotal_setup.php@subtotal"); |
|
108 | + // Config pages. Put here list of php pages |
|
109 | + // stored into titre/admin directory, used to setup module. |
|
110 | + $this->config_page_url = array("subtotal_setup.php@subtotal"); |
|
111 | 111 | |
112 | - // Dependencies |
|
113 | - // List of modules id that must be enabled if this module is enabled |
|
114 | - $this->depends = array(); |
|
112 | + // Dependencies |
|
113 | + // List of modules id that must be enabled if this module is enabled |
|
114 | + $this->depends = array(); |
|
115 | 115 | |
116 | 116 | $this->conflictwith=array('modMilestone'); |
117 | - // List of modules id to disable if this one is disabled |
|
118 | - $this->requiredby = array(); |
|
119 | - // Minimum version of PHP required by module |
|
120 | - $this->phpmin = array(5, 3); |
|
121 | - // Minimum version of Dolibarr required by module |
|
122 | - $this->need_dolibarr_version = array(3, 2); |
|
123 | - $this->langfiles = array("subtotal@subtotal"); // langfiles@titre |
|
124 | - // Constants |
|
125 | - // List of particular constants to add when module is enabled |
|
126 | - // (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive) |
|
127 | - // Example: |
|
128 | - $this->const = array( |
|
129 | - 0=>array( |
|
130 | - 'SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES', |
|
131 | - 'chaine', |
|
132 | - 'I', |
|
133 | - 'Définit le style (B : gras, I : Italique, U : Souligné) des sous titres lorsque le détail des lignes et des ensembles est caché', |
|
134 | - 1 |
|
135 | - ) |
|
117 | + // List of modules id to disable if this one is disabled |
|
118 | + $this->requiredby = array(); |
|
119 | + // Minimum version of PHP required by module |
|
120 | + $this->phpmin = array(5, 3); |
|
121 | + // Minimum version of Dolibarr required by module |
|
122 | + $this->need_dolibarr_version = array(3, 2); |
|
123 | + $this->langfiles = array("subtotal@subtotal"); // langfiles@titre |
|
124 | + // Constants |
|
125 | + // List of particular constants to add when module is enabled |
|
126 | + // (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive) |
|
127 | + // Example: |
|
128 | + $this->const = array( |
|
129 | + 0=>array( |
|
130 | + 'SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES', |
|
131 | + 'chaine', |
|
132 | + 'I', |
|
133 | + 'Définit le style (B : gras, I : Italique, U : Souligné) des sous titres lorsque le détail des lignes et des ensembles est caché', |
|
134 | + 1 |
|
135 | + ) |
|
136 | 136 | ,1=>array('SUBTOTAL_ALLOW_ADD_BLOCK', 'chaine', '1', 'Permet l\'ajout de titres et sous-totaux') |
137 | 137 | ,2=>array('SUBTOTAL_ALLOW_EDIT_BLOCK', 'chaine', '1', 'Permet de modifier titres et sous-totaux') |
138 | 138 | ,3=>array('SUBTOTAL_ALLOW_REMOVE_BLOCK', 'chaine', '1', 'Permet de supprimer les titres et sous-totaux') |
139 | 139 | ,4=>array('SUBTOTAL_TITLE_STYLE', 'chaine', 'BU') |
140 | 140 | ,5=>array('SUBTOTAL_SUBTOTAL_STYLE', 'chaine', 'B') |
141 | - // 1=>array( |
|
142 | - // 'MYMODULE_MYNEWCONST2', |
|
143 | - // 'chaine', |
|
144 | - // 'myvalue', |
|
145 | - // 'This is another constant to add', |
|
146 | - // 0 |
|
147 | - // ) |
|
148 | - ); |
|
141 | + // 1=>array( |
|
142 | + // 'MYMODULE_MYNEWCONST2', |
|
143 | + // 'chaine', |
|
144 | + // 'myvalue', |
|
145 | + // 'This is another constant to add', |
|
146 | + // 0 |
|
147 | + // ) |
|
148 | + ); |
|
149 | 149 | |
150 | 150 | |
151 | 151 | |
152 | 152 | |
153 | - // Array to add new pages in new tabs |
|
154 | - // Example: |
|
155 | - $this->tabs = array( |
|
156 | - // // To add a new tab identified by code tabname1 |
|
157 | - // 'objecttype:+tabname1:Title1:langfile@titre:$user->rights->titre->read:/titre/mynewtab1.php?id=__ID__', |
|
158 | - // // To add another new tab identified by code tabname2 |
|
159 | - // 'objecttype:+tabname2:Title2:langfile@titre:$user->rights->othermodule->read:/titre/mynewtab2.php?id=__ID__', |
|
160 | - // // To remove an existing tab identified by code tabname |
|
161 | - // 'objecttype:-tabname' |
|
162 | - ); |
|
163 | - // where objecttype can be |
|
164 | - // 'thirdparty' to add a tab in third party view |
|
165 | - // 'intervention' to add a tab in intervention view |
|
166 | - // 'order_supplier' to add a tab in supplier order view |
|
167 | - // 'invoice_supplier' to add a tab in supplier invoice view |
|
168 | - // 'invoice' to add a tab in customer invoice view |
|
169 | - // 'order' to add a tab in customer order view |
|
170 | - // 'product' to add a tab in product view |
|
171 | - // 'stock' to add a tab in stock view |
|
172 | - // 'propal' to add a tab in propal view |
|
173 | - // 'member' to add a tab in fundation member view |
|
174 | - // 'contract' to add a tab in contract view |
|
175 | - // 'user' to add a tab in user view |
|
176 | - // 'group' to add a tab in group view |
|
177 | - // 'contact' to add a tab in contact view |
|
178 | - // 'categories_x' to add a tab in category view |
|
179 | - // (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) |
|
180 | - // Dictionnaries |
|
181 | - if (! isset($conf->subtotal->enabled)) { |
|
182 | - $conf->subtotal=new stdClass(); |
|
183 | - $conf->subtotal->enabled = 0; |
|
184 | - } |
|
185 | - $this->dictionaries = array( |
|
153 | + // Array to add new pages in new tabs |
|
154 | + // Example: |
|
155 | + $this->tabs = array( |
|
156 | + // // To add a new tab identified by code tabname1 |
|
157 | + // 'objecttype:+tabname1:Title1:langfile@titre:$user->rights->titre->read:/titre/mynewtab1.php?id=__ID__', |
|
158 | + // // To add another new tab identified by code tabname2 |
|
159 | + // 'objecttype:+tabname2:Title2:langfile@titre:$user->rights->othermodule->read:/titre/mynewtab2.php?id=__ID__', |
|
160 | + // // To remove an existing tab identified by code tabname |
|
161 | + // 'objecttype:-tabname' |
|
162 | + ); |
|
163 | + // where objecttype can be |
|
164 | + // 'thirdparty' to add a tab in third party view |
|
165 | + // 'intervention' to add a tab in intervention view |
|
166 | + // 'order_supplier' to add a tab in supplier order view |
|
167 | + // 'invoice_supplier' to add a tab in supplier invoice view |
|
168 | + // 'invoice' to add a tab in customer invoice view |
|
169 | + // 'order' to add a tab in customer order view |
|
170 | + // 'product' to add a tab in product view |
|
171 | + // 'stock' to add a tab in stock view |
|
172 | + // 'propal' to add a tab in propal view |
|
173 | + // 'member' to add a tab in fundation member view |
|
174 | + // 'contract' to add a tab in contract view |
|
175 | + // 'user' to add a tab in user view |
|
176 | + // 'group' to add a tab in group view |
|
177 | + // 'contact' to add a tab in contact view |
|
178 | + // 'categories_x' to add a tab in category view |
|
179 | + // (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) |
|
180 | + // Dictionnaries |
|
181 | + if (! isset($conf->subtotal->enabled)) { |
|
182 | + $conf->subtotal=new stdClass(); |
|
183 | + $conf->subtotal->enabled = 0; |
|
184 | + } |
|
185 | + $this->dictionaries = array( |
|
186 | 186 | 'langs'=>'subtotal@subtotal', |
187 | - 'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'), // List of tables we want to see into dictonnary editor |
|
188 | - 'tablib'=>array($langs->trans('subtotalFreeLineDictionary')), // Label of tables |
|
189 | - 'tabsql'=>array('SELECT f.rowid as rowid, f.label, f.content, f.entity, f.active FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text as f WHERE f.entity='.$conf->entity), // Request to select fields |
|
190 | - 'tabsqlsort'=>array('label ASC'), // Sort order |
|
191 | - 'tabfield'=>array('label,content'), // List of fields (result of select to show dictionary) |
|
192 | - 'tabfieldvalue'=>array('label,content'), // List of fields (list of fields to edit a record) |
|
193 | - 'tabfieldinsert'=>array('label,content,entity'), // List of fields (list of fields for insert) |
|
194 | - 'tabrowid'=>array('rowid'), // Name of columns with primary key (try to always name it 'rowid') |
|
195 | - 'tabcond'=>array($conf->subtotal->enabled) |
|
187 | + 'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'), // List of tables we want to see into dictonnary editor |
|
188 | + 'tablib'=>array($langs->trans('subtotalFreeLineDictionary')), // Label of tables |
|
189 | + 'tabsql'=>array('SELECT f.rowid as rowid, f.label, f.content, f.entity, f.active FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text as f WHERE f.entity='.$conf->entity), // Request to select fields |
|
190 | + 'tabsqlsort'=>array('label ASC'), // Sort order |
|
191 | + 'tabfield'=>array('label,content'), // List of fields (result of select to show dictionary) |
|
192 | + 'tabfieldvalue'=>array('label,content'), // List of fields (list of fields to edit a record) |
|
193 | + 'tabfieldinsert'=>array('label,content,entity'), // List of fields (list of fields for insert) |
|
194 | + 'tabrowid'=>array('rowid'), // Name of columns with primary key (try to always name it 'rowid') |
|
195 | + 'tabcond'=>array($conf->subtotal->enabled) |
|
196 | 196 | ); |
197 | - /* Example: |
|
197 | + /* Example: |
|
198 | 198 | // This is to avoid warnings |
199 | 199 | if (! isset($conf->titre->enabled)) $conf->titre->enabled=0; |
200 | 200 | $this->dictionnaries=array( |
@@ -235,223 +235,223 @@ discard block |
||
235 | 235 | ); |
236 | 236 | */ |
237 | 237 | |
238 | - // Boxes |
|
239 | - // Add here list of php file(s) stored in core/boxes that contains class to show a box. |
|
240 | - $this->boxes = array(); // Boxes list |
|
238 | + // Boxes |
|
239 | + // Add here list of php file(s) stored in core/boxes that contains class to show a box. |
|
240 | + $this->boxes = array(); // Boxes list |
|
241 | 241 | |
242 | - /* |
|
242 | + /* |
|
243 | 243 | $this->boxes[$r][1] = "myboxb.php"; |
244 | 244 | $r++; |
245 | 245 | */ |
246 | 246 | |
247 | - // Permissions |
|
248 | - $this->rights = array(); // Permission array used by this module |
|
249 | - $r = 0; |
|
247 | + // Permissions |
|
248 | + $this->rights = array(); // Permission array used by this module |
|
249 | + $r = 0; |
|
250 | 250 | |
251 | - // Add here list of permission defined by |
|
252 | - // an id, a label, a boolean and two constant strings. |
|
253 | - // Example: |
|
254 | - //// Permission id (must not be already used) |
|
255 | - //$this->rights[$r][0] = 2000; |
|
256 | - //// Permission label |
|
257 | - //$this->rights[$r][1] = 'Permision label'; |
|
258 | - //// Permission by default for new user (0/1) |
|
259 | - //$this->rights[$r][3] = 1; |
|
260 | - //// In php code, permission will be checked by test |
|
261 | - //// if ($user->rights->permkey->level1->level2) |
|
262 | - //$this->rights[$r][4] = 'level1'; |
|
263 | - //// In php code, permission will be checked by test |
|
264 | - //// if ($user->rights->permkey->level1->level2) |
|
265 | - //$this->rights[$r][5] = 'level2'; |
|
266 | - //$r++; |
|
267 | - // Main menu entries |
|
268 | - $this->menus = array(); // List of menus to add |
|
269 | - $r = 0; |
|
251 | + // Add here list of permission defined by |
|
252 | + // an id, a label, a boolean and two constant strings. |
|
253 | + // Example: |
|
254 | + //// Permission id (must not be already used) |
|
255 | + //$this->rights[$r][0] = 2000; |
|
256 | + //// Permission label |
|
257 | + //$this->rights[$r][1] = 'Permision label'; |
|
258 | + //// Permission by default for new user (0/1) |
|
259 | + //$this->rights[$r][3] = 1; |
|
260 | + //// In php code, permission will be checked by test |
|
261 | + //// if ($user->rights->permkey->level1->level2) |
|
262 | + //$this->rights[$r][4] = 'level1'; |
|
263 | + //// In php code, permission will be checked by test |
|
264 | + //// if ($user->rights->permkey->level1->level2) |
|
265 | + //$this->rights[$r][5] = 'level2'; |
|
266 | + //$r++; |
|
267 | + // Main menu entries |
|
268 | + $this->menus = array(); // List of menus to add |
|
269 | + $r = 0; |
|
270 | 270 | |
271 | - // Add here entries to declare new menus |
|
272 | - // |
|
273 | - // Example to declare a new Top Menu entry and its Left menu entry: |
|
274 | - //$this->menu[$r]=array( |
|
275 | - // // Put 0 if this is a top menu |
|
276 | - // 'fk_menu'=>0, |
|
277 | - // // This is a Top menu entry |
|
278 | - // 'type'=>'top', |
|
279 | - // 'titre'=>'titre top menu', |
|
280 | - // 'mainmenu'=>'titre', |
|
281 | - // 'leftmenu'=>'titre', |
|
282 | - // 'url'=>'/titre/pagetop.php', |
|
283 | - // // Lang file to use (without .lang) by module. |
|
284 | - // // File must be in langs/code_CODE/ directory. |
|
285 | - // 'langs'=>'mylangfile', |
|
286 | - // 'position'=>100, |
|
287 | - // // Define condition to show or hide menu entry. |
|
288 | - // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
289 | - // 'enabled'=>'$conf->titre->enabled', |
|
290 | - // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
291 | - // // if you want your menu with a permission rules |
|
292 | - // 'perms'=>'1', |
|
293 | - // 'target'=>'', |
|
294 | - // // 0=Menu for internal users, 1=external users, 2=both |
|
295 | - // 'user'=>2 |
|
296 | - //); |
|
297 | - //$r++; |
|
298 | - //$this->menu[$r]=array( |
|
299 | - // // Use r=value where r is index key used for the parent menu entry |
|
300 | - // // (higher parent must be a top menu entry) |
|
301 | - // 'fk_menu'=>'r=0', |
|
302 | - // // This is a Left menu entry |
|
303 | - // 'type'=>'left', |
|
304 | - // 'titre'=>'titre left menu', |
|
305 | - // 'mainmenu'=>'titre', |
|
306 | - // 'leftmenu'=>'titre', |
|
307 | - // 'url'=>'/titre/pagelevel1.php', |
|
308 | - // // Lang file to use (without .lang) by module. |
|
309 | - // // File must be in langs/code_CODE/ directory. |
|
310 | - // 'langs'=>'mylangfile', |
|
311 | - // 'position'=>100, |
|
312 | - // // Define condition to show or hide menu entry. |
|
313 | - // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
314 | - // 'enabled'=>'$conf->titre->enabled', |
|
315 | - // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
316 | - // // if you want your menu with a permission rules |
|
317 | - // 'perms'=>'1', |
|
318 | - // 'target'=>'', |
|
319 | - // // 0=Menu for internal users, 1=external users, 2=both |
|
320 | - // 'user'=>2 |
|
321 | - //); |
|
322 | - //$r++; |
|
323 | - // |
|
324 | - // Example to declare a Left Menu entry into an existing Top menu entry: |
|
325 | - //$this->menu[$r]=array( |
|
326 | - // // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' |
|
327 | - // 'fk_menu'=>'fk_mainmenu=mainmenucode', |
|
328 | - // // This is a Left menu entry |
|
329 | - // 'type'=>'left', |
|
330 | - // 'titre'=>'titre left menu', |
|
331 | - // 'mainmenu'=>'mainmenucode', |
|
332 | - // 'leftmenu'=>'titre', |
|
333 | - // 'url'=>'/titre/pagelevel2.php', |
|
334 | - // // Lang file to use (without .lang) by module. |
|
335 | - // // File must be in langs/code_CODE/ directory. |
|
336 | - // 'langs'=>'mylangfile', |
|
337 | - // 'position'=>100, |
|
338 | - // // Define condition to show or hide menu entry. |
|
339 | - // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
340 | - // // Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
341 | - // 'enabled'=>'$conf->titre->enabled', |
|
342 | - // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
343 | - // // if you want your menu with a permission rules |
|
344 | - // 'perms'=>'1', |
|
345 | - // 'target'=>'', |
|
346 | - // // 0=Menu for internal users, 1=external users, 2=both |
|
347 | - // 'user'=>2 |
|
348 | - //); |
|
349 | - //$r++; |
|
350 | - // Exports |
|
351 | - $r = 1; |
|
271 | + // Add here entries to declare new menus |
|
272 | + // |
|
273 | + // Example to declare a new Top Menu entry and its Left menu entry: |
|
274 | + //$this->menu[$r]=array( |
|
275 | + // // Put 0 if this is a top menu |
|
276 | + // 'fk_menu'=>0, |
|
277 | + // // This is a Top menu entry |
|
278 | + // 'type'=>'top', |
|
279 | + // 'titre'=>'titre top menu', |
|
280 | + // 'mainmenu'=>'titre', |
|
281 | + // 'leftmenu'=>'titre', |
|
282 | + // 'url'=>'/titre/pagetop.php', |
|
283 | + // // Lang file to use (without .lang) by module. |
|
284 | + // // File must be in langs/code_CODE/ directory. |
|
285 | + // 'langs'=>'mylangfile', |
|
286 | + // 'position'=>100, |
|
287 | + // // Define condition to show or hide menu entry. |
|
288 | + // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
289 | + // 'enabled'=>'$conf->titre->enabled', |
|
290 | + // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
291 | + // // if you want your menu with a permission rules |
|
292 | + // 'perms'=>'1', |
|
293 | + // 'target'=>'', |
|
294 | + // // 0=Menu for internal users, 1=external users, 2=both |
|
295 | + // 'user'=>2 |
|
296 | + //); |
|
297 | + //$r++; |
|
298 | + //$this->menu[$r]=array( |
|
299 | + // // Use r=value where r is index key used for the parent menu entry |
|
300 | + // // (higher parent must be a top menu entry) |
|
301 | + // 'fk_menu'=>'r=0', |
|
302 | + // // This is a Left menu entry |
|
303 | + // 'type'=>'left', |
|
304 | + // 'titre'=>'titre left menu', |
|
305 | + // 'mainmenu'=>'titre', |
|
306 | + // 'leftmenu'=>'titre', |
|
307 | + // 'url'=>'/titre/pagelevel1.php', |
|
308 | + // // Lang file to use (without .lang) by module. |
|
309 | + // // File must be in langs/code_CODE/ directory. |
|
310 | + // 'langs'=>'mylangfile', |
|
311 | + // 'position'=>100, |
|
312 | + // // Define condition to show or hide menu entry. |
|
313 | + // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
314 | + // 'enabled'=>'$conf->titre->enabled', |
|
315 | + // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
316 | + // // if you want your menu with a permission rules |
|
317 | + // 'perms'=>'1', |
|
318 | + // 'target'=>'', |
|
319 | + // // 0=Menu for internal users, 1=external users, 2=both |
|
320 | + // 'user'=>2 |
|
321 | + //); |
|
322 | + //$r++; |
|
323 | + // |
|
324 | + // Example to declare a Left Menu entry into an existing Top menu entry: |
|
325 | + //$this->menu[$r]=array( |
|
326 | + // // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' |
|
327 | + // 'fk_menu'=>'fk_mainmenu=mainmenucode', |
|
328 | + // // This is a Left menu entry |
|
329 | + // 'type'=>'left', |
|
330 | + // 'titre'=>'titre left menu', |
|
331 | + // 'mainmenu'=>'mainmenucode', |
|
332 | + // 'leftmenu'=>'titre', |
|
333 | + // 'url'=>'/titre/pagelevel2.php', |
|
334 | + // // Lang file to use (without .lang) by module. |
|
335 | + // // File must be in langs/code_CODE/ directory. |
|
336 | + // 'langs'=>'mylangfile', |
|
337 | + // 'position'=>100, |
|
338 | + // // Define condition to show or hide menu entry. |
|
339 | + // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
340 | + // // Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
341 | + // 'enabled'=>'$conf->titre->enabled', |
|
342 | + // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
343 | + // // if you want your menu with a permission rules |
|
344 | + // 'perms'=>'1', |
|
345 | + // 'target'=>'', |
|
346 | + // // 0=Menu for internal users, 1=external users, 2=both |
|
347 | + // 'user'=>2 |
|
348 | + //); |
|
349 | + //$r++; |
|
350 | + // Exports |
|
351 | + $r = 1; |
|
352 | 352 | |
353 | - // Example: |
|
354 | - //$this->export_code[$r]=$this->rights_class.'_'.$r; |
|
355 | - //// Translation key (used only if key ExportDataset_xxx_z not found) |
|
356 | - //$this->export_label[$r]='CustomersInvoicesAndInvoiceLines'; |
|
357 | - //// Condition to show export in list (ie: '$user->id==3'). |
|
358 | - //// Set to 1 to always show when module is enabled. |
|
359 | - //$this->export_enabled[$r]='1'; |
|
360 | - //$this->export_permission[$r]=array(array("facture","facture","export")); |
|
361 | - //$this->export_fields_array[$r]=array( |
|
362 | - // 's.rowid'=>"IdCompany", |
|
363 | - // 's.nom'=>'CompanyName', |
|
364 | - // 's.address'=>'Address', |
|
365 | - // 's.cp'=>'Zip', |
|
366 | - // 's.ville'=>'Town', |
|
367 | - // 's.fk_pays'=>'Country', |
|
368 | - // 's.tel'=>'Phone', |
|
369 | - // 's.siren'=>'ProfId1', |
|
370 | - // 's.siret'=>'ProfId2', |
|
371 | - // 's.ape'=>'ProfId3', |
|
372 | - // 's.idprof4'=>'ProfId4', |
|
373 | - // 's.code_compta'=>'CustomerAccountancyCode', |
|
374 | - // 's.code_compta_fournisseur'=>'SupplierAccountancyCode', |
|
375 | - // 'f.rowid'=>"InvoiceId", |
|
376 | - // 'f.facnumber'=>"InvoiceRef", |
|
377 | - // 'f.datec'=>"InvoiceDateCreation", |
|
378 | - // 'f.datef'=>"DateInvoice", |
|
379 | - // 'f.total'=>"TotalHT", |
|
380 | - // 'f.total_ttc'=>"TotalTTC", |
|
381 | - // 'f.tva'=>"TotalVAT", |
|
382 | - // 'f.paye'=>"InvoicePaid", |
|
383 | - // 'f.fk_statut'=>'InvoiceStatus', |
|
384 | - // 'f.note'=>"InvoiceNote", |
|
385 | - // 'fd.rowid'=>'LineId', |
|
386 | - // 'fd.description'=>"LineDescription", |
|
387 | - // 'fd.price'=>"LineUnitPrice", |
|
388 | - // 'fd.tva_tx'=>"LineVATRate", |
|
389 | - // 'fd.qty'=>"LineQty", |
|
390 | - // 'fd.total_ht'=>"LineTotalHT", |
|
391 | - // 'fd.total_tva'=>"LineTotalTVA", |
|
392 | - // 'fd.total_ttc'=>"LineTotalTTC", |
|
393 | - // 'fd.date_start'=>"DateStart", |
|
394 | - // 'fd.date_end'=>"DateEnd", |
|
395 | - // 'fd.fk_product'=>'ProductId', |
|
396 | - // 'p.ref'=>'ProductRef' |
|
397 | - //); |
|
398 | - //$this->export_entities_array[$r]=array('s.rowid'=>"company", |
|
399 | - // 's.nom'=>'company', |
|
400 | - // 's.address'=>'company', |
|
401 | - // 's.cp'=>'company', |
|
402 | - // 's.ville'=>'company', |
|
403 | - // 's.fk_pays'=>'company', |
|
404 | - // 's.tel'=>'company', |
|
405 | - // 's.siren'=>'company', |
|
406 | - // 's.siret'=>'company', |
|
407 | - // 's.ape'=>'company', |
|
408 | - // 's.idprof4'=>'company', |
|
409 | - // 's.code_compta'=>'company', |
|
410 | - // 's.code_compta_fournisseur'=>'company', |
|
411 | - // 'f.rowid'=>"invoice", |
|
412 | - // 'f.facnumber'=>"invoice", |
|
413 | - // 'f.datec'=>"invoice", |
|
414 | - // 'f.datef'=>"invoice", |
|
415 | - // 'f.total'=>"invoice", |
|
416 | - // 'f.total_ttc'=>"invoice", |
|
417 | - // 'f.tva'=>"invoice", |
|
418 | - // 'f.paye'=>"invoice", |
|
419 | - // 'f.fk_statut'=>'invoice', |
|
420 | - // 'f.note'=>"invoice", |
|
421 | - // 'fd.rowid'=>'invoice_line', |
|
422 | - // 'fd.description'=>"invoice_line", |
|
423 | - // 'fd.price'=>"invoice_line", |
|
424 | - // 'fd.total_ht'=>"invoice_line", |
|
425 | - // 'fd.total_tva'=>"invoice_line", |
|
426 | - // 'fd.total_ttc'=>"invoice_line", |
|
427 | - // 'fd.tva_tx'=>"invoice_line", |
|
428 | - // 'fd.qty'=>"invoice_line", |
|
429 | - // 'fd.date_start'=>"invoice_line", |
|
430 | - // 'fd.date_end'=>"invoice_line", |
|
431 | - // 'fd.fk_product'=>'product', |
|
432 | - // 'p.ref'=>'product' |
|
433 | - //); |
|
434 | - //$this->export_sql_start[$r] = 'SELECT DISTINCT '; |
|
435 | - //$this->export_sql_end[$r] = ' FROM (' . MAIN_DB_PREFIX . 'facture as f, ' |
|
436 | - // . MAIN_DB_PREFIX . 'facturedet as fd, ' . MAIN_DB_PREFIX . 'societe as s)'; |
|
437 | - //$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX |
|
438 | - // . 'product as p on (fd.fk_product = p.rowid)'; |
|
439 | - //$this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid ' |
|
440 | - // . 'AND f.rowid = fd.fk_facture'; |
|
441 | - //$r++; |
|
442 | - } |
|
353 | + // Example: |
|
354 | + //$this->export_code[$r]=$this->rights_class.'_'.$r; |
|
355 | + //// Translation key (used only if key ExportDataset_xxx_z not found) |
|
356 | + //$this->export_label[$r]='CustomersInvoicesAndInvoiceLines'; |
|
357 | + //// Condition to show export in list (ie: '$user->id==3'). |
|
358 | + //// Set to 1 to always show when module is enabled. |
|
359 | + //$this->export_enabled[$r]='1'; |
|
360 | + //$this->export_permission[$r]=array(array("facture","facture","export")); |
|
361 | + //$this->export_fields_array[$r]=array( |
|
362 | + // 's.rowid'=>"IdCompany", |
|
363 | + // 's.nom'=>'CompanyName', |
|
364 | + // 's.address'=>'Address', |
|
365 | + // 's.cp'=>'Zip', |
|
366 | + // 's.ville'=>'Town', |
|
367 | + // 's.fk_pays'=>'Country', |
|
368 | + // 's.tel'=>'Phone', |
|
369 | + // 's.siren'=>'ProfId1', |
|
370 | + // 's.siret'=>'ProfId2', |
|
371 | + // 's.ape'=>'ProfId3', |
|
372 | + // 's.idprof4'=>'ProfId4', |
|
373 | + // 's.code_compta'=>'CustomerAccountancyCode', |
|
374 | + // 's.code_compta_fournisseur'=>'SupplierAccountancyCode', |
|
375 | + // 'f.rowid'=>"InvoiceId", |
|
376 | + // 'f.facnumber'=>"InvoiceRef", |
|
377 | + // 'f.datec'=>"InvoiceDateCreation", |
|
378 | + // 'f.datef'=>"DateInvoice", |
|
379 | + // 'f.total'=>"TotalHT", |
|
380 | + // 'f.total_ttc'=>"TotalTTC", |
|
381 | + // 'f.tva'=>"TotalVAT", |
|
382 | + // 'f.paye'=>"InvoicePaid", |
|
383 | + // 'f.fk_statut'=>'InvoiceStatus', |
|
384 | + // 'f.note'=>"InvoiceNote", |
|
385 | + // 'fd.rowid'=>'LineId', |
|
386 | + // 'fd.description'=>"LineDescription", |
|
387 | + // 'fd.price'=>"LineUnitPrice", |
|
388 | + // 'fd.tva_tx'=>"LineVATRate", |
|
389 | + // 'fd.qty'=>"LineQty", |
|
390 | + // 'fd.total_ht'=>"LineTotalHT", |
|
391 | + // 'fd.total_tva'=>"LineTotalTVA", |
|
392 | + // 'fd.total_ttc'=>"LineTotalTTC", |
|
393 | + // 'fd.date_start'=>"DateStart", |
|
394 | + // 'fd.date_end'=>"DateEnd", |
|
395 | + // 'fd.fk_product'=>'ProductId', |
|
396 | + // 'p.ref'=>'ProductRef' |
|
397 | + //); |
|
398 | + //$this->export_entities_array[$r]=array('s.rowid'=>"company", |
|
399 | + // 's.nom'=>'company', |
|
400 | + // 's.address'=>'company', |
|
401 | + // 's.cp'=>'company', |
|
402 | + // 's.ville'=>'company', |
|
403 | + // 's.fk_pays'=>'company', |
|
404 | + // 's.tel'=>'company', |
|
405 | + // 's.siren'=>'company', |
|
406 | + // 's.siret'=>'company', |
|
407 | + // 's.ape'=>'company', |
|
408 | + // 's.idprof4'=>'company', |
|
409 | + // 's.code_compta'=>'company', |
|
410 | + // 's.code_compta_fournisseur'=>'company', |
|
411 | + // 'f.rowid'=>"invoice", |
|
412 | + // 'f.facnumber'=>"invoice", |
|
413 | + // 'f.datec'=>"invoice", |
|
414 | + // 'f.datef'=>"invoice", |
|
415 | + // 'f.total'=>"invoice", |
|
416 | + // 'f.total_ttc'=>"invoice", |
|
417 | + // 'f.tva'=>"invoice", |
|
418 | + // 'f.paye'=>"invoice", |
|
419 | + // 'f.fk_statut'=>'invoice', |
|
420 | + // 'f.note'=>"invoice", |
|
421 | + // 'fd.rowid'=>'invoice_line', |
|
422 | + // 'fd.description'=>"invoice_line", |
|
423 | + // 'fd.price'=>"invoice_line", |
|
424 | + // 'fd.total_ht'=>"invoice_line", |
|
425 | + // 'fd.total_tva'=>"invoice_line", |
|
426 | + // 'fd.total_ttc'=>"invoice_line", |
|
427 | + // 'fd.tva_tx'=>"invoice_line", |
|
428 | + // 'fd.qty'=>"invoice_line", |
|
429 | + // 'fd.date_start'=>"invoice_line", |
|
430 | + // 'fd.date_end'=>"invoice_line", |
|
431 | + // 'fd.fk_product'=>'product', |
|
432 | + // 'p.ref'=>'product' |
|
433 | + //); |
|
434 | + //$this->export_sql_start[$r] = 'SELECT DISTINCT '; |
|
435 | + //$this->export_sql_end[$r] = ' FROM (' . MAIN_DB_PREFIX . 'facture as f, ' |
|
436 | + // . MAIN_DB_PREFIX . 'facturedet as fd, ' . MAIN_DB_PREFIX . 'societe as s)'; |
|
437 | + //$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX |
|
438 | + // . 'product as p on (fd.fk_product = p.rowid)'; |
|
439 | + //$this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid ' |
|
440 | + // . 'AND f.rowid = fd.fk_facture'; |
|
441 | + //$r++; |
|
442 | + } |
|
443 | 443 | |
444 | - /** |
|
445 | - * Function called when module is enabled. |
|
446 | - * The init function add constants, boxes, permissions and menus |
|
447 | - * (defined in constructor) into Dolibarr database. |
|
448 | - * It also creates data directories |
|
449 | - * |
|
450 | - * @param string $options Options when enabling module ('', 'noboxes') |
|
451 | - * @return int 1 if OK, 0 if KO |
|
452 | - */ |
|
453 | - public function init($options = '') |
|
454 | - { |
|
444 | + /** |
|
445 | + * Function called when module is enabled. |
|
446 | + * The init function add constants, boxes, permissions and menus |
|
447 | + * (defined in constructor) into Dolibarr database. |
|
448 | + * It also creates data directories |
|
449 | + * |
|
450 | + * @param string $options Options when enabling module ('', 'noboxes') |
|
451 | + * @return int 1 if OK, 0 if KO |
|
452 | + */ |
|
453 | + public function init($options = '') |
|
454 | + { |
|
455 | 455 | global $conf; |
456 | 456 | |
457 | 457 | |
@@ -459,39 +459,39 @@ discard block |
||
459 | 459 | exit("Attention, ce module rentre ne conflit avec le module Jalon/Milestones. Merci de le désactiver auparavant."); |
460 | 460 | } |
461 | 461 | */ |
462 | - $sql = array(); |
|
462 | + $sql = array(); |
|
463 | 463 | |
464 | - $result = $this->loadTables(); |
|
464 | + $result = $this->loadTables(); |
|
465 | 465 | |
466 | 466 | |
467 | - return $this->_init($sql, $options); |
|
468 | - } |
|
467 | + return $this->_init($sql, $options); |
|
468 | + } |
|
469 | 469 | |
470 | - /** |
|
471 | - * Function called when module is disabled. |
|
472 | - * Remove from database constants, boxes and permissions from Dolibarr database. |
|
473 | - * Data directories are not deleted |
|
474 | - * |
|
475 | - * @param string $options Options when enabling module ('', 'noboxes') |
|
476 | - * @return int 1 if OK, 0 if KO |
|
477 | - */ |
|
478 | - public function remove($options = '') |
|
479 | - { |
|
480 | - $sql = array(); |
|
470 | + /** |
|
471 | + * Function called when module is disabled. |
|
472 | + * Remove from database constants, boxes and permissions from Dolibarr database. |
|
473 | + * Data directories are not deleted |
|
474 | + * |
|
475 | + * @param string $options Options when enabling module ('', 'noboxes') |
|
476 | + * @return int 1 if OK, 0 if KO |
|
477 | + */ |
|
478 | + public function remove($options = '') |
|
479 | + { |
|
480 | + $sql = array(); |
|
481 | 481 | |
482 | - return $this->_remove($sql, $options); |
|
483 | - } |
|
482 | + return $this->_remove($sql, $options); |
|
483 | + } |
|
484 | 484 | |
485 | - /** |
|
486 | - * Create tables, keys and data required by module |
|
487 | - * Files llx_table1.sql, llx_table1.key.sql llx_data.sql with create table, create keys |
|
488 | - * and create data commands must be stored in directory /titre/sql/ |
|
489 | - * This function is called by this->init |
|
490 | - * |
|
491 | - * @return int <=0 if KO, >0 if OK |
|
492 | - */ |
|
493 | - private function loadTables() |
|
494 | - { |
|
495 | - return $this->_load_tables('/subtotal/sql/'); |
|
496 | - } |
|
485 | + /** |
|
486 | + * Create tables, keys and data required by module |
|
487 | + * Files llx_table1.sql, llx_table1.key.sql llx_data.sql with create table, create keys |
|
488 | + * and create data commands must be stored in directory /titre/sql/ |
|
489 | + * This function is called by this->init |
|
490 | + * |
|
491 | + * @return int <=0 if KO, >0 if OK |
|
492 | + */ |
|
493 | + private function loadTables() |
|
494 | + { |
|
495 | + return $this->_load_tables('/subtotal/sql/'); |
|
496 | + } |
|
497 | 497 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * \ingroup titre |
24 | 24 | * \brief Description and activation file for module titre |
25 | 25 | */ |
26 | -include_once DOL_DOCUMENT_ROOT . "/core/modules/DolibarrModules.class.php"; |
|
26 | +include_once DOL_DOCUMENT_ROOT."/core/modules/DolibarrModules.class.php"; |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * Description and activation class for module titre |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $this->version = '3.1.0'; |
67 | 67 | // Key used in llx_const table to save module status enabled/disabled |
68 | 68 | // (where MYMODULE is value of property name of module in uppercase) |
69 | - $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name); |
|
69 | + $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
70 | 70 | // Where to store the module in setup page |
71 | 71 | // (0=common,1=interface,2=others,3=very specific) |
72 | 72 | $this->special = 2; |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | // Set this to relative path of css if module has its own css file |
97 | 97 | //'css' => '/titre/css/mycss.css.php', |
98 | 98 | // Set here all hooks context managed by module |
99 | - 'hooks' => array('invoicecard', 'invoicesuppliercard','propalcard', 'supplier_proposalcard', 'ordercard', 'ordersuppliercard','odtgeneration','orderstoinvoice','admin','invoicereccard') |
|
99 | + 'hooks' => array('invoicecard', 'invoicesuppliercard', 'propalcard', 'supplier_proposalcard', 'ordercard', 'ordersuppliercard', 'odtgeneration', 'orderstoinvoice', 'admin', 'invoicereccard') |
|
100 | 100 | // Set here all workflow context managed by module |
101 | 101 | //'workflow' => array('order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE')) |
102 | 102 | ); |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | // List of modules id that must be enabled if this module is enabled |
114 | 114 | $this->depends = array(); |
115 | 115 | |
116 | - $this->conflictwith=array('modMilestone'); |
|
116 | + $this->conflictwith = array('modMilestone'); |
|
117 | 117 | // List of modules id to disable if this one is disabled |
118 | 118 | $this->requiredby = array(); |
119 | 119 | // Minimum version of PHP required by module |
@@ -178,20 +178,20 @@ discard block |
||
178 | 178 | // 'categories_x' to add a tab in category view |
179 | 179 | // (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) |
180 | 180 | // Dictionnaries |
181 | - if (! isset($conf->subtotal->enabled)) { |
|
182 | - $conf->subtotal=new stdClass(); |
|
181 | + if (!isset($conf->subtotal->enabled)) { |
|
182 | + $conf->subtotal = new stdClass(); |
|
183 | 183 | $conf->subtotal->enabled = 0; |
184 | 184 | } |
185 | 185 | $this->dictionaries = array( |
186 | 186 | 'langs'=>'subtotal@subtotal', |
187 | - 'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'), // List of tables we want to see into dictonnary editor |
|
188 | - 'tablib'=>array($langs->trans('subtotalFreeLineDictionary')), // Label of tables |
|
189 | - 'tabsql'=>array('SELECT f.rowid as rowid, f.label, f.content, f.entity, f.active FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text as f WHERE f.entity='.$conf->entity), // Request to select fields |
|
190 | - 'tabsqlsort'=>array('label ASC'), // Sort order |
|
191 | - 'tabfield'=>array('label,content'), // List of fields (result of select to show dictionary) |
|
192 | - 'tabfieldvalue'=>array('label,content'), // List of fields (list of fields to edit a record) |
|
193 | - 'tabfieldinsert'=>array('label,content,entity'), // List of fields (list of fields for insert) |
|
194 | - 'tabrowid'=>array('rowid'), // Name of columns with primary key (try to always name it 'rowid') |
|
187 | + 'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'), // List of tables we want to see into dictonnary editor |
|
188 | + 'tablib'=>array($langs->trans('subtotalFreeLineDictionary')), // Label of tables |
|
189 | + 'tabsql'=>array('SELECT f.rowid as rowid, f.label, f.content, f.entity, f.active FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text as f WHERE f.entity='.$conf->entity), // Request to select fields |
|
190 | + 'tabsqlsort'=>array('label ASC'), // Sort order |
|
191 | + 'tabfield'=>array('label,content'), // List of fields (result of select to show dictionary) |
|
192 | + 'tabfieldvalue'=>array('label,content'), // List of fields (list of fields to edit a record) |
|
193 | + 'tabfieldinsert'=>array('label,content,entity'), // List of fields (list of fields for insert) |
|
194 | + 'tabrowid'=>array('rowid'), // Name of columns with primary key (try to always name it 'rowid') |
|
195 | 195 | 'tabcond'=>array($conf->subtotal->enabled) |
196 | 196 | ); |
197 | 197 | /* Example: |
@@ -81,11 +81,11 @@ discard block |
||
81 | 81 | * @return void |
82 | 82 | */ |
83 | 83 | |
84 | - var $module_number = 104777; |
|
84 | + var $module_number = 104777; |
|
85 | 85 | |
86 | - function formObjectOptions($parameters, &$object, &$action, $hookmanager) |
|
87 | - { |
|
88 | - global $langs,$db,$user, $conf; |
|
86 | + function formObjectOptions($parameters, &$object, &$action, $hookmanager) |
|
87 | + { |
|
88 | + global $langs,$db,$user, $conf; |
|
89 | 89 | |
90 | 90 | $langs->load('subtotal@subtotal'); |
91 | 91 | |
@@ -100,10 +100,10 @@ discard block |
||
100 | 100 | $createRight = $user->rights->facture->creer; |
101 | 101 | } elseif($object->element == 'order_supplier' ) |
102 | 102 | { |
103 | - $createRight = $user->rights->fournisseur->commande->creer; |
|
103 | + $createRight = $user->rights->fournisseur->commande->creer; |
|
104 | 104 | } elseif($object->element == 'invoice_supplier' ) |
105 | 105 | { |
106 | - $createRight = $user->rights->fournisseur->facture->creer; |
|
106 | + $createRight = $user->rights->fournisseur->facture->creer; |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | if ($object->statut == 0 && $createRight) { |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | |
154 | 154 | if (!empty($conf->global->SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE) && $qty < 10) TSubtotal::addSubtotalMissing($object, $qty); |
155 | 155 | |
156 | - TSubtotal::addSubTotalLine($object, $title, $qty); |
|
156 | + TSubtotal::addSubTotalLine($object, $title, $qty); |
|
157 | 157 | } |
158 | 158 | else if($action==='ask_deleteallline') { |
159 | 159 | $form=new Form($db); |
@@ -375,36 +375,36 @@ discard block |
||
375 | 375 | $TContext = explode(':',$parameters['context']); |
376 | 376 | if ( |
377 | 377 | in_array('invoicecard',$TContext) |
378 | - || in_array('invoicesuppliercard',$TContext) |
|
378 | + || in_array('invoicesuppliercard',$TContext) |
|
379 | 379 | || in_array('propalcard',$TContext) |
380 | 380 | || in_array('ordercard',$TContext) |
381 | - || in_array('ordersuppliercard',$TContext) |
|
381 | + || in_array('ordersuppliercard',$TContext) |
|
382 | 382 | || in_array('invoicereccard',$TContext) |
383 | 383 | ) |
384 | - { |
|
385 | - $hideInnerLines = isset( $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] ) ? $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] : 0; |
|
386 | - $hidedetails = isset( $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] ) ? $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] : 0; |
|
384 | + { |
|
385 | + $hideInnerLines = isset( $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] ) ? $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] : 0; |
|
386 | + $hidedetails = isset( $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] ) ? $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] : 0; |
|
387 | 387 | $hidepricesDefaultConf = !empty($conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED)?$conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED:0; |
388 | 388 | $hideprices= isset( $_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id] ) ? $_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id] : $hidepricesDefaultConf; |
389 | 389 | |
390 | 390 | $var=false; |
391 | - $out.= '<tr '.$bc[$var].'> |
|
391 | + $out.= '<tr '.$bc[$var].'> |
|
392 | 392 | <td colspan="4" align="right"> |
393 | 393 | <label for="hideInnerLines">'.$langs->trans('HideInnerLines').'</label> |
394 | 394 | <input type="checkbox" onclick="if($(this).is(\':checked\')) { $(\'#hidedetails\').prop(\'checked\', \'checked\') }" id="hideInnerLines" name="hideInnerLines" value="1" '.(( $hideInnerLines ) ? 'checked="checked"' : '' ).' /> |
395 | 395 | </td> |
396 | 396 | </tr>'; |
397 | 397 | |
398 | - $var=!$var; |
|
399 | - $out.= '<tr '.$bc[$var].'> |
|
398 | + $var=!$var; |
|
399 | + $out.= '<tr '.$bc[$var].'> |
|
400 | 400 | <td colspan="4" align="right"> |
401 | 401 | <label for="hidedetails">'.$langs->trans('SubTotalhidedetails').'</label> |
402 | 402 | <input type="checkbox" id="hidedetails" name="hidedetails" value="1" '.(( $hidedetails ) ? 'checked="checked"' : '' ).' /> |
403 | 403 | </td> |
404 | 404 | </tr>'; |
405 | 405 | |
406 | - $var=!$var; |
|
407 | - $out.= '<tr '.$bc[$var].'> |
|
406 | + $var=!$var; |
|
407 | + $out.= '<tr '.$bc[$var].'> |
|
408 | 408 | <td colspan="4" align="right"> |
409 | 409 | <label for="hideprices">'.$langs->trans('SubTotalhidePrice').'</label> |
410 | 410 | <input type="checkbox" id="hideprices" name="hideprices" value="1" '.(( $hideprices ) ? 'checked="checked"' : '' ).' /> |
@@ -416,9 +416,9 @@ discard block |
||
416 | 416 | if ( |
417 | 417 | (in_array('propalcard',$TContext) && !empty($conf->global->SUBTOTAL_PROPAL_ADD_RECAP)) |
418 | 418 | || (in_array('ordercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
419 | - || (in_array('ordersuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
419 | + || (in_array('ordersuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
420 | 420 | || (in_array('invoicecard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
421 | - || (in_array('invoicesuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
421 | + || (in_array('invoicesuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
422 | 422 | || (in_array('invoicereccard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP )) |
423 | 423 | ) |
424 | 424 | { |
@@ -437,19 +437,19 @@ discard block |
||
437 | 437 | } |
438 | 438 | |
439 | 439 | |
440 | - return 1; |
|
440 | + return 1; |
|
441 | 441 | } |
442 | 442 | |
443 | - function formEditProductOptions($parameters, &$object, &$action, $hookmanager) |
|
444 | - { |
|
443 | + function formEditProductOptions($parameters, &$object, &$action, $hookmanager) |
|
444 | + { |
|
445 | 445 | |
446 | - if (in_array('invoicecard',explode(':',$parameters['context']))) |
|
447 | - { |
|
446 | + if (in_array('invoicecard',explode(':',$parameters['context']))) |
|
447 | + { |
|
448 | 448 | |
449 | - } |
|
449 | + } |
|
450 | 450 | |
451 | - return 0; |
|
452 | - } |
|
451 | + return 0; |
|
452 | + } |
|
453 | 453 | |
454 | 454 | function ODTSubstitutionLine(&$parameters, &$object, $action, $hookmanager) { |
455 | 455 | global $conf; |
@@ -498,11 +498,11 @@ discard block |
||
498 | 498 | |
499 | 499 | if ( |
500 | 500 | in_array('invoicecard',explode(':',$parameters['context'])) |
501 | - || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
501 | + || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
502 | 502 | || in_array('propalcard',explode(':',$parameters['context'])) |
503 | - || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
503 | + || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
504 | 504 | || in_array('ordercard',explode(':',$parameters['context'])) |
505 | - || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
505 | + || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
506 | 506 | || in_array('invoicereccard',explode(':',$parameters['context'])) |
507 | 507 | ) { |
508 | 508 | |
@@ -581,20 +581,20 @@ discard block |
||
581 | 581 | in_array('invoicecard',explode(':',$parameters['context'])) |
582 | 582 | || in_array('propalcard',explode(':',$parameters['context'])) |
583 | 583 | || in_array('ordercard',explode(':',$parameters['context'])) |
584 | - || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
585 | - || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
586 | - || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
584 | + || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
585 | + || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
586 | + || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
587 | 587 | ) |
588 | - { |
|
588 | + { |
|
589 | 589 | if(in_array('invoicecard',explode(':',$parameters['context']))) { |
590 | 590 | $sessname = 'subtotal_hideInnerLines_facture'; |
591 | 591 | $sessname2 = 'subtotal_hidedetails_facture'; |
592 | 592 | $sessname3 = 'subtotal_hideprices_facture'; |
593 | 593 | } |
594 | 594 | elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) { |
595 | - $sessname = 'subtotal_hideInnerLines_facture_fournisseur'; |
|
596 | - $sessname2 = 'subtotal_hidedetails_facture_fournisseur'; |
|
597 | - $sessname3 = 'subtotal_hideprices_facture_fournisseur'; |
|
595 | + $sessname = 'subtotal_hideInnerLines_facture_fournisseur'; |
|
596 | + $sessname2 = 'subtotal_hidedetails_facture_fournisseur'; |
|
597 | + $sessname3 = 'subtotal_hideprices_facture_fournisseur'; |
|
598 | 598 | } |
599 | 599 | elseif(in_array('propalcard',explode(':',$parameters['context']))) { |
600 | 600 | $sessname = 'subtotal_hideInnerLines_propal'; |
@@ -602,9 +602,9 @@ discard block |
||
602 | 602 | $sessname3 = 'subtotal_hideprices_propal'; |
603 | 603 | } |
604 | 604 | elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) { |
605 | - $sessname = 'subtotal_hideInnerLines_supplier_proposal'; |
|
606 | - $sessname2 = 'subtotal_hidedetails_supplier_proposal'; |
|
607 | - $sessname3 = 'subtotal_hideprices_supplier_proposal'; |
|
605 | + $sessname = 'subtotal_hideInnerLines_supplier_proposal'; |
|
606 | + $sessname2 = 'subtotal_hidedetails_supplier_proposal'; |
|
607 | + $sessname3 = 'subtotal_hideprices_supplier_proposal'; |
|
608 | 608 | } |
609 | 609 | elseif(in_array('ordercard',explode(':',$parameters['context']))) { |
610 | 610 | $sessname = 'subtotal_hideInnerLines_commande'; |
@@ -612,9 +612,9 @@ discard block |
||
612 | 612 | $sessname3 = 'subtotal_hideprices_commande'; |
613 | 613 | } |
614 | 614 | elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) { |
615 | - $sessname = 'subtotal_hideInnerLines_commande_fournisseur'; |
|
616 | - $sessname2 = 'subtotal_hidedetails_commande_fournisseur'; |
|
617 | - $sessname3 = 'subtotal_hideprices_commande_fournisseur'; |
|
615 | + $sessname = 'subtotal_hideInnerLines_commande_fournisseur'; |
|
616 | + $sessname2 = 'subtotal_hidedetails_commande_fournisseur'; |
|
617 | + $sessname3 = 'subtotal_hideprices_commande_fournisseur'; |
|
618 | 618 | } |
619 | 619 | else { |
620 | 620 | $sessname = 'subtotal_hideInnerLines_unknown'; |
@@ -639,17 +639,17 @@ discard block |
||
639 | 639 | foreach($object->lines as &$line) { |
640 | 640 | if ($line->product_type == 9 && $line->special_code == $this->module_number) { |
641 | 641 | |
642 | - if($line->qty>=90) { |
|
643 | - $line->modsubtotal_total = 1; |
|
644 | - } |
|
645 | - else{ |
|
646 | - $line->modsubtotal_title = 1; |
|
647 | - } |
|
642 | + if($line->qty>=90) { |
|
643 | + $line->modsubtotal_total = 1; |
|
644 | + } |
|
645 | + else{ |
|
646 | + $line->modsubtotal_title = 1; |
|
647 | + } |
|
648 | 648 | |
649 | 649 | $line->total_ht = $this->getTotalLineFromObject($object, $line, ''); |
650 | 650 | } |
651 | - } |
|
652 | - } |
|
651 | + } |
|
652 | + } |
|
653 | 653 | |
654 | 654 | } |
655 | 655 | else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') { |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | */ |
667 | 667 | else if($object->element=='invoice_supplier') |
668 | 668 | { |
669 | - $object->deleteline($idLine); |
|
669 | + $object->deleteline($idLine); |
|
670 | 670 | } |
671 | 671 | /** |
672 | 672 | * @var $object Propal |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | */ |
690 | 690 | else if($object->element=='order_supplier') |
691 | 691 | { |
692 | - $object->deleteline($idLine); |
|
692 | + $object->deleteline($idLine); |
|
693 | 693 | } |
694 | 694 | /** |
695 | 695 | * @var $object Facturerec |
@@ -733,7 +733,7 @@ discard block |
||
733 | 733 | |
734 | 734 | foreach($object->lines as $l) { |
735 | 735 | |
736 | - $lid = (!empty($l->rowid) ? $l->rowid : $l->id); |
|
736 | + $lid = (!empty($l->rowid) ? $l->rowid : $l->id); |
|
737 | 737 | if($lid == $lineid) { |
738 | 738 | |
739 | 739 | $found = true; |
@@ -742,7 +742,7 @@ discard block |
||
742 | 742 | |
743 | 743 | if($found) { |
744 | 744 | |
745 | - $Tab[] = (!empty($l->rowid) ? $l->rowid : $l->id); |
|
745 | + $Tab[] = (!empty($l->rowid) ? $l->rowid : $l->id); |
|
746 | 746 | |
747 | 747 | if($l->special_code==$this->module_number && (($l->qty==99 && $qty_line==1) || ($l->qty==98 && $qty_line==2)) ) { |
748 | 748 | break; // end of story |
@@ -821,17 +821,17 @@ discard block |
||
821 | 821 | if($l->rang>=$rang) { |
822 | 822 | return price($total); |
823 | 823 | } |
824 | - if (TSubtotal::isSubtotal($l)){ |
|
825 | - $total = 0; |
|
826 | - } else if ($l->situation_percent > 0 ){ |
|
824 | + if (TSubtotal::isSubtotal($l)){ |
|
825 | + $total = 0; |
|
826 | + } else if ($l->situation_percent > 0 ){ |
|
827 | 827 | |
828 | 828 | |
829 | 829 | $prev_progress = $l->get_prev_progress($object->id); |
830 | 830 | $progress = ($l->situation_percent - $prev_progress) /100; |
831 | - $total += ($l->total_ht/($l->situation_percent/100)) * $progress; |
|
831 | + $total += ($l->total_ht/($l->situation_percent/100)) * $progress; |
|
832 | 832 | |
833 | - } |
|
834 | - } |
|
833 | + } |
|
834 | + } |
|
835 | 835 | |
836 | 836 | return price($total); |
837 | 837 | } |
@@ -863,7 +863,7 @@ discard block |
||
863 | 863 | if(method_exists('Closure','bind')) { |
864 | 864 | $pageBreakOriginalValue = $pdf->AcceptPageBreak(); |
865 | 865 | $sweetsThief = function ($pdf) { |
866 | - return $pdf->bMargin ; |
|
866 | + return $pdf->bMargin ; |
|
867 | 867 | }; |
868 | 868 | $sweetsThief = Closure::bind($sweetsThief, null, $pdf); |
869 | 869 | |
@@ -926,11 +926,11 @@ discard block |
||
926 | 926 | else |
927 | 927 | { |
928 | 928 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
929 | - if(get_class($object) == 'Facture' && $object->type==Facture::TYPE_SITUATION){//Facture de situation |
|
930 | - $total_to_print = $this->getTotalToPrintSituation($object, $line); |
|
931 | - } else { |
|
932 | - $total_to_print = price($total); |
|
933 | - } |
|
929 | + if(get_class($object) == 'Facture' && $object->type==Facture::TYPE_SITUATION){//Facture de situation |
|
930 | + $total_to_print = $this->getTotalToPrintSituation($object, $line); |
|
931 | + } else { |
|
932 | + $total_to_print = price($total); |
|
933 | + } |
|
934 | 934 | |
935 | 935 | $line->total_ht = $total; |
936 | 936 | $line->total = $total; |
@@ -1081,7 +1081,7 @@ discard block |
||
1081 | 1081 | } |
1082 | 1082 | |
1083 | 1083 | function pdf_getlinetotalexcltax($parameters=array(), &$object, &$action='') { |
1084 | - global $conf, $hideprices, $hookmanager; |
|
1084 | + global $conf, $hideprices, $hookmanager; |
|
1085 | 1085 | |
1086 | 1086 | if(is_array($parameters)) $i = & $parameters['i']; |
1087 | 1087 | else $i = (int)$parameters; |
@@ -1120,7 +1120,7 @@ discard block |
||
1120 | 1120 | } |
1121 | 1121 | } |
1122 | 1122 | if ((int)GETPOST('hideInnerLines') && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)){ |
1123 | - $this->resprints = price($object->lines[$i]->total_ht); |
|
1123 | + $this->resprints = price($object->lines[$i]->total_ht); |
|
1124 | 1124 | } |
1125 | 1125 | |
1126 | 1126 | // Si la gestion C/NC est active et que je suis sur un ligne dont l'extrafield est coché |
@@ -1249,7 +1249,7 @@ discard block |
||
1249 | 1249 | } |
1250 | 1250 | |
1251 | 1251 | function pdf_getlineupexcltax($parameters=array(), &$object, &$action='') { |
1252 | - global $conf,$hideprices,$hookmanager; |
|
1252 | + global $conf,$hideprices,$hookmanager; |
|
1253 | 1253 | |
1254 | 1254 | if($this->isModSubtotalLine($parameters,$object) ){ |
1255 | 1255 | $this->resprints = ' '; |
@@ -1271,32 +1271,32 @@ discard block |
||
1271 | 1271 | (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) |
1272 | 1272 | ) |
1273 | 1273 | { |
1274 | - // alors je dois vérifier si la méthode fait partie de la conf qui l'exclue |
|
1275 | - if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
1276 | - { |
|
1277 | - $this->resprints = ' '; |
|
1274 | + // alors je dois vérifier si la méthode fait partie de la conf qui l'exclue |
|
1275 | + if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
1276 | + { |
|
1277 | + $this->resprints = ' '; |
|
1278 | 1278 | |
1279 | - // currentcontext à modifier celon l'appel |
|
1280 | - $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i); |
|
1281 | - return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1) |
|
1279 | + // currentcontext à modifier celon l'appel |
|
1280 | + $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i); |
|
1281 | + return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1) |
|
1282 | 1282 | |
1283 | - } |
|
1283 | + } |
|
1284 | 1284 | } |
1285 | 1285 | // Cache le prix pour les lignes standards dolibarr qui sont dans un ensemble |
1286 | 1286 | else if (!empty($hideprices)) |
1287 | 1287 | { |
1288 | 1288 | |
1289 | - // Check if a title exist for this line && if the title have subtotal |
|
1290 | - $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
1291 | - if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
1292 | - { |
|
1289 | + // Check if a title exist for this line && if the title have subtotal |
|
1290 | + $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
1291 | + if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
1292 | + { |
|
1293 | 1293 | |
1294 | - $this->resprints = ' '; |
|
1294 | + $this->resprints = ' '; |
|
1295 | 1295 | |
1296 | - // currentcontext à modifier celon l'appel |
|
1297 | - $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hideprices', 'i' => $i); |
|
1298 | - return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1) |
|
1299 | - } |
|
1296 | + // currentcontext à modifier celon l'appel |
|
1297 | + $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hideprices', 'i' => $i); |
|
1298 | + return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1) |
|
1299 | + } |
|
1300 | 1300 | } |
1301 | 1301 | |
1302 | 1302 | return 0; |
@@ -1333,7 +1333,7 @@ discard block |
||
1333 | 1333 | } |
1334 | 1334 | |
1335 | 1335 | function pdf_getlinevatrate($parameters=array(), &$object, &$action='') { |
1336 | - global $conf,$hideprices,$hookmanager; |
|
1336 | + global $conf,$hideprices,$hookmanager; |
|
1337 | 1337 | |
1338 | 1338 | if($this->isModSubtotalLine($parameters,$object) ){ |
1339 | 1339 | $this->resprints = ' '; |
@@ -1358,31 +1358,31 @@ discard block |
||
1358 | 1358 | (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) |
1359 | 1359 | ) |
1360 | 1360 | { |
1361 | - // alors je dois vérifier si la méthode fait partie de la conf qui l'exclue |
|
1362 | - if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
1363 | - { |
|
1364 | - $this->resprints = ' '; |
|
1361 | + // alors je dois vérifier si la méthode fait partie de la conf qui l'exclue |
|
1362 | + if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
1363 | + { |
|
1364 | + $this->resprints = ' '; |
|
1365 | 1365 | |
1366 | - // currentcontext à modifier celon l'appel |
|
1367 | - $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i); |
|
1368 | - return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1) |
|
1369 | - } |
|
1366 | + // currentcontext à modifier celon l'appel |
|
1367 | + $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i); |
|
1368 | + return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1) |
|
1369 | + } |
|
1370 | 1370 | } |
1371 | 1371 | // Cache le prix pour les lignes standards dolibarr qui sont dans un ensemble |
1372 | 1372 | else if (!empty($hideprices)) |
1373 | 1373 | { |
1374 | 1374 | |
1375 | - // Check if a title exist for this line && if the title have subtotal |
|
1376 | - $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
1377 | - if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
1378 | - { |
|
1375 | + // Check if a title exist for this line && if the title have subtotal |
|
1376 | + $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
1377 | + if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
1378 | + { |
|
1379 | 1379 | |
1380 | - $this->resprints = ' '; |
|
1380 | + $this->resprints = ' '; |
|
1381 | 1381 | |
1382 | - // currentcontext à modifier celon l'appel |
|
1383 | - $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hideprices', 'i' => $i); |
|
1384 | - return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1) |
|
1385 | - } |
|
1382 | + // currentcontext à modifier celon l'appel |
|
1383 | + $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hideprices', 'i' => $i); |
|
1384 | + return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1) |
|
1385 | + } |
|
1386 | 1386 | } |
1387 | 1387 | |
1388 | 1388 | return 0; |
@@ -1511,11 +1511,11 @@ discard block |
||
1511 | 1511 | $hidedetails = (int)GETPOST('hidedetails'); |
1512 | 1512 | |
1513 | 1513 | if ($hideInnerLines) { // si c une ligne de titre |
1514 | - $fk_parent_line=0; |
|
1514 | + $fk_parent_line=0; |
|
1515 | 1515 | $TLines =array(); |
1516 | 1516 | |
1517 | 1517 | $original_count=count($object->lines); |
1518 | - $TTvas = array(); // tableau de tva |
|
1518 | + $TTvas = array(); // tableau de tva |
|
1519 | 1519 | |
1520 | 1520 | foreach($object->lines as $k=>&$line) |
1521 | 1521 | { |
@@ -1545,48 +1545,48 @@ discard block |
||
1545 | 1545 | |
1546 | 1546 | if ($hideInnerLines) |
1547 | 1547 | { |
1548 | - if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
1549 | - { |
|
1550 | - if($line->tva_tx != '0.000' && $line->product_type!=9){ |
|
1548 | + if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
1549 | + { |
|
1550 | + if($line->tva_tx != '0.000' && $line->product_type!=9){ |
|
1551 | 1551 | |
1552 | - // on remplit le tableau de tva pour substituer les lignes cachées |
|
1553 | - $TTvas[$line->tva_tx]['total_tva'] += $line->total_tva; |
|
1554 | - $TTvas[$line->tva_tx]['total_ht'] += $line->total_ht; |
|
1555 | - $TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; |
|
1556 | - } |
|
1557 | - if($line->product_type==9 && $line->rowid>0) |
|
1558 | - { |
|
1559 | - //Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres |
|
1560 | - // génère des lignes d'affichage des montants HT soumis à tva |
|
1561 | - $nbtva = count($TTvas); |
|
1562 | - if(!empty($nbtva)){ |
|
1563 | - foreach ($TTvas as $tx =>$val){ |
|
1564 | - $l = clone $line; |
|
1565 | - $l->product_type = 1; |
|
1566 | - $l->special_code = ''; |
|
1567 | - $l->qty = 1; |
|
1568 | - $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx)); |
|
1569 | - $l->tva_tx = $tx; |
|
1570 | - $l->total_ht = $val['total_ht']; |
|
1571 | - $l->total_tva = $val['total_tva']; |
|
1572 | - $l->total = $line->total_ht; |
|
1573 | - $l->total_ttc = $val['total_ttc']; |
|
1574 | - $TLines[] = $l; |
|
1575 | - array_shift($TTvas); |
|
1576 | - } |
|
1577 | - } |
|
1552 | + // on remplit le tableau de tva pour substituer les lignes cachées |
|
1553 | + $TTvas[$line->tva_tx]['total_tva'] += $line->total_tva; |
|
1554 | + $TTvas[$line->tva_tx]['total_ht'] += $line->total_ht; |
|
1555 | + $TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; |
|
1556 | + } |
|
1557 | + if($line->product_type==9 && $line->rowid>0) |
|
1558 | + { |
|
1559 | + //Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres |
|
1560 | + // génère des lignes d'affichage des montants HT soumis à tva |
|
1561 | + $nbtva = count($TTvas); |
|
1562 | + if(!empty($nbtva)){ |
|
1563 | + foreach ($TTvas as $tx =>$val){ |
|
1564 | + $l = clone $line; |
|
1565 | + $l->product_type = 1; |
|
1566 | + $l->special_code = ''; |
|
1567 | + $l->qty = 1; |
|
1568 | + $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx)); |
|
1569 | + $l->tva_tx = $tx; |
|
1570 | + $l->total_ht = $val['total_ht']; |
|
1571 | + $l->total_tva = $val['total_tva']; |
|
1572 | + $l->total = $line->total_ht; |
|
1573 | + $l->total_ttc = $val['total_ttc']; |
|
1574 | + $TLines[] = $l; |
|
1575 | + array_shift($TTvas); |
|
1576 | + } |
|
1577 | + } |
|
1578 | 1578 | |
1579 | - // ajoute la ligne de sous-total |
|
1580 | - $TLines[] = $line; |
|
1581 | - } |
|
1582 | - } else { |
|
1579 | + // ajoute la ligne de sous-total |
|
1580 | + $TLines[] = $line; |
|
1581 | + } |
|
1582 | + } else { |
|
1583 | 1583 | |
1584 | - if($line->product_type==9 && $line->rowid>0) |
|
1585 | - { |
|
1586 | - // ajoute la ligne de sous-total |
|
1587 | - $TLines[] = $line; |
|
1588 | - } |
|
1589 | - } |
|
1584 | + if($line->product_type==9 && $line->rowid>0) |
|
1585 | + { |
|
1586 | + // ajoute la ligne de sous-total |
|
1587 | + $TLines[] = $line; |
|
1588 | + } |
|
1589 | + } |
|
1590 | 1590 | |
1591 | 1591 | |
1592 | 1592 | } |
@@ -1611,20 +1611,20 @@ discard block |
||
1611 | 1611 | $nbtva = count($TTvas); |
1612 | 1612 | if(!empty($nbtva) && $hideInnerLines && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
1613 | 1613 | { |
1614 | - foreach ($TTvas as $tx =>$val){ |
|
1615 | - $l = clone $line; |
|
1616 | - $l->product_type = 1; |
|
1617 | - $l->special_code = ''; |
|
1618 | - $l->qty = 1; |
|
1619 | - $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx)); |
|
1620 | - $l->tva_tx = $tx; |
|
1621 | - $l->total_ht = $val['total_ht']; |
|
1622 | - $l->total_tva = $val['total_tva']; |
|
1623 | - $l->total = $line->total_ht; |
|
1624 | - $l->total_ttc = $val['total_ttc']; |
|
1625 | - $TLines[] = $l; |
|
1626 | - array_shift($TTvas); |
|
1627 | - } |
|
1614 | + foreach ($TTvas as $tx =>$val){ |
|
1615 | + $l = clone $line; |
|
1616 | + $l->product_type = 1; |
|
1617 | + $l->special_code = ''; |
|
1618 | + $l->qty = 1; |
|
1619 | + $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx)); |
|
1620 | + $l->tva_tx = $tx; |
|
1621 | + $l->total_ht = $val['total_ht']; |
|
1622 | + $l->total_tva = $val['total_tva']; |
|
1623 | + $l->total = $line->total_ht; |
|
1624 | + $l->total_ttc = $val['total_ttc']; |
|
1625 | + $TLines[] = $l; |
|
1626 | + array_shift($TTvas); |
|
1627 | + } |
|
1628 | 1628 | } |
1629 | 1629 | |
1630 | 1630 | global $nblignes; |
@@ -1636,7 +1636,7 @@ discard block |
||
1636 | 1636 | $this->resprints = ''; |
1637 | 1637 | return 0; |
1638 | 1638 | } |
1639 | - } |
|
1639 | + } |
|
1640 | 1640 | |
1641 | 1641 | return 0; |
1642 | 1642 | } |
@@ -1799,18 +1799,18 @@ discard block |
||
1799 | 1799 | } |
1800 | 1800 | elseif($object->element == 'order_supplier' ) |
1801 | 1801 | { |
1802 | - $createRight = $user->rights->fournisseur->commande->creer; |
|
1802 | + $createRight = $user->rights->fournisseur->commande->creer; |
|
1803 | 1803 | } |
1804 | 1804 | elseif($object->element == 'invoice_supplier' ) |
1805 | 1805 | { |
1806 | - $createRight = $user->rights->fournisseur->facture->creer; |
|
1806 | + $createRight = $user->rights->fournisseur->facture->creer; |
|
1807 | 1807 | } |
1808 | 1808 | |
1809 | 1809 | if($line->special_code!=$this->module_number || $line->product_type!=9) { |
1810 | 1810 | null; |
1811 | 1811 | } |
1812 | 1812 | 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)) |
1813 | - { |
|
1813 | + { |
|
1814 | 1814 | if($object->element=='facture')$idvar = 'facid'; |
1815 | 1815 | else $idvar='id'; |
1816 | 1816 | |
@@ -1857,7 +1857,7 @@ discard block |
||
1857 | 1857 | //var_dump($line); |
1858 | 1858 | |
1859 | 1859 | // HTML 5 data for js |
1860 | - $data = $this->_getHtmlData($parameters, $object, $action, $hookmanager); |
|
1860 | + $data = $this->_getHtmlData($parameters, $object, $action, $hookmanager); |
|
1861 | 1861 | |
1862 | 1862 | |
1863 | 1863 | ?> |
@@ -1915,8 +1915,8 @@ discard block |
||
1915 | 1915 | } |
1916 | 1916 | |
1917 | 1917 | if ($object->element == 'order_supplier' || $object->element == 'invoice_supplier') { |
1918 | - $line->label = !empty($line->description) ? $line->description : $line->desc; |
|
1919 | - $line->description = ''; |
|
1918 | + $line->label = !empty($line->description) ? $line->description : $line->desc; |
|
1919 | + $line->description = ''; |
|
1920 | 1920 | } |
1921 | 1921 | $newlabel = $line->label; |
1922 | 1922 | if($line->label=='' && !$isFreeText) { |
@@ -2207,17 +2207,17 @@ discard block |
||
2207 | 2207 | if ($object->statut == 0 && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && $action != 'editline') |
2208 | 2208 | { |
2209 | 2209 | |
2210 | - if($object->element == 'invoice_supplier' || $object->element == 'order_supplier') |
|
2211 | - { |
|
2212 | - foreach ($object->lines as $line) |
|
2213 | - { |
|
2214 | - // fetch optionals attributes and labels |
|
2215 | - require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); |
|
2216 | - $extrafields=new ExtraFields($this->db); |
|
2217 | - $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true); |
|
2218 | - $line->fetch_optionals($line->id,$extralabels); |
|
2219 | - } |
|
2220 | - } |
|
2210 | + if($object->element == 'invoice_supplier' || $object->element == 'order_supplier') |
|
2211 | + { |
|
2212 | + foreach ($object->lines as $line) |
|
2213 | + { |
|
2214 | + // fetch optionals attributes and labels |
|
2215 | + require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); |
|
2216 | + $extrafields=new ExtraFields($this->db); |
|
2217 | + $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true); |
|
2218 | + $line->fetch_optionals($line->id,$extralabels); |
|
2219 | + } |
|
2220 | + } |
|
2221 | 2221 | |
2222 | 2222 | $TSubNc = array(); |
2223 | 2223 | foreach ($object->lines as &$l) |
@@ -2308,80 +2308,80 @@ discard block |
||
2308 | 2308 | { |
2309 | 2309 | dol_include_once('/subtotal/class/subtotal.class.php'); |
2310 | 2310 | |
2311 | - $line = &$parameters['line']; |
|
2311 | + $line = &$parameters['line']; |
|
2312 | 2312 | |
2313 | - $ThtmlData['data-id'] = $line->id; |
|
2314 | - $ThtmlData['data-product_type'] = $line->product_type; |
|
2315 | - $ThtmlData['data-qty'] = 0; //$line->qty; |
|
2316 | - $ThtmlData['data-level'] = TSubtotal::getNiveau($line); |
|
2313 | + $ThtmlData['data-id'] = $line->id; |
|
2314 | + $ThtmlData['data-product_type'] = $line->product_type; |
|
2315 | + $ThtmlData['data-qty'] = 0; //$line->qty; |
|
2316 | + $ThtmlData['data-level'] = TSubtotal::getNiveau($line); |
|
2317 | 2317 | |
2318 | - if(TSubtotal::isTitle($line)){ |
|
2319 | - $ThtmlData['data-issubtotal'] = 'title'; |
|
2320 | - }elseif(TSubtotal::isSubtotal($line)){ |
|
2321 | - $ThtmlData['data-issubtotal'] = 'subtotal'; |
|
2322 | - } |
|
2323 | - else{ |
|
2324 | - $ThtmlData['data-issubtotal'] = 'freetext'; |
|
2325 | - } |
|
2318 | + if(TSubtotal::isTitle($line)){ |
|
2319 | + $ThtmlData['data-issubtotal'] = 'title'; |
|
2320 | + }elseif(TSubtotal::isSubtotal($line)){ |
|
2321 | + $ThtmlData['data-issubtotal'] = 'subtotal'; |
|
2322 | + } |
|
2323 | + else{ |
|
2324 | + $ThtmlData['data-issubtotal'] = 'freetext'; |
|
2325 | + } |
|
2326 | 2326 | |
2327 | 2327 | |
2328 | - // Change or add data from hooks |
|
2329 | - $parameters = array_replace($parameters , array( 'ThtmlData' => $ThtmlData ) ); |
|
2328 | + // Change or add data from hooks |
|
2329 | + $parameters = array_replace($parameters , array( 'ThtmlData' => $ThtmlData ) ); |
|
2330 | 2330 | |
2331 | - // hook |
|
2332 | - $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
|
2333 | - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
2334 | - if ($reshook>0) |
|
2335 | - { |
|
2336 | - $ThtmlData = $hookmanager->resArray; |
|
2337 | - } |
|
2338 | - |
|
2339 | - return $this->implodeHtmlData($ThtmlData); |
|
2331 | + // hook |
|
2332 | + $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
|
2333 | + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
2334 | + if ($reshook>0) |
|
2335 | + { |
|
2336 | + $ThtmlData = $hookmanager->resArray; |
|
2337 | + } |
|
2338 | + |
|
2339 | + return $this->implodeHtmlData($ThtmlData); |
|
2340 | 2340 | |
2341 | 2341 | } |
2342 | 2342 | |
2343 | 2343 | |
2344 | 2344 | function implodeHtmlData($ThtmlData = array()) |
2345 | 2345 | { |
2346 | - $data = ''; |
|
2347 | - foreach($ThtmlData as $k => $h ) |
|
2348 | - { |
|
2349 | - if(is_array($h)) |
|
2350 | - { |
|
2351 | - $h = json_encode($h); |
|
2352 | - } |
|
2346 | + $data = ''; |
|
2347 | + foreach($ThtmlData as $k => $h ) |
|
2348 | + { |
|
2349 | + if(is_array($h)) |
|
2350 | + { |
|
2351 | + $h = json_encode($h); |
|
2352 | + } |
|
2353 | 2353 | |
2354 | - $data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" '; |
|
2355 | - } |
|
2354 | + $data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" '; |
|
2355 | + } |
|
2356 | 2356 | |
2357 | - return $data; |
|
2357 | + return $data; |
|
2358 | 2358 | } |
2359 | 2359 | |
2360 | 2360 | function _ajax_block_order_js($object) |
2361 | 2361 | { |
2362 | - global $conf,$tagidfortablednd,$filepath,$langs; |
|
2362 | + global $conf,$tagidfortablednd,$filepath,$langs; |
|
2363 | 2363 | |
2364 | - /* |
|
2364 | + /* |
|
2365 | 2365 | * this part of js is base on dolibarr htdocs/core/tpl/ajaxrow.tpl.php |
2366 | 2366 | * for compatibility reasons we don't use tableDnD but jquery sortable |
2367 | 2367 | */ |
2368 | 2368 | |
2369 | - $id=$object->id; |
|
2370 | - $nboflines=(isset($object->lines)?count($object->lines):0); |
|
2371 | - $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1; |
|
2369 | + $id=$object->id; |
|
2370 | + $nboflines=(isset($object->lines)?count($object->lines):0); |
|
2371 | + $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1; |
|
2372 | 2372 | |
2373 | - $id=$object->id; |
|
2374 | - $fk_element=$object->fk_element; |
|
2375 | - $table_element_line=$object->table_element_line; |
|
2376 | - $nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines)); |
|
2377 | - $tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd); |
|
2378 | - $filepath=(empty($filepath)?'':$filepath); |
|
2373 | + $id=$object->id; |
|
2374 | + $fk_element=$object->fk_element; |
|
2375 | + $table_element_line=$object->table_element_line; |
|
2376 | + $nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines)); |
|
2377 | + $tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd); |
|
2378 | + $filepath=(empty($filepath)?'':$filepath); |
|
2379 | 2379 | |
2380 | 2380 | |
2381 | - if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1) |
|
2382 | - { |
|
2381 | + if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1) |
|
2382 | + { |
|
2383 | 2383 | |
2384 | - ?> |
|
2384 | + ?> |
|
2385 | 2385 | |
2386 | 2386 | |
2387 | 2387 | <script type="text/javascript"> |
@@ -85,43 +85,43 @@ discard block |
||
85 | 85 | |
86 | 86 | function formObjectOptions($parameters, &$object, &$action, $hookmanager) |
87 | 87 | { |
88 | - global $langs,$db,$user, $conf; |
|
88 | + global $langs, $db, $user, $conf; |
|
89 | 89 | |
90 | 90 | $langs->load('subtotal@subtotal'); |
91 | 91 | |
92 | - $contexts = explode(':',$parameters['context']); |
|
92 | + $contexts = explode(':', $parameters['context']); |
|
93 | 93 | |
94 | - 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)) { |
|
94 | + 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)) { |
|
95 | 95 | |
96 | 96 | $createRight = $user->rights->{$object->element}->creer; |
97 | - if($object->element == 'facturerec' ) |
|
97 | + if ($object->element == 'facturerec') |
|
98 | 98 | { |
99 | 99 | $object->statut = 0; // hack for facture rec |
100 | 100 | $createRight = $user->rights->facture->creer; |
101 | - } elseif($object->element == 'order_supplier' ) |
|
101 | + } elseif ($object->element == 'order_supplier') |
|
102 | 102 | { |
103 | 103 | $createRight = $user->rights->fournisseur->commande->creer; |
104 | - } elseif($object->element == 'invoice_supplier' ) |
|
104 | + } elseif ($object->element == 'invoice_supplier') |
|
105 | 105 | { |
106 | 106 | $createRight = $user->rights->fournisseur->facture->creer; |
107 | 107 | } |
108 | 108 | |
109 | - if ($object->statut == 0 && $createRight) { |
|
109 | + if ($object->statut == 0 && $createRight) { |
|
110 | 110 | |
111 | 111 | |
112 | - if($object->element=='facture')$idvar = 'facid'; |
|
113 | - else $idvar='id'; |
|
112 | + if ($object->element == 'facture')$idvar = 'facid'; |
|
113 | + else $idvar = 'id'; |
|
114 | 114 | |
115 | - if(in_array($action, array('add_title_line', 'add_total_line', 'add_subtitle_line', 'add_subtotal_line', 'add_free_text')) ) |
|
115 | + if (in_array($action, array('add_title_line', 'add_total_line', 'add_subtitle_line', 'add_subtotal_line', 'add_free_text'))) |
|
116 | 116 | { |
117 | 117 | $level = GETPOST('level', 'int'); //New avec SUBTOTAL_USE_NEW_FORMAT |
118 | 118 | |
119 | - if($action=='add_title_line') { |
|
119 | + if ($action == 'add_title_line') { |
|
120 | 120 | $title = GETPOST('title'); |
121 | - if(empty($title)) $title = $langs->trans('title'); |
|
122 | - $qty = $level<1 ? 1 : $level ; |
|
121 | + if (empty($title)) $title = $langs->trans('title'); |
|
122 | + $qty = $level < 1 ? 1 : $level; |
|
123 | 123 | } |
124 | - else if($action=='add_free_text') { |
|
124 | + else if ($action == 'add_free_text') { |
|
125 | 125 | $title = GETPOST('title'); |
126 | 126 | |
127 | 127 | if (empty($title)) { |
@@ -133,21 +133,21 @@ discard block |
||
133 | 133 | } |
134 | 134 | } |
135 | 135 | } |
136 | - if(empty($title)) $title = $langs->trans('subtotalAddLineDescription'); |
|
136 | + if (empty($title)) $title = $langs->trans('subtotalAddLineDescription'); |
|
137 | 137 | $qty = 50; |
138 | 138 | } |
139 | - else if($action=='add_subtitle_line') { |
|
139 | + else if ($action == 'add_subtitle_line') { |
|
140 | 140 | $title = GETPOST('title'); |
141 | - if(empty($title)) $title = $langs->trans('subtitle'); |
|
141 | + if (empty($title)) $title = $langs->trans('subtitle'); |
|
142 | 142 | $qty = 2; |
143 | 143 | } |
144 | - else if($action=='add_subtotal_line') { |
|
144 | + else if ($action == 'add_subtotal_line') { |
|
145 | 145 | $title = $langs->trans('SubSubTotal'); |
146 | 146 | $qty = 98; |
147 | 147 | } |
148 | 148 | else { |
149 | 149 | $title = GETPOST('title') ? GETPOST('title') : $langs->trans('SubTotal'); |
150 | - $qty = $level ? 100-$level : 99; |
|
150 | + $qty = $level ? 100 - $level : 99; |
|
151 | 151 | } |
152 | 152 | dol_include_once('/subtotal/class/subtotal.class.php'); |
153 | 153 | |
@@ -155,15 +155,15 @@ discard block |
||
155 | 155 | |
156 | 156 | TSubtotal::addSubTotalLine($object, $title, $qty); |
157 | 157 | } |
158 | - else if($action==='ask_deleteallline') { |
|
159 | - $form=new Form($db); |
|
158 | + else if ($action === 'ask_deleteallline') { |
|
159 | + $form = new Form($db); |
|
160 | 160 | |
161 | - $lineid = GETPOST('lineid','integer'); |
|
161 | + $lineid = GETPOST('lineid', 'integer'); |
|
162 | 162 | $TIdForGroup = $this->getArrayOfLineForAGroup($object, $lineid); |
163 | 163 | |
164 | 164 | $nbLines = count($TIdForGroup); |
165 | 165 | |
166 | - $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('deleteWithAllLines'), $langs->trans('ConfirmDeleteAllThisLines',$nbLines), 'confirm_delete_all_lines','',0,1); |
|
166 | + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('deleteWithAllLines'), $langs->trans('ConfirmDeleteAllThisLines', $nbLines), 'confirm_delete_all_lines', '', 0, 1); |
|
167 | 167 | print $formconfirm; |
168 | 168 | } |
169 | 169 | |
@@ -173,13 +173,13 @@ discard block |
||
173 | 173 | } |
174 | 174 | |
175 | 175 | |
176 | - if($action!='editline') { |
|
176 | + if ($action != 'editline') { |
|
177 | 177 | // New format is for 3.8 |
178 | 178 | $this->printNewFormat($object, $conf, $langs, $idvar); |
179 | 179 | } |
180 | 180 | } |
181 | 181 | } |
182 | - elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice',$contexts)) |
|
182 | + elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice', $contexts)) |
|
183 | 183 | { |
184 | 184 | ?> |
185 | 185 | <script type="text/javascript"> |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | $(document).ready(function() { |
205 | 205 | $('div.fiche div.tabsAction').append('<br />'); |
206 | 206 | |
207 | - $('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>'); |
|
207 | + $('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>'); |
|
208 | 208 | $('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>'); |
209 | 209 | $('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>'); |
210 | 210 | |
@@ -255,9 +255,9 @@ discard block |
||
255 | 255 | $('body').append(dialog_html); |
256 | 256 | |
257 | 257 | <?php |
258 | - $editorTool = empty($conf->global->FCKEDITOR_EDITORNAME)?'ckeditor':$conf->global->FCKEDITOR_EDITORNAME; |
|
259 | - $editorConf = empty($conf->global->FCKEDITOR_ENABLE_DETAILS)?false:$conf->global->FCKEDITOR_ENABLE_DETAILS; |
|
260 | - if($editorConf && in_array($editorTool,array('textarea','ckeditor'))){ |
|
258 | + $editorTool = empty($conf->global->FCKEDITOR_EDITORNAME) ? 'ckeditor' : $conf->global->FCKEDITOR_EDITORNAME; |
|
259 | + $editorConf = empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ?false:$conf->global->FCKEDITOR_ENABLE_DETAILS; |
|
260 | + if ($editorConf && in_array($editorTool, array('textarea', 'ckeditor'))) { |
|
261 | 261 | ?> |
262 | 262 | if (action == 'addTitle' || action == 'addFreeTxt') |
263 | 263 | { |
@@ -372,62 +372,62 @@ discard block |
||
372 | 372 | global $conf, $langs, $bc; |
373 | 373 | |
374 | 374 | $action = GETPOST('action'); |
375 | - $TContext = explode(':',$parameters['context']); |
|
375 | + $TContext = explode(':', $parameters['context']); |
|
376 | 376 | if ( |
377 | - in_array('invoicecard',$TContext) |
|
378 | - || in_array('invoicesuppliercard',$TContext) |
|
379 | - || in_array('propalcard',$TContext) |
|
380 | - || in_array('ordercard',$TContext) |
|
381 | - || in_array('ordersuppliercard',$TContext) |
|
382 | - || in_array('invoicereccard',$TContext) |
|
377 | + in_array('invoicecard', $TContext) |
|
378 | + || in_array('invoicesuppliercard', $TContext) |
|
379 | + || in_array('propalcard', $TContext) |
|
380 | + || in_array('ordercard', $TContext) |
|
381 | + || in_array('ordersuppliercard', $TContext) |
|
382 | + || in_array('invoicereccard', $TContext) |
|
383 | 383 | ) |
384 | 384 | { |
385 | - $hideInnerLines = isset( $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] ) ? $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] : 0; |
|
386 | - $hidedetails = isset( $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] ) ? $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] : 0; |
|
387 | - $hidepricesDefaultConf = !empty($conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED)?$conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED:0; |
|
388 | - $hideprices= isset( $_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id] ) ? $_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id] : $hidepricesDefaultConf; |
|
385 | + $hideInnerLines = isset($_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id]) ? $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] : 0; |
|
386 | + $hidedetails = isset($_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id]) ? $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] : 0; |
|
387 | + $hidepricesDefaultConf = !empty($conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED) ? $conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED : 0; |
|
388 | + $hideprices = isset($_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id]) ? $_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id] : $hidepricesDefaultConf; |
|
389 | 389 | |
390 | - $var=false; |
|
391 | - $out.= '<tr '.$bc[$var].'> |
|
390 | + $var = false; |
|
391 | + $out .= '<tr '.$bc[$var].'> |
|
392 | 392 | <td colspan="4" align="right"> |
393 | 393 | <label for="hideInnerLines">'.$langs->trans('HideInnerLines').'</label> |
394 | - <input type="checkbox" onclick="if($(this).is(\':checked\')) { $(\'#hidedetails\').prop(\'checked\', \'checked\') }" id="hideInnerLines" name="hideInnerLines" value="1" '.(( $hideInnerLines ) ? 'checked="checked"' : '' ).' /> |
|
394 | + <input type="checkbox" onclick="if($(this).is(\':checked\')) { $(\'#hidedetails\').prop(\'checked\', \'checked\') }" id="hideInnerLines" name="hideInnerLines" value="1" '.(($hideInnerLines) ? 'checked="checked"' : '').' /> |
|
395 | 395 | </td> |
396 | 396 | </tr>'; |
397 | 397 | |
398 | - $var=!$var; |
|
399 | - $out.= '<tr '.$bc[$var].'> |
|
398 | + $var = !$var; |
|
399 | + $out .= '<tr '.$bc[$var].'> |
|
400 | 400 | <td colspan="4" align="right"> |
401 | 401 | <label for="hidedetails">'.$langs->trans('SubTotalhidedetails').'</label> |
402 | - <input type="checkbox" id="hidedetails" name="hidedetails" value="1" '.(( $hidedetails ) ? 'checked="checked"' : '' ).' /> |
|
402 | + <input type="checkbox" id="hidedetails" name="hidedetails" value="1" '.(($hidedetails) ? 'checked="checked"' : '').' /> |
|
403 | 403 | </td> |
404 | 404 | </tr>'; |
405 | 405 | |
406 | - $var=!$var; |
|
407 | - $out.= '<tr '.$bc[$var].'> |
|
406 | + $var = !$var; |
|
407 | + $out .= '<tr '.$bc[$var].'> |
|
408 | 408 | <td colspan="4" align="right"> |
409 | 409 | <label for="hideprices">'.$langs->trans('SubTotalhidePrice').'</label> |
410 | - <input type="checkbox" id="hideprices" name="hideprices" value="1" '.(( $hideprices ) ? 'checked="checked"' : '' ).' /> |
|
410 | + <input type="checkbox" id="hideprices" name="hideprices" value="1" '.(($hideprices) ? 'checked="checked"' : '').' /> |
|
411 | 411 | </td> |
412 | 412 | </tr>'; |
413 | 413 | |
414 | 414 | |
415 | 415 | |
416 | 416 | if ( |
417 | - (in_array('propalcard',$TContext) && !empty($conf->global->SUBTOTAL_PROPAL_ADD_RECAP)) |
|
418 | - || (in_array('ordercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
419 | - || (in_array('ordersuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
420 | - || (in_array('invoicecard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
421 | - || (in_array('invoicesuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
422 | - || (in_array('invoicereccard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP )) |
|
417 | + (in_array('propalcard', $TContext) && !empty($conf->global->SUBTOTAL_PROPAL_ADD_RECAP)) |
|
418 | + || (in_array('ordercard', $TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
419 | + || (in_array('ordersuppliercard', $TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
420 | + || (in_array('invoicecard', $TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
421 | + || (in_array('invoicesuppliercard', $TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
422 | + || (in_array('invoicereccard', $TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
423 | 423 | ) |
424 | 424 | { |
425 | - $var=!$var; |
|
426 | - $out.= ' |
|
425 | + $var = !$var; |
|
426 | + $out .= ' |
|
427 | 427 | <tr '.$bc[$var].'> |
428 | 428 | <td colspan="4" align="right"> |
429 | 429 | <label for="subtotal_add_recap">'.$langs->trans('subtotal_add_recap').'</label> |
430 | - <input type="checkbox" id="subtotal_add_recap" name="subtotal_add_recap" value="1" '.( GETPOST('subtotal_add_recap') ? 'checked="checked"' : '' ).' /> |
|
430 | + <input type="checkbox" id="subtotal_add_recap" name="subtotal_add_recap" value="1" '.(GETPOST('subtotal_add_recap') ? 'checked="checked"' : '').' /> |
|
431 | 431 | </td> |
432 | 432 | </tr>'; |
433 | 433 | } |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | function formEditProductOptions($parameters, &$object, &$action, $hookmanager) |
444 | 444 | { |
445 | 445 | |
446 | - if (in_array('invoicecard',explode(':',$parameters['context']))) |
|
446 | + if (in_array('invoicecard', explode(':', $parameters['context']))) |
|
447 | 447 | { |
448 | 448 | |
449 | 449 | } |
@@ -454,13 +454,13 @@ discard block |
||
454 | 454 | function ODTSubstitutionLine(&$parameters, &$object, $action, $hookmanager) { |
455 | 455 | global $conf; |
456 | 456 | |
457 | - if($action === 'builddoc') { |
|
457 | + if ($action === 'builddoc') { |
|
458 | 458 | |
459 | 459 | $line = &$parameters['line']; |
460 | 460 | $object = &$parameters['object']; |
461 | 461 | $substitutionarray = &$parameters['substitutionarray']; |
462 | 462 | |
463 | - if($line->product_type == 9 && $line->special_code == $this->module_number) { |
|
463 | + if ($line->product_type == 9 && $line->special_code == $this->module_number) { |
|
464 | 464 | $substitutionarray['line_modsubtotal'] = 1; |
465 | 465 | |
466 | 466 | $substitutionarray['line_price_ht'] |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | = $substitutionarray['line_up'] |
472 | 472 | = ''; |
473 | 473 | |
474 | - if($line->qty>90) { |
|
474 | + if ($line->qty > 90) { |
|
475 | 475 | $substitutionarray['line_modsubtotal_total'] = true; |
476 | 476 | |
477 | 477 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | |
486 | 486 | |
487 | 487 | } |
488 | - else{ |
|
488 | + else { |
|
489 | 489 | $substitutionarray['line_not_modsubtotal'] = true; |
490 | 490 | $substitutionarray['line_modsubtotal'] = 0; |
491 | 491 | } |
@@ -497,29 +497,29 @@ discard block |
||
497 | 497 | function createFrom($parameters, &$object, $action, $hookmanager) { |
498 | 498 | |
499 | 499 | if ( |
500 | - in_array('invoicecard',explode(':',$parameters['context'])) |
|
501 | - || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
502 | - || in_array('propalcard',explode(':',$parameters['context'])) |
|
503 | - || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
504 | - || in_array('ordercard',explode(':',$parameters['context'])) |
|
505 | - || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
506 | - || in_array('invoicereccard',explode(':',$parameters['context'])) |
|
500 | + in_array('invoicecard', explode(':', $parameters['context'])) |
|
501 | + || in_array('invoicesuppliercard', explode(':', $parameters['context'])) |
|
502 | + || in_array('propalcard', explode(':', $parameters['context'])) |
|
503 | + || in_array('supplier_proposalcard', explode(':', $parameters['context'])) |
|
504 | + || in_array('ordercard', explode(':', $parameters['context'])) |
|
505 | + || in_array('ordersuppliercard', explode(':', $parameters['context'])) |
|
506 | + || in_array('invoicereccard', explode(':', $parameters['context'])) |
|
507 | 507 | ) { |
508 | 508 | |
509 | 509 | global $db; |
510 | 510 | |
511 | 511 | $objFrom = $parameters['objFrom']; |
512 | 512 | |
513 | - foreach($objFrom->lines as $k=> &$lineOld) { |
|
513 | + foreach ($objFrom->lines as $k=> &$lineOld) { |
|
514 | 514 | |
515 | - if($lineOld->product_type == 9 && $lineOld->info_bits > 0 ) { |
|
515 | + if ($lineOld->product_type == 9 && $lineOld->info_bits > 0) { |
|
516 | 516 | |
517 | 517 | $line = & $object->lines[$k]; |
518 | 518 | |
519 | 519 | $idLine = (int) ($line->id ? $line->id : $line->rowid); |
520 | 520 | |
521 | 521 | $db->query("UPDATE ".MAIN_DB_PREFIX.$line->table_element." |
522 | - SET info_bits=".(int)$lineOld->info_bits." |
|
522 | + SET info_bits=".(int) $lineOld->info_bits." |
|
523 | 523 | WHERE rowid = ".$idLine." |
524 | 524 | "); |
525 | 525 | |
@@ -535,15 +535,15 @@ discard block |
||
535 | 535 | |
536 | 536 | function doActions($parameters, &$object, $action, $hookmanager) |
537 | 537 | { |
538 | - global $db, $conf, $langs,$user; |
|
538 | + global $db, $conf, $langs, $user; |
|
539 | 539 | |
540 | 540 | dol_include_once('/subtotal/class/subtotal.class.php'); |
541 | 541 | dol_include_once('/subtotal/lib/subtotal.lib.php'); |
542 | - require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; |
|
542 | + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; |
|
543 | 543 | |
544 | 544 | $showBlockExtrafields = GETPOST('showBlockExtrafields'); |
545 | 545 | |
546 | - if($object->element=='facture') $idvar = 'facid'; |
|
546 | + if ($object->element == 'facture') $idvar = 'facid'; |
|
547 | 547 | else $idvar = 'id'; |
548 | 548 | |
549 | 549 | if ($action == 'updateligne' || $action == 'updateline') |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | if ($line->id == $lineid && TSubtotal::isModSubtotalLine($line)) |
557 | 557 | { |
558 | 558 | $found = true; |
559 | - if(TSubtotal::isTitle($line) && !empty($showBlockExtrafields)) { |
|
559 | + if (TSubtotal::isTitle($line) && !empty($showBlockExtrafields)) { |
|
560 | 560 | $extrafieldsline = new ExtraFields($db); |
561 | 561 | $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); |
562 | 562 | $extrafieldsline->setOptionalsFromPost($extralabelsline, $line); |
@@ -575,43 +575,43 @@ discard block |
||
575 | 575 | exit; // Surtout ne pas laisser Dolibarr faire du traitement sur le updateligne sinon ça plante les données de la ligne |
576 | 576 | } |
577 | 577 | } |
578 | - else if($action === 'builddoc') { |
|
578 | + else if ($action === 'builddoc') { |
|
579 | 579 | |
580 | 580 | if ( |
581 | - in_array('invoicecard',explode(':',$parameters['context'])) |
|
582 | - || in_array('propalcard',explode(':',$parameters['context'])) |
|
583 | - || in_array('ordercard',explode(':',$parameters['context'])) |
|
584 | - || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
585 | - || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
586 | - || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
581 | + in_array('invoicecard', explode(':', $parameters['context'])) |
|
582 | + || in_array('propalcard', explode(':', $parameters['context'])) |
|
583 | + || in_array('ordercard', explode(':', $parameters['context'])) |
|
584 | + || in_array('ordersuppliercard', explode(':', $parameters['context'])) |
|
585 | + || in_array('invoicesuppliercard', explode(':', $parameters['context'])) |
|
586 | + || in_array('supplier_proposalcard', explode(':', $parameters['context'])) |
|
587 | 587 | ) |
588 | 588 | { |
589 | - if(in_array('invoicecard',explode(':',$parameters['context']))) { |
|
589 | + if (in_array('invoicecard', explode(':', $parameters['context']))) { |
|
590 | 590 | $sessname = 'subtotal_hideInnerLines_facture'; |
591 | 591 | $sessname2 = 'subtotal_hidedetails_facture'; |
592 | 592 | $sessname3 = 'subtotal_hideprices_facture'; |
593 | 593 | } |
594 | - elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) { |
|
594 | + elseif (in_array('invoicesuppliercard', explode(':', $parameters['context']))) { |
|
595 | 595 | $sessname = 'subtotal_hideInnerLines_facture_fournisseur'; |
596 | 596 | $sessname2 = 'subtotal_hidedetails_facture_fournisseur'; |
597 | 597 | $sessname3 = 'subtotal_hideprices_facture_fournisseur'; |
598 | 598 | } |
599 | - elseif(in_array('propalcard',explode(':',$parameters['context']))) { |
|
599 | + elseif (in_array('propalcard', explode(':', $parameters['context']))) { |
|
600 | 600 | $sessname = 'subtotal_hideInnerLines_propal'; |
601 | 601 | $sessname2 = 'subtotal_hidedetails_propal'; |
602 | 602 | $sessname3 = 'subtotal_hideprices_propal'; |
603 | 603 | } |
604 | - elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) { |
|
604 | + elseif (in_array('supplier_proposalcard', explode(':', $parameters['context']))) { |
|
605 | 605 | $sessname = 'subtotal_hideInnerLines_supplier_proposal'; |
606 | 606 | $sessname2 = 'subtotal_hidedetails_supplier_proposal'; |
607 | 607 | $sessname3 = 'subtotal_hideprices_supplier_proposal'; |
608 | 608 | } |
609 | - elseif(in_array('ordercard',explode(':',$parameters['context']))) { |
|
609 | + elseif (in_array('ordercard', explode(':', $parameters['context']))) { |
|
610 | 610 | $sessname = 'subtotal_hideInnerLines_commande'; |
611 | 611 | $sessname2 = 'subtotal_hidedetails_commande'; |
612 | 612 | $sessname3 = 'subtotal_hideprices_commande'; |
613 | 613 | } |
614 | - elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) { |
|
614 | + elseif (in_array('ordersuppliercard', explode(':', $parameters['context']))) { |
|
615 | 615 | $sessname = 'subtotal_hideInnerLines_commande_fournisseur'; |
616 | 616 | $sessname2 = 'subtotal_hidedetails_commande_fournisseur'; |
617 | 617 | $sessname3 = 'subtotal_hideprices_commande_fournisseur'; |
@@ -624,25 +624,25 @@ discard block |
||
624 | 624 | |
625 | 625 | global $hideprices; |
626 | 626 | |
627 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
628 | - if(!empty($_SESSION[$sessname]) && !is_array($_SESSION[$sessname][$object->id]) ) $_SESSION[$sessname] = array(); // prevent old system |
|
627 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
628 | + if (!empty($_SESSION[$sessname]) && !is_array($_SESSION[$sessname][$object->id])) $_SESSION[$sessname] = array(); // prevent old system |
|
629 | 629 | $_SESSION[$sessname][$object->id] = $hideInnerLines; |
630 | 630 | |
631 | - $hidedetails= (int)GETPOST('hidedetails'); |
|
632 | - if(!empty($_SESSION[$sessname2]) && !is_array($_SESSION[$sessname2][$object->id]) ) $_SESSION[$sessname2] = array(); // prevent old system |
|
631 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
632 | + if (!empty($_SESSION[$sessname2]) && !is_array($_SESSION[$sessname2][$object->id])) $_SESSION[$sessname2] = array(); // prevent old system |
|
633 | 633 | $_SESSION[$sessname2][$object->id] = $hidedetails; |
634 | 634 | |
635 | - $hideprices= (int)GETPOST('hideprices'); |
|
636 | - if(!empty($_SESSION[$sessname3]) && !is_array($_SESSION[$sessname3][$object->id]) ) $_SESSION[$sessname3] = array(); // prevent old system |
|
635 | + $hideprices = (int) GETPOST('hideprices'); |
|
636 | + if (!empty($_SESSION[$sessname3]) && !is_array($_SESSION[$sessname3][$object->id])) $_SESSION[$sessname3] = array(); // prevent old system |
|
637 | 637 | $_SESSION[$sessname3][$object->id] = $hideprices; |
638 | 638 | |
639 | - foreach($object->lines as &$line) { |
|
639 | + foreach ($object->lines as &$line) { |
|
640 | 640 | if ($line->product_type == 9 && $line->special_code == $this->module_number) { |
641 | 641 | |
642 | - if($line->qty>=90) { |
|
642 | + if ($line->qty >= 90) { |
|
643 | 643 | $line->modsubtotal_total = 1; |
644 | 644 | } |
645 | - else{ |
|
645 | + else { |
|
646 | 646 | $line->modsubtotal_title = 1; |
647 | 647 | } |
648 | 648 | |
@@ -652,34 +652,34 @@ discard block |
||
652 | 652 | } |
653 | 653 | |
654 | 654 | } |
655 | - else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') { |
|
655 | + else if ($action === 'confirm_delete_all_lines' && GETPOST('confirm') == 'yes') { |
|
656 | 656 | |
657 | 657 | $Tab = $this->getArrayOfLineForAGroup($object, GETPOST('lineid')); |
658 | 658 | |
659 | - foreach($Tab as $idLine) { |
|
659 | + foreach ($Tab as $idLine) { |
|
660 | 660 | /** |
661 | 661 | * @var $object Facture |
662 | 662 | */ |
663 | - if($object->element=='facture') $object->deleteline($idLine); |
|
663 | + if ($object->element == 'facture') $object->deleteline($idLine); |
|
664 | 664 | /** |
665 | 665 | * @var $object Facture fournisseur |
666 | 666 | */ |
667 | - else if($object->element=='invoice_supplier') |
|
667 | + else if ($object->element == 'invoice_supplier') |
|
668 | 668 | { |
669 | 669 | $object->deleteline($idLine); |
670 | 670 | } |
671 | 671 | /** |
672 | 672 | * @var $object Propal |
673 | 673 | */ |
674 | - else if($object->element=='propal') $object->deleteline($idLine); |
|
674 | + else if ($object->element == 'propal') $object->deleteline($idLine); |
|
675 | 675 | /** |
676 | 676 | * @var $object Propal Fournisseur |
677 | 677 | */ |
678 | - else if($object->element=='supplier_proposal') $object->deleteline($idLine); |
|
678 | + else if ($object->element == 'supplier_proposal') $object->deleteline($idLine); |
|
679 | 679 | /** |
680 | 680 | * @var $object Commande |
681 | 681 | */ |
682 | - else if($object->element=='commande') |
|
682 | + else if ($object->element == 'commande') |
|
683 | 683 | { |
684 | 684 | if ((float) DOL_VERSION >= 5.0) $object->deleteline($user, $idLine); |
685 | 685 | else $object->deleteline($idLine); |
@@ -687,14 +687,14 @@ discard block |
||
687 | 687 | /** |
688 | 688 | * @var $object Commande fournisseur |
689 | 689 | */ |
690 | - else if($object->element=='order_supplier') |
|
690 | + else if ($object->element == 'order_supplier') |
|
691 | 691 | { |
692 | 692 | $object->deleteline($idLine); |
693 | 693 | } |
694 | 694 | /** |
695 | 695 | * @var $object Facturerec |
696 | 696 | */ |
697 | - else if($object->element=='facturerec') $object->deleteline($idLine); |
|
697 | + else if ($object->element == 'facturerec') $object->deleteline($idLine); |
|
698 | 698 | } |
699 | 699 | |
700 | 700 | header('location:?id='.$object->id); |
@@ -717,7 +717,7 @@ discard block |
||
717 | 717 | return 0; |
718 | 718 | } |
719 | 719 | |
720 | - function formAddObjectLine ($parameters, &$object, &$action, $hookmanager) { |
|
720 | + function formAddObjectLine($parameters, &$object, &$action, $hookmanager) { |
|
721 | 721 | return 0; |
722 | 722 | } |
723 | 723 | |
@@ -729,22 +729,22 @@ discard block |
||
729 | 729 | |
730 | 730 | $found = false; |
731 | 731 | |
732 | - $Tab= array(); |
|
732 | + $Tab = array(); |
|
733 | 733 | |
734 | - foreach($object->lines as $l) { |
|
734 | + foreach ($object->lines as $l) { |
|
735 | 735 | |
736 | 736 | $lid = (!empty($l->rowid) ? $l->rowid : $l->id); |
737 | - if($lid == $lineid) { |
|
737 | + if ($lid == $lineid) { |
|
738 | 738 | |
739 | 739 | $found = true; |
740 | 740 | $qty_line = $l->qty; |
741 | 741 | } |
742 | 742 | |
743 | - if($found) { |
|
743 | + if ($found) { |
|
744 | 744 | |
745 | 745 | $Tab[] = (!empty($l->rowid) ? $l->rowid : $l->id); |
746 | 746 | |
747 | - if($l->special_code==$this->module_number && (($l->qty==99 && $qty_line==1) || ($l->qty==98 && $qty_line==2)) ) { |
|
747 | + if ($l->special_code == $this->module_number && (($l->qty == 99 && $qty_line == 1) || ($l->qty == 98 && $qty_line == 2))) { |
|
748 | 748 | break; // end of story |
749 | 749 | } |
750 | 750 | } |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | * |
774 | 774 | * @param $use_level isn't used anymore |
775 | 775 | */ |
776 | - function getTotalLineFromObject(&$object, &$line, $use_level=false, $return_all=0) { |
|
776 | + function getTotalLineFromObject(&$object, &$line, $use_level = false, $return_all = 0) { |
|
777 | 777 | |
778 | 778 | $rang = $line->rang; |
779 | 779 | $qty_line = $line->qty; |
@@ -784,21 +784,21 @@ discard block |
||
784 | 784 | $TTotal_tva = array(); |
785 | 785 | |
786 | 786 | dol_include_once('/subtotal/class/subtotal.class.php'); |
787 | - foreach($object->lines as $l) { |
|
787 | + foreach ($object->lines as $l) { |
|
788 | 788 | //print $l->rang.'>='.$rang.' '.$total.'<br/>'; |
789 | - if($l->rang>=$rang) { |
|
789 | + if ($l->rang >= $rang) { |
|
790 | 790 | //echo 'return!<br>'; |
791 | 791 | if (!$return_all) return $total; |
792 | 792 | else return array($total, $total_tva, $total_ttc, $TTotal_tva); |
793 | 793 | } |
794 | - else if(TSubtotal::isTitle($l, 100 - $qty_line)) |
|
794 | + else if (TSubtotal::isTitle($l, 100 - $qty_line)) |
|
795 | 795 | { |
796 | 796 | $total = 0; |
797 | 797 | $total_tva = 0; |
798 | 798 | $total_ttc = 0; |
799 | 799 | $TTotal_tva = array(); |
800 | 800 | } |
801 | - elseif(!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) { |
|
801 | + elseif (!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) { |
|
802 | 802 | $total += $l->total_ht; |
803 | 803 | $total_tva += $l->total_tva; |
804 | 804 | $TTotal_tva[$l->tva_tx] += $l->total_tva; |
@@ -817,18 +817,18 @@ discard block |
||
817 | 817 | |
818 | 818 | $rang = $line->rang; |
819 | 819 | $total = 0; |
820 | - foreach($object->lines as $l) { |
|
821 | - if($l->rang>=$rang) { |
|
820 | + foreach ($object->lines as $l) { |
|
821 | + if ($l->rang >= $rang) { |
|
822 | 822 | return price($total); |
823 | 823 | } |
824 | - if (TSubtotal::isSubtotal($l)){ |
|
824 | + if (TSubtotal::isSubtotal($l)) { |
|
825 | 825 | $total = 0; |
826 | - } else if ($l->situation_percent > 0 ){ |
|
826 | + } else if ($l->situation_percent > 0) { |
|
827 | 827 | |
828 | 828 | |
829 | 829 | $prev_progress = $l->get_prev_progress($object->id); |
830 | - $progress = ($l->situation_percent - $prev_progress) /100; |
|
831 | - $total += ($l->total_ht/($l->situation_percent/100)) * $progress; |
|
830 | + $progress = ($l->situation_percent - $prev_progress) / 100; |
|
831 | + $total += ($l->total_ht / ($l->situation_percent / 100)) * $progress; |
|
832 | 832 | |
833 | 833 | } |
834 | 834 | } |
@@ -847,10 +847,10 @@ discard block |
||
847 | 847 | * @param $w float width |
848 | 848 | * @param $h float height |
849 | 849 | */ |
850 | - function pdf_add_total(&$pdf,&$object, &$line, $label, $description,$posx, $posy, $w, $h) { |
|
851 | - global $conf,$subtotal_last_title_posy; |
|
850 | + function pdf_add_total(&$pdf, &$object, &$line, $label, $description, $posx, $posy, $w, $h) { |
|
851 | + global $conf, $subtotal_last_title_posy; |
|
852 | 852 | |
853 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
853 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
854 | 854 | if (!empty($conf->global->SUBTOTAL_ONE_LINE_IF_HIDE_INNERLINES) && $hideInnerLines && !empty($subtotal_last_title_posy)) |
855 | 855 | { |
856 | 856 | $posy = $subtotal_last_title_posy; |
@@ -860,34 +860,34 @@ discard block |
||
860 | 860 | $hidePriceOnSubtotalLines = (int) GETPOST('hide_price_on_subtotal_lines'); |
861 | 861 | |
862 | 862 | $set_pagebreak_margin = false; |
863 | - if(method_exists('Closure','bind')) { |
|
863 | + if (method_exists('Closure', 'bind')) { |
|
864 | 864 | $pageBreakOriginalValue = $pdf->AcceptPageBreak(); |
865 | - $sweetsThief = function ($pdf) { |
|
866 | - return $pdf->bMargin ; |
|
865 | + $sweetsThief = function($pdf) { |
|
866 | + return $pdf->bMargin; |
|
867 | 867 | }; |
868 | 868 | $sweetsThief = Closure::bind($sweetsThief, null, $pdf); |
869 | 869 | |
870 | - $bMargin = $sweetsThief($pdf); |
|
870 | + $bMargin = $sweetsThief($pdf); |
|
871 | 871 | |
872 | - $pdf->SetAutoPageBreak( false ); |
|
872 | + $pdf->SetAutoPageBreak(false); |
|
873 | 873 | |
874 | 874 | $set_pagebreak_margin = true; |
875 | 875 | } |
876 | 876 | |
877 | 877 | |
878 | - if($line->qty==99) |
|
879 | - $pdf->SetFillColor(220,220,220); |
|
880 | - elseif ($line->qty==98) |
|
881 | - $pdf->SetFillColor(230,230,230); |
|
878 | + if ($line->qty == 99) |
|
879 | + $pdf->SetFillColor(220, 220, 220); |
|
880 | + elseif ($line->qty == 98) |
|
881 | + $pdf->SetFillColor(230, 230, 230); |
|
882 | 882 | else |
883 | - $pdf->SetFillColor(240,240,240); |
|
883 | + $pdf->SetFillColor(240, 240, 240); |
|
884 | 884 | |
885 | 885 | $style = 'B'; |
886 | 886 | if (!empty($conf->global->SUBTOTAL_SUBTOTAL_STYLE)) $style = $conf->global->SUBTOTAL_SUBTOTAL_STYLE; |
887 | 887 | |
888 | 888 | $pdf->SetFont('', $style, 9); |
889 | 889 | |
890 | - $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'R',true); |
|
890 | + $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'R', true); |
|
891 | 891 | // var_dump($bMargin); |
892 | 892 | $pageAfter = $pdf->getPage(); |
893 | 893 | |
@@ -912,7 +912,7 @@ discard block |
||
912 | 912 | } |
913 | 913 | } |
914 | 914 | |
915 | - if($total_to_print !== '') { |
|
915 | + if ($total_to_print !== '') { |
|
916 | 916 | |
917 | 917 | if (GETPOST('hideInnerLines')) |
918 | 918 | { |
@@ -926,7 +926,7 @@ discard block |
||
926 | 926 | else |
927 | 927 | { |
928 | 928 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
929 | - if(get_class($object) == 'Facture' && $object->type==Facture::TYPE_SITUATION){//Facture de situation |
|
929 | + if (get_class($object) == 'Facture' && $object->type == Facture::TYPE_SITUATION) {//Facture de situation |
|
930 | 930 | $total_to_print = $this->getTotalToPrintSituation($object, $line); |
931 | 931 | } else { |
932 | 932 | $total_to_print = price($total); |
@@ -940,11 +940,11 @@ discard block |
||
940 | 940 | } |
941 | 941 | |
942 | 942 | $pdf->SetXY($pdf->postotalht, $posy); |
943 | - if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
944 | - $pdf->MultiCell($pdf->page_largeur-$pdf->marge_droite-$pdf->postotalht, 3, $total_to_print, 0, 'R', 0); |
|
943 | + if ($set_pagebreak_margin) $pdf->SetAutoPageBreak($pageBreakOriginalValue, $bMargin); |
|
944 | + $pdf->MultiCell($pdf->page_largeur - $pdf->marge_droite - $pdf->postotalht, 3, $total_to_print, 0, 'R', 0); |
|
945 | 945 | } |
946 | - else{ |
|
947 | - if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
946 | + else { |
|
947 | + if ($set_pagebreak_margin) $pdf->SetAutoPageBreak($pageBreakOriginalValue, $bMargin); |
|
948 | 948 | } |
949 | 949 | |
950 | 950 | $posy = $posy + $cell_height; |
@@ -964,22 +964,22 @@ discard block |
||
964 | 964 | * @param $w float width |
965 | 965 | * @param $h float height |
966 | 966 | */ |
967 | - function pdf_add_title(&$pdf,&$object, &$line, $label, $description,$posx, $posy, $w, $h) { |
|
967 | + function pdf_add_title(&$pdf, &$object, &$line, $label, $description, $posx, $posy, $w, $h) { |
|
968 | 968 | |
969 | - global $db,$conf,$subtotal_last_title_posy; |
|
969 | + global $db, $conf, $subtotal_last_title_posy; |
|
970 | 970 | |
971 | 971 | $subtotal_last_title_posy = $posy; |
972 | - $pdf->SetXY ($posx, $posy); |
|
972 | + $pdf->SetXY($posx, $posy); |
|
973 | 973 | |
974 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
974 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
975 | 975 | |
976 | 976 | |
977 | 977 | |
978 | - $style = ($line->qty==1) ? 'BU' : 'BUI'; |
|
978 | + $style = ($line->qty == 1) ? 'BU' : 'BUI'; |
|
979 | 979 | if (!empty($conf->global->SUBTOTAL_TITLE_STYLE)) $style = $conf->global->SUBTOTAL_TITLE_STYLE; |
980 | 980 | |
981 | - if($hideInnerLines) { |
|
982 | - if($line->qty==1)$pdf->SetFont('', $style, 9); |
|
981 | + if ($hideInnerLines) { |
|
982 | + if ($line->qty == 1)$pdf->SetFont('', $style, 9); |
|
983 | 983 | else |
984 | 984 | { |
985 | 985 | if (!empty($conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES)) $style = $conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES; |
@@ -988,43 +988,43 @@ discard block |
||
988 | 988 | } |
989 | 989 | else { |
990 | 990 | |
991 | - if($line->qty==1)$pdf->SetFont('', $style, 9); //TODO if super utile |
|
991 | + if ($line->qty == 1)$pdf->SetFont('', $style, 9); //TODO if super utile |
|
992 | 992 | else $pdf->SetFont('', $style, 9); |
993 | 993 | |
994 | 994 | } |
995 | 995 | |
996 | 996 | 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 |
997 | - else $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J',true); // et maintenant avec du HTML |
|
997 | + else $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J', true); // et maintenant avec du HTML |
|
998 | 998 | |
999 | - if($description && !$hidedesc) { |
|
999 | + if ($description && !$hidedesc) { |
|
1000 | 1000 | $posy = $pdf->GetY(); |
1001 | 1001 | |
1002 | 1002 | $pdf->SetFont('', '', 8); |
1003 | 1003 | |
1004 | - $pdf->writeHTMLCell($w, $h, $posx, $posy, $description, 0, 1, false, true, 'J',true); |
|
1004 | + $pdf->writeHTMLCell($w, $h, $posx, $posy, $description, 0, 1, false, true, 'J', true); |
|
1005 | 1005 | |
1006 | 1006 | } |
1007 | 1007 | |
1008 | 1008 | } |
1009 | 1009 | |
1010 | - function pdf_writelinedesc_ref($parameters=array(), &$object, &$action='') { |
|
1010 | + function pdf_writelinedesc_ref($parameters = array(), &$object, &$action = '') { |
|
1011 | 1011 | // ultimate PDF hook O_o |
1012 | 1012 | |
1013 | - return $this->pdf_writelinedesc($parameters,$object,$action); |
|
1013 | + return $this->pdf_writelinedesc($parameters, $object, $action); |
|
1014 | 1014 | |
1015 | 1015 | } |
1016 | 1016 | |
1017 | 1017 | function isModSubtotalLine(&$parameters, &$object) { |
1018 | 1018 | |
1019 | - if(is_array($parameters)) { |
|
1019 | + if (is_array($parameters)) { |
|
1020 | 1020 | $i = & $parameters['i']; |
1021 | 1021 | } |
1022 | 1022 | else { |
1023 | - $i = (int)$parameters; |
|
1023 | + $i = (int) $parameters; |
|
1024 | 1024 | } |
1025 | 1025 | |
1026 | 1026 | |
1027 | - if($object->lines[$i]->special_code == $this->module_number && $object->lines[$i]->product_type == 9) { |
|
1027 | + if ($object->lines[$i]->special_code == $this->module_number && $object->lines[$i]->product_type == 9) { |
|
1028 | 1028 | return true; |
1029 | 1029 | } |
1030 | 1030 | |
@@ -1032,43 +1032,43 @@ discard block |
||
1032 | 1032 | |
1033 | 1033 | } |
1034 | 1034 | |
1035 | - function pdf_getlineqty($parameters=array(), &$object, &$action='') { |
|
1036 | - global $conf,$hideprices; |
|
1035 | + function pdf_getlineqty($parameters = array(), &$object, &$action = '') { |
|
1036 | + global $conf, $hideprices; |
|
1037 | 1037 | |
1038 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1038 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1039 | 1039 | |
1040 | 1040 | $this->resprints = ' '; |
1041 | 1041 | |
1042 | - if((float)DOL_VERSION<=3.6) { |
|
1042 | + if ((float) DOL_VERSION <= 3.6) { |
|
1043 | 1043 | return ''; |
1044 | 1044 | } |
1045 | - else if((float)DOL_VERSION>=3.8) { |
|
1045 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1046 | 1046 | return 1; |
1047 | 1047 | } |
1048 | 1048 | |
1049 | 1049 | } |
1050 | - elseif(!empty($hideprices)) { |
|
1050 | + elseif (!empty($hideprices)) { |
|
1051 | 1051 | $this->resprints = $object->lines[$parameters['i']]->qty; |
1052 | 1052 | return 1; |
1053 | 1053 | } |
1054 | 1054 | elseif (!empty($conf->global->SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY)) |
1055 | 1055 | { |
1056 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
1057 | - $hidedetails = (int)GETPOST('hidedetails'); |
|
1056 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
1057 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
1058 | 1058 | if (empty($hideInnerLines) && !empty($hidedetails)) |
1059 | 1059 | { |
1060 | 1060 | $this->resprints = $object->lines[$parameters['i']]->qty; |
1061 | 1061 | } |
1062 | 1062 | } |
1063 | 1063 | |
1064 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1065 | - else $i = (int)$parameters; |
|
1064 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1065 | + else $i = (int) $parameters; |
|
1066 | 1066 | |
1067 | 1067 | 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) |
1068 | 1068 | |
1069 | - if(empty($object->lines[$i]->array_options)) $object->lines[$i]->fetch_optionals(); |
|
1069 | + if (empty($object->lines[$i]->array_options)) $object->lines[$i]->fetch_optionals(); |
|
1070 | 1070 | |
1071 | - if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1071 | + if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
1072 | 1072 | { |
1073 | 1073 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
1074 | 1074 | { |
@@ -1080,20 +1080,20 @@ discard block |
||
1080 | 1080 | return 0; |
1081 | 1081 | } |
1082 | 1082 | |
1083 | - function pdf_getlinetotalexcltax($parameters=array(), &$object, &$action='') { |
|
1083 | + function pdf_getlinetotalexcltax($parameters = array(), &$object, &$action = '') { |
|
1084 | 1084 | global $conf, $hideprices, $hookmanager; |
1085 | 1085 | |
1086 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1087 | - else $i = (int)$parameters; |
|
1086 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1087 | + else $i = (int) $parameters; |
|
1088 | 1088 | |
1089 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1089 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1090 | 1090 | |
1091 | 1091 | $this->resprints = ' '; |
1092 | 1092 | |
1093 | - if((float)DOL_VERSION<=3.6) { |
|
1093 | + if ((float) DOL_VERSION <= 3.6) { |
|
1094 | 1094 | return ''; |
1095 | 1095 | } |
1096 | - else if((float)DOL_VERSION>=3.8) { |
|
1096 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1097 | 1097 | return 1; |
1098 | 1098 | } |
1099 | 1099 | |
@@ -1119,7 +1119,7 @@ discard block |
||
1119 | 1119 | } |
1120 | 1120 | } |
1121 | 1121 | } |
1122 | - if ((int)GETPOST('hideInnerLines') && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)){ |
|
1122 | + if ((int) GETPOST('hideInnerLines') && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) { |
|
1123 | 1123 | $this->resprints = price($object->lines[$i]->total_ht); |
1124 | 1124 | } |
1125 | 1125 | |
@@ -1144,7 +1144,7 @@ discard block |
||
1144 | 1144 | { |
1145 | 1145 | // Check if a title exist for this line && if the title have subtotal |
1146 | 1146 | $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
1147 | - if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
1147 | + if (TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
1148 | 1148 | { |
1149 | 1149 | |
1150 | 1150 | $this->resprints = ' '; |
@@ -1164,7 +1164,7 @@ discard block |
||
1164 | 1164 | */ |
1165 | 1165 | private function callHook(&$object, &$hookmanager, $action, $params, $defaultReturn = 1) |
1166 | 1166 | { |
1167 | - $reshook=$hookmanager->executeHooks('subtotalHidePrices',$params, $object, $action); |
|
1167 | + $reshook = $hookmanager->executeHooks('subtotalHidePrices', $params, $object, $action); |
|
1168 | 1168 | if ($reshook < 0) |
1169 | 1169 | { |
1170 | 1170 | $this->error = $hookmanager->error; |
@@ -1180,7 +1180,7 @@ discard block |
||
1180 | 1180 | $this->resprints = $hookmanager->resprints; |
1181 | 1181 | |
1182 | 1182 | // override return (use $this->results['overrideReturn'] or $this->resArray['overrideReturn'] in other module action_xxxx.class.php ) |
1183 | - if(isset($hookmanager->resArray['overrideReturn'])) |
|
1183 | + if (isset($hookmanager->resArray['overrideReturn'])) |
|
1184 | 1184 | { |
1185 | 1185 | return $hookmanager->resArray['overrideReturn']; |
1186 | 1186 | } |
@@ -1189,25 +1189,25 @@ discard block |
||
1189 | 1189 | return $defaultReturn; |
1190 | 1190 | } |
1191 | 1191 | |
1192 | - function pdf_getlinetotalwithtax($parameters=array(), &$object, &$action='') { |
|
1192 | + function pdf_getlinetotalwithtax($parameters = array(), &$object, &$action = '') { |
|
1193 | 1193 | global $conf; |
1194 | 1194 | |
1195 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1195 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1196 | 1196 | |
1197 | 1197 | $this->resprints = ' '; |
1198 | 1198 | |
1199 | - if((float)DOL_VERSION<=3.6) { |
|
1199 | + if ((float) DOL_VERSION <= 3.6) { |
|
1200 | 1200 | return ''; |
1201 | 1201 | } |
1202 | - else if((float)DOL_VERSION>=3.8) { |
|
1202 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1203 | 1203 | return 1; |
1204 | 1204 | } |
1205 | 1205 | } |
1206 | 1206 | |
1207 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1208 | - else $i = (int)$parameters; |
|
1207 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1208 | + else $i = (int) $parameters; |
|
1209 | 1209 | |
1210 | - if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1210 | + if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
1211 | 1211 | { |
1212 | 1212 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
1213 | 1213 | { |
@@ -1219,24 +1219,24 @@ discard block |
||
1219 | 1219 | return 0; |
1220 | 1220 | } |
1221 | 1221 | |
1222 | - function pdf_getlineunit($parameters=array(), &$object, &$action='') { |
|
1222 | + function pdf_getlineunit($parameters = array(), &$object, &$action = '') { |
|
1223 | 1223 | global $conf; |
1224 | 1224 | |
1225 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1225 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1226 | 1226 | $this->resprints = ' '; |
1227 | 1227 | |
1228 | - if((float)DOL_VERSION<=3.6) { |
|
1228 | + if ((float) DOL_VERSION <= 3.6) { |
|
1229 | 1229 | return ''; |
1230 | 1230 | } |
1231 | - else if((float)DOL_VERSION>=3.8) { |
|
1231 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1232 | 1232 | return 1; |
1233 | 1233 | } |
1234 | 1234 | } |
1235 | 1235 | |
1236 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1237 | - else $i = (int)$parameters; |
|
1236 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1237 | + else $i = (int) $parameters; |
|
1238 | 1238 | |
1239 | - if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1239 | + if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
1240 | 1240 | { |
1241 | 1241 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
1242 | 1242 | { |
@@ -1248,21 +1248,21 @@ discard block |
||
1248 | 1248 | return 0; |
1249 | 1249 | } |
1250 | 1250 | |
1251 | - function pdf_getlineupexcltax($parameters=array(), &$object, &$action='') { |
|
1252 | - global $conf,$hideprices,$hookmanager; |
|
1251 | + function pdf_getlineupexcltax($parameters = array(), &$object, &$action = '') { |
|
1252 | + global $conf, $hideprices, $hookmanager; |
|
1253 | 1253 | |
1254 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1254 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1255 | 1255 | $this->resprints = ' '; |
1256 | 1256 | |
1257 | - if((float)DOL_VERSION<=3.6) { |
|
1257 | + if ((float) DOL_VERSION <= 3.6) { |
|
1258 | 1258 | return ''; |
1259 | 1259 | } |
1260 | - else if((float)DOL_VERSION>=3.8) { |
|
1260 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1261 | 1261 | return 1; |
1262 | 1262 | } |
1263 | 1263 | } |
1264 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1265 | - else $i = (int)$parameters; |
|
1264 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1265 | + else $i = (int) $parameters; |
|
1266 | 1266 | |
1267 | 1267 | |
1268 | 1268 | // Si la gestion C/NC est active et que je suis sur un ligne dont l'extrafield est coché |
@@ -1288,7 +1288,7 @@ discard block |
||
1288 | 1288 | |
1289 | 1289 | // Check if a title exist for this line && if the title have subtotal |
1290 | 1290 | $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
1291 | - if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
1291 | + if (TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
1292 | 1292 | { |
1293 | 1293 | |
1294 | 1294 | $this->resprints = ' '; |
@@ -1302,24 +1302,24 @@ discard block |
||
1302 | 1302 | return 0; |
1303 | 1303 | } |
1304 | 1304 | |
1305 | - function pdf_getlineupwithtax($parameters=array(), &$object, &$action='') { |
|
1306 | - global $conf,$hideprices; |
|
1305 | + function pdf_getlineupwithtax($parameters = array(), &$object, &$action = '') { |
|
1306 | + global $conf, $hideprices; |
|
1307 | 1307 | |
1308 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1308 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1309 | 1309 | $this->resprints = ' '; |
1310 | - if((float)DOL_VERSION<=3.6) { |
|
1310 | + if ((float) DOL_VERSION <= 3.6) { |
|
1311 | 1311 | return ''; |
1312 | 1312 | } |
1313 | - else if((float)DOL_VERSION>=3.8) { |
|
1313 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1314 | 1314 | return 1; |
1315 | 1315 | } |
1316 | 1316 | } |
1317 | 1317 | |
1318 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1319 | - else $i = (int)$parameters; |
|
1318 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1319 | + else $i = (int) $parameters; |
|
1320 | 1320 | |
1321 | 1321 | if (!empty($hideprices) |
1322 | - || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1322 | + || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
1323 | 1323 | ) |
1324 | 1324 | { |
1325 | 1325 | if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
@@ -1332,22 +1332,22 @@ discard block |
||
1332 | 1332 | return 0; |
1333 | 1333 | } |
1334 | 1334 | |
1335 | - function pdf_getlinevatrate($parameters=array(), &$object, &$action='') { |
|
1336 | - global $conf,$hideprices,$hookmanager; |
|
1335 | + function pdf_getlinevatrate($parameters = array(), &$object, &$action = '') { |
|
1336 | + global $conf, $hideprices, $hookmanager; |
|
1337 | 1337 | |
1338 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1338 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1339 | 1339 | $this->resprints = ' '; |
1340 | 1340 | |
1341 | - if((float)DOL_VERSION<=3.6) { |
|
1341 | + if ((float) DOL_VERSION <= 3.6) { |
|
1342 | 1342 | return ''; |
1343 | 1343 | } |
1344 | - else if((float)DOL_VERSION>=3.8) { |
|
1344 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1345 | 1345 | return 1; |
1346 | 1346 | } |
1347 | 1347 | } |
1348 | 1348 | |
1349 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1350 | - else $i = (int)$parameters; |
|
1349 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1350 | + else $i = (int) $parameters; |
|
1351 | 1351 | |
1352 | 1352 | 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) |
1353 | 1353 | |
@@ -1374,7 +1374,7 @@ discard block |
||
1374 | 1374 | |
1375 | 1375 | // Check if a title exist for this line && if the title have subtotal |
1376 | 1376 | $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
1377 | - if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
1377 | + if (TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
1378 | 1378 | { |
1379 | 1379 | |
1380 | 1380 | $this->resprints = ' '; |
@@ -1388,23 +1388,23 @@ discard block |
||
1388 | 1388 | return 0; |
1389 | 1389 | } |
1390 | 1390 | |
1391 | - function pdf_getlineprogress($parameters=array(), &$object, &$action) { |
|
1391 | + function pdf_getlineprogress($parameters = array(), &$object, &$action) { |
|
1392 | 1392 | global $conf; |
1393 | 1393 | |
1394 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1394 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1395 | 1395 | $this->resprints = ' '; |
1396 | - if((float)DOL_VERSION<=3.6) { |
|
1396 | + if ((float) DOL_VERSION <= 3.6) { |
|
1397 | 1397 | return ''; |
1398 | 1398 | } |
1399 | - else if((float)DOL_VERSION>=3.8) { |
|
1399 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1400 | 1400 | return 1; |
1401 | 1401 | } |
1402 | 1402 | } |
1403 | 1403 | |
1404 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1405 | - else $i = (int)$parameters; |
|
1404 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1405 | + else $i = (int) $parameters; |
|
1406 | 1406 | |
1407 | - if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1407 | + if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
1408 | 1408 | { |
1409 | 1409 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
1410 | 1410 | { |
@@ -1419,12 +1419,12 @@ discard block |
||
1419 | 1419 | function add_numerotation(&$object) { |
1420 | 1420 | global $conf; |
1421 | 1421 | |
1422 | - if(!empty($conf->global->SUBTOTAL_USE_NUMEROTATION)) { |
|
1422 | + if (!empty($conf->global->SUBTOTAL_USE_NUMEROTATION)) { |
|
1423 | 1423 | |
1424 | 1424 | $TLevelTitre = array(); |
1425 | 1425 | $prevlevel = 0; |
1426 | 1426 | |
1427 | - foreach($object->lines as $k=>&$line) |
|
1427 | + foreach ($object->lines as $k=>&$line) |
|
1428 | 1428 | { |
1429 | 1429 | if ($line->id > 0 && $this->isModSubtotalLine($k, $object) && $line->qty <= 10) |
1430 | 1430 | { |
@@ -1438,12 +1438,12 @@ discard block |
||
1438 | 1438 | } |
1439 | 1439 | |
1440 | 1440 | // TODO ne gère pas encore la numération des lignes "Totaux" |
1441 | - private function formatNumerotation(&$TLineTitle, $line_reference='', $level=1, $prefix_num=0) |
|
1441 | + private function formatNumerotation(&$TLineTitle, $line_reference = '', $level = 1, $prefix_num = 0) |
|
1442 | 1442 | { |
1443 | 1443 | $TTitle = array(); |
1444 | 1444 | |
1445 | - $i=1; |
|
1446 | - $j=0; |
|
1445 | + $i = 1; |
|
1446 | + $j = 0; |
|
1447 | 1447 | foreach ($TLineTitle as $k => &$line) |
1448 | 1448 | { |
1449 | 1449 | if (!empty($line_reference) && $line->rang <= $line_reference->rang) continue; |
@@ -1453,7 +1453,7 @@ discard block |
||
1453 | 1453 | { |
1454 | 1454 | $TTitle[$j]['numerotation'] = ($prefix_num == 0) ? $i : $prefix_num.'.'.$i; |
1455 | 1455 | //var_dump('Prefix == '.$prefix_num.' // '.$line->desc.' ==> numerotation == '.$TTitle[$j]['numerotation'].' ### '.$line->qty .'=='. $level); |
1456 | - if (empty($line->label) && (float)DOL_VERSION < 6) |
|
1456 | + if (empty($line->label) && (float) DOL_VERSION < 6) |
|
1457 | 1457 | { |
1458 | 1458 | $line->label = !empty($line->desc) ? $line->desc : $line->description; |
1459 | 1459 | $line->desc = $line->description = ''; |
@@ -1479,26 +1479,26 @@ discard block |
||
1479 | 1479 | |
1480 | 1480 | function setDocTVA(&$pdf, &$object) { |
1481 | 1481 | |
1482 | - $hidedetails = (int)GETPOST('hidedetails'); |
|
1482 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
1483 | 1483 | |
1484 | - if(empty($hidedetails)) return false; |
|
1484 | + if (empty($hidedetails)) return false; |
|
1485 | 1485 | |
1486 | 1486 | // TODO can't add VAT to document without lines... :-/ |
1487 | 1487 | |
1488 | 1488 | return true; |
1489 | 1489 | } |
1490 | 1490 | |
1491 | - function beforePDFCreation($parameters=array(), &$object, &$action) |
|
1491 | + function beforePDFCreation($parameters = array(), &$object, &$action) |
|
1492 | 1492 | { |
1493 | 1493 | /** |
1494 | 1494 | * @var $pdf TCPDF |
1495 | 1495 | */ |
1496 | - global $pdf,$conf, $langs; |
|
1496 | + global $pdf, $conf, $langs; |
|
1497 | 1497 | |
1498 | 1498 | // var_dump($object->lines); |
1499 | 1499 | dol_include_once('/subtotal/class/subtotal.class.php'); |
1500 | 1500 | |
1501 | - foreach($parameters as $key=>$value) { |
|
1501 | + foreach ($parameters as $key=>$value) { |
|
1502 | 1502 | ${$key} = $value; |
1503 | 1503 | } |
1504 | 1504 | |
@@ -1507,25 +1507,25 @@ discard block |
||
1507 | 1507 | $this->add_numerotation($object); |
1508 | 1508 | |
1509 | 1509 | |
1510 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
1511 | - $hidedetails = (int)GETPOST('hidedetails'); |
|
1510 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
1511 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
1512 | 1512 | |
1513 | 1513 | if ($hideInnerLines) { // si c une ligne de titre |
1514 | - $fk_parent_line=0; |
|
1515 | - $TLines =array(); |
|
1514 | + $fk_parent_line = 0; |
|
1515 | + $TLines = array(); |
|
1516 | 1516 | |
1517 | - $original_count=count($object->lines); |
|
1517 | + $original_count = count($object->lines); |
|
1518 | 1518 | $TTvas = array(); // tableau de tva |
1519 | 1519 | |
1520 | - foreach($object->lines as $k=>&$line) |
|
1520 | + foreach ($object->lines as $k=>&$line) |
|
1521 | 1521 | { |
1522 | 1522 | |
1523 | - if($line->product_type==9 && $line->rowid>0) |
|
1523 | + if ($line->product_type == 9 && $line->rowid > 0) |
|
1524 | 1524 | { |
1525 | 1525 | $fk_parent_line = $line->rowid; |
1526 | 1526 | |
1527 | 1527 | // 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 |
1528 | - if(TSubtotal::isSubtotal($line)) |
|
1528 | + if (TSubtotal::isSubtotal($line)) |
|
1529 | 1529 | { |
1530 | 1530 | /*$total = $this->getTotalLineFromObject($object, $line, ''); |
1531 | 1531 | |
@@ -1545,22 +1545,22 @@ discard block |
||
1545 | 1545 | |
1546 | 1546 | if ($hideInnerLines) |
1547 | 1547 | { |
1548 | - if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
1548 | + if (!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
1549 | 1549 | { |
1550 | - if($line->tva_tx != '0.000' && $line->product_type!=9){ |
|
1550 | + if ($line->tva_tx != '0.000' && $line->product_type != 9) { |
|
1551 | 1551 | |
1552 | 1552 | // on remplit le tableau de tva pour substituer les lignes cachées |
1553 | 1553 | $TTvas[$line->tva_tx]['total_tva'] += $line->total_tva; |
1554 | 1554 | $TTvas[$line->tva_tx]['total_ht'] += $line->total_ht; |
1555 | 1555 | $TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; |
1556 | 1556 | } |
1557 | - if($line->product_type==9 && $line->rowid>0) |
|
1557 | + if ($line->product_type == 9 && $line->rowid > 0) |
|
1558 | 1558 | { |
1559 | 1559 | //Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres |
1560 | 1560 | // génère des lignes d'affichage des montants HT soumis à tva |
1561 | 1561 | $nbtva = count($TTvas); |
1562 | - if(!empty($nbtva)){ |
|
1563 | - foreach ($TTvas as $tx =>$val){ |
|
1562 | + if (!empty($nbtva)) { |
|
1563 | + foreach ($TTvas as $tx =>$val) { |
|
1564 | 1564 | $l = clone $line; |
1565 | 1565 | $l->product_type = 1; |
1566 | 1566 | $l->special_code = ''; |
@@ -1581,7 +1581,7 @@ discard block |
||
1581 | 1581 | } |
1582 | 1582 | } else { |
1583 | 1583 | |
1584 | - if($line->product_type==9 && $line->rowid>0) |
|
1584 | + if ($line->product_type == 9 && $line->rowid > 0) |
|
1585 | 1585 | { |
1586 | 1586 | // ajoute la ligne de sous-total |
1587 | 1587 | $TLines[] = $line; |
@@ -1609,9 +1609,9 @@ discard block |
||
1609 | 1609 | |
1610 | 1610 | // cas incongru où il y aurait des produits en dessous du dernier sous-total |
1611 | 1611 | $nbtva = count($TTvas); |
1612 | - if(!empty($nbtva) && $hideInnerLines && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
1612 | + if (!empty($nbtva) && $hideInnerLines && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
1613 | 1613 | { |
1614 | - foreach ($TTvas as $tx =>$val){ |
|
1614 | + foreach ($TTvas as $tx =>$val) { |
|
1615 | 1615 | $l = clone $line; |
1616 | 1616 | $l->product_type = 1; |
1617 | 1617 | $l->special_code = ''; |
@@ -1628,11 +1628,11 @@ discard block |
||
1628 | 1628 | } |
1629 | 1629 | |
1630 | 1630 | global $nblignes; |
1631 | - $nblignes=count($TLines); |
|
1631 | + $nblignes = count($TLines); |
|
1632 | 1632 | |
1633 | 1633 | $object->lines = $TLines; |
1634 | 1634 | |
1635 | - if($i>count($object->lines)) { |
|
1635 | + if ($i > count($object->lines)) { |
|
1636 | 1636 | $this->resprints = ''; |
1637 | 1637 | return 0; |
1638 | 1638 | } |
@@ -1641,59 +1641,59 @@ discard block |
||
1641 | 1641 | return 0; |
1642 | 1642 | } |
1643 | 1643 | |
1644 | - function pdf_writelinedesc($parameters=array(), &$object, &$action) |
|
1644 | + function pdf_writelinedesc($parameters = array(), &$object, &$action) |
|
1645 | 1645 | { |
1646 | 1646 | /** |
1647 | 1647 | * @var $pdf TCPDF |
1648 | 1648 | */ |
1649 | - global $pdf,$conf; |
|
1649 | + global $pdf, $conf; |
|
1650 | 1650 | |
1651 | - foreach($parameters as $key=>$value) { |
|
1651 | + foreach ($parameters as $key=>$value) { |
|
1652 | 1652 | ${$key} = $value; |
1653 | 1653 | } |
1654 | 1654 | |
1655 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
1656 | - $hidedetails = (int)GETPOST('hidedetails'); |
|
1655 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
1656 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
1657 | 1657 | |
1658 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1658 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1659 | 1659 | |
1660 | 1660 | global $hideprices; |
1661 | 1661 | |
1662 | - if(!empty($hideprices)) { |
|
1663 | - foreach($object->lines as &$line) { |
|
1664 | - if($line->fk_product_type!=9) $line->fk_parent_line = -1; |
|
1662 | + if (!empty($hideprices)) { |
|
1663 | + foreach ($object->lines as &$line) { |
|
1664 | + if ($line->fk_product_type != 9) $line->fk_parent_line = -1; |
|
1665 | 1665 | } |
1666 | 1666 | } |
1667 | 1667 | |
1668 | 1668 | $line = &$object->lines[$i]; |
1669 | 1669 | |
1670 | - if($line->info_bits>0) { // PAGE BREAK |
|
1670 | + if ($line->info_bits > 0) { // PAGE BREAK |
|
1671 | 1671 | $pdf->addPage(); |
1672 | 1672 | $posy = $pdf->GetY(); |
1673 | 1673 | } |
1674 | 1674 | |
1675 | 1675 | $label = $line->label; |
1676 | - $description= !empty($line->desc) ? $outputlangs->convToOutputCharset($line->desc) : $outputlangs->convToOutputCharset($line->description); |
|
1676 | + $description = !empty($line->desc) ? $outputlangs->convToOutputCharset($line->desc) : $outputlangs->convToOutputCharset($line->description); |
|
1677 | 1677 | |
1678 | - if(empty($label)) { |
|
1678 | + if (empty($label)) { |
|
1679 | 1679 | $label = $description; |
1680 | - $description=''; |
|
1680 | + $description = ''; |
|
1681 | 1681 | } |
1682 | 1682 | |
1683 | - if($line->qty>90) { |
|
1683 | + if ($line->qty > 90) { |
|
1684 | 1684 | |
1685 | 1685 | if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) $label .= ' '.$this->getTitle($object, $line); |
1686 | 1686 | |
1687 | 1687 | $pageBefore = $pdf->getPage(); |
1688 | - $this->pdf_add_total($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
|
1688 | + $this->pdf_add_total($pdf, $object, $line, $label, $description, $posx, $posy, $w, $h); |
|
1689 | 1689 | $pageAfter = $pdf->getPage(); |
1690 | 1690 | |
1691 | - if($pageAfter>$pageBefore) { |
|
1691 | + if ($pageAfter > $pageBefore) { |
|
1692 | 1692 | //print "ST $pageAfter>$pageBefore<br>"; |
1693 | 1693 | $pdf->rollbackTransaction(true); |
1694 | - $pdf->addPage('','', true); |
|
1694 | + $pdf->addPage('', '', true); |
|
1695 | 1695 | $posy = $pdf->GetY(); |
1696 | - $this->pdf_add_total($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
|
1696 | + $this->pdf_add_total($pdf, $object, $line, $label, $description, $posx, $posy, $w, $h); |
|
1697 | 1697 | $posy = $pdf->GetY(); |
1698 | 1698 | //print 'add ST'.$pdf->getPage().'<br />'; |
1699 | 1699 | } |
@@ -1704,7 +1704,7 @@ discard block |
||
1704 | 1704 | else if ($line->qty < 10) { |
1705 | 1705 | $pageBefore = $pdf->getPage(); |
1706 | 1706 | |
1707 | - $this->pdf_add_title($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
|
1707 | + $this->pdf_add_title($pdf, $object, $line, $label, $description, $posx, $posy, $w, $h); |
|
1708 | 1708 | $pageAfter = $pdf->getPage(); |
1709 | 1709 | |
1710 | 1710 | |
@@ -1779,9 +1779,9 @@ discard block |
||
1779 | 1779 | * @param $hookmanager HookManager |
1780 | 1780 | * @return int |
1781 | 1781 | */ |
1782 | - function printObjectLine ($parameters, &$object, &$action, $hookmanager){ |
|
1782 | + function printObjectLine($parameters, &$object, &$action, $hookmanager) { |
|
1783 | 1783 | |
1784 | - global $conf,$langs,$user,$db,$bc; |
|
1784 | + global $conf, $langs, $user, $db, $bc; |
|
1785 | 1785 | |
1786 | 1786 | $num = &$parameters['num']; |
1787 | 1787 | $line = &$parameters['line']; |
@@ -1789,32 +1789,32 @@ discard block |
||
1789 | 1789 | |
1790 | 1790 | $var = &$parameters['var']; |
1791 | 1791 | |
1792 | - $contexts = explode(':',$parameters['context']); |
|
1792 | + $contexts = explode(':', $parameters['context']); |
|
1793 | 1793 | |
1794 | 1794 | $createRight = $user->rights->{$object->element}->creer; |
1795 | - if($object->element == 'facturerec' ) |
|
1795 | + if ($object->element == 'facturerec') |
|
1796 | 1796 | { |
1797 | 1797 | $object->statut = 0; // hack for facture rec |
1798 | 1798 | $createRight = $user->rights->facture->creer; |
1799 | 1799 | } |
1800 | - elseif($object->element == 'order_supplier' ) |
|
1800 | + elseif ($object->element == 'order_supplier') |
|
1801 | 1801 | { |
1802 | 1802 | $createRight = $user->rights->fournisseur->commande->creer; |
1803 | 1803 | } |
1804 | - elseif($object->element == 'invoice_supplier' ) |
|
1804 | + elseif ($object->element == 'invoice_supplier') |
|
1805 | 1805 | { |
1806 | 1806 | $createRight = $user->rights->fournisseur->facture->creer; |
1807 | 1807 | } |
1808 | 1808 | |
1809 | - if($line->special_code!=$this->module_number || $line->product_type!=9) { |
|
1809 | + if ($line->special_code != $this->module_number || $line->product_type != 9) { |
|
1810 | 1810 | null; |
1811 | 1811 | } |
1812 | - 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)) |
|
1812 | + 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)) |
|
1813 | 1813 | { |
1814 | - if($object->element=='facture')$idvar = 'facid'; |
|
1815 | - else $idvar='id'; |
|
1814 | + if ($object->element == 'facture')$idvar = 'facid'; |
|
1815 | + else $idvar = 'id'; |
|
1816 | 1816 | |
1817 | - if((float)DOL_VERSION <= 3.4) |
|
1817 | + if ((float) DOL_VERSION <= 3.4) |
|
1818 | 1818 | { |
1819 | 1819 | ?> |
1820 | 1820 | <script type="text/javascript"> |
@@ -1838,20 +1838,20 @@ discard block |
||
1838 | 1838 | <?php |
1839 | 1839 | } |
1840 | 1840 | |
1841 | - if(empty($line->description)) $line->description = $line->desc; |
|
1841 | + if (empty($line->description)) $line->description = $line->desc; |
|
1842 | 1842 | |
1843 | 1843 | $colspan = 5; |
1844 | - if($object->element == 'facturerec' ) $colspan = 3; |
|
1845 | - if($object->element == 'order_supplier') $colspan = 3; |
|
1846 | - if($object->element == 'invoice_supplier') $colspan = 4; |
|
1847 | - if($object->element == 'supplier_proposal') $colspan = 4; |
|
1848 | - if(!empty($conf->multicurrency->enabled)) $colspan+=2; |
|
1849 | - if($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) $colspan++; |
|
1850 | - if(!empty($conf->margin->enabled)) $colspan++; |
|
1851 | - if(!empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; |
|
1852 | - if(!empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; |
|
1853 | - if($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) $colspan++; |
|
1854 | - if(!empty($conf->global->PRODUCT_USE_UNITS)) $colspan++; |
|
1844 | + if ($object->element == 'facturerec') $colspan = 3; |
|
1845 | + if ($object->element == 'order_supplier') $colspan = 3; |
|
1846 | + if ($object->element == 'invoice_supplier') $colspan = 4; |
|
1847 | + if ($object->element == 'supplier_proposal') $colspan = 4; |
|
1848 | + if (!empty($conf->multicurrency->enabled)) $colspan += 2; |
|
1849 | + if ($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) $colspan++; |
|
1850 | + if (!empty($conf->margin->enabled)) $colspan++; |
|
1851 | + if (!empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; |
|
1852 | + if (!empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; |
|
1853 | + if ($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) $colspan++; |
|
1854 | + if (!empty($conf->global->PRODUCT_USE_UNITS)) $colspan++; |
|
1855 | 1855 | |
1856 | 1856 | /* Titre */ |
1857 | 1857 | //var_dump($line); |
@@ -1861,35 +1861,35 @@ discard block |
||
1861 | 1861 | |
1862 | 1862 | |
1863 | 1863 | ?> |
1864 | - <tr <?php echo $bc[$var]; $var=!$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
|
1864 | + <tr <?php echo $bc[$var]; $var = !$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
|
1865 | 1865 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT)) |
1866 | 1866 | { |
1867 | - if($line->qty==99) print 'background:#adadcf'; |
|
1868 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
1869 | - else if($line->qty<=97 && $line->qty>=91) print 'background:#eeeeff;'; |
|
1870 | - else if($line->qty==1) print 'background:#adadcf;'; |
|
1871 | - else if($line->qty==2) print 'background:#ddddff;'; |
|
1872 | - else if($line->qty==50) print ''; |
|
1867 | + if ($line->qty == 99) print 'background:#adadcf'; |
|
1868 | + else if ($line->qty == 98) print 'background:#ddddff;'; |
|
1869 | + else if ($line->qty <= 97 && $line->qty >= 91) print 'background:#eeeeff;'; |
|
1870 | + else if ($line->qty == 1) print 'background:#adadcf;'; |
|
1871 | + else if ($line->qty == 2) print 'background:#ddddff;'; |
|
1872 | + else if ($line->qty == 50) print ''; |
|
1873 | 1873 | else print 'background:#eeeeff;'; |
1874 | 1874 | |
1875 | 1875 | //A compléter si on veux plus de nuances de couleurs avec les niveau 4,5,6,7,8 et 9 |
1876 | 1876 | } |
1877 | 1877 | else |
1878 | 1878 | { |
1879 | - if($line->qty==99) print 'background:#ddffdd'; |
|
1880 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
1881 | - else if($line->qty==2) print 'background:#eeeeff; '; |
|
1882 | - else if($line->qty==50) print ''; |
|
1883 | - else print 'background:#eeffee;' ; |
|
1879 | + if ($line->qty == 99) print 'background:#ddffdd'; |
|
1880 | + else if ($line->qty == 98) print 'background:#ddddff;'; |
|
1881 | + else if ($line->qty == 2) print 'background:#eeeeff; '; |
|
1882 | + else if ($line->qty == 50) print ''; |
|
1883 | + else print 'background:#eeffee;'; |
|
1884 | 1884 | } |
1885 | 1885 | |
1886 | 1886 | ?>;"> |
1887 | 1887 | |
1888 | - <td colspan="<?php echo $colspan; ?>" style="<?php TSubtotal::isFreeText($line) ? '' : 'font-weight:bold;'; ?> <?php echo ($line->qty>90)?'text-align:right':'' ?> "><?php |
|
1889 | - if($action=='editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line) ) { |
|
1888 | + <td colspan="<?php echo $colspan; ?>" style="<?php TSubtotal::isFreeText($line) ? '' : 'font-weight:bold;'; ?> <?php echo ($line->qty > 90) ? 'text-align:right' : '' ?> "><?php |
|
1889 | + if ($action == 'editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line)) { |
|
1890 | 1890 | |
1891 | - $params=array('line'=>$line); |
|
1892 | - $reshook=$hookmanager->executeHooks('formEditProductOptions',$params,$object,$action); |
|
1891 | + $params = array('line'=>$line); |
|
1892 | + $reshook = $hookmanager->executeHooks('formEditProductOptions', $params, $object, $action); |
|
1893 | 1893 | |
1894 | 1894 | echo '<div id="line_'.$line->id.'"></div>'; // Imitation Dolibarr |
1895 | 1895 | echo '<input type="hidden" value="'.$line->id.'" name="lineid">'; |
@@ -1897,7 +1897,7 @@ discard block |
||
1897 | 1897 | echo '<input id="product_id" type="hidden" value="'.$line->fk_product.'" name="type">'; |
1898 | 1898 | echo '<input id="special_code" type="hidden" value="'.$line->special_code.'" name="type">'; |
1899 | 1899 | |
1900 | - $isFreeText=false; |
|
1900 | + $isFreeText = false; |
|
1901 | 1901 | if (TSubtotal::isTitle($line)) |
1902 | 1902 | { |
1903 | 1903 | $qty_displayed = $line->qty; |
@@ -1919,13 +1919,13 @@ discard block |
||
1919 | 1919 | $line->description = ''; |
1920 | 1920 | } |
1921 | 1921 | $newlabel = $line->label; |
1922 | - if($line->label=='' && !$isFreeText) { |
|
1923 | - if(TSubtotal::isSubtotal($line)) { |
|
1922 | + if ($line->label == '' && !$isFreeText) { |
|
1923 | + if (TSubtotal::isSubtotal($line)) { |
|
1924 | 1924 | $newlabel = $line->description.' '.$this->getTitle($object, $line); |
1925 | - $line->description=''; |
|
1926 | - } elseif( (float)DOL_VERSION < 6 ) { |
|
1927 | - $newlabel= $line->description; |
|
1928 | - $line->description=''; |
|
1925 | + $line->description = ''; |
|
1926 | + } elseif ((float) DOL_VERSION < 6) { |
|
1927 | + $newlabel = $line->description; |
|
1928 | + $line->description = ''; |
|
1929 | 1929 | } |
1930 | 1930 | } |
1931 | 1931 | |
@@ -1934,10 +1934,10 @@ discard block |
||
1934 | 1934 | |
1935 | 1935 | if (!$isFreeText) echo '<input type="text" name="line-title" id-line="'.$line->id.'" value="'.$newlabel.'" size="80" '.$readonlyForSituation.'/> '; |
1936 | 1936 | |
1937 | - if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT) && (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) ) |
|
1937 | + if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT) && (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line))) |
|
1938 | 1938 | { |
1939 | 1939 | $select = '<select name="subtotal_level">'; |
1940 | - for ($j=1; $j<10; $j++) |
|
1940 | + for ($j = 1; $j < 10; $j++) |
|
1941 | 1941 | { |
1942 | 1942 | if (!empty($readonlyForSituation)) { |
1943 | 1943 | if ($qty_displayed == $j) $select .= '<option selected="selected" value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
@@ -1950,7 +1950,7 @@ discard block |
||
1950 | 1950 | |
1951 | 1951 | |
1952 | 1952 | echo '<div class="subtotal_underline" style="margin-left:24px;">'; |
1953 | - 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"' : '') .' /> '; |
|
1953 | + 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"' : '').' /> '; |
|
1954 | 1954 | |
1955 | 1955 | if (TSubtotal::isTitle($line)) |
1956 | 1956 | { |
@@ -1968,9 +1968,9 @@ discard block |
||
1968 | 1968 | else if ($isFreeText) echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation); |
1969 | 1969 | echo '</div>'; |
1970 | 1970 | |
1971 | - if($line->qty<10) { |
|
1971 | + if ($line->qty < 10) { |
|
1972 | 1972 | // WYSIWYG editor |
1973 | - require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; |
|
1973 | + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
|
1974 | 1974 | $nbrows = ROWS_2; |
1975 | 1975 | $cked_enabled = (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0); |
1976 | 1976 | if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) { |
@@ -1990,25 +1990,25 @@ discard block |
||
1990 | 1990 | |
1991 | 1991 | if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) |
1992 | 1992 | { |
1993 | - if(TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) |
|
1993 | + if (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) |
|
1994 | 1994 | { |
1995 | - echo str_repeat(' ', $line->qty-1); |
|
1995 | + echo str_repeat(' ', $line->qty - 1); |
|
1996 | 1996 | |
1997 | 1997 | if (TSubtotal::isTitle($line)) print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
1998 | - else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
1998 | + else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100 - $line->qty).'</span> '; |
|
1999 | 1999 | } |
2000 | 2000 | } |
2001 | 2001 | else |
2002 | 2002 | { |
2003 | - if($line->qty<=1) print img_picto('', 'subtotal@subtotal'); |
|
2004 | - else if($line->qty==2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
2003 | + if ($line->qty <= 1) print img_picto('', 'subtotal@subtotal'); |
|
2004 | + else if ($line->qty == 2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
2005 | 2005 | } |
2006 | 2006 | |
2007 | 2007 | |
2008 | 2008 | // Get display styles and apply them |
2009 | 2009 | $titleStyleItalic = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'I') === false ? '' : ' font-style: italic;'; |
2010 | - $titleStyleBold = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'B') === false ? '' : ' font-weight:bold;'; |
|
2011 | - $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
|
2010 | + $titleStyleBold = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'B') === false ? '' : ' font-weight:bold;'; |
|
2011 | + $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
|
2012 | 2012 | |
2013 | 2013 | if (empty($line->label)) { |
2014 | 2014 | if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) print $line->description.' '.$this->getTitle($object, $line); |
@@ -2016,16 +2016,16 @@ discard block |
||
2016 | 2016 | } |
2017 | 2017 | else { |
2018 | 2018 | |
2019 | - if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
|
2019 | + if (!empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
|
2020 | 2020 | print '<span class="subtotal_label" style="'.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" >'.$line->label.'</span><br><div class="subtotal_desc">'.dol_htmlentitiesbr($line->description).'</div>'; |
2021 | 2021 | } |
2022 | - else{ |
|
2022 | + else { |
|
2023 | 2023 | print '<span class="subtotal_label classfortooltip '.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" title="'.$line->description.'">'.$line->label.'</span>'; |
2024 | 2024 | } |
2025 | 2025 | |
2026 | 2026 | } |
2027 | - if($line->qty>90) print ' : '; |
|
2028 | - if($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
2027 | + if ($line->qty > 90) print ' : '; |
|
2028 | + if ($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
2029 | 2029 | |
2030 | 2030 | |
2031 | 2031 | |
@@ -2034,7 +2034,7 @@ discard block |
||
2034 | 2034 | ?></td> |
2035 | 2035 | |
2036 | 2036 | <?php |
2037 | - if($line->qty>90) { |
|
2037 | + if ($line->qty > 90) { |
|
2038 | 2038 | /* Total */ |
2039 | 2039 | $total_line = $this->getTotalLineFromObject($object, $line, ''); |
2040 | 2040 | echo '<td class="nowrap liencolht" align="right" style="font-weight:bold;" rel="subtotal_total">'.price($total_line).'</td>'; |
@@ -2047,7 +2047,7 @@ discard block |
||
2047 | 2047 | <?php |
2048 | 2048 | if ($action != 'selectlines') { |
2049 | 2049 | |
2050 | - if($action=='editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line) ) { |
|
2050 | + if ($action == 'editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line)) { |
|
2051 | 2051 | ?> |
2052 | 2052 | <input id="savelinebutton" class="button" type="submit" name="save" value="<?php echo $langs->trans('Save') ?>" /> |
2053 | 2053 | <br /> |
@@ -2063,13 +2063,13 @@ discard block |
||
2063 | 2063 | <?php |
2064 | 2064 | |
2065 | 2065 | } |
2066 | - else{ |
|
2067 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) && $object->element !== 'invoice_supplier') |
|
2066 | + else { |
|
2067 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) && $object->element !== 'invoice_supplier') |
|
2068 | 2068 | { |
2069 | - 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>'; |
|
2069 | + 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>'; |
|
2070 | 2070 | } |
2071 | 2071 | |
2072 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_EDIT_BLOCK)) |
|
2072 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_EDIT_BLOCK)) |
|
2073 | 2073 | { |
2074 | 2074 | echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=editline&lineid='.$line->id.'">'.img_edit().'</a>'; |
2075 | 2075 | } |
@@ -2084,7 +2084,7 @@ discard block |
||
2084 | 2084 | <?php |
2085 | 2085 | |
2086 | 2086 | if ($action != 'editline' && $action != 'selectlines') { |
2087 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK)) |
|
2087 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK)) |
|
2088 | 2088 | { |
2089 | 2089 | |
2090 | 2090 | if ($object->situation_counter == 1 || !$object->situation_cycle_ref) |
@@ -2092,7 +2092,7 @@ discard block |
||
2092 | 2092 | echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=ask_deleteline&lineid='.$line->id.'">'.img_delete().'</a>'; |
2093 | 2093 | } |
2094 | 2094 | |
2095 | - if(TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref) ) |
|
2095 | + if (TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref)) |
|
2096 | 2096 | { |
2097 | 2097 | $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'); |
2098 | 2098 | echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=ask_deleteallline&lineid='.$line->id.'">'.$img_delete.'</a>'; |
@@ -2103,7 +2103,7 @@ discard block |
||
2103 | 2103 | </td> |
2104 | 2104 | |
2105 | 2105 | <?php |
2106 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && TSubtotal::isTitle($line) && $action != 'editline') |
|
2106 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && TSubtotal::isTitle($line) && $action != 'editline') |
|
2107 | 2107 | { |
2108 | 2108 | echo '<td class="subtotal_nc">'; |
2109 | 2109 | 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"' : '').' />'; |
@@ -2114,11 +2114,11 @@ discard block |
||
2114 | 2114 | <td align="center" class="tdlineupdown"> |
2115 | 2115 | </td> |
2116 | 2116 | <?php } else { ?> |
2117 | - <td align="center"<?php echo ((empty($conf->browser->phone) && ($object->statut == 0 && $createRight ))?' class="tdlineupdown"':''); ?>></td> |
|
2117 | + <td align="center"<?php echo ((empty($conf->browser->phone) && ($object->statut == 0 && $createRight)) ? ' class="tdlineupdown"' : ''); ?>></td> |
|
2118 | 2118 | <?php } ?> |
2119 | 2119 | |
2120 | - <?php if($action == 'selectlines'){ // dolibarr 8 ?> |
|
2121 | - <td class="linecolcheck" align="center"><input type="checkbox" class="linecheckbox" name="line_checkbox[<?php echo $i+1; ?>]" value="<?php echo $line->id; ?>" ></td> |
|
2120 | + <?php if ($action == 'selectlines') { // dolibarr 8 ?> |
|
2121 | + <td class="linecolcheck" align="center"><input type="checkbox" class="linecheckbox" name="line_checkbox[<?php echo $i + 1; ?>]" value="<?php echo $line->id; ?>" ></td> |
|
2122 | 2122 | <?php } ?> |
2123 | 2123 | |
2124 | 2124 | </tr> |
@@ -2126,29 +2126,29 @@ discard block |
||
2126 | 2126 | |
2127 | 2127 | |
2128 | 2128 | // Affichage des extrafields à la Dolibarr (car sinon non affiché sur les titres) |
2129 | - if(TSubtotal::isTitle($line) && !empty($conf->global->SUBTOTAL_ALLOW_EXTRAFIELDS_ON_TITLE)) { |
|
2129 | + if (TSubtotal::isTitle($line) && !empty($conf->global->SUBTOTAL_ALLOW_EXTRAFIELDS_ON_TITLE)) { |
|
2130 | 2130 | |
2131 | - require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; |
|
2131 | + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; |
|
2132 | 2132 | |
2133 | 2133 | // Extrafields |
2134 | 2134 | $extrafieldsline = new ExtraFields($db); |
2135 | 2135 | $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); |
2136 | 2136 | |
2137 | - $colspan+=3; $mode = 'view'; |
|
2138 | - if($action === 'editline' && $line->rowid == GETPOST('lineid')) $mode = 'edit'; |
|
2137 | + $colspan += 3; $mode = 'view'; |
|
2138 | + if ($action === 'editline' && $line->rowid == GETPOST('lineid')) $mode = 'edit'; |
|
2139 | 2139 | |
2140 | 2140 | $ex_element = $line->element; |
2141 | 2141 | $line->element = 'tr_extrafield_title '.$line->element; // Pour pouvoir manipuler ces tr |
2142 | - print $line->showOptionals($extrafieldsline, $mode, array('style'=>' style="background:#eeffee;" ','colspan'=>$colspan)); |
|
2142 | + print $line->showOptionals($extrafieldsline, $mode, array('style'=>' style="background:#eeffee;" ', 'colspan'=>$colspan)); |
|
2143 | 2143 | $isExtraSelected = false; |
2144 | - foreach($line->array_options as $option) { |
|
2145 | - if(!empty($option) && $option != "-1") { |
|
2144 | + foreach ($line->array_options as $option) { |
|
2145 | + if (!empty($option) && $option != "-1") { |
|
2146 | 2146 | $isExtraSelected = true; |
2147 | 2147 | break; |
2148 | 2148 | } |
2149 | 2149 | } |
2150 | 2150 | |
2151 | - if($mode === 'edit') { |
|
2151 | + if ($mode === 'edit') { |
|
2152 | 2152 | ?> |
2153 | 2153 | <script> |
2154 | 2154 | $(document).ready(function(){ |
@@ -2156,7 +2156,7 @@ discard block |
||
2156 | 2156 | var all_tr_extrafields = $("tr.tr_extrafield_title"); |
2157 | 2157 | <?php |
2158 | 2158 | // Si un extrafield est rempli alors on affiche directement les extrafields |
2159 | - if(!$isExtraSelected) { |
|
2159 | + if (!$isExtraSelected) { |
|
2160 | 2160 | echo 'all_tr_extrafields.hide();'; |
2161 | 2161 | echo 'var trad = "'.$langs->trans('showExtrafields').'";'; |
2162 | 2162 | echo 'var extra = 0;'; |
@@ -2202,20 +2202,20 @@ discard block |
||
2202 | 2202 | |
2203 | 2203 | |
2204 | 2204 | function addMoreActionsButtons($parameters, &$object, &$action, $hookmanager) { |
2205 | - global $conf,$langs; |
|
2205 | + global $conf, $langs; |
|
2206 | 2206 | |
2207 | 2207 | if ($object->statut == 0 && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && $action != 'editline') |
2208 | 2208 | { |
2209 | 2209 | |
2210 | - if($object->element == 'invoice_supplier' || $object->element == 'order_supplier') |
|
2210 | + if ($object->element == 'invoice_supplier' || $object->element == 'order_supplier') |
|
2211 | 2211 | { |
2212 | 2212 | foreach ($object->lines as $line) |
2213 | 2213 | { |
2214 | 2214 | // fetch optionals attributes and labels |
2215 | 2215 | require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); |
2216 | - $extrafields=new ExtraFields($this->db); |
|
2217 | - $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true); |
|
2218 | - $line->fetch_optionals($line->id,$extralabels); |
|
2216 | + $extrafields = new ExtraFields($this->db); |
|
2217 | + $extralabels = $extrafields->fetch_name_optionals_label($object->table_element_line, true); |
|
2218 | + $line->fetch_optionals($line->id, $extralabels); |
|
2219 | 2219 | } |
2220 | 2220 | } |
2221 | 2221 | |
@@ -2315,23 +2315,23 @@ discard block |
||
2315 | 2315 | $ThtmlData['data-qty'] = 0; //$line->qty; |
2316 | 2316 | $ThtmlData['data-level'] = TSubtotal::getNiveau($line); |
2317 | 2317 | |
2318 | - if(TSubtotal::isTitle($line)){ |
|
2318 | + if (TSubtotal::isTitle($line)) { |
|
2319 | 2319 | $ThtmlData['data-issubtotal'] = 'title'; |
2320 | - }elseif(TSubtotal::isSubtotal($line)){ |
|
2320 | + }elseif (TSubtotal::isSubtotal($line)) { |
|
2321 | 2321 | $ThtmlData['data-issubtotal'] = 'subtotal'; |
2322 | 2322 | } |
2323 | - else{ |
|
2323 | + else { |
|
2324 | 2324 | $ThtmlData['data-issubtotal'] = 'freetext'; |
2325 | 2325 | } |
2326 | 2326 | |
2327 | 2327 | |
2328 | 2328 | // Change or add data from hooks |
2329 | - $parameters = array_replace($parameters , array( 'ThtmlData' => $ThtmlData ) ); |
|
2329 | + $parameters = array_replace($parameters, array('ThtmlData' => $ThtmlData)); |
|
2330 | 2330 | |
2331 | 2331 | // hook |
2332 | - $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
|
2332 | + $reshook = $hookmanager->executeHooks('subtotalLineHtmlData', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
|
2333 | 2333 | if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
2334 | - if ($reshook>0) |
|
2334 | + if ($reshook > 0) |
|
2335 | 2335 | { |
2336 | 2336 | $ThtmlData = $hookmanager->resArray; |
2337 | 2337 | } |
@@ -2344,14 +2344,14 @@ discard block |
||
2344 | 2344 | function implodeHtmlData($ThtmlData = array()) |
2345 | 2345 | { |
2346 | 2346 | $data = ''; |
2347 | - foreach($ThtmlData as $k => $h ) |
|
2347 | + foreach ($ThtmlData as $k => $h) |
|
2348 | 2348 | { |
2349 | - if(is_array($h)) |
|
2349 | + if (is_array($h)) |
|
2350 | 2350 | { |
2351 | 2351 | $h = json_encode($h); |
2352 | 2352 | } |
2353 | 2353 | |
2354 | - $data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" '; |
|
2354 | + $data .= $k.'="'.dol_htmlentities($h, ENT_QUOTES).'" '; |
|
2355 | 2355 | } |
2356 | 2356 | |
2357 | 2357 | return $data; |
@@ -2359,26 +2359,26 @@ discard block |
||
2359 | 2359 | |
2360 | 2360 | function _ajax_block_order_js($object) |
2361 | 2361 | { |
2362 | - global $conf,$tagidfortablednd,$filepath,$langs; |
|
2362 | + global $conf, $tagidfortablednd, $filepath, $langs; |
|
2363 | 2363 | |
2364 | 2364 | /* |
2365 | 2365 | * this part of js is base on dolibarr htdocs/core/tpl/ajaxrow.tpl.php |
2366 | 2366 | * for compatibility reasons we don't use tableDnD but jquery sortable |
2367 | 2367 | */ |
2368 | 2368 | |
2369 | - $id=$object->id; |
|
2370 | - $nboflines=(isset($object->lines)?count($object->lines):0); |
|
2371 | - $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1; |
|
2369 | + $id = $object->id; |
|
2370 | + $nboflines = (isset($object->lines) ?count($object->lines) : 0); |
|
2371 | + $forcereloadpage = empty($conf->global->MAIN_FORCE_RELOAD_PAGE) ? 0 : 1; |
|
2372 | 2372 | |
2373 | - $id=$object->id; |
|
2374 | - $fk_element=$object->fk_element; |
|
2375 | - $table_element_line=$object->table_element_line; |
|
2376 | - $nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines)); |
|
2377 | - $tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd); |
|
2378 | - $filepath=(empty($filepath)?'':$filepath); |
|
2373 | + $id = $object->id; |
|
2374 | + $fk_element = $object->fk_element; |
|
2375 | + $table_element_line = $object->table_element_line; |
|
2376 | + $nboflines = (isset($object->lines) ?count($object->lines) : (empty($nboflines) ? 0 : $nboflines)); |
|
2377 | + $tagidfortablednd = (empty($tagidfortablednd) ? 'tablelines' : $tagidfortablednd); |
|
2378 | + $filepath = (empty($filepath) ? '' : $filepath); |
|
2379 | 2379 | |
2380 | 2380 | |
2381 | - if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1) |
|
2381 | + if (GETPOST('action', 'aZ09') != 'editline' && $nboflines > 1) |
|
2382 | 2382 | { |
2383 | 2383 | |
2384 | 2384 | ?> |
@@ -2396,7 +2396,7 @@ discard block |
||
2396 | 2396 | moveBlockCol.disableSelection(); // prevent selection |
2397 | 2397 | <?php if ($object->statut == 0) { ?> |
2398 | 2398 | // apply some graphical stuff |
2399 | - moveBlockCol.css("background-image",'url(<?php echo dol_buildpath('subtotal/img/grip_all.png',2); ?>)'); |
|
2399 | + moveBlockCol.css("background-image",'url(<?php echo dol_buildpath('subtotal/img/grip_all.png', 2); ?>)'); |
|
2400 | 2400 | moveBlockCol.css("background-repeat","no-repeat"); |
2401 | 2401 | moveBlockCol.css("background-position","center center"); |
2402 | 2402 | moveBlockCol.css("cursor","move"); |
@@ -25,7 +25,9 @@ discard block |
||
25 | 25 | $value = ''; |
26 | 26 | $sql = 'SELECT content FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text WHERE rowid = '.GETPOST('rowid'); |
27 | 27 | $resql = $this->db->query($sql); |
28 | - if ($resql && ($obj = $this->db->fetch_object($resql))) $value = $obj->content; |
|
28 | + if ($resql && ($obj = $this->db->fetch_object($resql))) { |
|
29 | + $value = $obj->content; |
|
30 | + } |
|
29 | 31 | } |
30 | 32 | |
31 | 33 | ?> |
@@ -109,8 +111,11 @@ discard block |
||
109 | 111 | if ($object->statut == 0 && $createRight) { |
110 | 112 | |
111 | 113 | |
112 | - if($object->element=='facture')$idvar = 'facid'; |
|
113 | - else $idvar='id'; |
|
114 | + if($object->element=='facture') { |
|
115 | + $idvar = 'facid'; |
|
116 | + } else { |
|
117 | + $idvar='id'; |
|
118 | + } |
|
114 | 119 | |
115 | 120 | if(in_array($action, array('add_title_line', 'add_total_line', 'add_subtitle_line', 'add_subtotal_line', 'add_free_text')) ) |
116 | 121 | { |
@@ -118,10 +123,11 @@ discard block |
||
118 | 123 | |
119 | 124 | if($action=='add_title_line') { |
120 | 125 | $title = GETPOST('title'); |
121 | - if(empty($title)) $title = $langs->trans('title'); |
|
126 | + if(empty($title)) { |
|
127 | + $title = $langs->trans('title'); |
|
128 | + } |
|
122 | 129 | $qty = $level<1 ? 1 : $level ; |
123 | - } |
|
124 | - else if($action=='add_free_text') { |
|
130 | + } else if($action=='add_free_text') { |
|
125 | 131 | $title = GETPOST('title'); |
126 | 132 | |
127 | 133 | if (empty($title)) { |
@@ -133,29 +139,31 @@ discard block |
||
133 | 139 | } |
134 | 140 | } |
135 | 141 | } |
136 | - if(empty($title)) $title = $langs->trans('subtotalAddLineDescription'); |
|
142 | + if(empty($title)) { |
|
143 | + $title = $langs->trans('subtotalAddLineDescription'); |
|
144 | + } |
|
137 | 145 | $qty = 50; |
138 | - } |
|
139 | - else if($action=='add_subtitle_line') { |
|
146 | + } else if($action=='add_subtitle_line') { |
|
140 | 147 | $title = GETPOST('title'); |
141 | - if(empty($title)) $title = $langs->trans('subtitle'); |
|
148 | + if(empty($title)) { |
|
149 | + $title = $langs->trans('subtitle'); |
|
150 | + } |
|
142 | 151 | $qty = 2; |
143 | - } |
|
144 | - else if($action=='add_subtotal_line') { |
|
152 | + } else if($action=='add_subtotal_line') { |
|
145 | 153 | $title = $langs->trans('SubSubTotal'); |
146 | 154 | $qty = 98; |
147 | - } |
|
148 | - else { |
|
155 | + } else { |
|
149 | 156 | $title = GETPOST('title') ? GETPOST('title') : $langs->trans('SubTotal'); |
150 | 157 | $qty = $level ? 100-$level : 99; |
151 | 158 | } |
152 | 159 | dol_include_once('/subtotal/class/subtotal.class.php'); |
153 | 160 | |
154 | - if (!empty($conf->global->SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE) && $qty < 10) TSubtotal::addSubtotalMissing($object, $qty); |
|
161 | + if (!empty($conf->global->SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE) && $qty < 10) { |
|
162 | + TSubtotal::addSubtotalMissing($object, $qty); |
|
163 | + } |
|
155 | 164 | |
156 | 165 | TSubtotal::addSubTotalLine($object, $title, $qty); |
157 | - } |
|
158 | - else if($action==='ask_deleteallline') { |
|
166 | + } else if($action==='ask_deleteallline') { |
|
159 | 167 | $form=new Form($db); |
160 | 168 | |
161 | 169 | $lineid = GETPOST('lineid','integer'); |
@@ -178,8 +186,7 @@ discard block |
||
178 | 186 | $this->printNewFormat($object, $conf, $langs, $idvar); |
179 | 187 | } |
180 | 188 | } |
181 | - } |
|
182 | - elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice',$contexts)) |
|
189 | + } elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice',$contexts)) |
|
183 | 190 | { |
184 | 191 | ?> |
185 | 192 | <script type="text/javascript"> |
@@ -197,8 +204,13 @@ discard block |
||
197 | 204 | |
198 | 205 | function printNewFormat(&$object, &$conf, &$langs, $idvar) |
199 | 206 | { |
200 | - if (empty($conf->global->SUBTOTAL_ALLOW_ADD_BLOCK)) return false; |
|
201 | - if (!empty($object->situation_cycle_ref) && $object->situation_counter > 1) return false; // Si facture de situation |
|
207 | + if (empty($conf->global->SUBTOTAL_ALLOW_ADD_BLOCK)) { |
|
208 | + return false; |
|
209 | + } |
|
210 | + if (!empty($object->situation_cycle_ref) && $object->situation_counter > 1) { |
|
211 | + return false; |
|
212 | + } |
|
213 | + // Si facture de situation |
|
202 | 214 | ?> |
203 | 215 | <script type="text/javascript"> |
204 | 216 | $(document).ready(function() { |
@@ -484,8 +496,7 @@ discard block |
||
484 | 496 | } |
485 | 497 | |
486 | 498 | |
487 | - } |
|
488 | - else{ |
|
499 | + } else{ |
|
489 | 500 | $substitutionarray['line_not_modsubtotal'] = true; |
490 | 501 | $substitutionarray['line_modsubtotal'] = 0; |
491 | 502 | } |
@@ -543,8 +554,11 @@ discard block |
||
543 | 554 | |
544 | 555 | $showBlockExtrafields = GETPOST('showBlockExtrafields'); |
545 | 556 | |
546 | - if($object->element=='facture') $idvar = 'facid'; |
|
547 | - else $idvar = 'id'; |
|
557 | + if($object->element=='facture') { |
|
558 | + $idvar = 'facid'; |
|
559 | + } else { |
|
560 | + $idvar = 'id'; |
|
561 | + } |
|
548 | 562 | |
549 | 563 | if ($action == 'updateligne' || $action == 'updateline') |
550 | 564 | { |
@@ -574,8 +588,7 @@ discard block |
||
574 | 588 | header('Location: '.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id); |
575 | 589 | exit; // Surtout ne pas laisser Dolibarr faire du traitement sur le updateligne sinon ça plante les données de la ligne |
576 | 590 | } |
577 | - } |
|
578 | - else if($action === 'builddoc') { |
|
591 | + } else if($action === 'builddoc') { |
|
579 | 592 | |
580 | 593 | if ( |
581 | 594 | in_array('invoicecard',explode(':',$parameters['context'])) |
@@ -590,33 +603,27 @@ discard block |
||
590 | 603 | $sessname = 'subtotal_hideInnerLines_facture'; |
591 | 604 | $sessname2 = 'subtotal_hidedetails_facture'; |
592 | 605 | $sessname3 = 'subtotal_hideprices_facture'; |
593 | - } |
|
594 | - elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) { |
|
606 | + } elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) { |
|
595 | 607 | $sessname = 'subtotal_hideInnerLines_facture_fournisseur'; |
596 | 608 | $sessname2 = 'subtotal_hidedetails_facture_fournisseur'; |
597 | 609 | $sessname3 = 'subtotal_hideprices_facture_fournisseur'; |
598 | - } |
|
599 | - elseif(in_array('propalcard',explode(':',$parameters['context']))) { |
|
610 | + } elseif(in_array('propalcard',explode(':',$parameters['context']))) { |
|
600 | 611 | $sessname = 'subtotal_hideInnerLines_propal'; |
601 | 612 | $sessname2 = 'subtotal_hidedetails_propal'; |
602 | 613 | $sessname3 = 'subtotal_hideprices_propal'; |
603 | - } |
|
604 | - elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) { |
|
614 | + } elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) { |
|
605 | 615 | $sessname = 'subtotal_hideInnerLines_supplier_proposal'; |
606 | 616 | $sessname2 = 'subtotal_hidedetails_supplier_proposal'; |
607 | 617 | $sessname3 = 'subtotal_hideprices_supplier_proposal'; |
608 | - } |
|
609 | - elseif(in_array('ordercard',explode(':',$parameters['context']))) { |
|
618 | + } elseif(in_array('ordercard',explode(':',$parameters['context']))) { |
|
610 | 619 | $sessname = 'subtotal_hideInnerLines_commande'; |
611 | 620 | $sessname2 = 'subtotal_hidedetails_commande'; |
612 | 621 | $sessname3 = 'subtotal_hideprices_commande'; |
613 | - } |
|
614 | - elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) { |
|
622 | + } elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) { |
|
615 | 623 | $sessname = 'subtotal_hideInnerLines_commande_fournisseur'; |
616 | 624 | $sessname2 = 'subtotal_hidedetails_commande_fournisseur'; |
617 | 625 | $sessname3 = 'subtotal_hideprices_commande_fournisseur'; |
618 | - } |
|
619 | - else { |
|
626 | + } else { |
|
620 | 627 | $sessname = 'subtotal_hideInnerLines_unknown'; |
621 | 628 | $sessname2 = 'subtotal_hidedetails_unknown'; |
622 | 629 | $sessname3 = 'subtotal_hideprices_unknown'; |
@@ -625,15 +632,24 @@ discard block |
||
625 | 632 | global $hideprices; |
626 | 633 | |
627 | 634 | $hideInnerLines = (int)GETPOST('hideInnerLines'); |
628 | - if(!empty($_SESSION[$sessname]) && !is_array($_SESSION[$sessname][$object->id]) ) $_SESSION[$sessname] = array(); // prevent old system |
|
635 | + if(!empty($_SESSION[$sessname]) && !is_array($_SESSION[$sessname][$object->id]) ) { |
|
636 | + $_SESSION[$sessname] = array(); |
|
637 | + } |
|
638 | + // prevent old system |
|
629 | 639 | $_SESSION[$sessname][$object->id] = $hideInnerLines; |
630 | 640 | |
631 | 641 | $hidedetails= (int)GETPOST('hidedetails'); |
632 | - if(!empty($_SESSION[$sessname2]) && !is_array($_SESSION[$sessname2][$object->id]) ) $_SESSION[$sessname2] = array(); // prevent old system |
|
642 | + if(!empty($_SESSION[$sessname2]) && !is_array($_SESSION[$sessname2][$object->id]) ) { |
|
643 | + $_SESSION[$sessname2] = array(); |
|
644 | + } |
|
645 | + // prevent old system |
|
633 | 646 | $_SESSION[$sessname2][$object->id] = $hidedetails; |
634 | 647 | |
635 | 648 | $hideprices= (int)GETPOST('hideprices'); |
636 | - if(!empty($_SESSION[$sessname3]) && !is_array($_SESSION[$sessname3][$object->id]) ) $_SESSION[$sessname3] = array(); // prevent old system |
|
649 | + if(!empty($_SESSION[$sessname3]) && !is_array($_SESSION[$sessname3][$object->id]) ) { |
|
650 | + $_SESSION[$sessname3] = array(); |
|
651 | + } |
|
652 | + // prevent old system |
|
637 | 653 | $_SESSION[$sessname3][$object->id] = $hideprices; |
638 | 654 | |
639 | 655 | foreach($object->lines as &$line) { |
@@ -641,8 +657,7 @@ discard block |
||
641 | 657 | |
642 | 658 | if($line->qty>=90) { |
643 | 659 | $line->modsubtotal_total = 1; |
644 | - } |
|
645 | - else{ |
|
660 | + } else{ |
|
646 | 661 | $line->modsubtotal_title = 1; |
647 | 662 | } |
648 | 663 | |
@@ -651,8 +666,7 @@ discard block |
||
651 | 666 | } |
652 | 667 | } |
653 | 668 | |
654 | - } |
|
655 | - else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') { |
|
669 | + } else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') { |
|
656 | 670 | |
657 | 671 | $Tab = $this->getArrayOfLineForAGroup($object, GETPOST('lineid')); |
658 | 672 | |
@@ -660,7 +674,9 @@ discard block |
||
660 | 674 | /** |
661 | 675 | * @var $object Facture |
662 | 676 | */ |
663 | - if($object->element=='facture') $object->deleteline($idLine); |
|
677 | + if($object->element=='facture') { |
|
678 | + $object->deleteline($idLine); |
|
679 | + } |
|
664 | 680 | /** |
665 | 681 | * @var $object Facture fournisseur |
666 | 682 | */ |
@@ -671,18 +687,25 @@ discard block |
||
671 | 687 | /** |
672 | 688 | * @var $object Propal |
673 | 689 | */ |
674 | - else if($object->element=='propal') $object->deleteline($idLine); |
|
690 | + else if($object->element=='propal') { |
|
691 | + $object->deleteline($idLine); |
|
692 | + } |
|
675 | 693 | /** |
676 | 694 | * @var $object Propal Fournisseur |
677 | 695 | */ |
678 | - else if($object->element=='supplier_proposal') $object->deleteline($idLine); |
|
696 | + else if($object->element=='supplier_proposal') { |
|
697 | + $object->deleteline($idLine); |
|
698 | + } |
|
679 | 699 | /** |
680 | 700 | * @var $object Commande |
681 | 701 | */ |
682 | 702 | else if($object->element=='commande') |
683 | 703 | { |
684 | - if ((float) DOL_VERSION >= 5.0) $object->deleteline($user, $idLine); |
|
685 | - else $object->deleteline($idLine); |
|
704 | + if ((float) DOL_VERSION >= 5.0) { |
|
705 | + $object->deleteline($user, $idLine); |
|
706 | + } else { |
|
707 | + $object->deleteline($idLine); |
|
708 | + } |
|
686 | 709 | } |
687 | 710 | /** |
688 | 711 | * @var $object Commande fournisseur |
@@ -694,21 +717,26 @@ discard block |
||
694 | 717 | /** |
695 | 718 | * @var $object Facturerec |
696 | 719 | */ |
697 | - else if($object->element=='facturerec') $object->deleteline($idLine); |
|
720 | + else if($object->element=='facturerec') { |
|
721 | + $object->deleteline($idLine); |
|
722 | + } |
|
698 | 723 | } |
699 | 724 | |
700 | 725 | header('location:?id='.$object->id); |
701 | 726 | exit; |
702 | 727 | |
703 | - } |
|
704 | - else if ($action == 'duplicate') |
|
728 | + } else if ($action == 'duplicate') |
|
705 | 729 | { |
706 | 730 | $lineid = GETPOST('lineid', 'int'); |
707 | 731 | $nbDuplicate = TSubtotal::duplicateLines($object, $lineid, true); |
708 | 732 | |
709 | - if ($nbDuplicate > 0) setEventMessage($langs->trans('subtotal_duplicate_success', $nbDuplicate)); |
|
710 | - elseif ($nbDuplicate == 0) setEventMessage($langs->trans('subtotal_duplicate_lineid_not_found'), 'warnings'); |
|
711 | - else setEventMessage($langs->trans('subtotal_duplicate_error'), 'errors'); |
|
733 | + if ($nbDuplicate > 0) { |
|
734 | + setEventMessage($langs->trans('subtotal_duplicate_success', $nbDuplicate)); |
|
735 | + } elseif ($nbDuplicate == 0) { |
|
736 | + setEventMessage($langs->trans('subtotal_duplicate_lineid_not_found'), 'warnings'); |
|
737 | + } else { |
|
738 | + setEventMessage($langs->trans('subtotal_duplicate_error'), 'errors'); |
|
739 | + } |
|
712 | 740 | |
713 | 741 | header('Location: ?id='.$object->id); |
714 | 742 | exit; |
@@ -788,17 +816,18 @@ discard block |
||
788 | 816 | //print $l->rang.'>='.$rang.' '.$total.'<br/>'; |
789 | 817 | if($l->rang>=$rang) { |
790 | 818 | //echo 'return!<br>'; |
791 | - if (!$return_all) return $total; |
|
792 | - else return array($total, $total_tva, $total_ttc, $TTotal_tva); |
|
793 | - } |
|
794 | - else if(TSubtotal::isTitle($l, 100 - $qty_line)) |
|
819 | + if (!$return_all) { |
|
820 | + return $total; |
|
821 | + } else { |
|
822 | + return array($total, $total_tva, $total_ttc, $TTotal_tva); |
|
823 | + } |
|
824 | + } else if(TSubtotal::isTitle($l, 100 - $qty_line)) |
|
795 | 825 | { |
796 | 826 | $total = 0; |
797 | 827 | $total_tva = 0; |
798 | 828 | $total_ttc = 0; |
799 | 829 | $TTotal_tva = array(); |
800 | - } |
|
801 | - elseif(!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) { |
|
830 | + } elseif(!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) { |
|
802 | 831 | $total += $l->total_ht; |
803 | 832 | $total_tva += $l->total_tva; |
804 | 833 | $TTotal_tva[$l->tva_tx] += $l->total_tva; |
@@ -806,8 +835,11 @@ discard block |
||
806 | 835 | } |
807 | 836 | |
808 | 837 | } |
809 | - if (!$return_all) return $total; |
|
810 | - else return array($total, $total_tva, $total_ttc, $TTotal_tva); |
|
838 | + if (!$return_all) { |
|
839 | + return $total; |
|
840 | + } else { |
|
841 | + return array($total, $total_tva, $total_ttc, $TTotal_tva); |
|
842 | + } |
|
811 | 843 | } |
812 | 844 | |
813 | 845 | /* |
@@ -875,15 +907,18 @@ discard block |
||
875 | 907 | } |
876 | 908 | |
877 | 909 | |
878 | - if($line->qty==99) |
|
879 | - $pdf->SetFillColor(220,220,220); |
|
880 | - elseif ($line->qty==98) |
|
881 | - $pdf->SetFillColor(230,230,230); |
|
882 | - else |
|
883 | - $pdf->SetFillColor(240,240,240); |
|
910 | + if($line->qty==99) { |
|
911 | + $pdf->SetFillColor(220,220,220); |
|
912 | + } elseif ($line->qty==98) { |
|
913 | + $pdf->SetFillColor(230,230,230); |
|
914 | + } else { |
|
915 | + $pdf->SetFillColor(240,240,240); |
|
916 | + } |
|
884 | 917 | |
885 | 918 | $style = 'B'; |
886 | - if (!empty($conf->global->SUBTOTAL_SUBTOTAL_STYLE)) $style = $conf->global->SUBTOTAL_SUBTOTAL_STYLE; |
|
919 | + if (!empty($conf->global->SUBTOTAL_SUBTOTAL_STYLE)) { |
|
920 | + $style = $conf->global->SUBTOTAL_SUBTOTAL_STYLE; |
|
921 | + } |
|
887 | 922 | |
888 | 923 | $pdf->SetFont('', $style, 9); |
889 | 924 | |
@@ -922,8 +957,7 @@ discard block |
||
922 | 957 | // $line->total_tva |
923 | 958 | // $line->total |
924 | 959 | // $line->total_ttc |
925 | - } |
|
926 | - else |
|
960 | + } else |
|
927 | 961 | { |
928 | 962 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
929 | 963 | if(get_class($object) == 'Facture' && $object->type==Facture::TYPE_SITUATION){//Facture de situation |
@@ -940,11 +974,14 @@ discard block |
||
940 | 974 | } |
941 | 975 | |
942 | 976 | $pdf->SetXY($pdf->postotalht, $posy); |
943 | - if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
977 | + if($set_pagebreak_margin) { |
|
978 | + $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
979 | + } |
|
944 | 980 | $pdf->MultiCell($pdf->page_largeur-$pdf->marge_droite-$pdf->postotalht, 3, $total_to_print, 0, 'R', 0); |
945 | - } |
|
946 | - else{ |
|
947 | - if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
981 | + } else{ |
|
982 | + if($set_pagebreak_margin) { |
|
983 | + $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
984 | + } |
|
948 | 985 | } |
949 | 986 | |
950 | 987 | $posy = $posy + $cell_height; |
@@ -976,25 +1013,40 @@ discard block |
||
976 | 1013 | |
977 | 1014 | |
978 | 1015 | $style = ($line->qty==1) ? 'BU' : 'BUI'; |
979 | - if (!empty($conf->global->SUBTOTAL_TITLE_STYLE)) $style = $conf->global->SUBTOTAL_TITLE_STYLE; |
|
1016 | + if (!empty($conf->global->SUBTOTAL_TITLE_STYLE)) { |
|
1017 | + $style = $conf->global->SUBTOTAL_TITLE_STYLE; |
|
1018 | + } |
|
980 | 1019 | |
981 | 1020 | if($hideInnerLines) { |
982 | - if($line->qty==1)$pdf->SetFont('', $style, 9); |
|
983 | - else |
|
1021 | + if($line->qty==1) { |
|
1022 | + $pdf->SetFont('', $style, 9); |
|
1023 | + } else |
|
984 | 1024 | { |
985 | - if (!empty($conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES)) $style = $conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES; |
|
1025 | + if (!empty($conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES)) { |
|
1026 | + $style = $conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES; |
|
1027 | + } |
|
986 | 1028 | $pdf->SetFont('', $style, 9); |
987 | 1029 | } |
988 | - } |
|
989 | - else { |
|
1030 | + } else { |
|
990 | 1031 | |
991 | - if($line->qty==1)$pdf->SetFont('', $style, 9); //TODO if super utile |
|
992 | - else $pdf->SetFont('', $style, 9); |
|
1032 | + if($line->qty==1) { |
|
1033 | + $pdf->SetFont('', $style, 9); |
|
1034 | + } |
|
1035 | + //TODO if super utile |
|
1036 | + else { |
|
1037 | + $pdf->SetFont('', $style, 9); |
|
1038 | + } |
|
993 | 1039 | |
994 | 1040 | } |
995 | 1041 | |
996 | - 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 |
|
997 | - else $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J',true); // et maintenant avec du HTML |
|
1042 | + if ($label === strip_tags($label) && $label === dol_html_entity_decode($label, ENT_QUOTES)) { |
|
1043 | + $pdf->MultiCell($w, $h, $label, 0, 'L'); |
|
1044 | + } |
|
1045 | + // Pas de HTML dans la chaine |
|
1046 | + else { |
|
1047 | + $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J',true); |
|
1048 | + } |
|
1049 | + // et maintenant avec du HTML |
|
998 | 1050 | |
999 | 1051 | if($description && !$hidedesc) { |
1000 | 1052 | $posy = $pdf->GetY(); |
@@ -1018,8 +1070,7 @@ discard block |
||
1018 | 1070 | |
1019 | 1071 | if(is_array($parameters)) { |
1020 | 1072 | $i = & $parameters['i']; |
1021 | - } |
|
1022 | - else { |
|
1073 | + } else { |
|
1023 | 1074 | $i = (int)$parameters; |
1024 | 1075 | } |
1025 | 1076 | |
@@ -1041,17 +1092,14 @@ discard block |
||
1041 | 1092 | |
1042 | 1093 | if((float)DOL_VERSION<=3.6) { |
1043 | 1094 | return ''; |
1044 | - } |
|
1045 | - else if((float)DOL_VERSION>=3.8) { |
|
1095 | + } else if((float)DOL_VERSION>=3.8) { |
|
1046 | 1096 | return 1; |
1047 | 1097 | } |
1048 | 1098 | |
1049 | - } |
|
1050 | - elseif(!empty($hideprices)) { |
|
1099 | + } elseif(!empty($hideprices)) { |
|
1051 | 1100 | $this->resprints = $object->lines[$parameters['i']]->qty; |
1052 | 1101 | return 1; |
1053 | - } |
|
1054 | - elseif (!empty($conf->global->SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY)) |
|
1102 | + } elseif (!empty($conf->global->SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY)) |
|
1055 | 1103 | { |
1056 | 1104 | $hideInnerLines = (int)GETPOST('hideInnerLines'); |
1057 | 1105 | $hidedetails = (int)GETPOST('hidedetails'); |
@@ -1061,12 +1109,20 @@ discard block |
||
1061 | 1109 | } |
1062 | 1110 | } |
1063 | 1111 | |
1064 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1065 | - else $i = (int)$parameters; |
|
1112 | + if(is_array($parameters)) { |
|
1113 | + $i = & $parameters['i']; |
|
1114 | + } else { |
|
1115 | + $i = (int)$parameters; |
|
1116 | + } |
|
1066 | 1117 | |
1067 | - 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) |
|
1118 | + if (empty($object->lines[$i])) { |
|
1119 | + return 0; |
|
1120 | + } |
|
1121 | + // 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) |
|
1068 | 1122 | |
1069 | - if(empty($object->lines[$i]->array_options)) $object->lines[$i]->fetch_optionals(); |
|
1123 | + if(empty($object->lines[$i]->array_options)) { |
|
1124 | + $object->lines[$i]->fetch_optionals(); |
|
1125 | + } |
|
1070 | 1126 | |
1071 | 1127 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
1072 | 1128 | { |
@@ -1083,8 +1139,11 @@ discard block |
||
1083 | 1139 | function pdf_getlinetotalexcltax($parameters=array(), &$object, &$action='') { |
1084 | 1140 | global $conf, $hideprices, $hookmanager; |
1085 | 1141 | |
1086 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1087 | - else $i = (int)$parameters; |
|
1142 | + if(is_array($parameters)) { |
|
1143 | + $i = & $parameters['i']; |
|
1144 | + } else { |
|
1145 | + $i = (int)$parameters; |
|
1146 | + } |
|
1088 | 1147 | |
1089 | 1148 | if($this->isModSubtotalLine($parameters,$object) ){ |
1090 | 1149 | |
@@ -1092,13 +1151,11 @@ discard block |
||
1092 | 1151 | |
1093 | 1152 | if((float)DOL_VERSION<=3.6) { |
1094 | 1153 | return ''; |
1095 | - } |
|
1096 | - else if((float)DOL_VERSION>=3.8) { |
|
1154 | + } else if((float)DOL_VERSION>=3.8) { |
|
1097 | 1155 | return 1; |
1098 | 1156 | } |
1099 | 1157 | |
1100 | - } |
|
1101 | - elseif (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS)) |
|
1158 | + } elseif (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS)) |
|
1102 | 1159 | { |
1103 | 1160 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
1104 | 1161 | { |
@@ -1170,12 +1227,10 @@ discard block |
||
1170 | 1227 | $this->error = $hookmanager->error; |
1171 | 1228 | $this->errors = $hookmanager->errors; |
1172 | 1229 | return -1; |
1173 | - } |
|
1174 | - elseif (empty($reshook)) |
|
1230 | + } elseif (empty($reshook)) |
|
1175 | 1231 | { |
1176 | 1232 | $this->resprints .= $hookmanager->resprints; |
1177 | - } |
|
1178 | - else |
|
1233 | + } else |
|
1179 | 1234 | { |
1180 | 1235 | $this->resprints = $hookmanager->resprints; |
1181 | 1236 | |
@@ -1198,14 +1253,16 @@ discard block |
||
1198 | 1253 | |
1199 | 1254 | if((float)DOL_VERSION<=3.6) { |
1200 | 1255 | return ''; |
1201 | - } |
|
1202 | - else if((float)DOL_VERSION>=3.8) { |
|
1256 | + } else if((float)DOL_VERSION>=3.8) { |
|
1203 | 1257 | return 1; |
1204 | 1258 | } |
1205 | 1259 | } |
1206 | 1260 | |
1207 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1208 | - else $i = (int)$parameters; |
|
1261 | + if(is_array($parameters)) { |
|
1262 | + $i = & $parameters['i']; |
|
1263 | + } else { |
|
1264 | + $i = (int)$parameters; |
|
1265 | + } |
|
1209 | 1266 | |
1210 | 1267 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
1211 | 1268 | { |
@@ -1227,14 +1284,16 @@ discard block |
||
1227 | 1284 | |
1228 | 1285 | if((float)DOL_VERSION<=3.6) { |
1229 | 1286 | return ''; |
1230 | - } |
|
1231 | - else if((float)DOL_VERSION>=3.8) { |
|
1287 | + } else if((float)DOL_VERSION>=3.8) { |
|
1232 | 1288 | return 1; |
1233 | 1289 | } |
1234 | 1290 | } |
1235 | 1291 | |
1236 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1237 | - else $i = (int)$parameters; |
|
1292 | + if(is_array($parameters)) { |
|
1293 | + $i = & $parameters['i']; |
|
1294 | + } else { |
|
1295 | + $i = (int)$parameters; |
|
1296 | + } |
|
1238 | 1297 | |
1239 | 1298 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
1240 | 1299 | { |
@@ -1256,13 +1315,15 @@ discard block |
||
1256 | 1315 | |
1257 | 1316 | if((float)DOL_VERSION<=3.6) { |
1258 | 1317 | return ''; |
1259 | - } |
|
1260 | - else if((float)DOL_VERSION>=3.8) { |
|
1318 | + } else if((float)DOL_VERSION>=3.8) { |
|
1261 | 1319 | return 1; |
1262 | 1320 | } |
1263 | 1321 | } |
1264 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1265 | - else $i = (int)$parameters; |
|
1322 | + if(is_array($parameters)) { |
|
1323 | + $i = & $parameters['i']; |
|
1324 | + } else { |
|
1325 | + $i = (int)$parameters; |
|
1326 | + } |
|
1266 | 1327 | |
1267 | 1328 | |
1268 | 1329 | // Si la gestion C/NC est active et que je suis sur un ligne dont l'extrafield est coché |
@@ -1309,14 +1370,16 @@ discard block |
||
1309 | 1370 | $this->resprints = ' '; |
1310 | 1371 | if((float)DOL_VERSION<=3.6) { |
1311 | 1372 | return ''; |
1312 | - } |
|
1313 | - else if((float)DOL_VERSION>=3.8) { |
|
1373 | + } else if((float)DOL_VERSION>=3.8) { |
|
1314 | 1374 | return 1; |
1315 | 1375 | } |
1316 | 1376 | } |
1317 | 1377 | |
1318 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1319 | - else $i = (int)$parameters; |
|
1378 | + if(is_array($parameters)) { |
|
1379 | + $i = & $parameters['i']; |
|
1380 | + } else { |
|
1381 | + $i = (int)$parameters; |
|
1382 | + } |
|
1320 | 1383 | |
1321 | 1384 | if (!empty($hideprices) |
1322 | 1385 | || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
@@ -1340,16 +1403,21 @@ discard block |
||
1340 | 1403 | |
1341 | 1404 | if((float)DOL_VERSION<=3.6) { |
1342 | 1405 | return ''; |
1343 | - } |
|
1344 | - else if((float)DOL_VERSION>=3.8) { |
|
1406 | + } else if((float)DOL_VERSION>=3.8) { |
|
1345 | 1407 | return 1; |
1346 | 1408 | } |
1347 | 1409 | } |
1348 | 1410 | |
1349 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1350 | - else $i = (int)$parameters; |
|
1411 | + if(is_array($parameters)) { |
|
1412 | + $i = & $parameters['i']; |
|
1413 | + } else { |
|
1414 | + $i = (int)$parameters; |
|
1415 | + } |
|
1351 | 1416 | |
1352 | - 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) |
|
1417 | + if (empty($object->lines[$i])) { |
|
1418 | + return 0; |
|
1419 | + } |
|
1420 | + // 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) |
|
1353 | 1421 | |
1354 | 1422 | $object->lines[$i]->fetch_optionals(); |
1355 | 1423 | // Si la gestion C/NC est active et que je suis sur un ligne dont l'extrafield est coché |
@@ -1395,14 +1463,16 @@ discard block |
||
1395 | 1463 | $this->resprints = ' '; |
1396 | 1464 | if((float)DOL_VERSION<=3.6) { |
1397 | 1465 | return ''; |
1398 | - } |
|
1399 | - else if((float)DOL_VERSION>=3.8) { |
|
1466 | + } else if((float)DOL_VERSION>=3.8) { |
|
1400 | 1467 | return 1; |
1401 | 1468 | } |
1402 | 1469 | } |
1403 | 1470 | |
1404 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1405 | - else $i = (int)$parameters; |
|
1471 | + if(is_array($parameters)) { |
|
1472 | + $i = & $parameters['i']; |
|
1473 | + } else { |
|
1474 | + $i = (int)$parameters; |
|
1475 | + } |
|
1406 | 1476 | |
1407 | 1477 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
1408 | 1478 | { |
@@ -1432,7 +1502,9 @@ discard block |
||
1432 | 1502 | } |
1433 | 1503 | } |
1434 | 1504 | |
1435 | - if (!empty($TLineTitle)) $TTitleNumeroted = $this->formatNumerotation($TLineTitle); |
|
1505 | + if (!empty($TLineTitle)) { |
|
1506 | + $TTitleNumeroted = $this->formatNumerotation($TLineTitle); |
|
1507 | + } |
|
1436 | 1508 | } |
1437 | 1509 | |
1438 | 1510 | } |
@@ -1446,8 +1518,12 @@ discard block |
||
1446 | 1518 | $j=0; |
1447 | 1519 | foreach ($TLineTitle as $k => &$line) |
1448 | 1520 | { |
1449 | - if (!empty($line_reference) && $line->rang <= $line_reference->rang) continue; |
|
1450 | - if (!empty($line_reference) && $line->qty <= $line_reference->qty) break; |
|
1521 | + if (!empty($line_reference) && $line->rang <= $line_reference->rang) { |
|
1522 | + continue; |
|
1523 | + } |
|
1524 | + if (!empty($line_reference) && $line->qty <= $line_reference->qty) { |
|
1525 | + break; |
|
1526 | + } |
|
1451 | 1527 | |
1452 | 1528 | if ($line->qty == $level) |
1453 | 1529 | { |
@@ -1481,7 +1557,9 @@ discard block |
||
1481 | 1557 | |
1482 | 1558 | $hidedetails = (int)GETPOST('hidedetails'); |
1483 | 1559 | |
1484 | - if(empty($hidedetails)) return false; |
|
1560 | + if(empty($hidedetails)) { |
|
1561 | + return false; |
|
1562 | + } |
|
1485 | 1563 | |
1486 | 1564 | // TODO can't add VAT to document without lines... :-/ |
1487 | 1565 | |
@@ -1534,7 +1612,9 @@ discard block |
||
1534 | 1612 | */ |
1535 | 1613 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
1536 | 1614 | |
1537 | - if (TSubtotal::getNiveau($line) == 1) $line->TTotal_tva = $TTotal_tva; |
|
1615 | + if (TSubtotal::getNiveau($line) == 1) { |
|
1616 | + $line->TTotal_tva = $TTotal_tva; |
|
1617 | + } |
|
1538 | 1618 | $line->total_ht = $total; |
1539 | 1619 | $line->total_tva = $total_tva; |
1540 | 1620 | $line->total = $line->total_ht; |
@@ -1589,8 +1669,7 @@ discard block |
||
1589 | 1669 | } |
1590 | 1670 | |
1591 | 1671 | |
1592 | - } |
|
1593 | - elseif ($hidedetails) |
|
1672 | + } elseif ($hidedetails) |
|
1594 | 1673 | { |
1595 | 1674 | $TLines[] = $line; //Cas où je cache uniquement les prix des produits |
1596 | 1675 | } |
@@ -1661,7 +1740,9 @@ discard block |
||
1661 | 1740 | |
1662 | 1741 | if(!empty($hideprices)) { |
1663 | 1742 | foreach($object->lines as &$line) { |
1664 | - if($line->fk_product_type!=9) $line->fk_parent_line = -1; |
|
1743 | + if($line->fk_product_type!=9) { |
|
1744 | + $line->fk_parent_line = -1; |
|
1745 | + } |
|
1665 | 1746 | } |
1666 | 1747 | } |
1667 | 1748 | |
@@ -1682,7 +1763,9 @@ discard block |
||
1682 | 1763 | |
1683 | 1764 | if($line->qty>90) { |
1684 | 1765 | |
1685 | - if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) $label .= ' '.$this->getTitle($object, $line); |
|
1766 | + if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) { |
|
1767 | + $label .= ' '.$this->getTitle($object, $line); |
|
1768 | + } |
|
1686 | 1769 | |
1687 | 1770 | $pageBefore = $pdf->getPage(); |
1688 | 1771 | $this->pdf_add_total($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
@@ -1700,8 +1783,7 @@ discard block |
||
1700 | 1783 | |
1701 | 1784 | $posy = $pdf->GetY(); |
1702 | 1785 | return 1; |
1703 | - } |
|
1704 | - else if ($line->qty < 10) { |
|
1786 | + } else if ($line->qty < 10) { |
|
1705 | 1787 | $pageBefore = $pdf->getPage(); |
1706 | 1788 | |
1707 | 1789 | $this->pdf_add_title($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
@@ -1725,8 +1807,7 @@ discard block |
||
1725 | 1807 | // if($line->rowid==47) exit; |
1726 | 1808 | |
1727 | 1809 | return 0; |
1728 | - } |
|
1729 | - elseif (empty($object->lines[$parameters['i']])) |
|
1810 | + } elseif (empty($object->lines[$parameters['i']])) |
|
1730 | 1811 | { |
1731 | 1812 | $this->resprints = -1; |
1732 | 1813 | } |
@@ -1759,7 +1840,9 @@ discard block |
||
1759 | 1840 | |
1760 | 1841 | foreach ($object->lines as $line) |
1761 | 1842 | { |
1762 | - if ($line->id == $currentLine->id) break; |
|
1843 | + if ($line->id == $currentLine->id) { |
|
1844 | + break; |
|
1845 | + } |
|
1763 | 1846 | |
1764 | 1847 | $qty_search = 100 - $currentLine->qty; |
1765 | 1848 | |
@@ -1796,23 +1879,23 @@ discard block |
||
1796 | 1879 | { |
1797 | 1880 | $object->statut = 0; // hack for facture rec |
1798 | 1881 | $createRight = $user->rights->facture->creer; |
1799 | - } |
|
1800 | - elseif($object->element == 'order_supplier' ) |
|
1882 | + } elseif($object->element == 'order_supplier' ) |
|
1801 | 1883 | { |
1802 | 1884 | $createRight = $user->rights->fournisseur->commande->creer; |
1803 | - } |
|
1804 | - elseif($object->element == 'invoice_supplier' ) |
|
1885 | + } elseif($object->element == 'invoice_supplier' ) |
|
1805 | 1886 | { |
1806 | 1887 | $createRight = $user->rights->fournisseur->facture->creer; |
1807 | 1888 | } |
1808 | 1889 | |
1809 | 1890 | if($line->special_code!=$this->module_number || $line->product_type!=9) { |
1810 | 1891 | null; |
1811 | - } |
|
1812 | - 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)) |
|
1892 | + } 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)) |
|
1813 | 1893 | { |
1814 | - if($object->element=='facture')$idvar = 'facid'; |
|
1815 | - else $idvar='id'; |
|
1894 | + if($object->element=='facture') { |
|
1895 | + $idvar = 'facid'; |
|
1896 | + } else { |
|
1897 | + $idvar='id'; |
|
1898 | + } |
|
1816 | 1899 | |
1817 | 1900 | if((float)DOL_VERSION <= 3.4) |
1818 | 1901 | { |
@@ -1838,20 +1921,44 @@ discard block |
||
1838 | 1921 | <?php |
1839 | 1922 | } |
1840 | 1923 | |
1841 | - if(empty($line->description)) $line->description = $line->desc; |
|
1924 | + if(empty($line->description)) { |
|
1925 | + $line->description = $line->desc; |
|
1926 | + } |
|
1842 | 1927 | |
1843 | 1928 | $colspan = 5; |
1844 | - if($object->element == 'facturerec' ) $colspan = 3; |
|
1845 | - if($object->element == 'order_supplier') $colspan = 3; |
|
1846 | - if($object->element == 'invoice_supplier') $colspan = 4; |
|
1847 | - if($object->element == 'supplier_proposal') $colspan = 4; |
|
1848 | - if(!empty($conf->multicurrency->enabled)) $colspan+=2; |
|
1849 | - if($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) $colspan++; |
|
1850 | - if(!empty($conf->margin->enabled)) $colspan++; |
|
1851 | - if(!empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; |
|
1852 | - if(!empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; |
|
1853 | - if($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) $colspan++; |
|
1854 | - if(!empty($conf->global->PRODUCT_USE_UNITS)) $colspan++; |
|
1929 | + if($object->element == 'facturerec' ) { |
|
1930 | + $colspan = 3; |
|
1931 | + } |
|
1932 | + if($object->element == 'order_supplier') { |
|
1933 | + $colspan = 3; |
|
1934 | + } |
|
1935 | + if($object->element == 'invoice_supplier') { |
|
1936 | + $colspan = 4; |
|
1937 | + } |
|
1938 | + if($object->element == 'supplier_proposal') { |
|
1939 | + $colspan = 4; |
|
1940 | + } |
|
1941 | + if(!empty($conf->multicurrency->enabled)) { |
|
1942 | + $colspan+=2; |
|
1943 | + } |
|
1944 | + if($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) { |
|
1945 | + $colspan++; |
|
1946 | + } |
|
1947 | + if(!empty($conf->margin->enabled)) { |
|
1948 | + $colspan++; |
|
1949 | + } |
|
1950 | + if(!empty($conf->global->DISPLAY_MARGIN_RATES)) { |
|
1951 | + $colspan++; |
|
1952 | + } |
|
1953 | + if(!empty($conf->global->DISPLAY_MARK_RATES)) { |
|
1954 | + $colspan++; |
|
1955 | + } |
|
1956 | + if($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) { |
|
1957 | + $colspan++; |
|
1958 | + } |
|
1959 | + if(!empty($conf->global->PRODUCT_USE_UNITS)) { |
|
1960 | + $colspan++; |
|
1961 | + } |
|
1855 | 1962 | |
1856 | 1963 | /* Titre */ |
1857 | 1964 | //var_dump($line); |
@@ -1864,23 +1971,36 @@ discard block |
||
1864 | 1971 | <tr <?php echo $bc[$var]; $var=!$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
1865 | 1972 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT)) |
1866 | 1973 | { |
1867 | - if($line->qty==99) print 'background:#adadcf'; |
|
1868 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
1869 | - else if($line->qty<=97 && $line->qty>=91) print 'background:#eeeeff;'; |
|
1870 | - else if($line->qty==1) print 'background:#adadcf;'; |
|
1871 | - else if($line->qty==2) print 'background:#ddddff;'; |
|
1872 | - else if($line->qty==50) print ''; |
|
1873 | - else print 'background:#eeeeff;'; |
|
1974 | + if($line->qty==99) { |
|
1975 | + print 'background:#adadcf'; |
|
1976 | + } else if($line->qty==98) { |
|
1977 | + print 'background:#ddddff;'; |
|
1978 | + } else if($line->qty<=97 && $line->qty>=91) { |
|
1979 | + print 'background:#eeeeff;'; |
|
1980 | + } else if($line->qty==1) { |
|
1981 | + print 'background:#adadcf;'; |
|
1982 | + } else if($line->qty==2) { |
|
1983 | + print 'background:#ddddff;'; |
|
1984 | + } else if($line->qty==50) { |
|
1985 | + print ''; |
|
1986 | + } else { |
|
1987 | + print 'background:#eeeeff;'; |
|
1988 | + } |
|
1874 | 1989 | |
1875 | 1990 | //A compléter si on veux plus de nuances de couleurs avec les niveau 4,5,6,7,8 et 9 |
1876 | - } |
|
1877 | - else |
|
1991 | + } else |
|
1878 | 1992 | { |
1879 | - if($line->qty==99) print 'background:#ddffdd'; |
|
1880 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
1881 | - else if($line->qty==2) print 'background:#eeeeff; '; |
|
1882 | - else if($line->qty==50) print ''; |
|
1883 | - else print 'background:#eeffee;' ; |
|
1993 | + if($line->qty==99) { |
|
1994 | + print 'background:#ddffdd'; |
|
1995 | + } else if($line->qty==98) { |
|
1996 | + print 'background:#ddddff;'; |
|
1997 | + } else if($line->qty==2) { |
|
1998 | + print 'background:#eeeeff; '; |
|
1999 | + } else if($line->qty==50) { |
|
2000 | + print ''; |
|
2001 | + } else { |
|
2002 | + print 'background:#eeffee;' ; |
|
2003 | + } |
|
1884 | 2004 | } |
1885 | 2005 | |
1886 | 2006 | ?>;"> |
@@ -1903,13 +2023,11 @@ discard block |
||
1903 | 2023 | $qty_displayed = $line->qty; |
1904 | 2024 | print img_picto('', 'subsubtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;color:#0075DE;">'.$qty_displayed.'</span> '; |
1905 | 2025 | |
1906 | - } |
|
1907 | - else if (TSubtotal::isSubtotal($line)) |
|
2026 | + } else if (TSubtotal::isSubtotal($line)) |
|
1908 | 2027 | { |
1909 | 2028 | $qty_displayed = 100 - $line->qty; |
1910 | 2029 | print img_picto('', 'subsubtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;color:#0075DE;">'.$qty_displayed.'</span> '; |
1911 | - } |
|
1912 | - else |
|
2030 | + } else |
|
1913 | 2031 | { |
1914 | 2032 | $isFreeText = true; |
1915 | 2033 | } |
@@ -1930,9 +2048,13 @@ discard block |
||
1930 | 2048 | } |
1931 | 2049 | |
1932 | 2050 | $readonlyForSituation = ''; |
1933 | - if (!empty($object->situation_cycle_ref) && $object->situation_counter > 1) $readonlyForSituation = 'readonly'; |
|
2051 | + if (!empty($object->situation_cycle_ref) && $object->situation_counter > 1) { |
|
2052 | + $readonlyForSituation = 'readonly'; |
|
2053 | + } |
|
1934 | 2054 | |
1935 | - if (!$isFreeText) echo '<input type="text" name="line-title" id-line="'.$line->id.'" value="'.$newlabel.'" size="80" '.$readonlyForSituation.'/> '; |
|
2055 | + if (!$isFreeText) { |
|
2056 | + echo '<input type="text" name="line-title" id-line="'.$line->id.'" value="'.$newlabel.'" size="80" '.$readonlyForSituation.'/> '; |
|
2057 | + } |
|
1936 | 2058 | |
1937 | 2059 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT) && (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) ) |
1938 | 2060 | { |
@@ -1940,8 +2062,12 @@ discard block |
||
1940 | 2062 | for ($j=1; $j<10; $j++) |
1941 | 2063 | { |
1942 | 2064 | if (!empty($readonlyForSituation)) { |
1943 | - if ($qty_displayed == $j) $select .= '<option selected="selected" value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
|
1944 | - } else $select .= '<option '.($qty_displayed == $j ? 'selected="selected"' : '').' value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
|
2065 | + if ($qty_displayed == $j) { |
|
2066 | + $select .= '<option selected="selected" value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
|
2067 | + } |
|
2068 | + } else { |
|
2069 | + $select .= '<option '.($qty_displayed == $j ? 'selected="selected"' : '').' value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
|
2070 | + } |
|
1945 | 2071 | } |
1946 | 2072 | $select .= '</select> '; |
1947 | 2073 | |
@@ -1957,15 +2083,18 @@ discard block |
||
1957 | 2083 | $form = new Form($db); |
1958 | 2084 | echo '<label for="subtotal_tva_tx">'.$form->textwithpicto($langs->trans('subtotal_apply_default_tva'), $langs->trans('subtotal_apply_default_tva_help')).'</label>'; |
1959 | 2085 | echo '<select id="subtotal_tva_tx" name="subtotal_tva_tx" class="flat"><option selected="selected" value="">-</option>'; |
1960 | - if (empty($readonlyForSituation)) echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true)); |
|
2086 | + if (empty($readonlyForSituation)) { |
|
2087 | + echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true)); |
|
2088 | + } |
|
1961 | 2089 | echo '</select> '; |
1962 | 2090 | |
1963 | 2091 | if (!empty($conf->global->INVOICE_USE_SITUATION) && $object->element == 'facture' && $object->type == Facture::TYPE_SITUATION) |
1964 | 2092 | { |
1965 | 2093 | echo '<label for="subtotal_progress">'.$langs->trans('subtotal_apply_progress').'</label> <input id="subtotal_progress" name="subtotal_progress" value="" size="1" />%'; |
1966 | 2094 | } |
2095 | + } else if ($isFreeText) { |
|
2096 | + echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation); |
|
1967 | 2097 | } |
1968 | - else if ($isFreeText) echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation); |
|
1969 | 2098 | echo '</div>'; |
1970 | 2099 | |
1971 | 2100 | if($line->qty<10) { |
@@ -1985,8 +2114,7 @@ discard block |
||
1985 | 2114 | $doleditor->Create(); |
1986 | 2115 | } |
1987 | 2116 | |
1988 | - } |
|
1989 | - else { |
|
2117 | + } else { |
|
1990 | 2118 | |
1991 | 2119 | if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) |
1992 | 2120 | { |
@@ -1994,14 +2122,19 @@ discard block |
||
1994 | 2122 | { |
1995 | 2123 | echo str_repeat(' ', $line->qty-1); |
1996 | 2124 | |
1997 | - if (TSubtotal::isTitle($line)) print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
|
1998 | - else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
2125 | + if (TSubtotal::isTitle($line)) { |
|
2126 | + print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
|
2127 | + } else { |
|
2128 | + print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
2129 | + } |
|
1999 | 2130 | } |
2000 | - } |
|
2001 | - else |
|
2131 | + } else |
|
2002 | 2132 | { |
2003 | - if($line->qty<=1) print img_picto('', 'subtotal@subtotal'); |
|
2004 | - else if($line->qty==2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
2133 | + if($line->qty<=1) { |
|
2134 | + print img_picto('', 'subtotal@subtotal'); |
|
2135 | + } else if($line->qty==2) { |
|
2136 | + print img_picto('', 'subsubtotal@subtotal').' '; |
|
2137 | + } |
|
2005 | 2138 | } |
2006 | 2139 | |
2007 | 2140 | |
@@ -2011,21 +2144,26 @@ discard block |
||
2011 | 2144 | $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
2012 | 2145 | |
2013 | 2146 | if (empty($line->label)) { |
2014 | - if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) print $line->description.' '.$this->getTitle($object, $line); |
|
2015 | - else print $line->description; |
|
2016 | - } |
|
2017 | - else { |
|
2147 | + if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) { |
|
2148 | + print $line->description.' '.$this->getTitle($object, $line); |
|
2149 | + } else { |
|
2150 | + print $line->description; |
|
2151 | + } |
|
2152 | + } else { |
|
2018 | 2153 | |
2019 | 2154 | if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
2020 | 2155 | print '<span class="subtotal_label" style="'.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" >'.$line->label.'</span><br><div class="subtotal_desc">'.dol_htmlentitiesbr($line->description).'</div>'; |
2021 | - } |
|
2022 | - else{ |
|
2156 | + } else{ |
|
2023 | 2157 | print '<span class="subtotal_label classfortooltip '.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" title="'.$line->description.'">'.$line->label.'</span>'; |
2024 | 2158 | } |
2025 | 2159 | |
2026 | 2160 | } |
2027 | - if($line->qty>90) print ' : '; |
|
2028 | - if($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
2161 | + if($line->qty>90) { |
|
2162 | + print ' : '; |
|
2163 | + } |
|
2164 | + if($line->info_bits > 0) { |
|
2165 | + echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
2166 | + } |
|
2029 | 2167 | |
2030 | 2168 | |
2031 | 2169 | |
@@ -2062,11 +2200,12 @@ discard block |
||
2062 | 2200 | </script> |
2063 | 2201 | <?php |
2064 | 2202 | |
2065 | - } |
|
2066 | - else{ |
|
2203 | + } else{ |
|
2067 | 2204 | if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) && $object->element !== 'invoice_supplier') |
2068 | 2205 | { |
2069 | - 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>'; |
|
2206 | + if(TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref) ) { |
|
2207 | + echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=duplicate&lineid='.$line->id.'">'. img_picto($langs->trans('Duplicate'), 'duplicate@subtotal').'</a>'; |
|
2208 | + } |
|
2070 | 2209 | } |
2071 | 2210 | |
2072 | 2211 | if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_EDIT_BLOCK)) |
@@ -2135,7 +2274,9 @@ discard block |
||
2135 | 2274 | $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); |
2136 | 2275 | |
2137 | 2276 | $colspan+=3; $mode = 'view'; |
2138 | - if($action === 'editline' && $line->rowid == GETPOST('lineid')) $mode = 'edit'; |
|
2277 | + if($action === 'editline' && $line->rowid == GETPOST('lineid')) { |
|
2278 | + $mode = 'edit'; |
|
2279 | + } |
|
2139 | 2280 | |
2140 | 2281 | $ex_element = $line->element; |
2141 | 2282 | $line->element = 'tr_extrafield_title '.$line->element; // Pour pouvoir manipuler ces tr |
@@ -2317,10 +2458,9 @@ discard block |
||
2317 | 2458 | |
2318 | 2459 | if(TSubtotal::isTitle($line)){ |
2319 | 2460 | $ThtmlData['data-issubtotal'] = 'title'; |
2320 | - }elseif(TSubtotal::isSubtotal($line)){ |
|
2461 | + } elseif(TSubtotal::isSubtotal($line)){ |
|
2321 | 2462 | $ThtmlData['data-issubtotal'] = 'subtotal'; |
2322 | - } |
|
2323 | - else{ |
|
2463 | + } else{ |
|
2324 | 2464 | $ThtmlData['data-issubtotal'] = 'freetext'; |
2325 | 2465 | } |
2326 | 2466 | |
@@ -2330,7 +2470,9 @@ discard block |
||
2330 | 2470 | |
2331 | 2471 | // hook |
2332 | 2472 | $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
2333 | - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
2473 | + if ($reshook < 0) { |
|
2474 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
2475 | + } |
|
2334 | 2476 | if ($reshook>0) |
2335 | 2477 | { |
2336 | 2478 | $ThtmlData = $hookmanager->resArray; |