@@ -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 | - $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 | + $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 |
@@ -369,10 +369,10 @@ discard block |
||
| 369 | 369 | |
| 370 | 370 | public static function isSubtotal(&$line, $level=-1) |
| 371 | 371 | { |
| 372 | - $res = $line->special_code == self::$module_number && $line->product_type == 9 && $line->qty >= 90; |
|
| 373 | - if($res && $level > -1) { |
|
| 374 | - return self::getNiveau($line) == $level; |
|
| 375 | - } else return $res; |
|
| 372 | + $res = $line->special_code == self::$module_number && $line->product_type == 9 && $line->qty >= 90; |
|
| 373 | + if($res && $level > -1) { |
|
| 374 | + return self::getNiveau($line) == $level; |
|
| 375 | + } else return $res; |
|
| 376 | 376 | } |
| 377 | 377 | |
| 378 | 378 | public static function isFreeText(&$line) |
@@ -409,16 +409,16 @@ discard block |
||
| 409 | 409 | $createRight = $user->rights->{$object->element}->creer; |
| 410 | 410 | if($object->element == 'facturerec' ) |
| 411 | 411 | { |
| 412 | - $object->statut = 0; // hack for facture rec |
|
| 413 | - $createRight = $user->rights->facture->creer; |
|
| 412 | + $object->statut = 0; // hack for facture rec |
|
| 413 | + $createRight = $user->rights->facture->creer; |
|
| 414 | 414 | } |
| 415 | 415 | elseif($object->element == 'order_supplier' ) |
| 416 | 416 | { |
| 417 | - $createRight = $user->rights->fournisseur->commande->creer; |
|
| 417 | + $createRight = $user->rights->fournisseur->commande->creer; |
|
| 418 | 418 | } |
| 419 | 419 | elseif($object->element == 'invoice_supplier' ) |
| 420 | 420 | { |
| 421 | - $createRight = $user->rights->fournisseur->facture->creer; |
|
| 421 | + $createRight = $user->rights->fournisseur->facture->creer; |
|
| 422 | 422 | } |
| 423 | 423 | |
| 424 | 424 | if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK)) |
@@ -443,8 +443,8 @@ discard block |
||
| 443 | 443 | break; |
| 444 | 444 | |
| 445 | 445 | case 'supplier_proposal': |
| 446 | - $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); |
|
| 447 | - break; |
|
| 446 | + $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); |
|
| 447 | + break; |
|
| 448 | 448 | |
| 449 | 449 | case 'commande': |
| 450 | 450 | //$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) |
@@ -452,10 +452,10 @@ discard block |
||
| 452 | 452 | break; |
| 453 | 453 | |
| 454 | 454 | case 'order_supplier': |
| 455 | - $object->line = $line; |
|
| 456 | - $object->line->fk_commande = $object->id; |
|
| 457 | - $object->line->rang = $object->line_max() +1; |
|
| 458 | - $res = $object->line->insert(1); |
|
| 455 | + $object->line = $line; |
|
| 456 | + $object->line->fk_commande = $object->id; |
|
| 457 | + $object->line->rang = $object->line_max() +1; |
|
| 458 | + $res = $object->line->insert(1); |
|
| 459 | 459 | break; |
| 460 | 460 | |
| 461 | 461 | case 'facture': |
@@ -508,8 +508,8 @@ discard block |
||
| 508 | 508 | $object->db->commit(); |
| 509 | 509 | foreach ($TLineAdded as &$line) |
| 510 | 510 | { |
| 511 | - // ç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 |
|
| 512 | - _updateLineNC($object->element, $object->id, $line->id, $line->array_options['options_subtotal_nc']); |
|
| 511 | + // ç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 |
|
| 512 | + _updateLineNC($object->element, $object->id, $line->id, $line->array_options['options_subtotal_nc']); |
|
| 513 | 513 | } |
| 514 | 514 | return count($TLineAdded); |
| 515 | 515 | } |
@@ -583,33 +583,33 @@ discard block |
||
| 583 | 583 | |
| 584 | 584 | switch ($object->element) |
| 585 | 585 | { |
| 586 | - case 'propal': |
|
| 587 | - $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); |
|
| 588 | - break; |
|
| 586 | + case 'propal': |
|
| 587 | + $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); |
|
| 588 | + break; |
|
| 589 | 589 | |
| 590 | - case 'supplier_proposal': |
|
| 591 | - $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); |
|
| 592 | - break; |
|
| 590 | + case 'supplier_proposal': |
|
| 591 | + $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); |
|
| 592 | + break; |
|
| 593 | 593 | |
| 594 | 594 | case 'commande': |
| 595 | 595 | $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); |
| 596 | 596 | break; |
| 597 | 597 | |
| 598 | 598 | case 'order_supplier': |
| 599 | - $object->special_code = SELF::$module_number; |
|
| 600 | - if (empty($desc)) $desc = $label; |
|
| 601 | - $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); |
|
| 602 | - break; |
|
| 599 | + $object->special_code = SELF::$module_number; |
|
| 600 | + if (empty($desc)) $desc = $label; |
|
| 601 | + $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); |
|
| 602 | + break; |
|
| 603 | 603 | |
| 604 | 604 | case 'facture': |
| 605 | 605 | $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); |
| 606 | 606 | break; |
| 607 | 607 | |
| 608 | 608 | case 'invoice_supplier': |
| 609 | - $object->special_code = SELF::$module_number; |
|
| 610 | - if (empty($desc)) $desc = $label; |
|
| 611 | - $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); |
|
| 612 | - break; |
|
| 609 | + $object->special_code = SELF::$module_number; |
|
| 610 | + if (empty($desc)) $desc = $label; |
|
| 611 | + $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); |
|
| 612 | + break; |
|
| 613 | 613 | |
| 614 | 614 | case 'facturerec': |
| 615 | 615 | // Add extrafields and get rang |
@@ -1000,8 +1000,8 @@ discard block |
||
| 1000 | 1000 | { |
| 1001 | 1001 | if (is_readable($logo)) |
| 1002 | 1002 | { |
| 1003 | - $height=pdf_getHeightForLogo($logo); |
|
| 1004 | - $pdf->Image($logo, $objmarge->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
| 1003 | + $height=pdf_getHeightForLogo($logo); |
|
| 1004 | + $pdf->Image($logo, $objmarge->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
| 1005 | 1005 | } |
| 1006 | 1006 | else |
| 1007 | 1007 | { |
@@ -1192,13 +1192,13 @@ discard block |
||
| 1192 | 1192 | * @param int $hidebottom Hide bottom |
| 1193 | 1193 | * @return void |
| 1194 | 1194 | */ |
| 1195 | - private static function printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0) |
|
| 1196 | - { |
|
| 1197 | - if (empty($hidetop) || $hidetop==-1) $pdf->line($x, $y, $x+$l, $y); |
|
| 1198 | - $pdf->line($x+$l, $y, $x+$l, $y+$h); |
|
| 1199 | - if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h); |
|
| 1200 | - $pdf->line($x, $y+$h, $x, $y); |
|
| 1201 | - } |
|
| 1195 | + private static function printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0) |
|
| 1196 | + { |
|
| 1197 | + if (empty($hidetop) || $hidetop==-1) $pdf->line($x, $y, $x+$l, $y); |
|
| 1198 | + $pdf->line($x+$l, $y, $x+$l, $y+$h); |
|
| 1199 | + if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h); |
|
| 1200 | + $pdf->line($x, $y+$h, $x, $y); |
|
| 1201 | + } |
|
| 1202 | 1202 | |
| 1203 | 1203 | |
| 1204 | 1204 | public static function concat(&$outputlangs, $files, $fileoutput='') |
@@ -1208,14 +1208,14 @@ discard block |
||
| 1208 | 1208 | if (empty($fileoutput)) $fileoutput = $file[0]; |
| 1209 | 1209 | |
| 1210 | 1210 | $pdf=pdf_getInstance(); |
| 1211 | - if (class_exists('TCPDF')) |
|
| 1212 | - { |
|
| 1213 | - $pdf->setPrintHeader(false); |
|
| 1214 | - $pdf->setPrintFooter(false); |
|
| 1215 | - } |
|
| 1216 | - $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
|
| 1211 | + if (class_exists('TCPDF')) |
|
| 1212 | + { |
|
| 1213 | + $pdf->setPrintHeader(false); |
|
| 1214 | + $pdf->setPrintFooter(false); |
|
| 1215 | + } |
|
| 1216 | + $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
|
| 1217 | 1217 | |
| 1218 | - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
| 1218 | + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
| 1219 | 1219 | |
| 1220 | 1220 | |
| 1221 | 1221 | 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 | 45 | $rang = $object->line_max() + 1; |
| 46 | - $res = $object->addline($label,0,0,0,0,$qty,0,0,'','',0,0,'HT',9,$rang); |
|
| 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)) |
@@ -358,19 +358,19 @@ discard block |
||
| 358 | 358 | return false; |
| 359 | 359 | } |
| 360 | 360 | |
| 361 | - public static function isTitle(&$line, $level=-1) |
|
| 361 | + public static function isTitle(&$line, $level = -1) |
|
| 362 | 362 | { |
| 363 | 363 | $res = $line->special_code == self::$module_number && $line->product_type == 9 && $line->qty <= 9; |
| 364 | - if($res && $level > -1) { |
|
| 364 | + if ($res && $level > -1) { |
|
| 365 | 365 | return $line->qty == $level; |
| 366 | 366 | } else return $res; |
| 367 | 367 | |
| 368 | 368 | } |
| 369 | 369 | |
| 370 | - public static function isSubtotal(&$line, $level=-1) |
|
| 370 | + public static function isSubtotal(&$line, $level = -1) |
|
| 371 | 371 | { |
| 372 | 372 | $res = $line->special_code == self::$module_number && $line->product_type == 9 && $line->qty >= 90; |
| 373 | - if($res && $level > -1) { |
|
| 373 | + if ($res && $level > -1) { |
|
| 374 | 374 | return self::getNiveau($line) == $level; |
| 375 | 375 | } else return $res; |
| 376 | 376 | } |
@@ -385,43 +385,43 @@ discard block |
||
| 385 | 385 | return self::isTitle($line) || self::isSubtotal($line) || self::isFreeText($line); |
| 386 | 386 | } |
| 387 | 387 | |
| 388 | - public static function getFreeTextHtml(&$line, $readonly=0) |
|
| 388 | + public static function getFreeTextHtml(&$line, $readonly = 0) |
|
| 389 | 389 | { |
| 390 | 390 | global $conf; |
| 391 | 391 | |
| 392 | 392 | // Copie du fichier "objectline_edit.tpl.php" |
| 393 | 393 | // editeur wysiwyg |
| 394 | 394 | require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
| 395 | - $nbrows=ROWS_2; |
|
| 396 | - if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; |
|
| 397 | - $enable=(isset($conf->global->FCKEDITOR_ENABLE_DETAILS)?$conf->global->FCKEDITOR_ENABLE_DETAILS:0); |
|
| 398 | - $toolbarname='dolibarr_details'; |
|
| 399 | - if (! empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) $toolbarname='dolibarr_notes'; |
|
| 400 | - $text = !empty($line->description)?$line->description:$line->label; |
|
| 401 | - $doleditor=new DolEditor('line-description',$text,'',164,$toolbarname,'',false,true,$enable,$nbrows,'98%', $readonly); |
|
| 395 | + $nbrows = ROWS_2; |
|
| 396 | + if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT; |
|
| 397 | + $enable = (isset($conf->global->FCKEDITOR_ENABLE_DETAILS) ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0); |
|
| 398 | + $toolbarname = 'dolibarr_details'; |
|
| 399 | + if (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) $toolbarname = 'dolibarr_notes'; |
|
| 400 | + $text = !empty($line->description) ? $line->description : $line->label; |
|
| 401 | + $doleditor = new DolEditor('line-description', $text, '', 164, $toolbarname, '', false, true, $enable, $nbrows, '98%', $readonly); |
|
| 402 | 402 | return $doleditor->Create(1); |
| 403 | 403 | } |
| 404 | 404 | |
| 405 | - public static function duplicateLines(&$object, $lineid, $withBlockLine=false) |
|
| 405 | + public static function duplicateLines(&$object, $lineid, $withBlockLine = false) |
|
| 406 | 406 | { |
| 407 | - global $db,$user,$conf; |
|
| 407 | + global $db, $user, $conf; |
|
| 408 | 408 | |
| 409 | 409 | $createRight = $user->rights->{$object->element}->creer; |
| 410 | - if($object->element == 'facturerec' ) |
|
| 410 | + if ($object->element == 'facturerec') |
|
| 411 | 411 | { |
| 412 | 412 | $object->statut = 0; // hack for facture rec |
| 413 | 413 | $createRight = $user->rights->facture->creer; |
| 414 | 414 | } |
| 415 | - elseif($object->element == 'order_supplier' ) |
|
| 415 | + elseif ($object->element == 'order_supplier') |
|
| 416 | 416 | { |
| 417 | 417 | $createRight = $user->rights->fournisseur->commande->creer; |
| 418 | 418 | } |
| 419 | - elseif($object->element == 'invoice_supplier' ) |
|
| 419 | + elseif ($object->element == 'invoice_supplier') |
|
| 420 | 420 | { |
| 421 | 421 | $createRight = $user->rights->fournisseur->facture->creer; |
| 422 | 422 | } |
| 423 | 423 | |
| 424 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK)) |
|
| 424 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK)) |
|
| 425 | 425 | { |
| 426 | 426 | dol_include_once('/subtotal/lib/subtotal.lib.php'); |
| 427 | 427 | |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | case 'order_supplier': |
| 455 | 455 | $object->line = $line; |
| 456 | 456 | $object->line->fk_commande = $object->id; |
| 457 | - $object->line->rang = $object->line_max() +1; |
|
| 457 | + $object->line->rang = $object->line_max() + 1; |
|
| 458 | 458 | $res = $object->line->insert(1); |
| 459 | 459 | break; |
| 460 | 460 | |
@@ -494,7 +494,7 @@ discard block |
||
| 494 | 494 | { |
| 495 | 495 | $object->line_from = $line; |
| 496 | 496 | // Call trigger |
| 497 | - $result=$object->call_trigger('LINE_DUPLICATE',$user); // $object->line |
|
| 497 | + $result = $object->call_trigger('LINE_DUPLICATE', $user); // $object->line |
|
| 498 | 498 | if ($result < 0) |
| 499 | 499 | { |
| 500 | 500 | $object->db->rollback(); |
@@ -524,7 +524,7 @@ discard block |
||
| 524 | 524 | } |
| 525 | 525 | } |
| 526 | 526 | |
| 527 | - public static function getLinesFromTitle(&$object, $key_trad, $level=1, $under_title='', $withBlockLine=false, $key_is_id=false) |
|
| 527 | + public static function getLinesFromTitle(&$object, $key_trad, $level = 1, $under_title = '', $withBlockLine = false, $key_is_id = false) |
|
| 528 | 528 | { |
| 529 | 529 | global $langs; |
| 530 | 530 | |
@@ -536,17 +536,17 @@ discard block |
||
| 536 | 536 | |
| 537 | 537 | $TLine = array(); |
| 538 | 538 | $add_line = false; |
| 539 | - $under_title_found=false; |
|
| 539 | + $under_title_found = false; |
|
| 540 | 540 | |
| 541 | 541 | foreach ($object->lines as $key => &$line) |
| 542 | 542 | { |
| 543 | 543 | if (!$under_title_found && !empty($TTitle_under_search)) |
| 544 | 544 | { |
| 545 | - if ($line->product_type == 9 && (in_array($line->desc, $TTitle_under_search) || in_array($line->label, $TTitle_under_search)) ) $under_title_found = true; |
|
| 545 | + if ($line->product_type == 9 && (in_array($line->desc, $TTitle_under_search) || in_array($line->label, $TTitle_under_search))) $under_title_found = true; |
|
| 546 | 546 | } |
| 547 | 547 | else |
| 548 | 548 | { |
| 549 | - 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) ))) |
|
| 549 | + 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)))) |
|
| 550 | 550 | { |
| 551 | 551 | if ($key_is_id) $level = $line->qty; |
| 552 | 552 | |
@@ -562,7 +562,7 @@ discard block |
||
| 562 | 562 | |
| 563 | 563 | if ($add_line) |
| 564 | 564 | { |
| 565 | - if (!$withBlockLine && (self::isTitle($line) || self::isSubtotal($line)) ) continue; |
|
| 565 | + if (!$withBlockLine && (self::isTitle($line) || self::isSubtotal($line))) continue; |
|
| 566 | 566 | else $TLine[] = $line; |
| 567 | 567 | } |
| 568 | 568 | } |
@@ -571,12 +571,12 @@ discard block |
||
| 571 | 571 | return $TLine; |
| 572 | 572 | } |
| 573 | 573 | |
| 574 | - public static function getLinesFromTitleId(&$object, $lineid, $withBlockLine=false) |
|
| 574 | + public static function getLinesFromTitleId(&$object, $lineid, $withBlockLine = false) |
|
| 575 | 575 | { |
| 576 | 576 | return self::getLinesFromTitle($object, $lineid, '', '', $withBlockLine, true); |
| 577 | 577 | } |
| 578 | 578 | |
| 579 | - 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) |
|
| 579 | + 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) |
|
| 580 | 580 | { |
| 581 | 581 | $res = 0; |
| 582 | 582 | $object->db->begin(); |
@@ -588,7 +588,7 @@ discard block |
||
| 588 | 588 | break; |
| 589 | 589 | |
| 590 | 590 | case 'supplier_proposal': |
| 591 | - $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); |
|
| 591 | + $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); |
|
| 592 | 592 | break; |
| 593 | 593 | |
| 594 | 594 | case 'commande': |
@@ -617,9 +617,9 @@ discard block |
||
| 617 | 617 | $factureRecLine->fetch($rowid); |
| 618 | 618 | $factureRecLine->array_options = $array_options; |
| 619 | 619 | $factureRecLine->insertExtraFields(); |
| 620 | - $rang=$factureRecLine->rang; |
|
| 620 | + $rang = $factureRecLine->rang; |
|
| 621 | 621 | |
| 622 | - $fk_product=0; $fk_remise_except=''; $pu_ttc=0; |
|
| 622 | + $fk_product = 0; $fk_remise_except = ''; $pu_ttc = 0; |
|
| 623 | 623 | $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); |
| 624 | 624 | break; |
| 625 | 625 | } |
@@ -635,7 +635,7 @@ discard block |
||
| 635 | 635 | global $db, $object; |
| 636 | 636 | |
| 637 | 637 | $TTitle = array(); |
| 638 | - if(! empty($object->id) && in_array($object->element, array('propal', 'commande', 'facture'))) {} |
|
| 638 | + if (!empty($object->id) && in_array($object->element, array('propal', 'commande', 'facture'))) {} |
|
| 639 | 639 | else { |
| 640 | 640 | if ($origin_line->element == 'propaldet') |
| 641 | 641 | { |
@@ -715,7 +715,7 @@ discard block |
||
| 715 | 715 | */ |
| 716 | 716 | public static function addRecapPage(&$parameters, &$origin_pdf) |
| 717 | 717 | { |
| 718 | - global $user,$conf,$langs; |
|
| 718 | + global $user, $conf, $langs; |
|
| 719 | 719 | |
| 720 | 720 | $origin_file = $parameters['file']; |
| 721 | 721 | $outputlangs = $parameters['outputlangs']; |
@@ -731,21 +731,21 @@ discard block |
||
| 731 | 731 | $objmarge->marge_droite = 10; |
| 732 | 732 | |
| 733 | 733 | $objectref = dol_sanitizeFileName($object->ref); |
| 734 | - if ($object->element == 'propal') $dir = $conf->propal->dir_output . '/' . $objectref; |
|
| 735 | - elseif ($object->element == 'commande') $dir = $conf->commande->dir_output . '/' . $objectref; |
|
| 736 | - elseif ($object->element == 'facture') $dir = $conf->facture->dir_output . '/' . $objectref; |
|
| 734 | + if ($object->element == 'propal') $dir = $conf->propal->dir_output.'/'.$objectref; |
|
| 735 | + elseif ($object->element == 'commande') $dir = $conf->commande->dir_output.'/'.$objectref; |
|
| 736 | + elseif ($object->element == 'facture') $dir = $conf->facture->dir_output.'/'.$objectref; |
|
| 737 | 737 | elseif ($object->element == 'facturerec') return; // no PDF for facturerec |
| 738 | 738 | else |
| 739 | 739 | { |
| 740 | 740 | setEventMessage($langs->trans('warning_subtotal_recap_object_element_unknown', $object->element), 'warnings'); |
| 741 | 741 | return -1; |
| 742 | 742 | } |
| 743 | - $file = $dir . '/' . $objectref . '_recap.pdf'; |
|
| 743 | + $file = $dir.'/'.$objectref.'_recap.pdf'; |
|
| 744 | 744 | |
| 745 | 745 | // $pdf=pdf_getInstance($origin_pdf->format); |
| 746 | - $pdf=pdf_getInstance(array(210, 297)); // Format A4 Portrait |
|
| 747 | - $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance |
|
| 748 | - $pdf->SetAutoPageBreak(1,0); |
|
| 746 | + $pdf = pdf_getInstance(array(210, 297)); // Format A4 Portrait |
|
| 747 | + $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance |
|
| 748 | + $pdf->SetAutoPageBreak(1, 0); |
|
| 749 | 749 | |
| 750 | 750 | if (class_exists('TCPDF')) |
| 751 | 751 | { |
@@ -754,49 +754,49 @@ discard block |
||
| 754 | 754 | } |
| 755 | 755 | $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
| 756 | 756 | // Set path to the background PDF File |
| 757 | - if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) |
|
| 757 | + if (empty($conf->global->MAIN_DISABLE_FPDI) && !empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) |
|
| 758 | 758 | { |
| 759 | 759 | $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); |
| 760 | 760 | $tplidx = $pdf->importPage(1); |
| 761 | 761 | } |
| 762 | 762 | |
| 763 | 763 | $pdf->Open(); |
| 764 | - $pagenb=0; |
|
| 765 | - $pdf->SetDrawColor(128,128,128); |
|
| 764 | + $pagenb = 0; |
|
| 765 | + $pdf->SetDrawColor(128, 128, 128); |
|
| 766 | 766 | |
| 767 | 767 | $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); |
| 768 | 768 | $pdf->SetSubject($outputlangs->transnoentities("subtotalRecap")); |
| 769 | 769 | $pdf->SetCreator("Dolibarr ".DOL_VERSION); |
| 770 | 770 | $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); |
| 771 | 771 | $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("subtotalRecap")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); |
| 772 | - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
| 772 | + if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
| 773 | 773 | |
| 774 | - $pdf->SetMargins($objmarge->marge_gauche, $objmarge->marge_haute, $objmarge->marge_droite); // Left, Top, Right |
|
| 774 | + $pdf->SetMargins($objmarge->marge_gauche, $objmarge->marge_haute, $objmarge->marge_droite); // Left, Top, Right |
|
| 775 | 775 | |
| 776 | - $pagenb=0; |
|
| 777 | - $pdf->SetDrawColor(128,128,128); |
|
| 776 | + $pagenb = 0; |
|
| 777 | + $pdf->SetDrawColor(128, 128, 128); |
|
| 778 | 778 | |
| 779 | 779 | |
| 780 | 780 | // New page |
| 781 | 781 | $pdf->AddPage(); |
| 782 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 782 | + if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 783 | 783 | $pagenb++; |
| 784 | 784 | |
| 785 | 785 | |
| 786 | 786 | self::pagehead($objmarge, $pdf, $object, 1, $outputlangs); |
| 787 | - $pdf->SetFont('','', $default_font_size - 1); |
|
| 788 | - $pdf->MultiCell(0, 3, ''); // Set interline to 3 |
|
| 789 | - $pdf->SetTextColor(0,0,0); |
|
| 787 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
| 788 | + $pdf->MultiCell(0, 3, ''); // Set interline to 3 |
|
| 789 | + $pdf->SetTextColor(0, 0, 0); |
|
| 790 | 790 | |
| 791 | - $heightforinfotot = 25; // Height reserved to output the info and total part |
|
| 792 | - $heightforfooter = $objmarge->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
|
| 791 | + $heightforinfotot = 25; // Height reserved to output the info and total part |
|
| 792 | + $heightforfooter = $objmarge->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
|
| 793 | 793 | |
| 794 | 794 | $posx_designation = 25; |
| 795 | 795 | $posx_options = 150; |
| 796 | 796 | $posx_montant = 170; |
| 797 | 797 | |
| 798 | 798 | $tab_top = 72; |
| 799 | - $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?72:20); // TODO à vérifier |
|
| 799 | + $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 72 : 20); // TODO à vérifier |
|
| 800 | 800 | |
| 801 | 801 | $TTot = array('total_ht' => 0, 'total_ttc' => 0, 'TTotal_tva' => array()); |
| 802 | 802 | |
@@ -810,14 +810,14 @@ discard block |
||
| 810 | 810 | $nexY = $tab_top + 10; |
| 811 | 811 | |
| 812 | 812 | $nblignes = count($TLine); |
| 813 | - foreach($TLine as $i => &$line) |
|
| 813 | + foreach ($TLine as $i => &$line) |
|
| 814 | 814 | { |
| 815 | 815 | $curY = $nexY; |
| 816 | 816 | |
| 817 | 817 | if (self::getNiveau($line) == 1) |
| 818 | 818 | { |
| 819 | - $pdf->SetFont('','B', $default_font_size - 1); // Into loop to work with multipage |
|
| 820 | - $curY+=2; |
|
| 819 | + $pdf->SetFont('', 'B', $default_font_size - 1); // Into loop to work with multipage |
|
| 820 | + $curY += 2; |
|
| 821 | 821 | |
| 822 | 822 | $TTot['total_ht'] += $line->total_ht; |
| 823 | 823 | $TTot['total_tva'] += $line->total_tva; |
@@ -836,67 +836,67 @@ discard block |
||
| 836 | 836 | $TTot['TTotal_tva_multicurrency'][$tx] += $amount; |
| 837 | 837 | } |
| 838 | 838 | } |
| 839 | - else $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage |
|
| 839 | + else $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage |
|
| 840 | 840 | |
| 841 | - $pdf->SetTextColor(0,0,0); |
|
| 841 | + $pdf->SetTextColor(0, 0, 0); |
|
| 842 | 842 | |
| 843 | 843 | $pdf->setTopMargin($tab_top_newpage + 10); |
| 844 | - $pdf->setPageOrientation('', 1, $heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. |
|
| 845 | - $pageposbefore=$pdf->getPage(); |
|
| 844 | + $pdf->setPageOrientation('', 1, $heightforfooter + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. |
|
| 845 | + $pageposbefore = $pdf->getPage(); |
|
| 846 | 846 | |
| 847 | - $showpricebeforepagebreak=1; |
|
| 847 | + $showpricebeforepagebreak = 1; |
|
| 848 | 848 | |
| 849 | 849 | $decalage = (self::getNiveau($line) - 1) * 2; |
| 850 | 850 | |
| 851 | 851 | // Print: Designation |
| 852 | 852 | $label = $line->label; |
| 853 | - if( (float)DOL_VERSION < 6 ) { |
|
| 853 | + if ((float) DOL_VERSION < 6) { |
|
| 854 | 854 | $label = !empty($line->label) ? $line->label : $line->desc; |
| 855 | 855 | } |
| 856 | 856 | |
| 857 | 857 | |
| 858 | 858 | $pdf->startTransaction(); |
| 859 | - $pdf->writeHTMLCell($posx_options-$posx_designation-$decalage, 3, $posx_designation+$decalage, $curY, $outputlangs->convToOutputCharset($label), 0, 1, false, true, 'J',true); |
|
| 860 | - $pageposafter=$pdf->getPage(); |
|
| 859 | + $pdf->writeHTMLCell($posx_options - $posx_designation - $decalage, 3, $posx_designation + $decalage, $curY, $outputlangs->convToOutputCharset($label), 0, 1, false, true, 'J', true); |
|
| 860 | + $pageposafter = $pdf->getPage(); |
|
| 861 | 861 | if ($pageposafter > $pageposbefore) // There is a pagebreak |
| 862 | 862 | { |
| 863 | 863 | $pdf->rollbackTransaction(true); |
| 864 | - $pageposafter=$pageposbefore; |
|
| 864 | + $pageposafter = $pageposbefore; |
|
| 865 | 865 | //print $pageposafter.'-'.$pageposbefore;exit; |
| 866 | - $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
|
| 867 | - $pdf->writeHTMLCell($posx_options-$posx_designation-$decalage, 3, $posx_designation+$decalage, $curY, $outputlangs->convToOutputCharset($label), 0, 1, false, true, 'J',true); |
|
| 866 | + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
|
| 867 | + $pdf->writeHTMLCell($posx_options - $posx_designation - $decalage, 3, $posx_designation + $decalage, $curY, $outputlangs->convToOutputCharset($label), 0, 1, false, true, 'J', true); |
|
| 868 | 868 | |
| 869 | - $pageposafter=$pdf->getPage(); |
|
| 870 | - $posyafter=$pdf->GetY(); |
|
| 869 | + $pageposafter = $pdf->getPage(); |
|
| 870 | + $posyafter = $pdf->GetY(); |
|
| 871 | 871 | //var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit; |
| 872 | - if ($posyafter > ($objmarge->page_hauteur - ($heightforfooter+$heightforinfotot))) // There is no space left for total+free text |
|
| 872 | + if ($posyafter > ($objmarge->page_hauteur - ($heightforfooter + $heightforinfotot))) // There is no space left for total+free text |
|
| 873 | 873 | { |
| 874 | - if ($i == ($nblignes-1)) // No more lines, and no space left to show total, so we create a new page |
|
| 874 | + if ($i == ($nblignes - 1)) // No more lines, and no space left to show total, so we create a new page |
|
| 875 | 875 | { |
| 876 | - $pdf->AddPage('','',true); |
|
| 877 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 876 | + $pdf->AddPage('', '', true); |
|
| 877 | + if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 878 | 878 | if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) self::pagehead($objmarge, $pdf, $object, 0, $outputlangs); |
| 879 | - $pdf->setPage($pageposafter+1); |
|
| 879 | + $pdf->setPage($pageposafter + 1); |
|
| 880 | 880 | } |
| 881 | 881 | } |
| 882 | 882 | else |
| 883 | 883 | { |
| 884 | 884 | // We found a page break |
| 885 | - $showpricebeforepagebreak=0; |
|
| 885 | + $showpricebeforepagebreak = 0; |
|
| 886 | 886 | } |
| 887 | 887 | } |
| 888 | 888 | else // No pagebreak |
| 889 | 889 | { |
| 890 | 890 | $pdf->commitTransaction(); |
| 891 | 891 | } |
| 892 | - $posYAfterDescription=$pdf->GetY(); |
|
| 892 | + $posYAfterDescription = $pdf->GetY(); |
|
| 893 | 893 | |
| 894 | 894 | $nexY = $pdf->GetY(); |
| 895 | - $pageposafter=$pdf->getPage(); |
|
| 895 | + $pageposafter = $pdf->getPage(); |
|
| 896 | 896 | |
| 897 | 897 | $pdf->setPage($pageposbefore); |
| 898 | 898 | $pdf->setTopMargin($objmarge->marge_haute); |
| 899 | - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
| 899 | + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
| 900 | 900 | |
| 901 | 901 | // We suppose that a too long description or photo were moved completely on next page |
| 902 | 902 | if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { |
@@ -909,14 +909,14 @@ discard block |
||
| 909 | 909 | if (!empty($line->total_options)) |
| 910 | 910 | { |
| 911 | 911 | $pdf->SetXY($posx_options, $curY); |
| 912 | - $pdf->MultiCell($posx_montant-$posx_options-0.8, 3, price($line->total_options, 0, $outputlangs), 0, 'R', 0); |
|
| 912 | + $pdf->MultiCell($posx_montant - $posx_options - 0.8, 3, price($line->total_options, 0, $outputlangs), 0, 'R', 0); |
|
| 913 | 913 | } |
| 914 | 914 | |
| 915 | 915 | // Print: Montant |
| 916 | 916 | $pdf->SetXY($posx_montant, $curY); |
| 917 | - $pdf->MultiCell($objmarge->page_largeur-$objmarge->marge_droite-$posx_montant-0.8, 3, price($line->total_ht, 0, $outputlangs), 0, 'R', 0); |
|
| 917 | + $pdf->MultiCell($objmarge->page_largeur - $objmarge->marge_droite - $posx_montant - 0.8, 3, price($line->total_ht, 0, $outputlangs), 0, 'R', 0); |
|
| 918 | 918 | |
| 919 | - $nexY+=2; // Passe espace entre les lignes |
|
| 919 | + $nexY += 2; // Passe espace entre les lignes |
|
| 920 | 920 | |
| 921 | 921 | // Detect if some page were added automatically and output _tableau for past pages |
| 922 | 922 | while ($pagenb < $pageposafter) |
@@ -933,7 +933,7 @@ discard block |
||
| 933 | 933 | |
| 934 | 934 | $pagenb++; |
| 935 | 935 | $pdf->setPage($pagenb); |
| 936 | - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
| 936 | + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
| 937 | 937 | if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) self::pagehead($objmarge, $pdf, $object, 0, $outputlangs); |
| 938 | 938 | } |
| 939 | 939 | } |
@@ -943,19 +943,19 @@ discard block |
||
| 943 | 943 | if ($pagenb == 1) |
| 944 | 944 | { |
| 945 | 945 | 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); |
| 946 | - $bottomlasttab=$objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1; |
|
| 946 | + $bottomlasttab = $objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1; |
|
| 947 | 947 | } |
| 948 | 948 | else |
| 949 | 949 | { |
| 950 | 950 | 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); |
| 951 | - $bottomlasttab=$objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1; |
|
| 951 | + $bottomlasttab = $objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1; |
|
| 952 | 952 | } |
| 953 | 953 | |
| 954 | 954 | // Affiche zone totaux |
| 955 | - $posy=self::tableau_tot($objmarge, $pdf, $object, $bottomlasttab, $outputlangs, $TTot); |
|
| 955 | + $posy = self::tableau_tot($objmarge, $pdf, $object, $bottomlasttab, $outputlangs, $TTot); |
|
| 956 | 956 | |
| 957 | 957 | $pdf->Close(); |
| 958 | - $pdf->Output($file,'F'); |
|
| 958 | + $pdf->Output($file, 'F'); |
|
| 959 | 959 | |
| 960 | 960 | $pagecount = self::concat($outputlangs, array($origin_file, $file), $origin_file); |
| 961 | 961 | |
@@ -967,7 +967,7 @@ discard block |
||
| 967 | 967 | $level = $line->qty; // TODO à améliorer |
| 968 | 968 | |
| 969 | 969 | $pdf->SetXY($objmarge->marge_gauche, $curY); |
| 970 | - $pdf->MultiCell($posx_designation-$objmarge->marge_gauche-0.8, 5, $level, 0, 'L', 0); |
|
| 970 | + $pdf->MultiCell($posx_designation - $objmarge->marge_gauche - 0.8, 5, $level, 0, 'L', 0); |
|
| 971 | 971 | } |
| 972 | 972 | |
| 973 | 973 | /** |
@@ -981,50 +981,50 @@ discard block |
||
| 981 | 981 | */ |
| 982 | 982 | private static function pagehead(&$objmarge, &$pdf, &$object, $showdetail, $outputlangs) |
| 983 | 983 | { |
| 984 | - global $conf,$mysoc; |
|
| 984 | + global $conf, $mysoc; |
|
| 985 | 985 | |
| 986 | 986 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
| 987 | 987 | |
| 988 | - pdf_pagehead($pdf,$outputlangs,$objmarge->page_hauteur); |
|
| 988 | + pdf_pagehead($pdf, $outputlangs, $objmarge->page_hauteur); |
|
| 989 | 989 | |
| 990 | - $pdf->SetTextColor(0,0,60); |
|
| 991 | - $pdf->SetFont('','B', $default_font_size + 3); |
|
| 990 | + $pdf->SetTextColor(0, 0, 60); |
|
| 991 | + $pdf->SetFont('', 'B', $default_font_size + 3); |
|
| 992 | 992 | |
| 993 | - $posy=$objmarge->marge_haute; |
|
| 994 | - $posx=$objmarge->page_largeur-$objmarge->marge_droite-100; |
|
| 993 | + $posy = $objmarge->marge_haute; |
|
| 994 | + $posx = $objmarge->page_largeur - $objmarge->marge_droite - 100; |
|
| 995 | 995 | |
| 996 | - $pdf->SetXY($objmarge->marge_gauche,$posy); |
|
| 996 | + $pdf->SetXY($objmarge->marge_gauche, $posy); |
|
| 997 | 997 | |
| 998 | - $logo=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo; |
|
| 998 | + $logo = $conf->mycompany->dir_output.'/logos/'.$mysoc->logo; |
|
| 999 | 999 | if ($mysoc->logo) |
| 1000 | 1000 | { |
| 1001 | 1001 | if (is_readable($logo)) |
| 1002 | 1002 | { |
| 1003 | - $height=pdf_getHeightForLogo($logo); |
|
| 1004 | - $pdf->Image($logo, $objmarge->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
| 1003 | + $height = pdf_getHeightForLogo($logo); |
|
| 1004 | + $pdf->Image($logo, $objmarge->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
| 1005 | 1005 | } |
| 1006 | 1006 | else |
| 1007 | 1007 | { |
| 1008 | - $pdf->SetTextColor(200,0,0); |
|
| 1009 | - $pdf->SetFont('','B',$default_font_size - 2); |
|
| 1010 | - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L'); |
|
| 1008 | + $pdf->SetTextColor(200, 0, 0); |
|
| 1009 | + $pdf->SetFont('', 'B', $default_font_size - 2); |
|
| 1010 | + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); |
|
| 1011 | 1011 | $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); |
| 1012 | 1012 | } |
| 1013 | 1013 | |
| 1014 | - $posy+=35; |
|
| 1014 | + $posy += 35; |
|
| 1015 | 1015 | } |
| 1016 | 1016 | else |
| 1017 | 1017 | { |
| 1018 | - $text=$mysoc->name; |
|
| 1018 | + $text = $mysoc->name; |
|
| 1019 | 1019 | $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); |
| 1020 | 1020 | |
| 1021 | - $posy+=15; |
|
| 1021 | + $posy += 15; |
|
| 1022 | 1022 | } |
| 1023 | 1023 | |
| 1024 | 1024 | |
| 1025 | - $pdf->SetTextColor(0,0,0); |
|
| 1026 | - $pdf->SetFont('','B', $default_font_size + 2); |
|
| 1027 | - $pdf->SetXY($objmarge->marge_gauche,$posy); |
|
| 1025 | + $pdf->SetTextColor(0, 0, 0); |
|
| 1026 | + $pdf->SetFont('', 'B', $default_font_size + 2); |
|
| 1027 | + $pdf->SetXY($objmarge->marge_gauche, $posy); |
|
| 1028 | 1028 | |
| 1029 | 1029 | $key = 'subtotalPropalTitle'; |
| 1030 | 1030 | if ($object->element == 'commande') $key = 'subtotalCommandeTitle'; |
@@ -1033,14 +1033,14 @@ discard block |
||
| 1033 | 1033 | |
| 1034 | 1034 | $pdf->MultiCell(150, 4, $outputlangs->transnoentities($key, $object->ref, $object->thirdparty->name), '', 'L'); |
| 1035 | 1035 | |
| 1036 | - $pdf->SetFont('','', $default_font_size); |
|
| 1037 | - $pdf->SetXY($objmarge->page_largeur-$objmarge->marge_droite-40,$posy); |
|
| 1036 | + $pdf->SetFont('', '', $default_font_size); |
|
| 1037 | + $pdf->SetXY($objmarge->page_largeur - $objmarge->marge_droite - 40, $posy); |
|
| 1038 | 1038 | $pdf->MultiCell(40, 4, dol_print_date($object->date, 'daytext'), '', 'R'); |
| 1039 | 1039 | |
| 1040 | 1040 | $posy += 8; |
| 1041 | 1041 | |
| 1042 | - $pdf->SetFont('','B', $default_font_size + 2); |
|
| 1043 | - $pdf->SetXY($objmarge->marge_gauche,$posy); |
|
| 1042 | + $pdf->SetFont('', 'B', $default_font_size + 2); |
|
| 1043 | + $pdf->SetXY($objmarge->marge_gauche, $posy); |
|
| 1044 | 1044 | $pdf->MultiCell(70, 4, $outputlangs->transnoentities('subtotalRecapLot'), '', 'L'); |
| 1045 | 1045 | |
| 1046 | 1046 | } |
@@ -1058,44 +1058,44 @@ discard block |
||
| 1058 | 1058 | * @param string $currency Currency code |
| 1059 | 1059 | * @return void |
| 1060 | 1060 | */ |
| 1061 | - private static function tableau(&$objmarge, &$pdf, $posx_designation, $posx_options, $posx_montant, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0, $currency='') |
|
| 1061 | + private static function tableau(&$objmarge, &$pdf, $posx_designation, $posx_options, $posx_montant, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '') |
|
| 1062 | 1062 | { |
| 1063 | 1063 | global $conf; |
| 1064 | 1064 | |
| 1065 | 1065 | // Force to disable hidetop and hidebottom |
| 1066 | - $hidebottom=0; |
|
| 1067 | - if ($hidetop) $hidetop=-1; |
|
| 1066 | + $hidebottom = 0; |
|
| 1067 | + if ($hidetop) $hidetop = -1; |
|
| 1068 | 1068 | |
| 1069 | 1069 | $currency = !empty($currency) ? $currency : $conf->currency; |
| 1070 | 1070 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
| 1071 | 1071 | |
| 1072 | 1072 | // Amount in (at tab_top - 1) |
| 1073 | - $pdf->SetTextColor(0,0,0); |
|
| 1074 | - $pdf->SetFont('','',$default_font_size); |
|
| 1073 | + $pdf->SetTextColor(0, 0, 0); |
|
| 1074 | + $pdf->SetFont('', '', $default_font_size); |
|
| 1075 | 1075 | |
| 1076 | 1076 | if (empty($hidetop)) |
| 1077 | 1077 | { |
| 1078 | - $titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$currency)); |
|
| 1079 | - $pdf->SetXY($objmarge->page_largeur - $objmarge->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4.5); |
|
| 1078 | + $titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency)); |
|
| 1079 | + $pdf->SetXY($objmarge->page_largeur - $objmarge->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4.5); |
|
| 1080 | 1080 | $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); |
| 1081 | 1081 | |
| 1082 | - 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)); |
|
| 1082 | + 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)); |
|
| 1083 | 1083 | |
| 1084 | 1084 | |
| 1085 | - $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 |
|
| 1085 | + $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 |
|
| 1086 | 1086 | |
| 1087 | - $pdf->SetXY($posx_designation, $tab_top+2); |
|
| 1088 | - $pdf->MultiCell($posx_options - $posx_designation,2, $outputlangs->transnoentities("Designation"),'','L'); |
|
| 1089 | - $pdf->SetXY($posx_options, $tab_top+2); |
|
| 1090 | - $pdf->MultiCell($posx_montant - $posx_options,2, $outputlangs->transnoentities("Options"),'','R'); |
|
| 1091 | - $pdf->SetXY($posx_montant, $tab_top+2); |
|
| 1092 | - $pdf->MultiCell($objmarge->page_largeur - $objmarge->marge_droite - $posx_montant,2, $outputlangs->transnoentities("Amount"),'','R'); |
|
| 1087 | + $pdf->SetXY($posx_designation, $tab_top + 2); |
|
| 1088 | + $pdf->MultiCell($posx_options - $posx_designation, 2, $outputlangs->transnoentities("Designation"), '', 'L'); |
|
| 1089 | + $pdf->SetXY($posx_options, $tab_top + 2); |
|
| 1090 | + $pdf->MultiCell($posx_montant - $posx_options, 2, $outputlangs->transnoentities("Options"), '', 'R'); |
|
| 1091 | + $pdf->SetXY($posx_montant, $tab_top + 2); |
|
| 1092 | + $pdf->MultiCell($objmarge->page_largeur - $objmarge->marge_droite - $posx_montant, 2, $outputlangs->transnoentities("Amount"), '', 'R'); |
|
| 1093 | 1093 | |
| 1094 | - $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 |
|
| 1094 | + $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 |
|
| 1095 | 1095 | } |
| 1096 | 1096 | else |
| 1097 | 1097 | { |
| 1098 | - $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 |
|
| 1098 | + $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 |
|
| 1099 | 1099 | } |
| 1100 | 1100 | |
| 1101 | 1101 | } |
@@ -1104,29 +1104,29 @@ discard block |
||
| 1104 | 1104 | { |
| 1105 | 1105 | global $conf; |
| 1106 | 1106 | |
| 1107 | - $pdf->line($objmarge->marge_gauche, $posy, $objmarge->page_largeur-$objmarge->marge_droite, $posy); // line prend une position y en 2eme param et 4eme param |
|
| 1107 | + $pdf->line($objmarge->marge_gauche, $posy, $objmarge->page_largeur - $objmarge->marge_droite, $posy); // line prend une position y en 2eme param et 4eme param |
|
| 1108 | 1108 | |
| 1109 | 1109 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
| 1110 | 1110 | |
| 1111 | - $tab2_top = $posy+2; |
|
| 1111 | + $tab2_top = $posy + 2; |
|
| 1112 | 1112 | $tab2_hl = 4; |
| 1113 | - $pdf->SetFont('','', $default_font_size - 1); |
|
| 1113 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
| 1114 | 1114 | |
| 1115 | 1115 | // Tableau total |
| 1116 | 1116 | $col1x = 120; $col2x = 170; |
| 1117 | 1117 | if ($objmarge->page_largeur < 210) // To work with US executive format |
| 1118 | 1118 | { |
| 1119 | - $col2x-=20; |
|
| 1119 | + $col2x -= 20; |
|
| 1120 | 1120 | } |
| 1121 | 1121 | $largcol2 = ($objmarge->page_largeur - $objmarge->marge_droite - $col2x); |
| 1122 | 1122 | |
| 1123 | - $useborder=0; |
|
| 1123 | + $useborder = 0; |
|
| 1124 | 1124 | $index = 0; |
| 1125 | 1125 | |
| 1126 | 1126 | // Total HT |
| 1127 | - $pdf->SetFillColor(255,255,255); |
|
| 1127 | + $pdf->SetFillColor(255, 255, 255); |
|
| 1128 | 1128 | $pdf->SetXY($col1x, $tab2_top + 0); |
| 1129 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); |
|
| 1129 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); |
|
| 1130 | 1130 | |
| 1131 | 1131 | // $total_ht = ($conf->multicurrency->enabled && $object->mylticurrency_tx != 1) ? $TTot['multicurrency_total_ht'] : $TTot['total_ht']; |
| 1132 | 1132 | $total_ht = $TTot['total_ht']; |
@@ -1134,10 +1134,10 @@ discard block |
||
| 1134 | 1134 | $pdf->MultiCell($largcol2, $tab2_hl, price($total_ht, 0, $outputlangs), 0, 'R', 1); |
| 1135 | 1135 | |
| 1136 | 1136 | // Show VAT by rates and total |
| 1137 | - $pdf->SetFillColor(248,248,248); |
|
| 1137 | + $pdf->SetFillColor(248, 248, 248); |
|
| 1138 | 1138 | |
| 1139 | - $atleastoneratenotnull=0; |
|
| 1140 | - foreach($TTot['TTotal_tva'] as $tvakey => $tvaval) |
|
| 1139 | + $atleastoneratenotnull = 0; |
|
| 1140 | + foreach ($TTot['TTotal_tva'] as $tvakey => $tvaval) |
|
| 1141 | 1141 | { |
| 1142 | 1142 | if ($tvakey != 0) // On affiche pas taux 0 |
| 1143 | 1143 | { |
@@ -1146,15 +1146,15 @@ discard block |
||
| 1146 | 1146 | $index++; |
| 1147 | 1147 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
| 1148 | 1148 | |
| 1149 | - $tvacompl=''; |
|
| 1150 | - if (preg_match('/\*/',$tvakey)) |
|
| 1149 | + $tvacompl = ''; |
|
| 1150 | + if (preg_match('/\*/', $tvakey)) |
|
| 1151 | 1151 | { |
| 1152 | - $tvakey=str_replace('*','',$tvakey); |
|
| 1152 | + $tvakey = str_replace('*', '', $tvakey); |
|
| 1153 | 1153 | $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; |
| 1154 | 1154 | } |
| 1155 | - $totalvat =$outputlangs->transnoentities("TotalVAT").' '; |
|
| 1156 | - $totalvat.=vatrate($tvakey,1).$tvacompl; |
|
| 1157 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
| 1155 | + $totalvat = $outputlangs->transnoentities("TotalVAT").' '; |
|
| 1156 | + $totalvat .= vatrate($tvakey, 1).$tvacompl; |
|
| 1157 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
| 1158 | 1158 | |
| 1159 | 1159 | $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
| 1160 | 1160 | $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); |
@@ -1164,16 +1164,16 @@ discard block |
||
| 1164 | 1164 | // Total TTC |
| 1165 | 1165 | $index++; |
| 1166 | 1166 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
| 1167 | - $pdf->SetTextColor(0,0,60); |
|
| 1168 | - $pdf->SetFillColor(224,224,224); |
|
| 1169 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); |
|
| 1167 | + $pdf->SetTextColor(0, 0, 60); |
|
| 1168 | + $pdf->SetFillColor(224, 224, 224); |
|
| 1169 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); |
|
| 1170 | 1170 | |
| 1171 | 1171 | // $total_ttc = ($conf->multicurrency->enabled && $object->multiccurency_tx != 1) ? $TTot['multicurrency_total_ttc'] : $TTot['total_ttc']; |
| 1172 | 1172 | $total_ttc = $TTot['total_ttc']; |
| 1173 | 1173 | $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
| 1174 | 1174 | $pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc, 0, $outputlangs), $useborder, 'R', 1); |
| 1175 | 1175 | |
| 1176 | - $pdf->SetTextColor(0,0,0); |
|
| 1176 | + $pdf->SetTextColor(0, 0, 0); |
|
| 1177 | 1177 | |
| 1178 | 1178 | $index++; |
| 1179 | 1179 | return ($tab2_top + ($tab2_hl * $index)); |
@@ -1192,22 +1192,22 @@ discard block |
||
| 1192 | 1192 | * @param int $hidebottom Hide bottom |
| 1193 | 1193 | * @return void |
| 1194 | 1194 | */ |
| 1195 | - private static function printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0) |
|
| 1195 | + private static function printRect($pdf, $x, $y, $l, $h, $hidetop = 0, $hidebottom = 0) |
|
| 1196 | 1196 | { |
| 1197 | - if (empty($hidetop) || $hidetop==-1) $pdf->line($x, $y, $x+$l, $y); |
|
| 1198 | - $pdf->line($x+$l, $y, $x+$l, $y+$h); |
|
| 1199 | - if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h); |
|
| 1200 | - $pdf->line($x, $y+$h, $x, $y); |
|
| 1197 | + if (empty($hidetop) || $hidetop == -1) $pdf->line($x, $y, $x + $l, $y); |
|
| 1198 | + $pdf->line($x + $l, $y, $x + $l, $y + $h); |
|
| 1199 | + if (empty($hidebottom)) $pdf->line($x + $l, $y + $h, $x, $y + $h); |
|
| 1200 | + $pdf->line($x, $y + $h, $x, $y); |
|
| 1201 | 1201 | } |
| 1202 | 1202 | |
| 1203 | 1203 | |
| 1204 | - public static function concat(&$outputlangs, $files, $fileoutput='') |
|
| 1204 | + public static function concat(&$outputlangs, $files, $fileoutput = '') |
|
| 1205 | 1205 | { |
| 1206 | 1206 | global $conf; |
| 1207 | 1207 | |
| 1208 | 1208 | if (empty($fileoutput)) $fileoutput = $file[0]; |
| 1209 | 1209 | |
| 1210 | - $pdf=pdf_getInstance(); |
|
| 1210 | + $pdf = pdf_getInstance(); |
|
| 1211 | 1211 | if (class_exists('TCPDF')) |
| 1212 | 1212 | { |
| 1213 | 1213 | $pdf->setPrintHeader(false); |
@@ -1215,10 +1215,10 @@ discard block |
||
| 1215 | 1215 | } |
| 1216 | 1216 | $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
| 1217 | 1217 | |
| 1218 | - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
| 1218 | + if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
| 1219 | 1219 | |
| 1220 | 1220 | |
| 1221 | - foreach($files as $file) |
|
| 1221 | + foreach ($files as $file) |
|
| 1222 | 1222 | { |
| 1223 | 1223 | $pagecount = $pdf->setSourceFile($file); |
| 1224 | 1224 | for ($i = 1; $i <= $pagecount; $i++) |
@@ -1230,8 +1230,8 @@ discard block |
||
| 1230 | 1230 | } |
| 1231 | 1231 | } |
| 1232 | 1232 | |
| 1233 | - $pdf->Output($fileoutput,'F'); |
|
| 1234 | - if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
| 1233 | + $pdf->Output($fileoutput, 'F'); |
|
| 1234 | + if (!empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
| 1235 | 1235 | |
| 1236 | 1236 | return $pagecount; |
| 1237 | 1237 | } |
@@ -1244,7 +1244,7 @@ discard block |
||
| 1244 | 1244 | */ |
| 1245 | 1245 | public static function hasNcTitle(&$line) |
| 1246 | 1246 | { |
| 1247 | - if(isset($line->has_nc_title)) return $line->has_nc_title; |
|
| 1247 | + if (isset($line->has_nc_title)) return $line->has_nc_title; |
|
| 1248 | 1248 | |
| 1249 | 1249 | $TTitle = self::getAllTitleFromLine($line); |
| 1250 | 1250 | 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 | |
| 30 | 35 | $TNotElements = array ('invoice_supplier', 'order_supplier'); |
@@ -36,7 +41,9 @@ discard block |
||
| 36 | 41 | /** |
| 37 | 42 | * @var $object Facture |
| 38 | 43 | */ |
| 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); |
|
| 44 | + if($object->element=='facture') { |
|
| 45 | + $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); |
|
| 46 | + } |
|
| 40 | 47 | /** |
| 41 | 48 | * @var $object Facture fournisseur |
| 42 | 49 | */ |
@@ -48,16 +55,22 @@ discard block |
||
| 48 | 55 | /** |
| 49 | 56 | * @var $object Propal |
| 50 | 57 | */ |
| 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); |
|
| 58 | + else if($object->element=='propal') { |
|
| 59 | + $res = $object->addline($desc, 0,$qty,0,0,0,0,0,'HT',0,0,9,$rang, TSubtotal::$module_number, 0, 0, 0, $label); |
|
| 60 | + } |
|
| 52 | 61 | /** |
| 53 | 62 | * @var $object Propal Fournisseur |
| 54 | 63 | */ |
| 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); |
|
| 64 | + else if($object->element=='supplier_proposal') { |
|
| 65 | + $res = $object->addline($desc, 0,$qty,0,0,0,0,0,'HT',0,0,9,$rang, TSubtotal::$module_number, 0, 0, 0, $label); |
|
| 66 | + } |
|
| 56 | 67 | |
| 57 | 68 | /** |
| 58 | 69 | * @var $object Commande |
| 59 | 70 | */ |
| 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); |
|
| 71 | + else if($object->element=='commande') { |
|
| 72 | + $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 | + } |
|
| 61 | 74 | /** |
| 62 | 75 | * @var $object Commande fournisseur |
| 63 | 76 | */ |
@@ -68,7 +81,9 @@ discard block |
||
| 68 | 81 | /** |
| 69 | 82 | * @var $object Facturerec |
| 70 | 83 | */ |
| 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); |
|
| 84 | + else if($object->element=='facturerec') { |
|
| 85 | + $res = $object->addline($desc, 0,$qty, 0, 0, 0, 0, 0, 'HT', 0, '', 0, 9, $rang, TSubtotal::$module_number,$label); |
|
| 86 | + } |
|
| 72 | 87 | |
| 73 | 88 | } |
| 74 | 89 | |
@@ -90,8 +105,9 @@ discard block |
||
| 90 | 105 | // Define output language |
| 91 | 106 | $outputlangs = $langs; |
| 92 | 107 | $newlang = GETPOST('lang_id', 'alpha'); |
| 93 | - if (! empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) |
|
| 94 | - $newlang = !empty($object->client) ? $object->client->default_lang : $object->thirdparty->default_lang; |
|
| 108 | + if (! empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) { |
|
| 109 | + $newlang = !empty($object->client) ? $object->client->default_lang : $object->thirdparty->default_lang; |
|
| 110 | + } |
|
| 95 | 111 | if (! empty($newlang)) { |
| 96 | 112 | $outputlangs = new Translate("", $conf); |
| 97 | 113 | $outputlangs->setDefaultLang($newlang); |
@@ -100,13 +116,18 @@ discard block |
||
| 100 | 116 | $ret = $object->fetch($object->id); // Reload to get new records |
| 101 | 117 | if ((float) DOL_VERSION <= 3.6) |
| 102 | 118 | { |
| 103 | - if ($object->element == 'propal') propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 104 | - elseif ($object->element == 'commande') commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 105 | - elseif ($object->element == 'facture') facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 106 | - } |
|
| 107 | - else |
|
| 119 | + if ($object->element == 'propal') { |
|
| 120 | + propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 121 | + } elseif ($object->element == 'commande') { |
|
| 122 | + commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 123 | + } elseif ($object->element == 'facture') { |
|
| 124 | + facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 125 | + } |
|
| 126 | + } else |
|
| 108 | 127 | { |
| 109 | - if ($object->element!= 'facturerec') $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 128 | + if ($object->element!= 'facturerec') { |
|
| 129 | + $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 130 | + } |
|
| 110 | 131 | } |
| 111 | 132 | } |
| 112 | 133 | } |
@@ -120,7 +141,9 @@ discard block |
||
| 120 | 141 | */ |
| 121 | 142 | public static function updateRang(&$object, $rang_start, $move_to=1) |
| 122 | 143 | { |
| 123 | - if (!class_exists('GenericObject')) require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php'; |
|
| 144 | + if (!class_exists('GenericObject')) { |
|
| 145 | + require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php'; |
|
| 146 | + } |
|
| 124 | 147 | |
| 125 | 148 | $row=new GenericObject($object->db); |
| 126 | 149 | $row->table_element_line = $object->table_element_line; |
@@ -129,7 +152,9 @@ discard block |
||
| 129 | 152 | |
| 130 | 153 | foreach ($object->lines as &$line) |
| 131 | 154 | { |
| 132 | - if ($line->rang < $rang_start) continue; |
|
| 155 | + if ($line->rang < $rang_start) { |
|
| 156 | + continue; |
|
| 157 | + } |
|
| 133 | 158 | |
| 134 | 159 | $row->updateRangOfLine($line->id, $line->rang+$move_to); |
| 135 | 160 | } |
@@ -152,21 +177,28 @@ discard block |
||
| 152 | 177 | foreach ($TTitle_reverse as $k => $title_line) |
| 153 | 178 | { |
| 154 | 179 | $title_niveau = self::getNiveau($title_line); |
| 155 | - if ($title_niveau < $level_new_title) break; |
|
| 180 | + if ($title_niveau < $level_new_title) { |
|
| 181 | + break; |
|
| 182 | + } |
|
| 156 | 183 | |
| 157 | 184 | $rang_to_add = self::titleHasTotalLine($object, $title_line, true, true); |
| 158 | 185 | |
| 159 | 186 | if (is_numeric($rang_to_add)) |
| 160 | 187 | { |
| 161 | - if ($rang_to_add != -1) self::updateRang($object, $rang_to_add); |
|
| 188 | + if ($rang_to_add != -1) { |
|
| 189 | + self::updateRang($object, $rang_to_add); |
|
| 190 | + } |
|
| 162 | 191 | |
| 163 | 192 | self::addSubTotalLine($object, $langs->trans('SubTotal'), 100-$title_niveau, $rang_to_add); |
| 164 | 193 | |
| 165 | 194 | $object->lines[] = $object->line; // ajout de la ligne dans le tableau de ligne (Dolibarr ne le fait pas) |
| 166 | 195 | if ($rang_to_add != -1) |
| 167 | 196 | { |
| 168 | - if (method_exists($object, 'fetch_lines')) $object->fetch_lines(); |
|
| 169 | - else $object->fetch($object->id); |
|
| 197 | + if (method_exists($object, 'fetch_lines')) { |
|
| 198 | + $object->fetch_lines(); |
|
| 199 | + } else { |
|
| 200 | + $object->fetch($object->id); |
|
| 201 | + } |
|
| 170 | 202 | } |
| 171 | 203 | } |
| 172 | 204 | } |
@@ -196,7 +228,9 @@ discard block |
||
| 196 | 228 | |
| 197 | 229 | foreach ($TTitle as $k => $title_line) |
| 198 | 230 | { |
| 199 | - if (self::titleHasTotalLine($object, $title_line)) unset($TTitle[$k]); |
|
| 231 | + if (self::titleHasTotalLine($object, $title_line)) { |
|
| 232 | + unset($TTitle[$k]); |
|
| 233 | + } |
|
| 200 | 234 | } |
| 201 | 235 | |
| 202 | 236 | return $TTitle; |
@@ -213,23 +247,41 @@ discard block |
||
| 213 | 247 | */ |
| 214 | 248 | public static function titleHasTotalLine(&$object, &$title_line, $strict_mode=false, $return_rang_on_false=false) |
| 215 | 249 | { |
| 216 | - if (empty($object->lines) || !is_array($object->lines)) return false; |
|
| 250 | + if (empty($object->lines) || !is_array($object->lines)) { |
|
| 251 | + return false; |
|
| 252 | + } |
|
| 217 | 253 | |
| 218 | 254 | $title_niveau = self::getNiveau($title_line); |
| 219 | 255 | foreach ($object->lines as &$line) |
| 220 | 256 | { |
| 221 | - if ($line->rang <= $title_line->rang) continue; |
|
| 222 | - 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 |
|
| 223 | - if (!self::isSubtotal($line)) continue; |
|
| 257 | + if ($line->rang <= $title_line->rang) { |
|
| 258 | + continue; |
|
| 259 | + } |
|
| 260 | + if (self::isTitle($line) && self::getNiveau($line) <= $title_niveau) { |
|
| 261 | + return false; |
|
| 262 | + } |
|
| 263 | + // 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 |
|
| 264 | + if (!self::isSubtotal($line)) { |
|
| 265 | + continue; |
|
| 266 | + } |
|
| 224 | 267 | |
| 225 | 268 | $subtotal_niveau = self::getNiveau($line); |
| 226 | 269 | |
| 227 | 270 | // Comparaison du niveau de la ligne de sous-total avec celui du titre |
| 228 | - if ($subtotal_niveau == $title_niveau) return true; // niveau égale => Ok mon titre a un sous-total |
|
| 229 | - elseif ($subtotal_niveau < $title_niveau) // niveau inférieur trouvé (exemple : sous-total de niveau 1 contre mon titre de niveau 3) |
|
| 271 | + if ($subtotal_niveau == $title_niveau) { |
|
| 272 | + return true; |
|
| 273 | + } |
|
| 274 | + // niveau égale => Ok mon titre a un sous-total |
|
| 275 | + elseif ($subtotal_niveau < $title_niveau) { |
|
| 276 | + // niveau inférieur trouvé (exemple : sous-total de niveau 1 contre mon titre de niveau 3) |
|
| 230 | 277 | { |
| 231 | - if ($strict_mode) return ($return_rang_on_false) ? $line->rang : false; // mode strict niveau pas égale donc faux |
|
| 232 | - else return true; // mode libre => OK je considère que mon titre à un sous-total |
|
| 278 | + if ($strict_mode) return ($return_rang_on_false) ? $line->rang : false; |
|
| 279 | + } |
|
| 280 | + // mode strict niveau pas égale donc faux |
|
| 281 | + else { |
|
| 282 | + return true; |
|
| 283 | + } |
|
| 284 | + // mode libre => OK je considère que mon titre à un sous-total |
|
| 233 | 285 | } |
| 234 | 286 | } |
| 235 | 287 | |
@@ -277,16 +329,19 @@ discard block |
||
| 277 | 329 | |
| 278 | 330 | foreach ($object->lines as &$l) |
| 279 | 331 | { |
| 280 | - if ($l->rang <= $line->rang) continue; |
|
| 281 | - elseif (self::isSubtotal($l) && self::getNiveau($l) == $line->qty) break; |
|
| 282 | - elseif (self::isModSubtotalLine($l)) continue; |
|
| 332 | + if ($l->rang <= $line->rang) { |
|
| 333 | + continue; |
|
| 334 | + } elseif (self::isSubtotal($l) && self::getNiveau($l) == $line->qty) { |
|
| 335 | + break; |
|
| 336 | + } elseif (self::isModSubtotalLine($l)) { |
|
| 337 | + continue; |
|
| 338 | + } |
|
| 283 | 339 | |
| 284 | 340 | if (!empty($l->array_options['options_subtotal_nc'])) |
| 285 | 341 | { |
| 286 | 342 | $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); |
| 287 | 343 | $TTot['total_options'] += $tabprice[0]; // total ht |
| 288 | - } |
|
| 289 | - else |
|
| 344 | + } else |
|
| 290 | 345 | { |
| 291 | 346 | $TTot['total_pa_ht'] += $l->pa_ht * $l->qty; |
| 292 | 347 | $TTot['total_subprice'] += $l->subprice * $l->qty; |
@@ -306,29 +361,41 @@ discard block |
||
| 306 | 361 | |
| 307 | 362 | public static function getOrderIdFromLineId(&$db, $fk_commandedet) |
| 308 | 363 | { |
| 309 | - if (empty($fk_commandedet)) return false; |
|
| 364 | + if (empty($fk_commandedet)) { |
|
| 365 | + return false; |
|
| 366 | + } |
|
| 310 | 367 | |
| 311 | 368 | $sql = 'SELECT fk_commande FROM '.MAIN_DB_PREFIX.'commandedet WHERE rowid = '.$fk_commandedet; |
| 312 | 369 | $resql = $db->query($sql); |
| 313 | 370 | |
| 314 | - if ($resql && ($row = $db->fetch_object($resql))) return $row->fk_commande; |
|
| 315 | - else return false; |
|
| 371 | + if ($resql && ($row = $db->fetch_object($resql))) { |
|
| 372 | + return $row->fk_commande; |
|
| 373 | + } else { |
|
| 374 | + return false; |
|
| 375 | + } |
|
| 316 | 376 | } |
| 317 | 377 | |
| 318 | 378 | public static function getLastLineOrderId(&$db, $fk_commande) |
| 319 | 379 | { |
| 320 | - if (empty($fk_commande)) return false; |
|
| 380 | + if (empty($fk_commande)) { |
|
| 381 | + return false; |
|
| 382 | + } |
|
| 321 | 383 | |
| 322 | 384 | $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'commandedet WHERE fk_commande = '.$fk_commande.' ORDER BY rang DESC LIMIT 1'; |
| 323 | 385 | $resql = $db->query($sql); |
| 324 | 386 | |
| 325 | - if ($resql && ($row = $db->fetch_object($resql))) return $row->rowid; |
|
| 326 | - else return false; |
|
| 387 | + if ($resql && ($row = $db->fetch_object($resql))) { |
|
| 388 | + return $row->rowid; |
|
| 389 | + } else { |
|
| 390 | + return false; |
|
| 391 | + } |
|
| 327 | 392 | } |
| 328 | 393 | |
| 329 | 394 | public static function getParentTitleOfLine(&$object, $i) |
| 330 | 395 | { |
| 331 | - if ($i <= 0) return false; |
|
| 396 | + if ($i <= 0) { |
|
| 397 | + return false; |
|
| 398 | + } |
|
| 332 | 399 | |
| 333 | 400 | $skip_title = 0; |
| 334 | 401 | // Je parcours les lignes précédentes |
@@ -347,8 +414,7 @@ discard block |
||
| 347 | 414 | //@INFO J'ai ma ligne titre qui contient ma ligne, par contre je check pas s'il y a un sous-total |
| 348 | 415 | return $line; |
| 349 | 416 | break; |
| 350 | - } |
|
| 351 | - elseif ($line->product_type == 9 && $line->qty >= 90 && $line->qty <= 99) |
|
| 417 | + } elseif ($line->product_type == 9 && $line->qty >= 90 && $line->qty <= 99) |
|
| 352 | 418 | { |
| 353 | 419 | // 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) |
| 354 | 420 | $skip_title++; |
@@ -363,7 +429,9 @@ discard block |
||
| 363 | 429 | $res = $line->special_code == self::$module_number && $line->product_type == 9 && $line->qty <= 9; |
| 364 | 430 | if($res && $level > -1) { |
| 365 | 431 | return $line->qty == $level; |
| 366 | - } else return $res; |
|
| 432 | + } else { |
|
| 433 | + return $res; |
|
| 434 | + } |
|
| 367 | 435 | |
| 368 | 436 | } |
| 369 | 437 | |
@@ -372,7 +440,9 @@ discard block |
||
| 372 | 440 | $res = $line->special_code == self::$module_number && $line->product_type == 9 && $line->qty >= 90; |
| 373 | 441 | if($res && $level > -1) { |
| 374 | 442 | return self::getNiveau($line) == $level; |
| 375 | - } else return $res; |
|
| 443 | + } else { |
|
| 444 | + return $res; |
|
| 445 | + } |
|
| 376 | 446 | } |
| 377 | 447 | |
| 378 | 448 | public static function isFreeText(&$line) |
@@ -393,10 +463,14 @@ discard block |
||
| 393 | 463 | // editeur wysiwyg |
| 394 | 464 | require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
| 395 | 465 | $nbrows=ROWS_2; |
| 396 | - if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; |
|
| 466 | + if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) { |
|
| 467 | + $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; |
|
| 468 | + } |
|
| 397 | 469 | $enable=(isset($conf->global->FCKEDITOR_ENABLE_DETAILS)?$conf->global->FCKEDITOR_ENABLE_DETAILS:0); |
| 398 | 470 | $toolbarname='dolibarr_details'; |
| 399 | - if (! empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) $toolbarname='dolibarr_notes'; |
|
| 471 | + if (! empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) { |
|
| 472 | + $toolbarname='dolibarr_notes'; |
|
| 473 | + } |
|
| 400 | 474 | $text = !empty($line->description)?$line->description:$line->label; |
| 401 | 475 | $doleditor=new DolEditor('line-description',$text,'',164,$toolbarname,'',false,true,$enable,$nbrows,'98%', $readonly); |
| 402 | 476 | return $doleditor->Create(1); |
@@ -411,12 +485,10 @@ discard block |
||
| 411 | 485 | { |
| 412 | 486 | $object->statut = 0; // hack for facture rec |
| 413 | 487 | $createRight = $user->rights->facture->creer; |
| 414 | - } |
|
| 415 | - elseif($object->element == 'order_supplier' ) |
|
| 488 | + } elseif($object->element == 'order_supplier' ) |
|
| 416 | 489 | { |
| 417 | 490 | $createRight = $user->rights->fournisseur->commande->creer; |
| 418 | - } |
|
| 419 | - elseif($object->element == 'invoice_supplier' ) |
|
| 491 | + } elseif($object->element == 'invoice_supplier' ) |
|
| 420 | 492 | { |
| 421 | 493 | $createRight = $user->rights->fournisseur->facture->creer; |
| 422 | 494 | } |
@@ -489,8 +561,9 @@ discard block |
||
| 489 | 561 | |
| 490 | 562 | $TLineAdded[] = $object->line; |
| 491 | 563 | // Error from addline |
| 492 | - if ($res <= 0) break; |
|
| 493 | - else |
|
| 564 | + if ($res <= 0) { |
|
| 565 | + break; |
|
| 566 | + } else |
|
| 494 | 567 | { |
| 495 | 568 | $object->line_from = $line; |
| 496 | 569 | // Call trigger |
@@ -512,8 +585,7 @@ discard block |
||
| 512 | 585 | _updateLineNC($object->element, $object->id, $line->id, $line->array_options['options_subtotal_nc']); |
| 513 | 586 | } |
| 514 | 587 | return count($TLineAdded); |
| 515 | - } |
|
| 516 | - else |
|
| 588 | + } else |
|
| 517 | 589 | { |
| 518 | 590 | $object->db->rollback(); |
| 519 | 591 | return -1; |
@@ -529,10 +601,14 @@ discard block |
||
| 529 | 601 | global $langs; |
| 530 | 602 | |
| 531 | 603 | // Besoin de comparer sur les 2 formes d'écriture |
| 532 | - if (!$key_is_id) $TTitle_search = array($langs->trans($key_trad), $langs->transnoentitiesnoconv($key_trad)); |
|
| 604 | + if (!$key_is_id) { |
|
| 605 | + $TTitle_search = array($langs->trans($key_trad), $langs->transnoentitiesnoconv($key_trad)); |
|
| 606 | + } |
|
| 533 | 607 | |
| 534 | 608 | $TTitle_under_search = array(); |
| 535 | - if (!empty($under_title)) $TTitle_under_search = array($langs->trans($under_title), $langs->transnoentitiesnoconv($under_title)); |
|
| 609 | + if (!empty($under_title)) { |
|
| 610 | + $TTitle_under_search = array($langs->trans($under_title), $langs->transnoentitiesnoconv($under_title)); |
|
| 611 | + } |
|
| 536 | 612 | |
| 537 | 613 | $TLine = array(); |
| 538 | 614 | $add_line = false; |
@@ -542,28 +618,37 @@ discard block |
||
| 542 | 618 | { |
| 543 | 619 | if (!$under_title_found && !empty($TTitle_under_search)) |
| 544 | 620 | { |
| 545 | - if ($line->product_type == 9 && (in_array($line->desc, $TTitle_under_search) || in_array($line->label, $TTitle_under_search)) ) $under_title_found = true; |
|
| 546 | - } |
|
| 547 | - else |
|
| 621 | + if ($line->product_type == 9 && (in_array($line->desc, $TTitle_under_search) || in_array($line->label, $TTitle_under_search)) ) { |
|
| 622 | + $under_title_found = true; |
|
| 623 | + } |
|
| 624 | + } else |
|
| 548 | 625 | { |
| 549 | 626 | 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) ))) |
| 550 | 627 | { |
| 551 | - if ($key_is_id) $level = $line->qty; |
|
| 628 | + if ($key_is_id) { |
|
| 629 | + $level = $line->qty; |
|
| 630 | + } |
|
| 552 | 631 | |
| 553 | 632 | $add_line = true; |
| 554 | - if ($withBlockLine) $TLine[] = $line; |
|
| 633 | + if ($withBlockLine) { |
|
| 634 | + $TLine[] = $line; |
|
| 635 | + } |
|
| 555 | 636 | continue; |
| 556 | - } |
|
| 557 | - elseif ($add_line && TSubtotal::isModSubtotalLine($line) && TSubtotal::getNiveau($line) == $level) // Si on tombe sur un sous-total, il faut que ce soit un du même niveau que le titre |
|
| 637 | + } elseif ($add_line && TSubtotal::isModSubtotalLine($line) && TSubtotal::getNiveau($line) == $level) { |
|
| 638 | + // Si on tombe sur un sous-total, il faut que ce soit un du même niveau que le titre |
|
| 558 | 639 | { |
| 559 | 640 | if ($withBlockLine) $TLine[] = $line; |
| 641 | + } |
|
| 560 | 642 | break; |
| 561 | 643 | } |
| 562 | 644 | |
| 563 | 645 | if ($add_line) |
| 564 | 646 | { |
| 565 | - if (!$withBlockLine && (self::isTitle($line) || self::isSubtotal($line)) ) continue; |
|
| 566 | - else $TLine[] = $line; |
|
| 647 | + if (!$withBlockLine && (self::isTitle($line) || self::isSubtotal($line)) ) { |
|
| 648 | + continue; |
|
| 649 | + } else { |
|
| 650 | + $TLine[] = $line; |
|
| 651 | + } |
|
| 567 | 652 | } |
| 568 | 653 | } |
| 569 | 654 | } |
@@ -597,7 +682,9 @@ discard block |
||
| 597 | 682 | |
| 598 | 683 | case 'order_supplier': |
| 599 | 684 | $object->special_code = SELF::$module_number; |
| 600 | - if (empty($desc)) $desc = $label; |
|
| 685 | + if (empty($desc)) { |
|
| 686 | + $desc = $label; |
|
| 687 | + } |
|
| 601 | 688 | $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); |
| 602 | 689 | break; |
| 603 | 690 | |
@@ -607,7 +694,9 @@ discard block |
||
| 607 | 694 | |
| 608 | 695 | case 'invoice_supplier': |
| 609 | 696 | $object->special_code = SELF::$module_number; |
| 610 | - if (empty($desc)) $desc = $label; |
|
| 697 | + if (empty($desc)) { |
|
| 698 | + $desc = $label; |
|
| 699 | + } |
|
| 611 | 700 | $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); |
| 612 | 701 | break; |
| 613 | 702 | |
@@ -624,8 +713,11 @@ discard block |
||
| 624 | 713 | break; |
| 625 | 714 | } |
| 626 | 715 | |
| 627 | - if ($res <= 0) $object->db->rollback(); |
|
| 628 | - else $object->db->commit(); |
|
| 716 | + if ($res <= 0) { |
|
| 717 | + $object->db->rollback(); |
|
| 718 | + } else { |
|
| 719 | + $object->db->commit(); |
|
| 720 | + } |
|
| 629 | 721 | |
| 630 | 722 | return $res; |
| 631 | 723 | } |
@@ -635,24 +727,20 @@ discard block |
||
| 635 | 727 | global $db, $object; |
| 636 | 728 | |
| 637 | 729 | $TTitle = array(); |
| 638 | - if(! empty($object->id) && in_array($object->element, array('propal', 'commande', 'facture'))) {} |
|
| 639 | - else { |
|
| 730 | + if(! empty($object->id) && in_array($object->element, array('propal', 'commande', 'facture'))) {} else { |
|
| 640 | 731 | if ($origin_line->element == 'propaldet') |
| 641 | 732 | { |
| 642 | 733 | $object = new Propal($db); |
| 643 | 734 | $object->fetch($origin_line->fk_propal); |
| 644 | - } |
|
| 645 | - else if ($origin_line->element == 'commandedet') |
|
| 735 | + } else if ($origin_line->element == 'commandedet') |
|
| 646 | 736 | { |
| 647 | 737 | $object = new Commande($db); |
| 648 | 738 | $object->fetch($origin_line->fk_commande); |
| 649 | - } |
|
| 650 | - else if ($origin_line->element == 'facturedet') |
|
| 739 | + } else if ($origin_line->element == 'facturedet') |
|
| 651 | 740 | { |
| 652 | 741 | $object = new Facture($db); |
| 653 | 742 | $object->fetch($origin_line->fk_facture); |
| 654 | - } |
|
| 655 | - else |
|
| 743 | + } else |
|
| 656 | 744 | { |
| 657 | 745 | return $TTitle; |
| 658 | 746 | } |
@@ -662,8 +750,11 @@ discard block |
||
| 662 | 750 | $i = 0; |
| 663 | 751 | foreach ($object->lines as &$line) |
| 664 | 752 | { |
| 665 | - if ($origin_line->id == $line->id) break; |
|
| 666 | - else $i++; |
|
| 753 | + if ($origin_line->id == $line->id) { |
|
| 754 | + break; |
|
| 755 | + } else { |
|
| 756 | + $i++; |
|
| 757 | + } |
|
| 667 | 758 | } |
| 668 | 759 | |
| 669 | 760 | $i--; // Skip la ligne d'origine |
@@ -678,35 +769,43 @@ discard block |
||
| 678 | 769 | if (self::isSubtotal($object->lines[$y])) |
| 679 | 770 | { |
| 680 | 771 | $next_title_lvl_to_skip = self::getNiveau($object->lines[$y]); |
| 681 | - } |
|
| 682 | - elseif (self::isTitle($object->lines[$y])) |
|
| 772 | + } elseif (self::isTitle($object->lines[$y])) |
|
| 683 | 773 | { |
| 684 | 774 | if ($object->lines[$y]->qty == $next_title_lvl_to_skip) |
| 685 | 775 | { |
| 686 | 776 | $next_title_lvl_to_skip = 0; |
| 687 | 777 | continue; |
| 688 | - } |
|
| 689 | - else |
|
| 778 | + } else |
|
| 690 | 779 | { |
| 691 | - if (empty($object->lines[$y]->array_options)) $object->lines[$y]->fetch_optionals(); |
|
| 780 | + if (empty($object->lines[$y]->array_options)) { |
|
| 781 | + $object->lines[$y]->fetch_optionals(); |
|
| 782 | + } |
|
| 692 | 783 | $TTitle[$object->lines[$y]->id] = $object->lines[$y]; |
| 693 | 784 | |
| 694 | - if ($object->lines[$y]->qty == 1) break; |
|
| 785 | + if ($object->lines[$y]->qty == 1) { |
|
| 786 | + break; |
|
| 787 | + } |
|
| 695 | 788 | } |
| 696 | 789 | } |
| 697 | 790 | } |
| 698 | 791 | } |
| 699 | 792 | |
| 700 | - if ($reverse) $TTitle = array_reverse($TTitle, true); |
|
| 793 | + if ($reverse) { |
|
| 794 | + $TTitle = array_reverse($TTitle, true); |
|
| 795 | + } |
|
| 701 | 796 | |
| 702 | 797 | return $TTitle; |
| 703 | 798 | } |
| 704 | 799 | |
| 705 | 800 | public static function getNiveau(&$line) |
| 706 | 801 | { |
| 707 | - if (self::isTitle($line)) return $line->qty; |
|
| 708 | - elseif (self::isSubtotal($line)) return 100 - $line->qty; |
|
| 709 | - else return 0; |
|
| 802 | + if (self::isTitle($line)) { |
|
| 803 | + return $line->qty; |
|
| 804 | + } elseif (self::isSubtotal($line)) { |
|
| 805 | + return 100 - $line->qty; |
|
| 806 | + } else { |
|
| 807 | + return 0; |
|
| 808 | + } |
|
| 710 | 809 | } |
| 711 | 810 | |
| 712 | 811 | /** |
@@ -731,10 +830,16 @@ discard block |
||
| 731 | 830 | $objmarge->marge_droite = 10; |
| 732 | 831 | |
| 733 | 832 | $objectref = dol_sanitizeFileName($object->ref); |
| 734 | - if ($object->element == 'propal') $dir = $conf->propal->dir_output . '/' . $objectref; |
|
| 735 | - elseif ($object->element == 'commande') $dir = $conf->commande->dir_output . '/' . $objectref; |
|
| 736 | - elseif ($object->element == 'facture') $dir = $conf->facture->dir_output . '/' . $objectref; |
|
| 737 | - elseif ($object->element == 'facturerec') return; // no PDF for facturerec |
|
| 833 | + if ($object->element == 'propal') { |
|
| 834 | + $dir = $conf->propal->dir_output . '/' . $objectref; |
|
| 835 | + } elseif ($object->element == 'commande') { |
|
| 836 | + $dir = $conf->commande->dir_output . '/' . $objectref; |
|
| 837 | + } elseif ($object->element == 'facture') { |
|
| 838 | + $dir = $conf->facture->dir_output . '/' . $objectref; |
|
| 839 | + } elseif ($object->element == 'facturerec') { |
|
| 840 | + return; |
|
| 841 | + } |
|
| 842 | + // no PDF for facturerec |
|
| 738 | 843 | else |
| 739 | 844 | { |
| 740 | 845 | setEventMessage($langs->trans('warning_subtotal_recap_object_element_unknown', $object->element), 'warnings'); |
@@ -769,7 +874,9 @@ discard block |
||
| 769 | 874 | $pdf->SetCreator("Dolibarr ".DOL_VERSION); |
| 770 | 875 | $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); |
| 771 | 876 | $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("subtotalRecap")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); |
| 772 | - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
| 877 | + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { |
|
| 878 | + $pdf->SetCompression(false); |
|
| 879 | + } |
|
| 773 | 880 | |
| 774 | 881 | $pdf->SetMargins($objmarge->marge_gauche, $objmarge->marge_haute, $objmarge->marge_droite); // Left, Top, Right |
| 775 | 882 | |
@@ -779,7 +886,9 @@ discard block |
||
| 779 | 886 | |
| 780 | 887 | // New page |
| 781 | 888 | $pdf->AddPage(); |
| 782 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 889 | + if (! empty($tplidx)) { |
|
| 890 | + $pdf->useTemplate($tplidx); |
|
| 891 | + } |
|
| 783 | 892 | $pagenb++; |
| 784 | 893 | |
| 785 | 894 | |
@@ -835,8 +944,10 @@ discard block |
||
| 835 | 944 | { |
| 836 | 945 | $TTot['TTotal_tva_multicurrency'][$tx] += $amount; |
| 837 | 946 | } |
| 947 | + } else { |
|
| 948 | + $pdf->SetFont('','', $default_font_size - 1); |
|
| 838 | 949 | } |
| 839 | - else $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage |
|
| 950 | + // Into loop to work with multipage |
|
| 840 | 951 | |
| 841 | 952 | $pdf->SetTextColor(0,0,0); |
| 842 | 953 | |
@@ -858,9 +969,11 @@ discard block |
||
| 858 | 969 | $pdf->startTransaction(); |
| 859 | 970 | $pdf->writeHTMLCell($posx_options-$posx_designation-$decalage, 3, $posx_designation+$decalage, $curY, $outputlangs->convToOutputCharset($label), 0, 1, false, true, 'J',true); |
| 860 | 971 | $pageposafter=$pdf->getPage(); |
| 861 | - if ($pageposafter > $pageposbefore) // There is a pagebreak |
|
| 972 | + if ($pageposafter > $pageposbefore) { |
|
| 973 | + // There is a pagebreak |
|
| 862 | 974 | { |
| 863 | 975 | $pdf->rollbackTransaction(true); |
| 976 | + } |
|
| 864 | 977 | $pageposafter=$pageposbefore; |
| 865 | 978 | //print $pageposafter.'-'.$pageposbefore;exit; |
| 866 | 979 | $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
@@ -869,23 +982,27 @@ discard block |
||
| 869 | 982 | $pageposafter=$pdf->getPage(); |
| 870 | 983 | $posyafter=$pdf->GetY(); |
| 871 | 984 | //var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit; |
| 872 | - if ($posyafter > ($objmarge->page_hauteur - ($heightforfooter+$heightforinfotot))) // There is no space left for total+free text |
|
| 985 | + if ($posyafter > ($objmarge->page_hauteur - ($heightforfooter+$heightforinfotot))) { |
|
| 986 | + // There is no space left for total+free text |
|
| 873 | 987 | { |
| 874 | 988 | if ($i == ($nblignes-1)) // No more lines, and no space left to show total, so we create a new page |
| 875 | 989 | { |
| 876 | 990 | $pdf->AddPage('','',true); |
| 877 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 878 | - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) self::pagehead($objmarge, $pdf, $object, 0, $outputlangs); |
|
| 991 | + } |
|
| 992 | + if (! empty($tplidx)) { |
|
| 993 | + $pdf->useTemplate($tplidx); |
|
| 994 | + } |
|
| 995 | + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { |
|
| 996 | + self::pagehead($objmarge, $pdf, $object, 0, $outputlangs); |
|
| 997 | + } |
|
| 879 | 998 | $pdf->setPage($pageposafter+1); |
| 880 | 999 | } |
| 881 | - } |
|
| 882 | - else |
|
| 1000 | + } else |
|
| 883 | 1001 | { |
| 884 | 1002 | // We found a page break |
| 885 | 1003 | $showpricebeforepagebreak=0; |
| 886 | 1004 | } |
| 887 | - } |
|
| 888 | - else // No pagebreak |
|
| 1005 | + } else // No pagebreak |
|
| 889 | 1006 | { |
| 890 | 1007 | $pdf->commitTransaction(); |
| 891 | 1008 | } |
@@ -925,8 +1042,7 @@ discard block |
||
| 925 | 1042 | if ($pagenb == 1) |
| 926 | 1043 | { |
| 927 | 1044 | 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); |
| 928 | - } |
|
| 929 | - else |
|
| 1045 | + } else |
|
| 930 | 1046 | { |
| 931 | 1047 | 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); |
| 932 | 1048 | } |
@@ -934,7 +1050,9 @@ discard block |
||
| 934 | 1050 | $pagenb++; |
| 935 | 1051 | $pdf->setPage($pagenb); |
| 936 | 1052 | $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
| 937 | - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) self::pagehead($objmarge, $pdf, $object, 0, $outputlangs); |
|
| 1053 | + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { |
|
| 1054 | + self::pagehead($objmarge, $pdf, $object, 0, $outputlangs); |
|
| 1055 | + } |
|
| 938 | 1056 | } |
| 939 | 1057 | } |
| 940 | 1058 | } |
@@ -944,8 +1062,7 @@ discard block |
||
| 944 | 1062 | { |
| 945 | 1063 | 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); |
| 946 | 1064 | $bottomlasttab=$objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1; |
| 947 | - } |
|
| 948 | - else |
|
| 1065 | + } else |
|
| 949 | 1066 | { |
| 950 | 1067 | 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); |
| 951 | 1068 | $bottomlasttab=$objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1; |
@@ -959,7 +1076,9 @@ discard block |
||
| 959 | 1076 | |
| 960 | 1077 | $pagecount = self::concat($outputlangs, array($origin_file, $file), $origin_file); |
| 961 | 1078 | |
| 962 | - if (empty($conf->global->SUBTOTAL_KEEP_RECAP_FILE)) unlink($file); |
|
| 1079 | + if (empty($conf->global->SUBTOTAL_KEEP_RECAP_FILE)) { |
|
| 1080 | + unlink($file); |
|
| 1081 | + } |
|
| 963 | 1082 | } |
| 964 | 1083 | |
| 965 | 1084 | private static function printLevel($objmarge, $pdf, $line, $curY, $posx_designation) |
@@ -1002,8 +1121,7 @@ discard block |
||
| 1002 | 1121 | { |
| 1003 | 1122 | $height=pdf_getHeightForLogo($logo); |
| 1004 | 1123 | $pdf->Image($logo, $objmarge->marge_gauche, $posy, 0, $height); // width=0 (auto) |
| 1005 | - } |
|
| 1006 | - else |
|
| 1124 | + } else |
|
| 1007 | 1125 | { |
| 1008 | 1126 | $pdf->SetTextColor(200,0,0); |
| 1009 | 1127 | $pdf->SetFont('','B',$default_font_size - 2); |
@@ -1012,8 +1130,7 @@ discard block |
||
| 1012 | 1130 | } |
| 1013 | 1131 | |
| 1014 | 1132 | $posy+=35; |
| 1015 | - } |
|
| 1016 | - else |
|
| 1133 | + } else |
|
| 1017 | 1134 | { |
| 1018 | 1135 | $text=$mysoc->name; |
| 1019 | 1136 | $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); |
@@ -1027,9 +1144,13 @@ discard block |
||
| 1027 | 1144 | $pdf->SetXY($objmarge->marge_gauche,$posy); |
| 1028 | 1145 | |
| 1029 | 1146 | $key = 'subtotalPropalTitle'; |
| 1030 | - if ($object->element == 'commande') $key = 'subtotalCommandeTitle'; |
|
| 1031 | - elseif ($object->element == 'facture') $key = 'subtotalInvoiceTitle'; |
|
| 1032 | - elseif ($object->element == 'facturerec') $key = 'subtotalInvoiceTitle'; |
|
| 1147 | + if ($object->element == 'commande') { |
|
| 1148 | + $key = 'subtotalCommandeTitle'; |
|
| 1149 | + } elseif ($object->element == 'facture') { |
|
| 1150 | + $key = 'subtotalInvoiceTitle'; |
|
| 1151 | + } elseif ($object->element == 'facturerec') { |
|
| 1152 | + $key = 'subtotalInvoiceTitle'; |
|
| 1153 | + } |
|
| 1033 | 1154 | |
| 1034 | 1155 | $pdf->MultiCell(150, 4, $outputlangs->transnoentities($key, $object->ref, $object->thirdparty->name), '', 'L'); |
| 1035 | 1156 | |
@@ -1064,7 +1185,9 @@ discard block |
||
| 1064 | 1185 | |
| 1065 | 1186 | // Force to disable hidetop and hidebottom |
| 1066 | 1187 | $hidebottom=0; |
| 1067 | - if ($hidetop) $hidetop=-1; |
|
| 1188 | + if ($hidetop) { |
|
| 1189 | + $hidetop=-1; |
|
| 1190 | + } |
|
| 1068 | 1191 | |
| 1069 | 1192 | $currency = !empty($currency) ? $currency : $conf->currency; |
| 1070 | 1193 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
@@ -1079,7 +1202,9 @@ discard block |
||
| 1079 | 1202 | $pdf->SetXY($objmarge->page_largeur - $objmarge->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4.5); |
| 1080 | 1203 | $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); |
| 1081 | 1204 | |
| 1082 | - 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)); |
|
| 1205 | + if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) { |
|
| 1206 | + $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)); |
|
| 1207 | + } |
|
| 1083 | 1208 | |
| 1084 | 1209 | |
| 1085 | 1210 | $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 |
@@ -1092,8 +1217,7 @@ discard block |
||
| 1092 | 1217 | $pdf->MultiCell($objmarge->page_largeur - $objmarge->marge_droite - $posx_montant,2, $outputlangs->transnoentities("Amount"),'','R'); |
| 1093 | 1218 | |
| 1094 | 1219 | $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 |
| 1095 | - } |
|
| 1096 | - else |
|
| 1220 | + } else |
|
| 1097 | 1221 | { |
| 1098 | 1222 | $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 |
| 1099 | 1223 | } |
@@ -1114,10 +1238,12 @@ discard block |
||
| 1114 | 1238 | |
| 1115 | 1239 | // Tableau total |
| 1116 | 1240 | $col1x = 120; $col2x = 170; |
| 1117 | - if ($objmarge->page_largeur < 210) // To work with US executive format |
|
| 1241 | + if ($objmarge->page_largeur < 210) { |
|
| 1242 | + // To work with US executive format |
|
| 1118 | 1243 | { |
| 1119 | 1244 | $col2x-=20; |
| 1120 | 1245 | } |
| 1246 | + } |
|
| 1121 | 1247 | $largcol2 = ($objmarge->page_largeur - $objmarge->marge_droite - $col2x); |
| 1122 | 1248 | |
| 1123 | 1249 | $useborder=0; |
@@ -1139,9 +1265,11 @@ discard block |
||
| 1139 | 1265 | $atleastoneratenotnull=0; |
| 1140 | 1266 | foreach($TTot['TTotal_tva'] as $tvakey => $tvaval) |
| 1141 | 1267 | { |
| 1142 | - if ($tvakey != 0) // On affiche pas taux 0 |
|
| 1268 | + if ($tvakey != 0) { |
|
| 1269 | + // On affiche pas taux 0 |
|
| 1143 | 1270 | { |
| 1144 | 1271 | $atleastoneratenotnull++; |
| 1272 | + } |
|
| 1145 | 1273 | |
| 1146 | 1274 | $index++; |
| 1147 | 1275 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
@@ -1194,9 +1322,13 @@ discard block |
||
| 1194 | 1322 | */ |
| 1195 | 1323 | private static function printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0) |
| 1196 | 1324 | { |
| 1197 | - if (empty($hidetop) || $hidetop==-1) $pdf->line($x, $y, $x+$l, $y); |
|
| 1325 | + if (empty($hidetop) || $hidetop==-1) { |
|
| 1326 | + $pdf->line($x, $y, $x+$l, $y); |
|
| 1327 | + } |
|
| 1198 | 1328 | $pdf->line($x+$l, $y, $x+$l, $y+$h); |
| 1199 | - if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h); |
|
| 1329 | + if (empty($hidebottom)) { |
|
| 1330 | + $pdf->line($x+$l, $y+$h, $x, $y+$h); |
|
| 1331 | + } |
|
| 1200 | 1332 | $pdf->line($x, $y+$h, $x, $y); |
| 1201 | 1333 | } |
| 1202 | 1334 | |
@@ -1205,7 +1337,9 @@ discard block |
||
| 1205 | 1337 | { |
| 1206 | 1338 | global $conf; |
| 1207 | 1339 | |
| 1208 | - if (empty($fileoutput)) $fileoutput = $file[0]; |
|
| 1340 | + if (empty($fileoutput)) { |
|
| 1341 | + $fileoutput = $file[0]; |
|
| 1342 | + } |
|
| 1209 | 1343 | |
| 1210 | 1344 | $pdf=pdf_getInstance(); |
| 1211 | 1345 | if (class_exists('TCPDF')) |
@@ -1215,7 +1349,9 @@ discard block |
||
| 1215 | 1349 | } |
| 1216 | 1350 | $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
| 1217 | 1351 | |
| 1218 | - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
| 1352 | + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { |
|
| 1353 | + $pdf->SetCompression(false); |
|
| 1354 | + } |
|
| 1219 | 1355 | |
| 1220 | 1356 | |
| 1221 | 1357 | foreach($files as $file) |
@@ -1231,7 +1367,9 @@ discard block |
||
| 1231 | 1367 | } |
| 1232 | 1368 | |
| 1233 | 1369 | $pdf->Output($fileoutput,'F'); |
| 1234 | - if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
| 1370 | + if (! empty($conf->global->MAIN_UMASK)) { |
|
| 1371 | + @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
| 1372 | + } |
|
| 1235 | 1373 | |
| 1236 | 1374 | return $pagecount; |
| 1237 | 1375 | } |
@@ -1244,7 +1382,9 @@ discard block |
||
| 1244 | 1382 | */ |
| 1245 | 1383 | public static function hasNcTitle(&$line) |
| 1246 | 1384 | { |
| 1247 | - if(isset($line->has_nc_title)) return $line->has_nc_title; |
|
| 1385 | + if(isset($line->has_nc_title)) { |
|
| 1386 | + return $line->has_nc_title; |
|
| 1387 | + } |
|
| 1248 | 1388 | |
| 1249 | 1389 | $TTitle = self::getAllTitleFromLine($line); |
| 1250 | 1390 | foreach ($TTitle as &$line_title) |
@@ -1269,7 +1409,9 @@ discard block |
||
| 1269 | 1409 | public static function getTitleLabel($line) |
| 1270 | 1410 | { |
| 1271 | 1411 | $title = $line->label; |
| 1272 | - if (empty($title)) $title = !empty($line->description) ? $line->description : $line->desc; |
|
| 1412 | + if (empty($title)) { |
|
| 1413 | + $title = !empty($line->description) ? $line->description : $line->desc; |
|
| 1414 | + } |
|
| 1273 | 1415 | return $title; |
| 1274 | 1416 | } |
| 1275 | 1417 | } |
@@ -31,182 +31,182 @@ 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.7'; |
|
| 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( |
|
| 100 | - 'invoicecard' |
|
| 101 | - ,'invoicesuppliercard' |
|
| 102 | - ,'propalcard' |
|
| 103 | - ,'supplier_proposalcard' |
|
| 104 | - ,'ordercard' |
|
| 105 | - ,'ordersuppliercard' |
|
| 106 | - ,'odtgeneration' |
|
| 107 | - ,'orderstoinvoice' |
|
| 108 | - ,'admin' |
|
| 109 | - ,'invoicereccard' |
|
| 110 | - ,'consumptionthirdparty' |
|
| 111 | - ) |
|
| 112 | - // Set here all workflow context managed by module |
|
| 113 | - //'workflow' => array('order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE')) |
|
| 114 | - ); |
|
| 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.7'; |
|
| 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( |
|
| 100 | + 'invoicecard' |
|
| 101 | + ,'invoicesuppliercard' |
|
| 102 | + ,'propalcard' |
|
| 103 | + ,'supplier_proposalcard' |
|
| 104 | + ,'ordercard' |
|
| 105 | + ,'ordersuppliercard' |
|
| 106 | + ,'odtgeneration' |
|
| 107 | + ,'orderstoinvoice' |
|
| 108 | + ,'admin' |
|
| 109 | + ,'invoicereccard' |
|
| 110 | + ,'consumptionthirdparty' |
|
| 111 | + ) |
|
| 112 | + // Set here all workflow context managed by module |
|
| 113 | + //'workflow' => array('order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE')) |
|
| 114 | + ); |
|
| 115 | 115 | |
| 116 | - // Data directories to create when module is enabled. |
|
| 117 | - // Example: this->dirs = array("/titre/temp"); |
|
| 118 | - $this->dirs = array(); |
|
| 116 | + // Data directories to create when module is enabled. |
|
| 117 | + // Example: this->dirs = array("/titre/temp"); |
|
| 118 | + $this->dirs = array(); |
|
| 119 | 119 | |
| 120 | - // Config pages. Put here list of php pages |
|
| 121 | - // stored into titre/admin directory, used to setup module. |
|
| 122 | - $this->config_page_url = array("subtotal_setup.php@subtotal"); |
|
| 120 | + // Config pages. Put here list of php pages |
|
| 121 | + // stored into titre/admin directory, used to setup module. |
|
| 122 | + $this->config_page_url = array("subtotal_setup.php@subtotal"); |
|
| 123 | 123 | |
| 124 | - // Dependencies |
|
| 125 | - // List of modules id that must be enabled if this module is enabled |
|
| 126 | - $this->depends = array(); |
|
| 124 | + // Dependencies |
|
| 125 | + // List of modules id that must be enabled if this module is enabled |
|
| 126 | + $this->depends = array(); |
|
| 127 | 127 | |
| 128 | 128 | $this->conflictwith=array('modMilestone'); |
| 129 | - // List of modules id to disable if this one is disabled |
|
| 130 | - $this->requiredby = array(); |
|
| 131 | - // Minimum version of PHP required by module |
|
| 132 | - $this->phpmin = array(5, 3); |
|
| 133 | - // Minimum version of Dolibarr required by module |
|
| 134 | - $this->need_dolibarr_version = array(3, 2); |
|
| 135 | - $this->langfiles = array("subtotal@subtotal"); // langfiles@titre |
|
| 136 | - // Constants |
|
| 137 | - // List of particular constants to add when module is enabled |
|
| 138 | - // (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive) |
|
| 139 | - // Example: |
|
| 140 | - $this->const = array( |
|
| 141 | - 0=>array( |
|
| 142 | - 'SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES', |
|
| 143 | - 'chaine', |
|
| 144 | - 'I', |
|
| 145 | - 'Définit le style (B : gras, I : Italique, U : Souligné) des sous titres lorsque le détail des lignes et des ensembles est caché', |
|
| 146 | - 1 |
|
| 147 | - ) |
|
| 129 | + // List of modules id to disable if this one is disabled |
|
| 130 | + $this->requiredby = array(); |
|
| 131 | + // Minimum version of PHP required by module |
|
| 132 | + $this->phpmin = array(5, 3); |
|
| 133 | + // Minimum version of Dolibarr required by module |
|
| 134 | + $this->need_dolibarr_version = array(3, 2); |
|
| 135 | + $this->langfiles = array("subtotal@subtotal"); // langfiles@titre |
|
| 136 | + // Constants |
|
| 137 | + // List of particular constants to add when module is enabled |
|
| 138 | + // (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive) |
|
| 139 | + // Example: |
|
| 140 | + $this->const = array( |
|
| 141 | + 0=>array( |
|
| 142 | + 'SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES', |
|
| 143 | + 'chaine', |
|
| 144 | + 'I', |
|
| 145 | + 'Définit le style (B : gras, I : Italique, U : Souligné) des sous titres lorsque le détail des lignes et des ensembles est caché', |
|
| 146 | + 1 |
|
| 147 | + ) |
|
| 148 | 148 | ,1=>array('SUBTOTAL_ALLOW_ADD_BLOCK', 'chaine', '1', 'Permet l\'ajout de titres et sous-totaux') |
| 149 | 149 | ,2=>array('SUBTOTAL_ALLOW_EDIT_BLOCK', 'chaine', '1', 'Permet de modifier titres et sous-totaux') |
| 150 | 150 | ,3=>array('SUBTOTAL_ALLOW_REMOVE_BLOCK', 'chaine', '1', 'Permet de supprimer les titres et sous-totaux') |
| 151 | 151 | ,4=>array('SUBTOTAL_TITLE_STYLE', 'chaine', 'BU') |
| 152 | 152 | ,5=>array('SUBTOTAL_SUBTOTAL_STYLE', 'chaine', 'B') |
| 153 | - // 1=>array( |
|
| 154 | - // 'MYMODULE_MYNEWCONST2', |
|
| 155 | - // 'chaine', |
|
| 156 | - // 'myvalue', |
|
| 157 | - // 'This is another constant to add', |
|
| 158 | - // 0 |
|
| 159 | - // ) |
|
| 160 | - ); |
|
| 153 | + // 1=>array( |
|
| 154 | + // 'MYMODULE_MYNEWCONST2', |
|
| 155 | + // 'chaine', |
|
| 156 | + // 'myvalue', |
|
| 157 | + // 'This is another constant to add', |
|
| 158 | + // 0 |
|
| 159 | + // ) |
|
| 160 | + ); |
|
| 161 | 161 | |
| 162 | 162 | |
| 163 | 163 | |
| 164 | 164 | |
| 165 | - // Array to add new pages in new tabs |
|
| 166 | - // Example: |
|
| 167 | - $this->tabs = array( |
|
| 168 | - // // To add a new tab identified by code tabname1 |
|
| 169 | - // 'objecttype:+tabname1:Title1:langfile@titre:$user->rights->titre->read:/titre/mynewtab1.php?id=__ID__', |
|
| 170 | - // // To add another new tab identified by code tabname2 |
|
| 171 | - // 'objecttype:+tabname2:Title2:langfile@titre:$user->rights->othermodule->read:/titre/mynewtab2.php?id=__ID__', |
|
| 172 | - // // To remove an existing tab identified by code tabname |
|
| 173 | - // 'objecttype:-tabname' |
|
| 174 | - ); |
|
| 175 | - // where objecttype can be |
|
| 176 | - // 'thirdparty' to add a tab in third party view |
|
| 177 | - // 'intervention' to add a tab in intervention view |
|
| 178 | - // 'order_supplier' to add a tab in supplier order view |
|
| 179 | - // 'invoice_supplier' to add a tab in supplier invoice view |
|
| 180 | - // 'invoice' to add a tab in customer invoice view |
|
| 181 | - // 'order' to add a tab in customer order view |
|
| 182 | - // 'product' to add a tab in product view |
|
| 183 | - // 'stock' to add a tab in stock view |
|
| 184 | - // 'propal' to add a tab in propal view |
|
| 185 | - // 'member' to add a tab in fundation member view |
|
| 186 | - // 'contract' to add a tab in contract view |
|
| 187 | - // 'user' to add a tab in user view |
|
| 188 | - // 'group' to add a tab in group view |
|
| 189 | - // 'contact' to add a tab in contact view |
|
| 190 | - // 'categories_x' to add a tab in category view |
|
| 191 | - // (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) |
|
| 192 | - // Dictionnaries |
|
| 193 | - if (! isset($conf->subtotal->enabled)) { |
|
| 194 | - $conf->subtotal=new stdClass(); |
|
| 195 | - $conf->subtotal->enabled = 0; |
|
| 196 | - } |
|
| 197 | - $this->dictionaries = array( |
|
| 165 | + // Array to add new pages in new tabs |
|
| 166 | + // Example: |
|
| 167 | + $this->tabs = array( |
|
| 168 | + // // To add a new tab identified by code tabname1 |
|
| 169 | + // 'objecttype:+tabname1:Title1:langfile@titre:$user->rights->titre->read:/titre/mynewtab1.php?id=__ID__', |
|
| 170 | + // // To add another new tab identified by code tabname2 |
|
| 171 | + // 'objecttype:+tabname2:Title2:langfile@titre:$user->rights->othermodule->read:/titre/mynewtab2.php?id=__ID__', |
|
| 172 | + // // To remove an existing tab identified by code tabname |
|
| 173 | + // 'objecttype:-tabname' |
|
| 174 | + ); |
|
| 175 | + // where objecttype can be |
|
| 176 | + // 'thirdparty' to add a tab in third party view |
|
| 177 | + // 'intervention' to add a tab in intervention view |
|
| 178 | + // 'order_supplier' to add a tab in supplier order view |
|
| 179 | + // 'invoice_supplier' to add a tab in supplier invoice view |
|
| 180 | + // 'invoice' to add a tab in customer invoice view |
|
| 181 | + // 'order' to add a tab in customer order view |
|
| 182 | + // 'product' to add a tab in product view |
|
| 183 | + // 'stock' to add a tab in stock view |
|
| 184 | + // 'propal' to add a tab in propal view |
|
| 185 | + // 'member' to add a tab in fundation member view |
|
| 186 | + // 'contract' to add a tab in contract view |
|
| 187 | + // 'user' to add a tab in user view |
|
| 188 | + // 'group' to add a tab in group view |
|
| 189 | + // 'contact' to add a tab in contact view |
|
| 190 | + // 'categories_x' to add a tab in category view |
|
| 191 | + // (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) |
|
| 192 | + // Dictionnaries |
|
| 193 | + if (! isset($conf->subtotal->enabled)) { |
|
| 194 | + $conf->subtotal=new stdClass(); |
|
| 195 | + $conf->subtotal->enabled = 0; |
|
| 196 | + } |
|
| 197 | + $this->dictionaries = array( |
|
| 198 | 198 | 'langs'=>'subtotal@subtotal', |
| 199 | - 'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'), // List of tables we want to see into dictonnary editor |
|
| 200 | - 'tablib'=>array($langs->trans('subtotalFreeLineDictionary')), // Label of tables |
|
| 201 | - '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 |
|
| 202 | - 'tabsqlsort'=>array('label ASC'), // Sort order |
|
| 203 | - 'tabfield'=>array('label,content'), // List of fields (result of select to show dictionary) |
|
| 204 | - 'tabfieldvalue'=>array('label,content'), // List of fields (list of fields to edit a record) |
|
| 205 | - 'tabfieldinsert'=>array('label,content,entity'), // List of fields (list of fields for insert) |
|
| 206 | - 'tabrowid'=>array('rowid'), // Name of columns with primary key (try to always name it 'rowid') |
|
| 207 | - 'tabcond'=>array($conf->subtotal->enabled) |
|
| 199 | + 'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'), // List of tables we want to see into dictonnary editor |
|
| 200 | + 'tablib'=>array($langs->trans('subtotalFreeLineDictionary')), // Label of tables |
|
| 201 | + '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 |
|
| 202 | + 'tabsqlsort'=>array('label ASC'), // Sort order |
|
| 203 | + 'tabfield'=>array('label,content'), // List of fields (result of select to show dictionary) |
|
| 204 | + 'tabfieldvalue'=>array('label,content'), // List of fields (list of fields to edit a record) |
|
| 205 | + 'tabfieldinsert'=>array('label,content,entity'), // List of fields (list of fields for insert) |
|
| 206 | + 'tabrowid'=>array('rowid'), // Name of columns with primary key (try to always name it 'rowid') |
|
| 207 | + 'tabcond'=>array($conf->subtotal->enabled) |
|
| 208 | 208 | ); |
| 209 | - /* Example: |
|
| 209 | + /* Example: |
|
| 210 | 210 | // This is to avoid warnings |
| 211 | 211 | if (! isset($conf->titre->enabled)) $conf->titre->enabled=0; |
| 212 | 212 | $this->dictionnaries=array( |
@@ -247,223 +247,223 @@ discard block |
||
| 247 | 247 | ); |
| 248 | 248 | */ |
| 249 | 249 | |
| 250 | - // Boxes |
|
| 251 | - // Add here list of php file(s) stored in core/boxes that contains class to show a box. |
|
| 252 | - $this->boxes = array(); // Boxes list |
|
| 250 | + // Boxes |
|
| 251 | + // Add here list of php file(s) stored in core/boxes that contains class to show a box. |
|
| 252 | + $this->boxes = array(); // Boxes list |
|
| 253 | 253 | |
| 254 | - /* |
|
| 254 | + /* |
|
| 255 | 255 | $this->boxes[$r][1] = "myboxb.php"; |
| 256 | 256 | $r++; |
| 257 | 257 | */ |
| 258 | 258 | |
| 259 | - // Permissions |
|
| 260 | - $this->rights = array(); // Permission array used by this module |
|
| 261 | - $r = 0; |
|
| 259 | + // Permissions |
|
| 260 | + $this->rights = array(); // Permission array used by this module |
|
| 261 | + $r = 0; |
|
| 262 | 262 | |
| 263 | - // Add here list of permission defined by |
|
| 264 | - // an id, a label, a boolean and two constant strings. |
|
| 265 | - // Example: |
|
| 266 | - //// Permission id (must not be already used) |
|
| 267 | - //$this->rights[$r][0] = 2000; |
|
| 268 | - //// Permission label |
|
| 269 | - //$this->rights[$r][1] = 'Permision label'; |
|
| 270 | - //// Permission by default for new user (0/1) |
|
| 271 | - //$this->rights[$r][3] = 1; |
|
| 272 | - //// In php code, permission will be checked by test |
|
| 273 | - //// if ($user->rights->permkey->level1->level2) |
|
| 274 | - //$this->rights[$r][4] = 'level1'; |
|
| 275 | - //// In php code, permission will be checked by test |
|
| 276 | - //// if ($user->rights->permkey->level1->level2) |
|
| 277 | - //$this->rights[$r][5] = 'level2'; |
|
| 278 | - //$r++; |
|
| 279 | - // Main menu entries |
|
| 280 | - $this->menus = array(); // List of menus to add |
|
| 281 | - $r = 0; |
|
| 263 | + // Add here list of permission defined by |
|
| 264 | + // an id, a label, a boolean and two constant strings. |
|
| 265 | + // Example: |
|
| 266 | + //// Permission id (must not be already used) |
|
| 267 | + //$this->rights[$r][0] = 2000; |
|
| 268 | + //// Permission label |
|
| 269 | + //$this->rights[$r][1] = 'Permision label'; |
|
| 270 | + //// Permission by default for new user (0/1) |
|
| 271 | + //$this->rights[$r][3] = 1; |
|
| 272 | + //// In php code, permission will be checked by test |
|
| 273 | + //// if ($user->rights->permkey->level1->level2) |
|
| 274 | + //$this->rights[$r][4] = 'level1'; |
|
| 275 | + //// In php code, permission will be checked by test |
|
| 276 | + //// if ($user->rights->permkey->level1->level2) |
|
| 277 | + //$this->rights[$r][5] = 'level2'; |
|
| 278 | + //$r++; |
|
| 279 | + // Main menu entries |
|
| 280 | + $this->menus = array(); // List of menus to add |
|
| 281 | + $r = 0; |
|
| 282 | 282 | |
| 283 | - // Add here entries to declare new menus |
|
| 284 | - // |
|
| 285 | - // Example to declare a new Top Menu entry and its Left menu entry: |
|
| 286 | - //$this->menu[$r]=array( |
|
| 287 | - // // Put 0 if this is a top menu |
|
| 288 | - // 'fk_menu'=>0, |
|
| 289 | - // // This is a Top menu entry |
|
| 290 | - // 'type'=>'top', |
|
| 291 | - // 'titre'=>'titre top menu', |
|
| 292 | - // 'mainmenu'=>'titre', |
|
| 293 | - // 'leftmenu'=>'titre', |
|
| 294 | - // 'url'=>'/titre/pagetop.php', |
|
| 295 | - // // Lang file to use (without .lang) by module. |
|
| 296 | - // // File must be in langs/code_CODE/ directory. |
|
| 297 | - // 'langs'=>'mylangfile', |
|
| 298 | - // 'position'=>100, |
|
| 299 | - // // Define condition to show or hide menu entry. |
|
| 300 | - // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
| 301 | - // 'enabled'=>'$conf->titre->enabled', |
|
| 302 | - // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
| 303 | - // // if you want your menu with a permission rules |
|
| 304 | - // 'perms'=>'1', |
|
| 305 | - // 'target'=>'', |
|
| 306 | - // // 0=Menu for internal users, 1=external users, 2=both |
|
| 307 | - // 'user'=>2 |
|
| 308 | - //); |
|
| 309 | - //$r++; |
|
| 310 | - //$this->menu[$r]=array( |
|
| 311 | - // // Use r=value where r is index key used for the parent menu entry |
|
| 312 | - // // (higher parent must be a top menu entry) |
|
| 313 | - // 'fk_menu'=>'r=0', |
|
| 314 | - // // This is a Left menu entry |
|
| 315 | - // 'type'=>'left', |
|
| 316 | - // 'titre'=>'titre left menu', |
|
| 317 | - // 'mainmenu'=>'titre', |
|
| 318 | - // 'leftmenu'=>'titre', |
|
| 319 | - // 'url'=>'/titre/pagelevel1.php', |
|
| 320 | - // // Lang file to use (without .lang) by module. |
|
| 321 | - // // File must be in langs/code_CODE/ directory. |
|
| 322 | - // 'langs'=>'mylangfile', |
|
| 323 | - // 'position'=>100, |
|
| 324 | - // // Define condition to show or hide menu entry. |
|
| 325 | - // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
| 326 | - // 'enabled'=>'$conf->titre->enabled', |
|
| 327 | - // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
| 328 | - // // if you want your menu with a permission rules |
|
| 329 | - // 'perms'=>'1', |
|
| 330 | - // 'target'=>'', |
|
| 331 | - // // 0=Menu for internal users, 1=external users, 2=both |
|
| 332 | - // 'user'=>2 |
|
| 333 | - //); |
|
| 334 | - //$r++; |
|
| 335 | - // |
|
| 336 | - // Example to declare a Left Menu entry into an existing Top menu entry: |
|
| 337 | - //$this->menu[$r]=array( |
|
| 338 | - // // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' |
|
| 339 | - // 'fk_menu'=>'fk_mainmenu=mainmenucode', |
|
| 340 | - // // This is a Left menu entry |
|
| 341 | - // 'type'=>'left', |
|
| 342 | - // 'titre'=>'titre left menu', |
|
| 343 | - // 'mainmenu'=>'mainmenucode', |
|
| 344 | - // 'leftmenu'=>'titre', |
|
| 345 | - // 'url'=>'/titre/pagelevel2.php', |
|
| 346 | - // // Lang file to use (without .lang) by module. |
|
| 347 | - // // File must be in langs/code_CODE/ directory. |
|
| 348 | - // 'langs'=>'mylangfile', |
|
| 349 | - // 'position'=>100, |
|
| 350 | - // // Define condition to show or hide menu entry. |
|
| 351 | - // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
| 352 | - // // Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
| 353 | - // 'enabled'=>'$conf->titre->enabled', |
|
| 354 | - // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
| 355 | - // // if you want your menu with a permission rules |
|
| 356 | - // 'perms'=>'1', |
|
| 357 | - // 'target'=>'', |
|
| 358 | - // // 0=Menu for internal users, 1=external users, 2=both |
|
| 359 | - // 'user'=>2 |
|
| 360 | - //); |
|
| 361 | - //$r++; |
|
| 362 | - // Exports |
|
| 363 | - $r = 1; |
|
| 283 | + // Add here entries to declare new menus |
|
| 284 | + // |
|
| 285 | + // Example to declare a new Top Menu entry and its Left menu entry: |
|
| 286 | + //$this->menu[$r]=array( |
|
| 287 | + // // Put 0 if this is a top menu |
|
| 288 | + // 'fk_menu'=>0, |
|
| 289 | + // // This is a Top menu entry |
|
| 290 | + // 'type'=>'top', |
|
| 291 | + // 'titre'=>'titre top menu', |
|
| 292 | + // 'mainmenu'=>'titre', |
|
| 293 | + // 'leftmenu'=>'titre', |
|
| 294 | + // 'url'=>'/titre/pagetop.php', |
|
| 295 | + // // Lang file to use (without .lang) by module. |
|
| 296 | + // // File must be in langs/code_CODE/ directory. |
|
| 297 | + // 'langs'=>'mylangfile', |
|
| 298 | + // 'position'=>100, |
|
| 299 | + // // Define condition to show or hide menu entry. |
|
| 300 | + // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
| 301 | + // 'enabled'=>'$conf->titre->enabled', |
|
| 302 | + // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
| 303 | + // // if you want your menu with a permission rules |
|
| 304 | + // 'perms'=>'1', |
|
| 305 | + // 'target'=>'', |
|
| 306 | + // // 0=Menu for internal users, 1=external users, 2=both |
|
| 307 | + // 'user'=>2 |
|
| 308 | + //); |
|
| 309 | + //$r++; |
|
| 310 | + //$this->menu[$r]=array( |
|
| 311 | + // // Use r=value where r is index key used for the parent menu entry |
|
| 312 | + // // (higher parent must be a top menu entry) |
|
| 313 | + // 'fk_menu'=>'r=0', |
|
| 314 | + // // This is a Left menu entry |
|
| 315 | + // 'type'=>'left', |
|
| 316 | + // 'titre'=>'titre left menu', |
|
| 317 | + // 'mainmenu'=>'titre', |
|
| 318 | + // 'leftmenu'=>'titre', |
|
| 319 | + // 'url'=>'/titre/pagelevel1.php', |
|
| 320 | + // // Lang file to use (without .lang) by module. |
|
| 321 | + // // File must be in langs/code_CODE/ directory. |
|
| 322 | + // 'langs'=>'mylangfile', |
|
| 323 | + // 'position'=>100, |
|
| 324 | + // // Define condition to show or hide menu entry. |
|
| 325 | + // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
| 326 | + // 'enabled'=>'$conf->titre->enabled', |
|
| 327 | + // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
| 328 | + // // if you want your menu with a permission rules |
|
| 329 | + // 'perms'=>'1', |
|
| 330 | + // 'target'=>'', |
|
| 331 | + // // 0=Menu for internal users, 1=external users, 2=both |
|
| 332 | + // 'user'=>2 |
|
| 333 | + //); |
|
| 334 | + //$r++; |
|
| 335 | + // |
|
| 336 | + // Example to declare a Left Menu entry into an existing Top menu entry: |
|
| 337 | + //$this->menu[$r]=array( |
|
| 338 | + // // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' |
|
| 339 | + // 'fk_menu'=>'fk_mainmenu=mainmenucode', |
|
| 340 | + // // This is a Left menu entry |
|
| 341 | + // 'type'=>'left', |
|
| 342 | + // 'titre'=>'titre left menu', |
|
| 343 | + // 'mainmenu'=>'mainmenucode', |
|
| 344 | + // 'leftmenu'=>'titre', |
|
| 345 | + // 'url'=>'/titre/pagelevel2.php', |
|
| 346 | + // // Lang file to use (without .lang) by module. |
|
| 347 | + // // File must be in langs/code_CODE/ directory. |
|
| 348 | + // 'langs'=>'mylangfile', |
|
| 349 | + // 'position'=>100, |
|
| 350 | + // // Define condition to show or hide menu entry. |
|
| 351 | + // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
| 352 | + // // Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
| 353 | + // 'enabled'=>'$conf->titre->enabled', |
|
| 354 | + // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
| 355 | + // // if you want your menu with a permission rules |
|
| 356 | + // 'perms'=>'1', |
|
| 357 | + // 'target'=>'', |
|
| 358 | + // // 0=Menu for internal users, 1=external users, 2=both |
|
| 359 | + // 'user'=>2 |
|
| 360 | + //); |
|
| 361 | + //$r++; |
|
| 362 | + // Exports |
|
| 363 | + $r = 1; |
|
| 364 | 364 | |
| 365 | - // Example: |
|
| 366 | - //$this->export_code[$r]=$this->rights_class.'_'.$r; |
|
| 367 | - //// Translation key (used only if key ExportDataset_xxx_z not found) |
|
| 368 | - //$this->export_label[$r]='CustomersInvoicesAndInvoiceLines'; |
|
| 369 | - //// Condition to show export in list (ie: '$user->id==3'). |
|
| 370 | - //// Set to 1 to always show when module is enabled. |
|
| 371 | - //$this->export_enabled[$r]='1'; |
|
| 372 | - //$this->export_permission[$r]=array(array("facture","facture","export")); |
|
| 373 | - //$this->export_fields_array[$r]=array( |
|
| 374 | - // 's.rowid'=>"IdCompany", |
|
| 375 | - // 's.nom'=>'CompanyName', |
|
| 376 | - // 's.address'=>'Address', |
|
| 377 | - // 's.cp'=>'Zip', |
|
| 378 | - // 's.ville'=>'Town', |
|
| 379 | - // 's.fk_pays'=>'Country', |
|
| 380 | - // 's.tel'=>'Phone', |
|
| 381 | - // 's.siren'=>'ProfId1', |
|
| 382 | - // 's.siret'=>'ProfId2', |
|
| 383 | - // 's.ape'=>'ProfId3', |
|
| 384 | - // 's.idprof4'=>'ProfId4', |
|
| 385 | - // 's.code_compta'=>'CustomerAccountancyCode', |
|
| 386 | - // 's.code_compta_fournisseur'=>'SupplierAccountancyCode', |
|
| 387 | - // 'f.rowid'=>"InvoiceId", |
|
| 388 | - // 'f.facnumber'=>"InvoiceRef", |
|
| 389 | - // 'f.datec'=>"InvoiceDateCreation", |
|
| 390 | - // 'f.datef'=>"DateInvoice", |
|
| 391 | - // 'f.total'=>"TotalHT", |
|
| 392 | - // 'f.total_ttc'=>"TotalTTC", |
|
| 393 | - // 'f.tva'=>"TotalVAT", |
|
| 394 | - // 'f.paye'=>"InvoicePaid", |
|
| 395 | - // 'f.fk_statut'=>'InvoiceStatus', |
|
| 396 | - // 'f.note'=>"InvoiceNote", |
|
| 397 | - // 'fd.rowid'=>'LineId', |
|
| 398 | - // 'fd.description'=>"LineDescription", |
|
| 399 | - // 'fd.price'=>"LineUnitPrice", |
|
| 400 | - // 'fd.tva_tx'=>"LineVATRate", |
|
| 401 | - // 'fd.qty'=>"LineQty", |
|
| 402 | - // 'fd.total_ht'=>"LineTotalHT", |
|
| 403 | - // 'fd.total_tva'=>"LineTotalTVA", |
|
| 404 | - // 'fd.total_ttc'=>"LineTotalTTC", |
|
| 405 | - // 'fd.date_start'=>"DateStart", |
|
| 406 | - // 'fd.date_end'=>"DateEnd", |
|
| 407 | - // 'fd.fk_product'=>'ProductId', |
|
| 408 | - // 'p.ref'=>'ProductRef' |
|
| 409 | - //); |
|
| 410 | - //$this->export_entities_array[$r]=array('s.rowid'=>"company", |
|
| 411 | - // 's.nom'=>'company', |
|
| 412 | - // 's.address'=>'company', |
|
| 413 | - // 's.cp'=>'company', |
|
| 414 | - // 's.ville'=>'company', |
|
| 415 | - // 's.fk_pays'=>'company', |
|
| 416 | - // 's.tel'=>'company', |
|
| 417 | - // 's.siren'=>'company', |
|
| 418 | - // 's.siret'=>'company', |
|
| 419 | - // 's.ape'=>'company', |
|
| 420 | - // 's.idprof4'=>'company', |
|
| 421 | - // 's.code_compta'=>'company', |
|
| 422 | - // 's.code_compta_fournisseur'=>'company', |
|
| 423 | - // 'f.rowid'=>"invoice", |
|
| 424 | - // 'f.facnumber'=>"invoice", |
|
| 425 | - // 'f.datec'=>"invoice", |
|
| 426 | - // 'f.datef'=>"invoice", |
|
| 427 | - // 'f.total'=>"invoice", |
|
| 428 | - // 'f.total_ttc'=>"invoice", |
|
| 429 | - // 'f.tva'=>"invoice", |
|
| 430 | - // 'f.paye'=>"invoice", |
|
| 431 | - // 'f.fk_statut'=>'invoice', |
|
| 432 | - // 'f.note'=>"invoice", |
|
| 433 | - // 'fd.rowid'=>'invoice_line', |
|
| 434 | - // 'fd.description'=>"invoice_line", |
|
| 435 | - // 'fd.price'=>"invoice_line", |
|
| 436 | - // 'fd.total_ht'=>"invoice_line", |
|
| 437 | - // 'fd.total_tva'=>"invoice_line", |
|
| 438 | - // 'fd.total_ttc'=>"invoice_line", |
|
| 439 | - // 'fd.tva_tx'=>"invoice_line", |
|
| 440 | - // 'fd.qty'=>"invoice_line", |
|
| 441 | - // 'fd.date_start'=>"invoice_line", |
|
| 442 | - // 'fd.date_end'=>"invoice_line", |
|
| 443 | - // 'fd.fk_product'=>'product', |
|
| 444 | - // 'p.ref'=>'product' |
|
| 445 | - //); |
|
| 446 | - //$this->export_sql_start[$r] = 'SELECT DISTINCT '; |
|
| 447 | - //$this->export_sql_end[$r] = ' FROM (' . MAIN_DB_PREFIX . 'facture as f, ' |
|
| 448 | - // . MAIN_DB_PREFIX . 'facturedet as fd, ' . MAIN_DB_PREFIX . 'societe as s)'; |
|
| 449 | - //$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX |
|
| 450 | - // . 'product as p on (fd.fk_product = p.rowid)'; |
|
| 451 | - //$this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid ' |
|
| 452 | - // . 'AND f.rowid = fd.fk_facture'; |
|
| 453 | - //$r++; |
|
| 454 | - } |
|
| 365 | + // Example: |
|
| 366 | + //$this->export_code[$r]=$this->rights_class.'_'.$r; |
|
| 367 | + //// Translation key (used only if key ExportDataset_xxx_z not found) |
|
| 368 | + //$this->export_label[$r]='CustomersInvoicesAndInvoiceLines'; |
|
| 369 | + //// Condition to show export in list (ie: '$user->id==3'). |
|
| 370 | + //// Set to 1 to always show when module is enabled. |
|
| 371 | + //$this->export_enabled[$r]='1'; |
|
| 372 | + //$this->export_permission[$r]=array(array("facture","facture","export")); |
|
| 373 | + //$this->export_fields_array[$r]=array( |
|
| 374 | + // 's.rowid'=>"IdCompany", |
|
| 375 | + // 's.nom'=>'CompanyName', |
|
| 376 | + // 's.address'=>'Address', |
|
| 377 | + // 's.cp'=>'Zip', |
|
| 378 | + // 's.ville'=>'Town', |
|
| 379 | + // 's.fk_pays'=>'Country', |
|
| 380 | + // 's.tel'=>'Phone', |
|
| 381 | + // 's.siren'=>'ProfId1', |
|
| 382 | + // 's.siret'=>'ProfId2', |
|
| 383 | + // 's.ape'=>'ProfId3', |
|
| 384 | + // 's.idprof4'=>'ProfId4', |
|
| 385 | + // 's.code_compta'=>'CustomerAccountancyCode', |
|
| 386 | + // 's.code_compta_fournisseur'=>'SupplierAccountancyCode', |
|
| 387 | + // 'f.rowid'=>"InvoiceId", |
|
| 388 | + // 'f.facnumber'=>"InvoiceRef", |
|
| 389 | + // 'f.datec'=>"InvoiceDateCreation", |
|
| 390 | + // 'f.datef'=>"DateInvoice", |
|
| 391 | + // 'f.total'=>"TotalHT", |
|
| 392 | + // 'f.total_ttc'=>"TotalTTC", |
|
| 393 | + // 'f.tva'=>"TotalVAT", |
|
| 394 | + // 'f.paye'=>"InvoicePaid", |
|
| 395 | + // 'f.fk_statut'=>'InvoiceStatus', |
|
| 396 | + // 'f.note'=>"InvoiceNote", |
|
| 397 | + // 'fd.rowid'=>'LineId', |
|
| 398 | + // 'fd.description'=>"LineDescription", |
|
| 399 | + // 'fd.price'=>"LineUnitPrice", |
|
| 400 | + // 'fd.tva_tx'=>"LineVATRate", |
|
| 401 | + // 'fd.qty'=>"LineQty", |
|
| 402 | + // 'fd.total_ht'=>"LineTotalHT", |
|
| 403 | + // 'fd.total_tva'=>"LineTotalTVA", |
|
| 404 | + // 'fd.total_ttc'=>"LineTotalTTC", |
|
| 405 | + // 'fd.date_start'=>"DateStart", |
|
| 406 | + // 'fd.date_end'=>"DateEnd", |
|
| 407 | + // 'fd.fk_product'=>'ProductId', |
|
| 408 | + // 'p.ref'=>'ProductRef' |
|
| 409 | + //); |
|
| 410 | + //$this->export_entities_array[$r]=array('s.rowid'=>"company", |
|
| 411 | + // 's.nom'=>'company', |
|
| 412 | + // 's.address'=>'company', |
|
| 413 | + // 's.cp'=>'company', |
|
| 414 | + // 's.ville'=>'company', |
|
| 415 | + // 's.fk_pays'=>'company', |
|
| 416 | + // 's.tel'=>'company', |
|
| 417 | + // 's.siren'=>'company', |
|
| 418 | + // 's.siret'=>'company', |
|
| 419 | + // 's.ape'=>'company', |
|
| 420 | + // 's.idprof4'=>'company', |
|
| 421 | + // 's.code_compta'=>'company', |
|
| 422 | + // 's.code_compta_fournisseur'=>'company', |
|
| 423 | + // 'f.rowid'=>"invoice", |
|
| 424 | + // 'f.facnumber'=>"invoice", |
|
| 425 | + // 'f.datec'=>"invoice", |
|
| 426 | + // 'f.datef'=>"invoice", |
|
| 427 | + // 'f.total'=>"invoice", |
|
| 428 | + // 'f.total_ttc'=>"invoice", |
|
| 429 | + // 'f.tva'=>"invoice", |
|
| 430 | + // 'f.paye'=>"invoice", |
|
| 431 | + // 'f.fk_statut'=>'invoice', |
|
| 432 | + // 'f.note'=>"invoice", |
|
| 433 | + // 'fd.rowid'=>'invoice_line', |
|
| 434 | + // 'fd.description'=>"invoice_line", |
|
| 435 | + // 'fd.price'=>"invoice_line", |
|
| 436 | + // 'fd.total_ht'=>"invoice_line", |
|
| 437 | + // 'fd.total_tva'=>"invoice_line", |
|
| 438 | + // 'fd.total_ttc'=>"invoice_line", |
|
| 439 | + // 'fd.tva_tx'=>"invoice_line", |
|
| 440 | + // 'fd.qty'=>"invoice_line", |
|
| 441 | + // 'fd.date_start'=>"invoice_line", |
|
| 442 | + // 'fd.date_end'=>"invoice_line", |
|
| 443 | + // 'fd.fk_product'=>'product', |
|
| 444 | + // 'p.ref'=>'product' |
|
| 445 | + //); |
|
| 446 | + //$this->export_sql_start[$r] = 'SELECT DISTINCT '; |
|
| 447 | + //$this->export_sql_end[$r] = ' FROM (' . MAIN_DB_PREFIX . 'facture as f, ' |
|
| 448 | + // . MAIN_DB_PREFIX . 'facturedet as fd, ' . MAIN_DB_PREFIX . 'societe as s)'; |
|
| 449 | + //$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX |
|
| 450 | + // . 'product as p on (fd.fk_product = p.rowid)'; |
|
| 451 | + //$this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid ' |
|
| 452 | + // . 'AND f.rowid = fd.fk_facture'; |
|
| 453 | + //$r++; |
|
| 454 | + } |
|
| 455 | 455 | |
| 456 | - /** |
|
| 457 | - * Function called when module is enabled. |
|
| 458 | - * The init function add constants, boxes, permissions and menus |
|
| 459 | - * (defined in constructor) into Dolibarr database. |
|
| 460 | - * It also creates data directories |
|
| 461 | - * |
|
| 462 | - * @param string $options Options when enabling module ('', 'noboxes') |
|
| 463 | - * @return int 1 if OK, 0 if KO |
|
| 464 | - */ |
|
| 465 | - public function init($options = '') |
|
| 466 | - { |
|
| 456 | + /** |
|
| 457 | + * Function called when module is enabled. |
|
| 458 | + * The init function add constants, boxes, permissions and menus |
|
| 459 | + * (defined in constructor) into Dolibarr database. |
|
| 460 | + * It also creates data directories |
|
| 461 | + * |
|
| 462 | + * @param string $options Options when enabling module ('', 'noboxes') |
|
| 463 | + * @return int 1 if OK, 0 if KO |
|
| 464 | + */ |
|
| 465 | + public function init($options = '') |
|
| 466 | + { |
|
| 467 | 467 | global $conf, $db; |
| 468 | 468 | |
| 469 | 469 | |
@@ -471,46 +471,46 @@ discard block |
||
| 471 | 471 | exit("Attention, ce module rentre ne conflit avec le module Jalon/Milestones. Merci de le désactiver auparavant."); |
| 472 | 472 | } |
| 473 | 473 | */ |
| 474 | - $sql = array(); |
|
| 474 | + $sql = array(); |
|
| 475 | 475 | |
| 476 | - $result = $this->loadTables(); |
|
| 477 | - dol_include_once('/core/class/extrafields.class.php'); |
|
| 476 | + $result = $this->loadTables(); |
|
| 477 | + dol_include_once('/core/class/extrafields.class.php'); |
|
| 478 | 478 | |
| 479 | - $extra = new ExtraFields($db); // propaldet, commandedet, facturedet |
|
| 480 | - $TElementType = array('propaldet', 'commandedet', 'facturedet', 'supplier_proposaldet', 'commande_fournisseurdet', 'facture_fourn_det'); |
|
| 481 | - foreach($TElementType as $element_type) { |
|
| 482 | - $extra->addExtraField('show_total_ht', 'Afficher le Total HT sur le sous-total', 'int', 0, 10, $element_type, 0, 0, '', unserialize('a:1:{s:7:"options";a:1:{s:0:"";N;}}'), 0, '', 0, 1); |
|
| 483 | - $extra->addExtraField('show_reduc', 'Afficher la réduction sur le sous-total', 'int', 0, 10, $element_type, 0, 0, '', unserialize('a:1:{s:7:"options";a:1:{s:0:"";N;}}'), 0, '', 0, 1); |
|
| 484 | - } |
|
| 479 | + $extra = new ExtraFields($db); // propaldet, commandedet, facturedet |
|
| 480 | + $TElementType = array('propaldet', 'commandedet', 'facturedet', 'supplier_proposaldet', 'commande_fournisseurdet', 'facture_fourn_det'); |
|
| 481 | + foreach($TElementType as $element_type) { |
|
| 482 | + $extra->addExtraField('show_total_ht', 'Afficher le Total HT sur le sous-total', 'int', 0, 10, $element_type, 0, 0, '', unserialize('a:1:{s:7:"options";a:1:{s:0:"";N;}}'), 0, '', 0, 1); |
|
| 483 | + $extra->addExtraField('show_reduc', 'Afficher la réduction sur le sous-total', 'int', 0, 10, $element_type, 0, 0, '', unserialize('a:1:{s:7:"options";a:1:{s:0:"";N;}}'), 0, '', 0, 1); |
|
| 484 | + } |
|
| 485 | 485 | |
| 486 | - return $this->_init($sql, $options); |
|
| 487 | - } |
|
| 486 | + return $this->_init($sql, $options); |
|
| 487 | + } |
|
| 488 | 488 | |
| 489 | - /** |
|
| 490 | - * Function called when module is disabled. |
|
| 491 | - * Remove from database constants, boxes and permissions from Dolibarr database. |
|
| 492 | - * Data directories are not deleted |
|
| 493 | - * |
|
| 494 | - * @param string $options Options when enabling module ('', 'noboxes') |
|
| 495 | - * @return int 1 if OK, 0 if KO |
|
| 496 | - */ |
|
| 497 | - public function remove($options = '') |
|
| 498 | - { |
|
| 499 | - $sql = array(); |
|
| 489 | + /** |
|
| 490 | + * Function called when module is disabled. |
|
| 491 | + * Remove from database constants, boxes and permissions from Dolibarr database. |
|
| 492 | + * Data directories are not deleted |
|
| 493 | + * |
|
| 494 | + * @param string $options Options when enabling module ('', 'noboxes') |
|
| 495 | + * @return int 1 if OK, 0 if KO |
|
| 496 | + */ |
|
| 497 | + public function remove($options = '') |
|
| 498 | + { |
|
| 499 | + $sql = array(); |
|
| 500 | 500 | |
| 501 | - return $this->_remove($sql, $options); |
|
| 502 | - } |
|
| 501 | + return $this->_remove($sql, $options); |
|
| 502 | + } |
|
| 503 | 503 | |
| 504 | - /** |
|
| 505 | - * Create tables, keys and data required by module |
|
| 506 | - * Files llx_table1.sql, llx_table1.key.sql llx_data.sql with create table, create keys |
|
| 507 | - * and create data commands must be stored in directory /titre/sql/ |
|
| 508 | - * This function is called by this->init |
|
| 509 | - * |
|
| 510 | - * @return int <=0 if KO, >0 if OK |
|
| 511 | - */ |
|
| 512 | - private function loadTables() |
|
| 513 | - { |
|
| 514 | - return $this->_load_tables('/subtotal/sql/'); |
|
| 515 | - } |
|
| 504 | + /** |
|
| 505 | + * Create tables, keys and data required by module |
|
| 506 | + * Files llx_table1.sql, llx_table1.key.sql llx_data.sql with create table, create keys |
|
| 507 | + * and create data commands must be stored in directory /titre/sql/ |
|
| 508 | + * This function is called by this->init |
|
| 509 | + * |
|
| 510 | + * @return int <=0 if KO, >0 if OK |
|
| 511 | + */ |
|
| 512 | + private function loadTables() |
|
| 513 | + { |
|
| 514 | + return $this->_load_tables('/subtotal/sql/'); |
|
| 515 | + } |
|
| 516 | 516 | } |
@@ -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.7'; |
| 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; |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | // List of modules id that must be enabled if this module is enabled |
| 126 | 126 | $this->depends = array(); |
| 127 | 127 | |
| 128 | - $this->conflictwith=array('modMilestone'); |
|
| 128 | + $this->conflictwith = array('modMilestone'); |
|
| 129 | 129 | // List of modules id to disable if this one is disabled |
| 130 | 130 | $this->requiredby = array(); |
| 131 | 131 | // Minimum version of PHP required by module |
@@ -190,20 +190,20 @@ discard block |
||
| 190 | 190 | // 'categories_x' to add a tab in category view |
| 191 | 191 | // (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) |
| 192 | 192 | // Dictionnaries |
| 193 | - if (! isset($conf->subtotal->enabled)) { |
|
| 194 | - $conf->subtotal=new stdClass(); |
|
| 193 | + if (!isset($conf->subtotal->enabled)) { |
|
| 194 | + $conf->subtotal = new stdClass(); |
|
| 195 | 195 | $conf->subtotal->enabled = 0; |
| 196 | 196 | } |
| 197 | 197 | $this->dictionaries = array( |
| 198 | 198 | 'langs'=>'subtotal@subtotal', |
| 199 | - 'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'), // List of tables we want to see into dictonnary editor |
|
| 200 | - 'tablib'=>array($langs->trans('subtotalFreeLineDictionary')), // Label of tables |
|
| 201 | - '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 |
|
| 202 | - 'tabsqlsort'=>array('label ASC'), // Sort order |
|
| 203 | - 'tabfield'=>array('label,content'), // List of fields (result of select to show dictionary) |
|
| 204 | - 'tabfieldvalue'=>array('label,content'), // List of fields (list of fields to edit a record) |
|
| 205 | - 'tabfieldinsert'=>array('label,content,entity'), // List of fields (list of fields for insert) |
|
| 206 | - 'tabrowid'=>array('rowid'), // Name of columns with primary key (try to always name it 'rowid') |
|
| 199 | + 'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'), // List of tables we want to see into dictonnary editor |
|
| 200 | + 'tablib'=>array($langs->trans('subtotalFreeLineDictionary')), // Label of tables |
|
| 201 | + '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 |
|
| 202 | + 'tabsqlsort'=>array('label ASC'), // Sort order |
|
| 203 | + 'tabfield'=>array('label,content'), // List of fields (result of select to show dictionary) |
|
| 204 | + 'tabfieldvalue'=>array('label,content'), // List of fields (list of fields to edit a record) |
|
| 205 | + 'tabfieldinsert'=>array('label,content,entity'), // List of fields (list of fields for insert) |
|
| 206 | + 'tabrowid'=>array('rowid'), // Name of columns with primary key (try to always name it 'rowid') |
|
| 207 | 207 | 'tabcond'=>array($conf->subtotal->enabled) |
| 208 | 208 | ); |
| 209 | 209 | /* Example: |
@@ -478,7 +478,7 @@ discard block |
||
| 478 | 478 | |
| 479 | 479 | $extra = new ExtraFields($db); // propaldet, commandedet, facturedet |
| 480 | 480 | $TElementType = array('propaldet', 'commandedet', 'facturedet', 'supplier_proposaldet', 'commande_fournisseurdet', 'facture_fourn_det'); |
| 481 | - foreach($TElementType as $element_type) { |
|
| 481 | + foreach ($TElementType as $element_type) { |
|
| 482 | 482 | $extra->addExtraField('show_total_ht', 'Afficher le Total HT sur le sous-total', 'int', 0, 10, $element_type, 0, 0, '', unserialize('a:1:{s:7:"options";a:1:{s:0:"";N;}}'), 0, '', 0, 1); |
| 483 | 483 | $extra->addExtraField('show_reduc', 'Afficher la réduction sur le sous-total', 'int', 0, 10, $element_type, 0, 0, '', unserialize('a:1:{s:7:"options";a:1:{s:0:"";N;}}'), 0, '', 0, 1); |
| 484 | 484 | } |