diff --git a/.github/workflows/windows-ci.yaml b/.github/workflows/windows-ci.yaml index c0e44dbb74f..f8441c438fc 100644 --- a/.github/workflows/windows-ci.yaml +++ b/.github/workflows/windows-ci.yaml @@ -114,7 +114,7 @@ jobs: curl "http://${{ env.PHPSERVER_DOMAIN_PORT }}" shell: powershell - name: Run PHPUnit tests - continue-on-error: true + # continue-on-error: true shell: cmd # setting up php.ini, starting the php server are currently in this step run: |- @@ -143,7 +143,7 @@ jobs: cat htdocs/conf/conf.php curl "http://${{ env.PHPSERVER_DOMAIN_PORT }}" REM 'DOSKEY' USED to recover error code (no pipefile equivalent in windows?) - ( php "%PHPROOT%\phpunit" -d memory_limit=-1 -c %CD%\test\phpunit\phpunittest.xml "test\phpunit\AllTests.php" & call doskey /exename=err err=%%^^errorlevel%% ) | "${{ env.TEE }}" "${{ env.PHPUNIT_LOG }}" + ( php "%PHPROOT%\phpunit" -d memory_limit=-1 -c %CD%\test\phpunit\phpunittest.xml "test\phpunit\AllTests.php" --exclude-group WindowsWaitingForFix & call doskey /exename=err err=%%^^errorlevel%% ) | "${{ env.TEE }}" "${{ env.PHPUNIT_LOG }}" for /f "tokens=2 delims==" %%A in ('doskey /m:err') do EXIT /B %%A - name: Convert Raw Log to Annotations uses: mdeweerd/logToCheckStyle@v2024.2.9 diff --git a/dev/tools/github_commits_byversion.sh b/dev/tools/github_commits_byversion.sh index bd3405376cf..eafca6b2e01 100755 --- a/dev/tools/github_commits_byversion.sh +++ b/dev/tools/github_commits_byversion.sh @@ -4,7 +4,7 @@ # # shellcheck disable=1113,2002,2006,2086,2164,2219 -Releases=("3.9" "4.0" "5.0" "6.0" "7.0" "8.0" "9.0" "10.0" "11.0" "12.0" "13.0" "14.0" "15.0" "16.0" "17.0" "18.0" "develop") +Releases=("3.9" "4.0" "5.0" "6.0" "7.0" "8.0" "9.0" "10.0" "11.0" "12.0" "13.0" "14.0" "15.0" "16.0" "17.0" "18.0" "19.0" "develop") let "counter = 0" echo "Copy script into /tmp/github_commits_byversion.sh" @@ -49,4 +49,3 @@ do echo let "counter +=1" done - diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt index 1fd31534dad..68fc0c015e7 100644 --- a/dev/tools/phan/baseline.txt +++ b/dev/tools/phan/baseline.txt @@ -15,7 +15,6 @@ return [ // PhanPluginDuplicateExpressionBinaryOp : 10+ occurrences // PhanTypeArraySuspiciousNull : 10+ occurrences // PhanTypeInvalidUnaryOperandNumeric : 8 occurrences - // PhanPluginDuplicateIfCondition : 6 occurrences // PhanRedefineFunctionInternal : 6 occurrences // PhanPluginUnsafeEval : 5 occurrences // PhanParamSuspiciousOrder : 4 occurrences @@ -51,7 +50,6 @@ return [ 'htdocs/compta/cashcontrol/cashcontrol_card.php' => ['PhanPluginDuplicateExpressionBinaryOp'], 'htdocs/compta/facture/agenda-rec.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/compta/facture/card-rec.php' => ['PhanPluginSuspiciousParamPosition'], - 'htdocs/compta/facture/list.php' => ['PhanPluginDuplicateIfCondition'], 'htdocs/compta/prelevement/class/bonprelevement.class.php' => ['PhanParamTooMany'], 'htdocs/compta/prelevement/create.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/compta/sociales/class/paymentsocialcontribution.class.php' => ['PhanTypeInvalidUnaryOperandNumeric'], @@ -62,7 +60,7 @@ return [ 'htdocs/compta/tva/document.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/core/actions_massactions.inc.php' => ['PhanPluginSuspiciousParamOrder'], 'htdocs/core/class/commondocgenerator.class.php' => ['PhanTypeArraySuspiciousNull'], - 'htdocs/core/class/commonobject.class.php' => ['PhanPluginDuplicateIfCondition', 'PhanPluginSuspiciousParamPosition'], + 'htdocs/core/class/commonobject.class.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/core/class/evalmath.class.php' => ['PhanPluginUnsafeEval'], 'htdocs/core/class/html.form.class.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/core/class/html.formmail.class.php' => ['PhanNoopArray'], @@ -72,8 +70,8 @@ return [ 'htdocs/core/db/sqlite3.class.php' => ['PhanParamSignatureMismatch'], 'htdocs/core/filemanagerdol/connectors/php/connector.lib.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/core/get_info.php' => ['PhanPluginSuspiciousParamPosition'], - 'htdocs/core/lib/files.lib.php' => ['PhanPluginDuplicateExpressionBinaryOp', 'PhanPluginDuplicateIfCondition'], - 'htdocs/core/lib/functions.lib.php' => ['PhanParamTooMany', 'PhanPluginAlwaysReturnFunction', 'PhanPluginDuplicateIfCondition', 'PhanPluginUnsafeEval', 'PhanRedefineFunctionInternal'], + 'htdocs/core/lib/files.lib.php' => ['PhanPluginDuplicateExpressionBinaryOp'], + 'htdocs/core/lib/functions.lib.php' => ['PhanParamTooMany', 'PhanPluginAlwaysReturnFunction', 'PhanPluginUnsafeEval', 'PhanRedefineFunctionInternal'], 'htdocs/core/lib/price.lib.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/core/lib/usergroups.lib.php' => ['PhanNoopArrayAccess'], 'htdocs/core/menus/standard/auguria_menu.php' => ['PhanParamSuspiciousOrder'], @@ -84,7 +82,6 @@ return [ 'htdocs/core/modules/member/doc/pdf_standard.class.php' => ['PhanParamSignatureMismatch'], 'htdocs/core/modules/movement/doc/pdf_standard.modules.php' => ['PhanPluginDuplicateExpressionBinaryOp'], 'htdocs/core/modules/mrp/doc/pdf_vinci.modules.php' => ['PhanTypeArraySuspiciousNull'], - 'htdocs/core/modules/societe/modules_societe.class.php' => ['PhanPluginDuplicateIfCondition'], 'htdocs/core/modules/syslog/mod_syslog_file.php' => ['PhanParamSignatureMismatch', 'PhanParamSuspiciousOrder'], 'htdocs/core/modules/syslog/mod_syslog_syslog.php' => ['PhanParamSignatureMismatch'], 'htdocs/don/class/don.class.php' => ['PhanParamTooMany'], diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php index 0bb240128f8..53dd0aa447b 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 Frédéric France */ define('DOL_PROJECT_ROOT', __DIR__.'/../../..'); define('DOL_DOCUMENT_ROOT', DOL_PROJECT_ROOT.'/htdocs'); @@ -54,7 +55,7 @@ $DEPRECATED_MODULE_MAPPING = array( 'commande' => 'order', 'contrat' => 'contract', 'entrepot' => 'stock', - 'expedition' => 'delivery_note', + 'expedition' => 'shipping', 'facture' => 'invoice', 'ficheinter' => 'intervention', 'product_fournisseur_price' => 'productsupplierprice', @@ -93,7 +94,7 @@ $VALID_MODULE_MAPPING = array( 'datapolicy' => 'DataPolicy', 'dav' => 'Dav', 'debugbar' => 'DebugBar', - 'delivery_note' => 'Expedition', + 'shipping' => 'Expedition', 'deplacement' => 'Deplacement', "documentgeneration" => 'DocumentGeneration', 'don' => 'Don', @@ -475,7 +476,7 @@ return [ // 'PhanPluginUnknownFunctionReturnType', // 'PhanPluginDescriptionlessCommentOnProtectedProperty', 'PhanPluginRedundantAssignmentInGlobalScope', - 'PhanTypeMismatchDeclaredParamNullable', + // 'PhanTypeMismatchDeclaredParamNullable', 'PhanTypeInvalidRightOperandOfAdd', // 'PhanPluginDescriptionlessCommentOnPrivateProperty', // 'PhanUndeclaredVariableDim', // Array initialisation on undeclared var: $abc['x']='ab' @@ -493,7 +494,7 @@ return [ 'PhanRedefineClass', 'PhanRedefineFunction', 'PhanTypeInvalidLeftOperandOfBitwiseOp', - 'PhanTypeMismatchDimAssignment', + // 'PhanTypeMismatchDimAssignment', // 'PhanPluginDescriptionlessCommentOnProtectedMethod', 'PhanPluginPrintfIncompatibleArgumentTypeWeak', 'PhanUndeclaredVariableAssignOp', @@ -535,7 +536,8 @@ return [ // 'PhanTypeInvalidThrowsIsInterface', // 'PhanPluginRedundantAssignmentInLoop', // 'PhanInvalidCommentForDeclarationType', - //'PhanParamSignatureMismatchInternal', + // 'PhanParamSignatureMismatchInternal', + // 'PhanParamSignatureMismatch', // 'PhanPluginEmptyStatementForeachLoop', // 'PhanCompatibleDimAlternativeSyntax', 'PhanInvalidFQSENInClasslike', @@ -568,7 +570,7 @@ return [ // 'PhanTypeMismatchDeclaredReturnNullable', // 'PhanUndeclaredThis', - 'PhanPluginMixedKeyNoKey', + // 'PhanPluginMixedKeyNoKey', 'PhanPluginDuplicateConditionalNullCoalescing', // Suggests to optimize to ?? //'PhanUnreferencedClosure', // False positives seen with closures in arrays, TODO: move closure checks closer to what is done by unused variable plugin //'PhanPluginNoCommentOnProtectedMethod', @@ -656,5 +658,4 @@ return [ 'sockets' => PHAN_DIR . '/stubs/sockets.phan_php', 'zip' => PHAN_DIR . '/stubs/zip.phan_php', ], - ]; diff --git a/dev/tools/phan/config_extended.php b/dev/tools/phan/config_extended.php index 7db2b587708..b9e92619b06 100644 --- a/dev/tools/phan/config_extended.php +++ b/dev/tools/phan/config_extended.php @@ -54,7 +54,7 @@ $DEPRECATED_MODULE_MAPPING = array( 'commande' => 'order', 'contrat' => 'contract', 'entrepot' => 'stock', - 'expedition' => 'delivery_note', + 'expedition' => 'shipping', 'facture' => 'invoice', 'ficheinter' => 'intervention', 'product_fournisseur_price' => 'productsupplierprice', @@ -93,7 +93,7 @@ $VALID_MODULE_MAPPING = array( 'datapolicy' => 'DataPolicy', 'dav' => 'Dav', 'debugbar' => 'DebugBar', - 'delivery_note' => 'Expedition', + 'shipping' => 'Expedition', 'deplacement' => 'Deplacement', "documentgeneration" => 'DocumentGeneration', 'don' => 'Don', diff --git a/dev/tools/phan/config_fixer.php b/dev/tools/phan/config_fixer.php index a588483e3bf..86f1765defb 100644 --- a/dev/tools/phan/config_fixer.php +++ b/dev/tools/phan/config_fixer.php @@ -1,4 +1,7 @@ + * Copyright (C) 2024 Frédéric France + */ // Uncomment require_once to enable corresponding fixer @@ -7,8 +10,6 @@ //require_once __DIR__.'/plugins/UrlEncodeStringifyFixer.php'; require_once __DIR__.'/plugins/SelectDateFixer.php'; -/* Copyright (C) 2024 MDW - */ define('DOL_PROJECT_ROOT', __DIR__.'/../../..'); define('DOL_DOCUMENT_ROOT', DOL_PROJECT_ROOT.'/htdocs'); define('PHAN_DIR', __DIR__); @@ -22,7 +23,7 @@ $DEPRECATED_MODULE_MAPPING = array( 'commande' => 'order', 'contrat' => 'contract', 'entrepot' => 'stock', - 'expedition' => 'delivery_note', + 'expedition' => 'shipping', 'facture' => 'invoice', 'ficheinter' => 'intervention', 'product_fournisseur_price' => 'productsupplierprice', diff --git a/dev/tools/phan/plugins/DeprecatedModuleNameFixer.php b/dev/tools/phan/plugins/DeprecatedModuleNameFixer.php index d8cfcfb141a..cf8a9bc7c62 100644 --- a/dev/tools/phan/plugins/DeprecatedModuleNameFixer.php +++ b/dev/tools/phan/plugins/DeprecatedModuleNameFixer.php @@ -36,7 +36,7 @@ call_user_func(static function (): void { 'commande' => 'order', 'contrat' => 'contract', 'entrepot' => 'stock', - 'expedition' => 'delivery_note', + 'expedition' => 'shipping', 'facture' => 'invoice', 'ficheinter' => 'intervention', 'product_fournisseur_price' => 'productsupplierprice', diff --git a/htdocs/accountancy/admin/accountmodel.php b/htdocs/accountancy/admin/accountmodel.php index 8523baecacc..dbe02a3ff02 100644 --- a/htdocs/accountancy/admin/accountmodel.php +++ b/htdocs/accountancy/admin/accountmodel.php @@ -129,7 +129,7 @@ $tabrowid[31] = ""; // List of help for fields $tabhelp = array(); -$tabhelp[31] = array('pcg_version'=>$langs->trans("EnterAnyCode")); +$tabhelp[31] = array('pcg_version' => $langs->trans("EnterAnyCode")); // Define elementList and sourceList (used for dictionary type of contacts "llx_c_type_contact") @@ -241,7 +241,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) { $result = $db->query($sql); if ($result) { // Add is ok setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs'); - $_POST = array('id'=>$id); // Clean $_POST array, we keep only + $_POST = array('id' => $id); // Clean $_POST array, we keep only } else { if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors'); @@ -353,7 +353,7 @@ print load_fiche_titre($titre, $linkback, 'title_accountancy'); // Confirmation de la suppression de la ligne if ($action == 'delete') { - print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.urlencode($page).'&' : '').'sortfield='.urlencode($sortfield).'&sortorder='.urlencode($sortorder).'&rowid='.urlencode($rowid).'&code='.urlencode($code).'&id='.urlencode($id), $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1); + print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.urlencode((string) ($page)).'&' : '').'sortfield='.urlencode((string) ($sortfield)).'&sortorder='.urlencode((string) ($sortorder)).'&rowid='.urlencode((string) ($rowid)).'&code='.urlencode((string) ($code)).'&id='.urlencode((string) ($id)), $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1); } //var_dump($elementList); @@ -458,7 +458,7 @@ if ($id) { } $tmpaction = 'create'; - $parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); + $parameters = array('fieldlist' => $fieldlist, 'tabname' => $tabname[$id]); $reshook = $hookmanager->executeHooks('createDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks $error = $hookmanager->error; $errors = $hookmanager->errors; @@ -486,9 +486,9 @@ if ($id) { $num = $db->num_rows($resql); $i = 0; - $param = '&id='.urlencode($id); + $param = '&id='.urlencode((string) ($id)); if ($search_country_id > 0) { - $param .= '&search_country_id='.urlencode($search_country_id); + $param .= '&search_country_id='.urlencode((string) ($search_country_id)); } $paramwithsearch = $param; if ($sortorder) { @@ -556,7 +556,7 @@ if ($id) { print ''; $tmpaction = 'edit'; - $parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); + $parameters = array('fieldlist' => $fieldlist, 'tabname' => $tabname[$id]); $reshook = $hookmanager->executeHooks('editDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks $error = $hookmanager->error; $errors = $hookmanager->errors; @@ -571,7 +571,7 @@ if ($id) { print ''; } else { $tmpaction = 'view'; - $parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); + $parameters = array('fieldlist' => $fieldlist, 'tabname' => $tabname[$id]); $reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks $error = $hookmanager->error; @@ -718,7 +718,7 @@ function fieldListAccountModel($fieldlist, $obj = null, $tabname = '', $context print ''; } if ($fieldlist[$field] == 'type_cdr') { - print $form->selectarray($fieldlist[$field], array(0=>$langs->trans('None'), 1=>$langs->trans('AtEndOfMonth'), 2=>$langs->trans('CurrentNext')), (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '')); + print $form->selectarray($fieldlist[$field], array(0 => $langs->trans('None'), 1 => $langs->trans('AtEndOfMonth'), 2 => $langs->trans('CurrentNext')), (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '')); } else { print $form->selectyesno($fieldlist[$field], (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : ''), 1); } diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php index 032b3ac6e3e..18d793fc43e 100644 --- a/htdocs/accountancy/admin/categories_list.php +++ b/htdocs/accountancy/admin/categories_list.php @@ -461,7 +461,7 @@ $fieldlist = explode(',', $tabfield[$id]); $param = '&id='.$id; if ($search_country_id > 0) { - $param .= '&search_country_id='.urlencode($search_country_id); + $param .= '&search_country_id='.urlencode((string) ($search_country_id)); } $paramwithsearch = $param; if ($sortorder) { @@ -474,7 +474,7 @@ if (GETPOST('from', 'alpha')) { $paramwithsearch .= '&from='.urlencode(GETPOST('from', 'alpha')); } if ($listlimit) { - $paramwithsearch .= '&listlimit='.urlencode(GETPOSTINT('listlimit')); + $paramwithsearch .= '&listlimit='.urlencode((string) (GETPOSTINT('listlimit'))); } print '
'; print ''; diff --git a/htdocs/accountancy/admin/journals_list.php b/htdocs/accountancy/admin/journals_list.php index 1b12d17df07..d710839a391 100644 --- a/htdocs/accountancy/admin/journals_list.php +++ b/htdocs/accountancy/admin/journals_list.php @@ -481,7 +481,7 @@ if ($id) { $param = '&id='.((int) $id); if ($search_country_id > 0) { - $param .= '&search_country_id='.urlencode($search_country_id); + $param .= '&search_country_id='.urlencode((string) ($search_country_id)); } $paramwithsearch = $param; if ($sortorder) { diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index fdd471b2fac..403819c7f4d 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -423,7 +423,7 @@ if ($resql) { $param .= '&limit='.((int) $limit); } if ($searchCategoryProductOperator == 1) { - $param .= "&search_category_product_operator=".urlencode($searchCategoryProductOperator); + $param .= "&search_category_product_operator=".urlencode((string) ($searchCategoryProductOperator)); } foreach ($searchCategoryProductList as $searchCategoryProduct) { $param .= "&search_category_product_list[]=".urlencode($searchCategoryProduct); diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 66838b8c2e2..e2f1e86008d 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -447,7 +447,7 @@ if ($action == 'create') { print $langs->trans('Docdate'); print ''; if ($action != 'editdate') { - print 'piece_num).'&mode='.urlencode($mode).'">'.img_edit($langs->transnoentitiesnoconv('SetDate'), 1).''; + print 'piece_num)).'&mode='.urlencode((string) ($mode)).'">'.img_edit($langs->transnoentitiesnoconv('SetDate'), 1).''; } print ''; print ''; @@ -474,7 +474,7 @@ if ($action == 'create') { print $langs->trans('Codejournal'); print ''; if ($action != 'editjournal') { - print 'piece_num).'&mode='.urlencode($mode).'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).''; + print 'piece_num)).'&mode='.urlencode((string) ($mode)).'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).''; } print ''; print ''; @@ -501,7 +501,7 @@ if ($action == 'create') { print $langs->trans('Piece'); print ''; if ($action != 'editdocref') { - print 'piece_num).'&mode='.urlencode($mode).'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).''; + print 'piece_num)).'&mode='.urlencode((string) ($mode)).'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).''; } print ''; print ''; diff --git a/htdocs/accountancy/bookkeeping/export.php b/htdocs/accountancy/bookkeeping/export.php index 610b6d4384a..16923e5ebbd 100644 --- a/htdocs/accountancy/bookkeeping/export.php +++ b/htdocs/accountancy/bookkeeping/export.php @@ -189,21 +189,21 @@ if (!in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && !GE $arrayfields = array( - 't.piece_num'=>array('label'=>$langs->trans("TransactionNumShort"), 'checked'=>1), - 't.code_journal'=>array('label'=>$langs->trans("Codejournal"), 'checked'=>1), - 't.doc_date'=>array('label'=>$langs->trans("Docdate"), 'checked'=>1), - 't.doc_ref'=>array('label'=>$langs->trans("Piece"), 'checked'=>1), - 't.numero_compte'=>array('label'=>$langs->trans("AccountAccountingShort"), 'checked'=>1), - 't.subledger_account'=>array('label'=>$langs->trans("SubledgerAccount"), 'checked'=>1), - 't.label_operation'=>array('label'=>$langs->trans("Label"), 'checked'=>1), - 't.debit'=>array('label'=>$langs->trans("AccountingDebit"), 'checked'=>1), - 't.credit'=>array('label'=>$langs->trans("AccountingCredit"), 'checked'=>1), - 't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1), - 't.date_creation'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0), - 't.tms'=>array('label'=>$langs->trans("DateModification"), 'checked'=>0), - 't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>1), - 't.date_validated'=>array('label'=>$langs->trans("DateValidationAndLock"), 'checked'=>1, 'enabled'=>!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")), - 't.import_key'=>array('label'=>$langs->trans("ImportId"), 'checked'=>0, 'position'=>1100), + 't.piece_num' => array('label' => $langs->trans("TransactionNumShort"), 'checked' => 1), + 't.code_journal' => array('label' => $langs->trans("Codejournal"), 'checked' => 1), + 't.doc_date' => array('label' => $langs->trans("Docdate"), 'checked' => 1), + 't.doc_ref' => array('label' => $langs->trans("Piece"), 'checked' => 1), + 't.numero_compte' => array('label' => $langs->trans("AccountAccountingShort"), 'checked' => 1), + 't.subledger_account' => array('label' => $langs->trans("SubledgerAccount"), 'checked' => 1), + 't.label_operation' => array('label' => $langs->trans("Label"), 'checked' => 1), + 't.debit' => array('label' => $langs->trans("AccountingDebit"), 'checked' => 1), + 't.credit' => array('label' => $langs->trans("AccountingCredit"), 'checked' => 1), + 't.lettering_code' => array('label' => $langs->trans("LetteringCode"), 'checked' => 1), + 't.date_creation' => array('label' => $langs->trans("DateCreation"), 'checked' => 0), + 't.tms' => array('label' => $langs->trans("DateModification"), 'checked' => 0), + 't.date_export' => array('label' => $langs->trans("DateExport"), 'checked' => 1), + 't.date_validated' => array('label' => $langs->trans("DateValidationAndLock"), 'checked' => 1, 'enabled' => !getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")), + 't.import_key' => array('label' => $langs->trans("ImportId"), 'checked' => 0, 'position' => 1100), ); if (!getDolGlobalString('ACCOUNTING_ENABLE_LETTERING')) { @@ -244,7 +244,7 @@ if (!GETPOST('confirmmassaction', 'alpha')) { $massaction = ''; } -$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'); @@ -353,7 +353,7 @@ if (empty($reshook)) { } } $filter['t.search_accounting_code_in'] = implode(',', $listofaccountsforgroup2); - $param .= '&search_account_category='.urlencode($search_account_category); + $param .= '&search_account_category='.urlencode((string) ($search_account_category)); } if (!empty($search_accountancy_code)) { $filter['t.numero_compte'] = $search_accountancy_code; @@ -395,7 +395,7 @@ if (empty($reshook)) { } if (!empty($search_mvt_num)) { $filter['t.piece_num'] = $search_mvt_num; - $param .= '&search_mvt_num='.urlencode($search_mvt_num); + $param .= '&search_mvt_num='.urlencode((string) ($search_mvt_num)); } if (!empty($search_date_creation_start)) { $filter['t.date_creation>='] = $search_date_creation_start; @@ -778,7 +778,7 @@ $arrayofselected = is_array($toselect) ? $toselect : array(); // Output page // -------------------------------------------------------------------- -$help_url ='EN:Module_Double_Entry_Accounting#Exports|FR:Module_Comptabilité_en_Partie_Double#Exports'; +$help_url = 'EN:Module_Double_Entry_Accounting#Exports|FR:Module_Comptabilité_en_Partie_Double#Exports'; llxHeader('', $title_page, $help_url); @@ -796,7 +796,7 @@ if ($action == 'export_file') { 'morecss' => 'minwidth200 maxwidth200' ); - $form_question['separator0'] = array('name'=>'separator0', 'type'=>'separator'); + $form_question['separator0'] = array('name' => 'separator0', 'type' => 'separator'); if (getDolGlobalInt("ACCOUNTING_ENABLE_LETTERING")) { // If 1, we check by default. @@ -808,7 +808,7 @@ if ($action == 'export_file') { 'value' => $checked, ); - $form_question['separator1'] = array('name'=>'separator1', 'type'=>'separator'); + $form_question['separator1'] = array('name' => 'separator1', 'type' => 'separator'); } // If 1 or not set, we check by default. @@ -820,7 +820,7 @@ if ($action == 'export_file') { 'value' => (getDolGlobalString('ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE') ? 'false' : 'true'), ); - $form_question['separator2'] = array('name'=>'separator2', 'type'=>'separator'); + $form_question['separator2'] = array('name' => 'separator2', 'type' => 'separator'); if (!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")) { // If 0 or not set, we NOT check by default. @@ -832,7 +832,7 @@ if ($action == 'export_file') { 'value' => $checked, ); - $form_question['separator3'] = array('name'=>'separator3', 'type'=>'separator'); + $form_question['separator3'] = array('name' => 'separator3', 'type' => 'separator'); } // add documents in an archive for accountancy export (Quadratus) @@ -1036,7 +1036,7 @@ if (!empty($arrayfields['t.lettering_code']['checked'])) { } // 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; @@ -1133,7 +1133,7 @@ if (!empty($arrayfields['t.lettering_code']['checked'])) { print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, '', $sortfield, $sortorder, 'center '); } // 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['t.date_creation']['checked'])) { @@ -1383,7 +1383,7 @@ while ($i < min($num, $limit)) { } // 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; @@ -1462,7 +1462,7 @@ if ($num == 0) { print ''.$langs->trans("NoRecordFound").''; } -$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/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 6e84cc8e01d..bbf41060a4c 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -184,21 +184,21 @@ if (!in_array($action, array('delmouv', 'delmouvconfirm')) && !GETPOSTISSET('beg $arrayfields = array( - 't.piece_num'=>array('label'=>$langs->trans("TransactionNumShort"), 'checked'=>1), - 't.code_journal'=>array('label'=>$langs->trans("Codejournal"), 'checked'=>1), - 't.doc_date'=>array('label'=>$langs->trans("Docdate"), 'checked'=>1), - 't.doc_ref'=>array('label'=>$langs->trans("Piece"), 'checked'=>1), - 't.numero_compte'=>array('label'=>$langs->trans("AccountAccountingShort"), 'checked'=>1), - 't.subledger_account'=>array('label'=>$langs->trans("SubledgerAccount"), 'checked'=>1), - 't.label_operation'=>array('label'=>$langs->trans("Label"), 'checked'=>1), - 't.debit'=>array('label'=>$langs->trans("AccountingDebit"), 'checked'=>1), - 't.credit'=>array('label'=>$langs->trans("AccountingCredit"), 'checked'=>1), - 't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1), - 't.date_creation'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0), - 't.tms'=>array('label'=>$langs->trans("DateModification"), 'checked'=>0), - 't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>0), - 't.date_validated'=>array('label'=>$langs->trans("DateValidationAndLock"), 'checked'=>0, 'enabled'=>!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")), - 't.import_key'=>array('label'=>$langs->trans("ImportId"), 'checked'=>0, 'position'=>1100), + 't.piece_num' => array('label' => $langs->trans("TransactionNumShort"), 'checked' => 1), + 't.code_journal' => array('label' => $langs->trans("Codejournal"), 'checked' => 1), + 't.doc_date' => array('label' => $langs->trans("Docdate"), 'checked' => 1), + 't.doc_ref' => array('label' => $langs->trans("Piece"), 'checked' => 1), + 't.numero_compte' => array('label' => $langs->trans("AccountAccountingShort"), 'checked' => 1), + 't.subledger_account' => array('label' => $langs->trans("SubledgerAccount"), 'checked' => 1), + 't.label_operation' => array('label' => $langs->trans("Label"), 'checked' => 1), + 't.debit' => array('label' => $langs->trans("AccountingDebit"), 'checked' => 1), + 't.credit' => array('label' => $langs->trans("AccountingCredit"), 'checked' => 1), + 't.lettering_code' => array('label' => $langs->trans("LetteringCode"), 'checked' => 1), + 't.date_creation' => array('label' => $langs->trans("DateCreation"), 'checked' => 0), + 't.tms' => array('label' => $langs->trans("DateModification"), 'checked' => 0), + 't.date_export' => array('label' => $langs->trans("DateExport"), 'checked' => 0), + 't.date_validated' => array('label' => $langs->trans("DateValidationAndLock"), 'checked' => 0, 'enabled' => !getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")), + 't.import_key' => array('label' => $langs->trans("ImportId"), 'checked' => 0, 'position' => 1100), ); if (!getDolGlobalString('ACCOUNTING_ENABLE_LETTERING')) { @@ -232,7 +232,7 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'preunletteringauto $massaction = ''; } -$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'); @@ -341,7 +341,7 @@ if (empty($reshook)) { } } $filter['t.search_accounting_code_in'] = implode(',', $listofaccountsforgroup2); - $param .= '&search_account_category='.urlencode($search_account_category); + $param .= '&search_account_category='.urlencode((string) ($search_account_category)); } if (!empty($search_accountancy_code)) { $filter['t.numero_compte'] = $search_accountancy_code; @@ -383,7 +383,7 @@ if (empty($reshook)) { } if (!empty($search_mvt_num)) { $filter['t.piece_num'] = $search_mvt_num; - $param .= '&search_mvt_num='.urlencode($search_mvt_num); + $param .= '&search_mvt_num='.urlencode((string) ($search_mvt_num)); } if (!empty($search_date_creation_start)) { $filter['t.date_creation>='] = $search_date_creation_start; @@ -936,7 +936,7 @@ if (!empty($arrayfields['t.lettering_code']['checked'])) { } // 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; @@ -1033,7 +1033,7 @@ if (!empty($arrayfields['t.lettering_code']['checked'])) { print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, '', $sortfield, $sortorder, 'center '); } // 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['t.date_creation']['checked'])) { @@ -1283,7 +1283,7 @@ while ($i < min($num, $limit)) { } // 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; @@ -1362,7 +1362,7 @@ if ($num == 0) { print ''.$langs->trans("NoRecordFound").''; } -$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/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 4a39d78e5ef..40b7599040c 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -159,18 +159,18 @@ if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('searc $arrayfields = array( // 't.subledger_account'=>array('label'=>$langs->trans("SubledgerAccount"), 'checked'=>1), - 't.piece_num'=>array('label'=>$langs->trans("TransactionNumShort"), 'checked'=>1), - 't.code_journal'=>array('label'=>$langs->trans("Codejournal"), 'checked'=>1), - 't.doc_date'=>array('label'=>$langs->trans("Docdate"), 'checked'=>1), - 't.doc_ref'=>array('label'=>$langs->trans("Piece"), 'checked'=>1), - 't.label_operation'=>array('label'=>$langs->trans("Label"), 'checked'=>1), - 't.lettering_code'=>array('label'=>$langs->trans("Lettering"), 'checked'=>1), - 't.debit'=>array('label'=>$langs->trans("AccountingDebit"), 'checked'=>1), - 't.credit'=>array('label'=>$langs->trans("AccountingCredit"), 'checked'=>1), - 't.balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1), - 't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>-1), - 't.date_validated'=>array('label'=>$langs->trans("DateValidation"), 'checked'=>-1, 'enabled'=>!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")), - 't.import_key'=>array('label'=>$langs->trans("ImportId"), 'checked'=>-1, 'position'=>1100), + 't.piece_num' => array('label' => $langs->trans("TransactionNumShort"), 'checked' => 1), + 't.code_journal' => array('label' => $langs->trans("Codejournal"), 'checked' => 1), + 't.doc_date' => array('label' => $langs->trans("Docdate"), 'checked' => 1), + 't.doc_ref' => array('label' => $langs->trans("Piece"), 'checked' => 1), + 't.label_operation' => array('label' => $langs->trans("Label"), 'checked' => 1), + 't.lettering_code' => array('label' => $langs->trans("Lettering"), 'checked' => 1), + 't.debit' => array('label' => $langs->trans("AccountingDebit"), 'checked' => 1), + 't.credit' => array('label' => $langs->trans("AccountingCredit"), 'checked' => 1), + 't.balance' => array('label' => $langs->trans("Balance"), 'checked' => 1), + 't.date_export' => array('label' => $langs->trans("DateExport"), 'checked' => -1), + 't.date_validated' => array('label' => $langs->trans("DateValidation"), 'checked' => -1, 'enabled' => !getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")), + 't.import_key' => array('label' => $langs->trans("ImportId"), 'checked' => -1, 'position' => 1100), ); if (!getDolGlobalString('ACCOUNTING_ENABLE_LETTERING')) { @@ -217,7 +217,7 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'preunletteringauto $massaction = ''; } -$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'); @@ -296,7 +296,7 @@ if (empty($reshook)) { } } $filter['t.search_accounting_code_in'] = implode(',', $listofaccountsforgroup2); - $param .= '&search_account_category='.urlencode($search_account_category); + $param .= '&search_account_category='.urlencode((string) ($search_account_category)); } if (!empty($search_accountancy_code_start)) { if ($type == 'sub') { @@ -320,7 +320,7 @@ if (empty($reshook)) { } if (!empty($search_mvt_num)) { $filter['t.piece_num'] = $search_mvt_num; - $param .= '&search_mvt_num='.urlencode($search_mvt_num); + $param .= '&search_mvt_num='.urlencode((string) ($search_mvt_num)); } if (!empty($search_doc_ref)) { $filter['t.doc_ref'] = $search_doc_ref; @@ -897,7 +897,7 @@ if (!empty($arrayfields['t.import_key']['checked'])) { } // 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; @@ -951,7 +951,7 @@ if (!empty($arrayfields['t.import_key']['checked'])) { print_liste_field_titre($arrayfields['t.import_key']['label'], $_SERVER["PHP_SELF"], "t.import_key", "", $param, '', $sortfield, $sortorder, 'center '); } // 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 (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { @@ -1071,7 +1071,7 @@ while ($i < min($num, $limit)) { // Show the break account print ''; - print ''; + print ''; if ($type == 'sub') { if ($line->subledger_account != "" && $line->subledger_account != '-1') { print empty($line->subledger_label) ? ''.$langs->trans("Unknown").'' : $line->subledger_label; @@ -1227,7 +1227,7 @@ while ($i < min($num, $limit)) { if (strlen(length_accounta($line->subledger_account)) == 0) { print ''.dol_escape_htmltag($line->label_operation).''; } else { - print '('.length_accounta($line->subledger_account).')').'">'.dol_escape_htmltag($line->label_operation).($line->label_operation?'
':'').'('.dol_escape_htmltag(length_accounta($line->subledger_account)).')'; + print '('.length_accounta($line->subledger_account).')').'">'.dol_escape_htmltag($line->label_operation).($line->label_operation ? '
' : '').'('.dol_escape_htmltag(length_accounta($line->subledger_account)).')'; } if (!$i) { $totalarray['nbfield']++; @@ -1302,7 +1302,7 @@ while ($i < min($num, $limit)) { } // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$line); + $parameters = array('arrayfields' => $arrayfields, 'obj' => $line); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; @@ -1387,7 +1387,7 @@ if ($num == 0) { print ''.$langs->trans("NoRecordFound").''; } -$parameters = array('arrayfields'=>$arrayfields); +$parameters = array('arrayfields' => $arrayfields); $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/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 500fd4a7543..479887a5724 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -5,6 +5,7 @@ * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2015 Ari Elbaz (elarifr) * Copyright (C) 2018 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -501,7 +502,7 @@ class AccountingAccount extends CommonObject $url = DOL_URL_ROOT . '/accountancy/bookkeeping/list.php?search_accountancy_code_start=' . urlencode($this->account_number) . '&search_accountancy_code_end=' . urlencode($this->account_number); $labelurl = $langs->trans("ShowAccountingAccountInJournals"); } elseif ($option == 'accountcard') { - $url = DOL_URL_ROOT . '/accountancy/admin/card.php?id=' . urlencode($this->id); + $url = DOL_URL_ROOT . '/accountancy/admin/card.php?id=' . urlencode((string) ($this->id)); $labelurl = $langs->trans("ShowAccountingAccount"); } @@ -570,7 +571,7 @@ class AccountingAccount 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; @@ -745,7 +746,7 @@ class AccountingAccount extends CommonObject $hookmanager->initHooks(array('accountancyBindingCalculation')); // Execute hook accountancyBindingCalculation - $parameters = array('buyer' => $buyer, 'seller' => $seller, 'product' => $product, 'facture' => $facture, 'factureDet' => $factureDet ,'accountingAccount'=>$accountingAccount, $type); + $parameters = array('buyer' => $buyer, 'seller' => $seller, 'product' => $product, 'facture' => $facture, 'factureDet' => $factureDet ,'accountingAccount' => $accountingAccount, 0 => $type); $reshook = $hookmanager->executeHooks('accountancyBindingCalculation', $parameters); // Note that $action and $object may have been modified by some hooks if (empty($reshook)) { diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index f291093d063..6d47b7fe700 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -2528,7 +2528,7 @@ class BookKeeping extends CommonObject * Get list of fiscal period * * @param string $filter Filter - * @return array|int Return integer <0 if KO, Fiscal periods : [[id, date_start, date_end, label], ...] + * @return array|int Return integer <0 if KO, Fiscal periods : [[id, date_start, date_end, label], ...] */ public function getFiscalPeriods($filter = '') { @@ -2551,11 +2551,11 @@ class BookKeeping extends CommonObject while ($obj = $this->db->fetch_object($resql)) { $list[$obj->rowid] = array( - 'id' => $obj->rowid, + 'id' => (int) $obj->rowid, 'label' => $obj->label, 'date_start' => $this->db->jdate($obj->date_start), 'date_end' => $this->db->jdate($obj->date_end), - 'status' => $obj->statut, + 'status' => (int) $obj->statut, ); } diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 2aaed4ba014..a47a54ae40c 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -351,22 +351,22 @@ if ($result) { $param .= "&search_vat=".urlencode($search_vat); } if ($search_date_startday) { - $param .= '&search_date_startday='.urlencode($search_date_startday); + $param .= '&search_date_startday='.urlencode((string) ($search_date_startday)); } if ($search_date_startmonth) { - $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); + $param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth)); } if ($search_date_startyear) { - $param .= '&search_date_startyear='.urlencode($search_date_startyear); + $param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear)); } if ($search_date_endday) { - $param .= '&search_date_endday='.urlencode($search_date_endday); + $param .= '&search_date_endday='.urlencode((string) ($search_date_endday)); } if ($search_date_endmonth) { - $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + $param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth)); } if ($search_date_endyear) { - $param .= '&search_date_endyear='.urlencode($search_date_endyear); + $param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear)); } if ($search_country) { $param .= "&search_country=".urlencode($search_country); diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index e7487c70e0f..84128d37f94 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -399,25 +399,25 @@ if ($result) { $param .= '&search_societe='.urlencode($search_societe); } if ($search_lineid) { - $param .= '&search_lineid='.urlencode($search_lineid); + $param .= '&search_lineid='.urlencode((string) ($search_lineid)); } if ($search_date_startday) { - $param .= '&search_date_startday='.urlencode($search_date_startday); + $param .= '&search_date_startday='.urlencode((string) ($search_date_startday)); } if ($search_date_startmonth) { - $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); + $param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth)); } if ($search_date_startyear) { - $param .= '&search_date_startyear='.urlencode($search_date_startyear); + $param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear)); } if ($search_date_endday) { - $param .= '&search_date_endday='.urlencode($search_date_endday); + $param .= '&search_date_endday='.urlencode((string) ($search_date_endday)); } if ($search_date_endmonth) { - $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + $param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth)); } if ($search_date_endyear) { - $param .= '&search_date_endyear='.urlencode($search_date_endyear); + $param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear)); } if ($search_invoice) { $param .= '&search_invoice='.urlencode($search_invoice); diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php index 11602a58f1f..60f08f4992d 100644 --- a/htdocs/accountancy/expensereport/lines.php +++ b/htdocs/accountancy/expensereport/lines.php @@ -279,22 +279,22 @@ if ($result) { $param .= "&search_vat=".urlencode($search_vat); } if ($search_date_startday) { - $param .= '&search_date_startday='.urlencode($search_date_startday); + $param .= '&search_date_startday='.urlencode((string) ($search_date_startday)); } if ($search_date_startmonth) { - $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); + $param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth)); } if ($search_date_startyear) { - $param .= '&search_date_startyear='.urlencode($search_date_startyear); + $param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear)); } if ($search_date_endday) { - $param .= '&search_date_endday='.urlencode($search_date_endday); + $param .= '&search_date_endday='.urlencode((string) ($search_date_endday)); } if ($search_date_endmonth) { - $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + $param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth)); } if ($search_date_endyear) { - $param .= '&search_date_endyear='.urlencode($search_date_endyear); + $param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear)); } print ''."\n"; diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index 73d9dd96cb1..9bb346e153a 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -327,22 +327,22 @@ if ($result) { $param .= '&search_lineid='.urlencode($search_lineid); } if ($search_date_startday) { - $param .= '&search_date_startday='.urlencode($search_date_startday); + $param .= '&search_date_startday='.urlencode((string) ($search_date_startday)); } if ($search_date_startmonth) { - $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); + $param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth)); } if ($search_date_startyear) { - $param .= '&search_date_startyear='.urlencode($search_date_startyear); + $param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear)); } if ($search_date_endday) { - $param .= '&search_date_endday='.urlencode($search_date_endday); + $param .= '&search_date_endday='.urlencode((string) ($search_date_endday)); } if ($search_date_endmonth) { - $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + $param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth)); } if ($search_date_endyear) { - $param .= '&search_date_endyear='.urlencode($search_date_endyear); + $param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear)); } if ($search_expensereport) { $param .= '&search_expensereport='.urlencode($search_expensereport); diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 09c7aca7af7..16d1d3d0202 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -359,22 +359,22 @@ if ($result) { $param .= "&search_vat=".urlencode($search_vat); } if ($search_date_startday) { - $param .= '&search_date_startday='.urlencode($search_date_startday); + $param .= '&search_date_startday='.urlencode((string) ($search_date_startday)); } if ($search_date_startmonth) { - $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); + $param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth)); } if ($search_date_startyear) { - $param .= '&search_date_startyear='.urlencode($search_date_startyear); + $param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear)); } if ($search_date_endday) { - $param .= '&search_date_endday='.urlencode($search_date_endday); + $param .= '&search_date_endday='.urlencode((string) ($search_date_endday)); } if ($search_date_endmonth) { - $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + $param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth)); } if ($search_date_endyear) { - $param .= '&search_date_endyear='.urlencode($search_date_endyear); + $param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear)); } if ($search_country) { $param .= "&search_country=".urlencode($search_country); diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index db16688ff31..b086cdd1914 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -403,25 +403,25 @@ if ($result) { $param .= '&search_societe='.urlencode($search_societe); } if ($search_lineid) { - $param .= '&search_lineid='.urlencode($search_lineid); + $param .= '&search_lineid='.urlencode((string) ($search_lineid)); } if ($search_date_startday) { - $param .= '&search_date_startday='.urlencode($search_date_startday); + $param .= '&search_date_startday='.urlencode((string) ($search_date_startday)); } if ($search_date_startmonth) { - $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); + $param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth)); } if ($search_date_startyear) { - $param .= '&search_date_startyear='.urlencode($search_date_startyear); + $param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear)); } if ($search_date_endday) { - $param .= '&search_date_endday='.urlencode($search_date_endday); + $param .= '&search_date_endday='.urlencode((string) ($search_date_endday)); } if ($search_date_endmonth) { - $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + $param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth)); } if ($search_date_endyear) { - $param .= '&search_date_endyear='.urlencode($search_date_endyear); + $param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear)); } if ($search_invoice) { $param .= '&search_invoice='.urlencode($search_invoice); diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 531c089e1f1..1937924df3b 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -15,6 +15,7 @@ * Copyright (C) 2020 Josep Lluís Amador * Copyright (C) 2021 Waël Almoman * Copyright (C) 2021 Philippe Grand + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -315,7 +316,7 @@ class Adherent extends CommonObject /** - * @var array fields + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), @@ -323,14 +324,14 @@ class Adherent extends CommonObject 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 15, 'index' => 1), 'ref_ext' => array('type' => 'varchar(128)', 'label' => 'Ref ext', 'enabled' => 1, 'visible' => 0, 'position' => 20), 'civility' => array('type' => 'varchar(6)', 'label' => 'Civility', 'enabled' => 1, 'visible' => -1, 'position' => 25), - 'lastname' => array('type' => 'varchar(50)', 'label' => 'Lastname', 'enabled' => 1, 'visible' => 1, 'position' => 30, 'showoncombobox'=>1), - 'firstname' => array('type' => 'varchar(50)', 'label' => 'Firstname', 'enabled' => 1, 'visible' => 1, 'position' => 35, 'showoncombobox'=>1), + 'lastname' => array('type' => 'varchar(50)', 'label' => 'Lastname', 'enabled' => 1, 'visible' => 1, 'position' => 30, 'showoncombobox' => 1), + 'firstname' => array('type' => 'varchar(50)', 'label' => 'Firstname', 'enabled' => 1, 'visible' => 1, 'position' => 35, 'showoncombobox' => 1), 'login' => array('type' => 'varchar(50)', 'label' => 'Login', 'enabled' => 1, 'visible' => 1, 'position' => 40), 'pass' => array('type' => 'varchar(50)', 'label' => 'Pass', 'enabled' => 1, 'visible' => -1, 'position' => 45), 'pass_crypted' => array('type' => 'varchar(128)', 'label' => 'Pass crypted', 'enabled' => 1, 'visible' => -1, 'position' => 50), 'morphy' => array('type' => 'varchar(3)', 'label' => 'MemberNature', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'position' => 55), 'fk_adherent_type' => array('type' => 'integer', 'label' => 'Fk adherent type', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'position' => 60), - 'societe' => array('type' => 'varchar(128)', 'label' => 'Societe', 'enabled' => 1, 'visible' => 1, 'position' => 65, 'showoncombobox'=>2), + 'societe' => array('type' => 'varchar(128)', 'label' => 'Societe', 'enabled' => 1, 'visible' => 1, 'position' => 65, 'showoncombobox' => 2), 'fk_soc' => array('type' => 'integer:Societe:societe/class/societe.class.php', 'label' => 'ThirdParty', 'enabled' => 1, 'visible' => 1, 'position' => 70), 'address' => array('type' => 'text', 'label' => 'Address', 'enabled' => 1, 'visible' => -1, 'position' => 75), 'zip' => array('type' => 'varchar(10)', 'label' => 'Zip', 'enabled' => 1, 'visible' => -1, 'position' => 80), @@ -341,14 +342,14 @@ class Adherent extends CommonObject 'phone_perso' => array('type' => 'varchar(30)', 'label' => 'Phone perso', 'enabled' => 1, 'visible' => -1, 'position' => 120), 'phone_mobile' => array('type' => 'varchar(30)', 'label' => 'Phone mobile', 'enabled' => 1, 'visible' => -1, 'position' => 125), 'email' => array('type' => 'varchar(255)', 'label' => 'Email', 'enabled' => 1, 'visible' => 1, 'position' => 126), - 'url' =>array('type'=>'varchar(255)', 'label'=>'Url', 'enabled'=>1, 'visible'=>-1, 'position'=>127), + 'url' => array('type' => 'varchar(255)', 'label' => 'Url', 'enabled' => 1, 'visible' => -1, 'position' => 127), 'socialnetworks' => array('type' => 'text', 'label' => 'Socialnetworks', 'enabled' => 1, 'visible' => -1, 'position' => 128), 'birth' => array('type' => 'date', 'label' => 'DateOfBirth', 'enabled' => 1, 'visible' => -1, 'position' => 130), 'gender' => array('type' => 'varchar(10)', 'label' => 'Gender', 'enabled' => 1, 'visible' => -1, 'position' => 132), 'photo' => array('type' => 'varchar(255)', 'label' => 'Photo', 'enabled' => 1, 'visible' => -1, 'position' => 135), 'public' => array('type' => 'smallint(6)', 'label' => 'Public', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 145), 'datefin' => array('type' => 'datetime', 'label' => 'DateEnd', 'enabled' => 1, 'visible' => 1, 'position' => 150), - 'default_lang' =>array('type'=>'varchar(6)', 'label'=>'Default lang', 'enabled'=>1, 'visible'=>-1, 'position'=> 153), + 'default_lang' => array('type' => 'varchar(6)', 'label' => 'Default lang', 'enabled' => 1, 'visible' => -1, 'position' => 153), 'note_public' => array('type' => 'text', 'label' => 'NotePublic', 'enabled' => 1, 'visible' => 0, 'position' => 155), 'note_private' => array('type' => 'text', 'label' => 'NotePrivate', 'enabled' => 1, 'visible' => 0, 'position' => 160), 'datevalid' => array('type' => 'datetime', 'label' => 'DateValidation', 'enabled' => 1, 'visible' => -1, 'position' => 165), @@ -490,7 +491,7 @@ class Adherent extends CommonObject */ public function makeSubstitution($text) { - global $conf, $langs; + global $langs; $birthday = dol_print_date($this->birth, 'day'); @@ -2421,7 +2422,7 @@ class Adherent 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; @@ -3276,7 +3277,7 @@ class Adherent extends CommonObject $return .= '
'; $return .= ''; if (property_exists($this, 'photo') || !empty($this->photo)) { - $return.= Form::showphoto('memberphoto', $this, 0, 60, 0, 'photokanban photoref photowithmargin photologintooltip', 'small', 0, 1); + $return .= Form::showphoto('memberphoto', $this, 0, 60, 0, 'photokanban photoref photowithmargin photologintooltip', 'small', 0, 1); } else { $return .= img_picto('', 'user'); } diff --git a/htdocs/adherents/class/subscription.class.php b/htdocs/adherents/class/subscription.class.php index 111cb2c04ea..40aa0ab512a 100644 --- a/htdocs/adherents/class/subscription.class.php +++ b/htdocs/adherents/class/subscription.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2006-2015 Laurent Destailleur + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -103,21 +104,21 @@ class Subscription extends CommonObject public $fk_bank; /** - * @var array Array with all fields into database and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), - 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>15), - 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>20), - 'fk_adherent' =>array('type'=>'integer', 'label'=>'Member', 'enabled'=>1, 'visible'=>-1, 'position'=>25), - 'dateadh' =>array('type'=>'datetime', 'label'=>'DateSubscription', 'enabled'=>1, 'visible'=>-1, 'position'=>30), - 'datef' =>array('type'=>'datetime', 'label'=>'DateEndSubscription', 'enabled'=>1, 'visible'=>-1, 'position'=>35), - 'subscription' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>-1, 'position'=>40, 'isameasure'=>1), - 'fk_bank' =>array('type'=>'integer', 'label'=>'BankId', 'enabled'=>1, 'visible'=>-1, 'position'=>45), - 'note' =>array('type'=>'html', 'label'=>'Note', 'enabled'=>1, 'visible'=>-1, 'position'=>50), - 'fk_type' =>array('type'=>'integer', 'label'=>'MemberType', 'enabled'=>1, 'visible'=>-1, 'position'=>55), - 'fk_user_creat' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'position'=>60), - 'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>65), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 15), + 'datec' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'visible' => -1, 'position' => 20), + 'fk_adherent' => array('type' => 'integer', 'label' => 'Member', 'enabled' => 1, 'visible' => -1, 'position' => 25), + 'dateadh' => array('type' => 'datetime', 'label' => 'DateSubscription', 'enabled' => 1, 'visible' => -1, 'position' => 30), + 'datef' => array('type' => 'datetime', 'label' => 'DateEndSubscription', 'enabled' => 1, 'visible' => -1, 'position' => 35), + 'subscription' => array('type' => 'double(24,8)', 'label' => 'Amount', 'enabled' => 1, 'visible' => -1, 'position' => 40, 'isameasure' => 1), + 'fk_bank' => array('type' => 'integer', 'label' => 'BankId', 'enabled' => 1, 'visible' => -1, 'position' => 45), + 'note' => array('type' => 'html', 'label' => 'Note', 'enabled' => 1, 'visible' => -1, 'position' => 50), + 'fk_type' => array('type' => 'integer', 'label' => 'MemberType', 'enabled' => 1, 'visible' => -1, 'position' => 55), + 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => 1, 'visible' => -2, 'position' => 60), + 'fk_user_valid' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserValidation', 'enabled' => 1, 'visible' => -1, 'position' => 65), ); @@ -295,7 +296,7 @@ class Subscription extends CommonObject $result = $member->update_end_date($user); if (!$error && !$notrigger) { - $this->context = array('member'=>$member); + $this->context = array('member' => $member); // Call triggers $result = $this->call_trigger('MEMBER_SUBSCRIPTION_MODIFY', $user); if ($result < 0) { diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 7ce26e570c7..e8d85f21c76 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -670,7 +670,7 @@ if ($search_email) { $param .= "&search_email=".urlencode($search_email); } if ($search_categ > 0 || $search_categ == -2) { - $param .= "&search_categ=".urlencode($search_categ); + $param .= "&search_categ=".urlencode((string) ($search_categ)); } if ($search_company) { $param .= "&search_company=".urlencode($search_company); diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index efd6c1b1c47..3a99f379502 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -89,20 +89,20 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen $fieldstosearchall = array( ); $arrayfields = array( - 'd.ref'=>array('label'=>"Ref", 'checked'=>1), - 'd.fk_type'=>array('label'=>"Type", 'checked'=>1), - 'd.lastname'=>array('label'=>"Lastname", 'checked'=>1), - 'd.firstname'=>array('label'=>"Firstname", 'checked'=>1), - 'd.login'=>array('label'=>"Login", 'checked'=>1), - 't.libelle'=>array('label'=>"Label", 'checked'=>1), - 'd.bank'=>array('label'=>"BankAccount", 'checked'=>1, 'enabled'=>(isModEnabled('bank'))), + 'd.ref' => array('label' => "Ref", 'checked' => 1), + 'd.fk_type' => array('label' => "Type", 'checked' => 1), + 'd.lastname' => array('label' => "Lastname", 'checked' => 1), + 'd.firstname' => array('label' => "Firstname", 'checked' => 1), + 'd.login' => array('label' => "Login", 'checked' => 1), + 't.libelle' => array('label' => "Label", 'checked' => 1), + 'd.bank' => array('label' => "BankAccount", 'checked' => 1, 'enabled' => (isModEnabled('bank'))), /*'d.note_public'=>array('label'=>"NotePublic", 'checked'=>0), 'd.note_private'=>array('label'=>"NotePrivate", 'checked'=>0),*/ - 'c.dateadh'=>array('label'=>"DateSubscription", 'checked'=>1, 'position'=>100), - 'c.datef'=>array('label'=>"EndSubscription", 'checked'=>1, 'position'=>101), - 'd.amount'=>array('label'=>"Amount", 'checked'=>1, 'position'=>102), - 'c.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500), - 'c.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500), + 'c.dateadh' => array('label' => "DateSubscription", 'checked' => 1, 'position' => 100), + 'c.datef' => array('label' => "EndSubscription", 'checked' => 1, 'position' => 101), + 'd.amount' => array('label' => "Amount", 'checked' => 1, 'position' => 102), + 'c.datec' => array('label' => "DateCreation", 'checked' => 0, 'position' => 500), + 'c.tms' => array('label' => "DateModificationShort", 'checked' => 0, 'position' => 500), // 'd.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000) ); @@ -124,7 +124,7 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa $massaction = ''; } -$parameters = array('socid'=>isset($socid) ? $socid : null); +$parameters = array('socid' => isset($socid) ? $socid : null); $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'); @@ -298,7 +298,7 @@ $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; if (!empty($mode)) { - $param .='&mode='.urlencode($mode); + $param .= '&mode='.urlencode($mode); } if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); @@ -322,7 +322,7 @@ if ($search_login) { $param .= "&search_login=".urlencode($search_login); } if ($search_account) { - $param .= "&search_account=".urlencode($search_account); + $param .= "&search_account=".urlencode((string) ($search_account)); } if ($search_amount) { $param .= "&search_amount=".urlencode($search_amount); @@ -366,8 +366,8 @@ print ''; print ''; $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')); if ($user->hasRight('adherent', 'cotisation', 'creer')) { $newcardbutton .= dolGetButtonTitleSeparator(); $newcardbutton .= dolGetButtonTitle($langs->trans('NewSubscription'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/list.php?status=-1,1'); @@ -492,7 +492,7 @@ if (!empty($arrayfields['d.amount']['checked'])) { 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; // Date creation @@ -571,7 +571,7 @@ if (!empty($arrayfields['d.amount']['checked'])) { 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; if (!empty($arrayfields['c.datec']['checked'])) { @@ -647,7 +647,7 @@ while ($i < $imaxinloop) { $accountstatic->fetch($obj->fk_account); } // Output Kanban - print $subscription->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected), 'adherent_type' => $adht, 'member' => $adherent, 'bank'=>($obj->fk_account > 0 ? $accountstatic : null))); + print $subscription->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected), 'adherent_type' => $adht, 'member' => $adherent, 'bank' => ($obj->fk_account > 0 ? $accountstatic : null))); if ($i == ($imaxinloop - 1)) { print '
'; print ''; @@ -770,7 +770,7 @@ while ($i < $imaxinloop) { // 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 @@ -829,7 +829,7 @@ if ($num == 0) { $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/adherents/type.php b/htdocs/adherents/type.php index e8bf0d5f45d..df36f5c95da 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -190,7 +190,7 @@ if ($action == 'update' && $user->hasRight('adherent', 'configurer')) { $object->oldcopy = dol_clone($object, 2); - $object->label= trim($label); + $object->label = trim($label); $object->morphy = trim($morphy); $object->status = (int) $status; $object->subscription = (int) $subscription; @@ -277,8 +277,8 @@ if (!$rowid && $action != 'create' && $action != 'edit') { $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')); if ($user->hasRight('adherent', 'configurer')) { $newcardbutton .= dolGetButtonTitleSeparator(); @@ -379,9 +379,9 @@ if (!$rowid && $action != 'create' && $action != 'edit') { if ($objp->duration) { $duration_value = intval($objp->duration); if ($duration_value > 1) { - $dur = array("i"=>$langs->trans("Minutes"), "h"=>$langs->trans("Hours"), "d"=>$langs->trans("Days"), "w"=>$langs->trans("Weeks"), "m"=>$langs->trans("Months"), "y"=>$langs->trans("Years")); + $dur = array("i" => $langs->trans("Minutes"), "h" => $langs->trans("Hours"), "d" => $langs->trans("Days"), "w" => $langs->trans("Weeks"), "m" => $langs->trans("Months"), "y" => $langs->trans("Years")); } else { - $dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hour"), "d"=>$langs->trans("Day"), "w"=>$langs->trans("Week"), "m"=>$langs->trans("Month"), "y"=>$langs->trans("Year")); + $dur = array("i" => $langs->trans("Minute"), "h" => $langs->trans("Hour"), "d" => $langs->trans("Day"), "w" => $langs->trans("Week"), "m" => $langs->trans("Month"), "y" => $langs->trans("Year")); } $unit = preg_replace("/[^a-zA-Z]+/", "", $objp->duration); print max(1, $duration_value).' '.$dur[$unit]; @@ -441,7 +441,7 @@ if ($action == 'create') { print ''.$langs->trans("Label").''; print ''.$langs->trans("Status").''; - print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), 1, 0, 0, 0, '', 0, 0, 0, '', 'minwidth100'); + print $form->selectarray('status', array('0' => $langs->trans('ActivityCeased'), '1' => $langs->trans('InActivity')), 1, 0, 0, 0, '', 0, 0, 0, '', 'minwidth100'); print ''; // Morphy @@ -548,9 +548,9 @@ if ($rowid > 0) { print ''.$langs->trans("Duration").''.$object->duration_value.' '; if ($object->duration_value > 1) { - $dur = array("i"=>$langs->trans("Minutes"), "h"=>$langs->trans("Hours"), "d"=>$langs->trans("Days"), "w"=>$langs->trans("Weeks"), "m"=>$langs->trans("Months"), "y"=>$langs->trans("Years")); + $dur = array("i" => $langs->trans("Minutes"), "h" => $langs->trans("Hours"), "d" => $langs->trans("Days"), "w" => $langs->trans("Weeks"), "m" => $langs->trans("Months"), "y" => $langs->trans("Years")); } elseif ($object->duration_value > 0) { - $dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hour"), "d"=>$langs->trans("Day"), "w"=>$langs->trans("Week"), "m"=>$langs->trans("Month"), "y"=>$langs->trans("Year")); + $dur = array("i" => $langs->trans("Minute"), "h" => $langs->trans("Hour"), "d" => $langs->trans("Day"), "w" => $langs->trans("Week"), "m" => $langs->trans("Month"), "y" => $langs->trans("Year")); } print(!empty($object->duration_unit) && isset($dur[$object->duration_unit]) ? $langs->trans($dur[$object->duration_unit]) : '')." "; print ''; @@ -592,7 +592,7 @@ if ($rowid > 0) { $morphy = ''; } - if ($user->hasRight('adherent', 'configurer')&& !empty($object->status)) { + if ($user->hasRight('adherent', 'configurer') && !empty($object->status)) { print ''; } else { print ''; @@ -712,7 +712,7 @@ if ($rowid > 0) { $titre .= " (".$membertype->label.")"; } - $param = "&rowid=".urlencode($object->id); + $param = "&rowid=".urlencode((string) ($object->id)); if (!empty($mode)) { $param .= '&mode='.urlencode($mode); } @@ -956,7 +956,7 @@ if ($rowid > 0) { print ''.$langs->trans("Label").''; print ''.$langs->trans("Status").''; - print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), $object->status, 0, 0, 0, '', 0, 0, 0, '', 'minwidth100'); + print $form->selectarray('status', array('0' => $langs->trans('ActivityCeased'), '1' => $langs->trans('InActivity')), $object->status, 0, 0, 0, '', 0, 0, 0, '', 'minwidth100'); print ''; // Morphy diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index 772bc0efa6a..dcc7cdec446 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -5,6 +5,7 @@ * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2016 Charlie Benke * Copyright (C) 2017 Open-DSI + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -89,7 +90,7 @@ if ($action == 'set') { dolibarr_set_const($db, 'AGENDA_DEFAULT_VIEW', GETPOST('AGENDA_DEFAULT_VIEW'), 'chaine', 0, '', $conf->entity); $defaultValues = new DefaultValues($db); - $result = $defaultValues->fetchAll('', '', 0, 0, array('t.page'=>'comm/action/card.php', 't.param'=>'complete', 't.user_id'=>'0', 't.type'=>'createform', 't.entity'=>$conf->entity)); + $result = $defaultValues->fetchAll('', '', 0, 0, array('t.page' => 'comm/action/card.php', 't.param' => 'complete', 't.user_id' => '0', 't.type' => 'createform', 't.entity' => $conf->entity)); if (!is_array($result) && $result < 0) { setEventMessages($defaultValues->error, $defaultValues->errors, 'errors'); } elseif (count($result) > 0) { @@ -123,18 +124,16 @@ if ($action == 'set') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/action/doc/pdf_".$modele.".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db, $commande); @@ -334,7 +333,7 @@ $htmltext = $langs->trans("ThisValueCanOverwrittenOnUserLevel", $langs->transnoe print ''.$form->textwithpicto($langs->trans("AGENDA_DEFAULT_VIEW"), $htmltext).''."\n"; print ' '."\n"; print ''."\n"; -$tmplist = array(''=>' ', 'show_list'=>$langs->trans("ViewList"), 'show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_peruser'=>$langs->trans("ViewPerUser")); +$tmplist = array('' => ' ', 'show_list' => $langs->trans("ViewList"), 'show_month' => $langs->trans("ViewCal"), 'show_week' => $langs->trans("ViewWeek"), 'show_day' => $langs->trans("ViewDay"), 'show_peruser' => $langs->trans("ViewPerUser")); print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, getDolGlobalString('AGENDA_DEFAULT_VIEW')); print ''."\n"; @@ -369,7 +368,7 @@ print ' '."\n"; print ''."\n"; $defval = 'na'; $defaultValues = new DefaultValues($db); -$result = $defaultValues->fetchAll('', '', 0, 0, array('t.page'=>'comm/action/card.php', 't.param'=>'complete', 't.user_id'=>'0', 't.type'=>'createform', 't.entity'=>$conf->entity)); +$result = $defaultValues->fetchAll('', '', 0, 0, array('t.page' => 'comm/action/card.php', 't.param' => 'complete', 't.user_id' => '0', 't.type' => 'createform', 't.entity' => $conf->entity)); if (!is_array($result) && $result < 0) { setEventMessages($defaultValues->error, $defaultValues->errors, 'errors'); } elseif (count($result) > 0) { diff --git a/htdocs/admin/agenda_reminder.php b/htdocs/admin/agenda_reminder.php index fa4dd0df9a1..cdc6a2b8647 100644 --- a/htdocs/admin/agenda_reminder.php +++ b/htdocs/admin/agenda_reminder.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -86,18 +87,16 @@ if ($action == 'set') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/action/doc/pdf_".$modele.".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db, $commande); diff --git a/htdocs/admin/bank.php b/htdocs/admin/bank.php index f8ca472744f..865b54f5878 100644 --- a/htdocs/admin/bank.php +++ b/htdocs/admin/bank.php @@ -3,6 +3,7 @@ * Copyright (C) 2010-2016 Juanjo Menent * Copyright (C) 2013-2018 Philippe Grand * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -131,18 +132,16 @@ if ($action == 'specimen') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/bank/doc/pdf_".$modele.".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); diff --git a/htdocs/admin/bom.php b/htdocs/admin/bom.php index 319e5b71789..ebfa4e6772a 100644 --- a/htdocs/admin/bom.php +++ b/htdocs/admin/bom.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -76,18 +77,16 @@ if ($action == 'updateMask') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/bom/doc/pdf_".$modele.".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index 62d11335384..af9db12a62b 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -10,6 +10,7 @@ * Copyright (C) 2011-2016 Philippe Grand * Copyright (C) 2013 Florian Henry * Copyright (C) 2021 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -86,18 +87,16 @@ if ($action == 'updateMask') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/commande/doc/pdf_".$modele.".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php index e30a2b8d0c5..89e09907a6e 100644 --- a/htdocs/admin/contract.php +++ b/htdocs/admin/contract.php @@ -1,6 +1,7 @@ * Copyright (C) 2011-2018 Philippe Grand + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -82,18 +83,16 @@ if ($action == 'updateMask') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/contract/doc/pdf_".$modele.".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); diff --git a/htdocs/admin/delivery.php b/htdocs/admin/delivery.php index 0e6339c36f8..2c66f284c7d 100644 --- a/htdocs/admin/delivery.php +++ b/htdocs/admin/delivery.php @@ -8,6 +8,7 @@ * Copyright (C) 2011-2013 Juanjo Menent * Copyright (C) 2011-2018 Philippe Grand * Copyright (C) 2015 Claudio Aschieri + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -58,7 +59,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; // Shipment note -if (isModEnabled('delivery_note') && !getDolGlobalString('MAIN_SUBMODULE_EXPEDITION')) { +if (isModEnabled('shipping') && !getDolGlobalString('MAIN_SUBMODULE_EXPEDITION')) { // This option should always be set to on when module is on. dolibarr_set_const($db, "MAIN_SUBMODULE_EXPEDITION", "1", 'chaine', 0, '', $conf->entity); } @@ -131,18 +132,16 @@ if ($action == 'specimen') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/delivery/doc/pdf_".$modele.".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 0ca6a21bfe2..d895854ab2c 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -507,7 +507,7 @@ $tabcond[14] = (isModEnabled("product") && (isModEnabled('ecotax') || getDolGlob $tabcond[15] = true; $tabcond[16] = (isModEnabled("societe") && !getDolGlobalString('SOCIETE_DISABLE_PROSPECTS')); $tabcond[17] = (isModEnabled('deplacement') || isModEnabled('expensereport')); -$tabcond[18] = isModEnabled("delivery_note") || isModEnabled("reception"); +$tabcond[18] = isModEnabled("shipping") || isModEnabled("reception"); $tabcond[19] = isModEnabled("societe"); $tabcond[20] = isModEnabled("supplier_order"); $tabcond[21] = isModEnabled("propal"); @@ -1227,9 +1227,9 @@ if ($id == 7 && GETPOST('from') == 'accountancy') { $titlepicto = 'accountancy'; } -$param = '&id='.urlencode($id); +$param = '&id='.urlencode((string) ($id)); if ($search_country_id || GETPOSTISSET('page') || GETPOST('button_removefilter', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter_x', 'alpha')) { - $param .= '&search_country_id='.urlencode($search_country_id ? $search_country_id : -1); + $param .= '&search_country_id='.urlencode((string) ($search_country_id ? $search_country_id : -1)); } if ($search_code != '') { $param .= '&search_code='.urlencode($search_code); diff --git a/htdocs/admin/dolistore/class/dolistore.class.php b/htdocs/admin/dolistore/class/dolistore.class.php index 2fee52df32b..ac2e3c2ea46 100644 --- a/htdocs/admin/dolistore/class/dolistore.class.php +++ b/htdocs/admin/dolistore/class/dolistore.class.php @@ -68,7 +68,7 @@ class Dolistore $langtmp = explode('_', $langs->defaultlang); $lang = $langtmp[0]; - $lang_array = array('en'=>1, 'fr'=>2, 'es'=>3, 'it'=>4, 'de'=>5); // Into table ps_lang of Prestashop - 1 + $lang_array = array('en' => 1, 'fr' => 2, 'es' => 3, 'it' => 4, 'de' => 5); // Into table ps_lang of Prestashop - 1 if (!in_array($lang, array_keys($lang_array))) { $lang = 'en'; } @@ -270,7 +270,7 @@ class Dolistore // add image or default ? if ($product->id_default_image != '') { - $image_url = DOL_URL_ROOT.'/admin/dolistore/ajax/image.php?id_product='.urlencode(((int) $product->id)).'&id_image='.urlencode(((int) $product->id_default_image)); + $image_url = DOL_URL_ROOT.'/admin/dolistore/ajax/image.php?id_product='.urlencode((string) (((int) $product->id))).'&id_image='.urlencode((string) (((int) $product->id_default_image))); $images = ''; $images .= ''; } else { diff --git a/htdocs/admin/eventorganization.php b/htdocs/admin/eventorganization.php index 7016986b0bd..983a93a9c02 100644 --- a/htdocs/admin/eventorganization.php +++ b/htdocs/admin/eventorganization.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -47,20 +48,20 @@ $scandir = GETPOST('scan_dir', 'alpha'); $type = 'myobject'; $arrayofparameters = array( - 'EVENTORGANIZATION_TASK_LABEL'=>array('type'=>'textarea','enabled'=>1), - 'EVENTORGANIZATION_CATEG_THIRDPARTY_CONF'=>array('type'=>'category:'.Categorie::TYPE_CUSTOMER, 'enabled'=>1), - 'EVENTORGANIZATION_CATEG_THIRDPARTY_BOOTH'=>array('type'=>'category:'.Categorie::TYPE_CUSTOMER, 'enabled'=>1), - 'EVENTORGANIZATION_FILTERATTENDEES_CAT'=>array('type'=>'category:'.Categorie::TYPE_CUSTOMER, 'enabled'=>1), - 'EVENTORGANIZATION_FILTERATTENDEES_TYPE'=>array('type'=>'thirdparty_type:', 'enabled'=>1), - 'EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_CONF'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1), - 'EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_BOOTH'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1), - 'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1), - 'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1), + 'EVENTORGANIZATION_TASK_LABEL' => array('type' => 'textarea','enabled' => 1), + 'EVENTORGANIZATION_CATEG_THIRDPARTY_CONF' => array('type' => 'category:'.Categorie::TYPE_CUSTOMER, 'enabled' => 1), + 'EVENTORGANIZATION_CATEG_THIRDPARTY_BOOTH' => array('type' => 'category:'.Categorie::TYPE_CUSTOMER, 'enabled' => 1), + 'EVENTORGANIZATION_FILTERATTENDEES_CAT' => array('type' => 'category:'.Categorie::TYPE_CUSTOMER, 'enabled' => 1), + 'EVENTORGANIZATION_FILTERATTENDEES_TYPE' => array('type' => 'thirdparty_type:', 'enabled' => 1), + 'EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_CONF' => array('type' => 'emailtemplate:conferenceorbooth', 'enabled' => 1), + 'EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_BOOTH' => array('type' => 'emailtemplate:conferenceorbooth', 'enabled' => 1), + 'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH' => array('type' => 'emailtemplate:conferenceorbooth', 'enabled' => 1), + 'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT' => array('type' => 'emailtemplate:conferenceorbooth', 'enabled' => 1), //'EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_SPEAKER'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1), //'EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_ATTENDES'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1), - 'SERVICE_BOOTH_LOCATION'=>array('type'=>'product', 'enabled'=>1), - 'SERVICE_CONFERENCE_ATTENDEE_SUBSCRIPTION'=>array('type'=>'product', 'enabled'=>1), - 'EVENTORGANIZATION_SECUREKEY'=>array('type'=>'securekey', 'enabled'=>1), + 'SERVICE_BOOTH_LOCATION' => array('type' => 'product', 'enabled' => 1), + 'SERVICE_CONFERENCE_ATTENDEE_SUBSCRIPTION' => array('type' => 'product', 'enabled' => 1), + 'EVENTORGANIZATION_SECUREKEY' => array('type' => 'securekey', 'enabled' => 1), ); $error = 0; @@ -80,7 +81,7 @@ if (empty($user->admin)) { */ if ($cancel) { - $action =''; + $action = ''; } include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; @@ -111,18 +112,16 @@ if ($action == 'updateMask') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/eventorganization/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); @@ -218,7 +217,7 @@ if ($action == 'edit') { print ''.$langs->trans("Parameter").''.$langs->trans("Value").''; foreach ($arrayofparameters as $constname => $val) { - if ($val['enabled']==1) { + if ($val['enabled'] == 1) { $setupnotempty++; print ''; $tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : ''); @@ -230,7 +229,7 @@ if ($action == 'edit') { print '\n"; - } elseif ($val['type']== 'html') { + } elseif ($val['type'] == 'html') { require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; $doleditor = new DolEditor($constname, getDolGlobalString($constname), '', 160, 'dolibarr_notes', '', false, false, isModEnabled('fckeditor'), ROWS_5, '90%'); $doleditor->Create(); @@ -300,7 +299,7 @@ if ($action == 'edit') { print ''.$langs->trans("Parameter").''.$langs->trans("Value").''; foreach ($arrayofparameters as $constname => $val) { - if ($val['enabled']==1) { + if ($val['enabled'] == 1) { $setupnotempty++; print ''; print ''; @@ -311,7 +310,7 @@ if ($action == 'edit') { if ($val['type'] == 'textarea') { print dol_nl2br(getDolGlobalString($constname)); - } elseif ($val['type']== 'html') { + } elseif ($val['type'] == 'html') { print getDolGlobalString($constname); } elseif ($val['type'] == 'yesno') { print ajax_constantonoff($constname); @@ -348,13 +347,13 @@ if ($action == 'edit') { print '
    ' . implode(' ', $toprint) . '
'; } } elseif (preg_match('/thirdparty_type/', $val['type'])) { - if (getDolGlobalString($constname)==2) { + if (getDolGlobalString($constname) == 2) { print $langs->trans("Prospect"); - } elseif (getDolGlobalString($constname)==3) { + } elseif (getDolGlobalString($constname) == 3) { print $langs->trans("ProspectCustomer"); - } elseif (getDolGlobalString($constname)==1) { + } elseif (getDolGlobalString($constname) == 1) { print $langs->trans("Customer"); - } elseif (getDolGlobalString($constname)==0) { + } elseif (getDolGlobalString($constname) == 0) { print $langs->trans("NorProspectNorCustomer"); } } elseif ($val['type'] == 'product') { diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index d054f3bfa5e..082d2a39741 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -7,6 +7,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2011-2012 Juanjo Menent * Copyright (C) 2011-2018 Philippe Grand + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -102,18 +103,16 @@ if ($action == 'updateMask') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/expedition/doc/pdf_".$modele.".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); diff --git a/htdocs/admin/expensereport.php b/htdocs/admin/expensereport.php index 64cba2b7c6f..d0fa6cfd98b 100644 --- a/htdocs/admin/expensereport.php +++ b/htdocs/admin/expensereport.php @@ -7,6 +7,7 @@ * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2011-2013 Juanjo Menent * Copyright (C) 2011-2022 Philippe Grand + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -83,18 +84,16 @@ if ($action == 'updateMask') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/expensereport/doc/pdf_".$modele.".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php index aba9db7f9fd..250d4d9e2cd 100644 --- a/htdocs/admin/fichinter.php +++ b/htdocs/admin/fichinter.php @@ -7,6 +7,7 @@ * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2011-2013 Juanjo Menent * Copyright (C) 2011-2018 Philippe Grand + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -82,18 +83,16 @@ if ($action == 'updateMask') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/fichinter/doc/pdf_".$modele.".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); diff --git a/htdocs/admin/holiday.php b/htdocs/admin/holiday.php index 34153e22866..1a8a343ea69 100644 --- a/htdocs/admin/holiday.php +++ b/htdocs/admin/holiday.php @@ -3,6 +3,7 @@ * Copyright (C) 2011-2018 Philippe Grand * Copyright (C) 2018 Charlene Benke * Copyright (C) 2018 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -82,18 +83,16 @@ if ($action == 'updateMask') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/holiday/doc/pdf_".$modele.".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); diff --git a/htdocs/admin/hrm.php b/htdocs/admin/hrm.php index eef0a7a34a8..df883799b2b 100644 --- a/htdocs/admin/hrm.php +++ b/htdocs/admin/hrm.php @@ -4,6 +4,7 @@ * Copyright (C) 2021 Greg Rastklan * Copyright (C) 2021 Jean-Pascal BOUDET * Copyright (C) 2021 Grégory BLEMAND + * Copyright (C) 2024 MDW * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -116,18 +117,16 @@ if ($action == 'update') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/hrm/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); diff --git a/htdocs/admin/invoice.php b/htdocs/admin/invoice.php index 26678685f53..a2f0282ba9f 100644 --- a/htdocs/admin/invoice.php +++ b/htdocs/admin/invoice.php @@ -7,6 +7,7 @@ * Copyright (C) 2012-2013 Juanjo Menent * Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com> * Copyright (C) 2022 Anthony Berton + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -99,18 +100,16 @@ if ($action == 'updateMask') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/facture/doc/pdf_".$modele.".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); @@ -628,10 +627,10 @@ if (getDolGlobalString('INVOICE_USE_DEFAULT_DOCUMENT')) { // Hidden conf print "\n"; $listtype = array( - Facture::TYPE_STANDARD=>$langs->trans("InvoiceStandard"), - Facture::TYPE_REPLACEMENT=>$langs->trans("InvoiceReplacement"), - Facture::TYPE_CREDIT_NOTE=>$langs->trans("InvoiceAvoir"), - Facture::TYPE_DEPOSIT=>$langs->trans("InvoiceDeposit"), + Facture::TYPE_STANDARD => $langs->trans("InvoiceStandard"), + Facture::TYPE_REPLACEMENT => $langs->trans("InvoiceReplacement"), + Facture::TYPE_CREDIT_NOTE => $langs->trans("InvoiceAvoir"), + Facture::TYPE_DEPOSIT => $langs->trans("InvoiceDeposit"), ); if (getDolGlobalInt('INVOICE_USE_SITUATION')) { $listtype[Facture::TYPE_SITUATION] = $langs->trans("InvoiceSituation"); diff --git a/htdocs/admin/knowledgemanagement.php b/htdocs/admin/knowledgemanagement.php index b8445a0fb9a..1f79f506c89 100644 --- a/htdocs/admin/knowledgemanagement.php +++ b/htdocs/admin/knowledgemanagement.php @@ -1,6 +1,7 @@ * Copyright (C) 2021 SuperAdmin + * Copyright (C) 2024 MDW * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -94,18 +95,16 @@ if ($action == 'updateMask') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/knowledgemanagement/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index e224b75a986..1856e89f875 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -273,9 +273,9 @@ if ($action == 'edit') { jQuery("#MAIN_MAIL_SMTP_SERVER").show(); jQuery("#MAIN_MAIL_SMTP_PORT").show(); jQuery("#smtp_server_mess").hide(); - jQuery("#smtp_port_mess").hide(); + jQuery("#smtp_port_mess").hide(); jQuery(".smtp_method").show(); - jQuery(".dkim").hide(); + jQuery(".dkim").hide(); jQuery(".smtp_auth_method").show(); } if (jQuery("#MAIN_MAIL_SENDMODE").val()==\'swiftmailer\') @@ -302,9 +302,9 @@ if ($action == 'edit') { jQuery("#MAIN_MAIL_SMTP_PORT").show(); jQuery("#smtp_server_mess").hide(); jQuery("#smtp_port_mess").hide(); - jQuery(".smtp_method").show(); + jQuery(".smtp_method").show(); jQuery(".dkim").show(); - jQuery(".smtp_auth_method").show(); + jQuery(".smtp_auth_method").show(); } } function change_smtp_auth_method() { @@ -1109,7 +1109,7 @@ if ($action == 'edit') { $formmail->withtopicreadonly = 0; $formmail->withfile = 2; $formmail->withlayout = 1; - $formmail->withaiprompt = 1; + $formmail->withaiprompt = ($action == 'testhtml' ? 'html' : 'text'); $formmail->withbody = (GETPOSTISSET('message') ? GETPOST('message', 'restricthtml') : ($action == 'testhtml' ? $langs->transnoentities("PredefinedMailTestHtml") : $langs->transnoentities("PredefinedMailTest"))); $formmail->withbodyreadonly = 0; $formmail->withcancel = 1; diff --git a/htdocs/admin/mails_senderprofile_list.php b/htdocs/admin/mails_senderprofile_list.php index 0f314ba993a..bcf786ec1b0 100644 --- a/htdocs/admin/mails_senderprofile_list.php +++ b/htdocs/admin/mails_senderprofile_list.php @@ -108,11 +108,11 @@ foreach ($object->fields as $key => $val) { 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'] : '' ); } } @@ -121,10 +121,10 @@ if (!empty($extrafields->attributes[$object->table_element]['label']) && is_arra foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) { $arrayfields["ef.".$key] = array( - 'label'=>$extrafields->attributes[$object->table_element]['label'][$key], - 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), - 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], - 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]) + 'label' => $extrafields->attributes[$object->table_element]['label'][$key], + 'checked' => (($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), + 'position' => $extrafields->attributes[$object->table_element]['pos'][$key], + 'enabled' => (abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]) ); } } @@ -591,7 +591,7 @@ foreach ($object->fields as $key => $val) { // Extra fields 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 @@ -635,7 +635,7 @@ foreach ($object->fields as $key => $val) { 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 @@ -706,7 +706,7 @@ while ($i < $imaxinloop) { $url .= '&limit='.((int) $limit); } if ($page) { - $url .= '&page='.urlencode($page); + $url .= '&page='.urlencode((string) ($page)); } if ($sortfield) { $url .= '&sortfield='.urlencode($sortfield); @@ -783,7 +783,7 @@ while ($i < $imaxinloop) { // 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; @@ -796,7 +796,7 @@ while ($i < $imaxinloop) { $url .= '&limit='.((int) $limit); } if ($page) { - $url .= '&page='.urlencode($page); + $url .= '&page='.urlencode((string) ($page)); } if ($sortfield) { $url .= '&sortfield='.urlencode($sortfield); @@ -845,7 +845,7 @@ if ($num == 0) { $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/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 830a129b74a..ae1f8bf67d1 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -204,7 +204,7 @@ if (isModEnabled('order') && $user->hasRight('commande', 'lire')) { if (isModEnabled('invoice') && $user->hasRight('facture', 'lire')) { $elementList['facture_send'] = img_picto('', 'bill', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendInvoice')); } -if (isModEnabled("delivery_note")) { +if (isModEnabled("shipping")) { $elementList['shipping_send'] = img_picto('', 'dolly', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendShipment')); } if (isModEnabled("reception")) { diff --git a/htdocs/admin/modulehelp.php b/htdocs/admin/modulehelp.php index 50e83f65fcb..e076187e563 100644 --- a/htdocs/admin/modulehelp.php +++ b/htdocs/admin/modulehelp.php @@ -2,6 +2,7 @@ /* Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2017 Regis Houssin * Copyright (C) 2022 Charlene Benke + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -167,7 +168,10 @@ foreach ($modulesdir as $dir) { $familyinfo = array_merge($familyinfo, $objMod->familyinfo); $familykey = key($objMod->familyinfo); } else { - $familykey = empty($objMod->family) ? 'other' : $objMod->family; + $familykey = $objMod->family; + } + if (empty($familykey) || $familykey === null) { + $familykey = 'other'; } $moduleposition = ($objMod->module_position ? $objMod->module_position : '50'); diff --git a/htdocs/admin/mrp.php b/htdocs/admin/mrp.php index 5c2de506880..f616df182c4 100644 --- a/htdocs/admin/mrp.php +++ b/htdocs/admin/mrp.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -77,18 +78,16 @@ if ($action == 'updateMask') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/mrp/doc/pdf_".$modele.".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index 6913857a69f..401db58d473 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -7,6 +7,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2011-2013 Juanjo Menent + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -82,18 +83,16 @@ if ($action == 'updateMask') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/propale/doc/pdf_".$modele.".modules.php"); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); diff --git a/htdocs/admin/reception_setup.php b/htdocs/admin/reception_setup.php index 3b5ee37b77c..b5f8e336b20 100644 --- a/htdocs/admin/reception_setup.php +++ b/htdocs/admin/reception_setup.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -105,18 +106,16 @@ if ($action == 'updateMask') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/reception/doc/pdf_".$modele.".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index 4c8c5fc51ae..86f485c11a4 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -5,6 +5,7 @@ * Copyright (C) 2012-2013 Juanjo Menent * Copyright (C) 2013-2018 Philippe Grand * Copyright (C) 2013 Florian Henry + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -109,18 +110,16 @@ if ($action == 'specimen') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/stock/doc/pdf_".$modele.".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); @@ -270,7 +269,7 @@ print ''; print ''; print ''.$langs->trans("DeStockOnShipment").''; print ''; -if (isModEnabled("delivery_note")) { +if (isModEnabled("shipping")) { if ($conf->use_javascript_ajax) { print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT', array(), null, 0, 0, 0, 2, 1, '', '', 'reposition'); } else { @@ -287,7 +286,7 @@ print ''; print ''; print ''.$langs->trans("DeStockOnShipmentOnClosing").''; print ''; -if (isModEnabled("delivery_note")) { +if (isModEnabled("shipping")) { if ($conf->use_javascript_ajax) { print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT_CLOSE', array(), null, 0, 0, 0, 2, 1, '', '', 'reposition'); } else { @@ -461,7 +460,7 @@ if (isModEnabled('order')) { print "\n"; } -if (isModEnabled("delivery_note")) { +if (isModEnabled("shipping")) { print ''; print ''.$langs->trans("StockMustBeEnoughForShipment").''; print ''; diff --git a/htdocs/admin/stocktransfer.php b/htdocs/admin/stocktransfer.php index b7e027db2b2..dee8ebc3b14 100644 --- a/htdocs/admin/stocktransfer.php +++ b/htdocs/admin/stocktransfer.php @@ -2,6 +2,7 @@ /* Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2021 Gauthier VERDOL * Copyright (C) 2021 SuperAdmin + * Copyright (C) 2024 MDW * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -91,18 +92,16 @@ if ($action == 'updateMask') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/stocktransfer/doc/pdf_".$modele.".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); diff --git a/htdocs/admin/supplier_invoice.php b/htdocs/admin/supplier_invoice.php index 52b1342f88e..38db853af92 100644 --- a/htdocs/admin/supplier_invoice.php +++ b/htdocs/admin/supplier_invoice.php @@ -6,6 +6,7 @@ * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2010-2013 Juanjo Menent * Copyright (C) 2011-2018 Philippe Grand + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -102,18 +103,16 @@ if ($action == 'specimen') { // For invoices // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/supplier_invoice/doc/pdf_".$modele.".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db, $facture); diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index 849a6dff7f3..ecfc2a68b93 100644 --- a/htdocs/admin/supplier_order.php +++ b/htdocs/admin/supplier_order.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2004 Sebastien Di Cintio @@ -92,18 +93,16 @@ if ($action == 'specimen') { // For orders // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/supplier_order/doc/pdf_".$modele.".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db, $commande); diff --git a/htdocs/admin/supplier_payment.php b/htdocs/admin/supplier_payment.php index c8ac3fa4423..e420a914155 100644 --- a/htdocs/admin/supplier_payment.php +++ b/htdocs/admin/supplier_payment.php @@ -2,6 +2,7 @@ /* Copyright (C) 2015 Juanjo Menent * Copyright (C) 2016 Laurent Destailleur * Copyright (C) 2020 Maxime DEMAREST + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -103,18 +104,16 @@ if ($action == 'updateMask') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/supplier_payment/doc/pdf_".$modele.".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); diff --git a/htdocs/admin/supplier_proposal.php b/htdocs/admin/supplier_proposal.php index 09728fbe93e..94197b4bdad 100644 --- a/htdocs/admin/supplier_proposal.php +++ b/htdocs/admin/supplier_proposal.php @@ -8,6 +8,7 @@ * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2011-2013 Juanjo Menent * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -81,18 +82,16 @@ if ($action == 'specimen') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/supplier_proposal/doc/pdf_".$modele.".modules.php"); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index b1b1242ebcc..902239fca39 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -278,7 +278,7 @@ if ($result) { $param .= '&optioncss='.urlencode($optioncss); } if ($search_rowid) { - $param .= '&search_rowid='.urlencode($search_rowid); + $param .= '&search_rowid='.urlencode((string) ($search_rowid)); } if ($search_code) { $param .= '&search_code='.urlencode($search_code); diff --git a/htdocs/admin/webhook.php b/htdocs/admin/webhook.php index 7755856f8a0..4758220503d 100644 --- a/htdocs/admin/webhook.php +++ b/htdocs/admin/webhook.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -99,18 +100,16 @@ if ($action == 'updateMask') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/webhook/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele."_".strtolower($tmpobjectkey); break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); diff --git a/htdocs/admin/workflow.php b/htdocs/admin/workflow.php index 1628db01977..e06954b0422 100644 --- a/htdocs/admin/workflow.php +++ b/htdocs/admin/workflow.php @@ -101,13 +101,13 @@ $workflowcodes = array( 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING'=>array( // when shipping validated 'family'=>'classify_order', 'position'=>40, - 'enabled'=>(isModEnabled("delivery_note") && isModEnabled('order')), + 'enabled'=>(isModEnabled("shipping") && isModEnabled('order')), 'picto'=>'order' ), 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED'=>array( // when shipping closed 'family'=>'classify_order', 'position'=>41, - 'enabled'=>(isModEnabled("delivery_note") && isModEnabled('order')), + 'enabled'=>(isModEnabled("shipping") && isModEnabled('order')), 'picto'=>'order' ), 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER'=>array( @@ -166,7 +166,7 @@ $workflowcodes = array( 'WORKFLOW_SHIPPING_CLASSIFY_BILLED_INVOICE' => array( 'family' => 'classify_shipping', 'position' => 91, - 'enabled' => isModEnabled("delivery_note") && isModEnabled("invoice") && getDolGlobalString('WORKFLOW_BILL_ON_SHIPMENT') !== '0', + 'enabled' => isModEnabled("shipping") && isModEnabled("invoice") && getDolGlobalString('WORKFLOW_BILL_ON_SHIPMENT') !== '0', 'picto' => 'shipment' ), diff --git a/htdocs/admin/workstation.php b/htdocs/admin/workstation.php index 67c2bb9869a..78084737c6e 100644 --- a/htdocs/admin/workstation.php +++ b/htdocs/admin/workstation.php @@ -1,6 +1,7 @@ * Copyright (C) 2020 Gauthier VERDOL + * Copyright (C) 2024 MDW * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -84,18 +85,16 @@ if ($action == 'updateMask') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/workstation/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); diff --git a/htdocs/ai/admin/custom_prompt.php b/htdocs/ai/admin/custom_prompt.php index c784e9ae3b8..ee62b646604 100644 --- a/htdocs/ai/admin/custom_prompt.php +++ b/htdocs/ai/admin/custom_prompt.php @@ -126,6 +126,25 @@ if ($action == 'update' && !GETPOST('cancel')) { $action = 'edit'; } +if ($action == 'confirm_deleteproperty') { + $key = GETPOST('key', 'alpha'); + + //var_dump($currentConfigurations[$key]);exit; + if (isset($currentConfigurations[$key])) { + unset($currentConfigurations[$key]); + + $newConfigurationsJson = json_encode($currentConfigurations, JSON_UNESCAPED_UNICODE); + $res = dolibarr_set_const($db, 'AI_CONFIGURATIONS_PROMPT', $newConfigurationsJson, 'chaine', 0, '', $conf->entity); + if ($res) { + header("Location: ".$_SERVER['PHP_SELF']); + setEventMessages($langs->trans("SetupDeleted"), null, 'mesgs'); + exit; + } else { + setEventMessages($langs->trans("ErrorDeleting"), null, 'errors'); + } + } +} + /* * View @@ -152,11 +171,25 @@ $newbutton = ''; print load_fiche_titre($langs->trans("AIPromptForFeatures"), $newbutton, ''); +if ($action == 'deleteproperty') { + $formconfirm = $form->formconfirm( + $_SERVER["PHP_SELF"].'?key='.urlencode(GETPOST('key', 'alpha')), + $langs->trans('Delete'), + $langs->trans('ConfirmDeleteSetup', GETPOST('key', 'alpha')), + 'confirm_deleteproperty', + '', + 0, + 1 + ); + print $formconfirm; +} + if ($action == 'edit') { $out .= ''; $out .= ''; $out .= ''; + $out .= ''; $out .= ''; $out .= ''; @@ -235,7 +268,10 @@ if ($action == 'edit' || $action == 'create') { $out .= ''; $out .= ''; - $out .= ''; + $out .= ''; $out .= ''; $out .= ''; $out .= ''; diff --git a/htdocs/ai/admin/setup.php b/htdocs/ai/admin/setup.php index 73e4765d7a4..9459b501b84 100644 --- a/htdocs/ai/admin/setup.php +++ b/htdocs/ai/admin/setup.php @@ -1,6 +1,7 @@ * Copyright (C) 2022 Alice Adminson + * Copyright (C) 2024 MDW * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -75,7 +76,7 @@ foreach ($arrayofia as $ia) { $item->cssClass = 'minwidth500'; } -$setupnotempty =+ count($formSetup->items); +$setupnotempty = + count($formSetup->items); $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); @@ -113,18 +114,16 @@ if ($action == 'updateMask') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/ai/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele."_".strtolower($tmpobjectkey); break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); @@ -193,45 +192,45 @@ $action = 'edit'; * View */ - $form = new Form($db); +$form = new Form($db); - $help_url = ''; - $title = "AiSetup"; +$help_url = ''; +$title = "AiSetup"; - llxHeader('', $langs->trans($title), $help_url); +llxHeader('', $langs->trans($title), $help_url); - // Subheader - $linkback = ''.$langs->trans("BackToModuleList").''; +// Subheader +$linkback = ''.$langs->trans("BackToModuleList").''; - print load_fiche_titre($langs->trans($title), $linkback, 'title_setup'); +print load_fiche_titre($langs->trans($title), $linkback, 'title_setup'); - // Configuration header - $head = aiAdminPrepareHead(); - print dol_get_fiche_head($head, 'settings', $langs->trans($title), -1, "fa-microchip"); +// Configuration header +$head = aiAdminPrepareHead(); +print dol_get_fiche_head($head, 'settings', $langs->trans($title), -1, "fa-microchip"); - // Setup page goes here - //echo ''.$langs->trans("AiSetupPage").'

'; +// Setup page goes here +//echo ''.$langs->trans("AiSetupPage").'

'; if ($action == 'edit') { - print $formSetup->generateOutput(true); - print '
'; + print $formSetup->generateOutput(true); + print '
'; } elseif (!empty($formSetup->items)) { print $formSetup->generateOutput(); print '
'; print ''.$langs->trans("Modify").''; print '
'; } else { - print '
'.$langs->trans("NothingToSetup"); + print '
'.$langs->trans("NothingToSetup"); } if (empty($setupnotempty)) { - print '
'.$langs->trans("NothingToSetup"); + print '
'.$langs->trans("NothingToSetup"); } - // Page end - print dol_get_fiche_end(); +// Page end +print dol_get_fiche_end(); - llxFooter(); - $db->close(); +llxFooter(); +$db->close(); diff --git a/htdocs/ai/ajax/generate_content.php b/htdocs/ai/ajax/generate_content.php index f60cef9ee09..2d65256ad01 100644 --- a/htdocs/ai/ajax/generate_content.php +++ b/htdocs/ai/ajax/generate_content.php @@ -61,13 +61,20 @@ if (is_null($jsonData)) { } $ai = new Ai($db); -$instructions = dol_string_nohtmltag($jsonData['instructions'], 1, 'UTF-8'); $function = 'textgeneration'; +$instructions = dol_string_nohtmltag($jsonData['instructions'], 1, 'UTF-8'); +$format = empty($jsonData['instructions']) ? '' : $jsonData['instructions']; -$generatedContent = $ai->generateContent($instructions, 'auto', $function); +$generatedContent = $ai->generateContent($instructions, 'auto', $function, $format); if (is_array($generatedContent) && $generatedContent['error']) { - print "Error returned by API call: " . $generatedContent['message']; + // client errors + if ($generatedContent['code'] >= 400) { + print "Error : " . $generatedContent['message']; + print '
'.$langs->trans('Check Config of Module').''; + } else { + print "Error returned by API call: " . $generatedContent['message']; + } } else { print $generatedContent; } diff --git a/htdocs/ai/class/ai.class.php b/htdocs/ai/class/ai.class.php index fd1c7ca17c5..68002b62bb8 100644 --- a/htdocs/ai/class/ai.class.php +++ b/htdocs/ai/class/ai.class.php @@ -1,9 +1,5 @@ - * Copyright (C) 2005-2016 Regis Houssin - * Copyright (C) 2012 J. Fernando Lagrange - * Copyright (C) 2015 Raphaël Doursenaud - * Copyright (C) 2023 Eric Seigne +/* Copyright (C) 2024 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,13 +16,14 @@ * or see https://www.gnu.org/ */ require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"; +require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; + /** * Class for AI */ class Ai { - /** * @var DoliDB $db Database object */ @@ -57,12 +54,13 @@ class Ai /** * Generate response of instructions * - * @param string $instructions instruction for generate content - * @param string $model model name ('gpt-3.5-turbo') - * @param string $function code of the feature we want to use ('emailing', 'transcription', 'audiotext', 'imagegeneration', 'translation') + * @param string $instructions Instruction to generate content + * @param string $model Model name ('gpt-3.5-turbo', 'gpt-4-turbo', 'dall-e-3', ...) + * @param string $function Code of the feature we want to use ('textgeneration', 'transcription', 'audiotext', 'imagegeneration', 'translation') + * @param string $format Format for output ('', 'html', ...) * @return mixed $response */ - public function generateContent($instructions, $model = 'auto', $function = 'textgeneration') + public function generateContent($instructions, $model = 'auto', $function = 'textgeneration', $format = '') { if (empty($this->apiKey)) { return array('error' => true, 'message' => 'API key is no defined'); @@ -121,40 +119,37 @@ class Ai } $fullInstructions = $prePrompt.' '.$instructions.' .'.$postPrompt; - // TODO Replace this with a simple call of getDolURLContent(); - $ch = curl_init($this->apiEndpoint); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([ + + $payload = json_encode([ 'messages' => [ ['role' => 'user', 'content' => $fullInstructions] ], 'model' => $model - ])); - curl_setopt($ch, CURLOPT_HTTPHEADER, [ + ]); + + $headers = ([ 'Authorization: Bearer ' . $this->apiKey, 'Content-Type: application/json' ]); + $response = getURLContent($this->apiEndpoint, 'POST', $payload, $headers); - $response = curl_exec($ch); - if (curl_errno($ch)) { - throw new Exception('cURL error: ' . curl_error($ch)); - } - - $statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); - if ($statusCode != 200) { - throw new Exception('API request failed with status code ' . $statusCode); + if ($response['http_code'] != 200) { + throw new Exception('API request failed with status code ' . $response['http_code']); } // Decode JSON response - $decodedResponse = json_decode($response, true); + $decodedResponse = json_decode($response['content'], true); // Extraction content $generatedEmailContent = $decodedResponse['choices'][0]['message']['content']; + // If content is not HTML, we convert it into HTML + if (!dol_textishtml($generatedEmailContent)) { + $generatedEmailContent = dol_nl2br($generatedEmailContent); + } + return $generatedEmailContent; } catch (Exception $e) { return array('error' => true, 'message' => $e->getMessage()); - } finally { - curl_close($ch); } } } diff --git a/htdocs/asset/admin/setup.php b/htdocs/asset/admin/setup.php index 72e6cac37ea..40e37464e90 100644 --- a/htdocs/asset/admin/setup.php +++ b/htdocs/asset/admin/setup.php @@ -1,6 +1,7 @@ * Copyright (C) 2018 Alexandre Spangaro + * Copyright (C) 2024 MDW * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -96,18 +97,16 @@ if ($action == 'updateMask') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/asset/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); diff --git a/htdocs/asset/agenda.php b/htdocs/asset/agenda.php index f25da35dd6a..56e33e2e317 100644 --- a/htdocs/asset/agenda.php +++ b/htdocs/asset/agenda.php @@ -99,7 +99,7 @@ if (!isModEnabled('asset')) { * Actions */ -$parameters = array('id'=>$id); +$parameters = array('id' => $id); $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'); @@ -167,14 +167,14 @@ if ($object->id > 0) { $objthirdparty = $object; $objcon = new stdClass(); - $out = '&origin=' . urlencode($object->element . '@' . $object->module) . '&originid=' . urlencode($object->id); + $out = '&origin=' . urlencode((string) ($object->element . '@' . $object->module)) . '&originid=' . urlencode((string) ($object->id)); $urlbacktopage = $_SERVER['PHP_SELF'] . '?id=' . $object->id; $out .= '&backtopage=' . urlencode($urlbacktopage); $permok = $user->hasRight('agenda', 'myactions', 'create'); if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) { //$out.=' * Copyright (C) 2018 Alexandre Spangaro * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -93,7 +94,7 @@ class Asset extends CommonObject */ /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'css' => 'left', 'comment' => "Id"), diff --git a/htdocs/asset/class/assetdepreciationoptions.class.php b/htdocs/asset/class/assetdepreciationoptions.class.php index e6aa273060c..1be3533eedd 100644 --- a/htdocs/asset/class/assetdepreciationoptions.class.php +++ b/htdocs/asset/class/assetdepreciationoptions.class.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -64,7 +65,7 @@ class AssetDepreciationOptions extends CommonObject */ /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array(); @@ -77,15 +78,15 @@ class AssetDepreciationOptions extends CommonObject 'label' => 'AssetDepreciationOptionEconomic', 'table' => 'asset_depreciation_options_economic', 'fields' => array( - 'depreciation_type' => array('type'=>'smallint', 'label'=>'AssetDepreciationOptionDepreciationType', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>1, 'default'=>'0', 'arrayofkeyval'=>array('0'=>'AssetDepreciationOptionDepreciationTypeLinear', '1'=>'AssetDepreciationOptionDepreciationTypeDegressive', '2'=>'AssetDepreciationOptionDepreciationTypeExceptional'), 'validate'=>'1',), - 'degressive_coefficient' => array('type'=>'double(24,8)', 'label'=>'AssetDepreciationOptionDegressiveRate', 'enabled'=>'1', 'position'=>20, 'notnull'=>1, 'visible'=>1, 'default'=>'0', 'isameasure'=>'1', 'validate'=>'1','enabled_field' => 'economic:depreciation_type:1'), - 'duration' => array('type'=>'integer', 'label'=>'AssetDepreciationOptionDuration', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'default'=>'0', 'isameasure'=>'1', 'validate'=>'1',), - 'duration_type' => array('type'=>'smallint', 'label'=>'AssetDepreciationOptionDurationType', 'enabled'=>'1', 'position'=>40, 'notnull'=>1, 'visible'=>1, 'default'=>'0', 'arrayofkeyval'=>array('0'=>'AssetDepreciationOptionDurationTypeAnnual', '1'=>'AssetDepreciationOptionDurationTypeMonthly'/*, '2'=>'AssetDepreciationOptionDurationTypeDaily'*/), 'validate'=>'1',), - 'rate' => array('type'=>'double(24,8)', 'label'=>'AssetDepreciationOptionRate', 'enabled'=>'1', 'position'=>50, 'visible'=>3, 'default'=>'0', 'isameasure'=>'1', 'validate'=>'1', 'computed' => '$object->asset_depreciation_options->getRate("economic")',), - 'accelerated_depreciation_option' => array('type'=>'boolean', 'label'=>'AssetDepreciationOptionAcceleratedDepreciation', 'enabled'=>'1', 'position'=>60, 'column_break' => true, 'notnull'=>0, 'default'=>'0', 'visible'=>1, 'validate'=>'1',), - 'amount_base_depreciation_ht' => array('type'=>'price', 'label'=>'AssetDepreciationOptionAmountBaseDepreciationHT', 'enabled'=>'isset($object)&&get_class($object)=="Asset"', 'only_on_asset'=>1, 'position'=>90, 'notnull'=>0, 'required'=>1, 'visible'=>1, 'default'=>'$object->reversal_amount_ht > 0 ? $object->reversal_amount_ht : $object->acquisition_value_ht', 'isameasure'=>'1', 'validate'=>'1',), - 'amount_base_deductible_ht' => array('type'=>'price', 'label'=>'AssetDepreciationOptionAmountBaseDeductibleHT', 'enabled'=>'isset($object)&&get_class($object)=="Asset"', 'only_on_asset'=>1, 'position'=>100, 'notnull'=>0, 'visible'=>1, 'default'=>'0', 'isameasure'=>'1', 'validate'=>'1',), - 'total_amount_last_depreciation_ht' => array('type'=>'price', 'label'=>'AssetDepreciationOptionTotalAmountLastDepreciationHT', 'enabled'=>'isset($object)&&get_class($object)=="Asset"', 'only_on_asset'=>1, 'position'=>110, 'noteditable'=> 1, 'notnull'=>0, 'visible'=>1, 'default'=>'0', 'isameasure'=>'1', 'validate'=>'1',), + 'depreciation_type' => array('type' => 'smallint', 'label' => 'AssetDepreciationOptionDepreciationType', 'enabled' => '1', 'position' => 10, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'arrayofkeyval' => array('0' => 'AssetDepreciationOptionDepreciationTypeLinear', '1' => 'AssetDepreciationOptionDepreciationTypeDegressive', '2' => 'AssetDepreciationOptionDepreciationTypeExceptional'), 'validate' => '1',), + 'degressive_coefficient' => array('type' => 'double(24,8)', 'label' => 'AssetDepreciationOptionDegressiveRate', 'enabled' => '1', 'position' => 20, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'isameasure' => '1', 'validate' => '1','enabled_field' => 'economic:depreciation_type:1'), + 'duration' => array('type' => 'integer', 'label' => 'AssetDepreciationOptionDuration', 'enabled' => '1', 'position' => 30, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'isameasure' => '1', 'validate' => '1',), + 'duration_type' => array('type' => 'smallint', 'label' => 'AssetDepreciationOptionDurationType', 'enabled' => '1', 'position' => 40, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'arrayofkeyval' => array('0' => 'AssetDepreciationOptionDurationTypeAnnual', '1' => 'AssetDepreciationOptionDurationTypeMonthly'/*, '2'=>'AssetDepreciationOptionDurationTypeDaily'*/), 'validate' => '1',), + 'rate' => array('type' => 'double(24,8)', 'label' => 'AssetDepreciationOptionRate', 'enabled' => '1', 'position' => 50, 'visible' => 3, 'default' => '0', 'isameasure' => '1', 'validate' => '1', 'computed' => '$object->asset_depreciation_options->getRate("economic")',), + 'accelerated_depreciation_option' => array('type' => 'boolean', 'label' => 'AssetDepreciationOptionAcceleratedDepreciation', 'enabled' => '1', 'position' => 60, 'column_break' => true, 'notnull' => 0, 'default' => '0', 'visible' => 1, 'validate' => '1',), + 'amount_base_depreciation_ht' => array('type' => 'price', 'label' => 'AssetDepreciationOptionAmountBaseDepreciationHT', 'enabled' => 'isset($object)&&get_class($object)=="Asset"', 'only_on_asset' => 1, 'position' => 90, 'notnull' => 0, 'required' => 1, 'visible' => 1, 'default' => '$object->reversal_amount_ht > 0 ? $object->reversal_amount_ht : $object->acquisition_value_ht', 'isameasure' => '1', 'validate' => '1',), + 'amount_base_deductible_ht' => array('type' => 'price', 'label' => 'AssetDepreciationOptionAmountBaseDeductibleHT', 'enabled' => 'isset($object)&&get_class($object)=="Asset"', 'only_on_asset' => 1, 'position' => 100, 'notnull' => 0, 'visible' => 1, 'default' => '0', 'isameasure' => '1', 'validate' => '1',), + 'total_amount_last_depreciation_ht' => array('type' => 'price', 'label' => 'AssetDepreciationOptionTotalAmountLastDepreciationHT', 'enabled' => 'isset($object)&&get_class($object)=="Asset"', 'only_on_asset' => 1, 'position' => 110, 'noteditable' => 1, 'notnull' => 0, 'visible' => 1, 'default' => '0', 'isameasure' => '1', 'validate' => '1',), ), ), 'accelerated_depreciation' => array( @@ -93,14 +94,14 @@ class AssetDepreciationOptions extends CommonObject 'table' => 'asset_depreciation_options_fiscal', 'enabled_field' => 'economic:accelerated_depreciation_option:1', 'fields' => array( - 'depreciation_type' => array('type'=>'smallint', 'label'=>'AssetDepreciationOptionDepreciationType', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>1, 'default'=>'0', 'arrayofkeyval'=>array('0'=>'AssetDepreciationOptionDepreciationTypeLinear', '1'=>'AssetDepreciationOptionDepreciationTypeDegressive', '2'=>'AssetDepreciationOptionDepreciationTypeExceptional'), 'validate'=>'1',), - 'degressive_coefficient' => array('type'=>'double(24,8)', 'label'=>'AssetDepreciationOptionDegressiveRate', 'enabled'=>'1', 'position'=>20, 'notnull'=>1, 'visible'=>1, 'default'=>'0', 'isameasure'=>'1', 'validate'=>'1','enabled_field' => 'accelerated_depreciation:depreciation_type:1'), - 'duration' => array('type'=>'integer', 'label'=>'AssetDepreciationOptionDuration', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'default'=>'0', 'isameasure'=>'1', 'validate'=>'1',), - 'duration_type' => array('type'=>'smallint', 'label'=>'AssetDepreciationOptionDurationType', 'enabled'=>'1', 'position'=>40, 'notnull'=>1, 'visible'=>1, 'default'=>'0', 'arrayofkeyval'=>array('0'=>'AssetDepreciationOptionDurationTypeAnnual', '1'=>'AssetDepreciationOptionDurationTypeMonthly'/*, '2'=>'AssetDepreciationOptionDurationTypeDaily'*/), 'validate'=>'1',), - 'rate' => array('type'=>'double(24,8)', 'label'=>'AssetDepreciationOptionRate', 'enabled'=>'1', 'position'=>50, 'visible'=>3, 'default'=>'0', 'isameasure'=>'1', 'validate'=>'1', 'computed' => '$object->asset_depreciation_options->getRate("accelerated_depreciation")',), - 'amount_base_depreciation_ht' => array('type'=>'price', 'label'=>'AssetDepreciationOptionAmountBaseDepreciationHT', 'enabled'=>'isset($object)&&get_class($object)=="Asset"', 'only_on_asset'=>1, 'position'=>80, 'column_break' => true, 'notnull'=>0, 'required'=>1, 'visible'=>1, 'default'=>'$object->reversal_amount_ht > 0 ? $object->reversal_amount_ht : $object->acquisition_value_ht', 'isameasure'=>'1', 'validate'=>'1',), - 'amount_base_deductible_ht' => array('type'=>'price', 'label'=>'AssetDepreciationOptionAmountBaseDeductibleHT', 'enabled'=>'isset($object)&&get_class($object)=="Asset"', 'only_on_asset'=>1, 'position'=>90, 'notnull'=>0, 'visible'=>1, 'default'=>'0', 'isameasure'=>'1', 'validate'=>'1',), - 'total_amount_last_depreciation_ht' => array('type'=>'price', 'label'=>'AssetDepreciationOptionTotalAmountLastDepreciationHT', 'enabled'=>'isset($object)&&get_class($object)=="Asset"', 'only_on_asset'=>1, 'position'=>100, 'noteditable'=> 1, 'notnull'=>0, 'visible'=>1, 'default'=>'0', 'isameasure'=>'1', 'validate'=>'1',), + 'depreciation_type' => array('type' => 'smallint', 'label' => 'AssetDepreciationOptionDepreciationType', 'enabled' => '1', 'position' => 10, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'arrayofkeyval' => array('0' => 'AssetDepreciationOptionDepreciationTypeLinear', '1' => 'AssetDepreciationOptionDepreciationTypeDegressive', '2' => 'AssetDepreciationOptionDepreciationTypeExceptional'), 'validate' => '1',), + 'degressive_coefficient' => array('type' => 'double(24,8)', 'label' => 'AssetDepreciationOptionDegressiveRate', 'enabled' => '1', 'position' => 20, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'isameasure' => '1', 'validate' => '1','enabled_field' => 'accelerated_depreciation:depreciation_type:1'), + 'duration' => array('type' => 'integer', 'label' => 'AssetDepreciationOptionDuration', 'enabled' => '1', 'position' => 30, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'isameasure' => '1', 'validate' => '1',), + 'duration_type' => array('type' => 'smallint', 'label' => 'AssetDepreciationOptionDurationType', 'enabled' => '1', 'position' => 40, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'arrayofkeyval' => array('0' => 'AssetDepreciationOptionDurationTypeAnnual', '1' => 'AssetDepreciationOptionDurationTypeMonthly'/*, '2'=>'AssetDepreciationOptionDurationTypeDaily'*/), 'validate' => '1',), + 'rate' => array('type' => 'double(24,8)', 'label' => 'AssetDepreciationOptionRate', 'enabled' => '1', 'position' => 50, 'visible' => 3, 'default' => '0', 'isameasure' => '1', 'validate' => '1', 'computed' => '$object->asset_depreciation_options->getRate("accelerated_depreciation")',), + 'amount_base_depreciation_ht' => array('type' => 'price', 'label' => 'AssetDepreciationOptionAmountBaseDepreciationHT', 'enabled' => 'isset($object)&&get_class($object)=="Asset"', 'only_on_asset' => 1, 'position' => 80, 'column_break' => true, 'notnull' => 0, 'required' => 1, 'visible' => 1, 'default' => '$object->reversal_amount_ht > 0 ? $object->reversal_amount_ht : $object->acquisition_value_ht', 'isameasure' => '1', 'validate' => '1',), + 'amount_base_deductible_ht' => array('type' => 'price', 'label' => 'AssetDepreciationOptionAmountBaseDeductibleHT', 'enabled' => 'isset($object)&&get_class($object)=="Asset"', 'only_on_asset' => 1, 'position' => 90, 'notnull' => 0, 'visible' => 1, 'default' => '0', 'isameasure' => '1', 'validate' => '1',), + 'total_amount_last_depreciation_ht' => array('type' => 'price', 'label' => 'AssetDepreciationOptionTotalAmountLastDepreciationHT', 'enabled' => 'isset($object)&&get_class($object)=="Asset"', 'only_on_asset' => 1, 'position' => 100, 'noteditable' => 1, 'notnull' => 0, 'visible' => 1, 'default' => '0', 'isameasure' => '1', 'validate' => '1',), ), ), ); @@ -178,7 +179,7 @@ class AssetDepreciationOptions extends CommonObject $this->{$field_key} = $this->deprecation_options[$mode][$field_key] ?? null; } - $this->fields['rowid'] = array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"); + $this->fields['rowid'] = array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'css' => 'left', 'comment' => "Id"); if (empty($class_type)) { $this->fields['fk_asset'] = array('type' => 'integer:Asset:asset/class/asset.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label' => 'Asset', 'enabled' => '1', 'position' => 0, 'notnull' => 0, 'visible' => 0, 'index' => 1, 'validate' => '1',); } else { diff --git a/htdocs/asset/class/assetmodel.class.php b/htdocs/asset/class/assetmodel.class.php index 811f50252d7..8315231fd76 100644 --- a/htdocs/asset/class/assetmodel.class.php +++ b/htdocs/asset/class/assetmodel.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2021 Open-Dsi * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -99,7 +100,7 @@ class AssetModel extends CommonObject */ /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'css' => 'left', 'comment' => "Id"), diff --git a/htdocs/asset/model/agenda.php b/htdocs/asset/model/agenda.php index ff190403410..1eb0a2e850a 100644 --- a/htdocs/asset/model/agenda.php +++ b/htdocs/asset/model/agenda.php @@ -173,14 +173,14 @@ if ($object->id > 0) { $objthirdparty = $object; $objcon = new stdClass(); - $out = '&origin=' . urlencode($object->element . '@' . $object->module) . '&originid=' . urlencode($object->id); + $out = '&origin=' . urlencode((string) ($object->element . '@' . $object->module)) . '&originid=' . urlencode((string) ($object->id)); $urlbacktopage = $_SERVER['PHP_SELF'] . '?id=' . $object->id; $out .= '&backtopage=' . urlencode($urlbacktopage); $permok = $user->hasRight('agenda', 'myactions', 'create'); if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) { //$out.='trans("BrowseBlockedLog"); } -$help_url="EN:Module_Unalterable_Archives_-_Logs|FR:Module_Archives_-_Logs_Inaltérable"; +$help_url = "EN:Module_Unalterable_Archives_-_Logs|FR:Module_Archives_-_Logs_Inaltérable"; llxHeader('', $title, $help_url); @@ -353,16 +353,16 @@ if ($search_startday > 0) { $param .= '&search_startday='.urlencode($search_startday); } if ($search_endyear > 0) { - $param .= '&search_endyear='.urlencode($search_endyear); + $param .= '&search_endyear='.urlencode((string) ($search_endyear)); } if ($search_endmonth > 0) { - $param .= '&search_endmonth='.urlencode($search_endmonth); + $param .= '&search_endmonth='.urlencode((string) ($search_endmonth)); } if ($search_endday > 0) { - $param .= '&search_endday='.urlencode($search_endday); + $param .= '&search_endday='.urlencode((string) ($search_endday)); } if ($search_showonlyerrors > 0) { - $param .= '&search_showonlyerrors='.urlencode($search_showonlyerrors); + $param .= '&search_showonlyerrors='.urlencode((string) ($search_showonlyerrors)); } if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 451926a030c..fda5dd93eeb 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2023 Benjamin Falière * Copyright (C) 2023 Charlene Benke * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -110,7 +111,7 @@ class BOM extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -2, 'position' => 1, 'notnull' => 1, 'index' => 1, 'comment' => "Id",), @@ -236,7 +237,7 @@ class BOM extends CommonObject // protected $childtables=array(); /** - * @var array List of child tables. To know object to delete on cascade. + * @var string[] List of child tables. To know object to delete on cascade. */ protected $childtablesoncascade = array('bom_bomline'); diff --git a/htdocs/bookcal/admin/setup.php b/htdocs/bookcal/admin/setup.php index 7117deee8e1..1b445686550 100644 --- a/htdocs/bookcal/admin/setup.php +++ b/htdocs/bookcal/admin/setup.php @@ -1,6 +1,7 @@ * Copyright (C) 2022 Alice Adminson + * Copyright (C) 2024 MDW * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -102,7 +103,7 @@ $item->helpText = $langs->transnoentities('AnHelpMessage');*/ //$item->fieldOutputOverride = false; // set this var to override field output -$setupnotempty =+ count($formSetup->items); +$setupnotempty = + count($formSetup->items); $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); @@ -145,18 +146,16 @@ if ($action == 'updateMask') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/bookcal/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele."_".strtolower($tmpobjectkey); break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); diff --git a/htdocs/bookcal/availabilities_agenda.php b/htdocs/bookcal/availabilities_agenda.php index ac313e7b699..5c29e0c45cc 100644 --- a/htdocs/bookcal/availabilities_agenda.php +++ b/htdocs/bookcal/availabilities_agenda.php @@ -113,7 +113,7 @@ if (!$permissiontoread) { * Actions */ -$parameters = array('id'=>$id); +$parameters = array('id' => $id); $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'); @@ -218,14 +218,14 @@ if ($object->id > 0) { $objthirdparty = $object; $objcon = new stdClass(); - $out = '&origin='.urlencode($object->element.'@'.$object->module).'&originid='.urlencode($object->id); + $out = '&origin='.urlencode((string) ($object->element.'@'.$object->module)).'&originid='.urlencode((string) ($object->id)); $urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id; $out .= '&backtopage='.urlencode($urlbacktopage); $permok = $user->hasRight('agenda', 'myactions', 'create'); if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) { //$out.='$id); +$parameters = array('id' => $id); $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'); @@ -217,14 +217,14 @@ if ($object->id > 0) { $objthirdparty = $object; $objcon = new stdClass(); - $out = '&origin='.urlencode($object->element.(property_exists($object, 'module') ? '@'.$object->module : '')).'&originid='.urlencode($object->id); + $out = '&origin='.urlencode((string) ($object->element.(property_exists($object, 'module') ? '@'.$object->module : ''))).'&originid='.urlencode((string) ($object->id)); $urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id; $out .= '&backtopage='.urlencode($urlbacktopage); $permok = $user->hasRight('agenda', 'myactions', 'create'); if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) { //$out.=' * Copyright (C) 2022 Alice Adminson * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -111,7 +112,7 @@ class Availabilities extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 2, 'noteditable' => '1', 'index' => 1, 'css' => 'left', 'comment' => "Id"), diff --git a/htdocs/bookcal/class/calendar.class.php b/htdocs/bookcal/class/calendar.class.php index cad6ca0eeb2..f4777bfa003 100644 --- a/htdocs/bookcal/class/calendar.class.php +++ b/htdocs/bookcal/class/calendar.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2023-2024 Frédéric France * Copyright (C) 2023 Alice Adminson + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -111,7 +112,7 @@ class Calendar extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'css' => 'right', 'comment' => "Id"), diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 95a0b4e8b5c..f5d96eec190 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1796,7 +1796,7 @@ if ($id > 0) { // Confirmation suppression action if ($action == 'delete') { - print $form->formconfirm("card.php?id=".urlencode($id), $langs->trans("DeleteAction"), $langs->trans("ConfirmDeleteAction"), "confirm_delete", '', '', 1); + print $form->formconfirm("card.php?id=".urlencode((string) ($id)), $langs->trans("DeleteAction"), $langs->trans("ConfirmDeleteAction"), "confirm_delete", '', '', 1); } if ($action == 'edit') { diff --git a/htdocs/comm/action/class/actioncommreminder.class.php b/htdocs/comm/action/class/actioncommreminder.class.php index 4880e42300d..cf86e744f70 100644 --- a/htdocs/comm/action/class/actioncommreminder.class.php +++ b/htdocs/comm/action/class/actioncommreminder.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -75,20 +76,20 @@ class ActionCommReminder extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>-1, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",), - 'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>0, 'enabled'=>1, 'position'=>20, 'notnull'=>1, 'index'=>1,), - 'dateremind' => array('type'=>'datetime', 'label'=>'DateRemind', 'visible'=>1, 'enabled'=>1, 'position'=>60, 'notnull'=>1, 'index'=>1,), - 'typeremind' => array('type'=>'varchar(32)', 'label'=>'TypeRemind', 'visible'=>-1, 'enabled'=>1, 'position'=>55, 'notnull'=>1, 'comment'=>"email, browser, sms",), - 'fk_user' => array('type'=>'integer', 'label'=>'User', 'visible'=>-1, 'enabled'=>1, 'position'=>65, 'notnull'=>1, 'index'=>1,), - 'offsetvalue' => array('type'=>'integer', 'label'=>'OffsetValue', 'visible'=>1, 'enabled'=>1, 'position'=>56, 'notnull'=>1,), - 'offsetunit' => array('type'=>'varchar(1)', 'label'=>'OffsetUnit', 'visible'=>1, 'enabled'=>1, 'position'=>57, 'notnull'=>1, 'comment'=>"y, m, d, w, h, i",), - 'status' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>58, 'notnull'=>1, 'default'=>0, 'index'=>0, 'arrayofkeyval'=>array('0'=>'ToDo', '1'=>'Done')), - 'lasterror' => array('type'=>'varchar(128)', 'label'=>'LastError', 'visible'=>-1, 'enabled'=>1, 'position'=>59, 'index'=>0), - 'fk_actioncomm' => array('type'=>'integer', 'label'=>'Project', 'visible'=>1, 'enabled'=>1, 'position'=>70, 'notnull'=>1, 'index'=>1,), - 'fk_email_template' => array('type'=>'integer', 'label'=>'EmailTemplate', 'visible'=>1, 'enabled'=>1, 'position'=>80, 'notnull'=>0), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'visible' => -1, 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'index' => 1, 'comment' => "Id",), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'visible' => 0, 'enabled' => 1, 'position' => 20, 'notnull' => 1, 'index' => 1,), + 'dateremind' => array('type' => 'datetime', 'label' => 'DateRemind', 'visible' => 1, 'enabled' => 1, 'position' => 60, 'notnull' => 1, 'index' => 1,), + 'typeremind' => array('type' => 'varchar(32)', 'label' => 'TypeRemind', 'visible' => -1, 'enabled' => 1, 'position' => 55, 'notnull' => 1, 'comment' => "email, browser, sms",), + 'fk_user' => array('type' => 'integer', 'label' => 'User', 'visible' => -1, 'enabled' => 1, 'position' => 65, 'notnull' => 1, 'index' => 1,), + 'offsetvalue' => array('type' => 'integer', 'label' => 'OffsetValue', 'visible' => 1, 'enabled' => 1, 'position' => 56, 'notnull' => 1,), + 'offsetunit' => array('type' => 'varchar(1)', 'label' => 'OffsetUnit', 'visible' => 1, 'enabled' => 1, 'position' => 57, 'notnull' => 1, 'comment' => "y, m, d, w, h, i",), + 'status' => array('type' => 'integer', 'label' => 'Status', 'visible' => 1, 'enabled' => 1, 'position' => 58, 'notnull' => 1, 'default' => 0, 'index' => 0, 'arrayofkeyval' => array('0' => 'ToDo', '1' => 'Done')), + 'lasterror' => array('type' => 'varchar(128)', 'label' => 'LastError', 'visible' => -1, 'enabled' => 1, 'position' => 59, 'index' => 0), + 'fk_actioncomm' => array('type' => 'integer', 'label' => 'Project', 'visible' => 1, 'enabled' => 1, 'position' => 70, 'notnull' => 1, 'index' => 1,), + 'fk_email_template' => array('type' => 'integer', 'label' => 'EmailTemplate', 'visible' => 1, 'enabled' => 1, 'position' => 80, 'notnull' => 0), ); /** diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index ac9148579b1..bc6f454539a 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -228,7 +228,7 @@ class CActionComm if ($obj->module == 'order_supplier' && ((isModEnabled("fournisseur") && !getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight('fournisseur', 'commande', 'lire')) || (!isModEnabled('supplier_order') && $user->hasRight('supplier_order', 'lire')))) { $qualified = 1; } - if ($obj->module == 'shipping' && isModEnabled("delivery_note") && $user->hasRight('expedition', 'lire')) { + if ($obj->module == 'shipping' && isModEnabled("shipping") && $user->hasRight('expedition', 'lire')) { $qualified = 1; } // For case module = 'myobject@eventorganization' diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index f0843f3c990..68e6b4d7169 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -393,7 +393,7 @@ if ($actioncode || GETPOSTISSET('search_actioncode')) { } } if ($resourceid > 0) { - $param .= "&search_resourceid=".urlencode($resourceid); + $param .= "&search_resourceid=".urlencode((string) ($resourceid)); } if ($status || GETPOSTISSET('status') || GETPOSTISSET('search_status')) { $param .= "&search_status=".urlencode($status); @@ -405,26 +405,26 @@ if ($filtert) { $param .= "&search_filtert=".urlencode($filtert); } if ($usergroup > 0) { - $param .= "&search_usergroup=".urlencode($usergroup); + $param .= "&search_usergroup=".urlencode((string) ($usergroup)); } if ($socid > 0) { - $param .= "&search_socid=".urlencode($socid); + $param .= "&search_socid=".urlencode((string) ($socid)); } if ($showbirthday) { $param .= "&search_showbirthday=1"; } if ($pid) { - $param .= "&search_projectid=".urlencode($pid); + $param .= "&search_projectid=".urlencode((string) ($pid)); } if ($type) { $param .= "&search_type=".urlencode($type); } -$param .= "&maxprint=".urlencode($maxprint); +$param .= "&maxprint=".urlencode((string) ($maxprint)); if ($mode == 'show_day' || $mode == 'show_week' || $mode == 'show_month') { $param .= '&mode='.urlencode($mode); } if ($search_categ_cus != 0) { - $param .= '&search_categ_cus='.urlencode($search_categ_cus); + $param .= '&search_categ_cus='.urlencode((string) ($search_categ_cus)); } // Show navigation bar diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 03efd125979..eff2e4b3708 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -316,7 +316,7 @@ if ($actioncode != '') { } } if ($resourceid > 0) { - $param .= "&search_resourceid=".urlencode($resourceid); + $param .= "&search_resourceid=".urlencode((string) ($resourceid)); } if ($search_status != '') { $param .= "&search_status=".urlencode($search_status); @@ -328,16 +328,16 @@ if ($filtert) { $param .= "&search_filtert=".urlencode($filtert); } if ($usergroup > 0) { - $param .= "&search_usergroup=".urlencode($usergroup); + $param .= "&search_usergroup=".urlencode((string) ($usergroup)); } if ($socid > 0) { - $param .= "&search_socid=".urlencode($socid); + $param .= "&search_socid=".urlencode((string) ($socid)); } if ($showbirthday) { $param .= "&search_showbirthday=1"; } if ($pid) { - $param .= "&search_projectid=".urlencode($pid); + $param .= "&search_projectid=".urlencode((string) ($pid)); } if ($type) { $param .= "&search_type=".urlencode($type); @@ -391,7 +391,7 @@ if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); } if ($search_categ_cus != 0) { - $param .= '&search_categ_cus='.urlencode($search_categ_cus); + $param .= '&search_categ_cus='.urlencode((string) ($search_categ_cus)); } // Add $param from extra fields diff --git a/htdocs/comm/action/pertype.php b/htdocs/comm/action/pertype.php index 239f8d74600..7bb071f036c 100644 --- a/htdocs/comm/action/pertype.php +++ b/htdocs/comm/action/pertype.php @@ -286,7 +286,7 @@ if ($actioncode || GETPOSTISSET('search_actioncode')) { } } if ($resourceid > 0) { - $param .= "&search_resourceid=".urlencode($resourceid); + $param .= "&search_resourceid=".urlencode((string) ($resourceid)); } if ($status || GETPOSTISSET('status') || GETPOSTISSET('search_status')) { $param .= "&search_status=".urlencode($status); @@ -298,16 +298,16 @@ if ($filtert) { $param .= "&search_filtert=".urlencode($filtert); } if ($usergroup > 0) { - $param .= "&search_usergroup=".urlencode($usergroup); + $param .= "&search_usergroup=".urlencode((string) ($usergroup)); } if ($socid > 0) { - $param .= "&search_socid=".urlencode($socid); + $param .= "&search_socid=".urlencode((string) ($socid)); } if ($showbirthday) { $param .= "&search_showbirthday=1"; } if ($pid) { - $param .= "&search_projectid=".urlencode($pid); + $param .= "&search_projectid=".urlencode((string) ($pid)); } if ($type) { $param .= "&search_type=".urlencode($type); @@ -322,12 +322,12 @@ if ($end_h != '') { $param .= '&end_h='.urlencode($end_h); } if ($begin_d != '') { - $param .= '&begin_d='.urlencode($begin_d); + $param .= '&begin_d='.urlencode((string) ($begin_d)); } if ($end_d != '') { - $param .= '&end_d='.urlencode($end_d); + $param .= '&end_d='.urlencode((string) ($end_d)); } -$param .= "&maxprint=".urlencode($maxprint); +$param .= "&maxprint=".urlencode((string) ($maxprint)); $paramnoactionodate = $param; @@ -374,7 +374,7 @@ $nav .= $form->selectDate($dateselect, 'dateselect', 0, 0, 1, '', 1, 0); $nav .= ' '; // Must be after the nav definition -$param .= '&year='.urlencode($year).'&month='.urlencode($month).($day ? '&day='.urlencode($day) : ''); +$param .= '&year='.urlencode((string) ($year)).'&month='.urlencode((string) ($month)).($day ? '&day='.urlencode((string) ($day)) : ''); //print 'x'.$param; diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index a9d3ba71561..c191a6c35be 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -282,7 +282,7 @@ if ($actioncode || GETPOSTISSET('search_actioncode')) { } } if ($resourceid > 0) { - $param .= "&search_resourceid=".urlencode($resourceid); + $param .= "&search_resourceid=".urlencode((string) ($resourceid)); } if ($status || GETPOSTISSET('status') || GETPOSTISSET('search_status')) { @@ -295,16 +295,16 @@ if ($filtert) { $param .= "&search_filtert=".urlencode($filtert); } if ($usergroup > 0) { - $param .= "&search_usergroup=".urlencode($usergroup); + $param .= "&search_usergroup=".urlencode((string) ($usergroup)); } if ($socid > 0) { - $param .= "&search_socid=".urlencode($socid); + $param .= "&search_socid=".urlencode((string) ($socid)); } if ($showbirthday) { $param .= "&search_showbirthday=1"; } if ($pid) { - $param .= "&search_projectid=".urlencode($pid); + $param .= "&search_projectid=".urlencode((string) ($pid)); } if ($type) { $param .= "&search_type=".urlencode($type); @@ -325,9 +325,9 @@ if ($end_d != '') { $param .= '&end_d='.urlencode($end_d); } if ($search_categ_cus != 0) { - $param .= '&search_categ_cus='.urlencode($search_categ_cus); + $param .= '&search_categ_cus='.urlencode((string) ($search_categ_cus)); } -$param .= "&maxprint=".urlencode($maxprint); +$param .= "&maxprint=".urlencode((string) ($maxprint)); $paramnoactionodate = $param; @@ -377,7 +377,7 @@ $nav .= $form->selectDate($dateselect, 'dateselect', 0, 0, 1, '', 1, 0); $nav .= ' '; // Must be after the nav definition -$param .= '&year='.urlencode($year).'&month='.urlencode($month).($day ? '&day='.urlencode($day) : ''); +$param .= '&year='.urlencode((string) ($year)).'&month='.urlencode((string) ($month)).($day ? '&day='.urlencode((string) ($day)) : ''); //print 'x'.$param; diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 4a20bf2dc9e..796f17e710c 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -52,7 +52,7 @@ if (isModEnabled("propal")) { if (isModEnabled('order')) { require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; } -if (isModEnabled("delivery_note")) { +if (isModEnabled("shipping")) { require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; } if (isModEnabled('contract')) { @@ -74,7 +74,7 @@ if (isModEnabled('contract')) { if (isModEnabled('order')) { $langs->load("orders"); } -if (isModEnabled("delivery_note")) { +if (isModEnabled("shipping")) { $langs->load("sendings"); } if (isModEnabled('invoice')) { @@ -1029,7 +1029,7 @@ if ($object->id > 0) { /* * Latest shipments */ - if (isModEnabled("delivery_note") && $user->hasRight('expedition', 'lire')) { + if (isModEnabled("shipping") && $user->hasRight('expedition', 'lire')) { $sql = 'SELECT e.rowid as id'; $sql .= ', e.ref, e.entity'; $sql .= ', e.date_creation'; diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index e6f33c8e8cd..559530a6873 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -847,7 +847,7 @@ if ($action == 'create') { $formmail = new FormMail($db); $formmail->withfckeditor = 1; - $formmail->withaiprompt = 1; + $formmail->withaiprompt = 'html'; $formmail->withlayout = 1; print '
'; if ($page) { - $param .= "&page=".urlencode($page); + $param .= "&page=".urlencode((string) ($page)); } print ''; diff --git a/htdocs/comm/propal/agenda.php b/htdocs/comm/propal/agenda.php index a61ed2e0270..1fe3cf6d5dd 100644 --- a/htdocs/comm/propal/agenda.php +++ b/htdocs/comm/propal/agenda.php @@ -96,7 +96,7 @@ restrictedArea($user, 'propal', $object->id, '', '', 'fk_soc', 'rowid', $isdraft * Actions */ -$parameters = array('id'=>$id); +$parameters = array('id' => $id); $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'); @@ -191,14 +191,14 @@ if ($object->id > 0) { $objthirdparty = $object; $objcon = new stdClass(); - $out = '&origin='.urlencode($object->element.(property_exists($object, 'module') ? '@'.$object->module : '')).'&originid='.urlencode($object->id); + $out = '&origin='.urlencode((string) ($object->element.(property_exists($object, 'module') ? '@'.$object->module : ''))).'&originid='.urlencode((string) ($object->id)); $urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id; $out .= '&backtopage='.urlencode($urlbacktopage); $permok = $user->hasRight('agenda', 'myactions', 'create'); if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) { //$out.='id.'&action='.$action.'&origin='.urlencode(GETPOST('origin')).'&originid='.urlencode(GETPOSTINT('originid')); + $backtopage = $_SERVER["PHP_SELF"].'?socid='.$thirdparty->id.'&action='.$action.'&origin='.urlencode((string) (GETPOST('origin'))).'&originid='.urlencode((string) (GETPOSTINT('originid'))); include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php'; print ''; } @@ -2004,7 +2004,7 @@ if ($action == 'create') { print ''; // Shipping Method - if (isModEnabled("delivery_note")) { + if (isModEnabled("shipping")) { if (getDolGlobalString('SOCIETE_ASK_FOR_SHIPPING_METHOD') && !empty($soc->shipping_method_id)) { $shipping_method_id = $soc->shipping_method_id; } @@ -2695,7 +2695,7 @@ if ($action == 'create') { print ''; // Shipping Method - if (isModEnabled("delivery_note")) { + if (isModEnabled("shipping")) { print ''; $out .= ''; @@ -1399,7 +1399,7 @@ class FormMail extends Form } /** - * get Html For Topic of message + * Return Html section for the Topic of message * * @param array $arraydefaultmessage Array with message template content * @param string $helpforsubstitution Help string for substitution @@ -1437,11 +1437,12 @@ class FormMail extends Form } /** - * Return Html code for AI instruction of message + * Return Html code for AI instruction of message and autofill result * - * @return string Text for instructions + * @param string $format Format for output ('', 'html', ...) + * @return string HTML code to ask AI instruction and autofill result */ - public function getSectionForAIPrompt() + public function getSectionForAIPrompt($format = '') { global $langs; @@ -1455,7 +1456,6 @@ class FormMail extends Form $out .= ''; $out .= "\n"; - $out .= " trans('TotalTTC')."'.substring(0,20);"; - echo "line1=line1.padEnd(20);"; - echo "var line2='".price($invoice->total_ttc, 1, '', 1, -1, -1)."'.substring(0,20);"; - echo "line2=line2.padEnd(20);"; - echo "$.ajax({ + echo "var line1='".$langs->trans('TotalTTC')."'.substring(0,20);"; + echo "line1=line1.padEnd(20);"; + echo "var line2='".price($invoice->total_ttc, 1, '', 1, -1, -1)."'.substring(0,20);"; + echo "line2=line2.padEnd(20);"; + echo "$.ajax({ type: 'GET', data: { text: line1+line2 }, url: '".getDolGlobalString('TAKEPOS_PRINT_SERVER')."/display/index.php', @@ -553,7 +553,7 @@ if (isModEnabled('multicurrency') && $_SESSION["takeposcustomercurrency"] != ""
trans("Received"); ?>: multicurrency_code); + echo price(0, 1, '', 1, -1, -1, $invoice->multicurrency_code); if ($showothercurrency) { print '   (' . price(0 * $multicurrency->rate->rate) . ' ' . $_SESSION["takeposcustomercurrency"] . ')'; } @@ -561,7 +561,7 @@ if (isModEnabled('multicurrency') && $_SESSION["takeposcustomercurrency"] != ""
trans("Change"); ?>: multicurrency_code); + echo price(0, 1, '', 1, -1, -1, $invoice->multicurrency_code); if ($showothercurrency) { print '   (' . price(0 * $multicurrency->rate->rate) . ' ' . $_SESSION["takeposcustomercurrency"] . ')'; } @@ -583,18 +583,18 @@ if (isModEnabled('multicurrency') && $_SESSION["takeposcustomercurrency"] != ""
"reset()", - "span" => "style='font-size: 150%;'", - "text" => "C", - "class" => "poscolorblue" - ), - array( - "function" => "parent.$.colorbox.close();", - "span" => "id='printtext' style='font-weight: bold; font-size: 18pt;'", - "text" => "X", - "class" => "poscolordelete" - ), +array( + "function" => "reset()", + "span" => "style='font-size: 150%;'", + "text" => "C", + "class" => "poscolorblue" +), +array( + "function" => "parent.$.colorbox.close();", + "span" => "id='printtext' style='font-weight: bold; font-size: 18pt;'", + "text" => "X", + "class" => "poscolordelete" +), ); $numpad = getDolGlobalString('TAKEPOS_NUMPAD'); if (isModEnabled('stripe') && isset($keyforstripeterminalbank) && getDolGlobalString('STRIPE_CARD_PRESENT')) { @@ -748,7 +748,7 @@ if (getDolGlobalString('TAKEPOS_DELAYED_PAYMENT')) { executeHooks('completePayment', $parameters, $invoice); print $hookmanager->resPrint; ?> diff --git a/htdocs/ticket/class/cticketcategory.class.php b/htdocs/ticket/class/cticketcategory.class.php index 1bc4f15c5bf..820cc281c89 100644 --- a/htdocs/ticket/class/cticketcategory.class.php +++ b/htdocs/ticket/class/cticketcategory.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2017 Laurent Destailleur * Copyright (C) ---Put here your own copyright and developer email--- * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -97,7 +98,7 @@ class CTicketCategory extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 1233793cd7d..4ccef134ea0 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -668,16 +668,16 @@ $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook $param .= $hookmanager->resPrint; if ($socid > 0) { - $param .= '&socid='.urlencode($socid); + $param .= '&socid='.urlencode((string) ($socid)); } if ($search_societe) { $param .= '&search_societe='.urlencode($search_societe); } if ($projectid > 0) { - $param .= '&projectid='.urlencode($projectid); + $param .= '&projectid='.urlencode((string) ($projectid)); } if ($contractid > 0) { - $param .= '&contractid='.urlencode($contractid); + $param .= '&contractid='.urlencode((string) ($contractid)); } if ($search_date_start) { $tmparray = dol_getdate($search_date_start); diff --git a/htdocs/user/agenda.php b/htdocs/user/agenda.php index a9887cc577c..7c692bb9ba4 100644 --- a/htdocs/user/agenda.php +++ b/htdocs/user/agenda.php @@ -89,7 +89,7 @@ if (($object->id != $user->id) && !$user->hasRight('user', 'user', 'lire')) { accessforbidden(); } -$parameters = array('id'=>$userId); +$parameters = array('id' => $userId); $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'); @@ -185,7 +185,7 @@ if (isModEnabled('agenda')) { if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allaactions', 'read'))) { print '
'; - $param = '&id='.urlencode($id); + $param = '&id='.urlencode((string) ($id)); if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.((int) $limit); diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 9c074307e31..2b68a23c5c5 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1582,8 +1582,11 @@ if ($action == 'create' || $action == 'adduserldap') { // Employee print '
'."\n"; // TODO This is also available into the tab RH diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index 48ec6758351..25a188fa8ee 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -8,6 +8,7 @@ * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2019 Abbes Bahfir * Copyright (C) 2023-2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -111,13 +112,13 @@ class UserGroup extends CommonObject public $oldcopy; // To contains a clone of this when we need to save old properties of object public $fields = array( - 'rowid'=>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'), - 'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>5), - 'nom'=>array('type'=>'varchar(180)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Group name'), - 'note' => array('type'=>'html', 'label'=>'Description', 'enabled'=>1, 'visible'=>1, 'position'=>20, 'notnull'=>-1, 'searchall'=>1), - 'datec' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>50, 'notnull'=>1,), - 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'position'=>60, 'notnull'=>1,), - 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'ModelPDF', 'enabled'=>1, 'visible'=>0, 'position'=>100), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'index' => 1, 'position' => 1, 'comment' => 'Id'), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'default' => 1, 'index' => 1, 'position' => 5), + 'nom' => array('type' => 'varchar(180)', 'label' => 'Name', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'showoncombobox' => 1, 'index' => 1, 'position' => 10, 'searchall' => 1, 'comment' => 'Group name'), + 'note' => array('type' => 'html', 'label' => 'Description', 'enabled' => 1, 'visible' => 1, 'position' => 20, 'notnull' => -1, 'searchall' => 1), + 'datec' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'visible' => -2, 'position' => 50, 'notnull' => 1,), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'visible' => -2, 'position' => 60, 'notnull' => 1,), + 'model_pdf' => array('type' => 'varchar(255)', 'label' => 'ModelPDF', 'enabled' => 1, 'visible' => 0, 'position' => 100), ); /** @@ -126,12 +127,12 @@ class UserGroup extends CommonObject public $fk_element = 'fk_usergroup'; /** - * @var array List of child tables. To test if we can delete object. + * @var array> List of child tables. To test if we can delete object. */ protected $childtables = array(); /** - * @var array List of child tables. To know object to delete on cascade. + * @var string[] List of child tables. To know object to delete on cascade. */ protected $childtablesoncascade = array('usergroup_rights', 'usergroup_user'); @@ -407,7 +408,7 @@ class UserGroup extends CommonObject if (!$error) { $langs->load("other"); - $this->context = array('audit'=>$langs->trans("PermissionsAdd").($rid ? ' (id='.$rid.')' : '')); + $this->context = array('audit' => $langs->trans("PermissionsAdd").($rid ? ' (id='.$rid.')' : '')); // Call trigger $result = $this->call_trigger('USERGROUP_MODIFY', $user); @@ -536,7 +537,7 @@ class UserGroup extends CommonObject if (!$error) { $langs->load("other"); - $this->context = array('audit'=>$langs->trans("PermissionsDelete").($rid ? ' (id='.$rid.')' : '')); + $this->context = array('audit' => $langs->trans("PermissionsDelete").($rid ? ' (id='.$rid.')' : '')); // Call trigger $result = $this->call_trigger('USERGROUP_MODIFY', $user); @@ -860,7 +861,7 @@ class UserGroup extends CommonObject global $action; $hookmanager->initHooks(array('groupdao')); - $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/user/list.php b/htdocs/user/list.php index c7793975b0f..e55dc5ea1bc 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -606,7 +606,7 @@ if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); } if ($search_categ > 0) { - $param .= '&search_categ='.urlencode($search_categ); + $param .= '&search_categ='.urlencode((string) ($search_categ)); } if ($search_warehouse > 0) { $param .= '&search_warehouse='.urlencode($search_warehouse); @@ -650,7 +650,7 @@ print ''; $url = DOL_URL_ROOT.'/user/card.php?action=create'.($contextpage == 'employeelist' ? '&search_employee=1' : '').'&leftmenu='; if (!empty($socid)) { - $url .= '&socid='.urlencode($socid); + $url .= '&socid='.urlencode((string) ($socid)); } $newcardbutton = ''; diff --git a/htdocs/user/messaging.php b/htdocs/user/messaging.php index d9db450b985..f28ee2aa0cc 100644 --- a/htdocs/user/messaging.php +++ b/htdocs/user/messaging.php @@ -99,7 +99,7 @@ $result = restrictedArea($user, 'user', $userId, '&user'); * Actions */ -$parameters = array('id'=>$socid); +$parameters = array('id' => $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'); @@ -196,7 +196,7 @@ if (isModEnabled('agenda')) { if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allaactions', 'read'))) { print '
'; - $param = '&userid='.urlencode($userid); + $param = '&userid='.urlencode((string) ($userid)); if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } diff --git a/htdocs/user/notify/card.php b/htdocs/user/notify/card.php index 8112a219016..240723c47c8 100644 --- a/htdocs/user/notify/card.php +++ b/htdocs/user/notify/card.php @@ -228,11 +228,11 @@ if ($result > 0) { // Add notification form // print load_fiche_titre($langs->trans("AddNewNotification"), '', ''); - print ''; + print ''; print ''; print ''; - $param = "&id=".urlencode($id); + $param = "&id=".urlencode((string) ($id)); // Line with titles /* print '
'.$arrayofaifeatures[$key]['picto'].' '.$langs->trans($arrayofaifeatures[$key]['label']).''.$arrayofaifeatures[$key]['picto'].' '.$langs->trans($arrayofaifeatures[$key]['label']); + $out .= ''.img_edit().''; + $out .= ''.img_delete().''; + $out .= '
'; @@ -1151,8 +1151,8 @@ if ($action == 'create') { // Create an array for form $formquestion = array( 'text' => $langs->trans("ConfirmClone"), - array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneContent"), 'value' => 1), - array('type' => 'checkbox', 'name' => 'clone_receivers', 'label' => $langs->trans("CloneReceivers"), 'value' => 0) + 0 => array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneContent"), 'value' => 1), + 1 => array('type' => 'checkbox', 'name' => 'clone_receivers', 'label' => $langs->trans("CloneReceivers"), 'value' => 0) ); // Incomplete payment. On demande si motif = escompte ou autre print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneEMailing', $object->ref), 'confirm_clone', $formquestion, 'yes', 2, 240); @@ -1252,7 +1252,7 @@ if ($action == 'create') { $formmail->withtopicreadonly = 1; $formmail->withfile = 0; $formmail->withlayout = 0; - $formmail->withaiprompt = 0; + $formmail->withaiprompt = ''; $formmail->withbody = 0; $formmail->withbodyreadonly = 1; $formmail->withcancel = 1; diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 4096d3ae161..95ffc1f0c38 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -752,7 +752,7 @@ if ($object->fetch($id) >= 0) { print '
'; print ''; @@ -1953,7 +1953,7 @@ if ($action == 'create' && $usercancreate) { } // Shipping Method - if (isModEnabled('delivery_note')) { + if (isModEnabled('shipping')) { print ''; // Shipping Method - if (isModEnabled('delivery_note')) { + if (isModEnabled('shipping')) { print ''; @@ -568,7 +568,7 @@ if (!empty($arrayfields['toreconcile']['checked'])) { // 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, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (!empty($arrayfields['b.datec']['checked'])) { @@ -601,7 +601,7 @@ $i = 0; $savnbfield = $totalarray['nbfield']; $totalarray = array(); $totalarray['nbfield'] = 0; -$totalarray['val'] = array('balance'=>0); +$totalarray['val'] = array('balance' => 0); $total = array(); $found = 0; $lastcurrencycode = ''; @@ -799,7 +799,7 @@ foreach ($accounts as $key => $type) { } 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, $objecttmp, $action); // Note that $action and $objecttmpect may have been modified by hook print $hookmanager->resPrint; // Date creation diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index 56eb4e93a6c..34c61ad8b31 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -250,7 +250,7 @@ if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.$limit; } if ($id > 0) { - $param .= '&id='.urlencode($id); + $param .= '&id='.urlencode((string) ($id)); } if (empty($numref)) { diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index 33f9f0154cd..8a2aa9178f7 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -148,27 +148,27 @@ $search_all = GETPOSTISSET("search_all") ? trim(GETPOST("search_all", 'alpha')) // List of fields to search into when doing a "search in all" $fieldstosearchall = array( - 'v.rowid'=>"Ref", - 'v.label'=>"Label", - 'v.datep'=>"DatePayment", - 'v.datev'=>"DateValue", - 'v.amount'=>$langs->trans("Debit").", ".$langs->trans("Credit"), + 'v.rowid' => "Ref", + 'v.label' => "Label", + 'v.datep' => "DatePayment", + 'v.datev' => "DateValue", + 'v.amount' => $langs->trans("Debit").", ".$langs->trans("Credit"), ); // Definition of fields for lists $arrayfields = array( - 'ref' =>array('label'=>"Ref", 'checked'=>1, 'position'=>100), - 'label' =>array('label'=>"Label", 'checked'=>1, 'position'=>110), - 'datep' =>array('label'=>"DatePayment", 'checked'=>1, 'position'=>120), - 'datev' =>array('label'=>"DateValue", 'checked'=>-1, 'position'=>130), - 'type' =>array('label'=>"PaymentMode", 'checked'=>1, 'position'=>140), - 'project' =>array('label'=>"Project", 'checked'=>1, 'position'=>200, "enabled"=>isModEnabled('project')), - 'bank' =>array('label'=>"BankAccount", 'checked'=>1, 'position'=>300, "enabled"=>isModEnabled("bank")), - 'entry' =>array('label'=>"BankTransactionLine", 'checked'=>1, 'position'=>310, "enabled"=>isModEnabled("bank")), - 'account' =>array('label'=>"AccountAccountingShort", 'checked'=>1, 'position'=>400, "enabled"=>isModEnabled('accounting')), - 'subledger' =>array('label'=>"SubledgerAccount", 'checked'=>1, 'position'=>410, "enabled"=>isModEnabled('accounting')), - 'debit' =>array('label'=>"Debit", 'checked'=>1, 'position'=>500), - 'credit' =>array('label'=>"Credit", 'checked'=>1, 'position'=>510), + 'ref' => array('label' => "Ref", 'checked' => 1, 'position' => 100), + 'label' => array('label' => "Label", 'checked' => 1, 'position' => 110), + 'datep' => array('label' => "DatePayment", 'checked' => 1, 'position' => 120), + 'datev' => array('label' => "DateValue", 'checked' => -1, 'position' => 130), + 'type' => array('label' => "PaymentMode", 'checked' => 1, 'position' => 140), + 'project' => array('label' => "Project", 'checked' => 1, 'position' => 200, "enabled" => isModEnabled('project')), + 'bank' => array('label' => "BankAccount", 'checked' => 1, 'position' => 300, "enabled" => isModEnabled("bank")), + 'entry' => array('label' => "BankTransactionLine", 'checked' => 1, 'position' => 310, "enabled" => isModEnabled("bank")), + 'account' => array('label' => "AccountAccountingShort", 'checked' => 1, 'position' => 400, "enabled" => isModEnabled('accounting')), + 'subledger' => array('label' => "SubledgerAccount", 'checked' => 1, 'position' => 410, "enabled" => isModEnabled('accounting')), + 'debit' => array('label' => "Debit", 'checked' => 1, 'position' => 500), + 'credit' => array('label' => "Credit", 'checked' => 1, 'position' => 510), ); $arrayfields = dol_sort_array($arrayfields, 'position'); @@ -401,7 +401,7 @@ if ($search_datev_end) { $param .= '&search_datev_end='.urlencode($search_datev_end); } if ($search_type_id > 0) { - $param .= '&search_type_id='.urlencode($search_type_id); + $param .= '&search_type_id='.urlencode((string) ($search_type_id)); } if ($search_amount_deb) { $param .= '&search_amount_deb='.urlencode($search_amount_deb); @@ -410,7 +410,7 @@ if ($search_amount_cred) { $param .= '&search_amount_cred='.urlencode($search_amount_cred); } if ($search_bank_account > 0) { - $param .= '&search_account='.urlencode($search_bank_account); + $param .= '&search_account='.urlencode((string) ($search_bank_account)); } if ($search_accountancy_account > 0) { $param .= '&search_accountancy_account='.urlencode($search_accountancy_account); @@ -421,7 +421,7 @@ if ($search_accountancy_subledger > 0) { $url = DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create'; if (!empty($socid)) { - $url .= '&socid='.urlencode($socid); + $url .= '&socid='.urlencode((string) ($socid)); } // List of mass actions available @@ -443,8 +443,8 @@ print ''; print ''; $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('MenuNewVariousPayment'), '', 'fa fa-plus-circle', $url, '', $user->hasRight('banque', 'modifier')); @@ -462,7 +462,7 @@ if ($search_all) { $arrayofmassactions = array(); -$moreforfilter= ''; +$moreforfilter = ''; $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $selectedfields = ($mode != 'kanban' ? $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) : ''); // This also change content of $arrayfields @@ -662,7 +662,7 @@ if ($arrayfields['credit']['checked']) { // 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 @@ -904,7 +904,7 @@ if ($num == 0) { $db->free($resql); -$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); +$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql); $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; diff --git a/htdocs/compta/deplacement/card.php b/htdocs/compta/deplacement/card.php index bcc66ade965..04c50f82ffe 100644 --- a/htdocs/compta/deplacement/card.php +++ b/htdocs/compta/deplacement/card.php @@ -367,7 +367,7 @@ if ($action == 'create') { * Confirm delete trip */ if ($action == 'delete') { - print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".urlencode($id), $langs->trans("DeleteTrip"), $langs->trans("ConfirmDeleteTrip"), "confirm_delete"); + print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".urlencode((string) ($id)), $langs->trans("DeleteTrip"), $langs->trans("ConfirmDeleteTrip"), "confirm_delete"); } $soc = new Societe($db); diff --git a/htdocs/compta/facture/agenda-rec.php b/htdocs/compta/facture/agenda-rec.php index 6f1ed587758..542dfd8f6c1 100644 --- a/htdocs/compta/facture/agenda-rec.php +++ b/htdocs/compta/facture/agenda-rec.php @@ -96,7 +96,7 @@ restrictedArea($user, 'facture', $object->id, 'facture_rec', '', 'fk_soc', 'rowi * Actions */ -$parameters = array('id'=>$id); +$parameters = array('id' => $id); $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'); @@ -196,14 +196,14 @@ if ($object->id > 0) { $objthirdparty = $object; $objcon = new stdClass(); - $out = '&origin='.urlencode($object->element.(property_exists($object, 'module') ? '@'.$object->module : '')).'&originid='.urlencode($object->id); + $out = '&origin='.urlencode((string) ($object->element.(property_exists($object, 'module') ? '@'.$object->module : ''))).'&originid='.urlencode((string) ($object->id)); $urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id; $out .= '&backtopage='.urlencode($urlbacktopage); $permok = $user->hasRight('paymentbagendaybanktransfer', 'myactions', 'create'); if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) { //$out.='id, '', '', 'fk_soc', 'rowid', $isdraf * Actions */ -$parameters = array('id'=>$id); +$parameters = array('id' => $id); $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'); @@ -191,14 +191,14 @@ if ($object->id > 0) { $objthirdparty = $object; $objcon = new stdClass(); - $out = '&origin='.urlencode($object->element.(property_exists($object, 'module') ? '@'.$object->module : '')).'&originid='.urlencode($object->id); + $out = '&origin='.urlencode((string) ($object->element.(property_exists($object, 'module') ? '@'.$object->module : ''))).'&originid='.urlencode((string) ($object->id)); $urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id; $out .= '&backtopage='.urlencode($urlbacktopage); $permok = $user->hasRight('paymentbagendaybanktransfer', 'myactions', 'create'); if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) { //$out.=' * Copyright (C) 2022 Gauthier VERDOL * Copyright (C) 2023 Nick Fragoulis + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1662,7 +1663,7 @@ if (empty($reshook)) { null, 0, '', - (!empty($conf->global->MAIN_DEPOSIT_MULTI_TVA)?0:1) + (!empty($conf->global->MAIN_DEPOSIT_MULTI_TVA) ? 0 : 1) ); } @@ -3832,7 +3833,7 @@ if ($action == 'create') { $thirdparty = $soc; $discount_type = 0; - $backtopage = $_SERVER["PHP_SELF"].'?socid='.$thirdparty->id.'&action='.$action.'&origin='.urlencode(GETPOST('origin')).'&originid='.urlencode(GETPOSTINT('originid')); + $backtopage = $_SERVER["PHP_SELF"].'?socid='.$thirdparty->id.'&action='.$action.'&origin='.urlencode((string) (GETPOST('origin'))).'&originid='.urlencode((string) (GETPOSTINT('originid'))); include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php'; print ''; @@ -4459,7 +4460,7 @@ if ($action == 'create') { } // Create a form table - $formquestion = array('text' => $langs->trans("ConfirmClassifyPaidPartiallyQuestion"), array('type' => 'radio', 'name' => 'close_code', 'label' => $langs->trans("Reason"), 'values' => $arrayreasons), array('type' => 'text', 'name' => 'close_note', 'label' => $langs->trans("Comment"), 'value' => '', 'morecss' => 'minwidth300')); + $formquestion = array('text' => $langs->trans("ConfirmClassifyPaidPartiallyQuestion"), 0 => array('type' => 'radio', 'name' => 'close_code', 'label' => $langs->trans("Reason"), 'values' => $arrayreasons), 1 => array('type' => 'text', 'name' => 'close_note', 'label' => $langs->trans("Comment"), 'value' => '', 'morecss' => 'minwidth300')); // Incomplete payment. We ask if reason = discount or other $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id, $langs->trans('ClassifyPaid'), $langs->trans('ConfirmClassifyPaidPartially', $object->ref), 'confirm_paid_partially', $formquestion, "yes", 1, 380, 600); } @@ -4491,7 +4492,7 @@ if ($action == 'create') { $arrayreasons[$close[2]['code']] = $close[2]['reason']; // Create a form table - $formquestion = array('text' => $langs->trans("ConfirmCancelBillQuestion"), array('type' => 'radio', 'name' => 'close_code', 'label' => $langs->trans("Reason"), 'values' => $arrayreasons), array('type' => 'text', 'name' => 'close_note', 'label' => $langs->trans("Comment"), 'value' => '', 'morecss' => 'minwidth300')); + $formquestion = array('text' => $langs->trans("ConfirmCancelBillQuestion"), 0 => array('type' => 'radio', 'name' => 'close_code', 'label' => $langs->trans("Reason"), 'values' => $arrayreasons), 1 => array('type' => 'text', 'name' => 'close_note', 'label' => $langs->trans("Comment"), 'value' => '', 'morecss' => 'minwidth300')); $formconfirm = $form->formconfirm($_SERVER['PHP_SELF'].'?facid='.$object->id, $langs->trans('CancelBill'), $langs->trans('ConfirmCancelBill', $object->ref), 'confirm_canceled', $formquestion, "yes", 1, 270); } diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 50317b0ece3..447d0d9f5da 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -8,6 +8,7 @@ * Copyright (C) 2015 Marcos García * Copyright (C) 2017-2024 Frédéric France * Copyright (C) 2023 Nick Fragoulis + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -171,7 +172,7 @@ class FactureRec extends CommonInvoice // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index e0e994959a7..20483623722 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -290,7 +290,7 @@ class Facture extends CommonInvoice // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 1), diff --git a/htdocs/compta/facture/invoicetemplate_list.php b/htdocs/compta/facture/invoicetemplate_list.php index 4bbea222033..13a119e35b5 100644 --- a/htdocs/compta/facture/invoicetemplate_list.php +++ b/htdocs/compta/facture/invoicetemplate_list.php @@ -438,43 +438,43 @@ if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.((int) $limit); } if ($socid > 0) { - $param .= '&socid='.urlencode($socid); + $param .= '&socid='.urlencode((string) ($socid)); } if ($search_date_startday) { - $param .= '&search_date_startday='.urlencode($search_date_startday); + $param .= '&search_date_startday='.urlencode((string) ($search_date_startday)); } if ($search_date_startmonth) { - $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); + $param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth)); } if ($search_date_startyear) { - $param .= '&search_date_startyear='.urlencode($search_date_startyear); + $param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear)); } if ($search_date_endday) { - $param .= '&search_date_endday='.urlencode($search_date_endday); + $param .= '&search_date_endday='.urlencode((string) ($search_date_endday)); } if ($search_date_endmonth) { - $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + $param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth)); } if ($search_date_endyear) { - $param .= '&search_date_endyear='.urlencode($search_date_endyear); + $param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear)); } if ($search_date_when_startday) { - $param .= '&search_date_when_startday='.urlencode($search_date_when_startday); + $param .= '&search_date_when_startday='.urlencode((string) ($search_date_when_startday)); } if ($search_date_when_startmonth) { - $param .= '&search_date_when_startmonth='.urlencode($search_date_when_startmonth); + $param .= '&search_date_when_startmonth='.urlencode((string) ($search_date_when_startmonth)); } if ($search_date_when_startyear) { - $param .= '&search_date_when_startyear='.urlencode($search_date_when_startyear); + $param .= '&search_date_when_startyear='.urlencode((string) ($search_date_when_startyear)); } if ($search_date_when_endday) { - $param .= '&search_date_when_endday='.urlencode($search_date_when_endday); + $param .= '&search_date_when_endday='.urlencode((string) ($search_date_when_endday)); } if ($search_date_when_endmonth) { - $param .= '&search_date_when_endmonth='.urlencode($search_date_when_endmonth); + $param .= '&search_date_when_endmonth='.urlencode((string) ($search_date_when_endmonth)); } if ($search_date_when_endyear) { - $param .= '&search_date_when_endyear='.urlencode($search_date_when_endyear); + $param .= '&search_date_when_endyear='.urlencode((string) ($search_date_when_endyear)); } if ($search_ref) { $param .= '&search_ref='.urlencode($search_ref); diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index e897ebd198b..13995e6cc0b 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -16,6 +16,7 @@ * Copyright (C) 2019-2021 Alexandre Spangaro * Copyright (C) 2023 Nick Fragoulis * Copyright (C) 2023 Joachim Kueter + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -273,8 +274,6 @@ foreach ($object->fields as $key => $val) { $newkey = $key; } elseif (array_key_exists('f.'.$key, $arrayfields)) { $newkey = 'f.'.$key; - } elseif (array_key_exists('f.'.$key, $arrayfields)) { - $newkey = 'f.'.$key; } elseif (array_key_exists('s.'.$key, $arrayfields)) { $newkey = 's.'.$key; } @@ -1004,7 +1003,7 @@ if ($num == 1 && getDolGlobalString('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $s llxHeader('', $title, $help_url); -$param = '&socid='.urlencode($socid); +$param = '&socid='.urlencode((string) ($socid)); if (!empty($mode)) { $param .= '&mode='.urlencode($mode); } @@ -1018,58 +1017,58 @@ if ($search_all) { $param .= '&search_all='.urlencode($search_all); } if ($search_date_startday) { - $param .= '&search_date_startday='.urlencode($search_date_startday); + $param .= '&search_date_startday='.urlencode((string) ($search_date_startday)); } if ($search_date_startmonth) { - $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); + $param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth)); } if ($search_date_startyear) { - $param .= '&search_date_startyear='.urlencode($search_date_startyear); + $param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear)); } if ($search_date_endday) { - $param .= '&search_date_endday='.urlencode($search_date_endday); + $param .= '&search_date_endday='.urlencode((string) ($search_date_endday)); } if ($search_date_endmonth) { - $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + $param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth)); } if ($search_date_endyear) { - $param .= '&search_date_endyear='.urlencode($search_date_endyear); + $param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear)); } if ($search_date_valid_startday) { - $param .= '&search_date_valid_startday='.urlencode($search_date_valid_startday); + $param .= '&search_date_valid_startday='.urlencode((string) ($search_date_valid_startday)); } if ($search_date_valid_startmonth) { - $param .= '&search_date_valid_startmonth='.urlencode($search_date_valid_startmonth); + $param .= '&search_date_valid_startmonth='.urlencode((string) ($search_date_valid_startmonth)); } if ($search_date_valid_startyear) { - $param .= '&search_date_valid_startyear='.urlencode($search_date_valid_startyear); + $param .= '&search_date_valid_startyear='.urlencode((string) ($search_date_valid_startyear)); } if ($search_date_valid_endday) { - $param .= '&search_date_valid_endday='.urlencode($search_date_valid_endday); + $param .= '&search_date_valid_endday='.urlencode((string) ($search_date_valid_endday)); } if ($search_date_valid_endmonth) { - $param .= '&search_date_valid_endmonth='.urlencode($search_date_valid_endmonth); + $param .= '&search_date_valid_endmonth='.urlencode((string) ($search_date_valid_endmonth)); } if ($search_date_valid_endyear) { - $param .= '&search_date_valid_endyear='.urlencode($search_date_valid_endyear); + $param .= '&search_date_valid_endyear='.urlencode((string) ($search_date_valid_endyear)); } if ($search_datelimit_startday) { - $param .= '&search_datelimit_startday='.urlencode($search_datelimit_startday); + $param .= '&search_datelimit_startday='.urlencode((string) ($search_datelimit_startday)); } if ($search_datelimit_startmonth) { - $param .= '&search_datelimit_startmonth='.urlencode($search_datelimit_startmonth); + $param .= '&search_datelimit_startmonth='.urlencode((string) ($search_datelimit_startmonth)); } if ($search_datelimit_startyear) { - $param .= '&search_datelimit_startyear='.urlencode($search_datelimit_startyear); + $param .= '&search_datelimit_startyear='.urlencode((string) ($search_datelimit_startyear)); } if ($search_datelimit_endday) { - $param .= '&search_datelimit_endday='.urlencode($search_datelimit_endday); + $param .= '&search_datelimit_endday='.urlencode((string) ($search_datelimit_endday)); } if ($search_datelimit_endmonth) { - $param .= '&search_datelimit_endmonth='.urlencode($search_datelimit_endmonth); + $param .= '&search_datelimit_endmonth='.urlencode((string) ($search_datelimit_endmonth)); } if ($search_datelimit_endyear) { - $param .= '&search_datelimit_endyear='.urlencode($search_datelimit_endyear); + $param .= '&search_datelimit_endyear='.urlencode((string) ($search_datelimit_endyear)); } if ($search_ref) { $param .= '&search_ref='.urlencode($search_ref); @@ -1117,13 +1116,13 @@ if ($search_sale > 0) { $param .= '&search_sale='.urlencode($search_sale); } if ($search_user > 0) { - $param .= '&search_user='.urlencode($search_user); + $param .= '&search_user='.urlencode((string) ($search_user)); } if ($search_login) { $param .= '&search_login='.urlencode($search_login); } if ($search_product_category > 0) { - $param .= '&search_product_category='.urlencode($search_product_category); + $param .= '&search_product_category='.urlencode((string) ($search_product_category)); } if ($search_montant_ht != '') { $param .= '&search_montant_ht='.urlencode($search_montant_ht); @@ -1159,10 +1158,10 @@ if ($search_status != '') { $param .= '&search_status='.urlencode($search_status); } if ($search_paymentmode > 0) { - $param .= '&search_paymentmode='.urlencode($search_paymentmode); + $param .= '&search_paymentmode='.urlencode((string) ($search_paymentmode)); } if ($search_paymentterms > 0) { - $param .= '&search_paymentterms='.urlencode($search_paymentterms); + $param .= '&search_paymentterms='.urlencode((string) ($search_paymentterms)); } if ($search_module_source) { $param .= '&search_module_source='.urlencode($search_module_source); @@ -1171,7 +1170,7 @@ if ($search_pos_source) { $param .= '&search_pos_source='.urlencode($search_pos_source); } if ($show_files) { - $param .= '&show_files='.urlencode($show_files); + $param .= '&show_files='.urlencode((string) ($show_files)); } if ($search_late) { $param .= "&search_late=".urlencode($search_late); @@ -1180,7 +1179,7 @@ if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); } if ($search_categ_cus > 0) { - $param .= '&search_categ_cus='.urlencode($search_categ_cus); + $param .= '&search_categ_cus='.urlencode((string) ($search_categ_cus)); } if (!empty($search_fac_rec_source_title)) { $param .= '&search_fac_rec_source_title='.urlencode($search_fac_rec_source_title); diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index 284dbefcc54..7243c91f3c3 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -221,22 +221,22 @@ if ($resql) { $param .= '&contextpage='.$contextpage; } if ($search_date_startday) { - $param .= '&search_date_startday='.urlencode($search_date_startday); + $param .= '&search_date_startday='.urlencode((string) ($search_date_startday)); } if ($search_date_startmonth) { - $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); + $param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth)); } if ($search_date_startyear) { - $param .= '&search_date_startyear='.urlencode($search_date_startyear); + $param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear)); } if ($search_date_endday) { - $param .= '&search_date_endday='.urlencode($search_date_endday); + $param .= '&search_date_endday='.urlencode((string) ($search_date_endday)); } if ($search_date_endmonth) { - $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + $param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth)); } if ($search_date_endyear) { - $param .= '&search_date_endyear='.urlencode($search_date_endyear); + $param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear)); } if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.$limit; @@ -245,7 +245,7 @@ if ($resql) { $param .= '&search_amount='.urlencode($search_amount); } if ($search_account > 0) { - $param .= '&search_account='.urlencode($search_account); + $param .= '&search_account='.urlencode((string) ($search_account)); } $url = DOL_URL_ROOT.'/compta/paiement/cheque/card.php?action=new'; diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index b59aff4bfc9..12c2ec797d8 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -339,22 +339,22 @@ if ($search_ref) { $param .= '&search_ref='.urlencode($search_ref); } if ($search_date_startday) { - $param .= '&search_date_startday='.urlencode($search_date_startday); + $param .= '&search_date_startday='.urlencode((string) ($search_date_startday)); } if ($search_date_startmonth) { - $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); + $param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth)); } if ($search_date_startyear) { - $param .= '&search_date_startyear='.urlencode($search_date_startyear); + $param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear)); } if ($search_date_endday) { - $param .= '&search_date_endday='.urlencode($search_date_endday); + $param .= '&search_date_endday='.urlencode((string) ($search_date_endday)); } if ($search_date_endmonth) { - $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + $param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth)); } if ($search_date_endyear) { - $param .= '&search_date_endyear='.urlencode($search_date_endyear); + $param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear)); } if ($search_company) { $param .= '&search_company='.urlencode($search_company); @@ -366,7 +366,7 @@ if ($search_paymenttype) { $param .= '&search_paymenttype='.urlencode($search_paymenttype); } if ($search_account) { - $param .= '&search_account='.urlencode($search_account); + $param .= '&search_account='.urlencode((string) ($search_account)); } if ($search_payment_num) { $param .= '&search_payment_num='.urlencode($search_payment_num); diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index 691f6d903bf..c9f2401513b 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -506,7 +506,7 @@ if ($id > 0 || $ref) { $num = $db->num_rows($result); $i = 0; - $urladd = "&id=".urlencode($id); + $urladd = "&id=".urlencode((string) ($id)); if ($limit > 0 && $limit != $conf->liste_limit) { $urladd .= '&limit='.((int) $limit); } diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index abda85280a0..7e149cc435c 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -6,6 +6,7 @@ * Copyright (C) 2014-2016 Ferran Marcet * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2019 JC Prieto + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -144,7 +145,7 @@ class BonPrelevement extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 10, 'notnull' => 1, 'visible' => 0,), diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 8102984f3b2..00934b0f0e6 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -185,7 +185,7 @@ if (empty($reshook)) { setEventMessages($texttoshow, null); } - header("Location: ".DOL_URL_ROOT.'/compta/prelevement/card.php?id='.urlencode($bprev->id).'&type='.urlencode($type)); + header("Location: ".DOL_URL_ROOT.'/compta/prelevement/card.php?id='.urlencode((string) ($bprev->id)).'&type='.urlencode((string) ($type))); exit; } } @@ -462,7 +462,7 @@ if ($resql) { $param .= '&limit='.((int) $limit); } if ($socid) { - $param .= '&socid='.urlencode($socid); + $param .= '&socid='.urlencode((string) ($socid)); } if ($option) { $param .= "&option=".urlencode($option); diff --git a/htdocs/compta/prelevement/factures.php b/htdocs/compta/prelevement/factures.php index 09015486e30..1fe40efa05e 100644 --- a/htdocs/compta/prelevement/factures.php +++ b/htdocs/compta/prelevement/factures.php @@ -275,9 +275,9 @@ if ($resql) { $i = 0; if ($limit > 0 && $limit != $conf->liste_limit) { - $param.='&limit='.((int) $limit); + $param .= '&limit='.((int) $limit); } - $param = "&id=".urlencode($id); + $param = "&id=".urlencode((string) ($id)); // Lines of title fields print ''; @@ -342,7 +342,7 @@ if ($resql) { print ''; print '\n"; if ($object->type == 'bank-transfer' && !$salaryBonPl) { diff --git a/htdocs/compta/prelevement/line.php b/htdocs/compta/prelevement/line.php index 85e92020011..96d9a2d6b2c 100644 --- a/htdocs/compta/prelevement/line.php +++ b/htdocs/compta/prelevement/line.php @@ -111,7 +111,7 @@ if ($action == 'confirm_rejet' && $permissiontoadd) { $result = $rej->create($user, $id, GETPOSTINT('motif'), $daterej, $lipre->bon_rowid, GETPOSTINT('facturer')); if ($result > 0) { - header("Location: line.php?id=".urlencode($id).'&type='.urlencode($type)); + header("Location: line.php?id=".urlencode((string) ($id)).'&type='.urlencode((string) ($type))); exit; } } @@ -119,7 +119,7 @@ if ($action == 'confirm_rejet' && $permissiontoadd) { $action = "rejet"; } } else { - header("Location: line.php?id=".urlencode($id).'&type='.urlencode($type)); + header("Location: line.php?id=".urlencode((string) ($id)).'&type='.urlencode((string) ($type))); exit; } } @@ -343,7 +343,7 @@ if ($id) { $num = $db->num_rows($result); $i = 0; - $urladd = "&id=".urlencode($id); + $urladd = "&id=".urlencode((string) ($id)); $title = $langs->trans("Bills"); if ($type == 'bank-transfer') { $title = $langs->trans("SupplierInvoices"); diff --git a/htdocs/compta/prelevement/orders_list.php b/htdocs/compta/prelevement/orders_list.php index 23eee162758..b6dd673f37f 100644 --- a/htdocs/compta/prelevement/orders_list.php +++ b/htdocs/compta/prelevement/orders_list.php @@ -235,7 +235,7 @@ llxHeader('', $title, $help_url); $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; -$param .= "&statut=".urlencode($statut); +$param .= "&statut=".urlencode((string) ($statut)); if ($type == 'bank-transfer') { $param .= '&type=bank-transfer'; } diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php index 0f2b503da99..5f07abd308a 100644 --- a/htdocs/compta/sociales/list.php +++ b/htdocs/compta/sociales/list.php @@ -328,7 +328,7 @@ if ($search_amount) { $param .= '&search_amount='.urlencode($search_amount); } if ($search_typeid) { - $param .= '&search_typeid='.urlencode($search_typeid); + $param .= '&search_typeid='.urlencode((string) ($search_typeid)); } if ($search_users) { foreach ($search_users as $id_user) { @@ -336,7 +336,7 @@ if ($search_users) { } } if ($search_type) { - $param .= '&search_type='.urlencode($search_type); + $param .= '&search_type='.urlencode((string) ($search_type)); } if ($search_account) { $param .= '&search_account='.$search_account; @@ -345,40 +345,40 @@ if ($search_status != '' && $search_status != '-1') { $param .= '&search_status='.urlencode($search_status); } if ($search_date_startday) { - $param .= '&search_date_startday='.urlencode($search_date_startday); + $param .= '&search_date_startday='.urlencode((string) ($search_date_startday)); } if ($search_date_startmonth) { - $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); + $param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth)); } if ($search_date_startyear) { - $param .= '&search_date_startyear='.urlencode($search_date_startyear); + $param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear)); } if ($search_date_endday) { - $param .= '&search_date_endday='.urlencode($search_date_endday); + $param .= '&search_date_endday='.urlencode((string) ($search_date_endday)); } if ($search_date_endmonth) { - $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + $param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth)); } if ($search_date_endyear) { - $param .= '&search_date_endyear='.urlencode($search_date_endyear); + $param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear)); } if ($search_date_limit_startday) { - $param .= '&search_date_limit_startday='.urlencode($search_date_limit_startday); + $param .= '&search_date_limit_startday='.urlencode((string) ($search_date_limit_startday)); } if ($search_date_limit_startmonth) { - $param .= '&search_date_limit_startmonth='.urlencode($search_date_limit_startmonth); + $param .= '&search_date_limit_startmonth='.urlencode((string) ($search_date_limit_startmonth)); } if ($search_date_limit_startyear) { - $param .= '&search_date_limit_startyear='.urlencode($search_date_limit_startyear); + $param .= '&search_date_limit_startyear='.urlencode((string) ($search_date_limit_startyear)); } if ($search_date_limit_endday) { - $param .= '&search_date_limit_endday='.urlencode($search_date_limit_endday); + $param .= '&search_date_limit_endday='.urlencode((string) ($search_date_limit_endday)); } if ($search_date_limit_endmonth) { - $param .= '&search_date_limit_endmonth='.urlencode($search_date_limit_endmonth); + $param .= '&search_date_limit_endmonth='.urlencode((string) ($search_date_limit_endmonth)); } if ($search_date_limit_endyear) { - $param .= '&search_date_limit_endyear='.urlencode($search_date_limit_endyear); + $param .= '&search_date_limit_endyear='.urlencode((string) ($search_date_limit_endyear)); } $url = DOL_URL_ROOT.'/compta/sociales/card.php?action=create'; diff --git a/htdocs/compta/sociales/payments.php b/htdocs/compta/sociales/payments.php index 22bde6bf509..b97882242e3 100644 --- a/htdocs/compta/sociales/payments.php +++ b/htdocs/compta/sociales/payments.php @@ -123,10 +123,10 @@ if ($sortorder) { $param .= '&sortorder='.urlencode($sortorder); } if ($year) { - $param .= '&year='.urlencode($year); + $param .= '&year='.urlencode((string) ($year)); } if ($search_sc_type) { - $param .= '&search_sc_type='.urlencode($search_sc_type); + $param .= '&search_sc_type='.urlencode((string) ($search_sc_type)); } if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 0cf70884978..a7b38cc85c7 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -1462,16 +1462,16 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; } - if (isModEnabled('order') || isModEnabled("delivery_note")) { + if (isModEnabled('order') || isModEnabled("shipping")) { print ''; diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 98c46cc9f47..ff741101419 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -12,6 +12,7 @@ * Copyright (C) 2018-2021 Frédéric France * Copyright (C) 2023 Charlene Benke * Copyright (C) 2023 Nick Fragoulis + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1351,8 +1352,8 @@ if ($action == 'create') { } elseif ($action == 'activate') { $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' => 'date', 'name' => 'd_end', 'label' => $langs->trans("DateEndPlanned"), /*'value' => $form->selectDate('', "end", $usehm, $usehm, '', "active", 1, 0),*/ 0 => '', 1 => ''), + array('type' => 'text', 'name' => 'comment', 'label' => $langs->trans("Comment"), 'value' => '', 0 => '', 1 => '', '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') { @@ -1890,7 +1891,7 @@ if ($action == 'create') { // Cree un tableau formulaire $formquestion = array( 'text' => $langs->trans("ConfirmMoveToAnotherContractQuestion"), - array('type' => 'select', 'name' => 'newcid', 'values' => $arraycontractid)); + 0 => array('type' => 'select', 'name' => 'newcid', 'values' => $arraycontractid)); print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id."&lineid=".GETPOSTINT('rowid'), $langs->trans("MoveToAnotherContract"), $langs->trans("ConfirmMoveToAnotherContract"), "confirm_move", $formquestion); print '
'; print $langs->trans('SendingMethod'); diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 5097273a833..41fd6253113 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -19,6 +19,7 @@ * Copyright (C) 2022 OpenDSI * Copyright (C) 2022 Gauthier VERDOL * Copyright (C) 2023 William Mead + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -319,7 +320,7 @@ class Propal extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index e5cb5d58393..911d866b671 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -59,7 +59,7 @@ if (isModEnabled('category')) { // Load translation files required by the page $langs->loadLangs(array('companies', 'propal', 'compta', 'bills', 'orders', 'products', 'deliveries', 'categories')); -if (isModEnabled("delivery_note")) { +if (isModEnabled("shipping")) { $langs->loadLangs(array('sendings')); } @@ -225,7 +225,7 @@ $arrayfields = array( 'p.date_livraison' => array('label' => "DeliveryDate", 'checked' => 0), 'p.date_signature' => array('label' => "DateSigning", 'checked' => 0), 'ava.rowid' => array('label' => "AvailabilityPeriod", 'checked' => 0), - 'p.fk_shipping_method' => array('label' => "SendingMethod", 'checked' => 0, 'enabled' => isModEnabled("delivery_note")), + 'p.fk_shipping_method' => array('label' => "SendingMethod", 'checked' => 0, 'enabled' => isModEnabled("shipping")), 'p.fk_input_reason' => array('label' => "Origin", 'checked' => 0, 'enabled' => 1), 'p.fk_cond_reglement' => array('label' => "PaymentConditionsShort", 'checked' => 0), 'p.fk_mode_reglement' => array('label' => "PaymentMode", 'checked' => 0), @@ -886,58 +886,58 @@ if ($search_all) { $param .= '&search_all='.urlencode($search_all); } if ($search_date_startday) { - $param .= '&search_date_startday='.urlencode($search_date_startday); + $param .= '&search_date_startday='.urlencode((string) ($search_date_startday)); } if ($search_date_startmonth) { - $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); + $param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth)); } if ($search_date_startyear) { - $param .= '&search_date_startyear='.urlencode($search_date_startyear); + $param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear)); } if ($search_date_endday) { - $param .= '&search_date_endday='.urlencode($search_date_endday); + $param .= '&search_date_endday='.urlencode((string) ($search_date_endday)); } if ($search_date_endmonth) { - $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + $param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth)); } if ($search_date_endyear) { - $param .= '&search_date_endyear='.urlencode($search_date_endyear); + $param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear)); } if ($search_date_end_startday) { - $param .= '&search_date_end_startday='.urlencode($search_date_end_startday); + $param .= '&search_date_end_startday='.urlencode((string) ($search_date_end_startday)); } if ($search_date_end_startmonth) { - $param .= '&search_date_end_startmonth='.urlencode($search_date_end_startmonth); + $param .= '&search_date_end_startmonth='.urlencode((string) ($search_date_end_startmonth)); } if ($search_date_end_startyear) { - $param .= '&search_date_end_startyear='.urlencode($search_date_end_startyear); + $param .= '&search_date_end_startyear='.urlencode((string) ($search_date_end_startyear)); } if ($search_date_end_endday) { - $param .= '&search_date_end_endday='.urlencode($search_date_end_endday); + $param .= '&search_date_end_endday='.urlencode((string) ($search_date_end_endday)); } if ($search_date_end_endmonth) { - $param .= '&search_date_end_endmonth='.urlencode($search_date_end_endmonth); + $param .= '&search_date_end_endmonth='.urlencode((string) ($search_date_end_endmonth)); } if ($search_date_end_endyear) { - $param .= '&search_date_end_endyear='.urlencode($search_date_end_endyear); + $param .= '&search_date_end_endyear='.urlencode((string) ($search_date_end_endyear)); } if ($search_date_delivery_startday) { - $param .= '&search_date_delivery_startday='.urlencode($search_date_delivery_startday); + $param .= '&search_date_delivery_startday='.urlencode((string) ($search_date_delivery_startday)); } if ($search_date_delivery_startmonth) { - $param .= '&search_date_delivery_startmonth='.urlencode($search_date_delivery_startmonth); + $param .= '&search_date_delivery_startmonth='.urlencode((string) ($search_date_delivery_startmonth)); } if ($search_date_delivery_startyear) { - $param .= '&search_date_delivery_startyear='.urlencode($search_date_delivery_startyear); + $param .= '&search_date_delivery_startyear='.urlencode((string) ($search_date_delivery_startyear)); } if ($search_date_delivery_endday) { - $param .= '&search_date_delivery_endday='.urlencode($search_date_delivery_endday); + $param .= '&search_date_delivery_endday='.urlencode((string) ($search_date_delivery_endday)); } if ($search_date_delivery_endmonth) { - $param .= '&search_date_delivery_endmonth='.urlencode($search_date_delivery_endmonth); + $param .= '&search_date_delivery_endmonth='.urlencode((string) ($search_date_delivery_endmonth)); } if ($search_date_delivery_endyear) { - $param .= '&search_date_delivery_endyear='.urlencode($search_date_delivery_endyear); + $param .= '&search_date_delivery_endyear='.urlencode((string) ($search_date_delivery_endyear)); } if ($search_ref) { $param .= '&search_ref='.urlencode($search_ref); @@ -955,7 +955,7 @@ if ($search_societe_alias) { $param .= '&search_societe_alias='.urlencode($search_societe_alias); } if ($search_user > 0) { - $param .= '&search_user='.urlencode($search_user); + $param .= '&search_user='.urlencode((string) ($search_user)); } if ($search_sale > 0) { $param .= '&search_sale='.urlencode($search_sale); @@ -988,31 +988,31 @@ if ($search_zip) { $param .= '&search_zip='.urlencode($search_zip); } if ($socid > 0) { - $param .= '&socid='.urlencode($socid); + $param .= '&socid='.urlencode((string) ($socid)); } if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); } if ($search_categ_cus > 0) { - $param .= '&search_categ_cus='.urlencode($search_categ_cus); + $param .= '&search_categ_cus='.urlencode((string) ($search_categ_cus)); } if ($search_product_category != '') { - $param .= '&search_product_category='.urlencode($search_product_category); + $param .= '&search_product_category='.urlencode((string) ($search_product_category)); } if ($search_fk_cond_reglement > 0) { - $param .= '&search_fk_cond_reglement='.urlencode($search_fk_cond_reglement); + $param .= '&search_fk_cond_reglement='.urlencode((string) ($search_fk_cond_reglement)); } if ($search_fk_shipping_method > 0) { - $param .= '&search_fk_shipping_method='.urlencode($search_fk_shipping_method); + $param .= '&search_fk_shipping_method='.urlencode((string) ($search_fk_shipping_method)); } if ($search_fk_input_reason > 0) { - $param .= '&search_fk_input_reason='.urlencode($search_fk_input_reason); + $param .= '&search_fk_input_reason='.urlencode((string) ($search_fk_input_reason)); } if ($search_fk_mode_reglement > 0) { - $param .= '&search_fk_mode_reglement='.urlencode($search_fk_mode_reglement); + $param .= '&search_fk_mode_reglement='.urlencode((string) ($search_fk_mode_reglement)); } if ($search_type_thirdparty > 0) { - $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty); + $param .= '&search_type_thirdparty='.urlencode((string) ($search_type_thirdparty)); } if ($search_town) { $param .= '&search_town='.urlencode($search_town); @@ -1027,25 +1027,25 @@ if ($search_town) { $param .= '&search_town='.urlencode($search_town); } if ($search_country) { - $param .= '&search_country='.urlencode($search_country); + $param .= '&search_country='.urlencode((string) ($search_country)); } if ($search_date_signature_startday) { - $param .= '&search_date_signature_startday='.urlencode($search_date_signature_startday); + $param .= '&search_date_signature_startday='.urlencode((string) ($search_date_signature_startday)); } if ($search_date_signature_startmonth) { - $param .= '&search_date_signature_startmonth='.urlencode($search_date_signature_startmonth); + $param .= '&search_date_signature_startmonth='.urlencode((string) ($search_date_signature_startmonth)); } if ($search_date_signature_startyear) { - $param .= '&search_date_signature_startyear='.urlencode($search_date_signature_startyear); + $param .= '&search_date_signature_startyear='.urlencode((string) ($search_date_signature_startyear)); } if ($search_date_signature_endday) { - $param .= '&search_date_signature_endday='.urlencode($search_date_signature_endday); + $param .= '&search_date_signature_endday='.urlencode((string) ($search_date_signature_endday)); } if ($search_date_signature_endmonth) { - $param .= '&search_date_signature_endmonth='.urlencode($search_date_signature_endmonth); + $param .= '&search_date_signature_endmonth='.urlencode((string) ($search_date_signature_endmonth)); } if ($search_date_signature_endyear) { - $param .= '&search_date_signature_endyear='.urlencode($search_date_signature_endyear); + $param .= '&search_date_signature_endyear='.urlencode((string) ($search_date_signature_endyear)); } // Add $param from extra fields diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index 994e30fb9f1..1ed17699c6d 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -2,7 +2,8 @@ /* Copyright (C) 2001-2004 Rodolphe Quiedeville * Copyright (C) 2004-2019 Laurent Destailleur * Copyright (C) 2008 Raphael Bertrand (Resultic) - * Copyright (C) 2019 Frédéric France + * Copyright (C) 2019-2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -45,6 +46,7 @@ $backtopage = GETPOST('backtopage', 'alpha'); // Security check $socid = GETPOSTINT('id') ? GETPOSTINT('id') : GETPOSTINT('socid'); +/** @var User $user */ if ($user->socid > 0) { $socid = $user->socid; } @@ -55,7 +57,7 @@ if ($user->socid > 0) { } $result = restrictedArea($user, 'societe', $id, '&societe', '', 'fk_soc', 'rowid', 0); -$permissiontocreate = ($user->rights->societe->creer || $user->rights->facture->creer); +$permissiontocreate = ($user->hasRight('societe', 'creer') || $user->hasRight('facture', 'creer')); @@ -559,8 +561,8 @@ if ($socid > 0) { $amount2 = ($showconfirminfo['amount_ttc'] - $amount1); $formquestion = array( 'text' => $langs->trans('TypeAmountOfEachNewDiscount'), - array('type' => 'text', 'name' => 'amount_ttc_1', 'label' => $langs->trans("AmountTTC").' 1', 'value' => $amount1, 'size' => '5'), - array('type' => 'text', 'name' => 'amount_ttc_2', 'label' => $langs->trans("AmountTTC").' 2', 'value' => $amount2, 'size' => '5') + 0 => array('type' => 'text', 'name' => 'amount_ttc_1', 'label' => $langs->trans("AmountTTC").' 1', 'value' => $amount1, 'size' => '5'), + 1 => array('type' => 'text', 'name' => 'amount_ttc_2', 'label' => $langs->trans("AmountTTC").' 2', 'value' => $amount2, 'size' => '5') ); $langs->load("dict"); print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&remid='.$showconfirminfo['rowid'].($backtopage ? '&backtopage='.urlencode($backtopage) : ''), $langs->trans('SplitDiscount'), $langs->trans('ConfirmSplitDiscount', price($showconfirminfo['amount_ttc']), $langs->transnoentities("Currency".$conf->currency)), 'confirm_split', $formquestion, '', 0); @@ -706,8 +708,8 @@ if ($socid > 0) { $amount2 = ($showconfirminfo['amount_ttc'] - $amount1); $formquestion = array( 'text' => $langs->trans('TypeAmountOfEachNewDiscount'), - array('type' => 'text', 'name' => 'amount_ttc_1', 'label' => $langs->trans("AmountTTC").' 1', 'value' => $amount1, 'size' => '5'), - array('type' => 'text', 'name' => 'amount_ttc_2', 'label' => $langs->trans("AmountTTC").' 2', 'value' => $amount2, 'size' => '5') + 0 => array('type' => 'text', 'name' => 'amount_ttc_1', 'label' => $langs->trans("AmountTTC").' 1', 'value' => $amount1, 'size' => '5'), + 1 => array('type' => 'text', 'name' => 'amount_ttc_2', 'label' => $langs->trans("AmountTTC").' 2', 'value' => $amount2, 'size' => '5') ); $langs->load("dict"); print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&remid='.$showconfirminfo['rowid'].($backtopage ? '&backtopage='.urlencode($backtopage) : ''), $langs->trans('SplitDiscount'), $langs->trans('ConfirmSplitDiscount', price($showconfirminfo['amount_ttc']), $langs->transnoentities("Currency".$conf->currency)), 'confirm_split', $formquestion, 0, 0); diff --git a/htdocs/commande/agenda.php b/htdocs/commande/agenda.php index 9ffb69fbb9c..af2a5da5594 100644 --- a/htdocs/commande/agenda.php +++ b/htdocs/commande/agenda.php @@ -96,7 +96,7 @@ restrictedArea($user, 'commande', $object->id, '', '', 'fk_soc', 'rowid', $isdra * Actions */ -$parameters = array('id'=>$id); +$parameters = array('id' => $id); $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'); @@ -191,14 +191,14 @@ if ($object->id > 0) { $objthirdparty = $object; $objcon = new stdClass(); - $out = '&origin='.urlencode($object->element.(property_exists($object, 'module') ? '@'.$object->module : '')).'&originid='.urlencode($object->id); + $out = '&origin='.urlencode((string) ($object->element.(property_exists($object, 'module') ? '@'.$object->module : ''))).'&originid='.urlencode((string) ($object->id)); $urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id; $out .= '&backtopage='.urlencode($urlbacktopage); $permok = $user->hasRight('agenda', 'myactions', 'create'); if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) { //$out.='id.'&action='.$action.'&origin='.urlencode(GETPOST('origin')).'&originid='.urlencode(GETPOSTINT('originid')); + $backtopage = $_SERVER["PHP_SELF"].'?socid='.$thirdparty->id.'&action='.$action.'&origin='.urlencode((string) (GETPOST('origin'))).'&originid='.urlencode((string) (GETPOSTINT('originid'))); include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php'; print '
'.$langs->trans('SendingMethod').''; print img_picto('', 'object_dolly', 'class="pictofixedwidth"'); $form->selectShippingMethod(((GETPOSTISSET('shipping_method_id') && GETPOSTINT('shipping_method_id') != 0) ? GETPOST('shipping_method_id') : $shipping_method_id), 'shipping_method_id', '', 1, '', 0, 'maxwidth200 widthcentpercentminusx'); @@ -2593,7 +2593,7 @@ if ($action == 'create' && $usercancreate) { print '
'; $editenable = $usercancreate; print $form->editfieldkey("SendingMethod", 'shippingmethod', '', $object, $editenable); @@ -2995,14 +2995,14 @@ if ($action == 'create' && $usercancreate) { }*/ $numshipping = 0; - if (isModEnabled('delivery_note')) { + if (isModEnabled('shipping')) { $numshipping = $object->countNbOfShipments(); } // Create shipment if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && ($object->getNbOfProductsLines() > 0 || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) { if ((getDolGlobalInt('MAIN_SUBMODULE_EXPEDITION') && $user->hasRight('expedition', 'creer')) || (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY') && $user->hasRight('expedition', 'delivery', 'creer'))) { - $arrayforbutaction[] = array('lang' => 'sendings', 'enabled' => (isModEnabled("delivery_note") && ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && ($object->getNbOfProductsLines() > 0 || getDolGlobalString('STOCK_SUPPORTS_SERVICES')))), 'perm' => $user->hasRight('expedition', 'creer'), 'label' => 'CreateShipment', 'url' => '/expedition/shipment.php?id='.$object->id); + $arrayforbutaction[] = array('lang' => 'sendings', 'enabled' => (isModEnabled("shipping") && ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && ($object->getNbOfProductsLines() > 0 || getDolGlobalString('STOCK_SUPPORTS_SERVICES')))), 'perm' => $user->hasRight('expedition', 'creer'), 'label' => 'CreateShipment', 'url' => '/expedition/shipment.php?id='.$object->id); /* if ($user->hasRight('expedition', 'creer')) { print dolGetButtonAction('', $langs->trans('CreateShipment'), 'default', DOL_URL_ROOT.'/expedition/shipment.php?id='.$object->id, ''); diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index d89d3b39dfb..b7d2e37c24d 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -13,6 +13,7 @@ * Copyright (C) 2016-2022 Ferran Marcet * Copyright (C) 2021-2024 Frédéric France * Copyright (C) 2022 Gauthier VERDOL + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -310,7 +311,7 @@ class Commande extends CommonOrder // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), @@ -3825,7 +3826,7 @@ class Commande extends CommonOrder $result = ''; - if (isModEnabled("delivery_note") && ($option == '1' || $option == '2')) { + if (isModEnabled("shipping") && ($option == '1' || $option == '2')) { $url = DOL_URL_ROOT.'/expedition/shipment.php?id='.$this->id; } else { $url = DOL_URL_ROOT.'/commande/card.php?id='.$this->id; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index ac2ac6af639..e01cc02b357 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -184,7 +184,7 @@ $arrayfields = array( 'typent.code' => array('label' => "ThirdPartyType", 'checked' => $checkedtypetiers, 'position' => 55), 'c.date_commande' => array('label' => "OrderDateShort", 'checked' => 1, 'position' => 60, 'csslist' => 'nowraponall'), 'c.date_delivery' => array('label' => "DateDeliveryPlanned", 'checked' => 1, 'enabled' => !getDolGlobalString('ORDER_DISABLE_DELIVERY_DATE'), 'position' => 65, 'csslist' => 'nowraponall'), - 'c.fk_shipping_method' => array('label' => "SendingMethod", 'checked' => -1, 'position' => 66 , 'enabled' => isModEnabled("delivery_note")), + 'c.fk_shipping_method' => array('label' => "SendingMethod", 'checked' => -1, 'position' => 66 , 'enabled' => isModEnabled("shipping")), 'c.fk_cond_reglement' => array('label' => "PaymentConditionsShort", 'checked' => -1, 'position' => 67), 'c.fk_mode_reglement' => array('label' => "PaymentMode", 'checked' => -1, 'position' => 68), 'c.fk_input_reason' => array('label' => "Channel", 'checked' => -1, 'position' => 69), @@ -207,7 +207,7 @@ $arrayfields = array( 'c.date_cloture' => array('label' => "DateClosing", 'checked' => 0, 'position' => 130), 'c.note_public' => array('label' => 'NotePublic', 'checked' => 0, 'enabled' => (!getDolGlobalInt('MAIN_LIST_HIDE_PUBLIC_NOTES')), 'position' => 135, 'searchall' => 1), 'c.note_private' => array('label' => 'NotePrivate', 'checked' => 0, 'enabled' => (!getDolGlobalInt('MAIN_LIST_HIDE_PRIVATE_NOTES')), 'position' => 140), - 'shippable' => array('label' => "Shippable", 'checked' => 1,'enabled' => (isModEnabled("delivery_note")), 'position' => 990), + 'shippable' => array('label' => "Shippable", 'checked' => 1,'enabled' => (isModEnabled("shipping")), 'position' => 990), 'c.facture' => array('label' => "Billed", 'checked' => 1, 'enabled' => (!getDolGlobalString('WORKFLOW_BILL_ON_SHIPMENT')), 'position' => 995), 'c.import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'position' => 999), 'c.fk_statut' => array('label' => "Status", 'checked' => 1, 'position' => 1000) @@ -593,7 +593,7 @@ if (empty($reshook)) { if ($nb_bills_created == 1) { $texttoshow = $langs->trans('BillXCreated', '{s1}'); - $texttoshow = str_replace('{s1}', ''.$lastref.'', $texttoshow); + $texttoshow = str_replace('{s1}', ''.$lastref.'', $texttoshow); setEventMessages($texttoshow, null, 'mesgs'); } else { setEventMessages($langs->trans('BillCreated', $nb_bills_created), null, 'mesgs'); @@ -617,10 +617,10 @@ if (empty($reshook)) { $param .= '&search_all='.urlencode($search_all); } if ($show_files) { - $param .= '&show_files='.urlencode($show_files); + $param .= '&show_files='.urlencode((string) ($show_files)); } if ($socid > 0) { - $param .= '&socid='.urlencode($socid); + $param .= '&socid='.urlencode((string) ($socid)); } if ($search_status != '') { $param .= '&search_status='.urlencode($search_status); @@ -653,10 +653,10 @@ if (empty($reshook)) { $param .= '&search_ref_customer='.urlencode($search_ref_customer); } if ($search_user > 0) { - $param .= '&search_user='.urlencode($search_user); + $param .= '&search_user='.urlencode((string) ($search_user)); } if ($search_sale > 0) { - $param .= '&search_sale='.urlencode($search_sale); + $param .= '&search_sale='.urlencode((string) ($search_sale)); } if ($search_total_ht != '') { $param .= '&search_total_ht='.urlencode($search_total_ht); @@ -905,7 +905,7 @@ if ($search_billed != '' && $search_billed >= 0) { } if ($search_status != '') { if ($search_status <= 3 && $search_status >= -1) { // status from -1 to 3 are real status (other are virtual combination) - if ($search_status == 1 && !isModEnabled('delivery_note')) { + if ($search_status == 1 && !isModEnabled('shipping')) { $sql .= ' AND c.fk_statut IN (1,2)'; // If module expedition disabled, we include order with status "sent" into "validated" } else { $sql .= ' AND c.fk_statut = '.((int) $search_status); // draft, validated, in process or canceled @@ -1162,7 +1162,7 @@ if ($search_status == -2) { $title .= ' - '.$langs->trans('StatusOrderToProcessShort'); } if ($search_status == -3) { - $title .= ' - '.$langs->trans('StatusOrderValidated').', '.(!isModEnabled('delivery_note') ? '' : $langs->trans("StatusOrderSent").', ').$langs->trans('StatusOrderToBill'); + $title .= ' - '.$langs->trans('StatusOrderValidated').', '.(!isModEnabled('shipping') ? '' : $langs->trans("StatusOrderSent").', ').$langs->trans('StatusOrderToBill'); } if ($search_status == -4) { $title .= ' - '.$langs->trans("StatusOrderValidatedShort").'+'.$langs->trans("StatusOrderSentShort"); @@ -1239,10 +1239,10 @@ if ($search_ref_customer) { $param .= '&search_ref_customer='.urlencode($search_ref_customer); } if ($search_user > 0) { - $param .= '&search_user='.urlencode($search_user); + $param .= '&search_user='.urlencode((string) ($search_user)); } if ($search_sale > 0) { - $param .= '&search_sale='.urlencode($search_sale); + $param .= '&search_sale='.urlencode((string) ($search_sale)); } if ($search_total_ht != '') { $param .= '&search_total_ht='.urlencode($search_total_ht); @@ -1254,7 +1254,7 @@ if ($search_total_ttc != '') { $param .= '&search_total_ttc='.urlencode($search_total_ttc); } if ($search_warehouse != '') { - $param .= '&search_warehouse='.urlencode($search_warehouse); + $param .= '&search_warehouse='.urlencode((string) ($search_warehouse)); } if ($search_login) { $param .= '&search_login='.urlencode($search_login); @@ -1287,19 +1287,19 @@ if ($search_state != '') { $param .= '&search_state='.urlencode($search_state); } if ($search_country != '') { - $param .= '&search_country='.urlencode($search_country); + $param .= '&search_country='.urlencode((string) ($search_country)); } if ($search_type_thirdparty && $search_type_thirdparty != '-1') { - $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty); + $param .= '&search_type_thirdparty='.urlencode((string) ($search_type_thirdparty)); } if ($search_product_category != '') { - $param .= '&search_product_category='.urlencode($search_product_category); + $param .= '&search_product_category='.urlencode((string) ($search_product_category)); } if (($search_categ_cus > 0) || ($search_categ_cus == -2)) { - $param .= '&search_categ_cus='.urlencode($search_categ_cus); + $param .= '&search_categ_cus='.urlencode((string) ($search_categ_cus)); } if ($show_files) { - $param .= '&show_files='.urlencode($show_files); + $param .= '&show_files='.urlencode((string) ($show_files)); } if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); @@ -1308,16 +1308,16 @@ if ($search_billed != '') { $param .= '&search_billed='.urlencode($search_billed); } if ($search_fk_cond_reglement > 0) { - $param .= '&search_fk_cond_reglement='.urlencode($search_fk_cond_reglement); + $param .= '&search_fk_cond_reglement='.urlencode((string) ($search_fk_cond_reglement)); } if ($search_fk_shipping_method > 0) { - $param .= '&search_fk_shipping_method='.urlencode($search_fk_shipping_method); + $param .= '&search_fk_shipping_method='.urlencode((string) ($search_fk_shipping_method)); } if ($search_fk_mode_reglement > 0) { - $param .= '&search_fk_mode_reglement='.urlencode($search_fk_mode_reglement); + $param .= '&search_fk_mode_reglement='.urlencode((string) ($search_fk_mode_reglement)); } if ($search_fk_input_reason > 0) { - $param .= '&search_fk_input_reason='.urlencode($search_fk_input_reason); + $param .= '&search_fk_input_reason='.urlencode((string) ($search_fk_input_reason)); } // Add $param from extra fields diff --git a/htdocs/commande/list_det.php b/htdocs/commande/list_det.php index 0451f7d48fe..2adbd25a7d0 100644 --- a/htdocs/commande/list_det.php +++ b/htdocs/commande/list_det.php @@ -195,7 +195,7 @@ $arrayfields = array( 'typent.code' => array('label' => "ThirdPartyType", 'checked' => $checkedtypetiers, 'position' => 55), 'c.date_commande' => array('label' => "OrderDateShort", 'checked' => 1, 'position' => 60), 'c.date_delivery' => array('label' => "DateDeliveryPlanned", 'checked' => 1, 'enabled' => !getDolGlobalString('ORDER_DISABLE_DELIVERY_DATE'), 'position' => 65), - 'c.fk_shipping_method' => array('label' => "SendingMethod", 'checked' => -1, 'position' => 66 , 'enabled' => isModEnabled('delivery_note')), + 'c.fk_shipping_method' => array('label' => "SendingMethod", 'checked' => -1, 'position' => 66 , 'enabled' => isModEnabled('shipping')), 'c.fk_cond_reglement' => array('label' => "PaymentConditionsShort", 'checked' => -1, 'position' => 67), 'c.fk_mode_reglement' => array('label' => "PaymentMode", 'checked' => -1, 'position' => 68), 'c.fk_input_reason' => array('label' => "Channel", 'checked' => -1, 'position' => 69), @@ -219,7 +219,7 @@ $arrayfields = array( 'c.date_cloture' => array('label' => "DateClosing", 'checked' => 0, 'position' => 130), 'c.note_public' => array('label' => 'NotePublic', 'checked' => 0, 'enabled' => (!getDolGlobalString('MAIN_LIST_ALLOW_PUBLIC_NOTES')), 'position' => 135), 'c.note_private' => array('label' => 'NotePrivate', 'checked' => 0, 'enabled' => (!getDolGlobalString('MAIN_LIST_ALLOW_PRIVATE_NOTES')), 'position' => 140), - 'shippable' => array('label' => "Shippable", 'checked' => 1,'enabled' => (isModEnabled('delivery_note')), 'position' => 990), + 'shippable' => array('label' => "Shippable", 'checked' => 1,'enabled' => (isModEnabled('shipping')), 'position' => 990), 'c.facture' => array('label' => "Billed", 'checked' => 1, 'enabled' => (!getDolGlobalString('WORKFLOW_BILL_ON_SHIPMENT')), 'position' => 995), 'c.import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'position' => 999), 'c.fk_statut' => array('label' => "Status", 'checked' => 1, 'position' => 1000) @@ -470,7 +470,7 @@ if ($search_billed != '' && $search_billed >= 0) { } if ($search_status != '') { if ($search_status <= 3 && $search_status >= -1) { // status from -1 to 3 are real status (other are virtual combination) - if ($search_status == 1 && !isModEnabled('delivery_note')) { + if ($search_status == 1 && !isModEnabled('shipping')) { $sql .= ' AND c.fk_statut IN (1,2)'; // If module expedition disabled, we include order with status "sent" into "validated" } else { $sql .= ' AND c.fk_statut = '.((int) $search_status); // draft, validated, in process or canceled @@ -685,7 +685,7 @@ if ($resql) { $title .= ' - '.$langs->trans('StatusOrderToProcessShort'); } if ($search_status == -3) { - $title .= ' - '.$langs->trans('StatusOrderValidated').', '.(!isModEnabled('delivery_note') ? '' : $langs->trans("StatusOrderSent").', ').$langs->trans('StatusOrderToBill'); + $title .= ' - '.$langs->trans('StatusOrderValidated').', '.(!isModEnabled('shipping') ? '' : $langs->trans("StatusOrderSent").', ').$langs->trans('StatusOrderToBill'); } if ($search_status == -4) { $title .= ' - '.$langs->trans("StatusOrderValidatedShort").'+'.$langs->trans("StatusOrderSentShort"); @@ -716,7 +716,7 @@ if ($resql) { $param .= '&sall='.urlencode($sall); } if ($socid > 0) { - $param .= '&socid='.urlencode($socid); + $param .= '&socid='.urlencode((string) ($socid)); } if ($search_id) { $param .= '&search_id='.urlencode($search_id); @@ -762,7 +762,7 @@ if ($resql) { $param .= '&search_ref_customer='.urlencode($search_ref_customer); } if ($search_user > 0) { - $param .= '&search_user='.urlencode($search_user); + $param .= '&search_user='.urlencode((string) ($search_user)); } if ($search_sale > 0) { $param .= '&search_sale='.urlencode($search_sale); @@ -777,7 +777,7 @@ if ($resql) { $param .= '&search_total_ttc='.urlencode($search_total_ttc); } if ($search_warehouse != '') { - $param .= '&search_warehouse='.urlencode($search_warehouse); + $param .= '&search_warehouse='.urlencode((string) ($search_warehouse)); } if ($search_login) { $param .= '&search_login='.urlencode($search_login); @@ -810,10 +810,10 @@ if ($resql) { $param .= '&search_state='.urlencode($search_state); } if ($search_country != '') { - $param .= '&search_country='.urlencode($search_country); + $param .= '&search_country='.urlencode((string) ($search_country)); } if ($search_type_thirdparty && $search_type_thirdparty != '-1') { - $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty); + $param .= '&search_type_thirdparty='.urlencode((string) ($search_type_thirdparty)); } if (!empty($search_product_category_array)) { foreach ($search_product_category_array as $tmpval) { @@ -821,10 +821,10 @@ if ($resql) { } } if (($search_categ_cus > 0) || ($search_categ_cus == -2)) { - $param .= '&search_categ_cus='.urlencode($search_categ_cus); + $param .= '&search_categ_cus='.urlencode((string) ($search_categ_cus)); } if ($show_files) { - $param .= '&show_files='.urlencode($show_files); + $param .= '&show_files='.urlencode((string) ($show_files)); } if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); @@ -833,16 +833,16 @@ if ($resql) { $param .= '&search_billed='.urlencode($search_billed); } if ($search_fk_cond_reglement > 0) { - $param .= '&search_fk_cond_reglement='.urlencode($search_fk_cond_reglement); + $param .= '&search_fk_cond_reglement='.urlencode((string) ($search_fk_cond_reglement)); } if ($search_fk_shipping_method > 0) { - $param .= '&search_fk_shipping_method='.urlencode($search_fk_shipping_method); + $param .= '&search_fk_shipping_method='.urlencode((string) ($search_fk_shipping_method)); } if ($search_fk_mode_reglement > 0) { - $param .= '&search_fk_mode_reglement='.urlencode($search_fk_mode_reglement); + $param .= '&search_fk_mode_reglement='.urlencode((string) ($search_fk_mode_reglement)); } if ($search_fk_input_reason > 0) { - $param .= '&search_fk_input_reason='.urlencode($search_fk_input_reason); + $param .= '&search_fk_input_reason='.urlencode((string) ($search_fk_input_reason)); } if (!empty($productobuy)) { $param .= '&productobuy='.urlencode($productobuy); diff --git a/htdocs/compta/bank/account_statement_document.php b/htdocs/compta/bank/account_statement_document.php index 26613a6bb49..9585ac55973 100644 --- a/htdocs/compta/bank/account_statement_document.php +++ b/htdocs/compta/bank/account_statement_document.php @@ -130,7 +130,7 @@ if (!empty($numref)) { $object->fetch_thirdparty(); $upload_dir = $conf->bank->dir_output."/".$id."/statement/".dol_sanitizeFileName($numref); } -$backtopage = $_SERVER['PHP_SELF']."?account=".urlencode($id)."&num=".urlencode($numref); +$backtopage = $_SERVER['PHP_SELF']."?account=".urlencode((string) ($id))."&num=".urlencode((string) ($numref)); include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 2a3672b0cd9..82184b9ecb7 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -288,16 +288,16 @@ if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', ' if (!$error) { $param = 'action=reconcile&contextpage=banktransactionlist&id='.((int) $object->id).'&search_account='.((int) $object->id); if ($page) { - $param .= '&page='.urlencode($page); + $param .= '&page='.urlencode((string) ($page)); } if ($offset) { - $param .= '&offset='.urlencode($offset); + $param .= '&offset='.urlencode((string) ($offset)); } if ($limit) { $param .= '&limit='.((int) $limit); } if ($search_conciliated != '' && $search_conciliated != '-1') { - $param .= '&search_conciliated='.urlencode($search_conciliated); + $param .= '&search_conciliated='.urlencode((string) ($search_conciliated)); } if ($search_thirdparty_user) { $param .= '&search_thirdparty='.urlencode($search_thirdparty_user); @@ -449,7 +449,7 @@ if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.((int) $limit); } if ($id > 0) { - $param .= '&id='.urlencode($id); + $param .= '&id='.urlencode((string) ($id)); } if (!empty($ref)) { $param .= '&ref='.urlencode($ref); @@ -473,19 +473,19 @@ if (!empty($search_credit)) { $param .= '&search_credit='.urlencode($search_credit); } if ($search_account > 0) { - $param .= '&search_account='.urlencode($search_account); + $param .= '&search_account='.urlencode((string) ($search_account)); } if (!empty($search_num_releve)) { $param .= '&search_num_releve='.urlencode($search_num_releve); } if ($search_conciliated != '' && $search_conciliated != '-1') { - $param .= '&search_conciliated='.urlencode($search_conciliated); + $param .= '&search_conciliated='.urlencode((string) ($search_conciliated)); } if ($search_fk_bordereau > 0) { - $param .= '$&search_fk_bordereau='.urlencode($search_fk_bordereau); + $param .= '$&search_fk_bordereau='.urlencode((string) ($search_fk_bordereau)); } if ($search_bid > 0) { - $param .= '&search_bid='.urlencode($search_bid); + $param .= '&search_bid='.urlencode((string) ($search_bid)); } if (dol_strlen($search_dt_start) > 0) { $param .= '&search_start_dtmonth='.GETPOSTINT('search_start_dtmonth').'&search_start_dtday='.GETPOSTINT('search_start_dtday').'&search_start_dtyear='.GETPOSTINT('search_start_dtyear'); @@ -503,7 +503,7 @@ if ($search_req_nb) { $param .= '&req_nb='.urlencode($search_req_nb); } if (GETPOSTINT("search_thirdparty")) { - $param .= '&thirdparty='.urlencode(GETPOSTINT("search_thirdparty")); + $param .= '&thirdparty='.urlencode((string) (GETPOSTINT("search_thirdparty"))); } if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); @@ -1022,7 +1022,7 @@ if ($resql) { // We can add page now to param if ($page != '') { - $param .= '&page='.urlencode($page); + $param .= '&page='.urlencode((string) ($page)); } $moreforfilter = ''; diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 980139ac752..e871b6dd754 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -10,6 +10,7 @@ * Copyright (C) 2016 Ferran Marcet * Copyright (C) 2019 JC Prieto * Copyright (C) 2022-2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -311,49 +312,49 @@ class Account extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), - 'ref' =>array('type'=>'varchar(12)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>25), - 'label' =>array('type'=>'varchar(30)', 'label'=>'Label', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>30), - 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>35, 'index'=>1), - 'bank' =>array('type'=>'varchar(60)', 'label'=>'Bank', 'enabled'=>1, 'visible'=>-1, 'position'=>40), - 'code_banque' =>array('type'=>'varchar(128)', 'label'=>'Code banque', 'enabled'=>1, 'visible'=>-1, 'position'=>45), - 'code_guichet' =>array('type'=>'varchar(6)', 'label'=>'Code guichet', 'enabled'=>1, 'visible'=>-1, 'position'=>50), - 'number' =>array('type'=>'varchar(255)', 'label'=>'Number', 'enabled'=>1, 'visible'=>-1, 'position'=>55), - 'cle_rib' =>array('type'=>'varchar(5)', 'label'=>'Cle rib', 'enabled'=>1, 'visible'=>-1, 'position'=>60), - 'bic' =>array('type'=>'varchar(11)', 'label'=>'Bic', 'enabled'=>1, 'visible'=>-1, 'position'=>65), - 'iban_prefix' =>array('type'=>'varchar(34)', 'label'=>'Iban prefix', 'enabled'=>1, 'visible'=>-1, 'position'=>70), - 'country_iban' =>array('type'=>'varchar(2)', 'label'=>'Country iban', 'enabled'=>1, 'visible'=>-1, 'position'=>75), - 'cle_iban' =>array('type'=>'varchar(2)', 'label'=>'Cle iban', 'enabled'=>1, 'visible'=>-1, 'position'=>80), - 'domiciliation' =>array('type'=>'varchar(255)', 'label'=>'Domiciliation', 'enabled'=>1, 'visible'=>-1, 'position'=>85), - 'state_id' =>array('type'=>'integer', 'label'=>'StateId', 'enabled'=>1, 'visible'=>-1, 'position'=>90), - 'fk_pays' =>array('type'=>'integer', 'label'=>'Country', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>95), - 'proprio' =>array('type'=>'varchar(60)', 'label'=>'Proprio', 'enabled'=>1, 'visible'=>-1, 'position'=>100), - 'owner_address' =>array('type'=>'varchar(255)', 'label'=>'Owner address', 'enabled'=>1, 'visible'=>-1, 'position'=>105), - 'owner_zip' =>array('type'=>'varchar(25)', 'label'=>'Owner zip', 'enabled'=>1, 'visible'=>-1, 'position'=>106), - 'owner_town' =>array('type'=>'varchar(50)', 'label'=>'Owner town', 'enabled'=>1, 'visible'=>-1, 'position'=>107), - 'owner_country_id' =>array('type'=>'integer', 'label'=>'Owner country', 'enabled'=>1, 'visible'=>-1, 'position'=>108), - 'courant' =>array('type'=>'smallint(6)', 'label'=>'Courant', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>110), - 'clos' =>array('type'=>'smallint(6)', 'label'=>'Clos', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>115), - 'rappro' =>array('type'=>'smallint(6)', 'label'=>'Rappro', 'enabled'=>1, 'visible'=>-1, 'position'=>120), - 'url' =>array('type'=>'varchar(128)', 'label'=>'Url', 'enabled'=>1, 'visible'=>-1, 'position'=>125), - 'account_number' =>array('type'=>'varchar(32)', 'label'=>'Account number', 'enabled'=>1, 'visible'=>-1, 'position'=>130), - 'fk_accountancy_journal' =>array('type'=>'integer', 'label'=>'Accountancy journal ID', 'enabled'=>1, 'visible'=>-1, 'position'=>132), - 'accountancy_journal' =>array('type'=>'varchar(20)', 'label'=>'Accountancy journal', 'enabled'=>1, 'visible'=>-1, 'position'=>135), - 'currency_code' =>array('type'=>'varchar(3)', 'label'=>'Currency code', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>140), - 'min_allowed' =>array('type'=>'integer', 'label'=>'Min allowed', 'enabled'=>1, 'visible'=>-1, 'position'=>145), - 'min_desired' =>array('type'=>'integer', 'label'=>'Min desired', 'enabled'=>1, 'visible'=>-1, 'position'=>150), - 'comment' =>array('type'=>'text', 'label'=>'Comment', 'enabled'=>1, 'visible'=>-1, 'position'=>155), - 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>156), - 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>157), - 'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'position'=>160), - 'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>165), - 'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>170), - 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>175), - 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>180), - 'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>185), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), + 'ref' => array('type' => 'varchar(12)', 'label' => 'Ref', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'showoncombobox' => 1, 'position' => 25), + 'label' => array('type' => 'varchar(30)', 'label' => 'Label', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 30), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 35, 'index' => 1), + 'bank' => array('type' => 'varchar(60)', 'label' => 'Bank', 'enabled' => 1, 'visible' => -1, 'position' => 40), + 'code_banque' => array('type' => 'varchar(128)', 'label' => 'Code banque', 'enabled' => 1, 'visible' => -1, 'position' => 45), + 'code_guichet' => array('type' => 'varchar(6)', 'label' => 'Code guichet', 'enabled' => 1, 'visible' => -1, 'position' => 50), + 'number' => array('type' => 'varchar(255)', 'label' => 'Number', 'enabled' => 1, 'visible' => -1, 'position' => 55), + 'cle_rib' => array('type' => 'varchar(5)', 'label' => 'Cle rib', 'enabled' => 1, 'visible' => -1, 'position' => 60), + 'bic' => array('type' => 'varchar(11)', 'label' => 'Bic', 'enabled' => 1, 'visible' => -1, 'position' => 65), + 'iban_prefix' => array('type' => 'varchar(34)', 'label' => 'Iban prefix', 'enabled' => 1, 'visible' => -1, 'position' => 70), + 'country_iban' => array('type' => 'varchar(2)', 'label' => 'Country iban', 'enabled' => 1, 'visible' => -1, 'position' => 75), + 'cle_iban' => array('type' => 'varchar(2)', 'label' => 'Cle iban', 'enabled' => 1, 'visible' => -1, 'position' => 80), + 'domiciliation' => array('type' => 'varchar(255)', 'label' => 'Domiciliation', 'enabled' => 1, 'visible' => -1, 'position' => 85), + 'state_id' => array('type' => 'integer', 'label' => 'StateId', 'enabled' => 1, 'visible' => -1, 'position' => 90), + 'fk_pays' => array('type' => 'integer', 'label' => 'Country', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 95), + 'proprio' => array('type' => 'varchar(60)', 'label' => 'Proprio', 'enabled' => 1, 'visible' => -1, 'position' => 100), + 'owner_address' => array('type' => 'varchar(255)', 'label' => 'Owner address', 'enabled' => 1, 'visible' => -1, 'position' => 105), + 'owner_zip' => array('type' => 'varchar(25)', 'label' => 'Owner zip', 'enabled' => 1, 'visible' => -1, 'position' => 106), + 'owner_town' => array('type' => 'varchar(50)', 'label' => 'Owner town', 'enabled' => 1, 'visible' => -1, 'position' => 107), + 'owner_country_id' => array('type' => 'integer', 'label' => 'Owner country', 'enabled' => 1, 'visible' => -1, 'position' => 108), + 'courant' => array('type' => 'smallint(6)', 'label' => 'Courant', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 110), + 'clos' => array('type' => 'smallint(6)', 'label' => 'Clos', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 115), + 'rappro' => array('type' => 'smallint(6)', 'label' => 'Rappro', 'enabled' => 1, 'visible' => -1, 'position' => 120), + 'url' => array('type' => 'varchar(128)', 'label' => 'Url', 'enabled' => 1, 'visible' => -1, 'position' => 125), + 'account_number' => array('type' => 'varchar(32)', 'label' => 'Account number', 'enabled' => 1, 'visible' => -1, 'position' => 130), + 'fk_accountancy_journal' => array('type' => 'integer', 'label' => 'Accountancy journal ID', 'enabled' => 1, 'visible' => -1, 'position' => 132), + 'accountancy_journal' => array('type' => 'varchar(20)', 'label' => 'Accountancy journal', 'enabled' => 1, 'visible' => -1, 'position' => 135), + 'currency_code' => array('type' => 'varchar(3)', 'label' => 'Currency code', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 140), + 'min_allowed' => array('type' => 'integer', 'label' => 'Min allowed', 'enabled' => 1, 'visible' => -1, 'position' => 145), + 'min_desired' => array('type' => 'integer', 'label' => 'Min desired', 'enabled' => 1, 'visible' => -1, 'position' => 150), + 'comment' => array('type' => 'text', 'label' => 'Comment', 'enabled' => 1, 'visible' => -1, 'position' => 155), + 'datec' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'visible' => -1, 'position' => 156), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 157), + 'fk_user_author' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'Fk user author', 'enabled' => 1, 'visible' => -1, 'position' => 160), + 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => 1, 'visible' => -2, 'notnull' => -1, 'position' => 165), + 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => 1, 'visible' => 0, 'position' => 170), + 'model_pdf' => array('type' => 'varchar(255)', 'label' => 'Model pdf', 'enabled' => 1, 'visible' => 0, 'position' => 175), + 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'position' => 180), + 'extraparams' => array('type' => 'varchar(255)', 'label' => 'Extraparams', 'enabled' => 1, 'visible' => -1, 'position' => 185), ); // END MODULEBUILDER PROPERTIES diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index 33ac0d8f817..7e54567fc47 100644 --- a/htdocs/compta/bank/class/paymentvarious.class.php +++ b/htdocs/compta/bank/class/paymentvarious.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -197,7 +198,7 @@ class PaymentVarious extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array fields definition + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( // TODO: fill this array @@ -744,7 +745,7 @@ class PaymentVarious extends CommonObject global $action; $hookmanager->initHooks(array('variouspayment')); - $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/compta/bank/line.php b/htdocs/compta/bank/line.php index c0cbdb0447e..6ed9e7d37a9 100644 --- a/htdocs/compta/bank/line.php +++ b/htdocs/compta/bank/line.php @@ -352,7 +352,7 @@ if ($result) { // Confirmations if ($action == 'delete_categ') { - print $form->formconfirm($_SERVER['PHP_SELF']."?rowid=".urlencode($rowid)."&cat1=".urlencode(GETPOSTINT("fk_categ"))."&orig_account=".urlencode($orig_account), $langs->trans("RemoveFromRubrique"), $langs->trans("RemoveFromRubriqueConfirm"), "confirm_delete_categ", '', 'yes', 1); + print $form->formconfirm($_SERVER['PHP_SELF']."?rowid=".urlencode((string) ($rowid))."&cat1=".urlencode((string) (GETPOSTINT("fk_categ")))."&orig_account=".urlencode((string) ($orig_account)), $langs->trans("RemoveFromRubrique"), $langs->trans("RemoveFromRubriqueConfirm"), "confirm_delete_categ", '', 'yes', 1); } print ''; diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index ef9206a74ed..480c36cd07e 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -60,7 +60,7 @@ $search_number = GETPOST('search_number', 'alpha'); $search_status = GETPOST('search_status') ? GETPOST('search_status', 'alpha') : 'opened'; // 'all' or '' means 'opened' $optioncss = GETPOST('optioncss', 'alpha'); -$search_category_list =""; +$search_category_list = ""; if (isModEnabled('category')) { $search_category_list = GETPOST("search_category_".Categorie::TYPE_ACCOUNT."_list", "array"); } @@ -101,24 +101,24 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen // List of fields to search into when doing a "search in all" $fieldstosearchall = array( - 'b.ref'=>'Ref', - 'b.label'=>'Label', + 'b.ref' => 'Ref', + 'b.label' => 'Label', ); $checkedtypetiers = 0; $arrayfields = array( - 'b.ref'=>array('label'=>$langs->trans("BankAccounts"), 'checked'=>1, 'position'=>10), - 'b.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1, 'position'=>12), - 'accountype'=>array('label'=>$langs->trans("Type"), 'checked'=>1, 'position'=>14), - 'b.number'=>array('label'=>$langs->trans("AccountIdShort"), 'checked'=>1, 'position'=>16), - 'b.account_number'=>array('label'=>$langs->trans("AccountAccounting"), 'checked'=>(isModEnabled('accounting')), 'position'=>18), - 'b.fk_accountancy_journal'=>array('label'=>$langs->trans("AccountancyJournal"), 'checked'=>(isModEnabled('accounting')), 'position'=>20), - 'toreconcile'=>array('label'=>$langs->trans("TransactionsToConciliate"), 'checked'=>1, 'position'=>50), - 'b.currency_code'=>array('label'=>$langs->trans("Currency"), 'checked'=>0, 'position'=>22), - 'b.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), - 'b.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), - 'b.clos'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), - 'balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1, 'position'=>1010), + 'b.ref' => array('label' => $langs->trans("BankAccounts"), 'checked' => 1, 'position' => 10), + 'b.label' => array('label' => $langs->trans("Label"), 'checked' => 1, 'position' => 12), + 'accountype' => array('label' => $langs->trans("Type"), 'checked' => 1, 'position' => 14), + 'b.number' => array('label' => $langs->trans("AccountIdShort"), 'checked' => 1, 'position' => 16), + 'b.account_number' => array('label' => $langs->trans("AccountAccounting"), 'checked' => (isModEnabled('accounting')), 'position' => 18), + 'b.fk_accountancy_journal' => array('label' => $langs->trans("AccountancyJournal"), 'checked' => (isModEnabled('accounting')), 'position' => 20), + 'toreconcile' => array('label' => $langs->trans("TransactionsToConciliate"), 'checked' => 1, 'position' => 50), + 'b.currency_code' => array('label' => $langs->trans("Currency"), 'checked' => 0, 'position' => 22), + 'b.datec' => array('label' => $langs->trans("DateCreation"), 'checked' => 0, 'position' => 500), + 'b.tms' => array('label' => $langs->trans("DateModificationShort"), 'checked' => 0, 'position' => 500), + 'b.clos' => array('label' => $langs->trans("Status"), 'checked' => 1, 'position' => 1000), + 'balance' => array('label' => $langs->trans("Balance"), 'checked' => 1, 'position' => 1010), ); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; @@ -150,7 +150,7 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa $massaction = ''; } -$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'); @@ -336,7 +336,7 @@ if ($search_status != '') { $param .= '&search_status='.urlencode($search_status); } if ($show_files) { - $param .= '&show_files='.urlencode($show_files); + $param .= '&show_files='.urlencode((string) ($show_files)); } // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; @@ -378,8 +378,8 @@ print ''; $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('NewFinancialAccount'), '', 'fa fa-plus-circle', 'card.php?action=create', '', $user->hasRight('banque', 'configurer')); @@ -486,7 +486,7 @@ if (!empty($arrayfields['b.currency_code']['checked'])) { 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; // Date creation @@ -503,8 +503,8 @@ if (!empty($arrayfields['b.tms']['checked'])) { if (!empty($arrayfields['b.clos']['checked'])) { print ''; $array = array( - 'opened'=>$langs->trans("Opened"), - 'closed'=>$langs->trans("Closed") + 'opened' => $langs->trans("Opened"), + 'closed' => $langs->trans("Closed") ); print $form->selectarray("search_status", $array, $search_status, 1, 0, 0, '', 0, 0, 0, '', 'search_status minwidth75 maxwidth125 onrightofpage', 1); print '
'; - print ($salaryBonPl ? $salarytmp->getNomUrl(1) : $invoicetmp->getNomUrl(1)); + print($salaryBonPl ? $salarytmp->getNomUrl(1) : $invoicetmp->getNomUrl(1)); print "
'; - if (isModEnabled("delivery_note")) { + if (isModEnabled("shipping")) { print $langs->trans("ContactForOrdersOrShipments"); } else { print $langs->trans("ContactForOrders"); } print ''; $none = $langs->trans("NoContactForAnyOrder"); - if (isModEnabled("delivery_note")) { + if (isModEnabled("shipping")) { $none = $langs->trans("NoContactForAnyOrderOrShipments"); } print $object->ref_commande ? $object->ref_commande : $none; diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 9b6752305a7..9b204deacf1 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -12,6 +12,7 @@ * Copyright (C) 2019 Nicolas ZABOURI * Copyright (C) 2020 Open-Dsi * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -97,45 +98,45 @@ class Contact extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'noteditable'=>1, 'notnull'=> 1, 'index'=>1, 'position'=>1, 'comment'=>'Id', 'css'=>'left'), - 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>3, 'notnull'=>1, 'position'=>30, 'index'=>1), - 'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>3, 'position'=>35), - 'civility' =>array('type'=>'varchar(6)', 'label'=>'Civility', 'enabled'=>1, 'visible'=>3, 'position'=>40), - 'lastname' =>array('type'=>'varchar(50)', 'label'=>'Lastname', 'enabled'=>1, 'visible'=>1, 'position'=>45, 'showoncombobox'=>1, 'searchall'=>1), - 'name_alias' =>array('type'=>'varchar(255)', 'label'=>'Name alias', 'enabled'=>1, 'visible'=>-1, 'position'=>46, 'searchall'=>1), - 'firstname' =>array('type'=>'varchar(50)', 'label'=>'Firstname', 'enabled'=>1, 'visible'=>1, 'position'=>50, 'showoncombobox'=>1, 'searchall'=>1), - 'poste' =>array('type'=>'varchar(80)', 'label'=>'PostOrFunction', 'enabled'=>1, 'visible'=>-1, 'position'=>52), - 'address' =>array('type'=>'varchar(255)', 'label'=>'Address', 'enabled'=>1, 'visible'=>-1, 'position'=>55), - 'zip' =>array('type'=>'varchar(25)', 'label'=>'Zip', 'enabled'=>1, 'visible'=>1, 'position'=>60), - 'town' =>array('type'=>'varchar(50)', 'label'=>'Town', 'enabled'=>1, 'visible'=>-1, 'position'=>65), - 'fk_departement' =>array('type'=>'integer', 'label'=>'Fk departement', 'enabled'=>1, 'visible'=>3, 'position'=>70), - 'fk_pays' =>array('type'=>'integer', 'label'=>'Fk pays', 'enabled'=>1, 'visible'=>3, 'position'=>75), - 'fk_soc' =>array('type'=>'integer', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>1, 'position'=>77, 'searchall'=>1), - 'birthday' =>array('type'=>'date', 'label'=>'Birthday', 'enabled'=>1, 'visible'=>-1, 'position'=>80), - 'phone' =>array('type'=>'varchar(30)', 'label'=>'Phone', 'enabled'=>1, 'visible'=>1, 'position'=>90, 'searchall'=>1), - 'phone_perso' =>array('type'=>'varchar(30)', 'label'=>'PhonePerso', 'enabled'=>1, 'visible'=>-1, 'position'=>95, 'searchall'=>1), - 'phone_mobile' =>array('type'=>'varchar(30)', 'label'=>'PhoneMobile', 'enabled'=>1, 'visible'=>1, 'position'=>100, 'searchall'=>1), - 'fax' =>array('type'=>'varchar(30)', 'label'=>'Fax', 'enabled'=>1, 'visible'=>-1, 'position'=>105, 'searchall'=>1), - 'email' =>array('type'=>'varchar(255)', 'label'=>'Email', 'enabled'=>1, 'visible'=>1, 'position'=>110, 'searchall'=>1), - 'socialnetworks' =>array('type'=>'text', 'label'=>'SocialNetworks', 'enabled'=>1, 'visible'=>3, 'position'=>115), - 'photo' =>array('type'=>'varchar(255)', 'label'=>'Photo', 'enabled'=>1, 'visible'=>3, 'position'=>170), - 'priv' =>array('type'=>'smallint(6)', 'label'=>'ContactVisibility', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>175), - 'fk_stcommcontact' =>array('type'=>'integer', 'label'=>'ProspectStatus', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>220), - 'fk_prospectcontactlevel' =>array('type'=>'varchar(12)', 'label'=>'ProspectLevel', 'enabled'=>1, 'visible'=>-1, 'position'=>255), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -2, 'noteditable' => 1, 'notnull' => 1, 'index' => 1, 'position' => 1, 'comment' => 'Id', 'css' => 'left'), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => 3, 'notnull' => 1, 'position' => 30, 'index' => 1), + 'ref_ext' => array('type' => 'varchar(255)', 'label' => 'Ref ext', 'enabled' => 1, 'visible' => 3, 'position' => 35), + 'civility' => array('type' => 'varchar(6)', 'label' => 'Civility', 'enabled' => 1, 'visible' => 3, 'position' => 40), + 'lastname' => array('type' => 'varchar(50)', 'label' => 'Lastname', 'enabled' => 1, 'visible' => 1, 'position' => 45, 'showoncombobox' => 1, 'searchall' => 1), + 'name_alias' => array('type' => 'varchar(255)', 'label' => 'Name alias', 'enabled' => 1, 'visible' => -1, 'position' => 46, 'searchall' => 1), + 'firstname' => array('type' => 'varchar(50)', 'label' => 'Firstname', 'enabled' => 1, 'visible' => 1, 'position' => 50, 'showoncombobox' => 1, 'searchall' => 1), + 'poste' => array('type' => 'varchar(80)', 'label' => 'PostOrFunction', 'enabled' => 1, 'visible' => -1, 'position' => 52), + 'address' => array('type' => 'varchar(255)', 'label' => 'Address', 'enabled' => 1, 'visible' => -1, 'position' => 55), + 'zip' => array('type' => 'varchar(25)', 'label' => 'Zip', 'enabled' => 1, 'visible' => 1, 'position' => 60), + 'town' => array('type' => 'varchar(50)', 'label' => 'Town', 'enabled' => 1, 'visible' => -1, 'position' => 65), + 'fk_departement' => array('type' => 'integer', 'label' => 'Fk departement', 'enabled' => 1, 'visible' => 3, 'position' => 70), + 'fk_pays' => array('type' => 'integer', 'label' => 'Fk pays', 'enabled' => 1, 'visible' => 3, 'position' => 75), + 'fk_soc' => array('type' => 'integer', 'label' => 'ThirdParty', 'enabled' => 1, 'visible' => 1, 'position' => 77, 'searchall' => 1), + 'birthday' => array('type' => 'date', 'label' => 'Birthday', 'enabled' => 1, 'visible' => -1, 'position' => 80), + 'phone' => array('type' => 'varchar(30)', 'label' => 'Phone', 'enabled' => 1, 'visible' => 1, 'position' => 90, 'searchall' => 1), + 'phone_perso' => array('type' => 'varchar(30)', 'label' => 'PhonePerso', 'enabled' => 1, 'visible' => -1, 'position' => 95, 'searchall' => 1), + 'phone_mobile' => array('type' => 'varchar(30)', 'label' => 'PhoneMobile', 'enabled' => 1, 'visible' => 1, 'position' => 100, 'searchall' => 1), + 'fax' => array('type' => 'varchar(30)', 'label' => 'Fax', 'enabled' => 1, 'visible' => -1, 'position' => 105, 'searchall' => 1), + 'email' => array('type' => 'varchar(255)', 'label' => 'Email', 'enabled' => 1, 'visible' => 1, 'position' => 110, 'searchall' => 1), + 'socialnetworks' => array('type' => 'text', 'label' => 'SocialNetworks', 'enabled' => 1, 'visible' => 3, 'position' => 115), + 'photo' => array('type' => 'varchar(255)', 'label' => 'Photo', 'enabled' => 1, 'visible' => 3, 'position' => 170), + 'priv' => array('type' => 'smallint(6)', 'label' => 'ContactVisibility', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'position' => 175), + 'fk_stcommcontact' => array('type' => 'integer', 'label' => 'ProspectStatus', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 220), + 'fk_prospectcontactlevel' => array('type' => 'varchar(12)', 'label' => 'ProspectLevel', 'enabled' => 1, 'visible' => -1, 'position' => 255), //no more used. Replace by a scan of email into mailing_unsubscribe. 'no_email' =>array('type'=>'smallint(6)', 'label'=>'No_Email', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>180), - 'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>3, 'position'=>195, 'searchall'=>1), - 'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>3, 'position'=>200, 'searchall'=>1), - 'default_lang' =>array('type'=>'varchar(6)', 'label'=>'Default lang', 'enabled'=>1, 'visible'=>3, 'position'=>205), - 'canvas' =>array('type'=>'varchar(32)', 'label'=>'Canvas', 'enabled'=>1, 'visible'=>3, 'position'=>210), - 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>300), - 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>305), - 'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>3, 'position'=>310), - 'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>3, 'position'=>315), - 'statut' =>array('type'=>'tinyint(4)', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>500), - 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-1, 'position'=>1000), + 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => 1, 'visible' => 3, 'position' => 195, 'searchall' => 1), + 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => 1, 'visible' => 3, 'position' => 200, 'searchall' => 1), + 'default_lang' => array('type' => 'varchar(6)', 'label' => 'Default lang', 'enabled' => 1, 'visible' => 3, 'position' => 205), + 'canvas' => array('type' => 'varchar(32)', 'label' => 'Canvas', 'enabled' => 1, 'visible' => 3, 'position' => 210), + 'datec' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'visible' => -1, 'position' => 300), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 305), + 'fk_user_creat' => array('type' => 'integer', 'label' => 'UserAuthor', 'enabled' => 1, 'visible' => 3, 'position' => 310), + 'fk_user_modif' => array('type' => 'integer', 'label' => 'UserModif', 'enabled' => 1, 'visible' => 3, 'position' => 315), + 'statut' => array('type' => 'tinyint(4)', 'label' => 'Status', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'position' => 500), + 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -1, 'position' => 1000), ); public $civility_id; // In fact we store civility_code @@ -1797,7 +1798,7 @@ class Contact extends CommonObject while ($obj = $this->db->fetch_object($resql)) { $transkey = "TypeContact_".$obj->element."_".$obj->source."_".$obj->code; $libelle_element = $langs->trans('ContactDefault_'.$obj->element); - $this->roles[$obj->contactroleid] = array('id'=>$obj->rowid, 'socid'=>$obj->socid, 'element'=>$obj->element, 'source'=>$obj->source, 'code'=>$obj->code, 'label'=>$libelle_element.' - '.($langs->trans($transkey) != $transkey ? $langs->trans($transkey) : $obj->label)); + $this->roles[$obj->contactroleid] = array('id' => $obj->rowid, 'socid' => $obj->socid, 'element' => $obj->element, 'source' => $obj->source, 'code' => $obj->code, 'label' => $libelle_element.' - '.($langs->trans($transkey) != $transkey ? $langs->trans($transkey) : $obj->label)); } } } else { @@ -1846,7 +1847,7 @@ class Contact extends CommonObject $i = 0; while ($i < $num) { $obj = $this->db->fetch_object($resql); - $tab[] = array('fk_socpeople'=>$obj->id, 'type_contact'=>$obj->fk_c_type_contact); + $tab[] = array('fk_socpeople' => $obj->id, 'type_contact' => $obj->fk_c_type_contact); $i++; } @@ -2178,7 +2179,7 @@ class Contact extends CommonObject $return .= ''; //var_dump($this->photo);exit; if (property_exists($this, 'photo') && !is_null($this->photo)) { - $return.= Form::showphoto('contact', $this, 0, 60, 0, 'photokanban photoref photowithmargin photologintooltip', 'small', 0, 1); + $return .= Form::showphoto('contact', $this, 0, 60, 0, 'photokanban photoref photowithmargin photologintooltip', 'small', 0, 1); } else { $return .= img_picto('', $this->picto); } diff --git a/htdocs/contact/consumption.php b/htdocs/contact/consumption.php index 67714ae131e..66067b00e6e 100644 --- a/htdocs/contact/consumption.php +++ b/htdocs/contact/consumption.php @@ -368,7 +368,7 @@ $param .= "&month=".urlencode($month); $param .= "&year=".urlencode($year); $param .= "&sprod_fulldescr=".urlencode($sprod_fulldescr); if (!empty($socid)) { - $param .= "&socid=".urlencode($socid); + $param .= "&socid=".urlencode((string) ($socid)); } $param .= "&type_element=".urlencode($type_element); @@ -382,7 +382,7 @@ if ($sql_select) { $num = $db->num_rows($resql); - $param = (!empty($socid) ? "&socid=".urlencode($socid) : "")."&type_element=".urlencode($type_element)."&id=".urlencode($id); + $param = (!empty($socid) ? "&socid=".urlencode((string) ($socid)) : "")."&type_element=".urlencode((string) ($type_element))."&id=".urlencode((string) ($id)); if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -396,10 +396,10 @@ if ($sql_select) { $param .= "&sref=".urlencode($sref); } if ($month) { - $param .= "&month=".urlencode($month); + $param .= "&month=".urlencode((string) ($month)); } if ($year) { - $param .= "&year=".urlencode($year); + $param .= "&year=".urlencode((string) ($year)); } if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 6fefaccd5cc..d391b2e8d4b 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -832,25 +832,25 @@ if ($limit > 0 && $limit != $conf->liste_limit) { if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); } -$param .= '&begin='.urlencode($begin).'&userid='.urlencode($userid).'&contactname='.urlencode($search_all); +$param .= '&begin='.urlencode((string) ($begin)).'&userid='.urlencode((string) ($userid)).'&contactname='.urlencode((string) ($search_all)); $param .= '&type='.urlencode($type).'&view='.urlencode($view); if (!empty($search_sale) && $search_sale != '-1') { $param .= '&search_sale='.urlencode($search_sale); } if (!empty($search_categ) && $search_categ != '-1') { - $param .= '&search_categ='.urlencode($search_categ); + $param .= '&search_categ='.urlencode((string) ($search_categ)); } if (!empty($search_categ_thirdparty) && $search_categ_thirdparty != '-1') { - $param .= '&search_categ_thirdparty='.urlencode($search_categ_thirdparty); + $param .= '&search_categ_thirdparty='.urlencode((string) ($search_categ_thirdparty)); } if (!empty($search_categ_supplier) && $search_categ_supplier != '-1') { - $param .= '&search_categ_supplier='.urlencode($search_categ_supplier); + $param .= '&search_categ_supplier='.urlencode((string) ($search_categ_supplier)); } if ($search_all != '') { $param .= '&search_all='.urlencode($search_all); } if ($search_id > 0) { - $param .= "&search_id=".urlencode($search_id); + $param .= "&search_id=".urlencode((string) ($search_id)); } if ($search_lastname != '') { $param .= '&search_lastname='.urlencode($search_lastname); @@ -895,16 +895,16 @@ if ($search_email != '') { $param .= '&search_email='.urlencode($search_email); } if ($search_no_email != '') { - $param .= '&search_no_email='.urlencode($search_no_email); + $param .= '&search_no_email='.urlencode((string) ($search_no_email)); } if ($search_status != '') { - $param .= '&search_status='.urlencode($search_status); + $param .= '&search_status='.urlencode((string) ($search_status)); } if ($search_priv == '0' || $search_priv == '1') { $param .= "&search_priv=".urlencode($search_priv); } if ($search_stcomm != '') { - $param .= '&search_stcomm='.urlencode($search_stcomm); + $param .= '&search_stcomm='.urlencode((string) ($search_stcomm)); } if (is_array($search_level) && count($search_level)) { foreach ($search_level as $slevel) { @@ -1688,7 +1688,7 @@ while ($i < $imaxinloop) { $titlealt = $val['label']; } if ($obj->stcomm_id != $val['id']) { - print ''.img_action($titlealt, $val['code'], $val['picto']).''; + print ''.img_action($titlealt, $val['code'], $val['picto']).''; } } print '
'; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 8139d7aa755..99662fd0273 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -243,31 +243,31 @@ class Contrat extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), - 'ref' =>array('type'=>'varchar(50)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'showoncombobox'=>1, 'position'=>15, 'searchall'=>1), - 'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>20), - 'ref_customer' =>array('type'=>'varchar(50)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>25, 'searchall'=>1), - 'ref_supplier' =>array('type'=>'varchar(50)', 'label'=>'RefSupplier', 'enabled'=>1, 'visible'=>-1, 'position'=>26, 'searchall'=>1), - 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>30, 'index'=>1), - 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35), - 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>40), - 'date_contrat' =>array('type'=>'datetime', 'label'=>'Date contrat', 'enabled'=>1, 'visible'=>-1, 'position'=>45), - 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'isModEnabled("societe")', 'visible'=>-1, 'notnull'=>1, 'position'=>70), - 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:(fk_statut:=:1)', 'label'=>'Project', 'enabled'=>"isModEnabled('project')", 'visible'=>-1, 'position'=>75), - 'fk_commercial_signature' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative Signature', 'enabled'=>1, 'visible'=>-1, 'position'=>80), - 'fk_commercial_suivi' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative follower', 'enabled'=>1, 'visible'=>-1, 'position'=>85), - 'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>90), - 'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>105, 'searchall'=>1), - 'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110, 'searchall'=>1), - 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>115), - 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>120), - 'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>125), - 'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>135), - 'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'Last main doc', 'enabled'=>1, 'visible'=>-1, 'position'=>140), - 'statut' =>array('type'=>'smallint(6)', 'label'=>'Statut', 'enabled'=>1, 'visible'=>-1, 'position'=>500, 'notnull'=>1, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 2=>'Closed')) + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), + 'ref' => array('type' => 'varchar(50)', 'label' => 'Ref', 'enabled' => 1, 'visible' => -1, 'showoncombobox' => 1, 'position' => 15, 'searchall' => 1), + 'ref_ext' => array('type' => 'varchar(255)', 'label' => 'Ref ext', 'enabled' => 1, 'visible' => 0, 'position' => 20), + 'ref_customer' => array('type' => 'varchar(50)', 'label' => 'RefCustomer', 'enabled' => 1, 'visible' => -1, 'position' => 25, 'searchall' => 1), + 'ref_supplier' => array('type' => 'varchar(50)', 'label' => 'RefSupplier', 'enabled' => 1, 'visible' => -1, 'position' => 26, 'searchall' => 1), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 30, 'index' => 1), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 35), + 'datec' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'visible' => -1, 'position' => 40), + 'date_contrat' => array('type' => 'datetime', 'label' => 'Date contrat', 'enabled' => 1, 'visible' => -1, 'position' => 45), + 'fk_soc' => array('type' => 'integer:Societe:societe/class/societe.class.php', 'label' => 'ThirdParty', 'enabled' => 'isModEnabled("societe")', 'visible' => -1, 'notnull' => 1, 'position' => 70), + 'fk_projet' => array('type' => 'integer:Project:projet/class/project.class.php:1:(fk_statut:=:1)', 'label' => 'Project', 'enabled' => "isModEnabled('project')", 'visible' => -1, 'position' => 75), + 'fk_commercial_signature' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'SaleRepresentative Signature', 'enabled' => 1, 'visible' => -1, 'position' => 80), + 'fk_commercial_suivi' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'SaleRepresentative follower', 'enabled' => 1, 'visible' => -1, 'position' => 85), + 'fk_user_author' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 90), + 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => 1, 'visible' => 0, 'position' => 105, 'searchall' => 1), + 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => 1, 'visible' => 0, 'position' => 110, 'searchall' => 1), + 'model_pdf' => array('type' => 'varchar(255)', 'label' => 'Model pdf', 'enabled' => 1, 'visible' => 0, 'position' => 115), + 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'position' => 120), + 'extraparams' => array('type' => 'varchar(255)', 'label' => 'Extraparams', 'enabled' => 1, 'visible' => -1, 'position' => 125), + 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => 1, 'visible' => -2, 'notnull' => -1, 'position' => 135), + 'last_main_doc' => array('type' => 'varchar(255)', 'label' => 'Last main doc', 'enabled' => 1, 'visible' => -1, 'position' => 140), + 'statut' => array('type' => 'smallint(6)', 'label' => 'Statut', 'enabled' => 1, 'visible' => -1, 'position' => 500, 'notnull' => 1, 'arrayofkeyval' => array(0 => 'Draft', 1 => 'Validated', 2 => 'Closed')) ); // END MODULEBUILDER PROPERTIES @@ -2154,7 +2154,7 @@ class Contrat extends CommonObject global $action; $hookmanager->initHooks(array('contractdao')); - $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; @@ -2744,7 +2744,7 @@ class Contrat extends CommonObject $error = 0; $this->output = ''; - $this->error=''; + $this->error = ''; $contractlineprocessed = array(); $contractignored = array(); @@ -2753,13 +2753,13 @@ class Contrat extends CommonObject dol_syslog(__METHOD__, LOG_DEBUG); $sql = 'SELECT c.rowid, c.ref_customer, cd.rowid as lid, cd.date_fin_validite, p.duration'; - $sql.= ' FROM '.MAIN_DB_PREFIX.'contrat as c, '.MAIN_DB_PREFIX.'contratdet as cd'; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON p.rowid = cd.fk_product'; - $sql.= ' WHERE cd.fk_contrat = c.rowid'; - $sql.= " AND date_format(cd.date_fin_validite, '%Y-%m-%d') <= date_format('".$this->db->idate($enddatetoscan)."', '%Y-%m-%d')"; - $sql.= " AND cd.statut = 4"; + $sql .= ' FROM '.MAIN_DB_PREFIX.'contrat as c, '.MAIN_DB_PREFIX.'contratdet as cd'; + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON p.rowid = cd.fk_product'; + $sql .= ' WHERE cd.fk_contrat = c.rowid'; + $sql .= " AND date_format(cd.date_fin_validite, '%Y-%m-%d') <= date_format('".$this->db->idate($enddatetoscan)."', '%Y-%m-%d')"; + $sql .= " AND cd.statut = 4"; if ($thirdparty_id > 0) { - $sql.=" AND c.fk_soc = ".((int) $thirdparty_id); + $sql .= " AND c.fk_soc = ".((int) $thirdparty_id); } //print $sql; @@ -2769,7 +2769,7 @@ class Contrat extends CommonObject include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - $i=0; + $i = 0; while ($i < $num) { $obj = $this->db->fetch_object($resql); if ($obj) { @@ -2806,7 +2806,7 @@ class Contrat extends CommonObject usort($object->linkedObjects['facture'], array('Contrat', 'contractCmpDate')); //dol_sort_array($object->linkedObjects['facture'], 'date'); - $someinvoicenotpaid=0; + $someinvoicenotpaid = 0; foreach ($object->linkedObjects['facture'] as $idinvoice => $invoice) { if ($invoice->statut == Facture::STATUS_DRAFT) { continue; @@ -2826,7 +2826,7 @@ class Contrat extends CommonObject if ($expirationdate && $expirationdate < $enddatetoscan) { dol_syslog("Define the newdate of end of services from expirationdate=".$expirationdate); $newdate = $expirationdate; - $protecti=0; //$protecti is to avoid infinite loop + $protecti = 0; //$protecti is to avoid infinite loop while ($newdate < $enddatetoscan && $protecti < 1000) { $newdate = dol_time_plus_duree($newdate, $duration_value, $duration_unit); $protecti++; @@ -2844,10 +2844,10 @@ class Contrat extends CommonObject $comment = 'Renew date of contract '.$object->ref.' line '.$obj->lid.' by doAutoRenewContracts'; $sqlupdate = 'UPDATE '.MAIN_DB_PREFIX."contratdet SET date_fin_validite = '".$this->db->idate($newdate)."'"; - $sqlupdate.= ' WHERE rowid = '.((int) $obj->lid); + $sqlupdate .= ' WHERE rowid = '.((int) $obj->lid); $resqlupdate = $this->db->query($sqlupdate); if ($resqlupdate) { - $contractlineprocessed[$obj->lid]=$object->ref; + $contractlineprocessed[$obj->lid] = $object->ref; $actioncode = 'RENEW_CONTRACT'; $now = dol_now(); @@ -2869,7 +2869,7 @@ class Contrat extends CommonObject $ret = $actioncomm->create($user); // User creating action } else { - $contracterror[$object->id]=$object->ref; + $contracterror[$object->id] = $object->ref; $error++; $errorforlocaltransaction++; @@ -2895,7 +2895,7 @@ class Contrat extends CommonObject $this->error = $this->db->lasterror(); } - $this->output .= count($contractlineprocessed).' contract line(s) with end date before '.dol_print_date($enddatetoscan, 'day').' were renewed'.(count($contractlineprocessed)>0 ? ' : '.implode(',', $contractlineprocessed) : ''); + $this->output .= count($contractlineprocessed).' contract line(s) with end date before '.dol_print_date($enddatetoscan, 'day').' were renewed'.(count($contractlineprocessed) > 0 ? ' : '.implode(',', $contractlineprocessed) : ''); return ($error ? 1 : 0); } @@ -3109,27 +3109,27 @@ class ContratLigne extends CommonObjectLine * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), - 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>30, 'index'=>1), - 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35), - 'qty' =>array('type'=>'integer', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>35, 'isameasure'=>1), - 'total_ht' =>array('type'=>'integer', 'label'=>'AmountHT', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>36, 'isameasure'=>1), - 'total_tva' =>array('type'=>'integer', 'label'=>'AmountVAT', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>37, 'isameasure'=>1), - 'total_ttc' =>array('type'=>'integer', 'label'=>'AmountTTC', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>38, 'isameasure'=>1), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 30, 'index' => 1), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 35), + 'qty' => array('type' => 'integer', 'label' => 'Quantity', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'position' => 35, 'isameasure' => 1), + 'total_ht' => array('type' => 'integer', 'label' => 'AmountHT', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 36, 'isameasure' => 1), + 'total_tva' => array('type' => 'integer', 'label' => 'AmountVAT', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 37, 'isameasure' => 1), + 'total_ttc' => array('type' => 'integer', 'label' => 'AmountTTC', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 38, 'isameasure' => 1), //'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>40), //'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>70), - 'fk_contrat' =>array('type'=>'integer:Contrat:contrat/class/contrat.class.php', 'label'=>'Contract', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>70), - 'fk_product' =>array('type'=>'integer:Product:product/class/product.class.php:1', 'label'=>'Product', 'enabled'=>1, 'visible'=>-1, 'position'=>75), + 'fk_contrat' => array('type' => 'integer:Contrat:contrat/class/contrat.class.php', 'label' => 'Contract', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 70), + 'fk_product' => array('type' => 'integer:Product:product/class/product.class.php:1', 'label' => 'Product', 'enabled' => 1, 'visible' => -1, 'position' => 75), //'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>90), - 'note_private' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>105), - 'note_public' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110), + 'note_private' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => 1, 'visible' => 0, 'position' => 105), + 'note_public' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => 1, 'visible' => 0, 'position' => 110), //'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>115), //'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>120), //'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>125), - 'fk_user_ouverture' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserStartingService', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>135), - 'fk_user_cloture' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserClosingService', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>135), - 'statut' =>array('type'=>'smallint(6)', 'label'=>'Statut', 'enabled'=>1, 'visible'=>-1, 'position'=>500, 'arrayofkeyval'=>array(0=>'Draft', 4=>'Open', 5=>'Closed')), - 'rang' =>array('type'=>'integer', 'label'=>'Rank', 'enabled'=>1, 'visible'=>0, 'position'=>500, 'default' =>0) + 'fk_user_ouverture' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserStartingService', 'enabled' => 1, 'visible' => -2, 'notnull' => -1, 'position' => 135), + 'fk_user_cloture' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserClosingService', 'enabled' => 1, 'visible' => -2, 'notnull' => -1, 'position' => 135), + 'statut' => array('type' => 'smallint(6)', 'label' => 'Statut', 'enabled' => 1, 'visible' => -1, 'position' => 500, 'arrayofkeyval' => array(0 => 'Draft', 4 => 'Open', 5 => 'Closed')), + 'rang' => array('type' => 'integer', 'label' => 'Rank', 'enabled' => 1, 'visible' => 0, 'position' => 500, 'default' => 0) ); // END MODULEBUILDER PROPERTIES @@ -3200,7 +3200,7 @@ class ContratLigne extends CommonObjectLine $params = array(); $reg = array(); if (preg_match('/class="(.*)"/', $moreatt, $reg)) { - $params = array('badgeParams'=>array('css' => $reg[1])); + $params = array('badgeParams' => array('css' => $reg[1])); } return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode, '', $params); } diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index a8704ff8da3..a9c49bbeaab 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -626,94 +626,94 @@ if ($search_op2df != '') { $param .= '&search_op2df='.urlencode($search_op2df); } if ($search_date_creation_startmonth) { - $param .= '&search_date_creation_startmonth='.urlencode($search_date_creation_startmonth); + $param .= '&search_date_creation_startmonth='.urlencode((string) ($search_date_creation_startmonth)); } if ($search_date_creation_startyear) { - $param .= '&search_date_creation_startyear='.urlencode($search_date_creation_startyear); + $param .= '&search_date_creation_startyear='.urlencode((string) ($search_date_creation_startyear)); } if ($search_date_creation_startday) { - $param .= '&search_date_creation_startday='.urlencode($search_date_creation_startday); + $param .= '&search_date_creation_startday='.urlencode((string) ($search_date_creation_startday)); } if ($search_date_creation_start) { $param .= '&search_date_creation_start='.urlencode($search_date_creation_start); } if ($search_date_creation_endmonth) { - $param .= '&search_date_creation_endmonth='.urlencode($search_date_creation_endmonth); + $param .= '&search_date_creation_endmonth='.urlencode((string) ($search_date_creation_endmonth)); } if ($search_date_creation_endyear) { - $param .= '&search_date_creation_endyear='.urlencode($search_date_creation_endyear); + $param .= '&search_date_creation_endyear='.urlencode((string) ($search_date_creation_endyear)); } if ($search_date_creation_endday) { - $param .= '&search_date_creation_endday='.urlencode($search_date_creation_endday); + $param .= '&search_date_creation_endday='.urlencode((string) ($search_date_creation_endday)); } if ($search_date_creation_end) { $param .= '&search_date_creation_end='.urlencode($search_date_creation_end); } if ($search_date_modif_startmonth) { - $param .= '&search_date_modif_startmonth='.urlencode($search_date_modif_startmonth); + $param .= '&search_date_modif_startmonth='.urlencode((string) ($search_date_modif_startmonth)); } if ($search_date_modif_startyear) { - $param .= '&search_date_modif_startyear='.urlencode($search_date_modif_startyear); + $param .= '&search_date_modif_startyear='.urlencode((string) ($search_date_modif_startyear)); } if ($search_date_modif_startday) { - $param .= '&search_date_modif_startday='.urlencode($search_date_modif_startday); + $param .= '&search_date_modif_startday='.urlencode((string) ($search_date_modif_startday)); } if ($search_date_modif_start) { $param .= '&search_date_modif_start='.urlencode($search_date_modif_start); } if ($search_date_modif_endmonth) { - $param .= '&search_date_modif_endmonth='.urlencode($search_date_modif_endmonth); + $param .= '&search_date_modif_endmonth='.urlencode((string) ($search_date_modif_endmonth)); } if ($search_date_modif_endyear) { - $param .= '&search_date_modif_endyear='.urlencode($search_date_modif_endyear); + $param .= '&search_date_modif_endyear='.urlencode((string) ($search_date_modif_endyear)); } if ($search_date_modif_endday) { - $param .= '&search_date_modif_endday='.urlencode($search_date_modif_endday); + $param .= '&search_date_modif_endday='.urlencode((string) ($search_date_modif_endday)); } if ($search_date_modif_end) { $param .= '&search_date_modif_end=' . urlencode($search_date_modif_end); } if ($search_date_startday > 0) { - $param .= '&search_date_startday='.urlencode($search_date_startday); + $param .= '&search_date_startday='.urlencode((string) ($search_date_startday)); } if ($search_date_startmonth > 0) { - $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); + $param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth)); } if ($search_date_startyear > 0) { - $param .= '&search_date_startyear='.urlencode($search_date_startyear); + $param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear)); } if ($search_date_endday > 0) { - $param .= '&search_date_endday='.urlencode($search_date_endday); + $param .= '&search_date_endday='.urlencode((string) ($search_date_endday)); } if ($search_date_endmonth > 0) { - $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + $param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth)); } if ($search_date_endyear > 0) { - $param .= '&search_date_endyear='.urlencode($search_date_endyear); + $param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear)); } if ($search_dfyear > 0) { - $param .= '&search_dfyear='.urlencode($search_dfyear); + $param .= '&search_dfyear='.urlencode((string) ($search_dfyear)); } if ($search_dfmonth > 0) { - $param .= '&search_dfmonth='.urlencode($search_dfmonth); + $param .= '&search_dfmonth='.urlencode((string) ($search_dfmonth)); } if ($search_sale > 0) { $param .= '&search_sale='.urlencode($search_sale); } if ($search_user > 0) { - $param .= '&search_user='.urlencode($search_user); + $param .= '&search_user='.urlencode((string) ($search_user)); } if ($search_type_thirdparty > 0) { - $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty); + $param .= '&search_type_thirdparty='.urlencode((string) ($search_type_thirdparty)); } if ($search_country != '') { $param .= "&search_country=".urlencode($search_country); } if ($search_product_category > 0) { - $param .= '&search_product_category='.urlencode($search_product_category); + $param .= '&search_product_category='.urlencode((string) ($search_product_category)); } if ($show_files) { - $param .= '&show_files='.urlencode($show_files); + $param .= '&show_files='.urlencode((string) ($show_files)); } if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); diff --git a/htdocs/contrat/messaging.php b/htdocs/contrat/messaging.php index f7e1b285291..8f3e5fac95e 100644 --- a/htdocs/contrat/messaging.php +++ b/htdocs/contrat/messaging.php @@ -37,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; // Load translation files required by the page $langs->loadLangs(array('agenda', 'contrat', 'companies')); -$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'contratagenda'; +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'contratagenda'; if (GETPOST('actioncode', 'array')) { $actioncode = GETPOST('actioncode', 'array', 3); @@ -45,7 +45,7 @@ if (GETPOST('actioncode', 'array')) { $actioncode = '0'; } } else { - $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT')); + $actioncode = GETPOST("actioncode", "alpha", 3) ? GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT')); } $search_rowid = GETPOST('search_rowid'); @@ -56,7 +56,7 @@ $confirm = GETPOST('confirm', 'alpha'); $id = GETPOSTINT('id'); $ref = GETPOST('ref', 'alpha'); -$limit = GETPOSTINT('limit') ?GETPOSTINT('limit') : $conf->liste_limit; +$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); @@ -101,7 +101,7 @@ if (!$user->hasRight('contrat', 'lire')) { /* * Actions */ -$parameters = array('id'=>$id); +$parameters = array('id' => $id); $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'); @@ -241,7 +241,7 @@ if (isModEnabled('agenda')) { if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { print '
'; - $param = '&id='.urlencode($id); + $param = '&id='.urlencode((string) ($id)); if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -254,9 +254,9 @@ if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $cachekey = 'count_events_thirdparty_'.$object->id; $nbEvent = dol_getcache($cachekey); - $titlelist = $langs->trans("ActionsOnCompany").(is_numeric($nbEvent) ? '('.$nbEvent.')': ''); + $titlelist = $langs->trans("ActionsOnCompany").(is_numeric($nbEvent) ? '('.$nbEvent.')' : ''); if (!empty($conf->dol_optimize_smallscreen)) { - $titlelist = $langs->trans("Actions").(is_numeric($nbEvent) ? '('.$nbEvent.')': ''); + $titlelist = $langs->trans("Actions").(is_numeric($nbEvent) ? '('.$nbEvent.')' : ''); } print_barre_liste($titlelist, 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 0); diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index 48ee32f5de2..3fbd13840c2 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -321,7 +321,7 @@ if ($type == 'directory') { $param .= '&website='.urlencode(GETPOST('website', 'alpha')); } if (!preg_match('/pageid=/', $param)) { - $param .= '&pageid='.urlencode(GETPOSTINT('pageid')); + $param .= '&pageid='.urlencode((string) (GETPOSTINT('pageid'))); } //if (!preg_match('/backtopage=/',$param)) $param.='&backtopage='.urlencode($_SERVER["PHP_SELF"].'?file_manager=1&website='.$websitekey.'&pageid='.$pageid); } diff --git a/htdocs/core/ajax/onlineSign.php b/htdocs/core/ajax/onlineSign.php index 996f7be806d..de58f75c303 100644 --- a/htdocs/core/ajax/onlineSign.php +++ b/htdocs/core/ajax/onlineSign.php @@ -1,4 +1,6 @@ + */ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -580,18 +582,15 @@ if ($action == "importSignature") { $classname = 'pdf_' . $last_modelpdf; break; } - if ($filefound) { - break; - } } - if (!$filefound) { + if ($filefound === '') { $response = $langs->trans("Error") . ' Failed to load doc generator with modelpaths=' . $modelpath . ' - modele=' . $last_modelpdf; dol_syslog($response, LOG_ERR); $error++; } - if (!$error) { + if (!$error && $classname !== '') { // If PDF template class was found require_once $file; diff --git a/htdocs/core/ajax/selectsearchbox.php b/htdocs/core/ajax/selectsearchbox.php index 00a86ccd9a9..f1d63188307 100644 --- a/htdocs/core/ajax/selectsearchbox.php +++ b/htdocs/core/ajax/selectsearchbox.php @@ -106,7 +106,7 @@ if (isModEnabled('propal') && !getDolGlobalString('MAIN_SEARCHFORM_CUSTOMER_PROP if (isModEnabled('order') && !getDolGlobalString('MAIN_SEARCHFORM_CUSTOMER_ORDER_DISABLED') && $user->hasRight('commande', 'lire')) { $arrayresult['searchintoorder'] = array('position' => 70, 'img' => 'object_order', 'label' => $langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'text' => img_picto('', 'object_order', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'url' => DOL_URL_ROOT.'/commande/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } -if (isModEnabled('delivery_note') && !getDolGlobalString('MAIN_SEARCHFORM_CUSTOMER_SHIPMENT_DISABLED') && $user->hasRight('expedition', 'lire')) { +if (isModEnabled('shipping') && !getDolGlobalString('MAIN_SEARCHFORM_CUSTOMER_SHIPMENT_DISABLED') && $user->hasRight('expedition', 'lire')) { $arrayresult['searchintoshipment'] = array('position' => 80, 'img' => 'object_shipment', 'label' => $langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'text' => img_picto('', 'object_shipment', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'url' => DOL_URL_ROOT.'/expedition/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } if (isModEnabled('invoice') && !getDolGlobalString('MAIN_SEARCHFORM_CUSTOMER_INVOICE_DISABLED') && $user->hasRight('facture', 'lire')) { diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index e782e83f662..2bd85fa349e 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -7,6 +7,7 @@ * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2019-2023 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -274,7 +275,7 @@ class CMailFile // This converts an embed file with src="/viewimage.php?modulepart... into a cid link // TODO Exclude viewimage used for the read tracker ? $findimg = $this->findHtmlImages($dolibarr_main_data_root.'/medias'); - if ($findimg<0) { + if ($findimg < 0) { dol_syslog("CMailFile::CMailfile: Error on findHtmlImages"); $this->error = 'ErrorInAddAttachementsImageBaseOnMedia'; return; @@ -285,7 +286,7 @@ class CMailFile // Search into the body for error = 'ErrorInAddAttachementsImageBaseOnMedia'; return; @@ -388,7 +389,7 @@ class CMailFile $addr_cc = implode(',', $tabcc); //Verify for $addr_bcc - $replacebcc= false; + $replacebcc = false; $tabbcc = explode(',', $addr_bcc); foreach ($tabbcc as $key => $bcc) { if (in_array($bcc, $tabbcc)) { @@ -730,7 +731,7 @@ class CMailFile /** * Send mail that was prepared by constructor. * - * @return boolean True if mail sent, false otherwise + * @return int|bool|string True if mail sent, false otherwise. Negative int if error in hook. String if incorrect send mode. */ public function sendfile() { @@ -755,7 +756,7 @@ class CMailFile $this->error = "Error in hook maildao sendMail ".$reshook; dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR); - return $reshook; + return false; } if ($reshook == 1) { // Hook replace standard code return true; @@ -1283,7 +1284,8 @@ class CMailFile // Send mail method not correctly defined // -------------------------------------- - return 'Bad value for sendmode'; + $this->error = 'Bad value for sendmode'; + return false; } // Now we delete image files that were created dynamically to manage data inline files @@ -1300,7 +1302,7 @@ class CMailFile $this->error = "Error in hook maildao sendMailAfter ".$reshook; dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR); - return $reshook; + return false; } } else { $this->error = 'No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS'; diff --git a/htdocs/core/class/commonnumrefgenerator.class.php b/htdocs/core/class/commonnumrefgenerator.class.php index c4edb202031..60104d09cd7 100644 --- a/htdocs/core/class/commonnumrefgenerator.class.php +++ b/htdocs/core/class/commonnumrefgenerator.class.php @@ -132,7 +132,7 @@ abstract class CommonNumRefGenerator * Checks if the numbers already in the database do not * cause conflicts that would prevent this numbering working. * - * @param Object $object Object we need next value for + * @param CommonObject $object Object we need next value for * @return boolean false if conflict, true if ok */ public function canBeActivated($object) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index a693c31ff2d..d7c2f99e635 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -140,7 +140,7 @@ abstract class CommonObject /** - * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array(); @@ -781,9 +781,9 @@ abstract class CommonObject protected $childtables = array(); /** - * @var array List of child tables. To know object to delete on cascade. - * If name is like '@ClassName:FilePathClass:ParentFkFieldName', it will - * call method deleteByParentField(parentId, ParentFkFieldName) to fetch and delete child object. + * @var string[] List of child tables. To know object to delete on cascade. + * If name is like '@ClassName:FilePathClass:ParentFkFieldName', it will + * call method deleteByParentField(parentId, ParentFkFieldName) to fetch and delete child object. */ protected $childtablesoncascade = array(); @@ -1659,8 +1659,6 @@ abstract class CommonObject $modulename = 'agenda'; } elseif (strpos($obj->element, 'supplier') !== false && $obj->element != 'supplier_proposal') { $modulename = 'fournisseur'; - } elseif (strpos($obj->element, 'supplier') !== false && $obj->element != 'supplier_proposal') { - $modulename = 'fournisseur'; } if (!empty($conf->{$modulename}->enabled)) { $libelle_element = $langs->trans('ContactDefault_'.$obj->element); @@ -4224,7 +4222,7 @@ abstract class CommonObject } elseif ($objecttype == 'delivery') { $classpath = 'delivery/class'; $subelement = 'delivery'; - $module = 'delivery_note'; + $module = 'shipping'; } elseif ($objecttype == 'invoice_supplier' || $objecttype == 'order_supplier') { $classpath = 'fourn/class'; $module = 'fournisseur'; @@ -5705,7 +5703,7 @@ abstract class CommonObject } } - if (!$filefound) { + if ($filefound === '' || $classname === '') { $this->error = $langs->trans("Error").' Failed to load doc generator with modelpaths='.$modelspath.' - modele='.$modele; $this->errors[] = $this->error; dol_syslog($this->error, LOG_ERR); @@ -8006,7 +8004,11 @@ abstract class CommonObject if (!empty($value)) { $checked = ' checked '; } - $value = ''; + if (getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER') < 2) { + $value = ''; + } else { + $value = yn($value ? 1 : 0); + } } elseif ($type == 'mail' || $type == 'email') { $value = dol_print_email($value, 0, 0, 0, 64, 1, 1); } elseif ($type == 'url') { diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 647354ef247..a8148548443 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -41,9 +41,14 @@ class Conf extends stdClass */ public $db; - //! To store properties found into database + /** + * @var Object To store global setup found into database + */ public $global; - //! To store browser info (->name, ->os, ->version, ->ua, ->layout, ...) + + /** + * @var Object To store browser info (->name, ->os, ->version, ->ua, ->layout, ...) + */ public $browser; //! To store some setup of generic modules diff --git a/htdocs/core/class/defaultvalues.class.php b/htdocs/core/class/defaultvalues.class.php index cdb14b5bd5a..de216b0c47c 100644 --- a/htdocs/core/class/defaultvalues.class.php +++ b/htdocs/core/class/defaultvalues.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2021 Florian HENRY * Copyright (C) 2021-2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -86,7 +87,7 @@ class DefaultValues extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), diff --git a/htdocs/core/class/emailsenderprofile.class.php b/htdocs/core/class/emailsenderprofile.class.php index 00a8d800251..d9f8aa251cc 100644 --- a/htdocs/core/class/emailsenderprofile.class.php +++ b/htdocs/core/class/emailsenderprofile.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2015 Florian Henry * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -88,19 +89,19 @@ class EmailSenderProfile extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>-1, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>'Id',), - 'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>-1, 'enabled'=>1, 'position'=>20, 'notnull'=>1, 'index'=>1,), - 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>1), - 'email' => array('type'=>'varchar(255)', 'label'=>'Email', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1), - 'private' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'User', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'default'=>'0', 'notnull'=>1), - 'signature' => array('type'=>'html', 'label'=>'Signature', 'visible'=>3, 'enabled'=>1, 'position'=>400, 'notnull'=>-1, 'index'=>1,), - 'position' => array('type'=>'integer', 'label'=>'Position', 'visible'=>1, 'enabled'=>1, 'position'=>405, 'notnull'=>-1, 'index'=>1,), - 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,), - 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,), - 'active' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'default'=>1, 'position'=>1000, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array(0=>'Disabled', 1=>'Enabled')), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'visible' => -1, 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'index' => 1, 'comment' => 'Id',), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'visible' => -1, 'enabled' => 1, 'position' => 20, 'notnull' => 1, 'index' => 1,), + 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'visible' => 1, 'enabled' => 1, 'position' => 30, 'notnull' => 1), + 'email' => array('type' => 'varchar(255)', 'label' => 'Email', 'visible' => 1, 'enabled' => 1, 'position' => 40, 'notnull' => -1), + 'private' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'User', 'visible' => 1, 'enabled' => 1, 'position' => 50, 'default' => '0', 'notnull' => 1), + 'signature' => array('type' => 'html', 'label' => 'Signature', 'visible' => 3, 'enabled' => 1, 'position' => 400, 'notnull' => -1, 'index' => 1,), + 'position' => array('type' => 'integer', 'label' => 'Position', 'visible' => 1, 'enabled' => 1, 'position' => 405, 'notnull' => -1, 'index' => 1,), + 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'visible' => -1, 'enabled' => 1, 'position' => 500, 'notnull' => 1,), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'visible' => -1, 'enabled' => 1, 'position' => 500, 'notnull' => 1,), + 'active' => array('type' => 'integer', 'label' => 'Status', 'visible' => 1, 'enabled' => 1, 'default' => 1, 'position' => 1000, 'notnull' => 1, 'index' => 1, 'arrayofkeyval' => array(0 => 'Disabled', 1 => 'Enabled')), ); /** diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index f849094195b..9a8e1ea8a0f 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1121,7 +1121,6 @@ class ExtraFields } else { $checked = ' value="1" '; } - $out = ''; } else { $out = $form->selectyesno($keyprefix.$key.$keysuffix, $value, 1, false, 1); @@ -1691,7 +1690,11 @@ class ExtraFields if (!empty($value)) { $checked = ' checked '; } - $value = ''; + if (getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER') < 2) { + $value = ''; + } else { + $value = yn($value ? 1 : 0); + } } elseif ($type == 'mail') { $value = dol_print_email($value, 0, 0, 0, 64, 1, 1); } elseif ($type == 'ip') { diff --git a/htdocs/core/class/fileupload.class.php b/htdocs/core/class/fileupload.class.php index 290a75738e0..686bc3566d0 100644 --- a/htdocs/core/class/fileupload.class.php +++ b/htdocs/core/class/fileupload.class.php @@ -197,7 +197,7 @@ class FileUpload */ protected function setFileDeleteUrl($file) { - $file->delete_url = $this->options['script_url'].'?file='.urlencode($file->name).'&fk_element='.urlencode($this->fk_element).'&element='.urlencode($this->element); + $file->delete_url = $this->options['script_url'].'?file='.urlencode((string) ($file->name)).'&fk_element='.urlencode((string) ($this->fk_element)).'&element='.urlencode((string) ($this->element)); $file->delete_type = $this->options['delete_type']; if ($file->delete_type !== 'DELETE') { $file->delete_url .= '&_method=DELETE'; diff --git a/htdocs/core/class/fiscalyear.class.php b/htdocs/core/class/fiscalyear.class.php index c1592b01db3..4b6f6f60939 100644 --- a/htdocs/core/class/fiscalyear.class.php +++ b/htdocs/core/class/fiscalyear.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2014-2020 Alexandre Spangaro * Copyright (C) 2020 OScss-Shop * Copyright (C) 2023-2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -331,7 +332,7 @@ class Fiscalyear extends CommonObject $params = [ 'id' => $this->id, 'objecttype' => $this->element, - 'option', $option, + 'option' => $option, 'nofetch' => 1, ]; $classfortooltip = 'classfortooltip'; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 51324da5753..a7905a1b346 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1343,7 +1343,7 @@ class Form } // mode 1 - $urloption = 'htmlname=' . urlencode(str_replace('.', '_', $htmlname)) . '&outjson=1&filter=' . urlencode($filter) . (empty($excludeids) ? '' : '&excludeids=' . implode(',', $excludeids)) . ($showtype ? '&showtype=' . urlencode($showtype) : '') . ($showcode ? '&showcode=' . urlencode($showcode) : ''); + $urloption = 'htmlname=' . urlencode((string) (str_replace('.', '_', $htmlname))) . '&outjson=1&filter=' . urlencode((string) ($filter)) . (empty($excludeids) ? '' : '&excludeids=' . implode(',', $excludeids)) . ($showtype ? '&showtype=' . urlencode((string) ($showtype)) : '') . ($showcode ? '&showcode=' . urlencode((string) ($showcode)) : ''); $out .= ''; if (empty($hidelabel)) { @@ -9181,7 +9181,7 @@ class Form } } elseif ($objecttype == 'shipping' || $objecttype == 'shipment' || $objecttype == 'expedition') { $tplpath = 'expedition'; - if (!isModEnabled('delivery_note')) { + if (!isModEnabled('shipping')) { continue; // Do not show if module disabled } } elseif ($objecttype == 'reception') { @@ -9191,8 +9191,8 @@ class Form } } elseif ($objecttype == 'delivery') { $tplpath = 'delivery'; - if (!isModEnabled('delivery_note')) { - continue; // Do not show if module disabled + if (!getDolGlobalInt('MAIN_SUBMODULE_DELIVERY')) { + continue; // Do not show if sub module disabled } } elseif ($objecttype == 'ficheinter') { $tplpath = 'fichinter'; @@ -9298,7 +9298,7 @@ class Form 'label' => 'LinkToProposal', 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('propal') . ')'), 'shipping' => array( - 'enabled' => isModEnabled('delivery_note'), + 'enabled' => isModEnabled('shipping'), 'perms' => 1, 'label' => 'LinkToExpedition', 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "expedition as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('shipping') . ')'), @@ -9681,8 +9681,8 @@ class Form $stringforfirstkey .= ' CTL +'; } - $previous_ref = $object->ref_previous ? '
' : ''; - $next_ref = $object->ref_next ? '' : ''; + $previous_ref = $object->ref_previous ? '' : ''; + $next_ref = $object->ref_next ? '' : ''; } //print "xx".$previous_ref."x".$next_ref; @@ -9696,8 +9696,8 @@ class Form if ($previous_ref || $next_ref || $morehtml) { $ret .= '
'.$langs->trans("Employee").''; - print 'employee ? ' checked="checked"' : '').'>'; - //print yn($object->employee); + if (getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER') < 2) { + print 'employee ? ' checked="checked"' : '').'>'; + } else { + print yn($object->employee); + } print '
'; diff --git a/htdocs/variants/class/ProductAttribute.class.php b/htdocs/variants/class/ProductAttribute.class.php index f0014a0a7ab..b4c16a23b95 100644 --- a/htdocs/variants/class/ProductAttribute.class.php +++ b/htdocs/variants/class/ProductAttribute.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2016 Marcos García * Copyright (C) 2022 Open-Dsi * Copyright (C) 2023 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -97,14 +98,14 @@ class ProductAttribute extends CommonObject * Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor. */ /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ - public $fields=array( - 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), - 'ref' => array('type'=>'varchar(255)', 'label'=>'Ref', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'css'=>'width200'), - 'ref_ext' => array('type' => 'varchar(255)', 'label' => 'ExternalRef', 'enabled' => 1, 'visible' => 0, 'position' => 20, 'searchall'=>1), - 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'help'=>"", 'showoncombobox'=>'1',), - 'position' => array('type'=>'integer', 'label'=>'Rank', 'enabled'=>1, 'visible'=>0, 'default'=>0, 'position'=>40, 'notnull'=>1,), + public $fields = array( + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'css' => 'left', 'comment' => "Id"), + 'ref' => array('type' => 'varchar(255)', 'label' => 'Ref', 'visible' => 1, 'enabled' => 1, 'position' => 10, 'notnull' => 1, 'index' => 1, 'searchall' => 1, 'comment' => "Reference of object", 'css' => 'width200'), + 'ref_ext' => array('type' => 'varchar(255)', 'label' => 'ExternalRef', 'enabled' => 1, 'visible' => 0, 'position' => 20, 'searchall' => 1), + 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => '1', 'position' => 30, 'notnull' => 1, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'help' => "", 'showoncombobox' => '1',), + 'position' => array('type' => 'integer', 'label' => 'Rank', 'enabled' => 1, 'visible' => 0, 'default' => 0, 'position' => 40, 'notnull' => 1,), ); /** diff --git a/htdocs/variants/class/ProductAttributeValue.class.php b/htdocs/variants/class/ProductAttributeValue.class.php index 7636df31290..4b04d46a375 100644 --- a/htdocs/variants/class/ProductAttributeValue.class.php +++ b/htdocs/variants/class/ProductAttributeValue.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2022 Open-Dsi + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -75,14 +76,14 @@ class ProductAttributeValue extends CommonObjectLine * Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor. */ /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ - public $fields=array( - 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), - 'fk_product_attribute' => array('type'=>'integer:ProductAttribute:variants/class/ProductAttribute.class.php', 'label'=>'ProductAttribute', 'enabled'=>1, 'visible'=>0, 'position'=>10, 'notnull'=>1, 'index'=>1,), - 'ref' => array('type'=>'varchar(255)', 'label'=>'Ref', 'visible'=>1, 'enabled'=>1, 'position'=>20, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'css'=>''), - 'value' => array('type'=>'varchar(255)', 'label'=>'Value', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'help'=>"", 'showoncombobox'=>'1',), - 'position' => array('type'=>'integer', 'label'=>'Rank', 'enabled'=>1, 'visible'=>0, 'default'=>0, 'position'=>200, 'notnull'=>1,), + public $fields = array( + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'css' => 'left', 'comment' => "Id"), + 'fk_product_attribute' => array('type' => 'integer:ProductAttribute:variants/class/ProductAttribute.class.php', 'label' => 'ProductAttribute', 'enabled' => 1, 'visible' => 0, 'position' => 10, 'notnull' => 1, 'index' => 1,), + 'ref' => array('type' => 'varchar(255)', 'label' => 'Ref', 'visible' => 1, 'enabled' => 1, 'position' => 20, 'notnull' => 1, 'index' => 1, 'searchall' => 1, 'comment' => "Reference of object", 'css' => ''), + 'value' => array('type' => 'varchar(255)', 'label' => 'Value', 'enabled' => '1', 'position' => 30, 'notnull' => 1, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'help' => "", 'showoncombobox' => '1',), + 'position' => array('type' => 'integer', 'label' => 'Rank', 'enabled' => 1, 'visible' => 0, 'default' => 0, 'position' => 200, 'notnull' => 1,), ); public $id; public $fk_product_attribute; diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index e34cf104d40..905e915dfbb 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -117,7 +117,7 @@ if ($action == 'create' && GETPOST('selectvariant', 'alpha')) { // We click on s $action = 'add'; $attribute_id = GETPOSTINT('attribute'); $attribute_value_id = GETPOSTINT('value'); - if ($attribute_id> 0 && $attribute_value_id > 0) { + if ($attribute_id > 0 && $attribute_value_id > 0) { $feature = $attribute_id . '-' . $attribute_value_id; $selectedvariant[$feature] = $feature; $_SESSION['addvariant_'.$object->id] = $selectedvariant; @@ -792,11 +792,11 @@ if (!empty($id) || !empty($ref)) { $prodstatic->fetch($prodcomb->fk_product_child); print $form->formconfirm( - "combinations.php?id=".urlencode($id)."&valueid=".urlencode($valueid), + "combinations.php?id=".urlencode((string) ($id))."&valueid=".urlencode((string) ($valueid)), $langs->trans('Delete'), $langs->trans('ProductCombinationDeleteDialog', $prodstatic->ref), "confirm_deletecombination", - array(array('label'=> $langs->trans('DeleteLinkedProduct'), 'type'=> 'checkbox', 'name' => 'delete_product', 'value' => false)), + array(array('label' => $langs->trans('DeleteLinkedProduct'), 'type' => 'checkbox', 'name' => 'delete_product', 'value' => false)), 0, 1 ); diff --git a/htdocs/webhook/class/target.class.php b/htdocs/webhook/class/target.class.php index 484991e1dc7..011b8b31606 100644 --- a/htdocs/webhook/class/target.class.php +++ b/htdocs/webhook/class/target.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2017 Laurent Destailleur * Copyright (C) ---Put here your own copyright and developer email--- * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -100,7 +101,7 @@ class Target extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'css' => 'left', 'comment' => "Id"), diff --git a/htdocs/webportal/admin/setup.php b/htdocs/webportal/admin/setup.php index 48a3f73e2a4..7680e08cd9a 100644 --- a/htdocs/webportal/admin/setup.php +++ b/htdocs/webportal/admin/setup.php @@ -1,6 +1,7 @@ * Copyright (C) 2023-2024 Lionel Vessiller + * Copyright (C) 2024 MDW * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -146,18 +147,16 @@ if ($action == 'updateMask') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir . "core/modules/webportal/doc/pdf_" . $modele . "_" . strtolower($tmpobjectkey) . ".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_" . $modele . "_" . strtolower($tmpobjectkey); break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); diff --git a/htdocs/webportal/class/webportalinvoice.class.php b/htdocs/webportal/class/webportalinvoice.class.php index e120979aaa9..5212a7e433f 100644 --- a/htdocs/webportal/class/webportalinvoice.class.php +++ b/htdocs/webportal/class/webportalinvoice.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2023-2024 Lionel Vessiller + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -96,11 +97,11 @@ class WebPortalInvoice extends Facture // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'position' => 1,), - 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'position' => 20, 'index' => 1,), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => '1', 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'position' => 20, 'index' => 1,), 'ref' => array('type' => 'varchar(30)', 'label' => 'Ref', 'enabled' => 1, 'visible' => 2, 'notnull' => 1, 'showoncombobox' => 1, 'position' => 5,), 'type' => array('type' => 'smallint(6)', 'label' => 'Type', 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'position' => 15,), 'datef' => array('type' => 'date', 'label' => 'DateInvoice', 'enabled' => 1, 'visible' => 2, 'position' => 20,), diff --git a/htdocs/webportal/class/webportalmember.class.php b/htdocs/webportal/class/webportalmember.class.php index 093703df8c7..d09568cf5f5 100644 --- a/htdocs/webportal/class/webportalmember.class.php +++ b/htdocs/webportal/class/webportalmember.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2023-2024 Lionel Vessiller + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -112,7 +113,7 @@ class WebPortalMember extends Adherent // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'position' => 10,), diff --git a/htdocs/webportal/class/webportalorder.class.php b/htdocs/webportal/class/webportalorder.class.php index 12b1586e4c3..a1ca6bd5270 100644 --- a/htdocs/webportal/class/webportalorder.class.php +++ b/htdocs/webportal/class/webportalorder.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2023-2024 Lionel Vessiller + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -97,7 +98,7 @@ class WebPortalOrder extends Commande // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'position' => 10,), diff --git a/htdocs/webportal/class/webportalpartnership.class.php b/htdocs/webportal/class/webportalpartnership.class.php index ffb32ec6dfc..7a0146072dd 100644 --- a/htdocs/webportal/class/webportalpartnership.class.php +++ b/htdocs/webportal/class/webportalpartnership.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2023-2024 Lionel Vessiller + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -96,33 +97,33 @@ class WebPortalPartnership extends Partnership // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'css' => 'left', 'comment' => "Id",), - 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => '1', 'position' => 10, 'notnull' => 1, 'visible' => 5, 'noteditable' => '1', 'default' => '(PROV)', 'index' => 1, 'searchall' => 1, 'showoncombobox' => '1', 'comment' => "Reference of object", 'showonheader' => 1,), - 'entity' => array('type' => 'integer', 'label' => 'Entity', 'enabled' => '1', 'position' => 15, 'notnull' => 1, 'visible' => -2, 'default' => '1', 'index' => 1,), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'css' => 'left', 'comment' => "Id",), + 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => 1, 'position' => 10, 'notnull' => 1, 'visible' => 5, 'noteditable' => '1', 'default' => '(PROV)', 'index' => 1, 'searchall' => 1, 'showoncombobox' => '1', 'comment' => "Reference of object", 'showonheader' => 1,), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'enabled' => 1, 'position' => 15, 'notnull' => 1, 'visible' => -2, 'default' => '1', 'index' => 1,), - 'fk_type' => array('type' => 'integer:PartnershipType:partnership/class/partnership_type.class.php:0:(active:=:1)', 'label' => 'Type', 'enabled' => '1', 'position' => 20, 'notnull' => 1, 'visible' => 5, 'csslist' => '',), - 'fk_soc' => array('type' => 'integer:Societe:societe/class/societe.class.php:1:((status:=:1) AND (entity:IN:__SHARED_ENTITIES__))', 'label' => 'ThirdParty', 'picto' => 'company', 'enabled' => '1', 'position' => 50, 'notnull' => -1, 'visible' => 5, 'index' => 1, 'css' => '', 'csslist' => '',), - 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => '1', 'position' => 61, 'notnull' => 0, 'visible' => 0,), - 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => '1', 'position' => 62, 'notnull' => 0, 'visible' => 0,), - 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => '1', 'position' => 500, 'notnull' => 1, 'visible' => -2,), - 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => '1', 'position' => 501, 'notnull' => 0, 'visible' => -2,), - 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => '1', 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), - 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => '1', 'position' => 511, 'notnull' => -1, 'visible' => -2,), - 'last_main_doc' => array('type' => 'varchar(255)', 'label' => 'LastMainDoc', 'enabled' => '1', 'position' => 600, 'notnull' => 0, 'visible' => 0,), - 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => '1', 'position' => 1000, 'notnull' => -1, 'visible' => -2,), - 'model_pdf' => array('type' => 'varchar(255)', 'label' => 'Model pdf', 'enabled' => '1', 'position' => 1010, 'notnull' => -1, 'visible' => 0,), - 'date_partnership_start' => array('type' => 'date', 'label' => 'DatePartnershipStart', 'enabled' => '1', 'position' => 52, 'notnull' => 1, 'visible' => 5,), - 'date_partnership_end' => array('type' => 'date', 'label' => 'DatePartnershipEnd', 'enabled' => '1', 'position' => 53, 'notnull' => 0, 'visible' => 5,), - 'url_to_check' => array('type' => 'varchar(255)', 'label' => 'UrlToCheck', 'enabled' => '1', 'position' => 70, 'notnull' => 0, 'visible' => -5,), - 'count_last_url_check_error' => array('type' => 'integer', 'label' => 'CountLastUrlCheckError', 'enabled' => '1', 'position' => 71, 'notnull' => 0, 'visible' => -2, 'default' => '0',), - 'last_check_backlink' => array('type' => 'datetime', 'label' => 'LastCheckBacklink', 'enabled' => '1', 'position' => 72, 'notnull' => 0, 'visible' => -2,), - 'reason_decline_or_cancel' => array('type' => 'text', 'label' => 'ReasonDeclineOrCancel', 'enabled' => '1', 'position' => 73, 'notnull' => 0, 'visible' => -2,), - 'ip' => array('type' => 'varchar(250)', 'label' => 'Ip', 'enabled' => '1', 'position' => 74, 'notnull' => 0, 'visible' => -2,), + 'fk_type' => array('type' => 'integer:PartnershipType:partnership/class/partnership_type.class.php:0:(active:=:1)', 'label' => 'Type', 'enabled' => 1, 'position' => 20, 'notnull' => 1, 'visible' => 5, 'csslist' => '',), + 'fk_soc' => array('type' => 'integer:Societe:societe/class/societe.class.php:1:((status:=:1) AND (entity:IN:__SHARED_ENTITIES__))', 'label' => 'ThirdParty', 'picto' => 'company', 'enabled' => 1, 'position' => 50, 'notnull' => -1, 'visible' => 5, 'index' => 1, 'css' => '', 'csslist' => '',), + 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => 1, 'position' => 61, 'notnull' => 0, 'visible' => 0,), + 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => 1, 'position' => 62, 'notnull' => 0, 'visible' => 0,), + 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'position' => 500, 'notnull' => 1, 'visible' => -2,), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'position' => 501, 'notnull' => 0, 'visible' => -2,), + 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => 1, 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), + 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => 1, 'position' => 511, 'notnull' => -1, 'visible' => -2,), + 'last_main_doc' => array('type' => 'varchar(255)', 'label' => 'LastMainDoc', 'enabled' => 1, 'position' => 600, 'notnull' => 0, 'visible' => 0,), + 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'position' => 1000, 'notnull' => -1, 'visible' => -2,), + 'model_pdf' => array('type' => 'varchar(255)', 'label' => 'Model pdf', 'enabled' => 1, 'position' => 1010, 'notnull' => -1, 'visible' => 0,), + 'date_partnership_start' => array('type' => 'date', 'label' => 'DatePartnershipStart', 'enabled' => 1, 'position' => 52, 'notnull' => 1, 'visible' => 5,), + 'date_partnership_end' => array('type' => 'date', 'label' => 'DatePartnershipEnd', 'enabled' => 1, 'position' => 53, 'notnull' => 0, 'visible' => 5,), + 'url_to_check' => array('type' => 'varchar(255)', 'label' => 'UrlToCheck', 'enabled' => 1, 'position' => 70, 'notnull' => 0, 'visible' => -5,), + 'count_last_url_check_error' => array('type' => 'integer', 'label' => 'CountLastUrlCheckError', 'enabled' => 1, 'position' => 71, 'notnull' => 0, 'visible' => -2, 'default' => '0',), + 'last_check_backlink' => array('type' => 'datetime', 'label' => 'LastCheckBacklink', 'enabled' => 1, 'position' => 72, 'notnull' => 0, 'visible' => -2,), + 'reason_decline_or_cancel' => array('type' => 'text', 'label' => 'ReasonDeclineOrCancel', 'enabled' => 1, 'position' => 73, 'notnull' => 0, 'visible' => -2,), + 'ip' => array('type' => 'varchar(250)', 'label' => 'Ip', 'enabled' => 1, 'position' => 74, 'notnull' => 0, 'visible' => -2,), - 'status' => array('type' => 'smallint', 'label' => 'Status', 'enabled' => '1', 'position' => 2000, 'notnull' => 1, 'visible' => 5, 'default' => '0', 'index' => 1, 'arrayofkeyval' => self::STATUS_SHORT_LIST, 'showonheader' => 1,), + 'status' => array('type' => 'smallint', 'label' => 'Status', 'enabled' => 1, 'position' => 2000, 'notnull' => 1, 'visible' => 5, 'default' => '0', 'index' => 1, 'arrayofkeyval' => self::STATUS_SHORT_LIST, 'showonheader' => 1,), ); //public $rowid; //public $ref; diff --git a/htdocs/webportal/class/webportalpropal.class.php b/htdocs/webportal/class/webportalpropal.class.php index d53fa5f07ab..2c6a973ec66 100644 --- a/htdocs/webportal/class/webportalpropal.class.php +++ b/htdocs/webportal/class/webportalpropal.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2023-2024 Lionel Vessiller + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -97,7 +98,7 @@ class WebPortalPropal extends Propal // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'css' => 'left', 'comment' => "Id",), diff --git a/htdocs/webportal/controllers/propallist.controller.class.php b/htdocs/webportal/controllers/propallist.controller.class.php index 5c6ca9668db..4eb947582c1 100644 --- a/htdocs/webportal/controllers/propallist.controller.class.php +++ b/htdocs/webportal/controllers/propallist.controller.class.php @@ -64,7 +64,7 @@ class PropalListController extends Controller // Load translation files required by the page $langs->loadLangs(array('companies', 'propal', 'compta', 'bills', 'orders', 'products', 'deliveries', 'categories')); - if (isModEnabled('delivery_note')) { + if (isModEnabled('shipping')) { $langs->loadLangs(array('sendings')); } diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index 7a0a42a0f9f..f7d8829bd71 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -5,6 +5,7 @@ * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2020 Nicolas ZABOURI * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -57,7 +58,7 @@ class WebsitePage extends CommonObject public $fk_element = 'fk_website_page'; /** - * @var array List of child tables. To know object to delete on cascade. + * @var string[] List of child tables. To know object to delete on cascade. */ protected $childtablesoncascade = array('categorie_website_page'); @@ -162,7 +163,7 @@ class WebsitePage extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'index' => 1, 'position' => 1, 'comment' => 'Id'), diff --git a/htdocs/workstation/class/workstation.class.php b/htdocs/workstation/class/workstation.class.php index ad650d6c7b0..8a3e195f0fd 100644 --- a/htdocs/workstation/class/workstation.class.php +++ b/htdocs/workstation/class/workstation.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2020 Gauthier VERDOL * Copyright (C) 2023-2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -95,7 +96,7 @@ class Workstation extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'css' => 'left', 'comment' => "Id"), diff --git a/htdocs/workstation/class/workstationresource.class.php b/htdocs/workstation/class/workstationresource.class.php index c50a8417e90..853bba00724 100644 --- a/htdocs/workstation/class/workstationresource.class.php +++ b/htdocs/workstation/class/workstationresource.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2020 Gauthier VERDOL + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -35,7 +36,7 @@ class WorkstationResource extends CommonObject public $element = 'workstationresource'; /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'fk_workstation' => array('type' => 'integer'), diff --git a/htdocs/workstation/class/workstationusergroup.class.php b/htdocs/workstation/class/workstationusergroup.class.php index e53bee221ef..54e342ba09a 100644 --- a/htdocs/workstation/class/workstationusergroup.class.php +++ b/htdocs/workstation/class/workstationusergroup.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2020 Gauthier VERDOL + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -34,7 +35,7 @@ class WorkstationUserGroup extends CommonObject public $element = 'workstationusergroup'; /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'fk_workstation' => array('type' => 'integer'), diff --git a/htdocs/workstation/workstation_agenda.php b/htdocs/workstation/workstation_agenda.php index cf25d186ae8..4e6853596bc 100644 --- a/htdocs/workstation/workstation_agenda.php +++ b/htdocs/workstation/workstation_agenda.php @@ -100,7 +100,7 @@ restrictedArea($user, $object->element, $object->id, $object->table_element, 'wo * Actions */ -$parameters = array('id'=>$id); +$parameters = array('id' => $id); $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'); @@ -206,14 +206,14 @@ if ($object->id > 0) { $objthirdparty = $object; $objcon = new stdClass(); - $out = '&origin='.urlencode($object->element.'@'.$object->module).'&originid='.urlencode($object->id); + $out = '&origin='.urlencode((string) ($object->element.'@'.$object->module)).'&originid='.urlencode((string) ($object->id)); $urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id; $out .= '&backtopage='.urlencode($urlbacktopage); $permok = $user->hasRight('agenda', 'myactions', 'create'); if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) { //$out.=' * Copyright (C) 2019-2024 Frédéric France + * Copyright (C) 2024 MDW * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or @@ -80,7 +81,7 @@ class Hook extends CommonObject */ /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array( diff --git a/test/phpunit/CommonClassTest.class.php b/test/phpunit/CommonClassTest.class.php index 701dccc6e63..399f972863c 100644 --- a/test/phpunit/CommonClassTest.class.php +++ b/test/phpunit/CommonClassTest.class.php @@ -247,7 +247,7 @@ abstract class CommonClassTest extends TestCase 'commande' => 'order', 'contrat' => 'contract', 'entrepot' => 'stock', - 'expedition' => 'delivery_note', + 'expedition' => 'shipping', 'facture' => 'invoice', 'fichinter' => 'intervention', 'product_fournisseur_price' => 'productsupplierprice', @@ -296,7 +296,7 @@ abstract class CommonClassTest extends TestCase 'datapolicy' => 'DataPolicy', 'dav' => 'Dav', 'debugbar' => 'DebugBar', - 'delivery_note' => 'Expedition', + 'shipping' => 'Expedition', 'deplacement' => 'Deplacement', "documentgeneration" => 'DocumentGeneration', // TODO: fill in proper name 'don' => 'Don', diff --git a/test/phpunit/FilesLibTest.php b/test/phpunit/FilesLibTest.php index 91cdcc816bd..32616542c2a 100644 --- a/test/phpunit/FilesLibTest.php +++ b/test/phpunit/FilesLibTest.php @@ -247,6 +247,7 @@ class FilesLibTest extends CommonClassTest * testDolCopyMoveDelete * * @return void + * @group WindowsWaitingForFix */ public function testDolCopyMoveDelete() { @@ -490,6 +491,7 @@ class FilesLibTest extends CommonClassTest * testDolDirMove * * @return void + * @group WindowsWaitingForFix */ public function testDolDirMove() {