@@ -81,11 +81,11 @@ discard block |
||
| 81 | 81 | * @return void |
| 82 | 82 | */ |
| 83 | 83 | |
| 84 | - var $module_number = 104777; |
|
| 84 | + var $module_number = 104777; |
|
| 85 | 85 | |
| 86 | - function formObjectOptions($parameters, &$object, &$action, $hookmanager) |
|
| 87 | - { |
|
| 88 | - global $langs,$db,$user, $conf; |
|
| 86 | + function formObjectOptions($parameters, &$object, &$action, $hookmanager) |
|
| 87 | + { |
|
| 88 | + global $langs,$db,$user, $conf; |
|
| 89 | 89 | |
| 90 | 90 | $langs->load('subtotal@subtotal'); |
| 91 | 91 | |
@@ -100,10 +100,10 @@ discard block |
||
| 100 | 100 | $createRight = $user->rights->facture->creer; |
| 101 | 101 | } elseif($object->element == 'order_supplier' ) |
| 102 | 102 | { |
| 103 | - $createRight = $user->rights->fournisseur->commande->creer; |
|
| 103 | + $createRight = $user->rights->fournisseur->commande->creer; |
|
| 104 | 104 | } elseif($object->element == 'invoice_supplier' ) |
| 105 | 105 | { |
| 106 | - $createRight = $user->rights->fournisseur->facture->creer; |
|
| 106 | + $createRight = $user->rights->fournisseur->facture->creer; |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | if ($object->statut == 0 && $createRight) { |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | |
| 154 | 154 | if (!empty($conf->global->SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE) && $qty < 10) TSubtotal::addSubtotalMissing($object, $qty); |
| 155 | 155 | |
| 156 | - TSubtotal::addSubTotalLine($object, $title, $qty); |
|
| 156 | + TSubtotal::addSubTotalLine($object, $title, $qty); |
|
| 157 | 157 | } |
| 158 | 158 | else if($action==='ask_deleteallline') { |
| 159 | 159 | $form=new Form($db); |
@@ -375,36 +375,36 @@ discard block |
||
| 375 | 375 | $TContext = explode(':',$parameters['context']); |
| 376 | 376 | if ( |
| 377 | 377 | in_array('invoicecard',$TContext) |
| 378 | - || in_array('invoicesuppliercard',$TContext) |
|
| 378 | + || in_array('invoicesuppliercard',$TContext) |
|
| 379 | 379 | || in_array('propalcard',$TContext) |
| 380 | 380 | || in_array('ordercard',$TContext) |
| 381 | - || in_array('ordersuppliercard',$TContext) |
|
| 381 | + || in_array('ordersuppliercard',$TContext) |
|
| 382 | 382 | || in_array('invoicereccard',$TContext) |
| 383 | 383 | ) |
| 384 | - { |
|
| 384 | + { |
|
| 385 | 385 | $hideInnerLines = isset( $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']] ) ? $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']] : 0; |
| 386 | 386 | $hidedetails = isset( $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']] ) ? $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']] : 0; |
| 387 | 387 | $hidepricesDefaultConf = !empty($conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED)?$conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED:0; |
| 388 | 388 | $hideprices= isset( $_SESSION['subtotal_hideprices_'.$parameters['modulepart']] ) ? $_SESSION['subtotal_hideprices_'.$parameters['modulepart']] : $hidepricesDefaultConf; |
| 389 | 389 | |
| 390 | 390 | $var=false; |
| 391 | - $out.= '<tr '.$bc[$var].'> |
|
| 391 | + $out.= '<tr '.$bc[$var].'> |
|
| 392 | 392 | <td colspan="4" align="right"> |
| 393 | 393 | <label for="hideInnerLines">'.$langs->trans('HideInnerLines').'</label> |
| 394 | 394 | <input type="checkbox" onclick="if($(this).is(\':checked\')) { $(\'#hidedetails\').prop(\'checked\', \'checked\') }" id="hideInnerLines" name="hideInnerLines" value="1" '.(( $hideInnerLines ) ? 'checked="checked"' : '' ).' /> |
| 395 | 395 | </td> |
| 396 | 396 | </tr>'; |
| 397 | 397 | |
| 398 | - $var=!$var; |
|
| 399 | - $out.= '<tr '.$bc[$var].'> |
|
| 398 | + $var=!$var; |
|
| 399 | + $out.= '<tr '.$bc[$var].'> |
|
| 400 | 400 | <td colspan="4" align="right"> |
| 401 | 401 | <label for="hidedetails">'.$langs->trans('SubTotalhidedetails').'</label> |
| 402 | 402 | <input type="checkbox" id="hidedetails" name="hidedetails" value="1" '.(( $hidedetails ) ? 'checked="checked"' : '' ).' /> |
| 403 | 403 | </td> |
| 404 | 404 | </tr>'; |
| 405 | 405 | |
| 406 | - $var=!$var; |
|
| 407 | - $out.= '<tr '.$bc[$var].'> |
|
| 406 | + $var=!$var; |
|
| 407 | + $out.= '<tr '.$bc[$var].'> |
|
| 408 | 408 | <td colspan="4" align="right"> |
| 409 | 409 | <label for="hidedetails">'.$langs->trans('SubTotalhidePrice').'</label> |
| 410 | 410 | <input type="checkbox" id="hideprices" name="hideprices" value="1" '.(( $hideprices ) ? 'checked="checked"' : '' ).' /> |
@@ -416,9 +416,9 @@ discard block |
||
| 416 | 416 | if ( |
| 417 | 417 | (in_array('propalcard',$TContext) && !empty($conf->global->SUBTOTAL_PROPAL_ADD_RECAP)) |
| 418 | 418 | || (in_array('ordercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
| 419 | - || (in_array('ordersuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
| 419 | + || (in_array('ordersuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
| 420 | 420 | || (in_array('invoicecard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
| 421 | - || (in_array('invoicesuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
| 421 | + || (in_array('invoicesuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
| 422 | 422 | || (in_array('invoicereccard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP )) |
| 423 | 423 | ) |
| 424 | 424 | { |
@@ -437,19 +437,19 @@ discard block |
||
| 437 | 437 | } |
| 438 | 438 | |
| 439 | 439 | |
| 440 | - return 1; |
|
| 440 | + return 1; |
|
| 441 | 441 | } |
| 442 | 442 | |
| 443 | - function formEditProductOptions($parameters, &$object, &$action, $hookmanager) |
|
| 444 | - { |
|
| 443 | + function formEditProductOptions($parameters, &$object, &$action, $hookmanager) |
|
| 444 | + { |
|
| 445 | 445 | |
| 446 | - if (in_array('invoicecard',explode(':',$parameters['context']))) |
|
| 447 | - { |
|
| 446 | + if (in_array('invoicecard',explode(':',$parameters['context']))) |
|
| 447 | + { |
|
| 448 | 448 | |
| 449 | - } |
|
| 449 | + } |
|
| 450 | 450 | |
| 451 | - return 0; |
|
| 452 | - } |
|
| 451 | + return 0; |
|
| 452 | + } |
|
| 453 | 453 | |
| 454 | 454 | function ODTSubstitutionLine(&$parameters, &$object, $action, $hookmanager) { |
| 455 | 455 | global $conf; |
@@ -498,11 +498,11 @@ discard block |
||
| 498 | 498 | |
| 499 | 499 | if ( |
| 500 | 500 | in_array('invoicecard',explode(':',$parameters['context'])) |
| 501 | - || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
| 501 | + || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
| 502 | 502 | || in_array('propalcard',explode(':',$parameters['context'])) |
| 503 | - || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
| 503 | + || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
| 504 | 504 | || in_array('ordercard',explode(':',$parameters['context'])) |
| 505 | - || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
| 505 | + || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
| 506 | 506 | || in_array('invoicereccard',explode(':',$parameters['context'])) |
| 507 | 507 | ) { |
| 508 | 508 | |
@@ -581,20 +581,20 @@ discard block |
||
| 581 | 581 | in_array('invoicecard',explode(':',$parameters['context'])) |
| 582 | 582 | || in_array('propalcard',explode(':',$parameters['context'])) |
| 583 | 583 | || in_array('ordercard',explode(':',$parameters['context'])) |
| 584 | - || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
| 585 | - || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
| 586 | - || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
| 584 | + || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
| 585 | + || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
| 586 | + || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
| 587 | 587 | ) |
| 588 | - { |
|
| 588 | + { |
|
| 589 | 589 | if(in_array('invoicecard',explode(':',$parameters['context']))) { |
| 590 | 590 | $sessname = 'subtotal_hideInnerLines_facture'; |
| 591 | 591 | $sessname2 = 'subtotal_hidedetails_facture'; |
| 592 | 592 | $sessname3 = 'subtotal_hideprices_facture'; |
| 593 | 593 | } |
| 594 | 594 | elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) { |
| 595 | - $sessname = 'subtotal_hideInnerLines_facture_fournisseur'; |
|
| 596 | - $sessname2 = 'subtotal_hidedetails_facture_fournisseur'; |
|
| 597 | - $sessname3 = 'subtotal_hideprices_facture_fournisseur'; |
|
| 595 | + $sessname = 'subtotal_hideInnerLines_facture_fournisseur'; |
|
| 596 | + $sessname2 = 'subtotal_hidedetails_facture_fournisseur'; |
|
| 597 | + $sessname3 = 'subtotal_hideprices_facture_fournisseur'; |
|
| 598 | 598 | } |
| 599 | 599 | elseif(in_array('propalcard',explode(':',$parameters['context']))) { |
| 600 | 600 | $sessname = 'subtotal_hideInnerLines_propal'; |
@@ -602,9 +602,9 @@ discard block |
||
| 602 | 602 | $sessname3 = 'subtotal_hideprices_propal'; |
| 603 | 603 | } |
| 604 | 604 | elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) { |
| 605 | - $sessname = 'subtotal_hideInnerLines_supplier_proposal'; |
|
| 606 | - $sessname2 = 'subtotal_hidedetails_supplier_proposal'; |
|
| 607 | - $sessname3 = 'subtotal_hideprices_supplier_proposal'; |
|
| 605 | + $sessname = 'subtotal_hideInnerLines_supplier_proposal'; |
|
| 606 | + $sessname2 = 'subtotal_hidedetails_supplier_proposal'; |
|
| 607 | + $sessname3 = 'subtotal_hideprices_supplier_proposal'; |
|
| 608 | 608 | } |
| 609 | 609 | elseif(in_array('ordercard',explode(':',$parameters['context']))) { |
| 610 | 610 | $sessname = 'subtotal_hideInnerLines_commande'; |
@@ -612,9 +612,9 @@ discard block |
||
| 612 | 612 | $sessname3 = 'subtotal_hideprices_commande'; |
| 613 | 613 | } |
| 614 | 614 | elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) { |
| 615 | - $sessname = 'subtotal_hideInnerLines_commande_fournisseur'; |
|
| 616 | - $sessname2 = 'subtotal_hidedetails_commande_fournisseur'; |
|
| 617 | - $sessname3 = 'subtotal_hideprices_commande_fournisseur'; |
|
| 615 | + $sessname = 'subtotal_hideInnerLines_commande_fournisseur'; |
|
| 616 | + $sessname2 = 'subtotal_hidedetails_commande_fournisseur'; |
|
| 617 | + $sessname3 = 'subtotal_hideprices_commande_fournisseur'; |
|
| 618 | 618 | } |
| 619 | 619 | else { |
| 620 | 620 | $sessname = 'subtotal_hideInnerLines_unknown'; |
@@ -636,17 +636,17 @@ discard block |
||
| 636 | 636 | foreach($object->lines as &$line) { |
| 637 | 637 | if ($line->product_type == 9 && $line->special_code == $this->module_number) { |
| 638 | 638 | |
| 639 | - if($line->qty>=90) { |
|
| 640 | - $line->modsubtotal_total = 1; |
|
| 641 | - } |
|
| 642 | - else{ |
|
| 643 | - $line->modsubtotal_title = 1; |
|
| 644 | - } |
|
| 639 | + if($line->qty>=90) { |
|
| 640 | + $line->modsubtotal_total = 1; |
|
| 641 | + } |
|
| 642 | + else{ |
|
| 643 | + $line->modsubtotal_title = 1; |
|
| 644 | + } |
|
| 645 | 645 | |
| 646 | 646 | $line->total_ht = $this->getTotalLineFromObject($object, $line, ''); |
| 647 | 647 | } |
| 648 | - } |
|
| 649 | - } |
|
| 648 | + } |
|
| 649 | + } |
|
| 650 | 650 | |
| 651 | 651 | } |
| 652 | 652 | else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') { |
@@ -663,7 +663,7 @@ discard block |
||
| 663 | 663 | */ |
| 664 | 664 | else if($object->element=='invoice_supplier') |
| 665 | 665 | { |
| 666 | - $object->deleteline($idLine); |
|
| 666 | + $object->deleteline($idLine); |
|
| 667 | 667 | } |
| 668 | 668 | /** |
| 669 | 669 | * @var $object Propal |
@@ -686,7 +686,7 @@ discard block |
||
| 686 | 686 | */ |
| 687 | 687 | else if($object->element=='order_supplier') |
| 688 | 688 | { |
| 689 | - $object->deleteline($idLine); |
|
| 689 | + $object->deleteline($idLine); |
|
| 690 | 690 | } |
| 691 | 691 | /** |
| 692 | 692 | * @var $object Facturerec |
@@ -730,7 +730,7 @@ discard block |
||
| 730 | 730 | |
| 731 | 731 | foreach($object->lines as $l) { |
| 732 | 732 | |
| 733 | - $lid = (!empty($l->rowid) ? $l->rowid : $l->id); |
|
| 733 | + $lid = (!empty($l->rowid) ? $l->rowid : $l->id); |
|
| 734 | 734 | if($lid == $lineid) { |
| 735 | 735 | |
| 736 | 736 | $found = true; |
@@ -739,7 +739,7 @@ discard block |
||
| 739 | 739 | |
| 740 | 740 | if($found) { |
| 741 | 741 | |
| 742 | - $Tab[] = (!empty($l->rowid) ? $l->rowid : $l->id); |
|
| 742 | + $Tab[] = (!empty($l->rowid) ? $l->rowid : $l->id); |
|
| 743 | 743 | |
| 744 | 744 | if($l->special_code==$this->module_number && (($l->qty==99 && $qty_line==1) || ($l->qty==98 && $qty_line==2)) ) { |
| 745 | 745 | break; // end of story |
@@ -818,17 +818,17 @@ discard block |
||
| 818 | 818 | if($l->rang>=$rang) { |
| 819 | 819 | return price($total); |
| 820 | 820 | } |
| 821 | - if (TSubtotal::isSubtotal($l)){ |
|
| 822 | - $total = 0; |
|
| 823 | - } else if ($l->situation_percent > 0 ){ |
|
| 821 | + if (TSubtotal::isSubtotal($l)){ |
|
| 822 | + $total = 0; |
|
| 823 | + } else if ($l->situation_percent > 0 ){ |
|
| 824 | 824 | |
| 825 | 825 | |
| 826 | 826 | $prev_progress = $l->get_prev_progress($object->id); |
| 827 | 827 | $progress = ($l->situation_percent - $prev_progress) /100; |
| 828 | - $total += ($l->total_ht/($l->situation_percent/100)) * $progress; |
|
| 828 | + $total += ($l->total_ht/($l->situation_percent/100)) * $progress; |
|
| 829 | 829 | |
| 830 | - } |
|
| 831 | - } |
|
| 830 | + } |
|
| 831 | + } |
|
| 832 | 832 | |
| 833 | 833 | return price($total); |
| 834 | 834 | } |
@@ -860,7 +860,7 @@ discard block |
||
| 860 | 860 | if(method_exists('Closure','bind')) { |
| 861 | 861 | $pageBreakOriginalValue = $pdf->AcceptPageBreak(); |
| 862 | 862 | $sweetsThief = function ($pdf) { |
| 863 | - return $pdf->bMargin ; |
|
| 863 | + return $pdf->bMargin ; |
|
| 864 | 864 | }; |
| 865 | 865 | $sweetsThief = Closure::bind($sweetsThief, null, $pdf); |
| 866 | 866 | |
@@ -923,11 +923,11 @@ discard block |
||
| 923 | 923 | else |
| 924 | 924 | { |
| 925 | 925 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
| 926 | - if(get_class($object) == 'Facture' && $object->type==Facture::TYPE_SITUATION){//Facture de situation |
|
| 927 | - $total_to_print = $this->getTotalToPrintSituation($object, $line); |
|
| 928 | - } else { |
|
| 929 | - $total_to_print = price($total); |
|
| 930 | - } |
|
| 926 | + if(get_class($object) == 'Facture' && $object->type==Facture::TYPE_SITUATION){//Facture de situation |
|
| 927 | + $total_to_print = $this->getTotalToPrintSituation($object, $line); |
|
| 928 | + } else { |
|
| 929 | + $total_to_print = price($total); |
|
| 930 | + } |
|
| 931 | 931 | |
| 932 | 932 | $line->total_ht = $total; |
| 933 | 933 | $line->total = $total; |
@@ -1078,7 +1078,7 @@ discard block |
||
| 1078 | 1078 | } |
| 1079 | 1079 | |
| 1080 | 1080 | function pdf_getlinetotalexcltax($parameters=array(), &$object, &$action='') { |
| 1081 | - global $conf, $hideprices, $hookmanager; |
|
| 1081 | + global $conf, $hideprices, $hookmanager; |
|
| 1082 | 1082 | |
| 1083 | 1083 | if(is_array($parameters)) $i = & $parameters['i']; |
| 1084 | 1084 | else $i = (int)$parameters; |
@@ -1117,7 +1117,7 @@ discard block |
||
| 1117 | 1117 | } |
| 1118 | 1118 | } |
| 1119 | 1119 | if ((int)GETPOST('hideInnerLines') && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)){ |
| 1120 | - $this->resprints = price($object->lines[$i]->total_ht); |
|
| 1120 | + $this->resprints = price($object->lines[$i]->total_ht); |
|
| 1121 | 1121 | } |
| 1122 | 1122 | |
| 1123 | 1123 | // Si la gestion C/NC est active et que je suis sur un ligne dont l'extrafield est coché |
@@ -1246,7 +1246,7 @@ discard block |
||
| 1246 | 1246 | } |
| 1247 | 1247 | |
| 1248 | 1248 | function pdf_getlineupexcltax($parameters=array(), &$object, &$action='') { |
| 1249 | - global $conf,$hideprices,$hookmanager; |
|
| 1249 | + global $conf,$hideprices,$hookmanager; |
|
| 1250 | 1250 | |
| 1251 | 1251 | if($this->isModSubtotalLine($parameters,$object) ){ |
| 1252 | 1252 | $this->resprints = ' '; |
@@ -1268,32 +1268,32 @@ discard block |
||
| 1268 | 1268 | (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) |
| 1269 | 1269 | ) |
| 1270 | 1270 | { |
| 1271 | - // alors je dois vérifier si la méthode fait partie de la conf qui l'exclue |
|
| 1272 | - if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
| 1273 | - { |
|
| 1274 | - $this->resprints = ' '; |
|
| 1271 | + // alors je dois vérifier si la méthode fait partie de la conf qui l'exclue |
|
| 1272 | + if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
| 1273 | + { |
|
| 1274 | + $this->resprints = ' '; |
|
| 1275 | 1275 | |
| 1276 | - // currentcontext à modifier celon l'appel |
|
| 1277 | - $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i); |
|
| 1278 | - return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1) |
|
| 1276 | + // currentcontext à modifier celon l'appel |
|
| 1277 | + $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i); |
|
| 1278 | + return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1) |
|
| 1279 | 1279 | |
| 1280 | - } |
|
| 1280 | + } |
|
| 1281 | 1281 | } |
| 1282 | 1282 | // Cache le prix pour les lignes standards dolibarr qui sont dans un ensemble |
| 1283 | 1283 | else if (!empty($hideprices)) |
| 1284 | 1284 | { |
| 1285 | 1285 | |
| 1286 | - // Check if a title exist for this line && if the title have subtotal |
|
| 1287 | - $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
| 1288 | - if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
| 1289 | - { |
|
| 1286 | + // Check if a title exist for this line && if the title have subtotal |
|
| 1287 | + $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
| 1288 | + if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
| 1289 | + { |
|
| 1290 | 1290 | |
| 1291 | - $this->resprints = ' '; |
|
| 1291 | + $this->resprints = ' '; |
|
| 1292 | 1292 | |
| 1293 | - // currentcontext à modifier celon l'appel |
|
| 1294 | - $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hideprices', 'i' => $i); |
|
| 1295 | - return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1) |
|
| 1296 | - } |
|
| 1293 | + // currentcontext à modifier celon l'appel |
|
| 1294 | + $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hideprices', 'i' => $i); |
|
| 1295 | + return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1) |
|
| 1296 | + } |
|
| 1297 | 1297 | } |
| 1298 | 1298 | |
| 1299 | 1299 | return 0; |
@@ -1330,7 +1330,7 @@ discard block |
||
| 1330 | 1330 | } |
| 1331 | 1331 | |
| 1332 | 1332 | function pdf_getlinevatrate($parameters=array(), &$object, &$action='') { |
| 1333 | - global $conf,$hideprices,$hookmanager; |
|
| 1333 | + global $conf,$hideprices,$hookmanager; |
|
| 1334 | 1334 | |
| 1335 | 1335 | if($this->isModSubtotalLine($parameters,$object) ){ |
| 1336 | 1336 | $this->resprints = ' '; |
@@ -1355,31 +1355,31 @@ discard block |
||
| 1355 | 1355 | (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) |
| 1356 | 1356 | ) |
| 1357 | 1357 | { |
| 1358 | - // alors je dois vérifier si la méthode fait partie de la conf qui l'exclue |
|
| 1359 | - if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
| 1360 | - { |
|
| 1361 | - $this->resprints = ' '; |
|
| 1358 | + // alors je dois vérifier si la méthode fait partie de la conf qui l'exclue |
|
| 1359 | + if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
| 1360 | + { |
|
| 1361 | + $this->resprints = ' '; |
|
| 1362 | 1362 | |
| 1363 | - // currentcontext à modifier celon l'appel |
|
| 1364 | - $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i); |
|
| 1365 | - return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1) |
|
| 1366 | - } |
|
| 1363 | + // currentcontext à modifier celon l'appel |
|
| 1364 | + $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i); |
|
| 1365 | + return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1) |
|
| 1366 | + } |
|
| 1367 | 1367 | } |
| 1368 | 1368 | // Cache le prix pour les lignes standards dolibarr qui sont dans un ensemble |
| 1369 | 1369 | else if (!empty($hideprices)) |
| 1370 | 1370 | { |
| 1371 | 1371 | |
| 1372 | - // Check if a title exist for this line && if the title have subtotal |
|
| 1373 | - $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
| 1374 | - if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
| 1375 | - { |
|
| 1372 | + // Check if a title exist for this line && if the title have subtotal |
|
| 1373 | + $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
| 1374 | + if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
| 1375 | + { |
|
| 1376 | 1376 | |
| 1377 | - $this->resprints = ' '; |
|
| 1377 | + $this->resprints = ' '; |
|
| 1378 | 1378 | |
| 1379 | - // currentcontext à modifier celon l'appel |
|
| 1380 | - $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hideprices', 'i' => $i); |
|
| 1381 | - return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1) |
|
| 1382 | - } |
|
| 1379 | + // currentcontext à modifier celon l'appel |
|
| 1380 | + $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hideprices', 'i' => $i); |
|
| 1381 | + return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1) |
|
| 1382 | + } |
|
| 1383 | 1383 | } |
| 1384 | 1384 | |
| 1385 | 1385 | return 0; |
@@ -1508,11 +1508,11 @@ discard block |
||
| 1508 | 1508 | $hidedetails = (int)GETPOST('hidedetails'); |
| 1509 | 1509 | |
| 1510 | 1510 | if ($hideInnerLines) { // si c une ligne de titre |
| 1511 | - $fk_parent_line=0; |
|
| 1511 | + $fk_parent_line=0; |
|
| 1512 | 1512 | $TLines =array(); |
| 1513 | 1513 | |
| 1514 | 1514 | $original_count=count($object->lines); |
| 1515 | - $TTvas = array(); // tableau de tva |
|
| 1515 | + $TTvas = array(); // tableau de tva |
|
| 1516 | 1516 | |
| 1517 | 1517 | foreach($object->lines as $k=>&$line) |
| 1518 | 1518 | { |
@@ -1542,48 +1542,48 @@ discard block |
||
| 1542 | 1542 | |
| 1543 | 1543 | if ($hideInnerLines) |
| 1544 | 1544 | { |
| 1545 | - if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
| 1546 | - { |
|
| 1547 | - if($line->tva_tx != '0.000' && $line->product_type!=9){ |
|
| 1545 | + if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
| 1546 | + { |
|
| 1547 | + if($line->tva_tx != '0.000' && $line->product_type!=9){ |
|
| 1548 | 1548 | |
| 1549 | - // on remplit le tableau de tva pour substituer les lignes cachées |
|
| 1550 | - $TTvas[$line->tva_tx]['total_tva'] += $line->total_tva; |
|
| 1551 | - $TTvas[$line->tva_tx]['total_ht'] += $line->total_ht; |
|
| 1552 | - $TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; |
|
| 1553 | - } |
|
| 1554 | - if($line->product_type==9 && $line->rowid>0) |
|
| 1555 | - { |
|
| 1556 | - //Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres |
|
| 1557 | - // génère des lignes d'affichage des montants HT soumis à tva |
|
| 1558 | - $nbtva = count($TTvas); |
|
| 1559 | - if(!empty($nbtva)){ |
|
| 1560 | - foreach ($TTvas as $tx =>$val){ |
|
| 1561 | - $l = clone $line; |
|
| 1562 | - $l->product_type = 1; |
|
| 1563 | - $l->special_code = ''; |
|
| 1564 | - $l->qty = 1; |
|
| 1565 | - $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx)); |
|
| 1566 | - $l->tva_tx = $tx; |
|
| 1567 | - $l->total_ht = $val['total_ht']; |
|
| 1568 | - $l->total_tva = $val['total_tva']; |
|
| 1569 | - $l->total = $line->total_ht; |
|
| 1570 | - $l->total_ttc = $val['total_ttc']; |
|
| 1571 | - $TLines[] = $l; |
|
| 1572 | - array_shift($TTvas); |
|
| 1573 | - } |
|
| 1574 | - } |
|
| 1549 | + // on remplit le tableau de tva pour substituer les lignes cachées |
|
| 1550 | + $TTvas[$line->tva_tx]['total_tva'] += $line->total_tva; |
|
| 1551 | + $TTvas[$line->tva_tx]['total_ht'] += $line->total_ht; |
|
| 1552 | + $TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; |
|
| 1553 | + } |
|
| 1554 | + if($line->product_type==9 && $line->rowid>0) |
|
| 1555 | + { |
|
| 1556 | + //Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres |
|
| 1557 | + // génère des lignes d'affichage des montants HT soumis à tva |
|
| 1558 | + $nbtva = count($TTvas); |
|
| 1559 | + if(!empty($nbtva)){ |
|
| 1560 | + foreach ($TTvas as $tx =>$val){ |
|
| 1561 | + $l = clone $line; |
|
| 1562 | + $l->product_type = 1; |
|
| 1563 | + $l->special_code = ''; |
|
| 1564 | + $l->qty = 1; |
|
| 1565 | + $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx)); |
|
| 1566 | + $l->tva_tx = $tx; |
|
| 1567 | + $l->total_ht = $val['total_ht']; |
|
| 1568 | + $l->total_tva = $val['total_tva']; |
|
| 1569 | + $l->total = $line->total_ht; |
|
| 1570 | + $l->total_ttc = $val['total_ttc']; |
|
| 1571 | + $TLines[] = $l; |
|
| 1572 | + array_shift($TTvas); |
|
| 1573 | + } |
|
| 1574 | + } |
|
| 1575 | 1575 | |
| 1576 | - // ajoute la ligne de sous-total |
|
| 1577 | - $TLines[] = $line; |
|
| 1578 | - } |
|
| 1579 | - } else { |
|
| 1576 | + // ajoute la ligne de sous-total |
|
| 1577 | + $TLines[] = $line; |
|
| 1578 | + } |
|
| 1579 | + } else { |
|
| 1580 | 1580 | |
| 1581 | - if($line->product_type==9 && $line->rowid>0) |
|
| 1582 | - { |
|
| 1583 | - // ajoute la ligne de sous-total |
|
| 1584 | - $TLines[] = $line; |
|
| 1585 | - } |
|
| 1586 | - } |
|
| 1581 | + if($line->product_type==9 && $line->rowid>0) |
|
| 1582 | + { |
|
| 1583 | + // ajoute la ligne de sous-total |
|
| 1584 | + $TLines[] = $line; |
|
| 1585 | + } |
|
| 1586 | + } |
|
| 1587 | 1587 | |
| 1588 | 1588 | |
| 1589 | 1589 | } |
@@ -1608,20 +1608,20 @@ discard block |
||
| 1608 | 1608 | $nbtva = count($TTvas); |
| 1609 | 1609 | if(!empty($nbtva) && $hideInnerLines && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
| 1610 | 1610 | { |
| 1611 | - foreach ($TTvas as $tx =>$val){ |
|
| 1612 | - $l = clone $line; |
|
| 1613 | - $l->product_type = 1; |
|
| 1614 | - $l->special_code = ''; |
|
| 1615 | - $l->qty = 1; |
|
| 1616 | - $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx)); |
|
| 1617 | - $l->tva_tx = $tx; |
|
| 1618 | - $l->total_ht = $val['total_ht']; |
|
| 1619 | - $l->total_tva = $val['total_tva']; |
|
| 1620 | - $l->total = $line->total_ht; |
|
| 1621 | - $l->total_ttc = $val['total_ttc']; |
|
| 1622 | - $TLines[] = $l; |
|
| 1623 | - array_shift($TTvas); |
|
| 1624 | - } |
|
| 1611 | + foreach ($TTvas as $tx =>$val){ |
|
| 1612 | + $l = clone $line; |
|
| 1613 | + $l->product_type = 1; |
|
| 1614 | + $l->special_code = ''; |
|
| 1615 | + $l->qty = 1; |
|
| 1616 | + $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx)); |
|
| 1617 | + $l->tva_tx = $tx; |
|
| 1618 | + $l->total_ht = $val['total_ht']; |
|
| 1619 | + $l->total_tva = $val['total_tva']; |
|
| 1620 | + $l->total = $line->total_ht; |
|
| 1621 | + $l->total_ttc = $val['total_ttc']; |
|
| 1622 | + $TLines[] = $l; |
|
| 1623 | + array_shift($TTvas); |
|
| 1624 | + } |
|
| 1625 | 1625 | } |
| 1626 | 1626 | |
| 1627 | 1627 | global $nblignes; |
@@ -1633,7 +1633,7 @@ discard block |
||
| 1633 | 1633 | $this->resprints = ''; |
| 1634 | 1634 | return 0; |
| 1635 | 1635 | } |
| 1636 | - } |
|
| 1636 | + } |
|
| 1637 | 1637 | |
| 1638 | 1638 | return 0; |
| 1639 | 1639 | } |
@@ -1796,18 +1796,18 @@ discard block |
||
| 1796 | 1796 | } |
| 1797 | 1797 | elseif($object->element == 'order_supplier' ) |
| 1798 | 1798 | { |
| 1799 | - $createRight = $user->rights->fournisseur->commande->creer; |
|
| 1799 | + $createRight = $user->rights->fournisseur->commande->creer; |
|
| 1800 | 1800 | } |
| 1801 | 1801 | elseif($object->element == 'invoice_supplier' ) |
| 1802 | 1802 | { |
| 1803 | - $createRight = $user->rights->fournisseur->facture->creer; |
|
| 1803 | + $createRight = $user->rights->fournisseur->facture->creer; |
|
| 1804 | 1804 | } |
| 1805 | 1805 | |
| 1806 | 1806 | if($line->special_code!=$this->module_number || $line->product_type!=9) { |
| 1807 | 1807 | null; |
| 1808 | 1808 | } |
| 1809 | 1809 | 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)) |
| 1810 | - { |
|
| 1810 | + { |
|
| 1811 | 1811 | if($object->element=='facture')$idvar = 'facid'; |
| 1812 | 1812 | else $idvar='id'; |
| 1813 | 1813 | |
@@ -1854,7 +1854,7 @@ discard block |
||
| 1854 | 1854 | //var_dump($line); |
| 1855 | 1855 | |
| 1856 | 1856 | // HTML 5 data for js |
| 1857 | - $data = $this->_getHtmlData($parameters, $object, $action, $hookmanager); |
|
| 1857 | + $data = $this->_getHtmlData($parameters, $object, $action, $hookmanager); |
|
| 1858 | 1858 | |
| 1859 | 1859 | |
| 1860 | 1860 | ?> |
@@ -1912,8 +1912,8 @@ discard block |
||
| 1912 | 1912 | } |
| 1913 | 1913 | |
| 1914 | 1914 | if ($object->element == 'order_supplier' || $object->element == 'invoice_supplier') { |
| 1915 | - $line->label = !empty($line->description) ? $line->description : $line->desc; |
|
| 1916 | - $line->description = ''; |
|
| 1915 | + $line->label = !empty($line->description) ? $line->description : $line->desc; |
|
| 1916 | + $line->description = ''; |
|
| 1917 | 1917 | } |
| 1918 | 1918 | $newlabel = $line->label; |
| 1919 | 1919 | if($line->label=='' && !$isFreeText) { |
@@ -2204,17 +2204,17 @@ discard block |
||
| 2204 | 2204 | if ($object->statut == 0 && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && $action != 'editline') |
| 2205 | 2205 | { |
| 2206 | 2206 | |
| 2207 | - if($object->element == 'invoice_supplier' || $object->element == 'order_supplier') |
|
| 2208 | - { |
|
| 2209 | - foreach ($object->lines as $line) |
|
| 2210 | - { |
|
| 2211 | - // fetch optionals attributes and labels |
|
| 2212 | - require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); |
|
| 2213 | - $extrafields=new ExtraFields($this->db); |
|
| 2214 | - $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true); |
|
| 2215 | - $line->fetch_optionals($line->id,$extralabels); |
|
| 2216 | - } |
|
| 2217 | - } |
|
| 2207 | + if($object->element == 'invoice_supplier' || $object->element == 'order_supplier') |
|
| 2208 | + { |
|
| 2209 | + foreach ($object->lines as $line) |
|
| 2210 | + { |
|
| 2211 | + // fetch optionals attributes and labels |
|
| 2212 | + require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); |
|
| 2213 | + $extrafields=new ExtraFields($this->db); |
|
| 2214 | + $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true); |
|
| 2215 | + $line->fetch_optionals($line->id,$extralabels); |
|
| 2216 | + } |
|
| 2217 | + } |
|
| 2218 | 2218 | |
| 2219 | 2219 | $TSubNc = array(); |
| 2220 | 2220 | foreach ($object->lines as &$l) |
@@ -2305,80 +2305,80 @@ discard block |
||
| 2305 | 2305 | { |
| 2306 | 2306 | dol_include_once('/subtotal/class/subtotal.class.php'); |
| 2307 | 2307 | |
| 2308 | - $line = &$parameters['line']; |
|
| 2308 | + $line = &$parameters['line']; |
|
| 2309 | 2309 | |
| 2310 | - $ThtmlData['data-id'] = $line->id; |
|
| 2311 | - $ThtmlData['data-product_type'] = $line->product_type; |
|
| 2312 | - $ThtmlData['data-qty'] = 0; //$line->qty; |
|
| 2313 | - $ThtmlData['data-level'] = TSubtotal::getNiveau($line); |
|
| 2310 | + $ThtmlData['data-id'] = $line->id; |
|
| 2311 | + $ThtmlData['data-product_type'] = $line->product_type; |
|
| 2312 | + $ThtmlData['data-qty'] = 0; //$line->qty; |
|
| 2313 | + $ThtmlData['data-level'] = TSubtotal::getNiveau($line); |
|
| 2314 | 2314 | |
| 2315 | - if(TSubtotal::isTitle($line)){ |
|
| 2316 | - $ThtmlData['data-issubtotal'] = 'title'; |
|
| 2317 | - }elseif(TSubtotal::isSubtotal($line)){ |
|
| 2318 | - $ThtmlData['data-issubtotal'] = 'subtotal'; |
|
| 2319 | - } |
|
| 2320 | - else{ |
|
| 2321 | - $ThtmlData['data-issubtotal'] = 'freetext'; |
|
| 2322 | - } |
|
| 2315 | + if(TSubtotal::isTitle($line)){ |
|
| 2316 | + $ThtmlData['data-issubtotal'] = 'title'; |
|
| 2317 | + }elseif(TSubtotal::isSubtotal($line)){ |
|
| 2318 | + $ThtmlData['data-issubtotal'] = 'subtotal'; |
|
| 2319 | + } |
|
| 2320 | + else{ |
|
| 2321 | + $ThtmlData['data-issubtotal'] = 'freetext'; |
|
| 2322 | + } |
|
| 2323 | 2323 | |
| 2324 | 2324 | |
| 2325 | - // Change or add data from hooks |
|
| 2326 | - $parameters = array_replace($parameters , array( 'ThtmlData' => $ThtmlData ) ); |
|
| 2325 | + // Change or add data from hooks |
|
| 2326 | + $parameters = array_replace($parameters , array( 'ThtmlData' => $ThtmlData ) ); |
|
| 2327 | 2327 | |
| 2328 | - // hook |
|
| 2329 | - $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
|
| 2330 | - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 2331 | - if ($reshook>0) |
|
| 2332 | - { |
|
| 2333 | - $ThtmlData = $hookmanager->resArray; |
|
| 2334 | - } |
|
| 2335 | - |
|
| 2336 | - return $this->implodeHtmlData($ThtmlData); |
|
| 2328 | + // hook |
|
| 2329 | + $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
|
| 2330 | + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 2331 | + if ($reshook>0) |
|
| 2332 | + { |
|
| 2333 | + $ThtmlData = $hookmanager->resArray; |
|
| 2334 | + } |
|
| 2335 | + |
|
| 2336 | + return $this->implodeHtmlData($ThtmlData); |
|
| 2337 | 2337 | |
| 2338 | 2338 | } |
| 2339 | 2339 | |
| 2340 | 2340 | |
| 2341 | 2341 | function implodeHtmlData($ThtmlData = array()) |
| 2342 | 2342 | { |
| 2343 | - $data = ''; |
|
| 2344 | - foreach($ThtmlData as $k => $h ) |
|
| 2345 | - { |
|
| 2346 | - if(is_array($h)) |
|
| 2347 | - { |
|
| 2348 | - $h = json_encode($h); |
|
| 2349 | - } |
|
| 2343 | + $data = ''; |
|
| 2344 | + foreach($ThtmlData as $k => $h ) |
|
| 2345 | + { |
|
| 2346 | + if(is_array($h)) |
|
| 2347 | + { |
|
| 2348 | + $h = json_encode($h); |
|
| 2349 | + } |
|
| 2350 | 2350 | |
| 2351 | - $data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" '; |
|
| 2352 | - } |
|
| 2351 | + $data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" '; |
|
| 2352 | + } |
|
| 2353 | 2353 | |
| 2354 | - return $data; |
|
| 2354 | + return $data; |
|
| 2355 | 2355 | } |
| 2356 | 2356 | |
| 2357 | 2357 | function _ajax_block_order_js($object) |
| 2358 | 2358 | { |
| 2359 | - global $conf,$tagidfortablednd,$filepath,$langs; |
|
| 2359 | + global $conf,$tagidfortablednd,$filepath,$langs; |
|
| 2360 | 2360 | |
| 2361 | - /* |
|
| 2361 | + /* |
|
| 2362 | 2362 | * this part of js is base on dolibarr htdocs/core/tpl/ajaxrow.tpl.php |
| 2363 | 2363 | * for compatibility reasons we don't use tableDnD but jquery sortable |
| 2364 | 2364 | */ |
| 2365 | 2365 | |
| 2366 | - $id=$object->id; |
|
| 2367 | - $nboflines=(isset($object->lines)?count($object->lines):0); |
|
| 2368 | - $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1; |
|
| 2366 | + $id=$object->id; |
|
| 2367 | + $nboflines=(isset($object->lines)?count($object->lines):0); |
|
| 2368 | + $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1; |
|
| 2369 | 2369 | |
| 2370 | - $id=$object->id; |
|
| 2371 | - $fk_element=$object->fk_element; |
|
| 2372 | - $table_element_line=$object->table_element_line; |
|
| 2373 | - $nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines)); |
|
| 2374 | - $tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd); |
|
| 2375 | - $filepath=(empty($filepath)?'':$filepath); |
|
| 2370 | + $id=$object->id; |
|
| 2371 | + $fk_element=$object->fk_element; |
|
| 2372 | + $table_element_line=$object->table_element_line; |
|
| 2373 | + $nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines)); |
|
| 2374 | + $tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd); |
|
| 2375 | + $filepath=(empty($filepath)?'':$filepath); |
|
| 2376 | 2376 | |
| 2377 | 2377 | |
| 2378 | - if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1) |
|
| 2379 | - { |
|
| 2378 | + if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1) |
|
| 2379 | + { |
|
| 2380 | 2380 | |
| 2381 | - ?> |
|
| 2381 | + ?> |
|
| 2382 | 2382 | |
| 2383 | 2383 | |
| 2384 | 2384 | <script type="text/javascript"> |
@@ -85,43 +85,43 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | function formObjectOptions($parameters, &$object, &$action, $hookmanager) |
| 87 | 87 | { |
| 88 | - global $langs,$db,$user, $conf; |
|
| 88 | + global $langs, $db, $user, $conf; |
|
| 89 | 89 | |
| 90 | 90 | $langs->load('subtotal@subtotal'); |
| 91 | 91 | |
| 92 | - $contexts = explode(':',$parameters['context']); |
|
| 92 | + $contexts = explode(':', $parameters['context']); |
|
| 93 | 93 | |
| 94 | - if(in_array('ordercard',$contexts) || in_array('ordersuppliercard',$contexts) || in_array('propalcard',$contexts) || in_array('supplier_proposalcard',$contexts) || in_array('invoicecard',$contexts) || in_array('invoicesuppliercard',$contexts) || in_array('invoicereccard',$contexts)) { |
|
| 94 | + if (in_array('ordercard', $contexts) || in_array('ordersuppliercard', $contexts) || in_array('propalcard', $contexts) || in_array('supplier_proposalcard', $contexts) || in_array('invoicecard', $contexts) || in_array('invoicesuppliercard', $contexts) || in_array('invoicereccard', $contexts)) { |
|
| 95 | 95 | |
| 96 | 96 | $createRight = $user->rights->{$object->element}->creer; |
| 97 | - if($object->element == 'facturerec' ) |
|
| 97 | + if ($object->element == 'facturerec') |
|
| 98 | 98 | { |
| 99 | 99 | $object->statut = 0; // hack for facture rec |
| 100 | 100 | $createRight = $user->rights->facture->creer; |
| 101 | - } elseif($object->element == 'order_supplier' ) |
|
| 101 | + } elseif ($object->element == 'order_supplier') |
|
| 102 | 102 | { |
| 103 | 103 | $createRight = $user->rights->fournisseur->commande->creer; |
| 104 | - } elseif($object->element == 'invoice_supplier' ) |
|
| 104 | + } elseif ($object->element == 'invoice_supplier') |
|
| 105 | 105 | { |
| 106 | 106 | $createRight = $user->rights->fournisseur->facture->creer; |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - if ($object->statut == 0 && $createRight) { |
|
| 109 | + if ($object->statut == 0 && $createRight) { |
|
| 110 | 110 | |
| 111 | 111 | |
| 112 | - if($object->element=='facture')$idvar = 'facid'; |
|
| 113 | - else $idvar='id'; |
|
| 112 | + if ($object->element == 'facture')$idvar = 'facid'; |
|
| 113 | + else $idvar = 'id'; |
|
| 114 | 114 | |
| 115 | - if(in_array($action, array('add_title_line', 'add_total_line', 'add_subtitle_line', 'add_subtotal_line', 'add_free_text')) ) |
|
| 115 | + if (in_array($action, array('add_title_line', 'add_total_line', 'add_subtitle_line', 'add_subtotal_line', 'add_free_text'))) |
|
| 116 | 116 | { |
| 117 | 117 | $level = GETPOST('level', 'int'); //New avec SUBTOTAL_USE_NEW_FORMAT |
| 118 | 118 | |
| 119 | - if($action=='add_title_line') { |
|
| 119 | + if ($action == 'add_title_line') { |
|
| 120 | 120 | $title = GETPOST('title'); |
| 121 | - if(empty($title)) $title = $langs->trans('title'); |
|
| 122 | - $qty = $level<1 ? 1 : $level ; |
|
| 121 | + if (empty($title)) $title = $langs->trans('title'); |
|
| 122 | + $qty = $level < 1 ? 1 : $level; |
|
| 123 | 123 | } |
| 124 | - else if($action=='add_free_text') { |
|
| 124 | + else if ($action == 'add_free_text') { |
|
| 125 | 125 | $title = GETPOST('title'); |
| 126 | 126 | |
| 127 | 127 | if (empty($title)) { |
@@ -133,21 +133,21 @@ discard block |
||
| 133 | 133 | } |
| 134 | 134 | } |
| 135 | 135 | } |
| 136 | - if(empty($title)) $title = $langs->trans('subtotalAddLineDescription'); |
|
| 136 | + if (empty($title)) $title = $langs->trans('subtotalAddLineDescription'); |
|
| 137 | 137 | $qty = 50; |
| 138 | 138 | } |
| 139 | - else if($action=='add_subtitle_line') { |
|
| 139 | + else if ($action == 'add_subtitle_line') { |
|
| 140 | 140 | $title = GETPOST('title'); |
| 141 | - if(empty($title)) $title = $langs->trans('subtitle'); |
|
| 141 | + if (empty($title)) $title = $langs->trans('subtitle'); |
|
| 142 | 142 | $qty = 2; |
| 143 | 143 | } |
| 144 | - else if($action=='add_subtotal_line') { |
|
| 144 | + else if ($action == 'add_subtotal_line') { |
|
| 145 | 145 | $title = $langs->trans('SubSubTotal'); |
| 146 | 146 | $qty = 98; |
| 147 | 147 | } |
| 148 | 148 | else { |
| 149 | 149 | $title = GETPOST('title') ? GETPOST('title') : $langs->trans('SubTotal'); |
| 150 | - $qty = $level ? 100-$level : 99; |
|
| 150 | + $qty = $level ? 100 - $level : 99; |
|
| 151 | 151 | } |
| 152 | 152 | dol_include_once('/subtotal/class/subtotal.class.php'); |
| 153 | 153 | |
@@ -155,15 +155,15 @@ discard block |
||
| 155 | 155 | |
| 156 | 156 | TSubtotal::addSubTotalLine($object, $title, $qty); |
| 157 | 157 | } |
| 158 | - else if($action==='ask_deleteallline') { |
|
| 159 | - $form=new Form($db); |
|
| 158 | + else if ($action === 'ask_deleteallline') { |
|
| 159 | + $form = new Form($db); |
|
| 160 | 160 | |
| 161 | - $lineid = GETPOST('lineid','integer'); |
|
| 161 | + $lineid = GETPOST('lineid', 'integer'); |
|
| 162 | 162 | $TIdForGroup = $this->getArrayOfLineForAGroup($object, $lineid); |
| 163 | 163 | |
| 164 | 164 | $nbLines = count($TIdForGroup); |
| 165 | 165 | |
| 166 | - $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('deleteWithAllLines'), $langs->trans('ConfirmDeleteAllThisLines',$nbLines), 'confirm_delete_all_lines','',0,1); |
|
| 166 | + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('deleteWithAllLines'), $langs->trans('ConfirmDeleteAllThisLines', $nbLines), 'confirm_delete_all_lines', '', 0, 1); |
|
| 167 | 167 | print $formconfirm; |
| 168 | 168 | } |
| 169 | 169 | |
@@ -173,13 +173,13 @@ discard block |
||
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | |
| 176 | - if($action!='editline') { |
|
| 176 | + if ($action != 'editline') { |
|
| 177 | 177 | // New format is for 3.8 |
| 178 | 178 | $this->printNewFormat($object, $conf, $langs, $idvar); |
| 179 | 179 | } |
| 180 | 180 | } |
| 181 | 181 | } |
| 182 | - elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice',$contexts)) |
|
| 182 | + elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice', $contexts)) |
|
| 183 | 183 | { |
| 184 | 184 | ?> |
| 185 | 185 | <script type="text/javascript"> |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | $(document).ready(function() { |
| 205 | 205 | $('div.fiche div.tabsAction').append('<br />'); |
| 206 | 206 | |
| 207 | - $('div.fiche div.tabsAction').append('<div class="inline-block divButAction"><a id="add_title_line" rel="add_title_line" href="javascript:;" class="butAction"><?php echo $langs->trans('AddTitle' )?></a></div>'); |
|
| 207 | + $('div.fiche div.tabsAction').append('<div class="inline-block divButAction"><a id="add_title_line" rel="add_title_line" href="javascript:;" class="butAction"><?php echo $langs->trans('AddTitle')?></a></div>'); |
|
| 208 | 208 | $('div.fiche div.tabsAction').append('<div class="inline-block divButAction"><a id="add_total_line" rel="add_total_line" href="javascript:;" class="butAction"><?php echo $langs->trans('AddSubTotal')?></a></div>'); |
| 209 | 209 | $('div.fiche div.tabsAction').append('<div class="inline-block divButAction"><a id="add_free_text" rel="add_free_text" href="javascript:;" class="butAction"><?php echo $langs->trans('AddFreeText')?></a></div>'); |
| 210 | 210 | |
@@ -255,9 +255,9 @@ discard block |
||
| 255 | 255 | $('body').append(dialog_html); |
| 256 | 256 | |
| 257 | 257 | <?php |
| 258 | - $editorTool = empty($conf->global->FCKEDITOR_EDITORNAME)?'ckeditor':$conf->global->FCKEDITOR_EDITORNAME; |
|
| 259 | - $editorConf = empty($conf->global->FCKEDITOR_ENABLE_DETAILS)?false:$conf->global->FCKEDITOR_ENABLE_DETAILS; |
|
| 260 | - if($editorConf && in_array($editorTool,array('textarea','ckeditor'))){ |
|
| 258 | + $editorTool = empty($conf->global->FCKEDITOR_EDITORNAME) ? 'ckeditor' : $conf->global->FCKEDITOR_EDITORNAME; |
|
| 259 | + $editorConf = empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ?false:$conf->global->FCKEDITOR_ENABLE_DETAILS; |
|
| 260 | + if ($editorConf && in_array($editorTool, array('textarea', 'ckeditor'))) { |
|
| 261 | 261 | ?> |
| 262 | 262 | if (action == 'addTitle' || action == 'addFreeTxt') |
| 263 | 263 | { |
@@ -372,62 +372,62 @@ discard block |
||
| 372 | 372 | global $conf, $langs, $bc; |
| 373 | 373 | |
| 374 | 374 | $action = GETPOST('action'); |
| 375 | - $TContext = explode(':',$parameters['context']); |
|
| 375 | + $TContext = explode(':', $parameters['context']); |
|
| 376 | 376 | if ( |
| 377 | - in_array('invoicecard',$TContext) |
|
| 378 | - || in_array('invoicesuppliercard',$TContext) |
|
| 379 | - || in_array('propalcard',$TContext) |
|
| 380 | - || in_array('ordercard',$TContext) |
|
| 381 | - || in_array('ordersuppliercard',$TContext) |
|
| 382 | - || in_array('invoicereccard',$TContext) |
|
| 377 | + in_array('invoicecard', $TContext) |
|
| 378 | + || in_array('invoicesuppliercard', $TContext) |
|
| 379 | + || in_array('propalcard', $TContext) |
|
| 380 | + || in_array('ordercard', $TContext) |
|
| 381 | + || in_array('ordersuppliercard', $TContext) |
|
| 382 | + || in_array('invoicereccard', $TContext) |
|
| 383 | 383 | ) |
| 384 | 384 | { |
| 385 | - $hideInnerLines = isset( $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']] ) ? $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']] : 0; |
|
| 386 | - $hidedetails = isset( $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']] ) ? $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']] : 0; |
|
| 387 | - $hidepricesDefaultConf = !empty($conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED)?$conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED:0; |
|
| 388 | - $hideprices= isset( $_SESSION['subtotal_hideprices_'.$parameters['modulepart']] ) ? $_SESSION['subtotal_hideprices_'.$parameters['modulepart']] : $hidepricesDefaultConf; |
|
| 385 | + $hideInnerLines = isset($_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']]) ? $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']] : 0; |
|
| 386 | + $hidedetails = isset($_SESSION['subtotal_hidedetails_'.$parameters['modulepart']]) ? $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']] : 0; |
|
| 387 | + $hidepricesDefaultConf = !empty($conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED) ? $conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED : 0; |
|
| 388 | + $hideprices = isset($_SESSION['subtotal_hideprices_'.$parameters['modulepart']]) ? $_SESSION['subtotal_hideprices_'.$parameters['modulepart']] : $hidepricesDefaultConf; |
|
| 389 | 389 | |
| 390 | - $var=false; |
|
| 391 | - $out.= '<tr '.$bc[$var].'> |
|
| 390 | + $var = false; |
|
| 391 | + $out .= '<tr '.$bc[$var].'> |
|
| 392 | 392 | <td colspan="4" align="right"> |
| 393 | 393 | <label for="hideInnerLines">'.$langs->trans('HideInnerLines').'</label> |
| 394 | - <input type="checkbox" onclick="if($(this).is(\':checked\')) { $(\'#hidedetails\').prop(\'checked\', \'checked\') }" id="hideInnerLines" name="hideInnerLines" value="1" '.(( $hideInnerLines ) ? 'checked="checked"' : '' ).' /> |
|
| 394 | + <input type="checkbox" onclick="if($(this).is(\':checked\')) { $(\'#hidedetails\').prop(\'checked\', \'checked\') }" id="hideInnerLines" name="hideInnerLines" value="1" '.(($hideInnerLines) ? 'checked="checked"' : '').' /> |
|
| 395 | 395 | </td> |
| 396 | 396 | </tr>'; |
| 397 | 397 | |
| 398 | - $var=!$var; |
|
| 399 | - $out.= '<tr '.$bc[$var].'> |
|
| 398 | + $var = !$var; |
|
| 399 | + $out .= '<tr '.$bc[$var].'> |
|
| 400 | 400 | <td colspan="4" align="right"> |
| 401 | 401 | <label for="hidedetails">'.$langs->trans('SubTotalhidedetails').'</label> |
| 402 | - <input type="checkbox" id="hidedetails" name="hidedetails" value="1" '.(( $hidedetails ) ? 'checked="checked"' : '' ).' /> |
|
| 402 | + <input type="checkbox" id="hidedetails" name="hidedetails" value="1" '.(($hidedetails) ? 'checked="checked"' : '').' /> |
|
| 403 | 403 | </td> |
| 404 | 404 | </tr>'; |
| 405 | 405 | |
| 406 | - $var=!$var; |
|
| 407 | - $out.= '<tr '.$bc[$var].'> |
|
| 406 | + $var = !$var; |
|
| 407 | + $out .= '<tr '.$bc[$var].'> |
|
| 408 | 408 | <td colspan="4" align="right"> |
| 409 | 409 | <label for="hidedetails">'.$langs->trans('SubTotalhidePrice').'</label> |
| 410 | - <input type="checkbox" id="hideprices" name="hideprices" value="1" '.(( $hideprices ) ? 'checked="checked"' : '' ).' /> |
|
| 410 | + <input type="checkbox" id="hideprices" name="hideprices" value="1" '.(($hideprices) ? 'checked="checked"' : '').' /> |
|
| 411 | 411 | </td> |
| 412 | 412 | </tr>'; |
| 413 | 413 | |
| 414 | 414 | |
| 415 | 415 | |
| 416 | 416 | if ( |
| 417 | - (in_array('propalcard',$TContext) && !empty($conf->global->SUBTOTAL_PROPAL_ADD_RECAP)) |
|
| 418 | - || (in_array('ordercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
| 419 | - || (in_array('ordersuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
| 420 | - || (in_array('invoicecard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
| 421 | - || (in_array('invoicesuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
| 422 | - || (in_array('invoicereccard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP )) |
|
| 417 | + (in_array('propalcard', $TContext) && !empty($conf->global->SUBTOTAL_PROPAL_ADD_RECAP)) |
|
| 418 | + || (in_array('ordercard', $TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
| 419 | + || (in_array('ordersuppliercard', $TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
| 420 | + || (in_array('invoicecard', $TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
| 421 | + || (in_array('invoicesuppliercard', $TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
| 422 | + || (in_array('invoicereccard', $TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
| 423 | 423 | ) |
| 424 | 424 | { |
| 425 | - $var=!$var; |
|
| 426 | - $out.= ' |
|
| 425 | + $var = !$var; |
|
| 426 | + $out .= ' |
|
| 427 | 427 | <tr '.$bc[$var].'> |
| 428 | 428 | <td colspan="4" align="right"> |
| 429 | 429 | <label for="subtotal_add_recap">'.$langs->trans('subtotal_add_recap').'</label> |
| 430 | - <input type="checkbox" id="subtotal_add_recap" name="subtotal_add_recap" value="1" '.( GETPOST('subtotal_add_recap') ? 'checked="checked"' : '' ).' /> |
|
| 430 | + <input type="checkbox" id="subtotal_add_recap" name="subtotal_add_recap" value="1" '.(GETPOST('subtotal_add_recap') ? 'checked="checked"' : '').' /> |
|
| 431 | 431 | </td> |
| 432 | 432 | </tr>'; |
| 433 | 433 | } |
@@ -443,7 +443,7 @@ discard block |
||
| 443 | 443 | function formEditProductOptions($parameters, &$object, &$action, $hookmanager) |
| 444 | 444 | { |
| 445 | 445 | |
| 446 | - if (in_array('invoicecard',explode(':',$parameters['context']))) |
|
| 446 | + if (in_array('invoicecard', explode(':', $parameters['context']))) |
|
| 447 | 447 | { |
| 448 | 448 | |
| 449 | 449 | } |
@@ -454,13 +454,13 @@ discard block |
||
| 454 | 454 | function ODTSubstitutionLine(&$parameters, &$object, $action, $hookmanager) { |
| 455 | 455 | global $conf; |
| 456 | 456 | |
| 457 | - if($action === 'builddoc') { |
|
| 457 | + if ($action === 'builddoc') { |
|
| 458 | 458 | |
| 459 | 459 | $line = &$parameters['line']; |
| 460 | 460 | $object = &$parameters['object']; |
| 461 | 461 | $substitutionarray = &$parameters['substitutionarray']; |
| 462 | 462 | |
| 463 | - if($line->product_type == 9 && $line->special_code == $this->module_number) { |
|
| 463 | + if ($line->product_type == 9 && $line->special_code == $this->module_number) { |
|
| 464 | 464 | $substitutionarray['line_modsubtotal'] = 1; |
| 465 | 465 | |
| 466 | 466 | $substitutionarray['line_price_ht'] |
@@ -471,7 +471,7 @@ discard block |
||
| 471 | 471 | = $substitutionarray['line_up'] |
| 472 | 472 | = ''; |
| 473 | 473 | |
| 474 | - if($line->qty>90) { |
|
| 474 | + if ($line->qty > 90) { |
|
| 475 | 475 | $substitutionarray['line_modsubtotal_total'] = true; |
| 476 | 476 | |
| 477 | 477 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
@@ -485,7 +485,7 @@ discard block |
||
| 485 | 485 | |
| 486 | 486 | |
| 487 | 487 | } |
| 488 | - else{ |
|
| 488 | + else { |
|
| 489 | 489 | $substitutionarray['line_not_modsubtotal'] = true; |
| 490 | 490 | $substitutionarray['line_modsubtotal'] = 0; |
| 491 | 491 | } |
@@ -497,29 +497,29 @@ discard block |
||
| 497 | 497 | function createFrom($parameters, &$object, $action, $hookmanager) { |
| 498 | 498 | |
| 499 | 499 | if ( |
| 500 | - in_array('invoicecard',explode(':',$parameters['context'])) |
|
| 501 | - || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
| 502 | - || in_array('propalcard',explode(':',$parameters['context'])) |
|
| 503 | - || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
| 504 | - || in_array('ordercard',explode(':',$parameters['context'])) |
|
| 505 | - || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
| 506 | - || in_array('invoicereccard',explode(':',$parameters['context'])) |
|
| 500 | + in_array('invoicecard', explode(':', $parameters['context'])) |
|
| 501 | + || in_array('invoicesuppliercard', explode(':', $parameters['context'])) |
|
| 502 | + || in_array('propalcard', explode(':', $parameters['context'])) |
|
| 503 | + || in_array('supplier_proposalcard', explode(':', $parameters['context'])) |
|
| 504 | + || in_array('ordercard', explode(':', $parameters['context'])) |
|
| 505 | + || in_array('ordersuppliercard', explode(':', $parameters['context'])) |
|
| 506 | + || in_array('invoicereccard', explode(':', $parameters['context'])) |
|
| 507 | 507 | ) { |
| 508 | 508 | |
| 509 | 509 | global $db; |
| 510 | 510 | |
| 511 | 511 | $objFrom = $parameters['objFrom']; |
| 512 | 512 | |
| 513 | - foreach($objFrom->lines as $k=> &$lineOld) { |
|
| 513 | + foreach ($objFrom->lines as $k=> &$lineOld) { |
|
| 514 | 514 | |
| 515 | - if($lineOld->product_type == 9 && $lineOld->info_bits > 0 ) { |
|
| 515 | + if ($lineOld->product_type == 9 && $lineOld->info_bits > 0) { |
|
| 516 | 516 | |
| 517 | 517 | $line = & $object->lines[$k]; |
| 518 | 518 | |
| 519 | 519 | $idLine = (int) ($line->id ? $line->id : $line->rowid); |
| 520 | 520 | |
| 521 | 521 | $db->query("UPDATE ".MAIN_DB_PREFIX.$line->table_element." |
| 522 | - SET info_bits=".(int)$lineOld->info_bits." |
|
| 522 | + SET info_bits=".(int) $lineOld->info_bits." |
|
| 523 | 523 | WHERE rowid = ".$idLine." |
| 524 | 524 | "); |
| 525 | 525 | |
@@ -535,15 +535,15 @@ discard block |
||
| 535 | 535 | |
| 536 | 536 | function doActions($parameters, &$object, $action, $hookmanager) |
| 537 | 537 | { |
| 538 | - global $db, $conf, $langs,$user; |
|
| 538 | + global $db, $conf, $langs, $user; |
|
| 539 | 539 | |
| 540 | 540 | dol_include_once('/subtotal/class/subtotal.class.php'); |
| 541 | 541 | dol_include_once('/subtotal/lib/subtotal.lib.php'); |
| 542 | - require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; |
|
| 542 | + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; |
|
| 543 | 543 | |
| 544 | 544 | $showBlockExtrafields = GETPOST('showBlockExtrafields'); |
| 545 | 545 | |
| 546 | - if($object->element=='facture') $idvar = 'facid'; |
|
| 546 | + if ($object->element == 'facture') $idvar = 'facid'; |
|
| 547 | 547 | else $idvar = 'id'; |
| 548 | 548 | |
| 549 | 549 | if ($action == 'updateligne' || $action == 'updateline') |
@@ -556,7 +556,7 @@ discard block |
||
| 556 | 556 | if ($line->id == $lineid && TSubtotal::isModSubtotalLine($line)) |
| 557 | 557 | { |
| 558 | 558 | $found = true; |
| 559 | - if(TSubtotal::isTitle($line) && !empty($showBlockExtrafields)) { |
|
| 559 | + if (TSubtotal::isTitle($line) && !empty($showBlockExtrafields)) { |
|
| 560 | 560 | $extrafieldsline = new ExtraFields($db); |
| 561 | 561 | $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); |
| 562 | 562 | $extrafieldsline->setOptionalsFromPost($extralabelsline, $line); |
@@ -575,43 +575,43 @@ discard block |
||
| 575 | 575 | exit; // Surtout ne pas laisser Dolibarr faire du traitement sur le updateligne sinon ça plante les données de la ligne |
| 576 | 576 | } |
| 577 | 577 | } |
| 578 | - else if($action === 'builddoc') { |
|
| 578 | + else if ($action === 'builddoc') { |
|
| 579 | 579 | |
| 580 | 580 | if ( |
| 581 | - in_array('invoicecard',explode(':',$parameters['context'])) |
|
| 582 | - || in_array('propalcard',explode(':',$parameters['context'])) |
|
| 583 | - || in_array('ordercard',explode(':',$parameters['context'])) |
|
| 584 | - || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
| 585 | - || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
| 586 | - || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
| 581 | + in_array('invoicecard', explode(':', $parameters['context'])) |
|
| 582 | + || in_array('propalcard', explode(':', $parameters['context'])) |
|
| 583 | + || in_array('ordercard', explode(':', $parameters['context'])) |
|
| 584 | + || in_array('ordersuppliercard', explode(':', $parameters['context'])) |
|
| 585 | + || in_array('invoicesuppliercard', explode(':', $parameters['context'])) |
|
| 586 | + || in_array('supplier_proposalcard', explode(':', $parameters['context'])) |
|
| 587 | 587 | ) |
| 588 | 588 | { |
| 589 | - if(in_array('invoicecard',explode(':',$parameters['context']))) { |
|
| 589 | + if (in_array('invoicecard', explode(':', $parameters['context']))) { |
|
| 590 | 590 | $sessname = 'subtotal_hideInnerLines_facture'; |
| 591 | 591 | $sessname2 = 'subtotal_hidedetails_facture'; |
| 592 | 592 | $sessname3 = 'subtotal_hideprices_facture'; |
| 593 | 593 | } |
| 594 | - elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) { |
|
| 594 | + elseif (in_array('invoicesuppliercard', explode(':', $parameters['context']))) { |
|
| 595 | 595 | $sessname = 'subtotal_hideInnerLines_facture_fournisseur'; |
| 596 | 596 | $sessname2 = 'subtotal_hidedetails_facture_fournisseur'; |
| 597 | 597 | $sessname3 = 'subtotal_hideprices_facture_fournisseur'; |
| 598 | 598 | } |
| 599 | - elseif(in_array('propalcard',explode(':',$parameters['context']))) { |
|
| 599 | + elseif (in_array('propalcard', explode(':', $parameters['context']))) { |
|
| 600 | 600 | $sessname = 'subtotal_hideInnerLines_propal'; |
| 601 | 601 | $sessname2 = 'subtotal_hidedetails_propal'; |
| 602 | 602 | $sessname3 = 'subtotal_hideprices_propal'; |
| 603 | 603 | } |
| 604 | - elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) { |
|
| 604 | + elseif (in_array('supplier_proposalcard', explode(':', $parameters['context']))) { |
|
| 605 | 605 | $sessname = 'subtotal_hideInnerLines_supplier_proposal'; |
| 606 | 606 | $sessname2 = 'subtotal_hidedetails_supplier_proposal'; |
| 607 | 607 | $sessname3 = 'subtotal_hideprices_supplier_proposal'; |
| 608 | 608 | } |
| 609 | - elseif(in_array('ordercard',explode(':',$parameters['context']))) { |
|
| 609 | + elseif (in_array('ordercard', explode(':', $parameters['context']))) { |
|
| 610 | 610 | $sessname = 'subtotal_hideInnerLines_commande'; |
| 611 | 611 | $sessname2 = 'subtotal_hidedetails_commande'; |
| 612 | 612 | $sessname3 = 'subtotal_hideprices_commande'; |
| 613 | 613 | } |
| 614 | - elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) { |
|
| 614 | + elseif (in_array('ordersuppliercard', explode(':', $parameters['context']))) { |
|
| 615 | 615 | $sessname = 'subtotal_hideInnerLines_commande_fournisseur'; |
| 616 | 616 | $sessname2 = 'subtotal_hidedetails_commande_fournisseur'; |
| 617 | 617 | $sessname3 = 'subtotal_hideprices_commande_fournisseur'; |
@@ -624,22 +624,22 @@ discard block |
||
| 624 | 624 | |
| 625 | 625 | global $hideprices; |
| 626 | 626 | |
| 627 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
| 627 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
| 628 | 628 | $_SESSION[$sessname] = $hideInnerLines; |
| 629 | 629 | |
| 630 | - $hidedetails= (int)GETPOST('hidedetails'); |
|
| 630 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
| 631 | 631 | $_SESSION[$sessname2] = $hidedetails; |
| 632 | 632 | |
| 633 | - $hideprices= (int)GETPOST('hideprices'); |
|
| 633 | + $hideprices = (int) GETPOST('hideprices'); |
|
| 634 | 634 | $_SESSION[$sessname3] = $hideprices; |
| 635 | 635 | |
| 636 | - foreach($object->lines as &$line) { |
|
| 636 | + foreach ($object->lines as &$line) { |
|
| 637 | 637 | if ($line->product_type == 9 && $line->special_code == $this->module_number) { |
| 638 | 638 | |
| 639 | - if($line->qty>=90) { |
|
| 639 | + if ($line->qty >= 90) { |
|
| 640 | 640 | $line->modsubtotal_total = 1; |
| 641 | 641 | } |
| 642 | - else{ |
|
| 642 | + else { |
|
| 643 | 643 | $line->modsubtotal_title = 1; |
| 644 | 644 | } |
| 645 | 645 | |
@@ -649,34 +649,34 @@ discard block |
||
| 649 | 649 | } |
| 650 | 650 | |
| 651 | 651 | } |
| 652 | - else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') { |
|
| 652 | + else if ($action === 'confirm_delete_all_lines' && GETPOST('confirm') == 'yes') { |
|
| 653 | 653 | |
| 654 | 654 | $Tab = $this->getArrayOfLineForAGroup($object, GETPOST('lineid')); |
| 655 | 655 | |
| 656 | - foreach($Tab as $idLine) { |
|
| 656 | + foreach ($Tab as $idLine) { |
|
| 657 | 657 | /** |
| 658 | 658 | * @var $object Facture |
| 659 | 659 | */ |
| 660 | - if($object->element=='facture') $object->deleteline($idLine); |
|
| 660 | + if ($object->element == 'facture') $object->deleteline($idLine); |
|
| 661 | 661 | /** |
| 662 | 662 | * @var $object Facture fournisseur |
| 663 | 663 | */ |
| 664 | - else if($object->element=='invoice_supplier') |
|
| 664 | + else if ($object->element == 'invoice_supplier') |
|
| 665 | 665 | { |
| 666 | 666 | $object->deleteline($idLine); |
| 667 | 667 | } |
| 668 | 668 | /** |
| 669 | 669 | * @var $object Propal |
| 670 | 670 | */ |
| 671 | - else if($object->element=='propal') $object->deleteline($idLine); |
|
| 671 | + else if ($object->element == 'propal') $object->deleteline($idLine); |
|
| 672 | 672 | /** |
| 673 | 673 | * @var $object Propal Fournisseur |
| 674 | 674 | */ |
| 675 | - else if($object->element=='supplier_proposal') $object->deleteline($idLine); |
|
| 675 | + else if ($object->element == 'supplier_proposal') $object->deleteline($idLine); |
|
| 676 | 676 | /** |
| 677 | 677 | * @var $object Commande |
| 678 | 678 | */ |
| 679 | - else if($object->element=='commande') |
|
| 679 | + else if ($object->element == 'commande') |
|
| 680 | 680 | { |
| 681 | 681 | if ((float) DOL_VERSION >= 5.0) $object->deleteline($user, $idLine); |
| 682 | 682 | else $object->deleteline($idLine); |
@@ -684,14 +684,14 @@ discard block |
||
| 684 | 684 | /** |
| 685 | 685 | * @var $object Commande fournisseur |
| 686 | 686 | */ |
| 687 | - else if($object->element=='order_supplier') |
|
| 687 | + else if ($object->element == 'order_supplier') |
|
| 688 | 688 | { |
| 689 | 689 | $object->deleteline($idLine); |
| 690 | 690 | } |
| 691 | 691 | /** |
| 692 | 692 | * @var $object Facturerec |
| 693 | 693 | */ |
| 694 | - else if($object->element=='facturerec') $object->deleteline($idLine); |
|
| 694 | + else if ($object->element == 'facturerec') $object->deleteline($idLine); |
|
| 695 | 695 | } |
| 696 | 696 | |
| 697 | 697 | header('location:?id='.$object->id); |
@@ -714,7 +714,7 @@ discard block |
||
| 714 | 714 | return 0; |
| 715 | 715 | } |
| 716 | 716 | |
| 717 | - function formAddObjectLine ($parameters, &$object, &$action, $hookmanager) { |
|
| 717 | + function formAddObjectLine($parameters, &$object, &$action, $hookmanager) { |
|
| 718 | 718 | return 0; |
| 719 | 719 | } |
| 720 | 720 | |
@@ -726,22 +726,22 @@ discard block |
||
| 726 | 726 | |
| 727 | 727 | $found = false; |
| 728 | 728 | |
| 729 | - $Tab= array(); |
|
| 729 | + $Tab = array(); |
|
| 730 | 730 | |
| 731 | - foreach($object->lines as $l) { |
|
| 731 | + foreach ($object->lines as $l) { |
|
| 732 | 732 | |
| 733 | 733 | $lid = (!empty($l->rowid) ? $l->rowid : $l->id); |
| 734 | - if($lid == $lineid) { |
|
| 734 | + if ($lid == $lineid) { |
|
| 735 | 735 | |
| 736 | 736 | $found = true; |
| 737 | 737 | $qty_line = $l->qty; |
| 738 | 738 | } |
| 739 | 739 | |
| 740 | - if($found) { |
|
| 740 | + if ($found) { |
|
| 741 | 741 | |
| 742 | 742 | $Tab[] = (!empty($l->rowid) ? $l->rowid : $l->id); |
| 743 | 743 | |
| 744 | - if($l->special_code==$this->module_number && (($l->qty==99 && $qty_line==1) || ($l->qty==98 && $qty_line==2)) ) { |
|
| 744 | + if ($l->special_code == $this->module_number && (($l->qty == 99 && $qty_line == 1) || ($l->qty == 98 && $qty_line == 2))) { |
|
| 745 | 745 | break; // end of story |
| 746 | 746 | } |
| 747 | 747 | } |
@@ -770,7 +770,7 @@ discard block |
||
| 770 | 770 | * |
| 771 | 771 | * @param $use_level isn't used anymore |
| 772 | 772 | */ |
| 773 | - function getTotalLineFromObject(&$object, &$line, $use_level=false, $return_all=0) { |
|
| 773 | + function getTotalLineFromObject(&$object, &$line, $use_level = false, $return_all = 0) { |
|
| 774 | 774 | |
| 775 | 775 | $rang = $line->rang; |
| 776 | 776 | $qty_line = $line->qty; |
@@ -781,21 +781,21 @@ discard block |
||
| 781 | 781 | $TTotal_tva = array(); |
| 782 | 782 | |
| 783 | 783 | dol_include_once('/subtotal/class/subtotal.class.php'); |
| 784 | - foreach($object->lines as $l) { |
|
| 784 | + foreach ($object->lines as $l) { |
|
| 785 | 785 | //print $l->rang.'>='.$rang.' '.$total.'<br/>'; |
| 786 | - if($l->rang>=$rang) { |
|
| 786 | + if ($l->rang >= $rang) { |
|
| 787 | 787 | //echo 'return!<br>'; |
| 788 | 788 | if (!$return_all) return $total; |
| 789 | 789 | else return array($total, $total_tva, $total_ttc, $TTotal_tva); |
| 790 | 790 | } |
| 791 | - else if(TSubtotal::isTitle($l, 100 - $qty_line)) |
|
| 791 | + else if (TSubtotal::isTitle($l, 100 - $qty_line)) |
|
| 792 | 792 | { |
| 793 | 793 | $total = 0; |
| 794 | 794 | $total_tva = 0; |
| 795 | 795 | $total_ttc = 0; |
| 796 | 796 | $TTotal_tva = array(); |
| 797 | 797 | } |
| 798 | - elseif(!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) { |
|
| 798 | + elseif (!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) { |
|
| 799 | 799 | $total += $l->total_ht; |
| 800 | 800 | $total_tva += $l->total_tva; |
| 801 | 801 | $TTotal_tva[$l->tva_tx] += $l->total_tva; |
@@ -814,18 +814,18 @@ discard block |
||
| 814 | 814 | |
| 815 | 815 | $rang = $line->rang; |
| 816 | 816 | $total = 0; |
| 817 | - foreach($object->lines as $l) { |
|
| 818 | - if($l->rang>=$rang) { |
|
| 817 | + foreach ($object->lines as $l) { |
|
| 818 | + if ($l->rang >= $rang) { |
|
| 819 | 819 | return price($total); |
| 820 | 820 | } |
| 821 | - if (TSubtotal::isSubtotal($l)){ |
|
| 821 | + if (TSubtotal::isSubtotal($l)) { |
|
| 822 | 822 | $total = 0; |
| 823 | - } else if ($l->situation_percent > 0 ){ |
|
| 823 | + } else if ($l->situation_percent > 0) { |
|
| 824 | 824 | |
| 825 | 825 | |
| 826 | 826 | $prev_progress = $l->get_prev_progress($object->id); |
| 827 | - $progress = ($l->situation_percent - $prev_progress) /100; |
|
| 828 | - $total += ($l->total_ht/($l->situation_percent/100)) * $progress; |
|
| 827 | + $progress = ($l->situation_percent - $prev_progress) / 100; |
|
| 828 | + $total += ($l->total_ht / ($l->situation_percent / 100)) * $progress; |
|
| 829 | 829 | |
| 830 | 830 | } |
| 831 | 831 | } |
@@ -844,10 +844,10 @@ discard block |
||
| 844 | 844 | * @param $w float width |
| 845 | 845 | * @param $h float height |
| 846 | 846 | */ |
| 847 | - function pdf_add_total(&$pdf,&$object, &$line, $label, $description,$posx, $posy, $w, $h) { |
|
| 848 | - global $conf,$subtotal_last_title_posy; |
|
| 847 | + function pdf_add_total(&$pdf, &$object, &$line, $label, $description, $posx, $posy, $w, $h) { |
|
| 848 | + global $conf, $subtotal_last_title_posy; |
|
| 849 | 849 | |
| 850 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
| 850 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
| 851 | 851 | if (!empty($conf->global->SUBTOTAL_ONE_LINE_IF_HIDE_INNERLINES) && $hideInnerLines && !empty($subtotal_last_title_posy)) |
| 852 | 852 | { |
| 853 | 853 | $posy = $subtotal_last_title_posy; |
@@ -857,34 +857,34 @@ discard block |
||
| 857 | 857 | $hidePriceOnSubtotalLines = (int) GETPOST('hide_price_on_subtotal_lines'); |
| 858 | 858 | |
| 859 | 859 | $set_pagebreak_margin = false; |
| 860 | - if(method_exists('Closure','bind')) { |
|
| 860 | + if (method_exists('Closure', 'bind')) { |
|
| 861 | 861 | $pageBreakOriginalValue = $pdf->AcceptPageBreak(); |
| 862 | - $sweetsThief = function ($pdf) { |
|
| 863 | - return $pdf->bMargin ; |
|
| 862 | + $sweetsThief = function($pdf) { |
|
| 863 | + return $pdf->bMargin; |
|
| 864 | 864 | }; |
| 865 | 865 | $sweetsThief = Closure::bind($sweetsThief, null, $pdf); |
| 866 | 866 | |
| 867 | - $bMargin = $sweetsThief($pdf); |
|
| 867 | + $bMargin = $sweetsThief($pdf); |
|
| 868 | 868 | |
| 869 | - $pdf->SetAutoPageBreak( false ); |
|
| 869 | + $pdf->SetAutoPageBreak(false); |
|
| 870 | 870 | |
| 871 | 871 | $set_pagebreak_margin = true; |
| 872 | 872 | } |
| 873 | 873 | |
| 874 | 874 | |
| 875 | - if($line->qty==99) |
|
| 876 | - $pdf->SetFillColor(220,220,220); |
|
| 877 | - elseif ($line->qty==98) |
|
| 878 | - $pdf->SetFillColor(230,230,230); |
|
| 875 | + if ($line->qty == 99) |
|
| 876 | + $pdf->SetFillColor(220, 220, 220); |
|
| 877 | + elseif ($line->qty == 98) |
|
| 878 | + $pdf->SetFillColor(230, 230, 230); |
|
| 879 | 879 | else |
| 880 | - $pdf->SetFillColor(240,240,240); |
|
| 880 | + $pdf->SetFillColor(240, 240, 240); |
|
| 881 | 881 | |
| 882 | 882 | $style = 'B'; |
| 883 | 883 | if (!empty($conf->global->SUBTOTAL_SUBTOTAL_STYLE)) $style = $conf->global->SUBTOTAL_SUBTOTAL_STYLE; |
| 884 | 884 | |
| 885 | 885 | $pdf->SetFont('', $style, 9); |
| 886 | 886 | |
| 887 | - $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'R',true); |
|
| 887 | + $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'R', true); |
|
| 888 | 888 | // var_dump($bMargin); |
| 889 | 889 | $pageAfter = $pdf->getPage(); |
| 890 | 890 | |
@@ -909,7 +909,7 @@ discard block |
||
| 909 | 909 | } |
| 910 | 910 | } |
| 911 | 911 | |
| 912 | - if($total_to_print) { |
|
| 912 | + if ($total_to_print) { |
|
| 913 | 913 | |
| 914 | 914 | if (GETPOST('hideInnerLines')) |
| 915 | 915 | { |
@@ -923,7 +923,7 @@ discard block |
||
| 923 | 923 | else |
| 924 | 924 | { |
| 925 | 925 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
| 926 | - if(get_class($object) == 'Facture' && $object->type==Facture::TYPE_SITUATION){//Facture de situation |
|
| 926 | + if (get_class($object) == 'Facture' && $object->type == Facture::TYPE_SITUATION) {//Facture de situation |
|
| 927 | 927 | $total_to_print = $this->getTotalToPrintSituation($object, $line); |
| 928 | 928 | } else { |
| 929 | 929 | $total_to_print = price($total); |
@@ -937,11 +937,11 @@ discard block |
||
| 937 | 937 | } |
| 938 | 938 | |
| 939 | 939 | $pdf->SetXY($pdf->postotalht, $posy); |
| 940 | - if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
| 941 | - $pdf->MultiCell($pdf->page_largeur-$pdf->marge_droite-$pdf->postotalht, 3, $total_to_print, 0, 'R', 0); |
|
| 940 | + if ($set_pagebreak_margin) $pdf->SetAutoPageBreak($pageBreakOriginalValue, $bMargin); |
|
| 941 | + $pdf->MultiCell($pdf->page_largeur - $pdf->marge_droite - $pdf->postotalht, 3, $total_to_print, 0, 'R', 0); |
|
| 942 | 942 | } |
| 943 | - else{ |
|
| 944 | - if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
| 943 | + else { |
|
| 944 | + if ($set_pagebreak_margin) $pdf->SetAutoPageBreak($pageBreakOriginalValue, $bMargin); |
|
| 945 | 945 | } |
| 946 | 946 | |
| 947 | 947 | $posy = $posy + $cell_height; |
@@ -961,22 +961,22 @@ discard block |
||
| 961 | 961 | * @param $w float width |
| 962 | 962 | * @param $h float height |
| 963 | 963 | */ |
| 964 | - function pdf_add_title(&$pdf,&$object, &$line, $label, $description,$posx, $posy, $w, $h) { |
|
| 964 | + function pdf_add_title(&$pdf, &$object, &$line, $label, $description, $posx, $posy, $w, $h) { |
|
| 965 | 965 | |
| 966 | - global $db,$conf,$subtotal_last_title_posy; |
|
| 966 | + global $db, $conf, $subtotal_last_title_posy; |
|
| 967 | 967 | |
| 968 | 968 | $subtotal_last_title_posy = $posy; |
| 969 | - $pdf->SetXY ($posx, $posy); |
|
| 969 | + $pdf->SetXY($posx, $posy); |
|
| 970 | 970 | |
| 971 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
| 971 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
| 972 | 972 | |
| 973 | 973 | |
| 974 | 974 | |
| 975 | - $style = ($line->qty==1) ? 'BU' : 'BUI'; |
|
| 975 | + $style = ($line->qty == 1) ? 'BU' : 'BUI'; |
|
| 976 | 976 | if (!empty($conf->global->SUBTOTAL_TITLE_STYLE)) $style = $conf->global->SUBTOTAL_TITLE_STYLE; |
| 977 | 977 | |
| 978 | - if($hideInnerLines) { |
|
| 979 | - if($line->qty==1)$pdf->SetFont('', $style, 9); |
|
| 978 | + if ($hideInnerLines) { |
|
| 979 | + if ($line->qty == 1)$pdf->SetFont('', $style, 9); |
|
| 980 | 980 | else |
| 981 | 981 | { |
| 982 | 982 | if (!empty($conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES)) $style = $conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES; |
@@ -985,43 +985,43 @@ discard block |
||
| 985 | 985 | } |
| 986 | 986 | else { |
| 987 | 987 | |
| 988 | - if($line->qty==1)$pdf->SetFont('', $style, 9); //TODO if super utile |
|
| 988 | + if ($line->qty == 1)$pdf->SetFont('', $style, 9); //TODO if super utile |
|
| 989 | 989 | else $pdf->SetFont('', $style, 9); |
| 990 | 990 | |
| 991 | 991 | } |
| 992 | 992 | |
| 993 | 993 | 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 |
| 994 | - else $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J',true); // et maintenant avec du HTML |
|
| 994 | + else $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J', true); // et maintenant avec du HTML |
|
| 995 | 995 | |
| 996 | - if($description && !$hidedesc) { |
|
| 996 | + if ($description && !$hidedesc) { |
|
| 997 | 997 | $posy = $pdf->GetY(); |
| 998 | 998 | |
| 999 | 999 | $pdf->SetFont('', '', 8); |
| 1000 | 1000 | |
| 1001 | - $pdf->writeHTMLCell($w, $h, $posx, $posy, $description, 0, 1, false, true, 'J',true); |
|
| 1001 | + $pdf->writeHTMLCell($w, $h, $posx, $posy, $description, 0, 1, false, true, 'J', true); |
|
| 1002 | 1002 | |
| 1003 | 1003 | } |
| 1004 | 1004 | |
| 1005 | 1005 | } |
| 1006 | 1006 | |
| 1007 | - function pdf_writelinedesc_ref($parameters=array(), &$object, &$action='') { |
|
| 1007 | + function pdf_writelinedesc_ref($parameters = array(), &$object, &$action = '') { |
|
| 1008 | 1008 | // ultimate PDF hook O_o |
| 1009 | 1009 | |
| 1010 | - return $this->pdf_writelinedesc($parameters,$object,$action); |
|
| 1010 | + return $this->pdf_writelinedesc($parameters, $object, $action); |
|
| 1011 | 1011 | |
| 1012 | 1012 | } |
| 1013 | 1013 | |
| 1014 | 1014 | function isModSubtotalLine(&$parameters, &$object) { |
| 1015 | 1015 | |
| 1016 | - if(is_array($parameters)) { |
|
| 1016 | + if (is_array($parameters)) { |
|
| 1017 | 1017 | $i = & $parameters['i']; |
| 1018 | 1018 | } |
| 1019 | 1019 | else { |
| 1020 | - $i = (int)$parameters; |
|
| 1020 | + $i = (int) $parameters; |
|
| 1021 | 1021 | } |
| 1022 | 1022 | |
| 1023 | 1023 | |
| 1024 | - if($object->lines[$i]->special_code == $this->module_number && $object->lines[$i]->product_type == 9) { |
|
| 1024 | + if ($object->lines[$i]->special_code == $this->module_number && $object->lines[$i]->product_type == 9) { |
|
| 1025 | 1025 | return true; |
| 1026 | 1026 | } |
| 1027 | 1027 | |
@@ -1029,43 +1029,43 @@ discard block |
||
| 1029 | 1029 | |
| 1030 | 1030 | } |
| 1031 | 1031 | |
| 1032 | - function pdf_getlineqty($parameters=array(), &$object, &$action='') { |
|
| 1033 | - global $conf,$hideprices; |
|
| 1032 | + function pdf_getlineqty($parameters = array(), &$object, &$action = '') { |
|
| 1033 | + global $conf, $hideprices; |
|
| 1034 | 1034 | |
| 1035 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
| 1035 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
| 1036 | 1036 | |
| 1037 | 1037 | $this->resprints = ' '; |
| 1038 | 1038 | |
| 1039 | - if((float)DOL_VERSION<=3.6) { |
|
| 1039 | + if ((float) DOL_VERSION <= 3.6) { |
|
| 1040 | 1040 | return ''; |
| 1041 | 1041 | } |
| 1042 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1042 | + else if ((float) DOL_VERSION >= 3.8) { |
|
| 1043 | 1043 | return 1; |
| 1044 | 1044 | } |
| 1045 | 1045 | |
| 1046 | 1046 | } |
| 1047 | - elseif(!empty($hideprices)) { |
|
| 1047 | + elseif (!empty($hideprices)) { |
|
| 1048 | 1048 | $this->resprints = $object->lines[$parameters['i']]->qty; |
| 1049 | 1049 | return 1; |
| 1050 | 1050 | } |
| 1051 | 1051 | elseif (!empty($conf->global->SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY)) |
| 1052 | 1052 | { |
| 1053 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
| 1054 | - $hidedetails = (int)GETPOST('hidedetails'); |
|
| 1053 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
| 1054 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
| 1055 | 1055 | if (empty($hideInnerLines) && !empty($hidedetails)) |
| 1056 | 1056 | { |
| 1057 | 1057 | $this->resprints = $object->lines[$parameters['i']]->qty; |
| 1058 | 1058 | } |
| 1059 | 1059 | } |
| 1060 | 1060 | |
| 1061 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1062 | - else $i = (int)$parameters; |
|
| 1061 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
| 1062 | + else $i = (int) $parameters; |
|
| 1063 | 1063 | |
| 1064 | 1064 | 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) |
| 1065 | 1065 | |
| 1066 | - if(empty($object->lines[$i]->array_options)) $object->lines[$i]->fetch_optionals(); |
|
| 1066 | + if (empty($object->lines[$i]->array_options)) $object->lines[$i]->fetch_optionals(); |
|
| 1067 | 1067 | |
| 1068 | - if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
| 1068 | + if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
| 1069 | 1069 | { |
| 1070 | 1070 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
| 1071 | 1071 | { |
@@ -1077,20 +1077,20 @@ discard block |
||
| 1077 | 1077 | return 0; |
| 1078 | 1078 | } |
| 1079 | 1079 | |
| 1080 | - function pdf_getlinetotalexcltax($parameters=array(), &$object, &$action='') { |
|
| 1080 | + function pdf_getlinetotalexcltax($parameters = array(), &$object, &$action = '') { |
|
| 1081 | 1081 | global $conf, $hideprices, $hookmanager; |
| 1082 | 1082 | |
| 1083 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1084 | - else $i = (int)$parameters; |
|
| 1083 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
| 1084 | + else $i = (int) $parameters; |
|
| 1085 | 1085 | |
| 1086 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
| 1086 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
| 1087 | 1087 | |
| 1088 | 1088 | $this->resprints = ' '; |
| 1089 | 1089 | |
| 1090 | - if((float)DOL_VERSION<=3.6) { |
|
| 1090 | + if ((float) DOL_VERSION <= 3.6) { |
|
| 1091 | 1091 | return ''; |
| 1092 | 1092 | } |
| 1093 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1093 | + else if ((float) DOL_VERSION >= 3.8) { |
|
| 1094 | 1094 | return 1; |
| 1095 | 1095 | } |
| 1096 | 1096 | |
@@ -1116,7 +1116,7 @@ discard block |
||
| 1116 | 1116 | } |
| 1117 | 1117 | } |
| 1118 | 1118 | } |
| 1119 | - if ((int)GETPOST('hideInnerLines') && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)){ |
|
| 1119 | + if ((int) GETPOST('hideInnerLines') && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) { |
|
| 1120 | 1120 | $this->resprints = price($object->lines[$i]->total_ht); |
| 1121 | 1121 | } |
| 1122 | 1122 | |
@@ -1141,7 +1141,7 @@ discard block |
||
| 1141 | 1141 | { |
| 1142 | 1142 | // Check if a title exist for this line && if the title have subtotal |
| 1143 | 1143 | $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
| 1144 | - if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
| 1144 | + if (TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
| 1145 | 1145 | { |
| 1146 | 1146 | |
| 1147 | 1147 | $this->resprints = ' '; |
@@ -1161,7 +1161,7 @@ discard block |
||
| 1161 | 1161 | */ |
| 1162 | 1162 | private function callHook(&$object, &$hookmanager, $action, $params, $defaultReturn = 1) |
| 1163 | 1163 | { |
| 1164 | - $reshook=$hookmanager->executeHooks('subtotalHidePrices',$params, $object, $action); |
|
| 1164 | + $reshook = $hookmanager->executeHooks('subtotalHidePrices', $params, $object, $action); |
|
| 1165 | 1165 | if ($reshook < 0) |
| 1166 | 1166 | { |
| 1167 | 1167 | $this->error = $hookmanager->error; |
@@ -1177,7 +1177,7 @@ discard block |
||
| 1177 | 1177 | $this->resprints = $hookmanager->resprints; |
| 1178 | 1178 | |
| 1179 | 1179 | // override return (use $this->results['overrideReturn'] or $this->resArray['overrideReturn'] in other module action_xxxx.class.php ) |
| 1180 | - if(isset($hookmanager->resArray['overrideReturn'])) |
|
| 1180 | + if (isset($hookmanager->resArray['overrideReturn'])) |
|
| 1181 | 1181 | { |
| 1182 | 1182 | return $hookmanager->resArray['overrideReturn']; |
| 1183 | 1183 | } |
@@ -1186,25 +1186,25 @@ discard block |
||
| 1186 | 1186 | return $defaultReturn; |
| 1187 | 1187 | } |
| 1188 | 1188 | |
| 1189 | - function pdf_getlinetotalwithtax($parameters=array(), &$object, &$action='') { |
|
| 1189 | + function pdf_getlinetotalwithtax($parameters = array(), &$object, &$action = '') { |
|
| 1190 | 1190 | global $conf; |
| 1191 | 1191 | |
| 1192 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
| 1192 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
| 1193 | 1193 | |
| 1194 | 1194 | $this->resprints = ' '; |
| 1195 | 1195 | |
| 1196 | - if((float)DOL_VERSION<=3.6) { |
|
| 1196 | + if ((float) DOL_VERSION <= 3.6) { |
|
| 1197 | 1197 | return ''; |
| 1198 | 1198 | } |
| 1199 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1199 | + else if ((float) DOL_VERSION >= 3.8) { |
|
| 1200 | 1200 | return 1; |
| 1201 | 1201 | } |
| 1202 | 1202 | } |
| 1203 | 1203 | |
| 1204 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1205 | - else $i = (int)$parameters; |
|
| 1204 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
| 1205 | + else $i = (int) $parameters; |
|
| 1206 | 1206 | |
| 1207 | - if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
| 1207 | + if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
| 1208 | 1208 | { |
| 1209 | 1209 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
| 1210 | 1210 | { |
@@ -1216,24 +1216,24 @@ discard block |
||
| 1216 | 1216 | return 0; |
| 1217 | 1217 | } |
| 1218 | 1218 | |
| 1219 | - function pdf_getlineunit($parameters=array(), &$object, &$action='') { |
|
| 1219 | + function pdf_getlineunit($parameters = array(), &$object, &$action = '') { |
|
| 1220 | 1220 | global $conf; |
| 1221 | 1221 | |
| 1222 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
| 1222 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
| 1223 | 1223 | $this->resprints = ' '; |
| 1224 | 1224 | |
| 1225 | - if((float)DOL_VERSION<=3.6) { |
|
| 1225 | + if ((float) DOL_VERSION <= 3.6) { |
|
| 1226 | 1226 | return ''; |
| 1227 | 1227 | } |
| 1228 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1228 | + else if ((float) DOL_VERSION >= 3.8) { |
|
| 1229 | 1229 | return 1; |
| 1230 | 1230 | } |
| 1231 | 1231 | } |
| 1232 | 1232 | |
| 1233 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1234 | - else $i = (int)$parameters; |
|
| 1233 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
| 1234 | + else $i = (int) $parameters; |
|
| 1235 | 1235 | |
| 1236 | - if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
| 1236 | + if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
| 1237 | 1237 | { |
| 1238 | 1238 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
| 1239 | 1239 | { |
@@ -1245,21 +1245,21 @@ discard block |
||
| 1245 | 1245 | return 0; |
| 1246 | 1246 | } |
| 1247 | 1247 | |
| 1248 | - function pdf_getlineupexcltax($parameters=array(), &$object, &$action='') { |
|
| 1249 | - global $conf,$hideprices,$hookmanager; |
|
| 1248 | + function pdf_getlineupexcltax($parameters = array(), &$object, &$action = '') { |
|
| 1249 | + global $conf, $hideprices, $hookmanager; |
|
| 1250 | 1250 | |
| 1251 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
| 1251 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
| 1252 | 1252 | $this->resprints = ' '; |
| 1253 | 1253 | |
| 1254 | - if((float)DOL_VERSION<=3.6) { |
|
| 1254 | + if ((float) DOL_VERSION <= 3.6) { |
|
| 1255 | 1255 | return ''; |
| 1256 | 1256 | } |
| 1257 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1257 | + else if ((float) DOL_VERSION >= 3.8) { |
|
| 1258 | 1258 | return 1; |
| 1259 | 1259 | } |
| 1260 | 1260 | } |
| 1261 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1262 | - else $i = (int)$parameters; |
|
| 1261 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
| 1262 | + else $i = (int) $parameters; |
|
| 1263 | 1263 | |
| 1264 | 1264 | |
| 1265 | 1265 | // Si la gestion C/NC est active et que je suis sur un ligne dont l'extrafield est coché |
@@ -1285,7 +1285,7 @@ discard block |
||
| 1285 | 1285 | |
| 1286 | 1286 | // Check if a title exist for this line && if the title have subtotal |
| 1287 | 1287 | $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
| 1288 | - if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
| 1288 | + if (TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
| 1289 | 1289 | { |
| 1290 | 1290 | |
| 1291 | 1291 | $this->resprints = ' '; |
@@ -1299,24 +1299,24 @@ discard block |
||
| 1299 | 1299 | return 0; |
| 1300 | 1300 | } |
| 1301 | 1301 | |
| 1302 | - function pdf_getlineupwithtax($parameters=array(), &$object, &$action='') { |
|
| 1303 | - global $conf,$hideprices; |
|
| 1302 | + function pdf_getlineupwithtax($parameters = array(), &$object, &$action = '') { |
|
| 1303 | + global $conf, $hideprices; |
|
| 1304 | 1304 | |
| 1305 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
| 1305 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
| 1306 | 1306 | $this->resprints = ' '; |
| 1307 | - if((float)DOL_VERSION<=3.6) { |
|
| 1307 | + if ((float) DOL_VERSION <= 3.6) { |
|
| 1308 | 1308 | return ''; |
| 1309 | 1309 | } |
| 1310 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1310 | + else if ((float) DOL_VERSION >= 3.8) { |
|
| 1311 | 1311 | return 1; |
| 1312 | 1312 | } |
| 1313 | 1313 | } |
| 1314 | 1314 | |
| 1315 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1316 | - else $i = (int)$parameters; |
|
| 1315 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
| 1316 | + else $i = (int) $parameters; |
|
| 1317 | 1317 | |
| 1318 | 1318 | if (!empty($hideprices) |
| 1319 | - || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
| 1319 | + || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
| 1320 | 1320 | ) |
| 1321 | 1321 | { |
| 1322 | 1322 | if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
@@ -1329,22 +1329,22 @@ discard block |
||
| 1329 | 1329 | return 0; |
| 1330 | 1330 | } |
| 1331 | 1331 | |
| 1332 | - function pdf_getlinevatrate($parameters=array(), &$object, &$action='') { |
|
| 1333 | - global $conf,$hideprices,$hookmanager; |
|
| 1332 | + function pdf_getlinevatrate($parameters = array(), &$object, &$action = '') { |
|
| 1333 | + global $conf, $hideprices, $hookmanager; |
|
| 1334 | 1334 | |
| 1335 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
| 1335 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
| 1336 | 1336 | $this->resprints = ' '; |
| 1337 | 1337 | |
| 1338 | - if((float)DOL_VERSION<=3.6) { |
|
| 1338 | + if ((float) DOL_VERSION <= 3.6) { |
|
| 1339 | 1339 | return ''; |
| 1340 | 1340 | } |
| 1341 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1341 | + else if ((float) DOL_VERSION >= 3.8) { |
|
| 1342 | 1342 | return 1; |
| 1343 | 1343 | } |
| 1344 | 1344 | } |
| 1345 | 1345 | |
| 1346 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1347 | - else $i = (int)$parameters; |
|
| 1346 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
| 1347 | + else $i = (int) $parameters; |
|
| 1348 | 1348 | |
| 1349 | 1349 | 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) |
| 1350 | 1350 | |
@@ -1371,7 +1371,7 @@ discard block |
||
| 1371 | 1371 | |
| 1372 | 1372 | // Check if a title exist for this line && if the title have subtotal |
| 1373 | 1373 | $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
| 1374 | - if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
| 1374 | + if (TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
| 1375 | 1375 | { |
| 1376 | 1376 | |
| 1377 | 1377 | $this->resprints = ' '; |
@@ -1385,23 +1385,23 @@ discard block |
||
| 1385 | 1385 | return 0; |
| 1386 | 1386 | } |
| 1387 | 1387 | |
| 1388 | - function pdf_getlineprogress($parameters=array(), &$object, &$action) { |
|
| 1388 | + function pdf_getlineprogress($parameters = array(), &$object, &$action) { |
|
| 1389 | 1389 | global $conf; |
| 1390 | 1390 | |
| 1391 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
| 1391 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
| 1392 | 1392 | $this->resprints = ' '; |
| 1393 | - if((float)DOL_VERSION<=3.6) { |
|
| 1393 | + if ((float) DOL_VERSION <= 3.6) { |
|
| 1394 | 1394 | return ''; |
| 1395 | 1395 | } |
| 1396 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1396 | + else if ((float) DOL_VERSION >= 3.8) { |
|
| 1397 | 1397 | return 1; |
| 1398 | 1398 | } |
| 1399 | 1399 | } |
| 1400 | 1400 | |
| 1401 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1402 | - else $i = (int)$parameters; |
|
| 1401 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
| 1402 | + else $i = (int) $parameters; |
|
| 1403 | 1403 | |
| 1404 | - if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
| 1404 | + if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
| 1405 | 1405 | { |
| 1406 | 1406 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
| 1407 | 1407 | { |
@@ -1416,12 +1416,12 @@ discard block |
||
| 1416 | 1416 | function add_numerotation(&$object) { |
| 1417 | 1417 | global $conf; |
| 1418 | 1418 | |
| 1419 | - if(!empty($conf->global->SUBTOTAL_USE_NUMEROTATION)) { |
|
| 1419 | + if (!empty($conf->global->SUBTOTAL_USE_NUMEROTATION)) { |
|
| 1420 | 1420 | |
| 1421 | 1421 | $TLevelTitre = array(); |
| 1422 | 1422 | $prevlevel = 0; |
| 1423 | 1423 | |
| 1424 | - foreach($object->lines as $k=>&$line) |
|
| 1424 | + foreach ($object->lines as $k=>&$line) |
|
| 1425 | 1425 | { |
| 1426 | 1426 | if ($line->id > 0 && $this->isModSubtotalLine($k, $object) && $line->qty <= 10) |
| 1427 | 1427 | { |
@@ -1435,12 +1435,12 @@ discard block |
||
| 1435 | 1435 | } |
| 1436 | 1436 | |
| 1437 | 1437 | // TODO ne gère pas encore la numération des lignes "Totaux" |
| 1438 | - private function formatNumerotation(&$TLineTitle, $line_reference='', $level=1, $prefix_num=0) |
|
| 1438 | + private function formatNumerotation(&$TLineTitle, $line_reference = '', $level = 1, $prefix_num = 0) |
|
| 1439 | 1439 | { |
| 1440 | 1440 | $TTitle = array(); |
| 1441 | 1441 | |
| 1442 | - $i=1; |
|
| 1443 | - $j=0; |
|
| 1442 | + $i = 1; |
|
| 1443 | + $j = 0; |
|
| 1444 | 1444 | foreach ($TLineTitle as $k => &$line) |
| 1445 | 1445 | { |
| 1446 | 1446 | if (!empty($line_reference) && $line->rang <= $line_reference->rang) continue; |
@@ -1450,7 +1450,7 @@ discard block |
||
| 1450 | 1450 | { |
| 1451 | 1451 | $TTitle[$j]['numerotation'] = ($prefix_num == 0) ? $i : $prefix_num.'.'.$i; |
| 1452 | 1452 | //var_dump('Prefix == '.$prefix_num.' // '.$line->desc.' ==> numerotation == '.$TTitle[$j]['numerotation'].' ### '.$line->qty .'=='. $level); |
| 1453 | - if (empty($line->label) && (float)DOL_VERSION < 6) |
|
| 1453 | + if (empty($line->label) && (float) DOL_VERSION < 6) |
|
| 1454 | 1454 | { |
| 1455 | 1455 | $line->label = !empty($line->desc) ? $line->desc : $line->description; |
| 1456 | 1456 | $line->desc = $line->description = ''; |
@@ -1476,26 +1476,26 @@ discard block |
||
| 1476 | 1476 | |
| 1477 | 1477 | function setDocTVA(&$pdf, &$object) { |
| 1478 | 1478 | |
| 1479 | - $hidedetails = (int)GETPOST('hidedetails'); |
|
| 1479 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
| 1480 | 1480 | |
| 1481 | - if(empty($hidedetails)) return false; |
|
| 1481 | + if (empty($hidedetails)) return false; |
|
| 1482 | 1482 | |
| 1483 | 1483 | // TODO can't add VAT to document without lines... :-/ |
| 1484 | 1484 | |
| 1485 | 1485 | return true; |
| 1486 | 1486 | } |
| 1487 | 1487 | |
| 1488 | - function beforePDFCreation($parameters=array(), &$object, &$action) |
|
| 1488 | + function beforePDFCreation($parameters = array(), &$object, &$action) |
|
| 1489 | 1489 | { |
| 1490 | 1490 | /** |
| 1491 | 1491 | * @var $pdf TCPDF |
| 1492 | 1492 | */ |
| 1493 | - global $pdf,$conf, $langs; |
|
| 1493 | + global $pdf, $conf, $langs; |
|
| 1494 | 1494 | |
| 1495 | 1495 | // var_dump($object->lines); |
| 1496 | 1496 | dol_include_once('/subtotal/class/subtotal.class.php'); |
| 1497 | 1497 | |
| 1498 | - foreach($parameters as $key=>$value) { |
|
| 1498 | + foreach ($parameters as $key=>$value) { |
|
| 1499 | 1499 | ${$key} = $value; |
| 1500 | 1500 | } |
| 1501 | 1501 | |
@@ -1504,25 +1504,25 @@ discard block |
||
| 1504 | 1504 | $this->add_numerotation($object); |
| 1505 | 1505 | |
| 1506 | 1506 | |
| 1507 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
| 1508 | - $hidedetails = (int)GETPOST('hidedetails'); |
|
| 1507 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
| 1508 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
| 1509 | 1509 | |
| 1510 | 1510 | if ($hideInnerLines) { // si c une ligne de titre |
| 1511 | - $fk_parent_line=0; |
|
| 1512 | - $TLines =array(); |
|
| 1511 | + $fk_parent_line = 0; |
|
| 1512 | + $TLines = array(); |
|
| 1513 | 1513 | |
| 1514 | - $original_count=count($object->lines); |
|
| 1514 | + $original_count = count($object->lines); |
|
| 1515 | 1515 | $TTvas = array(); // tableau de tva |
| 1516 | 1516 | |
| 1517 | - foreach($object->lines as $k=>&$line) |
|
| 1517 | + foreach ($object->lines as $k=>&$line) |
|
| 1518 | 1518 | { |
| 1519 | 1519 | |
| 1520 | - if($line->product_type==9 && $line->rowid>0) |
|
| 1520 | + if ($line->product_type == 9 && $line->rowid > 0) |
|
| 1521 | 1521 | { |
| 1522 | 1522 | $fk_parent_line = $line->rowid; |
| 1523 | 1523 | |
| 1524 | 1524 | // Fix tk7201 - si on cache le détail, la TVA est renseigné au niveau du sous-total, l'erreur c'est s'il y a plusieurs sous-totaux pour les même lignes, ça va faire la somme |
| 1525 | - if(TSubtotal::isSubtotal($line)) |
|
| 1525 | + if (TSubtotal::isSubtotal($line)) |
|
| 1526 | 1526 | { |
| 1527 | 1527 | /*$total = $this->getTotalLineFromObject($object, $line, ''); |
| 1528 | 1528 | |
@@ -1542,22 +1542,22 @@ discard block |
||
| 1542 | 1542 | |
| 1543 | 1543 | if ($hideInnerLines) |
| 1544 | 1544 | { |
| 1545 | - if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
| 1545 | + if (!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
| 1546 | 1546 | { |
| 1547 | - if($line->tva_tx != '0.000' && $line->product_type!=9){ |
|
| 1547 | + if ($line->tva_tx != '0.000' && $line->product_type != 9) { |
|
| 1548 | 1548 | |
| 1549 | 1549 | // on remplit le tableau de tva pour substituer les lignes cachées |
| 1550 | 1550 | $TTvas[$line->tva_tx]['total_tva'] += $line->total_tva; |
| 1551 | 1551 | $TTvas[$line->tva_tx]['total_ht'] += $line->total_ht; |
| 1552 | 1552 | $TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; |
| 1553 | 1553 | } |
| 1554 | - if($line->product_type==9 && $line->rowid>0) |
|
| 1554 | + if ($line->product_type == 9 && $line->rowid > 0) |
|
| 1555 | 1555 | { |
| 1556 | 1556 | //Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres |
| 1557 | 1557 | // génère des lignes d'affichage des montants HT soumis à tva |
| 1558 | 1558 | $nbtva = count($TTvas); |
| 1559 | - if(!empty($nbtva)){ |
|
| 1560 | - foreach ($TTvas as $tx =>$val){ |
|
| 1559 | + if (!empty($nbtva)) { |
|
| 1560 | + foreach ($TTvas as $tx =>$val) { |
|
| 1561 | 1561 | $l = clone $line; |
| 1562 | 1562 | $l->product_type = 1; |
| 1563 | 1563 | $l->special_code = ''; |
@@ -1578,7 +1578,7 @@ discard block |
||
| 1578 | 1578 | } |
| 1579 | 1579 | } else { |
| 1580 | 1580 | |
| 1581 | - if($line->product_type==9 && $line->rowid>0) |
|
| 1581 | + if ($line->product_type == 9 && $line->rowid > 0) |
|
| 1582 | 1582 | { |
| 1583 | 1583 | // ajoute la ligne de sous-total |
| 1584 | 1584 | $TLines[] = $line; |
@@ -1606,9 +1606,9 @@ discard block |
||
| 1606 | 1606 | |
| 1607 | 1607 | // cas incongru où il y aurait des produits en dessous du dernier sous-total |
| 1608 | 1608 | $nbtva = count($TTvas); |
| 1609 | - if(!empty($nbtva) && $hideInnerLines && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
| 1609 | + if (!empty($nbtva) && $hideInnerLines && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
| 1610 | 1610 | { |
| 1611 | - foreach ($TTvas as $tx =>$val){ |
|
| 1611 | + foreach ($TTvas as $tx =>$val) { |
|
| 1612 | 1612 | $l = clone $line; |
| 1613 | 1613 | $l->product_type = 1; |
| 1614 | 1614 | $l->special_code = ''; |
@@ -1625,11 +1625,11 @@ discard block |
||
| 1625 | 1625 | } |
| 1626 | 1626 | |
| 1627 | 1627 | global $nblignes; |
| 1628 | - $nblignes=count($TLines); |
|
| 1628 | + $nblignes = count($TLines); |
|
| 1629 | 1629 | |
| 1630 | 1630 | $object->lines = $TLines; |
| 1631 | 1631 | |
| 1632 | - if($i>count($object->lines)) { |
|
| 1632 | + if ($i > count($object->lines)) { |
|
| 1633 | 1633 | $this->resprints = ''; |
| 1634 | 1634 | return 0; |
| 1635 | 1635 | } |
@@ -1638,59 +1638,59 @@ discard block |
||
| 1638 | 1638 | return 0; |
| 1639 | 1639 | } |
| 1640 | 1640 | |
| 1641 | - function pdf_writelinedesc($parameters=array(), &$object, &$action) |
|
| 1641 | + function pdf_writelinedesc($parameters = array(), &$object, &$action) |
|
| 1642 | 1642 | { |
| 1643 | 1643 | /** |
| 1644 | 1644 | * @var $pdf TCPDF |
| 1645 | 1645 | */ |
| 1646 | - global $pdf,$conf; |
|
| 1646 | + global $pdf, $conf; |
|
| 1647 | 1647 | |
| 1648 | - foreach($parameters as $key=>$value) { |
|
| 1648 | + foreach ($parameters as $key=>$value) { |
|
| 1649 | 1649 | ${$key} = $value; |
| 1650 | 1650 | } |
| 1651 | 1651 | |
| 1652 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
| 1653 | - $hidedetails = (int)GETPOST('hidedetails'); |
|
| 1652 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
| 1653 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
| 1654 | 1654 | |
| 1655 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
| 1655 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
| 1656 | 1656 | |
| 1657 | 1657 | global $hideprices; |
| 1658 | 1658 | |
| 1659 | - if(!empty($hideprices)) { |
|
| 1660 | - foreach($object->lines as &$line) { |
|
| 1661 | - if($line->fk_product_type!=9) $line->fk_parent_line = -1; |
|
| 1659 | + if (!empty($hideprices)) { |
|
| 1660 | + foreach ($object->lines as &$line) { |
|
| 1661 | + if ($line->fk_product_type != 9) $line->fk_parent_line = -1; |
|
| 1662 | 1662 | } |
| 1663 | 1663 | } |
| 1664 | 1664 | |
| 1665 | 1665 | $line = &$object->lines[$i]; |
| 1666 | 1666 | |
| 1667 | - if($line->info_bits>0) { // PAGE BREAK |
|
| 1667 | + if ($line->info_bits > 0) { // PAGE BREAK |
|
| 1668 | 1668 | $pdf->addPage(); |
| 1669 | 1669 | $posy = $pdf->GetY(); |
| 1670 | 1670 | } |
| 1671 | 1671 | |
| 1672 | 1672 | $label = $line->label; |
| 1673 | - $description= !empty($line->desc) ? $outputlangs->convToOutputCharset($line->desc) : $outputlangs->convToOutputCharset($line->description); |
|
| 1673 | + $description = !empty($line->desc) ? $outputlangs->convToOutputCharset($line->desc) : $outputlangs->convToOutputCharset($line->description); |
|
| 1674 | 1674 | |
| 1675 | - if(empty($label)) { |
|
| 1675 | + if (empty($label)) { |
|
| 1676 | 1676 | $label = $description; |
| 1677 | - $description=''; |
|
| 1677 | + $description = ''; |
|
| 1678 | 1678 | } |
| 1679 | 1679 | |
| 1680 | - if($line->qty>90) { |
|
| 1680 | + if ($line->qty > 90) { |
|
| 1681 | 1681 | |
| 1682 | 1682 | if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) $label .= ' '.$this->getTitle($object, $line); |
| 1683 | 1683 | |
| 1684 | 1684 | $pageBefore = $pdf->getPage(); |
| 1685 | - $this->pdf_add_total($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
|
| 1685 | + $this->pdf_add_total($pdf, $object, $line, $label, $description, $posx, $posy, $w, $h); |
|
| 1686 | 1686 | $pageAfter = $pdf->getPage(); |
| 1687 | 1687 | |
| 1688 | - if($pageAfter>$pageBefore) { |
|
| 1688 | + if ($pageAfter > $pageBefore) { |
|
| 1689 | 1689 | //print "ST $pageAfter>$pageBefore<br>"; |
| 1690 | 1690 | $pdf->rollbackTransaction(true); |
| 1691 | - $pdf->addPage('','', true); |
|
| 1691 | + $pdf->addPage('', '', true); |
|
| 1692 | 1692 | $posy = $pdf->GetY(); |
| 1693 | - $this->pdf_add_total($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
|
| 1693 | + $this->pdf_add_total($pdf, $object, $line, $label, $description, $posx, $posy, $w, $h); |
|
| 1694 | 1694 | $posy = $pdf->GetY(); |
| 1695 | 1695 | //print 'add ST'.$pdf->getPage().'<br />'; |
| 1696 | 1696 | } |
@@ -1701,7 +1701,7 @@ discard block |
||
| 1701 | 1701 | else if ($line->qty < 10) { |
| 1702 | 1702 | $pageBefore = $pdf->getPage(); |
| 1703 | 1703 | |
| 1704 | - $this->pdf_add_title($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
|
| 1704 | + $this->pdf_add_title($pdf, $object, $line, $label, $description, $posx, $posy, $w, $h); |
|
| 1705 | 1705 | $pageAfter = $pdf->getPage(); |
| 1706 | 1706 | |
| 1707 | 1707 | |
@@ -1776,9 +1776,9 @@ discard block |
||
| 1776 | 1776 | * @param $hookmanager HookManager |
| 1777 | 1777 | * @return int |
| 1778 | 1778 | */ |
| 1779 | - function printObjectLine ($parameters, &$object, &$action, $hookmanager){ |
|
| 1779 | + function printObjectLine($parameters, &$object, &$action, $hookmanager) { |
|
| 1780 | 1780 | |
| 1781 | - global $conf,$langs,$user,$db,$bc; |
|
| 1781 | + global $conf, $langs, $user, $db, $bc; |
|
| 1782 | 1782 | |
| 1783 | 1783 | $num = &$parameters['num']; |
| 1784 | 1784 | $line = &$parameters['line']; |
@@ -1786,32 +1786,32 @@ discard block |
||
| 1786 | 1786 | |
| 1787 | 1787 | $var = &$parameters['var']; |
| 1788 | 1788 | |
| 1789 | - $contexts = explode(':',$parameters['context']); |
|
| 1789 | + $contexts = explode(':', $parameters['context']); |
|
| 1790 | 1790 | |
| 1791 | 1791 | $createRight = $user->rights->{$object->element}->creer; |
| 1792 | - if($object->element == 'facturerec' ) |
|
| 1792 | + if ($object->element == 'facturerec') |
|
| 1793 | 1793 | { |
| 1794 | 1794 | $object->statut = 0; // hack for facture rec |
| 1795 | 1795 | $createRight = $user->rights->facture->creer; |
| 1796 | 1796 | } |
| 1797 | - elseif($object->element == 'order_supplier' ) |
|
| 1797 | + elseif ($object->element == 'order_supplier') |
|
| 1798 | 1798 | { |
| 1799 | 1799 | $createRight = $user->rights->fournisseur->commande->creer; |
| 1800 | 1800 | } |
| 1801 | - elseif($object->element == 'invoice_supplier' ) |
|
| 1801 | + elseif ($object->element == 'invoice_supplier') |
|
| 1802 | 1802 | { |
| 1803 | 1803 | $createRight = $user->rights->fournisseur->facture->creer; |
| 1804 | 1804 | } |
| 1805 | 1805 | |
| 1806 | - if($line->special_code!=$this->module_number || $line->product_type!=9) { |
|
| 1806 | + if ($line->special_code != $this->module_number || $line->product_type != 9) { |
|
| 1807 | 1807 | null; |
| 1808 | 1808 | } |
| 1809 | - 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)) |
|
| 1809 | + 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)) |
|
| 1810 | 1810 | { |
| 1811 | - if($object->element=='facture')$idvar = 'facid'; |
|
| 1812 | - else $idvar='id'; |
|
| 1811 | + if ($object->element == 'facture')$idvar = 'facid'; |
|
| 1812 | + else $idvar = 'id'; |
|
| 1813 | 1813 | |
| 1814 | - if((float)DOL_VERSION <= 3.4) |
|
| 1814 | + if ((float) DOL_VERSION <= 3.4) |
|
| 1815 | 1815 | { |
| 1816 | 1816 | ?> |
| 1817 | 1817 | <script type="text/javascript"> |
@@ -1835,20 +1835,20 @@ discard block |
||
| 1835 | 1835 | <?php |
| 1836 | 1836 | } |
| 1837 | 1837 | |
| 1838 | - if(empty($line->description)) $line->description = $line->desc; |
|
| 1838 | + if (empty($line->description)) $line->description = $line->desc; |
|
| 1839 | 1839 | |
| 1840 | 1840 | $colspan = 5; |
| 1841 | - if($object->element == 'facturerec' ) $colspan = 3; |
|
| 1842 | - if($object->element == 'order_supplier') $colspan = 3; |
|
| 1843 | - if($object->element == 'invoice_supplier') $colspan = 4; |
|
| 1844 | - if($object->element == 'supplier_proposal') $colspan = 4; |
|
| 1845 | - if(!empty($conf->multicurrency->enabled)) $colspan+=2; |
|
| 1846 | - if($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) $colspan++; |
|
| 1847 | - if(!empty($conf->margin->enabled)) $colspan++; |
|
| 1848 | - if(!empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; |
|
| 1849 | - if(!empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; |
|
| 1850 | - if($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) $colspan++; |
|
| 1851 | - if(!empty($conf->global->PRODUCT_USE_UNITS)) $colspan++; |
|
| 1841 | + if ($object->element == 'facturerec') $colspan = 3; |
|
| 1842 | + if ($object->element == 'order_supplier') $colspan = 3; |
|
| 1843 | + if ($object->element == 'invoice_supplier') $colspan = 4; |
|
| 1844 | + if ($object->element == 'supplier_proposal') $colspan = 4; |
|
| 1845 | + if (!empty($conf->multicurrency->enabled)) $colspan += 2; |
|
| 1846 | + if ($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) $colspan++; |
|
| 1847 | + if (!empty($conf->margin->enabled)) $colspan++; |
|
| 1848 | + if (!empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; |
|
| 1849 | + if (!empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; |
|
| 1850 | + if ($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) $colspan++; |
|
| 1851 | + if (!empty($conf->global->PRODUCT_USE_UNITS)) $colspan++; |
|
| 1852 | 1852 | |
| 1853 | 1853 | /* Titre */ |
| 1854 | 1854 | //var_dump($line); |
@@ -1858,35 +1858,35 @@ discard block |
||
| 1858 | 1858 | |
| 1859 | 1859 | |
| 1860 | 1860 | ?> |
| 1861 | - <tr <?php echo $bc[$var]; $var=!$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
|
| 1861 | + <tr <?php echo $bc[$var]; $var = !$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
|
| 1862 | 1862 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT)) |
| 1863 | 1863 | { |
| 1864 | - if($line->qty==99) print 'background:#adadcf'; |
|
| 1865 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
| 1866 | - else if($line->qty<=97 && $line->qty>=91) print 'background:#eeeeff;'; |
|
| 1867 | - else if($line->qty==1) print 'background:#adadcf;'; |
|
| 1868 | - else if($line->qty==2) print 'background:#ddddff;'; |
|
| 1869 | - else if($line->qty==50) print ''; |
|
| 1864 | + if ($line->qty == 99) print 'background:#adadcf'; |
|
| 1865 | + else if ($line->qty == 98) print 'background:#ddddff;'; |
|
| 1866 | + else if ($line->qty <= 97 && $line->qty >= 91) print 'background:#eeeeff;'; |
|
| 1867 | + else if ($line->qty == 1) print 'background:#adadcf;'; |
|
| 1868 | + else if ($line->qty == 2) print 'background:#ddddff;'; |
|
| 1869 | + else if ($line->qty == 50) print ''; |
|
| 1870 | 1870 | else print 'background:#eeeeff;'; |
| 1871 | 1871 | |
| 1872 | 1872 | //A compléter si on veux plus de nuances de couleurs avec les niveau 4,5,6,7,8 et 9 |
| 1873 | 1873 | } |
| 1874 | 1874 | else |
| 1875 | 1875 | { |
| 1876 | - if($line->qty==99) print 'background:#ddffdd'; |
|
| 1877 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
| 1878 | - else if($line->qty==2) print 'background:#eeeeff; '; |
|
| 1879 | - else if($line->qty==50) print ''; |
|
| 1880 | - else print 'background:#eeffee;' ; |
|
| 1876 | + if ($line->qty == 99) print 'background:#ddffdd'; |
|
| 1877 | + else if ($line->qty == 98) print 'background:#ddddff;'; |
|
| 1878 | + else if ($line->qty == 2) print 'background:#eeeeff; '; |
|
| 1879 | + else if ($line->qty == 50) print ''; |
|
| 1880 | + else print 'background:#eeffee;'; |
|
| 1881 | 1881 | } |
| 1882 | 1882 | |
| 1883 | 1883 | ?>;"> |
| 1884 | 1884 | |
| 1885 | - <td colspan="<?php echo $colspan; ?>" style="<?php TSubtotal::isFreeText($line) ? '' : 'font-weight:bold;'; ?> <?php echo ($line->qty>90)?'text-align:right':'' ?> "><?php |
|
| 1886 | - if($action=='editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line) ) { |
|
| 1885 | + <td colspan="<?php echo $colspan; ?>" style="<?php TSubtotal::isFreeText($line) ? '' : 'font-weight:bold;'; ?> <?php echo ($line->qty > 90) ? 'text-align:right' : '' ?> "><?php |
|
| 1886 | + if ($action == 'editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line)) { |
|
| 1887 | 1887 | |
| 1888 | - $params=array('line'=>$line); |
|
| 1889 | - $reshook=$hookmanager->executeHooks('formEditProductOptions',$params,$object,$action); |
|
| 1888 | + $params = array('line'=>$line); |
|
| 1889 | + $reshook = $hookmanager->executeHooks('formEditProductOptions', $params, $object, $action); |
|
| 1890 | 1890 | |
| 1891 | 1891 | echo '<div id="line_'.$line->id.'"></div>'; // Imitation Dolibarr |
| 1892 | 1892 | echo '<input type="hidden" value="'.$line->id.'" name="lineid">'; |
@@ -1894,7 +1894,7 @@ discard block |
||
| 1894 | 1894 | echo '<input id="product_id" type="hidden" value="'.$line->fk_product.'" name="type">'; |
| 1895 | 1895 | echo '<input id="special_code" type="hidden" value="'.$line->special_code.'" name="type">'; |
| 1896 | 1896 | |
| 1897 | - $isFreeText=false; |
|
| 1897 | + $isFreeText = false; |
|
| 1898 | 1898 | if (TSubtotal::isTitle($line)) |
| 1899 | 1899 | { |
| 1900 | 1900 | $qty_displayed = $line->qty; |
@@ -1916,13 +1916,13 @@ discard block |
||
| 1916 | 1916 | $line->description = ''; |
| 1917 | 1917 | } |
| 1918 | 1918 | $newlabel = $line->label; |
| 1919 | - if($line->label=='' && !$isFreeText) { |
|
| 1920 | - if(TSubtotal::isSubtotal($line)) { |
|
| 1919 | + if ($line->label == '' && !$isFreeText) { |
|
| 1920 | + if (TSubtotal::isSubtotal($line)) { |
|
| 1921 | 1921 | $newlabel = $line->description.' '.$this->getTitle($object, $line); |
| 1922 | - $line->description=''; |
|
| 1923 | - } elseif( (float)DOL_VERSION < 6 ) { |
|
| 1924 | - $newlabel= $line->description; |
|
| 1925 | - $line->description=''; |
|
| 1922 | + $line->description = ''; |
|
| 1923 | + } elseif ((float) DOL_VERSION < 6) { |
|
| 1924 | + $newlabel = $line->description; |
|
| 1925 | + $line->description = ''; |
|
| 1926 | 1926 | } |
| 1927 | 1927 | } |
| 1928 | 1928 | |
@@ -1931,10 +1931,10 @@ discard block |
||
| 1931 | 1931 | |
| 1932 | 1932 | if (!$isFreeText) echo '<input type="text" name="line-title" id-line="'.$line->id.'" value="'.$newlabel.'" size="80" '.$readonlyForSituation.'/> '; |
| 1933 | 1933 | |
| 1934 | - if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT) && (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) ) |
|
| 1934 | + if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT) && (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line))) |
|
| 1935 | 1935 | { |
| 1936 | 1936 | $select = '<select name="subtotal_level">'; |
| 1937 | - for ($j=1; $j<10; $j++) |
|
| 1937 | + for ($j = 1; $j < 10; $j++) |
|
| 1938 | 1938 | { |
| 1939 | 1939 | if (!empty($readonlyForSituation)) { |
| 1940 | 1940 | if ($qty_displayed == $j) $select .= '<option selected="selected" value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
@@ -1947,7 +1947,7 @@ discard block |
||
| 1947 | 1947 | |
| 1948 | 1948 | |
| 1949 | 1949 | echo '<div class="subtotal_underline" style="margin-left:24px;">'; |
| 1950 | - echo '<label for="subtotal-pagebreak">'.$langs->trans('AddBreakPageBefore').'</label> <input style="vertical-align:sub;" type="checkbox" name="line-pagebreak" id="subtotal-pagebreak" value="8" '.(($line->info_bits > 0) ? 'checked="checked"' : '') .' /> '; |
|
| 1950 | + echo '<label for="subtotal-pagebreak">'.$langs->trans('AddBreakPageBefore').'</label> <input style="vertical-align:sub;" type="checkbox" name="line-pagebreak" id="subtotal-pagebreak" value="8" '.(($line->info_bits > 0) ? 'checked="checked"' : '').' /> '; |
|
| 1951 | 1951 | |
| 1952 | 1952 | if (TSubtotal::isTitle($line)) |
| 1953 | 1953 | { |
@@ -1965,9 +1965,9 @@ discard block |
||
| 1965 | 1965 | else if ($isFreeText) echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation); |
| 1966 | 1966 | echo '</div>'; |
| 1967 | 1967 | |
| 1968 | - if($line->qty<10) { |
|
| 1968 | + if ($line->qty < 10) { |
|
| 1969 | 1969 | // WYSIWYG editor |
| 1970 | - require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; |
|
| 1970 | + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
|
| 1971 | 1971 | $nbrows = ROWS_2; |
| 1972 | 1972 | $cked_enabled = (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0); |
| 1973 | 1973 | if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) { |
@@ -1987,25 +1987,25 @@ discard block |
||
| 1987 | 1987 | |
| 1988 | 1988 | if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) |
| 1989 | 1989 | { |
| 1990 | - if(TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) |
|
| 1990 | + if (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) |
|
| 1991 | 1991 | { |
| 1992 | - echo str_repeat(' ', $line->qty-1); |
|
| 1992 | + echo str_repeat(' ', $line->qty - 1); |
|
| 1993 | 1993 | |
| 1994 | 1994 | if (TSubtotal::isTitle($line)) print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
| 1995 | - else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
| 1995 | + else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100 - $line->qty).'</span> '; |
|
| 1996 | 1996 | } |
| 1997 | 1997 | } |
| 1998 | 1998 | else |
| 1999 | 1999 | { |
| 2000 | - if($line->qty<=1) print img_picto('', 'subtotal@subtotal'); |
|
| 2001 | - else if($line->qty==2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
| 2000 | + if ($line->qty <= 1) print img_picto('', 'subtotal@subtotal'); |
|
| 2001 | + else if ($line->qty == 2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
| 2002 | 2002 | } |
| 2003 | 2003 | |
| 2004 | 2004 | |
| 2005 | 2005 | // Get display styles and apply them |
| 2006 | 2006 | $titleStyleItalic = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'I') === false ? '' : ' font-style: italic;'; |
| 2007 | - $titleStyleBold = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'B') === false ? '' : ' font-weight:bold;'; |
|
| 2008 | - $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
|
| 2007 | + $titleStyleBold = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'B') === false ? '' : ' font-weight:bold;'; |
|
| 2008 | + $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
|
| 2009 | 2009 | |
| 2010 | 2010 | if (empty($line->label)) { |
| 2011 | 2011 | if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) print $line->description.' '.$this->getTitle($object, $line); |
@@ -2013,16 +2013,16 @@ discard block |
||
| 2013 | 2013 | } |
| 2014 | 2014 | else { |
| 2015 | 2015 | |
| 2016 | - if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
|
| 2016 | + if (!empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
|
| 2017 | 2017 | print '<span class="subtotal_label" style="'.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" >'.$line->label.'</span><br><div class="subtotal_desc">'.dol_htmlentitiesbr($line->description).'</div>'; |
| 2018 | 2018 | } |
| 2019 | - else{ |
|
| 2019 | + else { |
|
| 2020 | 2020 | print '<span class="subtotal_label classfortooltip '.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" title="'.$line->description.'">'.$line->label.'</span>'; |
| 2021 | 2021 | } |
| 2022 | 2022 | |
| 2023 | 2023 | } |
| 2024 | - if($line->qty>90) print ' : '; |
|
| 2025 | - if($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
| 2024 | + if ($line->qty > 90) print ' : '; |
|
| 2025 | + if ($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
| 2026 | 2026 | |
| 2027 | 2027 | |
| 2028 | 2028 | |
@@ -2031,7 +2031,7 @@ discard block |
||
| 2031 | 2031 | ?></td> |
| 2032 | 2032 | |
| 2033 | 2033 | <?php |
| 2034 | - if($line->qty>90) { |
|
| 2034 | + if ($line->qty > 90) { |
|
| 2035 | 2035 | /* Total */ |
| 2036 | 2036 | $total_line = $this->getTotalLineFromObject($object, $line, ''); |
| 2037 | 2037 | echo '<td class="nowrap liencolht" align="right" style="font-weight:bold;" rel="subtotal_total">'.price($total_line).'</td>'; |
@@ -2044,7 +2044,7 @@ discard block |
||
| 2044 | 2044 | <?php |
| 2045 | 2045 | if ($action != 'selectlines') { |
| 2046 | 2046 | |
| 2047 | - if($action=='editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line) ) { |
|
| 2047 | + if ($action == 'editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line)) { |
|
| 2048 | 2048 | ?> |
| 2049 | 2049 | <input id="savelinebutton" class="button" type="submit" name="save" value="<?php echo $langs->trans('Save') ?>" /> |
| 2050 | 2050 | <br /> |
@@ -2060,13 +2060,13 @@ discard block |
||
| 2060 | 2060 | <?php |
| 2061 | 2061 | |
| 2062 | 2062 | } |
| 2063 | - else{ |
|
| 2064 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) && $object->element !== 'invoice_supplier') |
|
| 2063 | + else { |
|
| 2064 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) && $object->element !== 'invoice_supplier') |
|
| 2065 | 2065 | { |
| 2066 | - if(TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref) ) echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=duplicate&lineid='.$line->id.'">'. img_picto($langs->trans('Duplicate'), 'duplicate@subtotal').'</a>'; |
|
| 2066 | + if (TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref)) echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=duplicate&lineid='.$line->id.'">'.img_picto($langs->trans('Duplicate'), 'duplicate@subtotal').'</a>'; |
|
| 2067 | 2067 | } |
| 2068 | 2068 | |
| 2069 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_EDIT_BLOCK)) |
|
| 2069 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_EDIT_BLOCK)) |
|
| 2070 | 2070 | { |
| 2071 | 2071 | echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=editline&lineid='.$line->id.'">'.img_edit().'</a>'; |
| 2072 | 2072 | } |
@@ -2081,7 +2081,7 @@ discard block |
||
| 2081 | 2081 | <?php |
| 2082 | 2082 | |
| 2083 | 2083 | if ($action != 'editline' && $action != 'selectlines') { |
| 2084 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK)) |
|
| 2084 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK)) |
|
| 2085 | 2085 | { |
| 2086 | 2086 | |
| 2087 | 2087 | if ($object->situation_counter == 1 || !$object->situation_cycle_ref) |
@@ -2089,7 +2089,7 @@ discard block |
||
| 2089 | 2089 | echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=ask_deleteline&lineid='.$line->id.'">'.img_delete().'</a>'; |
| 2090 | 2090 | } |
| 2091 | 2091 | |
| 2092 | - if(TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref) ) |
|
| 2092 | + if (TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref)) |
|
| 2093 | 2093 | { |
| 2094 | 2094 | $img_delete = ((float) DOL_VERSION >= 3.8) ? img_picto($langs->trans('deleteWithAllLines'), 'delete_all.3.8@subtotal') : img_picto($langs->trans('deleteWithAllLines'), 'delete_all@subtotal'); |
| 2095 | 2095 | echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=ask_deleteallline&lineid='.$line->id.'">'.$img_delete.'</a>'; |
@@ -2100,7 +2100,7 @@ discard block |
||
| 2100 | 2100 | </td> |
| 2101 | 2101 | |
| 2102 | 2102 | <?php |
| 2103 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && TSubtotal::isTitle($line) && $action != 'editline') |
|
| 2103 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && TSubtotal::isTitle($line) && $action != 'editline') |
|
| 2104 | 2104 | { |
| 2105 | 2105 | echo '<td class="subtotal_nc">'; |
| 2106 | 2106 | echo '<input id="subtotal_nc-'.$line->id.'" class="subtotal_nc_chkbx" data-lineid="'.$line->id.'" type="checkbox" name="subtotal_nc" value="1" '.(!empty($line->array_options['options_subtotal_nc']) ? 'checked="checked"' : '').' />'; |
@@ -2111,11 +2111,11 @@ discard block |
||
| 2111 | 2111 | <td align="center" class="tdlineupdown"> |
| 2112 | 2112 | </td> |
| 2113 | 2113 | <?php } else { ?> |
| 2114 | - <td align="center"<?php echo ((empty($conf->browser->phone) && ($object->statut == 0 && $createRight ))?' class="tdlineupdown"':''); ?>></td> |
|
| 2114 | + <td align="center"<?php echo ((empty($conf->browser->phone) && ($object->statut == 0 && $createRight)) ? ' class="tdlineupdown"' : ''); ?>></td> |
|
| 2115 | 2115 | <?php } ?> |
| 2116 | 2116 | |
| 2117 | - <?php if($action == 'selectlines'){ // dolibarr 8 ?> |
|
| 2118 | - <td class="linecolcheck" align="center"><input type="checkbox" class="linecheckbox" name="line_checkbox[<?php echo $i+1; ?>]" value="<?php echo $line->id; ?>" ></td> |
|
| 2117 | + <?php if ($action == 'selectlines') { // dolibarr 8 ?> |
|
| 2118 | + <td class="linecolcheck" align="center"><input type="checkbox" class="linecheckbox" name="line_checkbox[<?php echo $i + 1; ?>]" value="<?php echo $line->id; ?>" ></td> |
|
| 2119 | 2119 | <?php } ?> |
| 2120 | 2120 | |
| 2121 | 2121 | </tr> |
@@ -2123,29 +2123,29 @@ discard block |
||
| 2123 | 2123 | |
| 2124 | 2124 | |
| 2125 | 2125 | // Affichage des extrafields à la Dolibarr (car sinon non affiché sur les titres) |
| 2126 | - if(TSubtotal::isTitle($line) && !empty($conf->global->SUBTOTAL_ALLOW_EXTRAFIELDS_ON_TITLE)) { |
|
| 2126 | + if (TSubtotal::isTitle($line) && !empty($conf->global->SUBTOTAL_ALLOW_EXTRAFIELDS_ON_TITLE)) { |
|
| 2127 | 2127 | |
| 2128 | - require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; |
|
| 2128 | + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; |
|
| 2129 | 2129 | |
| 2130 | 2130 | // Extrafields |
| 2131 | 2131 | $extrafieldsline = new ExtraFields($db); |
| 2132 | 2132 | $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); |
| 2133 | 2133 | |
| 2134 | - $colspan+=3; $mode = 'view'; |
|
| 2135 | - if($action === 'editline' && $line->rowid == GETPOST('lineid')) $mode = 'edit'; |
|
| 2134 | + $colspan += 3; $mode = 'view'; |
|
| 2135 | + if ($action === 'editline' && $line->rowid == GETPOST('lineid')) $mode = 'edit'; |
|
| 2136 | 2136 | |
| 2137 | 2137 | $ex_element = $line->element; |
| 2138 | 2138 | $line->element = 'tr_extrafield_title '.$line->element; // Pour pouvoir manipuler ces tr |
| 2139 | - print $line->showOptionals($extrafieldsline, $mode, array('style'=>' style="background:#eeffee;" ','colspan'=>$colspan)); |
|
| 2139 | + print $line->showOptionals($extrafieldsline, $mode, array('style'=>' style="background:#eeffee;" ', 'colspan'=>$colspan)); |
|
| 2140 | 2140 | $isExtraSelected = false; |
| 2141 | - foreach($line->array_options as $option) { |
|
| 2142 | - if(!empty($option) && $option != "-1") { |
|
| 2141 | + foreach ($line->array_options as $option) { |
|
| 2142 | + if (!empty($option) && $option != "-1") { |
|
| 2143 | 2143 | $isExtraSelected = true; |
| 2144 | 2144 | break; |
| 2145 | 2145 | } |
| 2146 | 2146 | } |
| 2147 | 2147 | |
| 2148 | - if($mode === 'edit') { |
|
| 2148 | + if ($mode === 'edit') { |
|
| 2149 | 2149 | ?> |
| 2150 | 2150 | <script> |
| 2151 | 2151 | $(document).ready(function(){ |
@@ -2153,7 +2153,7 @@ discard block |
||
| 2153 | 2153 | var all_tr_extrafields = $("tr.tr_extrafield_title"); |
| 2154 | 2154 | <?php |
| 2155 | 2155 | // Si un extrafield est rempli alors on affiche directement les extrafields |
| 2156 | - if(!$isExtraSelected) { |
|
| 2156 | + if (!$isExtraSelected) { |
|
| 2157 | 2157 | echo 'all_tr_extrafields.hide();'; |
| 2158 | 2158 | echo 'var trad = "'.$langs->trans('showExtrafields').'";'; |
| 2159 | 2159 | echo 'var extra = 0;'; |
@@ -2199,20 +2199,20 @@ discard block |
||
| 2199 | 2199 | |
| 2200 | 2200 | |
| 2201 | 2201 | function addMoreActionsButtons($parameters, &$object, &$action, $hookmanager) { |
| 2202 | - global $conf,$langs; |
|
| 2202 | + global $conf, $langs; |
|
| 2203 | 2203 | |
| 2204 | 2204 | if ($object->statut == 0 && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && $action != 'editline') |
| 2205 | 2205 | { |
| 2206 | 2206 | |
| 2207 | - if($object->element == 'invoice_supplier' || $object->element == 'order_supplier') |
|
| 2207 | + if ($object->element == 'invoice_supplier' || $object->element == 'order_supplier') |
|
| 2208 | 2208 | { |
| 2209 | 2209 | foreach ($object->lines as $line) |
| 2210 | 2210 | { |
| 2211 | 2211 | // fetch optionals attributes and labels |
| 2212 | 2212 | require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); |
| 2213 | - $extrafields=new ExtraFields($this->db); |
|
| 2214 | - $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true); |
|
| 2215 | - $line->fetch_optionals($line->id,$extralabels); |
|
| 2213 | + $extrafields = new ExtraFields($this->db); |
|
| 2214 | + $extralabels = $extrafields->fetch_name_optionals_label($object->table_element_line, true); |
|
| 2215 | + $line->fetch_optionals($line->id, $extralabels); |
|
| 2216 | 2216 | } |
| 2217 | 2217 | } |
| 2218 | 2218 | |
@@ -2312,23 +2312,23 @@ discard block |
||
| 2312 | 2312 | $ThtmlData['data-qty'] = 0; //$line->qty; |
| 2313 | 2313 | $ThtmlData['data-level'] = TSubtotal::getNiveau($line); |
| 2314 | 2314 | |
| 2315 | - if(TSubtotal::isTitle($line)){ |
|
| 2315 | + if (TSubtotal::isTitle($line)) { |
|
| 2316 | 2316 | $ThtmlData['data-issubtotal'] = 'title'; |
| 2317 | - }elseif(TSubtotal::isSubtotal($line)){ |
|
| 2317 | + }elseif (TSubtotal::isSubtotal($line)) { |
|
| 2318 | 2318 | $ThtmlData['data-issubtotal'] = 'subtotal'; |
| 2319 | 2319 | } |
| 2320 | - else{ |
|
| 2320 | + else { |
|
| 2321 | 2321 | $ThtmlData['data-issubtotal'] = 'freetext'; |
| 2322 | 2322 | } |
| 2323 | 2323 | |
| 2324 | 2324 | |
| 2325 | 2325 | // Change or add data from hooks |
| 2326 | - $parameters = array_replace($parameters , array( 'ThtmlData' => $ThtmlData ) ); |
|
| 2326 | + $parameters = array_replace($parameters, array('ThtmlData' => $ThtmlData)); |
|
| 2327 | 2327 | |
| 2328 | 2328 | // hook |
| 2329 | - $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
|
| 2329 | + $reshook = $hookmanager->executeHooks('subtotalLineHtmlData', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
|
| 2330 | 2330 | if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
| 2331 | - if ($reshook>0) |
|
| 2331 | + if ($reshook > 0) |
|
| 2332 | 2332 | { |
| 2333 | 2333 | $ThtmlData = $hookmanager->resArray; |
| 2334 | 2334 | } |
@@ -2341,14 +2341,14 @@ discard block |
||
| 2341 | 2341 | function implodeHtmlData($ThtmlData = array()) |
| 2342 | 2342 | { |
| 2343 | 2343 | $data = ''; |
| 2344 | - foreach($ThtmlData as $k => $h ) |
|
| 2344 | + foreach ($ThtmlData as $k => $h) |
|
| 2345 | 2345 | { |
| 2346 | - if(is_array($h)) |
|
| 2346 | + if (is_array($h)) |
|
| 2347 | 2347 | { |
| 2348 | 2348 | $h = json_encode($h); |
| 2349 | 2349 | } |
| 2350 | 2350 | |
| 2351 | - $data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" '; |
|
| 2351 | + $data .= $k.'="'.dol_htmlentities($h, ENT_QUOTES).'" '; |
|
| 2352 | 2352 | } |
| 2353 | 2353 | |
| 2354 | 2354 | return $data; |
@@ -2356,26 +2356,26 @@ discard block |
||
| 2356 | 2356 | |
| 2357 | 2357 | function _ajax_block_order_js($object) |
| 2358 | 2358 | { |
| 2359 | - global $conf,$tagidfortablednd,$filepath,$langs; |
|
| 2359 | + global $conf, $tagidfortablednd, $filepath, $langs; |
|
| 2360 | 2360 | |
| 2361 | 2361 | /* |
| 2362 | 2362 | * this part of js is base on dolibarr htdocs/core/tpl/ajaxrow.tpl.php |
| 2363 | 2363 | * for compatibility reasons we don't use tableDnD but jquery sortable |
| 2364 | 2364 | */ |
| 2365 | 2365 | |
| 2366 | - $id=$object->id; |
|
| 2367 | - $nboflines=(isset($object->lines)?count($object->lines):0); |
|
| 2368 | - $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1; |
|
| 2366 | + $id = $object->id; |
|
| 2367 | + $nboflines = (isset($object->lines) ?count($object->lines) : 0); |
|
| 2368 | + $forcereloadpage = empty($conf->global->MAIN_FORCE_RELOAD_PAGE) ? 0 : 1; |
|
| 2369 | 2369 | |
| 2370 | - $id=$object->id; |
|
| 2371 | - $fk_element=$object->fk_element; |
|
| 2372 | - $table_element_line=$object->table_element_line; |
|
| 2373 | - $nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines)); |
|
| 2374 | - $tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd); |
|
| 2375 | - $filepath=(empty($filepath)?'':$filepath); |
|
| 2370 | + $id = $object->id; |
|
| 2371 | + $fk_element = $object->fk_element; |
|
| 2372 | + $table_element_line = $object->table_element_line; |
|
| 2373 | + $nboflines = (isset($object->lines) ?count($object->lines) : (empty($nboflines) ? 0 : $nboflines)); |
|
| 2374 | + $tagidfortablednd = (empty($tagidfortablednd) ? 'tablelines' : $tagidfortablednd); |
|
| 2375 | + $filepath = (empty($filepath) ? '' : $filepath); |
|
| 2376 | 2376 | |
| 2377 | 2377 | |
| 2378 | - if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1) |
|
| 2378 | + if (GETPOST('action', 'aZ09') != 'editline' && $nboflines > 1) |
|
| 2379 | 2379 | { |
| 2380 | 2380 | |
| 2381 | 2381 | ?> |
@@ -2393,7 +2393,7 @@ discard block |
||
| 2393 | 2393 | moveBlockCol.disableSelection(); // prevent selection |
| 2394 | 2394 | <?php if ($object->statut == 0) { ?> |
| 2395 | 2395 | // apply some graphical stuff |
| 2396 | - moveBlockCol.css("background-image",'url(<?php echo dol_buildpath('subtotal/img/grip_all.png',2); ?>)'); |
|
| 2396 | + moveBlockCol.css("background-image",'url(<?php echo dol_buildpath('subtotal/img/grip_all.png', 2); ?>)'); |
|
| 2397 | 2397 | moveBlockCol.css("background-repeat","no-repeat"); |
| 2398 | 2398 | moveBlockCol.css("background-position","center center"); |
| 2399 | 2399 | moveBlockCol.css("cursor","move"); |
@@ -25,7 +25,9 @@ discard block |
||
| 25 | 25 | $value = ''; |
| 26 | 26 | $sql = 'SELECT content FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text WHERE rowid = '.GETPOST('rowid'); |
| 27 | 27 | $resql = $this->db->query($sql); |
| 28 | - if ($resql && ($obj = $this->db->fetch_object($resql))) $value = $obj->content; |
|
| 28 | + if ($resql && ($obj = $this->db->fetch_object($resql))) { |
|
| 29 | + $value = $obj->content; |
|
| 30 | + } |
|
| 29 | 31 | } |
| 30 | 32 | |
| 31 | 33 | ?> |
@@ -109,8 +111,11 @@ discard block |
||
| 109 | 111 | if ($object->statut == 0 && $createRight) { |
| 110 | 112 | |
| 111 | 113 | |
| 112 | - if($object->element=='facture')$idvar = 'facid'; |
|
| 113 | - else $idvar='id'; |
|
| 114 | + if($object->element=='facture') { |
|
| 115 | + $idvar = 'facid'; |
|
| 116 | + } else { |
|
| 117 | + $idvar='id'; |
|
| 118 | + } |
|
| 114 | 119 | |
| 115 | 120 | if(in_array($action, array('add_title_line', 'add_total_line', 'add_subtitle_line', 'add_subtotal_line', 'add_free_text')) ) |
| 116 | 121 | { |
@@ -118,10 +123,11 @@ discard block |
||
| 118 | 123 | |
| 119 | 124 | if($action=='add_title_line') { |
| 120 | 125 | $title = GETPOST('title'); |
| 121 | - if(empty($title)) $title = $langs->trans('title'); |
|
| 126 | + if(empty($title)) { |
|
| 127 | + $title = $langs->trans('title'); |
|
| 128 | + } |
|
| 122 | 129 | $qty = $level<1 ? 1 : $level ; |
| 123 | - } |
|
| 124 | - else if($action=='add_free_text') { |
|
| 130 | + } else if($action=='add_free_text') { |
|
| 125 | 131 | $title = GETPOST('title'); |
| 126 | 132 | |
| 127 | 133 | if (empty($title)) { |
@@ -133,29 +139,31 @@ discard block |
||
| 133 | 139 | } |
| 134 | 140 | } |
| 135 | 141 | } |
| 136 | - if(empty($title)) $title = $langs->trans('subtotalAddLineDescription'); |
|
| 142 | + if(empty($title)) { |
|
| 143 | + $title = $langs->trans('subtotalAddLineDescription'); |
|
| 144 | + } |
|
| 137 | 145 | $qty = 50; |
| 138 | - } |
|
| 139 | - else if($action=='add_subtitle_line') { |
|
| 146 | + } else if($action=='add_subtitle_line') { |
|
| 140 | 147 | $title = GETPOST('title'); |
| 141 | - if(empty($title)) $title = $langs->trans('subtitle'); |
|
| 148 | + if(empty($title)) { |
|
| 149 | + $title = $langs->trans('subtitle'); |
|
| 150 | + } |
|
| 142 | 151 | $qty = 2; |
| 143 | - } |
|
| 144 | - else if($action=='add_subtotal_line') { |
|
| 152 | + } else if($action=='add_subtotal_line') { |
|
| 145 | 153 | $title = $langs->trans('SubSubTotal'); |
| 146 | 154 | $qty = 98; |
| 147 | - } |
|
| 148 | - else { |
|
| 155 | + } else { |
|
| 149 | 156 | $title = GETPOST('title') ? GETPOST('title') : $langs->trans('SubTotal'); |
| 150 | 157 | $qty = $level ? 100-$level : 99; |
| 151 | 158 | } |
| 152 | 159 | dol_include_once('/subtotal/class/subtotal.class.php'); |
| 153 | 160 | |
| 154 | - if (!empty($conf->global->SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE) && $qty < 10) TSubtotal::addSubtotalMissing($object, $qty); |
|
| 161 | + if (!empty($conf->global->SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE) && $qty < 10) { |
|
| 162 | + TSubtotal::addSubtotalMissing($object, $qty); |
|
| 163 | + } |
|
| 155 | 164 | |
| 156 | 165 | TSubtotal::addSubTotalLine($object, $title, $qty); |
| 157 | - } |
|
| 158 | - else if($action==='ask_deleteallline') { |
|
| 166 | + } else if($action==='ask_deleteallline') { |
|
| 159 | 167 | $form=new Form($db); |
| 160 | 168 | |
| 161 | 169 | $lineid = GETPOST('lineid','integer'); |
@@ -178,8 +186,7 @@ discard block |
||
| 178 | 186 | $this->printNewFormat($object, $conf, $langs, $idvar); |
| 179 | 187 | } |
| 180 | 188 | } |
| 181 | - } |
|
| 182 | - elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice',$contexts)) |
|
| 189 | + } elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice',$contexts)) |
|
| 183 | 190 | { |
| 184 | 191 | ?> |
| 185 | 192 | <script type="text/javascript"> |
@@ -197,8 +204,13 @@ discard block |
||
| 197 | 204 | |
| 198 | 205 | function printNewFormat(&$object, &$conf, &$langs, $idvar) |
| 199 | 206 | { |
| 200 | - if (empty($conf->global->SUBTOTAL_ALLOW_ADD_BLOCK)) return false; |
|
| 201 | - if (!empty($object->situation_cycle_ref) && $object->situation_counter > 1) return false; // Si facture de situation |
|
| 207 | + if (empty($conf->global->SUBTOTAL_ALLOW_ADD_BLOCK)) { |
|
| 208 | + return false; |
|
| 209 | + } |
|
| 210 | + if (!empty($object->situation_cycle_ref) && $object->situation_counter > 1) { |
|
| 211 | + return false; |
|
| 212 | + } |
|
| 213 | + // Si facture de situation |
|
| 202 | 214 | ?> |
| 203 | 215 | <script type="text/javascript"> |
| 204 | 216 | $(document).ready(function() { |
@@ -484,8 +496,7 @@ discard block |
||
| 484 | 496 | } |
| 485 | 497 | |
| 486 | 498 | |
| 487 | - } |
|
| 488 | - else{ |
|
| 499 | + } else{ |
|
| 489 | 500 | $substitutionarray['line_not_modsubtotal'] = true; |
| 490 | 501 | $substitutionarray['line_modsubtotal'] = 0; |
| 491 | 502 | } |
@@ -543,8 +554,11 @@ discard block |
||
| 543 | 554 | |
| 544 | 555 | $showBlockExtrafields = GETPOST('showBlockExtrafields'); |
| 545 | 556 | |
| 546 | - if($object->element=='facture') $idvar = 'facid'; |
|
| 547 | - else $idvar = 'id'; |
|
| 557 | + if($object->element=='facture') { |
|
| 558 | + $idvar = 'facid'; |
|
| 559 | + } else { |
|
| 560 | + $idvar = 'id'; |
|
| 561 | + } |
|
| 548 | 562 | |
| 549 | 563 | if ($action == 'updateligne' || $action == 'updateline') |
| 550 | 564 | { |
@@ -574,8 +588,7 @@ discard block |
||
| 574 | 588 | header('Location: '.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id); |
| 575 | 589 | exit; // Surtout ne pas laisser Dolibarr faire du traitement sur le updateligne sinon ça plante les données de la ligne |
| 576 | 590 | } |
| 577 | - } |
|
| 578 | - else if($action === 'builddoc') { |
|
| 591 | + } else if($action === 'builddoc') { |
|
| 579 | 592 | |
| 580 | 593 | if ( |
| 581 | 594 | in_array('invoicecard',explode(':',$parameters['context'])) |
@@ -590,33 +603,27 @@ discard block |
||
| 590 | 603 | $sessname = 'subtotal_hideInnerLines_facture'; |
| 591 | 604 | $sessname2 = 'subtotal_hidedetails_facture'; |
| 592 | 605 | $sessname3 = 'subtotal_hideprices_facture'; |
| 593 | - } |
|
| 594 | - elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) { |
|
| 606 | + } elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) { |
|
| 595 | 607 | $sessname = 'subtotal_hideInnerLines_facture_fournisseur'; |
| 596 | 608 | $sessname2 = 'subtotal_hidedetails_facture_fournisseur'; |
| 597 | 609 | $sessname3 = 'subtotal_hideprices_facture_fournisseur'; |
| 598 | - } |
|
| 599 | - elseif(in_array('propalcard',explode(':',$parameters['context']))) { |
|
| 610 | + } elseif(in_array('propalcard',explode(':',$parameters['context']))) { |
|
| 600 | 611 | $sessname = 'subtotal_hideInnerLines_propal'; |
| 601 | 612 | $sessname2 = 'subtotal_hidedetails_propal'; |
| 602 | 613 | $sessname3 = 'subtotal_hideprices_propal'; |
| 603 | - } |
|
| 604 | - elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) { |
|
| 614 | + } elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) { |
|
| 605 | 615 | $sessname = 'subtotal_hideInnerLines_supplier_proposal'; |
| 606 | 616 | $sessname2 = 'subtotal_hidedetails_supplier_proposal'; |
| 607 | 617 | $sessname3 = 'subtotal_hideprices_supplier_proposal'; |
| 608 | - } |
|
| 609 | - elseif(in_array('ordercard',explode(':',$parameters['context']))) { |
|
| 618 | + } elseif(in_array('ordercard',explode(':',$parameters['context']))) { |
|
| 610 | 619 | $sessname = 'subtotal_hideInnerLines_commande'; |
| 611 | 620 | $sessname2 = 'subtotal_hidedetails_commande'; |
| 612 | 621 | $sessname3 = 'subtotal_hideprices_commande'; |
| 613 | - } |
|
| 614 | - elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) { |
|
| 622 | + } elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) { |
|
| 615 | 623 | $sessname = 'subtotal_hideInnerLines_commande_fournisseur'; |
| 616 | 624 | $sessname2 = 'subtotal_hidedetails_commande_fournisseur'; |
| 617 | 625 | $sessname3 = 'subtotal_hideprices_commande_fournisseur'; |
| 618 | - } |
|
| 619 | - else { |
|
| 626 | + } else { |
|
| 620 | 627 | $sessname = 'subtotal_hideInnerLines_unknown'; |
| 621 | 628 | $sessname2 = 'subtotal_hidedetails_unknown'; |
| 622 | 629 | $sessname3 = 'subtotal_hideprices_unknown'; |
@@ -638,8 +645,7 @@ discard block |
||
| 638 | 645 | |
| 639 | 646 | if($line->qty>=90) { |
| 640 | 647 | $line->modsubtotal_total = 1; |
| 641 | - } |
|
| 642 | - else{ |
|
| 648 | + } else{ |
|
| 643 | 649 | $line->modsubtotal_title = 1; |
| 644 | 650 | } |
| 645 | 651 | |
@@ -648,8 +654,7 @@ discard block |
||
| 648 | 654 | } |
| 649 | 655 | } |
| 650 | 656 | |
| 651 | - } |
|
| 652 | - else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') { |
|
| 657 | + } else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') { |
|
| 653 | 658 | |
| 654 | 659 | $Tab = $this->getArrayOfLineForAGroup($object, GETPOST('lineid')); |
| 655 | 660 | |
@@ -657,7 +662,9 @@ discard block |
||
| 657 | 662 | /** |
| 658 | 663 | * @var $object Facture |
| 659 | 664 | */ |
| 660 | - if($object->element=='facture') $object->deleteline($idLine); |
|
| 665 | + if($object->element=='facture') { |
|
| 666 | + $object->deleteline($idLine); |
|
| 667 | + } |
|
| 661 | 668 | /** |
| 662 | 669 | * @var $object Facture fournisseur |
| 663 | 670 | */ |
@@ -668,18 +675,25 @@ discard block |
||
| 668 | 675 | /** |
| 669 | 676 | * @var $object Propal |
| 670 | 677 | */ |
| 671 | - else if($object->element=='propal') $object->deleteline($idLine); |
|
| 678 | + else if($object->element=='propal') { |
|
| 679 | + $object->deleteline($idLine); |
|
| 680 | + } |
|
| 672 | 681 | /** |
| 673 | 682 | * @var $object Propal Fournisseur |
| 674 | 683 | */ |
| 675 | - else if($object->element=='supplier_proposal') $object->deleteline($idLine); |
|
| 684 | + else if($object->element=='supplier_proposal') { |
|
| 685 | + $object->deleteline($idLine); |
|
| 686 | + } |
|
| 676 | 687 | /** |
| 677 | 688 | * @var $object Commande |
| 678 | 689 | */ |
| 679 | 690 | else if($object->element=='commande') |
| 680 | 691 | { |
| 681 | - if ((float) DOL_VERSION >= 5.0) $object->deleteline($user, $idLine); |
|
| 682 | - else $object->deleteline($idLine); |
|
| 692 | + if ((float) DOL_VERSION >= 5.0) { |
|
| 693 | + $object->deleteline($user, $idLine); |
|
| 694 | + } else { |
|
| 695 | + $object->deleteline($idLine); |
|
| 696 | + } |
|
| 683 | 697 | } |
| 684 | 698 | /** |
| 685 | 699 | * @var $object Commande fournisseur |
@@ -691,21 +705,26 @@ discard block |
||
| 691 | 705 | /** |
| 692 | 706 | * @var $object Facturerec |
| 693 | 707 | */ |
| 694 | - else if($object->element=='facturerec') $object->deleteline($idLine); |
|
| 708 | + else if($object->element=='facturerec') { |
|
| 709 | + $object->deleteline($idLine); |
|
| 710 | + } |
|
| 695 | 711 | } |
| 696 | 712 | |
| 697 | 713 | header('location:?id='.$object->id); |
| 698 | 714 | exit; |
| 699 | 715 | |
| 700 | - } |
|
| 701 | - else if ($action == 'duplicate') |
|
| 716 | + } else if ($action == 'duplicate') |
|
| 702 | 717 | { |
| 703 | 718 | $lineid = GETPOST('lineid', 'int'); |
| 704 | 719 | $nbDuplicate = TSubtotal::duplicateLines($object, $lineid, true); |
| 705 | 720 | |
| 706 | - if ($nbDuplicate > 0) setEventMessage($langs->trans('subtotal_duplicate_success', $nbDuplicate)); |
|
| 707 | - elseif ($nbDuplicate == 0) setEventMessage($langs->trans('subtotal_duplicate_lineid_not_found'), 'warnings'); |
|
| 708 | - else setEventMessage($langs->trans('subtotal_duplicate_error'), 'errors'); |
|
| 721 | + if ($nbDuplicate > 0) { |
|
| 722 | + setEventMessage($langs->trans('subtotal_duplicate_success', $nbDuplicate)); |
|
| 723 | + } elseif ($nbDuplicate == 0) { |
|
| 724 | + setEventMessage($langs->trans('subtotal_duplicate_lineid_not_found'), 'warnings'); |
|
| 725 | + } else { |
|
| 726 | + setEventMessage($langs->trans('subtotal_duplicate_error'), 'errors'); |
|
| 727 | + } |
|
| 709 | 728 | |
| 710 | 729 | header('Location: ?id='.$object->id); |
| 711 | 730 | exit; |
@@ -785,17 +804,18 @@ discard block |
||
| 785 | 804 | //print $l->rang.'>='.$rang.' '.$total.'<br/>'; |
| 786 | 805 | if($l->rang>=$rang) { |
| 787 | 806 | //echo 'return!<br>'; |
| 788 | - if (!$return_all) return $total; |
|
| 789 | - else return array($total, $total_tva, $total_ttc, $TTotal_tva); |
|
| 790 | - } |
|
| 791 | - else if(TSubtotal::isTitle($l, 100 - $qty_line)) |
|
| 807 | + if (!$return_all) { |
|
| 808 | + return $total; |
|
| 809 | + } else { |
|
| 810 | + return array($total, $total_tva, $total_ttc, $TTotal_tva); |
|
| 811 | + } |
|
| 812 | + } else if(TSubtotal::isTitle($l, 100 - $qty_line)) |
|
| 792 | 813 | { |
| 793 | 814 | $total = 0; |
| 794 | 815 | $total_tva = 0; |
| 795 | 816 | $total_ttc = 0; |
| 796 | 817 | $TTotal_tva = array(); |
| 797 | - } |
|
| 798 | - elseif(!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) { |
|
| 818 | + } elseif(!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) { |
|
| 799 | 819 | $total += $l->total_ht; |
| 800 | 820 | $total_tva += $l->total_tva; |
| 801 | 821 | $TTotal_tva[$l->tva_tx] += $l->total_tva; |
@@ -803,8 +823,11 @@ discard block |
||
| 803 | 823 | } |
| 804 | 824 | |
| 805 | 825 | } |
| 806 | - if (!$return_all) return $total; |
|
| 807 | - else return array($total, $total_tva, $total_ttc, $TTotal_tva); |
|
| 826 | + if (!$return_all) { |
|
| 827 | + return $total; |
|
| 828 | + } else { |
|
| 829 | + return array($total, $total_tva, $total_ttc, $TTotal_tva); |
|
| 830 | + } |
|
| 808 | 831 | } |
| 809 | 832 | |
| 810 | 833 | /* |
@@ -872,15 +895,18 @@ discard block |
||
| 872 | 895 | } |
| 873 | 896 | |
| 874 | 897 | |
| 875 | - if($line->qty==99) |
|
| 876 | - $pdf->SetFillColor(220,220,220); |
|
| 877 | - elseif ($line->qty==98) |
|
| 878 | - $pdf->SetFillColor(230,230,230); |
|
| 879 | - else |
|
| 880 | - $pdf->SetFillColor(240,240,240); |
|
| 898 | + if($line->qty==99) { |
|
| 899 | + $pdf->SetFillColor(220,220,220); |
|
| 900 | + } elseif ($line->qty==98) { |
|
| 901 | + $pdf->SetFillColor(230,230,230); |
|
| 902 | + } else { |
|
| 903 | + $pdf->SetFillColor(240,240,240); |
|
| 904 | + } |
|
| 881 | 905 | |
| 882 | 906 | $style = 'B'; |
| 883 | - if (!empty($conf->global->SUBTOTAL_SUBTOTAL_STYLE)) $style = $conf->global->SUBTOTAL_SUBTOTAL_STYLE; |
|
| 907 | + if (!empty($conf->global->SUBTOTAL_SUBTOTAL_STYLE)) { |
|
| 908 | + $style = $conf->global->SUBTOTAL_SUBTOTAL_STYLE; |
|
| 909 | + } |
|
| 884 | 910 | |
| 885 | 911 | $pdf->SetFont('', $style, 9); |
| 886 | 912 | |
@@ -919,8 +945,7 @@ discard block |
||
| 919 | 945 | // $line->total_tva |
| 920 | 946 | // $line->total |
| 921 | 947 | // $line->total_ttc |
| 922 | - } |
|
| 923 | - else |
|
| 948 | + } else |
|
| 924 | 949 | { |
| 925 | 950 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
| 926 | 951 | if(get_class($object) == 'Facture' && $object->type==Facture::TYPE_SITUATION){//Facture de situation |
@@ -937,11 +962,14 @@ discard block |
||
| 937 | 962 | } |
| 938 | 963 | |
| 939 | 964 | $pdf->SetXY($pdf->postotalht, $posy); |
| 940 | - if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
| 965 | + if($set_pagebreak_margin) { |
|
| 966 | + $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
| 967 | + } |
|
| 941 | 968 | $pdf->MultiCell($pdf->page_largeur-$pdf->marge_droite-$pdf->postotalht, 3, $total_to_print, 0, 'R', 0); |
| 942 | - } |
|
| 943 | - else{ |
|
| 944 | - if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
| 969 | + } else{ |
|
| 970 | + if($set_pagebreak_margin) { |
|
| 971 | + $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
| 972 | + } |
|
| 945 | 973 | } |
| 946 | 974 | |
| 947 | 975 | $posy = $posy + $cell_height; |
@@ -973,25 +1001,40 @@ discard block |
||
| 973 | 1001 | |
| 974 | 1002 | |
| 975 | 1003 | $style = ($line->qty==1) ? 'BU' : 'BUI'; |
| 976 | - if (!empty($conf->global->SUBTOTAL_TITLE_STYLE)) $style = $conf->global->SUBTOTAL_TITLE_STYLE; |
|
| 1004 | + if (!empty($conf->global->SUBTOTAL_TITLE_STYLE)) { |
|
| 1005 | + $style = $conf->global->SUBTOTAL_TITLE_STYLE; |
|
| 1006 | + } |
|
| 977 | 1007 | |
| 978 | 1008 | if($hideInnerLines) { |
| 979 | - if($line->qty==1)$pdf->SetFont('', $style, 9); |
|
| 980 | - else |
|
| 1009 | + if($line->qty==1) { |
|
| 1010 | + $pdf->SetFont('', $style, 9); |
|
| 1011 | + } else |
|
| 981 | 1012 | { |
| 982 | - if (!empty($conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES)) $style = $conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES; |
|
| 1013 | + if (!empty($conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES)) { |
|
| 1014 | + $style = $conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES; |
|
| 1015 | + } |
|
| 983 | 1016 | $pdf->SetFont('', $style, 9); |
| 984 | 1017 | } |
| 985 | - } |
|
| 986 | - else { |
|
| 1018 | + } else { |
|
| 987 | 1019 | |
| 988 | - if($line->qty==1)$pdf->SetFont('', $style, 9); //TODO if super utile |
|
| 989 | - else $pdf->SetFont('', $style, 9); |
|
| 1020 | + if($line->qty==1) { |
|
| 1021 | + $pdf->SetFont('', $style, 9); |
|
| 1022 | + } |
|
| 1023 | + //TODO if super utile |
|
| 1024 | + else { |
|
| 1025 | + $pdf->SetFont('', $style, 9); |
|
| 1026 | + } |
|
| 990 | 1027 | |
| 991 | 1028 | } |
| 992 | 1029 | |
| 993 | - 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 |
|
| 994 | - else $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J',true); // et maintenant avec du HTML |
|
| 1030 | + if ($label === strip_tags($label) && $label === dol_html_entity_decode($label, ENT_QUOTES)) { |
|
| 1031 | + $pdf->MultiCell($w, $h, $label, 0, 'L'); |
|
| 1032 | + } |
|
| 1033 | + // Pas de HTML dans la chaine |
|
| 1034 | + else { |
|
| 1035 | + $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J',true); |
|
| 1036 | + } |
|
| 1037 | + // et maintenant avec du HTML |
|
| 995 | 1038 | |
| 996 | 1039 | if($description && !$hidedesc) { |
| 997 | 1040 | $posy = $pdf->GetY(); |
@@ -1015,8 +1058,7 @@ discard block |
||
| 1015 | 1058 | |
| 1016 | 1059 | if(is_array($parameters)) { |
| 1017 | 1060 | $i = & $parameters['i']; |
| 1018 | - } |
|
| 1019 | - else { |
|
| 1061 | + } else { |
|
| 1020 | 1062 | $i = (int)$parameters; |
| 1021 | 1063 | } |
| 1022 | 1064 | |
@@ -1038,17 +1080,14 @@ discard block |
||
| 1038 | 1080 | |
| 1039 | 1081 | if((float)DOL_VERSION<=3.6) { |
| 1040 | 1082 | return ''; |
| 1041 | - } |
|
| 1042 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1083 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1043 | 1084 | return 1; |
| 1044 | 1085 | } |
| 1045 | 1086 | |
| 1046 | - } |
|
| 1047 | - elseif(!empty($hideprices)) { |
|
| 1087 | + } elseif(!empty($hideprices)) { |
|
| 1048 | 1088 | $this->resprints = $object->lines[$parameters['i']]->qty; |
| 1049 | 1089 | return 1; |
| 1050 | - } |
|
| 1051 | - elseif (!empty($conf->global->SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY)) |
|
| 1090 | + } elseif (!empty($conf->global->SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY)) |
|
| 1052 | 1091 | { |
| 1053 | 1092 | $hideInnerLines = (int)GETPOST('hideInnerLines'); |
| 1054 | 1093 | $hidedetails = (int)GETPOST('hidedetails'); |
@@ -1058,12 +1097,20 @@ discard block |
||
| 1058 | 1097 | } |
| 1059 | 1098 | } |
| 1060 | 1099 | |
| 1061 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1062 | - else $i = (int)$parameters; |
|
| 1100 | + if(is_array($parameters)) { |
|
| 1101 | + $i = & $parameters['i']; |
|
| 1102 | + } else { |
|
| 1103 | + $i = (int)$parameters; |
|
| 1104 | + } |
|
| 1063 | 1105 | |
| 1064 | - 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) |
|
| 1106 | + if (empty($object->lines[$i])) { |
|
| 1107 | + return 0; |
|
| 1108 | + } |
|
| 1109 | + // 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) |
|
| 1065 | 1110 | |
| 1066 | - if(empty($object->lines[$i]->array_options)) $object->lines[$i]->fetch_optionals(); |
|
| 1111 | + if(empty($object->lines[$i]->array_options)) { |
|
| 1112 | + $object->lines[$i]->fetch_optionals(); |
|
| 1113 | + } |
|
| 1067 | 1114 | |
| 1068 | 1115 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
| 1069 | 1116 | { |
@@ -1080,8 +1127,11 @@ discard block |
||
| 1080 | 1127 | function pdf_getlinetotalexcltax($parameters=array(), &$object, &$action='') { |
| 1081 | 1128 | global $conf, $hideprices, $hookmanager; |
| 1082 | 1129 | |
| 1083 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1084 | - else $i = (int)$parameters; |
|
| 1130 | + if(is_array($parameters)) { |
|
| 1131 | + $i = & $parameters['i']; |
|
| 1132 | + } else { |
|
| 1133 | + $i = (int)$parameters; |
|
| 1134 | + } |
|
| 1085 | 1135 | |
| 1086 | 1136 | if($this->isModSubtotalLine($parameters,$object) ){ |
| 1087 | 1137 | |
@@ -1089,13 +1139,11 @@ discard block |
||
| 1089 | 1139 | |
| 1090 | 1140 | if((float)DOL_VERSION<=3.6) { |
| 1091 | 1141 | return ''; |
| 1092 | - } |
|
| 1093 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1142 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1094 | 1143 | return 1; |
| 1095 | 1144 | } |
| 1096 | 1145 | |
| 1097 | - } |
|
| 1098 | - elseif (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS)) |
|
| 1146 | + } elseif (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS)) |
|
| 1099 | 1147 | { |
| 1100 | 1148 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
| 1101 | 1149 | { |
@@ -1167,12 +1215,10 @@ discard block |
||
| 1167 | 1215 | $this->error = $hookmanager->error; |
| 1168 | 1216 | $this->errors = $hookmanager->errors; |
| 1169 | 1217 | return -1; |
| 1170 | - } |
|
| 1171 | - elseif (empty($reshook)) |
|
| 1218 | + } elseif (empty($reshook)) |
|
| 1172 | 1219 | { |
| 1173 | 1220 | $this->resprints .= $hookmanager->resprints; |
| 1174 | - } |
|
| 1175 | - else |
|
| 1221 | + } else |
|
| 1176 | 1222 | { |
| 1177 | 1223 | $this->resprints = $hookmanager->resprints; |
| 1178 | 1224 | |
@@ -1195,14 +1241,16 @@ discard block |
||
| 1195 | 1241 | |
| 1196 | 1242 | if((float)DOL_VERSION<=3.6) { |
| 1197 | 1243 | return ''; |
| 1198 | - } |
|
| 1199 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1244 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1200 | 1245 | return 1; |
| 1201 | 1246 | } |
| 1202 | 1247 | } |
| 1203 | 1248 | |
| 1204 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1205 | - else $i = (int)$parameters; |
|
| 1249 | + if(is_array($parameters)) { |
|
| 1250 | + $i = & $parameters['i']; |
|
| 1251 | + } else { |
|
| 1252 | + $i = (int)$parameters; |
|
| 1253 | + } |
|
| 1206 | 1254 | |
| 1207 | 1255 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
| 1208 | 1256 | { |
@@ -1224,14 +1272,16 @@ discard block |
||
| 1224 | 1272 | |
| 1225 | 1273 | if((float)DOL_VERSION<=3.6) { |
| 1226 | 1274 | return ''; |
| 1227 | - } |
|
| 1228 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1275 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1229 | 1276 | return 1; |
| 1230 | 1277 | } |
| 1231 | 1278 | } |
| 1232 | 1279 | |
| 1233 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1234 | - else $i = (int)$parameters; |
|
| 1280 | + if(is_array($parameters)) { |
|
| 1281 | + $i = & $parameters['i']; |
|
| 1282 | + } else { |
|
| 1283 | + $i = (int)$parameters; |
|
| 1284 | + } |
|
| 1235 | 1285 | |
| 1236 | 1286 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
| 1237 | 1287 | { |
@@ -1253,13 +1303,15 @@ discard block |
||
| 1253 | 1303 | |
| 1254 | 1304 | if((float)DOL_VERSION<=3.6) { |
| 1255 | 1305 | return ''; |
| 1256 | - } |
|
| 1257 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1306 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1258 | 1307 | return 1; |
| 1259 | 1308 | } |
| 1260 | 1309 | } |
| 1261 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1262 | - else $i = (int)$parameters; |
|
| 1310 | + if(is_array($parameters)) { |
|
| 1311 | + $i = & $parameters['i']; |
|
| 1312 | + } else { |
|
| 1313 | + $i = (int)$parameters; |
|
| 1314 | + } |
|
| 1263 | 1315 | |
| 1264 | 1316 | |
| 1265 | 1317 | // Si la gestion C/NC est active et que je suis sur un ligne dont l'extrafield est coché |
@@ -1306,14 +1358,16 @@ discard block |
||
| 1306 | 1358 | $this->resprints = ' '; |
| 1307 | 1359 | if((float)DOL_VERSION<=3.6) { |
| 1308 | 1360 | return ''; |
| 1309 | - } |
|
| 1310 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1361 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1311 | 1362 | return 1; |
| 1312 | 1363 | } |
| 1313 | 1364 | } |
| 1314 | 1365 | |
| 1315 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1316 | - else $i = (int)$parameters; |
|
| 1366 | + if(is_array($parameters)) { |
|
| 1367 | + $i = & $parameters['i']; |
|
| 1368 | + } else { |
|
| 1369 | + $i = (int)$parameters; |
|
| 1370 | + } |
|
| 1317 | 1371 | |
| 1318 | 1372 | if (!empty($hideprices) |
| 1319 | 1373 | || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
@@ -1337,16 +1391,21 @@ discard block |
||
| 1337 | 1391 | |
| 1338 | 1392 | if((float)DOL_VERSION<=3.6) { |
| 1339 | 1393 | return ''; |
| 1340 | - } |
|
| 1341 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1394 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1342 | 1395 | return 1; |
| 1343 | 1396 | } |
| 1344 | 1397 | } |
| 1345 | 1398 | |
| 1346 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1347 | - else $i = (int)$parameters; |
|
| 1399 | + if(is_array($parameters)) { |
|
| 1400 | + $i = & $parameters['i']; |
|
| 1401 | + } else { |
|
| 1402 | + $i = (int)$parameters; |
|
| 1403 | + } |
|
| 1348 | 1404 | |
| 1349 | - 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) |
|
| 1405 | + if (empty($object->lines[$i])) { |
|
| 1406 | + return 0; |
|
| 1407 | + } |
|
| 1408 | + // 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) |
|
| 1350 | 1409 | |
| 1351 | 1410 | $object->lines[$i]->fetch_optionals(); |
| 1352 | 1411 | // Si la gestion C/NC est active et que je suis sur un ligne dont l'extrafield est coché |
@@ -1392,14 +1451,16 @@ discard block |
||
| 1392 | 1451 | $this->resprints = ' '; |
| 1393 | 1452 | if((float)DOL_VERSION<=3.6) { |
| 1394 | 1453 | return ''; |
| 1395 | - } |
|
| 1396 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1454 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1397 | 1455 | return 1; |
| 1398 | 1456 | } |
| 1399 | 1457 | } |
| 1400 | 1458 | |
| 1401 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1402 | - else $i = (int)$parameters; |
|
| 1459 | + if(is_array($parameters)) { |
|
| 1460 | + $i = & $parameters['i']; |
|
| 1461 | + } else { |
|
| 1462 | + $i = (int)$parameters; |
|
| 1463 | + } |
|
| 1403 | 1464 | |
| 1404 | 1465 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
| 1405 | 1466 | { |
@@ -1429,7 +1490,9 @@ discard block |
||
| 1429 | 1490 | } |
| 1430 | 1491 | } |
| 1431 | 1492 | |
| 1432 | - if (!empty($TLineTitle)) $TTitleNumeroted = $this->formatNumerotation($TLineTitle); |
|
| 1493 | + if (!empty($TLineTitle)) { |
|
| 1494 | + $TTitleNumeroted = $this->formatNumerotation($TLineTitle); |
|
| 1495 | + } |
|
| 1433 | 1496 | } |
| 1434 | 1497 | |
| 1435 | 1498 | } |
@@ -1443,8 +1506,12 @@ discard block |
||
| 1443 | 1506 | $j=0; |
| 1444 | 1507 | foreach ($TLineTitle as $k => &$line) |
| 1445 | 1508 | { |
| 1446 | - if (!empty($line_reference) && $line->rang <= $line_reference->rang) continue; |
|
| 1447 | - if (!empty($line_reference) && $line->qty <= $line_reference->qty) break; |
|
| 1509 | + if (!empty($line_reference) && $line->rang <= $line_reference->rang) { |
|
| 1510 | + continue; |
|
| 1511 | + } |
|
| 1512 | + if (!empty($line_reference) && $line->qty <= $line_reference->qty) { |
|
| 1513 | + break; |
|
| 1514 | + } |
|
| 1448 | 1515 | |
| 1449 | 1516 | if ($line->qty == $level) |
| 1450 | 1517 | { |
@@ -1478,7 +1545,9 @@ discard block |
||
| 1478 | 1545 | |
| 1479 | 1546 | $hidedetails = (int)GETPOST('hidedetails'); |
| 1480 | 1547 | |
| 1481 | - if(empty($hidedetails)) return false; |
|
| 1548 | + if(empty($hidedetails)) { |
|
| 1549 | + return false; |
|
| 1550 | + } |
|
| 1482 | 1551 | |
| 1483 | 1552 | // TODO can't add VAT to document without lines... :-/ |
| 1484 | 1553 | |
@@ -1531,7 +1600,9 @@ discard block |
||
| 1531 | 1600 | */ |
| 1532 | 1601 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
| 1533 | 1602 | |
| 1534 | - if (TSubtotal::getNiveau($line) == 1) $line->TTotal_tva = $TTotal_tva; |
|
| 1603 | + if (TSubtotal::getNiveau($line) == 1) { |
|
| 1604 | + $line->TTotal_tva = $TTotal_tva; |
|
| 1605 | + } |
|
| 1535 | 1606 | $line->total_ht = $total; |
| 1536 | 1607 | $line->total_tva = $total_tva; |
| 1537 | 1608 | $line->total = $line->total_ht; |
@@ -1586,8 +1657,7 @@ discard block |
||
| 1586 | 1657 | } |
| 1587 | 1658 | |
| 1588 | 1659 | |
| 1589 | - } |
|
| 1590 | - elseif ($hidedetails) |
|
| 1660 | + } elseif ($hidedetails) |
|
| 1591 | 1661 | { |
| 1592 | 1662 | $TLines[] = $line; //Cas où je cache uniquement les prix des produits |
| 1593 | 1663 | } |
@@ -1658,7 +1728,9 @@ discard block |
||
| 1658 | 1728 | |
| 1659 | 1729 | if(!empty($hideprices)) { |
| 1660 | 1730 | foreach($object->lines as &$line) { |
| 1661 | - if($line->fk_product_type!=9) $line->fk_parent_line = -1; |
|
| 1731 | + if($line->fk_product_type!=9) { |
|
| 1732 | + $line->fk_parent_line = -1; |
|
| 1733 | + } |
|
| 1662 | 1734 | } |
| 1663 | 1735 | } |
| 1664 | 1736 | |
@@ -1679,7 +1751,9 @@ discard block |
||
| 1679 | 1751 | |
| 1680 | 1752 | if($line->qty>90) { |
| 1681 | 1753 | |
| 1682 | - if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) $label .= ' '.$this->getTitle($object, $line); |
|
| 1754 | + if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) { |
|
| 1755 | + $label .= ' '.$this->getTitle($object, $line); |
|
| 1756 | + } |
|
| 1683 | 1757 | |
| 1684 | 1758 | $pageBefore = $pdf->getPage(); |
| 1685 | 1759 | $this->pdf_add_total($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
@@ -1697,8 +1771,7 @@ discard block |
||
| 1697 | 1771 | |
| 1698 | 1772 | $posy = $pdf->GetY(); |
| 1699 | 1773 | return 1; |
| 1700 | - } |
|
| 1701 | - else if ($line->qty < 10) { |
|
| 1774 | + } else if ($line->qty < 10) { |
|
| 1702 | 1775 | $pageBefore = $pdf->getPage(); |
| 1703 | 1776 | |
| 1704 | 1777 | $this->pdf_add_title($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
@@ -1722,8 +1795,7 @@ discard block |
||
| 1722 | 1795 | // if($line->rowid==47) exit; |
| 1723 | 1796 | |
| 1724 | 1797 | return 0; |
| 1725 | - } |
|
| 1726 | - elseif (empty($object->lines[$parameters['i']])) |
|
| 1798 | + } elseif (empty($object->lines[$parameters['i']])) |
|
| 1727 | 1799 | { |
| 1728 | 1800 | $this->resprints = -1; |
| 1729 | 1801 | } |
@@ -1756,7 +1828,9 @@ discard block |
||
| 1756 | 1828 | |
| 1757 | 1829 | foreach ($object->lines as $line) |
| 1758 | 1830 | { |
| 1759 | - if ($line->id == $currentLine->id) break; |
|
| 1831 | + if ($line->id == $currentLine->id) { |
|
| 1832 | + break; |
|
| 1833 | + } |
|
| 1760 | 1834 | |
| 1761 | 1835 | $qty_search = 100 - $currentLine->qty; |
| 1762 | 1836 | |
@@ -1793,23 +1867,23 @@ discard block |
||
| 1793 | 1867 | { |
| 1794 | 1868 | $object->statut = 0; // hack for facture rec |
| 1795 | 1869 | $createRight = $user->rights->facture->creer; |
| 1796 | - } |
|
| 1797 | - elseif($object->element == 'order_supplier' ) |
|
| 1870 | + } elseif($object->element == 'order_supplier' ) |
|
| 1798 | 1871 | { |
| 1799 | 1872 | $createRight = $user->rights->fournisseur->commande->creer; |
| 1800 | - } |
|
| 1801 | - elseif($object->element == 'invoice_supplier' ) |
|
| 1873 | + } elseif($object->element == 'invoice_supplier' ) |
|
| 1802 | 1874 | { |
| 1803 | 1875 | $createRight = $user->rights->fournisseur->facture->creer; |
| 1804 | 1876 | } |
| 1805 | 1877 | |
| 1806 | 1878 | if($line->special_code!=$this->module_number || $line->product_type!=9) { |
| 1807 | 1879 | null; |
| 1808 | - } |
|
| 1809 | - 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)) |
|
| 1880 | + } 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)) |
|
| 1810 | 1881 | { |
| 1811 | - if($object->element=='facture')$idvar = 'facid'; |
|
| 1812 | - else $idvar='id'; |
|
| 1882 | + if($object->element=='facture') { |
|
| 1883 | + $idvar = 'facid'; |
|
| 1884 | + } else { |
|
| 1885 | + $idvar='id'; |
|
| 1886 | + } |
|
| 1813 | 1887 | |
| 1814 | 1888 | if((float)DOL_VERSION <= 3.4) |
| 1815 | 1889 | { |
@@ -1835,20 +1909,44 @@ discard block |
||
| 1835 | 1909 | <?php |
| 1836 | 1910 | } |
| 1837 | 1911 | |
| 1838 | - if(empty($line->description)) $line->description = $line->desc; |
|
| 1912 | + if(empty($line->description)) { |
|
| 1913 | + $line->description = $line->desc; |
|
| 1914 | + } |
|
| 1839 | 1915 | |
| 1840 | 1916 | $colspan = 5; |
| 1841 | - if($object->element == 'facturerec' ) $colspan = 3; |
|
| 1842 | - if($object->element == 'order_supplier') $colspan = 3; |
|
| 1843 | - if($object->element == 'invoice_supplier') $colspan = 4; |
|
| 1844 | - if($object->element == 'supplier_proposal') $colspan = 4; |
|
| 1845 | - if(!empty($conf->multicurrency->enabled)) $colspan+=2; |
|
| 1846 | - if($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) $colspan++; |
|
| 1847 | - if(!empty($conf->margin->enabled)) $colspan++; |
|
| 1848 | - if(!empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; |
|
| 1849 | - if(!empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; |
|
| 1850 | - if($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) $colspan++; |
|
| 1851 | - if(!empty($conf->global->PRODUCT_USE_UNITS)) $colspan++; |
|
| 1917 | + if($object->element == 'facturerec' ) { |
|
| 1918 | + $colspan = 3; |
|
| 1919 | + } |
|
| 1920 | + if($object->element == 'order_supplier') { |
|
| 1921 | + $colspan = 3; |
|
| 1922 | + } |
|
| 1923 | + if($object->element == 'invoice_supplier') { |
|
| 1924 | + $colspan = 4; |
|
| 1925 | + } |
|
| 1926 | + if($object->element == 'supplier_proposal') { |
|
| 1927 | + $colspan = 4; |
|
| 1928 | + } |
|
| 1929 | + if(!empty($conf->multicurrency->enabled)) { |
|
| 1930 | + $colspan+=2; |
|
| 1931 | + } |
|
| 1932 | + if($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) { |
|
| 1933 | + $colspan++; |
|
| 1934 | + } |
|
| 1935 | + if(!empty($conf->margin->enabled)) { |
|
| 1936 | + $colspan++; |
|
| 1937 | + } |
|
| 1938 | + if(!empty($conf->global->DISPLAY_MARGIN_RATES)) { |
|
| 1939 | + $colspan++; |
|
| 1940 | + } |
|
| 1941 | + if(!empty($conf->global->DISPLAY_MARK_RATES)) { |
|
| 1942 | + $colspan++; |
|
| 1943 | + } |
|
| 1944 | + if($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) { |
|
| 1945 | + $colspan++; |
|
| 1946 | + } |
|
| 1947 | + if(!empty($conf->global->PRODUCT_USE_UNITS)) { |
|
| 1948 | + $colspan++; |
|
| 1949 | + } |
|
| 1852 | 1950 | |
| 1853 | 1951 | /* Titre */ |
| 1854 | 1952 | //var_dump($line); |
@@ -1861,23 +1959,36 @@ discard block |
||
| 1861 | 1959 | <tr <?php echo $bc[$var]; $var=!$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
| 1862 | 1960 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT)) |
| 1863 | 1961 | { |
| 1864 | - if($line->qty==99) print 'background:#adadcf'; |
|
| 1865 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
| 1866 | - else if($line->qty<=97 && $line->qty>=91) print 'background:#eeeeff;'; |
|
| 1867 | - else if($line->qty==1) print 'background:#adadcf;'; |
|
| 1868 | - else if($line->qty==2) print 'background:#ddddff;'; |
|
| 1869 | - else if($line->qty==50) print ''; |
|
| 1870 | - else print 'background:#eeeeff;'; |
|
| 1962 | + if($line->qty==99) { |
|
| 1963 | + print 'background:#adadcf'; |
|
| 1964 | + } else if($line->qty==98) { |
|
| 1965 | + print 'background:#ddddff;'; |
|
| 1966 | + } else if($line->qty<=97 && $line->qty>=91) { |
|
| 1967 | + print 'background:#eeeeff;'; |
|
| 1968 | + } else if($line->qty==1) { |
|
| 1969 | + print 'background:#adadcf;'; |
|
| 1970 | + } else if($line->qty==2) { |
|
| 1971 | + print 'background:#ddddff;'; |
|
| 1972 | + } else if($line->qty==50) { |
|
| 1973 | + print ''; |
|
| 1974 | + } else { |
|
| 1975 | + print 'background:#eeeeff;'; |
|
| 1976 | + } |
|
| 1871 | 1977 | |
| 1872 | 1978 | //A compléter si on veux plus de nuances de couleurs avec les niveau 4,5,6,7,8 et 9 |
| 1873 | - } |
|
| 1874 | - else |
|
| 1979 | + } else |
|
| 1875 | 1980 | { |
| 1876 | - if($line->qty==99) print 'background:#ddffdd'; |
|
| 1877 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
| 1878 | - else if($line->qty==2) print 'background:#eeeeff; '; |
|
| 1879 | - else if($line->qty==50) print ''; |
|
| 1880 | - else print 'background:#eeffee;' ; |
|
| 1981 | + if($line->qty==99) { |
|
| 1982 | + print 'background:#ddffdd'; |
|
| 1983 | + } else if($line->qty==98) { |
|
| 1984 | + print 'background:#ddddff;'; |
|
| 1985 | + } else if($line->qty==2) { |
|
| 1986 | + print 'background:#eeeeff; '; |
|
| 1987 | + } else if($line->qty==50) { |
|
| 1988 | + print ''; |
|
| 1989 | + } else { |
|
| 1990 | + print 'background:#eeffee;' ; |
|
| 1991 | + } |
|
| 1881 | 1992 | } |
| 1882 | 1993 | |
| 1883 | 1994 | ?>;"> |
@@ -1900,13 +2011,11 @@ discard block |
||
| 1900 | 2011 | $qty_displayed = $line->qty; |
| 1901 | 2012 | print img_picto('', 'subsubtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;color:#0075DE;">'.$qty_displayed.'</span> '; |
| 1902 | 2013 | |
| 1903 | - } |
|
| 1904 | - else if (TSubtotal::isSubtotal($line)) |
|
| 2014 | + } else if (TSubtotal::isSubtotal($line)) |
|
| 1905 | 2015 | { |
| 1906 | 2016 | $qty_displayed = 100 - $line->qty; |
| 1907 | 2017 | print img_picto('', 'subsubtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;color:#0075DE;">'.$qty_displayed.'</span> '; |
| 1908 | - } |
|
| 1909 | - else |
|
| 2018 | + } else |
|
| 1910 | 2019 | { |
| 1911 | 2020 | $isFreeText = true; |
| 1912 | 2021 | } |
@@ -1927,9 +2036,13 @@ discard block |
||
| 1927 | 2036 | } |
| 1928 | 2037 | |
| 1929 | 2038 | $readonlyForSituation = ''; |
| 1930 | - if (!empty($object->situation_cycle_ref) && $object->situation_counter > 1) $readonlyForSituation = 'readonly'; |
|
| 2039 | + if (!empty($object->situation_cycle_ref) && $object->situation_counter > 1) { |
|
| 2040 | + $readonlyForSituation = 'readonly'; |
|
| 2041 | + } |
|
| 1931 | 2042 | |
| 1932 | - if (!$isFreeText) echo '<input type="text" name="line-title" id-line="'.$line->id.'" value="'.$newlabel.'" size="80" '.$readonlyForSituation.'/> '; |
|
| 2043 | + if (!$isFreeText) { |
|
| 2044 | + echo '<input type="text" name="line-title" id-line="'.$line->id.'" value="'.$newlabel.'" size="80" '.$readonlyForSituation.'/> '; |
|
| 2045 | + } |
|
| 1933 | 2046 | |
| 1934 | 2047 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT) && (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) ) |
| 1935 | 2048 | { |
@@ -1937,8 +2050,12 @@ discard block |
||
| 1937 | 2050 | for ($j=1; $j<10; $j++) |
| 1938 | 2051 | { |
| 1939 | 2052 | if (!empty($readonlyForSituation)) { |
| 1940 | - if ($qty_displayed == $j) $select .= '<option selected="selected" value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
|
| 1941 | - } else $select .= '<option '.($qty_displayed == $j ? 'selected="selected"' : '').' value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
|
| 2053 | + if ($qty_displayed == $j) { |
|
| 2054 | + $select .= '<option selected="selected" value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
|
| 2055 | + } |
|
| 2056 | + } else { |
|
| 2057 | + $select .= '<option '.($qty_displayed == $j ? 'selected="selected"' : '').' value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
|
| 2058 | + } |
|
| 1942 | 2059 | } |
| 1943 | 2060 | $select .= '</select> '; |
| 1944 | 2061 | |
@@ -1954,15 +2071,18 @@ discard block |
||
| 1954 | 2071 | $form = new Form($db); |
| 1955 | 2072 | echo '<label for="subtotal_tva_tx">'.$form->textwithpicto($langs->trans('subtotal_apply_default_tva'), $langs->trans('subtotal_apply_default_tva_help')).'</label>'; |
| 1956 | 2073 | echo '<select id="subtotal_tva_tx" name="subtotal_tva_tx" class="flat"><option selected="selected" value="">-</option>'; |
| 1957 | - if (empty($readonlyForSituation)) echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true)); |
|
| 2074 | + if (empty($readonlyForSituation)) { |
|
| 2075 | + echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true)); |
|
| 2076 | + } |
|
| 1958 | 2077 | echo '</select> '; |
| 1959 | 2078 | |
| 1960 | 2079 | if (!empty($conf->global->INVOICE_USE_SITUATION) && $object->element == 'facture' && $object->type == Facture::TYPE_SITUATION) |
| 1961 | 2080 | { |
| 1962 | 2081 | echo '<label for="subtotal_progress">'.$langs->trans('subtotal_apply_progress').'</label> <input id="subtotal_progress" name="subtotal_progress" value="" size="1" />%'; |
| 1963 | 2082 | } |
| 2083 | + } else if ($isFreeText) { |
|
| 2084 | + echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation); |
|
| 1964 | 2085 | } |
| 1965 | - else if ($isFreeText) echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation); |
|
| 1966 | 2086 | echo '</div>'; |
| 1967 | 2087 | |
| 1968 | 2088 | if($line->qty<10) { |
@@ -1982,8 +2102,7 @@ discard block |
||
| 1982 | 2102 | $doleditor->Create(); |
| 1983 | 2103 | } |
| 1984 | 2104 | |
| 1985 | - } |
|
| 1986 | - else { |
|
| 2105 | + } else { |
|
| 1987 | 2106 | |
| 1988 | 2107 | if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) |
| 1989 | 2108 | { |
@@ -1991,14 +2110,19 @@ discard block |
||
| 1991 | 2110 | { |
| 1992 | 2111 | echo str_repeat(' ', $line->qty-1); |
| 1993 | 2112 | |
| 1994 | - if (TSubtotal::isTitle($line)) print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
|
| 1995 | - else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
| 2113 | + if (TSubtotal::isTitle($line)) { |
|
| 2114 | + print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
|
| 2115 | + } else { |
|
| 2116 | + print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
| 2117 | + } |
|
| 1996 | 2118 | } |
| 1997 | - } |
|
| 1998 | - else |
|
| 2119 | + } else |
|
| 1999 | 2120 | { |
| 2000 | - if($line->qty<=1) print img_picto('', 'subtotal@subtotal'); |
|
| 2001 | - else if($line->qty==2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
| 2121 | + if($line->qty<=1) { |
|
| 2122 | + print img_picto('', 'subtotal@subtotal'); |
|
| 2123 | + } else if($line->qty==2) { |
|
| 2124 | + print img_picto('', 'subsubtotal@subtotal').' '; |
|
| 2125 | + } |
|
| 2002 | 2126 | } |
| 2003 | 2127 | |
| 2004 | 2128 | |
@@ -2008,21 +2132,26 @@ discard block |
||
| 2008 | 2132 | $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
| 2009 | 2133 | |
| 2010 | 2134 | if (empty($line->label)) { |
| 2011 | - if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) print $line->description.' '.$this->getTitle($object, $line); |
|
| 2012 | - else print $line->description; |
|
| 2013 | - } |
|
| 2014 | - else { |
|
| 2135 | + if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) { |
|
| 2136 | + print $line->description.' '.$this->getTitle($object, $line); |
|
| 2137 | + } else { |
|
| 2138 | + print $line->description; |
|
| 2139 | + } |
|
| 2140 | + } else { |
|
| 2015 | 2141 | |
| 2016 | 2142 | if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
| 2017 | 2143 | print '<span class="subtotal_label" style="'.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" >'.$line->label.'</span><br><div class="subtotal_desc">'.dol_htmlentitiesbr($line->description).'</div>'; |
| 2018 | - } |
|
| 2019 | - else{ |
|
| 2144 | + } else{ |
|
| 2020 | 2145 | print '<span class="subtotal_label classfortooltip '.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" title="'.$line->description.'">'.$line->label.'</span>'; |
| 2021 | 2146 | } |
| 2022 | 2147 | |
| 2023 | 2148 | } |
| 2024 | - if($line->qty>90) print ' : '; |
|
| 2025 | - if($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
| 2149 | + if($line->qty>90) { |
|
| 2150 | + print ' : '; |
|
| 2151 | + } |
|
| 2152 | + if($line->info_bits > 0) { |
|
| 2153 | + echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
| 2154 | + } |
|
| 2026 | 2155 | |
| 2027 | 2156 | |
| 2028 | 2157 | |
@@ -2059,11 +2188,12 @@ discard block |
||
| 2059 | 2188 | </script> |
| 2060 | 2189 | <?php |
| 2061 | 2190 | |
| 2062 | - } |
|
| 2063 | - else{ |
|
| 2191 | + } else{ |
|
| 2064 | 2192 | if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) && $object->element !== 'invoice_supplier') |
| 2065 | 2193 | { |
| 2066 | - if(TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref) ) echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=duplicate&lineid='.$line->id.'">'. img_picto($langs->trans('Duplicate'), 'duplicate@subtotal').'</a>'; |
|
| 2194 | + if(TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref) ) { |
|
| 2195 | + echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=duplicate&lineid='.$line->id.'">'. img_picto($langs->trans('Duplicate'), 'duplicate@subtotal').'</a>'; |
|
| 2196 | + } |
|
| 2067 | 2197 | } |
| 2068 | 2198 | |
| 2069 | 2199 | if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_EDIT_BLOCK)) |
@@ -2132,7 +2262,9 @@ discard block |
||
| 2132 | 2262 | $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); |
| 2133 | 2263 | |
| 2134 | 2264 | $colspan+=3; $mode = 'view'; |
| 2135 | - if($action === 'editline' && $line->rowid == GETPOST('lineid')) $mode = 'edit'; |
|
| 2265 | + if($action === 'editline' && $line->rowid == GETPOST('lineid')) { |
|
| 2266 | + $mode = 'edit'; |
|
| 2267 | + } |
|
| 2136 | 2268 | |
| 2137 | 2269 | $ex_element = $line->element; |
| 2138 | 2270 | $line->element = 'tr_extrafield_title '.$line->element; // Pour pouvoir manipuler ces tr |
@@ -2314,10 +2446,9 @@ discard block |
||
| 2314 | 2446 | |
| 2315 | 2447 | if(TSubtotal::isTitle($line)){ |
| 2316 | 2448 | $ThtmlData['data-issubtotal'] = 'title'; |
| 2317 | - }elseif(TSubtotal::isSubtotal($line)){ |
|
| 2449 | + } elseif(TSubtotal::isSubtotal($line)){ |
|
| 2318 | 2450 | $ThtmlData['data-issubtotal'] = 'subtotal'; |
| 2319 | - } |
|
| 2320 | - else{ |
|
| 2451 | + } else{ |
|
| 2321 | 2452 | $ThtmlData['data-issubtotal'] = 'freetext'; |
| 2322 | 2453 | } |
| 2323 | 2454 | |
@@ -2327,7 +2458,9 @@ discard block |
||
| 2327 | 2458 | |
| 2328 | 2459 | // hook |
| 2329 | 2460 | $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
| 2330 | - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 2461 | + if ($reshook < 0) { |
|
| 2462 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 2463 | + } |
|
| 2331 | 2464 | if ($reshook>0) |
| 2332 | 2465 | { |
| 2333 | 2466 | $ThtmlData = $hookmanager->resArray; |