@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | // Dolibarr environment |
| 26 | 26 | $res = @include("../../main.inc.php"); // From htdocs directory |
| 27 | 27 | if (! $res) { |
| 28 | - $res = @include("../../../main.inc.php"); // From "custom" directory |
|
| 28 | + $res = @include("../../../main.inc.php"); // From "custom" directory |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | // Libraries |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | // Access control |
| 39 | 39 | if (! $user->admin) { |
| 40 | - accessforbidden(); |
|
| 40 | + accessforbidden(); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /* |
@@ -48,17 +48,17 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | // Subheader |
| 50 | 50 | $linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' |
| 51 | - . $langs->trans("BackToModuleList") . '</a>'; |
|
| 51 | + . $langs->trans("BackToModuleList") . '</a>'; |
|
| 52 | 52 | print_fiche_titre($langs->trans($page_name), $linkback); |
| 53 | 53 | |
| 54 | 54 | // Configuration header |
| 55 | 55 | $head = subtotalAdminPrepareHead(); |
| 56 | 56 | dol_fiche_head( |
| 57 | - $head, |
|
| 58 | - 'about', |
|
| 59 | - $langs->trans("Module104777Name"), |
|
| 60 | - 0, |
|
| 61 | - 'subtotal@subtotal' |
|
| 57 | + $head, |
|
| 58 | + 'about', |
|
| 59 | + $langs->trans("Module104777Name"), |
|
| 60 | + 0, |
|
| 61 | + 'subtotal@subtotal' |
|
| 62 | 62 | ); |
| 63 | 63 | |
| 64 | 64 | // About page goes here |
@@ -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(); |
@@ -47,11 +47,11 @@ discard block |
||
| 47 | 47 | * @return void |
| 48 | 48 | */ |
| 49 | 49 | |
| 50 | - var $module_number = 104777; |
|
| 50 | + var $module_number = 104777; |
|
| 51 | 51 | |
| 52 | - function formObjectOptions($parameters, &$object, &$action, $hookmanager) |
|
| 53 | - { |
|
| 54 | - global $langs,$db,$user, $conf; |
|
| 52 | + function formObjectOptions($parameters, &$object, &$action, $hookmanager) |
|
| 53 | + { |
|
| 54 | + global $langs,$db,$user, $conf; |
|
| 55 | 55 | |
| 56 | 56 | $langs->load('subtotal@subtotal'); |
| 57 | 57 | |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | if (!empty($conf->global->SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE) && $qty < 10) TSubtotal::addSubtotalMissing($object, $qty); |
| 115 | 115 | |
| 116 | - TSubtotal::addSubTotalLine($object, $title, $qty); |
|
| 116 | + TSubtotal::addSubTotalLine($object, $title, $qty); |
|
| 117 | 117 | } |
| 118 | 118 | else if($action==='ask_deleteallline') { |
| 119 | 119 | $form=new Form($db); |
@@ -339,29 +339,29 @@ discard block |
||
| 339 | 339 | || in_array('ordercard',$TContext) |
| 340 | 340 | || in_array('invoicereccard',$TContext) |
| 341 | 341 | ) |
| 342 | - { |
|
| 342 | + { |
|
| 343 | 343 | $hideInnerLines = isset( $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']] ) ? $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']] : 0; |
| 344 | 344 | $hidedetails = isset( $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']] ) ? $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']] : 0; |
| 345 | 345 | $hideprices= isset( $_SESSION['subtotal_hideprices_'.$parameters['modulepart']] ) ? $_SESSION['subtotal_hideprices_'.$parameters['modulepart']] : 0; |
| 346 | 346 | |
| 347 | 347 | $var=false; |
| 348 | - $out.= '<tr '.$bc[$var].'> |
|
| 348 | + $out.= '<tr '.$bc[$var].'> |
|
| 349 | 349 | <td colspan="4" align="right"> |
| 350 | 350 | <label for="hideInnerLines">'.$langs->trans('HideInnerLines').'</label> |
| 351 | 351 | <input type="checkbox" onclick="if($(this).is(\':checked\')) { $(\'#hidedetails\').prop(\'checked\', \'checked\') }" id="hideInnerLines" name="hideInnerLines" value="1" '.(( $hideInnerLines ) ? 'checked="checked"' : '' ).' /> |
| 352 | 352 | </td> |
| 353 | 353 | </tr>'; |
| 354 | 354 | |
| 355 | - $var=!$var; |
|
| 356 | - $out.= '<tr '.$bc[$var].'> |
|
| 355 | + $var=!$var; |
|
| 356 | + $out.= '<tr '.$bc[$var].'> |
|
| 357 | 357 | <td colspan="4" align="right"> |
| 358 | 358 | <label for="hidedetails">'.$langs->trans('SubTotalhidedetails').'</label> |
| 359 | 359 | <input type="checkbox" id="hidedetails" name="hidedetails" value="1" '.(( $hidedetails ) ? 'checked="checked"' : '' ).' /> |
| 360 | 360 | </td> |
| 361 | 361 | </tr>'; |
| 362 | 362 | |
| 363 | - $var=!$var; |
|
| 364 | - $out.= '<tr '.$bc[$var].'> |
|
| 363 | + $var=!$var; |
|
| 364 | + $out.= '<tr '.$bc[$var].'> |
|
| 365 | 365 | <td colspan="4" align="right"> |
| 366 | 366 | <label for="hidedetails">'.$langs->trans('SubTotalhidePrice').'</label> |
| 367 | 367 | <input type="checkbox" id="hideprices" name="hideprices" value="1" '.(( $hideprices ) ? 'checked="checked"' : '' ).' /> |
@@ -392,19 +392,19 @@ discard block |
||
| 392 | 392 | } |
| 393 | 393 | |
| 394 | 394 | |
| 395 | - return 1; |
|
| 395 | + return 1; |
|
| 396 | 396 | } |
| 397 | 397 | |
| 398 | - function formEditProductOptions($parameters, &$object, &$action, $hookmanager) |
|
| 399 | - { |
|
| 398 | + function formEditProductOptions($parameters, &$object, &$action, $hookmanager) |
|
| 399 | + { |
|
| 400 | 400 | |
| 401 | - if (in_array('invoicecard',explode(':',$parameters['context']))) |
|
| 402 | - { |
|
| 401 | + if (in_array('invoicecard',explode(':',$parameters['context']))) |
|
| 402 | + { |
|
| 403 | 403 | |
| 404 | - } |
|
| 404 | + } |
|
| 405 | 405 | |
| 406 | - return 0; |
|
| 407 | - } |
|
| 406 | + return 0; |
|
| 407 | + } |
|
| 408 | 408 | |
| 409 | 409 | function ODTSubstitutionLine(&$parameters, &$object, $action, $hookmanager) { |
| 410 | 410 | global $conf; |
@@ -534,7 +534,7 @@ discard block |
||
| 534 | 534 | || in_array('propalcard',explode(':',$parameters['context'])) |
| 535 | 535 | || in_array('ordercard',explode(':',$parameters['context'])) |
| 536 | 536 | ) |
| 537 | - { |
|
| 537 | + { |
|
| 538 | 538 | if(in_array('invoicecard',explode(':',$parameters['context']))) { |
| 539 | 539 | $sessname = 'subtotal_hideInnerLines_facture'; |
| 540 | 540 | $sessname2 = 'subtotal_hidedetails_facture'; |
@@ -570,17 +570,17 @@ discard block |
||
| 570 | 570 | foreach($object->lines as &$line) { |
| 571 | 571 | if ($line->product_type == 9 && $line->special_code == $this->module_number) { |
| 572 | 572 | |
| 573 | - if($line->qty>=90) { |
|
| 574 | - $line->modsubtotal_total = 1; |
|
| 575 | - } |
|
| 576 | - else{ |
|
| 577 | - $line->modsubtotal_title = 1; |
|
| 578 | - } |
|
| 573 | + if($line->qty>=90) { |
|
| 574 | + $line->modsubtotal_total = 1; |
|
| 575 | + } |
|
| 576 | + else{ |
|
| 577 | + $line->modsubtotal_title = 1; |
|
| 578 | + } |
|
| 579 | 579 | |
| 580 | 580 | $line->total_ht = $this->getTotalLineFromObject($object, $line, ''); |
| 581 | 581 | } |
| 582 | - } |
|
| 583 | - } |
|
| 582 | + } |
|
| 583 | + } |
|
| 584 | 584 | |
| 585 | 585 | } |
| 586 | 586 | else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') { |
@@ -732,17 +732,17 @@ discard block |
||
| 732 | 732 | if($l->rang>=$rang) { |
| 733 | 733 | return price($total); |
| 734 | 734 | } |
| 735 | - if (TSubtotal::isSubtotal($l)){ |
|
| 736 | - $total = 0; |
|
| 737 | - } else if ($l->situation_percent > 0 ){ |
|
| 735 | + if (TSubtotal::isSubtotal($l)){ |
|
| 736 | + $total = 0; |
|
| 737 | + } else if ($l->situation_percent > 0 ){ |
|
| 738 | 738 | |
| 739 | 739 | |
| 740 | 740 | $prev_progress = $l->get_prev_progress($object->id); |
| 741 | 741 | $progress = ($l->situation_percent - $prev_progress) /100; |
| 742 | - $total += ($l->total_ht/($l->situation_percent/100)) * $progress; |
|
| 742 | + $total += ($l->total_ht/($l->situation_percent/100)) * $progress; |
|
| 743 | 743 | |
| 744 | - } |
|
| 745 | - } |
|
| 744 | + } |
|
| 745 | + } |
|
| 746 | 746 | |
| 747 | 747 | return price($total); |
| 748 | 748 | } |
@@ -774,7 +774,7 @@ discard block |
||
| 774 | 774 | if(method_exists('Closure','bind')) { |
| 775 | 775 | $pageBreakOriginalValue = $pdf->AcceptPageBreak(); |
| 776 | 776 | $sweetsThief = function ($pdf) { |
| 777 | - return $pdf->bMargin ; |
|
| 777 | + return $pdf->bMargin ; |
|
| 778 | 778 | }; |
| 779 | 779 | $sweetsThief = Closure::bind($sweetsThief, null, $pdf); |
| 780 | 780 | |
@@ -837,11 +837,11 @@ discard block |
||
| 837 | 837 | else |
| 838 | 838 | { |
| 839 | 839 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
| 840 | - if(get_class($object) == 'Facture' && $object->type==Facture::TYPE_SITUATION){//Facture de situation |
|
| 841 | - $total_to_print = $this->getTotalToPrintSituation($object, $line); |
|
| 842 | - } else { |
|
| 843 | - $total_to_print = price($total); |
|
| 844 | - } |
|
| 840 | + if(get_class($object) == 'Facture' && $object->type==Facture::TYPE_SITUATION){//Facture de situation |
|
| 841 | + $total_to_print = $this->getTotalToPrintSituation($object, $line); |
|
| 842 | + } else { |
|
| 843 | + $total_to_print = price($total); |
|
| 844 | + } |
|
| 845 | 845 | |
| 846 | 846 | $line->total_ht = $total; |
| 847 | 847 | $line->total = $total; |
@@ -1030,19 +1030,19 @@ discard block |
||
| 1030 | 1030 | } |
| 1031 | 1031 | } |
| 1032 | 1032 | if ((int)GETPOST('hideInnerLines') && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)){ |
| 1033 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1034 | - else $i = (int)$parameters; |
|
| 1035 | - $this->resprints = price($object->lines[$i]->total_ht); |
|
| 1033 | + if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1034 | + else $i = (int)$parameters; |
|
| 1035 | + $this->resprints = price($object->lines[$i]->total_ht); |
|
| 1036 | 1036 | } |
| 1037 | 1037 | if (!empty($hideprices) |
| 1038 | - || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
| 1039 | - ) |
|
| 1038 | + || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
| 1039 | + ) |
|
| 1040 | 1040 | { |
| 1041 | - if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
| 1042 | - { |
|
| 1043 | - $this->resprints = ' '; |
|
| 1044 | - return 1; |
|
| 1045 | - } |
|
| 1041 | + if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
| 1042 | + { |
|
| 1043 | + $this->resprints = ' '; |
|
| 1044 | + return 1; |
|
| 1045 | + } |
|
| 1046 | 1046 | } |
| 1047 | 1047 | |
| 1048 | 1048 | return 0; |
@@ -1322,11 +1322,11 @@ discard block |
||
| 1322 | 1322 | $hidedetails = (int)GETPOST('hidedetails'); |
| 1323 | 1323 | |
| 1324 | 1324 | if ($hideInnerLines) { // si c une ligne de titre |
| 1325 | - $fk_parent_line=0; |
|
| 1325 | + $fk_parent_line=0; |
|
| 1326 | 1326 | $TLines =array(); |
| 1327 | 1327 | |
| 1328 | 1328 | $original_count=count($object->lines); |
| 1329 | - $TTvas = array(); // tableau de tva |
|
| 1329 | + $TTvas = array(); // tableau de tva |
|
| 1330 | 1330 | |
| 1331 | 1331 | foreach($object->lines as $k=>&$line) |
| 1332 | 1332 | { |
@@ -1356,48 +1356,48 @@ discard block |
||
| 1356 | 1356 | |
| 1357 | 1357 | if ($hideInnerLines) |
| 1358 | 1358 | { |
| 1359 | - if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
| 1360 | - { |
|
| 1361 | - if($line->tva_tx != '0.000' && $line->product_type!=9){ |
|
| 1359 | + if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
| 1360 | + { |
|
| 1361 | + if($line->tva_tx != '0.000' && $line->product_type!=9){ |
|
| 1362 | 1362 | |
| 1363 | - // on remplit le tableau de tva pour substituer les lignes cachées |
|
| 1364 | - $TTvas[$line->tva_tx]['total_tva'] += $line->total_tva; |
|
| 1365 | - $TTvas[$line->tva_tx]['total_ht'] += $line->total_ht; |
|
| 1366 | - $TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; |
|
| 1367 | - } |
|
| 1368 | - if($line->product_type==9 && $line->rowid>0) |
|
| 1369 | - { |
|
| 1370 | - //Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres |
|
| 1371 | - // génère des lignes d'affichage des montants HT soumis à tva |
|
| 1372 | - $nbtva = count($TTvas); |
|
| 1373 | - if(!empty($nbtva)){ |
|
| 1374 | - foreach ($TTvas as $tx =>$val){ |
|
| 1375 | - $l = clone $line; |
|
| 1376 | - $l->product_type = 1; |
|
| 1377 | - $l->special_code = ''; |
|
| 1378 | - $l->qty = 1; |
|
| 1379 | - $l->desc = 'Montant HT soumis à '.$langs->trans('VAT').' '. price($tx) .' %'; |
|
| 1380 | - $l->tva_tx = $tx; |
|
| 1381 | - $l->total_ht = $val['total_ht']; |
|
| 1382 | - $l->total_tva = $val['total_tva']; |
|
| 1383 | - $l->total = $line->total_ht; |
|
| 1384 | - $l->total_ttc = $val['total_ttc']; |
|
| 1385 | - $TLines[] = $l; |
|
| 1386 | - array_shift($TTvas); |
|
| 1387 | - } |
|
| 1388 | - } |
|
| 1363 | + // on remplit le tableau de tva pour substituer les lignes cachées |
|
| 1364 | + $TTvas[$line->tva_tx]['total_tva'] += $line->total_tva; |
|
| 1365 | + $TTvas[$line->tva_tx]['total_ht'] += $line->total_ht; |
|
| 1366 | + $TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; |
|
| 1367 | + } |
|
| 1368 | + if($line->product_type==9 && $line->rowid>0) |
|
| 1369 | + { |
|
| 1370 | + //Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres |
|
| 1371 | + // génère des lignes d'affichage des montants HT soumis à tva |
|
| 1372 | + $nbtva = count($TTvas); |
|
| 1373 | + if(!empty($nbtva)){ |
|
| 1374 | + foreach ($TTvas as $tx =>$val){ |
|
| 1375 | + $l = clone $line; |
|
| 1376 | + $l->product_type = 1; |
|
| 1377 | + $l->special_code = ''; |
|
| 1378 | + $l->qty = 1; |
|
| 1379 | + $l->desc = 'Montant HT soumis à '.$langs->trans('VAT').' '. price($tx) .' %'; |
|
| 1380 | + $l->tva_tx = $tx; |
|
| 1381 | + $l->total_ht = $val['total_ht']; |
|
| 1382 | + $l->total_tva = $val['total_tva']; |
|
| 1383 | + $l->total = $line->total_ht; |
|
| 1384 | + $l->total_ttc = $val['total_ttc']; |
|
| 1385 | + $TLines[] = $l; |
|
| 1386 | + array_shift($TTvas); |
|
| 1387 | + } |
|
| 1388 | + } |
|
| 1389 | 1389 | |
| 1390 | - // ajoute la ligne de sous-total |
|
| 1391 | - $TLines[] = $line; |
|
| 1392 | - } |
|
| 1393 | - } else { |
|
| 1390 | + // ajoute la ligne de sous-total |
|
| 1391 | + $TLines[] = $line; |
|
| 1392 | + } |
|
| 1393 | + } else { |
|
| 1394 | 1394 | |
| 1395 | - if($line->product_type==9 && $line->rowid>0) |
|
| 1396 | - { |
|
| 1397 | - // ajoute la ligne de sous-total |
|
| 1398 | - $TLines[] = $line; |
|
| 1399 | - } |
|
| 1400 | - } |
|
| 1395 | + if($line->product_type==9 && $line->rowid>0) |
|
| 1396 | + { |
|
| 1397 | + // ajoute la ligne de sous-total |
|
| 1398 | + $TLines[] = $line; |
|
| 1399 | + } |
|
| 1400 | + } |
|
| 1401 | 1401 | |
| 1402 | 1402 | |
| 1403 | 1403 | } |
@@ -1422,20 +1422,20 @@ discard block |
||
| 1422 | 1422 | $nbtva = count($TTvas); |
| 1423 | 1423 | if(!empty($nbtva) && $hideInnerLines && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
| 1424 | 1424 | { |
| 1425 | - foreach ($TTvas as $tx =>$val){ |
|
| 1426 | - $l = clone $line; |
|
| 1427 | - $l->product_type = 1; |
|
| 1428 | - $l->special_code = ''; |
|
| 1429 | - $l->qty = 1; |
|
| 1430 | - $l->desc = 'Montant HT soumis à '.$langs->trans('VAT').' '. price($tx) .' %'; |
|
| 1431 | - $l->tva_tx = $tx; |
|
| 1432 | - $l->total_ht = $val['total_ht']; |
|
| 1433 | - $l->total_tva = $val['total_tva']; |
|
| 1434 | - $l->total = $line->total_ht; |
|
| 1435 | - $l->total_ttc = $val['total_ttc']; |
|
| 1436 | - $TLines[] = $l; |
|
| 1437 | - array_shift($TTvas); |
|
| 1438 | - } |
|
| 1425 | + foreach ($TTvas as $tx =>$val){ |
|
| 1426 | + $l = clone $line; |
|
| 1427 | + $l->product_type = 1; |
|
| 1428 | + $l->special_code = ''; |
|
| 1429 | + $l->qty = 1; |
|
| 1430 | + $l->desc = 'Montant HT soumis à '.$langs->trans('VAT').' '. price($tx) .' %'; |
|
| 1431 | + $l->tva_tx = $tx; |
|
| 1432 | + $l->total_ht = $val['total_ht']; |
|
| 1433 | + $l->total_tva = $val['total_tva']; |
|
| 1434 | + $l->total = $line->total_ht; |
|
| 1435 | + $l->total_ttc = $val['total_ttc']; |
|
| 1436 | + $TLines[] = $l; |
|
| 1437 | + array_shift($TTvas); |
|
| 1438 | + } |
|
| 1439 | 1439 | } |
| 1440 | 1440 | |
| 1441 | 1441 | global $nblignes; |
@@ -1447,7 +1447,7 @@ discard block |
||
| 1447 | 1447 | $this->resprints = ''; |
| 1448 | 1448 | return 0; |
| 1449 | 1449 | } |
| 1450 | - } |
|
| 1450 | + } |
|
| 1451 | 1451 | |
| 1452 | 1452 | return 0; |
| 1453 | 1453 | } |
@@ -1613,7 +1613,7 @@ discard block |
||
| 1613 | 1613 | null; |
| 1614 | 1614 | } |
| 1615 | 1615 | else if (in_array('invoicecard',$contexts) || in_array('propalcard',$contexts) || in_array('ordercard',$contexts) || in_array('invoicereccard',$contexts)) |
| 1616 | - { |
|
| 1616 | + { |
|
| 1617 | 1617 | if($object->element=='facture')$idvar = 'facid'; |
| 1618 | 1618 | else $idvar='id'; |
| 1619 | 1619 | |
@@ -1658,7 +1658,7 @@ discard block |
||
| 1658 | 1658 | //var_dump($line); |
| 1659 | 1659 | |
| 1660 | 1660 | // HTML 5 data for js |
| 1661 | - $data = $this->_getHtmlData($parameters, $object, $action, $hookmanager); |
|
| 1661 | + $data = $this->_getHtmlData($parameters, $object, $action, $hookmanager); |
|
| 1662 | 1662 | |
| 1663 | 1663 | |
| 1664 | 1664 | ?> |
@@ -2087,80 +2087,80 @@ discard block |
||
| 2087 | 2087 | // HTML 5 data for js |
| 2088 | 2088 | private function _getHtmlData($parameters, &$object, &$action, $hookmanager) |
| 2089 | 2089 | { |
| 2090 | - $line = &$parameters['line']; |
|
| 2090 | + $line = &$parameters['line']; |
|
| 2091 | 2091 | |
| 2092 | - $ThtmlData['data-id'] = $line->id; |
|
| 2093 | - $ThtmlData['data-product_type'] = $line->product_type; |
|
| 2094 | - $ThtmlData['data-qty'] = 0; //$line->qty; |
|
| 2095 | - $ThtmlData['data-level'] = TSubtotal::getNiveau($line); |
|
| 2092 | + $ThtmlData['data-id'] = $line->id; |
|
| 2093 | + $ThtmlData['data-product_type'] = $line->product_type; |
|
| 2094 | + $ThtmlData['data-qty'] = 0; //$line->qty; |
|
| 2095 | + $ThtmlData['data-level'] = TSubtotal::getNiveau($line); |
|
| 2096 | 2096 | |
| 2097 | - if(TSubtotal::isTitle($line)){ |
|
| 2098 | - $ThtmlData['data-issubtotal'] = 'title'; |
|
| 2099 | - }elseif(TSubtotal::isSubtotal($line)){ |
|
| 2100 | - $ThtmlData['data-issubtotal'] = 'subtotal'; |
|
| 2101 | - } |
|
| 2102 | - else{ |
|
| 2103 | - $ThtmlData['data-issubtotal'] = 'freetext'; |
|
| 2104 | - } |
|
| 2097 | + if(TSubtotal::isTitle($line)){ |
|
| 2098 | + $ThtmlData['data-issubtotal'] = 'title'; |
|
| 2099 | + }elseif(TSubtotal::isSubtotal($line)){ |
|
| 2100 | + $ThtmlData['data-issubtotal'] = 'subtotal'; |
|
| 2101 | + } |
|
| 2102 | + else{ |
|
| 2103 | + $ThtmlData['data-issubtotal'] = 'freetext'; |
|
| 2104 | + } |
|
| 2105 | 2105 | |
| 2106 | 2106 | |
| 2107 | - // Change or add data from hooks |
|
| 2108 | - $parameters = array_replace($parameters , array( 'ThtmlData' => $ThtmlData ) ); |
|
| 2107 | + // Change or add data from hooks |
|
| 2108 | + $parameters = array_replace($parameters , array( 'ThtmlData' => $ThtmlData ) ); |
|
| 2109 | 2109 | |
| 2110 | - // hook |
|
| 2111 | - $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
|
| 2112 | - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 2113 | - if ($reshook>0) |
|
| 2114 | - { |
|
| 2115 | - $ThtmlData = $hookmanager->resArray; |
|
| 2116 | - } |
|
| 2117 | - |
|
| 2118 | - return $this->implodeHtmlData($ThtmlData); |
|
| 2110 | + // hook |
|
| 2111 | + $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
|
| 2112 | + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 2113 | + if ($reshook>0) |
|
| 2114 | + { |
|
| 2115 | + $ThtmlData = $hookmanager->resArray; |
|
| 2116 | + } |
|
| 2117 | + |
|
| 2118 | + return $this->implodeHtmlData($ThtmlData); |
|
| 2119 | 2119 | |
| 2120 | 2120 | } |
| 2121 | 2121 | |
| 2122 | 2122 | |
| 2123 | 2123 | function implodeHtmlData($ThtmlData = array()) |
| 2124 | 2124 | { |
| 2125 | - $data = ''; |
|
| 2126 | - foreach($ThtmlData as $k => $h ) |
|
| 2127 | - { |
|
| 2128 | - if(is_array($h)) |
|
| 2129 | - { |
|
| 2130 | - $h = json_encode($h); |
|
| 2131 | - } |
|
| 2125 | + $data = ''; |
|
| 2126 | + foreach($ThtmlData as $k => $h ) |
|
| 2127 | + { |
|
| 2128 | + if(is_array($h)) |
|
| 2129 | + { |
|
| 2130 | + $h = json_encode($h); |
|
| 2131 | + } |
|
| 2132 | 2132 | |
| 2133 | - $data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" '; |
|
| 2134 | - } |
|
| 2133 | + $data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" '; |
|
| 2134 | + } |
|
| 2135 | 2135 | |
| 2136 | - return $data; |
|
| 2136 | + return $data; |
|
| 2137 | 2137 | } |
| 2138 | 2138 | |
| 2139 | 2139 | function _ajax_block_order_js($object) |
| 2140 | 2140 | { |
| 2141 | - global $conf,$tagidfortablednd,$filepath,$langs; |
|
| 2141 | + global $conf,$tagidfortablednd,$filepath,$langs; |
|
| 2142 | 2142 | |
| 2143 | - /* |
|
| 2143 | + /* |
|
| 2144 | 2144 | * this part of js is base on dolibarr htdocs/core/tpl/ajaxrow.tpl.php |
| 2145 | 2145 | * for compatibility reasons we don't use tableDnD but jquery sortable |
| 2146 | 2146 | */ |
| 2147 | 2147 | |
| 2148 | - $id=$object->id; |
|
| 2149 | - $nboflines=(isset($object->lines)?count($object->lines):0); |
|
| 2150 | - $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1; |
|
| 2148 | + $id=$object->id; |
|
| 2149 | + $nboflines=(isset($object->lines)?count($object->lines):0); |
|
| 2150 | + $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1; |
|
| 2151 | 2151 | |
| 2152 | - $id=$object->id; |
|
| 2153 | - $fk_element=$object->fk_element; |
|
| 2154 | - $table_element_line=$object->table_element_line; |
|
| 2155 | - $nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines)); |
|
| 2156 | - $tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd); |
|
| 2157 | - $filepath=(empty($filepath)?'':$filepath); |
|
| 2152 | + $id=$object->id; |
|
| 2153 | + $fk_element=$object->fk_element; |
|
| 2154 | + $table_element_line=$object->table_element_line; |
|
| 2155 | + $nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines)); |
|
| 2156 | + $tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd); |
|
| 2157 | + $filepath=(empty($filepath)?'':$filepath); |
|
| 2158 | 2158 | |
| 2159 | 2159 | |
| 2160 | - if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1) |
|
| 2161 | - { |
|
| 2160 | + if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1) |
|
| 2161 | + { |
|
| 2162 | 2162 | |
| 2163 | - ?> |
|
| 2163 | + ?> |
|
| 2164 | 2164 | |
| 2165 | 2165 | |
| 2166 | 2166 | <script type="text/javascript"> |
@@ -909,8 +909,8 @@ discard block |
||
| 909 | 909 | { |
| 910 | 910 | if (is_readable($logo)) |
| 911 | 911 | { |
| 912 | - $height=pdf_getHeightForLogo($logo); |
|
| 913 | - $pdf->Image($logo, $objmarge->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
| 912 | + $height=pdf_getHeightForLogo($logo); |
|
| 913 | + $pdf->Image($logo, $objmarge->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
| 914 | 914 | } |
| 915 | 915 | else |
| 916 | 916 | { |
@@ -1101,13 +1101,13 @@ discard block |
||
| 1101 | 1101 | * @param int $hidebottom Hide bottom |
| 1102 | 1102 | * @return void |
| 1103 | 1103 | */ |
| 1104 | - private static function printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0) |
|
| 1105 | - { |
|
| 1106 | - if (empty($hidetop) || $hidetop==-1) $pdf->line($x, $y, $x+$l, $y); |
|
| 1107 | - $pdf->line($x+$l, $y, $x+$l, $y+$h); |
|
| 1108 | - if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h); |
|
| 1109 | - $pdf->line($x, $y+$h, $x, $y); |
|
| 1110 | - } |
|
| 1104 | + private static function printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0) |
|
| 1105 | + { |
|
| 1106 | + if (empty($hidetop) || $hidetop==-1) $pdf->line($x, $y, $x+$l, $y); |
|
| 1107 | + $pdf->line($x+$l, $y, $x+$l, $y+$h); |
|
| 1108 | + if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h); |
|
| 1109 | + $pdf->line($x, $y+$h, $x, $y); |
|
| 1110 | + } |
|
| 1111 | 1111 | |
| 1112 | 1112 | |
| 1113 | 1113 | public static function concat(&$outputlangs, $files, $fileoutput='') |
@@ -1117,14 +1117,14 @@ discard block |
||
| 1117 | 1117 | if (empty($fileoutput)) $fileoutput = $file[0]; |
| 1118 | 1118 | |
| 1119 | 1119 | $pdf=pdf_getInstance(); |
| 1120 | - if (class_exists('TCPDF')) |
|
| 1121 | - { |
|
| 1122 | - $pdf->setPrintHeader(false); |
|
| 1123 | - $pdf->setPrintFooter(false); |
|
| 1124 | - } |
|
| 1125 | - $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
|
| 1120 | + if (class_exists('TCPDF')) |
|
| 1121 | + { |
|
| 1122 | + $pdf->setPrintHeader(false); |
|
| 1123 | + $pdf->setPrintFooter(false); |
|
| 1124 | + } |
|
| 1125 | + $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
|
| 1126 | 1126 | |
| 1127 | - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
| 1127 | + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
| 1128 | 1128 | |
| 1129 | 1129 | |
| 1130 | 1130 | foreach($files as $file) |
@@ -56,33 +56,33 @@ |
||
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | |
| 59 | - $res = $db->query("SELECT DISTINCT(fk_facture) as fk_facture FROM ".MAIN_DB_PREFIX."facturedet WHERE special_code=104777"); |
|
| 60 | - while($obj = $db->fetch_object($res)) { |
|
| 61 | - $resLine = $db->query("SELECT rowid FROM ".MAIN_DB_PREFIX."facturedet WHERE fk_facture=".$obj->fk_propal." ORDER BY rang "); |
|
| 62 | - $k = 1; |
|
| 63 | - while($objLine = $db->fetch_object($resLine)) { |
|
| 59 | + $res = $db->query("SELECT DISTINCT(fk_facture) as fk_facture FROM ".MAIN_DB_PREFIX."facturedet WHERE special_code=104777"); |
|
| 60 | + while($obj = $db->fetch_object($res)) { |
|
| 61 | + $resLine = $db->query("SELECT rowid FROM ".MAIN_DB_PREFIX."facturedet WHERE fk_facture=".$obj->fk_propal." ORDER BY rang "); |
|
| 62 | + $k = 1; |
|
| 63 | + while($objLine = $db->fetch_object($resLine)) { |
|
| 64 | 64 | |
| 65 | - $sql="UPDATE ".MAIN_DB_PREFIX."facturedet SET rang=".$k.",fk_parent_line=NULL WHERE rowid=".$objLine->rowid; |
|
| 65 | + $sql="UPDATE ".MAIN_DB_PREFIX."facturedet SET rang=".$k.",fk_parent_line=NULL WHERE rowid=".$objLine->rowid; |
|
| 66 | 66 | |
| 67 | - print $sql.";<br />"; |
|
| 68 | - $k++; |
|
| 69 | - } |
|
| 67 | + print $sql.";<br />"; |
|
| 68 | + $k++; |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | - } |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - $res = $db->query("SELECT DISTINCT(fk_commande) as fk_commande FROM ".MAIN_DB_PREFIX."commandedet WHERE special_code=104777"); |
|
| 74 | - while($obj = $db->fetch_object($res)) { |
|
| 75 | - $resLine = $db->query("SELECT rowid FROM ".MAIN_DB_PREFIX."commandedet WHERE fk_commande=".$obj->fk_propal." ORDER BY rang "); |
|
| 76 | - $k = 1; |
|
| 77 | - while($objLine = $db->fetch_object($resLine)) { |
|
| 73 | + $res = $db->query("SELECT DISTINCT(fk_commande) as fk_commande FROM ".MAIN_DB_PREFIX."commandedet WHERE special_code=104777"); |
|
| 74 | + while($obj = $db->fetch_object($res)) { |
|
| 75 | + $resLine = $db->query("SELECT rowid FROM ".MAIN_DB_PREFIX."commandedet WHERE fk_commande=".$obj->fk_propal." ORDER BY rang "); |
|
| 76 | + $k = 1; |
|
| 77 | + while($objLine = $db->fetch_object($resLine)) { |
|
| 78 | 78 | |
| 79 | - $sql="UPDATE ".MAIN_DB_PREFIX."commandedet SET rang=".$k.",fk_parent_line=NULL WHERE rowid=".$objLine->rowid; |
|
| 79 | + $sql="UPDATE ".MAIN_DB_PREFIX."commandedet SET rang=".$k.",fk_parent_line=NULL WHERE rowid=".$objLine->rowid; |
|
| 80 | 80 | |
| 81 | - print $sql.";<br />"; |
|
| 82 | - $k++; |
|
| 83 | - } |
|
| 81 | + print $sql.";<br />"; |
|
| 82 | + $k++; |
|
| 83 | + } |
|
| 84 | 84 | |
| 85 | - } |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | 87 | |
| 88 | 88 | print $sql.";<br />"; |
@@ -127,7 +127,7 @@ |
||
| 127 | 127 | else require_once FPDF_PATH.'fpdf.php'; |
| 128 | 128 | |
| 129 | 129 | // We need to instantiate tcpdi or fpdi object (instead of tcpdf) to use merging features. But we can disable it (this will break all merge features). |
| 130 | - if (empty($conf->global->MAIN_DISABLE_TCPDI)) require_once TCPDI_PATH.'tcpdi.php'; |
|
| 130 | + if (empty($conf->global->MAIN_DISABLE_TCPDI)) require_once TCPDI_PATH.'tcpdi.php'; |
|
| 131 | 131 | else if (empty($conf->global->MAIN_DISABLE_FPDI)) require_once FPDI_PATH.'fpdi.php'; |
| 132 | 132 | |
| 133 | 133 | //$arrayformat=pdf_getFormat(); |
@@ -25,25 +25,25 @@ |
||
| 25 | 25 | |
| 26 | 26 | function subtotalAdminPrepareHead() |
| 27 | 27 | { |
| 28 | - global $langs, $conf; |
|
| 28 | + global $langs, $conf; |
|
| 29 | 29 | |
| 30 | - $langs->load("subtotal@subtotal"); |
|
| 30 | + $langs->load("subtotal@subtotal"); |
|
| 31 | 31 | |
| 32 | - $h = 0; |
|
| 33 | - $head = array(); |
|
| 32 | + $h = 0; |
|
| 33 | + $head = array(); |
|
| 34 | 34 | |
| 35 | - $head[$h][0] = dol_buildpath("/subtotal/admin/subtotal_setup.php", 1); |
|
| 36 | - $head[$h][1] = $langs->trans("Parameters"); |
|
| 37 | - $head[$h][2] = 'settings'; |
|
| 38 | - $h++; |
|
| 39 | - $head[$h][0] = dol_buildpath("/subtotal/admin/subtotal_about.php", 1); |
|
| 40 | - $head[$h][1] = $langs->trans("About"); |
|
| 41 | - $head[$h][2] = 'about'; |
|
| 42 | - $h++; |
|
| 35 | + $head[$h][0] = dol_buildpath("/subtotal/admin/subtotal_setup.php", 1); |
|
| 36 | + $head[$h][1] = $langs->trans("Parameters"); |
|
| 37 | + $head[$h][2] = 'settings'; |
|
| 38 | + $h++; |
|
| 39 | + $head[$h][0] = dol_buildpath("/subtotal/admin/subtotal_about.php", 1); |
|
| 40 | + $head[$h][1] = $langs->trans("About"); |
|
| 41 | + $head[$h][2] = 'about'; |
|
| 42 | + $h++; |
|
| 43 | 43 | |
| 44 | - complete_head_from_modules($conf, $langs, $object, $head, $h, 'subtotal', $showLabel=false); |
|
| 44 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'subtotal', $showLabel=false); |
|
| 45 | 45 | |
| 46 | - return $head; |
|
| 46 | + return $head; |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | function getHtmlSelectTitle(&$object, $showLabel=false) |
@@ -31,170 +31,170 @@ discard block |
||
| 31 | 31 | class modSubtotal extends DolibarrModules |
| 32 | 32 | { |
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * Constructor. Define names, constants, directories, boxes, permissions |
|
| 36 | - * |
|
| 37 | - * @param DoliDB $db Database handler |
|
| 38 | - */ |
|
| 34 | + /** |
|
| 35 | + * Constructor. Define names, constants, directories, boxes, permissions |
|
| 36 | + * |
|
| 37 | + * @param DoliDB $db Database handler |
|
| 38 | + */ |
|
| 39 | 39 | |
| 40 | - public function __construct($db) |
|
| 41 | - { |
|
| 42 | - global $langs, $conf; |
|
| 40 | + public function __construct($db) |
|
| 41 | + { |
|
| 42 | + global $langs, $conf; |
|
| 43 | 43 | |
| 44 | - $this->db = $db; |
|
| 44 | + $this->db = $db; |
|
| 45 | 45 | |
| 46 | 46 | $this->editor_name = 'ATM-Consulting'; |
| 47 | - // Id for module (must be unique). |
|
| 48 | - // Use a free id here |
|
| 49 | - // (See in Home -> System information -> Dolibarr for list of used modules id). |
|
| 50 | - $this->numero = 104777; // 104000 to 104999 for ATM CONSULTING |
|
| 51 | - // Key text used to identify module (for permissions, menus, etc...) |
|
| 52 | - $this->rights_class = 'subtotal'; |
|
| 47 | + // Id for module (must be unique). |
|
| 48 | + // Use a free id here |
|
| 49 | + // (See in Home -> System information -> Dolibarr for list of used modules id). |
|
| 50 | + $this->numero = 104777; // 104000 to 104999 for ATM CONSULTING |
|
| 51 | + // Key text used to identify module (for permissions, menus, etc...) |
|
| 52 | + $this->rights_class = 'subtotal'; |
|
| 53 | 53 | |
| 54 | - // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' |
|
| 55 | - // It is used to group modules in module setup page |
|
| 56 | - $this->family = "technic"; |
|
| 57 | - // Module label (no space allowed) |
|
| 58 | - // used if translation string 'ModuleXXXName' not found |
|
| 59 | - // (where XXX is value of numeric property 'numero' of module) |
|
| 60 | - $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
| 61 | - // Module description |
|
| 62 | - // used if translation string 'ModuleXXXDesc' not found |
|
| 63 | - // (where XXX is value of numeric property 'numero' of module) |
|
| 64 | - $this->description = "Module permettant l'ajout de sous-totaux et sous-totaux intermédiaires et le déplacement d'une ligne aisée de l'un dans l'autre"; |
|
| 65 | - // Possible values for version are: 'development', 'experimental' or version |
|
| 66 | - $this->version = '3.0.0'; |
|
| 67 | - // Key used in llx_const table to save module status enabled/disabled |
|
| 68 | - // (where MYMODULE is value of property name of module in uppercase) |
|
| 69 | - $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name); |
|
| 70 | - // Where to store the module in setup page |
|
| 71 | - // (0=common,1=interface,2=others,3=very specific) |
|
| 72 | - $this->special = 2; |
|
| 73 | - // Name of image file used for this module. |
|
| 74 | - // If file is in theme/yourtheme/img directory under name object_pictovalue.png |
|
| 75 | - // use this->picto='pictovalue' |
|
| 76 | - // If file is in module/img directory under name object_pictovalue.png |
|
| 77 | - // use this->picto='pictovalue@module' |
|
| 78 | - $this->picto = 'subtotal@subtotal'; // mypicto@titre |
|
| 79 | - // Defined all module parts (triggers, login, substitutions, menus, css, etc...) |
|
| 80 | - // for default path (eg: /titre/core/xxxxx) (0=disable, 1=enable) |
|
| 81 | - // for specific path of parts (eg: /titre/core/modules/barcode) |
|
| 82 | - // for specific css file (eg: /titre/css/titre.css.php) |
|
| 83 | - $this->module_parts = array( |
|
| 84 | - // Set this to 1 if module has its own trigger directory |
|
| 85 | - 'triggers' => 1, |
|
| 86 | - // Set this to 1 if module has its own login method directory |
|
| 87 | - //'login' => 0, |
|
| 88 | - // Set this to 1 if module has its own substitution function file |
|
| 89 | - //'substitutions' => 0, |
|
| 90 | - // Set this to 1 if module has its own menus handler directory |
|
| 91 | - //'menus' => 0, |
|
| 92 | - // Set this to 1 if module has its own barcode directory |
|
| 93 | - //'barcode' => 0, |
|
| 94 | - // Set this to 1 if module has its own models directory |
|
| 95 | - 'models' => 1, |
|
| 96 | - // Set this to relative path of css if module has its own css file |
|
| 97 | - //'css' => '/titre/css/mycss.css.php', |
|
| 98 | - // Set here all hooks context managed by module |
|
| 99 | - 'hooks' => array('invoicecard','propalcard','ordercard','odtgeneration','orderstoinvoice','admin','invoicereccard') |
|
| 100 | - // Set here all workflow context managed by module |
|
| 101 | - //'workflow' => array('order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE')) |
|
| 102 | - ); |
|
| 54 | + // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' |
|
| 55 | + // It is used to group modules in module setup page |
|
| 56 | + $this->family = "technic"; |
|
| 57 | + // Module label (no space allowed) |
|
| 58 | + // used if translation string 'ModuleXXXName' not found |
|
| 59 | + // (where XXX is value of numeric property 'numero' of module) |
|
| 60 | + $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
| 61 | + // Module description |
|
| 62 | + // used if translation string 'ModuleXXXDesc' not found |
|
| 63 | + // (where XXX is value of numeric property 'numero' of module) |
|
| 64 | + $this->description = "Module permettant l'ajout de sous-totaux et sous-totaux intermédiaires et le déplacement d'une ligne aisée de l'un dans l'autre"; |
|
| 65 | + // Possible values for version are: 'development', 'experimental' or version |
|
| 66 | + $this->version = '3.0.0'; |
|
| 67 | + // Key used in llx_const table to save module status enabled/disabled |
|
| 68 | + // (where MYMODULE is value of property name of module in uppercase) |
|
| 69 | + $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name); |
|
| 70 | + // Where to store the module in setup page |
|
| 71 | + // (0=common,1=interface,2=others,3=very specific) |
|
| 72 | + $this->special = 2; |
|
| 73 | + // Name of image file used for this module. |
|
| 74 | + // If file is in theme/yourtheme/img directory under name object_pictovalue.png |
|
| 75 | + // use this->picto='pictovalue' |
|
| 76 | + // If file is in module/img directory under name object_pictovalue.png |
|
| 77 | + // use this->picto='pictovalue@module' |
|
| 78 | + $this->picto = 'subtotal@subtotal'; // mypicto@titre |
|
| 79 | + // Defined all module parts (triggers, login, substitutions, menus, css, etc...) |
|
| 80 | + // for default path (eg: /titre/core/xxxxx) (0=disable, 1=enable) |
|
| 81 | + // for specific path of parts (eg: /titre/core/modules/barcode) |
|
| 82 | + // for specific css file (eg: /titre/css/titre.css.php) |
|
| 83 | + $this->module_parts = array( |
|
| 84 | + // Set this to 1 if module has its own trigger directory |
|
| 85 | + 'triggers' => 1, |
|
| 86 | + // Set this to 1 if module has its own login method directory |
|
| 87 | + //'login' => 0, |
|
| 88 | + // Set this to 1 if module has its own substitution function file |
|
| 89 | + //'substitutions' => 0, |
|
| 90 | + // Set this to 1 if module has its own menus handler directory |
|
| 91 | + //'menus' => 0, |
|
| 92 | + // Set this to 1 if module has its own barcode directory |
|
| 93 | + //'barcode' => 0, |
|
| 94 | + // Set this to 1 if module has its own models directory |
|
| 95 | + 'models' => 1, |
|
| 96 | + // Set this to relative path of css if module has its own css file |
|
| 97 | + //'css' => '/titre/css/mycss.css.php', |
|
| 98 | + // Set here all hooks context managed by module |
|
| 99 | + 'hooks' => array('invoicecard','propalcard','ordercard','odtgeneration','orderstoinvoice','admin','invoicereccard') |
|
| 100 | + // Set here all workflow context managed by module |
|
| 101 | + //'workflow' => array('order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE')) |
|
| 102 | + ); |
|
| 103 | 103 | |
| 104 | - // Data directories to create when module is enabled. |
|
| 105 | - // Example: this->dirs = array("/titre/temp"); |
|
| 106 | - $this->dirs = array(); |
|
| 104 | + // Data directories to create when module is enabled. |
|
| 105 | + // Example: this->dirs = array("/titre/temp"); |
|
| 106 | + $this->dirs = array(); |
|
| 107 | 107 | |
| 108 | - // Config pages. Put here list of php pages |
|
| 109 | - // stored into titre/admin directory, used to setup module. |
|
| 110 | - $this->config_page_url = array("subtotal_setup.php@subtotal"); |
|
| 108 | + // Config pages. Put here list of php pages |
|
| 109 | + // stored into titre/admin directory, used to setup module. |
|
| 110 | + $this->config_page_url = array("subtotal_setup.php@subtotal"); |
|
| 111 | 111 | |
| 112 | - // Dependencies |
|
| 113 | - // List of modules id that must be enabled if this module is enabled |
|
| 114 | - $this->depends = array(); |
|
| 112 | + // Dependencies |
|
| 113 | + // List of modules id that must be enabled if this module is enabled |
|
| 114 | + $this->depends = array(); |
|
| 115 | 115 | |
| 116 | 116 | $this->conflictwith=array('modMilestone'); |
| 117 | - // List of modules id to disable if this one is disabled |
|
| 118 | - $this->requiredby = array(); |
|
| 119 | - // Minimum version of PHP required by module |
|
| 120 | - $this->phpmin = array(5, 3); |
|
| 121 | - // Minimum version of Dolibarr required by module |
|
| 122 | - $this->need_dolibarr_version = array(3, 2); |
|
| 123 | - $this->langfiles = array("subtotal@subtotal"); // langfiles@titre |
|
| 124 | - // Constants |
|
| 125 | - // List of particular constants to add when module is enabled |
|
| 126 | - // (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive) |
|
| 127 | - // Example: |
|
| 128 | - $this->const = array( |
|
| 129 | - 0=>array( |
|
| 130 | - 'SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES', |
|
| 131 | - 'chaine', |
|
| 132 | - 'I', |
|
| 133 | - 'Définit le style (B : gras, I : Italique, U : Souligné) des sous titres lorsque le détail des lignes et des ensembles est caché', |
|
| 134 | - 1 |
|
| 135 | - ) |
|
| 117 | + // List of modules id to disable if this one is disabled |
|
| 118 | + $this->requiredby = array(); |
|
| 119 | + // Minimum version of PHP required by module |
|
| 120 | + $this->phpmin = array(5, 3); |
|
| 121 | + // Minimum version of Dolibarr required by module |
|
| 122 | + $this->need_dolibarr_version = array(3, 2); |
|
| 123 | + $this->langfiles = array("subtotal@subtotal"); // langfiles@titre |
|
| 124 | + // Constants |
|
| 125 | + // List of particular constants to add when module is enabled |
|
| 126 | + // (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive) |
|
| 127 | + // Example: |
|
| 128 | + $this->const = array( |
|
| 129 | + 0=>array( |
|
| 130 | + 'SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES', |
|
| 131 | + 'chaine', |
|
| 132 | + 'I', |
|
| 133 | + 'Définit le style (B : gras, I : Italique, U : Souligné) des sous titres lorsque le détail des lignes et des ensembles est caché', |
|
| 134 | + 1 |
|
| 135 | + ) |
|
| 136 | 136 | ,1=>array('SUBTOTAL_ALLOW_ADD_BLOCK', 'chaine', '1', 'Permet l\'ajout de titres et sous-totaux') |
| 137 | 137 | ,2=>array('SUBTOTAL_ALLOW_EDIT_BLOCK', 'chaine', '1', 'Permet de modifier titres et sous-totaux') |
| 138 | 138 | ,3=>array('SUBTOTAL_ALLOW_REMOVE_BLOCK', 'chaine', '1', 'Permet de supprimer les titres et sous-totaux') |
| 139 | 139 | ,4=>array('SUBTOTAL_TITLE_STYLE', 'chaine', 'BU') |
| 140 | 140 | ,5=>array('SUBTOTAL_SUBTOTAL_STYLE', 'chaine', 'B') |
| 141 | - // 1=>array( |
|
| 142 | - // 'MYMODULE_MYNEWCONST2', |
|
| 143 | - // 'chaine', |
|
| 144 | - // 'myvalue', |
|
| 145 | - // 'This is another constant to add', |
|
| 146 | - // 0 |
|
| 147 | - // ) |
|
| 148 | - ); |
|
| 141 | + // 1=>array( |
|
| 142 | + // 'MYMODULE_MYNEWCONST2', |
|
| 143 | + // 'chaine', |
|
| 144 | + // 'myvalue', |
|
| 145 | + // 'This is another constant to add', |
|
| 146 | + // 0 |
|
| 147 | + // ) |
|
| 148 | + ); |
|
| 149 | 149 | |
| 150 | 150 | |
| 151 | 151 | |
| 152 | 152 | |
| 153 | - // Array to add new pages in new tabs |
|
| 154 | - // Example: |
|
| 155 | - $this->tabs = array( |
|
| 156 | - // // To add a new tab identified by code tabname1 |
|
| 157 | - // 'objecttype:+tabname1:Title1:langfile@titre:$user->rights->titre->read:/titre/mynewtab1.php?id=__ID__', |
|
| 158 | - // // To add another new tab identified by code tabname2 |
|
| 159 | - // 'objecttype:+tabname2:Title2:langfile@titre:$user->rights->othermodule->read:/titre/mynewtab2.php?id=__ID__', |
|
| 160 | - // // To remove an existing tab identified by code tabname |
|
| 161 | - // 'objecttype:-tabname' |
|
| 162 | - ); |
|
| 163 | - // where objecttype can be |
|
| 164 | - // 'thirdparty' to add a tab in third party view |
|
| 165 | - // 'intervention' to add a tab in intervention view |
|
| 166 | - // 'order_supplier' to add a tab in supplier order view |
|
| 167 | - // 'invoice_supplier' to add a tab in supplier invoice view |
|
| 168 | - // 'invoice' to add a tab in customer invoice view |
|
| 169 | - // 'order' to add a tab in customer order view |
|
| 170 | - // 'product' to add a tab in product view |
|
| 171 | - // 'stock' to add a tab in stock view |
|
| 172 | - // 'propal' to add a tab in propal view |
|
| 173 | - // 'member' to add a tab in fundation member view |
|
| 174 | - // 'contract' to add a tab in contract view |
|
| 175 | - // 'user' to add a tab in user view |
|
| 176 | - // 'group' to add a tab in group view |
|
| 177 | - // 'contact' to add a tab in contact view |
|
| 178 | - // 'categories_x' to add a tab in category view |
|
| 179 | - // (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) |
|
| 180 | - // Dictionnaries |
|
| 181 | - if (! isset($conf->subtotal->enabled)) { |
|
| 182 | - $conf->subtotal=new stdClass(); |
|
| 183 | - $conf->subtotal->enabled = 0; |
|
| 184 | - } |
|
| 185 | - $this->dictionaries = array( |
|
| 153 | + // Array to add new pages in new tabs |
|
| 154 | + // Example: |
|
| 155 | + $this->tabs = array( |
|
| 156 | + // // To add a new tab identified by code tabname1 |
|
| 157 | + // 'objecttype:+tabname1:Title1:langfile@titre:$user->rights->titre->read:/titre/mynewtab1.php?id=__ID__', |
|
| 158 | + // // To add another new tab identified by code tabname2 |
|
| 159 | + // 'objecttype:+tabname2:Title2:langfile@titre:$user->rights->othermodule->read:/titre/mynewtab2.php?id=__ID__', |
|
| 160 | + // // To remove an existing tab identified by code tabname |
|
| 161 | + // 'objecttype:-tabname' |
|
| 162 | + ); |
|
| 163 | + // where objecttype can be |
|
| 164 | + // 'thirdparty' to add a tab in third party view |
|
| 165 | + // 'intervention' to add a tab in intervention view |
|
| 166 | + // 'order_supplier' to add a tab in supplier order view |
|
| 167 | + // 'invoice_supplier' to add a tab in supplier invoice view |
|
| 168 | + // 'invoice' to add a tab in customer invoice view |
|
| 169 | + // 'order' to add a tab in customer order view |
|
| 170 | + // 'product' to add a tab in product view |
|
| 171 | + // 'stock' to add a tab in stock view |
|
| 172 | + // 'propal' to add a tab in propal view |
|
| 173 | + // 'member' to add a tab in fundation member view |
|
| 174 | + // 'contract' to add a tab in contract view |
|
| 175 | + // 'user' to add a tab in user view |
|
| 176 | + // 'group' to add a tab in group view |
|
| 177 | + // 'contact' to add a tab in contact view |
|
| 178 | + // 'categories_x' to add a tab in category view |
|
| 179 | + // (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) |
|
| 180 | + // Dictionnaries |
|
| 181 | + if (! isset($conf->subtotal->enabled)) { |
|
| 182 | + $conf->subtotal=new stdClass(); |
|
| 183 | + $conf->subtotal->enabled = 0; |
|
| 184 | + } |
|
| 185 | + $this->dictionaries = array( |
|
| 186 | 186 | 'langs'=>'subtotal@subtotal', |
| 187 | - 'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'), // List of tables we want to see into dictonnary editor |
|
| 188 | - 'tablib'=>array($langs->trans('subtotalFreeLineDictionary')), // Label of tables |
|
| 189 | - 'tabsql'=>array('SELECT f.rowid as rowid, f.label, f.content, f.entity, f.active FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text as f WHERE f.entity='.$conf->entity), // Request to select fields |
|
| 190 | - 'tabsqlsort'=>array('label ASC'), // Sort order |
|
| 191 | - 'tabfield'=>array('label,content'), // List of fields (result of select to show dictionary) |
|
| 192 | - 'tabfieldvalue'=>array('label,content'), // List of fields (list of fields to edit a record) |
|
| 193 | - 'tabfieldinsert'=>array('label,content,entity'), // List of fields (list of fields for insert) |
|
| 194 | - 'tabrowid'=>array('rowid'), // Name of columns with primary key (try to always name it 'rowid') |
|
| 195 | - 'tabcond'=>array($conf->subtotal->enabled) |
|
| 187 | + 'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'), // List of tables we want to see into dictonnary editor |
|
| 188 | + 'tablib'=>array($langs->trans('subtotalFreeLineDictionary')), // Label of tables |
|
| 189 | + 'tabsql'=>array('SELECT f.rowid as rowid, f.label, f.content, f.entity, f.active FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text as f WHERE f.entity='.$conf->entity), // Request to select fields |
|
| 190 | + 'tabsqlsort'=>array('label ASC'), // Sort order |
|
| 191 | + 'tabfield'=>array('label,content'), // List of fields (result of select to show dictionary) |
|
| 192 | + 'tabfieldvalue'=>array('label,content'), // List of fields (list of fields to edit a record) |
|
| 193 | + 'tabfieldinsert'=>array('label,content,entity'), // List of fields (list of fields for insert) |
|
| 194 | + 'tabrowid'=>array('rowid'), // Name of columns with primary key (try to always name it 'rowid') |
|
| 195 | + 'tabcond'=>array($conf->subtotal->enabled) |
|
| 196 | 196 | ); |
| 197 | - /* Example: |
|
| 197 | + /* Example: |
|
| 198 | 198 | // This is to avoid warnings |
| 199 | 199 | if (! isset($conf->titre->enabled)) $conf->titre->enabled=0; |
| 200 | 200 | $this->dictionnaries=array( |
@@ -235,223 +235,223 @@ discard block |
||
| 235 | 235 | ); |
| 236 | 236 | */ |
| 237 | 237 | |
| 238 | - // Boxes |
|
| 239 | - // Add here list of php file(s) stored in core/boxes that contains class to show a box. |
|
| 240 | - $this->boxes = array(); // Boxes list |
|
| 238 | + // Boxes |
|
| 239 | + // Add here list of php file(s) stored in core/boxes that contains class to show a box. |
|
| 240 | + $this->boxes = array(); // Boxes list |
|
| 241 | 241 | |
| 242 | - /* |
|
| 242 | + /* |
|
| 243 | 243 | $this->boxes[$r][1] = "myboxb.php"; |
| 244 | 244 | $r++; |
| 245 | 245 | */ |
| 246 | 246 | |
| 247 | - // Permissions |
|
| 248 | - $this->rights = array(); // Permission array used by this module |
|
| 249 | - $r = 0; |
|
| 247 | + // Permissions |
|
| 248 | + $this->rights = array(); // Permission array used by this module |
|
| 249 | + $r = 0; |
|
| 250 | 250 | |
| 251 | - // Add here list of permission defined by |
|
| 252 | - // an id, a label, a boolean and two constant strings. |
|
| 253 | - // Example: |
|
| 254 | - //// Permission id (must not be already used) |
|
| 255 | - //$this->rights[$r][0] = 2000; |
|
| 256 | - //// Permission label |
|
| 257 | - //$this->rights[$r][1] = 'Permision label'; |
|
| 258 | - //// Permission by default for new user (0/1) |
|
| 259 | - //$this->rights[$r][3] = 1; |
|
| 260 | - //// In php code, permission will be checked by test |
|
| 261 | - //// if ($user->rights->permkey->level1->level2) |
|
| 262 | - //$this->rights[$r][4] = 'level1'; |
|
| 263 | - //// In php code, permission will be checked by test |
|
| 264 | - //// if ($user->rights->permkey->level1->level2) |
|
| 265 | - //$this->rights[$r][5] = 'level2'; |
|
| 266 | - //$r++; |
|
| 267 | - // Main menu entries |
|
| 268 | - $this->menus = array(); // List of menus to add |
|
| 269 | - $r = 0; |
|
| 251 | + // Add here list of permission defined by |
|
| 252 | + // an id, a label, a boolean and two constant strings. |
|
| 253 | + // Example: |
|
| 254 | + //// Permission id (must not be already used) |
|
| 255 | + //$this->rights[$r][0] = 2000; |
|
| 256 | + //// Permission label |
|
| 257 | + //$this->rights[$r][1] = 'Permision label'; |
|
| 258 | + //// Permission by default for new user (0/1) |
|
| 259 | + //$this->rights[$r][3] = 1; |
|
| 260 | + //// In php code, permission will be checked by test |
|
| 261 | + //// if ($user->rights->permkey->level1->level2) |
|
| 262 | + //$this->rights[$r][4] = 'level1'; |
|
| 263 | + //// In php code, permission will be checked by test |
|
| 264 | + //// if ($user->rights->permkey->level1->level2) |
|
| 265 | + //$this->rights[$r][5] = 'level2'; |
|
| 266 | + //$r++; |
|
| 267 | + // Main menu entries |
|
| 268 | + $this->menus = array(); // List of menus to add |
|
| 269 | + $r = 0; |
|
| 270 | 270 | |
| 271 | - // Add here entries to declare new menus |
|
| 272 | - // |
|
| 273 | - // Example to declare a new Top Menu entry and its Left menu entry: |
|
| 274 | - //$this->menu[$r]=array( |
|
| 275 | - // // Put 0 if this is a top menu |
|
| 276 | - // 'fk_menu'=>0, |
|
| 277 | - // // This is a Top menu entry |
|
| 278 | - // 'type'=>'top', |
|
| 279 | - // 'titre'=>'titre top menu', |
|
| 280 | - // 'mainmenu'=>'titre', |
|
| 281 | - // 'leftmenu'=>'titre', |
|
| 282 | - // 'url'=>'/titre/pagetop.php', |
|
| 283 | - // // Lang file to use (without .lang) by module. |
|
| 284 | - // // File must be in langs/code_CODE/ directory. |
|
| 285 | - // 'langs'=>'mylangfile', |
|
| 286 | - // 'position'=>100, |
|
| 287 | - // // Define condition to show or hide menu entry. |
|
| 288 | - // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
| 289 | - // 'enabled'=>'$conf->titre->enabled', |
|
| 290 | - // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
| 291 | - // // if you want your menu with a permission rules |
|
| 292 | - // 'perms'=>'1', |
|
| 293 | - // 'target'=>'', |
|
| 294 | - // // 0=Menu for internal users, 1=external users, 2=both |
|
| 295 | - // 'user'=>2 |
|
| 296 | - //); |
|
| 297 | - //$r++; |
|
| 298 | - //$this->menu[$r]=array( |
|
| 299 | - // // Use r=value where r is index key used for the parent menu entry |
|
| 300 | - // // (higher parent must be a top menu entry) |
|
| 301 | - // 'fk_menu'=>'r=0', |
|
| 302 | - // // This is a Left menu entry |
|
| 303 | - // 'type'=>'left', |
|
| 304 | - // 'titre'=>'titre left menu', |
|
| 305 | - // 'mainmenu'=>'titre', |
|
| 306 | - // 'leftmenu'=>'titre', |
|
| 307 | - // 'url'=>'/titre/pagelevel1.php', |
|
| 308 | - // // Lang file to use (without .lang) by module. |
|
| 309 | - // // File must be in langs/code_CODE/ directory. |
|
| 310 | - // 'langs'=>'mylangfile', |
|
| 311 | - // 'position'=>100, |
|
| 312 | - // // Define condition to show or hide menu entry. |
|
| 313 | - // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
| 314 | - // 'enabled'=>'$conf->titre->enabled', |
|
| 315 | - // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
| 316 | - // // if you want your menu with a permission rules |
|
| 317 | - // 'perms'=>'1', |
|
| 318 | - // 'target'=>'', |
|
| 319 | - // // 0=Menu for internal users, 1=external users, 2=both |
|
| 320 | - // 'user'=>2 |
|
| 321 | - //); |
|
| 322 | - //$r++; |
|
| 323 | - // |
|
| 324 | - // Example to declare a Left Menu entry into an existing Top menu entry: |
|
| 325 | - //$this->menu[$r]=array( |
|
| 326 | - // // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' |
|
| 327 | - // 'fk_menu'=>'fk_mainmenu=mainmenucode', |
|
| 328 | - // // This is a Left menu entry |
|
| 329 | - // 'type'=>'left', |
|
| 330 | - // 'titre'=>'titre left menu', |
|
| 331 | - // 'mainmenu'=>'mainmenucode', |
|
| 332 | - // 'leftmenu'=>'titre', |
|
| 333 | - // 'url'=>'/titre/pagelevel2.php', |
|
| 334 | - // // Lang file to use (without .lang) by module. |
|
| 335 | - // // File must be in langs/code_CODE/ directory. |
|
| 336 | - // 'langs'=>'mylangfile', |
|
| 337 | - // 'position'=>100, |
|
| 338 | - // // Define condition to show or hide menu entry. |
|
| 339 | - // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
| 340 | - // // Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
| 341 | - // 'enabled'=>'$conf->titre->enabled', |
|
| 342 | - // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
| 343 | - // // if you want your menu with a permission rules |
|
| 344 | - // 'perms'=>'1', |
|
| 345 | - // 'target'=>'', |
|
| 346 | - // // 0=Menu for internal users, 1=external users, 2=both |
|
| 347 | - // 'user'=>2 |
|
| 348 | - //); |
|
| 349 | - //$r++; |
|
| 350 | - // Exports |
|
| 351 | - $r = 1; |
|
| 271 | + // Add here entries to declare new menus |
|
| 272 | + // |
|
| 273 | + // Example to declare a new Top Menu entry and its Left menu entry: |
|
| 274 | + //$this->menu[$r]=array( |
|
| 275 | + // // Put 0 if this is a top menu |
|
| 276 | + // 'fk_menu'=>0, |
|
| 277 | + // // This is a Top menu entry |
|
| 278 | + // 'type'=>'top', |
|
| 279 | + // 'titre'=>'titre top menu', |
|
| 280 | + // 'mainmenu'=>'titre', |
|
| 281 | + // 'leftmenu'=>'titre', |
|
| 282 | + // 'url'=>'/titre/pagetop.php', |
|
| 283 | + // // Lang file to use (without .lang) by module. |
|
| 284 | + // // File must be in langs/code_CODE/ directory. |
|
| 285 | + // 'langs'=>'mylangfile', |
|
| 286 | + // 'position'=>100, |
|
| 287 | + // // Define condition to show or hide menu entry. |
|
| 288 | + // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
| 289 | + // 'enabled'=>'$conf->titre->enabled', |
|
| 290 | + // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
| 291 | + // // if you want your menu with a permission rules |
|
| 292 | + // 'perms'=>'1', |
|
| 293 | + // 'target'=>'', |
|
| 294 | + // // 0=Menu for internal users, 1=external users, 2=both |
|
| 295 | + // 'user'=>2 |
|
| 296 | + //); |
|
| 297 | + //$r++; |
|
| 298 | + //$this->menu[$r]=array( |
|
| 299 | + // // Use r=value where r is index key used for the parent menu entry |
|
| 300 | + // // (higher parent must be a top menu entry) |
|
| 301 | + // 'fk_menu'=>'r=0', |
|
| 302 | + // // This is a Left menu entry |
|
| 303 | + // 'type'=>'left', |
|
| 304 | + // 'titre'=>'titre left menu', |
|
| 305 | + // 'mainmenu'=>'titre', |
|
| 306 | + // 'leftmenu'=>'titre', |
|
| 307 | + // 'url'=>'/titre/pagelevel1.php', |
|
| 308 | + // // Lang file to use (without .lang) by module. |
|
| 309 | + // // File must be in langs/code_CODE/ directory. |
|
| 310 | + // 'langs'=>'mylangfile', |
|
| 311 | + // 'position'=>100, |
|
| 312 | + // // Define condition to show or hide menu entry. |
|
| 313 | + // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
| 314 | + // 'enabled'=>'$conf->titre->enabled', |
|
| 315 | + // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
| 316 | + // // if you want your menu with a permission rules |
|
| 317 | + // 'perms'=>'1', |
|
| 318 | + // 'target'=>'', |
|
| 319 | + // // 0=Menu for internal users, 1=external users, 2=both |
|
| 320 | + // 'user'=>2 |
|
| 321 | + //); |
|
| 322 | + //$r++; |
|
| 323 | + // |
|
| 324 | + // Example to declare a Left Menu entry into an existing Top menu entry: |
|
| 325 | + //$this->menu[$r]=array( |
|
| 326 | + // // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' |
|
| 327 | + // 'fk_menu'=>'fk_mainmenu=mainmenucode', |
|
| 328 | + // // This is a Left menu entry |
|
| 329 | + // 'type'=>'left', |
|
| 330 | + // 'titre'=>'titre left menu', |
|
| 331 | + // 'mainmenu'=>'mainmenucode', |
|
| 332 | + // 'leftmenu'=>'titre', |
|
| 333 | + // 'url'=>'/titre/pagelevel2.php', |
|
| 334 | + // // Lang file to use (without .lang) by module. |
|
| 335 | + // // File must be in langs/code_CODE/ directory. |
|
| 336 | + // 'langs'=>'mylangfile', |
|
| 337 | + // 'position'=>100, |
|
| 338 | + // // Define condition to show or hide menu entry. |
|
| 339 | + // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
| 340 | + // // Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
| 341 | + // 'enabled'=>'$conf->titre->enabled', |
|
| 342 | + // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
| 343 | + // // if you want your menu with a permission rules |
|
| 344 | + // 'perms'=>'1', |
|
| 345 | + // 'target'=>'', |
|
| 346 | + // // 0=Menu for internal users, 1=external users, 2=both |
|
| 347 | + // 'user'=>2 |
|
| 348 | + //); |
|
| 349 | + //$r++; |
|
| 350 | + // Exports |
|
| 351 | + $r = 1; |
|
| 352 | 352 | |
| 353 | - // Example: |
|
| 354 | - //$this->export_code[$r]=$this->rights_class.'_'.$r; |
|
| 355 | - //// Translation key (used only if key ExportDataset_xxx_z not found) |
|
| 356 | - //$this->export_label[$r]='CustomersInvoicesAndInvoiceLines'; |
|
| 357 | - //// Condition to show export in list (ie: '$user->id==3'). |
|
| 358 | - //// Set to 1 to always show when module is enabled. |
|
| 359 | - //$this->export_enabled[$r]='1'; |
|
| 360 | - //$this->export_permission[$r]=array(array("facture","facture","export")); |
|
| 361 | - //$this->export_fields_array[$r]=array( |
|
| 362 | - // 's.rowid'=>"IdCompany", |
|
| 363 | - // 's.nom'=>'CompanyName', |
|
| 364 | - // 's.address'=>'Address', |
|
| 365 | - // 's.cp'=>'Zip', |
|
| 366 | - // 's.ville'=>'Town', |
|
| 367 | - // 's.fk_pays'=>'Country', |
|
| 368 | - // 's.tel'=>'Phone', |
|
| 369 | - // 's.siren'=>'ProfId1', |
|
| 370 | - // 's.siret'=>'ProfId2', |
|
| 371 | - // 's.ape'=>'ProfId3', |
|
| 372 | - // 's.idprof4'=>'ProfId4', |
|
| 373 | - // 's.code_compta'=>'CustomerAccountancyCode', |
|
| 374 | - // 's.code_compta_fournisseur'=>'SupplierAccountancyCode', |
|
| 375 | - // 'f.rowid'=>"InvoiceId", |
|
| 376 | - // 'f.facnumber'=>"InvoiceRef", |
|
| 377 | - // 'f.datec'=>"InvoiceDateCreation", |
|
| 378 | - // 'f.datef'=>"DateInvoice", |
|
| 379 | - // 'f.total'=>"TotalHT", |
|
| 380 | - // 'f.total_ttc'=>"TotalTTC", |
|
| 381 | - // 'f.tva'=>"TotalVAT", |
|
| 382 | - // 'f.paye'=>"InvoicePaid", |
|
| 383 | - // 'f.fk_statut'=>'InvoiceStatus', |
|
| 384 | - // 'f.note'=>"InvoiceNote", |
|
| 385 | - // 'fd.rowid'=>'LineId', |
|
| 386 | - // 'fd.description'=>"LineDescription", |
|
| 387 | - // 'fd.price'=>"LineUnitPrice", |
|
| 388 | - // 'fd.tva_tx'=>"LineVATRate", |
|
| 389 | - // 'fd.qty'=>"LineQty", |
|
| 390 | - // 'fd.total_ht'=>"LineTotalHT", |
|
| 391 | - // 'fd.total_tva'=>"LineTotalTVA", |
|
| 392 | - // 'fd.total_ttc'=>"LineTotalTTC", |
|
| 393 | - // 'fd.date_start'=>"DateStart", |
|
| 394 | - // 'fd.date_end'=>"DateEnd", |
|
| 395 | - // 'fd.fk_product'=>'ProductId', |
|
| 396 | - // 'p.ref'=>'ProductRef' |
|
| 397 | - //); |
|
| 398 | - //$this->export_entities_array[$r]=array('s.rowid'=>"company", |
|
| 399 | - // 's.nom'=>'company', |
|
| 400 | - // 's.address'=>'company', |
|
| 401 | - // 's.cp'=>'company', |
|
| 402 | - // 's.ville'=>'company', |
|
| 403 | - // 's.fk_pays'=>'company', |
|
| 404 | - // 's.tel'=>'company', |
|
| 405 | - // 's.siren'=>'company', |
|
| 406 | - // 's.siret'=>'company', |
|
| 407 | - // 's.ape'=>'company', |
|
| 408 | - // 's.idprof4'=>'company', |
|
| 409 | - // 's.code_compta'=>'company', |
|
| 410 | - // 's.code_compta_fournisseur'=>'company', |
|
| 411 | - // 'f.rowid'=>"invoice", |
|
| 412 | - // 'f.facnumber'=>"invoice", |
|
| 413 | - // 'f.datec'=>"invoice", |
|
| 414 | - // 'f.datef'=>"invoice", |
|
| 415 | - // 'f.total'=>"invoice", |
|
| 416 | - // 'f.total_ttc'=>"invoice", |
|
| 417 | - // 'f.tva'=>"invoice", |
|
| 418 | - // 'f.paye'=>"invoice", |
|
| 419 | - // 'f.fk_statut'=>'invoice', |
|
| 420 | - // 'f.note'=>"invoice", |
|
| 421 | - // 'fd.rowid'=>'invoice_line', |
|
| 422 | - // 'fd.description'=>"invoice_line", |
|
| 423 | - // 'fd.price'=>"invoice_line", |
|
| 424 | - // 'fd.total_ht'=>"invoice_line", |
|
| 425 | - // 'fd.total_tva'=>"invoice_line", |
|
| 426 | - // 'fd.total_ttc'=>"invoice_line", |
|
| 427 | - // 'fd.tva_tx'=>"invoice_line", |
|
| 428 | - // 'fd.qty'=>"invoice_line", |
|
| 429 | - // 'fd.date_start'=>"invoice_line", |
|
| 430 | - // 'fd.date_end'=>"invoice_line", |
|
| 431 | - // 'fd.fk_product'=>'product', |
|
| 432 | - // 'p.ref'=>'product' |
|
| 433 | - //); |
|
| 434 | - //$this->export_sql_start[$r] = 'SELECT DISTINCT '; |
|
| 435 | - //$this->export_sql_end[$r] = ' FROM (' . MAIN_DB_PREFIX . 'facture as f, ' |
|
| 436 | - // . MAIN_DB_PREFIX . 'facturedet as fd, ' . MAIN_DB_PREFIX . 'societe as s)'; |
|
| 437 | - //$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX |
|
| 438 | - // . 'product as p on (fd.fk_product = p.rowid)'; |
|
| 439 | - //$this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid ' |
|
| 440 | - // . 'AND f.rowid = fd.fk_facture'; |
|
| 441 | - //$r++; |
|
| 442 | - } |
|
| 353 | + // Example: |
|
| 354 | + //$this->export_code[$r]=$this->rights_class.'_'.$r; |
|
| 355 | + //// Translation key (used only if key ExportDataset_xxx_z not found) |
|
| 356 | + //$this->export_label[$r]='CustomersInvoicesAndInvoiceLines'; |
|
| 357 | + //// Condition to show export in list (ie: '$user->id==3'). |
|
| 358 | + //// Set to 1 to always show when module is enabled. |
|
| 359 | + //$this->export_enabled[$r]='1'; |
|
| 360 | + //$this->export_permission[$r]=array(array("facture","facture","export")); |
|
| 361 | + //$this->export_fields_array[$r]=array( |
|
| 362 | + // 's.rowid'=>"IdCompany", |
|
| 363 | + // 's.nom'=>'CompanyName', |
|
| 364 | + // 's.address'=>'Address', |
|
| 365 | + // 's.cp'=>'Zip', |
|
| 366 | + // 's.ville'=>'Town', |
|
| 367 | + // 's.fk_pays'=>'Country', |
|
| 368 | + // 's.tel'=>'Phone', |
|
| 369 | + // 's.siren'=>'ProfId1', |
|
| 370 | + // 's.siret'=>'ProfId2', |
|
| 371 | + // 's.ape'=>'ProfId3', |
|
| 372 | + // 's.idprof4'=>'ProfId4', |
|
| 373 | + // 's.code_compta'=>'CustomerAccountancyCode', |
|
| 374 | + // 's.code_compta_fournisseur'=>'SupplierAccountancyCode', |
|
| 375 | + // 'f.rowid'=>"InvoiceId", |
|
| 376 | + // 'f.facnumber'=>"InvoiceRef", |
|
| 377 | + // 'f.datec'=>"InvoiceDateCreation", |
|
| 378 | + // 'f.datef'=>"DateInvoice", |
|
| 379 | + // 'f.total'=>"TotalHT", |
|
| 380 | + // 'f.total_ttc'=>"TotalTTC", |
|
| 381 | + // 'f.tva'=>"TotalVAT", |
|
| 382 | + // 'f.paye'=>"InvoicePaid", |
|
| 383 | + // 'f.fk_statut'=>'InvoiceStatus', |
|
| 384 | + // 'f.note'=>"InvoiceNote", |
|
| 385 | + // 'fd.rowid'=>'LineId', |
|
| 386 | + // 'fd.description'=>"LineDescription", |
|
| 387 | + // 'fd.price'=>"LineUnitPrice", |
|
| 388 | + // 'fd.tva_tx'=>"LineVATRate", |
|
| 389 | + // 'fd.qty'=>"LineQty", |
|
| 390 | + // 'fd.total_ht'=>"LineTotalHT", |
|
| 391 | + // 'fd.total_tva'=>"LineTotalTVA", |
|
| 392 | + // 'fd.total_ttc'=>"LineTotalTTC", |
|
| 393 | + // 'fd.date_start'=>"DateStart", |
|
| 394 | + // 'fd.date_end'=>"DateEnd", |
|
| 395 | + // 'fd.fk_product'=>'ProductId', |
|
| 396 | + // 'p.ref'=>'ProductRef' |
|
| 397 | + //); |
|
| 398 | + //$this->export_entities_array[$r]=array('s.rowid'=>"company", |
|
| 399 | + // 's.nom'=>'company', |
|
| 400 | + // 's.address'=>'company', |
|
| 401 | + // 's.cp'=>'company', |
|
| 402 | + // 's.ville'=>'company', |
|
| 403 | + // 's.fk_pays'=>'company', |
|
| 404 | + // 's.tel'=>'company', |
|
| 405 | + // 's.siren'=>'company', |
|
| 406 | + // 's.siret'=>'company', |
|
| 407 | + // 's.ape'=>'company', |
|
| 408 | + // 's.idprof4'=>'company', |
|
| 409 | + // 's.code_compta'=>'company', |
|
| 410 | + // 's.code_compta_fournisseur'=>'company', |
|
| 411 | + // 'f.rowid'=>"invoice", |
|
| 412 | + // 'f.facnumber'=>"invoice", |
|
| 413 | + // 'f.datec'=>"invoice", |
|
| 414 | + // 'f.datef'=>"invoice", |
|
| 415 | + // 'f.total'=>"invoice", |
|
| 416 | + // 'f.total_ttc'=>"invoice", |
|
| 417 | + // 'f.tva'=>"invoice", |
|
| 418 | + // 'f.paye'=>"invoice", |
|
| 419 | + // 'f.fk_statut'=>'invoice', |
|
| 420 | + // 'f.note'=>"invoice", |
|
| 421 | + // 'fd.rowid'=>'invoice_line', |
|
| 422 | + // 'fd.description'=>"invoice_line", |
|
| 423 | + // 'fd.price'=>"invoice_line", |
|
| 424 | + // 'fd.total_ht'=>"invoice_line", |
|
| 425 | + // 'fd.total_tva'=>"invoice_line", |
|
| 426 | + // 'fd.total_ttc'=>"invoice_line", |
|
| 427 | + // 'fd.tva_tx'=>"invoice_line", |
|
| 428 | + // 'fd.qty'=>"invoice_line", |
|
| 429 | + // 'fd.date_start'=>"invoice_line", |
|
| 430 | + // 'fd.date_end'=>"invoice_line", |
|
| 431 | + // 'fd.fk_product'=>'product', |
|
| 432 | + // 'p.ref'=>'product' |
|
| 433 | + //); |
|
| 434 | + //$this->export_sql_start[$r] = 'SELECT DISTINCT '; |
|
| 435 | + //$this->export_sql_end[$r] = ' FROM (' . MAIN_DB_PREFIX . 'facture as f, ' |
|
| 436 | + // . MAIN_DB_PREFIX . 'facturedet as fd, ' . MAIN_DB_PREFIX . 'societe as s)'; |
|
| 437 | + //$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX |
|
| 438 | + // . 'product as p on (fd.fk_product = p.rowid)'; |
|
| 439 | + //$this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid ' |
|
| 440 | + // . 'AND f.rowid = fd.fk_facture'; |
|
| 441 | + //$r++; |
|
| 442 | + } |
|
| 443 | 443 | |
| 444 | - /** |
|
| 445 | - * Function called when module is enabled. |
|
| 446 | - * The init function add constants, boxes, permissions and menus |
|
| 447 | - * (defined in constructor) into Dolibarr database. |
|
| 448 | - * It also creates data directories |
|
| 449 | - * |
|
| 450 | - * @param string $options Options when enabling module ('', 'noboxes') |
|
| 451 | - * @return int 1 if OK, 0 if KO |
|
| 452 | - */ |
|
| 453 | - public function init($options = '') |
|
| 454 | - { |
|
| 444 | + /** |
|
| 445 | + * Function called when module is enabled. |
|
| 446 | + * The init function add constants, boxes, permissions and menus |
|
| 447 | + * (defined in constructor) into Dolibarr database. |
|
| 448 | + * It also creates data directories |
|
| 449 | + * |
|
| 450 | + * @param string $options Options when enabling module ('', 'noboxes') |
|
| 451 | + * @return int 1 if OK, 0 if KO |
|
| 452 | + */ |
|
| 453 | + public function init($options = '') |
|
| 454 | + { |
|
| 455 | 455 | global $conf; |
| 456 | 456 | |
| 457 | 457 | |
@@ -459,39 +459,39 @@ discard block |
||
| 459 | 459 | exit("Attention, ce module rentre ne conflit avec le module Jalon/Milestones. Merci de le désactiver auparavant."); |
| 460 | 460 | } |
| 461 | 461 | */ |
| 462 | - $sql = array(); |
|
| 462 | + $sql = array(); |
|
| 463 | 463 | |
| 464 | - $result = $this->loadTables(); |
|
| 464 | + $result = $this->loadTables(); |
|
| 465 | 465 | |
| 466 | 466 | |
| 467 | - return $this->_init($sql, $options); |
|
| 468 | - } |
|
| 467 | + return $this->_init($sql, $options); |
|
| 468 | + } |
|
| 469 | 469 | |
| 470 | - /** |
|
| 471 | - * Function called when module is disabled. |
|
| 472 | - * Remove from database constants, boxes and permissions from Dolibarr database. |
|
| 473 | - * Data directories are not deleted |
|
| 474 | - * |
|
| 475 | - * @param string $options Options when enabling module ('', 'noboxes') |
|
| 476 | - * @return int 1 if OK, 0 if KO |
|
| 477 | - */ |
|
| 478 | - public function remove($options = '') |
|
| 479 | - { |
|
| 480 | - $sql = array(); |
|
| 470 | + /** |
|
| 471 | + * Function called when module is disabled. |
|
| 472 | + * Remove from database constants, boxes and permissions from Dolibarr database. |
|
| 473 | + * Data directories are not deleted |
|
| 474 | + * |
|
| 475 | + * @param string $options Options when enabling module ('', 'noboxes') |
|
| 476 | + * @return int 1 if OK, 0 if KO |
|
| 477 | + */ |
|
| 478 | + public function remove($options = '') |
|
| 479 | + { |
|
| 480 | + $sql = array(); |
|
| 481 | 481 | |
| 482 | - return $this->_remove($sql, $options); |
|
| 483 | - } |
|
| 482 | + return $this->_remove($sql, $options); |
|
| 483 | + } |
|
| 484 | 484 | |
| 485 | - /** |
|
| 486 | - * Create tables, keys and data required by module |
|
| 487 | - * Files llx_table1.sql, llx_table1.key.sql llx_data.sql with create table, create keys |
|
| 488 | - * and create data commands must be stored in directory /titre/sql/ |
|
| 489 | - * This function is called by this->init |
|
| 490 | - * |
|
| 491 | - * @return int <=0 if KO, >0 if OK |
|
| 492 | - */ |
|
| 493 | - private function loadTables() |
|
| 494 | - { |
|
| 495 | - return $this->_load_tables('/subtotal/sql/'); |
|
| 496 | - } |
|
| 485 | + /** |
|
| 486 | + * Create tables, keys and data required by module |
|
| 487 | + * Files llx_table1.sql, llx_table1.key.sql llx_data.sql with create table, create keys |
|
| 488 | + * and create data commands must be stored in directory /titre/sql/ |
|
| 489 | + * This function is called by this->init |
|
| 490 | + * |
|
| 491 | + * @return int <=0 if KO, >0 if OK |
|
| 492 | + */ |
|
| 493 | + private function loadTables() |
|
| 494 | + { |
|
| 495 | + return $this->_load_tables('/subtotal/sql/'); |
|
| 496 | + } |
|
| 497 | 497 | } |
@@ -38,17 +38,17 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | class pdf_crabe_subtotal extends ModelePDFFactures |
| 40 | 40 | { |
| 41 | - var $db; |
|
| 42 | - var $name; |
|
| 43 | - var $description; |
|
| 44 | - var $type; |
|
| 41 | + var $db; |
|
| 42 | + var $name; |
|
| 43 | + var $description; |
|
| 44 | + var $type; |
|
| 45 | 45 | |
| 46 | - var $phpmin = array(4,3,0); // Minimum version of PHP required by module |
|
| 47 | - var $version = 'dolibarr'; |
|
| 46 | + var $phpmin = array(4,3,0); // Minimum version of PHP required by module |
|
| 47 | + var $version = 'dolibarr'; |
|
| 48 | 48 | |
| 49 | - var $page_largeur; |
|
| 50 | - var $page_hauteur; |
|
| 51 | - var $format; |
|
| 49 | + var $page_largeur; |
|
| 50 | + var $page_hauteur; |
|
| 51 | + var $format; |
|
| 52 | 52 | var $marge_gauche; |
| 53 | 53 | var $marge_droite; |
| 54 | 54 | var $marge_haute; |
@@ -130,15 +130,15 @@ discard block |
||
| 130 | 130 | |
| 131 | 131 | |
| 132 | 132 | /** |
| 133 | - * Function to build pdf onto disk |
|
| 134 | - * |
|
| 135 | - * @param Object $object Object to generate |
|
| 136 | - * @param Translate $outputlangs Lang output object |
|
| 137 | - * @param string $srctemplatepath Full path of source filename for generator using a template file |
|
| 138 | - * @param int $hidedetails Do not show line details |
|
| 139 | - * @param int $hidedesc Do not show desc |
|
| 140 | - * @param int $hideref Do not show ref |
|
| 141 | - * @return int 1=OK, 0=KO |
|
| 133 | + * Function to build pdf onto disk |
|
| 134 | + * |
|
| 135 | + * @param Object $object Object to generate |
|
| 136 | + * @param Translate $outputlangs Lang output object |
|
| 137 | + * @param string $srctemplatepath Full path of source filename for generator using a template file |
|
| 138 | + * @param int $hidedetails Do not show line details |
|
| 139 | + * @param int $hidedesc Do not show desc |
|
| 140 | + * @param int $hideref Do not show ref |
|
| 141 | + * @return int 1=OK, 0=KO |
|
| 142 | 142 | */ |
| 143 | 143 | function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) |
| 144 | 144 | { |
@@ -230,25 +230,25 @@ discard block |
||
| 230 | 230 | |
| 231 | 231 | // Create pdf instance |
| 232 | 232 | $pdf=pdf_getInstance($this->format); |
| 233 | - $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance |
|
| 233 | + $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance |
|
| 234 | 234 | $heightforinfotot = 50; // Height reserved to output the info and total part |
| 235 | - $heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page |
|
| 236 | - $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
|
| 237 | - $pdf->SetAutoPageBreak(1,0); |
|
| 238 | - |
|
| 239 | - if (class_exists('TCPDF')) |
|
| 240 | - { |
|
| 241 | - $pdf->setPrintHeader(false); |
|
| 242 | - $pdf->setPrintFooter(false); |
|
| 243 | - } |
|
| 244 | - $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
|
| 245 | - |
|
| 246 | - // Set path to the background PDF File |
|
| 247 | - if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) |
|
| 248 | - { |
|
| 249 | - $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); |
|
| 250 | - $tplidx = $pdf->importPage(1); |
|
| 251 | - } |
|
| 235 | + $heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page |
|
| 236 | + $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
|
| 237 | + $pdf->SetAutoPageBreak(1,0); |
|
| 238 | + |
|
| 239 | + if (class_exists('TCPDF')) |
|
| 240 | + { |
|
| 241 | + $pdf->setPrintHeader(false); |
|
| 242 | + $pdf->setPrintFooter(false); |
|
| 243 | + } |
|
| 244 | + $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
|
| 245 | + |
|
| 246 | + // Set path to the background PDF File |
|
| 247 | + if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) |
|
| 248 | + { |
|
| 249 | + $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); |
|
| 250 | + $tplidx = $pdf->importPage(1); |
|
| 251 | + } |
|
| 252 | 252 | |
| 253 | 253 | $pdf->Open(); |
| 254 | 254 | $pagenb=0; |
@@ -538,8 +538,8 @@ discard block |
||
| 538 | 538 | // Discount on line |
| 539 | 539 | if ($object->lines[$i]->remise_percent) |
| 540 | 540 | { |
| 541 | - $pdf->SetXY($this->posxdiscount-2, $curY); |
|
| 542 | - $remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails); |
|
| 541 | + $pdf->SetXY($this->posxdiscount-2, $curY); |
|
| 542 | + $remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails); |
|
| 543 | 543 | $pdf->MultiCell($this->postotalht-$this->posxdiscount+2, 3, $remise_percent, 0, 'R'); |
| 544 | 544 | } |
| 545 | 545 | |
@@ -577,7 +577,7 @@ discard block |
||
| 577 | 577 | $localtax2_type = $localtaxtmp_array[2]; |
| 578 | 578 | } |
| 579 | 579 | |
| 580 | - // retrieve global local tax |
|
| 580 | + // retrieve global local tax |
|
| 581 | 581 | if ($localtax1_type && $localtax1ligne != 0) |
| 582 | 582 | $this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne; |
| 583 | 583 | if ($localtax2_type && $localtax2ligne != 0) |
@@ -713,20 +713,20 @@ discard block |
||
| 713 | 713 | /** |
| 714 | 714 | * Show payments table |
| 715 | 715 | * |
| 716 | - * @param PDF $pdf Object PDF |
|
| 717 | - * @param Object $object Object invoice |
|
| 718 | - * @param int $posy Position y in PDF |
|
| 719 | - * @param Translate $outputlangs Object langs for output |
|
| 720 | - * @return int <0 if KO, >0 if OK |
|
| 716 | + * @param PDF $pdf Object PDF |
|
| 717 | + * @param Object $object Object invoice |
|
| 718 | + * @param int $posy Position y in PDF |
|
| 719 | + * @param Translate $outputlangs Object langs for output |
|
| 720 | + * @return int <0 if KO, >0 if OK |
|
| 721 | 721 | */ |
| 722 | 722 | function _tableau_versements(&$pdf, $object, $posy, $outputlangs) |
| 723 | 723 | { |
| 724 | 724 | global $conf; |
| 725 | 725 | |
| 726 | - $sign=1; |
|
| 727 | - if ($object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1; |
|
| 726 | + $sign=1; |
|
| 727 | + if ($object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1; |
|
| 728 | 728 | |
| 729 | - $tab3_posx = 120; |
|
| 729 | + $tab3_posx = 120; |
|
| 730 | 730 | $tab3_top = $posy + 8; |
| 731 | 731 | $tab3_width = 80; |
| 732 | 732 | $tab3_height = 4; |
@@ -953,13 +953,13 @@ discard block |
||
| 953 | 953 | $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$account->proprio),0,'L',0); |
| 954 | 954 | $posy=$pdf->GetY()+1; |
| 955 | 955 | |
| 956 | - if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) |
|
| 957 | - { |
|
| 956 | + if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) |
|
| 957 | + { |
|
| 958 | 958 | $pdf->SetXY($this->marge_gauche, $posy); |
| 959 | 959 | $pdf->SetFont('','', $default_font_size - $diffsizetitle); |
| 960 | 960 | $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->owner_address), 0, 'L', 0); |
| 961 | 961 | $posy=$pdf->GetY()+2; |
| 962 | - } |
|
| 962 | + } |
|
| 963 | 963 | } |
| 964 | 964 | if ($conf->global->FACTURE_CHQ_NUMBER == -1) |
| 965 | 965 | { |
@@ -968,13 +968,13 @@ discard block |
||
| 968 | 968 | $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$this->emetteur->name),0,'L',0); |
| 969 | 969 | $posy=$pdf->GetY()+1; |
| 970 | 970 | |
| 971 | - if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) |
|
| 972 | - { |
|
| 971 | + if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) |
|
| 972 | + { |
|
| 973 | 973 | $pdf->SetXY($this->marge_gauche, $posy); |
| 974 | 974 | $pdf->SetFont('','', $default_font_size - $diffsizetitle); |
| 975 | 975 | $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0); |
| 976 | 976 | $posy=$pdf->GetY()+2; |
| 977 | - } |
|
| 977 | + } |
|
| 978 | 978 | } |
| 979 | 979 | } |
| 980 | 980 | } |
@@ -1016,10 +1016,10 @@ discard block |
||
| 1016 | 1016 | { |
| 1017 | 1017 | global $conf,$mysoc; |
| 1018 | 1018 | |
| 1019 | - $sign=1; |
|
| 1020 | - if ($object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1; |
|
| 1019 | + $sign=1; |
|
| 1020 | + if ($object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1; |
|
| 1021 | 1021 | |
| 1022 | - $default_font_size = pdf_getPDFFontSize($outputlangs); |
|
| 1022 | + $default_font_size = pdf_getPDFFontSize($outputlangs); |
|
| 1023 | 1023 | |
| 1024 | 1024 | $tab2_top = $posy; |
| 1025 | 1025 | $tab2_hl = 4; |
@@ -1088,7 +1088,7 @@ discard block |
||
| 1088 | 1088 | } |
| 1089 | 1089 | } |
| 1090 | 1090 | } |
| 1091 | - //} |
|
| 1091 | + //} |
|
| 1092 | 1092 | //Local tax 2 before VAT |
| 1093 | 1093 | //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') |
| 1094 | 1094 | //{ |
@@ -1180,7 +1180,7 @@ discard block |
||
| 1180 | 1180 | } |
| 1181 | 1181 | } |
| 1182 | 1182 | } |
| 1183 | - //} |
|
| 1183 | + //} |
|
| 1184 | 1184 | //Local tax 2 after VAT |
| 1185 | 1185 | //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') |
| 1186 | 1186 | //{ |
@@ -1190,7 +1190,7 @@ discard block |
||
| 1190 | 1190 | |
| 1191 | 1191 | foreach( $localtax_rate as $tvakey => $tvaval ) |
| 1192 | 1192 | { |
| 1193 | - // retrieve global local tax |
|
| 1193 | + // retrieve global local tax |
|
| 1194 | 1194 | if ($tvakey != 0) // On affiche pas taux 0 |
| 1195 | 1195 | { |
| 1196 | 1196 | //$this->atleastoneratenotnull++; |
@@ -1424,15 +1424,15 @@ discard block |
||
| 1424 | 1424 | |
| 1425 | 1425 | // Show Draft Watermark |
| 1426 | 1426 | if($object->statut==0 && (! empty($conf->global->FACTURE_DRAFT_WATERMARK)) ) |
| 1427 | - { |
|
| 1428 | - pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->FACTURE_DRAFT_WATERMARK); |
|
| 1429 | - } |
|
| 1427 | + { |
|
| 1428 | + pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->FACTURE_DRAFT_WATERMARK); |
|
| 1429 | + } |
|
| 1430 | 1430 | |
| 1431 | 1431 | $pdf->SetTextColor(0,0,60); |
| 1432 | 1432 | $pdf->SetFont('','B', $default_font_size + 3); |
| 1433 | 1433 | |
| 1434 | 1434 | $posy=$this->marge_haute; |
| 1435 | - $posx=$this->page_largeur-$this->marge_droite-100; |
|
| 1435 | + $posx=$this->page_largeur-$this->marge_droite-100; |
|
| 1436 | 1436 | |
| 1437 | 1437 | $pdf->SetXY($this->marge_gauche,$posy); |
| 1438 | 1438 | |
@@ -1442,7 +1442,7 @@ discard block |
||
| 1442 | 1442 | { |
| 1443 | 1443 | if (is_readable($logo)) |
| 1444 | 1444 | { |
| 1445 | - $height=pdf_getHeightForLogo($logo); |
|
| 1445 | + $height=pdf_getHeightForLogo($logo); |
|
| 1446 | 1446 | $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) |
| 1447 | 1447 | } |
| 1448 | 1448 | else |
@@ -1633,7 +1633,7 @@ discard block |
||
| 1633 | 1633 | |
| 1634 | 1634 | /** |
| 1635 | 1635 | * Show footer of page. Need this->emetteur object |
| 1636 | - * |
|
| 1636 | + * |
|
| 1637 | 1637 | * @param PDF $pdf PDF |
| 1638 | 1638 | * @param Object $object Object to show |
| 1639 | 1639 | * @param Translate $outputlangs Object lang for output |