@@ -51,43 +51,43 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | function formObjectOptions($parameters, &$object, &$action, $hookmanager) |
| 53 | 53 | { |
| 54 | - global $langs,$db,$user, $conf; |
|
| 54 | + global $langs, $db, $user, $conf; |
|
| 55 | 55 | |
| 56 | 56 | $langs->load('subtotal@subtotal'); |
| 57 | 57 | |
| 58 | - $contexts = explode(':',$parameters['context']); |
|
| 58 | + $contexts = explode(':', $parameters['context']); |
|
| 59 | 59 | |
| 60 | - if(in_array('ordercard',$contexts) || in_array('ordersuppliercard',$contexts) || in_array('propalcard',$contexts) || in_array('supplier_proposalcard',$contexts) || in_array('invoicecard',$contexts) || in_array('invoicesuppliercard',$contexts) || in_array('invoicereccard',$contexts)) { |
|
| 60 | + if (in_array('ordercard', $contexts) || in_array('ordersuppliercard', $contexts) || in_array('propalcard', $contexts) || in_array('supplier_proposalcard', $contexts) || in_array('invoicecard', $contexts) || in_array('invoicesuppliercard', $contexts) || in_array('invoicereccard', $contexts)) { |
|
| 61 | 61 | |
| 62 | 62 | $createRight = $user->rights->{$object->element}->creer; |
| 63 | - if($object->element == 'facturerec' ) |
|
| 63 | + if ($object->element == 'facturerec') |
|
| 64 | 64 | { |
| 65 | 65 | $object->statut = 0; // hack for facture rec |
| 66 | 66 | $createRight = $user->rights->facture->creer; |
| 67 | - } elseif($object->element == 'order_supplier' ) |
|
| 67 | + } elseif ($object->element == 'order_supplier') |
|
| 68 | 68 | { |
| 69 | 69 | $createRight = $user->rights->fournisseur->commande->creer; |
| 70 | - } elseif($object->element == 'invoice_supplier' ) |
|
| 70 | + } elseif ($object->element == 'invoice_supplier') |
|
| 71 | 71 | { |
| 72 | 72 | $createRight = $user->rights->fournisseur->facture->creer; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - if ($object->statut == 0 && $createRight) { |
|
| 75 | + if ($object->statut == 0 && $createRight) { |
|
| 76 | 76 | |
| 77 | 77 | |
| 78 | - if($object->element=='facture')$idvar = 'facid'; |
|
| 79 | - else $idvar='id'; |
|
| 78 | + if ($object->element == 'facture')$idvar = 'facid'; |
|
| 79 | + else $idvar = 'id'; |
|
| 80 | 80 | |
| 81 | - if(in_array($action, array('add_title_line', 'add_total_line', 'add_subtitle_line', 'add_subtotal_line', 'add_free_text')) ) |
|
| 81 | + if (in_array($action, array('add_title_line', 'add_total_line', 'add_subtitle_line', 'add_subtotal_line', 'add_free_text'))) |
|
| 82 | 82 | { |
| 83 | 83 | $level = GETPOST('level', 'int'); //New avec SUBTOTAL_USE_NEW_FORMAT |
| 84 | 84 | |
| 85 | - if($action=='add_title_line') { |
|
| 85 | + if ($action == 'add_title_line') { |
|
| 86 | 86 | $title = GETPOST('title'); |
| 87 | - if(empty($title)) $title = $langs->trans('title'); |
|
| 88 | - $qty = $level<1 ? 1 : $level ; |
|
| 87 | + if (empty($title)) $title = $langs->trans('title'); |
|
| 88 | + $qty = $level < 1 ? 1 : $level; |
|
| 89 | 89 | } |
| 90 | - else if($action=='add_free_text') { |
|
| 90 | + else if ($action == 'add_free_text') { |
|
| 91 | 91 | $title = GETPOST('title'); |
| 92 | 92 | |
| 93 | 93 | if (empty($title)) { |
@@ -99,21 +99,21 @@ discard block |
||
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | - if(empty($title)) $title = $langs->trans('subtotalAddLineDescription'); |
|
| 102 | + if (empty($title)) $title = $langs->trans('subtotalAddLineDescription'); |
|
| 103 | 103 | $qty = 50; |
| 104 | 104 | } |
| 105 | - else if($action=='add_subtitle_line') { |
|
| 105 | + else if ($action == 'add_subtitle_line') { |
|
| 106 | 106 | $title = GETPOST('title'); |
| 107 | - if(empty($title)) $title = $langs->trans('subtitle'); |
|
| 107 | + if (empty($title)) $title = $langs->trans('subtitle'); |
|
| 108 | 108 | $qty = 2; |
| 109 | 109 | } |
| 110 | - else if($action=='add_subtotal_line') { |
|
| 110 | + else if ($action == 'add_subtotal_line') { |
|
| 111 | 111 | $title = $langs->trans('SubSubTotal'); |
| 112 | 112 | $qty = 98; |
| 113 | 113 | } |
| 114 | 114 | else { |
| 115 | 115 | $title = GETPOST('title') ? GETPOST('title') : $langs->trans('SubTotal'); |
| 116 | - $qty = $level ? 100-$level : 99; |
|
| 116 | + $qty = $level ? 100 - $level : 99; |
|
| 117 | 117 | } |
| 118 | 118 | dol_include_once('/subtotal/class/subtotal.class.php'); |
| 119 | 119 | |
@@ -121,15 +121,15 @@ discard block |
||
| 121 | 121 | |
| 122 | 122 | TSubtotal::addSubTotalLine($object, $title, $qty); |
| 123 | 123 | } |
| 124 | - else if($action==='ask_deleteallline') { |
|
| 125 | - $form=new Form($db); |
|
| 124 | + else if ($action === 'ask_deleteallline') { |
|
| 125 | + $form = new Form($db); |
|
| 126 | 126 | |
| 127 | - $lineid = GETPOST('lineid','integer'); |
|
| 127 | + $lineid = GETPOST('lineid', 'integer'); |
|
| 128 | 128 | $TIdForGroup = $this->getArrayOfLineForAGroup($object, $lineid); |
| 129 | 129 | |
| 130 | 130 | $nbLines = count($TIdForGroup); |
| 131 | 131 | |
| 132 | - $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('deleteWithAllLines'), $langs->trans('ConfirmDeleteAllThisLines',$nbLines), 'confirm_delete_all_lines','',0,1); |
|
| 132 | + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('deleteWithAllLines'), $langs->trans('ConfirmDeleteAllThisLines', $nbLines), 'confirm_delete_all_lines', '', 0, 1); |
|
| 133 | 133 | print $formconfirm; |
| 134 | 134 | } |
| 135 | 135 | |
@@ -139,13 +139,13 @@ discard block |
||
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | |
| 142 | - if($action!='editline') { |
|
| 142 | + if ($action != 'editline') { |
|
| 143 | 143 | // New format is for 3.8 |
| 144 | 144 | $this->printNewFormat($object, $conf, $langs, $idvar); |
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | - elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice',$contexts)) |
|
| 148 | + elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice', $contexts)) |
|
| 149 | 149 | { |
| 150 | 150 | ?> |
| 151 | 151 | <script type="text/javascript"> |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | $(document).ready(function() { |
| 171 | 171 | $('div.fiche div.tabsAction').append('<br />'); |
| 172 | 172 | |
| 173 | - $('div.fiche div.tabsAction').append('<div class="inline-block divButAction"><a id="add_title_line" rel="add_title_line" href="javascript:;" class="butAction"><?php echo $langs->trans('AddTitle' )?></a></div>'); |
|
| 173 | + $('div.fiche div.tabsAction').append('<div class="inline-block divButAction"><a id="add_title_line" rel="add_title_line" href="javascript:;" class="butAction"><?php echo $langs->trans('AddTitle')?></a></div>'); |
|
| 174 | 174 | $('div.fiche div.tabsAction').append('<div class="inline-block divButAction"><a id="add_total_line" rel="add_total_line" href="javascript:;" class="butAction"><?php echo $langs->trans('AddSubTotal')?></a></div>'); |
| 175 | 175 | $('div.fiche div.tabsAction').append('<div class="inline-block divButAction"><a id="add_free_text" rel="add_free_text" href="javascript:;" class="butAction"><?php echo $langs->trans('AddFreeText')?></a></div>'); |
| 176 | 176 | |
@@ -221,9 +221,9 @@ discard block |
||
| 221 | 221 | $('body').append(dialog_html); |
| 222 | 222 | |
| 223 | 223 | <?php |
| 224 | - $editorTool = empty($conf->global->FCKEDITOR_EDITORNAME)?'ckeditor':$conf->global->FCKEDITOR_EDITORNAME; |
|
| 225 | - $editorConf = empty($conf->global->FCKEDITOR_ENABLE_DETAILS)?false:$conf->global->FCKEDITOR_ENABLE_DETAILS; |
|
| 226 | - if($editorConf && in_array($editorTool,array('textarea','ckeditor'))){ |
|
| 224 | + $editorTool = empty($conf->global->FCKEDITOR_EDITORNAME) ? 'ckeditor' : $conf->global->FCKEDITOR_EDITORNAME; |
|
| 225 | + $editorConf = empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ?false:$conf->global->FCKEDITOR_ENABLE_DETAILS; |
|
| 226 | + if ($editorConf && in_array($editorTool, array('textarea', 'ckeditor'))) { |
|
| 227 | 227 | ?> |
| 228 | 228 | if (action == 'addTitle' || action == 'addFreeTxt') |
| 229 | 229 | { |
@@ -338,62 +338,62 @@ discard block |
||
| 338 | 338 | global $conf, $langs, $bc; |
| 339 | 339 | |
| 340 | 340 | $action = GETPOST('action'); |
| 341 | - $TContext = explode(':',$parameters['context']); |
|
| 341 | + $TContext = explode(':', $parameters['context']); |
|
| 342 | 342 | if ( |
| 343 | - in_array('invoicecard',$TContext) |
|
| 344 | - || in_array('invoicesuppliercard',$TContext) |
|
| 345 | - || in_array('propalcard',$TContext) |
|
| 346 | - || in_array('ordercard',$TContext) |
|
| 347 | - || in_array('ordersuppliercard',$TContext) |
|
| 348 | - || in_array('invoicereccard',$TContext) |
|
| 343 | + in_array('invoicecard', $TContext) |
|
| 344 | + || in_array('invoicesuppliercard', $TContext) |
|
| 345 | + || in_array('propalcard', $TContext) |
|
| 346 | + || in_array('ordercard', $TContext) |
|
| 347 | + || in_array('ordersuppliercard', $TContext) |
|
| 348 | + || in_array('invoicereccard', $TContext) |
|
| 349 | 349 | ) |
| 350 | 350 | { |
| 351 | - $hideInnerLines = isset( $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']] ) ? $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']] : 0; |
|
| 352 | - $hidedetails = isset( $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']] ) ? $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']] : 0; |
|
| 353 | - $hidepricesDefaultConf = !empty($conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED)?$conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED:0; |
|
| 354 | - $hideprices= isset( $_SESSION['subtotal_hideprices_'.$parameters['modulepart']] ) ? $_SESSION['subtotal_hideprices_'.$parameters['modulepart']] : $hidepricesDefaultConf; |
|
| 351 | + $hideInnerLines = isset($_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']]) ? $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']] : 0; |
|
| 352 | + $hidedetails = isset($_SESSION['subtotal_hidedetails_'.$parameters['modulepart']]) ? $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']] : 0; |
|
| 353 | + $hidepricesDefaultConf = !empty($conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED) ? $conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED : 0; |
|
| 354 | + $hideprices = isset($_SESSION['subtotal_hideprices_'.$parameters['modulepart']]) ? $_SESSION['subtotal_hideprices_'.$parameters['modulepart']] : $hidepricesDefaultConf; |
|
| 355 | 355 | |
| 356 | - $var=false; |
|
| 357 | - $out.= '<tr '.$bc[$var].'> |
|
| 356 | + $var = false; |
|
| 357 | + $out .= '<tr '.$bc[$var].'> |
|
| 358 | 358 | <td colspan="4" align="right"> |
| 359 | 359 | <label for="hideInnerLines">'.$langs->trans('HideInnerLines').'</label> |
| 360 | - <input type="checkbox" onclick="if($(this).is(\':checked\')) { $(\'#hidedetails\').prop(\'checked\', \'checked\') }" id="hideInnerLines" name="hideInnerLines" value="1" '.(( $hideInnerLines ) ? 'checked="checked"' : '' ).' /> |
|
| 360 | + <input type="checkbox" onclick="if($(this).is(\':checked\')) { $(\'#hidedetails\').prop(\'checked\', \'checked\') }" id="hideInnerLines" name="hideInnerLines" value="1" '.(($hideInnerLines) ? 'checked="checked"' : '').' /> |
|
| 361 | 361 | </td> |
| 362 | 362 | </tr>'; |
| 363 | 363 | |
| 364 | - $var=!$var; |
|
| 365 | - $out.= '<tr '.$bc[$var].'> |
|
| 364 | + $var = !$var; |
|
| 365 | + $out .= '<tr '.$bc[$var].'> |
|
| 366 | 366 | <td colspan="4" align="right"> |
| 367 | 367 | <label for="hidedetails">'.$langs->trans('SubTotalhidedetails').'</label> |
| 368 | - <input type="checkbox" id="hidedetails" name="hidedetails" value="1" '.(( $hidedetails ) ? 'checked="checked"' : '' ).' /> |
|
| 368 | + <input type="checkbox" id="hidedetails" name="hidedetails" value="1" '.(($hidedetails) ? 'checked="checked"' : '').' /> |
|
| 369 | 369 | </td> |
| 370 | 370 | </tr>'; |
| 371 | 371 | |
| 372 | - $var=!$var; |
|
| 373 | - $out.= '<tr '.$bc[$var].'> |
|
| 372 | + $var = !$var; |
|
| 373 | + $out .= '<tr '.$bc[$var].'> |
|
| 374 | 374 | <td colspan="4" align="right"> |
| 375 | 375 | <label for="hidedetails">'.$langs->trans('SubTotalhidePrice').'</label> |
| 376 | - <input type="checkbox" id="hideprices" name="hideprices" value="1" '.(( $hideprices ) ? 'checked="checked"' : '' ).' /> |
|
| 376 | + <input type="checkbox" id="hideprices" name="hideprices" value="1" '.(($hideprices) ? 'checked="checked"' : '').' /> |
|
| 377 | 377 | </td> |
| 378 | 378 | </tr>'; |
| 379 | 379 | |
| 380 | 380 | |
| 381 | 381 | |
| 382 | 382 | if ( |
| 383 | - (in_array('propalcard',$TContext) && !empty($conf->global->SUBTOTAL_PROPAL_ADD_RECAP)) |
|
| 384 | - || (in_array('ordercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
| 385 | - || (in_array('ordersuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
| 386 | - || (in_array('invoicecard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
| 387 | - || (in_array('invoicesuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
| 388 | - || (in_array('invoicereccard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP )) |
|
| 383 | + (in_array('propalcard', $TContext) && !empty($conf->global->SUBTOTAL_PROPAL_ADD_RECAP)) |
|
| 384 | + || (in_array('ordercard', $TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
| 385 | + || (in_array('ordersuppliercard', $TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
| 386 | + || (in_array('invoicecard', $TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
| 387 | + || (in_array('invoicesuppliercard', $TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
| 388 | + || (in_array('invoicereccard', $TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
| 389 | 389 | ) |
| 390 | 390 | { |
| 391 | - $var=!$var; |
|
| 392 | - $out.= ' |
|
| 391 | + $var = !$var; |
|
| 392 | + $out .= ' |
|
| 393 | 393 | <tr '.$bc[$var].'> |
| 394 | 394 | <td colspan="4" align="right"> |
| 395 | 395 | <label for="subtotal_add_recap">'.$langs->trans('subtotal_add_recap').'</label> |
| 396 | - <input type="checkbox" id="subtotal_add_recap" name="subtotal_add_recap" value="1" '.( GETPOST('subtotal_add_recap') ? 'checked="checked"' : '' ).' /> |
|
| 396 | + <input type="checkbox" id="subtotal_add_recap" name="subtotal_add_recap" value="1" '.(GETPOST('subtotal_add_recap') ? 'checked="checked"' : '').' /> |
|
| 397 | 397 | </td> |
| 398 | 398 | </tr>'; |
| 399 | 399 | } |
@@ -409,7 +409,7 @@ discard block |
||
| 409 | 409 | function formEditProductOptions($parameters, &$object, &$action, $hookmanager) |
| 410 | 410 | { |
| 411 | 411 | |
| 412 | - if (in_array('invoicecard',explode(':',$parameters['context']))) |
|
| 412 | + if (in_array('invoicecard', explode(':', $parameters['context']))) |
|
| 413 | 413 | { |
| 414 | 414 | |
| 415 | 415 | } |
@@ -420,13 +420,13 @@ discard block |
||
| 420 | 420 | function ODTSubstitutionLine(&$parameters, &$object, $action, $hookmanager) { |
| 421 | 421 | global $conf; |
| 422 | 422 | |
| 423 | - if($action === 'builddoc') { |
|
| 423 | + if ($action === 'builddoc') { |
|
| 424 | 424 | |
| 425 | 425 | $line = &$parameters['line']; |
| 426 | 426 | $object = &$parameters['object']; |
| 427 | 427 | $substitutionarray = &$parameters['substitutionarray']; |
| 428 | 428 | |
| 429 | - if($line->product_type == 9 && $line->special_code == $this->module_number) { |
|
| 429 | + if ($line->product_type == 9 && $line->special_code == $this->module_number) { |
|
| 430 | 430 | $substitutionarray['line_modsubtotal'] = 1; |
| 431 | 431 | |
| 432 | 432 | $substitutionarray['line_price_ht'] |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | = $substitutionarray['line_up'] |
| 438 | 438 | = ''; |
| 439 | 439 | |
| 440 | - if($line->qty>90) { |
|
| 440 | + if ($line->qty > 90) { |
|
| 441 | 441 | $substitutionarray['line_modsubtotal_total'] = true; |
| 442 | 442 | |
| 443 | 443 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
@@ -451,7 +451,7 @@ discard block |
||
| 451 | 451 | |
| 452 | 452 | |
| 453 | 453 | } |
| 454 | - else{ |
|
| 454 | + else { |
|
| 455 | 455 | $substitutionarray['line_not_modsubtotal'] = true; |
| 456 | 456 | $substitutionarray['line_modsubtotal'] = 0; |
| 457 | 457 | } |
@@ -463,29 +463,29 @@ discard block |
||
| 463 | 463 | function createFrom($parameters, &$object, $action, $hookmanager) { |
| 464 | 464 | |
| 465 | 465 | if ( |
| 466 | - in_array('invoicecard',explode(':',$parameters['context'])) |
|
| 467 | - || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
| 468 | - || in_array('propalcard',explode(':',$parameters['context'])) |
|
| 469 | - || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
| 470 | - || in_array('ordercard',explode(':',$parameters['context'])) |
|
| 471 | - || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
| 472 | - || in_array('invoicereccard',explode(':',$parameters['context'])) |
|
| 466 | + in_array('invoicecard', explode(':', $parameters['context'])) |
|
| 467 | + || in_array('invoicesuppliercard', explode(':', $parameters['context'])) |
|
| 468 | + || in_array('propalcard', explode(':', $parameters['context'])) |
|
| 469 | + || in_array('supplier_proposalcard', explode(':', $parameters['context'])) |
|
| 470 | + || in_array('ordercard', explode(':', $parameters['context'])) |
|
| 471 | + || in_array('ordersuppliercard', explode(':', $parameters['context'])) |
|
| 472 | + || in_array('invoicereccard', explode(':', $parameters['context'])) |
|
| 473 | 473 | ) { |
| 474 | 474 | |
| 475 | 475 | global $db; |
| 476 | 476 | |
| 477 | 477 | $objFrom = $parameters['objFrom']; |
| 478 | 478 | |
| 479 | - foreach($objFrom->lines as $k=> &$lineOld) { |
|
| 479 | + foreach ($objFrom->lines as $k=> &$lineOld) { |
|
| 480 | 480 | |
| 481 | - if($lineOld->product_type == 9 && $lineOld->info_bits > 0 ) { |
|
| 481 | + if ($lineOld->product_type == 9 && $lineOld->info_bits > 0) { |
|
| 482 | 482 | |
| 483 | 483 | $line = & $object->lines[$k]; |
| 484 | 484 | |
| 485 | 485 | $idLine = (int) ($line->id ? $line->id : $line->rowid); |
| 486 | 486 | |
| 487 | 487 | $db->query("UPDATE ".MAIN_DB_PREFIX.$line->table_element." |
| 488 | - SET info_bits=".(int)$lineOld->info_bits." |
|
| 488 | + SET info_bits=".(int) $lineOld->info_bits." |
|
| 489 | 489 | WHERE rowid = ".$idLine." |
| 490 | 490 | "); |
| 491 | 491 | |
@@ -501,15 +501,15 @@ discard block |
||
| 501 | 501 | |
| 502 | 502 | function doActions($parameters, &$object, $action, $hookmanager) |
| 503 | 503 | { |
| 504 | - global $db, $conf, $langs,$user; |
|
| 504 | + global $db, $conf, $langs, $user; |
|
| 505 | 505 | |
| 506 | 506 | dol_include_once('/subtotal/class/subtotal.class.php'); |
| 507 | 507 | dol_include_once('/subtotal/lib/subtotal.lib.php'); |
| 508 | - require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; |
|
| 508 | + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; |
|
| 509 | 509 | |
| 510 | 510 | $showBlockExtrafields = GETPOST('showBlockExtrafields'); |
| 511 | 511 | |
| 512 | - if($object->element=='facture') $idvar = 'facid'; |
|
| 512 | + if ($object->element == 'facture') $idvar = 'facid'; |
|
| 513 | 513 | else $idvar = 'id'; |
| 514 | 514 | |
| 515 | 515 | if ($action == 'updateligne' || $action == 'updateline') |
@@ -522,7 +522,7 @@ discard block |
||
| 522 | 522 | if ($line->id == $lineid && TSubtotal::isModSubtotalLine($line)) |
| 523 | 523 | { |
| 524 | 524 | $found = true; |
| 525 | - if(TSubtotal::isTitle($line) && !empty($showBlockExtrafields)) { |
|
| 525 | + if (TSubtotal::isTitle($line) && !empty($showBlockExtrafields)) { |
|
| 526 | 526 | $extrafieldsline = new ExtraFields($db); |
| 527 | 527 | $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); |
| 528 | 528 | $extrafieldsline->setOptionalsFromPost($extralabelsline, $line); |
@@ -541,43 +541,43 @@ discard block |
||
| 541 | 541 | exit; // Surtout ne pas laisser Dolibarr faire du traitement sur le updateligne sinon ça plante les données de la ligne |
| 542 | 542 | } |
| 543 | 543 | } |
| 544 | - else if($action === 'builddoc') { |
|
| 544 | + else if ($action === 'builddoc') { |
|
| 545 | 545 | |
| 546 | 546 | if ( |
| 547 | - in_array('invoicecard',explode(':',$parameters['context'])) |
|
| 548 | - || in_array('propalcard',explode(':',$parameters['context'])) |
|
| 549 | - || in_array('ordercard',explode(':',$parameters['context'])) |
|
| 550 | - || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
| 551 | - || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
| 552 | - || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
| 547 | + in_array('invoicecard', explode(':', $parameters['context'])) |
|
| 548 | + || in_array('propalcard', explode(':', $parameters['context'])) |
|
| 549 | + || in_array('ordercard', explode(':', $parameters['context'])) |
|
| 550 | + || in_array('ordersuppliercard', explode(':', $parameters['context'])) |
|
| 551 | + || in_array('invoicesuppliercard', explode(':', $parameters['context'])) |
|
| 552 | + || in_array('supplier_proposalcard', explode(':', $parameters['context'])) |
|
| 553 | 553 | ) |
| 554 | 554 | { |
| 555 | - if(in_array('invoicecard',explode(':',$parameters['context']))) { |
|
| 555 | + if (in_array('invoicecard', explode(':', $parameters['context']))) { |
|
| 556 | 556 | $sessname = 'subtotal_hideInnerLines_facture'; |
| 557 | 557 | $sessname2 = 'subtotal_hidedetails_facture'; |
| 558 | 558 | $sessname3 = 'subtotal_hideprices_facture'; |
| 559 | 559 | } |
| 560 | - elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) { |
|
| 560 | + elseif (in_array('invoicesuppliercard', explode(':', $parameters['context']))) { |
|
| 561 | 561 | $sessname = 'subtotal_hideInnerLines_facture_fournisseur'; |
| 562 | 562 | $sessname2 = 'subtotal_hidedetails_facture_fournisseur'; |
| 563 | 563 | $sessname3 = 'subtotal_hideprices_facture_fournisseur'; |
| 564 | 564 | } |
| 565 | - elseif(in_array('propalcard',explode(':',$parameters['context']))) { |
|
| 565 | + elseif (in_array('propalcard', explode(':', $parameters['context']))) { |
|
| 566 | 566 | $sessname = 'subtotal_hideInnerLines_propal'; |
| 567 | 567 | $sessname2 = 'subtotal_hidedetails_propal'; |
| 568 | 568 | $sessname3 = 'subtotal_hideprices_propal'; |
| 569 | 569 | } |
| 570 | - elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) { |
|
| 570 | + elseif (in_array('supplier_proposalcard', explode(':', $parameters['context']))) { |
|
| 571 | 571 | $sessname = 'subtotal_hideInnerLines_supplier_proposal'; |
| 572 | 572 | $sessname2 = 'subtotal_hidedetails_supplier_proposal'; |
| 573 | 573 | $sessname3 = 'subtotal_hideprices_supplier_proposal'; |
| 574 | 574 | } |
| 575 | - elseif(in_array('ordercard',explode(':',$parameters['context']))) { |
|
| 575 | + elseif (in_array('ordercard', explode(':', $parameters['context']))) { |
|
| 576 | 576 | $sessname = 'subtotal_hideInnerLines_commande'; |
| 577 | 577 | $sessname2 = 'subtotal_hidedetails_commande'; |
| 578 | 578 | $sessname3 = 'subtotal_hideprices_commande'; |
| 579 | 579 | } |
| 580 | - elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) { |
|
| 580 | + elseif (in_array('ordersuppliercard', explode(':', $parameters['context']))) { |
|
| 581 | 581 | $sessname = 'subtotal_hideInnerLines_commande_fournisseur'; |
| 582 | 582 | $sessname2 = 'subtotal_hidedetails_commande_fournisseur'; |
| 583 | 583 | $sessname3 = 'subtotal_hideprices_commande_fournisseur'; |
@@ -590,22 +590,22 @@ discard block |
||
| 590 | 590 | |
| 591 | 591 | global $hideprices; |
| 592 | 592 | |
| 593 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
| 593 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
| 594 | 594 | $_SESSION[$sessname] = $hideInnerLines; |
| 595 | 595 | |
| 596 | - $hidedetails= (int)GETPOST('hidedetails'); |
|
| 596 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
| 597 | 597 | $_SESSION[$sessname2] = $hidedetails; |
| 598 | 598 | |
| 599 | - $hideprices= (int)GETPOST('hideprices'); |
|
| 599 | + $hideprices = (int) GETPOST('hideprices'); |
|
| 600 | 600 | $_SESSION[$sessname3] = $hideprices; |
| 601 | 601 | |
| 602 | - foreach($object->lines as &$line) { |
|
| 602 | + foreach ($object->lines as &$line) { |
|
| 603 | 603 | if ($line->product_type == 9 && $line->special_code == $this->module_number) { |
| 604 | 604 | |
| 605 | - if($line->qty>=90) { |
|
| 605 | + if ($line->qty >= 90) { |
|
| 606 | 606 | $line->modsubtotal_total = 1; |
| 607 | 607 | } |
| 608 | - else{ |
|
| 608 | + else { |
|
| 609 | 609 | $line->modsubtotal_title = 1; |
| 610 | 610 | } |
| 611 | 611 | |
@@ -615,34 +615,34 @@ discard block |
||
| 615 | 615 | } |
| 616 | 616 | |
| 617 | 617 | } |
| 618 | - else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') { |
|
| 618 | + else if ($action === 'confirm_delete_all_lines' && GETPOST('confirm') == 'yes') { |
|
| 619 | 619 | |
| 620 | 620 | $Tab = $this->getArrayOfLineForAGroup($object, GETPOST('lineid')); |
| 621 | 621 | |
| 622 | - foreach($Tab as $idLine) { |
|
| 622 | + foreach ($Tab as $idLine) { |
|
| 623 | 623 | /** |
| 624 | 624 | * @var $object Facture |
| 625 | 625 | */ |
| 626 | - if($object->element=='facture') $object->deleteline($idLine); |
|
| 626 | + if ($object->element == 'facture') $object->deleteline($idLine); |
|
| 627 | 627 | /** |
| 628 | 628 | * @var $object Facture fournisseur |
| 629 | 629 | */ |
| 630 | - else if($object->element=='invoice_supplier') |
|
| 630 | + else if ($object->element == 'invoice_supplier') |
|
| 631 | 631 | { |
| 632 | 632 | $object->deleteline($idLine); |
| 633 | 633 | } |
| 634 | 634 | /** |
| 635 | 635 | * @var $object Propal |
| 636 | 636 | */ |
| 637 | - else if($object->element=='propal') $object->deleteline($idLine); |
|
| 637 | + else if ($object->element == 'propal') $object->deleteline($idLine); |
|
| 638 | 638 | /** |
| 639 | 639 | * @var $object Propal Fournisseur |
| 640 | 640 | */ |
| 641 | - else if($object->element=='supplier_proposal') $object->deleteline($idLine); |
|
| 641 | + else if ($object->element == 'supplier_proposal') $object->deleteline($idLine); |
|
| 642 | 642 | /** |
| 643 | 643 | * @var $object Commande |
| 644 | 644 | */ |
| 645 | - else if($object->element=='commande') |
|
| 645 | + else if ($object->element == 'commande') |
|
| 646 | 646 | { |
| 647 | 647 | if ((float) DOL_VERSION >= 5.0) $object->deleteline($user, $idLine); |
| 648 | 648 | else $object->deleteline($idLine); |
@@ -650,14 +650,14 @@ discard block |
||
| 650 | 650 | /** |
| 651 | 651 | * @var $object Commande fournisseur |
| 652 | 652 | */ |
| 653 | - else if($object->element=='order_supplier') |
|
| 653 | + else if ($object->element == 'order_supplier') |
|
| 654 | 654 | { |
| 655 | 655 | $object->deleteline($idLine); |
| 656 | 656 | } |
| 657 | 657 | /** |
| 658 | 658 | * @var $object Facturerec |
| 659 | 659 | */ |
| 660 | - else if($object->element=='facturerec') $object->deleteline($idLine); |
|
| 660 | + else if ($object->element == 'facturerec') $object->deleteline($idLine); |
|
| 661 | 661 | } |
| 662 | 662 | |
| 663 | 663 | header('location:?id='.$object->id); |
@@ -680,7 +680,7 @@ discard block |
||
| 680 | 680 | return 0; |
| 681 | 681 | } |
| 682 | 682 | |
| 683 | - function formAddObjectLine ($parameters, &$object, &$action, $hookmanager) { |
|
| 683 | + function formAddObjectLine($parameters, &$object, &$action, $hookmanager) { |
|
| 684 | 684 | return 0; |
| 685 | 685 | } |
| 686 | 686 | |
@@ -692,22 +692,22 @@ discard block |
||
| 692 | 692 | |
| 693 | 693 | $found = false; |
| 694 | 694 | |
| 695 | - $Tab= array(); |
|
| 695 | + $Tab = array(); |
|
| 696 | 696 | |
| 697 | - foreach($object->lines as $l) { |
|
| 697 | + foreach ($object->lines as $l) { |
|
| 698 | 698 | |
| 699 | 699 | $lid = (!empty($l->rowid) ? $l->rowid : $l->id); |
| 700 | - if($lid == $lineid) { |
|
| 700 | + if ($lid == $lineid) { |
|
| 701 | 701 | |
| 702 | 702 | $found = true; |
| 703 | 703 | $qty_line = $l->qty; |
| 704 | 704 | } |
| 705 | 705 | |
| 706 | - if($found) { |
|
| 706 | + if ($found) { |
|
| 707 | 707 | |
| 708 | 708 | $Tab[] = (!empty($l->rowid) ? $l->rowid : $l->id); |
| 709 | 709 | |
| 710 | - if($l->special_code==$this->module_number && (($l->qty==99 && $qty_line==1) || ($l->qty==98 && $qty_line==2)) ) { |
|
| 710 | + if ($l->special_code == $this->module_number && (($l->qty == 99 && $qty_line == 1) || ($l->qty == 98 && $qty_line == 2))) { |
|
| 711 | 711 | break; // end of story |
| 712 | 712 | } |
| 713 | 713 | } |
@@ -736,7 +736,7 @@ discard block |
||
| 736 | 736 | * |
| 737 | 737 | * @param $use_level isn't used anymore |
| 738 | 738 | */ |
| 739 | - function getTotalLineFromObject(&$object, &$line, $use_level=false, $return_all=0) { |
|
| 739 | + function getTotalLineFromObject(&$object, &$line, $use_level = false, $return_all = 0) { |
|
| 740 | 740 | |
| 741 | 741 | $rang = $line->rang; |
| 742 | 742 | $qty_line = $line->qty; |
@@ -747,21 +747,21 @@ discard block |
||
| 747 | 747 | $TTotal_tva = array(); |
| 748 | 748 | |
| 749 | 749 | dol_include_once('/subtotal/class/subtotal.class.php'); |
| 750 | - foreach($object->lines as $l) { |
|
| 750 | + foreach ($object->lines as $l) { |
|
| 751 | 751 | //print $l->rang.'>='.$rang.' '.$total.'<br/>'; |
| 752 | - if($l->rang>=$rang) { |
|
| 752 | + if ($l->rang >= $rang) { |
|
| 753 | 753 | //echo 'return!<br>'; |
| 754 | 754 | if (!$return_all) return $total; |
| 755 | 755 | else return array($total, $total_tva, $total_ttc, $TTotal_tva); |
| 756 | 756 | } |
| 757 | - else if(TSubtotal::isTitle($l, 100 - $qty_line)) |
|
| 757 | + else if (TSubtotal::isTitle($l, 100 - $qty_line)) |
|
| 758 | 758 | { |
| 759 | 759 | $total = 0; |
| 760 | 760 | $total_tva = 0; |
| 761 | 761 | $total_ttc = 0; |
| 762 | 762 | $TTotal_tva = array(); |
| 763 | 763 | } |
| 764 | - elseif(!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) { |
|
| 764 | + elseif (!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) { |
|
| 765 | 765 | $total += $l->total_ht; |
| 766 | 766 | $total_tva += $l->total_tva; |
| 767 | 767 | $TTotal_tva[$l->tva_tx] += $l->total_tva; |
@@ -780,18 +780,18 @@ discard block |
||
| 780 | 780 | |
| 781 | 781 | $rang = $line->rang; |
| 782 | 782 | $total = 0; |
| 783 | - foreach($object->lines as $l) { |
|
| 784 | - if($l->rang>=$rang) { |
|
| 783 | + foreach ($object->lines as $l) { |
|
| 784 | + if ($l->rang >= $rang) { |
|
| 785 | 785 | return price($total); |
| 786 | 786 | } |
| 787 | - if (TSubtotal::isSubtotal($l)){ |
|
| 787 | + if (TSubtotal::isSubtotal($l)) { |
|
| 788 | 788 | $total = 0; |
| 789 | - } else if ($l->situation_percent > 0 ){ |
|
| 789 | + } else if ($l->situation_percent > 0) { |
|
| 790 | 790 | |
| 791 | 791 | |
| 792 | 792 | $prev_progress = $l->get_prev_progress($object->id); |
| 793 | - $progress = ($l->situation_percent - $prev_progress) /100; |
|
| 794 | - $total += ($l->total_ht/($l->situation_percent/100)) * $progress; |
|
| 793 | + $progress = ($l->situation_percent - $prev_progress) / 100; |
|
| 794 | + $total += ($l->total_ht / ($l->situation_percent / 100)) * $progress; |
|
| 795 | 795 | |
| 796 | 796 | } |
| 797 | 797 | } |
@@ -810,10 +810,10 @@ discard block |
||
| 810 | 810 | * @param $w float width |
| 811 | 811 | * @param $h float height |
| 812 | 812 | */ |
| 813 | - function pdf_add_total(&$pdf,&$object, &$line, $label, $description,$posx, $posy, $w, $h) { |
|
| 814 | - global $conf,$subtotal_last_title_posy; |
|
| 813 | + function pdf_add_total(&$pdf, &$object, &$line, $label, $description, $posx, $posy, $w, $h) { |
|
| 814 | + global $conf, $subtotal_last_title_posy; |
|
| 815 | 815 | |
| 816 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
| 816 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
| 817 | 817 | if (!empty($conf->global->SUBTOTAL_ONE_LINE_IF_HIDE_INNERLINES) && $hideInnerLines && !empty($subtotal_last_title_posy)) |
| 818 | 818 | { |
| 819 | 819 | $posy = $subtotal_last_title_posy; |
@@ -823,34 +823,34 @@ discard block |
||
| 823 | 823 | $hidePriceOnSubtotalLines = (int) GETPOST('hide_price_on_subtotal_lines'); |
| 824 | 824 | |
| 825 | 825 | $set_pagebreak_margin = false; |
| 826 | - if(method_exists('Closure','bind')) { |
|
| 826 | + if (method_exists('Closure', 'bind')) { |
|
| 827 | 827 | $pageBreakOriginalValue = $pdf->AcceptPageBreak(); |
| 828 | - $sweetsThief = function ($pdf) { |
|
| 829 | - return $pdf->bMargin ; |
|
| 828 | + $sweetsThief = function($pdf) { |
|
| 829 | + return $pdf->bMargin; |
|
| 830 | 830 | }; |
| 831 | 831 | $sweetsThief = Closure::bind($sweetsThief, null, $pdf); |
| 832 | 832 | |
| 833 | - $bMargin = $sweetsThief($pdf); |
|
| 833 | + $bMargin = $sweetsThief($pdf); |
|
| 834 | 834 | |
| 835 | - $pdf->SetAutoPageBreak( false ); |
|
| 835 | + $pdf->SetAutoPageBreak(false); |
|
| 836 | 836 | |
| 837 | 837 | $set_pagebreak_margin = true; |
| 838 | 838 | } |
| 839 | 839 | |
| 840 | 840 | |
| 841 | - if($line->qty==99) |
|
| 842 | - $pdf->SetFillColor(220,220,220); |
|
| 843 | - elseif ($line->qty==98) |
|
| 844 | - $pdf->SetFillColor(230,230,230); |
|
| 841 | + if ($line->qty == 99) |
|
| 842 | + $pdf->SetFillColor(220, 220, 220); |
|
| 843 | + elseif ($line->qty == 98) |
|
| 844 | + $pdf->SetFillColor(230, 230, 230); |
|
| 845 | 845 | else |
| 846 | - $pdf->SetFillColor(240,240,240); |
|
| 846 | + $pdf->SetFillColor(240, 240, 240); |
|
| 847 | 847 | |
| 848 | 848 | $style = 'B'; |
| 849 | 849 | if (!empty($conf->global->SUBTOTAL_SUBTOTAL_STYLE)) $style = $conf->global->SUBTOTAL_SUBTOTAL_STYLE; |
| 850 | 850 | |
| 851 | 851 | $pdf->SetFont('', $style, 9); |
| 852 | 852 | |
| 853 | - $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'R',true); |
|
| 853 | + $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'R', true); |
|
| 854 | 854 | // var_dump($bMargin); |
| 855 | 855 | $pageAfter = $pdf->getPage(); |
| 856 | 856 | |
@@ -875,7 +875,7 @@ discard block |
||
| 875 | 875 | } |
| 876 | 876 | } |
| 877 | 877 | |
| 878 | - if($total_to_print) { |
|
| 878 | + if ($total_to_print) { |
|
| 879 | 879 | |
| 880 | 880 | if (GETPOST('hideInnerLines')) |
| 881 | 881 | { |
@@ -889,7 +889,7 @@ discard block |
||
| 889 | 889 | else |
| 890 | 890 | { |
| 891 | 891 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
| 892 | - if(get_class($object) == 'Facture' && $object->type==Facture::TYPE_SITUATION){//Facture de situation |
|
| 892 | + if (get_class($object) == 'Facture' && $object->type == Facture::TYPE_SITUATION) {//Facture de situation |
|
| 893 | 893 | $total_to_print = $this->getTotalToPrintSituation($object, $line); |
| 894 | 894 | } else { |
| 895 | 895 | $total_to_print = price($total); |
@@ -903,11 +903,11 @@ discard block |
||
| 903 | 903 | } |
| 904 | 904 | |
| 905 | 905 | $pdf->SetXY($pdf->postotalht, $posy); |
| 906 | - if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
| 907 | - $pdf->MultiCell($pdf->page_largeur-$pdf->marge_droite-$pdf->postotalht, 3, $total_to_print, 0, 'R', 0); |
|
| 906 | + if ($set_pagebreak_margin) $pdf->SetAutoPageBreak($pageBreakOriginalValue, $bMargin); |
|
| 907 | + $pdf->MultiCell($pdf->page_largeur - $pdf->marge_droite - $pdf->postotalht, 3, $total_to_print, 0, 'R', 0); |
|
| 908 | 908 | } |
| 909 | - else{ |
|
| 910 | - if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
| 909 | + else { |
|
| 910 | + if ($set_pagebreak_margin) $pdf->SetAutoPageBreak($pageBreakOriginalValue, $bMargin); |
|
| 911 | 911 | } |
| 912 | 912 | |
| 913 | 913 | $posy = $posy + $cell_height; |
@@ -927,22 +927,22 @@ discard block |
||
| 927 | 927 | * @param $w float width |
| 928 | 928 | * @param $h float height |
| 929 | 929 | */ |
| 930 | - function pdf_add_title(&$pdf,&$object, &$line, $label, $description,$posx, $posy, $w, $h) { |
|
| 930 | + function pdf_add_title(&$pdf, &$object, &$line, $label, $description, $posx, $posy, $w, $h) { |
|
| 931 | 931 | |
| 932 | - global $db,$conf,$subtotal_last_title_posy; |
|
| 932 | + global $db, $conf, $subtotal_last_title_posy; |
|
| 933 | 933 | |
| 934 | 934 | $subtotal_last_title_posy = $posy; |
| 935 | - $pdf->SetXY ($posx, $posy); |
|
| 935 | + $pdf->SetXY($posx, $posy); |
|
| 936 | 936 | |
| 937 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
| 937 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
| 938 | 938 | |
| 939 | 939 | |
| 940 | 940 | |
| 941 | - $style = ($line->qty==1) ? 'BU' : 'BUI'; |
|
| 941 | + $style = ($line->qty == 1) ? 'BU' : 'BUI'; |
|
| 942 | 942 | if (!empty($conf->global->SUBTOTAL_TITLE_STYLE)) $style = $conf->global->SUBTOTAL_TITLE_STYLE; |
| 943 | 943 | |
| 944 | - if($hideInnerLines) { |
|
| 945 | - if($line->qty==1)$pdf->SetFont('', $style, 9); |
|
| 944 | + if ($hideInnerLines) { |
|
| 945 | + if ($line->qty == 1)$pdf->SetFont('', $style, 9); |
|
| 946 | 946 | else |
| 947 | 947 | { |
| 948 | 948 | if (!empty($conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES)) $style = $conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES; |
@@ -951,43 +951,43 @@ discard block |
||
| 951 | 951 | } |
| 952 | 952 | else { |
| 953 | 953 | |
| 954 | - if($line->qty==1)$pdf->SetFont('', $style, 9); //TODO if super utile |
|
| 954 | + if ($line->qty == 1)$pdf->SetFont('', $style, 9); //TODO if super utile |
|
| 955 | 955 | else $pdf->SetFont('', $style, 9); |
| 956 | 956 | |
| 957 | 957 | } |
| 958 | 958 | |
| 959 | 959 | if ($label === strip_tags($label) && $label === dol_html_entity_decode($label, ENT_QUOTES)) $pdf->MultiCell($w, $h, $label, 0, 'L'); // Pas de HTML dans la chaine |
| 960 | - else $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J',true); // et maintenant avec du HTML |
|
| 960 | + else $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J', true); // et maintenant avec du HTML |
|
| 961 | 961 | |
| 962 | - if($description && !$hidedesc) { |
|
| 962 | + if ($description && !$hidedesc) { |
|
| 963 | 963 | $posy = $pdf->GetY(); |
| 964 | 964 | |
| 965 | 965 | $pdf->SetFont('', '', 8); |
| 966 | 966 | |
| 967 | - $pdf->writeHTMLCell($w, $h, $posx, $posy, $description, 0, 1, false, true, 'J',true); |
|
| 967 | + $pdf->writeHTMLCell($w, $h, $posx, $posy, $description, 0, 1, false, true, 'J', true); |
|
| 968 | 968 | |
| 969 | 969 | } |
| 970 | 970 | |
| 971 | 971 | } |
| 972 | 972 | |
| 973 | - function pdf_writelinedesc_ref($parameters=array(), &$object, &$action='') { |
|
| 973 | + function pdf_writelinedesc_ref($parameters = array(), &$object, &$action = '') { |
|
| 974 | 974 | // ultimate PDF hook O_o |
| 975 | 975 | |
| 976 | - return $this->pdf_writelinedesc($parameters,$object,$action); |
|
| 976 | + return $this->pdf_writelinedesc($parameters, $object, $action); |
|
| 977 | 977 | |
| 978 | 978 | } |
| 979 | 979 | |
| 980 | 980 | function isModSubtotalLine(&$parameters, &$object) { |
| 981 | 981 | |
| 982 | - if(is_array($parameters)) { |
|
| 982 | + if (is_array($parameters)) { |
|
| 983 | 983 | $i = & $parameters['i']; |
| 984 | 984 | } |
| 985 | 985 | else { |
| 986 | - $i = (int)$parameters; |
|
| 986 | + $i = (int) $parameters; |
|
| 987 | 987 | } |
| 988 | 988 | |
| 989 | 989 | |
| 990 | - if($object->lines[$i]->special_code == $this->module_number && $object->lines[$i]->product_type == 9) { |
|
| 990 | + if ($object->lines[$i]->special_code == $this->module_number && $object->lines[$i]->product_type == 9) { |
|
| 991 | 991 | return true; |
| 992 | 992 | } |
| 993 | 993 | |
@@ -995,43 +995,43 @@ discard block |
||
| 995 | 995 | |
| 996 | 996 | } |
| 997 | 997 | |
| 998 | - function pdf_getlineqty($parameters=array(), &$object, &$action='') { |
|
| 999 | - global $conf,$hideprices; |
|
| 998 | + function pdf_getlineqty($parameters = array(), &$object, &$action = '') { |
|
| 999 | + global $conf, $hideprices; |
|
| 1000 | 1000 | |
| 1001 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
| 1001 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
| 1002 | 1002 | |
| 1003 | 1003 | $this->resprints = ' '; |
| 1004 | 1004 | |
| 1005 | - if((float)DOL_VERSION<=3.6) { |
|
| 1005 | + if ((float) DOL_VERSION <= 3.6) { |
|
| 1006 | 1006 | return ''; |
| 1007 | 1007 | } |
| 1008 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1008 | + else if ((float) DOL_VERSION >= 3.8) { |
|
| 1009 | 1009 | return 1; |
| 1010 | 1010 | } |
| 1011 | 1011 | |
| 1012 | 1012 | } |
| 1013 | - elseif(!empty($hideprices)) { |
|
| 1013 | + elseif (!empty($hideprices)) { |
|
| 1014 | 1014 | $this->resprints = $object->lines[$parameters['i']]->qty; |
| 1015 | 1015 | return 1; |
| 1016 | 1016 | } |
| 1017 | 1017 | elseif (!empty($conf->global->SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY)) |
| 1018 | 1018 | { |
| 1019 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
| 1020 | - $hidedetails = (int)GETPOST('hidedetails'); |
|
| 1019 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
| 1020 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
| 1021 | 1021 | if (empty($hideInnerLines) && !empty($hidedetails)) |
| 1022 | 1022 | { |
| 1023 | 1023 | $this->resprints = $object->lines[$parameters['i']]->qty; |
| 1024 | 1024 | } |
| 1025 | 1025 | } |
| 1026 | 1026 | |
| 1027 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1028 | - else $i = (int)$parameters; |
|
| 1027 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
| 1028 | + else $i = (int) $parameters; |
|
| 1029 | 1029 | |
| 1030 | 1030 | if (empty($object->lines[$i])) return 0; // hideInnerLines => override $object->lines et Dolibarr ne nous permet pas de mettre à jour la variable qui conditionne la boucle sur les lignes (PR faite pour 6.0) |
| 1031 | 1031 | |
| 1032 | - if(empty($object->lines[$i]->array_options)) $object->lines[$i]->fetch_optionals(); |
|
| 1032 | + if (empty($object->lines[$i]->array_options)) $object->lines[$i]->fetch_optionals(); |
|
| 1033 | 1033 | |
| 1034 | - if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
| 1034 | + if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
| 1035 | 1035 | { |
| 1036 | 1036 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
| 1037 | 1037 | { |
@@ -1043,25 +1043,25 @@ discard block |
||
| 1043 | 1043 | return 0; |
| 1044 | 1044 | } |
| 1045 | 1045 | |
| 1046 | - function pdf_getlinetotalexcltax($parameters=array(), &$object, &$action='') { |
|
| 1046 | + function pdf_getlinetotalexcltax($parameters = array(), &$object, &$action = '') { |
|
| 1047 | 1047 | global $conf, $hideprices; |
| 1048 | 1048 | |
| 1049 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
| 1049 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
| 1050 | 1050 | |
| 1051 | 1051 | $this->resprints = ' '; |
| 1052 | 1052 | |
| 1053 | - if((float)DOL_VERSION<=3.6) { |
|
| 1053 | + if ((float) DOL_VERSION <= 3.6) { |
|
| 1054 | 1054 | return ''; |
| 1055 | 1055 | } |
| 1056 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1056 | + else if ((float) DOL_VERSION >= 3.8) { |
|
| 1057 | 1057 | return 1; |
| 1058 | 1058 | } |
| 1059 | 1059 | |
| 1060 | 1060 | } |
| 1061 | 1061 | elseif (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS)) |
| 1062 | 1062 | { |
| 1063 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1064 | - else $i = (int)$parameters; |
|
| 1063 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
| 1064 | + else $i = (int) $parameters; |
|
| 1065 | 1065 | |
| 1066 | 1066 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
| 1067 | 1067 | { |
@@ -1082,13 +1082,13 @@ discard block |
||
| 1082 | 1082 | } |
| 1083 | 1083 | } |
| 1084 | 1084 | } |
| 1085 | - if ((int)GETPOST('hideInnerLines') && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)){ |
|
| 1086 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1087 | - else $i = (int)$parameters; |
|
| 1085 | + if ((int) GETPOST('hideInnerLines') && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) { |
|
| 1086 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
| 1087 | + else $i = (int) $parameters; |
|
| 1088 | 1088 | $this->resprints = price($object->lines[$i]->total_ht); |
| 1089 | 1089 | } |
| 1090 | 1090 | if (!empty($hideprices) |
| 1091 | - || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
| 1091 | + || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
| 1092 | 1092 | ) |
| 1093 | 1093 | { |
| 1094 | 1094 | if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
@@ -1101,25 +1101,25 @@ discard block |
||
| 1101 | 1101 | return 0; |
| 1102 | 1102 | } |
| 1103 | 1103 | |
| 1104 | - function pdf_getlinetotalwithtax($parameters=array(), &$object, &$action='') { |
|
| 1104 | + function pdf_getlinetotalwithtax($parameters = array(), &$object, &$action = '') { |
|
| 1105 | 1105 | global $conf; |
| 1106 | 1106 | |
| 1107 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
| 1107 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
| 1108 | 1108 | |
| 1109 | 1109 | $this->resprints = ' '; |
| 1110 | 1110 | |
| 1111 | - if((float)DOL_VERSION<=3.6) { |
|
| 1111 | + if ((float) DOL_VERSION <= 3.6) { |
|
| 1112 | 1112 | return ''; |
| 1113 | 1113 | } |
| 1114 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1114 | + else if ((float) DOL_VERSION >= 3.8) { |
|
| 1115 | 1115 | return 1; |
| 1116 | 1116 | } |
| 1117 | 1117 | } |
| 1118 | 1118 | |
| 1119 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1120 | - else $i = (int)$parameters; |
|
| 1119 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
| 1120 | + else $i = (int) $parameters; |
|
| 1121 | 1121 | |
| 1122 | - if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
| 1122 | + if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
| 1123 | 1123 | { |
| 1124 | 1124 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
| 1125 | 1125 | { |
@@ -1131,24 +1131,24 @@ discard block |
||
| 1131 | 1131 | return 0; |
| 1132 | 1132 | } |
| 1133 | 1133 | |
| 1134 | - function pdf_getlineunit($parameters=array(), &$object, &$action='') { |
|
| 1134 | + function pdf_getlineunit($parameters = array(), &$object, &$action = '') { |
|
| 1135 | 1135 | global $conf; |
| 1136 | 1136 | |
| 1137 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
| 1137 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
| 1138 | 1138 | $this->resprints = ' '; |
| 1139 | 1139 | |
| 1140 | - if((float)DOL_VERSION<=3.6) { |
|
| 1140 | + if ((float) DOL_VERSION <= 3.6) { |
|
| 1141 | 1141 | return ''; |
| 1142 | 1142 | } |
| 1143 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1143 | + else if ((float) DOL_VERSION >= 3.8) { |
|
| 1144 | 1144 | return 1; |
| 1145 | 1145 | } |
| 1146 | 1146 | } |
| 1147 | 1147 | |
| 1148 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1149 | - else $i = (int)$parameters; |
|
| 1148 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
| 1149 | + else $i = (int) $parameters; |
|
| 1150 | 1150 | |
| 1151 | - if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
| 1151 | + if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
| 1152 | 1152 | { |
| 1153 | 1153 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
| 1154 | 1154 | { |
@@ -1160,24 +1160,24 @@ discard block |
||
| 1160 | 1160 | return 0; |
| 1161 | 1161 | } |
| 1162 | 1162 | |
| 1163 | - function pdf_getlineupexcltax($parameters=array(), &$object, &$action='') { |
|
| 1164 | - global $conf,$hideprices; |
|
| 1163 | + function pdf_getlineupexcltax($parameters = array(), &$object, &$action = '') { |
|
| 1164 | + global $conf, $hideprices; |
|
| 1165 | 1165 | |
| 1166 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
| 1166 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
| 1167 | 1167 | $this->resprints = ' '; |
| 1168 | 1168 | |
| 1169 | - if((float)DOL_VERSION<=3.6) { |
|
| 1169 | + if ((float) DOL_VERSION <= 3.6) { |
|
| 1170 | 1170 | return ''; |
| 1171 | 1171 | } |
| 1172 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1172 | + else if ((float) DOL_VERSION >= 3.8) { |
|
| 1173 | 1173 | return 1; |
| 1174 | 1174 | } |
| 1175 | 1175 | } |
| 1176 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1177 | - else $i = (int)$parameters; |
|
| 1176 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
| 1177 | + else $i = (int) $parameters; |
|
| 1178 | 1178 | |
| 1179 | 1179 | if (!empty($hideprices) |
| 1180 | - || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
| 1180 | + || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
| 1181 | 1181 | ) |
| 1182 | 1182 | { |
| 1183 | 1183 | if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
@@ -1190,24 +1190,24 @@ discard block |
||
| 1190 | 1190 | return 0; |
| 1191 | 1191 | } |
| 1192 | 1192 | |
| 1193 | - function pdf_getlineupwithtax($parameters=array(), &$object, &$action='') { |
|
| 1194 | - global $conf,$hideprices; |
|
| 1193 | + function pdf_getlineupwithtax($parameters = array(), &$object, &$action = '') { |
|
| 1194 | + global $conf, $hideprices; |
|
| 1195 | 1195 | |
| 1196 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
| 1196 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
| 1197 | 1197 | $this->resprints = ' '; |
| 1198 | - if((float)DOL_VERSION<=3.6) { |
|
| 1198 | + if ((float) DOL_VERSION <= 3.6) { |
|
| 1199 | 1199 | return ''; |
| 1200 | 1200 | } |
| 1201 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1201 | + else if ((float) DOL_VERSION >= 3.8) { |
|
| 1202 | 1202 | return 1; |
| 1203 | 1203 | } |
| 1204 | 1204 | } |
| 1205 | 1205 | |
| 1206 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1207 | - else $i = (int)$parameters; |
|
| 1206 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
| 1207 | + else $i = (int) $parameters; |
|
| 1208 | 1208 | |
| 1209 | 1209 | if (!empty($hideprices) |
| 1210 | - || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
| 1210 | + || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
| 1211 | 1211 | ) |
| 1212 | 1212 | { |
| 1213 | 1213 | if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
@@ -1220,27 +1220,27 @@ discard block |
||
| 1220 | 1220 | return 0; |
| 1221 | 1221 | } |
| 1222 | 1222 | |
| 1223 | - function pdf_getlinevatrate($parameters=array(), &$object, &$action='') { |
|
| 1223 | + function pdf_getlinevatrate($parameters = array(), &$object, &$action = '') { |
|
| 1224 | 1224 | global $conf; |
| 1225 | 1225 | |
| 1226 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
| 1226 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
| 1227 | 1227 | $this->resprints = ' '; |
| 1228 | 1228 | |
| 1229 | - if((float)DOL_VERSION<=3.6) { |
|
| 1229 | + if ((float) DOL_VERSION <= 3.6) { |
|
| 1230 | 1230 | return ''; |
| 1231 | 1231 | } |
| 1232 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1232 | + else if ((float) DOL_VERSION >= 3.8) { |
|
| 1233 | 1233 | return 1; |
| 1234 | 1234 | } |
| 1235 | 1235 | } |
| 1236 | 1236 | |
| 1237 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1238 | - else $i = (int)$parameters; |
|
| 1237 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
| 1238 | + else $i = (int) $parameters; |
|
| 1239 | 1239 | |
| 1240 | 1240 | if (empty($object->lines[$i])) return 0; // hideInnerLines => override $object->lines et Dolibarr ne nous permet pas de mettre à jour la variable qui conditionne la boucle sur les lignes (PR faite pour 6.0) |
| 1241 | 1241 | |
| 1242 | 1242 | $object->lines[$i]->fetch_optionals(); |
| 1243 | - if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
| 1243 | + if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
| 1244 | 1244 | { |
| 1245 | 1245 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
| 1246 | 1246 | { |
@@ -1252,23 +1252,23 @@ discard block |
||
| 1252 | 1252 | return 0; |
| 1253 | 1253 | } |
| 1254 | 1254 | |
| 1255 | - function pdf_getlineprogress($parameters=array(), &$object, &$action) { |
|
| 1255 | + function pdf_getlineprogress($parameters = array(), &$object, &$action) { |
|
| 1256 | 1256 | global $conf; |
| 1257 | 1257 | |
| 1258 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
| 1258 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
| 1259 | 1259 | $this->resprints = ' '; |
| 1260 | - if((float)DOL_VERSION<=3.6) { |
|
| 1260 | + if ((float) DOL_VERSION <= 3.6) { |
|
| 1261 | 1261 | return ''; |
| 1262 | 1262 | } |
| 1263 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1263 | + else if ((float) DOL_VERSION >= 3.8) { |
|
| 1264 | 1264 | return 1; |
| 1265 | 1265 | } |
| 1266 | 1266 | } |
| 1267 | 1267 | |
| 1268 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1269 | - else $i = (int)$parameters; |
|
| 1268 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
| 1269 | + else $i = (int) $parameters; |
|
| 1270 | 1270 | |
| 1271 | - if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
| 1271 | + if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
| 1272 | 1272 | { |
| 1273 | 1273 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
| 1274 | 1274 | { |
@@ -1283,12 +1283,12 @@ discard block |
||
| 1283 | 1283 | function add_numerotation(&$object) { |
| 1284 | 1284 | global $conf; |
| 1285 | 1285 | |
| 1286 | - if(!empty($conf->global->SUBTOTAL_USE_NUMEROTATION)) { |
|
| 1286 | + if (!empty($conf->global->SUBTOTAL_USE_NUMEROTATION)) { |
|
| 1287 | 1287 | |
| 1288 | 1288 | $TLevelTitre = array(); |
| 1289 | 1289 | $prevlevel = 0; |
| 1290 | 1290 | |
| 1291 | - foreach($object->lines as $k=>&$line) |
|
| 1291 | + foreach ($object->lines as $k=>&$line) |
|
| 1292 | 1292 | { |
| 1293 | 1293 | if ($line->id > 0 && $this->isModSubtotalLine($k, $object) && $line->qty <= 10) |
| 1294 | 1294 | { |
@@ -1302,12 +1302,12 @@ discard block |
||
| 1302 | 1302 | } |
| 1303 | 1303 | |
| 1304 | 1304 | // TODO ne gère pas encore la numération des lignes "Totaux" |
| 1305 | - private function formatNumerotation(&$TLineTitle, $line_reference='', $level=1, $prefix_num=0) |
|
| 1305 | + private function formatNumerotation(&$TLineTitle, $line_reference = '', $level = 1, $prefix_num = 0) |
|
| 1306 | 1306 | { |
| 1307 | 1307 | $TTitle = array(); |
| 1308 | 1308 | |
| 1309 | - $i=1; |
|
| 1310 | - $j=0; |
|
| 1309 | + $i = 1; |
|
| 1310 | + $j = 0; |
|
| 1311 | 1311 | foreach ($TLineTitle as $k => &$line) |
| 1312 | 1312 | { |
| 1313 | 1313 | if (!empty($line_reference) && $line->rang <= $line_reference->rang) continue; |
@@ -1317,7 +1317,7 @@ discard block |
||
| 1317 | 1317 | { |
| 1318 | 1318 | $TTitle[$j]['numerotation'] = ($prefix_num == 0) ? $i : $prefix_num.'.'.$i; |
| 1319 | 1319 | //var_dump('Prefix == '.$prefix_num.' // '.$line->desc.' ==> numerotation == '.$TTitle[$j]['numerotation'].' ### '.$line->qty .'=='. $level); |
| 1320 | - if (empty($line->label) && (float)DOL_VERSION < 6) |
|
| 1320 | + if (empty($line->label) && (float) DOL_VERSION < 6) |
|
| 1321 | 1321 | { |
| 1322 | 1322 | $line->label = !empty($line->desc) ? $line->desc : $line->description; |
| 1323 | 1323 | $line->desc = $line->description = ''; |
@@ -1343,26 +1343,26 @@ discard block |
||
| 1343 | 1343 | |
| 1344 | 1344 | function setDocTVA(&$pdf, &$object) { |
| 1345 | 1345 | |
| 1346 | - $hidedetails = (int)GETPOST('hidedetails'); |
|
| 1346 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
| 1347 | 1347 | |
| 1348 | - if(empty($hidedetails)) return false; |
|
| 1348 | + if (empty($hidedetails)) return false; |
|
| 1349 | 1349 | |
| 1350 | 1350 | // TODO can't add VAT to document without lines... :-/ |
| 1351 | 1351 | |
| 1352 | 1352 | return true; |
| 1353 | 1353 | } |
| 1354 | 1354 | |
| 1355 | - function beforePDFCreation($parameters=array(), &$object, &$action) |
|
| 1355 | + function beforePDFCreation($parameters = array(), &$object, &$action) |
|
| 1356 | 1356 | { |
| 1357 | 1357 | /** |
| 1358 | 1358 | * @var $pdf TCPDF |
| 1359 | 1359 | */ |
| 1360 | - global $pdf,$conf, $langs; |
|
| 1360 | + global $pdf, $conf, $langs; |
|
| 1361 | 1361 | |
| 1362 | 1362 | // var_dump($object->lines); |
| 1363 | 1363 | dol_include_once('/subtotal/class/subtotal.class.php'); |
| 1364 | 1364 | |
| 1365 | - foreach($parameters as $key=>$value) { |
|
| 1365 | + foreach ($parameters as $key=>$value) { |
|
| 1366 | 1366 | ${$key} = $value; |
| 1367 | 1367 | } |
| 1368 | 1368 | |
@@ -1371,25 +1371,25 @@ discard block |
||
| 1371 | 1371 | $this->add_numerotation($object); |
| 1372 | 1372 | |
| 1373 | 1373 | |
| 1374 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
| 1375 | - $hidedetails = (int)GETPOST('hidedetails'); |
|
| 1374 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
| 1375 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
| 1376 | 1376 | |
| 1377 | 1377 | if ($hideInnerLines) { // si c une ligne de titre |
| 1378 | - $fk_parent_line=0; |
|
| 1379 | - $TLines =array(); |
|
| 1378 | + $fk_parent_line = 0; |
|
| 1379 | + $TLines = array(); |
|
| 1380 | 1380 | |
| 1381 | - $original_count=count($object->lines); |
|
| 1381 | + $original_count = count($object->lines); |
|
| 1382 | 1382 | $TTvas = array(); // tableau de tva |
| 1383 | 1383 | |
| 1384 | - foreach($object->lines as $k=>&$line) |
|
| 1384 | + foreach ($object->lines as $k=>&$line) |
|
| 1385 | 1385 | { |
| 1386 | 1386 | |
| 1387 | - if($line->product_type==9 && $line->rowid>0) |
|
| 1387 | + if ($line->product_type == 9 && $line->rowid > 0) |
|
| 1388 | 1388 | { |
| 1389 | 1389 | $fk_parent_line = $line->rowid; |
| 1390 | 1390 | |
| 1391 | 1391 | // Fix tk7201 - si on cache le détail, la TVA est renseigné au niveau du sous-total, l'erreur c'est s'il y a plusieurs sous-totaux pour les même lignes, ça va faire la somme |
| 1392 | - if(TSubtotal::isSubtotal($line)) |
|
| 1392 | + if (TSubtotal::isSubtotal($line)) |
|
| 1393 | 1393 | { |
| 1394 | 1394 | /*$total = $this->getTotalLineFromObject($object, $line, ''); |
| 1395 | 1395 | |
@@ -1409,22 +1409,22 @@ discard block |
||
| 1409 | 1409 | |
| 1410 | 1410 | if ($hideInnerLines) |
| 1411 | 1411 | { |
| 1412 | - if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
| 1412 | + if (!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
| 1413 | 1413 | { |
| 1414 | - if($line->tva_tx != '0.000' && $line->product_type!=9){ |
|
| 1414 | + if ($line->tva_tx != '0.000' && $line->product_type != 9) { |
|
| 1415 | 1415 | |
| 1416 | 1416 | // on remplit le tableau de tva pour substituer les lignes cachées |
| 1417 | 1417 | $TTvas[$line->tva_tx]['total_tva'] += $line->total_tva; |
| 1418 | 1418 | $TTvas[$line->tva_tx]['total_ht'] += $line->total_ht; |
| 1419 | 1419 | $TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; |
| 1420 | 1420 | } |
| 1421 | - if($line->product_type==9 && $line->rowid>0) |
|
| 1421 | + if ($line->product_type == 9 && $line->rowid > 0) |
|
| 1422 | 1422 | { |
| 1423 | 1423 | //Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres |
| 1424 | 1424 | // génère des lignes d'affichage des montants HT soumis à tva |
| 1425 | 1425 | $nbtva = count($TTvas); |
| 1426 | - if(!empty($nbtva)){ |
|
| 1427 | - foreach ($TTvas as $tx =>$val){ |
|
| 1426 | + if (!empty($nbtva)) { |
|
| 1427 | + foreach ($TTvas as $tx =>$val) { |
|
| 1428 | 1428 | $l = clone $line; |
| 1429 | 1429 | $l->product_type = 1; |
| 1430 | 1430 | $l->special_code = ''; |
@@ -1445,7 +1445,7 @@ discard block |
||
| 1445 | 1445 | } |
| 1446 | 1446 | } else { |
| 1447 | 1447 | |
| 1448 | - if($line->product_type==9 && $line->rowid>0) |
|
| 1448 | + if ($line->product_type == 9 && $line->rowid > 0) |
|
| 1449 | 1449 | { |
| 1450 | 1450 | // ajoute la ligne de sous-total |
| 1451 | 1451 | $TLines[] = $line; |
@@ -1473,9 +1473,9 @@ discard block |
||
| 1473 | 1473 | |
| 1474 | 1474 | // cas incongru où il y aurait des produits en dessous du dernier sous-total |
| 1475 | 1475 | $nbtva = count($TTvas); |
| 1476 | - if(!empty($nbtva) && $hideInnerLines && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
| 1476 | + if (!empty($nbtva) && $hideInnerLines && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
| 1477 | 1477 | { |
| 1478 | - foreach ($TTvas as $tx =>$val){ |
|
| 1478 | + foreach ($TTvas as $tx =>$val) { |
|
| 1479 | 1479 | $l = clone $line; |
| 1480 | 1480 | $l->product_type = 1; |
| 1481 | 1481 | $l->special_code = ''; |
@@ -1492,11 +1492,11 @@ discard block |
||
| 1492 | 1492 | } |
| 1493 | 1493 | |
| 1494 | 1494 | global $nblignes; |
| 1495 | - $nblignes=count($TLines); |
|
| 1495 | + $nblignes = count($TLines); |
|
| 1496 | 1496 | |
| 1497 | 1497 | $object->lines = $TLines; |
| 1498 | 1498 | |
| 1499 | - if($i>count($object->lines)) { |
|
| 1499 | + if ($i > count($object->lines)) { |
|
| 1500 | 1500 | $this->resprints = ''; |
| 1501 | 1501 | return 0; |
| 1502 | 1502 | } |
@@ -1505,59 +1505,59 @@ discard block |
||
| 1505 | 1505 | return 0; |
| 1506 | 1506 | } |
| 1507 | 1507 | |
| 1508 | - function pdf_writelinedesc($parameters=array(), &$object, &$action) |
|
| 1508 | + function pdf_writelinedesc($parameters = array(), &$object, &$action) |
|
| 1509 | 1509 | { |
| 1510 | 1510 | /** |
| 1511 | 1511 | * @var $pdf TCPDF |
| 1512 | 1512 | */ |
| 1513 | - global $pdf,$conf; |
|
| 1513 | + global $pdf, $conf; |
|
| 1514 | 1514 | |
| 1515 | - foreach($parameters as $key=>$value) { |
|
| 1515 | + foreach ($parameters as $key=>$value) { |
|
| 1516 | 1516 | ${$key} = $value; |
| 1517 | 1517 | } |
| 1518 | 1518 | |
| 1519 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
| 1520 | - $hidedetails = (int)GETPOST('hidedetails'); |
|
| 1519 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
| 1520 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
| 1521 | 1521 | |
| 1522 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
| 1522 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
| 1523 | 1523 | |
| 1524 | 1524 | global $hideprices; |
| 1525 | 1525 | |
| 1526 | - if(!empty($hideprices)) { |
|
| 1527 | - foreach($object->lines as &$line) { |
|
| 1528 | - if($line->fk_product_type!=9) $line->fk_parent_line = -1; |
|
| 1526 | + if (!empty($hideprices)) { |
|
| 1527 | + foreach ($object->lines as &$line) { |
|
| 1528 | + if ($line->fk_product_type != 9) $line->fk_parent_line = -1; |
|
| 1529 | 1529 | } |
| 1530 | 1530 | } |
| 1531 | 1531 | |
| 1532 | 1532 | $line = &$object->lines[$i]; |
| 1533 | 1533 | |
| 1534 | - if($line->info_bits>0) { // PAGE BREAK |
|
| 1534 | + if ($line->info_bits > 0) { // PAGE BREAK |
|
| 1535 | 1535 | $pdf->addPage(); |
| 1536 | 1536 | $posy = $pdf->GetY(); |
| 1537 | 1537 | } |
| 1538 | 1538 | |
| 1539 | 1539 | $label = $line->label; |
| 1540 | - $description= !empty($line->desc) ? $outputlangs->convToOutputCharset($line->desc) : $outputlangs->convToOutputCharset($line->description); |
|
| 1540 | + $description = !empty($line->desc) ? $outputlangs->convToOutputCharset($line->desc) : $outputlangs->convToOutputCharset($line->description); |
|
| 1541 | 1541 | |
| 1542 | - if(empty($label)) { |
|
| 1542 | + if (empty($label)) { |
|
| 1543 | 1543 | $label = $description; |
| 1544 | - $description=''; |
|
| 1544 | + $description = ''; |
|
| 1545 | 1545 | } |
| 1546 | 1546 | |
| 1547 | - if($line->qty>90) { |
|
| 1547 | + if ($line->qty > 90) { |
|
| 1548 | 1548 | |
| 1549 | 1549 | if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) $label .= ' '.$this->getTitle($object, $line); |
| 1550 | 1550 | |
| 1551 | 1551 | $pageBefore = $pdf->getPage(); |
| 1552 | - $this->pdf_add_total($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
|
| 1552 | + $this->pdf_add_total($pdf, $object, $line, $label, $description, $posx, $posy, $w, $h); |
|
| 1553 | 1553 | $pageAfter = $pdf->getPage(); |
| 1554 | 1554 | |
| 1555 | - if($pageAfter>$pageBefore) { |
|
| 1555 | + if ($pageAfter > $pageBefore) { |
|
| 1556 | 1556 | //print "ST $pageAfter>$pageBefore<br>"; |
| 1557 | 1557 | $pdf->rollbackTransaction(true); |
| 1558 | - $pdf->addPage('','', true); |
|
| 1558 | + $pdf->addPage('', '', true); |
|
| 1559 | 1559 | $posy = $pdf->GetY(); |
| 1560 | - $this->pdf_add_total($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
|
| 1560 | + $this->pdf_add_total($pdf, $object, $line, $label, $description, $posx, $posy, $w, $h); |
|
| 1561 | 1561 | $posy = $pdf->GetY(); |
| 1562 | 1562 | //print 'add ST'.$pdf->getPage().'<br />'; |
| 1563 | 1563 | } |
@@ -1568,7 +1568,7 @@ discard block |
||
| 1568 | 1568 | else if ($line->qty < 10) { |
| 1569 | 1569 | $pageBefore = $pdf->getPage(); |
| 1570 | 1570 | |
| 1571 | - $this->pdf_add_title($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
|
| 1571 | + $this->pdf_add_title($pdf, $object, $line, $label, $description, $posx, $posy, $w, $h); |
|
| 1572 | 1572 | $pageAfter = $pdf->getPage(); |
| 1573 | 1573 | |
| 1574 | 1574 | |
@@ -1643,9 +1643,9 @@ discard block |
||
| 1643 | 1643 | * @param $hookmanager HookManager |
| 1644 | 1644 | * @return int |
| 1645 | 1645 | */ |
| 1646 | - function printObjectLine ($parameters, &$object, &$action, $hookmanager){ |
|
| 1646 | + function printObjectLine($parameters, &$object, &$action, $hookmanager) { |
|
| 1647 | 1647 | |
| 1648 | - global $conf,$langs,$user,$db,$bc; |
|
| 1648 | + global $conf, $langs, $user, $db, $bc; |
|
| 1649 | 1649 | |
| 1650 | 1650 | $num = &$parameters['num']; |
| 1651 | 1651 | $line = &$parameters['line']; |
@@ -1653,32 +1653,32 @@ discard block |
||
| 1653 | 1653 | |
| 1654 | 1654 | $var = &$parameters['var']; |
| 1655 | 1655 | |
| 1656 | - $contexts = explode(':',$parameters['context']); |
|
| 1656 | + $contexts = explode(':', $parameters['context']); |
|
| 1657 | 1657 | |
| 1658 | 1658 | $createRight = $user->rights->{$object->element}->creer; |
| 1659 | - if($object->element == 'facturerec' ) |
|
| 1659 | + if ($object->element == 'facturerec') |
|
| 1660 | 1660 | { |
| 1661 | 1661 | $object->statut = 0; // hack for facture rec |
| 1662 | 1662 | $createRight = $user->rights->facture->creer; |
| 1663 | 1663 | } |
| 1664 | - elseif($object->element == 'order_supplier' ) |
|
| 1664 | + elseif ($object->element == 'order_supplier') |
|
| 1665 | 1665 | { |
| 1666 | 1666 | $createRight = $user->rights->fournisseur->commande->creer; |
| 1667 | 1667 | } |
| 1668 | - elseif($object->element == 'invoice_supplier' ) |
|
| 1668 | + elseif ($object->element == 'invoice_supplier') |
|
| 1669 | 1669 | { |
| 1670 | 1670 | $createRight = $user->rights->fournisseur->facture->creer; |
| 1671 | 1671 | } |
| 1672 | 1672 | |
| 1673 | - if($line->special_code!=$this->module_number || $line->product_type!=9) { |
|
| 1673 | + if ($line->special_code != $this->module_number || $line->product_type != 9) { |
|
| 1674 | 1674 | null; |
| 1675 | 1675 | } |
| 1676 | - 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)) |
|
| 1676 | + 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)) |
|
| 1677 | 1677 | { |
| 1678 | - if($object->element=='facture')$idvar = 'facid'; |
|
| 1679 | - else $idvar='id'; |
|
| 1678 | + if ($object->element == 'facture')$idvar = 'facid'; |
|
| 1679 | + else $idvar = 'id'; |
|
| 1680 | 1680 | |
| 1681 | - if((float)DOL_VERSION <= 3.4) |
|
| 1681 | + if ((float) DOL_VERSION <= 3.4) |
|
| 1682 | 1682 | { |
| 1683 | 1683 | ?> |
| 1684 | 1684 | <script type="text/javascript"> |
@@ -1702,20 +1702,20 @@ discard block |
||
| 1702 | 1702 | <?php |
| 1703 | 1703 | } |
| 1704 | 1704 | |
| 1705 | - if(empty($line->description)) $line->description = $line->desc; |
|
| 1705 | + if (empty($line->description)) $line->description = $line->desc; |
|
| 1706 | 1706 | |
| 1707 | 1707 | $colspan = 5; |
| 1708 | - if($object->element == 'facturerec' ) $colspan = 3; |
|
| 1709 | - if($object->element == 'order_supplier') $colspan = 3; |
|
| 1710 | - if($object->element == 'invoice_supplier') $colspan = 4; |
|
| 1711 | - if($object->element == 'supplier_proposal') $colspan = 4; |
|
| 1712 | - if(!empty($conf->multicurrency->enabled)) $colspan+=2; |
|
| 1713 | - if($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) $colspan++; |
|
| 1714 | - if(!empty($conf->margin->enabled)) $colspan++; |
|
| 1715 | - if(!empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; |
|
| 1716 | - if(!empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; |
|
| 1717 | - if($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) $colspan++; |
|
| 1718 | - if(!empty($conf->global->PRODUCT_USE_UNITS)) $colspan++; |
|
| 1708 | + if ($object->element == 'facturerec') $colspan = 3; |
|
| 1709 | + if ($object->element == 'order_supplier') $colspan = 3; |
|
| 1710 | + if ($object->element == 'invoice_supplier') $colspan = 4; |
|
| 1711 | + if ($object->element == 'supplier_proposal') $colspan = 4; |
|
| 1712 | + if (!empty($conf->multicurrency->enabled)) $colspan += 2; |
|
| 1713 | + if ($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) $colspan++; |
|
| 1714 | + if (!empty($conf->margin->enabled)) $colspan++; |
|
| 1715 | + if (!empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; |
|
| 1716 | + if (!empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; |
|
| 1717 | + if ($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) $colspan++; |
|
| 1718 | + if (!empty($conf->global->PRODUCT_USE_UNITS)) $colspan++; |
|
| 1719 | 1719 | |
| 1720 | 1720 | /* Titre */ |
| 1721 | 1721 | //var_dump($line); |
@@ -1725,35 +1725,35 @@ discard block |
||
| 1725 | 1725 | |
| 1726 | 1726 | |
| 1727 | 1727 | ?> |
| 1728 | - <tr <?php echo $bc[$var]; $var=!$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
|
| 1728 | + <tr <?php echo $bc[$var]; $var = !$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
|
| 1729 | 1729 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT)) |
| 1730 | 1730 | { |
| 1731 | - if($line->qty==99) print 'background:#adadcf'; |
|
| 1732 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
| 1733 | - else if($line->qty<=97 && $line->qty>=91) print 'background:#eeeeff;'; |
|
| 1734 | - else if($line->qty==1) print 'background:#adadcf;'; |
|
| 1735 | - else if($line->qty==2) print 'background:#ddddff;'; |
|
| 1736 | - else if($line->qty==50) print ''; |
|
| 1731 | + if ($line->qty == 99) print 'background:#adadcf'; |
|
| 1732 | + else if ($line->qty == 98) print 'background:#ddddff;'; |
|
| 1733 | + else if ($line->qty <= 97 && $line->qty >= 91) print 'background:#eeeeff;'; |
|
| 1734 | + else if ($line->qty == 1) print 'background:#adadcf;'; |
|
| 1735 | + else if ($line->qty == 2) print 'background:#ddddff;'; |
|
| 1736 | + else if ($line->qty == 50) print ''; |
|
| 1737 | 1737 | else print 'background:#eeeeff;'; |
| 1738 | 1738 | |
| 1739 | 1739 | //A compléter si on veux plus de nuances de couleurs avec les niveau 4,5,6,7,8 et 9 |
| 1740 | 1740 | } |
| 1741 | 1741 | else |
| 1742 | 1742 | { |
| 1743 | - if($line->qty==99) print 'background:#ddffdd'; |
|
| 1744 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
| 1745 | - else if($line->qty==2) print 'background:#eeeeff; '; |
|
| 1746 | - else if($line->qty==50) print ''; |
|
| 1747 | - else print 'background:#eeffee;' ; |
|
| 1743 | + if ($line->qty == 99) print 'background:#ddffdd'; |
|
| 1744 | + else if ($line->qty == 98) print 'background:#ddddff;'; |
|
| 1745 | + else if ($line->qty == 2) print 'background:#eeeeff; '; |
|
| 1746 | + else if ($line->qty == 50) print ''; |
|
| 1747 | + else print 'background:#eeffee;'; |
|
| 1748 | 1748 | } |
| 1749 | 1749 | |
| 1750 | 1750 | ?>;"> |
| 1751 | 1751 | |
| 1752 | - <td colspan="<?php echo $colspan; ?>" style="<?php TSubtotal::isFreeText($line) ? '' : 'font-weight:bold;'; ?> <?php echo ($line->qty>90)?'text-align:right':'' ?> "><?php |
|
| 1753 | - if($action=='editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line) ) { |
|
| 1752 | + <td colspan="<?php echo $colspan; ?>" style="<?php TSubtotal::isFreeText($line) ? '' : 'font-weight:bold;'; ?> <?php echo ($line->qty > 90) ? 'text-align:right' : '' ?> "><?php |
|
| 1753 | + if ($action == 'editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line)) { |
|
| 1754 | 1754 | |
| 1755 | - $params=array('line'=>$line); |
|
| 1756 | - $reshook=$hookmanager->executeHooks('formEditProductOptions',$params,$object,$action); |
|
| 1755 | + $params = array('line'=>$line); |
|
| 1756 | + $reshook = $hookmanager->executeHooks('formEditProductOptions', $params, $object, $action); |
|
| 1757 | 1757 | |
| 1758 | 1758 | echo '<div id="line_'.$line->id.'"></div>'; // Imitation Dolibarr |
| 1759 | 1759 | echo '<input type="hidden" value="'.$line->id.'" name="lineid">'; |
@@ -1761,7 +1761,7 @@ discard block |
||
| 1761 | 1761 | echo '<input id="product_id" type="hidden" value="'.$line->fk_product.'" name="type">'; |
| 1762 | 1762 | echo '<input id="special_code" type="hidden" value="'.$line->special_code.'" name="type">'; |
| 1763 | 1763 | |
| 1764 | - $isFreeText=false; |
|
| 1764 | + $isFreeText = false; |
|
| 1765 | 1765 | if (TSubtotal::isTitle($line)) |
| 1766 | 1766 | { |
| 1767 | 1767 | $qty_displayed = $line->qty; |
@@ -1783,13 +1783,13 @@ discard block |
||
| 1783 | 1783 | $line->description = ''; |
| 1784 | 1784 | } |
| 1785 | 1785 | $newlabel = $line->label; |
| 1786 | - if($line->label=='' && !$isFreeText) { |
|
| 1787 | - if(TSubtotal::isSubtotal($line)) { |
|
| 1786 | + if ($line->label == '' && !$isFreeText) { |
|
| 1787 | + if (TSubtotal::isSubtotal($line)) { |
|
| 1788 | 1788 | $newlabel = $line->description.' '.$this->getTitle($object, $line); |
| 1789 | - $line->description=''; |
|
| 1790 | - } elseif( (float)DOL_VERSION < 6 ) { |
|
| 1791 | - $newlabel= $line->description; |
|
| 1792 | - $line->description=''; |
|
| 1789 | + $line->description = ''; |
|
| 1790 | + } elseif ((float) DOL_VERSION < 6) { |
|
| 1791 | + $newlabel = $line->description; |
|
| 1792 | + $line->description = ''; |
|
| 1793 | 1793 | } |
| 1794 | 1794 | } |
| 1795 | 1795 | |
@@ -1798,10 +1798,10 @@ discard block |
||
| 1798 | 1798 | |
| 1799 | 1799 | if (!$isFreeText) echo '<input type="text" name="line-title" id-line="'.$line->id.'" value="'.$newlabel.'" size="80" '.$readonlyForSituation.'/> '; |
| 1800 | 1800 | |
| 1801 | - if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT) && (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) ) |
|
| 1801 | + if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT) && (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line))) |
|
| 1802 | 1802 | { |
| 1803 | 1803 | $select = '<select name="subtotal_level">'; |
| 1804 | - for ($j=1; $j<10; $j++) |
|
| 1804 | + for ($j = 1; $j < 10; $j++) |
|
| 1805 | 1805 | { |
| 1806 | 1806 | if (!empty($readonlyForSituation)) { |
| 1807 | 1807 | if ($qty_displayed == $j) $select .= '<option selected="selected" value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
@@ -1814,7 +1814,7 @@ discard block |
||
| 1814 | 1814 | |
| 1815 | 1815 | |
| 1816 | 1816 | echo '<div class="subtotal_underline" style="margin-left:24px;">'; |
| 1817 | - echo '<label for="subtotal-pagebreak">'.$langs->trans('AddBreakPageBefore').'</label> <input style="vertical-align:sub;" type="checkbox" name="line-pagebreak" id="subtotal-pagebreak" value="8" '.(($line->info_bits > 0) ? 'checked="checked"' : '') .' /> '; |
|
| 1817 | + echo '<label for="subtotal-pagebreak">'.$langs->trans('AddBreakPageBefore').'</label> <input style="vertical-align:sub;" type="checkbox" name="line-pagebreak" id="subtotal-pagebreak" value="8" '.(($line->info_bits > 0) ? 'checked="checked"' : '').' /> '; |
|
| 1818 | 1818 | |
| 1819 | 1819 | if (TSubtotal::isTitle($line)) |
| 1820 | 1820 | { |
@@ -1832,9 +1832,9 @@ discard block |
||
| 1832 | 1832 | else if ($isFreeText) echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation); |
| 1833 | 1833 | echo '</div>'; |
| 1834 | 1834 | |
| 1835 | - if($line->qty<10) { |
|
| 1835 | + if ($line->qty < 10) { |
|
| 1836 | 1836 | // WYSIWYG editor |
| 1837 | - require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; |
|
| 1837 | + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
|
| 1838 | 1838 | $nbrows = ROWS_2; |
| 1839 | 1839 | $cked_enabled = (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0); |
| 1840 | 1840 | if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) { |
@@ -1854,25 +1854,25 @@ discard block |
||
| 1854 | 1854 | |
| 1855 | 1855 | if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) |
| 1856 | 1856 | { |
| 1857 | - if(TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) |
|
| 1857 | + if (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) |
|
| 1858 | 1858 | { |
| 1859 | - echo str_repeat(' ', $line->qty-1); |
|
| 1859 | + echo str_repeat(' ', $line->qty - 1); |
|
| 1860 | 1860 | |
| 1861 | 1861 | if (TSubtotal::isTitle($line)) print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
| 1862 | - else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
| 1862 | + else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100 - $line->qty).'</span> '; |
|
| 1863 | 1863 | } |
| 1864 | 1864 | } |
| 1865 | 1865 | else |
| 1866 | 1866 | { |
| 1867 | - if($line->qty<=1) print img_picto('', 'subtotal@subtotal'); |
|
| 1868 | - else if($line->qty==2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
| 1867 | + if ($line->qty <= 1) print img_picto('', 'subtotal@subtotal'); |
|
| 1868 | + else if ($line->qty == 2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
| 1869 | 1869 | } |
| 1870 | 1870 | |
| 1871 | 1871 | |
| 1872 | 1872 | // Get display styles and apply them |
| 1873 | 1873 | $titleStyleItalic = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'I') === false ? '' : ' font-style: italic;'; |
| 1874 | - $titleStyleBold = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'B') === false ? '' : ' font-weight:bold;'; |
|
| 1875 | - $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
|
| 1874 | + $titleStyleBold = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'B') === false ? '' : ' font-weight:bold;'; |
|
| 1875 | + $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
|
| 1876 | 1876 | |
| 1877 | 1877 | if (empty($line->label)) { |
| 1878 | 1878 | if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) print $line->description.' '.$this->getTitle($object, $line); |
@@ -1880,16 +1880,16 @@ discard block |
||
| 1880 | 1880 | } |
| 1881 | 1881 | else { |
| 1882 | 1882 | |
| 1883 | - if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
|
| 1883 | + if (!empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
|
| 1884 | 1884 | print '<span class="subtotal_label" style="'.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" >'.$line->label.'</span><br><div class="subtotal_desc">'.dol_htmlentitiesbr($line->description).'</div>'; |
| 1885 | 1885 | } |
| 1886 | - else{ |
|
| 1886 | + else { |
|
| 1887 | 1887 | print '<span class="subtotal_label classfortooltip '.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" title="'.$line->description.'">'.$line->label.'</span>'; |
| 1888 | 1888 | } |
| 1889 | 1889 | |
| 1890 | 1890 | } |
| 1891 | - if($line->qty>90) print ' : '; |
|
| 1892 | - if($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
| 1891 | + if ($line->qty > 90) print ' : '; |
|
| 1892 | + if ($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
| 1893 | 1893 | |
| 1894 | 1894 | |
| 1895 | 1895 | |
@@ -1898,7 +1898,7 @@ discard block |
||
| 1898 | 1898 | ?></td> |
| 1899 | 1899 | |
| 1900 | 1900 | <?php |
| 1901 | - if($line->qty>90) { |
|
| 1901 | + if ($line->qty > 90) { |
|
| 1902 | 1902 | /* Total */ |
| 1903 | 1903 | $total_line = $this->getTotalLineFromObject($object, $line, ''); |
| 1904 | 1904 | echo '<td class="nowrap liencolht" align="right" style="font-weight:bold;" rel="subtotal_total">'.price($total_line).'</td>'; |
@@ -1911,7 +1911,7 @@ discard block |
||
| 1911 | 1911 | <?php |
| 1912 | 1912 | if ($action != 'selectlines') { |
| 1913 | 1913 | |
| 1914 | - if($action=='editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line) ) { |
|
| 1914 | + if ($action == 'editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line)) { |
|
| 1915 | 1915 | ?> |
| 1916 | 1916 | <input id="savelinebutton" class="button" type="submit" name="save" value="<?php echo $langs->trans('Save') ?>" /> |
| 1917 | 1917 | <br /> |
@@ -1927,13 +1927,13 @@ discard block |
||
| 1927 | 1927 | <?php |
| 1928 | 1928 | |
| 1929 | 1929 | } |
| 1930 | - else{ |
|
| 1931 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) && $object->element !== 'invoice_supplier') |
|
| 1930 | + else { |
|
| 1931 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) && $object->element !== 'invoice_supplier') |
|
| 1932 | 1932 | { |
| 1933 | - if(TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref) ) echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=duplicate&lineid='.$line->id.'">'. img_picto($langs->trans('Duplicate'), 'duplicate@subtotal').'</a>'; |
|
| 1933 | + if (TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref)) echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=duplicate&lineid='.$line->id.'">'.img_picto($langs->trans('Duplicate'), 'duplicate@subtotal').'</a>'; |
|
| 1934 | 1934 | } |
| 1935 | 1935 | |
| 1936 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_EDIT_BLOCK)) |
|
| 1936 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_EDIT_BLOCK)) |
|
| 1937 | 1937 | { |
| 1938 | 1938 | echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=editline&lineid='.$line->id.'">'.img_edit().'</a>'; |
| 1939 | 1939 | } |
@@ -1948,7 +1948,7 @@ discard block |
||
| 1948 | 1948 | <?php |
| 1949 | 1949 | |
| 1950 | 1950 | if ($action != 'editline' && $action != 'selectlines') { |
| 1951 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK)) |
|
| 1951 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK)) |
|
| 1952 | 1952 | { |
| 1953 | 1953 | |
| 1954 | 1954 | if ($object->situation_counter == 1 || !$object->situation_cycle_ref) |
@@ -1956,7 +1956,7 @@ discard block |
||
| 1956 | 1956 | echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=ask_deleteline&lineid='.$line->id.'">'.img_delete().'</a>'; |
| 1957 | 1957 | } |
| 1958 | 1958 | |
| 1959 | - if(TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref) ) |
|
| 1959 | + if (TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref)) |
|
| 1960 | 1960 | { |
| 1961 | 1961 | $img_delete = ((float) DOL_VERSION >= 3.8) ? img_picto($langs->trans('deleteWithAllLines'), 'delete_all.3.8@subtotal') : img_picto($langs->trans('deleteWithAllLines'), 'delete_all@subtotal'); |
| 1962 | 1962 | echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=ask_deleteallline&lineid='.$line->id.'">'.$img_delete.'</a>'; |
@@ -1967,7 +1967,7 @@ discard block |
||
| 1967 | 1967 | </td> |
| 1968 | 1968 | |
| 1969 | 1969 | <?php |
| 1970 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && TSubtotal::isTitle($line) && $action != 'editline') |
|
| 1970 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && TSubtotal::isTitle($line) && $action != 'editline') |
|
| 1971 | 1971 | { |
| 1972 | 1972 | echo '<td class="subtotal_nc">'; |
| 1973 | 1973 | echo '<input id="subtotal_nc-'.$line->id.'" class="subtotal_nc_chkbx" data-lineid="'.$line->id.'" type="checkbox" name="subtotal_nc" value="1" '.(!empty($line->array_options['options_subtotal_nc']) ? 'checked="checked"' : '').' />'; |
@@ -1978,11 +1978,11 @@ discard block |
||
| 1978 | 1978 | <td align="center" class="tdlineupdown"> |
| 1979 | 1979 | </td> |
| 1980 | 1980 | <?php } else { ?> |
| 1981 | - <td align="center"<?php echo ((empty($conf->browser->phone) && ($object->statut == 0 && $createRight ))?' class="tdlineupdown"':''); ?>></td> |
|
| 1981 | + <td align="center"<?php echo ((empty($conf->browser->phone) && ($object->statut == 0 && $createRight)) ? ' class="tdlineupdown"' : ''); ?>></td> |
|
| 1982 | 1982 | <?php } ?> |
| 1983 | 1983 | |
| 1984 | - <?php if($action == 'selectlines'){ // dolibarr 8 ?> |
|
| 1985 | - <td class="linecolcheck" align="center"><input type="checkbox" class="linecheckbox" name="line_checkbox[<?php echo $i+1; ?>]" value="<?php echo $line->id; ?>" ></td> |
|
| 1984 | + <?php if ($action == 'selectlines') { // dolibarr 8 ?> |
|
| 1985 | + <td class="linecolcheck" align="center"><input type="checkbox" class="linecheckbox" name="line_checkbox[<?php echo $i + 1; ?>]" value="<?php echo $line->id; ?>" ></td> |
|
| 1986 | 1986 | <?php } ?> |
| 1987 | 1987 | |
| 1988 | 1988 | </tr> |
@@ -1990,29 +1990,29 @@ discard block |
||
| 1990 | 1990 | |
| 1991 | 1991 | |
| 1992 | 1992 | // Affichage des extrafields à la Dolibarr (car sinon non affiché sur les titres) |
| 1993 | - if(TSubtotal::isTitle($line) && !empty($conf->global->SUBTOTAL_ALLOW_EXTRAFIELDS_ON_TITLE)) { |
|
| 1993 | + if (TSubtotal::isTitle($line) && !empty($conf->global->SUBTOTAL_ALLOW_EXTRAFIELDS_ON_TITLE)) { |
|
| 1994 | 1994 | |
| 1995 | - require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; |
|
| 1995 | + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; |
|
| 1996 | 1996 | |
| 1997 | 1997 | // Extrafields |
| 1998 | 1998 | $extrafieldsline = new ExtraFields($db); |
| 1999 | 1999 | $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); |
| 2000 | 2000 | |
| 2001 | - $colspan+=3; $mode = 'view'; |
|
| 2002 | - if($action === 'editline' && $line->rowid == GETPOST('lineid')) $mode = 'edit'; |
|
| 2001 | + $colspan += 3; $mode = 'view'; |
|
| 2002 | + if ($action === 'editline' && $line->rowid == GETPOST('lineid')) $mode = 'edit'; |
|
| 2003 | 2003 | |
| 2004 | 2004 | $ex_element = $line->element; |
| 2005 | 2005 | $line->element = 'tr_extrafield_title '.$line->element; // Pour pouvoir manipuler ces tr |
| 2006 | - print $line->showOptionals($extrafieldsline, $mode, array('style'=>' style="background:#eeffee;" ','colspan'=>$colspan)); |
|
| 2006 | + print $line->showOptionals($extrafieldsline, $mode, array('style'=>' style="background:#eeffee;" ', 'colspan'=>$colspan)); |
|
| 2007 | 2007 | $isExtraSelected = false; |
| 2008 | - foreach($line->array_options as $option) { |
|
| 2009 | - if(!empty($option) && $option != "-1") { |
|
| 2008 | + foreach ($line->array_options as $option) { |
|
| 2009 | + if (!empty($option) && $option != "-1") { |
|
| 2010 | 2010 | $isExtraSelected = true; |
| 2011 | 2011 | break; |
| 2012 | 2012 | } |
| 2013 | 2013 | } |
| 2014 | 2014 | |
| 2015 | - if($mode === 'edit') { |
|
| 2015 | + if ($mode === 'edit') { |
|
| 2016 | 2016 | ?> |
| 2017 | 2017 | <script> |
| 2018 | 2018 | $(document).ready(function(){ |
@@ -2020,7 +2020,7 @@ discard block |
||
| 2020 | 2020 | var all_tr_extrafields = $("tr.tr_extrafield_title"); |
| 2021 | 2021 | <?php |
| 2022 | 2022 | // Si un extrafield est rempli alors on affiche directement les extrafields |
| 2023 | - if(!$isExtraSelected) { |
|
| 2023 | + if (!$isExtraSelected) { |
|
| 2024 | 2024 | echo 'all_tr_extrafields.hide();'; |
| 2025 | 2025 | echo 'var trad = "'.$langs->trans('showExtrafields').'";'; |
| 2026 | 2026 | echo 'var extra = 0;'; |
@@ -2066,20 +2066,20 @@ discard block |
||
| 2066 | 2066 | |
| 2067 | 2067 | |
| 2068 | 2068 | function addMoreActionsButtons($parameters, &$object, &$action, $hookmanager) { |
| 2069 | - global $conf,$langs; |
|
| 2069 | + global $conf, $langs; |
|
| 2070 | 2070 | |
| 2071 | 2071 | if ($object->statut == 0 && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && $action != 'editline') |
| 2072 | 2072 | { |
| 2073 | 2073 | |
| 2074 | - if($object->element == 'invoice_supplier' || $object->element == 'order_supplier') |
|
| 2074 | + if ($object->element == 'invoice_supplier' || $object->element == 'order_supplier') |
|
| 2075 | 2075 | { |
| 2076 | 2076 | foreach ($object->lines as $line) |
| 2077 | 2077 | { |
| 2078 | 2078 | // fetch optionals attributes and labels |
| 2079 | 2079 | require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); |
| 2080 | - $extrafields=new ExtraFields($this->db); |
|
| 2081 | - $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true); |
|
| 2082 | - $line->fetch_optionals($line->id,$extralabels); |
|
| 2080 | + $extrafields = new ExtraFields($this->db); |
|
| 2081 | + $extralabels = $extrafields->fetch_name_optionals_label($object->table_element_line, true); |
|
| 2082 | + $line->fetch_optionals($line->id, $extralabels); |
|
| 2083 | 2083 | } |
| 2084 | 2084 | } |
| 2085 | 2085 | |
@@ -2179,23 +2179,23 @@ discard block |
||
| 2179 | 2179 | $ThtmlData['data-qty'] = 0; //$line->qty; |
| 2180 | 2180 | $ThtmlData['data-level'] = TSubtotal::getNiveau($line); |
| 2181 | 2181 | |
| 2182 | - if(TSubtotal::isTitle($line)){ |
|
| 2182 | + if (TSubtotal::isTitle($line)) { |
|
| 2183 | 2183 | $ThtmlData['data-issubtotal'] = 'title'; |
| 2184 | - }elseif(TSubtotal::isSubtotal($line)){ |
|
| 2184 | + }elseif (TSubtotal::isSubtotal($line)) { |
|
| 2185 | 2185 | $ThtmlData['data-issubtotal'] = 'subtotal'; |
| 2186 | 2186 | } |
| 2187 | - else{ |
|
| 2187 | + else { |
|
| 2188 | 2188 | $ThtmlData['data-issubtotal'] = 'freetext'; |
| 2189 | 2189 | } |
| 2190 | 2190 | |
| 2191 | 2191 | |
| 2192 | 2192 | // Change or add data from hooks |
| 2193 | - $parameters = array_replace($parameters , array( 'ThtmlData' => $ThtmlData ) ); |
|
| 2193 | + $parameters = array_replace($parameters, array('ThtmlData' => $ThtmlData)); |
|
| 2194 | 2194 | |
| 2195 | 2195 | // hook |
| 2196 | - $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
|
| 2196 | + $reshook = $hookmanager->executeHooks('subtotalLineHtmlData', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
|
| 2197 | 2197 | if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
| 2198 | - if ($reshook>0) |
|
| 2198 | + if ($reshook > 0) |
|
| 2199 | 2199 | { |
| 2200 | 2200 | $ThtmlData = $hookmanager->resArray; |
| 2201 | 2201 | } |
@@ -2208,14 +2208,14 @@ discard block |
||
| 2208 | 2208 | function implodeHtmlData($ThtmlData = array()) |
| 2209 | 2209 | { |
| 2210 | 2210 | $data = ''; |
| 2211 | - foreach($ThtmlData as $k => $h ) |
|
| 2211 | + foreach ($ThtmlData as $k => $h) |
|
| 2212 | 2212 | { |
| 2213 | - if(is_array($h)) |
|
| 2213 | + if (is_array($h)) |
|
| 2214 | 2214 | { |
| 2215 | 2215 | $h = json_encode($h); |
| 2216 | 2216 | } |
| 2217 | 2217 | |
| 2218 | - $data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" '; |
|
| 2218 | + $data .= $k.'="'.dol_htmlentities($h, ENT_QUOTES).'" '; |
|
| 2219 | 2219 | } |
| 2220 | 2220 | |
| 2221 | 2221 | return $data; |
@@ -2223,26 +2223,26 @@ discard block |
||
| 2223 | 2223 | |
| 2224 | 2224 | function _ajax_block_order_js($object) |
| 2225 | 2225 | { |
| 2226 | - global $conf,$tagidfortablednd,$filepath,$langs; |
|
| 2226 | + global $conf, $tagidfortablednd, $filepath, $langs; |
|
| 2227 | 2227 | |
| 2228 | 2228 | /* |
| 2229 | 2229 | * this part of js is base on dolibarr htdocs/core/tpl/ajaxrow.tpl.php |
| 2230 | 2230 | * for compatibility reasons we don't use tableDnD but jquery sortable |
| 2231 | 2231 | */ |
| 2232 | 2232 | |
| 2233 | - $id=$object->id; |
|
| 2234 | - $nboflines=(isset($object->lines)?count($object->lines):0); |
|
| 2235 | - $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1; |
|
| 2233 | + $id = $object->id; |
|
| 2234 | + $nboflines = (isset($object->lines) ?count($object->lines) : 0); |
|
| 2235 | + $forcereloadpage = empty($conf->global->MAIN_FORCE_RELOAD_PAGE) ? 0 : 1; |
|
| 2236 | 2236 | |
| 2237 | - $id=$object->id; |
|
| 2238 | - $fk_element=$object->fk_element; |
|
| 2239 | - $table_element_line=$object->table_element_line; |
|
| 2240 | - $nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines)); |
|
| 2241 | - $tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd); |
|
| 2242 | - $filepath=(empty($filepath)?'':$filepath); |
|
| 2237 | + $id = $object->id; |
|
| 2238 | + $fk_element = $object->fk_element; |
|
| 2239 | + $table_element_line = $object->table_element_line; |
|
| 2240 | + $nboflines = (isset($object->lines) ?count($object->lines) : (empty($nboflines) ? 0 : $nboflines)); |
|
| 2241 | + $tagidfortablednd = (empty($tagidfortablednd) ? 'tablelines' : $tagidfortablednd); |
|
| 2242 | + $filepath = (empty($filepath) ? '' : $filepath); |
|
| 2243 | 2243 | |
| 2244 | 2244 | |
| 2245 | - if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1) |
|
| 2245 | + if (GETPOST('action', 'aZ09') != 'editline' && $nboflines > 1) |
|
| 2246 | 2246 | { |
| 2247 | 2247 | |
| 2248 | 2248 | ?> |
@@ -2260,7 +2260,7 @@ discard block |
||
| 2260 | 2260 | moveBlockCol.disableSelection(); // prevent selection |
| 2261 | 2261 | <?php if ($object->statut == 0) { ?> |
| 2262 | 2262 | // apply some graphical stuff |
| 2263 | - moveBlockCol.css("background-image",'url(<?php echo dol_buildpath('subtotal/img/grip_all.png',2); ?>)'); |
|
| 2263 | + moveBlockCol.css("background-image",'url(<?php echo dol_buildpath('subtotal/img/grip_all.png', 2); ?>)'); |
|
| 2264 | 2264 | moveBlockCol.css("background-repeat","no-repeat"); |
| 2265 | 2265 | moveBlockCol.css("background-position","center center"); |
| 2266 | 2266 | moveBlockCol.css("cursor","move"); |