@@ -45,7 +45,9 @@ discard block |
||
| 45 | 45 | $value = ''; |
| 46 | 46 | $sql = 'SELECT content FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text WHERE rowid = '.GETPOST('rowid'); |
| 47 | 47 | $resql = $this->db->query($sql); |
| 48 | - if ($resql && ($obj = $this->db->fetch_object($resql))) $value = $obj->content; |
|
| 48 | + if ($resql && ($obj = $this->db->fetch_object($resql))) { |
|
| 49 | + $value = $obj->content; |
|
| 50 | + } |
|
| 49 | 51 | } |
| 50 | 52 | |
| 51 | 53 | ?> |
@@ -124,8 +126,7 @@ discard block |
||
| 124 | 126 | } elseif($object->element == 'invoice_supplier' ) |
| 125 | 127 | { |
| 126 | 128 | $createRight = $user->rights->fournisseur->facture->creer; |
| 127 | - } |
|
| 128 | - elseif($object->element == 'shipping') |
|
| 129 | + } elseif($object->element == 'shipping') |
|
| 129 | 130 | { |
| 130 | 131 | $createRight = true; // No rights management for shipments |
| 131 | 132 | } |
@@ -133,8 +134,11 @@ discard block |
||
| 133 | 134 | if ($object->statut == 0 && $createRight) { |
| 134 | 135 | |
| 135 | 136 | |
| 136 | - if($object->element=='facture')$idvar = 'facid'; |
|
| 137 | - else $idvar='id'; |
|
| 137 | + if($object->element=='facture') { |
|
| 138 | + $idvar = 'facid'; |
|
| 139 | + } else { |
|
| 140 | + $idvar='id'; |
|
| 141 | + } |
|
| 138 | 142 | |
| 139 | 143 | if(in_array($action, array('add_title_line', 'add_total_line', 'add_subtitle_line', 'add_subtotal_line', 'add_free_text')) ) |
| 140 | 144 | { |
@@ -142,10 +146,11 @@ discard block |
||
| 142 | 146 | |
| 143 | 147 | if($action=='add_title_line') { |
| 144 | 148 | $title = GETPOST('title'); |
| 145 | - if(empty($title)) $title = $langs->trans('title'); |
|
| 149 | + if(empty($title)) { |
|
| 150 | + $title = $langs->trans('title'); |
|
| 151 | + } |
|
| 146 | 152 | $qty = $level<1 ? 1 : $level ; |
| 147 | - } |
|
| 148 | - else if($action=='add_free_text') { |
|
| 153 | + } else if($action=='add_free_text') { |
|
| 149 | 154 | $title = GETPOST('title'); |
| 150 | 155 | |
| 151 | 156 | if (empty($title)) { |
@@ -157,29 +162,31 @@ discard block |
||
| 157 | 162 | } |
| 158 | 163 | } |
| 159 | 164 | } |
| 160 | - if(empty($title)) $title = $langs->trans('subtotalAddLineDescription'); |
|
| 165 | + if(empty($title)) { |
|
| 166 | + $title = $langs->trans('subtotalAddLineDescription'); |
|
| 167 | + } |
|
| 161 | 168 | $qty = 50; |
| 162 | - } |
|
| 163 | - else if($action=='add_subtitle_line') { |
|
| 169 | + } else if($action=='add_subtitle_line') { |
|
| 164 | 170 | $title = GETPOST('title'); |
| 165 | - if(empty($title)) $title = $langs->trans('subtitle'); |
|
| 171 | + if(empty($title)) { |
|
| 172 | + $title = $langs->trans('subtitle'); |
|
| 173 | + } |
|
| 166 | 174 | $qty = 2; |
| 167 | - } |
|
| 168 | - else if($action=='add_subtotal_line') { |
|
| 175 | + } else if($action=='add_subtotal_line') { |
|
| 169 | 176 | $title = $langs->trans('SubSubTotal'); |
| 170 | 177 | $qty = 98; |
| 171 | - } |
|
| 172 | - else { |
|
| 178 | + } else { |
|
| 173 | 179 | $title = GETPOST('title') ? GETPOST('title') : $langs->trans('SubTotal'); |
| 174 | 180 | $qty = $level ? 100-$level : 99; |
| 175 | 181 | } |
| 176 | 182 | dol_include_once('/subtotal/class/subtotal.class.php'); |
| 177 | 183 | |
| 178 | - if (!empty($conf->global->SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE) && $qty < 10) TSubtotal::addSubtotalMissing($object, $qty); |
|
| 184 | + if (!empty($conf->global->SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE) && $qty < 10) { |
|
| 185 | + TSubtotal::addSubtotalMissing($object, $qty); |
|
| 186 | + } |
|
| 179 | 187 | |
| 180 | 188 | TSubtotal::addSubTotalLine($object, $title, $qty); |
| 181 | - } |
|
| 182 | - else if($action==='ask_deleteallline') { |
|
| 189 | + } else if($action==='ask_deleteallline') { |
|
| 183 | 190 | $form=new Form($db); |
| 184 | 191 | |
| 185 | 192 | $lineid = GETPOST('lineid','integer'); |
@@ -202,8 +209,7 @@ discard block |
||
| 202 | 209 | $this->printNewFormat($object, $conf, $langs, $idvar); |
| 203 | 210 | } |
| 204 | 211 | } |
| 205 | - } |
|
| 206 | - elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice',$contexts) || in_array('orderstoinvoicesupplier',$contexts)) |
|
| 212 | + } elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice',$contexts) || in_array('orderstoinvoicesupplier',$contexts)) |
|
| 207 | 213 | { |
| 208 | 214 | ?> |
| 209 | 215 | <script type="text/javascript"> |
@@ -221,8 +227,13 @@ discard block |
||
| 221 | 227 | |
| 222 | 228 | function printNewFormat(&$object, &$conf, &$langs, $idvar) |
| 223 | 229 | { |
| 224 | - if (empty($conf->global->SUBTOTAL_ALLOW_ADD_BLOCK)) return false; |
|
| 225 | - if ($line->fk_prev_id != null && !empty($line->fk_prev_id)) return false; // Si facture de situation |
|
| 230 | + if (empty($conf->global->SUBTOTAL_ALLOW_ADD_BLOCK)) { |
|
| 231 | + return false; |
|
| 232 | + } |
|
| 233 | + if ($line->fk_prev_id != null && !empty($line->fk_prev_id)) { |
|
| 234 | + return false; |
|
| 235 | + } |
|
| 236 | + // Si facture de situation |
|
| 226 | 237 | ?> |
| 227 | 238 | <script type="text/javascript"> |
| 228 | 239 | $(document).ready(function() { |
@@ -515,8 +526,7 @@ discard block |
||
| 515 | 526 | } |
| 516 | 527 | |
| 517 | 528 | |
| 518 | - } |
|
| 519 | - else{ |
|
| 529 | + } else{ |
|
| 520 | 530 | $substitutionarray['line_not_modsubtotal'] = true; |
| 521 | 531 | $substitutionarray['line_modsubtotal'] = 0; |
| 522 | 532 | } |
@@ -574,8 +584,11 @@ discard block |
||
| 574 | 584 | |
| 575 | 585 | $showBlockExtrafields = GETPOST('showBlockExtrafields'); |
| 576 | 586 | |
| 577 | - if($object->element=='facture') $idvar = 'facid'; |
|
| 578 | - else $idvar = 'id'; |
|
| 587 | + if($object->element=='facture') { |
|
| 588 | + $idvar = 'facid'; |
|
| 589 | + } else { |
|
| 590 | + $idvar = 'id'; |
|
| 591 | + } |
|
| 579 | 592 | |
| 580 | 593 | if ($action == 'updateligne' || $action == 'updateline') |
| 581 | 594 | { |
@@ -605,8 +618,7 @@ discard block |
||
| 605 | 618 | header('Location: '.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id); |
| 606 | 619 | exit; // Surtout ne pas laisser Dolibarr faire du traitement sur le updateligne sinon ça plante les données de la ligne |
| 607 | 620 | } |
| 608 | - } |
|
| 609 | - else if($action === 'builddoc') { |
|
| 621 | + } else if($action === 'builddoc') { |
|
| 610 | 622 | |
| 611 | 623 | if ( |
| 612 | 624 | in_array('invoicecard',explode(':',$parameters['context'])) |
@@ -621,33 +633,27 @@ discard block |
||
| 621 | 633 | $sessname = 'subtotal_hideInnerLines_facture'; |
| 622 | 634 | $sessname2 = 'subtotal_hidedetails_facture'; |
| 623 | 635 | $sessname3 = 'subtotal_hideprices_facture'; |
| 624 | - } |
|
| 625 | - elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) { |
|
| 636 | + } elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) { |
|
| 626 | 637 | $sessname = 'subtotal_hideInnerLines_facture_fournisseur'; |
| 627 | 638 | $sessname2 = 'subtotal_hidedetails_facture_fournisseur'; |
| 628 | 639 | $sessname3 = 'subtotal_hideprices_facture_fournisseur'; |
| 629 | - } |
|
| 630 | - elseif(in_array('propalcard',explode(':',$parameters['context']))) { |
|
| 640 | + } elseif(in_array('propalcard',explode(':',$parameters['context']))) { |
|
| 631 | 641 | $sessname = 'subtotal_hideInnerLines_propal'; |
| 632 | 642 | $sessname2 = 'subtotal_hidedetails_propal'; |
| 633 | 643 | $sessname3 = 'subtotal_hideprices_propal'; |
| 634 | - } |
|
| 635 | - elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) { |
|
| 644 | + } elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) { |
|
| 636 | 645 | $sessname = 'subtotal_hideInnerLines_supplier_proposal'; |
| 637 | 646 | $sessname2 = 'subtotal_hidedetails_supplier_proposal'; |
| 638 | 647 | $sessname3 = 'subtotal_hideprices_supplier_proposal'; |
| 639 | - } |
|
| 640 | - elseif(in_array('ordercard',explode(':',$parameters['context']))) { |
|
| 648 | + } elseif(in_array('ordercard',explode(':',$parameters['context']))) { |
|
| 641 | 649 | $sessname = 'subtotal_hideInnerLines_commande'; |
| 642 | 650 | $sessname2 = 'subtotal_hidedetails_commande'; |
| 643 | 651 | $sessname3 = 'subtotal_hideprices_commande'; |
| 644 | - } |
|
| 645 | - elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) { |
|
| 652 | + } elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) { |
|
| 646 | 653 | $sessname = 'subtotal_hideInnerLines_commande_fournisseur'; |
| 647 | 654 | $sessname2 = 'subtotal_hidedetails_commande_fournisseur'; |
| 648 | 655 | $sessname3 = 'subtotal_hideprices_commande_fournisseur'; |
| 649 | - } |
|
| 650 | - else { |
|
| 656 | + } else { |
|
| 651 | 657 | $sessname = 'subtotal_hideInnerLines_unknown'; |
| 652 | 658 | $sessname2 = 'subtotal_hidedetails_unknown'; |
| 653 | 659 | $sessname3 = 'subtotal_hideprices_unknown'; |
@@ -656,15 +662,24 @@ discard block |
||
| 656 | 662 | global $hideprices; |
| 657 | 663 | |
| 658 | 664 | $hideInnerLines = (int)GETPOST('hideInnerLines'); |
| 659 | - if(!empty($_SESSION[$sessname]) && !is_array($_SESSION[$sessname][$object->id]) ) $_SESSION[$sessname] = array(); // prevent old system |
|
| 665 | + if(!empty($_SESSION[$sessname]) && !is_array($_SESSION[$sessname][$object->id]) ) { |
|
| 666 | + $_SESSION[$sessname] = array(); |
|
| 667 | + } |
|
| 668 | + // prevent old system |
|
| 660 | 669 | $_SESSION[$sessname][$object->id] = $hideInnerLines; |
| 661 | 670 | |
| 662 | 671 | $hidedetails= (int)GETPOST('hidedetails'); |
| 663 | - if(!empty($_SESSION[$sessname2]) && !is_array($_SESSION[$sessname2][$object->id]) ) $_SESSION[$sessname2] = array(); // prevent old system |
|
| 672 | + if(!empty($_SESSION[$sessname2]) && !is_array($_SESSION[$sessname2][$object->id]) ) { |
|
| 673 | + $_SESSION[$sessname2] = array(); |
|
| 674 | + } |
|
| 675 | + // prevent old system |
|
| 664 | 676 | $_SESSION[$sessname2][$object->id] = $hidedetails; |
| 665 | 677 | |
| 666 | 678 | $hideprices= (int)GETPOST('hideprices'); |
| 667 | - if(!empty($_SESSION[$sessname3]) && !is_array($_SESSION[$sessname3][$object->id]) ) $_SESSION[$sessname3] = array(); // prevent old system |
|
| 679 | + if(!empty($_SESSION[$sessname3]) && !is_array($_SESSION[$sessname3][$object->id]) ) { |
|
| 680 | + $_SESSION[$sessname3] = array(); |
|
| 681 | + } |
|
| 682 | + // prevent old system |
|
| 668 | 683 | $_SESSION[$sessname3][$object->id] = $hideprices; |
| 669 | 684 | |
| 670 | 685 | foreach($object->lines as &$line) { |
@@ -672,8 +687,7 @@ discard block |
||
| 672 | 687 | |
| 673 | 688 | if($line->qty>=90) { |
| 674 | 689 | $line->modsubtotal_total = 1; |
| 675 | - } |
|
| 676 | - else{ |
|
| 690 | + } else{ |
|
| 677 | 691 | $line->modsubtotal_title = 1; |
| 678 | 692 | } |
| 679 | 693 | |
@@ -682,8 +696,7 @@ discard block |
||
| 682 | 696 | } |
| 683 | 697 | } |
| 684 | 698 | |
| 685 | - } |
|
| 686 | - else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') { |
|
| 699 | + } else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') { |
|
| 687 | 700 | |
| 688 | 701 | $Tab = $this->getArrayOfLineForAGroup($object, GETPOST('lineid')); |
| 689 | 702 | |
@@ -691,7 +704,9 @@ discard block |
||
| 691 | 704 | /** |
| 692 | 705 | * @var $object Facture |
| 693 | 706 | */ |
| 694 | - if($object->element=='facture') $object->deleteline($idLine); |
|
| 707 | + if($object->element=='facture') { |
|
| 708 | + $object->deleteline($idLine); |
|
| 709 | + } |
|
| 695 | 710 | /** |
| 696 | 711 | * @var $object Facture fournisseur |
| 697 | 712 | */ |
@@ -702,18 +717,25 @@ discard block |
||
| 702 | 717 | /** |
| 703 | 718 | * @var $object Propal |
| 704 | 719 | */ |
| 705 | - else if($object->element=='propal') $object->deleteline($idLine); |
|
| 720 | + else if($object->element=='propal') { |
|
| 721 | + $object->deleteline($idLine); |
|
| 722 | + } |
|
| 706 | 723 | /** |
| 707 | 724 | * @var $object Propal Fournisseur |
| 708 | 725 | */ |
| 709 | - else if($object->element=='supplier_proposal') $object->deleteline($idLine); |
|
| 726 | + else if($object->element=='supplier_proposal') { |
|
| 727 | + $object->deleteline($idLine); |
|
| 728 | + } |
|
| 710 | 729 | /** |
| 711 | 730 | * @var $object Commande |
| 712 | 731 | */ |
| 713 | 732 | else if($object->element=='commande') |
| 714 | 733 | { |
| 715 | - if ((float) DOL_VERSION >= 5.0) $object->deleteline($user, $idLine); |
|
| 716 | - else $object->deleteline($idLine); |
|
| 734 | + if ((float) DOL_VERSION >= 5.0) { |
|
| 735 | + $object->deleteline($user, $idLine); |
|
| 736 | + } else { |
|
| 737 | + $object->deleteline($idLine); |
|
| 738 | + } |
|
| 717 | 739 | } |
| 718 | 740 | /** |
| 719 | 741 | * @var $object Commande fournisseur |
@@ -725,25 +747,32 @@ discard block |
||
| 725 | 747 | /** |
| 726 | 748 | * @var $object Facturerec |
| 727 | 749 | */ |
| 728 | - else if($object->element=='facturerec') $object->deleteline($idLine); |
|
| 750 | + else if($object->element=='facturerec') { |
|
| 751 | + $object->deleteline($idLine); |
|
| 752 | + } |
|
| 729 | 753 | /** |
| 730 | 754 | * @var $object Expedition |
| 731 | 755 | */ |
| 732 | - else if($object->element=='shipping') $object->deleteline($user, $idLine); |
|
| 756 | + else if($object->element=='shipping') { |
|
| 757 | + $object->deleteline($user, $idLine); |
|
| 758 | + } |
|
| 733 | 759 | } |
| 734 | 760 | |
| 735 | 761 | header('location:?id='.$object->id); |
| 736 | 762 | exit; |
| 737 | 763 | |
| 738 | - } |
|
| 739 | - else if ($action == 'duplicate') |
|
| 764 | + } else if ($action == 'duplicate') |
|
| 740 | 765 | { |
| 741 | 766 | $lineid = GETPOST('lineid', 'int'); |
| 742 | 767 | $nbDuplicate = TSubtotal::duplicateLines($object, $lineid, true); |
| 743 | 768 | |
| 744 | - if ($nbDuplicate > 0) setEventMessage($langs->trans('subtotal_duplicate_success', $nbDuplicate)); |
|
| 745 | - elseif ($nbDuplicate == 0) setEventMessage($langs->trans('subtotal_duplicate_lineid_not_found'), 'warnings'); |
|
| 746 | - else setEventMessage($langs->trans('subtotal_duplicate_error'), 'errors'); |
|
| 769 | + if ($nbDuplicate > 0) { |
|
| 770 | + setEventMessage($langs->trans('subtotal_duplicate_success', $nbDuplicate)); |
|
| 771 | + } elseif ($nbDuplicate == 0) { |
|
| 772 | + setEventMessage($langs->trans('subtotal_duplicate_lineid_not_found'), 'warnings'); |
|
| 773 | + } else { |
|
| 774 | + setEventMessage($langs->trans('subtotal_duplicate_error'), 'errors'); |
|
| 775 | + } |
|
| 747 | 776 | |
| 748 | 777 | header('Location: ?id='.$object->id); |
| 749 | 778 | exit; |
@@ -761,21 +790,26 @@ discard block |
||
| 761 | 790 | global $conf; |
| 762 | 791 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && !empty($object->table_element_line) && in_array($object->element, array('commande', 'facture', 'propal'))) |
| 763 | 792 | { |
| 764 | - if ($object->element == 'commande') |
|
| 765 | - $obj = new OrderLine($object->db); |
|
| 766 | - if ($object->element == 'propal') |
|
| 767 | - $obj = new PropaleLigne($object->db); |
|
| 768 | - if ($object->element == 'facture') |
|
| 769 | - $obj = new FactureLigne($object->db); |
|
| 793 | + if ($object->element == 'commande') { |
|
| 794 | + $obj = new OrderLine($object->db); |
|
| 795 | + } |
|
| 796 | + if ($object->element == 'propal') { |
|
| 797 | + $obj = new PropaleLigne($object->db); |
|
| 798 | + } |
|
| 799 | + if ($object->element == 'facture') { |
|
| 800 | + $obj = new FactureLigne($object->db); |
|
| 801 | + } |
|
| 770 | 802 | if (!empty($parameters['fk_element'])) |
| 771 | 803 | { |
| 772 | 804 | |
| 773 | 805 | if($obj->fetch($parameters['fk_element'])){ |
| 774 | 806 | $obj->id= $obj->rowid; |
| 775 | - if (empty($obj->array_options)) |
|
| 776 | - $obj->fetch_optionals(); |
|
| 777 | - if (!empty($obj->array_options['options_subtotal_nc'])) |
|
| 778 | - return 1; |
|
| 807 | + if (empty($obj->array_options)) { |
|
| 808 | + $obj->fetch_optionals(); |
|
| 809 | + } |
|
| 810 | + if (!empty($obj->array_options['options_subtotal_nc'])) { |
|
| 811 | + return 1; |
|
| 812 | + } |
|
| 779 | 813 | } |
| 780 | 814 | } |
| 781 | 815 | } |
@@ -847,27 +881,33 @@ discard block |
||
| 847 | 881 | $TTotal_tva = array(); |
| 848 | 882 | |
| 849 | 883 | $sign=1; |
| 850 | - if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1; |
|
| 884 | + if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) { |
|
| 885 | + $sign=-1; |
|
| 886 | + } |
|
| 851 | 887 | |
| 852 | - if (GETPOST('action') == 'builddoc') $builddoc = true; |
|
| 853 | - else $builddoc = false; |
|
| 888 | + if (GETPOST('action') == 'builddoc') { |
|
| 889 | + $builddoc = true; |
|
| 890 | + } else { |
|
| 891 | + $builddoc = false; |
|
| 892 | + } |
|
| 854 | 893 | |
| 855 | 894 | dol_include_once('/subtotal/class/subtotal.class.php'); |
| 856 | 895 | foreach($object->lines as $l) { |
| 857 | 896 | //print $l->rang.'>='.$rang.' '.$total.'<br/>'; |
| 858 | 897 | if($l->rang>=$rang) { |
| 859 | 898 | //echo 'return!<br>'; |
| 860 | - if (!$return_all) return $total; |
|
| 861 | - else return array($total, $total_tva, $total_ttc, $TTotal_tva); |
|
| 862 | - } |
|
| 863 | - else if(TSubtotal::isTitle($l, 100 - $qty_line)) |
|
| 899 | + if (!$return_all) { |
|
| 900 | + return $total; |
|
| 901 | + } else { |
|
| 902 | + return array($total, $total_tva, $total_ttc, $TTotal_tva); |
|
| 903 | + } |
|
| 904 | + } else if(TSubtotal::isTitle($l, 100 - $qty_line)) |
|
| 864 | 905 | { |
| 865 | 906 | $total = 0; |
| 866 | 907 | $total_tva = 0; |
| 867 | 908 | $total_ttc = 0; |
| 868 | 909 | $TTotal_tva = array(); |
| 869 | - } |
|
| 870 | - elseif(!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) { |
|
| 910 | + } elseif(!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) { |
|
| 871 | 911 | |
| 872 | 912 | // TODO retirer le test avec $builddoc quand Dolibarr affichera le total progression sur la card et pas seulement dans le PDF |
| 873 | 913 | if ($builddoc && $object->element == 'facture' && $object->type==Facture::TYPE_SITUATION) |
@@ -889,8 +929,7 @@ discard block |
||
| 889 | 929 | $TTotal_tva[$l->tva_tx] += $sign * ($l->total_tva / ($l->situation_percent / 100)) * $progress; |
| 890 | 930 | $total_ttc += $sign * ($l->total_tva / ($l->total_ttc / 100)) * $progress; |
| 891 | 931 | } |
| 892 | - } |
|
| 893 | - else |
|
| 932 | + } else |
|
| 894 | 933 | { |
| 895 | 934 | $total += $l->total_ht; |
| 896 | 935 | $total_tva += $l->total_tva; |
@@ -900,8 +939,11 @@ discard block |
||
| 900 | 939 | } |
| 901 | 940 | |
| 902 | 941 | } |
| 903 | - if (!$return_all) return $total; |
|
| 904 | - else return array($total, $total_tva, $total_ttc, $TTotal_tva); |
|
| 942 | + if (!$return_all) { |
|
| 943 | + return $total; |
|
| 944 | + } else { |
|
| 945 | + return array($total, $total_tva, $total_ttc, $TTotal_tva); |
|
| 946 | + } |
|
| 905 | 947 | } |
| 906 | 948 | |
| 907 | 949 | /** |
@@ -948,15 +990,18 @@ discard block |
||
| 948 | 990 | } |
| 949 | 991 | |
| 950 | 992 | |
| 951 | - if($line->qty==99) |
|
| 952 | - $pdf->SetFillColor(220,220,220); |
|
| 953 | - elseif ($line->qty==98) |
|
| 954 | - $pdf->SetFillColor(230,230,230); |
|
| 955 | - else |
|
| 956 | - $pdf->SetFillColor(240,240,240); |
|
| 993 | + if($line->qty==99) { |
|
| 994 | + $pdf->SetFillColor(220,220,220); |
|
| 995 | + } elseif ($line->qty==98) { |
|
| 996 | + $pdf->SetFillColor(230,230,230); |
|
| 997 | + } else { |
|
| 998 | + $pdf->SetFillColor(240,240,240); |
|
| 999 | + } |
|
| 957 | 1000 | |
| 958 | 1001 | $style = 'B'; |
| 959 | - if (!empty($conf->global->SUBTOTAL_SUBTOTAL_STYLE)) $style = $conf->global->SUBTOTAL_SUBTOTAL_STYLE; |
|
| 1002 | + if (!empty($conf->global->SUBTOTAL_SUBTOTAL_STYLE)) { |
|
| 1003 | + $style = $conf->global->SUBTOTAL_SUBTOTAL_STYLE; |
|
| 1004 | + } |
|
| 960 | 1005 | |
| 961 | 1006 | $pdf->SetFont('', $style, 9); |
| 962 | 1007 | |
@@ -998,8 +1043,7 @@ discard block |
||
| 998 | 1043 | // $line->total_tva |
| 999 | 1044 | // $line->total |
| 1000 | 1045 | // $line->total_ttc |
| 1001 | - } |
|
| 1002 | - else |
|
| 1046 | + } else |
|
| 1003 | 1047 | { |
| 1004 | 1048 | // list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
| 1005 | 1049 | |
@@ -1009,17 +1053,22 @@ discard block |
||
| 1009 | 1053 | |
| 1010 | 1054 | $line->total_ht = $TInfo[0]; |
| 1011 | 1055 | $line->total = $TInfo[0]; |
| 1012 | - if (!TSubtotal::isModSubtotalLine($line)) $line->total_tva = $TInfo[1]; |
|
| 1056 | + if (!TSubtotal::isModSubtotalLine($line)) { |
|
| 1057 | + $line->total_tva = $TInfo[1]; |
|
| 1058 | + } |
|
| 1013 | 1059 | $line->total_ttc = $TInfo[2]; |
| 1014 | 1060 | } |
| 1015 | 1061 | } |
| 1016 | 1062 | |
| 1017 | 1063 | $pdf->SetXY($pdf->postotalht, $posy); |
| 1018 | - if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
| 1064 | + if($set_pagebreak_margin) { |
|
| 1065 | + $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
| 1066 | + } |
|
| 1019 | 1067 | $pdf->MultiCell($pdf->page_largeur-$pdf->marge_droite-$pdf->postotalht, 3, $total_to_print, 0, 'R', 0); |
| 1020 | - } |
|
| 1021 | - else{ |
|
| 1022 | - if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
| 1068 | + } else{ |
|
| 1069 | + if($set_pagebreak_margin) { |
|
| 1070 | + $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
| 1071 | + } |
|
| 1023 | 1072 | } |
| 1024 | 1073 | |
| 1025 | 1074 | $posy = $posy + $cell_height; |
@@ -1051,25 +1100,40 @@ discard block |
||
| 1051 | 1100 | |
| 1052 | 1101 | |
| 1053 | 1102 | $style = ($line->qty==1) ? 'BU' : 'BUI'; |
| 1054 | - if (!empty($conf->global->SUBTOTAL_TITLE_STYLE)) $style = $conf->global->SUBTOTAL_TITLE_STYLE; |
|
| 1103 | + if (!empty($conf->global->SUBTOTAL_TITLE_STYLE)) { |
|
| 1104 | + $style = $conf->global->SUBTOTAL_TITLE_STYLE; |
|
| 1105 | + } |
|
| 1055 | 1106 | |
| 1056 | 1107 | if($hideInnerLines) { |
| 1057 | - if($line->qty==1)$pdf->SetFont('', $style, 9); |
|
| 1058 | - else |
|
| 1108 | + if($line->qty==1) { |
|
| 1109 | + $pdf->SetFont('', $style, 9); |
|
| 1110 | + } else |
|
| 1059 | 1111 | { |
| 1060 | - if (!empty($conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES)) $style = $conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES; |
|
| 1112 | + if (!empty($conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES)) { |
|
| 1113 | + $style = $conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES; |
|
| 1114 | + } |
|
| 1061 | 1115 | $pdf->SetFont('', $style, 9); |
| 1062 | 1116 | } |
| 1063 | - } |
|
| 1064 | - else { |
|
| 1117 | + } else { |
|
| 1065 | 1118 | |
| 1066 | - if($line->qty==1)$pdf->SetFont('', $style, 9); //TODO if super utile |
|
| 1067 | - else $pdf->SetFont('', $style, 9); |
|
| 1119 | + if($line->qty==1) { |
|
| 1120 | + $pdf->SetFont('', $style, 9); |
|
| 1121 | + } |
|
| 1122 | + //TODO if super utile |
|
| 1123 | + else { |
|
| 1124 | + $pdf->SetFont('', $style, 9); |
|
| 1125 | + } |
|
| 1068 | 1126 | |
| 1069 | 1127 | } |
| 1070 | 1128 | |
| 1071 | - if ($label === strip_tags($label) && $label === dol_html_entity_decode($label, ENT_QUOTES)) $pdf->MultiCell($w, $h, $label, 0, 'L'); // Pas de HTML dans la chaine |
|
| 1072 | - else $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J',true); // et maintenant avec du HTML |
|
| 1129 | + if ($label === strip_tags($label) && $label === dol_html_entity_decode($label, ENT_QUOTES)) { |
|
| 1130 | + $pdf->MultiCell($w, $h, $label, 0, 'L'); |
|
| 1131 | + } |
|
| 1132 | + // Pas de HTML dans la chaine |
|
| 1133 | + else { |
|
| 1134 | + $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J',true); |
|
| 1135 | + } |
|
| 1136 | + // et maintenant avec du HTML |
|
| 1073 | 1137 | |
| 1074 | 1138 | if($description && !$hidedesc) { |
| 1075 | 1139 | $posy = $pdf->GetY(); |
@@ -1093,8 +1157,7 @@ discard block |
||
| 1093 | 1157 | |
| 1094 | 1158 | if(is_array($parameters)) { |
| 1095 | 1159 | $i = & $parameters['i']; |
| 1096 | - } |
|
| 1097 | - else { |
|
| 1160 | + } else { |
|
| 1098 | 1161 | $i = (int)$parameters; |
| 1099 | 1162 | } |
| 1100 | 1163 | |
@@ -1124,17 +1187,14 @@ discard block |
||
| 1124 | 1187 | |
| 1125 | 1188 | if((float)DOL_VERSION<=3.6) { |
| 1126 | 1189 | return ''; |
| 1127 | - } |
|
| 1128 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1190 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1129 | 1191 | return 1; |
| 1130 | 1192 | } |
| 1131 | 1193 | |
| 1132 | - } |
|
| 1133 | - elseif(!empty($hideprices)) { |
|
| 1194 | + } elseif(!empty($hideprices)) { |
|
| 1134 | 1195 | $this->resprints = $object->lines[$parameters['i']]->qty; |
| 1135 | 1196 | return 1; |
| 1136 | - } |
|
| 1137 | - elseif (!empty($conf->global->SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY)) |
|
| 1197 | + } elseif (!empty($conf->global->SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY)) |
|
| 1138 | 1198 | { |
| 1139 | 1199 | $hideInnerLines = (int)GETPOST('hideInnerLines'); |
| 1140 | 1200 | $hidedetails = (int)GETPOST('hidedetails'); |
@@ -1144,12 +1204,20 @@ discard block |
||
| 1144 | 1204 | } |
| 1145 | 1205 | } |
| 1146 | 1206 | |
| 1147 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1148 | - else $i = (int)$parameters; |
|
| 1207 | + if(is_array($parameters)) { |
|
| 1208 | + $i = & $parameters['i']; |
|
| 1209 | + } else { |
|
| 1210 | + $i = (int)$parameters; |
|
| 1211 | + } |
|
| 1149 | 1212 | |
| 1150 | - if (empty($object->lines[$i])) return 0; // hideInnerLines => override $object->lines et Dolibarr ne nous permet pas de mettre à jour la variable qui conditionne la boucle sur les lignes (PR faite pour 6.0) |
|
| 1213 | + if (empty($object->lines[$i])) { |
|
| 1214 | + return 0; |
|
| 1215 | + } |
|
| 1216 | + // hideInnerLines => override $object->lines et Dolibarr ne nous permet pas de mettre à jour la variable qui conditionne la boucle sur les lignes (PR faite pour 6.0) |
|
| 1151 | 1217 | |
| 1152 | - if(empty($object->lines[$i]->array_options)) $object->lines[$i]->fetch_optionals(); |
|
| 1218 | + if(empty($object->lines[$i]->array_options)) { |
|
| 1219 | + $object->lines[$i]->fetch_optionals(); |
|
| 1220 | + } |
|
| 1153 | 1221 | |
| 1154 | 1222 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
| 1155 | 1223 | { |
@@ -1166,8 +1234,11 @@ discard block |
||
| 1166 | 1234 | function pdf_getlinetotalexcltax($parameters=array(), &$object, &$action='') { |
| 1167 | 1235 | global $conf, $hideprices, $hookmanager; |
| 1168 | 1236 | |
| 1169 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1170 | - else $i = (int)$parameters; |
|
| 1237 | + if(is_array($parameters)) { |
|
| 1238 | + $i = & $parameters['i']; |
|
| 1239 | + } else { |
|
| 1240 | + $i = (int)$parameters; |
|
| 1241 | + } |
|
| 1171 | 1242 | |
| 1172 | 1243 | if($this->isModSubtotalLine($parameters,$object) ){ |
| 1173 | 1244 | |
@@ -1175,13 +1246,11 @@ discard block |
||
| 1175 | 1246 | |
| 1176 | 1247 | if((float)DOL_VERSION<=3.6) { |
| 1177 | 1248 | return ''; |
| 1178 | - } |
|
| 1179 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1249 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1180 | 1250 | return 1; |
| 1181 | 1251 | } |
| 1182 | 1252 | |
| 1183 | - } |
|
| 1184 | - elseif (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS)) |
|
| 1253 | + } elseif (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS)) |
|
| 1185 | 1254 | { |
| 1186 | 1255 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
| 1187 | 1256 | { |
@@ -1253,12 +1322,10 @@ discard block |
||
| 1253 | 1322 | $this->error = $hookmanager->error; |
| 1254 | 1323 | $this->errors = $hookmanager->errors; |
| 1255 | 1324 | return -1; |
| 1256 | - } |
|
| 1257 | - elseif (empty($reshook)) |
|
| 1325 | + } elseif (empty($reshook)) |
|
| 1258 | 1326 | { |
| 1259 | 1327 | $this->resprints .= $hookmanager->resprints; |
| 1260 | - } |
|
| 1261 | - else |
|
| 1328 | + } else |
|
| 1262 | 1329 | { |
| 1263 | 1330 | $this->resprints = $hookmanager->resprints; |
| 1264 | 1331 | |
@@ -1281,14 +1348,16 @@ discard block |
||
| 1281 | 1348 | |
| 1282 | 1349 | if((float)DOL_VERSION<=3.6) { |
| 1283 | 1350 | return ''; |
| 1284 | - } |
|
| 1285 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1351 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1286 | 1352 | return 1; |
| 1287 | 1353 | } |
| 1288 | 1354 | } |
| 1289 | 1355 | |
| 1290 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1291 | - else $i = (int)$parameters; |
|
| 1356 | + if(is_array($parameters)) { |
|
| 1357 | + $i = & $parameters['i']; |
|
| 1358 | + } else { |
|
| 1359 | + $i = (int)$parameters; |
|
| 1360 | + } |
|
| 1292 | 1361 | |
| 1293 | 1362 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
| 1294 | 1363 | { |
@@ -1310,14 +1379,16 @@ discard block |
||
| 1310 | 1379 | |
| 1311 | 1380 | if((float)DOL_VERSION<=3.6) { |
| 1312 | 1381 | return ''; |
| 1313 | - } |
|
| 1314 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1382 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1315 | 1383 | return 1; |
| 1316 | 1384 | } |
| 1317 | 1385 | } |
| 1318 | 1386 | |
| 1319 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1320 | - else $i = (int)$parameters; |
|
| 1387 | + if(is_array($parameters)) { |
|
| 1388 | + $i = & $parameters['i']; |
|
| 1389 | + } else { |
|
| 1390 | + $i = (int)$parameters; |
|
| 1391 | + } |
|
| 1321 | 1392 | |
| 1322 | 1393 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
| 1323 | 1394 | { |
@@ -1334,8 +1405,11 @@ discard block |
||
| 1334 | 1405 | function pdf_getlineupexcltax($parameters=array(), &$object, &$action='') { |
| 1335 | 1406 | global $conf,$hideprices,$hookmanager; |
| 1336 | 1407 | |
| 1337 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1338 | - else $i = (int)$parameters; |
|
| 1408 | + if(is_array($parameters)) { |
|
| 1409 | + $i = & $parameters['i']; |
|
| 1410 | + } else { |
|
| 1411 | + $i = (int)$parameters; |
|
| 1412 | + } |
|
| 1339 | 1413 | |
| 1340 | 1414 | if($this->isModSubtotalLine($parameters,$object) ) { |
| 1341 | 1415 | $this->resprints = ' '; |
@@ -1346,7 +1420,9 @@ discard block |
||
| 1346 | 1420 | if(TSubtotal::isSubtotal($line)) { |
| 1347 | 1421 | $parentTitle = TSubtotal::getParentTitleOfLine($object, $i); |
| 1348 | 1422 | |
| 1349 | - if(is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
| 1423 | + if(is_object($parentTitle) && empty($parentTitle->array_options)) { |
|
| 1424 | + $parentTitle->fetch_optionals(); |
|
| 1425 | + } |
|
| 1350 | 1426 | if(! empty($parentTitle->array_options['options_show_total_ht'])) { |
| 1351 | 1427 | $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle); |
| 1352 | 1428 | $this->resprints = price($TTotal['total_unit_subprice']); |
@@ -1355,8 +1431,7 @@ discard block |
||
| 1355 | 1431 | |
| 1356 | 1432 | if((float)DOL_VERSION<=3.6) { |
| 1357 | 1433 | return ''; |
| 1358 | - } |
|
| 1359 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1434 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1360 | 1435 | return 1; |
| 1361 | 1436 | } |
| 1362 | 1437 | } |
@@ -1401,8 +1476,11 @@ discard block |
||
| 1401 | 1476 | function pdf_getlineremisepercent($parameters=array(), &$object, &$action='') { |
| 1402 | 1477 | global $conf,$hideprices,$hookmanager; |
| 1403 | 1478 | |
| 1404 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1405 | - else $i = (int) $parameters; |
|
| 1479 | + if(is_array($parameters)) { |
|
| 1480 | + $i = & $parameters['i']; |
|
| 1481 | + } else { |
|
| 1482 | + $i = (int) $parameters; |
|
| 1483 | + } |
|
| 1406 | 1484 | |
| 1407 | 1485 | if($this->isModSubtotalLine($parameters,$object) ) { |
| 1408 | 1486 | $this->resprints = ' '; |
@@ -1413,7 +1491,9 @@ discard block |
||
| 1413 | 1491 | if(TSubtotal::isSubtotal($line)) { |
| 1414 | 1492 | $parentTitle = TSubtotal::getParentTitleOfLine($object, $i); |
| 1415 | 1493 | |
| 1416 | - if(empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
| 1494 | + if(empty($parentTitle->array_options)) { |
|
| 1495 | + $parentTitle->fetch_optionals(); |
|
| 1496 | + } |
|
| 1417 | 1497 | if(! empty($parentTitle->array_options['options_show_reduc'])) { |
| 1418 | 1498 | $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle); |
| 1419 | 1499 | $this->resprints = price((1-$TTotal['total_ht'] / $TTotal['total_subprice'])*100, 0, '', 1, 2, 2).'%'; |
@@ -1422,12 +1502,10 @@ discard block |
||
| 1422 | 1502 | |
| 1423 | 1503 | if((float)DOL_VERSION<=3.6) { |
| 1424 | 1504 | return ''; |
| 1425 | - } |
|
| 1426 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1505 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1427 | 1506 | return 1; |
| 1428 | 1507 | } |
| 1429 | - } |
|
| 1430 | - elseif (!empty($hideprices) |
|
| 1508 | + } elseif (!empty($hideprices) |
|
| 1431 | 1509 | || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
| 1432 | 1510 | ) |
| 1433 | 1511 | { |
@@ -1448,14 +1526,16 @@ discard block |
||
| 1448 | 1526 | $this->resprints = ' '; |
| 1449 | 1527 | if((float)DOL_VERSION<=3.6) { |
| 1450 | 1528 | return ''; |
| 1451 | - } |
|
| 1452 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1529 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1453 | 1530 | return 1; |
| 1454 | 1531 | } |
| 1455 | 1532 | } |
| 1456 | 1533 | |
| 1457 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1458 | - else $i = (int)$parameters; |
|
| 1534 | + if(is_array($parameters)) { |
|
| 1535 | + $i = & $parameters['i']; |
|
| 1536 | + } else { |
|
| 1537 | + $i = (int)$parameters; |
|
| 1538 | + } |
|
| 1459 | 1539 | |
| 1460 | 1540 | if (!empty($hideprices) |
| 1461 | 1541 | || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
@@ -1479,16 +1559,21 @@ discard block |
||
| 1479 | 1559 | |
| 1480 | 1560 | if((float)DOL_VERSION<=3.6) { |
| 1481 | 1561 | return ''; |
| 1482 | - } |
|
| 1483 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1562 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1484 | 1563 | return 1; |
| 1485 | 1564 | } |
| 1486 | 1565 | } |
| 1487 | 1566 | |
| 1488 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1489 | - else $i = (int)$parameters; |
|
| 1567 | + if(is_array($parameters)) { |
|
| 1568 | + $i = & $parameters['i']; |
|
| 1569 | + } else { |
|
| 1570 | + $i = (int)$parameters; |
|
| 1571 | + } |
|
| 1490 | 1572 | |
| 1491 | - if (empty($object->lines[$i])) return 0; // hideInnerLines => override $object->lines et Dolibarr ne nous permet pas de mettre à jour la variable qui conditionne la boucle sur les lignes (PR faite pour 6.0) |
|
| 1573 | + if (empty($object->lines[$i])) { |
|
| 1574 | + return 0; |
|
| 1575 | + } |
|
| 1576 | + // hideInnerLines => override $object->lines et Dolibarr ne nous permet pas de mettre à jour la variable qui conditionne la boucle sur les lignes (PR faite pour 6.0) |
|
| 1492 | 1577 | |
| 1493 | 1578 | $object->lines[$i]->fetch_optionals(); |
| 1494 | 1579 | // Si la gestion C/NC est active et que je suis sur un ligne dont l'extrafield est coché |
@@ -1534,14 +1619,16 @@ discard block |
||
| 1534 | 1619 | $this->resprints = ' '; |
| 1535 | 1620 | if((float)DOL_VERSION<=3.6) { |
| 1536 | 1621 | return ''; |
| 1537 | - } |
|
| 1538 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1622 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1539 | 1623 | return 1; |
| 1540 | 1624 | } |
| 1541 | 1625 | } |
| 1542 | 1626 | |
| 1543 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1544 | - else $i = (int)$parameters; |
|
| 1627 | + if(is_array($parameters)) { |
|
| 1628 | + $i = & $parameters['i']; |
|
| 1629 | + } else { |
|
| 1630 | + $i = (int)$parameters; |
|
| 1631 | + } |
|
| 1545 | 1632 | |
| 1546 | 1633 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
| 1547 | 1634 | { |
@@ -1571,7 +1658,9 @@ discard block |
||
| 1571 | 1658 | } |
| 1572 | 1659 | } |
| 1573 | 1660 | |
| 1574 | - if (!empty($TLineTitle)) $TTitleNumeroted = $this->formatNumerotation($TLineTitle); |
|
| 1661 | + if (!empty($TLineTitle)) { |
|
| 1662 | + $TTitleNumeroted = $this->formatNumerotation($TLineTitle); |
|
| 1663 | + } |
|
| 1575 | 1664 | } |
| 1576 | 1665 | |
| 1577 | 1666 | } |
@@ -1585,8 +1674,12 @@ discard block |
||
| 1585 | 1674 | $j=0; |
| 1586 | 1675 | foreach ($TLineTitle as $k => &$line) |
| 1587 | 1676 | { |
| 1588 | - if (!empty($line_reference) && $line->rang <= $line_reference->rang) continue; |
|
| 1589 | - if (!empty($line_reference) && $line->qty <= $line_reference->qty) break; |
|
| 1677 | + if (!empty($line_reference) && $line->rang <= $line_reference->rang) { |
|
| 1678 | + continue; |
|
| 1679 | + } |
|
| 1680 | + if (!empty($line_reference) && $line->qty <= $line_reference->qty) { |
|
| 1681 | + break; |
|
| 1682 | + } |
|
| 1590 | 1683 | |
| 1591 | 1684 | if ($line->qty == $level) |
| 1592 | 1685 | { |
@@ -1620,7 +1713,9 @@ discard block |
||
| 1620 | 1713 | |
| 1621 | 1714 | $hidedetails = (int)GETPOST('hidedetails'); |
| 1622 | 1715 | |
| 1623 | - if(empty($hidedetails)) return false; |
|
| 1716 | + if(empty($hidedetails)) { |
|
| 1717 | + return false; |
|
| 1718 | + } |
|
| 1624 | 1719 | |
| 1625 | 1720 | // TODO can't add VAT to document without lines... :-/ |
| 1626 | 1721 | |
@@ -1648,7 +1743,9 @@ discard block |
||
| 1648 | 1743 | foreach($object->lines as $k => &$l) { |
| 1649 | 1744 | if(TSubtotal::isSubtotal($l)) { |
| 1650 | 1745 | $parentTitle = TSubtotal::getParentTitleOfLine($object, $k); |
| 1651 | - if(is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
| 1746 | + if(is_object($parentTitle) && empty($parentTitle->array_options)) { |
|
| 1747 | + $parentTitle->fetch_optionals(); |
|
| 1748 | + } |
|
| 1652 | 1749 | if(! empty($parentTitle->id) && ! empty($parentTitle->array_options['options_show_reduc'])) { |
| 1653 | 1750 | $l->remise_percent = 100; // Affichage de la réduction sur la ligne de sous-total |
| 1654 | 1751 | } |
@@ -1692,7 +1789,9 @@ discard block |
||
| 1692 | 1789 | |
| 1693 | 1790 | $TInfo = $this->getTotalLineFromObject($object, $line, '', 1); |
| 1694 | 1791 | |
| 1695 | - if (TSubtotal::getNiveau($line) == 1) $line->TTotal_tva = $TInfo[3]; |
|
| 1792 | + if (TSubtotal::getNiveau($line) == 1) { |
|
| 1793 | + $line->TTotal_tva = $TInfo[3]; |
|
| 1794 | + } |
|
| 1696 | 1795 | $line->total_ht = $TInfo[0]; |
| 1697 | 1796 | $line->total_tva = $TInfo[1]; |
| 1698 | 1797 | $line->total = $line->total_ht; |
@@ -1756,8 +1855,7 @@ discard block |
||
| 1756 | 1855 | } |
| 1757 | 1856 | |
| 1758 | 1857 | |
| 1759 | - } |
|
| 1760 | - elseif ($hidedetails) |
|
| 1858 | + } elseif ($hidedetails) |
|
| 1761 | 1859 | { |
| 1762 | 1860 | $TLines[] = $line; //Cas où je cache uniquement les prix des produits |
| 1763 | 1861 | } |
@@ -1828,13 +1926,17 @@ discard block |
||
| 1828 | 1926 | |
| 1829 | 1927 | if(!empty($hideprices)) { |
| 1830 | 1928 | foreach($object->lines as &$line) { |
| 1831 | - if($line->fk_product_type!=9) $line->fk_parent_line = -1; |
|
| 1929 | + if($line->fk_product_type!=9) { |
|
| 1930 | + $line->fk_parent_line = -1; |
|
| 1931 | + } |
|
| 1832 | 1932 | } |
| 1833 | 1933 | } |
| 1834 | 1934 | |
| 1835 | 1935 | $line = &$object->lines[$i]; |
| 1836 | 1936 | |
| 1837 | - if($object->element == 'delivery' && ! empty($object->commande->expeditions[$line->fk_origin_line])) unset($object->commande->expeditions[$line->fk_origin_line]); |
|
| 1937 | + if($object->element == 'delivery' && ! empty($object->commande->expeditions[$line->fk_origin_line])) { |
|
| 1938 | + unset($object->commande->expeditions[$line->fk_origin_line]); |
|
| 1939 | + } |
|
| 1838 | 1940 | |
| 1839 | 1941 | if($line->info_bits>0) { // PAGE BREAK |
| 1840 | 1942 | $pdf->addPage(); |
@@ -1850,7 +1952,9 @@ discard block |
||
| 1850 | 1952 | } |
| 1851 | 1953 | |
| 1852 | 1954 | if($line->qty>90) { |
| 1853 | - if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) $label .= ' '.$this->getTitle($object, $line); |
|
| 1955 | + if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) { |
|
| 1956 | + $label .= ' '.$this->getTitle($object, $line); |
|
| 1957 | + } |
|
| 1854 | 1958 | |
| 1855 | 1959 | $pageBefore = $pdf->getPage(); |
| 1856 | 1960 | $this->pdf_add_total($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
@@ -1888,8 +1992,7 @@ discard block |
||
| 1888 | 1992 | |
| 1889 | 1993 | $posy = $pdf->GetY(); |
| 1890 | 1994 | return 1; |
| 1891 | - } |
|
| 1892 | - else if ($line->qty < 10) { |
|
| 1995 | + } else if ($line->qty < 10) { |
|
| 1893 | 1996 | $pageBefore = $pdf->getPage(); |
| 1894 | 1997 | |
| 1895 | 1998 | $this->pdf_add_title($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
@@ -1919,8 +2022,7 @@ discard block |
||
| 1919 | 2022 | // if($line->rowid==47) exit; |
| 1920 | 2023 | |
| 1921 | 2024 | return 0; |
| 1922 | - } |
|
| 1923 | - elseif (empty($object->lines[$parameters['i']])) |
|
| 2025 | + } elseif (empty($object->lines[$parameters['i']])) |
|
| 1924 | 2026 | { |
| 1925 | 2027 | $this->resprints = -1; |
| 1926 | 2028 | } |
@@ -1953,7 +2055,9 @@ discard block |
||
| 1953 | 2055 | |
| 1954 | 2056 | foreach ($object->lines as $line) |
| 1955 | 2057 | { |
| 1956 | - if ($line->id == $currentLine->id) break; |
|
| 2058 | + if ($line->id == $currentLine->id) { |
|
| 2059 | + break; |
|
| 2060 | + } |
|
| 1957 | 2061 | |
| 1958 | 2062 | $qty_search = 100 - $currentLine->qty; |
| 1959 | 2063 | |
@@ -1984,7 +2088,9 @@ discard block |
||
| 1984 | 2088 | $var = &$parameters['var']; |
| 1985 | 2089 | |
| 1986 | 2090 | $contexts = explode(':',$parameters['context']); |
| 1987 | - if($parameters['currentcontext'] === 'paiementcard') return 0; |
|
| 2091 | + if($parameters['currentcontext'] === 'paiementcard') { |
|
| 2092 | + return 0; |
|
| 2093 | + } |
|
| 1988 | 2094 | $originline = null; |
| 1989 | 2095 | |
| 1990 | 2096 | $createRight = $user->rights->{$object->element}->creer; |
@@ -1992,22 +2098,18 @@ discard block |
||
| 1992 | 2098 | { |
| 1993 | 2099 | $object->statut = 0; // hack for facture rec |
| 1994 | 2100 | $createRight = $user->rights->facture->creer; |
| 1995 | - } |
|
| 1996 | - elseif($object->element == 'order_supplier' ) |
|
| 2101 | + } elseif($object->element == 'order_supplier' ) |
|
| 1997 | 2102 | { |
| 1998 | 2103 | $createRight = $user->rights->fournisseur->commande->creer; |
| 1999 | - } |
|
| 2000 | - elseif($object->element == 'invoice_supplier' ) |
|
| 2104 | + } elseif($object->element == 'invoice_supplier' ) |
|
| 2001 | 2105 | { |
| 2002 | 2106 | $createRight = $user->rights->fournisseur->facture->creer; |
| 2003 | - } |
|
| 2004 | - elseif($object->element == 'commande' && in_array('ordershipmentcard', $contexts)) |
|
| 2107 | + } elseif($object->element == 'commande' && in_array('ordershipmentcard', $contexts)) |
|
| 2005 | 2108 | { |
| 2006 | 2109 | // H4cK 4n0nYm0u$-style : $line n'est pas un objet instancié mais provient d'un fetch_object d'une requête SQL |
| 2007 | 2110 | $line->id = $line->rowid; |
| 2008 | 2111 | $line->product_type = $line->type; |
| 2009 | - } |
|
| 2010 | - elseif($object->element == 'shipping' || $object->element == 'delivery') |
|
| 2112 | + } elseif($object->element == 'shipping' || $object->element == 'delivery') |
|
| 2011 | 2113 | { |
| 2012 | 2114 | if(empty($line->origin_line_id) && ! empty($line->fk_origin_line)) |
| 2013 | 2115 | { |
@@ -2027,8 +2129,11 @@ discard block |
||
| 2027 | 2129 | |
| 2028 | 2130 | $line = $originline; |
| 2029 | 2131 | } |
| 2030 | - if($object->element=='facture')$idvar = 'facid'; |
|
| 2031 | - else $idvar='id'; |
|
| 2132 | + if($object->element=='facture') { |
|
| 2133 | + $idvar = 'facid'; |
|
| 2134 | + } else { |
|
| 2135 | + $idvar='id'; |
|
| 2136 | + } |
|
| 2032 | 2137 | if($line->special_code!=$this->module_number || $line->product_type!=9) { |
| 2033 | 2138 | if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_LINE) && $object->element !== 'invoice_supplier') |
| 2034 | 2139 | { |
@@ -2046,8 +2151,7 @@ discard block |
||
| 2046 | 2151 | |
| 2047 | 2152 | } |
| 2048 | 2153 | return 0; |
| 2049 | - } |
|
| 2050 | - else if (in_array('invoicecard',$contexts) || in_array('invoicesuppliercard',$contexts) || in_array('propalcard',$contexts) || in_array('supplier_proposalcard',$contexts) || in_array('ordercard',$contexts) || in_array('ordersuppliercard',$contexts) || in_array('invoicereccard',$contexts)) |
|
| 2154 | + } else if (in_array('invoicecard',$contexts) || in_array('invoicesuppliercard',$contexts) || in_array('propalcard',$contexts) || in_array('supplier_proposalcard',$contexts) || in_array('ordercard',$contexts) || in_array('ordersuppliercard',$contexts) || in_array('invoicereccard',$contexts)) |
|
| 2051 | 2155 | { |
| 2052 | 2156 | |
| 2053 | 2157 | |
@@ -2075,22 +2179,44 @@ discard block |
||
| 2075 | 2179 | <?php |
| 2076 | 2180 | } |
| 2077 | 2181 | |
| 2078 | - if(empty($line->description)) $line->description = $line->desc; |
|
| 2182 | + if(empty($line->description)) { |
|
| 2183 | + $line->description = $line->desc; |
|
| 2184 | + } |
|
| 2079 | 2185 | |
| 2080 | 2186 | $colspan = 5; |
| 2081 | - if($object->element == 'facturerec' ) $colspan = 3; |
|
| 2082 | - if($object->element == 'order_supplier') (float) DOL_VERSION < 7.0 ? $colspan = 3 : $colspan = 6; |
|
| 2083 | - if($object->element == 'invoice_supplier') (float) DOL_VERSION < 7.0 ? $colspan = 4: $colspan = 7; |
|
| 2084 | - if($object->element == 'supplier_proposal') (float) DOL_VERSION < 6.0 ? $colspan = 4 : $colspan = 3; |
|
| 2187 | + if($object->element == 'facturerec' ) { |
|
| 2188 | + $colspan = 3; |
|
| 2189 | + } |
|
| 2190 | + if($object->element == 'order_supplier') { |
|
| 2191 | + (float) DOL_VERSION < 7.0 ? $colspan = 3 : $colspan = 6; |
|
| 2192 | + } |
|
| 2193 | + if($object->element == 'invoice_supplier') { |
|
| 2194 | + (float) DOL_VERSION < 7.0 ? $colspan = 4: $colspan = 7; |
|
| 2195 | + } |
|
| 2196 | + if($object->element == 'supplier_proposal') { |
|
| 2197 | + (float) DOL_VERSION < 6.0 ? $colspan = 4 : $colspan = 3; |
|
| 2198 | + } |
|
| 2085 | 2199 | if(!empty($conf->multicurrency->enabled) && ((float) DOL_VERSION < 8.0 || $object->multicurrency_code != $conf->currency)) { |
| 2086 | 2200 | $colspan++; // Colonne PU Devise |
| 2087 | 2201 | } |
| 2088 | - if($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) $colspan++; |
|
| 2089 | - if(!empty($conf->margin->enabled)) $colspan++; |
|
| 2090 | - if(!empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; |
|
| 2091 | - if(!empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; |
|
| 2092 | - if($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) $colspan++; |
|
| 2093 | - if(!empty($conf->global->PRODUCT_USE_UNITS)) $colspan++; |
|
| 2202 | + if($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) { |
|
| 2203 | + $colspan++; |
|
| 2204 | + } |
|
| 2205 | + if(!empty($conf->margin->enabled)) { |
|
| 2206 | + $colspan++; |
|
| 2207 | + } |
|
| 2208 | + if(!empty($conf->global->DISPLAY_MARGIN_RATES)) { |
|
| 2209 | + $colspan++; |
|
| 2210 | + } |
|
| 2211 | + if(!empty($conf->global->DISPLAY_MARK_RATES)) { |
|
| 2212 | + $colspan++; |
|
| 2213 | + } |
|
| 2214 | + if($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) { |
|
| 2215 | + $colspan++; |
|
| 2216 | + } |
|
| 2217 | + if(!empty($conf->global->PRODUCT_USE_UNITS)) { |
|
| 2218 | + $colspan++; |
|
| 2219 | + } |
|
| 2094 | 2220 | |
| 2095 | 2221 | /* Titre */ |
| 2096 | 2222 | //var_dump($line); |
@@ -2103,23 +2229,36 @@ discard block |
||
| 2103 | 2229 | <tr <?php echo $bc[$var]; $var=!$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
| 2104 | 2230 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT)) |
| 2105 | 2231 | { |
| 2106 | - if($line->qty==99) print 'background:#adadcf'; |
|
| 2107 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
| 2108 | - else if($line->qty<=97 && $line->qty>=91) print 'background:#eeeeff;'; |
|
| 2109 | - else if($line->qty==1) print 'background:#adadcf;'; |
|
| 2110 | - else if($line->qty==2) print 'background:#ddddff;'; |
|
| 2111 | - else if($line->qty==50) print ''; |
|
| 2112 | - else print 'background:#eeeeff;'; |
|
| 2232 | + if($line->qty==99) { |
|
| 2233 | + print 'background:#adadcf'; |
|
| 2234 | + } else if($line->qty==98) { |
|
| 2235 | + print 'background:#ddddff;'; |
|
| 2236 | + } else if($line->qty<=97 && $line->qty>=91) { |
|
| 2237 | + print 'background:#eeeeff;'; |
|
| 2238 | + } else if($line->qty==1) { |
|
| 2239 | + print 'background:#adadcf;'; |
|
| 2240 | + } else if($line->qty==2) { |
|
| 2241 | + print 'background:#ddddff;'; |
|
| 2242 | + } else if($line->qty==50) { |
|
| 2243 | + print ''; |
|
| 2244 | + } else { |
|
| 2245 | + print 'background:#eeeeff;'; |
|
| 2246 | + } |
|
| 2113 | 2247 | |
| 2114 | 2248 | //A compléter si on veux plus de nuances de couleurs avec les niveau 4,5,6,7,8 et 9 |
| 2115 | - } |
|
| 2116 | - else |
|
| 2249 | + } else |
|
| 2117 | 2250 | { |
| 2118 | - if($line->qty==99) print 'background:#ddffdd'; |
|
| 2119 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
| 2120 | - else if($line->qty==2) print 'background:#eeeeff; '; |
|
| 2121 | - else if($line->qty==50) print ''; |
|
| 2122 | - else print 'background:#eeffee;' ; |
|
| 2251 | + if($line->qty==99) { |
|
| 2252 | + print 'background:#ddffdd'; |
|
| 2253 | + } else if($line->qty==98) { |
|
| 2254 | + print 'background:#ddddff;'; |
|
| 2255 | + } else if($line->qty==2) { |
|
| 2256 | + print 'background:#eeeeff; '; |
|
| 2257 | + } else if($line->qty==50) { |
|
| 2258 | + print ''; |
|
| 2259 | + } else { |
|
| 2260 | + print 'background:#eeffee;' ; |
|
| 2261 | + } |
|
| 2123 | 2262 | } |
| 2124 | 2263 | |
| 2125 | 2264 | ?>;"> |
@@ -2146,13 +2285,11 @@ discard block |
||
| 2146 | 2285 | $qty_displayed = $line->qty; |
| 2147 | 2286 | print img_picto('', 'subsubtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;color:#0075DE;">'.$qty_displayed.'</span> '; |
| 2148 | 2287 | |
| 2149 | - } |
|
| 2150 | - else if (TSubtotal::isSubtotal($line)) |
|
| 2288 | + } else if (TSubtotal::isSubtotal($line)) |
|
| 2151 | 2289 | { |
| 2152 | 2290 | $qty_displayed = 100 - $line->qty; |
| 2153 | 2291 | print img_picto('', 'subsubtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;color:#0075DE;">'.$qty_displayed.'</span> '; |
| 2154 | - } |
|
| 2155 | - else |
|
| 2292 | + } else |
|
| 2156 | 2293 | { |
| 2157 | 2294 | $isFreeText = true; |
| 2158 | 2295 | } |
@@ -2173,9 +2310,13 @@ discard block |
||
| 2173 | 2310 | } |
| 2174 | 2311 | |
| 2175 | 2312 | $readonlyForSituation = ''; |
| 2176 | - if (!empty($line->fk_prev_id) && $line->fk_prev_id != null) $readonlyForSituation = 'readonly'; |
|
| 2313 | + if (!empty($line->fk_prev_id) && $line->fk_prev_id != null) { |
|
| 2314 | + $readonlyForSituation = 'readonly'; |
|
| 2315 | + } |
|
| 2177 | 2316 | |
| 2178 | - if (!$isFreeText) echo '<input type="text" name="line-title" id-line="'.$line->id.'" value="'.$newlabel.'" size="80" '.$readonlyForSituation.'/> '; |
|
| 2317 | + if (!$isFreeText) { |
|
| 2318 | + echo '<input type="text" name="line-title" id-line="'.$line->id.'" value="'.$newlabel.'" size="80" '.$readonlyForSituation.'/> '; |
|
| 2319 | + } |
|
| 2179 | 2320 | |
| 2180 | 2321 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT) && (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) ) |
| 2181 | 2322 | { |
@@ -2183,8 +2324,12 @@ discard block |
||
| 2183 | 2324 | for ($j=1; $j<10; $j++) |
| 2184 | 2325 | { |
| 2185 | 2326 | if (!empty($readonlyForSituation)) { |
| 2186 | - if ($qty_displayed == $j) $select .= '<option selected="selected" value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
|
| 2187 | - } else $select .= '<option '.($qty_displayed == $j ? 'selected="selected"' : '').' value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
|
| 2327 | + if ($qty_displayed == $j) { |
|
| 2328 | + $select .= '<option selected="selected" value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
|
| 2329 | + } |
|
| 2330 | + } else { |
|
| 2331 | + $select .= '<option '.($qty_displayed == $j ? 'selected="selected"' : '').' value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
|
| 2332 | + } |
|
| 2188 | 2333 | } |
| 2189 | 2334 | $select .= '</select> '; |
| 2190 | 2335 | |
@@ -2204,7 +2349,9 @@ discard block |
||
| 2204 | 2349 | echo '<div>'; |
| 2205 | 2350 | echo '<label for="subtotal_tva_tx">'.$form->textwithpicto($langs->trans('subtotal_apply_default_tva'), $langs->trans('subtotal_apply_default_tva_help')).'</label>'; |
| 2206 | 2351 | echo '<select id="subtotal_tva_tx" name="subtotal_tva_tx" class="flat"><option selected="selected" value="">-</option>'; |
| 2207 | - if (empty($readonlyForSituation)) echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true)); |
|
| 2352 | + if (empty($readonlyForSituation)) { |
|
| 2353 | + echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true)); |
|
| 2354 | + } |
|
| 2208 | 2355 | echo '</select>'; |
| 2209 | 2356 | echo '</div>'; |
| 2210 | 2357 | |
@@ -2223,8 +2370,9 @@ discard block |
||
| 2223 | 2370 | echo '<input style="vertical-align:sub;" type="checkbox" name="line-showReduc" id="subtotal-showReduc" value="1" '.(($line->array_options['options_show_reduc'] > 0) ? 'checked="checked"' : '') .' /> '; |
| 2224 | 2371 | echo '<label for="subtotal-showReduc">'.$langs->trans('ShowReducOnSubtotalBlock').'</label>'; |
| 2225 | 2372 | echo '</div>'; |
| 2373 | + } else if ($isFreeText) { |
|
| 2374 | + echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation); |
|
| 2226 | 2375 | } |
| 2227 | - else if ($isFreeText) echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation); |
|
| 2228 | 2376 | echo '</div>'; |
| 2229 | 2377 | |
| 2230 | 2378 | if($line->qty<10) { |
@@ -2244,8 +2392,7 @@ discard block |
||
| 2244 | 2392 | $doleditor->Create(); |
| 2245 | 2393 | } |
| 2246 | 2394 | |
| 2247 | - } |
|
| 2248 | - else { |
|
| 2395 | + } else { |
|
| 2249 | 2396 | |
| 2250 | 2397 | if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) |
| 2251 | 2398 | { |
@@ -2253,14 +2400,19 @@ discard block |
||
| 2253 | 2400 | { |
| 2254 | 2401 | echo str_repeat(' ', $line->qty-1); |
| 2255 | 2402 | |
| 2256 | - if (TSubtotal::isTitle($line)) print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
|
| 2257 | - else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
| 2403 | + if (TSubtotal::isTitle($line)) { |
|
| 2404 | + print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
|
| 2405 | + } else { |
|
| 2406 | + print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
| 2407 | + } |
|
| 2258 | 2408 | } |
| 2259 | - } |
|
| 2260 | - else |
|
| 2409 | + } else |
|
| 2261 | 2410 | { |
| 2262 | - if($line->qty<=1) print img_picto('', 'subtotal@subtotal'); |
|
| 2263 | - else if($line->qty==2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
| 2411 | + if($line->qty<=1) { |
|
| 2412 | + print img_picto('', 'subtotal@subtotal'); |
|
| 2413 | + } else if($line->qty==2) { |
|
| 2414 | + print img_picto('', 'subsubtotal@subtotal').' '; |
|
| 2415 | + } |
|
| 2264 | 2416 | } |
| 2265 | 2417 | |
| 2266 | 2418 | |
@@ -2270,21 +2422,26 @@ discard block |
||
| 2270 | 2422 | $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
| 2271 | 2423 | |
| 2272 | 2424 | if (empty($line->label)) { |
| 2273 | - if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) print $line->description.' '.$this->getTitle($object, $line); |
|
| 2274 | - else print $line->description; |
|
| 2275 | - } |
|
| 2276 | - else { |
|
| 2425 | + if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) { |
|
| 2426 | + print $line->description.' '.$this->getTitle($object, $line); |
|
| 2427 | + } else { |
|
| 2428 | + print $line->description; |
|
| 2429 | + } |
|
| 2430 | + } else { |
|
| 2277 | 2431 | |
| 2278 | 2432 | if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
| 2279 | 2433 | print '<span class="subtotal_label" style="'.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" >'.$line->label.'</span><br><div class="subtotal_desc">'.dol_htmlentitiesbr($line->description).'</div>'; |
| 2280 | - } |
|
| 2281 | - else{ |
|
| 2434 | + } else{ |
|
| 2282 | 2435 | print '<span class="subtotal_label classfortooltip '.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" title="'.$line->description.'">'.$line->label.'</span>'; |
| 2283 | 2436 | } |
| 2284 | 2437 | |
| 2285 | 2438 | } |
| 2286 | - if($line->qty>90) print ' : '; |
|
| 2287 | - if($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
| 2439 | + if($line->qty>90) { |
|
| 2440 | + print ' : '; |
|
| 2441 | + } |
|
| 2442 | + if($line->info_bits > 0) { |
|
| 2443 | + echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
| 2444 | + } |
|
| 2288 | 2445 | |
| 2289 | 2446 | |
| 2290 | 2447 | |
@@ -2327,11 +2484,12 @@ discard block |
||
| 2327 | 2484 | </script> |
| 2328 | 2485 | <?php |
| 2329 | 2486 | |
| 2330 | - } |
|
| 2331 | - else{ |
|
| 2487 | + } else{ |
|
| 2332 | 2488 | if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) && $object->element !== 'invoice_supplier') |
| 2333 | 2489 | { |
| 2334 | - if(TSubtotal::isTitle($line) && ( $line->fk_prev_id === null )) echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=duplicate&lineid='.$line->id.'">'. img_picto($langs->trans('Duplicate'), 'duplicate@subtotal').'</a>'; |
|
| 2490 | + if(TSubtotal::isTitle($line) && ( $line->fk_prev_id === null )) { |
|
| 2491 | + echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=duplicate&lineid='.$line->id.'">'. img_picto($langs->trans('Duplicate'), 'duplicate@subtotal').'</a>'; |
|
| 2492 | + } |
|
| 2335 | 2493 | } |
| 2336 | 2494 | |
| 2337 | 2495 | if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_EDIT_BLOCK)) |
@@ -2421,7 +2579,9 @@ discard block |
||
| 2421 | 2579 | $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); |
| 2422 | 2580 | |
| 2423 | 2581 | $colspan+=3; $mode = 'view'; |
| 2424 | - if($action === 'editline' && $line->rowid == GETPOST('lineid')) $mode = 'edit'; |
|
| 2582 | + if($action === 'editline' && $line->rowid == GETPOST('lineid')) { |
|
| 2583 | + $mode = 'edit'; |
|
| 2584 | + } |
|
| 2425 | 2585 | |
| 2426 | 2586 | $ex_element = $line->element; |
| 2427 | 2587 | $line->element = 'tr_extrafield_title '.$line->element; // Pour pouvoir manipuler ces tr |
@@ -2480,8 +2640,7 @@ discard block |
||
| 2480 | 2640 | |
| 2481 | 2641 | return 1; |
| 2482 | 2642 | |
| 2483 | - } |
|
| 2484 | - elseif(($object->element == 'commande' && in_array('ordershipmentcard', $contexts)) || (in_array('expeditioncard', $contexts) && $action == 'create')) |
|
| 2643 | + } elseif(($object->element == 'commande' && in_array('ordershipmentcard', $contexts)) || (in_array('expeditioncard', $contexts) && $action == 'create')) |
|
| 2485 | 2644 | { |
| 2486 | 2645 | $colspan = 4; |
| 2487 | 2646 | |
@@ -2491,23 +2650,36 @@ discard block |
||
| 2491 | 2650 | <tr <?php echo $bc[$var]; $var=!$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
| 2492 | 2651 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT)) |
| 2493 | 2652 | { |
| 2494 | - if($line->qty==99) print 'background:#adadcf'; |
|
| 2495 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
| 2496 | - else if($line->qty<=97 && $line->qty>=91) print 'background:#eeeeff;'; |
|
| 2497 | - else if($line->qty==1) print 'background:#adadcf;'; |
|
| 2498 | - else if($line->qty==2) print 'background:#ddddff;'; |
|
| 2499 | - else if($line->qty==50) print ''; |
|
| 2500 | - else print 'background:#eeeeff;'; |
|
| 2653 | + if($line->qty==99) { |
|
| 2654 | + print 'background:#adadcf'; |
|
| 2655 | + } else if($line->qty==98) { |
|
| 2656 | + print 'background:#ddddff;'; |
|
| 2657 | + } else if($line->qty<=97 && $line->qty>=91) { |
|
| 2658 | + print 'background:#eeeeff;'; |
|
| 2659 | + } else if($line->qty==1) { |
|
| 2660 | + print 'background:#adadcf;'; |
|
| 2661 | + } else if($line->qty==2) { |
|
| 2662 | + print 'background:#ddddff;'; |
|
| 2663 | + } else if($line->qty==50) { |
|
| 2664 | + print ''; |
|
| 2665 | + } else { |
|
| 2666 | + print 'background:#eeeeff;'; |
|
| 2667 | + } |
|
| 2501 | 2668 | |
| 2502 | 2669 | //A compléter si on veux plus de nuances de couleurs avec les niveau 4,5,6,7,8 et 9 |
| 2503 | - } |
|
| 2504 | - else |
|
| 2670 | + } else |
|
| 2505 | 2671 | { |
| 2506 | - if($line->qty==99) print 'background:#ddffdd'; |
|
| 2507 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
| 2508 | - else if($line->qty==2) print 'background:#eeeeff; '; |
|
| 2509 | - else if($line->qty==50) print ''; |
|
| 2510 | - else print 'background:#eeffee;' ; |
|
| 2672 | + if($line->qty==99) { |
|
| 2673 | + print 'background:#ddffdd'; |
|
| 2674 | + } else if($line->qty==98) { |
|
| 2675 | + print 'background:#ddddff;'; |
|
| 2676 | + } else if($line->qty==2) { |
|
| 2677 | + print 'background:#eeeeff; '; |
|
| 2678 | + } else if($line->qty==50) { |
|
| 2679 | + print ''; |
|
| 2680 | + } else { |
|
| 2681 | + print 'background:#eeffee;' ; |
|
| 2682 | + } |
|
| 2511 | 2683 | } |
| 2512 | 2684 | |
| 2513 | 2685 | ?>;"> |
@@ -2521,14 +2693,19 @@ discard block |
||
| 2521 | 2693 | { |
| 2522 | 2694 | echo str_repeat(' ', $line->qty-1); |
| 2523 | 2695 | |
| 2524 | - if (TSubtotal::isTitle($line)) print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
|
| 2525 | - else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
| 2696 | + if (TSubtotal::isTitle($line)) { |
|
| 2697 | + print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
|
| 2698 | + } else { |
|
| 2699 | + print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
| 2700 | + } |
|
| 2526 | 2701 | } |
| 2527 | - } |
|
| 2528 | - else |
|
| 2702 | + } else |
|
| 2529 | 2703 | { |
| 2530 | - if($line->qty<=1) print img_picto('', 'subtotal@subtotal'); |
|
| 2531 | - else if($line->qty==2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
| 2704 | + if($line->qty<=1) { |
|
| 2705 | + print img_picto('', 'subtotal@subtotal'); |
|
| 2706 | + } else if($line->qty==2) { |
|
| 2707 | + print img_picto('', 'subsubtotal@subtotal').' '; |
|
| 2708 | + } |
|
| 2532 | 2709 | } |
| 2533 | 2710 | |
| 2534 | 2711 | |
@@ -2538,21 +2715,24 @@ discard block |
||
| 2538 | 2715 | $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
| 2539 | 2716 | |
| 2540 | 2717 | if (empty($line->label)) { |
| 2541 | - if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) print $line->description.' '.$this->getTitle($object, $line); |
|
| 2542 | - else print $line->description; |
|
| 2543 | - } |
|
| 2544 | - else { |
|
| 2718 | + if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) { |
|
| 2719 | + print $line->description.' '.$this->getTitle($object, $line); |
|
| 2720 | + } else { |
|
| 2721 | + print $line->description; |
|
| 2722 | + } |
|
| 2723 | + } else { |
|
| 2545 | 2724 | |
| 2546 | 2725 | if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
| 2547 | 2726 | print '<span class="subtotal_label" style="'.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" >'.$line->label.'</span><br><div class="subtotal_desc">'.dol_htmlentitiesbr($line->description).'</div>'; |
| 2548 | - } |
|
| 2549 | - else{ |
|
| 2727 | + } else{ |
|
| 2550 | 2728 | print '<span class="subtotal_label classfortooltip '.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" title="'.$line->description.'">'.$line->label.'</span>'; |
| 2551 | 2729 | } |
| 2552 | 2730 | |
| 2553 | 2731 | } |
| 2554 | 2732 | //if($line->qty>90) print ' : '; |
| 2555 | - if($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
| 2733 | + if($line->info_bits > 0) { |
|
| 2734 | + echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
| 2735 | + } |
|
| 2556 | 2736 | |
| 2557 | 2737 | ?> |
| 2558 | 2738 | </td> |
@@ -2575,8 +2755,7 @@ discard block |
||
| 2575 | 2755 | </tr> |
| 2576 | 2756 | <?php |
| 2577 | 2757 | return 1; |
| 2578 | - } |
|
| 2579 | - elseif ($object->element == 'shipping' || $object->element == 'delivery') |
|
| 2758 | + } elseif ($object->element == 'shipping' || $object->element == 'delivery') |
|
| 2580 | 2759 | { |
| 2581 | 2760 | global $form; |
| 2582 | 2761 | |
@@ -2588,13 +2767,25 @@ discard block |
||
| 2588 | 2767 | $extralabelslines=$extrafieldsline->fetch_name_optionals_label($object->table_element_line); |
| 2589 | 2768 | |
| 2590 | 2769 | $colspan = 4; |
| 2591 | - if($object->origin && $object->origin_id > 0) $colspan++; |
|
| 2592 | - if(! empty($conf->stock->enabled)) $colspan++; |
|
| 2593 | - if(! empty($conf->productbatch->enabled)) $colspan++; |
|
| 2594 | - if($object->statut == 0) $colspan++; |
|
| 2595 | - if($object->statut == 0 && empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK)) $colspan++; |
|
| 2770 | + if($object->origin && $object->origin_id > 0) { |
|
| 2771 | + $colspan++; |
|
| 2772 | + } |
|
| 2773 | + if(! empty($conf->stock->enabled)) { |
|
| 2774 | + $colspan++; |
|
| 2775 | + } |
|
| 2776 | + if(! empty($conf->productbatch->enabled)) { |
|
| 2777 | + $colspan++; |
|
| 2778 | + } |
|
| 2779 | + if($object->statut == 0) { |
|
| 2780 | + $colspan++; |
|
| 2781 | + } |
|
| 2782 | + if($object->statut == 0 && empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK)) { |
|
| 2783 | + $colspan++; |
|
| 2784 | + } |
|
| 2596 | 2785 | |
| 2597 | - if($object->element == 'delivery') $colspan = 2; |
|
| 2786 | + if($object->element == 'delivery') { |
|
| 2787 | + $colspan = 2; |
|
| 2788 | + } |
|
| 2598 | 2789 | |
| 2599 | 2790 | print '<!-- origin line id = '.$line->origin_line_id.' -->'; // id of order line |
| 2600 | 2791 | |
@@ -2604,23 +2795,36 @@ discard block |
||
| 2604 | 2795 | <tr <?php echo $bc[$var]; $var=!$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
| 2605 | 2796 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT)) |
| 2606 | 2797 | { |
| 2607 | - if($line->qty==99) print 'background:#adadcf'; |
|
| 2608 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
| 2609 | - else if($line->qty<=97 && $line->qty>=91) print 'background:#eeeeff;'; |
|
| 2610 | - else if($line->qty==1) print 'background:#adadcf;'; |
|
| 2611 | - else if($line->qty==2) print 'background:#ddddff;'; |
|
| 2612 | - else if($line->qty==50) print ''; |
|
| 2613 | - else print 'background:#eeeeff;'; |
|
| 2798 | + if($line->qty==99) { |
|
| 2799 | + print 'background:#adadcf'; |
|
| 2800 | + } else if($line->qty==98) { |
|
| 2801 | + print 'background:#ddddff;'; |
|
| 2802 | + } else if($line->qty<=97 && $line->qty>=91) { |
|
| 2803 | + print 'background:#eeeeff;'; |
|
| 2804 | + } else if($line->qty==1) { |
|
| 2805 | + print 'background:#adadcf;'; |
|
| 2806 | + } else if($line->qty==2) { |
|
| 2807 | + print 'background:#ddddff;'; |
|
| 2808 | + } else if($line->qty==50) { |
|
| 2809 | + print ''; |
|
| 2810 | + } else { |
|
| 2811 | + print 'background:#eeeeff;'; |
|
| 2812 | + } |
|
| 2614 | 2813 | |
| 2615 | 2814 | //A compléter si on veux plus de nuances de couleurs avec les niveau 4,5,6,7,8 et 9 |
| 2616 | - } |
|
| 2617 | - else |
|
| 2815 | + } else |
|
| 2618 | 2816 | { |
| 2619 | - if($line->qty==99) print 'background:#ddffdd'; |
|
| 2620 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
| 2621 | - else if($line->qty==2) print 'background:#eeeeff; '; |
|
| 2622 | - else if($line->qty==50) print ''; |
|
| 2623 | - else print 'background:#eeffee;' ; |
|
| 2817 | + if($line->qty==99) { |
|
| 2818 | + print 'background:#ddffdd'; |
|
| 2819 | + } else if($line->qty==98) { |
|
| 2820 | + print 'background:#ddddff;'; |
|
| 2821 | + } else if($line->qty==2) { |
|
| 2822 | + print 'background:#eeeeff; '; |
|
| 2823 | + } else if($line->qty==50) { |
|
| 2824 | + print ''; |
|
| 2825 | + } else { |
|
| 2826 | + print 'background:#eeffee;' ; |
|
| 2827 | + } |
|
| 2624 | 2828 | } |
| 2625 | 2829 | |
| 2626 | 2830 | ?>;"> |
@@ -2642,14 +2846,19 @@ discard block |
||
| 2642 | 2846 | { |
| 2643 | 2847 | echo str_repeat(' ', $line->qty-1); |
| 2644 | 2848 | |
| 2645 | - if (TSubtotal::isTitle($line)) print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
|
| 2646 | - else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
| 2849 | + if (TSubtotal::isTitle($line)) { |
|
| 2850 | + print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
|
| 2851 | + } else { |
|
| 2852 | + print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
| 2853 | + } |
|
| 2647 | 2854 | } |
| 2648 | - } |
|
| 2649 | - else |
|
| 2855 | + } else |
|
| 2650 | 2856 | { |
| 2651 | - if($line->qty<=1) print img_picto('', 'subtotal@subtotal'); |
|
| 2652 | - else if($line->qty==2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
| 2857 | + if($line->qty<=1) { |
|
| 2858 | + print img_picto('', 'subtotal@subtotal'); |
|
| 2859 | + } else if($line->qty==2) { |
|
| 2860 | + print img_picto('', 'subsubtotal@subtotal').' '; |
|
| 2861 | + } |
|
| 2653 | 2862 | } |
| 2654 | 2863 | |
| 2655 | 2864 | |
@@ -2659,19 +2868,22 @@ discard block |
||
| 2659 | 2868 | $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
| 2660 | 2869 | |
| 2661 | 2870 | if (empty($line->label)) { |
| 2662 | - if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) print $line->description.' '.$this->getTitle($object, $line); |
|
| 2663 | - else print $line->description; |
|
| 2664 | - } |
|
| 2665 | - else { |
|
| 2871 | + if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) { |
|
| 2872 | + print $line->description.' '.$this->getTitle($object, $line); |
|
| 2873 | + } else { |
|
| 2874 | + print $line->description; |
|
| 2875 | + } |
|
| 2876 | + } else { |
|
| 2666 | 2877 | if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
| 2667 | 2878 | print '<span class="subtotal_label" style="'.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" >'.$line->label.'</span><br><div class="subtotal_desc">'.dol_htmlentitiesbr($line->description).'</div>'; |
| 2668 | - } |
|
| 2669 | - else{ |
|
| 2879 | + } else{ |
|
| 2670 | 2880 | print '<span class="subtotal_label classfortooltip '.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" title="'.$line->description.'">'.$line->label.'</span>'; |
| 2671 | 2881 | } |
| 2672 | 2882 | } |
| 2673 | 2883 | //if($line->qty>90) print ' : '; |
| 2674 | - if($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
| 2884 | + if($line->info_bits > 0) { |
|
| 2885 | + echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
| 2886 | + } |
|
| 2675 | 2887 | |
| 2676 | 2888 | ?> |
| 2677 | 2889 | </td> |
@@ -2851,10 +3063,9 @@ discard block |
||
| 2851 | 3063 | |
| 2852 | 3064 | if(TSubtotal::isTitle($line)){ |
| 2853 | 3065 | $ThtmlData['data-issubtotal'] = 'title'; |
| 2854 | - }elseif(TSubtotal::isSubtotal($line)){ |
|
| 3066 | + } elseif(TSubtotal::isSubtotal($line)){ |
|
| 2855 | 3067 | $ThtmlData['data-issubtotal'] = 'subtotal'; |
| 2856 | - } |
|
| 2857 | - else{ |
|
| 3068 | + } else{ |
|
| 2858 | 3069 | $ThtmlData['data-issubtotal'] = 'freetext'; |
| 2859 | 3070 | } |
| 2860 | 3071 | |
@@ -2864,7 +3075,9 @@ discard block |
||
| 2864 | 3075 | |
| 2865 | 3076 | // hook |
| 2866 | 3077 | $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
| 2867 | - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 3078 | + if ($reshook < 0) { |
|
| 3079 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 3080 | + } |
|
| 2868 | 3081 | if ($reshook>0) |
| 2869 | 3082 | { |
| 2870 | 3083 | $ThtmlData = $hookmanager->resArray; |
@@ -89,12 +89,14 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | if ($this->version == 'development') { |
| 91 | 91 | return $langs->trans("Development"); |
| 92 | - } elseif ($this->version == 'experimental') |
|
| 93 | - |
|
| 92 | + } elseif ($this->version == 'experimental') { |
|
| 93 | + |
|
| 94 | 94 | return $langs->trans("Experimental"); |
| 95 | - elseif ($this->version == 'dolibarr') return DOL_VERSION; |
|
| 96 | - elseif ($this->version) return $this->version; |
|
| 97 | - else { |
|
| 95 | + } elseif ($this->version == 'dolibarr') { |
|
| 96 | + return DOL_VERSION; |
|
| 97 | + } elseif ($this->version) { |
|
| 98 | + return $this->version; |
|
| 99 | + } else { |
|
| 98 | 100 | return $langs->trans("Unknown"); |
| 99 | 101 | } |
| 100 | 102 | } |
@@ -122,14 +124,18 @@ discard block |
||
| 122 | 124 | $subtotal_line_found = false; |
| 123 | 125 | foreach ($parent->lines as $k => &$line) |
| 124 | 126 | { |
| 125 | - if ($line->rang < $rang) continue; |
|
| 126 | - elseif ($line->rang == $rang) // Je suis sur la ligne de titre où je souhaite ajouter ma nouvelle ligne en fin de bloc |
|
| 127 | + if ($line->rang < $rang) { |
|
| 128 | + continue; |
|
| 129 | + } elseif ($line->rang == $rang) { |
|
| 130 | + // Je suis sur la ligne de titre où je souhaite ajouter ma nouvelle ligne en fin de bloc |
|
| 127 | 131 | { |
| 128 | 132 | $title_level = $line->qty; |
| 129 | 133 | } |
| 130 | - elseif (!$subtotal_line_found && $title_level > -1 && ($line->qty == 100 - $title_level)) // Le level de mon titre a été trouvé avant, donc maintenant je vais m'arrêter jusqu'à trouver un sous-total |
|
| 134 | + } elseif (!$subtotal_line_found && $title_level > -1 && ($line->qty == 100 - $title_level)) { |
|
| 135 | + // Le level de mon titre a été trouvé avant, donc maintenant je vais m'arrêter jusqu'à trouver un sous-total |
|
| 131 | 136 | { |
| 132 | 137 | $subtotal_line_found = true; |
| 138 | + } |
|
| 133 | 139 | $rang = $line->rang; |
| 134 | 140 | } |
| 135 | 141 | |
@@ -191,8 +197,11 @@ discard block |
||
| 191 | 197 | break; |
| 192 | 198 | } |
| 193 | 199 | |
| 194 | - if (!empty($conf->global->SUBTOTAL_ADD_LINE_UNDER_TITLE_AT_END_BLOCK)) $this->addToEnd($parent, $object, $rang); |
|
| 195 | - else $this->addToBegin($parent, $object, $rang); |
|
| 200 | + if (!empty($conf->global->SUBTOTAL_ADD_LINE_UNDER_TITLE_AT_END_BLOCK)) { |
|
| 201 | + $this->addToEnd($parent, $object, $rang); |
|
| 202 | + } else { |
|
| 203 | + $this->addToBegin($parent, $object, $rang); |
|
| 204 | + } |
|
| 196 | 205 | |
| 197 | 206 | } |
| 198 | 207 | |
@@ -213,8 +222,7 @@ discard block |
||
| 213 | 222 | if (!$is_supplier){ |
| 214 | 223 | $facture = new Facture($this->db); |
| 215 | 224 | $ret = $facture->fetch($object->fk_facture); |
| 216 | - } |
|
| 217 | - else |
|
| 225 | + } else |
|
| 218 | 226 | { |
| 219 | 227 | $facture = new FactureFournisseur($this->db); |
| 220 | 228 | $ret = $facture->fetch($object->fk_facture_fourn); |
@@ -225,14 +233,19 @@ discard block |
||
| 225 | 233 | $rang = !empty($subtotal_current_rang) ? $subtotal_current_rang : $object->rang; |
| 226 | 234 | // Si le fk_commande courrant est différent alors on change de commande => ajout d'un titre |
| 227 | 235 | if ($current_fk_commande != $subtotal_bloc_previous_fk_commande ) { |
| 228 | - if (!$is_supplier) $commande = new Commande($this->db); |
|
| 229 | - else $commande = new CommandeFournisseur($this->db); |
|
| 236 | + if (!$is_supplier) { |
|
| 237 | + $commande = new Commande($this->db); |
|
| 238 | + } else { |
|
| 239 | + $commande = new CommandeFournisseur($this->db); |
|
| 240 | + } |
|
| 230 | 241 | $commande->fetch($current_fk_commande); |
| 231 | 242 | |
| 232 | 243 | $label = $conf->global->SUBTOTAL_TEXT_FOR_TITLE_ORDETSTOINVOICE; |
| 233 | 244 | if (empty($label)) { |
| 234 | 245 | $label = 'Commande [__REFORDER__]'; |
| 235 | - if (!$is_supplier) $label .= ' - Référence client : [__REFCUSTOMER__]'; |
|
| 246 | + if (!$is_supplier) { |
|
| 247 | + $label .= ' - Référence client : [__REFCUSTOMER__]'; |
|
| 248 | + } |
|
| 236 | 249 | } |
| 237 | 250 | $label = str_replace(array('__REFORDER__', '__REFCUSTOMER__'), array($commande->ref, $commande->ref_client), $label); |
| 238 | 251 | |
@@ -271,7 +284,9 @@ discard block |
||
| 271 | 284 | |
| 272 | 285 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && in_array($action, array('LINEPROPAL_INSERT', 'LINEPROPAL_UPDATE', 'LINEORDER_INSERT', 'LINEORDER_UPDATE', 'LINEBILL_INSERT', 'LINEBILL_UPDATE'))) |
| 273 | 286 | { |
| 274 | - if(! function_exists('_updateLineNC')) dol_include_once('/subtotal/lib/subtotal.lib.php'); |
|
| 287 | + if(! function_exists('_updateLineNC')) { |
|
| 288 | + dol_include_once('/subtotal/lib/subtotal.lib.php'); |
|
| 289 | + } |
|
| 275 | 290 | |
| 276 | 291 | $doli_action = GETPOST('action'); |
| 277 | 292 | $set = GETPOST('set'); |
@@ -289,32 +304,50 @@ discard block |
||
| 289 | 304 | $object->total_ht = $object->total_tva = $object->total_ttc = $object->total_localtax1 = $object->total_localtax2 = |
| 290 | 305 | $object->multicurrency_total_ht = $object->multicurrency_total_tva = $object->multicurrency_total_ttc = 0; |
| 291 | 306 | |
| 292 | - if ($object->element == 'propal') $res = $object->update(1); |
|
| 293 | - else $res = $object->update($user, 1); |
|
| 307 | + if ($object->element == 'propal') { |
|
| 308 | + $res = $object->update(1); |
|
| 309 | + } else { |
|
| 310 | + $res = $object->update($user, 1); |
|
| 311 | + } |
|
| 294 | 312 | |
| 295 | - if ($res > 0) setEventMessage($langs->trans('subtotal_update_nc_success')); |
|
| 313 | + if ($res > 0) { |
|
| 314 | + setEventMessage($langs->trans('subtotal_update_nc_success')); |
|
| 315 | + } |
|
| 296 | 316 | break; |
| 297 | 317 | } |
| 298 | 318 | } |
| 299 | 319 | |
| 300 | 320 | // $object correspond à la ligne ajoutée |
| 301 | - if(empty($object->array_options)) $object->fetch_optionals(); |
|
| 321 | + if(empty($object->array_options)) { |
|
| 322 | + $object->fetch_optionals(); |
|
| 323 | + } |
|
| 302 | 324 | |
| 303 | 325 | if(! empty($object->array_options['options_subtotal_nc'])) { |
| 304 | 326 | $object->total_ht = $object->total_tva = $object->total_ttc = $object->total_localtax1 = $object->total_localtax2 = |
| 305 | 327 | $object->multicurrency_total_ht = $object->multicurrency_total_tva = $object->multicurrency_total_ttc = 0; |
| 306 | 328 | |
| 307 | - if ($object->element == 'propaldet') $res = $object->update(1); |
|
| 308 | - else $res = $object->update($user, 1); |
|
| 329 | + if ($object->element == 'propaldet') { |
|
| 330 | + $res = $object->update(1); |
|
| 331 | + } else { |
|
| 332 | + $res = $object->update($user, 1); |
|
| 333 | + } |
|
| 309 | 334 | |
| 310 | - if ($res > 0) setEventMessage($langs->trans('subtotal_update_nc_success')); |
|
| 335 | + if ($res > 0) { |
|
| 336 | + setEventMessage($langs->trans('subtotal_update_nc_success')); |
|
| 337 | + } |
|
| 311 | 338 | } |
| 312 | 339 | |
| 313 | 340 | // Correction d'un bug lors de la création d'une commande depuis une propale qui a, au moins, une ligne NC |
| 314 | 341 | $parent_element = ''; |
| 315 | - if($object->element == 'propaldet') $parent_element = 'propal'; |
|
| 316 | - if($object->element == 'commandedet') $parent_element = 'commande'; |
|
| 317 | - if($object->element == 'facturedet') $parent_element = 'facture'; |
|
| 342 | + if($object->element == 'propaldet') { |
|
| 343 | + $parent_element = 'propal'; |
|
| 344 | + } |
|
| 345 | + if($object->element == 'commandedet') { |
|
| 346 | + $parent_element = 'commande'; |
|
| 347 | + } |
|
| 348 | + if($object->element == 'facturedet') { |
|
| 349 | + $parent_element = 'facture'; |
|
| 350 | + } |
|
| 318 | 351 | |
| 319 | 352 | if(! empty($parent_element) && ! empty($object->array_options['options_subtotal_nc'])) { |
| 320 | 353 | _updateLineNC($parent_element, $object->{'fk_'.$parent_element}, $object->id, $object->array_options['options_subtotal_nc'], 1); |
@@ -514,26 +547,38 @@ discard block |
||
| 514 | 547 | ); |
| 515 | 548 | |
| 516 | 549 | // En fonction de l'objet et de la version, les lignes conservent l'id de l'objet d'origine |
| 517 | - if (method_exists($object, 'fetch_lines')) $object->fetch_lines(); |
|
| 518 | - else $object->fetch($object->id); |
|
| 550 | + if (method_exists($object, 'fetch_lines')) { |
|
| 551 | + $object->fetch_lines(); |
|
| 552 | + } else { |
|
| 553 | + $object->fetch($object->id); |
|
| 554 | + } |
|
| 519 | 555 | |
| 520 | 556 | foreach ($object->lines as &$line) |
| 521 | 557 | { |
| 522 | - if (empty($line->array_options)) $line->fetch_optionals(); |
|
| 558 | + if (empty($line->array_options)) { |
|
| 559 | + $line->fetch_optionals(); |
|
| 560 | + } |
|
| 523 | 561 | |
| 524 | 562 | if (!TSubtotal::isModSubtotalLine($line) && !empty($line->array_options['options_subtotal_nc'])) |
| 525 | 563 | { |
| 526 | 564 | $line->total_ht = $line->total_tva = $line->total_ttc = $line->total_localtax1 = $line->total_localtax2 = |
| 527 | 565 | $line->multicurrency_total_ht = $line->multicurrency_total_tva = $line->multicurrency_total_ttc = 0; |
| 528 | 566 | |
| 529 | - if ($line->element == 'propaldet') $res = $line->update(1); |
|
| 530 | - else $res = $line->update($user, 1); |
|
| 567 | + if ($line->element == 'propaldet') { |
|
| 568 | + $res = $line->update(1); |
|
| 569 | + } else { |
|
| 570 | + $res = $line->update($user, 1); |
|
| 571 | + } |
|
| 531 | 572 | |
| 532 | - if ($res > 0) setEventMessage($langs->trans('subtotal_update_nc_success')); |
|
| 573 | + if ($res > 0) { |
|
| 574 | + setEventMessage($langs->trans('subtotal_update_nc_success')); |
|
| 575 | + } |
|
| 533 | 576 | } |
| 534 | 577 | } |
| 535 | 578 | |
| 536 | - if (!empty($line)) $object->update_price(1); |
|
| 579 | + if (!empty($line)) { |
|
| 580 | + $object->update_price(1); |
|
| 581 | + } |
|
| 537 | 582 | } |
| 538 | 583 | |
| 539 | 584 | } elseif ($action == 'PROPAL_MODIFY') { |
@@ -603,9 +648,7 @@ discard block |
||
| 603 | 648 | dol_syslog( |
| 604 | 649 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
| 605 | 650 | ); |
| 606 | - } |
|
| 607 | - |
|
| 608 | - elseif ($action == 'BILL_MODIFY') { |
|
| 651 | + } elseif ($action == 'BILL_MODIFY') { |
|
| 609 | 652 | dol_syslog( |
| 610 | 653 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
| 611 | 654 | ); |