@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | $this->rowid = $obj->rowid; |
142 | 142 | |
143 | 143 | $this->code = $obj->code; |
144 | - $this->ref = $obj->code; |
|
144 | + $this->ref = $obj->code; |
|
145 | 145 | $this->label = $obj->label; |
146 | 146 | $this->nature = $obj->nature; |
147 | 147 | $this->active = $obj->active; |
@@ -437,10 +437,10 @@ discard block |
||
437 | 437 | return array(); |
438 | 438 | } |
439 | 439 | |
440 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; |
|
441 | - require_once DOL_DOCUMENT_ROOT . '/asset/class/asset.class.php'; |
|
442 | - require_once DOL_DOCUMENT_ROOT . '/asset/class/assetaccountancycodes.class.php'; |
|
443 | - require_once DOL_DOCUMENT_ROOT . '/asset/class/assetdepreciationoptions.class.php'; |
|
440 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; |
|
441 | + require_once DOL_DOCUMENT_ROOT.'/asset/class/asset.class.php'; |
|
442 | + require_once DOL_DOCUMENT_ROOT.'/asset/class/assetaccountancycodes.class.php'; |
|
443 | + require_once DOL_DOCUMENT_ROOT.'/asset/class/assetdepreciationoptions.class.php'; |
|
444 | 444 | |
445 | 445 | $langs->loadLangs(array("assets")); |
446 | 446 | |
@@ -456,21 +456,21 @@ discard block |
||
456 | 456 | $sql .= "SELECT ad.fk_asset AS rowid, a.ref AS asset_ref, a.label AS asset_label, a.acquisition_value_ht AS asset_acquisition_value_ht"; |
457 | 457 | $sql .= ", a.disposal_date AS asset_disposal_date, a.disposal_amount_ht AS asset_disposal_amount_ht, a.disposal_subject_to_vat AS asset_disposal_subject_to_vat"; |
458 | 458 | $sql .= ", ad.rowid AS depreciation_id, ad.depreciation_mode, ad.ref AS depreciation_ref, ad.depreciation_date, ad.depreciation_ht, ad.accountancy_code_debit, ad.accountancy_code_credit"; |
459 | - $sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation as ad"; |
|
460 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "asset as a ON a.rowid = ad.fk_asset"; |
|
461 | - $sql .= " WHERE a.entity IN (" . getEntity('asset', 0) . ')'; // We don't share object for accountancy, we use source object sharing |
|
459 | + $sql .= " FROM ".MAIN_DB_PREFIX."asset_depreciation as ad"; |
|
460 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."asset as a ON a.rowid = ad.fk_asset"; |
|
461 | + $sql .= " WHERE a.entity IN (".getEntity('asset', 0).')'; // We don't share object for accountancy, we use source object sharing |
|
462 | 462 | if ($in_bookkeeping == 'already') { |
463 | - $sql .= " AND EXISTS (SELECT iab.fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS iab WHERE iab.fk_docdet = ad.rowid AND doc_type = 'asset')"; |
|
463 | + $sql .= " AND EXISTS (SELECT iab.fk_docdet FROM ".MAIN_DB_PREFIX."accounting_bookkeeping AS iab WHERE iab.fk_docdet = ad.rowid AND doc_type = 'asset')"; |
|
464 | 464 | } elseif ($in_bookkeeping == 'notyet') { |
465 | - $sql .= " AND NOT EXISTS (SELECT iab.fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS iab WHERE iab.fk_docdet = ad.rowid AND doc_type = 'asset')"; |
|
465 | + $sql .= " AND NOT EXISTS (SELECT iab.fk_docdet FROM ".MAIN_DB_PREFIX."accounting_bookkeeping AS iab WHERE iab.fk_docdet = ad.rowid AND doc_type = 'asset')"; |
|
466 | 466 | } |
467 | 467 | $sql .= " AND ad.ref != ''"; // not reversal lines |
468 | 468 | if ($date_start && $date_end) { |
469 | - $sql .= " AND ad.depreciation_date >= '" . $this->db->idate($date_start) . "' AND ad.depreciation_date <= '" . $this->db->idate($date_end) . "'"; |
|
469 | + $sql .= " AND ad.depreciation_date >= '".$this->db->idate($date_start)."' AND ad.depreciation_date <= '".$this->db->idate($date_end)."'"; |
|
470 | 470 | } |
471 | 471 | // Define begin binding date |
472 | 472 | if (getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) { |
473 | - $sql .= " AND ad.depreciation_date >= '" . $this->db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) . "'"; |
|
473 | + $sql .= " AND ad.depreciation_date >= '".$this->db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING'))."'"; |
|
474 | 474 | } |
475 | 475 | $sql .= " ORDER BY ad.depreciation_date"; |
476 | 476 | |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | if ($type == 'view') { |
557 | 557 | $account_to_show = length_accounta($account); |
558 | 558 | if (($account_to_show == "") || $account_to_show == 'NotDefined') { |
559 | - $account_to_show = '<span class="error">' . $langs->trans("AssetInAccountNotDefined") . '</span>'; |
|
559 | + $account_to_show = '<span class="error">'.$langs->trans("AssetInAccountNotDefined").'</span>'; |
|
560 | 560 | } |
561 | 561 | |
562 | 562 | $blocks[] = array( |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | 'piece' => $element_link, |
565 | 565 | 'account_accounting' => $account_to_show, |
566 | 566 | 'subledger_account' => '', |
567 | - 'label_operation' => $label_operation . ' - ' . $depreciation_ref, |
|
567 | + 'label_operation' => $label_operation.' - '.$depreciation_ref, |
|
568 | 568 | 'debit' => $mt < 0 ? price(-$mt) : '', |
569 | 569 | 'credit' => $mt >= 0 ? price($mt) : '', |
570 | 570 | ); |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | 'subledger_label' => '', |
584 | 584 | 'numero_compte' => $account, |
585 | 585 | 'label_compte' => $account_infos['label'], |
586 | - 'label_operation' => $element_name_formatted_0 . ' - ' . $depreciation_ref, |
|
586 | + 'label_operation' => $element_name_formatted_0.' - '.$depreciation_ref, |
|
587 | 587 | 'montant' => $mt, |
588 | 588 | 'sens' => $mt < 0 ? 'D' : 'C', |
589 | 589 | 'debit' => $mt < 0 ? -$mt : 0, |
@@ -598,12 +598,12 @@ discard block |
||
598 | 598 | } |
599 | 599 | } else { // $type == 'csv' |
600 | 600 | $blocks[] = array( |
601 | - $depreciation_date, // Date |
|
602 | - $element_static->ref, // Piece |
|
603 | - $account_infos['code_formatted_1'], // AccountAccounting |
|
604 | - $element_name_formatted_0 . ' - ' . $depreciation_ref, // LabelOperation |
|
605 | - $mt < 0 ? price(-$mt) : '', // Debit |
|
606 | - $mt >= 0 ? price($mt) : '', // Credit |
|
601 | + $depreciation_date, // Date |
|
602 | + $element_static->ref, // Piece |
|
603 | + $account_infos['code_formatted_1'], // AccountAccounting |
|
604 | + $element_name_formatted_0.' - '.$depreciation_ref, // LabelOperation |
|
605 | + $mt < 0 ? price(-$mt) : '', // Debit |
|
606 | + $mt >= 0 ? price($mt) : '', // Credit |
|
607 | 607 | ); |
608 | 608 | } |
609 | 609 | } |
@@ -625,7 +625,7 @@ discard block |
||
625 | 625 | |
626 | 626 | // Get accountancy codes |
627 | 627 | //--------------------------- |
628 | - require_once DOL_DOCUMENT_ROOT . '/asset/class/assetaccountancycodes.class.php'; |
|
628 | + require_once DOL_DOCUMENT_ROOT.'/asset/class/assetaccountancycodes.class.php'; |
|
629 | 629 | $accountancy_codes = new AssetAccountancyCodes($this->db); |
630 | 630 | $result = $accountancy_codes->fetchAccountancyCodes($element_static->id); |
631 | 631 | if ($result < 0) { |
@@ -676,7 +676,7 @@ discard block |
||
676 | 676 | if ($type == 'view') { |
677 | 677 | $account_to_show = length_accounta($account); |
678 | 678 | if (($account_to_show == "") || $account_to_show == 'NotDefined') { |
679 | - $account_to_show = '<span class="error">' . $langs->trans("AssetInAccountNotDefined") . '</span>'; |
|
679 | + $account_to_show = '<span class="error">'.$langs->trans("AssetInAccountNotDefined").'</span>'; |
|
680 | 680 | } |
681 | 681 | |
682 | 682 | $blocks[] = array( |
@@ -684,7 +684,7 @@ discard block |
||
684 | 684 | 'piece' => $element_link, |
685 | 685 | 'account_accounting' => $account_to_show, |
686 | 686 | 'subledger_account' => '', |
687 | - 'label_operation' => $label_operation . ' - ' . $disposal_ref, |
|
687 | + 'label_operation' => $label_operation.' - '.$disposal_ref, |
|
688 | 688 | 'debit' => $mt < 0 ? price(-$mt) : '', |
689 | 689 | 'credit' => $mt >= 0 ? price($mt) : '', |
690 | 690 | ); |
@@ -703,7 +703,7 @@ discard block |
||
703 | 703 | 'subledger_label' => '', |
704 | 704 | 'numero_compte' => $account, |
705 | 705 | 'label_compte' => $account_infos['label'], |
706 | - 'label_operation' => $element_name_formatted_0 . ' - ' . $disposal_ref, |
|
706 | + 'label_operation' => $element_name_formatted_0.' - '.$disposal_ref, |
|
707 | 707 | 'montant' => $mt, |
708 | 708 | 'sens' => $mt < 0 ? 'D' : 'C', |
709 | 709 | 'debit' => $mt < 0 ? -$mt : 0, |
@@ -718,12 +718,12 @@ discard block |
||
718 | 718 | } |
719 | 719 | } else { // $type == 'csv' |
720 | 720 | $blocks[] = array( |
721 | - $disposal_date, // Date |
|
722 | - $element_static->ref, // Piece |
|
723 | - $account_infos['code_formatted_1'], // AccountAccounting |
|
724 | - $element_name_formatted_0 . ' - ' . $disposal_ref, // LabelOperation |
|
725 | - $mt < 0 ? price(-$mt) : '', // Debit |
|
726 | - $mt >= 0 ? price($mt) : '', // Credit |
|
721 | + $disposal_date, // Date |
|
722 | + $element_static->ref, // Piece |
|
723 | + $account_infos['code_formatted_1'], // AccountAccounting |
|
724 | + $element_name_formatted_0.' - '.$disposal_ref, // LabelOperation |
|
725 | + $mt < 0 ? price(-$mt) : '', // Debit |
|
726 | + $mt >= 0 ? price($mt) : '', // Credit |
|
727 | 727 | ); |
728 | 728 | } |
729 | 729 | } |
@@ -787,7 +787,7 @@ discard block |
||
787 | 787 | public function writeIntoBookkeeping(User $user, &$journal_data = array(), $max_nb_errors = 10) |
788 | 788 | { |
789 | 789 | global $conf, $langs, $hookmanager; |
790 | - require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php'; |
|
790 | + require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php'; |
|
791 | 791 | |
792 | 792 | $error = 0; |
793 | 793 | |
@@ -885,7 +885,7 @@ discard block |
||
885 | 885 | $error++; |
886 | 886 | $error_for_line++; |
887 | 887 | $journal_data[$element_id]['error'] = 'amountsnotbalanced'; |
888 | - $this->errors[] = 'Try to insert a non balanced transaction in book for ' . $element['blocks'] . '. Canceled. Surely a bug.'; |
|
888 | + $this->errors[] = 'Try to insert a non balanced transaction in book for '.$element['blocks'].'. Canceled. Surely a bug.'; |
|
889 | 889 | } |
890 | 890 | |
891 | 891 | if (!$error_for_line) { |
@@ -983,12 +983,12 @@ discard block |
||
983 | 983 | } |
984 | 984 | |
985 | 985 | if (!empty($header)) { |
986 | - $out .= '"' . implode('"' . $sep . '"', $header) . '"' . "\n"; |
|
986 | + $out .= '"'.implode('"'.$sep.'"', $header).'"'."\n"; |
|
987 | 987 | } |
988 | 988 | foreach ($journal_data as $element_id => $element) { |
989 | 989 | foreach ($element['blocks'] as $lines) { |
990 | 990 | foreach ($lines as $line) { |
991 | - $out .= '"' . implode('"' . $sep . '"', $line) . '"' . "\n"; |
|
991 | + $out .= '"'.implode('"'.$sep.'"', $line).'"'."\n"; |
|
992 | 992 | } |
993 | 993 | } |
994 | 994 | } |
@@ -1006,8 +1006,8 @@ discard block |
||
1006 | 1006 | public function getAccountingAccountInfos($account) |
1007 | 1007 | { |
1008 | 1008 | if (!isset(self::$accounting_account_cached[$account])) { |
1009 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; |
|
1010 | - require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php'; |
|
1009 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; |
|
1010 | + require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; |
|
1011 | 1011 | $accountingaccount = new AccountingAccount($this->db); |
1012 | 1012 | $result = $accountingaccount->fetch(null, $account, true); |
1013 | 1013 | if ($result > 0) { |
@@ -50,14 +50,14 @@ discard block |
||
50 | 50 | |
51 | 51 | $value = GETPOST('value', 'alpha'); |
52 | 52 | $label = GETPOST('label', 'alpha'); |
53 | -$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php |
|
53 | +$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php |
|
54 | 54 | |
55 | 55 | $scandir = GETPOST('scan_dir', 'alpha'); |
56 | 56 | $type = 'evaluation'; |
57 | 57 | |
58 | 58 | $arrayofparameters = array( |
59 | - 'HRM_MAXRANK'=>array('type'=>'integer','enabled'=>1), |
|
60 | - 'HRM_DEFAULT_SKILL_DESCRIPTION'=>array('type'=>'varchar','enabled'=>1), |
|
59 | + 'HRM_MAXRANK'=>array('type'=>'integer', 'enabled'=>1), |
|
60 | + 'HRM_DEFAULT_SKILL_DESCRIPTION'=>array('type'=>'varchar', 'enabled'=>1), |
|
61 | 61 | ); |
62 | 62 | |
63 | 63 | $error = 0; |
@@ -487,27 +487,27 @@ discard block |
||
487 | 487 | print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>'; |
488 | 488 | |
489 | 489 | foreach ($arrayofparameters as $constname => $val) { |
490 | - if ($val['enabled']==1) { |
|
490 | + if ($val['enabled'] == 1) { |
|
491 | 491 | $setupnotempty++; |
492 | 492 | print '<tr class="oddeven"><td>'; |
493 | - $tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : ''); |
|
493 | + $tooltiphelp = (($langs->trans($constname.'Tooltip') != $constname.'Tooltip') ? $langs->trans($constname.'Tooltip') : ''); |
|
494 | 494 | print '<span id="helplink'.$constname.'" class="spanforparamtooltip">'.$form->textwithpicto($langs->trans($constname), $tooltiphelp, 1, 'info', '', 0, 3, 'tootips'.$constname).'</span>'; |
495 | 495 | print '</td><td>'; |
496 | 496 | |
497 | 497 | if ($val['type'] == 'textarea') { |
498 | - print '<textarea class="flat" name="' . $constname . '" id="' . $constname . '" cols="50" rows="5" wrap="soft">' . "\n"; |
|
498 | + print '<textarea class="flat" name="'.$constname.'" id="'.$constname.'" cols="50" rows="5" wrap="soft">'."\n"; |
|
499 | 499 | print getDolGlobalString($constname); |
500 | 500 | print "</textarea>\n"; |
501 | 501 | } elseif ($val['type'] == 'integer') { |
502 | - print '<input class="flat" name="' . $constname . '" id="' . $constname . '" value="' . getDolGlobalString($constname) . '" type="number" step="1" min="0" max="50" >' . "\n"; |
|
502 | + print '<input class="flat" name="'.$constname.'" id="'.$constname.'" value="'.getDolGlobalString($constname).'" type="number" step="1" min="0" max="50" >'."\n"; |
|
503 | 503 | } elseif ($val['type'] == 'html') { |
504 | - require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; |
|
504 | + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
|
505 | 505 | $doleditor = new DolEditor($constname, getDolGlobalString($constname), '', 160, 'dolibarr_notes', '', false, false, isModEnabled('fckeditor'), ROWS_5, '90%'); |
506 | 506 | $doleditor->Create(); |
507 | 507 | } elseif ($val['type'] == 'yesno') { |
508 | 508 | print $form->selectyesno($constname, getDolGlobalString($constname), 1); |
509 | 509 | } elseif (preg_match('/emailtemplate:/', $val['type'])) { |
510 | - include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; |
|
510 | + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; |
|
511 | 511 | $formmail = new FormMail($db); |
512 | 512 | |
513 | 513 | $tmp = explode(':', $val['type']); |
@@ -519,10 +519,10 @@ discard block |
||
519 | 519 | //var_dump($modelmail); |
520 | 520 | $moreonlabel = ''; |
521 | 521 | if (!empty($arrayofmessagename[$modelmail->label])) { |
522 | - $moreonlabel = ' <span class="opacitymedium">(' . $langs->trans("SeveralLangugeVariatFound") . ')</span>'; |
|
522 | + $moreonlabel = ' <span class="opacitymedium">('.$langs->trans("SeveralLangugeVariatFound").')</span>'; |
|
523 | 523 | } |
524 | 524 | // The 'label' is the key that is unique if we exclude the language |
525 | - $arrayofmessagename[$modelmail->id] = $langs->trans(preg_replace('/\(|\)/', '', $modelmail->label)) . $moreonlabel; |
|
525 | + $arrayofmessagename[$modelmail->id] = $langs->trans(preg_replace('/\(|\)/', '', $modelmail->label)).$moreonlabel; |
|
526 | 526 | } |
527 | 527 | } |
528 | 528 | print $form->selectarray($constname, $arrayofmessagename, getDolGlobalString($constname), 'None', 0, 0, '', 0, 0, 0, '', '', 1); |
@@ -535,25 +535,25 @@ discard block |
||
535 | 535 | print img_picto('', 'category', 'class="pictofixedwidth"'); |
536 | 536 | print $formother->select_categories($tmp[1], getDolGlobalString($constname), $constname, 0, $langs->trans('CustomersProspectsCategoriesShort')); |
537 | 537 | } elseif (preg_match('/thirdparty_type/', $val['type'])) { |
538 | - require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php'; |
|
538 | + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; |
|
539 | 539 | $formcompany = new FormCompany($db); |
540 | 540 | print $formcompany->selectProspectCustomerType(getDolGlobalString($constname), $constname); |
541 | 541 | } elseif ($val['type'] == 'securekey') { |
542 | - print '<input required="required" type="text" class="flat" id="' . $constname . '" name="' . $constname . '" value="' . (GETPOST($constname, 'alpha') ? GETPOST($constname, 'alpha') : getDolGlobalString($constname)) . '" size="40">'; |
|
542 | + print '<input required="required" type="text" class="flat" id="'.$constname.'" name="'.$constname.'" value="'.(GETPOST($constname, 'alpha') ? GETPOST($constname, 'alpha') : getDolGlobalString($constname)).'" size="40">'; |
|
543 | 543 | if (!empty($conf->use_javascript_ajax)) { |
544 | - print ' ' . img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token' . $constname . '" class="linkobject"'); |
|
544 | + print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token'.$constname.'" class="linkobject"'); |
|
545 | 545 | } |
546 | 546 | |
547 | 547 | // Add button to autosuggest a key |
548 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/security2.lib.php'; |
|
549 | - print dolJSToSetRandomPassword($constname, 'generate_token' . $constname); |
|
548 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; |
|
549 | + print dolJSToSetRandomPassword($constname, 'generate_token'.$constname); |
|
550 | 550 | } elseif ($val['type'] == 'product') { |
551 | 551 | if (isModEnabled('product') || isModEnabled('service')) { |
552 | 552 | $selected = getDolGlobalString($constname); |
553 | 553 | $form->select_produits($selected, $constname, '', 0); |
554 | 554 | } |
555 | 555 | } else { |
556 | - print '<input name="' . $constname . '" class="flat ' . (empty($val['css']) ? 'minwidth200' : $val['css']) . '" value="' . getDolGlobalString($constname) . '">'; |
|
556 | + print '<input name="'.$constname.'" class="flat '.(empty($val['css']) ? 'minwidth200' : $val['css']).'" value="'.getDolGlobalString($constname).'">'; |
|
557 | 557 | } |
558 | 558 | print '</td></tr>'; |
559 | 559 | } |
@@ -572,27 +572,27 @@ discard block |
||
572 | 572 | print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>'; |
573 | 573 | |
574 | 574 | foreach ($arrayofparameters as $constname => $val) { |
575 | - if ($val['enabled']==1) { |
|
575 | + if ($val['enabled'] == 1) { |
|
576 | 576 | $setupnotempty++; |
577 | 577 | print '<tr class="oddeven"><td>'; |
578 | - $tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : ''); |
|
578 | + $tooltiphelp = (($langs->trans($constname.'Tooltip') != $constname.'Tooltip') ? $langs->trans($constname.'Tooltip') : ''); |
|
579 | 579 | print $form->textwithpicto($langs->trans($constname), $tooltiphelp); |
580 | 580 | print '</td><td>'; |
581 | 581 | |
582 | 582 | if ($val['type'] == 'textarea') { |
583 | 583 | print dol_nl2br(getDolGlobalString($constname)); |
584 | - } elseif ($val['type']== 'html') { |
|
584 | + } elseif ($val['type'] == 'html') { |
|
585 | 585 | print getDolGlobalString($constname); |
586 | 586 | } elseif ($val['type'] == 'yesno') { |
587 | 587 | print ajax_constantonoff($constname); |
588 | 588 | } elseif (preg_match('/emailtemplate:/', $val['type'])) { |
589 | - include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; |
|
589 | + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; |
|
590 | 590 | $formmail = new FormMail($db); |
591 | 591 | |
592 | 592 | $tmp = explode(':', $val['type']); |
593 | 593 | |
594 | 594 | $template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs, getDolGlobalString($constname)); |
595 | - if ($template<0) { |
|
595 | + if ($template < 0) { |
|
596 | 596 | setEventMessages(null, $formmail->errors, 'errors'); |
597 | 597 | } |
598 | 598 | print $langs->trans($template->label); |
@@ -605,9 +605,9 @@ discard block |
||
605 | 605 | $ways = $c->print_all_ways(' >> ', 'none', 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formated text |
606 | 606 | $toprint = array(); |
607 | 607 | foreach ($ways as $way) { |
608 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . '</li>'; |
|
608 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #bbb"').'>'.$way.'</li>'; |
|
609 | 609 | } |
610 | - print '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>'; |
|
610 | + print '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; |
|
611 | 611 | } elseif (preg_match('/thirdparty_type/', $val['type'])) { |
612 | 612 | if (getDolGlobalString($constname) == 2) { |
613 | 613 | print $langs->trans("Prospect"); |
@@ -134,13 +134,13 @@ discard block |
||
134 | 134 | if ($invoiceid > 0) { |
135 | 135 | $ret = $invoice->fetch($invoiceid); |
136 | 136 | } else { |
137 | - $ret = $invoice->fetch('', '(PROV-POS'. (isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '') .'-'.$place.')'); |
|
137 | + $ret = $invoice->fetch('', '(PROV-POS'.(isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '').'-'.$place.')'); |
|
138 | 138 | } |
139 | 139 | if ($ret > 0) { |
140 | 140 | $placeid = $invoice->id; |
141 | 141 | } |
142 | 142 | |
143 | -$constforcompanyid = 'CASHDESK_ID_THIRDPARTY'. (isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : ''); |
|
143 | +$constforcompanyid = 'CASHDESK_ID_THIRDPARTY'.(isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : ''); |
|
144 | 144 | |
145 | 145 | $soc = new Societe($db); |
146 | 146 | if ($invoice->socid > 0) { |
@@ -161,8 +161,8 @@ discard block |
||
161 | 161 | * Actions |
162 | 162 | */ |
163 | 163 | |
164 | -$parameters=array(); |
|
165 | -$reshook=$hookmanager->executeHooks('doActions', $parameters, $invoice, $action); // Note that $action and $object may have been modified by some hooks |
|
164 | +$parameters = array(); |
|
165 | +$reshook = $hookmanager->executeHooks('doActions', $parameters, $invoice, $action); // Note that $action and $object may have been modified by some hooks |
|
166 | 166 | if ($reshook < 0) { |
167 | 167 | setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
168 | 168 | } |
@@ -177,9 +177,9 @@ discard block |
||
177 | 177 | $bankaccount = GETPOST('accountid', 'int'); |
178 | 178 | } else { |
179 | 179 | if ($pay == 'LIQ') { |
180 | - $bankaccount = getDolGlobalString('CASHDESK_ID_BANKACCOUNT_CASH'.$_SESSION["takeposterminal"]); // For backward compatibility |
|
180 | + $bankaccount = getDolGlobalString('CASHDESK_ID_BANKACCOUNT_CASH'.$_SESSION["takeposterminal"]); // For backward compatibility |
|
181 | 181 | } elseif ($pay == "CHQ") { |
182 | - $bankaccount = getDolGlobalString('CASHDESK_ID_BANKACCOUNT_CHEQUE'.$_SESSION["takeposterminal"]); // For backward compatibility |
|
182 | + $bankaccount = getDolGlobalString('CASHDESK_ID_BANKACCOUNT_CHEQUE'.$_SESSION["takeposterminal"]); // For backward compatibility |
|
183 | 183 | } else { |
184 | 184 | $accountname = "CASHDESK_ID_BANKACCOUNT_".$pay.$_SESSION["takeposterminal"]; |
185 | 185 | $bankaccount = getDolGlobalString($accountname); |
@@ -239,9 +239,9 @@ discard block |
||
239 | 239 | $savconst = $conf->global->STOCK_CALCULATE_ON_BILL; |
240 | 240 | |
241 | 241 | if (isModEnabled('productbatch') && !getDolGlobalInt('CASHDESK_FORCE_DECREASE_STOCK')) { |
242 | - $conf->global->STOCK_CALCULATE_ON_BILL = 0; // To not change the stock (not yet compatible with batch management) |
|
242 | + $conf->global->STOCK_CALCULATE_ON_BILL = 0; // To not change the stock (not yet compatible with batch management) |
|
243 | 243 | } else { |
244 | - $conf->global->STOCK_CALCULATE_ON_BILL = 1; // To force the change of stock |
|
244 | + $conf->global->STOCK_CALCULATE_ON_BILL = 1; // To force the change of stock |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | $constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"]; |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | } |
316 | 316 | // Update stock for batch products |
317 | 317 | if (isModEnabled('productbatch')) { |
318 | - require_once DOL_DOCUMENT_ROOT . "/product/stock/class/mouvementstock.class.php"; |
|
318 | + require_once DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php"; |
|
319 | 319 | $constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"]; |
320 | 320 | foreach ($invoice->lines as $line) { |
321 | 321 | if ($line->batch && $line->fk_warehouse > 0) { |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | $creditnote->socid = $invoice->socid; |
338 | 338 | $creditnote->date = dol_now(); |
339 | 339 | $creditnote->module_source = 'takepos'; |
340 | - $creditnote->pos_source = isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '' ; |
|
340 | + $creditnote->pos_source = isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : ''; |
|
341 | 341 | $creditnote->type = Facture::TYPE_CREDIT_NOTE; |
342 | 342 | $creditnote->fk_facture_source = $placeid; |
343 | 343 | //$creditnote->remise_absolue = $invoice->remise_absolue; |
@@ -488,9 +488,9 @@ discard block |
||
488 | 488 | // If we add a line and no invoice yet, we create the invoice |
489 | 489 | if (($action == "addline" || $action == "freezone") && $placeid == 0) { |
490 | 490 | $invoice->socid = getDolGlobalString($constforcompanyid); |
491 | - $invoice->date = dol_now('tzuserrel'); // We use the local date, only the day will be saved. |
|
491 | + $invoice->date = dol_now('tzuserrel'); // We use the local date, only the day will be saved. |
|
492 | 492 | $invoice->module_source = 'takepos'; |
493 | - $invoice->pos_source = isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '' ; |
|
493 | + $invoice->pos_source = isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : ''; |
|
494 | 494 | $invoice->entity = !empty($_SESSION["takeposinvoiceentity"]) ? $_SESSION["takeposinvoiceentity"] : $conf->entity; |
495 | 495 | |
496 | 496 | if ($invoice->socid <= 0) { |
@@ -532,12 +532,12 @@ discard block |
||
532 | 532 | $batch = GETPOST('batch', 'alpha'); |
533 | 533 | |
534 | 534 | if (!empty($batch)) { |
535 | - $action="setbatch"; |
|
535 | + $action = "setbatch"; |
|
536 | 536 | } else { |
537 | 537 | $nbofsuggested = 0; |
538 | 538 | $prod->load_stock('warehouseopen'); |
539 | 539 | $constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"]; |
540 | - if ($prod->stock_warehouse[getDolGlobalString($constantforkey)]->detail_batch!="") { |
|
540 | + if ($prod->stock_warehouse[getDolGlobalString($constantforkey)]->detail_batch != "") { |
|
541 | 541 | if (is_object($prod->stock_warehouse[getDolGlobalString($constantforkey)]) && count($prod->stock_warehouse[getDolGlobalString($constantforkey)]->detail_batch)) { |
542 | 542 | foreach ($prod->stock_warehouse[getDolGlobalString($constantforkey)]->detail_batch as $dbatch) { |
543 | 543 | $nbofsuggested++; |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | echo "}"; |
553 | 553 | echo "</script>"; |
554 | 554 | |
555 | - if ($nbofsuggested>0) { |
|
555 | + if ($nbofsuggested > 0) { |
|
556 | 556 | echo "<center>".$langs->trans("SearchIntoBatch").": <b> $nbofsuggested </b></center><br><table>"; |
557 | 557 | foreach ($prod->stock_warehouse[getDolGlobalString($constantforkey)]->detail_batch as $dbatch) { // $dbatch is instance of Productbatch |
558 | 558 | $batchStock = + $dbatch->qty; // To get a numeric |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | if (getDolGlobalString('TAKEPOS_GROUP_SAME_PRODUCT')) { |
614 | 614 | foreach ($invoice->lines as $line) { |
615 | 615 | if ($line->product_ref == $prod->ref) { |
616 | - if ($line->special_code==4) { |
|
616 | + if ($line->special_code == 4) { |
|
617 | 617 | continue; |
618 | 618 | } // If this line is sended to printer create new line |
619 | 619 | // check if qty in stock |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | |
664 | 664 | // complete line by hook |
665 | 665 | $parameters = array('prod' => $prod, 'line' => $line); |
666 | - $reshook=$hookmanager->executeHooks('completeTakePosAddLine', $parameters, $invoice, $action); // Note that $action and $line may have been modified by some hooks |
|
666 | + $reshook = $hookmanager->executeHooks('completeTakePosAddLine', $parameters, $invoice, $action); // Note that $action and $line may have been modified by some hooks |
|
667 | 667 | if ($reshook < 0) { |
668 | 668 | setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
669 | 669 | } |
@@ -718,7 +718,7 @@ discard block |
||
718 | 718 | |
719 | 719 | if ($action == "addnote") { |
720 | 720 | $desc = GETPOST('addnote', 'alpha'); |
721 | - if ($idline==0) { |
|
721 | + if ($idline == 0) { |
|
722 | 722 | $invoice->update_note($desc, '_public'); |
723 | 723 | } else { |
724 | 724 | foreach ($invoice->lines as $line) { |
@@ -820,7 +820,7 @@ discard block |
||
820 | 820 | } else { |
821 | 821 | if (!$user->hasRight('takepos', 'editlines') || (!$user->hasRight('takepos', 'editorderedlines') && $line->special_code == "4")) { |
822 | 822 | dol_htmloutput_errors($langs->trans("NotEnoughPermissions", "TakePos"), null, 1); |
823 | - } elseif (getDolGlobalInt('TAKEPOS_CHANGE_PRICE_HT') == 1) { |
|
823 | + } elseif (getDolGlobalInt('TAKEPOS_CHANGE_PRICE_HT') == 1) { |
|
824 | 824 | $result = $invoice->updateline($line->id, $line->desc, $number, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit); |
825 | 825 | } else { |
826 | 826 | $result = $invoice->updateline($line->id, $line->desc, $number, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'TTC', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit); |
@@ -874,7 +874,7 @@ discard block |
||
874 | 874 | $invoice->fetch($placeid); |
875 | 875 | } |
876 | 876 | |
877 | - if ($action=="setbatch") { |
|
877 | + if ($action == "setbatch") { |
|
878 | 878 | $constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"]; |
879 | 879 | $sql = "UPDATE ".MAIN_DB_PREFIX."facturedet set batch=".$db->escape($batch).", fk_warehouse=".getDolGlobalString($constantforkey)." where rowid=".((int) $idoflineadded); |
880 | 880 | $db->query($sql); |
@@ -1021,7 +1021,7 @@ discard block |
||
1021 | 1021 | } |
1022 | 1022 | $sectionwithinvoicelink .= '</span><br>'; |
1023 | 1023 | if (getDolGlobalInt('TAKEPOS_PRINT_INVOICE_DOC_INSTEAD_OF_RECEIPT')) { |
1024 | - $sectionwithinvoicelink .= ' <a target="_blank" class="button" href="' . DOL_URL_ROOT . '/document.php?token=' . newToken() . '&modulepart=facture&file=' . $invoice->ref . '/' . $invoice->ref . '.pdf">Invoice</a>'; |
|
1024 | + $sectionwithinvoicelink .= ' <a target="_blank" class="button" href="'.DOL_URL_ROOT.'/document.php?token='.newToken().'&modulepart=facture&file='.$invoice->ref.'/'.$invoice->ref.'.pdf">Invoice</a>'; |
|
1025 | 1025 | } elseif (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector") { |
1026 | 1026 | if (getDolGlobalString('TAKEPOS_PRINT_SERVER') && filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) == true) { |
1027 | 1027 | $sectionwithinvoicelink .= ' <button id="buttonprint" type="button" onclick="TakeposConnector('.$placeid.')">'.$langs->trans('PrintTicket').'</button>'; |
@@ -1059,7 +1059,7 @@ discard block |
||
1059 | 1059 | if ((getDolGlobalString('TAKEPOS_PHONE_BASIC_LAYOUT') == 1 && $conf->browser->layout == 'phone') || defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) { |
1060 | 1060 | $title = 'TakePOS - Dolibarr '.DOL_VERSION; |
1061 | 1061 | if (getDolGlobalString('MAIN_APPLICATION_TITLE')) { |
1062 | - $title = 'TakePOS - ' . getDolGlobalString('MAIN_APPLICATION_TITLE'); |
|
1062 | + $title = 'TakePOS - '.getDolGlobalString('MAIN_APPLICATION_TITLE'); |
|
1063 | 1063 | } |
1064 | 1064 | $head = '<meta name="apple-mobile-web-app-title" content="TakePOS"/> |
1065 | 1065 | <meta name="apple-mobile-web-app-capable" content="yes"> |
@@ -1083,7 +1083,7 @@ discard block |
||
1083 | 1083 | <script type="text/javascript"> |
1084 | 1084 | var selectedline=0; |
1085 | 1085 | var selectedtext=""; |
1086 | -<?php if ($action=="valid") { |
|
1086 | +<?php if ($action == "valid") { |
|
1087 | 1087 | echo "var place=0;"; |
1088 | 1088 | }?> // Set to default place after close sale |
1089 | 1089 | var placeid=<?php echo($placeid > 0 ? $placeid : 0); ?>; |
@@ -1275,7 +1275,7 @@ discard block |
||
1275 | 1275 | if ($contactid > 0) { |
1276 | 1276 | $contact = new Contact($db); |
1277 | 1277 | $contact->fetch($contactid); |
1278 | - $s .= " - " . $contact->getFullName($langs); |
|
1278 | + $s .= " - ".$contact->getFullName($langs); |
|
1279 | 1279 | } |
1280 | 1280 | } |
1281 | 1281 | } |
@@ -1336,10 +1336,10 @@ discard block |
||
1336 | 1336 | $s = ''; |
1337 | 1337 | |
1338 | 1338 | $idwarehouse = 0; |
1339 | - $constantforkey = 'CASHDESK_NO_DECREASE_STOCK'. (isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : ''); |
|
1339 | + $constantforkey = 'CASHDESK_NO_DECREASE_STOCK'.(isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : ''); |
|
1340 | 1340 | if (isModEnabled('stock')) { |
1341 | 1341 | if (getDolGlobalString($constantforkey) != "1") { |
1342 | - $constantforkey = 'CASHDESK_ID_WAREHOUSE'. (isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : ''); |
|
1342 | + $constantforkey = 'CASHDESK_ID_WAREHOUSE'.(isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : ''); |
|
1343 | 1343 | $idwarehouse = getDolGlobalString($constantforkey); |
1344 | 1344 | if ($idwarehouse > 0) { |
1345 | 1345 | $s = '<span class="small">'; |
@@ -1482,8 +1482,8 @@ discard block |
||
1482 | 1482 | print '</td>'; |
1483 | 1483 | |
1484 | 1484 | // complete header by hook |
1485 | -$parameters=array(); |
|
1486 | -$reshook=$hookmanager->executeHooks('completeTakePosInvoiceHeader', $parameters, $invoice, $action); // Note that $action and $object may have been modified by some hooks |
|
1485 | +$parameters = array(); |
|
1486 | +$reshook = $hookmanager->executeHooks('completeTakePosInvoiceHeader', $parameters, $invoice, $action); // Note that $action and $object may have been modified by some hooks |
|
1487 | 1487 | if ($reshook < 0) { |
1488 | 1488 | setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
1489 | 1489 | } |
@@ -1494,16 +1494,16 @@ discard block |
||
1494 | 1494 | print '<td class="linecolqty right">'.$langs->trans('Qty').'</td>'; |
1495 | 1495 | if (getDolGlobalString('TAKEPOS_SHOW_HT')) { |
1496 | 1496 | print '<td class="linecolht right nowraponall">'; |
1497 | - print '<span class="opacitymedium small">' . $langs->trans('TotalHTShort') . '</span><br>'; |
|
1497 | + print '<span class="opacitymedium small">'.$langs->trans('TotalHTShort').'</span><br>'; |
|
1498 | 1498 | // In phone version only show when it is invoice page |
1499 | 1499 | if (empty($mobilepage) || $mobilepage == "invoice") { |
1500 | - print '<span id="linecolht-span-total" style="font-size:1.3em; font-weight: bold;">' . price($invoice->total_ht, 1, '', 1, -1, -1, $conf->currency) . '</span>'; |
|
1500 | + print '<span id="linecolht-span-total" style="font-size:1.3em; font-weight: bold;">'.price($invoice->total_ht, 1, '', 1, -1, -1, $conf->currency).'</span>'; |
|
1501 | 1501 | if (isModEnabled('multicurrency') && $_SESSION["takeposcustomercurrency"] != "" && $conf->currency != $_SESSION["takeposcustomercurrency"]) { |
1502 | 1502 | //Only show customer currency if multicurrency module is enabled, if currency selected and if this currency selected is not the same as main currency |
1503 | - include_once DOL_DOCUMENT_ROOT . '/multicurrency/class/multicurrency.class.php'; |
|
1503 | + include_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.php'; |
|
1504 | 1504 | $multicurrency = new MultiCurrency($db); |
1505 | 1505 | $multicurrency->fetch(0, $_SESSION["takeposcustomercurrency"]); |
1506 | - print '<br><span id="linecolht-span-total" style="font-size:0.9em; font-style:italic;">(' . price($invoice->total_ht * $multicurrency->rate->rate) . ' ' . $_SESSION["takeposcustomercurrency"] . ')</span>'; |
|
1506 | + print '<br><span id="linecolht-span-total" style="font-size:0.9em; font-style:italic;">('.price($invoice->total_ht * $multicurrency->rate->rate).' '.$_SESSION["takeposcustomercurrency"].')</span>'; |
|
1507 | 1507 | } |
1508 | 1508 | print '</td>'; |
1509 | 1509 | } |
@@ -1648,8 +1648,8 @@ discard block |
||
1648 | 1648 | $htmlsupplements[$line->fk_parent_line] .= '</td>'; |
1649 | 1649 | |
1650 | 1650 | // complete line by hook |
1651 | - $parameters=array('line' => $line); |
|
1652 | - $reshook=$hookmanager->executeHooks('completeTakePosInvoiceParentLine', $parameters, $invoice, $action); // Note that $action and $object may have been modified by some hooks |
|
1651 | + $parameters = array('line' => $line); |
|
1652 | + $reshook = $hookmanager->executeHooks('completeTakePosInvoiceParentLine', $parameters, $invoice, $action); // Note that $action and $object may have been modified by some hooks |
|
1653 | 1653 | if ($reshook < 0) { |
1654 | 1654 | setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
1655 | 1655 | } |
@@ -1698,7 +1698,7 @@ discard block |
||
1698 | 1698 | } |
1699 | 1699 | } |
1700 | 1700 | if (getDolGlobalInt('TAKEPOS_SHOW_PRODUCT_REFERENCE') == 1) { |
1701 | - $htmlforlines .= $form->textwithpicto($line->product_label ? '<b>' . $line->product_ref . '</b> - ' . $line->product_label : dolGetFirstLineOfText($line->desc, 1), $tooltiptext); |
|
1701 | + $htmlforlines .= $form->textwithpicto($line->product_label ? '<b>'.$line->product_ref.'</b> - '.$line->product_label : dolGetFirstLineOfText($line->desc, 1), $tooltiptext); |
|
1702 | 1702 | } elseif (getDolGlobalInt('TAKEPOS_SHOW_PRODUCT_REFERENCE') == 2) { |
1703 | 1703 | $htmlforlines .= $form->textwithpicto($line->product_ref ? '<b>'.$line->product_ref.'<b>' : dolGetFirstLineOfText($line->desc, 1), $tooltiptext); |
1704 | 1704 | } else { |
@@ -1744,8 +1744,8 @@ discard block |
||
1744 | 1744 | $htmlforlines .= '</td>'; |
1745 | 1745 | |
1746 | 1746 | // complete line by hook |
1747 | - $parameters=array('line' => $line); |
|
1748 | - $reshook=$hookmanager->executeHooks('completeTakePosInvoiceLine', $parameters, $invoice, $action); // Note that $action and $object may have been modified by some hooks |
|
1747 | + $parameters = array('line' => $line); |
|
1748 | + $reshook = $hookmanager->executeHooks('completeTakePosInvoiceLine', $parameters, $invoice, $action); // Note that $action and $object may have been modified by some hooks |
|
1749 | 1749 | if ($reshook < 0) { |
1750 | 1750 | setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
1751 | 1751 | } |
@@ -1836,7 +1836,7 @@ discard block |
||
1836 | 1836 | if (($action == "valid" || $action == "history") && $invoice->type != Facture::TYPE_CREDIT_NOTE && !getDolGlobalString('TAKEPOS_NO_CREDITNOTE')) { |
1837 | 1837 | print '<button id="buttonprint" type="button" onclick="ModalBox(\'ModalCreditNote\')">'.$langs->trans('CreateCreditNote').'</button>'; |
1838 | 1838 | if (getDolGlobalInt('TAKEPOS_PRINT_INVOICE_DOC_INSTEAD_OF_RECEIPT')) { |
1839 | - print ' <a target="_blank" class="button" href="' . DOL_URL_ROOT . '/document.php?token=' . newToken() . '&modulepart=facture&file=' . $invoice->ref . '/' . $invoice->ref . '.pdf">Invoice</a>'; |
|
1839 | + print ' <a target="_blank" class="button" href="'.DOL_URL_ROOT.'/document.php?token='.newToken().'&modulepart=facture&file='.$invoice->ref.'/'.$invoice->ref.'.pdf">Invoice</a>'; |
|
1840 | 1840 | } |
1841 | 1841 | } |
1842 | 1842 |
@@ -118,14 +118,14 @@ discard block |
||
118 | 118 | $arrayofcss = array('/takepos/css/pos.css.php', '/takepos/css/colorbox.css'); |
119 | 119 | |
120 | 120 | if (getDolGlobalInt('TAKEPOS_COLOR_THEME') == 1) { |
121 | - $arrayofcss[] = '/takepos/css/colorful.css'; |
|
121 | + $arrayofcss[] = '/takepos/css/colorful.css'; |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | |
125 | 125 | // Title |
126 | 126 | $title = 'TakePOS - Dolibarr '.DOL_VERSION; |
127 | 127 | if (getDolGlobalString('MAIN_APPLICATION_TITLE')) { |
128 | - $title = 'TakePOS - ' . getDolGlobalString('MAIN_APPLICATION_TITLE'); |
|
128 | + $title = 'TakePOS - '.getDolGlobalString('MAIN_APPLICATION_TITLE'); |
|
129 | 129 | } |
130 | 130 | $head = '<meta name="apple-mobile-web-app-title" content="TakePOS"/> |
131 | 131 | <meta name="apple-mobile-web-app-capable" content="yes"> |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | limit = maxproduct-1; |
332 | 332 | } |
333 | 333 | // Only show products for sale (tosell=1) |
334 | - $.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getProducts&token=<?php echo newToken();?>&thirdpartyid=' + jQuery('#thirdpartyid').val() + '&category='+currentcat+'&tosell=1&limit='+limit+'&offset=0', function(data) { |
|
334 | + $.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getProducts&token=<?php echo newToken(); ?>&thirdpartyid=' + jQuery('#thirdpartyid').val() + '&category='+currentcat+'&tosell=1&limit='+limit+'&offset=0', function(data) { |
|
335 | 335 | console.log("Call ajax.php (in LoadProducts) to get Products of category "+currentcat+" then loop on result to fill image thumbs"); |
336 | 336 | console.log(data); |
337 | 337 | while (ishow < maxproduct) { |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | |
388 | 388 | <?php |
389 | 389 | // Add js from hooks |
390 | - $parameters=array(); |
|
390 | + $parameters = array(); |
|
391 | 391 | $parameters['caller'] = 'loadProducts'; |
392 | 392 | $hookmanager->executeHooks('completeJSProductDisplay', $parameters); |
393 | 393 | print $hookmanager->resPrint; |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | } |
432 | 432 | var offset = <?php echo($MAXPRODUCT - 2); ?> * pageproducts; |
433 | 433 | // Only show products for sale (tosell=1) |
434 | - $.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getProducts&token=<?php echo newToken();?>&category='+currentcat+'&tosell=1&limit='+limit+'&offset='+offset, function(data) { |
|
434 | + $.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getProducts&token=<?php echo newToken(); ?>&category='+currentcat+'&tosell=1&limit='+limit+'&offset='+offset, function(data) { |
|
435 | 435 | console.log("Call ajax.php (in MoreProducts) to get Products of category "+currentcat); |
436 | 436 | |
437 | 437 | if (typeof (data[0]) == "undefined" && moreorless=="more"){ // Return if no more pages |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | function ChangeThirdparty(idcustomer) { |
505 | 505 | console.log("ChangeThirdparty"); |
506 | 506 | // Call page list.php to change customer |
507 | - $("#poslines").load("../societe/list.php?action=change&token=<?php echo newToken();?>&type=t&contextpage=poslist&idcustomer="+idcustomer+"&place="+place+"", function() { |
|
507 | + $("#poslines").load("../societe/list.php?action=change&token=<?php echo newToken(); ?>&type=t&contextpage=poslist&idcustomer="+idcustomer+"&place="+place+"", function() { |
|
508 | 508 | }); |
509 | 509 | |
510 | 510 | ClearSearch(); |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | |
582 | 582 | console.log("New with place = <?php echo $place; ?>, js place="+place+", invoiceid="+invoiceid); |
583 | 583 | |
584 | - $.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getInvoice&token=<?php echo newToken();?>&id='+invoiceid, function(data) { |
|
584 | + $.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getInvoice&token=<?php echo newToken(); ?>&id='+invoiceid, function(data) { |
|
585 | 585 | var r; |
586 | 586 | |
587 | 587 | if (parseInt(data['paye']) === 1) { |
@@ -651,7 +651,7 @@ discard block |
||
651 | 651 | pageproducts = 0; |
652 | 652 | jQuery(".wrapper2 .catwatermark").hide(); |
653 | 653 | var nbsearchresults = 0; |
654 | - $.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=search&token=<?php echo newToken();?>&term=' + search_term + '&thirdpartyid=' + jQuery('#thirdpartyid').val() + '&search_start=' + search_start + '&search_limit=' + search_limit, function (data) { |
|
654 | + $.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=search&token=<?php echo newToken(); ?>&term=' + search_term + '&thirdpartyid=' + jQuery('#thirdpartyid').val() + '&search_start=' + search_start + '&search_limit=' + search_limit, function (data) { |
|
655 | 655 | for (i = 0; i < <?php echo $MAXPRODUCT ?>; i++) { |
656 | 656 | if (typeof (data[i]) == "undefined") { |
657 | 657 | $("#prowatermark" + i).html(""); |
@@ -695,7 +695,7 @@ discard block |
||
695 | 695 | |
696 | 696 | <?php |
697 | 697 | // Add js from hooks |
698 | - $parameters=array(); |
|
698 | + $parameters = array(); |
|
699 | 699 | $parameters['caller'] = 'search2'; |
700 | 700 | $hookmanager->executeHooks('completeJSProductDisplay', $parameters); |
701 | 701 | print $hookmanager->resPrint; |
@@ -733,7 +733,7 @@ discard block |
||
733 | 733 | } |
734 | 734 | else { |
735 | 735 | $("#prodiv<?php echo $MAXPRODUCT - 2; ?> span").show(); |
736 | - var search_start_less = Math.max(0, parseInt(search_start) - parseInt(<?php echo $MAXPRODUCT - 2;?>)); |
|
736 | + var search_start_less = Math.max(0, parseInt(search_start) - parseInt(<?php echo $MAXPRODUCT - 2; ?>)); |
|
737 | 737 | $("#search_start_less").val(search_start_less); |
738 | 738 | } |
739 | 739 | if (nbsearchresults != <?php echo $MAXPRODUCT - 2; ?>) { |
@@ -741,7 +741,7 @@ discard block |
||
741 | 741 | } |
742 | 742 | else { |
743 | 743 | $("#prodiv<?php echo $MAXPRODUCT - 1; ?> span").show(); |
744 | - var search_start_more = parseInt(search_start) + parseInt(<?php echo $MAXPRODUCT - 2;?>); |
|
744 | + var search_start_more = parseInt(search_start) + parseInt(<?php echo $MAXPRODUCT - 2; ?>); |
|
745 | 745 | $("#search_start_more").val(search_start_more); |
746 | 746 | } |
747 | 747 | }); |
@@ -838,14 +838,14 @@ discard block |
||
838 | 838 | |
839 | 839 | function TakeposPrintingOrder(){ |
840 | 840 | console.log("TakeposPrintingOrder"); |
841 | - $("#poslines").load("invoice.php?action=order&token=<?php echo newToken();?>&place="+place, function() { |
|
841 | + $("#poslines").load("invoice.php?action=order&token=<?php echo newToken(); ?>&place="+place, function() { |
|
842 | 842 | //$('#poslines').scrollTop($('#poslines')[0].scrollHeight); |
843 | 843 | }); |
844 | 844 | } |
845 | 845 | |
846 | 846 | function TakeposPrintingTemp(){ |
847 | 847 | console.log("TakeposPrintingTemp"); |
848 | - $("#poslines").load("invoice.php?action=temp&token=<?php echo newToken();?>&place="+place, function() { |
|
848 | + $("#poslines").load("invoice.php?action=temp&token=<?php echo newToken(); ?>&place="+place, function() { |
|
849 | 849 | //$('#poslines').scrollTop($('#poslines')[0].scrollHeight); |
850 | 850 | }); |
851 | 851 | } |
@@ -867,7 +867,7 @@ discard block |
||
867 | 867 | } |
868 | 868 | |
869 | 869 | function DolibarrOpenDrawer() { |
870 | - console.log("DolibarrOpenDrawer call ajax url /takepos/ajax/ajax.php?action=opendrawer&token=<?php echo newToken();?>&term=<?php print urlencode($_SESSION["takeposterminal"]); ?>"); |
|
870 | + console.log("DolibarrOpenDrawer call ajax url /takepos/ajax/ajax.php?action=opendrawer&token=<?php echo newToken(); ?>&term=<?php print urlencode($_SESSION["takeposterminal"]); ?>"); |
|
871 | 871 | $.ajax({ |
872 | 872 | type: "GET", |
873 | 873 | data: { token: '<?php echo currentToken(); ?>' }, |
@@ -1204,8 +1204,8 @@ discard block |
||
1204 | 1204 | |
1205 | 1205 | // TakePOS setup check |
1206 | 1206 | if (isset($_SESSION["takeposterminal"]) && $_SESSION["takeposterminal"]) { |
1207 | - $sql = "SELECT code, libelle FROM " . MAIN_DB_PREFIX . "c_paiement"; |
|
1208 | - $sql .= " WHERE entity IN (" . getEntity('c_paiement') . ")"; |
|
1207 | + $sql = "SELECT code, libelle FROM ".MAIN_DB_PREFIX."c_paiement"; |
|
1208 | + $sql .= " WHERE entity IN (".getEntity('c_paiement').")"; |
|
1209 | 1209 | $sql .= " AND active = 1"; |
1210 | 1210 | $sql .= " ORDER BY libelle"; |
1211 | 1211 | |
@@ -1221,7 +1221,7 @@ discard block |
||
1221 | 1221 | $paycode = 'CHEQUE'; |
1222 | 1222 | } |
1223 | 1223 | |
1224 | - $constantforkey = "CASHDESK_ID_BANKACCOUNT_" . $paycode . $_SESSION["takeposterminal"]; |
|
1224 | + $constantforkey = "CASHDESK_ID_BANKACCOUNT_".$paycode.$_SESSION["takeposterminal"]; |
|
1225 | 1225 | //var_dump($constantforkey.' '.getDolGlobalInt($constantforkey)); |
1226 | 1226 | if (getDolGlobalInt($constantforkey) > 0) { |
1227 | 1227 | array_push($paiementsModes, $obj); |
@@ -1263,7 +1263,7 @@ discard block |
||
1263 | 1263 | $menus[$r++] = array('title'=>'<span class="far fa-building paddingrightonly"></span><div class="trunc">'.$langs->trans("Customer").'</div>', 'action'=>'Customer();'); |
1264 | 1264 | } |
1265 | 1265 | } |
1266 | -if (! getDolGlobalString('TAKEPOS_HIDE_HISTORY')) { |
|
1266 | +if (!getDolGlobalString('TAKEPOS_HIDE_HISTORY')) { |
|
1267 | 1267 | $menus[$r++] = array('title'=>'<span class="fa fa-history paddingrightonly"></span><div class="trunc">'.$langs->trans("History").'</div>', 'action'=>'History();'); |
1268 | 1268 | } |
1269 | 1269 | $menus[$r++] = array('title'=>'<span class="fa fa-cube paddingrightonly"></span><div class="trunc">'.$langs->trans("FreeZone").'</div>', 'action'=>'FreeZone();'); |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | } |
200 | 200 | |
201 | 201 | // We check if we're allowed to add this bom |
202 | - $TParentBom=array(); |
|
202 | + $TParentBom = array(); |
|
203 | 203 | $object->getParentBomTreeRecursive($TParentBom); |
204 | 204 | if ($bom_child_id > 0 && !empty($TParentBom) && in_array($bom_child_id, $TParentBom)) { |
205 | 205 | $n_child = new BOM($db); |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | $bomline->fetch($lineid); |
273 | 273 | |
274 | 274 | $fk_default_workstation = $bomline->fk_default_workstation; |
275 | - if (isModEnabled('workstation') && GETPOSTISSET('idworkstations')) { |
|
275 | + if (isModEnabled('workstation') && GETPOSTISSET('idworkstations')) { |
|
276 | 276 | $fk_default_workstation = GETPOSTINT('idworkstations'); |
277 | 277 | } |
278 | 278 | |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | |
307 | 307 | |
308 | 308 | $title = $langs->trans('BOM'); |
309 | -$help_url ='EN:Module_BOM'; |
|
309 | +$help_url = 'EN:Module_BOM'; |
|
310 | 310 | llxHeader('', $title, $help_url); |
311 | 311 | |
312 | 312 | // Part to create |
@@ -585,17 +585,17 @@ discard block |
||
585 | 585 | |
586 | 586 | if (!empty($object->table_element_line)) { |
587 | 587 | // Products |
588 | - $res = $object->fetchLinesbytypeproduct(0); // Load all lines products into ->lines |
|
588 | + $res = $object->fetchLinesbytypeproduct(0); // Load all lines products into ->lines |
|
589 | 589 | $object->calculateCosts(); |
590 | 590 | |
591 | 591 | print ($res == 0 && $object->status >= $object::STATUS_VALIDATED) ? '' : load_fiche_titre($langs->trans('BOMProductsList'), '', 'product'); |
592 | 592 | |
593 | - print ' <form name="addproduct" id="listbomproducts" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (($action != 'editline') ? '' : '') . '" method="POST"> |
|
594 | - <input type="hidden" name="token" value="' . newToken() . '"> |
|
595 | - <input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline') . '"> |
|
593 | + print ' <form name="addproduct" id="listbomproducts" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '' : '').'" method="POST"> |
|
594 | + <input type="hidden" name="token" value="' . newToken().'"> |
|
595 | + <input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'"> |
|
596 | 596 | <input type="hidden" name="mode" value=""> |
597 | 597 | <input type="hidden" name="page_y" value=""> |
598 | - <input type="hidden" name="id" value="' . $object->id . '"> |
|
598 | + <input type="hidden" name="id" value="' . $object->id.'"> |
|
599 | 599 | '; |
600 | 600 | |
601 | 601 | if (!empty($conf->use_javascript_ajax) && $object->status == 0) { |
@@ -637,21 +637,21 @@ discard block |
||
637 | 637 | |
638 | 638 | // Services |
639 | 639 | $filtertype = 1; |
640 | - $res = $object->fetchLinesbytypeproduct(1); // Load all lines services into ->lines |
|
640 | + $res = $object->fetchLinesbytypeproduct(1); // Load all lines services into ->lines |
|
641 | 641 | $object->calculateCosts(); |
642 | 642 | |
643 | 643 | print ($res == 0 && $object->status >= $object::STATUS_VALIDATED) ? '' : load_fiche_titre($langs->trans('BOMServicesList'), '', 'service'); |
644 | 644 | |
645 | - print ' <form name="addservice" id="listbomservices" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (($action != 'editline') ? '' : '') . '" method="POST"> |
|
646 | - <input type="hidden" name="token" value="' . newToken() . '"> |
|
647 | - <input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline') . '"> |
|
645 | + print ' <form name="addservice" id="listbomservices" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '' : '').'" method="POST"> |
|
646 | + <input type="hidden" name="token" value="' . newToken().'"> |
|
647 | + <input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'"> |
|
648 | 648 | <input type="hidden" name="mode" value=""> |
649 | - <input type="hidden" name="page_y" value=""> <input type="hidden" name="id" value="' . $object->id . '"> |
|
649 | + <input type="hidden" name="page_y" value=""> <input type="hidden" name="id" value="' . $object->id.'"> |
|
650 | 650 | '; |
651 | 651 | |
652 | 652 | if (!empty($conf->use_javascript_ajax) && $object->status == 0) { |
653 | 653 | $tagidfortablednd = 'tablelinesservice'; |
654 | - include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php'; |
|
654 | + include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; |
|
655 | 655 | } |
656 | 656 | |
657 | 657 | print '<div class="div-table-responsive-no-min">'; |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | $also_cancel_consumed_and_produced_lines = (GETPOST('alsoCancelConsumedAndProducedLines', 'alpha') ? 1 : 0); |
134 | 134 | $result = $object->cancel($user, 0, $also_cancel_consumed_and_produced_lines); |
135 | 135 | if ($result > 0) { |
136 | - header("Location: " . dol_buildpath('/mrp/mo_card.php?id=' . $object->id, 1)); |
|
136 | + header("Location: ".dol_buildpath('/mrp/mo_card.php?id='.$object->id, 1)); |
|
137 | 137 | exit; |
138 | 138 | } else { |
139 | 139 | $action = ''; |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | $also_cancel_consumed_and_produced_lines = (GETPOST('alsoCancelConsumedAndProducedLines', 'alpha') ? 1 : 0); |
144 | 144 | $result = $object->delete($user, 0, $also_cancel_consumed_and_produced_lines); |
145 | 145 | if ($result > 0) { |
146 | - header("Location: " . $backurlforlist); |
|
146 | + header("Location: ".$backurlforlist); |
|
147 | 147 | exit; |
148 | 148 | } else { |
149 | 149 | $action = ''; |
@@ -603,7 +603,7 @@ discard block |
||
603 | 603 | 'value' => !getDolGlobalString('MO_ALSO_CANCEL_CONSUMED_AND_PRODUCED_LINES_BY_DEFAULT') ? 0 : 1 |
604 | 604 | ), |
605 | 605 | ); |
606 | - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('CancelMo'), $langs->trans('ConfirmCancelMo'), 'confirm_cancel', $formquestion, 0, 1); |
|
606 | + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('CancelMo'), $langs->trans('ConfirmCancelMo'), 'confirm_cancel', $formquestion, 0, 1); |
|
607 | 607 | } |
608 | 608 | |
609 | 609 | // Call Hook formConfirm |
@@ -841,7 +841,7 @@ discard block |
||
841 | 841 | print '<td class="right">'.$langs->trans("Qty").'</td>'; |
842 | 842 | // Unit |
843 | 843 | if ($conf->global->PRODUCT_USE_UNITS) { |
844 | - print '<td class="right">' . $langs->trans("Unit") . '</td>'; |
|
844 | + print '<td class="right">'.$langs->trans("Unit").'</td>'; |
|
845 | 845 | } |
846 | 846 | // Cost price |
847 | 847 | if ($permissiontoupdatecost && getDolGlobalString('MRP_SHOW_COST_FOR_CONSUMPTION')) { |
@@ -958,7 +958,7 @@ discard block |
||
958 | 958 | |
959 | 959 | // Lines to consume |
960 | 960 | |
961 | - $bomcostupdated = 0; // We will recalculate the unitary cost to produce a product using the real "products to consume into MO" |
|
961 | + $bomcostupdated = 0; // We will recalculate the unitary cost to produce a product using the real "products to consume into MO" |
|
962 | 962 | |
963 | 963 | if (!empty($object->lines)) { |
964 | 964 | $nblinetoconsume = 0; |
@@ -989,8 +989,8 @@ discard block |
||
989 | 989 | $costprice = 0; |
990 | 990 | } |
991 | 991 | } |
992 | - $linecost = price2num(($line->qty * $costprice) / $object->qty, 'MT'); // price for line for all quantities |
|
993 | - $bomcostupdated += price2num(($line->qty * $costprice) / $object->qty, 'MU'); // same but with full accuracy |
|
992 | + $linecost = price2num(($line->qty * $costprice) / $object->qty, 'MT'); // price for line for all quantities |
|
993 | + $bomcostupdated += price2num(($line->qty * $costprice) / $object->qty, 'MU'); // same but with full accuracy |
|
994 | 994 | } |
995 | 995 | |
996 | 996 | $bomcostupdated = price2num($bomcostupdated, 'MU'); |
@@ -1010,23 +1010,23 @@ discard block |
||
1010 | 1010 | $alreadyconsumed += $line2['qty']; |
1011 | 1011 | } |
1012 | 1012 | } |
1013 | - $suffix = '_' . $line->id; |
|
1014 | - print '<!-- Line to dispatch ' . $suffix . ' -->' . "\n"; |
|
1013 | + $suffix = '_'.$line->id; |
|
1014 | + print '<!-- Line to dispatch '.$suffix.' -->'."\n"; |
|
1015 | 1015 | // hidden fields for js function |
1016 | - print '<input id="qty_ordered' . $suffix . '" type="hidden" value="' . $line->qty . '">'; |
|
1016 | + print '<input id="qty_ordered'.$suffix.'" type="hidden" value="'.$line->qty.'">'; |
|
1017 | 1017 | // Duration - Time spent |
1018 | - print '<input id="qty_dispatched' . $suffix . '" type="hidden" value="' . $alreadyconsumed . '">'; |
|
1018 | + print '<input id="qty_dispatched'.$suffix.'" type="hidden" value="'.$alreadyconsumed.'">'; |
|
1019 | 1019 | print '<tr>'; |
1020 | - print '<input name="lineid" type="hidden" value="' . $line->id . '">'; |
|
1020 | + print '<input name="lineid" type="hidden" value="'.$line->id.'">'; |
|
1021 | 1021 | |
1022 | 1022 | // Product |
1023 | - print '<td>' . $tmpproduct->getNomUrl(1); |
|
1024 | - print '<br><div class="opacitymedium small tdoverflowmax150" title="' . dol_escape_htmltag($tmpproduct->label) . '">' . $tmpproduct->label . '</span>'; |
|
1023 | + print '<td>'.$tmpproduct->getNomUrl(1); |
|
1024 | + print '<br><div class="opacitymedium small tdoverflowmax150" title="'.dol_escape_htmltag($tmpproduct->label).'">'.$tmpproduct->label.'</span>'; |
|
1025 | 1025 | print '</td>'; |
1026 | 1026 | |
1027 | 1027 | // Qty |
1028 | 1028 | print '<td class="right nowraponall">'; |
1029 | - print '<input class="width40" name="qty_lineProduce" value="'. $line->qty.'">'; |
|
1029 | + print '<input class="width40" name="qty_lineProduce" value="'.$line->qty.'">'; |
|
1030 | 1030 | print '</td>'; |
1031 | 1031 | // Unit |
1032 | 1032 | if ($conf->global->PRODUCT_USE_UNITS) { |
@@ -1036,7 +1036,7 @@ discard block |
||
1036 | 1036 | } |
1037 | 1037 | // Qty consumed |
1038 | 1038 | print '<td class="right">'; |
1039 | - print ' ' . price2num($alreadyconsumed, 'MS'); |
|
1039 | + print ' '.price2num($alreadyconsumed, 'MS'); |
|
1040 | 1040 | print '</td>'; |
1041 | 1041 | // Entrepot |
1042 | 1042 | print '<td class="right">'; |
@@ -1047,7 +1047,7 @@ discard block |
||
1047 | 1047 | if ($tmpproduct->stock_reel < ($line->qty - $alreadyconsumed)) { |
1048 | 1048 | print img_warning($langs->trans('StockTooLow')).' '; |
1049 | 1049 | } |
1050 | - print '<span class="left">'. $tmpproduct->stock_reel .' </span>'; |
|
1050 | + print '<span class="left">'.$tmpproduct->stock_reel.' </span>'; |
|
1051 | 1051 | } |
1052 | 1052 | print '</td>'; |
1053 | 1053 | |
@@ -1059,8 +1059,8 @@ discard block |
||
1059 | 1059 | |
1060 | 1060 | // Action delete line |
1061 | 1061 | print '<td colspan="2">'; |
1062 | - print '<input type="submit" class="button buttongen button-add small nominwidth" name="save" value="' . $langs->trans("Save") . '">'; |
|
1063 | - print '<input type="submit" class="button buttongen button-cancel small nominwidth" name="cancel" value="' . $langs->trans("Cancel") . '">'; |
|
1062 | + print '<input type="submit" class="button buttongen button-add small nominwidth" name="save" value="'.$langs->trans("Save").'">'; |
|
1063 | + print '<input type="submit" class="button buttongen button-cancel small nominwidth" name="cancel" value="'.$langs->trans("Cancel").'">'; |
|
1064 | 1064 | print '</td>'; |
1065 | 1065 | |
1066 | 1066 | // Action delete line |
@@ -1081,28 +1081,28 @@ discard block |
||
1081 | 1081 | } |
1082 | 1082 | } |
1083 | 1083 | } else { |
1084 | - $suffix = '_' . $line->id; |
|
1085 | - print '<!-- Line to dispatch ' . $suffix . ' -->' . "\n"; |
|
1084 | + $suffix = '_'.$line->id; |
|
1085 | + print '<!-- Line to dispatch '.$suffix.' -->'."\n"; |
|
1086 | 1086 | // hidden fields for js function |
1087 | - print '<input id="qty_ordered' . $suffix . '" type="hidden" value="' . $line->qty . '">'; |
|
1088 | - print '<input id="qty_dispatched' . $suffix . '" type="hidden" value="' . $alreadyconsumed . '">'; |
|
1087 | + print '<input id="qty_ordered'.$suffix.'" type="hidden" value="'.$line->qty.'">'; |
|
1088 | + print '<input id="qty_dispatched'.$suffix.'" type="hidden" value="'.$alreadyconsumed.'">'; |
|
1089 | 1089 | |
1090 | - print '<tr data-line-id="' . $line->id . '">'; |
|
1090 | + print '<tr data-line-id="'.$line->id.'">'; |
|
1091 | 1091 | // Product |
1092 | - print '<td>' . $tmpproduct->getNomUrl(1); |
|
1093 | - print '<br><div class="opacitymedium small tdoverflowmax150" title="' . dol_escape_htmltag($tmpproduct->label) . '">' . $tmpproduct->label . '</div>'; |
|
1092 | + print '<td>'.$tmpproduct->getNomUrl(1); |
|
1093 | + print '<br><div class="opacitymedium small tdoverflowmax150" title="'.dol_escape_htmltag($tmpproduct->label).'">'.$tmpproduct->label.'</div>'; |
|
1094 | 1094 | print '</td>'; |
1095 | 1095 | // Qty |
1096 | 1096 | print '<td class="right nowraponall">'; |
1097 | 1097 | $help = ''; |
1098 | 1098 | $picto = 'help'; |
1099 | 1099 | if ($line->qty_frozen) { |
1100 | - $help = ($help ? '<br>' : '') . '<strong>' . $langs->trans("QuantityFrozen") . '</strong>: ' . yn(1) . ' (' . $langs->trans("QuantityConsumedInvariable") . ')'; |
|
1101 | - print $form->textwithpicto('', $help, -1, 'lock') . ' '; |
|
1100 | + $help = ($help ? '<br>' : '').'<strong>'.$langs->trans("QuantityFrozen").'</strong>: '.yn(1).' ('.$langs->trans("QuantityConsumedInvariable").')'; |
|
1101 | + print $form->textwithpicto('', $help, -1, 'lock').' '; |
|
1102 | 1102 | } |
1103 | 1103 | if ($line->disable_stock_change) { |
1104 | - $help = ($help ? '<br>' : '') . '<strong>' . $langs->trans("DisableStockChange") . '</strong>: ' . yn(1) . ' (' . (($tmpproduct->type == Product::TYPE_SERVICE && !getDolGlobalString('STOCK_SUPPORTS_SERVICES')) ? $langs->trans("NoStockChangeOnServices") : $langs->trans("DisableStockChangeHelp")) . ')'; |
|
1105 | - print $form->textwithpicto('', $help, -1, 'help') . ' '; |
|
1104 | + $help = ($help ? '<br>' : '').'<strong>'.$langs->trans("DisableStockChange").'</strong>: '.yn(1).' ('.(($tmpproduct->type == Product::TYPE_SERVICE && !getDolGlobalString('STOCK_SUPPORTS_SERVICES')) ? $langs->trans("NoStockChangeOnServices") : $langs->trans("DisableStockChangeHelp")).')'; |
|
1105 | + print $form->textwithpicto('', $help, -1, 'help').' '; |
|
1106 | 1106 | } |
1107 | 1107 | print price2num($line->qty, 'MS'); |
1108 | 1108 | print '</td>'; |
@@ -1123,9 +1123,9 @@ discard block |
||
1123 | 1123 | if ($alreadyconsumed) { |
1124 | 1124 | print '<script>'; |
1125 | 1125 | print 'jQuery(document).ready(function() { |
1126 | - jQuery("#expandtoproduce' . $line->id . '").click(function() { |
|
1127 | - console.log("Expand mrp_production line ' . $line->id . '"); |
|
1128 | - jQuery(".expanddetail' . $line->id . '").toggle();'; |
|
1126 | + jQuery("#expandtoproduce' . $line->id.'").click(function() { |
|
1127 | + console.log("Expand mrp_production line ' . $line->id.'"); |
|
1128 | + jQuery(".expanddetail' . $line->id.'").toggle();'; |
|
1129 | 1129 | if ($nblinetoconsume == $nblinetoconsumecursor) { // If it is the last line |
1130 | 1130 | print 'if (jQuery("#tablelines").hasClass("nobottom")) { jQuery("#tablelines").removeClass("nobottom"); } else { jQuery("#tablelines").addClass("nobottom"); }'; |
1131 | 1131 | } |
@@ -1134,9 +1134,9 @@ discard block |
||
1134 | 1134 | });'; |
1135 | 1135 | print '</script>'; |
1136 | 1136 | if (empty($conf->use_javascript_ajax)) { |
1137 | - print '<a href="' . $_SERVER["PHP_SELF"] . '?collapse=' . $collapse . ',' . $line->id . '">'; |
|
1137 | + print '<a href="'.$_SERVER["PHP_SELF"].'?collapse='.$collapse.','.$line->id.'">'; |
|
1138 | 1138 | } |
1139 | - print img_picto($langs->trans("ShowDetails"), "chevron-down", 'id="expandtoproduce' . $line->id . '"'); |
|
1139 | + print img_picto($langs->trans("ShowDetails"), "chevron-down", 'id="expandtoproduce'.$line->id.'"'); |
|
1140 | 1140 | if (empty($conf->use_javascript_ajax)) { |
1141 | 1141 | print '</a>'; |
1142 | 1142 | } |
@@ -1145,12 +1145,12 @@ discard block |
||
1145 | 1145 | print '<script>jQuery("#tablelines").removeClass("nobottom");</script>'; |
1146 | 1146 | } |
1147 | 1147 | } |
1148 | - print ' ' . price2num($alreadyconsumed, 'MS'); |
|
1148 | + print ' '.price2num($alreadyconsumed, 'MS'); |
|
1149 | 1149 | print '</td>'; |
1150 | 1150 | // Warehouse and/or workstation |
1151 | 1151 | print '<td>'; |
1152 | 1152 | if (getDolGlobalString('STOCK_CONSUMPTION_FROM_MANUFACTURING_WAREHOUSE') && $tmpwarehouse->id > 0) { |
1153 | - print img_picto('', $tmpwarehouse->picto) . " " . $tmpwarehouse->label; |
|
1153 | + print img_picto('', $tmpwarehouse->picto)." ".$tmpwarehouse->label; |
|
1154 | 1154 | } |
1155 | 1155 | if (isModEnabled('workstation') && $line->fk_default_workstation > 0) { |
1156 | 1156 | $tmpworkstation = new Workstation($db); |
@@ -1163,7 +1163,7 @@ discard block |
||
1163 | 1163 | print '<td class="nowraponall right">'; |
1164 | 1164 | if (!getDolGlobalString('STOCK_SUPPORTS_SERVICES') && $tmpproduct->type != Product::TYPE_SERVICE) { |
1165 | 1165 | if (!$line->disable_stock_change && $tmpproduct->stock_reel < ($line->qty - $alreadyconsumed)) { |
1166 | - print img_warning($langs->trans('StockTooLow')) . ' '; |
|
1166 | + print img_warning($langs->trans('StockTooLow')).' '; |
|
1167 | 1167 | } |
1168 | 1168 | if (!getDolGlobalString('STOCK_CONSUMPTION_FROM_MANUFACTURING_WAREHOUSE') || empty($tmpwarehouse->id)) { |
1169 | 1169 | print price2num($tmpproduct->stock_reel, 'MS'); // Available |
@@ -1193,9 +1193,9 @@ discard block |
||
1193 | 1193 | |
1194 | 1194 | // Action Edit line |
1195 | 1195 | if ($object->status == Mo::STATUS_DRAFT) { |
1196 | - $href = $_SERVER["PHP_SELF"] . '?id=' . ((int) $object->id) . '&action=editline&token=' . newToken() . '&lineid=' . ((int) $line->id); |
|
1196 | + $href = $_SERVER["PHP_SELF"].'?id='.((int) $object->id).'&action=editline&token='.newToken().'&lineid='.((int) $line->id); |
|
1197 | 1197 | print '<td class="center">'; |
1198 | - print '<a class="reposition" href="' . $href . '">'; |
|
1198 | + print '<a class="reposition" href="'.$href.'">'; |
|
1199 | 1199 | print img_picto($langs->trans('TooltipEditAndRevertStockMovement'), 'edit'); |
1200 | 1200 | print '</a>'; |
1201 | 1201 | print '</td>'; |
@@ -1203,9 +1203,9 @@ discard block |
||
1203 | 1203 | |
1204 | 1204 | // Action delete line |
1205 | 1205 | if ($permissiontodelete) { |
1206 | - $href = $_SERVER["PHP_SELF"] . '?id=' . ((int) $object->id) . '&action=deleteline&token=' . newToken() . '&lineid=' . ((int) $line->id); |
|
1206 | + $href = $_SERVER["PHP_SELF"].'?id='.((int) $object->id).'&action=deleteline&token='.newToken().'&lineid='.((int) $line->id); |
|
1207 | 1207 | print '<td class="center">'; |
1208 | - print '<a class="reposition" href="' . $href . '">'; |
|
1208 | + print '<a class="reposition" href="'.$href.'">'; |
|
1209 | 1209 | print img_picto($langs->trans('TooltipDeleteAndRevertStockMovement'), 'delete'); |
1210 | 1210 | print '</a>'; |
1211 | 1211 | print '</td>'; |
@@ -1278,9 +1278,9 @@ discard block |
||
1278 | 1278 | |
1279 | 1279 | // Action Edit line |
1280 | 1280 | if ($object->status == Mo::STATUS_DRAFT) { |
1281 | - $href = $_SERVER["PHP_SELF"] . '?id=' . ((int) $object->id) . '&action=editline&token=' . newToken() . '&lineid=' . ((int) $line->id); |
|
1281 | + $href = $_SERVER["PHP_SELF"].'?id='.((int) $object->id).'&action=editline&token='.newToken().'&lineid='.((int) $line->id); |
|
1282 | 1282 | print '<td class="center">'; |
1283 | - print '<a class="reposition" href="' . $href . '">'; |
|
1283 | + print '<a class="reposition" href="'.$href.'">'; |
|
1284 | 1284 | print img_picto($langs->trans('TooltipEditAndRevertStockMovement'), 'edit'); |
1285 | 1285 | print '</a>'; |
1286 | 1286 | print '</td>'; |
@@ -1320,7 +1320,7 @@ discard block |
||
1320 | 1320 | print '<input type="hidden" name="product-'.$line->id.'-'.$i.'" value="'.$line->fk_product.'">'; |
1321 | 1321 | |
1322 | 1322 | // Qty |
1323 | - print '<td class="right"><input type="text" class="width50 right" id="qtytoconsume-' . $line->id . '-' . $i . '" name="qty-' . $line->id . '-' . $i . '" value="' . $preselected . '" ' . $disable . '></td>'; |
|
1323 | + print '<td class="right"><input type="text" class="width50 right" id="qtytoconsume-'.$line->id.'-'.$i.'" name="qty-'.$line->id.'-'.$i.'" value="'.$preselected.'" '.$disable.'></td>'; |
|
1324 | 1324 | |
1325 | 1325 | // Unit |
1326 | 1326 | if ($conf->global->PRODUCT_USE_UNITS) { |
@@ -1834,7 +1834,7 @@ discard block |
||
1834 | 1834 | |
1835 | 1835 | $.ajax({ |
1836 | 1836 | type: "POST", |
1837 | - url: "<?php echo DOL_URL_ROOT . '/mrp/ajax/interface.php'; ?>", |
|
1837 | + url: "<?php echo DOL_URL_ROOT.'/mrp/ajax/interface.php'; ?>", |
|
1838 | 1838 | data: { |
1839 | 1839 | action: "updateselectbatchbywarehouse", |
1840 | 1840 | permissiontoproduce: <?php echo $permissiontoproduce ?>, |
@@ -1895,7 +1895,7 @@ discard block |
||
1895 | 1895 | |
1896 | 1896 | $.ajax({ |
1897 | 1897 | type: "POST", |
1898 | - url: "<?php echo DOL_URL_ROOT . '/mrp/ajax/interface.php'; ?>", |
|
1898 | + url: "<?php echo DOL_URL_ROOT.'/mrp/ajax/interface.php'; ?>", |
|
1899 | 1899 | data: { |
1900 | 1900 | action: "updateselectwarehousebybatch", |
1901 | 1901 | permissiontoproduce: <?php echo $permissiontoproduce ?>, |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,), |
119 | 119 | 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>1010), |
120 | 120 | 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>2, 'position'=>1000, 'default'=>0, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Validated', '2'=>'InProgress', '3'=>'StatusMOProduced', '9'=>'Canceled')), |
121 | - 'fk_parent_line' => array('type'=>'integer:MoLine:mrp/class/mo.class.php', 'label'=>'ParentMo', 'enabled'=>1, 'visible'=>0, 'position'=>1020, 'default'=>0, 'notnull'=>0, 'index'=>1,'showoncombobox'=>0), |
|
121 | + 'fk_parent_line' => array('type'=>'integer:MoLine:mrp/class/mo.class.php', 'label'=>'ParentMo', 'enabled'=>1, 'visible'=>0, 'position'=>1020, 'default'=>0, 'notnull'=>0, 'index'=>1, 'showoncombobox'=>0), |
|
122 | 122 | ); |
123 | 123 | public $rowid; |
124 | 124 | public $entity; |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | } |
333 | 333 | |
334 | 334 | if (!$error) { |
335 | - $result = $this->createProduction($user, $notrigger); // Insert lines from BOM |
|
335 | + $result = $this->createProduction($user, $notrigger); // Insert lines from BOM |
|
336 | 336 | if ($result <= 0) { |
337 | 337 | $error++; |
338 | 338 | } |
@@ -805,7 +805,7 @@ discard block |
||
805 | 805 | $oldQty = $this->oldQty; |
806 | 806 | $newQty = $this->qty; |
807 | 807 | if ($newQty != $oldQty && !empty($this->oldQty)) { |
808 | - $sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "mrp_production WHERE fk_mo = " . (int) $this->id; |
|
808 | + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."mrp_production WHERE fk_mo = ".(int) $this->id; |
|
809 | 809 | $resql = $this->db->query($sql); |
810 | 810 | if ($resql) { |
811 | 811 | while ($obj = $this->db->fetch_object($resql)) { |
@@ -974,7 +974,7 @@ discard block |
||
974 | 974 | if (getDolGlobalString('MRP_MO_ADDON')) { |
975 | 975 | $mybool = false; |
976 | 976 | |
977 | - $file = getDolGlobalString('MRP_MO_ADDON') . ".php"; |
|
977 | + $file = getDolGlobalString('MRP_MO_ADDON').".php"; |
|
978 | 978 | $classname = $conf->global->MRP_MO_ADDON; |
979 | 979 | |
980 | 980 | // Include file with class |
@@ -1247,8 +1247,8 @@ discard block |
||
1247 | 1247 | return 1; |
1248 | 1248 | } |
1249 | 1249 | |
1250 | - require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; |
|
1251 | - require_once DOL_DOCUMENT_ROOT . '/product/stock/class/mouvementstock.class.php'; |
|
1250 | + require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
|
1251 | + require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; |
|
1252 | 1252 | $error = 0; |
1253 | 1253 | $langs->load('stocks'); |
1254 | 1254 | |
@@ -1370,13 +1370,13 @@ discard block |
||
1370 | 1370 | $datas['qty'] = '<br><b>'.$langs->trans('QtyToProduce').':</b> '.$this->qty; |
1371 | 1371 | } |
1372 | 1372 | if (!$nofetch && isset($this->fk_product)) { |
1373 | - require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; |
|
1373 | + require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
|
1374 | 1374 | $product = new Product($this->db); |
1375 | 1375 | $product->fetch($this->fk_product); |
1376 | 1376 | $datas['product'] = '<br><b>'.$langs->trans('Product').':</b> '.$product->getNomUrl(1, '', 0, -1, 1); |
1377 | 1377 | } |
1378 | 1378 | if (!$nofetch && isset($this->fk_warehouse)) { |
1379 | - require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php'; |
|
1379 | + require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; |
|
1380 | 1380 | $warehouse = new Entrepot($this->db); |
1381 | 1381 | $warehouse->fetch($this->fk_warehouse); |
1382 | 1382 | $datas['warehouse'] = '<br><b>'.$langs->trans('WarehouseForProduction').':</b> '.$warehouse->getNomUrl(1, '', 0, 1); |
@@ -1786,7 +1786,7 @@ discard block |
||
1786 | 1786 | $this->tpl['disable_stock_change'] = $line->disable_stock_change; |
1787 | 1787 | $this->tpl['efficiency'] = $line->efficiency; |
1788 | 1788 | |
1789 | - global $conf; // used into template |
|
1789 | + global $conf; // used into template |
|
1790 | 1790 | $res = include DOL_DOCUMENT_ROOT.'/mrp/tpl/originproductline.tpl.php'; |
1791 | 1791 | } |
1792 | 1792 | |
@@ -1817,9 +1817,9 @@ discard block |
||
1817 | 1817 | $error = 0; |
1818 | 1818 | |
1819 | 1819 | $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."mrp_mo as mo_child"; |
1820 | - $sql.= " WHERE fk_parent_line IN "; |
|
1821 | - $sql.= " (SELECT rowid FROM ".MAIN_DB_PREFIX."mrp_production as line_parent"; |
|
1822 | - $sql.= " WHERE fk_mo=".((int) $this->id).")"; |
|
1820 | + $sql .= " WHERE fk_parent_line IN "; |
|
1821 | + $sql .= " (SELECT rowid FROM ".MAIN_DB_PREFIX."mrp_production as line_parent"; |
|
1822 | + $sql .= " WHERE fk_mo=".((int) $this->id).")"; |
|
1823 | 1823 | |
1824 | 1824 | $resql = $this->db->query($sql); |
1825 | 1825 | |
@@ -1903,8 +1903,8 @@ discard block |
||
1903 | 1903 | $error = 0; |
1904 | 1904 | |
1905 | 1905 | $sql = "SELECT lineparent.fk_mo as id_moparent FROM ".MAIN_DB_PREFIX."mrp_mo as mo"; |
1906 | - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."mrp_production lineparent ON mo.fk_parent_line = lineparent.rowid"; |
|
1907 | - $sql.= " WHERE mo.rowid = ".((int) $this->id); |
|
1906 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."mrp_production lineparent ON mo.fk_parent_line = lineparent.rowid"; |
|
1907 | + $sql .= " WHERE mo.rowid = ".((int) $this->id); |
|
1908 | 1908 | |
1909 | 1909 | $resql = $this->db->query($sql); |
1910 | 1910 |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | $this->mode_reglement_id = 0; |
472 | 472 | } |
473 | 473 | $this->status = self::STATUS_DRAFT; |
474 | - $this->statut = self::STATUS_DRAFT; // deprecated |
|
474 | + $this->statut = self::STATUS_DRAFT; // deprecated |
|
475 | 475 | |
476 | 476 | if (!empty($this->multicurrency_code)) { |
477 | 477 | // Multicurrency (test on $this->multicurrency_tx because we should take the default rate of multicurrency_code only if not using original rate) |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | $this->mode_reglement_id = 0; |
575 | 575 | } |
576 | 576 | $this->status = self::STATUS_DRAFT; |
577 | - $this->statut = self::STATUS_DRAFT; // deprecated |
|
577 | + $this->statut = self::STATUS_DRAFT; // deprecated |
|
578 | 578 | |
579 | 579 | $this->linked_objects = $_facrec->linkedObjectsIds; |
580 | 580 | // We do not add link to template invoice or next invoice will be linked to all generated invoices |
@@ -818,8 +818,8 @@ discard block |
||
818 | 818 | |
819 | 819 | // Complete vat rate with code |
820 | 820 | $vatrate = $newinvoiceline->tva_tx; |
821 | - if ($newinvoiceline->vat_src_code && ! preg_match('/\(.*\)/', $vatrate)) { |
|
822 | - $vatrate.=' ('.$newinvoiceline->vat_src_code.')'; |
|
821 | + if ($newinvoiceline->vat_src_code && !preg_match('/\(.*\)/', $vatrate)) { |
|
822 | + $vatrate .= ' ('.$newinvoiceline->vat_src_code.')'; |
|
823 | 823 | } |
824 | 824 | |
825 | 825 | $newinvoiceline->fk_parent_line = $fk_parent_line; |
@@ -1050,7 +1050,7 @@ discard block |
||
1050 | 1050 | $buyprice, |
1051 | 1051 | $_facrec->lines[$i]->label, |
1052 | 1052 | empty($_facrec->lines[$i]->array_options) ? null : $_facrec->lines[$i]->array_options, |
1053 | - 100, // situation percent is undefined on recurring invoice lines |
|
1053 | + 100, // situation percent is undefined on recurring invoice lines |
|
1054 | 1054 | '', |
1055 | 1055 | $_facrec->lines[$i]->fk_unit, |
1056 | 1056 | $_facrec->lines[$i]->multicurrency_subprice, |
@@ -1146,7 +1146,7 @@ discard block |
||
1146 | 1146 | |
1147 | 1147 | $facture->fk_facture_source = $this->fk_facture_source; |
1148 | 1148 | $facture->type = $this->type; |
1149 | - $facture->subtype = $this->subtype; |
|
1149 | + $facture->subtype = $this->subtype; |
|
1150 | 1150 | $facture->socid = $this->socid; |
1151 | 1151 | $facture->date = $this->date; |
1152 | 1152 | $facture->date_pointoftax = $this->date_pointoftax; |
@@ -1162,7 +1162,7 @@ discard block |
||
1162 | 1162 | |
1163 | 1163 | $facture->origin = $this->origin; |
1164 | 1164 | $facture->origin_id = $this->origin_id; |
1165 | - $facture->fk_account = $this->fk_account; |
|
1165 | + $facture->fk_account = $this->fk_account; |
|
1166 | 1166 | |
1167 | 1167 | $facture->lines = $this->lines; // Array of lines of invoice |
1168 | 1168 | $facture->situation_counter = $this->situation_counter; |
@@ -1633,7 +1633,7 @@ discard block |
||
1633 | 1633 | { |
1634 | 1634 | global $conf, $langs, $hookmanager, $action; |
1635 | 1635 | |
1636 | - if (! in_array($origin->element, array('propal', 'commande'))) { |
|
1636 | + if (!in_array($origin->element, array('propal', 'commande'))) { |
|
1637 | 1637 | $origin->error = 'ErrorCanOnlyAutomaticallyGenerateADepositFromProposalOrOrder'; |
1638 | 1638 | return null; |
1639 | 1639 | } |
@@ -1643,7 +1643,7 @@ discard block |
||
1643 | 1643 | return null; |
1644 | 1644 | } |
1645 | 1645 | |
1646 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; |
|
1646 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; |
|
1647 | 1647 | |
1648 | 1648 | if ($date > (dol_get_last_hour(dol_now('tzuserrel')) + (!getDolGlobalString('INVOICE_MAX_FUTURE_DELAY') ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { |
1649 | 1649 | $origin->error = 'ErrorDateIsInFuture'; |
@@ -1687,7 +1687,7 @@ discard block |
||
1687 | 1687 | $deposit->pos_source = $origin->pos_source; |
1688 | 1688 | $deposit->model_pdf = 'crabe'; |
1689 | 1689 | |
1690 | - $modelByTypeConfName = 'FACTURE_ADDON_PDF_' . $deposit->type; |
|
1690 | + $modelByTypeConfName = 'FACTURE_ADDON_PDF_'.$deposit->type; |
|
1691 | 1691 | |
1692 | 1692 | if (getDolGlobalString($modelByTypeConfName)) { |
1693 | 1693 | $deposit->model_pdf = getDolGlobalString($modelByTypeConfName); |
@@ -1742,10 +1742,10 @@ discard block |
||
1742 | 1742 | continue; |
1743 | 1743 | } |
1744 | 1744 | $TTotalByTva[$line->tva_tx] += $line->total_ttc; |
1745 | - $descriptions[$line->tva_tx] .= '<li>' . (!empty($line->product_ref) ? $line->product_ref . ' - ' : ''); |
|
1746 | - $descriptions[$line->tva_tx] .= (!empty($line->product_label) ? $line->product_label . ' - ' : ''); |
|
1747 | - $descriptions[$line->tva_tx] .= $langs->trans('Qty') . ' : ' . $line->qty; |
|
1748 | - $descriptions[$line->tva_tx] .= ' - ' . $langs->trans('TotalHT') . ' : ' . price($line->total_ht) . '</li>'; |
|
1745 | + $descriptions[$line->tva_tx] .= '<li>'.(!empty($line->product_ref) ? $line->product_ref.' - ' : ''); |
|
1746 | + $descriptions[$line->tva_tx] .= (!empty($line->product_label) ? $line->product_label.' - ' : ''); |
|
1747 | + $descriptions[$line->tva_tx] .= $langs->trans('Qty').' : '.$line->qty; |
|
1748 | + $descriptions[$line->tva_tx] .= ' - '.$langs->trans('TotalHT').' : '.price($line->total_ht).'</li>'; |
|
1749 | 1749 | } |
1750 | 1750 | |
1751 | 1751 | foreach ($TTotalByTva as $tva => &$total) { |
@@ -1769,10 +1769,10 @@ discard block |
||
1769 | 1769 | $totalamount += $lines[$i]->total_ht; // Fixme : is it not for the customer ? Shouldn't we take total_ttc ? |
1770 | 1770 | $tva_tx = $lines[$i]->tva_tx; |
1771 | 1771 | $amountdeposit[$tva_tx] += ($lines[$i]->total_ht * $origin->deposit_percent) / 100; |
1772 | - $descriptions[$tva_tx] .= '<li>' . (!empty($lines[$i]->product_ref) ? $lines[$i]->product_ref . ' - ' : ''); |
|
1773 | - $descriptions[$tva_tx] .= (!empty($lines[$i]->product_label) ? $lines[$i]->product_label . ' - ' : ''); |
|
1774 | - $descriptions[$tva_tx] .= $langs->trans('Qty') . ' : ' . $lines[$i]->qty; |
|
1775 | - $descriptions[$tva_tx] .= ' - ' . $langs->trans('TotalHT') . ' : ' . price($lines[$i]->total_ht) . '</li>'; |
|
1772 | + $descriptions[$tva_tx] .= '<li>'.(!empty($lines[$i]->product_ref) ? $lines[$i]->product_ref.' - ' : ''); |
|
1773 | + $descriptions[$tva_tx] .= (!empty($lines[$i]->product_label) ? $lines[$i]->product_label.' - ' : ''); |
|
1774 | + $descriptions[$tva_tx] .= $langs->trans('Qty').' : '.$lines[$i]->qty; |
|
1775 | + $descriptions[$tva_tx] .= ' - '.$langs->trans('TotalHT').' : '.price($lines[$i]->total_ht).'</li>'; |
|
1776 | 1776 | } |
1777 | 1777 | |
1778 | 1778 | if ($totalamount == 0) { |
@@ -1787,11 +1787,11 @@ discard block |
||
1787 | 1787 | continue; |
1788 | 1788 | } |
1789 | 1789 | |
1790 | - $descline = '(DEPOSIT) ('. $origin->deposit_percent .'%) - '.$origin->ref; |
|
1790 | + $descline = '(DEPOSIT) ('.$origin->deposit_percent.'%) - '.$origin->ref; |
|
1791 | 1791 | |
1792 | 1792 | // Hidden conf |
1793 | 1793 | if (getDolGlobalString('INVOICE_DEPOSIT_VARIABLE_MODE_DETAIL_LINES_IN_DESCRIPTION') && !empty($descriptions[$tva])) { |
1794 | - $descline .= '<ul>' . $descriptions[$tva] . '</ul>'; |
|
1794 | + $descline .= '<ul>'.$descriptions[$tva].'</ul>'; |
|
1795 | 1795 | } |
1796 | 1796 | |
1797 | 1797 | $addlineResult = $deposit->addline( |
@@ -2164,9 +2164,9 @@ discard block |
||
2164 | 2164 | $this->id = $obj->rowid; |
2165 | 2165 | $this->entity = $obj->entity; |
2166 | 2166 | |
2167 | - $this->ref = $obj->ref; |
|
2168 | - $this->ref_client = $obj->ref_client; |
|
2169 | - $this->ref_customer = $obj->ref_client; |
|
2167 | + $this->ref = $obj->ref; |
|
2168 | + $this->ref_client = $obj->ref_client; |
|
2169 | + $this->ref_customer = $obj->ref_client; |
|
2170 | 2170 | $this->ref_ext = $obj->ref_ext; |
2171 | 2171 | $this->type = $obj->type; |
2172 | 2172 | $this->subtype = $obj->subtype; |
@@ -2192,7 +2192,7 @@ discard block |
||
2192 | 2192 | $this->fk_project = $obj->fk_project; |
2193 | 2193 | $this->project = null; // Clear if another value was already set by fetch_projet |
2194 | 2194 | |
2195 | - $this->statut = $obj->status; // deprecated |
|
2195 | + $this->statut = $obj->status; // deprecated |
|
2196 | 2196 | $this->status = $obj->status; |
2197 | 2197 | |
2198 | 2198 | $this->date_lim_reglement = $this->db->jdate($obj->dlr); |
@@ -2208,7 +2208,7 @@ discard block |
||
2208 | 2208 | $this->fk_fac_rec_source = $obj->fk_fac_rec_source; |
2209 | 2209 | $this->note = $obj->note_private; // deprecated |
2210 | 2210 | $this->note_private = $obj->note_private; |
2211 | - $this->note_public = $obj->note_public; |
|
2211 | + $this->note_public = $obj->note_public; |
|
2212 | 2212 | $this->user_creation_id = $obj->fk_user_author; |
2213 | 2213 | $this->user_validation_id = $obj->fk_user_valid; |
2214 | 2214 | $this->user_modification_id = $obj->fk_user_modif; |
@@ -2322,7 +2322,7 @@ discard block |
||
2322 | 2322 | $line->ref = $objp->product_ref; // Ref product |
2323 | 2323 | $line->product_ref = $objp->product_ref; // Ref product |
2324 | 2324 | $line->libelle = $objp->product_label; // deprecated |
2325 | - $line->product_label = $objp->product_label; // Label product |
|
2325 | + $line->product_label = $objp->product_label; // Label product |
|
2326 | 2326 | $line->product_barcode = $objp->product_barcode; // Barcode number product |
2327 | 2327 | $line->product_desc = $objp->product_desc; // Description product |
2328 | 2328 | $line->fk_product_type = $objp->fk_product_type; // Type of product |
@@ -2621,7 +2621,7 @@ discard block |
||
2621 | 2621 | $facligne->rang = 1; |
2622 | 2622 | $linecount = count($this->lines); |
2623 | 2623 | for ($ii = 1; $ii <= $linecount; $ii++) { |
2624 | - $this->updateRangOfLine($this->lines[$ii - 1]->id, $ii+1); |
|
2624 | + $this->updateRangOfLine($this->lines[$ii - 1]->id, $ii + 1); |
|
2625 | 2625 | } |
2626 | 2626 | } |
2627 | 2627 | |
@@ -3198,10 +3198,10 @@ discard block |
||
3198 | 3198 | if ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !$user->hasRight('facture', 'creer')) |
3199 | 3199 | || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !$user->hasRight('facture', 'invoice_advance', 'validate'))) { |
3200 | 3200 | $this->error = 'Permission denied'; |
3201 | - dol_syslog(get_class($this)."::validate ".$this->error.' MAIN_USE_ADVANCED_PERMS=' . getDolGlobalString('MAIN_USE_ADVANCED_PERMS'), LOG_ERR); |
|
3201 | + dol_syslog(get_class($this)."::validate ".$this->error.' MAIN_USE_ADVANCED_PERMS='.getDolGlobalString('MAIN_USE_ADVANCED_PERMS'), LOG_ERR); |
|
3202 | 3202 | return -1; |
3203 | 3203 | } |
3204 | - if ((preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) && // empty should not happened, but when it occurs, the test save life |
|
3204 | + if ((preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) && // empty should not happened, but when it occurs, the test save life |
|
3205 | 3205 | getDolGlobalString('FAC_FORCE_DATE_VALIDATION') // If option enabled, we force invoice date |
3206 | 3206 | ) { |
3207 | 3207 | $this->date = dol_now(); |
@@ -3555,7 +3555,7 @@ discard block |
||
3555 | 3555 | // Set new ref and define current status |
3556 | 3556 | if (!$error) { |
3557 | 3557 | $this->ref = $num; |
3558 | - $this->statut = self::STATUS_VALIDATED; // deprecated |
|
3558 | + $this->statut = self::STATUS_VALIDATED; // deprecated |
|
3559 | 3559 | $this->status = self::STATUS_VALIDATED; |
3560 | 3560 | $this->date_validation = $now; |
3561 | 3561 | $i = 0; |
@@ -3700,7 +3700,7 @@ discard block |
||
3700 | 3700 | |
3701 | 3701 | if ($error == 0) { |
3702 | 3702 | $old_statut = $this->status; |
3703 | - $this->statut = self::STATUS_DRAFT; // deprecated |
|
3703 | + $this->statut = self::STATUS_DRAFT; // deprecated |
|
3704 | 3704 | $this->status = self::STATUS_DRAFT; |
3705 | 3705 | |
3706 | 3706 | // Call trigger |
@@ -4031,7 +4031,7 @@ discard block |
||
4031 | 4031 | return -2; |
4032 | 4032 | } |
4033 | 4033 | } else { |
4034 | - $this->errors[]='status of invoice must be Draft to allow use of ->addline()'; |
|
4034 | + $this->errors[] = 'status of invoice must be Draft to allow use of ->addline()'; |
|
4035 | 4035 | dol_syslog(get_class($this)."::addline status of invoice must be Draft to allow use of ->addline()", LOG_ERR); |
4036 | 4036 | return -3; |
4037 | 4037 | } |
@@ -4597,7 +4597,7 @@ discard block |
||
4597 | 4597 | } |
4598 | 4598 | |
4599 | 4599 | if (!empty($addon)) { |
4600 | - dol_syslog("Call getNextNumRef with ".$addonConstName." = " . getDolGlobalString('FACTURE_ADDON').", thirdparty=".$soc->name.", type=".$soc->typent_code.", mode=".$mode, LOG_DEBUG); |
|
4600 | + dol_syslog("Call getNextNumRef with ".$addonConstName." = ".getDolGlobalString('FACTURE_ADDON').", thirdparty=".$soc->name.", type=".$soc->typent_code.", mode=".$mode, LOG_DEBUG); |
|
4601 | 4601 | |
4602 | 4602 | $mybool = false; |
4603 | 4603 | |
@@ -5666,14 +5666,14 @@ discard block |
||
5666 | 5666 | if (!empty($paymentmode) && $paymentmode != 'all') { |
5667 | 5667 | $sql .= ", ".MAIN_DB_PREFIX."c_paiement as cp"; |
5668 | 5668 | } |
5669 | - $sql .= " WHERE f.paye = 0"; // Only unpaid |
|
5670 | - $sql .= " AND f.fk_statut = ".self::STATUS_VALIDATED; // Only validated status |
|
5669 | + $sql .= " WHERE f.paye = 0"; // Only unpaid |
|
5670 | + $sql .= " AND f.fk_statut = ".self::STATUS_VALIDATED; // Only validated status |
|
5671 | 5671 | if ($datetouse == 'invoicedate') { |
5672 | 5672 | $sql .= " AND f.datef = '".$this->db->idate($tmpidate, 'gmt')."'"; |
5673 | 5673 | } else { |
5674 | 5674 | $sql .= " AND f.date_lim_reglement = '".$this->db->idate($tmpidate, 'gmt')."'"; |
5675 | 5675 | } |
5676 | - $sql .= " AND f.entity IN (".getEntity('facture', 0).")"; // One batch process only one company (no sharing) |
|
5676 | + $sql .= " AND f.entity IN (".getEntity('facture', 0).")"; // One batch process only one company (no sharing) |
|
5677 | 5677 | if (!empty($paymentmode) && $paymentmode != 'all') { |
5678 | 5678 | $sql .= " AND f.fk_mode_reglement = cp.id AND cp.code = '".$this->db->escape($paymentmode)."'"; |
5679 | 5679 | } |
@@ -5891,7 +5891,7 @@ discard block |
||
5891 | 5891 | $actioncomm->create($user); |
5892 | 5892 | } |
5893 | 5893 | |
5894 | - $this->db->commit(); // We always commit |
|
5894 | + $this->db->commit(); // We always commit |
|
5895 | 5895 | } |
5896 | 5896 | |
5897 | 5897 | if ($errormesg) { |
@@ -5933,7 +5933,7 @@ discard block |
||
5933 | 5933 | // get date of last validated invoices of same type |
5934 | 5934 | $sql = "SELECT datef"; |
5935 | 5935 | $sql .= " FROM ".MAIN_DB_PREFIX."facture"; |
5936 | - $sql .= " WHERE type = " . (int) $this->type ; |
|
5936 | + $sql .= " WHERE type = ".(int) $this->type; |
|
5937 | 5937 | $sql .= " AND date_valid IS NOT NULL"; |
5938 | 5938 | $sql .= " AND entity IN (".getEntity('invoice').")"; |
5939 | 5939 | $sql .= " ORDER BY datef DESC LIMIT 1"; |
@@ -6138,7 +6138,7 @@ discard block |
||
6138 | 6138 | $objp = $this->db->fetch_object($result); |
6139 | 6139 | |
6140 | 6140 | if (!$objp) { |
6141 | - $this->error = 'InvoiceLine with id '. $rowid .' not found sql='.$sql; |
|
6141 | + $this->error = 'InvoiceLine with id '.$rowid.' not found sql='.$sql; |
|
6142 | 6142 | return 0; |
6143 | 6143 | } |
6144 | 6144 |