@@ -41,9 +41,9 @@ discard block |
||
41 | 41 | * @var $object Facture fournisseur |
42 | 42 | */ |
43 | 43 | else if($object->element=='invoice_supplier') { |
44 | - $object->special_code = TSubtotal::$module_number; |
|
45 | - if( (float)DOL_VERSION < 6 ) $rang = $object->line_max() + 1; |
|
46 | - $res = $object->addline($label,0,0,0,0,$qty,0,0,'','',0,0,'HT',9,$rang); |
|
44 | + $object->special_code = TSubtotal::$module_number; |
|
45 | + if( (float)DOL_VERSION < 6 ) $rang = $object->line_max() + 1; |
|
46 | + $res = $object->addline($label,0,0,0,0,$qty,0,0,'','',0,0,'HT',9,$rang); |
|
47 | 47 | } |
48 | 48 | /** |
49 | 49 | * @var $object Propal |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | * @var $object Commande fournisseur |
63 | 63 | */ |
64 | 64 | else if($object->element=='order_supplier') { |
65 | - $object->special_code = TSubtotal::$module_number; |
|
66 | - $res = $object->addline($label, 0,$qty,0,0,0,0,0,'',0,'HT', 0, 9); |
|
65 | + $object->special_code = TSubtotal::$module_number; |
|
66 | + $res = $object->addline($label, 0,$qty,0,0,0,0,0,'',0,'HT', 0, 9); |
|
67 | 67 | } |
68 | 68 | /** |
69 | 69 | * @var $object Facturerec |
@@ -323,8 +323,8 @@ discard block |
||
323 | 323 | { |
324 | 324 | if (empty($fk_commande)) return false; |
325 | 325 | |
326 | - $table = 'commandedet'; |
|
327 | - if ($supplier) $table = 'commande_fournisseurdet'; |
|
326 | + $table = 'commandedet'; |
|
327 | + if ($supplier) $table = 'commande_fournisseurdet'; |
|
328 | 328 | |
329 | 329 | $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.$table.' WHERE fk_commande = '.$fk_commande.' ORDER BY rang DESC LIMIT 1'; |
330 | 330 | $resql = $db->query($sql); |
@@ -376,10 +376,10 @@ discard block |
||
376 | 376 | |
377 | 377 | public static function isSubtotal(&$line, $level=-1) |
378 | 378 | { |
379 | - $res = $line->special_code == self::$module_number && $line->product_type == 9 && $line->qty >= 90; |
|
380 | - if($res && $level > -1) { |
|
381 | - return self::getNiveau($line) == $level; |
|
382 | - } else return $res; |
|
379 | + $res = $line->special_code == self::$module_number && $line->product_type == 9 && $line->qty >= 90; |
|
380 | + if($res && $level > -1) { |
|
381 | + return self::getNiveau($line) == $level; |
|
382 | + } else return $res; |
|
383 | 383 | } |
384 | 384 | |
385 | 385 | public static function isFreeText(&$line) |
@@ -416,29 +416,29 @@ discard block |
||
416 | 416 | $createRight = $user->rights->{$object->element}->creer; |
417 | 417 | if($object->element == 'facturerec' ) |
418 | 418 | { |
419 | - $object->statut = 0; // hack for facture rec |
|
420 | - $createRight = $user->rights->facture->creer; |
|
419 | + $object->statut = 0; // hack for facture rec |
|
420 | + $createRight = $user->rights->facture->creer; |
|
421 | 421 | } |
422 | 422 | elseif($object->element == 'order_supplier' ) |
423 | 423 | { |
424 | - $createRight = $user->rights->fournisseur->commande->creer; |
|
424 | + $createRight = $user->rights->fournisseur->commande->creer; |
|
425 | 425 | } |
426 | 426 | elseif($object->element == 'invoice_supplier' ) |
427 | 427 | { |
428 | - $createRight = $user->rights->fournisseur->facture->creer; |
|
428 | + $createRight = $user->rights->fournisseur->facture->creer; |
|
429 | 429 | } |
430 | 430 | |
431 | 431 | if ($object->statut == 0 && $createRight && (!empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) || !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_LINE))) |
432 | 432 | { |
433 | 433 | dol_include_once('/subtotal/lib/subtotal.lib.php'); |
434 | 434 | |
435 | - if(!empty($object->lines)) { |
|
436 | - foreach($object->lines as $line) { |
|
437 | - if($line->id == $lineid) $duplicateLine = $line; |
|
438 | - } |
|
439 | - } |
|
440 | - if(!empty($duplicateLine) && !self::isModSubtotalLine($duplicateLine)) $TLine = array($duplicateLine); |
|
441 | - else $TLine = self::getLinesFromTitleId($object, $lineid, $withBlockLine); |
|
435 | + if(!empty($object->lines)) { |
|
436 | + foreach($object->lines as $line) { |
|
437 | + if($line->id == $lineid) $duplicateLine = $line; |
|
438 | + } |
|
439 | + } |
|
440 | + if(!empty($duplicateLine) && !self::isModSubtotalLine($duplicateLine)) $TLine = array($duplicateLine); |
|
441 | + else $TLine = self::getLinesFromTitleId($object, $lineid, $withBlockLine); |
|
442 | 442 | |
443 | 443 | if (!empty($TLine)) |
444 | 444 | { |
@@ -456,8 +456,8 @@ discard block |
||
456 | 456 | break; |
457 | 457 | |
458 | 458 | case 'supplier_proposal': |
459 | - $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, $object->element, $line->id); |
|
460 | - break; |
|
459 | + $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, $object->element, $line->id); |
|
460 | + break; |
|
461 | 461 | |
462 | 462 | case 'commande': |
463 | 463 | //$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) |
@@ -465,12 +465,12 @@ discard block |
||
465 | 465 | break; |
466 | 466 | |
467 | 467 | case 'order_supplier': |
468 | - $object->line = $line; |
|
469 | - $object->line->origin = $object->element; |
|
470 | - $object->line->origin_id = $line->id; |
|
471 | - $object->line->fk_commande = $object->id; |
|
472 | - $object->line->rang = $object->line_max() +1; |
|
473 | - $res = $object->line->insert(1); |
|
468 | + $object->line = $line; |
|
469 | + $object->line->origin = $object->element; |
|
470 | + $object->line->origin_id = $line->id; |
|
471 | + $object->line->fk_commande = $object->id; |
|
472 | + $object->line->rang = $object->line_max() +1; |
|
473 | + $res = $object->line->insert(1); |
|
474 | 474 | break; |
475 | 475 | |
476 | 476 | case 'facture': |
@@ -523,8 +523,8 @@ discard block |
||
523 | 523 | $object->db->commit(); |
524 | 524 | foreach ($TLineAdded as &$line) |
525 | 525 | { |
526 | - // ç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 |
|
527 | - _updateLineNC($object->element, $object->id, $line->id, $line->array_options['options_subtotal_nc']); |
|
526 | + // ç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 |
|
527 | + _updateLineNC($object->element, $object->id, $line->id, $line->array_options['options_subtotal_nc']); |
|
528 | 528 | } |
529 | 529 | return count($TLineAdded); |
530 | 530 | } |
@@ -598,33 +598,33 @@ discard block |
||
598 | 598 | |
599 | 599 | switch ($object->element) |
600 | 600 | { |
601 | - case 'propal': |
|
602 | - $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, 0, $notrigger); |
|
603 | - break; |
|
601 | + case 'propal': |
|
602 | + $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, 0, $notrigger); |
|
603 | + break; |
|
604 | 604 | |
605 | - case 'supplier_proposal': |
|
606 | - $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); |
|
607 | - break; |
|
605 | + case 'supplier_proposal': |
|
606 | + $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); |
|
607 | + break; |
|
608 | 608 | |
609 | 609 | case 'commande': |
610 | 610 | $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, 0, $notrigger); |
611 | 611 | break; |
612 | 612 | |
613 | 613 | case 'order_supplier': |
614 | - $object->special_code = SELF::$module_number; |
|
615 | - if (empty($desc)) $desc = $label; |
|
616 | - $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); |
|
617 | - break; |
|
614 | + $object->special_code = SELF::$module_number; |
|
615 | + if (empty($desc)) $desc = $label; |
|
616 | + $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); |
|
617 | + break; |
|
618 | 618 | |
619 | 619 | case 'facture': |
620 | 620 | $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, 0, $notrigger); |
621 | 621 | break; |
622 | 622 | |
623 | 623 | case 'invoice_supplier': |
624 | - $object->special_code = SELF::$module_number; |
|
625 | - if (empty($desc)) $desc = $label; |
|
626 | - $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); |
|
627 | - break; |
|
624 | + $object->special_code = SELF::$module_number; |
|
625 | + if (empty($desc)) $desc = $label; |
|
626 | + $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); |
|
627 | + break; |
|
628 | 628 | |
629 | 629 | case 'facturerec': |
630 | 630 | // Add extrafields and get rang |
@@ -1015,8 +1015,8 @@ discard block |
||
1015 | 1015 | { |
1016 | 1016 | if (is_readable($logo)) |
1017 | 1017 | { |
1018 | - $height=pdf_getHeightForLogo($logo); |
|
1019 | - $pdf->Image($logo, $objmarge->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
1018 | + $height=pdf_getHeightForLogo($logo); |
|
1019 | + $pdf->Image($logo, $objmarge->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
1020 | 1020 | } |
1021 | 1021 | else |
1022 | 1022 | { |
@@ -1207,13 +1207,13 @@ discard block |
||
1207 | 1207 | * @param int $hidebottom Hide bottom |
1208 | 1208 | * @return void |
1209 | 1209 | */ |
1210 | - private static function printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0) |
|
1211 | - { |
|
1212 | - if (empty($hidetop) || $hidetop==-1) $pdf->line($x, $y, $x+$l, $y); |
|
1213 | - $pdf->line($x+$l, $y, $x+$l, $y+$h); |
|
1214 | - if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h); |
|
1215 | - $pdf->line($x, $y+$h, $x, $y); |
|
1216 | - } |
|
1210 | + private static function printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0) |
|
1211 | + { |
|
1212 | + if (empty($hidetop) || $hidetop==-1) $pdf->line($x, $y, $x+$l, $y); |
|
1213 | + $pdf->line($x+$l, $y, $x+$l, $y+$h); |
|
1214 | + if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h); |
|
1215 | + $pdf->line($x, $y+$h, $x, $y); |
|
1216 | + } |
|
1217 | 1217 | |
1218 | 1218 | |
1219 | 1219 | public static function concat(&$outputlangs, $files, $fileoutput='') |
@@ -1223,14 +1223,14 @@ discard block |
||
1223 | 1223 | if (empty($fileoutput)) $fileoutput = $file[0]; |
1224 | 1224 | |
1225 | 1225 | $pdf=pdf_getInstance(); |
1226 | - if (class_exists('TCPDF')) |
|
1227 | - { |
|
1228 | - $pdf->setPrintHeader(false); |
|
1229 | - $pdf->setPrintFooter(false); |
|
1230 | - } |
|
1231 | - $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
|
1226 | + if (class_exists('TCPDF')) |
|
1227 | + { |
|
1228 | + $pdf->setPrintHeader(false); |
|
1229 | + $pdf->setPrintFooter(false); |
|
1230 | + } |
|
1231 | + $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
|
1232 | 1232 | |
1233 | - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
1233 | + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
1234 | 1234 | |
1235 | 1235 | |
1236 | 1236 | foreach($files as $file) |
@@ -5,30 +5,30 @@ 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 | 29 | |
30 | - $TNotElements = array ('invoice_supplier', 'order_supplier'); |
|
31 | - if ((float) DOL_VERSION < 6 || $qty==50 && !in_array($object->element, $TNotElements) ) { |
|
30 | + $TNotElements = array('invoice_supplier', 'order_supplier'); |
|
31 | + if ((float) DOL_VERSION < 6 || $qty == 50 && !in_array($object->element, $TNotElements)) { |
|
32 | 32 | $desc = $label; |
33 | 33 | $label = ''; |
34 | 34 | } |
@@ -36,39 +36,39 @@ discard block |
||
36 | 36 | /** |
37 | 37 | * @var $object Facture |
38 | 38 | */ |
39 | - 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); |
|
39 | + 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); |
|
40 | 40 | /** |
41 | 41 | * @var $object Facture fournisseur |
42 | 42 | */ |
43 | - else if($object->element=='invoice_supplier') { |
|
43 | + else if ($object->element == 'invoice_supplier') { |
|
44 | 44 | $object->special_code = TSubtotal::$module_number; |
45 | - if( (float)DOL_VERSION < 6 ) $rang = $object->line_max() + 1; |
|
46 | - $res = $object->addline($label,0,0,0,0,$qty,0,0,'','',0,0,'HT',9,$rang); |
|
45 | + if ((float) DOL_VERSION < 6) $rang = $object->line_max() + 1; |
|
46 | + $res = $object->addline($label, 0, 0, 0, 0, $qty, 0, 0, '', '', 0, 0, 'HT', 9, $rang); |
|
47 | 47 | } |
48 | 48 | /** |
49 | 49 | * @var $object Propal |
50 | 50 | */ |
51 | - 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 | + 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); |
|
52 | 52 | /** |
53 | 53 | * @var $object Propal Fournisseur |
54 | 54 | */ |
55 | - 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 | + 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); |
|
56 | 56 | |
57 | 57 | /** |
58 | 58 | * @var $object Commande |
59 | 59 | */ |
60 | - 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 | + 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); |
|
61 | 61 | /** |
62 | 62 | * @var $object Commande fournisseur |
63 | 63 | */ |
64 | - else if($object->element=='order_supplier') { |
|
64 | + else if ($object->element == 'order_supplier') { |
|
65 | 65 | $object->special_code = TSubtotal::$module_number; |
66 | - $res = $object->addline($label, 0,$qty,0,0,0,0,0,'',0,'HT', 0, 9); |
|
66 | + $res = $object->addline($label, 0, $qty, 0, 0, 0, 0, 0, '', 0, 'HT', 0, 9); |
|
67 | 67 | } |
68 | 68 | /** |
69 | 69 | * @var $object Facturerec |
70 | 70 | */ |
71 | - 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 | + 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); |
|
72 | 72 | |
73 | 73 | } |
74 | 74 | |
@@ -79,20 +79,20 @@ discard block |
||
79 | 79 | |
80 | 80 | public static function generateDoc(&$object) |
81 | 81 | { |
82 | - global $conf,$langs,$db; |
|
82 | + global $conf, $langs, $db; |
|
83 | 83 | |
84 | 84 | if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) |
85 | 85 | { |
86 | - $hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); |
|
87 | - $hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0)); |
|
88 | - $hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0)); |
|
86 | + $hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); |
|
87 | + $hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0)); |
|
88 | + $hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0)); |
|
89 | 89 | |
90 | 90 | // Define output language |
91 | 91 | $outputlangs = $langs; |
92 | 92 | $newlang = GETPOST('lang_id', 'alpha'); |
93 | - if (! empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) |
|
93 | + if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) |
|
94 | 94 | $newlang = !empty($object->client) ? $object->client->default_lang : $object->thirdparty->default_lang; |
95 | - if (! empty($newlang)) { |
|
95 | + if (!empty($newlang)) { |
|
96 | 96 | $outputlangs = new Translate("", $conf); |
97 | 97 | $outputlangs->setDefaultLang($newlang); |
98 | 98 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | } |
107 | 107 | else |
108 | 108 | { |
109 | - if ($object->element!= 'facturerec') $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
109 | + if ($object->element != 'facturerec') $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | } |
@@ -118,11 +118,11 @@ discard block |
||
118 | 118 | * @param type $rang_start |
119 | 119 | * @param type $move_to |
120 | 120 | */ |
121 | - public static function updateRang(&$object, $rang_start, $move_to=1) |
|
121 | + public static function updateRang(&$object, $rang_start, $move_to = 1) |
|
122 | 122 | { |
123 | 123 | if (!class_exists('GenericObject')) require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php'; |
124 | 124 | |
125 | - $row=new GenericObject($object->db); |
|
125 | + $row = new GenericObject($object->db); |
|
126 | 126 | $row->table_element_line = $object->table_element_line; |
127 | 127 | $row->fk_element = $object->fk_element; |
128 | 128 | $row->id = $object->id; |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | { |
132 | 132 | if ($line->rang < $rang_start) continue; |
133 | 133 | |
134 | - $row->updateRangOfLine($line->id, $line->rang+$move_to); |
|
134 | + $row->updateRangOfLine($line->id, $line->rang + $move_to); |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | { |
161 | 161 | if ($rang_to_add != -1) self::updateRang($object, $rang_to_add); |
162 | 162 | |
163 | - self::addSubTotalLine($object, $langs->trans('SubTotal'), 100-$title_niveau, $rang_to_add); |
|
163 | + self::addSubTotalLine($object, $langs->trans('SubTotal'), 100 - $title_niveau, $rang_to_add); |
|
164 | 164 | |
165 | 165 | $object->lines[] = $object->line; // ajout de la ligne dans le tableau de ligne (Dolibarr ne le fait pas) |
166 | 166 | if ($rang_to_add != -1) |
@@ -172,14 +172,14 @@ discard block |
||
172 | 172 | } |
173 | 173 | } |
174 | 174 | |
175 | - public static function addTitle(&$object, $label, $level, $rang=-1) |
|
175 | + public static function addTitle(&$object, $label, $level, $rang = -1) |
|
176 | 176 | { |
177 | 177 | self::addSubTotalLine($object, $label, $level, $rang); |
178 | 178 | } |
179 | 179 | |
180 | - public static function addTotal(&$object, $label, $level, $rang=-1) |
|
180 | + public static function addTotal(&$object, $label, $level, $rang = -1) |
|
181 | 181 | { |
182 | - self::addSubTotalLine($object, $label, (100-$level), $rang); |
|
182 | + self::addSubTotalLine($object, $label, (100 - $level), $rang); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | /** |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | * |
191 | 191 | * @return array |
192 | 192 | */ |
193 | - public static function getAllTitleWithoutTotalFromDocument(&$object, $get_block_total=false) |
|
193 | + public static function getAllTitleWithoutTotalFromDocument(&$object, $get_block_total = false) |
|
194 | 194 | { |
195 | 195 | $TTitle = self::getAllTitleFromDocument($object, $get_block_total); |
196 | 196 | |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | * @param boolean $return_rang_on_false si true alors renvoi le rang où devrait ce trouver le sous-total |
212 | 212 | * @return boolean |
213 | 213 | */ |
214 | - public static function titleHasTotalLine(&$object, &$title_line, $strict_mode=false, $return_rang_on_false=false) |
|
214 | + public static function titleHasTotalLine(&$object, &$title_line, $strict_mode = false, $return_rang_on_false = false) |
|
215 | 215 | { |
216 | 216 | if (empty($object->lines) || !is_array($object->lines)) return false; |
217 | 217 | |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | return ($return_rang_on_false) ? -1 : false; |
238 | 238 | } |
239 | 239 | |
240 | - public static function getAllTitleFromDocument(&$object, $get_block_total=false) |
|
240 | + public static function getAllTitleFromDocument(&$object, $get_block_total = false) |
|
241 | 241 | { |
242 | 242 | $TRes = array(); |
243 | 243 | if (!empty($object->lines)) |
@@ -365,19 +365,19 @@ discard block |
||
365 | 365 | return false; |
366 | 366 | } |
367 | 367 | |
368 | - public static function isTitle(&$line, $level=-1) |
|
368 | + public static function isTitle(&$line, $level = -1) |
|
369 | 369 | { |
370 | 370 | $res = $line->special_code == self::$module_number && $line->product_type == 9 && $line->qty <= 9; |
371 | - if($res && $level > -1) { |
|
371 | + if ($res && $level > -1) { |
|
372 | 372 | return $line->qty == $level; |
373 | 373 | } else return $res; |
374 | 374 | |
375 | 375 | } |
376 | 376 | |
377 | - public static function isSubtotal(&$line, $level=-1) |
|
377 | + public static function isSubtotal(&$line, $level = -1) |
|
378 | 378 | { |
379 | 379 | $res = $line->special_code == self::$module_number && $line->product_type == 9 && $line->qty >= 90; |
380 | - if($res && $level > -1) { |
|
380 | + if ($res && $level > -1) { |
|
381 | 381 | return self::getNiveau($line) == $level; |
382 | 382 | } else return $res; |
383 | 383 | } |
@@ -392,52 +392,52 @@ discard block |
||
392 | 392 | return self::isTitle($line) || self::isSubtotal($line) || self::isFreeText($line); |
393 | 393 | } |
394 | 394 | |
395 | - public static function getFreeTextHtml(&$line, $readonly=0) |
|
395 | + public static function getFreeTextHtml(&$line, $readonly = 0) |
|
396 | 396 | { |
397 | 397 | global $conf; |
398 | 398 | |
399 | 399 | // Copie du fichier "objectline_edit.tpl.php" |
400 | 400 | // editeur wysiwyg |
401 | 401 | require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
402 | - $nbrows=ROWS_2; |
|
403 | - if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; |
|
404 | - $enable=(isset($conf->global->FCKEDITOR_ENABLE_DETAILS)?$conf->global->FCKEDITOR_ENABLE_DETAILS:0); |
|
405 | - $toolbarname='dolibarr_details'; |
|
406 | - if (! empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) $toolbarname='dolibarr_notes'; |
|
407 | - $text = !empty($line->description)?$line->description:$line->label; |
|
408 | - $doleditor=new DolEditor('line-description',$text,'',164,$toolbarname,'',false,true,$enable,$nbrows,'98%', $readonly); |
|
402 | + $nbrows = ROWS_2; |
|
403 | + if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT; |
|
404 | + $enable = (isset($conf->global->FCKEDITOR_ENABLE_DETAILS) ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0); |
|
405 | + $toolbarname = 'dolibarr_details'; |
|
406 | + if (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) $toolbarname = 'dolibarr_notes'; |
|
407 | + $text = !empty($line->description) ? $line->description : $line->label; |
|
408 | + $doleditor = new DolEditor('line-description', $text, '', 164, $toolbarname, '', false, true, $enable, $nbrows, '98%', $readonly); |
|
409 | 409 | return $doleditor->Create(1); |
410 | 410 | } |
411 | 411 | |
412 | - public static function duplicateLines(&$object, $lineid, $withBlockLine=false) |
|
412 | + public static function duplicateLines(&$object, $lineid, $withBlockLine = false) |
|
413 | 413 | { |
414 | - global $db,$user,$conf; |
|
414 | + global $db, $user, $conf; |
|
415 | 415 | |
416 | 416 | $createRight = $user->rights->{$object->element}->creer; |
417 | - if($object->element == 'facturerec' ) |
|
417 | + if ($object->element == 'facturerec') |
|
418 | 418 | { |
419 | 419 | $object->statut = 0; // hack for facture rec |
420 | 420 | $createRight = $user->rights->facture->creer; |
421 | 421 | } |
422 | - elseif($object->element == 'order_supplier' ) |
|
422 | + elseif ($object->element == 'order_supplier') |
|
423 | 423 | { |
424 | 424 | $createRight = $user->rights->fournisseur->commande->creer; |
425 | 425 | } |
426 | - elseif($object->element == 'invoice_supplier' ) |
|
426 | + elseif ($object->element == 'invoice_supplier') |
|
427 | 427 | { |
428 | 428 | $createRight = $user->rights->fournisseur->facture->creer; |
429 | 429 | } |
430 | 430 | |
431 | - if ($object->statut == 0 && $createRight && (!empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) || !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_LINE))) |
|
431 | + if ($object->statut == 0 && $createRight && (!empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) || !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_LINE))) |
|
432 | 432 | { |
433 | 433 | dol_include_once('/subtotal/lib/subtotal.lib.php'); |
434 | 434 | |
435 | - if(!empty($object->lines)) { |
|
436 | - foreach($object->lines as $line) { |
|
437 | - if($line->id == $lineid) $duplicateLine = $line; |
|
435 | + if (!empty($object->lines)) { |
|
436 | + foreach ($object->lines as $line) { |
|
437 | + if ($line->id == $lineid) $duplicateLine = $line; |
|
438 | 438 | } |
439 | 439 | } |
440 | - if(!empty($duplicateLine) && !self::isModSubtotalLine($duplicateLine)) $TLine = array($duplicateLine); |
|
440 | + if (!empty($duplicateLine) && !self::isModSubtotalLine($duplicateLine)) $TLine = array($duplicateLine); |
|
441 | 441 | else $TLine = self::getLinesFromTitleId($object, $lineid, $withBlockLine); |
442 | 442 | |
443 | 443 | if (!empty($TLine)) |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | $object->line->origin = $object->element; |
470 | 470 | $object->line->origin_id = $line->id; |
471 | 471 | $object->line->fk_commande = $object->id; |
472 | - $object->line->rang = $object->line_max() +1; |
|
472 | + $object->line->rang = $object->line_max() + 1; |
|
473 | 473 | $res = $object->line->insert(1); |
474 | 474 | break; |
475 | 475 | |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | { |
510 | 510 | $object->line_from = $line; |
511 | 511 | // Call trigger |
512 | - $result=$object->call_trigger('LINE_DUPLICATE',$user); // $object->line |
|
512 | + $result = $object->call_trigger('LINE_DUPLICATE', $user); // $object->line |
|
513 | 513 | if ($result < 0) |
514 | 514 | { |
515 | 515 | $object->db->rollback(); |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | } |
540 | 540 | } |
541 | 541 | |
542 | - public static function getLinesFromTitle(&$object, $key_trad, $level=1, $under_title='', $withBlockLine=false, $key_is_id=false) |
|
542 | + public static function getLinesFromTitle(&$object, $key_trad, $level = 1, $under_title = '', $withBlockLine = false, $key_is_id = false) |
|
543 | 543 | { |
544 | 544 | global $langs; |
545 | 545 | |
@@ -551,17 +551,17 @@ discard block |
||
551 | 551 | |
552 | 552 | $TLine = array(); |
553 | 553 | $add_line = false; |
554 | - $under_title_found=false; |
|
554 | + $under_title_found = false; |
|
555 | 555 | |
556 | 556 | foreach ($object->lines as $key => &$line) |
557 | 557 | { |
558 | 558 | if (!$under_title_found && !empty($TTitle_under_search)) |
559 | 559 | { |
560 | - if ($line->product_type == 9 && (in_array($line->desc, $TTitle_under_search) || in_array($line->label, $TTitle_under_search)) ) $under_title_found = true; |
|
560 | + if ($line->product_type == 9 && (in_array($line->desc, $TTitle_under_search) || in_array($line->label, $TTitle_under_search))) $under_title_found = true; |
|
561 | 561 | } |
562 | 562 | else |
563 | 563 | { |
564 | - 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) ))) |
|
564 | + 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)))) |
|
565 | 565 | { |
566 | 566 | if ($key_is_id) $level = $line->qty; |
567 | 567 | |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | |
578 | 578 | if ($add_line) |
579 | 579 | { |
580 | - if (!$withBlockLine && (self::isTitle($line) || self::isSubtotal($line)) ) continue; |
|
580 | + if (!$withBlockLine && (self::isTitle($line) || self::isSubtotal($line))) continue; |
|
581 | 581 | else $TLine[] = $line; |
582 | 582 | } |
583 | 583 | } |
@@ -586,12 +586,12 @@ discard block |
||
586 | 586 | return $TLine; |
587 | 587 | } |
588 | 588 | |
589 | - public static function getLinesFromTitleId(&$object, $lineid, $withBlockLine=false) |
|
589 | + public static function getLinesFromTitleId(&$object, $lineid, $withBlockLine = false) |
|
590 | 590 | { |
591 | 591 | return self::getLinesFromTitle($object, $lineid, '', '', $withBlockLine, true); |
592 | 592 | } |
593 | 593 | |
594 | - 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, $notrigger = 0) |
|
594 | + 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, $notrigger = 0) |
|
595 | 595 | { |
596 | 596 | $res = 0; |
597 | 597 | $object->db->begin(); |
@@ -603,7 +603,7 @@ discard block |
||
603 | 603 | break; |
604 | 604 | |
605 | 605 | case 'supplier_proposal': |
606 | - $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); |
|
606 | + $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); |
|
607 | 607 | break; |
608 | 608 | |
609 | 609 | case 'commande': |
@@ -632,9 +632,9 @@ discard block |
||
632 | 632 | $factureRecLine->fetch($rowid); |
633 | 633 | $factureRecLine->array_options = $array_options; |
634 | 634 | $factureRecLine->insertExtraFields(); |
635 | - $rang=$factureRecLine->rang; |
|
635 | + $rang = $factureRecLine->rang; |
|
636 | 636 | |
637 | - $fk_product=0; $fk_remise_except=''; $pu_ttc=0; |
|
637 | + $fk_product = 0; $fk_remise_except = ''; $pu_ttc = 0; |
|
638 | 638 | $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); |
639 | 639 | break; |
640 | 640 | } |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | global $db, $object; |
651 | 651 | |
652 | 652 | $TTitle = array(); |
653 | - if(! empty($object->id) && in_array($object->element, array('propal', 'commande', 'facture'))) {} |
|
653 | + if (!empty($object->id) && in_array($object->element, array('propal', 'commande', 'facture'))) {} |
|
654 | 654 | else { |
655 | 655 | if ($origin_line->element == 'propaldet') |
656 | 656 | { |
@@ -730,7 +730,7 @@ discard block |
||
730 | 730 | */ |
731 | 731 | public static function addRecapPage(&$parameters, &$origin_pdf) |
732 | 732 | { |
733 | - global $user,$conf,$langs; |
|
733 | + global $user, $conf, $langs; |
|
734 | 734 | |
735 | 735 | $origin_file = $parameters['file']; |
736 | 736 | $outputlangs = $parameters['outputlangs']; |
@@ -746,21 +746,21 @@ discard block |
||
746 | 746 | $objmarge->marge_droite = 10; |
747 | 747 | |
748 | 748 | $objectref = dol_sanitizeFileName($object->ref); |
749 | - if ($object->element == 'propal') $dir = $conf->propal->dir_output . '/' . $objectref; |
|
750 | - elseif ($object->element == 'commande') $dir = $conf->commande->dir_output . '/' . $objectref; |
|
751 | - elseif ($object->element == 'facture') $dir = $conf->facture->dir_output . '/' . $objectref; |
|
749 | + if ($object->element == 'propal') $dir = $conf->propal->dir_output.'/'.$objectref; |
|
750 | + elseif ($object->element == 'commande') $dir = $conf->commande->dir_output.'/'.$objectref; |
|
751 | + elseif ($object->element == 'facture') $dir = $conf->facture->dir_output.'/'.$objectref; |
|
752 | 752 | elseif ($object->element == 'facturerec') return; // no PDF for facturerec |
753 | 753 | else |
754 | 754 | { |
755 | 755 | setEventMessage($langs->trans('warning_subtotal_recap_object_element_unknown', $object->element), 'warnings'); |
756 | 756 | return -1; |
757 | 757 | } |
758 | - $file = $dir . '/' . $objectref . '_recap.pdf'; |
|
758 | + $file = $dir.'/'.$objectref.'_recap.pdf'; |
|
759 | 759 | |
760 | 760 | // $pdf=pdf_getInstance($origin_pdf->format); |
761 | - $pdf=pdf_getInstance(array(210, 297)); // Format A4 Portrait |
|
762 | - $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance |
|
763 | - $pdf->SetAutoPageBreak(1,0); |
|
761 | + $pdf = pdf_getInstance(array(210, 297)); // Format A4 Portrait |
|
762 | + $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance |
|
763 | + $pdf->SetAutoPageBreak(1, 0); |
|
764 | 764 | |
765 | 765 | if (class_exists('TCPDF')) |
766 | 766 | { |
@@ -769,49 +769,49 @@ discard block |
||
769 | 769 | } |
770 | 770 | $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
771 | 771 | // Set path to the background PDF File |
772 | - if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) |
|
772 | + if (empty($conf->global->MAIN_DISABLE_FPDI) && !empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) |
|
773 | 773 | { |
774 | 774 | $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); |
775 | 775 | $tplidx = $pdf->importPage(1); |
776 | 776 | } |
777 | 777 | |
778 | 778 | $pdf->Open(); |
779 | - $pagenb=0; |
|
780 | - $pdf->SetDrawColor(128,128,128); |
|
779 | + $pagenb = 0; |
|
780 | + $pdf->SetDrawColor(128, 128, 128); |
|
781 | 781 | |
782 | 782 | $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); |
783 | 783 | $pdf->SetSubject($outputlangs->transnoentities("subtotalRecap")); |
784 | 784 | $pdf->SetCreator("Dolibarr ".DOL_VERSION); |
785 | 785 | $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); |
786 | 786 | $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("subtotalRecap")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); |
787 | - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
787 | + if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
788 | 788 | |
789 | - $pdf->SetMargins($objmarge->marge_gauche, $objmarge->marge_haute, $objmarge->marge_droite); // Left, Top, Right |
|
789 | + $pdf->SetMargins($objmarge->marge_gauche, $objmarge->marge_haute, $objmarge->marge_droite); // Left, Top, Right |
|
790 | 790 | |
791 | - $pagenb=0; |
|
792 | - $pdf->SetDrawColor(128,128,128); |
|
791 | + $pagenb = 0; |
|
792 | + $pdf->SetDrawColor(128, 128, 128); |
|
793 | 793 | |
794 | 794 | |
795 | 795 | // New page |
796 | 796 | $pdf->AddPage(); |
797 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
797 | + if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
798 | 798 | $pagenb++; |
799 | 799 | |
800 | 800 | |
801 | 801 | self::pagehead($objmarge, $pdf, $object, 1, $outputlangs); |
802 | - $pdf->SetFont('','', $default_font_size - 1); |
|
803 | - $pdf->MultiCell(0, 3, ''); // Set interline to 3 |
|
804 | - $pdf->SetTextColor(0,0,0); |
|
802 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
803 | + $pdf->MultiCell(0, 3, ''); // Set interline to 3 |
|
804 | + $pdf->SetTextColor(0, 0, 0); |
|
805 | 805 | |
806 | - $heightforinfotot = 25; // Height reserved to output the info and total part |
|
807 | - $heightforfooter = $objmarge->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
|
806 | + $heightforinfotot = 25; // Height reserved to output the info and total part |
|
807 | + $heightforfooter = $objmarge->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
|
808 | 808 | |
809 | 809 | $posx_designation = 25; |
810 | 810 | $posx_options = 150; |
811 | 811 | $posx_montant = 170; |
812 | 812 | |
813 | 813 | $tab_top = 72; |
814 | - $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?72:20); // TODO à vérifier |
|
814 | + $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 72 : 20); // TODO à vérifier |
|
815 | 815 | |
816 | 816 | $TTot = array('total_ht' => 0, 'total_ttc' => 0, 'TTotal_tva' => array()); |
817 | 817 | |
@@ -825,14 +825,14 @@ discard block |
||
825 | 825 | $nexY = $tab_top + 10; |
826 | 826 | |
827 | 827 | $nblignes = count($TLine); |
828 | - foreach($TLine as $i => &$line) |
|
828 | + foreach ($TLine as $i => &$line) |
|
829 | 829 | { |
830 | 830 | $curY = $nexY; |
831 | 831 | |
832 | 832 | if (self::getNiveau($line) == 1) |
833 | 833 | { |
834 | - $pdf->SetFont('','B', $default_font_size - 1); // Into loop to work with multipage |
|
835 | - $curY+=2; |
|
834 | + $pdf->SetFont('', 'B', $default_font_size - 1); // Into loop to work with multipage |
|
835 | + $curY += 2; |
|
836 | 836 | |
837 | 837 | $TTot['total_ht'] += $line->total_ht; |
838 | 838 | $TTot['total_tva'] += $line->total_tva; |
@@ -851,67 +851,67 @@ discard block |
||
851 | 851 | $TTot['TTotal_tva_multicurrency'][$tx] += $amount; |
852 | 852 | } |
853 | 853 | } |
854 | - else $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage |
|
854 | + else $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage |
|
855 | 855 | |
856 | - $pdf->SetTextColor(0,0,0); |
|
856 | + $pdf->SetTextColor(0, 0, 0); |
|
857 | 857 | |
858 | 858 | $pdf->setTopMargin($tab_top_newpage + 10); |
859 | - $pdf->setPageOrientation('', 1, $heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. |
|
860 | - $pageposbefore=$pdf->getPage(); |
|
859 | + $pdf->setPageOrientation('', 1, $heightforfooter + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. |
|
860 | + $pageposbefore = $pdf->getPage(); |
|
861 | 861 | |
862 | - $showpricebeforepagebreak=1; |
|
862 | + $showpricebeforepagebreak = 1; |
|
863 | 863 | |
864 | 864 | $decalage = (self::getNiveau($line) - 1) * 2; |
865 | 865 | |
866 | 866 | // Print: Designation |
867 | 867 | $label = $line->label; |
868 | - if( (float)DOL_VERSION < 6 ) { |
|
868 | + if ((float) DOL_VERSION < 6) { |
|
869 | 869 | $label = !empty($line->label) ? $line->label : $line->desc; |
870 | 870 | } |
871 | 871 | |
872 | 872 | |
873 | 873 | $pdf->startTransaction(); |
874 | - $pdf->writeHTMLCell($posx_options-$posx_designation-$decalage, 3, $posx_designation+$decalage, $curY, $outputlangs->convToOutputCharset($label), 0, 1, false, true, 'J',true); |
|
875 | - $pageposafter=$pdf->getPage(); |
|
874 | + $pdf->writeHTMLCell($posx_options - $posx_designation - $decalage, 3, $posx_designation + $decalage, $curY, $outputlangs->convToOutputCharset($label), 0, 1, false, true, 'J', true); |
|
875 | + $pageposafter = $pdf->getPage(); |
|
876 | 876 | if ($pageposafter > $pageposbefore) // There is a pagebreak |
877 | 877 | { |
878 | 878 | $pdf->rollbackTransaction(true); |
879 | - $pageposafter=$pageposbefore; |
|
879 | + $pageposafter = $pageposbefore; |
|
880 | 880 | //print $pageposafter.'-'.$pageposbefore;exit; |
881 | - $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
|
882 | - $pdf->writeHTMLCell($posx_options-$posx_designation-$decalage, 3, $posx_designation+$decalage, $curY, $outputlangs->convToOutputCharset($label), 0, 1, false, true, 'J',true); |
|
881 | + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
|
882 | + $pdf->writeHTMLCell($posx_options - $posx_designation - $decalage, 3, $posx_designation + $decalage, $curY, $outputlangs->convToOutputCharset($label), 0, 1, false, true, 'J', true); |
|
883 | 883 | |
884 | - $pageposafter=$pdf->getPage(); |
|
885 | - $posyafter=$pdf->GetY(); |
|
884 | + $pageposafter = $pdf->getPage(); |
|
885 | + $posyafter = $pdf->GetY(); |
|
886 | 886 | //var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit; |
887 | - if ($posyafter > ($objmarge->page_hauteur - ($heightforfooter+$heightforinfotot))) // There is no space left for total+free text |
|
887 | + if ($posyafter > ($objmarge->page_hauteur - ($heightforfooter + $heightforinfotot))) // There is no space left for total+free text |
|
888 | 888 | { |
889 | - if ($i == ($nblignes-1)) // No more lines, and no space left to show total, so we create a new page |
|
889 | + if ($i == ($nblignes - 1)) // No more lines, and no space left to show total, so we create a new page |
|
890 | 890 | { |
891 | - $pdf->AddPage('','',true); |
|
892 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
891 | + $pdf->AddPage('', '', true); |
|
892 | + if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
893 | 893 | if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) self::pagehead($objmarge, $pdf, $object, 0, $outputlangs); |
894 | - $pdf->setPage($pageposafter+1); |
|
894 | + $pdf->setPage($pageposafter + 1); |
|
895 | 895 | } |
896 | 896 | } |
897 | 897 | else |
898 | 898 | { |
899 | 899 | // We found a page break |
900 | - $showpricebeforepagebreak=0; |
|
900 | + $showpricebeforepagebreak = 0; |
|
901 | 901 | } |
902 | 902 | } |
903 | 903 | else // No pagebreak |
904 | 904 | { |
905 | 905 | $pdf->commitTransaction(); |
906 | 906 | } |
907 | - $posYAfterDescription=$pdf->GetY(); |
|
907 | + $posYAfterDescription = $pdf->GetY(); |
|
908 | 908 | |
909 | 909 | $nexY = $pdf->GetY(); |
910 | - $pageposafter=$pdf->getPage(); |
|
910 | + $pageposafter = $pdf->getPage(); |
|
911 | 911 | |
912 | 912 | $pdf->setPage($pageposbefore); |
913 | 913 | $pdf->setTopMargin($objmarge->marge_haute); |
914 | - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
914 | + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
915 | 915 | |
916 | 916 | // We suppose that a too long description or photo were moved completely on next page |
917 | 917 | if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { |
@@ -924,14 +924,14 @@ discard block |
||
924 | 924 | if (!empty($line->total_options)) |
925 | 925 | { |
926 | 926 | $pdf->SetXY($posx_options, $curY); |
927 | - $pdf->MultiCell($posx_montant-$posx_options-0.8, 3, price($line->total_options, 0, $outputlangs), 0, 'R', 0); |
|
927 | + $pdf->MultiCell($posx_montant - $posx_options - 0.8, 3, price($line->total_options, 0, $outputlangs), 0, 'R', 0); |
|
928 | 928 | } |
929 | 929 | |
930 | 930 | // Print: Montant |
931 | 931 | $pdf->SetXY($posx_montant, $curY); |
932 | - $pdf->MultiCell($objmarge->page_largeur-$objmarge->marge_droite-$posx_montant-0.8, 3, price($line->total_ht, 0, $outputlangs), 0, 'R', 0); |
|
932 | + $pdf->MultiCell($objmarge->page_largeur - $objmarge->marge_droite - $posx_montant - 0.8, 3, price($line->total_ht, 0, $outputlangs), 0, 'R', 0); |
|
933 | 933 | |
934 | - $nexY+=2; // Passe espace entre les lignes |
|
934 | + $nexY += 2; // Passe espace entre les lignes |
|
935 | 935 | |
936 | 936 | // Detect if some page were added automatically and output _tableau for past pages |
937 | 937 | while ($pagenb < $pageposafter) |
@@ -948,7 +948,7 @@ discard block |
||
948 | 948 | |
949 | 949 | $pagenb++; |
950 | 950 | $pdf->setPage($pagenb); |
951 | - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
951 | + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
952 | 952 | if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) self::pagehead($objmarge, $pdf, $object, 0, $outputlangs); |
953 | 953 | } |
954 | 954 | } |
@@ -958,19 +958,19 @@ discard block |
||
958 | 958 | if ($pagenb == 1) |
959 | 959 | { |
960 | 960 | 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); |
961 | - $bottomlasttab=$objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1; |
|
961 | + $bottomlasttab = $objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1; |
|
962 | 962 | } |
963 | 963 | else |
964 | 964 | { |
965 | 965 | 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); |
966 | - $bottomlasttab=$objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1; |
|
966 | + $bottomlasttab = $objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1; |
|
967 | 967 | } |
968 | 968 | |
969 | 969 | // Affiche zone totaux |
970 | - $posy=self::tableau_tot($objmarge, $pdf, $object, $bottomlasttab, $outputlangs, $TTot); |
|
970 | + $posy = self::tableau_tot($objmarge, $pdf, $object, $bottomlasttab, $outputlangs, $TTot); |
|
971 | 971 | |
972 | 972 | $pdf->Close(); |
973 | - $pdf->Output($file,'F'); |
|
973 | + $pdf->Output($file, 'F'); |
|
974 | 974 | |
975 | 975 | $pagecount = self::concat($outputlangs, array($origin_file, $file), $origin_file); |
976 | 976 | |
@@ -982,7 +982,7 @@ discard block |
||
982 | 982 | $level = $line->qty; // TODO à améliorer |
983 | 983 | |
984 | 984 | $pdf->SetXY($objmarge->marge_gauche, $curY); |
985 | - $pdf->MultiCell($posx_designation-$objmarge->marge_gauche-0.8, 5, $level, 0, 'L', 0); |
|
985 | + $pdf->MultiCell($posx_designation - $objmarge->marge_gauche - 0.8, 5, $level, 0, 'L', 0); |
|
986 | 986 | } |
987 | 987 | |
988 | 988 | /** |
@@ -996,50 +996,50 @@ discard block |
||
996 | 996 | */ |
997 | 997 | private static function pagehead(&$objmarge, &$pdf, &$object, $showdetail, $outputlangs) |
998 | 998 | { |
999 | - global $conf,$mysoc; |
|
999 | + global $conf, $mysoc; |
|
1000 | 1000 | |
1001 | 1001 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
1002 | 1002 | |
1003 | - pdf_pagehead($pdf,$outputlangs,$objmarge->page_hauteur); |
|
1003 | + pdf_pagehead($pdf, $outputlangs, $objmarge->page_hauteur); |
|
1004 | 1004 | |
1005 | - $pdf->SetTextColor(0,0,60); |
|
1006 | - $pdf->SetFont('','B', $default_font_size + 3); |
|
1005 | + $pdf->SetTextColor(0, 0, 60); |
|
1006 | + $pdf->SetFont('', 'B', $default_font_size + 3); |
|
1007 | 1007 | |
1008 | - $posy=$objmarge->marge_haute; |
|
1009 | - $posx=$objmarge->page_largeur-$objmarge->marge_droite-100; |
|
1008 | + $posy = $objmarge->marge_haute; |
|
1009 | + $posx = $objmarge->page_largeur - $objmarge->marge_droite - 100; |
|
1010 | 1010 | |
1011 | - $pdf->SetXY($objmarge->marge_gauche,$posy); |
|
1011 | + $pdf->SetXY($objmarge->marge_gauche, $posy); |
|
1012 | 1012 | |
1013 | - $logo=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo; |
|
1013 | + $logo = $conf->mycompany->dir_output.'/logos/'.$mysoc->logo; |
|
1014 | 1014 | if ($mysoc->logo) |
1015 | 1015 | { |
1016 | 1016 | if (is_readable($logo)) |
1017 | 1017 | { |
1018 | - $height=pdf_getHeightForLogo($logo); |
|
1019 | - $pdf->Image($logo, $objmarge->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
1018 | + $height = pdf_getHeightForLogo($logo); |
|
1019 | + $pdf->Image($logo, $objmarge->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
1020 | 1020 | } |
1021 | 1021 | else |
1022 | 1022 | { |
1023 | - $pdf->SetTextColor(200,0,0); |
|
1024 | - $pdf->SetFont('','B',$default_font_size - 2); |
|
1025 | - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L'); |
|
1023 | + $pdf->SetTextColor(200, 0, 0); |
|
1024 | + $pdf->SetFont('', 'B', $default_font_size - 2); |
|
1025 | + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); |
|
1026 | 1026 | $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); |
1027 | 1027 | } |
1028 | 1028 | |
1029 | - $posy+=35; |
|
1029 | + $posy += 35; |
|
1030 | 1030 | } |
1031 | 1031 | else |
1032 | 1032 | { |
1033 | - $text=$mysoc->name; |
|
1033 | + $text = $mysoc->name; |
|
1034 | 1034 | $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); |
1035 | 1035 | |
1036 | - $posy+=15; |
|
1036 | + $posy += 15; |
|
1037 | 1037 | } |
1038 | 1038 | |
1039 | 1039 | |
1040 | - $pdf->SetTextColor(0,0,0); |
|
1041 | - $pdf->SetFont('','B', $default_font_size + 2); |
|
1042 | - $pdf->SetXY($objmarge->marge_gauche,$posy); |
|
1040 | + $pdf->SetTextColor(0, 0, 0); |
|
1041 | + $pdf->SetFont('', 'B', $default_font_size + 2); |
|
1042 | + $pdf->SetXY($objmarge->marge_gauche, $posy); |
|
1043 | 1043 | |
1044 | 1044 | $key = 'subtotalPropalTitle'; |
1045 | 1045 | if ($object->element == 'commande') $key = 'subtotalCommandeTitle'; |
@@ -1048,14 +1048,14 @@ discard block |
||
1048 | 1048 | |
1049 | 1049 | $pdf->MultiCell(150, 4, $outputlangs->transnoentities($key, $object->ref, $object->thirdparty->name), '', 'L'); |
1050 | 1050 | |
1051 | - $pdf->SetFont('','', $default_font_size); |
|
1052 | - $pdf->SetXY($objmarge->page_largeur-$objmarge->marge_droite-40,$posy); |
|
1051 | + $pdf->SetFont('', '', $default_font_size); |
|
1052 | + $pdf->SetXY($objmarge->page_largeur - $objmarge->marge_droite - 40, $posy); |
|
1053 | 1053 | $pdf->MultiCell(40, 4, dol_print_date($object->date, 'daytext'), '', 'R'); |
1054 | 1054 | |
1055 | 1055 | $posy += 8; |
1056 | 1056 | |
1057 | - $pdf->SetFont('','B', $default_font_size + 2); |
|
1058 | - $pdf->SetXY($objmarge->marge_gauche,$posy); |
|
1057 | + $pdf->SetFont('', 'B', $default_font_size + 2); |
|
1058 | + $pdf->SetXY($objmarge->marge_gauche, $posy); |
|
1059 | 1059 | $pdf->MultiCell(70, 4, $outputlangs->transnoentities('subtotalRecapLot'), '', 'L'); |
1060 | 1060 | |
1061 | 1061 | } |
@@ -1073,44 +1073,44 @@ discard block |
||
1073 | 1073 | * @param string $currency Currency code |
1074 | 1074 | * @return void |
1075 | 1075 | */ |
1076 | - private static function tableau(&$objmarge, &$pdf, $posx_designation, $posx_options, $posx_montant, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0, $currency='') |
|
1076 | + private static function tableau(&$objmarge, &$pdf, $posx_designation, $posx_options, $posx_montant, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '') |
|
1077 | 1077 | { |
1078 | 1078 | global $conf; |
1079 | 1079 | |
1080 | 1080 | // Force to disable hidetop and hidebottom |
1081 | - $hidebottom=0; |
|
1082 | - if ($hidetop) $hidetop=-1; |
|
1081 | + $hidebottom = 0; |
|
1082 | + if ($hidetop) $hidetop = -1; |
|
1083 | 1083 | |
1084 | 1084 | $currency = !empty($currency) ? $currency : $conf->currency; |
1085 | 1085 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
1086 | 1086 | |
1087 | 1087 | // Amount in (at tab_top - 1) |
1088 | - $pdf->SetTextColor(0,0,0); |
|
1089 | - $pdf->SetFont('','',$default_font_size); |
|
1088 | + $pdf->SetTextColor(0, 0, 0); |
|
1089 | + $pdf->SetFont('', '', $default_font_size); |
|
1090 | 1090 | |
1091 | 1091 | if (empty($hidetop)) |
1092 | 1092 | { |
1093 | - $titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$currency)); |
|
1094 | - $pdf->SetXY($objmarge->page_largeur - $objmarge->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4.5); |
|
1093 | + $titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency)); |
|
1094 | + $pdf->SetXY($objmarge->page_largeur - $objmarge->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4.5); |
|
1095 | 1095 | $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); |
1096 | 1096 | |
1097 | - 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)); |
|
1097 | + 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)); |
|
1098 | 1098 | |
1099 | 1099 | |
1100 | - $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 |
|
1100 | + $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 |
|
1101 | 1101 | |
1102 | - $pdf->SetXY($posx_designation, $tab_top+2); |
|
1103 | - $pdf->MultiCell($posx_options - $posx_designation,2, $outputlangs->transnoentities("Designation"),'','L'); |
|
1104 | - $pdf->SetXY($posx_options, $tab_top+2); |
|
1105 | - $pdf->MultiCell($posx_montant - $posx_options,2, $outputlangs->transnoentities("Options"),'','R'); |
|
1106 | - $pdf->SetXY($posx_montant, $tab_top+2); |
|
1107 | - $pdf->MultiCell($objmarge->page_largeur - $objmarge->marge_droite - $posx_montant,2, $outputlangs->transnoentities("Amount"),'','R'); |
|
1102 | + $pdf->SetXY($posx_designation, $tab_top + 2); |
|
1103 | + $pdf->MultiCell($posx_options - $posx_designation, 2, $outputlangs->transnoentities("Designation"), '', 'L'); |
|
1104 | + $pdf->SetXY($posx_options, $tab_top + 2); |
|
1105 | + $pdf->MultiCell($posx_montant - $posx_options, 2, $outputlangs->transnoentities("Options"), '', 'R'); |
|
1106 | + $pdf->SetXY($posx_montant, $tab_top + 2); |
|
1107 | + $pdf->MultiCell($objmarge->page_largeur - $objmarge->marge_droite - $posx_montant, 2, $outputlangs->transnoentities("Amount"), '', 'R'); |
|
1108 | 1108 | |
1109 | - $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 |
|
1109 | + $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 |
|
1110 | 1110 | } |
1111 | 1111 | else |
1112 | 1112 | { |
1113 | - $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 |
|
1113 | + $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 |
|
1114 | 1114 | } |
1115 | 1115 | |
1116 | 1116 | } |
@@ -1119,29 +1119,29 @@ discard block |
||
1119 | 1119 | { |
1120 | 1120 | global $conf; |
1121 | 1121 | |
1122 | - $pdf->line($objmarge->marge_gauche, $posy, $objmarge->page_largeur-$objmarge->marge_droite, $posy); // line prend une position y en 2eme param et 4eme param |
|
1122 | + $pdf->line($objmarge->marge_gauche, $posy, $objmarge->page_largeur - $objmarge->marge_droite, $posy); // line prend une position y en 2eme param et 4eme param |
|
1123 | 1123 | |
1124 | 1124 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
1125 | 1125 | |
1126 | - $tab2_top = $posy+2; |
|
1126 | + $tab2_top = $posy + 2; |
|
1127 | 1127 | $tab2_hl = 4; |
1128 | - $pdf->SetFont('','', $default_font_size - 1); |
|
1128 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
1129 | 1129 | |
1130 | 1130 | // Tableau total |
1131 | 1131 | $col1x = 120; $col2x = 170; |
1132 | 1132 | if ($objmarge->page_largeur < 210) // To work with US executive format |
1133 | 1133 | { |
1134 | - $col2x-=20; |
|
1134 | + $col2x -= 20; |
|
1135 | 1135 | } |
1136 | 1136 | $largcol2 = ($objmarge->page_largeur - $objmarge->marge_droite - $col2x); |
1137 | 1137 | |
1138 | - $useborder=0; |
|
1138 | + $useborder = 0; |
|
1139 | 1139 | $index = 0; |
1140 | 1140 | |
1141 | 1141 | // Total HT |
1142 | - $pdf->SetFillColor(255,255,255); |
|
1142 | + $pdf->SetFillColor(255, 255, 255); |
|
1143 | 1143 | $pdf->SetXY($col1x, $tab2_top + 0); |
1144 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); |
|
1144 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); |
|
1145 | 1145 | |
1146 | 1146 | // $total_ht = ($conf->multicurrency->enabled && $object->mylticurrency_tx != 1) ? $TTot['multicurrency_total_ht'] : $TTot['total_ht']; |
1147 | 1147 | $total_ht = $TTot['total_ht']; |
@@ -1149,10 +1149,10 @@ discard block |
||
1149 | 1149 | $pdf->MultiCell($largcol2, $tab2_hl, price($total_ht, 0, $outputlangs), 0, 'R', 1); |
1150 | 1150 | |
1151 | 1151 | // Show VAT by rates and total |
1152 | - $pdf->SetFillColor(248,248,248); |
|
1152 | + $pdf->SetFillColor(248, 248, 248); |
|
1153 | 1153 | |
1154 | - $atleastoneratenotnull=0; |
|
1155 | - foreach($TTot['TTotal_tva'] as $tvakey => $tvaval) |
|
1154 | + $atleastoneratenotnull = 0; |
|
1155 | + foreach ($TTot['TTotal_tva'] as $tvakey => $tvaval) |
|
1156 | 1156 | { |
1157 | 1157 | if ($tvakey != 0) // On affiche pas taux 0 |
1158 | 1158 | { |
@@ -1161,15 +1161,15 @@ discard block |
||
1161 | 1161 | $index++; |
1162 | 1162 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
1163 | 1163 | |
1164 | - $tvacompl=''; |
|
1165 | - if (preg_match('/\*/',$tvakey)) |
|
1164 | + $tvacompl = ''; |
|
1165 | + if (preg_match('/\*/', $tvakey)) |
|
1166 | 1166 | { |
1167 | - $tvakey=str_replace('*','',$tvakey); |
|
1167 | + $tvakey = str_replace('*', '', $tvakey); |
|
1168 | 1168 | $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; |
1169 | 1169 | } |
1170 | - $totalvat =$outputlangs->transnoentities("TotalVAT").' '; |
|
1171 | - $totalvat.=vatrate($tvakey,1).$tvacompl; |
|
1172 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
1170 | + $totalvat = $outputlangs->transnoentities("TotalVAT").' '; |
|
1171 | + $totalvat .= vatrate($tvakey, 1).$tvacompl; |
|
1172 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
1173 | 1173 | |
1174 | 1174 | $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
1175 | 1175 | $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); |
@@ -1179,16 +1179,16 @@ discard block |
||
1179 | 1179 | // Total TTC |
1180 | 1180 | $index++; |
1181 | 1181 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
1182 | - $pdf->SetTextColor(0,0,60); |
|
1183 | - $pdf->SetFillColor(224,224,224); |
|
1184 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); |
|
1182 | + $pdf->SetTextColor(0, 0, 60); |
|
1183 | + $pdf->SetFillColor(224, 224, 224); |
|
1184 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); |
|
1185 | 1185 | |
1186 | 1186 | // $total_ttc = ($conf->multicurrency->enabled && $object->multiccurency_tx != 1) ? $TTot['multicurrency_total_ttc'] : $TTot['total_ttc']; |
1187 | 1187 | $total_ttc = $TTot['total_ttc']; |
1188 | 1188 | $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
1189 | 1189 | $pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc, 0, $outputlangs), $useborder, 'R', 1); |
1190 | 1190 | |
1191 | - $pdf->SetTextColor(0,0,0); |
|
1191 | + $pdf->SetTextColor(0, 0, 0); |
|
1192 | 1192 | |
1193 | 1193 | $index++; |
1194 | 1194 | return ($tab2_top + ($tab2_hl * $index)); |
@@ -1207,22 +1207,22 @@ discard block |
||
1207 | 1207 | * @param int $hidebottom Hide bottom |
1208 | 1208 | * @return void |
1209 | 1209 | */ |
1210 | - private static function printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0) |
|
1210 | + private static function printRect($pdf, $x, $y, $l, $h, $hidetop = 0, $hidebottom = 0) |
|
1211 | 1211 | { |
1212 | - if (empty($hidetop) || $hidetop==-1) $pdf->line($x, $y, $x+$l, $y); |
|
1213 | - $pdf->line($x+$l, $y, $x+$l, $y+$h); |
|
1214 | - if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h); |
|
1215 | - $pdf->line($x, $y+$h, $x, $y); |
|
1212 | + if (empty($hidetop) || $hidetop == -1) $pdf->line($x, $y, $x + $l, $y); |
|
1213 | + $pdf->line($x + $l, $y, $x + $l, $y + $h); |
|
1214 | + if (empty($hidebottom)) $pdf->line($x + $l, $y + $h, $x, $y + $h); |
|
1215 | + $pdf->line($x, $y + $h, $x, $y); |
|
1216 | 1216 | } |
1217 | 1217 | |
1218 | 1218 | |
1219 | - public static function concat(&$outputlangs, $files, $fileoutput='') |
|
1219 | + public static function concat(&$outputlangs, $files, $fileoutput = '') |
|
1220 | 1220 | { |
1221 | 1221 | global $conf; |
1222 | 1222 | |
1223 | 1223 | if (empty($fileoutput)) $fileoutput = $file[0]; |
1224 | 1224 | |
1225 | - $pdf=pdf_getInstance(); |
|
1225 | + $pdf = pdf_getInstance(); |
|
1226 | 1226 | if (class_exists('TCPDF')) |
1227 | 1227 | { |
1228 | 1228 | $pdf->setPrintHeader(false); |
@@ -1230,10 +1230,10 @@ discard block |
||
1230 | 1230 | } |
1231 | 1231 | $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
1232 | 1232 | |
1233 | - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
1233 | + if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
1234 | 1234 | |
1235 | 1235 | |
1236 | - foreach($files as $file) |
|
1236 | + foreach ($files as $file) |
|
1237 | 1237 | { |
1238 | 1238 | $pagecount = $pdf->setSourceFile($file); |
1239 | 1239 | for ($i = 1; $i <= $pagecount; $i++) |
@@ -1245,8 +1245,8 @@ discard block |
||
1245 | 1245 | } |
1246 | 1246 | } |
1247 | 1247 | |
1248 | - $pdf->Output($fileoutput,'F'); |
|
1249 | - if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
1248 | + $pdf->Output($fileoutput, 'F'); |
|
1249 | + if (!empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
1250 | 1250 | |
1251 | 1251 | return $pagecount; |
1252 | 1252 | } |
@@ -1259,7 +1259,7 @@ discard block |
||
1259 | 1259 | */ |
1260 | 1260 | public static function hasNcTitle(&$line) |
1261 | 1261 | { |
1262 | - if(isset($line->has_nc_title)) return $line->has_nc_title; |
|
1262 | + if (isset($line->has_nc_title)) return $line->has_nc_title; |
|
1263 | 1263 | |
1264 | 1264 | $TTitle = self::getAllTitleFromLine($line); |
1265 | 1265 | foreach ($TTitle as &$line_title) |