Merge branch 'develop' into fix-warnings-and-trad-not-showing

This commit is contained in:
Laurent Destailleur 2024-03-15 00:23:54 +01:00 committed by GitHub
commit f1a8d712fb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
640 changed files with 9407 additions and 8846 deletions

View file

@ -9,8 +9,7 @@ concurrency:
cancel-in-progress: true
env:
CACHE_KEY_PART: ${{ github.event_name == 'pull_request' && format('{0}-{1}',
github.base_ref, github.head_ref) || github.ref_name }}
CACHE_KEY_PART: ${{ github.event_name == 'pull_request' && format('{0}-{1}', github.base_ref, github.head_ref) || github.ref_name }}
GITHUB_JSON: ${{ toJSON(github) }} # Helps in debugging Github Action
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
@ -57,7 +56,8 @@ jobs:
# Run PHPStan
- name: Run PHPStan
id: phpstan
run: phpstan -vvv analyse --error-format=checkstyle --memory-limit 4G -a build/phpstan/bootstrap_action.php -c phpstan.neon | tee _stan.xml | cs2pr --graceful-warnings
run: |
phpstan -vvv analyse --error-format=checkstyle --memory-limit 7G -a build/phpstan/bootstrap_action.php | tee _stan.xml | cs2pr --graceful-warnings
# continue-on-error: true
# Save cache

View file

@ -114,7 +114,7 @@ jobs:
curl "http://${{ env.PHPSERVER_DOMAIN_PORT }}"
shell: powershell
- name: Run PHPUnit tests
continue-on-error: true
# continue-on-error: true
shell: cmd
# setting up php.ini, starting the php server are currently in this step
run: |-
@ -143,7 +143,7 @@ jobs:
cat htdocs/conf/conf.php
curl "http://${{ env.PHPSERVER_DOMAIN_PORT }}"
REM 'DOSKEY' USED to recover error code (no pipefile equivalent in windows?)
( php "%PHPROOT%\phpunit" -d memory_limit=-1 -c %CD%\test\phpunit\phpunittest.xml "test\phpunit\AllTests.php" & call doskey /exename=err err=%%^^errorlevel%% ) | "${{ env.TEE }}" "${{ env.PHPUNIT_LOG }}"
( php "%PHPROOT%\phpunit" -d memory_limit=-1 -c %CD%\test\phpunit\phpunittest.xml "test\phpunit\AllTests.php" --exclude-group WindowsWaitingForFix & call doskey /exename=err err=%%^^errorlevel%% ) | "${{ env.TEE }}" "${{ env.PHPUNIT_LOG }}"
for /f "tokens=2 delims==" %%A in ('doskey /m:err') do EXIT /B %%A
- name: Convert Raw Log to Annotations
uses: mdeweerd/logToCheckStyle@v2024.2.9

18
.gitignore vendored
View file

@ -66,8 +66,21 @@ doc/install.lock
/composer.json
/composer.lock
# to execute pre-commit
local.sh
# Local script, executed during pre-commit
/local.sh
# Local phpstan configuration
/phpstan.neon
/phpstan-baseline.neon
# Logs
/*.log
# Vim swap files
*.sw?
# Generated by PHPUNIT.BAT
/INI_PHPUNIT
# ignore cache builds
/build/phpstan/phpstan
@ -75,3 +88,4 @@ local.sh
phpstan_custom.neon
/.php-cs-fixer.cache
/.php_cs.cache
/.cache

View file

@ -30,6 +30,9 @@ The following changes may create regressions for some external modules, but were
* The signature for all ->delete() method has been modified to match the modulebuilder template (so first paramis now always $user), except
the delete for thirdparty (still accept the id of thirdparty to delete as first parameter). Will probably be modified into another version.
* Route for API /thirdparties/gateways has been renamed into /thirdparties/accounts
* The $userdoneid in actioncomm class is deprecated. Please use $userownerid instead.
* The field fk_user_done in actioncomm table is deprecated. Please use fk_user_action instead.
* The AGENDA_ENABLE_DONEBY hidden option is deprecated.
***** ChangeLog for 19.0.1 compared to 19.0.0 *****

View file

@ -104,3 +104,5 @@ Scope is the web application (backoffice) and the APIs.
* SSL/TLS best practices
* Invalid or missing SPF (Sender Policy Framework) records (Incomplete or missing SPF/DKIM/DMARC)
* Physical or social engineering attempts or issues that require physical access to a victim’s computer/device
* Vulnerabilities of type XSS exploited by using javascript into a website page (with permission to edit website pages) or by using php code into a website page
using the permission to edit php code are not qualified, except if this allow to get higher privileges (being able to set javascript or php code is the expected behaviour).

View file

@ -57,3 +57,4 @@ dur
fonction
espace
methode
datee

View file

@ -4,7 +4,7 @@
#
# shellcheck disable=1113,2002,2006,2086,2164,2219
Releases=("3.9" "4.0" "5.0" "6.0" "7.0" "8.0" "9.0" "10.0" "11.0" "12.0" "13.0" "14.0" "15.0" "16.0" "17.0" "18.0" "develop")
Releases=("3.9" "4.0" "5.0" "6.0" "7.0" "8.0" "9.0" "10.0" "11.0" "12.0" "13.0" "14.0" "15.0" "16.0" "17.0" "18.0" "19.0" "develop")
let "counter = 0"
echo "Copy script into /tmp/github_commits_byversion.sh"
@ -49,4 +49,3 @@ do
echo
let "counter +=1"
done

View file

@ -10,13 +10,11 @@
return [
// # Issue statistics:
// PhanPluginSuspiciousParamPosition : 45+ occurrences
// PhanPluginDuplicateIfStatements : 30+ occurrences
// PhanParamSignatureMismatch : 25+ occurrences
// PhanUndeclaredConstant : 15+ occurrences
// PhanPluginDuplicateExpressionBinaryOp : 10+ occurrences
// PhanTypeArraySuspiciousNull : 10+ occurrences
// PhanTypeInvalidUnaryOperandNumeric : 8 occurrences
// PhanPluginDuplicateIfCondition : 6 occurrences
// PhanRedefineFunctionInternal : 6 occurrences
// PhanPluginUnsafeEval : 5 occurrences
// PhanParamSuspiciousOrder : 4 occurrences
@ -32,26 +30,19 @@ return [
// Currently, file_suppressions and directory_suppressions are the only supported suppressions
'file_suppressions' => [
'htdocs/adherents/card.php' => ['PhanPluginDuplicateIfStatements'],
'htdocs/adherents/stats/geo.php' => ['PhanTypeArraySuspiciousNull'],
'htdocs/adherents/type.php' => ['PhanPluginDuplicateExpressionBinaryOp'],
'htdocs/admin/receiptprinter.php' => ['PhanRedefineFunctionInternal'],
'htdocs/admin/translation.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/api/class/api_documents.class.php' => ['PhanPluginDuplicateExpressionBinaryOp'],
'htdocs/barcode/printsheet.php' => ['PhanPluginDuplicateExpressionBinaryOp'],
'htdocs/bom/bom_list.php' => ['PhanPluginDuplicateIfStatements'],
'htdocs/categories/class/api_categories.class.php' => ['PhanAccessMethodProtected'],
'htdocs/categories/viewcat.php' => ['PhanPluginDuplicateExpressionBinaryOp'],
'htdocs/collab/index.php' => ['PhanParamTooMany'],
'htdocs/comm/action/card.php' => ['PhanPluginDuplicateIfStatements'],
'htdocs/comm/action/index.php' => ['PhanPluginSuspiciousParamPosition', 'PhanTypeArraySuspiciousNull', 'PhanTypeInvalidUnaryOperandNumeric'],
'htdocs/comm/action/pertype.php' => ['PhanPluginDuplicateIfStatements'],
'htdocs/comm/action/peruser.php' => ['PhanPluginDuplicateIfStatements'],
'htdocs/comm/mailing/card.php' => ['PhanPluginDuplicateIfStatements', 'PhanPluginSuspiciousParamPosition'],
'htdocs/comm/mailing/card.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/comm/mailing/cibles.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/comm/mailing/info.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/comm/propal/list.php' => ['PhanPluginDuplicateIfStatements'],
'htdocs/commande/list.php' => ['PhanPluginDuplicateIfStatements'],
'htdocs/compta/accounting-files.php' => ['PhanTypeInvalidUnaryOperandNumeric'],
'htdocs/compta/bank/various_payment/card.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/compta/bank/various_payment/document.php' => ['PhanPluginSuspiciousParamPosition'],
@ -59,7 +50,6 @@ return [
'htdocs/compta/cashcontrol/cashcontrol_card.php' => ['PhanPluginDuplicateExpressionBinaryOp'],
'htdocs/compta/facture/agenda-rec.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/compta/facture/card-rec.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/compta/facture/list.php' => ['PhanPluginDuplicateIfCondition'],
'htdocs/compta/prelevement/class/bonprelevement.class.php' => ['PhanParamTooMany'],
'htdocs/compta/prelevement/create.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/compta/sociales/class/paymentsocialcontribution.class.php' => ['PhanTypeInvalidUnaryOperandNumeric'],
@ -68,38 +58,33 @@ return [
'htdocs/compta/sociales/note.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/compta/tva/class/paymentvat.class.php' => ['PhanTypeInvalidUnaryOperandNumeric'],
'htdocs/compta/tva/document.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/core/actions_massactions.inc.php' => ['PhanPluginDuplicateIfStatements', 'PhanPluginSuspiciousParamOrder'],
'htdocs/core/actions_massactions.inc.php' => ['PhanPluginSuspiciousParamOrder'],
'htdocs/core/class/commondocgenerator.class.php' => ['PhanTypeArraySuspiciousNull'],
'htdocs/core/class/commonobject.class.php' => ['PhanPluginDuplicateIfCondition', 'PhanPluginDuplicateIfStatements', 'PhanPluginSuspiciousParamPosition'],
'htdocs/core/class/commonobject.class.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/core/class/evalmath.class.php' => ['PhanPluginUnsafeEval'],
'htdocs/core/class/html.form.class.php' => ['PhanPluginDuplicateIfStatements', 'PhanPluginSuspiciousParamPosition'],
'htdocs/core/class/html.form.class.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/core/class/html.formmail.class.php' => ['PhanNoopArray'],
'htdocs/core/class/rssparser.class.php' => ['PhanPluginDuplicateIfStatements', 'PhanUndeclaredFunctionInCallable'],
'htdocs/core/db/mysqli.class.php' => ['PhanParamSignatureMismatch', 'PhanPluginDuplicateIfStatements'],
'htdocs/core/class/rssparser.class.php' => ['PhanUndeclaredFunctionInCallable'],
'htdocs/core/db/mysqli.class.php' => ['PhanParamSignatureMismatch'],
'htdocs/core/db/pgsql.class.php' => ['PhanParamSignatureMismatch'],
'htdocs/core/db/sqlite3.class.php' => ['PhanParamSignatureMismatch'],
'htdocs/core/filemanagerdol/connectors/php/connector.lib.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/core/get_info.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/core/lib/files.lib.php' => ['PhanPluginDuplicateExpressionBinaryOp', 'PhanPluginDuplicateIfCondition'],
'htdocs/core/lib/ftp.lib.php' => ['PhanPluginDuplicateIfStatements'],
'htdocs/core/lib/functions.lib.php' => ['PhanParamTooMany', 'PhanPluginAlwaysReturnFunction', 'PhanPluginDuplicateIfCondition', 'PhanPluginUnsafeEval', 'PhanRedefineFunctionInternal'],
'htdocs/core/lib/files.lib.php' => ['PhanPluginDuplicateExpressionBinaryOp'],
'htdocs/core/lib/functions.lib.php' => ['PhanParamTooMany', 'PhanPluginAlwaysReturnFunction', 'PhanPluginUnsafeEval', 'PhanRedefineFunctionInternal'],
'htdocs/core/lib/price.lib.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/core/lib/usergroups.lib.php' => ['PhanNoopArrayAccess'],
'htdocs/core/menus/standard/auguria_menu.php' => ['PhanParamSuspiciousOrder', 'PhanPluginDuplicateIfStatements'],
'htdocs/core/menus/standard/eldy_menu.php' => ['PhanParamSuspiciousOrder', 'PhanPluginDuplicateIfStatements'],
'htdocs/core/menus/standard/empty.php' => ['PhanParamSuspiciousOrder', 'PhanPluginDuplicateIfStatements'],
'htdocs/core/menus/standard/auguria_menu.php' => ['PhanParamSuspiciousOrder'],
'htdocs/core/menus/standard/eldy_menu.php' => ['PhanParamSuspiciousOrder'],
'htdocs/core/menus/standard/empty.php' => ['PhanParamSuspiciousOrder'],
'htdocs/core/modules/barcode/mod_barcode_thirdparty_standard.php' => ['PhanParamSignatureMismatch'],
'htdocs/core/modules/import/import_xlsx.modules.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/core/modules/member/doc/pdf_standard.class.php' => ['PhanParamSignatureMismatch'],
'htdocs/core/modules/movement/doc/pdf_standard.modules.php' => ['PhanPluginDuplicateExpressionBinaryOp'],
'htdocs/core/modules/mrp/doc/pdf_vinci.modules.php' => ['PhanTypeArraySuspiciousNull'],
'htdocs/core/modules/societe/mod_codecompta_aquarium.php' => ['PhanPluginDuplicateIfStatements'],
'htdocs/core/modules/societe/modules_societe.class.php' => ['PhanPluginDuplicateIfCondition'],
'htdocs/core/modules/syslog/mod_syslog_file.php' => ['PhanParamSignatureMismatch', 'PhanParamSuspiciousOrder'],
'htdocs/core/modules/syslog/mod_syslog_syslog.php' => ['PhanParamSignatureMismatch'],
'htdocs/don/class/don.class.php' => ['PhanParamTooMany'],
'htdocs/ecm/index_auto.php' => ['PhanPluginDuplicateIfStatements'],
'htdocs/expensereport/card.php' => ['PhanPluginDuplicateIfStatements'],
'htdocs/expensereport/class/paymentexpensereport.class.php' => ['PhanTypeInvalidUnaryOperandNumeric'],
'htdocs/fourn/class/api_supplier_invoices.class.php' => ['PhanPluginSuspiciousParamOrder'],
'htdocs/fourn/facture/card-rec.php' => ['PhanPluginSuspiciousParamPosition'],
@ -114,8 +99,6 @@ return [
'htdocs/mrp/class/mo.class.php' => ['PhanParamSignatureMismatch'],
'htdocs/product/admin/product_tools.php' => ['PhanNoopStringLiteral'],
'htdocs/product/card.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/product/popuprop.php' => ['PhanPluginDuplicateIfStatements'],
'htdocs/product/stats/card.php' => ['PhanPluginDuplicateIfStatements'],
'htdocs/projet/tasks/list.php' => ['PhanTypeArraySuspiciousNull'],
'htdocs/public/bookcal/index.php' => ['PhanTypeInvalidUnaryOperandNumeric'],
'htdocs/public/opensurvey/index.php' => ['PhanPluginSuspiciousParamOrder'],
@ -126,7 +109,6 @@ return [
'htdocs/takepos/invoice.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/user/class/user.class.php' => ['PhanParamSignatureMismatch'],
'htdocs/variants/class/ProductCombination.class.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/webportal/class/html.formwebportal.class.php' => ['PhanPluginSuspiciousParamPosition'],
'internal' => ['PhanUndeclaredConstant'],
],
// 'directory_suppressions' => ['src/directory_name' => ['PhanIssueName1', 'PhanIssueName2']] can be manually added if needed.

View file

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*/
define('DOL_PROJECT_ROOT', __DIR__.'/../../..');
define('DOL_DOCUMENT_ROOT', DOL_PROJECT_ROOT.'/htdocs');
@ -54,7 +55,7 @@ $DEPRECATED_MODULE_MAPPING = array(
'commande' => 'order',
'contrat' => 'contract',
'entrepot' => 'stock',
'expedition' => 'delivery_note',
'expedition' => 'shipping',
'facture' => 'invoice',
'ficheinter' => 'intervention',
'product_fournisseur_price' => 'productsupplierprice',
@ -93,7 +94,7 @@ $VALID_MODULE_MAPPING = array(
'datapolicy' => 'DataPolicy',
'dav' => 'Dav',
'debugbar' => 'DebugBar',
'delivery_note' => 'Expedition',
'shipping' => 'Expedition',
'deplacement' => 'Deplacement',
"documentgeneration" => 'DocumentGeneration',
'don' => 'Don',
@ -228,14 +229,58 @@ return [
'simplify_ast' => true,
'analyzed_file_extensions' => ['php','inc'],
'globals_type_map' => [
'action' => 'string',
'actioncode' => 'string',
'badgeStatus0' => 'string',
'badgeStatus1' => 'string',
'badgeStatus11' => 'string',
'badgeStatus3' => 'string',
'badgeStatus4' => 'string',
'badgeStatus6' => 'string',
'badgeStatus8' => 'string',
'badgeStatus9' => 'string',
'classname' => 'string',
'conf' => '\Conf',
'conffile' => 'string',
'conffiletoshow' => 'string',
'conffiletoshowshort' => 'string',
'dateSelector' => 'int<0,1>',
'db' => '\DoliDB',
'disableedit' => 'int<0,1>',
'disablemove' => 'int<0,1>',
'disableremove' => 'int<0,1>',
'dolibarr_main_authentication' => 'string',
'dolibarr_main_data_root' => 'string',
'dolibarr_main_data_root' => 'string',
'dolibarr_main_db_encrypted_pass' => 'string',
'dolibarr_main_db_host' => 'string',
'dolibarr_main_db_pass' => 'string',
'dolibarr_main_demo' => 'string',
'dolibarr_main_document_root' => 'string',
'dolibarr_main_url_root' => 'string',
'errormsg' => 'string',
'extrafields' => '\ExtraFields',
'filter' => 'string',
'filtert' => 'int',
'forceall' => 'int<0,1>',
'form' => '\Form',
'hookmanager' => '\HookManager',
'inputalsopricewithtax' => 'int<0,1>',
'langs' => '\Translate',
'leftmenu' => 'string',
'mainmenu' => 'string',
'menumanager' => 'string',
'mysoc' => '\Societe',
'nblines' => '\int',
'obj' => '\CommonObject', // Deprecated
'object_rights' => 'int|stdClass',
'objectoffield' => '\CommonObject',
'senderissupplier' => 'int<0,1,2>',
'user' => '\User',
'website' => '\WebSite',
'websitepage' => '\WebSitePage',
'websitepagefile' => 'string',
// 'object' => '\CommonObject', // Deprecated, not enabled because conflicts with $object assignments
],
// Supported values: `'5.6'`, `'7.0'`, `'7.1'`, `'7.2'`, `'7.3'`, `'7.4'`, `null`.
@ -284,6 +329,7 @@ return [
.'|htdocs/includes/restler/.*' // @phpstan-ignore-line
// Included as stub (did not seem properly analysed by phan without it)
.'|htdocs/includes/stripe/.*' // @phpstan-ignore-line
.'|htdocs/conf/conf.php' // @phpstan-ignore-line
// .'|htdocs/[^h].*/.*' // For testing @phpstan-ignore-line
.')@', // @phpstan-ignore-line
@ -297,7 +343,7 @@ return [
// Alternately, you can pass in the full path to a PHP file
// with the plugin's implementation (e.g. 'vendor/phan/phan/.phan/plugins/AlwaysReturnPlugin.php')
'ParamMatchRegexPlugin' => [
'/^GETPOST$/' => [1, $sanitizeRegex],
'/^GETPOST$/' => [1, $sanitizeRegex, 'GetPostUnknownSanitizeType'],
'/^isModEnabled$/' => [0, $moduleNameRegex, 'UnknownModuleName'],
// Note: trick to have different key for same regex:
'/^isModEnable[d]$/' => [0, $deprecatedModuleNameRegex, "DeprecatedModuleName"],
@ -364,8 +410,7 @@ return [
'PhanDeprecatedProperty',
'PhanDeprecatedFunction',
//'PhanCompatibleNegativeStringOffset',
// Dolibarr has quite a few strange noop assignments like $abc=$abc;
'PhanPluginDuplicateExpressionAssignment',
// 'PhanPluginDuplicateExpressionAssignment',
// Nulls are likely mostly false positives
'PhanPluginConstantVariableNull',
'PhanTypeObjectUnsetDeclaredProperty',
@ -408,7 +453,7 @@ return [
'PhanTypeInvalidDimOffset',
// 'PhanPluginNoCommentOnProtectedProperty',
// 'PhanPluginDescriptionlessCommentOnPublicMethod',
'PhanPluginUnknownClosureParamType',
// 'PhanPluginUnknownClosureParamType',
'PhanPluginUnknownClosureReturnType',
// 'PhanPluginNoCommentOnProtectedMethod',
// 'PhanTypeArraySuspicious',
@ -420,9 +465,9 @@ return [
// 'PhanPluginNoCommentOnFunction',
'PhanPluginUnknownArrayFunctionParamType',
// 'PhanPluginDescriptionlessCommentOnPublicProperty',
'PhanPluginUnknownFunctionParamType',
// 'PhanPluginUnknownFunctionParamType', // Finds certain errors in PHPdoc typing
'PhanTypeSuspiciousStringExpression',
'PhanPluginRedundantAssignment',
// 'PhanPluginRedundantAssignment',
'PhanTypeExpectedObjectPropAccess',
'PhanTypeInvalidRightOperandOfNumericOp',
@ -430,14 +475,14 @@ return [
// 'PhanPluginUnknownFunctionReturnType',
// 'PhanPluginDescriptionlessCommentOnProtectedProperty',
'PhanPluginRedundantAssignmentInGlobalScope',
'PhanTypeMismatchDeclaredParamNullable',
// 'PhanTypeMismatchDeclaredParamNullable',
'PhanTypeInvalidRightOperandOfAdd',
// 'PhanPluginDescriptionlessCommentOnPrivateProperty',
// 'PhanUndeclaredVariableDim', // Array initialisation on undeclared var: $abc['x']='ab'
'PhanTypeInvalidPropertyName',
'PhanPluginDuplicateCatchStatementBody',
'PhanPluginUndeclaredVariableIsset',
'PhanTypeInvalidUnaryOperandIncOrDec',
// 'PhanTypeInvalidUnaryOperandIncOrDec',
// 'PhanPluginDescriptionlessCommentOnClass',
'PhanPluginEmptyStatementIf',
'PhanPluginInlineHTMLTrailing',
@ -448,7 +493,7 @@ return [
'PhanRedefineClass',
'PhanRedefineFunction',
'PhanTypeInvalidLeftOperandOfBitwiseOp',
'PhanTypeMismatchDimAssignment',
// 'PhanTypeMismatchDimAssignment',
// 'PhanPluginDescriptionlessCommentOnProtectedMethod',
'PhanPluginPrintfIncompatibleArgumentTypeWeak',
'PhanUndeclaredVariableAssignOp',
@ -482,7 +527,7 @@ return [
'PhanTypeMismatchBitwiseBinaryOperands',
'PhanTypeMismatchDimEmpty',
'PhanTypeSuspiciousEcho',
'PhanNoopBinaryOperator',
// 'PhanNoopBinaryOperator',
// 'PhanTypeInvalidBitwiseBinaryOperator',
// 'PhanPluginDescriptionlessCommentOnFunction',
'PhanPluginPHPDocInWrongComment',
@ -490,7 +535,8 @@ return [
// 'PhanTypeInvalidThrowsIsInterface',
// 'PhanPluginRedundantAssignmentInLoop',
// 'PhanInvalidCommentForDeclarationType',
//'PhanParamSignatureMismatchInternal',
// 'PhanParamSignatureMismatchInternal',
// 'PhanParamSignatureMismatch',
// 'PhanPluginEmptyStatementForeachLoop',
// 'PhanCompatibleDimAlternativeSyntax',
'PhanInvalidFQSENInClasslike',
@ -503,7 +549,7 @@ return [
// 'PhanSyntaxReturnValueInVoid',
// 'PhanTypeInstantiateTraitStaticOrSelf',
// 'PhanUndeclaredInvokeInCallable',
'PhanNoopProperty',
// 'PhanNoopProperty',
'PhanNoopVariable',
// 'PhanPluginPrintfUnusedArgument',
// 'PhanSyntaxReturnExpectedValue',
@ -523,7 +569,7 @@ return [
// 'PhanTypeMismatchDeclaredReturnNullable',
// 'PhanUndeclaredThis',
'PhanPluginMixedKeyNoKey',
// 'PhanPluginMixedKeyNoKey',
'PhanPluginDuplicateConditionalNullCoalescing', // Suggests to optimize to ??
//'PhanUnreferencedClosure', // False positives seen with closures in arrays, TODO: move closure checks closer to what is done by unused variable plugin
//'PhanPluginNoCommentOnProtectedMethod',
@ -540,7 +586,7 @@ return [
'PhanTypePossiblyInvalidDimOffset', // Also checks optional array keys and requires that they are checked for existence.
'PhanUndeclaredGlobalVariable',
'PhanUndeclaredProperty',
'PhanPluginPrintfNotPercent',
// 'PhanPluginPrintfNotPercent', // Detects fishy stuff with '%' format and suggests %%
'PhanPossiblyUndeclaredGlobalVariable',
// 'PhanPluginPossiblyStaticProtectedMethod',
'PhanTypeMismatchReturn',
@ -554,7 +600,7 @@ return [
'PhanUndeclaredClassMethod',
'PhanUndeclaredMethod',
'PhanTypeMismatchArgumentProbablyReal',
'PhanPluginDuplicateExpressionAssignmentOperation',
'PhanPluginDuplicateExpressionAssignmentOperation', // Suggestions for optimisation
'PhanTypeMismatchPropertyDefault',
// 'PhanPluginAlwaysReturnMethod',
// 'PhanPluginMissingReturnMethod',
@ -611,5 +657,4 @@ return [
'sockets' => PHAN_DIR . '/stubs/sockets.phan_php',
'zip' => PHAN_DIR . '/stubs/zip.phan_php',
],
];

View file

@ -54,7 +54,7 @@ $DEPRECATED_MODULE_MAPPING = array(
'commande' => 'order',
'contrat' => 'contract',
'entrepot' => 'stock',
'expedition' => 'delivery_note',
'expedition' => 'shipping',
'facture' => 'invoice',
'ficheinter' => 'intervention',
'product_fournisseur_price' => 'productsupplierprice',
@ -93,7 +93,7 @@ $VALID_MODULE_MAPPING = array(
'datapolicy' => 'DataPolicy',
'dav' => 'Dav',
'debugbar' => 'DebugBar',
'delivery_note' => 'Expedition',
'shipping' => 'Expedition',
'deplacement' => 'Deplacement',
"documentgeneration" => 'DocumentGeneration',
'don' => 'Don',
@ -206,6 +206,26 @@ return [
'mysoc' => '\Societe',
'nblines' => '\int',
'user' => '\User',
'dolibarr_main_data_root' => 'string',
'dolibarr_main_authentication' => 'string',
'dolibarr_main_demo' => 'string',
'menumanager' => 'string',
'errormsg' => 'string',
'form' => '\Form',
'object_rights' => 'int|stdClass',
'disableedit' => 'int<0,1>',
'disablemove' => 'int<0,1>',
'disableremove' => 'int<0,1>',
// Found in dol_eval
'website' => '\WebSite',
'websitepage' => '\WebSitePage',
'websitepagefile' => 'string',
'action' => 'string',
'mainmenu' => 'string',
'leftmenu' => 'string',
'objectoffield' => '\CommonObject',
// 'object' => '\CommonObject', // Deprecated, not enabled because conflicts with $object assignments
'obj' => '\CommonObject', // Deprecated
],
// Supported values: `'5.6'`, `'7.0'`, `'7.1'`, `'7.2'`, `'7.3'`, `'7.4'`, `null`.
@ -254,6 +274,7 @@ return [
.'|htdocs/includes/restler/.*' // @phpstan-ignore-line
// Included as stub (did not seem properly analysed by phan without it)
.'|htdocs/includes/stripe/.*' // @phpstan-ignore-line
.'|htdocs/conf/conf.php' // @phpstan-ignore-line
.')@', // @phpstan-ignore-line
// A list of plugin files to execute.
@ -266,11 +287,11 @@ return [
// Alternately, you can pass in the full path to a PHP file
// with the plugin's implementation (e.g. 'vendor/phan/phan/.phan/plugins/AlwaysReturnPlugin.php')
'ParamMatchRegexPlugin' => [
'/^GETPOST$/' => [1, $sanitizeRegex],
'/^GETPOST$/' => [1, $sanitizeRegex, 'GetPostUnknownSanitizeType'],
'/^isModEnabled$/' => [0, $moduleNameRegex, 'UnknownModuleName'],
// Note: trick to have different key for same regex:
'/^isModEnable[d]$/' => [0, $deprecatedModuleNameRegex, "DeprecatedModuleName"],
'/^sanitizeVal$/' => [1, $sanitizeRegex],
'/^sanitizeVal$/' => [1, $sanitizeRegex,"UnknownSanitizeType"],
],
'plugins' => [
__DIR__.'/plugins/NoVarDumpPlugin.php',
@ -347,6 +368,7 @@ return [
'PhanPluginDuplicateConditionalTernaryDuplication', // 2750+ occurrences
'PhanPluginDuplicateConditionalNullCoalescing', // Not essential - 990+ occurrences
'PhanPluginRedundantAssignmentInGlobalScope', // Not essential, a lot of false warning
'PhanPluginDuplicateCatchStatementBody', // Requires PHP7.1 - 50+ occurrences
],
// You can put relative paths to internal stubs in this config option.
// Phan will continue using its detailed type annotations,

View file

@ -1,4 +1,7 @@
<?php
/* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*/
// Uncomment require_once to enable corresponding fixer
@ -7,8 +10,6 @@
//require_once __DIR__.'/plugins/UrlEncodeStringifyFixer.php';
require_once __DIR__.'/plugins/SelectDateFixer.php';
/* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*/
define('DOL_PROJECT_ROOT', __DIR__.'/../../..');
define('DOL_DOCUMENT_ROOT', DOL_PROJECT_ROOT.'/htdocs');
define('PHAN_DIR', __DIR__);
@ -22,7 +23,7 @@ $DEPRECATED_MODULE_MAPPING = array(
'commande' => 'order',
'contrat' => 'contract',
'entrepot' => 'stock',
'expedition' => 'delivery_note',
'expedition' => 'shipping',
'facture' => 'invoice',
'ficheinter' => 'intervention',
'product_fournisseur_price' => 'productsupplierprice',
@ -103,6 +104,7 @@ return [
.'|htdocs/includes/restler/.*' // @phpstan-ignore-line
// Included as stub (did not seem properly analysed by phan without it)
.'|htdocs/includes/stripe/.*' // @phpstan-ignore-line
.'|htdocs/conf/conf.php' // @phpstan-ignore-line
//.'|htdocs/[^c][^o][^r][^e][^/].*' // For testing @phpstan-ignore-line
//.'|htdocs/[^h].*' // For testing on restricted set @phpstan-ignore-line
.')@', // @phpstan-ignore-line

View file

@ -36,7 +36,7 @@ call_user_func(static function (): void {
'commande' => 'order',
'contrat' => 'contract',
'entrepot' => 'stock',
'expedition' => 'delivery_note',
'expedition' => 'shipping',
'facture' => 'invoice',
'ficheinter' => 'intervention',
'product_fournisseur_price' => 'productsupplierprice',

View file

@ -129,7 +129,7 @@ $tabrowid[31] = "";
// List of help for fields
$tabhelp = array();
$tabhelp[31] = array('pcg_version'=>$langs->trans("EnterAnyCode"));
$tabhelp[31] = array('pcg_version' => $langs->trans("EnterAnyCode"));
// Define elementList and sourceList (used for dictionary type of contacts "llx_c_type_contact")
@ -191,10 +191,10 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) {
// Si verif ok et action add, on ajoute la ligne
if ($ok && GETPOST('actionadd', 'alpha')) {
$newid = 0;
if ($tabrowid[$id]) {
// Get free id for insert
$newid = 0;
$sql = "SELECT MAX(".$db->sanitize($tabrowid[$id]).") newid FROM ".$db->sanitize($tabname[$id]);
$sql = "SELECT MAX(".$db->sanitize($tabrowid[$id]).") as newid FROM ".$db->sanitize($tabname[$id]);
$result = $db->query($sql);
if ($result) {
$obj = $db->fetch_object($result);
@ -241,7 +241,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) {
$result = $db->query($sql);
if ($result) { // Add is ok
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
$_POST = array('id'=>$id); // Clean $_POST array, we keep only
$_POST = array('id' => $id); // Clean $_POST array, we keep only
} else {
if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors');
@ -353,7 +353,7 @@ print load_fiche_titre($titre, $linkback, 'title_accountancy');
// Confirmation de la suppression de la ligne
if ($action == 'delete') {
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.urlencode($page).'&' : '').'sortfield='.urlencode($sortfield).'&sortorder='.urlencode($sortorder).'&rowid='.urlencode($rowid).'&code='.urlencode($code).'&id='.urlencode($id), $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1);
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.urlencode((string) ($page)).'&' : '').'sortfield='.urlencode((string) ($sortfield)).'&sortorder='.urlencode((string) ($sortorder)).'&rowid='.urlencode((string) ($rowid)).'&code='.urlencode((string) ($code)).'&id='.urlencode((string) ($id)), $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1);
}
//var_dump($elementList);
@ -458,7 +458,7 @@ if ($id) {
}
$tmpaction = 'create';
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$parameters = array('fieldlist' => $fieldlist, 'tabname' => $tabname[$id]);
$reshook = $hookmanager->executeHooks('createDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error = $hookmanager->error;
$errors = $hookmanager->errors;
@ -486,9 +486,9 @@ if ($id) {
$num = $db->num_rows($resql);
$i = 0;
$param = '&id='.urlencode($id);
$param = '&id='.urlencode((string) ($id));
if ($search_country_id > 0) {
$param .= '&search_country_id='.urlencode($search_country_id);
$param .= '&search_country_id='.urlencode((string) ($search_country_id));
}
$paramwithsearch = $param;
if ($sortorder) {
@ -556,7 +556,7 @@ if ($id) {
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
$tmpaction = 'edit';
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$parameters = array('fieldlist' => $fieldlist, 'tabname' => $tabname[$id]);
$reshook = $hookmanager->executeHooks('editDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error = $hookmanager->error;
$errors = $hookmanager->errors;
@ -571,7 +571,7 @@ if ($id) {
print '</td>';
} else {
$tmpaction = 'view';
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$parameters = array('fieldlist' => $fieldlist, 'tabname' => $tabname[$id]);
$reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error = $hookmanager->error;
@ -718,7 +718,7 @@ function fieldListAccountModel($fieldlist, $obj = null, $tabname = '', $context
print '<td>';
}
if ($fieldlist[$field] == 'type_cdr') {
print $form->selectarray($fieldlist[$field], array(0=>$langs->trans('None'), 1=>$langs->trans('AtEndOfMonth'), 2=>$langs->trans('CurrentNext')), (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : ''));
print $form->selectarray($fieldlist[$field], array(0 => $langs->trans('None'), 1 => $langs->trans('AtEndOfMonth'), 2 => $langs->trans('CurrentNext')), (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : ''));
} else {
print $form->selectyesno($fieldlist[$field], (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : ''), 1);
}

View file

@ -461,7 +461,7 @@ $fieldlist = explode(',', $tabfield[$id]);
$param = '&id='.$id;
if ($search_country_id > 0) {
$param .= '&search_country_id='.urlencode($search_country_id);
$param .= '&search_country_id='.urlencode((string) ($search_country_id));
}
$paramwithsearch = $param;
if ($sortorder) {
@ -474,7 +474,7 @@ if (GETPOST('from', 'alpha')) {
$paramwithsearch .= '&from='.urlencode(GETPOST('from', 'alpha'));
}
if ($listlimit) {
$paramwithsearch .= '&listlimit='.urlencode(GETPOSTINT('listlimit'));
$paramwithsearch .= '&listlimit='.urlencode((string) (GETPOSTINT('listlimit')));
}
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">';

View file

@ -481,7 +481,7 @@ if ($id) {
$param = '&id='.((int) $id);
if ($search_country_id > 0) {
$param .= '&search_country_id='.urlencode($search_country_id);
$param .= '&search_country_id='.urlencode((string) ($search_country_id));
}
$paramwithsearch = $param;
if ($sortorder) {

View file

@ -5,6 +5,7 @@
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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
@ -206,7 +207,7 @@ if ($action == 'update') {
$sql_exists .= " WHERE fk_product = " . ((int) $productid) . " AND entity = " . ((int) $conf->entity);
$resql_exists = $db->query($sql_exists);
if (!$resql_exists) {
$msg .= '<div><span class="error">'.$langs->trans("ErrorDB").' : '.$langs->trans("Product").' '.$productid.' '.$langs->trans("NotVentilatedinAccount").' : id='.$accounting_account_id.'<br> <pre>'.$resql_exists.'</pre></span></div>';
$msg .= '<div><span class="error">'.$langs->trans("ErrorDB").' : '.$langs->trans("Product").' '.$productid.' '.$langs->trans("NotVentilatedinAccount").' : id='.$accounting_account_id.'<br> <pre>'.json_encode($resql_exists).'</pre></span></div>';
$ko++;
} else {
$nb_exists = $db->num_rows($resql_exists);
@ -422,7 +423,7 @@ if ($resql) {
$param .= '&limit='.((int) $limit);
}
if ($searchCategoryProductOperator == 1) {
$param .= "&search_category_product_operator=".urlencode($searchCategoryProductOperator);
$param .= "&search_category_product_operator=".urlencode((string) ($searchCategoryProductOperator));
}
foreach ($searchCategoryProductList as $searchCategoryProduct) {
$param .= "&search_category_product_list[]=".urlencode($searchCategoryProduct);

View file

@ -447,7 +447,7 @@ if ($action == 'create') {
print $langs->trans('Docdate');
print '</td>';
if ($action != 'editdate') {
print '<td class="right"><a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editdate&token='.newToken().'&piece_num='.urlencode($object->piece_num).'&mode='.urlencode($mode).'">'.img_edit($langs->transnoentitiesnoconv('SetDate'), 1).'</a></td>';
print '<td class="right"><a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editdate&token='.newToken().'&piece_num='.urlencode((string) ($object->piece_num)).'&mode='.urlencode((string) ($mode)).'">'.img_edit($langs->transnoentitiesnoconv('SetDate'), 1).'</a></td>';
}
print '</tr></table>';
print '</td><td colspan="3">';
@ -474,7 +474,7 @@ if ($action == 'create') {
print $langs->trans('Codejournal');
print '</td>';
if ($action != 'editjournal') {
print '<td class="right"><a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editjournal&token='.newToken().'&piece_num='.urlencode($object->piece_num).'&mode='.urlencode($mode).'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'</a></td>';
print '<td class="right"><a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editjournal&token='.newToken().'&piece_num='.urlencode((string) ($object->piece_num)).'&mode='.urlencode((string) ($mode)).'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'</a></td>';
}
print '</tr></table>';
print '</td><td>';
@ -501,7 +501,7 @@ if ($action == 'create') {
print $langs->trans('Piece');
print '</td>';
if ($action != 'editdocref') {
print '<td class="right"><a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editdocref&token='.newToken().'&piece_num='.urlencode($object->piece_num).'&mode='.urlencode($mode).'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'</a></td>';
print '<td class="right"><a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editdocref&token='.newToken().'&piece_num='.urlencode((string) ($object->piece_num)).'&mode='.urlencode((string) ($mode)).'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'</a></td>';
}
print '</tr></table>';
print '</td><td>';

View file

@ -189,21 +189,21 @@ if (!in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && !GE
$arrayfields = array(
't.piece_num'=>array('label'=>$langs->trans("TransactionNumShort"), 'checked'=>1),
't.code_journal'=>array('label'=>$langs->trans("Codejournal"), 'checked'=>1),
't.doc_date'=>array('label'=>$langs->trans("Docdate"), 'checked'=>1),
't.doc_ref'=>array('label'=>$langs->trans("Piece"), 'checked'=>1),
't.numero_compte'=>array('label'=>$langs->trans("AccountAccountingShort"), 'checked'=>1),
't.subledger_account'=>array('label'=>$langs->trans("SubledgerAccount"), 'checked'=>1),
't.label_operation'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
't.debit'=>array('label'=>$langs->trans("AccountingDebit"), 'checked'=>1),
't.credit'=>array('label'=>$langs->trans("AccountingCredit"), 'checked'=>1),
't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1),
't.date_creation'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0),
't.tms'=>array('label'=>$langs->trans("DateModification"), 'checked'=>0),
't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>1),
't.date_validated'=>array('label'=>$langs->trans("DateValidationAndLock"), 'checked'=>1, 'enabled'=>!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")),
't.import_key'=>array('label'=>$langs->trans("ImportId"), 'checked'=>0, 'position'=>1100),
't.piece_num' => array('label' => $langs->trans("TransactionNumShort"), 'checked' => 1),
't.code_journal' => array('label' => $langs->trans("Codejournal"), 'checked' => 1),
't.doc_date' => array('label' => $langs->trans("Docdate"), 'checked' => 1),
't.doc_ref' => array('label' => $langs->trans("Piece"), 'checked' => 1),
't.numero_compte' => array('label' => $langs->trans("AccountAccountingShort"), 'checked' => 1),
't.subledger_account' => array('label' => $langs->trans("SubledgerAccount"), 'checked' => 1),
't.label_operation' => array('label' => $langs->trans("Label"), 'checked' => 1),
't.debit' => array('label' => $langs->trans("AccountingDebit"), 'checked' => 1),
't.credit' => array('label' => $langs->trans("AccountingCredit"), 'checked' => 1),
't.lettering_code' => array('label' => $langs->trans("LetteringCode"), 'checked' => 1),
't.date_creation' => array('label' => $langs->trans("DateCreation"), 'checked' => 0),
't.tms' => array('label' => $langs->trans("DateModification"), 'checked' => 0),
't.date_export' => array('label' => $langs->trans("DateExport"), 'checked' => 1),
't.date_validated' => array('label' => $langs->trans("DateValidationAndLock"), 'checked' => 1, 'enabled' => !getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")),
't.import_key' => array('label' => $langs->trans("ImportId"), 'checked' => 0, 'position' => 1100),
);
if (!getDolGlobalString('ACCOUNTING_ENABLE_LETTERING')) {
@ -244,7 +244,7 @@ if (!GETPOST('confirmmassaction', 'alpha')) {
$massaction = '';
}
$parameters = array('socid'=>$socid);
$parameters = array('socid' => $socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@ -353,7 +353,7 @@ if (empty($reshook)) {
}
}
$filter['t.search_accounting_code_in'] = implode(',', $listofaccountsforgroup2);
$param .= '&search_account_category='.urlencode($search_account_category);
$param .= '&search_account_category='.urlencode((string) ($search_account_category));
}
if (!empty($search_accountancy_code)) {
$filter['t.numero_compte'] = $search_accountancy_code;
@ -395,7 +395,7 @@ if (empty($reshook)) {
}
if (!empty($search_mvt_num)) {
$filter['t.piece_num'] = $search_mvt_num;
$param .= '&search_mvt_num='.urlencode($search_mvt_num);
$param .= '&search_mvt_num='.urlencode((string) ($search_mvt_num));
}
if (!empty($search_date_creation_start)) {
$filter['t.date_creation>='] = $search_date_creation_start;
@ -528,25 +528,45 @@ $sqlwhere = array();
if (count($filter) > 0) {
foreach ($filter as $key => $value) {
if ($key == 't.doc_date') {
$sqlwhere[] = $key."='".$db->idate($value)."'";
} elseif ($key == 't.doc_date>=' || $key == 't.doc_date<=') {
$sqlwhere[] = $key."'".$db->idate($value)."'";
} elseif ($key == 't.numero_compte>=' || $key == 't.numero_compte<=' || $key == 't.subledger_account>=' || $key == 't.subledger_account<=') {
$sqlwhere[] = $key."'".$db->escape($value)."'";
$sqlwhere[] = $db->sanitize($key)." = '".$db->idate($value)."'";
} elseif ($key == 't.doc_date>=') {
$sqlwhere[] = "t.doc_date >= '".$db->idate($value)."'";
} elseif ($key == 't.doc_date<=') {
$sqlwhere[] = "t.doc_date <= '".$db->idate($value)."'";
} elseif ($key == 't.doc_date>') {
$sqlwhere[] = "t.doc_date > '".$db->idate($value)."'";
} elseif ($key == 't.doc_date<') {
$sqlwhere[] = "t.doc_date < '".$db->idate($value)."'";
} elseif ($key == 't.numero_compte>=') {
$sqlwhere[] = "t.numero_compte >= '".$db->escape($value)."'";
} elseif ($key == 't.numero_compte<=') {
$sqlwhere[] = "t.numero_compte <= '".$db->escape($value)."'";
} elseif ($key == 't.subledger_account>=') {
$sqlwhere[] = "t.subledger_account >= '".$db->escape($value)."'";
} elseif ($key == 't.subledger_account<=') {
$sqlwhere[] = "t.subledger_account <= '".$db->escape($value)."'";
} elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') {
$sqlwhere[] = $key.'='.((int) $value);
$sqlwhere[] = $db->sanitize($key).'='.((int) $value);
} elseif ($key == 't.subledger_account' || $key == 't.numero_compte') {
$sqlwhere[] = $key." LIKE '".$db->escape($value)."%'";
$sqlwhere[] = $db->sanitize($key)." LIKE '".$db->escape($db->escapeforlike($value))."%'";
} elseif ($key == 't.subledger_account') {
$sqlwhere[] = natural_search($key, $value, 0, 1);
} elseif ($key == 't.date_creation>=' || $key == 't.date_creation<=') {
$sqlwhere[] = $key."'".$db->idate($value)."'";
} elseif ($key == 't.tms>=' || $key == 't.tms<=') {
$sqlwhere[] = $key."'".$db->idate($value)."'";
} elseif ($key == 't.date_export>=' || $key == 't.date_export<=') {
$sqlwhere[] = $key."'".$db->idate($value)."'";
} elseif ($key == 't.date_validated>=' || $key == 't.date_validated<=') {
$sqlwhere[] = $key."'".$db->idate($value)."'";
} elseif ($key == 't.tms>=') {
$sqlwhere[] = "t.tms >= '".$db->idate($value)."'";
} elseif ($key == 't.tms<=') {
$sqlwhere[] = "t.tms <= '".$db->idate($value)."'";
} elseif ($key == 't.date_creation>=') {
$sqlwhere[] = "t.date_creation >= '".$db->idate($value)."'";
} elseif ($key == 't.date_creation<=') {
$sqlwhere[] = "t.date_creation <= '".$db->idate($value)."'";
} elseif ($key == 't.date_export>=') {
$sqlwhere[] = "t.date_export >= '".$db->idate($value)."'";
} elseif ($key == 't.date_export<=') {
$sqlwhere[] = "t.date_export <= '".$db->idate($value)."'";
} elseif ($key == 't.date_validated>=') {
$sqlwhere[] = "t;date_validate >= '".$db->idate($value)."'";
} elseif ($key == 't.date_validated<=') {
$sqlwhere[] = "t;date_validate <= '".$db->idate($value)."'";
} elseif ($key == 't.credit' || $key == 't.debit') {
$sqlwhere[] = natural_search($key, $value, 1, 1);
} elseif ($key == 't.reconciled_option') {
@ -758,7 +778,7 @@ $arrayofselected = is_array($toselect) ? $toselect : array();
// Output page
// --------------------------------------------------------------------
$help_url ='EN:Module_Double_Entry_Accounting#Exports|FR:Module_Comptabilit&eacute;_en_Partie_Double#Exports';
$help_url = 'EN:Module_Double_Entry_Accounting#Exports|FR:Module_Comptabilit&eacute;_en_Partie_Double#Exports';
llxHeader('', $title_page, $help_url);
@ -776,7 +796,7 @@ if ($action == 'export_file') {
'morecss' => 'minwidth200 maxwidth200'
);
$form_question['separator0'] = array('name'=>'separator0', 'type'=>'separator');
$form_question['separator0'] = array('name' => 'separator0', 'type' => 'separator');
if (getDolGlobalInt("ACCOUNTING_ENABLE_LETTERING")) {
// If 1, we check by default.
@ -788,7 +808,7 @@ if ($action == 'export_file') {
'value' => $checked,
);
$form_question['separator1'] = array('name'=>'separator1', 'type'=>'separator');
$form_question['separator1'] = array('name' => 'separator1', 'type' => 'separator');
}
// If 1 or not set, we check by default.
@ -800,7 +820,7 @@ if ($action == 'export_file') {
'value' => (getDolGlobalString('ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE') ? 'false' : 'true'),
);
$form_question['separator2'] = array('name'=>'separator2', 'type'=>'separator');
$form_question['separator2'] = array('name' => 'separator2', 'type' => 'separator');
if (!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")) {
// If 0 or not set, we NOT check by default.
@ -812,7 +832,7 @@ if ($action == 'export_file') {
'value' => $checked,
);
$form_question['separator3'] = array('name'=>'separator3', 'type'=>'separator');
$form_question['separator3'] = array('name' => 'separator3', 'type' => 'separator');
}
// add documents in an archive for accountancy export (Quadratus)
@ -1016,7 +1036,7 @@ if (!empty($arrayfields['t.lettering_code']['checked'])) {
}
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields);
$parameters = array('arrayfields' => $arrayfields);
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
@ -1113,7 +1133,7 @@ if (!empty($arrayfields['t.lettering_code']['checked'])) {
print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, '', $sortfield, $sortorder, 'center ');
}
// Hook fields
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (!empty($arrayfields['t.date_creation']['checked'])) {
@ -1363,7 +1383,7 @@ while ($i < min($num, $limit)) {
}
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$parameters = array('arrayfields' => $arrayfields, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
@ -1442,7 +1462,7 @@ if ($num == 0) {
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
}
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;

View file

@ -184,21 +184,21 @@ if (!in_array($action, array('delmouv', 'delmouvconfirm')) && !GETPOSTISSET('beg
$arrayfields = array(
't.piece_num'=>array('label'=>$langs->trans("TransactionNumShort"), 'checked'=>1),
't.code_journal'=>array('label'=>$langs->trans("Codejournal"), 'checked'=>1),
't.doc_date'=>array('label'=>$langs->trans("Docdate"), 'checked'=>1),
't.doc_ref'=>array('label'=>$langs->trans("Piece"), 'checked'=>1),
't.numero_compte'=>array('label'=>$langs->trans("AccountAccountingShort"), 'checked'=>1),
't.subledger_account'=>array('label'=>$langs->trans("SubledgerAccount"), 'checked'=>1),
't.label_operation'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
't.debit'=>array('label'=>$langs->trans("AccountingDebit"), 'checked'=>1),
't.credit'=>array('label'=>$langs->trans("AccountingCredit"), 'checked'=>1),
't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1),
't.date_creation'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0),
't.tms'=>array('label'=>$langs->trans("DateModification"), 'checked'=>0),
't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>0),
't.date_validated'=>array('label'=>$langs->trans("DateValidationAndLock"), 'checked'=>0, 'enabled'=>!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")),
't.import_key'=>array('label'=>$langs->trans("ImportId"), 'checked'=>0, 'position'=>1100),
't.piece_num' => array('label' => $langs->trans("TransactionNumShort"), 'checked' => 1),
't.code_journal' => array('label' => $langs->trans("Codejournal"), 'checked' => 1),
't.doc_date' => array('label' => $langs->trans("Docdate"), 'checked' => 1),
't.doc_ref' => array('label' => $langs->trans("Piece"), 'checked' => 1),
't.numero_compte' => array('label' => $langs->trans("AccountAccountingShort"), 'checked' => 1),
't.subledger_account' => array('label' => $langs->trans("SubledgerAccount"), 'checked' => 1),
't.label_operation' => array('label' => $langs->trans("Label"), 'checked' => 1),
't.debit' => array('label' => $langs->trans("AccountingDebit"), 'checked' => 1),
't.credit' => array('label' => $langs->trans("AccountingCredit"), 'checked' => 1),
't.lettering_code' => array('label' => $langs->trans("LetteringCode"), 'checked' => 1),
't.date_creation' => array('label' => $langs->trans("DateCreation"), 'checked' => 0),
't.tms' => array('label' => $langs->trans("DateModification"), 'checked' => 0),
't.date_export' => array('label' => $langs->trans("DateExport"), 'checked' => 0),
't.date_validated' => array('label' => $langs->trans("DateValidationAndLock"), 'checked' => 0, 'enabled' => !getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")),
't.import_key' => array('label' => $langs->trans("ImportId"), 'checked' => 0, 'position' => 1100),
);
if (!getDolGlobalString('ACCOUNTING_ENABLE_LETTERING')) {
@ -232,7 +232,7 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'preunletteringauto
$massaction = '';
}
$parameters = array('socid'=>$socid);
$parameters = array('socid' => $socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@ -341,7 +341,7 @@ if (empty($reshook)) {
}
}
$filter['t.search_accounting_code_in'] = implode(',', $listofaccountsforgroup2);
$param .= '&search_account_category='.urlencode($search_account_category);
$param .= '&search_account_category='.urlencode((string) ($search_account_category));
}
if (!empty($search_accountancy_code)) {
$filter['t.numero_compte'] = $search_accountancy_code;
@ -383,7 +383,7 @@ if (empty($reshook)) {
}
if (!empty($search_mvt_num)) {
$filter['t.piece_num'] = $search_mvt_num;
$param .= '&search_mvt_num='.urlencode($search_mvt_num);
$param .= '&search_mvt_num='.urlencode((string) ($search_mvt_num));
}
if (!empty($search_date_creation_start)) {
$filter['t.date_creation>='] = $search_date_creation_start;
@ -484,7 +484,7 @@ if (empty($reshook)) {
setEventMessages($object->error, $object->errors, 'errors');
$error++;
break;
} elseif (isset($object->date_validation) || $object->date_validation != '') {
} elseif (isset($object->date_validation) && $object->date_validation != '') {
setEventMessages($langs->trans("ValidatedRecordWhereFound"), null, 'errors');
$error++;
break;
@ -620,25 +620,45 @@ $sqlwhere = array();
if (count($filter) > 0) {
foreach ($filter as $key => $value) {
if ($key == 't.doc_date') {
$sqlwhere[] = $key."='".$db->idate($value)."'";
} elseif ($key == 't.doc_date>=' || $key == 't.doc_date<=') {
$sqlwhere[] = $key."'".$db->idate($value)."'";
} elseif ($key == 't.numero_compte>=' || $key == 't.numero_compte<=' || $key == 't.subledger_account>=' || $key == 't.subledger_account<=') {
$sqlwhere[] = $key."'".$db->escape($value)."'";
$sqlwhere[] = $db->sanitize($key)." = '".$db->idate($value)."'";
} elseif ($key == 't.doc_date>=') {
$sqlwhere[] = "t.doc_date >= '".$db->idate($value)."'";
} elseif ($key == 't.doc_date<=') {
$sqlwhere[] = "t.doc_date <= '".$db->idate($value)."'";
} elseif ($key == 't.doc_date>') {
$sqlwhere[] = "t.doc_date > '".$db->idate($value)."'";
} elseif ($key == 't.doc_date<') {
$sqlwhere[] = "t.doc_date < '".$db->idate($value)."'";
} elseif ($key == 't.numero_compte>=') {
$sqlwhere[] = "t.numero_compte >= '".$db->escape($value)."'";
} elseif ($key == 't.numero_compte<=') {
$sqlwhere[] = "t.numero_compte <= '".$db->escape($value)."'";
} elseif ($key == 't.subledger_account>=') {
$sqlwhere[] = "t.subledger_account >= '".$db->escape($value)."'";
} elseif ($key == 't.subledger_account<=') {
$sqlwhere[] = "t.subledger_account <= '".$db->escape($value)."'";
} elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') {
$sqlwhere[] = $key.'='.((int) $value);
$sqlwhere[] = $db->sanitize($key).' = '.((int) $value);
} elseif ($key == 't.subledger_account' || $key == 't.numero_compte') {
$sqlwhere[] = $key." LIKE '".$db->escape($value)."%'";
$sqlwhere[] = $db->sanitize($key)." LIKE '".$db->escape($db->escapeforlike($value))."%'";
} elseif ($key == 't.subledger_account') {
$sqlwhere[] = natural_search($key, $value, 0, 1);
} elseif ($key == 't.date_creation>=' || $key == 't.date_creation<=') {
$sqlwhere[] = $key."'".$db->idate($value)."'";
} elseif ($key == 't.tms>=' || $key == 't.tms<=') {
$sqlwhere[] = $key."'".$db->idate($value)."'";
} elseif ($key == 't.date_export>=' || $key == 't.date_export<=') {
$sqlwhere[] = $key."'".$db->idate($value)."'";
} elseif ($key == 't.date_validated>=' || $key == 't.date_validated<=') {
$sqlwhere[] = $key."'".$db->idate($value)."'";
} elseif ($key == 't.tms>=') {
$sqlwhere[] = "t.tms >= '".$db->idate($value)."'";
} elseif ($key == 't.tms<=') {
$sqlwhere[] = "t.tms <= '".$db->idate($value)."'";
} elseif ($key == 't.date_creation>=') {
$sqlwhere[] = "t.date_creation >= '".$db->idate($value)."'";
} elseif ($key == 't.date_creation<=') {
$sqlwhere[] = "t.date_creation <= '".$db->idate($value)."'";
} elseif ($key == 't.date_export>=') {
$sqlwhere[] = "t.date_export >= '".$db->idate($value)."'";
} elseif ($key == 't.date_export<=') {
$sqlwhere[] = "t.date_export <= '".$db->idate($value)."'";
} elseif ($key == 't.date_validated>=') {
$sqlwhere[] = "t;date_validate >= '".$db->idate($value)."'";
} elseif ($key == 't.date_validated<=') {
$sqlwhere[] = "t;date_validate <= '".$db->idate($value)."'";
} elseif ($key == 't.credit' || $key == 't.debit') {
$sqlwhere[] = natural_search($key, $value, 1, 1);
} elseif ($key == 't.reconciled_option') {
@ -916,7 +936,7 @@ if (!empty($arrayfields['t.lettering_code']['checked'])) {
}
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields);
$parameters = array('arrayfields' => $arrayfields);
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
@ -1013,7 +1033,7 @@ if (!empty($arrayfields['t.lettering_code']['checked'])) {
print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, '', $sortfield, $sortorder, 'center ');
}
// Hook fields
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (!empty($arrayfields['t.date_creation']['checked'])) {
@ -1263,7 +1283,7 @@ while ($i < min($num, $limit)) {
}
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$parameters = array('arrayfields' => $arrayfields, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
@ -1342,7 +1362,7 @@ if ($num == 0) {
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
}
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;

View file

@ -159,18 +159,18 @@ if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('searc
$arrayfields = array(
// 't.subledger_account'=>array('label'=>$langs->trans("SubledgerAccount"), 'checked'=>1),
't.piece_num'=>array('label'=>$langs->trans("TransactionNumShort"), 'checked'=>1),
't.code_journal'=>array('label'=>$langs->trans("Codejournal"), 'checked'=>1),
't.doc_date'=>array('label'=>$langs->trans("Docdate"), 'checked'=>1),
't.doc_ref'=>array('label'=>$langs->trans("Piece"), 'checked'=>1),
't.label_operation'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
't.lettering_code'=>array('label'=>$langs->trans("Lettering"), 'checked'=>1),
't.debit'=>array('label'=>$langs->trans("AccountingDebit"), 'checked'=>1),
't.credit'=>array('label'=>$langs->trans("AccountingCredit"), 'checked'=>1),
't.balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1),
't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>-1),
't.date_validated'=>array('label'=>$langs->trans("DateValidation"), 'checked'=>-1, 'enabled'=>!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")),
't.import_key'=>array('label'=>$langs->trans("ImportId"), 'checked'=>-1, 'position'=>1100),
't.piece_num' => array('label' => $langs->trans("TransactionNumShort"), 'checked' => 1),
't.code_journal' => array('label' => $langs->trans("Codejournal"), 'checked' => 1),
't.doc_date' => array('label' => $langs->trans("Docdate"), 'checked' => 1),
't.doc_ref' => array('label' => $langs->trans("Piece"), 'checked' => 1),
't.label_operation' => array('label' => $langs->trans("Label"), 'checked' => 1),
't.lettering_code' => array('label' => $langs->trans("Lettering"), 'checked' => 1),
't.debit' => array('label' => $langs->trans("AccountingDebit"), 'checked' => 1),
't.credit' => array('label' => $langs->trans("AccountingCredit"), 'checked' => 1),
't.balance' => array('label' => $langs->trans("Balance"), 'checked' => 1),
't.date_export' => array('label' => $langs->trans("DateExport"), 'checked' => -1),
't.date_validated' => array('label' => $langs->trans("DateValidation"), 'checked' => -1, 'enabled' => !getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")),
't.import_key' => array('label' => $langs->trans("ImportId"), 'checked' => -1, 'position' => 1100),
);
if (!getDolGlobalString('ACCOUNTING_ENABLE_LETTERING')) {
@ -217,7 +217,7 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'preunletteringauto
$massaction = '';
}
$parameters = array('socid'=>$socid);
$parameters = array('socid' => $socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@ -296,7 +296,7 @@ if (empty($reshook)) {
}
}
$filter['t.search_accounting_code_in'] = implode(',', $listofaccountsforgroup2);
$param .= '&search_account_category='.urlencode($search_account_category);
$param .= '&search_account_category='.urlencode((string) ($search_account_category));
}
if (!empty($search_accountancy_code_start)) {
if ($type == 'sub') {
@ -320,7 +320,7 @@ if (empty($reshook)) {
}
if (!empty($search_mvt_num)) {
$filter['t.piece_num'] = $search_mvt_num;
$param .= '&search_mvt_num='.urlencode($search_mvt_num);
$param .= '&search_mvt_num='.urlencode((string) ($search_mvt_num));
}
if (!empty($search_doc_ref)) {
$filter['t.doc_ref'] = $search_doc_ref;
@ -447,7 +447,7 @@ if (empty($reshook)) {
setEventMessages($object->error, $object->errors, 'errors');
$error++;
break;
} elseif (isset($object->date_validation) || $object->date_validation != '') {
} elseif (isset($object->date_validation) && $object->date_validation != '') {
setEventMessages($langs->trans("ValidatedRecordWhereFound"), null, 'errors');
$error++;
break;
@ -897,7 +897,7 @@ if (!empty($arrayfields['t.import_key']['checked'])) {
}
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields);
$parameters = array('arrayfields' => $arrayfields);
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
@ -951,7 +951,7 @@ if (!empty($arrayfields['t.import_key']['checked'])) {
print_liste_field_titre($arrayfields['t.import_key']['label'], $_SERVER["PHP_SELF"], "t.import_key", "", $param, '', $sortfield, $sortorder, 'center ');
}
// Hook fields
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
@ -1071,7 +1071,7 @@ while ($i < min($num, $limit)) {
// Show the break account
print '<tr class="trforbreak">';
print '<td colspan="'.($totalarray['nbfield'] ? $totalarray['nbfield'] : count($arrayfields)+1).'" class="tdforbreak">';
print '<td colspan="'.($totalarray['nbfield'] ? $totalarray['nbfield'] : count($arrayfields) + 1).'" class="tdforbreak">';
if ($type == 'sub') {
if ($line->subledger_account != "" && $line->subledger_account != '-1') {
print empty($line->subledger_label) ? '<span class="error">'.$langs->trans("Unknown").'</span>' : $line->subledger_label;
@ -1227,7 +1227,7 @@ while ($i < min($num, $limit)) {
if (strlen(length_accounta($line->subledger_account)) == 0) {
print '<td class="small tdoverflowmax350 classfortooltip" title="'.dol_escape_htmltag($line->label_operation).'">'.dol_escape_htmltag($line->label_operation).'</td>';
} else {
print '<td class="small tdoverflowmax350 classfortooltip" title="'.dol_escape_htmltag($line->label_operation.($line->label_operation?'<br>':'').'<span style="font-size:0.8em">('.length_accounta($line->subledger_account).')').'">'.dol_escape_htmltag($line->label_operation).($line->label_operation?'<br>':'').'<span style="font-size:0.8em">('.dol_escape_htmltag(length_accounta($line->subledger_account)).')</span></td>';
print '<td class="small tdoverflowmax350 classfortooltip" title="'.dol_escape_htmltag($line->label_operation.($line->label_operation ? '<br>' : '').'<span style="font-size:0.8em">('.length_accounta($line->subledger_account).')').'">'.dol_escape_htmltag($line->label_operation).($line->label_operation ? '<br>' : '').'<span style="font-size:0.8em">('.dol_escape_htmltag(length_accounta($line->subledger_account)).')</span></td>';
}
if (!$i) {
$totalarray['nbfield']++;
@ -1302,7 +1302,7 @@ while ($i < min($num, $limit)) {
}
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$line);
$parameters = array('arrayfields' => $arrayfields, 'obj' => $line);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
@ -1387,7 +1387,7 @@ if ($num == 0) {
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
}
$parameters = array('arrayfields'=>$arrayfields);
$parameters = array('arrayfields' => $arrayfields);
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;

View file

@ -14,6 +14,7 @@
* Copyright (C) 2020 Guillaume Alexandre <guillaume@tag-info.fr>
* Copyright (C) 2022 Joachim Kueter <jkueter@gmx.de>
* Copyright (C) 2022 Progiseize <a.bisotti@progiseize.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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
@ -277,7 +278,7 @@ class AccountancyExport
'ACCOUNTING_EXPORT_FORMAT' => 'csv',
),
),
'cr'=> array(
'cr' => array(
'1' => $langs->trans("Unix"),
'2' => $langs->trans("Windows")
),
@ -302,8 +303,6 @@ class AccountancyExport
*/
public function getMimeType($formatexportset)
{
$mime = 'text/csv';
switch ($formatexportset) {
case self::$EXPORT_TYPE_FEC:
$mime = 'text/tab-separated-values';
@ -346,7 +345,7 @@ class AccountancyExport
$exportFile = null;
$exportFileName = '';
$exportFilePath = '';
$exportFileFullName ='';
$exportFileFullName = '';
$downloadFileMimeType = '';
$downloadFileFullName = '';
$downloadFilePath = '';
@ -1000,7 +999,7 @@ class AccountancyExport
$invoice = new FactureFournisseur($this->db);
$invoice->fetch($line->fk_doc);
$objectDirPath = !empty($conf->fournisseur->facture->multidir_output[$conf->entity]) ? $conf->fournisseur->facture->multidir_output[$conf->entity] : $conf->fournisseur->facture->dir_output;
$objectDirPath.= '/'.rtrim(get_exdir($invoice->id, 2, 0, 0, $invoice, 'invoice_supplier'), '/');
$objectDirPath .= '/'.rtrim(get_exdir($invoice->id, 2, 0, 0, $invoice, 'invoice_supplier'), '/');
}
$arrayofinclusion = array();
// If it is a supplier invoice, we want to use last uploaded file
@ -1466,7 +1465,7 @@ class AccountancyExport
$objectDirPath = !empty($conf->expensereport->multidir_output[$conf->entity]) ? $conf->expensereport->multidir_output[$conf->entity] : $conf->expensereport->dir_output;
} elseif ($line->doc_type == 'supplier_invoice') {
$objectDirPath = !empty($conf->fournisseur->facture->multidir_output[$conf->entity]) ? $conf->fournisseur->facture->multidir_output[$conf->entity] : $conf->fournisseur->facture->dir_output;
$objectDirPath.= '/'.rtrim(get_exdir($invoice->id, 2, 0, 0, $invoice, 'invoice_supplier'), '/');
$objectDirPath .= '/'.rtrim(get_exdir($invoice->id, 2, 0, 0, $invoice, 'invoice_supplier'), '/');
}
$arrayofinclusion = array();
// If it is a supplier invoice, we want to use last uploaded file
@ -1678,7 +1677,7 @@ class AccountancyExport
$objectDirPath = !empty($conf->expensereport->multidir_output[$conf->entity]) ? $conf->expensereport->multidir_output[$conf->entity] : $conf->expensereport->dir_output;
} elseif ($line->doc_type == 'supplier_invoice') {
$objectDirPath = !empty($conf->fournisseur->facture->multidir_output[$conf->entity]) ? $conf->fournisseur->facture->multidir_output[$conf->entity] : $conf->fournisseur->facture->dir_output;
$objectDirPath.= '/'.rtrim(get_exdir($invoice->id, 2, 0, 0, $invoice, 'invoice_supplier'), '/');
$objectDirPath .= '/'.rtrim(get_exdir($invoice->id, 2, 0, 0, $invoice, 'invoice_supplier'), '/');
}
$arrayofinclusion = array();
// If it is a supplier invoice, we want to use last uploaded file
@ -1789,7 +1788,7 @@ class AccountancyExport
&& $objectLines[$aIndex + 1]->piece_num == $line->piece_num
&& $aIndex - 1 < $aSize
&& $objectLines[$aIndex - 1]->piece_num == $line->piece_num
) {
) {
$sammelBuchung = true;
}

View file

@ -5,6 +5,7 @@
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -501,7 +502,7 @@ class AccountingAccount extends CommonObject
$url = DOL_URL_ROOT . '/accountancy/bookkeeping/list.php?search_accountancy_code_start=' . urlencode($this->account_number) . '&search_accountancy_code_end=' . urlencode($this->account_number);
$labelurl = $langs->trans("ShowAccountingAccountInJournals");
} elseif ($option == 'accountcard') {
$url = DOL_URL_ROOT . '/accountancy/admin/card.php?id=' . urlencode($this->id);
$url = DOL_URL_ROOT . '/accountancy/admin/card.php?id=' . urlencode((string) ($this->id));
$labelurl = $langs->trans("ShowAccountingAccount");
}
@ -570,7 +571,7 @@ class AccountingAccount extends CommonObject
}
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$parameters = array('id' => $this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
@ -745,7 +746,7 @@ class AccountingAccount extends CommonObject
$hookmanager->initHooks(array('accountancyBindingCalculation'));
// Execute hook accountancyBindingCalculation
$parameters = array('buyer' => $buyer, 'seller' => $seller, 'product' => $product, 'facture' => $facture, 'factureDet' => $factureDet ,'accountingAccount'=>$accountingAccount, $type);
$parameters = array('buyer' => $buyer, 'seller' => $seller, 'product' => $product, 'facture' => $facture, 'factureDet' => $factureDet ,'accountingAccount' => $accountingAccount, 0 => $type);
$reshook = $hookmanager->executeHooks('accountancyBindingCalculation', $parameters); // Note that $action and $object may have been modified by some hooks
if (empty($reshook)) {
@ -769,11 +770,11 @@ class AccountingAccount extends CommonObject
if ($factureDet->product_type == 1) {
if ($buyer->country_code == $seller->country_code || empty($buyer->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
$code_l = getDolGlobalString('ACCOUNTING_SERVICE_' . $const_name . '_ACCOUNT');
// @phan-suppress-next-line PhanPluginRedundantAssignment
$suggestedaccountingaccountbydefaultfor = '';
} else {
if ($isSellerInEEC && $isBuyerInEEC && $factureDet->tva_tx != 0) { // European intravat sale, but with a VAT
$code_l = getDolGlobalString('ACCOUNTING_SERVICE_' . $const_name . '_ACCOUNT');
$suggestedaccountingaccountbydefaultfor = 'eecwithvat';
} elseif ($isSellerInEEC && $isBuyerInEEC && empty($buyer->tva_intra)) { // European intravat sale, without VAT intra community number
$code_l = getDolGlobalString('ACCOUNTING_SERVICE_' . $const_name . '_ACCOUNT');
$suggestedaccountingaccountbydefaultfor = 'eecwithoutvatnumber';
@ -788,6 +789,7 @@ class AccountingAccount extends CommonObject
} elseif ($factureDet->product_type == 0) {
if ($buyer->country_code == $seller->country_code || empty($buyer->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
$code_l = getDolGlobalString('ACCOUNTING_PRODUCT_' . $const_name . '_ACCOUNT');
// @phan-suppress-next-line PhanPluginRedundantAssignment
$suggestedaccountingaccountbydefaultfor = '';
} else {
if ($isSellerInEEC && $isBuyerInEEC && $factureDet->tva_tx != 0) { // European intravat sale, but with a VAT

View file

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2017-2022 OpenDSI <support@open-dsi.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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
@ -161,33 +162,47 @@ class AccountingJournal extends CommonObject
/**
* Load object in memory from the database
*
* @param string $sortorder Sort Order
* @param string $sortfield Sort field
* @param int $limit limit
* @param int $offset offset limit
* @param array $filter filter array
* @param string $filtermode filter mode (AND or OR)
* @return int Return integer <0 if KO, >0 if OK
* @param string $sortorder Sort Order
* @param string $sortfield Sort field
* @param int $limit limit
* @param int $offset offset limit
* @param string|array $filter filter array
* @param string $filtermode filter mode (AND or OR)
* @return int Return integer <0 if KO, >0 if OK
*/
public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND')
public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = '', $filtermode = 'AND')
{
$sql = "SELECT rowid, code, label, nature, active";
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
// Manage filter
$sqlwhere = array();
if (count($filter) > 0) {
foreach ($filter as $key => $value) {
if ($key == 't.code' || $key == 't.label' || $key == 't.nature') {
$sqlwhere[] = $key." = '".$this->db->escape($value)."'";
} elseif ($key == 't.rowid' || $key == 't.active') {
$sqlwhere[] = $key.'='.((int) $value);
}
}
}
$sql .= ' WHERE 1 = 1';
$sql .= " AND entity IN (".getEntity('accountancy').")";
if (count($sqlwhere) > 0) {
$sql .= " AND ".implode(" ".$this->db->sanitize($filtermode)." ", $sqlwhere);
// Manage filter
if (is_array($filter)) {
$sqlwhere = array();
if (count($filter) > 0) {
foreach ($filter as $key => $value) {
if ($key == 't.code' || $key == 't.label' || $key == 't.nature') {
$sqlwhere[] = $key." = '".$this->db->escape($value)."'";
} elseif ($key == 't.rowid' || $key == 't.active') {
$sqlwhere[] = $key.'='.((int) $value);
}
}
}
if (count($sqlwhere) > 0) {
$sql .= " AND ".implode(" ".$this->db->sanitize($filtermode)." ", $sqlwhere);
}
$filter = '';
}
// Manage filter
$errormessage = '';
$sql .= forgeSQLFromUniversalSearchCriteria($filter, $errormessage);
if ($errormessage) {
$this->errors[] = $errormessage;
dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
return -1;
}
if (!empty($sortfield)) {
@ -300,7 +315,7 @@ class AccountingJournal extends CommonObject
global $action;
$hookmanager->initHooks(array('accountingjournaldao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$parameters = array('id' => $this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
@ -406,12 +421,12 @@ class AccountingJournal extends CommonObject
case 1: // Various Journal
$data = $this->getAssetData($user, $type, $date_start, $date_end, $in_bookkeeping);
break;
// case 2: // Sells Journal
// case 3: // Purchases Journal
// case 4: // Bank Journal
// case 5: // Expense reports Journal
// case 8: // Inventory Journal
// case 9: // hasnew Journal
// case 2: // Sells Journal
// case 3: // Purchases Journal
// case 4: // Bank Journal
// case 5: // Expense reports Journal
// case 8: // Inventory Journal
// case 9: // hasnew Journal
}
}

View file

@ -908,22 +908,38 @@ class BookKeeping extends CommonObject
$sqlwhere = array();
if (count($filter) > 0) {
foreach ($filter as $key => $value) {
if ($key == 't.doc_date') {
$sqlwhere[] = $key.'=\''.$this->db->idate($value).'\'';
} elseif ($key == 't.doc_date>=' || $key == 't.doc_date<=') {
$sqlwhere[] = $key.'\''.$this->db->idate($value).'\'';
} elseif ($key == 't.numero_compte>=' || $key == 't.numero_compte<=' || $key == 't.subledger_account>=' || $key == 't.subledger_account<=') {
$sqlwhere[] = $key.'\''.$this->db->escape($value).'\'';
if ($key == 't.doc_date>=') {
$sqlwhere[] = "t.doc_date >= '".$this->db->idate($value)."'";
} elseif ($key == 't.doc_date<=') {
$sqlwhere[] = "t.doc_date <= '".$this->db->idate($value)."'";
} elseif ($key == 't.doc_date>') {
$sqlwhere[] = "t.doc_date > '".$this->db->idate($value)."'";
} elseif ($key == 't.doc_date<') {
$sqlwhere[] = "t.doc_date < '".$this->db->idate($value)."'";
} elseif ($key == 't.numero_compte>=') {
$sqlwhere[] = "t.numero_compte >= '".$this->db->escape($value)."'";
} elseif ($key == 't.numero_compte<=') {
$sqlwhere[] = "t.numero_compte <= '".$this->db->escape($value)."'";
} elseif ($key == 't.subledger_account>=') {
$sqlwhere[] = "t.subledger_account >= '".$this->db->escape($value)."'";
} elseif ($key == 't.subledger_account<=') {
$sqlwhere[] = "t.subledger_account <= '".$this->db->escape($value)."'";
} elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') {
$sqlwhere[] = $key.' = '.((int) $value);
$sqlwhere[] = $this->db->sanitize($key).' = '.((int) $value);
} elseif ($key == 't.subledger_account' || $key == 't.numero_compte') {
$sqlwhere[] = $key.' LIKE \''.$this->db->escape($this->db->escapeforlike($value)).'%\'';
} elseif ($key == 't.date_creation>=' || $key == 't.date_creation<=') {
$sqlwhere[] = $key.'\''.$this->db->idate($value).'\'';
} elseif ($key == 't.date_export>=' || $key == 't.date_export<=') {
$sqlwhere[] = $key.'\''.$this->db->idate($value).'\'';
} elseif ($key == 't.date_validated>=' || $key == 't.date_validated<=') {
$sqlwhere[] = $key.'\''.$this->db->idate($value).'\'';
$sqlwhere[] = $this->db->sanitize($key).' LIKE \''.$this->db->escape($this->db->escapeforlike($value)).'%\'';
} elseif ($key == 't.date_creation>=') {
$sqlwhere[] = 't.date_creation >= \''.$this->db->idate($value).'\'';
} elseif ($key == 't.date_creation<=') {
$sqlwhere[] = 't.date_creation <= \''.$this->db->idate($value).'\'';
} elseif ($key == 't.date_export>=') {
$sqlwhere[] = 't.date_export >= \''.$this->db->idate($value).'\'';
} elseif ($key == 't.date_export<=') {
$sqlwhere[] = 't.date_export <= \''.$this->db->idate($value).'\'';
} elseif ($key == 't.date_validated>=') {
$sqlwhere[] = 't;date_validate >= \''.$this->db->idate($value).'\'';
} elseif ($key == 't.date_validated<=') {
$sqlwhere[] = 't;date_validate <= \''.$this->db->idate($value).'\'';
} elseif ($key == 't.credit' || $key == 't.debit') {
$sqlwhere[] = natural_search($key, $value, 1, 1);
} elseif ($key == 't.reconciled_option') {
@ -1031,14 +1047,14 @@ class BookKeeping extends CommonObject
*
* @param string $sortorder Sort Order
* @param string $sortfield Sort field
* @param int $limit Offset limit
* @param int $limit Limit
* @param int $offset Offset limit
* @param array $filter Filter array
* @param string|array $filter Filter array
* @param string $filtermode Filter mode (AND or OR)
* @param int $showAlreadyExportMovements Show movements when field 'date_export' is not empty (0:No / 1:Yes (Default))
* @return int Return integer <0 if KO, >0 if OK
*/
public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND', $showAlreadyExportMovements = 1)
public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = '', $filtermode = 'AND', $showAlreadyExportMovements = 1)
{
global $conf;
@ -1074,48 +1090,84 @@ class BookKeeping extends CommonObject
$sql .= " t.date_export,";
$sql .= " t.date_validated as date_validation";
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
// Manage filter
$sqlwhere = array();
if (count($filter) > 0) {
foreach ($filter as $key => $value) {
if ($key == 't.doc_date') {
$sqlwhere[] = $key.'=\''.$this->db->idate($value).'\'';
} elseif ($key == 't.doc_date>=' || $key == 't.doc_date<=') {
$sqlwhere[] = $key.'\''.$this->db->idate($value).'\'';
} elseif ($key == 't.numero_compte>=' || $key == 't.numero_compte<=' || $key == 't.subledger_account>=' || $key == 't.subledger_account<=') {
$sqlwhere[] = $key.'\''.$this->db->escape($value).'\'';
} elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') {
$sqlwhere[] = $key.'='.((int) $value);
} elseif ($key == 't.subledger_account' || $key == 't.numero_compte') {
$sqlwhere[] = $key.' LIKE \''.$this->db->escape($value).'%\'';
} elseif ($key == 't.date_creation>=' || $key == 't.date_creation<=') {
$sqlwhere[] = $key.'\''.$this->db->idate($value).'\'';
} elseif ($key == 't.tms>=' || $key == 't.tms<=') {
$sqlwhere[] = $key.'\''.$this->db->idate($value).'\'';
} elseif ($key == 't.date_export>=' || $key == 't.date_export<=') {
$sqlwhere[] = $key.'\''.$this->db->idate($value).'\'';
} elseif ($key == 't.date_validated>=' || $key == 't.date_validated<=') {
$sqlwhere[] = $key.'\''.$this->db->idate($value).'\'';
} elseif ($key == 't.credit' || $key == 't.debit') {
$sqlwhere[] = natural_search($key, $value, 1, 1);
} elseif ($key == 't.code_journal' && !empty($value)) {
if (is_array($value)) {
$sqlwhere[] = natural_search("t.code_journal", implode(',', $value), 3, 1);
} else {
$sqlwhere[] = natural_search("t.code_journal", $value, 3, 1);
}
} else {
$sqlwhere[] = natural_search($key, $value, 0, 1);
}
}
}
$sql .= ' WHERE t.entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features
if ($showAlreadyExportMovements == 0) {
$sql .= " AND t.date_export IS NULL";
}
if (count($sqlwhere) > 0) {
$sql .= ' AND '.implode(" ".$this->db->sanitize($filtermode)." ", $sqlwhere);
// Manage filter
if (is_array($filter)) { // deprecated, use $filter = USF syntax
$sqlwhere = array();
if (count($filter) > 0) {
foreach ($filter as $key => $value) {
if ($key == 't.doc_date') {
$sqlwhere[] = $this->db->sanitize($key).' = \''.$this->db->idate($value).'\'';
} elseif ($key == 't.doc_date>=') {
$sqlwhere[] = "t.doc_date >= '".$this->db->idate($value)."'";
} elseif ($key == 't.doc_date<=') {
$sqlwhere[] = "t.doc_date <= '".$this->db->idate($value)."'";
} elseif ($key == 't.doc_date>') {
$sqlwhere[] = "t.doc_date > '".$this->db->idate($value)."'";
} elseif ($key == 't.doc_date<') {
$sqlwhere[] = "t.doc_date < '".$this->db->idate($value)."'";
} elseif ($key == 't.numero_compte>=') {
$sqlwhere[] = "t.numero_compte >= '".$this->db->escape($value)."'";
} elseif ($key == 't.numero_compte<=') {
$sqlwhere[] = "t.numero_compte <= '".$this->db->escape($value)."'";
} elseif ($key == 't.subledger_account>=') {
$sqlwhere[] = "t.subledger_account >= '".$this->db->escape($value)."'";
} elseif ($key == 't.subledger_account<=') {
$sqlwhere[] = "t.subledger_account <= '".$this->db->escape($value)."'";
} elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') {
$sqlwhere[] = $this->db->sanitize($key).' = '.((int) $value);
} elseif ($key == 't.subledger_account' || $key == 't.numero_compte') {
$sqlwhere[] = $this->db->sanitize($key).' LIKE \''.$this->db->escape($value).'%\'';
} elseif ($key == 't.date_creation>=') {
$sqlwhere[] = 't.date_creation >= \''.$this->db->idate($value).'\'';
} elseif ($key == 't.date_creation<=') {
$sqlwhere[] = 't.date_creation <= \''.$this->db->idate($value).'\'';
} elseif ($key == 't.tms>=') {
$sqlwhere[] = 't.tms >= \''.$this->db->idate($value).'\'';
} elseif ($key == 't.tms<=') {
$sqlwhere[] = 't.tms <= \''.$this->db->idate($value).'\'';
} elseif ($key == 't.date_export>=') {
$sqlwhere[] = 't.date_export >= \''.$this->db->idate($value).'\'';
} elseif ($key == 't.date_export<=') {
$sqlwhere[] = 't.date_export <= \''.$this->db->idate($value).'\'';
} elseif ($key == 't.date_validated>=') {
$sqlwhere[] = 't.date_validated >= \''.$this->db->idate($value).'\'';
} elseif ($key == 't.date_validated<=') {
$sqlwhere[] = 't.date_validated <= \''.$this->db->idate($value).'\'';
} elseif ($key == 't.credit' || $key == 't.debit') {
$sqlwhere[] = natural_search($key, $value, 1, 1);
} elseif ($key == 't.code_journal' && !empty($value)) {
if (is_array($value)) {
$sqlwhere[] = natural_search("t.code_journal", implode(',', $value), 3, 1);
} else {
$sqlwhere[] = natural_search("t.code_journal", $value, 3, 1);
}
} else {
$sqlwhere[] = natural_search($key, $value, 0, 1);
}
}
}
if (count($sqlwhere) > 0) {
$sql .= ' AND '.implode(" ".$this->db->sanitize($filtermode)." ", $sqlwhere);
}
$filter = '';
}
// Manage filter
$errormessage = '';
$sql .= forgeSQLFromUniversalSearchCriteria($filter, $errormessage);
if ($errormessage) {
$this->errors[] = $errormessage;
dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
return -1;
}
if (!empty($sortfield)) {
$sql .= $this->db->order($sortfield, $sortorder);
}
@ -1180,16 +1232,16 @@ class BookKeeping extends CommonObject
/**
* Load object in memory from the database
*
* @param string $sortorder Sort Order
* @param string $sortfield Sort field
* @param int $limit offset limit
* @param int $offset offset limit
* @param array $filter filter array
* @param string $filtermode filter mode (AND or OR)
* @param int $option option (0: aggregate by general account or 1: aggreegate by subaccount)
* @return int Return integer <0 if KO, >0 if OK
* @param string $sortorder Sort Order
* @param string $sortfield Sort field
* @param int $limit Limit
* @param int $offset Offset limit
* @param string|array $filter Filter
* @param string $filtermode Filter mode (AND or OR)
* @param int $option option (0: aggregate by general account or 1: aggreegate by subaccount)
* @return int Return integer <0 if KO, >0 if OK
*/
public function fetchAllBalance($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND', $option = 0)
public function fetchAllBalance($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = '', $filtermode = 'AND', $option = 0)
{
global $conf;
@ -1206,52 +1258,64 @@ class BookKeeping extends CommonObject
$sql .= " SUM(t.debit) as debit,";
$sql .= " SUM(t.credit) as credit";
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
// Manage filter
$sqlwhere = array();
if (count($filter) > 0) {
foreach ($filter as $key => $value) {
if ($key == 't.doc_date') {
$sqlwhere[] = $this->db->sanitize($key)." = '".$this->db->idate($value)."'";
} elseif ($key == 't.doc_date>=') {
$sqlwhere[] = "t.doc_date >= '".$this->db->idate($value)."'";
} elseif ($key == 't.doc_date<=') {
$sqlwhere[] = "t.doc_date <= '".$this->db->idate($value)."'";
} elseif ($key == 't.doc_date>') {
$sqlwhere[] = "t.doc_date > '".$this->db->idate($value)."'";
} elseif ($key == 't.doc_date<') {
$sqlwhere[] = "t.doc_date < '".$this->db->idate($value)."'";
} elseif ($key == 't.numero_compte>=') {
$sqlwhere[] = "t.numero_compte >= '".$this->db->escape($value)."'";
} elseif ($key == 't.numero_compte<=') {
$sqlwhere[] = "t.numero_compte <= '".$this->db->escape($value)."'";
} elseif ($key == 't.subledger_account>=') {
$sqlwhere[] = "t.subledger_account >= '".$this->db->escape($value)."'";
} elseif ($key == 't.subledger_account<=') {
$sqlwhere[] = "t.subledger_account <= '".$this->db->escape($value)."'";
} elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') {
$sqlwhere[] = $this->db->sanitize($key)." = ".((int) $value);
} elseif ($key == 't.subledger_account' || $key == 't.numero_compte') {
$sqlwhere[] = $this->db->sanitize($key)." LIKE '".$this->db->escape($value)."%'";
} elseif ($key == 't.subledger_label') {
$sqlwhere[] = $this->db->sanitize($key)." LIKE '".$this->db->escape($value)."%'";
} elseif ($key == 't.code_journal' && !empty($value)) {
if (is_array($value)) {
$sqlwhere[] = natural_search("t.code_journal", implode(',', $value), 3, 1);
} else {
$sqlwhere[] = natural_search("t.code_journal", $value, 3, 1);
}
} elseif ($key == 't.reconciled_option') {
$sqlwhere[] = 't.lettering_code IS NULL';
} else {
$sqlwhere[] = $this->db->sanitize($key)." LIKE '%".$this->db->escape($this->db->escapeforlike($value))."%'";
}
}
}
$sql .= ' WHERE entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features
if (count($sqlwhere) > 0) {
$sql .= " AND ".implode(" ".$this->db->sanitize($filtermode)." ", $sqlwhere);
// Manage filter
if (is_array($filter)) {
$sqlwhere = array();
if (count($filter) > 0) {
foreach ($filter as $key => $value) {
if ($key == 't.doc_date') {
$sqlwhere[] = $this->db->sanitize($key)." = '".$this->db->idate($value)."'";
} elseif ($key == 't.doc_date>=') {
$sqlwhere[] = "t.doc_date >= '".$this->db->idate($value)."'";
} elseif ($key == 't.doc_date<=') {
$sqlwhere[] = "t.doc_date <= '".$this->db->idate($value)."'";
} elseif ($key == 't.doc_date>') {
$sqlwhere[] = "t.doc_date > '".$this->db->idate($value)."'";
} elseif ($key == 't.doc_date<') {
$sqlwhere[] = "t.doc_date < '".$this->db->idate($value)."'";
} elseif ($key == 't.numero_compte>=') {
$sqlwhere[] = "t.numero_compte >= '".$this->db->escape($value)."'";
} elseif ($key == 't.numero_compte<=') {
$sqlwhere[] = "t.numero_compte <= '".$this->db->escape($value)."'";
} elseif ($key == 't.subledger_account>=') {
$sqlwhere[] = "t.subledger_account >= '".$this->db->escape($value)."'";
} elseif ($key == 't.subledger_account<=') {
$sqlwhere[] = "t.subledger_account <= '".$this->db->escape($value)."'";
} elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') {
$sqlwhere[] = $this->db->sanitize($key)." = ".((int) $value);
} elseif ($key == 't.subledger_account' || $key == 't.numero_compte') {
$sqlwhere[] = $this->db->sanitize($key)." LIKE '".$this->db->escape($value)."%'";
} elseif ($key == 't.subledger_label') {
$sqlwhere[] = $this->db->sanitize($key)." LIKE '".$this->db->escape($value)."%'";
} elseif ($key == 't.code_journal' && !empty($value)) {
if (is_array($value)) {
$sqlwhere[] = natural_search("t.code_journal", implode(',', $value), 3, 1);
} else {
$sqlwhere[] = natural_search("t.code_journal", $value, 3, 1);
}
} elseif ($key == 't.reconciled_option') {
$sqlwhere[] = 't.lettering_code IS NULL';
} else {
$sqlwhere[] = $this->db->sanitize($key)." LIKE '%".$this->db->escape($this->db->escapeforlike($value))."%'";
}
}
}
if (count($sqlwhere) > 0) {
$sql .= " AND ".implode(" ".$this->db->sanitize($filtermode)." ", $sqlwhere);
}
$filter = '';
}
// Manage filter
$errormessage = '';
$sql .= forgeSQLFromUniversalSearchCriteria($filter, $errormessage);
if ($errormessage) {
$this->errors[] = $errormessage;
dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
return -1;
}
if (!empty($option)) {
@ -2464,7 +2528,7 @@ class BookKeeping extends CommonObject
* Get list of fiscal period
*
* @param string $filter Filter
* @return array<array{id:int,data_start:string,date_end:string,label:string}>|int Return integer <0 if KO, Fiscal periods : [[id, date_start, date_end, label], ...]
* @return array<array{id:int,label:string,date_start:string,date_end:string,status:int}>|int Return integer <0 if KO, Fiscal periods : [[id, date_start, date_end, label], ...]
*/
public function getFiscalPeriods($filter = '')
{
@ -2487,11 +2551,11 @@ class BookKeeping extends CommonObject
while ($obj = $this->db->fetch_object($resql)) {
$list[$obj->rowid] = array(
'id' => $obj->rowid,
'id' => (int) $obj->rowid,
'label' => $obj->label,
'date_start' => $this->db->jdate($obj->date_start),
'date_end' => $this->db->jdate($obj->date_end),
'status' => $obj->statut,
'status' => (int) $obj->statut,
);
}

View file

@ -351,22 +351,22 @@ if ($result) {
$param .= "&search_vat=".urlencode($search_vat);
}
if ($search_date_startday) {
$param .= '&search_date_startday='.urlencode($search_date_startday);
$param .= '&search_date_startday='.urlencode((string) ($search_date_startday));
}
if ($search_date_startmonth) {
$param .= '&search_date_startmonth='.urlencode($search_date_startmonth);
$param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth));
}
if ($search_date_startyear) {
$param .= '&search_date_startyear='.urlencode($search_date_startyear);
$param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear));
}
if ($search_date_endday) {
$param .= '&search_date_endday='.urlencode($search_date_endday);
$param .= '&search_date_endday='.urlencode((string) ($search_date_endday));
}
if ($search_date_endmonth) {
$param .= '&search_date_endmonth='.urlencode($search_date_endmonth);
$param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth));
}
if ($search_date_endyear) {
$param .= '&search_date_endyear='.urlencode($search_date_endyear);
$param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear));
}
if ($search_country) {
$param .= "&search_country=".urlencode($search_country);

View file

@ -399,25 +399,25 @@ if ($result) {
$param .= '&search_societe='.urlencode($search_societe);
}
if ($search_lineid) {
$param .= '&search_lineid='.urlencode($search_lineid);
$param .= '&search_lineid='.urlencode((string) ($search_lineid));
}
if ($search_date_startday) {
$param .= '&search_date_startday='.urlencode($search_date_startday);
$param .= '&search_date_startday='.urlencode((string) ($search_date_startday));
}
if ($search_date_startmonth) {
$param .= '&search_date_startmonth='.urlencode($search_date_startmonth);
$param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth));
}
if ($search_date_startyear) {
$param .= '&search_date_startyear='.urlencode($search_date_startyear);
$param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear));
}
if ($search_date_endday) {
$param .= '&search_date_endday='.urlencode($search_date_endday);
$param .= '&search_date_endday='.urlencode((string) ($search_date_endday));
}
if ($search_date_endmonth) {
$param .= '&search_date_endmonth='.urlencode($search_date_endmonth);
$param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth));
}
if ($search_date_endyear) {
$param .= '&search_date_endyear='.urlencode($search_date_endyear);
$param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear));
}
if ($search_invoice) {
$param .= '&search_invoice='.urlencode($search_invoice);

View file

@ -279,22 +279,22 @@ if ($result) {
$param .= "&search_vat=".urlencode($search_vat);
}
if ($search_date_startday) {
$param .= '&search_date_startday='.urlencode($search_date_startday);
$param .= '&search_date_startday='.urlencode((string) ($search_date_startday));
}
if ($search_date_startmonth) {
$param .= '&search_date_startmonth='.urlencode($search_date_startmonth);
$param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth));
}
if ($search_date_startyear) {
$param .= '&search_date_startyear='.urlencode($search_date_startyear);
$param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear));
}
if ($search_date_endday) {
$param .= '&search_date_endday='.urlencode($search_date_endday);
$param .= '&search_date_endday='.urlencode((string) ($search_date_endday));
}
if ($search_date_endmonth) {
$param .= '&search_date_endmonth='.urlencode($search_date_endmonth);
$param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth));
}
if ($search_date_endyear) {
$param .= '&search_date_endyear='.urlencode($search_date_endyear);
$param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear));
}
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">'."\n";

View file

@ -327,22 +327,22 @@ if ($result) {
$param .= '&search_lineid='.urlencode($search_lineid);
}
if ($search_date_startday) {
$param .= '&search_date_startday='.urlencode($search_date_startday);
$param .= '&search_date_startday='.urlencode((string) ($search_date_startday));
}
if ($search_date_startmonth) {
$param .= '&search_date_startmonth='.urlencode($search_date_startmonth);
$param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth));
}
if ($search_date_startyear) {
$param .= '&search_date_startyear='.urlencode($search_date_startyear);
$param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear));
}
if ($search_date_endday) {
$param .= '&search_date_endday='.urlencode($search_date_endday);
$param .= '&search_date_endday='.urlencode((string) ($search_date_endday));
}
if ($search_date_endmonth) {
$param .= '&search_date_endmonth='.urlencode($search_date_endmonth);
$param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth));
}
if ($search_date_endyear) {
$param .= '&search_date_endyear='.urlencode($search_date_endyear);
$param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear));
}
if ($search_expensereport) {
$param .= '&search_expensereport='.urlencode($search_expensereport);

View file

@ -359,22 +359,22 @@ if ($result) {
$param .= "&search_vat=".urlencode($search_vat);
}
if ($search_date_startday) {
$param .= '&search_date_startday='.urlencode($search_date_startday);
$param .= '&search_date_startday='.urlencode((string) ($search_date_startday));
}
if ($search_date_startmonth) {
$param .= '&search_date_startmonth='.urlencode($search_date_startmonth);
$param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth));
}
if ($search_date_startyear) {
$param .= '&search_date_startyear='.urlencode($search_date_startyear);
$param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear));
}
if ($search_date_endday) {
$param .= '&search_date_endday='.urlencode($search_date_endday);
$param .= '&search_date_endday='.urlencode((string) ($search_date_endday));
}
if ($search_date_endmonth) {
$param .= '&search_date_endmonth='.urlencode($search_date_endmonth);
$param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth));
}
if ($search_date_endyear) {
$param .= '&search_date_endyear='.urlencode($search_date_endyear);
$param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear));
}
if ($search_country) {
$param .= "&search_country=".urlencode($search_country);

View file

@ -403,25 +403,25 @@ if ($result) {
$param .= '&search_societe='.urlencode($search_societe);
}
if ($search_lineid) {
$param .= '&search_lineid='.urlencode($search_lineid);
$param .= '&search_lineid='.urlencode((string) ($search_lineid));
}
if ($search_date_startday) {
$param .= '&search_date_startday='.urlencode($search_date_startday);
$param .= '&search_date_startday='.urlencode((string) ($search_date_startday));
}
if ($search_date_startmonth) {
$param .= '&search_date_startmonth='.urlencode($search_date_startmonth);
$param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth));
}
if ($search_date_startyear) {
$param .= '&search_date_startyear='.urlencode($search_date_startyear);
$param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear));
}
if ($search_date_endday) {
$param .= '&search_date_endday='.urlencode($search_date_endday);
$param .= '&search_date_endday='.urlencode((string) ($search_date_endday));
}
if ($search_date_endmonth) {
$param .= '&search_date_endmonth='.urlencode($search_date_endmonth);
$param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth));
}
if ($search_date_endyear) {
$param .= '&search_date_endyear='.urlencode($search_date_endyear);
$param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear));
}
if ($search_invoice) {
$param .= '&search_invoice='.urlencode($search_invoice);

View file

@ -8,6 +8,7 @@
* Copyright (C) 2015-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018-2022 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2021 Waël Almoman <info@almoman.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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
@ -699,11 +700,7 @@ if (empty($reshook)) {
}
} else {
$error++;
if ($object->error) {
setEventMessages($object->error, $object->errors, 'errors');
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
setEventMessages($object->error, $object->errors, 'errors');
}
if (!$error) {
@ -771,11 +768,7 @@ if (empty($reshook)) {
} else {
$error++;
if ($object->error) {
setEventMessages($object->error, $object->errors, 'errors');
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
setEventMessages($object->error, $object->errors, 'errors');
$action = '';
}
}
@ -842,11 +835,7 @@ if (empty($reshook)) {
} else {
$error++;
if ($object->error) {
setEventMessages($object->error, $object->errors, 'errors');
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
setEventMessages($object->error, $object->errors, 'errors');
$action = '';
}
}

View file

@ -15,6 +15,7 @@
* Copyright (C) 2020 Josep Lluís Amador <joseplluis@lliuretic.cat>
* Copyright (C) 2021 Waël Almoman <info@almoman.com>
* Copyright (C) 2021 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -315,7 +316,7 @@ class Adherent extends CommonObject
/**
* @var array fields
* @var array<string,array{type:string,label:string,enabled:int<0,2>|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array<int,string>,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
*/
public $fields = array(
'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10),
@ -323,14 +324,14 @@ class Adherent extends CommonObject
'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 15, 'index' => 1),
'ref_ext' => array('type' => 'varchar(128)', 'label' => 'Ref ext', 'enabled' => 1, 'visible' => 0, 'position' => 20),
'civility' => array('type' => 'varchar(6)', 'label' => 'Civility', 'enabled' => 1, 'visible' => -1, 'position' => 25),
'lastname' => array('type' => 'varchar(50)', 'label' => 'Lastname', 'enabled' => 1, 'visible' => 1, 'position' => 30, 'showoncombobox'=>1),
'firstname' => array('type' => 'varchar(50)', 'label' => 'Firstname', 'enabled' => 1, 'visible' => 1, 'position' => 35, 'showoncombobox'=>1),
'lastname' => array('type' => 'varchar(50)', 'label' => 'Lastname', 'enabled' => 1, 'visible' => 1, 'position' => 30, 'showoncombobox' => 1),
'firstname' => array('type' => 'varchar(50)', 'label' => 'Firstname', 'enabled' => 1, 'visible' => 1, 'position' => 35, 'showoncombobox' => 1),
'login' => array('type' => 'varchar(50)', 'label' => 'Login', 'enabled' => 1, 'visible' => 1, 'position' => 40),
'pass' => array('type' => 'varchar(50)', 'label' => 'Pass', 'enabled' => 1, 'visible' => -1, 'position' => 45),
'pass_crypted' => array('type' => 'varchar(128)', 'label' => 'Pass crypted', 'enabled' => 1, 'visible' => -1, 'position' => 50),
'morphy' => array('type' => 'varchar(3)', 'label' => 'MemberNature', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'position' => 55),
'fk_adherent_type' => array('type' => 'integer', 'label' => 'Fk adherent type', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'position' => 60),
'societe' => array('type' => 'varchar(128)', 'label' => 'Societe', 'enabled' => 1, 'visible' => 1, 'position' => 65, 'showoncombobox'=>2),
'societe' => array('type' => 'varchar(128)', 'label' => 'Societe', 'enabled' => 1, 'visible' => 1, 'position' => 65, 'showoncombobox' => 2),
'fk_soc' => array('type' => 'integer:Societe:societe/class/societe.class.php', 'label' => 'ThirdParty', 'enabled' => 1, 'visible' => 1, 'position' => 70),
'address' => array('type' => 'text', 'label' => 'Address', 'enabled' => 1, 'visible' => -1, 'position' => 75),
'zip' => array('type' => 'varchar(10)', 'label' => 'Zip', 'enabled' => 1, 'visible' => -1, 'position' => 80),
@ -341,14 +342,14 @@ class Adherent extends CommonObject
'phone_perso' => array('type' => 'varchar(30)', 'label' => 'Phone perso', 'enabled' => 1, 'visible' => -1, 'position' => 120),
'phone_mobile' => array('type' => 'varchar(30)', 'label' => 'Phone mobile', 'enabled' => 1, 'visible' => -1, 'position' => 125),
'email' => array('type' => 'varchar(255)', 'label' => 'Email', 'enabled' => 1, 'visible' => 1, 'position' => 126),
'url' =>array('type'=>'varchar(255)', 'label'=>'Url', 'enabled'=>1, 'visible'=>-1, 'position'=>127),
'url' => array('type' => 'varchar(255)', 'label' => 'Url', 'enabled' => 1, 'visible' => -1, 'position' => 127),
'socialnetworks' => array('type' => 'text', 'label' => 'Socialnetworks', 'enabled' => 1, 'visible' => -1, 'position' => 128),
'birth' => array('type' => 'date', 'label' => 'DateOfBirth', 'enabled' => 1, 'visible' => -1, 'position' => 130),
'gender' => array('type' => 'varchar(10)', 'label' => 'Gender', 'enabled' => 1, 'visible' => -1, 'position' => 132),
'photo' => array('type' => 'varchar(255)', 'label' => 'Photo', 'enabled' => 1, 'visible' => -1, 'position' => 135),
'public' => array('type' => 'smallint(6)', 'label' => 'Public', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 145),
'datefin' => array('type' => 'datetime', 'label' => 'DateEnd', 'enabled' => 1, 'visible' => 1, 'position' => 150),
'default_lang' =>array('type'=>'varchar(6)', 'label'=>'Default lang', 'enabled'=>1, 'visible'=>-1, 'position'=> 153),
'default_lang' => array('type' => 'varchar(6)', 'label' => 'Default lang', 'enabled' => 1, 'visible' => -1, 'position' => 153),
'note_public' => array('type' => 'text', 'label' => 'NotePublic', 'enabled' => 1, 'visible' => 0, 'position' => 155),
'note_private' => array('type' => 'text', 'label' => 'NotePrivate', 'enabled' => 1, 'visible' => 0, 'position' => 160),
'datevalid' => array('type' => 'datetime', 'label' => 'DateValidation', 'enabled' => 1, 'visible' => -1, 'position' => 165),
@ -490,7 +491,7 @@ class Adherent extends CommonObject
*/
public function makeSubstitution($text)
{
global $conf, $langs;
global $langs;
$birthday = dol_print_date($this->birth, 'day');
@ -2421,7 +2422,7 @@ class Adherent extends CommonObject
}
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$parameters = array('id' => $this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
@ -3276,7 +3277,7 @@ class Adherent extends CommonObject
$return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">';
if (property_exists($this, 'photo') || !empty($this->photo)) {
$return.= Form::showphoto('memberphoto', $this, 0, 60, 0, 'photokanban photoref photowithmargin photologintooltip', 'small', 0, 1);
$return .= Form::showphoto('memberphoto', $this, 0, 60, 0, 'photokanban photoref photowithmargin photologintooltip', 'small', 0, 1);
} else {
$return .= img_picto('', 'user');
}

View file

@ -3,6 +3,7 @@
* Copyright (C) 2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2020 Thibault FOUCART<support@ptibogxiv.net>
* Copyright (C) 2020 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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
@ -535,8 +536,6 @@ class Members extends DolibarrApi
*/
public function getSubscriptions($id)
{
$obj_ret = array();
if (!DolibarrApiAccess::$user->hasRight('adherent', 'cotisation', 'lire')) {
throw new RestException(403);
}

View file

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -103,21 +104,21 @@ class Subscription extends CommonObject
public $fk_bank;
/**
* @var array Array with all fields into database and their property. Do not use it as a static var. It may be modified by constructor.
* @var array<string,array{type:string,label:string,enabled:int<0,2>|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array<int,string>,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
*/
public $fields = array(
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>15),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>20),
'fk_adherent' =>array('type'=>'integer', 'label'=>'Member', 'enabled'=>1, 'visible'=>-1, 'position'=>25),
'dateadh' =>array('type'=>'datetime', 'label'=>'DateSubscription', 'enabled'=>1, 'visible'=>-1, 'position'=>30),
'datef' =>array('type'=>'datetime', 'label'=>'DateEndSubscription', 'enabled'=>1, 'visible'=>-1, 'position'=>35),
'subscription' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>-1, 'position'=>40, 'isameasure'=>1),
'fk_bank' =>array('type'=>'integer', 'label'=>'BankId', 'enabled'=>1, 'visible'=>-1, 'position'=>45),
'note' =>array('type'=>'html', 'label'=>'Note', 'enabled'=>1, 'visible'=>-1, 'position'=>50),
'fk_type' =>array('type'=>'integer', 'label'=>'MemberType', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
'fk_user_creat' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'position'=>60),
'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10),
'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 15),
'datec' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'visible' => -1, 'position' => 20),
'fk_adherent' => array('type' => 'integer', 'label' => 'Member', 'enabled' => 1, 'visible' => -1, 'position' => 25),
'dateadh' => array('type' => 'datetime', 'label' => 'DateSubscription', 'enabled' => 1, 'visible' => -1, 'position' => 30),
'datef' => array('type' => 'datetime', 'label' => 'DateEndSubscription', 'enabled' => 1, 'visible' => -1, 'position' => 35),
'subscription' => array('type' => 'double(24,8)', 'label' => 'Amount', 'enabled' => 1, 'visible' => -1, 'position' => 40, 'isameasure' => 1),
'fk_bank' => array('type' => 'integer', 'label' => 'BankId', 'enabled' => 1, 'visible' => -1, 'position' => 45),
'note' => array('type' => 'html', 'label' => 'Note', 'enabled' => 1, 'visible' => -1, 'position' => 50),
'fk_type' => array('type' => 'integer', 'label' => 'MemberType', 'enabled' => 1, 'visible' => -1, 'position' => 55),
'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => 1, 'visible' => -2, 'position' => 60),
'fk_user_valid' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserValidation', 'enabled' => 1, 'visible' => -1, 'position' => 65),
);
@ -295,7 +296,7 @@ class Subscription extends CommonObject
$result = $member->update_end_date($user);
if (!$error && !$notrigger) {
$this->context = array('member'=>$member);
$this->context = array('member' => $member);
// Call triggers
$result = $this->call_trigger('MEMBER_SUBSCRIPTION_MODIFY', $user);
if ($result < 0) {

View file

@ -120,12 +120,13 @@ print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">';
// Login
print '<tr><td class="titlefield">'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$object->login.'&nbsp;</td></tr>';
print '<tr><td class="titlefield">'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.dol_escape_htmltag($object->login).'&nbsp;</td></tr>';
// If there is a link to the unencrypted password, we show the value in database here so we can compare because it is shown nowhere else
// This is for very old situation. Password are now encrypted and $object->pass is empty.
if (getDolGlobalString('LDAP_MEMBER_FIELD_PASSWORD')) {
print '<tr><td>'.$langs->trans("LDAPFieldPasswordNotCrypted").'</td>';
print '<td class="valeur">'.$object->pass.'</td>';
print '<td class="valeur">'.dol_escape_htmltag($object->pass).'</td>';
print "</tr>\n";
}

View file

@ -670,7 +670,7 @@ if ($search_email) {
$param .= "&search_email=".urlencode($search_email);
}
if ($search_categ > 0 || $search_categ == -2) {
$param .= "&search_categ=".urlencode($search_categ);
$param .= "&search_categ=".urlencode((string) ($search_categ));
}
if ($search_company) {
$param .= "&search_company=".urlencode($search_company);

View file

@ -89,20 +89,20 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen
$fieldstosearchall = array(
);
$arrayfields = array(
'd.ref'=>array('label'=>"Ref", 'checked'=>1),
'd.fk_type'=>array('label'=>"Type", 'checked'=>1),
'd.lastname'=>array('label'=>"Lastname", 'checked'=>1),
'd.firstname'=>array('label'=>"Firstname", 'checked'=>1),
'd.login'=>array('label'=>"Login", 'checked'=>1),
't.libelle'=>array('label'=>"Label", 'checked'=>1),
'd.bank'=>array('label'=>"BankAccount", 'checked'=>1, 'enabled'=>(isModEnabled('bank'))),
'd.ref' => array('label' => "Ref", 'checked' => 1),
'd.fk_type' => array('label' => "Type", 'checked' => 1),
'd.lastname' => array('label' => "Lastname", 'checked' => 1),
'd.firstname' => array('label' => "Firstname", 'checked' => 1),
'd.login' => array('label' => "Login", 'checked' => 1),
't.libelle' => array('label' => "Label", 'checked' => 1),
'd.bank' => array('label' => "BankAccount", 'checked' => 1, 'enabled' => (isModEnabled('bank'))),
/*'d.note_public'=>array('label'=>"NotePublic", 'checked'=>0),
'd.note_private'=>array('label'=>"NotePrivate", 'checked'=>0),*/
'c.dateadh'=>array('label'=>"DateSubscription", 'checked'=>1, 'position'=>100),
'c.datef'=>array('label'=>"EndSubscription", 'checked'=>1, 'position'=>101),
'd.amount'=>array('label'=>"Amount", 'checked'=>1, 'position'=>102),
'c.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
'c.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
'c.dateadh' => array('label' => "DateSubscription", 'checked' => 1, 'position' => 100),
'c.datef' => array('label' => "EndSubscription", 'checked' => 1, 'position' => 101),
'd.amount' => array('label' => "Amount", 'checked' => 1, 'position' => 102),
'c.datec' => array('label' => "DateCreation", 'checked' => 0, 'position' => 500),
'c.tms' => array('label' => "DateModificationShort", 'checked' => 0, 'position' => 500),
// 'd.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000)
);
@ -124,7 +124,7 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa
$massaction = '';
}
$parameters = array('socid'=>isset($socid) ? $socid : null);
$parameters = array('socid' => isset($socid) ? $socid : null);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@ -298,7 +298,7 @@ $arrayofselected = is_array($toselect) ? $toselect : array();
$param = '';
if (!empty($mode)) {
$param .='&mode='.urlencode($mode);
$param .= '&mode='.urlencode($mode);
}
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
@ -322,7 +322,7 @@ if ($search_login) {
$param .= "&search_login=".urlencode($search_login);
}
if ($search_account) {
$param .= "&search_account=".urlencode($search_account);
$param .= "&search_account=".urlencode((string) ($search_account));
}
if ($search_amount) {
$param .= "&search_amount=".urlencode($search_amount);
@ -366,8 +366,8 @@ print '<input type="hidden" name="page_y" value="">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
$newcardbutton = '';
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss' => 'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss' => 'reposition'));
if ($user->hasRight('adherent', 'cotisation', 'creer')) {
$newcardbutton .= dolGetButtonTitleSeparator();
$newcardbutton .= dolGetButtonTitle($langs->trans('NewSubscription'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/list.php?status=-1,1');
@ -492,7 +492,7 @@ if (!empty($arrayfields['d.amount']['checked'])) {
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields);
$parameters = array('arrayfields' => $arrayfields);
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation
@ -571,7 +571,7 @@ if (!empty($arrayfields['d.amount']['checked'])) {
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray);
$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (!empty($arrayfields['c.datec']['checked'])) {
@ -647,7 +647,7 @@ while ($i < $imaxinloop) {
$accountstatic->fetch($obj->fk_account);
}
// Output Kanban
print $subscription->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected), 'adherent_type' => $adht, 'member' => $adherent, 'bank'=>($obj->fk_account > 0 ? $accountstatic : null)));
print $subscription->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected), 'adherent_type' => $adht, 'member' => $adherent, 'bank' => ($obj->fk_account > 0 ? $accountstatic : null)));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';
@ -770,7 +770,7 @@ while ($i < $imaxinloop) {
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$parameters = array('arrayfields' => $arrayfields, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation
@ -829,7 +829,7 @@ if ($num == 0) {
$db->free($resql);
$parameters = array('arrayfields'=>$arrayfields, 'sql' => $sql);
$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;

View file

@ -2,6 +2,7 @@
/* Copyright (C) 2010-2011 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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 +41,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) {
echo '<td class="center">'.dol_print_date($objectlink->dateh, 'day').'</td>';
echo '<td class="right">';
if ($user->hasRight('adherent', 'lire')) {
$total = $total + $objectlink->amount;
$total += $objectlink->amount;
echo price($objectlink->amount);
}
echo '</td>';

View file

@ -190,7 +190,7 @@ if ($action == 'update' && $user->hasRight('adherent', 'configurer')) {
$object->oldcopy = dol_clone($object, 2);
$object->label= trim($label);
$object->label = trim($label);
$object->morphy = trim($morphy);
$object->status = (int) $status;
$object->subscription = (int) $subscription;
@ -277,8 +277,8 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
$newcardbutton = '';
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss' => 'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss' => 'reposition'));
if ($user->hasRight('adherent', 'configurer')) {
$newcardbutton .= dolGetButtonTitleSeparator();
@ -379,9 +379,9 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
if ($objp->duration) {
$duration_value = intval($objp->duration);
if ($duration_value > 1) {
$dur = array("i"=>$langs->trans("Minutes"), "h"=>$langs->trans("Hours"), "d"=>$langs->trans("Days"), "w"=>$langs->trans("Weeks"), "m"=>$langs->trans("Months"), "y"=>$langs->trans("Years"));
$dur = array("i" => $langs->trans("Minutes"), "h" => $langs->trans("Hours"), "d" => $langs->trans("Days"), "w" => $langs->trans("Weeks"), "m" => $langs->trans("Months"), "y" => $langs->trans("Years"));
} else {
$dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hour"), "d"=>$langs->trans("Day"), "w"=>$langs->trans("Week"), "m"=>$langs->trans("Month"), "y"=>$langs->trans("Year"));
$dur = array("i" => $langs->trans("Minute"), "h" => $langs->trans("Hour"), "d" => $langs->trans("Day"), "w" => $langs->trans("Week"), "m" => $langs->trans("Month"), "y" => $langs->trans("Year"));
}
$unit = preg_replace("/[^a-zA-Z]+/", "", $objp->duration);
print max(1, $duration_value).' '.$dur[$unit];
@ -441,7 +441,7 @@ if ($action == 'create') {
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" class="minwidth200" name="label" autofocus="autofocus"></td></tr>';
print '<tr><td>'.$langs->trans("Status").'</td><td>';
print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), 1, 0, 0, 0, '', 0, 0, 0, '', 'minwidth100');
print $form->selectarray('status', array('0' => $langs->trans('ActivityCeased'), '1' => $langs->trans('InActivity')), 1, 0, 0, 0, '', 0, 0, 0, '', 'minwidth100');
print '</td></tr>';
// Morphy
@ -548,9 +548,9 @@ if ($rowid > 0) {
print '<tr><td class="titlefield">'.$langs->trans("Duration").'</td><td colspan="2">'.$object->duration_value.'&nbsp;';
if ($object->duration_value > 1) {
$dur = array("i"=>$langs->trans("Minutes"), "h"=>$langs->trans("Hours"), "d"=>$langs->trans("Days"), "w"=>$langs->trans("Weeks"), "m"=>$langs->trans("Months"), "y"=>$langs->trans("Years"));
$dur = array("i" => $langs->trans("Minutes"), "h" => $langs->trans("Hours"), "d" => $langs->trans("Days"), "w" => $langs->trans("Weeks"), "m" => $langs->trans("Months"), "y" => $langs->trans("Years"));
} elseif ($object->duration_value > 0) {
$dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hour"), "d"=>$langs->trans("Day"), "w"=>$langs->trans("Week"), "m"=>$langs->trans("Month"), "y"=>$langs->trans("Year"));
$dur = array("i" => $langs->trans("Minute"), "h" => $langs->trans("Hour"), "d" => $langs->trans("Day"), "w" => $langs->trans("Week"), "m" => $langs->trans("Month"), "y" => $langs->trans("Year"));
}
print(!empty($object->duration_unit) && isset($dur[$object->duration_unit]) ? $langs->trans($dur[$object->duration_unit]) : '')."&nbsp;";
print '</td></tr>';
@ -592,7 +592,7 @@ if ($rowid > 0) {
$morphy = '';
}
if ($user->hasRight('adherent', 'configurer')&& !empty($object->status)) {
if ($user->hasRight('adherent', 'configurer') && !empty($object->status)) {
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?action=create&token='.newToken().'&typeid='.$object->id.($morphy ? '&morphy='.urlencode($morphy) : '').'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?rowid='.$object->id).'">'.$langs->trans("AddMember").'</a></div>';
} else {
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NoAddMember")).'">'.$langs->trans("AddMember").'</a></div>';
@ -712,7 +712,7 @@ if ($rowid > 0) {
$titre .= " (".$membertype->label.")";
}
$param = "&rowid=".urlencode($object->id);
$param = "&rowid=".urlencode((string) ($object->id));
if (!empty($mode)) {
$param .= '&mode='.urlencode($mode);
}
@ -918,7 +918,7 @@ if ($rowid > 0) {
}
if ($i == 0) {
print '<tr><td colspan="7"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
print '<tr><td colspan="9"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
}
print "</table>\n";
@ -956,7 +956,7 @@ if ($rowid > 0) {
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" class="minwidth300" name="label" value="'.dol_escape_htmltag($object->label).'"></td></tr>';
print '<tr><td>'.$langs->trans("Status").'</td><td>';
print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), $object->status, 0, 0, 0, '', 0, 0, 0, '', 'minwidth100');
print $form->selectarray('status', array('0' => $langs->trans('ActivityCeased'), '1' => $langs->trans('InActivity')), $object->status, 0, 0, 0, '', 0, 0, 0, '', 'minwidth100');
print '</td></tr>';
// Morphy

View file

@ -5,6 +5,7 @@
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
* Copyright (C) 2017 Open-DSI <support@open-dsi.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -89,7 +90,7 @@ if ($action == 'set') {
dolibarr_set_const($db, 'AGENDA_DEFAULT_VIEW', GETPOST('AGENDA_DEFAULT_VIEW'), 'chaine', 0, '', $conf->entity);
$defaultValues = new DefaultValues($db);
$result = $defaultValues->fetchAll('', '', 0, 0, array('t.page'=>'comm/action/card.php', 't.param'=>'complete', 't.user_id'=>'0', 't.type'=>'createform', 't.entity'=>$conf->entity));
$result = $defaultValues->fetchAll('', '', 0, 0, array('t.page' => 'comm/action/card.php', 't.param' => 'complete', 't.user_id' => '0', 't.type' => 'createform', 't.entity' => $conf->entity));
if (!is_array($result) && $result < 0) {
setEventMessages($defaultValues->error, $defaultValues->errors, 'errors');
} elseif (count($result) > 0) {
@ -123,18 +124,16 @@ if ($action == 'set') {
// Search template files
$file = '';
$classname = '';
$filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/action/doc/pdf_".$modele.".modules.php", 0);
if (file_exists($file)) {
$filefound = 1;
$classname = "pdf_".$modele;
break;
}
}
if ($filefound) {
if ($classname !== '') {
require_once $file;
$module = new $classname($db, $commande);
@ -334,7 +333,7 @@ $htmltext = $langs->trans("ThisValueCanOverwrittenOnUserLevel", $langs->transnoe
print '<td>'.$form->textwithpicto($langs->trans("AGENDA_DEFAULT_VIEW"), $htmltext).'</td>'."\n";
print '<td class="center">&nbsp;</td>'."\n";
print '<td class="right">'."\n";
$tmplist = array(''=>'&nbsp;', 'show_list'=>$langs->trans("ViewList"), 'show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_peruser'=>$langs->trans("ViewPerUser"));
$tmplist = array('' => '&nbsp;', 'show_list' => $langs->trans("ViewList"), 'show_month' => $langs->trans("ViewCal"), 'show_week' => $langs->trans("ViewWeek"), 'show_day' => $langs->trans("ViewDay"), 'show_peruser' => $langs->trans("ViewPerUser"));
print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, getDolGlobalString('AGENDA_DEFAULT_VIEW'));
print '</td></tr>'."\n";
@ -369,7 +368,7 @@ print '<td class="center">&nbsp;</td>'."\n";
print '<td class="right nowrap">'."\n";
$defval = 'na';
$defaultValues = new DefaultValues($db);
$result = $defaultValues->fetchAll('', '', 0, 0, array('t.page'=>'comm/action/card.php', 't.param'=>'complete', 't.user_id'=>'0', 't.type'=>'createform', 't.entity'=>$conf->entity));
$result = $defaultValues->fetchAll('', '', 0, 0, array('t.page' => 'comm/action/card.php', 't.param' => 'complete', 't.user_id' => '0', 't.type' => 'createform', 't.entity' => $conf->entity));
if (!is_array($result) && $result < 0) {
setEventMessages($defaultValues->error, $defaultValues->errors, 'errors');
} elseif (count($result) > 0) {

View file

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -86,18 +87,16 @@ if ($action == 'set') {
// Search template files
$file = '';
$classname = '';
$filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/action/doc/pdf_".$modele.".modules.php", 0);
if (file_exists($file)) {
$filefound = 1;
$classname = "pdf_".$modele;
break;
}
}
if ($filefound) {
if ($classname !== '') {
require_once $file;
$module = new $classname($db, $commande);

View file

@ -3,6 +3,7 @@
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013-2018 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -131,18 +132,16 @@ if ($action == 'specimen') {
// Search template files
$file = '';
$classname = '';
$filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/bank/doc/pdf_".$modele.".modules.php", 0);
if (file_exists($file)) {
$filefound = 1;
$classname = "pdf_".$modele;
break;
}
}
if ($filefound) {
if ($classname !== '') {
require_once $file;
$module = new $classname($db);

View file

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2019 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -76,18 +77,16 @@ if ($action == 'updateMask') {
// Search template files
$file = '';
$classname = '';
$filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/bom/doc/pdf_".$modele.".modules.php", 0);
if (file_exists($file)) {
$filefound = 1;
$classname = "pdf_".$modele;
break;
}
}
if ($filefound) {
if ($classname !== '') {
require_once $file;
$module = new $classname($db);

View file

@ -10,6 +10,7 @@
* Copyright (C) 2011-2016 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -86,18 +87,16 @@ if ($action == 'updateMask') {
// Search template files
$file = '';
$classname = '';
$filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/commande/doc/pdf_".$modele.".modules.php", 0);
if (file_exists($file)) {
$filefound = 1;
$classname = "pdf_".$modele;
break;
}
}
if ($filefound) {
if ($classname !== '') {
require_once $file;
$module = new $classname($db);

View file

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2018 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -82,18 +83,16 @@ if ($action == 'updateMask') {
// Search template files
$file = '';
$classname = '';
$filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/contract/doc/pdf_".$modele.".modules.php", 0);
if (file_exists($file)) {
$filefound = 1;
$classname = "pdf_".$modele;
break;
}
}
if ($filefound) {
if ($classname !== '') {
require_once $file;
$module = new $classname($db);

View file

@ -8,6 +8,7 @@
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2018 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2015 Claudio Aschieri <c.aschieri@19.coop>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -58,7 +59,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
// Shipment note
if (isModEnabled('delivery_note') && !getDolGlobalString('MAIN_SUBMODULE_EXPEDITION')) {
if (isModEnabled('shipping') && !getDolGlobalString('MAIN_SUBMODULE_EXPEDITION')) {
// This option should always be set to on when module is on.
dolibarr_set_const($db, "MAIN_SUBMODULE_EXPEDITION", "1", 'chaine', 0, '', $conf->entity);
}
@ -131,18 +132,16 @@ if ($action == 'specimen') {
// Search template files
$file = '';
$classname = '';
$filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/delivery/doc/pdf_".$modele.".modules.php", 0);
if (file_exists($file)) {
$filefound = 1;
$classname = "pdf_".$modele;
break;
}
}
if ($filefound) {
if ($classname !== '') {
require_once $file;
$module = new $classname($db);

View file

@ -507,7 +507,7 @@ $tabcond[14] = (isModEnabled("product") && (isModEnabled('ecotax') || getDolGlob
$tabcond[15] = true;
$tabcond[16] = (isModEnabled("societe") && !getDolGlobalString('SOCIETE_DISABLE_PROSPECTS'));
$tabcond[17] = (isModEnabled('deplacement') || isModEnabled('expensereport'));
$tabcond[18] = isModEnabled("delivery_note") || isModEnabled("reception");
$tabcond[18] = isModEnabled("shipping") || isModEnabled("reception");
$tabcond[19] = isModEnabled("societe");
$tabcond[20] = isModEnabled("supplier_order");
$tabcond[21] = isModEnabled("propal");
@ -1227,9 +1227,9 @@ if ($id == 7 && GETPOST('from') == 'accountancy') {
$titlepicto = 'accountancy';
}
$param = '&id='.urlencode($id);
$param = '&id='.urlencode((string) ($id));
if ($search_country_id || GETPOSTISSET('page') || GETPOST('button_removefilter', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter_x', 'alpha')) {
$param .= '&search_country_id='.urlencode($search_country_id ? $search_country_id : -1);
$param .= '&search_country_id='.urlencode((string) ($search_country_id ? $search_country_id : -1));
}
if ($search_code != '') {
$param .= '&search_code='.urlencode($search_code);

View file

@ -68,7 +68,7 @@ class Dolistore
$langtmp = explode('_', $langs->defaultlang);
$lang = $langtmp[0];
$lang_array = array('en'=>1, 'fr'=>2, 'es'=>3, 'it'=>4, 'de'=>5); // Into table ps_lang of Prestashop - 1
$lang_array = array('en' => 1, 'fr' => 2, 'es' => 3, 'it' => 4, 'de' => 5); // Into table ps_lang of Prestashop - 1
if (!in_array($lang, array_keys($lang_array))) {
$lang = 'en';
}
@ -270,7 +270,7 @@ class Dolistore
// add image or default ?
if ($product->id_default_image != '') {
$image_url = DOL_URL_ROOT.'/admin/dolistore/ajax/image.php?id_product='.urlencode(((int) $product->id)).'&id_image='.urlencode(((int) $product->id_default_image));
$image_url = DOL_URL_ROOT.'/admin/dolistore/ajax/image.php?id_product='.urlencode((string) (((int) $product->id))).'&id_image='.urlencode((string) (((int) $product->id_default_image)));
$images = '<a href="'.$image_url.'" class="documentpreview" target="_blank" rel="noopener noreferrer" mime="image/png" title="'.dol_escape_htmltag($product->name->language[$this->lang - 1].', '.$langs->trans('Version').' '.$product->module_version).'">';
$images .= '<img src="'.$image_url.'&quality=home_default" style="max-height:250px;max-width: 210px;" alt="" /></a>';
} else {

View file

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2021 Florian Henry <florian.henry@scopen.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -47,20 +48,20 @@ $scandir = GETPOST('scan_dir', 'alpha');
$type = 'myobject';
$arrayofparameters = array(
'EVENTORGANIZATION_TASK_LABEL'=>array('type'=>'textarea','enabled'=>1),
'EVENTORGANIZATION_CATEG_THIRDPARTY_CONF'=>array('type'=>'category:'.Categorie::TYPE_CUSTOMER, 'enabled'=>1),
'EVENTORGANIZATION_CATEG_THIRDPARTY_BOOTH'=>array('type'=>'category:'.Categorie::TYPE_CUSTOMER, 'enabled'=>1),
'EVENTORGANIZATION_FILTERATTENDEES_CAT'=>array('type'=>'category:'.Categorie::TYPE_CUSTOMER, 'enabled'=>1),
'EVENTORGANIZATION_FILTERATTENDEES_TYPE'=>array('type'=>'thirdparty_type:', 'enabled'=>1),
'EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_CONF'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1),
'EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_BOOTH'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1),
'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1),
'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1),
'EVENTORGANIZATION_TASK_LABEL' => array('type' => 'textarea','enabled' => 1),
'EVENTORGANIZATION_CATEG_THIRDPARTY_CONF' => array('type' => 'category:'.Categorie::TYPE_CUSTOMER, 'enabled' => 1),
'EVENTORGANIZATION_CATEG_THIRDPARTY_BOOTH' => array('type' => 'category:'.Categorie::TYPE_CUSTOMER, 'enabled' => 1),
'EVENTORGANIZATION_FILTERATTENDEES_CAT' => array('type' => 'category:'.Categorie::TYPE_CUSTOMER, 'enabled' => 1),
'EVENTORGANIZATION_FILTERATTENDEES_TYPE' => array('type' => 'thirdparty_type:', 'enabled' => 1),
'EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_CONF' => array('type' => 'emailtemplate:conferenceorbooth', 'enabled' => 1),
'EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_BOOTH' => array('type' => 'emailtemplate:conferenceorbooth', 'enabled' => 1),
'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH' => array('type' => 'emailtemplate:conferenceorbooth', 'enabled' => 1),
'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT' => array('type' => 'emailtemplate:conferenceorbooth', 'enabled' => 1),
//'EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_SPEAKER'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1),
//'EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_ATTENDES'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1),
'SERVICE_BOOTH_LOCATION'=>array('type'=>'product', 'enabled'=>1),
'SERVICE_CONFERENCE_ATTENDEE_SUBSCRIPTION'=>array('type'=>'product', 'enabled'=>1),
'EVENTORGANIZATION_SECUREKEY'=>array('type'=>'securekey', 'enabled'=>1),
'SERVICE_BOOTH_LOCATION' => array('type' => 'product', 'enabled' => 1),
'SERVICE_CONFERENCE_ATTENDEE_SUBSCRIPTION' => array('type' => 'product', 'enabled' => 1),
'EVENTORGANIZATION_SECUREKEY' => array('type' => 'securekey', 'enabled' => 1),
);
$error = 0;
@ -80,7 +81,7 @@ if (empty($user->admin)) {
*/
if ($cancel) {
$action ='';
$action = '';
}
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
@ -111,18 +112,16 @@ if ($action == 'updateMask') {
// Search template files
$file = '';
$classname = '';
$filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/eventorganization/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0);
if (file_exists($file)) {
$filefound = 1;
$classname = "pdf_".$modele;
break;
}
}
if ($filefound) {
if ($classname !== '') {
require_once $file;
$module = new $classname($db);
@ -218,7 +217,7 @@ if ($action == 'edit') {
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
foreach ($arrayofparameters as $constname => $val) {
if ($val['enabled']==1) {
if ($val['enabled'] == 1) {
$setupnotempty++;
print '<tr class="oddeven"><td><!-- '.$constname.' -->';
$tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : '');
@ -230,7 +229,7 @@ if ($action == 'edit') {
print '<textarea class="flat" name="'.$constname.'" id="'.$constname.'" cols="50" rows="5" wrap="soft">' . "\n";
print getDolGlobalString($constname);
print "</textarea>\n";
} elseif ($val['type']== 'html') {
} elseif ($val['type'] == 'html') {
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
$doleditor = new DolEditor($constname, getDolGlobalString($constname), '', 160, 'dolibarr_notes', '', false, false, isModEnabled('fckeditor'), ROWS_5, '90%');
$doleditor->Create();
@ -300,7 +299,7 @@ if ($action == 'edit') {
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
foreach ($arrayofparameters as $constname => $val) {
if ($val['enabled']==1) {
if ($val['enabled'] == 1) {
$setupnotempty++;
print '<tr class="oddeven">';
print '<td><!-- '.$constname.' -->';
@ -311,7 +310,7 @@ if ($action == 'edit') {
if ($val['type'] == 'textarea') {
print dol_nl2br(getDolGlobalString($constname));
} elseif ($val['type']== 'html') {
} elseif ($val['type'] == 'html') {
print getDolGlobalString($constname);
} elseif ($val['type'] == 'yesno') {
print ajax_constantonoff($constname);
@ -348,13 +347,13 @@ if ($action == 'edit') {
print '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
}
} elseif (preg_match('/thirdparty_type/', $val['type'])) {
if (getDolGlobalString($constname)==2) {
if (getDolGlobalString($constname) == 2) {
print $langs->trans("Prospect");
} elseif (getDolGlobalString($constname)==3) {
} elseif (getDolGlobalString($constname) == 3) {
print $langs->trans("ProspectCustomer");
} elseif (getDolGlobalString($constname)==1) {
} elseif (getDolGlobalString($constname) == 1) {
print $langs->trans("Customer");
} elseif (getDolGlobalString($constname)==0) {
} elseif (getDolGlobalString($constname) == 0) {
print $langs->trans("NorProspectNorCustomer");
}
} elseif ($val['type'] == 'product') {

View file

@ -7,6 +7,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2018 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -102,18 +103,16 @@ if ($action == 'updateMask') {
// Search template files
$file = '';
$classname = '';
$filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/expedition/doc/pdf_".$modele.".modules.php", 0);
if (file_exists($file)) {
$filefound = 1;
$classname = "pdf_".$modele;
break;
}
}
if ($filefound) {
if ($classname !== '') {
require_once $file;
$module = new $classname($db);

View file

@ -7,6 +7,7 @@
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2022 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -83,18 +84,16 @@ if ($action == 'updateMask') {
// Search template files
$file = '';
$classname = '';
$filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/expensereport/doc/pdf_".$modele.".modules.php", 0);
if (file_exists($file)) {
$filefound = 1;
$classname = "pdf_".$modele;
break;
}
}
if ($filefound) {
if ($classname !== '') {
require_once $file;
$module = new $classname($db);

View file

@ -3,6 +3,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2019 Christophe Battarel <christophe@altairis.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/doleditor.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
// Load translation files required by the page
$langs->loadLangs(array('admin', 'fckeditor'));
$langs->loadLangs(array('admin', 'fckeditor', 'errors'));
$action = GETPOST('action', 'aZ09');
// Possible modes are:
@ -221,12 +222,12 @@ if (empty($conf->use_javascript_ajax)) {
if ($mode != 'Full_inline') {
$uselocalbrowser = true;
$readonly = ($mode == 'dolibarr_readonly' ? 1 : 0);
$editor = new DolEditor('formtestfield', isset($conf->global->FCKEDITOR_TEST) ? $conf->global->FCKEDITOR_TEST : 'Test', '', 200, $mode, 'In', true, $uselocalbrowser, 1, 120, 8, $readonly);
$editor = new DolEditor('formtestfield', getDolGlobalString('FCKEDITOR_TEST', 'Test'), '', 200, $mode, 'In', true, $uselocalbrowser, 1, 120, 8, $readonly);
$editor->Create();
} else {
// CKEditor inline enabled with the contenteditable="true"
print '<div style="border: 1px solid #888;" contenteditable="true">';
print $conf->global->FCKEDITOR_TEST;
print getDolGlobalString('FCKEDITOR_TEST');
print '</div>';
}
print $form->buttonsSaveCancel("Save", '', null, 0, 'reposition');

View file

@ -7,6 +7,7 @@
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2018 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -82,18 +83,16 @@ if ($action == 'updateMask') {
// Search template files
$file = '';
$classname = '';
$filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/fichinter/doc/pdf_".$modele.".modules.php", 0);
if (file_exists($file)) {
$filefound = 1;
$classname = "pdf_".$modele;
break;
}
}
if ($filefound) {
if ($classname !== '') {
require_once $file;
$module = new $classname($db);

View file

@ -3,6 +3,7 @@
* Copyright (C) 2011-2018 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -82,18 +83,16 @@ if ($action == 'updateMask') {
// Search template files
$file = '';
$classname = '';
$filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/holiday/doc/pdf_".$modele.".modules.php", 0);
if (file_exists($file)) {
$filefound = 1;
$classname = "pdf_".$modele;
break;
}
}
if ($filefound) {
if ($classname !== '') {
require_once $file;
$module = new $classname($db);

View file

@ -4,6 +4,7 @@
* Copyright (C) 2021 Greg Rastklan <greg.rastklan@atm-consulting.fr>
* Copyright (C) 2021 Jean-Pascal BOUDET <jean-pascal.boudet@atm-consulting.fr>
* Copyright (C) 2021 Grégory BLEMAND <gregory.blemand@atm-consulting.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -116,18 +117,16 @@ if ($action == 'update') {
// Search template files
$file = '';
$classname = '';
$filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/hrm/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0);
if (file_exists($file)) {
$filefound = 1;
$classname = "pdf_".$modele;
break;
}
}
if ($filefound) {
if ($classname !== '') {
require_once $file;
$module = new $classname($db);

View file

@ -7,6 +7,7 @@
* Copyright (C) 2012-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com>
* Copyright (C) 2022 Anthony Berton <anthony.berton@bb2a.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -99,18 +100,16 @@ if ($action == 'updateMask') {
// Search template files
$file = '';
$classname = '';
$filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/facture/doc/pdf_".$modele.".modules.php", 0);
if (file_exists($file)) {
$filefound = 1;
$classname = "pdf_".$modele;
break;
}
}
if ($filefound) {
if ($classname !== '') {
require_once $file;
$module = new $classname($db);
@ -150,8 +149,7 @@ if ($action == 'updateMask') {
$ret = addDocumentModel($value, $type, $label, $scandir);
}
} elseif ($action == 'setmod') {
// TODO Verifier si module numerotation choisi peut etre active
// par appel method canBeActivated
// TODO Check if numbering module chosen can ba activated by calling method canBeActivated()
dolibarr_set_const($db, "FACTURE_ADDON", $value, 'chaine', 0, '', $conf->entity);
} elseif ($action == 'setribchq') {
@ -619,13 +617,14 @@ if (getDolGlobalString('INVOICE_USE_DEFAULT_DOCUMENT')) { // Hidden conf
print '<form action="'.$_SERVER["PHP_SELF"].'#default-pdf-modules-by-type-table" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'" />';
print '<input type="hidden" name="action" value="setDefaultPDFModulesByType" >';
print '<input type="hidden" name="page_y" value="" />';
print '<div class="div-table-responsive-no-min">';
print '<table id="default-pdf-modules-by-type-table" class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Type").'</td>';
print '<td>'.$langs->trans("Name").'</td>';
print '<td class="right"><input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'"></td>';
print '<td class="right"><input type="submit" class="button button-edit reposition" value="'.$langs->trans("Modify").'"></td>';
print "</tr>\n";
$listtype = array(
@ -661,6 +660,7 @@ print load_fiche_titre($langs->trans("SuggestedPaymentModesIfNotDefinedInInvoice
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'" />';
print '<input type="hidden" name="page_y" value="" />';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
@ -669,17 +669,16 @@ print '<tr class="liste_titre">';
print '<td>';
print '<input type="hidden" name="action" value="setribchq">';
print $langs->trans("PaymentMode").'</td>';
print '<td class="right"><input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'"></td>';
print '<td class="right"><input type="submit" class="button button-edit reposition" value="'.$langs->trans("Modify").'"></td>';
print "</tr>\n";
print '<tr class="oddeven">';
print "<td>".$langs->trans("SuggestPaymentByRIBOnAccount")."</td>";
print "<td>";
if (isModEnabled('bank')) {
$sql = "SELECT rowid, label";
$sql = "SELECT rowid, label, clos";
$sql .= " FROM ".MAIN_DB_PREFIX."bank_account";
$sql .= " WHERE clos = 0";
$sql .= " AND courant = 1";
$sql .= " WHERE courant = 1";
$sql .= " AND entity IN (".getEntity('bank_account').")";
$resql = $db->query($sql);
if ($resql) {
@ -689,15 +688,19 @@ if (isModEnabled('bank')) {
print '<select name="rib" class="flat" id="rib">';
print '<option value="0">'.$langs->trans("DoNotSuggestPaymentMode").'</option>';
while ($i < $num) {
$row = $db->fetch_row($resql);
$obj = $db->fetch_object($resql);
print '<option value="'.$row[0].'"';
print $conf->global->FACTURE_RIB_NUMBER == $row[0] ? ' selected' : '';
print '>'.$row[1].'</option>';
print '<option value="'.$obj->rowid.'"';
print getDolGlobalString('FACTURE_RIB_NUMBER') == $obj->rowid ? ' selected' : '';
if (!empty($obj->clos)) {
print ' disabled';
}
print '>'.dol_escape_htmltag($obj->label).'</option>';
$i++;
}
print "</select>";
print ajax_combobox("rib");
} else {
print '<span class="opacitymedium">'.$langs->trans("NoActiveBankAccountDefined").'</span>';
}
@ -737,6 +740,8 @@ if ($resql) {
}
}
print "</select>";
print ajax_combobox("chq", array(), 0, 0, 'resolve', -2);
print "</td></tr>";
print "</table>";
print '</div>';
@ -759,12 +764,13 @@ print "</tr>\n";
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'" />';
print '<input type="hidden" name="action" value="setforcedate" />';
print '<input type="hidden" name="page_y" value="" />';
print '<tr class="oddeven"><td>';
print $langs->trans("ForceInvoiceDate");
print '</td><td width="60" class="center">';
print $form->selectyesno("forcedate", getDolGlobalInt('FAC_FORCE_DATE_VALIDATION', 0), 1);
print '</td><td class="right">';
print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'" />';
print '<input type="submit" class="button button-edit reposition" value="'.$langs->trans("Modify").'" />';
print "</td></tr>\n";
print '</form>';
@ -779,6 +785,7 @@ $htmltext .= '</i>';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'" />';
print '<input type="hidden" name="action" value="set_INVOICE_FREE_TEXT" />';
print '<input type="hidden" name="page_y" value="" />';
print '<tr class="oddeven"><td colspan="2">';
print $form->textwithpicto($langs->trans("FreeLegalTextOnInvoices"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
$variablename = 'INVOICE_FREE_TEXT';
@ -790,7 +797,7 @@ if (!getDolGlobalString('PDF_ALLOW_HTML_FOR_FREE_TEXT')) {
print $doleditor->Create();
}
print '</td><td class="right">';
print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'" />';
print '<input type="submit" class="button button-edit reposition" value="'.$langs->trans("Modify").'" />';
print "</td></tr>\n";
print '</form>';
@ -798,12 +805,13 @@ print '</form>';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'" />';
print '<input type="hidden" name="action" value="set_FACTURE_DRAFT_WATERMARK" />';
print '<input type="hidden" name="page_y" value="" />';
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("WatermarkOnDraftBill"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
print '</td>';
print '<td><input class="flat minwidth200imp" type="text" name="FACTURE_DRAFT_WATERMARK" value="'.dol_escape_htmltag(getDolGlobalString('FACTURE_DRAFT_WATERMARK')).'">';
print '</td><td class="right">';
print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'" />';
print '<input type="submit" class="button button-edit reposition" value="'.$langs->trans("Modify").'" />';
print "</td></tr>\n";
print '</form>';

View file

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2021 SuperAdmin
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -94,18 +95,16 @@ if ($action == 'updateMask') {
// Search template files
$file = '';
$classname = '';
$filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/knowledgemanagement/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0);
if (file_exists($file)) {
$filefound = 1;
$classname = "pdf_".$modele;
break;
}
}
if ($filefound) {
if ($classname !== '') {
require_once $file;
$module = new $classname($db);

View file

@ -273,9 +273,9 @@ if ($action == 'edit') {
jQuery("#MAIN_MAIL_SMTP_SERVER").show();
jQuery("#MAIN_MAIL_SMTP_PORT").show();
jQuery("#smtp_server_mess").hide();
jQuery("#smtp_port_mess").hide();
jQuery("#smtp_port_mess").hide();
jQuery(".smtp_method").show();
jQuery(".dkim").hide();
jQuery(".dkim").hide();
jQuery(".smtp_auth_method").show();
}
if (jQuery("#MAIN_MAIL_SENDMODE").val()==\'swiftmailer\')
@ -302,9 +302,9 @@ if ($action == 'edit') {
jQuery("#MAIN_MAIL_SMTP_PORT").show();
jQuery("#smtp_server_mess").hide();
jQuery("#smtp_port_mess").hide();
jQuery(".smtp_method").show();
jQuery(".smtp_method").show();
jQuery(".dkim").show();
jQuery(".smtp_auth_method").show();
jQuery(".smtp_auth_method").show();
}
}
function change_smtp_auth_method() {
@ -1109,7 +1109,7 @@ if ($action == 'edit') {
$formmail->withtopicreadonly = 0;
$formmail->withfile = 2;
$formmail->withlayout = 1;
$formmail->withaiprompt = 1;
$formmail->withaiprompt = ($action == 'testhtml' ? 'html' : 'text');
$formmail->withbody = (GETPOSTISSET('message') ? GETPOST('message', 'restricthtml') : ($action == 'testhtml' ? $langs->transnoentities("PredefinedMailTestHtml") : $langs->transnoentities("PredefinedMailTest")));
$formmail->withbodyreadonly = 0;
$formmail->withcancel = 1;

View file

@ -108,11 +108,11 @@ foreach ($object->fields as $key => $val) {
if (!empty($val['visible'])) {
$visible = (int) dol_eval($val['visible'], 1);
$arrayfields['t.'.$key] = array(
'label'=>$val['label'],
'checked'=>(($visible < 0) ? 0 : 1),
'enabled'=>(abs($visible) != 3 && (int) dol_eval($val['enabled'], 1)),
'position'=>$val['position'],
'help'=> isset($val['help']) ? $val['help'] : ''
'label' => $val['label'],
'checked' => (($visible < 0) ? 0 : 1),
'enabled' => (abs($visible) != 3 && (int) dol_eval($val['enabled'], 1)),
'position' => $val['position'],
'help' => isset($val['help']) ? $val['help'] : ''
);
}
}
@ -121,10 +121,10 @@ if (!empty($extrafields->attributes[$object->table_element]['label']) && is_arra
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) {
$arrayfields["ef.".$key] = array(
'label'=>$extrafields->attributes[$object->table_element]['label'][$key],
'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1),
'position'=>$extrafields->attributes[$object->table_element]['pos'][$key],
'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key])
'label' => $extrafields->attributes[$object->table_element]['label'][$key],
'checked' => (($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1),
'position' => $extrafields->attributes[$object->table_element]['pos'][$key],
'enabled' => (abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key])
);
}
}
@ -591,7 +591,7 @@ foreach ($object->fields as $key => $val) {
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields);
$parameters = array('arrayfields' => $arrayfields);
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
@ -635,7 +635,7 @@ foreach ($object->fields as $key => $val) {
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray);
$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
@ -706,7 +706,7 @@ while ($i < $imaxinloop) {
$url .= '&limit='.((int) $limit);
}
if ($page) {
$url .= '&page='.urlencode($page);
$url .= '&page='.urlencode((string) ($page));
}
if ($sortfield) {
$url .= '&sortfield='.urlencode($sortfield);
@ -783,7 +783,7 @@ while ($i < $imaxinloop) {
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
@ -796,7 +796,7 @@ while ($i < $imaxinloop) {
$url .= '&limit='.((int) $limit);
}
if ($page) {
$url .= '&page='.urlencode($page);
$url .= '&page='.urlencode((string) ($page));
}
if ($sortfield) {
$url .= '&sortfield='.urlencode($sortfield);
@ -845,7 +845,7 @@ if ($num == 0) {
$db->free($resql);
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;

View file

@ -204,7 +204,7 @@ if (isModEnabled('order') && $user->hasRight('commande', 'lire')) {
if (isModEnabled('invoice') && $user->hasRight('facture', 'lire')) {
$elementList['facture_send'] = img_picto('', 'bill', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendInvoice'));
}
if (isModEnabled("delivery_note")) {
if (isModEnabled("shipping")) {
$elementList['shipping_send'] = img_picto('', 'dolly', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendShipment'));
}
if (isModEnabled("reception")) {

View file

@ -2,6 +2,7 @@
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2022 Charlene Benke <charlene@patas-monkey.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -77,7 +78,7 @@ print '<!-- Force style container -->'."\n".'<style>
}
</style>';
$arrayofnatures = array('core'=>$langs->transnoentitiesnoconv("Core"), 'external'=>$langs->transnoentitiesnoconv("External").' - '.$langs->trans("AllPublishers"));
$arrayofnatures = array('core' => $langs->transnoentitiesnoconv("Core"), 'external' => $langs->transnoentitiesnoconv("External").' - '.$langs->trans("AllPublishers"));
// Search modules dirs
$modulesdir = dolGetModulesDirs();
@ -116,6 +117,7 @@ foreach ($modulesdir as $dir) {
if (class_exists($modName)) {
try {
$objMod = new $modName($db);
'@phan-var-force DolibarrModules $objMod';
$modNameLoaded[$modName] = $dir;
if (!$objMod->numero > 0 && $modName != 'modUser') {
@ -168,6 +170,9 @@ foreach ($modulesdir as $dir) {
} else {
$familykey = $objMod->family;
}
if (empty($familykey) || $familykey === null) {
$familykey = 'other';
}
$moduleposition = ($objMod->module_position ? $objMod->module_position : '50');
if ($moduleposition == '50' && ($objMod->isCoreOrExternalModule() == 'external')) {
@ -235,7 +240,10 @@ foreach ($orders as $tmpkey => $tmpvalue) {
}
$value = $orders[$key];
$tab = explode('_', $value);
$familyposition = $tab[0]; $familykey = $tab[1]; $module_position = $tab[2]; $numero = $tab[3];
$familyposition = $tab[0];
$familykey = $tab[1];
$module_position = $tab[2];
$numero = $tab[3];

View file

@ -9,6 +9,7 @@
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2021-2023 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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
@ -460,7 +461,7 @@ foreach ($modulesdir as $dir) {
$arrayofwarningsext[$modName] = $objMod->warnings_activation_ext;
}
$familyposition = (empty($familyinfo[$familykey]['position']) ? 0 : $familyinfo[$familykey]['position']);
$familyposition = (empty($familyinfo[$familykey]['position']) ? '0' : $familyinfo[$familykey]['position']);
$listOfOfficialModuleGroups = array('hr', 'technic', 'interface', 'technic', 'portal', 'financial', 'crm', 'base', 'products', 'srm', 'ecm', 'projects', 'other');
if ($external && !in_array($familykey, $listOfOfficialModuleGroups)) {
// If module is extern and into a custom group (not into an official predefined one), it must appear at end (custom groups should not be before official groups).
@ -1253,36 +1254,36 @@ if ($mode == 'deploy') {
$maxphp = @ini_get('upload_max_filesize'); // In unknown
if (preg_match('/k$/i', $maxphp)) {
$maxphp = preg_replace('/k$/i', '', $maxphp);
$maxphp = $maxphp * 1;
$maxphp *= 1;
}
if (preg_match('/m$/i', $maxphp)) {
$maxphp = preg_replace('/m$/i', '', $maxphp);
$maxphp = $maxphp * 1024;
$maxphp *= 1024;
}
if (preg_match('/g$/i', $maxphp)) {
$maxphp = preg_replace('/g$/i', '', $maxphp);
$maxphp = $maxphp * 1024 * 1024;
$maxphp *= 1024 * 1024;
}
if (preg_match('/t$/i', $maxphp)) {
$maxphp = preg_replace('/t$/i', '', $maxphp);
$maxphp = $maxphp * 1024 * 1024 * 1024;
$maxphp *= 1024 * 1024 * 1024;
}
$maxphp2 = @ini_get('post_max_size'); // In unknown
if (preg_match('/k$/i', $maxphp2)) {
$maxphp2 = preg_replace('/k$/i', '', $maxphp2);
$maxphp2 = $maxphp2 * 1;
$maxphp2 *= 1;
}
if (preg_match('/m$/i', $maxphp2)) {
$maxphp2 = preg_replace('/m$/i', '', $maxphp2);
$maxphp2 = $maxphp2 * 1024;
$maxphp2 *= 1024;
}
if (preg_match('/g$/i', $maxphp2)) {
$maxphp2 = preg_replace('/g$/i', '', $maxphp2);
$maxphp2 = $maxphp2 * 1024 * 1024;
$maxphp2 *= 1024 * 1024;
}
if (preg_match('/t$/i', $maxphp2)) {
$maxphp2 = preg_replace('/t$/i', '', $maxphp2);
$maxphp2 = $maxphp2 * 1024 * 1024 * 1024;
$maxphp2 *= 1024 * 1024 * 1024;
}
// Now $max and $maxphp and $maxphp2 are in Kb
$maxmin = $max;

View file

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2019 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -77,18 +78,16 @@ if ($action == 'updateMask') {
// Search template files
$file = '';
$classname = '';
$filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/mrp/doc/pdf_".$modele.".modules.php", 0);
if (file_exists($file)) {
$filefound = 1;
$classname = "pdf_".$modele;
break;
}
}
if ($filefound) {
if ($classname !== '') {
require_once $file;
$module = new $classname($db);

View file

@ -7,6 +7,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -82,18 +83,16 @@ if ($action == 'updateMask') {
// Search template files
$file = '';
$classname = '';
$filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/propale/doc/pdf_".$modele.".modules.php");
if (file_exists($file)) {
$filefound = 1;
$classname = "pdf_".$modele;
break;
}
}
if ($filefound) {
if ($classname !== '') {
require_once $file;
$module = new $classname($db);

View file

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2018 Quentin Vial-Gouteyron <quentin.vial-gouteyron@atm-consulting.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -105,18 +106,16 @@ if ($action == 'updateMask') {
// Search template files
$file = '';
$classname = '';
$filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/reception/doc/pdf_".$modele.".modules.php", 0);
if (file_exists($file)) {
$filefound = 1;
$classname = "pdf_".$modele;
break;
}
}
if ($filefound) {
if ($classname !== '') {
require_once $file;
$module = new $classname($db);

View file

@ -5,6 +5,7 @@
* Copyright (C) 2012-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013-2018 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -109,18 +110,16 @@ if ($action == 'specimen') {
// Search template files
$file = '';
$classname = '';
$filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/stock/doc/pdf_".$modele.".modules.php", 0);
if (file_exists($file)) {
$filefound = 1;
$classname = "pdf_".$modele;
break;
}
}
if ($filefound) {
if ($classname !== '') {
require_once $file;
$module = new $classname($db);
@ -270,7 +269,7 @@ print '<!-- STOCK_CALCULATE_ON_SHIPMENT -->';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("DeStockOnShipment").'</td>';
print '<td class="right">';
if (isModEnabled("delivery_note")) {
if (isModEnabled("shipping")) {
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT', array(), null, 0, 0, 0, 2, 1, '', '', 'reposition');
} else {
@ -287,7 +286,7 @@ print '<!-- STOCK_CALCULATE_ON_SHIPMENT_CLOSE -->';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("DeStockOnShipmentOnClosing").'</td>';
print '<td class="right">';
if (isModEnabled("delivery_note")) {
if (isModEnabled("shipping")) {
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT_CLOSE', array(), null, 0, 0, 0, 2, 1, '', '', 'reposition');
} else {
@ -461,7 +460,7 @@ if (isModEnabled('order')) {
print "</tr>\n";
}
if (isModEnabled("delivery_note")) {
if (isModEnabled("shipping")) {
print '<tr class="oddeven">';
print '<td>'.$langs->trans("StockMustBeEnoughForShipment").'</td>';
print '<td class="right">';

View file

@ -2,6 +2,7 @@
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2021 SuperAdmin
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -91,18 +92,16 @@ if ($action == 'updateMask') {
// Search template files
$file = '';
$classname = '';
$filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/stocktransfer/doc/pdf_".$modele.".modules.php", 0);
if (file_exists($file)) {
$filefound = 1;
$classname = "pdf_".$modele;
break;
}
}
if ($filefound) {
if ($classname !== '') {
require_once $file;
$module = new $classname($db);

View file

@ -6,6 +6,7 @@
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2018 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -102,18 +103,16 @@ if ($action == 'specimen') { // For invoices
// Search template files
$file = '';
$classname = '';
$filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/supplier_invoice/doc/pdf_".$modele.".modules.php", 0);
if (file_exists($file)) {
$filefound = 1;
$classname = "pdf_".$modele;
break;
}
}
if ($filefound) {
if ($classname !== '') {
require_once $file;
$module = new $classname($db, $facture);

View file

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
@ -92,18 +93,16 @@ if ($action == 'specimen') { // For orders
// Search template files
$file = '';
$classname = '';
$filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/supplier_order/doc/pdf_".$modele.".modules.php", 0);
if (file_exists($file)) {
$filefound = 1;
$classname = "pdf_".$modele;
break;
}
}
if ($filefound) {
if ($classname !== '') {
require_once $file;
$module = new $classname($db, $commande);

View file

@ -2,6 +2,7 @@
/* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2020 Maxime DEMAREST <maxime@indelog.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -103,18 +104,16 @@ if ($action == 'updateMask') {
// Search template files
$file = '';
$classname = '';
$filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/supplier_payment/doc/pdf_".$modele.".modules.php", 0);
if (file_exists($file)) {
$filefound = 1;
$classname = "pdf_".$modele;
break;
}
}
if ($filefound) {
if ($classname !== '') {
require_once $file;
$module = new $classname($db);

View file

@ -8,6 +8,7 @@
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -81,18 +82,16 @@ if ($action == 'specimen') {
// Search template files
$file = '';
$classname = '';
$filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/supplier_proposal/doc/pdf_".$modele.".modules.php");
if (file_exists($file)) {
$filefound = 1;
$classname = "pdf_".$modele;
break;
}
}
if ($filefound) {
if ($classname !== '') {
require_once $file;
$module = new $classname($db);

View file

@ -4,6 +4,7 @@
* Copyright (C) 2007-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015-2019 Frederic France <frederic.france@netlogic.fr>
* Copyright (C) 2017 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -83,7 +84,7 @@ $xmlshortfile = dol_sanitizeFileName(GETPOST('xmlshortfile', 'alpha') ? GETPOST(
$xmlfile = DOL_DOCUMENT_ROOT.'/install/'.$xmlshortfile;
if (!preg_match('/\.zip$/i', $xmlfile) && dol_is_file($xmlfile.'.zip')) {
$xmlfile = $xmlfile.'.zip';
$xmlfile .= '.zip';
}
// Remote file to compare to
@ -183,7 +184,7 @@ if (GETPOST('target') == 'remote') {
libxml_disable_entity_loader(true);
}
$xml = simplexml_load_string($xmlfile, 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET);
$xml = simplexml_load_string($xmlfile, 'SimpleXMLElement', LIBXML_NOCDATA | LIBXML_NONET);
} else {
$errormsg = $langs->trans('XmlNotFound').': '.$xmlremote.' - '.$xmlarray['http_code'].(($xmlarray['http_code'] == 400 && $xmlarray['content']) ? ' '.$xmlarray['content'] : '').' '.$xmlarray['curl_error_no'].' '.$xmlarray['curl_error_msg'];
setEventMessages($errormsg, null, 'errors');
@ -259,7 +260,7 @@ if (empty($error) && !empty($xml)) {
$tmprelativefilename = preg_replace('/^'.preg_quote(DOL_DOCUMENT_ROOT, '/').'/', '', $valfile['fullname']);
if (!in_array($tmprelativefilename, $file_list['insignature'])) {
$md5newfile = @md5_file($valfile['fullname']); // Can fails if we don't have permission to open/read file
$file_list['added'][] = array('filename'=>$tmprelativefilename, 'md5'=>$md5newfile);
$file_list['added'][] = array('filename' => $tmprelativefilename, 'md5' => $md5newfile);
}
}

View file

@ -2,6 +2,7 @@
/* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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
@ -308,21 +309,37 @@ print '</tr>';
// sort list
if ($sortfield == "name" && $sortorder == "asc") {
usort($moduleList, function (stdClass $a, stdClass $b) {
return strcasecmp($a->name, $b->name);
});
usort(
$moduleList,
/** @return bool */
function (stdClass $a, stdClass $b) {
return strcasecmp($a->name, $b->name);
}
);
} elseif ($sortfield == "name" && $sortorder == "desc") {
usort($moduleList, function (stdClass $a, stdClass $b) {
return strcasecmp($b->name, $a->name);
});
usort(
$moduleList,
/** @return bool */
static function (stdClass $a, stdClass $b) {
return strcasecmp($b->name, $a->name);
}
);
} elseif ($sortfield == "version" && $sortorder == "asc") {
usort($moduleList, function (stdClass $a, stdClass $b) {
return strcasecmp($a->version, $b->version);
});
usort(
$moduleList,
/** @return bool */
static function (stdClass $a, stdClass $b) {
return strcasecmp($a->version, $b->version);
}
);
} elseif ($sortfield == "version" && $sortorder == "desc") {
usort($moduleList, function (stdClass $a, stdClass $b) {
return strcasecmp($b->version, $a->version);
});
usort(
$moduleList,
/** @return bool */
static function (stdClass $a, stdClass $b) {
return strcasecmp($b->version, $a->version);
}
);
} elseif ($sortfield == "id" && $sortorder == "asc") {
usort($moduleList, "compareIdAsc");
} elseif ($sortfield == "id" && $sortorder == "desc") {

View file

@ -4,6 +4,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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
@ -53,36 +54,36 @@ if (isset($title)) {
$maxphp = @ini_get('upload_max_filesize'); // In unknown
if (preg_match('/k$/i', $maxphp)) {
$maxphp = preg_replace('/k$/i', '', $maxphp);
$maxphp = $maxphp * 1;
$maxphp *= 1;
}
if (preg_match('/m$/i', $maxphp)) {
$maxphp = preg_replace('/m$/i', '', $maxphp);
$maxphp = $maxphp * 1024;
$maxphp *= 1024;
}
if (preg_match('/g$/i', $maxphp)) {
$maxphp = preg_replace('/g$/i', '', $maxphp);
$maxphp = $maxphp * 1024 * 1024;
$maxphp *= 1024 * 1024;
}
if (preg_match('/t$/i', $maxphp)) {
$maxphp = preg_replace('/t$/i', '', $maxphp);
$maxphp = $maxphp * 1024 * 1024 * 1024;
$maxphp *= 1024 * 1024 * 1024;
}
$maxphp2 = @ini_get('post_max_size'); // In unknown
if (preg_match('/k$/i', $maxphp2)) {
$maxphp2 = preg_replace('/k$/i', '', $maxphp2);
$maxphp2 = $maxphp2 * 1;
$maxphp2 *= 1;
}
if (preg_match('/m$/i', $maxphp2)) {
$maxphp2 = preg_replace('/m$/i', '', $maxphp2);
$maxphp2 = $maxphp2 * 1024;
$maxphp2 *= 1024;
}
if (preg_match('/g$/i', $maxphp2)) {
$maxphp2 = preg_replace('/g$/i', '', $maxphp2);
$maxphp2 = $maxphp2 * 1024 * 1024;
$maxphp2 *= 1024 * 1024;
}
if (preg_match('/t$/i', $maxphp2)) {
$maxphp2 = preg_replace('/t$/i', '', $maxphp2);
$maxphp2 = $maxphp2 * 1024 * 1024 * 1024;
$maxphp2 *= 1024 * 1024 * 1024;
}
if ($maxphp > 0 && $maxphp2 > 0 && $maxphp > $maxphp2) {
$langs->load("errors");

View file

@ -341,12 +341,13 @@ if (!getDolGlobalString('SECURITY_DISABLE_TEST_ON_OBFUSCATED_CONF')) {
}
print '<strong>$dolibarr_main_stream_to_disable</strong>: ';
// $arrayofstreamtodisable is defined into filefunc.inc.php
if (empty($dolibarr_main_stream_to_disable)) {
print '<span class="opacitymedium">'.$langs->trans("Undefined").' = '.implode(', ', $arrayofstreamtodisable).'</span>';
} else {
print implode(', ', $dolibarr_main_stream_to_disable);
}
print '<span class="bold"> -> PHP streams allowed = </span>';
print '<span class="bold"> -> Current PHP streams allowed = </span>';
$arrayofstreams = stream_get_wrappers();
if (!empty($arrayofstreams)) {
sort($arrayofstreams);

View file

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2009-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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
@ -90,7 +91,12 @@ if (function_exists('socket_create')) {
//$client = socket_accept($sock);
$client = socket_connect($socket, $address, $port);
if ($client) {
print "Connection established: ".$client." - address=".$address." port=".$port."<br>\n";
if (is_bool($client)) {
$client_str = 'true';
} else {
$client_str = (string) $client;
}
print "Connection established: ".$client_str." - address=".$address." port=".$port."<br>\n";
print "There is a Remote debug server at this address.<br>\n";
print "<br>\n";
print "To be sure this debugger accepts input from your PHP server and xdebug, be sure to have\n";

View file

@ -191,7 +191,7 @@ if (in_array($type, array('mysql', 'mysqli'))) {
print '<label for="radio_dump_postgresql">PostgreSQL Dump (pg_dump)</label>';
print '</div>';
} else {
print 'No method available with database '.$label;
print 'No method available with database '.dol_escape_htmltag($label);
}
print '</fieldset>';
print '</div>';

View file

@ -278,7 +278,7 @@ if ($result) {
$param .= '&optioncss='.urlencode($optioncss);
}
if ($search_rowid) {
$param .= '&search_rowid='.urlencode($search_rowid);
$param .= '&search_rowid='.urlencode((string) ($search_rowid));
}
if ($search_code) {
$param .= '&search_code='.urlencode($search_code);

View file

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -99,18 +100,16 @@ if ($action == 'updateMask') {
// Search template files
$file = '';
$classname = '';
$filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/webhook/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0);
if (file_exists($file)) {
$filefound = 1;
$classname = "pdf_".$modele."_".strtolower($tmpobjectkey);
break;
}
}
if ($filefound) {
if ($classname !== '') {
require_once $file;
$module = new $classname($db);

View file

@ -3,6 +3,7 @@
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2021 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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
@ -60,96 +61,96 @@ clearstatcache();
$workflowcodes = array(
// Automatic creation
'WORKFLOW_PROPAL_AUTOCREATE_ORDER'=>array(
'family'=>'create',
'position'=>10,
'enabled'=>(isModEnabled("propal") && isModEnabled('order')),
'picto'=>'order'
'WORKFLOW_PROPAL_AUTOCREATE_ORDER' => array(
'family' => 'create',
'position' => 10,
'enabled' => (isModEnabled("propal") && isModEnabled('order')),
'picto' => 'order'
),
'WORKFLOW_ORDER_AUTOCREATE_INVOICE'=>array(
'family'=>'create',
'position'=>20,
'enabled'=>(isModEnabled('order') && isModEnabled('invoice')),
'picto'=>'bill'
'WORKFLOW_ORDER_AUTOCREATE_INVOICE' => array(
'family' => 'create',
'position' => 20,
'enabled' => (isModEnabled('order') && isModEnabled('invoice')),
'picto' => 'bill'
),
'WORKFLOW_TICKET_CREATE_INTERVENTION' => array(
'family'=>'create',
'position'=>25,
'enabled'=>(isModEnabled('ticket') && isModEnabled('intervention')),
'picto'=>'ticket'
'family' => 'create',
'position' => 25,
'enabled' => (isModEnabled('ticket') && isModEnabled('intervention')),
'picto' => 'ticket'
),
'separator1'=>array('family'=>'separator', 'position'=>25, 'title'=>'', 'enabled'=>((isModEnabled("propal") && isModEnabled('order')) || (isModEnabled('order') && isModEnabled('invoice')) || (isModEnabled('ticket') && isModEnabled('intervention')))),
'separator1' => array('family' => 'separator', 'position' => 25, 'title' => '', 'enabled' => ((isModEnabled("propal") && isModEnabled('order')) || (isModEnabled('order') && isModEnabled('invoice')) || (isModEnabled('ticket') && isModEnabled('intervention')))),
// Automatic classification of proposal
'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL'=>array(
'family'=>'classify_proposal',
'position'=>30,
'enabled'=>(isModEnabled("propal") && isModEnabled('order')),
'picto'=>'propal',
'warning'=>''
'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL' => array(
'family' => 'classify_proposal',
'position' => 30,
'enabled' => (isModEnabled("propal") && isModEnabled('order')),
'picto' => 'propal',
'warning' => ''
),
'WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL'=>array(
'family'=>'classify_proposal',
'position'=>31,
'enabled'=>(isModEnabled("propal") && isModEnabled('invoice')),
'picto'=>'propal',
'warning'=>''
'WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL' => array(
'family' => 'classify_proposal',
'position' => 31,
'enabled' => (isModEnabled("propal") && isModEnabled('invoice')),
'picto' => 'propal',
'warning' => ''
),
// Automatic classification of order
'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING'=>array( // when shipping validated
'family'=>'classify_order',
'position'=>40,
'enabled'=>(isModEnabled("delivery_note") && isModEnabled('order')),
'picto'=>'order'
'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING' => array( // when shipping validated
'family' => 'classify_order',
'position' => 40,
'enabled' => (isModEnabled("shipping") && isModEnabled('order')),
'picto' => 'order'
),
'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED'=>array( // when shipping closed
'family'=>'classify_order',
'position'=>41,
'enabled'=>(isModEnabled("delivery_note") && isModEnabled('order')),
'picto'=>'order'
'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED' => array( // when shipping closed
'family' => 'classify_order',
'position' => 41,
'enabled' => (isModEnabled("shipping") && isModEnabled('order')),
'picto' => 'order'
),
'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER'=>array(
'family'=>'classify_order',
'position'=>42,
'enabled'=>(isModEnabled('invoice') && isModEnabled('order')),
'picto'=>'order',
'warning'=>''
'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER' => array(
'family' => 'classify_order',
'position' => 42,
'enabled' => (isModEnabled('invoice') && isModEnabled('order')),
'picto' => 'order',
'warning' => ''
), // For this option, if module invoice is disabled, it does not exists, so "Classify billed" for order must be done manually from order card.
// Automatic classification supplier proposal
'WORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL'=>array(
'family'=>'classify_supplier_proposal',
'position'=>60,
'enabled'=>(isModEnabled('supplier_proposal') && (isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))),
'picto'=>'supplier_proposal',
'warning'=>''
'WORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL' => array(
'family' => 'classify_supplier_proposal',
'position' => 60,
'enabled' => (isModEnabled('supplier_proposal') && (isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))),
'picto' => 'supplier_proposal',
'warning' => ''
),
// Automatic classification supplier order
'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION'=>array(
'family'=>'classify_supplier_order',
'position'=>63,
'enabled'=>(getDolGlobalString('MAIN_FEATURES_LEVEL') && isModEnabled("reception") && isModEnabled('supplier_order')),
'picto'=>'supplier_order',
'warning'=>''
'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION' => array(
'family' => 'classify_supplier_order',
'position' => 63,
'enabled' => (getDolGlobalString('MAIN_FEATURES_LEVEL') && isModEnabled("reception") && isModEnabled('supplier_order')),
'picto' => 'supplier_order',
'warning' => ''
),
'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION_CLOSED'=>array(
'family'=>'classify_supplier_order',
'position'=>64,
'enabled'=>(getDolGlobalString('MAIN_FEATURES_LEVEL') && isModEnabled("reception") && isModEnabled('supplier_order')),
'picto'=>'supplier_order',
'warning'=>''
'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION_CLOSED' => array(
'family' => 'classify_supplier_order',
'position' => 64,
'enabled' => (getDolGlobalString('MAIN_FEATURES_LEVEL') && isModEnabled("reception") && isModEnabled('supplier_order')),
'picto' => 'supplier_order',
'warning' => ''
),
'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER'=>array(
'family'=>'classify_supplier_order',
'position'=>65,
'enabled'=>(isModEnabled("supplier_order") || isModEnabled("supplier_invoice")),
'picto'=>'supplier_order',
'warning'=>''
'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER' => array(
'family' => 'classify_supplier_order',
'position' => 65,
'enabled' => (isModEnabled("supplier_order") || isModEnabled("supplier_invoice")),
'picto' => 'supplier_order',
'warning' => ''
),
// Automatic classification shipping
@ -166,7 +167,7 @@ $workflowcodes = array(
'WORKFLOW_SHIPPING_CLASSIFY_BILLED_INVOICE' => array(
'family' => 'classify_shipping',
'position' => 91,
'enabled' => isModEnabled("delivery_note") && isModEnabled("invoice") && getDolGlobalString('WORKFLOW_BILL_ON_SHIPMENT') !== '0',
'enabled' => isModEnabled("shipping") && isModEnabled("invoice") && getDolGlobalString('WORKFLOW_BILL_ON_SHIPMENT') !== '0',
'picto' => 'shipment'
),
@ -188,7 +189,7 @@ $workflowcodes = array(
),
'separator2'=>array('family'=>'separator', 'position'=>400, 'enabled' => (isModEnabled('ticket') && isModEnabled('contract'))),
'separator2' => array('family' => 'separator', 'position' => 400, 'enabled' => (isModEnabled('ticket') && isModEnabled('contract'))),
// Automatic link ticket -> contract
'WORKFLOW_TICKET_LINK_CONTRACT' => array(
@ -212,9 +213,16 @@ if (!empty($conf->modules_parts['workflow']) && is_array($conf->modules_parts['w
}
// remove not available workflows (based on activated modules and global defined keys)
$workflowcodes = array_filter($workflowcodes, function ($var) {
return $var['enabled'];
});
$workflowcodes = array_filter(
$workflowcodes,
/**
* @param array{enabled:int<0,1>} $var
* @return int<0,1>
*/
static function ($var) {
return $var['enabled'];
}
);

View file

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2020 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -84,18 +85,16 @@ if ($action == 'updateMask') {
// Search template files
$file = '';
$classname = '';
$filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/workstation/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0);
if (file_exists($file)) {
$filefound = 1;
$classname = "pdf_".$modele;
break;
}
}
if ($filefound) {
if ($classname !== '') {
require_once $file;
$module = new $classname($db);

View file

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2022 Alice Adminson <aadminson@example.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -80,8 +81,8 @@ $arrayofaifeatures = array(
*/
$functioncode = GETPOST('functioncode', 'alpha');
$pre_prompt = GETPOST('prePrompt', 'alpha');
$post_prompt = GETPOST('postPrompt', 'alpha');
$pre_prompt = GETPOST('prePrompt');
$post_prompt = GETPOST('postPrompt');
// get all configs in const AI
$currentConfigurationsJson = getDolGlobalString('AI_CONFIGURATIONS_PROMPT');
@ -126,6 +127,46 @@ if ($action == 'update' && !GETPOST('cancel')) {
$action = 'edit';
}
if ($action == 'updatePrompts') {
$key = GETPOST('key', 'alpha');
$currentConfigurations[$key] = [
'prePrompt' => $pre_prompt,
'postPrompt' => $post_prompt,
];
$newConfigurationsJson = json_encode($currentConfigurations, JSON_UNESCAPED_UNICODE);
$result = dolibarr_set_const($db, 'AI_CONFIGURATIONS_PROMPT', $newConfigurationsJson, 'chaine', 0, '', $conf->entity);
if (!$error) {
$action = '';
if ($result) {
header("Location: ".$_SERVER['PHP_SELF']);
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
exit;
} else {
setEventMessages($langs->trans("ErrorUpdating"), null, 'errors');
}
}
}
if ($action == 'confirm_deleteproperty' && GETPOST('confirm') == 'yes') {
$key = GETPOST('key', 'alpha');
if (isset($currentConfigurations[$key])) {
unset($currentConfigurations[$key]);
$newConfigurationsJson = json_encode($currentConfigurations, JSON_UNESCAPED_UNICODE);
$res = dolibarr_set_const($db, 'AI_CONFIGURATIONS_PROMPT', $newConfigurationsJson, 'chaine', 0, '', $conf->entity);
if ($res) {
header("Location: ".$_SERVER['PHP_SELF']);
setEventMessages($langs->trans("SetupDeleted"), null, 'mesgs');
exit;
} else {
setEventMessages($langs->trans("ErrorDeleting"), null, 'errors');
}
}
}
/*
* View
@ -152,11 +193,25 @@ $newbutton = '';
print load_fiche_titre($langs->trans("AIPromptForFeatures"), $newbutton, '');
if ($action == 'deleteproperty') {
$formconfirm = $form->formconfirm(
$_SERVER["PHP_SELF"].'?key='.urlencode(GETPOST('key', 'alpha')),
$langs->trans('Delete'),
$langs->trans('ConfirmDeleteSetup', GETPOST('key', 'alpha')),
'confirm_deleteproperty',
'',
0,
1
);
print $formconfirm;
}
if ($action == 'edit') {
$out .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
$out .= '<input type="hidden" name="token" value="'.newToken().'">';
$out .= '<input type="hidden" name="action" value="update">';
$out .= '<table class="noborder centpercent">';
$out .= '<thead>';
$out .= '<tr class="liste_titre">';
@ -201,7 +256,7 @@ if ($action == 'edit') {
$out .= '<span id="prePrompt" class="spanforparamtooltip">pre-Prompt</span>';
$out .= '</td>';
$out .= '<td>';
$out .= '<input name="prePrompt" id="prePromptInput" class="flat minwidth500" value="">';
$out .= '<textarea class="flat minwidth500" id="prePromptInput" name="prePrompt" rows="3"></textarea>';
$out .= '</td>';
$out .= '</tr>';
$out .= '<tr class="oddeven">';
@ -209,14 +264,14 @@ if ($action == 'edit') {
$out .= '<span id="postPrompt" class="spanforparamtooltip">Post-prompt</span>';
$out .= '</td>';
$out .= '<td>';
$out .= '<input name="postPrompt" id="postPromptInput" class="flat minwidth500" value="">';
$out .= '<textarea class="flat minwidth500" id="postPromptInput" name="postPrompt" rows="3"></textarea>';
$out .= '</td>';
$out .= '</tr>';
$out .= '</tbody>';
$out .= '</table>';
$out .= $form->buttonsSaveCancel("Add", "");
$out .= '</form>';
$out .= '<br><br><br>';
print $out;
@ -235,17 +290,25 @@ if ($action == 'edit' || $action == 'create') {
$out .= '<thead>';
$out .= '<tr class="liste_titre">';
$out .= '<td>'.$arrayofaifeatures[$key]['picto'].' '.$langs->trans($arrayofaifeatures[$key]['label']).'</td>';
$out .= '<td>'.$arrayofaifeatures[$key]['picto'].' '.$langs->trans($arrayofaifeatures[$key]['label']);
$out .= '<a class="viewfielda reposition marginleftonly marginrighttonly showInputBtn" href="#" data-index="'.$key.'" data-state="edit" data-icon-edit="'.dol_escape_htmltag(img_edit()).'" data-icon-cancel="'.dol_escape_htmltag(img_view()).'">'.img_edit().'</a>';
$out .= '<a class="deletefielda marginleftonly right" href="'.$_SERVER["PHP_SELF"].'?action=deleteproperty&token='.newToken().'&key='.urlencode($key).'">'.img_delete().'</a>';
$out .= '</td>';
$out .= '<td></td>';
$out .= '</tr>';
$out .= '</thead>';
$out .= '<tbody>';
$out .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
$out .= '<input type="hidden" name="token" value="'.newToken().'">';
$out .= '<input type="hidden" name="key" value="'.$key.'" />';
$out .= '<input type="hidden" name="action" value="updatePrompts">';
$out .= '<tr class="oddeven">';
$out .= '<td class="col-setup-title">';
$out .= '<span id="prePrompt" class="spanforparamtooltip">pre-Prompt</span>';
$out .= '</td>';
$out .= '<td>';
$out .= '<input name="prePrompt" id="prePromptInput" class="flat minwidth500" value="'.$config['prePrompt'].'">';
$out .= '<textarea class="flat minwidth500" id="prePromptInput_'.$key.'" name="prePrompt" rows="2" disabled>'.$config['prePrompt'].'</textarea>';
$out .= '</td>';
$out .= '</tr>';
$out .= '<tr class="oddeven">';
@ -253,15 +316,17 @@ if ($action == 'edit' || $action == 'create') {
$out .= '<span id="postPrompt" class="spanforparamtooltip">Post-prompt</span>';
$out .= '</td>';
$out .= '<td>';
$out .= '<input name="postPrompt" id="postPromptInput" class="flat minwidth500" value="'.$config['postPrompt'].'">';
$out .= '<textarea class="flat minwidth500" id="postPromptInput_'.$key.'" name="postPrompt" rows="2" disabled>'.$config['postPrompt'].'</textarea>';
$out .= '<br><input type="submit" class="button small submitBtn" name="modify" data-index="'.$key.'" style="display: none;" value="'.dol_escape_htmltag($langs->trans("Modify")).'"/>';
$out .= '</td>';
$out .= '</tr>';
$out .= '</form>';
}
$out .= '</tbody>';
$out .= '</table>';
}
$out .= '</form>';
$out .= "<script>
var configurations = ".$currentConfigurationsJson.";
@ -278,7 +343,31 @@ if ($action == 'edit' || $action == 'create') {
$('#postPromptInput').val('');
}
});
});
$('.showInputBtn').click(function() {
event.preventDefault();
var index = $(this).data('index');
var state = $(this).data('state');
if(state === 'edit') {
$('#prePromptInput_'+index).removeAttr('disabled').focus();
$('#postPromptInput_'+index).removeAttr('disabled');
$('.submitBtn[data-index=' + index + ']').show();
$(this).html($(this).data('icon-cancel'));
$(this).data('state', 'cancel');
} else {
$('#prePromptInput_'+index).attr('disabled', 'disabled');
$('#postPromptInput_'+index).attr('disabled', 'disabled');
$('.submitBtn[data-index=' + index + ']').hide();
$(this).html($(this).data('icon-edit'));
$(this).data('state', 'edit');
}
});
});
</script>";
print $out;

View file

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2022 Alice Adminson <aadminson@example.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -75,7 +76,7 @@ foreach ($arrayofia as $ia) {
$item->cssClass = 'minwidth500';
}
$setupnotempty =+ count($formSetup->items);
$setupnotempty = + count($formSetup->items);
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
@ -113,18 +114,16 @@ if ($action == 'updateMask') {
// Search template files
$file = '';
$classname = '';
$filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/ai/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0);
if (file_exists($file)) {
$filefound = 1;
$classname = "pdf_".$modele."_".strtolower($tmpobjectkey);
break;
}
}
if ($filefound) {
if ($classname !== '') {
require_once $file;
$module = new $classname($db);
@ -193,45 +192,45 @@ $action = 'edit';
* View
*/
$form = new Form($db);
$form = new Form($db);
$help_url = '';
$title = "AiSetup";
$help_url = '';
$title = "AiSetup";
llxHeader('', $langs->trans($title), $help_url);
llxHeader('', $langs->trans($title), $help_url);
// Subheader
$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>';
// Subheader
$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans($title), $linkback, 'title_setup');
print load_fiche_titre($langs->trans($title), $linkback, 'title_setup');
// Configuration header
$head = aiAdminPrepareHead();
print dol_get_fiche_head($head, 'settings', $langs->trans($title), -1, "fa-microchip");
// Configuration header
$head = aiAdminPrepareHead();
print dol_get_fiche_head($head, 'settings', $langs->trans($title), -1, "fa-microchip");
// Setup page goes here
//echo '<span class="opacitymedium">'.$langs->trans("AiSetupPage").'</span><br><br>';
// Setup page goes here
//echo '<span class="opacitymedium">'.$langs->trans("AiSetupPage").'</span><br><br>';
if ($action == 'edit') {
print $formSetup->generateOutput(true);
print '<br>';
print $formSetup->generateOutput(true);
print '<br>';
} elseif (!empty($formSetup->items)) {
print $formSetup->generateOutput();
print '<div class="tabsAction">';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>';
print '</div>';
} else {
print '<br>'.$langs->trans("NothingToSetup");
print '<br>'.$langs->trans("NothingToSetup");
}
if (empty($setupnotempty)) {
print '<br>'.$langs->trans("NothingToSetup");
print '<br>'.$langs->trans("NothingToSetup");
}
// Page end
print dol_get_fiche_end();
// Page end
print dol_get_fiche_end();
llxFooter();
$db->close();
llxFooter();
$db->close();

View file

@ -61,13 +61,22 @@ if (is_null($jsonData)) {
}
$ai = new Ai($db);
$instructions = dol_string_nohtmltag($jsonData['instructions'], 1, 'UTF-8');
$function = 'textgeneration';
$instructions = dol_string_nohtmltag($jsonData['instructions'], 1, 'UTF-8');
$format = empty($jsonData['instructions']) ? '' : $jsonData['instructions'];
$generatedContent = $ai->generateContent($instructions, 'auto', $function);
$generatedContent = $ai->generateContent($instructions, 'auto', $function, $format);
if (is_array($generatedContent) && $generatedContent['error']) {
print "Error : " . $generatedContent['message'];
// client errors
if ($generatedContent['code'] >= 400) {
print "Error : " . $generatedContent['message'];
print '<br><a href="'.DOL_MAIN_URL_ROOT.'/ai/admin/setup.php">'.$langs->trans('Check Config of Module').'</a>';
} elseif ($generatedContent['code'] == 429) {
print "Quota or allowed period exceeded. Retry Later !";
} else {
print "Error returned by API call: " . $generatedContent['message'];
}
} else {
print $generatedContent;
}

View file

@ -1,9 +1,5 @@
<?php
/* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2016 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012 J. Fernando Lagrange <fernando@demo-tic.org>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2023 Eric Seigne <eric.seigne@cap-rel.fr>
/* Copyright (C) 2024 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -20,13 +16,14 @@
* or see https://www.gnu.org/
*/
require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
/**
* Class for AI
*/
class Ai
{
/**
* @var DoliDB $db Database object
*/
@ -57,13 +54,18 @@ class Ai
/**
* Generate response of instructions
*
* @param string $instructions instruction for generate content
* @param string $model model name ('gpt-3.5-turbo')
* @param string $function code of the feature we want to use ('emailing', 'transcription', 'audiotext', 'imagegeneration', 'translation')
* @param string $instructions Instruction to generate content
* @param string $model Model name ('gpt-3.5-turbo', 'gpt-4-turbo', 'dall-e-3', ...)
* @param string $function Code of the feature we want to use ('textgeneration', 'transcription', 'audiotext', 'imagegeneration', 'translation')
* @param string $format Format for output ('', 'html', ...)
* @return mixed $response
*/
public function generateContent($instructions, $model = 'auto', $function = 'textgeneration')
public function generateContent($instructions, $model = 'auto', $function = 'textgeneration', $format = '')
{
if (empty($this->apiKey)) {
return array('error' => true, 'message' => 'API key is no defined');
}
if (empty($this->apiEndpoint)) {
if ($function == 'textgeneration') {
$this->apiEndpoint = 'https://api.openai.com/v1/chat/completions';
@ -97,6 +99,8 @@ class Ai
}
}
dol_syslog("Call API for apiEndpoint=".$this->apiEndpoint." apiKey=".substr($this->apiKey, 0, 3).'***********, model='.$model);
try {
$configurationsJson = getDolGlobalString('AI_CONFIGURATIONS_PROMPT');
$configurations = json_decode($configurationsJson, true);
@ -115,40 +119,37 @@ class Ai
}
$fullInstructions = $prePrompt.' '.$instructions.' .'.$postPrompt;
// TODO Replace this with a simple call of getDolURLContent();
$ch = curl_init($this->apiEndpoint);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
$payload = json_encode([
'messages' => [
['role' => 'user', 'content' => $fullInstructions]
],
'model' => $model
]));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
]);
$headers = ([
'Authorization: Bearer ' . $this->apiKey,
'Content-Type: application/json'
]);
$response = getURLContent($this->apiEndpoint, 'POST', $payload, $headers);
$response = curl_exec($ch);
if (curl_errno($ch)) {
throw new Exception('cURL error: ' . curl_error($ch));
}
$statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($statusCode != 200) {
throw new Exception('API request failed with status code ' . $statusCode);
if ($response['http_code'] != 200) {
throw new Exception('API request failed with status code ' . $response['http_code']);
}
// Decode JSON response
$decodedResponse = json_decode($response, true);
$decodedResponse = json_decode($response['content'], true);
// Extraction content
$generatedEmailContent = $decodedResponse['choices'][0]['message']['content'];
// If content is not HTML, we convert it into HTML
if (!dol_textishtml($generatedEmailContent)) {
$generatedEmailContent = dol_nl2br($generatedEmailContent);
}
return $generatedEmailContent;
} catch (Exception $e) {
return array('error' => true, 'message' => $e->getMessage());
} finally {
curl_close($ch);
}
}
}

View file

@ -2,6 +2,7 @@
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2023 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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
@ -19,11 +20,16 @@
// Create the autoloader for Luracast
require_once DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/AutoLoader.php';
call_user_func(function () {
$loader = Luracast\Restler\AutoLoader::instance();
spl_autoload_register($loader);
return $loader;
});
call_user_func(
/**
* @return Luracast\Restler\AutoLoader
*/
static function () {
$loader = Luracast\Restler\AutoLoader::instance();
spl_autoload_register($loader);
return $loader;
}
);
require_once DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/iAuthenticate.php';
require_once DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/iUseAuthentication.php';

View file

@ -3,6 +3,7 @@
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2021 Alexis LAURIER <contact@alexislaurier.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -91,11 +92,16 @@ if (!$res) {
require_once DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/AutoLoader.php';
call_user_func(function () {
$loader = Luracast\Restler\AutoLoader::instance();
spl_autoload_register($loader);
return $loader;
});
call_user_func(
/**
* @return Luracast\Restler\AutoLoader
*/
static function () {
$loader = Luracast\Restler\AutoLoader::instance();
spl_autoload_register($loader);
return $loader;
}
);
require_once DOL_DOCUMENT_ROOT.'/api/class/api.class.php';
require_once DOL_DOCUMENT_ROOT.'/api/class/api_access.class.php';

View file

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -96,18 +97,16 @@ if ($action == 'updateMask') {
// Search template files
$file = '';
$classname = '';
$filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/asset/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0);
if (file_exists($file)) {
$filefound = 1;
$classname = "pdf_".$modele;
break;
}
}
if ($filefound) {
if ($classname !== '') {
require_once $file;
$module = new $classname($db);

View file

@ -99,7 +99,7 @@ if (!isModEnabled('asset')) {
* Actions
*/
$parameters = array('id'=>$id);
$parameters = array('id' => $id);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@ -167,14 +167,14 @@ if ($object->id > 0) {
$objthirdparty = $object;
$objcon = new stdClass();
$out = '&origin=' . urlencode($object->element . '@' . $object->module) . '&originid=' . urlencode($object->id);
$out = '&origin=' . urlencode((string) ($object->element . '@' . $object->module)) . '&originid=' . urlencode((string) ($object->id));
$urlbacktopage = $_SERVER['PHP_SELF'] . '?id=' . $object->id;
$out .= '&backtopage=' . urlencode($urlbacktopage);
$permok = $user->hasRight('agenda', 'myactions', 'create');
if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
if (get_class($objthirdparty) == 'Societe') {
$out .= '&socid=' . urlencode($objthirdparty->id);
$out .= '&socid=' . urlencode((string) ($objthirdparty->id));
}
$out .= (!empty($objcon->id) ? '&contactid=' . urlencode($objcon->id) : '');
//$out.=$langs->trans("AddAnAction").' ';

View file

@ -2,6 +2,7 @@
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -93,7 +94,7 @@ class Asset extends CommonObject
*/
/**
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
* @var array<string,array{type:string,label:string,enabled:int<0,2>|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array<int,string>,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
*/
public $fields = array(
'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'css' => 'left', 'comment' => "Id"),

View file

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2021 Open-Dsi <support@open-dsi.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -64,7 +65,7 @@ class AssetDepreciationOptions extends CommonObject
*/
/**
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
* @var array<string,array{type:string,label:string,enabled:int<0,2>|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array<int,string>,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
*/
public $fields = array();
@ -77,15 +78,15 @@ class AssetDepreciationOptions extends CommonObject
'label' => 'AssetDepreciationOptionEconomic',
'table' => 'asset_depreciation_options_economic',
'fields' => array(
'depreciation_type' => array('type'=>'smallint', 'label'=>'AssetDepreciationOptionDepreciationType', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>1, 'default'=>'0', 'arrayofkeyval'=>array('0'=>'AssetDepreciationOptionDepreciationTypeLinear', '1'=>'AssetDepreciationOptionDepreciationTypeDegressive', '2'=>'AssetDepreciationOptionDepreciationTypeExceptional'), 'validate'=>'1',),
'degressive_coefficient' => array('type'=>'double(24,8)', 'label'=>'AssetDepreciationOptionDegressiveRate', 'enabled'=>'1', 'position'=>20, 'notnull'=>1, 'visible'=>1, 'default'=>'0', 'isameasure'=>'1', 'validate'=>'1','enabled_field' => 'economic:depreciation_type:1'),
'duration' => array('type'=>'integer', 'label'=>'AssetDepreciationOptionDuration', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'default'=>'0', 'isameasure'=>'1', 'validate'=>'1',),
'duration_type' => array('type'=>'smallint', 'label'=>'AssetDepreciationOptionDurationType', 'enabled'=>'1', 'position'=>40, 'notnull'=>1, 'visible'=>1, 'default'=>'0', 'arrayofkeyval'=>array('0'=>'AssetDepreciationOptionDurationTypeAnnual', '1'=>'AssetDepreciationOptionDurationTypeMonthly'/*, '2'=>'AssetDepreciationOptionDurationTypeDaily'*/), 'validate'=>'1',),
'rate' => array('type'=>'double(24,8)', 'label'=>'AssetDepreciationOptionRate', 'enabled'=>'1', 'position'=>50, 'visible'=>3, 'default'=>'0', 'isameasure'=>'1', 'validate'=>'1', 'computed' => '$object->asset_depreciation_options->getRate("economic")',),
'accelerated_depreciation_option' => array('type'=>'boolean', 'label'=>'AssetDepreciationOptionAcceleratedDepreciation', 'enabled'=>'1', 'position'=>60, 'column_break' => true, 'notnull'=>0, 'default'=>'0', 'visible'=>1, 'validate'=>'1',),
'amount_base_depreciation_ht' => array('type'=>'price', 'label'=>'AssetDepreciationOptionAmountBaseDepreciationHT', 'enabled'=>'isset($object)&&get_class($object)=="Asset"', 'only_on_asset'=>1, 'position'=>90, 'notnull'=>0, 'required'=>1, 'visible'=>1, 'default'=>'$object->reversal_amount_ht > 0 ? $object->reversal_amount_ht : $object->acquisition_value_ht', 'isameasure'=>'1', 'validate'=>'1',),
'amount_base_deductible_ht' => array('type'=>'price', 'label'=>'AssetDepreciationOptionAmountBaseDeductibleHT', 'enabled'=>'isset($object)&&get_class($object)=="Asset"', 'only_on_asset'=>1, 'position'=>100, 'notnull'=>0, 'visible'=>1, 'default'=>'0', 'isameasure'=>'1', 'validate'=>'1',),
'total_amount_last_depreciation_ht' => array('type'=>'price', 'label'=>'AssetDepreciationOptionTotalAmountLastDepreciationHT', 'enabled'=>'isset($object)&&get_class($object)=="Asset"', 'only_on_asset'=>1, 'position'=>110, 'noteditable'=> 1, 'notnull'=>0, 'visible'=>1, 'default'=>'0', 'isameasure'=>'1', 'validate'=>'1',),
'depreciation_type' => array('type' => 'smallint', 'label' => 'AssetDepreciationOptionDepreciationType', 'enabled' => '1', 'position' => 10, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'arrayofkeyval' => array('0' => 'AssetDepreciationOptionDepreciationTypeLinear', '1' => 'AssetDepreciationOptionDepreciationTypeDegressive', '2' => 'AssetDepreciationOptionDepreciationTypeExceptional'), 'validate' => '1',),
'degressive_coefficient' => array('type' => 'double(24,8)', 'label' => 'AssetDepreciationOptionDegressiveRate', 'enabled' => '1', 'position' => 20, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'isameasure' => '1', 'validate' => '1','enabled_field' => 'economic:depreciation_type:1'),
'duration' => array('type' => 'integer', 'label' => 'AssetDepreciationOptionDuration', 'enabled' => '1', 'position' => 30, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'isameasure' => '1', 'validate' => '1',),
'duration_type' => array('type' => 'smallint', 'label' => 'AssetDepreciationOptionDurationType', 'enabled' => '1', 'position' => 40, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'arrayofkeyval' => array('0' => 'AssetDepreciationOptionDurationTypeAnnual', '1' => 'AssetDepreciationOptionDurationTypeMonthly'/*, '2'=>'AssetDepreciationOptionDurationTypeDaily'*/), 'validate' => '1',),
'rate' => array('type' => 'double(24,8)', 'label' => 'AssetDepreciationOptionRate', 'enabled' => '1', 'position' => 50, 'visible' => 3, 'default' => '0', 'isameasure' => '1', 'validate' => '1', 'computed' => '$object->asset_depreciation_options->getRate("economic")',),
'accelerated_depreciation_option' => array('type' => 'boolean', 'label' => 'AssetDepreciationOptionAcceleratedDepreciation', 'enabled' => '1', 'position' => 60, 'column_break' => true, 'notnull' => 0, 'default' => '0', 'visible' => 1, 'validate' => '1',),
'amount_base_depreciation_ht' => array('type' => 'price', 'label' => 'AssetDepreciationOptionAmountBaseDepreciationHT', 'enabled' => 'isset($object)&&get_class($object)=="Asset"', 'only_on_asset' => 1, 'position' => 90, 'notnull' => 0, 'required' => 1, 'visible' => 1, 'default' => '$object->reversal_amount_ht > 0 ? $object->reversal_amount_ht : $object->acquisition_value_ht', 'isameasure' => '1', 'validate' => '1',),
'amount_base_deductible_ht' => array('type' => 'price', 'label' => 'AssetDepreciationOptionAmountBaseDeductibleHT', 'enabled' => 'isset($object)&&get_class($object)=="Asset"', 'only_on_asset' => 1, 'position' => 100, 'notnull' => 0, 'visible' => 1, 'default' => '0', 'isameasure' => '1', 'validate' => '1',),
'total_amount_last_depreciation_ht' => array('type' => 'price', 'label' => 'AssetDepreciationOptionTotalAmountLastDepreciationHT', 'enabled' => 'isset($object)&&get_class($object)=="Asset"', 'only_on_asset' => 1, 'position' => 110, 'noteditable' => 1, 'notnull' => 0, 'visible' => 1, 'default' => '0', 'isameasure' => '1', 'validate' => '1',),
),
),
'accelerated_depreciation' => array(
@ -93,14 +94,14 @@ class AssetDepreciationOptions extends CommonObject
'table' => 'asset_depreciation_options_fiscal',
'enabled_field' => 'economic:accelerated_depreciation_option:1',
'fields' => array(
'depreciation_type' => array('type'=>'smallint', 'label'=>'AssetDepreciationOptionDepreciationType', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>1, 'default'=>'0', 'arrayofkeyval'=>array('0'=>'AssetDepreciationOptionDepreciationTypeLinear', '1'=>'AssetDepreciationOptionDepreciationTypeDegressive', '2'=>'AssetDepreciationOptionDepreciationTypeExceptional'), 'validate'=>'1',),
'degressive_coefficient' => array('type'=>'double(24,8)', 'label'=>'AssetDepreciationOptionDegressiveRate', 'enabled'=>'1', 'position'=>20, 'notnull'=>1, 'visible'=>1, 'default'=>'0', 'isameasure'=>'1', 'validate'=>'1','enabled_field' => 'accelerated_depreciation:depreciation_type:1'),
'duration' => array('type'=>'integer', 'label'=>'AssetDepreciationOptionDuration', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'default'=>'0', 'isameasure'=>'1', 'validate'=>'1',),
'duration_type' => array('type'=>'smallint', 'label'=>'AssetDepreciationOptionDurationType', 'enabled'=>'1', 'position'=>40, 'notnull'=>1, 'visible'=>1, 'default'=>'0', 'arrayofkeyval'=>array('0'=>'AssetDepreciationOptionDurationTypeAnnual', '1'=>'AssetDepreciationOptionDurationTypeMonthly'/*, '2'=>'AssetDepreciationOptionDurationTypeDaily'*/), 'validate'=>'1',),
'rate' => array('type'=>'double(24,8)', 'label'=>'AssetDepreciationOptionRate', 'enabled'=>'1', 'position'=>50, 'visible'=>3, 'default'=>'0', 'isameasure'=>'1', 'validate'=>'1', 'computed' => '$object->asset_depreciation_options->getRate("accelerated_depreciation")',),
'amount_base_depreciation_ht' => array('type'=>'price', 'label'=>'AssetDepreciationOptionAmountBaseDepreciationHT', 'enabled'=>'isset($object)&&get_class($object)=="Asset"', 'only_on_asset'=>1, 'position'=>80, 'column_break' => true, 'notnull'=>0, 'required'=>1, 'visible'=>1, 'default'=>'$object->reversal_amount_ht > 0 ? $object->reversal_amount_ht : $object->acquisition_value_ht', 'isameasure'=>'1', 'validate'=>'1',),
'amount_base_deductible_ht' => array('type'=>'price', 'label'=>'AssetDepreciationOptionAmountBaseDeductibleHT', 'enabled'=>'isset($object)&&get_class($object)=="Asset"', 'only_on_asset'=>1, 'position'=>90, 'notnull'=>0, 'visible'=>1, 'default'=>'0', 'isameasure'=>'1', 'validate'=>'1',),
'total_amount_last_depreciation_ht' => array('type'=>'price', 'label'=>'AssetDepreciationOptionTotalAmountLastDepreciationHT', 'enabled'=>'isset($object)&&get_class($object)=="Asset"', 'only_on_asset'=>1, 'position'=>100, 'noteditable'=> 1, 'notnull'=>0, 'visible'=>1, 'default'=>'0', 'isameasure'=>'1', 'validate'=>'1',),
'depreciation_type' => array('type' => 'smallint', 'label' => 'AssetDepreciationOptionDepreciationType', 'enabled' => '1', 'position' => 10, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'arrayofkeyval' => array('0' => 'AssetDepreciationOptionDepreciationTypeLinear', '1' => 'AssetDepreciationOptionDepreciationTypeDegressive', '2' => 'AssetDepreciationOptionDepreciationTypeExceptional'), 'validate' => '1',),
'degressive_coefficient' => array('type' => 'double(24,8)', 'label' => 'AssetDepreciationOptionDegressiveRate', 'enabled' => '1', 'position' => 20, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'isameasure' => '1', 'validate' => '1','enabled_field' => 'accelerated_depreciation:depreciation_type:1'),
'duration' => array('type' => 'integer', 'label' => 'AssetDepreciationOptionDuration', 'enabled' => '1', 'position' => 30, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'isameasure' => '1', 'validate' => '1',),
'duration_type' => array('type' => 'smallint', 'label' => 'AssetDepreciationOptionDurationType', 'enabled' => '1', 'position' => 40, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'arrayofkeyval' => array('0' => 'AssetDepreciationOptionDurationTypeAnnual', '1' => 'AssetDepreciationOptionDurationTypeMonthly'/*, '2'=>'AssetDepreciationOptionDurationTypeDaily'*/), 'validate' => '1',),
'rate' => array('type' => 'double(24,8)', 'label' => 'AssetDepreciationOptionRate', 'enabled' => '1', 'position' => 50, 'visible' => 3, 'default' => '0', 'isameasure' => '1', 'validate' => '1', 'computed' => '$object->asset_depreciation_options->getRate("accelerated_depreciation")',),
'amount_base_depreciation_ht' => array('type' => 'price', 'label' => 'AssetDepreciationOptionAmountBaseDepreciationHT', 'enabled' => 'isset($object)&&get_class($object)=="Asset"', 'only_on_asset' => 1, 'position' => 80, 'column_break' => true, 'notnull' => 0, 'required' => 1, 'visible' => 1, 'default' => '$object->reversal_amount_ht > 0 ? $object->reversal_amount_ht : $object->acquisition_value_ht', 'isameasure' => '1', 'validate' => '1',),
'amount_base_deductible_ht' => array('type' => 'price', 'label' => 'AssetDepreciationOptionAmountBaseDeductibleHT', 'enabled' => 'isset($object)&&get_class($object)=="Asset"', 'only_on_asset' => 1, 'position' => 90, 'notnull' => 0, 'visible' => 1, 'default' => '0', 'isameasure' => '1', 'validate' => '1',),
'total_amount_last_depreciation_ht' => array('type' => 'price', 'label' => 'AssetDepreciationOptionTotalAmountLastDepreciationHT', 'enabled' => 'isset($object)&&get_class($object)=="Asset"', 'only_on_asset' => 1, 'position' => 100, 'noteditable' => 1, 'notnull' => 0, 'visible' => 1, 'default' => '0', 'isameasure' => '1', 'validate' => '1',),
),
),
);
@ -178,7 +179,7 @@ class AssetDepreciationOptions extends CommonObject
$this->{$field_key} = $this->deprecation_options[$mode][$field_key] ?? null;
}
$this->fields['rowid'] = array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id");
$this->fields['rowid'] = array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'css' => 'left', 'comment' => "Id");
if (empty($class_type)) {
$this->fields['fk_asset'] = array('type' => 'integer:Asset:asset/class/asset.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label' => 'Asset', 'enabled' => '1', 'position' => 0, 'notnull' => 0, 'visible' => 0, 'index' => 1, 'validate' => '1',);
} else {

View file

@ -2,6 +2,7 @@
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2021 Open-Dsi <support@open-dsi.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -99,7 +100,7 @@ class AssetModel extends CommonObject
*/
/**
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
* @var array<string,array{type:string,label:string,enabled:int<0,2>|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array<int,string>,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
*/
public $fields = array(
'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'css' => 'left', 'comment' => "Id"),

View file

@ -173,14 +173,14 @@ if ($object->id > 0) {
$objthirdparty = $object;
$objcon = new stdClass();
$out = '&origin=' . urlencode($object->element . '@' . $object->module) . '&originid=' . urlencode($object->id);
$out = '&origin=' . urlencode((string) ($object->element . '@' . $object->module)) . '&originid=' . urlencode((string) ($object->id));
$urlbacktopage = $_SERVER['PHP_SELF'] . '?id=' . $object->id;
$out .= '&backtopage=' . urlencode($urlbacktopage);
$permok = $user->hasRight('agenda', 'myactions', 'create');
if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
if (get_class($objthirdparty) == 'Societe') {
$out .= '&socid=' . urlencode($objthirdparty->id);
$out .= '&socid=' . urlencode((string) ($objthirdparty->id));
}
$out .= (!empty($objcon->id) ? '&contactid=' . urlencode($objcon->id) : '');
//$out.=$langs->trans("AddAnAction").' ';

View file

@ -2,6 +2,7 @@
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2006-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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
@ -253,8 +254,6 @@ if (empty($reshook)) {
}
}
$i++;
// Build and output PDF
if (!$error && $mode == 'label') {
if (!count($arrayofrecords)) {

View file

@ -298,7 +298,7 @@ if (GETPOST('withtab', 'alpha')) {
} else {
$title = $langs->trans("BrowseBlockedLog");
}
$help_url="EN:Module_Unalterable_Archives_-_Logs|FR:Module_Archives_-_Logs_Inaltérable";
$help_url = "EN:Module_Unalterable_Archives_-_Logs|FR:Module_Archives_-_Logs_Inaltérable";
llxHeader('', $title, $help_url);
@ -353,16 +353,16 @@ if ($search_startday > 0) {
$param .= '&search_startday='.urlencode($search_startday);
}
if ($search_endyear > 0) {
$param .= '&search_endyear='.urlencode($search_endyear);
$param .= '&search_endyear='.urlencode((string) ($search_endyear));
}
if ($search_endmonth > 0) {
$param .= '&search_endmonth='.urlencode($search_endmonth);
$param .= '&search_endmonth='.urlencode((string) ($search_endmonth));
}
if ($search_endday > 0) {
$param .= '&search_endday='.urlencode($search_endday);
$param .= '&search_endday='.urlencode((string) ($search_endday));
}
if ($search_showonlyerrors > 0) {
$param .= '&search_showonlyerrors='.urlencode($search_showonlyerrors);
$param .= '&search_showonlyerrors='.urlencode((string) ($search_showonlyerrors));
}
if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss);

View file

@ -2,6 +2,7 @@
/* Copyright (C) 2017 ATM Consulting <contact@atm-consulting.fr>
* Copyright (C) 2017-2020 Laurent Destailleur <eldy@destailleur.fr>
* Copyright (C) 2022 charlene benke <charlene@patas-monkey.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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
@ -351,6 +352,7 @@ class BlockedLog
global $langs, $cachedUser;
if (empty($cachedUser)) {
// @phan-suppress-next-line PhanPluginRedundantAssignment
$cachedUser = array();
}
@ -1014,7 +1016,7 @@ class BlockedLog
unset($keyforsignature);
return array('checkresult' => $res, 'calculatedsignature' => $signature, 'previoushash' => $previoushash);
} else { // Consume much memory ($keyforsignature is a large var)
return array('checkresult' => $res, 'calculatedsignature' => $signature, 'previoushash' => $previoushash, 'keyforsignature'=>$keyforsignature);
return array('checkresult' => $res, 'calculatedsignature' => $signature, 'previoushash' => $previoushash, 'keyforsignature' => $keyforsignature);
}
} else {
unset($keyforsignature);
@ -1227,7 +1229,7 @@ class BlockedLog
dol_print_error($this->db);
}
dol_syslog("Module Blockedlog alreadyUsed with ignoresystem=".$ignoresystem." is ".$result);
dol_syslog("Module Blockedlog alreadyUsed with ignoresystem=".$ignoresystem." is ".json_encode($result));
return $result;
}

View file

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -109,11 +110,11 @@ foreach ($object->fields as $key => $val) {
if (!empty($val['visible'])) {
$visible = (int) dol_eval($val['visible'], 1);
$arrayfields['t.'.$key] = array(
'label'=>$val['label'],
'checked'=>(($visible < 0) ? 0 : 1),
'enabled'=>(abs($visible) != 3 && (int) dol_eval($val['enabled'], 1)),
'position'=>$val['position'],
'help'=> isset($val['help']) ? $val['help'] : ''
'label' => $val['label'],
'checked' => (($visible < 0) ? 0 : 1),
'enabled' => (abs($visible) != 3 && (int) dol_eval($val['enabled'], 1)),
'position' => $val['position'],
'help' => isset($val['help']) ? $val['help'] : ''
);
}
}
@ -218,11 +219,7 @@ if (empty($reshook)) {
}
if (!$error) {
if ($nbok > 1) {
setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
} else {
setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
}
setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
$db->commit();
} else {
$db->rollback();
@ -266,11 +263,7 @@ if (empty($reshook)) {
}
if (!$error) {
if ($nbok > 1) {
setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
} else {
setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
}
setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
$db->commit();
} else {
$db->rollback();
@ -343,7 +336,7 @@ foreach ($search as $key => $val) {
}
} else {
if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
$columnName=preg_replace('/(_dtstart|_dtend)$/', '', $key);
$columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key);
if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
if (preg_match('/_dtstart$/', $key)) {
$sql .= " AND t.".$db->sanitize($columnName)." >= '".$db->idate($search[$key])."'";
@ -474,8 +467,8 @@ $param .= $hookmanager->resPrint;
// List of mass actions available
$arrayofmassactions = array(
//'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
'enable'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Enable"),
'disable'=>img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Disable"),
'enable' => img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Enable"),
'disable' => img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Disable"),
);
if (!empty($permissiontodelete)) {
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
@ -500,8 +493,8 @@ print '<input type="hidden" name="page_y" value="">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
$newcardbutton = '';
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss' => 'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss' => 'reposition'));
$newcardbutton .= dolGetButtonTitleSeparator();
$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/bom/bom_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $user->hasRight('bom', 'write'));
@ -607,7 +600,7 @@ foreach ($object->fields as $key => $val) {
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields);
$parameters = array('arrayfields' => $arrayfields);
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
@ -650,7 +643,7 @@ foreach ($object->fields as $key => $val) {
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray);
$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
@ -711,7 +704,7 @@ while ($i < $imaxinloop) {
$selected = 1;
}
}
print $object->getKanbanView('', array('prod'=>$prod, 'selected' => $selected));
print $object->getKanbanView('', array('prod' => $prod, 'selected' => $selected));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';
@ -787,7 +780,7 @@ while ($i < $imaxinloop) {
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
@ -830,7 +823,7 @@ if ($num == 0) {
$db->free($resql);
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;

View file

@ -3,6 +3,7 @@
* Copyright (C) 2023 Benjamin Falière <benjamin.faliere@altairis.fr>
* Copyright (C) 2023 Charlene Benke <charlene@patas-monkey.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -110,7 +111,7 @@ class BOM extends CommonObject
// BEGIN MODULEBUILDER PROPERTIES
/**
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
* @var array<string,array{type:string,label:string,enabled:int<0,2>|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array<int,string>,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
*/
public $fields = array(
'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -2, 'position' => 1, 'notnull' => 1, 'index' => 1, 'comment' => "Id",),
@ -236,7 +237,7 @@ class BOM extends CommonObject
// protected $childtables=array();
/**
* @var array List of child tables. To know object to delete on cascade.
* @var string[] List of child tables. To know object to delete on cascade.
*/
protected $childtablesoncascade = array('bom_bomline');
@ -485,18 +486,16 @@ class BOM extends CommonObject
/**
* Load list of objects in memory from the database.
*
* @param string $sortorder Sort Order
* @param string $sortfield Sort field
* @param int $limit limit
* @param int $offset Offset
* @param array $filter Filter array. Example array('field'=>'valueforlike', 'customurl'=>...)
* @param string $filtermode Filter mode (AND or OR)
* @return array|int int <0 if KO, array of pages if OK
* @param string $sortorder Sort Order
* @param string $sortfield Sort field
* @param int $limit Limit
* @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
*/
public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND')
public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = '', $filtermode = 'AND')
{
global $conf;
dol_syslog(__METHOD__, LOG_DEBUG);
$records = array();
@ -510,6 +509,7 @@ class BOM extends CommonObject
$sql .= ' WHERE 1 = 1';
}
// Manage filter
$errormessage = '';
$sql .= forgeSQLFromUniversalSearchCriteria($filter, $errormessage);
if ($errormessage) {

View file

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2022 Alice Adminson <aadminson@example.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -102,7 +103,7 @@ $item->helpText = $langs->transnoentities('AnHelpMessage');*/
//$item->fieldOutputOverride = false; // set this var to override field output
$setupnotempty =+ count($formSetup->items);
$setupnotempty = + count($formSetup->items);
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
@ -145,18 +146,16 @@ if ($action == 'updateMask') {
// Search template files
$file = '';
$classname = '';
$filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/bookcal/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0);
if (file_exists($file)) {
$filefound = 1;
$classname = "pdf_".$modele."_".strtolower($tmpobjectkey);
break;
}
}
if ($filefound) {
if ($classname !== '') {
require_once $file;
$module = new $classname($db);

View file

@ -113,7 +113,7 @@ if (!$permissiontoread) {
* Actions
*/
$parameters = array('id'=>$id);
$parameters = array('id' => $id);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@ -218,14 +218,14 @@ if ($object->id > 0) {
$objthirdparty = $object;
$objcon = new stdClass();
$out = '&origin='.urlencode($object->element.'@'.$object->module).'&originid='.urlencode($object->id);
$out = '&origin='.urlencode((string) ($object->element.'@'.$object->module)).'&originid='.urlencode((string) ($object->id));
$urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id;
$out .= '&backtopage='.urlencode($urlbacktopage);
$permok = $user->hasRight('agenda', 'myactions', 'create');
if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
if (get_class($objthirdparty) == 'Societe') {
$out .= '&socid='.urlencode($objthirdparty->id);
$out .= '&socid='.urlencode((string) ($objthirdparty->id));
}
$out .= (!empty($objcon->id) ? '&contactid='.urlencode($objcon->id) : '');
//$out.=$langs->trans("AddAnAction").' ';

Some files were not shown because too many files have changed in this diff Show more