From 6f38f4030a466d182395011459e87f3e178d77e5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 8 Mar 2024 21:55:26 +0100 Subject: [PATCH 01/11] Trans --- htdocs/langs/en_US/resource.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/resource.lang b/htdocs/langs/en_US/resource.lang index 8f117e93bc9..391ba469932 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 From 5371db3c0b9de09bb4cd14d8c6c095b4f545c6ee Mon Sep 17 00:00:00 2001 From: JeromeBARBOTIN <162124543+JeromeBARBOTIN@users.noreply.github.com> Date: Fri, 8 Mar 2024 22:50:15 +0100 Subject: [PATCH 02/11] FIX: Verification of variables (#28623) * Verifcation of variables Modification of the variable setting before its use. * To check if the property exists * Modification as per @frederic34 suggestion * Update propal.class.php * Application of coding rules Modification of the called function. * Verification of variables * Verification of variable * Typo error * Update actions_sendmails.inc.php --------- Co-authored-by: Laurent Destailleur --- htdocs/comm/propal/class/propal.class.php | 4 ++-- htdocs/compta/facture/card.php | 4 ++-- htdocs/core/actions_sendmails.inc.php | 4 ++-- htdocs/societe/card.php | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 868a16ed304..5097273a833 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2704,7 +2704,7 @@ class Propal extends CommonObject $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 @@ class Propal extends CommonObject } 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/compta/facture/card.php b/htdocs/compta/facture/card.php index 9d277f17bc3..82af075289f 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1820,7 +1820,7 @@ if (empty($reshook)) { $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 @@ if (empty($reshook)) { $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, diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index af109bd436e..2a5dc287f2b 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -434,10 +434,10 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO 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/societe/card.php b/htdocs/societe/card.php index 134d68a3eab..5b29d73fefb 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -753,7 +753,7 @@ if (empty($reshook)) { // 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)) { From c44f1025182acbefcf26a2f50fca6a30d437e3eb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 8 Mar 2024 22:58:15 +0100 Subject: [PATCH 03/11] Try to remove phan error --- dev/tools/phan/config_fixer.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dev/tools/phan/config_fixer.php b/dev/tools/phan/config_fixer.php index 11daf743c09..056a5c26805 100644 --- a/dev/tools/phan/config_fixer.php +++ b/dev/tools/phan/config_fixer.php @@ -176,6 +176,8 @@ return [ // 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() From bb6cf2c6ed2875a3695f7cfd2f15a2e8cf547cb3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 8 Mar 2024 23:00:55 +0100 Subject: [PATCH 04/11] Fix warning --- dev/tools/phan/config.php | 1 + dev/tools/phan/config_extended.php | 3 +++ 2 files changed, 4 insertions(+) diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php index 085d4daba12..178a021e00c 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -331,6 +331,7 @@ return [ // 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 a186b90bd25..65dcc8f7389 100644 --- a/dev/tools/phan/config_extended.php +++ b/dev/tools/phan/config_extended.php @@ -326,6 +326,8 @@ return [ // 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 @@ return [ '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 From d13d6617543864e72de10acacf5ca8e8ae1ccf78 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 9 Mar 2024 01:02:45 +0100 Subject: [PATCH 05/11] Fix: PhanPossiblyUnsetPropertyOfThis - variable is unset (#28714) # Fix: PhanPossiblyUnsetPropertyOfThis - variable is unset Because the variable is unset to force recomputation, the Phan message is valid and the if condition is always true. Hence, the if condition was commented. Also added an initialisation to an empty array before assigning array fields. Co-authored-by: Laurent Destailleur --- htdocs/loan/class/loan.class.php | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/htdocs/loan/class/loan.class.php b/htdocs/loan/class/loan.class.php index 20f51e90e78..466dde2cef3 100644 --- a/htdocs/loan/class/loan.class.php +++ b/htdocs/loan/class/loan.class.php @@ -501,21 +501,23 @@ class Loan extends CommonObject $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 @@ class Loan extends CommonObject 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; From 3b5779589503432391ecf93e72d9c21c6b9e7c60 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 9 Mar 2024 01:04:15 +0100 Subject: [PATCH 06/11] Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) (#28718) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * Qual: Update selectDate '' arguments h, m and empty to match PHPdoc (set to 0) * New: Fixer for selectDate '' arguments h, m and empty * Qual: Update codespell exceptions --- .../codespell/codespell-lines-ignore.txt | 1 + dev/tools/phan/config_fixer.php | 1 + dev/tools/phan/plugins/SelectDateFixer.php | 175 ++++++++++++++++++ htdocs/accountancy/bookkeeping/card.php | 4 +- htdocs/adherents/card.php | 4 +- htdocs/adherents/subscription.php | 4 +- htdocs/admin/expensereport_rules.php | 8 +- htdocs/comm/propal/card.php | 10 +- htdocs/commande/card.php | 6 +- htdocs/commande/list.php | 2 +- htdocs/compta/bank/line.php | 4 +- htdocs/compta/bank/transfer.php | 2 +- htdocs/compta/bank/various_payment/card.php | 10 +- htdocs/compta/deplacement/card.php | 4 +- htdocs/compta/facture/card-rec.php | 2 +- htdocs/compta/facture/card.php | 4 +- htdocs/compta/localtax/card.php | 4 +- htdocs/compta/paiement.php | 4 +- htdocs/compta/paiement/cheque/card.php | 2 +- htdocs/compta/paiement_charge.php | 2 +- htdocs/compta/paiement_vat.php | 2 +- htdocs/compta/prelevement/card.php | 6 +- htdocs/compta/prelevement/line.php | 2 +- htdocs/compta/tva/card.php | 6 +- htdocs/contrat/card.php | 14 +- htdocs/cron/card.php | 8 +- htdocs/delivery/card.php | 2 +- htdocs/don/card.php | 4 +- htdocs/expedition/card.php | 36 ++-- htdocs/expedition/dispatch.php | 18 +- htdocs/expedition/shipment.php | 2 +- htdocs/expensereport/payment/payment.php | 2 +- htdocs/fichinter/card-rec.php | 28 +-- htdocs/fourn/commande/card.php | 8 +- htdocs/fourn/commande/dispatch.php | 6 +- htdocs/fourn/commande/list.php | 60 +++--- htdocs/fourn/facture/card-rec.php | 2 +- htdocs/fourn/facture/card.php | 4 +- htdocs/fourn/facture/paiement.php | 10 +- htdocs/loan/card.php | 4 +- htdocs/loan/payment/payment.php | 2 +- htdocs/margin/agentMargins.php | 4 +- htdocs/margin/checkMargins.php | 4 +- htdocs/margin/customerMargins.php | 4 +- htdocs/margin/productMargins.php | 4 +- htdocs/opensurvey/wizard/create_survey.php | 2 +- htdocs/product/stock/product.php | 6 +- .../product/stock/tpl/stockcorrection.tpl.php | 6 +- .../product/stock/tpl/stocktransfer.tpl.php | 4 +- htdocs/projet/tasks/time.php | 2 +- htdocs/reception/card.php | 28 +-- htdocs/reception/dispatch.php | 16 +- htdocs/reception/list.php | 2 +- htdocs/salaries/card.php | 8 +- htdocs/supplier_proposal/card.php | 8 +- 55 files changed, 377 insertions(+), 200 deletions(-) create mode 100644 dev/tools/phan/plugins/SelectDateFixer.php diff --git a/dev/tools/codespell/codespell-lines-ignore.txt b/dev/tools/codespell/codespell-lines-ignore.txt index 94c67e08f75..2c0fb95a96f 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_fixer.php b/dev/tools/phan/config_fixer.php index 056a5c26805..18e50834844 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 */ diff --git a/dev/tools/phan/plugins/SelectDateFixer.php b/dev/tools/phan/plugins/SelectDateFixer.php new file mode 100644 index 00000000000..c475d7b2b81 --- /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 444cb44d104..66838b8c2e2 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -374,7 +374,7 @@ if ($action == 'create') { 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 @@ if ($action == 'create') { 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 a75d6358477..aaee4c47aa4 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1118,7 +1118,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // 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 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // 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 512189bef85..3ace1b42d58 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -996,7 +996,7 @@ if (($action == 'addsubscription' || $action == 'create_thirdparty') && $user->h $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 @@ if (($action == 'addsubscription' || $action == 'create_thirdparty') && $user->h } } 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 b3f22626264..abadd050991 100644 --- a/htdocs/admin/expensereport_rules.php +++ b/htdocs/admin/expensereport_rules.php @@ -222,8 +222,8 @@ if ($action != 'edit') { 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 @@ foreach ($rules as $rule) { 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 @@ foreach ($rules as $rule) { 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 6d6ac13c58d..cb2001fc399 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1971,7 +1971,7 @@ if ($action == 'create') { // 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 @@ if ($action == 'create') { $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 @@ if ($action == 'create') { 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 @@ if ($action == 'create') { 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/commande/card.php b/htdocs/commande/card.php index 9722ca53344..11b3f049599 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1915,7 +1915,7 @@ if ($action == 'create' && $usercancreate) { // 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 @@ if ($action == 'create' && $usercancreate) { 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 @@ if ($action == 'create' && $usercancreate) { 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 b84de3413f5..54ba84705cb 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -1413,7 +1413,7 @@ if ($massaction == 'createbills') { 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 5b27d9ccd39..c0cbdb0447e 100644 --- a/htdocs/compta/bank/line.php +++ b/htdocs/compta/bank/line.php @@ -546,7 +546,7 @@ if ($result) { 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 @@ if ($result) { 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 71c620c0a5d..1ecfab6693c 100644 --- a/htdocs/compta/bank/transfer.php +++ b/htdocs/compta/bank/transfer.php @@ -335,7 +335,7 @@ for ($i = 1 ; $i < $MAXLINES; $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 b35350f2ee4..505b5b64ccc 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -415,13 +415,13 @@ if ($action == 'create') { // 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 @@ if ($id) { $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), ); @@ -712,7 +712,7 @@ if ($id) { } // 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 785bc96edc5..bcc66ade965 100644 --- a/htdocs/compta/deplacement/card.php +++ b/htdocs/compta/deplacement/card.php @@ -221,7 +221,7 @@ if ($action == 'create') { 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 @@ if ($action == 'create') { 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 954b0eb3077..59318f1a753 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -1135,7 +1135,7 @@ if ($action == 'create') { // 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 82af075289f..a0748e540ed 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3843,14 +3843,14 @@ if ($action == 'create') { // 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 a7a7c5f5898..2797c3203c9 100644 --- a/htdocs/compta/localtax/card.php +++ b/htdocs/compta/localtax/card.php @@ -164,12 +164,12 @@ if ($action == 'create') { // 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 63938b6742c..f7a2026903d 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -90,7 +90,7 @@ $result = restrictedArea($user, 'facture', $object->id, '', '', 'fk_soc', $field * 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 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie 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 097006e12e2..29cd19534e9 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -628,7 +628,7 @@ if ($action == 'new') { 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 44a6cb3fe71..0094a541cf6 100644 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -204,7 +204,7 @@ if ($action == 'create') { 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 20b574adac4..3b98f540a22 100644 --- a/htdocs/compta/paiement_vat.php +++ b/htdocs/compta/paiement_vat.php @@ -203,7 +203,7 @@ if ($action == 'create') { 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 24e37a37904..691f6d903bf 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -236,7 +236,7 @@ if ($id > 0 || $ref) { 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 @@ if ($id > 0 || $ref) { 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 @@ if ($id > 0 || $ref) { 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 de713bb137b..85e92020011 100644 --- a/htdocs/compta/prelevement/line.php +++ b/htdocs/compta/prelevement/line.php @@ -233,7 +233,7 @@ if ($id) { //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 47669898244..d3f0886eae9 100644 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -223,7 +223,7 @@ if (empty($reshook)) { $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 @@ if ($action == 'create') { 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 @@ if ($action == 'create') { 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 613403d2f44..98c46cc9f47 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -380,7 +380,7 @@ if (empty($reshook)) { $lines[$i]->pa_ht, $array_options, $lines[$i]->fk_unit, - $num+1 + $num + 1 ); if ($result < 0) { @@ -1245,7 +1245,7 @@ if ($action == 'create') { 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 @@ if ($action == 'create') { $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 @@ if ($action == 'create') { $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 @@ if ($action == 'create') { $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 @@ if ($action == 'create') { 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/cron/card.php b/htdocs/cron/card.php index 68dbac1b3e7..032dca46d45 100644 --- a/htdocs/cron/card.php +++ b/htdocs/cron/card.php @@ -492,7 +492,7 @@ if (($action == "create") || ($action == "edit")) { 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 @@ if (($action == "create") || ($action == "edit")) { 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 @@ if (($action == "create") || ($action == "edit")) { //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 7dccbfbdd44..7ee3fd7ea4b 100644 --- a/htdocs/delivery/card.php +++ b/htdocs/delivery/card.php @@ -430,7 +430,7 @@ if ($action == 'create') { 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 06546f208d1..2e28a7c2655 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -490,7 +490,7 @@ if ($action == 'create') { // 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 @@ if (!empty($id) && $action == 'edit') { // 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/expedition/card.php b/htdocs/expedition/card.php index 8c259b63e2a..e42131e8cb4 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -274,7 +274,7 @@ if (empty($reshook)) { $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 @@ if (empty($reshook)) { //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 @@ if (empty($reshook)) { // 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 @@ if (empty($reshook)) { 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 @@ if (empty($reshook)) { 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 @@ if (empty($reshook)) { setEventMessages($object->error, $object->errors, 'errors'); $error++; } else { - $update_done=true; + $update_done = true; } } } else { @@ -794,7 +794,7 @@ if (empty($reshook)) { setEventMessages($line->error, $line->errors, 'errors'); $error++; } else { - $update_done=true; + $update_done = true; } } unset($_POST[$stockLocation]); @@ -810,7 +810,7 @@ if (empty($reshook)) { setEventMessages($line->error, $line->errors, 'errors'); $error++; } else { - $update_done=true; + $update_done = true; } unset($_POST[$qty]); } @@ -824,7 +824,7 @@ if (empty($reshook)) { setEventMessages($line->error, $line->errors, 'errors'); $error++; } else { - $update_done=true; + $update_done = true; } unset($_POST[$qty]); } @@ -1604,7 +1604,7 @@ if ($action == 'create') { $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 @@ if ($action == 'create') { $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 @@ if ($action == 'create') { 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 ($action == 'create') { 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 @@ if ($action == 'create') { // 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 8334b30bdef..913f069ff61 100644 --- a/htdocs/expedition/dispatch.php +++ b/htdocs/expedition/dispatch.php @@ -51,7 +51,7 @@ if (isModEnabled('productbatch')) { $langs->load('productbatch'); } - // Security check +// Security check $id = GETPOSTINT("id"); $ref = GETPOST('ref'); $lineid = GETPOSTINT('lineid'); @@ -510,7 +510,7 @@ if ($object->id > 0 || !empty($object->ref)) { 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 @@ if ($object->id > 0 || !empty($object->ref)) { $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 ($object->id > 0 || !empty($object->ref)) { 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 @@ if ($object->id > 0 || !empty($object->ref)) { 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 ($object->id > 0 || !empty($object->ref)) { 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 fe20c6ed008..7809b47105b 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -368,7 +368,7 @@ if ($id > 0 || !empty($ref)) { 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 0df2d3583a1..e1de1f7015b 100644 --- a/htdocs/expensereport/payment/payment.php +++ b/htdocs/expensereport/payment/payment.php @@ -238,7 +238,7 @@ if ($action == 'create' || empty($action)) { 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 bd1670c51e8..8e7aad352be 100644 --- a/htdocs/fichinter/card-rec.php +++ b/htdocs/fichinter/card-rec.php @@ -97,17 +97,17 @@ $extrafields = new ExtraFields($db); $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 @@ if ($action == 'create') { 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 ($action == 'create') { 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 @@ if ($action == 'create') { 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 85de2e7fb6f..e3729dc7423 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1769,7 +1769,7 @@ if ($action == 'create') { $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 ($action == 'create') { 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 @@ if ($action == 'create') { //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 @@ if ($action == 'create') { //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 61193e3e707..6b4574ed2a9 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -794,7 +794,7 @@ if ($id > 0 || !empty($ref)) { $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 ($id > 0 || !empty($ref)) { 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 68f6d8f0af2..c4d93209600 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -181,28 +181,28 @@ $checkedtypetiers = 0; // 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 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa $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 @@ if (empty($reshook)) { $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 @@ if (empty($reshook)) { $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 @@ if ($resql) { // 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 @@ if ($resql) { $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 @@ if ($resql) { 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 @@ if ($resql) { 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 @@ if ($resql) { // 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 @@ if ($resql) { $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 @@ if ($resql) { // 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 @@ if ($resql) { $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 c3d748e81d1..d8f899d7bb1 100644 --- a/htdocs/fourn/facture/card-rec.php +++ b/htdocs/fourn/facture/card-rec.php @@ -1044,7 +1044,7 @@ if ($action == 'create') { // 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 8244ed6e8af..1e13db22978 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2645,7 +2645,7 @@ if ($action == 'create') { // 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 @@ if ($action == 'create') { // 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 4f1c81602a1..e495c2e3f9e 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -140,7 +140,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $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 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie 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 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie 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/loan/card.php b/htdocs/loan/card.php index fc41bac9d6b..17fd78aa8c1 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -306,13 +306,13 @@ if ($action == 'create') { // 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/payment/payment.php b/htdocs/loan/payment/payment.php index 27b01120195..ece271b9135 100644 --- a/htdocs/loan/payment/payment.php +++ b/htdocs/loan/payment/payment.php @@ -289,7 +289,7 @@ if ($action == 'create') { } 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 af35d75201f..3c2fa4bca90 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -129,11 +129,11 @@ print ''; // 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 de7822b6198..5cdee16619b 100644 --- a/htdocs/margin/checkMargins.php +++ b/htdocs/margin/checkMargins.php @@ -190,11 +190,11 @@ print ''; print ''; print ''; print ''; print ''; print ''; // Start date print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''."\n"; print ''."\n"; print '
'.$langs->trans('DateStart').' ('.$langs->trans("DateValidation").')'; -print $form->selectDate($startdate, 'startdate', '', '', 1, "sel", 1, 1); +print $form->selectDate($startdate, 'startdate', 0, 0, 1, "sel", 1, 1); print ''.$langs->trans('DateEnd').' ('.$langs->trans("DateValidation").')'; -print $form->selectDate($enddate, 'enddate', '', '', 1, "sel", 1, 1); +print $form->selectDate($enddate, 'enddate', 0, 0, 1, "sel", 1, 1); print ''; print ''; diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php index d30ef558ecf..b81567d7b09 100644 --- a/htdocs/margin/customerMargins.php +++ b/htdocs/margin/customerMargins.php @@ -170,11 +170,11 @@ print '
'.$langs->trans('DateStart').' ('.$langs->trans("DateValidation").')'; -print $form->selectDate($startdate, 'startdate', '', '', 1, "sel", 1, 1); +print $form->selectDate($startdate, 'startdate', 0, 0, 1, "sel", 1, 1); print ''.$langs->trans('DateEnd').' ('.$langs->trans("DateValidation").')'; -print $form->selectDate($enddate, 'enddate', '', '', 1, "sel", 1, 1); +print $form->selectDate($enddate, 'enddate', 0, 0, 1, "sel", 1, 1); print ''; print ''; diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index fb1604c6d9f..e6837605980 100644 --- a/htdocs/margin/productMargins.php +++ b/htdocs/margin/productMargins.php @@ -134,11 +134,11 @@ print '
'.$langs->trans('DateStart').' ('.$langs->trans("DateValidation").')'; -print $form->selectDate($startdate, 'startdate', '', '', 1, "sel", 1, 1); +print $form->selectDate($startdate, 'startdate', 0, 0, 1, "sel", 1, 1); print ''.$langs->trans('DateEnd').' ('.$langs->trans("DateValidation").')'; -print $form->selectDate($enddate, 'enddate', '', '', 1, "sel", 1, 1); +print $form->selectDate($enddate, 'enddate', 0, 0, 1, "sel", 1, 1); print ''; print ''; diff --git a/htdocs/opensurvey/wizard/create_survey.php b/htdocs/opensurvey/wizard/create_survey.php index 61f5a1ef7d5..084d768ce05 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"; diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 6361cea7a8d..456460e2b21 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -144,7 +144,7 @@ if ($cancel) { $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 @@ if (!$variants || getDolGlobalString('VARIANT_ALLOW_STOCK_MOVEMENT_ON_VARIANT_PA 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 b393de2bc48..87f6acee486 100644 --- a/htdocs/product/stock/tpl/stockcorrection.tpl.php +++ b/htdocs/product/stock/tpl/stockcorrection.tpl.php @@ -105,7 +105,7 @@ print '