diff --git a/.github/workflows/README.md b/.github/workflows/README.md index abb6782f778..bb4ee919364 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -12,7 +12,7 @@ This run the actions: - phan.yml - phpstan.yml When all succeed, start: -- Windows-ci; +- windows-ci.yml See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#running-a-workflow-based-on-the-conclusion-of-another-workflow @@ -21,13 +21,13 @@ The other worklows are: ----------------------- - ci-stale-issues-safe to autoclose old issues. -- ci-phpstan_baseline to update the phpstan baseline file. -- ci-cache-clean-pr to clean cache when closing a PR. -- ci-test to make CI tests +- ci-phpstan_baseline to update the phpstan baseline file. +- ci-cache-clean-pr to clean cache when closing a PR. +- ci-test to make CI tests +- ci-checkfiltesetlock to check we do not modify a file that is locked by a signature in dev/lockedfiles.txt Some tests workflows are: ------------------------ - pr-18 -- pr-18-autolbal - test diff --git a/.github/workflows/ci-pr-devcamp.yaml.disabled b/.github/workflows/ci-pr-devcamp.yaml.disabled deleted file mode 100644 index 375974b43cd..00000000000 --- a/.github/workflows/ci-pr-devcamp.yaml.disabled +++ /dev/null @@ -1,45 +0,0 @@ -# Action to prepare the github action -# Go on Dolibarr Organization - Settings - Developer settings - GitHub App (https://github.com/organizations/Dolibarr/settings/apps) -# Create an App: Enter a name + In Home page URL use https://github.com/Dolibarr/dolibarr + Disable webhook -# Set Permissions (see other app for list of permissions) -# Click on generate the private keys -# Click on Install application - choose the repository of the bot -# Go on Organisation - Secret and variables and create a secret PR_SECRET_KEY and copy the content of received private key. Choose the repository access to "Repository Dolibarr". -# Go on Organisation - Secret and variables and create a variable PR_APP_ID and copy the ID of the previously create ID. Choose the repository access to "Repository Dolibarr". -# - -name: Set the tag with devcamp label during the session of a devcamp -on: - pull_request_target: - types: [opened] - - -permissions: - pull-requests: write - issues: write - -jobs: - add-label-devcamp: - runs-on: ubuntu-latest - - steps: - #- name: Install GitHub CLI - # run: sudo apt-get install gh - - - name: Generate a token - id: generate-token - uses: actions/create-github-app-token@v2 - with: - app-id: ${{ vars.PR_APP_ID }} - private-key: ${{ secrets.PR_SECRET_KEY }} - - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Assign label - env: - GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} - url: ${{ github.event.pull_request.html_url }} - run: | - echo "env.url=${{env.url}}" - gh pr edit "${{env.url}}" --add-label "Event: DevCamp 2025 XXX" diff --git a/dev/build/phpstan/phpstan-baseline.neon b/dev/build/phpstan/phpstan-baseline.neon index 402c60dd326..57f70f9eef5 100644 --- a/dev/build/phpstan/phpstan-baseline.neon +++ b/dev/build/phpstan/phpstan-baseline.neon @@ -888,12 +888,6 @@ parameters: count: 1 path: ../../../htdocs/asset/card.php - - - message: '#^Property Asset\:\:\$fields \(array\\|string, position\: int, notnull\?\: int, visible\: int\<\-6, 6\>\|string, alwayseditable\?\: int\<0, 1\>\|string, \.\.\.\}\>\) does not accept non\-empty\-array\\|string, position\: int, notnull\?\: int, visible\: int\<\-6, 6\>\|string, alwayseditable\?\: int\<0, 1\>\|string, \.\.\.\}\>\.$#' - identifier: assign.propertyType - count: 1 - path: ../../../htdocs/asset/card.php - - message: '#^Call to function is_callable\(\) with array\{\$this\(AssetDepreciationOptions\), ''validateField''\} will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -1146,12 +1140,6 @@ parameters: count: 1 path: ../../../htdocs/bookmarks/bookmarks.lib.php - - - message: '#^Variable \$result might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/categories/card.php - - message: '#^Loose comparison using \=\= between ''hierarchy'' and ''common'' will always evaluate to false\.$#' identifier: equal.alwaysFalse @@ -1164,12 +1152,6 @@ parameters: count: 1 path: ../../../htdocs/categories/categorie_list.php - - - message: '#^Strict comparison using \=\=\= between array\{type\: string, label\: string, langfile\?\: string, enabled\: int\<0, 2\>\|string, position\: int, notnull\?\: int, visible\: int\<\-6, 6\>\|string, alwayseditable\?\: int\<0, 1\>\|string, \.\.\.\} and null will always evaluate to false\.$#' - identifier: identical.alwaysFalse - count: 1 - path: ../../../htdocs/categories/categorie_list.php - - message: '#^If condition is always true\.$#' identifier: if.alwaysTrue @@ -1302,12 +1284,6 @@ parameters: count: 2 path: ../../../htdocs/comm/action/index.php - - - message: '#^Variable \$socid might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/comm/action/info.php - - message: '#^Call to function is_array\(\) with array\ will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -1980,12 +1956,6 @@ parameters: count: 3 path: ../../../htdocs/compta/cashcontrol/cashcontrol_card.php - - - message: '#^Strict comparison using \=\=\= between array\{type\: string, label\: string, langfile\?\: string, enabled\: int\<0, 2\>\|string, position\: int, notnull\?\: int, visible\: int\<\-6, 6\>\|string, alwayseditable\?\: int\<0, 1\>\|string, \.\.\.\} and null will always evaluate to false\.$#' - identifier: identical.alwaysFalse - count: 1 - path: ../../../htdocs/compta/cashcontrol/cashcontrol_list.php - - message: '#^Call to function method_exists\(\) with \$this\(CashControl\) and ''getLibStatut'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -4176,12 +4146,6 @@ parameters: count: 1 path: ../../../htdocs/core/class/html.formother.class.php - - - message: '#^If condition is always false\.$#' - identifier: if.alwaysFalse - count: 1 - path: ../../../htdocs/core/class/html.formprojet.class.php - - message: '#^Variable \$labeltoshow might not be defined\.$#' identifier: variable.undefined @@ -6756,18 +6720,6 @@ parameters: count: 2 path: ../../../htdocs/fourn/commande/card.php - - - message: '#^Variable \$line might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../../htdocs/fourn/commande/card.php - - - - message: '#^Variable \$num might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/fourn/commande/card.php - - message: '#^Right side of && is always false\.$#' identifier: booleanAnd.rightAlwaysFalse @@ -6780,12 +6732,6 @@ parameters: count: 2 path: ../../../htdocs/fourn/commande/dispatch.php - - - message: '#^Variable \$comment might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../../htdocs/fourn/commande/dispatch.php - - message: '#^Variable \$product might not be defined\.$#' identifier: variable.undefined @@ -7314,12 +7260,6 @@ parameters: count: 1 path: ../../../htdocs/hrm/job_card.php - - - message: '#^Strict comparison using \=\=\= between array\{type\: string, label\: string, langfile\?\: string, enabled\: int\<0, 2\>\|string, position\: int, notnull\?\: int, visible\: int\<\-6, 6\>\|string, alwayseditable\?\: int\<0, 1\>\|string, \.\.\.\} and null will always evaluate to false\.$#' - identifier: identical.alwaysFalse - count: 1 - path: ../../../htdocs/hrm/job_list.php - - message: '#^Comparison operation "\<" between int\<0, max\> and 0 is always false\.$#' identifier: smaller.alwaysFalse @@ -7332,12 +7272,6 @@ parameters: count: 1 path: ../../../htdocs/hrm/position.php - - - message: '#^Property Position\:\:\$fields \(array\\|string, position\: int, notnull\?\: int, visible\: int\<\-6, 6\>\|string, alwayseditable\?\: int\<0, 1\>\|string, \.\.\.\}\>\) does not accept non\-empty\-array\\|string, position\: int, notnull\?\: int, visible\: int\<\-6, 6\>\|string, alwayseditable\?\: int\<0, 1\>\|string, \.\.\.\}\>\.$#' - identifier: assign.propertyType - count: 1 - path: ../../../htdocs/hrm/position_agenda.php - - message: '#^If condition is always true\.$#' identifier: if.alwaysTrue @@ -8226,12 +8160,6 @@ parameters: count: 1 path: ../../../htdocs/modulebuilder/template/myobject_list.php - - - message: '#^Strict comparison using \=\=\= between array\{type\: string, label\: string, langfile\?\: string, enabled\: int\<0, 2\>\|string, position\: int, notnull\?\: int, visible\: int\<\-6, 6\>\|string, alwayseditable\?\: int\<0, 1\>\|string, \.\.\.\} and null will always evaluate to false\.$#' - identifier: identical.alwaysFalse - count: 1 - path: ../../../htdocs/modulebuilder/template/myobject_list.php - - message: '#^Negated boolean expression is always true\.$#' identifier: booleanNot.alwaysTrue @@ -8460,12 +8388,6 @@ parameters: count: 1 path: ../../../htdocs/partnership/class/partnership.class.php - - - message: '#^Call to function property_exists\(\) with \$this\(Partnership\) and ''fk_soc'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../../htdocs/partnership/class/partnership.class.php - - message: '#^Call to function property_exists\(\) with \$this\(Partnership\) and ''thirdparty'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -8505,7 +8427,7 @@ parameters: - message: '#^Negated boolean expression is always true\.$#' identifier: booleanNot.alwaysTrue - count: 2 + count: 1 path: ../../../htdocs/partnership/class/partnership.class.php - @@ -8538,12 +8460,6 @@ parameters: count: 1 path: ../../../htdocs/partnership/partnership_card.php - - - message: '#^Variable \$adht might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/partnership/partnership_card.php - - message: '#^Variable \$soc might not be defined\.$#' identifier: variable.undefined @@ -8556,12 +8472,6 @@ parameters: count: 1 path: ../../../htdocs/partnership/partnership_list.php - - - message: '#^Ternary operator condition is always true\.$#' - identifier: ternary.alwaysTrue - count: 2 - path: ../../../htdocs/partnership/partnership_list.php - - message: '#^Right side of && is always true\.$#' identifier: booleanAnd.rightAlwaysTrue @@ -11586,12 +11496,6 @@ parameters: count: 1 path: ../../../htdocs/webhook/target_card.php - - - message: '#^Strict comparison using \=\=\= between array\{type\: string, label\: string, langfile\?\: string, enabled\: int\<0, 2\>\|string, position\: int, notnull\?\: int, visible\: int\<\-6, 6\>\|string, alwayseditable\?\: int\<0, 1\>\|string, \.\.\.\} and null will always evaluate to false\.$#' - identifier: identical.alwaysFalse - count: 1 - path: ../../../htdocs/webhook/triggerhistory_list.php - - message: '#^Result of && is always false\.$#' identifier: booleanAnd.alwaysFalse diff --git a/dev/tools/codespell/codespell-ignore.txt b/dev/tools/codespell/codespell-ignore.txt index b00028f0999..feb181252f6 100644 --- a/dev/tools/codespell/codespell-ignore.txt +++ b/dev/tools/codespell/codespell-ignore.txt @@ -101,6 +101,7 @@ activ addin amountin alltime +Referers # other blacklists diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt index 40682345aa6..c0b4c86a907 100644 --- a/dev/tools/phan/baseline.txt +++ b/dev/tools/phan/baseline.txt @@ -72,7 +72,6 @@ return [ 'htdocs/core/class/html.formcompany.class.php' => ['PhanUndeclaredProperty'], 'htdocs/core/class/html.formmail.class.php' => ['PhanUndeclaredProperty'], 'htdocs/core/class/openid.class.php' => ['PhanTypeMismatchArgument'], - 'htdocs/core/class/rssparser.class.php' => ['PhanTypeMismatchArgument'], 'htdocs/core/class/timespent.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'], 'htdocs/core/lib/admin.lib.php' => ['PhanUndeclaredProperty'], 'htdocs/core/lib/files.lib.php' => ['PhanUndeclaredProperty'], @@ -89,7 +88,6 @@ return [ 'htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/core/modules/delivery/mod_delivery_saphir.php' => ['PhanUndeclaredProperty'], 'htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php' => ['PhanTypeMismatchArgument'], - 'htdocs/core/modules/expedition/doc/pdf_espadon.modules.php' => ['PhanTypeMismatchArgument'], 'htdocs/core/modules/expensereport/doc/pdf_standard_expensereport.modules.php' => ['PhanUndeclaredProperty'], 'htdocs/core/modules/facture/doc/pdf_octopus.modules.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanUndeclaredProperty'], 'htdocs/core/modules/holiday/mod_holiday_immaculate.php' => ['PhanTypeMismatchArgument'], diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php index 46d1d9335e9..0bc6b843033 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2024-2026 MDW * Copyright (C) 2024-2025 Frédéric France * * This is the phan config file used by .github/workflows/phan.yml @@ -279,6 +279,7 @@ return [ 'dolibarr_main_db_encrypted_pass' => 'string', 'dolibarr_main_db_host' => 'string', 'dolibarr_main_db_pass' => 'string', + 'dolibarr_main_db_type' => '?string', 'dolibarr_main_demo' => 'string', 'dolibarr_main_document_root' => 'string', 'dolibarr_main_url_root' => 'string', diff --git a/htdocs/accountancy/admin/fiscalyear_card.php b/htdocs/accountancy/admin/fiscalyear_card.php index 3639749d2da..6de0f000241 100644 --- a/htdocs/accountancy/admin/fiscalyear_card.php +++ b/htdocs/accountancy/admin/fiscalyear_card.php @@ -28,6 +28,7 @@ require '../../main.inc.php'; /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user @@ -54,7 +55,6 @@ $error = 0; // Initialize a technical objects $object = new Fiscalyear($db); -$extrafields = new ExtraFields($db); // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be 'include', not 'include_once'. diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index 9ce79e02889..1e15d8c3754 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -435,6 +435,62 @@ if ($action == 'setenabletabonthirdparty') { } } +if ($action == 'setexportenablelettering') { + $setexportenablelettering = GETPOSTINT('value'); + $res = dolibarr_set_const($db, "ACCOUNTING_DEFAULT_NOT_EXPORT_LETTERING", $setexportenablelettering, 'yesno', 0, '', $conf->entity); + if (!($res > 0)) { + $error++; + } + + if (!$error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'mesgs'); + } +} + +if ($action == 'setexportenableexportdate') { + $setexportenableexportdate = GETPOSTINT('value'); + $res = dolibarr_set_const($db, "ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE", $setexportenableexportdate, 'yesno', 0, '', $conf->entity); + if (!($res > 0)) { + $error++; + } + + if (!$error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'mesgs'); + } +} + +if ($action == 'setexportenablevalidationdate') { + $setexportenablevalidationdate = GETPOSTINT('value'); + $res = dolibarr_set_const($db, "ACCOUNTING_DEFAULT_NOTIFIED_VALIDATION_DATE", $setexportenablevalidationdate, 'yesno', 0, '', $conf->entity); + if (!($res > 0)) { + $error++; + } + + if (!$error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'mesgs'); + } +} + +if ($action == 'setexportenablefull') { + $setexportenablefull = GETPOSTINT('value'); + $res = dolibarr_set_const($db, "ACCOUNTING_DEFAULT_NOTIFIED_EXPORTFULL", $setexportenablefull, 'yesno', 0, '', $conf->entity); + if (!($res > 0)) { + $error++; + } + + if (!$error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'mesgs'); + } +} + if ($action == 'updateMask') { $maskconstbookkeeping = GETPOST('maskconstbookkeeping', 'aZ09'); $maskbookkeeping = GETPOST('maskbookkeeping', 'alpha'); @@ -989,10 +1045,66 @@ if ($num2) { print ''; } - - print "\n"; } +print ''; +print ''; +print $form->textwithpicto($langs->trans("AccountingDefaultNotExportLettering"), $langs->trans("AccountingDefaultNotExportLetteringDesc")) . ''; +if (getDolGlobalInt('ACCOUNTING_DEFAULT_NOT_EXPORT_LETTERING')) { + print ''; + print img_picto($langs->trans("Activated"), 'switch_on'); + print ''; +} else { + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off'); + print ''; +} +print ''; + +print ''; +print ''; +print $form->textwithpicto($langs->trans("AccountingDefaultNotNotifiedExportDate"), $langs->trans("AccountingDefaultNotNotifiedExportDateDesc")) . ''; +if (getDolGlobalInt('ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE')) { + print ''; + print img_picto($langs->trans("Activated"), 'switch_on'); + print ''; +} else { + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off'); + print ''; +} +print ''; + +print ''; +print ''; +print $form->textwithpicto($langs->trans("AccountingDefaultNotifiedValidationDate"), $langs->trans("AccountingDefaultNotifiedValidationDateDesc")) . ''; +if (getDolGlobalInt('ACCOUNTING_DEFAULT_NOTIFIED_VALIDATION_DATE')) { + print ''; + print img_picto($langs->trans("Activated"), 'switch_on'); + print ''; +} else { + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off'); + print ''; +} +print ''; + +print ''; +print ''; +print $form->textwithpicto($langs->trans("AccountingDefaultNotifiedExportFull"), $langs->trans("AccountingDefaultNotifiedExportFullDesc")) . ''; +if (getDolGlobalInt('ACCOUNTING_DEFAULT_NOTIFIED_EXPORTFULL')) { + print ''; + print img_picto($langs->trans("Activated"), 'switch_on'); + print ''; +} else { + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off'); + print ''; +} +print ''; + +print "\n"; + print '
'; print ''; diff --git a/htdocs/accountancy/admin/template/card.php b/htdocs/accountancy/admin/template/card.php index fb27fefa6a7..7ec97fe55b5 100644 --- a/htdocs/accountancy/admin/template/card.php +++ b/htdocs/accountancy/admin/template/card.php @@ -28,6 +28,7 @@ require '../../../main.inc.php'; /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user @@ -60,7 +61,6 @@ $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); // Initialize technical objects $object = new BookkeepingTemplate($db); -$extrafields = new ExtraFields($db); $diroutputmassaction = $conf->accounting->dir_output . '/temp/massgeneration/' . $user->id; $hookmanager->initHooks(array($object->element . 'card', 'globalcard')); diff --git a/htdocs/accountancy/admin/template/list.php b/htdocs/accountancy/admin/template/list.php index af12705b243..7ded35fb391 100644 --- a/htdocs/accountancy/admin/template/list.php +++ b/htdocs/accountancy/admin/template/list.php @@ -29,6 +29,7 @@ require '../../../main.inc.php'; /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user @@ -68,7 +69,6 @@ $pagenext = $page + 1; // Initialize technical objects $object = new BookkeepingTemplate($db); -$extrafields = new ExtraFields($db); $diroutputmassaction = $conf->accounting->dir_output.'/temp/massgeneration/'.$user->id; $hookmanager->initHooks(array($contextpage)); diff --git a/htdocs/accountancy/bookkeeping/export.php b/htdocs/accountancy/bookkeeping/export.php index 515dda487ca..c4537358066 100644 --- a/htdocs/accountancy/bookkeeping/export.php +++ b/htdocs/accountancy/bookkeeping/export.php @@ -812,36 +812,36 @@ if ($action == 'export_file') { if (getDolGlobalInt("ACCOUNTING_ENABLE_LETTERING")) { // If 1, we check by default. - $checked = getDolGlobalString('ACCOUNTING_DEFAULT_NOT_EXPORT_LETTERING') ? 'true' : 'false'; + $checked_exportreconcile = getDolGlobalString('ACCOUNTING_DEFAULT_NOT_EXPORT_LETTERING') ? 'true' : 'false'; $form_question['notexportlettering'] = array( 'name' => 'notexportlettering', 'type' => 'checkbox', 'label' => $langs->trans('NotExportLettering'), - 'value' => $checked, + 'value' => $checked_exportreconcile, ); $form_question['separator1'] = array('name' => 'separator1', 'type' => 'separator'); } // If 1 or not set, we check by default. - $checked = (!isset($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE) || getDolGlobalString('ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE')); + $checked_exportdate = getDolGlobalString('ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE') ? 'true' : 'false'; $form_question['notifiedexportdate'] = array( 'name' => 'notifiedexportdate', 'type' => 'checkbox', 'label' => $langs->trans('NotifiedExportDate'), - 'value' => (getDolGlobalString('ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE') ? 'false' : 'true'), + 'value' => $checked_exportdate, ); $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. - $checked = getDolGlobalString('ACCOUNTING_DEFAULT_NOTIFIED_VALIDATION_DATE'); + $checked_validationdate = getDolGlobalString('ACCOUNTING_DEFAULT_NOTIFIED_VALIDATION_DATE') ? 'true' : 'false'; $form_question['notifiedvalidationdate'] = array( 'name' => 'notifiedvalidationdate', 'type' => 'checkbox', 'label' => $langs->trans('NotifiedValidationDate', $langs->transnoentitiesnoconv("MenuAccountancyClosure")), - 'value' => $checked, + 'value' => $checked_validationdate, ); $form_question['separator3'] = array('name' => 'separator3', 'type' => 'separator'); @@ -865,11 +865,12 @@ if ($action == 'export_file') { $except[] = $langs->trans('SupplierInvoice'); } + $checked_exportfull = getDolGlobalString('ACCOUNTING_DEFAULT_NOTIFIED_EXPORTFULL') ? 'true' : 'false'; $form_question['notifiedexportfull'] = array( 'name' => 'notifiedexportfull', 'type' => 'checkbox', 'label' => $langs->trans('NotifiedExportFull').(empty($except) ? '' : ' ('.$langs->trans("except").' '.implode(', ', $except).')'), - 'value' => 'false', + 'value' => $checked_exportfull, ); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans("ExportFilteredList").'...', $langs->trans('ConfirmExportFile'), 'export_fileconfirm', $form_question, '', 1, 500, 700); @@ -879,12 +880,18 @@ if ($action == 'export_file') { const exportTypesWithDocs = ['.implode(',', $exportTypesWithDocs).']; const $formatExport = jQuery("#formatexport"); + // We retrieve the configured default value (true or false in native JavaScript) + const defaultChecked = ' . $checked_exportfull . '; + function toggleExportFull() { const $checkbox = jQuery("#notifiedexportfull"); const show = exportTypesWithDocs.indexOf(parseInt($formatExport.val())) !== -1; $checkbox.closest(".tagtr").toggle(show); + if (!show) { $checkbox.prop("checked", false); // remove checked if hidden + } else { + $checkbox.prop("checked", defaultChecked); // Restore the default configuration if displayed } } diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index cd88e050ded..97382861d7a 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2015-2026 Alexandre Spangaro * Copyright (C) 2015-2020 Florian Henry * Copyright (C) 2018-2025 Frédéric France - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2026 MDW * Copyright (C) 2024 Jose MARTINEZ * Copyright (C) 2025 Nicolas Barrouillet * @@ -2947,7 +2947,7 @@ class BookKeeping extends CommonObject $income_statement_amount = 0; if (getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT')) { - $accounting_groups_used_for_income_statement = array_filter(array_map('trim', explode(',', getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT'))), 'strlen'); + $accounting_groups_used_for_income_statement = array_filter(array_map('trim', explode(',', getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT'))), 'strlen'); // @phpstan-ignore argument.type $pcg_type_filter = array(); foreach ($accounting_groups_used_for_income_statement as $item) { @@ -3073,8 +3073,8 @@ class BookKeeping extends CommonObject } if (!$error && is_object($journal)) { - $accounting_groups_used_for_balance_sheet_account = array_filter(array_map('trim', explode(',', getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_BALANCE_SHEET_ACCOUNT'))), 'strlen'); - $accounting_groups_used_for_income_statement = array_filter(array_map('trim', explode(',', getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT'))), 'strlen'); + $accounting_groups_used_for_balance_sheet_account = array_filter(array_map('trim', explode(',', getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_BALANCE_SHEET_ACCOUNT'))), 'strlen'); // @phpstan-ignore argument.type + $accounting_groups_used_for_income_statement = array_filter(array_map('trim', explode(',', getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT'))), 'strlen'); // @phpstan-ignore argument.type $pcg_type_filter = array(); $tmp = array_merge($accounting_groups_used_for_balance_sheet_account, $accounting_groups_used_for_income_statement); @@ -3217,8 +3217,8 @@ class BookKeeping extends CommonObject $bookkeeping->subledger_label = null; } else { */ - $bookkeeping->subledger_account = null; - $bookkeeping->subledger_label = null; + $bookkeeping->subledger_account = null; + $bookkeeping->subledger_label = null; //} $bookkeeping->numero_compte = $accountingaccount->account_number; @@ -3422,16 +3422,20 @@ class BookKeeping extends CommonObject $echecT = []; foreach ($toselect as $id) { if ($bookkeeping->fetch($id)) { - if ( !getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER')) { + if (!getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER')) { $accountcustcode = '411'; - } else $accountcustcode = getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER'); + } else { + $accountcustcode = getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER'); + } - if ( !getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER')) { + if (!getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER')) { $accountsuppcode = '401'; - } else $accountsuppcode = getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER'); + } else { + $accountsuppcode = getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER'); + } if (strpos($bookkeeping->numero_compte, $accountcustcode) === 0 || strpos($bookkeeping->numero_compte, $accountsuppcode) === 0) { - $echecT[]=$bookkeeping->numero_compte; + $echecT[] = $bookkeeping->numero_compte; continue; } @@ -3468,7 +3472,10 @@ class BookKeeping extends CommonObject if (!empty($echecImplode)) { $nbEchec = count(explode(',', $echecImplode)); - setEventMessages($nbEchec == 1 ? $langs->trans('NoAccountChangedWithAccountNumber') . ' ' . $echecImplode : $langs->trans('NoAccountsChangedWithAccountNumber') . ' ' . $echecImplode, null, 'errors' + setEventMessages( + $nbEchec == 1 ? $langs->trans('NoAccountChangedWithAccountNumber') . ' ' . $echecImplode : $langs->trans('NoAccountsChangedWithAccountNumber') . ' ' . $echecImplode, + null, + 'errors' ); } @@ -3731,7 +3738,6 @@ class BookKeeping extends CommonObject * @param string $code_journal Accounting journal code * @param int $docdate Date of the document * @return int int Return integer -1 if KO, 1 if OK - * */ public function newReturnAccount(array $toselect, $code_journal, $docdate) { @@ -3753,7 +3759,7 @@ class BookKeeping extends CommonObject $alreadyExtourneT = array(); if ($resqlAlreadyExtourne) { while ($obj4 = $this->db->fetch_object($resqlAlreadyExtourne)) { - $alreadyExtourneT []= $obj4->piece_num; + $alreadyExtourneT [] = $obj4->piece_num; } } diff --git a/htdocs/accountancy/closure/index.php b/htdocs/accountancy/closure/index.php index 8b8e64cf625..e56a49e9138 100644 --- a/htdocs/accountancy/closure/index.php +++ b/htdocs/accountancy/closure/index.php @@ -2,7 +2,7 @@ /* Copyright (C) 2019-2023 Open-DSI * Copyright (C) 2024 Frédéric France * Copyright (C) 2025-2026 Alexandre Spangaro - * Copyright (C) 2025 MDW + * Copyright (C) 2025-2026 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 @@ -122,8 +122,8 @@ if (empty($current_fiscal_period) && !empty($first_active_fiscal_period)) { } } -$accounting_groups_used_for_balance_sheet_account = array_filter(array_map('trim', explode(',', getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_BALANCE_SHEET_ACCOUNT'))), 'strlen'); -$accounting_groups_used_for_income_statement = array_filter(array_map('trim', explode(',', getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT'))), 'strlen'); +$accounting_groups_used_for_balance_sheet_account = array_filter(array_map('trim', explode(',', getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_BALANCE_SHEET_ACCOUNT'))), 'strlen'); // @phpstan-ignore argument.type +$accounting_groups_used_for_income_statement = array_filter(array_map('trim', explode(',', getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT'))), 'strlen'); // @phpstan-ignore argument.type /* diff --git a/htdocs/adherents/admin/member_extrafields.php b/htdocs/adherents/admin/member_extrafields.php index bb3199e16b5..c7813559af2 100644 --- a/htdocs/adherents/admin/member_extrafields.php +++ b/htdocs/adherents/admin/member_extrafields.php @@ -29,11 +29,11 @@ // Load Dolibarr environment require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user @@ -42,7 +42,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; // Load translation files required by the page $langs->loadLangs(array("admin", "members")); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/adherents/admin/member_type_extrafields.php b/htdocs/adherents/admin/member_type_extrafields.php index de9c3b6e90f..476db2b3820 100644 --- a/htdocs/adherents/admin/member_type_extrafields.php +++ b/htdocs/adherents/admin/member_type_extrafields.php @@ -32,6 +32,7 @@ /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user @@ -40,12 +41,10 @@ // Load Dolibarr environment require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; // Load translation files required by the page $langs->loadLangs(array("admin", "members")); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/adherents/admin/website.php b/htdocs/adherents/admin/website.php index 57d9950b901..a67de387d6e 100644 --- a/htdocs/adherents/admin/website.php +++ b/htdocs/adherents/admin/website.php @@ -75,11 +75,8 @@ if ($action == 'setMEMBER_ENABLE_PUBLIC') { if ($action == 'update') { $public = GETPOST('MEMBER_ENABLE_PUBLIC'); - if (GETPOST('MEMBER_NEWFORM_AMOUNT') !== '') { - $amount = price2num(GETPOST('MEMBER_NEWFORM_AMOUNT'), 'MT', 2); - } else { - $amount = ''; - } + $amount = ''; + $minamount = GETPOST('MEMBER_MIN_AMOUNT'); $publiccounters = GETPOST('MEMBER_COUNTERS_ARE_PUBLIC'); $showtable = GETPOST('MEMBER_SHOW_TABLE'); @@ -89,7 +86,6 @@ if ($action == 'update') { $forcemorphy = GETPOST('MEMBER_NEWFORM_FORCEMORPHY', 'aZ09'); $res = dolibarr_set_const($db, "MEMBER_ENABLE_PUBLIC", $public, 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "MEMBER_NEWFORM_AMOUNT", $amount, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "MEMBER_MIN_AMOUNT", $minamount, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "MEMBER_COUNTERS_ARE_PUBLIC", $publiccounters, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "MEMBER_SKIP_TABLE", $showtable ? 0 : 1, 'chaine', 0, '', $conf->entity); // Logic is reversed for retrocompatibility: "skip -> show" @@ -107,6 +103,9 @@ if ($action == 'update') { } else { $res = dolibarr_set_const($db, "MEMBER_NEWFORM_FORCEMORPHY", $forcemorphy, 'chaine', 0, '', $conf->entity); } + if (GETPOSTISSET('MEMBER_SEARCH_MEMBER_PUBLIC_FORM_CREATE')) { + $res = dolibarr_set_const($db, "MEMBER_SEARCH_MEMBER_PUBLIC_FORM_CREATE", GETPOST('MEMBER_SEARCH_MEMBER_PUBLIC_FORM_CREATE') == 'yes' ? 1 : 0, 'chaine', 0, '', $conf->entity); + } if (!($res > 0)) { $error++; @@ -272,14 +271,6 @@ if (getDolGlobalString('MEMBER_ENABLE_PUBLIC')) { print $form->selectarray("MEMBER_NEWFORM_FORCEMORPHY", $morphys, $forcenature, $langs->trans("No"), 0, 0, '', 0, 0, 0, '', 'width200'); print "\n"; - // Amount - print ''; - print $langs->trans("DefaultAmount"); - print ''; - print ''; - print ' '.$langs->getCurrencySymbol($mysoc->currency_code).''; - print "\n"; - // Min amount print ''; print $langs->trans("MinimumAmount"); @@ -321,9 +312,9 @@ if (getDolGlobalString('MEMBER_ENABLE_PUBLIC')) { // Search a member after member creation form print ''; - print $langs->trans("MEMBER_SEARCH_MEMBER_PUBLIC_FORM_CREATE"); + print $form->textwithpicto($langs->trans("MEMBER_SEARCH_MEMBER_PUBLIC_FORM_CREATE"), $langs->trans("MEMBER_SEARCH_MEMBER_PUBLIC_FORM_CREATEDesc")); print ''; - print $form->selectyesno("MEMBER_SEARCH_MEMBER_PUBLIC_FORM_CREATE"); // Reverse the logic "hide -> show" for retrocompatibility + print $form->selectyesno("MEMBER_SEARCH_MEMBER_PUBLIC_FORM_CREATE", getDolGlobalInt("MEMBER_SEARCH_MEMBER_PUBLIC_FORM_CREATE")); // Reverse the logic "hide -> show" for retrocompatibility print "\n"; print ''; diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 8e91a54f486..28d0c8744da 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -36,6 +36,7 @@ require '../main.inc.php'; /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Societe $mysoc * @var Translate $langs @@ -85,7 +86,7 @@ if (isModEnabled('mailmanspip')) { } $object = new Adherent($db); -$extrafields = new ExtraFields($db); + $upload_dir = null; // fetch optionals attributes and labels diff --git a/htdocs/adherents/cartes/carte.php b/htdocs/adherents/cartes/carte.php index 191cccae92c..95f21f1844d 100644 --- a/htdocs/adherents/cartes/carte.php +++ b/htdocs/adherents/cartes/carte.php @@ -29,6 +29,7 @@ require '../../main.inc.php'; /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user @@ -60,7 +61,6 @@ $mesg = ''; $adherentstatic = new Adherent($db); $object = new Adherent($db); -$extrafields = new ExtraFields($db); // Fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 46433eeca21..04188bc9e1c 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -36,6 +36,7 @@ require '../main.inc.php'; /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user @@ -85,7 +86,7 @@ $search_categ = GETPOST("search_categ", 'intcomma'); $search_morphy = GETPOST("search_morphy", 'alpha'); $search_import_key = trim(GETPOST("search_import_key", 'alpha')); -$socid = GETPOSTINT('socid'); +$socid = GETPOSTINT('socid'); if (GETPOSTINT('catid') && empty($search_categ)) { $search_categ = GETPOSTINT('catid'); } @@ -136,7 +137,7 @@ $object = new Adherent($db); // Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context $hookmanager->initHooks(array('memberlist')); -$extrafields = new ExtraFields($db); + $diroutputmassaction = $conf->member->dir_output.'/temp/massgeneration/'.$user->id; // Fetch optionals attributes and labels diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index ef829fe6268..b56879b06b8 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -34,6 +34,7 @@ require '../main.inc.php'; /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Societe $mysoc * @var Translate $langs @@ -44,7 +45,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; @@ -84,7 +84,7 @@ if (!$sortorder) { } $object = new Adherent($db); -$extrafields = new ExtraFields($db); + $adht = new AdherentType($db); // fetch optionals attributes and labels diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index 0208ae3c228..c6b42441c8f 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -28,19 +28,20 @@ // Load Dolibarr environment require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; -require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; -require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; +require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; +require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; + $langs->loadLangs(array("members", "companies", "banks")); $action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'create'/'add', 'edit'/'update', 'view', ... @@ -88,7 +89,6 @@ if (!$sortfield) { // Initialize a technical objects $object = new Subscription($db); -$extrafields = new ExtraFields($db); $hookmanager->initHooks(array('subscriptionlist')); // Fetch optionals attributes and labels diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 2c992b71f81..f689e560b34 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -36,6 +36,7 @@ require '../main.inc.php'; /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user @@ -43,7 +44,6 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; // Load translation files required by the page @@ -103,7 +103,7 @@ $mail_valid = GETPOST("mail_valid", 'restricthtml'); // Initialize a technical object $object = new AdherentType($db); -$extrafields = new ExtraFields($db); + $hookmanager->initHooks(array('membertypecard', 'globalcard')); // Fetch optionals attributes and labels @@ -1123,9 +1123,9 @@ if ($rowid > 0) { print ''; - print ''; + print ''; - print ''; + print ''; print ''; @@ -1178,7 +1178,7 @@ if ($rowid > 0) { print '"; diff --git a/htdocs/admin/agenda_extrafields.php b/htdocs/admin/agenda_extrafields.php index 8a581ac0fa3..899b5a4fcc5 100644 --- a/htdocs/admin/agenda_extrafields.php +++ b/htdocs/admin/agenda_extrafields.php @@ -29,17 +29,17 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; + if (!$user->admin) { accessforbidden(); } @@ -47,7 +47,6 @@ if (!$user->admin) { // Load translation files required by the page $langs->loadLangs(array('admin', 'other', 'agenda')); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/bank_extrafields.php b/htdocs/admin/bank_extrafields.php index 17ff1082230..b0d6961617c 100644 --- a/htdocs/admin/bank_extrafields.php +++ b/htdocs/admin/bank_extrafields.php @@ -29,21 +29,20 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; + // Load translation files required by the page $langs->loadLangs(array('banks', 'admin')); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/bank_payments_extrafields.php b/htdocs/admin/bank_payments_extrafields.php index b4ca2483f2c..cf69d6f2c8d 100644 --- a/htdocs/admin/bank_payments_extrafields.php +++ b/htdocs/admin/bank_payments_extrafields.php @@ -5,7 +5,7 @@ * Copyright (C) 2012 Regis Houssin * Copyright (C) 2014 Florian Henry * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2022-2025 Frédéric France + * Copyright (C) 2022-2026 Frédéric France * * 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 @@ -30,21 +30,20 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; + // Load translation files required by the page $langs->loadLangs(array("admin", "companies", "bills", "other", "banks")); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/bankline_extrafields.php b/htdocs/admin/bankline_extrafields.php index d8c812d08d4..d5b58630116 100644 --- a/htdocs/admin/bankline_extrafields.php +++ b/htdocs/admin/bankline_extrafields.php @@ -5,7 +5,7 @@ * Copyright (C) 2012 Regis Houssin * Copyright (C) 2014 Florian Henry * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2022-2024 Frédéric France + * Copyright (C) 2022-2026 Frédéric France * * 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 @@ -30,21 +30,20 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; + // Load translation files required by the page $langs->loadLangs(array("admin", "companies", "bills", "other", "banks")); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/bom_extrafields.php b/htdocs/admin/bom_extrafields.php index 01d9ca59dbe..dbba8557312 100644 --- a/htdocs/admin/bom_extrafields.php +++ b/htdocs/admin/bom_extrafields.php @@ -5,7 +5,7 @@ * Copyright (C) 2012 Regis Houssin * Copyright (C) 2014 Florian Henry * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * * 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 @@ -29,21 +29,20 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php'; + // Load translation files required by the page $langs->loadLangs(array('mrp', 'admin')); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/bomline_extrafields.php b/htdocs/admin/bomline_extrafields.php index 8c5126c0ab8..a1fa9a25267 100644 --- a/htdocs/admin/bomline_extrafields.php +++ b/htdocs/admin/bomline_extrafields.php @@ -6,7 +6,7 @@ * Copyright (C) 2012 Regis Houssin * Copyright (C) 2014 Florian Henry * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * * 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 @@ -29,21 +29,20 @@ */ require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT . '/bom/lib/bom.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT . '/bom/lib/bom.lib.php'; + // Load translation files required by the page $langs->loadLangs(array('mrp', 'admin')); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/delivery_extrafields.php b/htdocs/admin/delivery_extrafields.php index 7153e8b2588..10c258affc7 100644 --- a/htdocs/admin/delivery_extrafields.php +++ b/htdocs/admin/delivery_extrafields.php @@ -6,7 +6,7 @@ * Copyright (C) 2012 Florian Henry * Copyright (C) 2013 Philippe Grand * Copyright (C) 2015 Claudio Aschieri - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * * 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 @@ -30,18 +30,17 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/expedition.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/expedition.lib.php'; + if (!$user->admin) { accessforbidden(); } @@ -49,8 +48,6 @@ if (!$user->admin) { // Load translation files required by the page $langs->loadLangs(array('admin', 'other', 'sendings')); - -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/deliverydet_extrafields.php b/htdocs/admin/deliverydet_extrafields.php index d778b547d18..5bf5ae9fd0b 100644 --- a/htdocs/admin/deliverydet_extrafields.php +++ b/htdocs/admin/deliverydet_extrafields.php @@ -7,7 +7,7 @@ * Copyright (C) 2013 Philippe Grand * Copyright (C) 2013 Florian Henry * Copyright (C) 2015 Claudio Aschieri - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * * * This program is free software; you can redistribute it and/or modify @@ -32,18 +32,17 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/expedition.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/expedition.lib.php'; + if (!$user->admin) { accessforbidden(); } @@ -51,7 +50,6 @@ if (!$user->admin) { // Load translation files required by the page $langs->loadLangs(array('admin', 'other', 'sendings')); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index e362285bd91..8ca2705348a 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -12,7 +12,7 @@ * Copyright (C) 2015 Ferran Marcet * Copyright (C) 2016 Raphaël Doursenaud * Copyright (C) 2019-2026 Frédéric France - * Copyright (C) 2020-2022 Open-Dsi + * Copyright (C) 2020-2026 Open-Dsi * Copyright (C) 2024-2025 Charlene Benke * Copyright (C) 2024 MDW * @@ -270,7 +270,7 @@ $tabsql = array(); $tabsql[DICT_FORME_JURIDIQUE] = "SELECT f.rowid as rowid, f.code, f.libelle, c.code as country_code, c.label as country, f.active FROM ".MAIN_DB_PREFIX."c_forme_juridique as f, ".MAIN_DB_PREFIX."c_country as c WHERE f.fk_pays=c.rowid"; $tabsql[DICT_DEPARTEMENTS] = "SELECT d.rowid as rowid, d.code_departement as code, d.nom as libelle, d.fk_region as region_id, r.nom as region, c.code as country_code, c.label as country, d.active FROM ".MAIN_DB_PREFIX."c_departements as d, ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_country as c WHERE d.fk_region=r.code_region and r.fk_pays=c.rowid and r.active=1 and c.active=1"; $tabsql[DICT_REGIONS] = "SELECT r.rowid as rowid, r.code_region as code, r.nom as libelle, r.fk_pays as country_id, c.code as country_code, c.label as country, r.active FROM ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_country as c WHERE r.fk_pays=c.rowid and c.active=1"; -$tabsql[DICT_COUNTRY] = "SELECT c.rowid as rowid, c.code, c.label, c.active, c.favorite, c.eec, c.sepa FROM ".MAIN_DB_PREFIX."c_country AS c"; +$tabsql[DICT_COUNTRY] = "SELECT c.rowid as rowid, c.code, c.label, c.phone_code, c.trunk_prefix, c.active, c.favorite, c.eec, c.sepa FROM ".MAIN_DB_PREFIX."c_country AS c"; $tabsql[DICT_CIVILITY] = "SELECT c.rowid as rowid, c.code as code, c.label, c.active FROM ".MAIN_DB_PREFIX."c_civility AS c"; $tabsql[DICT_ACTIONCOMM] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.type, a.active, a.module, a.color, a.position FROM ".MAIN_DB_PREFIX."c_actioncomm AS a"; $tabsql[DICT_CHARGESOCIALES] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.accountancy_code as accountancy_code, c.code as country_code, c.label as country, a.fk_pays as country_id, a.active FROM ".MAIN_DB_PREFIX."c_chargesociales AS a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_pays = c.rowid and c.active = 1"; @@ -364,7 +364,7 @@ $tabfield = array(); $tabfield[DICT_FORME_JURIDIQUE] = "code,libelle,country"; $tabfield[DICT_DEPARTEMENTS] = "code,libelle,region_id,region,country"; // "code,libelle,region,country_code-country" $tabfield[DICT_REGIONS] = "code,libelle,country_id,country"; -$tabfield[DICT_COUNTRY] = "code,label"; +$tabfield[DICT_COUNTRY] = "code,label,phone_code,trunk_prefix"; $tabfield[DICT_CIVILITY] = "code,label"; $tabfield[DICT_ACTIONCOMM] = "code,libelle,type,color,position"; $tabfield[DICT_CHARGESOCIALES] = "code,libelle,country,accountancy_code"; @@ -411,7 +411,7 @@ $tabfieldvalue = array(); $tabfieldvalue[DICT_FORME_JURIDIQUE] = "code,libelle,country"; $tabfieldvalue[DICT_DEPARTEMENTS] = "code,libelle,region"; // "code,libelle,region" $tabfieldvalue[DICT_REGIONS] = "code,libelle,country"; -$tabfieldvalue[DICT_COUNTRY] = "code,label"; +$tabfieldvalue[DICT_COUNTRY] = "code,label,phone_code,trunk_prefix"; $tabfieldvalue[DICT_CIVILITY] = "code,label"; $tabfieldvalue[DICT_ACTIONCOMM] = "code,libelle,type,color,position"; $tabfieldvalue[DICT_CHARGESOCIALES] = "code,libelle,country,accountancy_code"; @@ -458,7 +458,7 @@ $tabfieldinsert = array(); $tabfieldinsert[DICT_FORME_JURIDIQUE] = "code,libelle,fk_pays"; $tabfieldinsert[DICT_DEPARTEMENTS] = "code_departement,nom,fk_region"; $tabfieldinsert[DICT_REGIONS] = "code_region,nom,fk_pays"; -$tabfieldinsert[DICT_COUNTRY] = "code,label"; +$tabfieldinsert[DICT_COUNTRY] = "code,label,phone_code,trunk_prefix"; $tabfieldinsert[DICT_CIVILITY] = "code,label"; $tabfieldinsert[DICT_ACTIONCOMM] = "code,libelle,type,color,position"; $tabfieldinsert[DICT_CHARGESOCIALES] = "code,libelle,fk_pays,accountancy_code"; @@ -613,7 +613,7 @@ $tabcomplete = array( 'picto' => 'region', 'help' => array('code' => $langs->trans("EnterAnyCode")) ), - 'c_country' => array('picto' => 'country', 'help' => array('code' => $langs->trans("EnterAnyCode"))), + 'c_country' => array('picto' => 'country', 'help' => array('code' => $langs->trans("EnterAnyCode"), 'phone_code' => 'e.g. 33', 'trunk_prefix' => 'e.g. 0')), 'c_civility' => array('picto' => 'contact', 'help' => array('code' => $langs->trans("EnterAnyCode"))), 'c_actioncomm' => array('picto' => 'action', 'help' => array('code' => $langs->trans("EnterAnyCode"), 'color' => $langs->trans("ColorFormat"), 'position' => $langs->trans("PositionIntoComboList"))), 'c_chargesociales' => array('picto' => 'bill', 'help' => array('code' => $langs->trans("EnterAnyCode"))), @@ -2117,6 +2117,12 @@ if ($id > 0) { if ($value == 'country') { $valuetoshow = $langs->trans("Country"); } + if ($value == 'phone_code') { + $valuetoshow = $langs->trans("PhoneCode"); + } + if ($value == 'trunk_prefix') { + $valuetoshow = $langs->trans("TrunkPrefix"); + } if ($value == 'department_buyer') { $valuetoshow = $langs->trans('DepartmentBuyer'); } @@ -2434,7 +2440,7 @@ if ($id > 0) { //var_dump($fieldlist); $class = ''; $showfield = 1; - $valuetoshow = empty($obj->$value) ? '' : $obj->$value; + $valuetoshow = (isset($obj->$value) && $obj->$value !== null && $obj->$value !== '') ? $obj->$value : ''; $titletoshow = ''; if ($value == 'entity') { diff --git a/htdocs/admin/ecm_directories_extrafields.php b/htdocs/admin/ecm_directories_extrafields.php index aaba4e1bf38..c4b6ca1c718 100644 --- a/htdocs/admin/ecm_directories_extrafields.php +++ b/htdocs/admin/ecm_directories_extrafields.php @@ -6,7 +6,7 @@ * Copyright (C) 2012 Florian Henry * Copyright (C) 2013 Philippe Grand * Copyright (C) 2015 Claudio Aschieri - * Copyright (C) 2020-2025 Frédéric France + * Copyright (C) 2020-2026 Frédéric France * * 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 @@ -30,18 +30,17 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/ecm.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/ecm.lib.php'; + if (!$user->admin) { accessforbidden(); } @@ -49,8 +48,6 @@ if (!$user->admin) { // Load translation files required by the page $langs->loadLangs(array('admin', 'other', 'ecm')); - -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/ecm_files_extrafields.php b/htdocs/admin/ecm_files_extrafields.php index c99dc245924..62f36b8b7e3 100644 --- a/htdocs/admin/ecm_files_extrafields.php +++ b/htdocs/admin/ecm_files_extrafields.php @@ -6,7 +6,7 @@ * Copyright (C) 2012 Florian Henry * Copyright (C) 2013 Philippe Grand * Copyright (C) 2015 Claudio Aschieri - * Copyright (C) 2020-2025 Frédéric France + * Copyright (C) 2020-2026 Frédéric France * * 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 @@ -30,18 +30,17 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/ecm.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/ecm.lib.php'; + if (!$user->admin) { accessforbidden(); } @@ -49,8 +48,6 @@ if (!$user->admin) { // Load translation files required by the page $langs->loadLangs(array('admin', 'other', 'ecm')); - -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index 48f803595e2..6280141c458 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -2,7 +2,7 @@ /* Copyright (C) 2018 Laurent Destailleur * Copyright (C) 2022 Charlene Benke * Copyright (C) 2024 MDW - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * * 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 @@ -26,6 +26,15 @@ // Load Dolibarr environment require '../main.inc.php'; +/** + * @var Conf $conf + * @var DoliDB $db + * @var ExtraFields $extrafields + * @var HookManager $hookmanager + * @var Translate $langs + * @var User $user + */ + require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/events.class.php'; @@ -44,14 +53,6 @@ use Webklex\PHPIMAP\Exceptions\ConnectionFailedException; use OAuth\Common\Storage\DoliStorage; use OAuth\Common\Consumer\Credentials; -/** - * @var Conf $conf - * @var DoliDB $db - * @var HookManager $hookmanager - * @var Translate $langs - * @var User $user - */ - if (!$user->admin) { accessforbidden(); } @@ -64,10 +65,10 @@ $langs->loadLangs(array("admin", "mails", "other")); // Get parameters $id = GETPOSTINT('id'); -$ref = GETPOST('ref', 'alpha'); +$ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); -$confirm = GETPOST('confirm', 'alpha'); -$cancel = GETPOST('cancel', 'alpha'); +$confirm = GETPOST('confirm', 'alpha'); +$cancel = GETPOST('cancel', 'alpha'); $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'emailcollectorcard'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); @@ -75,7 +76,7 @@ $operationid = GETPOSTINT('operationid'); // Initialize a technical objects $object = new EmailCollector($db); -$extrafields = new ExtraFields($db); + $diroutputmassaction = $conf->emailcollector->dir_output.'/temp/massgeneration/'.$user->id; $hookmanager->initHooks(array('emailcollectorcard')); // Note that conf->hooks_modules contains array diff --git a/htdocs/admin/emailcollector_list.php b/htdocs/admin/emailcollector_list.php index 0804c08b499..c63e9c66690 100644 --- a/htdocs/admin/emailcollector_list.php +++ b/htdocs/admin/emailcollector_list.php @@ -1,7 +1,7 @@ * Copyright (C) 2024 Alexandre Spangaro - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -29,10 +29,12 @@ require '../main.inc.php'; /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ + require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/events.class.php'; @@ -77,7 +79,7 @@ $pagenext = $page + 1; // Initialize a technical objects $object = new EmailCollector($db); -$extrafields = new ExtraFields($db); + $diroutputmassaction = $conf->emailcollector->dir_output.'/temp/massgeneration/'.$user->id; $hookmanager->initHooks(array('emailcollectorlist')); // Note that conf->hooks_modules contains array diff --git a/htdocs/admin/eventorganization_confbooth_extrafields.php b/htdocs/admin/eventorganization_confbooth_extrafields.php index 8cef64b5db8..eea0bc383ba 100644 --- a/htdocs/admin/eventorganization_confbooth_extrafields.php +++ b/htdocs/admin/eventorganization_confbooth_extrafields.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * * 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 @@ -24,21 +24,20 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/eventorganization.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/eventorganization.lib.php'; + // Load translation files required by the page $langs->loadLangs(array('eventorganization', 'admin')); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/eventorganization_confboothattendee_extrafields.php b/htdocs/admin/eventorganization_confboothattendee_extrafields.php index d33db8b1863..2c436b0f912 100644 --- a/htdocs/admin/eventorganization_confboothattendee_extrafields.php +++ b/htdocs/admin/eventorganization_confboothattendee_extrafields.php @@ -5,7 +5,7 @@ * Copyright (C) 2012 Regis Houssin * Copyright (C) 2014 Florian Henry * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * * 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 @@ -27,21 +27,20 @@ * \brief Page to setup extra fields of conferenceorboothattendee */ require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/eventorganization.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/eventorganization.lib.php'; + // Load translation files required by the page $langs->loadLangs(array('eventorganization', 'admin')); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/expedition_extrafields.php b/htdocs/admin/expedition_extrafields.php index 63cb11e4335..c32d710f432 100644 --- a/htdocs/admin/expedition_extrafields.php +++ b/htdocs/admin/expedition_extrafields.php @@ -6,7 +6,7 @@ * Copyright (C) 2012 Florian Henry * Copyright (C) 2013 Philippe Grand * Copyright (C) 2015 Claudio Aschieri - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * * 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 @@ -30,18 +30,17 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/expedition.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/expedition.lib.php'; + if (!$user->admin) { accessforbidden(); } @@ -49,8 +48,6 @@ if (!$user->admin) { // Load translation files required by the page $langs->loadLangs(array('admin', 'other', 'sendings')); - -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/expeditiondet_extrafields.php b/htdocs/admin/expeditiondet_extrafields.php index b8d2d5f0093..b2ada94d6a8 100644 --- a/htdocs/admin/expeditiondet_extrafields.php +++ b/htdocs/admin/expeditiondet_extrafields.php @@ -7,7 +7,7 @@ * Copyright (C) 2013 Philippe Grand * Copyright (C) 2013 Florian Henry * Copyright (C) 2015 Claudio Aschieri - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * * * This program is free software; you can redistribute it and/or modify @@ -32,18 +32,17 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/expedition.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/expedition.lib.php'; + if (!$user->admin) { accessforbidden(); } @@ -51,7 +50,6 @@ if (!$user->admin) { // Load translation files required by the page $langs->loadLangs(array('admin', 'other', 'sendings')); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/expensereport_extrafields.php b/htdocs/admin/expensereport_extrafields.php index c3690d4a80c..9b43a03bbf1 100644 --- a/htdocs/admin/expensereport_extrafields.php +++ b/htdocs/admin/expensereport_extrafields.php @@ -5,7 +5,7 @@ * Copyright (C) 2012 Regis Houssin * Copyright (C) 2012 Florian Henry * Copyright (C) 2013 Philippe Grand - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * * 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 @@ -29,17 +29,17 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/expensereport.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/expensereport.lib.php'; + if (!$user->admin) { accessforbidden(); } @@ -47,7 +47,6 @@ if (!$user->admin) { // Load translation files required by the page $langs->loadLangs(array('admin', 'errors', 'trips', 'other')); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/holiday_extrafields.php b/htdocs/admin/holiday_extrafields.php index eb052884c32..e3c8329c9e3 100644 --- a/htdocs/admin/holiday_extrafields.php +++ b/htdocs/admin/holiday_extrafields.php @@ -5,7 +5,7 @@ * Copyright (C) 2012 Regis Houssin * Copyright (C) 2012 Florian Henry * Copyright (C) 2013 Philippe Grand - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * * 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 @@ -29,17 +29,17 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/holiday.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/holiday.lib.php'; + if (!$user->admin) { accessforbidden(); } @@ -47,7 +47,6 @@ if (!$user->admin) { // Load translation files required by the page $langs->loadLangs(array('admin', 'errors', 'holiday', 'other')); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/knowledgerecord_extrafields.php b/htdocs/admin/knowledgerecord_extrafields.php index d5fbaed92de..04ff49ab83d 100644 --- a/htdocs/admin/knowledgerecord_extrafields.php +++ b/htdocs/admin/knowledgerecord_extrafields.php @@ -5,7 +5,7 @@ * Copyright (C) 2012 Regis Houssin * Copyright (C) 2014 Florian Henry * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * * 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 @@ -29,22 +29,20 @@ // Load Dolibarr environment require '../main.inc.php'; - -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; -require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/lib/knowledgemanagement.lib.php'; - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/lib/knowledgemanagement.lib.php'; + // Load translation files required by the page $langs->loadLangs(array('knowledgemanagement', 'admin')); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/mails_senderprofile_list.php b/htdocs/admin/mails_senderprofile_list.php index a6fd6e20dff..18f2aa5807d 100644 --- a/htdocs/admin/mails_senderprofile_list.php +++ b/htdocs/admin/mails_senderprofile_list.php @@ -1,7 +1,7 @@ * Copyright (C) 2018 Ferran Marcet - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -29,10 +29,12 @@ require '../main.inc.php'; /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; @@ -70,7 +72,7 @@ $pagenext = $page + 1; // Initialize a technical objects $object = new EmailSenderProfile($db); -$extrafields = new ExtraFields($db); + $diroutputmassaction = $conf->admin->dir_output.'/temp/massgeneration/'.$user->id; $hookmanager->initHooks(array('emailsenderprofilelist')); // Note that conf->hooks_modules contains array diff --git a/htdocs/admin/mrp_extrafields.php b/htdocs/admin/mrp_extrafields.php index 066fb9fe0bc..a2c7065ecbd 100644 --- a/htdocs/admin/mrp_extrafields.php +++ b/htdocs/admin/mrp_extrafields.php @@ -6,7 +6,7 @@ * Copyright (C) 2014 Florian Henry * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2024 MDW - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * * 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 @@ -30,21 +30,20 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/mrp/lib/mrp.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/mrp/lib/mrp.lib.php'; + // Load translation files required by the page $langs->loadLangs(array('mrp', 'admin')); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/mrp_production_extrafields.php b/htdocs/admin/mrp_production_extrafields.php index 9febcda909e..3dde686582f 100644 --- a/htdocs/admin/mrp_production_extrafields.php +++ b/htdocs/admin/mrp_production_extrafields.php @@ -5,7 +5,7 @@ * Copyright (C) 2012 Regis Houssin * Copyright (C) 2014 Florian Henry * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * * 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 @@ -29,21 +29,20 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/mrp/lib/mrp.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/mrp/lib/mrp.lib.php'; + // Load translation files required by the page $langs->loadLangs(array('mrp', 'admin')); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/order_extrafields.php b/htdocs/admin/order_extrafields.php index feaba5590ef..f1e34cd0da3 100644 --- a/htdocs/admin/order_extrafields.php +++ b/htdocs/admin/order_extrafields.php @@ -5,7 +5,7 @@ * Copyright (C) 2012 Regis Houssin * Copyright (C) 2012 Florian Henry * Copyright (C) 2013 Philippe Grand - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * * 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 @@ -29,18 +29,17 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php'; + if (!$user->admin) { accessforbidden(); } @@ -48,7 +47,6 @@ if (!$user->admin) { // Load translation files required by the page $langs->loadLangs(array('admin', 'other', 'orders')); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/orderdet_extrafields.php b/htdocs/admin/orderdet_extrafields.php index 636f2fd264d..f6a3a676f5e 100644 --- a/htdocs/admin/orderdet_extrafields.php +++ b/htdocs/admin/orderdet_extrafields.php @@ -6,7 +6,7 @@ * Copyright (C) 2012 Florian Henry * Copyright (C) 2013 Philippe Grand * Copyright (C) 2013 Florian Henry - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * * 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 @@ -30,18 +30,17 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php'; + if (!$user->admin) { accessforbidden(); } @@ -49,7 +48,6 @@ if (!$user->admin) { // Load translation files required by the page $langs->loadlangs(array('admin', 'other', 'orders')); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/pdf_other.php b/htdocs/admin/pdf_other.php index 6f51b283fc9..04f4fd52cda 100644 --- a/htdocs/admin/pdf_other.php +++ b/htdocs/admin/pdf_other.php @@ -260,7 +260,7 @@ print ''; print ''; if (isModEnabled('propal')) { - print '
'; + print '
'; print load_fiche_titre($langs->trans("Proposal"), '', 'proposal'); print '
'; @@ -350,7 +350,7 @@ if (isModEnabled('propal')) { } if (isModEnabled('order')) { - print '
'; + print '
'; $langs->load("orders"); print load_fiche_titre($langs->trans('CustomersOrders'), '', 'order'); @@ -430,7 +430,7 @@ if (isModEnabled('order')) { } if (isModEnabled('contract')) { - print '
'; + print '
'; print load_fiche_titre($langs->trans("Contract"), '', 'contract'); print '
'; @@ -474,7 +474,7 @@ if (isModEnabled('contract')) { if (isModEnabled('invoice')) { - print '
'; + print '
'; print load_fiche_titre($langs->trans("Invoices"), '', 'bill'); diff --git a/htdocs/admin/reception_extrafields.php b/htdocs/admin/reception_extrafields.php index 26103d779a9..96407bc6351 100644 --- a/htdocs/admin/reception_extrafields.php +++ b/htdocs/admin/reception_extrafields.php @@ -7,7 +7,7 @@ * Copyright (C) 2013 Philippe Grand * Copyright (C) 2015 Claudio Aschieri * Copyright (C) 2018 Quentin Vial-Gouteyron - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * * 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 @@ -31,26 +31,23 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/reception.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/reception.lib.php'; + if (!$user->admin) { accessforbidden(); } $langs->loadLangs(array("admin", "other", "receptions", "sendings")); - -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/receptiondet_batch_extrafields.php b/htdocs/admin/receptiondet_batch_extrafields.php index 93864b69edd..73270c31b83 100644 --- a/htdocs/admin/receptiondet_batch_extrafields.php +++ b/htdocs/admin/receptiondet_batch_extrafields.php @@ -8,7 +8,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2015 Claudio Aschieri * Copyright (C) 2018 Quentin Vial-Gouteyron - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * * * This program is free software; you can redistribute it and/or modify @@ -33,27 +33,23 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/reception.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/reception.lib.php'; + if (!$user->admin) { accessforbidden(); } -$langs->load("admin"); -$langs->load("other"); -$langs->load("receptions"); +$langs->loadLangs(["admin", "other", "receptions"]); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/resource_extrafields.php b/htdocs/admin/resource_extrafields.php index 6d3b3806d82..4f0ca407645 100644 --- a/htdocs/admin/resource_extrafields.php +++ b/htdocs/admin/resource_extrafields.php @@ -4,7 +4,7 @@ * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2012 Regis Houssin * Copyright (C) 2016 Florian Henry - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * * 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 @@ -28,18 +28,17 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/resource.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/resource.lib.php'; + if (!$user->admin) { accessforbidden(); } @@ -47,7 +46,6 @@ if (!$user->admin) { // Load translation files required by the page $langs->loadLangs(array('admin', 'other', 'resource')); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/subtotals.php b/htdocs/admin/subtotals.php index 924ae671178..85037b98af3 100644 --- a/htdocs/admin/subtotals.php +++ b/htdocs/admin/subtotals.php @@ -3,7 +3,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2012-2013 Juanjo Menent * Copyright (C) 2019 Christophe Battarel - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * Copyright (C) 2024 MDW * Copyright (C) 2025 Charlene Benke * @@ -29,11 +29,6 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/core/lib/doleditor.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; - /** * @var Conf $conf * @var DoliDB $db @@ -43,6 +38,11 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; * @var User $user */ +require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/doleditor.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; + // Load translation files required by the page $langs->loadLangs(array('main', 'admin', 'subtotals', 'errors')); $action = GETPOST('action', 'aZ09'); diff --git a/htdocs/admin/taxes.php b/htdocs/admin/taxes.php index b3c3b60a579..206ce16e180 100644 --- a/htdocs/admin/taxes.php +++ b/htdocs/admin/taxes.php @@ -5,7 +5,7 @@ * Copyright (C) 2011-2013 Juanjo Menent * Copyright (C) 2015-2022 Alexandre Spangaro * Copyright (C) 2023 Joachim Kueter - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -30,11 +30,6 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; -if (isModEnabled('accounting')) { - require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; -} - /** * @var Conf $conf * @var DoliDB $db @@ -43,6 +38,11 @@ if (isModEnabled('accounting')) { * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +if (isModEnabled('accounting')) { + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; +} + // Load translation files required by the page $langs->loadLangs(array('admin', 'objects', 'companies', 'products')); diff --git a/htdocs/admin/ticket_extrafields.php b/htdocs/admin/ticket_extrafields.php index 5cfba7fd924..9c989c8e543 100644 --- a/htdocs/admin/ticket_extrafields.php +++ b/htdocs/admin/ticket_extrafields.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * * 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 @@ -24,22 +24,21 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT."/core/lib/ticket.lib.php"; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT."/core/lib/ticket.lib.php"; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; + // Load translation files required by the page $langs->loadLangs(array('ticket', 'admin')); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/admin/user.php b/htdocs/admin/user.php index 5cf7b347ea2..b0dcc265497 100644 --- a/htdocs/admin/user.php +++ b/htdocs/admin/user.php @@ -6,7 +6,7 @@ * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2015 Juanjo Menent - * Copyright (C) 2020-2025 Frédéric France + * Copyright (C) 2020-2026 Frédéric France * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -34,20 +34,18 @@ require '../main.inc.php'; /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ + require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - // Load translation files required by the page $langs->loadLangs(array('admin', 'members', 'users')); -$extrafields = new ExtraFields($db); // may be used by some inc.php files - $action = GETPOST('action', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); $modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php diff --git a/htdocs/admin/usergroup.php b/htdocs/admin/usergroup.php index 7c0303b34dd..e23b607935c 100644 --- a/htdocs/admin/usergroup.php +++ b/htdocs/admin/usergroup.php @@ -7,7 +7,7 @@ * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2015 Juanjo Menent * Copyright (C) 2024-2025 MDW - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * * 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 @@ -31,26 +31,24 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; + // Load translation files required by the page $langs->loadLangs(array("admin", "members", "users")); if (!$user->admin) { accessforbidden(); } -$extrafields = new ExtraFields($db); - $action = GETPOST('action', 'aZ09'); $value = GETPOST('value', 'alpha'); $modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php diff --git a/htdocs/admin/workstation_extrafields.php b/htdocs/admin/workstation_extrafields.php index 193bd173afc..65756b04928 100644 --- a/htdocs/admin/workstation_extrafields.php +++ b/htdocs/admin/workstation_extrafields.php @@ -5,7 +5,7 @@ * Copyright (C) 2012 Regis Houssin * Copyright (C) 2014 Florian Henry * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * * 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 @@ -29,22 +29,20 @@ // Load Dolibarr environment require "../main.inc.php"; - -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; -require_once DOL_DOCUMENT_ROOT.'/workstation/lib/workstation.lib.php'; - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/workstation/lib/workstation.lib.php'; + // Load translation files required by the page $langs->loadLangs(array('workstation', 'admin')); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/ai/ajax/generate_content.php b/htdocs/ai/ajax/generate_content.php index 9c32a6a7d6d..bbab82b0862 100644 --- a/htdocs/ai/ajax/generate_content.php +++ b/htdocs/ai/ajax/generate_content.php @@ -112,7 +112,14 @@ if (empty($instructions)) { } } else { if ($function == 'textgenerationemail' || $function == 'textgenerationwebpage') { - print dolPrintHTML($generatedContent); // Note that common HTML tags are NOT escaped (but a sanitization is done) + if ($format == 'html') { + print dolPrintHTML($generatedContent); // Note that common HTML tags are NOT escaped (but a sanitization is done) + } else { + // We must not use dolPrintText because dolPrintText format data including accent in htmlentities for a HTML output. We need a non formatted output. + //print dol_string_onlythesehtmltags('"Ça va" est une expression française et ceci une balise html', 1, 1, 1); + print dol_string_onlythesehtmltags($generatedContent, 1, 1, 1); + //print dol_string_nohtmltag($generatedContent); + } } elseif ($function == 'imagegeneration') { // TODO } elseif ($function == 'videogeneration') { diff --git a/htdocs/ai/class/ai.class.php b/htdocs/ai/class/ai.class.php index 64b82e98f4b..3905b62818f 100644 --- a/htdocs/ai/class/ai.class.php +++ b/htdocs/ai/class/ai.class.php @@ -54,11 +54,11 @@ class Ai */ private $apiEndpoint; - const AI_DEFAULT_PROMPT_FOR_EMAIL = 'You are an email editor. Return all HTML content inside a section tag. Do not add explanation.'; + const AI_DEFAULT_PROMPT_FOR_EMAIL = 'You are an email editor. Return only the content of the message. Do not add explanation.'; // Note: This instruction will also be completed by generateContent() to manage text versus HTML content. const AI_DEFAULT_PROMPT_FOR_WEBPAGE = 'You are a website editor. Return all HTML content inside a section tag. Do not add explanation.'; const AI_DEFAULT_PROMPT_FOR_TEXT_TRANSLATION = 'You are a translator, answer with one and only one translation with no comment and explanation.'; const AI_DEFAULT_PROMPT_FOR_TEXT_SUMMARIZE = 'You are a writer, make the answer in the same language than the original text to summarize.'; - const AI_DEFAULT_PROMPT_FOR_TEXT_REPHRASER = 'You are a writer, give only one answer with no comment and explanation and give the answer in the same language than the original text to rephrase.'; + const AI_DEFAULT_PROMPT_FOR_TEXT_REPHRASER = 'You are a writer, give only one answer with no comment and explanation and give the answer in the same language than the original text to rephrase. If there is carriage return or line feed in original message, keep them.'; const AI_DEFAULT_PROMPT_FOR_EXTRAFIELD_FILLER = 'Give only one answer with no comment and explanation, I want the text to be ready to copy and paste.'; const AI_DEFAULT_PROMPT_FOR_DOC_PARSING = 'You are an assistant to analyze documents. Return your answer with a JSON string and only a JSON string, do not add any other comment.'; const AI_DEFAULT_PROMPT_FOR_TEXT_SPELLCHECKER = 'You are the proofreader, please write your response in the same language as the original text in order to correct spelling and grammar errors.'; @@ -90,7 +90,7 @@ class Ai } /** - * Generate response of instructions + * Generate the response of an AI prompt. * * @param string|array $instructions String instruction to generate content (or file path) or array of payload or ID of file with function threads * @param string $model Model name ('gpt-4.1-turbo', 'gpt-4.1', 'dall-e-3', ...) @@ -147,6 +147,7 @@ class Ai $this->apiEndpoint .= '/'.$moreendpoint; } + // $model may be undefined or 'auto'. // If this is the case, we must get it from $function and $this->apiService if (empty($model) || $model == 'auto') { @@ -169,7 +170,19 @@ class Ai } } - dol_syslog("Call API for apiKey=".substr($this->apiKey, 0, 5).'***********, apiEndpoint='.$this->apiEndpoint.", model=".$model); + dol_syslog("Call API for apiKey=".substr($this->apiKey, 0, 5).'***********, apiEndpoint='.$this->apiEndpoint.", model=".$model.", format=".$format); + if (getDolGlobalString("AI_DEBUG")) { + if (@is_writable($dolibarr_main_data_root)) { // Avoid fatal error on fopen with open_basedir + $outputfile = $dolibarr_main_data_root."/dolibarr_ai.log"; + $fp = fopen($outputfile, "w"); // overwrite + + if ($fp) { + fwrite($fp, "Call API for apiKey=".substr($this->apiKey, 0, 5).'***********, apiEndpoint='.$this->apiEndpoint.", model=".$model.", format=".$format."\n"); + fclose($fp); + dolChmod($outputfile); + } + } + } $response = null; @@ -193,10 +206,16 @@ class Ai $postPrompt = $configurations[$function]['postPrompt']; } } + //var_dump($prePrompt); // Get the default value of prePrompt if not defined if (empty($prePrompt) && $function == 'textgenerationemail') { $prePrompt = self::AI_DEFAULT_PROMPT_FOR_EMAIL; + if ($format === 'html') { + $prePrompt .= ' Return all HTML content inside a section tag'; + } else { + $prePrompt .= ' Return content in UTF8 text. Use Linux carriage return if you need to split a line. Do not include any HTML tag neither HTML entities.'; + } } if (empty($prePrompt) && $function == 'textgenerationwebpage') { $prePrompt = self::AI_DEFAULT_PROMPT_FOR_WEBPAGE; @@ -289,7 +308,7 @@ class Ai if (getDolGlobalString("AI_DEBUG")) { if (@is_writable($dolibarr_main_data_root)) { // Avoid fatal error on fopen with open_basedir $outputfile = $dolibarr_main_data_root."/dolibarr_ai.log"; - $fp = fopen($outputfile, "w"); // overwrite + $fp = fopen($outputfile, "a"); if ($fp) { if ($function == 'docparsing') { diff --git a/htdocs/api/class/api_login.class.php b/htdocs/api/class/api_login.class.php index c4e87367afb..0d1b7dc6390 100644 --- a/htdocs/api/class/api_login.class.php +++ b/htdocs/api/class/api_login.class.php @@ -41,7 +41,7 @@ class Login global $db; $this->db = $db; - if (getDolGlobalString('API_ENABLE_LOGIN_API')) { + if (!getDolGlobalInt('API_ENABLE_LOGIN_API')) { throw new RestException(403, "Error: The login APIs are disabled. It is recommended to call the APIs using the DOLAPIKEY token of an allowed user instead of the login/password. API key can be set from the user card. If you really need to get the API token from the login API, you can set the constant API_ENABLE_LOGIN_API."); } } @@ -186,7 +186,7 @@ class Login 'success' => array( 'code' => 200, 'token' => $token, - 'entity' => $tmpuser->entity, + 'entity' => $tmpuser->entity ?? 1, 'message' => 'Welcome '.$login.($reset ? ' - Token is new' : ' - This is your token (recorded for your user). You can use it to make any REST API call, or enter it into the DOLAPIKEY field to use the Dolibarr API explorer.') ) ); diff --git a/htdocs/asset/accountancy_codes.php b/htdocs/asset/accountancy_codes.php index 82c6f58207b..5aa4a793c83 100644 --- a/htdocs/asset/accountancy_codes.php +++ b/htdocs/asset/accountancy_codes.php @@ -1,7 +1,7 @@ * Copyright (C) 2018 Alexandre Spangaro - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * * 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 @@ -25,19 +25,20 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT . '/core/lib/asset.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/asset/class/asset.class.php'; -require_once DOL_DOCUMENT_ROOT . '/asset/class/assetaccountancycodes.class.php'; -require_once DOL_DOCUMENT_ROOT . '/asset/class/assetdepreciationoptions.class.php'; - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT . '/core/lib/asset.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/asset/class/asset.class.php'; +require_once DOL_DOCUMENT_ROOT . '/asset/class/assetaccountancycodes.class.php'; +require_once DOL_DOCUMENT_ROOT . '/asset/class/assetdepreciationoptions.class.php'; + // Load translation files required by the page $langs->loadLangs(array("assets", "companies")); @@ -53,7 +54,7 @@ $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); $object = new Asset($db); $assetaccountancycodes = new AssetAccountancyCodes($db); $assetdepreciationoptions = new AssetDepreciationOptions($db); -$extrafields = new ExtraFields($db); + $diroutputmassaction = $conf->asset->dir_output . '/temp/massgeneration/' . $user->id; $hookmanager->initHooks(array('assetaccountancycodes', 'globalcard')); // Note that conf->hooks_modules contains array // Fetch optionals attributes and labels diff --git a/htdocs/asset/agenda.php b/htdocs/asset/agenda.php index a8a8b3d0e21..f2a58bb0798 100644 --- a/htdocs/asset/agenda.php +++ b/htdocs/asset/agenda.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * Copyright (C) 2025 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify @@ -28,10 +28,12 @@ require '../main.inc.php'; /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ + require_once DOL_DOCUMENT_ROOT.'/core/lib/asset.lib.php'; require_once DOL_DOCUMENT_ROOT.'/asset/class/asset.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; @@ -79,7 +81,7 @@ if (!$sortorder) { // Initialize a technical objects $object = new Asset($db); -$extrafields = new ExtraFields($db); + $diroutputmassaction = $conf->asset->dir_output.'/temp/massgeneration/'.$user->id; $hookmanager->initHooks(array('assetagenda', 'globalcard')); // Note that conf->hooks_modules contains array // Fetch optionals attributes and labels diff --git a/htdocs/asset/card.php b/htdocs/asset/card.php index 6d7c7b9ad60..626f315b22c 100644 --- a/htdocs/asset/card.php +++ b/htdocs/asset/card.php @@ -2,7 +2,7 @@ /* Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2018-2025 Alexandre Spangaro * Copyright (C) 2024-2025 Frédéric France - * Copyright (C) 2025 MDW + * Copyright (C) 2025-2026 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 @@ -198,7 +198,7 @@ if ($action == 'create') { print ''; } if (GETPOSTISSET('supplier_invoice_id')) { - $object->fields['supplier_invoice_id'] = array('type' => 'integer:FactureFournisseur:fourn/class/fournisseur.facture.class.php:1:entity IN (__SHARED_ENTITIES__)', 'label' => 'SupplierInvoice', 'enabled' => '1', 'noteditable' => 1, 'position' => 280, 'notnull' => 0, 'visible' => 1, 'index' => 1, 'validate' => '1',); + $object->fields['supplier_invoice_id'] = array('type' => 'integer:FactureFournisseur:fourn/class/fournisseur.facture.class.php:1:entity IN (__SHARED_ENTITIES__)', 'label' => 'SupplierInvoice', 'enabled' => '1', 'noteditable' => 1, 'position' => 280, 'notnull' => 0, 'visible' => 1, 'index' => 1, 'validate' => 1,); print ''; } diff --git a/htdocs/asset/model/note.php b/htdocs/asset/model/note.php index 5fa63a2f7a8..25b3f88aeac 100644 --- a/htdocs/asset/model/note.php +++ b/htdocs/asset/model/note.php @@ -1,7 +1,7 @@ * Copyright (C) 2018 Alexandre Spangaro - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * * 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 @@ -25,17 +25,18 @@ // Load Dolibarr environment require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT . '/core/lib/asset.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/asset/class/assetmodel.class.php'; - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT . '/core/lib/asset.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/asset/class/assetmodel.class.php'; + // Load translation files required by the page $langs->loadLangs(array("assets", "companies")); @@ -48,7 +49,7 @@ $backtopage = GETPOST('backtopage', 'alpha'); // Initialize a technical objects $object = new AssetModel($db); -$extrafields = new ExtraFields($db); + $diroutputmassaction = $conf->asset->dir_output . '/temp/massgeneration/' . $user->id; $hookmanager->initHooks(array('assetmodelnote', 'globalcard')); // Note that conf->hooks_modules contains array // Fetch optionals attributes and labels diff --git a/htdocs/bookmarks/list.php b/htdocs/bookmarks/list.php index 579cc7889a0..4b56bf866a5 100644 --- a/htdocs/bookmarks/list.php +++ b/htdocs/bookmarks/list.php @@ -25,16 +25,17 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php'; - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php'; + // Load translation files required by the page $langs->loadLangs(array('other', 'admin')); @@ -74,7 +75,7 @@ if (!$sortorder) { // Initialize Objects $object = new Bookmark($db); -$extrafields = new ExtraFields($db); + $arrayfields = array(); $hookmanager->initHooks(array('bookmarklist')); // Note that conf->hooks_modules contains array diff --git a/htdocs/categories/admin/categorie_extrafields.php b/htdocs/categories/admin/categorie_extrafields.php index f730c09dc1d..48fbd3eacbe 100644 --- a/htdocs/categories/admin/categorie_extrafields.php +++ b/htdocs/categories/admin/categorie_extrafields.php @@ -3,7 +3,7 @@ * Copyright (C) 2003 Jean-Louis Bergamo * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2012 Regis Houssin - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * * 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 @@ -27,21 +27,20 @@ // Load Dolibarr environment require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/categories.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/categories.lib.php'; + // Load translation files required by the page $langs->loadLangs(array('categories', 'admin')); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/categories/admin/categorie_lang_extrafields.php b/htdocs/categories/admin/categorie_lang_extrafields.php new file mode 100644 index 00000000000..953bd871a59 --- /dev/null +++ b/htdocs/categories/admin/categorie_lang_extrafields.php @@ -0,0 +1,128 @@ + + * Copyright (C) 2003 Jean-Louis Bergamo + * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2014 Florian Henry + * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2026 Frédéric France + * + * 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 + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file admin/categorie_lang_extrafields.php + * \ingroup categorie + * \brief Page to setup extra fields of categorie lang + */ + +// Load Dolibarr environment +require '../../main.inc.php'; + +/** + * @var Conf $conf + * @var DoliDB $db + * @var ExtraFields $extrafields + * @var HookManager $hookmanager + * @var Translate $langs + * @var User $user + */ + +require_once DOL_DOCUMENT_ROOT.'/core/lib/categories.lib.php'; + +// Load translation files required by the page +$langs->loadLangs(array('admin', 'categories')); + +$form = new Form($db); + +// List of supported format +$tmptype2label = ExtraFields::$type2label; +$type2label = array(''); +foreach ($tmptype2label as $key => $val) { + $type2label[$key] = $langs->transnoentitiesnoconv($val); +} + +$action = GETPOST('action', 'aZ09'); +$attrname = GETPOST('attrname', 'alpha'); +$elementtype = 'categorie_lang'; // Must be the $table_element of the class that manage extrafield + +if (!$user->admin) { + accessforbidden(); +} + + +/* + * Actions + */ + +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; + + + +/* + * View + */ + +$textobject = $langs->transnoentitiesnoconv("Category"); + +$help_url = ''; +$page_name = "CategoriesTranslationsExtrafields"; + +llxHeader('', $langs->trans($page_name), $help_url); + + +$linkback = ''.$langs->trans("BackToModuleList").''; +print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup'); + + +$head = categoriesadmin_prepare_head(); + +print dol_get_fiche_head($head, 'translationAttributes', $langs->trans($page_name), -1, 'categorie'); + +require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; + +print dol_get_fiche_end(); + + +// Buttons +if ($action != 'create' && $action != 'edit') { + print '
'; + print ''.$langs->trans("NewAttribute").''; + print "
"; +} + + +/* + * Creation of an optional field + */ +if ($action == 'create') { + print '
'; + print load_fiche_titre($langs->trans('NewAttribute')); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; +} + +/* + * Edition of an optional field + */ +if ($action == 'edit' && !empty($attrname)) { + print "
"; + print load_fiche_titre($langs->trans("FieldEdition", $attrname)); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; +} + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/categories/card.php b/htdocs/categories/card.php index 0127c4a6ede..9d70b0a8ab8 100644 --- a/htdocs/categories/card.php +++ b/htdocs/categories/card.php @@ -5,7 +5,7 @@ * Copyright (C) 2007 Patrick Raguin * Copyright (C) 2013 Florian Henry * Copyright (C) 2015 Raphaël Doursenaud - * Copyright (C) 2020-2024 Frédéric France + * Copyright (C) 2020-2026 Frédéric France * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -30,18 +30,18 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; + // Load translation files required by the page $langs->load("categories"); @@ -104,7 +104,6 @@ if (!GETPOSTISSET('parent') && $catorigin) { $object = new Categorie($db); -$extrafields = new ExtraFields($db); $extrafields->fetch_name_optionals_label($object->table_element); // Initialize a technical object to manage hooks. Note that conf->hooks_modules contains array array diff --git a/htdocs/categories/categorie_list.php b/htdocs/categories/categorie_list.php index c5e2e989573..20fdef48fa7 100644 --- a/htdocs/categories/categorie_list.php +++ b/htdocs/categories/categorie_list.php @@ -1,7 +1,7 @@ - * Copyright (C) 2024-2025 Frédéric France - * Copyright (C) 2025 MDW + * Copyright (C) 2024-2026 Frédéric France + * Copyright (C) 2025-2026 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 @@ -25,20 +25,21 @@ // Load Dolibarr environment require '../main.inc.php'; +/** + * @var Conf $conf + * @var DoliDB $db + * @var ExtraFields $extrafields + * @var HookManager $hookmanager + * @var Translate $langs + * @var User $user + */ + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/treeview.lib.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; -/** - * @var Conf $conf - * @var DoliDB $db - * @var HookManager $hookmanager - * @var Translate $langs - * @var User $user - */ - // Load translation files required by the page $langs->loadLangs(array("accountancy", "agenda", "banks", "bills", "categories", "contracts", "interventions", "mrp")); $langs->loadLangs(array("knowledgemanagement", "members", "orders", "products", "stocks", "suppliers", "tickets")); @@ -84,7 +85,7 @@ $pagenext = $page + 1; // Initialize technical objects $object = new Categorie($db); -$extrafields = new ExtraFields($db); + $diroutputmassaction = $conf->category->dir_output.'/temp/massgeneration/'.$user->id; $hookmanager->initHooks(array($contextpage)); // Note that conf->hooks_modules contains array of activated contexes @@ -282,9 +283,6 @@ foreach ($search as $key => $val) { continue; } $field_spec = $object->fields[$key]; - if ($field_spec === null) { - continue; - } $mode_search = (($object->isInt($field_spec) || $object->isFloat($field_spec)) ? 1 : 0); if ((strpos($field_spec['type'], 'integer:') === 0) || (strpos($field_spec['type'], 'sellist:') === 0) || !empty($field_spec['arrayofkeyval'])) { if ($search[$key] == '-1' || ($search[$key] === '0' && !isset($field_spec['arrayofkeyval']['0']))) { diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 53ccd935391..f33640e4732 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -663,11 +663,11 @@ class Categorie extends CommonObject /** * Update category * - * @param User $user Object user - * @param int $notrigger 1=Does not execute triggers, 0= execute triggers - * @return int 1 : OK - * -1 : SQL error - * -2 : invalid category + * @param User $user Object user + * @param int<0,1> $notrigger 1=Does not execute triggers, 0= execute triggers + * @return int<-2,1> 1 : OK + * -1 : SQL error + * -2 : invalid category */ public function update(User $user, $notrigger = 0) { @@ -706,6 +706,14 @@ class Categorie extends CommonObject dol_syslog(get_class($this)."::update", LOG_DEBUG); if ($this->db->query($sql)) { + // Multilangs + if (getDolGlobalInt('MAIN_MULTILANGS')) { + if ($this->setMultiLangs($user, $notrigger) < 0) { + $this->db->rollback(); + return -2; + } + } + $action = 'update'; // Actions on extra fields @@ -2167,35 +2175,37 @@ class Categorie extends CommonObject if ($key == $current_lang) { $sql2 = ''; - if ($this->db->num_rows($result)) { // if no line in database + if ($this->db->num_rows($result)) { // if there is already a description line for this language $sql2 = "UPDATE ".MAIN_DB_PREFIX."categorie_lang"; $sql2 .= " SET label = '".$this->db->escape($this->label)."',"; $sql2 .= " description = '".$this->db->escape($this->description)."'"; $sql2 .= " WHERE fk_category = ".((int) $this->id)." AND lang = '".$this->db->escape($key)."'"; - } elseif (isset($this->multilangs[$key])) { + } else { // if no line in database $sql2 = "INSERT INTO ".MAIN_DB_PREFIX."categorie_lang (fk_category, lang, label, description)"; $sql2 .= " VALUES(".((int) $this->id).", '".$this->db->escape($key)."', '".$this->db->escape($this->label)."'"; - $sql2 .= ", '".$this->db->escape($this->multilangs[$key]["description"])."')"; + $sql2 .= ", '".$this->db->escape($this->description)."')"; } dol_syslog(get_class($this).'::setMultiLangs', LOG_DEBUG); - if ($sql2 && !$this->db->query($sql2)) { + if (!$this->db->query($sql2)) { $this->error = $this->db->lasterror(); return -1; } - } elseif (isset($this->multilangs[$key])) { - if ($this->db->num_rows($result)) { // if no line in database + $this->multilangs[$key]["label"] = $this->label; + $this->multilangs[$key]["description"] = $this->description; + } elseif (isset($this->multilangs[$key])) { // if there is already a description line for this language + if ($this->db->num_rows($result)) { $sql2 = "UPDATE ".MAIN_DB_PREFIX."categorie_lang"; $sql2 .= " SET label='".$this->db->escape($this->multilangs[$key]["label"])."',"; $sql2 .= " description='".$this->db->escape($this->multilangs[$key]["description"])."'"; $sql2 .= " WHERE fk_category=".((int) $this->id)." AND lang='".$this->db->escape($key)."'"; - } else { + } else { // if no line in database $sql2 = "INSERT INTO ".MAIN_DB_PREFIX."categorie_lang (fk_category, lang, label, description)"; $sql2 .= " VALUES(".((int) $this->id).", '".$this->db->escape($key)."', '".$this->db->escape($this->multilangs[$key]["label"])."'"; $sql2 .= ",'".$this->db->escape($this->multilangs[$key]["description"])."')"; } - // on ne sauvegarde pas des champs vides - if ($this->multilangs[$key]["label"] || $this->multilangs[$key]["description"] || $this->multilangs[$key]["note"]) { + // We do not save if main fields are empty + if ($this->multilangs[$key]["label"] || $this->multilangs[$key]["description"]) { dol_syslog(get_class($this).'::setMultiLangs', LOG_DEBUG); } if (!$this->db->query($sql2)) { diff --git a/htdocs/categories/edit.php b/htdocs/categories/edit.php index 33d759d1bc9..fe084fd4906 100644 --- a/htdocs/categories/edit.php +++ b/htdocs/categories/edit.php @@ -3,7 +3,7 @@ * Copyright (C) 2006-2016 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2007 Patrick Raguin - * Copyright (C) 2020-2024 Frédéric France + * Copyright (C) 2020-2026 Frédéric France * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -29,12 +29,12 @@ // Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user @@ -82,7 +82,6 @@ if (is_numeric($type)) { $type = array_search($type, $object->MAP_ID); // For backward compatibility } -$extrafields = new ExtraFields($db); $extrafields->fetch_name_optionals_label($object->table_element); $error = 0; diff --git a/htdocs/categories/photos.php b/htdocs/categories/photos.php index c30e1eeb21b..f4fa2c44dd8 100644 --- a/htdocs/categories/photos.php +++ b/htdocs/categories/photos.php @@ -161,12 +161,18 @@ if ($object->id) { print '
'; print '
'.$langs->trans("Ref").''.$object->id.'
'.$langs->trans("Ref").''.dolPrintHTML($object->id).'
'.$langs->trans("Label").'
'.$langs->trans("Label").'
'.$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'); @@ -1163,7 +1163,7 @@ if ($rowid > 0) { print '
'.$langs->trans("AmountFormulaDescription").''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor('amountformuladescription', $object->amountformuladescription, '', 220, 'dolibarr_notes', '', false, true, isModEnabled('fckeditor'), 15, '90%'); + $doleditor = new DolEditor('amountformuladescription', $object->amountformuladescription, '', 120, 'dolibarr_details', '', false, false, isModEnabled('fckeditor'), ROWS_5, '90%'); $doleditor->Create(); print '
'.$langs->trans("Description").''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor('comment', $object->note_public, '', 220, 'dolibarr_notes', '', false, true, isModEnabled('fckeditor'), 15, '90%'); + $doleditor = new DolEditor('comment', $object->note_public, '', 220, 'dolibarr_details', '', false, false, isModEnabled('fckeditor'), 15, '90%'); $doleditor->Create(); print "
'; - // Description + // Label print ''; + // Description + // print ''; + // Color print '
'; - print $langs->trans("Description").''; - print dol_htmlentitiesbr($object->description); + print $langs->trans("Label").''; + print dol_htmlentitiesbr($object->label); print '
'; + // print $langs->trans("Description").''; + // print dol_htmlentitiesbr($object->description); + // print '
'; print $langs->trans("Color").''; diff --git a/htdocs/categories/traduction.php b/htdocs/categories/traduction.php index a66e333fdf4..29d364b5595 100644 --- a/htdocs/categories/traduction.php +++ b/htdocs/categories/traduction.php @@ -3,7 +3,7 @@ * Copyright (C) 2007 Rodolphe Quiedeville * Copyright (C) 2010-2016 Destailleur Laurent * Copyright (C) 2015 Raphaël Doursenaud - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -29,20 +29,21 @@ // Load Dolibarr environment require '../main.inc.php'; +/** + * @var Conf $conf + * @var DoliDB $db + * @var ExtraFields $extrafields + * @var HookManager $hookmanager + * @var Translate $langs + * @var User $user + */ + require_once DOL_DOCUMENT_ROOT.'/core/lib/categories.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; -/** - * @var Conf $conf - * @var DoliDB $db - * @var HookManager $hookmanager - * @var Translate $langs - * @var User $user - */ - // Load translation files required by the page $langs->loadLangs(array('categories', 'languages', 'mrp')); @@ -63,6 +64,10 @@ if ($result <= 0) { dol_print_error($db, $object->error); exit; } +$extralabels = $extrafields->fetch_name_optionals_label("categorie_lang"); + +// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context +$hookmanager->initHooks(array('categorietranslationcard', 'globalcard')); $type = $object->type; if (is_numeric($type)) { @@ -73,21 +78,28 @@ if (is_numeric($type)) { $result = restrictedArea($user, 'categorie', $id, '&category'); $permissiontoadd = $user->hasRight('categorie', 'creer'); - +$permissiontodelete = $user->hasRight('categorie', 'supprimer'); /* * Actions */ $error = 0; - +$parameters = [ + 'id' => $id, + 'ref' => $label, +]; +$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'); +} // return to translation view if cancelled -if ($cancel == $langs->trans("Cancel")) { +if (empty($reshook) && $cancel == $langs->trans("Cancel")) { $action = ''; } // delete a translation -if ($action == 'delete' && $langtodelete && $user->hasRight('categorie', 'creer')) { +if (empty($reshook) && $action == 'delete' && $langtodelete && $permissiontodelete) { $res = $object->delMultiLangs($langtodelete, $user); if ($res < 0) { setEventMessages($object->error, $object->errors, 'errors'); @@ -99,7 +111,7 @@ if ($action == 'delete' && $langtodelete && $user->hasRight('categorie', 'creer' } // validation of addition -if ($action == 'vadd' && $cancel != $langs->trans("Cancel") && $permissiontoadd) { +if (empty($reshook) && $action == 'vadd' && $cancel != $langs->trans("Cancel") && $permissiontoadd) { $object->fetch($id); $current_lang = $langs->getDefaultLang(); @@ -148,7 +160,7 @@ if ($action == 'vadd' && $cancel != $langs->trans("Cancel") && $permissiontoadd) } // validation of the edition -if ($action == 'vedit' && $cancel != $langs->trans("Cancel") && $permissiontoadd) { +if (empty($reshook) && $action == 'vedit' && $cancel != $langs->trans("Cancel") && $permissiontoadd) { $object->fetch($id); $current_lang = $langs->getDefaultLang(); @@ -164,6 +176,7 @@ if ($action == 'vedit' && $cancel != $langs->trans("Cancel") && $permissiontoadd if ($key == $current_lang) { $object->label = $libelle; $object->description = dol_htmlcleanlastbr($desc); + $object->update($user); } else { $object->multilangs[$key]["label"] = $libelle; $object->multilangs[$key]["description"] = dol_htmlcleanlastbr($desc); @@ -231,12 +244,18 @@ print '
'; print ''; -// Description +// Label print ''; +// Description +// print ''; + // Color print '
'; -print $langs->trans("Description").''; -print dol_htmlentitiesbr($object->description); +print $langs->trans("Label").''; +print dol_htmlentitiesbr($object->label); print '
'; +// print $langs->trans("Description").''; +// print dol_htmlentitiesbr($object->description); +// print '
'; print $langs->trans("Color").''; @@ -249,18 +268,19 @@ print ''; print dol_get_fiche_end(); - /* * Action bar */ print "\n
\n"; -if ($action == '') { - if ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer')) { - print ''.$langs->trans('Add').''; +$parameters = array(); +$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been +if (empty($reshook)) { + if ($action == '' && $permissiontoadd) { + print ''.$langs->trans('Add').''; if ($cnt_trans > 0) { - print ''.$langs->trans('Update').''; + print ''.$langs->trans('Update').''; } } } @@ -268,7 +288,6 @@ if ($action == '') { print "\n
\n"; - if ($action == 'edit') { // WYSIWYG Editor require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; @@ -281,7 +300,8 @@ if ($action == 'edit') { if (!empty($object->multilangs)) { foreach ($object->multilangs as $key => $value) { - print "
".$langs->trans('Language_'.$key)." :
"; + $s = picto_from_langcode((string) $key); + print '
'.($s ? $s.' ' : '').''.$langs->trans('Language_'.$key).': ' . $langs->trans('Language_'.$key).' :
'; print ''; // Label @@ -314,7 +334,7 @@ if ($action == 'edit') { foreach ($object->multilangs as $key => $value) { $s = picto_from_langcode((string) $key); print '
'; - print ''; + print ''; print ''; print ''; if (getDolGlobalString('CATEGORY_USE_OTHER_FIELD_IN_TRANSLATION')) { @@ -333,12 +353,12 @@ if ($action == 'edit') { * Form to add a new translation */ -if ($action == 'add' && ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer'))) { +if ($action == 'add' && $permissiontoadd) { //WYSIWYG Editor require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; print '
'; - print ''; + print ''; print ''; print ''; print ''; diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 82fc95fa9eb..f33eb263c5c 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -8,7 +8,7 @@ * Copyright (C) 2020 Josep Lluís Amador * Copyright (C) 2022-2023 Solution Libre SAS * Copyright (C) 2024-2025 MDW - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * Copyright (C) 2024-2025 Alexandre Spangaro * Copyright (C) 2023-2024 Charlene Benke * @@ -37,13 +37,13 @@ require '../main.inc.php'; /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/categories.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; // Load translation files required by the page @@ -104,7 +104,6 @@ if (is_numeric($type)) { $type = array_search($type, $object->MAP_ID); // For backward compatibility } -$extrafields = new ExtraFields($db); $extrafields->fetch_name_optionals_label($object->table_element); /* diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index ab35d5e3aa0..9aa1f963be8 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -9,7 +9,7 @@ * Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2018-2026 Frédéric France * Copyright (C) 2019 Ferran Marcet - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2026 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 @@ -332,7 +332,7 @@ if (empty($reshook) && $action == 'confirm_clone' && $confirm == 'yes' && $userc //$object->fetch($id); if (!empty($object->socpeopleassigned)) { reset($object->socpeopleassigned); - $object->contact_id = key($object->socpeopleassigned); + $object->contact_id = (int) key($object->socpeopleassigned); } $result = $object->createFromClone($user, GETPOSTINT('socid')); if ($result > 0) { @@ -980,7 +980,7 @@ if (empty($reshook) && $action == 'update' && $usercancreate) { $object->contact_id = GETPOSTINT("contactid"); if (empty($object->contact_id) && !empty($object->socpeopleassigned)) { reset($object->socpeopleassigned); - $object->contact_id = key($object->socpeopleassigned); + $object->contact_id = (int) key($object->socpeopleassigned); } $object->fk_project = GETPOSTINT("projectid"); $taskid = GETPOSTINT('taskid'); @@ -1583,7 +1583,7 @@ if ($action == 'create') { */ // limit date - $repeateventlimitdate = empty($repeateventlimitdate) ? (dol_now() + ((24 * 3600 * 365) + 1)) : $repeateventlimitdate; + $repeateventlimitdate = empty($repeateventlimitdate) ? (dol_now() + ((24 * 3600 * 365) + 1)) : $repeateventlimitdate; print ''; print ''; + print $form->showPhoneInput($object->phone_pro, 'phone_pro', $object->country_id, 'object_phoning', 'maxwidth150 widthcentpercentminusx'); + print ''; if ($conf->browser->layout == 'phone') { print ''; } + print ''; print ''; + print $form->showPhoneInput($object->phone_perso, 'phone_perso', $object->country_id, 'object_phoning', 'maxwidth150 widthcentpercentminusx'); + print ''; print ''; print ''; print ''; + print $form->showPhoneInput($object->phone_mobile, 'phone_mobile', $object->country_id, 'object_phoning_mobile', 'maxwidth150 widthcentpercentminusx'); + print ''; if ($conf->browser->layout == 'phone') { print ''; } + print ''; print ''; + print $form->showPhoneInput($object->fax, 'fax', $object->country_id, 'object_phoning_fax', 'maxwidth150 widthcentpercentminusx'); + print ''; print ''; if (((isset($objsoc->typent_code) && $objsoc->typent_code == 'TE_PRIVATE') || getDolGlobalString('CONTACT_USE_COMPANY_ADDRESS')) && dol_strlen(trim($object->email)) == 0) { @@ -1072,27 +1074,29 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Phone print ''; print ''; + print $form->showPhoneInput($object->phone_pro, 'phone_pro', $object->country_id, 'object_phoning', 'maxwidth150', 80); + print ''; if ($conf->browser->layout == 'phone') { print ''; } - print ''; + + print ''; print ''; + print $form->showPhoneInput($object->phone_perso, 'phone_perso', $object->country_id, 'object_phoning', 'maxwidth150', 80); + print ''; print ''; print ''; + print $form->showPhoneInput($object->phone_mobile, 'phone_mobile', $object->country_id, 'object_phoning_mobile', 'maxwidth150', 80); + print ''; if ($conf->browser->layout == 'phone') { print ''; } + print ''; print ''; + print $form->showPhoneInput($object->fax, 'fax', $object->country_id, 'object_phoning_fax', 'maxwidth150', 80); + print ''; // EMail print ''; diff --git a/htdocs/contrat/class/api_contracts.class.php b/htdocs/contrat/class/api_contracts.class.php index 80083fe486e..62df847ce74 100644 --- a/htdocs/contrat/class/api_contracts.class.php +++ b/htdocs/contrat/class/api_contracts.class.php @@ -36,9 +36,7 @@ class Contracts extends DolibarrApi */ public static $FIELDS = array( 'socid', - 'date_contrat', - 'commercial_signature_id', - 'commercial_suivi_id' + 'date_contrat' ); /** diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 2217957c8bf..554014b3c3a 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -4,7 +4,7 @@ * Copyright (C) 2018 Juanjo Menent * Copyright (C) 2019 Ferran Marcet * Copyright (C) 2019-2026 Frédéric France - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2026 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 @@ -1156,6 +1156,7 @@ if (!$error && ($massaction == 'delete' || ($action == 'delete' && $confirm == ' $objecttmp = new $objectclass($db); $nbok = 0; $nbignored = 0; + /** @var string[] $TMsg */ $TMsg = array(); //$toselect could contain duplicate entries, cf https://github.com/Dolibarr/dolibarr/issues/26244 @@ -2008,9 +2009,15 @@ if (!$error && $action == 'createcreditnote' && $permissiontoadd) { // We check if invoice type is supported. If not, we refuse to create credit note. $isSupportedType = false; - if ($objecttmp->type == Facture::TYPE_STANDARD) $isSupportedType = true; - if ($objecttmp->type == Facture::TYPE_PROFORMA) $isSupportedType = true; - if ($objecttmp->type == Facture::TYPE_DEPOSIT && !getDolGlobalString('FACTURE_DEPOSITS_ARE_JUST_PAYMENTS')) $isSupportedType = true; + if ($objecttmp->type == Facture::TYPE_STANDARD) { + $isSupportedType = true; + } + if ($objecttmp->type == Facture::TYPE_PROFORMA) { + $isSupportedType = true; + } + if ($objecttmp->type == Facture::TYPE_DEPOSIT && !getDolGlobalString('FACTURE_DEPOSITS_ARE_JUST_PAYMENTS')) { + $isSupportedType = true; + } if (!$isSupportedType) { $listtype = array( diff --git a/htdocs/core/ajax/getphonecode.php b/htdocs/core/ajax/getphonecode.php new file mode 100644 index 00000000000..b45c87829db --- /dev/null +++ b/htdocs/core/ajax/getphonecode.php @@ -0,0 +1,58 @@ + + * + * 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 + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/core/ajax/getphonecode.php + * \brief Returns JSON phone_code for a given country_id + */ + +if (!defined('NOTOKENRENEWAL')) { + define('NOTOKENRENEWAL', '1'); // Disables token renewal +} +if (!defined('NOREQUIREMENU')) { + define('NOREQUIREMENU', '1'); +} +if (!defined('NOREQUIREAJAX')) { + define('NOREQUIREAJAX', '1'); +} + +// Load Dolibarr environment +require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/phone.lib.php'; +/** + * @var DoliDB $db + * @var User $user + */ + +$country_id = GETPOSTINT('country_id'); + +// Security check - user must be logged in +if (empty($user->id)) { + http_response_code(403); + echo json_encode(array('error' => 'Not authorized')); + exit; +} + +/* + * View + */ + +top_httphead('application/json'); + +$phone_code = dol_get_phone_code_from_country($db, $country_id); + +echo json_encode(array('phone_code' => $phone_code)); diff --git a/htdocs/core/ajax/selectobject.php b/htdocs/core/ajax/selectobject.php index b080f703d69..5e96e01c093 100644 --- a/htdocs/core/ajax/selectobject.php +++ b/htdocs/core/ajax/selectobject.php @@ -132,7 +132,7 @@ $sharedentities = getEntity(strtolower($objecttmp->element)); $filter = str_replace( array('__ENTITY__', '__SHARED_ENTITIES__', '__USER_ID__', '$ID$'), - array($conf->entity, $sharedentities, $user->id, $id), + array((string) $conf->entity, $sharedentities, (string) $user->id, (string) $id), $filter ); diff --git a/htdocs/core/boxes/box_accountancy_last_manual_entries.php b/htdocs/core/boxes/box_accountancy_last_manual_entries.php index cad285014c2..4a2cfe074c3 100644 --- a/htdocs/core/boxes/box_accountancy_last_manual_entries.php +++ b/htdocs/core/boxes/box_accountancy_last_manual_entries.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2019 Alexandre Spangaro - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -44,7 +44,7 @@ class box_accountancy_last_manual_entries extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param) + public function __construct($db, $param) // @phpstan-ignore constructor.unusedParameter { global $user; diff --git a/htdocs/core/boxes/box_accountancy_suspense_account.php b/htdocs/core/boxes/box_accountancy_suspense_account.php index 1bf03ec68d6..811626ce8f3 100644 --- a/htdocs/core/boxes/box_accountancy_suspense_account.php +++ b/htdocs/core/boxes/box_accountancy_suspense_account.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2019 Alexandre Spangaro - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -44,7 +44,7 @@ class box_accountancy_suspense_account extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param) + public function __construct($db, $param) // @phpstan-ignore constructor.unusedParameter { global $user; diff --git a/htdocs/core/boxes/box_actions.php b/htdocs/core/boxes/box_actions.php index 979f3fce0ff..18f9e90932a 100644 --- a/htdocs/core/boxes/box_actions.php +++ b/htdocs/core/boxes/box_actions.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2014 Charles-Fr BENKE * Copyright (C) 2015-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -46,7 +46,7 @@ class box_actions extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param) + public function __construct($db, $param) // @phpstan-ignore constructor.unusedParameter { global $user; diff --git a/htdocs/core/boxes/box_actions_future.php b/htdocs/core/boxes/box_actions_future.php index 1f30497476a..49f8c66d23e 100644 --- a/htdocs/core/boxes/box_actions_future.php +++ b/htdocs/core/boxes/box_actions_future.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2014 Charles-Fr BENKE * Copyright (C) 2015-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -46,7 +46,7 @@ class box_actions_future extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param) + public function __construct($db, $param) // @phpstan-ignore constructor.unusedParameter { global $user; diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php index 914ac00ef55..a80a3c06db6 100644 --- a/htdocs/core/boxes/box_activity.php +++ b/htdocs/core/boxes/box_activity.php @@ -2,7 +2,7 @@ /* Copyright (C) 2012 Charles-François BENKE * Copyright (C) 2005-2015 Laurent Destailleur * Copyright (C) 2014-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -44,7 +44,7 @@ class box_activity extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param) + public function __construct($db, $param) // @phpstan-ignore constructor.unusedParameter { global $conf, $user; diff --git a/htdocs/core/boxes/box_birthdays.php b/htdocs/core/boxes/box_birthdays.php index 30cc8ea9491..da4733ff634 100644 --- a/htdocs/core/boxes/box_birthdays.php +++ b/htdocs/core/boxes/box_birthdays.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2010 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2015-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -46,7 +46,7 @@ class box_birthdays extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param = '') + public function __construct($db, $param = '') // @phpstan-ignore constructor.unusedParameter { global $user; diff --git a/htdocs/core/boxes/box_birthdays_members.php b/htdocs/core/boxes/box_birthdays_members.php index edf35d08df1..0eaeac81f9d 100644 --- a/htdocs/core/boxes/box_birthdays_members.php +++ b/htdocs/core/boxes/box_birthdays_members.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2010 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2015-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -46,7 +46,7 @@ class box_birthdays_members extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param = '') + public function __construct($db, $param = '') // @phpstan-ignore constructor.unusedParameter { global $user; diff --git a/htdocs/core/boxes/box_boms.php b/htdocs/core/boxes/box_boms.php index 75d929e0b1a..2c0e55068ea 100644 --- a/htdocs/core/boxes/box_boms.php +++ b/htdocs/core/boxes/box_boms.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2015-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -44,7 +44,7 @@ class box_boms extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param) + public function __construct($db, $param) // @phpstan-ignore constructor.unusedParameter { global $user; diff --git a/htdocs/core/boxes/box_bookmarks.php b/htdocs/core/boxes/box_bookmarks.php index a4abb6e7f49..3563c6489a8 100644 --- a/htdocs/core/boxes/box_bookmarks.php +++ b/htdocs/core/boxes/box_bookmarks.php @@ -1,7 +1,7 @@ * Copyright (C) 2015-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -40,7 +40,7 @@ class box_bookmarks extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param) + public function __construct($db, $param) // @phpstan-ignore constructor.unusedParameter { global $user; diff --git a/htdocs/core/boxes/box_clients.php b/htdocs/core/boxes/box_clients.php index 2d9aae70395..5aca613030c 100644 --- a/htdocs/core/boxes/box_clients.php +++ b/htdocs/core/boxes/box_clients.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2010 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2015-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -46,7 +46,7 @@ class box_clients extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param = '') + public function __construct($db, $param = '') // @phpstan-ignore constructor.unusedParameter { global $user; diff --git a/htdocs/core/boxes/box_commandes.php b/htdocs/core/boxes/box_commandes.php index 70a54d0e1ad..3d3c1c9d2d3 100644 --- a/htdocs/core/boxes/box_commandes.php +++ b/htdocs/core/boxes/box_commandes.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2015-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -44,7 +44,7 @@ class box_commandes extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param) + public function __construct($db, $param) // @phpstan-ignore constructor.unusedParameter { global $user; diff --git a/htdocs/core/boxes/box_comptes.php b/htdocs/core/boxes/box_comptes.php index 7fc45b1c91f..3e578fedb1f 100644 --- a/htdocs/core/boxes/box_comptes.php +++ b/htdocs/core/boxes/box_comptes.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2013 Juanjo Menent * Copyright (C) 2015-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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,7 +47,7 @@ class box_comptes extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param = '') + public function __construct($db, $param = '') // @phpstan-ignore constructor.unusedParameter { global $conf, $user; diff --git a/htdocs/core/boxes/box_contacts.php b/htdocs/core/boxes/box_contacts.php index 0b62bca1a20..33efe81aedc 100644 --- a/htdocs/core/boxes/box_contacts.php +++ b/htdocs/core/boxes/box_contacts.php @@ -5,7 +5,7 @@ * Copyright (C) 2015-2025 Frédéric France * Copyright (C) 2018 Josep Lluís Amador * Copyright (C) 2020 Ferran Marcet - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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,7 +47,7 @@ class box_contacts extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param) + public function __construct($db, $param) // @phpstan-ignore constructor.unusedParameter { global $user; diff --git a/htdocs/core/boxes/box_contracts.php b/htdocs/core/boxes/box_contracts.php index a5381fc9e3e..92a426957c7 100644 --- a/htdocs/core/boxes/box_contracts.php +++ b/htdocs/core/boxes/box_contracts.php @@ -2,7 +2,7 @@ /* Copyright (C) 2010 Regis Houssin * Copyright (C) 2015-2025 Frédéric France * Copyright (C) 2016-2017 Laurent Destailleur - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -43,7 +43,7 @@ class box_contracts extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param) + public function __construct($db, $param) // @phpstan-ignore constructor.unusedParameter { global $user; diff --git a/htdocs/core/boxes/box_customers_outstanding_bill_reached.php b/htdocs/core/boxes/box_customers_outstanding_bill_reached.php index f70e734e8a2..dfa98ff7770 100644 --- a/htdocs/core/boxes/box_customers_outstanding_bill_reached.php +++ b/htdocs/core/boxes/box_customers_outstanding_bill_reached.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2010 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2015-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -46,7 +46,7 @@ class box_customers_outstanding_bill_reached extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param = '') + public function __construct($db, $param = '') // @phpstan-ignore constructor.unusedParameter { global $user; diff --git a/htdocs/core/boxes/box_dolibarr_state_board.php b/htdocs/core/boxes/box_dolibarr_state_board.php index 6cf769bd339..770a3aaf38f 100644 --- a/htdocs/core/boxes/box_dolibarr_state_board.php +++ b/htdocs/core/boxes/box_dolibarr_state_board.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2015-2024 Frédéric France * Copyright (C) 2024 Charlene Benke - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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,7 +47,7 @@ class box_dolibarr_state_board extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param = '') + public function __construct($db, $param = '') // @phpstan-ignore constructor.unusedParameter { $this->db = $db; } diff --git a/htdocs/core/boxes/box_factures.php b/htdocs/core/boxes/box_factures.php index 1a3a69d4423..2dad8ffce23 100644 --- a/htdocs/core/boxes/box_factures.php +++ b/htdocs/core/boxes/box_factures.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2015-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -42,7 +42,7 @@ class box_factures extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param) + public function __construct($db, $param) // @phpstan-ignore constructor.unusedParameter { global $user; diff --git a/htdocs/core/boxes/box_factures_fourn.php b/htdocs/core/boxes/box_factures_fourn.php index 50ac66eb0fb..4c94573fbfc 100644 --- a/htdocs/core/boxes/box_factures_fourn.php +++ b/htdocs/core/boxes/box_factures_fourn.php @@ -43,7 +43,7 @@ class box_factures_fourn extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param) + public function __construct($db, $param) // @phpstan-ignore constructor.unusedParameter { global $user; diff --git a/htdocs/core/boxes/box_factures_fourn_imp.php b/htdocs/core/boxes/box_factures_fourn_imp.php index 818d5e46cac..ade2e5418c9 100644 --- a/htdocs/core/boxes/box_factures_fourn_imp.php +++ b/htdocs/core/boxes/box_factures_fourn_imp.php @@ -2,7 +2,7 @@ /* Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2015-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -42,7 +42,7 @@ class box_factures_fourn_imp extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param) + public function __construct($db, $param) // @phpstan-ignore constructor.unusedParameter { global $user; diff --git a/htdocs/core/boxes/box_factures_imp.php b/htdocs/core/boxes/box_factures_imp.php index 914687414da..4cfcc580f97 100644 --- a/htdocs/core/boxes/box_factures_imp.php +++ b/htdocs/core/boxes/box_factures_imp.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2007 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2015-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 MDW * Copyright (C) 2024 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify @@ -46,7 +46,7 @@ class box_factures_imp extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param) + public function __construct($db, $param) // @phpstan-ignore constructor.unusedParameter { global $user; diff --git a/htdocs/core/boxes/box_ficheinter.php b/htdocs/core/boxes/box_ficheinter.php index d9821886449..57736378f36 100644 --- a/htdocs/core/boxes/box_ficheinter.php +++ b/htdocs/core/boxes/box_ficheinter.php @@ -2,7 +2,7 @@ /* Copyright (C) 2013 Florian Henry * Copyright (C) 2013 Juanjo Menent * Copyright (C) 2015-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -43,7 +43,7 @@ class box_ficheinter extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param) + public function __construct($db, $param) // @phpstan-ignore constructor.unusedParameter { global $user; diff --git a/htdocs/core/boxes/box_fournisseurs.php b/htdocs/core/boxes/box_fournisseurs.php index 7195000382b..92c97a502b1 100644 --- a/htdocs/core/boxes/box_fournisseurs.php +++ b/htdocs/core/boxes/box_fournisseurs.php @@ -3,7 +3,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2015-2025 Frédéric France * Copyright (C) 2020 Pierre Ardoin - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -44,7 +44,7 @@ class box_fournisseurs extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param) + public function __construct($db, $param) // @phpstan-ignore constructor.unusedParameter { global $user; diff --git a/htdocs/core/boxes/box_funnel_of_prospection.php b/htdocs/core/boxes/box_funnel_of_prospection.php index 90e6214c315..3e2755eb6b3 100644 --- a/htdocs/core/boxes/box_funnel_of_prospection.php +++ b/htdocs/core/boxes/box_funnel_of_prospection.php @@ -4,7 +4,7 @@ * Copyright (C) 2015-2025 Frédéric France * Copyright (C) 2016 Juan José Menent * Copyright (C) 2020 Pierre Ardoin - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -46,7 +46,7 @@ class box_funnel_of_prospection extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param = '') + public function __construct($db, $param = '') // @phpstan-ignore constructor.unusedParameter { global $user, $langs; diff --git a/htdocs/core/boxes/box_goodcustomers.php b/htdocs/core/boxes/box_goodcustomers.php index bf1225c3231..e9a1ac68014 100644 --- a/htdocs/core/boxes/box_goodcustomers.php +++ b/htdocs/core/boxes/box_goodcustomers.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2015-2025 Frédéric France * Copyright (C) 2016 Charlie Benke - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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,7 +47,7 @@ class box_goodcustomers extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param = '') + public function __construct($db, $param = '') // @phpstan-ignore constructor.unusedParameter { global $user; diff --git a/htdocs/core/boxes/box_graph_invoices_permonth.php b/htdocs/core/boxes/box_graph_invoices_permonth.php index a9ad73b9daf..a3af997a7dd 100644 --- a/htdocs/core/boxes/box_graph_invoices_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_permonth.php @@ -1,7 +1,7 @@ * Copyright (C) 2024-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -44,7 +44,7 @@ class box_graph_invoices_permonth extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param) + public function __construct($db, $param) // @phpstan-ignore constructor.unusedParameter { global $user; diff --git a/htdocs/core/boxes/box_graph_invoices_peryear.php b/htdocs/core/boxes/box_graph_invoices_peryear.php index a0d52f5e07a..3b27f6feea8 100644 --- a/htdocs/core/boxes/box_graph_invoices_peryear.php +++ b/htdocs/core/boxes/box_graph_invoices_peryear.php @@ -1,7 +1,7 @@ * Copyright (C) 2024-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -41,7 +41,7 @@ class box_graph_invoices_peryear extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param) + public function __construct($db, $param) // @phpstan-ignore constructor.unusedParameter { global $user; diff --git a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php index 10aecc5776e..0f2c1344ab7 100644 --- a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php @@ -1,7 +1,7 @@ * Copyright (C) 2024-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -43,7 +43,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param) + public function __construct($db, $param) // @phpstan-ignore constructor.unusedParameter { global $user; diff --git a/htdocs/core/boxes/box_graph_nb_ticket_last_x_days.php b/htdocs/core/boxes/box_graph_nb_ticket_last_x_days.php index 8df77c95ac4..e2d619c8f99 100644 --- a/htdocs/core/boxes/box_graph_nb_ticket_last_x_days.php +++ b/htdocs/core/boxes/box_graph_nb_ticket_last_x_days.php @@ -3,7 +3,7 @@ * Copyright (C) 2013-2016 Jean-François FERRY * Copyright (C) 2016 Christophe Battarel * Copyright (C) 2019-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -46,7 +46,7 @@ class box_graph_nb_ticket_last_x_days extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param = '') + public function __construct($db, $param = '') // @phpstan-ignore constructor.unusedParameter { global $langs; $langs->load("boxes"); diff --git a/htdocs/core/boxes/box_graph_nb_tickets_type.php b/htdocs/core/boxes/box_graph_nb_tickets_type.php index dc9e4b1a784..2439165f2bf 100644 --- a/htdocs/core/boxes/box_graph_nb_tickets_type.php +++ b/htdocs/core/boxes/box_graph_nb_tickets_type.php @@ -3,7 +3,7 @@ * Copyright (C) 2013-2016 Jean-François FERRY * Copyright (C) 2016 Christophe Battarel * Copyright (C) 2019-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -46,7 +46,7 @@ class box_graph_nb_tickets_type extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param = '') + public function __construct($db, $param = '') // @phpstan-ignore constructor.unusedParameter { global $langs; $langs->load("boxes"); diff --git a/htdocs/core/boxes/box_graph_new_vs_close_ticket.php b/htdocs/core/boxes/box_graph_new_vs_close_ticket.php index 1c29d20bcbf..7b7be40a534 100644 --- a/htdocs/core/boxes/box_graph_new_vs_close_ticket.php +++ b/htdocs/core/boxes/box_graph_new_vs_close_ticket.php @@ -3,7 +3,7 @@ * Copyright (C) 2013-2016 Jean-François FERRY * Copyright (C) 2016 Christophe Battarel * Copyright (C) 2019-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -46,7 +46,7 @@ class box_graph_new_vs_close_ticket extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param = '') + public function __construct($db, $param = '') // @phpstan-ignore constructor.unusedParameter { global $langs; $langs->load("boxes"); diff --git a/htdocs/core/boxes/box_graph_orders_permonth.php b/htdocs/core/boxes/box_graph_orders_permonth.php index 35618b54d79..07b44c382b2 100644 --- a/htdocs/core/boxes/box_graph_orders_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_permonth.php @@ -1,7 +1,7 @@ * Copyright (C) 2024-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -43,7 +43,7 @@ class box_graph_orders_permonth extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param) + public function __construct($db, $param) // @phpstan-ignore constructor.unusedParameter { global $user; diff --git a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php index 5263cd32039..a2b7396a2ad 100644 --- a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php @@ -1,7 +1,7 @@ * Copyright (C) 2024-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -43,7 +43,7 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param) + public function __construct($db, $param) // @phpstan-ignore constructor.unusedParameter { global $user; diff --git a/htdocs/core/boxes/box_graph_product_distribution.php b/htdocs/core/boxes/box_graph_product_distribution.php index b7343d24cf0..041e708f2db 100644 --- a/htdocs/core/boxes/box_graph_product_distribution.php +++ b/htdocs/core/boxes/box_graph_product_distribution.php @@ -1,7 +1,7 @@ * Copyright (C) 2018-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -43,7 +43,7 @@ class box_graph_product_distribution extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param) + public function __construct($db, $param) // @phpstan-ignore constructor.unusedParameter { global $user; diff --git a/htdocs/core/boxes/box_graph_propales_permonth.php b/htdocs/core/boxes/box_graph_propales_permonth.php index de7ef4b2cf2..e9cfc002dc2 100644 --- a/htdocs/core/boxes/box_graph_propales_permonth.php +++ b/htdocs/core/boxes/box_graph_propales_permonth.php @@ -1,7 +1,7 @@ * Copyright (C) 2024-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -43,7 +43,7 @@ class box_graph_propales_permonth extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param) + public function __construct($db, $param) // @phpstan-ignore constructor.unusedParameter { global $user; diff --git a/htdocs/core/boxes/box_graph_ticket_by_severity.php b/htdocs/core/boxes/box_graph_ticket_by_severity.php index d18d0f2ea23..ca6c2bdb595 100644 --- a/htdocs/core/boxes/box_graph_ticket_by_severity.php +++ b/htdocs/core/boxes/box_graph_ticket_by_severity.php @@ -3,7 +3,7 @@ * Copyright (C) 2013-2016 Jean-François FERRY * Copyright (C) 2016 Christophe Battarel * Copyright (C) 2019-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -46,7 +46,7 @@ class box_graph_ticket_by_severity extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param = '') + public function __construct($db, $param = '') // @phpstan-ignore constructor.unusedParameter { global $langs; $langs->load("boxes"); diff --git a/htdocs/core/boxes/box_last_knowledgerecord.php b/htdocs/core/boxes/box_last_knowledgerecord.php index 41f9f847445..93417fe7b23 100644 --- a/htdocs/core/boxes/box_last_knowledgerecord.php +++ b/htdocs/core/boxes/box_last_knowledgerecord.php @@ -3,7 +3,7 @@ * Copyright (C) 2013-2016 Jean-François FERRY * Copyright (C) 2016 Christophe Battarel * Copyright (C) 2018-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -56,7 +56,7 @@ class box_last_knowledgerecord extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param = '') + public function __construct($db, $param = '') // @phpstan-ignore constructor.unusedParameter { global $langs; $langs->loadLangs(array("boxes", "languages")); diff --git a/htdocs/core/boxes/box_last_modified_knowledgerecord.php b/htdocs/core/boxes/box_last_modified_knowledgerecord.php index 3e1d48897b6..72585e43561 100644 --- a/htdocs/core/boxes/box_last_modified_knowledgerecord.php +++ b/htdocs/core/boxes/box_last_modified_knowledgerecord.php @@ -3,7 +3,7 @@ * Copyright (C) 2013-2016 Jean-François FERRY * Copyright (C) 2016 Christophe Battarel * Copyright (C) 2018-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -56,7 +56,7 @@ class box_last_modified_knowledgerecord extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param = '') + public function __construct($db, $param = '') // @phpstan-ignore constructor.unusedParameter { global $langs; $langs->loadLangs(array("boxes", "knowledgemanagement", "languages")); diff --git a/htdocs/core/boxes/box_last_modified_ticket.php b/htdocs/core/boxes/box_last_modified_ticket.php index b4da5819ff5..aae4ac79058 100644 --- a/htdocs/core/boxes/box_last_modified_ticket.php +++ b/htdocs/core/boxes/box_last_modified_ticket.php @@ -3,7 +3,7 @@ * Copyright (C) 2013-2016 Jean-François FERRY * Copyright (C) 2016 Christophe Battarel * Copyright (C) 2019-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -44,7 +44,7 @@ class box_last_modified_ticket extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param = '') + public function __construct($db, $param = '') // @phpstan-ignore constructor.unusedParameter { global $langs; $langs->load("boxes"); diff --git a/htdocs/core/boxes/box_last_ticket.php b/htdocs/core/boxes/box_last_ticket.php index 0703c3fd652..737ebdfa71d 100644 --- a/htdocs/core/boxes/box_last_ticket.php +++ b/htdocs/core/boxes/box_last_ticket.php @@ -3,7 +3,7 @@ * Copyright (C) 2013-2016 Jean-François FERRY * Copyright (C) 2016 Christophe Battarel * Copyright (C) 2018-2021 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -44,7 +44,7 @@ class box_last_ticket extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param = '') + public function __construct($db, $param = '') // @phpstan-ignore constructor.unusedParameter { global $langs; $langs->load("boxes"); diff --git a/htdocs/core/boxes/box_lastlogin.php b/htdocs/core/boxes/box_lastlogin.php index 000cd9c25bf..742c4a2dc02 100644 --- a/htdocs/core/boxes/box_lastlogin.php +++ b/htdocs/core/boxes/box_lastlogin.php @@ -2,7 +2,7 @@ /* Copyright (C) 2012 Charles-François BENKE * Copyright (C) 2005-2017 Laurent Destailleur * Copyright (C) 2014-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -44,7 +44,7 @@ class box_lastlogin extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param) + public function __construct($db, $param) // @phpstan-ignore constructor.unusedParameter { $this->db = $db; } diff --git a/htdocs/core/boxes/box_members_by_tags.php b/htdocs/core/boxes/box_members_by_tags.php index 79ec096034e..f4e08c7bdfe 100644 --- a/htdocs/core/boxes/box_members_by_tags.php +++ b/htdocs/core/boxes/box_members_by_tags.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2015-2025 Frédéric France * Copyright (C) 2021-2023 Waël Almoman - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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,7 +47,7 @@ class box_members_by_tags extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param = '') + public function __construct($db, $param = '') // @phpstan-ignore constructor.unusedParameter { global $conf, $user; diff --git a/htdocs/core/boxes/box_members_by_type.php b/htdocs/core/boxes/box_members_by_type.php index ebe15471a4b..af60577fc4e 100644 --- a/htdocs/core/boxes/box_members_by_type.php +++ b/htdocs/core/boxes/box_members_by_type.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2015-2024 Frédéric France * Copyright (C) 2021-2023 Waël Almoman - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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,7 +47,7 @@ class box_members_by_type extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param = '') + public function __construct($db, $param = '') // @phpstan-ignore constructor.unusedParameter { global $conf, $user; diff --git a/htdocs/core/boxes/box_members_last_modified.php b/htdocs/core/boxes/box_members_last_modified.php index 8c49715271f..41b82ce5f00 100644 --- a/htdocs/core/boxes/box_members_last_modified.php +++ b/htdocs/core/boxes/box_members_last_modified.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2015-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -46,7 +46,7 @@ class box_members_last_modified extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param = '') + public function __construct($db, $param = '') // @phpstan-ignore constructor.unusedParameter { global $conf, $user; @@ -140,7 +140,7 @@ class box_members_last_modified extends ModeleBoxes 'td' => 'class="right" width="18"', 'text' => $memberstatic->LibStatut($data['status'], $data['need_subscription'], $data['date_end_subscription'], 3), ); - $line ++; + $line++; } if ($num == 0) { diff --git a/htdocs/core/boxes/box_members_last_subscriptions.php b/htdocs/core/boxes/box_members_last_subscriptions.php index 77cd63e5ea0..064cb25167e 100644 --- a/htdocs/core/boxes/box_members_last_subscriptions.php +++ b/htdocs/core/boxes/box_members_last_subscriptions.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2015-2025 Frédéric France - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2026 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 @@ -46,7 +46,7 @@ class box_members_last_subscriptions extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param = '') + public function __construct($db, $param = '') // @phpstan-ignore constructor.unusedParameter { global $user; diff --git a/htdocs/core/boxes/box_members_subscriptions_by_year.php b/htdocs/core/boxes/box_members_subscriptions_by_year.php index 54ea9e07b4d..ac091748c1f 100644 --- a/htdocs/core/boxes/box_members_subscriptions_by_year.php +++ b/htdocs/core/boxes/box_members_subscriptions_by_year.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2015-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -46,7 +46,7 @@ class box_members_subscriptions_by_year extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param = '') + public function __construct($db, $param = '') // @phpstan-ignore constructor.unusedParameter { global $conf, $user; diff --git a/htdocs/core/boxes/box_mos.php b/htdocs/core/boxes/box_mos.php index 640dc988da4..923d0090a67 100644 --- a/htdocs/core/boxes/box_mos.php +++ b/htdocs/core/boxes/box_mos.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2015-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -44,7 +44,7 @@ class box_mos extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param) + public function __construct($db, $param) // @phpstan-ignore constructor.unusedParameter { global $user; diff --git a/htdocs/core/boxes/box_produits.php b/htdocs/core/boxes/box_produits.php index 5ea6b3c6c8d..8afd87cb026 100644 --- a/htdocs/core/boxes/box_produits.php +++ b/htdocs/core/boxes/box_produits.php @@ -45,7 +45,7 @@ class box_produits extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param) + public function __construct($db, $param) // @phpstan-ignore constructor.unusedParameter { global $user; diff --git a/htdocs/core/boxes/box_produits_alerte_stock.php b/htdocs/core/boxes/box_produits_alerte_stock.php index ba62d236369..8789d697e7d 100644 --- a/htdocs/core/boxes/box_produits_alerte_stock.php +++ b/htdocs/core/boxes/box_produits_alerte_stock.php @@ -47,7 +47,7 @@ class box_produits_alerte_stock extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param = '') + public function __construct($db, $param = '') // @phpstan-ignore constructor.unusedParameter { global $user; diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php index c189869339a..54266b90837 100644 --- a/htdocs/core/boxes/box_project.php +++ b/htdocs/core/boxes/box_project.php @@ -4,7 +4,7 @@ * Copyright (C) 2015-2025 Frédéric France * Copyright (C) 2016 Juan José Menent * Copyright (C) 2020 Pierre Ardoin - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -46,7 +46,7 @@ class box_project extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param = '') + public function __construct($db, $param = '') // @phpstan-ignore constructor.unusedParameter { global $user, $langs; diff --git a/htdocs/core/boxes/box_project_opportunities.php b/htdocs/core/boxes/box_project_opportunities.php index 2b587a1f5ce..9d79c40c6e2 100644 --- a/htdocs/core/boxes/box_project_opportunities.php +++ b/htdocs/core/boxes/box_project_opportunities.php @@ -4,7 +4,7 @@ * Copyright (C) 2015-2025 Frédéric France * Copyright (C) 2016 Juan José Menent * Copyright (C) 2020 Pierre Ardoin - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -46,7 +46,7 @@ class box_project_opportunities extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param = '') + public function __construct($db, $param = '') // @phpstan-ignore constructor.unusedParameter { global $user, $langs; diff --git a/htdocs/core/boxes/box_propales.php b/htdocs/core/boxes/box_propales.php index fe2335b330e..9726bb05cb0 100644 --- a/htdocs/core/boxes/box_propales.php +++ b/htdocs/core/boxes/box_propales.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2015-2025 Frédéric France * Copyright (C) 2020 Pierre Ardoin - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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,7 +45,7 @@ class box_propales extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param) + public function __construct($db, $param) // @phpstan-ignore constructor.unusedParameter { global $user; diff --git a/htdocs/core/boxes/box_prospect.php b/htdocs/core/boxes/box_prospect.php index 30bafa07e66..e8ed8fe62ed 100644 --- a/htdocs/core/boxes/box_prospect.php +++ b/htdocs/core/boxes/box_prospect.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2015-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -48,7 +48,7 @@ class box_prospect extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param = '') + public function __construct($db, $param = '') // @phpstan-ignore constructor.unusedParameter { global $conf, $user; diff --git a/htdocs/core/boxes/box_scheduled_jobs.php b/htdocs/core/boxes/box_scheduled_jobs.php index e958acf5fbe..014032717d3 100644 --- a/htdocs/core/boxes/box_scheduled_jobs.php +++ b/htdocs/core/boxes/box_scheduled_jobs.php @@ -3,7 +3,7 @@ * Copyright (C) 2005-2017 Laurent Destailleur * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2017 Nicolas Zabouri - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -44,7 +44,7 @@ class box_scheduled_jobs extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param) + public function __construct($db, $param) // @phpstan-ignore constructor.unusedParameter { global $user; diff --git a/htdocs/core/boxes/box_services_contracts.php b/htdocs/core/boxes/box_services_contracts.php index cdd35f31789..573f95bf603 100644 --- a/htdocs/core/boxes/box_services_contracts.php +++ b/htdocs/core/boxes/box_services_contracts.php @@ -44,7 +44,7 @@ class box_services_contracts extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param) + public function __construct($db, $param) // @phpstan-ignore constructor.unusedParameter { global $user; diff --git a/htdocs/core/boxes/box_services_expired.php b/htdocs/core/boxes/box_services_expired.php index a59c4ac991b..77ec1dd5ef3 100644 --- a/htdocs/core/boxes/box_services_expired.php +++ b/htdocs/core/boxes/box_services_expired.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -41,7 +41,7 @@ class box_services_expired extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param) + public function __construct($db, $param) // @phpstan-ignore constructor.unusedParameter { global $user; diff --git a/htdocs/core/boxes/box_shipments.php b/htdocs/core/boxes/box_shipments.php index 0dd5e4e0718..31a7a9209ae 100644 --- a/htdocs/core/boxes/box_shipments.php +++ b/htdocs/core/boxes/box_shipments.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2019 Alexandre Spangaro - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -44,7 +44,7 @@ class box_shipments extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param) + public function __construct($db, $param) // @phpstan-ignore constructor.unusedParameter { global $user; diff --git a/htdocs/core/boxes/box_supplier_orders.php b/htdocs/core/boxes/box_supplier_orders.php index f5cf01d3929..529f1b402a2 100644 --- a/htdocs/core/boxes/box_supplier_orders.php +++ b/htdocs/core/boxes/box_supplier_orders.php @@ -3,7 +3,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2012 Raphaël Doursenaud * Copyright (C) 2015-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -42,7 +42,7 @@ class box_supplier_orders extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param) + public function __construct($db, $param) // @phpstan-ignore constructor.unusedParameter { global $user; diff --git a/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php b/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php index 558c358a801..3aea8b4b930 100644 --- a/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php +++ b/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php @@ -3,7 +3,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2012 Raphaël Doursenaud * Copyright (C) 2015-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -42,7 +42,7 @@ class box_supplier_orders_awaiting_reception extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param) + public function __construct($db, $param) // @phpstan-ignore constructor.unusedParameter { global $user; diff --git a/htdocs/core/boxes/box_task.php b/htdocs/core/boxes/box_task.php index e9ef4e3cff1..d5f3c9b1f5a 100644 --- a/htdocs/core/boxes/box_task.php +++ b/htdocs/core/boxes/box_task.php @@ -1,7 +1,7 @@ * Copyright (C) 2015-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -48,7 +48,7 @@ class box_task extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param = '') + public function __construct($db, $param = '') // @phpstan-ignore constructor.unusedParameter { global $user, $langs; diff --git a/htdocs/core/boxes/box_validated_projects.php b/htdocs/core/boxes/box_validated_projects.php index 290bd74f086..8a4118a1cd9 100644 --- a/htdocs/core/boxes/box_validated_projects.php +++ b/htdocs/core/boxes/box_validated_projects.php @@ -5,7 +5,7 @@ * Copyright (C) 2016 Juan José Menent * Copyright (C) 2020 Pierre Ardoin * Copyright (C) 2023 Gauthier VERDOL - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -50,7 +50,7 @@ class box_validated_projects extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param = '') + public function __construct($db, $param = '') // @phpstan-ignore constructor.unusedParameter { global $conf, $user, $langs; diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php index d7d85fbe8b6..5418f65686f 100644 --- a/htdocs/core/boxes/modules_boxes.php +++ b/htdocs/core/boxes/modules_boxes.php @@ -3,7 +3,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2014 Raphaël Doursenaud * Copyright (C) 2015-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 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 @@ -52,12 +52,12 @@ class ModeleBoxes // Can't be abstract as it is instantiated to build "empty" bo public $param; /** - * @var array,sublink?:string,subtext?:string,picto?:string,target?:string,td?:string}>|array{text:string,nbcol?:int,limit?:int,graph?:int<0,1>,sublink?:string,subtext?:string,picto?:string,target?:string,td?:string} box info heads. Example: array('text' => $langs->trans("BoxScheduledJobs", $max), 'nbcol' => 4); + * @var array,sublink?:string,subtext?:string,picto?:string,target?:string,td?:string}>|array{text:string,nbcol?:int,limit?:int,graph?:int<0,1>,sublink?:string,subtext?:string,picto?:string,target?:string,td?:string} box info heads. Example: array('text' =>->trans("BoxScheduledJobs",), 'nbcol' => 4); */ public $info_box_head = array(); /** - * @var array,maxlength?:int}>>|array,maxlength?:int}> box info content + * @var array,maxlength?:int}|array{td?:string,textnoformat:string,asis?:int<0,1>,maxlength?:int}>>|array,maxlength?:int}|array{td?:string,textnoformat:string,asis?:int<0,1>,maxlength?:int}> box info content */ public $info_box_contents = array(); @@ -175,7 +175,7 @@ class ModeleBoxes // Can't be abstract as it is instantiated to build "empty" bo * @param DoliDB $db Database handler * @param string $param More parameters */ - public function __construct($db, $param = '') + public function __construct($db, $param = '') // @phpstan-ignore constructor.unusedParameter { $this->db = $db; } @@ -487,7 +487,6 @@ class ModeleBoxes // Can't be abstract as it is instantiated to build "empty" bo * * @param ?string[] $forcedirwidget null=All default directories. This parameter is used by modulebuilder module only. * @return array Array list of widgets - * */ public static function getWidgetsList($forcedirwidget = null) { diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index d81b8d5ce98..efb970ee10f 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -189,6 +189,7 @@ class CMailFile public $html_images = array(); /** @var array */ public $images_encoded = array(); + /** @var array Filename extension to MIME mapping */ public $image_types = array( 'gif' => 'image/gif', 'jpg' => 'image/jpeg', diff --git a/htdocs/core/class/cleadstatus.class.php b/htdocs/core/class/cleadstatus.class.php index 6d131c0a3c4..43a745aa92c 100644 --- a/htdocs/core/class/cleadstatus.class.php +++ b/htdocs/core/class/cleadstatus.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2020 Florian HENRY - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 MDW * Copyright (C) 2025 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -183,7 +183,7 @@ class CLeadStatus extends CommonDict * @param int $offset Offset * @param string $filter Filter USF * @param string $filtermode Filter mode (AND or OR) - * @return array|int int <0 if KO, array of pages if OK + * @return self[]|int int <0 if KO, array of pages if OK */ public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = '', $filtermode = 'AND') { diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 38fc34643f1..d5d44de4434 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -4,7 +4,7 @@ * Copyright (C) 2012-2014 Raphaël Doursenaud * Copyright (C) 2023 Nick Fragoulis * Copyright (C) 2024-2025 Frédéric France - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2026 MDW * Copyright (C) 2024-2026 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify @@ -615,7 +615,7 @@ abstract class CommonInvoice extends CommonObject // List of payments if (empty($mode) || $mode == 1) { - $sql = "SELECT p.ref, pf.amount, pf.multicurrency_amount, p.fk_paiement, p.datep, p.num_paiement as num, t.code".($field3 ? ", ".$this->db->sanitize($field3) : "") . ($field4 ? ", ".$this->db->sanitize($field4) : ""); + $sql = "SELECT p.ref, pf.amount, pf.multicurrency_amount, p.fk_paiement, p.datep, p.num_paiement as num, t.code".($field3 ? ", ".$this->db->sanitize($field3) : "") . (", ".$this->db->sanitize($field4)); $sql .= " FROM ".$this->db->prefix().$table." as pf, ".$this->db->prefix().$table2." as p, ".$this->db->prefix()."c_paiement as t"; $sql .= " WHERE pf.".$this->db->sanitize($field)." = ".((int) $this->id); $sql .= " AND pf.".$this->db->sanitize($field2)." = p.rowid"; @@ -734,7 +734,7 @@ abstract class CommonInvoice extends CommonObject // If not a draft invoice and not temporary invoice if ($tmppart !== 'PROV') { - if ($this instanceOf Facture) { + if ($this instanceof Facture) { /* @var Facture $this */ // If sent by email, we refuse if ((int) $this->email_sent_counter > 0) { @@ -906,7 +906,7 @@ abstract class CommonInvoice extends CommonObject // If not a draft invoice and not temporary invoice if ($tmppart !== 'PROV') { - if ($this instanceOf Facture) { + if ($this instanceof Facture) { /* @var Facture $this */ // If sent by email, we refuse if ((int) $this->email_sent_counter > 0) { @@ -987,6 +987,10 @@ abstract class CommonInvoice extends CommonObject */ public function getVentilExportCompta($mode = 0) { + if (!isModEnabled('accounting')) { + return 0; + } + $alreadydispatched = 0; $type = 'customer_invoice'; @@ -1253,7 +1257,7 @@ abstract class CommonInvoice extends CommonObject 'paye' => $paye, 'alreadypaid' => $alreadypaid, 'type' => $type, - 'paramsBadge'=>& $paramsBadge + 'paramsBadge' => & $paramsBadge ); $reshook = $hookmanager->executeHooks('LibStatut', $parameters, $this); // Note that $action and $object may have been modified by hook @@ -1438,7 +1442,7 @@ abstract class CommonInvoice extends CommonObject $sql .= " AND type = 'ban'"; // To exclude record done for some online payments $sql .= " AND traite = 0"; // Not yet in a transfer receipt dol_syslog(get_class($this)."::demande_prelevement - get pending requests not yet in receipt", LOG_DEBUG); - $resql= $this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { $obj = $this->db->fetch_object($resql); $total_already_requested += $obj ? (float) $obj->total_requested : 0; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 2386a7d0d18..f41bc0c7bfc 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4914,7 +4914,7 @@ abstract class CommonObject * @param string $field_select name of field we need to get a list * @param string $field_where name of field of object we need to get linked items * @param string $table_element name of association table - * @return array|int Array of record, -1 if empty + * @return string[]|int Array of record, -1 if empty */ public static function getAllItemsLinkedByObjectID($fk_object_where, $field_select, $field_where, $table_element) { @@ -4946,7 +4946,7 @@ abstract class CommonObject * @param int $fk_object_where id of object we need to get linked items * @param string $field_where name of field of object we need to get linked items * @param string $table_element name of association table - * @return array|int Array of record, -1 if empty + * @return int<-1,max> Array of records, -1 if empty argument */ public static function getCountOfItemsLinkedByObjectID($fk_object_where, $field_where, $table_element) { @@ -6957,7 +6957,7 @@ abstract class CommonObject */ public function insertExtraFields($trigger = '', $userused = null) { - global $langs, $user; + global $langs, $extrafields, $user; if (getDolGlobalString('MAIN_EXTRAFIELDS_DISABLED') || empty($this->array_options)) { return 0; @@ -6971,8 +6971,10 @@ abstract class CommonObject // Check parameters $langs->load('admin'); - require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - $extrafields = new ExtraFields($this->db); + if (!isset($extrafields) || !is_object($extrafields)) { + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + $extrafields = new ExtraFields($this->db); + } $target_extrafields = $extrafields->fetch_name_optionals_label($this->table_element); // Eliminate copied source object extra fields that do not exist in target object @@ -7436,7 +7438,7 @@ abstract class CommonObject */ public function updateExtraField($key, $trigger = null, $userused = null) { - global $langs, $user, $hookmanager; + global $langs, $user, $extrafields, $hookmanager; if (getDolGlobalString('MAIN_EXTRAFIELDS_DISABLED')) { return 0; @@ -7451,8 +7453,10 @@ abstract class CommonObject if (!empty($this->array_options) && isset($this->array_options["options_".$key])) { // Check parameters $langs->load('admin'); - require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - $extrafields = new ExtraFields($this->db); + if (!isset($extrafields) || !is_object($extrafields)) { + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + $extrafields = new ExtraFields($this->db); + } $extrafields->fetch_name_optionals_label($this->table_element); $value = $this->array_options["options_".$key]; diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index 6b90c1fec67..f34ef1ed65a 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2021 Gaëtan MAISON - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2026 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -103,7 +103,7 @@ class DolEditor * @param string $toolbarname Name of the toolbar set to use ('Basic', 'dolibarr_details[_encoded]'=the less featured, 'dolibarr_notes[_encoded]' for notes content, 'dolibarr_mailings[_encoded]' for emailing content, 'dolibarr_readonly'). * @param string $notused Deprecated. Not used * @param bool $toolbarstartexpanded Bar is visible or not at start - * @param bool|int $uselocalbrowser Enabled to add links to local object with a local media filemanager. -1=auto, false=only external images URL can be added into content, or images saved inline with src="data:..." with a cut/paste. + * @param bool|int $uselocalbrowser Enabled to add links to local object with a local media filemanager. -1 or true = auto, false = only external images URL can be added into content, or images saved inline with src="data:..." with a cut/paste. * @param bool|int|string $okforextendededitor 1 or True=Allow usage of extended editor tool if qualified (like ckeditor). If 'textarea', force use of simple textarea. If 'ace', force use of Ace. * Warning: If you use 'ace', don't forget to also include ace.js in page header. Also, the button "save" must have class="buttonforacesave". * @param int $rows Size of rows for textarea tool @@ -112,13 +112,13 @@ class DolEditor * @param array{x?:string,y?:string,find?:string} $poscursor Array for initial cursor position array('x'=>x, 'y'=>y). * array('find'=> 'word') can be used to go to line were the word has been found */ - public function __construct($htmlname, $content, $width = '', $height = 200, $toolbarname = 'Basic', $notused = '', $toolbarstartexpanded = false, $uselocalbrowser = -1, $okforextendededitor = true, $rows = 0, $cols = '', $readonly = 0, $poscursor = array()) + public function __construct($htmlname, $content, $width = '', $height = 200, $toolbarname = 'Basic', $notused = '', $toolbarstartexpanded = false, $uselocalbrowser = -1, $okforextendededitor = true, $rows = 0, $cols = '', $readonly = 0, $poscursor = array()) // @phpstan-ignore constructor.unusedParameter { global $conf; dol_syslog(get_class($this)."::DolEditor htmlname=".$htmlname." width=".$width." height=".$height." toolbarname=".$toolbarname." uselocalbrowser=".$uselocalbrowser); - if ($uselocalbrowser === -1) { + if ($uselocalbrowser) { // This may not be supported by new generation of WYSIWYG editors. $uselocalbrowser = getDolGlobalInt("WYSIWYG_ALLOW_UPLOAD_MEDIA_FILES"); } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index f841299868b..2edd9c39a4d 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -26,6 +26,7 @@ * Copyright (C) 2024-2026 MDW * Copyright (C) 2024 William Mead * Copyright (C) 2026 Lenin Rivas + * Copyright (C) 2026 Open-Dsi * * 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 @@ -98,6 +99,11 @@ class Form /** @var array */ public $cache_rule_for_lines_dates = array(); + /** + * @var bool Whether the shared phone input JS (country-sync) has been emitted + */ + private $phoneInputSharedJsLoaded = false; + /** * Constructor @@ -1114,6 +1120,285 @@ class Form return $out; } + /** + * Return a select list of country phone calling codes + * + * @param string $selected Pre-selected phone code value (e.g. "+33") + * @param string $htmlname Name of HTML select element + * @param string $morecss More CSS classes + * @param int $showempty Show empty option (1) or not (0) + * @param int $country_id_hint Country ID to prefer when multiple countries share a code + * @return string HTML select string + */ + public function selectPhoneCode($selected = '', $htmlname = 'phone_code', $morecss = 'maxwidth150', $showempty = 0, $country_id_hint = 0) + { + global $langs; + + $langs->load("dict"); + + $out = ''; + $codeArray = array(); + $favorite = array(); + $label = array(); + $atleastonefavorite = 0; + + $sql = "SELECT rowid, code, label, phone_code, favorite, trunk_prefix"; + $sql .= " FROM ".$this->db->prefix()."c_country"; + $sql .= " WHERE active > 0 AND phone_code IS NOT NULL AND phone_code != ''"; + + dol_syslog(get_class($this)."::selectPhoneCode", LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) { + $num = $this->db->num_rows($resql); + $i = 0; + while ($i < $num) { + $obj = $this->db->fetch_object($resql); + + $translabel = ($obj->code && $langs->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langs->transnoentitiesnoconv("Country".$obj->code) : $obj->label; + + $codeArray[$i]['rowid'] = $obj->rowid; + $codeArray[$i]['code'] = $obj->code; + $codeArray[$i]['label'] = $translabel; + $codeArray[$i]['phone_code'] = '+'.$obj->phone_code; + $codeArray[$i]['favorite'] = $obj->favorite; + $codeArray[$i]['trunk_prefix'] = $obj->trunk_prefix; + $favorite[$i] = $obj->favorite; + $label[$i] = dol_string_unaccent($translabel); + $i++; + } + + $array1_sort_order = SORT_DESC; + $array2_sort_order = SORT_ASC; + array_multisort($favorite, $array1_sort_order, $label, $array2_sort_order, $codeArray); + + $out .= ''; + + // Picto + $out .= img_picto('', $picto, 'class="pictofixedwidth"'); + + // Phone code select (display-only name, not submitted as separate POST param) + $out .= $this->selectPhoneCode($selectedCode, $codename, 'maxwidth75 phone_code_select', 0, $country_id_hint); + + // Visible number input (no name — not POSTed) + $out .= ' 0) { + $out .= ' maxlength="'.$maxlength.'"'; + } + $out .= ' value="'.dol_escape_htmltag($numberValue).'">'; + + // Per-field JS to sync hidden field + $out .= $this->getPhoneInputFieldJs($htmlname, $codename); + + // Shared JS for country-sync (output once per page) + $out .= $this->getPhoneInputSharedJs($countrySelectorId); + + return $out; + } + + /** + * Return inline JS that syncs the hidden phone field from select + text input. + * + * Strips formatting chars and trunk prefix from the number, then builds + * the hidden value as "{code} {number}" or just "{number}" if no code. + * + * @param string $htmlname Base name (e.g. "phone_pro") + * @param string $codename Code select name (e.g. "phone_pro_code") + * @return string Inline '."\n"; + + return $out; + } + + /** + * Return inline JS for country-selector → phone code sync (output once per page). + * + * When the country select changes, fetches the phone code via AJAX and updates + * all .phone_code_select dropdowns, which in turn triggers per-field sync. + * + * @param string $countrySelectorId ID of the country select element + * @return string Inline '."\n"; + + return $out; + } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index bf52138fbe6..2bf8b35d575 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -266,7 +266,7 @@ class FormMail extends Form public $withtoccuser = array(); /** - * @var ModelMail[] + * @var CEmailTemplate[] */ public $lines_model; @@ -1102,6 +1102,7 @@ class FormMail extends Form $defaultmessage = preg_replace("/^\n+/", "", $defaultmessage); } + $out .= ''; $out .= ''; $out .= ''; } + $topic = ""; foreach ($formmail->lines_model as $line) { if (!empty($this->substit) && $this->param['models_id'] == $line->id) { @@ -1797,9 +1803,9 @@ class FormTicket } print ''; if (empty($topic)) { - print ''; @@ -1870,7 +1876,10 @@ class FormTicket $defaultmessage = preg_replace("/^\n+/", "", $defaultmessage); } - print ''; + print ''; + $out = ''; + print $out; + + print ''; print ''; // Owner $out .= ''; // Type $out .= ''; // Title/Label of event @@ -2565,6 +2568,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = null, $nopr $label = $histo[$key]['note']; $actionstatic->id = $histo[$key]['id']; $out .= ' title="' . dol_escape_htmltag($label) . '">'; + $label = preg_replace('/^\[[^\[]*\]/', '[...]', $label); $out .= dol_trunc($label, 120); } if (isset($histo[$key]['type']) && $histo[$key]['type'] == 'mailing') { @@ -2573,7 +2577,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = null, $nopr $label .= ' - ' . $histo[$key]['note']; $out .= ''; - //$out .= img_object($langs->trans("EMailing").'
'.$histo[$key]['note'], "email").' '; + $label = preg_replace('/^\[[^\[]*\]/', '[...]', $label); $out .= dol_trunc($label, 120); $out .= '
'; } diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 34eff7dc3c4..9e5ef6f8596 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -4,7 +4,7 @@ * Copyright (C) 2011-2015 Juanjo Menent * Copyright (C) 2017 Ferran Marcet * Copyright (C) 2018-2024 Charlene Benke - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2026 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -31,7 +31,7 @@ /** * Return an array with timezone values * - * @return array,string> Array with timezone values + * @return array,string> Array with timezone values */ function get_tz_array() { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index c47889994d4..7f57029ba2b 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1765,9 +1765,10 @@ function dol_buildpath($path, $type = 0, $returnemptyifnotfound = 0) * @param string $url Relative path to file * @param array $params params for the http query * @param bool $addtoken does we need to add token + * @param string $anchor Add an anchor #xxx at end of URL * @return string path */ -function dolBuildUrl($url, $params = [], $addtoken = false) +function dolBuildUrl($url, $params = [], $addtoken = false, $anchor = '') { global $db, $hookmanager; @@ -1790,13 +1791,12 @@ function dolBuildUrl($url, $params = [], $addtoken = false) if ($addtoken) { $params = array_merge($params, ['token' => newToken()]); } - // TODO TO REMOVE - if (getDolGlobalString('MAIN_DEBUG_DOL_BUILDURL')) { - $params = array_merge($params, ['debug' => 'debug']); - } if ($params) { $url .= '?' . http_build_query($params); } + if ($anchor) { + $url .= '#' . preg_replace('/[^a-z]/i', '', $anchor); + } return $url; } @@ -16983,7 +16983,11 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = null, $libelle = ''; if (!empty($actionstatic->code) && preg_match('/^TICKET_MSG_PRIVATE/', $actionstatic->code)) { - $out .= $langs->trans('TicketNewMessage').' ('.$langs->trans('Private').')'; + $out .= $langs->trans('TicketNewMessage').' - '.img_picto($langs->trans('Private'), 'lock', 'class="valignmiddle"').' '.$langs->trans('Private').''; + $summary = preg_replace('/\[[^\]]*\]\s*/', '', $actionstatic->label); + //if ($summary != $object->title) { + $out .= ' - '.dolPrintHTML($summary); + //} } elseif (!empty($actionstatic->code) && preg_match('/^TICKET_MSG/', $actionstatic->code)) { $out .= $langs->trans('TicketNewMessage'); } elseif (isset($histo[$key]['type'])) { diff --git a/htdocs/core/lib/phone.lib.php b/htdocs/core/lib/phone.lib.php new file mode 100644 index 00000000000..bc241061382 --- /dev/null +++ b/htdocs/core/lib/phone.lib.php @@ -0,0 +1,160 @@ + + * + * 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 + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/core/lib/phone.lib.php + * \ingroup core + * \brief Helper functions for phone number formatting + */ + +/** + * Parse a stored phone number into country code and number parts + * + * Stored format is "+{code} {number}" (e.g. "+33 644986885"). + * If no code is found, returns empty code and the full string as number. + * + * @param string $phone Stored phone number + * @return array{code:string,number:string} Array with 'code' and 'number' keys + */ +function dol_parse_phone($phone) +{ + $phone = trim((string) $phone); + if ($phone === '') { + return array('code' => '', 'number' => ''); + } + + if (strpos($phone, '+') === 0) { + $pos = strpos($phone, ' '); + if ($pos !== false) { + return array( + 'code' => substr($phone, 0, $pos), + 'number' => substr($phone, $pos + 1) + ); + } + // Phone starts with + but has no space: try to keep it as-is in code + return array('code' => '', 'number' => $phone); + } + + return array('code' => '', 'number' => $phone); +} + +/** + * Build a normalized phone string from code and number parts + * + * Strips formatting characters (spaces, dashes, dots, parentheses) from number. + * Also strips the national trunk prefix for the country matching $code + * (e.g. leading "0" for France, "8" for Russia, "06" for Hungary). + * Returns "+{code} {number}" or just the number if code is empty. + * + * @param DoliDB $db Database handler + * @param string $code Country calling code (e.g. "+33") + * @param string $number Phone number (may contain formatting) + * @return string Normalized phone string + */ +function dol_build_phone($db, $code, $number) +{ + $number = preg_replace('/[\s\-\.\(\)]/', '', trim((string) $number)); + $code = trim((string) $code); + + if ($number === '') { + return ''; + } + + if ($code !== '') { + // Strip national trunk prefix (e.g. leading "0" for France) + $sql = "SELECT trunk_prefix FROM ".$db->prefix()."c_country"; + $sql .= " WHERE phone_code = ".((int) ltrim($code, '+')); + $sql .= " AND trunk_prefix IS NOT NULL AND trunk_prefix != ''"; + $sql .= " LIMIT 1"; + $resql = $db->query($sql); + if ($resql) { + $obj = $db->fetch_object($resql); + if ($obj && isset($obj->trunk_prefix) && $obj->trunk_prefix !== '' && $obj->trunk_prefix !== null) { + $prefix = $obj->trunk_prefix; + if (strpos($number, $prefix) === 0) { + $number = substr($number, strlen($prefix)); + } + } + $db->free($resql); + } + } + + if ($code !== '') { + return $code.' '.$number; + } + + return $number; +} + +/** + * Get the national trunk prefix for a phone code + * + * @param DoliDB $db Database handler + * @param string $phone_code Phone code (e.g. "+33") + * @return string Trunk prefix (e.g. "0") or empty string + */ +function dol_get_trunk_prefix($db, $phone_code) +{ + $phone_code = trim((string) $phone_code); + if ($phone_code === '') { + return ''; + } + + $sql = "SELECT trunk_prefix FROM ".$db->prefix()."c_country"; + $sql .= " WHERE phone_code = ".((int) ltrim($phone_code, '+')); + $sql .= " AND trunk_prefix IS NOT NULL AND trunk_prefix != ''"; + $sql .= " LIMIT 1"; + $resql = $db->query($sql); + if ($resql) { + $obj = $db->fetch_object($resql); + if ($obj && isset($obj->trunk_prefix) && $obj->trunk_prefix !== '' && $obj->trunk_prefix !== null) { + $db->free($resql); + return $obj->trunk_prefix; + } + $db->free($resql); + } + + return ''; +} + +/** + * Get the phone calling code for a country + * + * @param DoliDB $db Database handler + * @param int $country_id Country rowid + * @return string Phone code (e.g. "+33") or empty string + */ +function dol_get_phone_code_from_country($db, $country_id) +{ + $country_id = (int) $country_id; + if ($country_id <= 0) { + return ''; + } + + $sql = "SELECT phone_code FROM ".$db->prefix()."c_country WHERE rowid = ".((int) $country_id); + $resql = $db->query($sql); + if ($resql) { + $obj = $db->fetch_object($resql); + if ($obj && !empty($obj->phone_code)) { + $db->free($resql); + return '+'.$obj->phone_code; + } + $db->free($resql); + } + + return ''; +} diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index 639a33fe26f..f91f6d98431 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -535,10 +535,12 @@ function show_stats_for_company($product, $socid) $nblines = 0; print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; print ''; // Customer proposals @@ -550,7 +552,7 @@ function show_stats_for_company($product, $socid) } $langs->load("propal"); print '
'.($s ? $s.' ' : '')." ".$langs->trans('Language_'.$key).": ".''.img_delete('', '').'
'.($s ? $s.' ' : '').' '.$langs->trans('Language_'.$key).': $object->id, 'action' => 'delete', 'langtodelete' => $key, 'type' => $type], true).'">'.img_delete('', '').'
'.$langs->trans('Label').''.($object->multilangs[$key]["label"] ?? '').'
'.$langs->trans('Description').''.($object->multilangs[$key]["description"] ?? '').'
'.$form->editfieldkey('PhonePro', 'phone_pro', '', $object, 0).''; - print img_picto('', 'object_phoning', 'class="pictofixedwidth"'); - print '
'.$form->editfieldkey('PhonePerso', 'phone_perso', '', $object, 0).''; - print img_picto('', 'object_phoning', 'class="pictofixedwidth"'); - print '
'.$form->editfieldkey('PhoneMobile', 'phone_mobile', '', $object, 0).''; - print img_picto('', 'object_phoning_mobile', 'class="pictofixedwidth"'); - print '
'.$form->editfieldkey('Fax', 'fax', '', $object, 0).''; - print img_picto('', 'object_phoning_fax', 'class="pictofixedwidth"'); - print '
'.$form->editfieldkey('PhonePro', 'phone_pro', GETPOST('phone_pro', 'alpha'), $object, 0).''; - print img_picto('', 'object_phoning', 'class="pictofixedwidth"'); - print '
'.$form->editfieldkey('PhonePerso', 'fax', GETPOST('phone_perso', 'alpha'), $object, 0).''.$form->editfieldkey('PhonePerso', 'phone_perso', GETPOST('phone_perso', 'alpha'), $object, 0).''; - print img_picto('', 'object_phoning', 'class="pictofixedwidth"'); - print '
'.$form->editfieldkey('PhoneMobile', 'phone_mobile', GETPOST('phone_mobile', 'alpha'), $object, 0, 'string', '').''; - print img_picto('', 'object_phoning_mobile', 'class="pictofixedwidth"'); - print '
'.$form->editfieldkey('Fax', 'fax', GETPOST('fax', 'alpha'), $object, 0).''; - print img_picto('', 'object_phoning_fax', 'class="pictofixedwidth"'); - print '
'.$form->editfieldkey('EMail', 'email', GETPOST('email', 'alpha'), $object, 0, 'string', '', (int) (getDolGlobalInt('SOCIETE_EMAIL_MANDATORY'))).'
'; $out .= $form->textwithpicto($langs->trans('MailText'), $helpforsubstitution, 1, 'help', '', 0, 2, 'substittooltipfrombody'); diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 1b32a9e08df..9e6c1fdf5d6 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -1569,11 +1569,13 @@ class FormTicket jQuery("#send_msg_email").prop("checked", true).trigger("change"); } jQuery(".email_line").show(); + jQuery(".not_email_line").hide(); } else { if (!jQuery("#private_message").is(":checked")) { jQuery("#private_message").prop("checked", true).trigger("change"); } jQuery(".email_line").hide(); + jQuery(".not_email_line").show(); } '; @@ -1586,9 +1588,11 @@ class FormTicket jQuery("#private_message").prop("checked", false).trigger("change"); } jQuery(".email_line").show(); + jQuery(".not_email_line").hide(); } else { jQuery(".email_line").hide(); + jQuery(".not_email_line").show(); } }); @@ -1599,6 +1603,7 @@ class FormTicket jQuery("#send_msg_email").prop("checked", false).trigger("change"); } jQuery(".email_line").hide(); + jQuery(".not_email_line").show(); } });'; } @@ -1778,7 +1783,7 @@ class FormTicket // Summary if ($this->withtitletopic) { - print '
'; + print '
'; // Answer to a ticket : display of the thread title in readonly if ($this->withtopicreadonly && $this->topic_title) { print $langs->trans('Summary').' '.$this->topic_title; @@ -1788,6 +1793,7 @@ class FormTicket } print '
'; + + $out .= '
'; + + // Required to show editor assistants + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; + $formmail = new FormMail($this->db); + + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formai.class.php'; + $formai = new FormAI($this->db); + + $formmail->withfckeditor = $ckeditorenabledforticket ? 1 : 0; + $formmail->withlayout = (string) $ckeditorenabledforticket ? 'email' : ''; + $formmail->withaiprompt = isModEnabled('ai') ? 'text' : ''; + $formai = new FormAI($this->db); + + $showlinktolayout = ($formmail->withfckeditor && getDolGlobalInt('MAIN_EMAIL_USE_LAYOUT')) ? $formmail->withlayout : ''; + $showlinktolayoutlabel = $langs->trans("FillMessageWithALayout"); + $showlinktoai = ($formmail->withaiprompt ? 'textgenerationemail' : ''); + $showlinktoailabel = $langs->trans("AIEnhancements"); + $formatforouput = ''; + $htmlname = 'message'; + + $formai->substit = $this->substit; + + // Fill $out + $db = $this->db; + include DOL_DOCUMENT_ROOT.'/core/tpl/formlayoutai.tpl.php'; + + $out .= '
'; @@ -1896,7 +1938,6 @@ class FormTicket $toolbarname = 'dolibarr_notes'; include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $uselocalbrowser = false; - $ckeditorenabledforticket = (getDolGlobalString('FCKEDITOR_ENABLE_TICKET') >= 2); // 0=no, 1=from backoffice only, 2=from backoffice+public (very dangerous) if (!$ckeditorenabledforticket) { $defaultmessage = dol_string_nohtmltag($defaultmessage, 2); } diff --git a/htdocs/core/class/menubase.class.php b/htdocs/core/class/menubase.class.php index 247f007737f..23b2e3f7552 100644 --- a/htdocs/core/class/menubase.class.php +++ b/htdocs/core/class/menubase.class.php @@ -2,7 +2,7 @@ /* Copyright (C) 2007-2009 Laurent Destailleur * Copyright (C) 2009-2012 Regis Houssin * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2026 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 @@ -569,7 +569,7 @@ class Menubase foreach ($tabMenu as $key => $val) { // Define menutopid of mainmenu if (empty($menutopid) && $val['type'] == 'top' && $val['mainmenu'] == $mainmenu) { - $menutopid = $val['rowid']; + $menutopid = (int) $val['rowid']; break; } } diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index ac91a67dce5..9fdc693b783 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -139,7 +139,9 @@ class Notify */ public $fk_project; - // This codes actions are defined into table llx_notify_def + /** + * @var string[] These codes actions are defined in table llx_notify_def + */ public static $arrayofnotifsupported = array( 'BILL_CANCEL', 'BILL_VALIDATE', @@ -185,10 +187,10 @@ class Notify * Return message that say how many notification (and to which email) will occurs on requested event. * This is to show confirmation messages before event is recorded. * - * @param string $action Id of action in llx_c_action_trigger - * @param int $socid Id of third party - * @param Object $object Object the notification is about - * @return string Message + * @param string $action Id of action in llx_c_action_trigger + * @param int $socid Id of third party + * @param ?CommonObject $object Object the notification is about + * @return string Message */ public function confirmMessage($action, $socid, $object) { @@ -451,10 +453,10 @@ class Notify * * @param string $notifcode Code of action in llx_c_action_trigger (new usage) or Id of action in llx_c_action_trigger (old usage) * @param int $socid Id of third party or 0 for all thirdparties or -1 for no thirdparties - * @param CommonObject $object Object the notification is about (need it to check threshold value of some notifications) + * @param ?CommonObject $object Object the notification is about (need it to check threshold value of some notifications) * @param int $userid Id of user or 0 for all users or -1 for no users - * @param array $scope Scope where to search - * @return array|int Return integer <0 if KO, array of notifications to send if OK + * @param string[] $scope Scope where to search + * @return array|-1 Return integer <0 if KO, array of notifications to send if OK */ public function getNotificationsArray($notifcode, $socid = 0, $object = null, $userid = 0, $scope = array('thirdparty', 'user', 'global')) { @@ -547,7 +549,7 @@ class Notify $newval2 = trim($obj->email); $isvalid = isValidEmail($newval2); if (empty($resarray[$newval2])) { - $resarray[$newval2] = array('type' => 'touser', 'code' => trim($obj->code), 'emaildesc' => 'User id '.$obj->rowid, 'email' => $newval2, 'userid' => $obj->rowid, 'isemailvalid' => $isvalid); + $resarray[$newval2] = array('type' => 'touser', 'code' => trim($obj->code), 'emaildesc' => 'User id '.$obj->rowid, 'email' => $newval2, 'userid' => (int) $obj->rowid, 'isemailvalid' => $isvalid); } } $i++; diff --git a/htdocs/core/class/rssparser.class.php b/htdocs/core/class/rssparser.class.php index c57011ab8ba..fd8e505d015 100644 --- a/htdocs/core/class/rssparser.class.php +++ b/htdocs/core/class/rssparser.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -99,6 +99,9 @@ class RssParser */ private $current_namespace; + /** + * @var array|array>> + */ public $items = array(); /** * @var array|array> @@ -811,11 +814,14 @@ class RssParser } } else { if (!empty($this->initem)) { - $this->concat($this->current_item[$el], $text); + // @phpstan-ignore-next-line argument.type + $this->concat($this->current_item[$el], $text); // @phan-suppress-current-line PhanTypeMismatchArgument } elseif (!empty($this->intextinput)) { - $this->concat($this->textinput[$el], $text); + // @phpstan-ignore-next-line argument.type + $this->concat($this->textinput[$el], $text); // @phan-suppress-current-line PhanTypeMismatchArgument } elseif (!empty($this->inimage)) { - $this->concat($this->image[$el], $text); + // @phpstan-ignore-next-line argument.type + $this->concat($this->image[$el], $text); // @phan-suppress-current-line PhanTypeMismatchArgument } elseif (!empty($this->inchannel)) { $this->concat($this->channel[$el], $text); } diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index e2952de5303..4c79a7bddbf 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2015 Laurent Destailleur * Copyright (C) 2006-2011 Regis Houssin * Copyright (C) 2016 Jonathan TISSEAU - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2026 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -143,7 +143,7 @@ class SMTPs private $_msgSensitivity = 0; /** - * @var string[] Message Sensitivity + * @var array Message Sensitivity */ private $_arySensitivity = array(false, 'Personal', @@ -151,7 +151,7 @@ class SMTPs 'Company Confidential'); /** - * @var int Message Sensitivity + * @var int<0,5> Message Sensitivity * Defaults to 3 - Normal */ private $_msgPriority = 3; diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index b48531ee7ca..2a3bfa71561 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -59,7 +59,7 @@ class DoliDBMysqli extends DoliDB * @param string $name Name of database * @param int $port Port of database server */ - public function __construct($type, $host, $user, $pass, $name = '', $port = 0) + public function __construct($type, $host, $user, $pass, $name = '', $port = 0) // @phpstan-ignore constructor.unusedParameter { global $conf, $langs; @@ -146,7 +146,7 @@ class DoliDBMysqli extends DoliDB exit; } - $collation = (empty($conf) ? 'utf8_unicode_ci' : $conf->db->dolibarr_main_db_collation); + $collation = (empty($conf) ? 'utf8_unicode_ci' : (string) $conf->db->dolibarr_main_db_collation); if (preg_match('/latin1/', $collation)) { $collation = 'utf8_unicode_ci'; } @@ -179,7 +179,7 @@ class DoliDBMysqli extends DoliDB if (empty($disableforcecharset) && $this->db->character_set_name() != $clientmustbe) { $this->db->set_charset($clientmustbe); // This set utf8_unicode_ci - $collation = $conf->db->dolibarr_main_db_collation; + $collation = (string) $conf->db->dolibarr_main_db_collation; if (preg_match('/latin1/', $collation)) { $collation = 'utf8_unicode_ci'; } @@ -1368,7 +1368,7 @@ if (class_exists('mysqli')) { * @param int $port Port of database server * @param string $socket Socket */ - public function __construct($host, $user, $pass, $name, $port = 0, $socket = "") + public function __construct($host, $user, $pass, $name, $port = 0, $socket = "") // @phpstan-ignore constructor.unusedParameter { $flags = 0; if (PHP_VERSION_ID >= 80100) { @@ -1379,7 +1379,7 @@ if (class_exists('mysqli')) { } if (strpos($host, 'ssl://') === 0) { $host = substr($host, 6); - parent::options(MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, false); + parent::options(MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, 0); // Suppress false positive @phan-suppress-next-line PhanTypeMismatchArgumentInternalProbablyReal parent::ssl_set(null, null, "", null, null); $flags = MYSQLI_CLIENT_SSL; diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index ff1d920a5eb..ff3b72d85d2 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -78,7 +78,7 @@ class DoliDBPgsql extends DoliDB * @param string $name Nom de la database * @param int $port Port of database server */ - public function __construct($type, $host, $user, $pass, $name = '', $port = 0) + public function __construct($type, $host, $user, $pass, $name = '', $port = 0) // @phpstan-ignore constructor.unusedParameter { global $conf, $langs; diff --git a/htdocs/core/db/sqlite3.class.php b/htdocs/core/db/sqlite3.class.php index 1d1335ac13a..f2094e57b55 100644 --- a/htdocs/core/db/sqlite3.class.php +++ b/htdocs/core/db/sqlite3.class.php @@ -67,7 +67,7 @@ class DoliDBSqlite3 extends DoliDB * @param string $name Nom de la database * @param int $port Port of database server */ - public function __construct($type, $host, $user, $pass, $name = '', $port = 0) + public function __construct($type, $host, $user, $pass, $name = '', $port = 0) // @phpstan-ignore constructor.unusedParameter { global $conf; diff --git a/htdocs/core/filemanagerdol/connectors/php/config.inc.php b/htdocs/core/filemanagerdol/connectors/php/config.inc.php index 0704d51f615..377646fe9a5 100644 --- a/htdocs/core/filemanagerdol/connectors/php/config.inc.php +++ b/htdocs/core/filemanagerdol/connectors/php/config.inc.php @@ -3,6 +3,7 @@ * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2010 Frederico Caldeira Knabben * Copyright (C) 2024 Frédéric France + * Copyright (C) 2026 MDW * * == BEGIN LICENSE == * @@ -33,9 +34,9 @@ define('NOTOKENRENEWAL', 1); // Disables token renewal // is a security hole if anybody can access without // being an authenticated user. require_once '../../../../main.inc.php'; - /** * @var Conf $conf + * @var User $user * * @var string $dolibarr_main_data_root * @var string $dolibarr_main_url_root @@ -49,6 +50,12 @@ if ($pos == '/') { //define('DOL_URL_ROOT', $pos); $entity = ((!empty($_SESSION['dol_entity']) && $_SESSION['dol_entity'] > 1) ? $_SESSION['dol_entity'] : null); + +if (!empty($user->admin) && !$user->hasRight('website', 'write')) { + accessforbidden('Need to be admin or having write permission on website module'); +} + + // SECURITY: You must explicitly enable this "connector". (Set it to "true"). // WARNING: don't just set "$Config['Enabled'] = true ;", you must be sure that only // authenticated users can access this file or use some kind of session checking. diff --git a/htdocs/core/filemanagerdol/connectors/php/connector.php b/htdocs/core/filemanagerdol/connectors/php/connector.php index 25d9312015f..94ea7f864cc 100644 --- a/htdocs/core/filemanagerdol/connectors/php/connector.php +++ b/htdocs/core/filemanagerdol/connectors/php/connector.php @@ -26,6 +26,9 @@ ob_start(); require 'config.inc.php'; // This include the main.inc.php +/** + * @var array $Config + */ require 'connector.lib.php'; if (!$Config['Enabled']) { diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index d2958d65ce2..24a4501038d 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -694,6 +694,12 @@ function setConstant(url, code, input, entity, strict, forcereload, userid, toke }); } }); + + // Execute js context Dolibarr Hooks + if (typeof Dolibarr != 'undefined') { + Dolibarr.executeHook('setConstant', {url : saved_url, code, input, entity, strict, forcereload, userid, token, value, userconst}); + } + if (forcereload) { var url = window.location.href; @@ -726,7 +732,7 @@ function setConstant(url, code, input, entity, strict, forcereload, userid, toke //location.reload(); return false; } - }).fail(function(error) { console.log("Error, we force reload"); location.reload(); }); /* When it fails, we always force reload to have setEventErrorMessages in session visible */ + }).fail(function(error) { console.error("Error, we force reload"); location.reload(); }); /* When it fails, we always force reload to have setEventErrorMessages in session visible */ return true; } @@ -800,6 +806,12 @@ function delConstant(url, code, input, entity, strict, forcereload, userid, toke }); } }); + + // Execute js context Dolibarr Hooks + if (typeof Dolibarr != 'undefined') { + Dolibarr.executeHook('delConstant', {url : saved_url, code, input, entity, strict, forcereload, userid, token, userconst}); + } + if (forcereload) { var url = window.location.href; if (url.indexOf('dol_resetcache') < 0) { diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 068a68404ea..6a0c7186cba 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -219,19 +219,14 @@ function run_sql($sqlfile, $silent = 1, $entity = 0, $usesavepoint = 1, $handler if (!empty($reg[2])) { if (is_numeric($reg[2])) { // This is a version $versionrequest = explode('.', $reg[2]); - //var_dump($versionrequest); - //var_dump($versionarray); if (!count($versionrequest) || !count($versionarray) || versioncompare($versionrequest, $versionarray) > 0) { $qualified = 0; } } else { // This is a test on a constant. For example when we have -- VMYSQLUTF8UNICODE, we test constant $conf->global->UTF8UNICODE $dbcollation = strtoupper(preg_replace('/_/', '', $conf->db->dolibarr_main_db_collation)); - //var_dump($reg[2]); - //var_dump($dbcollation); if (empty($conf->db->dolibarr_main_db_collation) || ($reg[2] != $dbcollation)) { $qualified = 0; } - //var_dump($qualified); } } } @@ -239,7 +234,7 @@ function run_sql($sqlfile, $silent = 1, $entity = 0, $usesavepoint = 1, $handler if ($qualified) { // Version qualified, delete SQL comments $buf = preg_replace('/^--\sV(MYSQL|PGSQL)([^\s]*)/i', '', $buf); - //print "Ligne $i qualifi?e par version: ".$buf.'
'; + //print "Line $i qualified by version: ".$buf.'
'; } } diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index c9d46540209..851bab3f36c 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -4,6 +4,7 @@ * Copyright (C) 2012 Christophe Battarel * Copyright (C) 2024-2026 MDW * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2026 Open-Dsi * * 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 @@ -37,12 +38,12 @@ * @param string $urloption More parameters on URL request * @param int $minLength Minimum number of chars to trigger that Ajax search * @param int $autoselect Automatic selection if just one value (trigger("change") on field is done if search return only 1 result) - * @param array $ajaxoptions Multiple options array - * - Ex: array('update'=>array('field1','field2'...)) will reset field1 and field2 once select done - * - Ex: array('disabled'=> ) - * - Ex: array('show'=> ) - * - Ex: array('update_textarea'=> ) - * - Ex: array('option_disabled'=> id to disable and warning to show if we select a disabled value (this is possible when using autocomplete ajax) + * @param array>> $ajaxoptions Multiple options array + * - Ex: array('update'=>array('field1','field2'...)) will reset field1 and field2 once select done + * - Ex: array('disabled'=> ) + * - Ex: array('show'=> ) + * - Ex: array('update_textarea'=> ) + * - Ex: array('option_disabled'=> id to disable and warning to show if we select a disabled value (this is possible when using autocomplete ajax) * @param string $moreparams More params provided to ajax call * @return string Script */ @@ -557,6 +558,11 @@ function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete = }, templateSelection: function (selection) { /* Format visible output of selected value */ if (selection.id == \''.(dol_escape_js($idforemptyvalue)).'\') return \'\'+selection.text+\'\'; + if (selection.element && $(selection.element).attr("data-select-html") != undefined) { + if (typeof htmlEntityDecodeJs === "function") { + return htmlEntityDecodeJs($(selection.element).attr("data-select-html")); + } + } return selection.text; }, escapeMarkup: function(markup) { diff --git a/htdocs/core/lib/categories.lib.php b/htdocs/core/lib/categories.lib.php index d312df286ea..217f949fcd0 100644 --- a/htdocs/core/lib/categories.lib.php +++ b/htdocs/core/lib/categories.lib.php @@ -1,7 +1,7 @@ * Copyright (C) 2024 MDW - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * * 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,9 +86,12 @@ function categories_prepare_head(Categorie $object, $type) */ function categoriesadmin_prepare_head() { - global $langs, $conf, $user, $db; + global $langs, $conf, $extrafields, $db; - $extrafields = new ExtraFields($db); + if (!is_object($extrafields)) { + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + $extrafields = new ExtraFields($db); + } $extrafields->fetch_name_optionals_label('categorie'); $langs->load("categories"); @@ -110,6 +113,18 @@ function categoriesadmin_prepare_head() $head[$h][2] = 'attributes_categories'; $h++; + // Multilangs Extrafields + if (getDolGlobalInt('MAIN_MULTILANGS')) { + $head[$h][0] = dolBuildUrl(DOL_URL_ROOT.'/categories/admin/categorie_lang_extrafields.php'); + $head[$h][1] = $langs->trans("CategoriesTranslationsExtrafields"); + $nbExtrafields = isset($extrafields->attributes['categorie_lang']['count']) ? $extrafields->attributes['categorie_lang']['count'] : 0; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } + $head[$h][2] = 'translationAttributes'; + $h++; + } + // Show more tabs from modules // Entries must be declared in modules descriptor with line // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 90dbff4a865..a01ba3dd70d 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -2385,7 +2385,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = null, $nopr $out .= '
'; - $out .= $form->select_dolusers(($filters['search_filtert'] > 0 ? $filters['search_filtert'] : ''), 'search_filtert', 1, null, 0, '', '', '0', 0, 0, '', 2, '', 'minwidth100 maxwidth250 widthcentpercentminusx'); + $out .= $form->select_dolusers((isset($filters['search_filtert']) && $filters['search_filtert'] > 0 ? $filters['search_filtert'] : ''), 'search_filtert', 1, null, 0, '', '', '0', 0, 0, '', 2, '', 'minwidth100 maxwidth250 widthcentpercentminusx'); $out .= ''; @@ -2555,6 +2555,9 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = null, $nopr // Example $actionstatic->code = AC_COMPANY_MODIFY and $actionstatic->type_code = AC_OTH_AUTO $out .= $actionstatic->getTypePicto(); $out .= $labelOfTypeToShow; + if (preg_match('/PRIVATE/', $actionstatic->code)) { + $out .= ' ' . img_picto($langs->trans("Private"), 'lock', 'class="valignmiddle"'); + } $out .= '
'.$langs->trans("Referers").''.$langs->trans("NbOfThirdParties").''.$langs->trans("NbOfObjectReferers").''.$langs->trans("TotalQuantity").''; + print $form->textwithpicto($langs->trans("Referers"), $langs->trans("ClinkOnALinkOfColumn", $langs->transnoentitiesnoconv("Referers"))); + print ''.$langs->trans("NbOfThirdParties").''.$langs->trans("NbOfObjectReferers").''.$langs->trans("TotalQuantity").'
'; - print ''.img_object('', 'propal', 'class="pictofixedwidth"').$langs->trans("Proposals").''; + print ''.img_object('', 'propal', 'class="pictofixedwidth"').$langs->trans("Proposals").''; print ''; print $product->stats_propale['customers']; print ''; @@ -569,7 +571,7 @@ function show_stats_for_company($product, $socid) } $langs->load("supplier_proposal"); print '
'; - print ''.img_object('', 'supplier_proposal', 'class="pictofixedwidth"').$langs->trans("SupplierProposals").''; + print ''.img_object('', 'supplier_proposal', 'class="pictofixedwidth"').$langs->trans("SupplierProposals").''; print ''; print $product->stats_proposal_supplier['suppliers']; print ''; @@ -588,7 +590,7 @@ function show_stats_for_company($product, $socid) } $langs->load("orders"); print '
'; - print ''.img_object('', 'order', 'class="pictofixedwidth"').$langs->trans("CustomersOrders").''; + print ''.img_object('', 'order', 'class="pictofixedwidth"').$langs->trans("CustomersOrders").''; print ''; print $product->stats_commande['customers']; print ''; @@ -607,7 +609,7 @@ function show_stats_for_company($product, $socid) } $langs->load("orders"); print '
'; - print ''.img_object('', 'supplier_order', 'class="pictofixedwidth"').$langs->trans("SuppliersOrders").''; + print ''.img_object('', 'supplier_order', 'class="pictofixedwidth"').$langs->trans("SuppliersOrders").''; print ''; print $product->stats_commande_fournisseur['suppliers']; print ''; @@ -626,7 +628,7 @@ function show_stats_for_company($product, $socid) } $langs->load("bills"); print '
'; - print ''.img_object('', 'bill', 'class="pictofixedwidth"').$langs->trans("CustomersInvoices").''; + print ''.img_object('', 'bill', 'class="pictofixedwidth"').$langs->trans("CustomersInvoices").''; print ''; print $product->stats_facture['customers']; print ''; @@ -645,7 +647,7 @@ function show_stats_for_company($product, $socid) } $langs->load("bills"); print '
'; - print ''.img_object('', 'bill', 'class="pictofixedwidth"').$langs->trans("RecurringInvoiceTemplate").''; + print ''.img_object('', 'bill', 'class="pictofixedwidth"').$langs->trans("RecurringInvoiceTemplate").''; print ''; print $product->stats_facturerec['customers']; print ''; @@ -664,7 +666,7 @@ function show_stats_for_company($product, $socid) } $langs->load("bills"); print '
'; - print ''.img_object('', 'supplier_invoice', 'class="pictofixedwidth"').$langs->trans("SuppliersInvoices").''; + print ''.img_object('', 'supplier_invoice', 'class="pictofixedwidth"').$langs->trans("SuppliersInvoices").''; print ''; print $product->stats_facture_fournisseur['suppliers']; print ''; @@ -684,7 +686,7 @@ function show_stats_for_company($product, $socid) } $langs->load("bills"); print '
'; - print ''.img_object('', 'bill', 'class="pictofixedwidth"').$langs->trans("RecurringInvoiceTemplate").''; + print ''.img_object('', 'bill', 'class="pictofixedwidth"').$langs->trans("RecurringInvoiceTemplate").''; print ''; print $product->stats_facturefournrec['customers']; print ''; @@ -705,7 +707,7 @@ function show_stats_for_company($product, $socid) } $langs->load("sendings"); print '
'; - print ''.img_object('', 'shipment', 'class="pictofixedwidth"').$langs->trans("Shipments").''; + print ''.img_object('', 'shipment', 'class="pictofixedwidth"').$langs->trans("Shipments").''; print ''; print $product->stats_expedition['customers']; print ''; @@ -725,7 +727,7 @@ function show_stats_for_company($product, $socid) } $langs->load("receptions"); print '
'; - print ''.img_object('', 'reception', 'class="pictofixedwidth"').$langs->trans("Receptions").''; + print ''.img_object('', 'reception', 'class="pictofixedwidth"').$langs->trans("Receptions").''; print ''; print $product->stats_reception['suppliers']; print ''; @@ -745,7 +747,7 @@ function show_stats_for_company($product, $socid) } $langs->load("contracts"); print '
'; - print ''.img_object('', 'contract', 'class="pictofixedwidth"').$langs->trans("Contracts").''; + print ''.img_object('', 'contract', 'class="pictofixedwidth"').$langs->trans("Contracts").''; print ''; print $product->stats_contrat['customers']; print ''; @@ -766,7 +768,7 @@ function show_stats_for_company($product, $socid) $langs->load("mrp"); print '
'; - print ''.img_object('', 'bom', 'class="pictofixedwidth"').$langs->trans("BOM").''; + print ''.img_object('', 'bom', 'class="pictofixedwidth"').$langs->trans("BOM").''; print ''; print ''; @@ -790,7 +792,7 @@ function show_stats_for_company($product, $socid) } $langs->load("mrp"); print '
'; - print ''.img_object('', 'mrp', 'class="pictofixedwidth"').$langs->trans("MO").''; + print ''.img_object('', 'mrp', 'class="pictofixedwidth"').$langs->trans("MO").''; print ''; print $form->textwithpicto((string) $product->stats_mo['customers_toconsume'], $langs->trans("ToConsume")); print ' '; diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index e7187ccbd55..716fa432071 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -2566,7 +2566,7 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, & if ($lines[$i]->id > 0) { //var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level); //var_dump($totalforeachday); - $ret = projectLinesPerMonth($inc, $firstdaytoshow, $fuser, $lines[$i]->id, ($parent == 0 ? $lineswithoutlevel0 : $lines), $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $isavailable, $oldprojectforbreak, $TWeek); + $ret = projectLinesPerMonth($inc, $firstdaytoshow, $fuser, $lines[$i]->id, ($parent == 0 ? $lineswithoutlevel0 : $lines), $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $isavailable, $oldprojectforbreak, $TWeek, $arrayfields); //var_dump('ret with parent='.$lines[$i]->id.' level='.$level); //var_dump($ret); foreach ($ret as $key => $val) { diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index 792df603da0..fa3bb9c431e 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -830,6 +830,34 @@ function showWebsiteTemplates(Website $website, int $refresh) $colspan = 2; + $importButtonIsDisabled = 0; + + global $dolibarr_website_allow_custom_php; + if (!empty($dolibarr_website_allow_custom_php) && $dolibarr_website_allow_custom_php == 1) { + $notdisabledsystemfunction = ''; + $systemfunctions = array("exec", "passthru", "shell_exec", "system", "popen", "proc_open"); + foreach ($systemfunctions as $systemfunction) { + // @phpstan-ignore-next-line + if (function_exists($systemfunction)) { + $notdisabledsystemfunction .= ($notdisabledsystemfunction ? ', ' : '').$systemfunction; + } + } + if ($notdisabledsystemfunction) { + print '
'; + print $langs->trans("ImportOfWebsiteTemplateIncludingPHPIsAllowedIf", 'warning'); + print '
'; + + $importButtonIsDisabled = 1; + } + } + if (empty($dolibarr_website_allow_custom_php)) { + print '
'; + print $langs->trans("ImportOfWebsiteTemplateIncludingPHPIsDisabled", 'warning'); + print '
'; + + $importButtonIsDisabled = 1; + } + print ''."\n"; print ''; @@ -911,7 +939,7 @@ function showWebsiteTemplates(Website $website, int $refresh) if ($user->hasRight('website', 'delete')) { print ' ref).'&templateuserfile='.urlencode($subdir).'">'.img_picto('', 'delete').''; } - print '
ref).'&templateuserfile='.urlencode($subdir).'" class="button">'.$langs->trans("Load").''; + print '
ref).'&templateuserfile='.urlencode($subdir).'" class="button'.($importButtonIsDisabled ? ' disabled' : '').'">'.$langs->trans("Load").''; print ''; $i++; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 13fe1f80e5c..8c12564b2e9 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -2588,7 +2588,7 @@ function get_left_menu_tools($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu $titleindex .= ' | '.$langs->trans("SMSings"); $titlenew .= ' | '.$langs->trans("NewSMSing"); } - $newmenu->add(dolBuildUrl('/comm/mailing/index.php', ['leftmenu' => 'mailing']), $titleindex, 0, $user->hasRight('mailing', 'lire'), '', $mainmenu, 'mailing', 15, '', '', '', img_picto('', 'email', 'class="paddingright pictofixedwidth"')); + $newmenu->add(dolBuildUrl('/comm/mailing/index.php', ['leftmenu' => 'mailing']), $titleindex, 0, $user->hasRight('mailing', 'lire'), '', $mainmenu, 'mailing', 15, '', '', '', img_picto('', 'mail-bulk', 'class="paddingright pictofixedwidth"')); $newmenu->add(dolBuildUrl('/comm/mailing/card.php', ['leftmenu' => 'mailing', 'action' => 'create']), $titlenew, 1, $user->hasRight('mailing', 'creer')); $newmenu->add(dolBuildUrl('/comm/mailing/list.php', ['leftmenu' => 'mailing']), $titlelist, 1, $user->hasRight('mailing', 'lire')); } diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index c6ccbd9174b..e9d4dd1b965 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -5,7 +5,7 @@ * Copyright (C) 2014-2015 Marcos García * Copyright (C) 2018-2025 Frédéric France * Copyright (C) 2023 Charlene Benke - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2026 MDW * Copyright (C) 2024 Nick Fragoulis * Copyright (C) 2024 Alexandre Spangaro * @@ -960,7 +960,7 @@ class pdf_espadon extends ModelePdfExpedition } if ($this->getColumnStatus('qty_shipped') && $totalToShip) { - $this->printStdColumnContent($pdf, $tab2_top, 'qty_shipped', $totalToShip); + $this->printStdColumnContent($pdf, $tab2_top, 'qty_shipped', (string) $totalToShip); } if ($this->getColumnStatus('totalexcltax')) { diff --git a/htdocs/core/modules/facture/doc/pdf_octopus.modules.php b/htdocs/core/modules/facture/doc/pdf_octopus.modules.php index 7143f14a1cf..fdf6b81f993 100644 --- a/htdocs/core/modules/facture/doc/pdf_octopus.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_octopus.modules.php @@ -12,7 +12,7 @@ * Copyright (C) 2022 Anthony Berton * Copyright (C) 2022-2025 Alexandre Spangaro * Copyright (C) 2022-2024 Eric Seigne - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2026 MDW * Copyright (C) 2024-2025 Nick Fragoulis * Copyright (C) 2026 Vincent Maury * @@ -1769,9 +1769,11 @@ class pdf_octopus extends ModelePDFFactures $this->atleastoneratenotnull = 0; if (!getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT')) { $tvaisnull = false; - if (!empty($this->tva_array) && count($this->tva_array) == 1 ) { + if (!empty($this->tva_array) && count($this->tva_array) == 1) { $tva_el = reset($this->tva_array); - if ($tva_el['vatrate'] == '0.000' && is_float($tva_el['amount'])) $tvaisnull = true; + if ($tva_el['vatrate'] == '0.000' && is_float($tva_el['amount'])) { + $tvaisnull = true; + } } if (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_IFNULL') && $tvaisnull) { // Nothing to do @@ -2818,13 +2820,17 @@ class pdf_octopus extends ModelePDFFactures $salereparray = $object->thirdparty->getSalesRepresentatives($user); $salerepobj = new User($this->db); $salerepobj->fetch($salereparray[0]['id']); - if (!empty($salerepobj->signature)) $notetoshow = dol_concatdesc($notetoshow, $salerepobj->signature); + if (!empty($salerepobj->signature)) { + $notetoshow = dol_concatdesc($notetoshow, $salerepobj->signature); + } } } // Extrafields in note $extranote = $this->getExtrafieldsInHtml($object, $outputlangs); - if (!empty($extranote)) $notetoshow = dol_concatdesc((string) $notetoshow, $extranote); + if (!empty($extranote)) { + $notetoshow = dol_concatdesc((string) $notetoshow, $extranote); + } if ($notetoshow) { $tab_top -= 2; @@ -3149,10 +3155,10 @@ class pdf_octopus extends ModelePDFFactures /** * Calculates the sum of two arrays, key by key, taking into account nested arrays * - * @param array $a [$a description] - * @param array $b [$b description] + * @param array> $a [$a description] + * @param array> $b [$b description] * - * @return array [return description] + * @return array> [return description] */ public function sumSituation($a, $b) { diff --git a/htdocs/core/modules/modQuickMemo.class.php b/htdocs/core/modules/modQuickMemo.class.php index 6aebd38cd54..54996a88b71 100644 --- a/htdocs/core/modules/modQuickMemo.class.php +++ b/htdocs/core/modules/modQuickMemo.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2018-2019 Nicolas ZABOURI * Copyright (C) 2019-2024 Frédéric France * Copyright (C) 2026 John BOTELLA + * Copyright (C) 2026 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 @@ -98,7 +99,7 @@ class modQuickMemo extends DolibarrModules } $compatibleHooks = array_unique($compatibleHooks); // Security check - $compatibleHooks = array_filter($compatibleHooks, function (string $k) { + $compatibleHooks = array_filter($compatibleHooks, /** @return int|false */ static function (string $k) { return preg_match('/^[a-zA-Z0-9_]+$/', $k); }); diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 4b88f97a56e..2997ad591de 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -1019,6 +1019,7 @@ if (!empty($object->thirdparty)) { if (isNaN(pbq)) { console.log("We use experimental option PRODUIT_CUSTOMER_PRICES_BY_QTY or PRODUIT_CUSTOMER_PRICES_BY_QTY but we could not get the id of pbq from product combo list, so load of price may be 0 if product has different prices"); } } + let idProdFournPrice = $(this).val(); // Get the price for the product and display it console.log("Load unit price and set it into #price_ht or #price_ttc for product id="+$(this).val()+" socid=" + jsConf.docObject.socid); $.post(jsConf.url.fetchProductUrl, @@ -1145,6 +1146,11 @@ if (!empty($object->thirdparty)) { jQuery('div[class*="det'+key.replace('options_','_extras_')+'"] > #'+key).val(value); }); } + + // Execute js context Dolibarr Hooks + if (typeof Dolibarr != 'undefined') { + Dolibarr.executeHook('objectLineCreate:LoadUnitPrice', {idProdFournPrice, 'socid': jsConf.docObject.socid,ajaxResultData : data, jsConf}); + } }, 'json' ); @@ -1157,10 +1163,11 @@ if (!empty($object->thirdparty)) { $("#fournprice_predef").find("option").remove(); $("#fournprice_predef").hide(); $("#buying_price").val("").show(); + let idProd = $(this).val(); /* Call post to load content of combo list fournprice_predef */ var token = jsConf.conf.token; // For AJAX Call we use old 'token' and not 'newtoken' - $.post(jsConf.url.getSupplierPrices, { 'idprod': $(this).val(), 'token': token }, function(data) { + $.post(jsConf.url.getSupplierPrices, { 'idprod': idProd, 'token': token }, function(data) { if (data && data.length > 0) { var options = ''; var defaultkey = ''; var defaultprice = ''; var bestpricefound = 0; @@ -1248,6 +1255,12 @@ if (!empty($object->thirdparty)) { $('#buying_price').hide(); } }); + + + // Execute js context Dolibarr Hooks + if (typeof Dolibarr != 'undefined') { + Dolibarr.executeHook('objectLineCreate:GetSupplierPrices', {'idprod': idProd, ajaxResultData : data, jsConf}); + } } }, 'json'); @@ -1283,6 +1296,11 @@ if (!empty($object->thirdparty)) { jQuery("#remise_percent").val(pbqpercent); } } else { jQuery("#pbq").val(''); } + + // Execute js context Dolibarr Hooks + if (typeof Dolibarr != 'undefined') { + Dolibarr.executeHook('objectLineCreate:CustomerPriceByQty', { pbq, pbqup, pbqbase, pbqqty, pbqpercent }); + } } // Deal with supplier ref price (idprodfournprice = int) @@ -1397,7 +1415,6 @@ if (!empty($object->thirdparty)) { jQuery('#dp_desc').text(description); } } - } else if (jQuery('#idprodfournprice').length > 0) { console.log("objectline_create.tpl #idprodfournprice is not an int but is a string so we set only few properties into page"); @@ -1465,6 +1482,10 @@ if (!empty($object->thirdparty)) { setforpredef(); } + // Execute js context Dolibarr Hooks + if (typeof Dolibarr != 'undefined') { + Dolibarr.executeHook('objectLineCreate:ProductSelectionChange'); + } }); /* Function to set fields visibility after selecting a free product */ diff --git a/htdocs/core/website.inc.php b/htdocs/core/website.inc.php index f07295aea4f..f84dbce31b8 100644 --- a/htdocs/core/website.inc.php +++ b/htdocs/core/website.inc.php @@ -307,36 +307,40 @@ $sessionname = 'DOLSESSID_'.$prefix; // Add a protection if custom PHP is not allowed or allowed with conditions global $dolibarr_website_allow_custom_php; -if (!empty($dolibarr_website_allow_custom_php) && $dolibarr_website_allow_custom_php == 1) { - $systemfunctions = array("exec", "passthru", "shell_exec", "system", "popen", "proc_open"); - foreach ($systemfunctions as $systemfunction) { - //print ini_get('disable_functions').'
'; - //print exec("ls"); - - // @phpstan-ignore-next-line - if (function_exists($systemfunction)) { - print '


'; - print 'Website features are protected to be disabled if the PHP system functions ('.implode(',', $systemfunctions).') are not disabled for the website context.
'; - print 'The value "'.$systemfunction.'" has NOT been found into the current disable_functions=
'; - print ''; - print '

'; - print 'You can fix this by changing setup of your PHP ini (changing this in a virtual host with php_admin_value is not effective):
'; - print 'disable_functions="exec,passthru,shell_exec,system,popen,proc_open,..."
'; - print 'but WARNING, this may also break features for:
'; - print '- cron tasks calling command line tools.
'; - print '- and for the backup feature running the database dump tool.
'; - print '- and for the command line antivirus check ran when uploading a file.
'; - print '
'; - print 'If you don\'t use this 3 feature, change your php.ini, if you need at least one, you can bypass this protection by setting $dolibarr_website_allow_custom_php to 2 in your dolibarr config file.'; - print '
'; - exit; // Stop here to PHP later won't be executed - } +$notdisabledsystemfunction = ''; +$systemfunctions = array("exec", "passthru", "shell_exec", "system", "popen", "proc_open"); +foreach ($systemfunctions as $systemfunction) { + // @phpstan-ignore-next-line + if (function_exists($systemfunction)) { + $notdisabledsystemfunction .= ($notdisabledsystemfunction ? ', ' : '').$systemfunction; } } +if (empty($dolibarr_website_allow_custom_php) || ($dolibarr_website_allow_custom_php == 1 && $notdisabledsystemfunction)) { + print '


'; + print 'Website features are DISABLED if the PHP system functions ('.implode(',', $systemfunctions).') are NOT disabled for the website context.
'; + print 'The value "'.$notdisabledsystemfunction.'" has NOT been found into the php parameter current disable_functions '; + //print ''; + + print '

'; + print 'You can fix this by changing setup of your PHP ini (changing this in a virtual host with php_admin_value is not effective):
'; + print 'disable_functions="exec,passthru,shell_exec,system,popen,proc_open,..."
'; + print 'but WARNING, this will break this 3 features for:
'; + print '- 1) Cron tasks calling command line tools.
'; + print '- 2) Internal backup feature running the database dump tool.
'; + print '- 3) Command line antivirus check ran when uploading a file.
'; + print '
'; + print 'If you don\'t use this 3 feature, you can change your php.ini to exclude the exec functions.
If you need at least one, you can bypass this protection by setting $dolibarr_website_allow_custom_php to 2 in your dolibarr config file (Add RCE protection like AppArmor or SELinux in this case).'; + print '
'; + exit; // Stop here to PHP later won't be executed +} + $_COOKIE[$sessionname] = 'obfuscatedcookie'; unset($conf->file->instance_unique_id); diff --git a/htdocs/dav/dav.class.php b/htdocs/dav/dav.class.php index f40d7823577..1d528c9772b 100644 --- a/htdocs/dav/dav.class.php +++ b/htdocs/dav/dav.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2024 Frédéric France - * Copyright (C) 2025 MDW + * Copyright (C) 2025-2026 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 @@ -246,8 +246,8 @@ class CdavLib * getFullCalendarObjects * * @param int $calendarId Calendar id - * @param int $bCalendarData Add calendar data - * @return array|string[][] + * @param int<0,1> $bCalendarData Add calendar data if not 0 + * @return array> */ public function getFullCalendarObjects($calendarId, $bCalendarData) { diff --git a/htdocs/debugbar/class/autoloader.php b/htdocs/debugbar/class/autoloader.php index df0c22e9e11..af0628b1511 100644 --- a/htdocs/debugbar/class/autoloader.php +++ b/htdocs/debugbar/class/autoloader.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2024-2026 MDW */ /** * Simple autoloader, so we don't need Composer just for this. @@ -13,6 +13,7 @@ spl_autoload_register( * @return bool If class could be loaded */ static function ($class) { + // @phpstan-ignore argument.type if (preg_match('/^DebugBar/', $class)) { $file = DOL_DOCUMENT_ROOT.'/includes/maximebf/debugbar/src/'.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php'; //var_dump($class.' - '.file_exists($file).' - '.$file); diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 48bea0dda78..e3b9bcf2b53 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -126,12 +126,12 @@ $extrafields->fetch_name_optionals_label($objectorder->table_element_line); // Load object. Make an object->fetch include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be 'include', not 'include_once' -if (empty($origin) && !empty($object->origin_type)) { +if (empty($origin) && !empty($object->origin_type) && $object->origin_id > 0) { $origin = $object->origin_type; -} elseif (empty($origin) && !empty($object->origin)) { - $origin = (string) $object->origin; // Cast to string because origin is type hinted as object too. +} elseif (empty($origin) && is_string($object->origin) && $object->origin !== '' && $object->origin_id > 0) { + $origin = $object->origin; } -if (empty($origin_id) && !empty($object->origin_id)) { +if (empty($origin_id) && $object->origin_id > 0) { $origin_id = $object->origin_id; } $origin_type = is_string($origin) ? $origin : ''; diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 302ba48a32f..286211624cf 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -14,7 +14,7 @@ * Copyright (C) 2021 Josep Lluís Amador * Copyright (C) 2022 Gauthier VERDOL * Copyright (C) 2024 Solution Libre SAS - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2026 MDW * Copyright (C) 2024 William Mead * Copyright (C) 2025 Noé Cendrier * @@ -1721,7 +1721,7 @@ class CommandeFournisseur extends CommonOrder $line->rang, // rang $line->special_code, isset($line->label) ? $line->label : '' - ); + ); if ($result < 0) { dol_syslog(get_class($this)."::create ".$this->error, LOG_WARNING); // do not use dol_print_error here as it may be a functional error $this->db->rollback(); @@ -2188,7 +2188,7 @@ class CommandeFournisseur extends CommonOrder // VERY IMPORTANT: It's at the time of line insertion that we must store the net, VAT, and gross amounts, // and this is done at the line level, which has its own VAT rate - $tabprice = calcul_price_total((float) $qty, $pu, $remise_percent, $txtva, (float) $txlocaltax1, (float) $txlocaltax2, 0, $price_base_type, $info_bits, $product_type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx, (float) $pu_ht_devise); + $tabprice = calcul_price_total((float) $qty, $pu, (float) $remise_percent, $txtva, (float) $txlocaltax1, (float) $txlocaltax2, 0, $price_base_type, $info_bits, $product_type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx, (float) $pu_ht_devise); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 686b3ef6a67..aa5c6a089c0 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -15,7 +15,7 @@ * Copyright (C) 2018-2026 Frédéric France * Copyright (C) 2022 Gauthier VERDOL * Copyright (C) 2023 Nick Fragoulis - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2026 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 @@ -2243,7 +2243,7 @@ class FactureFournisseur extends CommonInvoice // VERY IMPORTANT: It's at the time of line insertion that we must store the net, VAT, and gross amounts, // and this is done at the line level, which has its own VAT rate - $tabprice = calcul_price_total((float) $qty, $pu, $remise_percent, $txtva, (float) $txlocaltax1, (float) $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx, $pu_devise); + $tabprice = calcul_price_total((float) $qty, $pu, (float) $remise_percent, $txtva, (float) $txlocaltax1, (float) $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx, $pu_devise); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; @@ -3267,7 +3267,7 @@ class FactureFournisseur extends CommonInvoice if (!$error) { // Hook of thirdparty module if (is_object($hookmanager)) { - $parameters = array('objFrom'=>$objFrom); + $parameters = array('objFrom' => $objFrom); $action = ''; $reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 019cf63ccb2..0613acd5de6 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -816,12 +816,12 @@ if (empty($reshook)) { //exit; // Replacement invoice - if (GETPOSTINT('type') === '') { + if (GETPOST('type') === '') { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors'); $error++; } - if (GETPOST('type') == FactureFournisseur::TYPE_REPLACEMENT) { + if (GETPOSTINT('type') == FactureFournisseur::TYPE_REPLACEMENT) { if (empty($dateinvoice)) { setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('DateInvoice')), null, 'errors'); $action = 'create'; @@ -876,7 +876,7 @@ if (empty($reshook)) { } // Credit note invoice - if (GETPOST('type') == FactureFournisseur::TYPE_CREDIT_NOTE) { + if (GETPOSTINT('type') == FactureFournisseur::TYPE_CREDIT_NOTE) { $sourceinvoice = GETPOSTINT('fac_avoir'); if (!($sourceinvoice > 0) && !getDolGlobalString('INVOICE_CREDIT_NOTE_STANDALONE')) { $error++; @@ -999,7 +999,7 @@ if (empty($reshook)) { } } } - } elseif ($fac_recid > 0 && (GETPOST('type') == FactureFournisseur::TYPE_STANDARD || GETPOST('type') == FactureFournisseur::TYPE_DEPOSIT)) { + } elseif ($fac_recid > 0 && (GETPOSTINT('type') == FactureFournisseur::TYPE_STANDARD || GETPOSTINT('type') == FactureFournisseur::TYPE_DEPOSIT)) { // Standard invoice or Deposit invoice, created from a Predefined template invoice if (empty($dateinvoice)) { $error++; @@ -1019,7 +1019,7 @@ if (empty($reshook)) { if (!$error) { $object->socid = GETPOSTINT('socid'); - $object->type = GETPOST('type', 'alphanohtml'); + $object->type = GETPOSTINT('type'); $object->subtype = GETPOSTINT('subtype'); $object->ref = GETPOST('ref', 'alphanohtml'); $object->date = $dateinvoice; @@ -1046,7 +1046,7 @@ if (empty($reshook)) { $id = $object->create($user); // This include recopy of links from recurring invoice and recurring invoice lines } - } elseif ($fac_recid <= 0 && (GETPOST('type') == FactureFournisseur::TYPE_STANDARD || GETPOST('type') == FactureFournisseur::TYPE_DEPOSIT)) { + } elseif ($fac_recid <= 0 && (GETPOSTINT('type') == FactureFournisseur::TYPE_STANDARD || GETPOSTINT('type') == FactureFournisseur::TYPE_DEPOSIT)) { // Standard invoice or Deposit invoice, not from a Predefined template invoice if (GETPOSTINT('socid') < 1) { setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('Supplier')), null, 'errors'); @@ -1083,7 +1083,7 @@ if (empty($reshook)) { // Creation invoice $object->socid = GETPOSTINT('socid'); - $object->type = GETPOST('type', 'alphanohtml'); + $object->type = GETPOSTINT('type'); $object->subtype = GETPOSTINT('subtype'); $object->ref = GETPOST('ref', 'alphanohtml'); $object->ref_supplier = GETPOST('ref_supplier', 'alphanohtml'); @@ -1184,7 +1184,7 @@ if (empty($reshook)) { // If deposit invoice - down payment with 1 line (fixed amount or percent) $typeamount = GETPOST('typedeposit', 'alpha'); - if (GETPOST('type') == FactureFournisseur::TYPE_DEPOSIT && in_array($typeamount, array('amount', 'variable'))) { + if (GETPOSTINT('type') == FactureFournisseur::TYPE_DEPOSIT && in_array($typeamount, array('amount', 'variable'))) { $valuedeposit = price2num(GETPOST('valuedeposit', 'alpha'), 'MU'); // Define the array $amountdeposit @@ -1499,7 +1499,7 @@ if (empty($reshook)) { $type = $prod->type; } else { $label = GETPOST('product_desc', 'restricthtml'); - $type = GETPOST("type") ? GETPOST("type") : 0; + $type = GETPOSTINT("type"); } $date_start = dol_mktime(GETPOSTINT('date_starthour'), GETPOSTINT('date_startmin'), GETPOSTINT('date_startsec'), GETPOSTINT('date_startmonth'), GETPOSTINT('date_startday'), GETPOSTINT('date_startyear')); @@ -1667,7 +1667,7 @@ if (empty($reshook)) { setEventMessages($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPrice'), $langs->transnoentitiesnoconv('Qty')), null, 'errors'); $error++; } - if ($prod_entry_mode == 'free' && (!GETPOST('idprodfournprice') || GETPOST('idprodfournprice') == '-1') && GETPOST('type') < 0) { + if ($prod_entry_mode == 'free' && (!GETPOST('idprodfournprice') || GETPOST('idprodfournprice') == '-1') && GETPOSTINT('type') < 0) { setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors'); $error++; } @@ -2610,7 +2610,7 @@ if ($action == 'create') { print ''; print '
'; - $tmp=' @@ -2681,7 +2681,7 @@ if ($action == 'create') { } print '
'; - $tmp = ' * Copyright (C) 2017 Josep Lluís Amador * Copyright (C) 2018-2022 Charlene Benke - * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2018-2026 Frédéric France * Copyright (C) 2019-2026 Alexandre Spangaro * Copyright (C) 2023 Nick Fragoulis * Copyright (C) 2023 Joachim Kueter @@ -39,6 +39,16 @@ // Load Dolibarr environment require '../../main.inc.php'; +/** + * @var Conf $conf + * @var DoliDB $db + * @var ExtraFields $extrafields + * @var HookManager $hookmanager + * @var Societe $mysoc + * @var Translate $langs + * @var User $user + */ + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; @@ -50,15 +60,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; -/** - * @var Conf $conf - * @var DoliDB $db - * @var HookManager $hookmanager - * @var Societe $mysoc - * @var Translate $langs - * @var User $user - */ - // Load translation files required by the page $langs->loadLangs(array('products', 'bills', 'companies', 'projects', 'banks')); @@ -177,7 +178,6 @@ $now = dol_now(); // Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context $object = new FactureFournisseur($db); $hookmanager->initHooks(array('supplierinvoicelist')); -$extrafields = new ExtraFields($db); $diroutputmassaction = getMultidirTemp($object).'/massgeneration/'.$user->id; diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php index 5a89a74b49b..7e8a0307294 100644 --- a/htdocs/holiday/define_holiday.php +++ b/htdocs/holiday/define_holiday.php @@ -5,7 +5,7 @@ * Copyright (C) 2016 Regis Houssin * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2024 Alexandre Spangaro - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2026 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 @@ -156,13 +156,13 @@ if (empty($reshook)) { $typeleaves = $holiday->getTypes(1, 1); - $userID = array_keys(GETPOST('update_cp')); - $userID = $userID[0]; + $userID = array_keys(GETPOST('update_cp', 'array:int')); + $userID = (int) $userID[0]; $db->begin(); foreach ($typeleaves as $key => $val) { - $userValue = GETPOST('nb_holiday_'.$val['rowid']); + $userValue = GETPOST('nb_holiday_'.$val['rowid'], 'array'); $userValue = $userValue[$userID]; if (!empty($userValue) || (string) $userValue == '0') { diff --git a/htdocs/hrm/class/position.class.php b/htdocs/hrm/class/position.class.php index 6d55b21309a..a07389708e3 100644 --- a/htdocs/hrm/class/position.class.php +++ b/htdocs/hrm/class/position.class.php @@ -398,7 +398,7 @@ class Position extends CommonObject * @param string $filter Filter as an Universal Search string. * Example: '((client:=:1) OR ((client:>=:2) AND (client:<=:3))) AND (client:!=:8) AND (nom:like:'a%')' * @param string $filtermode No more used - * @return array|int int <0 if KO, array of pages if OK + * @return self[]|int int <0 if KO, array of pages if OK */ public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = '', $filtermode = 'AND') { @@ -985,7 +985,7 @@ class Position extends CommonObject /** * Create an array of lines * - * @return array|int array of lines if OK, <0 if KO + * @return CommonObject[]|int array of lines if OK, <0 if KO */ public function getLinesArray() { @@ -1063,7 +1063,7 @@ class Position extends CommonObject * getForUser * * @param int $userid id of user we need to get position list - * @return array|int of positions of user with for each of them the job fetched into that array + * @return self[]|int of positions of user with for each of them the job fetched into that array */ public function getForUser($userid) { diff --git a/htdocs/hrm/class/skill.class.php b/htdocs/hrm/class/skill.class.php index 5e7ed1d884f..aca7ccc0139 100644 --- a/htdocs/hrm/class/skill.class.php +++ b/htdocs/hrm/class/skill.class.php @@ -432,7 +432,7 @@ class Skill extends CommonObject /** * Load object lines in memory from the database * - * @return array|int Return integer <0 if KO, array of skill level found + * @return CommonObject[]|int Return integer <0 if KO, array of skill level found */ public function fetchLines() { @@ -991,7 +991,7 @@ class Skill extends CommonObject /** * Create an array of lines * - * @return array|int array of lines if OK, <0 if KO + * @return Skilldet[]|int array of lines if OK, <0 if KO */ public function getLinesArray() { diff --git a/htdocs/hrm/job_list.php b/htdocs/hrm/job_list.php index a04e8bfb625..1d7b30598ce 100644 --- a/htdocs/hrm/job_list.php +++ b/htdocs/hrm/job_list.php @@ -5,7 +5,7 @@ * Copyright (C) 2021 Jean-Pascal BOUDET * Copyright (C) 2021 Grégory BLEMAND * Copyright (C) 2024 Frédéric France - * Copyright (C) 2025 MDW + * Copyright (C) 2025-2026 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 @@ -266,9 +266,6 @@ foreach ($search as $key => $val) { continue; } $field_spec = $object->fields[$key]; - if ($field_spec === null) { - continue; - } $mode_search = (($object->isInt($field_spec) || $object->isFloat($field_spec)) ? 1 : 0); if ((strpos($field_spec['type'], 'integer:') === 0) || (strpos($field_spec['type'], 'sellist:') === 0) || !empty($field_spec['arrayofkeyval'])) { if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($field_spec['arrayofkeyval']) || !array_key_exists('0', $field_spec['arrayofkeyval'])))) { diff --git a/htdocs/hrm/position_agenda.php b/htdocs/hrm/position_agenda.php index 01f0827229c..d07da7883c7 100644 --- a/htdocs/hrm/position_agenda.php +++ b/htdocs/hrm/position_agenda.php @@ -5,6 +5,7 @@ * Copyright (C) 2021 Jean-Pascal BOUDET * Copyright (C) 2021 Grégory BLEMAND * Copyright (C) 2024 Frédéric France + * Copyright (C) 2026 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 @@ -239,7 +240,7 @@ if ($object->id > 0) { $filters['search_agenda_label'] = $search_agenda_label; $filters['search_rowid'] = $search_rowid; - $object->fields['label'] = array(); // Useful to get only agenda events linked to position (this object doesn't need label of ref field, but show_actions_done() needs it to work correctly) + $object->fields['label'] = array('type' => 'varchar(128)', 'label' => 'Label', 'enabled' => 0, 'position' => 30, 'visible' => -1); // Useful to get only agenda events linked to position (this object doesn't need label of ref field, but show_actions_done() needs it to work correctly) - dummy but "valid" fields entry // TODO Replace this with same code than into list.php show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder, $object->module); diff --git a/htdocs/includes/tcpdi/fpdf_tpl.php b/htdocs/includes/tcpdi/fpdf_tpl.php index c6bde6748b1..f5204325989 100644 --- a/htdocs/includes/tcpdi/fpdf_tpl.php +++ b/htdocs/includes/tcpdi/fpdf_tpl.php @@ -17,7 +17,7 @@ // limitations under the License. // -class FPDF_TPL extends FPDF { +class FPDF_TPL extends TCPDF { /** * Array of Tpl-Data * @var array diff --git a/htdocs/includes/tcpdi/tcpdi.php b/htdocs/includes/tcpdi/tcpdi.php index 89db66b50c2..237dba3b222 100644 --- a/htdocs/includes/tcpdi/tcpdi.php +++ b/htdocs/includes/tcpdi/tcpdi.php @@ -19,7 +19,7 @@ // // Dummy shim to allow unmodified use of fpdf_tpl -class FPDF extends TCPDF {} +//class FPDF extends TCPDF {} require_once('fpdf_tpl.php'); diff --git a/htdocs/install/mysql/data/llx_00_c_country.sql b/htdocs/install/mysql/data/llx_00_c_country.sql index 4a0e4035eb6..5d3c28c55ca 100644 --- a/htdocs/install/mysql/data/llx_00_c_country.sql +++ b/htdocs/install/mysql/data/llx_00_c_country.sql @@ -8,6 +8,7 @@ -- Copyright (C) 2014 Alexandre Spangaro -- Copyright (C) 2021-2022 Udo Tamm -- Copyright (C) 2025 Nick Fragoulis +-- Copyright (C) 2026 Open-Dsi -- -- 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 @@ -544,3 +545,381 @@ UPDATE llx_c_country SET eec = 1 WHERE code IN ('AT','BE','BG','CY','CZ','DE','D -- Source: https://www.europeanpaymentscouncil.eu/document-library/other/epc-list-sepa-scheme-countries -- Set field sepa UPDATE llx_c_country SET sepa = 1 WHERE code IN ('AD','AL','AT','AX','BE','BG','BL','CH','CY','CZ','DE','DK','EE','ES','FI','FR','GB','GF','GG','GI','GP','GR','HR','HU','IE','IM','IS','IT','JE','LI','LT','LU','LV','MC','MD','ME','MF','MK','MQ','MT','NL','NO','PL','PM','PT','RE','RO','RS','SE','SI','SK','SM','VA','YT'); + +-- Set field phone_code (ITU-T country calling codes) +UPDATE llx_c_country SET phone_code = 33 WHERE code = 'FR'; +UPDATE llx_c_country SET phone_code = 32 WHERE code = 'BE'; +UPDATE llx_c_country SET phone_code = 39 WHERE code = 'IT'; +UPDATE llx_c_country SET phone_code = 34 WHERE code = 'ES'; +UPDATE llx_c_country SET phone_code = 49 WHERE code = 'DE'; +UPDATE llx_c_country SET phone_code = 41 WHERE code = 'CH'; +UPDATE llx_c_country SET phone_code = 44 WHERE code = 'GB'; +UPDATE llx_c_country SET phone_code = 353 WHERE code = 'IE'; +UPDATE llx_c_country SET phone_code = 86 WHERE code = 'CN'; +UPDATE llx_c_country SET phone_code = 216 WHERE code = 'TN'; +UPDATE llx_c_country SET phone_code = 1 WHERE code = 'US'; +UPDATE llx_c_country SET phone_code = 212 WHERE code = 'MA'; +UPDATE llx_c_country SET phone_code = 213 WHERE code = 'DZ'; +UPDATE llx_c_country SET phone_code = 1 WHERE code = 'CA'; +UPDATE llx_c_country SET phone_code = 228 WHERE code = 'TG'; +UPDATE llx_c_country SET phone_code = 241 WHERE code = 'GA'; +UPDATE llx_c_country SET phone_code = 31 WHERE code = 'NL'; +UPDATE llx_c_country SET phone_code = 36 WHERE code = 'HU'; +UPDATE llx_c_country SET phone_code = 7 WHERE code = 'RU'; +UPDATE llx_c_country SET phone_code = 46 WHERE code = 'SE'; +UPDATE llx_c_country SET phone_code = 225 WHERE code = 'CI'; +UPDATE llx_c_country SET phone_code = 221 WHERE code = 'SN'; +UPDATE llx_c_country SET phone_code = 54 WHERE code = 'AR'; +UPDATE llx_c_country SET phone_code = 237 WHERE code = 'CM'; +UPDATE llx_c_country SET phone_code = 351 WHERE code = 'PT'; +UPDATE llx_c_country SET phone_code = 966 WHERE code = 'SA'; +UPDATE llx_c_country SET phone_code = 377 WHERE code = 'MC'; +UPDATE llx_c_country SET phone_code = 61 WHERE code = 'AU'; +UPDATE llx_c_country SET phone_code = 65 WHERE code = 'SG'; +UPDATE llx_c_country SET phone_code = 93 WHERE code = 'AF'; +UPDATE llx_c_country SET phone_code = 358 WHERE code = 'AX'; +UPDATE llx_c_country SET phone_code = 355 WHERE code = 'AL'; +UPDATE llx_c_country SET phone_code = 1684 WHERE code = 'AS'; +UPDATE llx_c_country SET phone_code = 376 WHERE code = 'AD'; +UPDATE llx_c_country SET phone_code = 244 WHERE code = 'AO'; +UPDATE llx_c_country SET phone_code = 1264 WHERE code = 'AI'; +UPDATE llx_c_country SET phone_code = 1268 WHERE code = 'AG'; +UPDATE llx_c_country SET phone_code = 374 WHERE code = 'AM'; +UPDATE llx_c_country SET phone_code = 297 WHERE code = 'AW'; +UPDATE llx_c_country SET phone_code = 43 WHERE code = 'AT'; +UPDATE llx_c_country SET phone_code = 994 WHERE code = 'AZ'; +UPDATE llx_c_country SET phone_code = 1242 WHERE code = 'BS'; +UPDATE llx_c_country SET phone_code = 973 WHERE code = 'BH'; +UPDATE llx_c_country SET phone_code = 880 WHERE code = 'BD'; +UPDATE llx_c_country SET phone_code = 1246 WHERE code = 'BB'; +UPDATE llx_c_country SET phone_code = 375 WHERE code = 'BY'; +UPDATE llx_c_country SET phone_code = 501 WHERE code = 'BZ'; +UPDATE llx_c_country SET phone_code = 229 WHERE code = 'BJ'; +UPDATE llx_c_country SET phone_code = 1441 WHERE code = 'BM'; +UPDATE llx_c_country SET phone_code = 975 WHERE code = 'BT'; +UPDATE llx_c_country SET phone_code = 591 WHERE code = 'BO'; +UPDATE llx_c_country SET phone_code = 387 WHERE code = 'BA'; +UPDATE llx_c_country SET phone_code = 267 WHERE code = 'BW'; +UPDATE llx_c_country SET phone_code = 55 WHERE code = 'BR'; +UPDATE llx_c_country SET phone_code = 246 WHERE code = 'IO'; +UPDATE llx_c_country SET phone_code = 673 WHERE code = 'BN'; +UPDATE llx_c_country SET phone_code = 359 WHERE code = 'BG'; +UPDATE llx_c_country SET phone_code = 226 WHERE code = 'BF'; +UPDATE llx_c_country SET phone_code = 257 WHERE code = 'BI'; +UPDATE llx_c_country SET phone_code = 855 WHERE code = 'KH'; +UPDATE llx_c_country SET phone_code = 238 WHERE code = 'CV'; +UPDATE llx_c_country SET phone_code = 1345 WHERE code = 'KY'; +UPDATE llx_c_country SET phone_code = 236 WHERE code = 'CF'; +UPDATE llx_c_country SET phone_code = 235 WHERE code = 'TD'; +UPDATE llx_c_country SET phone_code = 56 WHERE code = 'CL'; +UPDATE llx_c_country SET phone_code = 61 WHERE code = 'CX'; +UPDATE llx_c_country SET phone_code = 61 WHERE code = 'CC'; +UPDATE llx_c_country SET phone_code = 57 WHERE code = 'CO'; +UPDATE llx_c_country SET phone_code = 269 WHERE code = 'KM'; +UPDATE llx_c_country SET phone_code = 242 WHERE code = 'CG'; +UPDATE llx_c_country SET phone_code = 243 WHERE code = 'CD'; +UPDATE llx_c_country SET phone_code = 682 WHERE code = 'CK'; +UPDATE llx_c_country SET phone_code = 506 WHERE code = 'CR'; +UPDATE llx_c_country SET phone_code = 385 WHERE code = 'HR'; +UPDATE llx_c_country SET phone_code = 53 WHERE code = 'CU'; +UPDATE llx_c_country SET phone_code = 357 WHERE code = 'CY'; +UPDATE llx_c_country SET phone_code = 420 WHERE code = 'CZ'; +UPDATE llx_c_country SET phone_code = 45 WHERE code = 'DK'; +UPDATE llx_c_country SET phone_code = 253 WHERE code = 'DJ'; +UPDATE llx_c_country SET phone_code = 1767 WHERE code = 'DM'; +UPDATE llx_c_country SET phone_code = 1809 WHERE code = 'DO'; +UPDATE llx_c_country SET phone_code = 593 WHERE code = 'EC'; +UPDATE llx_c_country SET phone_code = 20 WHERE code = 'EG'; +UPDATE llx_c_country SET phone_code = 503 WHERE code = 'SV'; +UPDATE llx_c_country SET phone_code = 240 WHERE code = 'GQ'; +UPDATE llx_c_country SET phone_code = 291 WHERE code = 'ER'; +UPDATE llx_c_country SET phone_code = 372 WHERE code = 'EE'; +UPDATE llx_c_country SET phone_code = 251 WHERE code = 'ET'; +UPDATE llx_c_country SET phone_code = 500 WHERE code = 'FK'; +UPDATE llx_c_country SET phone_code = 298 WHERE code = 'FO'; +UPDATE llx_c_country SET phone_code = 679 WHERE code = 'FJ'; +UPDATE llx_c_country SET phone_code = 358 WHERE code = 'FI'; +UPDATE llx_c_country SET phone_code = 594 WHERE code = 'GF'; +UPDATE llx_c_country SET phone_code = 689 WHERE code = 'PF'; +UPDATE llx_c_country SET phone_code = 220 WHERE code = 'GM'; +UPDATE llx_c_country SET phone_code = 995 WHERE code = 'GE'; +UPDATE llx_c_country SET phone_code = 233 WHERE code = 'GH'; +UPDATE llx_c_country SET phone_code = 350 WHERE code = 'GI'; +UPDATE llx_c_country SET phone_code = 30 WHERE code = 'GR'; +UPDATE llx_c_country SET phone_code = 299 WHERE code = 'GL'; +UPDATE llx_c_country SET phone_code = 1473 WHERE code = 'GD'; +UPDATE llx_c_country SET phone_code = 1671 WHERE code = 'GU'; +UPDATE llx_c_country SET phone_code = 502 WHERE code = 'GT'; +UPDATE llx_c_country SET phone_code = 224 WHERE code = 'GN'; +UPDATE llx_c_country SET phone_code = 245 WHERE code = 'GW'; +UPDATE llx_c_country SET phone_code = 509 WHERE code = 'HT'; +UPDATE llx_c_country SET phone_code = 379 WHERE code = 'VA'; +UPDATE llx_c_country SET phone_code = 504 WHERE code = 'HN'; +UPDATE llx_c_country SET phone_code = 852 WHERE code = 'HK'; +UPDATE llx_c_country SET phone_code = 354 WHERE code = 'IS'; +UPDATE llx_c_country SET phone_code = 91 WHERE code = 'IN'; +UPDATE llx_c_country SET phone_code = 62 WHERE code = 'ID'; +UPDATE llx_c_country SET phone_code = 98 WHERE code = 'IR'; +UPDATE llx_c_country SET phone_code = 964 WHERE code = 'IQ'; +UPDATE llx_c_country SET phone_code = 972 WHERE code = 'IL'; +UPDATE llx_c_country SET phone_code = 1876 WHERE code = 'JM'; +UPDATE llx_c_country SET phone_code = 81 WHERE code = 'JP'; +UPDATE llx_c_country SET phone_code = 962 WHERE code = 'JO'; +UPDATE llx_c_country SET phone_code = 7 WHERE code = 'KZ'; +UPDATE llx_c_country SET phone_code = 254 WHERE code = 'KE'; +UPDATE llx_c_country SET phone_code = 686 WHERE code = 'KI'; +UPDATE llx_c_country SET phone_code = 850 WHERE code = 'KP'; +UPDATE llx_c_country SET phone_code = 82 WHERE code = 'KR'; +UPDATE llx_c_country SET phone_code = 965 WHERE code = 'KW'; +UPDATE llx_c_country SET phone_code = 996 WHERE code = 'KG'; +UPDATE llx_c_country SET phone_code = 856 WHERE code = 'LA'; +UPDATE llx_c_country SET phone_code = 371 WHERE code = 'LV'; +UPDATE llx_c_country SET phone_code = 961 WHERE code = 'LB'; +UPDATE llx_c_country SET phone_code = 266 WHERE code = 'LS'; +UPDATE llx_c_country SET phone_code = 231 WHERE code = 'LR'; +UPDATE llx_c_country SET phone_code = 218 WHERE code = 'LY'; +UPDATE llx_c_country SET phone_code = 423 WHERE code = 'LI'; +UPDATE llx_c_country SET phone_code = 370 WHERE code = 'LT'; +UPDATE llx_c_country SET phone_code = 352 WHERE code = 'LU'; +UPDATE llx_c_country SET phone_code = 853 WHERE code = 'MO'; +UPDATE llx_c_country SET phone_code = 389 WHERE code = 'MK'; +UPDATE llx_c_country SET phone_code = 261 WHERE code = 'MG'; +UPDATE llx_c_country SET phone_code = 265 WHERE code = 'MW'; +UPDATE llx_c_country SET phone_code = 60 WHERE code = 'MY'; +UPDATE llx_c_country SET phone_code = 960 WHERE code = 'MV'; +UPDATE llx_c_country SET phone_code = 223 WHERE code = 'ML'; +UPDATE llx_c_country SET phone_code = 356 WHERE code = 'MT'; +UPDATE llx_c_country SET phone_code = 692 WHERE code = 'MH'; +UPDATE llx_c_country SET phone_code = 222 WHERE code = 'MR'; +UPDATE llx_c_country SET phone_code = 230 WHERE code = 'MU'; +UPDATE llx_c_country SET phone_code = 262 WHERE code = 'YT'; +UPDATE llx_c_country SET phone_code = 52 WHERE code = 'MX'; +UPDATE llx_c_country SET phone_code = 691 WHERE code = 'FM'; +UPDATE llx_c_country SET phone_code = 373 WHERE code = 'MD'; +UPDATE llx_c_country SET phone_code = 976 WHERE code = 'MN'; +UPDATE llx_c_country SET phone_code = 1664 WHERE code = 'MS'; +UPDATE llx_c_country SET phone_code = 258 WHERE code = 'MZ'; +UPDATE llx_c_country SET phone_code = 95 WHERE code = 'MM'; +UPDATE llx_c_country SET phone_code = 264 WHERE code = 'NA'; +UPDATE llx_c_country SET phone_code = 674 WHERE code = 'NR'; +UPDATE llx_c_country SET phone_code = 977 WHERE code = 'NP'; +UPDATE llx_c_country SET phone_code = 599 WHERE code = 'CW'; +UPDATE llx_c_country SET phone_code = 1721 WHERE code = 'SX'; +UPDATE llx_c_country SET phone_code = 687 WHERE code = 'NC'; +UPDATE llx_c_country SET phone_code = 64 WHERE code = 'NZ'; +UPDATE llx_c_country SET phone_code = 505 WHERE code = 'NI'; +UPDATE llx_c_country SET phone_code = 227 WHERE code = 'NE'; +UPDATE llx_c_country SET phone_code = 234 WHERE code = 'NG'; +UPDATE llx_c_country SET phone_code = 683 WHERE code = 'NU'; +UPDATE llx_c_country SET phone_code = 672 WHERE code = 'NF'; +UPDATE llx_c_country SET phone_code = 1670 WHERE code = 'MP'; +UPDATE llx_c_country SET phone_code = 47 WHERE code = 'NO'; +UPDATE llx_c_country SET phone_code = 968 WHERE code = 'OM'; +UPDATE llx_c_country SET phone_code = 92 WHERE code = 'PK'; +UPDATE llx_c_country SET phone_code = 680 WHERE code = 'PW'; +UPDATE llx_c_country SET phone_code = 970 WHERE code = 'PS'; +UPDATE llx_c_country SET phone_code = 507 WHERE code = 'PA'; +UPDATE llx_c_country SET phone_code = 675 WHERE code = 'PG'; +UPDATE llx_c_country SET phone_code = 595 WHERE code = 'PY'; +UPDATE llx_c_country SET phone_code = 51 WHERE code = 'PE'; +UPDATE llx_c_country SET phone_code = 63 WHERE code = 'PH'; +UPDATE llx_c_country SET phone_code = 48 WHERE code = 'PL'; +UPDATE llx_c_country SET phone_code = 1787 WHERE code = 'PR'; +UPDATE llx_c_country SET phone_code = 974 WHERE code = 'QA'; +UPDATE llx_c_country SET phone_code = 40 WHERE code = 'RO'; +UPDATE llx_c_country SET phone_code = 250 WHERE code = 'RW'; +UPDATE llx_c_country SET phone_code = 290 WHERE code = 'SH'; +UPDATE llx_c_country SET phone_code = 1869 WHERE code = 'KN'; +UPDATE llx_c_country SET phone_code = 1758 WHERE code = 'LC'; +UPDATE llx_c_country SET phone_code = 508 WHERE code = 'PM'; +UPDATE llx_c_country SET phone_code = 1784 WHERE code = 'VC'; +UPDATE llx_c_country SET phone_code = 685 WHERE code = 'WS'; +UPDATE llx_c_country SET phone_code = 378 WHERE code = 'SM'; +UPDATE llx_c_country SET phone_code = 239 WHERE code = 'ST'; +UPDATE llx_c_country SET phone_code = 381 WHERE code = 'RS'; +UPDATE llx_c_country SET phone_code = 248 WHERE code = 'SC'; +UPDATE llx_c_country SET phone_code = 232 WHERE code = 'SL'; +UPDATE llx_c_country SET phone_code = 421 WHERE code = 'SK'; +UPDATE llx_c_country SET phone_code = 386 WHERE code = 'SI'; +UPDATE llx_c_country SET phone_code = 677 WHERE code = 'SB'; +UPDATE llx_c_country SET phone_code = 252 WHERE code = 'SO'; +UPDATE llx_c_country SET phone_code = 27 WHERE code = 'ZA'; +UPDATE llx_c_country SET phone_code = 94 WHERE code = 'LK'; +UPDATE llx_c_country SET phone_code = 249 WHERE code = 'SD'; +UPDATE llx_c_country SET phone_code = 597 WHERE code = 'SR'; +UPDATE llx_c_country SET phone_code = 47 WHERE code = 'SJ'; +UPDATE llx_c_country SET phone_code = 268 WHERE code = 'SZ'; +UPDATE llx_c_country SET phone_code = 963 WHERE code = 'SY'; +UPDATE llx_c_country SET phone_code = 886 WHERE code = 'TW'; +UPDATE llx_c_country SET phone_code = 992 WHERE code = 'TJ'; +UPDATE llx_c_country SET phone_code = 255 WHERE code = 'TZ'; +UPDATE llx_c_country SET phone_code = 66 WHERE code = 'TH'; +UPDATE llx_c_country SET phone_code = 670 WHERE code = 'TL'; +UPDATE llx_c_country SET phone_code = 690 WHERE code = 'TK'; +UPDATE llx_c_country SET phone_code = 676 WHERE code = 'TO'; +UPDATE llx_c_country SET phone_code = 1868 WHERE code = 'TT'; +UPDATE llx_c_country SET phone_code = 90 WHERE code = 'TR'; +UPDATE llx_c_country SET phone_code = 993 WHERE code = 'TM'; +UPDATE llx_c_country SET phone_code = 1649 WHERE code = 'TC'; +UPDATE llx_c_country SET phone_code = 688 WHERE code = 'TV'; +UPDATE llx_c_country SET phone_code = 256 WHERE code = 'UG'; +UPDATE llx_c_country SET phone_code = 380 WHERE code = 'UA'; +UPDATE llx_c_country SET phone_code = 971 WHERE code = 'AE'; +UPDATE llx_c_country SET phone_code = 598 WHERE code = 'UY'; +UPDATE llx_c_country SET phone_code = 998 WHERE code = 'UZ'; +UPDATE llx_c_country SET phone_code = 678 WHERE code = 'VU'; +UPDATE llx_c_country SET phone_code = 58 WHERE code = 'VE'; +UPDATE llx_c_country SET phone_code = 84 WHERE code = 'VN'; +UPDATE llx_c_country SET phone_code = 1284 WHERE code = 'VG'; +UPDATE llx_c_country SET phone_code = 1340 WHERE code = 'VI'; +UPDATE llx_c_country SET phone_code = 681 WHERE code = 'WF'; +UPDATE llx_c_country SET phone_code = 967 WHERE code = 'YE'; +UPDATE llx_c_country SET phone_code = 260 WHERE code = 'ZM'; +UPDATE llx_c_country SET phone_code = 263 WHERE code = 'ZW'; +UPDATE llx_c_country SET phone_code = 44 WHERE code = 'GG'; +UPDATE llx_c_country SET phone_code = 44 WHERE code = 'IM'; +UPDATE llx_c_country SET phone_code = 44 WHERE code = 'JE'; +UPDATE llx_c_country SET phone_code = 382 WHERE code = 'ME'; +UPDATE llx_c_country SET phone_code = 590 WHERE code = 'BL'; +UPDATE llx_c_country SET phone_code = 590 WHERE code = 'MF'; +UPDATE llx_c_country SET phone_code = 383 WHERE code = 'XK'; + +-- Set field trunk_prefix (national trunk prefix stripped in international format) +-- Trunk prefix '0' (~101 countries) +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'FR'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'BE'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'DE'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'CH'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'GB'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'IE'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'NL'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'SE'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'AT'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'GR'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'FI'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'HR'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'BA'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'BG'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'RO'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'RS'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'ME'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'MK'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'AL'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'SK'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'SI'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'LT'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'MD'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'UA'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'GE'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'XK'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'TR'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'CN'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'IN'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'ID'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'JP'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'KR'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'TH'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'VN'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'MY'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'PH'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'BD'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'PK'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'AF'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'IR'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'IQ'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'JO'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'LB'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'SA'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'AE'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'IL'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'SY'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'YE'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'AM'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'AZ'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'KH'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'LA'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'MM'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'NP'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'LK'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'TW'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'MN'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'KG'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'UZ'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'PS'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'KP'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'MA'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'DZ'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'EG'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'ZA'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'NG'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'GH'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'KE'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'ET'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'TZ'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'UG'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'SD'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'LY'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'NA'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'SL'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'ZM'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'ZW'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'ER'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'CD'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'AO'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'EH'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'AU'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'NZ'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'AR'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'BR'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'CU'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'VE'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'PE'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'EC'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'BO'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'PY'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'SR'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'GF'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'YT'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'PM'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'BL'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'MF'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'GG'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'JE'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'IM'; +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code = 'AX'; +-- Trunk prefix '8' (post-Soviet countries) +UPDATE llx_c_country SET trunk_prefix = '8' WHERE code = 'RU'; +UPDATE llx_c_country SET trunk_prefix = '8' WHERE code = 'BY'; +UPDATE llx_c_country SET trunk_prefix = '8' WHERE code = 'KZ'; +UPDATE llx_c_country SET trunk_prefix = '8' WHERE code = 'TJ'; +UPDATE llx_c_country SET trunk_prefix = '8' WHERE code = 'TM'; +-- Trunk prefix '06' (Hungary) +UPDATE llx_c_country SET trunk_prefix = '06' WHERE code = 'HU'; +-- Trunk prefix '1' (NANP countries) +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'US'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'CA'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'PR'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'VI'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'GU'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'AS'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'MP'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'JM'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'BS'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'BB'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'AG'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'DM'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'GD'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'KN'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'LC'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'VC'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'TT'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'DO'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'AI'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'BM'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'VG'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'KY'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'MS'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'TC'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'SX'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'MH'; +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code = 'FM'; diff --git a/htdocs/install/mysql/migration/22.0.0-23.0.0.sql b/htdocs/install/mysql/migration/22.0.0-23.0.0.sql index 07dee3352dd..c10522dd4b2 100644 --- a/htdocs/install/mysql/migration/22.0.0-23.0.0.sql +++ b/htdocs/install/mysql/migration/22.0.0-23.0.0.sql @@ -224,6 +224,8 @@ ALTER TABLE llx_prelevement_lignes ADD COLUMN bic varchar(11); -- 11 accordi ALTER TABLE llx_prelevement_lignes ADD COLUMN iban varchar(80); -- full iban. 34 according to ISO 13616 but we set 80 to allow to store it with encryption information ALTER TABLE llx_prelevement_lignes ADD COLUMN rum varchar(32); -- rum used +-- Add phone_code column to country table +ALTER TABLE llx_c_country ADD COLUMN phone_code integer; ALTER TABLE llx_product_customer_price CHANGE COLUMN localtax1_tx localtax1_tx varchar(20) DEFAULT '0'; ALTER TABLE llx_product_customer_price CHANGE COLUMN localtax2_tx localtax2_tx varchar(20) DEFAULT '0'; @@ -438,4 +440,262 @@ INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUE INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 4, 'PCG08-PYME-CAT', 'The PYME accountancy spanish plan in catalan language', 1); +-- Populate phone codes (ITU-T country calling codes) +UPDATE llx_c_country SET phone_code = 33 WHERE code = 'FR'; +UPDATE llx_c_country SET phone_code = 32 WHERE code = 'BE'; +UPDATE llx_c_country SET phone_code = 39 WHERE code = 'IT'; +UPDATE llx_c_country SET phone_code = 34 WHERE code = 'ES'; +UPDATE llx_c_country SET phone_code = 49 WHERE code = 'DE'; +UPDATE llx_c_country SET phone_code = 41 WHERE code = 'CH'; +UPDATE llx_c_country SET phone_code = 44 WHERE code = 'GB'; +UPDATE llx_c_country SET phone_code = 353 WHERE code = 'IE'; +UPDATE llx_c_country SET phone_code = 86 WHERE code = 'CN'; +UPDATE llx_c_country SET phone_code = 216 WHERE code = 'TN'; +UPDATE llx_c_country SET phone_code = 1 WHERE code = 'US'; +UPDATE llx_c_country SET phone_code = 212 WHERE code = 'MA'; +UPDATE llx_c_country SET phone_code = 213 WHERE code = 'DZ'; +UPDATE llx_c_country SET phone_code = 1 WHERE code = 'CA'; +UPDATE llx_c_country SET phone_code = 228 WHERE code = 'TG'; +UPDATE llx_c_country SET phone_code = 241 WHERE code = 'GA'; +UPDATE llx_c_country SET phone_code = 31 WHERE code = 'NL'; +UPDATE llx_c_country SET phone_code = 36 WHERE code = 'HU'; +UPDATE llx_c_country SET phone_code = 7 WHERE code = 'RU'; +UPDATE llx_c_country SET phone_code = 46 WHERE code = 'SE'; +UPDATE llx_c_country SET phone_code = 225 WHERE code = 'CI'; +UPDATE llx_c_country SET phone_code = 221 WHERE code = 'SN'; +UPDATE llx_c_country SET phone_code = 54 WHERE code = 'AR'; +UPDATE llx_c_country SET phone_code = 237 WHERE code = 'CM'; +UPDATE llx_c_country SET phone_code = 351 WHERE code = 'PT'; +UPDATE llx_c_country SET phone_code = 966 WHERE code = 'SA'; +UPDATE llx_c_country SET phone_code = 377 WHERE code = 'MC'; +UPDATE llx_c_country SET phone_code = 61 WHERE code = 'AU'; +UPDATE llx_c_country SET phone_code = 65 WHERE code = 'SG'; +UPDATE llx_c_country SET phone_code = 93 WHERE code = 'AF'; +UPDATE llx_c_country SET phone_code = 358 WHERE code = 'AX'; +UPDATE llx_c_country SET phone_code = 355 WHERE code = 'AL'; +UPDATE llx_c_country SET phone_code = 1684 WHERE code = 'AS'; +UPDATE llx_c_country SET phone_code = 376 WHERE code = 'AD'; +UPDATE llx_c_country SET phone_code = 244 WHERE code = 'AO'; +UPDATE llx_c_country SET phone_code = 1264 WHERE code = 'AI'; +UPDATE llx_c_country SET phone_code = 1268 WHERE code = 'AG'; +UPDATE llx_c_country SET phone_code = 374 WHERE code = 'AM'; +UPDATE llx_c_country SET phone_code = 297 WHERE code = 'AW'; +UPDATE llx_c_country SET phone_code = 43 WHERE code = 'AT'; +UPDATE llx_c_country SET phone_code = 994 WHERE code = 'AZ'; +UPDATE llx_c_country SET phone_code = 1242 WHERE code = 'BS'; +UPDATE llx_c_country SET phone_code = 973 WHERE code = 'BH'; +UPDATE llx_c_country SET phone_code = 880 WHERE code = 'BD'; +UPDATE llx_c_country SET phone_code = 1246 WHERE code = 'BB'; +UPDATE llx_c_country SET phone_code = 375 WHERE code = 'BY'; +UPDATE llx_c_country SET phone_code = 501 WHERE code = 'BZ'; +UPDATE llx_c_country SET phone_code = 229 WHERE code = 'BJ'; +UPDATE llx_c_country SET phone_code = 1441 WHERE code = 'BM'; +UPDATE llx_c_country SET phone_code = 975 WHERE code = 'BT'; +UPDATE llx_c_country SET phone_code = 591 WHERE code = 'BO'; +UPDATE llx_c_country SET phone_code = 387 WHERE code = 'BA'; +UPDATE llx_c_country SET phone_code = 267 WHERE code = 'BW'; +UPDATE llx_c_country SET phone_code = 55 WHERE code = 'BR'; +UPDATE llx_c_country SET phone_code = 246 WHERE code = 'IO'; +UPDATE llx_c_country SET phone_code = 673 WHERE code = 'BN'; +UPDATE llx_c_country SET phone_code = 359 WHERE code = 'BG'; +UPDATE llx_c_country SET phone_code = 226 WHERE code = 'BF'; +UPDATE llx_c_country SET phone_code = 257 WHERE code = 'BI'; +UPDATE llx_c_country SET phone_code = 855 WHERE code = 'KH'; +UPDATE llx_c_country SET phone_code = 238 WHERE code = 'CV'; +UPDATE llx_c_country SET phone_code = 1345 WHERE code = 'KY'; +UPDATE llx_c_country SET phone_code = 236 WHERE code = 'CF'; +UPDATE llx_c_country SET phone_code = 235 WHERE code = 'TD'; +UPDATE llx_c_country SET phone_code = 56 WHERE code = 'CL'; +UPDATE llx_c_country SET phone_code = 61 WHERE code = 'CX'; +UPDATE llx_c_country SET phone_code = 61 WHERE code = 'CC'; +UPDATE llx_c_country SET phone_code = 57 WHERE code = 'CO'; +UPDATE llx_c_country SET phone_code = 269 WHERE code = 'KM'; +UPDATE llx_c_country SET phone_code = 242 WHERE code = 'CG'; +UPDATE llx_c_country SET phone_code = 243 WHERE code = 'CD'; +UPDATE llx_c_country SET phone_code = 682 WHERE code = 'CK'; +UPDATE llx_c_country SET phone_code = 506 WHERE code = 'CR'; +UPDATE llx_c_country SET phone_code = 385 WHERE code = 'HR'; +UPDATE llx_c_country SET phone_code = 53 WHERE code = 'CU'; +UPDATE llx_c_country SET phone_code = 357 WHERE code = 'CY'; +UPDATE llx_c_country SET phone_code = 420 WHERE code = 'CZ'; +UPDATE llx_c_country SET phone_code = 45 WHERE code = 'DK'; +UPDATE llx_c_country SET phone_code = 253 WHERE code = 'DJ'; +UPDATE llx_c_country SET phone_code = 1767 WHERE code = 'DM'; +UPDATE llx_c_country SET phone_code = 1809 WHERE code = 'DO'; +UPDATE llx_c_country SET phone_code = 593 WHERE code = 'EC'; +UPDATE llx_c_country SET phone_code = 20 WHERE code = 'EG'; +UPDATE llx_c_country SET phone_code = 503 WHERE code = 'SV'; +UPDATE llx_c_country SET phone_code = 240 WHERE code = 'GQ'; +UPDATE llx_c_country SET phone_code = 291 WHERE code = 'ER'; +UPDATE llx_c_country SET phone_code = 372 WHERE code = 'EE'; +UPDATE llx_c_country SET phone_code = 251 WHERE code = 'ET'; +UPDATE llx_c_country SET phone_code = 500 WHERE code = 'FK'; +UPDATE llx_c_country SET phone_code = 298 WHERE code = 'FO'; +UPDATE llx_c_country SET phone_code = 679 WHERE code = 'FJ'; +UPDATE llx_c_country SET phone_code = 358 WHERE code = 'FI'; +UPDATE llx_c_country SET phone_code = 594 WHERE code = 'GF'; +UPDATE llx_c_country SET phone_code = 689 WHERE code = 'PF'; +UPDATE llx_c_country SET phone_code = 220 WHERE code = 'GM'; +UPDATE llx_c_country SET phone_code = 995 WHERE code = 'GE'; +UPDATE llx_c_country SET phone_code = 233 WHERE code = 'GH'; +UPDATE llx_c_country SET phone_code = 350 WHERE code = 'GI'; +UPDATE llx_c_country SET phone_code = 30 WHERE code = 'GR'; +UPDATE llx_c_country SET phone_code = 299 WHERE code = 'GL'; +UPDATE llx_c_country SET phone_code = 1473 WHERE code = 'GD'; +UPDATE llx_c_country SET phone_code = 1671 WHERE code = 'GU'; +UPDATE llx_c_country SET phone_code = 502 WHERE code = 'GT'; +UPDATE llx_c_country SET phone_code = 224 WHERE code = 'GN'; +UPDATE llx_c_country SET phone_code = 245 WHERE code = 'GW'; +UPDATE llx_c_country SET phone_code = 509 WHERE code = 'HT'; +UPDATE llx_c_country SET phone_code = 379 WHERE code = 'VA'; +UPDATE llx_c_country SET phone_code = 504 WHERE code = 'HN'; +UPDATE llx_c_country SET phone_code = 852 WHERE code = 'HK'; +UPDATE llx_c_country SET phone_code = 354 WHERE code = 'IS'; +UPDATE llx_c_country SET phone_code = 91 WHERE code = 'IN'; +UPDATE llx_c_country SET phone_code = 62 WHERE code = 'ID'; +UPDATE llx_c_country SET phone_code = 98 WHERE code = 'IR'; +UPDATE llx_c_country SET phone_code = 964 WHERE code = 'IQ'; +UPDATE llx_c_country SET phone_code = 972 WHERE code = 'IL'; +UPDATE llx_c_country SET phone_code = 1876 WHERE code = 'JM'; +UPDATE llx_c_country SET phone_code = 81 WHERE code = 'JP'; +UPDATE llx_c_country SET phone_code = 962 WHERE code = 'JO'; +UPDATE llx_c_country SET phone_code = 7 WHERE code = 'KZ'; +UPDATE llx_c_country SET phone_code = 254 WHERE code = 'KE'; +UPDATE llx_c_country SET phone_code = 686 WHERE code = 'KI'; +UPDATE llx_c_country SET phone_code = 850 WHERE code = 'KP'; +UPDATE llx_c_country SET phone_code = 82 WHERE code = 'KR'; +UPDATE llx_c_country SET phone_code = 965 WHERE code = 'KW'; +UPDATE llx_c_country SET phone_code = 996 WHERE code = 'KG'; +UPDATE llx_c_country SET phone_code = 856 WHERE code = 'LA'; +UPDATE llx_c_country SET phone_code = 371 WHERE code = 'LV'; +UPDATE llx_c_country SET phone_code = 961 WHERE code = 'LB'; +UPDATE llx_c_country SET phone_code = 266 WHERE code = 'LS'; +UPDATE llx_c_country SET phone_code = 231 WHERE code = 'LR'; +UPDATE llx_c_country SET phone_code = 218 WHERE code = 'LY'; +UPDATE llx_c_country SET phone_code = 423 WHERE code = 'LI'; +UPDATE llx_c_country SET phone_code = 370 WHERE code = 'LT'; +UPDATE llx_c_country SET phone_code = 352 WHERE code = 'LU'; +UPDATE llx_c_country SET phone_code = 853 WHERE code = 'MO'; +UPDATE llx_c_country SET phone_code = 389 WHERE code = 'MK'; +UPDATE llx_c_country SET phone_code = 261 WHERE code = 'MG'; +UPDATE llx_c_country SET phone_code = 265 WHERE code = 'GH'; +UPDATE llx_c_country SET phone_code = 350 WHERE code = 'GI'; +UPDATE llx_c_country SET phone_code = 30 WHERE code = 'MW'; +UPDATE llx_c_country SET phone_code = 60 WHERE code = 'MY'; +UPDATE llx_c_country SET phone_code = 960 WHERE code = 'MV'; +UPDATE llx_c_country SET phone_code = 223 WHERE code = 'ML'; +UPDATE llx_c_country SET phone_code = 356 WHERE code = 'MT'; +UPDATE llx_c_country SET phone_code = 692 WHERE code = 'MH'; +UPDATE llx_c_country SET phone_code = 222 WHERE code = 'MR'; +UPDATE llx_c_country SET phone_code = 230 WHERE code = 'MU'; +UPDATE llx_c_country SET phone_code = 262 WHERE code = 'YT'; +UPDATE llx_c_country SET phone_code = 52 WHERE code = 'MX'; +UPDATE llx_c_country SET phone_code = 691 WHERE code = 'FM'; +UPDATE llx_c_country SET phone_code = 373 WHERE code = 'MD'; +UPDATE llx_c_country SET phone_code = 976 WHERE code = 'MN'; +UPDATE llx_c_country SET phone_code = 1664 WHERE code = 'MS'; +UPDATE llx_c_country SET phone_code = 258 WHERE code = 'MZ'; +UPDATE llx_c_country SET phone_code = 95 WHERE code = 'MM'; +UPDATE llx_c_country SET phone_code = 264 WHERE code = 'NA'; +UPDATE llx_c_country SET phone_code = 674 WHERE code = 'NR'; +UPDATE llx_c_country SET phone_code = 977 WHERE code = 'NP'; +UPDATE llx_c_country SET phone_code = 599 WHERE code = 'CW'; +UPDATE llx_c_country SET phone_code = 1721 WHERE code = 'SX'; +UPDATE llx_c_country SET phone_code = 687 WHERE code = 'NC'; +UPDATE llx_c_country SET phone_code = 64 WHERE code = 'NZ'; +UPDATE llx_c_country SET phone_code = 505 WHERE code = 'NI'; +UPDATE llx_c_country SET phone_code = 227 WHERE code = 'NE'; +UPDATE llx_c_country SET phone_code = 234 WHERE code = 'NG'; +UPDATE llx_c_country SET phone_code = 683 WHERE code = 'NU'; +UPDATE llx_c_country SET phone_code = 672 WHERE code = 'NF'; +UPDATE llx_c_country SET phone_code = 1670 WHERE code = 'MP'; +UPDATE llx_c_country SET phone_code = 47 WHERE code = 'NO'; +UPDATE llx_c_country SET phone_code = 968 WHERE code = 'OM'; +UPDATE llx_c_country SET phone_code = 92 WHERE code = 'PK'; +UPDATE llx_c_country SET phone_code = 680 WHERE code = 'PW'; +UPDATE llx_c_country SET phone_code = 970 WHERE code = 'PS'; +UPDATE llx_c_country SET phone_code = 507 WHERE code = 'PA'; +UPDATE llx_c_country SET phone_code = 675 WHERE code = 'PG'; +UPDATE llx_c_country SET phone_code = 595 WHERE code = 'PY'; +UPDATE llx_c_country SET phone_code = 51 WHERE code = 'PE'; +UPDATE llx_c_country SET phone_code = 63 WHERE code = 'PH'; +UPDATE llx_c_country SET phone_code = 48 WHERE code = 'PL'; +UPDATE llx_c_country SET phone_code = 1787 WHERE code = 'PR'; +UPDATE llx_c_country SET phone_code = 974 WHERE code = 'QA'; +UPDATE llx_c_country SET phone_code = 40 WHERE code = 'RO'; +UPDATE llx_c_country SET phone_code = 250 WHERE code = 'RW'; +UPDATE llx_c_country SET phone_code = 290 WHERE code = 'SH'; +UPDATE llx_c_country SET phone_code = 1869 WHERE code = 'KN'; +UPDATE llx_c_country SET phone_code = 1758 WHERE code = 'LC'; +UPDATE llx_c_country SET phone_code = 508 WHERE code = 'PM'; +UPDATE llx_c_country SET phone_code = 1784 WHERE code = 'VC'; +UPDATE llx_c_country SET phone_code = 685 WHERE code = 'WS'; +UPDATE llx_c_country SET phone_code = 378 WHERE code = 'SM'; +UPDATE llx_c_country SET phone_code = 239 WHERE code = 'ST'; +UPDATE llx_c_country SET phone_code = 381 WHERE code = 'RS'; +UPDATE llx_c_country SET phone_code = 248 WHERE code = 'SC'; +UPDATE llx_c_country SET phone_code = 232 WHERE code = 'SL'; +UPDATE llx_c_country SET phone_code = 421 WHERE code = 'SK'; +UPDATE llx_c_country SET phone_code = 386 WHERE code = 'SI'; +UPDATE llx_c_country SET phone_code = 677 WHERE code = 'SB'; +UPDATE llx_c_country SET phone_code = 252 WHERE code = 'SO'; +UPDATE llx_c_country SET phone_code = 27 WHERE code = 'ZA'; +UPDATE llx_c_country SET phone_code = 94 WHERE code = 'LK'; +UPDATE llx_c_country SET phone_code = 249 WHERE code = 'SD'; +UPDATE llx_c_country SET phone_code = 597 WHERE code = 'SR'; +UPDATE llx_c_country SET phone_code = 47 WHERE code = 'SJ'; +UPDATE llx_c_country SET phone_code = 268 WHERE code = 'SZ'; +UPDATE llx_c_country SET phone_code = 963 WHERE code = 'SY'; +UPDATE llx_c_country SET phone_code = 886 WHERE code = 'TW'; +UPDATE llx_c_country SET phone_code = 992 WHERE code = 'TJ'; +UPDATE llx_c_country SET phone_code = 255 WHERE code = 'TZ'; +UPDATE llx_c_country SET phone_code = 66 WHERE code = 'TH'; +UPDATE llx_c_country SET phone_code = 670 WHERE code = 'TL'; +UPDATE llx_c_country SET phone_code = 690 WHERE code = 'TK'; +UPDATE llx_c_country SET phone_code = 676 WHERE code = 'TO'; +UPDATE llx_c_country SET phone_code = 1868 WHERE code = 'TT'; +UPDATE llx_c_country SET phone_code = 90 WHERE code = 'TR'; +UPDATE llx_c_country SET phone_code = 993 WHERE code = 'TM'; +UPDATE llx_c_country SET phone_code = 1649 WHERE code = 'TC'; +UPDATE llx_c_country SET phone_code = 688 WHERE code = 'TV'; +UPDATE llx_c_country SET phone_code = 256 WHERE code = 'UG'; +UPDATE llx_c_country SET phone_code = 380 WHERE code = 'UA'; +UPDATE llx_c_country SET phone_code = 971 WHERE code = 'AE'; +UPDATE llx_c_country SET phone_code = 598 WHERE code = 'UY'; +UPDATE llx_c_country SET phone_code = 998 WHERE code = 'UZ'; +UPDATE llx_c_country SET phone_code = 678 WHERE code = 'VU'; +UPDATE llx_c_country SET phone_code = 58 WHERE code = 'VE'; +UPDATE llx_c_country SET phone_code = 84 WHERE code = 'VN'; +UPDATE llx_c_country SET phone_code = 1284 WHERE code = 'VG'; +UPDATE llx_c_country SET phone_code = 1340 WHERE code = 'VI'; +UPDATE llx_c_country SET phone_code = 681 WHERE code = 'WF'; +UPDATE llx_c_country SET phone_code = 967 WHERE code = 'YE'; +UPDATE llx_c_country SET phone_code = 260 WHERE code = 'ZM'; +UPDATE llx_c_country SET phone_code = 263 WHERE code = 'ZW'; +UPDATE llx_c_country SET phone_code = 44 WHERE code = 'GG'; +UPDATE llx_c_country SET phone_code = 44 WHERE code = 'IM'; +UPDATE llx_c_country SET phone_code = 44 WHERE code = 'JE'; +UPDATE llx_c_country SET phone_code = 382 WHERE code = 'ME'; +UPDATE llx_c_country SET phone_code = 590 WHERE code = 'BL'; +UPDATE llx_c_country SET phone_code = 590 WHERE code = 'MF'; +UPDATE llx_c_country SET phone_code = 383 WHERE code = 'XK'; + +-- Add trunk_prefix column to llx_c_country +ALTER TABLE llx_c_country ADD COLUMN trunk_prefix varchar(5); + +-- Populate trunk_prefix for countries with trunk prefix '0' +UPDATE llx_c_country SET trunk_prefix = '0' WHERE code IN ('FR','BE','DE','CH','GB','IE','NL','SE','AT','GR','FI','HR','BA','BG','RO','RS','ME','MK','AL','SK','SI','LT','MD','UA','GE','XK','TR','CN','IN','ID','JP','KR','TH','VN','MY','PH','BD','PK','AF','IR','IQ','JO','LB','SA','AE','IL','SY','YE','AM','AZ','KH','LA','MM','NP','LK','TW','MN','KG','UZ','PS','KP','MA','DZ','EG','ZA','NG','GH','KE','ET','TZ','UG','SD','LY','NA','SL','ZM','ZW','ER','CD','AO','EH','AU','NZ','AR','BR','CU','VE','PE','EC','BO','PY','SR','GF','YT','PM','BL','MF','GG','JE','IM','AX'); +-- Populate trunk_prefix for post-Soviet countries with trunk prefix '8' +UPDATE llx_c_country SET trunk_prefix = '8' WHERE code IN ('RU','BY','KZ','TJ','TM'); +-- Populate trunk_prefix for Hungary with trunk prefix '06' +UPDATE llx_c_country SET trunk_prefix = '06' WHERE code = 'HU'; +-- Populate trunk_prefix for NANP countries with trunk prefix '1' +UPDATE llx_c_country SET trunk_prefix = '1' WHERE code IN ('US','CA','PR','VI','GU','AS','MP','JM','BS','BB','AG','DM','GD','KN','LC','VC','TT','DO','AI','BM','VG','KY','MS','TC','SX','MH','FM'); + +-- Strip formatting sugar from existing phone numbers in llx_socpeople +UPDATE llx_socpeople SET phone = REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(phone, ' ', ''), '-', ''), '.', ''), '(', ''), ')', '') WHERE phone IS NOT NULL AND phone != ''; +UPDATE llx_socpeople SET phone_perso = REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(phone_perso, ' ', ''), '-', ''), '.', ''), '(', ''), ')', '') WHERE phone_perso IS NOT NULL AND phone_perso != ''; +UPDATE llx_socpeople SET phone_mobile = REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(phone_mobile, ' ', ''), '-', ''), '.', ''), '(', ''), ')', '') WHERE phone_mobile IS NOT NULL AND phone_mobile != ''; +UPDATE llx_socpeople SET fax = REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(fax, ' ', ''), '-', ''), '.', ''), '(', ''), ')', '') WHERE fax IS NOT NULL AND fax != ''; + -- end of migration diff --git a/htdocs/install/mysql/tables/llx_c_country.sql b/htdocs/install/mysql/tables/llx_c_country.sql index f7936deefe1..5e2bd0bf9a3 100644 --- a/htdocs/install/mysql/tables/llx_c_country.sql +++ b/htdocs/install/mysql/tables/llx_c_country.sql @@ -3,6 +3,7 @@ -- Copyright (C) 2004 Laurent Destailleur -- Copyright (C) 2014 Alexandre Spangaro -- Copyright (C) 2022 Juanjo Menent +-- Copyright (C) 2026 Open-Dsi -- -- 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 @@ -29,5 +30,7 @@ create table llx_c_country eec tinyint DEFAULT 0 NOT NULL, sepa tinyint DEFAULT 0 NOT NULL, active tinyint DEFAULT 1 NOT NULL, - favorite tinyint DEFAULT 0 NOT NULL + favorite tinyint DEFAULT 0 NOT NULL, + phone_code integer, + trunk_prefix varchar(5) )ENGINE=innodb; diff --git a/htdocs/install/step2.php b/htdocs/install/step2.php index 169a22bdfd2..b0fd3c186b7 100644 --- a/htdocs/install/step2.php +++ b/htdocs/install/step2.php @@ -503,7 +503,7 @@ if ($action == "set") { // Test on permission not required. Already managed by } //print 'x'.$file.'-'.$createdata.'
'; - if (is_numeric($createdata) || preg_match('/'.preg_quote($createdata).'/i', $file)) { + if (is_numeric($createdata) || preg_match('/'.preg_quote($createdata).'/i', $file)) { // @phpstan-ignore argument.invalidPregQuote $tablefound++; $tabledata[] = $file; } diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index c316e7d6f2a..9583064287d 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -4381,7 +4381,7 @@ function migrate_delete_old_dir($db, $langs, $conf) * @param DoliDB $db Database handler * @param Translate $langs Object langs * @param Conf $conf Object conf - * @param array $listofmodule List of modules, like array('MODULE_KEY_NAME'=>$reloadmode, ...) + * @param array $listofmodule List of modules, like array('MODULE_KEY_NAME'=>$reloadmode, ...) * @param int<0,1> $force 1=Reload module even if not already loaded * @return int Return integer <0 if KO, >0 if OK */ @@ -4579,7 +4579,7 @@ function migrate_productlot_path() $resql = $db->query($sql); if ($resql) { - $modulepart="product_batch"; + $modulepart = "product_batch"; $lot = new Productlot($db); @@ -5585,7 +5585,8 @@ function migrate_apiresttokens() while ($obj = $db->fetch_object($result)) { if (!in_array(dolDecrypt($obj->tokenstring), $allexistingtokens)) { // Load the object of the user of token so we can get the API_COUNT_CALL - unset($tmpuser->conf); $tmpuser->conf = new stdClass(); + unset($tmpuser->conf); + $tmpuser->conf = new stdClass(); $tmpuser->fetch((int) $obj->fk_user, '', '', 1, ($obj->entity ? $obj->entity : $conf->entity)); $sqlforinsert = "INSERT INTO ".MAIN_DB_PREFIX."oauth_token (service, tokenstring, fk_user, datec, entity, apicount_total)"; diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 0eebc8b7244..062829a0db9 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -393,6 +393,14 @@ ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE=Activate the management of VAT revers ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE_DESC=When this option is enabled, you can define that a supplier or a given vendor invoice must be transferred into accountancy differently: A additional debit and a credit line will generated into the accounting on 2 given accounts from the chart of account defined into the "%s" setup page. ACCOUNTING_ENABLE_TABONTHIRDPARTY=Activate a tab on third-party cards to view the subsidiary ledger ACCOUNTING_ENABLE_TABONTHIRDPARTY_DESC=When this option is enabled, a new tab is showing in third-party cards to view and manage accounting for the third-party as to reconcile, print & more +AccountingDefaultNotExportLettering=By default, do not export lettering when generating the file +AccountingDefaultNotExportLetteringDesc=If enabled, the lettering information of accounting entries will not be included in the generated export file. +AccountingDefaultNotNotifiedExportDate=By default, mark not yet exported lines as "Exported" +AccountingDefaultNotNotifiedExportDateDesc=If enabled, each exported line will be stamped with the export date. To modify a line marked as exported, you will need to delete the entire accounting entry and re-transfer it to accounting. +AccountingDefaultNotifiedValidationDate=By default, validate and lock exported accounting entries +AccountingDefaultNotifiedValidationDateDesc=If enabled, exported accounting entries will be automatically validated and locked (same effect as the "Close" feature). Editing and deletion of these lines will be PERMANENTLY impossible. +AccountingDefaultNotifiedExportFull=By default, export source documents (Available only on some export models Quadra | FEC | FEC2) +AccountingDefaultNotifiedExportFullDesc=If enabled, source documents associated with accounting entries (invoices, credit notes, etc.) will be included or attached when generating the export file. ## Template MenuListBookkeepingTemplates=Bookkeeping templates BookkeepingTemplates=Bookkeeping templates diff --git a/htdocs/langs/en_US/categories.lang b/htdocs/langs/en_US/categories.lang index 48fb8d21421..d619c8904d1 100644 --- a/htdocs/langs/en_US/categories.lang +++ b/htdocs/langs/en_US/categories.lang @@ -107,3 +107,4 @@ CategorieListOfType=Categories (or tags) can be used to categorize the objects m NumberOfCategories=Number of tags/categories MyTag=My tag BackToCategoryTypes=Back to types of category +CategoriesTranslationsExtrafields=Categorie translation attributes extrafields diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index 9fcda8b5a2d..017a086f1b7 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -458,6 +458,8 @@ PaymentTermsSupplier=Payment Term - Vendor PaymentTypeBoth=Payment Type - Customer and Vendor MulticurrencyUsed=Use Multicurrency MulticurrencyCurrency=Currency +PhoneCode=Phone code +TrunkPrefix=Trunk prefix InEEC=Europe (EEC) RestOfEurope=Rest of Europe (EEC) OutOfEurope=Out of Europe (EEC) diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang index da563c950f1..9416b02272c 100644 --- a/htdocs/langs/en_US/members.lang +++ b/htdocs/langs/en_US/members.lang @@ -262,5 +262,6 @@ ConfirmMergeMembers=Are you sure you want to merge the chosen member with the cu ErrorMembersMerge=There was an error when merging the members. Please check the log. Changes have been reverted. ConfirmCreateMember=Confirm create member CorrespondingMemberFound=Corresponding member found -CorrespondingMemberFoundQuestion=A member has been found with the given information.
Do you want to renew your membership? -MEMBER_SEARCH_MEMBER_PUBLIC_FORM_CREATE=Searches for a member matching the information entered in the public member creation form. If a member is found, redirects the user to the membership payment form +CorrespondingMemberFoundQuestion=A member has been found with the given information.
Do you want to renew your membership? (if not nothing will be recorded) +MEMBER_SEARCH_MEMBER_PUBLIC_FORM_CREATE=Suggest to just record the subscription (without creating a new member) if an existing member is found +MEMBER_SEARCH_MEMBER_PUBLIC_FORM_CREATEDesc=A search is done on login, company name + email (for legal entity), or full name + email (for individual). If a member is already found, the form suggest to record a renewal of subscription. diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 9ff9bf0189c..a98519c895e 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -467,3 +467,4 @@ ProductType=Type of product UseBarCodeForProducts=Use barcode for products UseBarCodeForThirdParties=Use barcode for third parties NotSupportedOnKits=Not supported on kits +ProductLangExtrafieldsSetup=Product translations Extrafields diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang index aee39fbb539..ae49a3be9b2 100644 --- a/htdocs/langs/en_US/website.lang +++ b/htdocs/langs/en_US/website.lang @@ -506,3 +506,5 @@ WebPortalSharedDocsDirHelp=Enter the name of the directory, located in the ECM/G DateM=Modification Date ThisDirectoryIsEmpty=This directory is empty WrittenBy=Written by %s +ImportOfWebsiteTemplateIncludingPHPIsAllowedIf=Import of website templates using dynamic content in PHP is allowed only if $dolibarr_website_allow_custom_php is set to 2 in conf.php. +ImportOfWebsiteTemplateIncludingPHPIsDisabled=Import of website templates using dynamic content in PHP need to have $dolibarr_website_allow_custom_php set to 1 or 2 in conf.php to be allowed. diff --git a/htdocs/langs/fr_FR/companies.lang b/htdocs/langs/fr_FR/companies.lang index 394b059f9f4..21bf748b59f 100644 --- a/htdocs/langs/fr_FR/companies.lang +++ b/htdocs/langs/fr_FR/companies.lang @@ -458,6 +458,8 @@ PaymentTermsSupplier=Conditions de paiement - fournisseur PaymentTypeBoth=Type de paiement - Client et fournisseur MulticurrencyUsed=Utiliser plusieurs devises MulticurrencyCurrency=Devise +PhoneCode=Indicatif tél. +TrunkPrefix=Préfixe trunk InEEC=Union Européenne (UE) RestOfEurope=Reste de l'Union Européenne (UE) OutOfEurope=Hors Union Européenne (UE) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 809aff66916..e1fdcd3a557 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -13,7 +13,7 @@ * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2020 Demarest Maxime * Copyright (C) 2020-2024 Charlene Benke - * Copyright (C) 2021-2025 Frédéric France + * Copyright (C) 2021-2026 Frédéric France * Copyright (C) 2021 Alexandre Spangaro * Copyright (C) 2023 Joachim Küter * Copyright (C) 2023 Eric Seigne @@ -146,12 +146,13 @@ if (!defined('NOSESSION')) { } -// Init the 6 global objects, this include will make the 'new Xxx()' and set properties for: $conf, $db, $langs, $user, $mysoc, $hookmanager +// Init the 7 global objects, this include will make the 'new Xxx()' and set properties for: $conf, $db, $langs, $user, $mysoc, $hookmanager, $extrafields require_once 'master.inc.php'; /** * The master.inc.php has been included so the following variable are now defined: * @var Conf $conf * @var ?DoliDB $db May be null if NOREQUIREDB is defined + * @var ?ExtraFields $extrafields May be null if NOREQUIREDB is defined * @var ?HookManager $hookmanager May be null if NOHOOKMANAGER is defined * @var ?Translate $langs May be null if NOREQUIRETRAN is defined * @var ?User $user May be null if NOREQUIREUSER is defined diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index eff2c682bae..80ad932eac6 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -11,7 +11,7 @@ * Copyright (C) 2011 Philippe Grand * Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com> * Copyright (C) 2024-2025 MDW - * Copyright (C) 2025 Frédéric France + * Copyright (C) 2025-2026 Frédéric France * * 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 @@ -67,6 +67,7 @@ require_once 'filefunc.inc.php'; */ ' @phan-var-force ?string $dolibarr_main_db_prefix +@phan-var-force ?string $dolibarr_main_db_collation @phan-var-force ?string $dolibarr_main_db_encryption @phan-var-force ?string $dolibarr_main_db_cryptkey @phan-var-force ?string $dolibarr_main_limit_users @@ -271,6 +272,13 @@ if (!defined('NOREQUIREUSER')) { if (!defined('NOHOOKMANAGER')) { $hookmanager = new HookManager($db); } +/* + * Create $extrafields object + */ +if ($db !== null) { + require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; + $extrafields = new ExtraFields($db); +} /* diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index b9bd10fe308..70f3369f94d 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -345,9 +345,7 @@ foreach ($search as $key => $val) { continue; } $field_spec = $object->fields[$key]; - if ($field_spec === null) { - continue; - } + // Ignore false positive @phan-suppress-next-line PhanTypeMismatchArgumentNullable $mode_search = (($object->isInt($field_spec) || $object->isFloat($field_spec)) ? 1 : 0); if ((strpos($field_spec['type'], 'integer:') === 0) || (strpos($field_spec['type'], 'sellist:') === 0) || !empty($field_spec['arrayofkeyval'])) { if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($field_spec['arrayofkeyval']) || !array_key_exists('0', $field_spec['arrayofkeyval'])))) { diff --git a/htdocs/opensurvey/wizard/choix_date.php b/htdocs/opensurvey/wizard/choix_date.php index 2fb2ac4b67f..4bae05abb1a 100644 --- a/htdocs/opensurvey/wizard/choix_date.php +++ b/htdocs/opensurvey/wizard/choix_date.php @@ -427,7 +427,7 @@ if (issetAndNoEmpty('choixjourajout')) { $nbofchoice = count($_SESSION["totalchoixjour"]); for ($i = 0; $i < $nbofchoice; $i++) { $choixjourajout = GETPOST("choixjourajout"); - if ($_SESSION["totalchoixjour"][$i] == mktime(0, 0, 0, $_SESSION["mois"], $choixjourajout[0], $_SESSION["annee"])) { + if ($_SESSION["totalchoixjour"][$i] == mktime(0, 0, 0, $_SESSION["mois"], (int) $choixjourajout[0], $_SESSION["annee"])) { $journeuf = false; } } @@ -436,9 +436,9 @@ if (issetAndNoEmpty('choixjourajout')) { // If the validation is ok, add a field to the session variables that holds all the dates if ($journeuf && issetAndNoEmpty('choixjourajout') === true) { $choixjourajout = GETPOST("choixjourajout"); - array_push($_SESSION["totalchoixjour"], dol_mktime(0, 0, 0, $_SESSION["mois"], $choixjourajout[0], $_SESSION["annee"])); + array_push($_SESSION["totalchoixjour"], dol_mktime(0, 0, 0, $_SESSION["mois"], (int) $choixjourajout[0], $_SESSION["annee"])); sort($_SESSION["totalchoixjour"]); - $cle = array_search(dol_mktime(0, 0, 0, $_SESSION["mois"], $choixjourajout[0], $_SESSION["annee"]), $_SESSION["totalchoixjour"]); + $cle = array_search(dol_mktime(0, 0, 0, $_SESSION["mois"], (int) $choixjourajout[0], $_SESSION["annee"]), $_SESSION["totalchoixjour"]); //On sauvegarde les heures deja entrées for ($i = 0; $i < $cle; $i++) { @@ -479,7 +479,7 @@ if (issetAndNoEmpty('choixjourretrait')) { for ($i = 0; $i < $nbofchoice; $i++) { $choixjourretrait = GETPOST('choixjourretrait'); - if ($_SESSION["totalchoixjour"][$i] == mktime(0, 0, 0, $_SESSION["mois"], $choixjourretrait[0], $_SESSION["annee"])) { + if ($_SESSION["totalchoixjour"][$i] == mktime(0, 0, 0, $_SESSION["mois"], (int) $choixjourretrait[0], $_SESSION["annee"])) { for ($j = $i; $j < $nbofchoice; $j++) { $k = $j + 1; $_SESSION["horaires$j"] = $_SESSION["horaires$k"]; diff --git a/htdocs/partnership/partnership_list.php b/htdocs/partnership/partnership_list.php index 1ed446f111e..75627eacc1a 100644 --- a/htdocs/partnership/partnership_list.php +++ b/htdocs/partnership/partnership_list.php @@ -2,7 +2,7 @@ /* Copyright (C) 2007-2017 Laurent Destailleur * Copyright (C) 2021 NextGestion * Copyright (C) 2024-2025 Frédéric France - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2026 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 @@ -1034,10 +1034,10 @@ while ($i < $imaxinloop) { } else { print $object->thirdparty->town; } - } elseif ($key == 'fk_soc_member' && $adherent->id > 0) { + } elseif ($key == 'fk_soc_member' && $adherent->id > 0) { // @phpstan-ignore greater.alwaysFalse,booleanAnd.alwaysFalse print $adherent->getNomUrl(1); } elseif ($key == 'fk_soc_dateend') { - if ($adherent->id > 0) { + if ($adherent->id > 0) { // @phpstan-ignore greater.alwaysFalse $datefin = $adherent->datefin; if ($datefin) { print dol_print_date($datefin, 'day'); diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 8a8ac4f64bc..f8028c55fc6 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -16,7 +16,7 @@ * Copyright (C) 2016-2022 Charlene Benke * Copyright (C) 2016 Meziane Sof * Copyright (C) 2017 Josep Lluís Amador - * Copyright (C) 2019-2025 Frédéric France + * Copyright (C) 2019-2026 Frédéric France * Copyright (C) 2019-2020 Thibault FOUCART * Copyright (C) 2020 Pierre Ardoin * Copyright (C) 2022 Vincent de Grandpré @@ -46,8 +46,16 @@ // Load Dolibarr environment require '../main.inc.php'; +/** + * @var Conf $conf + * @var DoliDB $db + * @var ExtraFields $extrafields + * @var HookManager $hookmanager + * @var Societe $mysoc + * @var Translate $langs + * @var User $user + */ require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; @@ -57,14 +65,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/product/modules_product.class.php' require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; -/** - * @var Conf $conf - * @var DoliDB $db - * @var HookManager $hookmanager - * @var Societe $mysoc - * @var Translate $langs - * @var User $user - */ if (isModEnabled('propal')) { require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; } @@ -157,7 +157,6 @@ if ($result > 0) { $object = new Product($db); $object->type = $type; // so test later to fill $usercancxxx is correct -$extrafields = new ExtraFields($db); // fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index 426ca1928ed..d422340aad8 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -152,7 +152,23 @@ class FormProduct $sql .= " HAVING sum(ps.reel) > ".((float) $stockMin); } } - $sql .= $this->db->order($orderBy); + $reorderBy = explode(',', $orderBy); + $arraysortfield = array(); + $arraysortorder = array(); + foreach ($reorderBy as $element) { + $elementKey = explode(' ', $element)[0]; + if ($elementKey) { + $arraysortfield[] = $elementKey; + if (isset($element[1])) { + $arraysortorder[] = $element[1]; + } else { + $arraysortorder[] = 'ASC'; + } + } + } + $sortfield = implode(',', $arraysortfield); + $sortorder = implode(',', $arraysortorder); + $sql .= $this->db->order($sortfield, $sortorder); dol_syslog(get_class($this).'::loadWarehouses', LOG_DEBUG); $resql = $this->db->query($sql); diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 6b5207a52f5..4d46b09d4bc 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -44,6 +44,7 @@ require '../main.inc.php'; /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Societe $mysoc * @var Translate $langs @@ -187,7 +188,6 @@ if ((string) $type == '0') { // Initialize a technical object to manage hooks. Note that conf->hooks_modules contains array of hooks $object = new Product($db); $hookmanager->initHooks(array('productservicelist')); -$extrafields = new ExtraFields($db); $form = new Form($db); $formcompany = new FormCompany($db); $formproduct = new FormProduct($db); diff --git a/htdocs/product/stats/bom.php b/htdocs/product/stats/bom.php index 215472d88f2..21c3b392c56 100644 --- a/htdocs/product/stats/bom.php +++ b/htdocs/product/stats/bom.php @@ -46,6 +46,9 @@ $langs->loadLangs(array('mrp', 'products', 'companies')); $id = GETPOSTINT('id'); $ref = GETPOST('ref', 'alpha'); +$search_month = GETPOSTINT('search_month'); +$search_year = GETPOSTINT('search_year'); + // Security check $fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : '')); $fieldtype = (!empty($ref) ? 'ref' : 'rowid'); @@ -124,8 +127,8 @@ if ($id > 0 || !empty($ref)) { print '
'; - print '
'; - print '
'; + print '
'; + print '
'; $nboflines = show_stats_for_company($product, $socid); @@ -288,8 +291,10 @@ if ($id > 0 || !empty($ref)) { $option .= '&search_year='.urlencode((string) $search_year); } + print ''; print ''."\n"; print ''; + print ''; if (!empty($sortfield)) { print ''; } diff --git a/htdocs/product/stats/card.php b/htdocs/product/stats/card.php index 4c07c970a41..fee419d3cc7 100644 --- a/htdocs/product/stats/card.php +++ b/htdocs/product/stats/card.php @@ -198,6 +198,7 @@ if ((!($id > 0) && empty($ref)) || $notab) { if ($result || !($id > 0)) { print ''; print ''; + print ''; if (empty($id) || $notab) { print ''; } @@ -255,7 +256,7 @@ if ($result || !($id > 0)) { print ''; print '
'; - print '
'; + print '
'; print '
'; print '
'; diff --git a/htdocs/product/stats/commande.php b/htdocs/product/stats/commande.php index 0bebe84e284..b85ab10ebe4 100644 --- a/htdocs/product/stats/commande.php +++ b/htdocs/product/stats/commande.php @@ -141,8 +141,8 @@ if ($id > 0 || !empty($ref)) { print '
'; - print '
'; - print ''; + print '
'; + print '
'; $nboflines = show_stats_for_company($product, $socid); @@ -228,8 +228,10 @@ if ($id > 0 || !empty($ref)) { $option .= '&search_status='.urlencode($search_status); } + print ''; print ''."\n"; print ''; + print ''; if (!empty($sortfield)) { print ''; } @@ -252,8 +254,8 @@ if ($id > 0 || !empty($ref)) { print $langs->trans('Status'); $formorder->selectOrderStatus($search_status, 1, 'search_status'); print '
'; - print ''; - print ''; + print ''; + print ''; print '
'; print ''; print ''; diff --git a/htdocs/product/stats/commande_fournisseur.php b/htdocs/product/stats/commande_fournisseur.php index 0a7bd876c23..33056df6b75 100644 --- a/htdocs/product/stats/commande_fournisseur.php +++ b/htdocs/product/stats/commande_fournisseur.php @@ -27,12 +27,6 @@ * \brief Statistics for supplier orders by product */ require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; -require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formorder.class.php'; - /** * @var Conf $conf * @var DoliDB $db @@ -40,6 +34,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formorder.class.php'; * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; +require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formorder.class.php'; // Load translation files required by the page $langs->loadLangs(array('orders', 'products', 'companies', 'sendings')); @@ -142,8 +141,8 @@ if ($id > 0 || !empty($ref)) { print '
'; - print '
'; - print '
'; + print '
'; + print '
'; $nboflines = show_stats_for_company($product, $socid); @@ -222,11 +221,13 @@ if ($id > 0 || !empty($ref)) { } if ($search_status != '') { - $param .= '&search_status='.urlencode($search_status); + $option .= '&search_status='.urlencode($search_status); } + print ''; print ''."\n"; print ''; + print ''; if (!empty($sortfield)) { print ''; } @@ -249,8 +250,8 @@ if ($id > 0 || !empty($ref)) { print $langs->trans('Status'); $formorder->selectSupplierOrderStatus($search_status, 1, 'search_status'); print '
'; - print ''; - print ''; + print ''; + print ''; print '
'; print ''; print ''; diff --git a/htdocs/product/stats/contrat.php b/htdocs/product/stats/contrat.php index 5a845a64cfb..db950f7bbe2 100644 --- a/htdocs/product/stats/contrat.php +++ b/htdocs/product/stats/contrat.php @@ -27,10 +27,6 @@ // Load Dolibarr environment require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; -require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; - /** * @var Conf $conf * @var DoliDB $db @@ -39,12 +35,19 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; +require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; + // Load translation files required by the page $langs->loadLangs(array('contracts', 'products', 'companies')); $id = GETPOSTINT('id'); $ref = GETPOST('ref', 'alpha'); +$search_month = GETPOSTINT('search_month'); +$search_year = GETPOSTINT('search_year'); + // Security check $fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : '')); $fieldtype = (!empty($ref) ? 'ref' : 'rowid'); @@ -124,8 +127,8 @@ if ($id > 0 || !empty($ref)) { print '
'; - print '
'; - print '
'; + print '
'; + print '
'; $nboflines = show_stats_for_company($product, $socid); @@ -187,17 +190,17 @@ if ($id > 0 || !empty($ref)) { if ($limit > 0 && $limit != $conf->liste_limit) { $option .= '&limit='.((int) $limit); } - /* if (!empty($search_month)) { - $option .= '&search_month='.urlencode($search_month); + $option .= '&search_month='.urlencode((string) $search_month); } if (!empty($search_year)) { - $option .= '&search_year='.urlencode((string) ($search_year)); + $option .= '&search_year='.urlencode((string) $search_year); } - */ + print ''; print ''."\n"; print ''; + print ''; if (!empty($sortfield)) { print ''; } diff --git a/htdocs/product/stats/expedition.php b/htdocs/product/stats/expedition.php index e6f2d8e48bb..5059fb4b3de 100644 --- a/htdocs/product/stats/expedition.php +++ b/htdocs/product/stats/expedition.php @@ -135,8 +135,8 @@ if ($id > 0 || !empty($ref)) { print '
'; - print '
'; - print '
'; + print '
'; + print '
'; $nboflines = show_stats_for_company($product, $socid); @@ -204,8 +204,10 @@ if ($id > 0 || !empty($ref)) { $option .= '&search_year='.urlencode((string) ($search_year)); } + print ''; print ''."\n"; print ''; + print ''; if (!empty($sortfield)) { print ''; } @@ -226,8 +228,8 @@ if ($id > 0 || !empty($ref)) { print $langs->trans('Month').': '; print $langs->trans('Year').':'.$formother->selectyear(($search_year ? (string) $search_year : '-1'), 'search_year', 1, 20, 5); print '
'; - print ''; - print ''; + print ''; + print ''; print '
'; print ''; print ''; diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php index 04a154aadc2..e94345c3865 100644 --- a/htdocs/product/stats/facture.php +++ b/htdocs/product/stats/facture.php @@ -5,6 +5,7 @@ * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2014 Florian Henry * Copyright (C) 2024 Frédéric France + * Copyright (C) 2026 Jon Bendtsen * * 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 @@ -28,11 +29,6 @@ // Load Dolibarr environment require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; -require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; - /** * @var Conf $conf * @var DoliDB $db @@ -40,6 +36,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; // Load translation files required by the page $langs->loadLangs(array('companies', 'bills', 'products', 'supplier_proposal')); @@ -130,15 +131,105 @@ $result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product /* - * View + * Actions */ +$toselect = GETPOST('toselect', 'array:int'); +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'invoicelist'; +$massaction = GETPOST('massaction', 'alpha'); +$diroutputmassaction = $conf->invoice->dir_output.'/temp/massgeneration/'.$user->id; + +if (GETPOST('cancel', 'alpha')) { + $action = 'list'; + $massaction = ''; +} +if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { + $massaction = ''; +} +$arrayfields = array( + 'f.ref' => array('label' => "Ref", 'checked' => '1', 'position' => 5), + 's.nom' => array('label' => "ThirdParty", 'checked' => '1', 'position' => 50), + 's.code_client' => array('label' => "CustomerCodeShort", 'checked' => '-1', 'position' => 52), + 'f.datef' => array('label' => "DateInvoice", 'checked' => '1', 'position' => 60), + 'd.qty' => array('label' => "Qty", 'checked' => '1', 'position' => 65), + 'd.total_ht' => array('label' => "AmountHT", 'checked' => '1', 'position' => 70), + 'f.fk_statut' => array('label' => "Status", 'checked' => '1', 'position' => 1000), +); + $invoicestatic = new Facture($db); $societestatic = new Societe($db); $form = new Form($db); $formother = new FormOther($db); + + +$arrayofmassactions = array( + 'presend' => img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), +); +$massactionbutton = $form->selectMassAction('', $arrayofmassactions); +$arrayofselected = is_array($toselect) ? $toselect : array(); +$selectedfields = (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); + + +$totalarray = array(); +$totalarray['nbfield'] = 0; + +$parameters = array('socid' => $socid, 'arrayfields' => &$arrayfields); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +} +if (empty($reshook)) { + $objectclass = 'Facture'; + $objectlabel = 'Invoices'; + $permissiontoread = $user->hasRight("facture", "lire"); + $permissiontoadd = $user->hasRight("facture", "creer"); + $permissiontodelete = $user->hasRight("facture", "supprimer"); + $uploaddir = $conf->invoice->dir_output; + + if (isset($_POST['massaction'])) { + $massaction = $_POST['massaction']; + } + + if (isset($_POST['confirmmassaction']) && isset($_POST['massaction']) && $_POST['massaction'] == 'presend') { + global $arrayofselected; + + $toselect = is_array($_POST['toselect']) ? $_POST['toselect'] : array(); + $arrayofselected = array(); + + // Store only VALID IDs (those with emails) + foreach ($toselect as $invoice_id) { + $objecttmp = new Facture($db); + if ($objecttmp->fetch((int) $invoice_id) > 0) { + // Force loading the thirdparty object + if (empty($objecttmp->thirdparty) || !is_object($objecttmp->thirdparty)) { + $objecttmp->fetch_thirdparty(); + } + + // Only add to array if email exists + if (!empty($objecttmp->thirdparty->email)) { + // Store just the ID, not the object + $arrayofselected[] = $invoice_id; + } + } + } + + if (empty($arrayofselected)) { + setEventMessages($langs->trans("DefaultStatusEmptyMandatory").' '.$langs->trans("Select"), null, 'errors'); + header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); + exit; + } + } else { + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; + } +} + + +/* + * View + */ + if ($id > 0 || !empty($ref)) { $product = new Product($db); $result = $product->fetch($id, $ref); @@ -189,8 +280,8 @@ if ($id > 0 || !empty($ref)) { print '
'; - print '
'; - print '
'; + print '
'; + print '
'; $nboflines = show_stats_for_company($product, $socid); @@ -202,7 +293,7 @@ if ($id > 0 || !empty($ref)) { print dol_get_fiche_end(); if ($showmessage && $nboflines > 1) { - print ''.$langs->trans("ClinkOnALinkOfColumn", $langs->transnoentitiesnoconv("Referers")).''; + // Nothing shown } elseif ($user->hasRight('facture', 'lire')) { $sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, s.code_client,"; $sql .= " f.ref, f.datef, f.paye, f.type, f.fk_statut as statut, f.rowid as facid,"; @@ -287,6 +378,14 @@ if ($id > 0 || !empty($ref)) { $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); + // I am saving the result here, because some hooks a little later will change $result such that I can not get the contents + $all_rows = array(); + $num = $db->num_rows($result); + while ($row = $db->fetch_object($result)) { + $all_rows[] = $row; + } + $db->free($result); // Free immediately + $result = null; // Clear the variable $option .= '&id='.$product->id; @@ -297,12 +396,16 @@ if ($id > 0 || !empty($ref)) { // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; // Add $param from hooks + '@phan-var-force string $param'; + /** @var string $param */ $parameters = array('param' => &$param); $reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $option .= $hookmanager->resPrint; + print ''; print ''."\n"; print ''; + print ''; if (!empty($sortfield)) { print ''; } @@ -311,7 +414,17 @@ if ($id > 0 || !empty($ref)) { } // @phan-suppress-next-line PhanPluginSuspiciousParamOrder - print_barre_liste($langs->trans("CustomersInvoices"), $page, $_SERVER["PHP_SELF"], $option, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit, 0, 0, 1); + print_barre_liste($langs->trans("CustomersInvoices"), $page, $_SERVER["PHP_SELF"], $option, $sortfield, $sortorder, $massactionbutton, $num, $totalofrecords, '', 0, '', '', $limit, 0, 0, 1); + + if ($massaction == 'presend' && !empty($arrayofselected)) { + // Set variables expected by the template + $topicmail = "SendBillRef"; + $modelmail = "facture_send"; + $objecttmp = new Facture($db); + $trackid = 'inv'.$id; + + include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; + } if (!empty($page)) { $option .= '&page='.urlencode((string) ($page)); @@ -327,8 +440,8 @@ if ($id > 0 || !empty($ref)) { print $hookmanager->resPrint; print '
'; - print ''; - print ''; + print ''; + print ''; print '
'; print ''; print ''; @@ -337,6 +450,8 @@ if ($id > 0 || !empty($ref)) { print '
'; print '
'; print ''; + // Action column + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "s.rowid", "", $option, '', $sortfield, $sortorder); print_liste_field_titre("Company", $_SERVER["PHP_SELF"], "s.nom", "", $option, '', $sortfield, $sortorder); print_liste_field_titre("CustomerCode", $_SERVER["PHP_SELF"], "s.code_client", "", $option, '', $sortfield, $sortorder); @@ -352,8 +467,7 @@ if ($id > 0 || !empty($ref)) { if ($num > 0) { while ($i < min($num, $limit)) { - $objp = $db->fetch_object($result); - + $objp = $all_rows[$i]; if ($objp->type == Facture::TYPE_CREDIT_NOTE) { $objp->qty = -($objp->qty); } @@ -366,15 +480,32 @@ if ($id > 0 || !empty($ref)) { $societestatic->fetch($objp->socid); $paiement = $invoicestatic->getSommePaiement(); - print ''; - print ''; + + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + print '\n"; - print ''; - print "\n"; + print ''; + print '\n"; print '"; - print '\n"; + print '\n"; print '\n"; print ''; // Fields from hook @@ -401,7 +532,6 @@ if ($id > 0 || !empty($ref)) { } else { dol_print_error($db); } - $db->free($result); } } } else { diff --git a/htdocs/product/stats/facture_fournisseur.php b/htdocs/product/stats/facture_fournisseur.php index 2ea447de01e..e8d6b18311c 100644 --- a/htdocs/product/stats/facture_fournisseur.php +++ b/htdocs/product/stats/facture_fournisseur.php @@ -136,8 +136,8 @@ if ($id > 0 || !empty($ref)) { print '
'; - print '
'; - print '
'; + print '
'; + if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($invoicestatic->id, $arrayofselected)) { + $selected = 1; + } + print ''; + } + print ''; print $invoicestatic->getNomUrl(1); print "'.$societestatic->getNomUrl(1).'".$objp->code_client."'.$societestatic->getNomUrl(1).''.dolPrintHTML($objp->code_client)."'; print dol_print_date($db->jdate($objp->datef), 'dayhour')."'.$objp->qty."'.dolPrintHTML($objp->qty)."'.price($objp->total_ht)."'.$invoicestatic->LibStatut($objp->paye, $objp->statut, 5, $paiement, $objp->type).'
'; + print '
'; + print '
'; $nboflines = show_stats_for_company($product, $socid); @@ -208,8 +208,10 @@ if ($id > 0 || !empty($ref)) { $option .= '&search_year='.urlencode((string) ($search_year)); } + print ''; print ''."\n"; print ''; + print ''; if (!empty($sortfield)) { print ''; } @@ -230,8 +232,8 @@ if ($id > 0 || !empty($ref)) { print $langs->trans('Month').': '; print $langs->trans('Year').':'.$formother->selectyear(($search_year ? (string) $search_year : '-1'), 'search_year', 1, 20, 5); print '
'; - print ''; - print ''; + print ''; + print ''; print '
'; print ''; print ''; diff --git a/htdocs/product/stats/facturerec.php b/htdocs/product/stats/facturerec.php index 04040fad093..0ca60eaa224 100644 --- a/htdocs/product/stats/facturerec.php +++ b/htdocs/product/stats/facturerec.php @@ -150,8 +150,8 @@ if ($id > 0 || !empty($ref)) { print '
'; - print '
'; - print '
'; + print '
'; + print '
'; $nboflines = show_stats_for_company($product, $socid); @@ -224,8 +224,10 @@ if ($id > 0 || !empty($ref)) { $option .= '&search_year='.urlencode((string) ($search_year)); } + print ''; print ''."\n"; print ''; + print ''; if (!empty($sortfield)) { print ''; } @@ -246,8 +248,8 @@ if ($id > 0 || !empty($ref)) { print $langs->trans('Month').': '; print $langs->trans('Year').':'.$formother->selectyear(($search_year ? (string) $search_year : '-1'), 'search_year', 1, 20, 5); print '
'; - print ''; - print ''; + print ''; + print ''; print '
'; print ''; print ''; diff --git a/htdocs/product/stats/mo.php b/htdocs/product/stats/mo.php index f94a7a4fcc4..6ac05302b49 100644 --- a/htdocs/product/stats/mo.php +++ b/htdocs/product/stats/mo.php @@ -136,8 +136,8 @@ if ($id > 0 || !empty($ref)) { print '
'; - print '
'; - print '
'; + print '
'; + print '
'; $nboflines = show_stats_for_company($product, $socid); @@ -205,8 +205,10 @@ if ($id > 0 || !empty($ref)) { $option .= '&search_year='.urlencode((string) ($search_year)); } + print ''; print ''."\n"; print ''; + print ''; print ''; print ''; @@ -223,8 +225,8 @@ if ($id > 0 || !empty($ref)) { print $langs->trans('Month').': '; print $langs->trans('Year').':'.$formother->selectyear(($search_year ? (string) $search_year : '-1'), 'search_year', 1, 20, 5); print '
'; - print ''; - print ''; + print ''; + print ''; print '
'; print ''; print ''; diff --git a/htdocs/product/stats/propal.php b/htdocs/product/stats/propal.php index b9f6d82d6fc..ecdd012de03 100644 --- a/htdocs/product/stats/propal.php +++ b/htdocs/product/stats/propal.php @@ -137,8 +137,8 @@ if ($id > 0 || !empty($ref)) { print '
'; - print '
'; - print '
'; + print '
'; + print '
'; $nboflines = show_stats_for_company($product, $socid); @@ -214,8 +214,10 @@ if ($id > 0 || !empty($ref)) { $option .= '&search_year='.urlencode((string) ($search_year)); } + print ''; print ''."\n"; print ''; + print ''; if (!empty($sortfield)) { print ''; } @@ -236,8 +238,8 @@ if ($id > 0 || !empty($ref)) { print $langs->trans('Month').': '; print $langs->trans('Year').':'.$formother->selectyear(($search_year ? (string) $search_year : '-1'), 'search_year', 1, 20, 5); print '
'; - print ''; - print ''; + print ''; + print ''; print '
'; print ''; print ''; @@ -271,12 +273,12 @@ if ($id > 0 || !empty($ref)) { print '\n"; - print ''; + print ''; print '"; - print "\n"; - print ''."\n"; - print ''; + print '\n"; + print ''."\n"; + print ''; print "\n"; $i++; } diff --git a/htdocs/product/stats/reception.php b/htdocs/product/stats/reception.php index bfde1cee7cc..55384805d5f 100644 --- a/htdocs/product/stats/reception.php +++ b/htdocs/product/stats/reception.php @@ -134,8 +134,8 @@ if ($id > 0 || !empty($ref)) { print '
'; - print '
'; - print '
'; print $propalstatic->getNomUrl(1); print "'.$societestatic->getNomUrl(1).''.$societestatic->getNomUrl(1).''; print dol_print_date($db->jdate($objp->datep), 'dayhour')."".$objp->qty."'.price($objp->amount).''.$propalstatic->LibStatut($objp->statut, 5).''.$objp->qty."'.price($objp->amount).''.$propalstatic->LibStatut($objp->statut, 5).'
'; + print '
'; + print '
'; $nboflines = show_stats_for_company($product, $socid); @@ -203,8 +203,10 @@ if ($id > 0 || !empty($ref)) { $option .= '&search_year='.urlencode((string) ($search_year)); } - print ''."\n"; + print ''; + print ''."\n"; print ''; + print ''; if (!empty($sortfield)) { print ''; } @@ -225,8 +227,8 @@ if ($id > 0 || !empty($ref)) { print $langs->trans('Month').': '; print $langs->trans('Year').':'.$formother->selectyear(($search_year ? (string) $search_year : '-1'), 'search_year', 1, 20, 5); print '
'; - print ''; - print ''; + print ''; + print ''; print '
'; print ''; print ''; diff --git a/htdocs/product/stats/supplier_proposal.php b/htdocs/product/stats/supplier_proposal.php index 9bde87ea5b6..7466efa9a2c 100644 --- a/htdocs/product/stats/supplier_proposal.php +++ b/htdocs/product/stats/supplier_proposal.php @@ -134,8 +134,8 @@ if ($id > 0 || !empty($ref)) { print '
'; - print '
'; - print '
'; + print '
'; + print '
'; $nboflines = show_stats_for_company($product, $socid); @@ -207,8 +207,10 @@ if ($id > 0 || !empty($ref)) { $option .= '&search_year='.urlencode((string) ($search_year)); } + print ''; print ''."\n"; print ''; + print ''; if (!empty($sortfield)) { print ''; } @@ -229,8 +231,8 @@ if ($id > 0 || !empty($ref)) { print $langs->trans('Month').': '; print $langs->trans('Year').':'.$formother->selectyear(($search_year ? (string) $search_year : '-1'), 'search_year', 1, 20, 5); print '
'; - print ''; - print ''; + print ''; + print ''; print '
'; print ''; print ''; diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index f0d9f424d50..4b160504d78 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -83,7 +83,7 @@ $fieldid = GETPOSTISSET("ref") ? 'ref' : 'rowid'; $d_eatby = dol_mktime(0, 0, 0, GETPOSTINT('eatbymonth'), GETPOSTINT('eatbyday'), GETPOSTINT('eatbyyear')); $d_sellby = dol_mktime(0, 0, 0, GETPOSTINT('sellbymonth'), GETPOSTINT('sellbyday'), GETPOSTINT('sellbyyear')); $pdluoid = GETPOSTINT('pdluoid'); -$batchnumber = GETPOST('batch_number', 'aZ09comma'); +$batchnumber = GETPOST('batch_number', 'alpha'); if (!empty($batchnumber)) { $batchnumber = trim($batchnumber); } diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 1a60d29b5c6..d5465236bfc 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -250,25 +250,27 @@ if (empty($reshook)) { $error++; } - $result = $object->create($user); - if (!$error && $result > 0) { - // Add myself as Owner Contact Selected in the form - $typeofcontact = GETPOST('typeofcontact'); - $result = $object->add_contact($user->id, $typeofcontact, 'internal'); + if (!$error) { + $result = $object->create($user); + if ($result > 0) { + // Add myself as Owner Contact Selected in the form + $typeofcontact = GETPOST('typeofcontact'); + $result = $object->add_contact($user->id, $typeofcontact, 'internal'); - // -3 means type not found (renamed, de-activated or deleted), so don't prevent creation if it has been the case - if ($result == -3) { - setEventMessage('ErrorPROJECTLEADERRoleMissingRestoreIt', 'errors'); - $error++; - } elseif ($result < 0) { + // -3 means type not found (renamed, de-activated or deleted), so don't prevent creation if it has been the case + if ($result == -3) { + setEventMessage('ErrorPROJECTLEADERRoleMissingRestoreIt', 'errors'); + $error++; + } elseif ($result < 0) { + $langs->load("errors"); + setEventMessages($object->error, $object->errors, 'errors'); + $error++; + } + } else { $langs->load("errors"); setEventMessages($object->error, $object->errors, 'errors'); $error++; } - } else { - $langs->load("errors"); - setEventMessages($object->error, $object->errors, 'errors'); - $error++; } if (!$error && !empty($object->id) > 0) { // Category association diff --git a/htdocs/public/includes/dolibarr-js-context/dolibarr-context.umd.js b/htdocs/public/includes/dolibarr-js-context/dolibarr-context.umd.js index 8823bcc684b..53675753c63 100644 --- a/htdocs/public/includes/dolibarr-js-context/dolibarr-context.umd.js +++ b/htdocs/public/includes/dolibarr-js-context/dolibarr-context.umd.js @@ -229,8 +229,18 @@ /** * Internal logger - * Only prints when debug mode is enabled - * @param {string} msg + * Outputs logs only when debug mode is enabled. + * + * Why use Dolibarr.log instead of console.log? + * Dolibarr.log avoids console noise caused by the Dolibarr core context + * or internal notices that can easily spam the console. + * Dolibarr.log is primarily intended to be used by the Dolibarr context itself, + * providing a unified logging mechanism across the application. + * + * This allows module developers to focus on their own logs (with console.log) + * without being distracted by unrelated global Dolibarr activity. + * + * @param {string} msg Log message */ log(msg) { if (_debug) console.log(`Dolibarr: ${msg}`); diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 16a47afe396..3c0659f70b2 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -30,7 +30,6 @@ * \brief Example of form to add a new member * * Note that you can add following constant to change behaviour of page - * MEMBER_NEWFORM_AMOUNT Default amount for auto-subscribe form * MEMBER_MIN_AMOUNT Minimum amount * MEMBER_NEWFORM_PAYONLINE Suggest payment with 'all', 'paypal', 'paybox', 'stripe', ... * MEMBER_NEWFORM_DOLIBARRTURNOVER Show field turnover (specific for dolibarr foundation) @@ -228,9 +227,13 @@ if ($reshook < 0) { } // Verify if we can find member + if (empty($reshook) && getDolGlobalInt("MEMBER_SEARCH_MEMBER_PUBLIC_FORM_CREATE") && $action == 'add' && !GETPOSTISSET("nofetchmember")) { // Test on permission not required here $memberfound = false; + if (!getDolGlobalString('ADHERENT_LOGIN_NOT_REQUIRED') && GETPOSTISSET('login')) { + // Note that this allow to guess anonymous ID already used. But this is not a problem as it is an anonymous pseudonym. + // If we try to new account and option MEMBER_SEARCH_MEMBER_PUBLIC_FORM_CREATE was off, we also get the same error. $sql = "SELECT rowid as id"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent as a"; $sql .= " WHERE a.login = '".$db->escape(GETPOST('login'))."'"; @@ -582,7 +585,7 @@ if (empty($reshook) && $action == 'add') { // Test on permission not required he if (getDolGlobalString('MEMBER_NEWFORM_PAYONLINE') && getDolGlobalString('MEMBER_NEWFORM_PAYONLINE') != '-1') { if (empty($adht->caneditamount)) { // If edition of amount not allowed - // TODO Check amount is same than the amount required for the type of member or if not defined as the default amount into $conf->global->MEMBER_NEWFORM_AMOUNT + // TODO Check amount is same than the amount required for the type of member // It is not so important because a test is done on return of payment validation. } @@ -868,14 +871,14 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR } // Firstname - print ''."\n"; + print ''."\n"; // Lastname - print ''."\n"; + print ''."\n"; // EMail print ''; - print ''."\n"; + print ''."\n"; // Login if (!getDolGlobalString('ADHERENT_LOGIN_NOT_REQUIRED')) { @@ -981,7 +984,7 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR $amountbytype = $adht->amountByType(1); // Load the array of amount per type $minimumamountbytype = $adht->minimumamountbytype(1); // Load the array of minimum amount per type foreach ($amountbytype as $k => $v) { - $amount = max(0, (float) $v, (float) getDolGlobalInt("MEMBER_MIN_AMOUNT"), (float) getDolGlobalInt("MEMBER_NEWFORM_AMOUNT"), $minimumamountbytype[$k]); + $amount = max(0, (float) $v, (float) getDolGlobalInt("MEMBER_MIN_AMOUNT"), $minimumamountbytype[$k]); $amountbytype[$k] = $amount; } @@ -991,10 +994,6 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR // Set amount for the subscription from the type and options: // - First check the amount of the member type. $amount = empty($amountbytype[$typeid]) ? 0 : $amountbytype[$typeid]; - // - If not found, take the default amount only if the user is authorized to edit it - if (empty($amount) && getDolGlobalString('MEMBER_NEWFORM_AMOUNT')) { - $amount = getDolGlobalString('MEMBER_NEWFORM_AMOUNT'); - } // - If not set, we accept to have amount defined as parameter (for backward compatibility). if (empty($amount)) { $amount = (GETPOST('amount') ? price2num(GETPOST('amount', 'alpha'), 'MT', 2) : ''); @@ -1016,7 +1015,6 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR } // TODO Move this into previous hook if (getDolGlobalString('MEMBER_NEWFORM_DOLIBARRTURNOVER')) { - // Do not set a default amount MEMBER_NEWFORM_AMOUNT if you use MEMBER_NEWFORM_DOLIBARRTURNOVER $s = $langs->trans("AreYouAPreferredPartner", '{s1}'); $s = str_replace('{s1}', 'Peferred Partner', $s); print '
'.$langs->trans("Firstname").'
'.$langs->trans("Firstname").'
'.$langs->trans("Lastname").'
'.$langs->trans("Lastname").'
'.(getDolGlobalString('ADHERENT_MAIL_REQUIRED') ? '' : '').$langs->trans("EMail").(getDolGlobalString('ADHERENT_MAIL_REQUIRED') ? '' : '').''.img_picto('', 'object_email').'
'.img_picto('', 'object_email').'
'; @@ -1147,17 +1145,13 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR } print ''; - if (empty($amount) && getDolGlobalString('MEMBER_NEWFORM_AMOUNT')) { - $amount = getDolGlobalString('MEMBER_NEWFORM_AMOUNT'); - } - $amountformuladescription = $amountformuladescriptionbytype[$typeid]; $showedamount = $amount > 0 ? $amount : 0; if ($caneditamount === "1") { print ''; print ''; - print ' '.$langs->getCurrencySymbol($conf->currency).''; + print ' '.$langs->getCurrencySymbol($conf->currency).''; if (!getDolGlobalString('MEMBER_NEWFORM_DOLIBARRTURNOVER')) { print ' - '; if (empty($amountformuladescription)) { @@ -1173,7 +1167,7 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR } else { print ''; print ''; - print ' '.$langs->getCurrencySymbol($conf->currency).'