diff --git a/dev/tools/codespell/codespell-lines-ignore.txt b/dev/tools/codespell/codespell-lines-ignore.txt index 94c67e08f754f..2c0fb95a96f80 100644 --- a/dev/tools/codespell/codespell-lines-ignore.txt +++ b/dev/tools/codespell/codespell-lines-ignore.txt @@ -178,6 +178,7 @@ if (empty($this->datea)) { if (in_array('01', $TWeek) && in_array('52', $TWeek) && $weekNb == '01') { print $form->selectDate(strtotime(date('Y-m-d', $object->datee)), 'end', '', '', 0, '', 1, 0); + print $form->selectDate(strtotime(date('Y-m-d', $object->datee)), 'end', 0, 0, 0, '', 1, 0); print $object->datee ? dol_print_date($object->datee, 'daytext') : ' '; print ''; print ''.$langs->trans("AddIn").''; diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php index 085d4daba123e..178a021e00c66 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -331,6 +331,7 @@ // Dolibarr uses a lot of internal deprecated stuff, not reporting 'PhanDeprecatedProperty', 'PhanDeprecatedFunction', + 'PhanCompatibleNegativeStringOffset', // Dolibarr has quite a few strange noop assignments like $abc=$abc; 'PhanPluginDuplicateExpressionAssignment', // Nulls are likely mostly false positives diff --git a/dev/tools/phan/config_extended.php b/dev/tools/phan/config_extended.php index a186b90bd25bd..65dcc8f73893f 100644 --- a/dev/tools/phan/config_extended.php +++ b/dev/tools/phan/config_extended.php @@ -326,6 +326,8 @@ // Add any issue types (such as 'PhanUndeclaredMethod') // here to inhibit them from being reported 'suppress_issue_types' => [ + 'PhanCompatibleNegativeStringOffset', // return false positive + 'PhanPluginWhitespaceTab', // Dolibarr used tabs 'PhanPluginCanUsePHP71Void', // Dolibarr is maintaining 7.0 compatibility 'PhanPluginShortArray', // Dolibarr uses array() @@ -335,6 +337,7 @@ 'PhanPluginCanUseReturnType', // Fixer - Report/Add return types in the function definition (function abc(string $var) (adds string) 'PhanPluginCanUseNullableParamType', // Fixer - Report/Add nullable parameter types in the function definition 'PhanPluginCanUseNullableReturnType', // Fixer - Report/Add nullable return types in the function definition + 'PhanPluginNonBoolBranch', // Not essential - 31240+ occurrences 'PhanPluginNumericalComparison', // Not essential - 19870+ occurrences 'PhanTypeMismatchArgument', // Not essential - 12300+ occurrences diff --git a/dev/tools/phan/config_fixer.php b/dev/tools/phan/config_fixer.php index 11daf743c090b..18e50834844df 100644 --- a/dev/tools/phan/config_fixer.php +++ b/dev/tools/phan/config_fixer.php @@ -5,6 +5,7 @@ //require_once __DIR__.'/plugins/DeprecatedModuleNameFixer.php'; //require_once __DIR__.'/plugins/PriceFormFixer.php'; //require_once __DIR__.'/plugins/UrlEncodeStringifyFixer.php'; +require_once __DIR__.'/plugins/SelectDateFixer.php'; /* Copyright (C) 2024 MDW */ @@ -176,6 +177,8 @@ // Add any issue types (such as 'PhanUndeclaredMethod') // here to inhibit them from being reported 'suppress_issue_types' => [ + 'PhanCompatibleNegativeStringOffset', // return false positive + 'PhanPluginWhitespaceTab', // Dolibarr used tabs 'PhanPluginCanUsePHP71Void', // Dolibarr is maintaining 7.0 compatibility 'PhanPluginShortArray', // Dolibarr uses array() diff --git a/dev/tools/phan/plugins/SelectDateFixer.php b/dev/tools/phan/plugins/SelectDateFixer.php new file mode 100644 index 0000000000000..c475d7b2b8192 --- /dev/null +++ b/dev/tools/phan/plugins/SelectDateFixer.php @@ -0,0 +1,175 @@ + + * + * For 'price()', replace $form parameter that is '' with 0. + */ + +declare(strict_types=1); + +use ast\flags; +use Microsoft\PhpParser\Node\Expression\CallExpression; +use Microsoft\PhpParser\Node\QualifiedName; +use Phan\AST\TolerantASTConverter\NodeUtils; +use Phan\CodeBase; +use Phan\IssueInstance; +use Phan\Library\FileCacheEntry; +use Phan\Plugin\Internal\IssueFixingPlugin\FileEdit; +use Phan\Plugin\Internal\IssueFixingPlugin\FileEditSet; +use Phan\Plugin\Internal\IssueFixingPlugin\IssueFixer; +use Microsoft\PhpParser\Node\Expression\ArgumentExpression; +use Microsoft\PhpParser\Node\DelimitedList\ArgumentExpressionList; +use Microsoft\PhpParser\Node\StringLiteral; +use Microsoft\PhpParser\Node\ReservedWord; +use Microsoft\PhpParser\Token; + +/** + * This is a prototype, there are various features it does not implement. + */ + +call_user_func(static function (): void { + /** + * @param $code_base @unused-param + * @return ?FileEditSet a representation of the edit to make to replace a call to a function alias with a call to the original function + */ + $fix = static function (CodeBase $code_base, FileCacheEntry $contents, IssueInstance $instance): ?FileEditSet { + + // Argument {INDEX} (${PARAMETER}) is {CODE} of type {TYPE}{DETAILS} but + // {FUNCTIONLIKE} takes {TYPE}{DETAILS} defined at {FILE}:{LINE} (the inferred real argument type has nothing in common with the parameter's phpdoc type) + + //htdocs\supplier_proposal\card.php:1705 PhanTypeMismatchArgumentProbablyReal Argument 3 ($h) is '' of type '' but \Form::selectDate() takes int (no real type) defined at htdocs\core\class\html.form.class.php:6799 (the inferred real argument type has nothing in common with the parameter's phpdoc type) + //htdocs\supplier_proposal\card.php:1705 PhanTypeMismatchArgumentProbablyReal Argument 4 ($m) is '' of type '' but \Form::selectDate() takes int (no real type) defined at htdocs\core\class\html.form.class.php:6799 (the inferred real argument type has nothing in common with the parameter's phpdoc type) + + $argument_index = (string) $instance->getTemplateParameters()[0]; + $argument_name = (string) $instance->getTemplateParameters()[1]; + $argument_code = (string) $instance->getTemplateParameters()[2]; + $argument_type = (string) $instance->getTemplateParameters()[3]; + $details = (string) $instance->getTemplateParameters()[4]; + $functionlike = (string) $instance->getTemplateParameters()[5]; + + $expected_functionlike = "\\Form::selectDate()"; + $expected_name = "selectDate"; + if ($functionlike !== $expected_functionlike) { + print "$functionlike != '$expected_functionlike'".PHP_EOL; + return null; + } + + // Check if we fix any of this + if ( + ($argument_name === 'h' && $argument_code === "''") + || ($argument_name === 'm' && $argument_code === "''") + || ($argument_name === 'empty' && $argument_code === "''") + ) { + $replacement = '0'; + $argIdx = ($argument_index - 1) * 2; + $expectedStringValue = ""; + } else { + print "ARG$argument_index:$argument_name CODE:$argument_code".PHP_EOL; + return null; + } + + // At this point we established that the notification + // matches some we fix. + + $line = $instance->getLine(); + + $edits = []; + foreach ($contents->getNodesAtLine($line) as $node) { + if (!$node instanceof ArgumentExpressionList) { + continue; + } + $arguments = $node->children; + if (count($arguments) <= $argIdx) { + // print "Arg Count is ".count($arguments)." - Skip $instance".PHP_EOL; + continue; + } + + $is_actual_call = $node->parent instanceof CallExpression; + if (!$is_actual_call) { + // print "Not actual call - Skip $instance".PHP_EOL; + continue; + } + + print "Actual call - $instance".PHP_EOL; + $callable = $node->parent; + + $callableExpression = $callable->callableExpression; + + if ($callableExpression instanceof Microsoft\PhpParser\Node\QualifiedName) { + $actual_name = $callableExpression->getResolvedName(); + } elseif ($callableExpression instanceof Microsoft\PhpParser\Node\Expression\MemberAccessExpression) { + $memberNameToken = $callableExpression->memberName; + $actual_name = (new NodeUtils($contents->getContents()))->tokenToString($memberNameToken); + } else { + print "Callable expression is ".get_class($callableExpression)."- Skip $instance".PHP_EOL; + continue; + } + + if ((string) $actual_name !== (string) $expected_name) { + // print "Name unexpected '$actual_name'!='$expected_name' - Skip $instance".PHP_EOL; + continue; + } + + foreach ($arguments as $i => $argument) { + if ($argument instanceof ArgumentExpression) { + print "Type$i: ".get_class($argument->expression).PHP_EOL; + } + } + + $stringValue = null; + + + $arg = $arguments[$argIdx]; + + if ( + $arg instanceof ArgumentExpression + && $arg->expression instanceof StringLiteral + ) { + // Get the string value of the StringLiteral + $stringValue = $arg->expression->getStringContentsText(); + print "String is '$stringValue'".PHP_EOL; + } elseif ($arg instanceof ArgumentExpression && $arg->expression instanceof ReservedWord) { + $child = $arg->expression->children; + if (!$child instanceof Token) { + continue; + } + $token_str = (new NodeUtils($contents->getContents()))->tokenToString($child); + print "$token_str KIND:".($child->kind ?? 'no kind')." ".get_class($child).PHP_EOL; + + if ($token_str !== 'null') { + continue; + } + + $stringValue = ''; // Fake empty + } else { + print "Expression is not string or null ".get_class($arg)."/".get_class($arg->expression)."- Skip $instance".PHP_EOL; + continue; + } + + if ($stringValue !== $expectedStringValue) { + print "Not replacing $argument_name which is '$stringValue'/".get_class($arg)."/".get_class($arg->expression)."- Skip $instance".PHP_EOL; + continue; + } + + print "Fixture elem on $line - $actual_name(...'$stringValue'...) - $instance".PHP_EOL; + + + + // Get the first argument (delimiter) + $argument_to_replace = $arg; + + $arg_start_pos = $argument_to_replace->getStartPosition(); + $arg_end_pos = $argument_to_replace->getEndPosition(); + + // Set edit instruction + $edits[] = new FileEdit($arg_start_pos, $arg_end_pos, $replacement); + } + if ($edits) { + return new FileEditSet($edits); + } + return null; + }; + IssueFixer::registerFixerClosure( + 'PhanTypeMismatchArgumentProbablyReal', + $fix + ); +}); diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 444cb44d10463..66838b8c2e274 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -374,7 +374,7 @@ print ''; print ''.$langs->trans("Docdate").''; print ''; - print $form->selectDate('', 'doc_date', '', '', '', "create_mvt", 1, 1); + print $form->selectDate('', 'doc_date', 0, 0, 0, "create_mvt", 1, 1); print ''; print ''; @@ -459,7 +459,7 @@ print ''; print ''; print ''; - print $form->selectDate($object->doc_date ? $object->doc_date : - 1, 'doc_date', '', '', '', "setdate"); + print $form->selectDate($object->doc_date ? $object->doc_date : - 1, 'doc_date', 0, 0, 0, "setdate"); print ''; print ''; } else { diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index a75d635847790..aaee4c47aa47b 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1118,7 +1118,7 @@ function initfieldrequired() { // Birth Date print "".$langs->trans("DateOfBirth")."\n"; - print img_picto('', 'object_calendar', 'class="pictofixedwidth"').$form->selectDate(($object->birth ? $object->birth : -1), 'birth', '', '', 1, 'formsoc'); + print img_picto('', 'object_calendar', 'class="pictofixedwidth"').$form->selectDate(($object->birth ? $object->birth : -1), 'birth', 0, 0, 1, 'formsoc'); print "\n"; // Public profil @@ -1365,7 +1365,7 @@ function initfieldrequired() { // Birth Date print "".$langs->trans("DateOfBirth")."\n"; - print img_picto('', 'object_calendar', 'class="pictofixedwidth"').$form->selectDate(($object->birth ? $object->birth : -1), 'birth', '', '', 1, 'formsoc'); + print img_picto('', 'object_calendar', 'class="pictofixedwidth"').$form->selectDate(($object->birth ? $object->birth : -1), 'birth', 0, 0, 1, 'formsoc'); print "\n"; // Default language diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index 512189bef85cf..3ace1b42d5850 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -996,7 +996,7 @@ $datefrom = dol_get_first_day(dol_print_date($datefrom, "%Y")); } } - print $form->selectDate($datefrom, '', '', '', '', "subscription", 1, 1); + print $form->selectDate($datefrom, '', 0, 0, 0, "subscription", 1, 1); print ""; // Date end subscription @@ -1013,7 +1013,7 @@ } } print ''.$langs->trans("DateEndSubscription").''; - print $form->selectDate($dateto, 'end', '', '', '', "subscription", 1, 0); + print $form->selectDate($dateto, 'end', 0, 0, 0, "subscription", 1, 0); print ""; if ($adht->subscription) { diff --git a/htdocs/admin/expensereport_rules.php b/htdocs/admin/expensereport_rules.php index b3f2262626498..abadd05099166 100644 --- a/htdocs/admin/expensereport_rules.php +++ b/htdocs/admin/expensereport_rules.php @@ -222,8 +222,8 @@ echo '' . $form->selectExpense('', 'fk_c_type_fees', 0, 1, 1) . ''; echo '' . $form->selectarray('code_expense_rules_type', $tab_rules_type, '', 0) . ''; - echo '' . $form->selectDate(strtotime(date('Y-m-01', dol_now())), 'start', '', '', 0, '', 1, 0) . ''; - echo '' . $form->selectDate(strtotime(date('Y-m-t', dol_now())), 'end', '', '', 0, '', 1, 0) . ''; + echo '' . $form->selectDate(strtotime(date('Y-m-01', dol_now())), 'start', 0, 0, 0, '', 1, 0) . ''; + echo '' . $form->selectDate(strtotime(date('Y-m-t', dol_now())), 'end', 0, 0, 0, '', 1, 0) . ''; echo ''; echo '' . $form->selectyesno('restrictive', 0, 1) . ''; echo ''; @@ -308,7 +308,7 @@ echo ''; if ($action == 'edit' && $object->id == $rule->id) { - print $form->selectDate(strtotime(date('Y-m-d', $object->dates)), 'start', '', '', 0, '', 1, 0); + print $form->selectDate(strtotime(date('Y-m-d', $object->dates)), 'start', 0, 0, 0, '', 1, 0); } else { echo dol_print_date($rule->dates, 'day'); } @@ -317,7 +317,7 @@ echo ''; if ($action == 'edit' && $object->id == $rule->id) { - print $form->selectDate(strtotime(date('Y-m-d', $object->datee)), 'end', '', '', 0, '', 1, 0); + print $form->selectDate(strtotime(date('Y-m-d', $object->datee)), 'end', 0, 0, 0, '', 1, 0); } else { echo dol_print_date($rule->datee, 'day'); } diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 6d6ac13c58dad..cb2001fc399d9 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1971,7 +1971,7 @@ // Date print ''.$langs->trans('DatePropal').''; print img_picto('', 'action', 'class="pictofixedwidth"'); - print $form->selectDate('', '', '', '', '', "addprop", 1, 1); + print $form->selectDate('', '', 0, 0, 0, "addprop", 1, 1); print ''; // Validaty duration @@ -2042,9 +2042,9 @@ $syear = date("Y", $tmpdte); $smonth = date("m", $tmpdte); $sday = date("d", $tmpdte); - print $form->selectDate($syear."-".$smonth."-".$sday, 'date_livraison', '', '', '', "addprop"); + print $form->selectDate($syear."-".$smonth."-".$sday, 'date_livraison', 0, 0, 0, "addprop"); } else { - print $form->selectDate(-1, 'date_livraison', '', '', '', "addprop", 1, 1); + print $form->selectDate(-1, 'date_livraison', 0, 0, 0, "addprop", 1, 1); } print ''; @@ -2582,7 +2582,7 @@ print ''; print ''; print ''; - print $form->selectDate($object->date, 're', '', '', 0, "editdate"); + print $form->selectDate($object->date, 're', 0, 0, 0, "editdate"); print ''; print ''; } else { @@ -2610,7 +2610,7 @@ print ''; print ''; print ''; - print $form->selectDate($object->fin_validite, 'ech', '', '', '', "editecheance"); + print $form->selectDate($object->fin_validite, 'ech', 0, 0, 0, "editecheance"); print ''; print ''; } else { diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 868a16ed304a6..5097273a83325 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2704,7 +2704,7 @@ public function closeProposal($user, $status, $note = '', $notrigger = 0) $resql = $this->db->query($sql); if ($resql) { // Status self::STATUS_REFUSED by default - $modelpdf = getDolGlobalString('PROPALE_ADDON_PDF_ODT_CLOSED') ? $conf->global->PROPALE_ADDON_PDF_ODT_CLOSED : $this->model_pdf; + $modelpdf = getDolGlobalString('PROPALE_ADDON_PDF_ODT_CLOSED', $this->model_pdf); $trigger_name = 'PROPAL_CLOSE_REFUSED'; // used later in call_trigger() if ($status == self::STATUS_SIGNED) { // Status self::STATUS_SIGNED @@ -2814,7 +2814,7 @@ public function classifyBilled(User $user, $notrigger = 0, $note = '') } if (!$error) { - $modelpdf = $conf->global->PROPALE_ADDON_PDF_ODT_CLOSED ? $conf->global->PROPALE_ADDON_PDF_ODT_CLOSED : $this->model_pdf; + $modelpdf = getDolGlobalString('PROPALE_ADDON_PDF_ODT_CLOSED', $this->model_pdf); if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) { // Define output language diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 9722ca53344dc..11b3f049599be 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1915,7 +1915,7 @@ // Date print ''.$langs->trans('Date').''; print img_picto('', 'action', 'class="pictofixedwidth"'); - print $form->selectDate('', 're', '', '', '', "crea_commande", 1, 1); // Always autofill date with current date + print $form->selectDate('', 're', 0, 0, 0, "crea_commande", 1, 1); // Always autofill date with current date print ''; // Date delivery planned @@ -2546,7 +2546,7 @@ print ''; print ''; print ''; - print $form->selectDate($object->date, 'order_', '', '', '', "setdate"); + print $form->selectDate($object->date, 'order_', 0, 0, 0, "setdate"); print ''; print ''; } else { @@ -2568,7 +2568,7 @@ print ''; print ''; print ''; - print $form->selectDate($object->delivery_date ? $object->delivery_date : -1, 'liv_', 1, 1, '', "setdate_livraison", 1, 0); + print $form->selectDate($object->delivery_date ? $object->delivery_date : -1, 'liv_', 1, 1, 0, "setdate_livraison", 1, 0); print ''; print ''; } else { diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index b84de3413f5f4..54ba84705cb1f 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -1413,7 +1413,7 @@ print $langs->trans('DateInvoice'); print ''; print ''; - print $form->selectDate('', '', '', '', '', '', 1, 1); + print $form->selectDate('', '', 0, 0, 0, '', 1, 1); print ''; print ''; print ''; diff --git a/htdocs/compta/bank/line.php b/htdocs/compta/bank/line.php index 5b27d9ccd392a..c0cbdb0447e2d 100644 --- a/htdocs/compta/bank/line.php +++ b/htdocs/compta/bank/line.php @@ -546,7 +546,7 @@ print ''.$langs->trans("DateOperation").''; if ($user->hasRight('banque', 'modifier') || $user->hasRight('banque', 'consolidate')) { print ''; - print $form->selectDate($db->jdate($objp->do), 'dateo', '', '', '', 'update', 1, 0, $objp->rappro); + print $form->selectDate($db->jdate($objp->do), 'dateo', 0, 0, 0, 'update', 1, 0, $objp->rappro); if (!$objp->rappro) { print '   '; print ''; @@ -566,7 +566,7 @@ print "".$langs->trans("DateValue").""; if ($user->hasRight('banque', 'modifier') || $user->hasRight('banque', 'consolidate')) { print ''; - print $form->selectDate($db->jdate($objp->dv), 'datev', '', '', '', 'update', 1, 0, $objp->rappro); + print $form->selectDate($db->jdate($objp->dv), 'datev', 0, 0, 0, 'update', 1, 0, $objp->rappro); if (!$objp->rappro) { print '   '; print ''; diff --git a/htdocs/compta/bank/transfer.php b/htdocs/compta/bank/transfer.php index 71c620c0a5d81..1ecfab6693c40 100644 --- a/htdocs/compta/bank/transfer.php +++ b/htdocs/compta/bank/transfer.php @@ -335,7 +335,7 @@ function init_page(i) { // Date print ''; - print $form->selectDate((!empty($dateo[$i]) ? $dateo[$i] : ''), $i.'_', '', '', '', 'add'); + print $form->selectDate((!empty($dateo[$i]) ? $dateo[$i] : ''), $i.'_', 0, 0, 0, 'add'); print "\n"; // Description diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index b35350f2ee46a..ae720d6342370 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -415,13 +415,13 @@ function setPaymentType() // Date payment print ''; print $form->editfieldkey('DatePayment', 'datep', '', $object, 0, 'string', '', 1).''; - print $form->selectDate((empty($datep) ? -1 : $datep), "datep", '', '', '', 'add', 1, 1); + print $form->selectDate((empty($datep) ? -1 : $datep), "datep", 0, 0, 0, 'add', 1, 1); print ''; // Date value for bank print ''; print $form->editfieldkey('DateValue', 'datev', '', $object, 0).''; - print $form->selectDate((empty($datev) ? -1 : $datev), "datev", '', '', '', 'add', 1, 1); + print $form->selectDate((empty($datev) ? -1 : $datev), "datev", 0, 0, 0, 'add', 1, 1); print ''; // Label @@ -561,9 +561,9 @@ function setPaymentType() $formquestion = array( array('type' => 'text', 'name' => 'clone_label', 'label' => $langs->trans("Label"), 'value' => $langs->trans("CopyOf").' '.$object->label), - array('type' => 'date', 'tdclass'=>'fieldrequired', 'name' => 'clone_date_payment', 'label' => $langs->trans("DatePayment"), 'value' => -1), + array('type' => 'date', 'tdclass' => 'fieldrequired', 'name' => 'clone_date_payment', 'label' => $langs->trans("DatePayment"), 'value' => -1), array('type' => 'date', 'name' => 'clone_date_value', 'label' => $langs->trans("DateValue"), 'value' => -1), - array('type' => 'other', 'tdclass'=>'fieldrequired', 'name' => 'clone_accountid', 'label' => $langs->trans("BankAccount"), 'value' => $form->select_comptes($object->fk_account, "accountid", 0, '', 1, '', 0, 'minwidth200', 1)), + array('type' => 'other', 'tdclass' => 'fieldrequired', 'name' => 'clone_accountid', 'label' => $langs->trans("BankAccount"), 'value' => $form->select_comptes($object->fk_account, "accountid", 0, '', 1, '', 0, 'minwidth200', 1)), array('type' => 'text', 'name' => 'clone_amount', 'label' => $langs->trans("Amount"), 'value' => price($object->amount)), array('type' => 'select', 'name' => 'clone_sens', 'label' => $langs->trans("Sens").' '.$set_value_help, 'values' => $sensarray, 'default' => $object->sens), ); @@ -680,7 +680,7 @@ function setPaymentType() if (getDolGlobalString('ACCOUNTANCY_COMBO_FOR_AUX')) { print $formaccounting->formAccountingAccount($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->subledger_account, 'subledger_account', 1, 1, '', 1); } else { - print $form->editfieldval('SubledgerAccount', 'subledger_account', $object->subledger_account, $object, (!$alreadyaccounted && $permissiontoadd), 'string', '', 0, null, '', 1, 'lengthAccounta'); + print $form->editfieldval('SubledgerAccount', 'subledger_account', $object->subledger_account, $object, (!$alreadyaccounted && $permissiontoadd), 'string', '', null, null, '', 1, 'lengthAccounta'); } } else { print length_accounta($object->subledger_account); @@ -712,7 +712,7 @@ function setPaymentType() } // Other attributes - $parameters = array('socid'=>$object->id); + $parameters = array('socid' => $object->id); include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; print ''; diff --git a/htdocs/compta/deplacement/card.php b/htdocs/compta/deplacement/card.php index 785bc96edc5f5..bcc66ade96554 100644 --- a/htdocs/compta/deplacement/card.php +++ b/htdocs/compta/deplacement/card.php @@ -221,7 +221,7 @@ print ""; print ''.$langs->trans("Date").''; - print $form->selectDate($datec ? $datec : -1, '', '', '', '', 'add', 1, 1); + print $form->selectDate($datec ? $datec : -1, '', 0, 0, 0, 'add', 1, 1); print ''; // Km @@ -451,7 +451,7 @@ print ''.$langs->trans("Status").''.$object->getLibStatut(4).''; // Other attributes - $parameters = array('socid'=>$object->id); + $parameters = array('socid' => $object->id); include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; print "
"; diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index 954b0eb30777d..59318f1a753c2 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -1135,7 +1135,7 @@ // Date next run print "".$langs->trans('NextDateToExecution').""; $date_next_execution = isset($date_next_execution) ? $date_next_execution : (GETPOST('remonth') ? dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')) : -1); - print $form->selectDate($date_next_execution, '', 1, 1, '', "add", 1, 1); + print $form->selectDate($date_next_execution, '', 1, 1, 0, "add", 1, 1); print ""; // Number max of generation diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 9d277f17bc3ed..a0748e540ed11 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1820,7 +1820,7 @@ $date_end, 0, $lines[$i]->info_bits, - $lines[$i]->fk_remise_except, + isset($lines[$i]->fk_remise_except) ? $lines[$i]->fk_remise_except : null, 'HT', 0, $product_type, @@ -1829,7 +1829,7 @@ $object->origin, $lines[$i]->rowid, $fk_parent_line, - $lines[$i]->fk_fournprice, + isset($lines[$i]->fk_fournprice) ? $lines[$i]->fk_fournprice : null, $lines[$i]->pa_ht, $label, $array_options, @@ -3843,14 +3843,14 @@ function setRadioForTypeOfInvoice() { // Date invoice print ''.$langs->trans('DateInvoice').''; print img_picto('', 'action', 'class="pictofixedwidth"'); - print $form->selectDate($newdateinvoice ? $newdateinvoice : $dateinvoice, '', '', '', '', "add", 1, 1); + print $form->selectDate($newdateinvoice ? $newdateinvoice : $dateinvoice, '', 0, 0, 0, "add", 1, 1); print ''; // Date point of tax if (getDolGlobalString('INVOICE_POINTOFTAX_DATE')) { print ''.$langs->trans('DatePointOfTax').''; print img_picto('', 'action', 'class="pictofixedwidth"'); - print $form->selectDate($date_pointoftax ? $date_pointoftax : -1, 'date_pointoftax', '', '', '', "add", 1, 1); + print $form->selectDate($date_pointoftax ? $date_pointoftax : -1, 'date_pointoftax', 0, 0, 0, "add", 1, 1); print ''; } diff --git a/htdocs/compta/localtax/card.php b/htdocs/compta/localtax/card.php index a7a7c5f58980e..2797c3203c979 100644 --- a/htdocs/compta/localtax/card.php +++ b/htdocs/compta/localtax/card.php @@ -164,12 +164,12 @@ // Date of payment print ""; print ''.$langs->trans("DatePayment").''; - print $form->selectDate($datep, "datep", '', '', '', 'add', 1, 1); + print $form->selectDate($datep, "datep", 0, 0, 0, 'add', 1, 1); print ''; // End date of period print ''.$form->textwithpicto($langs->trans("PeriodEndDate"), $langs->trans("LastDayTaxIsRelatedTo")).''; - print $form->selectDate($datev, "datev", '', '', '', 'add', 1, 1); + print $form->selectDate($datev, "datev", 0, 0, 0, 'add', 1, 1); print ''; // Label diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 63938b6742c7d..f7a2026903d7f 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -90,7 +90,7 @@ * Actions */ -$parameters = array('socid'=>$socid); +$parameters = array('socid' => $socid); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -490,7 +490,7 @@ function callForResult(imgId) print ''.$langs->trans('Date').''; $datepayment = dol_mktime(12, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear')); $datepayment = ($datepayment == '' ? (!getDolGlobalString('MAIN_AUTOFILL_DATE') ? -1 : '') : $datepayment); - print $form->selectDate($datepayment, '', '', '', 0, "add_paiement", 1, 1, 0, '', '', $facture->date); + print $form->selectDate($datepayment, '', 0, 0, 0, "add_paiement", 1, 1, 0, '', '', $facture->date); print ''; // Payment mode diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index 097006e12e248..29cd19534e922 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -628,7 +628,7 @@ print '
'; print ''; print ''; - print $form->selectDate($object->date_bordereau, 'datecreate_', '', '', '', "setdate"); + print $form->selectDate($object->date_bordereau, 'datecreate_', 0, 0, 0, "setdate"); print ''; print '
'; } else { diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index 44a6cb3fe71b2..0094a541cf61b 100644 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -204,7 +204,7 @@ print ''.$langs->trans("Date").''; $datepaye = dol_mktime(12, 0, 0, GETPOSTINT("remonth"), GETPOSTINT("reday"), GETPOSTINT("reyear")); $datepayment = !getDolGlobalString('MAIN_AUTOFILL_DATE') ? (GETPOSTISSET("remonth") ? $datepaye : -1) : ''; - print $form->selectDate($datepayment, '', '', '', 0, "add_payment", 1, 1, 0, '', '', $charge->date_ech, '', 1, $langs->trans("DateOfSocialContribution")); + print $form->selectDate($datepayment, '', 0, 0, 0, "add_payment", 1, 1, 0, '', '', $charge->date_ech, '', 1, $langs->trans("DateOfSocialContribution")); print ""; print ''; diff --git a/htdocs/compta/paiement_vat.php b/htdocs/compta/paiement_vat.php index 20b574adac457..3b98f540a22d0 100644 --- a/htdocs/compta/paiement_vat.php +++ b/htdocs/compta/paiement_vat.php @@ -203,7 +203,7 @@ print ''.$langs->trans("Date").''; $datepaye = dol_mktime(12, 0, 0, GETPOSTINT("remonth"), GETPOSTINT("reday"), GETPOSTINT("reyear")); $datepayment = !getDolGlobalString('MAIN_AUTOFILL_DATE') ? (GETPOSTINT("remonth") ? $datepaye : -1) : 0; - print $form->selectDate($datepayment, '', '', '', '', "add_payment", 1, 1); + print $form->selectDate($datepayment, '', 0, 0, 0, "add_payment", 1, 1); print ""; print ''; diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index 24e37a3790461..691f6d903bf45 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -236,7 +236,7 @@ print '
'; print ''; print ''; - print $form->selectDate($object->date_trans ? $object->date_trans : -1, 'date_trans', 0, '', "setdate_trans"); + print $form->selectDate($object->date_trans ? $object->date_trans : -1, 'date_trans', 0, 0, "setdate_trans"); print ''; print '
'; } else { @@ -383,7 +383,7 @@ print ''; print ''.$langs->trans("NotifyTransmision").''; print ''.$langs->trans("TransData").''; - print $form->selectDate('', '', '', '', '', "userfile", 1, 1); + print $form->selectDate('', '', 0, 0, 0, "userfile", 1, 1); print ''; print ''.$langs->trans("TransMetod").''; print $form->selectarray("methode", $object->methodes_trans); @@ -403,7 +403,7 @@ print ''; print ''.$langs->trans("NotifyCredit").''; print ''.$langs->trans('CreditDate').''; - print $form->selectDate(-1, '', '', '', '', "infocredit", 1, 1); + print $form->selectDate(-1, '', 0, 0, 0, "infocredit", 1, 1); print ''; print ''; print '
'.$langs->trans("ThisWillAlsoAddPaymentOnInvoice").'
'; diff --git a/htdocs/compta/prelevement/line.php b/htdocs/compta/prelevement/line.php index de713bb137be5..85e9202001157 100644 --- a/htdocs/compta/prelevement/line.php +++ b/htdocs/compta/prelevement/line.php @@ -233,7 +233,7 @@ //Date print ''.$langs->trans("RefusedData").''; print ''; - print $form->selectDate('', '', '', '', '', "confirm_rejet"); + print $form->selectDate('', '', 0, 0, 0, "confirm_rejet"); print ''; //Reason diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php index 4766989824492..d3f0886eae94b 100644 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -223,7 +223,7 @@ $paiement = new PaymentVAT($db); $paiement->chid = $object->id; $paiement->datepaye = $datep; - $paiement->amounts = array($object->id=>$amount); // Tableau de montant + $paiement->amounts = array($object->id => $amount); // Tableau de montant $paiement->paiementtype = GETPOST("type_payment", 'alphanohtml'); $paiement->num_payment = GETPOST("num_payment", 'alphanohtml'); $paiement->note = GETPOST("note", 'restricthtml'); @@ -460,7 +460,7 @@ print ''.$langs->trans("Label").''; print ''.$form->textwithpicto($langs->trans("PeriodEndDate"), $langs->trans("LastDayTaxIsRelatedTo")).''; - print $form->selectDate((GETPOSTINT("datevmonth") ? $datev : -1), "datev", '', '', '', 'add', 1, 1); + print $form->selectDate((GETPOSTINT("datevmonth") ? $datev : -1), "datev", 0, 0, 0, 'add', 1, 1); print ''; // Amount @@ -474,7 +474,7 @@ print ''; print ''.$langs->trans("DatePayment").''; - print $form->selectDate($datep, "datep", '', '', '', 'add', 1, 1); + print $form->selectDate($datep, "datep", 0, 0, 0, 'add', 1, 1); print ''; // Type payment diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 613403d2f4400..98c46cc9f4710 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -380,7 +380,7 @@ $lines[$i]->pa_ht, $array_options, $lines[$i]->fk_unit, - $num+1 + $num + 1 ); if ($result < 0) { @@ -1245,7 +1245,7 @@ print ''.$langs->trans("Date").''; print img_picto('', 'action', 'class="pictofixedwidth"'); - print $form->selectDate($datecontrat, '', 0, 0, '', "contrat"); + print $form->selectDate($datecontrat, '', 0, 0, 0, "contrat"); print ""; // Project @@ -1352,7 +1352,7 @@ $formquestion = array( array('type' => 'date', 'name' => 'd_start', 'label' => $langs->trans("DateServiceActivate"), 'value' => dol_now()), array('type' => 'date', 'name' => 'd_end', 'label' => $langs->trans("DateEndPlanned"), /*'value' => $form->selectDate('', "end", $usehm, $usehm, '', "active", 1, 0),*/ '', ''), - array('type' => 'text', 'name' => 'comment', 'label' => $langs->trans("Comment"), 'value' => '', '', '', 'class' => 'minwidth300', 'moreattr'=>'autofocus') + array('type' => 'text', 'name' => 'comment', 'label' => $langs->trans("Comment"), 'value' => '', '', '', 'class' => 'minwidth300', 'moreattr' => 'autofocus') ); $formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id, $langs->trans("ActivateAllOnContract"), $langs->trans("ConfirmActivateAllOnContract"), "confirm_activate", $formquestion, 'yes', 1, 280); } elseif ($action == 'clone') { @@ -1730,7 +1730,7 @@ $line = new ContratLigne($db); $line->id = $objp->rowid; $line->fetch_optionals(); - print $line->showOptionals($extrafields, 'view', array('class'=>'oddeven', 'style'=>$moreparam, 'colspan'=>$colspan), '', '', 1); + print $line->showOptionals($extrafields, 'view', array('class' => 'oddeven', 'style' => $moreparam, 'colspan' => $colspan), '', '', 1); } } else { // Line in mode update @@ -1834,7 +1834,7 @@ $line = new ContratLigne($db); $line->id = $objp->rowid; $line->fetch_optionals(); - print $line->showOptionals($extrafields, 'edit', array('style'=>'class="oddeven"', 'colspan'=>$colspan), '', '', 1); + print $line->showOptionals($extrafields, 'edit', array('style' => 'class="oddeven"', 'colspan' => $colspan), '', '', 1); } } @@ -1992,10 +1992,10 @@ print ''; print ''.$langs->trans("DateServiceActivate").''; - print $form->selectDate($dateactstart, 'start', $usehm, $usehm, '', "active", 1, 0); + print $form->selectDate($dateactstart, 'start', $usehm, $usehm, 0, "active", 1, 0); print ''; print ''.$langs->trans("DateEndPlanned").''; - print $form->selectDate($dateactend, "end", $usehm, $usehm, '', "active", 1, 0); + print $form->selectDate($dateactend, "end", $usehm, $usehm, 0, "active", 1, 0); print ''; print ''; print ''; diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index af109bd436ea7..2a5dc287f2b27 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -434,10 +434,10 @@ setEventMessages($mesg, null, 'mesgs'); $moreparam = ''; - if (isset($paramname2) || isset($paramval2)) { + if (isset($paramval2)) { $moreparam .= '&'.($paramname2 ? $paramname2 : 'mid').'='.$paramval2; } - header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname ? $paramname : 'id').'='.(is_object($object) ? $object->id : '').$moreparam); + header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname ?? 'id').'='.(is_object($object) ? $object->id : '').$moreparam); exit; } else { $langs->load("other"); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 4a43106e8dc85..fb7f4a0ea4de4 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -111,7 +111,7 @@ public function __construct($db) */ public function editfieldkey($text, $htmlname, $preselected, $object, $perm, $typeofdata = 'string', $moreparam = '', $fieldrequired = 0, $notabletag = 0, $paramid = 'id', $help = '') { - global $conf, $langs; + global $langs; $ret = ''; @@ -199,13 +199,13 @@ public function editfieldkey($text, $htmlname, $preselected, $object, $perm, $ty * @param string $text Text of label (not used in this function) * @param string $htmlname Name of select field * @param string $value Value to show/edit - * @param object $object Object (that we want to show) + * @param CommonObject $object Object (that we want to show) * @param boolean $perm Permission to allow button to edit parameter * @param string $typeofdata Type of data ('string' by default, 'checkbox', 'email', 'phone', 'amount:99', 'numeric:99', * 'text' or 'textarea:rows:cols%', 'safehtmlstring', 'restricthtml', * 'datepicker' ('day' do not work, don't know why), 'dayhour' or 'datehourpicker', 'ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols', 'select;xkey:xval,ykey:yval,...') * @param string $editvalue When in edit mode, use this value as $value instead of value (for example, you can provide here a formatted price instead of numeric value, or a select combo). Use '' to use same than $value - * @param object $extObject External object ??? + * @param ?CommonObject $extObject External object ??? * @param mixed $custommsg String or Array of custom messages : eg array('success' => 'MyMessage', 'error' => 'MyMessage') * @param string $moreparam More param to add on the form on action href URL parameter * @param int $notabletag Do no output table tags @@ -478,20 +478,18 @@ public function widgetForTranslation($fieldname, $object, $perm, $typeofdata = ' /** * Output edit in place form * - * @param object $object Object + * @param CommonObject $object Object * @param string $value Value to show/edit * @param string $htmlname DIV ID (field name) * @param int $condition Condition to edit * @param string $inputType Type of input ('string', 'numeric', 'datepicker' ('day' do not work, don't know why), 'textarea:rows:cols', 'ckeditor:dolibarr_zzz:width:height:?:1:rows:cols', 'select:loadmethod:savemethod:buttononly') * @param string $editvalue When in edit mode, use this value as $value instead of value - * @param object $extObject External object + * @param ?CommonObject $extObject External object * @param mixed $custommsg String or Array of custom messages : eg array('success' => 'MyMessage', 'error' => 'MyMessage') * @return string HTML edit in place */ protected function editInPlace($object, $value, $htmlname, $condition, $inputType = 'textarea', $editvalue = null, $extObject = null, $custommsg = null) { - global $conf; - $out = ''; // Check parameters diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 7e3823d2ac596..ce35aff6f74d2 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9957,8 +9957,7 @@ function dol_eval($s, $returnvalue = 1, $hideerrors = 1, $onlysimplestring = '1' if ($hideerrors) { ob_start(); // An evaluation has no reason to output data $tmps = @eval('return '.$s.';'); - $tmpo = ob_get_contents(); - ob_clean(); // End of interception of data + $tmpo = ob_get_clean(); if ($tmpo) { print 'Bad string syntax to evaluate. Some data were output when it should not when evaluating: '.$s; } @@ -9966,8 +9965,7 @@ function dol_eval($s, $returnvalue = 1, $hideerrors = 1, $onlysimplestring = '1' } else { ob_start(); // An evaluation has no reason to output data $tmps = eval('return '.$s.';'); - $tmpo = ob_get_contents(); - ob_clean(); // End of interception of data + $tmpo = ob_get_clean(); if ($tmpo) { print 'Bad string syntax to evaluate. Some data were output when it should not when evaluating: '.$s; } diff --git a/htdocs/core/lib/json.lib.php b/htdocs/core/lib/json.lib.php index 15f54b75f9789..12b0ab69220c4 100644 --- a/htdocs/core/lib/json.lib.php +++ b/htdocs/core/lib/json.lib.php @@ -267,6 +267,7 @@ function dol_json_decode($json, $assoc = false) } else { $out .= $json[$i]; } + // @phan-suppress-next-line PhanCompatibleNegativeStringOffset if ($i >= 1 && $json[$i] == '"' && $json[$i - 1] != "\\") { $comment = !$comment; } diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php index 82c372f82490c..895e7e2329ea7 100644 --- a/htdocs/core/modules/modAgenda.class.php +++ b/htdocs/core/modules/modAgenda.class.php @@ -200,7 +200,7 @@ public function __construct($db) // 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. // 'position'=>100, // 'enabled'=>'1', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. - // 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules + // 'perms'=>'1', // Use 'perms'=>'$user->hasRights('mymodule', 'level1', 'level2') if you want your menu with a permission rules // 'target'=>'', // 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both // $r++; diff --git a/htdocs/core/modules/modAi.class.php b/htdocs/core/modules/modAi.class.php index 44d06ce83a461..21249db69e912 100644 --- a/htdocs/core/modules/modAi.class.php +++ b/htdocs/core/modules/modAi.class.php @@ -167,8 +167,8 @@ public function __construct($db) // Array to add new pages in new tabs $this->tabs = array(); // Example: - // $this->tabs[] = array('data'=>'objecttype:+tabname1:Title1:mylangfile@ai:$user->rights->ai->read:/ai/mynewtab1.php?id=__ID__'); // To add a new tab identified by code tabname1 - // $this->tabs[] = array('data'=>'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@ai:$user->rights->othermodule->read:/ai/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key. + // $this->tabs[] = array('data'=>'objecttype:+tabname1:Title1:mylangfile@ai:$user->hasRight('ai','read'):/ai/mynewtab1.php?id=__ID__'); // To add a new tab identified by code tabname1 + // $this->tabs[] = array('data'=>'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@ai:$user->hasRight('othermodule','read'):/ai/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key. // $this->tabs[] = array('data'=>'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname // // Where objecttype can be diff --git a/htdocs/core/modules/modApi.class.php b/htdocs/core/modules/modApi.class.php index 27af84dca963a..254847962109e 100644 --- a/htdocs/core/modules/modApi.class.php +++ b/htdocs/core/modules/modApi.class.php @@ -95,8 +95,8 @@ public function __construct($db) $this->const = array(); // Array to add new pages in new tabs - // Example: $this->tabs = array('objecttype:+tabname1:Title1:mylangfile@api:$user->rights->api->read:/api/mynewtab1.php?id=__ID__', // To add a new tab identified by code tabname1 - // 'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@api:$user->rights->othermodule->read:/api/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key. + // Example: $this->tabs = array('objecttype:+tabname1:Title1:mylangfile@api:$user->hasRight('api','read'):/api/mynewtab1.php?id=__ID__', // To add a new tab identified by code tabname1 + // 'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@api:$user->hasRight('othermodule','read'):/api/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key. // 'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname // where objecttype can be // 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) @@ -144,8 +144,8 @@ public function __construct($db) $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) $this->rights[$r][1] = 'Generate/modify users API key'; // Permission label $this->rights[$r][3] = 0; // Permission by default for new user (0/1) - $this->rights[$r][4] = 'apikey'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - $this->rights[$r][5] = 'generate'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + $this->rights[$r][4] = 'apikey'; // In php code, permission will be checked by test if ($user->hasRight('permkey','level1','level2')) + $this->rights[$r][5] = 'generate'; // In php code, permission will be checked by test if ($user->hasRight('permkey','level1','level2')) $r++; diff --git a/htdocs/core/modules/modBlockedLog.class.php b/htdocs/core/modules/modBlockedLog.class.php index eb91bf4ef47bc..dd7fe7b3884c8 100644 --- a/htdocs/core/modules/modBlockedLog.class.php +++ b/htdocs/core/modules/modBlockedLog.class.php @@ -133,8 +133,8 @@ public function __construct($db) 'url'=>'/blockedlog/admin/blockedlog_list.php?mainmenu=tools&leftmenu=blockedlogbrowser', 'langs'=>'blockedlog', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'position'=>200, - 'enabled'=>'$conf->blockedlog->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'perms'=>'$user->rights->blockedlog->read', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules + 'enabled'=>'isModEnabled("blockedlog")', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. + 'perms'=>'$user->hasRight("blockedlog", "read")', // Use 'perms'=>'$user->hasRight("mymodule","level1","level2")' if you want your menu with a permission rules 'target'=>'', 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both ); diff --git a/htdocs/core/modules/modCollab.class.php b/htdocs/core/modules/modCollab.class.php index be1edcb8c620d..abf1949a174b3 100644 --- a/htdocs/core/modules/modCollab.class.php +++ b/htdocs/core/modules/modCollab.class.php @@ -118,7 +118,7 @@ public function __construct($db) 'langs'=>'collab', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'position'=>100, 'enabled'=>'$conf->collab->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules + 'perms'=>'1', // Use 'perms'=>'$user->hasRight("mymodule","level1","level2")' if you want your menu with a permission rules 'target'=>'', 'user'=>2 // 0=Menu for internal users, 1=external users, 2=both ); diff --git a/htdocs/core/modules/modCron.class.php b/htdocs/core/modules/modCron.class.php index 29daa7d61bf0e..366b8a6ab3177 100644 --- a/htdocs/core/modules/modCron.class.php +++ b/htdocs/core/modules/modCron.class.php @@ -142,7 +142,7 @@ public function __construct($db) 'langs'=>'cron', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'position'=>500, 'enabled'=>'$conf->cron->enabled && preg_match(\'/^(admintools|all)/\', $leftmenu)', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'perms'=>'$user->rights->cron->read', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules + 'perms'=>'$user->rights->cron->read', // Use 'perms'=>'$user->hasRight("mymodule","level1","level2")' if you want your menu with a permission rules 'target'=>'', 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both $r++; diff --git a/htdocs/core/modules/modEmailCollector.class.php b/htdocs/core/modules/modEmailCollector.class.php index 1912c92827bb0..3604cdaf2ce4c 100644 --- a/htdocs/core/modules/modEmailCollector.class.php +++ b/htdocs/core/modules/modEmailCollector.class.php @@ -175,7 +175,7 @@ public function __construct($db) 'langs'=>'admin', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'position'=>400, 'enabled'=>'isModEnabled("emailcollector") && preg_match(\'/^(admintools|all)/\', $leftmenu)', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'perms'=>'$user->admin', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules + 'perms'=>'$user->admin', // Use 'perms'=>'$user->hasRight("mymodule","level1","level2")' if you want your menu with a permission rules 'target'=>'', 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both $r++; diff --git a/htdocs/core/modules/modGravatar.class.php b/htdocs/core/modules/modGravatar.class.php index 25c5e7ac2d373..4e38b93c4fccf 100644 --- a/htdocs/core/modules/modGravatar.class.php +++ b/htdocs/core/modules/modGravatar.class.php @@ -129,7 +129,7 @@ public function __construct($db) // 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. // 'position'=>100, // 'enabled'=>'1', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. - // 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules + // 'perms'=>'1', // Use 'perms'=>'$user->hasRight("mymodule","level1","level2")' if you want your menu with a permission rules // 'target'=>'', // 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both // $r++; @@ -143,7 +143,7 @@ public function __construct($db) // 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. // 'position'=>100, // 'enabled'=>'1', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. - // 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules + // 'perms'=>'1', // Use 'perms'=>'$user->hasRight("mymodule","level1","level2")' if you want your menu with a permission rules // 'target'=>'', // 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both // $r++; @@ -157,7 +157,7 @@ public function __construct($db) // 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. // 'position'=>100, // 'enabled'=>'1', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. - // 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules + // 'perms'=>'1', // Use 'perms'=>'$user->hasRight("mymodule","level1","level2")' if you want your menu with a permission rules // 'target'=>'', // 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both // $r++; diff --git a/htdocs/core/modules/modPaybox.class.php b/htdocs/core/modules/modPaybox.class.php index 510ae24b0ff31..eeb3dc00e6c32 100644 --- a/htdocs/core/modules/modPaybox.class.php +++ b/htdocs/core/modules/modPaybox.class.php @@ -125,7 +125,7 @@ public function __construct($db) // 'url'=>'/mymodule/pagetop.php', // 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. // 'position'=>100, - // 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules + // 'perms'=>'1', // Use 'perms'=>'$user->hasRight("mymodule","level1","level2")' if you want your menu with a permission rules // 'target'=>'', // 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both // $r++; @@ -138,7 +138,7 @@ public function __construct($db) // 'url'=>'/mymodule/pagelevel1.php', // 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. // 'position'=>100, - // 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules + // 'perms'=>'1', // Use 'perms'=>'$user->hasRight("mymodule","level1","level2")' if you want your menu with a permission rules // 'target'=>'', // 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both // $r++; @@ -151,7 +151,7 @@ public function __construct($db) // 'url'=>'/mymodule/pagelevel2.php', // 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. // 'position'=>100, - // 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules + // 'perms'=>'1', // Use 'perms'=>'$user->hasRight("mymodule","level1","level2")' if you want your menu with a permission rules // 'target'=>'', // 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both // $r++; diff --git a/htdocs/core/modules/modPaypal.class.php b/htdocs/core/modules/modPaypal.class.php index 4863e9c53bd99..8d2a98c67e7d8 100644 --- a/htdocs/core/modules/modPaypal.class.php +++ b/htdocs/core/modules/modPaypal.class.php @@ -117,7 +117,7 @@ public function __construct($db) 'langs'=>'paypal', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'position'=>501, 'enabled'=>'$conf->paypal->enabled && isModEnabled("banque") && $conf->global->MAIN_FEATURES_LEVEL >= 2', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'perms'=>'$user->rights->banque->consolidate', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules + 'perms'=>'$user->rights->banque->consolidate', // Use 'perms'=>'$user->hasRight("mymodule","level1","level2")' if you want your menu with a permission rules 'target'=>'', 'user'=>2 ); // 0=Menu for internal users, 1=external users, 2=both @@ -132,7 +132,7 @@ public function __construct($db) // 'url'=>'/mymodule/pagetop.php', // 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. // 'position'=>100, - // 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules + // 'perms'=>'1', // Use 'perms'=>'$user->hasRight("mymodule","level1","level2")' if you want your menu with a permission rules // 'target'=>'', // 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both // $r++; @@ -145,7 +145,7 @@ public function __construct($db) // 'url'=>'/mymodule/pagelevel1.php', // 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. // 'position'=>100, - // 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules + // 'perms'=>'1', // Use 'perms'=>'$user->hasRight("mymodule","level1","level2")' if you want your menu with a permission rules // 'target'=>'', // 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both // $r++; @@ -158,7 +158,7 @@ public function __construct($db) // 'url'=>'/mymodule/pagelevel2.php', // 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. // 'position'=>100, - // 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules + // 'perms'=>'1', // Use 'perms'=>'$user->hasRight("mymodule","level1","level2")' if you want your menu with a permission rules // 'target'=>'', // 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both // $r++; diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index 35a75ca1345e5..28b5f19174c08 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -169,7 +169,7 @@ public function __construct($db) 'langs'=>'products', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'position'=>300, 'enabled'=>'isModEnabled("product") && preg_match(\'/^(admintools|all)/\',$leftmenu)', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules + 'perms'=>'1', // Use 'perms'=>'$user->hasRight("mymodule","level1","level2")' if you want your menu with a permission rules 'target'=>'', 'user'=>0); // 0=Menu for internal users, 1=external users, 2=both $r++; diff --git a/htdocs/core/modules/modService.class.php b/htdocs/core/modules/modService.class.php index f40d72e8038c1..fb07f91ee1c27 100644 --- a/htdocs/core/modules/modService.class.php +++ b/htdocs/core/modules/modService.class.php @@ -135,7 +135,7 @@ public function __construct($db) 'langs'=>'products', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'position'=>300, 'enabled'=>'isModEnabled("product") && preg_match(\'/^(admintools|all)/\',$leftmenu)', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules + 'perms'=>'1', // Use 'perms'=>'$user->hasRight("mymodule","level1","level2")' if you want your menu with a permission rules 'target'=>'', 'user'=>0); // 0=Menu for internal users, 1=external users, 2=both $r++; diff --git a/htdocs/core/modules/modStripe.class.php b/htdocs/core/modules/modStripe.class.php index b990e03729599..2e0d639c8562b 100644 --- a/htdocs/core/modules/modStripe.class.php +++ b/htdocs/core/modules/modStripe.class.php @@ -102,7 +102,7 @@ public function __construct($db) 'langs'=>'stripe', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'position'=>500, 'enabled'=>'$conf->stripe->enabled && isModEnabled("banque") && $conf->global->MAIN_FEATURES_LEVEL >= 2', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'perms'=>'$user->rights->banque->modifier', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules + 'perms'=>'$user->rights->banque->modifier', // Use 'perms'=>'$user->hasRight("mymodule","level1","level2")' if you want your menu with a permission rules 'target'=>'', 'user'=>2 ); // 0=Menu for internal users, 1=external users, 2=both diff --git a/htdocs/core/modules/modWebsite.class.php b/htdocs/core/modules/modWebsite.class.php index d7afc7921b7ee..fe01b0e7814ac 100644 --- a/htdocs/core/modules/modWebsite.class.php +++ b/htdocs/core/modules/modWebsite.class.php @@ -123,7 +123,7 @@ public function __construct($db) 'langs'=>'website', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'position'=>100, 'enabled'=>'$conf->website->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'perms'=>'$user->rights->website->read', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules + 'perms'=>'$user->rights->website->read', // Use 'perms'=>'$user->hasRight("mymodule","level1","level2")' if you want your menu with a permission rules 'target'=>'', 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both $r++; diff --git a/htdocs/cron/card.php b/htdocs/cron/card.php index 68dbac1b3e74b..032dca46d45cb 100644 --- a/htdocs/cron/card.php +++ b/htdocs/cron/card.php @@ -492,7 +492,7 @@ function initfields() print ""; print $langs->trans('CronDtStart').""; if (!empty($object->datestart)) { - print $form->selectDate($object->datestart, 'datestart', 1, 1, '', "cronform"); + print $form->selectDate($object->datestart, 'datestart', 1, 1, 0, "cronform"); } else { print $form->selectDate(-1, 'datestart', 1, 1, 1, "cronform"); } @@ -504,7 +504,7 @@ function initfields() print ""; print $langs->trans('CronDtEnd').""; if (!empty($object->dateend)) { - print $form->selectDate($object->dateend, 'dateend', 1, 1, '', "cronform"); + print $form->selectDate($object->dateend, 'dateend', 1, 1, 0, "cronform"); } else { print $form->selectDate(-1, 'dateend', 1, 1, 1, "cronform"); } @@ -542,9 +542,9 @@ function initfields() //print ' ('.$langs->trans('CronFrom').')'; print ""; if (!empty($object->datenextrun)) { - print $form->selectDate($object->datenextrun, 'datenextrun', 1, 1, '', "cronform"); + print $form->selectDate($object->datenextrun, 'datenextrun', 1, 1, 0, "cronform"); } else { - print $form->selectDate(-1, 'datenextrun', 1, 1, '', "cronform", 1, 1); + print $form->selectDate(-1, 'datenextrun', 1, 1, 0, "cronform", 1, 1); } print ""; print ""; diff --git a/htdocs/delivery/card.php b/htdocs/delivery/card.php index 7dccbfbdd44e9..7ee3fd7ea4b77 100644 --- a/htdocs/delivery/card.php +++ b/htdocs/delivery/card.php @@ -430,7 +430,7 @@ print '
'; print ''; print ''; - print $form->selectDate($object->date_delivery ? $object->date_delivery : -1, 'liv_', 1, 1, '', "setdate_delivery", 1, 1); + print $form->selectDate($object->date_delivery ? $object->date_delivery : -1, 'liv_', 1, 1, 0, "setdate_delivery", 1, 1); print ''; print '
'; } else { diff --git a/htdocs/don/card.php b/htdocs/don/card.php index 06546f208d187..2e28a7c2655ef 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -490,7 +490,7 @@ // Date print ''.$langs->trans("Date").''; - print $form->selectDate($donation_date ? $donation_date : -1, '', '', '', '', "add", 1, 1); + print $form->selectDate($donation_date ? $donation_date : -1, '', 0, 0, 0, "add", 1, 1); print ''; // Amount @@ -623,7 +623,7 @@ // Date print ''.$langs->trans("Date").''; - print $form->selectDate($object->date, '', '', '', '', "update"); + print $form->selectDate($object->date, '', 0, 0, 0, "update"); print ''; // Amount diff --git a/htdocs/eventorganization/conferenceorbooth_card.php b/htdocs/eventorganization/conferenceorbooth_card.php index 77ee9b6abd532..370d5c5df6533 100644 --- a/htdocs/eventorganization/conferenceorbooth_card.php +++ b/htdocs/eventorganization/conferenceorbooth_card.php @@ -97,7 +97,7 @@ if ($user->socid > 0) { accessforbidden(); } -$isdraft = (($object->status== $object::STATUS_DRAFT) ? 1 : 0); +$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); $result = restrictedArea($user, 'eventorganization', $object->id, '', '', 'fk_soc', 'id', $isdraft); if (!$permissiontoread) { @@ -186,7 +186,7 @@ $projectstatic->fetch_thirdparty(); } -$withProjectUrl=''; +$withProjectUrl = ''; $object->project = clone $projectstatic; if (!empty($withproject)) { @@ -339,7 +339,7 @@ $htmltext = $langs->trans("AllowUnknownPeopleSuggestConfHelp"); print $form->editfieldkey('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '', $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext); print ''; - print $form->editfieldval('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '1', $projectstatic, 0, $typeofdata, '', 0, 0, '', 0, '', 'projectid'); + print $form->editfieldval('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '1', $projectstatic, 0, $typeofdata, '', null, 0, '', 0, '', 'projectid'); print ""; print ''; @@ -347,25 +347,25 @@ $htmltext = $langs->trans("AllowUnknownPeopleSuggestBoothHelp"); print $form->editfieldkey('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '', $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext); print ''; - print $form->editfieldval('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '1', $projectstatic, 0, $typeofdata, '', 0, 0, '', 0, '', 'projectid'); + print $form->editfieldval('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '1', $projectstatic, 0, $typeofdata, '', null, 0, '', 0, '', 'projectid'); print ""; print ''; print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid'); print ''; - print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', $projectstatic->price_booth, $projectstatic, 0, 'amount', '', 0, 0, '', 0, '', 'projectid'); + print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', $projectstatic->price_booth, $projectstatic, 0, 'amount', '', null, 0, '', 0, '', 'projectid'); print ""; print ''; print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid'); print ''; - print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', $projectstatic->price_registration, $projectstatic, 0, 'amount', '', 0, 0, '', 0, '', 'projectid'); + print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', $projectstatic->price_registration, $projectstatic, 0, 'amount', '', null, 0, '', 0, '', 'projectid'); print ""; print ''; print $form->editfieldkey($form->textwithpicto($langs->trans('MaxNbOfAttendees'), ''), 'max_attendees', '', $project, $permissiontoadd, 'integer:3', '', 0, 0, 'projectid'); print ''; - print $form->editfieldval($form->textwithpicto($langs->trans('MaxNbOfAttendees'), ''), 'max_attendees', $project->max_attendees, $project, $permissiontoadd, 'integer:3', '', 0, 0, '', 0, '', 'projectid'); + print $form->editfieldval($form->textwithpicto($langs->trans('MaxNbOfAttendees'), ''), 'max_attendees', $project->max_attendees, $project, $permissiontoadd, 'integer:3', '', null, 0, '', 0, '', 'projectid'); print ""; print ''.$langs->trans("EventOrganizationICSLink").''; @@ -571,7 +571,7 @@ //$keyforbreak='fieldkeytoswitchonsecondcolumn'; // We change column just before this field //unset($object->fields['fk_project']); // Hide field already shown in banner //unset($object->fields['fk_soc']); // Hide field already shown in banner - $keyforbreak='num_vote'; + $keyforbreak = 'num_vote'; include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; @@ -643,7 +643,7 @@ $object->fetchObjectLinked(); - if (is_array($object->linkedObjects) && count($object->linkedObjects)>0 && array_key_exists("facture", $object->linkedObjects)) { + if (is_array($object->linkedObjects) && count($object->linkedObjects) > 0 && array_key_exists("facture", $object->linkedObjects)) { foreach ($object->linkedObjects["facture"] as $fac) { if (empty($fac->paye)) { $key = 'paymentlink_'.$fac->id; diff --git a/htdocs/eventorganization/conferenceorbooth_contact.php b/htdocs/eventorganization/conferenceorbooth_contact.php index 201dc52710bfe..b2ae4685c8913 100644 --- a/htdocs/eventorganization/conferenceorbooth_contact.php +++ b/htdocs/eventorganization/conferenceorbooth_contact.php @@ -74,7 +74,7 @@ accessforbidden(); } -$isdraft = (($object->status== $object::STATUS_DRAFT) ? 1 : 0); +$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); $result = restrictedArea($user, 'eventorganization', $object->id, '', '', 'fk_soc', 'rowid', $isdraft); $permissiontoread = $user->hasRight('eventorganization', 'read'); @@ -88,7 +88,7 @@ if ($user->socid > 0) { accessforbidden(); } -$isdraft = (($object->status== $object::STATUS_DRAFT) ? 1 : 0); +$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); $result = restrictedArea($user, 'eventorganization', $object->id, '', '', 'fk_soc', 'rowid', $isdraft); if (!$permissiontoread) { @@ -166,7 +166,7 @@ if (!empty($projectstatic->socid)) { $projectstatic->fetch_thirdparty(); } -$withProjectUrl=''; +$withProjectUrl = ''; $object->project = clone $projectstatic; if (!empty($withproject)) { @@ -298,7 +298,7 @@ $htmltext = $langs->trans("AllowUnknownPeopleSuggestConfHelp"); print $form->editfieldkey('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '', $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext); print ''; - print $form->editfieldval('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '1', $projectstatic, 0, $typeofdata, '', 0, 0, '', 0, '', 'projectid'); + print $form->editfieldval('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '1', $projectstatic, 0, $typeofdata, '', null, 0, '', 0, '', 'projectid'); print ""; print ''; @@ -306,19 +306,19 @@ $htmltext = $langs->trans("AllowUnknownPeopleSuggestBoothHelp"); print $form->editfieldkey('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '', $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext); print ''; - print $form->editfieldval('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '1', $projectstatic, 0, $typeofdata, '', 0, 0, '', 0, '', 'projectid'); + print $form->editfieldval('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '1', $projectstatic, 0, $typeofdata, '', null, 0, '', 0, '', 'projectid'); print ""; print ''; print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid'); print ''; - print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', $projectstatic->price_booth, $projectstatic, 0, 'amount', '', 0, 0, '', 0, '', 'projectid'); + print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', $projectstatic->price_booth, $projectstatic, 0, 'amount', '', null, 0, '', 0, '', 'projectid'); print ""; print ''; print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid'); print ''; - print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', $projectstatic->price_registration, $projectstatic, 0, 'amount', '', 0, 0, '', 0, '', 'projectid'); + print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', $projectstatic->price_registration, $projectstatic, 0, 'amount', '', null, 0, '', 0, '', 'projectid'); print ""; print ''.$langs->trans("EventOrganizationICSLink").''; diff --git a/htdocs/eventorganization/conferenceorbooth_document.php b/htdocs/eventorganization/conferenceorbooth_document.php index 788128a69065b..da8471988d9f0 100644 --- a/htdocs/eventorganization/conferenceorbooth_document.php +++ b/htdocs/eventorganization/conferenceorbooth_document.php @@ -102,7 +102,7 @@ if ($user->socid > 0) { accessforbidden(); } -$isdraft = (($object->status== $object::STATUS_DRAFT) ? 1 : 0); +$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); $result = restrictedArea($user, 'eventorganization', $object->id, '', '', 'fk_soc', 'id', $isdraft); if (!$permissiontoread) { @@ -141,7 +141,7 @@ $projectstatic->fetch_thirdparty(); } -$withProjectUrl=''; +$withProjectUrl = ''; $object->project = clone $projectstatic; if (!empty($withproject)) { @@ -271,7 +271,7 @@ $htmltext = $langs->trans("AllowUnknownPeopleSuggestConfHelp"); print $form->editfieldkey('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '', $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext); print ''; - print $form->editfieldval('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '1', $projectstatic, 0, $typeofdata, '', 0, 0, '', 0, '', 'projectid'); + print $form->editfieldval('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '1', $projectstatic, 0, $typeofdata, '', null, 0, '', 0, '', 'projectid'); print ""; print ''; @@ -279,19 +279,19 @@ $htmltext = $langs->trans("AllowUnknownPeopleSuggestBoothHelp"); print $form->editfieldkey('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '', $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext); print ''; - print $form->editfieldval('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '1', $projectstatic, 0, $typeofdata, '', 0, 0, '', 0, '', 'projectid'); + print $form->editfieldval('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '1', $projectstatic, 0, $typeofdata, '', null, 0, '', 0, '', 'projectid'); print ""; print ''; print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid'); print ''; - print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', $projectstatic->price_booth, $projectstatic, 0, 'amount', '', 0, 0, '', 0, '', 'projectid'); + print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', $projectstatic->price_booth, $projectstatic, 0, 'amount', '', null, 0, '', 0, '', 'projectid'); print ""; print ''; print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid'); print ''; - print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', $projectstatic->price_registration, $projectstatic, 0, 'amount', '', 0, 0, '', 0, '', 'projectid'); + print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', $projectstatic->price_registration, $projectstatic, 0, 'amount', '', null, 0, '', 0, '', 'projectid'); print ""; print ''.$langs->trans("EventOrganizationICSLink").''; diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php index 9ee0be54b5804..46e1f251aace7 100644 --- a/htdocs/eventorganization/conferenceorbooth_list.php +++ b/htdocs/eventorganization/conferenceorbooth_list.php @@ -120,11 +120,11 @@ if (!empty($val['visible'])) { $visible = (int) dol_eval($val['visible'], 1); $arrayfields['t.'.$key] = array( - 'label'=>$val['label'], - 'checked'=>(($visible < 0) ? 0 : 1), - 'enabled'=>(abs($visible) != 3 && (int) dol_eval($val['enabled'], 1)), - 'position'=>$val['position'], - 'help'=> isset($val['help']) ? $val['help'] : '' + 'label' => $val['label'], + 'checked' => (($visible < 0) ? 0 : 1), + 'enabled' => (abs($visible) != 3 && (int) dol_eval($val['enabled'], 1)), + 'position' => $val['position'], + 'help' => isset($val['help']) ? $val['help'] : '' ); } } @@ -159,15 +159,15 @@ if (preg_match('/^set/', $action) && ($projectid > 0 || $projectref) && $user->hasRight('eventorganization', 'write')) { //If "set" fields keys is in projects fields - $project_attr=preg_replace('/^set/', '', $action); + $project_attr = preg_replace('/^set/', '', $action); if (array_key_exists($project_attr, $project->fields)) { $result = $project->fetch($projectid, $projectref); if ($result < 0) { setEventMessages(null, $project->errors, 'errors'); } else { $projectid = $project->id; - $project->{$project_attr}=GETPOST($project_attr); - $result=$project->update($user); + $project->{$project_attr} = GETPOST($project_attr); + $result = $project->update($user); if ($result < 0) { setEventMessages(null, $project->errors, 'errors'); } @@ -245,7 +245,7 @@ } } else { setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); - $error ++; + $error++; break; } } @@ -408,10 +408,10 @@ // Date start - end of event print ''.$langs->trans("Dates").' ('.$langs->trans("Event").')'; $start = dol_print_date($project->date_start_event, 'day', 'tzuserrel'); - print ($start ? ''.$start.'' : '?'); + print($start ? ''.$start.'' : '?'); $end = dol_print_date($project->date_end_event, 'day', 'tzuserrel'); print ' - '; - print ($end ? ''.$end.'' : '?'); + print($end ? ''.$end.'' : '?'); if ($object->hasDelay()) { print img_warning("Late"); } @@ -454,7 +454,7 @@ $htmltext = $langs->trans("AllowUnknownPeopleSuggestConfHelp"); print $form->editfieldkey('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', ($project->accept_conference_suggestions ? 1 : 0), $project, $permissiontoadd, $typeofdata, '', 0, 0, 'projectid', $htmltext); print ''; - print $form->editfieldval('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', ($project->accept_conference_suggestions ? 1 : 0), $project, $permissiontoadd, $typeofdata, '', 0, 0, '', 0, '', 'projectid'); + print $form->editfieldval('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', ($project->accept_conference_suggestions ? 1 : 0), $project, $permissiontoadd, $typeofdata, '', null, 0, '', 0, '', 'projectid'); print ""; print ''; @@ -462,25 +462,25 @@ $htmltext = $langs->trans("AllowUnknownPeopleSuggestBoothHelp"); print $form->editfieldkey('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', ($project->accept_booth_suggestions ? 1 : 0), $project, $permissiontoadd, $typeofdata, '', 0, 0, 'projectid', $htmltext); print ''; - print $form->editfieldval('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', ($project->accept_booth_suggestions ? 1 : 0), $project, $permissiontoadd, $typeofdata, '', 0, 0, '', 0, '', 'projectid'); + print $form->editfieldval('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', ($project->accept_booth_suggestions ? 1 : 0), $project, $permissiontoadd, $typeofdata, '', null, 0, '', 0, '', 'projectid'); print ""; print ''; print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', '', $project, $permissiontoadd, 'amount', '', 0, 0, 'projectid'); print ''; - print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', $project->price_booth, $project, $permissiontoadd, 'amount', '', 0, 0, '', 0, '', 'projectid'); + print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', $project->price_booth, $project, $permissiontoadd, 'amount', '', null, 0, '', 0, '', 'projectid'); print ""; print ''; print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', '', $project, $permissiontoadd, 'amount', '', 0, 0, 'projectid'); print ''; - print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', $project->price_registration, $project, $permissiontoadd, 'amount', '', 0, 0, '', 0, '', 'projectid'); + print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', $project->price_registration, $project, $permissiontoadd, 'amount', '', null, 0, '', 0, '', 'projectid'); print ""; print ''; print $form->editfieldkey($form->textwithpicto($langs->trans('MaxNbOfAttendees'), ''), 'max_attendees', '', $project, $permissiontoadd, 'integer:3', '', 0, 0, 'projectid'); print ''; - print $form->editfieldval($form->textwithpicto($langs->trans('MaxNbOfAttendees'), ''), 'max_attendees', $project->max_attendees, $project, $permissiontoadd, 'integer:3', '', 0, 0, '', 0, '', 'projectid'); + print $form->editfieldval($form->textwithpicto($langs->trans('MaxNbOfAttendees'), ''), 'max_attendees', $project->max_attendees, $project, $permissiontoadd, 'integer:3', '', null, 0, '', 0, '', 'projectid'); print ""; // Link to ICS for the event @@ -733,7 +733,7 @@ //'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"), //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"), //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), - 'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail").' ('.$langs->trans("ToSpeakers").')', + 'presend' => img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail").' ('.$langs->trans("ToSpeakers").')', //'presend_attendees'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail").' - '.$langs->trans("Attendees"), ); if (!empty($permissiontodelete)) { @@ -763,8 +763,8 @@ $newcardbutton = ''; -$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.(!empty($project->id) ? '&withproject=1&fk_project='.$project->id : '').(!empty($project->socid) ? '&fk_soc='.$project->socid : '').preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); -$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.(!empty($project->id) ? '&withproject=1&fk_project='.$project->id : '').(!empty($project->socid) ? '&fk_soc='.$project->socid : '').preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.(!empty($project->id) ? '&withproject=1&fk_project='.$project->id : '').(!empty($project->socid) ? '&fk_soc='.$project->socid : '').preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss' => 'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.(!empty($project->id) ? '&withproject=1&fk_project='.$project->id : '').(!empty($project->socid) ? '&fk_soc='.$project->socid : '').preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss' => 'reposition')); $newcardbutton .= dolGetButtonTitleSeparator(); $newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/eventorganization/conferenceorbooth_card.php?action=create'.(!empty($project->id) ? '&withproject=1&fk_project='.$project->id : '').(!empty($project->socid) ? '&fk_soc='.$project->socid : '').'&backtopage='.urlencode($_SERVER['PHP_SELF']).(!empty($project->id) ? '?projectid='.$project->id : ''), '', $permissiontoadd); @@ -884,7 +884,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook -$parameters = array('arrayfields'=>$arrayfields); +$parameters = array('arrayfields' => $arrayfields); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column @@ -927,7 +927,7 @@ // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields -$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray); +$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column @@ -1056,7 +1056,7 @@ // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column @@ -1098,7 +1098,7 @@ $db->free($resql); -$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); +$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql); $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; diff --git a/htdocs/eventorganization/conferenceorboothattendee_card.php b/htdocs/eventorganization/conferenceorboothattendee_card.php index b57b5180bf5b2..4e6074703a697 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_card.php +++ b/htdocs/eventorganization/conferenceorboothattendee_card.php @@ -343,7 +343,7 @@ $htmltext = $langs->trans("AllowUnknownPeopleSuggestConfHelp"); print $form->editfieldkey('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '', $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext); print ''; - print $form->editfieldval('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '1', $projectstatic, 0, $typeofdata, '', 0, 0, '', 0, '', 'projectid'); + print $form->editfieldval('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '1', $projectstatic, 0, $typeofdata, '', null, 0, '', 0, '', 'projectid'); print ""; print ''; @@ -351,19 +351,19 @@ $htmltext = $langs->trans("AllowUnknownPeopleSuggestBoothHelp"); print $form->editfieldkey('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '', $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext); print ''; - print $form->editfieldval('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '1', $projectstatic, 0, $typeofdata, '', 0, 0, '', 0, '', 'projectid'); + print $form->editfieldval('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '1', $projectstatic, 0, $typeofdata, '', null, 0, '', 0, '', 'projectid'); print ""; print ''; print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid'); print ''; - print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', $projectstatic->price_booth, $projectstatic, 0, 'amount', '', 0, 0, '', 0, '', 'projectid'); + print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', $projectstatic->price_booth, $projectstatic, 0, 'amount', '', null, 0, '', 0, '', 'projectid'); print ""; print ''; print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid'); print ''; - print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', $projectstatic->price_registration, $projectstatic, 0, 'amount', '', 0, 0, '', 0, '', 'projectid'); + print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', $projectstatic->price_registration, $projectstatic, 0, 'amount', '', null, 0, '', 0, '', 'projectid'); print ""; print ''.$langs->trans("EventOrganizationICSLink").''; diff --git a/htdocs/eventorganization/conferenceorboothattendee_list.php b/htdocs/eventorganization/conferenceorboothattendee_list.php index cbaf93a8f4540..6e752262effc9 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_list.php +++ b/htdocs/eventorganization/conferenceorboothattendee_list.php @@ -63,7 +63,7 @@ $fk_project = GETPOSTINT('fk_project') ? GETPOSTINT('fk_project') : GETPOSTINT('projectid'); $projectid = $fk_project; -$withProjectUrl=''; +$withProjectUrl = ''; // Load variable for pagination $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; @@ -128,11 +128,11 @@ if (!empty($val['visible'])) { $visible = (int) dol_eval($val['visible'], 1); $arrayfields['t.'.$key] = array( - 'label'=>$val['label'], - 'checked'=>(($visible < 0) ? 0 : 1), - 'enabled'=>(abs($visible) != 3 && (int) dol_eval($val['enabled'], 1)), - 'position'=>$val['position'], - 'help'=> isset($val['help']) ? $val['help'] : '' + 'label' => $val['label'], + 'checked' => (($visible < 0) ? 0 : 1), + 'enabled' => (abs($visible) != 3 && (int) dol_eval($val['enabled'], 1)), + 'position' => $val['position'], + 'help' => isset($val['help']) ? $val['help'] : '' ); } } @@ -169,14 +169,14 @@ if (preg_match('/^set/', $action) && $projectid > 0 && $user->hasRight('eventorganization', 'write')) { $project = new Project($db); //If "set" fields keys is in projects fields - $project_attr=preg_replace('/^set/', '', $action); + $project_attr = preg_replace('/^set/', '', $action); if (array_key_exists($project_attr, $project->fields)) { $result = $project->fetch($projectid); if ($result < 0) { setEventMessages(null, $project->errors, 'errors'); } else { - $project->{$project_attr}=GETPOST($project_attr); - $result=$project->update($user); + $project->{$project_attr} = GETPOST($project_attr); + $result = $project->update($user); if ($result < 0) { setEventMessages(null, $project->errors, 'errors'); } @@ -402,7 +402,7 @@ $projectstatic->fetch_thirdparty(); } - $withProjectUrl=''; + $withProjectUrl = ''; $object->project = clone $projectstatic; if (!empty($withproject)) { @@ -554,7 +554,7 @@ $htmltext = $langs->trans("AllowUnknownPeopleSuggestConfHelp"); print $form->editfieldkey('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '', $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext); print ''; - print $form->editfieldval('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '1', $projectstatic, 0, $typeofdata, '', 0, 0, '', 0, '', 'projectid'); + print $form->editfieldval('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '1', $projectstatic, 0, $typeofdata, '', null, 0, '', 0, '', 'projectid'); print ""; print ''; @@ -562,25 +562,25 @@ $htmltext = $langs->trans("AllowUnknownPeopleSuggestBoothHelp"); print $form->editfieldkey('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '', $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext); print ''; - print $form->editfieldval('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '1', $projectstatic, 0, $typeofdata, '', 0, 0, '', 0, '', 'projectid'); + print $form->editfieldval('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '1', $projectstatic, 0, $typeofdata, '', null, 0, '', 0, '', 'projectid'); print ""; print ''; print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid'); print ''; - print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', $projectstatic->price_booth, $projectstatic, 0, 'amount', '', 0, 0, '', 0, '', 'projectid'); + print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', $projectstatic->price_booth, $projectstatic, 0, 'amount', '', null, 0, '', 0, '', 'projectid'); print ""; print ''; print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid'); print ''; - print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', $projectstatic->price_registration, $projectstatic, 0, 'amount', '', 0, 0, '', 0, '', 'projectid'); + print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', $projectstatic->price_registration, $projectstatic, 0, 'amount', '', null, 0, '', 0, '', 'projectid'); print ""; print ''; print $form->editfieldkey($form->textwithpicto($langs->trans('MaxNbOfAttendees'), ''), 'max_attendees', '', $projectstatic, $permissiontoadd, 'integer:3', '&withproject=1', 0, 0, 'projectid'); print ''; - print $form->editfieldval($form->textwithpicto($langs->trans('MaxNbOfAttendees'), ''), 'max_attendees', $projectstatic->max_attendees, $projectstatic, $permissiontoadd, 'integer:3', '', 0, 0, '&withproject=1', 0, '', 'projectid'); + print $form->editfieldval($form->textwithpicto($langs->trans('MaxNbOfAttendees'), ''), 'max_attendees', $projectstatic->max_attendees, $projectstatic, $permissiontoadd, 'integer:3', '', null, 0, '&withproject=1', 0, '', 'projectid'); print ""; print ''.$langs->trans("EventOrganizationICSLink").''; @@ -725,7 +725,7 @@ //'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"), //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"), //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), - 'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), + 'presend' => img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), ); if (!empty($permissiontodelete)) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); @@ -751,7 +751,7 @@ print ''; print ''; -$params = array('morecss'=>'reposition'); +$params = array('morecss' => 'reposition'); $urlnew = DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_card.php?action=create'.(!empty($confOrBooth->id) ? '&conforboothid='.$confOrBooth->id : '').(!empty($projectstatic->id) ? '&fk_project='.$projectstatic->id : '').$withProjectUrl.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?projectid='.$projectstatic->id.(empty($confOrBooth->id) ? '' : '&conforboothid='.$confOrBooth->id).$withProjectUrl); @@ -859,7 +859,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook -$parameters = array('arrayfields'=>$arrayfields); +$parameters = array('arrayfields' => $arrayfields); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column @@ -902,7 +902,7 @@ // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields -$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray); +$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column @@ -1007,7 +1007,7 @@ } elseif ($key == 'ref') { $optionLink = (!empty($withproject) ? 'conforboothidproject' : 'conforboothid'); if (empty($confOrBooth->id)) { - $optionLink='projectid'; + $optionLink = 'projectid'; } print $object->getNomUrl(1, $optionLink); } else { @@ -1034,7 +1034,7 @@ // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column @@ -1076,7 +1076,7 @@ $db->free($resql); -$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); +$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql); $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 8c259b63e2a10..e42131e8cb423 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -274,7 +274,7 @@ $stockLocation = "ent1".$i."_0"; $qty = "qtyl".$i; - $is_batch_or_serial=0; + $is_batch_or_serial = 0; if (!empty($objectsrc->lines[$i]->fk_product)) { $resultFetch = $product->fetch($objectsrc->lines[$i]->fk_product, '', '', '', 1, 1, 1); if ($resultFetch < 0) { @@ -300,9 +300,9 @@ //var_dump($sub_qty[$j]['id_batch']); //var_dump($qty);var_dump($batch);var_dump($sub_qty[$j]['q']);var_dump($sub_qty[$j]['id_batch']); - if ($is_batch_or_serial==2 && $sub_qty[$j]['q']>1) { + if ($is_batch_or_serial == 2 && $sub_qty[$j]['q'] > 1) { setEventMessages($langs->trans("TooManyQtyForSerialNumber", $product->ref, ''), null, 'errors'); - $totalqty=0; + $totalqty = 0; break 2; } $j++; @@ -351,7 +351,7 @@ // check qty shipped not greater than ordered if (getDolGlobalInt("MAIN_DONT_SHIP_MORE_THAN_ORDERED") && $subtotalqty > $objectsrc->lines[$i]->qty) { - setEventMessages($langs->trans("ErrorTooMuchShipped", $i+1), null, 'errors'); + setEventMessages($langs->trans("ErrorTooMuchShipped", $i + 1), null, 'errors'); $error++; continue; } @@ -679,7 +679,7 @@ setEventMessages($line->error, $line->errors, 'errors'); $error++; } else { - $update_done=true; + $update_done = true; } } else { setEventMessages($lotStock->error, $lotStock->errors, 'errors'); @@ -723,7 +723,7 @@ setEventMessages($line->error, $line->errors, 'errors'); $error++; } else { - $update_done=true; + $update_done = true; } } else { setEventMessages($line->error, $line->errors, 'errors'); @@ -742,7 +742,7 @@ setEventMessages($object->error, $object->errors, 'errors'); $error++; } else { - $update_done=true; + $update_done = true; } } } else { @@ -794,7 +794,7 @@ setEventMessages($line->error, $line->errors, 'errors'); $error++; } else { - $update_done=true; + $update_done = true; } } unset($_POST[$stockLocation]); @@ -810,7 +810,7 @@ setEventMessages($line->error, $line->errors, 'errors'); $error++; } else { - $update_done=true; + $update_done = true; } unset($_POST[$qty]); } @@ -824,7 +824,7 @@ setEventMessages($line->error, $line->errors, 'errors'); $error++; } else { - $update_done=true; + $update_done = true; } unset($_POST[$qty]); } @@ -1604,7 +1604,7 @@ $nbofsuggested = 0; foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) { if (($stock_warehouse->real > 0) && (count($stock_warehouse->detail_batch))) { - $nbofsuggested+=count($stock_warehouse->detail_batch); + $nbofsuggested += count($stock_warehouse->detail_batch); } } @@ -1749,7 +1749,7 @@ $expLine->array_options = array_merge($expLine->array_options, $srcLine->array_options); - print $expLine->showOptionals($extrafields, 'edit', array('style'=>'class="drag drop oddeven"', 'colspan'=>$colspan), $indiceAsked, '', 1); + print $expLine->showOptionals($extrafields, 'edit', array('style' => 'class="drag drop oddeven"', 'colspan' => $colspan), $indiceAsked, '', 1); } } @@ -1957,7 +1957,7 @@ print '
'; print ''; print ''; - print $form->selectDate($object->date_delivery ? $object->date_delivery : -1, 'liv_', 1, 1, '', "setdate_livraison", 1, 0); + print $form->selectDate($object->date_delivery ? $object->date_delivery : -1, 'liv_', 1, 1, 0, "setdate_livraison", 1, 0); print ''; print '
'; } else { @@ -2266,9 +2266,9 @@ if ($obj) { // $obj->rowid is rowid in $origin."det" table $alreadysent[$obj->rowid][$obj->shipmentline_id] = array( - 'shipment_ref'=>$obj->shipment_ref, 'shipment_id'=>$obj->shipment_id, 'warehouse'=>$obj->fk_entrepot, 'qty_shipped'=>$obj->qty_shipped, - 'product_tosell'=>$obj->product_tosell, 'product_tobuy'=>$obj->product_tobuy, 'product_tobatch'=>$obj->product_tobatch, - 'date_valid'=>$db->jdate($obj->date_valid), 'date_delivery'=>$db->jdate($obj->date_delivery)); + 'shipment_ref' => $obj->shipment_ref, 'shipment_id' => $obj->shipment_id, 'warehouse' => $obj->fk_entrepot, 'qty_shipped' => $obj->qty_shipped, + 'product_tosell' => $obj->product_tosell, 'product_tobuy' => $obj->product_tobuy, 'product_tobatch' => $obj->product_tobatch, + 'date_valid' => $db->jdate($obj->date_valid), 'date_delivery' => $db->jdate($obj->date_delivery)); } $i++; } @@ -2608,9 +2608,9 @@ // TODO Show all in same line by setting $display_type = 'line' if ($action == 'editline' && $line->id == $line_id) { - print $lines[$i]->showOptionals($extrafields, 'edit', array('colspan'=>$colspan), !empty($indiceAsked) ? $indiceAsked : '', '', 0, 'card'); + print $lines[$i]->showOptionals($extrafields, 'edit', array('colspan' => $colspan), !empty($indiceAsked) ? $indiceAsked : '', '', 0, 'card'); } else { - print $lines[$i]->showOptionals($extrafields, 'view', array('colspan'=>$colspan), !empty($indiceAsked) ? $indiceAsked : '', '', 0, 'card'); + print $lines[$i]->showOptionals($extrafields, 'view', array('colspan' => $colspan), !empty($indiceAsked) ? $indiceAsked : '', '', 0, 'card'); } } } diff --git a/htdocs/expedition/dispatch.php b/htdocs/expedition/dispatch.php index 8334b30bdef9e..913f069ff61b7 100644 --- a/htdocs/expedition/dispatch.php +++ b/htdocs/expedition/dispatch.php @@ -51,7 +51,7 @@ $langs->load('productbatch'); } - // Security check +// Security check $id = GETPOSTINT("id"); $ref = GETPOST('ref'); $lineid = GETPOSTINT('lineid'); @@ -510,7 +510,7 @@ print '
'; print ''; print ''; - print $form->selectDate($object->date_delivery ? $object->date_delivery : -1, 'liv_', 1, 1, '', "setdate_livraison", 1, 0); + print $form->selectDate($object->date_delivery ? $object->date_delivery : -1, 'liv_', 1, 1, 0, "setdate_livraison", 1, 0); print ''; print '
'; } else { @@ -677,7 +677,7 @@ $nbfreeproduct = 0; // Nb of lins of free products/services $nbproduct = 0; // Nb of predefined product lines to dispatch (already done or not) if SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED is off (default) - // or nb of line that remain to dispatch if SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED is on. + // or nb of line that remain to dispatch if SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED is on. $conf->cache['product'] = array(); @@ -838,13 +838,13 @@ if (!getDolGlobalString('PRODUCT_DISABLE_SELLBY')) { print ''; $dlcdatesuffix = !empty($objd->sellby) ? dol_stringtotime($objd->sellby) : dol_mktime(0, 0, 0, GETPOST('dlc'.$suffix.'month'), GETPOST('dlc'.$suffix.'day'), GETPOST('dlc'.$suffix.'year')); - print $form->selectDate($dlcdatesuffix, 'dlc'.$suffix, '', '', 1, ''); + print $form->selectDate($dlcdatesuffix, 'dlc'.$suffix, 0, 0, 1, ''); print ''; } if (!getDolGlobalString('PRODUCT_DISABLE_EATBY')) { print ''; $dluodatesuffix = !empty($objd->eatby) ? dol_stringtotime($objd->eatby) : dol_mktime(0, 0, 0, GETPOST('dluo'.$suffix.'month'), GETPOST('dluo'.$suffix.'day'), GETPOST('dluo'.$suffix.'year')); - print $form->selectDate($dluodatesuffix, 'dluo'.$suffix, '', '', 1, ''); + print $form->selectDate($dluodatesuffix, 'dluo'.$suffix, 0, 0, 1, ''); print ''; } print ' '; // Supplier ref + Qty ordered + qty already dispatched @@ -895,10 +895,10 @@ print ''; if (isModEnabled('productbatch') && $objp->tobatch > 0) { $type = 'batch'; - print img_picto($langs->trans('AddStockLocationLine'), 'split.png', 'class="splitbutton" '.($numd != $j+1 ? 'style="display:none"' : '').' onClick="addDispatchLine('.$i.', \''.$type.'\')"'); + print img_picto($langs->trans('AddStockLocationLine'), 'split.png', 'class="splitbutton" '.($numd != $j + 1 ? 'style="display:none"' : '').' onClick="addDispatchLine('.$i.', \''.$type.'\')"'); } else { $type = 'dispatch'; - print img_picto($langs->trans('AddStockLocationLine'), 'split.png', 'class="splitbutton" '.($numd != $j+1 ? 'style="display:none"' : '').' onClick="addDispatchLine('.$i.', \''.$type.'\')"'); + print img_picto($langs->trans('AddStockLocationLine'), 'split.png', 'class="splitbutton" '.($numd != $j + 1 ? 'style="display:none"' : '').' onClick="addDispatchLine('.$i.', \''.$type.'\')"'); } print ''; @@ -983,13 +983,13 @@ if (!getDolGlobalString('PRODUCT_DISABLE_SELLBY')) { print ''; $dlcdatesuffix = dol_mktime(0, 0, 0, GETPOST('dlc'.$suffix.'month'), GETPOST('dlc'.$suffix.'day'), GETPOST('dlc'.$suffix.'year')); - print $form->selectDate($dlcdatesuffix, 'dlc'.$suffix, '', '', 1, ''); + print $form->selectDate($dlcdatesuffix, 'dlc'.$suffix, 0, 0, 1, ''); print ''; } if (!getDolGlobalString('PRODUCT_DISABLE_EATBY')) { print ''; $dluodatesuffix = dol_mktime(0, 0, 0, GETPOST('dluo'.$suffix.'month'), GETPOST('dluo'.$suffix.'day'), GETPOST('dluo'.$suffix.'year')); - print $form->selectDate($dluodatesuffix, 'dluo'.$suffix, '', '', 1, ''); + print $form->selectDate($dluodatesuffix, 'dluo'.$suffix, 0, 0, 1, ''); print ''; } print ' '; // Supplier ref + Qty ordered + qty already dispatched diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index fe20c6ed00887..7809b47105b86 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -368,7 +368,7 @@ print '
'; print ''; print ''; - print $form->selectDate($object->delivery_date ? $object->delivery_date : -1, 'liv_', 1, 1, '', "setdate_livraison", 1, 0); + print $form->selectDate($object->delivery_date ? $object->delivery_date : -1, 'liv_', 1, 1, 0, "setdate_livraison", 1, 0); print ''; print '
'; } else { diff --git a/htdocs/expensereport/payment/payment.php b/htdocs/expensereport/payment/payment.php index 0df2d3583a1be..e1de1f7015b46 100644 --- a/htdocs/expensereport/payment/payment.php +++ b/htdocs/expensereport/payment/payment.php @@ -238,7 +238,7 @@ print ''.$langs->trans("Date").''; $datepaid = dol_mktime(12, 0, 0, GETPOSTINT("remonth"), GETPOSTINT("reday"), GETPOSTINT("reyear")); $datepayment = ($datepaid == '' ? (!getDolGlobalString('MAIN_AUTOFILL_DATE') ? -1 : '') : $datepaid); - print $form->selectDate($datepayment, '', '', '', 0, "add_payment", 1, 1); + print $form->selectDate($datepayment, '', 0, 0, 0, "add_payment", 1, 1); print ""; print ''; diff --git a/htdocs/fichinter/card-rec.php b/htdocs/fichinter/card-rec.php index bd1670c51e86b..8e7aad352be2d 100644 --- a/htdocs/fichinter/card-rec.php +++ b/htdocs/fichinter/card-rec.php @@ -97,17 +97,17 @@ $arrayfields = array( - 'f.titre'=>array('label'=>"Ref", 'checked'=>1), - 's.nom'=>array('label'=>"ThirdParty", 'checked'=>1), - 'f.fk_contrat'=>array('label'=>"Contract", 'checked'=>1), - 'f.duree'=>array('label'=>"Duration", 'checked'=>1), - 'f.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>1), - 'f.frequency'=>array('label'=>"RecurringInvoiceTemplate", 'checked'=>1), - 'f.nb_gen_done'=>array('label'=>"NbOfGenerationDoneShort", 'checked'=>1), - 'f.date_last_gen'=>array('label'=>"DateLastGeneration", 'checked'=>1), - 'f.date_when'=>array('label'=>"NextDateToExecution", 'checked'=>1), - 'f.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500), - 'f.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500), + 'f.titre' => array('label' => "Ref", 'checked' => 1), + 's.nom' => array('label' => "ThirdParty", 'checked' => 1), + 'f.fk_contrat' => array('label' => "Contract", 'checked' => 1), + 'f.duree' => array('label' => "Duration", 'checked' => 1), + 'f.total_ttc' => array('label' => "AmountTTC", 'checked' => 1), + 'f.frequency' => array('label' => "RecurringInvoiceTemplate", 'checked' => 1), + 'f.nb_gen_done' => array('label' => "NbOfGenerationDoneShort", 'checked' => 1), + 'f.date_last_gen' => array('label' => "DateLastGeneration", 'checked' => 1), + 'f.date_when' => array('label' => "NextDateToExecution", 'checked' => 1), + 'f.datec' => array('label' => "DateCreation", 'checked' => 0, 'position' => 500), + 'f.tms' => array('label' => "DateModificationShort", 'checked' => 0, 'position' => 500), ); @@ -378,7 +378,7 @@ print $form->textwithpicto($langs->trans("Frequency"), $langs->transnoentitiesnoconv('toolTipFrequency')); print ""; print ' '; - print $form->selectarray('unit_frequency', array('d'=>$langs->trans('Day'), 'm'=>$langs->trans('Month'), 'y'=>$langs->trans('Year')), (GETPOST('unit_frequency') ? GETPOST('unit_frequency') : 'm')); + print $form->selectarray('unit_frequency', array('d' => $langs->trans('Day'), 'm' => $langs->trans('Month'), 'y' => $langs->trans('Year')), (GETPOST('unit_frequency') ? GETPOST('unit_frequency') : 'm')); print ""; // First date of execution for cron @@ -386,7 +386,7 @@ if (empty($date_next_execution)) { $date_next_execution = (GETPOST('remonth') ? dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')) : -1); } - print $form->selectDate($date_next_execution, '', 1, 1, '', "add", 1, 1); + print $form->selectDate($date_next_execution, '', 1, 1, 0, "add", 1, 1); print ""; // Number max of generation @@ -625,7 +625,7 @@ print ''; print ''; print ''; print '
'; print ' '; - print $form->selectarray('unit_frequency', array('d'=>$langs->trans('Day'), 'm'=>$langs->trans('Month'), 'y'=>$langs->trans('Year')), ($object->unit_frequency ? $object->unit_frequency : 'm')); + print $form->selectarray('unit_frequency', array('d' => $langs->trans('Day'), 'm' => $langs->trans('Month'), 'y' => $langs->trans('Year')), ($object->unit_frequency ? $object->unit_frequency : 'm')); print '
'; diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 85de2e7fb6fc8..e3729dc742359 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1769,7 +1769,7 @@ $usehourmin = 1; } print img_picto('', 'action', 'class="pictofixedwidth"'); - print $form->selectDate($datelivraison ? $datelivraison : -1, 'liv_', $usehourmin, $usehourmin, '', "set"); + print $form->selectDate($datelivraison ? $datelivraison : -1, 'liv_', $usehourmin, $usehourmin, 0, "set"); print ''; // Bank Account @@ -2289,7 +2289,7 @@ if (getDolGlobalString('SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE')) { $usehourmin = 1; } - print $form->selectDate($object->delivery_date ? $object->delivery_date : -1, 'liv_', $usehourmin, $usehourmin, '', "setdate_livraison"); + print $form->selectDate($object->delivery_date ? $object->delivery_date : -1, 'liv_', $usehourmin, $usehourmin, 0, "setdate_livraison"); print ''; print ''; } else { @@ -2695,7 +2695,7 @@ //print ''.$langs->trans("ToOrder").''; print ''.$langs->trans("OrderDate").''; $date_com = dol_mktime(GETPOSTINT('rehour'), GETPOSTINT('remin'), GETPOSTINT('resec'), GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear')); - print $form->selectDate($date_com ?: '', '', 0, 0, '', "commande", 1, 1); + print $form->selectDate($date_com ?: '', '', 0, 0, 0, "commande", 1, 1); print ''; // Force mandatory order method @@ -2756,7 +2756,7 @@ //print ''.$langs->trans("Receive").''; print ''.$langs->trans("DeliveryDate").''; $datepreselected = dol_now(); - print $form->selectDate($datepreselected, '', 1, 1, '', "commande", 1, 1); + print $form->selectDate($datepreselected, '', 1, 1, 0, "commande", 1, 1); print "\n"; print ''.$langs->trans("Delivery")."\n"; diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 61193e3e70737..6b4574ed2a981 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -794,7 +794,7 @@ $nbfreeproduct = 0; // Nb of lins of free products/services $nbproduct = 0; // Nb of predefined product lines to dispatch (already done or not) if SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED is off (default) - // or nb of line that remain to dispatch if SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED is on. + // or nb of line that remain to dispatch if SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED is on. $conf->cache['product'] = array(); @@ -937,13 +937,13 @@ if (!getDolGlobalString('PRODUCT_DISABLE_SELLBY')) { print ''; $dlcdatesuffix = dol_mktime(0, 0, 0, GETPOST('dlc'.$suffix.'month'), GETPOST('dlc'.$suffix.'day'), GETPOST('dlc'.$suffix.'year')); - print $form->selectDate($dlcdatesuffix, 'dlc'.$suffix, '', '', 1, ''); + print $form->selectDate($dlcdatesuffix, 'dlc'.$suffix, 0, 0, 1, ''); print ''; } if (!getDolGlobalString('PRODUCT_DISABLE_EATBY')) { print ''; $dluodatesuffix = dol_mktime(0, 0, 0, GETPOST('dluo'.$suffix.'month'), GETPOST('dluo'.$suffix.'day'), GETPOST('dluo'.$suffix.'year')); - print $form->selectDate($dluodatesuffix, 'dluo'.$suffix, '', '', 1, ''); + print $form->selectDate($dluodatesuffix, 'dluo'.$suffix, 0, 0, 1, ''); print ''; } print ' '; // Supplier ref + Qty ordered + qty already dispatched diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 68f6d8f0af2fb..c4d93209600af 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -181,28 +181,28 @@ // Definition of array of fields for columns $arrayfields = array( - 'u.login'=>array('label'=>"AuthorRequest", 'enabled'=>1, 'position'=>41), - 's.name_alias'=>array('label'=>"AliasNameShort", 'position'=>51, 'checked'=>0), - 's.town'=>array('label'=>"Town", 'enabled'=>1, 'position'=>55, 'checked'=>1), - 's.zip'=>array('label'=>"Zip", 'enabled'=>1, 'position'=>56, 'checked'=>1), - 'state.nom'=>array('label'=>"StateShort", 'enabled'=>1, 'position'=>57), - 'country.code_iso'=>array('label'=>"Country", 'enabled'=>1, 'position'=>58), - 'typent.code'=>array('label'=>"ThirdPartyType", 'enabled'=>$checkedtypetiers, 'position'=>59), - 'cf.total_localtax1'=>array('label'=>$langs->transcountry("AmountLT1", $mysoc->country_code), 'checked'=>0, 'enabled'=>($mysoc->localtax1_assuj == "1"), 'position'=>140), - 'cf.total_localtax2'=>array('label'=>$langs->transcountry("AmountLT2", $mysoc->country_code), 'checked'=>0, 'enabled'=>($mysoc->localtax2_assuj == "1"), 'position'=>145), - 'cf.note_public'=>array('label'=>'NotePublic', 'checked'=>0, 'enabled'=>(!getDolGlobalInt('MAIN_LIST_HIDE_PUBLIC_NOTES')), 'position'=>750), - 'cf.note_private'=>array('label'=>'NotePrivate', 'checked'=>0, 'enabled'=>(!getDolGlobalInt('MAIN_LIST_HIDE_PRIVATE_NOTES')), 'position'=>760), + 'u.login' => array('label' => "AuthorRequest", 'enabled' => 1, 'position' => 41), + 's.name_alias' => array('label' => "AliasNameShort", 'position' => 51, 'checked' => 0), + 's.town' => array('label' => "Town", 'enabled' => 1, 'position' => 55, 'checked' => 1), + 's.zip' => array('label' => "Zip", 'enabled' => 1, 'position' => 56, 'checked' => 1), + 'state.nom' => array('label' => "StateShort", 'enabled' => 1, 'position' => 57), + 'country.code_iso' => array('label' => "Country", 'enabled' => 1, 'position' => 58), + 'typent.code' => array('label' => "ThirdPartyType", 'enabled' => $checkedtypetiers, 'position' => 59), + 'cf.total_localtax1' => array('label' => $langs->transcountry("AmountLT1", $mysoc->country_code), 'checked' => 0, 'enabled' => ($mysoc->localtax1_assuj == "1"), 'position' => 140), + 'cf.total_localtax2' => array('label' => $langs->transcountry("AmountLT2", $mysoc->country_code), 'checked' => 0, 'enabled' => ($mysoc->localtax2_assuj == "1"), 'position' => 145), + 'cf.note_public' => array('label' => 'NotePublic', 'checked' => 0, 'enabled' => (!getDolGlobalInt('MAIN_LIST_HIDE_PUBLIC_NOTES')), 'position' => 750), + 'cf.note_private' => array('label' => 'NotePrivate', 'checked' => 0, 'enabled' => (!getDolGlobalInt('MAIN_LIST_HIDE_PRIVATE_NOTES')), 'position' => 760), ); foreach ($object->fields as $key => $val) { // If $val['visible']==0, then we never show the field if (!empty($val['visible'])) { $visible = (int) dol_eval($val['visible'], 1); $arrayfields['cf.'.$key] = array( - 'label'=>$val['label'], - 'checked'=>(($visible < 0) ? 0 : 1), - 'enabled'=>(abs($visible) != 3 && (int) dol_eval($val['enabled'], 1)), - 'position'=>$val['position'], - 'help'=> isset($val['help']) ? $val['help'] : '' + 'label' => $val['label'], + 'checked' => (($visible < 0) ? 0 : 1), + 'enabled' => (abs($visible) != 3 && (int) dol_eval($val['enabled'], 1)), + 'position' => $val['position'], + 'help' => isset($val['help']) ? $val['help'] : '' ); } } @@ -244,7 +244,7 @@ $massaction = ''; } -$parameters = array('socid'=>$socid, 'arrayfields'=>&$arrayfields); +$parameters = array('socid' => $socid, 'arrayfields' => &$arrayfields); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -380,7 +380,7 @@ $db->begin(); - $default_ref_supplier=dol_print_date(dol_now(), '%Y%m%d%H%M%S'); + $default_ref_supplier = dol_print_date(dol_now(), '%Y%m%d%H%M%S'); foreach ($orders as $id_order) { $cmd = new CommandeFournisseur($db); @@ -405,7 +405,7 @@ $objecttmp->fk_project = $cmd->fk_project; $objecttmp->multicurrency_code = $cmd->multicurrency_code; $objecttmp->ref_supplier = !empty($cmd->ref_supplier) ? $cmd->ref_supplier : $default_ref_supplier; - $default_ref_supplier+=1; + $default_ref_supplier += 1; $datefacture = dol_mktime(12, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear')); if (empty($datefacture)) { @@ -1181,9 +1181,9 @@ // List of mass actions available $arrayofmassactions = array( - 'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"), - 'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), - 'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), + 'generate_doc' => img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"), + 'builddoc' => img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), + 'presend' => img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), ); if ($permissiontovalidate) { @@ -1211,8 +1211,8 @@ $url .= '&backtopage='.urlencode(DOL_URL_ROOT.'/fourn/commande/list.php?socid='.((int) $socid)); } $newcardbutton = ''; - $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); - $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss' => 'reposition')); + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss' => 'reposition')); $newcardbutton .= dolGetButtonTitleSeparator(); $newcardbutton .= dolGetButtonTitle($langs->trans('NewSupplierOrderShort'), '', 'fa fa-plus-circle', $url, '', $permissiontoadd); @@ -1252,7 +1252,7 @@ print $langs->trans('DateInvoice'); print ''; print ''; - print $form->selectDate('', '', '', '', '', '', 1, 1); + print $form->selectDate('', '', 0, 0, 0, '', 1, 1); print ''; print ''; print ''; @@ -1479,7 +1479,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook - $parameters = array('arrayfields'=>$arrayfields); + $parameters = array('arrayfields' => $arrayfields); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation @@ -1646,7 +1646,7 @@ // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields - $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); + $parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (!empty($arrayfields['cf.date_creation']['checked'])) { @@ -1738,7 +1738,7 @@ $thirdpartytmp->client = $obj->client; $thirdpartytmp->fournisseur = $obj->fournisseur; // Output Kanban - print $objectstatic->getKanbanView('', array('thirdparty'=>$thirdpartytmp->getNomUrl('supplier', 0, 0, -1), 'selected' => in_array($objectstatic->id, $arrayofselected))); + print $objectstatic->getKanbanView('', array('thirdparty' => $thirdpartytmp->getNomUrl('supplier', 0, 0, -1), 'selected' => in_array($objectstatic->id, $arrayofselected))); if ($i == ($imaxinloop - 1)) { print ''; print ''; @@ -1988,7 +1988,7 @@ // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $parameters = array('arrayfields' => $arrayfields, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation @@ -2102,7 +2102,7 @@ $db->free($resql); - $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); + $parameters = array('arrayfields' => $arrayfields, 'sql' => $sql); $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; diff --git a/htdocs/fourn/facture/card-rec.php b/htdocs/fourn/facture/card-rec.php index c3d748e81d1a5..d8f899d7bb154 100644 --- a/htdocs/fourn/facture/card-rec.php +++ b/htdocs/fourn/facture/card-rec.php @@ -1044,7 +1044,7 @@ // Date next run print "" . $langs->trans('NextDateToExecution') . ""; $date_next_execution = isset($date_next_execution) ? $date_next_execution : (GETPOST('remonth') ? dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')) : -1); - print $form->selectDate($date_next_execution, '', 1, 1, '', "add", 1, 1); + print $form->selectDate($date_next_execution, '', 1, 1, 0, "add", 1, 1); print ""; // Number max of generation diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 8244ed6e8afca..1e13db22978d0 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2645,7 +2645,7 @@ function setRadioForTypeOfInvoice() { // Date invoice print ''.$langs->trans('DateInvoice').''; print img_picto('', 'action', 'class="pictofixedwidth"'); - print $form->selectDate($dateinvoice, '', '', '', '', "add", 1, 1); + print $form->selectDate($dateinvoice, '', 0, 0, 0, "add", 1, 1); print ''; // Payment term @@ -2658,7 +2658,7 @@ function setRadioForTypeOfInvoice() { // Due date print ''.$langs->trans('DateMaxPayment').''; print img_picto('', 'action', 'class="pictofixedwidth"'); - print $form->selectDate($datedue, 'ech', '', '', '', "add", 1, 1); + print $form->selectDate($datedue, 'ech', 0, 0, 0, "add", 1, 1); print ''; // Payment mode diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 4f1c81602a1e8..e495c2e3f9edf 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -140,7 +140,7 @@ $search_array_options = array(); } -$parameters = array('socid'=>$socid); +$parameters = array('socid' => $socid); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -513,9 +513,9 @@ function callForResult(imgId) print ''.$langs->trans('Date').''; // $object is default vendor invoice - $adddateof = array(array('adddateof'=>$object->date)); - $adddateof[] = array('adddateof'=>$object->date_echeance, 'labeladddateof'=>$langs->transnoentities('DateDue')); - print $form->selectDate($dateinvoice, '', '', '', 0, "addpaiement", 1, 1, 0, '', '', $adddateof); + $adddateof = array(array('adddateof' => $object->date)); + $adddateof[] = array('adddateof' => $object->date_echeance, 'labeladddateof' => $langs->transnoentities('DateDue')); + print $form->selectDate($dateinvoice, '', 0, 0, 0, "addpaiement", 1, 1, 0, '', '', $adddateof); print ''; print ''.$langs->trans('PaymentMode').''; $form->select_types_paiements(!GETPOST('paiementid') ? $obj->fk_mode_reglement : GETPOST('paiementid'), 'paiementid'); @@ -536,7 +536,7 @@ function callForResult(imgId) print dol_get_fiche_end(); - $parameters = array('facid'=>$facid, 'ref'=>$ref, 'objcanvas'=>$objcanvas); + $parameters = array('facid' => $facid, 'ref' => $ref, 'objcanvas' => $objcanvas); $reshook = $hookmanager->executeHooks('paymentsupplierinvoices', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $error = $hookmanager->error; $errors = $hookmanager->errors; diff --git a/htdocs/langs/en_US/resource.lang b/htdocs/langs/en_US/resource.lang index 8f117e93bc900..391ba469932bc 100644 --- a/htdocs/langs/en_US/resource.lang +++ b/htdocs/langs/en_US/resource.lang @@ -9,6 +9,7 @@ ActionsOnResource=Events about this resource ResourcePageIndex=Resources list ResourceSingular=Resource ResourceCard=Resource card +NewResource=New resource AddResource=Create a resource ResourceFormLabel_ref=Resource name ResourceType=Resource type diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index fc41bac9d6bcb..17fd78aa8c109 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -306,13 +306,13 @@ // Date Start print ""; print ''.$langs->trans("DateStart").''; - print $form->selectDate(!empty($datestart) ? $datestart : -1, 'start', '', '', '', 'add', 1, 1); + print $form->selectDate(!empty($datestart) ? $datestart : -1, 'start', 0, 0, 0, 'add', 1, 1); print ''; // Date End print ""; print ''.$langs->trans("DateEnd").''; - print $form->selectDate(!empty($dateend) ? $dateend : -1, 'end', '', '', '', 'add', 1, 1); + print $form->selectDate(!empty($dateend) ? $dateend : -1, 'end', 0, 0, 0, 'add', 1, 1); print ''; // Number of terms diff --git a/htdocs/loan/class/loan.class.php b/htdocs/loan/class/loan.class.php index 20f51e90e78cf..466dde2cef327 100644 --- a/htdocs/loan/class/loan.class.php +++ b/htdocs/loan/class/loan.class.php @@ -501,21 +501,23 @@ public function LibStatut($status, $mode = 0, $alreadypaid = -1) $langs->loadLangs(array("customers", "bills")); unset($this->labelStatus); // Force to reset the array of status label, because label can change depending on parameters - if (empty($this->labelStatus) || empty($this->labelStatusShort)) { - global $langs; - $this->labelStatus[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv('Unpaid'); - $this->labelStatus[self::STATUS_PAID] = $langs->transnoentitiesnoconv('Paid'); - $this->labelStatus[self::STATUS_STARTED] = $langs->transnoentitiesnoconv("BillStatusStarted"); - if ($status == 0 && $alreadypaid > 0) { - $this->labelStatus[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv("BillStatusStarted"); - } - $this->labelStatusShort[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv('Unpaid'); - $this->labelStatusShort[self::STATUS_PAID] = $langs->transnoentitiesnoconv('Paid'); - $this->labelStatusShort[self::STATUS_STARTED] = $langs->transnoentitiesnoconv("BillStatusStarted"); - if ($status == 0 && $alreadypaid > 0) { - $this->labelStatusShort[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv("BillStatusStarted"); - } + // Always true because of 'unset': + // if (empty($this->labelStatus) || empty($this->labelStatusShort)) { + global $langs; + $this->labelStatus = array(); + $this->labelStatus[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv('Unpaid'); + $this->labelStatus[self::STATUS_PAID] = $langs->transnoentitiesnoconv('Paid'); + $this->labelStatus[self::STATUS_STARTED] = $langs->transnoentitiesnoconv("BillStatusStarted"); + if ($status == 0 && $alreadypaid > 0) { + $this->labelStatus[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv("BillStatusStarted"); + } + $this->labelStatusShort[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv('Unpaid'); + $this->labelStatusShort[self::STATUS_PAID] = $langs->transnoentitiesnoconv('Paid'); + $this->labelStatusShort[self::STATUS_STARTED] = $langs->transnoentitiesnoconv("BillStatusStarted"); + if ($status == 0 && $alreadypaid > 0) { + $this->labelStatusShort[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv("BillStatusStarted"); } + // } // End of empty(labelStatus,labelStatusShort) $statusType = 'status1'; if (($status == 0 && $alreadypaid > 0) || $status == self::STATUS_STARTED) { @@ -594,7 +596,7 @@ public function getNomUrl($withpicto = 0, $maxlen = 0, $option = '', $notooltip global $action; $hookmanager->initHooks(array($this->element . 'dao')); - $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $parameters = array('id' => $this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/loan/payment/payment.php b/htdocs/loan/payment/payment.php index 27b011201959f..ece271b9135a1 100644 --- a/htdocs/loan/payment/payment.php +++ b/htdocs/loan/payment/payment.php @@ -289,7 +289,7 @@ } else { $datepayment = $datepaid; } - print $form->selectDate($datepayment, '', '', '', '', "add_payment", 1, 1); + print $form->selectDate($datepayment, '', 0, 0, 0, "add_payment", 1, 1); print ""; print ''; diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php index af35d75201f71..3c2fa4bca90bb 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -129,11 +129,11 @@ // Start date print ''.$langs->trans('DateStart').' ('.$langs->trans("DateValidation").')'; print ''; -print $form->selectDate($startdate, 'startdate', '', '', 1, "sel", 1, 1); +print $form->selectDate($startdate, 'startdate', 0, 0, 1, "sel", 1, 1); print ''; print ''.$langs->trans('DateEnd').' ('.$langs->trans("DateValidation").')'; print ''; -print $form->selectDate($enddate, 'enddate', '', '', 1, "sel", 1, 1); +print $form->selectDate($enddate, 'enddate', 0, 0, 1, "sel", 1, 1); print ''; print ''; print ''; diff --git a/htdocs/margin/checkMargins.php b/htdocs/margin/checkMargins.php index de7822b6198f3..5cdee16619b70 100644 --- a/htdocs/margin/checkMargins.php +++ b/htdocs/margin/checkMargins.php @@ -190,11 +190,11 @@ print ''.$langs->trans('DateStart').' ('.$langs->trans("DateValidation").')'; print ''; -print $form->selectDate($startdate, 'startdate', '', '', 1, "sel", 1, 1); +print $form->selectDate($startdate, 'startdate', 0, 0, 1, "sel", 1, 1); print ''; print ''.$langs->trans('DateEnd').' ('.$langs->trans("DateValidation").')'; print ''; -print $form->selectDate($enddate, 'enddate', '', '', 1, "sel", 1, 1); +print $form->selectDate($enddate, 'enddate', 0, 0, 1, "sel", 1, 1); print ''; print ''; print ''; diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php index d30ef558ecf10..b81567d7b0986 100644 --- a/htdocs/margin/customerMargins.php +++ b/htdocs/margin/customerMargins.php @@ -170,11 +170,11 @@ // Start date print ''.$langs->trans('DateStart').' ('.$langs->trans("DateValidation").')'; print ''; -print $form->selectDate($startdate, 'startdate', '', '', 1, "sel", 1, 1); +print $form->selectDate($startdate, 'startdate', 0, 0, 1, "sel", 1, 1); print ''; print ''.$langs->trans('DateEnd').' ('.$langs->trans("DateValidation").')'; print ''; -print $form->selectDate($enddate, 'enddate', '', '', 1, "sel", 1, 1); +print $form->selectDate($enddate, 'enddate', 0, 0, 1, "sel", 1, 1); print ''; print ''; print ''; diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index fb1604c6d9fb1..e6837605980f4 100644 --- a/htdocs/margin/productMargins.php +++ b/htdocs/margin/productMargins.php @@ -134,11 +134,11 @@ print ''; print ''.$langs->trans('DateStart').' ('.$langs->trans("DateValidation").')'; print ''; -print $form->selectDate($startdate, 'startdate', '', '', 1, "sel", 1, 1); +print $form->selectDate($startdate, 'startdate', 0, 0, 1, "sel", 1, 1); print ''; print ''.$langs->trans('DateEnd').' ('.$langs->trans("DateValidation").')'; print ''; -print $form->selectDate($enddate, 'enddate', '', '', 1, "sel", 1, 1); +print $form->selectDate($enddate, 'enddate', 0, 0, 1, "sel", 1, 1); print ''; print ''; print ''; diff --git a/htdocs/opensurvey/wizard/create_survey.php b/htdocs/opensurvey/wizard/create_survey.php index 61f5a1ef7d5dd..084d768ce050d 100644 --- a/htdocs/opensurvey/wizard/create_survey.php +++ b/htdocs/opensurvey/wizard/create_survey.php @@ -151,7 +151,7 @@ print ''.$langs->trans("ExpireDate").''; -print $form->selectDate($champdatefin ? $champdatefin : -1, 'champdatefin', '', '', '', "add", 1, 0); +print $form->selectDate($champdatefin ? $champdatefin : -1, 'champdatefin', 0, 0, 0, "add", 1, 0); print ''."\n"; print ''."\n"; diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 6361cea7a8d9c..456460e2b213f 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -144,7 +144,7 @@ $action = ''; } -$parameters = array('id'=>$id, 'ref'=>$ref, 'objcanvas'=>$objcanvas); +$parameters = array('id' => $id, 'ref' => $ref, 'objcanvas' => $objcanvas); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -1147,12 +1147,12 @@ print ''; if (!getDolGlobalString('PRODUCT_DISABLE_SELLBY')) { print ''; - print $form->selectDate($pdluo->sellby, 'sellby', '', '', 1, '', 1, 0); + print $form->selectDate($pdluo->sellby, 'sellby', 0, 0, 1, '', 1, 0); print ''; } if (!getDolGlobalString('PRODUCT_DISABLE_EATBY')) { print ''; - print $form->selectDate($pdluo->eatby, 'eatby', '', '', 1, '', 1, 0); + print $form->selectDate($pdluo->eatby, 'eatby', 0, 0, 1, '', 1, 0); print ''; } print ''.$pdluo->qty.($pdluo->qty < 0 ? ' '.img_warning() : '').''; diff --git a/htdocs/product/stock/tpl/stockcorrection.tpl.php b/htdocs/product/stock/tpl/stockcorrection.tpl.php index b393de2bc48fd..87f6acee4865f 100644 --- a/htdocs/product/stock/tpl/stockcorrection.tpl.php +++ b/htdocs/product/stock/tpl/stockcorrection.tpl.php @@ -105,7 +105,7 @@ function init_price() });'; if ($disableSellBy == 0 || $disableEatBy == 0) { - print ' + print ' var disableSellBy = '.dol_escape_js($disableSellBy).'; var disableEatBy = '.dol_escape_js($disableSellBy).'; jQuery("#batch_number").change(function(event) { @@ -206,14 +206,14 @@ function init_price() print ''.$langs->trans("SellByDate").''; $sellbyselected = dol_mktime(0, 0, 0, GETPOST('sellbymonth'), GETPOST('sellbyday'), GETPOST('sellbyyear')); // If form was opened for a specific pdluoid, field is disabled - print $form->selectDate(($pdluo->id > 0 ? $pdluo->sellby : $sellbyselected), 'sellby', '', '', 1, "", 1, 0, ($pdluoid > 0 ? 1 : 0)); + print $form->selectDate(($pdluo->id > 0 ? $pdluo->sellby : $sellbyselected), 'sellby', 0, 0, 1, "", 1, 0, ($pdluoid > 0 ? 1 : 0)); print ''; } if (!getDolGlobalString('PRODUCT_DISABLE_EATBY')) { print ''.$langs->trans("EatByDate").''; $eatbyselected = dol_mktime(0, 0, 0, GETPOST('eatbymonth'), GETPOST('eatbyday'), GETPOST('eatbyyear')); // If form was opened for a specific pdluoid, field is disabled - print $form->selectDate(($pdluo->id > 0 ? $pdluo->eatby : $eatbyselected), 'eatby', '', '', 1, "", 1, 0, ($pdluoid > 0 ? 1 : 0)); + print $form->selectDate(($pdluo->id > 0 ? $pdluo->eatby : $eatbyselected), 'eatby', 0, 0, 1, "", 1, 0, ($pdluoid > 0 ? 1 : 0)); print ''; } print ''; diff --git a/htdocs/product/stock/tpl/stocktransfer.tpl.php b/htdocs/product/stock/tpl/stocktransfer.tpl.php index b5bf80f894703..b24230fdf3847 100644 --- a/htdocs/product/stock/tpl/stocktransfer.tpl.php +++ b/htdocs/product/stock/tpl/stocktransfer.tpl.php @@ -112,12 +112,12 @@ print ''; if (!getDolGlobalString('PRODUCT_DISABLE_SELLBY')) { print ''.$langs->trans("SellByDate").''; - print $form->selectDate((!empty($d_sellby) ? $d_sellby : $pdluo->sellby), 'sellby', '', '', 1, "", 1, 0, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled + print $form->selectDate((!empty($d_sellby) ? $d_sellby : $pdluo->sellby), 'sellby', 0, 0, 1, "", 1, 0, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled print ''; } if (!getDolGlobalString('PRODUCT_DISABLE_EATBY')) { print ''.$langs->trans("EatByDate").''; - print $form->selectDate((!empty($d_eatby) ? $d_eatby : $pdluo->eatby), 'eatby', '', '', 1, "", 1, 0, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled + print $form->selectDate((!empty($d_eatby) ? $d_eatby : $pdluo->eatby), 'eatby', 0, 0, 1, "", 1, 0, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled print ''; } print ''; diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 5f079bb44e952..32e47dcfb83a7 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -1418,7 +1418,7 @@ print $langs->trans('DateInvoice'); print ''; print ''; - print $form->selectDate('', '', '', '', '', '', 1, 1); + print $form->selectDate('', '', 0, 0, 0, '', 1, 1); print ''; print ''; diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 1c633da8e302c..c4a27f64b5a09 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -919,7 +919,7 @@ print "\n"; // Other attributes - $parameters = array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"', 'cols' => '3', 'socid'=>$socid); + $parameters = array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"', 'cols' => '3', 'socid' => $socid); $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $recept, $action); // Note that $action and $objectsrc may have been modified by hook print $hookmanager->resPrint; @@ -985,7 +985,7 @@ $ent = "entrepot_" . $paramSuffix; $pu = "pu_" . $paramSuffix; // This is unit price including discount $fk_commandefourndet = "fk_commandefourndet_" . $paramSuffix; - $dispatchLines[$numAsked] = array('paramSuffix'=>$paramSuffix, 'prod' => GETPOSTINT($prod), 'qty' => price2num(GETPOST($qty), 'MS'), 'ent' => GETPOSTINT($ent), 'pu' => price2num(GETPOST($pu), 'MU'), 'comment' => GETPOST('comment'), 'fk_commandefourndet' => GETPOSTINT($fk_commandefourndet)); + $dispatchLines[$numAsked] = array('paramSuffix' => $paramSuffix, 'prod' => GETPOSTINT($prod), 'qty' => price2num(GETPOST($qty), 'MS'), 'ent' => GETPOSTINT($ent), 'pu' => price2num(GETPOST($pu), 'MU'), 'comment' => GETPOST('comment'), 'fk_commandefourndet' => GETPOSTINT($fk_commandefourndet)); } // with batch module enabled and product with lot/serial @@ -1006,7 +1006,7 @@ $dDLUO = dol_mktime(12, 0, 0, GETPOSTINT('dluo_'.$paramSuffix.'month'), GETPOSTINT('dluo_'.$paramSuffix.'day'), GETPOSTINT('dluo_'.$paramSuffix.'year')); $dDLC = dol_mktime(12, 0, 0, GETPOSTINT('dlc_'.$paramSuffix.'month'), GETPOSTINT('dlc_'.$paramSuffix.'day'), GETPOSTINT('dlc_'.$paramSuffix.'year')); $fk_commandefourndet = 'fk_commandefourndet_'.$paramSuffix; - $dispatchLines[$numAsked] = array('paramSuffix'=>$paramSuffix, 'prod' => GETPOSTINT($prod), 'qty' => price2num(GETPOST($qty), 'MS'), 'ent' => GETPOSTINT($ent), 'pu' => price2num(GETPOST($pu), 'MU'), 'comment' => GETPOST('comment'), 'fk_commandefourndet' => GETPOSTINT($fk_commandefourndet), 'DLC'=> $dDLC, 'DLUO'=> $dDLUO, 'lot'=> GETPOSTINT($lot)); + $dispatchLines[$numAsked] = array('paramSuffix' => $paramSuffix, 'prod' => GETPOSTINT($prod), 'qty' => price2num(GETPOST($qty), 'MS'), 'ent' => GETPOSTINT($ent), 'pu' => price2num(GETPOST($pu), 'MU'), 'comment' => GETPOST('comment'), 'fk_commandefourndet' => GETPOSTINT($fk_commandefourndet), 'DLC' => $dDLC, 'DLUO' => $dDLUO, 'lot' => GETPOSTINT($lot)); } // If create form is coming from same page, it means that post was sent but an error occurred @@ -1028,7 +1028,7 @@ $dDLUO = dol_mktime(12, 0, 0, GETPOSTINT('dluo'.$paramSuffix.'month'), GETPOSTINT('dluo'.$paramSuffix.'day'), GETPOSTINT('dluo'.$paramSuffix.'year')); $dDLC = dol_mktime(12, 0, 0, GETPOSTINT('dlc'.$paramSuffix.'month'), GETPOSTINT('dlc'.$paramSuffix.'day'), GETPOSTINT('dlc'.$paramSuffix.'year')); $fk_commandefourndet = 'fk_commandefournisseurdet'.$paramSuffix; - $dispatchLines[$numAsked] = array('prod' => GETPOSTINT($prod), 'qty' => price2num(GETPOST($qty), 'MS'), 'ent' =>GETPOSTINT($ent), 'pu' => price2num(GETPOST($pu), 'MU'), 'comment' =>GETPOST($comment), 'fk_commandefourndet' => GETPOSTINT($fk_commandefourndet), 'DLC'=> $dDLC, 'DLUO'=> $dDLUO, 'lot'=> GETPOSTINT($lot)); + $dispatchLines[$numAsked] = array('prod' => GETPOSTINT($prod), 'qty' => price2num(GETPOST($qty), 'MS'), 'ent' => GETPOSTINT($ent), 'pu' => price2num(GETPOST($pu), 'MU'), 'comment' => GETPOST($comment), 'fk_commandefourndet' => GETPOSTINT($fk_commandefourndet), 'DLC' => $dDLC, 'DLUO' => $dDLUO, 'lot' => GETPOSTINT($lot)); } } @@ -1100,7 +1100,7 @@ // $objectsrc->lines contains the line of the purchase order // $dispatchLines is list of lines with dispatching detail (with product, qty and warehouse). One purchase order line may have n of this dispatch lines. - $arrayofpurchaselinealreadyoutput= array(); + $arrayofpurchaselinealreadyoutput = array(); // $_POST contains fk_commandefourndet_X_Y where Y is num of product line and X is number of split lines $indiceAsked = 1; @@ -1271,12 +1271,12 @@ print ''; if (!getDolGlobalString('PRODUCT_DISABLE_SELLBY')) { print ''; - print $form->selectDate($dispatchLines[$indiceAsked]['DLC'], 'dlc'.$indiceAsked, '', '', 1, ""); + print $form->selectDate($dispatchLines[$indiceAsked]['DLC'], 'dlc'.$indiceAsked, 0, 0, 1, ""); print ''; } if (!getDolGlobalString('PRODUCT_DISABLE_EATBY')) { print ''; - print $form->selectDate($dispatchLines[$indiceAsked]['DLUO'], 'dluo'.$indiceAsked, '', '', 1, ""); + print $form->selectDate($dispatchLines[$indiceAsked]['DLUO'], 'dluo'.$indiceAsked, 0, 0, 1, ""); print ''; } } else { @@ -1313,7 +1313,7 @@ } $recLine->array_options = array_merge($recLine->array_options, $srcLine->array_options); - print $recLine->showOptionals($extrafields, 'edit', array('style'=>'class="oddeven"', 'colspan'=>$colspan), $indiceAsked, '', 1); + print $recLine->showOptionals($extrafields, 'edit', array('style' => 'class="oddeven"', 'colspan' => $colspan), $indiceAsked, '', 1); } $indiceAsked++; @@ -1524,7 +1524,7 @@ print '
'; print ''; print ''; - print $form->selectDate($object->date_delivery ? $object->date_delivery : -1, 'liv_', 1, 1, '', "setdate_livraison", 1, 0); + print $form->selectDate($object->date_delivery ? $object->date_delivery : -1, 'liv_', 1, 1, 0, "setdate_livraison", 1, 0); print ''; print '
'; } else { @@ -1840,7 +1840,7 @@ $obj = $db->fetch_object($resql); if ($obj) { // $obj->rowid is rowid in $origin."det" table - $alreadysent[$obj->rowid][$obj->receptionline_id] = array('reception_ref'=>$obj->reception_ref, 'reception_id'=>$obj->reception_id, 'warehouse'=>$obj->fk_entrepot, 'qty'=>$obj->qty, 'date_valid'=>$obj->date_valid, 'date_delivery'=>$obj->date_delivery); + $alreadysent[$obj->rowid][$obj->receptionline_id] = array('reception_ref' => $obj->reception_ref, 'reception_id' => $obj->reception_id, 'warehouse' => $obj->fk_entrepot, 'qty' => $obj->qty, 'date_valid' => $obj->date_valid, 'date_delivery' => $obj->date_delivery); } $i++; } @@ -1976,11 +1976,11 @@ print '
'; if (!getDolGlobalString('PRODUCT_DISABLE_SELLBY')) { print $langs->trans('SellByDate').' : '; - print $form->selectDate($lines[$i]->sellby, 'dlc'.$line_id, '', '', 1, "").'
'; + print $form->selectDate($lines[$i]->sellby, 'dlc'.$line_id, 0, 0, 1, "").'
'; } if (!getDolGlobalString('PRODUCT_DISABLE_EATBY')) { print $langs->trans('EatByDate').' : '; - print $form->selectDate($lines[$i]->eatby, 'dluo'.$line_id, '', '', 1, ""); + print $form->selectDate($lines[$i]->eatby, 'dluo'.$line_id, 0, 0, 1, ""); } print ''; } @@ -2107,9 +2107,9 @@ $line->fetch_optionals(); if ($action == 'editline' && $lines[$i]->id == $line_id) { - print $line->showOptionals($extrafields, 'edit', array('colspan'=>$colspan), ''); + print $line->showOptionals($extrafields, 'edit', array('colspan' => $colspan), ''); } else { - print $line->showOptionals($extrafields, 'view', array('colspan'=>$colspan), ''); + print $line->showOptionals($extrafields, 'view', array('colspan' => $colspan), ''); } } } diff --git a/htdocs/reception/dispatch.php b/htdocs/reception/dispatch.php index ab5e4dc997283..69055aa130c27 100644 --- a/htdocs/reception/dispatch.php +++ b/htdocs/reception/dispatch.php @@ -49,7 +49,7 @@ $langs->load('productbatch'); } - // Security check +// Security check $id = GETPOSTINT("id"); $ref = GETPOST('ref'); $lineid = GETPOSTINT('lineid'); @@ -586,7 +586,7 @@ $nbfreeproduct = 0; // Nb of lins of free products/services $nbproduct = 0; // Nb of predefined product lines to dispatch (already done or not) if SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED is off (default) - // or nb of line that remain to dispatch if SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED is on. + // or nb of line that remain to dispatch if SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED is on. $conf->cache['product'] = array(); @@ -747,13 +747,13 @@ if (!getDolGlobalString('PRODUCT_DISABLE_SELLBY')) { print ''; $dlcdatesuffix = !empty($objd->sellby) ? dol_stringtotime($objd->sellby) : dol_mktime(0, 0, 0, GETPOST('dlc'.$suffix.'month'), GETPOST('dlc'.$suffix.'day'), GETPOST('dlc'.$suffix.'year')); - print $form->selectDate($dlcdatesuffix, 'dlc'.$suffix, '', '', 1, ''); + print $form->selectDate($dlcdatesuffix, 'dlc'.$suffix, 0, 0, 1, ''); print ''; } if (!getDolGlobalString('PRODUCT_DISABLE_EATBY')) { print ''; $dluodatesuffix = !empty($objd->eatby) ? dol_stringtotime($objd->eatby) : dol_mktime(0, 0, 0, GETPOST('dluo'.$suffix.'month'), GETPOST('dluo'.$suffix.'day'), GETPOST('dluo'.$suffix.'year')); - print $form->selectDate($dluodatesuffix, 'dluo'.$suffix, '', '', 1, ''); + print $form->selectDate($dluodatesuffix, 'dluo'.$suffix, 0, 0, 1, ''); print ''; } print ' '; // Supplier ref + Qty ordered + qty already dispatched @@ -808,10 +808,10 @@ print ''; if (isModEnabled('productbatch') && $objp->tobatch > 0) { $type = 'batch'; - print img_picto($langs->trans('AddStockLocationLine'), 'split.png', 'class="splitbutton" '.($numd != $j+1 ? 'style="display:none"' : '').' onClick="addDispatchLine('.$i.', \''.$type.'\')"'); + print img_picto($langs->trans('AddStockLocationLine'), 'split.png', 'class="splitbutton" '.($numd != $j + 1 ? 'style="display:none"' : '').' onClick="addDispatchLine('.$i.', \''.$type.'\')"'); } else { $type = 'dispatch'; - print img_picto($langs->trans('AddStockLocationLine'), 'split.png', 'class="splitbutton" '.($numd != $j+1 ? 'style="display:none"' : '').' onClick="addDispatchLine('.$i.', \''.$type.'\')"'); + print img_picto($langs->trans('AddStockLocationLine'), 'split.png', 'class="splitbutton" '.($numd != $j + 1 ? 'style="display:none"' : '').' onClick="addDispatchLine('.$i.', \''.$type.'\')"'); } print ''; @@ -920,13 +920,13 @@ if (!getDolGlobalString('PRODUCT_DISABLE_SELLBY')) { print ''; $dlcdatesuffix = dol_mktime(0, 0, 0, GETPOST('dlc'.$suffix.'month'), GETPOST('dlc'.$suffix.'day'), GETPOST('dlc'.$suffix.'year')); - print $form->selectDate($dlcdatesuffix, 'dlc'.$suffix, '', '', 1, ''); + print $form->selectDate($dlcdatesuffix, 'dlc'.$suffix, 0, 0, 1, ''); print ''; } if (!getDolGlobalString('PRODUCT_DISABLE_EATBY')) { print ''; $dluodatesuffix = dol_mktime(0, 0, 0, GETPOST('dluo'.$suffix.'month'), GETPOST('dluo'.$suffix.'day'), GETPOST('dluo'.$suffix.'year')); - print $form->selectDate($dluodatesuffix, 'dluo'.$suffix, '', '', 1, ''); + print $form->selectDate($dluodatesuffix, 'dluo'.$suffix, 0, 0, 1, ''); print ''; } print ' '; // Supplier ref + Qty ordered + qty already dispatched diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index f1b8c29eb6c46..caadc0e2af0a7 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -899,7 +899,7 @@ print $langs->trans('DateInvoice'); print ''; print ''; - print $form->selectDate('', '', '', '', '', '', 1, 1); + print $form->selectDate('', '', 0, 0, 0, '', 1, 1); print ''; print ''; print ''; diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index a44e82e6eb9c1..36d30fc46a20a 100644 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -302,7 +302,7 @@ $paiement->chid = $object->id; // deprecated $paiement->datep = $datep; $paiement->datev = $datev; - $paiement->amounts = array($object->id=>$amount); // Tableau de montant + $paiement->amounts = array($object->id => $amount); // Tableau de montant $paiement->fk_typepayment = $type_payment; $paiement->num_payment = GETPOST("num_payment", 'alphanohtml'); $paiement->note_private = GETPOST("note", 'restricthtml'); @@ -580,13 +580,13 @@ // Date start period print ''; print $form->editfieldkey('DateStartPeriod', 'datesp', '', $object, 0, 'string', '', 1).''; - print $form->selectDate($datesp, "datesp", '', '', '', 'add'); + print $form->selectDate($datesp, "datesp", 0, 0, 0, 'add'); print ''; // Date end period print ''; print $form->editfieldkey('DateEndPeriod', 'dateep', '', $object, 0, 'string', '', 1).''; - print $form->selectDate($dateep, "dateep", '', '', '', 'add'); + print $form->selectDate($dateep, "dateep", 0, 0, 0, 'add'); print ''; // Amount @@ -646,7 +646,7 @@ // Date value for bank print ''; print $form->editfieldkey('DateValue', 'datev', '', $object, 0).''; - print $form->selectDate((empty($datev) ? -1 : $datev), "datev", '', '', '', 'add', 1, 1); + print $form->selectDate((empty($datev) ? -1 : $datev), "datev", 0, 0, 0, 'add', 1, 1); print ''; // Number diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 134d68a3eab8d..5b29d73fefbd1 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -753,7 +753,7 @@ // Update linked member - if (!$error && $object->fk_soc > 0) { + if (!$error && isset($object->fk_soc) && $object->fk_soc > 0) { $sql = "UPDATE ".MAIN_DB_PREFIX."adherent"; $sql .= " SET fk_soc = NULL WHERE fk_soc = ".((int) $socid); if (!$object->db->query($sql)) { diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index f072cf540c47b..78551cdb6e4c2 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -704,7 +704,7 @@ //If text set in desc is the same as product descpription (as now it's preloaded) we add it only one time if (trim($product_desc) == trim($desc) && getDolGlobalString('PRODUIT_AUTOFILL_DESC')) { - $product_desc=''; + $product_desc = ''; } if (!empty($product_desc) && getDolGlobalString('MAIN_NO_CONCAT_DESCRIPTION')) { @@ -1345,9 +1345,9 @@ $syear = date("Y", $tmpdte); $smonth = date("m", $tmpdte); $sday = date("d", $tmpdte); - print $form->selectDate($syear."-".$smonth."-".$sday, 'liv_', '', '', '', "addask"); + print $form->selectDate($syear."-".$smonth."-".$sday, 'liv_', 0, 0, 0, "addask"); } else { - print $form->selectDate($datedelivery ? $datedelivery : -1, 'liv_', '', '', '', "addask", 1, 1); + print $form->selectDate($datedelivery ? $datedelivery : -1, 'liv_', 0, 0, 0, "addask", 1, 1); } print ''; @@ -1702,7 +1702,7 @@ print ''; print ''; print ''; - print $form->selectDate($object->delivery_date, 'liv_', '', '', '', "editdate_livraison"); + print $form->selectDate($object->delivery_date, 'liv_', 0, 0, 0, "editdate_livraison"); print ''; print ''; } else { diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php index f621e6dfe2759..bd0f56b57cf2f 100644 --- a/test/phpunit/FunctionsLibTest.php +++ b/test/phpunit/FunctionsLibTest.php @@ -1227,33 +1227,43 @@ public function testDolNow() $this->assertEquals(getServerTimeZoneInt('now') * 3600, ($nowtzserver - $now)); } + + + /** + * Data provider for testVerifCond + * + * @return array + */ + public function verifCondDataProvider(): array + { + return [ + 'Test a true comparison' => ['1==1', true,], + 'Test a false comparison' => ['1==2', false,], + 'Test that the conf property of a module reports true when enabled' => ['isModEnabled("facture")', true,], + 'Test that the conf property of a module reports false when disabled' => ['isModEnabled("moduledummy")', false,], + 'Test that verifConf(0) returns false' => [0, false,], + 'Test that verifConf("0") returns false' => ["0", false,], + 'Test that verifConf("") returns false (special case)' => ['', true,], + ]; + } + /** * testVerifCond * + * @dataProvider verifCondDataProvider + * + * @param string $cond Condition to test using verifCond + * @param string $expected Expected outcome of verifCond + * * @return void */ - public function testVerifCond() + public function testVerifCond($cond, $expected) { - $verifcond = verifCond('1==1'); - $this->assertTrue($verifcond, 'Test a true comparison'); - - $verifcond = verifCond('1==2'); - $this->assertFalse($verifcond, 'Test a false comparison'); - - $verifcond = verifCond('isModEnabled("facture")'); - $this->assertTrue($verifcond, 'Test that the conf property of a module reports true when enabled'); - - $verifcond = verifCond('isModEnabled("moduledummy")'); - $this->assertFalse($verifcond, 'Test that the conf property of a module reports false when disabled'); - - $verifcond = verifCond(0); - $this->assertFalse($verifcond, 'Test that verifConf(0) return False'); - - $verifcond = verifCond("0"); - $this->assertFalse($verifcond, 'Test that verifConf("0") return False'); - - $verifcond = verifCond(''); - $this->assertTrue($verifcond, 'Test that verifConf("") return False (special case)'); + if ($expected) { + $this->assertTrue(verifCond($cond)); + } else { + $this->assertFalse(verifCond($cond)); + } } /**