Merge branch 'develop' into fix_getrights_loadrights

This commit is contained in:
Laurent Destailleur 2025-01-21 08:34:22 +01:00 committed by GitHub
commit d37897b50c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
185 changed files with 3317 additions and 1464 deletions

View File

@ -59,6 +59,35 @@ jobs:
key: pre-commit-4|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
# Run all the precommit tools (defined in pre-commit-config.yaml).
- name: Extract PHP version
id: extract-php-version
run: |
# shellcheck disable=SC2016
PHP_VERSION=$(sed -n 's/.*\$arrayphpmaxversionwarning\s*=\s*array\s*(\s*\([0-9]\+\)\s*,\s*\([0-9]\+\).*/\1.\2/p' htdocs/install/check.php)
echo "PHP_VERSION=$PHP_VERSION" >> "$GITHUB_ENV"
- name: Setup PHPCS
uses: shivammathur/setup-php@v2
# Install proper php version, and also install phpcs which may be needed
if: |
! cancelled() &&
(
steps.changed-php.outputs.any_changed == 'true'
||
(
env.gh_event == 'push'
&& (
github.event.ref == 'refs/heads/develop'
|| endsWith(github.event.ref, '.0')
)
)
)
with:
php-version: ${{ env.PHP_VERSION }} # Version from check.php
coverage: none # disable xdebug, pcov
tools: phpcs
# Run all the precommit tools (defined into pre-commit-config.yaml).
# We can force exclusion of some of them here.
- name: Run pre-commit hooks
env:
@ -78,27 +107,6 @@ jobs:
# files: |
# **.php
- name: Setup PHPCS
uses: shivammathur/setup-php@v2
# Install when we're going to run phpcs
if: |
! cancelled() &&
(
steps.changed-php.outputs.any_changed == 'true'
||
(
env.gh_event == 'push'
&& (
github.event.ref == 'refs/heads/develop'
|| endsWith(github.event.ref, '.0')
)
)
)
with:
php-version: 8.1
coverage: none # disable xdebug, pcov
tools: phpcs
- name: Run some pre-commit hooks on selected changed files only
if: "! cancelled() && steps.changed-php.outputs.any_changed == 'true'"
env:

View File

@ -547,12 +547,11 @@ script:
- |
echo "Unit testing"
# Ensure we catch errors with -e. Set this to +e instead of -e if you want to go to the end to see dolibarr.log file.
set -e
phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php
phpunitresult=$?
# Execute phpunit, check its exit status and that the phpunit output shows a test summary
phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php | tee /dev/tty | grep -qE "(OK .*[0-9]+ tests.*[0-9]+ assertions|Tests: [0-9]+)" ; phpunitresult=$((PIPESTATUS[0]?PIPESTATUS[0]:PIPESTATUS[2]))
echo "Phpunit return code = $phpunitresult"
set +e
# Comment next line if you want to go to the end to see the dolibarr.log file.
[ $phpunitresult == 0 ] || exit $phpunitresult
echo
after_script:

View File

@ -6576,12 +6576,6 @@ parameters:
count: 1
path: ../../../htdocs/compta/sociales/card.php
-
message: '#^Variable \$resteapayer might not be defined\.$#'
identifier: variable.undefined
count: 3
path: ../../../htdocs/compta/sociales/card.php
-
message: '#^Negated boolean expression is always true\.$#'
identifier: booleanNot.alwaysTrue
@ -19593,13 +19587,7 @@ parameters:
-
message: '#^Variable \$begin might not be defined\.$#'
identifier: variable.undefined
count: 5
path: ../../../htdocs/fourn/contact.php
-
message: '#^Variable \$contactname might not be defined\.$#'
identifier: variable.undefined
count: 1
count: 3
path: ../../../htdocs/fourn/contact.php
-
@ -19608,12 +19596,6 @@ parameters:
count: 4
path: ../../../htdocs/fourn/contact.php
-
message: '#^Variable \$stcomm might not be defined\.$#'
identifier: variable.undefined
count: 2
path: ../../../htdocs/fourn/contact.php
-
message: '#^If condition is always false\.$#'
identifier: if.alwaysFalse
@ -22290,12 +22272,6 @@ parameters:
count: 2
path: ../../../htdocs/loan/class/loanschedule.class.php
-
message: '#^Negated boolean expression is always true\.$#'
identifier: booleanNot.alwaysTrue
count: 1
path: ../../../htdocs/loan/class/paymentloan.class.php
-
message: '#^Property PaymentLoan\:\:\$amount_capital \(float\|int\) in isset\(\) is not nullable\.$#'
identifier: isset.property
@ -32628,21 +32604,9 @@ parameters:
count: 4
path: ../../../htdocs/website/index.php
-
message: '#^Comparison operation "\>\=" between 1 and 0 is always true\.$#'
identifier: greaterOrEqual.alwaysTrue
count: 1
path: ../../../htdocs/website/samples/wrapper.php
-
message: '#^If condition is always false\.$#'
identifier: if.alwaysFalse
count: 3
path: ../../../htdocs/website/samples/wrapper.php
-
message: '#^If condition is always true\.$#'
identifier: if.alwaysTrue
count: 1
path: ../../../htdocs/website/samples/wrapper.php

View File

@ -1,215 +1,246 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles>
<profile name="PSR-12 [built-in]">
<setting id="indentationChar" value="&#9;"/>
<setting id="insert_space_after_opening_paren_in_declare" value="false"/>
<setting id="insert_space_before_closing_paren_in_declare" value="false"/>
<setting id="insert_space_before_opening_paren_in_declare" value="false"/>
<setting id="org.eclipse.php.core.formatter.insert_new_line_in_function_invoke" value="3"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_allocation_expression_force_split" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_allocation_expression_indent_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_allocation_expression_line_wrap_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_method_invocation_force_split" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_method_invocation_indent_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_method_invocation_line_wrap_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_assignment_force_split" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_assignment_indent_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_assignment_line_wrap_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_binary_expression_force_split" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_binary_expression_indent_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_binary_expression_line_wrap_policy" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_compact_if_force_split" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_compact_if_indent_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_compact_if_line_wrap_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_conditional_expression_force_split" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_conditional_expression_indent_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_conditional_expression_line_wrap_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_expressions_in_array_initializer_force_split" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_expressions_in_array_initializer_indent_policy" value="2"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_expressions_in_array_initializer_line_wrap_policy" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_parameters_in_method_declaration_force_split" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_parameters_in_method_declaration_indent_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_parameters_in_method_declaration_line_wrap_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_superclass_in_type_declaration_force_split" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_superclass_in_type_declaration_indent_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_superclass_in_type_declaration_line_wrap_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_superinterfaces_in_type_declaration_force_split" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_superinterfaces_in_type_declaration_indent_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_superinterfaces_in_type_declaration_line_wrap_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.blank_lines_before_field" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.blank_lines_before_member_type" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.blank_lines_before_method" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.blank_lines_between_type_declarations" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.brace_position_for_block" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.brace_position_for_lambda_function_declaration" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.brace_position_for_method_declaration" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.brace_position_for_switch" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.brace_position_for_type_declaration" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.clear_blank_lines_in_block_comment" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.format_block_comments" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.format_header" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.format_html" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.format_javadoc_comments" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.format_line_comments" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.format_source_code" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.indent_parameter_description" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.indent_root_tags" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.insert_new_line_before_root_tags" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.insert_new_line_for_parameter" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.keep_empty_line_for_empty_description" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.line_length" value="1000"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.never_format_unknown_tags" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.new_lines_at_block_boundaries" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.continuation_indentation" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.continuation_indentation_for_array_initializer" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.disabling_tag" value="@formatter:off"/>
<setting id="org.eclipse.php.formatter.core.formatter.enabling_tag" value="@formatter:on"/>
<setting id="org.eclipse.php.formatter.core.formatter.format_guardian_clause_on_one_line" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.format_line_comment_starting_on_first_column" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.indent_breaks_compare_to_cases" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.indent_empty_lines" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.indent_heredocs" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.indent_statements_compare_to_block" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.indent_statements_compare_to_body" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.indent_switchstatements_compare_to_switch" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.indentation.size" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_before_catch_in_try_statement" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_before_else_in_if_statement" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_before_finally_in_try_statement" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_before_while_in_do_statement" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_in_empty_block" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_in_empty_method_body" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_in_empty_type_declaration" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_arrow_in_array_creation" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_arrow_in_field_access" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_arrow_in_foreach" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_arrow_in_method_invocation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_arrow_in_yield" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_assignment_operator" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_binary_operator" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_closing_brace_in_block" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_closing_paren_in_cast" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_colon_in_conditional" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_coloncolon_in_field_access" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_coloncolon_in_method_invocation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_array_creation" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_echo" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_for_inits" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_global" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_list" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_multiple_constant_declarations" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_static" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_superinterfaces" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_array_creation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_cast" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_catch" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_for" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_foreach" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_if" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_list" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_switch" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_while" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_postfix_operator" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_prefix_operator" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_question_in_conditional" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_reference_symbol_in_referenced_expression" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_semicolon_in_for" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_unary_operator" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_arrow_in_array_creation" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_arrow_in_field_access" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_arrow_in_foreach" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_arrow_in_method_invocation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_arrow_in_yield" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_assignment_operator" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_binary_operator" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_array_creation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_cast" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_catch" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_for" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_foreach" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_if" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_list" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_switch" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_while" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_colon_in_case" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_colon_in_conditional" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_colon_in_default" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_coloncolon_in_field_access" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_coloncolon_in_method_invocation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_array_creation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_echo" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_for_inits" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_global" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_list" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_multiple_constant_declarations" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_static" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_superinterfaces" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_brace_in_block" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_brace_in_switch" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_array_creation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_catch" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_for" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_foreach" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_if" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_list" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_switch" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_while" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_postfix_operator" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_prefix_operator" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_question_in_conditional" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_semicolon" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_semicolon_in_for" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_unary_operator" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_between_brackets_in_array_type_reference" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.join_lines_in_comments" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.keep_else_statement_on_same_line" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.keep_elseif_statement_on_same_line" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.keep_imple_if_on_one_line" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.keep_then_statement_on_same_line" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.keep_trailing_comma_in_list" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.lineSplit" value="200"/>
<setting id="org.eclipse.php.formatter.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.never_indent_line_comments_on_first_column" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_after_namespace" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_after_use_statements" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_at_end_of_class_body" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_at_end_of_method_body" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_before_namespace" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_before_use_statements" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_between_namespaces" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_between_use_statements" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.number_of_empty_lines_to_preserve" value="3"/>
<setting id="org.eclipse.php.formatter.core.formatter.put_empty_statement_on_new_line" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.tabulation.size" value="4"/>
<setting id="org.eclipse.php.formatter.core.formatter.use_on_off_tags" value="false"/>
</profile>
<profile name="PSR-2 [built-in] dolibarr">
<setting id="indentationChar" value="&#9;"/>
<setting id="insert_space_after_opening_paren_in_declare" value="false"/>
<setting id="insert_space_before_closing_paren_in_declare" value="false"/>
<setting id="insert_space_before_opening_paren_in_declare" value="false"/>
<setting id="org.eclipse.php.core.formatter.insert_new_line_in_function_invoke" value="3"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_allocation_expression_force_split" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_allocation_expression_indent_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_allocation_expression_line_wrap_policy" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_attribute_group_force_split" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_attribute_group_indent_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_attribute_group_line_wrap_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_match_expression_force_split" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_match_expression_indent_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_match_expression_line_wrap_policy" value="3"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_method_invocation_force_split" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_method_invocation_indent_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_method_invocation_line_wrap_policy" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_assignment_force_split" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_assignment_indent_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_assignment_line_wrap_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_binary_expression_force_split" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_binary_expression_indent_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_binary_expression_line_wrap_policy" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_compact_if_force_split" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_compact_if_indent_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_compact_if_line_wrap_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_conditional_expression_force_split" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_conditional_expression_indent_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_conditional_expression_line_wrap_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_expressions_in_array_initializer_force_split" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_expressions_in_array_initializer_indent_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_expressions_in_array_initializer_line_wrap_policy" value="3"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_parameters_in_method_declaration_force_split" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_parameters_in_method_declaration_indent_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_parameters_in_method_declaration_line_wrap_policy" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_superclass_in_type_declaration_force_split" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_superclass_in_type_declaration_indent_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_superclass_in_type_declaration_line_wrap_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_superinterfaces_in_type_declaration_force_split" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_superinterfaces_in_type_declaration_indent_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_superinterfaces_in_type_declaration_line_wrap_policy" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.blank_lines_before_enum_case" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.blank_lines_before_field" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.blank_lines_before_member_type" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.blank_lines_before_method" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.blank_lines_between_type_declarations" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.brace_position_for_block" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.brace_position_for_lambda_function_declaration" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.brace_position_for_match" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.brace_position_for_method_declaration" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.brace_position_for_switch" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.brace_position_for_type_declaration" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.format_block_comments" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.format_header" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.format_html" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.format_javadoc_comments" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.format_line_comments" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.format_source_code" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.indent_parameter_description" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.indent_root_tags" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.insert_new_line_before_root_tags" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.insert_new_line_for_parameter" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.keep_empty_line_for_empty_description" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.line_length" value="9999"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.never_format_unknown_tags" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.new_lines_at_block_boundaries" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.continuation_indentation" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.continuation_indentation_for_array_initializer" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.disabling_tag" value="@formatter:off"/>
<setting id="org.eclipse.php.formatter.core.formatter.enabling_tag" value="@formatter:on"/>
<setting id="org.eclipse.php.formatter.core.formatter.format_guardian_clause_on_one_line" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.format_line_comment_starting_on_first_column" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.indent_breaks_compare_to_cases" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.indent_empty_lines" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.indent_heredocs" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.indent_match_arms_compare_to_match" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.indent_statements_compare_to_block" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.indent_statements_compare_to_body" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.indent_switchstatements_compare_to_switch" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.indentation.size" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_before_catch_in_try_statement" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_before_else_in_if_statement" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_before_finally_in_try_statement" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_before_while_in_do_statement" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_in_empty_block" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_in_empty_method_body" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_in_empty_type_declaration" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_arrow_in_array_creation" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_arrow_in_field_access" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_arrow_in_foreach" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_arrow_in_match_arm" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_arrow_in_method_invocation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_arrow_in_yield" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_assignment_operator" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_attribute_group_start" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_binary_operator" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_closing_brace_in_block" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_closing_paren_in_cast" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_colon_in_conditional" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_colon_in_enum_type" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_colon_in_named_argument" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_coloncolon_in_field_access" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_coloncolon_in_method_invocation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_array_creation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_attribute_group" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_echo" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_for_inits" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_global" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_list" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_match_arm_conditions" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_match_expressions" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_multiple_constant_declarations" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_static" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_superinterfaces" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_concatenation_operator" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_equal_in_enum_case" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_array_creation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_cast" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_catch" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_for" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_foreach" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_if" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_list" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_match" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_switch" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_while" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_postfix_operator" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_prefix_operator" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_question_in_conditional" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_reference_symbol_in_referenced_expression" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_semicolon_in_for" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_unary_operator" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_arrow_in_array_creation" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_arrow_in_field_access" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_arrow_in_foreach" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_arrow_in_match_arm" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_arrow_in_method_invocation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_arrow_in_yield" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_assignment_operator" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_attribute_group_end" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_binary_operator" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_array_creation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_cast" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_catch" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_for" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_foreach" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_if" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_list" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_match" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_switch" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_while" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_colon_in_case" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_colon_in_conditional" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_colon_in_default" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_colon_in_enum_type" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_colon_in_named_argument" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_coloncolon_in_field_access" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_coloncolon_in_method_invocation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_array_creation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_attribute_group" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_echo" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_for_inits" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_global" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_list" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_match_arm_conditions" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_match_expressions" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_multiple_constant_declarations" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_static" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_superinterfaces" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_concatenation_operator" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_equal_in_enum_case" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_brace_in_block" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_brace_in_match" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_brace_in_switch" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_array_creation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_catch" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_for" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_foreach" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_if" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_list" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_match" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_switch" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_while" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_postfix_operator" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_prefix_operator" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_question_in_conditional" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_semicolon" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_semicolon_in_for" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_unary_operator" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_between_brackets_in_array_type_reference" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.join_lines_in_comments" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.keep_else_statement_on_same_line" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.keep_elseif_statement_on_same_line" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.keep_imple_if_on_one_line" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.keep_then_statement_on_same_line" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.keep_trailing_comma_in_list" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.lineSplit" value="9999"/>
<setting id="org.eclipse.php.formatter.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.never_indent_line_comments_on_first_column" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_after_namespace" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_after_use_statements" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_at_end_of_class_body" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_at_end_of_method_body" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_before_namespace" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_before_use_statements" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_between_namespaces" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_between_use_statements" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.put_empty_statement_on_new_line" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.tabulation.size" value="4"/>
<setting id="org.eclipse.php.formatter.core.formatter.use_on_off_tags" value="false"/>
</profile>
</profiles>

View File

@ -248,12 +248,11 @@ if (empty($reshook)) {
$result = $object->fetch($id, null, $mode);
$piece_num = (int) $object->piece_num;
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
$action = 'create';
} else {
} elseif ($result > 0) {
$result = $object->delete($user, 0, $mode);
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
@ -980,7 +979,7 @@ if ($action == 'create') {
print '</form>';
}
} else {
print load_fiche_titre($langs->trans("NoRecords"));
print $langs->trans("NoRecordFound");
}
}

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2017-2022 OpenDSI <support@open-dsi.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 Alexandre Janniaux <alexandre.janniaux@gmail.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,6 +104,50 @@ class AccountingJournal extends CommonObject
$this->ismultientitymanaged = 0;
}
/**
* Create a new Accounting Journal.
*
* @param User $user the user that created the journal, currently unused
* @return int Return integer <0 on error, or the ID of the created object
*/
public function create($user)
{
$valid_nature = array(1, 2, 3, 4, 5, 8, 9);
if (!in_array((int) $this->nature, $valid_nature)) {
$this->error = get_class($this)."::Create Error invalid field nature '" . strval($this->nature) . "'";
dol_syslog($this->error, LOG_ERR);
return -1;
}
$sql = "INSERT INTO ".MAIN_DB_PREFIX."accounting_journal";
$sql .= " (entity, code, label, nature, active)";
$sql .= " VALUES ("
. ((int) $this->entity) .",'"
. $this->db->escape($this->code) ."','"
. $this->db->escape($this->label) ."',"
. ((int) $this->nature) .","
. ((int) $this->active) .")";
dol_syslog(get_class($this)."::create", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$this->error = get_class($this)."::Create Error: " . $this->db->lasterror();
dol_syslog($this->error, LOG_ERR);
return -1;
}
$id = $this->db->last_insert_id(MAIN_DB_PREFIX."accounting_journal");
if ($id <= 0) {
$this->error = get_class($this)."::Create Error " . $id . ": " . $this->db->lasterror();
dol_syslog($this->error, LOG_ERR);
return -2;
}
$this->id = $id;
$this->rowid = $id;
return $id;
}
/**
* Load an object from database
*

View File

@ -297,11 +297,11 @@ if ($result) {
$compta_soc = 'NotDefined';
$accountancy_code_general = 'NotDefined';
if ($lineisapurchase > 0) {
$accountancy_code_general = (!empty($obj->accountancy_code_supplier_general)) ? $obj->accountancy_code_supplier_general : $account_supplier;
$accountancy_code_general = (!empty($obj->accountancy_code_supplier_general) && $obj->accountancy_code_supplier_general != '-1') ? $obj->accountancy_code_supplier_general : $account_supplier;
$compta_soc = (($obj->code_compta_fournisseur != "") ? $obj->code_compta_fournisseur : $account_supplier);
}
if ($lineisasale > 0) {
$accountancy_code_general = (!empty($obj->accountancy_code_customer_general)) ? $obj->accountancy_code_customer_general : $account_customer;
$accountancy_code_general = (!empty($obj->accountancy_code_customer_general) && $obj->accountancy_code_customer_general != '-1') ? $obj->accountancy_code_customer_general : $account_customer;
$compta_soc = (!empty($obj->code_compta_client) ? $obj->code_compta_client : $account_customer);
}
@ -446,9 +446,9 @@ if ($result) {
// If we fill it here to, we must concat.
if ($userstatic->id > 0) {
if ($is_sc) {
$tabpay[$obj->rowid]["soclib"] .= ' '.$userstatic->getNomUrl(1, 'accountancy', 0);
$tabpay[$obj->rowid]["soclib"] .= ' '.$userstatic->getNomUrl(-1, 'accountancy', 0);
} else {
$tabpay[$obj->rowid]["soclib"] = $userstatic->getNomUrl(1, 'accountancy', 0);
$tabpay[$obj->rowid]["soclib"] = $userstatic->getNomUrl(-1, 'accountancy', 0);
}
} else {
$tabpay[$obj->rowid]["soclib"] = '???'; // Should not happen, but happens with old data when id of user was not saved on expense report payment.
@ -476,13 +476,10 @@ if ($result) {
$chargestatic->label = $links[$key]['label'];
}
$chargestatic->ref = $chargestatic->label;
//$chargestatic->fetch($chargestatic->id);
$tabpay[$obj->rowid]["soclib"] = $chargestatic->getNomUrl(1, 30);
$tabpay[$obj->rowid]["paymentscid"] = $chargestatic->id;
// Retrieve the accounting code of the social contribution of the payment from link of payment.
// Note: We have the social contribution id, it can be faster to get accounting code from social contribution id.
/*
$sqlmid = "SELECT cchgsoc.accountancy_code";
$sqlmid .= " FROM ".MAIN_DB_PREFIX."c_chargesociales cchgsoc";
$sqlmid .= " INNER JOIN ".MAIN_DB_PREFIX."chargesociales as chgsoc ON chgsoc.fk_type = cchgsoc.id";
@ -495,7 +492,19 @@ if ($result) {
if ($resultmid) {
$objmid = $db->fetch_object($resultmid);
$tabtp[$obj->rowid][$objmid->accountancy_code] = isset($tabtp[$obj->rowid][$objmid->accountancy_code]) ? $tabtp[$obj->rowid][$objmid->accountancy_code] + $amounttouse : $amounttouse;
}*/
$tmpcharge = new ChargeSociales($db);
$resultmid = $tmpcharge->fetch($chargestatic->id);
if ($resultmid) {
$chargestatic->type_label = $tmpcharge->type_label;
$chargestatic->type_code = $tmpcharge->type_code;
$chargestatic->type_accountancy_code = $tmpcharge->type_accountancy_code;
$tabtp[$obj->rowid][$tmpcharge->type_accountancy_code] = isset($tabtp[$obj->rowid][$tmpcharge->type_accountancy_code]) ? $tabtp[$obj->rowid][$tmpcharge->type_accountancy_code] + $amounttouse : $amounttouse;
}
$tabpay[$obj->rowid]["soclib"] = $chargestatic->getNomUrl(1, 30);
$tabpay[$obj->rowid]["paymentscid"] = $chargestatic->id;
} elseif ($links[$key]['type'] == 'payment_donation') {
$paymentdonstatic->id = $links[$key]['url_id'];
$paymentdonstatic->ref = (string) $links[$key]['url_id'];
@ -600,7 +609,7 @@ if ($result) {
}
} elseif ($links[$key]['type'] == 'banktransfert') {
$accountLinestatic->fetch($links[$key]['url_id']);
$tabpay[$obj->rowid]["lib"] .= ' '.$langs->trans("BankTransfer").'- '.$accountLinestatic ->getNomUrl(1);
$tabpay[$obj->rowid]["lib"] .= ' '.$langs->trans("BankTransfer").' '.$accountLinestatic ->getNomUrl(1);
$tabtp[$obj->rowid][$account_transfer] = isset($tabtp[$obj->rowid][$account_transfer]) ? $tabtp[$obj->rowid][$account_transfer] + $amounttouse : $amounttouse;
$bankaccountstatic->fetch($tabpay[$obj->rowid]['fk_bank_account']);
$tabpay[$obj->rowid]["soclib"] = $bankaccountstatic->getNomUrl(2);
@ -699,11 +708,11 @@ if (!$error && $action == 'writebookkeeping' && $user->hasRight('accounting', 'b
$reflabel = '';
if (!empty($val['lib'])) {
$reflabel .= dol_string_nohtmltag($val['lib'])." - ";
$reflabel .= dol_string_nohtmltag($val['lib'])." / ";
}
$reflabel .= $langs->trans("Bank").' '.dol_string_nohtmltag($val['bank_account_ref']);
if (!empty($val['soclib'])) {
$reflabel .= " - ".dol_string_nohtmltag($val['soclib']);
$reflabel .= " / ".dol_string_nohtmltag($val['soclib']);
}
$bookkeeping = new BookKeeping($db);
@ -760,7 +769,7 @@ if (!$error && $action == 'writebookkeeping' && $user->hasRight('accounting', 'b
$reflabel = '';
if (!empty($val['lib'])) {
$reflabel .= dol_string_nohtmltag($val['lib']).($val['soclib'] ? " - " : "");
$reflabel .= dol_string_nohtmltag($val['lib']).($val['soclib'] ? " / " : "");
}
if ($tabtype[$key] == 'banktransfert') {
$reflabel .= dol_string_nohtmltag($langs->transnoentitiesnoconv('TransitionalAccount').' '.$account_transfer);
@ -889,7 +898,7 @@ if (!$error && $action == 'writebookkeeping' && $user->hasRight('accounting', 'b
if ($mt) {
$reflabel = '';
if (!empty($val['lib'])) {
$reflabel .= dol_string_nohtmltag($val['lib'])." - ";
$reflabel .= dol_string_nohtmltag($val['lib'])." / ";
}
$reflabel .= dol_string_nohtmltag('WaitingAccount');
@ -1010,11 +1019,11 @@ if ($action == 'exportcsv' && $user->hasRight('accounting', 'bind', 'write')) {
if ($mt) {
$reflabel = '';
if (!empty($val['lib'])) {
$reflabel .= dol_string_nohtmltag($val['lib'])." - ";
$reflabel .= dol_string_nohtmltag($val['lib'])." / ";
}
$reflabel .= $langs->trans("Bank").' '.dol_string_nohtmltag($val['bank_account_ref']);
if (!empty($val['soclib'])) {
$reflabel .= " - ".dol_string_nohtmltag($val['soclib']);
$reflabel .= " / ".dol_string_nohtmltag($val['soclib']);
}
print '"'.$key.'"'.$sep;
@ -1037,7 +1046,7 @@ if ($action == 'exportcsv' && $user->hasRight('accounting', 'bind', 'write')) {
if ($mt) {
$reflabel = '';
if (!empty($val['lib'])) {
$reflabel .= dol_string_nohtmltag($val['lib']).($val['soclib'] ? " - " : "");
$reflabel .= dol_string_nohtmltag($val['lib']).($val['soclib'] ? " / " : "");
}
if ($tabtype[$key] == 'banktransfert') {
$reflabel .= dol_string_nohtmltag($langs->transnoentitiesnoconv('TransitionalAccount').' '.$account_transfer);
@ -1076,7 +1085,7 @@ if ($action == 'exportcsv' && $user->hasRight('accounting', 'bind', 'write')) {
if ($mt) {
$reflabel = '';
if (!empty($val['lib'])) {
$reflabel .= dol_string_nohtmltag($val['lib'])." - ";
$reflabel .= dol_string_nohtmltag($val['lib'])." / ";
}
$reflabel .= dol_string_nohtmltag('WaitingAccount');
@ -1250,8 +1259,6 @@ if (empty($action) || $action == 'view') {
print '<td class="right">'.$langs->trans("AccountingCredit")."</td>";
print "</tr>\n";
$r = '';
foreach ($tabpay as $key => $val) { // $key is rowid in llx_bank
$date = dol_print_date($val["date"], 'day');
@ -1262,22 +1269,22 @@ if (empty($action) || $action == 'view') {
if ($mt) {
$reflabel = '';
if (!empty($val['lib'])) {
$reflabel .= $val['lib']." - ";
$reflabel .= $val['lib']." / ";
}
$reflabel .= $langs->trans("Bank").' '.$val['bank_account_ref'];
if (!empty($val['soclib'])) {
$reflabel .= " - ".$val['soclib'];
$reflabel .= " / ".$val['soclib'];
}
//var_dump($tabpay[$key]);
print '<!-- Bank bank.rowid='.$key.' type='.$tabpay[$key]['type'].' ref='.$tabpay[$key]['ref'].'-->';
print '<!-- Bank bank.rowid='.$key.'=accounting_bookkeeping.fk_doc (accounting_bookkeeping.doc_type=\'bank\') type='.$tabpay[$key]['type'].' ref='.$tabpay[$key]['ref'].' -->';
print '<tr class="oddeven">';
// Date
print "<td>".$date."</td>";
// Ref
print "<td>".dol_escape_htmltag($ref)."</td>";
print '<td class="maxwidth300 nopaddingtopimp nopaddingbottomimp">'.dol_escape_htmltag($ref)."</td>";
// Ledger account
$accounttoshow = length_accountg($k);
@ -1299,7 +1306,7 @@ if (empty($action) || $action == 'view') {
print "</td>";
// Label operation
print '<td>';
print '<td class="maxwidth300 nopaddingtopimp nopaddingbottomimp">';
print $reflabel; // This is already html escaped content
print "</td>";
@ -1318,7 +1325,7 @@ if (empty($action) || $action == 'view') {
if ($mt) {
$reflabel = '';
if (!empty($val['lib'])) {
$reflabel .= $val['lib'].(isset($val['soclib']) ? " - " : "");
$reflabel .= $val['lib'].(isset($val['soclib']) ? " / " : "");
}
if ($tabtype[$key] == 'banktransfert') {
$reflabel .= $langs->trans('TransitionalAccount').' '.$account_transfer;
@ -1326,14 +1333,14 @@ if (empty($action) || $action == 'view') {
$reflabel .= isset($val['soclib']) ? $val['soclib'] : "";
}
print '<!-- Thirdparty bank.rowid='.$key.' -->';
print '<!-- Thirdparty bank.rowid='.$key.'=accounting_bookkeeping.fk_doc (accounting_bookkeeping.doc_type=\'bank\') type='.$tabpay[$key]['type'].' ref='.$tabpay[$key]['ref'].' -->';
print '<tr class="oddeven">';
// Date
print "<td>".$date."</td>";
// Ref
print "<td>".dol_escape_htmltag($ref)."</td>";
// Ref / Piece
print '<td class="nopaddingtopimp nopaddingbottomimp">'.dol_escape_htmltag($ref)."</td>";
// Ledger account
@ -1405,9 +1412,11 @@ if (empty($action) || $action == 'view') {
if (empty($accounttoshowsubledger) || $accounttoshowsubledger == 'NotDefined') {
//print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
if (!empty($tabcompany[$key]['code_compta'])) {
if (in_array($tabtype[$key], array('payment_various', 'payment_salary'))) {
if (in_array($tabtype[$key], array('payment_various'))) {
// For such case, if subledger is not defined, we won't use subledger accounts.
$accounttoshowsubledger = '<span class="warning small">'.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownSubledgerIgnored").'</span>';
} elseif (in_array($tabtype[$key], array('payment_salary'))) {
$accounttoshowsubledger = '<span class="warning small">'.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownSubledgerIgnored2").'</span>';
} else {
$accounttoshowsubledger = '<span class="warning small">'.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknown", $tabcompany[$key]['code_compta']).'</span>';
}
@ -1419,11 +1428,14 @@ if (empty($action) || $action == 'view') {
$accounttoshowsubledger = '';
}
}
print '<td class="maxwidth300">';
print '<td class="maxwidth300 nopaddingtopimp nopaddingbottomimp">';
print $accounttoshowsubledger; // This is a html string
print "</td>";
print "<td>".$reflabel."</td>";
// Label operation
print '<td class="nopaddingtopimpo paddingbottomimp">';
print $reflabel; // This is a html string
print "</td>";
print '<td class="center">'.$val["type_payment"]."</td>";
@ -1441,7 +1453,7 @@ if (empty($action) || $action == 'view') {
if ($mt) {
$reflabel = '';
if (!empty($val['lib'])) {
$reflabel .= $val['lib']." - ";
$reflabel .= $val['lib']." / ";
}
$reflabel .= 'WaitingAccount';

View File

@ -3,7 +3,7 @@
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013-2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2013-2025 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
@ -1276,12 +1276,10 @@ if (empty($action) || $action == 'view') {
// Subledger account
print "<td>";
print '</td>';
print "<td>";
$tmpvatrate = (empty($def_tva[$key][$k]) ? (empty($arrayofvat[$key][$k]) ? '' : $arrayofvat[$key][$k]) : implode(', ', $def_tva[$key][$k]));
$labelvatrate = $langs->trans("Taxes").' '.$tmpvatrate.' %';
$labelvatrate .= ($numtax ? ' - Localtax '.$numtax : '');
print "<td>" . $bookkeepingstatic->accountingLabelForOperation($companystatic->getNomUrl(0, 'supplier'), $invoicestatic->ref_supplier, $labelvatrate) . "</td>";
print "</td>";
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
print "</tr>";

View File

@ -233,7 +233,7 @@ if ($result) {
$obj = $db->fetch_object($result);
// Controls
$accountancy_code_customer_general = (!empty($obj->accountancy_code_customer_general)) ? $obj->accountancy_code_customer_general : $cptcli;
$accountancy_code_customer_general = (!empty($obj->accountancy_code_customer_general) && $obj->accountancy_code_customer_general != '-1') ? $obj->accountancy_code_customer_general : $cptcli;
$compta_soc = (!empty($obj->code_compta_client)) ? $obj->code_compta_client : $cptcli;
$compta_prod = $obj->compte;
@ -611,7 +611,7 @@ if ($action == 'writebookkeeping' && !$error && $user->hasRight('accounting', 'b
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
$bookkeeping->numero_compte = !empty($tabcompany[$key]['accountancy_code_customer_general']) ? $tabcompany[$key]['accountancy_code_customer_general'] : $cptcli;
$bookkeeping->numero_compte = (!empty($tabcompany[$key]['accountancy_code_customer_general']) && $tabcompany[$key]['accountancy_code_customer_general'] != '-1') ? $tabcompany[$key]['accountancy_code_customer_general'] : $cptcli;
$bookkeeping->label_compte = $accountingaccountcustomer->label;
$bookkeeping->label_operation = $bookkeepingstatic->accountingLabelForOperation($companystatic->name, $invoicestatic->ref, $langs->trans("SubledgerAccount"));
@ -920,7 +920,7 @@ if ($action == 'exportcsv' && !$error) { // ISO and not UTF8 !
foreach ($tabfac as $key => $val) {
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
$companystatic->accountancy_code_customer_general = !empty($tabcompany[$key]['accountancy_code_customer_general']) ? $tabcompany[$key]['accountancy_code_customer_general'] : $cptcli;
$companystatic->accountancy_code_customer_general = (!empty($tabcompany[$key]['accountancy_code_customer_general']) && $tabcompany[$key]['accountancy_code_customer_general'] != '-1') ? $tabcompany[$key]['accountancy_code_customer_general'] : $cptcli;
$companystatic->code_compta = $tabcompany[$key]['code_compta']; // deprecated
$companystatic->code_compta_client = $tabcompany[$key]['code_compta'];
$companystatic->code_client = $tabcompany[$key]['code_client'];
@ -1174,7 +1174,7 @@ if (empty($action) || $action == 'view') {
foreach ($tabfac as $key => $val) {
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
$companystatic->accountancy_code_customer_general = !empty($tabcompany[$key]['accountancy_code_customer_general']) ? $tabcompany[$key]['accountancy_code_customer_general'] : $cptcli;
$companystatic->accountancy_code_customer_general = (!empty($tabcompany[$key]['accountancy_code_customer_general']) && $tabcompany[$key]['accountancy_code_customer_general'] != '-1') ? $tabcompany[$key]['accountancy_code_customer_general'] : $cptcli;
$companystatic->code_compta = $tabcompany[$key]['code_compta'];
$companystatic->code_compta_client = $tabcompany[$key]['code_compta'];
$companystatic->code_client = $tabcompany[$key]['code_client'];
@ -1281,7 +1281,7 @@ if (empty($action) || $action == 'view') {
// Account
print "<td>";
$accountoshow = length_accountg($companystatic->accountancy_code_customer_general);
if (($accountoshow == "") || $accountoshow == 'NotDefined') {
if (($accountoshow == "") || $accountoshow == "-1" || $accountoshow == 'NotDefined') {
print '<span class="error">'.$langs->trans("MainAccountForCustomersNotDefined").'</span>';
} else {
print $accountoshow;

View File

@ -861,6 +861,27 @@ if (empty($reshook)) {
}
}
if ($action == 'update_extras' && $user->hasRight('adherent', 'creer')) {
$object->oldcopy = dol_clone($object, 2);
$attribute_name = GETPOST('attribute', 'restricthtml');
// Fill array 'array_options' with data from update form
$ret = $extrafields->setOptionalsFromPost(null, $object, $attribute_name);
if ($ret < 0) {
$error++;
}
if (!$error) {
$result = $object->updateExtraField($attribute_name, 'MEMBER_MODIFY');
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
}
if ($error) {
$action = 'edit_extras';
}
}
// SPIP Management
if (is_object($mailmanspip)) {
if ($user->hasRight('adherent', 'supprimer') && $action == 'confirm_del_spip' && $confirm == 'yes') {

View File

@ -763,6 +763,11 @@ class Adherent extends CommonObject
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
if (empty($this->country_id) && !empty($this->country_code)) {
$country_id = getCountry($this->country_code, '3');
$this->country_id = is_int($country_id) ? $country_id : 0;
}
$nbrowsaffected = 0;
$error = 0;

View File

@ -3,7 +3,7 @@
* Copyright (C) 2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2020 Thibault FOUCART <support@ptibogxiv.net>
* Copyright (C) 2020-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 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
@ -37,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
class Members extends DolibarrApi
{
/**
* @var string[] $FIELDS Mandatory fields, checked when create and update object
* @var string[] Mandatory fields, checked when create and update object
*/
public static $FIELDS = array(
'morphy',
@ -159,7 +159,7 @@ class Members extends DolibarrApi
throw new RestException(404, 'member not found');
}
} else {
throw new RestException(404, 'This account have many thirdparties attached or does not exist.');
throw new RestException(404, 'This account have many thirdparties attached or does not exist.');
}
if (!DolibarrApi::_checkAccessToResource('adherent', $member->id)) {
@ -355,7 +355,9 @@ class Members extends DolibarrApi
/**
* Create member object
*
* @param array<string,string> $request_data Request data
* @param array $request_data Request data
* @phan-param ?array<string,string> $request_data
* @phpstan-param ?array<string,string> $request_data
* @return int ID of member
*
* @throws RestException 403 Access denied
@ -425,7 +427,7 @@ class Members extends DolibarrApi
}
if ($field == 'array_options' && is_array($value)) {
foreach ($value as $index => $val) {
$member->array_options[$index] = $val;
$member->array_options[$index] = $this->_checkValForAPI($field, $val, $member);
}
continue;
}

View File

@ -0,0 +1,343 @@
<?php
/* Copyright (C) 2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2025 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use Luracast\Restler\RestException;
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
/**
* API class for members types
*
* @access protected
* @class DolibarrApiAccess {@requires user,external}
*/
class MembersTypes extends DolibarrApi
{
/**
* @var string[] Mandatory fields, checked when create and update object
*/
public static $FIELDS = array(
'label',
);
/**
* Constructor
*/
public function __construct()
{
global $db;
$this->db = $db;
}
/**
* Get properties of a member type object
*
* Return an array with member type information
*
* @param int $id ID of member type
* @return Object Object with cleaned properties
*
* @throws RestException
*/
public function get($id)
{
if (!DolibarrApiAccess::$user->hasRight('adherent', 'lire')) {
throw new RestException(401);
}
$membertype = new AdherentType($this->db);
$result = $membertype->fetch($id);
if (!$result) {
throw new RestException(404, 'member type not found');
}
if (!DolibarrApi::_checkAccessToResource('member', $membertype->id, 'adherent_type')) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
return $this->_cleanObjectDatas($membertype);
}
/**
* List members types
*
* Get a list of members types
*
* @param string $sortfield Sort field
* @param string $sortorder Sort order
* @param int $limit Limit for list
* @param int $page Page number
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.libelle:like:'SO-%') and (t.subscription:=:'1')"
* @param string $properties Restrict the data returned to these properties. Ignored if empty. Comma separated list of properties names
* @return array Array of member type objects
* @phan-return AdherentType[]
* @phpstan-return AdherentType[]
*
* @throws RestException
*/
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '', $properties = '')
{
$obj_ret = array();
if (!DolibarrApiAccess::$user->hasRight('adherent', 'lire')) {
throw new RestException(401);
}
$sql = "SELECT t.rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type AS t LEFT JOIN ".MAIN_DB_PREFIX."adherent_type_extrafields AS ef ON (ef.fk_object = t.rowid)"; // Modification VMR Global Solutions to include extrafields as search parameters in the API GET call, so we will be able to filter on extrafields
$sql .= ' WHERE t.entity IN ('.getEntity('member_type').')';
// Add sql filters
if ($sqlfilters) {
$errormessage = '';
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
if ($errormessage) {
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
}
}
$sql .= $this->db->order($sortfield, $sortorder);
if ($limit) {
if ($page < 0) {
$page = 0;
}
$offset = $limit * $page;
$sql .= $this->db->plimit($limit + 1, $offset);
}
$result = $this->db->query($sql);
if ($result) {
$i = 0;
$num = $this->db->num_rows($result);
$min = min($num, ($limit <= 0 ? $num : $limit));
while ($i < $min) {
$obj = $this->db->fetch_object($result);
$membertype = new AdherentType($this->db);
if ($membertype->fetch($obj->rowid)) {
$obj_ret[] = $this->_filterObjectProperties($this->_cleanObjectDatas($membertype), $properties);
}
$i++;
}
} else {
throw new RestException(503, 'Error when retrieve member type list : '.$this->db->lasterror());
}
return $obj_ret;
}
/**
* Create member type object
*
* @param array $request_data Request data
* @phan-param ?array<string,string> $request_data
* @phpstan-param ?array<string,string> $request_data
* @return int ID of member type
*/
public function post($request_data = null)
{
if (!DolibarrApiAccess::$user->hasRight('adherent', 'configurer')) {
throw new RestException(401);
}
// Check mandatory fields. Throw exception on error.
$this->_validate($request_data);
$membertype = new AdherentType($this->db);
foreach ($request_data as $field => $value) {
if ($field === 'caller') {
// Add a mention of caller so on trigger called after action, we can filter to avoid a loop if we try to sync back again with the caller
$membertype->context['caller'] = $request_data['caller'];
continue;
}
$membertype->$field = $value;
}
if ($membertype->create(DolibarrApiAccess::$user) < 0) {
throw new RestException(500, 'Error creating member type', array_merge(array($membertype->error), $membertype->errors));
}
return $membertype->id;
}
/**
* Update member type
*
* @param int $id ID of member type to update
* @param array $request_data Datas
* @phan-param ?array<string,string> $request_data
* @phpstan-param ?array<string,string> $request_data
* @return Object
*/
public function put($id, $request_data = null)
{
if (!DolibarrApiAccess::$user->hasRight('adherent', 'configurer')) {
throw new RestException(401);
}
$membertype = new AdherentType($this->db);
$result = $membertype->fetch($id);
if (!$result) {
throw new RestException(404, 'member type not found');
}
if (!DolibarrApi::_checkAccessToResource('member', $membertype->id, 'adherent_type')) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
foreach ($request_data as $field => $value) {
if ($field == 'id') {
continue;
}
if ($field === 'caller') {
// Add a mention of caller so on trigger called after action, we can filter to avoid a loop if we try to sync back again with the caller
$membertype->context['caller'] = $request_data['caller'];
continue;
}
if ($field == 'array_options' && is_array($value)) {
foreach ($value as $index => $val) {
$membertype->array_options[$index] = $this->_checkValForAPI($field, $val, $membertype);
}
continue;
}
// Process the status separately because it must be updated using
// the validate(), resiliate() and exclude() methods of the class AdherentType.
$membertype->$field = $this->_checkValForAPI($field, $value, $membertype);
}
// If there is no error, update() returns the number of affected rows
// so if the update is a no op, the return value is zero.
if ($membertype->update(DolibarrApiAccess::$user) >= 0) {
return $this->get($id);
} else {
throw new RestException(500, 'Error when updating member type: '.$membertype->error);
}
}
/**
* Delete member type
*
* @param int $id member type ID
* @return array
* @phan-return array<string,array{code:int,message:string}>
* @phpstan-return array<string,array{code:int,message:string}>
*/
public function delete($id)
{
if (!DolibarrApiAccess::$user->hasRight('adherent', 'configurer')) {
throw new RestException(401);
}
$membertype = new AdherentType($this->db);
$result = $membertype->fetch($id);
if (!$result) {
throw new RestException(404, 'member type not found');
}
if (!DolibarrApi::_checkAccessToResource('member', $membertype->id, 'adherent_type')) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$res = $membertype->delete(DolibarrApiAccess::$user);
if ($res < 0) {
throw new RestException(500, "Can't delete, error occurs");
} elseif ($res == 0) {
throw new RestException(409, "Can't delete, that product is probably used");
}
return array(
'success' => array(
'code' => 200,
'message' => 'Member type deleted'
)
);
}
/**
* Validate fields before creating an object
*
* @param ?array<null|int|float|string> $data Data to validate
* @return array<string,null|int|float|string>
*
* @throws RestException
*/
private function _validate($data)
{
$membertype = array();
foreach (MembersTypes::$FIELDS as $field) {
if (!isset($data[$field])) {
throw new RestException(400, "$field field missing");
}
$membertype[$field] = $data[$field];
}
return $membertype;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Clean sensible object datas
*
* @param Object $object Object to clean
* @return Object Object with cleaned properties
*/
protected function _cleanObjectDatas($object)
{
// phpcs:enable
$object = parent::_cleanObjectDatas($object);
unset($object->array_options);
unset($object->linkedObjectsIds);
unset($object->context);
unset($object->canvas);
unset($object->fk_project);
unset($object->contact);
unset($object->contact_id);
unset($object->thirdparty);
unset($object->user);
unset($object->origin);
unset($object->origin_id);
unset($object->ref_ext);
unset($object->country);
unset($object->country_id);
unset($object->country_code);
unset($object->barcode_type);
unset($object->barcode_type_code);
unset($object->barcode_type_label);
unset($object->barcode_type_coder);
unset($object->mode_reglement_id);
unset($object->cond_reglement_id);
unset($object->cond_reglement);
unset($object->fk_delivery_address);
unset($object->shipping_method_id);
unset($object->model_pdf);
unset($object->fk_account);
unset($object->note_public);
unset($object->note_private);
unset($object->fk_incoterms);
unset($object->label_incoterms);
unset($object->location_incoterms);
unset($object->name);
unset($object->lastname);
unset($object->firstname);
unset($object->civility_id);
unset($object->total_ht);
unset($object->total_tva);
unset($object->total_localtax1);
unset($object->total_localtax2);
unset($object->total_ttc);
return $object;
}
}

View File

@ -234,6 +234,12 @@ class Subscriptions extends DolibarrApi
continue;
}
if ($field == 'array_options' && is_array($value)) {
foreach ($value as $index => $val) {
$subscription->array_options[$index] = $this->_checkValForAPI($field, $val, $subscription);
}
continue;
}
$subscription->$field = $this->_checkValForAPI($field, $value, $subscription);
}

View File

@ -598,7 +598,7 @@ $tabcond[DICT_ASSET_DISPOSAL_TYPE] = isModEnabled('asset');
// List of help for fields (no more used, help is defined into tabcomplete)
$tabhelp = array();
// Table to store complete information (will replace all other table). Key is table name.
// Table to store complete information (will replace all other tables). Key is table name.
$tabcomplete = array(
'c_forme_juridique' => array(
'picto' => 'company',
@ -2367,7 +2367,10 @@ if ($id > 0) {
continue;
}
if ($value == 'element') {
// Management of several special cases and exceptions
if ($value == 'code' && $id == DICT_PRODUCT_NATURE) {
$valuetoshow = (int) $valuetoshow;
} elseif ($value == 'element') {
$valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow;
} elseif ($value == 'source') {
$valuetoshow = isset($sourceList[$valuetoshow]) ? $sourceList[$valuetoshow] : $valuetoshow;
@ -2543,6 +2546,7 @@ if ($id > 0) {
$valuetoshow = $TDurationTypes[$obj->{$value}];
}
}
$class .= ($class ? ' ' : '').'tddict';
if ($value == 'name') {
$class .= ' tdoverflowmax200';
@ -2679,7 +2683,11 @@ if ($id > 0) {
print '<tr class="oddeven"><td class="minwidth200">';
if (!empty($tabcond[$i])) {
$tabnamenoprefix = preg_replace('/'.MAIN_DB_PREFIX.'/', '', $tabname[$i]);
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$i.'">';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$i;
if ($i == DICT_CHARGESOCIALES) {
print '&search_country_id='.$mysoc->country_id;
}
print '">';
if (!empty($tabcomplete[$tabnamenoprefix]['picto'])) {
print img_picto('', $tabcomplete[$tabnamenoprefix]['picto'], 'class="pictofixedwidth paddingrightonly"');
}
@ -2786,12 +2794,11 @@ function dictFieldList($fieldlist, $obj = null, $tabname = '', $context = '')
print '</td>';
} elseif ($value == 'department_buyer') {
if ($context == 'edit') {
print '<td>';
print '<td class="nowraponall">';
// show department buyer list
$country_code = (!empty($obj->country_code) ? $obj->country_code : '');
$department_buyer_id = (!empty($obj->department_buyer_id) ? (int) $obj->department_buyer_id : 0);
if ($country_code != '') {
print img_picto('', 'state', 'class="pictofixedwidth"');
print $formcompany->select_state($department_buyer_id, $country_code, 'department_buyer_id', 'minwidth100 maxwidth150 maxwidthonsmartphone');
}
print '</td>';

View File

@ -92,7 +92,7 @@ if ($action == 'add' || GETPOST("modify")) {
// Supprime boite box_external_rss de definition des boites
/* $sql = "UPDATE ".MAIN_DB_PREFIX."boxes_def";
$sql.= " SET name = '".$db->escape($boxlabel)."'";
$sql.= " WHERE file ='box_external_rss.php' AND note like '".$db->escape(GETPOST("norss"))." %'";
$sql.= " WHERE file ='box_external_rss.php' AND note LIKE '".$db->escape(GETPOST("norss"))." %'";
$resql=$db->query($sql);
if (! $resql)

View File

@ -325,7 +325,12 @@ if ($action == 'update') {
if ($mode == 'css') {
//file_put_contents(DOL_DATA_ROOT.'/admin/customcss.css', $data);
//dol_chmod(DOL_DATA_ROOT.'/admin/customcss.css');
dolibarr_set_const($db, "MAIN_IHM_CUSTOM_CSS", GETPOST('MAIN_IHM_CUSTOM_CSS', 'restricthtml'), 'chaine', 0, '', $conf->entity);
$csscontent = GETPOST('MAIN_IHM_CUSTOM_CSS', 'restricthtml');
$csscontent = dol_string_nohtmltag($csscontent, 2);
dolibarr_set_const($db, "MAIN_IHM_CUSTOM_CSS", $csscontent, 'chaine', 0, '', $conf->entity);
setEventMessages($langs->trans("RecordSaved"), null);
}
$_SESSION["mainmenu"] = ""; // The menu manager may have changed

View File

@ -1,11 +1,11 @@
<?php
/* Copyright (C) 2013-2018 Jean-François FERRY <hello@librethic.io>
* Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
* Copyright (C) 2022-2023 Udo Tamm <dev@dolibit.de>
* Copyright (C) 2023 Alexandre Spangaro <aspangaro@easya.solutions>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 Benjamin Falière <benjamin.faliere@altairis.fr>
/* Copyright (C) 2013-2018 Jean-François FERRY <hello@librethic.io>
* Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
* Copyright (C) 2022-2023 Udo Tamm <dev@dolibit.de>
* Copyright (C) 2023 Alexandre Spangaro <aspangaro@easya.solutions>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2025 Benjamin Falière <benjamin.faliere@altairis.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
@ -563,7 +563,7 @@ print '</tr>';
// Auto assign ticket to user who created it
print '<tr class="oddeven">';
print '<td>'.$langs->trans("TicketsAutoAssignTicket").'</td>';
print '<td><label for="TICKET_AUTO_ASSIGN_USER_CREATE" class="block">'.$langs->trans("TicketsAutoAssignTicket").'</label></td>';
print '<td class="left">';
print '<input class="minwidth100" type="text" id="TICKET_AUTO_ASSIGN_USER_CREATE" name="TICKET_AUTO_ASSIGN_USER_CREATE" value="'.getDolGlobalString('TICKET_AUTO_ASSIGN_USER_CREATE').'">';
print '</td>';
@ -598,9 +598,9 @@ print '</td>';
print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("TicketsDelayBeforeFirstAnswer")."</td>";
print '<td><label for="delay_first_response" class="block">'.$langs->trans("TicketsDelayBeforeFirstAnswer")."</label></td>";
print '<td class="left">
<input type="number" value="'.getDolGlobalString('TICKET_DELAY_BEFORE_FIRST_RESPONSE').'" name="delay_first_response" class="width50">
<input type="number" value="'.getDolGlobalString('TICKET_DELAY_BEFORE_FIRST_RESPONSE').'" id="delay_first_response" name="delay_first_response" class="width50">
</td>';
print '<td class="center">';
print $formcategory->textwithpicto('', $langs->trans("TicketsDelayBeforeFirstAnswerHelp"), 1, 'help');
@ -608,9 +608,9 @@ print '</td>';
print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("TicketsDelayBetweenAnswers")."</td>";
print '<td><label for="delay_between_responses" class="block">'.$langs->trans("TicketsDelayBetweenAnswers")."</label></td>";
print '<td class="left">
<input type="number" value="'.getDolGlobalString('TICKET_DELAY_SINCE_LAST_RESPONSE').'" name="delay_between_responses" class="width50">
<input type="number" value="'.getDolGlobalString('TICKET_DELAY_SINCE_LAST_RESPONSE').'" id="delay_between_responses" name="delay_between_responses" class="width50">
</td>';
print '<td class="center">';
print $formcategory->textwithpicto('', $langs->trans("TicketsDelayBetweenAnswersHelp"), 1, 'help');
@ -655,18 +655,18 @@ if (!getDolGlobalString('FCKEDITOR_ENABLE_MAIL')) {
// TODO Use module notification instead...
// Email to send notifications
print '<tr class="oddeven"><td>'.$langs->trans("TicketEmailNotificationFrom").'</td>';
print '<tr class="oddeven"><td><label for="TICKET_NOTIFICATION_EMAIL_FROM" class="block">'.$langs->trans("TicketEmailNotificationFrom").'</label></td>';
print '<td class="left">';
print '<input type="text" class="minwidth200" name="TICKET_NOTIFICATION_EMAIL_FROM" value="' . getDolGlobalString('TICKET_NOTIFICATION_EMAIL_FROM').'"></td>';
print '<input type="text" class="minwidth200" id="TICKET_NOTIFICATION_EMAIL_FROM" name="TICKET_NOTIFICATION_EMAIL_FROM" value="' . getDolGlobalString('TICKET_NOTIFICATION_EMAIL_FROM').'"></td>';
print '<td class="center">';
print $formcategory->textwithpicto('', $langs->trans("TicketEmailNotificationFromHelp"), 1, 'help');
print '</td>';
print '</tr>';
// Email for notification of TICKET_CREATE
print '<tr class="oddeven"><td>'.$langs->trans("TicketEmailNotificationTo").'</td>';
print '<tr class="oddeven"><td><label for="TICKET_NOTIFICATION_EMAIL_TO" class="block">'.$langs->trans("TicketEmailNotificationTo").'</label></td>';
print '<td class="left">';
print '<input type="text" class="minwidth200" name="TICKET_NOTIFICATION_EMAIL_TO" value="'.getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO').'"></td>';
print '<input type="text" class="minwidth200" id="TICKET_NOTIFICATION_EMAIL_TO" name="TICKET_NOTIFICATION_EMAIL_TO" value="'.getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO').'"></td>';
print '<td class="center">';
print $formcategory->textwithpicto('', $langs->trans("TicketEmailNotificationToHelp"), 1, 'help');
print '</td>';

View File

@ -249,11 +249,10 @@ class Boms extends DolibarrApi
if ($field == 'array_options' && is_array($value)) {
foreach ($value as $index => $val) {
$this->bom->array_options[$index] = $this->_checkValForAPI('extrafields', $val, $this->bom);
$this->bom->array_options[$index] = $this->_checkValForAPI($field, $val, $this->bom);
}
continue;
}
$this->bom->$field = $this->_checkValForAPI($field, $value, $this->bom);
}

View File

@ -252,6 +252,13 @@ class Categories extends DolibarrApi
continue;
}
if ($field == 'array_options' && is_array($value)) {
foreach ($value as $index => $val) {
$this->category->array_options[$index] = $this->_checkValForAPI($field, $val, $this->category);
}
continue;
}
$this->category->$field = $this->_checkValForAPI($field, $value, $this->category);
}

View File

@ -1187,9 +1187,10 @@ class Categorie extends CommonObject
* - string (categories ids separated by comma)
* - array (list of categories ids)
* @param int<0,1> $include [=0] Removed or 1=Keep only
* @param string $forcelangcode Lang code to force ('fr_FR', 'en_US', ...)
* @return int<-1,-1>|array<int,array{rowid:int,id:int,fk_parent:int,label:string,description:string,color:string,position:string,visible:int,ref_ext:string,picto:string,fullpath:string,fulllabel:string,level:?int}> Array of categories. this->cats and this->motherof are set, -1 on error
*/
public function get_full_arbo($type, $fromid = 0, $include = 0)
public function get_full_arbo($type, $fromid = 0, $include = 0, $forcelangcode = '')
{
// phpcs:enable
global $langs;
@ -1219,7 +1220,12 @@ class Categorie extends CommonObject
// Init this->motherof that is array(id_son=>id_parent, ...)
$this->load_motherof();
$current_lang = $langs->getDefaultLang();
if ($forcelangcode) {
$current_lang = $forcelangcode;
} else {
$current_lang = $langs->getDefaultLang();
}
// Init $this->cats array
$sql = "SELECT DISTINCT c.rowid, c.label, c.ref_ext, c.description, c.color, c.position, c.fk_parent, c.visible"; // Distinct reduce pb with old tables with duplicates
@ -1228,7 +1234,7 @@ class Categorie extends CommonObject
}
$sql .= " FROM ".MAIN_DB_PREFIX."categorie as c";
if (getDolGlobalInt('MAIN_MULTILANGS')) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_lang as t ON t.fk_category=c.rowid AND t.lang='".$this->db->escape($current_lang)."'";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_lang as t ON t.fk_category=c.rowid AND t.lang = '".$this->db->escape($current_lang)."'";
}
$sql .= " WHERE c.entity IN (".getEntity('category').")";
$sql .= " AND c.type = ".(int) $type;

View File

@ -287,6 +287,12 @@ class AgendaEvents extends DolibarrApi
continue;
}
if ($field == 'array_options' && is_array($value)) {
foreach ($value as $index => $val) {
$this->actioncomm->array_options[$index] = $this->_checkValForAPI($field, $val, $this->actioncomm);
}
continue;
}
$this->actioncomm->$field = $this->_checkValForAPI($field, $value, $this->actioncomm);
}

View File

@ -120,7 +120,7 @@ if (!empty($search_company)) {
$sql .= " AND s.nom LIKE '%".$db->escape($search_company)."%'";
}
if (!empty($contactname)) { // access a partir du module de recherche
$sql .= " AND (p.lastname LIKE '%".$db->escape($contactname)."%' OR lower(p.firstname) LIKE '%".$db->escape($contactname)."%') ";
$sql .= " AND (p.lastname LIKE '%".$db->escape($contactname)."%' OR p.firstname LIKE '%".$db->escape($contactname)."%') ";
$sortfield = "p.lastname";
$sortorder = "ASC";
}

View File

@ -336,7 +336,7 @@ class Commande extends CommonOrder
'fk_mode_reglement' => array('type' => 'integer', 'label' => 'PaymentMode', 'enabled' => 1, 'visible' => -1, 'position' => 185),
'date_livraison' => array('type' => 'date', 'label' => 'DateDeliveryPlanned', 'enabled' => 1, 'visible' => -1, 'position' => 190, 'csslist' => 'nowraponall'),
'fk_shipping_method' => array('type' => 'integer', 'label' => 'ShippingMethod', 'enabled' => 1, 'visible' => -1, 'position' => 195),
'fk_warehouse' => array('type' => 'integer:Entrepot:product/stock/class/entrepot.class.php', 'label' => 'Fk warehouse', 'enabled' => 'isModEnabled("stock")', 'visible' => -1, 'position' => 200),
'fk_warehouse' => array('type' => 'integer:Entrepot:product/stock/class/entrepot.class.php', 'label' => 'DefaultWarehouse', 'enabled' => 'isModEnabled("stock")', 'visible' => -1, 'position' => 200, 'nodepth' => 1),
'fk_availability' => array('type' => 'integer', 'label' => 'Availability', 'enabled' => 1, 'visible' => -1, 'position' => 205),
'fk_input_reason' => array('type' => 'integer', 'label' => 'InputReason', 'enabled' => 1, 'visible' => -1, 'position' => 210),
//'fk_delivery_address' =>array('type'=>'integer', 'label'=>'DeliveryAddress', 'enabled'=>1, 'visible'=>-1, 'position'=>215),
@ -534,7 +534,7 @@ class Commande extends CommonOrder
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
$sql .= " SET ref = '".$this->db->escape($num)."',";
$sql .= " fk_statut = ".self::STATUS_VALIDATED.",";
$sql .= " date_valid='".$this->db->idate($now)."',";
$sql .= " date_valid = '".$this->db->idate($now)."',";
$sql .= " fk_user_valid = ".($user->id > 0 ? (int) $user->id : "null").",";
$sql .= " fk_user_modif = ".((int) $user->id);
$sql .= " WHERE rowid = ".((int) $this->id);
@ -655,7 +655,7 @@ class Commande extends CommonOrder
public function setDraft($user, $idwarehouse = -1)
{
//phpcs:enable
global $conf, $langs;
global $langs;
$error = 0;
@ -857,7 +857,7 @@ class Commande extends CommonOrder
*/
public function cancel($idwarehouse = -1)
{
global $conf, $user, $langs;
global $user, $langs;
$error = 0;
@ -1234,7 +1234,7 @@ class Commande extends CommonOrder
*/
public function createFromClone(User $user, $socid = 0)
{
global $conf, $user, $hookmanager;
global $user, $hookmanager;
$error = 0;
@ -1537,7 +1537,7 @@ class Commande extends CommonOrder
*/
public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $info_bits = 0, $fk_remise_except = 0, $price_base_type = 'HT', $pu_ttc = 0, $date_start = '', $date_end = '', $type = 0, $rang = -1, $special_code = 0, $fk_parent_line = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $array_options = array(), $fk_unit = null, $origin = '', $origin_id = 0, $pu_ht_devise = 0, $ref_ext = '', $noupdateafterinsertline = 0)
{
global $mysoc, $conf, $langs, $user;
global $mysoc, $langs, $user;
$logtext = "::addline commandeid=$this->id, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_percent=$remise_percent";
$logtext .= ", info_bits=$info_bits, fk_remise_except=$fk_remise_except, price_base_type=$price_base_type, pu_ttc=$pu_ttc, date_start=$date_start";
@ -1910,16 +1910,16 @@ class Commande extends CommonOrder
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON c.fk_incoterms = i.rowid';
if ($id) {
$sql .= " WHERE c.rowid=".((int) $id);
$sql .= " WHERE c.rowid = ".((int) $id);
} else {
$sql .= " WHERE c.entity IN (".getEntity('commande').")"; // Don't use entity if you use rowid
}
if ($ref) {
$sql .= " AND c.ref='".$this->db->escape($ref)."'";
$sql .= " AND c.ref = '".$this->db->escape($ref)."'";
}
if ($ref_ext) {
$sql .= " AND c.ref_ext='".$this->db->escape($ref_ext)."'";
$sql .= " AND c.ref_ext = '".$this->db->escape($ref_ext)."'";
}
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
@ -2372,45 +2372,6 @@ class Commande extends CommonOrder
return 0;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return a array with the pending stock by product
*
* @param int $filtre_statut Filtre sur statut
* @return int 0 si OK, <0 si KO
*
* TODO FONCTION NON FINIE A FINIR
*/
/*public function stock_array($filtre_statut = self::STATUS_CANCELED)
{
// phpcs:enable
$this->stocks = array();
// Tableau des id de produit de la commande
$array_of_product = array();
// Recherche total en stock pour chaque produit
// TODO $array_of_product est défini vide juste au dessus !!
if (count($array_of_product)) {
$sql = "SELECT fk_product, sum(ps.reel) as total";
$sql .= " FROM ".MAIN_DB_PREFIX."product_stock as ps";
$sql .= " WHERE ps.fk_product IN (".$this->db->sanitize(join(',', $array_of_product)).")";
$sql .= ' GROUP BY fk_product';
$resql = $this->db->query($sql);
if ($resql) {
$num = $this->db->num_rows($resql);
$i = 0;
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
$this->stocks[$obj->fk_product] = $obj->total;
$i++;
}
$this->db->free($resql);
}
}
return 0;
}*/
/**
* Delete an order line
*
@ -2544,73 +2505,6 @@ class Commande extends CommonOrder
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Set a fixed amount discount
*
* @param User $user User qui positionne la remise
* @param float $remise Discount
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int Return integer <0 if KO, >0 if OK
*/
/*
public function set_remise_absolue($user, $remise, $notrigger = 0)
{
// phpcs:enable
if (empty($remise)) {
$remise = 0;
}
$remise = price2num($remise);
if ($user->hasRight('commande', 'creer')) {
$error = 0;
$this->db->begin();
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql .= ' SET remise_absolue = '.((float) $remise);
$sql .= ' WHERE rowid = '.((int) $this->id).' AND fk_statut = '.self::STATUS_DRAFT;
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$this->errors[] = $this->db->error();
$error++;
}
if (!$error) {
$this->oldcopy = clone $this;
$this->remise_absolue = $remise;
$this->update_price(1);
}
if (!$notrigger && empty($error)) {
// Call trigger
$result = $this->call_trigger('ORDER_MODIFY', $user);
if ($result < 0) {
$error++;
}
// End call triggers
}
if (!$error) {
$this->db->commit();
return 1;
} else {
foreach ($this->errors as $errmsg) {
dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR);
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
}
$this->db->rollback();
return -1 * $error;
}
}
return 0;
}
*/
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Set the order date
@ -3138,7 +3032,7 @@ class Commande extends CommonOrder
*/
public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $price_base_type = 'HT', $info_bits = 0, $date_start = '', $date_end = '', $type = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $special_code = 0, $array_options = array(), $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0, $ref_ext = '', $rang = 0)
{
global $conf, $mysoc, $langs, $user;
global $mysoc, $langs, $user;
dol_syslog(get_class($this)."::updateline id=$rowid, desc=$desc, pu=$pu, qty=$qty, remise_percent=$remise_percent, txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, price_base_type=$price_base_type, info_bits=$info_bits, date_start=$date_start, date_end=$date_end, type=$type, fk_parent_line=$fk_parent_line, pa_ht=$pa_ht, special_code=$special_code, ref_ext=$ref_ext");
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
@ -3350,8 +3244,6 @@ class Commande extends CommonOrder
*/
public function update(User $user, $notrigger = 0)
{
global $conf;
$error = 0;
// Clean parameters

View File

@ -101,7 +101,7 @@ if (GETPOST("search_code_client")) {
$sql .= natural_search("s.code_client", GETPOST("search_code_client"));
}
if (dol_strlen($begin)) {
$sql .= " AND s.nom like '".$db->escape($begin)."'";
$sql .= " AND s.nom LIKE '".$db->escape($begin)."'";
}
// If the internal user must only see his customers, force searching by him
$search_sale = 0;

View File

@ -1662,7 +1662,7 @@ if (!empty($arrayfields['c.ref']['checked'])) {
// Ref ext
if (!empty($arrayfields['c.ref_ext']['checked'])) {
print '<td class="liste_titre">';
print '<input class="flat" size="6" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref_ext).'">';
print '<input class="flat" size="6" type="text" name="search_ref_ext" value="'.dol_escape_htmltag($search_ref_ext).'">';
print '</td>';
}
// Ref customer

View File

@ -76,8 +76,6 @@ if (!$year_start) {
*/
$error = 0;
$form = new Form($db);
// Get account information
$object = new Account($db);
if ($id > 0 && !preg_match('/,/', $id)) { // if for a particular account and not a list
@ -153,7 +151,7 @@ if ($resql) {
}
// Onglets
// Tabs tab / graph
$head = bank_prepare_head($object);
print dol_get_fiche_head($head, 'annual', $langs->trans("FinancialAccount"), 0, 'account');
@ -186,7 +184,7 @@ if (!empty($id)) {
print dol_get_fiche_end();
$head = bank_report_prepare_head($object);
print dol_get_fiche_head($head, 'annual', $langs->trans("FinancialAccount"), 0);
print dol_get_fiche_head($head, 'annual', $langs->trans("FinancialAccount"), -1);
// Affiche tableau
print load_fiche_titre('', $link, '');
@ -194,16 +192,16 @@ print load_fiche_titre('', $link, '');
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="liste_titre">'.$langs->trans("Month").'</td>';
print '<tr class="liste_titre"><td class="liste_titre borderrightlight">'.$langs->trans("Month").'</td>';
for ($annee = $year_start; $annee <= $year_end; $annee++) {
print '<td align="center" width="20%" colspan="2" class="liste_titre borderrightlight">'.$annee.'</td>';
print '<td width="20%" colspan="2" class="liste_titre borderrightlight center">'.$annee.'</td>';
}
print '</tr>';
print '<tr class="liste_titre">';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre borderrightlight">&nbsp;</td>';
for ($annee = $year_start; $annee <= $year_end; $annee++) {
print '<td class="liste_titre" align="center">'.$langs->trans("Debit").'</td><td class="liste_titre" align="center">'.$langs->trans("Credit").'</td>';
print '<td class="liste_titre center">'.$langs->trans("Debit").'</td><td class="liste_titre center borderrightlight">'.$langs->trans("Credit").'</td>';
}
print '</tr>';
@ -214,7 +212,7 @@ for ($annee = $year_start; $annee <= $year_end; $annee++) {
for ($mois = 1; $mois < 13; $mois++) {
print '<tr class="oddeven">';
print "<td>".dol_print_date(dol_mktime(1, 1, 1, $mois, 1, 2000), "%B")."</td>";
print '<td class="borderrightlight">'.dol_print_date(dol_mktime(1, 1, 1, $mois, 1, 2000), "%B")."</td>";
for ($annee = $year_start; $annee <= $year_end; $annee++) {
$case = sprintf("%04d-%02d", $annee, $mois);
@ -237,10 +235,10 @@ for ($mois = 1; $mois < 13; $mois++) {
}
// Total debit-credit
print '<tr class="liste_total"><td><b>'.$langs->trans("Total")."</b></td>";
print '<tr class="liste_total"><td class="borderrightlight liste_total"><b>'.$langs->trans("Total")."</b></td>";
for ($annee = $year_start; $annee <= $year_end; $annee++) {
print '<td class="right nowraponall"><b>'. (isset($totsorties[$annee]) ? price($totsorties[$annee]) : '') .'</b></td>';
print '<td class="right nowraponall"><b>'. (isset($totentrees[$annee]) ? price($totentrees[$annee]) : '') .'</b></td>';
print '<td class="right nowraponall liste_total"><b>'. (isset($totsorties[$annee]) ? price($totsorties[$annee]) : '') .'</b></td>';
print '<td class="right nowraponall liste_total borderrightlight"><b>'. (isset($totentrees[$annee]) ? price($totentrees[$annee]) : '') .'</b></td>';
}
print "</tr>\n";
@ -322,7 +320,7 @@ if ($result < 0) {
$tblyear[2] = array();
for ($annee = 0; $annee < 3; $annee++) {
$sql = "SELECT date_format(b.datev,'%m')";
$sql = "SELECT date_format(b.datev, '%m')";
$sql .= ", SUM(b.amount)";
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
@ -334,7 +332,7 @@ if ($result < 0) {
if ($id && GETPOST("option") != 'all') {
$sql .= " AND b.fk_account IN (".$db->sanitize($id).")";
}
$sql .= " GROUP BY date_format(b.datev,'%m');";
$sql .= " GROUP BY date_format(b.datev, '%m');";
$resql = $db->query($sql);
if ($resql) {
@ -371,12 +369,12 @@ if ($result < 0) {
$title = $langs->transnoentities("Credit").' - '.$langs->transnoentities("Year").': '.($year - 2).' - '.($year - 1)." - ".$year;
$graph_datas = array();
for ($i = 0; $i < 12; $i++) {
$graph_datas[$i] = array($labels[$i], $data_year_0[$i], $data_year_1[$i], $data_year_2[$i]);
$graph_datas[$i] = array($labels[$i], $data_year_2[$i], $data_year_1[$i], $data_year_0[$i]);
}
$px1 = new DolGraph();
$px1->SetData($graph_datas);
$px1->SetLegend(array(($year), ($year - 1), ($year - 2)));
$px1->SetLegend(array(($year - 2), ($year - 1), $year));
$px1->SetLegendWidthMin(180);
$px1->SetMaxValue($px1->GetCeilMaxValue() < 0 ? 0 : $px1->GetCeilMaxValue());
$px1->SetMinValue($px1->GetFloorMinValue() > 0 ? 0 : $px1->GetFloorMinValue());
@ -405,7 +403,7 @@ if ($result < 0) {
$tblyear[2] = array();
for ($annee = 0; $annee < 3; $annee++) {
$sql = "SELECT date_format(b.datev,'%m')";
$sql = "SELECT date_format(b.datev, '%m')";
$sql .= ", SUM(b.amount)";
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
@ -417,7 +415,7 @@ if ($result < 0) {
if ($id && GETPOST("option") != 'all') {
$sql .= " AND b.fk_account IN (".$db->sanitize($id).")";
}
$sql .= " GROUP BY date_format(b.datev,'%m');";
$sql .= " GROUP BY date_format(b.datev, '%m');";
$resql = $db->query($sql);
if ($resql) {
@ -433,6 +431,7 @@ if ($result < 0) {
dol_print_error($db);
}
}
// Chargement de labels et data_xxx pour tableau 4 Movements
$labels = array();
$data_year_0 = array();
@ -452,12 +451,12 @@ if ($result < 0) {
$title = $langs->transnoentities("Debit").' - '.$langs->transnoentities("Year").': '.($year - 2).' - '.($year - 1)." - ".$year;
$graph_datas = array();
for ($i = 0; $i < 12; $i++) {
$graph_datas[$i] = array($labels[$i], $data_year_0[$i], $data_year_1[$i], $data_year_2[$i]);
$graph_datas[$i] = array($labels[$i], $data_year_2[$i], $data_year_1[$i], $data_year_0[$i]);
}
$px2 = new DolGraph();
$px2->SetData($graph_datas);
$px2->SetLegend(array(($year), ($year - 1), ($year - 2)));
$px2->SetLegend(array(($year - 2), ($year - 1), $year));
$px2->SetLegendWidthMin(180);
$px2->SetMaxValue($px2->GetCeilMaxValue() < 0 ? 0 : $px2->GetCeilMaxValue());
$px2->SetMinValue($px2->GetFloorMinValue() > 0 ? 0 : $px2->GetFloorMinValue());
@ -480,9 +479,9 @@ if ($result < 0) {
unset($tblyear[2]);
print '<div class="fichecenter"><div class="fichehalfleft"><div align="center">'; // do not use class="center" here, it will have no effect for the js graph inside.
print $show1;
print $show2; // debit
print '</div></div><div class="fichehalfright"><div align="center">'; // do not use class="center" here, it will have no effect for the js graph inside.
print $show2;
print $show1; // credit
print '</div></div></div>';
print '<div class="clearboth"></div>';
}

View File

@ -760,6 +760,11 @@ class Account extends CommonObject
$this->status = $this->clos;
}
if (empty($this->country_id) && !empty($this->country_code)) {
$country_id = getCountry($this->country_code, '3');
$this->country_id = is_int($country_id) ? $country_id : 0;
}
// Load the library to validate/check a BAN account
require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
@ -900,6 +905,11 @@ class Account extends CommonObject
{
global $langs, $conf;
if (empty($this->country_id) && !empty($this->country_code)) {
$country_id = getCountry($this->country_code, '3');
$this->country_id = is_int($country_id) ? $country_id : 0;
}
$error = 0;
$this->db->begin();

View File

@ -348,6 +348,12 @@ class BankAccounts extends DolibarrApi
continue;
}
if ($field == 'array_options' && is_array($value)) {
foreach ($value as $index => $val) {
$account->array_options[$index] = $this->_checkValForAPI($field, $val, $account);
}
continue;
}
$account->$field = $this->_checkValForAPI($field, $value, $account);
}

View File

@ -3336,9 +3336,9 @@ if ($action == 'create') {
$expesrc->fetch_optionals();
$object->array_options = $expesrc->array_options;
} else {
$cond_reglement_id = (!empty($objectsrc->cond_reglement_id) ? $objectsrc->cond_reglement_id : (!empty($soc->cond_reglement_id) ? $soc->cond_reglement_id : 0));
$mode_reglement_id = (!empty($objectsrc->mode_reglement_id) ? $objectsrc->mode_reglement_id : (!empty($soc->mode_reglement_id) ? $soc->mode_reglement_id : 0));
$fk_account = (!empty($objectsrc->fk_account) ? $objectsrc->fk_account : (!empty($soc->fk_account) ? $soc->fk_account : 0));
$cond_reglement_id = (!empty($objectsrc->cond_reglement_id) ? $objectsrc->cond_reglement_id : (!empty($soc->cond_reglement_id) ? $soc->cond_reglement_id : (!empty($cond_reglement_id) ? $cond_reglement_id : 0)));
$mode_reglement_id = (!empty($objectsrc->mode_reglement_id) ? $objectsrc->mode_reglement_id : (!empty($soc->mode_reglement_id) ? $soc->mode_reglement_id : (!empty($mode_reglement_id) ? $mode_reglement_id : 0)));
$fk_account = (!empty($objectsrc->fk_account) ? $objectsrc->fk_account : (!empty($soc->fk_account) ? $soc->fk_account : (!empty($fk_account) ? $fk_account : 0)));
if (isModEnabled('multicurrency')) {
if (!empty($objectsrc->multicurrency_code)) {
@ -4743,19 +4743,21 @@ if ($action == 'create') {
print ' <span class="opacitymediumbycolor paddingleft">'.$langs->transnoentities("CorrectInvoice", $facusing->getNomUrl(1, '', 32)).'</span>';
}
$facidavoir = $object->getListIdAvoirFromInvoice();
if (count($facidavoir) > 0) {
// Retrieve credit note ids
$object->getListIdAvoirFromInvoice();
if (!empty($object->creditnote_ids)) {
print ' <span class="opacitymediumbycolor paddingleft">'.$langs->transnoentities("InvoiceHasAvoir");
$i = 0;
foreach ($facidavoir as $id) {
foreach ($object->creditnote_ids as $invoiceid) {
if ($i == 0) {
print ' ';
} else {
print ',';
}
$facavoir = new Facture($db);
$facavoir->fetch($id);
print $facavoir->getNomUrl(1, '', 32);
$creditnote = new Facture($db);
$creditnote->fetch($invoiceid);
print $creditnote->getNomUrl(1, '', 32);
}
print '</span>';
}

View File

@ -149,6 +149,9 @@ class Invoices extends DolibarrApi
throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
// Retrieve credit note ids
$this->invoice->getListIdAvoirFromInvoice();
// Add external contacts ids
if ($contact_list > -1) {
$tmparray = $this->invoice->liste_contact(-1, 'external', $contact_list);
@ -268,6 +271,9 @@ class Invoices extends DolibarrApi
$invoice_static->totaldeposits = $invoice_static->getSumDepositsUsed();
$invoice_static->remaintopay = price2num($invoice_static->total_ttc - $invoice_static->totalpaid - $invoice_static->totalcreditnotes - $invoice_static->totaldeposits, 'MT');
// Retrieve credit note ids
$invoice_static->getListIdAvoirFromInvoice();
// Add external contacts ids
$tmparray = $invoice_static->liste_contact(-1, 'external', 1);
if (is_array($tmparray)) {

View File

@ -1415,7 +1415,7 @@ if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER_IN_LIST')) {
}
// Ref
if (!empty($arrayfields['f.ref']['checked'])) {
print '<td class="liste_titre" align="left">';
print '<td class="liste_titre">';
print '<input class="flat maxwidth50imp" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
print '</td>';
}
@ -1439,7 +1439,7 @@ if (!empty($arrayfields['f.type']['checked'])) {
}
//$listtype[Facture::TYPE_PROFORMA]=$langs->trans("InvoiceProForma"); // A proformat invoice is not an invoice but must be an order.
// @phan-suppress-next-line PhanPluginSuspiciousParamOrder
print $form->selectarray('search_type', $listtype, $search_type, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100');
print $form->selectarray('search_type', $listtype, $search_type, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth75');
print '</td>';
}
// Invoice Subtype
@ -2505,7 +2505,7 @@ if ($num > 0) {
// Author
if (!empty($arrayfields['u.login']['checked'])) {
print '<td class="tdoverflowmax200">';
print '<td class="tdoverflowmax125">';
if ($userstatic->id) {
print $userstatic->getNomUrl(-1);
} else {

View File

@ -439,17 +439,19 @@ if ($object->id > 0) {
print ' <span class="opacitymediumbycolor paddingleft">'.$langs->transnoentities("CorrectInvoice", $facusing->getNomUrl(1)).'</span>';
}
$facidavoir = $object->getListIdAvoirFromInvoice();
if (count($facidavoir) > 0) {
// Retrieve credit note ids
$object->getListIdAvoirFromInvoice();
if (!empty($object->creditnote_ids)) {
$invoicecredits = array();
foreach ($facidavoir as $facid) {
foreach ($object->creditnote_ids as $invoiceid) {
if ($type == 'bank-transfer') {
$facavoir = new FactureFournisseur($db);
$creditnote = new FactureFournisseur($db);
} else {
$facavoir = new Facture($db);
$creditnote = new Facture($db);
}
$facavoir->fetch($facid);
$invoicecredits[] = $facavoir->getNomUrl(1);
$creditnote->fetch($invoiceid);
$invoicecredits[] = $creditnote->getNomUrl(1);
}
print ' <span class="opacitymediumbycolor paddingleft">'.$langs->transnoentities("InvoiceHasAvoir");
print ' '. (count($invoicecredits) ? ' ' : '') . implode(',', $invoicecredits);

View File

@ -455,7 +455,7 @@ if (isModEnabled('don') && $user->hasRight('don', 'lire')) {
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<th colspan="2">'.$langs->trans("BoxTitleLastModifiedDonations", $max);
print '<a href="'.DOL_URL_ROOT.'/don/list.php?sortfield=f.tms&sortorder=desc"><span class="badge marginleftonly">...</span></a>';
print '<a href="'.DOL_URL_ROOT.'/don/list.php?sortfield=d.tms&sortorder=desc"><span class="badge marginleftonly">...</span></a>';
print '</th>';
print '<th class="right">'.$langs->trans("AmountTTC").'</th>';
print '<th class="right">'.$langs->trans("DateModificationShort").'</th>';

View File

@ -37,13 +37,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
if (isModEnabled('project')) {
include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
}
if (isModEnabled('accounting')) {
include_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
}
/**
* @var Conf $conf
@ -351,13 +350,11 @@ if (isModEnabled('project')) {
$formproject = new FormProjets($db);
}
$now = dol_now();
$title = $langs->trans("SocialContribution").' - '.$langs->trans("Card");
$help_url = 'EN:Module_Taxes_and_social_contributions|FR:Module_Taxes_et_charges_spéciales|ES:M&oacute;dulo Impuestos y cargas sociales (IVA, impuestos)';
llxHeader("", $title, $help_url);
$reseapayer = 0;
$resteapayer = 0;
// Form to create a social contribution
@ -603,6 +600,9 @@ if ($id > 0) {
$formsocialcontrib->select_type_socialcontrib($actionPostValue ? $actionPostValue : $object->type, 'actioncode', 1);
} else {
print $object->type_label;
if (isModEnabled("accounting")) {
print ' &nbsp; <pan class="opacitymedium">('.$langs->trans("AccountancyCode").': '.(empty($object->type_accountancy_code) ? $langs->trans("Unknown") : length_accountg($object->type_accountancy_code)).')</span>';
}
}
print "</td>";

View File

@ -679,8 +679,9 @@ class ChargeSociales extends CommonObject
}
if (!empty($this->type_label)) {
$label .= '<br><b>'.$langs->trans('Type').':</b> '.$this->type_label;
if (!empty($this->type_accountancy_code)) {
$label .= ' <span class="opacitymedium">('.$langs->trans('AccountancyCode').': '.$this->type_accountancy_code.')</span>';
if (isModEnabled('accounting') || !empty($this->type_accountancy_code)) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
$label .= ' <span class="opacitymedium">('.$langs->trans('AccountancyCode').': '.(empty($this->type_accountancy_code) ? $langs->trans("Unknown") : length_accountg($this->type_accountancy_code)).')</span>';
}
}

View File

@ -120,12 +120,12 @@ class Contact extends CommonObject
'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => 1, 'visible' => 3, 'position' => 200, 'searchall' => 1),
'default_lang' => array('type' => 'varchar(6)', 'label' => 'Default lang', 'enabled' => 1, 'visible' => 3, 'position' => 205),
'canvas' => array('type' => 'varchar(32)', 'label' => 'Canvas', 'enabled' => 1, 'visible' => 3, 'position' => 210),
'ip' => array('type' => 'ip', 'label' => 'IPAddress', 'enabled' => '1', 'position' => 700, 'notnull' => 0, 'visible' => '-2', 'comment' => 'ip used to create record (for public submission page)'),
'datec' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'visible' => -1, 'position' => 300),
'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 305),
'fk_user_creat' => array('type' => 'integer', 'label' => 'UserAuthor', 'enabled' => 1, 'visible' => 3, 'position' => 310),
'fk_user_modif' => array('type' => 'integer', 'label' => 'UserModif', 'enabled' => 1, 'visible' => 3, 'position' => 315),
'statut' => array('type' => 'tinyint(4)', 'label' => 'Status', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'position' => 500),
'ip' => array('type' => 'varchar(250)', 'label' => 'Ip', 'enabled' => '1', 'position' => 700, 'notnull' => 0, 'visible' => '0', 'comment' => 'ip used to create record (for public submission page)'),
'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -1, 'position' => 1000),
);
@ -607,6 +607,11 @@ class Contact extends CommonObject
{
global $conf;
if (empty($this->country_id) && !empty($this->country_code)) {
$country_id = getCountry($this->country_code, '3');
$this->country_id = is_int($country_id) ? $country_id : 0;
}
$error = 0;
$this->id = $id;
@ -664,7 +669,7 @@ class Contact extends CommonObject
$sql .= ", phone = ".(isset($this->phone_pro) ? "'".$this->db->escape($this->phone_pro)."'" : "NULL");
$sql .= ", phone_perso = ".(isset($this->phone_perso) ? "'".$this->db->escape($this->phone_perso)."'" : "NULL");
$sql .= ", phone_mobile = ".(isset($this->phone_mobile) ? "'".$this->db->escape($this->phone_mobile)."'" : "NULL");
$sql .= ", priv = '".$this->db->escape($this->priv)."'";
$sql .= ", priv = ".((int) $this->priv);
$sql .= ", fk_prospectlevel = '".$this->db->escape($this->fk_prospectlevel)."'";
if (isset($this->stcomm_id)) {
$sql .= ", fk_stcommcontact = ".($this->stcomm_id > 0 || $this->stcomm_id == -1 ? $this->stcomm_id : "0");

View File

@ -12,7 +12,7 @@
* Copyright (C) 2019-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2019 Josep Lluís Amador <joseplluis@lliuretic.cat>
* Copyright (C) 2020 Open-Dsi <support@open-dsi.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Benjamin Falière <benjamin.faliere@altairis.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -368,7 +368,7 @@ if (empty($reshook)) {
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
$search_all = "";
$search_id = '';
$search_ref = '';
$search_ref_ext = '';
$search_firstlast_only = "";
$search_lastname = "";
$search_firstname = "";
@ -486,7 +486,7 @@ if ($resql) {
$sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias as alias,";
$sql .= " p.rowid, p.ref_ext, p.lastname as lastname, p.statut, p.firstname, p.address, p.zip, p.town, p.poste, p.email, p.birthday,";
$sql .= " p.socialnetworks, p.photo,";
$sql .= " p.phone as phone_pro, p.phone_mobile, p.phone_perso, p.fax, p.fk_pays, p.priv, p.datec as date_creation, p.tms as date_modification,";
$sql .= " p.phone as phone_pro, p.phone_mobile, p.phone_perso, p.fax, p.fk_pays, p.priv, p.ip, p.datec as date_creation, p.tms as date_modification,";
$sql .= " p.import_key, p.fk_stcommcontact as stcomm_id, p.fk_prospectlevel,";
$sql .= " st.libelle as stcomm, st.picto as stcomm_picto,";
$sql .= " co.label as country, co.code as country_code";
@ -866,8 +866,8 @@ if ($search_all != '') {
if ($search_id > 0) {
$param .= "&search_id=".((int) $search_id);
}
if ($search_ref) {
$param .= "&search_ref=".urlencode($search_ref);
if ($search_ref_ext) {
$param .= "&search_ref_ext=".urlencode($search_ref_ext);
}
if ($search_lastname != '') {
$param .= '&search_lastname='.urlencode($search_lastname);
@ -1240,6 +1240,11 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
$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;
// IP
if (!empty($arrayfields['p.ip']['checked'])) {
print '<td class="liste_titre">';
print '</td>';
}
// Date creation
if (!empty($arrayfields['p.datec']['checked'])) {
print '<td class="liste_titre">';
@ -1385,6 +1390,12 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
$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;
// IP
if (!empty($arrayfields['p.ip']['checked'])) {
print_liste_field_titre($arrayfields['p.ip']['label'], $_SERVER["PHP_SELF"], "p.ip", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
$totalarray['nbfield']++;
}
// Date creation
if (!empty($arrayfields['p.datec']['checked'])) {
print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
$totalarray['nbfield']++;
@ -1754,6 +1765,17 @@ while ($i < $imaxinloop) {
$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;
// IP creation
if (!empty($arrayfields['p.ip']['checked'])) {
print '<td class="center nowraponall">';
print dol_print_ip($obj->ip);
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Date creation
if (!empty($arrayfields['p.datec']['checked'])) {
print '<td class="center nowraponall">';

View File

@ -107,7 +107,7 @@ if (!empty($permtodelete) && empty($permissiontodelete)) {
}
// Mass actions. Controls on number of lines checked.
$maxformassaction = (!getDolGlobalString('MAIN_LIMIT_FOR_MASS_ACTIONS') ? 1000 : $conf->global->MAIN_LIMIT_FOR_MASS_ACTIONS);
$maxformassaction = getDolGlobalInt('MAIN_LIMIT_FOR_MASS_ACTIONS', 1000);
if ($massaction && is_array($toselect) && count($toselect) < 1) {
$error++;
setEventMessages($langs->trans("NoRecordSelected"), null, "warnings");

View File

@ -58,13 +58,13 @@ if ($action == 'update' && !empty($arrayofparameters) && is_array($arrayofparame
foreach ($arrayofparameters as $key => $val) {
// Modify constant only if key was posted (avoid resetting key to the null value)
if (GETPOSTISSET($key)) {
if (!empty($val['type']) && preg_match('/category:/', $val['type'])) {
if (isset($val['type']) && preg_match('/category:/', $val['type'])) {
if (GETPOSTINT($key) == '-1') {
$val_const = '';
} else {
$val_const = GETPOSTINT($key);
}
} elseif ($val['type'] == 'html') {
} elseif (isset($val['type']) && $val['type'] == 'html') {
$val_const = GETPOST($key, 'restricthtml');
} else {
$val_const = GETPOST($key, 'alpha');

View File

@ -73,7 +73,7 @@ class box_fediverse extends ModeleBoxes
$sql = '';
if (!empty($this->paramdef)) {
$sql = "SELECT value FROM ".MAIN_DB_PREFIX."const";
$sql .= " WHERE name like '%SOCIAL_NETWORKS_DATA_".$this->db->escape($this->paramdef)."%'";
$sql .= " WHERE name LIKE '%SOCIAL_NETWORKS_DATA_".$this->db->escape($this->paramdef)."%'";
}
$resql = $this->db->query($sql);
$num = $this->db->num_rows($resql);

View File

@ -222,6 +222,7 @@ class box_graph_product_distribution extends ModeleBoxes
if (empty($data3)) {
$showpointvalue = 0;
$nocolor = 1;
$data3 = array(array(0 => $langs->trans("None"), 1 => 1));
}

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2007-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2025 Charlene Benke <charlene@patas-monkey.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
@ -45,6 +46,22 @@ class Ccountry extends CommonDict
*/
public $code_iso;
/**
* @var string
*/
public $ecc;
/**
* @var int
*/
public $favorite;
/**
* @var string
*/
public $numeric_code;
/**
* @var array<string,array{type:string,label:string,enabled:int<0,2>|string,position:int,notnull?:int,visible:int<-5,5>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array<int|string,string>,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}>
*/
@ -150,7 +167,10 @@ class Ccountry extends CommonDict
$sql .= " t.code,";
$sql .= " t.code_iso,";
$sql .= " t.label,";
$sql .= " t.active";
$sql .= " t.eec,";
$sql .= " t.active,";
$sql .= " t.favorite,";
$sql .= " t.numeric_code";
$sql .= " FROM ".$this->db->prefix()."c_country as t";
if ($id) {
$sql .= " WHERE t.rowid = ".((int) $id);
@ -161,6 +181,7 @@ class Ccountry extends CommonDict
}
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
if ($this->db->num_rows($resql)) {
@ -171,7 +192,10 @@ class Ccountry extends CommonDict
$this->code = $obj->code;
$this->code_iso = $obj->code_iso;
$this->label = $obj->label;
$this->ecc = $obj->ecc;
$this->active = $obj->active;
$this->favorite = $obj->favorite;
$this->numeric_code = $obj->numeric_code;
}
$this->db->free($resql);

View File

@ -162,6 +162,11 @@ abstract class CommonInvoice extends CommonObject
*/
public $nbofopendirectdebitorcredittransfer;
/**
* @var int[] return of getListIdAvoirFromInvoice()
*/
public $creditnote_ids;
/**
* @var int
*/
@ -450,6 +455,9 @@ abstract class CommonInvoice extends CommonObject
} else {
dol_print_error($this->db);
}
$this->creditnote_ids = $idarray;
return $idarray;
}

View File

@ -26,7 +26,7 @@
/**
* Class to manage a WYSIWYG editor.
* Usage: $doleditor=new DolEditor('body',$message,320,'toolbar_mailing');
* Usage: $doleditor = new DolEditor('body', $message, 320, 'toolbar_mailing');
* $doleditor->Create();
*/
class DolEditor
@ -103,7 +103,7 @@ class DolEditor
* @param string $toolbarname Name of the toolbar set to use ('dolibarr_details[_encoded]'=the less featured, 'dolibarr_notes[_encoded]' for notes content, 'dolibarr_mailings[_encoded]' for emailing content, 'dolibarr_readonly').
* @param string $toolbarlocation Deprecated. Not used
* @param bool $toolbarstartexpanded Bar is visible or not at start
* @param bool|int $uselocalbrowser Enabled to add links to local object with a local media filemanager. If false, only external images URL can be added into content, or images saved inline with src="data:..." with a cut/paste.
* @param bool|int $uselocalbrowser Enabled to add links to local object with a local media filemanager. -1=auto, false=only external images URL can be added into content, or images saved inline with src="data:..." with a cut/paste.
* @param bool|int|string $okforextendededitor 1 or True=Allow usage of extended editor tool if qualified (like ckeditor). If 'textarea', force use of simple textarea. If 'ace', force use of Ace.
* Warning: If you use 'ace', don't forget to also include ace.js in page header. Also, the button "save" must have class="buttonforacesave".
* @param int $rows Size of rows for textarea tool
@ -188,23 +188,31 @@ class DolEditor
* Output edit area inside the HTML stream.
* Output depends on this->tool (fckeditor, ckeditor, textarea, ...)
*
* @param int $noprint 1=Return HTML string instead of printing it to output
* @param string $morejs Add more js. For example: ".on( \'saveSnapshot\', function(e) { alert(\'ee\'); });". Used by CKEditor only.
* @param boolean $disallowAnyContent Disallow to use any content. true=restrict to a predefined list of allowed elements. Used by CKEditor only.
* @param string $titlecontent Show title content before editor area. Used by ACE editor only.
* @param string $option For ACE editor, set the source language ('html', 'php', 'javascript', 'json', ...)
* @param string $moreparam Add extra tags to the textarea
* @param string $morecss Add extra css to the textarea
* @param int $noprint 1=Return HTML string instead of printing it to output
* @param string $morejs Add more js. For example: ".on( \'saveSnapshot\', function(e) { alert(\'ee\'); });". Used by CKEditor only.
* @param boolean|string $restrictContent Decide which content is allowed. Used by CKEditor only.
* true = restrict allowed content to a predefined list of allowed elements.
* false = allow anything
* string = true + add values into string
* @param string $titlecontent Show title content before editor area. Used by ACE editor only.
* @param string $option For ACE editor, set the source language ('html', 'php', 'javascript', 'json', ...)
* @param string $moreparam Add extra tags to the textarea
* @param string $morecss Add extra css to the textarea
* @return void|string
*/
public function Create($noprint = 0, $morejs = '', $disallowAnyContent = true, $titlecontent = '', $option = '', $moreparam = '', $morecss = '')
public function Create($noprint = 0, $morejs = '', $restrictContent = true, $titlecontent = '', $option = '', $moreparam = '', $morecss = '')
{
// phpcs:enable
global $conf, $langs;
$fullpage = false;
$extraAllowedContent = 'a[target];section[contenteditable,id];div{float,display}';
if (is_string($restrictContent)) {
$extraAllowedContent = $restrictContent;
}
if (isset($conf->global->FCKEDITOR_ALLOW_ANY_CONTENT)) {
$disallowAnyContent = !getDolGlobalString('FCKEDITOR_ALLOW_ANY_CONTENT'); // Only predefined list of html tags are allowed or all
$restrictContent = !getDolGlobalString('FCKEDITOR_ALLOW_ANY_CONTENT'); // Only predefined list of html tags are allowed or all
}
$found = 0;
@ -214,9 +222,7 @@ class DolEditor
if (in_array($this->tool, array('textarea', 'ckeditor'))) {
$found = 1;
//$out.= '<textarea id="'.$this->htmlname.'" name="'.$this->htmlname.'" '.($this->readonly?' disabled':'').' rows="'.$this->rows.'"'.(preg_match('/%/',$this->cols)?' style="margin-top: 5px; width: '.$this->cols.'"':' cols="'.$this->cols.'"').' class="flat">';
// TODO We do not put the 'disabled' tag because on a read form, it change style with grey.
//print $this->content;
// Note: We do not put the attribute 'disabled' tag because on a read form, it change style with grey.
$out .= '<textarea id="'.$this->htmlname.'" name="'.$this->htmlname.'"';
$out .= ' rows="'.$this->rows.'"';
//$out .= ' style="height: 700px; min-height: 700px;"';
@ -259,7 +265,7 @@ class DolEditor
$htmlencode_force = preg_match('/_encoded$/', $this->toolbarname) ? 'true' : 'false';
$out .= '<!-- Output ckeditor disallowAnyContent='.dol_escape_htmltag((string) $disallowAnyContent).' toolbarname='.dol_escape_htmltag($this->toolbarname).' -->'."\n";
$out .= '<!-- Output ckeditor disallowAnyContent='.dol_escape_htmltag((string) $restrictContent).' toolbarname='.dol_escape_htmltag($this->toolbarname).' -->'."\n";
//$out .= '<style>#cke_1_top { height: 34px !important; }</style>';
$out .= '<script nonce="'.getNonce().'" type="text/javascript">
$(document).ready(function () {
@ -268,15 +274,15 @@ class DolEditor
/* should be editor=CKEDITOR.replace but what if there is several editors ? */
tmpeditor = CKEDITOR.replace(\''.dol_escape_js($this->htmlname).'\',
{
/* property:xxx is same than CKEDITOR.config.property = xxx */
/* property: xxx is same than CKEDITOR.config.property = xxx */
customConfig: ckeditorConfig,
removePlugins: \''.dol_escape_js($pluginstodisable).'\',
versionCheck: false,
readOnly: '.($this->readonly ? 'true' : 'false').',
htmlEncodeOutput: '.dol_escape_js($htmlencode_force).',
allowedContent: '.($disallowAnyContent ? 'false' : 'true').', /* Advanced Content Filter (ACF) is on when allowedContent is false */
extraAllowedContent: \'a[target];section[contenteditable,id];div{float,display}\', /* Allow a tag with attribute target, allow seciont tag and allow the style float and display into div to default other allowed tags */
disallowedContent: \'\', /* Tags that are not allowed */
allowedContent: '.($restrictContent ? 'false' : 'true').', /* Advanced Content Filter (ACF) is on when allowedContent is false */
extraAllowedContent: \''.dol_escape_js($extraAllowedContent).'\', /* Allow a tag with attribute target, allow section tag and allow the style float and display into div to default other allowed tags */
disallowedContent: \'\', /* Tags that are not allowed */
fullPage: '.($fullpage ? 'true' : 'false').', /* if true, the html, header and body tags are kept */
toolbar: \''.dol_escape_js($this->toolbarname).'\',
toolbarStartupExpanded: '.($this->toolbarstartexpanded ? 'true' : 'false').',
@ -291,7 +297,7 @@ class DolEditor
console.log(\'ckeditor '.dol_escape_js($this->htmlname).' instanceReady\');
/* If we found the attribute required on source div, we remove it (not compatible with ckeditor) */
/* Disabled, because attribute required should never be used on fields for doleditor */
/* Disabled, because attribute "required" should never be used on fields for doleditor */
/* jQuery("#'.dol_escape_js($this->htmlname).'").attr("required", false); */
// Output paragraphs as <p>Text</p>.
@ -303,14 +309,6 @@ class DolEditor
breakAfterClose : true
});
},
/* This is to remove the tab Link on image popup. Does not work, so commented */
/* dialogDefinition: function (event) {
var dialogName = event.data.name;
var dialogDefinition = event.data.definition;
if (dialogName == \'image\') {
dialogDefinition.removeContents(\'Link\');
}
} */
},
disableNativeSpellChecker: '.(getDolGlobalString('CKEDITOR_NATIVE_SPELLCHECKER') ? 'false' : 'true');

View File

@ -23,7 +23,7 @@
* Copyright (C) 2018 Josep Lluis Amador <joseplluis@lliuretic.cat>
* Copyright (C) 2023 Joachim Kueter <git-jk@bloxera.com>
* Copyright (C) 2023 Nick Fragoulis
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 William Mead <william.mead@manchenumerique.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -3040,11 +3040,6 @@ class Form
$sql .= ' AND e.statut IN (' . $this->db->sanitize($this->db->escape(implode(',', $warehouseStatusArray))) . ')'; // Return line if product is inside the selected stock. If not, an empty line will be returned so we will count 0.
}
// include search in supplier ref
if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) {
$sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
}
//Price by customer
if ((getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) && !empty($socid)) {
$sql .= " LEFT JOIN " . $this->db->prefix() . "product_customer_price as pcp ON pcp.fk_soc=" . ((int) $socid) . " AND pcp.fk_product=p.rowid";
@ -3110,6 +3105,8 @@ class Form
$sql .= $hookmanager->resPrint;
// Add criteria on ref/label
if ($filterkey != '') {
$sqlSupplierSearch= '';
$sql .= ' AND (';
$prefix = !getDolGlobalString('PRODUCT_DONOTSEARCH_ANYWHERE') ? '%' : ''; // Can use index if PRODUCT_DONOTSEARCH_ANYWHERE is on
// For natural search
@ -3135,8 +3132,11 @@ class Form
$sql .= " OR pl.description LIKE '" . $this->db->escape($prefix . $crit) . "%'";
}
}
// include search in supplier ref
if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) {
$sql .= " OR pfp.ref_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'";
$sqlSupplierSearch .= !empty($sqlSupplierSearch) ? ' OR ':'';
$sqlSupplierSearch .= " pfp.ref_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'";
}
$sql .= ")";
$i++;
@ -3147,6 +3147,15 @@ class Form
if (isModEnabled('barcode')) {
$sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
}
// include search in supplier ref
if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) {
$sql .= " OR EXISTS (SELECT pfp.fk_product FROM " . $this->db->prefix() . "product_fournisseur_price as pfp WHERE p.rowid = pfp.fk_product";
$sql .= " AND (";
$sql .= $sqlSupplierSearch;
$sql .= "))";
}
$sql .= ')';
}
if (count($warehouseStatusArray)) {
@ -6906,11 +6915,30 @@ class Form
public function load_tva($htmlname = 'tauxtva', $selectedrate = '', $societe_vendeuse = null, $societe_acheteuse = null, $idprod = 0, $info_bits = 0, $type = '', $options_only = false, $mode = 0, $type_vat = 0)
{
// phpcs:enable
global $langs, $mysoc;
global $langs, $mysoc, $hookmanager;
$langs->load('errors');
$return = '';
// Bypass the default method
$hookmanager->initHooks(array('commonobject'));
$info_bits == 1 ? $is_npr = 1 : $is_npr = 0;
$parameters = array(
'seller' => $societe_vendeuse,
'buyer' => $societe_acheteuse,
'idprod' => $idprod,
'is_npr' => $is_npr,
'type' => $type,
'options_only' => $options_only,
'mode' => $mode,
'type_vat' => $type_vat
);
$reshook = $hookmanager->executeHooks('load_tva', $parameters);
if ($reshook > 0) {
return $hookmanager->resPrint;
} elseif ($reshook === 0) {
$return .= $hookmanager->resPrint;
}
// Define defaultnpr, defaultttx and defaultcode
$defaultnpr = ($info_bits & 0x01);
@ -9044,7 +9072,7 @@ class Form
*/
public static function selectArrayAjax($htmlname, $url, $id = '', $moreparam = '', $moreparamtourl = '', $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0)
{
global $conf, $langs;
global $conf;
global $delayedhtmlcontent; // Will be used later outside of this function
// TODO Use an internal dolibarr component instead of select2
@ -9091,9 +9119,9 @@ class Form
},
cache: true
},
language: select2arrayoflanguage,
language: (typeof select2arrayoflanguage === \'undefined\') ? \'en\' : select2arrayoflanguage,
containerCssClass: \':all:\', /* Line to add class from the original SELECT propagated to the new <span class="select2-selection...> tag */
placeholder: "' . dol_escape_js($placeholder) . '",
placeholder: \'' . dol_escape_js($placeholder) . '\',
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
minimumInputLength: ' . ((int) $minimumInputLength) . ',
formatResult: function (result, container, query, escapeMarkup) {
@ -9104,9 +9132,9 @@ class Form
' . ($callurlonselect ? '
/* Code to execute a GET when we select a value */
$(".' . $htmlname . '").change(function() {
var selected = $(".' . $htmlname . '").val();
var selected = $(\'.' . dol_escape_js($htmlname) . '\').val();
console.log("We select in selectArrayAjax the entry "+selected)
$(".' . $htmlname . '").val(""); /* reset visible combo value */
$(\'.' . dol_escape_js($htmlname) . '\').val(""); /* reset visible combo value */
$.each( saveRemoteData, function( key, value ) {
if (key == selected)
{
@ -9149,7 +9177,7 @@ class Form
*/
public static function selectArrayFilter($htmlname, $array, $id = '', $moreparam = '', $disableFiltering = 0, $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0, $textfortitle = '')
{
global $conf, $langs;
global $conf;
global $delayedhtmlcontent; // Will be used later outside of this function
// TODO Use an internal dolibarr component instead of select2
@ -9179,13 +9207,13 @@ class Form
' . ($callurlonselect ? 'var saveRemoteData = ' . json_encode($array) . ';' : '') . '
$(".' . $htmlname . '").select2({
$(\'.' . dol_escape_js($htmlname) . '\').select2({
data: data,
language: select2arrayoflanguage,
language: (typeof select2arrayoflanguage === \'undefined\') ? \'en\' : select2arrayoflanguage,
containerCssClass: \':all:\', /* Line to add class from the original SELECT propagated to the new <span class="select2-selection...> tag */
placeholder: "' . dol_escape_js($placeholder) . '",
placeholder: \'' . dol_escape_js($placeholder) . '\',
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
minimumInputLength: ' . $minimumInputLength . ',
minimumInputLength: ' . ((int) $minimumInputLength) . ',
formatResult: function (result, container, query, escapeMarkup) {
return escapeMarkup(result.text);
},
@ -9224,11 +9252,11 @@ class Form
' . ($callurlonselect ? '
/* Code to execute a GET when we select a value */
$(".' . $htmlname . '").change(function() {
var selected = $(".' . $htmlname . '").val();
$(\'.' . dol_escape_js($htmlname) . '\').change(function() {
var selected = $(\'.' . dol_escape_js($htmlname) . '\').val();
console.log("We select "+selected)
$(".' . $htmlname . '").val(""); /* reset visible combo value */
$(\'.' . dol_escape_js($htmlname) . '\').val(""); /* reset visible combo value */
$.each( saveRemoteData, function( key, value ) {
if (key == selected)
{
@ -9357,7 +9385,7 @@ class Form
}
$out .= '}' . "\n";
$out .= '$(document).ready(function () {
$(\'#' . $htmlname . '\').' . $tmpplugin . '({';
$(\'#' . dol_escape_js($htmlname) . '\').' . $tmpplugin . '({';
if ($placeholder) {
$out .= '
placeholder: {
@ -9367,33 +9395,34 @@ class Form
}
$out .= ' dir: \'ltr\',
containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag (ko with multiselect) */
dropdownCssClass: \'' . $morecss . '\', /* Line to add class on the new <span class="select2-selection...> tag (ok with multiselect). Need full version of select2. */
dropdownCssClass: \'' . dol_escape_js($morecss) . '\', /* Line to add class on the new <span class="select2-selection...> tag (ok with multiselect). Need full version of select2. */
// Specify format function for dropdown item
formatResult: formatResult,
templateResult: formatResult, /* For 4.0 */
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
// Specify format function for selected item
formatSelection: formatSelection,
templateSelection: formatSelection /* For 4.0 */
templateSelection: formatSelection, /* For 4.0 */
language: (typeof select2arrayoflanguage === \'undefined\') ? \'en\' : select2arrayoflanguage
});
/* Add also morecss to the css .select2 that is after the #htmlname, for component that are show dynamically after load, because select2 set
the size only if component is not hidden by default on load */
$(\'#' . $htmlname . ' + .select2\').addClass(\'' . $morecss . '\');
$(\'#' . dol_escape_js($htmlname) . ' + .select2\').addClass(\'' . dol_escape_js($morecss) . '\');
});' . "\n";
} elseif ($addjscombo == 2 && !defined('DISABLE_MULTISELECT')) {
// Add other js lib
// TODO external lib multiselect/jquery.multi-select.js must have been loaded to use this multiselect plugin
// ...
$out .= 'console.log(\'addjscombo=2 for htmlname=' . $htmlname . '\');';
$out .= 'console.log(\'addjscombo=2 for htmlname=' . dol_escape_js($htmlname) . '\');';
$out .= '$(document).ready(function () {
$(\'#' . $htmlname . '\').multiSelect({
$(\'#' . dol_escape_js($htmlname) . '\').multiSelect({
containerHTML: \'<div class="multi-select-container">\',
menuHTML: \'<div class="multi-select-menu">\',
buttonHTML: \'<span class="multi-select-button ' . $morecss . '">\',
buttonHTML: \'<span class="multi-select-button ' . dol_escape_js($morecss) . '">\',
menuItemHTML: \'<label class="multi-select-menuitem">\',
activeClass: \'multi-select-container--open\',
noneText: \'' . $placeholder . '\'
noneText: \'' . dol_escape_js($placeholder) . '\'
});
})';
}

View File

@ -682,6 +682,8 @@ class Translate
}
}
$str = str_replace('%)', '__percent_parenthesis__', $str);
if (strpos($key, 'Format') !== 0) {
try {
// @phan-suppress-next-line PhanPluginPrintfVariableFormatString
@ -691,6 +693,8 @@ class Translate
}
}
$str = str_replace('__percent_parenthesis__', '%)', $str);
// We replace some HTML tags by __xx__ to avoid having them encoded by htmlentities because
// we want to keep '"' '<b>' '</b>' '<u>' '</u>' '<i>' '</i>' '<center> '</center>' '<strong' '</strong>' '<a ' '</a>' '<br>' '<span' '</span>' '< ' that are reliable HTML tags inside translation strings.
$str = str_replace(

View File

@ -32,7 +32,7 @@
* include DOL_DOCUMENT_ROOT.'/core/customreports.php';
*/
/**
/**
* @var Conf $conf
* @var DoliDB $db
* @var HookManager $hookmanager
@ -322,6 +322,7 @@ $HH = substr($langs->trans("Hour"), 0, 1).substr($langs->trans("Hour"), 0, 1);
$MI = substr($langs->trans("Minute"), 0, 1).substr($langs->trans("Minute"), 0, 1);
$SS = substr($langs->trans("Second"), 0, 1).substr($langs->trans("Second"), 0, 1);
$arrayoffilterfields = array();
$arrayofmesures = array();
$arrayofxaxis = array();
$arrayofgroupby = array();
@ -375,6 +376,10 @@ foreach ($arrayoftype as $key => $val) {
}
}
$count = 0;
$arrayoffilterfields = fillArrayOfFilterFields($object, 't', $langs->trans($newarrayoftype[$objecttype]['label']), $arrayoffilterfields, 0, $count);
$arrayoffilterfields = dol_sort_array($arrayoffilterfields, 'position', 'asc', 0, 0, 1);
$count = 0;
$arrayofmesures = fillArrayOfMeasures($object, 't', $langs->trans($newarrayoftype[$objecttype]['label']), $arrayofmesures, 0, $count);
$arrayofmesures = dol_sort_array($arrayofmesures, 'position', 'asc', 0, 0, 1);
@ -387,10 +392,6 @@ $count = 0;
$arrayofgroupby = fillArrayOfGroupBy($object, 't', $langs->trans($newarrayoftype[$objecttype]['label']), $arrayofgroupby, 0, $count);
$arrayofgroupby = dol_sort_array($arrayofgroupby, 'position', 'asc', 0, 0, 1);
$count = 0;
$arrayoffilterfields = fillArrayOfFilterFields($object, 't', $langs->trans($newarrayoftype[$objecttype]['label']), $arrayoffilterfields, 0, $count);
$arrayoffilterfields = dol_sort_array($arrayoffilterfields, 'position', 'asc', 0, 0, 1);
// Check parameters
if ($action == 'viewgraph') {

View File

@ -295,7 +295,7 @@ function getDefaultDatesForTransfer()
$sql .= " WHERE date_start < '".$db->idate(dol_now())."' AND date_end > '".$db->idate(dol_now())."'";
$sql .= $db->plimit(1);
$res = $db->query($sql);
if ($res->num_rows > 0) {
if ($db->num_rows($res) > 0) {
$obj = $db->fetch_object($res);
$date_start = $db->jdate($obj->date_start);

View File

@ -489,14 +489,14 @@ function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete =
$msg = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id = '.$htmlname.' -->
<script>
$(document).ready(function () {
$(\''.(preg_match('/^\./', $htmlname) ? $htmlname : '#'.$htmlname).'\').'.$tmpplugin.'({
$(\''.(dol_escape_js(preg_match('/^\./', $htmlname) ? $htmlname : '#'.$htmlname)).'\').'.$tmpplugin.'({
dir: \'ltr\',';
if (preg_match('/onrightofpage/', $morecss)) { // when $morecss contains 'onrightofpage', the select2 component must also be inside a parent with class="parentonrightofpage"
$msg .= ' dropdownAutoWidth: true, dropdownParent: $(\'#'.$htmlname.'\').parent(), '."\n";
}
$msg .= ' width: \''.dol_escape_js($widthTypeOfAutocomplete).'\', /* off or resolve */
minimumInputLength: '.((int) $minLengthToAutocomplete).',
language: select2arrayoflanguage,
language: (typeof select2arrayoflanguage === \'undefined\') ? \'en\' : select2arrayoflanguage,
matcher: function (params, data) {
if ($.trim(params.term) === "") {
return data;
@ -509,7 +509,7 @@ function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete =
}
return data;
},
theme: \'default'.$moreselect2theme.'\', /* to add css on generated html components */
theme: \'default'.dol_escape_js($moreselect2theme).'\', /* to add css on generated html components */
containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */
selectionCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */
dropdownCssClass: \'ui-dialog\',

View File

@ -2366,11 +2366,13 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = null, $nopr
$out .= dol_trunc($libelle, 120);
}
if (isset($histo[$key]['type']) && $histo[$key]['type'] == 'mailing') {
$out .= '<a href="'.DOL_URL_ROOT.'/comm/mailing/card.php?id='.$histo[$key]['id'].'">'.img_object($langs->trans("ShowEMailing"), "email").' ';
$transcode = $langs->trans("Action".$histo[$key]['acode']);
$libelle = ($transcode != "Action".$histo[$key]['acode'] ? $transcode : 'Send mass mailing');
$out .= '<a href="'.DOL_URL_ROOT.'/comm/mailing/card.php?id='.$histo[$key]['id'].'"';
$out .= ' title="'.dol_escape_htmltag($libelle).'">';
$out .= img_object($langs->trans("ShowEMailing"), "email").' ';
$out .= dol_trunc($libelle, 120);
$out .= '</a>';
}
$out .= '</td>';

View File

@ -523,10 +523,12 @@ function fillArrayOfFilterFields($object, $tablealias, $labelofobject, &$arrayof
{
global $langs, $extrafields, $db;
$MAXLEVEL = 2;
if (empty($object)) { // Protection against bad use of method
return array();
}
if ($level >= 3) { // Limit scan on 2 levels max
if ($level > $MAXLEVEL) { // Limit scan on 2 levels max
return $arrayoffields;
}
@ -612,7 +614,11 @@ function fillArrayOfFilterFields($object, $tablealias, $labelofobject, &$arrayof
if (class_exists($newobject)) {
$tmpobject = new $newobject($db);
$count++;
$arrayoffields = fillArrayOfFilterFields($tmpobject, $tablealias.'__'.$key, $langs->trans($val['label']), $arrayoffields, $level + 1, $count, $tablepath);
if (!empty($val['nodepth'])) {
$arrayoffields = fillArrayOfFilterFields($tmpobject, $tablealias.'__'.$key, $langs->trans($val['label']), $arrayoffields, $MAXLEVEL, $count, $tablepath);
} else {
$arrayoffields = fillArrayOfFilterFields($tmpobject, $tablealias.'__'.$key, $langs->trans($val['label']), $arrayoffields, $level + 1, $count, $tablepath);
}
} else {
print 'For property '.$object->element.'->'.$key.', type="'.$val['type'].'": Failed to find class '.$newobject." in file ".$tmptype[2]."<br>\n";
}

View File

@ -3885,7 +3885,7 @@ function archiveOrBackupFile($srcfile, $max_versions = 5, $archivedir = '', $suf
if (count($sorted_files) >= $max_versions) {
$oldest_files = array_slice($sorted_files, $max_versions - 1);
foreach ($oldest_files as $oldest_file) {
dol_delete_file($oldest_file);
dol_delete_file($oldest_file, 0, 0, 0, null, false, 0);
}
}

View File

@ -1,4 +1,5 @@
<?php
/* Copyright (C) 2000-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2024 Laurent Destailleur <eldy@users.sourceforge.net>
@ -20,8 +21,8 @@
* Copyright (C) 2022 Anthony Berton <anthony.berton@bb2a.fr>
* Copyright (C) 2022 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2022 Charlene Benke <charlene@patas-monkey.com>
* Copyright (C) 2023 Joachim Kueter <git-jk@bloxera.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2023-2024 Joachim Kueter <git-jk@bloxera.com>
* Copyright (C) 2024 Lenin Rivas <lenin.rivas777@gmail.com>
* Copyright (C) 2024 Josep Lluís Amador Teruel <joseplluis@lliuretic.cat>
* Copyright (C) 2024 Benoît PASCAL <contact@p-ben.com>
@ -1316,6 +1317,7 @@ function sanitizeVal($out = '', $check = 'alphanohtml', $filter = null, $options
case 'restricthtmlnolink':
case 'restricthtml': // Recommended for most html textarea
case 'restricthtmlallowclass':
case 'restricthtmlallowiframe':
case 'restricthtmlallowlinkscript': // Allow link and script tag for head section.
case 'restricthtmlallowunvalid':
$out = dol_htmlwithnojs($out, 1, $check);
@ -8481,7 +8483,7 @@ function dol_nl2br($stringtoencode, $nl2brmode = 0, $forxml = false)
*
* @param string $stringtoencode String to encode
* @param int $nouseofiframesandbox 0=Default, 1=Allow use of option MAIN_SECURITY_USE_SANDBOX_FOR_HTMLWITHNOJS for html sanitizing (not yet working)
* @param string $check 'restricthtmlnolink' or 'restricthtml' or 'restricthtmlallowclass' or 'restricthtmlallowlinkscript' or 'restricthtmlallowunvalid'
* @param string $check 'restricthtmlnolink' or 'restricthtml' or 'restricthtmlallowclass' or 'restricthtmlallowiframe' or 'restricthtmlallowlinkscript' or 'restricthtmlallowunvalid'
* @return string HTML sanitized
*/
function dol_htmlwithnojs($stringtoencode, $nouseofiframesandbox = 0, $check = 'restricthtml')
@ -8585,17 +8587,19 @@ function dol_htmlwithnojs($stringtoencode, $nouseofiframesandbox = 0, $check = '
// We replace chars from a/A to z/Z encoded with numeric HTML entities with the real char so we won't loose the chars at the next step (preg_replace).
// No need to use a loop here, this step is not to sanitize (this is done at next step, this is to try to save chars, even if they are
// using a non conventionnal way to be encoded, to not have them sanitized just after)
$out = preg_replace_callback(
'/&#(x?[0-9][0-9a-f]+;?)/i',
/**
* @param string[] $m
* @return string
*/
static function ($m) {
return realCharForNumericEntities($m);
},
$out
);
if (function_exists('realCharForNumericEntities')) { // May not exist when main.inc.php not loaded, for example in a CLI context
$out = preg_replace_callback(
'/&#(x?[0-9][0-9a-f]+;?)/i',
/**
* @param string[] $m
* @return string
*/
static function ($m) {
return realCharForNumericEntities($m);
},
$out
);
}
// Now we remove all remaining HTML entities starting with a number. We don't want such entities.
$out = preg_replace('/&#x?[0-9]+/i', '', $out); // For example if we have j&#x61vascript with an entities without the ; to hide the 'a' of 'javascript'.
@ -8605,6 +8609,8 @@ function dol_htmlwithnojs($stringtoencode, $nouseofiframesandbox = 0, $check = '
$out = dol_string_onlythesehtmltags($out, 0, 1, 0, 0, array(), 1, 1, 1, getDolGlobalInt("UNSECURED_restricthtmlallowlinkscript_ALLOW_PHP"));
} elseif ($check == 'restricthtmlallowclass' || $check == 'restricthtmlallowunvalid') {
$out = dol_string_onlythesehtmltags($out, 0, 0, 1);
} elseif ($check == 'restricthtmlallowiframe') {
$out = dol_string_onlythesehtmltags($out, 0, 0, 1, 1);
} else {
$out = dol_string_onlythesehtmltags($out, 0, 1, 1);
}
@ -9171,23 +9177,33 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
$substitutionarray['__REF_SUPPLIER__'] = (isset($object->ref_supplier) ? $object->ref_supplier : null);
$substitutionarray['__NOTE_PUBLIC__'] = (isset($object->note_public) ? $object->note_public : null);
$substitutionarray['__NOTE_PRIVATE__'] = (isset($object->note_private) ? $object->note_private : null);
$substitutionarray['__DATE_CREATION__'] = (isset($object->date_creation) ? dol_print_date($object->date_creation, 'day', false, $outputlangs) : '');
$substitutionarray['__DATE_MODIFICATION__'] = (isset($object->date_modification) ? dol_print_date($object->date_modification, 'day', false, $outputlangs) : '');
$substitutionarray['__DATE_VALIDATION__'] = (isset($object->date_validation) ? dol_print_date($object->date_validation, 'day', false, $outputlangs) : '');
$substitutionarray['__DATE_DELIVERY__'] = (isset($object->date_delivery) ? dol_print_date($object->date_delivery, 'day', false, $outputlangs) : '');
$substitutionarray['__DATE_DELIVERY_DAY__'] = (isset($object->date_delivery) ? dol_print_date($object->date_delivery, "%d") : '');
$substitutionarray['__DATE_DELIVERY_DAY_TEXT__'] = (isset($object->date_delivery) ? dol_print_date($object->date_delivery, "%A") : '');
$substitutionarray['__DATE_DELIVERY_MON__'] = (isset($object->date_delivery) ? dol_print_date($object->date_delivery, "%m") : '');
$substitutionarray['__DATE_DELIVERY_MON_TEXT__'] = (isset($object->date_delivery) ? dol_print_date($object->date_delivery, "%b") : '');
$substitutionarray['__DATE_DELIVERY_YEAR__'] = (isset($object->date_delivery) ? dol_print_date($object->date_delivery, "%Y") : '');
$substitutionarray['__DATE_DELIVERY_HH__'] = (isset($object->date_delivery) ? dol_print_date($object->date_delivery, "%H") : '');
$substitutionarray['__DATE_DELIVERY_MM__'] = (isset($object->date_delivery) ? dol_print_date($object->date_delivery, "%M") : '');
$substitutionarray['__DATE_DELIVERY_SS__'] = (isset($object->date_delivery) ? dol_print_date($object->date_delivery, "%S") : '');
// handle date_delivery: in customer order/supplier order, the property name is delivery_date, in shipment/reception it is date_delivery
$date_delivery = null;
if (property_exists($object, 'date_delivery')) {
$date_delivery = $object->date_delivery;
} elseif (property_exists($object, 'delivery_date')) {
$date_delivery = $object->delivery_date;
}
$substitutionarray['__DATE_DELIVERY__'] = (isset($date_delivery) ? dol_print_date($date_delivery, 'day', false, $outputlangs) : '');
$substitutionarray['__DATE_DELIVERY_DAY__'] = (isset($date_delivery) ? dol_print_date($date_delivery, "%d") : '');
$substitutionarray['__DATE_DELIVERY_DAY_TEXT__'] = (isset($date_delivery) ? dol_print_date($date_delivery, "%A") : '');
$substitutionarray['__DATE_DELIVERY_MON__'] = (isset($date_delivery) ? dol_print_date($date_delivery, "%m") : '');
$substitutionarray['__DATE_DELIVERY_MON_TEXT__'] = (isset($date_delivery) ? dol_print_date($date_delivery, "%b") : '');
$substitutionarray['__DATE_DELIVERY_YEAR__'] = (isset($date_delivery) ? dol_print_date($date_delivery, "%Y") : '');
$substitutionarray['__DATE_DELIVERY_HH__'] = (isset($date_delivery) ? dol_print_date($date_delivery, "%H") : '');
$substitutionarray['__DATE_DELIVERY_MM__'] = (isset($date_delivery) ? dol_print_date($date_delivery, "%M") : '');
$substitutionarray['__DATE_DELIVERY_SS__'] = (isset($date_delivery) ? dol_print_date($date_delivery, "%S") : '');
// For backward compatibility (deprecated)
$substitutionarray['__REFCLIENT__'] = (isset($object->ref_client) ? $object->ref_client : (isset($object->ref_customer) ? $object->ref_customer : null));
$substitutionarray['__REFSUPPLIER__'] = (isset($object->ref_supplier) ? $object->ref_supplier : null);
$substitutionarray['__SUPPLIER_ORDER_DATE_DELIVERY__'] = (isset($object->delivery_date) ? dol_print_date($object->delivery_date, 'day', false, $outputlangs) : '');
$substitutionarray['__SUPPLIER_ORDER_DATE_DELIVERY__'] = (isset($date_delivery) ? dol_print_date($date_delivery, 'day', false, $outputlangs) : '');
$substitutionarray['__SUPPLIER_ORDER_DELAY_DELIVERY__'] = (isset($object->availability_code) ? ($outputlangs->transnoentities("AvailabilityType".$object->availability_code) != 'AvailabilityType'.$object->availability_code ? $outputlangs->transnoentities("AvailabilityType".$object->availability_code) : $outputlangs->convToOutputCharset(isset($object->availability) ? $object->availability : '')) : '');
$substitutionarray['__EXPIRATION_DATE__'] = (isset($object->fin_validite) ? dol_print_date($object->fin_validite, 'daytext') : '');
@ -9686,9 +9702,9 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
* $mesg = make_substitutions($mesg, $substitutionarray, $langs);
*
* @param string $text Source string in which we must do substitution
* @param array<string,string> $substitutionarray Array with key->val to substitute. Example: array('__MYKEY__' => 'MyVal', ...)
* @param array<string,null|string|float|int> $substitutionarray Array with key->val to substitute. Example: array('__MYKEY__' => 'MyVal', ...)
* @param ?Translate $outputlangs Output language
* @param int $converttextinhtmlifnecessary 0=Convert only value into HTML if text is already in HTML
* @param int<0,1> $converttextinhtmlifnecessary 0=Convert only value into HTML if text is already in HTML
* 1=Will also convert initial $text into HTML if we try to insert one value that is HTML
* @return string Output string after substitutions
* @see complete_substitutions_array(), getCommonSubstitutionArray()
@ -9736,7 +9752,7 @@ function make_substitutions($text, $substitutionarray, $outputlangs = null, $con
$msgishtml = 1;
}
} else {
$value = dol_nl2br("$value");
$value = dol_nl2br((string) $value);
}
$text = preg_replace('/__\('.preg_quote($reg[1], '/').'\)__/', $value, $text);
@ -9767,7 +9783,7 @@ function make_substitutions($text, $substitutionarray, $outputlangs = null, $con
$msgishtml = 1;
}
} else {
$value = dol_nl2br("$value");
$value = dol_nl2br((string) $value);
}
$text = preg_replace('/__\['.preg_quote($keyfound, '/').'\]__/', $value, $text);
@ -9785,7 +9801,7 @@ function make_substitutions($text, $substitutionarray, $outputlangs = null, $con
}
if (empty($converttextinhtmlifnecessary)) {
$text = str_replace("$key", "$value", $text); // We must keep the " to work when value is 123.5 for example
$text = str_replace((string) $key, (string) $value, $text); // Cast to string is needed when value is 123.5 for example
} else {
if (! $msgishtml) {
$valueishtml = dol_textishtml($value, 1);
@ -9795,9 +9811,9 @@ function make_substitutions($text, $substitutionarray, $outputlangs = null, $con
$msgishtml = 1;
}
} else {
$value = dol_nl2br("$value");
$value = dol_nl2br((string) $value);
}
$text = str_replace("$key", "$value", $text); // We must keep the " to work when value is 123.5 for example
$text = str_replace((string) $key, (string) $value, $text); // Cast to string is needed 123.5 for example
}
}
@ -9820,7 +9836,7 @@ function make_substitutions($text, $substitutionarray, $outputlangs = null, $con
if (isset($lazy_load_arr[1]) && !empty($lazy_load_arr[1])) {
$key_to_substitute = $lazy_load_arr[1];
if (preg_match('/' . preg_quote($key_to_substitute, '/') . '/', $text)) {
$param_arr = explode(':', $value);
$param_arr = explode(':', (string) $value);
// path:class:method:id
if (count($param_arr) == 4) {
$path = $param_arr[0];
@ -9855,7 +9871,7 @@ function make_substitutions($text, $substitutionarray, $outputlangs = null, $con
$valuetouseforsubstitution = $tmpobj->$method($id, $key_to_substitute, true);
}
$text = str_replace("$key_to_substitute", "$valuetouseforsubstitution", $text); // We must keep the " to work when value is 123.5 for example
$text = str_replace((string) $key_to_substitute, (string) $valuetouseforsubstitution, $text); // Cast to string in case value is 123.5 for example
}
}
}
@ -10497,10 +10513,11 @@ function dol_osencode($str)
* @param string $fieldid Field to get
* @param int $entityfilter Filter by entity
* @param string $filters Filters to add. WARNING: string must be escaped for SQL and not coming from user input.
* @param bool $useCache If true (default), cache will be queried and updated.
* @return int<-1,max>|string ID of code if OK, 0 if key empty, -1 if KO
* @see $langs->getLabelFromKey
*/
function dol_getIdFromCode($db, $key, $tablename, $fieldkey = 'code', $fieldid = 'id', $entityfilter = 0, $filters = '')
function dol_getIdFromCode($db, $key, $tablename, $fieldkey = 'code', $fieldid = 'id', $entityfilter = 0, $filters = '', $useCache = true)
{
global $conf;
@ -10510,7 +10527,7 @@ function dol_getIdFromCode($db, $key, $tablename, $fieldkey = 'code', $fieldid =
}
// Check in cache
if (isset($conf->cache['codeid'][$tablename][$key][$fieldid])) { // Can be defined to 0 or ''
if ($useCache && isset($conf->cache['codeid'][$tablename][$key][$fieldid])) { // Can be defined to 0 or ''
return $conf->cache['codeid'][$tablename][$key][$fieldid]; // Found in cache
}
@ -10533,14 +10550,16 @@ function dol_getIdFromCode($db, $key, $tablename, $fieldkey = 'code', $fieldid =
$resql = $db->query($sql);
if ($resql) {
$obj = $db->fetch_object($resql);
$valuetoget = '';
if ($obj) {
$conf->cache['codeid'][$tablename][$key][$fieldid] = $obj->valuetoget;
$valuetoget = $obj->valuetoget;
$conf->cache['codeid'][$tablename][$key][$fieldid] = $valuetoget;
} else {
$conf->cache['codeid'][$tablename][$key][$fieldid] = '';
}
$db->free($resql);
return $conf->cache['codeid'][$tablename][$key][$fieldid];
return $valuetoget;
} else {
return -1;
}
@ -10665,9 +10684,9 @@ function dol_eval($s, $returnvalue = 1, $hideerrors = 1, $onlysimplestring = '1'
// Check if there is dynamic call (first we use black list patterns)
if (preg_match('/\$[\w]*\s*\(/', $s)) {
if ($returnvalue) {
return 'Bad string syntax to evaluate (mode '.$onlysimplestring.', found a call using of "$abc(" or "$abc (" instead of using the direct name of the function): '.$s;
return 'Bad string syntax to evaluate (mode '.$onlysimplestring.', found a call using "$abc(" or "$abc (" instead of using the direct name of the function): '.$s;
} else {
dol_syslog('Bad string syntax to evaluate (mode '.$onlysimplestring.', found a call using of "$abc(" or "$abc (" instead of using the direct name of the function): '.$s, LOG_WARNING);
dol_syslog('Bad string syntax to evaluate (mode '.$onlysimplestring.', found a call using "$abc(" or "$abc (" instead of using the direct name of the function): '.$s, LOG_WARNING);
return '';
}
}
@ -11706,7 +11725,7 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0)
if ($newcrit != '') {
$numnewcrit = price2num($newcrit);
if (is_numeric($numnewcrit)) {
$newres .= $field.' '.$operator.' '.((float) $numnewcrit); // should be a numeric
$newres .= $db->sanitize($field).' '.$operator.' '.((float) $numnewcrit); // should be a numeric
} else {
$newres .= '1 = 2'; // force false, we received a corrupted data
}
@ -11716,10 +11735,10 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0)
$i2++; // a criteria for 1 more field was added to string
} elseif ($mode == 2 || $mode == -2) {
$crit = preg_replace('/[^0-9,]/', '', $crit); // ID are always integer
$newres .= ($i2 > 0 ? ' OR ' : '').$field." ".($mode == -2 ? 'NOT ' : '');
$newres .= ($i2 > 0 ? ' OR ' : '').$db->sanitize($field)." ".($mode == -2 ? 'NOT ' : '');
$newres .= $crit ? "IN (".$db->sanitize($db->escape($crit)).")" : "IN (0)";
if ($mode == -2) {
$newres .= ' OR '.$field.' IS NULL';
$newres .= ' OR '.$db->sanitize($field).' IS NULL';
}
$i2++; // a criteria for 1 more field was added to string
} elseif ($mode == 3 || $mode == -3) {
@ -11733,11 +11752,11 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0)
$listofcodes .= "'".$db->escape($val)."'";
}
}
$newres .= ($i2 > 0 ? ' OR ' : '').$field." ".($mode == -3 ? 'NOT ' : '')."IN (".$db->sanitize($listofcodes, 1).")";
$newres .= ($i2 > 0 ? ' OR ' : '').$db->sanitize($field)." ".($mode == -3 ? 'NOT ' : '')."IN (".$db->sanitize($listofcodes, 1).")";
$i2++; // a criteria for 1 more field was added to string
}
if ($mode == -3) {
$newres .= ' OR '.$field.' IS NULL';
$newres .= ' OR '.$db->sanitize($field).' IS NULL';
}
} elseif ($mode == 4) {
$tmparray = explode(',', $crit);
@ -11746,10 +11765,10 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0)
foreach ($tmparray as $val) {
$val = trim($val);
if ($val) {
$newres .= ($i2 > 0 ? " OR (" : "(").$field." LIKE '".$db->escape($val).",%'";
$newres .= ' OR '.$field." = '".$db->escape($val)."'";
$newres .= ' OR '.$field." LIKE '%,".$db->escape($val)."'";
$newres .= ' OR '.$field." LIKE '%,".$db->escape($val).",%'";
$newres .= ($i2 > 0 ? " OR (" : "(").$db->sanitize($field)." LIKE '".$db->escape($val).",%'";
$newres .= ' OR '.$db->sanitize($field)." = '".$db->escape($val)."'";
$newres .= ' OR '.$db->sanitize($field)." LIKE '%,".$db->escape($val)."'";
$newres .= ' OR '.$db->sanitize($field)." LIKE '%,".$db->escape($val).",%'";
$newres .= ')';
$i2++; // a criteria for 1 more field was added to string (we can add several criteria for the same field as it is a multiselect search criteria)
}
@ -11771,7 +11790,7 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0)
}
if (preg_match('/\.(id|rowid)$/', $field)) { // Special case for rowid that is sometimes a ref so used as a search field
$newres .= $field." = ".(is_numeric($tmpcrit) ? ((float) $tmpcrit) : '0');
$newres .= $db->sanitize($field)." = ".(is_numeric($tmpcrit) ? ((float) $tmpcrit) : '0');
} else {
$tmpcrit2 = $tmpcrit;
$tmpbefore = '%';
@ -11779,10 +11798,10 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0)
$tmps = '';
if (preg_match('/^!/', $tmpcrit)) {
$tmps .= $field." NOT LIKE "; // ! as exclude character
$tmps .= $db->sanitize($field)." NOT LIKE "; // ! as exclude character
$tmpcrit2 = preg_replace('/^!/', '', $tmpcrit2);
} else {
$tmps .= $field." LIKE ";
$tmps .= $db->sanitize($field)." LIKE ";
}
$tmps .= "'";

View File

@ -1231,9 +1231,9 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $
// Get counter in database
$counter = 0;
$sql = "SELECT MAX(".$sqlstring.") as val";
$sql .= " FROM ".MAIN_DB_PREFIX.$table;
$sql .= " WHERE ".$field." LIKE '".$db->escape($maskLike) . (getDolGlobalString('SEARCH_FOR_NEXT_VAL_ON_START_ONLY') ? "%" : "") . "'";
$sql .= " AND ".$field." NOT LIKE '(PROV%)'";
$sql .= " FROM ".MAIN_DB_PREFIX.$db->sanitize($table);
$sql .= " WHERE ".$db->sanitize($field)." LIKE '".$db->escape($maskLike) . (getDolGlobalString('SEARCH_FOR_NEXT_VAL_ON_START_ONLY') ? "%" : "") . "'";
$sql .= " AND ".$db->sanitize($field)." NOT LIKE '(PROV%)'";
// To ensure that all variables within the MAX() brackets are integers
// This avoid bad detection of max when data are noised with non numeric values at the position of the numero
@ -1299,10 +1299,10 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $
}
$ref = '';
$sql = "SELECT ".$field." as ref";
$sql .= " FROM ".MAIN_DB_PREFIX.$table;
$sql .= " WHERE ".$field." LIKE '".$db->escape($maskLike) . (getDolGlobalString('SEARCH_FOR_NEXT_VAL_ON_START_ONLY') ? "%" : "") . "'";
$sql .= " AND ".$field." NOT LIKE '%PROV%'";
$sql = "SELECT ".$db->sanitize($field)." as ref";
$sql .= " FROM ".MAIN_DB_PREFIX.$db->sanitize($table);
$sql .= " WHERE ".$db->sanitize($field)." LIKE '".$db->escape($maskLike) . (getDolGlobalString('SEARCH_FOR_NEXT_VAL_ON_START_ONLY') ? "%" : "") . "'";
$sql .= " AND ".$db->sanitize($field)." NOT LIKE '%PROV%'";
if ($bentityon) { // only if entity enable
$sql .= " AND entity IN (".getEntity($sharetable).")";
} elseif (!empty($forceentity)) {
@ -1364,8 +1364,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $
// Get counter in database
$maskrefclient_sql = "SELECT MAX(".$maskrefclient_sqlstring.") as val";
$maskrefclient_sql .= " FROM ".MAIN_DB_PREFIX.$table;
//$sql.= " WHERE ".$field." not like '(%'";
$maskrefclient_sql .= " WHERE ".$field." LIKE '".$db->escape($maskrefclient_maskLike) . (getDolGlobalString('SEARCH_FOR_NEXT_VAL_ON_START_ONLY') ? "%" : "") . "'";
$maskrefclient_sql .= " WHERE ".$db->sanitize($field)." LIKE '".$db->escape($maskrefclient_maskLike) . (getDolGlobalString('SEARCH_FOR_NEXT_VAL_ON_START_ONLY') ? "%" : "") . "'";
if ($bentityon) { // only if entity enable
$maskrefclient_sql .= " AND entity IN (".getEntity($sharetable).")";
} elseif (!empty($forceentity)) {

View File

@ -506,7 +506,8 @@ function correctExifImageOrientation($fileSource, $fileDest, $quality = 95)
/**
* Create a thumbnail from an image file (Supported extensions are gif, jpg, png and bmp).
* If file is myfile.jpg, new file may be myfile_small.jpg
* If file is myfile.jpg, new file may be myfile_small.jpg. But extension may differs if original file has a format and an extension
* of another one, like a.jpg file when real format is png.
*
* @param string $file Path of source file to resize
* @param int $maxWidth Maximum width of the thumbnail (-1=unchanged, 160 by default)
@ -514,7 +515,7 @@ function correctExifImageOrientation($fileSource, $fileDest, $quality = 95)
* @param string $extName Extension to differentiate thumb file name ('_small', '_mini')
* @param int $quality Quality of compression (0=worst, 100=best)
* @param string $outdir Directory where to store thumb
* @param int $targetformat New format of target (IMAGETYPE_GIF, IMAGETYPE_JPG, IMAGETYPE_PNG, IMAGETYPE_BMP, IMAGETYPE_WBMP ... or 0 to keep old format)
* @param int $targetformat New format of target (IMAGETYPE_GIF, IMAGETYPE_JPG, IMAGETYPE_PNG, IMAGETYPE_BMP, IMAGETYPE_WBMP ... or 0 to keep original format)
* @return string|int<0,0> Full path of thumb or '' if it fails or 'Error...' if it fails, or 0 if it fails to detect the type of image
*/
function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small', $quality = 50, $outdir = 'thumbs', $targetformat = 0)
@ -551,9 +552,12 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
$filetoread = realpath(dol_osencode($file)); // Chemin canonique absolu de l'image
$infoImg = getimagesize($filetoread); // Recuperation des infos de l'image
$imgWidth = $infoImg[0]; // Largeur de l'image
$imgHeight = $infoImg[1]; // Hauteur de l'image
$infoImg = getimagesize($filetoread); // Get information like size and real format of image. Warning real format may be png when extension is .jpg
$imgWidth = $infoImg[0]; // Width of image
$imgHeight = $infoImg[1]; // Height of image
// TODO LDR
//if $infoImg[2] != extension of file $file, return a string 'Error: content of file has a format that differs of the format of its extension
$ort = false;
if (function_exists('exif_read_data')) {

View File

@ -1506,6 +1506,8 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0,
$note = (!empty($object->lines[$i]->note) ? $object->lines[$i]->note : '');
$dbatch = (!empty($object->lines[$i]->detail_batch) ? $object->lines[$i]->detail_batch : false);
$multilangsactive = getDolGlobalInt('MAIN_MULTILANGS');
if ($issupplierline) {
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
$prodser = new ProductFournisseur($db);
@ -1518,11 +1520,55 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0,
}
}
//id
$idprod = (!empty($object->lines[$i]->fk_product) ? $object->lines[$i]->fk_product : false);
if ($idprod) {
$prodser->fetch($idprod);
//load multilangs
if ($multilangsactive) {
$prodser->getMultiLangs();
$object->lines[$i]->multilangs = $prodser->multilangs;
}
}
//label
if (!empty($object->lines[$i]->label)) {
$label = $object->lines[$i]->label;
} else {
if (!empty($object->lines[$i]->multilangs[$outputlangs->defaultlang]['label']) && $multilangsactive) {
$label = $object->lines[$i]->multilangs[$outputlangs->defaultlang]['label'];
} else {
if (!empty($object->lines[$i]->product_label)) {
$label = $object->lines[$i]->product_label;
} else {
$label = '';
}
}
}
//description
if (!empty($object->lines[$i]->desc)) {
$desc = $object->lines[$i]->desc;
} else {
if (!empty($object->lines[$i]->multilangs[$outputlangs->defaultlang]['description']) && $multilangsactive) {
$desc = $object->lines[$i]->multilangs[$outputlangs->defaultlang]['description'];
} else {
if (!empty($object->lines[$i]->description)) {
$desc = $object->lines[$i]->description;
} else {
$desc = '';
}
}
}
//ref supplier
$ref_supplier = (!empty($object->lines[$i]->ref_supplier) ? $object->lines[$i]->ref_supplier : (!empty($object->lines[$i]->ref_fourn) ? $object->lines[$i]->ref_fourn : '')); // TODO Not yet saved for supplier invoices, only supplier orders
//note
$note = (!empty($object->lines[$i]->note) ? $object->lines[$i]->note : '');
//dbatch
$dbatch = (!empty($object->lines[$i]->detail_batch) ? $object->lines[$i]->detail_batch : false);
if ($idprod) {
// If a predefined product and multilang and on other lang, we renamed label with label translated
if (getDolGlobalInt('MAIN_MULTILANGS') && ($outputlangs->defaultlang != $langs->defaultlang)) {
$translatealsoifmodified = (getDolGlobalString('MAIN_MULTILANG_TRANSLATE_EVEN_IF_MODIFIED')); // By default if value was modified manually, we keep it (no translation because we don't have it)
if ($multilangsactive && ($outputlangs->defaultlang != $langs->defaultlang)) {
$translatealsoifmodified = getDolGlobalString('MAIN_MULTILANG_TRANSLATE_EVEN_IF_MODIFIED'); // By default if value was modified manually, we keep it (no translation because we don't have it)
// TODO Instead of making a compare to see if param was modified, check that content contains reference translation. If yes, add the added part to the new translation
// ($textwasnotmodified is replaced with $textwasmodifiedorcompleted and we add completion).

View File

@ -1,8 +1,9 @@
<?php
/* Copyright (C) 2008-2021 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2008-2021 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2020 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 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
@ -234,18 +235,18 @@ function dolDecrypt($chain, $key = '')
* If constant MAIN_SECURITY_SALT is defined, we use it as a salt (used only if hashing algorithm is something else than 'password_hash').
*
* @param string $chain String to hash
* @param string $type Type of hash:
* 'auto' or '0': will use MAIN_SECURITY_HASH_ALGO else md5
* 'sha1' or '1': sha1
* 'sha1md5' or '2': sha1md5
* 'md5' or '3': md5
* 'openldapxxx' or '4': for OpenLdap
* 'sha256' or '5': sha256
* 'password_hash' or '6': password_hash
* Use 'md5' if hash is not needed for security purpose. For security need, prefer 'auto'.
* @param 'auto'|'0'|'sha1'|'1'|'sha1md5'|'2'|'md5'|'3'|'openldap'|'4'|'sha256'|'5'|'password_hash'|'6' $type Type of hash:
* 'auto' or '0': will use MAIN_SECURITY_HASH_ALGO else md5
* 'sha1' or '1': sha1
* 'sha1md5' or '2': sha1md5
* 'md5' or '3': md5
* 'openldapxxx' or '4': for OpenLdap
* 'sha256' or '5': sha256
* 'password_hash' or '6': password_hash
* Use 'md5' if hash is not needed for security purpose. For security need, prefer 'auto'.
* @param int $nosalt Do not include any salt
* @param int $mode 0=Return encoded password, 1=Return array with encoding password + encoding algorithm
* @return string|array<pass_encrypted:string,pass_encoding:string> Hash of string or array with pass_encrypted and pass_encoding
* @return string|array{pass_encrypted:string,pass_encoding:string} Hash of string or array with pass_encrypted and pass_encoding
* @see getRandomPassword(), dol_verifyHash()
*/
function dol_hash($chain, $type = '0', $nosalt = 0, $mode = 0)

View File

@ -33,7 +33,7 @@
*/
function dolStripPhpCode($str, $replacewith = '')
{
$str = str_replace('<?=', '<?php', $str);
$str = str_replace('<?=', '<?php echo', $str); // replace a bad practive
$newstr = '';
@ -77,9 +77,9 @@ function dolStripPhpCode($str, $replacewith = '')
*/
function dolKeepOnlyPhpCode($str)
{
$str = str_replace('<?=', '<?php', $str);
$str = str_replace('<?=', '<?php echo', $str);
$str = str_replace('<?php', '__LTINTPHP__', $str);
$str = str_replace('<?', '<?php', $str); // replace the short_open_tag. It is recommended to set this is Off in php.ini
$str = str_replace('<?', '<?php', $str); // replace the short_open_tag. It is recommended to set this to Off in php.ini
$str = str_replace('__LTINTPHP__', '<?php', $str);
$newstr = '';
@ -593,14 +593,15 @@ function redirectToContainer($containerref, $containeraliasalt = '', $containeri
/**
* Clean an HTML page to report only content, so we can include it into another page.
* It outputs content of file sanitized from html and body part.
* Execute content of a php page and report result to be included into another page.
* It outputs content of file where the html and body part have been removed.
*
* @param string $containerref Path to file to include (must be a page from website root. Example: 'mypage.php' means 'mywebsite/mypage.php')
* @param int $once If set to 1, we use include_once.
* @param int $cachedelay A cache delay in seconds.
* @return void
*/
function includeContainer($containerref, $once = 0)
function includeContainer($containerref, $once = 0, $cachedelay = 0)
{
global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs; // Very important. Required to have var available when running included containers.
global $includehtmlcontentopened;
@ -614,6 +615,11 @@ function includeContainer($containerref, $once = 0)
}
$fullpathfile = DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/website/'.$websitekey.'/'.$containerref;
$fullpathcache = '';
// If we ask to use the cache delay
if ($cachedelay > 0 && !getDolGlobalString("WEBSITE_DISABLE_CACHE_OF_CONTAINERS")) {
$fullpathcache = DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/website/temp/'.$websitekey.'-'.$websitepage->id.'-'.$containerref.'.cache';
}
if (empty($includehtmlcontentopened)) {
$includehtmlcontentopened = 0;
@ -626,29 +632,58 @@ function includeContainer($containerref, $once = 0)
//dol_syslog("Include container ".$containerref.' includehtmlcontentopened='.$includehtmlcontentopened);
// file_get_contents is not possible. We must execute code with include
//$content = file_get_contents($fullpathfile);
//print preg_replace(array('/^.*<body[^>]*>/ims','/<\/body>.*$/ims'), array('', ''), $content);*/
ob_start();
if ($once) {
$res = @include_once $fullpathfile;
} else {
$res = @include $fullpathfile;
}
$tmpoutput = ob_get_contents();
ob_end_clean();
// We don't print info messages for pages of type library or service
if (!empty($websitepage->type_container) && !in_array($websitepage->type_container, array('library', 'service'))) {
print "\n".'<!-- include '.$websitekey.'/'.$containerref.(is_object($websitepage) ? ' parent id='.$websitepage->id : '').' level = '.$includehtmlcontentopened.' -->'."\n";
print "\n".'<!-- include '.$websitekey.'/'.$containerref.(is_object($websitepage) ? ' parent id='.$websitepage->id : '').' level='.$includehtmlcontentopened.' -->'."\n";
}
print preg_replace(array('/^.*<body[^>]*>/ims', '/<\/body>.*$/ims'), array('', ''), $tmpoutput);
if (!$res) {
print 'ERROR: FAILED TO INCLUDE PAGE '.$containerref.".\n";
$tmpoutput = '';
if ($cachedelay > 0 && $fullpathcache) {
if (is_file($fullpathcache)) {
// Get the last modification time of the file
$lastModifiedTime = filemtime($fullpathcache);
// Get the current time
$currentTime = time();
// Check if the file is not older than X seconds
if (($currentTime - $lastModifiedTime) <= $cachedelay) {
// The file is too recent
$tmpoutput = file_get_contents($fullpathcache);
}
}
}
if (empty($tmpoutput)) {
// file_get_contents is not possible because we must execute code with include
//$content = file_get_contents($fullpathfile);
//print preg_replace(array('/^.*<body[^>]*>/ims','/<\/body>.*$/ims'), array('', ''), $content);*/
ob_start();
if ($once) {
$res = @include_once $fullpathfile;
} else {
$res = @include $fullpathfile;
}
$tmpoutput = ob_get_contents();
ob_end_clean();
if (!$res) {
print 'ERROR: FAILED TO INCLUDE PAGE '.$containerref."(once=".$once.")\n";
} else {
$tmpoutput = preg_replace(array('/^.*<body[^>]*>/ims', '/<\/body>.*$/ims'), array('', ''), $tmpoutput);
// Save the content into cache file if content is lower than 10M
if ($fullpathcache && strlen($tmpoutput) < 10000000) {
file_put_contents($fullpathcache, $tmpoutput);
dolChmod($fullpathcache);
}
}
}
print $tmpoutput;
$includehtmlcontentopened--;
}

View File

@ -731,9 +731,9 @@ function print_end_menu_array()
* @param int<0,1> $noout Disable output (Initialise &$menu only).
* @param string $forcemainmenu 'x'=Force mainmenu to mainmenu='x'
* @param string $forceleftmenu 'all'=Force leftmenu to '' (= all). If value come being '', we change it to value in session and 'none' if not defined in session.
* @param ?array<string,string> $moredata An array with more data to output
* @param ?array{searchform?:string,bookmarks?:string} $moredata An array with more data to output
* @param int<0,1> $type_user 0=Menu for backoffice, 1=Menu for front office
* @return int Nb of menu entries
* @return int<0,max> Nb of menu entries
*/
function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabMenu, &$menu, $noout = 0, $forcemainmenu = '', $forceleftmenu = '', $moredata = null, $type_user = 0)
{

View File

@ -148,9 +148,9 @@ class MenuManager
* Show menu.
* Menu defined in sql tables were stored into $this->tabMenu BEFORE this is called.
*
* @param string $mode 'top', 'topnb', 'left', 'leftdropdown', 'jmobile' (used to get full xml ul/li menu)
* @param ?array<string,mixed> $moredata An array with more data to output
* @return int 0 or nb of top menu entries if $mode = 'topnb'
* @param 'top'|'topnb'|'left'|'leftdropdown'|'jmobile' $mode 'top', 'topnb', 'left', 'leftdropdown', 'jmobile' (used to get full xml ul/li menu)
* @param ?array<string,string> $moredata An array with more data to output
* @return int<0,max> 0 or nb of top menu entries if $mode = 'topnb'
*/
public function showmenu($mode, $moredata = null)
{

View File

@ -1762,8 +1762,8 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
$err = 0;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const";
$sql .= " WHERE ".$this->db->decrypt('name')." like '".$this->db->escape($this->const_name)."_TABS_%'";
$sql .= " AND entity = ".$conf->entity;
$sql .= " WHERE ".$this->db->decrypt('name')." LIKE '".$this->db->escape($this->const_name)."_TABS_%'";
$sql .= " AND entity = ".((int) $conf->entity);
dol_syslog(get_class($this)."::delete_tabs", LOG_DEBUG);
if (!$this->db->query($sql)) {
@ -2753,8 +2753,8 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
$tmpfieldsofline = explode(';', $line);
$modulekey = strtolower($tmpfieldsofline[0]);
$conf->cache['noncompliantmodules'][$modulekey]['name'] = $tmpfieldsofline[0];
$conf->cache['noncompliantmodules'][$modulekey]['id'] = $tmpfieldsofline[1];
$conf->cache['noncompliantmodules'][$modulekey]['signature'] = $tmpfieldsofline[2];
$conf->cache['noncompliantmodules'][$modulekey]['id'] = (isset($tmpfieldsofline[1]) ? $tmpfieldsofline[1] : '');
$conf->cache['noncompliantmodules'][$modulekey]['signature'] = (isset($tmpfieldsofline[2]) ? $tmpfieldsofline[2] : '');
$conf->cache['noncompliantmodules'][$modulekey]['message'] = $langs->trans(empty($tmpfieldsofline[3]) ? 'WarningModuleAffiliatedToAReportedCompany' : $tmpfieldsofline[3]);
if (!empty($tmpfieldsofline[4])) {
$message2 = $langs->trans("WarningModuleAffiliatedToAPiratPlatform", '{s}');

View File

@ -60,7 +60,7 @@ class mod_commande_marbre extends ModeleNumRefCommandes
{
global $conf, $mysoc;
if ((float) $conf->global->MAIN_VERSION_LAST_INSTALL >= 16.0 && $mysoc->country_code != 'FR') {
if ((float) getDolGlobalString('MAIN_VERSION_LAST_INSTALL') >= 16.0 && $mysoc->country_code != 'FR') {
$this->prefix = 'SO'; // We use correct standard code "SO = Sale Order"
}
}

View File

@ -169,14 +169,14 @@ class MailingTargets // This can't be abstract as it is used for some method
{
// phpcs:enable
// Mise a jour nombre de destinataire dans table des mailings
$sql = "SELECT COUNT(*) nb FROM ".MAIN_DB_PREFIX."mailing_cibles";
$sql = "SELECT COUNT(*) nb FROM ".$this->db->prefix()."mailing_cibles";
$sql .= " WHERE fk_mailing = ".((int) $mailing_id);
$result = $this->db->query($sql);
if ($result) {
$obj = $this->db->fetch_object($result);
$nb = $obj->nb;
$sql = "UPDATE ".MAIN_DB_PREFIX."mailing";
$sql = "UPDATE ".$this->db->prefix()."mailing";
$sql .= " SET nbemail = ".((int) $nb)." WHERE rowid = ".((int) $mailing_id);
if (!$this->db->query($sql)) {
dol_syslog($this->db->error());
@ -208,7 +208,7 @@ class MailingTargets // This can't be abstract as it is used for some method
$num = count($cibles);
foreach ($cibles as $targetarray) {
if (!empty($targetarray['email'])) { // avoid empty email address
$sql = "INSERT INTO ".MAIN_DB_PREFIX."mailing_cibles";
$sql = "INSERT INTO ".$this->db->prefix()."mailing_cibles";
$sql .= " (fk_mailing,";
$sql .= " fk_contact,";
$sql .= " lastname, firstname, email, other, source_url, source_id,";
@ -244,27 +244,27 @@ class MailingTargets // This can't be abstract as it is used for some method
/*
//Update the status to show thirdparty mail that don't want to be contacted anymore'
$sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
$sql = "UPDATE ".$this->db->prefix()."mailing_cibles";
$sql .= " SET statut=3";
$sql .= " WHERE fk_mailing = ".((int) $mailing_id)." AND email in (SELECT email FROM ".MAIN_DB_PREFIX."societe where fk_stcomm=-1)";
$sql .= " WHERE fk_mailing = ".((int) $mailing_id)." AND email in (SELECT email FROM ".$this->db->prefix()."societe where fk_stcomm=-1)";
$sql .= " AND source_type='thirdparty'";
dol_syslog(__METHOD__.": mailing update status to display thirdparty mail that do not want to be contacted");
$result=$this->db->query($sql);
//Update the status to show contact mail that don't want to be contacted anymore'
$sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
$sql = "UPDATE ".$this->db->prefix()."mailing_cibles";
$sql .= " SET statut=3";
$sql .= " WHERE fk_mailing = ".((int) $mailing_id)." AND source_type='contact' AND (email in (SELECT sc.email FROM ".MAIN_DB_PREFIX."socpeople AS sc ";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe s ON s.rowid=sc.fk_soc WHERE s.fk_stcomm=-1 OR no_email=1))";
$sql .= " WHERE fk_mailing = ".((int) $mailing_id)." AND source_type='contact' AND (email in (SELECT sc.email FROM ".$this->db->prefix()."socpeople AS sc ";
$sql .= " INNER JOIN ".$this->db->prefix()."societe s ON s.rowid=sc.fk_soc WHERE s.fk_stcomm=-1 OR no_email=1))";
dol_syslog(__METHOD__.": mailing update status to display contact mail that do not want to be contacted",LOG_DEBUG);
$result=$this->db->query($sql);
*/
if (empty($this->evenunsubscribe)) {
$sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles as mc";
$sql = "UPDATE ".$this->db->prefix()."mailing_cibles as mc";
$sql .= " SET mc.statut = 3";
$sql .= " WHERE mc.fk_mailing = ".((int) $mailing_id);
$sql .= " AND EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX."mailing_unsubscribe as mu WHERE mu.email = mc.email and mu.entity = ".((int) $conf->entity).")";
$sql .= " AND EXISTS (SELECT rowid FROM ".$this->db->prefix()."mailing_unsubscribe as mu WHERE mu.email = mc.email and mu.entity = ".((int) $conf->entity).")";
dol_syslog(__METHOD__.":mailing update status to display emails that do not want to be contacted anymore", LOG_DEBUG);
$result = $this->db->query($sql);
@ -291,7 +291,7 @@ class MailingTargets // This can't be abstract as it is used for some method
public function clear_target($mailing_id)
{
// phpcs:enable
$sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing_cibles";
$sql = "DELETE FROM ".$this->db->prefix()."mailing_cibles";
$sql .= " WHERE fk_mailing = ".((int) $mailing_id);
if (!$this->db->query($sql)) {

View File

@ -415,7 +415,7 @@ class modAdherent extends DolibarrModules
'unitfrequency'=> 3600 * 24,
'priority'=>50,
'status'=>1,
'test'=>'$conf->adherent->enabled',
'test'=>'isModEnabled("member")',
'datestart'=>$datestart
),
);

View File

@ -527,7 +527,7 @@ class modStock extends DolibarrModules
);
$this->import_updatekeys_array[$r] = array('ps.fk_product' => 'Product', 'ps.fk_entrepot' => "Warehouse");
$this->import_run_sql_after_array[$r] = array( // Because we may change data that are denormalized, we must update dernormalized data after.
'UPDATE '.MAIN_DB_PREFIX.'product as p SET p.stock = (SELECT SUM(ps.reel) FROM '.MAIN_DB_PREFIX.'product_stock ps WHERE ps.fk_product = p.rowid);'
'UPDATE '.MAIN_DB_PREFIX.'product as p SET stock = (SELECT SUM(ps.reel) FROM '.MAIN_DB_PREFIX.'product_stock ps WHERE ps.fk_product = p.rowid);'
);
}

View File

@ -98,6 +98,8 @@ class modGeneratePassNone extends ModeleGenPassword
*/
public function validatePassword($password)
{
dol_syslog("modGeneratePassNone::validatePassword");
return 1;
}
}

View File

@ -221,6 +221,8 @@ class modGeneratePassPerso extends ModeleGenPassword
$this->initAll(); // For the case this method is called alone
dol_syslog("modGeneratePassPerso::validatePassword");
$password_a = preg_split('//u', $password, 0, PREG_SPLIT_NO_EMPTY);
$maj = preg_split('//u', $this->Maj, 0, PREG_SPLIT_NO_EMPTY);
$num = preg_split('//u', $this->Nb, 0, PREG_SPLIT_NO_EMPTY);

View File

@ -125,6 +125,8 @@ class modGeneratePassStandard extends ModeleGenPassword
{
global $langs;
dol_syslog("modGeneratePassStandard::validatePassword");
if (dol_strlen($password) < $this->length2) {
$langs->load("other");
$this->error = $langs->trans("YourPasswordMustHaveAtLeastXChars", $this->length2);

View File

@ -112,9 +112,9 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode
// First, we get the max value (response immediate car champ indexe)
$posindice = strlen($prefix) + 6;
$sql = "SELECT MAX(CAST(SUBSTRING(".$field." FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
$sql = "SELECT MAX(CAST(SUBSTRING(".$db->sanitize($field)." FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
$sql .= " FROM ".MAIN_DB_PREFIX."societe";
$sql .= " WHERE ".$field." LIKE '".$db->escape($prefix)."____-%'";
$sql .= " WHERE ".$db->sanitize($field)." LIKE '".$db->escape($prefix)."____-%'";
$sql .= " AND entity IN (".getEntity('societe').")";
dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG);

View File

@ -205,6 +205,9 @@ if (empty($reshook) && !empty($object->table_element) && isset($extrafields->att
if ($object->element == 'salary') {
$permok = $user->hasRight('salaries', 'read');
}
if ($object->element == 'member') {
$permok = $user->hasRight('adherent', 'creer');
}
$isdraft = ((isset($object->statut) && $object->statut == 0) || (isset($object->status) && $object->status == 0));
if (($isdraft || !empty($extrafields->attributes[$object->table_element]['alwayseditable'][$tmpkeyextra]))

View File

@ -3,7 +3,7 @@
* Copyright (C) 2014-2016 Jean-François Ferry <hello@librethic.io>
* 2016 Christophe Battarel <christophe@altairis.fr>
* Copyright (C) 2023 Benjamin Falière <benjamin.faliere@altairis.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 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
@ -178,6 +178,36 @@ class InterfaceTicketEmail extends DolibarrTriggers
if (!getDolGlobalString('TICKET_DISABLE_ALL_MAILS')) {
// Send email to assigned user
$sendto = $userstat->email;
$old_MAIN_MAIL_AUTOCOPY_TO = null;
if (!getDolGlobalString('TICKET_DISABLE_MAIL_AUTOCOPY_TO')) {
$old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO;
$conf->global->MAIN_MAIL_AUTOCOPY_TO = '';
}
if (!empty($sendto)) {
$this->composeAndSendAssigneeMessage($sendto, $subject_assignee, $body_assignee, $see_ticket_assignee, $object, $langs);
}
if (!getDolUserString('TICKET_DISABLE_MAIL_AUTOCOPY_TO')) {
$conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO;
}
}
} else {
$this->error = $userstat->error;
$this->errors = $userstat->errors;
}
}
// Send email to assignee if an assignee was set at creation
if ($object->fk_user_assign > 0 && $object->fk_user_assign != $user->id && empty($object->context['disableticketemail'])) {
$userstat = new User($this->db);
$res = $userstat->fetch($object->fk_user_assign);
if ($res > 0) {
// Send email to notification email
if (!getDolGlobalString('TICKET_DISABLE_ALL_MAILS')) {
// Send email to assigned user
$sendto = $userstat->email;
$old_MAIN_MAIL_AUTOCOPY_TO = null;
if (!getDolGlobalString('TICKET_DISABLE_MAIL_AUTOCOPY_TO')) {
$old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO;
$conf->global->MAIN_MAIL_AUTOCOPY_TO = '';

View File

@ -312,7 +312,7 @@ if (GETPOSTISSET('search_processing')) {
// Manage filter
if (is_array($filter) && count($filter) > 0) {
foreach ($filter as $key => $value) {
$sql .= " AND ".$key." LIKE '%".$db->escape($value)."%'";
$sql .= " AND ".$db->sanitize($key)." LIKE '%".$db->escape($value)."%'";
}
}
if (!empty($search_module_name)) {

View File

@ -256,6 +256,13 @@ class Donations extends DolibarrApi
continue;
}
if ($field == 'array_options' && is_array($value)) {
foreach ($value as $index => $val) {
$this->don->array_options[$index] = $this->_checkValForAPI($field, $val, $this->don);
}
continue;
}
$this->don->$field = $this->_checkValForAPI($field, $value, $this->don);
}

View File

@ -2242,7 +2242,7 @@ class EmailCollector extends CommonObject
// This is an external reference, we check if we have it in our database
if (is_null($objectemail) && isModEnabled('ticket')) {
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."ticket";
$sql .= " WHERE email_msgid = '".$this->db->escape($reg[1])."' OR origin_references like '%".$this->db->escape($this->db->escapeforlike($reg[1]))."%'";
$sql .= " WHERE email_msgid = '".$this->db->escape($reg[1])."' OR origin_references LIKE '%".$this->db->escape($this->db->escapeforlike($reg[1]))."%'";
$resql = $this->db->query($sql);
if ($resql) {
$obj = $this->db->fetch_object($resql);

View File

@ -291,7 +291,7 @@ class ConferenceOrBooth extends ActionComm
$link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_new.php?id='.urlencode((string) ($id)).'&type=conf';
$encodedsecurekey = dol_hash(getDolGlobalString('EVENTORGANIZATION_SECUREKEY').'conferenceorbooth'.$id, '2');
$encodedsecurekey = dol_hash(getDolGlobalString('EVENTORGANIZATION_SECUREKEY').'conferenceorbooth'.((int) $id), 'md5');
$link_subscription .= '&securekey='.urlencode($encodedsecurekey);
/*$this->fields['pubregister'] = array('type'=>'url', 'label'=>$langs->trans("PublicAttendeeSubscriptionPage"), 'enabled'=>'1', 'position'=>72, 'notnull'=>0, 'visible'=>1);
@ -336,15 +336,15 @@ class ConferenceOrBooth extends ActionComm
if (count($filter) > 0) {
foreach ($filter as $key => $value) {
if ($key == 't.id' || $key == 't.fk_project' || $key == 't.fk_soc' || $key == 't.fk_action') {
$sqlwhere[] = $key." = ".((int) $value);
$sqlwhere[] = $this->db->sanitize($key)." = ".((int) $value);
} elseif (array_key_exists($key, $this->fields) && in_array($this->fields[$key]['type'], array('date', 'datetime', 'timestamp'))) {
$sqlwhere[] = $key." = '".$this->db->idate($value)."'";
$sqlwhere[] = $this->db->sanitize($key)." = '".$this->db->idate($value)."'";
} elseif ($key == 'customsql') {
$sqlwhere[] = $value;
$sqlwhere[] = $value; // deprecated
} elseif (strpos($value, '%') === false) {
$sqlwhere[] = $key.' IN ('.$this->db->sanitize($this->db->escape($value)).')';
$sqlwhere[] = $this->db->sanitize($key).' IN ('.$this->db->sanitize($this->db->escape($value)).')';
} else {
$sqlwhere[] = $key." LIKE '%".$this->db->escape($value)."%'";
$sqlwhere[] = $this->db->sanitize($key)." LIKE '%".$this->db->escape($value)."%'";
}
}
}

View File

@ -489,15 +489,15 @@ class ConferenceOrBoothAttendee extends CommonObject
if (count($filter) > 0) {
foreach ($filter as $key => $value) {
if ($key == 't.rowid' || $key == 't.fk_soc' || $key == 't.fk_project' || $key == 't.fk_actioncomm') {
$sqlwhere[] = $key.'='.((int) $value);
} elseif (in_array($this->fields[$key]['type'], array('date', 'datetime', 'timestamp'))) {
$sqlwhere[] = $key." = '".$this->db->idate($value)."'";
$sqlwhere[] = $this->db->sanitize($key).' = '.((int) $value);
} elseif (!empty($this->fields[$key]) && in_array($this->fields[$key]['type'], array('date', 'datetime', 'timestamp'))) {
$sqlwhere[] = $this->db->sanitize($key)." = '".$this->db->idate($value)."'";
} elseif ($key == 'customsql') {
$sqlwhere[] = $value;
} elseif (strpos($value, '%') === false) {
$sqlwhere[] = $key.' IN ('.$this->db->sanitize($this->db->escape($value)).')';
$sqlwhere[] = $this->db->sanitize($key).' IN ('.$this->db->sanitize($this->db->escape($value)).')';
} else {
$sqlwhere[] = $key." LIKE '%".$this->db->escape($value)."%'";
$sqlwhere[] = $this->db->sanitize($key)." LIKE '%".$this->db->escape($value)."%'";
}
}
}

View File

@ -483,6 +483,7 @@ class Shipments extends DolibarrApi
$this->shipment->context['caller'] = sanitizeVal($request_data['caller'], 'aZ09');
continue;
}
if ($field == 'array_options' && is_array($value)) {
foreach ($value as $index => $val) {
$this->shipment->array_options[$index] = $this->_checkValForAPI($field, $val, $this->shipment);

View File

@ -460,6 +460,13 @@ class ExpenseReports extends DolibarrApi
continue;
}
if ($field == 'array_options' && is_array($value)) {
foreach ($value as $index => $val) {
$this->expensereport->array_options[$index] = $this->_checkValForAPI($field, $val, $this->expensereport);
}
continue;
}
$this->expensereport->$field = $this->_checkValForAPI($field, $value, $this->expensereport);
}

View File

@ -694,6 +694,7 @@ class ExpenseReport extends CommonObject
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element." as d";
if ($ref) {
$sql .= " WHERE d.ref = '".$this->db->escape($ref)."'";
$sql .= " AND d.entity IN (".getEntity('expensereport').")";
} else {
$sql .= " WHERE d.rowid = ".((int) $id);
}

View File

@ -406,9 +406,9 @@ class Export
switch ($InfoFieldList[0]) {
case 'Text':
if (!(strpos($ValueField, '%') === false)) {
$szFilterQuery = " ".$NameField." LIKE '".$this->db->escape($ValueField)."'";
$szFilterQuery = " ".$this->db->sanitize($NameField)." LIKE '".$this->db->escape($ValueField)."'";
} else {
$szFilterQuery = " ".$NameField." = '".$this->db->escape($ValueField)."'";
$szFilterQuery = " ".$this->db->sanitize($NameField)." = '".$this->db->escape($ValueField)."'";
}
break;
case 'Date':

View File

@ -1,9 +1,9 @@
<?php
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2023 Joachim Kueter <git-jk@bloxera.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2023 Joachim Kueter <git-jk@bloxera.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.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
@ -82,6 +82,9 @@ class SupplierInvoices extends DolibarrApi
throw new RestException(404, 'Supplier invoice not found');
}
// Retrieve credit note ids
$this->invoice->getListIdAvoirFromInvoice();
$this->invoice->fetchObjectLinked();
return $this->_cleanObjectDatas($this->invoice);
}
@ -289,6 +292,7 @@ class SupplierInvoices extends DolibarrApi
}
continue;
}
$this->invoice->$field = $this->_checkValForAPI($field, $value, $this->invoice);
}

View File

@ -312,6 +312,7 @@ class SupplierOrders extends DolibarrApi
}
continue;
}
$this->order->$field = $this->_checkValForAPI($field, $value, $this->order);
}

View File

@ -89,25 +89,24 @@ if (!$user->hasRight("societe", "client", "voir") && !$socid) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
/*
if (dol_strlen($stcomm)) {
$sql .= " AND s.fk_stcomm=$stcomm";
$sql .= " AND s.fk_stcomm = ".((int) $stcomm);
}
if (dol_strlen($begin)) {
$sql .= " AND p.lastname LIKE '$begin%'";
$sql .= " AND p.lastname LIKE '".$db->escape($begin)."%'";
}
if ($contactname) {
$sql .= " AND p.lastname LIKE '%".strtolower($contactname)."%'";
$sql .= " AND p.lastname LIKE '%".$db->escape($contactname)."%'";
$sortfield = "p.lastname";
$sortorder = "ASC";
}
*/
if ($socid) {
$sql .= " AND s.rowid = ".((int) $socid);
}
$sql .= " ORDER BY $sortfield $sortorder ";
$sql .= " ORDER BY $sortfield $sortorder";
$sql .= $db->plimit($limit, $offset);
$result = $db->query($sql);

View File

@ -3339,13 +3339,15 @@ if ($action == 'create') {
}
}
$facidavoir = $object->getListIdAvoirFromInvoice();
if (count($facidavoir) > 0) {
// Retrieve credit note ids
$object->getListIdAvoirFromInvoice();
if (!empty($object->creditnote_ids)) {
$invoicecredits = array();
foreach ($facidavoir as $id) {
$facavoir = new FactureFournisseur($db);
$facavoir->fetch($id);
$invoicecredits[] = $facavoir->getNomUrl(1);
foreach ($object->creditnote_ids as $invoiceid) {
$creditnote = new FactureFournisseur($db);
$creditnote->fetch($invoiceid);
$invoicecredits[] = $creditnote->getNomUrl(1);
}
print ' <span class="opacitymediumbycolor paddingleft">'.$langs->transnoentities("InvoiceHasAvoir") . (count($invoicecredits) ? ' ' : '') . implode(',', $invoicecredits);
print '</span>';

View File

@ -211,13 +211,15 @@ if ($id > 0 || !empty($ref)) {
print ' '.$langs->transnoentities("CorrectInvoice", $facusing->getNomUrl(1));
}
$facidavoir = $object->getListIdAvoirFromInvoice();
if (count($facidavoir) > 0) {
// Retrieve credit note ids
$object->getListIdAvoirFromInvoice();
if (!empty($object->creditnote_ids)) {
$invoicecredits = array();
foreach ($facidavoir as $facid) {
$facavoir = new FactureFournisseur($db);
$facavoir->fetch($facid);
$invoicecredits[] = $facavoir->getNomUrl(1);
foreach ($object->creditnote_ids as $invoiceid) {
$creditnote = new FactureFournisseur($db);
$creditnote->fetch($invoiceid);
$invoicecredits[] = $creditnote->getNomUrl(1);
}
print ' '.$langs->transnoentities("InvoiceHasAvoir") . (count($invoicecredits) ? ' ' : '') . implode(',', $invoicecredits);
}

View File

@ -187,13 +187,15 @@ if ($object->id > 0) {
print ' ('.$langs->transnoentities("CorrectInvoice", $facusing->getNomUrl(1)).')';
}
$facidavoir = $object->getListIdAvoirFromInvoice();
if (count($facidavoir) > 0) {
// Retrieve credit note ids
$object->getListIdAvoirFromInvoice();
if (!empty($object->creditnote_ids)) {
$invoicecredits = array();
foreach ($facidavoir as $facid) {
$facavoir = new FactureFournisseur($db);
$facavoir->fetch($facid);
$invoicecredits[] = $facavoir->getNomUrl(1);
foreach ($object->creditnote_ids as $invoiceid) {
$creditnote = new FactureFournisseur($db);
$creditnote->fetch($invoiceid);
$invoicecredits[] = $creditnote->getNomUrl(1);
}
print ' ('.$langs->transnoentities("InvoiceHasAvoir") . (count($invoicecredits) ? ' ' : '') . implode(',', $invoicecredits) . ')';
}

View File

@ -169,13 +169,15 @@ if ($object->id > 0) {
print ' ('.$langs->transnoentities("CorrectInvoice", $facusing->getNomUrl(1)).')';
}
$facidavoir = $object->getListIdAvoirFromInvoice();
if (count($facidavoir) > 0) {
// Retrieve credit note ids
$object->getListIdAvoirFromInvoice();
if (!empty($object->creditnote_ids)) {
$invoicecredits = array();
foreach ($facidavoir as $facid) {
$facavoir = new FactureFournisseur($db);
$facavoir->fetch($facid);
$invoicecredits[] = $facavoir->getNomUrl(1);
foreach ($object->creditnote_ids as $invoiceid) {
$creditnote = new FactureFournisseur($db);
$creditnote->fetch($invoiceid);
$invoicecredits[] = $creditnote->getNomUrl(1);
}
print ' ('.$langs->transnoentities("InvoiceHasAvoir") . implode(',', $invoicecredits) . ')';
}

View File

@ -178,6 +178,9 @@ if ($object->id > 0) {
print dol_get_fiche_end();
print '<br>';
$modulepart = 'supplier_payment';
// TODO: get the appropriate permission
$permissiontoadd = true;

View File

@ -91,8 +91,8 @@ class Odf
public $userdefined = array();
const PIXEL_TO_CM = 0.026458333;
const FIND_TAGS_REGEX = '/<([A-Za-z0-9]+)(?:\s([A-Za-z]+(?:\-[A-Za-z]+)?(?:=(?:".*?")|(?:[0-9]+))))*(?:(?:\s\/>)|(?:>(.*)<\/\1>))/s';
const FIND_ENCODED_TAGS_REGEX = '/&lt;([A-Za-z]+)(?:\s([A-Za-z]+(?:\-[A-Za-z]+)?(?:=(?:".*?")|(?:[0-9]+))))*(?:(?:\s\/&gt;)|(?:&gt;(.*)&lt;\/\1&gt;))/';
const FIND_TAGS_REGEX = '/<([A-Za-z0-9]+)(?:\s([A-Za-z]+(?:\-[A-Za-z]+)?(?:=(?:".*?")|(?:[0-9]+))))*(?:(?:\s\/>)|(?:>(((?!<\1(\s.*)?>).)*)<\/\1>))/s';
const FIND_ENCODED_TAGS_REGEX = '/&lt;([A-Za-z]+)(?:\s([A-Za-z]+(?:\-[A-Za-z]+)?(?:=(?:".*?")|(?:[0-9]+))))*(?:(?:\s\/&gt;)|(?:&gt;(((?!&lt;\1(\s.*)?&gt;).)*)&lt;\/\1&gt;))/';
/**

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,57 @@
-- Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
-- Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
-- Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
-- Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
-- Copyright (C) 2004 Guillaume Delecourt <guillaume.delecourt@opensides.be>
-- Copyright (C) 2005-2025 Regis Houssin <regis.houssin@inodbox.com>
-- Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
-- Copyright (C) 2011-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
-- Copyright (C) 2015-2017 Juanjo Menent <jmenent@2byte.es>
-- Copyright (C) 2018 Abbes bahfir <dolipar@dolipar.org>
-- Copyright (C) 2020 Udo Tamm <dev@dolibit.de>
-- Copyright (C) 2023 Nick Fragoulis
-- Copyright (C) 2023 Santiago Payà <santiagopim@gmail.com>
--
--
--------------------------------------------------------------------------------------
-- License
-- #######
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <https://www.gnu.org/licenses/>.
--
--------------------------------------------------------------------------------------
-- Comment
-- #######
-- (EN)
-- Do not place a comment at the end of the line, this file is parsed at the end of the line.
-- from the install and all '--' are removed.
--
-- (FR)
-- Ne pas placer de commentaire en fin de ligne, ce fichier est parsé lors
-- de l'install et tous les sigles '--' sont supprimés.
--
--------------------------------------------------------------------------------------
-- PCG = Plan Comptable Général (FR) - General Accounting Plan (EN)
--------------------------------------------------------------------------------------
-- Accounting Journals
INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('VT', 'ACCOUNTING_SELL_JOURNAL', 2, 1, __ENTITY__);
INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('AC', 'ACCOUNTING_PURCHASE_JOURNAL', 3, 1, __ENTITY__);
INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('BQ', 'FinanceJournal', 4, 1, __ENTITY__);
INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('OD', 'ACCOUNTING_MISCELLANEOUS_JOURNAL', 1, 1, __ENTITY__);
INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('AN', 'ACCOUNTING_HAS_NEW_JOURNAL', 9, 1, __ENTITY__);
INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('ER', 'ExpenseReportsJournal', 5, 1, __ENTITY__);
INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('INV', 'InventoryJournal', 8, 1, __ENTITY__);

View File

@ -3,7 +3,7 @@
-- Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
-- Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
-- Copyright (C) 2004 Guillaume Delecourt <guillaume.delecourt@opensides.be>
-- Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
-- Copyright (C) 2005-2025 Regis Houssin <regis.houssin@inodbox.com>
-- Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
-- Copyright (C) 2011-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
-- Copyright (C) 2015-2017 Juanjo Menent <jmenent@2byte.es>
@ -46,17 +46,6 @@
--------------------------------------------------------------------------------------
-- Accounting Journals
INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('VT', 'ACCOUNTING_SELL_JOURNAL', 2, 1, 1);
INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('AC', 'ACCOUNTING_PURCHASE_JOURNAL', 3, 1, 1);
INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('BQ', 'FinanceJournal', 4, 1, 1);
INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('OD', 'ACCOUNTING_MISCELLANEOUS_JOURNAL', 1, 1, 1);
INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('AN', 'ACCOUNTING_HAS_NEW_JOURNAL', 9, 1, 1);
INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('ER', 'ExpenseReportsJournal', 5, 1, 1);
INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('INV', 'InventoryJournal', 8, 1, 1);
-- Accounting Charts / Plans (Templates) for Countries
-- Description of chart of account FR PCG25-DEV

View File

@ -3,7 +3,7 @@
-- Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
-- Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
-- Copyright (C) 2004 Guillaume Delecourt <guillaume.delecourt@opensides.be>
-- Copyright (C) 2005-2024 Regis Houssin <regis.houssin@inodbox.com>
-- Copyright (C) 2005-2025 Regis Houssin <regis.houssin@inodbox.com>
-- Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
-- Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
-- Copyright (C) 2012 Sebastian Neuwert <sebastian.neuwert@modula71.de>
@ -39,383 +39,381 @@
-- Source: https://en.wikipedia.org/wiki/Value-added_tax
--
-- Warning : the rules for rowid (fk_pays+'1') is no longer used (Multicompany compatibility)
-- delete from llx_c_tva;
-- ALGERIA (id country=13)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 131, 13, '0','0','TVA 0%', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 132, 13, '9','0','TVA 9%',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 133, 13, '19','0','TVA 19%', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (13, '0','0','TVA 0%', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (13, '9','0','TVA 9%',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (13, '19','0','TVA 19%', 1,__ENTITY__);
-- ANGOLA (id country=35)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 351, 35, '0','0','VAT rate 0', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 352, 35, '7','0','VAT rate - reduced',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 353, 35, '14','0','VAT rate - standard',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (35, '0','0','VAT rate 0', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (35, '7','0','VAT rate - reduced',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (35, '14','0','VAT rate - standard',1,__ENTITY__);
-- ARGENTINA (id country=23)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (231, 23, '0','0','IVA Rate 0', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (232, 23,'10.5','0','IVA reduced rate',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (233, 23, '21','0','IVA standard rate',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (23, '0','0','IVA Rate 0', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (23,'10.5','0','IVA reduced rate',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (23, '21','0','IVA standard rate',1,__ENTITY__);
-- AUSTRALIA (id country=28)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (281, 28, '0','0','VAT rate 0', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (282, 28, '10','0','VAT rate - standard',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (28, '0','0','VAT rate 0', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (28, '10','0','VAT rate - standard',1,__ENTITY__);
-- AUSTRIA (id country=41)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (411, 41, '0','0','VAT rate 0',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (412, 41, '10','0','VAT rate - reduced', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (413, 41, '20','0','VAT rate - standard',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (41, '0','0','VAT rate 0',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (41, '10','0','VAT rate - reduced', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (41, '20','0','VAT rate - standard',1,__ENTITY__);
-- BRASIL (id country=56)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (561, 56, '0','0','VAT rate - reduced',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (56, '0','0','VAT rate - reduced',1,__ENTITY__);
-- BULGARIA (id country=59)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (591, 59, '0','0','VAT rate 0',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (592, 59, '7','0','VAT rate - reduced', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (593, 59, '20','0','VAT rate - standard',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (59, '0','0','VAT rate 0',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (59, '7','0','VAT rate - reduced', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (59, '20','0','VAT rate - standard',1,__ENTITY__);
-- BELGIUM (id country=2)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 21, 2, '0','0','VAT rate 0 ou non applicable',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 22, 2, '6','0','VAT rate - reduced', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 23, 2, '21','0','VAT rate - standard',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 24, 2, '12','0','VAT rate - reduced', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (2, '0','0','VAT rate 0 ou non applicable',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (2, '6','0','VAT rate - reduced', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (2, '21','0','VAT rate - standard',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (2, '12','0','VAT rate - reduced', 1,__ENTITY__);
-- CANADA (id country=14)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (141, 14, '0','0','VAT rate 0',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (142, 14, '7','0','VAT rate - standard',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,note,active,entity) values (143, 14,'5','0','9.975','1','GST/TPS and PST/TVQ rate for Province',1,__ENTITY__);
-- insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,note,active,entity) values (143, 14,'5','0','9.975','1','GST/TPS and PST/TVQ rate for Quebec',1,__ENTITY__);
-- insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,note,active,entity) values (144, 14,'5','0','7','1','GST/TPS and PST/TVQ rate for British Columbia',1,__ENTITY__);
-- insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,note,active,entity) values (149, 14,'5','0',null,null,'GST/TPS and PST/TVQ rate for Yukon',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (14, '0','0','VAT rate 0',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (14, '7','0','VAT rate - standard',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,localtax1,localtax1_type,note,active,entity) values (14,'5','0','9.975','1','GST/TPS and PST/TVQ rate for Province',1,__ENTITY__);
-- insert into llx_c_tva(fk_pays,taux,recuperableonly,localtax1,localtax1_type,note,active,entity) values (14,'5','0','9.975','1','GST/TPS and PST/TVQ rate for Quebec',1,__ENTITY__);
-- insert into llx_c_tva(fk_pays,taux,recuperableonly,localtax1,localtax1_type,note,active,entity) values (14,'5','0','7','1','GST/TPS and PST/TVQ rate for British Columbia',1,__ENTITY__);
-- insert into llx_c_tva(fk_pays,taux,recuperableonly,localtax1,localtax1_type,note,active,entity) values (14,'5','0',null,null,'GST/TPS and PST/TVQ rate for Yukon',1,__ENTITY__);
-- CAMEROUN (id country=24)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (241, 24, '0','0','VAT rate 0',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (242, 24, '19.25','0','VAT rate - standard',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (24, '0','0','VAT rate 0',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (24, '19.25','0','VAT rate - standard',1,__ENTITY__);
-- CHILE (id country=67)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (671, 67, '0','0','VAT rate 0',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (672, 67, '19','0','VAT rate - standard',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (67, '0','0','VAT rate 0',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (67, '19','0','VAT rate - standard',1,__ENTITY__);
-- CHINA (id country=9)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 91, 9, '0','0','VAT rate 0',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 92, 9, '13','0','VAT rate - reduced 0',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 93, 9, '3','0','VAT rate - super-reduced 0',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 94, 9, '17','0','VAT rate - standard',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (9, '0','0','VAT rate 0',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (9, '13','0','VAT rate - reduced 0',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (9, '3','0','VAT rate - super-reduced 0',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (9, '17','0','VAT rate - standard',1,__ENTITY__);
-- CONGO = REPUBLIQUE DU CONGO (id country=72)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (721, 72, '0','0','VAT rate 0',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,note,active,entity) values (722, 72, '18','0', '0.9', '1', 'VAT rate 18+0.9', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (72, '0','0','VAT rate 0',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,localtax1,localtax1_type,note,active,entity) values (72, '18','0', '0.9', '1', 'VAT rate 18+0.9', 1,__ENTITY__);
-- CROATIA (id country=76)
insert into llx_c_tva(rowid,fk_pays,taux,note,active,entity) values (761, 76, '25','PDV 25%', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,note,active,entity) values (762, 76, '13','PDV 13%', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,note,active,entity) values (763, 76, '5', 'PDV 5%', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,note,active,entity) values (764, 76, '0', 'PDV 0%', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,note,active,entity) values (76, '25','PDV 25%', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,note,active,entity) values (76, '13','PDV 13%', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,note,active,entity) values (76, '5', 'PDV 5%', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,note,active,entity) values (76, '0', 'PDV 0%', 1,__ENTITY__);
-- CYPRUS (id country=78)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (781, 78, '0','0','VAT rate 0',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (782, 78, '9','0','VAT rate 9',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (783, 78, '5','0','VAT rate 5',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (784, 78, '19','0','VAT rate - standard',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (78, '0','0','VAT rate 0',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (78, '9','0','VAT rate 9',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (78, '5','0','VAT rate 5',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (78, '19','0','VAT rate - standard',1,__ENTITY__);
-- DANMERK (id country=80)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (801, 80, '0','0','VAT rate 0',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (802, 80, '25','0','VAT rate - standard',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (80, '0','0','VAT rate 0',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (80, '25','0','VAT rate - standard',1,__ENTITY__);
-- FRANCE (id country=1)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 11, 1, '0','0','VAT rate 0 ou non applicable',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 12, 1, '20','0','VAT rate - standard (France hors DOM-TOM)',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 13, 1, '10','0','VAT rate - reduced',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 14, 1, '5.5','0','VAT rate - reduced (France hors DOM-TOM)',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 15, 1, '2.1','0','VAT rate - super-reduced',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,code,recuperableonly,note,active,entity) values (16, 1, '8.5', '85', '0', 'VAT rate - standard (DOM sauf Guyane et Saint-Martin)',0,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,code,recuperableonly,note,active,entity) values (17, 1, '8.5', '85NPR', '1', 'VAT rate - standard (DOM sauf Guyane et Saint-Martin), non perçu par le vendeur mais récupérable par acheteur',0,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,code,recuperableonly,localtax1,localtax1_type,note,active,entity) values (18, 1, '8.5', '85NPROM', '1', 2, 3, 'VAT rate - standard (DOM sauf Guyane et Saint-Martin), NPR, Octroi de Mer',0,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,code,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active,entity) values (19, 1, '8.5', '85NPROMOMR', '1', 2, 3, 2.5, 3, 'VAT rate - standard (DOM sauf Guyane et Saint-Martin), NPR, Octroi de Mer et Octroi de Mer Regional',0,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (1, '0','0','VAT rate 0 ou non applicable',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (1, '20','0','VAT rate - standard (France hors DOM-TOM)',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (1, '10','0','VAT rate - reduced',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (1, '5.5','0','VAT rate - reduced (France hors DOM-TOM)',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (1, '2.1','0','VAT rate - super-reduced',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,code,recuperableonly,note,active,entity) values (1, '8.5', '85', '0', 'VAT rate - standard (DOM sauf Guyane et Saint-Martin)',0,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,code,recuperableonly,note,active,entity) values (1, '8.5', '85NPR', '1', 'VAT rate - standard (DOM sauf Guyane et Saint-Martin), non perçu par le vendeur mais récupérable par acheteur',0,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,code,recuperableonly,localtax1,localtax1_type,note,active,entity) values (1, '8.5', '85NPROM', '1', 2, 3, 'VAT rate - standard (DOM sauf Guyane et Saint-Martin), NPR, Octroi de Mer',0,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,code,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active,entity) values (1, '8.5', '85NPROMOMR', '1', 2, 3, 2.5, 3, 'VAT rate - standard (DOM sauf Guyane et Saint-Martin), NPR, Octroi de Mer et Octroi de Mer Regional',0,__ENTITY__);
-- GABON (id country=16)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (161, 16, '0','0','VAT rate 0',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (162, 16, 'TPS95', 10, 0, '0', 0, '0', 0, 'VAT 9.5', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (163, 16, 'TPS95C', 10, 1, '1', 0, '0', 0, 'VAT 9.5+CSS', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (164, 16, 'TPS10', 10, 0, '0', 0, '0', 0, 'VAT 10', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (165, 16, 'TPS10C', 10, 1, '1', 0, '0', 0, 'VAT 10+CSS', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (166, 16, 'TPS18', 18, 0, '0', 0, '0', 0, 'VAT 18', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (167, 16, 'TPS18C', 18, 1, '1', 0, '0', 0, 'VAT 18+CSS', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values ( 16, '0','0','VAT rate 0',1,__ENTITY__);
insert into llx_c_tva(fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (16, 'TPS95', 10, 0, '0', 0, '0', 0, 'VAT 9.5', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (16, 'TPS95C', 10, 1, '1', 0, '0', 0, 'VAT 9.5+CSS', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (16, 'TPS10', 10, 0, '0', 0, '0', 0, 'VAT 10', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (16, 'TPS10C', 10, 1, '1', 0, '0', 0, 'VAT 10+CSS', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (16, 'TPS18', 18, 0, '0', 0, '0', 0, 'VAT 18', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (16, 'TPS18C', 18, 1, '1', 0, '0', 0, 'VAT 18+CSS', 1,__ENTITY__);
-- GERMANY (id country=5)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 51, 5, '0','0','No VAT', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 52, 5, '7.0','0','ermäßigte USt.', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 54, 5, '5.5','0','USt. Forst', 0,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 55, 5, '10.7','0','USt. Landwirtschaft', 0,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 56, 5, '19.0','0','allgemeine Ust.',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (5, '0','0','No VAT', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (5, '7.0','0','ermäßigte USt.', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (5, '5.5','0','USt. Forst', 0,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (5, '10.7','0','USt. Landwirtschaft', 0,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (5, '19.0','0','allgemeine Ust.',1,__ENTITY__);
-- GREECE (id country=102)
insert into llx_c_tva(rowid,fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (1021, 102, 0, 0, '0', 0, '0', 0, 'Μηδενικό Φ.Π.Α.', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (1022, 102, 24, 0, '0', 0, '0', 0, 'Κανονικός Φ.Π.Α.', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (1023, 102, 13, 0, '0', 0, '0', 0, 'Μειωμένος Φ.Π.Α.', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (1024, 102, 6, 0, '0', 0, '0', 0, 'Υπερμειωμένος Φ.Π.Α.', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (1025, 102, 3, 0, '0', 0, '0', 0, 'Νήσων υπερμειωμένος Φ.Π.Α.', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (1026, 102, 9, 0, '0', 0, '0', 0, 'Νήσων μειωμένος Φ.Π.Α.', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (1027, 102, 4, 0, '0', 0, '0', 0, 'Νήσων υπερμειωμένος Φ.Π.Α.', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (1028, 102, 17, 0, '0', 0, '0', 0, 'Νήσων υπερμειωμένος Φ.Π.Α.', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (102, 0, 0, '0', 0, '0', 0, 'Μηδενικό Φ.Π.Α.', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (102, 24, 0, '0', 0, '0', 0, 'Κανονικός Φ.Π.Α.', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (102, 13, 0, '0', 0, '0', 0, 'Μειωμένος Φ.Π.Α.', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (102, 6, 0, '0', 0, '0', 0, 'Υπερμειωμένος Φ.Π.Α.', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (102, 3, 0, '0', 0, '0', 0, 'Νήσων υπερμειωμένος Φ.Π.Α.', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (102, 9, 0, '0', 0, '0', 0, 'Νήσων μειωμένος Φ.Π.Α.', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (102, 4, 0, '0', 0, '0', 0, 'Νήσων υπερμειωμένος Φ.Π.Α.', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (102, 17, 0, '0', 0, '0', 0, 'Νήσων υπερμειωμένος Φ.Π.Α.', 1,__ENTITY__);
-- ICELAND (id country=116)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1161, 116, '0','0','VAT rate 0',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1163, 116,'25.5','0','VAT rate - standard',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1162, 116, '7','0','VAT rate - reduced',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (116, '0','0','VAT rate 0',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (116,'25.5','0','VAT rate - standard',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (116, '7','0','VAT rate - reduced',1,__ENTITY__);
-- INDIA (id country=117)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1171, 117, '0','0','VAT rate 0', 0,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (117, '0','0','VAT rate 0', 0,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (1172, 117, 'C+S-5' , 0, 2.5, '1', 2.5, '1', 0, 'CGST+SGST - Same state sales', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (1173, 117, 'I-5' , 5, 0, '0', 0, '0', 0, 'IGST', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (1174, 117, 'C+S-12', 0, 6, '1', 6, '1', 0, 'CGST+SGST - Same state sales', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (1175, 117, 'I-12' , 12, 0, '0', 0, '0', 0, 'IGST', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (1176, 117, 'C+S-18', 0, 9, '1', 9, '1', 0, 'CGST+SGST - Same state sales', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (1177, 117, 'I-18' , 18, 0, '0', 0, '0', 0, 'IGST', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (1178, 117, 'C+S-28', 0, 14, '1', 14, '1', 0, 'CGST+SGST - Same state sales', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (1179, 117, 'I-28' , 28, 0, '0', 0, '0', 0, 'IGST', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (117, 'C+S-5' , 0, 2.5, '1', 2.5, '1', 0, 'CGST+SGST - Same state sales', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (117, 'I-5' , 5, 0, '0', 0, '0', 0, 'IGST', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (117, 'C+S-12', 0, 6, '1', 6, '1', 0, 'CGST+SGST - Same state sales', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (117, 'I-12' , 12, 0, '0', 0, '0', 0, 'IGST', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (117, 'C+S-18', 0, 9, '1', 9, '1', 0, 'CGST+SGST - Same state sales', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (117, 'I-18' , 18, 0, '0', 0, '0', 0, 'IGST', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (117, 'C+S-28', 0, 14, '1', 14, '1', 0, 'CGST+SGST - Same state sales', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (117, 'I-28' , 28, 0, '0', 0, '0', 0, 'IGST', 1,__ENTITY__);
-- IRELAND (id country=8)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 81, 8, '0','0','VAT rate 0',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 82, 8, '23','0','VAT rate - standard',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 83, 8, '13.5','0','VAT rate - reduced',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 84, 8, '9','0','VAT rate - reduced',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 85, 8, '4.8','0','VAT rate - reduced',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (8, '0','0','VAT rate 0',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (8, '23','0','VAT rate - standard',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (8, '13.5','0','VAT rate - reduced',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (8, '9','0','VAT rate - reduced',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (8, '4.8','0','VAT rate - reduced',1,__ENTITY__);
-- ITALY (id country=3)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 31, 3, '0','0','VAT rate 0',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 32, 3, '10','0','VAT rate - reduced',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 33, 3, '4','0','VAT rate - super-reduced',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 34, 3, '22','0','VAT rate - standard',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (3, '0','0','VAT rate 0',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (3, '10','0','VAT rate - reduced',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (3, '4','0','VAT rate - super-reduced',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (3, '22','0','VAT rate - standard',1,__ENTITY__);
-- IVORY COST (id country=21)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active,entity) values (211, 21, '0','0',0,0,0,0,'IVA Rate 0',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active,entity) values (212, 21, '18','0',7.5,2,0,0,'IVA standard rate',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active,entity) values (21, '0','0',0,0,0,0,'IVA Rate 0',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active,entity) values (21, '18','0',7.5,2,0,0,'IVA standard rate',1,__ENTITY__);
-- JAPAN (id country=123)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1231, 123, '0','0','VAT rate 0',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1232, 123, '5','0','VAT rate 5',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (123, '0','0','VAT rate 0',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (123, '5','0','VAT rate 5',1,__ENTITY__);
-- LUXEMBOURG (id country=140)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1401, 140, '0','0','VAT rate 0', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1402, 140, '14','0','VAT rate - intermediary',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1403, 140, '8','0','VAT rate - reduced', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1404, 140, '3','0','VAT rate - super-reduced', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1405, 140, '16','0','VAT rate - standard',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (140, '0','0','VAT rate 0', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (140, '14','0','VAT rate - intermediary',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (140, '8','0','VAT rate - reduced', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (140, '3','0','VAT rate - super-reduced', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (140, '16','0','VAT rate - standard',1,__ENTITY__);
-- MALI (id country=147)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1471, 147, '0','0','VAT rate 0', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1472, 147, '18','0','VAT rate - standard', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (147, '0','0','VAT rate 0', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (147, '18','0','VAT rate - standard', 1,__ENTITY__);
-- MONACO (id country=27)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 271, 27, '0','0','VAT rate 0 ou non applicable',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 272, 27, '8.5','0','VAT rate - standard (DOM sauf Guyane et Saint-Martin)',0,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 273, 27, '8.5','1','VAT rate - standard (DOM sauf Guyane et Saint-Martin), non perçu par le vendeur mais récupérable par acheteur',0,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 274, 27, '5.5','0','VAT rate - reduced (France hors DOM-TOM)',0,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 275, 27,'19.6','0','VAT rate - standard (France hors DOM-TOM)',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 276, 27, '2.1','0','VAT rate - super-reduced',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 277, 27, '7','0','VAT rate - reduced',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (27, '0','0','VAT rate 0 ou non applicable',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (27, '8.5','0','VAT rate - standard (DOM sauf Guyane et Saint-Martin)',0,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (27, '8.5','1','VAT rate - standard (DOM sauf Guyane et Saint-Martin), non perçu par le vendeur mais récupérable par acheteur',0,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (27, '5.5','0','VAT rate - reduced (France hors DOM-TOM)',0,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (27,'19.6','0','VAT rate - standard (France hors DOM-TOM)',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (27, '2.1','0','VAT rate - super-reduced',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (27, '7','0','VAT rate - reduced',1,__ENTITY__);
-- MAROCO (id country=12)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 121, 12, '0','0','VAT rate 0', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 122, 12, '14','0','VAT rate - reduced',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 123, 12, '10','0','VAT rate - reduced',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 124, 12, '7','0','VAT rate - super-reduced', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 125, 12, '20','0','VAT rate - standard',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (12, '0','0','VAT rate 0', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (12, '14','0','VAT rate - reduced',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (12, '10','0','VAT rate - reduced',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (12, '7','0','VAT rate - super-reduced', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (12, '20','0','VAT rate - standard',1,__ENTITY__);
-- MALTA (id country=148)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1481, 148, '0','0','VAT rate 0', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1482, 148, '7','0','VAT rate - reduced',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1483, 148, '5','0','VAT rate - super-reduced', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1484, 148, '18','0','VAT rate - standard',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (148, '0','0','VAT rate 0', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (148, '7','0','VAT rate - reduced',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (148, '5','0','VAT rate - super-reduced', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (148, '18','0','VAT rate - standard',1,__ENTITY__);
-- NEDERLAND (id country=17)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 171, 17, '0','0','0 BTW tarief', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 172, 17, '6','0','Verlaagd BTW tarief', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 173, 17, '19','0','Algemeen BTW tarief',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 174, 17, '21','0','Algemeen BTW tarief (vanaf 1 oktober 2012)',0,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (17, '0','0','0 BTW tarief', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (17, '6','0','Verlaagd BTW tarief', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (17, '19','0','Algemeen BTW tarief',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (17, '21','0','Algemeen BTW tarief (vanaf 1 oktober 2012)',0,__ENTITY__);
-- NEW CALEDONIA (id country=165)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1651, 165, '0','0','VAT rate 0', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1652, 165, '3','0','VAT standard 3', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1653, 165, '6','0','VAT standard 6', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1654, 165, '11','0','VAT rate - standard', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1655, 165, '22','0','VAT standard high', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (165, '0','0','VAT rate 0', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (165, '3','0','VAT standard 3', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (165, '6','0','VAT standard 6', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (165, '11','0','VAT rate - standard', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (165, '22','0','VAT standard high', 1,__ENTITY__);
-- NEW ZEALAND (id country=166)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1661, 166, '0','0','VAT rate 0', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1662, 166, '15','0','VAT rate - standard', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (166, '0','0','VAT rate 0', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (166, '15','0','VAT rate - standard', 1,__ENTITY__);
-- NIGERIA (id country=169)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1691, 169, '0','0','VAT rate 0', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1692, 169, '5','0','VAT rate - standard', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (169, '0','0','VAT rate 0', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (169, '5','0','VAT rate - standard', 1,__ENTITY__);
-- NORWAY (id country=173)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1731, 173, '0','0','VAT rate 0', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1732, 173, '14','0','VAT rate - reduced', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1733, 173, '8','0','VAT rate - reduced', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1734, 173, '25','0','VAT rate - standard', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (173, '0','0','VAT rate 0', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (173, '14','0','VAT rate - reduced', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (173, '8','0','VAT rate - reduced', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (173, '25','0','VAT rate - standard', 1,__ENTITY__);
-- PANAMA (id country=178)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1781, 178, '0','0','ITBMS Rate 0',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1782, 178, '7','0','ITBMS standard rate',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (178, '0','0','ITBMS Rate 0',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (178, '7','0','ITBMS standard rate',1,__ENTITY__);
-- PERU (id country=181)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1811, 181, '0','0','VAT rate 0',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1818, 181, '18','0','VAT rate - standard',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (181, '0','0','VAT rate 0',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (181, '18','0','VAT rate - standard',1,__ENTITY__);
-- POLAND (id country=184)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1841, 184, '0','0','VAT rate 0', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1842, 184, '8','0','VAT rate - reduced',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1843, 184, '3','0','VAT rate - reduced',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1844, 184, '23','0','VAT rate - standard',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (184, '0','0','VAT rate 0', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (184, '8','0','VAT rate - reduced',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (184, '3','0','VAT rate - reduced',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (184, '23','0','VAT rate - standard',1,__ENTITY__);
-- PORTUGAL (id country=25)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 251, 25, '0','0','VAT rate 0', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 252, 25, '13','0','VAT rate - reduced',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 253, 25, '23','0','VAT rate - standard',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 254, 25, '6','0','VAT rate - reduced',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (25, '0','0','VAT rate 0', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (25, '13','0','VAT rate - reduced',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (25, '23','0','VAT rate - standard',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (25, '6','0','VAT rate - reduced',1,__ENTITY__);
-- ROMANIA (id country=188)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1881, 188, '0','0','VAT rate 0', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1882, 188, '9','0','VAT rate - reduced',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1883, 188, '19','0','VAT rate - standard',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1884, 188, '5','0','VAT rate - reduced',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (188, '0','0','VAT rate 0', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (188, '9','0','VAT rate - reduced',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (188, '19','0','VAT rate - standard',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (188, '5','0','VAT rate - reduced',1,__ENTITY__);
-- SAUDI ARABIA (id country=26)
INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) VALUES ( 261, 26, '0', '0', 'VAT rate 0', 1,__ENTITY__);
INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) VALUES ( 262, 26, '5', '0', 'VAT rate 5', 1,__ENTITY__);
INSERT INTO llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) VALUES (26, '0', '0', 'VAT rate 0', 1,__ENTITY__);
INSERT INTO llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) VALUES (26, '5', '0', 'VAT rate 5', 1,__ENTITY__);
-- SAN SALVADOR (id country=86)
INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) VALUES ( 861, 86, '0', '0', 'SIN IVA', 1,__ENTITY__);
INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) VALUES ( 862, 86, '13', '0', 'IVA 13', 1,__ENTITY__);
INSERT INTO llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) VALUES (86, '0', '0', 'SIN IVA', 1,__ENTITY__);
INSERT INTO llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) VALUES (86, '13', '0', 'IVA 13', 1,__ENTITY__);
-- SENEGAL (id country=22)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 221, 22, '0', '0', 'VAT rate 0', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 222, 22, '10', '0', 'VAT rate - reduced',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 223, 22, '18', '0', 'VAT rate - standard',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (22, '0', '0', 'VAT rate 0', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (22, '10', '0', 'VAT rate - reduced',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (22, '18', '0', 'VAT rate - standard',1,__ENTITY__);
-- SLOVAKIA (id country=201)
INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) VALUES (2011, 201, '0', '0', 'VAT rate 0', 1,__ENTITY__);
INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) VALUES (2012, 201, '10', '0', 'VAT rate - reduced', 1,__ENTITY__);
INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) VALUES (2013, 201, '20', '0', 'VAT rate - standard', 1,__ENTITY__);
INSERT INTO llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) VALUES (201, '0', '0', 'VAT rate 0', 1,__ENTITY__);
INSERT INTO llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) VALUES (201, '10', '0', 'VAT rate - reduced', 1,__ENTITY__);
INSERT INTO llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) VALUES (201, '20', '0', 'VAT rate - standard', 1,__ENTITY__);
-- SLOVENIA (id country=202)
INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) VALUES (2021, 202, '0', '0', 'VAT rate 0', 1,__ENTITY__);
INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) VALUES (2022, 202,'9.5', '0', 'VAT rate - reduced', 1,__ENTITY__);
INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) VALUES (2023, 202, '22', '0', 'VAT rate - standard', 1,__ENTITY__);
INSERT INTO llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) VALUES (202, '0', '0', 'VAT rate 0', 1,__ENTITY__);
INSERT INTO llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) VALUES (202,'9.5', '0', 'VAT rate - reduced', 1,__ENTITY__);
INSERT INTO llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) VALUES (202, '22', '0', 'VAT rate - standard', 1,__ENTITY__);
-- SOUTH AFRICA (id country=205)
INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) VALUES (2051, 205, '0', '0', 'VAT rate 0', 1,__ENTITY__);
INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) VALUES (2052, 205, '15', '0', 'VAT rate - standard', 1,__ENTITY__);
INSERT INTO llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) VALUES (205, '0', '0', 'VAT rate 0', 1,__ENTITY__);
INSERT INTO llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) VALUES (205, '15', '0', 'VAT rate - standard', 1,__ENTITY__);
-- SPAIN (id country=4)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active,entity) values ( 41, 4, '0','0', '0','3','-19:-15:-9','5','VAT rate 0',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active,entity) values ( 42, 4,'10','0','1.4','3','-19:-15:-9','5','VAT rate - reduced',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active,entity) values ( 43, 4, '4','0','0.5','3','-19:-15:-9','5','VAT rate - super-reduced',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active,entity) values ( 44, 4,'21','0','5.2','3','-19:-15:-9','5','VAT rate - standard',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active,entity) values (4, '0','0', '0','3','-19:-15:-9','5','VAT rate 0',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active,entity) values (4,'10','0','1.4','3','-19:-15:-9','5','VAT rate - reduced',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active,entity) values (4, '4','0','0.5','3','-19:-15:-9','5','VAT rate - super-reduced',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active,entity) values (4,'21','0','5.2','3','-19:-15:-9','5','VAT rate - standard',1,__ENTITY__);
-- SWEDEN (id country=20)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 201, 20, '0','0','VAT rate 0', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 202, 20, '12','0','VAT rate - reduced',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 203, 20, '6','0','VAT rate - super-reduced',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 204, 20, '25','0','VAT rate - standard',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (20, '0','0','VAT rate 0', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (20, '12','0','VAT rate - reduced',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (20, '6','0','VAT rate - super-reduced',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (20, '25','0','VAT rate - standard',1,__ENTITY__);
-- SWITZERLAND (id country=6)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 61, 6, '0','0','VAT rate 0', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 62, 6, '3.8','0','VAT rate - reduced',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 63, 6, '2.6','0','VAT rate - super-reduced',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 64, 6, '8.1','0','VAT rate - standard',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (6, '0','0','VAT rate 0', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (6, '3.8','0','VAT rate - reduced',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (6, '2.6','0','VAT rate - super-reduced',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (6, '8.1','0','VAT rate - standard',1,__ENTITY__);
-- SRI LANKA (id country=207)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (2071, 207, '0','0','VAT 0', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (2072, 207, '15','0','VAT 15%', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (207, '0','0','VAT 0', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (207, '15','0','VAT 15%', 1,__ENTITY__);
-- TAIWAN (id country=213)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (2131, 213, '0','0','VAT 0', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (2132, 213, '5','0','VAT 5%',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (213, '0','0','VAT 0', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (213, '5','0','VAT 5%',1,__ENTITY__);
-- TUNISIA (id country=10)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (101,10, '0','0','VAT rate 0',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (102,10, '12','0','VAT 12%',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (103,10, '18','0','VAT 18%',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (104,10, '7.5','0','VAT 6% Majoré à 25% (7.5%)',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (105,10, '15','0','VAT 12% Majoré à 25% (15%)',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (106,10, '22.5','0','VAT 18% Majoré à 25% (22.5%)',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (107,10, '6','0','VAT 6%', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,localtax1,localtax1_type,localtax2,localtax2_type,entity) values (108,10,'18.18','0','VAT 18%+FODEC', 1, 1, '4', 0, 0,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (10, '0','0','VAT rate 0',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (10, '12','0','VAT 12%',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (10, '18','0','VAT 18%',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (10, '7.5','0','VAT 6% Majoré à 25% (7.5%)',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (10, '15','0','VAT 12% Majoré à 25% (15%)',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (10, '22.5','0','VAT 18% Majoré à 25% (22.5%)',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (10, '6','0','VAT 6%', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,localtax1,localtax1_type,localtax2,localtax2_type,entity) values (10,'18.18','0','VAT 18%+FODEC', 1, 1, '4', 0, 0,__ENTITY__);
-- UKRAINE (id country=226)
INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (2261,226, '0','0','VAT rate 0',1,__ENTITY__);
INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (2262,226, '20','0','VAT standart rate',1,__ENTITY__);
INSERT INTO llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (226, '0','0','VAT rate 0',1,__ENTITY__);
INSERT INTO llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (226, '20','0','VAT standart rate',1,__ENTITY__);
-- UNITED OF KINGDOM (id country=7)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 71, 7, '0','0','VAT rate 0', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 72, 7, '17.5','0','VAT rate - standard before 2011',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 73, 7, '5','0','VAT rate - reduced', 1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 74, 7, '20','0','VAT rate - standard',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (7, '0','0','VAT rate 0', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (7, '17.5','0','VAT rate - standard before 2011',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (7, '5','0','VAT rate - reduced', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (7, '20','0','VAT rate - standard',1,__ENTITY__);
-- UNITED STATES (id country=11)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (111,11, '0','0','No Sales Tax',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (112,11, '4','0','Sales Tax 4%',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (113,11, '6','0','Sales Tax 6%',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (11, '0','0','No Sales Tax',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (11, '4','0','Sales Tax 4%',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (11, '6','0','Sales Tax 6%',1,__ENTITY__);
-- Pour les DOM-TOM, il faut utiliser le pays FRANCE (Sinon pb avec regles de TVA et autres regles propres aux pays et europe)
-- SAINT PIERRE ET MIQUELON (id country=19)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1931,193, '0','0','No VAT in SPM',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (193, '0','0','No VAT in SPM',1,__ENTITY__);
-- SAINT MARTIN (id country=24)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (2461,246, '0','0','VAT rate 0',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (246, '0','0','VAT rate 0',1,__ENTITY__);
-- MAURITANIA (id country=151)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1511,151, '0','0','VAT rate 0',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1512,151, '14','0','VAT rate 14',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (151, '0','0','VAT rate 0',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (151, '14','0','VAT rate 14',1,__ENTITY__);
-- MAURITIUS (id country=152)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1521,152, '0','0','VAT rate 0',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1522,152, '15','0','VAT rate 15',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (152, '0','0','VAT rate 0',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (152, '15','0','VAT rate 15',1,__ENTITY__);
-- HONDURAS (id country=114)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1141,114, '0','0','No ISV',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1142,114, '12','0','ISV 12%',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (114, '0','0','No ISV',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (114, '12','0','ISV 12%',1,__ENTITY__);
-- MEXIQUE (id country=154)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1541,154, '0','0','No VAT',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1542,154, '16','0','VAT 16%',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1543,154, '10','0','VAT Frontero',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (154, '0','0','No VAT',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (154, '16','0','VAT 16%',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (154, '10','0','VAT Frontero',1,__ENTITY__);
-- BARBADOS (id country=46)
INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) VALUES ( 461, 46, '0','0','No VAT',1,__ENTITY__);
INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) VALUES ( 462, 46, '15','0','VAT 15%',1,__ENTITY__);
INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) VALUES ( 463, 46, '7.5','0','VAT 7.5%',1,__ENTITY__);
INSERT INTO llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) VALUES (46, '0','0','No VAT',1,__ENTITY__);
INSERT INTO llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) VALUES (46, '15','0','VAT 15%',1,__ENTITY__);
INSERT INTO llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) VALUES (46, '7.5','0','VAT 7.5%',1,__ENTITY__);
-- VENEZUELA (id country=232)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (2321,232, '0','0','No VAT',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (2322,232, '12','0','VAT 12%',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (2323,232, '8','0','VAT 8%',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (232, '0','0','No VAT',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (232, '12','0','VAT 12%',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (232, '8','0','VAT 8%',1,__ENTITY__);
-- VIETNAM (id country=233)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (2331,233, '0','0','Thuế GTGT đươc khấu trừ 0%',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (2332,233, '5','0','Thuế GTGT đươc khấu trừ 5%',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (2333,233, '8','0','Thuế GTGT đươc khấu trừ 8%',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (2334,233, '10','0','Thuế GTGT đươc khấu trừ 10%',1,__ENTITY__);
-- Example of code to insert a VAT rate 0 for each country
-- delete from llx_c_tva where rowid = 1181; -- to delete a record that does not follow rules for rowid (fk_pays+'1')
-- insert into llx_c_tva(rowid, fk_pays, taux, recuperableonly, note, active,entity) SELECT CONCAT(c.rowid, '1'), c.rowid, 0, 0, 'No VAT', 1 from llx_c_country as c where c.rowid not in (select fk_pays from llx_c_tva,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (233, '0','0','Thuế GTGT đươc khấu trừ 0%',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (233, '5','0','Thuế GTGT đươc khấu trừ 5%',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (233, '8','0','Thuế GTGT đươc khấu trừ 8%',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (233, '10','0','Thuế GTGT đươc khấu trừ 10%',1,__ENTITY__);
-- BURUNDI (id country=61) -- https://www.objectif-import-export.fr/fr/marches-internationaux/fiche-pays/burundi/presentation-fiscalite
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (2335,61, '0','0','No VAT',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (2336,61, '10','0','VAT 10%',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (2337,61, '18','0','VAT 18%',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (61, '0','0','No VAT',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (61, '10','0','VAT 10%',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (61, '18','0','VAT 18%',1,__ENTITY__);
-- Turkiye (Turkey) (id country=221)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (22101,221, '0','0','No VAT',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (22102,221, '1','0','VAT 1%',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (22103,221, '8','0','VAT 8%',1,__ENTITY__);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (22104,221, '18','0','VAT 18%',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (221, '0','0','No VAT',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (221, '1','0','VAT 1%',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (221, '8','0','VAT 8%',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (221, '18','0','VAT 18%',1,__ENTITY__);

View File

@ -61,6 +61,11 @@ ALTER TABLE llx_asset_model ADD COLUMN ref_ext varchar(255) AFTER ref;
-- V21 migration
ALTER TABLE llx_product MODIFY COLUMN note_public mediumtext;
ALTER TABLE llx_product MODIFY COLUMN note mediumtext;
ALTER TABLE llx_product_lang MODIFY COLUMN note mediumtext;
CREATE TABLE llx_categorie_fichinter
(
fk_categorie integer NOT NULL,
@ -403,3 +408,7 @@ ALTER TABLE llx_societe_rib DROP INDEX uk_societe_rib;
ALTER TABLE llx_societe_rib ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER rowid;
-- select entity, label, fk_soc, default_rib, MIN(iban_prefix), MAX(iban_prefix), MIN(rowid), MAX(rowid), COUNT(rowid) from llx_societe_rib GROUP BY entity, label, fk_soc, default_rib HAVING COUNT(rowid) > 1;
ALTER TABLE llx_societe_rib ADD UNIQUE INDEX uk_societe_rib(entity, label, fk_soc);
ALTER TABLE llx_societe_account DROP INDEX uk_societe_account_login_website_soc;
ALTER TABLE llx_societe_account ADD UNIQUE INDEX uk_societe_account_login_website(entity, login, site, fk_website);

View File

@ -37,6 +37,9 @@
ALTER TABLE llx_societe_rib MODIFY COLUMN label varchar(180);
ALTER TABLE llx_societe_rib MODIFY COLUMN iban_prefix varchar(100);
ALTER TABLE llx_societe_account DROP INDEX uk_societe_account_login_website_soc;
ALTER TABLE llx_societe_account ADD UNIQUE INDEX uk_societe_account_login_website(entity, login, site, fk_website);
-- V22 migration

View File

@ -22,4 +22,5 @@ ALTER TABLE llx_blockedlog ADD INDEX entity (entity);
ALTER TABLE llx_blockedlog ADD INDEX fk_user (fk_user);
ALTER TABLE llx_blockedlog ADD INDEX entity_action_certified (entity,action,certified);
ALTER TABLE llx_blockedlog ADD INDEX entity_rowid (entity, rowid); -- for the "SELECT rowid, signature FROM llx_blockedlog FORCE INDEX entity_rowid WHERE entity = x AND rowid < z ORDER BY rowid DESC"
-- We add this index for the "SELECT rowid, signature FROM llx_blockedlog FORCE INDEX entity_rowid WHERE entity = x AND rowid < z ORDER BY rowid DESC"
ALTER TABLE llx_blockedlog ADD INDEX entity_rowid (entity, rowid);

View File

@ -36,8 +36,8 @@ create table llx_product
label varchar(255) NOT NULL,
description text,
note_public text,
note text,
note_public mediumtext,
note mediumtext,
customcode varchar(32), -- Customs|Commodity|HS|TARIC code see https://github.com/Dolibarr/dolibarr/issues/31679
fk_country integer DEFAULT NULL, -- Optional id of original country
fk_state integer DEFAULT NULL, -- Optional id of original state/province

View File

@ -25,6 +25,6 @@ create table llx_product_lang
lang varchar(5) DEFAULT 0 NOT NULL,
label varchar(255) NOT NULL,
description text,
note text,
note mediumtext,
import_key varchar(14) DEFAULT NULL
)ENGINE=innodb;

View File

@ -22,11 +22,13 @@ ALTER TABLE llx_societe_account ADD INDEX idx_societe_account_fk_website (fk_web
ALTER TABLE llx_societe_account ADD INDEX idx_societe_account_fk_soc (fk_soc);
-- END MODULEBUILDER INDEXES
ALTER TABLE llx_societe_account ADD UNIQUE INDEX uk_societe_account_login_website_soc(entity, fk_soc, login, site, fk_website);
-- Only one unique login in the same website (note: we can still have the same login in database for 2 different companies if fk_website is null)
ALTER TABLE llx_societe_account ADD UNIQUE INDEX uk_societe_account_login_website(entity, login, site, fk_website);
-- Only one unique login in the same external account in the same company
ALTER TABLE llx_societe_account ADD UNIQUE INDEX uk_societe_account_key_account_soc(entity, fk_soc, key_account, site, fk_website);
-- Table website does not always exists
--ALTER TABLE llx_societe_account ADD CONSTRAINT llx_societe_account_fk_website FOREIGN KEY (fk_website) REFERENCES llx_website(rowid);
ALTER TABLE llx_societe_account ADD CONSTRAINT llx_societe_account_fk_societe FOREIGN KEY (fk_soc) REFERENCES llx_societe(rowid);

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