@@ -101,11 +101,11 @@ discard block |
||
| 101 | 101 | * @return void |
| 102 | 102 | */ |
| 103 | 103 | |
| 104 | - var $module_number = 104777; |
|
| 104 | + var $module_number = 104777; |
|
| 105 | 105 | |
| 106 | - function formObjectOptions($parameters, &$object, &$action, $hookmanager) |
|
| 107 | - { |
|
| 108 | - global $langs,$db,$user, $conf; |
|
| 106 | + function formObjectOptions($parameters, &$object, &$action, $hookmanager) |
|
| 107 | + { |
|
| 108 | + global $langs,$db,$user, $conf; |
|
| 109 | 109 | |
| 110 | 110 | $langs->load('subtotal@subtotal'); |
| 111 | 111 | |
@@ -120,10 +120,10 @@ discard block |
||
| 120 | 120 | $createRight = $user->rights->facture->creer; |
| 121 | 121 | } elseif($object->element == 'order_supplier' ) |
| 122 | 122 | { |
| 123 | - $createRight = $user->rights->fournisseur->commande->creer; |
|
| 123 | + $createRight = $user->rights->fournisseur->commande->creer; |
|
| 124 | 124 | } elseif($object->element == 'invoice_supplier' ) |
| 125 | 125 | { |
| 126 | - $createRight = $user->rights->fournisseur->facture->creer; |
|
| 126 | + $createRight = $user->rights->fournisseur->facture->creer; |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if ($object->statut == 0 && $createRight) { |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | |
| 174 | 174 | if (!empty($conf->global->SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE) && $qty < 10) TSubtotal::addSubtotalMissing($object, $qty); |
| 175 | 175 | |
| 176 | - TSubtotal::addSubTotalLine($object, $title, $qty); |
|
| 176 | + TSubtotal::addSubTotalLine($object, $title, $qty); |
|
| 177 | 177 | } |
| 178 | 178 | else if($action==='ask_deleteallline') { |
| 179 | 179 | $form=new Form($db); |
@@ -395,36 +395,36 @@ discard block |
||
| 395 | 395 | $TContext = explode(':',$parameters['context']); |
| 396 | 396 | if ( |
| 397 | 397 | in_array('invoicecard',$TContext) |
| 398 | - || in_array('invoicesuppliercard',$TContext) |
|
| 398 | + || in_array('invoicesuppliercard',$TContext) |
|
| 399 | 399 | || in_array('propalcard',$TContext) |
| 400 | 400 | || in_array('ordercard',$TContext) |
| 401 | - || in_array('ordersuppliercard',$TContext) |
|
| 401 | + || in_array('ordersuppliercard',$TContext) |
|
| 402 | 402 | || in_array('invoicereccard',$TContext) |
| 403 | 403 | ) |
| 404 | - { |
|
| 405 | - $hideInnerLines = isset( $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] ) ? $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] : 0; |
|
| 406 | - $hidedetails = isset( $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] ) ? $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] : 0; |
|
| 404 | + { |
|
| 405 | + $hideInnerLines = isset( $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] ) ? $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] : 0; |
|
| 406 | + $hidedetails = isset( $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] ) ? $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] : 0; |
|
| 407 | 407 | $hidepricesDefaultConf = !empty($conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED)?$conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED:0; |
| 408 | 408 | $hideprices= isset( $_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id] ) ? $_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id] : $hidepricesDefaultConf; |
| 409 | 409 | |
| 410 | 410 | $var=false; |
| 411 | - $out.= '<tr '.$bc[$var].'> |
|
| 411 | + $out.= '<tr '.$bc[$var].'> |
|
| 412 | 412 | <td colspan="4" align="right"> |
| 413 | 413 | <label for="hideInnerLines">'.$langs->trans('HideInnerLines').'</label> |
| 414 | 414 | <input type="checkbox" onclick="if($(this).is(\':checked\')) { $(\'#hidedetails\').prop(\'checked\', \'checked\') }" id="hideInnerLines" name="hideInnerLines" value="1" '.(( $hideInnerLines ) ? 'checked="checked"' : '' ).' /> |
| 415 | 415 | </td> |
| 416 | 416 | </tr>'; |
| 417 | 417 | |
| 418 | - $var=!$var; |
|
| 419 | - $out.= '<tr '.$bc[$var].'> |
|
| 418 | + $var=!$var; |
|
| 419 | + $out.= '<tr '.$bc[$var].'> |
|
| 420 | 420 | <td colspan="4" align="right"> |
| 421 | 421 | <label for="hidedetails">'.$langs->trans('SubTotalhidedetails').'</label> |
| 422 | 422 | <input type="checkbox" id="hidedetails" name="hidedetails" value="1" '.(( $hidedetails ) ? 'checked="checked"' : '' ).' /> |
| 423 | 423 | </td> |
| 424 | 424 | </tr>'; |
| 425 | 425 | |
| 426 | - $var=!$var; |
|
| 427 | - $out.= '<tr '.$bc[$var].'> |
|
| 426 | + $var=!$var; |
|
| 427 | + $out.= '<tr '.$bc[$var].'> |
|
| 428 | 428 | <td colspan="4" align="right"> |
| 429 | 429 | <label for="hideprices">'.$langs->trans('SubTotalhidePrice').'</label> |
| 430 | 430 | <input type="checkbox" id="hideprices" name="hideprices" value="1" '.(( $hideprices ) ? 'checked="checked"' : '' ).' /> |
@@ -436,9 +436,9 @@ discard block |
||
| 436 | 436 | if ( |
| 437 | 437 | (in_array('propalcard',$TContext) && !empty($conf->global->SUBTOTAL_PROPAL_ADD_RECAP)) |
| 438 | 438 | || (in_array('ordercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
| 439 | - || (in_array('ordersuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
| 439 | + || (in_array('ordersuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
| 440 | 440 | || (in_array('invoicecard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
| 441 | - || (in_array('invoicesuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
| 441 | + || (in_array('invoicesuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
| 442 | 442 | || (in_array('invoicereccard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP )) |
| 443 | 443 | ) |
| 444 | 444 | { |
@@ -457,19 +457,19 @@ discard block |
||
| 457 | 457 | } |
| 458 | 458 | |
| 459 | 459 | |
| 460 | - return 1; |
|
| 460 | + return 1; |
|
| 461 | 461 | } |
| 462 | 462 | |
| 463 | - function formEditProductOptions($parameters, &$object, &$action, $hookmanager) |
|
| 464 | - { |
|
| 463 | + function formEditProductOptions($parameters, &$object, &$action, $hookmanager) |
|
| 464 | + { |
|
| 465 | 465 | |
| 466 | - if (in_array('invoicecard',explode(':',$parameters['context']))) |
|
| 467 | - { |
|
| 466 | + if (in_array('invoicecard',explode(':',$parameters['context']))) |
|
| 467 | + { |
|
| 468 | 468 | |
| 469 | - } |
|
| 469 | + } |
|
| 470 | 470 | |
| 471 | - return 0; |
|
| 472 | - } |
|
| 471 | + return 0; |
|
| 472 | + } |
|
| 473 | 473 | |
| 474 | 474 | function ODTSubstitutionLine(&$parameters, &$object, $action, $hookmanager) { |
| 475 | 475 | global $conf; |
@@ -518,11 +518,11 @@ discard block |
||
| 518 | 518 | |
| 519 | 519 | if ( |
| 520 | 520 | in_array('invoicecard',explode(':',$parameters['context'])) |
| 521 | - || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
| 521 | + || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
| 522 | 522 | || in_array('propalcard',explode(':',$parameters['context'])) |
| 523 | - || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
| 523 | + || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
| 524 | 524 | || in_array('ordercard',explode(':',$parameters['context'])) |
| 525 | - || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
| 525 | + || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
| 526 | 526 | || in_array('invoicereccard',explode(':',$parameters['context'])) |
| 527 | 527 | ) { |
| 528 | 528 | |
@@ -601,20 +601,20 @@ discard block |
||
| 601 | 601 | in_array('invoicecard',explode(':',$parameters['context'])) |
| 602 | 602 | || in_array('propalcard',explode(':',$parameters['context'])) |
| 603 | 603 | || in_array('ordercard',explode(':',$parameters['context'])) |
| 604 | - || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
| 605 | - || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
| 606 | - || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
| 604 | + || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
| 605 | + || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
| 606 | + || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
| 607 | 607 | ) |
| 608 | - { |
|
| 608 | + { |
|
| 609 | 609 | if(in_array('invoicecard',explode(':',$parameters['context']))) { |
| 610 | 610 | $sessname = 'subtotal_hideInnerLines_facture'; |
| 611 | 611 | $sessname2 = 'subtotal_hidedetails_facture'; |
| 612 | 612 | $sessname3 = 'subtotal_hideprices_facture'; |
| 613 | 613 | } |
| 614 | 614 | elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) { |
| 615 | - $sessname = 'subtotal_hideInnerLines_facture_fournisseur'; |
|
| 616 | - $sessname2 = 'subtotal_hidedetails_facture_fournisseur'; |
|
| 617 | - $sessname3 = 'subtotal_hideprices_facture_fournisseur'; |
|
| 615 | + $sessname = 'subtotal_hideInnerLines_facture_fournisseur'; |
|
| 616 | + $sessname2 = 'subtotal_hidedetails_facture_fournisseur'; |
|
| 617 | + $sessname3 = 'subtotal_hideprices_facture_fournisseur'; |
|
| 618 | 618 | } |
| 619 | 619 | elseif(in_array('propalcard',explode(':',$parameters['context']))) { |
| 620 | 620 | $sessname = 'subtotal_hideInnerLines_propal'; |
@@ -622,9 +622,9 @@ discard block |
||
| 622 | 622 | $sessname3 = 'subtotal_hideprices_propal'; |
| 623 | 623 | } |
| 624 | 624 | elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) { |
| 625 | - $sessname = 'subtotal_hideInnerLines_supplier_proposal'; |
|
| 626 | - $sessname2 = 'subtotal_hidedetails_supplier_proposal'; |
|
| 627 | - $sessname3 = 'subtotal_hideprices_supplier_proposal'; |
|
| 625 | + $sessname = 'subtotal_hideInnerLines_supplier_proposal'; |
|
| 626 | + $sessname2 = 'subtotal_hidedetails_supplier_proposal'; |
|
| 627 | + $sessname3 = 'subtotal_hideprices_supplier_proposal'; |
|
| 628 | 628 | } |
| 629 | 629 | elseif(in_array('ordercard',explode(':',$parameters['context']))) { |
| 630 | 630 | $sessname = 'subtotal_hideInnerLines_commande'; |
@@ -632,9 +632,9 @@ discard block |
||
| 632 | 632 | $sessname3 = 'subtotal_hideprices_commande'; |
| 633 | 633 | } |
| 634 | 634 | elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) { |
| 635 | - $sessname = 'subtotal_hideInnerLines_commande_fournisseur'; |
|
| 636 | - $sessname2 = 'subtotal_hidedetails_commande_fournisseur'; |
|
| 637 | - $sessname3 = 'subtotal_hideprices_commande_fournisseur'; |
|
| 635 | + $sessname = 'subtotal_hideInnerLines_commande_fournisseur'; |
|
| 636 | + $sessname2 = 'subtotal_hidedetails_commande_fournisseur'; |
|
| 637 | + $sessname3 = 'subtotal_hideprices_commande_fournisseur'; |
|
| 638 | 638 | } |
| 639 | 639 | else { |
| 640 | 640 | $sessname = 'subtotal_hideInnerLines_unknown'; |
@@ -659,17 +659,17 @@ discard block |
||
| 659 | 659 | foreach($object->lines as &$line) { |
| 660 | 660 | if ($line->product_type == 9 && $line->special_code == $this->module_number) { |
| 661 | 661 | |
| 662 | - if($line->qty>=90) { |
|
| 663 | - $line->modsubtotal_total = 1; |
|
| 664 | - } |
|
| 665 | - else{ |
|
| 666 | - $line->modsubtotal_title = 1; |
|
| 667 | - } |
|
| 662 | + if($line->qty>=90) { |
|
| 663 | + $line->modsubtotal_total = 1; |
|
| 664 | + } |
|
| 665 | + else{ |
|
| 666 | + $line->modsubtotal_title = 1; |
|
| 667 | + } |
|
| 668 | 668 | |
| 669 | 669 | $line->total_ht = $this->getTotalLineFromObject($object, $line, ''); |
| 670 | 670 | } |
| 671 | - } |
|
| 672 | - } |
|
| 671 | + } |
|
| 672 | + } |
|
| 673 | 673 | |
| 674 | 674 | } |
| 675 | 675 | else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') { |
@@ -686,7 +686,7 @@ discard block |
||
| 686 | 686 | */ |
| 687 | 687 | else if($object->element=='invoice_supplier') |
| 688 | 688 | { |
| 689 | - $object->deleteline($idLine); |
|
| 689 | + $object->deleteline($idLine); |
|
| 690 | 690 | } |
| 691 | 691 | /** |
| 692 | 692 | * @var $object Propal |
@@ -709,7 +709,7 @@ discard block |
||
| 709 | 709 | */ |
| 710 | 710 | else if($object->element=='order_supplier') |
| 711 | 711 | { |
| 712 | - $object->deleteline($idLine); |
|
| 712 | + $object->deleteline($idLine); |
|
| 713 | 713 | } |
| 714 | 714 | /** |
| 715 | 715 | * @var $object Facturerec |
@@ -780,7 +780,7 @@ discard block |
||
| 780 | 780 | |
| 781 | 781 | foreach($object->lines as $l) { |
| 782 | 782 | |
| 783 | - $lid = (!empty($l->rowid) ? $l->rowid : $l->id); |
|
| 783 | + $lid = (!empty($l->rowid) ? $l->rowid : $l->id); |
|
| 784 | 784 | if($lid == $lineid) { |
| 785 | 785 | |
| 786 | 786 | $found = true; |
@@ -789,7 +789,7 @@ discard block |
||
| 789 | 789 | |
| 790 | 790 | if($found) { |
| 791 | 791 | |
| 792 | - $Tab[] = (!empty($l->rowid) ? $l->rowid : $l->id); |
|
| 792 | + $Tab[] = (!empty($l->rowid) ? $l->rowid : $l->id); |
|
| 793 | 793 | |
| 794 | 794 | if($l->special_code==$this->module_number && (($l->qty==99 && $qty_line==1) || ($l->qty==98 && $qty_line==2)) ) { |
| 795 | 795 | break; // end of story |
@@ -916,7 +916,7 @@ discard block |
||
| 916 | 916 | if(method_exists('Closure','bind')) { |
| 917 | 917 | $pageBreakOriginalValue = $pdf->AcceptPageBreak(); |
| 918 | 918 | $sweetsThief = function ($pdf) { |
| 919 | - return $pdf->bMargin ; |
|
| 919 | + return $pdf->bMargin ; |
|
| 920 | 920 | }; |
| 921 | 921 | $sweetsThief = Closure::bind($sweetsThief, null, $pdf); |
| 922 | 922 | |
@@ -984,7 +984,7 @@ discard block |
||
| 984 | 984 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
| 985 | 985 | $total_to_print = price($total); |
| 986 | 986 | |
| 987 | - $line->total_ht = $total; |
|
| 987 | + $line->total_ht = $total; |
|
| 988 | 988 | $line->total = $total; |
| 989 | 989 | $line->total_tva = $total_tva; |
| 990 | 990 | $line->total_ttc = $total_ttc; |
@@ -1133,7 +1133,7 @@ discard block |
||
| 1133 | 1133 | } |
| 1134 | 1134 | |
| 1135 | 1135 | function pdf_getlinetotalexcltax($parameters=array(), &$object, &$action='') { |
| 1136 | - global $conf, $hideprices, $hookmanager; |
|
| 1136 | + global $conf, $hideprices, $hookmanager; |
|
| 1137 | 1137 | |
| 1138 | 1138 | if(is_array($parameters)) $i = & $parameters['i']; |
| 1139 | 1139 | else $i = (int)$parameters; |
@@ -1172,7 +1172,7 @@ discard block |
||
| 1172 | 1172 | } |
| 1173 | 1173 | } |
| 1174 | 1174 | if ((int)GETPOST('hideInnerLines') && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)){ |
| 1175 | - $this->resprints = price($object->lines[$i]->total_ht); |
|
| 1175 | + $this->resprints = price($object->lines[$i]->total_ht); |
|
| 1176 | 1176 | } |
| 1177 | 1177 | |
| 1178 | 1178 | // Si la gestion C/NC est active et que je suis sur un ligne dont l'extrafield est coché |
@@ -1301,7 +1301,7 @@ discard block |
||
| 1301 | 1301 | } |
| 1302 | 1302 | |
| 1303 | 1303 | function pdf_getlineupexcltax($parameters=array(), &$object, &$action='') { |
| 1304 | - global $conf,$hideprices,$hookmanager; |
|
| 1304 | + global $conf,$hideprices,$hookmanager; |
|
| 1305 | 1305 | |
| 1306 | 1306 | if(is_array($parameters)) $i = & $parameters['i']; |
| 1307 | 1307 | else $i = (int)$parameters; |
@@ -1309,18 +1309,18 @@ discard block |
||
| 1309 | 1309 | if($this->isModSubtotalLine($parameters,$object) ) { |
| 1310 | 1310 | $this->resprints = ' '; |
| 1311 | 1311 | |
| 1312 | - $line = $object->lines[$i]; |
|
| 1312 | + $line = $object->lines[$i]; |
|
| 1313 | 1313 | |
| 1314 | - // On récupère les montants du bloc pour les afficher dans la ligne de sous-total |
|
| 1315 | - if(TSubtotal::isSubtotal($line)) { |
|
| 1316 | - $parentTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
| 1314 | + // On récupère les montants du bloc pour les afficher dans la ligne de sous-total |
|
| 1315 | + if(TSubtotal::isSubtotal($line)) { |
|
| 1316 | + $parentTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
| 1317 | 1317 | |
| 1318 | - if(is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
| 1319 | - if(! empty($parentTitle->array_options['options_show_total_ht'])) { |
|
| 1320 | - $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle); |
|
| 1321 | - $this->resprints = price($TTotal['total_subprice']); |
|
| 1322 | - } |
|
| 1323 | - } |
|
| 1318 | + if(is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
| 1319 | + if(! empty($parentTitle->array_options['options_show_total_ht'])) { |
|
| 1320 | + $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle); |
|
| 1321 | + $this->resprints = price($TTotal['total_subprice']); |
|
| 1322 | + } |
|
| 1323 | + } |
|
| 1324 | 1324 | |
| 1325 | 1325 | if((float)DOL_VERSION<=3.6) { |
| 1326 | 1326 | return ''; |
@@ -1336,58 +1336,58 @@ discard block |
||
| 1336 | 1336 | (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) |
| 1337 | 1337 | ) |
| 1338 | 1338 | { |
| 1339 | - // alors je dois vérifier si la méthode fait partie de la conf qui l'exclue |
|
| 1340 | - if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
| 1341 | - { |
|
| 1342 | - $this->resprints = ' '; |
|
| 1339 | + // alors je dois vérifier si la méthode fait partie de la conf qui l'exclue |
|
| 1340 | + if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
| 1341 | + { |
|
| 1342 | + $this->resprints = ' '; |
|
| 1343 | 1343 | |
| 1344 | - // currentcontext à modifier celon l'appel |
|
| 1345 | - $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i); |
|
| 1346 | - 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) |
|
| 1344 | + // currentcontext à modifier celon l'appel |
|
| 1345 | + $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i); |
|
| 1346 | + 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) |
|
| 1347 | 1347 | |
| 1348 | - } |
|
| 1348 | + } |
|
| 1349 | 1349 | } |
| 1350 | 1350 | // Cache le prix pour les lignes standards dolibarr qui sont dans un ensemble |
| 1351 | 1351 | else if (!empty($hideprices)) |
| 1352 | 1352 | { |
| 1353 | 1353 | |
| 1354 | - // Check if a title exist for this line && if the title have subtotal |
|
| 1355 | - $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
| 1356 | - if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
| 1357 | - { |
|
| 1354 | + // Check if a title exist for this line && if the title have subtotal |
|
| 1355 | + $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
| 1356 | + if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
| 1357 | + { |
|
| 1358 | 1358 | |
| 1359 | - $this->resprints = ' '; |
|
| 1359 | + $this->resprints = ' '; |
|
| 1360 | 1360 | |
| 1361 | - // currentcontext à modifier celon l'appel |
|
| 1362 | - $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hideprices', 'i' => $i); |
|
| 1363 | - 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) |
|
| 1364 | - } |
|
| 1361 | + // currentcontext à modifier celon l'appel |
|
| 1362 | + $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hideprices', 'i' => $i); |
|
| 1363 | + 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) |
|
| 1364 | + } |
|
| 1365 | 1365 | } |
| 1366 | 1366 | |
| 1367 | 1367 | return 0; |
| 1368 | 1368 | } |
| 1369 | 1369 | |
| 1370 | 1370 | function pdf_getlineremisepercent($parameters=array(), &$object, &$action='') { |
| 1371 | - global $conf,$hideprices,$hookmanager; |
|
| 1371 | + global $conf,$hideprices,$hookmanager; |
|
| 1372 | 1372 | |
| 1373 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1374 | - else $i = (int) $parameters; |
|
| 1373 | + if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1374 | + else $i = (int) $parameters; |
|
| 1375 | 1375 | |
| 1376 | 1376 | if($this->isModSubtotalLine($parameters,$object) ) { |
| 1377 | 1377 | $this->resprints = ' '; |
| 1378 | 1378 | |
| 1379 | - $line = $object->lines[$i]; |
|
| 1379 | + $line = $object->lines[$i]; |
|
| 1380 | 1380 | |
| 1381 | - // Affichage de la remise |
|
| 1382 | - if(TSubtotal::isSubtotal($line)) { |
|
| 1383 | - $parentTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
| 1381 | + // Affichage de la remise |
|
| 1382 | + if(TSubtotal::isSubtotal($line)) { |
|
| 1383 | + $parentTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
| 1384 | 1384 | |
| 1385 | - if(empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
| 1386 | - if(! empty($parentTitle->array_options['options_show_reduc'])) { |
|
| 1387 | - $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle); |
|
| 1388 | - $this->resprints = price((1-$TTotal['total_ht'] / $TTotal['total_subprice'])*100, 0, '', 1, 2, 2).'%'; |
|
| 1389 | - } |
|
| 1390 | - } |
|
| 1385 | + if(empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
| 1386 | + if(! empty($parentTitle->array_options['options_show_reduc'])) { |
|
| 1387 | + $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle); |
|
| 1388 | + $this->resprints = price((1-$TTotal['total_ht'] / $TTotal['total_subprice'])*100, 0, '', 1, 2, 2).'%'; |
|
| 1389 | + } |
|
| 1390 | + } |
|
| 1391 | 1391 | |
| 1392 | 1392 | if((float)DOL_VERSION<=3.6) { |
| 1393 | 1393 | return ''; |
@@ -1397,15 +1397,15 @@ discard block |
||
| 1397 | 1397 | } |
| 1398 | 1398 | } |
| 1399 | 1399 | elseif (!empty($hideprices) |
| 1400 | - || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
| 1401 | - ) |
|
| 1402 | - { |
|
| 1403 | - if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
| 1404 | - { |
|
| 1405 | - $this->resprints = ' '; |
|
| 1406 | - return 1; |
|
| 1407 | - } |
|
| 1408 | - } |
|
| 1400 | + || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
| 1401 | + ) |
|
| 1402 | + { |
|
| 1403 | + if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
| 1404 | + { |
|
| 1405 | + $this->resprints = ' '; |
|
| 1406 | + return 1; |
|
| 1407 | + } |
|
| 1408 | + } |
|
| 1409 | 1409 | |
| 1410 | 1410 | return 0; |
| 1411 | 1411 | } |
@@ -1441,7 +1441,7 @@ discard block |
||
| 1441 | 1441 | } |
| 1442 | 1442 | |
| 1443 | 1443 | function pdf_getlinevatrate($parameters=array(), &$object, &$action='') { |
| 1444 | - global $conf,$hideprices,$hookmanager; |
|
| 1444 | + global $conf,$hideprices,$hookmanager; |
|
| 1445 | 1445 | |
| 1446 | 1446 | if($this->isModSubtotalLine($parameters,$object) ){ |
| 1447 | 1447 | $this->resprints = ' '; |
@@ -1466,31 +1466,31 @@ discard block |
||
| 1466 | 1466 | (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) |
| 1467 | 1467 | ) |
| 1468 | 1468 | { |
| 1469 | - // alors je dois vérifier si la méthode fait partie de la conf qui l'exclue |
|
| 1470 | - if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
| 1471 | - { |
|
| 1472 | - $this->resprints = ' '; |
|
| 1469 | + // alors je dois vérifier si la méthode fait partie de la conf qui l'exclue |
|
| 1470 | + if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
| 1471 | + { |
|
| 1472 | + $this->resprints = ' '; |
|
| 1473 | 1473 | |
| 1474 | - // currentcontext à modifier celon l'appel |
|
| 1475 | - $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i); |
|
| 1476 | - 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) |
|
| 1477 | - } |
|
| 1474 | + // currentcontext à modifier celon l'appel |
|
| 1475 | + $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i); |
|
| 1476 | + 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) |
|
| 1477 | + } |
|
| 1478 | 1478 | } |
| 1479 | 1479 | // Cache le prix pour les lignes standards dolibarr qui sont dans un ensemble |
| 1480 | 1480 | else if (!empty($hideprices)) |
| 1481 | 1481 | { |
| 1482 | 1482 | |
| 1483 | - // Check if a title exist for this line && if the title have subtotal |
|
| 1484 | - $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
| 1485 | - if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
| 1486 | - { |
|
| 1483 | + // Check if a title exist for this line && if the title have subtotal |
|
| 1484 | + $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
| 1485 | + if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
| 1486 | + { |
|
| 1487 | 1487 | |
| 1488 | - $this->resprints = ' '; |
|
| 1488 | + $this->resprints = ' '; |
|
| 1489 | 1489 | |
| 1490 | - // currentcontext à modifier celon l'appel |
|
| 1491 | - $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hideprices', 'i' => $i); |
|
| 1492 | - 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) |
|
| 1493 | - } |
|
| 1490 | + // currentcontext à modifier celon l'appel |
|
| 1491 | + $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hideprices', 'i' => $i); |
|
| 1492 | + 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) |
|
| 1493 | + } |
|
| 1494 | 1494 | } |
| 1495 | 1495 | |
| 1496 | 1496 | return 0; |
@@ -1614,25 +1614,25 @@ discard block |
||
| 1614 | 1614 | |
| 1615 | 1615 | $this->add_numerotation($object); |
| 1616 | 1616 | |
| 1617 | - foreach($object->lines as $k => &$l) { |
|
| 1618 | - if(TSubtotal::isSubtotal($l)) { |
|
| 1619 | - $parentTitle = TSubtotal::getParentTitleOfLine($object, $k); |
|
| 1620 | - if(is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
| 1621 | - if(! empty($parentTitle->id) && ! empty($parentTitle->array_options['options_show_total_ht'])) { |
|
| 1622 | - $l->remise_percent = 100; // Affichage de la réduction sur la ligne de sous-total |
|
| 1623 | - } |
|
| 1624 | - } |
|
| 1625 | - } |
|
| 1617 | + foreach($object->lines as $k => &$l) { |
|
| 1618 | + if(TSubtotal::isSubtotal($l)) { |
|
| 1619 | + $parentTitle = TSubtotal::getParentTitleOfLine($object, $k); |
|
| 1620 | + if(is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
| 1621 | + if(! empty($parentTitle->id) && ! empty($parentTitle->array_options['options_show_total_ht'])) { |
|
| 1622 | + $l->remise_percent = 100; // Affichage de la réduction sur la ligne de sous-total |
|
| 1623 | + } |
|
| 1624 | + } |
|
| 1625 | + } |
|
| 1626 | 1626 | |
| 1627 | 1627 | $hideInnerLines = (int)GETPOST('hideInnerLines'); |
| 1628 | 1628 | $hidedetails = (int)GETPOST('hidedetails'); |
| 1629 | 1629 | |
| 1630 | 1630 | if ($hideInnerLines) { // si c une ligne de titre |
| 1631 | - $fk_parent_line=0; |
|
| 1631 | + $fk_parent_line=0; |
|
| 1632 | 1632 | $TLines =array(); |
| 1633 | 1633 | |
| 1634 | 1634 | $original_count=count($object->lines); |
| 1635 | - $TTvas = array(); // tableau de tva |
|
| 1635 | + $TTvas = array(); // tableau de tva |
|
| 1636 | 1636 | |
| 1637 | 1637 | foreach($object->lines as $k=>&$line) |
| 1638 | 1638 | { |
@@ -1671,48 +1671,48 @@ discard block |
||
| 1671 | 1671 | |
| 1672 | 1672 | if ($hideInnerLines) |
| 1673 | 1673 | { |
| 1674 | - if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
| 1675 | - { |
|
| 1676 | - if($line->tva_tx != '0.000' && $line->product_type!=9){ |
|
| 1674 | + if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
| 1675 | + { |
|
| 1676 | + if($line->tva_tx != '0.000' && $line->product_type!=9){ |
|
| 1677 | 1677 | |
| 1678 | - // on remplit le tableau de tva pour substituer les lignes cachées |
|
| 1679 | - $TTvas[$line->tva_tx]['total_tva'] += $line->total_tva; |
|
| 1680 | - $TTvas[$line->tva_tx]['total_ht'] += $line->total_ht; |
|
| 1681 | - $TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; |
|
| 1682 | - } |
|
| 1683 | - if($line->product_type==9 && $line->rowid>0) |
|
| 1684 | - { |
|
| 1685 | - //Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres |
|
| 1686 | - // génère des lignes d'affichage des montants HT soumis à tva |
|
| 1687 | - $nbtva = count($TTvas); |
|
| 1688 | - if(!empty($nbtva)){ |
|
| 1689 | - foreach ($TTvas as $tx =>$val){ |
|
| 1690 | - $l = clone $line; |
|
| 1691 | - $l->product_type = 1; |
|
| 1692 | - $l->special_code = ''; |
|
| 1693 | - $l->qty = 1; |
|
| 1694 | - $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx)); |
|
| 1695 | - $l->tva_tx = $tx; |
|
| 1696 | - $l->total_ht = $val['total_ht']; |
|
| 1697 | - $l->total_tva = $val['total_tva']; |
|
| 1698 | - $l->total = $line->total_ht; |
|
| 1699 | - $l->total_ttc = $val['total_ttc']; |
|
| 1700 | - $TLines[] = $l; |
|
| 1701 | - array_shift($TTvas); |
|
| 1702 | - } |
|
| 1703 | - } |
|
| 1678 | + // on remplit le tableau de tva pour substituer les lignes cachées |
|
| 1679 | + $TTvas[$line->tva_tx]['total_tva'] += $line->total_tva; |
|
| 1680 | + $TTvas[$line->tva_tx]['total_ht'] += $line->total_ht; |
|
| 1681 | + $TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; |
|
| 1682 | + } |
|
| 1683 | + if($line->product_type==9 && $line->rowid>0) |
|
| 1684 | + { |
|
| 1685 | + //Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres |
|
| 1686 | + // génère des lignes d'affichage des montants HT soumis à tva |
|
| 1687 | + $nbtva = count($TTvas); |
|
| 1688 | + if(!empty($nbtva)){ |
|
| 1689 | + foreach ($TTvas as $tx =>$val){ |
|
| 1690 | + $l = clone $line; |
|
| 1691 | + $l->product_type = 1; |
|
| 1692 | + $l->special_code = ''; |
|
| 1693 | + $l->qty = 1; |
|
| 1694 | + $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx)); |
|
| 1695 | + $l->tva_tx = $tx; |
|
| 1696 | + $l->total_ht = $val['total_ht']; |
|
| 1697 | + $l->total_tva = $val['total_tva']; |
|
| 1698 | + $l->total = $line->total_ht; |
|
| 1699 | + $l->total_ttc = $val['total_ttc']; |
|
| 1700 | + $TLines[] = $l; |
|
| 1701 | + array_shift($TTvas); |
|
| 1702 | + } |
|
| 1703 | + } |
|
| 1704 | 1704 | |
| 1705 | - // ajoute la ligne de sous-total |
|
| 1706 | - $TLines[] = $line; |
|
| 1707 | - } |
|
| 1708 | - } else { |
|
| 1705 | + // ajoute la ligne de sous-total |
|
| 1706 | + $TLines[] = $line; |
|
| 1707 | + } |
|
| 1708 | + } else { |
|
| 1709 | 1709 | |
| 1710 | - if($line->product_type==9 && $line->rowid>0) |
|
| 1711 | - { |
|
| 1712 | - // ajoute la ligne de sous-total |
|
| 1713 | - $TLines[] = $line; |
|
| 1714 | - } |
|
| 1715 | - } |
|
| 1710 | + if($line->product_type==9 && $line->rowid>0) |
|
| 1711 | + { |
|
| 1712 | + // ajoute la ligne de sous-total |
|
| 1713 | + $TLines[] = $line; |
|
| 1714 | + } |
|
| 1715 | + } |
|
| 1716 | 1716 | |
| 1717 | 1717 | |
| 1718 | 1718 | } |
@@ -1737,20 +1737,20 @@ discard block |
||
| 1737 | 1737 | $nbtva = count($TTvas); |
| 1738 | 1738 | if(!empty($nbtva) && $hideInnerLines && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
| 1739 | 1739 | { |
| 1740 | - foreach ($TTvas as $tx =>$val){ |
|
| 1741 | - $l = clone $line; |
|
| 1742 | - $l->product_type = 1; |
|
| 1743 | - $l->special_code = ''; |
|
| 1744 | - $l->qty = 1; |
|
| 1745 | - $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx)); |
|
| 1746 | - $l->tva_tx = $tx; |
|
| 1747 | - $l->total_ht = $val['total_ht']; |
|
| 1748 | - $l->total_tva = $val['total_tva']; |
|
| 1749 | - $l->total = $line->total_ht; |
|
| 1750 | - $l->total_ttc = $val['total_ttc']; |
|
| 1751 | - $TLines[] = $l; |
|
| 1752 | - array_shift($TTvas); |
|
| 1753 | - } |
|
| 1740 | + foreach ($TTvas as $tx =>$val){ |
|
| 1741 | + $l = clone $line; |
|
| 1742 | + $l->product_type = 1; |
|
| 1743 | + $l->special_code = ''; |
|
| 1744 | + $l->qty = 1; |
|
| 1745 | + $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx)); |
|
| 1746 | + $l->tva_tx = $tx; |
|
| 1747 | + $l->total_ht = $val['total_ht']; |
|
| 1748 | + $l->total_tva = $val['total_tva']; |
|
| 1749 | + $l->total = $line->total_ht; |
|
| 1750 | + $l->total_ttc = $val['total_ttc']; |
|
| 1751 | + $TLines[] = $l; |
|
| 1752 | + array_shift($TTvas); |
|
| 1753 | + } |
|
| 1754 | 1754 | } |
| 1755 | 1755 | |
| 1756 | 1756 | global $nblignes; |
@@ -1762,7 +1762,7 @@ discard block |
||
| 1762 | 1762 | $this->resprints = ''; |
| 1763 | 1763 | return 0; |
| 1764 | 1764 | } |
| 1765 | - } |
|
| 1765 | + } |
|
| 1766 | 1766 | |
| 1767 | 1767 | return 0; |
| 1768 | 1768 | } |
@@ -1925,34 +1925,34 @@ discard block |
||
| 1925 | 1925 | } |
| 1926 | 1926 | elseif($object->element == 'order_supplier' ) |
| 1927 | 1927 | { |
| 1928 | - $createRight = $user->rights->fournisseur->commande->creer; |
|
| 1928 | + $createRight = $user->rights->fournisseur->commande->creer; |
|
| 1929 | 1929 | } |
| 1930 | 1930 | elseif($object->element == 'invoice_supplier' ) |
| 1931 | 1931 | { |
| 1932 | - $createRight = $user->rights->fournisseur->facture->creer; |
|
| 1932 | + $createRight = $user->rights->fournisseur->facture->creer; |
|
| 1933 | 1933 | } |
| 1934 | - if($object->element=='facture')$idvar = 'facid'; |
|
| 1935 | - else $idvar='id'; |
|
| 1934 | + if($object->element=='facture')$idvar = 'facid'; |
|
| 1935 | + else $idvar='id'; |
|
| 1936 | 1936 | if($line->special_code!=$this->module_number || $line->product_type!=9) { |
| 1937 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) && $object->element !== 'invoice_supplier') |
|
| 1938 | - { |
|
| 1939 | - if(!(TSubtotal::isModSubtotalLine($line)) && ( $line->fk_prev_id === null ) && !($action == "editline" && GETPOST('lineid') == $line->id)) { |
|
| 1940 | - echo '<a name="duplicate-'.$line->id.'" href="' . $_SERVER['PHP_SELF'] . '?' . $idvar . '=' . $object->id . '&action=duplicate&lineid=' . $line->id . '">' . img_picto($langs->trans('Duplicate'), 'duplicate@subtotal') . '</a>'; |
|
| 1937 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) && $object->element !== 'invoice_supplier') |
|
| 1938 | + { |
|
| 1939 | + if(!(TSubtotal::isModSubtotalLine($line)) && ( $line->fk_prev_id === null ) && !($action == "editline" && GETPOST('lineid') == $line->id)) { |
|
| 1940 | + echo '<a name="duplicate-'.$line->id.'" href="' . $_SERVER['PHP_SELF'] . '?' . $idvar . '=' . $object->id . '&action=duplicate&lineid=' . $line->id . '">' . img_picto($langs->trans('Duplicate'), 'duplicate@subtotal') . '</a>'; |
|
| 1941 | 1941 | |
| 1942 | - ?> |
|
| 1942 | + ?> |
|
| 1943 | 1943 | <script type="text/javascript"> |
| 1944 | 1944 | $(document).ready(function() { |
| 1945 | 1945 | $("a[name='duplicate-<?php echo $line->id; ?>']").prependTo($('#row-<?php echo $line->id; ?>').find('.linecoledit')); |
| 1946 | 1946 | }); |
| 1947 | 1947 | </script> |
| 1948 | 1948 | <?php |
| 1949 | - } |
|
| 1949 | + } |
|
| 1950 | 1950 | |
| 1951 | - } |
|
| 1951 | + } |
|
| 1952 | 1952 | return 0; |
| 1953 | 1953 | } |
| 1954 | 1954 | 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)) |
| 1955 | - { |
|
| 1955 | + { |
|
| 1956 | 1956 | |
| 1957 | 1957 | |
| 1958 | 1958 | if((float)DOL_VERSION <= 3.4) |
@@ -2000,7 +2000,7 @@ discard block |
||
| 2000 | 2000 | //var_dump($line); |
| 2001 | 2001 | |
| 2002 | 2002 | // HTML 5 data for js |
| 2003 | - $data = $this->_getHtmlData($parameters, $object, $action, $hookmanager); |
|
| 2003 | + $data = $this->_getHtmlData($parameters, $object, $action, $hookmanager); |
|
| 2004 | 2004 | |
| 2005 | 2005 | |
| 2006 | 2006 | ?> |
@@ -2062,8 +2062,8 @@ discard block |
||
| 2062 | 2062 | } |
| 2063 | 2063 | |
| 2064 | 2064 | if ($object->element == 'order_supplier' || $object->element == 'invoice_supplier') { |
| 2065 | - $line->label = !empty($line->description) ? $line->description : $line->desc; |
|
| 2066 | - $line->description = ''; |
|
| 2065 | + $line->label = !empty($line->description) ? $line->description : $line->desc; |
|
| 2066 | + $line->description = ''; |
|
| 2067 | 2067 | } |
| 2068 | 2068 | $newlabel = $line->label; |
| 2069 | 2069 | if($line->label=='' && !$isFreeText) { |
@@ -2097,38 +2097,38 @@ discard block |
||
| 2097 | 2097 | |
| 2098 | 2098 | |
| 2099 | 2099 | echo '<div class="subtotal_underline" style="margin-left:24px; line-height: 25px;">'; |
| 2100 | - echo '<div>'; |
|
| 2101 | - echo '<input style="vertical-align:sub;" type="checkbox" name="line-pagebreak" id="subtotal-pagebreak" value="8" '.(($line->info_bits > 0) ? 'checked="checked"' : '') .' /> '; |
|
| 2102 | - echo '<label for="subtotal-pagebreak">'.$langs->trans('AddBreakPageBefore').'</label>'; |
|
| 2103 | - echo '</div>'; |
|
| 2104 | - |
|
| 2105 | - if (TSubtotal::isTitle($line)) |
|
| 2106 | - { |
|
| 2107 | - $form = new Form($db); |
|
| 2108 | - echo '<div>'; |
|
| 2109 | - echo '<label for="subtotal_tva_tx">'.$form->textwithpicto($langs->trans('subtotal_apply_default_tva'), $langs->trans('subtotal_apply_default_tva_help')).'</label>'; |
|
| 2110 | - echo '<select id="subtotal_tva_tx" name="subtotal_tva_tx" class="flat"><option selected="selected" value="">-</option>'; |
|
| 2111 | - if (empty($readonlyForSituation)) echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true)); |
|
| 2112 | - echo '</select>'; |
|
| 2113 | - echo '</div>'; |
|
| 2114 | - |
|
| 2115 | - if (!empty($conf->global->INVOICE_USE_SITUATION) && $object->element == 'facture' && $object->type == Facture::TYPE_SITUATION) |
|
| 2116 | - { |
|
| 2117 | - echo '<div>'; |
|
| 2118 | - echo '<label for="subtotal_progress">'.$langs->trans('subtotal_apply_progress').'</label> <input id="subtotal_progress" name="subtotal_progress" value="" size="1" />%'; |
|
| 2119 | - echo '</div>'; |
|
| 2120 | - } |
|
| 2121 | - echo '<div>'; |
|
| 2122 | - echo '<input style="vertical-align:sub;" type="checkbox" name="line-showTotalHT" id="subtotal-showTotalHT" value="9" '.(($line->array_options['options_show_total_ht'] > 0) ? 'checked="checked"' : '') .' /> '; |
|
| 2123 | - echo '<label for="subtotal-showTotalHT">'.$langs->trans('ShowTotalHTOnSubtotalBlock').'</label>'; |
|
| 2124 | - echo '</div>'; |
|
| 2125 | - |
|
| 2126 | - echo '<div>'; |
|
| 2127 | - echo '<input style="vertical-align:sub;" type="checkbox" name="line-showReduc" id="subtotal-showReduc" value="1" '.(($line->array_options['options_show_reduc'] > 0) ? 'checked="checked"' : '') .' /> '; |
|
| 2128 | - echo '<label for="subtotal-showReduc">'.$langs->trans('ShowReducOnSubtotalBlock').'</label>'; |
|
| 2129 | - echo '</div>'; |
|
| 2130 | - } |
|
| 2131 | - else if ($isFreeText) echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation); |
|
| 2100 | + echo '<div>'; |
|
| 2101 | + echo '<input style="vertical-align:sub;" type="checkbox" name="line-pagebreak" id="subtotal-pagebreak" value="8" '.(($line->info_bits > 0) ? 'checked="checked"' : '') .' /> '; |
|
| 2102 | + echo '<label for="subtotal-pagebreak">'.$langs->trans('AddBreakPageBefore').'</label>'; |
|
| 2103 | + echo '</div>'; |
|
| 2104 | + |
|
| 2105 | + if (TSubtotal::isTitle($line)) |
|
| 2106 | + { |
|
| 2107 | + $form = new Form($db); |
|
| 2108 | + echo '<div>'; |
|
| 2109 | + echo '<label for="subtotal_tva_tx">'.$form->textwithpicto($langs->trans('subtotal_apply_default_tva'), $langs->trans('subtotal_apply_default_tva_help')).'</label>'; |
|
| 2110 | + echo '<select id="subtotal_tva_tx" name="subtotal_tva_tx" class="flat"><option selected="selected" value="">-</option>'; |
|
| 2111 | + if (empty($readonlyForSituation)) echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true)); |
|
| 2112 | + echo '</select>'; |
|
| 2113 | + echo '</div>'; |
|
| 2114 | + |
|
| 2115 | + if (!empty($conf->global->INVOICE_USE_SITUATION) && $object->element == 'facture' && $object->type == Facture::TYPE_SITUATION) |
|
| 2116 | + { |
|
| 2117 | + echo '<div>'; |
|
| 2118 | + echo '<label for="subtotal_progress">'.$langs->trans('subtotal_apply_progress').'</label> <input id="subtotal_progress" name="subtotal_progress" value="" size="1" />%'; |
|
| 2119 | + echo '</div>'; |
|
| 2120 | + } |
|
| 2121 | + echo '<div>'; |
|
| 2122 | + echo '<input style="vertical-align:sub;" type="checkbox" name="line-showTotalHT" id="subtotal-showTotalHT" value="9" '.(($line->array_options['options_show_total_ht'] > 0) ? 'checked="checked"' : '') .' /> '; |
|
| 2123 | + echo '<label for="subtotal-showTotalHT">'.$langs->trans('ShowTotalHTOnSubtotalBlock').'</label>'; |
|
| 2124 | + echo '</div>'; |
|
| 2125 | + |
|
| 2126 | + echo '<div>'; |
|
| 2127 | + echo '<input style="vertical-align:sub;" type="checkbox" name="line-showReduc" id="subtotal-showReduc" value="1" '.(($line->array_options['options_show_reduc'] > 0) ? 'checked="checked"' : '') .' /> '; |
|
| 2128 | + echo '<label for="subtotal-showReduc">'.$langs->trans('ShowReducOnSubtotalBlock').'</label>'; |
|
| 2129 | + echo '</div>'; |
|
| 2130 | + } |
|
| 2131 | + else if ($isFreeText) echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation); |
|
| 2132 | 2132 | echo '</div>'; |
| 2133 | 2133 | |
| 2134 | 2134 | if($line->qty<10) { |
@@ -2394,17 +2394,17 @@ discard block |
||
| 2394 | 2394 | if ($object->statut == 0 && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && $action != 'editline') |
| 2395 | 2395 | { |
| 2396 | 2396 | |
| 2397 | - if($object->element == 'invoice_supplier' || $object->element == 'order_supplier') |
|
| 2398 | - { |
|
| 2399 | - foreach ($object->lines as $line) |
|
| 2400 | - { |
|
| 2401 | - // fetch optionals attributes and labels |
|
| 2402 | - require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); |
|
| 2403 | - $extrafields=new ExtraFields($this->db); |
|
| 2404 | - $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true); |
|
| 2405 | - $line->fetch_optionals($line->id,$extralabels); |
|
| 2406 | - } |
|
| 2407 | - } |
|
| 2397 | + if($object->element == 'invoice_supplier' || $object->element == 'order_supplier') |
|
| 2398 | + { |
|
| 2399 | + foreach ($object->lines as $line) |
|
| 2400 | + { |
|
| 2401 | + // fetch optionals attributes and labels |
|
| 2402 | + require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); |
|
| 2403 | + $extrafields=new ExtraFields($this->db); |
|
| 2404 | + $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true); |
|
| 2405 | + $line->fetch_optionals($line->id,$extralabels); |
|
| 2406 | + } |
|
| 2407 | + } |
|
| 2408 | 2408 | |
| 2409 | 2409 | $TSubNc = array(); |
| 2410 | 2410 | foreach ($object->lines as &$l) |
@@ -2495,80 +2495,80 @@ discard block |
||
| 2495 | 2495 | { |
| 2496 | 2496 | dol_include_once('/subtotal/class/subtotal.class.php'); |
| 2497 | 2497 | |
| 2498 | - $line = &$parameters['line']; |
|
| 2498 | + $line = &$parameters['line']; |
|
| 2499 | 2499 | |
| 2500 | - $ThtmlData['data-id'] = $line->id; |
|
| 2501 | - $ThtmlData['data-product_type'] = $line->product_type; |
|
| 2502 | - $ThtmlData['data-qty'] = 0; //$line->qty; |
|
| 2503 | - $ThtmlData['data-level'] = TSubtotal::getNiveau($line); |
|
| 2500 | + $ThtmlData['data-id'] = $line->id; |
|
| 2501 | + $ThtmlData['data-product_type'] = $line->product_type; |
|
| 2502 | + $ThtmlData['data-qty'] = 0; //$line->qty; |
|
| 2503 | + $ThtmlData['data-level'] = TSubtotal::getNiveau($line); |
|
| 2504 | 2504 | |
| 2505 | - if(TSubtotal::isTitle($line)){ |
|
| 2506 | - $ThtmlData['data-issubtotal'] = 'title'; |
|
| 2507 | - }elseif(TSubtotal::isSubtotal($line)){ |
|
| 2508 | - $ThtmlData['data-issubtotal'] = 'subtotal'; |
|
| 2509 | - } |
|
| 2510 | - else{ |
|
| 2511 | - $ThtmlData['data-issubtotal'] = 'freetext'; |
|
| 2512 | - } |
|
| 2505 | + if(TSubtotal::isTitle($line)){ |
|
| 2506 | + $ThtmlData['data-issubtotal'] = 'title'; |
|
| 2507 | + }elseif(TSubtotal::isSubtotal($line)){ |
|
| 2508 | + $ThtmlData['data-issubtotal'] = 'subtotal'; |
|
| 2509 | + } |
|
| 2510 | + else{ |
|
| 2511 | + $ThtmlData['data-issubtotal'] = 'freetext'; |
|
| 2512 | + } |
|
| 2513 | 2513 | |
| 2514 | 2514 | |
| 2515 | - // Change or add data from hooks |
|
| 2516 | - $parameters = array_replace($parameters , array( 'ThtmlData' => $ThtmlData ) ); |
|
| 2515 | + // Change or add data from hooks |
|
| 2516 | + $parameters = array_replace($parameters , array( 'ThtmlData' => $ThtmlData ) ); |
|
| 2517 | 2517 | |
| 2518 | - // hook |
|
| 2519 | - $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
|
| 2520 | - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 2521 | - if ($reshook>0) |
|
| 2522 | - { |
|
| 2523 | - $ThtmlData = $hookmanager->resArray; |
|
| 2524 | - } |
|
| 2525 | - |
|
| 2526 | - return $this->implodeHtmlData($ThtmlData); |
|
| 2518 | + // hook |
|
| 2519 | + $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
|
| 2520 | + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 2521 | + if ($reshook>0) |
|
| 2522 | + { |
|
| 2523 | + $ThtmlData = $hookmanager->resArray; |
|
| 2524 | + } |
|
| 2525 | + |
|
| 2526 | + return $this->implodeHtmlData($ThtmlData); |
|
| 2527 | 2527 | |
| 2528 | 2528 | } |
| 2529 | 2529 | |
| 2530 | 2530 | |
| 2531 | 2531 | function implodeHtmlData($ThtmlData = array()) |
| 2532 | 2532 | { |
| 2533 | - $data = ''; |
|
| 2534 | - foreach($ThtmlData as $k => $h ) |
|
| 2535 | - { |
|
| 2536 | - if(is_array($h)) |
|
| 2537 | - { |
|
| 2538 | - $h = json_encode($h); |
|
| 2539 | - } |
|
| 2533 | + $data = ''; |
|
| 2534 | + foreach($ThtmlData as $k => $h ) |
|
| 2535 | + { |
|
| 2536 | + if(is_array($h)) |
|
| 2537 | + { |
|
| 2538 | + $h = json_encode($h); |
|
| 2539 | + } |
|
| 2540 | 2540 | |
| 2541 | - $data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" '; |
|
| 2542 | - } |
|
| 2541 | + $data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" '; |
|
| 2542 | + } |
|
| 2543 | 2543 | |
| 2544 | - return $data; |
|
| 2544 | + return $data; |
|
| 2545 | 2545 | } |
| 2546 | 2546 | |
| 2547 | 2547 | function _ajax_block_order_js($object) |
| 2548 | 2548 | { |
| 2549 | - global $conf,$tagidfortablednd,$filepath,$langs; |
|
| 2549 | + global $conf,$tagidfortablednd,$filepath,$langs; |
|
| 2550 | 2550 | |
| 2551 | - /* |
|
| 2551 | + /* |
|
| 2552 | 2552 | * this part of js is base on dolibarr htdocs/core/tpl/ajaxrow.tpl.php |
| 2553 | 2553 | * for compatibility reasons we don't use tableDnD but jquery sortable |
| 2554 | 2554 | */ |
| 2555 | 2555 | |
| 2556 | - $id=$object->id; |
|
| 2557 | - $nboflines=(isset($object->lines)?count($object->lines):0); |
|
| 2558 | - $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1; |
|
| 2556 | + $id=$object->id; |
|
| 2557 | + $nboflines=(isset($object->lines)?count($object->lines):0); |
|
| 2558 | + $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1; |
|
| 2559 | 2559 | |
| 2560 | - $id=$object->id; |
|
| 2561 | - $fk_element=$object->fk_element; |
|
| 2562 | - $table_element_line=$object->table_element_line; |
|
| 2563 | - $nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines)); |
|
| 2564 | - $tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd); |
|
| 2565 | - $filepath=(empty($filepath)?'':$filepath); |
|
| 2560 | + $id=$object->id; |
|
| 2561 | + $fk_element=$object->fk_element; |
|
| 2562 | + $table_element_line=$object->table_element_line; |
|
| 2563 | + $nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines)); |
|
| 2564 | + $tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd); |
|
| 2565 | + $filepath=(empty($filepath)?'':$filepath); |
|
| 2566 | 2566 | |
| 2567 | 2567 | |
| 2568 | - if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1) |
|
| 2569 | - { |
|
| 2568 | + if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1) |
|
| 2569 | + { |
|
| 2570 | 2570 | |
| 2571 | - ?> |
|
| 2571 | + ?> |
|
| 2572 | 2572 | |
| 2573 | 2573 | |
| 2574 | 2574 | <script type="text/javascript"> |
@@ -41,9 +41,9 @@ discard block |
||
| 41 | 41 | * @var $object Facture fournisseur |
| 42 | 42 | */ |
| 43 | 43 | else if($object->element=='invoice_supplier') { |
| 44 | - $object->special_code = TSubtotal::$module_number; |
|
| 45 | - $rang = $object->line_max() + 1; |
|
| 46 | - $res = $object->addline($label,0,0,0,0,$qty,0,0,'','',0,0,'HT',9,$rang); |
|
| 44 | + $object->special_code = TSubtotal::$module_number; |
|
| 45 | + $rang = $object->line_max() + 1; |
|
| 46 | + $res = $object->addline($label,0,0,0,0,$qty,0,0,'','',0,0,'HT',9,$rang); |
|
| 47 | 47 | } |
| 48 | 48 | /** |
| 49 | 49 | * @var $object Propal |
@@ -62,8 +62,8 @@ discard block |
||
| 62 | 62 | * @var $object Commande fournisseur |
| 63 | 63 | */ |
| 64 | 64 | else if($object->element=='order_supplier') { |
| 65 | - $object->special_code = TSubtotal::$module_number; |
|
| 66 | - $res = $object->addline($label, 0,$qty,0,0,0,0,0,'',0,'HT', 0, 9); |
|
| 65 | + $object->special_code = TSubtotal::$module_number; |
|
| 66 | + $res = $object->addline($label, 0,$qty,0,0,0,0,0,'',0,'HT', 0, 9); |
|
| 67 | 67 | } |
| 68 | 68 | /** |
| 69 | 69 | * @var $object Facturerec |
@@ -369,10 +369,10 @@ discard block |
||
| 369 | 369 | |
| 370 | 370 | public static function isSubtotal(&$line, $level=-1) |
| 371 | 371 | { |
| 372 | - $res = $line->special_code == self::$module_number && $line->product_type == 9 && $line->qty >= 90; |
|
| 373 | - if($res && $level > -1) { |
|
| 374 | - return self::getNiveau($line) == $level; |
|
| 375 | - } else return $res; |
|
| 372 | + $res = $line->special_code == self::$module_number && $line->product_type == 9 && $line->qty >= 90; |
|
| 373 | + if($res && $level > -1) { |
|
| 374 | + return self::getNiveau($line) == $level; |
|
| 375 | + } else return $res; |
|
| 376 | 376 | } |
| 377 | 377 | |
| 378 | 378 | public static function isFreeText(&$line) |
@@ -409,29 +409,29 @@ discard block |
||
| 409 | 409 | $createRight = $user->rights->{$object->element}->creer; |
| 410 | 410 | if($object->element == 'facturerec' ) |
| 411 | 411 | { |
| 412 | - $object->statut = 0; // hack for facture rec |
|
| 413 | - $createRight = $user->rights->facture->creer; |
|
| 412 | + $object->statut = 0; // hack for facture rec |
|
| 413 | + $createRight = $user->rights->facture->creer; |
|
| 414 | 414 | } |
| 415 | 415 | elseif($object->element == 'order_supplier' ) |
| 416 | 416 | { |
| 417 | - $createRight = $user->rights->fournisseur->commande->creer; |
|
| 417 | + $createRight = $user->rights->fournisseur->commande->creer; |
|
| 418 | 418 | } |
| 419 | 419 | elseif($object->element == 'invoice_supplier' ) |
| 420 | 420 | { |
| 421 | - $createRight = $user->rights->fournisseur->facture->creer; |
|
| 421 | + $createRight = $user->rights->fournisseur->facture->creer; |
|
| 422 | 422 | } |
| 423 | 423 | |
| 424 | 424 | if ($object->statut == 0 && $createRight && (!empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) || !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_LINE))) |
| 425 | 425 | { |
| 426 | 426 | dol_include_once('/subtotal/lib/subtotal.lib.php'); |
| 427 | 427 | |
| 428 | - if(!empty($object->lines)) { |
|
| 429 | - foreach($object->lines as $line) { |
|
| 430 | - if($line->id == $lineid) $duplicateLine = $line; |
|
| 431 | - } |
|
| 432 | - } |
|
| 433 | - if(!empty($duplicateLine) && !self::isModSubtotalLine($duplicateLine)) $TLine = array($duplicateLine); |
|
| 434 | - else $TLine = self::getLinesFromTitleId($object, $lineid, $withBlockLine); |
|
| 428 | + if(!empty($object->lines)) { |
|
| 429 | + foreach($object->lines as $line) { |
|
| 430 | + if($line->id == $lineid) $duplicateLine = $line; |
|
| 431 | + } |
|
| 432 | + } |
|
| 433 | + if(!empty($duplicateLine) && !self::isModSubtotalLine($duplicateLine)) $TLine = array($duplicateLine); |
|
| 434 | + else $TLine = self::getLinesFromTitleId($object, $lineid, $withBlockLine); |
|
| 435 | 435 | |
| 436 | 436 | if (!empty($TLine)) |
| 437 | 437 | { |
@@ -449,8 +449,8 @@ discard block |
||
| 449 | 449 | break; |
| 450 | 450 | |
| 451 | 451 | case 'supplier_proposal': |
| 452 | - $res = $object->addline($line->desc, $line->subprice, $line->qty, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->fk_product, $line->remise_percent, 'HT', 0, $line->info_bits, $line->product_type, -1, $line->special_code, 0, 0, $line->pa_ht, $line->label, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->origin, $line->origin_id); |
|
| 453 | - break; |
|
| 452 | + $res = $object->addline($line->desc, $line->subprice, $line->qty, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->fk_product, $line->remise_percent, 'HT', 0, $line->info_bits, $line->product_type, -1, $line->special_code, 0, 0, $line->pa_ht, $line->label, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->origin, $line->origin_id); |
|
| 453 | + break; |
|
| 454 | 454 | |
| 455 | 455 | case 'commande': |
| 456 | 456 | //$desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $info_bits=0, $fk_remise_except=0, $price_base_type='HT', $pu_ttc=0, $date_start='', $date_end='', $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht=0, $label='',$array_options=0, $fk_unit=null, $origin='', $origin_id=0) |
@@ -458,10 +458,10 @@ discard block |
||
| 458 | 458 | break; |
| 459 | 459 | |
| 460 | 460 | case 'order_supplier': |
| 461 | - $object->line = $line; |
|
| 462 | - $object->line->fk_commande = $object->id; |
|
| 463 | - $object->line->rang = $object->line_max() +1; |
|
| 464 | - $res = $object->line->insert(1); |
|
| 461 | + $object->line = $line; |
|
| 462 | + $object->line->fk_commande = $object->id; |
|
| 463 | + $object->line->rang = $object->line_max() +1; |
|
| 464 | + $res = $object->line->insert(1); |
|
| 465 | 465 | break; |
| 466 | 466 | |
| 467 | 467 | case 'facture': |
@@ -514,8 +514,8 @@ discard block |
||
| 514 | 514 | $object->db->commit(); |
| 515 | 515 | foreach ($TLineAdded as &$line) |
| 516 | 516 | { |
| 517 | - // ça peut paraitre non optimisé de déclancher la fonction sur toutes les lignes mais ceci est nécessaire pour réappliquer l'état exact de chaque ligne |
|
| 518 | - _updateLineNC($object->element, $object->id, $line->id, $line->array_options['options_subtotal_nc']); |
|
| 517 | + // ça peut paraitre non optimisé de déclancher la fonction sur toutes les lignes mais ceci est nécessaire pour réappliquer l'état exact de chaque ligne |
|
| 518 | + _updateLineNC($object->element, $object->id, $line->id, $line->array_options['options_subtotal_nc']); |
|
| 519 | 519 | } |
| 520 | 520 | return count($TLineAdded); |
| 521 | 521 | } |
@@ -589,33 +589,33 @@ discard block |
||
| 589 | 589 | |
| 590 | 590 | switch ($object->element) |
| 591 | 591 | { |
| 592 | - case 'propal': |
|
| 593 | - $res = $object->updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $desc, $price_base_type, $info_bits, $special_code, $fk_parent_line, $skip_update_total, $fk_fournprice, $pa_ht, $label, $type, $date_start, $date_end, $array_options, $fk_unit, 0, $notrigger); |
|
| 594 | - break; |
|
| 592 | + case 'propal': |
|
| 593 | + $res = $object->updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $desc, $price_base_type, $info_bits, $special_code, $fk_parent_line, $skip_update_total, $fk_fournprice, $pa_ht, $label, $type, $date_start, $date_end, $array_options, $fk_unit, 0, $notrigger); |
|
| 594 | + break; |
|
| 595 | 595 | |
| 596 | - case 'supplier_proposal': |
|
| 597 | - $res = $object->updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $desc, $price_base_type, $info_bits, $special_code, $fk_parent_line, $skip_update_total, $fk_fournprice, $pa_ht, $label, $type, $array_options,'', $fk_unit); |
|
| 598 | - break; |
|
| 596 | + case 'supplier_proposal': |
|
| 597 | + $res = $object->updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $desc, $price_base_type, $info_bits, $special_code, $fk_parent_line, $skip_update_total, $fk_fournprice, $pa_ht, $label, $type, $array_options,'', $fk_unit); |
|
| 598 | + break; |
|
| 599 | 599 | |
| 600 | 600 | case 'commande': |
| 601 | 601 | $res = $object->updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $price_base_type, $info_bits, $date_start, $date_end, $type, $fk_parent_line, $skip_update_total, $fk_fournprice, $pa_ht, $label, $special_code, $array_options, $fk_unit, 0, $notrigger); |
| 602 | 602 | break; |
| 603 | 603 | |
| 604 | 604 | case 'order_supplier': |
| 605 | - $object->special_code = SELF::$module_number; |
|
| 606 | - if (empty($desc)) $desc = $label; |
|
| 607 | - $res = $object->updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $price_base_type, $info_bits, $type, 0, $date_start, $date_end, $array_options, $fk_unit); |
|
| 608 | - break; |
|
| 605 | + $object->special_code = SELF::$module_number; |
|
| 606 | + if (empty($desc)) $desc = $label; |
|
| 607 | + $res = $object->updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $price_base_type, $info_bits, $type, 0, $date_start, $date_end, $array_options, $fk_unit); |
|
| 608 | + break; |
|
| 609 | 609 | |
| 610 | 610 | case 'facture': |
| 611 | 611 | $res = $object->updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1, $txlocaltax2, $price_base_type, $info_bits, $type, $fk_parent_line, $skip_update_total, $fk_fournprice, $pa_ht, $label, $special_code, $array_options, $situation_percent, $fk_unit, 0, $notrigger); |
| 612 | 612 | break; |
| 613 | 613 | |
| 614 | 614 | case 'invoice_supplier': |
| 615 | - $object->special_code = SELF::$module_number; |
|
| 616 | - if (empty($desc)) $desc = $label; |
|
| 617 | - $res = $object->updateline($rowid, $desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, 0, $price_base_type, $info_bits, $type, $remise_percent, 0, $date_start, $date_end, $array_options, $fk_unit); |
|
| 618 | - break; |
|
| 615 | + $object->special_code = SELF::$module_number; |
|
| 616 | + if (empty($desc)) $desc = $label; |
|
| 617 | + $res = $object->updateline($rowid, $desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, 0, $price_base_type, $info_bits, $type, $remise_percent, 0, $date_start, $date_end, $array_options, $fk_unit); |
|
| 618 | + break; |
|
| 619 | 619 | |
| 620 | 620 | case 'facturerec': |
| 621 | 621 | // Add extrafields and get rang |
@@ -1006,8 +1006,8 @@ discard block |
||
| 1006 | 1006 | { |
| 1007 | 1007 | if (is_readable($logo)) |
| 1008 | 1008 | { |
| 1009 | - $height=pdf_getHeightForLogo($logo); |
|
| 1010 | - $pdf->Image($logo, $objmarge->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
| 1009 | + $height=pdf_getHeightForLogo($logo); |
|
| 1010 | + $pdf->Image($logo, $objmarge->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
| 1011 | 1011 | } |
| 1012 | 1012 | else |
| 1013 | 1013 | { |
@@ -1198,13 +1198,13 @@ discard block |
||
| 1198 | 1198 | * @param int $hidebottom Hide bottom |
| 1199 | 1199 | * @return void |
| 1200 | 1200 | */ |
| 1201 | - private static function printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0) |
|
| 1202 | - { |
|
| 1203 | - if (empty($hidetop) || $hidetop==-1) $pdf->line($x, $y, $x+$l, $y); |
|
| 1204 | - $pdf->line($x+$l, $y, $x+$l, $y+$h); |
|
| 1205 | - if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h); |
|
| 1206 | - $pdf->line($x, $y+$h, $x, $y); |
|
| 1207 | - } |
|
| 1201 | + private static function printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0) |
|
| 1202 | + { |
|
| 1203 | + if (empty($hidetop) || $hidetop==-1) $pdf->line($x, $y, $x+$l, $y); |
|
| 1204 | + $pdf->line($x+$l, $y, $x+$l, $y+$h); |
|
| 1205 | + if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h); |
|
| 1206 | + $pdf->line($x, $y+$h, $x, $y); |
|
| 1207 | + } |
|
| 1208 | 1208 | |
| 1209 | 1209 | |
| 1210 | 1210 | public static function concat(&$outputlangs, $files, $fileoutput='') |
@@ -1214,14 +1214,14 @@ discard block |
||
| 1214 | 1214 | if (empty($fileoutput)) $fileoutput = $file[0]; |
| 1215 | 1215 | |
| 1216 | 1216 | $pdf=pdf_getInstance(); |
| 1217 | - if (class_exists('TCPDF')) |
|
| 1218 | - { |
|
| 1219 | - $pdf->setPrintHeader(false); |
|
| 1220 | - $pdf->setPrintFooter(false); |
|
| 1221 | - } |
|
| 1222 | - $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
|
| 1217 | + if (class_exists('TCPDF')) |
|
| 1218 | + { |
|
| 1219 | + $pdf->setPrintHeader(false); |
|
| 1220 | + $pdf->setPrintFooter(false); |
|
| 1221 | + } |
|
| 1222 | + $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
|
| 1223 | 1223 | |
| 1224 | - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
| 1224 | + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
| 1225 | 1225 | |
| 1226 | 1226 | |
| 1227 | 1227 | foreach($files as $file) |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | // Dolibarr environment |
| 29 | 29 | $res = @include("../../main.inc.php"); // From htdocs directory |
| 30 | 30 | if (! $res) { |
| 31 | - $res = @include("../../../main.inc.php"); // From "custom" directory |
|
| 31 | + $res = @include("../../../main.inc.php"); // From "custom" directory |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | // Libraries |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | // Access control |
| 41 | 41 | if (! $user->admin) { |
| 42 | - accessforbidden(); |
|
| 42 | + accessforbidden(); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | // Parameters |
@@ -91,11 +91,11 @@ discard block |
||
| 91 | 91 | // Configuration header |
| 92 | 92 | $head = subtotalAdminPrepareHead(); |
| 93 | 93 | dol_fiche_head( |
| 94 | - $head, |
|
| 95 | - 'settings', |
|
| 96 | - $langs->trans("Module104777Name"), |
|
| 97 | - 0, |
|
| 98 | - "subtotal@subtotal" |
|
| 94 | + $head, |
|
| 95 | + 'settings', |
|
| 96 | + $langs->trans("Module104777Name"), |
|
| 97 | + 0, |
|
| 98 | + "subtotal@subtotal" |
|
| 99 | 99 | ); |
| 100 | 100 | |
| 101 | 101 | showParameters(); |
@@ -164,13 +164,13 @@ discard block |
||
| 164 | 164 | print ajax_constantonoff('SUBTOTAL_ALLOW_DUPLICATE_BLOCK'); |
| 165 | 165 | print '</td></tr>'; |
| 166 | 166 | |
| 167 | - $var=!$var; |
|
| 168 | - print '<tr '.$bc[$var].'>'; |
|
| 169 | - print '<td>'.$langs->trans("SUBTOTAL_ALLOW_DUPLICATE_LINE").'</td>'; |
|
| 170 | - print '<td align="center" width="20"> </td>'; |
|
| 171 | - print '<td align="center" width="300">'; |
|
| 172 | - print ajax_constantonoff('SUBTOTAL_ALLOW_DUPLICATE_LINE'); |
|
| 173 | - print '</td></tr>'; |
|
| 167 | + $var=!$var; |
|
| 168 | + print '<tr '.$bc[$var].'>'; |
|
| 169 | + print '<td>'.$langs->trans("SUBTOTAL_ALLOW_DUPLICATE_LINE").'</td>'; |
|
| 170 | + print '<td align="center" width="20"> </td>'; |
|
| 171 | + print '<td align="center" width="300">'; |
|
| 172 | + print ajax_constantonoff('SUBTOTAL_ALLOW_DUPLICATE_LINE'); |
|
| 173 | + print '</td></tr>'; |
|
| 174 | 174 | |
| 175 | 175 | $var=!$var; |
| 176 | 176 | print '<tr '.$bc[$var].'>'; |
@@ -267,12 +267,12 @@ discard block |
||
| 267 | 267 | print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
| 268 | 268 | print '<input type="hidden" name="action" value="set_SUBTOTAL_TFIELD_TO_KEEP_WITH_NC">'; |
| 269 | 269 | $TField = array( |
| 270 | - 'pdf_getlineqty' => $langs->trans('Qty'), |
|
| 271 | - 'pdf_getlinevatrate' => $langs->trans('VAT'), |
|
| 272 | - 'pdf_getlineupexcltax' => $langs->trans('PriceUHT'), |
|
| 273 | - 'pdf_getlinetotalexcltax' => $langs->trans('TotalHT'), |
|
| 274 | - 'pdf_getlineunit' => $langs->trans('Unit'), |
|
| 275 | - 'pdf_getlineremisepercent' => $langs->trans('Discount') |
|
| 270 | + 'pdf_getlineqty' => $langs->trans('Qty'), |
|
| 271 | + 'pdf_getlinevatrate' => $langs->trans('VAT'), |
|
| 272 | + 'pdf_getlineupexcltax' => $langs->trans('PriceUHT'), |
|
| 273 | + 'pdf_getlinetotalexcltax' => $langs->trans('TotalHT'), |
|
| 274 | + 'pdf_getlineunit' => $langs->trans('Unit'), |
|
| 275 | + 'pdf_getlineremisepercent' => $langs->trans('Discount') |
|
| 276 | 276 | ); |
| 277 | 277 | print $html->multiselectarray('SUBTOTAL_TFIELD_TO_KEEP_WITH_NC', $TField, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC), 0, 0, '', 0, 0, 'style="min-width:100px"'); |
| 278 | 278 | print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'; |