@@ -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").'">'; |
@@ -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 | elseif($object->element == 'shipping') |
| 129 | 129 | { |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | |
| 178 | 178 | if (!empty($conf->global->SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE) && $qty < 10) TSubtotal::addSubtotalMissing($object, $qty); |
| 179 | 179 | |
| 180 | - TSubtotal::addSubTotalLine($object, $title, $qty); |
|
| 180 | + TSubtotal::addSubTotalLine($object, $title, $qty); |
|
| 181 | 181 | } |
| 182 | 182 | else if($action==='ask_deleteallline') { |
| 183 | 183 | $form=new Form($db); |
@@ -399,36 +399,36 @@ discard block |
||
| 399 | 399 | $TContext = explode(':',$parameters['context']); |
| 400 | 400 | if ( |
| 401 | 401 | in_array('invoicecard',$TContext) |
| 402 | - || in_array('invoicesuppliercard',$TContext) |
|
| 402 | + || in_array('invoicesuppliercard',$TContext) |
|
| 403 | 403 | || in_array('propalcard',$TContext) |
| 404 | 404 | || in_array('ordercard',$TContext) |
| 405 | - || in_array('ordersuppliercard',$TContext) |
|
| 405 | + || in_array('ordersuppliercard',$TContext) |
|
| 406 | 406 | || in_array('invoicereccard',$TContext) |
| 407 | 407 | ) |
| 408 | - { |
|
| 409 | - $hideInnerLines = isset( $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] ) ? $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] : 0; |
|
| 410 | - $hidedetails = isset( $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] ) ? $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] : 0; |
|
| 408 | + { |
|
| 409 | + $hideInnerLines = isset( $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] ) ? $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] : 0; |
|
| 410 | + $hidedetails = isset( $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] ) ? $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] : 0; |
|
| 411 | 411 | $hidepricesDefaultConf = !empty($conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED)?$conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED:0; |
| 412 | 412 | $hideprices= isset( $_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id] ) ? $_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id] : $hidepricesDefaultConf; |
| 413 | 413 | |
| 414 | 414 | $var=false; |
| 415 | - $out.= '<tr '.$bc[$var].'> |
|
| 415 | + $out.= '<tr '.$bc[$var].'> |
|
| 416 | 416 | <td colspan="4" align="right"> |
| 417 | 417 | <label for="hideInnerLines">'.$langs->trans('HideInnerLines').'</label> |
| 418 | 418 | <input type="checkbox" onclick="if($(this).is(\':checked\')) { $(\'#hidedetails\').prop(\'checked\', \'checked\') }" id="hideInnerLines" name="hideInnerLines" value="1" '.(( $hideInnerLines ) ? 'checked="checked"' : '' ).' /> |
| 419 | 419 | </td> |
| 420 | 420 | </tr>'; |
| 421 | 421 | |
| 422 | - $var=!$var; |
|
| 423 | - $out.= '<tr '.$bc[$var].'> |
|
| 422 | + $var=!$var; |
|
| 423 | + $out.= '<tr '.$bc[$var].'> |
|
| 424 | 424 | <td colspan="4" align="right"> |
| 425 | 425 | <label for="hidedetails">'.$langs->trans('SubTotalhidedetails').'</label> |
| 426 | 426 | <input type="checkbox" id="hidedetails" name="hidedetails" value="1" '.(( $hidedetails ) ? 'checked="checked"' : '' ).' /> |
| 427 | 427 | </td> |
| 428 | 428 | </tr>'; |
| 429 | 429 | |
| 430 | - $var=!$var; |
|
| 431 | - $out.= '<tr '.$bc[$var].'> |
|
| 430 | + $var=!$var; |
|
| 431 | + $out.= '<tr '.$bc[$var].'> |
|
| 432 | 432 | <td colspan="4" align="right"> |
| 433 | 433 | <label for="hideprices">'.$langs->trans('SubTotalhidePrice').'</label> |
| 434 | 434 | <input type="checkbox" id="hideprices" name="hideprices" value="1" '.(( $hideprices ) ? 'checked="checked"' : '' ).' /> |
@@ -440,9 +440,9 @@ discard block |
||
| 440 | 440 | if ( |
| 441 | 441 | (in_array('propalcard',$TContext) && !empty($conf->global->SUBTOTAL_PROPAL_ADD_RECAP)) |
| 442 | 442 | || (in_array('ordercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
| 443 | - || (in_array('ordersuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
| 443 | + || (in_array('ordersuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
| 444 | 444 | || (in_array('invoicecard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
| 445 | - || (in_array('invoicesuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
| 445 | + || (in_array('invoicesuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
| 446 | 446 | || (in_array('invoicereccard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP )) |
| 447 | 447 | ) |
| 448 | 448 | { |
@@ -461,19 +461,19 @@ discard block |
||
| 461 | 461 | } |
| 462 | 462 | |
| 463 | 463 | |
| 464 | - return 1; |
|
| 464 | + return 1; |
|
| 465 | 465 | } |
| 466 | 466 | |
| 467 | - function formEditProductOptions($parameters, &$object, &$action, $hookmanager) |
|
| 468 | - { |
|
| 467 | + function formEditProductOptions($parameters, &$object, &$action, $hookmanager) |
|
| 468 | + { |
|
| 469 | 469 | |
| 470 | - if (in_array('invoicecard',explode(':',$parameters['context']))) |
|
| 471 | - { |
|
| 470 | + if (in_array('invoicecard',explode(':',$parameters['context']))) |
|
| 471 | + { |
|
| 472 | 472 | |
| 473 | - } |
|
| 473 | + } |
|
| 474 | 474 | |
| 475 | - return 0; |
|
| 476 | - } |
|
| 475 | + return 0; |
|
| 476 | + } |
|
| 477 | 477 | |
| 478 | 478 | function ODTSubstitutionLine(&$parameters, &$object, $action, $hookmanager) { |
| 479 | 479 | global $conf; |
@@ -522,11 +522,11 @@ discard block |
||
| 522 | 522 | |
| 523 | 523 | if ( |
| 524 | 524 | in_array('invoicecard',explode(':',$parameters['context'])) |
| 525 | - || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
| 525 | + || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
| 526 | 526 | || in_array('propalcard',explode(':',$parameters['context'])) |
| 527 | - || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
| 527 | + || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
| 528 | 528 | || in_array('ordercard',explode(':',$parameters['context'])) |
| 529 | - || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
| 529 | + || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
| 530 | 530 | || in_array('invoicereccard',explode(':',$parameters['context'])) |
| 531 | 531 | ) { |
| 532 | 532 | |
@@ -605,20 +605,20 @@ discard block |
||
| 605 | 605 | in_array('invoicecard',explode(':',$parameters['context'])) |
| 606 | 606 | || in_array('propalcard',explode(':',$parameters['context'])) |
| 607 | 607 | || in_array('ordercard',explode(':',$parameters['context'])) |
| 608 | - || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
| 609 | - || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
| 610 | - || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
| 608 | + || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
| 609 | + || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
| 610 | + || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
| 611 | 611 | ) |
| 612 | - { |
|
| 612 | + { |
|
| 613 | 613 | if(in_array('invoicecard',explode(':',$parameters['context']))) { |
| 614 | 614 | $sessname = 'subtotal_hideInnerLines_facture'; |
| 615 | 615 | $sessname2 = 'subtotal_hidedetails_facture'; |
| 616 | 616 | $sessname3 = 'subtotal_hideprices_facture'; |
| 617 | 617 | } |
| 618 | 618 | elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) { |
| 619 | - $sessname = 'subtotal_hideInnerLines_facture_fournisseur'; |
|
| 620 | - $sessname2 = 'subtotal_hidedetails_facture_fournisseur'; |
|
| 621 | - $sessname3 = 'subtotal_hideprices_facture_fournisseur'; |
|
| 619 | + $sessname = 'subtotal_hideInnerLines_facture_fournisseur'; |
|
| 620 | + $sessname2 = 'subtotal_hidedetails_facture_fournisseur'; |
|
| 621 | + $sessname3 = 'subtotal_hideprices_facture_fournisseur'; |
|
| 622 | 622 | } |
| 623 | 623 | elseif(in_array('propalcard',explode(':',$parameters['context']))) { |
| 624 | 624 | $sessname = 'subtotal_hideInnerLines_propal'; |
@@ -626,9 +626,9 @@ discard block |
||
| 626 | 626 | $sessname3 = 'subtotal_hideprices_propal'; |
| 627 | 627 | } |
| 628 | 628 | elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) { |
| 629 | - $sessname = 'subtotal_hideInnerLines_supplier_proposal'; |
|
| 630 | - $sessname2 = 'subtotal_hidedetails_supplier_proposal'; |
|
| 631 | - $sessname3 = 'subtotal_hideprices_supplier_proposal'; |
|
| 629 | + $sessname = 'subtotal_hideInnerLines_supplier_proposal'; |
|
| 630 | + $sessname2 = 'subtotal_hidedetails_supplier_proposal'; |
|
| 631 | + $sessname3 = 'subtotal_hideprices_supplier_proposal'; |
|
| 632 | 632 | } |
| 633 | 633 | elseif(in_array('ordercard',explode(':',$parameters['context']))) { |
| 634 | 634 | $sessname = 'subtotal_hideInnerLines_commande'; |
@@ -636,9 +636,9 @@ discard block |
||
| 636 | 636 | $sessname3 = 'subtotal_hideprices_commande'; |
| 637 | 637 | } |
| 638 | 638 | elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) { |
| 639 | - $sessname = 'subtotal_hideInnerLines_commande_fournisseur'; |
|
| 640 | - $sessname2 = 'subtotal_hidedetails_commande_fournisseur'; |
|
| 641 | - $sessname3 = 'subtotal_hideprices_commande_fournisseur'; |
|
| 639 | + $sessname = 'subtotal_hideInnerLines_commande_fournisseur'; |
|
| 640 | + $sessname2 = 'subtotal_hidedetails_commande_fournisseur'; |
|
| 641 | + $sessname3 = 'subtotal_hideprices_commande_fournisseur'; |
|
| 642 | 642 | } |
| 643 | 643 | else { |
| 644 | 644 | $sessname = 'subtotal_hideInnerLines_unknown'; |
@@ -663,17 +663,17 @@ discard block |
||
| 663 | 663 | foreach($object->lines as &$line) { |
| 664 | 664 | if ($line->product_type == 9 && $line->special_code == $this->module_number) { |
| 665 | 665 | |
| 666 | - if($line->qty>=90) { |
|
| 667 | - $line->modsubtotal_total = 1; |
|
| 668 | - } |
|
| 669 | - else{ |
|
| 670 | - $line->modsubtotal_title = 1; |
|
| 671 | - } |
|
| 666 | + if($line->qty>=90) { |
|
| 667 | + $line->modsubtotal_total = 1; |
|
| 668 | + } |
|
| 669 | + else{ |
|
| 670 | + $line->modsubtotal_title = 1; |
|
| 671 | + } |
|
| 672 | 672 | |
| 673 | 673 | $line->total_ht = $this->getTotalLineFromObject($object, $line, ''); |
| 674 | 674 | } |
| 675 | - } |
|
| 676 | - } |
|
| 675 | + } |
|
| 676 | + } |
|
| 677 | 677 | |
| 678 | 678 | } |
| 679 | 679 | else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') { |
@@ -690,7 +690,7 @@ discard block |
||
| 690 | 690 | */ |
| 691 | 691 | else if($object->element=='invoice_supplier') |
| 692 | 692 | { |
| 693 | - $object->deleteline($idLine); |
|
| 693 | + $object->deleteline($idLine); |
|
| 694 | 694 | } |
| 695 | 695 | /** |
| 696 | 696 | * @var $object Propal |
@@ -713,7 +713,7 @@ discard block |
||
| 713 | 713 | */ |
| 714 | 714 | else if($object->element=='order_supplier') |
| 715 | 715 | { |
| 716 | - $object->deleteline($idLine); |
|
| 716 | + $object->deleteline($idLine); |
|
| 717 | 717 | } |
| 718 | 718 | /** |
| 719 | 719 | * @var $object Facturerec |
@@ -788,7 +788,7 @@ discard block |
||
| 788 | 788 | |
| 789 | 789 | foreach($object->lines as $l) { |
| 790 | 790 | |
| 791 | - $lid = (!empty($l->rowid) ? $l->rowid : $l->id); |
|
| 791 | + $lid = (!empty($l->rowid) ? $l->rowid : $l->id); |
|
| 792 | 792 | if($lid == $lineid) { |
| 793 | 793 | |
| 794 | 794 | $found = true; |
@@ -797,7 +797,7 @@ discard block |
||
| 797 | 797 | |
| 798 | 798 | if($found) { |
| 799 | 799 | |
| 800 | - $Tab[] = (!empty($l->rowid) ? $l->rowid : $l->id); |
|
| 800 | + $Tab[] = (!empty($l->rowid) ? $l->rowid : $l->id); |
|
| 801 | 801 | |
| 802 | 802 | if($l->special_code==$this->module_number && (($l->qty==99 && $qty_line==1) || ($l->qty==98 && $qty_line==2)) ) { |
| 803 | 803 | break; // end of story |
@@ -929,7 +929,7 @@ discard block |
||
| 929 | 929 | if(method_exists('Closure','bind')) { |
| 930 | 930 | $pageBreakOriginalValue = $pdf->AcceptPageBreak(); |
| 931 | 931 | $sweetsThief = function ($pdf) { |
| 932 | - return $pdf->bMargin ; |
|
| 932 | + return $pdf->bMargin ; |
|
| 933 | 933 | }; |
| 934 | 934 | $sweetsThief = Closure::bind($sweetsThief, null, $pdf); |
| 935 | 935 | |
@@ -997,7 +997,7 @@ discard block |
||
| 997 | 997 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
| 998 | 998 | $total_to_print = price($total); |
| 999 | 999 | |
| 1000 | - $line->total_ht = $total; |
|
| 1000 | + $line->total_ht = $total; |
|
| 1001 | 1001 | $line->total = $total; |
| 1002 | 1002 | $line->total_tva = $total_tva; |
| 1003 | 1003 | $line->total_ttc = $total_ttc; |
@@ -1154,7 +1154,7 @@ discard block |
||
| 1154 | 1154 | } |
| 1155 | 1155 | |
| 1156 | 1156 | function pdf_getlinetotalexcltax($parameters=array(), &$object, &$action='') { |
| 1157 | - global $conf, $hideprices, $hookmanager; |
|
| 1157 | + global $conf, $hideprices, $hookmanager; |
|
| 1158 | 1158 | |
| 1159 | 1159 | if(is_array($parameters)) $i = & $parameters['i']; |
| 1160 | 1160 | else $i = (int)$parameters; |
@@ -1193,7 +1193,7 @@ discard block |
||
| 1193 | 1193 | } |
| 1194 | 1194 | } |
| 1195 | 1195 | if ((int)GETPOST('hideInnerLines') && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)){ |
| 1196 | - $this->resprints = price($object->lines[$i]->total_ht); |
|
| 1196 | + $this->resprints = price($object->lines[$i]->total_ht); |
|
| 1197 | 1197 | } |
| 1198 | 1198 | |
| 1199 | 1199 | // Si la gestion C/NC est active et que je suis sur un ligne dont l'extrafield est coché |
@@ -1322,7 +1322,7 @@ discard block |
||
| 1322 | 1322 | } |
| 1323 | 1323 | |
| 1324 | 1324 | function pdf_getlineupexcltax($parameters=array(), &$object, &$action='') { |
| 1325 | - global $conf,$hideprices,$hookmanager; |
|
| 1325 | + global $conf,$hideprices,$hookmanager; |
|
| 1326 | 1326 | |
| 1327 | 1327 | if(is_array($parameters)) $i = & $parameters['i']; |
| 1328 | 1328 | else $i = (int)$parameters; |
@@ -1330,18 +1330,18 @@ discard block |
||
| 1330 | 1330 | if($this->isModSubtotalLine($parameters,$object) ) { |
| 1331 | 1331 | $this->resprints = ' '; |
| 1332 | 1332 | |
| 1333 | - $line = $object->lines[$i]; |
|
| 1333 | + $line = $object->lines[$i]; |
|
| 1334 | 1334 | |
| 1335 | - // On récupère les montants du bloc pour les afficher dans la ligne de sous-total |
|
| 1336 | - if(TSubtotal::isSubtotal($line)) { |
|
| 1337 | - $parentTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
| 1335 | + // On récupère les montants du bloc pour les afficher dans la ligne de sous-total |
|
| 1336 | + if(TSubtotal::isSubtotal($line)) { |
|
| 1337 | + $parentTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
| 1338 | 1338 | |
| 1339 | - if(is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
| 1340 | - if(! empty($parentTitle->array_options['options_show_total_ht'])) { |
|
| 1341 | - $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle); |
|
| 1342 | - $this->resprints = price($TTotal['total_subprice']); |
|
| 1343 | - } |
|
| 1344 | - } |
|
| 1339 | + if(is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
| 1340 | + if(! empty($parentTitle->array_options['options_show_total_ht'])) { |
|
| 1341 | + $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle); |
|
| 1342 | + $this->resprints = price($TTotal['total_subprice']); |
|
| 1343 | + } |
|
| 1344 | + } |
|
| 1345 | 1345 | |
| 1346 | 1346 | if((float)DOL_VERSION<=3.6) { |
| 1347 | 1347 | return ''; |
@@ -1357,58 +1357,58 @@ discard block |
||
| 1357 | 1357 | (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) |
| 1358 | 1358 | ) |
| 1359 | 1359 | { |
| 1360 | - // alors je dois vérifier si la méthode fait partie de la conf qui l'exclue |
|
| 1361 | - if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
| 1362 | - { |
|
| 1363 | - $this->resprints = ' '; |
|
| 1360 | + // alors je dois vérifier si la méthode fait partie de la conf qui l'exclue |
|
| 1361 | + if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
| 1362 | + { |
|
| 1363 | + $this->resprints = ' '; |
|
| 1364 | 1364 | |
| 1365 | - // currentcontext à modifier celon l'appel |
|
| 1366 | - $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i); |
|
| 1367 | - 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) |
|
| 1365 | + // currentcontext à modifier celon l'appel |
|
| 1366 | + $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i); |
|
| 1367 | + 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) |
|
| 1368 | 1368 | |
| 1369 | - } |
|
| 1369 | + } |
|
| 1370 | 1370 | } |
| 1371 | 1371 | // Cache le prix pour les lignes standards dolibarr qui sont dans un ensemble |
| 1372 | 1372 | else if (!empty($hideprices)) |
| 1373 | 1373 | { |
| 1374 | 1374 | |
| 1375 | - // Check if a title exist for this line && if the title have subtotal |
|
| 1376 | - $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
| 1377 | - if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
| 1378 | - { |
|
| 1375 | + // Check if a title exist for this line && if the title have subtotal |
|
| 1376 | + $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
| 1377 | + if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
| 1378 | + { |
|
| 1379 | 1379 | |
| 1380 | - $this->resprints = ' '; |
|
| 1380 | + $this->resprints = ' '; |
|
| 1381 | 1381 | |
| 1382 | - // currentcontext à modifier celon l'appel |
|
| 1383 | - $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hideprices', 'i' => $i); |
|
| 1384 | - 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) |
|
| 1385 | - } |
|
| 1382 | + // currentcontext à modifier celon l'appel |
|
| 1383 | + $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hideprices', 'i' => $i); |
|
| 1384 | + 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) |
|
| 1385 | + } |
|
| 1386 | 1386 | } |
| 1387 | 1387 | |
| 1388 | 1388 | return 0; |
| 1389 | 1389 | } |
| 1390 | 1390 | |
| 1391 | 1391 | function pdf_getlineremisepercent($parameters=array(), &$object, &$action='') { |
| 1392 | - global $conf,$hideprices,$hookmanager; |
|
| 1392 | + global $conf,$hideprices,$hookmanager; |
|
| 1393 | 1393 | |
| 1394 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1395 | - else $i = (int) $parameters; |
|
| 1394 | + if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1395 | + else $i = (int) $parameters; |
|
| 1396 | 1396 | |
| 1397 | 1397 | if($this->isModSubtotalLine($parameters,$object) ) { |
| 1398 | 1398 | $this->resprints = ' '; |
| 1399 | 1399 | |
| 1400 | - $line = $object->lines[$i]; |
|
| 1400 | + $line = $object->lines[$i]; |
|
| 1401 | 1401 | |
| 1402 | - // Affichage de la remise |
|
| 1403 | - if(TSubtotal::isSubtotal($line)) { |
|
| 1404 | - $parentTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
| 1402 | + // Affichage de la remise |
|
| 1403 | + if(TSubtotal::isSubtotal($line)) { |
|
| 1404 | + $parentTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
| 1405 | 1405 | |
| 1406 | - if(empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
| 1407 | - if(! empty($parentTitle->array_options['options_show_reduc'])) { |
|
| 1408 | - $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle); |
|
| 1409 | - $this->resprints = price((1-$TTotal['total_ht'] / $TTotal['total_subprice'])*100, 0, '', 1, 2, 2).'%'; |
|
| 1410 | - } |
|
| 1411 | - } |
|
| 1406 | + if(empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
| 1407 | + if(! empty($parentTitle->array_options['options_show_reduc'])) { |
|
| 1408 | + $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle); |
|
| 1409 | + $this->resprints = price((1-$TTotal['total_ht'] / $TTotal['total_subprice'])*100, 0, '', 1, 2, 2).'%'; |
|
| 1410 | + } |
|
| 1411 | + } |
|
| 1412 | 1412 | |
| 1413 | 1413 | if((float)DOL_VERSION<=3.6) { |
| 1414 | 1414 | return ''; |
@@ -1418,15 +1418,15 @@ discard block |
||
| 1418 | 1418 | } |
| 1419 | 1419 | } |
| 1420 | 1420 | elseif (!empty($hideprices) |
| 1421 | - || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
| 1422 | - ) |
|
| 1423 | - { |
|
| 1424 | - if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
| 1425 | - { |
|
| 1426 | - $this->resprints = ' '; |
|
| 1427 | - return 1; |
|
| 1428 | - } |
|
| 1429 | - } |
|
| 1421 | + || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
| 1422 | + ) |
|
| 1423 | + { |
|
| 1424 | + if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
| 1425 | + { |
|
| 1426 | + $this->resprints = ' '; |
|
| 1427 | + return 1; |
|
| 1428 | + } |
|
| 1429 | + } |
|
| 1430 | 1430 | |
| 1431 | 1431 | return 0; |
| 1432 | 1432 | } |
@@ -1462,7 +1462,7 @@ discard block |
||
| 1462 | 1462 | } |
| 1463 | 1463 | |
| 1464 | 1464 | function pdf_getlinevatrate($parameters=array(), &$object, &$action='') { |
| 1465 | - global $conf,$hideprices,$hookmanager; |
|
| 1465 | + global $conf,$hideprices,$hookmanager; |
|
| 1466 | 1466 | |
| 1467 | 1467 | if($this->isModSubtotalLine($parameters,$object) ){ |
| 1468 | 1468 | $this->resprints = ' '; |
@@ -1487,31 +1487,31 @@ discard block |
||
| 1487 | 1487 | (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) |
| 1488 | 1488 | ) |
| 1489 | 1489 | { |
| 1490 | - // alors je dois vérifier si la méthode fait partie de la conf qui l'exclue |
|
| 1491 | - if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
| 1492 | - { |
|
| 1493 | - $this->resprints = ' '; |
|
| 1490 | + // alors je dois vérifier si la méthode fait partie de la conf qui l'exclue |
|
| 1491 | + if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
| 1492 | + { |
|
| 1493 | + $this->resprints = ' '; |
|
| 1494 | 1494 | |
| 1495 | - // currentcontext à modifier celon l'appel |
|
| 1496 | - $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i); |
|
| 1497 | - 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) |
|
| 1498 | - } |
|
| 1495 | + // currentcontext à modifier celon l'appel |
|
| 1496 | + $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i); |
|
| 1497 | + 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) |
|
| 1498 | + } |
|
| 1499 | 1499 | } |
| 1500 | 1500 | // Cache le prix pour les lignes standards dolibarr qui sont dans un ensemble |
| 1501 | 1501 | else if (!empty($hideprices)) |
| 1502 | 1502 | { |
| 1503 | 1503 | |
| 1504 | - // Check if a title exist for this line && if the title have subtotal |
|
| 1505 | - $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
| 1506 | - if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
| 1507 | - { |
|
| 1504 | + // Check if a title exist for this line && if the title have subtotal |
|
| 1505 | + $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
| 1506 | + if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
| 1507 | + { |
|
| 1508 | 1508 | |
| 1509 | - $this->resprints = ' '; |
|
| 1509 | + $this->resprints = ' '; |
|
| 1510 | 1510 | |
| 1511 | - // currentcontext à modifier celon l'appel |
|
| 1512 | - $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hideprices', 'i' => $i); |
|
| 1513 | - 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) |
|
| 1514 | - } |
|
| 1511 | + // currentcontext à modifier celon l'appel |
|
| 1512 | + $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hideprices', 'i' => $i); |
|
| 1513 | + 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) |
|
| 1514 | + } |
|
| 1515 | 1515 | } |
| 1516 | 1516 | |
| 1517 | 1517 | return 0; |
@@ -1635,33 +1635,33 @@ discard block |
||
| 1635 | 1635 | |
| 1636 | 1636 | $this->add_numerotation($object); |
| 1637 | 1637 | |
| 1638 | - foreach($object->lines as $k => &$l) { |
|
| 1639 | - if(TSubtotal::isSubtotal($l)) { |
|
| 1640 | - $parentTitle = TSubtotal::getParentTitleOfLine($object, $k); |
|
| 1641 | - if(is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
| 1642 | - if(! empty($parentTitle->id) && ! empty($parentTitle->array_options['options_show_total_ht'])) { |
|
| 1643 | - $l->remise_percent = 100; // Affichage de la réduction sur la ligne de sous-total |
|
| 1644 | - } |
|
| 1645 | - } |
|
| 1638 | + foreach($object->lines as $k => &$l) { |
|
| 1639 | + if(TSubtotal::isSubtotal($l)) { |
|
| 1640 | + $parentTitle = TSubtotal::getParentTitleOfLine($object, $k); |
|
| 1641 | + if(is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
| 1642 | + if(! empty($parentTitle->id) && ! empty($parentTitle->array_options['options_show_total_ht'])) { |
|
| 1643 | + $l->remise_percent = 100; // Affichage de la réduction sur la ligne de sous-total |
|
| 1644 | + } |
|
| 1645 | + } |
|
| 1646 | 1646 | |
| 1647 | 1647 | |
| 1648 | - // Pas de hook sur les colonnes du PDF expédition, on unset les bonnes variables |
|
| 1649 | - if(($object->element == 'shipping' || $object->element == 'delivery') && $this->isModSubtotalLine($k, $object)) |
|
| 1648 | + // Pas de hook sur les colonnes du PDF expédition, on unset les bonnes variables |
|
| 1649 | + if(($object->element == 'shipping' || $object->element == 'delivery') && $this->isModSubtotalLine($k, $object)) |
|
| 1650 | 1650 | { |
| 1651 | 1651 | $l->qty = $l->qty_asked; |
| 1652 | 1652 | unset($l->qty_asked, $l->qty_shipped, $l->volume, $l->weight); |
| 1653 | 1653 | } |
| 1654 | - } |
|
| 1654 | + } |
|
| 1655 | 1655 | |
| 1656 | 1656 | $hideInnerLines = (int)GETPOST('hideInnerLines'); |
| 1657 | 1657 | $hidedetails = (int)GETPOST('hidedetails'); |
| 1658 | 1658 | |
| 1659 | 1659 | if ($hideInnerLines) { // si c une ligne de titre |
| 1660 | - $fk_parent_line=0; |
|
| 1660 | + $fk_parent_line=0; |
|
| 1661 | 1661 | $TLines =array(); |
| 1662 | 1662 | |
| 1663 | 1663 | $original_count=count($object->lines); |
| 1664 | - $TTvas = array(); // tableau de tva |
|
| 1664 | + $TTvas = array(); // tableau de tva |
|
| 1665 | 1665 | |
| 1666 | 1666 | foreach($object->lines as $k=>&$line) |
| 1667 | 1667 | { |
@@ -1700,48 +1700,48 @@ discard block |
||
| 1700 | 1700 | |
| 1701 | 1701 | if ($hideInnerLines) |
| 1702 | 1702 | { |
| 1703 | - if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
| 1704 | - { |
|
| 1705 | - if($line->tva_tx != '0.000' && $line->product_type!=9){ |
|
| 1703 | + if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
| 1704 | + { |
|
| 1705 | + if($line->tva_tx != '0.000' && $line->product_type!=9){ |
|
| 1706 | 1706 | |
| 1707 | - // on remplit le tableau de tva pour substituer les lignes cachées |
|
| 1708 | - $TTvas[$line->tva_tx]['total_tva'] += $line->total_tva; |
|
| 1709 | - $TTvas[$line->tva_tx]['total_ht'] += $line->total_ht; |
|
| 1710 | - $TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; |
|
| 1711 | - } |
|
| 1712 | - if($line->product_type==9 && $line->rowid>0) |
|
| 1713 | - { |
|
| 1714 | - //Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres |
|
| 1715 | - // génère des lignes d'affichage des montants HT soumis à tva |
|
| 1716 | - $nbtva = count($TTvas); |
|
| 1717 | - if(!empty($nbtva)){ |
|
| 1718 | - foreach ($TTvas as $tx =>$val){ |
|
| 1719 | - $l = clone $line; |
|
| 1720 | - $l->product_type = 1; |
|
| 1721 | - $l->special_code = ''; |
|
| 1722 | - $l->qty = 1; |
|
| 1723 | - $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx)); |
|
| 1724 | - $l->tva_tx = $tx; |
|
| 1725 | - $l->total_ht = $val['total_ht']; |
|
| 1726 | - $l->total_tva = $val['total_tva']; |
|
| 1727 | - $l->total = $line->total_ht; |
|
| 1728 | - $l->total_ttc = $val['total_ttc']; |
|
| 1729 | - $TLines[] = $l; |
|
| 1730 | - array_shift($TTvas); |
|
| 1731 | - } |
|
| 1732 | - } |
|
| 1707 | + // on remplit le tableau de tva pour substituer les lignes cachées |
|
| 1708 | + $TTvas[$line->tva_tx]['total_tva'] += $line->total_tva; |
|
| 1709 | + $TTvas[$line->tva_tx]['total_ht'] += $line->total_ht; |
|
| 1710 | + $TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; |
|
| 1711 | + } |
|
| 1712 | + if($line->product_type==9 && $line->rowid>0) |
|
| 1713 | + { |
|
| 1714 | + //Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres |
|
| 1715 | + // génère des lignes d'affichage des montants HT soumis à tva |
|
| 1716 | + $nbtva = count($TTvas); |
|
| 1717 | + if(!empty($nbtva)){ |
|
| 1718 | + foreach ($TTvas as $tx =>$val){ |
|
| 1719 | + $l = clone $line; |
|
| 1720 | + $l->product_type = 1; |
|
| 1721 | + $l->special_code = ''; |
|
| 1722 | + $l->qty = 1; |
|
| 1723 | + $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx)); |
|
| 1724 | + $l->tva_tx = $tx; |
|
| 1725 | + $l->total_ht = $val['total_ht']; |
|
| 1726 | + $l->total_tva = $val['total_tva']; |
|
| 1727 | + $l->total = $line->total_ht; |
|
| 1728 | + $l->total_ttc = $val['total_ttc']; |
|
| 1729 | + $TLines[] = $l; |
|
| 1730 | + array_shift($TTvas); |
|
| 1731 | + } |
|
| 1732 | + } |
|
| 1733 | 1733 | |
| 1734 | - // ajoute la ligne de sous-total |
|
| 1735 | - $TLines[] = $line; |
|
| 1736 | - } |
|
| 1737 | - } else { |
|
| 1734 | + // ajoute la ligne de sous-total |
|
| 1735 | + $TLines[] = $line; |
|
| 1736 | + } |
|
| 1737 | + } else { |
|
| 1738 | 1738 | |
| 1739 | - if($line->product_type==9 && $line->rowid>0) |
|
| 1740 | - { |
|
| 1741 | - // ajoute la ligne de sous-total |
|
| 1742 | - $TLines[] = $line; |
|
| 1743 | - } |
|
| 1744 | - } |
|
| 1739 | + if($line->product_type==9 && $line->rowid>0) |
|
| 1740 | + { |
|
| 1741 | + // ajoute la ligne de sous-total |
|
| 1742 | + $TLines[] = $line; |
|
| 1743 | + } |
|
| 1744 | + } |
|
| 1745 | 1745 | |
| 1746 | 1746 | |
| 1747 | 1747 | } |
@@ -1766,20 +1766,20 @@ discard block |
||
| 1766 | 1766 | $nbtva = count($TTvas); |
| 1767 | 1767 | if(!empty($nbtva) && $hideInnerLines && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
| 1768 | 1768 | { |
| 1769 | - foreach ($TTvas as $tx =>$val){ |
|
| 1770 | - $l = clone $line; |
|
| 1771 | - $l->product_type = 1; |
|
| 1772 | - $l->special_code = ''; |
|
| 1773 | - $l->qty = 1; |
|
| 1774 | - $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx)); |
|
| 1775 | - $l->tva_tx = $tx; |
|
| 1776 | - $l->total_ht = $val['total_ht']; |
|
| 1777 | - $l->total_tva = $val['total_tva']; |
|
| 1778 | - $l->total = $line->total_ht; |
|
| 1779 | - $l->total_ttc = $val['total_ttc']; |
|
| 1780 | - $TLines[] = $l; |
|
| 1781 | - array_shift($TTvas); |
|
| 1782 | - } |
|
| 1769 | + foreach ($TTvas as $tx =>$val){ |
|
| 1770 | + $l = clone $line; |
|
| 1771 | + $l->product_type = 1; |
|
| 1772 | + $l->special_code = ''; |
|
| 1773 | + $l->qty = 1; |
|
| 1774 | + $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx)); |
|
| 1775 | + $l->tva_tx = $tx; |
|
| 1776 | + $l->total_ht = $val['total_ht']; |
|
| 1777 | + $l->total_tva = $val['total_tva']; |
|
| 1778 | + $l->total = $line->total_ht; |
|
| 1779 | + $l->total_ttc = $val['total_ttc']; |
|
| 1780 | + $TLines[] = $l; |
|
| 1781 | + array_shift($TTvas); |
|
| 1782 | + } |
|
| 1783 | 1783 | } |
| 1784 | 1784 | |
| 1785 | 1785 | global $nblignes; |
@@ -1791,7 +1791,7 @@ discard block |
||
| 1791 | 1791 | $this->resprints = ''; |
| 1792 | 1792 | return 0; |
| 1793 | 1793 | } |
| 1794 | - } |
|
| 1794 | + } |
|
| 1795 | 1795 | |
| 1796 | 1796 | return 0; |
| 1797 | 1797 | } |
@@ -1983,11 +1983,11 @@ discard block |
||
| 1983 | 1983 | } |
| 1984 | 1984 | elseif($object->element == 'order_supplier' ) |
| 1985 | 1985 | { |
| 1986 | - $createRight = $user->rights->fournisseur->commande->creer; |
|
| 1986 | + $createRight = $user->rights->fournisseur->commande->creer; |
|
| 1987 | 1987 | } |
| 1988 | 1988 | elseif($object->element == 'invoice_supplier' ) |
| 1989 | 1989 | { |
| 1990 | - $createRight = $user->rights->fournisseur->facture->creer; |
|
| 1990 | + $createRight = $user->rights->fournisseur->facture->creer; |
|
| 1991 | 1991 | } |
| 1992 | 1992 | elseif($object->element == 'commande' && in_array('ordershipmentcard', $contexts)) |
| 1993 | 1993 | { |
@@ -2016,27 +2016,27 @@ discard block |
||
| 2016 | 2016 | $line = $originline; |
| 2017 | 2017 | } |
| 2018 | 2018 | if($object->element=='facture')$idvar = 'facid'; |
| 2019 | - else $idvar='id'; |
|
| 2019 | + else $idvar='id'; |
|
| 2020 | 2020 | if($line->special_code!=$this->module_number || $line->product_type!=9) { |
| 2021 | 2021 | if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_LINE) && $object->element !== 'invoice_supplier') |
| 2022 | - { |
|
| 2023 | - if(!(TSubtotal::isModSubtotalLine($line)) && ( $line->fk_prev_id === null ) && !($action == "editline" && GETPOST('lineid') == $line->id)) { |
|
| 2024 | - echo '<a name="duplicate-'.$line->id.'" href="' . $_SERVER['PHP_SELF'] . '?' . $idvar . '=' . $object->id . '&action=duplicate&lineid=' . $line->id . '"><i class="fa fa-clone" aria-hidden="true"></i></a>'; |
|
| 2022 | + { |
|
| 2023 | + if(!(TSubtotal::isModSubtotalLine($line)) && ( $line->fk_prev_id === null ) && !($action == "editline" && GETPOST('lineid') == $line->id)) { |
|
| 2024 | + echo '<a name="duplicate-'.$line->id.'" href="' . $_SERVER['PHP_SELF'] . '?' . $idvar . '=' . $object->id . '&action=duplicate&lineid=' . $line->id . '"><i class="fa fa-clone" aria-hidden="true"></i></a>'; |
|
| 2025 | 2025 | |
| 2026 | - ?> |
|
| 2026 | + ?> |
|
| 2027 | 2027 | <script type="text/javascript"> |
| 2028 | 2028 | $(document).ready(function() { |
| 2029 | 2029 | $("a[name='duplicate-<?php echo $line->id; ?>']").prependTo($('#row-<?php echo $line->id; ?>').find('.linecoledit')); |
| 2030 | 2030 | }); |
| 2031 | 2031 | </script> |
| 2032 | 2032 | <?php |
| 2033 | - } |
|
| 2033 | + } |
|
| 2034 | 2034 | |
| 2035 | - } |
|
| 2035 | + } |
|
| 2036 | 2036 | return 0; |
| 2037 | 2037 | } |
| 2038 | 2038 | 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)) |
| 2039 | - { |
|
| 2039 | + { |
|
| 2040 | 2040 | |
| 2041 | 2041 | |
| 2042 | 2042 | if((float)DOL_VERSION <= 3.4) |
@@ -2084,7 +2084,7 @@ discard block |
||
| 2084 | 2084 | //var_dump($line); |
| 2085 | 2085 | |
| 2086 | 2086 | // HTML 5 data for js |
| 2087 | - $data = $this->_getHtmlData($parameters, $object, $action, $hookmanager); |
|
| 2087 | + $data = $this->_getHtmlData($parameters, $object, $action, $hookmanager); |
|
| 2088 | 2088 | |
| 2089 | 2089 | |
| 2090 | 2090 | ?> |
@@ -2146,8 +2146,8 @@ discard block |
||
| 2146 | 2146 | } |
| 2147 | 2147 | |
| 2148 | 2148 | if ($object->element == 'order_supplier' || $object->element == 'invoice_supplier') { |
| 2149 | - $line->label = !empty($line->description) ? $line->description : $line->desc; |
|
| 2150 | - $line->description = ''; |
|
| 2149 | + $line->label = !empty($line->description) ? $line->description : $line->desc; |
|
| 2150 | + $line->description = ''; |
|
| 2151 | 2151 | } |
| 2152 | 2152 | $newlabel = $line->label; |
| 2153 | 2153 | if($line->label=='' && !$isFreeText) { |
@@ -2181,38 +2181,38 @@ discard block |
||
| 2181 | 2181 | |
| 2182 | 2182 | |
| 2183 | 2183 | echo '<div class="subtotal_underline" style="margin-left:24px; line-height: 25px;">'; |
| 2184 | - echo '<div>'; |
|
| 2185 | - echo '<input style="vertical-align:sub;" type="checkbox" name="line-pagebreak" id="subtotal-pagebreak" value="8" '.(($line->info_bits > 0) ? 'checked="checked"' : '') .' /> '; |
|
| 2186 | - echo '<label for="subtotal-pagebreak">'.$langs->trans('AddBreakPageBefore').'</label>'; |
|
| 2187 | - echo '</div>'; |
|
| 2188 | - |
|
| 2189 | - if (TSubtotal::isTitle($line)) |
|
| 2190 | - { |
|
| 2191 | - $form = new Form($db); |
|
| 2192 | - echo '<div>'; |
|
| 2193 | - echo '<label for="subtotal_tva_tx">'.$form->textwithpicto($langs->trans('subtotal_apply_default_tva'), $langs->trans('subtotal_apply_default_tva_help')).'</label>'; |
|
| 2194 | - echo '<select id="subtotal_tva_tx" name="subtotal_tva_tx" class="flat"><option selected="selected" value="">-</option>'; |
|
| 2195 | - if (empty($readonlyForSituation)) echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true)); |
|
| 2196 | - echo '</select>'; |
|
| 2197 | - echo '</div>'; |
|
| 2198 | - |
|
| 2199 | - if (!empty($conf->global->INVOICE_USE_SITUATION) && $object->element == 'facture' && $object->type == Facture::TYPE_SITUATION) |
|
| 2200 | - { |
|
| 2201 | - echo '<div>'; |
|
| 2202 | - echo '<label for="subtotal_progress">'.$langs->trans('subtotal_apply_progress').'</label> <input id="subtotal_progress" name="subtotal_progress" value="" size="1" />%'; |
|
| 2203 | - echo '</div>'; |
|
| 2204 | - } |
|
| 2205 | - echo '<div>'; |
|
| 2206 | - 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"' : '') .' /> '; |
|
| 2207 | - echo '<label for="subtotal-showTotalHT">'.$langs->trans('ShowTotalHTOnSubtotalBlock').'</label>'; |
|
| 2208 | - echo '</div>'; |
|
| 2209 | - |
|
| 2210 | - echo '<div>'; |
|
| 2211 | - 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"' : '') .' /> '; |
|
| 2212 | - echo '<label for="subtotal-showReduc">'.$langs->trans('ShowReducOnSubtotalBlock').'</label>'; |
|
| 2213 | - echo '</div>'; |
|
| 2214 | - } |
|
| 2215 | - else if ($isFreeText) echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation); |
|
| 2184 | + echo '<div>'; |
|
| 2185 | + echo '<input style="vertical-align:sub;" type="checkbox" name="line-pagebreak" id="subtotal-pagebreak" value="8" '.(($line->info_bits > 0) ? 'checked="checked"' : '') .' /> '; |
|
| 2186 | + echo '<label for="subtotal-pagebreak">'.$langs->trans('AddBreakPageBefore').'</label>'; |
|
| 2187 | + echo '</div>'; |
|
| 2188 | + |
|
| 2189 | + if (TSubtotal::isTitle($line)) |
|
| 2190 | + { |
|
| 2191 | + $form = new Form($db); |
|
| 2192 | + echo '<div>'; |
|
| 2193 | + echo '<label for="subtotal_tva_tx">'.$form->textwithpicto($langs->trans('subtotal_apply_default_tva'), $langs->trans('subtotal_apply_default_tva_help')).'</label>'; |
|
| 2194 | + echo '<select id="subtotal_tva_tx" name="subtotal_tva_tx" class="flat"><option selected="selected" value="">-</option>'; |
|
| 2195 | + if (empty($readonlyForSituation)) echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true)); |
|
| 2196 | + echo '</select>'; |
|
| 2197 | + echo '</div>'; |
|
| 2198 | + |
|
| 2199 | + if (!empty($conf->global->INVOICE_USE_SITUATION) && $object->element == 'facture' && $object->type == Facture::TYPE_SITUATION) |
|
| 2200 | + { |
|
| 2201 | + echo '<div>'; |
|
| 2202 | + echo '<label for="subtotal_progress">'.$langs->trans('subtotal_apply_progress').'</label> <input id="subtotal_progress" name="subtotal_progress" value="" size="1" />%'; |
|
| 2203 | + echo '</div>'; |
|
| 2204 | + } |
|
| 2205 | + echo '<div>'; |
|
| 2206 | + 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"' : '') .' /> '; |
|
| 2207 | + echo '<label for="subtotal-showTotalHT">'.$langs->trans('ShowTotalHTOnSubtotalBlock').'</label>'; |
|
| 2208 | + echo '</div>'; |
|
| 2209 | + |
|
| 2210 | + echo '<div>'; |
|
| 2211 | + 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"' : '') .' /> '; |
|
| 2212 | + echo '<label for="subtotal-showReduc">'.$langs->trans('ShowReducOnSubtotalBlock').'</label>'; |
|
| 2213 | + echo '</div>'; |
|
| 2214 | + } |
|
| 2215 | + else if ($isFreeText) echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation); |
|
| 2216 | 2216 | echo '</div>'; |
| 2217 | 2217 | |
| 2218 | 2218 | if($line->qty<10) { |
@@ -2729,17 +2729,17 @@ discard block |
||
| 2729 | 2729 | if ($object->statut == 0 && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && $action != 'editline') |
| 2730 | 2730 | { |
| 2731 | 2731 | |
| 2732 | - if($object->element == 'invoice_supplier' || $object->element == 'order_supplier') |
|
| 2733 | - { |
|
| 2734 | - foreach ($object->lines as $line) |
|
| 2735 | - { |
|
| 2736 | - // fetch optionals attributes and labels |
|
| 2737 | - require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); |
|
| 2738 | - $extrafields=new ExtraFields($this->db); |
|
| 2739 | - $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true); |
|
| 2740 | - $line->fetch_optionals($line->id,$extralabels); |
|
| 2741 | - } |
|
| 2742 | - } |
|
| 2732 | + if($object->element == 'invoice_supplier' || $object->element == 'order_supplier') |
|
| 2733 | + { |
|
| 2734 | + foreach ($object->lines as $line) |
|
| 2735 | + { |
|
| 2736 | + // fetch optionals attributes and labels |
|
| 2737 | + require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); |
|
| 2738 | + $extrafields=new ExtraFields($this->db); |
|
| 2739 | + $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true); |
|
| 2740 | + $line->fetch_optionals($line->id,$extralabels); |
|
| 2741 | + } |
|
| 2742 | + } |
|
| 2743 | 2743 | |
| 2744 | 2744 | $TSubNc = array(); |
| 2745 | 2745 | foreach ($object->lines as &$l) |
@@ -2830,80 +2830,80 @@ discard block |
||
| 2830 | 2830 | { |
| 2831 | 2831 | dol_include_once('/subtotal/class/subtotal.class.php'); |
| 2832 | 2832 | |
| 2833 | - $line = &$parameters['line']; |
|
| 2833 | + $line = &$parameters['line']; |
|
| 2834 | 2834 | |
| 2835 | - $ThtmlData['data-id'] = $line->id; |
|
| 2836 | - $ThtmlData['data-product_type'] = $line->product_type; |
|
| 2837 | - $ThtmlData['data-qty'] = 0; //$line->qty; |
|
| 2838 | - $ThtmlData['data-level'] = TSubtotal::getNiveau($line); |
|
| 2835 | + $ThtmlData['data-id'] = $line->id; |
|
| 2836 | + $ThtmlData['data-product_type'] = $line->product_type; |
|
| 2837 | + $ThtmlData['data-qty'] = 0; //$line->qty; |
|
| 2838 | + $ThtmlData['data-level'] = TSubtotal::getNiveau($line); |
|
| 2839 | 2839 | |
| 2840 | - if(TSubtotal::isTitle($line)){ |
|
| 2841 | - $ThtmlData['data-issubtotal'] = 'title'; |
|
| 2842 | - }elseif(TSubtotal::isSubtotal($line)){ |
|
| 2843 | - $ThtmlData['data-issubtotal'] = 'subtotal'; |
|
| 2844 | - } |
|
| 2845 | - else{ |
|
| 2846 | - $ThtmlData['data-issubtotal'] = 'freetext'; |
|
| 2847 | - } |
|
| 2840 | + if(TSubtotal::isTitle($line)){ |
|
| 2841 | + $ThtmlData['data-issubtotal'] = 'title'; |
|
| 2842 | + }elseif(TSubtotal::isSubtotal($line)){ |
|
| 2843 | + $ThtmlData['data-issubtotal'] = 'subtotal'; |
|
| 2844 | + } |
|
| 2845 | + else{ |
|
| 2846 | + $ThtmlData['data-issubtotal'] = 'freetext'; |
|
| 2847 | + } |
|
| 2848 | 2848 | |
| 2849 | 2849 | |
| 2850 | - // Change or add data from hooks |
|
| 2851 | - $parameters = array_replace($parameters , array( 'ThtmlData' => $ThtmlData ) ); |
|
| 2850 | + // Change or add data from hooks |
|
| 2851 | + $parameters = array_replace($parameters , array( 'ThtmlData' => $ThtmlData ) ); |
|
| 2852 | 2852 | |
| 2853 | - // hook |
|
| 2854 | - $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
|
| 2855 | - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 2856 | - if ($reshook>0) |
|
| 2857 | - { |
|
| 2858 | - $ThtmlData = $hookmanager->resArray; |
|
| 2859 | - } |
|
| 2860 | - |
|
| 2861 | - return $this->implodeHtmlData($ThtmlData); |
|
| 2853 | + // hook |
|
| 2854 | + $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
|
| 2855 | + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 2856 | + if ($reshook>0) |
|
| 2857 | + { |
|
| 2858 | + $ThtmlData = $hookmanager->resArray; |
|
| 2859 | + } |
|
| 2860 | + |
|
| 2861 | + return $this->implodeHtmlData($ThtmlData); |
|
| 2862 | 2862 | |
| 2863 | 2863 | } |
| 2864 | 2864 | |
| 2865 | 2865 | |
| 2866 | 2866 | function implodeHtmlData($ThtmlData = array()) |
| 2867 | 2867 | { |
| 2868 | - $data = ''; |
|
| 2869 | - foreach($ThtmlData as $k => $h ) |
|
| 2870 | - { |
|
| 2871 | - if(is_array($h)) |
|
| 2872 | - { |
|
| 2873 | - $h = json_encode($h); |
|
| 2874 | - } |
|
| 2868 | + $data = ''; |
|
| 2869 | + foreach($ThtmlData as $k => $h ) |
|
| 2870 | + { |
|
| 2871 | + if(is_array($h)) |
|
| 2872 | + { |
|
| 2873 | + $h = json_encode($h); |
|
| 2874 | + } |
|
| 2875 | 2875 | |
| 2876 | - $data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" '; |
|
| 2877 | - } |
|
| 2876 | + $data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" '; |
|
| 2877 | + } |
|
| 2878 | 2878 | |
| 2879 | - return $data; |
|
| 2879 | + return $data; |
|
| 2880 | 2880 | } |
| 2881 | 2881 | |
| 2882 | 2882 | function _ajax_block_order_js($object) |
| 2883 | 2883 | { |
| 2884 | - global $conf,$tagidfortablednd,$filepath,$langs; |
|
| 2884 | + global $conf,$tagidfortablednd,$filepath,$langs; |
|
| 2885 | 2885 | |
| 2886 | - /* |
|
| 2886 | + /* |
|
| 2887 | 2887 | * this part of js is base on dolibarr htdocs/core/tpl/ajaxrow.tpl.php |
| 2888 | 2888 | * for compatibility reasons we don't use tableDnD but jquery sortable |
| 2889 | 2889 | */ |
| 2890 | 2890 | |
| 2891 | - $id=$object->id; |
|
| 2892 | - $nboflines=(isset($object->lines)?count($object->lines):0); |
|
| 2893 | - $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1; |
|
| 2891 | + $id=$object->id; |
|
| 2892 | + $nboflines=(isset($object->lines)?count($object->lines):0); |
|
| 2893 | + $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1; |
|
| 2894 | 2894 | |
| 2895 | - $id=$object->id; |
|
| 2896 | - $fk_element=$object->fk_element; |
|
| 2897 | - $table_element_line=$object->table_element_line; |
|
| 2898 | - $nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines)); |
|
| 2899 | - $tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd); |
|
| 2900 | - $filepath=(empty($filepath)?'':$filepath); |
|
| 2895 | + $id=$object->id; |
|
| 2896 | + $fk_element=$object->fk_element; |
|
| 2897 | + $table_element_line=$object->table_element_line; |
|
| 2898 | + $nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines)); |
|
| 2899 | + $tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd); |
|
| 2900 | + $filepath=(empty($filepath)?'':$filepath); |
|
| 2901 | 2901 | |
| 2902 | 2902 | |
| 2903 | - if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1) |
|
| 2904 | - { |
|
| 2903 | + if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1) |
|
| 2904 | + { |
|
| 2905 | 2905 | |
| 2906 | - ?> |
|
| 2906 | + ?> |
|
| 2907 | 2907 | |
| 2908 | 2908 | |
| 2909 | 2909 | <script type="text/javascript"> |