| @@ -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 | } | 
| @@ -833,10 +867,15 @@ discard block | ||
| 833 | 867 | $TTotal_tva = array(); | 
| 834 | 868 | |
| 835 | 869 | $sign=1; | 
| 836 | - if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1; | |
| 870 | +		if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) { | |
| 871 | + $sign=-1; | |
| 872 | + } | |
| 837 | 873 | |
| 838 | -		if (GETPOST('action') == 'builddoc') $builddoc = true; | |
| 839 | - else $builddoc = false; | |
| 874 | +		if (GETPOST('action') == 'builddoc') { | |
| 875 | + $builddoc = true; | |
| 876 | +		} else { | |
| 877 | + $builddoc = false; | |
| 878 | + } | |
| 840 | 879 | |
| 841 | 880 |  		dol_include_once('/subtotal/class/subtotal.class.php'); | 
| 842 | 881 | |
| @@ -845,9 +884,12 @@ discard block | ||
| 845 | 884 | foreach($TLineReverse as $l) | 
| 846 | 885 |  		{ | 
| 847 | 886 | //print $l->rang.'>='.$rang.' '.$total.'<br/>'; | 
| 848 | - if ($l->rang>=$rang) continue; | |
| 849 | - if (!empty($title_break) && $title_break->id == $l->id) break; | |
| 850 | - elseif (!TSubtotal::isModSubtotalLine($l)) | |
| 887 | +            if ($l->rang>=$rang) { | |
| 888 | + continue; | |
| 889 | + } | |
| 890 | +            if (!empty($title_break) && $title_break->id == $l->id) { | |
| 891 | + break; | |
| 892 | + } elseif (!TSubtotal::isModSubtotalLine($l)) | |
| 851 | 893 |              { | 
| 852 | 894 | // TODO retirer le test avec $builddoc quand Dolibarr affichera le total progression sur la card et pas seulement dans le PDF | 
| 853 | 895 | if ($builddoc && $object->element == 'facture' && $object->type==Facture::TYPE_SITUATION) | 
| @@ -869,8 +911,7 @@ discard block | ||
| 869 | 911 | $TTotal_tva[$l->tva_tx] += $sign * ($l->total_tva / ($l->situation_percent / 100)) * $progress; | 
| 870 | 912 | $total_ttc += $sign * ($l->total_tva / ($l->total_ttc / 100)) * $progress; | 
| 871 | 913 | } | 
| 872 | - } | |
| 873 | - else | |
| 914 | + } else | |
| 874 | 915 |                  { | 
| 875 | 916 | $total += $l->total_ht; | 
| 876 | 917 | $total_tva += $l->total_tva; | 
| @@ -879,8 +920,11 @@ discard block | ||
| 879 | 920 | } | 
| 880 | 921 | } | 
| 881 | 922 | } | 
| 882 | - if (!$return_all) return $total; | |
| 883 | - else return array($total, $total_tva, $total_ttc, $TTotal_tva); | |
| 923 | +		if (!$return_all) { | |
| 924 | + return $total; | |
| 925 | +		} else { | |
| 926 | + return array($total, $total_tva, $total_ttc, $TTotal_tva); | |
| 927 | + } | |
| 884 | 928 | } | 
| 885 | 929 | |
| 886 | 930 | /** | 
| @@ -927,15 +971,18 @@ discard block | ||
| 927 | 971 | } | 
| 928 | 972 | |
| 929 | 973 | |
| 930 | - if($line->qty==99) | |
| 931 | - $pdf->SetFillColor(220,220,220); | |
| 932 | - elseif ($line->qty==98) | |
| 933 | - $pdf->SetFillColor(230,230,230); | |
| 934 | - else | |
| 935 | - $pdf->SetFillColor(240,240,240); | |
| 974 | +		if($line->qty==99) { | |
| 975 | + $pdf->SetFillColor(220,220,220); | |
| 976 | +		} elseif ($line->qty==98) { | |
| 977 | + $pdf->SetFillColor(230,230,230); | |
| 978 | +		} else { | |
| 979 | + $pdf->SetFillColor(240,240,240); | |
| 980 | + } | |
| 936 | 981 | |
| 937 | 982 | $style = 'B'; | 
| 938 | - if (!empty($conf->global->SUBTOTAL_SUBTOTAL_STYLE)) $style = $conf->global->SUBTOTAL_SUBTOTAL_STYLE; | |
| 983 | +		if (!empty($conf->global->SUBTOTAL_SUBTOTAL_STYLE)) { | |
| 984 | + $style = $conf->global->SUBTOTAL_SUBTOTAL_STYLE; | |
| 985 | + } | |
| 939 | 986 | |
| 940 | 987 |  		$pdf->SetFont('', $style, 9); | 
| 941 | 988 | |
| @@ -977,8 +1024,7 @@ discard block | ||
| 977 | 1024 | // $line->total_tva | 
| 978 | 1025 | // $line->total | 
| 979 | 1026 | // $line->total_ttc | 
| 980 | - } | |
| 981 | - else | |
| 1027 | + } else | |
| 982 | 1028 |  				{ | 
| 983 | 1029 | // list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); | 
| 984 | 1030 | |
| @@ -988,17 +1034,22 @@ discard block | ||
| 988 | 1034 | |
| 989 | 1035 | $line->total_ht = $TInfo[0]; | 
| 990 | 1036 | $line->total = $TInfo[0]; | 
| 991 | - if (!TSubtotal::isModSubtotalLine($line)) $line->total_tva = $TInfo[1]; | |
| 1037 | +					if (!TSubtotal::isModSubtotalLine($line)) { | |
| 1038 | + $line->total_tva = $TInfo[1]; | |
| 1039 | + } | |
| 992 | 1040 | $line->total_ttc = $TInfo[2]; | 
| 993 | 1041 | } | 
| 994 | 1042 | } | 
| 995 | 1043 | |
| 996 | 1044 | $pdf->SetXY($pdf->postotalht, $posy); | 
| 997 | - if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); | |
| 1045 | +			if($set_pagebreak_margin) { | |
| 1046 | + $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); | |
| 1047 | + } | |
| 998 | 1048 | $pdf->MultiCell($pdf->page_largeur-$pdf->marge_droite-$pdf->postotalht, 3, $total_to_print, 0, 'R', 0); | 
| 999 | - } | |
| 1000 | -		else{ | |
| 1001 | - if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); | |
| 1049 | +		} else{ | |
| 1050 | +			if($set_pagebreak_margin) { | |
| 1051 | + $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); | |
| 1052 | + } | |
| 1002 | 1053 | } | 
| 1003 | 1054 | |
| 1004 | 1055 | $posy = $posy + $cell_height; | 
| @@ -1030,25 +1081,40 @@ discard block | ||
| 1030 | 1081 | |
| 1031 | 1082 | |
| 1032 | 1083 | $style = ($line->qty==1) ? 'BU' : 'BUI'; | 
| 1033 | - if (!empty($conf->global->SUBTOTAL_TITLE_STYLE)) $style = $conf->global->SUBTOTAL_TITLE_STYLE; | |
| 1084 | +		if (!empty($conf->global->SUBTOTAL_TITLE_STYLE)) { | |
| 1085 | + $style = $conf->global->SUBTOTAL_TITLE_STYLE; | |
| 1086 | + } | |
| 1034 | 1087 | |
| 1035 | 1088 |  		if($hideInnerLines) { | 
| 1036 | -			if($line->qty==1)$pdf->SetFont('', $style, 9); | |
| 1037 | - else | |
| 1089 | +			if($line->qty==1) { | |
| 1090 | +				$pdf->SetFont('', $style, 9); | |
| 1091 | + } else | |
| 1038 | 1092 |  			{ | 
| 1039 | - if (!empty($conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES)) $style = $conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES; | |
| 1093 | +				if (!empty($conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES)) { | |
| 1094 | + $style = $conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES; | |
| 1095 | + } | |
| 1040 | 1096 |  				$pdf->SetFont('', $style, 9); | 
| 1041 | 1097 | } | 
| 1042 | - } | |
| 1043 | -		else { | |
| 1098 | +		} else { | |
| 1044 | 1099 | |
| 1045 | -			if($line->qty==1)$pdf->SetFont('', $style, 9); //TODO if super utile | |
| 1046 | -			else $pdf->SetFont('', $style, 9); | |
| 1100 | +			if($line->qty==1) { | |
| 1101 | +				$pdf->SetFont('', $style, 9); | |
| 1102 | + } | |
| 1103 | + //TODO if super utile | |
| 1104 | +			else { | |
| 1105 | +				$pdf->SetFont('', $style, 9); | |
| 1106 | + } | |
| 1047 | 1107 | |
| 1048 | 1108 | } | 
| 1049 | 1109 | |
| 1050 | - 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 | |
| 1051 | - else $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J',true); // et maintenant avec du HTML | |
| 1110 | +		if ($label === strip_tags($label) && $label === dol_html_entity_decode($label, ENT_QUOTES)) { | |
| 1111 | + $pdf->MultiCell($w, $h, $label, 0, 'L'); | |
| 1112 | + } | |
| 1113 | + // Pas de HTML dans la chaine | |
| 1114 | +		else { | |
| 1115 | + $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J',true); | |
| 1116 | + } | |
| 1117 | + // et maintenant avec du HTML | |
| 1052 | 1118 | |
| 1053 | 1119 |  		if($description && !$hidedesc) { | 
| 1054 | 1120 | $posy = $pdf->GetY(); | 
| @@ -1072,8 +1138,7 @@ discard block | ||
| 1072 | 1138 | |
| 1073 | 1139 |  		if(is_array($parameters)) { | 
| 1074 | 1140 | $i = & $parameters['i']; | 
| 1075 | - } | |
| 1076 | -		else { | |
| 1141 | +		} else { | |
| 1077 | 1142 | $i = (int)$parameters; | 
| 1078 | 1143 | } | 
| 1079 | 1144 | |
| @@ -1103,17 +1168,14 @@ discard block | ||
| 1103 | 1168 | |
| 1104 | 1169 |  			if((float)DOL_VERSION<=3.6) { | 
| 1105 | 1170 | return ''; | 
| 1106 | - } | |
| 1107 | -			else if((float)DOL_VERSION>=3.8) { | |
| 1171 | +			} else if((float)DOL_VERSION>=3.8) { | |
| 1108 | 1172 | return 1; | 
| 1109 | 1173 | } | 
| 1110 | 1174 | |
| 1111 | - } | |
| 1112 | -		elseif(!empty($hideprices)) { | |
| 1175 | +		} elseif(!empty($hideprices)) { | |
| 1113 | 1176 | $this->resprints = $object->lines[$parameters['i']]->qty; | 
| 1114 | 1177 | return 1; | 
| 1115 | - } | |
| 1116 | - elseif (!empty($conf->global->SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY)) | |
| 1178 | + } elseif (!empty($conf->global->SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY)) | |
| 1117 | 1179 |  		{ | 
| 1118 | 1180 |  			$hideInnerLines = (int)GETPOST('hideInnerLines'); | 
| 1119 | 1181 |  			$hidedetails = (int)GETPOST('hidedetails'); | 
| @@ -1123,12 +1185,20 @@ discard block | ||
| 1123 | 1185 | } | 
| 1124 | 1186 | } | 
| 1125 | 1187 | |
| 1126 | - if(is_array($parameters)) $i = & $parameters['i']; | |
| 1127 | - else $i = (int)$parameters; | |
| 1188 | +		if(is_array($parameters)) { | |
| 1189 | + $i = & $parameters['i']; | |
| 1190 | +		} else { | |
| 1191 | + $i = (int)$parameters; | |
| 1192 | + } | |
| 1128 | 1193 | |
| 1129 | - 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) | |
| 1194 | +		if (empty($object->lines[$i])) { | |
| 1195 | + return 0; | |
| 1196 | + } | |
| 1197 | + // 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) | |
| 1130 | 1198 | |
| 1131 | - if(empty($object->lines[$i]->array_options)) $object->lines[$i]->fetch_optionals(); | |
| 1199 | +		if(empty($object->lines[$i]->array_options)) { | |
| 1200 | + $object->lines[$i]->fetch_optionals(); | |
| 1201 | + } | |
| 1132 | 1202 | |
| 1133 | 1203 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) | 
| 1134 | 1204 |  		{ | 
| @@ -1145,8 +1215,11 @@ discard block | ||
| 1145 | 1215 |  	function pdf_getlinetotalexcltax($parameters=array(), &$object, &$action='') { | 
| 1146 | 1216 | global $conf, $hideprices, $hookmanager; | 
| 1147 | 1217 | |
| 1148 | - if(is_array($parameters)) $i = & $parameters['i']; | |
| 1149 | - else $i = (int)$parameters; | |
| 1218 | +		if(is_array($parameters)) { | |
| 1219 | + $i = & $parameters['i']; | |
| 1220 | +		} else { | |
| 1221 | + $i = (int)$parameters; | |
| 1222 | + } | |
| 1150 | 1223 | |
| 1151 | 1224 |  		if($this->isModSubtotalLine($parameters,$object) ){ | 
| 1152 | 1225 | |
| @@ -1154,13 +1227,11 @@ discard block | ||
| 1154 | 1227 | |
| 1155 | 1228 |  			if((float)DOL_VERSION<=3.6) { | 
| 1156 | 1229 | return ''; | 
| 1157 | - } | |
| 1158 | -			else if((float)DOL_VERSION>=3.8) { | |
| 1230 | +			} else if((float)DOL_VERSION>=3.8) { | |
| 1159 | 1231 | return 1; | 
| 1160 | 1232 | } | 
| 1161 | 1233 | |
| 1162 | - } | |
| 1163 | - elseif (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS)) | |
| 1234 | + } elseif (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS)) | |
| 1164 | 1235 |  		{ | 
| 1165 | 1236 |  			if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) | 
| 1166 | 1237 |  			{ | 
| @@ -1232,12 +1303,10 @@ discard block | ||
| 1232 | 1303 | $this->error = $hookmanager->error; | 
| 1233 | 1304 | $this->errors = $hookmanager->errors; | 
| 1234 | 1305 | return -1; | 
| 1235 | - } | |
| 1236 | - elseif (empty($reshook)) | |
| 1306 | + } elseif (empty($reshook)) | |
| 1237 | 1307 |  		{ | 
| 1238 | 1308 | $this->resprints .= $hookmanager->resprints; | 
| 1239 | - } | |
| 1240 | - else | |
| 1309 | + } else | |
| 1241 | 1310 |  		{ | 
| 1242 | 1311 | $this->resprints = $hookmanager->resprints; | 
| 1243 | 1312 | |
| @@ -1260,14 +1329,16 @@ discard block | ||
| 1260 | 1329 | |
| 1261 | 1330 |  			if((float)DOL_VERSION<=3.6) { | 
| 1262 | 1331 | return ''; | 
| 1263 | - } | |
| 1264 | -			else if((float)DOL_VERSION>=3.8) { | |
| 1332 | +			} else if((float)DOL_VERSION>=3.8) { | |
| 1265 | 1333 | return 1; | 
| 1266 | 1334 | } | 
| 1267 | 1335 | } | 
| 1268 | 1336 | |
| 1269 | - if(is_array($parameters)) $i = & $parameters['i']; | |
| 1270 | - else $i = (int)$parameters; | |
| 1337 | +		if(is_array($parameters)) { | |
| 1338 | + $i = & $parameters['i']; | |
| 1339 | +		} else { | |
| 1340 | + $i = (int)$parameters; | |
| 1341 | + } | |
| 1271 | 1342 | |
| 1272 | 1343 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) | 
| 1273 | 1344 |  		{ | 
| @@ -1289,14 +1360,16 @@ discard block | ||
| 1289 | 1360 | |
| 1290 | 1361 |  			if((float)DOL_VERSION<=3.6) { | 
| 1291 | 1362 | return ''; | 
| 1292 | - } | |
| 1293 | -			else if((float)DOL_VERSION>=3.8) { | |
| 1363 | +			} else if((float)DOL_VERSION>=3.8) { | |
| 1294 | 1364 | return 1; | 
| 1295 | 1365 | } | 
| 1296 | 1366 | } | 
| 1297 | 1367 | |
| 1298 | - if(is_array($parameters)) $i = & $parameters['i']; | |
| 1299 | - else $i = (int)$parameters; | |
| 1368 | +		if(is_array($parameters)) { | |
| 1369 | + $i = & $parameters['i']; | |
| 1370 | +		} else { | |
| 1371 | + $i = (int)$parameters; | |
| 1372 | + } | |
| 1300 | 1373 | |
| 1301 | 1374 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) | 
| 1302 | 1375 |  		{ | 
| @@ -1313,8 +1386,11 @@ discard block | ||
| 1313 | 1386 |  	function pdf_getlineupexcltax($parameters=array(), &$object, &$action='') { | 
| 1314 | 1387 | global $conf,$hideprices,$hookmanager; | 
| 1315 | 1388 | |
| 1316 | - if(is_array($parameters)) $i = & $parameters['i']; | |
| 1317 | - else $i = (int)$parameters; | |
| 1389 | +		if(is_array($parameters)) { | |
| 1390 | + $i = & $parameters['i']; | |
| 1391 | +		} else { | |
| 1392 | + $i = (int)$parameters; | |
| 1393 | + } | |
| 1318 | 1394 | |
| 1319 | 1395 |  		if($this->isModSubtotalLine($parameters,$object) ) { | 
| 1320 | 1396 | $this->resprints = ' '; | 
| @@ -1325,7 +1401,9 @@ discard block | ||
| 1325 | 1401 |              if(TSubtotal::isSubtotal($line)) { | 
| 1326 | 1402 | $parentTitle = TSubtotal::getParentTitleOfLine($object, $i); | 
| 1327 | 1403 | |
| 1328 | - if(is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); | |
| 1404 | +                if(is_object($parentTitle) && empty($parentTitle->array_options)) { | |
| 1405 | + $parentTitle->fetch_optionals(); | |
| 1406 | + } | |
| 1329 | 1407 |                  if(! empty($parentTitle->array_options['options_show_total_ht'])) { | 
| 1330 | 1408 | $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle); | 
| 1331 | 1409 | $this->resprints = price($TTotal['total_unit_subprice']); | 
| @@ -1334,8 +1412,7 @@ discard block | ||
| 1334 | 1412 | |
| 1335 | 1413 |  			if((float)DOL_VERSION<=3.6) { | 
| 1336 | 1414 | return ''; | 
| 1337 | - } | |
| 1338 | -			else if((float)DOL_VERSION>=3.8) { | |
| 1415 | +			} else if((float)DOL_VERSION>=3.8) { | |
| 1339 | 1416 | return 1; | 
| 1340 | 1417 | } | 
| 1341 | 1418 | } | 
| @@ -1380,8 +1457,11 @@ discard block | ||
| 1380 | 1457 |  	function pdf_getlineremisepercent($parameters=array(), &$object, &$action='') { | 
| 1381 | 1458 | global $conf,$hideprices,$hookmanager; | 
| 1382 | 1459 | |
| 1383 | - if(is_array($parameters)) $i = & $parameters['i']; | |
| 1384 | - else $i = (int) $parameters; | |
| 1460 | +        if(is_array($parameters)) { | |
| 1461 | + $i = & $parameters['i']; | |
| 1462 | +        } else { | |
| 1463 | + $i = (int) $parameters; | |
| 1464 | + } | |
| 1385 | 1465 | |
| 1386 | 1466 |  		if($this->isModSubtotalLine($parameters,$object) ) { | 
| 1387 | 1467 | $this->resprints = ' '; | 
| @@ -1392,7 +1472,9 @@ discard block | ||
| 1392 | 1472 |              if(TSubtotal::isSubtotal($line)) { | 
| 1393 | 1473 | $parentTitle = TSubtotal::getParentTitleOfLine($object, $i); | 
| 1394 | 1474 | |
| 1395 | - if(empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); | |
| 1475 | +                if(empty($parentTitle->array_options)) { | |
| 1476 | + $parentTitle->fetch_optionals(); | |
| 1477 | + } | |
| 1396 | 1478 |                  if(! empty($parentTitle->array_options['options_show_reduc'])) { | 
| 1397 | 1479 | $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle); | 
| 1398 | 1480 | $this->resprints = price((1-$TTotal['total_ht'] / $TTotal['total_subprice'])*100, 0, '', 1, 2, 2).'%'; | 
| @@ -1401,12 +1483,10 @@ discard block | ||
| 1401 | 1483 | |
| 1402 | 1484 |  			if((float)DOL_VERSION<=3.6) { | 
| 1403 | 1485 | return ''; | 
| 1404 | - } | |
| 1405 | -			else if((float)DOL_VERSION>=3.8) { | |
| 1486 | +			} else if((float)DOL_VERSION>=3.8) { | |
| 1406 | 1487 | return 1; | 
| 1407 | 1488 | } | 
| 1408 | - } | |
| 1409 | - elseif (!empty($hideprices) | |
| 1489 | + } elseif (!empty($hideprices) | |
| 1410 | 1490 | || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) | 
| 1411 | 1491 | ) | 
| 1412 | 1492 |  		    { | 
| @@ -1427,14 +1507,16 @@ discard block | ||
| 1427 | 1507 | $this->resprints = ' '; | 
| 1428 | 1508 |  			if((float)DOL_VERSION<=3.6) { | 
| 1429 | 1509 | return ''; | 
| 1430 | - } | |
| 1431 | -			else if((float)DOL_VERSION>=3.8) { | |
| 1510 | +			} else if((float)DOL_VERSION>=3.8) { | |
| 1432 | 1511 | return 1; | 
| 1433 | 1512 | } | 
| 1434 | 1513 | } | 
| 1435 | 1514 | |
| 1436 | - if(is_array($parameters)) $i = & $parameters['i']; | |
| 1437 | - else $i = (int)$parameters; | |
| 1515 | +		if(is_array($parameters)) { | |
| 1516 | + $i = & $parameters['i']; | |
| 1517 | +		} else { | |
| 1518 | + $i = (int)$parameters; | |
| 1519 | + } | |
| 1438 | 1520 | |
| 1439 | 1521 | if (!empty($hideprices) | 
| 1440 | 1522 | || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) | 
| @@ -1458,16 +1540,21 @@ discard block | ||
| 1458 | 1540 | |
| 1459 | 1541 |  			if((float)DOL_VERSION<=3.6) { | 
| 1460 | 1542 | return ''; | 
| 1461 | - } | |
| 1462 | -			else if((float)DOL_VERSION>=3.8) { | |
| 1543 | +			} else if((float)DOL_VERSION>=3.8) { | |
| 1463 | 1544 | return 1; | 
| 1464 | 1545 | } | 
| 1465 | 1546 | } | 
| 1466 | 1547 | |
| 1467 | - if(is_array($parameters)) $i = & $parameters['i']; | |
| 1468 | - else $i = (int)$parameters; | |
| 1548 | +		if(is_array($parameters)) { | |
| 1549 | + $i = & $parameters['i']; | |
| 1550 | +		} else { | |
| 1551 | + $i = (int)$parameters; | |
| 1552 | + } | |
| 1469 | 1553 | |
| 1470 | - 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) | |
| 1554 | +		if (empty($object->lines[$i])) { | |
| 1555 | + return 0; | |
| 1556 | + } | |
| 1557 | + // 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) | |
| 1471 | 1558 | |
| 1472 | 1559 | $object->lines[$i]->fetch_optionals(); | 
| 1473 | 1560 | // Si la gestion C/NC est active et que je suis sur un ligne dont l'extrafield est coché | 
| @@ -1513,14 +1600,16 @@ discard block | ||
| 1513 | 1600 | $this->resprints = ' '; | 
| 1514 | 1601 |  			if((float)DOL_VERSION<=3.6) { | 
| 1515 | 1602 | return ''; | 
| 1516 | - } | |
| 1517 | -			else if((float)DOL_VERSION>=3.8) { | |
| 1603 | +			} else if((float)DOL_VERSION>=3.8) { | |
| 1518 | 1604 | return 1; | 
| 1519 | 1605 | } | 
| 1520 | 1606 | } | 
| 1521 | 1607 | |
| 1522 | - if(is_array($parameters)) $i = & $parameters['i']; | |
| 1523 | - else $i = (int)$parameters; | |
| 1608 | +		if(is_array($parameters)) { | |
| 1609 | + $i = & $parameters['i']; | |
| 1610 | +		} else { | |
| 1611 | + $i = (int)$parameters; | |
| 1612 | + } | |
| 1524 | 1613 | |
| 1525 | 1614 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) | 
| 1526 | 1615 |  		{ | 
| @@ -1550,7 +1639,9 @@ discard block | ||
| 1550 | 1639 | } | 
| 1551 | 1640 | } | 
| 1552 | 1641 | |
| 1553 | - if (!empty($TLineTitle)) $TTitleNumeroted = $this->formatNumerotation($TLineTitle); | |
| 1642 | +			if (!empty($TLineTitle)) { | |
| 1643 | + $TTitleNumeroted = $this->formatNumerotation($TLineTitle); | |
| 1644 | + } | |
| 1554 | 1645 | } | 
| 1555 | 1646 | |
| 1556 | 1647 | } | 
| @@ -1564,8 +1655,12 @@ discard block | ||
| 1564 | 1655 | $j=0; | 
| 1565 | 1656 | foreach ($TLineTitle as $k => &$line) | 
| 1566 | 1657 |  		{ | 
| 1567 | - if (!empty($line_reference) && $line->rang <= $line_reference->rang) continue; | |
| 1568 | - if (!empty($line_reference) && $line->qty <= $line_reference->qty) break; | |
| 1658 | +			if (!empty($line_reference) && $line->rang <= $line_reference->rang) { | |
| 1659 | + continue; | |
| 1660 | + } | |
| 1661 | +			if (!empty($line_reference) && $line->qty <= $line_reference->qty) { | |
| 1662 | + break; | |
| 1663 | + } | |
| 1569 | 1664 | |
| 1570 | 1665 | if ($line->qty == $level) | 
| 1571 | 1666 |  			{ | 
| @@ -1599,7 +1694,9 @@ discard block | ||
| 1599 | 1694 | |
| 1600 | 1695 |  		$hidedetails = (int)GETPOST('hidedetails'); | 
| 1601 | 1696 | |
| 1602 | - if(empty($hidedetails)) return false; | |
| 1697 | +		if(empty($hidedetails)) { | |
| 1698 | + return false; | |
| 1699 | + } | |
| 1603 | 1700 | |
| 1604 | 1701 | // TODO can't add VAT to document without lines... :-/ | 
| 1605 | 1702 | |
| @@ -1627,7 +1724,9 @@ discard block | ||
| 1627 | 1724 |          foreach($object->lines as $k => &$l) { | 
| 1628 | 1725 |              if(TSubtotal::isSubtotal($l)) { | 
| 1629 | 1726 | $parentTitle = TSubtotal::getParentTitleOfLine($object, $k); | 
| 1630 | - if(is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); | |
| 1727 | +                if(is_object($parentTitle) && empty($parentTitle->array_options)) { | |
| 1728 | + $parentTitle->fetch_optionals(); | |
| 1729 | + } | |
| 1631 | 1730 |                  if(! empty($parentTitle->id) && ! empty($parentTitle->array_options['options_show_reduc'])) { | 
| 1632 | 1731 | $l->remise_percent = 100; // Affichage de la réduction sur la ligne de sous-total | 
| 1633 | 1732 | } | 
| @@ -1671,7 +1770,9 @@ discard block | ||
| 1671 | 1770 | |
| 1672 | 1771 | $TInfo = $this->getTotalLineFromObject($object, $line, '', 1); | 
| 1673 | 1772 | |
| 1674 | - if (TSubtotal::getNiveau($line) == 1) $line->TTotal_tva = $TInfo[3]; | |
| 1773 | +						if (TSubtotal::getNiveau($line) == 1) { | |
| 1774 | + $line->TTotal_tva = $TInfo[3]; | |
| 1775 | + } | |
| 1675 | 1776 | $line->total_ht = $TInfo[0]; | 
| 1676 | 1777 | $line->total_tva = $TInfo[1]; | 
| 1677 | 1778 | $line->total = $line->total_ht; | 
| @@ -1735,8 +1836,7 @@ discard block | ||
| 1735 | 1836 | } | 
| 1736 | 1837 | |
| 1737 | 1838 | |
| 1738 | - } | |
| 1739 | - elseif ($hidedetails) | |
| 1839 | + } elseif ($hidedetails) | |
| 1740 | 1840 |  				{ | 
| 1741 | 1841 | $TLines[] = $line; //Cas où je cache uniquement les prix des produits | 
| 1742 | 1842 | } | 
| @@ -1807,13 +1907,17 @@ discard block | ||
| 1807 | 1907 | |
| 1808 | 1908 |  				if(!empty($hideprices)) { | 
| 1809 | 1909 |  					foreach($object->lines as &$line) { | 
| 1810 | - if($line->fk_product_type!=9) $line->fk_parent_line = -1; | |
| 1910 | +						if($line->fk_product_type!=9) { | |
| 1911 | + $line->fk_parent_line = -1; | |
| 1912 | + } | |
| 1811 | 1913 | } | 
| 1812 | 1914 | } | 
| 1813 | 1915 | |
| 1814 | 1916 | $line = &$object->lines[$i]; | 
| 1815 | 1917 | |
| 1816 | - if($object->element == 'delivery' && ! empty($object->commande->expeditions[$line->fk_origin_line])) unset($object->commande->expeditions[$line->fk_origin_line]); | |
| 1918 | +				if($object->element == 'delivery' && ! empty($object->commande->expeditions[$line->fk_origin_line])) { | |
| 1919 | + unset($object->commande->expeditions[$line->fk_origin_line]); | |
| 1920 | + } | |
| 1817 | 1921 | |
| 1818 | 1922 |  				if($line->info_bits>0) { // PAGE BREAK | 
| 1819 | 1923 | $pdf->addPage(); | 
| @@ -1829,7 +1933,9 @@ discard block | ||
| 1829 | 1933 | } | 
| 1830 | 1934 | |
| 1831 | 1935 |  				if($line->qty>90) { | 
| 1832 | - if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) $label .= ' '.$this->getTitle($object, $line); | |
| 1936 | +					if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) { | |
| 1937 | + $label .= ' '.$this->getTitle($object, $line); | |
| 1938 | + } | |
| 1833 | 1939 | |
| 1834 | 1940 | $pageBefore = $pdf->getPage(); | 
| 1835 | 1941 | $this->pdf_add_total($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); | 
| @@ -1867,8 +1973,7 @@ discard block | ||
| 1867 | 1973 | |
| 1868 | 1974 | $posy = $pdf->GetY(); | 
| 1869 | 1975 | return 1; | 
| 1870 | - } | |
| 1871 | -				else if ($line->qty < 10) { | |
| 1976 | +				} else if ($line->qty < 10) { | |
| 1872 | 1977 | $pageBefore = $pdf->getPage(); | 
| 1873 | 1978 | |
| 1874 | 1979 | $this->pdf_add_title($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); | 
| @@ -1898,8 +2003,7 @@ discard block | ||
| 1898 | 2003 | // if($line->rowid==47) exit; | 
| 1899 | 2004 | |
| 1900 | 2005 | return 0; | 
| 1901 | - } | |
| 1902 | - elseif (empty($object->lines[$parameters['i']])) | |
| 2006 | + } elseif (empty($object->lines[$parameters['i']])) | |
| 1903 | 2007 |  		{ | 
| 1904 | 2008 | $this->resprints = -1; | 
| 1905 | 2009 | } | 
| @@ -1932,7 +2036,9 @@ discard block | ||
| 1932 | 2036 | |
| 1933 | 2037 | foreach ($object->lines as $line) | 
| 1934 | 2038 |  		{ | 
| 1935 | - if ($line->id == $currentLine->id) break; | |
| 2039 | +			if ($line->id == $currentLine->id) { | |
| 2040 | + break; | |
| 2041 | + } | |
| 1936 | 2042 | |
| 1937 | 2043 | $qty_search = 100 - $currentLine->qty; | 
| 1938 | 2044 | |
| @@ -1963,7 +2069,9 @@ discard block | ||
| 1963 | 2069 | $var = &$parameters['var']; | 
| 1964 | 2070 | |
| 1965 | 2071 |  		$contexts = explode(':',$parameters['context']); | 
| 1966 | - if($parameters['currentcontext'] === 'paiementcard') return 0; | |
| 2072 | +		if($parameters['currentcontext'] === 'paiementcard') { | |
| 2073 | + return 0; | |
| 2074 | + } | |
| 1967 | 2075 | $originline = null; | 
| 1968 | 2076 | |
| 1969 | 2077 |  		$createRight = $user->rights->{$object->element}->creer; | 
| @@ -1971,22 +2079,18 @@ discard block | ||
| 1971 | 2079 |  		{ | 
| 1972 | 2080 | $object->statut = 0; // hack for facture rec | 
| 1973 | 2081 | $createRight = $user->rights->facture->creer; | 
| 1974 | - } | |
| 1975 | - elseif($object->element == 'order_supplier' ) | |
| 2082 | + } elseif($object->element == 'order_supplier' ) | |
| 1976 | 2083 |  		{ | 
| 1977 | 2084 | $createRight = $user->rights->fournisseur->commande->creer; | 
| 1978 | - } | |
| 1979 | - elseif($object->element == 'invoice_supplier' ) | |
| 2085 | + } elseif($object->element == 'invoice_supplier' ) | |
| 1980 | 2086 |  		{ | 
| 1981 | 2087 | $createRight = $user->rights->fournisseur->facture->creer; | 
| 1982 | - } | |
| 1983 | -		elseif($object->element == 'commande' && in_array('ordershipmentcard', $contexts)) | |
| 2088 | +		} elseif($object->element == 'commande' && in_array('ordershipmentcard', $contexts)) | |
| 1984 | 2089 |  		{ | 
| 1985 | 2090 | // H4cK 4n0nYm0u$-style : $line n'est pas un objet instancié mais provient d'un fetch_object d'une requête SQL | 
| 1986 | 2091 | $line->id = $line->rowid; | 
| 1987 | 2092 | $line->product_type = $line->type; | 
| 1988 | - } | |
| 1989 | - elseif($object->element == 'shipping' || $object->element == 'delivery') | |
| 2093 | + } elseif($object->element == 'shipping' || $object->element == 'delivery') | |
| 1990 | 2094 |  		{ | 
| 1991 | 2095 | if(empty($line->origin_line_id) && ! empty($line->fk_origin_line)) | 
| 1992 | 2096 |  			{ | 
| @@ -2006,8 +2110,11 @@ discard block | ||
| 2006 | 2110 | |
| 2007 | 2111 | $line = $originline; | 
| 2008 | 2112 | } | 
| 2009 | - if($object->element=='facture')$idvar = 'facid'; | |
| 2010 | - else $idvar='id'; | |
| 2113 | + 		if($object->element=='facture') { | |
| 2114 | + $idvar = 'facid'; | |
| 2115 | + 		} else { | |
| 2116 | + $idvar='id'; | |
| 2117 | + } | |
| 2011 | 2118 |  		if($line->special_code!=$this->module_number || $line->product_type!=9) { | 
| 2012 | 2119 | if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_LINE) && $object->element !== 'invoice_supplier') | 
| 2013 | 2120 |              { | 
| @@ -2025,8 +2132,7 @@ discard block | ||
| 2025 | 2132 | |
| 2026 | 2133 | } | 
| 2027 | 2134 | return 0; | 
| 2028 | - } | |
| 2029 | -		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))  | |
| 2135 | +		} 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))  | |
| 2030 | 2136 |          { | 
| 2031 | 2137 | |
| 2032 | 2138 | |
| @@ -2053,23 +2159,45 @@ discard block | ||
| 2053 | 2159 | </script> | 
| 2054 | 2160 | <?php | 
| 2055 | 2161 | } | 
| 2056 | - if(empty($line->description)) $line->description = $line->desc; | |
| 2162 | +			if(empty($line->description)) { | |
| 2163 | + $line->description = $line->desc; | |
| 2164 | + } | |
| 2057 | 2165 | $colspan = 5; | 
| 2058 | - if($object->element == 'facturerec' ) $colspan = 3; | |
| 2059 | - if($object->element == 'order_supplier') (float) DOL_VERSION < 7.0 ? $colspan = 3 : $colspan = 6; | |
| 2060 | - if($object->element == 'invoice_supplier') (float) DOL_VERSION < 7.0 ? $colspan = 4: $colspan = 7; | |
| 2061 | - if($object->element == 'supplier_proposal') (float) DOL_VERSION < 6.0 ? $colspan = 4 : $colspan = 3; | |
| 2166 | +			if($object->element == 'facturerec' ) { | |
| 2167 | + $colspan = 3; | |
| 2168 | + } | |
| 2169 | +			if($object->element == 'order_supplier') { | |
| 2170 | + (float) DOL_VERSION < 7.0 ? $colspan = 3 : $colspan = 6; | |
| 2171 | + } | |
| 2172 | +			if($object->element == 'invoice_supplier') { | |
| 2173 | + (float) DOL_VERSION < 7.0 ? $colspan = 4: $colspan = 7; | |
| 2174 | + } | |
| 2175 | +			if($object->element == 'supplier_proposal') { | |
| 2176 | + (float) DOL_VERSION < 6.0 ? $colspan = 4 : $colspan = 3; | |
| 2177 | + } | |
| 2062 | 2178 |  			if(!empty($conf->multicurrency->enabled) && ((float) DOL_VERSION < 8.0 || $object->multicurrency_code != $conf->currency)) { | 
| 2063 | 2179 | $colspan++; // Colonne PU Devise | 
| 2064 | 2180 | } | 
| 2065 | - if($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) $colspan++; | |
| 2181 | +			if($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) { | |
| 2182 | + $colspan++; | |
| 2183 | + } | |
| 2066 | 2184 | |
| 2067 | 2185 | $margins_hidden_by_module = empty($conf->affmarges->enabled) ? false : !($_SESSION['marginsdisplayed']); | 
| 2068 | - if(!empty($conf->margin->enabled) && !$margins_hidden_by_module) $colspan++; | |
| 2069 | - if(!empty($conf->global->DISPLAY_MARGIN_RATES) && !$margins_hidden_by_module) $colspan++; | |
| 2070 | - if(!empty($conf->global->DISPLAY_MARK_RATES) && !$margins_hidden_by_module) $colspan++; | |
| 2071 | - if($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) $colspan++; | |
| 2072 | - if(!empty($conf->global->PRODUCT_USE_UNITS)) $colspan++; | |
| 2186 | +			if(!empty($conf->margin->enabled) && !$margins_hidden_by_module) { | |
| 2187 | + $colspan++; | |
| 2188 | + } | |
| 2189 | +			if(!empty($conf->global->DISPLAY_MARGIN_RATES) && !$margins_hidden_by_module) { | |
| 2190 | + $colspan++; | |
| 2191 | + } | |
| 2192 | +			if(!empty($conf->global->DISPLAY_MARK_RATES) && !$margins_hidden_by_module) { | |
| 2193 | + $colspan++; | |
| 2194 | + } | |
| 2195 | +			if($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) { | |
| 2196 | + $colspan++; | |
| 2197 | + } | |
| 2198 | +			if(!empty($conf->global->PRODUCT_USE_UNITS)) { | |
| 2199 | + $colspan++; | |
| 2200 | + } | |
| 2073 | 2201 | |
| 2074 | 2202 | /* Titre */ | 
| 2075 | 2203 | //var_dump($line); | 
| @@ -2082,23 +2210,36 @@ discard block | ||
| 2082 | 2210 | <tr <?php echo $bc[$var]; $var=!$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php | 
| 2083 | 2211 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT)) | 
| 2084 | 2212 |  					{ | 
| 2085 | - if($line->qty==99) print 'background:#adadcf'; | |
| 2086 | - else if($line->qty==98) print 'background:#ddddff;'; | |
| 2087 | - else if($line->qty<=97 && $line->qty>=91) print 'background:#eeeeff;'; | |
| 2088 | - else if($line->qty==1) print 'background:#adadcf;'; | |
| 2089 | - else if($line->qty==2) print 'background:#ddddff;'; | |
| 2090 | - else if($line->qty==50) print ''; | |
| 2091 | - else print 'background:#eeeeff;'; | |
| 2213 | +						if($line->qty==99) { | |
| 2214 | + print 'background:#adadcf'; | |
| 2215 | +						} else if($line->qty==98) { | |
| 2216 | + print 'background:#ddddff;'; | |
| 2217 | +						} else if($line->qty<=97 && $line->qty>=91) { | |
| 2218 | + print 'background:#eeeeff;'; | |
| 2219 | +						} else if($line->qty==1) { | |
| 2220 | + print 'background:#adadcf;'; | |
| 2221 | +						} else if($line->qty==2) { | |
| 2222 | + print 'background:#ddddff;'; | |
| 2223 | +						} else if($line->qty==50) { | |
| 2224 | + print ''; | |
| 2225 | +						} else { | |
| 2226 | + print 'background:#eeeeff;'; | |
| 2227 | + } | |
| 2092 | 2228 | |
| 2093 | 2229 | //A compléter si on veux plus de nuances de couleurs avec les niveau 4,5,6,7,8 et 9 | 
| 2094 | - } | |
| 2095 | - else | |
| 2230 | + } else | |
| 2096 | 2231 |  					{ | 
| 2097 | - if($line->qty==99) print 'background:#ddffdd'; | |
| 2098 | - else if($line->qty==98) print 'background:#ddddff;'; | |
| 2099 | - else if($line->qty==2) print 'background:#eeeeff; '; | |
| 2100 | - else if($line->qty==50) print ''; | |
| 2101 | - else print 'background:#eeffee;' ; | |
| 2232 | +						if($line->qty==99) { | |
| 2233 | + print 'background:#ddffdd'; | |
| 2234 | +						} else if($line->qty==98) { | |
| 2235 | + print 'background:#ddddff;'; | |
| 2236 | +						} else if($line->qty==2) { | |
| 2237 | + print 'background:#eeeeff; '; | |
| 2238 | +						} else if($line->qty==50) { | |
| 2239 | + print ''; | |
| 2240 | +						} else { | |
| 2241 | + print 'background:#eeffee;' ; | |
| 2242 | + } | |
| 2102 | 2243 | } | 
| 2103 | 2244 | |
| 2104 | 2245 | ?>;"> | 
| @@ -2125,13 +2266,11 @@ discard block | ||
| 2125 | 2266 | $qty_displayed = $line->qty; | 
| 2126 | 2267 |  							print img_picto('', 'subsubtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;color:#0075DE;">'.$qty_displayed.'</span>  '; | 
| 2127 | 2268 | |
| 2128 | - } | |
| 2129 | - else if (TSubtotal::isSubtotal($line)) | |
| 2269 | + } else if (TSubtotal::isSubtotal($line)) | |
| 2130 | 2270 |  						{ | 
| 2131 | 2271 | $qty_displayed = 100 - $line->qty; | 
| 2132 | 2272 |  							print img_picto('', 'subsubtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;color:#0075DE;">'.$qty_displayed.'</span>  '; | 
| 2133 | - } | |
| 2134 | - else | |
| 2273 | + } else | |
| 2135 | 2274 |  						{ | 
| 2136 | 2275 | $isFreeText = true; | 
| 2137 | 2276 | } | 
| @@ -2152,9 +2291,13 @@ discard block | ||
| 2152 | 2291 | } | 
| 2153 | 2292 | |
| 2154 | 2293 | $readonlyForSituation = ''; | 
| 2155 | - if (!empty($line->fk_prev_id) && $line->fk_prev_id != null) $readonlyForSituation = 'readonly'; | |
| 2294 | +						if (!empty($line->fk_prev_id) && $line->fk_prev_id != null) { | |
| 2295 | + $readonlyForSituation = 'readonly'; | |
| 2296 | + } | |
| 2156 | 2297 | |
| 2157 | - if (!$isFreeText) echo '<input type="text" name="line-title" id-line="'.$line->id.'" value="'.$newlabel.'" size="80" '.$readonlyForSituation.'/> '; | |
| 2298 | +						if (!$isFreeText) { | |
| 2299 | + echo '<input type="text" name="line-title" id-line="'.$line->id.'" value="'.$newlabel.'" size="80" '.$readonlyForSituation.'/> '; | |
| 2300 | + } | |
| 2158 | 2301 | |
| 2159 | 2302 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT) && (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) ) | 
| 2160 | 2303 |  						{ | 
| @@ -2162,8 +2305,12 @@ discard block | ||
| 2162 | 2305 | for ($j=1; $j<10; $j++) | 
| 2163 | 2306 |  							{ | 
| 2164 | 2307 |  								if (!empty($readonlyForSituation)) { | 
| 2165 | -									if ($qty_displayed == $j) $select .= '<option selected="selected" value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; | |
| 2166 | -								} else $select .= '<option '.($qty_displayed == $j ? 'selected="selected"' : '').' value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; | |
| 2308 | +									if ($qty_displayed == $j) { | |
| 2309 | +										$select .= '<option selected="selected" value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; | |
| 2310 | + } | |
| 2311 | +								} else { | |
| 2312 | +									$select .= '<option '.($qty_displayed == $j ? 'selected="selected"' : '').' value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; | |
| 2313 | + } | |
| 2167 | 2314 | } | 
| 2168 | 2315 | $select .= '</select> '; | 
| 2169 | 2316 | |
| @@ -2183,7 +2330,9 @@ discard block | ||
| 2183 | 2330 | echo '<div>'; | 
| 2184 | 2331 |                              echo '<label for="subtotal_tva_tx">'.$form->textwithpicto($langs->trans('subtotal_apply_default_tva'), $langs->trans('subtotal_apply_default_tva_help')).'</label>'; | 
| 2185 | 2332 | echo '<select id="subtotal_tva_tx" name="subtotal_tva_tx" class="flat"><option selected="selected" value="">-</option>'; | 
| 2186 | -                            if (empty($readonlyForSituation)) echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true)); | |
| 2333 | +                            if (empty($readonlyForSituation)) { | |
| 2334 | +                            	echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true)); | |
| 2335 | + } | |
| 2187 | 2336 | echo '</select>'; | 
| 2188 | 2337 | echo '</div>'; | 
| 2189 | 2338 | |
| @@ -2202,8 +2351,9 @@ discard block | ||
| 2202 | 2351 | 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"' : '') .' /> '; | 
| 2203 | 2352 |                              echo '<label for="subtotal-showReduc">'.$langs->trans('ShowReducOnSubtotalBlock').'</label>'; | 
| 2204 | 2353 | echo '</div>'; | 
| 2354 | +                        } else if ($isFreeText) { | |
| 2355 | + echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation); | |
| 2205 | 2356 | } | 
| 2206 | - else if ($isFreeText) echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation); | |
| 2207 | 2357 | echo '</div>'; | 
| 2208 | 2358 | |
| 2209 | 2359 | if (TSubtotal::isTitle($line)) | 
| @@ -2224,9 +2374,13 @@ discard block | ||
| 2224 | 2374 | $doleditor->Create(); | 
| 2225 | 2375 | |
| 2226 | 2376 | $TKey = null; | 
| 2227 | -							if ($line->element == 'propaldet') $TKey = explode(',', $conf->global->SUBTOTAL_LIST_OF_EXTRAFIELDS_PROPALDET); | |
| 2228 | -							elseif ($line->element == 'commandedet') $TKey = explode(',', $conf->global->SUBTOTAL_LIST_OF_EXTRAFIELDS_COMMANDEDET); | |
| 2229 | -							elseif ($line->element == 'facturedet') $TKey = explode(',', $conf->global->SUBTOTAL_LIST_OF_EXTRAFIELDS_FACTUREDET); | |
| 2377 | +							if ($line->element == 'propaldet') { | |
| 2378 | +								$TKey = explode(',', $conf->global->SUBTOTAL_LIST_OF_EXTRAFIELDS_PROPALDET); | |
| 2379 | +							} elseif ($line->element == 'commandedet') { | |
| 2380 | +								$TKey = explode(',', $conf->global->SUBTOTAL_LIST_OF_EXTRAFIELDS_COMMANDEDET); | |
| 2381 | +							} elseif ($line->element == 'facturedet') { | |
| 2382 | +								$TKey = explode(',', $conf->global->SUBTOTAL_LIST_OF_EXTRAFIELDS_FACTUREDET); | |
| 2383 | + } | |
| 2230 | 2384 | // TODO ajouter la partie fournisseur | 
| 2231 | 2385 | |
| 2232 | 2386 | if (!empty($TKey)) | 
| @@ -2246,8 +2400,7 @@ discard block | ||
| 2246 | 2400 | } | 
| 2247 | 2401 | } | 
| 2248 | 2402 | |
| 2249 | - } | |
| 2250 | -					else { | |
| 2403 | +					} else { | |
| 2251 | 2404 | |
| 2252 | 2405 | if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) | 
| 2253 | 2406 |  						 { | 
| @@ -2255,14 +2408,19 @@ discard block | ||
| 2255 | 2408 |  							{ | 
| 2256 | 2409 |  								echo str_repeat('   ', $line->qty-1); | 
| 2257 | 2410 | |
| 2258 | -								if (TSubtotal::isTitle($line)) print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span>  '; | |
| 2259 | -								else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span>  '; | |
| 2411 | +								if (TSubtotal::isTitle($line)) { | |
| 2412 | +									print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span>  '; | |
| 2413 | +								} else { | |
| 2414 | +									print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span>  '; | |
| 2415 | + } | |
| 2260 | 2416 | } | 
| 2261 | - } | |
| 2262 | - else | |
| 2417 | + } else | |
| 2263 | 2418 |  						 { | 
| 2264 | -							if($line->qty<=1) print img_picto('', 'subtotal@subtotal'); | |
| 2265 | -							else if($line->qty==2) print img_picto('', 'subsubtotal@subtotal').'     ';  | |
| 2419 | +							if($line->qty<=1) { | |
| 2420 | +								print img_picto('', 'subtotal@subtotal'); | |
| 2421 | +							} else if($line->qty==2) { | |
| 2422 | +								print img_picto('', 'subsubtotal@subtotal').'     '; | |
| 2423 | + } | |
| 2266 | 2424 | } | 
| 2267 | 2425 | |
| 2268 | 2426 | |
| @@ -2272,21 +2430,26 @@ discard block | ||
| 2272 | 2430 | $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; | 
| 2273 | 2431 | |
| 2274 | 2432 |  						 if (empty($line->label)) { | 
| 2275 | - if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) print $line->description.' '.$this->getTitle($object, $line); | |
| 2276 | - else print $line->description; | |
| 2277 | - } | |
| 2278 | -						 else { | |
| 2433 | +							if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) { | |
| 2434 | + print $line->description.' '.$this->getTitle($object, $line); | |
| 2435 | +							} else { | |
| 2436 | + print $line->description; | |
| 2437 | + } | |
| 2438 | +						 } else { | |
| 2279 | 2439 | |
| 2280 | 2440 |  							if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { | 
| 2281 | 2441 | print '<span class="subtotal_label" style="'.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" >'.$line->label.'</span><br><div class="subtotal_desc">'.dol_htmlentitiesbr($line->description).'</div>'; | 
| 2282 | - } | |
| 2283 | -							else{ | |
| 2442 | +							} else{ | |
| 2284 | 2443 | print '<span class="subtotal_label classfortooltip '.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" title="'.$line->description.'">'.$line->label.'</span>'; | 
| 2285 | 2444 | } | 
| 2286 | 2445 | |
| 2287 | 2446 | } | 
| 2288 | - if($line->qty>90) print ' : '; | |
| 2289 | -						if($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); | |
| 2447 | +						if($line->qty>90) { | |
| 2448 | + print ' : '; | |
| 2449 | + } | |
| 2450 | +						if($line->info_bits > 0) { | |
| 2451 | +							echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); | |
| 2452 | + } | |
| 2290 | 2453 | |
| 2291 | 2454 | |
| 2292 | 2455 | |
| @@ -2329,11 +2492,12 @@ discard block | ||
| 2329 | 2492 | </script> | 
| 2330 | 2493 | <?php | 
| 2331 | 2494 | |
| 2332 | - } | |
| 2333 | -					else{ | |
| 2495 | +					} else{ | |
| 2334 | 2496 | if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) && $object->element !== 'invoice_supplier') | 
| 2335 | 2497 |  						{ | 
| 2336 | -							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>'; | |
| 2498 | +							if(TSubtotal::isTitle($line) && ( $line->fk_prev_id === null )) { | |
| 2499 | +								echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=duplicate&lineid='.$line->id.'">'. img_picto($langs->trans('Duplicate'), 'duplicate@subtotal').'</a>'; | |
| 2500 | + } | |
| 2337 | 2501 | } | 
| 2338 | 2502 | |
| 2339 | 2503 | if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_EDIT_BLOCK)) | 
| @@ -2423,7 +2587,9 @@ discard block | ||
| 2423 | 2587 | $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); | 
| 2424 | 2588 | |
| 2425 | 2589 | $colspan+=3; $mode = 'view'; | 
| 2426 | -				if($action === 'editline' && $line->rowid == GETPOST('lineid')) $mode = 'edit'; | |
| 2590 | +				if($action === 'editline' && $line->rowid == GETPOST('lineid')) { | |
| 2591 | + $mode = 'edit'; | |
| 2592 | + } | |
| 2427 | 2593 | |
| 2428 | 2594 | $ex_element = $line->element; | 
| 2429 | 2595 | $line->element = 'tr_extrafield_title '.$line->element; // Pour pouvoir manipuler ces tr | 
| @@ -2482,8 +2648,7 @@ discard block | ||
| 2482 | 2648 | |
| 2483 | 2649 | return 1; | 
| 2484 | 2650 | |
| 2485 | - } | |
| 2486 | -		elseif(($object->element == 'commande' && in_array('ordershipmentcard', $contexts)) || (in_array('expeditioncard', $contexts) && $action == 'create')) | |
| 2651 | +		} elseif(($object->element == 'commande' && in_array('ordershipmentcard', $contexts)) || (in_array('expeditioncard', $contexts) && $action == 'create')) | |
| 2487 | 2652 |  		{ | 
| 2488 | 2653 | $colspan = 4; | 
| 2489 | 2654 | |
| @@ -2493,23 +2658,36 @@ discard block | ||
| 2493 | 2658 | <tr <?php echo $bc[$var]; $var=!$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php | 
| 2494 | 2659 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT)) | 
| 2495 | 2660 |  					{ | 
| 2496 | - if($line->qty==99) print 'background:#adadcf'; | |
| 2497 | - else if($line->qty==98) print 'background:#ddddff;'; | |
| 2498 | - else if($line->qty<=97 && $line->qty>=91) print 'background:#eeeeff;'; | |
| 2499 | - else if($line->qty==1) print 'background:#adadcf;'; | |
| 2500 | - else if($line->qty==2) print 'background:#ddddff;'; | |
| 2501 | - else if($line->qty==50) print ''; | |
| 2502 | - else print 'background:#eeeeff;'; | |
| 2661 | +						if($line->qty==99) { | |
| 2662 | + print 'background:#adadcf'; | |
| 2663 | +						} else if($line->qty==98) { | |
| 2664 | + print 'background:#ddddff;'; | |
| 2665 | +						} else if($line->qty<=97 && $line->qty>=91) { | |
| 2666 | + print 'background:#eeeeff;'; | |
| 2667 | +						} else if($line->qty==1) { | |
| 2668 | + print 'background:#adadcf;'; | |
| 2669 | +						} else if($line->qty==2) { | |
| 2670 | + print 'background:#ddddff;'; | |
| 2671 | +						} else if($line->qty==50) { | |
| 2672 | + print ''; | |
| 2673 | +						} else { | |
| 2674 | + print 'background:#eeeeff;'; | |
| 2675 | + } | |
| 2503 | 2676 | |
| 2504 | 2677 | //A compléter si on veux plus de nuances de couleurs avec les niveau 4,5,6,7,8 et 9 | 
| 2505 | - } | |
| 2506 | - else | |
| 2678 | + } else | |
| 2507 | 2679 |  					{ | 
| 2508 | - if($line->qty==99) print 'background:#ddffdd'; | |
| 2509 | - else if($line->qty==98) print 'background:#ddddff;'; | |
| 2510 | - else if($line->qty==2) print 'background:#eeeeff; '; | |
| 2511 | - else if($line->qty==50) print ''; | |
| 2512 | - else print 'background:#eeffee;' ; | |
| 2680 | +						if($line->qty==99) { | |
| 2681 | + print 'background:#ddffdd'; | |
| 2682 | +						} else if($line->qty==98) { | |
| 2683 | + print 'background:#ddddff;'; | |
| 2684 | +						} else if($line->qty==2) { | |
| 2685 | + print 'background:#eeeeff; '; | |
| 2686 | +						} else if($line->qty==50) { | |
| 2687 | + print ''; | |
| 2688 | +						} else { | |
| 2689 | + print 'background:#eeffee;' ; | |
| 2690 | + } | |
| 2513 | 2691 | } | 
| 2514 | 2692 | |
| 2515 | 2693 | ?>;"> | 
| @@ -2523,14 +2701,19 @@ discard block | ||
| 2523 | 2701 |  							{ | 
| 2524 | 2702 |  								echo str_repeat('   ', $line->qty-1); | 
| 2525 | 2703 | |
| 2526 | -								if (TSubtotal::isTitle($line)) print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span>  '; | |
| 2527 | -								else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span>  '; | |
| 2704 | +								if (TSubtotal::isTitle($line)) { | |
| 2705 | +									print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span>  '; | |
| 2706 | +								} else { | |
| 2707 | +									print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span>  '; | |
| 2708 | + } | |
| 2528 | 2709 | } | 
| 2529 | - } | |
| 2530 | - else | |
| 2710 | + } else | |
| 2531 | 2711 |  						 { | 
| 2532 | -							if($line->qty<=1) print img_picto('', 'subtotal@subtotal'); | |
| 2533 | -							else if($line->qty==2) print img_picto('', 'subsubtotal@subtotal').'     '; | |
| 2712 | +							if($line->qty<=1) { | |
| 2713 | +								print img_picto('', 'subtotal@subtotal'); | |
| 2714 | +							} else if($line->qty==2) { | |
| 2715 | +								print img_picto('', 'subsubtotal@subtotal').'     '; | |
| 2716 | + } | |
| 2534 | 2717 | } | 
| 2535 | 2718 | |
| 2536 | 2719 | |
| @@ -2540,21 +2723,24 @@ discard block | ||
| 2540 | 2723 | $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; | 
| 2541 | 2724 | |
| 2542 | 2725 |  						 if (empty($line->label)) { | 
| 2543 | - if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) print $line->description.' '.$this->getTitle($object, $line); | |
| 2544 | - else print $line->description; | |
| 2545 | - } | |
| 2546 | -						 else { | |
| 2726 | +							if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) { | |
| 2727 | + print $line->description.' '.$this->getTitle($object, $line); | |
| 2728 | +							} else { | |
| 2729 | + print $line->description; | |
| 2730 | + } | |
| 2731 | +						 } else { | |
| 2547 | 2732 | |
| 2548 | 2733 |  							if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { | 
| 2549 | 2734 | print '<span class="subtotal_label" style="'.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" >'.$line->label.'</span><br><div class="subtotal_desc">'.dol_htmlentitiesbr($line->description).'</div>'; | 
| 2550 | - } | |
| 2551 | -							else{ | |
| 2735 | +							} else{ | |
| 2552 | 2736 | print '<span class="subtotal_label classfortooltip '.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" title="'.$line->description.'">'.$line->label.'</span>'; | 
| 2553 | 2737 | } | 
| 2554 | 2738 | |
| 2555 | 2739 | } | 
| 2556 | 2740 | //if($line->qty>90) print ' : '; | 
| 2557 | -						if($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); | |
| 2741 | +						if($line->info_bits > 0) { | |
| 2742 | +							echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); | |
| 2743 | + } | |
| 2558 | 2744 | |
| 2559 | 2745 | ?> | 
| 2560 | 2746 | </td> | 
| @@ -2577,8 +2763,7 @@ discard block | ||
| 2577 | 2763 | </tr> | 
| 2578 | 2764 | <?php | 
| 2579 | 2765 | return 1; | 
| 2580 | - } | |
| 2581 | - elseif ($object->element == 'shipping' || $object->element == 'delivery') | |
| 2766 | + } elseif ($object->element == 'shipping' || $object->element == 'delivery') | |
| 2582 | 2767 |  		{ | 
| 2583 | 2768 | global $form; | 
| 2584 | 2769 | |
| @@ -2590,13 +2775,25 @@ discard block | ||
| 2590 | 2775 | $extralabelslines=$extrafieldsline->fetch_name_optionals_label($object->table_element_line); | 
| 2591 | 2776 | |
| 2592 | 2777 | $colspan = 4; | 
| 2593 | - if($object->origin && $object->origin_id > 0) $colspan++; | |
| 2594 | - if(! empty($conf->stock->enabled)) $colspan++; | |
| 2595 | - if(! empty($conf->productbatch->enabled)) $colspan++; | |
| 2596 | - if($object->statut == 0) $colspan++; | |
| 2597 | - if($object->statut == 0 && empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK)) $colspan++; | |
| 2778 | +			if($object->origin && $object->origin_id > 0) { | |
| 2779 | + $colspan++; | |
| 2780 | + } | |
| 2781 | +			if(! empty($conf->stock->enabled)) { | |
| 2782 | + $colspan++; | |
| 2783 | + } | |
| 2784 | +			if(! empty($conf->productbatch->enabled)) { | |
| 2785 | + $colspan++; | |
| 2786 | + } | |
| 2787 | +			if($object->statut == 0) { | |
| 2788 | + $colspan++; | |
| 2789 | + } | |
| 2790 | +			if($object->statut == 0 && empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK)) { | |
| 2791 | + $colspan++; | |
| 2792 | + } | |
| 2598 | 2793 | |
| 2599 | - if($object->element == 'delivery') $colspan = 2; | |
| 2794 | +			if($object->element == 'delivery') { | |
| 2795 | + $colspan = 2; | |
| 2796 | + } | |
| 2600 | 2797 | |
| 2601 | 2798 | print '<!-- origin line id = '.$line->origin_line_id.' -->'; // id of order line | 
| 2602 | 2799 | |
| @@ -2606,23 +2803,36 @@ discard block | ||
| 2606 | 2803 | <tr <?php echo $bc[$var]; $var=!$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php | 
| 2607 | 2804 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT)) | 
| 2608 | 2805 |  					{ | 
| 2609 | - if($line->qty==99) print 'background:#adadcf'; | |
| 2610 | - else if($line->qty==98) print 'background:#ddddff;'; | |
| 2611 | - else if($line->qty<=97 && $line->qty>=91) print 'background:#eeeeff;'; | |
| 2612 | - else if($line->qty==1) print 'background:#adadcf;'; | |
| 2613 | - else if($line->qty==2) print 'background:#ddddff;'; | |
| 2614 | - else if($line->qty==50) print ''; | |
| 2615 | - else print 'background:#eeeeff;'; | |
| 2806 | +						if($line->qty==99) { | |
| 2807 | + print 'background:#adadcf'; | |
| 2808 | +						} else if($line->qty==98) { | |
| 2809 | + print 'background:#ddddff;'; | |
| 2810 | +						} else if($line->qty<=97 && $line->qty>=91) { | |
| 2811 | + print 'background:#eeeeff;'; | |
| 2812 | +						} else if($line->qty==1) { | |
| 2813 | + print 'background:#adadcf;'; | |
| 2814 | +						} else if($line->qty==2) { | |
| 2815 | + print 'background:#ddddff;'; | |
| 2816 | +						} else if($line->qty==50) { | |
| 2817 | + print ''; | |
| 2818 | +						} else { | |
| 2819 | + print 'background:#eeeeff;'; | |
| 2820 | + } | |
| 2616 | 2821 | |
| 2617 | 2822 | //A compléter si on veux plus de nuances de couleurs avec les niveau 4,5,6,7,8 et 9 | 
| 2618 | - } | |
| 2619 | - else | |
| 2823 | + } else | |
| 2620 | 2824 |  					{ | 
| 2621 | - if($line->qty==99) print 'background:#ddffdd'; | |
| 2622 | - else if($line->qty==98) print 'background:#ddddff;'; | |
| 2623 | - else if($line->qty==2) print 'background:#eeeeff; '; | |
| 2624 | - else if($line->qty==50) print ''; | |
| 2625 | - else print 'background:#eeffee;' ; | |
| 2825 | +						if($line->qty==99) { | |
| 2826 | + print 'background:#ddffdd'; | |
| 2827 | +						} else if($line->qty==98) { | |
| 2828 | + print 'background:#ddddff;'; | |
| 2829 | +						} else if($line->qty==2) { | |
| 2830 | + print 'background:#eeeeff; '; | |
| 2831 | +						} else if($line->qty==50) { | |
| 2832 | + print ''; | |
| 2833 | +						} else { | |
| 2834 | + print 'background:#eeffee;' ; | |
| 2835 | + } | |
| 2626 | 2836 | } | 
| 2627 | 2837 | |
| 2628 | 2838 | ?>;"> | 
| @@ -2644,14 +2854,19 @@ discard block | ||
| 2644 | 2854 |  				{ | 
| 2645 | 2855 |  					echo str_repeat('   ', $line->qty-1); | 
| 2646 | 2856 | |
| 2647 | -					if (TSubtotal::isTitle($line)) print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span>  '; | |
| 2648 | -					else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span>  '; | |
| 2857 | +					if (TSubtotal::isTitle($line)) { | |
| 2858 | +						print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span>  '; | |
| 2859 | +					} else { | |
| 2860 | +						print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span>  '; | |
| 2861 | + } | |
| 2649 | 2862 | } | 
| 2650 | - } | |
| 2651 | - else | |
| 2863 | + } else | |
| 2652 | 2864 |  			{ | 
| 2653 | -				if($line->qty<=1) print img_picto('', 'subtotal@subtotal'); | |
| 2654 | -				else if($line->qty==2) print img_picto('', 'subsubtotal@subtotal').'     '; | |
| 2865 | +				if($line->qty<=1) { | |
| 2866 | +					print img_picto('', 'subtotal@subtotal'); | |
| 2867 | +				} else if($line->qty==2) { | |
| 2868 | +					print img_picto('', 'subsubtotal@subtotal').'     '; | |
| 2869 | + } | |
| 2655 | 2870 | } | 
| 2656 | 2871 | |
| 2657 | 2872 | |
| @@ -2661,19 +2876,22 @@ discard block | ||
| 2661 | 2876 | $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; | 
| 2662 | 2877 | |
| 2663 | 2878 |  			if (empty($line->label)) { | 
| 2664 | - if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) print $line->description.' '.$this->getTitle($object, $line); | |
| 2665 | - else print $line->description; | |
| 2666 | - } | |
| 2667 | -			else { | |
| 2879 | +				if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) { | |
| 2880 | + print $line->description.' '.$this->getTitle($object, $line); | |
| 2881 | +				} else { | |
| 2882 | + print $line->description; | |
| 2883 | + } | |
| 2884 | +			} else { | |
| 2668 | 2885 |  				if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { | 
| 2669 | 2886 | print '<span class="subtotal_label" style="'.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" >'.$line->label.'</span><br><div class="subtotal_desc">'.dol_htmlentitiesbr($line->description).'</div>'; | 
| 2670 | - } | |
| 2671 | -				else{ | |
| 2887 | +				} else{ | |
| 2672 | 2888 | print '<span class="subtotal_label classfortooltip '.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" title="'.$line->description.'">'.$line->label.'</span>'; | 
| 2673 | 2889 | } | 
| 2674 | 2890 | } | 
| 2675 | 2891 | //if($line->qty>90) print ' : '; | 
| 2676 | -			if($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); | |
| 2892 | +			if($line->info_bits > 0) { | |
| 2893 | +				echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); | |
| 2894 | + } | |
| 2677 | 2895 | |
| 2678 | 2896 | ?> | 
| 2679 | 2897 | </td> | 
| @@ -2853,10 +3071,9 @@ discard block | ||
| 2853 | 3071 | |
| 2854 | 3072 |  	    if(TSubtotal::isTitle($line)){ | 
| 2855 | 3073 | $ThtmlData['data-issubtotal'] = 'title'; | 
| 2856 | -	    }elseif(TSubtotal::isSubtotal($line)){ | |
| 3074 | +	    } elseif(TSubtotal::isSubtotal($line)){ | |
| 2857 | 3075 | $ThtmlData['data-issubtotal'] = 'subtotal'; | 
| 2858 | - } | |
| 2859 | -	    else{ | |
| 3076 | +	    } else{ | |
| 2860 | 3077 | $ThtmlData['data-issubtotal'] = 'freetext'; | 
| 2861 | 3078 | } | 
| 2862 | 3079 | |
| @@ -2866,7 +3083,9 @@ discard block | ||
| 2866 | 3083 | |
| 2867 | 3084 | // hook | 
| 2868 | 3085 |  	    $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook | 
| 2869 | - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); | |
| 3086 | +	    if ($reshook < 0) { | |
| 3087 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); | |
| 3088 | + } | |
| 2870 | 3089 | if ($reshook>0) | 
| 2871 | 3090 |  	    { | 
| 2872 | 3091 | $ThtmlData = $hookmanager->resArray; |