From f166f15f7d8dfd15ae2e53fec92935e4b815c6ab Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 4 Mar 2024 18:21:32 +0100 Subject: [PATCH 001/709] Qual: Backport/pre commit / log annotation simplification (#28614) * Qual: ci: Run pre-commit/php-cs with cache (#28079) This adds a hook to .pre-commit-config.yaml and updates the workflow to run php-cs with cache when it is run for all files. When running on changed files only, the cache is not useful. The php-codesniffer ruleset.xml was cleaned up (duplicates removal/formatted) * Fix: Make all 'relative paths' absolute (#28196) # Fix: Make all 'relative paths' absolute The phpcs ruleset xml file's relative exclude patterns are relative to the filename(s) provided on the command line. Hence with partial verifications, the path exclusion does not function as we would like. Removing the relative-path attribute from the patterns the exclusion works. At the same time, the patterns were optimized and a comment was added. * Qual: Optimize workflow (#28386) # Qual: Optimize workflow The log annotation based on the pre-commit logs is now simplified. --- .github/logToCs.py | 588 ------------------------------- .github/workflows/pre-commit.yml | 18 +- 2 files changed, 5 insertions(+), 601 deletions(-) delete mode 100755 .github/logToCs.py diff --git a/.github/logToCs.py b/.github/logToCs.py deleted file mode 100755 index 7befd310a0a..00000000000 --- a/.github/logToCs.py +++ /dev/null @@ -1,588 +0,0 @@ -#!/usr/bin/env python3 -# pylint: disable=invalid-name -""" -Convert a log to CheckStyle format. - -Url: https://github.com/mdeweerd/LogToCheckStyle - -The log can then be used for generating annotations in a github action. - -Note: this script is very young and "quick and dirty". - Patterns can be added to "PATTERNS" to match more messages. - -# Examples - -Assumes that logToCs.py is available as .github/logToCs.py. - -## Example 1: - - -```yaml - - run: | - pre-commit run -all-files | tee pre-commit.log - .github/logToCs.py pre-commit.log pre-commit.xml - - uses: staabm/annotate-pull-request-from-checkstyle-action@v1 - with: - files: pre-commit.xml - notices-as-warnings: true # optional -``` - -## Example 2: - - -```yaml - - run: | - pre-commit run --all-files | tee pre-commit.log - - name: Add results to PR - if: ${{ always() }} - run: | - .github/logToCs.py pre-commit.log | cs2pr -``` - -Author(s): - - https://github.com/mdeweerd - -License: MIT License - -""" - -import argparse -import datetime as dt -import json -import os -import re -import sys -import xml.etree.ElementTree as ET # nosec - - -def remove_prefix(string, prefix): - """ - Remove prefix from string - - Provided for backward compatibility. - """ - if prefix and string.startswith(prefix): - return string[len(prefix) :] - return string - - -def convert_notices_to_checkstyle(notices, root_path=None): - """ - Convert annotation list to CheckStyle xml string - """ - root = ET.Element("checkstyle") - for fields in notices: - add_error_entry(root, **fields, root_path=root_path) - return ET.tostring(root, encoding="utf_8").decode("utf_8") - - -def convert_lines_to_notices(lines): - """ - Convert provided message to CheckStyle format. - """ - notices = [] - for line in lines: - fields = parse_message(line) - if fields: - notices.append(fields) - return notices - - -def convert_text_to_notices(text): - """ - Convert provided message to CheckStyle format. - """ - return parse_file(text) - - -# Initial version for Checkrun from: -# https://github.com/tayfun/flake8-your-pr/blob/50a175cde4dd26a656734c5b64ba1e5bb27151cb/src/main.py#L7C1-L123C36 -# MIT Licence -class CheckRun: - """ - Represents the check run - """ - - GITHUB_TOKEN = os.environ.get("GITHUB_TOKEN", None) - GITHUB_EVENT_PATH = os.environ.get("GITHUB_EVENT_PATH", None) - - URI = "https://api.github.com" - API_VERSION = "2022-11-28" - ACCEPT_HEADER_VALUE = "application/vnd.github+json" - AUTH_HEADER_VALUE = f"Bearer {GITHUB_TOKEN}" - # This is the max annotations Github API accepts in one go. - MAX_ANNOTATIONS = 50 - - def __init__(self): - """ - Initialise Check Run object with information from checkrun - """ - self.read_event_file() - self.read_meta_data() - - def read_event_file(self): - """ - Read the event file to get the event information later. - """ - if self.GITHUB_EVENT_PATH is None: - raise ValueError("Not running in github workflow") - with open(self.GITHUB_EVENT_PATH, encoding="utf_8") as event_file: - self.event = json.loads(event_file.read()) - - def read_meta_data(self): - """ - Get meta data from event information - """ - self.repo_full_name = self.event["repository"]["full_name"] - pull_request = self.event.get("pull_request") - print("%r", self.event) - if pull_request: - self.head_sha = pull_request["head"]["sha"] - else: - print("%r", self.event) - check_suite = self.event.get("check_suite", None) - if check_suite is not None: - self.head_sha = check_suite["pull_requests"][0]["base"]["sha"] - else: - self.head_sha = None # Can't annotate? - - def submit( # pylint: disable=too-many-arguments - self, - notices, - title=None, - summary=None, - text=None, - conclusion=None, - ): - """ - Submit annotations to github - - See: - https://docs.github.com/en/rest/checks/runs?apiVersion=2022-11-28 - #update-a-check-run - - :param conclusion: success, failure - """ - # pylint: disable=import-outside-toplevel - import requests # Import here to not impose presence of module - - if self.head_sha is None: - return - - output = { - "annotations": notices[: CheckRun.MAX_ANNOTATIONS], - } - if title is not None: - output["title"] = title - if summary is not None: - output["summary"] = summary - if text is not None: - output["text"] = text - if conclusion is None: - # action_required, cancelled, failure, neutral, success - # skipped, stale, timed_out - if bool(notices): - conclusion = "failure" - else: - conclusion = "success" - - payload = { - "name": "log-to-pr-annotation", - "head_sha": self.head_sha, - "status": "completed", # queued, in_progress, completed - "conclusion": conclusion, - # "started_at": dt.datetime.now(dt.timezone.utc).isoformat(), - "completed_at": dt.datetime.now(dt.timezone.utc).isoformat(), - "output": output, - } - - # Create the check-run - response = requests.post( - f"{self.URI}/repos/{self.repo_full_name}/check-runs", - headers={ - "Accept": self.ACCEPT_HEADER_VALUE, - "Authorization": self.AUTH_HEADER_VALUE, - "X-GitHub-Api-Version": self.API_VERSION, - }, - json=payload, - timeout=30, - ) - print(response.content) - response.raise_for_status() - - -ANY_REGEX = r".*?" -FILE_REGEX = r"\s*(?P\S.*?)\s*?" -FILEGROUP_REGEX = r"\s*(?P\S.*?)\s*?" -EOL_REGEX = r"[\r\n]" -LINE_REGEX = r"\s*(?P\d+?)\s*?" -COLUMN_REGEX = r"\s*(?P\d+?)\s*?" -SEVERITY_REGEX = r"\s*(?Perror|warning|notice|style|info)\s*?" -MSG_REGEX = r"\s*(?P.+?)\s*?" -MULTILINE_MSG_REGEX = r"\s*(?P(?:.|.[\r\n])+)" -# cpplint confidence index -CONFIDENCE_REGEX = r"\s*\[(?P\d+)\]\s*?" - - -# List of message patterns, add more specific patterns earlier in the list -# Creating patterns by using constants makes them easier to define and read. -PATTERNS = [ - # beautysh - # File ftp.sh: error: "esac" before "case" in line 90. - re.compile( - f"^File {FILE_REGEX}:{SEVERITY_REGEX}:" - f" {MSG_REGEX} in line {LINE_REGEX}.$" - ), - # beautysh - # File socks4echo.sh: error: indent/outdent mismatch: -2. - re.compile(f"^File {FILE_REGEX}:{SEVERITY_REGEX}: {MSG_REGEX}$"), - # yamllint - # ##[group].pre-commit-config.yaml - # ##[error]97:14 [trailing-spaces] trailing spaces - # ##[endgroup] - re.compile(rf"^##\[group\]{FILEGROUP_REGEX}$"), # Start file group - re.compile( - rf"^##\[{SEVERITY_REGEX}\]{LINE_REGEX}:{COLUMN_REGEX}{MSG_REGEX}$" - ), # Msg - re.compile(r"^##(?P\[endgroup\])$"), # End file group - # File socks4echo.sh: error: indent/outdent mismatch: -2. - re.compile(f"^File {FILE_REGEX}:{SEVERITY_REGEX}: {MSG_REGEX}$"), - # Emacs style - # path/to/file:845:5: error - Expected 1 space after closing brace - re.compile( - rf"^{FILE_REGEX}:{LINE_REGEX}:{COLUMN_REGEX}:{SEVERITY_REGEX}" - rf"-?\s{MSG_REGEX}$" - ), - # ESLint (JavaScript Linter), RoboCop, shellcheck - # path/to/file.js:10:2: Some linting issue - # path/to/file.rb:10:5: Style/Indentation: Incorrect indentation detected - # path/to/script.sh:10:1: SC2034: Some shell script issue - re.compile(f"^{FILE_REGEX}:{LINE_REGEX}:{COLUMN_REGEX}: {MSG_REGEX}$"), - # Cpplint default output: - # '%s:%s: %s [%s] [%d]\n' - # % (filename, linenum, message, category, confidence) - re.compile(f"^{FILE_REGEX}:{LINE_REGEX}:{MSG_REGEX}{CONFIDENCE_REGEX}$"), - # MSVC - # file.cpp(10): error C1234: Some error message - re.compile( - f"^{FILE_REGEX}\\({LINE_REGEX}\\):{SEVERITY_REGEX}{MSG_REGEX}$" - ), - # Java compiler - # File.java:10: error: Some error message - re.compile(f"^{FILE_REGEX}:{LINE_REGEX}:{SEVERITY_REGEX}:{MSG_REGEX}$"), - # Python - # File ".../logToCs.py", line 90 (note: code line follows) - re.compile(f'^File "{FILE_REGEX}", line {LINE_REGEX}$'), - # Pylint, others - # path/to/file.py:10: [C0111] Missing docstring - # others - re.compile(f"^{FILE_REGEX}:{LINE_REGEX}: {MSG_REGEX}$"), - # Shellcheck: - # In script.sh line 76: - re.compile( - f"^In {FILE_REGEX} line {LINE_REGEX}:{EOL_REGEX}?" - f"({MULTILINE_MSG_REGEX})?{EOL_REGEX}{EOL_REGEX}" - ), - # eslint: - # /path/to/filename - # 14:5 error Unexpected trailing comma comma-dangle - re.compile( - f"^{FILE_REGEX}{EOL_REGEX}" - rf"\s+{LINE_REGEX}:{COLUMN_REGEX}\s+{SEVERITY_REGEX}\s+{MSG_REGEX}$" - ), -] - -# Exceptionnaly some regexes match messages that are not error. -# This pattern matches those exceptions -EXCLUDE_MSG_PATTERN = re.compile( - r"^(" - r"Placeholder pattern" # To remove on first message pattern - r")" -) - -# Exceptionnaly some regexes match messages that are not error. -# This pattern matches those exceptions -EXCLUDE_FILE_PATTERN = re.compile( - r"^(" - # Codespell: (appears as a file name): - r"Used config files\b" - r")" -) - -# Severities available in CodeSniffer report format -SEVERITY_NOTICE = "notice" -SEVERITY_WARNING = "warning" -SEVERITY_ERROR = "error" - - -def strip_ansi(text: str): - """ - Strip ANSI escape sequences from string (colors, etc) - """ - return re.sub(r"\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])", "", text) - - -def parse_file(text): - """ - Parse all messages in a file - - Returns the fields in a dict. - """ - # pylint: disable=too-many-branches,too-many-statements - # regex required to allow same group names - try: - import regex # pylint: disable=import-outside-toplevel - except ImportError as exc: - raise ImportError( - "The 'parsefile' method requires 'python -m pip install regex'" - ) from exc - - patterns = [pattern.pattern for pattern in PATTERNS] - # patterns = [PATTERNS[0].pattern] - - file_group = None # The file name for the group (if any) - full_regex = "(?:(?:" + (")|(?:".join(patterns)) + "))" - results = [] - - for fields in regex.finditer( - full_regex, strip_ansi(text), regex.MULTILINE | regex.IGNORECASE - ): - if not fields: - continue - result = fields.groupdict() - - if len(result) == 0: - continue - - severity = result.get("severity", None) - file_name = result.get("file_name", None) - confidence = result.pop("confidence", None) - new_file_group = result.pop("file_group", None) - file_endgroup = result.pop("file_endgroup", None) - message = result.get("message", None) - - if new_file_group is not None: - # Start of file_group, just store file - file_group = new_file_group - continue - - if file_endgroup is not None: - file_group = None - continue - - if file_name is None: - if file_group is not None: - file_name = file_group - result["file_name"] = file_name - else: - # No filename, skip - continue - else: - if EXCLUDE_FILE_PATTERN.search(file_name): - # This file_name is excluded - continue - - if message is not None: - if EXCLUDE_MSG_PATTERN.search(message): - # This message is excluded - continue - - if confidence is not None: - # Convert confidence level of cpplint - # to warning, etc. - confidence = int(confidence) - - if confidence <= 1: - severity = SEVERITY_NOTICE - elif confidence >= 5: - severity = SEVERITY_ERROR - else: - severity = SEVERITY_WARNING - - if severity is None: - severity = SEVERITY_ERROR - else: - severity = severity.lower() - - if severity in ["info", "style"]: - severity = SEVERITY_NOTICE - - result["severity"] = severity - - results.append(result) - - return results - - -def parse_message(message): - """ - Parse message until it matches a pattern. - - Returns the fields in a dict. - """ - for pattern in PATTERNS: - fields = pattern.match(message, re.IGNORECASE) - if not fields: - continue - result = fields.groupdict() - if len(result) == 0: - continue - - if "confidence" in result: - # Convert confidence level of cpplint - # to warning, etc. - confidence = int(result["confidence"]) - del result["confidence"] - - if confidence <= 1: - severity = SEVERITY_NOTICE - elif confidence >= 5: - severity = SEVERITY_ERROR - else: - severity = SEVERITY_WARNING - result["severity"] = severity - - if "severity" not in result: - result["severity"] = SEVERITY_ERROR - else: - result["severity"] = result["severity"].lower() - - if result["severity"] in ["info", "style"]: - result["severity"] = SEVERITY_NOTICE - - return result - - # Nothing matched - return None - - -def add_error_entry( # pylint: disable=too-many-arguments - root, - severity, - file_name, - line=None, - column=None, - message=None, - source=None, - root_path=None, -): - """ - Add error information to the CheckStyle output being created. - """ - file_element = find_or_create_file_element( - root, file_name, root_path=root_path - ) - error_element = ET.SubElement(file_element, "error") - error_element.set("severity", severity) - if line: - error_element.set("line", line) - if column: - error_element.set("column", column) - if message: - error_element.set("message", message) - if source: - # To verify if this is a valid attribute - error_element.set("source", source) - - -def find_or_create_file_element(root, file_name: str, root_path=None): - """ - Find/create file element in XML document tree. - """ - - if root_path is not None: - file_name = remove_prefix(file_name, root_path) - for file_element in root.findall("file"): - if file_element.get("name") == file_name: - return file_element - file_element = ET.SubElement(root, "file") - file_element.set("name", file_name) - return file_element - - -def main(): - """ - Parse the script arguments and get the conversion done. - """ - parser = argparse.ArgumentParser( - description="Convert messages to Checkstyle XML format." - ) - parser.add_argument( - "input", help="Input file. Use '-' for stdin.", nargs="?", default="-" - ) - parser.add_argument( - "output", - help="Output file. Use '-' for stdout.", - nargs="?", - default="-", - ) - parser.add_argument( - "-i", - "--in", - dest="input_named", - help="Input filename. Overrides positional input.", - ) - parser.add_argument( - "-o", - "--out", - dest="output_named", - help="Output filename. Overrides positional output.", - ) - parser.add_argument( - "--root", - metavar="ROOT_PATH", - help="Root directory to remove from file paths." - " Defaults to working directory.", - default=os.getcwd(), - ) - parser.add_argument( - "--github-annotate", - action=argparse.BooleanOptionalAction, - help="Annotate when in Github workflow.", - # Currently disabled, - # Future: (os.environ.get("GITHUB_EVENT_PATH", None) is not None), - default=False, - ) - - args = parser.parse_args() - - if args.input == "-" and args.input_named: - with open( - args.input_named, encoding="utf_8", errors="surrogateescape" - ) as input_file: - text = input_file.read() - elif args.input != "-": - with open( - args.input, encoding="utf_8", errors="surrogateescape" - ) as input_file: - text = input_file.read() - else: - text = sys.stdin.read() - - root_path = os.path.join(args.root, "") - - try: - notices = convert_text_to_notices(text) - except ImportError: - notices = convert_lines_to_notices(re.split(r"[\r\n]+", text)) - - checkstyle_xml = convert_notices_to_checkstyle( - notices, root_path=root_path - ) - - if args.output == "-" and args.output_named: - with open(args.output_named, "w", encoding="utf_8") as output_file: - output_file.write(checkstyle_xml) - elif args.output != "-": - with open(args.output, "w", encoding="utf_8") as output_file: - output_file.write(checkstyle_xml) - else: - print(checkstyle_xml) - - if args.github_annotate: - checkrun = CheckRun() - checkrun.submit(notices) - - -if __name__ == "__main__": - main() diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index d0cdcb90ef3..1ae4d3387f8 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -7,7 +7,6 @@ jobs: pre-commit: runs-on: ubuntu-latest env: - LOG_TO_CS: .github/logToCs.py RAW_LOG: pre-commit.log CS_XML: pre-commit.xml steps: @@ -37,7 +36,7 @@ jobs: with: cache: pip python-version: "3.11" - - run: python -m pip install pre-commit regex + - run: python -m pip install pre-commit # Restore previous cache of precommit - uses: actions/cache/restore@v4 with: @@ -102,19 +101,12 @@ jobs: pre-commit run --hook-stage manual -a php-cs-with-cache | tee -a ${RAW_LOG} ls -l ~/.cache/pre-commit/ - # If error, we convert log in the checkstyle format - - name: Convert Raw Log to CheckStyle format - if: ${{ failure() }} - run: | - python ${LOG_TO_CS} ${RAW_LOG} ${CS_XML} - # Annotate the git sources with the log messages - - name: Annotate Source Code with Messages - uses: staabm/annotate-pull-request-from-checkstyle-action@v1 + - name: Convert Raw Log to Annotations + uses: mdeweerd/logToCheckStyle@v2024.2.9 if: ${{ failure() }} with: - files: ${{ env.CS_XML }} - notices-as-warnings: true # optional - prepend-filename: true # optional + in: ${{ env.RAW_LOG }} + # Save the precommit cache - uses: actions/cache/save@v4 if: ${{ ! cancelled() }} From 55c0efae3fb5f8d387eec9674fa5c784a3caa9d2 Mon Sep 17 00:00:00 2001 From: noec764 <58433943+noec764@users.noreply.github.com> Date: Mon, 4 Mar 2024 18:26:38 +0100 Subject: [PATCH 002/709] FIX: Special code is now transmitted by args only in order supplier (#28619) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Noé --- htdocs/fourn/commande/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 17b99779094..4fa93836b76 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1344,8 +1344,6 @@ if (empty($reshook)) { $tva_tx = get_default_tva($soc, $mysoc, $lines[$i]->fk_product, $product_fourn_price_id); } - $object->special_code = $lines[$i]->special_code; - $result = $object->addline( $desc, $lines[$i]->subprice, @@ -1368,7 +1366,9 @@ if (empty($reshook)) { $lines[$i]->fk_unit, 0, $element, - !empty($lines[$i]->id) ? $lines[$i]->id : $lines[$i]->rowid + !empty($lines[$i]->id) ? $lines[$i]->id : $lines[$i]->rowid, + -1, + $lines[$i]->special_code ); if ($result < 0) { From 75f1de8f8f5140235b45f80633f65192ab14b847 Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Tue, 5 Mar 2024 18:07:05 +0100 Subject: [PATCH 003/709] Fix: Deposit lines are not created correctly (#28646) * FIX: The minimum price in proposals is not checked correctly * Fix: Deposit lines are not created correctly * Fix: Volver a dejar como estaba * Fix: Deposit lines are not created correctly --- htdocs/compta/facture/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 0dd1b661b33..bb96c2c2f81 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -12,7 +12,7 @@ * Copyright (C) 2013 Jean-Francois FERRY * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2013 Cédric Salvador - * Copyright (C) 2014-2019 Ferran Marcet + * Copyright (C) 2014-2024 Ferran Marcet * Copyright (C) 2015-2016 Marcos García * Copyright (C) 2018-2021 Frédéric France * Copyright (C) 2022 Gauthier VERDOL @@ -1596,7 +1596,7 @@ if (empty($reshook)) { null, 0, '', - 1 + (!empty($conf->global->MAIN_DEPOSIT_MULTI_TVA)?0:1) ); } From a644adbfe5334b156e8b4321c4769c025128684e Mon Sep 17 00:00:00 2001 From: ATM john Date: Wed, 6 Mar 2024 15:57:34 +0100 Subject: [PATCH 004/709] New hook for getElementProperties --- htdocs/core/lib/functions.lib.php | 131 ++++++++++++++++++------------ 1 file changed, 79 insertions(+), 52 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 162d25420c1..d69dd57271f 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -12058,16 +12058,16 @@ function dolGetButtonTitle($label, $helpText = '', $iconClass = 'fa fa-file', $u /** * Get an array with properties of an element. * - * @param string $element_type Element type (Value of $object->element). Example: - * 'action', 'facture', 'project', 'project_task' or - * 'myobject@mymodule' or - * 'myobject_mysubobject' (where mymodule = myobject, like 'project_task') + * @param string $elementType Element type (Value of $object->element). Example: + * 'action', 'facture', 'project', 'project_task' or + * 'myobject@mymodule' or + * 'myobject_mysubobject' (where mymodule = myobject, like 'project_task') * @return array array('module'=>, 'classpath'=>, 'element'=>, 'subelement'=>, 'classfile'=>, 'classname'=>, 'dir_output'=>) * @see fetchObjectByElement(), getMultiDirOutput() */ -function getElementProperties($element_type) +function getElementProperties($elementType) { - global $conf; + global $conf, $db, $hookmanager; $regs = array(); @@ -12076,13 +12076,13 @@ function getElementProperties($element_type) $classfile = $classname = $classpath = $subdir = $dir_output = ''; // Parse element/subelement - $module = $element_type; - $element = $element_type; - $subelement = $element_type; - $table_element = $element_type; + $module = $elementType; + $element = $elementType; + $subelement = $elementType; + $table_element = $elementType; // If we ask a resource form external module (instead of default path) - if (preg_match('/^([^@]+)@([^@]+)$/i', $element_type, $regs)) { // 'myobject@mymodule' + if (preg_match('/^([^@]+)@([^@]+)$/i', $elementType, $regs)) { // 'myobject@mymodule' $element = $subelement = $regs[1]; $module = $regs[2]; } @@ -12095,138 +12095,138 @@ function getElementProperties($element_type) } // For compatibility and to work with non standard path - if ($element_type == "action") { + if ($elementType == "action") { $classpath = 'comm/action/class'; $subelement = 'Actioncomm'; $module = 'agenda'; $table_element = 'actioncomm'; - } elseif ($element_type == 'cronjob') { + } elseif ($elementType == 'cronjob') { $classpath = 'cron/class'; $module = 'cron'; $table_element = 'cron'; - } elseif ($element_type == 'adherent_type') { + } elseif ($elementType == 'adherent_type') { $classpath = 'adherents/class'; $classfile = 'adherent_type'; $module = 'adherent'; $subelement = 'adherent_type'; $classname = 'AdherentType'; $table_element = 'adherent_type'; - } elseif ($element_type == 'bank_account') { + } elseif ($elementType == 'bank_account') { $classpath = 'compta/bank/class'; $module = 'bank'; // We need $conf->bank->dir_output and not $conf->banque->dir_output $classfile = 'account'; $classname = 'Account'; - } elseif ($element_type == 'category') { + } elseif ($elementType == 'category') { $classpath = 'categories/class'; $module = 'categorie'; $subelement = 'categorie'; $table_element = 'categorie'; - } elseif ($element_type == 'contact') { + } elseif ($elementType == 'contact') { $classpath = 'contact/class'; $classfile = 'contact'; $module = 'societe'; $subelement = 'contact'; $table_element = 'socpeople'; - } elseif ($element_type == 'inventory') { + } elseif ($elementType == 'inventory') { $module = 'product'; $classpath = 'product/inventory/class'; - } elseif ($element_type == 'stock') { + } elseif ($elementType == 'stock') { $classpath = 'product/stock/class'; $classfile = 'entrepot'; $classname = 'Entrepot'; $table_element = 'entrepot'; - } elseif ($element_type == 'project') { + } elseif ($elementType == 'project') { $classpath = 'projet/class'; $module = 'projet'; $table_element = 'projet'; - } elseif ($element_type == 'project_task') { + } elseif ($elementType == 'project_task') { $classpath = 'projet/class'; $module = 'projet'; $subelement = 'task'; $table_element = 'projet_task'; - } elseif ($element_type == 'facture' || $element_type == 'invoice') { + } elseif ($elementType == 'facture' || $elementType == 'invoice') { $classpath = 'compta/facture/class'; $module = 'facture'; $subelement = 'facture'; $table_element = 'facture'; - } elseif ($element_type == 'commande' || $element_type == 'order') { + } elseif ($elementType == 'commande' || $elementType == 'order') { $classpath = 'commande/class'; $module = 'commande'; $subelement = 'commande'; $table_element = 'commande'; - } elseif ($element_type == 'propal') { + } elseif ($elementType == 'propal') { $classpath = 'comm/propal/class'; $table_element = 'propal'; - } elseif ($element_type == 'shipping') { + } elseif ($elementType == 'shipping') { $classpath = 'expedition/class'; $classfile = 'expedition'; $classname = 'Expedition'; $module = 'expedition'; $table_element = 'expedition'; - } elseif ($element_type == 'supplier_proposal') { + } elseif ($elementType == 'supplier_proposal') { $classpath = 'supplier_proposal/class'; $module = 'supplier_proposal'; $element = 'supplierproposal'; $classfile = 'supplier_proposal'; $subelement = 'supplierproposal'; - } elseif ($element_type == 'shipping') { + } elseif ($elementType == 'shipping') { $classpath = 'expedition/class'; $subelement = 'expedition'; $module = 'expedition_bon'; - } elseif ($element_type == 'delivery') { + } elseif ($elementType == 'delivery') { $classpath = 'delivery/class'; $subelement = 'delivery'; $module = 'expedition'; - } elseif ($element_type == 'contract') { + } elseif ($elementType == 'contract') { $classpath = 'contrat/class'; $module = 'contrat'; $subelement = 'contrat'; $table_element = 'contract'; - } elseif ($element_type == 'mailing') { + } elseif ($elementType == 'mailing') { $classpath = 'comm/mailing/class'; $module = 'mailing'; $classfile = 'mailing'; $classname = 'Mailing'; $subelement = ''; - } elseif ($element_type == 'member') { + } elseif ($elementType == 'member') { $classpath = 'adherents/class'; $module = 'adherent'; $subelement = 'adherent'; $table_element = 'adherent'; - } elseif ($element_type == 'usergroup') { + } elseif ($elementType == 'usergroup') { $classpath = 'user/class'; $module = 'user'; - } elseif ($element_type == 'mo') { + } elseif ($elementType == 'mo') { $classpath = 'mrp/class'; $classfile = 'mo'; $classname = 'Mo'; $module = 'mrp'; $subelement = ''; $table_element = 'mrp_mo'; - } elseif ($element_type == 'cabinetmed_cons') { + } elseif ($elementType == 'cabinetmed_cons') { $classpath = 'cabinetmed/class'; $module = 'cabinetmed'; $subelement = 'cabinetmedcons'; $table_element = 'cabinetmedcons'; - } elseif ($element_type == 'fichinter') { + } elseif ($elementType == 'fichinter') { $classpath = 'fichinter/class'; $module = 'ficheinter'; $subelement = 'fichinter'; $table_element = 'fichinter'; - } elseif ($element_type == 'dolresource' || $element_type == 'resource') { + } elseif ($elementType == 'dolresource' || $elementType == 'resource') { $classpath = 'resource/class'; $module = 'resource'; $subelement = 'dolresource'; $table_element = 'resource'; - } elseif ($element_type == 'propaldet') { + } elseif ($elementType == 'propaldet') { $classpath = 'comm/propal/class'; $module = 'propal'; $subelement = 'propaleligne'; - } elseif ($element_type == 'opensurvey_sondage') { + } elseif ($elementType == 'opensurvey_sondage') { $classpath = 'opensurvey/class'; $module = 'opensurvey'; $subelement = 'opensurveysondage'; - } elseif ($element_type == 'order_supplier') { + } elseif ($elementType == 'order_supplier') { $classpath = 'fourn/class'; $module = 'fournisseur'; $classfile = 'fournisseur.commande'; @@ -12234,7 +12234,7 @@ function getElementProperties($element_type) $subelement = ''; $classname = 'CommandeFournisseur'; $table_element = 'commande_fournisseur'; - } elseif ($element_type == 'invoice_supplier') { + } elseif ($elementType == 'invoice_supplier') { $classpath = 'fourn/class'; $module = 'fournisseur'; $classfile = 'fournisseur.facture'; @@ -12242,19 +12242,19 @@ function getElementProperties($element_type) $subelement = ''; $classname = 'FactureFournisseur'; $table_element = 'facture_fourn'; - } elseif ($element_type == "service") { + } elseif ($elementType == "service") { $classpath = 'product/class'; $subelement = 'product'; $table_element = 'product'; - } elseif ($element_type == 'salary') { + } elseif ($elementType == 'salary') { $classpath = 'salaries/class'; $module = 'salaries'; - } elseif ($element_type == 'payment_salary') { + } elseif ($elementType == 'payment_salary') { $classpath = 'salaries/class'; $classfile = 'paymentsalary'; $classname = 'PaymentSalary'; $module = 'salaries'; - } elseif ($element_type == 'productlot') { + } elseif ($elementType == 'productlot') { $module = 'productbatch'; $classpath = 'product/stock/class'; $classfile = 'productlot'; @@ -12262,27 +12262,27 @@ function getElementProperties($element_type) $element = 'productlot'; $subelement = ''; $table_element = 'product_lot'; - } elseif ($element_type == 'websitepage') { + } elseif ($elementType == 'websitepage') { $classpath = 'website/class'; $classfile = 'websitepage'; $classname = 'Websitepage'; $module = 'website'; $subelement = 'websitepage'; $table_element = 'website_page'; - } elseif ($element_type == 'fiscalyear') { + } elseif ($elementType == 'fiscalyear') { $classpath = 'core/class'; $module = 'accounting'; $subelement = 'fiscalyear'; - } elseif ($element_type == 'chargesociales') { + } elseif ($elementType == 'chargesociales') { $classpath = 'compta/sociales/class'; $module = 'tax'; $table_element = 'chargesociales'; - } elseif ($element_type == 'tva') { + } elseif ($elementType == 'tva') { $classpath = 'compta/tva/class'; $module = 'tax'; $subdir = '/vat'; $table_element = 'tva'; - } elseif ($element_type == 'emailsenderprofile') { + } elseif ($elementType == 'emailsenderprofile') { $module = ''; $classpath = 'core/class'; $classfile = 'emailsenderprofile'; @@ -12322,7 +12322,7 @@ function getElementProperties($element_type) } $dir_output .= $subdir; - $element_properties = array( + $elementProperties = array( 'module' => $module, 'element' => $element, 'table_element' => $table_element, @@ -12333,8 +12333,35 @@ function getElementProperties($element_type) 'dir_output' => $dir_output ); - //var_dump($element_properties); - return $element_properties; + + // Add hook + if (!is_object($hookmanager)) { + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + $hookmanager = new HookManager($db); + } + $hookmanager->initHooks(array('elementproperties')); + + + // Hook params + $parameters = array( + 'elementType' => $elementType, + 'elementProperties' => $elementProperties + ); + + $reshook = $hookmanager->executeHooks('getElementProperties', $parameters); + + if ($reshook) { + $elementProperties = $hookmanager->resArray; + } elseif (!empty($hookmanager->resArray) && is_array($hookmanager->resArray)) { // resArray is always an array but for sécurity against misconfigured external modules + $elementProperties = array_replace($elementProperties, $hookmanager->resArray); + } + + // context of elementproperties doesn't need to exist out of this function so delete it to avoid elementproperties context is equal to all + if (($key = array_search('elementproperties', $hookmanager->contextarray)) !== false) { + unset($hookmanager->contextarray[$key]); + } + + return $elementProperties; } /** From 2d9801ffe33c22ea9d6c65a0b5bdd49e487712be Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Mar 2024 15:01:25 +0100 Subject: [PATCH 005/709] Fix sec more complete list of forbidden function --- htdocs/core/lib/functions.lib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index cbf8fee96e0..181825a689e 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9297,6 +9297,7 @@ function dol_eval($s, $returnvalue = 0, $hideerrors = 1, $onlysimplestring = '1' $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("fopen", "file_put_contents", "fputs", "fputscsv", "fwrite", "fpassthru", "require", "include", "mkdir", "rmdir", "symlink", "touch", "unlink", "umask")); $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("get_defined_functions", "get_defined_vars", "get_defined_constants", "get_declared_classes")); $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("function", "call_user_func")); + $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("require", "include", "require_once", "include_once")); $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("eval", "create_function", "assert", "mb_ereg_replace")); // function with eval capabilities $forbiddenphpmethods = array('invoke', 'invokeArgs'); // Method of ReflectionFunction to execute a function From 91b994b89ce6a5263bdedd36dff1c43141f6767a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Mar 2024 17:20:44 +0100 Subject: [PATCH 006/709] Prepare 18.0.6 --- htdocs/filefunc.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index cba47566c2b..9e1046d439f 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -34,7 +34,7 @@ if (!defined('DOL_APPLICATION_TITLE')) { define('DOL_APPLICATION_TITLE', 'Dolibarr'); } if (!defined('DOL_VERSION')) { - define('DOL_VERSION', '18.0.5'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c + define('DOL_VERSION', '18.0.6'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c } if (!defined('EURO')) { From 24059b0b8db2dcc64ea7b133f17ff4a5258834af Mon Sep 17 00:00:00 2001 From: ATM john Date: Wed, 6 Mar 2024 17:24:23 +0100 Subject: [PATCH 007/709] get rows security --- htdocs/core/db/DoliDB.class.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index 3b1184c7f85..4c0bfcbd0f3 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -385,6 +385,7 @@ abstract class DoliDB implements Database if ($res) { $obj = $this->fetch_object($res); if ($obj) { + $this->free($res); return $obj; } else { return 0; @@ -399,12 +400,17 @@ abstract class DoliDB implements Database * Note : This method executes a given SQL query and retrieves all row of results as an array of objects. It should only be used with SELECT queries * be careful with this method use it only with some limit of results to avoid performances loss. * - * @param string $sql The sql query string - * @return bool|array Result - * @deprecated + * @param string $sql The sql query string + * @param bool $noLimitCheck set it to true to disable sql query check of limit + * @return bool|array Result */ - public function getRows($sql) + public function getRows($sql, $noLimitCheck = false) { + + if (!$noLimitCheck && strpos($sql, 'LIMIT') === false) { + return false; + } + $res = $this->query($sql); if ($res) { $results = array(); @@ -413,6 +419,7 @@ abstract class DoliDB implements Database $results[] = $obj; } } + $this->free($res); return $results; } From 4dcf98b9f7d5e26dd4c4c62bc4a980e389cc61aa Mon Sep 17 00:00:00 2001 From: ATM-NicolasV <92087862+ATM-NicolasV@users.noreply.github.com> Date: Thu, 7 Mar 2024 15:55:07 +0100 Subject: [PATCH 008/709] fix entity in sql from RemoveFromGroup (#28682) --- htdocs/user/class/user.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 1543d579839..0ec4d6fdf5a 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2377,7 +2377,11 @@ class User extends CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."usergroup_user"; $sql .= " WHERE fk_user = ".((int) $this->id); $sql .= " AND fk_usergroup = ".((int) $group); - $sql .= " AND entity = ".((int) $entity); + if (empty($entity)) { + $sql .= " AND entity IN (0, 1)"; // group may be in entity 0 (so $entity=0) and link with user into entity 1. + } else { + $sql .= " AND entity = ".((int) $entity); + } $result = $this->db->query($sql); if ($result) { From 7bb55aa22528cf2ac35303a957113170ebc58af0 Mon Sep 17 00:00:00 2001 From: atm-adrien <67913809+atm-adrien@users.noreply.github.com> Date: Thu, 7 Mar 2024 15:56:17 +0100 Subject: [PATCH 009/709] FIX : Translation for select (#28677) * FIX : Adding thez dependencies list feature for select fields * FIX : Adding some spaces * FIX : View * FIX : Translating --- htdocs/core/class/commonobject.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 47060b949f4..9ef1f4c94f4 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7330,7 +7330,7 @@ abstract class CommonObject $isDependList = 1; } $out .= (!empty($parent) ? ' parent="'.$parent.'"' : ''); - $out .= '>'.$valb.''; + $out .= '>'.$langs->trans($valb).''; } $out .= ''; } elseif ($type == 'sellist') { @@ -7954,7 +7954,7 @@ abstract class CommonObject } elseif ($type == 'select') { $value = isset($param['options'][$value]) ? $param['options'][$value] : ''; if (strpos($value, "|") !== false) { - $value = explode('|', $value)[0]; + $value = $langs->trans(explode('|', $value)[0]); } } elseif ($type == 'sellist') { $param_list = array_keys($param['options']); From 2d8223eefb5a3e493a71a358626c64e051068034 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Mar 2024 16:16:49 +0100 Subject: [PATCH 010/709] Doc --- htdocs/admin/system/security.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index 6ad04701a52..e19463934af 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -341,12 +341,13 @@ if (!getDolGlobalString('SECURITY_DISABLE_TEST_ON_OBFUSCATED_CONF')) { } print '$dolibarr_main_stream_to_disable: '; +// $arrayofstreamtodisable is defined into filefunc.inc.php if (empty($dolibarr_main_stream_to_disable)) { print ''.$langs->trans("Undefined").' = '.join(', ', $arrayofstreamtodisable).''; } else { print join(', ', $dolibarr_main_stream_to_disable); } -print ' -> PHP streams allowed = '; +print ' -> Current PHP streams allowed = '; $arrayofstreams = stream_get_wrappers(); if (!empty($arrayofstreams)) { sort($arrayofstreams); From 8870be3c3d211385f7a7061fb5eef4ee5cb3790d Mon Sep 17 00:00:00 2001 From: Rikard Bosnjakovic Date: Thu, 7 Mar 2024 16:43:04 +0100 Subject: [PATCH 011/709] Update card.php (#28679) Fix #25130 Co-authored-by: Laurent Destailleur --- htdocs/expedition/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index fd83a09ab0e..45cbba28344 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -2762,7 +2762,7 @@ if ($action == 'create') { // Presend form $modelmail = 'shipping_send'; - $defaulttopic = $langs->trans('SendShippingRef'); + $defaulttopic = 'SendShippingRef'; $diroutput = $conf->expedition->dir_output.'/sending'; $trackid = 'shi'.$object->id; From cbd331256d937c92a384bf6183b277e4f4bb0678 Mon Sep 17 00:00:00 2001 From: Jon Bendtsen Date: Thu, 7 Mar 2024 19:01:38 +0100 Subject: [PATCH 012/709] using note_public since note_private is not working (#28675) Co-authored-by: Jon Bendtsen --- htdocs/adherents/subscription/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/subscription/card.php b/htdocs/adherents/subscription/card.php index b2dc0a57a53..3b59dab63a2 100644 --- a/htdocs/adherents/subscription/card.php +++ b/htdocs/adherents/subscription/card.php @@ -238,7 +238,7 @@ if ($user->hasRight('adherent', 'cotisation', 'creer') && $action == 'edit') { // Label print ''.$langs->trans("Label").''; print ''; - print ''; + print ''; // Bank line if (isModEnabled("banque") && (getDolGlobalString('ADHERENT_BANK_USE') || $object->fk_bank)) { @@ -334,7 +334,7 @@ if ($rowid && $action != 'edit') { print ''.$langs->trans("Amount").''.price($object->amount).''; // Label - print ''.$langs->trans("Label").''.dol_string_onlythesehtmltags(dol_htmlentitiesbr($object->note_private)).''; + print ''.$langs->trans("Label").''.dol_string_onlythesehtmltags(dol_htmlentitiesbr($object->note_public)).''; // Bank line if (isModEnabled("banque") && (getDolGlobalString('ADHERENT_BANK_USE') || $object->fk_bank)) { From 7f10566d5e4f2ab900457405956d0112f11a251f Mon Sep 17 00:00:00 2001 From: Florian Mortgat <50440633+atm-florianm@users.noreply.github.com> Date: Thu, 7 Mar 2024 20:21:41 +0100 Subject: [PATCH 013/709] FIX 17.0: $num doesn't take trigger-modified newref into account, leading to inconsistencies if BILL_SUPPLIER_VALIDATE changes the invoice's ref (#28684) this is a follow-up of PR #27008 --- htdocs/fourn/class/fournisseur.facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 75874fbb86a..eebb2b95b51 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1895,7 +1895,7 @@ class FactureFournisseur extends CommonInvoice // Set new ref and define current statut if (!$error) { - $this->ref = $num; + $this->ref = $this->newref; $this->statut = self::STATUS_VALIDATED; //$this->date_validation=$now; this is stored into log table } From 2636a644612bd181698392e8fd5416451afe23fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20NASSIET?= <109105553+comaiteseb@users.noreply.github.com> Date: Thu, 7 Mar 2024 20:43:45 +0100 Subject: [PATCH 014/709] Set import_key in import when update record (#28657) * Set import_key in import when update record * Update import_xlsx.modules.php --- htdocs/core/modules/import/import_csv.modules.php | 2 +- htdocs/core/modules/import/import_xlsx.modules.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 124fe9f7bbc..0a0a1aeb07f 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -963,7 +963,7 @@ class ImportCsv extends ModeleImports foreach ($data as $key => $val) { $set[] = $key." = ".$val; } - $sqlstart .= " SET ".implode(', ', $set); + $sqlstart .= " SET ".implode(', ', $set).", import_key = '".$this->db->escape($importid)."'"; if (empty($keyfield)) { $keyfield = 'rowid'; diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index 14e4b561eae..8d5157e63a4 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -1006,7 +1006,7 @@ class ImportXlsx extends ModeleImports foreach ($data as $key => $val) { $set[] = $key." = ".$val; } - $sqlstart .= " SET " . implode(', ', $set); + $sqlstart .= " SET " . implode(', ', $set) . ", import_key = '" . $this->db->escape($importid) . "'"; if (empty($keyfield)) { $keyfield = 'rowid'; From 10aa278acae9ba7c49e916dde8fcdd01fed8b9a2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Mar 2024 21:38:40 +0100 Subject: [PATCH 015/709] Fix add a type to allow sanitization of import rule='compute'. --- .../modules/import/import_csv.modules.php | 19 ++++++++++++++----- .../modules/import/import_xlsx.modules.php | 19 ++++++++++++++----- htdocs/core/modules/modAccounting.class.php | 12 ++++++------ 3 files changed, 34 insertions(+), 16 deletions(-) diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 0a0a1aeb07f..aa979b5260a 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -738,7 +738,7 @@ class ImportCsv extends ModeleImports // ... } - // Define $listfields and $listvalues to build SQL request + // Define $listfields and $listvalues to build the SQL request if (isModEnabled("socialnetworks") && strpos($fieldname, "socialnetworks") !== false) { if (!in_array("socialnetworks", $listfields)) { $listfields[] = "socialnetworks"; @@ -765,7 +765,7 @@ class ImportCsv extends ModeleImports $listfields[] = $fieldname; // Note: arrayrecord (and 'type') is filled with ->import_read_record called by import.php page before calling import_insert if (empty($newval) && $arrayrecord[($key - 1)]['type'] < 0) { - $listvalues[] = ($newval == '0' ? $newval : "null"); + $listvalues[] = ($newval == '0' ? (int) $newval : "null"); } elseif (empty($newval) && $arrayrecord[($key - 1)]['type'] == 0) { $listvalues[] = "''"; } else { @@ -793,7 +793,7 @@ class ImportCsv extends ModeleImports $lastinsertid = (isset($last_insert_id_array[$tmp[1]])) ? $last_insert_id_array[$tmp[1]] : 0; $keyfield = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $tmpkey); $listfields[] = $keyfield; - $listvalues[] = $lastinsertid; + $listvalues[] = (int) $lastinsertid; //print $tmpkey."-".$tmpval."-".$listfields."-".$listvalues."
";exit; } elseif (preg_match('/^const-/', $tmpval)) { $tmp = explode('-', $tmpval, 2); @@ -806,6 +806,7 @@ class ImportCsv extends ModeleImports $file = (empty($objimport->array_import_convertvalue[0][$fieldname]['classfile']) ? $objimport->array_import_convertvalue[0][$fieldname]['file'] : $objimport->array_import_convertvalue[0][$fieldname]['classfile']); $class = $objimport->array_import_convertvalue[0][$fieldname]['class']; $method = $objimport->array_import_convertvalue[0][$fieldname]['method']; + $type = $objimport->array_import_convertvalue[0][$fieldname]['type']; $resultload = dol_include_once($file); if (empty($resultload)) { dol_print_error('', 'Error trying to call file=' . $file . ', class=' . $class . ', method=' . $method); @@ -818,8 +819,16 @@ class ImportCsv extends ModeleImports if (count($fieldArr) > 0) { $fieldname = $fieldArr[1]; } + + // Set $listfields and $listvalues $listfields[] = $fieldname; - $listvalues[] = $res; + if ($type == 'int') { + $listvalues[] = (int) $res; + } elseif ($type == 'double') { + $listvalues[] = (float) $res; + } else { + $listvalues[] = "'".$this->db->escape($res)."'"; + } } else { $this->errors[$error]['type'] = 'CLASSERROR'; $this->errors[$error]['lib'] = implode( @@ -961,7 +970,7 @@ class ImportCsv extends ModeleImports $data = array_combine($listfields, $listvalues); $set = array(); foreach ($data as $key => $val) { - $set[] = $key." = ".$val; + $set[] = $key." = ".$val; // $val was escaped/sanitized previously } $sqlstart .= " SET ".implode(', ', $set).", import_key = '".$this->db->escape($importid)."'"; diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index 8d5157e63a4..e798fc659f0 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -781,7 +781,7 @@ class ImportXlsx extends ModeleImports // ... } - // Define $listfields and $listvalues to build SQL request + // Define $listfields and $listvalues to build the SQL request if (isModEnabled("socialnetworks") && strpos($fieldname, "socialnetworks") !== false) { if (!in_array("socialnetworks", $listfields)) { $listfields[] = "socialnetworks"; @@ -807,7 +807,7 @@ class ImportXlsx extends ModeleImports // Note: arrayrecord (and 'type') is filled with ->import_read_record called by import.php page before calling import_insert if (empty($newval) && $arrayrecord[($key)]['type'] < 0) { - $listvalues[] = ($newval == '0' ? $newval : "null"); + $listvalues[] = ($newval == '0' ? (int) $newval : "null"); } elseif (empty($newval) && $arrayrecord[($key)]['type'] == 0) { $listvalues[] = "''"; } else { @@ -835,7 +835,7 @@ class ImportXlsx extends ModeleImports $lastinsertid = (isset($last_insert_id_array[$tmp[1]])) ? $last_insert_id_array[$tmp[1]] : 0; $keyfield = preg_replace('/^' . preg_quote($alias, '/') . '\./', '', $key); $listfields[] = $keyfield; - $listvalues[] = $lastinsertid; + $listvalues[] = (int) $lastinsertid; //print $key."-".$val."-".$listfields."-".$listvalues."
";exit; } elseif (preg_match('/^const-/', $val)) { $tmp = explode('-', $val, 2); @@ -848,6 +848,7 @@ class ImportXlsx extends ModeleImports $file = (empty($objimport->array_import_convertvalue[0][$fieldname]['classfile']) ? $objimport->array_import_convertvalue[0][$fieldname]['file'] : $objimport->array_import_convertvalue[0][$fieldname]['classfile']); $class = $objimport->array_import_convertvalue[0][$fieldname]['class']; $method = $objimport->array_import_convertvalue[0][$fieldname]['method']; + $type = $objimport->array_import_convertvalue[0][$fieldname]['type']; $resultload = dol_include_once($file); if (empty($resultload)) { dol_print_error('', 'Error trying to call file=' . $file . ', class=' . $class . ', method=' . $method); @@ -859,8 +860,16 @@ class ImportXlsx extends ModeleImports if (count($fieldArr) > 0) { $fieldname = $fieldArr[1]; } + + // Set $listfields and $listvalues $listfields[] = $fieldname; - $listvalues[] = $res; + if ($type == 'int') { + $listvalues[] = (int) $res; + } elseif ($type == 'double') { + $listvalues[] = (float) $res; + } else { + $listvalues[] = "'".$this->db->escape($res)."'"; + } } else { $this->errors[$error]['type'] = 'CLASSERROR'; $this->errors[$error]['lib'] = implode( @@ -1004,7 +1013,7 @@ class ImportXlsx extends ModeleImports $data = array_combine($listfields, $listvalues); $set = array(); foreach ($data as $key => $val) { - $set[] = $key." = ".$val; + $set[] = $key." = ".$val; // $val was escaped/sanitized previously } $sqlstart .= " SET " . implode(', ', $set) . ", import_key = '" . $this->db->escape($importid) . "'"; diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index 07591de93a7..f8788d09ba4 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -362,14 +362,14 @@ class modAccounting extends DolibarrModules 'b.sens'=>'rule-computeDirection' ); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) $this->import_convertvalue_array[$r]=array( - 'b.piece_num' => array('rule' => 'compute', 'classfile' => '/accountancy/class/accountancyimport.class.php', 'class' => 'AccountancyImport', 'method' => 'cleanValue', 'element' => 'Accountancy'), + 'b.piece_num' => array('rule' => 'compute', 'type' => 'int', 'classfile' => '/accountancy/class/accountancyimport.class.php', 'class' => 'AccountancyImport', 'method' => 'cleanValue', 'element' => 'Accountancy'), 'b.numero_compte'=>array('rule'=>'accountingaccount'), 'b.subledger_account'=>array('rule'=>'accountingaccount'), - 'b.debit' => array('rule' => 'compute', 'classfile' => '/accountancy/class/accountancyimport.class.php', 'class' => 'AccountancyImport', 'method' => 'cleanAmount', 'element' => 'Accountancy'), - 'b.credit' => array('rule' => 'compute', 'classfile' => '/accountancy/class/accountancyimport.class.php', 'class' => 'AccountancyImport', 'method' => 'cleanAmount', 'element' => 'Accountancy'), - 'b.multicurrency_amount' => array('rule' => 'compute', 'classfile' => '/accountancy/class/accountancyimport.class.php', 'class' => 'AccountancyImport', 'method' => 'cleanAmount', 'element' => 'Accountancy'), - 'b.montant' => array('rule' => 'compute', 'classfile' => '/accountancy/class/accountancyimport.class.php', 'class' => 'AccountancyImport', 'method' => 'computeAmount', 'element' => 'Accountancy'), - 'b.sens' => array('rule' => 'compute', 'classfile' => '/accountancy/class/accountancyimport.class.php', 'class' => 'AccountancyImport', 'method' => 'computeDirection', 'element' => 'Accountancy'), + 'b.debit' => array('rule' => 'compute', 'type' => 'double', 'classfile' => '/accountancy/class/accountancyimport.class.php', 'class' => 'AccountancyImport', 'method' => 'cleanAmount', 'element' => 'Accountancy'), + 'b.credit' => array('rule' => 'compute', 'type' => 'double', 'classfile' => '/accountancy/class/accountancyimport.class.php', 'class' => 'AccountancyImport', 'method' => 'cleanAmount', 'element' => 'Accountancy'), + 'b.multicurrency_amount' => array('rule' => 'compute', 'type' => 'double', 'classfile' => '/accountancy/class/accountancyimport.class.php', 'class' => 'AccountancyImport', 'method' => 'cleanAmount', 'element' => 'Accountancy'), + 'b.montant' => array('rule' => 'compute', 'type' => 'double', 'classfile' => '/accountancy/class/accountancyimport.class.php', 'class' => 'AccountancyImport', 'method' => 'computeAmount', 'element' => 'Accountancy'), + 'b.sens' => array('rule' => 'compute', 'type' => 'varchar', 'classfile' => '/accountancy/class/accountancyimport.class.php', 'class' => 'AccountancyImport', 'method' => 'computeDirection', 'element' => 'Accountancy'), ); $this->import_regex_array[$r] = array( //'b.doc_date'=>'^\d{4}\d{2}\d{2}$', From 491e85037a9fb2974b021feab63c5776cbefe42b Mon Sep 17 00:00:00 2001 From: Can Arslan <138895927+mc2rcanarslan@users.noreply.github.com> Date: Thu, 7 Mar 2024 15:09:54 -0700 Subject: [PATCH 016/709] FIX: PHP Warning: Undefined variable $mode (#28697) --- htdocs/fourn/paiement/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/paiement/list.php b/htdocs/fourn/paiement/list.php index 2c7009c8d42..3021fbdc898 100644 --- a/htdocs/fourn/paiement/list.php +++ b/htdocs/fourn/paiement/list.php @@ -48,7 +48,7 @@ $action = GETPOST('action', 'alpha'); $massaction = GETPOST('massaction', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha'); $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'vendorpaymentlist'; - +$mode = GETPOST('mode', 'aZ'); $socid = GETPOST('socid', 'int'); $search_ref = GETPOST('search_ref', 'alpha'); From e74e638b26990d3e517579f6616616afa6f82860 Mon Sep 17 00:00:00 2001 From: Can Arslan <138895927+mc2rcanarslan@users.noreply.github.com> Date: Fri, 8 Mar 2024 04:28:31 -0700 Subject: [PATCH 017/709] FIX: skip adding tab if user doesn't have permission (#28698) verifCond function checks whether user has right and we should skip adding it if user doesn't have right --- htdocs/core/lib/functions.lib.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 0298ce0d439..846819f2433 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -10189,6 +10189,8 @@ function complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $newtab[1] = $label; $newtab[2] = str_replace('+', '', $values[1]); $h++; + } else { + continue; } } elseif (count($values) == 5) { // case deprecated dol_syslog('Passing 5 values in tabs module_parts is deprecated. Please update to 6 with permissions.', LOG_WARNING); From bcf6d7a2aa5b255516e46d69c9898d8bb1dde4a8 Mon Sep 17 00:00:00 2001 From: kkhelifa-opendsi Date: Fri, 8 Mar 2024 12:36:31 +0100 Subject: [PATCH 018/709] FIX: Fix create shipping with product who have negative stocks on warehouse but the negative stock transfert is allowed (#26217) --- htdocs/expedition/card.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 318d66635ec..20c6a14b77d 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1424,7 +1424,7 @@ if ($action == 'create') { $nbofsuggested = 0; foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) { - if ($stock_warehouse->real > 0) { + if ($stock_warehouse->real > 0 || !empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) { $nbofsuggested++; } } @@ -1437,7 +1437,7 @@ if ($action == 'create') { } $tmpwarehouseObject->fetch($warehouse_id); - if ($stock_warehouse->real > 0) { + if ($stock_warehouse->real > 0 || !empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) { $stock = + $stock_warehouse->real; // Convert it to number $deliverableQty = min($quantityToBeDelivered, $stock); $deliverableQty = max(0, $deliverableQty); @@ -1536,7 +1536,7 @@ if ($action == 'create') { // Define nb of lines suggested for this order line $nbofsuggested = 0; foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) { - if (($stock_warehouse->real > 0) && (count($stock_warehouse->detail_batch))) { + if (($stock_warehouse->real > 0 || !empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) && (count($stock_warehouse->detail_batch))) { $nbofsuggested+=count($stock_warehouse->detail_batch); } } @@ -1549,7 +1549,7 @@ if ($action == 'create') { } $tmpwarehouseObject->fetch($warehouse_id); - if (($stock_warehouse->real > 0) && (count($stock_warehouse->detail_batch))) { + if (($stock_warehouse->real > 0 || !empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) && (count($stock_warehouse->detail_batch))) { foreach ($stock_warehouse->detail_batch as $dbatch) { $batchStock = + $dbatch->qty; // To get a numeric if (isset($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)])) { @@ -1634,6 +1634,9 @@ if ($action == 'create') { $disabled = 'disabled="disabled"'; } print ' '; + if (empty($disabled) && !empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) { + print ''; + } } else { print $langs->trans("NA"); } From 23723289c288410a54d594b9efc1938549475e08 Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 8 Mar 2024 18:05:58 -0600 Subject: [PATCH 019/709] Update ticket.class.php update function (#28722) Default value for status to zero(0) instead of "null" --- htdocs/ticket/class/ticket.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 601806e023b..e1b496b6929 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -992,7 +992,7 @@ class Ticket extends CommonObject $sql .= " fk_user_assign=".(isset($this->fk_user_assign) ? $this->fk_user_assign : "null").","; $sql .= " subject=".(isset($this->subject) ? "'".$this->db->escape($this->subject)."'" : "null").","; $sql .= " message=".(isset($this->message) ? "'".$this->db->escape($this->message)."'" : "null").","; - $sql .= " fk_statut=".(isset($this->fk_statut) ? $this->fk_statut : "null").","; + $sql .= " fk_statut=".(isset($this->fk_statut) ? $this->fk_statut : "0").","; $sql .= " resolution=".(isset($this->resolution) ? $this->resolution : "null").","; $sql .= " progress=".(isset($this->progress) ? "'".$this->db->escape($this->progress)."'" : "null").","; $sql .= " timing=".(isset($this->timing) ? "'".$this->db->escape($this->timing)."'" : "null").","; From 302ea702e68fc7c5f7196f1ef5261f81c70a4e8f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 9 Mar 2024 02:55:25 +0100 Subject: [PATCH 020/709] Add v19 in stats --- dev/tools/github_commits_byversion.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dev/tools/github_commits_byversion.sh b/dev/tools/github_commits_byversion.sh index bd3405376cf..eafca6b2e01 100755 --- a/dev/tools/github_commits_byversion.sh +++ b/dev/tools/github_commits_byversion.sh @@ -4,7 +4,7 @@ # # shellcheck disable=1113,2002,2006,2086,2164,2219 -Releases=("3.9" "4.0" "5.0" "6.0" "7.0" "8.0" "9.0" "10.0" "11.0" "12.0" "13.0" "14.0" "15.0" "16.0" "17.0" "18.0" "develop") +Releases=("3.9" "4.0" "5.0" "6.0" "7.0" "8.0" "9.0" "10.0" "11.0" "12.0" "13.0" "14.0" "15.0" "16.0" "17.0" "18.0" "19.0" "develop") let "counter = 0" echo "Copy script into /tmp/github_commits_byversion.sh" @@ -49,4 +49,3 @@ do echo let "counter +=1" done - From b601dabf6604e16561bcf102d18f32c4927dbf85 Mon Sep 17 00:00:00 2001 From: le-reparateur <162715304+le-reparateur@users.noreply.github.com> Date: Sat, 9 Mar 2024 15:14:23 +0100 Subject: [PATCH 021/709] Update fournisseur.product.class.php (#28729) * Update fournisseur.product.class.php #28710 * Update fournisseur.product.class.php --------- Co-authored-by: Laurent Destailleur --- htdocs/fourn/class/fournisseur.product.class.php | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index fd9e0245ad8..cd512972033 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -327,10 +327,10 @@ class ProductFournisseur extends Product $fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $multicurrency_code); } - $buyprice = price2num($buyprice, 'MU'); - $charges = price2num($charges, 'MU'); - $qty = price2num($qty, 'MS'); - $unitBuyPrice = price2num($buyprice / $qty, 'MU'); + $buyprice = (float) price2num($buyprice, 'MU'); + $charges = (float) price2num($charges, 'MU'); + $qty = (float) price2num($qty, 'MS'); + $unitBuyPrice = (float) price2num($buyprice / $qty, 'MU'); // We can have a puchase ref that need to buy 100 min for a given price and with a packaging of 50. //$packaging = price2num(((empty($this->packaging) || $this->packaging < $qty) ? $qty : $this->packaging), 'MS'); @@ -359,10 +359,6 @@ class ProductFournisseur extends Product $localtax2 = 0; // If = '' then = 0 } - // Check parameters - if ($buyprice != '' && !is_numeric($buyprice)) { - } - $this->db->begin(); if ($this->product_fourn_price_id > 0) { @@ -391,6 +387,7 @@ class ProductFournisseur extends Product } $sql = "UPDATE ".MAIN_DB_PREFIX."product_fournisseur_price"; $sql .= " SET fk_user = ".((int) $user->id)." ,"; + $sql .= " datec = '".$this->db->idate($now)."' ,"; // Note: Even if this is an update, we update the creation date as the log of each change is tracked into product_fournisseur_log. $sql .= " ref_fourn = '".$this->db->escape($ref_fourn)."',"; $sql .= " desc_fourn = '".$this->db->escape($desc_fourn)."',"; $sql .= " price = ".((float) $buyprice).","; From 195e1aca449273a7657fe6dd9e0e92f6179fe2d2 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:47:29 +0100 Subject: [PATCH 022/709] Fix: Ensure string type for urlencode() --- htdocs/accountancy/admin/accountmodel.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/accountancy/admin/accountmodel.php b/htdocs/accountancy/admin/accountmodel.php index 8523baecacc..dbe02a3ff02 100644 --- a/htdocs/accountancy/admin/accountmodel.php +++ b/htdocs/accountancy/admin/accountmodel.php @@ -129,7 +129,7 @@ $tabrowid[31] = ""; // List of help for fields $tabhelp = array(); -$tabhelp[31] = array('pcg_version'=>$langs->trans("EnterAnyCode")); +$tabhelp[31] = array('pcg_version' => $langs->trans("EnterAnyCode")); // Define elementList and sourceList (used for dictionary type of contacts "llx_c_type_contact") @@ -241,7 +241,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) { $result = $db->query($sql); if ($result) { // Add is ok setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs'); - $_POST = array('id'=>$id); // Clean $_POST array, we keep only + $_POST = array('id' => $id); // Clean $_POST array, we keep only } else { if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors'); @@ -353,7 +353,7 @@ print load_fiche_titre($titre, $linkback, 'title_accountancy'); // Confirmation de la suppression de la ligne if ($action == 'delete') { - print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.urlencode($page).'&' : '').'sortfield='.urlencode($sortfield).'&sortorder='.urlencode($sortorder).'&rowid='.urlencode($rowid).'&code='.urlencode($code).'&id='.urlencode($id), $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1); + print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.urlencode((string) ($page)).'&' : '').'sortfield='.urlencode((string) ($sortfield)).'&sortorder='.urlencode((string) ($sortorder)).'&rowid='.urlencode((string) ($rowid)).'&code='.urlencode((string) ($code)).'&id='.urlencode((string) ($id)), $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1); } //var_dump($elementList); @@ -458,7 +458,7 @@ if ($id) { } $tmpaction = 'create'; - $parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); + $parameters = array('fieldlist' => $fieldlist, 'tabname' => $tabname[$id]); $reshook = $hookmanager->executeHooks('createDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks $error = $hookmanager->error; $errors = $hookmanager->errors; @@ -486,9 +486,9 @@ if ($id) { $num = $db->num_rows($resql); $i = 0; - $param = '&id='.urlencode($id); + $param = '&id='.urlencode((string) ($id)); if ($search_country_id > 0) { - $param .= '&search_country_id='.urlencode($search_country_id); + $param .= '&search_country_id='.urlencode((string) ($search_country_id)); } $paramwithsearch = $param; if ($sortorder) { @@ -556,7 +556,7 @@ if ($id) { print ''; $tmpaction = 'edit'; - $parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); + $parameters = array('fieldlist' => $fieldlist, 'tabname' => $tabname[$id]); $reshook = $hookmanager->executeHooks('editDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks $error = $hookmanager->error; $errors = $hookmanager->errors; @@ -571,7 +571,7 @@ if ($id) { print ''; } else { $tmpaction = 'view'; - $parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); + $parameters = array('fieldlist' => $fieldlist, 'tabname' => $tabname[$id]); $reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks $error = $hookmanager->error; @@ -718,7 +718,7 @@ function fieldListAccountModel($fieldlist, $obj = null, $tabname = '', $context print ''; } if ($fieldlist[$field] == 'type_cdr') { - print $form->selectarray($fieldlist[$field], array(0=>$langs->trans('None'), 1=>$langs->trans('AtEndOfMonth'), 2=>$langs->trans('CurrentNext')), (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '')); + print $form->selectarray($fieldlist[$field], array(0 => $langs->trans('None'), 1 => $langs->trans('AtEndOfMonth'), 2 => $langs->trans('CurrentNext')), (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '')); } else { print $form->selectyesno($fieldlist[$field], (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : ''), 1); } From fc9e9f1c54c6edf0d9e225ed2bdca02492a68397 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:47:32 +0100 Subject: [PATCH 023/709] Fix: Ensure string type for urlencode() --- htdocs/accountancy/admin/categories_list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php index 032b3ac6e3e..18d793fc43e 100644 --- a/htdocs/accountancy/admin/categories_list.php +++ b/htdocs/accountancy/admin/categories_list.php @@ -461,7 +461,7 @@ $fieldlist = explode(',', $tabfield[$id]); $param = '&id='.$id; if ($search_country_id > 0) { - $param .= '&search_country_id='.urlencode($search_country_id); + $param .= '&search_country_id='.urlencode((string) ($search_country_id)); } $paramwithsearch = $param; if ($sortorder) { @@ -474,7 +474,7 @@ if (GETPOST('from', 'alpha')) { $paramwithsearch .= '&from='.urlencode(GETPOST('from', 'alpha')); } if ($listlimit) { - $paramwithsearch .= '&listlimit='.urlencode(GETPOSTINT('listlimit')); + $paramwithsearch .= '&listlimit='.urlencode((string) (GETPOSTINT('listlimit'))); } print '
'; print ''; From 1222809671eed03387088fa3672610d2022cb357 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:47:34 +0100 Subject: [PATCH 024/709] Fix: Ensure string type for urlencode() --- htdocs/accountancy/admin/journals_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/admin/journals_list.php b/htdocs/accountancy/admin/journals_list.php index 1b12d17df07..d710839a391 100644 --- a/htdocs/accountancy/admin/journals_list.php +++ b/htdocs/accountancy/admin/journals_list.php @@ -481,7 +481,7 @@ if ($id) { $param = '&id='.((int) $id); if ($search_country_id > 0) { - $param .= '&search_country_id='.urlencode($search_country_id); + $param .= '&search_country_id='.urlencode((string) ($search_country_id)); } $paramwithsearch = $param; if ($sortorder) { From 431c85816c20a5f7e1def92cc102b77a2d1bd991 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:47:36 +0100 Subject: [PATCH 025/709] Fix: Ensure string type for urlencode() --- htdocs/accountancy/admin/productaccount.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index fa0db20a05f..74dd948998b 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -422,7 +422,7 @@ if ($resql) { $param .= '&limit='.((int) $limit); } if ($searchCategoryProductOperator == 1) { - $param .= "&search_category_product_operator=".urlencode($searchCategoryProductOperator); + $param .= "&search_category_product_operator=".urlencode((string) ($searchCategoryProductOperator)); } foreach ($searchCategoryProductList as $searchCategoryProduct) { $param .= "&search_category_product_list[]=".urlencode($searchCategoryProduct); From 4df2f2e39dd8b2daf55aeaba26bc409f8aa9b156 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:47:38 +0100 Subject: [PATCH 026/709] Fix: Ensure string type for urlencode() --- htdocs/accountancy/bookkeeping/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 66838b8c2e2..e2f1e86008d 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -447,7 +447,7 @@ if ($action == 'create') { print $langs->trans('Docdate'); print ''; if ($action != 'editdate') { - print 'piece_num).'&mode='.urlencode($mode).'">'.img_edit($langs->transnoentitiesnoconv('SetDate'), 1).''; + print 'piece_num)).'&mode='.urlencode((string) ($mode)).'">'.img_edit($langs->transnoentitiesnoconv('SetDate'), 1).''; } print ''; print ''; @@ -474,7 +474,7 @@ if ($action == 'create') { print $langs->trans('Codejournal'); print ''; if ($action != 'editjournal') { - print 'piece_num).'&mode='.urlencode($mode).'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).''; + print 'piece_num)).'&mode='.urlencode((string) ($mode)).'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).''; } print ''; print ''; @@ -501,7 +501,7 @@ if ($action == 'create') { print $langs->trans('Piece'); print ''; if ($action != 'editdocref') { - print 'piece_num).'&mode='.urlencode($mode).'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).''; + print 'piece_num)).'&mode='.urlencode((string) ($mode)).'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).''; } print ''; print ''; From c6de5680bf4195af5f005689cadeccfdd53ef6ff Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:47:40 +0100 Subject: [PATCH 027/709] Fix: Ensure string type for urlencode() --- htdocs/accountancy/bookkeeping/export.php | 54 +++++++++++------------ 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/export.php b/htdocs/accountancy/bookkeeping/export.php index 6f3c34b279e..acd0fceb211 100644 --- a/htdocs/accountancy/bookkeeping/export.php +++ b/htdocs/accountancy/bookkeeping/export.php @@ -189,21 +189,21 @@ if (!in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && !GE $arrayfields = array( - 't.piece_num'=>array('label'=>$langs->trans("TransactionNumShort"), 'checked'=>1), - 't.code_journal'=>array('label'=>$langs->trans("Codejournal"), 'checked'=>1), - 't.doc_date'=>array('label'=>$langs->trans("Docdate"), 'checked'=>1), - 't.doc_ref'=>array('label'=>$langs->trans("Piece"), 'checked'=>1), - 't.numero_compte'=>array('label'=>$langs->trans("AccountAccountingShort"), 'checked'=>1), - 't.subledger_account'=>array('label'=>$langs->trans("SubledgerAccount"), 'checked'=>1), - 't.label_operation'=>array('label'=>$langs->trans("Label"), 'checked'=>1), - 't.debit'=>array('label'=>$langs->trans("AccountingDebit"), 'checked'=>1), - 't.credit'=>array('label'=>$langs->trans("AccountingCredit"), 'checked'=>1), - 't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1), - 't.date_creation'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0), - 't.tms'=>array('label'=>$langs->trans("DateModification"), 'checked'=>0), - 't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>1), - 't.date_validated'=>array('label'=>$langs->trans("DateValidationAndLock"), 'checked'=>1, 'enabled'=>!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")), - 't.import_key'=>array('label'=>$langs->trans("ImportId"), 'checked'=>0, 'position'=>1100), + 't.piece_num' => array('label' => $langs->trans("TransactionNumShort"), 'checked' => 1), + 't.code_journal' => array('label' => $langs->trans("Codejournal"), 'checked' => 1), + 't.doc_date' => array('label' => $langs->trans("Docdate"), 'checked' => 1), + 't.doc_ref' => array('label' => $langs->trans("Piece"), 'checked' => 1), + 't.numero_compte' => array('label' => $langs->trans("AccountAccountingShort"), 'checked' => 1), + 't.subledger_account' => array('label' => $langs->trans("SubledgerAccount"), 'checked' => 1), + 't.label_operation' => array('label' => $langs->trans("Label"), 'checked' => 1), + 't.debit' => array('label' => $langs->trans("AccountingDebit"), 'checked' => 1), + 't.credit' => array('label' => $langs->trans("AccountingCredit"), 'checked' => 1), + 't.lettering_code' => array('label' => $langs->trans("LetteringCode"), 'checked' => 1), + 't.date_creation' => array('label' => $langs->trans("DateCreation"), 'checked' => 0), + 't.tms' => array('label' => $langs->trans("DateModification"), 'checked' => 0), + 't.date_export' => array('label' => $langs->trans("DateExport"), 'checked' => 1), + 't.date_validated' => array('label' => $langs->trans("DateValidationAndLock"), 'checked' => 1, 'enabled' => !getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")), + 't.import_key' => array('label' => $langs->trans("ImportId"), 'checked' => 0, 'position' => 1100), ); if (!getDolGlobalString('ACCOUNTING_ENABLE_LETTERING')) { @@ -244,7 +244,7 @@ if (!GETPOST('confirmmassaction', 'alpha')) { $massaction = ''; } -$parameters = array('socid'=>$socid); +$parameters = array('socid' => $socid); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -353,7 +353,7 @@ if (empty($reshook)) { } } $filter['t.search_accounting_code_in'] = implode(',', $listofaccountsforgroup2); - $param .= '&search_account_category='.urlencode($search_account_category); + $param .= '&search_account_category='.urlencode((string) ($search_account_category)); } if (!empty($search_accountancy_code)) { $filter['t.numero_compte'] = $search_accountancy_code; @@ -395,7 +395,7 @@ if (empty($reshook)) { } if (!empty($search_mvt_num)) { $filter['t.piece_num'] = $search_mvt_num; - $param .= '&search_mvt_num='.urlencode($search_mvt_num); + $param .= '&search_mvt_num='.urlencode((string) ($search_mvt_num)); } if (!empty($search_date_creation_start)) { $filter['t.date_creation>='] = $search_date_creation_start; @@ -758,7 +758,7 @@ $arrayofselected = is_array($toselect) ? $toselect : array(); // Output page // -------------------------------------------------------------------- -$help_url ='EN:Module_Double_Entry_Accounting#Exports|FR:Module_Comptabilité_en_Partie_Double#Exports'; +$help_url = 'EN:Module_Double_Entry_Accounting#Exports|FR:Module_Comptabilité_en_Partie_Double#Exports'; llxHeader('', $title_page, $help_url); @@ -776,7 +776,7 @@ if ($action == 'export_file') { 'morecss' => 'minwidth200 maxwidth200' ); - $form_question['separator0'] = array('name'=>'separator0', 'type'=>'separator'); + $form_question['separator0'] = array('name' => 'separator0', 'type' => 'separator'); if (getDolGlobalInt("ACCOUNTING_ENABLE_LETTERING")) { // If 1, we check by default. @@ -788,7 +788,7 @@ if ($action == 'export_file') { 'value' => $checked, ); - $form_question['separator1'] = array('name'=>'separator1', 'type'=>'separator'); + $form_question['separator1'] = array('name' => 'separator1', 'type' => 'separator'); } // If 1 or not set, we check by default. @@ -800,7 +800,7 @@ if ($action == 'export_file') { 'value' => (getDolGlobalString('ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE') ? 'false' : 'true'), ); - $form_question['separator2'] = array('name'=>'separator2', 'type'=>'separator'); + $form_question['separator2'] = array('name' => 'separator2', 'type' => 'separator'); if (!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")) { // If 0 or not set, we NOT check by default. @@ -812,7 +812,7 @@ if ($action == 'export_file') { 'value' => $checked, ); - $form_question['separator3'] = array('name'=>'separator3', 'type'=>'separator'); + $form_question['separator3'] = array('name' => 'separator3', 'type' => 'separator'); } // add documents in an archive for accountancy export (Quadratus) @@ -1016,7 +1016,7 @@ if (!empty($arrayfields['t.lettering_code']['checked'])) { } // Fields from hook -$parameters = array('arrayfields'=>$arrayfields); +$parameters = array('arrayfields' => $arrayfields); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; @@ -1113,7 +1113,7 @@ if (!empty($arrayfields['t.lettering_code']['checked'])) { print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, '', $sortfield, $sortorder, 'center '); } // Hook fields -$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); +$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (!empty($arrayfields['t.date_creation']['checked'])) { @@ -1363,7 +1363,7 @@ while ($i < min($num, $limit)) { } // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $parameters = array('arrayfields' => $arrayfields, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; @@ -1442,7 +1442,7 @@ if ($num == 0) { print ''.$langs->trans("NoRecordFound").''; } -$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); +$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql); $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; From 1cc4a8de0f14e0cc23a2bc5cddaaeffe48f2d822 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:47:43 +0100 Subject: [PATCH 028/709] Fix: Ensure string type for urlencode() --- htdocs/accountancy/bookkeeping/list.php | 44 ++++++++++++------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 06921fc9d38..cd17fd8d40e 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -184,21 +184,21 @@ if (!in_array($action, array('delmouv', 'delmouvconfirm')) && !GETPOSTISSET('beg $arrayfields = array( - 't.piece_num'=>array('label'=>$langs->trans("TransactionNumShort"), 'checked'=>1), - 't.code_journal'=>array('label'=>$langs->trans("Codejournal"), 'checked'=>1), - 't.doc_date'=>array('label'=>$langs->trans("Docdate"), 'checked'=>1), - 't.doc_ref'=>array('label'=>$langs->trans("Piece"), 'checked'=>1), - 't.numero_compte'=>array('label'=>$langs->trans("AccountAccountingShort"), 'checked'=>1), - 't.subledger_account'=>array('label'=>$langs->trans("SubledgerAccount"), 'checked'=>1), - 't.label_operation'=>array('label'=>$langs->trans("Label"), 'checked'=>1), - 't.debit'=>array('label'=>$langs->trans("AccountingDebit"), 'checked'=>1), - 't.credit'=>array('label'=>$langs->trans("AccountingCredit"), 'checked'=>1), - 't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1), - 't.date_creation'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0), - 't.tms'=>array('label'=>$langs->trans("DateModification"), 'checked'=>0), - 't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>0), - 't.date_validated'=>array('label'=>$langs->trans("DateValidationAndLock"), 'checked'=>0, 'enabled'=>!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")), - 't.import_key'=>array('label'=>$langs->trans("ImportId"), 'checked'=>0, 'position'=>1100), + 't.piece_num' => array('label' => $langs->trans("TransactionNumShort"), 'checked' => 1), + 't.code_journal' => array('label' => $langs->trans("Codejournal"), 'checked' => 1), + 't.doc_date' => array('label' => $langs->trans("Docdate"), 'checked' => 1), + 't.doc_ref' => array('label' => $langs->trans("Piece"), 'checked' => 1), + 't.numero_compte' => array('label' => $langs->trans("AccountAccountingShort"), 'checked' => 1), + 't.subledger_account' => array('label' => $langs->trans("SubledgerAccount"), 'checked' => 1), + 't.label_operation' => array('label' => $langs->trans("Label"), 'checked' => 1), + 't.debit' => array('label' => $langs->trans("AccountingDebit"), 'checked' => 1), + 't.credit' => array('label' => $langs->trans("AccountingCredit"), 'checked' => 1), + 't.lettering_code' => array('label' => $langs->trans("LetteringCode"), 'checked' => 1), + 't.date_creation' => array('label' => $langs->trans("DateCreation"), 'checked' => 0), + 't.tms' => array('label' => $langs->trans("DateModification"), 'checked' => 0), + 't.date_export' => array('label' => $langs->trans("DateExport"), 'checked' => 0), + 't.date_validated' => array('label' => $langs->trans("DateValidationAndLock"), 'checked' => 0, 'enabled' => !getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")), + 't.import_key' => array('label' => $langs->trans("ImportId"), 'checked' => 0, 'position' => 1100), ); if (!getDolGlobalString('ACCOUNTING_ENABLE_LETTERING')) { @@ -232,7 +232,7 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'preunletteringauto $massaction = ''; } -$parameters = array('socid'=>$socid); +$parameters = array('socid' => $socid); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -341,7 +341,7 @@ if (empty($reshook)) { } } $filter['t.search_accounting_code_in'] = implode(',', $listofaccountsforgroup2); - $param .= '&search_account_category='.urlencode($search_account_category); + $param .= '&search_account_category='.urlencode((string) ($search_account_category)); } if (!empty($search_accountancy_code)) { $filter['t.numero_compte'] = $search_accountancy_code; @@ -383,7 +383,7 @@ if (empty($reshook)) { } if (!empty($search_mvt_num)) { $filter['t.piece_num'] = $search_mvt_num; - $param .= '&search_mvt_num='.urlencode($search_mvt_num); + $param .= '&search_mvt_num='.urlencode((string) ($search_mvt_num)); } if (!empty($search_date_creation_start)) { $filter['t.date_creation>='] = $search_date_creation_start; @@ -916,7 +916,7 @@ if (!empty($arrayfields['t.lettering_code']['checked'])) { } // Fields from hook -$parameters = array('arrayfields'=>$arrayfields); +$parameters = array('arrayfields' => $arrayfields); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; @@ -1013,7 +1013,7 @@ if (!empty($arrayfields['t.lettering_code']['checked'])) { print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, '', $sortfield, $sortorder, 'center '); } // Hook fields -$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); +$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (!empty($arrayfields['t.date_creation']['checked'])) { @@ -1263,7 +1263,7 @@ while ($i < min($num, $limit)) { } // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $parameters = array('arrayfields' => $arrayfields, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; @@ -1342,7 +1342,7 @@ if ($num == 0) { print ''.$langs->trans("NoRecordFound").''; } -$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); +$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql); $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; From f519faa2610a0ef7549edeec15e33a43e04099d0 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:47:45 +0100 Subject: [PATCH 029/709] Fix: Ensure string type for urlencode() --- .../accountancy/bookkeeping/listbyaccount.php | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 4a39d78e5ef..40b7599040c 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -159,18 +159,18 @@ if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('searc $arrayfields = array( // 't.subledger_account'=>array('label'=>$langs->trans("SubledgerAccount"), 'checked'=>1), - 't.piece_num'=>array('label'=>$langs->trans("TransactionNumShort"), 'checked'=>1), - 't.code_journal'=>array('label'=>$langs->trans("Codejournal"), 'checked'=>1), - 't.doc_date'=>array('label'=>$langs->trans("Docdate"), 'checked'=>1), - 't.doc_ref'=>array('label'=>$langs->trans("Piece"), 'checked'=>1), - 't.label_operation'=>array('label'=>$langs->trans("Label"), 'checked'=>1), - 't.lettering_code'=>array('label'=>$langs->trans("Lettering"), 'checked'=>1), - 't.debit'=>array('label'=>$langs->trans("AccountingDebit"), 'checked'=>1), - 't.credit'=>array('label'=>$langs->trans("AccountingCredit"), 'checked'=>1), - 't.balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1), - 't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>-1), - 't.date_validated'=>array('label'=>$langs->trans("DateValidation"), 'checked'=>-1, 'enabled'=>!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")), - 't.import_key'=>array('label'=>$langs->trans("ImportId"), 'checked'=>-1, 'position'=>1100), + 't.piece_num' => array('label' => $langs->trans("TransactionNumShort"), 'checked' => 1), + 't.code_journal' => array('label' => $langs->trans("Codejournal"), 'checked' => 1), + 't.doc_date' => array('label' => $langs->trans("Docdate"), 'checked' => 1), + 't.doc_ref' => array('label' => $langs->trans("Piece"), 'checked' => 1), + 't.label_operation' => array('label' => $langs->trans("Label"), 'checked' => 1), + 't.lettering_code' => array('label' => $langs->trans("Lettering"), 'checked' => 1), + 't.debit' => array('label' => $langs->trans("AccountingDebit"), 'checked' => 1), + 't.credit' => array('label' => $langs->trans("AccountingCredit"), 'checked' => 1), + 't.balance' => array('label' => $langs->trans("Balance"), 'checked' => 1), + 't.date_export' => array('label' => $langs->trans("DateExport"), 'checked' => -1), + 't.date_validated' => array('label' => $langs->trans("DateValidation"), 'checked' => -1, 'enabled' => !getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")), + 't.import_key' => array('label' => $langs->trans("ImportId"), 'checked' => -1, 'position' => 1100), ); if (!getDolGlobalString('ACCOUNTING_ENABLE_LETTERING')) { @@ -217,7 +217,7 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'preunletteringauto $massaction = ''; } -$parameters = array('socid'=>$socid); +$parameters = array('socid' => $socid); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -296,7 +296,7 @@ if (empty($reshook)) { } } $filter['t.search_accounting_code_in'] = implode(',', $listofaccountsforgroup2); - $param .= '&search_account_category='.urlencode($search_account_category); + $param .= '&search_account_category='.urlencode((string) ($search_account_category)); } if (!empty($search_accountancy_code_start)) { if ($type == 'sub') { @@ -320,7 +320,7 @@ if (empty($reshook)) { } if (!empty($search_mvt_num)) { $filter['t.piece_num'] = $search_mvt_num; - $param .= '&search_mvt_num='.urlencode($search_mvt_num); + $param .= '&search_mvt_num='.urlencode((string) ($search_mvt_num)); } if (!empty($search_doc_ref)) { $filter['t.doc_ref'] = $search_doc_ref; @@ -897,7 +897,7 @@ if (!empty($arrayfields['t.import_key']['checked'])) { } // Fields from hook -$parameters = array('arrayfields'=>$arrayfields); +$parameters = array('arrayfields' => $arrayfields); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; @@ -951,7 +951,7 @@ if (!empty($arrayfields['t.import_key']['checked'])) { print_liste_field_titre($arrayfields['t.import_key']['label'], $_SERVER["PHP_SELF"], "t.import_key", "", $param, '', $sortfield, $sortorder, 'center '); } // Hook fields -$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); +$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { @@ -1071,7 +1071,7 @@ while ($i < min($num, $limit)) { // Show the break account print ''; - print ''; + print ''; if ($type == 'sub') { if ($line->subledger_account != "" && $line->subledger_account != '-1') { print empty($line->subledger_label) ? ''.$langs->trans("Unknown").'' : $line->subledger_label; @@ -1227,7 +1227,7 @@ while ($i < min($num, $limit)) { if (strlen(length_accounta($line->subledger_account)) == 0) { print ''.dol_escape_htmltag($line->label_operation).''; } else { - print '('.length_accounta($line->subledger_account).')').'">'.dol_escape_htmltag($line->label_operation).($line->label_operation?'
':'').'('.dol_escape_htmltag(length_accounta($line->subledger_account)).')'; + print '('.length_accounta($line->subledger_account).')').'">'.dol_escape_htmltag($line->label_operation).($line->label_operation ? '
' : '').'('.dol_escape_htmltag(length_accounta($line->subledger_account)).')'; } if (!$i) { $totalarray['nbfield']++; @@ -1302,7 +1302,7 @@ while ($i < min($num, $limit)) { } // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$line); + $parameters = array('arrayfields' => $arrayfields, 'obj' => $line); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; @@ -1387,7 +1387,7 @@ if ($num == 0) { print ''.$langs->trans("NoRecordFound").''; } -$parameters = array('arrayfields'=>$arrayfields); +$parameters = array('arrayfields' => $arrayfields); $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; From 8a863da25665d665d252c4889505544720675ba5 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:47:47 +0100 Subject: [PATCH 030/709] Fix: Ensure string type for urlencode() --- htdocs/accountancy/class/accountingaccount.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 500fd4a7543..1f954f6a9ad 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -501,7 +501,7 @@ class AccountingAccount extends CommonObject $url = DOL_URL_ROOT . '/accountancy/bookkeeping/list.php?search_accountancy_code_start=' . urlencode($this->account_number) . '&search_accountancy_code_end=' . urlencode($this->account_number); $labelurl = $langs->trans("ShowAccountingAccountInJournals"); } elseif ($option == 'accountcard') { - $url = DOL_URL_ROOT . '/accountancy/admin/card.php?id=' . urlencode($this->id); + $url = DOL_URL_ROOT . '/accountancy/admin/card.php?id=' . urlencode((string) ($this->id)); $labelurl = $langs->trans("ShowAccountingAccount"); } @@ -570,7 +570,7 @@ class AccountingAccount extends CommonObject } global $action; $hookmanager->initHooks(array($this->element . 'dao')); - $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $parameters = array('id' => $this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; @@ -745,7 +745,7 @@ class AccountingAccount extends CommonObject $hookmanager->initHooks(array('accountancyBindingCalculation')); // Execute hook accountancyBindingCalculation - $parameters = array('buyer' => $buyer, 'seller' => $seller, 'product' => $product, 'facture' => $facture, 'factureDet' => $factureDet ,'accountingAccount'=>$accountingAccount, $type); + $parameters = array('buyer' => $buyer, 'seller' => $seller, 'product' => $product, 'facture' => $facture, 'factureDet' => $factureDet ,'accountingAccount' => $accountingAccount, $type); $reshook = $hookmanager->executeHooks('accountancyBindingCalculation', $parameters); // Note that $action and $object may have been modified by some hooks if (empty($reshook)) { From e47403cb3b3daf5cb498f2143b04496d1f119577 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:47:49 +0100 Subject: [PATCH 031/709] Fix: Ensure string type for urlencode() --- htdocs/accountancy/customer/lines.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 2aaed4ba014..a47a54ae40c 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -351,22 +351,22 @@ if ($result) { $param .= "&search_vat=".urlencode($search_vat); } if ($search_date_startday) { - $param .= '&search_date_startday='.urlencode($search_date_startday); + $param .= '&search_date_startday='.urlencode((string) ($search_date_startday)); } if ($search_date_startmonth) { - $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); + $param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth)); } if ($search_date_startyear) { - $param .= '&search_date_startyear='.urlencode($search_date_startyear); + $param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear)); } if ($search_date_endday) { - $param .= '&search_date_endday='.urlencode($search_date_endday); + $param .= '&search_date_endday='.urlencode((string) ($search_date_endday)); } if ($search_date_endmonth) { - $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + $param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth)); } if ($search_date_endyear) { - $param .= '&search_date_endyear='.urlencode($search_date_endyear); + $param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear)); } if ($search_country) { $param .= "&search_country=".urlencode($search_country); From a2936016cb2c09d4542843d65658f4d634a47926 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:47:51 +0100 Subject: [PATCH 032/709] Fix: Ensure string type for urlencode() --- htdocs/accountancy/customer/list.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index e7487c70e0f..84128d37f94 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -399,25 +399,25 @@ if ($result) { $param .= '&search_societe='.urlencode($search_societe); } if ($search_lineid) { - $param .= '&search_lineid='.urlencode($search_lineid); + $param .= '&search_lineid='.urlencode((string) ($search_lineid)); } if ($search_date_startday) { - $param .= '&search_date_startday='.urlencode($search_date_startday); + $param .= '&search_date_startday='.urlencode((string) ($search_date_startday)); } if ($search_date_startmonth) { - $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); + $param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth)); } if ($search_date_startyear) { - $param .= '&search_date_startyear='.urlencode($search_date_startyear); + $param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear)); } if ($search_date_endday) { - $param .= '&search_date_endday='.urlencode($search_date_endday); + $param .= '&search_date_endday='.urlencode((string) ($search_date_endday)); } if ($search_date_endmonth) { - $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + $param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth)); } if ($search_date_endyear) { - $param .= '&search_date_endyear='.urlencode($search_date_endyear); + $param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear)); } if ($search_invoice) { $param .= '&search_invoice='.urlencode($search_invoice); From 8e643dfb68592df93b5b7ae237447071fefe13cb Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:47:54 +0100 Subject: [PATCH 033/709] Fix: Ensure string type for urlencode() --- htdocs/accountancy/expensereport/lines.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php index 11602a58f1f..60f08f4992d 100644 --- a/htdocs/accountancy/expensereport/lines.php +++ b/htdocs/accountancy/expensereport/lines.php @@ -279,22 +279,22 @@ if ($result) { $param .= "&search_vat=".urlencode($search_vat); } if ($search_date_startday) { - $param .= '&search_date_startday='.urlencode($search_date_startday); + $param .= '&search_date_startday='.urlencode((string) ($search_date_startday)); } if ($search_date_startmonth) { - $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); + $param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth)); } if ($search_date_startyear) { - $param .= '&search_date_startyear='.urlencode($search_date_startyear); + $param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear)); } if ($search_date_endday) { - $param .= '&search_date_endday='.urlencode($search_date_endday); + $param .= '&search_date_endday='.urlencode((string) ($search_date_endday)); } if ($search_date_endmonth) { - $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + $param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth)); } if ($search_date_endyear) { - $param .= '&search_date_endyear='.urlencode($search_date_endyear); + $param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear)); } print ''."\n"; From e601eb1d9461715cbfaf8f8101a85740cbe1804d Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:47:56 +0100 Subject: [PATCH 034/709] Fix: Ensure string type for urlencode() --- htdocs/accountancy/expensereport/list.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index 73d9dd96cb1..9bb346e153a 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -327,22 +327,22 @@ if ($result) { $param .= '&search_lineid='.urlencode($search_lineid); } if ($search_date_startday) { - $param .= '&search_date_startday='.urlencode($search_date_startday); + $param .= '&search_date_startday='.urlencode((string) ($search_date_startday)); } if ($search_date_startmonth) { - $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); + $param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth)); } if ($search_date_startyear) { - $param .= '&search_date_startyear='.urlencode($search_date_startyear); + $param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear)); } if ($search_date_endday) { - $param .= '&search_date_endday='.urlencode($search_date_endday); + $param .= '&search_date_endday='.urlencode((string) ($search_date_endday)); } if ($search_date_endmonth) { - $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + $param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth)); } if ($search_date_endyear) { - $param .= '&search_date_endyear='.urlencode($search_date_endyear); + $param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear)); } if ($search_expensereport) { $param .= '&search_expensereport='.urlencode($search_expensereport); From b99710144126f82bbbb4e6f086e572ffd9224510 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:47:58 +0100 Subject: [PATCH 035/709] Fix: Ensure string type for urlencode() --- htdocs/accountancy/supplier/lines.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 09c7aca7af7..16d1d3d0202 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -359,22 +359,22 @@ if ($result) { $param .= "&search_vat=".urlencode($search_vat); } if ($search_date_startday) { - $param .= '&search_date_startday='.urlencode($search_date_startday); + $param .= '&search_date_startday='.urlencode((string) ($search_date_startday)); } if ($search_date_startmonth) { - $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); + $param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth)); } if ($search_date_startyear) { - $param .= '&search_date_startyear='.urlencode($search_date_startyear); + $param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear)); } if ($search_date_endday) { - $param .= '&search_date_endday='.urlencode($search_date_endday); + $param .= '&search_date_endday='.urlencode((string) ($search_date_endday)); } if ($search_date_endmonth) { - $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + $param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth)); } if ($search_date_endyear) { - $param .= '&search_date_endyear='.urlencode($search_date_endyear); + $param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear)); } if ($search_country) { $param .= "&search_country=".urlencode($search_country); From 127af1cf60ba3616735cf9dafa771b231491a72a Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:48:00 +0100 Subject: [PATCH 036/709] Fix: Ensure string type for urlencode() --- htdocs/accountancy/supplier/list.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index db16688ff31..b086cdd1914 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -403,25 +403,25 @@ if ($result) { $param .= '&search_societe='.urlencode($search_societe); } if ($search_lineid) { - $param .= '&search_lineid='.urlencode($search_lineid); + $param .= '&search_lineid='.urlencode((string) ($search_lineid)); } if ($search_date_startday) { - $param .= '&search_date_startday='.urlencode($search_date_startday); + $param .= '&search_date_startday='.urlencode((string) ($search_date_startday)); } if ($search_date_startmonth) { - $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); + $param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth)); } if ($search_date_startyear) { - $param .= '&search_date_startyear='.urlencode($search_date_startyear); + $param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear)); } if ($search_date_endday) { - $param .= '&search_date_endday='.urlencode($search_date_endday); + $param .= '&search_date_endday='.urlencode((string) ($search_date_endday)); } if ($search_date_endmonth) { - $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + $param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth)); } if ($search_date_endyear) { - $param .= '&search_date_endyear='.urlencode($search_date_endyear); + $param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear)); } if ($search_invoice) { $param .= '&search_invoice='.urlencode($search_invoice); From da0b05c15e7d862811760e794e2ba2fc03f54b1c Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:48:03 +0100 Subject: [PATCH 037/709] Fix: Ensure string type for urlencode() --- htdocs/adherents/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 7ce26e570c7..e8d85f21c76 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -670,7 +670,7 @@ if ($search_email) { $param .= "&search_email=".urlencode($search_email); } if ($search_categ > 0 || $search_categ == -2) { - $param .= "&search_categ=".urlencode($search_categ); + $param .= "&search_categ=".urlencode((string) ($search_categ)); } if ($search_company) { $param .= "&search_company=".urlencode($search_company); From 51373075de205263467a1eaa45d5557fd74e37e7 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:48:07 +0100 Subject: [PATCH 038/709] Fix: Ensure string type for urlencode() --- htdocs/adherents/subscription/list.php | 44 +++++++++++++------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index efd6c1b1c47..3a99f379502 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -89,20 +89,20 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen $fieldstosearchall = array( ); $arrayfields = array( - 'd.ref'=>array('label'=>"Ref", 'checked'=>1), - 'd.fk_type'=>array('label'=>"Type", 'checked'=>1), - 'd.lastname'=>array('label'=>"Lastname", 'checked'=>1), - 'd.firstname'=>array('label'=>"Firstname", 'checked'=>1), - 'd.login'=>array('label'=>"Login", 'checked'=>1), - 't.libelle'=>array('label'=>"Label", 'checked'=>1), - 'd.bank'=>array('label'=>"BankAccount", 'checked'=>1, 'enabled'=>(isModEnabled('bank'))), + 'd.ref' => array('label' => "Ref", 'checked' => 1), + 'd.fk_type' => array('label' => "Type", 'checked' => 1), + 'd.lastname' => array('label' => "Lastname", 'checked' => 1), + 'd.firstname' => array('label' => "Firstname", 'checked' => 1), + 'd.login' => array('label' => "Login", 'checked' => 1), + 't.libelle' => array('label' => "Label", 'checked' => 1), + 'd.bank' => array('label' => "BankAccount", 'checked' => 1, 'enabled' => (isModEnabled('bank'))), /*'d.note_public'=>array('label'=>"NotePublic", 'checked'=>0), 'd.note_private'=>array('label'=>"NotePrivate", 'checked'=>0),*/ - 'c.dateadh'=>array('label'=>"DateSubscription", 'checked'=>1, 'position'=>100), - 'c.datef'=>array('label'=>"EndSubscription", 'checked'=>1, 'position'=>101), - 'd.amount'=>array('label'=>"Amount", 'checked'=>1, 'position'=>102), - 'c.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500), - 'c.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500), + 'c.dateadh' => array('label' => "DateSubscription", 'checked' => 1, 'position' => 100), + 'c.datef' => array('label' => "EndSubscription", 'checked' => 1, 'position' => 101), + 'd.amount' => array('label' => "Amount", 'checked' => 1, 'position' => 102), + 'c.datec' => array('label' => "DateCreation", 'checked' => 0, 'position' => 500), + 'c.tms' => array('label' => "DateModificationShort", 'checked' => 0, 'position' => 500), // 'd.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000) ); @@ -124,7 +124,7 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa $massaction = ''; } -$parameters = array('socid'=>isset($socid) ? $socid : null); +$parameters = array('socid' => isset($socid) ? $socid : null); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -298,7 +298,7 @@ $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; if (!empty($mode)) { - $param .='&mode='.urlencode($mode); + $param .= '&mode='.urlencode($mode); } if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); @@ -322,7 +322,7 @@ if ($search_login) { $param .= "&search_login=".urlencode($search_login); } if ($search_account) { - $param .= "&search_account=".urlencode($search_account); + $param .= "&search_account=".urlencode((string) ($search_account)); } if ($search_amount) { $param .= "&search_amount=".urlencode($search_amount); @@ -366,8 +366,8 @@ print ''; print ''; $newcardbutton = ''; -$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); -$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss' => 'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss' => 'reposition')); if ($user->hasRight('adherent', 'cotisation', 'creer')) { $newcardbutton .= dolGetButtonTitleSeparator(); $newcardbutton .= dolGetButtonTitle($langs->trans('NewSubscription'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/list.php?status=-1,1'); @@ -492,7 +492,7 @@ if (!empty($arrayfields['d.amount']['checked'])) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook -$parameters = array('arrayfields'=>$arrayfields); +$parameters = array('arrayfields' => $arrayfields); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation @@ -571,7 +571,7 @@ if (!empty($arrayfields['d.amount']['checked'])) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields -$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray); +$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (!empty($arrayfields['c.datec']['checked'])) { @@ -647,7 +647,7 @@ while ($i < $imaxinloop) { $accountstatic->fetch($obj->fk_account); } // Output Kanban - print $subscription->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected), 'adherent_type' => $adht, 'member' => $adherent, 'bank'=>($obj->fk_account > 0 ? $accountstatic : null))); + print $subscription->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected), 'adherent_type' => $adht, 'member' => $adherent, 'bank' => ($obj->fk_account > 0 ? $accountstatic : null))); if ($i == ($imaxinloop - 1)) { print ''; print ''; @@ -770,7 +770,7 @@ while ($i < $imaxinloop) { // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $parameters = array('arrayfields' => $arrayfields, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation @@ -829,7 +829,7 @@ if ($num == 0) { $db->free($resql); -$parameters = array('arrayfields'=>$arrayfields, 'sql' => $sql); +$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql); $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; From 136646c96d82a427cb758facbc194dc1c8a265e4 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:48:10 +0100 Subject: [PATCH 039/709] Fix: Ensure string type for urlencode() --- htdocs/adherents/type.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 738ee68c23b..54742217778 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -190,7 +190,7 @@ if ($action == 'update' && $user->hasRight('adherent', 'configurer')) { $object->oldcopy = dol_clone($object, 2); - $object->label= trim($label); + $object->label = trim($label); $object->morphy = trim($morphy); $object->status = (int) $status; $object->subscription = (int) $subscription; @@ -277,8 +277,8 @@ if (!$rowid && $action != 'create' && $action != 'edit') { $newcardbutton = ''; - $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); - $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss' => 'reposition')); + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss' => 'reposition')); if ($user->hasRight('adherent', 'configurer')) { $newcardbutton .= dolGetButtonTitleSeparator(); @@ -379,9 +379,9 @@ if (!$rowid && $action != 'create' && $action != 'edit') { if ($objp->duration) { $duration_value = intval($objp->duration); if ($duration_value > 1) { - $dur = array("i"=>$langs->trans("Minutes"), "h"=>$langs->trans("Hours"), "d"=>$langs->trans("Days"), "w"=>$langs->trans("Weeks"), "m"=>$langs->trans("Months"), "y"=>$langs->trans("Years")); + $dur = array("i" => $langs->trans("Minutes"), "h" => $langs->trans("Hours"), "d" => $langs->trans("Days"), "w" => $langs->trans("Weeks"), "m" => $langs->trans("Months"), "y" => $langs->trans("Years")); } else { - $dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hour"), "d"=>$langs->trans("Day"), "w"=>$langs->trans("Week"), "m"=>$langs->trans("Month"), "y"=>$langs->trans("Year")); + $dur = array("i" => $langs->trans("Minute"), "h" => $langs->trans("Hour"), "d" => $langs->trans("Day"), "w" => $langs->trans("Week"), "m" => $langs->trans("Month"), "y" => $langs->trans("Year")); } $unit = preg_replace("/[^a-zA-Z]+/", "", $objp->duration); print max(1, $duration_value).' '.$dur[$unit]; @@ -441,7 +441,7 @@ if ($action == 'create') { print ''.$langs->trans("Label").''; print ''.$langs->trans("Status").''; - print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), 1, 0, 0, 0, '', 0, 0, 0, '', 'minwidth100'); + print $form->selectarray('status', array('0' => $langs->trans('ActivityCeased'), '1' => $langs->trans('InActivity')), 1, 0, 0, 0, '', 0, 0, 0, '', 'minwidth100'); print ''; // Morphy @@ -548,9 +548,9 @@ if ($rowid > 0) { print ''.$langs->trans("Duration").''.$object->duration_value.' '; if ($object->duration_value > 1) { - $dur = array("i"=>$langs->trans("Minutes"), "h"=>$langs->trans("Hours"), "d"=>$langs->trans("Days"), "w"=>$langs->trans("Weeks"), "m"=>$langs->trans("Months"), "y"=>$langs->trans("Years")); + $dur = array("i" => $langs->trans("Minutes"), "h" => $langs->trans("Hours"), "d" => $langs->trans("Days"), "w" => $langs->trans("Weeks"), "m" => $langs->trans("Months"), "y" => $langs->trans("Years")); } elseif ($object->duration_value > 0) { - $dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hour"), "d"=>$langs->trans("Day"), "w"=>$langs->trans("Week"), "m"=>$langs->trans("Month"), "y"=>$langs->trans("Year")); + $dur = array("i" => $langs->trans("Minute"), "h" => $langs->trans("Hour"), "d" => $langs->trans("Day"), "w" => $langs->trans("Week"), "m" => $langs->trans("Month"), "y" => $langs->trans("Year")); } print(!empty($object->duration_unit) && isset($dur[$object->duration_unit]) ? $langs->trans($dur[$object->duration_unit]) : '')." "; print ''; @@ -592,7 +592,7 @@ if ($rowid > 0) { $morphy = ''; } - if ($user->hasRight('adherent', 'configurer')&& !empty($object->status)) { + if ($user->hasRight('adherent', 'configurer') && !empty($object->status)) { print ''; } else { print ''; @@ -712,7 +712,7 @@ if ($rowid > 0) { $titre .= " (".$membertype->label.")"; } - $param = "&rowid=".urlencode($object->id); + $param = "&rowid=".urlencode((string) ($object->id)); if (!empty($mode)) { $param .= '&mode='.urlencode($mode); } @@ -956,7 +956,7 @@ if ($rowid > 0) { print ''.$langs->trans("Label").''; print ''.$langs->trans("Status").''; - print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), $object->status, 0, 0, 0, '', 0, 0, 0, '', 'minwidth100'); + print $form->selectarray('status', array('0' => $langs->trans('ActivityCeased'), '1' => $langs->trans('InActivity')), $object->status, 0, 0, 0, '', 0, 0, 0, '', 'minwidth100'); print ''; // Morphy From 3b439c81a135b4b69fa7d8412b4bb2815b4ceed7 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:48:14 +0100 Subject: [PATCH 040/709] Fix: Ensure string type for urlencode() --- htdocs/admin/dict.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 0ca6a21bfe2..011a66e4a1d 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1227,9 +1227,9 @@ if ($id == 7 && GETPOST('from') == 'accountancy') { $titlepicto = 'accountancy'; } -$param = '&id='.urlencode($id); +$param = '&id='.urlencode((string) ($id)); if ($search_country_id || GETPOSTISSET('page') || GETPOST('button_removefilter', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter_x', 'alpha')) { - $param .= '&search_country_id='.urlencode($search_country_id ? $search_country_id : -1); + $param .= '&search_country_id='.urlencode((string) ($search_country_id ? $search_country_id : -1)); } if ($search_code != '') { $param .= '&search_code='.urlencode($search_code); From 084c2106f65b0877d39aedb6df20d5e14de986ac Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:48:17 +0100 Subject: [PATCH 041/709] Fix: Ensure string type for urlencode() --- htdocs/admin/dolistore/class/dolistore.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/dolistore/class/dolistore.class.php b/htdocs/admin/dolistore/class/dolistore.class.php index 2fee52df32b..ac2e3c2ea46 100644 --- a/htdocs/admin/dolistore/class/dolistore.class.php +++ b/htdocs/admin/dolistore/class/dolistore.class.php @@ -68,7 +68,7 @@ class Dolistore $langtmp = explode('_', $langs->defaultlang); $lang = $langtmp[0]; - $lang_array = array('en'=>1, 'fr'=>2, 'es'=>3, 'it'=>4, 'de'=>5); // Into table ps_lang of Prestashop - 1 + $lang_array = array('en' => 1, 'fr' => 2, 'es' => 3, 'it' => 4, 'de' => 5); // Into table ps_lang of Prestashop - 1 if (!in_array($lang, array_keys($lang_array))) { $lang = 'en'; } @@ -270,7 +270,7 @@ class Dolistore // add image or default ? if ($product->id_default_image != '') { - $image_url = DOL_URL_ROOT.'/admin/dolistore/ajax/image.php?id_product='.urlencode(((int) $product->id)).'&id_image='.urlencode(((int) $product->id_default_image)); + $image_url = DOL_URL_ROOT.'/admin/dolistore/ajax/image.php?id_product='.urlencode((string) (((int) $product->id))).'&id_image='.urlencode((string) (((int) $product->id_default_image))); $images = ''; $images .= ''; } else { From 2fb1242d14eb5caec1d2c68186918ede7a767abc Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:48:20 +0100 Subject: [PATCH 042/709] Fix: Ensure string type for urlencode() --- htdocs/admin/mails_senderprofile_list.php | 30 +++++++++++------------ 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/htdocs/admin/mails_senderprofile_list.php b/htdocs/admin/mails_senderprofile_list.php index 0f314ba993a..bcf786ec1b0 100644 --- a/htdocs/admin/mails_senderprofile_list.php +++ b/htdocs/admin/mails_senderprofile_list.php @@ -108,11 +108,11 @@ foreach ($object->fields as $key => $val) { if (!empty($val['visible'])) { $visible = (int) dol_eval($val['visible'], 1); $arrayfields['t.'.$key] = array( - 'label'=>$val['label'], - 'checked'=>(($visible < 0) ? 0 : 1), - 'enabled'=>(abs($visible) != 3 && (int) dol_eval($val['enabled'], 1)), - 'position'=>$val['position'], - 'help'=> isset($val['help']) ? $val['help'] : '' + 'label' => $val['label'], + 'checked' => (($visible < 0) ? 0 : 1), + 'enabled' => (abs($visible) != 3 && (int) dol_eval($val['enabled'], 1)), + 'position' => $val['position'], + 'help' => isset($val['help']) ? $val['help'] : '' ); } } @@ -121,10 +121,10 @@ if (!empty($extrafields->attributes[$object->table_element]['label']) && is_arra foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) { $arrayfields["ef.".$key] = array( - 'label'=>$extrafields->attributes[$object->table_element]['label'][$key], - 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), - 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], - 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]) + 'label' => $extrafields->attributes[$object->table_element]['label'][$key], + 'checked' => (($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), + 'position' => $extrafields->attributes[$object->table_element]['pos'][$key], + 'enabled' => (abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]) ); } } @@ -591,7 +591,7 @@ foreach ($object->fields as $key => $val) { // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook -$parameters = array('arrayfields'=>$arrayfields); +$parameters = array('arrayfields' => $arrayfields); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column @@ -635,7 +635,7 @@ foreach ($object->fields as $key => $val) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields -$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray); +$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column @@ -706,7 +706,7 @@ while ($i < $imaxinloop) { $url .= '&limit='.((int) $limit); } if ($page) { - $url .= '&page='.urlencode($page); + $url .= '&page='.urlencode((string) ($page)); } if ($sortfield) { $url .= '&sortfield='.urlencode($sortfield); @@ -783,7 +783,7 @@ while ($i < $imaxinloop) { // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; @@ -796,7 +796,7 @@ while ($i < $imaxinloop) { $url .= '&limit='.((int) $limit); } if ($page) { - $url .= '&page='.urlencode($page); + $url .= '&page='.urlencode((string) ($page)); } if ($sortfield) { $url .= '&sortfield='.urlencode($sortfield); @@ -845,7 +845,7 @@ if ($num == 0) { $db->free($resql); -$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); +$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql); $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; From 735d91fd1f27319fe93a1c6355f290f72f4e575e Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:48:24 +0100 Subject: [PATCH 043/709] Fix: Ensure string type for urlencode() --- htdocs/admin/tools/listevents.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index b1b1242ebcc..902239fca39 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -278,7 +278,7 @@ if ($result) { $param .= '&optioncss='.urlencode($optioncss); } if ($search_rowid) { - $param .= '&search_rowid='.urlencode($search_rowid); + $param .= '&search_rowid='.urlencode((string) ($search_rowid)); } if ($search_code) { $param .= '&search_code='.urlencode($search_code); From 12fe3dd647ef18877406a7002681b49028fcfa9a Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:48:26 +0100 Subject: [PATCH 044/709] Fix: Ensure string type for urlencode() --- htdocs/asset/agenda.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/asset/agenda.php b/htdocs/asset/agenda.php index f25da35dd6a..56e33e2e317 100644 --- a/htdocs/asset/agenda.php +++ b/htdocs/asset/agenda.php @@ -99,7 +99,7 @@ if (!isModEnabled('asset')) { * Actions */ -$parameters = array('id'=>$id); +$parameters = array('id' => $id); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -167,14 +167,14 @@ if ($object->id > 0) { $objthirdparty = $object; $objcon = new stdClass(); - $out = '&origin=' . urlencode($object->element . '@' . $object->module) . '&originid=' . urlencode($object->id); + $out = '&origin=' . urlencode((string) ($object->element . '@' . $object->module)) . '&originid=' . urlencode((string) ($object->id)); $urlbacktopage = $_SERVER['PHP_SELF'] . '?id=' . $object->id; $out .= '&backtopage=' . urlencode($urlbacktopage); $permok = $user->hasRight('agenda', 'myactions', 'create'); if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) { //$out.=' Date: Fri, 8 Mar 2024 02:48:30 +0100 Subject: [PATCH 045/709] Fix: Ensure string type for urlencode() --- htdocs/asset/model/agenda.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/asset/model/agenda.php b/htdocs/asset/model/agenda.php index ff190403410..1eb0a2e850a 100644 --- a/htdocs/asset/model/agenda.php +++ b/htdocs/asset/model/agenda.php @@ -173,14 +173,14 @@ if ($object->id > 0) { $objthirdparty = $object; $objcon = new stdClass(); - $out = '&origin=' . urlencode($object->element . '@' . $object->module) . '&originid=' . urlencode($object->id); + $out = '&origin=' . urlencode((string) ($object->element . '@' . $object->module)) . '&originid=' . urlencode((string) ($object->id)); $urlbacktopage = $_SERVER['PHP_SELF'] . '?id=' . $object->id; $out .= '&backtopage=' . urlencode($urlbacktopage); $permok = $user->hasRight('agenda', 'myactions', 'create'); if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) { //$out.=' Date: Fri, 8 Mar 2024 02:48:32 +0100 Subject: [PATCH 046/709] Fix: Ensure string type for urlencode() --- htdocs/blockedlog/admin/blockedlog_list.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index 305c34413e5..bb385e34984 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -298,7 +298,7 @@ if (GETPOST('withtab', 'alpha')) { } else { $title = $langs->trans("BrowseBlockedLog"); } -$help_url="EN:Module_Unalterable_Archives_-_Logs|FR:Module_Archives_-_Logs_Inaltérable"; +$help_url = "EN:Module_Unalterable_Archives_-_Logs|FR:Module_Archives_-_Logs_Inaltérable"; llxHeader('', $title, $help_url); @@ -353,16 +353,16 @@ if ($search_startday > 0) { $param .= '&search_startday='.urlencode($search_startday); } if ($search_endyear > 0) { - $param .= '&search_endyear='.urlencode($search_endyear); + $param .= '&search_endyear='.urlencode((string) ($search_endyear)); } if ($search_endmonth > 0) { - $param .= '&search_endmonth='.urlencode($search_endmonth); + $param .= '&search_endmonth='.urlencode((string) ($search_endmonth)); } if ($search_endday > 0) { - $param .= '&search_endday='.urlencode($search_endday); + $param .= '&search_endday='.urlencode((string) ($search_endday)); } if ($search_showonlyerrors > 0) { - $param .= '&search_showonlyerrors='.urlencode($search_showonlyerrors); + $param .= '&search_showonlyerrors='.urlencode((string) ($search_showonlyerrors)); } if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); From 5fd975e60c7bc31afe2165f796d51ed5c2a5c133 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:48:35 +0100 Subject: [PATCH 047/709] Fix: Ensure string type for urlencode() --- htdocs/bookcal/availabilities_agenda.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/bookcal/availabilities_agenda.php b/htdocs/bookcal/availabilities_agenda.php index ac313e7b699..5c29e0c45cc 100644 --- a/htdocs/bookcal/availabilities_agenda.php +++ b/htdocs/bookcal/availabilities_agenda.php @@ -113,7 +113,7 @@ if (!$permissiontoread) { * Actions */ -$parameters = array('id'=>$id); +$parameters = array('id' => $id); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -218,14 +218,14 @@ if ($object->id > 0) { $objthirdparty = $object; $objcon = new stdClass(); - $out = '&origin='.urlencode($object->element.'@'.$object->module).'&originid='.urlencode($object->id); + $out = '&origin='.urlencode((string) ($object->element.'@'.$object->module)).'&originid='.urlencode((string) ($object->id)); $urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id; $out .= '&backtopage='.urlencode($urlbacktopage); $permok = $user->hasRight('agenda', 'myactions', 'create'); if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) { //$out.=' Date: Fri, 8 Mar 2024 02:48:37 +0100 Subject: [PATCH 048/709] Fix: Ensure string type for urlencode() --- htdocs/bookcal/calendar_agenda.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/bookcal/calendar_agenda.php b/htdocs/bookcal/calendar_agenda.php index 391c65e81ed..7ef31ec2c3e 100644 --- a/htdocs/bookcal/calendar_agenda.php +++ b/htdocs/bookcal/calendar_agenda.php @@ -113,7 +113,7 @@ if (!$permissiontoread) { * Actions */ -$parameters = array('id'=>$id); +$parameters = array('id' => $id); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -217,14 +217,14 @@ if ($object->id > 0) { $objthirdparty = $object; $objcon = new stdClass(); - $out = '&origin='.urlencode($object->element.(property_exists($object, 'module') ? '@'.$object->module : '')).'&originid='.urlencode($object->id); + $out = '&origin='.urlencode((string) ($object->element.(property_exists($object, 'module') ? '@'.$object->module : ''))).'&originid='.urlencode((string) ($object->id)); $urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id; $out .= '&backtopage='.urlencode($urlbacktopage); $permok = $user->hasRight('agenda', 'myactions', 'create'); if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) { //$out.=' Date: Fri, 8 Mar 2024 02:48:39 +0100 Subject: [PATCH 049/709] Fix: Ensure string type for urlencode() --- htdocs/comm/action/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 05229a9ab58..f23a3d4438b 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1800,7 +1800,7 @@ if ($id > 0) { // Confirmation suppression action if ($action == 'delete') { - print $form->formconfirm("card.php?id=".urlencode($id), $langs->trans("DeleteAction"), $langs->trans("ConfirmDeleteAction"), "confirm_delete", '', '', 1); + print $form->formconfirm("card.php?id=".urlencode((string) ($id)), $langs->trans("DeleteAction"), $langs->trans("ConfirmDeleteAction"), "confirm_delete", '', '', 1); } if ($action == 'edit') { From 9ca373b6996ac90eb89e763df7c1eb22ad678a85 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:48:41 +0100 Subject: [PATCH 050/709] Fix: Ensure string type for urlencode() --- htdocs/comm/action/index.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index f0843f3c990..68e6b4d7169 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -393,7 +393,7 @@ if ($actioncode || GETPOSTISSET('search_actioncode')) { } } if ($resourceid > 0) { - $param .= "&search_resourceid=".urlencode($resourceid); + $param .= "&search_resourceid=".urlencode((string) ($resourceid)); } if ($status || GETPOSTISSET('status') || GETPOSTISSET('search_status')) { $param .= "&search_status=".urlencode($status); @@ -405,26 +405,26 @@ if ($filtert) { $param .= "&search_filtert=".urlencode($filtert); } if ($usergroup > 0) { - $param .= "&search_usergroup=".urlencode($usergroup); + $param .= "&search_usergroup=".urlencode((string) ($usergroup)); } if ($socid > 0) { - $param .= "&search_socid=".urlencode($socid); + $param .= "&search_socid=".urlencode((string) ($socid)); } if ($showbirthday) { $param .= "&search_showbirthday=1"; } if ($pid) { - $param .= "&search_projectid=".urlencode($pid); + $param .= "&search_projectid=".urlencode((string) ($pid)); } if ($type) { $param .= "&search_type=".urlencode($type); } -$param .= "&maxprint=".urlencode($maxprint); +$param .= "&maxprint=".urlencode((string) ($maxprint)); if ($mode == 'show_day' || $mode == 'show_week' || $mode == 'show_month') { $param .= '&mode='.urlencode($mode); } if ($search_categ_cus != 0) { - $param .= '&search_categ_cus='.urlencode($search_categ_cus); + $param .= '&search_categ_cus='.urlencode((string) ($search_categ_cus)); } // Show navigation bar From f9a2ddf8c437b8833daacfbae713c0702f03740d Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:48:44 +0100 Subject: [PATCH 051/709] Fix: Ensure string type for urlencode() --- htdocs/comm/action/list.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 03efd125979..eff2e4b3708 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -316,7 +316,7 @@ if ($actioncode != '') { } } if ($resourceid > 0) { - $param .= "&search_resourceid=".urlencode($resourceid); + $param .= "&search_resourceid=".urlencode((string) ($resourceid)); } if ($search_status != '') { $param .= "&search_status=".urlencode($search_status); @@ -328,16 +328,16 @@ if ($filtert) { $param .= "&search_filtert=".urlencode($filtert); } if ($usergroup > 0) { - $param .= "&search_usergroup=".urlencode($usergroup); + $param .= "&search_usergroup=".urlencode((string) ($usergroup)); } if ($socid > 0) { - $param .= "&search_socid=".urlencode($socid); + $param .= "&search_socid=".urlencode((string) ($socid)); } if ($showbirthday) { $param .= "&search_showbirthday=1"; } if ($pid) { - $param .= "&search_projectid=".urlencode($pid); + $param .= "&search_projectid=".urlencode((string) ($pid)); } if ($type) { $param .= "&search_type=".urlencode($type); @@ -391,7 +391,7 @@ if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); } if ($search_categ_cus != 0) { - $param .= '&search_categ_cus='.urlencode($search_categ_cus); + $param .= '&search_categ_cus='.urlencode((string) ($search_categ_cus)); } // Add $param from extra fields From 9ed7f90fcafa6296b448c9e809b098e4e8304c21 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:48:46 +0100 Subject: [PATCH 052/709] Fix: Ensure string type for urlencode() --- htdocs/comm/action/pertype.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/comm/action/pertype.php b/htdocs/comm/action/pertype.php index f93373fc0f7..59c403323b5 100644 --- a/htdocs/comm/action/pertype.php +++ b/htdocs/comm/action/pertype.php @@ -286,7 +286,7 @@ if ($actioncode || GETPOSTISSET('search_actioncode')) { } } if ($resourceid > 0) { - $param .= "&search_resourceid=".urlencode($resourceid); + $param .= "&search_resourceid=".urlencode((string) ($resourceid)); } if ($status || GETPOSTISSET('status') || GETPOSTISSET('search_status')) { $param .= "&search_status=".urlencode($status); @@ -298,16 +298,16 @@ if ($filtert) { $param .= "&search_filtert=".urlencode($filtert); } if ($usergroup > 0) { - $param .= "&search_usergroup=".urlencode($usergroup); + $param .= "&search_usergroup=".urlencode((string) ($usergroup)); } if ($socid > 0) { - $param .= "&search_socid=".urlencode($socid); + $param .= "&search_socid=".urlencode((string) ($socid)); } if ($showbirthday) { $param .= "&search_showbirthday=1"; } if ($pid) { - $param .= "&search_projectid=".urlencode($pid); + $param .= "&search_projectid=".urlencode((string) ($pid)); } if ($type) { $param .= "&search_type=".urlencode($type); @@ -322,12 +322,12 @@ if ($end_h != '') { $param .= '&end_h='.urlencode($end_h); } if ($begin_d != '') { - $param .= '&begin_d='.urlencode($begin_d); + $param .= '&begin_d='.urlencode((string) ($begin_d)); } if ($end_d != '') { - $param .= '&end_d='.urlencode($end_d); + $param .= '&end_d='.urlencode((string) ($end_d)); } -$param .= "&maxprint=".urlencode($maxprint); +$param .= "&maxprint=".urlencode((string) ($maxprint)); $paramnoactionodate = $param; @@ -374,7 +374,7 @@ $nav .= $form->selectDate($dateselect, 'dateselect', 0, 0, 1, '', 1, 0); $nav .= ' '; // Must be after the nav definition -$param .= '&year='.urlencode($year).'&month='.urlencode($month).($day ? '&day='.urlencode($day) : ''); +$param .= '&year='.urlencode((string) ($year)).'&month='.urlencode((string) ($month)).($day ? '&day='.urlencode((string) ($day)) : ''); //print 'x'.$param; From 54f05cc69ec92db8b49b9b423d43c04cf1520a04 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:48:48 +0100 Subject: [PATCH 053/709] Fix: Ensure string type for urlencode() --- htdocs/comm/action/peruser.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 70b325ed45f..b847d042c0c 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -282,7 +282,7 @@ if ($actioncode || GETPOSTISSET('search_actioncode')) { } } if ($resourceid > 0) { - $param .= "&search_resourceid=".urlencode($resourceid); + $param .= "&search_resourceid=".urlencode((string) ($resourceid)); } if ($status || GETPOSTISSET('status') || GETPOSTISSET('search_status')) { @@ -295,16 +295,16 @@ if ($filtert) { $param .= "&search_filtert=".urlencode($filtert); } if ($usergroup > 0) { - $param .= "&search_usergroup=".urlencode($usergroup); + $param .= "&search_usergroup=".urlencode((string) ($usergroup)); } if ($socid > 0) { - $param .= "&search_socid=".urlencode($socid); + $param .= "&search_socid=".urlencode((string) ($socid)); } if ($showbirthday) { $param .= "&search_showbirthday=1"; } if ($pid) { - $param .= "&search_projectid=".urlencode($pid); + $param .= "&search_projectid=".urlencode((string) ($pid)); } if ($type) { $param .= "&search_type=".urlencode($type); @@ -325,9 +325,9 @@ if ($end_d != '') { $param .= '&end_d='.urlencode($end_d); } if ($search_categ_cus != 0) { - $param .= '&search_categ_cus='.urlencode($search_categ_cus); + $param .= '&search_categ_cus='.urlencode((string) ($search_categ_cus)); } -$param .= "&maxprint=".urlencode($maxprint); +$param .= "&maxprint=".urlencode((string) ($maxprint)); $paramnoactionodate = $param; @@ -377,7 +377,7 @@ $nav .= $form->selectDate($dateselect, 'dateselect', 0, 0, 1, '', 1, 0); $nav .= ' '; // Must be after the nav definition -$param .= '&year='.urlencode($year).'&month='.urlencode($month).($day ? '&day='.urlencode($day) : ''); +$param .= '&year='.urlencode((string) ($year)).'&month='.urlencode((string) ($month)).($day ? '&day='.urlencode((string) ($day)) : ''); //print 'x'.$param; From 014fb8d967566956f52fec3ba63ecf469772dd22 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:48:51 +0100 Subject: [PATCH 054/709] Fix: Ensure string type for urlencode() --- htdocs/comm/mailing/cibles.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 4096d3ae161..95ffc1f0c38 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -752,7 +752,7 @@ if ($object->fetch($id) >= 0) { print ''; if ($page) { - $param .= "&page=".urlencode($page); + $param .= "&page=".urlencode((string) ($page)); } print ''; From 448e4ae322c96f7b92aade033eb1902a8c28d88c Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:48:56 +0100 Subject: [PATCH 055/709] Fix: Ensure string type for urlencode() --- htdocs/comm/propal/agenda.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/propal/agenda.php b/htdocs/comm/propal/agenda.php index a61ed2e0270..1fe3cf6d5dd 100644 --- a/htdocs/comm/propal/agenda.php +++ b/htdocs/comm/propal/agenda.php @@ -96,7 +96,7 @@ restrictedArea($user, 'propal', $object->id, '', '', 'fk_soc', 'rowid', $isdraft * Actions */ -$parameters = array('id'=>$id); +$parameters = array('id' => $id); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -191,14 +191,14 @@ if ($object->id > 0) { $objthirdparty = $object; $objcon = new stdClass(); - $out = '&origin='.urlencode($object->element.(property_exists($object, 'module') ? '@'.$object->module : '')).'&originid='.urlencode($object->id); + $out = '&origin='.urlencode((string) ($object->element.(property_exists($object, 'module') ? '@'.$object->module : ''))).'&originid='.urlencode((string) ($object->id)); $urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id; $out .= '&backtopage='.urlencode($urlbacktopage); $permok = $user->hasRight('agenda', 'myactions', 'create'); if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) { //$out.=' Date: Fri, 8 Mar 2024 02:48:59 +0100 Subject: [PATCH 056/709] Fix: Ensure string type for urlencode() --- htdocs/comm/propal/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index cb2001fc399..d3c435bf195 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1963,7 +1963,7 @@ if ($action == 'create') { $thirdparty = $soc; $discount_type = 0; - $backtopage = $_SERVER["PHP_SELF"].'?socid='.$thirdparty->id.'&action='.$action.'&origin='.urlencode(GETPOST('origin')).'&originid='.urlencode(GETPOSTINT('originid')); + $backtopage = $_SERVER["PHP_SELF"].'?socid='.$thirdparty->id.'&action='.$action.'&origin='.urlencode((string) (GETPOST('origin'))).'&originid='.urlencode((string) (GETPOSTINT('originid'))); include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php'; print ''; } From 202cf1eb250c8a545a22954ff3b274e40d512140 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:49:02 +0100 Subject: [PATCH 057/709] Fix: Ensure string type for urlencode() --- htdocs/commande/agenda.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/commande/agenda.php b/htdocs/commande/agenda.php index 9ffb69fbb9c..af2a5da5594 100644 --- a/htdocs/commande/agenda.php +++ b/htdocs/commande/agenda.php @@ -96,7 +96,7 @@ restrictedArea($user, 'commande', $object->id, '', '', 'fk_soc', 'rowid', $isdra * Actions */ -$parameters = array('id'=>$id); +$parameters = array('id' => $id); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -191,14 +191,14 @@ if ($object->id > 0) { $objthirdparty = $object; $objcon = new stdClass(); - $out = '&origin='.urlencode($object->element.(property_exists($object, 'module') ? '@'.$object->module : '')).'&originid='.urlencode($object->id); + $out = '&origin='.urlencode((string) ($object->element.(property_exists($object, 'module') ? '@'.$object->module : ''))).'&originid='.urlencode((string) ($object->id)); $urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id; $out .= '&backtopage='.urlencode($urlbacktopage); $permok = $user->hasRight('agenda', 'myactions', 'create'); if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) { //$out.=' Date: Fri, 8 Mar 2024 02:49:05 +0100 Subject: [PATCH 058/709] Fix: Ensure string type for urlencode() --- htdocs/commande/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 11b3f049599..2bcfe9482e4 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1906,7 +1906,7 @@ if ($action == 'create' && $usercancreate) { $thirdparty = $soc; $discount_type = 0; - $backtopage = $_SERVER["PHP_SELF"].'?socid='.$thirdparty->id.'&action='.$action.'&origin='.urlencode(GETPOST('origin')).'&originid='.urlencode(GETPOSTINT('originid')); + $backtopage = $_SERVER["PHP_SELF"].'?socid='.$thirdparty->id.'&action='.$action.'&origin='.urlencode((string) (GETPOST('origin'))).'&originid='.urlencode((string) (GETPOSTINT('originid'))); include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php'; print ''; From d523528bc069d6c1e65b83dcf4e5b1a6e85249a4 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:49:08 +0100 Subject: [PATCH 059/709] Fix: Ensure string type for urlencode() --- htdocs/commande/list.php | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 54ba84705cb..003fdda6d09 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -592,7 +592,7 @@ if (empty($reshook)) { if ($nb_bills_created == 1) { $texttoshow = $langs->trans('BillXCreated', '{s1}'); - $texttoshow = str_replace('{s1}', ''.$lastref.'', $texttoshow); + $texttoshow = str_replace('{s1}', ''.$lastref.'', $texttoshow); setEventMessages($texttoshow, null, 'mesgs'); } else { setEventMessages($langs->trans('BillCreated', $nb_bills_created), null, 'mesgs'); @@ -616,10 +616,10 @@ if (empty($reshook)) { $param .= '&search_all='.urlencode($search_all); } if ($show_files) { - $param .= '&show_files='.urlencode($show_files); + $param .= '&show_files='.urlencode((string) ($show_files)); } if ($socid > 0) { - $param .= '&socid='.urlencode($socid); + $param .= '&socid='.urlencode((string) ($socid)); } if ($search_status != '') { $param .= '&search_status='.urlencode($search_status); @@ -652,7 +652,7 @@ if (empty($reshook)) { $param .= '&search_ref_customer='.urlencode($search_ref_customer); } if ($search_user > 0) { - $param .= '&search_user='.urlencode($search_user); + $param .= '&search_user='.urlencode((string) ($search_user)); } if ($search_sale > 0) { $param .= '&search_sale='.urlencode($search_sale); @@ -1242,7 +1242,7 @@ if ($search_ref_customer) { $param .= '&search_ref_customer='.urlencode($search_ref_customer); } if ($search_user > 0) { - $param .= '&search_user='.urlencode($search_user); + $param .= '&search_user='.urlencode((string) ($search_user)); } if ($search_sale > 0) { $param .= '&search_sale='.urlencode($search_sale); @@ -1257,7 +1257,7 @@ if ($search_total_ttc != '') { $param .= '&search_total_ttc='.urlencode($search_total_ttc); } if ($search_warehouse != '') { - $param .= '&search_warehouse='.urlencode($search_warehouse); + $param .= '&search_warehouse='.urlencode((string) ($search_warehouse)); } if ($search_login) { $param .= '&search_login='.urlencode($search_login); @@ -1290,19 +1290,19 @@ if ($search_state != '') { $param .= '&search_state='.urlencode($search_state); } if ($search_country != '') { - $param .= '&search_country='.urlencode($search_country); + $param .= '&search_country='.urlencode((string) ($search_country)); } if ($search_type_thirdparty && $search_type_thirdparty != '-1') { - $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty); + $param .= '&search_type_thirdparty='.urlencode((string) ($search_type_thirdparty)); } if ($search_product_category != '') { - $param .= '&search_product_category='.urlencode($search_product_category); + $param .= '&search_product_category='.urlencode((string) ($search_product_category)); } if (($search_categ_cus > 0) || ($search_categ_cus == -2)) { - $param .= '&search_categ_cus='.urlencode($search_categ_cus); + $param .= '&search_categ_cus='.urlencode((string) ($search_categ_cus)); } if ($show_files) { - $param .= '&show_files='.urlencode($show_files); + $param .= '&show_files='.urlencode((string) ($show_files)); } if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); @@ -1311,16 +1311,16 @@ if ($search_billed != '') { $param .= '&search_billed='.urlencode($search_billed); } if ($search_fk_cond_reglement > 0) { - $param .= '&search_fk_cond_reglement='.urlencode($search_fk_cond_reglement); + $param .= '&search_fk_cond_reglement='.urlencode((string) ($search_fk_cond_reglement)); } if ($search_fk_shipping_method > 0) { - $param .= '&search_fk_shipping_method='.urlencode($search_fk_shipping_method); + $param .= '&search_fk_shipping_method='.urlencode((string) ($search_fk_shipping_method)); } if ($search_fk_mode_reglement > 0) { - $param .= '&search_fk_mode_reglement='.urlencode($search_fk_mode_reglement); + $param .= '&search_fk_mode_reglement='.urlencode((string) ($search_fk_mode_reglement)); } if ($search_fk_input_reason > 0) { - $param .= '&search_fk_input_reason='.urlencode($search_fk_input_reason); + $param .= '&search_fk_input_reason='.urlencode((string) ($search_fk_input_reason)); } // Add $param from extra fields From 028f9599a656ebd7978ef2d2f9a24adb28efd17c Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:49:11 +0100 Subject: [PATCH 060/709] Fix: Ensure string type for urlencode() --- htdocs/commande/list_det.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/commande/list_det.php b/htdocs/commande/list_det.php index 0451f7d48fe..01aceb429d8 100644 --- a/htdocs/commande/list_det.php +++ b/htdocs/commande/list_det.php @@ -716,7 +716,7 @@ if ($resql) { $param .= '&sall='.urlencode($sall); } if ($socid > 0) { - $param .= '&socid='.urlencode($socid); + $param .= '&socid='.urlencode((string) ($socid)); } if ($search_id) { $param .= '&search_id='.urlencode($search_id); @@ -762,7 +762,7 @@ if ($resql) { $param .= '&search_ref_customer='.urlencode($search_ref_customer); } if ($search_user > 0) { - $param .= '&search_user='.urlencode($search_user); + $param .= '&search_user='.urlencode((string) ($search_user)); } if ($search_sale > 0) { $param .= '&search_sale='.urlencode($search_sale); @@ -777,7 +777,7 @@ if ($resql) { $param .= '&search_total_ttc='.urlencode($search_total_ttc); } if ($search_warehouse != '') { - $param .= '&search_warehouse='.urlencode($search_warehouse); + $param .= '&search_warehouse='.urlencode((string) ($search_warehouse)); } if ($search_login) { $param .= '&search_login='.urlencode($search_login); @@ -810,10 +810,10 @@ if ($resql) { $param .= '&search_state='.urlencode($search_state); } if ($search_country != '') { - $param .= '&search_country='.urlencode($search_country); + $param .= '&search_country='.urlencode((string) ($search_country)); } if ($search_type_thirdparty && $search_type_thirdparty != '-1') { - $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty); + $param .= '&search_type_thirdparty='.urlencode((string) ($search_type_thirdparty)); } if (!empty($search_product_category_array)) { foreach ($search_product_category_array as $tmpval) { @@ -821,10 +821,10 @@ if ($resql) { } } if (($search_categ_cus > 0) || ($search_categ_cus == -2)) { - $param .= '&search_categ_cus='.urlencode($search_categ_cus); + $param .= '&search_categ_cus='.urlencode((string) ($search_categ_cus)); } if ($show_files) { - $param .= '&show_files='.urlencode($show_files); + $param .= '&show_files='.urlencode((string) ($show_files)); } if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); @@ -833,16 +833,16 @@ if ($resql) { $param .= '&search_billed='.urlencode($search_billed); } if ($search_fk_cond_reglement > 0) { - $param .= '&search_fk_cond_reglement='.urlencode($search_fk_cond_reglement); + $param .= '&search_fk_cond_reglement='.urlencode((string) ($search_fk_cond_reglement)); } if ($search_fk_shipping_method > 0) { - $param .= '&search_fk_shipping_method='.urlencode($search_fk_shipping_method); + $param .= '&search_fk_shipping_method='.urlencode((string) ($search_fk_shipping_method)); } if ($search_fk_mode_reglement > 0) { - $param .= '&search_fk_mode_reglement='.urlencode($search_fk_mode_reglement); + $param .= '&search_fk_mode_reglement='.urlencode((string) ($search_fk_mode_reglement)); } if ($search_fk_input_reason > 0) { - $param .= '&search_fk_input_reason='.urlencode($search_fk_input_reason); + $param .= '&search_fk_input_reason='.urlencode((string) ($search_fk_input_reason)); } if (!empty($productobuy)) { $param .= '&productobuy='.urlencode($productobuy); From 08eb3a8e1f2fdfb2fda72d041f1d58feb7a8dce7 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:49:14 +0100 Subject: [PATCH 061/709] Fix: Ensure string type for urlencode() --- htdocs/compta/bank/account_statement_document.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/bank/account_statement_document.php b/htdocs/compta/bank/account_statement_document.php index 26613a6bb49..9585ac55973 100644 --- a/htdocs/compta/bank/account_statement_document.php +++ b/htdocs/compta/bank/account_statement_document.php @@ -130,7 +130,7 @@ if (!empty($numref)) { $object->fetch_thirdparty(); $upload_dir = $conf->bank->dir_output."/".$id."/statement/".dol_sanitizeFileName($numref); } -$backtopage = $_SERVER['PHP_SELF']."?account=".urlencode($id)."&num=".urlencode($numref); +$backtopage = $_SERVER['PHP_SELF']."?account=".urlencode((string) ($id))."&num=".urlencode((string) ($numref)); include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; From 263f6a1d15cc63aefd3a244dfb4dcc0cfd376ce4 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:49:17 +0100 Subject: [PATCH 062/709] Fix: Ensure string type for urlencode() --- htdocs/compta/bank/bankentries_list.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 2a3672b0cd9..82184b9ecb7 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -288,16 +288,16 @@ if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', ' if (!$error) { $param = 'action=reconcile&contextpage=banktransactionlist&id='.((int) $object->id).'&search_account='.((int) $object->id); if ($page) { - $param .= '&page='.urlencode($page); + $param .= '&page='.urlencode((string) ($page)); } if ($offset) { - $param .= '&offset='.urlencode($offset); + $param .= '&offset='.urlencode((string) ($offset)); } if ($limit) { $param .= '&limit='.((int) $limit); } if ($search_conciliated != '' && $search_conciliated != '-1') { - $param .= '&search_conciliated='.urlencode($search_conciliated); + $param .= '&search_conciliated='.urlencode((string) ($search_conciliated)); } if ($search_thirdparty_user) { $param .= '&search_thirdparty='.urlencode($search_thirdparty_user); @@ -449,7 +449,7 @@ if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.((int) $limit); } if ($id > 0) { - $param .= '&id='.urlencode($id); + $param .= '&id='.urlencode((string) ($id)); } if (!empty($ref)) { $param .= '&ref='.urlencode($ref); @@ -473,19 +473,19 @@ if (!empty($search_credit)) { $param .= '&search_credit='.urlencode($search_credit); } if ($search_account > 0) { - $param .= '&search_account='.urlencode($search_account); + $param .= '&search_account='.urlencode((string) ($search_account)); } if (!empty($search_num_releve)) { $param .= '&search_num_releve='.urlencode($search_num_releve); } if ($search_conciliated != '' && $search_conciliated != '-1') { - $param .= '&search_conciliated='.urlencode($search_conciliated); + $param .= '&search_conciliated='.urlencode((string) ($search_conciliated)); } if ($search_fk_bordereau > 0) { - $param .= '$&search_fk_bordereau='.urlencode($search_fk_bordereau); + $param .= '$&search_fk_bordereau='.urlencode((string) ($search_fk_bordereau)); } if ($search_bid > 0) { - $param .= '&search_bid='.urlencode($search_bid); + $param .= '&search_bid='.urlencode((string) ($search_bid)); } if (dol_strlen($search_dt_start) > 0) { $param .= '&search_start_dtmonth='.GETPOSTINT('search_start_dtmonth').'&search_start_dtday='.GETPOSTINT('search_start_dtday').'&search_start_dtyear='.GETPOSTINT('search_start_dtyear'); @@ -503,7 +503,7 @@ if ($search_req_nb) { $param .= '&req_nb='.urlencode($search_req_nb); } if (GETPOSTINT("search_thirdparty")) { - $param .= '&thirdparty='.urlencode(GETPOSTINT("search_thirdparty")); + $param .= '&thirdparty='.urlencode((string) (GETPOSTINT("search_thirdparty"))); } if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); @@ -1022,7 +1022,7 @@ if ($resql) { // We can add page now to param if ($page != '') { - $param .= '&page='.urlencode($page); + $param .= '&page='.urlencode((string) ($page)); } $moreforfilter = ''; From 80c239b010c889f77bcfe01f975df57a4b952df3 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:49:19 +0100 Subject: [PATCH 063/709] Fix: Ensure string type for urlencode() --- htdocs/compta/bank/line.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/bank/line.php b/htdocs/compta/bank/line.php index c0cbdb0447e..6ed9e7d37a9 100644 --- a/htdocs/compta/bank/line.php +++ b/htdocs/compta/bank/line.php @@ -352,7 +352,7 @@ if ($result) { // Confirmations if ($action == 'delete_categ') { - print $form->formconfirm($_SERVER['PHP_SELF']."?rowid=".urlencode($rowid)."&cat1=".urlencode(GETPOSTINT("fk_categ"))."&orig_account=".urlencode($orig_account), $langs->trans("RemoveFromRubrique"), $langs->trans("RemoveFromRubriqueConfirm"), "confirm_delete_categ", '', 'yes', 1); + print $form->formconfirm($_SERVER['PHP_SELF']."?rowid=".urlencode((string) ($rowid))."&cat1=".urlencode((string) (GETPOSTINT("fk_categ")))."&orig_account=".urlencode((string) ($orig_account)), $langs->trans("RemoveFromRubrique"), $langs->trans("RemoveFromRubriqueConfirm"), "confirm_delete_categ", '', 'yes', 1); } print ''; From 6ebe9fed3c9c11319f9262574196bed66a52e18d Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:49:21 +0100 Subject: [PATCH 064/709] Fix: Ensure string type for urlencode() --- htdocs/compta/bank/list.php | 50 ++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index ef9206a74ed..480c36cd07e 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -60,7 +60,7 @@ $search_number = GETPOST('search_number', 'alpha'); $search_status = GETPOST('search_status') ? GETPOST('search_status', 'alpha') : 'opened'; // 'all' or '' means 'opened' $optioncss = GETPOST('optioncss', 'alpha'); -$search_category_list =""; +$search_category_list = ""; if (isModEnabled('category')) { $search_category_list = GETPOST("search_category_".Categorie::TYPE_ACCOUNT."_list", "array"); } @@ -101,24 +101,24 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen // List of fields to search into when doing a "search in all" $fieldstosearchall = array( - 'b.ref'=>'Ref', - 'b.label'=>'Label', + 'b.ref' => 'Ref', + 'b.label' => 'Label', ); $checkedtypetiers = 0; $arrayfields = array( - 'b.ref'=>array('label'=>$langs->trans("BankAccounts"), 'checked'=>1, 'position'=>10), - 'b.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1, 'position'=>12), - 'accountype'=>array('label'=>$langs->trans("Type"), 'checked'=>1, 'position'=>14), - 'b.number'=>array('label'=>$langs->trans("AccountIdShort"), 'checked'=>1, 'position'=>16), - 'b.account_number'=>array('label'=>$langs->trans("AccountAccounting"), 'checked'=>(isModEnabled('accounting')), 'position'=>18), - 'b.fk_accountancy_journal'=>array('label'=>$langs->trans("AccountancyJournal"), 'checked'=>(isModEnabled('accounting')), 'position'=>20), - 'toreconcile'=>array('label'=>$langs->trans("TransactionsToConciliate"), 'checked'=>1, 'position'=>50), - 'b.currency_code'=>array('label'=>$langs->trans("Currency"), 'checked'=>0, 'position'=>22), - 'b.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), - 'b.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), - 'b.clos'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), - 'balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1, 'position'=>1010), + 'b.ref' => array('label' => $langs->trans("BankAccounts"), 'checked' => 1, 'position' => 10), + 'b.label' => array('label' => $langs->trans("Label"), 'checked' => 1, 'position' => 12), + 'accountype' => array('label' => $langs->trans("Type"), 'checked' => 1, 'position' => 14), + 'b.number' => array('label' => $langs->trans("AccountIdShort"), 'checked' => 1, 'position' => 16), + 'b.account_number' => array('label' => $langs->trans("AccountAccounting"), 'checked' => (isModEnabled('accounting')), 'position' => 18), + 'b.fk_accountancy_journal' => array('label' => $langs->trans("AccountancyJournal"), 'checked' => (isModEnabled('accounting')), 'position' => 20), + 'toreconcile' => array('label' => $langs->trans("TransactionsToConciliate"), 'checked' => 1, 'position' => 50), + 'b.currency_code' => array('label' => $langs->trans("Currency"), 'checked' => 0, 'position' => 22), + 'b.datec' => array('label' => $langs->trans("DateCreation"), 'checked' => 0, 'position' => 500), + 'b.tms' => array('label' => $langs->trans("DateModificationShort"), 'checked' => 0, 'position' => 500), + 'b.clos' => array('label' => $langs->trans("Status"), 'checked' => 1, 'position' => 1000), + 'balance' => array('label' => $langs->trans("Balance"), 'checked' => 1, 'position' => 1010), ); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; @@ -150,7 +150,7 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa $massaction = ''; } -$parameters = array('socid'=>$socid); +$parameters = array('socid' => $socid); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -336,7 +336,7 @@ if ($search_status != '') { $param .= '&search_status='.urlencode($search_status); } if ($show_files) { - $param .= '&show_files='.urlencode($show_files); + $param .= '&show_files='.urlencode((string) ($show_files)); } // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; @@ -378,8 +378,8 @@ print ''; $newcardbutton = ''; -$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); -$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss' => 'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss' => 'reposition')); $newcardbutton .= dolGetButtonTitleSeparator(); $newcardbutton .= dolGetButtonTitle($langs->trans('NewFinancialAccount'), '', 'fa fa-plus-circle', 'card.php?action=create', '', $user->hasRight('banque', 'configurer')); @@ -486,7 +486,7 @@ if (!empty($arrayfields['b.currency_code']['checked'])) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook -$parameters = array('arrayfields'=>$arrayfields); +$parameters = array('arrayfields' => $arrayfields); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation @@ -503,8 +503,8 @@ if (!empty($arrayfields['b.tms']['checked'])) { if (!empty($arrayfields['b.clos']['checked'])) { print ''; $array = array( - 'opened'=>$langs->trans("Opened"), - 'closed'=>$langs->trans("Closed") + 'opened' => $langs->trans("Opened"), + 'closed' => $langs->trans("Closed") ); print $form->selectarray("search_status", $array, $search_status, 1, 0, 0, '', 0, 0, 0, '', 'search_status minwidth75 maxwidth125 onrightofpage', 1); print ''; @@ -568,7 +568,7 @@ if (!empty($arrayfields['toreconcile']['checked'])) { // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields -$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); +$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (!empty($arrayfields['b.datec']['checked'])) { @@ -601,7 +601,7 @@ $i = 0; $savnbfield = $totalarray['nbfield']; $totalarray = array(); $totalarray['nbfield'] = 0; -$totalarray['val'] = array('balance'=>0); +$totalarray['val'] = array('balance' => 0); $total = array(); $found = 0; $lastcurrencycode = ''; @@ -799,7 +799,7 @@ foreach ($accounts as $key => $type) { } include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $parameters = array('arrayfields' => $arrayfields, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $objecttmp, $action); // Note that $action and $objecttmpect may have been modified by hook print $hookmanager->resPrint; // Date creation From a7895ec1a6cf24a76e2bdb2cad54d0c7225cb55f Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:49:23 +0100 Subject: [PATCH 065/709] Fix: Ensure string type for urlencode() --- htdocs/compta/bank/releve.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index 56eb4e93a6c..34c61ad8b31 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -250,7 +250,7 @@ if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.$limit; } if ($id > 0) { - $param .= '&id='.urlencode($id); + $param .= '&id='.urlencode((string) ($id)); } if (empty($numref)) { From bb144ed2781a12250700cf2a9a63e4f70cb8e3ed Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:49:25 +0100 Subject: [PATCH 066/709] Fix: Ensure string type for urlencode() --- htdocs/compta/bank/various_payment/list.php | 50 ++++++++++----------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index 33f9f0154cd..8a2aa9178f7 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -148,27 +148,27 @@ $search_all = GETPOSTISSET("search_all") ? trim(GETPOST("search_all", 'alpha')) // List of fields to search into when doing a "search in all" $fieldstosearchall = array( - 'v.rowid'=>"Ref", - 'v.label'=>"Label", - 'v.datep'=>"DatePayment", - 'v.datev'=>"DateValue", - 'v.amount'=>$langs->trans("Debit").", ".$langs->trans("Credit"), + 'v.rowid' => "Ref", + 'v.label' => "Label", + 'v.datep' => "DatePayment", + 'v.datev' => "DateValue", + 'v.amount' => $langs->trans("Debit").", ".$langs->trans("Credit"), ); // Definition of fields for lists $arrayfields = array( - 'ref' =>array('label'=>"Ref", 'checked'=>1, 'position'=>100), - 'label' =>array('label'=>"Label", 'checked'=>1, 'position'=>110), - 'datep' =>array('label'=>"DatePayment", 'checked'=>1, 'position'=>120), - 'datev' =>array('label'=>"DateValue", 'checked'=>-1, 'position'=>130), - 'type' =>array('label'=>"PaymentMode", 'checked'=>1, 'position'=>140), - 'project' =>array('label'=>"Project", 'checked'=>1, 'position'=>200, "enabled"=>isModEnabled('project')), - 'bank' =>array('label'=>"BankAccount", 'checked'=>1, 'position'=>300, "enabled"=>isModEnabled("bank")), - 'entry' =>array('label'=>"BankTransactionLine", 'checked'=>1, 'position'=>310, "enabled"=>isModEnabled("bank")), - 'account' =>array('label'=>"AccountAccountingShort", 'checked'=>1, 'position'=>400, "enabled"=>isModEnabled('accounting')), - 'subledger' =>array('label'=>"SubledgerAccount", 'checked'=>1, 'position'=>410, "enabled"=>isModEnabled('accounting')), - 'debit' =>array('label'=>"Debit", 'checked'=>1, 'position'=>500), - 'credit' =>array('label'=>"Credit", 'checked'=>1, 'position'=>510), + 'ref' => array('label' => "Ref", 'checked' => 1, 'position' => 100), + 'label' => array('label' => "Label", 'checked' => 1, 'position' => 110), + 'datep' => array('label' => "DatePayment", 'checked' => 1, 'position' => 120), + 'datev' => array('label' => "DateValue", 'checked' => -1, 'position' => 130), + 'type' => array('label' => "PaymentMode", 'checked' => 1, 'position' => 140), + 'project' => array('label' => "Project", 'checked' => 1, 'position' => 200, "enabled" => isModEnabled('project')), + 'bank' => array('label' => "BankAccount", 'checked' => 1, 'position' => 300, "enabled" => isModEnabled("bank")), + 'entry' => array('label' => "BankTransactionLine", 'checked' => 1, 'position' => 310, "enabled" => isModEnabled("bank")), + 'account' => array('label' => "AccountAccountingShort", 'checked' => 1, 'position' => 400, "enabled" => isModEnabled('accounting')), + 'subledger' => array('label' => "SubledgerAccount", 'checked' => 1, 'position' => 410, "enabled" => isModEnabled('accounting')), + 'debit' => array('label' => "Debit", 'checked' => 1, 'position' => 500), + 'credit' => array('label' => "Credit", 'checked' => 1, 'position' => 510), ); $arrayfields = dol_sort_array($arrayfields, 'position'); @@ -401,7 +401,7 @@ if ($search_datev_end) { $param .= '&search_datev_end='.urlencode($search_datev_end); } if ($search_type_id > 0) { - $param .= '&search_type_id='.urlencode($search_type_id); + $param .= '&search_type_id='.urlencode((string) ($search_type_id)); } if ($search_amount_deb) { $param .= '&search_amount_deb='.urlencode($search_amount_deb); @@ -410,7 +410,7 @@ if ($search_amount_cred) { $param .= '&search_amount_cred='.urlencode($search_amount_cred); } if ($search_bank_account > 0) { - $param .= '&search_account='.urlencode($search_bank_account); + $param .= '&search_account='.urlencode((string) ($search_bank_account)); } if ($search_accountancy_account > 0) { $param .= '&search_accountancy_account='.urlencode($search_accountancy_account); @@ -421,7 +421,7 @@ if ($search_accountancy_subledger > 0) { $url = DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create'; if (!empty($socid)) { - $url .= '&socid='.urlencode($socid); + $url .= '&socid='.urlencode((string) ($socid)); } // List of mass actions available @@ -443,8 +443,8 @@ print ''; print ''; $newcardbutton = ''; -$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); -$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss' => 'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss' => 'reposition')); $newcardbutton .= dolGetButtonTitleSeparator(); $newcardbutton .= dolGetButtonTitle($langs->trans('MenuNewVariousPayment'), '', 'fa fa-plus-circle', $url, '', $user->hasRight('banque', 'modifier')); @@ -462,7 +462,7 @@ if ($search_all) { $arrayofmassactions = array(); -$moreforfilter= ''; +$moreforfilter = ''; $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $selectedfields = ($mode != 'kanban' ? $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) : ''); // This also change content of $arrayfields @@ -662,7 +662,7 @@ if ($arrayfields['credit']['checked']) { // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields -$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray); +$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column @@ -904,7 +904,7 @@ if ($num == 0) { $db->free($resql); -$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); +$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql); $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; From bb3e90183cda9b48d82defd87f1f04afff684c71 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:49:28 +0100 Subject: [PATCH 067/709] Fix: Ensure string type for urlencode() --- htdocs/compta/deplacement/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/deplacement/card.php b/htdocs/compta/deplacement/card.php index bcc66ade965..04c50f82ffe 100644 --- a/htdocs/compta/deplacement/card.php +++ b/htdocs/compta/deplacement/card.php @@ -367,7 +367,7 @@ if ($action == 'create') { * Confirm delete trip */ if ($action == 'delete') { - print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".urlencode($id), $langs->trans("DeleteTrip"), $langs->trans("ConfirmDeleteTrip"), "confirm_delete"); + print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".urlencode((string) ($id)), $langs->trans("DeleteTrip"), $langs->trans("ConfirmDeleteTrip"), "confirm_delete"); } $soc = new Societe($db); From a361855b248f87859b432e9b2e4146f83177e128 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:49:31 +0100 Subject: [PATCH 068/709] Fix: Ensure string type for urlencode() --- htdocs/compta/facture/agenda-rec.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/facture/agenda-rec.php b/htdocs/compta/facture/agenda-rec.php index 6f1ed587758..542dfd8f6c1 100644 --- a/htdocs/compta/facture/agenda-rec.php +++ b/htdocs/compta/facture/agenda-rec.php @@ -96,7 +96,7 @@ restrictedArea($user, 'facture', $object->id, 'facture_rec', '', 'fk_soc', 'rowi * Actions */ -$parameters = array('id'=>$id); +$parameters = array('id' => $id); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -196,14 +196,14 @@ if ($object->id > 0) { $objthirdparty = $object; $objcon = new stdClass(); - $out = '&origin='.urlencode($object->element.(property_exists($object, 'module') ? '@'.$object->module : '')).'&originid='.urlencode($object->id); + $out = '&origin='.urlencode((string) ($object->element.(property_exists($object, 'module') ? '@'.$object->module : ''))).'&originid='.urlencode((string) ($object->id)); $urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id; $out .= '&backtopage='.urlencode($urlbacktopage); $permok = $user->hasRight('paymentbagendaybanktransfer', 'myactions', 'create'); if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) { //$out.=' Date: Fri, 8 Mar 2024 02:49:37 +0100 Subject: [PATCH 069/709] Fix: Ensure string type for urlencode() --- htdocs/compta/facture/agenda.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/facture/agenda.php b/htdocs/compta/facture/agenda.php index ab0edfbf10a..2880e158273 100644 --- a/htdocs/compta/facture/agenda.php +++ b/htdocs/compta/facture/agenda.php @@ -96,7 +96,7 @@ restrictedArea($user, 'facture', $object->id, '', '', 'fk_soc', 'rowid', $isdraf * Actions */ -$parameters = array('id'=>$id); +$parameters = array('id' => $id); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -191,14 +191,14 @@ if ($object->id > 0) { $objthirdparty = $object; $objcon = new stdClass(); - $out = '&origin='.urlencode($object->element.(property_exists($object, 'module') ? '@'.$object->module : '')).'&originid='.urlencode($object->id); + $out = '&origin='.urlencode((string) ($object->element.(property_exists($object, 'module') ? '@'.$object->module : ''))).'&originid='.urlencode((string) ($object->id)); $urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id; $out .= '&backtopage='.urlencode($urlbacktopage); $permok = $user->hasRight('paymentbagendaybanktransfer', 'myactions', 'create'); if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) { //$out.=' Date: Fri, 8 Mar 2024 02:49:41 +0100 Subject: [PATCH 070/709] Fix: Ensure string type for urlencode() --- htdocs/compta/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 66afe9fcb73..a9d280ebc1b 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3832,7 +3832,7 @@ if ($action == 'create') { $thirdparty = $soc; $discount_type = 0; - $backtopage = $_SERVER["PHP_SELF"].'?socid='.$thirdparty->id.'&action='.$action.'&origin='.urlencode(GETPOST('origin')).'&originid='.urlencode(GETPOSTINT('originid')); + $backtopage = $_SERVER["PHP_SELF"].'?socid='.$thirdparty->id.'&action='.$action.'&origin='.urlencode((string) (GETPOST('origin'))).'&originid='.urlencode((string) (GETPOSTINT('originid'))); include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php'; print ''; From 1d7c551a8560483b80b6788b1957890b1f4f78ce Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:49:45 +0100 Subject: [PATCH 071/709] Fix: Ensure string type for urlencode() --- .../compta/facture/invoicetemplate_list.php | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/htdocs/compta/facture/invoicetemplate_list.php b/htdocs/compta/facture/invoicetemplate_list.php index 4bbea222033..13a119e35b5 100644 --- a/htdocs/compta/facture/invoicetemplate_list.php +++ b/htdocs/compta/facture/invoicetemplate_list.php @@ -438,43 +438,43 @@ if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.((int) $limit); } if ($socid > 0) { - $param .= '&socid='.urlencode($socid); + $param .= '&socid='.urlencode((string) ($socid)); } if ($search_date_startday) { - $param .= '&search_date_startday='.urlencode($search_date_startday); + $param .= '&search_date_startday='.urlencode((string) ($search_date_startday)); } if ($search_date_startmonth) { - $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); + $param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth)); } if ($search_date_startyear) { - $param .= '&search_date_startyear='.urlencode($search_date_startyear); + $param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear)); } if ($search_date_endday) { - $param .= '&search_date_endday='.urlencode($search_date_endday); + $param .= '&search_date_endday='.urlencode((string) ($search_date_endday)); } if ($search_date_endmonth) { - $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + $param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth)); } if ($search_date_endyear) { - $param .= '&search_date_endyear='.urlencode($search_date_endyear); + $param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear)); } if ($search_date_when_startday) { - $param .= '&search_date_when_startday='.urlencode($search_date_when_startday); + $param .= '&search_date_when_startday='.urlencode((string) ($search_date_when_startday)); } if ($search_date_when_startmonth) { - $param .= '&search_date_when_startmonth='.urlencode($search_date_when_startmonth); + $param .= '&search_date_when_startmonth='.urlencode((string) ($search_date_when_startmonth)); } if ($search_date_when_startyear) { - $param .= '&search_date_when_startyear='.urlencode($search_date_when_startyear); + $param .= '&search_date_when_startyear='.urlencode((string) ($search_date_when_startyear)); } if ($search_date_when_endday) { - $param .= '&search_date_when_endday='.urlencode($search_date_when_endday); + $param .= '&search_date_when_endday='.urlencode((string) ($search_date_when_endday)); } if ($search_date_when_endmonth) { - $param .= '&search_date_when_endmonth='.urlencode($search_date_when_endmonth); + $param .= '&search_date_when_endmonth='.urlencode((string) ($search_date_when_endmonth)); } if ($search_date_when_endyear) { - $param .= '&search_date_when_endyear='.urlencode($search_date_when_endyear); + $param .= '&search_date_when_endyear='.urlencode((string) ($search_date_when_endyear)); } if ($search_ref) { $param .= '&search_ref='.urlencode($search_ref); From 1b5046661fe4d127117df118330901965e09a8da Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:49:49 +0100 Subject: [PATCH 072/709] Fix: Ensure string type for urlencode() --- htdocs/compta/facture/list.php | 50 +++++++++++++++++----------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index e897ebd198b..cfa495f3922 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -1004,7 +1004,7 @@ if ($num == 1 && getDolGlobalString('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $s llxHeader('', $title, $help_url); -$param = '&socid='.urlencode($socid); +$param = '&socid='.urlencode((string) ($socid)); if (!empty($mode)) { $param .= '&mode='.urlencode($mode); } @@ -1018,58 +1018,58 @@ if ($search_all) { $param .= '&search_all='.urlencode($search_all); } if ($search_date_startday) { - $param .= '&search_date_startday='.urlencode($search_date_startday); + $param .= '&search_date_startday='.urlencode((string) ($search_date_startday)); } if ($search_date_startmonth) { - $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); + $param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth)); } if ($search_date_startyear) { - $param .= '&search_date_startyear='.urlencode($search_date_startyear); + $param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear)); } if ($search_date_endday) { - $param .= '&search_date_endday='.urlencode($search_date_endday); + $param .= '&search_date_endday='.urlencode((string) ($search_date_endday)); } if ($search_date_endmonth) { - $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + $param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth)); } if ($search_date_endyear) { - $param .= '&search_date_endyear='.urlencode($search_date_endyear); + $param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear)); } if ($search_date_valid_startday) { - $param .= '&search_date_valid_startday='.urlencode($search_date_valid_startday); + $param .= '&search_date_valid_startday='.urlencode((string) ($search_date_valid_startday)); } if ($search_date_valid_startmonth) { - $param .= '&search_date_valid_startmonth='.urlencode($search_date_valid_startmonth); + $param .= '&search_date_valid_startmonth='.urlencode((string) ($search_date_valid_startmonth)); } if ($search_date_valid_startyear) { - $param .= '&search_date_valid_startyear='.urlencode($search_date_valid_startyear); + $param .= '&search_date_valid_startyear='.urlencode((string) ($search_date_valid_startyear)); } if ($search_date_valid_endday) { - $param .= '&search_date_valid_endday='.urlencode($search_date_valid_endday); + $param .= '&search_date_valid_endday='.urlencode((string) ($search_date_valid_endday)); } if ($search_date_valid_endmonth) { - $param .= '&search_date_valid_endmonth='.urlencode($search_date_valid_endmonth); + $param .= '&search_date_valid_endmonth='.urlencode((string) ($search_date_valid_endmonth)); } if ($search_date_valid_endyear) { - $param .= '&search_date_valid_endyear='.urlencode($search_date_valid_endyear); + $param .= '&search_date_valid_endyear='.urlencode((string) ($search_date_valid_endyear)); } if ($search_datelimit_startday) { - $param .= '&search_datelimit_startday='.urlencode($search_datelimit_startday); + $param .= '&search_datelimit_startday='.urlencode((string) ($search_datelimit_startday)); } if ($search_datelimit_startmonth) { - $param .= '&search_datelimit_startmonth='.urlencode($search_datelimit_startmonth); + $param .= '&search_datelimit_startmonth='.urlencode((string) ($search_datelimit_startmonth)); } if ($search_datelimit_startyear) { - $param .= '&search_datelimit_startyear='.urlencode($search_datelimit_startyear); + $param .= '&search_datelimit_startyear='.urlencode((string) ($search_datelimit_startyear)); } if ($search_datelimit_endday) { - $param .= '&search_datelimit_endday='.urlencode($search_datelimit_endday); + $param .= '&search_datelimit_endday='.urlencode((string) ($search_datelimit_endday)); } if ($search_datelimit_endmonth) { - $param .= '&search_datelimit_endmonth='.urlencode($search_datelimit_endmonth); + $param .= '&search_datelimit_endmonth='.urlencode((string) ($search_datelimit_endmonth)); } if ($search_datelimit_endyear) { - $param .= '&search_datelimit_endyear='.urlencode($search_datelimit_endyear); + $param .= '&search_datelimit_endyear='.urlencode((string) ($search_datelimit_endyear)); } if ($search_ref) { $param .= '&search_ref='.urlencode($search_ref); @@ -1117,13 +1117,13 @@ if ($search_sale > 0) { $param .= '&search_sale='.urlencode($search_sale); } if ($search_user > 0) { - $param .= '&search_user='.urlencode($search_user); + $param .= '&search_user='.urlencode((string) ($search_user)); } if ($search_login) { $param .= '&search_login='.urlencode($search_login); } if ($search_product_category > 0) { - $param .= '&search_product_category='.urlencode($search_product_category); + $param .= '&search_product_category='.urlencode((string) ($search_product_category)); } if ($search_montant_ht != '') { $param .= '&search_montant_ht='.urlencode($search_montant_ht); @@ -1159,10 +1159,10 @@ if ($search_status != '') { $param .= '&search_status='.urlencode($search_status); } if ($search_paymentmode > 0) { - $param .= '&search_paymentmode='.urlencode($search_paymentmode); + $param .= '&search_paymentmode='.urlencode((string) ($search_paymentmode)); } if ($search_paymentterms > 0) { - $param .= '&search_paymentterms='.urlencode($search_paymentterms); + $param .= '&search_paymentterms='.urlencode((string) ($search_paymentterms)); } if ($search_module_source) { $param .= '&search_module_source='.urlencode($search_module_source); @@ -1171,7 +1171,7 @@ if ($search_pos_source) { $param .= '&search_pos_source='.urlencode($search_pos_source); } if ($show_files) { - $param .= '&show_files='.urlencode($show_files); + $param .= '&show_files='.urlencode((string) ($show_files)); } if ($search_late) { $param .= "&search_late=".urlencode($search_late); @@ -1180,7 +1180,7 @@ if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); } if ($search_categ_cus > 0) { - $param .= '&search_categ_cus='.urlencode($search_categ_cus); + $param .= '&search_categ_cus='.urlencode((string) ($search_categ_cus)); } if (!empty($search_fac_rec_source_title)) { $param .= '&search_fac_rec_source_title='.urlencode($search_fac_rec_source_title); From e1e3185c70de7f71fe650d0c0d863cd374d1ff74 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:49:53 +0100 Subject: [PATCH 073/709] Fix: Ensure string type for urlencode() --- htdocs/compta/paiement/cheque/list.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index 284dbefcc54..7243c91f3c3 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -221,22 +221,22 @@ if ($resql) { $param .= '&contextpage='.$contextpage; } if ($search_date_startday) { - $param .= '&search_date_startday='.urlencode($search_date_startday); + $param .= '&search_date_startday='.urlencode((string) ($search_date_startday)); } if ($search_date_startmonth) { - $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); + $param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth)); } if ($search_date_startyear) { - $param .= '&search_date_startyear='.urlencode($search_date_startyear); + $param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear)); } if ($search_date_endday) { - $param .= '&search_date_endday='.urlencode($search_date_endday); + $param .= '&search_date_endday='.urlencode((string) ($search_date_endday)); } if ($search_date_endmonth) { - $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + $param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth)); } if ($search_date_endyear) { - $param .= '&search_date_endyear='.urlencode($search_date_endyear); + $param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear)); } if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.$limit; @@ -245,7 +245,7 @@ if ($resql) { $param .= '&search_amount='.urlencode($search_amount); } if ($search_account > 0) { - $param .= '&search_account='.urlencode($search_account); + $param .= '&search_account='.urlencode((string) ($search_account)); } $url = DOL_URL_ROOT.'/compta/paiement/cheque/card.php?action=new'; From 1c8e034c35b270ede2d4c288e0750bb6e6b9089f Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:49:55 +0100 Subject: [PATCH 074/709] Fix: Ensure string type for urlencode() --- htdocs/compta/paiement/list.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index b59aff4bfc9..12c2ec797d8 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -339,22 +339,22 @@ if ($search_ref) { $param .= '&search_ref='.urlencode($search_ref); } if ($search_date_startday) { - $param .= '&search_date_startday='.urlencode($search_date_startday); + $param .= '&search_date_startday='.urlencode((string) ($search_date_startday)); } if ($search_date_startmonth) { - $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); + $param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth)); } if ($search_date_startyear) { - $param .= '&search_date_startyear='.urlencode($search_date_startyear); + $param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear)); } if ($search_date_endday) { - $param .= '&search_date_endday='.urlencode($search_date_endday); + $param .= '&search_date_endday='.urlencode((string) ($search_date_endday)); } if ($search_date_endmonth) { - $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + $param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth)); } if ($search_date_endyear) { - $param .= '&search_date_endyear='.urlencode($search_date_endyear); + $param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear)); } if ($search_company) { $param .= '&search_company='.urlencode($search_company); @@ -366,7 +366,7 @@ if ($search_paymenttype) { $param .= '&search_paymenttype='.urlencode($search_paymenttype); } if ($search_account) { - $param .= '&search_account='.urlencode($search_account); + $param .= '&search_account='.urlencode((string) ($search_account)); } if ($search_payment_num) { $param .= '&search_payment_num='.urlencode($search_payment_num); From 106ff976b5d21c119072c46c9d10115cf565b1ab Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:49:58 +0100 Subject: [PATCH 075/709] Fix: Ensure string type for urlencode() --- htdocs/compta/prelevement/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index 691f6d903bf..c9f2401513b 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -506,7 +506,7 @@ if ($id > 0 || $ref) { $num = $db->num_rows($result); $i = 0; - $urladd = "&id=".urlencode($id); + $urladd = "&id=".urlencode((string) ($id)); if ($limit > 0 && $limit != $conf->liste_limit) { $urladd .= '&limit='.((int) $limit); } From 475aa5497d9163c8b9c7bb82481720b70a2e2b64 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:50:00 +0100 Subject: [PATCH 076/709] Fix: Ensure string type for urlencode() --- htdocs/compta/prelevement/create.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 8102984f3b2..00934b0f0e6 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -185,7 +185,7 @@ if (empty($reshook)) { setEventMessages($texttoshow, null); } - header("Location: ".DOL_URL_ROOT.'/compta/prelevement/card.php?id='.urlencode($bprev->id).'&type='.urlencode($type)); + header("Location: ".DOL_URL_ROOT.'/compta/prelevement/card.php?id='.urlencode((string) ($bprev->id)).'&type='.urlencode((string) ($type))); exit; } } @@ -462,7 +462,7 @@ if ($resql) { $param .= '&limit='.((int) $limit); } if ($socid) { - $param .= '&socid='.urlencode($socid); + $param .= '&socid='.urlencode((string) ($socid)); } if ($option) { $param .= "&option=".urlencode($option); From e2f6d646d3a7e29373c0c0b58f379b63704ca328 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:50:02 +0100 Subject: [PATCH 077/709] Fix: Ensure string type for urlencode() --- htdocs/compta/prelevement/factures.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/prelevement/factures.php b/htdocs/compta/prelevement/factures.php index 09015486e30..1fe40efa05e 100644 --- a/htdocs/compta/prelevement/factures.php +++ b/htdocs/compta/prelevement/factures.php @@ -275,9 +275,9 @@ if ($resql) { $i = 0; if ($limit > 0 && $limit != $conf->liste_limit) { - $param.='&limit='.((int) $limit); + $param .= '&limit='.((int) $limit); } - $param = "&id=".urlencode($id); + $param = "&id=".urlencode((string) ($id)); // Lines of title fields print ''; @@ -342,7 +342,7 @@ if ($resql) { print ''; print ''; - print ($salaryBonPl ? $salarytmp->getNomUrl(1) : $invoicetmp->getNomUrl(1)); + print($salaryBonPl ? $salarytmp->getNomUrl(1) : $invoicetmp->getNomUrl(1)); print "\n"; if ($object->type == 'bank-transfer' && !$salaryBonPl) { From 86c1bb8fe57ce45fbf19e169bff9d2fa2aaae3c7 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:50:04 +0100 Subject: [PATCH 078/709] Fix: Ensure string type for urlencode() --- htdocs/compta/prelevement/line.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/prelevement/line.php b/htdocs/compta/prelevement/line.php index 85e92020011..96d9a2d6b2c 100644 --- a/htdocs/compta/prelevement/line.php +++ b/htdocs/compta/prelevement/line.php @@ -111,7 +111,7 @@ if ($action == 'confirm_rejet' && $permissiontoadd) { $result = $rej->create($user, $id, GETPOSTINT('motif'), $daterej, $lipre->bon_rowid, GETPOSTINT('facturer')); if ($result > 0) { - header("Location: line.php?id=".urlencode($id).'&type='.urlencode($type)); + header("Location: line.php?id=".urlencode((string) ($id)).'&type='.urlencode((string) ($type))); exit; } } @@ -119,7 +119,7 @@ if ($action == 'confirm_rejet' && $permissiontoadd) { $action = "rejet"; } } else { - header("Location: line.php?id=".urlencode($id).'&type='.urlencode($type)); + header("Location: line.php?id=".urlencode((string) ($id)).'&type='.urlencode((string) ($type))); exit; } } @@ -343,7 +343,7 @@ if ($id) { $num = $db->num_rows($result); $i = 0; - $urladd = "&id=".urlencode($id); + $urladd = "&id=".urlencode((string) ($id)); $title = $langs->trans("Bills"); if ($type == 'bank-transfer') { $title = $langs->trans("SupplierInvoices"); From a696868f5c5965b07f22f884575b08fa46d8602d Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:50:06 +0100 Subject: [PATCH 079/709] Fix: Ensure string type for urlencode() --- htdocs/compta/prelevement/orders_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/prelevement/orders_list.php b/htdocs/compta/prelevement/orders_list.php index 23eee162758..b6dd673f37f 100644 --- a/htdocs/compta/prelevement/orders_list.php +++ b/htdocs/compta/prelevement/orders_list.php @@ -235,7 +235,7 @@ llxHeader('', $title, $help_url); $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; -$param .= "&statut=".urlencode($statut); +$param .= "&statut=".urlencode((string) ($statut)); if ($type == 'bank-transfer') { $param .= '&type=bank-transfer'; } From b43ec4056cb156b6e42a87aa687658819c6c3640 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:50:09 +0100 Subject: [PATCH 080/709] Fix: Ensure string type for urlencode() --- htdocs/compta/sociales/list.php | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php index 0f2b503da99..5f07abd308a 100644 --- a/htdocs/compta/sociales/list.php +++ b/htdocs/compta/sociales/list.php @@ -328,7 +328,7 @@ if ($search_amount) { $param .= '&search_amount='.urlencode($search_amount); } if ($search_typeid) { - $param .= '&search_typeid='.urlencode($search_typeid); + $param .= '&search_typeid='.urlencode((string) ($search_typeid)); } if ($search_users) { foreach ($search_users as $id_user) { @@ -336,7 +336,7 @@ if ($search_users) { } } if ($search_type) { - $param .= '&search_type='.urlencode($search_type); + $param .= '&search_type='.urlencode((string) ($search_type)); } if ($search_account) { $param .= '&search_account='.$search_account; @@ -345,40 +345,40 @@ if ($search_status != '' && $search_status != '-1') { $param .= '&search_status='.urlencode($search_status); } if ($search_date_startday) { - $param .= '&search_date_startday='.urlencode($search_date_startday); + $param .= '&search_date_startday='.urlencode((string) ($search_date_startday)); } if ($search_date_startmonth) { - $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); + $param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth)); } if ($search_date_startyear) { - $param .= '&search_date_startyear='.urlencode($search_date_startyear); + $param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear)); } if ($search_date_endday) { - $param .= '&search_date_endday='.urlencode($search_date_endday); + $param .= '&search_date_endday='.urlencode((string) ($search_date_endday)); } if ($search_date_endmonth) { - $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + $param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth)); } if ($search_date_endyear) { - $param .= '&search_date_endyear='.urlencode($search_date_endyear); + $param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear)); } if ($search_date_limit_startday) { - $param .= '&search_date_limit_startday='.urlencode($search_date_limit_startday); + $param .= '&search_date_limit_startday='.urlencode((string) ($search_date_limit_startday)); } if ($search_date_limit_startmonth) { - $param .= '&search_date_limit_startmonth='.urlencode($search_date_limit_startmonth); + $param .= '&search_date_limit_startmonth='.urlencode((string) ($search_date_limit_startmonth)); } if ($search_date_limit_startyear) { - $param .= '&search_date_limit_startyear='.urlencode($search_date_limit_startyear); + $param .= '&search_date_limit_startyear='.urlencode((string) ($search_date_limit_startyear)); } if ($search_date_limit_endday) { - $param .= '&search_date_limit_endday='.urlencode($search_date_limit_endday); + $param .= '&search_date_limit_endday='.urlencode((string) ($search_date_limit_endday)); } if ($search_date_limit_endmonth) { - $param .= '&search_date_limit_endmonth='.urlencode($search_date_limit_endmonth); + $param .= '&search_date_limit_endmonth='.urlencode((string) ($search_date_limit_endmonth)); } if ($search_date_limit_endyear) { - $param .= '&search_date_limit_endyear='.urlencode($search_date_limit_endyear); + $param .= '&search_date_limit_endyear='.urlencode((string) ($search_date_limit_endyear)); } $url = DOL_URL_ROOT.'/compta/sociales/card.php?action=create'; From 3885d1ebfe8ae69b4d8fae53dde2c822b5b36ce3 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:50:11 +0100 Subject: [PATCH 081/709] Fix: Ensure string type for urlencode() --- htdocs/compta/sociales/payments.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/sociales/payments.php b/htdocs/compta/sociales/payments.php index 22bde6bf509..b97882242e3 100644 --- a/htdocs/compta/sociales/payments.php +++ b/htdocs/compta/sociales/payments.php @@ -123,10 +123,10 @@ if ($sortorder) { $param .= '&sortorder='.urlencode($sortorder); } if ($year) { - $param .= '&year='.urlencode($year); + $param .= '&year='.urlencode((string) ($year)); } if ($search_sc_type) { - $param .= '&search_sc_type='.urlencode($search_sc_type); + $param .= '&search_sc_type='.urlencode((string) ($search_sc_type)); } if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); From 6ea6b52cf9ea15528f5e7d3f94f68b4becd45e45 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:50:13 +0100 Subject: [PATCH 082/709] Fix: Ensure string type for urlencode() --- htdocs/contact/consumption.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/contact/consumption.php b/htdocs/contact/consumption.php index 67714ae131e..66067b00e6e 100644 --- a/htdocs/contact/consumption.php +++ b/htdocs/contact/consumption.php @@ -368,7 +368,7 @@ $param .= "&month=".urlencode($month); $param .= "&year=".urlencode($year); $param .= "&sprod_fulldescr=".urlencode($sprod_fulldescr); if (!empty($socid)) { - $param .= "&socid=".urlencode($socid); + $param .= "&socid=".urlencode((string) ($socid)); } $param .= "&type_element=".urlencode($type_element); @@ -382,7 +382,7 @@ if ($sql_select) { $num = $db->num_rows($resql); - $param = (!empty($socid) ? "&socid=".urlencode($socid) : "")."&type_element=".urlencode($type_element)."&id=".urlencode($id); + $param = (!empty($socid) ? "&socid=".urlencode((string) ($socid)) : "")."&type_element=".urlencode((string) ($type_element))."&id=".urlencode((string) ($id)); if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -396,10 +396,10 @@ if ($sql_select) { $param .= "&sref=".urlencode($sref); } if ($month) { - $param .= "&month=".urlencode($month); + $param .= "&month=".urlencode((string) ($month)); } if ($year) { - $param .= "&year=".urlencode($year); + $param .= "&year=".urlencode((string) ($year)); } if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); From c877b3ddb30687d5c2c267b35b184b1b483377cb Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:50:16 +0100 Subject: [PATCH 083/709] Fix: Ensure string type for urlencode() --- htdocs/contact/list.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 6fefaccd5cc..d391b2e8d4b 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -832,25 +832,25 @@ if ($limit > 0 && $limit != $conf->liste_limit) { if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); } -$param .= '&begin='.urlencode($begin).'&userid='.urlencode($userid).'&contactname='.urlencode($search_all); +$param .= '&begin='.urlencode((string) ($begin)).'&userid='.urlencode((string) ($userid)).'&contactname='.urlencode((string) ($search_all)); $param .= '&type='.urlencode($type).'&view='.urlencode($view); if (!empty($search_sale) && $search_sale != '-1') { $param .= '&search_sale='.urlencode($search_sale); } if (!empty($search_categ) && $search_categ != '-1') { - $param .= '&search_categ='.urlencode($search_categ); + $param .= '&search_categ='.urlencode((string) ($search_categ)); } if (!empty($search_categ_thirdparty) && $search_categ_thirdparty != '-1') { - $param .= '&search_categ_thirdparty='.urlencode($search_categ_thirdparty); + $param .= '&search_categ_thirdparty='.urlencode((string) ($search_categ_thirdparty)); } if (!empty($search_categ_supplier) && $search_categ_supplier != '-1') { - $param .= '&search_categ_supplier='.urlencode($search_categ_supplier); + $param .= '&search_categ_supplier='.urlencode((string) ($search_categ_supplier)); } if ($search_all != '') { $param .= '&search_all='.urlencode($search_all); } if ($search_id > 0) { - $param .= "&search_id=".urlencode($search_id); + $param .= "&search_id=".urlencode((string) ($search_id)); } if ($search_lastname != '') { $param .= '&search_lastname='.urlencode($search_lastname); @@ -895,16 +895,16 @@ if ($search_email != '') { $param .= '&search_email='.urlencode($search_email); } if ($search_no_email != '') { - $param .= '&search_no_email='.urlencode($search_no_email); + $param .= '&search_no_email='.urlencode((string) ($search_no_email)); } if ($search_status != '') { - $param .= '&search_status='.urlencode($search_status); + $param .= '&search_status='.urlencode((string) ($search_status)); } if ($search_priv == '0' || $search_priv == '1') { $param .= "&search_priv=".urlencode($search_priv); } if ($search_stcomm != '') { - $param .= '&search_stcomm='.urlencode($search_stcomm); + $param .= '&search_stcomm='.urlencode((string) ($search_stcomm)); } if (is_array($search_level) && count($search_level)) { foreach ($search_level as $slevel) { @@ -1688,7 +1688,7 @@ while ($i < $imaxinloop) { $titlealt = $val['label']; } if ($obj->stcomm_id != $val['id']) { - print ''.img_action($titlealt, $val['code'], $val['picto']).''; + print ''.img_action($titlealt, $val['code'], $val['picto']).''; } } print ''; From e2e55622f013226985a3676cb2518e28eefd054d Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:50:19 +0100 Subject: [PATCH 084/709] Fix: Ensure string type for urlencode() --- htdocs/contrat/list.php | 48 ++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 20345dd7d50..96c67a25af8 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -626,94 +626,94 @@ if ($search_op2df != '') { $param .= '&search_op2df='.urlencode($search_op2df); } if ($search_date_creation_startmonth) { - $param .= '&search_date_creation_startmonth='.urlencode($search_date_creation_startmonth); + $param .= '&search_date_creation_startmonth='.urlencode((string) ($search_date_creation_startmonth)); } if ($search_date_creation_startyear) { - $param .= '&search_date_creation_startyear='.urlencode($search_date_creation_startyear); + $param .= '&search_date_creation_startyear='.urlencode((string) ($search_date_creation_startyear)); } if ($search_date_creation_startday) { - $param .= '&search_date_creation_startday='.urlencode($search_date_creation_startday); + $param .= '&search_date_creation_startday='.urlencode((string) ($search_date_creation_startday)); } if ($search_date_creation_start) { $param .= '&search_date_creation_start='.urlencode($search_date_creation_start); } if ($search_date_creation_endmonth) { - $param .= '&search_date_creation_endmonth='.urlencode($search_date_creation_endmonth); + $param .= '&search_date_creation_endmonth='.urlencode((string) ($search_date_creation_endmonth)); } if ($search_date_creation_endyear) { - $param .= '&search_date_creation_endyear='.urlencode($search_date_creation_endyear); + $param .= '&search_date_creation_endyear='.urlencode((string) ($search_date_creation_endyear)); } if ($search_date_creation_endday) { - $param .= '&search_date_creation_endday='.urlencode($search_date_creation_endday); + $param .= '&search_date_creation_endday='.urlencode((string) ($search_date_creation_endday)); } if ($search_date_creation_end) { $param .= '&search_date_creation_end='.urlencode($search_date_creation_end); } if ($search_date_modif_startmonth) { - $param .= '&search_date_modif_startmonth='.urlencode($search_date_modif_startmonth); + $param .= '&search_date_modif_startmonth='.urlencode((string) ($search_date_modif_startmonth)); } if ($search_date_modif_startyear) { - $param .= '&search_date_modif_startyear='.urlencode($search_date_modif_startyear); + $param .= '&search_date_modif_startyear='.urlencode((string) ($search_date_modif_startyear)); } if ($search_date_modif_startday) { - $param .= '&search_date_modif_startday='.urlencode($search_date_modif_startday); + $param .= '&search_date_modif_startday='.urlencode((string) ($search_date_modif_startday)); } if ($search_date_modif_start) { $param .= '&search_date_modif_start='.urlencode($search_date_modif_start); } if ($search_date_modif_endmonth) { - $param .= '&search_date_modif_endmonth='.urlencode($search_date_modif_endmonth); + $param .= '&search_date_modif_endmonth='.urlencode((string) ($search_date_modif_endmonth)); } if ($search_date_modif_endyear) { - $param .= '&search_date_modif_endyear='.urlencode($search_date_modif_endyear); + $param .= '&search_date_modif_endyear='.urlencode((string) ($search_date_modif_endyear)); } if ($search_date_modif_endday) { - $param .= '&search_date_modif_endday='.urlencode($search_date_modif_endday); + $param .= '&search_date_modif_endday='.urlencode((string) ($search_date_modif_endday)); } if ($search_date_modif_end) { $param .= '&search_date_modif_end=' . urlencode($search_date_modif_end); } if ($search_date_startday > 0) { - $param .= '&search_date_startday='.urlencode($search_date_startday); + $param .= '&search_date_startday='.urlencode((string) ($search_date_startday)); } if ($search_date_startmonth > 0) { - $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); + $param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth)); } if ($search_date_startyear > 0) { - $param .= '&search_date_startyear='.urlencode($search_date_startyear); + $param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear)); } if ($search_date_endday > 0) { - $param .= '&search_date_endday='.urlencode($search_date_endday); + $param .= '&search_date_endday='.urlencode((string) ($search_date_endday)); } if ($search_date_endmonth > 0) { - $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + $param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth)); } if ($search_date_endyear > 0) { - $param .= '&search_date_endyear='.urlencode($search_date_endyear); + $param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear)); } if ($search_dfyear > 0) { - $param .= '&search_dfyear='.urlencode($search_dfyear); + $param .= '&search_dfyear='.urlencode((string) ($search_dfyear)); } if ($search_dfmonth > 0) { - $param .= '&search_dfmonth='.urlencode($search_dfmonth); + $param .= '&search_dfmonth='.urlencode((string) ($search_dfmonth)); } if ($search_sale > 0) { $param .= '&search_sale='.urlencode($search_sale); } if ($search_user > 0) { - $param .= '&search_user='.urlencode($search_user); + $param .= '&search_user='.urlencode((string) ($search_user)); } if ($search_type_thirdparty > 0) { - $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty); + $param .= '&search_type_thirdparty='.urlencode((string) ($search_type_thirdparty)); } if ($search_country != '') { $param .= "&search_country=".urlencode($search_country); } if ($search_product_category > 0) { - $param .= '&search_product_category='.urlencode($search_product_category); + $param .= '&search_product_category='.urlencode((string) ($search_product_category)); } if ($show_files) { - $param .= '&show_files='.urlencode($show_files); + $param .= '&show_files='.urlencode((string) ($show_files)); } if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); From 895c7714b620051ce3f32fbcafdbb56b1cc59ebc Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:50:22 +0100 Subject: [PATCH 085/709] Fix: Ensure string type for urlencode() --- htdocs/contrat/messaging.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/contrat/messaging.php b/htdocs/contrat/messaging.php index f7e1b285291..8f3e5fac95e 100644 --- a/htdocs/contrat/messaging.php +++ b/htdocs/contrat/messaging.php @@ -37,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; // Load translation files required by the page $langs->loadLangs(array('agenda', 'contrat', 'companies')); -$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'contratagenda'; +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'contratagenda'; if (GETPOST('actioncode', 'array')) { $actioncode = GETPOST('actioncode', 'array', 3); @@ -45,7 +45,7 @@ if (GETPOST('actioncode', 'array')) { $actioncode = '0'; } } else { - $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT')); + $actioncode = GETPOST("actioncode", "alpha", 3) ? GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT')); } $search_rowid = GETPOST('search_rowid'); @@ -56,7 +56,7 @@ $confirm = GETPOST('confirm', 'alpha'); $id = GETPOSTINT('id'); $ref = GETPOST('ref', 'alpha'); -$limit = GETPOSTINT('limit') ?GETPOSTINT('limit') : $conf->liste_limit; +$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); @@ -101,7 +101,7 @@ if (!$user->hasRight('contrat', 'lire')) { /* * Actions */ -$parameters = array('id'=>$id); +$parameters = array('id' => $id); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -241,7 +241,7 @@ if (isModEnabled('agenda')) { if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { print '
'; - $param = '&id='.urlencode($id); + $param = '&id='.urlencode((string) ($id)); if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -254,9 +254,9 @@ if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $cachekey = 'count_events_thirdparty_'.$object->id; $nbEvent = dol_getcache($cachekey); - $titlelist = $langs->trans("ActionsOnCompany").(is_numeric($nbEvent) ? '('.$nbEvent.')': ''); + $titlelist = $langs->trans("ActionsOnCompany").(is_numeric($nbEvent) ? '('.$nbEvent.')' : ''); if (!empty($conf->dol_optimize_smallscreen)) { - $titlelist = $langs->trans("Actions").(is_numeric($nbEvent) ? '('.$nbEvent.')': ''); + $titlelist = $langs->trans("Actions").(is_numeric($nbEvent) ? '('.$nbEvent.')' : ''); } print_barre_liste($titlelist, 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 0); From e21c3df6612b7ea0647d0d4fdf59e46d6584bb88 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:50:25 +0100 Subject: [PATCH 086/709] Fix: Ensure string type for urlencode() --- htdocs/core/ajax/ajaxdirpreview.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index 48ee32f5de2..3fbd13840c2 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -321,7 +321,7 @@ if ($type == 'directory') { $param .= '&website='.urlencode(GETPOST('website', 'alpha')); } if (!preg_match('/pageid=/', $param)) { - $param .= '&pageid='.urlencode(GETPOSTINT('pageid')); + $param .= '&pageid='.urlencode((string) (GETPOSTINT('pageid'))); } //if (!preg_match('/backtopage=/',$param)) $param.='&backtopage='.urlencode($_SERVER["PHP_SELF"].'?file_manager=1&website='.$websitekey.'&pageid='.$pageid); } From 83d8f9cdd7b2f59f7b137bab33b570fa2e74d1a9 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:50:27 +0100 Subject: [PATCH 087/709] Fix: Ensure string type for urlencode() --- htdocs/core/class/fileupload.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/fileupload.class.php b/htdocs/core/class/fileupload.class.php index 290a75738e0..686bc3566d0 100644 --- a/htdocs/core/class/fileupload.class.php +++ b/htdocs/core/class/fileupload.class.php @@ -197,7 +197,7 @@ class FileUpload */ protected function setFileDeleteUrl($file) { - $file->delete_url = $this->options['script_url'].'?file='.urlencode($file->name).'&fk_element='.urlencode($this->fk_element).'&element='.urlencode($this->element); + $file->delete_url = $this->options['script_url'].'?file='.urlencode((string) ($file->name)).'&fk_element='.urlencode((string) ($this->fk_element)).'&element='.urlencode((string) ($this->element)); $file->delete_type = $this->options['delete_type']; if ($file->delete_type !== 'DELETE') { $file->delete_url .= '&_method=DELETE'; From 8195fa49d988cb54c6976bc21459465d770bbc27 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:50:30 +0100 Subject: [PATCH 088/709] Fix: Ensure string type for urlencode() --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index fb7f4a0ea4d..1fe85f48a4f 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1342,7 +1342,7 @@ class Form } // mode 1 - $urloption = 'htmlname=' . urlencode(str_replace('.', '_', $htmlname)) . '&outjson=1&filter=' . urlencode($filter) . (empty($excludeids) ? '' : '&excludeids=' . implode(',', $excludeids)) . ($showtype ? '&showtype=' . urlencode($showtype) : '') . ($showcode ? '&showcode=' . urlencode($showcode) : ''); + $urloption = 'htmlname=' . urlencode((string) (str_replace('.', '_', $htmlname))) . '&outjson=1&filter=' . urlencode((string) ($filter)) . (empty($excludeids) ? '' : '&excludeids=' . implode(',', $excludeids)) . ($showtype ? '&showtype=' . urlencode((string) ($showtype)) : '') . ($showcode ? '&showcode=' . urlencode((string) ($showcode)) : ''); $out .= ''; if (empty($hidelabel)) { From c7b1a924c2a033fa1e25a75beda5028c234d5cd5 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:50:32 +0100 Subject: [PATCH 089/709] Fix: Ensure string type for urlencode() --- htdocs/core/lib/company.lib.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 7caa6533194..a4cd09de402 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -229,7 +229,7 @@ function societe_prepare_head(Societe $object) //if (isModEnabled('stripe') && $nbBankAccount > 0) $nbBankAccount = '...'; // No way to know exact number - $head[$h][0] = DOL_URL_ROOT.'/societe/paymentmodes.php?socid='.urlencode($object->id); + $head[$h][0] = DOL_URL_ROOT.'/societe/paymentmodes.php?socid='.urlencode((string) ($object->id)); $head[$h][1] = $title; if ($foundonexternalonlinesystem) { $head[$h][1] .= '...'; @@ -249,7 +249,7 @@ function societe_prepare_head(Societe $object) $site_filter_list[] = 'dolibarr_portal'; } - $head[$h][0] = DOL_URL_ROOT.'/societe/website.php?id='.urlencode($object->id); + $head[$h][0] = DOL_URL_ROOT.'/societe/website.php?id='.urlencode((string) ($object->id)); $head[$h][1] = $langs->trans("WebSiteAccounts"); $nbNote = 0; $sql = "SELECT COUNT(n.rowid) as nb"; @@ -333,7 +333,7 @@ function societe_prepare_head(Societe $object) dol_setcache($cachekey, $nbNotif, 120); // If setting cache fails, this is not a problem, so we do not test result. } - $head[$h][0] = DOL_URL_ROOT.'/societe/notify/card.php?socid='.urlencode($object->id); + $head[$h][0] = DOL_URL_ROOT.'/societe/notify/card.php?socid='.urlencode((string) ($object->id)); $head[$h][1] = $langs->trans("Notifications"); if ($nbNotif > 0) { $head[$h][1] .= ''.$nbNotif.''; @@ -350,7 +350,7 @@ function societe_prepare_head(Societe $object) if (!empty($object->note_public)) { $nbNote++; } - $head[$h][0] = DOL_URL_ROOT.'/societe/note.php?id='.urlencode($object->id); + $head[$h][0] = DOL_URL_ROOT.'/societe/note.php?id='.urlencode((string) ($object->id)); $head[$h][1] = $langs->trans("Notes"); if ($nbNote > 0) { $head[$h][1] .= ''.$nbNote.''; @@ -1155,12 +1155,12 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table print "\n".''."\n"; - $param = "socid=".urlencode($object->id); + $param = "socid=".urlencode((string) ($object->id)); if ($search_rowid != '') { - $param .= '&search_rowid='.urlencode($search_rowid); + $param .= '&search_rowid='.urlencode((string) ($search_rowid)); } if ($search_status != '') { - $param .= '&search_status='.urlencode($search_status); + $param .= '&search_status='.urlencode((string) ($search_status)); } if (count($search_roles) > 0) { $param .= implode('&search_roles[]=', $search_roles); From d023b43da96841bd2947a92cbad3824cde5a3646 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:50:35 +0100 Subject: [PATCH 090/709] Fix: Ensure string type for urlencode() --- htdocs/core/lib/invoice.lib.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index 9e6a39c63f9..14a80f1c751 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -47,7 +47,7 @@ function facture_prepare_head($object) if (!getDolGlobalString('MAIN_DISABLE_CONTACTS_TAB')) { $nbContact = count($object->liste_contact(-1, 'internal')) + count($object->liste_contact(-1, 'external')); - $head[$h][0] = DOL_URL_ROOT.'/compta/facture/contact.php?id='.urlencode($object->id); + $head[$h][0] = DOL_URL_ROOT.'/compta/facture/contact.php?id='.urlencode((string) ($object->id)); $head[$h][1] = $langs->trans('ContactsAddresses'); if ($nbContact > 0) { $head[$h][1] .= ''.$nbContact.''; @@ -73,7 +73,7 @@ function facture_prepare_head($object) } $langs->load("banks"); - $head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?id='.urlencode($object->id); + $head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?id='.urlencode((string) ($object->id)); $head[$h][1] = $langs->trans('StandingOrders'); if ($nbStandingOrders > 0) { $head[$h][1] .= ''.$nbStandingOrders.''; @@ -120,7 +120,7 @@ function facture_prepare_head($object) $head[$h][0] = DOL_URL_ROOT.'/compta/facture/agenda.php?id='.$object->id; $head[$h][1] = $langs->trans("Events"); - if (isModEnabled('agenda')&& ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { + if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { $nbEvent = 0; // Enable caching of thirdparty count actioncomm require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; @@ -262,7 +262,7 @@ function invoice_rec_prepare_head($object) $head[$h][0] = DOL_URL_ROOT.'/compta/facture/agenda-rec.php?id='.$object->id; $head[$h][1] = $langs->trans("Events"); - if (isModEnabled('agenda')&& ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { + if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { $nbEvent = 0; // Enable caching of thirdparty count actioncomm require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; @@ -346,7 +346,7 @@ function getNumberInvoicesPieChart($mode) if (($mode == 'customers' && isModEnabled('invoice') && $user->hasRight('facture', 'lire')) || ($mode == 'suppliers' && (isModEnabled('fournisseur') || isModEnabled('supplier_invoice')) && $user->hasRight('fournisseur', 'facture', 'lire')) - ) { + ) { global $badgeStatus1, $badgeStatus3, $badgeStatus4, $badgeStatus8, $badgeStatus11; include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php'; @@ -402,7 +402,7 @@ function getNumberInvoicesPieChart($mode) ,array($langs->trans('InvoiceNotLate15Days'), $obj->nbnotlate15 - $obj->nbnotlate30) ,array($langs->trans('InvoiceNotLate30Days'), $obj->nbnotlate30)); */ - $dataseries[$i]=array($langs->transnoentitiesnoconv('NbOfOpenInvoices'), $obj->nblate30, $obj->nblate15 - $obj->nblate30, $obj->nblatenow - $obj->nblate15, $obj->nbnotlatenow - $obj->nbnotlate15, $obj->nbnotlate15 - $obj->nbnotlate30, $obj->nbnotlate30); + $dataseries[$i] = array($langs->transnoentitiesnoconv('NbOfOpenInvoices'), $obj->nblate30, $obj->nblate15 - $obj->nblate30, $obj->nblatenow - $obj->nblate15, $obj->nbnotlatenow - $obj->nbnotlate15, $obj->nbnotlate15 - $obj->nbnotlate30, $obj->nbnotlate30); $i++; } if (!empty($dataseries[0])) { From d994f5f7c5157bc4050789847f777a78383e2c18 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:50:37 +0100 Subject: [PATCH 091/709] Fix: Ensure string type for urlencode() --- htdocs/don/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/don/card.php b/htdocs/don/card.php index 2e28a7c2655..ac8c85fe697 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -164,7 +164,7 @@ if (empty($reshook)) { // Action update object if ($action == 'update') { if (!empty($cancel)) { - header("Location: ".$_SERVER['PHP_SELF']."?id=".urlencode($id)); + header("Location: ".$_SERVER['PHP_SELF']."?id=".urlencode((string) ($id))); exit; } From 040fc33b02f888b7c0eb5d4f24c89c8bdddc429c Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:50:41 +0100 Subject: [PATCH 092/709] Fix: Ensure string type for urlencode() --- htdocs/don/paiement/list.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/don/paiement/list.php b/htdocs/don/paiement/list.php index 4e25ab90823..b314131ca5b 100644 --- a/htdocs/don/paiement/list.php +++ b/htdocs/don/paiement/list.php @@ -269,22 +269,22 @@ if ($search_ref) { $param .= '&search_ref='.urlencode($search_ref); } if ($search_date_startday) { - $param .= '&search_date_startday='.urlencode($search_date_startday); + $param .= '&search_date_startday='.urlencode((string) ($search_date_startday)); } if ($search_date_startmonth) { - $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); + $param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth)); } if ($search_date_startyear) { - $param .= '&search_date_startyear='.urlencode($search_date_startyear); + $param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear)); } if ($search_date_endday) { - $param .= '&search_date_endday='.urlencode($search_date_endday); + $param .= '&search_date_endday='.urlencode((string) ($search_date_endday)); } if ($search_date_endmonth) { - $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + $param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth)); } if ($search_date_endyear) { - $param .= '&search_date_endyear='.urlencode($search_date_endyear); + $param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear)); } if ($search_company) { $param .= '&search_company='.urlencode($search_company); @@ -296,7 +296,7 @@ if ($search_paymenttype) { $param .= '&search_paymenttype='.urlencode($search_paymenttype); } if ($search_account) { - $param .= '&search_account='.urlencode($search_account); + $param .= '&search_account='.urlencode((string) ($search_account)); } if ($search_payment_num) { $param .= '&search_payment_num='.urlencode($search_payment_num); From b37c850a4b1659920a592bff67d72cd08f36e58e Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:50:44 +0100 Subject: [PATCH 093/709] Fix: Ensure string type for urlencode() --- htdocs/ecm/index_medias.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/ecm/index_medias.php b/htdocs/ecm/index_medias.php index 8c888b6792a..cc98e0173b4 100644 --- a/htdocs/ecm/index_medias.php +++ b/htdocs/ecm/index_medias.php @@ -110,7 +110,7 @@ $hookmanager->initHooks(array('ecmmediascard', 'globalcard')); */ $savbacktopage = $backtopage; -$backtopage = $_SERVER["PHP_SELF"].'?file_manager=1&website='.urlencode($websitekey).'&pageid='.urlencode($pageid).(GETPOST('section_dir', 'alpha') ? '§ion_dir='.urlencode(GETPOST('section_dir', 'alpha')) : ''); // used after a confirm_deletefile into actions_linkedfiles.inc.php +$backtopage = $_SERVER["PHP_SELF"].'?file_manager=1&website='.urlencode((string) ($websitekey)).'&pageid='.urlencode((string) ($pageid)).(GETPOST('section_dir', 'alpha') ? '§ion_dir='.urlencode((string) (GETPOST('section_dir', 'alpha'))) : ''); // used after a confirm_deletefile into actions_linkedfiles.inc.php if ($sortfield) { $backtopage .= '&sortfield='.urlencode($sortfield); } @@ -232,11 +232,11 @@ if ($action == 'refreshmanual') { //print $ecmdirtmp->cachenbofdoc."
\n";exit; $id = $ecmdirtmp->create($user); if ($id > 0) { - $newdirsql = array('id'=>$id, - 'id_mere'=>$ecmdirtmp->fk_parent, - 'label'=>$ecmdirtmp->label, - 'description'=>$ecmdirtmp->description, - 'fullrelativename'=>$relativepathmissing); + $newdirsql = array('id' => $id, + 'id_mere' => $ecmdirtmp->fk_parent, + 'label' => $ecmdirtmp->label, + 'description' => $ecmdirtmp->description, + 'fullrelativename' => $relativepathmissing); $sqltree[] = $newdirsql; // We complete fulltree for following loops //var_dump($sqltree); $adirwascreated = 1; From 4d8c3fc588b57f349231e33759d0c10183eb55ef Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:50:47 +0100 Subject: [PATCH 094/709] Fix: Ensure string type for urlencode() --- htdocs/eventorganization/class/conferenceorbooth.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/eventorganization/class/conferenceorbooth.class.php b/htdocs/eventorganization/class/conferenceorbooth.class.php index 0ff0e06936f..e71e7b2688b 100644 --- a/htdocs/eventorganization/class/conferenceorbooth.class.php +++ b/htdocs/eventorganization/class/conferenceorbooth.class.php @@ -258,7 +258,7 @@ class ConferenceOrBooth extends ActionComm $result = parent::fetch($id, $ref, $ref_ext, $email_msgid); - $link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_new.php?id='.urlencode($id).'&type=conf'; + $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); $link_subscription .= '&securekey='.urlencode($encodedsecurekey); From 049ff47d30ad8529400190cfd034fe5d55f40613 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:50:49 +0100 Subject: [PATCH 095/709] Fix: Ensure string type for urlencode() --- htdocs/eventorganization/conferenceorboothattendee_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/eventorganization/conferenceorboothattendee_list.php b/htdocs/eventorganization/conferenceorboothattendee_list.php index 6e752262eff..93ae78eeeb2 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_list.php +++ b/htdocs/eventorganization/conferenceorboothattendee_list.php @@ -709,7 +709,7 @@ if ($confOrBooth->id > 0) { $param .= '&conforboothid='.urlencode($confOrBooth->id); } if ($projectstatic->id > 0) { - $param .= '&fk_project='.urlencode($projectstatic->id); + $param .= '&fk_project='.urlencode((string) ($projectstatic->id)); } $param .= $withProjectUrl; From 1e5ae42b26b08a7f9855061f849d385eec400ee6 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:50:52 +0100 Subject: [PATCH 096/709] Fix: Ensure string type for urlencode() --- htdocs/expedition/list.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 37e1c6a4e17..86309c6da9f 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -528,10 +528,10 @@ if ($search_ref_customer) { $param .= "&search_ref_customer=".urlencode($search_ref_customer); } if ($search_user > 0) { - $param .= '&search_user='.urlencode($search_user); + $param .= '&search_user='.urlencode((string) ($search_user)); } if ($search_sale > 0) { - $param .= '&search_sale='.urlencode($search_sale); + $param .= '&search_sale='.urlencode((string) ($search_sale)); } if ($search_company) { $param .= "&search_company=".urlencode($search_company); @@ -551,7 +551,7 @@ if ($search_zip) { $param .= '&search_zip='.urlencode($search_zip); } if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) { - $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty); + $param .= '&search_type_thirdparty='.urlencode((string) ($search_type_thirdparty)); } if ($search_datedelivery_start) { $param .= '&search_datedelivery_startday='.urlencode(dol_print_date($search_datedelivery_start, '%d')).'&search_datedelivery_startmonth='.urlencode(dol_print_date($search_datedelivery_start, '%m')).'&search_datedelivery_startyear='.urlencode(dol_print_date($search_datedelivery_start, '%Y')); @@ -566,10 +566,10 @@ if ($search_datereceipt_end) { $param .= '&search_datereceipt_endday='.urlencode(dol_print_date($search_datereceipt_end, '%d')).'&search_datereceipt_endmonth='.urlencode(dol_print_date($search_datereceipt_end, '%m')).'&search_datereceipt_endyear='.urlencode(dol_print_date($search_datereceipt_end, '%Y')); } if ($search_product_category != '') { - $param .= '&search_product_category='.urlencode($search_product_category); + $param .= '&search_product_category='.urlencode((string) ($search_product_category)); } if (($search_categ_cus > 0) || ($search_categ_cus == -2)) { - $param .= '&search_categ_cus='.urlencode($search_categ_cus); + $param .= '&search_categ_cus='.urlencode((string) ($search_categ_cus)); } if ($search_status != '') { $param .= '&search_status='.urlencode($search_status); From 823c67585016e6a00c34acd4cdc10031d910cfa6 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:50:55 +0100 Subject: [PATCH 097/709] Fix: Ensure string type for urlencode() --- htdocs/expedition/shipment.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 7809b47105b..1b4f33382a2 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -260,7 +260,7 @@ if ($id > 0 || !empty($ref)) { // Confirm validation if ($action == 'cloture') { - $formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=".urlencode($id), $langs->trans("CloseShipment"), $langs->trans("ConfirmCloseShipment"), "confirm_cloture"); + $formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=".urlencode((string) ($id)), $langs->trans("CloseShipment"), $langs->trans("ConfirmCloseShipment"), "confirm_cloture"); } // Call Hook formConfirm @@ -794,7 +794,7 @@ if ($id > 0 || !empty($ref)) { print ' '.img_warning($langs->trans("StockTooLow")); if (getDolGlobalString('STOCK_CORRECT_STOCK_IN_SHIPMENT')) { $nbPiece = $toBeShipped[$objp->fk_product] - $product->stock_reel; - print '   '.$langs->trans("GoTo").' '.$langs->trans("CorrectStock").''; + print '   '.$langs->trans("GoTo").' '.$langs->trans("CorrectStock").''; } } print ''; From 888ac3edeeb22d60397ec245f66cbef05ae89410 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:51:00 +0100 Subject: [PATCH 098/709] Fix: Ensure string type for urlencode() --- htdocs/expensereport/list.php | 78 +++++++++++++++++------------------ 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 06fb2d4e9ac..6cc403e87d5 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -149,29 +149,29 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen // List of fields to search into when doing a "search in all" $fieldstosearchall = array( - 'd.ref'=>'Ref', - 'd.note_public'=>"NotePublic", - 'u.lastname'=>'EmployeeLastname', - 'u.firstname'=>"EmployeeFirstname", - 'u.login'=>"Login", + 'd.ref' => 'Ref', + 'd.note_public' => "NotePublic", + 'u.lastname' => 'EmployeeLastname', + 'u.firstname' => "EmployeeFirstname", + 'u.login' => "Login", ); if (empty($user->socid)) { $fieldstosearchall["d.note_private"] = "NotePrivate"; } $arrayfields = array( - 'd.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), - 'user'=>array('label'=>$langs->trans("User"), 'checked'=>1), - 'd.date_debut'=>array('label'=>$langs->trans("DateStart"), 'checked'=>1), - 'd.date_fin'=>array('label'=>$langs->trans("DateEnd"), 'checked'=>1), - 'd.date_valid'=>array('label'=>$langs->trans("DateValidation"), 'checked'=>1), - 'd.date_approve'=>array('label'=>$langs->trans("DateApprove"), 'checked'=>1), - 'd.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1), - 'd.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>1), - 'd.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>1), - 'd.date_create'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), - 'd.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), - 'd.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), + 'd.ref' => array('label' => $langs->trans("Ref"), 'checked' => 1), + 'user' => array('label' => $langs->trans("User"), 'checked' => 1), + 'd.date_debut' => array('label' => $langs->trans("DateStart"), 'checked' => 1), + 'd.date_fin' => array('label' => $langs->trans("DateEnd"), 'checked' => 1), + 'd.date_valid' => array('label' => $langs->trans("DateValidation"), 'checked' => 1), + 'd.date_approve' => array('label' => $langs->trans("DateApprove"), 'checked' => 1), + 'd.total_ht' => array('label' => $langs->trans("AmountHT"), 'checked' => 1), + 'd.total_vat' => array('label' => $langs->trans("AmountVAT"), 'checked' => 1), + 'd.total_ttc' => array('label' => $langs->trans("AmountTTC"), 'checked' => 1), + 'd.date_create' => array('label' => $langs->trans("DateCreation"), 'checked' => 0, 'position' => 500), + 'd.tms' => array('label' => $langs->trans("DateModificationShort"), 'checked' => 0, 'position' => 500), + 'd.fk_statut' => array('label' => $langs->trans("Status"), 'checked' => 1, 'position' => 1000), ); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; @@ -193,7 +193,7 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa $massaction = ''; } -$parameters = array('socid'=>$socid); +$parameters = array('socid' => $socid); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -397,41 +397,41 @@ if ($resql) { } // Start date if ($search_date_startday) { - $param .= '&search_date_startday='.urlencode($search_date_startday); + $param .= '&search_date_startday='.urlencode((string) ($search_date_startday)); } if ($search_date_startmonth) { - $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); + $param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth)); } if ($search_date_startyear) { - $param .= '&search_date_startyear='.urlencode($search_date_startyear); + $param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear)); } if ($search_date_startendday) { - $param .= '&search_date_startendday='.urlencode($search_date_startendday); + $param .= '&search_date_startendday='.urlencode((string) ($search_date_startendday)); } if ($search_date_startendmonth) { - $param .= '&search_date_startendmonth='.urlencode($search_date_startendmonth); + $param .= '&search_date_startendmonth='.urlencode((string) ($search_date_startendmonth)); } if ($search_date_startendyear) { - $param .= '&search_date_startendyear='.urlencode($search_date_startendyear); + $param .= '&search_date_startendyear='.urlencode((string) ($search_date_startendyear)); } // End date if ($search_date_endday) { - $param .= '&search_date_endday='.urlencode($search_date_endday); + $param .= '&search_date_endday='.urlencode((string) ($search_date_endday)); } if ($search_date_endmonth) { - $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + $param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth)); } if ($search_date_endyear) { - $param .= '&search_date_endyear='.urlencode($search_date_endyear); + $param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear)); } if ($search_date_endendday) { - $param .= '&search_date_endendday='.urlencode($search_date_endendday); + $param .= '&search_date_endendday='.urlencode((string) ($search_date_endendday)); } if ($search_date_endendmonth) { - $param .= '&search_date_endendmonth='.urlencode($search_date_endendmonth); + $param .= '&search_date_endendmonth='.urlencode((string) ($search_date_endendmonth)); } if ($search_date_endendyear) { - $param .= '&search_date_endendyear='.urlencode($search_date_endendyear); + $param .= '&search_date_endendyear='.urlencode((string) ($search_date_endendyear)); } if ($search_user) { $param .= "&search_user=".urlencode($search_user); @@ -453,9 +453,9 @@ if ($resql) { // List of mass actions available $arrayofmassactions = array( - 'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"), - 'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), - 'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), + 'generate_doc' => img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"), + 'builddoc' => img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), + 'presend' => img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), ); if ($user->hasRight('expensereport', 'supprimer')) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); @@ -519,8 +519,8 @@ if ($resql) { $url .= '&socid='.$socid; } $newcardbutton = ''; - $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); - $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss' => 'reposition')); + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss' => 'reposition')); $newcardbutton .= dolGetButtonTitleSeparator(); $newcardbutton .= dolGetButtonTitle($langs->trans('NewTrip'), '', 'fa fa-plus-circle', $url, '', $user->hasRight('expensereport', 'creer')); @@ -638,7 +638,7 @@ if ($resql) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook - $parameters = array('arrayfields'=>$arrayfields); + $parameters = array('arrayfields' => $arrayfields); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation @@ -714,7 +714,7 @@ if ($resql) { // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields - $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); + $parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (!empty($arrayfields['d.date_create']['checked'])) { @@ -921,7 +921,7 @@ if ($resql) { // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $parameters = array('arrayfields' => $arrayfields, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; @@ -990,7 +990,7 @@ if ($resql) { $db->free($resql); - $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); + $parameters = array('arrayfields' => $arrayfields, 'sql' => $sql); $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; From 310550f67621af85d5ace9067b8fe73b20de2b68 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:51:04 +0100 Subject: [PATCH 099/709] Fix: Ensure string type for urlencode() --- htdocs/expensereport/payment/list.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/expensereport/payment/list.php b/htdocs/expensereport/payment/list.php index d0c10e49a56..88cd5ecb2d0 100644 --- a/htdocs/expensereport/payment/list.php +++ b/htdocs/expensereport/payment/list.php @@ -274,22 +274,22 @@ if ($search_ref) { $param .= '&search_ref='.urlencode($search_ref); } if ($search_date_startday) { - $param .= '&search_date_startday='.urlencode($search_date_startday); + $param .= '&search_date_startday='.urlencode((string) ($search_date_startday)); } if ($search_date_startmonth) { - $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); + $param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth)); } if ($search_date_startyear) { - $param .= '&search_date_startyear='.urlencode($search_date_startyear); + $param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear)); } if ($search_date_endday) { - $param .= '&search_date_endday='.urlencode($search_date_endday); + $param .= '&search_date_endday='.urlencode((string) ($search_date_endday)); } if ($search_date_endmonth) { - $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + $param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth)); } if ($search_date_endyear) { - $param .= '&search_date_endyear='.urlencode($search_date_endyear); + $param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear)); } if ($search_user) { $param .= '&search_user='.urlencode($search_user); @@ -305,7 +305,7 @@ if ($search_amount) { } if ($search_bank_account) { - $param .= '&search_bank_account='.urlencode($search_bank_account); + $param .= '&search_bank_account='.urlencode((string) ($search_bank_account)); } // Add $param from extra fields From d234c97992224c8a076c256c1b65f063b5bca3df Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:51:09 +0100 Subject: [PATCH 100/709] Fix: Ensure string type for urlencode() --- htdocs/fichinter/agenda.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/fichinter/agenda.php b/htdocs/fichinter/agenda.php index ec91ebd4ae9..e348b888d55 100644 --- a/htdocs/fichinter/agenda.php +++ b/htdocs/fichinter/agenda.php @@ -95,7 +95,7 @@ restrictedArea($user, 'ficheinter', $object->id, 'fichinter', '', 'fk_soc', 'row * Actions */ -$parameters = array('id'=>$id); +$parameters = array('id' => $id); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -189,14 +189,14 @@ if ($object->id > 0) { $objthirdparty = $object; $objcon = new stdClass(); - $out = '&origin='.urlencode($object->element.(property_exists($object, 'module') ? '@'.$object->module : '')).'&originid='.urlencode($object->id); + $out = '&origin='.urlencode((string) ($object->element.(property_exists($object, 'module') ? '@'.$object->module : ''))).'&originid='.urlencode((string) ($object->id)); $urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id; $out .= '&backtopage='.urlencode($urlbacktopage); $permok = $user->hasRight('agenda', 'myactions', 'create'); if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) { //$out.=' Date: Fri, 8 Mar 2024 02:51:12 +0100 Subject: [PATCH 101/709] Fix: Ensure string type for urlencode() --- htdocs/fichinter/list.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 89d86259763..20878a34e16 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -436,7 +436,7 @@ if ($search_all) { $param .= "&search_all=".urlencode($search_all); } if ($socid) { - $param .= "&socid=".urlencode($socid); + $param .= "&socid=".urlencode((string) ($socid)); } if ($search_ref) { $param .= "&search_ref=".urlencode($search_ref); @@ -454,25 +454,25 @@ if ($search_status != '' && $search_status > -1) { $param .= "&search_status=".urlencode($search_status); } if ($search_date_startday > 0) { - $param .= '&search_date_startday='.urlencode($search_date_startday); + $param .= '&search_date_startday='.urlencode((string) ($search_date_startday)); } if ($search_date_startmonth > 0) { - $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); + $param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth)); } if ($search_date_startyear > 0) { - $param .= '&search_date_startyear='.urlencode($search_date_startyear); + $param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear)); } if ($search_date_endday > 0) { - $param .= '&search_date_endday='.urlencode($search_date_endday); + $param .= '&search_date_endday='.urlencode((string) ($search_date_endday)); } if ($search_date_endmonth > 0) { - $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + $param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth)); } if ($search_date_endyear > 0) { - $param .= '&search_date_endyear='.urlencode($search_date_endyear); + $param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear)); } if ($show_files) { - $param .= '&show_files='.urlencode($show_files); + $param .= '&show_files='.urlencode((string) ($show_files)); } if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); From 3a6e3404e2e1e20a94622ae1883bf428d765e400 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:51:16 +0100 Subject: [PATCH 102/709] Fix: Ensure string type for urlencode() --- htdocs/fourn/commande/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index e3729dc7423..0f716bcecc1 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1423,7 +1423,7 @@ if (empty($reshook)) { $_GET['socid'] = $_POST['socid']; } else { $db->commit(); - header("Location: ".$_SERVER['PHP_SELF']."?id=".urlencode($id)); + header("Location: ".$_SERVER['PHP_SELF']."?id=".urlencode((string) ($id))); exit; } } From 97a20b8aa92dd3517443fbf3e30275bc087e9698 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:51:19 +0100 Subject: [PATCH 103/709] Fix: Ensure string type for urlencode() --- htdocs/fourn/commande/list.php | 112 ++++++++++++++++----------------- 1 file changed, 56 insertions(+), 56 deletions(-) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index c4d93209600..1bab50ecddd 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -586,7 +586,7 @@ if (empty($reshook)) { if ($nb_bills_created == 1) { $texttoshow = $langs->trans('BillXCreated', '{s1}'); - $texttoshow = str_replace('{s1}', ''.$lastref.'', $texttoshow); + $texttoshow = str_replace('{s1}', ''.$lastref.'', $texttoshow); setEventMessages($texttoshow, null, 'mesgs'); } else { setEventMessages($langs->trans('BillCreated', $nb_bills_created), null, 'mesgs'); @@ -607,82 +607,82 @@ if (empty($reshook)) { $param .= '&sall='.urlencode($sall); } if ($socid > 0) { - $param .= '&socid='.urlencode($socid); + $param .= '&socid='.urlencode((string) ($socid)); } if ($search_status != '') { $param .= '&search_status='.urlencode($search_status); } if ($search_date_order_startday) { - $param .= '&search_date_order_startday='.urlencode($search_date_order_startday); + $param .= '&search_date_order_startday='.urlencode((string) ($search_date_order_startday)); } if ($search_date_order_startmonth) { - $param .= '&search_date_order_startmonth='.urlencode($search_date_order_startmonth); + $param .= '&search_date_order_startmonth='.urlencode((string) ($search_date_order_startmonth)); } if ($search_date_order_startyear) { - $param .= '&search_date_order_startyear='.urlencode($search_date_order_startyear); + $param .= '&search_date_order_startyear='.urlencode((string) ($search_date_order_startyear)); } if ($search_date_order_endday) { - $param .= '&search_date_order_endday='.urlencode($search_date_order_endday); + $param .= '&search_date_order_endday='.urlencode((string) ($search_date_order_endday)); } if ($search_date_order_endmonth) { - $param .= '&search_date_order_endmonth='.urlencode($search_date_order_endmonth); + $param .= '&search_date_order_endmonth='.urlencode((string) ($search_date_order_endmonth)); } if ($search_date_order_endyear) { - $param .= '&search_date_order_endyear='.urlencode($search_date_order_endyear); + $param .= '&search_date_order_endyear='.urlencode((string) ($search_date_order_endyear)); } if ($search_date_delivery_startday) { - $param .= '&search_date_delivery_startday='.urlencode($search_date_delivery_startday); + $param .= '&search_date_delivery_startday='.urlencode((string) ($search_date_delivery_startday)); } if ($search_date_delivery_startmonth) { - $param .= '&search_date_delivery_startmonth='.urlencode($search_date_delivery_startmonth); + $param .= '&search_date_delivery_startmonth='.urlencode((string) ($search_date_delivery_startmonth)); } if ($search_date_delivery_startyear) { - $param .= '&search_date_delivery_startyear='.urlencode($search_date_delivery_startyear); + $param .= '&search_date_delivery_startyear='.urlencode((string) ($search_date_delivery_startyear)); } if ($search_date_delivery_endday) { - $param .= '&search_date_delivery_endday='.urlencode($search_date_delivery_endday); + $param .= '&search_date_delivery_endday='.urlencode((string) ($search_date_delivery_endday)); } if ($search_date_delivery_endmonth) { - $param .= '&search_date_delivery_endmonth='.urlencode($search_date_delivery_endmonth); + $param .= '&search_date_delivery_endmonth='.urlencode((string) ($search_date_delivery_endmonth)); } if ($search_date_delivery_endyear) { - $param .= '&search_date_delivery_endyear='.urlencode($search_date_delivery_endyear); + $param .= '&search_date_delivery_endyear='.urlencode((string) ($search_date_delivery_endyear)); } if ($search_date_valid_startday) { - $param .= '&search_date_valid_startday='.urlencode($search_date_valid_startday); + $param .= '&search_date_valid_startday='.urlencode((string) ($search_date_valid_startday)); } if ($search_date_valid_startmonth) { - $param .= '&search_date_valid_startmonth='.urlencode($search_date_valid_startmonth); + $param .= '&search_date_valid_startmonth='.urlencode((string) ($search_date_valid_startmonth)); } if ($search_date_valid_startyear) { - $param .= '&search_date_valid_startyear='.urlencode($search_date_valid_startyear); + $param .= '&search_date_valid_startyear='.urlencode((string) ($search_date_valid_startyear)); } if ($search_date_valid_endday) { - $param .= '&search_date_valid_endday='.urlencode($search_date_valid_endday); + $param .= '&search_date_valid_endday='.urlencode((string) ($search_date_valid_endday)); } if ($search_date_valid_endmonth) { - $param .= '&search_date_valid_endmonth='.urlencode($search_date_valid_endmonth); + $param .= '&search_date_valid_endmonth='.urlencode((string) ($search_date_valid_endmonth)); } if ($search_date_valid_endyear) { - $param .= '&search_date_valid_endyear='.urlencode($search_date_valid_endyear); + $param .= '&search_date_valid_endyear='.urlencode((string) ($search_date_valid_endyear)); } if ($search_date_approve_startday) { - $param .= '&search_date_approve_startday='.urlencode($search_date_approve_startday); + $param .= '&search_date_approve_startday='.urlencode((string) ($search_date_approve_startday)); } if ($search_date_approve_startmonth) { - $param .= '&search_date_approve_startmonth='.urlencode($search_date_approve_startmonth); + $param .= '&search_date_approve_startmonth='.urlencode((string) ($search_date_approve_startmonth)); } if ($search_date_approve_startyear) { - $param .= '&search_date_approve_startyear='.urlencode($search_date_approve_startyear); + $param .= '&search_date_approve_startyear='.urlencode((string) ($search_date_approve_startyear)); } if ($search_date_approve_endday) { - $param .= '&search_date_approve_endday='.urlencode($search_date_approve_endday); + $param .= '&search_date_approve_endday='.urlencode((string) ($search_date_approve_endday)); } if ($search_date_approve_endmonth) { - $param .= '&search_date_approve_endmonth='.urlencode($search_date_approve_endmonth); + $param .= '&search_date_approve_endmonth='.urlencode((string) ($search_date_approve_endmonth)); } if ($search_date_approve_endyear) { - $param .= '&search_date_approve_endyear='.urlencode($search_date_approve_endyear); + $param .= '&search_date_approve_endyear='.urlencode((string) ($search_date_approve_endyear)); } if ($search_ref) { $param .= '&search_ref='.urlencode($search_ref); @@ -695,7 +695,7 @@ if (empty($reshook)) { } //if ($search_ref_customer) $param .= '&search_ref_customer='.urlencode($search_ref_customer); if ($search_user > 0) { - $param .= '&search_user='.urlencode($search_user); + $param .= '&search_user='.urlencode((string) ($search_user)); } if ($search_sale > 0) { $param .= '&search_sale='.urlencode($search_sale); @@ -713,7 +713,7 @@ if (empty($reshook)) { $param .= "&search_project_ref=".urlencode($search_project_ref); } if ($show_files) { - $param .= '&show_files='.urlencode($show_files); + $param .= '&show_files='.urlencode((string) ($show_files)); } if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); @@ -1034,82 +1034,82 @@ if ($resql) { $param .= '&sall='.urlencode($sall); } if ($socid > 0) { - $param .= '&socid='.urlencode($socid); + $param .= '&socid='.urlencode((string) ($socid)); } if ($sall) { $param .= "&search_all=".urlencode($sall); } if ($search_date_order_startday) { - $param .= '&search_date_order_startday='.urlencode($search_date_order_startday); + $param .= '&search_date_order_startday='.urlencode((string) ($search_date_order_startday)); } if ($search_date_order_startmonth) { - $param .= '&search_date_order_startmonth='.urlencode($search_date_order_startmonth); + $param .= '&search_date_order_startmonth='.urlencode((string) ($search_date_order_startmonth)); } if ($search_date_order_startyear) { - $param .= '&search_date_order_startyear='.urlencode($search_date_order_startyear); + $param .= '&search_date_order_startyear='.urlencode((string) ($search_date_order_startyear)); } if ($search_date_order_endday) { - $param .= '&search_date_order_endday='.urlencode($search_date_order_endday); + $param .= '&search_date_order_endday='.urlencode((string) ($search_date_order_endday)); } if ($search_date_order_endmonth) { - $param .= '&search_date_order_endmonth='.urlencode($search_date_order_endmonth); + $param .= '&search_date_order_endmonth='.urlencode((string) ($search_date_order_endmonth)); } if ($search_date_order_endyear) { - $param .= '&search_date_order_endyear='.urlencode($search_date_order_endyear); + $param .= '&search_date_order_endyear='.urlencode((string) ($search_date_order_endyear)); } if ($search_date_delivery_startday) { - $param .= '&search_date_delivery_startday='.urlencode($search_date_delivery_startday); + $param .= '&search_date_delivery_startday='.urlencode((string) ($search_date_delivery_startday)); } if ($search_date_delivery_startmonth) { - $param .= '&search_date_delivery_startmonth='.urlencode($search_date_delivery_startmonth); + $param .= '&search_date_delivery_startmonth='.urlencode((string) ($search_date_delivery_startmonth)); } if ($search_date_delivery_startyear) { - $param .= '&search_date_delivery_startyear='.urlencode($search_date_delivery_startyear); + $param .= '&search_date_delivery_startyear='.urlencode((string) ($search_date_delivery_startyear)); } if ($search_date_delivery_endday) { - $param .= '&search_date_delivery_endday='.urlencode($search_date_delivery_endday); + $param .= '&search_date_delivery_endday='.urlencode((string) ($search_date_delivery_endday)); } if ($search_date_delivery_endmonth) { - $param .= '&search_date_delivery_endmonth='.urlencode($search_date_delivery_endmonth); + $param .= '&search_date_delivery_endmonth='.urlencode((string) ($search_date_delivery_endmonth)); } if ($search_date_delivery_endyear) { - $param .= '&search_date_delivery_endyear='.urlencode($search_date_delivery_endyear); + $param .= '&search_date_delivery_endyear='.urlencode((string) ($search_date_delivery_endyear)); } if ($search_date_valid_startday) { - $param .= '&search_date_valid_startday='.urlencode($search_date_valid_startday); + $param .= '&search_date_valid_startday='.urlencode((string) ($search_date_valid_startday)); } if ($search_date_valid_startmonth) { - $param .= '&search_date_valid_startmonth='.urlencode($search_date_valid_startmonth); + $param .= '&search_date_valid_startmonth='.urlencode((string) ($search_date_valid_startmonth)); } if ($search_date_valid_startyear) { - $param .= '&search_date_valid_startyear='.urlencode($search_date_valid_startyear); + $param .= '&search_date_valid_startyear='.urlencode((string) ($search_date_valid_startyear)); } if ($search_date_valid_endday) { - $param .= '&search_date_valid_endday='.urlencode($search_date_valid_endday); + $param .= '&search_date_valid_endday='.urlencode((string) ($search_date_valid_endday)); } if ($search_date_valid_endmonth) { - $param .= '&search_date_valid_endmonth='.urlencode($search_date_valid_endmonth); + $param .= '&search_date_valid_endmonth='.urlencode((string) ($search_date_valid_endmonth)); } if ($search_date_valid_endyear) { - $param .= '&search_date_valid_endyear='.urlencode($search_date_valid_endyear); + $param .= '&search_date_valid_endyear='.urlencode((string) ($search_date_valid_endyear)); } if ($search_date_approve_startday) { - $param .= '&search_date_approve_startday='.urlencode($search_date_approve_startday); + $param .= '&search_date_approve_startday='.urlencode((string) ($search_date_approve_startday)); } if ($search_date_approve_startmonth) { - $param .= '&search_date_approve_startmonth='.urlencode($search_date_approve_startmonth); + $param .= '&search_date_approve_startmonth='.urlencode((string) ($search_date_approve_startmonth)); } if ($search_date_approve_startyear) { - $param .= '&search_date_approve_startyear='.urlencode($search_date_approve_startyear); + $param .= '&search_date_approve_startyear='.urlencode((string) ($search_date_approve_startyear)); } if ($search_date_approve_endday) { - $param .= '&search_date_approve_endday='.urlencode($search_date_approve_endday); + $param .= '&search_date_approve_endday='.urlencode((string) ($search_date_approve_endday)); } if ($search_date_approve_endmonth) { - $param .= '&search_date_approve_endmonth='.urlencode($search_date_approve_endmonth); + $param .= '&search_date_approve_endmonth='.urlencode((string) ($search_date_approve_endmonth)); } if ($search_date_approve_endyear) { - $param .= '&search_date_approve_endyear='.urlencode($search_date_approve_endyear); + $param .= '&search_date_approve_endyear='.urlencode((string) ($search_date_approve_endyear)); } if ($search_ref) { $param .= '&search_ref='.urlencode($search_ref); @@ -1121,7 +1121,7 @@ if ($resql) { $param .= '&search_company_alias='.urlencode($search_company_alias); } if ($search_user > 0) { - $param .= '&search_user='.urlencode($search_user); + $param .= '&search_user='.urlencode((string) ($search_user)); } if ($search_request_author) { $param .= '&search_request_author='.urlencode($search_request_author); @@ -1163,13 +1163,13 @@ if ($resql) { $param .= "&search_billed=".urlencode($search_billed); } if ($show_files) { - $param .= '&show_files='.urlencode($show_files); + $param .= '&show_files='.urlencode((string) ($show_files)); } if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); } if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) { - $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty); + $param .= '&search_type_thirdparty='.urlencode((string) ($search_type_thirdparty)); } // Add $param from extra fields From 24b0a17c30ffc528fe90fc0c5ee72c530cd189dc Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:51:23 +0100 Subject: [PATCH 104/709] Fix: Ensure string type for urlencode() --- htdocs/fourn/facture/list-rec.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/htdocs/fourn/facture/list-rec.php b/htdocs/fourn/facture/list-rec.php index 00e7c8c0a67..62531e8a569 100644 --- a/htdocs/fourn/facture/list-rec.php +++ b/htdocs/fourn/facture/list-rec.php @@ -432,43 +432,43 @@ if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.((int) $limit); } if ($socid > 0) { - $param .= '&socid='.urlencode($socid); + $param .= '&socid='.urlencode((string) ($socid)); } if ($search_date_startday) { - $param .= '&search_date_startday='.urlencode($search_date_startday); + $param .= '&search_date_startday='.urlencode((string) ($search_date_startday)); } if ($search_date_startmonth) { - $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); + $param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth)); } if ($search_date_startyear) { - $param .= '&search_date_startyear='.urlencode($search_date_startyear); + $param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear)); } if ($search_date_endday) { - $param .= '&search_date_endday='.urlencode($search_date_endday); + $param .= '&search_date_endday='.urlencode((string) ($search_date_endday)); } if ($search_date_endmonth) { - $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + $param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth)); } if ($search_date_endyear) { - $param .= '&search_date_endyear='.urlencode($search_date_endyear); + $param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear)); } if ($search_date_when_startday) { - $param .= '&search_date_when_startday='.urlencode($search_date_when_startday); + $param .= '&search_date_when_startday='.urlencode((string) ($search_date_when_startday)); } if ($search_date_when_startmonth) { - $param .= '&search_date_when_startmonth='.urlencode($search_date_when_startmonth); + $param .= '&search_date_when_startmonth='.urlencode((string) ($search_date_when_startmonth)); } if ($search_date_when_startyear) { - $param .= '&search_date_when_startyear='.urlencode($search_date_when_startyear); + $param .= '&search_date_when_startyear='.urlencode((string) ($search_date_when_startyear)); } if ($search_date_when_endday) { - $param .= '&search_date_when_endday='.urlencode($search_date_when_endday); + $param .= '&search_date_when_endday='.urlencode((string) ($search_date_when_endday)); } if ($search_date_when_endmonth) { - $param .= '&search_date_when_endmonth='.urlencode($search_date_when_endmonth); + $param .= '&search_date_when_endmonth='.urlencode((string) ($search_date_when_endmonth)); } if ($search_date_when_endyear) { - $param .= '&search_date_when_endyear='.urlencode($search_date_when_endyear); + $param .= '&search_date_when_endyear='.urlencode((string) ($search_date_when_endyear)); } if ($search_ref) { $param .= '&search_ref='.urlencode($search_ref); From beb0cfe5b429efa42d989b171f3292ee49a490ca Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:51:26 +0100 Subject: [PATCH 105/709] Fix: Ensure string type for urlencode() --- htdocs/fourn/facture/list.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 901419f4013..642b4612358 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -839,22 +839,22 @@ if ($search_date_end) { $param .= buildParamDate('search_date_end', null, '', 'tzserver'); } if ($search_datelimit_startday) { - $param .= '&search_datelimit_startday='.urlencode($search_datelimit_startday); + $param .= '&search_datelimit_startday='.urlencode((string) ($search_datelimit_startday)); } if ($search_datelimit_startmonth) { - $param .= '&search_datelimit_startmonth='.urlencode($search_datelimit_startmonth); + $param .= '&search_datelimit_startmonth='.urlencode((string) ($search_datelimit_startmonth)); } if ($search_datelimit_startyear) { - $param .= '&search_datelimit_startyear='.urlencode($search_datelimit_startyear); + $param .= '&search_datelimit_startyear='.urlencode((string) ($search_datelimit_startyear)); } if ($search_datelimit_endday) { - $param .= '&search_datelimit_endday='.urlencode($search_datelimit_endday); + $param .= '&search_datelimit_endday='.urlencode((string) ($search_datelimit_endday)); } if ($search_datelimit_endmonth) { - $param .= '&search_datelimit_endmonth='.urlencode($search_datelimit_endmonth); + $param .= '&search_datelimit_endmonth='.urlencode((string) ($search_datelimit_endmonth)); } if ($search_datelimit_endyear) { - $param .= '&search_datelimit_endyear='.urlencode($search_datelimit_endyear); + $param .= '&search_datelimit_endyear='.urlencode((string) ($search_datelimit_endyear)); } if ($search_ref) { $param .= '&search_ref='.urlencode($search_ref); @@ -920,13 +920,13 @@ if ($search_status >= 0) { $param .= "&search_status=".urlencode($search_status); } if ($search_paymentmode) { - $param .= '&search_paymentmode='.urlencode($search_paymentmode); + $param .= '&search_paymentmode='.urlencode((string) ($search_paymentmode)); } if ($search_paymentcond) { - $param .= '&search_paymentcond='.urlencode($search_paymentcond); + $param .= '&search_paymentcond='.urlencode((string) ($search_paymentcond)); } if ($show_files) { - $param .= '&show_files='.urlencode($show_files); + $param .= '&show_files='.urlencode((string) ($show_files)); } if ($option) { $param .= "&search_option=".urlencode($option); @@ -935,7 +935,7 @@ if ($search_categ_sup > 0) { $param .= '&search_categ_sup='.urlencode($search_categ_sup); } if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) { - $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty); + $param .= '&search_type_thirdparty='.urlencode((string) ($search_type_thirdparty)); } // Add $param from extra fields @@ -967,7 +967,7 @@ $massactionbutton = $form->selectMassAction('', $arrayofmassactions); $url = DOL_URL_ROOT.'/fourn/facture/card.php?action=create'; if (!empty($socid)) { - $url .= '&socid='.urlencode($socid); + $url .= '&socid='.urlencode((string) ($socid)); } $i = 0; From 81e8da34efe2409167b2af22b102bcf62cbc6d10 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:51:29 +0100 Subject: [PATCH 106/709] Fix: Ensure string type for urlencode() --- htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php b/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php index f1bccfcad6d..6ebb4f03f4f 100644 --- a/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php @@ -36,7 +36,8 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock']; $langs->load("bills"); -$total = 0; $ilink = 0; +$total = 0; +$ilink = 0; foreach ($linkedObjectBlock as $key => $objectlink) { $ilink++; @@ -69,7 +70,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { } else { echo $objectlink->getLibStatut(3); } ?> -
+ Date: Fri, 8 Mar 2024 02:51:32 +0100 Subject: [PATCH 107/709] Fix: Ensure string type for urlencode() --- htdocs/fourn/paiement/list.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/fourn/paiement/list.php b/htdocs/fourn/paiement/list.php index 466f7beaedd..8445377e946 100644 --- a/htdocs/fourn/paiement/list.php +++ b/htdocs/fourn/paiement/list.php @@ -307,22 +307,22 @@ if ($search_ref) { $param .= '&search_ref='.urlencode($search_ref); } if ($search_date_startday) { - $param .= '&search_date_startday='.urlencode($search_date_startday); + $param .= '&search_date_startday='.urlencode((string) ($search_date_startday)); } if ($search_date_startmonth) { - $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); + $param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth)); } if ($search_date_startyear) { - $param .= '&search_date_startyear='.urlencode($search_date_startyear); + $param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear)); } if ($search_date_endday) { - $param .= '&search_date_endday='.urlencode($search_date_endday); + $param .= '&search_date_endday='.urlencode((string) ($search_date_endday)); } if ($search_date_endmonth) { - $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + $param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth)); } if ($search_date_endyear) { - $param .= '&search_date_endyear='.urlencode($search_date_endyear); + $param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear)); } if ($search_company) { $param .= '&search_company='.urlencode($search_company); From b18d226c28b53410cd02b12a50688cb4f329e458 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:51:34 +0100 Subject: [PATCH 108/709] Fix: Ensure string type for urlencode() --- htdocs/holiday/list.php | 58 ++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 58a073fcad3..42c2d0808f6 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -111,26 +111,26 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen // List of fields to search into when doing a "search in all" $fieldstosearchall = array( - 'cp.ref'=>'Ref', - 'cp.description'=>'Description', - 'uu.lastname'=>'EmployeeLastname', - 'uu.firstname'=>'EmployeeFirstname', - 'uu.login'=>'Login' + 'cp.ref' => 'Ref', + 'cp.description' => 'Description', + 'uu.lastname' => 'EmployeeLastname', + 'uu.firstname' => 'EmployeeFirstname', + 'uu.login' => 'Login' ); $arrayfields = array( - 'cp.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), - 'cp.fk_user'=>array('label'=>$langs->trans("Employee"), 'checked'=>1, 'position'=>20), - 'cp.fk_validator'=>array('label'=>$langs->trans("ValidatorCP"), 'checked'=>1, 'position'=>30), - 'cp.fk_type'=>array('label'=>$langs->trans("Type"), 'checked'=>1, 'position'=>35), - 'duration'=>array('label'=>$langs->trans("NbUseDaysCPShort"), 'checked'=>1, 'position'=>38), - 'cp.date_debut'=>array('label'=>$langs->trans("DateStart"), 'checked'=>1, 'position'=>40), - 'cp.date_fin'=>array('label'=>$langs->trans("DateEnd"), 'checked'=>1, 'position'=>42), - 'cp.date_valid'=>array('label'=>$langs->trans("DateValidation"), 'checked'=>1, 'position'=>60), - 'cp.date_approval'=>array('label'=>$langs->trans("DateApprove"), 'checked'=>1, 'position'=>70), - 'cp.date_create'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), - 'cp.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>501), - 'cp.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), + 'cp.ref' => array('label' => $langs->trans("Ref"), 'checked' => 1), + 'cp.fk_user' => array('label' => $langs->trans("Employee"), 'checked' => 1, 'position' => 20), + 'cp.fk_validator' => array('label' => $langs->trans("ValidatorCP"), 'checked' => 1, 'position' => 30), + 'cp.fk_type' => array('label' => $langs->trans("Type"), 'checked' => 1, 'position' => 35), + 'duration' => array('label' => $langs->trans("NbUseDaysCPShort"), 'checked' => 1, 'position' => 38), + 'cp.date_debut' => array('label' => $langs->trans("DateStart"), 'checked' => 1, 'position' => 40), + 'cp.date_fin' => array('label' => $langs->trans("DateEnd"), 'checked' => 1, 'position' => 42), + 'cp.date_valid' => array('label' => $langs->trans("DateValidation"), 'checked' => 1, 'position' => 60), + 'cp.date_approval' => array('label' => $langs->trans("DateApprove"), 'checked' => 1, 'position' => 70), + 'cp.date_create' => array('label' => $langs->trans("DateCreation"), 'checked' => 0, 'position' => 500), + 'cp.tms' => array('label' => $langs->trans("DateModificationShort"), 'checked' => 0, 'position' => 501), + 'cp.statut' => array('label' => $langs->trans("Status"), 'checked' => 1, 'position' => 1000), ); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; @@ -183,7 +183,7 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa $massaction = ''; } -$parameters = array('socid'=>$socid); +$parameters = array('socid' => $socid); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -451,10 +451,10 @@ if ($search_employee > 0) { $param .= '&search_employee='.urlencode($search_employee); } if ($search_valideur > 0) { - $param .= '&search_valideur='.urlencode($search_valideur); + $param .= '&search_valideur='.urlencode((string) ($search_valideur)); } if ($search_type > 0) { - $param .= '&search_type='.urlencode($search_type); + $param .= '&search_type='.urlencode((string) ($search_type)); } if ($search_status > 0) { $param .= '&search_status='.urlencode($search_status); @@ -538,8 +538,8 @@ if ($id > 0) { // For user tab $newcardbutton = ''; - $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); - $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss' => 'reposition')); + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss' => 'reposition')); $newcardbutton .= dolGetButtonTitleSeparator(); $newcardbutton .= dolGetButtonTitle($langs->trans('MenuAddCP'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/holiday/card.php?action=create', '', $user->hasRight('holiday', 'write')); @@ -575,7 +575,7 @@ if (empty($reshook)) { if (!empty($moreforfilter)) { print '
'; print $moreforfilter; - $parameters = array('type'=>$type); + $parameters = array('type' => $type); $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; print '
'; @@ -701,7 +701,7 @@ if (!empty($arrayfields['cp.date_approval']['checked'])) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook -$parameters = array('arrayfields'=>$arrayfields); +$parameters = array('arrayfields' => $arrayfields); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; @@ -787,7 +787,7 @@ if (!empty($arrayfields['cp.date_approval']['checked'])) { // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields -$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray); +$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (!empty($arrayfields['cp.date_create']['checked'])) { @@ -809,7 +809,7 @@ if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { } print ''."\n"; -$listhalfday = array('morning'=>$langs->trans("Morning"), "afternoon"=>$langs->trans("Afternoon")); +$listhalfday = array('morning' => $langs->trans("Morning"), "afternoon" => $langs->trans("Afternoon")); // Loop on record @@ -895,7 +895,7 @@ if ($id && !$user->hasRight('holiday', 'readall') && !in_array($id, $childids)) $labeltypeleavetoshow = ($langs->trans($typeleaves[$obj->fk_type]['code']) != $typeleaves[$obj->fk_type]['code'] ? $langs->trans($typeleaves[$obj->fk_type]['code']) : $typeleaves[$obj->fk_type]['label']); } - $arraydata = array('user'=>$userstatic, 'labeltype'=>$labeltypeleavetoshow, 'selected'=>$selected, 'nbopenedday'=>$nbopenedday); + $arraydata = array('user' => $userstatic, 'labeltype' => $labeltypeleavetoshow, 'selected' => $selected, 'nbopenedday' => $nbopenedday); } print $holidaystatic->getKanbanView('', $arraydata); if ($i == ($imaxinloop - 1)) { @@ -1004,7 +1004,7 @@ if ($id && !$user->hasRight('holiday', 'readall') && !in_array($id, $childids)) // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; @@ -1086,7 +1086,7 @@ if ($num == 0) { $db->free($resql); -$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); +$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql); $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; From a39cf7318665e5d9958bad19dfb298700ee17536 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:51:37 +0100 Subject: [PATCH 109/709] Fix: Ensure string type for urlencode() --- htdocs/holiday/month_report.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/holiday/month_report.php b/htdocs/holiday/month_report.php index f38ee1a7069..6f10f9c9ce9 100644 --- a/htdocs/holiday/month_report.php +++ b/htdocs/holiday/month_report.php @@ -119,16 +119,16 @@ if (empty($reshook)) { } $arrayfields = array( - 'cp.ref'=>array('label' => 'Ref', 'checked'=>1, 'position'=>5), - 'cp.fk_type'=>array('label' => 'Type', 'checked'=>1, 'position'=>10), - 'cp.fk_user'=>array('label' => 'Employee', 'checked'=>1, 'position'=>20), - 'cp.date_debut'=>array('label' => 'DateDebCP', 'checked'=>-1, 'position'=>30), - 'cp.date_fin'=>array('label' => 'DateFinCP', 'checked'=>-1, 'position'=>32), - 'used_days'=>array('label' => 'NbUseDaysCPShort', 'checked'=>-1, 'position'=>34), - 'date_start_month'=>array('label' => 'DateStartInMonth', 'checked'=>1, 'position'=>50), - 'date_end_month'=>array('label' => 'DateEndInMonth', 'checked'=>1, 'position'=>52), - 'used_days_month'=>array('label' => 'NbUseDaysCPShortInMonth', 'checked'=>1, 'position'=>54), - 'cp.description'=>array('label' => 'DescCP', 'checked'=>-1, 'position'=>800), + 'cp.ref' => array('label' => 'Ref', 'checked' => 1, 'position' => 5), + 'cp.fk_type' => array('label' => 'Type', 'checked' => 1, 'position' => 10), + 'cp.fk_user' => array('label' => 'Employee', 'checked' => 1, 'position' => 20), + 'cp.date_debut' => array('label' => 'DateDebCP', 'checked' => -1, 'position' => 30), + 'cp.date_fin' => array('label' => 'DateFinCP', 'checked' => -1, 'position' => 32), + 'used_days' => array('label' => 'NbUseDaysCPShort', 'checked' => -1, 'position' => 34), + 'date_start_month' => array('label' => 'DateStartInMonth', 'checked' => 1, 'position' => 50), + 'date_end_month' => array('label' => 'DateEndInMonth', 'checked' => 1, 'position' => 52), + 'used_days_month' => array('label' => 'NbUseDaysCPShortInMonth', 'checked' => 1, 'position' => 54), + 'cp.description' => array('label' => 'DescCP', 'checked' => -1, 'position' => 800), ); @@ -140,7 +140,7 @@ $form = new Form($db); $formother = new FormOther($db); $holidaystatic = new Holiday($db); -$listhalfday = array('morning'=>$langs->trans("Morning"), "afternoon"=>$langs->trans("Afternoon")); +$listhalfday = array('morning' => $langs->trans("Morning"), "afternoon" => $langs->trans("Afternoon")); $title = $langs->trans('CPTitreMenu'); @@ -194,7 +194,7 @@ if (!empty($search_ref)) { $param .= '&search_ref='.urlencode($search_ref); } if (!empty($search_employee)) { - $param .= '&search_employee='.urlencode($search_employee); + $param .= '&search_employee='.urlencode((string) ($search_employee)); } if (!empty($search_type)) { $param .= '&search_type='.urlencode($search_type); From 68661a67e22e4edcecbda6c0df7e8fa73984f82d Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:51:40 +0100 Subject: [PATCH 110/709] Fix: Ensure string type for urlencode() --- htdocs/holiday/view_log.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/holiday/view_log.php b/htdocs/holiday/view_log.php index 8aafba502ad..0820c283618 100644 --- a/htdocs/holiday/view_log.php +++ b/htdocs/holiday/view_log.php @@ -249,22 +249,22 @@ if (!empty($search_id)) { $param .= '&search_status='.urlencode($search_status); } if (!empty($search_month) && $search_month > 0) { - $param .= '&search_month='.urlencode($search_month); + $param .= '&search_month='.urlencode((string) ($search_month)); } if (!empty($search_year) && $search_year > 0) { - $param .= '&search_year='.urlencode($search_year); + $param .= '&search_year='.urlencode((string) ($search_year)); } if (!empty($search_validator) && $search_validator > 0) { - $param .= '&search_validator='.urlencode($search_validator); + $param .= '&search_validator='.urlencode((string) ($search_validator)); } if (!empty($search_employee) && $search_employee > 0) { - $param .= '&search_employee='.urlencode($search_employee); + $param .= '&search_employee='.urlencode((string) ($search_employee)); } if (!empty($search_description)) { $param .= '&search_description='.urlencode($search_description); } if (!empty($search_type) && $search_type > 0) { - $param .= '&search_type='.urlencode($search_type); + $param .= '&search_type='.urlencode((string) ($search_type)); } if (!empty($search_prev_solde)) { $param .= '&search_prev_solde='.urlencode($search_prev_solde); From 2d8649dfc35815bc2ebdcfd972c4490ea1b393f6 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:51:43 +0100 Subject: [PATCH 111/709] Fix: Ensure string type for urlencode() --- htdocs/hrm/evaluation_agenda.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/hrm/evaluation_agenda.php b/htdocs/hrm/evaluation_agenda.php index a65c659e867..4507ba5764f 100644 --- a/htdocs/hrm/evaluation_agenda.php +++ b/htdocs/hrm/evaluation_agenda.php @@ -110,7 +110,7 @@ if (!$permissiontoread) { * Actions */ -$parameters = array('id'=>$id); +$parameters = array('id' => $id); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -186,14 +186,14 @@ if ($object->id > 0) { $objthirdparty = $object; $objcon = new stdClass(); - $out = '&origin='.urlencode($object->element.'@'.$object->module).'&originid='.urlencode($object->id); + $out = '&origin='.urlencode((string) ($object->element.'@'.$object->module)).'&originid='.urlencode((string) ($object->id)); $urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id; $out .= '&backtopage='.urlencode($urlbacktopage); $permok = $user->hasRight('agenda', 'myactions', 'create'); if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) { //$out.=' Date: Fri, 8 Mar 2024 02:51:46 +0100 Subject: [PATCH 112/709] Fix: Ensure string type for urlencode() --- htdocs/hrm/job_agenda.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/hrm/job_agenda.php b/htdocs/hrm/job_agenda.php index 074f5e008f1..6fffa6934e4 100644 --- a/htdocs/hrm/job_agenda.php +++ b/htdocs/hrm/job_agenda.php @@ -108,7 +108,7 @@ if (!$permissiontoread) { * Actions */ -$parameters = array('id'=>$id); +$parameters = array('id' => $id); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -155,7 +155,7 @@ if ($object->id > 0) { $linkback = ''.$langs->trans("BackToList").''; $morehtmlref = '
'; - $morehtmlref.= $object->label; + $morehtmlref .= $object->label; $morehtmlref .= '
'; @@ -178,14 +178,14 @@ if ($object->id > 0) { $objthirdparty = $object; $objcon = new stdClass(); - $out = '&origin='.urlencode($object->element.'@'.$object->module).'&originid='.urlencode($object->id); + $out = '&origin='.urlencode((string) ($object->element.'@'.$object->module)).'&originid='.urlencode((string) ($object->id)); $urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id; $out .= '&backtopage='.urlencode($urlbacktopage); $permok = $user->hasRight('agenda', 'myactions', 'create'); if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) { //$out.=' Date: Fri, 8 Mar 2024 02:51:49 +0100 Subject: [PATCH 113/709] Fix: Ensure string type for urlencode() --- htdocs/hrm/position_agenda.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/hrm/position_agenda.php b/htdocs/hrm/position_agenda.php index ae37771e4c2..49f269d8efa 100644 --- a/htdocs/hrm/position_agenda.php +++ b/htdocs/hrm/position_agenda.php @@ -111,7 +111,7 @@ if (!$permissiontoread) { * Actions */ -$parameters = array('id'=>$id); +$parameters = array('id' => $id); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -186,14 +186,14 @@ if ($object->id > 0) { $objthirdparty = $object; $objcon = new stdClass(); - $out = '&origin='.urlencode($object->element.'@'.$object->module).'&originid='.urlencode($object->id); + $out = '&origin='.urlencode((string) ($object->element.'@'.$object->module)).'&originid='.urlencode((string) ($object->id)); $urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id; $out .= '&backtopage='.urlencode($urlbacktopage); $permok = $user->hasRight('agenda', 'myactions', 'create'); if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) { //$out.='id > 0) { $filters['search_agenda_label'] = $search_agenda_label; $filters['search_rowid'] = $search_rowid; - $object->fields['label']=array(); // Useful to get only agenda events linked to position (this object doesn't need label of ref field, but show_actions_done() needs it to work correctly) + $object->fields['label'] = array(); // Useful to get only agenda events linked to position (this object doesn't need label of ref field, but show_actions_done() needs it to work correctly) // TODO Replace this with same code than into list.php show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder, $object->module); From 1691c2eff4374e6c0d1da1cf38bd29db27793803 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:51:52 +0100 Subject: [PATCH 114/709] Fix: Ensure string type for urlencode() --- htdocs/hrm/skill_agenda.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/hrm/skill_agenda.php b/htdocs/hrm/skill_agenda.php index 92fa94e9c4d..a469ded4cf9 100644 --- a/htdocs/hrm/skill_agenda.php +++ b/htdocs/hrm/skill_agenda.php @@ -110,7 +110,7 @@ if (!$permissiontoread) { * Actions */ -$parameters = array('id'=>$id); +$parameters = array('id' => $id); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -157,7 +157,7 @@ if ($object->id > 0) { $linkback = ''.$langs->trans("BackToList").''; $morehtmlref = '
'; - $morehtmlref.= $object->label; + $morehtmlref .= $object->label; $morehtmlref .= '
'; @@ -180,14 +180,14 @@ if ($object->id > 0) { $objthirdparty = $object; $objcon = new stdClass(); - $out = '&origin='.urlencode($object->element.'@'.$object->module).'&originid='.urlencode($object->id); + $out = '&origin='.urlencode((string) ($object->element.'@'.$object->module)).'&originid='.urlencode((string) ($object->id)); $urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id; $out .= '&backtopage='.urlencode($urlbacktopage); $permok = $user->hasRight('agenda', 'myactions', 'create'); if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) { //$out.=' Date: Fri, 8 Mar 2024 02:51:55 +0100 Subject: [PATCH 115/709] Fix: Ensure string type for urlencode() --- htdocs/intracommreport/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/intracommreport/card.php b/htdocs/intracommreport/card.php index 4bfd8068589..7adc9ea0eb7 100644 --- a/htdocs/intracommreport/card.php +++ b/htdocs/intracommreport/card.php @@ -247,7 +247,7 @@ if ($id > 0 && $action != 'edit') { ); } print $form->formconfirm( - "card.php?rowid=".urlencode($id), + "card.php?rowid=".urlencode((string) ($id)), $langs->trans("DeleteReport"), $langs->trans("ConfirmDeleteReport"), "confirm_delete", From 0b0c858af7a03111c1f1b95a603e7079c78a32ef Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:51:58 +0100 Subject: [PATCH 116/709] Fix: Ensure string type for urlencode() --- htdocs/knowledgemanagement/knowledgerecord_agenda.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/knowledgemanagement/knowledgerecord_agenda.php b/htdocs/knowledgemanagement/knowledgerecord_agenda.php index 77c814d60c9..4ed3b95b63b 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_agenda.php +++ b/htdocs/knowledgemanagement/knowledgerecord_agenda.php @@ -98,7 +98,7 @@ $permissiontoadd = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'wr * Actions */ -$parameters = array('id'=>$id); +$parameters = array('id' => $id); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -203,14 +203,14 @@ if ($object->id > 0) { $objthirdparty = $object; $objcon = new stdClass(); - $out = '&origin='.urlencode($object->element.'@'.$object->module).'&originid='.urlencode($object->id); + $out = '&origin='.urlencode((string) ($object->element.'@'.$object->module)).'&originid='.urlencode((string) ($object->id)); $urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id; $out .= '&backtopage='.urlencode($urlbacktopage); $permok = $user->hasRight('agenda', 'myactions', 'create'); if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) { //$out.=' Date: Fri, 8 Mar 2024 02:52:01 +0100 Subject: [PATCH 117/709] Fix: Ensure string type for urlencode() --- htdocs/loan/payment/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/loan/payment/card.php b/htdocs/loan/payment/card.php index ec20266337e..2afeb25b322 100644 --- a/htdocs/loan/payment/card.php +++ b/htdocs/loan/payment/card.php @@ -67,7 +67,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->hasRight('loan', $result = $payment->delete($user); if ($result > 0) { $db->commit(); - header("Location: ".DOL_URL_ROOT."/loan/card.php?id=".urlencode($fk_loan)); + header("Location: ".DOL_URL_ROOT."/loan/card.php?id=".urlencode((string) ($fk_loan))); exit; } else { setEventMessages($payment->error, $payment->errors, 'errors'); From 364fcd313be46de1d6fd3dac9ceee9482e7a46e6 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:52:03 +0100 Subject: [PATCH 118/709] Fix: Ensure string type for urlencode() --- htdocs/margin/agentMargins.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php index 3c2fa4bca90..bd47dd65d95 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -208,22 +208,22 @@ if (!empty($agentid)) { $param .= "&agentid=".urlencode($agentid); } if (!empty($startdateday)) { - $param .= "&startdateday=".urlencode($startdateday); + $param .= "&startdateday=".urlencode((string) ($startdateday)); } if (!empty($startdatemonth)) { - $param .= "&startdatemonth=".urlencode($startdatemonth); + $param .= "&startdatemonth=".urlencode((string) ($startdatemonth)); } if (!empty($startdateyear)) { - $param .= "&startdateyear=".urlencode($startdateyear); + $param .= "&startdateyear=".urlencode((string) ($startdateyear)); } if (!empty($enddateday)) { - $param .= "&enddateday=".urlencode($enddateday); + $param .= "&enddateday=".urlencode((string) ($enddateday)); } if (!empty($enddatemonth)) { - $param .= "&enddatemonth=".urlencode($enddatemonth); + $param .= "&enddatemonth=".urlencode((string) ($enddatemonth)); } if (!empty($enddateyear)) { - $param .= "&enddateyear=".urlencode($enddateyear); + $param .= "&enddateyear=".urlencode((string) ($enddateyear)); } From 1066ee61ca6bbe8ec8a5a78a07f3fd086c9ba234 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:52:06 +0100 Subject: [PATCH 119/709] Fix: Ensure string type for urlencode() --- htdocs/modulebuilder/index.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 197f1b5e5dc..6d1a5a85d06 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -2918,7 +2918,7 @@ if ($dirins && $action == "update_menu" && GETPOSTINT('menukey') && GETPOST('tab if ($result < 0) { setEventMessages($langs->trans('ErrorMenuExistValue'), null, 'errors'); //var_dump($_SESSION);exit; - header("Location: ".$_SERVER["PHP_SELF"].'?action=editmenu&token='.newToken().'&menukey='.urlencode($key + 1).'&tab='.urlencode($tab).'&module='.urlencode($module).'&tabobj='.($key + 1)); + header("Location: ".$_SERVER["PHP_SELF"].'?action=editmenu&token='.newToken().'&menukey='.urlencode((string) ($key + 1)).'&tab='.urlencode((string) ($tab)).'&module='.urlencode((string) ($module)).'&tabobj='.($key + 1)); exit; } @@ -4703,7 +4703,7 @@ if ($module == 'initmodule') { if ($action == 'deletedict') { $formconfirm = $form->formconfirm( - $_SERVER["PHP_SELF"].'?dictionnarykey='.urlencode(GETPOSTINT('dictionnarykey')).'&tab='.urlencode($tab).'&module='.urlencode($module), + $_SERVER["PHP_SELF"].'?dictionnarykey='.urlencode((string) (GETPOSTINT('dictionnarykey'))).'&tab='.urlencode((string) ($tab)).'&module='.urlencode((string) ($module)), $langs->trans('Delete'), $langs->trans('Confirm Delete Dictionnary', GETPOST('dictionnarykey', 'alpha')), 'confirm_deletedictionary', @@ -4915,8 +4915,8 @@ if ($module == 'initmodule') { print ''; print '
'; print ''; @@ -5071,7 +5071,7 @@ if ($module == 'initmodule') { if ($action == 'deletemenu') { $formconfirms = $form->formconfirm( - $_SERVER["PHP_SELF"].'?menukey='.urlencode(GETPOSTINT('menukey')).'&tab='.urlencode($tab).'&module='.urlencode($module), + $_SERVER["PHP_SELF"].'?menukey='.urlencode((string) (GETPOSTINT('menukey'))).'&tab='.urlencode((string) ($tab)).'&module='.urlencode((string) ($module)), $langs->trans('Delete'), ($menus[GETPOST('menukey')]['fk_menu'] === 'fk_mainmenu='.strtolower($module) ? $langs->trans('Warning: you will delete all menus linked to this one.', GETPOSTINT('menukey')) : $langs->trans('Confirm Delete Menu', GETPOSTINT('menukey'))), 'confirm_deletemenu', @@ -5387,8 +5387,8 @@ if ($module == 'initmodule') { print ''; print ''; } @@ -5503,7 +5503,7 @@ if ($module == 'initmodule') { if ($action == 'deleteright') { $formconfirm = $form->formconfirm( - $_SERVER["PHP_SELF"].'?permskey='.urlencode(GETPOSTINT('permskey')).'&tab='.urlencode($tab).'&module='.urlencode($module).'&tabobj='.urlencode($tabobj), + $_SERVER["PHP_SELF"].'?permskey='.urlencode((string) (GETPOSTINT('permskey'))).'&tab='.urlencode((string) ($tab)).'&module='.urlencode((string) ($module)).'&tabobj='.urlencode((string) ($tabobj)), $langs->trans('Delete'), $langs->trans('Confirm Delete Right', GETPOST('permskey', 'alpha')), 'confirm_deleteright', @@ -5657,7 +5657,7 @@ if ($module == 'initmodule') { print ''; From 35d087c0a179d1cc2219c23617c02b8033ce2668 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:52:09 +0100 Subject: [PATCH 120/709] Fix: Ensure string type for urlencode() --- htdocs/mrp/mo_movements.php | 38 ++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/htdocs/mrp/mo_movements.php b/htdocs/mrp/mo_movements.php index b5395b9b04b..bab5f6aa68f 100644 --- a/htdocs/mrp/mo_movements.php +++ b/htdocs/mrp/mo_movements.php @@ -119,22 +119,22 @@ $objectlist = new MouvementStock($db); // Definition of fields for list $arrayfields = array( - 'm.rowid'=>array('label'=>"Ref", 'checked'=>1, 'position'=>1), - 'm.datem'=>array('label'=>"Date", 'checked'=>1, 'position'=>2), - 'p.ref'=>array('label'=>"ProductRef", 'checked'=>1, 'css'=>'maxwidth100', 'position'=>3), - 'p.label'=>array('label'=>"ProductLabel", 'checked'=>0, 'position'=>5), - 'm.batch'=>array('label'=>"BatchNumberShort", 'checked'=>1, 'position'=>8, 'enabled'=>(isModEnabled('productbatch'))), - 'pl.eatby'=>array('label'=>"EatByDate", 'checked'=>0, 'position'=>9, 'enabled'=>(isModEnabled('productbatch'))), - 'pl.sellby'=>array('label'=>"SellByDate", 'checked'=>0, 'position'=>10, 'enabled'=>(isModEnabled('productbatch'))), - 'e.ref'=>array('label'=>"Warehouse", 'checked'=>1, 'position'=>100, 'enabled'=>(!($id > 0))), // If we are on specific warehouse, we hide it - 'm.fk_user_author'=>array('label'=>"Author", 'checked'=>0, 'position'=>120), - 'm.inventorycode'=>array('label'=>"InventoryCodeShort", 'checked'=>1, 'position'=>130), - 'm.label'=>array('label'=>"MovementLabel", 'checked'=>1, 'position'=>140), - 'm.type_mouvement'=>array('label'=>"TypeMovement", 'checked'=>0, 'position'=>150), - 'origin'=>array('label'=>"Origin", 'checked'=>1, 'position'=>155), - 'm.fk_projet'=>array('label'=>'Project', 'checked'=>0, 'position'=>180), - 'm.value'=>array('label'=>"Qty", 'checked'=>1, 'position'=>200), - 'm.price'=>array('label'=>"UnitPurchaseValue", 'checked'=>0, 'position'=>210) + 'm.rowid' => array('label' => "Ref", 'checked' => 1, 'position' => 1), + 'm.datem' => array('label' => "Date", 'checked' => 1, 'position' => 2), + 'p.ref' => array('label' => "ProductRef", 'checked' => 1, 'css' => 'maxwidth100', 'position' => 3), + 'p.label' => array('label' => "ProductLabel", 'checked' => 0, 'position' => 5), + 'm.batch' => array('label' => "BatchNumberShort", 'checked' => 1, 'position' => 8, 'enabled' => (isModEnabled('productbatch'))), + 'pl.eatby' => array('label' => "EatByDate", 'checked' => 0, 'position' => 9, 'enabled' => (isModEnabled('productbatch'))), + 'pl.sellby' => array('label' => "SellByDate", 'checked' => 0, 'position' => 10, 'enabled' => (isModEnabled('productbatch'))), + 'e.ref' => array('label' => "Warehouse", 'checked' => 1, 'position' => 100, 'enabled' => (!($id > 0))), // If we are on specific warehouse, we hide it + 'm.fk_user_author' => array('label' => "Author", 'checked' => 0, 'position' => 120), + 'm.inventorycode' => array('label' => "InventoryCodeShort", 'checked' => 1, 'position' => 130), + 'm.label' => array('label' => "MovementLabel", 'checked' => 1, 'position' => 140), + 'm.type_mouvement' => array('label' => "TypeMovement", 'checked' => 0, 'position' => 150), + 'origin' => array('label' => "Origin", 'checked' => 1, 'position' => 155), + 'm.fk_projet' => array('label' => 'Project', 'checked' => 0, 'position' => 180), + 'm.value' => array('label' => "Qty", 'checked' => 1, 'position' => 200), + 'm.price' => array('label' => "UnitPurchaseValue", 'checked' => 0, 'position' => 210) //'m.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500), //'m.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500) ); @@ -521,7 +521,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $param .= '&limit='.((int) $limit); } if ($id > 0) { - $param .= '&id='.urlencode($id); + $param .= '&id='.urlencode((string) ($id)); } if ($search_movement) { $param .= '&search_movement='.urlencode($search_movement); @@ -728,7 +728,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook - $parameters = array('arrayfields'=>$arrayfields); + $parameters = array('arrayfields' => $arrayfields); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation @@ -1010,7 +1010,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (!empty($arrayfields['m.value']['checked'])) { // Qty print ''; } @@ -785,7 +785,7 @@ if ($managedfor == 'member') { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook -$parameters = array('arrayfields'=>$arrayfields); +$parameters = array('arrayfields' => $arrayfields); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column @@ -833,7 +833,7 @@ if ($managedfor == 'member') { // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields -$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray); +$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column @@ -897,7 +897,7 @@ while ($i < $imaxinloop) { $selected = 1; } } - print $object->getKanbanView('', array('thirdparty'=>$object->thirdparty, 'selected' => $selected)); + print $object->getKanbanView('', array('thirdparty' => $object->thirdparty, 'selected' => $selected)); if ($i == ($imaxinloop - 1)) { print ''; print ''; @@ -999,7 +999,7 @@ while ($i < $imaxinloop) { // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column @@ -1047,7 +1047,7 @@ if ($num == 0) { $db->free($resql); -$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); +$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql); $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; From 4d83ffd7db59fd4aac88a44e547a0fb4eec50d51 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:52:18 +0100 Subject: [PATCH 123/709] Fix: Ensure string type for urlencode() --- htdocs/paypal/lib/paypal.lib.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/paypal/lib/paypal.lib.php b/htdocs/paypal/lib/paypal.lib.php index cd9bda1e9f3..41be7d6a956 100644 --- a/htdocs/paypal/lib/paypal.lib.php +++ b/htdocs/paypal/lib/paypal.lib.php @@ -233,16 +233,16 @@ function callSetExpressCheckout($paymentAmount, $currencyCodeType, $paymentType, $paymentType = 'Sale'; } - $nvpstr = $nvpstr."&AMT=".urlencode($paymentAmount); // Total for all elements + $nvpstr = $nvpstr."&AMT=".urlencode((string) ($paymentAmount)); // Total for all elements $nvpstr = $nvpstr."&".$paypalprefix."INVNUM=".urlencode($tag); - $nvpstr = $nvpstr."&".$paypalprefix."AMT=".urlencode($paymentAmount); // AMT deprecated by paypal -> PAYMENTREQUEST_n_AMT - $nvpstr = $nvpstr."&".$paypalprefix."ITEMAMT=".urlencode($paymentAmount); // AMT deprecated by paypal -> PAYMENTREQUEST_n_AMT + $nvpstr = $nvpstr."&".$paypalprefix."AMT=".urlencode((string) ($paymentAmount)); // AMT deprecated by paypal -> PAYMENTREQUEST_n_AMT + $nvpstr = $nvpstr."&".$paypalprefix."ITEMAMT=".urlencode((string) ($paymentAmount)); // AMT deprecated by paypal -> PAYMENTREQUEST_n_AMT $nvpstr = $nvpstr."&".$paypalprefix."PAYMENTACTION=".urlencode($paymentType); // PAYMENTACTION deprecated by paypal -> PAYMENTREQUEST_n_PAYMENTACTION $nvpstr = $nvpstr."&".$paypalprefix."CURRENCYCODE=".urlencode($currencyCodeType); // CURRENCYCODE deprecated by paypal -> PAYMENTREQUEST_n_CURRENCYCODE $nvpstr = $nvpstr."&".$paypalprefix."L_PAYMENTREQUEST_0_QTY0=1"; - $nvpstr = $nvpstr."&".$paypalprefix."L_PAYMENTREQUEST_0_AMT0=".urlencode($paymentAmount); + $nvpstr = $nvpstr."&".$paypalprefix."L_PAYMENTREQUEST_0_AMT0=".urlencode((string) ($paymentAmount)); $nvpstr = $nvpstr."&".$paypalprefix."L_PAYMENTREQUEST_0_NAME0=".urlencode($desc); $nvpstr = $nvpstr."&".$paypalprefix."L_PAYMENTREQUEST_0_NUMBER0=0"; From 2f4108e7384cb6787751d204acd785460cce6430 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:52:21 +0100 Subject: [PATCH 124/709] Fix: Ensure string type for urlencode() --- htdocs/product/card.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index d9a95678e81..b848078cc20 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -90,7 +90,9 @@ if (isModEnabled('productbatch')) { $langs->load("productbatch"); } -$mesg = ''; $error = 0; $errors = array(); +$mesg = ''; +$error = 0; +$errors = array(); $refalreadyexists = 0; @@ -216,7 +218,7 @@ if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !$user->hasRight('barcode', $createbarcode = 0; } -$parameters = array('id'=>$id, 'ref'=>$ref, 'objcanvas'=>$objcanvas); +$parameters = array('id' => $id, 'ref' => $ref, 'objcanvas' => $objcanvas); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -1182,7 +1184,7 @@ if (empty($reshook)) { ); if ($result > 0) { - header("Location: ".DOL_URL_ROOT."/commande/card.php?id=".urlencode($commande->id)); + header("Location: ".DOL_URL_ROOT."/commande/card.php?id=".urlencode((string) ($commande->id))); exit; } } elseif (GETPOST('factureid') > 0) { @@ -1480,7 +1482,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio if (empty($fk_barcode_type) && getDolGlobalString('PRODUIT_DEFAULT_BARCODE_TYPE')) { $fk_barcode_type = getDolGlobalInt("PRODUIT_DEFAULT_BARCODE_TYPE"); } else { - $fk_barcode_type=0; + $fk_barcode_type = 0; } } require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbarcode.class.php'; @@ -1666,7 +1668,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio } // Other attributes - $parameters = array('colspan' => ' colspan="2"', 'cols'=>2); + $parameters = array('colspan' => ' colspan="2"', 'cols' => 2); $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (empty($reshook)) { @@ -2695,9 +2697,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio print ''; print ''; // Fields from hook - $parameters = array('obj'=>$objp); + $parameters = array('obj' => $objp); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $product); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column From 318faa061b82829566f0ca19e409c9b7023d8a47 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:52:30 +0100 Subject: [PATCH 127/709] Fix: Ensure string type for urlencode() --- htdocs/product/reassortlot.php | 44 +++++++++++++++++----------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/htdocs/product/reassortlot.php b/htdocs/product/reassortlot.php index d78e47d5dfe..07873e790ad 100644 --- a/htdocs/product/reassortlot.php +++ b/htdocs/product/reassortlot.php @@ -139,15 +139,15 @@ $result = restrictedArea($user, 'produit|service', 0, 'product&product'); // Definition of array of fields for columns $arrayfields = array( - array('type'=>'varchar', 'label'=>'Ref', 'checked'=>1, 'enabled'=>1, 'position'=>1), - array('type'=>'varchar', 'label'=>'Label', 'checked'=>1, 'enabled'=>1, 'position'=>1), - array('type'=>'int', 'label'=>'Warehouse', 'checked'=>1, 'enabled'=>1, 'position'=>1), - array('type'=>'varchar', 'label'=>'Lot', 'checked'=>1, 'enabled'=>1, 'position'=>1), - array('type'=>'varchar', 'label'=>'DLC', 'checked'=>1, 'enabled'=>1, 'position'=>1), - array('type'=>'varchar', 'label'=>'DLUO', 'checked'=>1, 'enabled'=>1, 'position'=>1), - array('type'=>'int', 'label'=>'Stock', 'checked'=>1, 'enabled'=>1, 'position'=>1), - array('type'=>'int', 'label'=>'StatusSell', 'checked'=>1, 'enabled'=>1, 'position'=>1), - array('type'=>'int', 'label'=>'StatusBuy', 'checked'=>1, 'enabled'=>1, 'position'=>1), + array('type' => 'varchar', 'label' => 'Ref', 'checked' => 1, 'enabled' => 1, 'position' => 1), + array('type' => 'varchar', 'label' => 'Label', 'checked' => 1, 'enabled' => 1, 'position' => 1), + array('type' => 'int', 'label' => 'Warehouse', 'checked' => 1, 'enabled' => 1, 'position' => 1), + array('type' => 'varchar', 'label' => 'Lot', 'checked' => 1, 'enabled' => 1, 'position' => 1), + array('type' => 'varchar', 'label' => 'DLC', 'checked' => 1, 'enabled' => 1, 'position' => 1), + array('type' => 'varchar', 'label' => 'DLUO', 'checked' => 1, 'enabled' => 1, 'position' => 1), + array('type' => 'int', 'label' => 'Stock', 'checked' => 1, 'enabled' => 1, 'position' => 1), + array('type' => 'int', 'label' => 'StatusSell', 'checked' => 1, 'enabled' => 1, 'position' => 1), + array('type' => 'int', 'label' => 'StatusBuy', 'checked' => 1, 'enabled' => 1, 'position' => 1), ); //$arrayfields['anotherfield'] = array('type'=>'integer', 'label'=>'AnotherField', 'checked'=>1, 'enabled'=>1, 'position'=>90, 'csslist'=>'right'); @@ -214,11 +214,11 @@ if (empty($reshook)) { } // Mass actions - /*$objectclass = 'MyObject'; - $objectlabel = 'MyObject'; - $uploaddir = $conf->mymodule->dir_output; - include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; - */ + /*$objectclass = 'MyObject'; + $objectlabel = 'MyObject'; + $uploaddir = $conf->mymodule->dir_output; + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; + */ } @@ -489,10 +489,10 @@ if ($tobuy) { $param .= "&tobuy=".urlencode($tobuy); } if ($type != '') { - $param .= "&type=".urlencode($type); + $param .= "&type=".urlencode((string) ($type)); } if ($fourn_id) { - $param .= "&fourn_id=".urlencode($fourn_id); + $param .= "&fourn_id=".urlencode((string) ($fourn_id)); } if ($snom) { $param .= "&snom=".urlencode($snom); @@ -504,7 +504,7 @@ if ($search_batch) { $param .= "&search_batch=".urlencode($search_batch); } if ($sbarcode) { - $param .= "&sbarcode=".urlencode($sbarcode); + $param .= "&sbarcode=".urlencode((string) ($sbarcode)); } if ($search_warehouse) { $param .= "&search_warehouse=".urlencode($search_warehouse); @@ -519,10 +519,10 @@ if ($search_sale) { $param .= "&search_sale=".urlencode($search_sale); } if (!empty($search_categ) && $search_categ != '-1') { - $param .= "&search_categ=".urlencode($search_categ); + $param .= "&search_categ=".urlencode((string) ($search_categ)); } if (!empty($search_warehouse_categ) && $search_warehouse_categ != '-1') { - $param .= "&search_warehouse_categ=".urlencode($search_warehouse_categ); + $param .= "&search_warehouse_categ=".urlencode((string) ($search_warehouse_categ)); } if ($search_stock_physique) { $param .= '&search_stock_physique=' . urlencode($search_stock_physique); @@ -574,7 +574,7 @@ if (isModEnabled('category')) { $moreforfilter .= ''; } -$moreforfilter.=''; +$moreforfilter .= ''; if (!empty($moreforfilter)) { @@ -686,7 +686,7 @@ print_liste_field_titre(''); print_liste_field_titre("ProductStatusOnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre("ProductStatusOnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'right '); // Hook fields -$parameters = array('param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); +$parameters = array('param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { @@ -875,7 +875,7 @@ while ($i < $imaxinloop) { } // Fields values from hook - $parameters = array('obj'=>$objp); + $parameters = array('obj' => $objp); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $product); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; From 25b0da26e04d4579beaf2560378098132a08d6b3 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:52:33 +0100 Subject: [PATCH 128/709] Fix: Ensure string type for urlencode() --- htdocs/product/stats/bom.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/stats/bom.php b/htdocs/product/stats/bom.php index b0257248690..73714afa21c 100644 --- a/htdocs/product/stats/bom.php +++ b/htdocs/product/stats/bom.php @@ -82,7 +82,7 @@ if ($id > 0 || !empty($ref)) { $object = $product; - $parameters = array('id'=>$id); + $parameters = array('id' => $id); $reshook = $hookmanager->executeHooks('doActions', $parameters, $product, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -130,7 +130,7 @@ if ($id > 0 || !empty($ref)) { //Calcul total qty and amount for global if full scan list $total_qty_toconsume = 0; $total_qty_toproduce = 0; - $product_cache=array(); + $product_cache = array(); $bom_data_result = array(); //Qauntity to produce @@ -283,7 +283,7 @@ if ($id > 0 || !empty($ref)) { print_barre_liste($langs->trans("BOMs"), $page, $_SERVER["PHP_SELF"], $option, $sortfield, $sortorder, '', count($bom_data_result), count($bom_data_result), '', 0, '', '', $limit, 0, 0, 1); if (!empty($page)) { - $option .= '&page='.urlencode($page); + $option .= '&page='.urlencode((string) ($page)); } print '
'; From dbda44cf2088a5b8744940c64dc243ef33a4e430 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:52:35 +0100 Subject: [PATCH 129/709] Fix: Ensure string type for urlencode() --- htdocs/product/stats/commande.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/stats/commande.php b/htdocs/product/stats/commande.php index 315f39590d3..8c9dbd7830b 100644 --- a/htdocs/product/stats/commande.php +++ b/htdocs/product/stats/commande.php @@ -204,10 +204,10 @@ if ($id > 0 || !empty($ref)) { $option .= '&limit='.((int) $limit); } if (!empty($search_month)) { - $option .= '&search_month='.urlencode($search_month); + $option .= '&search_month='.urlencode((string) ($search_month)); } if (!empty($search_year)) { - $option .= '&search_year='.urlencode($search_year); + $option .= '&search_year='.urlencode((string) ($search_year)); } if ($search_status != '') { @@ -227,7 +227,7 @@ if ($id > 0 || !empty($ref)) { print_barre_liste($langs->trans("CustomersOrders"), $page, $_SERVER["PHP_SELF"], $option, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit, 0, 0, 1); if (!empty($page)) { - $option .= '&page='.urlencode($page); + $option .= '&page='.urlencode((string) ($page)); } print '
'; From d992b55cd6e21afb1373ce17e30b529549141537 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:52:38 +0100 Subject: [PATCH 130/709] Fix: Ensure string type for urlencode() --- htdocs/product/stats/commande_fournisseur.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/stats/commande_fournisseur.php b/htdocs/product/stats/commande_fournisseur.php index d377ae40e0a..e91555cea67 100644 --- a/htdocs/product/stats/commande_fournisseur.php +++ b/htdocs/product/stats/commande_fournisseur.php @@ -204,10 +204,10 @@ if ($id > 0 || !empty($ref)) { $option .= '&limit='.((int) $limit); } if (!empty($search_month)) { - $option .= '&search_month='.urlencode($search_month); + $option .= '&search_month='.urlencode((string) ($search_month)); } if (!empty($search_year)) { - $option .= '&search_year='.urlencode($search_year); + $option .= '&search_year='.urlencode((string) ($search_year)); } if ($search_status != '') { @@ -227,7 +227,7 @@ if ($id > 0 || !empty($ref)) { print_barre_liste($langs->trans("SuppliersOrders"), $page, $_SERVER["PHP_SELF"], $option, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit, 0, 0, 1); if (!empty($page)) { - $option .= '&page='.urlencode($page); + $option .= '&page='.urlencode((string) ($page)); } print '
'; From b5bebdf657e58c2ff0895a64a756f1fcc4d8fa38 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:52:40 +0100 Subject: [PATCH 131/709] Fix: Ensure string type for urlencode() --- htdocs/product/stats/contrat.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/stats/contrat.php b/htdocs/product/stats/contrat.php index 870e7f81fda..6712ac33185 100644 --- a/htdocs/product/stats/contrat.php +++ b/htdocs/product/stats/contrat.php @@ -179,7 +179,7 @@ if ($id > 0 || !empty($ref)) { $option .= '&search_month='.urlencode($search_month); } if (!empty($search_year)) { - $option .= '&search_year='.urlencode($search_year); + $option .= '&search_year='.urlencode((string) ($search_year)); } print ''."\n"; @@ -195,7 +195,7 @@ if ($id > 0 || !empty($ref)) { print_barre_liste($langs->trans("Contrats"), $page, $_SERVER["PHP_SELF"], $option, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit, 0, 0, 1); if (!empty($page)) { - $option .= '&page='.urlencode($page); + $option .= '&page='.urlencode((string) ($page)); } $i = 0; From 11b2de835243062e341f9a552f38864bfb534bac Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:52:42 +0100 Subject: [PATCH 132/709] Fix: Ensure string type for urlencode() --- htdocs/product/stats/facture.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php index ad3e190e851..c44e95eae64 100644 --- a/htdocs/product/stats/facture.php +++ b/htdocs/product/stats/facture.php @@ -278,7 +278,7 @@ if ($id > 0 || !empty($ref)) { $option .= '&search_month='.urlencode($search_month); } if (!empty($search_year)) { - $option .= '&search_year='.urlencode($search_year); + $option .= '&search_year='.urlencode((string) ($search_year)); } // Add $param from extra fields @@ -301,7 +301,7 @@ if ($id > 0 || !empty($ref)) { print_barre_liste($langs->trans("CustomersInvoices"), $page, $_SERVER["PHP_SELF"], $option, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit, 0, 0, 1); if (!empty($page)) { - $option .= '&page='.urlencode($page); + $option .= '&page='.urlencode((string) ($page)); } print '
'; From 965ec8f0769df58fcd18bd6ab755a9149e9ea7d9 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:52:44 +0100 Subject: [PATCH 133/709] Fix: Ensure string type for urlencode() --- htdocs/product/stats/facture_fournisseur.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/stats/facture_fournisseur.php b/htdocs/product/stats/facture_fournisseur.php index faf752b71e9..2ee2e18b793 100644 --- a/htdocs/product/stats/facture_fournisseur.php +++ b/htdocs/product/stats/facture_fournisseur.php @@ -190,10 +190,10 @@ if ($id > 0 || !empty($ref)) { $option .= '&limit='.((int) $limit); } if (!empty($search_month)) { - $option .= '&search_month='.urlencode($search_month); + $option .= '&search_month='.urlencode((string) ($search_month)); } if (!empty($search_year)) { - $option .= '&search_year='.urlencode($search_year); + $option .= '&search_year='.urlencode((string) ($search_year)); } print ''."\n"; @@ -209,7 +209,7 @@ if ($id > 0 || !empty($ref)) { print_barre_liste($langs->trans("SuppliersInvoices"), $page, $_SERVER["PHP_SELF"], $option, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit, 0, 0, 1); if (!empty($page)) { - $option .= '&page='.urlencode($page); + $option .= '&page='.urlencode((string) ($page)); } print '
'; From a86806298a4138d04237efd341d12f983fc0106c Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:52:46 +0100 Subject: [PATCH 134/709] Fix: Ensure string type for urlencode() --- htdocs/product/stats/facturerec.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/stats/facturerec.php b/htdocs/product/stats/facturerec.php index f25c3076b63..83d66963e51 100644 --- a/htdocs/product/stats/facturerec.php +++ b/htdocs/product/stats/facturerec.php @@ -208,10 +208,10 @@ if ($id > 0 || !empty($ref)) { $option .= '&limit='.((int) $limit); } if (!empty($search_month)) { - $option .= '&search_month='.urlencode($search_month); + $option .= '&search_month='.urlencode((string) ($search_month)); } if (!empty($search_year)) { - $option .= '&search_year='.urlencode($search_year); + $option .= '&search_year='.urlencode((string) ($search_year)); } print ''."\n"; @@ -227,7 +227,7 @@ if ($id > 0 || !empty($ref)) { print_barre_liste($langs->trans("CustomersInvoices"), $page, $_SERVER["PHP_SELF"], $option, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit, 0, 0, 1); if (!empty($page)) { - $option .= '&page='.urlencode($page); + $option .= '&page='.urlencode((string) ($page)); } print '
'; From 2d9a426c4244fb801f4117d24062a2eb5ef6197c Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:52:48 +0100 Subject: [PATCH 135/709] Fix: Ensure string type for urlencode() --- htdocs/product/stats/mo.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/stats/mo.php b/htdocs/product/stats/mo.php index d6727842ead..d98a73fbc79 100644 --- a/htdocs/product/stats/mo.php +++ b/htdocs/product/stats/mo.php @@ -186,10 +186,10 @@ if ($id > 0 || !empty($ref)) { $option .= '&limit='.((int) $limit); } if (!empty($search_month)) { - $option .= '&search_month='.urlencode($search_month); + $option .= '&search_month='.urlencode((string) ($search_month)); } if (!empty($search_year)) { - $option .= '&search_year='.urlencode($search_year); + $option .= '&search_year='.urlencode((string) ($search_year)); } print ''."\n"; @@ -205,7 +205,7 @@ if ($id > 0 || !empty($ref)) { print_barre_liste($langs->trans("MOs"), $page, $_SERVER["PHP_SELF"], $option, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit, 0, 0, 1); if (!empty($page)) { - $option .= '&page='.urlencode($page); + $option .= '&page='.urlencode((string) ($page)); } print '
'; From 6d728265ffb69b6e2ccb6fe504c859961adf60c0 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:52:50 +0100 Subject: [PATCH 136/709] Fix: Ensure string type for urlencode() --- htdocs/product/stats/propal.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/stats/propal.php b/htdocs/product/stats/propal.php index 7ac396da333..9e6084f78c5 100644 --- a/htdocs/product/stats/propal.php +++ b/htdocs/product/stats/propal.php @@ -192,10 +192,10 @@ if ($id > 0 || !empty($ref)) { $option .= '&limit='.((int) $limit); } if (!empty($search_month)) { - $option .= '&search_month='.urlencode($search_month); + $option .= '&search_month='.urlencode((string) ($search_month)); } if (!empty($search_year)) { - $option .= '&search_year='.urlencode($search_year); + $option .= '&search_year='.urlencode((string) ($search_year)); } print ''."\n"; @@ -211,7 +211,7 @@ if ($id > 0 || !empty($ref)) { print_barre_liste($langs->trans("Proposals"), $page, $_SERVER["PHP_SELF"], $option, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit, 0, 0, 1); if (!empty($page)) { - $option .= '&page='.urlencode($page); + $option .= '&page='.urlencode((string) ($page)); } print '
'; From 31391e950abad0063707c4f63b9f53cab035340d Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:52:52 +0100 Subject: [PATCH 137/709] Fix: Ensure string type for urlencode() --- htdocs/product/stats/supplier_proposal.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/stats/supplier_proposal.php b/htdocs/product/stats/supplier_proposal.php index 5e162e08339..5c755024acd 100644 --- a/htdocs/product/stats/supplier_proposal.php +++ b/htdocs/product/stats/supplier_proposal.php @@ -191,10 +191,10 @@ if ($id > 0 || !empty($ref)) { $option .= '&limit='.((int) $limit); } if (!empty($search_month)) { - $option .= '&search_month='.urlencode($search_month); + $option .= '&search_month='.urlencode((string) ($search_month)); } if (!empty($search_year)) { - $option .= '&search_year='.urlencode($search_year); + $option .= '&search_year='.urlencode((string) ($search_year)); } print ''."\n"; @@ -210,7 +210,7 @@ if ($id > 0 || !empty($ref)) { print_barre_liste($langs->trans("Proposals"), $page, $_SERVER["PHP_SELF"], $option, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit, 0, 0, 1); if (!empty($page)) { - $option .= '&page='.urlencode($page); + $option .= '&page='.urlencode((string) ($page)); } print '
'; From 322f85ee64b96f990c4ef3febe6c35ff91c8d3a7 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:52:54 +0100 Subject: [PATCH 138/709] Fix: Ensure string type for urlencode() --- htdocs/product/stock/card.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 1a4aedaefa6..c812e507035 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -103,7 +103,7 @@ $usercandelete = (($user->hasRight('stock', 'supprimer'))); $error = 0; -$parameters = array('id'=>$id, 'ref'=>$ref); +$parameters = array('id' => $id, 'ref' => $ref); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -168,7 +168,7 @@ if (empty($reshook)) { header("Location: ".$backtopage); exit; } else { - header("Location: card.php?id=".urlencode($id)); + header("Location: card.php?id=".urlencode((string) ($id))); exit; } } else { @@ -417,7 +417,7 @@ if ($action == 'create') { // Confirm delete warehouse if ($action == 'delete') { $formquestion = array( - array('type' => 'other', 'name' => 'info', 'label' => img_warning('').$langs->trans("WarningThisWIllAlsoDeleteStock"), 'morecss'=>'warning') + array('type' => 'other', 'name' => 'info', 'label' => img_warning('').$langs->trans("WarningThisWIllAlsoDeleteStock"), 'morecss' => 'warning') ); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("DeleteAWarehouse"), $langs->trans("ConfirmDeleteWarehouse", $object->label), "confirm_delete", $formquestion, 0, 2); } @@ -659,7 +659,7 @@ if ($action == 'create') { $totalarray['nbfield']++; } // Hook fields - $parameters = array('sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray' => &$totalarray); + $parameters = array('sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; print "
\n"; @@ -744,7 +744,7 @@ if ($action == 'create') { //print ''; print ''; - $parameters = array('obj'=>$objp, 'totalarray' => &$totalarray); + $parameters = array('obj' => $objp, 'totalarray' => &$totalarray); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; From 2ceaaeb2e8ecf5c77e9253e6a6f129d9f902f654 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:52:57 +0100 Subject: [PATCH 139/709] Fix: Ensure string type for urlencode() --- htdocs/product/stock/movement_card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/stock/movement_card.php b/htdocs/product/stock/movement_card.php index 6c8671175ec..d1ae82983e4 100644 --- a/htdocs/product/stock/movement_card.php +++ b/htdocs/product/stock/movement_card.php @@ -689,7 +689,7 @@ if ($resql) { $param .= '&limit='.((int) $limit); } if ($id > 0) { - $param .= '&id='.urlencode($id); + $param .= '&id='.urlencode((string) ($id)); } if ($search_movement) { $param .= '&search_movement='.urlencode($search_movement); @@ -716,7 +716,7 @@ if ($resql) { $param .= '&search_user='.urlencode($search_user); } if ($idproduct > 0) { - $param .= '&idproduct='.urlencode($idproduct); + $param .= '&idproduct='.urlencode((string) ($idproduct)); } // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; From 7b74e52d3a7be2e50141799763856871c6591daa Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:53:00 +0100 Subject: [PATCH 140/709] Fix: Ensure string type for urlencode() --- htdocs/product/stock/movement_list.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index 95e7b87a203..fbc888a2793 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -1003,28 +1003,28 @@ if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.((int) $limit); } if ($id > 0) { - $param .= '&id='.urlencode($id); + $param .= '&id='.urlencode((string) ($id)); } if ($show_files) { - $param .= '&show_files='.urlencode($show_files); + $param .= '&show_files='.urlencode((string) ($show_files)); } if ($search_date_startday) { - $param .= '&search_date_startday='.urlencode($search_date_startday); + $param .= '&search_date_startday='.urlencode((string) ($search_date_startday)); } if ($search_date_startmonth) { - $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); + $param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth)); } if ($search_date_startyear) { - $param .= '&search_date_startyear='.urlencode($search_date_startyear); + $param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear)); } if ($search_date_endday) { - $param .= '&search_date_endday='.urlencode($search_date_endday); + $param .= '&search_date_endday='.urlencode((string) ($search_date_endday)); } if ($search_date_endmonth) { - $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + $param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth)); } if ($search_date_endyear) { - $param .= '&search_date_endyear='.urlencode($search_date_endyear); + $param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear)); } if ($search_movement) { $param .= '&search_movement='.urlencode($search_movement); @@ -1051,10 +1051,10 @@ if ($search_user) { $param .= '&search_user='.urlencode($search_user); } if ($idproduct > 0) { - $param .= '&idproduct='.urlencode($idproduct); + $param .= '&idproduct='.urlencode((string) ($idproduct)); } if ($search_fk_project != '' && $search_fk_project != '-1') { - $param .= '&search_fk_project='.urlencode($search_fk_project); + $param .= '&search_fk_project='.urlencode((string) ($search_fk_project)); } // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; From 3749abb41977bb49029a5b5a8be3d89728811c90 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:53:03 +0100 Subject: [PATCH 141/709] Fix: Ensure string type for urlencode() --- htdocs/product/stock/replenish.php | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index ee51a45c4d5..febc2adf39e 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -650,23 +650,23 @@ if ($search_ref || $search_label || $sall || $salert || $draftorder || GETPOST(' $filters .= '&draftorder='.urlencode($draftorder); $filters .= '&mode='.urlencode($mode); if ($fk_supplier > 0) { - $filters .= '&fk_supplier='.urlencode($fk_supplier); + $filters .= '&fk_supplier='.urlencode((string) ($fk_supplier)); } if ($fk_entrepot > 0) { - $filters .= '&fk_entrepot='.urlencode($fk_entrepot); + $filters .= '&fk_entrepot='.urlencode((string) ($fk_entrepot)); } } else { $filters = '&search_ref='.urlencode($search_ref).'&search_label='.urlencode($search_label); - $filters .= '&fourn_id='.urlencode($fourn_id); - $filters .= (isset($type) ? '&type='.urlencode($type) : ''); + $filters .= '&fourn_id='.urlencode((string) ($fourn_id)); + $filters .= (isset($type) ? '&type='.urlencode((string) ($type)) : ''); $filters .= '&='.urlencode($salert); $filters .= '&draftorder='.urlencode($draftorder); $filters .= '&mode='.urlencode($mode); if ($fk_supplier > 0) { - $filters .= '&fk_supplier='.urlencode($fk_supplier); + $filters .= '&fk_supplier='.urlencode((string) ($fk_supplier)); } if ($fk_entrepot > 0) { - $filters .= '&fk_entrepot='.urlencode($fk_entrepot); + $filters .= '&fk_entrepot='.urlencode((string) ($fk_entrepot)); } } if ($limit > 0 && $limit != $conf->liste_limit) { @@ -679,12 +679,12 @@ if (!empty($salert)) { $filters .= '&salert='.urlencode($salert); } -$param = (isset($type) ? '&type='.urlencode($type) : ''); -$param .= '&fourn_id='.urlencode($fourn_id).'&search_label='.urlencode($search_label).'&includeproductswithoutdesiredqty='.urlencode($includeproductswithoutdesiredqty).'&salert='.urlencode($salert).'&draftorder='.urlencode($draftorder); +$param = (isset($type) ? '&type='.urlencode((string) ($type)) : ''); +$param .= '&fourn_id='.urlencode((string) ($fourn_id)).'&search_label='.urlencode((string) ($search_label)).'&includeproductswithoutdesiredqty='.urlencode((string) ($includeproductswithoutdesiredqty)).'&salert='.urlencode((string) ($salert)).'&draftorder='.urlencode((string) ($draftorder)); $param .= '&search_ref='.urlencode($search_ref); $param .= '&mode='.urlencode($mode); -$param .= '&fk_supplier='.urlencode($fk_supplier); -$param .= '&fk_entrepot='.urlencode($fk_entrepot); +$param .= '&fk_supplier='.urlencode((string) ($fk_supplier)); +$param .= '&fk_entrepot='.urlencode((string) ($fk_entrepot)); if (!empty($includeproductswithoutdesiredqty)) { $param .= '&includeproductswithoutdesiredqty='.urlencode($includeproductswithoutdesiredqty); } @@ -768,7 +768,7 @@ if (getDolGlobalString('STOCK_REPLENISH_ADD_CHECKBOX_INCLUDE_DRAFT_ORDER')) { print ''; print ''; // Fields from hook -$parameters = array('param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); +$parameters = array('param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; @@ -797,7 +797,7 @@ print_liste_field_titre('StockToBuy', $_SERVER["PHP_SELF"], '', $param, '', '', print_liste_field_titre('SupplierRef', $_SERVER["PHP_SELF"], '', $param, '', '', $sortfield, $sortorder, 'right '); // Hook fields -$parameters = array('param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); +$parameters = array('param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; @@ -959,7 +959,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { print ''; // Fields from hook - $parameters = array('objp'=>$objp, 'i'=>$i, 'tobuy'=>$tobuy); + $parameters = array('objp' => $objp, 'i' => $i, 'tobuy' => $tobuy); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; @@ -983,7 +983,7 @@ if ($num == 0) { print ''; } -$parameters = array('sql'=>$sql); +$parameters = array('sql' => $sql); $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; From 6a92582727e971c2ce8dd568e375e19d37b73ebb Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:53:06 +0100 Subject: [PATCH 142/709] Fix: Ensure string type for urlencode() --- htdocs/product/stock/replenishorders.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/stock/replenishorders.php b/htdocs/product/stock/replenishorders.php index 86573d63deb..724eeed763c 100644 --- a/htdocs/product/stock/replenishorders.php +++ b/htdocs/product/stock/replenishorders.php @@ -202,13 +202,13 @@ if ($resql) { $param .= '&search_ttc='.urlencode($sttc); } if ($search_dateyear) { - $param .= '&search_dateyear='.urlencode($search_dateyear); + $param .= '&search_dateyear='.urlencode((string) ($search_dateyear)); } if ($search_datemonth) { - $param .= '&search_datemonth='.urlencode($search_datemonth); + $param .= '&search_datemonth='.urlencode((string) ($search_datemonth)); } if ($search_dateday) { - $param .= '&search_dateday='.urlencode($search_dateday); + $param .= '&search_dateday='.urlencode((string) ($search_dateday)); } if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); From 564f91fc97f88518257ab4f7b9dff64f3fb2a97e Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:53:09 +0100 Subject: [PATCH 143/709] Fix: Ensure string type for urlencode() --- htdocs/product/stock/stats/commande_fournisseur.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/stock/stats/commande_fournisseur.php b/htdocs/product/stock/stats/commande_fournisseur.php index 174be7e4486..7f362de5f01 100644 --- a/htdocs/product/stock/stats/commande_fournisseur.php +++ b/htdocs/product/stock/stats/commande_fournisseur.php @@ -268,10 +268,10 @@ if ($id > 0 || !empty($ref)) { $option .= '&limit='.((int) $limit); } if (!empty($search_month)) { - $option .= '&search_month='.urlencode($search_month); + $option .= '&search_month='.urlencode((string) ($search_month)); } if (!empty($search_year)) { - $option .= '&search_year='.urlencode($search_year); + $option .= '&search_year='.urlencode((string) ($search_year)); } print ''."\n"; @@ -287,7 +287,7 @@ if ($id > 0 || !empty($ref)) { print_barre_liste($langs->trans("SuppliersOrders"), $page, $_SERVER["PHP_SELF"], $option, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit, 0, 0, 1); if (!empty($page)) { - $option .= '&page='.urlencode($page); + $option .= '&page='.urlencode((string) ($page)); } print '
'; From c971d6d02f5513be2d065d2ef2ccf151fc0d2b1b Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:53:11 +0100 Subject: [PATCH 144/709] Fix: Ensure string type for urlencode() --- htdocs/product/stock/stats/expedition.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/stock/stats/expedition.php b/htdocs/product/stock/stats/expedition.php index cc2a10c0592..b3c30f5ce68 100644 --- a/htdocs/product/stock/stats/expedition.php +++ b/htdocs/product/stock/stats/expedition.php @@ -267,10 +267,10 @@ if ($id > 0 || !empty($ref)) { $option .= '&limit='.((int) $limit); } if (!empty($search_month)) { - $option .= '&search_month='.urlencode($search_month); + $option .= '&search_month='.urlencode((string) ($search_month)); } if (!empty($search_year)) { - $option .= '&search_year='.urlencode($search_year); + $option .= '&search_year='.urlencode((string) ($search_year)); } print ''."\n"; @@ -286,7 +286,7 @@ if ($id > 0 || !empty($ref)) { print_barre_liste($langs->trans("Shipments"), $page, $_SERVER["PHP_SELF"], $option, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit, 0, 0, 1); if (!empty($page)) { - $option .= '&page='.urlencode($page); + $option .= '&page='.urlencode((string) ($page)); } print '
'; From b0480f82fb66a39ae029bb9f681ca165fa320d58 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:53:13 +0100 Subject: [PATCH 145/709] Fix: Ensure string type for urlencode() --- htdocs/product/stock/stats/mo.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/stock/stats/mo.php b/htdocs/product/stock/stats/mo.php index e48d44127c0..96699d17d92 100644 --- a/htdocs/product/stock/stats/mo.php +++ b/htdocs/product/stock/stats/mo.php @@ -209,10 +209,10 @@ if ($id > 0 || !empty($ref)) { $option .= '&limit='.((int) $limit); } if (!empty($search_month)) { - $option .= '&search_month='.urlencode($search_month); + $option .= '&search_month='.urlencode((string) ($search_month)); } if (!empty($search_year)) { - $option .= '&search_year='.urlencode($search_year); + $option .= '&search_year='.urlencode((string) ($search_year)); } print ''."\n"; @@ -228,7 +228,7 @@ if ($id > 0 || !empty($ref)) { print_barre_liste($langs->trans("MOs"), $page, $_SERVER["PHP_SELF"], $option, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit, 0, 0, 1); if (!empty($page)) { - $option .= '&page='.urlencode($page); + $option .= '&page='.urlencode((string) ($page)); } print '
'; From 6cb026ef8ca71ef7dbbc441a0ac5a0cea488a562 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:53:15 +0100 Subject: [PATCH 146/709] Fix: Ensure string type for urlencode() --- htdocs/product/stock/stats/reception.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/stock/stats/reception.php b/htdocs/product/stock/stats/reception.php index 08839af5749..ced528e301d 100644 --- a/htdocs/product/stock/stats/reception.php +++ b/htdocs/product/stock/stats/reception.php @@ -266,10 +266,10 @@ if ($id > 0 || !empty($ref)) { $option .= '&limit='.((int) $limit); } if (!empty($search_month)) { - $option .= '&search_month='.urlencode($search_month); + $option .= '&search_month='.urlencode((string) ($search_month)); } if (!empty($search_year)) { - $option .= '&search_year='.urlencode($search_year); + $option .= '&search_year='.urlencode((string) ($search_year)); } print ''."\n"; @@ -285,7 +285,7 @@ if ($id > 0 || !empty($ref)) { print_barre_liste($langs->trans("Receptions"), $page, $_SERVER["PHP_SELF"], $option, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit, 0, 0, 1); if (!empty($page)) { - $option .= '&page='.urlencode($page); + $option .= '&page='.urlencode((string) ($page)); } print '
'; From f1faf390f5466b7499c1645ebed0bc51b9e6a8ca Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:53:17 +0100 Subject: [PATCH 147/709] Fix: Ensure string type for urlencode() --- htdocs/projet/activity/permonth.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/activity/permonth.php b/htdocs/projet/activity/permonth.php index 7e1e2d82ccf..82f46fa4b4a 100644 --- a/htdocs/projet/activity/permonth.php +++ b/htdocs/projet/activity/permonth.php @@ -326,9 +326,9 @@ if ($action == 'addtime' && $user->hasRight('projet', 'lire') && GETPOST('formfi $param = ''; $param .= ($mode ? '&mode='.urlencode($mode) : ''); - $param .= ($projectid ? 'id='.urlencode($projectid) : ''); + $param .= ($projectid ? 'id='.urlencode((string) ($projectid)) : ''); $param .= ($search_usertoprocessid ? '&search_usertoprocessid='.urlencode($search_usertoprocessid) : ''); - $param .= ($day ? '&day='.urlencode($day) : '').($month ? '&month='.urlencode($month) : '').($year ? '&year='.urlencode($year) : ''); + $param .= ($day ? '&day='.urlencode((string) ($day)) : '').($month ? '&month='.urlencode((string) ($month)) : '').($year ? '&year='.urlencode((string) ($year)) : ''); $param .= ($search_project_ref ? '&search_project_ref='.urlencode($search_project_ref) : ''); $param .= ($search_usertoprocessid > 0 ? '&search_usertoprocessid='.urlencode($search_usertoprocessid) : ''); $param .= ($search_thirdparty ? '&search_thirdparty='.urlencode($search_thirdparty) : ''); From ebebb70720415acb59247816adabb8c34bceedde Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:53:20 +0100 Subject: [PATCH 148/709] Fix: Ensure string type for urlencode() --- htdocs/projet/activity/perweek.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index 97d38e4eb96..b1776078f36 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -330,9 +330,9 @@ if ($action == 'addtime' && $user->hasRight('projet', 'lire') && GETPOST('formfi $param = ''; $param .= ($mode ? '&mode='.urlencode($mode) : ''); - $param .= ($projectid ? 'id='.urlencode($projectid) : ''); + $param .= ($projectid ? 'id='.urlencode((string) ($projectid)) : ''); $param .= ($search_usertoprocessid ? '&search_usertoprocessid='.urlencode($search_usertoprocessid) : ''); - $param .= ($day ? '&day='.urlencode($day) : '').($month ? '&month='.urlencode($month) : '').($year ? '&year='.urlencode($year) : ''); + $param .= ($day ? '&day='.urlencode((string) ($day)) : '').($month ? '&month='.urlencode((string) ($month)) : '').($year ? '&year='.urlencode((string) ($year)) : ''); $param .= ($search_project_ref ? '&search_project_ref='.urlencode($search_project_ref) : ''); $param .= ($search_usertoprocessid > 0 ? '&search_usertoprocessid='.urlencode($search_usertoprocessid) : ''); $param .= ($search_thirdparty ? '&search_thirdparty='.urlencode($search_thirdparty) : ''); From dfd47dfe2c9899c0ed24e2001dbd11cae154e4d6 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:53:22 +0100 Subject: [PATCH 149/709] Fix: Ensure string type for urlencode() --- htdocs/projet/list.php | 66 +++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 4477b2ad218..4e0f40d0127 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -809,121 +809,121 @@ if ($search_all != '') { $param .= '&search_all='.urlencode($search_all); } if ($search_sday) { - $param .= '&search_sday='.urlencode($search_sday); + $param .= '&search_sday='.urlencode((string) ($search_sday)); } if ($search_smonth) { - $param .= '&search_smonth='.urlencode($search_smonth); + $param .= '&search_smonth='.urlencode((string) ($search_smonth)); } if ($search_syear) { - $param .= '&search_syear='.urlencode($search_syear); + $param .= '&search_syear='.urlencode((string) ($search_syear)); } if ($search_eday) { - $param .= '&search_eday='.urlencode($search_eday); + $param .= '&search_eday='.urlencode((string) ($search_eday)); } if ($search_emonth) { - $param .= '&search_emonth='.urlencode($search_emonth); + $param .= '&search_emonth='.urlencode((string) ($search_emonth)); } if ($search_eyear) { - $param .= '&search_eyear='.urlencode($search_eyear); + $param .= '&search_eyear='.urlencode((string) ($search_eyear)); } if ($search_date_start_startmonth) { - $param .= '&search_date_start_startmonth='.urlencode($search_date_start_startmonth); + $param .= '&search_date_start_startmonth='.urlencode((string) ($search_date_start_startmonth)); } if ($search_date_start_startyear) { - $param .= '&search_date_start_startyear='.urlencode($search_date_start_startyear); + $param .= '&search_date_start_startyear='.urlencode((string) ($search_date_start_startyear)); } if ($search_date_start_startday) { - $param .= '&search_date_start_startday='.urlencode($search_date_start_startday); + $param .= '&search_date_start_startday='.urlencode((string) ($search_date_start_startday)); } if ($search_date_start_start) { $param .= '&search_date_start_start='.urlencode($search_date_start_start); } if ($search_date_start_endmonth) { - $param .= '&search_date_start_endmonth='.urlencode($search_date_start_endmonth); + $param .= '&search_date_start_endmonth='.urlencode((string) ($search_date_start_endmonth)); } if ($search_date_start_endyear) { - $param .= '&search_date_start_endyear='.urlencode($search_date_start_endyear); + $param .= '&search_date_start_endyear='.urlencode((string) ($search_date_start_endyear)); } if ($search_date_start_endday) { - $param .= '&search_date_start_endday='.urlencode($search_date_start_endday); + $param .= '&search_date_start_endday='.urlencode((string) ($search_date_start_endday)); } if ($search_date_start_end) { $param .= '&search_date_start_end='.urlencode($search_date_start_end); } if ($search_date_end_startmonth) { - $param .= '&search_date_end_startmonth='.urlencode($search_date_end_startmonth); + $param .= '&search_date_end_startmonth='.urlencode((string) ($search_date_end_startmonth)); } if ($search_date_end_startyear) { - $param .= '&search_date_end_startyear='.urlencode($search_date_end_startyear); + $param .= '&search_date_end_startyear='.urlencode((string) ($search_date_end_startyear)); } if ($search_date_end_startday) { - $param .= '&search_date_end_startday='.urlencode($search_date_end_startday); + $param .= '&search_date_end_startday='.urlencode((string) ($search_date_end_startday)); } if ($search_date_end_start) { $param .= '&search_date_end_start='.urlencode($search_date_end_start); } if ($search_date_end_endmonth) { - $param .= '&search_date_end_endmonth='.urlencode($search_date_end_endmonth); + $param .= '&search_date_end_endmonth='.urlencode((string) ($search_date_end_endmonth)); } if ($search_date_end_endyear) { - $param .= '&search_date_end_endyear='.urlencode($search_date_end_endyear); + $param .= '&search_date_end_endyear='.urlencode((string) ($search_date_end_endyear)); } if ($search_date_end_endday) { - $param .= '&search_date_end_endday='.urlencode($search_date_end_endday); + $param .= '&search_date_end_endday='.urlencode((string) ($search_date_end_endday)); } if ($search_date_end_end) { $param .= '&search_date_end_end=' . urlencode($search_date_end_end); } if ($search_date_creation_startmonth) { - $param .= '&search_date_creation_startmonth='.urlencode($search_date_creation_startmonth); + $param .= '&search_date_creation_startmonth='.urlencode((string) ($search_date_creation_startmonth)); } if ($search_date_creation_startyear) { - $param .= '&search_date_creation_startyear='.urlencode($search_date_creation_startyear); + $param .= '&search_date_creation_startyear='.urlencode((string) ($search_date_creation_startyear)); } if ($search_date_creation_startday) { - $param .= '&search_date_creation_startday='.urlencode($search_date_creation_startday); + $param .= '&search_date_creation_startday='.urlencode((string) ($search_date_creation_startday)); } if ($search_date_creation_start) { $param .= '&search_date_creation_start='.urlencode($search_date_creation_start); } if ($search_date_creation_endmonth) { - $param .= '&search_date_creation_endmonth='.urlencode($search_date_creation_endmonth); + $param .= '&search_date_creation_endmonth='.urlencode((string) ($search_date_creation_endmonth)); } if ($search_date_creation_endyear) { - $param .= '&search_date_creation_endyear='.urlencode($search_date_creation_endyear); + $param .= '&search_date_creation_endyear='.urlencode((string) ($search_date_creation_endyear)); } if ($search_date_creation_endday) { - $param .= '&search_date_creation_endday='.urlencode($search_date_creation_endday); + $param .= '&search_date_creation_endday='.urlencode((string) ($search_date_creation_endday)); } if ($search_date_creation_end) { $param .= '&search_date_creation_end='.urlencode($search_date_creation_end); } if ($search_date_modif_startmonth) { - $param .= '&search_date_modif_startmonth='.urlencode($search_date_modif_startmonth); + $param .= '&search_date_modif_startmonth='.urlencode((string) ($search_date_modif_startmonth)); } if ($search_date_modif_startyear) { - $param .= '&search_date_modif_startyear='.urlencode($search_date_modif_startyear); + $param .= '&search_date_modif_startyear='.urlencode((string) ($search_date_modif_startyear)); } if ($search_date_modif_startday) { - $param .= '&search_date_modif_startday='.urlencode($search_date_modif_startday); + $param .= '&search_date_modif_startday='.urlencode((string) ($search_date_modif_startday)); } if ($search_date_modif_start) { $param .= '&search_date_modif_start='.urlencode($search_date_modif_start); } if ($search_date_modif_endmonth) { - $param .= '&search_date_modif_endmonth='.urlencode($search_date_modif_endmonth); + $param .= '&search_date_modif_endmonth='.urlencode((string) ($search_date_modif_endmonth)); } if ($search_date_modif_endyear) { - $param .= '&search_date_modif_endyear='.urlencode($search_date_modif_endyear); + $param .= '&search_date_modif_endyear='.urlencode((string) ($search_date_modif_endyear)); } if ($search_date_modif_endday) { - $param .= '&search_date_modif_endday='.urlencode($search_date_modif_endday); + $param .= '&search_date_modif_endday='.urlencode((string) ($search_date_modif_endday)); } if ($search_date_modif_end) { $param .= '&search_date_modif_end=' . urlencode($search_date_modif_end); } if ($socid) { - $param .= '&socid='.urlencode($socid); + $param .= '&socid='.urlencode((string) ($socid)); } if (!empty($search_category_array)) { foreach ($search_category_array as $tmpval) { @@ -958,10 +958,10 @@ if ($search_project_user > 0) { $param .= '&search_project_user='.urlencode($search_project_user); } if ($search_project_contact > 0) { - $param .= '&search_project_contact='.urlencode($search_project_contact); + $param .= '&search_project_contact='.urlencode((string) ($search_project_contact)); } if ($search_sale > 0) { - $param .= '&search_sale='.urlencode($search_sale); + $param .= '&search_sale='.urlencode((string) ($search_sale)); } if ($search_opp_amount != '') { $param .= '&search_opp_amount='.urlencode($search_opp_amount); From a4c03e51789d9b9d7f089f9dcb35340b72bcec45 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:53:24 +0100 Subject: [PATCH 150/709] Fix: Ensure string type for urlencode() --- htdocs/projet/tasks.php | 70 ++++++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index c5b496273f9..23aac791656 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -36,9 +36,9 @@ if (isModEnabled('category')) { } // Load translation files required by the page -$langsLoad=array('projects', 'users', 'companies'); +$langsLoad = array('projects', 'users', 'companies'); if (isModEnabled('eventorganization')) { - $langsLoad[]='eventorganization'; + $langsLoad[] = 'eventorganization'; } $langs->loadLangs($langsLoad); @@ -152,22 +152,22 @@ $planned_workload = $planned_workloadhour * 3600 + $planned_workloadmin * 60; // Definition of fields for list $arrayfields = array( - 't.ref'=>array('label'=>"RefTask", 'checked'=>1, 'position'=>1), - 't.label'=>array('label'=>"LabelTask", 'checked'=>1, 'position'=>2), - 't.description'=>array('label'=>"Description", 'checked'=>0, 'position'=>3), - 't.dateo'=>array('label'=>"DateStart", 'checked'=>1, 'position'=>4), - 't.datee'=>array('label'=>"Deadline", 'checked'=>1, 'position'=>5), - 't.planned_workload'=>array('label'=>"PlannedWorkload", 'checked'=>1, 'position'=>6), - 't.duration_effective'=>array('label'=>"TimeSpent", 'checked'=>1, 'position'=>7), - 't.progress_calculated'=>array('label'=>"ProgressCalculated", 'checked'=>1, 'position'=>8), - 't.progress'=>array('label'=>"ProgressDeclared", 'checked'=>1, 'position'=>9), - 't.progress_summary'=>array('label'=>"TaskProgressSummary", 'checked'=>1, 'position'=>10), - 't.budget_amount'=>array('label'=>"Budget", 'checked'=>0, 'position'=>11), - 'c.assigned'=>array('label'=>"TaskRessourceLinks", 'checked'=>1, 'position'=>12), + 't.ref' => array('label' => "RefTask", 'checked' => 1, 'position' => 1), + 't.label' => array('label' => "LabelTask", 'checked' => 1, 'position' => 2), + 't.description' => array('label' => "Description", 'checked' => 0, 'position' => 3), + 't.dateo' => array('label' => "DateStart", 'checked' => 1, 'position' => 4), + 't.datee' => array('label' => "Deadline", 'checked' => 1, 'position' => 5), + 't.planned_workload' => array('label' => "PlannedWorkload", 'checked' => 1, 'position' => 6), + 't.duration_effective' => array('label' => "TimeSpent", 'checked' => 1, 'position' => 7), + 't.progress_calculated' => array('label' => "ProgressCalculated", 'checked' => 1, 'position' => 8), + 't.progress' => array('label' => "ProgressDeclared", 'checked' => 1, 'position' => 9), + 't.progress_summary' => array('label' => "TaskProgressSummary", 'checked' => 1, 'position' => 10), + 't.budget_amount' => array('label' => "Budget", 'checked' => 0, 'position' => 11), + 'c.assigned' => array('label' => "TaskRessourceLinks", 'checked' => 1, 'position' => 12), ); if ($object->usage_bill_time) { - $arrayfields['t.tobill'] = array('label'=>$langs->trans("TimeToBill"), 'checked'=>0, 'position'=>11); - $arrayfields['t.billed'] = array('label'=>$langs->trans("TimeBilled"), 'checked'=>0, 'position'=>12); + $arrayfields['t.tobill'] = array('label' => $langs->trans("TimeToBill"), 'checked' => 0, 'position' => 11); + $arrayfields['t.billed'] = array('label' => $langs->trans("TimeBilled"), 'checked' => 0, 'position' => 12); } // Extra fields @@ -192,7 +192,7 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa $massaction = ''; } -$parameters = array('id'=>$id); +$parameters = array('id' => $id); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -297,7 +297,7 @@ if (!empty($search_progresscalc)) { //natural_search('round(100 * $line->duration_effective / $line->planned_workload,2)', $filterprogresscalc, 1, 1).' {return 1;} else {return 0;}'; } if ($search_task_budget_amount) { - $morewherefilterarray[]= natural_search('t.budget_amount', $search_task_budget_amount, 1, 1); + $morewherefilterarray[] = natural_search('t.budget_amount', $search_task_budget_amount, 1, 1); } //var_dump($morewherefilterarray); @@ -449,7 +449,7 @@ if ($id > 0 || !empty($ref)) { $param .= '&contextpage='.urlencode($contextpage); } if ($search_user_id) { - $param .= '&search_user_id='.urlencode($search_user_id); + $param .= '&search_user_id='.urlencode((string) ($search_user_id)); } if ($search_taskref) { $param .= '&search_taskref='.urlencode($search_taskref); @@ -479,49 +479,49 @@ if ($id > 0 || !empty($ref)) { $param .= '&search_dtendyear='.urlencode($search_dtendyear); } if ($search_date_start_startmonth) { - $param .= '&search_date_start_startmonth='.urlencode($search_date_start_startmonth); + $param .= '&search_date_start_startmonth='.urlencode((string) ($search_date_start_startmonth)); } if ($search_date_start_startyear) { - $param .= '&search_date_start_startyear='.urlencode($search_date_start_startyear); + $param .= '&search_date_start_startyear='.urlencode((string) ($search_date_start_startyear)); } if ($search_date_start_startday) { - $param .= '&search_date_start_startday='.urlencode($search_date_start_startday); + $param .= '&search_date_start_startday='.urlencode((string) ($search_date_start_startday)); } if ($search_date_start_start) { $param .= '&search_date_start_start='.urlencode($search_date_start_start); } if ($search_date_start_endmonth) { - $param .= '&search_date_start_endmonth='.urlencode($search_date_start_endmonth); + $param .= '&search_date_start_endmonth='.urlencode((string) ($search_date_start_endmonth)); } if ($search_date_start_endyear) { - $param .= '&search_date_start_endyear='.urlencode($search_date_start_endyear); + $param .= '&search_date_start_endyear='.urlencode((string) ($search_date_start_endyear)); } if ($search_date_start_endday) { - $param .= '&search_date_start_endday='.urlencode($search_date_start_endday); + $param .= '&search_date_start_endday='.urlencode((string) ($search_date_start_endday)); } if ($search_date_start_end) { $param .= '&search_date_start_end='.urlencode($search_date_start_end); } if ($search_date_end_startmonth) { - $param .= '&search_date_end_startmonth='.urlencode($search_date_end_startmonth); + $param .= '&search_date_end_startmonth='.urlencode((string) ($search_date_end_startmonth)); } if ($search_date_end_startyear) { - $param .= '&search_date_end_startyear='.urlencode($search_date_end_startyear); + $param .= '&search_date_end_startyear='.urlencode((string) ($search_date_end_startyear)); } if ($search_date_end_startday) { - $param .= '&search_date_end_startday='.urlencode($search_date_end_startday); + $param .= '&search_date_end_startday='.urlencode((string) ($search_date_end_startday)); } if ($search_date_end_start) { $param .= '&search_date_end_start='.urlencode($search_date_end_start); } if ($search_date_end_endmonth) { - $param .= '&search_date_end_endmonth='.urlencode($search_date_end_endmonth); + $param .= '&search_date_end_endmonth='.urlencode((string) ($search_date_end_endmonth)); } if ($search_date_end_endyear) { - $param .= '&search_date_end_endyear='.urlencode($search_date_end_endyear); + $param .= '&search_date_end_endyear='.urlencode((string) ($search_date_end_endyear)); } if ($search_date_end_endday) { - $param .= '&search_date_end_endday='.urlencode($search_date_end_endday); + $param .= '&search_date_end_endday='.urlencode((string) ($search_date_end_endday)); } if ($search_date_end_end) { $param .= '&search_date_end_end=' . urlencode($search_date_end_end); @@ -875,8 +875,8 @@ if ($action == 'create' && $user->hasRight('projet', 'creer') && (empty($object- print ''; $title = $langs->trans("ListOfTasks"); - $linktotasks = dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/projet/tasks.php?id='.$object->id, '', 1, array('morecss'=>'reposition btnTitleSelected')); - $linktotasks .= dolGetButtonTitle($langs->trans('ViewGantt'), '', 'fa fa-stream imgforviewmode', DOL_URL_ROOT.'/projet/ganttview.php?id='.$object->id.'&withproject=1', '', 1, array('morecss'=>'reposition marginleftonly')); + $linktotasks = dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/projet/tasks.php?id='.$object->id, '', 1, array('morecss' => 'reposition btnTitleSelected')); + $linktotasks .= dolGetButtonTitle($langs->trans('ViewGantt'), '', 'fa fa-stream imgforviewmode', DOL_URL_ROOT.'/projet/ganttview.php?id='.$object->id.'&withproject=1', '', 1, array('morecss' => 'reposition marginleftonly')); //print_barre_liste($title, 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $linktotasks, $num, $totalnboflines, 'generic', 0, '', '', 0, 1); print load_fiche_titre($title, $linktotasks.'   '.$linktocreatetask, 'projecttask', '', '', '', $massactionbutton); @@ -918,7 +918,7 @@ if ($action == 'create' && $user->hasRight('projet', 'creer') && (empty($object- // Show the massaction checkboxes only when this page is not opend from the Extended POS if ($massactionbutton && $contextpage != 'poslist') { - $selectedfields.= $form->showCheckAddButtons('checkforselect', 1); + $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); } print '
'; @@ -1115,7 +1115,7 @@ if ($action == 'create' && $user->hasRight('projet', 'creer') && (empty($object- $disablesortlink = 1; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields - $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); + $parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; print '
'; From 6cfd5774657c62c13a34c44d0ab81a5cd0c18241 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:53:27 +0100 Subject: [PATCH 151/709] Fix: Ensure string type for urlencode() --- htdocs/projet/tasks/list.php | 88 ++++++++++++++++++------------------ 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 714371b8d44..a7a5c47d757 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -144,37 +144,37 @@ if (!$sortorder) { // List of fields to search into when doing a "search in all" $fieldstosearchall = array( - 't.ref'=>"Ref", - 't.label'=>"Label", - 't.description'=>"Description", - 't.note_public'=>"NotePublic", + 't.ref' => "Ref", + 't.label' => "Label", + 't.description' => "Description", + 't.note_public' => "NotePublic", ); if (empty($user->socid)) { $fieldstosearchall['t.note_private'] = "NotePrivate"; } $arrayfields = array( - 't.fk_task_parent'=>array('label'=>"RefTaskParent", 'checked'=>0, 'position'=>70), - 't.ref'=>array('label'=>"RefTask", 'checked'=>1, 'position'=>80), - 't.label'=>array('label'=>"LabelTask", 'checked'=>1, 'position'=>80), - 't.description'=>array('label'=>"Description", 'checked'=>0, 'position'=>80), - 't.dateo'=>array('label'=>"DateStart", 'checked'=>1, 'position'=>100), - 't.datee'=>array('label'=>"Deadline", 'checked'=>1, 'position'=>101), - 'p.ref'=>array('label'=>"ProjectRef", 'checked'=>1, 'position'=>151), - 'p.title'=>array('label'=>"ProjectLabel", 'checked'=>0, 'position'=>152), - 's.nom'=>array('label'=>"ThirdParty", 'checked'=>1, 'csslist'=>'tdoverflowmax125', 'position'=>200), - 's.name_alias'=>array('label'=>"AliasNameShort", 'checked'=>0, 'csslist'=>'tdoverflowmax125', 'position'=>201), - 'p.fk_statut'=>array('label'=>"ProjectStatus", 'checked'=>1, 'position'=>205), - 't.planned_workload'=>array('label'=>"PlannedWorkload", 'checked'=>1, 'position'=>302), - 't.duration_effective'=>array('label'=>"TimeSpent", 'checked'=>1, 'position'=>303), - 't.progress_calculated'=>array('label'=>"ProgressCalculated", 'checked'=>1, 'position'=>304), - 't.progress'=>array('label'=>"ProgressDeclared", 'checked'=>1, 'position'=>305), - 't.progress_summary'=>array('label'=>"TaskProgressSummary", 'checked'=>1, 'position'=>306), - 't.budget_amount'=>array('label'=>"Budget", 'checked'=>0, 'position'=>307), - 't.tobill'=>array('label'=>"TimeToBill", 'checked'=>0, 'position'=>310), - 't.billed'=>array('label'=>"TimeBilled", 'checked'=>0, 'position'=>311), - 't.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500), - 't.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>501), + 't.fk_task_parent' => array('label' => "RefTaskParent", 'checked' => 0, 'position' => 70), + 't.ref' => array('label' => "RefTask", 'checked' => 1, 'position' => 80), + 't.label' => array('label' => "LabelTask", 'checked' => 1, 'position' => 80), + 't.description' => array('label' => "Description", 'checked' => 0, 'position' => 80), + 't.dateo' => array('label' => "DateStart", 'checked' => 1, 'position' => 100), + 't.datee' => array('label' => "Deadline", 'checked' => 1, 'position' => 101), + 'p.ref' => array('label' => "ProjectRef", 'checked' => 1, 'position' => 151), + 'p.title' => array('label' => "ProjectLabel", 'checked' => 0, 'position' => 152), + 's.nom' => array('label' => "ThirdParty", 'checked' => 1, 'csslist' => 'tdoverflowmax125', 'position' => 200), + 's.name_alias' => array('label' => "AliasNameShort", 'checked' => 0, 'csslist' => 'tdoverflowmax125', 'position' => 201), + 'p.fk_statut' => array('label' => "ProjectStatus", 'checked' => 1, 'position' => 205), + 't.planned_workload' => array('label' => "PlannedWorkload", 'checked' => 1, 'position' => 302), + 't.duration_effective' => array('label' => "TimeSpent", 'checked' => 1, 'position' => 303), + 't.progress_calculated' => array('label' => "ProgressCalculated", 'checked' => 1, 'position' => 304), + 't.progress' => array('label' => "ProgressDeclared", 'checked' => 1, 'position' => 305), + 't.progress_summary' => array('label' => "TaskProgressSummary", 'checked' => 1, 'position' => 306), + 't.budget_amount' => array('label' => "Budget", 'checked' => 0, 'position' => 307), + 't.tobill' => array('label' => "TimeToBill", 'checked' => 0, 'position' => 310), + 't.billed' => array('label' => "TimeBilled", 'checked' => 0, 'position' => 311), + 't.datec' => array('label' => "DateCreation", 'checked' => 0, 'position' => 500), + 't.tms' => array('label' => "DateModificationShort", 'checked' => 0, 'position' => 501), //'t.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000), ); // Extra fields @@ -204,7 +204,7 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa $massaction = ''; } -$parameters = array('socid'=>$socid); +$parameters = array('socid' => $socid); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -611,40 +611,40 @@ if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.((int) $limit); } if ($search_date_startday) { - $param .= '&search_date_startday='.urlencode($search_date_startday); + $param .= '&search_date_startday='.urlencode((string) ($search_date_startday)); } if ($search_date_startmonth) { - $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); + $param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth)); } if ($search_date_startyear) { - $param .= '&search_date_startyear='.urlencode($search_date_startyear); + $param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear)); } if ($search_date_endday) { - $param .= '&search_date_endday='.urlencode($search_date_endday); + $param .= '&search_date_endday='.urlencode((string) ($search_date_endday)); } if ($search_date_endmonth) { - $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + $param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth)); } if ($search_date_endyear) { - $param .= '&search_date_endyear='.urlencode($search_date_endyear); + $param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear)); } if ($search_datelimit_startday) { - $param .= '&search_datelimit_startday='.urlencode($search_datelimit_startday); + $param .= '&search_datelimit_startday='.urlencode((string) ($search_datelimit_startday)); } if ($search_datelimit_startmonth) { - $param .= '&search_datelimit_startmonth='.urlencode($search_datelimit_startmonth); + $param .= '&search_datelimit_startmonth='.urlencode((string) ($search_datelimit_startmonth)); } if ($search_datelimit_startyear) { - $param .= '&search_datelimit_startyear='.urlencode($search_datelimit_startyear); + $param .= '&search_datelimit_startyear='.urlencode((string) ($search_datelimit_startyear)); } if ($search_datelimit_endday) { - $param .= '&search_datelimit_endday='.urlencode($search_datelimit_endday); + $param .= '&search_datelimit_endday='.urlencode((string) ($search_datelimit_endday)); } if ($search_datelimit_endmonth) { - $param .= '&search_datelimit_endmonth='.urlencode($search_datelimit_endmonth); + $param .= '&search_datelimit_endmonth='.urlencode((string) ($search_datelimit_endmonth)); } if ($search_datelimit_endyear) { - $param .= '&search_datelimit_endyear='.urlencode($search_datelimit_endyear); + $param .= '&search_datelimit_endyear='.urlencode((string) ($search_datelimit_endyear)); } if ($search_task_budget_amount) { $param .= '&search_task_budget_amount='.urlencode($search_task_budget_amount); @@ -689,7 +689,7 @@ if ((is_numeric($search_opp_status) && $search_opp_status >= 0) || in_array($sea $param .= '&search_opp_status='.urlencode($search_opp_status); } if ($search_project_user != '') { - $param .= '&search_project_user='.urlencode($search_project_user); + $param .= '&search_project_user='.urlencode((string) ($search_project_user)); } if ($search_task_user > 0) { $param .= '&search_task_user='.urlencode($search_task_user); @@ -741,8 +741,8 @@ print ''; $newcardbutton = ''; -$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); -$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss' => 'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss' => 'reposition')); $newcardbutton .= dolGetButtonTitleSeparator(); $newcardbutton .= dolGetButtonTitle($langs->trans('NewTask'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/tasks.php?action=create', '', $permissiontocreate); @@ -960,7 +960,7 @@ if (!empty($arrayfields['t.billed']['checked'])) { // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook -$parameters = array('arrayfields'=>$arrayfields); +$parameters = array('arrayfields' => $arrayfields); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (!empty($arrayfields['t.datec']['checked'])) { @@ -1521,7 +1521,7 @@ while ($i < $imaxinloop) { // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation @@ -1622,7 +1622,7 @@ if (isset($totalarray['totaldurationeffectivefield']) || isset($totalarray['tota $db->free($resql); -$parameters = array('arrayfields'=>$arrayfields, 'sql' => $sql); +$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql); $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; From 6dbabaa5143e95cadba8b4397a69bd14aec7af33 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:53:30 +0100 Subject: [PATCH 152/709] Fix: Ensure string type for urlencode() --- htdocs/projet/tasks/time.php | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 32e47dcfb83..c48a6f296cc 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -1297,10 +1297,10 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser $param .= '&limit='.((int) $limit); } if ($search_month > 0) { - $param .= '&search_month=' . urlencode($search_month); + $param .= '&search_month=' . urlencode((string) ($search_month)); } if ($search_year > 0) { - $param .= '&search_year=' . urlencode($search_year); + $param .= '&search_year=' . urlencode((string) ($search_year)); } if (!empty($search_user)) { // We keep param if -1 because default value is forced to user id if not set $param .= '&search_user='.urlencode($search_user); @@ -1327,40 +1327,40 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser $param .= '&search_note=' . urlencode($search_note); } if ($search_duration != '') { - $param .= '&search_field2=' . urlencode($search_duration); + $param .= '&search_field2=' . urlencode((string) ($search_duration)); } if ($optioncss != '') { $param .= '&optioncss=' . urlencode($optioncss); } if ($search_date_startday) { - $param .= '&search_date_startday=' . urlencode($search_date_startday); + $param .= '&search_date_startday=' . urlencode((string) ($search_date_startday)); } if ($search_date_startmonth) { - $param .= '&search_date_startmonth=' . urlencode($search_date_startmonth); + $param .= '&search_date_startmonth=' . urlencode((string) ($search_date_startmonth)); } if ($search_date_startyear) { - $param .= '&search_date_startyear=' . urlencode($search_date_startyear); + $param .= '&search_date_startyear=' . urlencode((string) ($search_date_startyear)); } if ($search_date_endday) { - $param .= '&search_date_endday=' . urlencode($search_date_endday); + $param .= '&search_date_endday=' . urlencode((string) ($search_date_endday)); } if ($search_date_endmonth) { - $param .= '&search_date_endmonth=' . urlencode($search_date_endmonth); + $param .= '&search_date_endmonth=' . urlencode((string) ($search_date_endmonth)); } if ($search_date_endyear) { - $param .= '&search_date_endyear=' . urlencode($search_date_endyear); + $param .= '&search_date_endyear=' . urlencode((string) ($search_date_endyear)); } if ($search_timespent_starthour) { - $param .= '&search_timespent_duration_starthour=' . urlencode($search_timespent_starthour); + $param .= '&search_timespent_duration_starthour=' . urlencode((string) ($search_timespent_starthour)); } if ($search_timespent_startmin) { - $param .= '&search_timespent_duration_startmin=' . urlencode($search_timespent_startmin); + $param .= '&search_timespent_duration_startmin=' . urlencode((string) ($search_timespent_startmin)); } if ($search_timespent_endhour) { - $param .= '&search_timespent_duration_endhour=' . urlencode($search_timespent_endhour); + $param .= '&search_timespent_duration_endhour=' . urlencode((string) ($search_timespent_endhour)); } if ($search_timespent_endmin) { - $param .= '&search_timespent_duration_endmin=' . urlencode($search_timespent_endmin); + $param .= '&search_timespent_duration_endmin=' . urlencode((string) ($search_timespent_endmin)); } /* @@ -1368,13 +1368,13 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; */ if ($id) { - $param .= '&id=' . urlencode($id); + $param .= '&id=' . urlencode((string) ($id)); } if ($projectid) { - $param .= '&projectid=' . urlencode($projectid); + $param .= '&projectid=' . urlencode((string) ($projectid)); } if ($withproject) { - $param .= '&withproject=' . urlencode($withproject); + $param .= '&withproject=' . urlencode((string) ($withproject)); } // Add $param from hooks $parameters = array(); From f12e03cdc13da52a9ec1a918a4cdb348d91ba4c6 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:53:33 +0100 Subject: [PATCH 153/709] Fix: Ensure string type for urlencode() --- htdocs/public/eventorganization/attendee_new.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/public/eventorganization/attendee_new.php b/htdocs/public/eventorganization/attendee_new.php index edccbf8006a..7de72eac061 100644 --- a/htdocs/public/eventorganization/attendee_new.php +++ b/htdocs/public/eventorganization/attendee_new.php @@ -235,7 +235,7 @@ if ($reshook < 0) { } // Action called when page is submitted -if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conference->status==2 || !empty($project->id) && $project->status == Project::STATUS_VALIDATED)) { +if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conference->status == 2 || !empty($project->id) && $project->status == Project::STATUS_VALIDATED)) { $error = 0; $urlback = ''; @@ -600,7 +600,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen // Now we redirect to the payment page $sourcetouse = 'organizedeventregistration'; $reftouse = $facture->id; - $redirection = $dolibarr_main_url_root.'/public/payment/newpayment.php?source='.urlencode($sourcetouse).'&ref='.urlencode($reftouse); + $redirection = $dolibarr_main_url_root.'/public/payment/newpayment.php?source='.urlencode((string) ($sourcetouse)).'&ref='.urlencode((string) ($reftouse)); if (getDolGlobalString('PAYMENT_SECURITY_TOKEN')) { if (getDolGlobalString('PAYMENT_SECURITY_TOKEN_UNIQUE')) { $redirection .= '&securekey='.dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN') . $sourcetouse . $reftouse, 2); // Use the source in the hash to avoid duplicates if the references are identical From cc606e9e85b4f13a785e0674f6ee74d855b6d7db Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:53:35 +0100 Subject: [PATCH 154/709] Fix: Ensure string type for urlencode() --- htdocs/public/onlinesign/newonlinesign.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index f5be599fcc4..9f09c6a3f4d 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -112,8 +112,8 @@ if (!empty($SECUREKEY)) { $urlko .= 'securekey='.urlencode($SECUREKEY).'&'; } if (!empty($entity)) { - $urlok .= 'entity='.urlencode($entity).'&'; - $urlko .= 'entity='.urlencode($entity).'&'; + $urlok .= 'entity='.urlencode((string) ($entity)).'&'; + $urlko .= 'entity='.urlencode((string) ($entity)).'&'; } $urlok = preg_replace('/&$/', '', $urlok); // Remove last & $urlko = preg_replace('/&$/', '', $urlko); // Remove last & @@ -146,19 +146,19 @@ if (!dol_verifyHash($securekeyseed.$type.$ref.(isModEnabled('multicompany') ? $e if ($source == 'proposal') { require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; $object = new Propal($db); - $result= $object->fetch(0, $ref, '', $entity); + $result = $object->fetch(0, $ref, '', $entity); } elseif ($source == 'contract') { require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; $object = new Contrat($db); - $result= $object->fetch(0, $ref); + $result = $object->fetch(0, $ref); } elseif ($source == 'fichinter') { require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; $object = new Fichinter($db); - $result= $object->fetch(0, $ref); + $result = $object->fetch(0, $ref); } elseif ($source == 'societe_rib') { require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php'; $object = new CompanyBankAccount($db); - $result= $object->fetch($ref); + $result = $object->fetch($ref); } else { httponly_accessforbidden($langs->trans('ErrorBadParameters')." - Bad value for source. Value not supported.", 400, 1); } @@ -571,11 +571,11 @@ if ($source == 'proposal') { $object->setDocModel($user, $defaulttemplate); $moreparams = array( - 'use_companybankid'=>$object->id, - 'force_dir_output'=>$diroutput + 'use_companybankid' => $object->id, + 'force_dir_output' => $diroutput ); $result = $object->thirdparty->generateDocument($defaulttemplate, $langs, 0, 0, 0, $moreparams); - $object->last_main_doc=$object->thirdparty->last_main_doc; + $object->last_main_doc = $object->thirdparty->last_main_doc; } $directdownloadlink = $object->getLastMainDocLink('company'); if ($directdownloadlink) { From 5ab36a5aa9bf077b9f216f6f5e3f9e66bb5c3d51 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:53:38 +0100 Subject: [PATCH 155/709] Fix: Ensure string type for urlencode() --- htdocs/public/payment/newpayment.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index e679a3e180f..efa31e998c2 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -238,8 +238,8 @@ if (!empty($SECUREKEY)) { $urlko .= 'securekey='.urlencode($SECUREKEY).'&'; } if (!empty($entity)) { - $urlok .= 'e='.urlencode($entity).'&'; - $urlko .= 'e='.urlencode($entity).'&'; + $urlok .= 'e='.urlencode((string) ($entity)).'&'; + $urlko .= 'e='.urlencode((string) ($entity)).'&'; } if (!empty($getpostlang)) { $urlok .= 'lang='.urlencode($getpostlang).'&'; @@ -519,7 +519,7 @@ if ($action == 'charge' && isModEnabled('stripe')) { 'dol_entity' => $conf->entity, 'dol_company' => $mysoc->name, // Useful when using multicompany 'dol_tax_num' => $vatnumber, - 'ipaddress'=> getUserRemoteIP() + 'ipaddress' => getUserRemoteIP() ); if (!empty($thirdparty_id)) { @@ -1421,9 +1421,9 @@ if ($source == 'contractline') { // TODO Put this in a global method if ($contractline->product->duration_value > 1) { - $dur = array("h"=>$langs->trans("Hours"), "d"=>$langs->trans("DurationDays"), "w"=>$langs->trans("DurationWeeks"), "m"=>$langs->trans("DurationMonths"), "y"=>$langs->trans("DurationYears")); + $dur = array("h" => $langs->trans("Hours"), "d" => $langs->trans("DurationDays"), "w" => $langs->trans("DurationWeeks"), "m" => $langs->trans("DurationMonths"), "y" => $langs->trans("DurationYears")); } else { - $dur = array("h"=>$langs->trans("Hour"), "d"=>$langs->trans("DurationDay"), "w"=>$langs->trans("DurationWeek"), "m"=>$langs->trans("DurationMonth"), "y"=>$langs->trans("DurationYear")); + $dur = array("h" => $langs->trans("Hour"), "d" => $langs->trans("DurationDay"), "w" => $langs->trans("DurationWeek"), "m" => $langs->trans("DurationMonth"), "y" => $langs->trans("DurationYear")); } $duration = $contractline->product->duration_value.' '.$dur[$contractline->product->duration_unit]; } @@ -1496,7 +1496,7 @@ if ($source == 'contractline') { if ($source == 'member' || $source == 'membersubscription') { $newsource = 'member'; - $tag=""; + $tag = ""; $found = true; $langs->load("members"); @@ -2362,7 +2362,7 @@ if (preg_match('/^dopayment/', $action)) { // If we chose/clicked on the payme } $ipaddress = getUserRemoteIP(); - $metadata = array('dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>$ipaddress); + $metadata = array('dol_version' => DOL_VERSION, 'dol_entity' => $conf->entity, 'ipaddress' => $ipaddress); if (is_object($object)) { $metadata['dol_type'] = $object->element; $metadata['dol_id'] = $object->id; @@ -2372,7 +2372,7 @@ if (preg_match('/^dopayment/', $action)) { // If we chose/clicked on the payme try { $arrayforpaymentintent = array( - 'description'=>'Stripe payment: '.$FULLTAG.($ref ? ' ref='.$ref : ''), + 'description' => 'Stripe payment: '.$FULLTAG.($ref ? ' ref='.$ref : ''), "metadata" => $metadata ); if ($TAG) { From 31221fe77ac8a0be1c7e8bac02d849022f2d3dba Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:53:40 +0100 Subject: [PATCH 156/709] Fix: Ensure string type for urlencode() --- htdocs/public/ticket/list.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/public/ticket/list.php b/htdocs/public/ticket/list.php index 11a1c5fa5c5..3267d9aef67 100644 --- a/htdocs/public/ticket/list.php +++ b/htdocs/public/ticket/list.php @@ -293,14 +293,14 @@ if ($action == "view_ticketlist") { // -1 value = all so no filter if ($search_fk_user_assign > 0) { $filter['t.fk_user_assign'] = $search_fk_user_assign; - $param .= '&search_fk_user_assign='.urlencode($search_fk_user_assign); + $param .= '&search_fk_user_assign='.urlencode((string) ($search_fk_user_assign)); } } if (!empty($search_fk_user_create)) { // -1 value = all so no filter if ($search_fk_user_create > 0) { $filter['t.fk_user_create'] = $search_fk_user_create; - $param .= '&search_fk_user_create='.urlencode($search_fk_user_create); + $param .= '&search_fk_user_create='.urlencode((string) ($search_fk_user_create)); } } if ((isset($search_fk_status) && $search_fk_status != '') && $search_fk_status != '-1' && $search_fk_status != 'non_closed') { @@ -432,8 +432,8 @@ if ($action == "view_ticketlist") { $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields // allow to display information before list - $parameters=array('arrayfields'=>$arrayfields); - $reshook=$hookmanager->executeHooks('printFieldListHeader', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + $parameters = array('arrayfields' => $arrayfields); + $reshook = $hookmanager->executeHooks('printFieldListHeader', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; print '
'; @@ -501,7 +501,7 @@ if ($action == "view_ticketlist") { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook - $parameters = array('arrayfields'=>$arrayfields); + $parameters = array('arrayfields' => $arrayfields); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; @@ -563,7 +563,7 @@ if ($action == "view_ticketlist") { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields - $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); + $parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; From 1f25fabc3457542be34f48c6913f1bbdc2a56641 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:53:43 +0100 Subject: [PATCH 157/709] Fix: Ensure string type for urlencode() --- htdocs/reception/list.php | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index caadc0e2af0..f6242c6ee14 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -560,7 +560,7 @@ if (empty($reshook)) { if ($nb_bills_created == 1) { $texttoshow = $langs->trans('BillXCreated', '{s1}'); - $texttoshow = str_replace('{s1}', ''.$lastref.'', $texttoshow); + $texttoshow = str_replace('{s1}', ''.$lastref.'', $texttoshow); setEventMessages($texttoshow, null, 'mesgs'); } else { setEventMessages($langs->trans('BillCreated', $nb_bills_created), null, 'mesgs'); @@ -765,7 +765,7 @@ if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); } if ($search_billed != '' && $search_billed >= 0) { - $param .= "&search_billed=".urlencode($search_billed); + $param .= "&search_billed=".urlencode((string) ($search_billed)); } if ($search_town) { $param .= "&search_town=".urlencode($search_town); @@ -780,46 +780,46 @@ if ($search_status != '') { $param .= "&search_status=".urlencode($search_status); } if ($search_country) { - $param .= "&search_country=".urlencode($search_country); + $param .= "&search_country=".urlencode((string) ($search_country)); } if ($search_type_thirdparty) { - $param .= "&search_type_thirdparty=".urlencode($search_type_thirdparty); + $param .= "&search_type_thirdparty=".urlencode((string) ($search_type_thirdparty)); } if ($search_date_delivery_startday) { - $param .= '&search_date_delivery_startday='.urlencode($search_date_delivery_startday); + $param .= '&search_date_delivery_startday='.urlencode((string) ($search_date_delivery_startday)); } if ($search_date_delivery_startmonth) { - $param .= '&search_date_delivery_startmonth='.urlencode($search_date_delivery_startmonth); + $param .= '&search_date_delivery_startmonth='.urlencode((string) ($search_date_delivery_startmonth)); } if ($search_date_delivery_startyear) { - $param .= '&search_date_delivery_startyear='.urlencode($search_date_delivery_startyear); + $param .= '&search_date_delivery_startyear='.urlencode((string) ($search_date_delivery_startyear)); } if ($search_date_delivery_endday) { - $param .= '&search_date_delivery_endday='.urlencode($search_date_delivery_endday); + $param .= '&search_date_delivery_endday='.urlencode((string) ($search_date_delivery_endday)); } if ($search_date_delivery_endmonth) { - $param .= '&search_date_delivery_endmonth='.urlencode($search_date_delivery_endmonth); + $param .= '&search_date_delivery_endmonth='.urlencode((string) ($search_date_delivery_endmonth)); } if ($search_date_delivery_endyear) { - $param .= '&search_date_delivery_endyear='.urlencode($search_date_delivery_endyear); + $param .= '&search_date_delivery_endyear='.urlencode((string) ($search_date_delivery_endyear)); } if ($search_date_create_startday) { - $param .= '&search_date_create_startday='.urlencode($search_date_create_startday); + $param .= '&search_date_create_startday='.urlencode((string) ($search_date_create_startday)); } if ($search_date_create_startmonth) { - $param .= '&search_date_create_startmonth='.urlencode($search_date_create_startmonth); + $param .= '&search_date_create_startmonth='.urlencode((string) ($search_date_create_startmonth)); } if ($search_date_create_startyear) { - $param .= '&search_date_create_startyear='.urlencode($search_date_create_startyear); + $param .= '&search_date_create_startyear='.urlencode((string) ($search_date_create_startyear)); } if ($search_date_create_endday) { - $param .= '&search_date_create_endday='.urlencode($search_date_create_endday); + $param .= '&search_date_create_endday='.urlencode((string) ($search_date_create_endday)); } if ($search_date_create_endmonth) { - $param .= '&search_date_create_endmonth='.urlencode($search_date_create_endmonth); + $param .= '&search_date_create_endmonth='.urlencode((string) ($search_date_create_endmonth)); } if ($search_date_create_endyear) { - $param .= '&search_date_create_endyear='.urlencode($search_date_create_endyear); + $param .= '&search_date_create_endyear='.urlencode((string) ($search_date_create_endyear)); } if ($search_ref_supplier) { $param .= "&search_ref_supplier=".urlencode($search_ref_supplier); From 6644897b6041541c82d6521caa2f69ee11a41be7 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:53:46 +0100 Subject: [PATCH 158/709] Fix: Ensure string type for urlencode() --- .../recruitmentcandidature_list.php | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/htdocs/recruitment/recruitmentcandidature_list.php b/htdocs/recruitment/recruitmentcandidature_list.php index 3284710c7eb..56c05ffdb56 100644 --- a/htdocs/recruitment/recruitmentcandidature_list.php +++ b/htdocs/recruitment/recruitmentcandidature_list.php @@ -117,11 +117,11 @@ foreach ($object->fields as $key => $val) { if (!empty($val['visible'])) { $visible = (int) dol_eval($val['visible'], 1); $arrayfields['t.'.$key] = array( - 'label'=>$val['label'], - 'checked'=>(($visible < 0) ? 0 : 1), - 'enabled'=>(abs($visible) != 3 && (int) dol_eval($val['enabled'], 1)), - 'position'=>$val['position'], - 'help'=> isset($val['help']) ? $val['help'] : '' + 'label' => $val['label'], + 'checked' => (($visible < 0) ? 0 : 1), + 'enabled' => (abs($visible) != 3 && (int) dol_eval($val['enabled'], 1)), + 'position' => $val['position'], + 'help' => isset($val['help']) ? $val['help'] : '' ); } } @@ -499,7 +499,7 @@ $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; if (!empty($id)) { - $param .= '&id='.urlencode($id); + $param .= '&id='.urlencode((string) ($id)); } if (!empty($mode)) { $param .= '&mode='.urlencode($mode); @@ -533,7 +533,7 @@ $param .= $hookmanager->resPrint; // List of mass actions available $arrayofmassactions = array( - 'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"), + 'validate' => img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"), //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"), //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), @@ -562,8 +562,8 @@ print ''; $newcardbutton = ''; -$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); -$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss' => 'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss' => 'reposition')); $newcardbutton .= dolGetButtonTitleSeparator(); $newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/recruitment/recruitmentcandidature_card.php', 1).'?action=create&fk_recruitmentjobposition='.$id, '', $permissiontoadd); @@ -662,7 +662,7 @@ foreach ($object->fields as $key => $val) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook -$parameters = array('arrayfields'=>$arrayfields); +$parameters = array('arrayfields' => $arrayfields); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column @@ -704,7 +704,7 @@ foreach ($object->fields as $key => $val) { // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields -$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray); +$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column @@ -761,7 +761,7 @@ while ($i < $imaxinloop) { $selected = 1; } } - print $object->getKanbanView('', array('jobpositionlink'=>$recruitment->getNomUrl(1), 'selected' => $selected)); + print $object->getKanbanView('', array('jobpositionlink' => $recruitment->getNomUrl(1), 'selected' => $selected)); if ($i == ($imaxinloop - 1)) { print '
'; print ''; @@ -838,7 +838,7 @@ while ($i < $imaxinloop) { // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column @@ -880,7 +880,7 @@ if ($num == 0) { $db->free($resql); -$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); +$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql); $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; From c7d1e2616d8b7ce0e9d3056347e3b1139b7eab61 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:53:50 +0100 Subject: [PATCH 159/709] Fix: Ensure string type for urlencode() --- htdocs/salaries/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index 36d30fc46a2..0159b9b93a9 100644 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -330,7 +330,7 @@ if ($action == 'add' && empty($cancel)) { if (GETPOST('saveandnew', 'alpha')) { setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); - header("Location: card.php?action=create&fk_project=" . urlencode($projectid) . "&accountid=" . urlencode($accountid) . '&paymenttype=' . urlencode(GETPOSTINT('paymenttype')) . '&datepday=' . GETPOSTINT("datepday") . '&datepmonth=' . GETPOSTINT("datepmonth") . '&datepyear=' . GETPOSTINT("datepyear")); + header("Location: card.php?action=create&fk_project=" . urlencode((string) ($projectid)) . "&accountid=" . urlencode((string) ($accountid)) . '&paymenttype=' . urlencode((string) (GETPOSTINT('paymenttype'))) . '&datepday=' . GETPOSTINT("datepday") . '&datepmonth=' . GETPOSTINT("datepmonth") . '&datepyear=' . GETPOSTINT("datepyear")); exit; } else { header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $object->id); From ad99c7e2a8174833ac3b4334d8bb6df43bcdf8ab Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:53:53 +0100 Subject: [PATCH 160/709] Fix: Ensure string type for urlencode() --- htdocs/salaries/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php index 3b1beab890d..7af81d47d6e 100644 --- a/htdocs/salaries/list.php +++ b/htdocs/salaries/list.php @@ -380,7 +380,7 @@ if ($search_label) { $param .= '&search_label='.urlencode($search_label); } if ($search_account) { - $param .= '&search_account='.urlencode($search_account); + $param .= '&search_account='.urlencode((string) ($search_account)); } if ($search_status != '' && $search_status != '-1') { $param .= '&search_status='.urlencode($search_status); From a6827b7c910bef3b3875135009be284ef5d3290f Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:53:56 +0100 Subject: [PATCH 161/709] Fix: Ensure string type for urlencode() --- htdocs/salaries/payments.php | 44 ++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/htdocs/salaries/payments.php b/htdocs/salaries/payments.php index db0865ba994..fc659db2e1b 100644 --- a/htdocs/salaries/payments.php +++ b/htdocs/salaries/payments.php @@ -140,11 +140,11 @@ foreach ($object->fields as $key => $val) { if (!empty($val['visible'])) { $visible = (int) dol_eval($val['visible'], 1, 1, '1'); $arrayfields['t.'.$key] = array( - 'label'=>$val['label'], - 'checked'=>(($visible < 0) ? 0 : 1), - 'enabled'=>(abs($visible) != 3 && (int) dol_eval($val['enabled'], 1, 1, '1')), - 'position'=>$val['position'], - 'help'=> isset($val['help']) ? $val['help'] : '' + 'label' => $val['label'], + 'checked' => (($visible < 0) ? 0 : 1), + 'enabled' => (abs($visible) != 3 && (int) dol_eval($val['enabled'], 1, 1, '1')), + 'position' => $val['position'], + 'help' => isset($val['help']) ? $val['help'] : '' ); } } @@ -362,25 +362,25 @@ if ($search_label) { $param .= '&search_label='.urlencode($search_label); } if ($search_fk_bank) { - $param .= '&search_fk_bank='.urlencode($search_fk_bank); + $param .= '&search_fk_bank='.urlencode((string) ($search_fk_bank)); } if ($search_chq_number) { - $param .= '&search_chq_number='.urlencode($search_chq_number); + $param .= '&search_chq_number='.urlencode((string) ($search_chq_number)); } if ($search_account) { - $param .= '&search_account='.urlencode($search_account); + $param .= '&search_account='.urlencode((string) ($search_account)); } if ($search_date_start) { - $param .= '&search_date_startday='.urlencode(GETPOSTINT('search_date_startday')).'&search_date_startmonth='.urlencode(GETPOSTINT('search_date_startmonth')).'&search_date_startyear='.urlencode(GETPOSTINT('search_date_startyear')); + $param .= '&search_date_startday='.urlencode((string) (GETPOSTINT('search_date_startday'))).'&search_date_startmonth='.urlencode((string) (GETPOSTINT('search_date_startmonth'))).'&search_date_startyear='.urlencode((string) (GETPOSTINT('search_date_startyear'))); } if ($search_dateep_start) { - $param .= '&search_dateep_startday='.urlencode(GETPOSTINT('search_dateep_startday')).'&search_dateep_startmonth='.urlencode(GETPOSTINT('search_dateep_startmonth')).'&search_dateep_startyear='.urlencode(GETPOSTINT('search_dateep_startyear')); + $param .= '&search_dateep_startday='.urlencode((string) (GETPOSTINT('search_dateep_startday'))).'&search_dateep_startmonth='.urlencode((string) (GETPOSTINT('search_dateep_startmonth'))).'&search_dateep_startyear='.urlencode((string) (GETPOSTINT('search_dateep_startyear'))); } if ($search_date_end) { - $param .= '&search_date_endday='.urlencode(GETPOSTINT('search_date_endday')).'&search_date_endmonth='.urlencode(GETPOSTINT('search_date_endmonth')).'&search_date_endyear='.urlencode(GETPOSTINT('search_date_endyear')); + $param .= '&search_date_endday='.urlencode((string) (GETPOSTINT('search_date_endday'))).'&search_date_endmonth='.urlencode((string) (GETPOSTINT('search_date_endmonth'))).'&search_date_endyear='.urlencode((string) (GETPOSTINT('search_date_endyear'))); } if ($search_dateep_end) { - $param .= '&search_dateep_endday='.urlencode(GETPOSTINT('search_dateep_endday')).'&search_dateep_endmonth='.urlencode(GETPOSTINT('search_dateep_endmonth')).'&search_dateep_endyear='.urlencode(GETPOSTINT('search_dateep_endyear')); + $param .= '&search_dateep_endday='.urlencode((string) (GETPOSTINT('search_dateep_endday'))).'&search_dateep_endmonth='.urlencode((string) (GETPOSTINT('search_dateep_endmonth'))).'&search_dateep_endyear='.urlencode((string) (GETPOSTINT('search_dateep_endyear'))); } // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; @@ -414,8 +414,8 @@ if (!empty($socid)) { $url .= '&socid='.$socid; } $newcardbutton = ''; -$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); -$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss' => 'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss' => 'reposition')); $newcardbutton .= dolGetButtonTitleSeparator(); $newcardbutton = dolGetButtonTitle($langs->trans('NewSalaryPayment'), '', 'fa fa-plus-circle', $url, '', $user->hasRight('salaries', 'write')); @@ -454,19 +454,19 @@ print ''; // Date payment print ''; // Date value @@ -501,7 +501,7 @@ print ''; @@ -1269,7 +1269,7 @@ if ($resql) { // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $parameters = array('arrayfields' => $arrayfields, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation @@ -1338,7 +1338,7 @@ if ($resql) { $db->free($resql); - $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); + $parameters = array('arrayfields' => $arrayfields, 'sql' => $sql); $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; From a00e69f96fe31c8fea232f830458ef70d525e4c3 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:54:16 +0100 Subject: [PATCH 168/709] Fix: Ensure string type for urlencode() --- htdocs/takepos/floors.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/takepos/floors.php b/htdocs/takepos/floors.php index 6bb4f8ae4c2..20558a484e4 100644 --- a/htdocs/takepos/floors.php +++ b/htdocs/takepos/floors.php @@ -157,7 +157,7 @@ function updateplace(idplace, left, top) { url: "", data: { action: "update", left: left, top: top, place: idplace, token: '' } }).done(function( msg ) { - window.location.href='floors.php?mode=edit&floor='; + window.location.href='floors.php?mode=edit&floor='; }); } @@ -169,7 +169,7 @@ function updatename(rowid) { url: "", data: { action: "updatename", place: rowid, newname: after, token: '' } }).done(function( msg ) { - window.location.href='floors.php?mode=edit&floor='; + window.location.href='floors.php?mode=edit&floor='; }); } @@ -232,7 +232,8 @@ $( document ).ready(function() { } ?>';"> trans("Floor")." ".$floor; ?> - + From 8bd13a17dba3c479b86b43512cd9681083486f31 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:54:18 +0100 Subject: [PATCH 169/709] Fix: Ensure string type for urlencode() --- htdocs/takepos/pay.php | 50 +++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index ec19ad6c74d..27fa2d103e3 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -69,7 +69,7 @@ $title = ''; $disablejs = 0; $disablehead = 0; -$head=''; +$head = ''; if (getDolGlobalInt('TAKEPOS_COLOR_THEME') == 1) { $head .= ''; } @@ -122,7 +122,7 @@ function unexpectedDisconnect() { function fetchConnectionToken() { type != $invoice::TYPE_CREDIT_NOTE) { trans('TotalTTC')."'.substring(0,20);"; - echo "line1=line1.padEnd(20);"; - echo "var line2='".price($invoice->total_ttc, 1, '', 1, -1, -1)."'.substring(0,20);"; - echo "line2=line2.padEnd(20);"; - echo "$.ajax({ + echo "var line1='".$langs->trans('TotalTTC')."'.substring(0,20);"; + echo "line1=line1.padEnd(20);"; + echo "var line2='".price($invoice->total_ttc, 1, '', 1, -1, -1)."'.substring(0,20);"; + echo "line2=line2.padEnd(20);"; + echo "$.ajax({ type: 'GET', data: { text: line1+line2 }, url: '".getDolGlobalString('TAKEPOS_PRINT_SERVER')."/display/index.php', @@ -553,7 +553,7 @@ if (isModEnabled('multicurrency') && $_SESSION["takeposcustomercurrency"] != ""
trans("Received"); ?>: multicurrency_code); + echo price(0, 1, '', 1, -1, -1, $invoice->multicurrency_code); if ($showothercurrency) { print '   (' . price(0 * $multicurrency->rate->rate) . ' ' . $_SESSION["takeposcustomercurrency"] . ')'; } @@ -561,7 +561,7 @@ if (isModEnabled('multicurrency') && $_SESSION["takeposcustomercurrency"] != ""
trans("Change"); ?>: multicurrency_code); + echo price(0, 1, '', 1, -1, -1, $invoice->multicurrency_code); if ($showothercurrency) { print '   (' . price(0 * $multicurrency->rate->rate) . ' ' . $_SESSION["takeposcustomercurrency"] . ')'; } @@ -583,18 +583,18 @@ if (isModEnabled('multicurrency') && $_SESSION["takeposcustomercurrency"] != ""
"reset()", - "span" => "style='font-size: 150%;'", - "text" => "C", - "class" => "poscolorblue" - ), - array( - "function" => "parent.$.colorbox.close();", - "span" => "id='printtext' style='font-weight: bold; font-size: 18pt;'", - "text" => "X", - "class" => "poscolordelete" - ), +array( + "function" => "reset()", + "span" => "style='font-size: 150%;'", + "text" => "C", + "class" => "poscolorblue" +), +array( + "function" => "parent.$.colorbox.close();", + "span" => "id='printtext' style='font-weight: bold; font-size: 18pt;'", + "text" => "X", + "class" => "poscolordelete" +), ); $numpad = getDolGlobalString('TAKEPOS_NUMPAD'); if (isModEnabled('stripe') && isset($keyforstripeterminalbank) && getDolGlobalString('STRIPE_CARD_PRESENT')) { @@ -748,7 +748,7 @@ if (getDolGlobalString('TAKEPOS_DELAYED_PAYMENT')) { executeHooks('completePayment', $parameters, $invoice); print $hookmanager->resPrint; ?> From a7c5b01ec3ecae2fc89cfa7fd88f5a9eb45555df Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:54:21 +0100 Subject: [PATCH 170/709] Fix: Ensure string type for urlencode() --- htdocs/ticket/list.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 1233793cd7d..4ccef134ea0 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -668,16 +668,16 @@ $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook $param .= $hookmanager->resPrint; if ($socid > 0) { - $param .= '&socid='.urlencode($socid); + $param .= '&socid='.urlencode((string) ($socid)); } if ($search_societe) { $param .= '&search_societe='.urlencode($search_societe); } if ($projectid > 0) { - $param .= '&projectid='.urlencode($projectid); + $param .= '&projectid='.urlencode((string) ($projectid)); } if ($contractid > 0) { - $param .= '&contractid='.urlencode($contractid); + $param .= '&contractid='.urlencode((string) ($contractid)); } if ($search_date_start) { $tmparray = dol_getdate($search_date_start); From 7fd69459dfc33e36202ef30dc6dfcea0063f51a3 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:54:24 +0100 Subject: [PATCH 171/709] Fix: Ensure string type for urlencode() --- htdocs/user/agenda.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/user/agenda.php b/htdocs/user/agenda.php index a9887cc577c..7c692bb9ba4 100644 --- a/htdocs/user/agenda.php +++ b/htdocs/user/agenda.php @@ -89,7 +89,7 @@ if (($object->id != $user->id) && !$user->hasRight('user', 'user', 'lire')) { accessforbidden(); } -$parameters = array('id'=>$userId); +$parameters = array('id' => $userId); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -185,7 +185,7 @@ if (isModEnabled('agenda')) { if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allaactions', 'read'))) { print '
'; - $param = '&id='.urlencode($id); + $param = '&id='.urlencode((string) ($id)); if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.((int) $limit); From 41a82fe7da8f87990904374f75bcbb45c034f31d Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:54:27 +0100 Subject: [PATCH 172/709] Fix: Ensure string type for urlencode() --- htdocs/user/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/user/list.php b/htdocs/user/list.php index c7793975b0f..e55dc5ea1bc 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -606,7 +606,7 @@ if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); } if ($search_categ > 0) { - $param .= '&search_categ='.urlencode($search_categ); + $param .= '&search_categ='.urlencode((string) ($search_categ)); } if ($search_warehouse > 0) { $param .= '&search_warehouse='.urlencode($search_warehouse); @@ -650,7 +650,7 @@ print ''; $url = DOL_URL_ROOT.'/user/card.php?action=create'.($contextpage == 'employeelist' ? '&search_employee=1' : '').'&leftmenu='; if (!empty($socid)) { - $url .= '&socid='.urlencode($socid); + $url .= '&socid='.urlencode((string) ($socid)); } $newcardbutton = ''; From 08424f1347cd866f86043f0b2369d21981d8a0e0 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:54:29 +0100 Subject: [PATCH 173/709] Fix: Ensure string type for urlencode() --- htdocs/user/messaging.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/user/messaging.php b/htdocs/user/messaging.php index d9db450b985..f28ee2aa0cc 100644 --- a/htdocs/user/messaging.php +++ b/htdocs/user/messaging.php @@ -99,7 +99,7 @@ $result = restrictedArea($user, 'user', $userId, '&user'); * Actions */ -$parameters = array('id'=>$socid); +$parameters = array('id' => $socid); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -196,7 +196,7 @@ if (isModEnabled('agenda')) { if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allaactions', 'read'))) { print '
'; - $param = '&userid='.urlencode($userid); + $param = '&userid='.urlencode((string) ($userid)); if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } From be80a14b472b0542f2aa27081c11eb02db6afa79 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:54:32 +0100 Subject: [PATCH 174/709] Fix: Ensure string type for urlencode() --- htdocs/user/notify/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/user/notify/card.php b/htdocs/user/notify/card.php index 8112a219016..240723c47c8 100644 --- a/htdocs/user/notify/card.php +++ b/htdocs/user/notify/card.php @@ -228,11 +228,11 @@ if ($result > 0) { // Add notification form // print load_fiche_titre($langs->trans("AddNewNotification"), '', ''); - print ''; + print ''; print ''; print ''; - $param = "&id=".urlencode($id); + $param = "&id=".urlencode((string) ($id)); // Line with titles /* print '
">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?>">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?>
'; - print ''.img_edit().''; - print ''.img_delete().''; + print ''.img_edit().''; + print ''.img_delete().''; print '
'; if ($menu['titre'] != 'Module'.$module.'Name') { - print ''.img_edit().''; - print ''.img_delete().''; + print ''.img_edit().''; + print ''.img_delete().''; } print ''; print ''.img_edit().''; - print ''.img_delete().''; + print ''.img_delete().''; print ''; - if ($objp->qty >0) { + if ($objp->qty > 0) { print '+'.$objp->qty.''; } else { print ''.$objp->qty.''; From 8b8f1c9410796cf2f683cd670c0ab8367aae9952 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:52:12 +0100 Subject: [PATCH 121/709] Fix: Ensure string type for urlencode() --- htdocs/partnership/partnership_agenda.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/partnership/partnership_agenda.php b/htdocs/partnership/partnership_agenda.php index 0f0fd217047..851809edb21 100644 --- a/htdocs/partnership/partnership_agenda.php +++ b/htdocs/partnership/partnership_agenda.php @@ -112,7 +112,7 @@ if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') { * Actions */ -$parameters = array('id'=>$id); +$parameters = array('id' => $id); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -217,14 +217,14 @@ if ($object->id > 0) { $objthirdparty = $object; $objcon = new stdClass(); - $out = '&origin='.urlencode($object->element.'@'.$object->module).'&originid='.urlencode($object->id); + $out = '&origin='.urlencode((string) ($object->element.'@'.$object->module)).'&originid='.urlencode((string) ($object->id)); $urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id; $out .= '&backtopage='.urlencode($urlbacktopage); $permok = $user->hasRight('agenda', 'myactions', 'create'); if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) { //$out.=' Date: Fri, 8 Mar 2024 02:52:15 +0100 Subject: [PATCH 122/709] Fix: Ensure string type for urlencode() --- htdocs/partnership/partnership_list.php | 38 ++++++++++++------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/htdocs/partnership/partnership_list.php b/htdocs/partnership/partnership_list.php index c810e09f554..327b8e7988e 100644 --- a/htdocs/partnership/partnership_list.php +++ b/htdocs/partnership/partnership_list.php @@ -136,11 +136,11 @@ foreach ($object->fields as $key => $val) { if (!empty($val['visible'])) { $visible = (int) dol_eval($val['visible'], 1); $arrayfields['t.'.$key] = array( - 'label'=>$val['label'], - 'checked'=>(($visible < 0) ? 0 : 1), - 'enabled'=>(abs($visible) != 3 && (int) dol_eval($val['enabled'], 1)), - 'position'=>$val['position'], - 'help'=> isset($val['help']) ? $val['help'] : '' + 'label' => $val['label'], + 'checked' => (($visible < 0) ? 0 : 1), + 'enabled' => (abs($visible) != 3 && (int) dol_eval($val['enabled'], 1)), + 'position' => $val['position'], + 'help' => isset($val['help']) ? $val['help'] : '' ); } } @@ -598,10 +598,10 @@ if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.((int) $limit); } if ($socid) { - $param .= '&socid='.urlencode($socid); + $param .= '&socid='.urlencode((string) ($socid)); } if ($memberid) { - $param .= '&rowid='.urlencode($memberid); + $param .= '&rowid='.urlencode((string) ($memberid)); } foreach ($search as $key => $val) { if (is_array($search[$key])) { @@ -634,11 +634,11 @@ $param .= $hookmanager->resPrint; // List of mass actions available $arrayofmassactions = array( //'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"), - 'approve'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("ValidateAndApprove"), - 'cancel'=>img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Cancel"), + 'approve' => img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("ValidateAndApprove"), + 'cancel' => img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Cancel"), //'generate_doc'=>img_picto('', 'pdf').$langs->trans("ReGeneratePDF"), //'builddoc'=>img_picto('', 'pdf').$langs->trans("PDFMerge"), - 'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendMail"), + 'presend' => img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendMail"), ); if ($permissiontodelete) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); @@ -669,8 +669,8 @@ if ($socid) { $newcardbutton = ''; -$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); -$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss' => 'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss' => 'reposition')); $newcardbutton .= dolGetButtonTitleSeparator(); $newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/partnership/partnership_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd); @@ -710,7 +710,7 @@ if (empty($reshook)) { if (!empty($moreforfilter)) { print '
'; print $moreforfilter; - $parameters = array('type'=>$type); + $parameters = array('type' => $type); $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; print '
'; @@ -777,7 +777,7 @@ foreach ($object->fields as $key => $val) { // End of subscription date if ($managedfor == 'member') { print '
'; - $selectarray = array('-1'=>'', 'withoutsubscription'=>$langs->trans("WithoutSubscription"), 'uptodate'=>$langs->trans("UpToDate"), 'outofdate'=>$langs->trans("OutOfDate")); + $selectarray = array('-1' => '', 'withoutsubscription' => $langs->trans("WithoutSubscription"), 'uptodate' => $langs->trans("UpToDate"), 'outofdate' => $langs->trans("OutOfDate")); print $form->selectarray('search_filter', $selectarray, $search_filter); print '
'.$langs->trans("Duration").''; print $object->duration_value; if ($object->duration_value > 1) { - $dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hours"), "d"=>$langs->trans("Days"), "w"=>$langs->trans("Weeks"), "m"=>$langs->trans("Months"), "y"=>$langs->trans("Years")); + $dur = array("i" => $langs->trans("Minute"), "h" => $langs->trans("Hours"), "d" => $langs->trans("Days"), "w" => $langs->trans("Weeks"), "m" => $langs->trans("Months"), "y" => $langs->trans("Years")); } elseif ($object->duration_value > 0) { - $dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hour"), "d"=>$langs->trans("Day"), "w"=>$langs->trans("Week"), "m"=>$langs->trans("Month"), "y"=>$langs->trans("Year")); + $dur = array("i" => $langs->trans("Minute"), "h" => $langs->trans("Hour"), "d" => $langs->trans("Day"), "w" => $langs->trans("Week"), "m" => $langs->trans("Month"), "y" => $langs->trans("Year")); } print(!empty($object->duration_unit) && isset($dur[$object->duration_unit]) ? " ".$langs->trans($dur[$object->duration_unit])." " : ''); @@ -2882,7 +2884,7 @@ if (($action == 'clone' && (empty($conf->use_javascript_ajax) || !empty($conf->d // Define confirmation messages $formquestionclone = array( 'text' => $langs->trans("ConfirmClone"), - array('type' => 'text', 'name' => 'clone_ref', 'label' => $langs->trans("NewRefForClone"), 'value' => empty($tmpcode) ? $langs->trans("CopyOf").' '.$object->ref : $tmpcode, 'morecss'=>'width150'), + array('type' => 'text', 'name' => 'clone_ref', 'label' => $langs->trans("NewRefForClone"), 'value' => empty($tmpcode) ? $langs->trans("CopyOf").' '.$object->ref : $tmpcode, 'morecss' => 'width150'), array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneContentProduct"), 'value' => 1), array('type' => 'checkbox', 'name' => 'clone_categories', 'label' => $langs->trans("CloneCategoriesProduct"), 'value' => 1), ); From 4d53e828d2916f48fd7d8d7cc92d1ce5bf9f690b Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:52:23 +0100 Subject: [PATCH 125/709] Fix: Ensure string type for urlencode() --- htdocs/product/list.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 92f95dad523..1fe8ae87fa5 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -748,7 +748,7 @@ if ($sall) { $param .= "&sall=".urlencode($sall); } if ($searchCategoryProductOperator == 1) { - $param .= "&search_category_product_operator=".urlencode($searchCategoryProductOperator); + $param .= "&search_category_product_operator=".urlencode((string) ($searchCategoryProductOperator)); } foreach ($searchCategoryProductList as $searchCategoryProduct) { $param .= "&search_category_product_list[]=".urlencode($searchCategoryProduct); @@ -778,22 +778,22 @@ if ($search_tobatch) { $param .= "&search_tobatch=".urlencode($search_tobatch); } if ($search_country != '') { - $param .= "&search_country=".urlencode($search_country); + $param .= "&search_country=".urlencode((string) ($search_country)); } if ($search_state != '') { - $param .= "&search_state=".urlencode($search_state); + $param .= "&search_state=".urlencode((string) ($search_state)); } if ($search_vatrate) { $param .= "&search_vatrate=".urlencode($search_vatrate); } if ($fourn_id > 0) { - $param .= "&fourn_id=".urlencode($fourn_id); + $param .= "&fourn_id=".urlencode((string) ($fourn_id)); } if ($show_childproducts) { $param .= ($show_childproducts ? "&search_show_childproducts=".urlencode($show_childproducts) : ""); } if ($type != '') { - $param .= '&type='.urlencode($type); + $param .= '&type='.urlencode((string) ($type)); } if ($search_type != '') { $param .= '&search_type='.urlencode($search_type); From ccc8b19e071fc13a25fb7b5473f0a68aa89a71aa Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:52:27 +0100 Subject: [PATCH 126/709] Fix: Ensure string type for urlencode() --- htdocs/product/reassort.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index a7ca019a763..32d15a43939 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -360,10 +360,10 @@ if ($resql) { $param .= "&tobuy=".urlencode($tobuy); } if ($type != '') { - $param .= "&type=".urlencode($type); + $param .= "&type=".urlencode((string) ($type)); } if ($fourn_id) { - $param .= "&fourn_id=".urlencode($fourn_id); + $param .= "&fourn_id=".urlencode((string) ($fourn_id)); } if ($snom) { $param .= "&snom=".urlencode($snom); @@ -375,13 +375,13 @@ if ($resql) { $param .= "&search_sale=".urlencode($search_sale); } if ($search_categ > 0) { - $param .= "&search_categ=".urlencode($search_categ); + $param .= "&search_categ=".urlencode((string) ($search_categ)); } if ($search_toolowstock) { $param .= "&search_toolowstock=".urlencode($search_toolowstock); } if ($sbarcode) { - $param .= "&sbarcode=".urlencode($sbarcode); + $param .= "&sbarcode=".urlencode((string) ($sbarcode)); } if ($search_stock_physique) { $param .= '&search_stock_physique=' . urlencode($search_stock_physique); @@ -519,7 +519,7 @@ if ($resql) { print_liste_field_titre("ProductStatusOnSell", $_SERVER["PHP_SELF"], "p.tosell", '', $param, "", $sortfield, $sortorder, 'right '); print_liste_field_titre("ProductStatusOnBuy", $_SERVER["PHP_SELF"], "p.tobuy", '', $param, "", $sortfield, $sortorder, 'right '); // Hook fields - $parameters = array('param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); + $parameters = array('param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column @@ -617,7 +617,7 @@ if ($resql) { print ''.$product->LibStatut($objp->statut, 5, 0).''.$product->LibStatut($objp->tobuy, 5, 1).'
'.dol_print_date($objp->datem).'
 
'; print '
'; - print $form->selectDate($search_dateep_start ? $search_dateep_start : -1, 'search_dateep_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); +print $form->selectDate($search_dateep_start ? $search_dateep_start : -1, 'search_dateep_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); print '
'; print '
'; - print $form->selectDate($search_dateep_end ? $search_dateep_end : -1, 'search_dateep_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); +print $form->selectDate($search_dateep_end ? $search_dateep_end : -1, 'search_dateep_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); print '
'; print '
'; print '
'; - print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); +print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); print '
'; print '
'; - print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); +print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); print '
'; print '
$arrayfields); +$parameters = array('arrayfields' => $arrayfields); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column @@ -551,7 +551,7 @@ $totalarray['nbfield']++; // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields -$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); +$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column @@ -763,7 +763,7 @@ while ($i < $imaxinloop) { // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; @@ -807,7 +807,7 @@ if ($num == 0) { $db->free($resql); -$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); +$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql); $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; From 837749d47164d12f7975daeb8612765d9632d566 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:53:58 +0100 Subject: [PATCH 162/709] Fix: Ensure string type for urlencode() --- htdocs/societe/agenda.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index cffa65d43f1..be5ed78293e 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -94,7 +94,7 @@ $result = restrictedArea($user, 'societe', $socid, '&societe'); * Actions */ -$parameters = array('id'=>$socid); +$parameters = array('id' => $socid); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -194,7 +194,7 @@ if (isModEnabled('agenda')) { if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { print '
'; - $param = '&socid='.urlencode($socid); + $param = '&socid='.urlencode((string) ($socid)); if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } From 7293151d829f7aa99f57f5dccf7598467ede9156 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:54:01 +0100 Subject: [PATCH 163/709] Fix: Ensure string type for urlencode() --- htdocs/societe/consumption.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index 506810c806d..5877e3c9d11 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -412,7 +412,7 @@ if ($sql_select) { $num = $db->num_rows($resql); - $param = "&socid=".urlencode($socid)."&type_element=".urlencode($type_element); + $param = "&socid=".urlencode((string) ($socid))."&type_element=".urlencode((string) ($type_element)); if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -426,10 +426,10 @@ if ($sql_select) { $param .= "&sref=".urlencode($sref); } if ($month) { - $param .= "&month=".urlencode($month); + $param .= "&month=".urlencode((string) ($month)); } if ($year) { - $param .= "&year=".urlencode($year); + $param .= "&year=".urlencode((string) ($year)); } if ($optioncss) { $param .= '&optioncss='.urlencode($optioncss); From 5f025a87e1acdd9f3e0af88966477d4cee01a561 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:54:04 +0100 Subject: [PATCH 164/709] Fix: Ensure string type for urlencode() --- htdocs/societe/list.php | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index c0baeb41882..1d780599f2d 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -897,16 +897,16 @@ if ($search_all != '') { $param = "&search_all=".urlencode($search_all); } if ($search_categ_cus > 0) { - $param .= '&search_categ_cus='.urlencode($search_categ_cus); + $param .= '&search_categ_cus='.urlencode((string) ($search_categ_cus)); } if ($search_categ_sup > 0) { - $param .= '&search_categ_sup='.urlencode($search_categ_sup); + $param .= '&search_categ_sup='.urlencode((string) ($search_categ_sup)); } if ($searchCategoryCustomerOperator == 1) { - $param .= "&search_category_customer_operator=".urlencode($searchCategoryCustomerOperator); + $param .= "&search_category_customer_operator=".urlencode((string) ($searchCategoryCustomerOperator)); } if ($searchCategorySupplierOperator == 1) { - $param .= "&search_category_supplier_operator=".urlencode($searchCategorySupplierOperator); + $param .= "&search_category_supplier_operator=".urlencode((string) ($searchCategorySupplierOperator)); } foreach ($searchCategoryCustomerList as $searchCategoryCustomer) { $param .= "&search_category_customer_list[]=".urlencode($searchCategoryCustomer); @@ -915,7 +915,7 @@ foreach ($searchCategorySupplierList as $searchCategorySupplier) { $param .= "&search_category_supplier_list[]=".urlencode($searchCategorySupplier); } if ($search_sale > 0) { - $param .= '&search_sale='.urlencode($search_sale); + $param .= '&search_sale='.urlencode((string) ($search_sale)); } if ($search_id > 0) { $param .= "&search_id=".urlencode($search_id); @@ -999,13 +999,13 @@ if ($search_price_level != '') { $param .= '&search_price_level='.urlencode($search_price_level); } if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) { - $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty); + $param .= '&search_type_thirdparty='.urlencode((string) ($search_type_thirdparty)); } if ($search_type != '') { $param .= '&search_type='.urlencode($search_type); } if ($search_status != '') { - $param .= '&search_status='.urlencode($search_status); + $param .= '&search_status='.urlencode((string) ($search_status)); } if (is_array($search_level) && count($search_level)) { foreach ($search_level as $slevel) { @@ -1027,49 +1027,49 @@ if ($type != '') { $param .= '&type='.urlencode($type); } if ($search_date_creation_startmonth) { - $param .= '&search_date_creation_startmonth='.urlencode($search_date_creation_startmonth); + $param .= '&search_date_creation_startmonth='.urlencode((string) ($search_date_creation_startmonth)); } if ($search_date_creation_startyear) { - $param .= '&search_date_creation_startyear='.urlencode($search_date_creation_startyear); + $param .= '&search_date_creation_startyear='.urlencode((string) ($search_date_creation_startyear)); } if ($search_date_creation_startday) { - $param .= '&search_date_creation_startday='.urlencode($search_date_creation_startday); + $param .= '&search_date_creation_startday='.urlencode((string) ($search_date_creation_startday)); } if ($search_date_creation_start) { $param .= '&search_date_creation_start='.urlencode($search_date_creation_start); } if ($search_date_creation_endmonth) { - $param .= '&search_date_creation_endmonth='.urlencode($search_date_creation_endmonth); + $param .= '&search_date_creation_endmonth='.urlencode((string) ($search_date_creation_endmonth)); } if ($search_date_creation_endyear) { - $param .= '&search_date_creation_endyear='.urlencode($search_date_creation_endyear); + $param .= '&search_date_creation_endyear='.urlencode((string) ($search_date_creation_endyear)); } if ($search_date_creation_endday) { - $param .= '&search_date_creation_endday='.urlencode($search_date_creation_endday); + $param .= '&search_date_creation_endday='.urlencode((string) ($search_date_creation_endday)); } if ($search_date_creation_end) { $param .= '&search_date_creation_end='.urlencode($search_date_creation_end); } if ($search_date_modif_startmonth) { - $param .= '&search_date_modif_startmonth='.urlencode($search_date_modif_startmonth); + $param .= '&search_date_modif_startmonth='.urlencode((string) ($search_date_modif_startmonth)); } if ($search_date_modif_startyear) { - $param .= '&search_date_modif_startyear='.urlencode($search_date_modif_startyear); + $param .= '&search_date_modif_startyear='.urlencode((string) ($search_date_modif_startyear)); } if ($search_date_modif_startday) { - $param .= '&search_date_modif_startday='.urlencode($search_date_modif_startday); + $param .= '&search_date_modif_startday='.urlencode((string) ($search_date_modif_startday)); } if ($search_date_modif_start) { $param .= '&search_date_modif_start='.urlencode($search_date_modif_start); } if ($search_date_modif_endmonth) { - $param .= '&search_date_modif_endmonth='.urlencode($search_date_modif_endmonth); + $param .= '&search_date_modif_endmonth='.urlencode((string) ($search_date_modif_endmonth)); } if ($search_date_modif_endyear) { - $param .= '&search_date_modif_endyear='.urlencode($search_date_modif_endyear); + $param .= '&search_date_modif_endyear='.urlencode((string) ($search_date_modif_endyear)); } if ($search_date_modif_endday) { - $param .= '&search_date_modif_endday='.urlencode($search_date_modif_endday); + $param .= '&search_date_modif_endday='.urlencode((string) ($search_date_modif_endday)); } if ($search_date_modif_end) { $param .= '&search_date_modif_end=' . urlencode($search_date_modif_end); From 68ab7bac14b3d607cf21fdaf4717c101e18b99da Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:54:07 +0100 Subject: [PATCH 165/709] Fix: Ensure string type for urlencode() --- htdocs/societe/messaging.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/messaging.php b/htdocs/societe/messaging.php index 01791b4a188..b1275bfcdfe 100644 --- a/htdocs/societe/messaging.php +++ b/htdocs/societe/messaging.php @@ -94,7 +94,7 @@ $result = restrictedArea($user, 'societe', $socid, '&societe'); * Actions */ -$parameters = array('id'=>$socid); +$parameters = array('id' => $socid); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -192,7 +192,7 @@ if (isModEnabled('agenda')) { if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { print '
'; - $param = '&socid='.urlencode($socid); + $param = '&socid='.urlencode((string) ($socid)); if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } From 6f7e11126b6e17d3976456f0ddf89a7d3d95c1b6 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:54:10 +0100 Subject: [PATCH 166/709] Fix: Ensure string type for urlencode() --- htdocs/societe/website.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/societe/website.php b/htdocs/societe/website.php index 1557332ec18..29484d9773d 100644 --- a/htdocs/societe/website.php +++ b/htdocs/societe/website.php @@ -108,7 +108,7 @@ $arrayfields = array(); foreach ($objectwebsiteaccount->fields as $key => $val) { // If $val['visible']==0, then we never show the field if (!empty($val['visible'])) { - $arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>$val['enabled']); + $arrayfields['t.'.$key] = array('label' => $val['label'], 'checked' => (($val['visible'] < 0) ? 0 : 1), 'enabled' => $val['enabled']); } } @@ -134,7 +134,7 @@ $result = restrictedArea($user, 'societe', $object->id, '&societe'); * Actions */ -$parameters = array('id'=>$id); +$parameters = array('id' => $id); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -192,7 +192,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($id > 0) { - $param .= '&id='.urlencode($id); + $param .= '&id='.urlencode((string) ($id)); } if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.((int) $limit); @@ -454,7 +454,7 @@ foreach ($objectwebsiteaccount->fields as $key => $val) { // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook -$parameters = array('arrayfields'=>$arrayfields); +$parameters = array('arrayfields' => $arrayfields); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column @@ -499,7 +499,7 @@ foreach ($objectwebsiteaccount->fields as $key => $val) { // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields -$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); +$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column @@ -600,7 +600,7 @@ while ($i < min($num, $limit)) { // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $parameters = array('arrayfields' => $arrayfields, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column @@ -641,7 +641,7 @@ if ($num == 0) { $db->free($resql); -$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); +$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql); $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; From 14843e808aac414541759cb7fd3047497340f6ac Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:54:13 +0100 Subject: [PATCH 167/709] Fix: Ensure string type for urlencode() --- htdocs/supplier_proposal/list.php | 102 +++++++++++++++--------------- 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index b2934afcb1a..c34a60b581b 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -158,10 +158,10 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen // List of fields to search into when doing a "search in all" $fieldstosearchall = array( - 'sp.ref'=>'Ref', - 's.nom'=>'Supplier', - 'pd.description'=>'Description', - 'sp.note_public'=>'NotePublic', + 'sp.ref' => 'Ref', + 's.nom' => 'Supplier', + 'pd.description' => 'Description', + 'sp.note_public' => 'NotePublic', ); if (empty($user->socid)) { $fieldstosearchall["p.note_private"] = "NotePrivate"; @@ -169,28 +169,28 @@ if (empty($user->socid)) { $checkedtypetiers = 0; $arrayfields = array( - 'sp.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), - 's.nom'=>array('label'=>$langs->trans("Supplier"), 'checked'=>1), - 's.name_alias'=>array('label'=>"AliasNameShort", 'checked'=>0), - 's.town'=>array('label'=>$langs->trans("Town"), 'checked'=>1), - 's.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>1), - 'state.nom'=>array('label'=>$langs->trans("StateShort"), 'checked'=>0), - 'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0), - 'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>$checkedtypetiers), - 'sp.date_valid'=>array('label'=>$langs->trans("DateValidation"), 'checked'=>1), - 'sp.date_livraison'=>array('label'=>$langs->trans("DateEnd"), 'checked'=>1), - 'sp.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1), - 'sp.total_tva'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0), - 'sp.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>0), - 'sp.multicurrency_code'=>array('label'=>'Currency', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1)), - 'sp.multicurrency_tx'=>array('label'=>'CurrencyRate', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1)), - 'sp.multicurrency_total_ht'=>array('label'=>'MulticurrencyAmountHT', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1)), - 'sp.multicurrency_total_vat'=>array('label'=>'MulticurrencyAmountVAT', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1)), - 'sp.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1)), - 'u.login'=>array('label'=>$langs->trans("Author"), 'checked'=>1, 'position'=>10), - 'sp.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), - 'sp.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), - 'sp.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), + 'sp.ref' => array('label' => $langs->trans("Ref"), 'checked' => 1), + 's.nom' => array('label' => $langs->trans("Supplier"), 'checked' => 1), + 's.name_alias' => array('label' => "AliasNameShort", 'checked' => 0), + 's.town' => array('label' => $langs->trans("Town"), 'checked' => 1), + 's.zip' => array('label' => $langs->trans("Zip"), 'checked' => 1), + 'state.nom' => array('label' => $langs->trans("StateShort"), 'checked' => 0), + 'country.code_iso' => array('label' => $langs->trans("Country"), 'checked' => 0), + 'typent.code' => array('label' => $langs->trans("ThirdPartyType"), 'checked' => $checkedtypetiers), + 'sp.date_valid' => array('label' => $langs->trans("DateValidation"), 'checked' => 1), + 'sp.date_livraison' => array('label' => $langs->trans("DateEnd"), 'checked' => 1), + 'sp.total_ht' => array('label' => $langs->trans("AmountHT"), 'checked' => 1), + 'sp.total_tva' => array('label' => $langs->trans("AmountVAT"), 'checked' => 0), + 'sp.total_ttc' => array('label' => $langs->trans("AmountTTC"), 'checked' => 0), + 'sp.multicurrency_code' => array('label' => 'Currency', 'checked' => 0, 'enabled' => (!isModEnabled("multicurrency") ? 0 : 1)), + 'sp.multicurrency_tx' => array('label' => 'CurrencyRate', 'checked' => 0, 'enabled' => (!isModEnabled("multicurrency") ? 0 : 1)), + 'sp.multicurrency_total_ht' => array('label' => 'MulticurrencyAmountHT', 'checked' => 0, 'enabled' => (!isModEnabled("multicurrency") ? 0 : 1)), + 'sp.multicurrency_total_vat' => array('label' => 'MulticurrencyAmountVAT', 'checked' => 0, 'enabled' => (!isModEnabled("multicurrency") ? 0 : 1)), + 'sp.multicurrency_total_ttc' => array('label' => 'MulticurrencyAmountTTC', 'checked' => 0, 'enabled' => (!isModEnabled("multicurrency") ? 0 : 1)), + 'u.login' => array('label' => $langs->trans("Author"), 'checked' => 1, 'position' => 10), + 'sp.datec' => array('label' => $langs->trans("DateCreation"), 'checked' => 0, 'position' => 500), + 'sp.tms' => array('label' => $langs->trans("DateModificationShort"), 'checked' => 0, 'position' => 500), + 'sp.fk_statut' => array('label' => $langs->trans("Status"), 'checked' => 1, 'position' => 1000), ); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; @@ -220,7 +220,7 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa $massaction = ''; } -$parameters = array('socid'=>$socid); +$parameters = array('socid' => $socid); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -533,40 +533,40 @@ if ($resql) { $param .= '&sall='.urlencode($sall); } if ($search_date_startday) { - $param .= '&search_date_startday='.urlencode($search_date_startday); + $param .= '&search_date_startday='.urlencode((string) ($search_date_startday)); } if ($search_date_startmonth) { - $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); + $param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth)); } if ($search_date_startyear) { - $param .= '&search_date_startyear='.urlencode($search_date_startyear); + $param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear)); } if ($search_date_endday) { - $param .= '&search_date_endday='.urlencode($search_date_endday); + $param .= '&search_date_endday='.urlencode((string) ($search_date_endday)); } if ($search_date_endmonth) { - $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + $param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth)); } if ($search_date_endyear) { - $param .= '&search_date_endyear='.urlencode($search_date_endyear); + $param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear)); } if ($search_date_valid_startday) { - $param .= '&search_date_valid_startday='.urlencode($search_date_valid_startday); + $param .= '&search_date_valid_startday='.urlencode((string) ($search_date_valid_startday)); } if ($search_date_valid_startmonth) { - $param .= '&search_date_valid_startmonth='.urlencode($search_date_valid_startmonth); + $param .= '&search_date_valid_startmonth='.urlencode((string) ($search_date_valid_startmonth)); } if ($search_date_valid_startyear) { - $param .= '&search_date_valid_startyear='.urlencode($search_date_valid_startyear); + $param .= '&search_date_valid_startyear='.urlencode((string) ($search_date_valid_startyear)); } if ($search_date_valid_endday) { - $param .= '&search_date_valid_endday='.urlencode($search_date_valid_endday); + $param .= '&search_date_valid_endday='.urlencode((string) ($search_date_valid_endday)); } if ($search_date_valid_endmonth) { - $param .= '&search_date_valid_endmonth='.urlencode($search_date_valid_endmonth); + $param .= '&search_date_valid_endmonth='.urlencode((string) ($search_date_valid_endmonth)); } if ($search_date_valid_endyear) { - $param .= '&search_date_valid_endyear='.urlencode($search_date_valid_endyear); + $param .= '&search_date_valid_endyear='.urlencode((string) ($search_date_valid_endyear)); } if ($search_ref) { $param .= '&search_ref='.urlencode($search_ref); @@ -578,7 +578,7 @@ if ($resql) { $param .= '&search_societe_alias='.urlencode($search_societe_alias); } if ($search_user > 0) { - $param .= '&search_user='.urlencode($search_user); + $param .= '&search_user='.urlencode((string) ($search_user)); } if ($search_sale > 0) { $param .= '&search_sale='.urlencode($search_sale); @@ -611,7 +611,7 @@ if ($resql) { $param .= '&search_zip='.urlencode($search_zip); } if ($socid > 0) { - $param .= '&socid='.urlencode($socid); + $param .= '&socid='.urlencode((string) ($socid)); } if ($search_status != '') { $param .= '&search_status='.urlencode($search_status); @@ -620,15 +620,15 @@ if ($resql) { $param .= '&optioncss='.urlencode($optioncss); } if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) { - $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty); + $param .= '&search_type_thirdparty='.urlencode((string) ($search_type_thirdparty)); } // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; // List of mass actions available $arrayofmassactions = array( - 'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"), - 'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), + 'generate_doc' => img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"), + 'builddoc' => img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), ); if ($user->hasRight('supplier_proposal', 'supprimer')) { @@ -644,8 +644,8 @@ if ($resql) { $url .= '&socid='.$socid; } $newcardbutton = ''; - $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); - $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss' => 'reposition')); + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss' => 'reposition')); $newcardbutton .= dolGetButtonTitleSeparator(); $newcardbutton .= dolGetButtonTitle($langs->trans('NewAskPrice'), '', 'fa fa-plus-circle', $url, '', $user->hasRight('supplier_proposal', 'creer')); @@ -854,7 +854,7 @@ if ($resql) { // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook - $parameters = array('arrayfields'=>$arrayfields); + $parameters = array('arrayfields' => $arrayfields); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation @@ -971,7 +971,7 @@ if ($resql) { // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields - $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); + $parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (!empty($arrayfields['sp.datec']['checked'])) { @@ -1031,7 +1031,7 @@ if ($resql) { // TODO Use a cache on user $userstatic->fetch($obj->fk_user_author); $objectstatic->delivery_date = $obj->dp; - print $objectstatic->getKanbanView('', array('thirdparty'=>$companystatic, 'userauthor'=>$userstatic, 'selected' => in_array($obj->id, $arrayofselected))); + print $objectstatic->getKanbanView('', array('thirdparty' => $companystatic, 'userauthor' => $userstatic, 'selected' => in_array($obj->id, $arrayofselected))); if ($i == ($imaxinloop - 1)) { print ''; print '
'; From ed507b7df2d5974334b559ffb27be22a21487919 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:54:34 +0100 Subject: [PATCH 175/709] Fix: Ensure string type for urlencode() --- htdocs/variants/combinations.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index e34cf104d40..905e915dfbb 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -117,7 +117,7 @@ if ($action == 'create' && GETPOST('selectvariant', 'alpha')) { // We click on s $action = 'add'; $attribute_id = GETPOSTINT('attribute'); $attribute_value_id = GETPOSTINT('value'); - if ($attribute_id> 0 && $attribute_value_id > 0) { + if ($attribute_id > 0 && $attribute_value_id > 0) { $feature = $attribute_id . '-' . $attribute_value_id; $selectedvariant[$feature] = $feature; $_SESSION['addvariant_'.$object->id] = $selectedvariant; @@ -792,11 +792,11 @@ if (!empty($id) || !empty($ref)) { $prodstatic->fetch($prodcomb->fk_product_child); print $form->formconfirm( - "combinations.php?id=".urlencode($id)."&valueid=".urlencode($valueid), + "combinations.php?id=".urlencode((string) ($id))."&valueid=".urlencode((string) ($valueid)), $langs->trans('Delete'), $langs->trans('ProductCombinationDeleteDialog', $prodstatic->ref), "confirm_deletecombination", - array(array('label'=> $langs->trans('DeleteLinkedProduct'), 'type'=> 'checkbox', 'name' => 'delete_product', 'value' => false)), + array(array('label' => $langs->trans('DeleteLinkedProduct'), 'type' => 'checkbox', 'name' => 'delete_product', 'value' => false)), 0, 1 ); From 7d84a5ecf31bbba1c632b47c96a874557e6fd858 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 02:54:37 +0100 Subject: [PATCH 176/709] Fix: Ensure string type for urlencode() --- htdocs/workstation/workstation_agenda.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/workstation/workstation_agenda.php b/htdocs/workstation/workstation_agenda.php index cf25d186ae8..4e6853596bc 100644 --- a/htdocs/workstation/workstation_agenda.php +++ b/htdocs/workstation/workstation_agenda.php @@ -100,7 +100,7 @@ restrictedArea($user, $object->element, $object->id, $object->table_element, 'wo * Actions */ -$parameters = array('id'=>$id); +$parameters = array('id' => $id); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -206,14 +206,14 @@ if ($object->id > 0) { $objthirdparty = $object; $objcon = new stdClass(); - $out = '&origin='.urlencode($object->element.'@'.$object->module).'&originid='.urlencode($object->id); + $out = '&origin='.urlencode((string) ($object->element.'@'.$object->module)).'&originid='.urlencode((string) ($object->id)); $urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id; $out .= '&backtopage='.urlencode($urlbacktopage); $permok = $user->hasRight('agenda', 'myactions', 'create'); if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) { //$out.=' Date: Fri, 8 Mar 2024 02:55:38 +0100 Subject: [PATCH 177/709] Fix: Ensure string type for urlencode() --- htdocs/commande/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 003fdda6d09..b8009477a39 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -655,7 +655,7 @@ if (empty($reshook)) { $param .= '&search_user='.urlencode((string) ($search_user)); } if ($search_sale > 0) { - $param .= '&search_sale='.urlencode($search_sale); + $param .= '&search_sale='.urlencode((string) ($search_sale)); } if ($search_total_ht != '') { $param .= '&search_total_ht='.urlencode($search_total_ht); @@ -1245,7 +1245,7 @@ if ($search_user > 0) { $param .= '&search_user='.urlencode((string) ($search_user)); } if ($search_sale > 0) { - $param .= '&search_sale='.urlencode($search_sale); + $param .= '&search_sale='.urlencode((string) ($search_sale)); } if ($search_total_ht != '') { $param .= '&search_total_ht='.urlencode($search_total_ht); From 4fa993fe8a2355fcf4a53790e38cf883af5cc704 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 8 Mar 2024 23:22:15 +0100 Subject: [PATCH 178/709] Fix: Ensure string type for urlencode() --- htdocs/comm/propal/list.php | 2812 ++++++++++++++++++----------------- 1 file changed, 1407 insertions(+), 1405 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 2bc33b37f3f..5e8b4f60de1 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -77,7 +77,9 @@ $mode = GETPOST('mode', 'alpha'); // Search Fields $search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); $search_user = GETPOSTINT('search_user'); -if ($search_user==-1) $search_user=0; +if ($search_user == -1) { + $search_user = 0; +} $search_sale = GETPOSTINT('search_sale'); $search_ref = GETPOST('sf_ref') ? GETPOST('sf_ref', 'alpha') : GETPOST('search_ref', 'alpha'); $search_refcustomer = GETPOST('search_refcustomer', 'alpha'); @@ -190,14 +192,14 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen // List of fields to search into when doing a "search in all" $fieldstosearchall = array( - 'p.ref'=>'Ref', - 'p.ref_client'=>'RefCustomer', - 'pd.description'=>'Description', - 's.nom'=>"ThirdParty", - 's.name_alias'=>"AliasNameShort", - 's.zip'=>"Zip", - 's.town'=>"Town", - 'p.note_public'=>'NotePublic', + 'p.ref' => 'Ref', + 'p.ref_client' => 'RefCustomer', + 'pd.description' => 'Description', + 's.nom' => "ThirdParty", + 's.name_alias' => "AliasNameShort", + 's.zip' => "Zip", + 's.town' => "Town", + 'p.note_public' => 'NotePublic', ); if (empty($user->socid)) { $fieldstosearchall["p.note_private"] = "NotePrivate"; @@ -206,50 +208,50 @@ if (empty($user->socid)) { $checkedtypetiers = 0; $arrayfields = array( - 'p.ref'=>array('label'=>"Ref", 'checked'=>1), - 'p.ref_client'=>array('label'=>"RefCustomer", 'checked'=>-1), - 'pr.ref'=>array('label'=>"ProjectRef", 'checked'=>1, 'enabled'=>(isModEnabled('project') ? 1 : 0)), - 'pr.title'=>array('label'=>"ProjectLabel", 'checked'=>0, 'enabled'=>(isModEnabled('project') ? 1 : 0)), - 's.nom'=>array('label'=>"ThirdParty", 'checked'=>1), - 's.name_alias'=>array('label'=>"AliasNameShort", 'checked'=>-1), - 's.town'=>array('label'=>"Town", 'checked'=>-1), - 's.zip'=>array('label'=>"Zip", 'checked'=>-1), - 'state.nom'=>array('label'=>"StateShort", 'checked'=>0), - 'country.code_iso'=>array('label'=>"Country", 'checked'=>0), - 'typent.code'=>array('label'=>"ThirdPartyType", 'checked'=>$checkedtypetiers), - 'p.date'=>array('label'=>"DatePropal", 'checked'=>1), - 'p.fin_validite'=>array('label'=>"DateEnd", 'checked'=>1), - 'p.date_livraison'=>array('label'=>"DeliveryDate", 'checked'=>0), - 'p.date_signature'=>array('label'=>"DateSigning", 'checked'=>0), - 'ava.rowid'=>array('label'=>"AvailabilityPeriod", 'checked'=>0), - 'p.fk_shipping_method'=>array('label'=>"SendingMethod", 'checked'=>0, 'enabled'=>isModEnabled("delivery_note")), - 'p.fk_input_reason'=>array('label'=>"Origin", 'checked'=>0, 'enabled'=>1), - 'p.fk_cond_reglement'=>array('label'=>"PaymentConditionsShort", 'checked'=>0), - 'p.fk_mode_reglement'=>array('label'=>"PaymentMode", 'checked'=>0), - 'p.total_ht'=>array('label'=>"AmountHT", 'checked'=>1), - 'p.total_tva'=>array('label'=>"AmountVAT", 'checked'=>0), - 'p.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0), - 'p.total_ht_invoiced'=>array('label'=>"AmountInvoicedHT", 'checked'=>0, 'enabled'=>getDolGlobalString('PROPOSAL_SHOW_INVOICED_AMOUNT')), - 'p.total_invoiced'=>array('label'=>"AmountInvoicedTTC", 'checked'=>0, 'enabled'=>getDolGlobalString('PROPOSAL_SHOW_INVOICED_AMOUNT')), - 'p.multicurrency_code'=>array('label'=>'Currency', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1)), - 'p.multicurrency_tx'=>array('label'=>'CurrencyRate', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1)), - 'p.multicurrency_total_ht'=>array('label'=>'MulticurrencyAmountHT', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1)), - 'p.multicurrency_total_tva'=>array('label'=>'MulticurrencyAmountVAT', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1)), - 'p.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1)), - 'p.multicurrency_total_ht_invoiced'=>array('label'=>'MulticurrencyAmountInvoicedHT', 'checked'=>0, 'enabled'=>isModEnabled("multicurrency") && getDolGlobalString('PROPOSAL_SHOW_INVOICED_AMOUNT')), - 'p.multicurrency_total_invoiced'=>array('label'=>'MulticurrencyAmountInvoicedTTC', 'checked'=>0, 'enabled'=>isModEnabled("multicurrency") && getDolGlobalString('PROPOSAL_SHOW_INVOICED_AMOUNT')), - 'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>10), - 'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>-1), + 'p.ref' => array('label' => "Ref", 'checked' => 1), + 'p.ref_client' => array('label' => "RefCustomer", 'checked' => -1), + 'pr.ref' => array('label' => "ProjectRef", 'checked' => 1, 'enabled' => (isModEnabled('project') ? 1 : 0)), + 'pr.title' => array('label' => "ProjectLabel", 'checked' => 0, 'enabled' => (isModEnabled('project') ? 1 : 0)), + 's.nom' => array('label' => "ThirdParty", 'checked' => 1), + 's.name_alias' => array('label' => "AliasNameShort", 'checked' => -1), + 's.town' => array('label' => "Town", 'checked' => -1), + 's.zip' => array('label' => "Zip", 'checked' => -1), + 'state.nom' => array('label' => "StateShort", 'checked' => 0), + 'country.code_iso' => array('label' => "Country", 'checked' => 0), + 'typent.code' => array('label' => "ThirdPartyType", 'checked' => $checkedtypetiers), + 'p.date' => array('label' => "DatePropal", 'checked' => 1), + 'p.fin_validite' => array('label' => "DateEnd", 'checked' => 1), + 'p.date_livraison' => array('label' => "DeliveryDate", 'checked' => 0), + 'p.date_signature' => array('label' => "DateSigning", 'checked' => 0), + 'ava.rowid' => array('label' => "AvailabilityPeriod", 'checked' => 0), + 'p.fk_shipping_method' => array('label' => "SendingMethod", 'checked' => 0, 'enabled' => isModEnabled("delivery_note")), + 'p.fk_input_reason' => array('label' => "Origin", 'checked' => 0, 'enabled' => 1), + 'p.fk_cond_reglement' => array('label' => "PaymentConditionsShort", 'checked' => 0), + 'p.fk_mode_reglement' => array('label' => "PaymentMode", 'checked' => 0), + 'p.total_ht' => array('label' => "AmountHT", 'checked' => 1), + 'p.total_tva' => array('label' => "AmountVAT", 'checked' => 0), + 'p.total_ttc' => array('label' => "AmountTTC", 'checked' => 0), + 'p.total_ht_invoiced' => array('label' => "AmountInvoicedHT", 'checked' => 0, 'enabled' => getDolGlobalString('PROPOSAL_SHOW_INVOICED_AMOUNT')), + 'p.total_invoiced' => array('label' => "AmountInvoicedTTC", 'checked' => 0, 'enabled' => getDolGlobalString('PROPOSAL_SHOW_INVOICED_AMOUNT')), + 'p.multicurrency_code' => array('label' => 'Currency', 'checked' => 0, 'enabled' => (!isModEnabled("multicurrency") ? 0 : 1)), + 'p.multicurrency_tx' => array('label' => 'CurrencyRate', 'checked' => 0, 'enabled' => (!isModEnabled("multicurrency") ? 0 : 1)), + 'p.multicurrency_total_ht' => array('label' => 'MulticurrencyAmountHT', 'checked' => 0, 'enabled' => (!isModEnabled("multicurrency") ? 0 : 1)), + 'p.multicurrency_total_tva' => array('label' => 'MulticurrencyAmountVAT', 'checked' => 0, 'enabled' => (!isModEnabled("multicurrency") ? 0 : 1)), + 'p.multicurrency_total_ttc' => array('label' => 'MulticurrencyAmountTTC', 'checked' => 0, 'enabled' => (!isModEnabled("multicurrency") ? 0 : 1)), + 'p.multicurrency_total_ht_invoiced' => array('label' => 'MulticurrencyAmountInvoicedHT', 'checked' => 0, 'enabled' => isModEnabled("multicurrency") && getDolGlobalString('PROPOSAL_SHOW_INVOICED_AMOUNT')), + 'p.multicurrency_total_invoiced' => array('label' => 'MulticurrencyAmountInvoicedTTC', 'checked' => 0, 'enabled' => isModEnabled("multicurrency") && getDolGlobalString('PROPOSAL_SHOW_INVOICED_AMOUNT')), + 'u.login' => array('label' => "Author", 'checked' => 1, 'position' => 10), + 'sale_representative' => array('label' => "SaleRepresentativesOfThirdParty", 'checked' => -1), 'total_pa' => array('label' => (getDolGlobalString('MARGIN_TYPE') == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (!isModEnabled('margin') || !$user->hasRight('margins', 'liretous') ? 0 : 1)), 'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (!isModEnabled('margin') || !$user->hasRight('margins', 'liretous') ? 0 : 1)), 'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (!isModEnabled('margin') || !$user->hasRight('margins', 'liretous') || !getDolGlobalString('DISPLAY_MARGIN_RATES') ? 0 : 1)), 'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (!isModEnabled('margin') || !$user->hasRight('margins', 'liretous') || !getDolGlobalString('DISPLAY_MARK_RATES') ? 0 : 1)), - 'p.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500), - 'p.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500), - 'p.date_cloture'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>500), - 'p.note_public'=>array('label'=>'NotePublic', 'checked'=>0, 'position'=>510, 'enabled'=>(!getDolGlobalInt('MAIN_LIST_HIDE_PUBLIC_NOTES'))), - 'p.note_private'=>array('label'=>'NotePrivate', 'checked'=>0, 'position'=>511, 'enabled'=>(!getDolGlobalInt('MAIN_LIST_HIDE_PRIVATE_NOTES'))), - 'p.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000), + 'p.datec' => array('label' => "DateCreation", 'checked' => 0, 'position' => 500), + 'p.tms' => array('label' => "DateModificationShort", 'checked' => 0, 'position' => 500), + 'p.date_cloture' => array('label' => "DateClosing", 'checked' => 0, 'position' => 500), + 'p.note_public' => array('label' => 'NotePublic', 'checked' => 0, 'position' => 510, 'enabled' => (!getDolGlobalInt('MAIN_LIST_HIDE_PUBLIC_NOTES'))), + 'p.note_private' => array('label' => 'NotePrivate', 'checked' => 0, 'position' => 511, 'enabled' => (!getDolGlobalInt('MAIN_LIST_HIDE_PRIVATE_NOTES'))), + 'p.fk_statut' => array('label' => "Status", 'checked' => 1, 'position' => 1000), ); // List of fields to search into when doing a "search in all" @@ -310,7 +312,7 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa $massaction = ''; } -$parameters = array('socid'=>$socid, 'arrayfields'=>&$arrayfields); +$parameters = array('socid' => $socid, 'arrayfields' => &$arrayfields); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -843,8 +845,8 @@ if (!$resql) { exit; } - $objectstatic = new Propal($db); - $userstatic = new User($db); +$objectstatic = new Propal($db); +$userstatic = new User($db); if ($socid > 0) { $soc = new Societe($db); @@ -857,9 +859,9 @@ if ($socid > 0) { $title = $langs->trans('Proposals'); } - $num = $db->num_rows($resql); +$num = $db->num_rows($resql); - $arrayofselected = is_array($toselect) ? $toselect : array(); +$arrayofselected = is_array($toselect) ? $toselect : array(); if ($num == 1 && getDolGlobalString('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) { $obj = $db->fetch_object($resql); @@ -870,10 +872,10 @@ if ($num == 1 && getDolGlobalString('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $s exit; } - $help_url = 'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos'; - llxHeader('', $title, $help_url); +$help_url = 'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos'; +llxHeader('', $title, $help_url); - $param = '&search_status='.urlencode($search_status); +$param = '&search_status='.urlencode($search_status); if (!empty($mode)) { $param .= '&mode='.urlencode($mode); } @@ -887,58 +889,58 @@ if ($search_all) { $param .= '&search_all='.urlencode($search_all); } if ($search_date_startday) { - $param .= '&search_date_startday='.urlencode($search_date_startday); + $param .= '&search_date_startday='.urlencode((string) ($search_date_startday)); } if ($search_date_startmonth) { - $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); + $param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth)); } if ($search_date_startyear) { - $param .= '&search_date_startyear='.urlencode($search_date_startyear); + $param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear)); } if ($search_date_endday) { - $param .= '&search_date_endday='.urlencode($search_date_endday); + $param .= '&search_date_endday='.urlencode((string) ($search_date_endday)); } if ($search_date_endmonth) { - $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + $param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth)); } if ($search_date_endyear) { - $param .= '&search_date_endyear='.urlencode($search_date_endyear); + $param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear)); } if ($search_date_end_startday) { - $param .= '&search_date_end_startday='.urlencode($search_date_end_startday); + $param .= '&search_date_end_startday='.urlencode((string) ($search_date_end_startday)); } if ($search_date_end_startmonth) { - $param .= '&search_date_end_startmonth='.urlencode($search_date_end_startmonth); + $param .= '&search_date_end_startmonth='.urlencode((string) ($search_date_end_startmonth)); } if ($search_date_end_startyear) { - $param .= '&search_date_end_startyear='.urlencode($search_date_end_startyear); + $param .= '&search_date_end_startyear='.urlencode((string) ($search_date_end_startyear)); } if ($search_date_end_endday) { - $param .= '&search_date_end_endday='.urlencode($search_date_end_endday); + $param .= '&search_date_end_endday='.urlencode((string) ($search_date_end_endday)); } if ($search_date_end_endmonth) { - $param .= '&search_date_end_endmonth='.urlencode($search_date_end_endmonth); + $param .= '&search_date_end_endmonth='.urlencode((string) ($search_date_end_endmonth)); } if ($search_date_end_endyear) { - $param .= '&search_date_end_endyear='.urlencode($search_date_end_endyear); + $param .= '&search_date_end_endyear='.urlencode((string) ($search_date_end_endyear)); } if ($search_date_delivery_startday) { - $param .= '&search_date_delivery_startday='.urlencode($search_date_delivery_startday); + $param .= '&search_date_delivery_startday='.urlencode((string) ($search_date_delivery_startday)); } if ($search_date_delivery_startmonth) { - $param .= '&search_date_delivery_startmonth='.urlencode($search_date_delivery_startmonth); + $param .= '&search_date_delivery_startmonth='.urlencode((string) ($search_date_delivery_startmonth)); } if ($search_date_delivery_startyear) { - $param .= '&search_date_delivery_startyear='.urlencode($search_date_delivery_startyear); + $param .= '&search_date_delivery_startyear='.urlencode((string) ($search_date_delivery_startyear)); } if ($search_date_delivery_endday) { - $param .= '&search_date_delivery_endday='.urlencode($search_date_delivery_endday); + $param .= '&search_date_delivery_endday='.urlencode((string) ($search_date_delivery_endday)); } if ($search_date_delivery_endmonth) { - $param .= '&search_date_delivery_endmonth='.urlencode($search_date_delivery_endmonth); + $param .= '&search_date_delivery_endmonth='.urlencode((string) ($search_date_delivery_endmonth)); } if ($search_date_delivery_endyear) { - $param .= '&search_date_delivery_endyear='.urlencode($search_date_delivery_endyear); + $param .= '&search_date_delivery_endyear='.urlencode((string) ($search_date_delivery_endyear)); } if ($search_ref) { $param .= '&search_ref='.urlencode($search_ref); @@ -956,7 +958,7 @@ if ($search_societe_alias) { $param .= '&search_societe_alias='.urlencode($search_societe_alias); } if ($search_user > 0) { - $param .= '&search_user='.urlencode($search_user); + $param .= '&search_user='.urlencode((string) ($search_user)); } if ($search_sale > 0) { $param .= '&search_sale='.urlencode($search_sale); @@ -989,31 +991,31 @@ if ($search_zip) { $param .= '&search_zip='.urlencode($search_zip); } if ($socid > 0) { - $param .= '&socid='.urlencode($socid); + $param .= '&socid='.urlencode((string) ($socid)); } if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); } if ($search_categ_cus > 0) { - $param .= '&search_categ_cus='.urlencode($search_categ_cus); + $param .= '&search_categ_cus='.urlencode((string) ($search_categ_cus)); } if ($search_product_category != '') { - $param .= '&search_product_category='.urlencode($search_product_category); + $param .= '&search_product_category='.urlencode((string) ($search_product_category)); } if ($search_fk_cond_reglement > 0) { - $param .= '&search_fk_cond_reglement='.urlencode($search_fk_cond_reglement); + $param .= '&search_fk_cond_reglement='.urlencode((string) ($search_fk_cond_reglement)); } if ($search_fk_shipping_method > 0) { - $param .= '&search_fk_shipping_method='.urlencode($search_fk_shipping_method); + $param .= '&search_fk_shipping_method='.urlencode((string) ($search_fk_shipping_method)); } if ($search_fk_input_reason > 0) { - $param .= '&search_fk_input_reason='.urlencode($search_fk_input_reason); + $param .= '&search_fk_input_reason='.urlencode((string) ($search_fk_input_reason)); } if ($search_fk_mode_reglement > 0) { - $param .= '&search_fk_mode_reglement='.urlencode($search_fk_mode_reglement); + $param .= '&search_fk_mode_reglement='.urlencode((string) ($search_fk_mode_reglement)); } if ($search_type_thirdparty > 0) { - $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty); + $param .= '&search_type_thirdparty='.urlencode((string) ($search_type_thirdparty)); } if ($search_town) { $param .= '&search_town='.urlencode($search_town); @@ -1028,1383 +1030,1383 @@ if ($search_town) { $param .= '&search_town='.urlencode($search_town); } if ($search_country) { - $param .= '&search_country='.urlencode($search_country); + $param .= '&search_country='.urlencode((string) ($search_country)); } if ($search_date_signature_startday) { - $param .= '&search_date_signature_startday='.urlencode($search_date_signature_startday); + $param .= '&search_date_signature_startday='.urlencode((string) ($search_date_signature_startday)); } if ($search_date_signature_startmonth) { - $param .= '&search_date_signature_startmonth='.urlencode($search_date_signature_startmonth); + $param .= '&search_date_signature_startmonth='.urlencode((string) ($search_date_signature_startmonth)); } if ($search_date_signature_startyear) { - $param .= '&search_date_signature_startyear='.urlencode($search_date_signature_startyear); + $param .= '&search_date_signature_startyear='.urlencode((string) ($search_date_signature_startyear)); } if ($search_date_signature_endday) { - $param .= '&search_date_signature_endday='.urlencode($search_date_signature_endday); + $param .= '&search_date_signature_endday='.urlencode((string) ($search_date_signature_endday)); } if ($search_date_signature_endmonth) { - $param .= '&search_date_signature_endmonth='.urlencode($search_date_signature_endmonth); + $param .= '&search_date_signature_endmonth='.urlencode((string) ($search_date_signature_endmonth)); } if ($search_date_signature_endyear) { - $param .= '&search_date_signature_endyear='.urlencode($search_date_signature_endyear); + $param .= '&search_date_signature_endyear='.urlencode((string) ($search_date_signature_endyear)); } - // Add $param from extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; - // Add $param from hooks - $parameters = array(); - $reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - $param .= $hookmanager->resPrint; +// Add $param from extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; +// Add $param from hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook +$param .= $hookmanager->resPrint; - // List of mass actions available - $arrayofmassactions = array( - 'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"), - 'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), - ); - if ($permissiontosendbymail) { - $arrayofmassactions['presend']=img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"); +// List of mass actions available +$arrayofmassactions = array( + 'generate_doc' => img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"), + 'builddoc' => img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), +); +if ($permissiontosendbymail) { + $arrayofmassactions['presend'] = img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"); +} +if ($permissiontovalidate) { + $arrayofmassactions['prevalidate'] = img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"); +} +if ($permissiontoclose) { + $arrayofmassactions['presign'] = img_picto('', 'propal', 'class="pictofixedwidth"').$langs->trans("Sign"); + $arrayofmassactions['nopresign'] = img_picto('', 'propal', 'class="pictofixedwidth"').$langs->trans("NoSign"); + $arrayofmassactions['setbilled'] = img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans("ClassifyBilled"); +} +if ($permissiontodelete) { + $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); +} + +if (in_array($massaction, array('presend', 'predelete', 'closed'))) { + $arrayofmassactions = array(); +} +$massactionbutton = $form->selectMassAction('', $arrayofmassactions); + +$url = DOL_URL_ROOT.'/comm/propal/card.php?action=create'; +if (!empty($socid)) { + $url .= '&socid='.$socid; +} +$newcardbutton = ''; +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss' => 'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss' => 'reposition')); +$newcardbutton .= dolGetButtonTitleSeparator(); +$newcardbutton .= dolGetButtonTitle($langs->trans('NewPropal'), '', 'fa fa-plus-circle', $url, '', $user->hasRight('propal', 'creer')); + +// Fields title search +print ''; +if ($optioncss != '') { + print ''; +} +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + +print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'propal', 0, $newcardbutton, '', $limit, 0, 0, 1); + +$topicmail = "SendPropalRef"; +$modelmail = "propal_send"; +$objecttmp = new Propal($db); +$trackid = 'pro'.$object->id; +include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; + +if ($massaction == 'prevalidate') { + print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassValidation"), $langs->trans("ConfirmMassValidationQuestion"), "validate", null, '', 0, 200, 500, 1); +} + +if ($massaction == 'presign') { + print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassSignature"), $langs->trans("ConfirmMassSignatureQuestion"), "sign", null, '', 0, 200, 500, 1); +} + +if ($massaction == 'nopresign') { + print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassNoSignature"), $langs->trans("ConfirmMassNoSignatureQuestion"), "nosign", null, '', 0, 200, 500, 1); +} + +if ($search_all) { + foreach ($fieldstosearchall as $key => $val) { + $fieldstosearchall[$key] = $langs->trans($val); } - if ($permissiontovalidate) { - $arrayofmassactions['prevalidate']=img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"); - } - if ($permissiontoclose) { - $arrayofmassactions['presign']=img_picto('', 'propal', 'class="pictofixedwidth"').$langs->trans("Sign"); - $arrayofmassactions['nopresign']=img_picto('', 'propal', 'class="pictofixedwidth"').$langs->trans("NoSign"); - $arrayofmassactions['setbilled'] =img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans("ClassifyBilled"); - } - if ($permissiontodelete) { - $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); + print '
'.$langs->trans("FilterOnInto", $search_all).implode(', ', $fieldstosearchall).'
'; +} + +$i = 0; + +$moreforfilter = ''; + +// If the user can view prospects other than his' +if ($user->hasRight('user', 'user', 'lire')) { + $langs->load("commercial"); + $moreforfilter .= '
'; + $tmptitle = $langs->trans('ThirdPartiesOfSaleRepresentative'); + $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, $tmptitle, 'maxwidth250 widthcentpercentminusx', 1); + $moreforfilter .= '
'; +} +// If the user can view prospects other than his' +if ($user->hasRight('user', 'user', 'lire')) { + $moreforfilter .= '
'; + $tmptitle = $langs->trans('LinkedToSpecificUsers'); + $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers((empty($search_user) ? -2 : 0), 'search_user', $tmptitle, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth250 widthcentpercentminusx'); + $moreforfilter .= '
'; +} +// If the user can view products +if (isModEnabled('category') && $user->hasRight('categorie', 'read') && ($user->hasRight('product', 'read') || $user->hasRight('service', 'read'))) { + $searchCategoryProductOperator = -1; + include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; + $tmptitle = $langs->trans('IncludingProductWithTag'); + $formcategory = new FormCategory($db); + $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PRODUCT, array($search_product_category), 'maxwidth300', $searchCategoryProductOperator, 0, 0, $tmptitle); +} +if (isModEnabled('category') && $user->hasRight('categorie', 'lire')) { + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; + $moreforfilter .= '
'; + $tmptitle = $langs->trans('CustomersProspectsCategoriesShort'); + $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1, $tmptitle, (empty($conf->dol_optimize_smallscreen) ? 'maxwidth300 widthcentpercentminusx' : 'maxwidth250 widthcentpercentminusx')); + $moreforfilter .= '
'; +} +if (isModEnabled('stock') && getDolGlobalString('WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL')) { + require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; + $formproduct = new FormProduct($db); + $moreforfilter .= '
'; + $tmptitle = $langs->trans('Warehouse'); + $moreforfilter .= img_picto($tmptitle, 'stock', 'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse, 'search_warehouse', '', $tmptitle, 0, 0, $tmptitle); + $moreforfilter .= '
'; +} +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook +if (empty($reshook)) { + $moreforfilter .= $hookmanager->resPrint; +} else { + $moreforfilter = $hookmanager->resPrint; +} + +if (!empty($moreforfilter)) { + print '
'; + print $moreforfilter; + print '
'; +} + +$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; +$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields +$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); + +print '
'; +print '
'."\n"; + +print ''; + +// Action column +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; +} + +if (!empty($arrayfields['p.ref']['checked'])) { + print ''; +} +if (!empty($arrayfields['p.ref_client']['checked'])) { + print ''; +} +if (!empty($arrayfields['pr.ref']['checked'])) { + print ''; +} +if (!empty($arrayfields['pr.title']['checked'])) { + print ''; +} +if (!empty($arrayfields['s.nom']['checked'])) { + print ''; +} +if (!empty($arrayfields['s.name_alias']['checked'])) { + print ''; +} +if (!empty($arrayfields['s.town']['checked'])) { + print ''; +} +if (!empty($arrayfields['s.zip']['checked'])) { + print ''; +} +// State +if (!empty($arrayfields['state.nom']['checked'])) { + print ''; +} +// Country +if (!empty($arrayfields['country.code_iso']['checked'])) { + print ''; +} +// Company type +if (!empty($arrayfields['typent.code']['checked'])) { + print ''; +} +// Date +if (!empty($arrayfields['p.date']['checked'])) { + print ''; +} +// Date end +if (!empty($arrayfields['p.fin_validite']['checked'])) { + print ''; +} +// Date delivery +if (!empty($arrayfields['p.date_livraison']['checked'])) { + print ''; +} +// Date Signature +if (!empty($arrayfields['p.date_signature']['checked'])) { + print ''; +} +// Availability +if (!empty($arrayfields['ava.rowid']['checked'])) { + print ''; +} +// Shipping Method +if (!empty($arrayfields['p.fk_shipping_method']['checked'])) { + print ''; +} +// Source - Input reason +if (!empty($arrayfields['p.fk_input_reason']['checked'])) { + print ''; +} +// Payment term +if (!empty($arrayfields['p.fk_cond_reglement']['checked'])) { + print ''; +} +// Payment mode +if (!empty($arrayfields['p.fk_mode_reglement']['checked'])) { + print ''; +} +if (!empty($arrayfields['p.total_ht']['checked'])) { + // Amount + print ''; +} +if (!empty($arrayfields['p.total_tva']['checked'])) { + // Amount + print ''; +} +if (!empty($arrayfields['p.total_ttc']['checked'])) { + // Amount + print ''; +} +if (!empty($arrayfields['p.total_ht_invoiced']['checked'])) { + // Amount invoiced + print ''; +} +if (!empty($arrayfields['p.total_invoiced']['checked'])) { + // Amount invoiced + print ''; +} +if (!empty($arrayfields['p.multicurrency_code']['checked'])) { + // Currency + print ''; +} +if (!empty($arrayfields['p.multicurrency_tx']['checked'])) { + // Currency rate + print ''; +} +if (!empty($arrayfields['p.multicurrency_total_ht']['checked'])) { + // Amount + print ''; +} +if (!empty($arrayfields['p.multicurrency_total_tva']['checked'])) { + // Amount + print ''; +} +if (!empty($arrayfields['p.multicurrency_total_ttc']['checked'])) { + // Amount + print ''; +} +if (!empty($arrayfields['p.multicurrency_total_ht_invoiced']['checked'])) { + // Amount invoiced + print ''; +} +if (!empty($arrayfields['p.multicurrency_total_invoiced']['checked'])) { + // Amount invoiced + print ''; +} +if (!empty($arrayfields['u.login']['checked'])) { + // Author + print ''; +} +if (!empty($arrayfields['sale_representative']['checked'])) { + print ''; +} +if (!empty($arrayfields['total_pa']['checked'])) { + print ''; +} +if (!empty($arrayfields['total_margin']['checked'])) { + print ''; +} +if (!empty($arrayfields['total_margin_rate']['checked'])) { + print ''; +} +if (!empty($arrayfields['total_mark_rate']['checked'])) { + print ''; +} +// Extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; + +// Fields from hook +$parameters = array('arrayfields' => $arrayfields); +$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; +// Date creation +if (!empty($arrayfields['p.datec']['checked'])) { + print ''; +} +// Date modification +if (!empty($arrayfields['p.tms']['checked'])) { + print ''; +} +// Date cloture +if (!empty($arrayfields['p.date_cloture']['checked'])) { + print ''; +} +if (!empty($arrayfields['p.note_public']['checked'])) { + // Note public + print ''; +} +if (!empty($arrayfields['p.note_private']['checked'])) { + // Note private + print ''; +} +// Status +if (!empty($arrayfields['p.fk_statut']['checked'])) { + print ''; +} +// Action column +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; +} +print "\n"; + +$totalarray = array( + 'nbfield' => 0, + 'val' => array( + 'p.total_ht' => 0, + 'p.total_tva' => 0, + 'p.total_ttc' => 0, + ), +); + +// Fields title +print ''; +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['p.ref']['checked'])) { + print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], 'p.ref', '', $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['p.ref_client']['checked'])) { + print_liste_field_titre($arrayfields['p.ref_client']['label'], $_SERVER["PHP_SELF"], 'p.ref_client', '', $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['pr.ref']['checked'])) { + print_liste_field_titre($arrayfields['pr.ref']['label'], $_SERVER["PHP_SELF"], 'pr.ref', '', $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['pr.title']['checked'])) { + print_liste_field_titre($arrayfields['pr.title']['label'], $_SERVER["PHP_SELF"], 'pr.title', '', $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['s.nom']['checked'])) { + print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], 's.nom', '', $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['s.name_alias']['checked'])) { + print_liste_field_titre($arrayfields['s.name_alias']['label'], $_SERVER["PHP_SELF"], 's.name_alias', '', $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['s.town']['checked'])) { + print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['s.zip']['checked'])) { + print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['state.nom']['checked'])) { + print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['country.code_iso']['checked'])) { + print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, 'class="center"', $sortfield, $sortorder); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['typent.code']['checked'])) { + print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, 'class="center"', $sortfield, $sortorder); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['p.date']['checked'])) { + print_liste_field_titre($arrayfields['p.date']['label'], $_SERVER["PHP_SELF"], 'p.datep', '', $param, 'class="center"', $sortfield, $sortorder); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['p.fin_validite']['checked'])) { + print_liste_field_titre($arrayfields['p.fin_validite']['label'], $_SERVER["PHP_SELF"], 'dfv', '', $param, 'class="center"', $sortfield, $sortorder); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['p.date_livraison']['checked'])) { + print_liste_field_titre($arrayfields['p.date_livraison']['label'], $_SERVER["PHP_SELF"], 'p.date_livraison', '', $param, 'class="center"', $sortfield, $sortorder); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['p.date_signature']['checked'])) { + print_liste_field_titre($arrayfields['p.date_signature']['label'], $_SERVER["PHP_SELF"], 'p.date_signature', '', $param, 'class="center"', $sortfield, $sortorder); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['ava.rowid']['checked'])) { + print_liste_field_titre($arrayfields['ava.rowid']['label'], $_SERVER["PHP_SELF"], 'availability', '', $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['p.fk_shipping_method']['checked'])) { + print_liste_field_titre($arrayfields['p.fk_shipping_method']['label'], $_SERVER["PHP_SELF"], "p.fk_shipping_method", "", $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['p.fk_input_reason']['checked'])) { + print_liste_field_titre($arrayfields['p.fk_input_reason']['label'], $_SERVER["PHP_SELF"], "p.fk_input_reason", "", $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['p.fk_cond_reglement']['checked'])) { + print_liste_field_titre($arrayfields['p.fk_cond_reglement']['label'], $_SERVER["PHP_SELF"], "p.fk_cond_reglement", "", $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['p.fk_mode_reglement']['checked'])) { + print_liste_field_titre($arrayfields['p.fk_mode_reglement']['label'], $_SERVER["PHP_SELF"], "p.fk_mode_reglement", "", $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['p.total_ht']['checked'])) { + print_liste_field_titre($arrayfields['p.total_ht']['label'], $_SERVER["PHP_SELF"], 'p.total_ht', '', $param, '', $sortfield, $sortorder, 'right '); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['p.total_tva']['checked'])) { + print_liste_field_titre($arrayfields['p.total_tva']['label'], $_SERVER["PHP_SELF"], 'p.total_tva', '', $param, '', $sortfield, $sortorder, 'right '); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['p.total_ttc']['checked'])) { + print_liste_field_titre($arrayfields['p.total_ttc']['label'], $_SERVER["PHP_SELF"], 'p.total_ttc', '', $param, '', $sortfield, $sortorder, 'right '); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['p.total_ht_invoiced']['checked'])) { + print_liste_field_titre($arrayfields['p.total_ht_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right '); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['p.total_invoiced']['checked'])) { + print_liste_field_titre($arrayfields['p.total_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right '); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['p.multicurrency_code']['checked'])) { + print_liste_field_titre($arrayfields['p.multicurrency_code']['label'], $_SERVER['PHP_SELF'], 'p.multicurrency_code', '', $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['p.multicurrency_tx']['checked'])) { + print_liste_field_titre($arrayfields['p.multicurrency_tx']['label'], $_SERVER['PHP_SELF'], 'p.multicurrency_tx', '', $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['p.multicurrency_total_ht']['checked'])) { + print_liste_field_titre($arrayfields['p.multicurrency_total_ht']['label'], $_SERVER['PHP_SELF'], 'p.multicurrency_total_ht', '', $param, '', $sortfield, $sortorder, 'right '); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['p.multicurrency_total_tva']['checked'])) { + print_liste_field_titre($arrayfields['p.multicurrency_total_tva']['label'], $_SERVER['PHP_SELF'], 'p.multicurrency_total_tva', '', $param, '', $sortfield, $sortorder, 'right '); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['p.multicurrency_total_ttc']['checked'])) { + print_liste_field_titre($arrayfields['p.multicurrency_total_ttc']['label'], $_SERVER['PHP_SELF'], 'p.multicurrency_total_ttc', '', $param, '', $sortfield, $sortorder, 'right '); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['p.multicurrency_total_ht_invoiced']['checked'])) { + print_liste_field_titre($arrayfields['p.multicurrency_total_ht_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right '); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['p.multicurrency_total_invoiced']['checked'])) { + print_liste_field_titre($arrayfields['p.multicurrency_total_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right '); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['u.login']['checked'])) { + print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['sale_representative']['checked'])) { + print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", "$param", '', $sortfield, $sortorder); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['total_pa']['checked'])) { + print_liste_field_titre($arrayfields['total_pa']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right '); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['total_margin']['checked'])) { + print_liste_field_titre($arrayfields['total_margin']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right '); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['total_margin_rate']['checked'])) { + print_liste_field_titre($arrayfields['total_margin_rate']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right '); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['total_mark_rate']['checked'])) { + print_liste_field_titre($arrayfields['total_mark_rate']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right '); + $totalarray['nbfield']++; +} +// Extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; +// Hook fields +$parameters = array( + 'arrayfields' => $arrayfields, + 'param' => $param, + 'sortfield' => $sortfield, + 'sortorder' => $sortorder, + 'totalarray' => &$totalarray, +); + +$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + +print $hookmanager->resPrint; +if (!empty($arrayfields['p.datec']['checked'])) { + print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, '', $sortfield, $sortorder, 'center nowraponall '); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['p.tms']['checked'])) { + print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, '', $sortfield, $sortorder, 'center nowraponall '); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['p.date_cloture']['checked'])) { + print_liste_field_titre($arrayfields['p.date_cloture']['label'], $_SERVER["PHP_SELF"], "p.date_cloture", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['p.note_public']['checked'])) { + print_liste_field_titre($arrayfields['p.note_public']['label'], $_SERVER["PHP_SELF"], "p.note_public", "", $param, '', $sortfield, $sortorder, 'center nowrap '); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['p.note_private']['checked'])) { + print_liste_field_titre($arrayfields['p.note_private']['label'], $_SERVER["PHP_SELF"], "p.note_private", "", $param, '', $sortfield, $sortorder, 'center nowrap '); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['p.fk_statut']['checked'])) { + print_liste_field_titre($arrayfields['p.fk_statut']['label'], $_SERVER["PHP_SELF"], "p.fk_statut", "", $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; +} +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); + $totalarray['nbfield']++; +} +print ''."\n"; + +// Loop on record +// -------------------------------------------------------------------- +$typenArray = null; +$now = dol_now(); + +$with_margin_info = false; +if (isModEnabled('margin') && ( + !empty($arrayfields['total_pa']['checked']) + || !empty($arrayfields['total_margin']['checked']) + || !empty($arrayfields['total_margin_rate']['checked']) + || !empty($arrayfields['total_mark_rate']['checked']) +) +) { + $with_margin_info = true; +} +$total_ht = 0; +$total_margin = 0; + +$i = 0; +$savnbfield = $totalarray['nbfield']; +$totalarray = array(); +$totalarray['nbfield'] = 0; +$imaxinloop = ($limit ? min($num, $limit) : $num); +while ($i < $imaxinloop) { + $obj = $db->fetch_object($resql); + if (empty($obj)) { + break; // Should not happen } - if (in_array($massaction, array('presend', 'predelete', 'closed'))) { - $arrayofmassactions = array(); - } - $massactionbutton = $form->selectMassAction('', $arrayofmassactions); + $objectstatic->id = $obj->rowid; + $objectstatic->ref = $obj->ref; + $objectstatic->ref_client = $obj->ref_client; + $objectstatic->note_public = $obj->note_public; + $objectstatic->note_private = $obj->note_private; + $objectstatic->statut = $obj->status; + $objectstatic->status = $obj->status; - $url = DOL_URL_ROOT.'/comm/propal/card.php?action=create'; - if (!empty($socid)) { - $url .= '&socid='.$socid; - } - $newcardbutton = ''; - $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); - $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); - $newcardbutton .= dolGetButtonTitleSeparator(); - $newcardbutton .= dolGetButtonTitle($langs->trans('NewPropal'), '', 'fa fa-plus-circle', $url, '', $user->hasRight('propal', 'creer')); + $companystatic->id = $obj->socid; + $companystatic->name = $obj->name; + $companystatic->name_alias = $obj->alias; + $companystatic->client = $obj->client; + $companystatic->fournisseur = $obj->fournisseur; + $companystatic->code_client = $obj->code_client; + $companystatic->email = $obj->email; + $companystatic->phone = $obj->phone; + $companystatic->address = $obj->address; + $companystatic->zip = $obj->zip; + $companystatic->town = $obj->town; + $companystatic->country_code = $obj->country_code; - // Fields title search - print ''; - if ($optioncss != '') { - print ''; - } - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + $projectstatic->id = $obj->project_id; + $projectstatic->ref = $obj->project_ref; + $projectstatic->title = $obj->project_label; - print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'propal', 0, $newcardbutton, '', $limit, 0, 0, 1); + $totalInvoicedHT = 0; + $totalInvoicedTTC = 0; + $multicurrency_totalInvoicedHT = 0; + $multicurrency_totalInvoicedTTC = 0; - $topicmail = "SendPropalRef"; - $modelmail = "propal_send"; - $objecttmp = new Propal($db); - $trackid = 'pro'.$object->id; - include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; + $TInvoiceData = $objectstatic->InvoiceArrayList($obj->rowid); - if ($massaction == 'prevalidate') { - print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassValidation"), $langs->trans("ConfirmMassValidationQuestion"), "validate", null, '', 0, 200, 500, 1); - } + if (!empty($TInvoiceData)) { + foreach ($TInvoiceData as $invoiceData) { + $invoice = new Facture($db); + $invoice->fetch($invoiceData->facid); - if ($massaction == 'presign') { - print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassSignature"), $langs->trans("ConfirmMassSignatureQuestion"), "sign", null, '', 0, 200, 500, 1); - } + if (getDolGlobalString('FACTURE_DEPOSITS_ARE_JUST_PAYMENTS') && $invoice->type == Facture::TYPE_DEPOSIT) { + continue; + } - if ($massaction == 'nopresign') { - print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassNoSignature"), $langs->trans("ConfirmMassNoSignatureQuestion"), "nosign", null, '', 0, 200, 500, 1); - } - - if ($search_all) { - foreach ($fieldstosearchall as $key => $val) { - $fieldstosearchall[$key] = $langs->trans($val); + $totalInvoicedHT += $invoice->total_ht; + $totalInvoicedTTC += $invoice->total_ttc; + $multicurrency_totalInvoicedHT += $invoice->multicurrency_total_ht; + $multicurrency_totalInvoicedTTC += $invoice->multicurrency_total_ttc; } - print '
'.$langs->trans("FilterOnInto", $search_all).implode(', ', $fieldstosearchall).'
'; } - $i = 0; + $marginInfo = array(); + if ($with_margin_info === true) { + $objectstatic->fetch_lines(); + $marginInfo = $formmargin->getMarginInfosArray($objectstatic); + $total_ht += $obj->total_ht; + $total_margin += $marginInfo['total_margin']; + } - $moreforfilter = ''; - - // If the user can view prospects other than his' - if ($user->hasRight('user', 'user', 'lire')) { - $langs->load("commercial"); - $moreforfilter .= '
'; - $tmptitle = $langs->trans('ThirdPartiesOfSaleRepresentative'); - $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, $tmptitle, 'maxwidth250 widthcentpercentminusx', 1); - $moreforfilter .= '
'; - } - // If the user can view prospects other than his' - if ($user->hasRight('user', 'user', 'lire')) { - $moreforfilter .= '
'; - $tmptitle = $langs->trans('LinkedToSpecificUsers'); - $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers((empty($search_user)?-2:0), 'search_user', $tmptitle, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth250 widthcentpercentminusx'); - $moreforfilter .= '
'; - } - // If the user can view products - if (isModEnabled('category') && $user->hasRight('categorie', 'read') && ($user->hasRight('product', 'read') || $user->hasRight('service', 'read'))) { - $searchCategoryProductOperator = -1; - include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; - $tmptitle = $langs->trans('IncludingProductWithTag'); - $formcategory = new FormCategory($db); - $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PRODUCT, array($search_product_category), 'maxwidth300', $searchCategoryProductOperator, 0, 0, $tmptitle); - } - if (isModEnabled('category') && $user->hasRight('categorie', 'lire')) { - require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; - $moreforfilter .= '
'; - $tmptitle = $langs->trans('CustomersProspectsCategoriesShort'); - $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1, $tmptitle, (empty($conf->dol_optimize_smallscreen) ? 'maxwidth300 widthcentpercentminusx' : 'maxwidth250 widthcentpercentminusx')); - $moreforfilter .= '
'; - } - if (isModEnabled('stock') && getDolGlobalString('WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL')) { - require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; - $formproduct = new FormProduct($db); - $moreforfilter .= '
'; - $tmptitle = $langs->trans('Warehouse'); - $moreforfilter .= img_picto($tmptitle, 'stock', 'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse, 'search_warehouse', '', $tmptitle, 0, 0, $tmptitle); - $moreforfilter .= '
'; - } - $parameters = array(); - $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - if (empty($reshook)) { - $moreforfilter .= $hookmanager->resPrint; + if ($mode == 'kanban') { + if ($i == 0) { + print '
'; + } } else { - $moreforfilter = $hookmanager->resPrint; - } + print ''; - if (!empty($moreforfilter)) { - print '
'; - print $moreforfilter; - print '
'; - } + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print '
'; + if (!$i) { + $totalarray['nbfield']++; + } + } - $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; - $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields - $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); + if (!empty($arrayfields['p.ref']['checked'])) { + print ''; + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } - // Action column - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - } + if (!empty($arrayfields['p.ref_client']['checked'])) { + // Customer ref + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } - if (!empty($arrayfields['p.ref']['checked'])) { - print ''; - } - if (!empty($arrayfields['p.ref_client']['checked'])) { - print ''; - } - if (!empty($arrayfields['pr.ref']['checked'])) { - print ''; - } - if (!empty($arrayfields['pr.title']['checked'])) { - print ''; - } - if (!empty($arrayfields['s.nom']['checked'])) { - print ''; - } - if (!empty($arrayfields['s.name_alias']['checked'])) { - print ''; - } - if (!empty($arrayfields['s.town']['checked'])) { - print ''; - } - if (!empty($arrayfields['s.zip']['checked'])) { - print ''; - } - // State - if (!empty($arrayfields['state.nom']['checked'])) { - print ''; - } - // Country - if (!empty($arrayfields['country.code_iso']['checked'])) { - print ''; - } - // Company type - if (!empty($arrayfields['typent.code']['checked'])) { - print ''; - } - // Date - if (!empty($arrayfields['p.date']['checked'])) { - print ''; - } - // Date end - if (!empty($arrayfields['p.fin_validite']['checked'])) { - print ''; - } - // Date delivery - if (!empty($arrayfields['p.date_livraison']['checked'])) { - print ''; - } - // Date Signature - if (!empty($arrayfields['p.date_signature']['checked'])) { - print ''; - } - // Availability - if (!empty($arrayfields['ava.rowid']['checked'])) { - print ''; - } - // Shipping Method - if (!empty($arrayfields['p.fk_shipping_method']['checked'])) { - print ''; - } - // Source - Input reason - if (!empty($arrayfields['p.fk_input_reason']['checked'])) { - print ''; - } - // Payment term - if (!empty($arrayfields['p.fk_cond_reglement']['checked'])) { - print ''; - } - // Payment mode - if (!empty($arrayfields['p.fk_mode_reglement']['checked'])) { - print ''; - } - if (!empty($arrayfields['p.total_ht']['checked'])) { - // Amount - print ''; - } - if (!empty($arrayfields['p.total_tva']['checked'])) { - // Amount - print ''; - } - if (!empty($arrayfields['p.total_ttc']['checked'])) { - // Amount - print ''; - } - if (!empty($arrayfields['p.total_ht_invoiced']['checked'])) { - // Amount invoiced - print ''; - } - if (!empty($arrayfields['p.total_invoiced']['checked'])) { - // Amount invoiced - print ''; - } - if (!empty($arrayfields['p.multicurrency_code']['checked'])) { + if (!empty($arrayfields['pr.ref']['checked'])) { + // Project ref + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + if (!empty($arrayfields['pr.title']['checked'])) { + // Project label + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Thirdparty + if (!empty($arrayfields['s.nom']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Alias + if (!empty($arrayfields['s.name_alias']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Town + if (!empty($arrayfields['s.town']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Zip + if (!empty($arrayfields['s.zip']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // State + if (!empty($arrayfields['state.nom']['checked'])) { + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Country + if (!empty($arrayfields['country.code_iso']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Type ent + if (!empty($arrayfields['typent.code']['checked'])) { + if (!is_array($typenArray) || empty($typenArray)) { + $typenArray = $formcompany->typent_array(1); + } + + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Date proposal + if (!empty($arrayfields['p.date']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Date end validity + if (!empty($arrayfields['p.fin_validite']['checked'])) { + if ($obj->dfv) { + print ''; + } else { + print ''; + } + if (!$i) { + $totalarray['nbfield']++; + } + } + // Date delivery + if (!empty($arrayfields['p.date_livraison']['checked'])) { + if ($obj->ddelivery) { + print ''; + } else { + print ''; + } + if (!$i) { + $totalarray['nbfield']++; + } + } + // Date Signature + if (!empty($arrayfields['p.date_signature']['checked'])) { + if ($obj->dsignature) { + print ''; + } else { + print ''; + } + if (!$i) { + $totalarray['nbfield']++; + } + } + // Availability + if (!empty($arrayfields['ava.rowid']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Shipping Method + if (!empty($arrayfields['p.fk_shipping_method']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Source - input reason + if (!empty($arrayfields['p.fk_input_reason']['checked'])) { + $labelInputReason = ''; + if ($obj->fk_input_reason > 0) { + $labelInputReason = $form->cache_demand_reason[$obj->fk_input_reason]['label']; + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Payment terms + if (!empty($arrayfields['p.fk_cond_reglement']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Payment mode + if (!empty($arrayfields['p.fk_mode_reglement']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount HT + if (!empty($arrayfields['p.total_ht']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'p.total_ht'; + } + if (empty($totalarray['val']['p.total_ht'])) { + $totalarray['val']['p.total_ht'] = $obj->total_ht; + } else { + $totalarray['val']['p.total_ht'] += $obj->total_ht; + } + } + // Amount VAT + if (!empty($arrayfields['p.total_tva']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'p.total_tva'; + } + if (empty($totalarray['val']['p.total_tva'])) { + $totalarray['val']['p.total_tva'] = $obj->total_tva; + } else { + $totalarray['val']['p.total_tva'] += $obj->total_tva; + } + } + // Amount TTC + if (!empty($arrayfields['p.total_ttc']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'p.total_ttc'; + } + if (empty($totalarray['val']['p.total_ttc'])) { + $totalarray['val']['p.total_ttc'] = $obj->total_ttc; + } else { + $totalarray['val']['p.total_ttc'] += $obj->total_ttc; + } + } + // Amount invoiced HT + if (!empty($arrayfields['p.total_ht_invoiced']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'p.total_ht_invoiced'; + } + if (empty($totalarray['val']['p.total_ht_invoiced'])) { + $totalarray['val']['p.total_ht_invoiced'] = $totalInvoicedHT; + } else { + $totalarray['val']['p.total_ht_invoiced'] += $totalInvoicedHT; + } + } + // Amount invoiced TTC + if (!empty($arrayfields['p.total_invoiced']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'p.total_invoiced'; + } + if (empty($totalarray['val']['p.total_invoiced'])) { + $totalarray['val']['p.total_invoiced'] = $totalInvoicedTTC; + } else { + $totalarray['val']['p.total_invoiced'] += $totalInvoicedTTC; + } + } // Currency - print ''; - } - if (!empty($arrayfields['p.multicurrency_tx']['checked'])) { + if (!empty($arrayfields['p.multicurrency_code']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Currency rate - print ''; - } - if (!empty($arrayfields['p.multicurrency_total_ht']['checked'])) { - // Amount - print ''; - } - if (!empty($arrayfields['p.multicurrency_total_tva']['checked'])) { - // Amount - print ''; - } - if (!empty($arrayfields['p.multicurrency_total_ttc']['checked'])) { - // Amount - print ''; - } - if (!empty($arrayfields['p.multicurrency_total_ht_invoiced']['checked'])) { + if (!empty($arrayfields['p.multicurrency_tx']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount HT + if (!empty($arrayfields['p.multicurrency_total_ht']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount VAT + if (!empty($arrayfields['p.multicurrency_total_tva']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount TTC + if (!empty($arrayfields['p.multicurrency_total_ttc']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } // Amount invoiced - print ''; - } - if (!empty($arrayfields['p.multicurrency_total_invoiced']['checked'])) { + if (!empty($arrayfields['p.multicurrency_total_ht_invoiced']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } // Amount invoiced - print ''; - } - if (!empty($arrayfields['u.login']['checked'])) { + if (!empty($arrayfields['p.multicurrency_total_invoiced']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + + $userstatic->id = $obj->fk_user_author; + $userstatic->login = $obj->login; + $userstatic->lastname = $obj->lastname; + $userstatic->firstname = $obj->firstname; + $userstatic->email = $obj->user_email; + $userstatic->statut = $obj->user_statut; + $userstatic->entity = $obj->user_entity; + $userstatic->photo = $obj->photo; + $userstatic->office_phone = $obj->office_phone; + $userstatic->office_fax = $obj->office_fax; + $userstatic->user_mobile = $obj->user_mobile; + $userstatic->job = $obj->job; + $userstatic->gender = $obj->gender; + // Author - print ''; - } - if (!empty($arrayfields['sale_representative']['checked'])) { - print ''; - } - if (!empty($arrayfields['total_pa']['checked'])) { - print ''; - } - if (!empty($arrayfields['total_margin']['checked'])) { - print ''; - } - if (!empty($arrayfields['total_margin_rate']['checked'])) { - print ''; - } - if (!empty($arrayfields['total_mark_rate']['checked'])) { - print ''; - } - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; - - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields); - $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - // Date creation - if (!empty($arrayfields['p.datec']['checked'])) { - print ''; - } - // Date modification - if (!empty($arrayfields['p.tms']['checked'])) { - print ''; - } - // Date cloture - if (!empty($arrayfields['p.date_cloture']['checked'])) { - print ''; - } - if (!empty($arrayfields['p.note_public']['checked'])) { - // Note public - print ''; - } - if (!empty($arrayfields['p.note_private']['checked'])) { - // Note private - print ''; - } - // Status - if (!empty($arrayfields['p.fk_statut']['checked'])) { - print ''; - } - // Action column - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - } - print "\n"; - - $totalarray = array( - 'nbfield' => 0, - 'val' => array( - 'p.total_ht' => 0, - 'p.total_tva' => 0, - 'p.total_ttc' => 0, - ), - ); - - // Fields title - print ''; - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); - $totalarray['nbfield']++; - } - if (!empty($arrayfields['p.ref']['checked'])) { - print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], 'p.ref', '', $param, '', $sortfield, $sortorder); - $totalarray['nbfield']++; - } - if (!empty($arrayfields['p.ref_client']['checked'])) { - print_liste_field_titre($arrayfields['p.ref_client']['label'], $_SERVER["PHP_SELF"], 'p.ref_client', '', $param, '', $sortfield, $sortorder); - $totalarray['nbfield']++; - } - if (!empty($arrayfields['pr.ref']['checked'])) { - print_liste_field_titre($arrayfields['pr.ref']['label'], $_SERVER["PHP_SELF"], 'pr.ref', '', $param, '', $sortfield, $sortorder); - $totalarray['nbfield']++; - } - if (!empty($arrayfields['pr.title']['checked'])) { - print_liste_field_titre($arrayfields['pr.title']['label'], $_SERVER["PHP_SELF"], 'pr.title', '', $param, '', $sortfield, $sortorder); - $totalarray['nbfield']++; - } - if (!empty($arrayfields['s.nom']['checked'])) { - print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], 's.nom', '', $param, '', $sortfield, $sortorder); - $totalarray['nbfield']++; - } - if (!empty($arrayfields['s.name_alias']['checked'])) { - print_liste_field_titre($arrayfields['s.name_alias']['label'], $_SERVER["PHP_SELF"], 's.name_alias', '', $param, '', $sortfield, $sortorder); - $totalarray['nbfield']++; - } - if (!empty($arrayfields['s.town']['checked'])) { - print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder); - $totalarray['nbfield']++; - } - if (!empty($arrayfields['s.zip']['checked'])) { - print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder); - $totalarray['nbfield']++; - } - if (!empty($arrayfields['state.nom']['checked'])) { - print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder); - $totalarray['nbfield']++; - } - if (!empty($arrayfields['country.code_iso']['checked'])) { - print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, 'class="center"', $sortfield, $sortorder); - $totalarray['nbfield']++; - } - if (!empty($arrayfields['typent.code']['checked'])) { - print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, 'class="center"', $sortfield, $sortorder); - $totalarray['nbfield']++; - } - if (!empty($arrayfields['p.date']['checked'])) { - print_liste_field_titre($arrayfields['p.date']['label'], $_SERVER["PHP_SELF"], 'p.datep', '', $param, 'class="center"', $sortfield, $sortorder); - $totalarray['nbfield']++; - } - if (!empty($arrayfields['p.fin_validite']['checked'])) { - print_liste_field_titre($arrayfields['p.fin_validite']['label'], $_SERVER["PHP_SELF"], 'dfv', '', $param, 'class="center"', $sortfield, $sortorder); - $totalarray['nbfield']++; - } - if (!empty($arrayfields['p.date_livraison']['checked'])) { - print_liste_field_titre($arrayfields['p.date_livraison']['label'], $_SERVER["PHP_SELF"], 'p.date_livraison', '', $param, 'class="center"', $sortfield, $sortorder); - $totalarray['nbfield']++; - } - if (!empty($arrayfields['p.date_signature']['checked'])) { - print_liste_field_titre($arrayfields['p.date_signature']['label'], $_SERVER["PHP_SELF"], 'p.date_signature', '', $param, 'class="center"', $sortfield, $sortorder); - $totalarray['nbfield']++; - } - if (!empty($arrayfields['ava.rowid']['checked'])) { - print_liste_field_titre($arrayfields['ava.rowid']['label'], $_SERVER["PHP_SELF"], 'availability', '', $param, '', $sortfield, $sortorder); - $totalarray['nbfield']++; - } - if (!empty($arrayfields['p.fk_shipping_method']['checked'])) { - print_liste_field_titre($arrayfields['p.fk_shipping_method']['label'], $_SERVER["PHP_SELF"], "p.fk_shipping_method", "", $param, '', $sortfield, $sortorder); - $totalarray['nbfield']++; - } - if (!empty($arrayfields['p.fk_input_reason']['checked'])) { - print_liste_field_titre($arrayfields['p.fk_input_reason']['label'], $_SERVER["PHP_SELF"], "p.fk_input_reason", "", $param, '', $sortfield, $sortorder); - $totalarray['nbfield']++; - } - if (!empty($arrayfields['p.fk_cond_reglement']['checked'])) { - print_liste_field_titre($arrayfields['p.fk_cond_reglement']['label'], $_SERVER["PHP_SELF"], "p.fk_cond_reglement", "", $param, '', $sortfield, $sortorder); - $totalarray['nbfield']++; - } - if (!empty($arrayfields['p.fk_mode_reglement']['checked'])) { - print_liste_field_titre($arrayfields['p.fk_mode_reglement']['label'], $_SERVER["PHP_SELF"], "p.fk_mode_reglement", "", $param, '', $sortfield, $sortorder); - $totalarray['nbfield']++; - } - if (!empty($arrayfields['p.total_ht']['checked'])) { - print_liste_field_titre($arrayfields['p.total_ht']['label'], $_SERVER["PHP_SELF"], 'p.total_ht', '', $param, '', $sortfield, $sortorder, 'right '); - $totalarray['nbfield']++; - } - if (!empty($arrayfields['p.total_tva']['checked'])) { - print_liste_field_titre($arrayfields['p.total_tva']['label'], $_SERVER["PHP_SELF"], 'p.total_tva', '', $param, '', $sortfield, $sortorder, 'right '); - $totalarray['nbfield']++; - } - if (!empty($arrayfields['p.total_ttc']['checked'])) { - print_liste_field_titre($arrayfields['p.total_ttc']['label'], $_SERVER["PHP_SELF"], 'p.total_ttc', '', $param, '', $sortfield, $sortorder, 'right '); - $totalarray['nbfield']++; - } - if (!empty($arrayfields['p.total_ht_invoiced']['checked'])) { - print_liste_field_titre($arrayfields['p.total_ht_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right '); - $totalarray['nbfield']++; - } - if (!empty($arrayfields['p.total_invoiced']['checked'])) { - print_liste_field_titre($arrayfields['p.total_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right '); - $totalarray['nbfield']++; - } - if (!empty($arrayfields['p.multicurrency_code']['checked'])) { - print_liste_field_titre($arrayfields['p.multicurrency_code']['label'], $_SERVER['PHP_SELF'], 'p.multicurrency_code', '', $param, '', $sortfield, $sortorder); - $totalarray['nbfield']++; - } - if (!empty($arrayfields['p.multicurrency_tx']['checked'])) { - print_liste_field_titre($arrayfields['p.multicurrency_tx']['label'], $_SERVER['PHP_SELF'], 'p.multicurrency_tx', '', $param, '', $sortfield, $sortorder); - $totalarray['nbfield']++; - } - if (!empty($arrayfields['p.multicurrency_total_ht']['checked'])) { - print_liste_field_titre($arrayfields['p.multicurrency_total_ht']['label'], $_SERVER['PHP_SELF'], 'p.multicurrency_total_ht', '', $param, '', $sortfield, $sortorder, 'right '); - $totalarray['nbfield']++; - } - if (!empty($arrayfields['p.multicurrency_total_tva']['checked'])) { - print_liste_field_titre($arrayfields['p.multicurrency_total_tva']['label'], $_SERVER['PHP_SELF'], 'p.multicurrency_total_tva', '', $param, '', $sortfield, $sortorder, 'right '); - $totalarray['nbfield']++; - } - if (!empty($arrayfields['p.multicurrency_total_ttc']['checked'])) { - print_liste_field_titre($arrayfields['p.multicurrency_total_ttc']['label'], $_SERVER['PHP_SELF'], 'p.multicurrency_total_ttc', '', $param, '', $sortfield, $sortorder, 'right '); - $totalarray['nbfield']++; - } - if (!empty($arrayfields['p.multicurrency_total_ht_invoiced']['checked'])) { - print_liste_field_titre($arrayfields['p.multicurrency_total_ht_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right '); - $totalarray['nbfield']++; - } - if (!empty($arrayfields['p.multicurrency_total_invoiced']['checked'])) { - print_liste_field_titre($arrayfields['p.multicurrency_total_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right '); - $totalarray['nbfield']++; - } - if (!empty($arrayfields['u.login']['checked'])) { - print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, '', $sortfield, $sortorder); - $totalarray['nbfield']++; - } - if (!empty($arrayfields['sale_representative']['checked'])) { - print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", "$param", '', $sortfield, $sortorder); - $totalarray['nbfield']++; - } - if (!empty($arrayfields['total_pa']['checked'])) { - print_liste_field_titre($arrayfields['total_pa']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right '); - $totalarray['nbfield']++; - } - if (!empty($arrayfields['total_margin']['checked'])) { - print_liste_field_titre($arrayfields['total_margin']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right '); - $totalarray['nbfield']++; - } - if (!empty($arrayfields['total_margin_rate']['checked'])) { - print_liste_field_titre($arrayfields['total_margin_rate']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right '); - $totalarray['nbfield']++; - } - if (!empty($arrayfields['total_mark_rate']['checked'])) { - print_liste_field_titre($arrayfields['total_mark_rate']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right '); - $totalarray['nbfield']++; - } - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; - // Hook fields - $parameters = array( - 'arrayfields' => $arrayfields, - 'param' => $param, - 'sortfield' => $sortfield, - 'sortorder' => $sortorder, - 'totalarray' => &$totalarray, - ); - - $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - - print $hookmanager->resPrint; - if (!empty($arrayfields['p.datec']['checked'])) { - print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, '', $sortfield, $sortorder, 'center nowraponall '); - $totalarray['nbfield']++; - } - if (!empty($arrayfields['p.tms']['checked'])) { - print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, '', $sortfield, $sortorder, 'center nowraponall '); - $totalarray['nbfield']++; - } - if (!empty($arrayfields['p.date_cloture']['checked'])) { - print_liste_field_titre($arrayfields['p.date_cloture']['label'], $_SERVER["PHP_SELF"], "p.date_cloture", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); - $totalarray['nbfield']++; - } - if (!empty($arrayfields['p.note_public']['checked'])) { - print_liste_field_titre($arrayfields['p.note_public']['label'], $_SERVER["PHP_SELF"], "p.note_public", "", $param, '', $sortfield, $sortorder, 'center nowrap '); - $totalarray['nbfield']++; - } - if (!empty($arrayfields['p.note_private']['checked'])) { - print_liste_field_titre($arrayfields['p.note_private']['label'], $_SERVER["PHP_SELF"], "p.note_private", "", $param, '', $sortfield, $sortorder, 'center nowrap '); - $totalarray['nbfield']++; - } - if (!empty($arrayfields['p.fk_statut']['checked'])) { - print_liste_field_titre($arrayfields['p.fk_statut']['label'], $_SERVER["PHP_SELF"], "p.fk_statut", "", $param, '', $sortfield, $sortorder, 'center '); - $totalarray['nbfield']++; - } - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); - $totalarray['nbfield']++; - } - print ''."\n"; - - // Loop on record - // -------------------------------------------------------------------- - $typenArray = null; - $now = dol_now(); - - $with_margin_info = false; - if (isModEnabled('margin') && ( - !empty($arrayfields['total_pa']['checked']) - || !empty($arrayfields['total_margin']['checked']) - || !empty($arrayfields['total_margin_rate']['checked']) - || !empty($arrayfields['total_mark_rate']['checked']) - ) - ) { - $with_margin_info = true; - } - $total_ht = 0; - $total_margin = 0; - - $i = 0; - $savnbfield = $totalarray['nbfield']; - $totalarray = array(); - $totalarray['nbfield'] = 0; - $imaxinloop = ($limit ? min($num, $limit) : $num); - while ($i < $imaxinloop) { - $obj = $db->fetch_object($resql); - if (empty($obj)) { - break; // Should not happen - } - - $objectstatic->id = $obj->rowid; - $objectstatic->ref = $obj->ref; - $objectstatic->ref_client = $obj->ref_client; - $objectstatic->note_public = $obj->note_public; - $objectstatic->note_private = $obj->note_private; - $objectstatic->statut = $obj->status; - $objectstatic->status = $obj->status; - - $companystatic->id = $obj->socid; - $companystatic->name = $obj->name; - $companystatic->name_alias = $obj->alias; - $companystatic->client = $obj->client; - $companystatic->fournisseur = $obj->fournisseur; - $companystatic->code_client = $obj->code_client; - $companystatic->email = $obj->email; - $companystatic->phone = $obj->phone; - $companystatic->address = $obj->address; - $companystatic->zip = $obj->zip; - $companystatic->town = $obj->town; - $companystatic->country_code = $obj->country_code; - - $projectstatic->id = $obj->project_id; - $projectstatic->ref = $obj->project_ref; - $projectstatic->title = $obj->project_label; - - $totalInvoicedHT = 0; - $totalInvoicedTTC = 0; - $multicurrency_totalInvoicedHT = 0; - $multicurrency_totalInvoicedTTC = 0; - - $TInvoiceData = $objectstatic->InvoiceArrayList($obj->rowid); - - if (!empty($TInvoiceData)) { - foreach ($TInvoiceData as $invoiceData) { - $invoice = new Facture($db); - $invoice->fetch($invoiceData->facid); - - if (getDolGlobalString('FACTURE_DEPOSITS_ARE_JUST_PAYMENTS') && $invoice->type == Facture::TYPE_DEPOSIT) { - continue; - } - - $totalInvoicedHT += $invoice->total_ht; - $totalInvoicedTTC += $invoice->total_ttc; - $multicurrency_totalInvoicedHT += $invoice->multicurrency_total_ht; - $multicurrency_totalInvoicedTTC += $invoice->multicurrency_total_ttc; + if (!empty($arrayfields['u.login']['checked'])) { + print '\n"; + if (!$i) { + $totalarray['nbfield']++; } } - $marginInfo = array(); - if ($with_margin_info === true) { - $objectstatic->fetch_lines(); - $marginInfo = $formmargin->getMarginInfosArray($objectstatic); - $total_ht += $obj->total_ht; - $total_margin += $marginInfo['total_margin']; - } - - if ($mode == 'kanban') { - if ($i == 0) { - print ''; - } - } else { - print ''; - - // Action column - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - if (!empty($arrayfields['p.ref']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - - if (!empty($arrayfields['p.ref_client']['checked'])) { - // Customer ref - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - if (!empty($arrayfields['pr.ref']['checked'])) { - // Project ref - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - if (!empty($arrayfields['pr.title']['checked'])) { - // Project label - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Thirdparty - if (!empty($arrayfields['s.nom']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Alias - if (!empty($arrayfields['s.name_alias']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Town - if (!empty($arrayfields['s.town']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Zip - if (!empty($arrayfields['s.zip']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // State - if (!empty($arrayfields['state.nom']['checked'])) { - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Country - if (!empty($arrayfields['country.code_iso']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Type ent - if (!empty($arrayfields['typent.code']['checked'])) { - if (!is_array($typenArray) || empty($typenArray)) { - $typenArray = $formcompany->typent_array(1); - } - - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Date proposal - if (!empty($arrayfields['p.date']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Date end validity - if (!empty($arrayfields['p.fin_validite']['checked'])) { - if ($obj->dfv) { - print ''; - } else { - print ''; - } - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date delivery - if (!empty($arrayfields['p.date_livraison']['checked'])) { - if ($obj->ddelivery) { - print ''; - } else { - print ''; - } - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date Signature - if (!empty($arrayfields['p.date_signature']['checked'])) { - if ($obj->dsignature) { - print ''; - } else { - print ''; - } - if (!$i) { - $totalarray['nbfield']++; - } - } - // Availability - if (!empty($arrayfields['ava.rowid']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Shipping Method - if (!empty($arrayfields['p.fk_shipping_method']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Source - input reason - if (!empty($arrayfields['p.fk_input_reason']['checked'])) { - $labelInputReason = ''; - if ($obj->fk_input_reason > 0) { - $labelInputReason = $form->cache_demand_reason[$obj->fk_input_reason]['label']; - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Payment terms - if (!empty($arrayfields['p.fk_cond_reglement']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Payment mode - if (!empty($arrayfields['p.fk_mode_reglement']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Amount HT - if (!empty($arrayfields['p.total_ht']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'p.total_ht'; - } - if (empty($totalarray['val']['p.total_ht'])) { - $totalarray['val']['p.total_ht'] = $obj->total_ht; - } else { - $totalarray['val']['p.total_ht'] += $obj->total_ht; - } - } - // Amount VAT - if (!empty($arrayfields['p.total_tva']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'p.total_tva'; - } - if (empty($totalarray['val']['p.total_tva'])) { - $totalarray['val']['p.total_tva'] = $obj->total_tva; - } else { - $totalarray['val']['p.total_tva'] += $obj->total_tva; - } - } - // Amount TTC - if (!empty($arrayfields['p.total_ttc']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'p.total_ttc'; - } - if (empty($totalarray['val']['p.total_ttc'])) { - $totalarray['val']['p.total_ttc'] = $obj->total_ttc; - } else { - $totalarray['val']['p.total_ttc'] += $obj->total_ttc; - } - } - // Amount invoiced HT - if (!empty($arrayfields['p.total_ht_invoiced']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'p.total_ht_invoiced'; - } - if (empty($totalarray['val']['p.total_ht_invoiced'])) { - $totalarray['val']['p.total_ht_invoiced'] = $totalInvoicedHT; - } else { - $totalarray['val']['p.total_ht_invoiced'] += $totalInvoicedHT; - } - } - // Amount invoiced TTC - if (!empty($arrayfields['p.total_invoiced']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'p.total_invoiced'; - } - if (empty($totalarray['val']['p.total_invoiced'])) { - $totalarray['val']['p.total_invoiced'] = $totalInvoicedTTC; - } else { - $totalarray['val']['p.total_invoiced'] += $totalInvoicedTTC; - } - } - // Currency - if (!empty($arrayfields['p.multicurrency_code']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Currency rate - if (!empty($arrayfields['p.multicurrency_tx']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Amount HT - if (!empty($arrayfields['p.multicurrency_total_ht']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Amount VAT - if (!empty($arrayfields['p.multicurrency_total_tva']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Amount TTC - if (!empty($arrayfields['p.multicurrency_total_ttc']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Amount invoiced - if (!empty($arrayfields['p.multicurrency_total_ht_invoiced']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Amount invoiced - if (!empty($arrayfields['p.multicurrency_total_invoiced']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - - $userstatic->id = $obj->fk_user_author; - $userstatic->login = $obj->login; - $userstatic->lastname = $obj->lastname; - $userstatic->firstname = $obj->firstname; - $userstatic->email = $obj->user_email; - $userstatic->statut = $obj->user_statut; - $userstatic->entity = $obj->user_entity; - $userstatic->photo = $obj->photo; - $userstatic->office_phone = $obj->office_phone; - $userstatic->office_fax = $obj->office_fax; - $userstatic->user_mobile = $obj->user_mobile; - $userstatic->job = $obj->job; - $userstatic->gender = $obj->gender; - - // Author - if (!empty($arrayfields['u.login']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - - if (!empty($arrayfields['sale_representative']['checked'])) { - // Sales representatives - print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Total buying or cost price + if (!empty($arrayfields['total_pa']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Total margin + if (!empty($arrayfields['total_margin']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'total_margin'; + } + $totalarray['val']['total_margin'] = $total_margin; + } + // Total margin rate + if (!empty($arrayfields['total_margin_rate']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Total mark rate + if (!empty($arrayfields['total_mark_rate']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'total_mark_rate'; + } + if ($i >= $imaxinloop - 1) { + if (!empty($total_ht)) { + $totalarray['val']['total_mark_rate'] = price2num($total_margin * 100 / $total_ht, 'MT'); } else { - print ' '; - } - print ''; - if (!$i) { - $totalarray['nbfield']++; + $totalarray['val']['total_mark_rate'] = ''; } } - - // Total buying or cost price - if (!empty($arrayfields['total_pa']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Total margin - if (!empty($arrayfields['total_margin']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'total_margin'; - } - $totalarray['val']['total_margin'] = $total_margin; - } - // Total margin rate - if (!empty($arrayfields['total_margin_rate']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Total mark rate - if (!empty($arrayfields['total_mark_rate']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'total_mark_rate'; - } - if ($i >= $imaxinloop - 1) { - if (!empty($total_ht)) { - $totalarray['val']['total_mark_rate'] = price2num($total_margin * 100 / $total_ht, 'MT'); - } else { - $totalarray['val']['total_mark_rate'] = ''; - } - } - } - - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - // Date creation - if (!empty($arrayfields['p.datec']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date modification - if (!empty($arrayfields['p.tms']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date cloture - if (!empty($arrayfields['p.date_cloture']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Note public - if (!empty($arrayfields['p.note_public']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Note private - if (!empty($arrayfields['p.note_private']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Status - if (!empty($arrayfields['p.fk_statut']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Action column - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - - print ''."\n"; } - $i++; - } - - // Show total line - include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; - - // If no record found - if ($num == 0) { - $colspan = 1; - foreach ($arrayfields as $key => $val) { - if (!empty($val['checked'])) { - $colspan++; + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook + $parameters = array('arrayfields' => $arrayfields, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Date creation + if (!empty($arrayfields['p.datec']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; } } - print ''; - } - - $db->free($resql); - - $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); - $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - - print '
'; + $searchpicto = $form->showFilterButtons('left'); + print $searchpicto; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100'); + print ''; + print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0, '', 0, 0, 0, (!getDolGlobalString('SOCIETE_SORT_ON_TYPEENT') ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), '', 1); + print ajax_combobox('search_type_thirdparty'); + print ''; + print '
'; + print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print '
'; + print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); + print '
'; + print '
'; + print '
'; + print $form->selectDate($search_date_end_start ? $search_date_end_start : -1, 'search_date_end_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print '
'; + print $form->selectDate($search_date_end_end ? $search_date_end_end : -1, 'search_date_end_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); + print '
'; + print '
'; + print '
'; + print $form->selectDate($search_date_delivery_start ? $search_date_delivery_start : -1, 'search_date_delivery_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print '
'; + print $form->selectDate($search_date_delivery_end ? $search_date_delivery_end : -1, 'search_date_delivery_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print '
'; + print '
'; + print $form->selectDate($search_date_signature_start ? $search_date_signature_start : -1, 'search_date_signature_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print '
'; + print $form->selectDate($search_date_signature_end ? $search_date_signature_end : -1, 'search_date_signature_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print '
'; + $form->selectAvailabilityDelay($search_availability, 'search_availability', '', 1); + print ajax_combobox('search_availability'); + print ''; + $form->selectShippingMethod($search_fk_shipping_method, 'search_fk_shipping_method', '', 1, '', 1); + print ''; + $form->selectInputReason($search_fk_input_reason, 'search_fk_input_reason', '', 1, 'maxwidth125', 1); + print ''; + print $form->getSelectConditionsPaiements($search_fk_cond_reglement, 'search_fk_cond_reglement', 1, 1, 1); + print ''; + print $form->select_types_paiements($search_fk_mode_reglement, 'search_fk_mode_reglement', '', 0, 1, 1, 0, -1, '', 1); + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print $form->selectMultiCurrency($search_multicurrency_code, 'search_multicurrency_code', 1); + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + $formpropal->selectProposalStatus($search_status, 1, 0, 1, 'customer', 'search_status', 'search_status width100 onrightofpage'); + print ''; + $searchpicto = $form->showFilterButtons(); + print $searchpicto; + print '
'; + print '
'; + } + // Output Kanban + $userstatic->fetch($obj->fk_user_author); + $arrayofparams = array('selected' => in_array($object->id, $arrayofselected), 'authorlink' => $userstatic->getNomUrl(-2), 'projectlink' => $projectstatic->getNomUrl(2)); + print $objectstatic->getKanbanView('', $arrayofparams); + if ($i == ($imaxinloop - 1)) { + print '
'; + print '
'; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($obj->rowid, $arrayofselected)) { + $selected = 1; + } + print ''; + } + print ''; - print '
'; - print ''."\n"; + print '
'; + // Picto + Ref + print ''; + // Warning + $warnornote = ''; + if ($obj->status == Propal::STATUS_VALIDATED && $db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay)) { + $warnornote .= img_warning($langs->trans("Late")); + } + if ($warnornote) { + print ''; + } + // Other picto tool + print '
'; + print $objectstatic->getNomUrl(1, '', '', 0, 1, (isset($conf->global->PROPAL_LIST_SHOW_NOTES) ? $conf->global->PROPAL_LIST_SHOW_NOTES : 1)); + print ''; + print $warnornote; + print ''; + $filename = dol_sanitizeFileName($obj->ref); + $filedir = $conf->propal->multidir_output[$obj->propal_entity].'/'.dol_sanitizeFileName($obj->ref); + $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid; + print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); + print '
'; - print '
'; - $searchpicto = $form->showFilterButtons('left'); - print $searchpicto; - print ''; + print dol_escape_htmltag($obj->ref_client); + print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100'); - print ''; - print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0, '', 0, 0, 0, (!getDolGlobalString('SOCIETE_SORT_ON_TYPEENT') ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), '', 1); - print ajax_combobox('search_type_thirdparty'); - print ''; - print '
'; - print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); - print '
'; - print '
'; - print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); - print '
'; - print '
'; - print '
'; - print $form->selectDate($search_date_end_start ? $search_date_end_start : -1, 'search_date_end_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); - print '
'; - print '
'; - print $form->selectDate($search_date_end_end ? $search_date_end_end : -1, 'search_date_end_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); - print '
'; - print '
'; - print '
'; - print $form->selectDate($search_date_delivery_start ? $search_date_delivery_start : -1, 'search_date_delivery_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); - print '
'; - print '
'; - print $form->selectDate($search_date_delivery_end ? $search_date_delivery_end : -1, 'search_date_delivery_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); - print '
'; - print '
'; - print '
'; - print $form->selectDate($search_date_signature_start ? $search_date_signature_start : -1, 'search_date_signature_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); - print '
'; - print '
'; - print $form->selectDate($search_date_signature_end ? $search_date_signature_end : -1, 'search_date_signature_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); - print '
'; - print '
'; - $form->selectAvailabilityDelay($search_availability, 'search_availability', '', 1); - print ajax_combobox('search_availability'); - print ''; - $form->selectShippingMethod($search_fk_shipping_method, 'search_fk_shipping_method', '', 1, '', 1); - print ''; - $form->selectInputReason($search_fk_input_reason, 'search_fk_input_reason', '', 1, 'maxwidth125', 1); - print ''; - print $form->getSelectConditionsPaiements($search_fk_cond_reglement, 'search_fk_cond_reglement', 1, 1, 1); - print ''; - print $form->select_types_paiements($search_fk_mode_reglement, 'search_fk_mode_reglement', '', 0, 1, 1, 0, -1, '', 1); - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + if ($obj->project_id > 0) { + print $projectstatic->getNomUrl(1); + } + print ''; + if ($obj->project_id > 0) { + print dol_escape_htmltag($projectstatic->title); + } + print ''; + print $companystatic->getNomUrl(1, 'customer', 0, 0, 1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1); + print ''; + print $obj->alias; + print ''; + print dol_escape_htmltag($obj->town); + print ''; + print $obj->zip; + print '".$obj->state_name."'; + $tmparray = getCountry($obj->fk_pays, 'all'); + print $tmparray['label']; + print ''; + if (!empty($obj->typent_code)) { + print $typenArray[$obj->typent_code]; + } + print ''; + print dol_print_date($db->jdate($obj->dp), 'day'); + print "'.dol_print_date($db->jdate($obj->dfv), 'day'); + print ' '.dol_print_date($db->jdate($obj->ddelivery), 'day'); + print ' '.dol_print_date($db->jdate($obj->dsignature), 'day'); + print ' '; + $form->form_availability('', $obj->availability, 'none', 1); + print ''; + $form->formSelectShippingMethod('', $obj->fk_shipping_method, 'none', 1); + print ''; + print dol_escape_htmltag($labelInputReason); + print ''; + $form->form_conditions_reglement($_SERVER['PHP_SELF'], $obj->fk_cond_reglement, 'none', 0, '', 1, $obj->deposit_percent); + print ''; + $form->form_modes_reglement($_SERVER['PHP_SELF'], $obj->fk_mode_reglement, 'none', '', -1); + print ''.price($obj->total_ht)."'.price($obj->total_tva)."'.price($obj->total_ttc)."'.price($totalInvoicedHT)."'.price($totalInvoicedTTC)."'; - print $form->selectMultiCurrency($search_multicurrency_code, 'search_multicurrency_code', 1); - print ''.$obj->multicurrency_code.' - '.$langs->trans('Currency'.$obj->multicurrency_code)."'; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code); + print "'.price($obj->multicurrency_total_ht)."'.price($obj->multicurrency_total_tva)."'.price($obj->multicurrency_total_ttc)."'; - print ''.price($multicurrency_totalInvoicedHT)."'; - print ''.price($multicurrency_totalInvoicedTTC)."'; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - $formpropal->selectProposalStatus($search_status, 1, 0, 1, 'customer', 'search_status', 'search_status width100 onrightofpage'); - print ''; - $searchpicto = $form->showFilterButtons(); - print $searchpicto; - print '
'; + if ($userstatic->id) { + print $userstatic->getNomUrl(-1); + } + print "
'; - print '
'; - } - // Output Kanban - $userstatic->fetch($obj->fk_user_author); - $arrayofparams = array('selected' => in_array($object->id, $arrayofselected), 'authorlink' => $userstatic->getNomUrl(-2), 'projectlink' => $projectstatic->getNomUrl(2)); - print $objectstatic->getKanbanView('', $arrayofparams); - if ($i == ($imaxinloop - 1)) { - print '
'; - print '
'; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($obj->rowid, $arrayofselected)) { - $selected = 1; - } - print ''; + if (!empty($arrayfields['sale_representative']['checked'])) { + // Sales representatives + print ''; + if ($obj->socid > 0) { + $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user); + if ($listsalesrepresentatives < 0) { + dol_print_error($db); } - print ''; - - print ''; - // Picto + Ref - print ''; - // Warning - $warnornote = ''; - if ($obj->status == Propal::STATUS_VALIDATED && $db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay)) { - $warnornote .= img_warning($langs->trans("Late")); - } - if ($warnornote) { - print ''; - } - // Other picto tool - print '
'; - print $objectstatic->getNomUrl(1, '', '', 0, 1, (isset($conf->global->PROPAL_LIST_SHOW_NOTES) ? $conf->global->PROPAL_LIST_SHOW_NOTES : 1)); - print ''; - print $warnornote; - print ''; - $filename = dol_sanitizeFileName($obj->ref); - $filedir = $conf->propal->multidir_output[$obj->propal_entity].'/'.dol_sanitizeFileName($obj->ref); - $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid; - print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); - print '
'; - - print "
'; - print dol_escape_htmltag($obj->ref_client); - print ''; - if ($obj->project_id > 0) { - print $projectstatic->getNomUrl(1); - } - print ''; - if ($obj->project_id > 0) { - print dol_escape_htmltag($projectstatic->title); - } - print ''; - print $companystatic->getNomUrl(1, 'customer', 0, 0, 1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1); - print ''; - print $obj->alias; - print ''; - print dol_escape_htmltag($obj->town); - print ''; - print $obj->zip; - print '".$obj->state_name."'; - $tmparray = getCountry($obj->fk_pays, 'all'); - print $tmparray['label']; - print ''; - if (!empty($obj->typent_code)) { - print $typenArray[$obj->typent_code]; - } - print ''; - print dol_print_date($db->jdate($obj->dp), 'day'); - print "'.dol_print_date($db->jdate($obj->dfv), 'day'); - print ' '.dol_print_date($db->jdate($obj->ddelivery), 'day'); - print ' '.dol_print_date($db->jdate($obj->dsignature), 'day'); - print ' '; - $form->form_availability('', $obj->availability, 'none', 1); - print ''; - $form->formSelectShippingMethod('', $obj->fk_shipping_method, 'none', 1); - print ''; - print dol_escape_htmltag($labelInputReason); - print ''; - $form->form_conditions_reglement($_SERVER['PHP_SELF'], $obj->fk_cond_reglement, 'none', 0, '', 1, $obj->deposit_percent); - print ''; - $form->form_modes_reglement($_SERVER['PHP_SELF'], $obj->fk_mode_reglement, 'none', '', -1); - print ''.price($obj->total_ht)."'.price($obj->total_tva)."'.price($obj->total_ttc)."'.price($totalInvoicedHT)."'.price($totalInvoicedTTC)."'.$obj->multicurrency_code.' - '.$langs->trans('Currency'.$obj->multicurrency_code)."'; - $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code); - print "'.price($obj->multicurrency_total_ht)."'.price($obj->multicurrency_total_tva)."'.price($obj->multicurrency_total_ttc)."'.price($multicurrency_totalInvoicedHT)."'.price($multicurrency_totalInvoicedTTC)."'; - if ($userstatic->id) { - print $userstatic->getNomUrl(-1); - } - print "'; - if ($obj->socid > 0) { - $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user); - if ($listsalesrepresentatives < 0) { - dol_print_error($db); - } - $nbofsalesrepresentative = count($listsalesrepresentatives); - if ($nbofsalesrepresentative > 6) { - // We print only number - print $nbofsalesrepresentative; - } elseif ($nbofsalesrepresentative > 0) { - $userstatic = new User($db); - $j = 0; - foreach ($listsalesrepresentatives as $val) { - $userstatic->id = $val['id']; - $userstatic->lastname = $val['lastname']; - $userstatic->firstname = $val['firstname']; - $userstatic->email = $val['email']; - $userstatic->statut = $val['statut']; - $userstatic->entity = $val['entity']; - $userstatic->photo = $val['photo']; - $userstatic->login = $val['login']; - $userstatic->office_phone = $val['office_phone']; - $userstatic->office_fax = $val['office_fax']; - $userstatic->user_mobile = $val['user_mobile']; - $userstatic->job = $val['job']; - $userstatic->gender = $val['gender']; - //print '
': - print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2); - $j++; - if ($j < $nbofsalesrepresentative) { - print ' '; - } - //print '
'; + $nbofsalesrepresentative = count($listsalesrepresentatives); + if ($nbofsalesrepresentative > 6) { + // We print only number + print $nbofsalesrepresentative; + } elseif ($nbofsalesrepresentative > 0) { + $userstatic = new User($db); + $j = 0; + foreach ($listsalesrepresentatives as $val) { + $userstatic->id = $val['id']; + $userstatic->lastname = $val['lastname']; + $userstatic->firstname = $val['firstname']; + $userstatic->email = $val['email']; + $userstatic->statut = $val['statut']; + $userstatic->entity = $val['entity']; + $userstatic->photo = $val['photo']; + $userstatic->login = $val['login']; + $userstatic->office_phone = $val['office_phone']; + $userstatic->office_fax = $val['office_fax']; + $userstatic->user_mobile = $val['user_mobile']; + $userstatic->job = $val['job']; + $userstatic->gender = $val['gender']; + //print '
': + print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2); + $j++; + if ($j < $nbofsalesrepresentative) { + print ' '; } + //print '
'; } - //else print $langs->trans("NoSalesRepresentativeAffected"); + } + //else print $langs->trans("NoSalesRepresentativeAffected"); + } else { + print ' '; + } + print '
'.price($marginInfo['pa_total']).''.price($marginInfo['total_margin']).''.(($marginInfo['total_margin_rate'] == '') ? '' : price($marginInfo['total_margin_rate'], 0, null, null, null, 2).'%').''.(($marginInfo['total_mark_rate'] == '') ? '' : price($marginInfo['total_mark_rate'], 0, null, null, null, 2).'%').''.price($marginInfo['pa_total']).''.price($marginInfo['total_margin']).''.(($marginInfo['total_margin_rate'] == '') ? '' : price($marginInfo['total_margin_rate'], 0, null, null, null, 2).'%').''.(($marginInfo['total_mark_rate'] == '') ? '' : price($marginInfo['total_mark_rate'], 0, null, null, null, 2).'%').''; - print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); - print ''; - print dol_print_date($db->jdate($obj->date_modification), 'dayhour', 'tzuser'); - print ''; - print dol_print_date($db->jdate($obj->date_cloture), 'dayhour', 'tzuser'); - print ''; - print dol_string_nohtmltag($obj->note_public); - print ''; - print dol_string_nohtmltag($obj->note_private); - print ''.$objectstatic->getLibStatut(5).''; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($obj->rowid, $arrayofselected)) { - $selected = 1; - } - print ''; - } - print '
'; + print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); + print '
'.$langs->trans("NoRecordFound").'
'."\n"; - print '
'."\n"; - - print ''."\n"; - - if (in_array('builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords === '' || $nbtotalofrecords)) { - $hidegeneratedfilelistifempty = 1; - if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) { - $hidegeneratedfilelistifempty = 0; + // Date modification + if (!empty($arrayfields['p.tms']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_modification), 'dayhour', 'tzuser'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Date cloture + if (!empty($arrayfields['p.date_cloture']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_cloture), 'dayhour', 'tzuser'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Note public + if (!empty($arrayfields['p.note_public']['checked'])) { + print ''; + print dol_string_nohtmltag($obj->note_public); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Note private + if (!empty($arrayfields['p.note_private']['checked'])) { + print ''; + print dol_string_nohtmltag($obj->note_private); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Status + if (!empty($arrayfields['p.fk_statut']['checked'])) { + print ''.$objectstatic->getLibStatut(5).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($obj->rowid, $arrayofselected)) { + $selected = 1; + } + print ''; + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; - $formfile = new FormFile($db); - // Show list of available documents - $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; - $urlsource .= str_replace('&', '&', $param); - - $filedir = $diroutputmassaction; - $genallowed = $permissiontoread; - $delallowed = $permissiontoadd; - - print $formfile->showdocuments('massfilesarea_proposals', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); + print ''."\n"; } - // End of page - llxFooter(); - $db->close(); + $i++; +} + +// Show total line +include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; + +// If no record found +if ($num == 0) { + $colspan = 1; + foreach ($arrayfields as $key => $val) { + if (!empty($val['checked'])) { + $colspan++; + } + } + print ''.$langs->trans("NoRecordFound").''; +} + +$db->free($resql); + +$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql); +$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; + +print ''."\n"; +print ''."\n"; + +print ''."\n"; + +if (in_array('builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords === '' || $nbtotalofrecords)) { + $hidegeneratedfilelistifempty = 1; + if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) { + $hidegeneratedfilelistifempty = 0; + } + + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; + $formfile = new FormFile($db); + + // Show list of available documents + $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; + $urlsource .= str_replace('&', '&', $param); + + $filedir = $diroutputmassaction; + $genallowed = $permissiontoread; + $delallowed = $permissiontoadd; + + print $formfile->showdocuments('massfilesarea_proposals', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); +} + +// End of page +llxFooter(); +$db->close(); From 0c91e3fe068af441c38b38796a6914f35eff19b1 Mon Sep 17 00:00:00 2001 From: Jon Bendtsen Date: Sat, 9 Mar 2024 22:01:30 +0100 Subject: [PATCH 179/709] attempt at fixing #28645 --- htdocs/compta/bank/class/api_bankaccounts.class.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php index 2f5f532e746..5dcb390ace3 100644 --- a/htdocs/compta/bank/class/api_bankaccounts.class.php +++ b/htdocs/compta/bank/class/api_bankaccounts.class.php @@ -187,6 +187,7 @@ class BankAccounts extends DolibarrApi * @param string $description Description of the internal wire transfer {@from body}{@required true} * @param float $amount Amount to transfer from the source to the destination BankAccount {@from body}{@required true} * @param float $amount_to Amount to transfer to the destination BankAccount (only when accounts does not share the same currency) {@from body}{@required false} + * @param string $cheque_number Cheque numero {@from body} * * @url POST /transfer * @@ -199,7 +200,7 @@ class BankAccounts extends DolibarrApi * @throws RestException 422 Unprocessable Entity: Refer to detailed exception message for the cause * @throws RestException 500 Internal Server Error: Error(s) returned by the RDBMS */ - public function transfer($bankaccount_from_id = 0, $bankaccount_to_id = 0, $date = null, $description = "", $amount = 0.0, $amount_to = 0.0) + public function transfer($bankaccount_from_id = 0, $bankaccount_to_id = 0, $date = null, $description = "", $amount = 0.0, $amount_to = 0.0, $cheque_number = "" ) { if (!DolibarrApiAccess::$user->hasRight('banque', 'configurer')) { throw new RestException(403); @@ -257,21 +258,21 @@ class BankAccounts extends DolibarrApi // Clean data $description = sanitizeVal($description, 'alphanohtml'); - + $cheque_number = sanitizeVal($cheque_number); /** * Creating bank line records */ if (!$error) { - $bank_line_id_from = $accountfrom->addline($date, $typefrom, $description, -1 * price2num($amount), '', '', $user); + $bank_line_id_from = $accountfrom->addline($date, $typefrom, $description, -1 * price2num($amount), '', '', $user, $cheque_number); } if (!($bank_line_id_from > 0)) { $error++; } if (!$error) { - $bank_line_id_to = $accountto->addline($date, $typeto, $description, price2num($amount_to), '', '', $user); + $bank_line_id_to = $accountto->addline($date, $typeto, $description, price2num($amount_to), '', '', $user, $cheque_number); } if (!($bank_line_id_to > 0)) { $error++; From 95d644615c71c4cf8a34712274fb6fa2756919c2 Mon Sep 17 00:00:00 2001 From: Jon Bendtsen Date: Sat, 9 Mar 2024 22:14:02 +0100 Subject: [PATCH 180/709] remove trailing whitespace --- htdocs/compta/bank/class/api_bankaccounts.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php index 5dcb390ace3..47eb9bf84a6 100644 --- a/htdocs/compta/bank/class/api_bankaccounts.class.php +++ b/htdocs/compta/bank/class/api_bankaccounts.class.php @@ -200,7 +200,7 @@ class BankAccounts extends DolibarrApi * @throws RestException 422 Unprocessable Entity: Refer to detailed exception message for the cause * @throws RestException 500 Internal Server Error: Error(s) returned by the RDBMS */ - public function transfer($bankaccount_from_id = 0, $bankaccount_to_id = 0, $date = null, $description = "", $amount = 0.0, $amount_to = 0.0, $cheque_number = "" ) + public function transfer($bankaccount_from_id = 0, $bankaccount_to_id = 0, $date = null, $description = "", $amount = 0.0, $amount_to = 0.0, $cheque_number = "") { if (!DolibarrApiAccess::$user->hasRight('banque', 'configurer')) { throw new RestException(403); From 668d2fa6e88b0cfdcd9e71efeb54b41f197cdf7f Mon Sep 17 00:00:00 2001 From: Jon Bendtsen Date: Sat, 9 Mar 2024 22:43:53 +0100 Subject: [PATCH 181/709] making param string cheque_number line up and conform better with previous code --- htdocs/compta/bank/class/api_bankaccounts.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php index 47eb9bf84a6..c2f57b76056 100644 --- a/htdocs/compta/bank/class/api_bankaccounts.class.php +++ b/htdocs/compta/bank/class/api_bankaccounts.class.php @@ -187,7 +187,7 @@ class BankAccounts extends DolibarrApi * @param string $description Description of the internal wire transfer {@from body}{@required true} * @param float $amount Amount to transfer from the source to the destination BankAccount {@from body}{@required true} * @param float $amount_to Amount to transfer to the destination BankAccount (only when accounts does not share the same currency) {@from body}{@required false} - * @param string $cheque_number Cheque numero {@from body} + * @param string $cheque_number Cheque numero {@from body}{@required false} * * @url POST /transfer * From cecd3bc1b61d7c065faae45cbe88dbfb8cd861ef Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 9 Mar 2024 23:46:38 +0100 Subject: [PATCH 182/709] FIX Picto in top menu --- htdocs/core/menus/standard/auguria.lib.php | 2 ++ htdocs/core/menus/standard/eldy.lib.php | 2 ++ htdocs/core/menus/standard/empty.php | 8 +++++++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index 60480d6c9cb..dbed17b95d5 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -242,6 +242,8 @@ function print_text_menu_entry_auguria($text, $showmode, $url, $id, $idsel, $cla if (!empty($menuval['prefix']) && strpos($menuval['prefix'], ''; } else { print ''; } diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 1cf504a30fd..141e0e02c65 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -656,6 +656,8 @@ function print_text_menu_entry($text, $showmode, $url, $id, $idsel, $classname, print '
'; if (!empty($menuval['prefix']) && strpos($menuval['prefix'], ''; } else { print ''; } diff --git a/htdocs/core/menus/standard/empty.php b/htdocs/core/menus/standard/empty.php index 542cb1a493a..01282aff09f 100644 --- a/htdocs/core/menus/standard/empty.php +++ b/htdocs/core/menus/standard/empty.php @@ -523,7 +523,13 @@ function print_text_menu_entry_empty($text, $showmode, $url, $id, $idsel, $class if ($showmode == 1) { print ''; print '
'; - print ''; + if (!empty($menuval['prefix']) && strpos($menuval['prefix'], ''; + } else { + print ''; + } print '
'; print '
'; if (!getDolGlobalString('THEME_TOPMENU_DISABLE_TEXT')) { From 8ef22dc461487bd9942cf8d2613f53056eb2f6eb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 10 Mar 2024 00:47:00 +0100 Subject: [PATCH 183/709] Fix css --- htdocs/bookmarks/card.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/bookmarks/card.php b/htdocs/bookmarks/card.php index 7bebdcb2af7..8dd22d694ca 100644 --- a/htdocs/bookmarks/card.php +++ b/htdocs/bookmarks/card.php @@ -228,6 +228,7 @@ if ($id > 0 && !preg_match('/^add/i', $action)) { print '
'; print ''; + // Title print ''; + // URL print ''; print ''; print '
'; if ($action == 'edit') { print ''; @@ -247,6 +248,7 @@ if ($id > 0 && !preg_match('/^add/i', $action)) { } print '
'; if ($action == 'edit') { print ''; @@ -255,7 +257,7 @@ if ($id > 0 && !preg_match('/^add/i', $action)) { if ($action == 'edit') { print ''; } - print ''; + print ''; if ($action == 'edit') { print 'url).'">'; } else { From c6fa4e49453e9e90a7f0411c93701ba231b900cd Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 9 Mar 2024 20:44:47 +0100 Subject: [PATCH 184/709] Qual: Enable reporting PhanTypeMismatchDimAssignment --- dev/tools/phan/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php index ee9cde2603f..f2fe12ea94c 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -448,7 +448,7 @@ return [ 'PhanRedefineClass', 'PhanRedefineFunction', 'PhanTypeInvalidLeftOperandOfBitwiseOp', - 'PhanTypeMismatchDimAssignment', + // 'PhanTypeMismatchDimAssignment', // 'PhanPluginDescriptionlessCommentOnProtectedMethod', 'PhanPluginPrintfIncompatibleArgumentTypeWeak', 'PhanUndeclaredVariableAssignOp', From 101d56a2c1ae4c919a20381d2a796e9a5acfcb32 Mon Sep 17 00:00:00 2001 From: MDW Date: Sun, 10 Mar 2024 15:17:58 +0100 Subject: [PATCH 185/709] Fix: Ob buffer cleanup on exception # Fix: Ob buffer cleanup on exception The OB buffer capture was incorrectly cleaned up on exception. This fixes that. Also modified the SecurityTest to enable running it standalone --- htdocs/core/lib/functions.lib.php | 10 ++++++++++ test/phpunit/CommonClassTest.class.php | 5 +++++ test/phpunit/SecurityTest.php | 7 ++++--- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index c43dd851c78..57f785261ea 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9839,6 +9839,7 @@ function dol_eval($s, $returnvalue = 1, $hideerrors = 1, $onlysimplestring = '1' global $object; global $obj; // To get $obj used into list when dol_eval() is used for computed fields and $obj is not yet $object + $isObBufferActive = false; // When true, the ObBuffer must be cleaned in the exception handler if (!in_array($onlysimplestring, array('0', '1', '2'))) { return "Bad call of dol_eval. Parameter onlysimplestring must be '0' (deprecated), '1' or '2'"; } @@ -9957,16 +9958,20 @@ function dol_eval($s, $returnvalue = 1, $hideerrors = 1, $onlysimplestring = '1' if ($returnvalue) { if ($hideerrors) { ob_start(); // An evaluation has no reason to output data + $isObBufferActive = true; $tmps = @eval('return '.$s.';'); $tmpo = ob_get_clean(); + $isObBufferActive = false; if ($tmpo) { print 'Bad string syntax to evaluate. Some data were output when it should not when evaluating: '.$s; } return $tmps; } else { ob_start(); // An evaluation has no reason to output data + $isObBufferActive = true; $tmps = eval('return '.$s.';'); $tmpo = ob_get_clean(); + $isObBufferActive = false; if ($tmpo) { print 'Bad string syntax to evaluate. Some data were output when it should not when evaluating: '.$s; } @@ -9981,6 +9986,11 @@ function dol_eval($s, $returnvalue = 1, $hideerrors = 1, $onlysimplestring = '1' } } } catch (Error $e) { + if ($isObBufferActive) { + // Clean up buffer which was left behind due to exception. + $tmpo = ob_get_clean(); + $isObBufferActive = false; + } $error = 'dol_eval try/catch error : '; $error .= $e->getMessage(); dol_syslog($error, LOG_WARNING); diff --git a/test/phpunit/CommonClassTest.class.php b/test/phpunit/CommonClassTest.class.php index 2be3f58362f..a7c793ed9bf 100644 --- a/test/phpunit/CommonClassTest.class.php +++ b/test/phpunit/CommonClassTest.class.php @@ -26,11 +26,16 @@ * \remarks Class that extends all PHPunit tests. To share similare code between each test. */ +// Workaround for false security issue with main.inc.php in tests: +$_SERVER['PHP_SELF'] = "phpunit"; + global $conf,$user,$langs,$db; //define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver //require_once 'PHPUnit/Autoload.php'; require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; + + if (empty($user->id)) { print "Load permissions for admin user nb 1\n"; $user->fetch(1); diff --git a/test/phpunit/SecurityTest.php b/test/phpunit/SecurityTest.php index 8a154897acb..42455c49cef 100644 --- a/test/phpunit/SecurityTest.php +++ b/test/phpunit/SecurityTest.php @@ -53,10 +53,11 @@ if (! defined("NOSESSION")) { define("NOSESSION", '1'); } -require_once dirname(__FILE__).'/../../htdocs/main.inc.php'; +// Implements workaround for PHP_SELF & includes common files: +require_once dirname(__FILE__).'/CommonClassTest.class.php'; + require_once dirname(__FILE__).'/../../htdocs/core/lib/security.lib.php'; require_once dirname(__FILE__).'/../../htdocs/core/lib/security2.lib.php'; -require_once dirname(__FILE__).'/CommonClassTest.class.php'; if (empty($user->id)) { print "Load permissions for admin user nb 1\n"; @@ -988,7 +989,7 @@ class SecurityTest extends CommonClassTest include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; include_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; - $result=dol_eval('1==1', 1, 0); + $result = dol_eval('1==1', 1, 0); print "result1 = ".$result."\n"; $this->assertTrue($result); From 453eb9c242c3f75d96e1cadc0cfa4f70345f3317 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 10 Mar 2024 15:42:38 +0100 Subject: [PATCH 186/709] FIX: upload odt files should not start/end with space --- htdocs/admin/facture.php | 2 ++ htdocs/core/lib/files.lib.php | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index 3384a0d31d6..19f1182e608 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -50,6 +50,8 @@ $label = GETPOST('label', 'alpha'); $scandir = GETPOST('scan_dir', 'alpha'); $type = 'invoice'; +$error = 0; + /* * Actions diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 7152e2778bb..b170c4fc177 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1777,6 +1777,7 @@ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesess // var_dump($result);exit; if ($result >= 0) { $TFile = $_FILES[$varfiles]; + // Convert value of $TFile if (!is_array($TFile['name'])) { foreach ($TFile as $key => &$val) { $val = array($val); @@ -1791,13 +1792,13 @@ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesess } // Define $destfull (path to file including filename) and $destfile (only filename) - $destfull = $upload_dir."/".$TFile['name'][$i]; - $destfile = $TFile['name'][$i]; + $destfile = trim($TFile['name'][$i]); + $destfull = $upload_dir."/".$destfile; $destfilewithoutext = preg_replace('/\.[^\.]+$/', '', $destfile); if ($savingdocmask && strpos($savingdocmask, $destfilewithoutext) !== 0) { - $destfull = $upload_dir."/".preg_replace('/__file__/', $TFile['name'][$i], $savingdocmask); - $destfile = preg_replace('/__file__/', $TFile['name'][$i], $savingdocmask); + $destfile = trim(preg_replace('/__file__/', $TFile['name'][$i], $savingdocmask)); + $destfull = $upload_dir."/".$destfile; } $filenameto = basename($destfile); @@ -1806,7 +1807,6 @@ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesess setEventMessages($langs->trans("ErrorFilenameCantStartWithDot", $filenameto), null, 'errors'); break; } - // dol_sanitizeFileName the file name and lowercase extension $info = pathinfo($destfull); $destfull = $info['dirname'].'/'.dol_sanitizeFileName($info['filename'].($info['extension'] != '' ? ('.'.strtolower($info['extension'])) : '')); From 1431582b82c91c480662a6a7abebd4733006621d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 11 Mar 2024 10:10:17 +0100 Subject: [PATCH 187/709] Fix cursor --- htdocs/admin/tools/dolibarr_export.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index 3c70bdc74aa..749674956c0 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -203,7 +203,7 @@ print '
'; print '
'; -print img_picto('', 'setup', 'class="pictofixedwidth"').''.$langs->trans("ShowAdvancedOptions").'...'; +print img_picto('', 'setup', 'class="pictofixedwidth"').''.$langs->trans("ShowAdvancedOptions").'...'; print '
'; print ' + '; + } + + // Add link to add AI content + if ($formmail->withaiprompt && isModEnabled('ai')) { + $out .= ''; + $out .= img_picto($langs->trans("FillMessageWithAIContent"), 'ai', 'class="paddingrightonly"'); + $out .= $langs->trans("FillMessageWithAIContent").'...'; + $out .= ''; + $out .= ''; + } + if ($formmail->withfckeditor) { + $out .= $formmail->getModelEmailTemplate(); + } + if ($formmail->withaiprompt && isModEnabled('ai')) { + $out .= $formmail->getSectionForAIPrompt(); + } + print $out; + print '
'; print '
'; From bb64871b355c43f0940560311ab9bbf866493bd0 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 15:23:43 +0100 Subject: [PATCH 229/709] Qual: Precise typing for Societeaccount's fields property (#28758) # Qual: Precise typing for Societeaccount's fields property Better typing helps static analysis and fixes the message: PhanTypeMismatchArgumentInternal Argument 2 ($array) is $object->fields['site']['arrayofkeyval'] of type null but \array_key_exists() takes array --- htdocs/societe/class/societeaccount.class.php | 44 ++++++++++--------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/htdocs/societe/class/societeaccount.class.php b/htdocs/societe/class/societeaccount.class.php index c4a3f1fa824..cff6d5e7af5 100644 --- a/htdocs/societe/class/societeaccount.class.php +++ b/htdocs/societe/class/societeaccount.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2015 Florian Henry * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -75,30 +76,31 @@ class SocieteAccount extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ + public $fields = array( - 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>-2, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>'Id',), - 'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>0, 'enabled'=>1, 'position'=>5, 'default'=>1), - 'login' => array('type'=>'varchar(64)', 'label'=>'Login', 'visible'=>1, 'enabled'=>1, 'notnull'=>1, 'position'=>10, 'showoncombobox'=>1), - 'pass_encoding' => array('type'=>'varchar(24)', 'label'=>'PassEncoding', 'visible'=>0, 'enabled'=>1, 'position'=>30), - 'pass_crypted' => array('type'=>'password', 'label'=>'Password', 'visible'=>-1, 'enabled'=>1, 'position'=>31, 'notnull'=>1), - 'pass_temp' => array('type'=>'varchar(128)', 'label'=>'Temp', 'visible'=>0, 'enabled'=>0, 'position'=>32, 'notnull'=>-1,), - 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1, 'index'=>1, 'picto'=>'company', 'css'=>'maxwidth300 widthcentpercentminusxx'), - 'site' => array('type'=>'varchar(128)', 'label'=>'WebsiteTypeLabel', 'visible'=>0, 'enabled'=>0, 'position'=>41, 'notnull'=>1, 'default' => '', 'help'=>'Name of the website or service if this is account on an external website or service'), - 'fk_website' => array('type'=>'integer:Website:website/class/website.class.php', 'label'=>'WebSite', 'visible'=>0, 'enabled'=>0, 'position'=>42, 'notnull'=>-1, 'index'=>1, 'picto'=>'website', 'css'=>'maxwidth300 widthcentpercentminusxx'), - 'site_account' => array('type'=>'varchar(128)', 'label'=>'ExternalSiteAccount', 'visible'=>0, 'enabled'=>1, 'position'=>44, 'help'=>'A key to identify the account on external web site if this is an account on an external website'), - 'key_account' => array('type'=>'varchar(128)', 'label'=>'KeyAccount', 'visible'=>0, 'enabled'=>1, 'position'=>48, 'notnull'=>0, 'index'=>1, 'searchall'=>1, 'comment'=>'The id of third party in the external web site (for site_account if site_account defined)',), - 'date_last_login' => array('type'=>'datetime', 'label'=>'LastConnexion', 'visible'=>2, 'enabled'=>1, 'position'=>50, 'notnull'=>0,), - 'date_previous_login' => array('type'=>'datetime', 'label'=>'PreviousConnexion', 'visible'=>2, 'enabled'=>1, 'position'=>51, 'notnull'=>0,), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'visible' => -2, 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'index' => 1, 'comment' => 'Id',), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'visible' => 0, 'enabled' => 1, 'position' => 5, 'default' => 1), + 'login' => array('type' => 'varchar(64)', 'label' => 'Login', 'visible' => 1, 'enabled' => 1, 'notnull' => 1, 'position' => 10, 'showoncombobox' => 1), + 'pass_encoding' => array('type' => 'varchar(24)', 'label' => 'PassEncoding', 'visible' => 0, 'enabled' => 1, 'position' => 30), + 'pass_crypted' => array('type' => 'password', 'label' => 'Password', 'visible' => -1, 'enabled' => 1, 'position' => 31, 'notnull' => 1), + 'pass_temp' => array('type' => 'varchar(128)', 'label' => 'Temp', 'visible' => 0, 'enabled' => 0, 'position' => 32, 'notnull' => -1,), + 'fk_soc' => array('type' => 'integer:Societe:societe/class/societe.class.php', 'label' => 'ThirdParty', 'visible' => 1, 'enabled' => 1, 'position' => 40, 'notnull' => -1, 'index' => 1, 'picto' => 'company', 'css' => 'maxwidth300 widthcentpercentminusxx'), + 'site' => array('type' => 'varchar(128)', 'label' => 'WebsiteTypeLabel', 'visible' => 0, 'enabled' => 0, 'position' => 41, 'notnull' => 1, 'default' => '', 'help' => 'Name of the website or service if this is account on an external website or service'), + 'fk_website' => array('type' => 'integer:Website:website/class/website.class.php', 'label' => 'WebSite', 'visible' => 0, 'enabled' => 0, 'position' => 42, 'notnull' => -1, 'index' => 1, 'picto' => 'website', 'css' => 'maxwidth300 widthcentpercentminusxx'), + 'site_account' => array('type' => 'varchar(128)', 'label' => 'ExternalSiteAccount', 'visible' => 0, 'enabled' => 1, 'position' => 44, 'help' => 'A key to identify the account on external web site if this is an account on an external website'), + 'key_account' => array('type' => 'varchar(128)', 'label' => 'KeyAccount', 'visible' => 0, 'enabled' => 1, 'position' => 48, 'notnull' => 0, 'index' => 1, 'searchall' => 1, 'comment' => 'The id of third party in the external web site (for site_account if site_account defined)',), + 'date_last_login' => array('type' => 'datetime', 'label' => 'LastConnexion', 'visible' => 2, 'enabled' => 1, 'position' => 50, 'notnull' => 0,), + 'date_previous_login' => array('type' => 'datetime', 'label' => 'PreviousConnexion', 'visible' => 2, 'enabled' => 1, 'position' => 51, 'notnull' => 0,), //'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'visible'=>-1, 'enabled'=>1, 'position'=>45, 'notnull'=>-1,), - 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'visible'=>-1, 'enabled'=>1, 'position'=>46, 'notnull'=>-1,), - 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>-2, 'enabled'=>1, 'position'=>500, 'notnull'=>1,), - 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-2, 'enabled'=>1, 'position'=>500, 'notnull'=>1,), - 'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', 'visible'=>-2, 'enabled'=>1, 'position'=>500, 'notnull'=>1,), - 'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'visible'=>-2, 'enabled'=>1, 'position'=>500, 'notnull'=>-1,), - 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'visible'=>-2, 'enabled'=>1, 'position'=>1000, 'notnull'=>-1, 'index'=>1,), - 'status' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>1000, 'notnull'=>1, 'index'=>1, 'default'=>1, 'arrayofkeyval'=>array('1'=>'Active', '0'=>'Disabled')), + 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'visible' => -1, 'enabled' => 1, 'position' => 46, 'notnull' => -1,), + 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'visible' => -2, 'enabled' => 1, 'position' => 500, 'notnull' => 1,), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'visible' => -2, 'enabled' => 1, 'position' => 500, 'notnull' => 1,), + 'fk_user_creat' => array('type' => 'integer', 'label' => 'UserAuthor', 'visible' => -2, 'enabled' => 1, 'position' => 500, 'notnull' => 1,), + 'fk_user_modif' => array('type' => 'integer', 'label' => 'UserModif', 'visible' => -2, 'enabled' => 1, 'position' => 500, 'notnull' => -1,), + 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'visible' => -2, 'enabled' => 1, 'position' => 1000, 'notnull' => -1, 'index' => 1,), + 'status' => array('type' => 'integer', 'label' => 'Status', 'visible' => 1, 'enabled' => 1, 'position' => 1000, 'notnull' => 1, 'index' => 1, 'default' => 1, 'arrayofkeyval' => array('1' => 'Active', '0' => 'Disabled')), ); /** From a8a2f0ff7308ca478251999da63950d4f1c02374 Mon Sep 17 00:00:00 2001 From: terhoy <70033666+terhoy@users.noreply.github.com> Date: Mon, 11 Mar 2024 15:33:10 +0100 Subject: [PATCH 230/709] =?UTF-8?q?FIX:=20online=20signature=20partly=20fa?= =?UTF-8?q?ils=20if=20commercial=20proposal=20numbering=20contains=20a=20m?= =?UTF-8?q?ask=20that=E2=80=99s=20includes=20a=20space=20(#28608)=20=20(#2?= =?UTF-8?q?8742)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * FIX: online signature (#28608) Update signature.lib.php If Commercial proposal numbering contains a mask that’s includes a space, that will affect the result of the online signature form. When generating the online signature form, the code in signature.lib.php line 77, will remove any existing space in the Commercial proposal numbering. The result is that the online signature form will miss data in field “Third-party” and “Amount”. * FIX: online signature (#28608) Update payments.lib.php If Commercial proposal numbering contains a mask that’s includes a space, that will affect the result of the online signature form. When generating the online signature form, the code in core/lib/payments.lib.ph, will remove any existing space in the Commercial proposal numbering. --- htdocs/core/lib/payments.lib.php | 1 - htdocs/core/lib/signature.lib.php | 1 - 2 files changed, 2 deletions(-) diff --git a/htdocs/core/lib/payments.lib.php b/htdocs/core/lib/payments.lib.php index 2c496401768..e8532129b53 100644 --- a/htdocs/core/lib/payments.lib.php +++ b/htdocs/core/lib/payments.lib.php @@ -242,7 +242,6 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = 0, $freetag = 'y { global $conf, $dolibarr_main_url_root; - $ref = str_replace(' ', '', $ref); $out = ''; // Define $urlwithroot diff --git a/htdocs/core/lib/signature.lib.php b/htdocs/core/lib/signature.lib.php index 0290ec78080..d56cd662e9d 100644 --- a/htdocs/core/lib/signature.lib.php +++ b/htdocs/core/lib/signature.lib.php @@ -74,7 +74,6 @@ function getOnlineSignatureUrl($mode, $type, $ref = '', $localorexternal = 1, $o } } - $ref = str_replace(' ', '', $ref); $out = ''; // Define $urlwithroot From f7024b61ee6797e02f2c969dda280d53668c707b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 11 Mar 2024 15:37:16 +0100 Subject: [PATCH 231/709] Update api_bankaccounts.class.php --- htdocs/compta/bank/class/api_bankaccounts.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php index c2f57b76056..bc973b0045b 100644 --- a/htdocs/compta/bank/class/api_bankaccounts.class.php +++ b/htdocs/compta/bank/class/api_bankaccounts.class.php @@ -258,7 +258,7 @@ class BankAccounts extends DolibarrApi // Clean data $description = sanitizeVal($description, 'alphanohtml'); - $cheque_number = sanitizeVal($cheque_number); + $cheque_number = sanitizeVal($cheque_number, 'alphanohtml'); /** * Creating bank line records From 769b682fd3690214216be2a11dd6e189209cb00e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 11 Mar 2024 16:13:11 +0100 Subject: [PATCH 232/709] Update commonobject.class.php --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index bbdb8183fe2..a693c31ff2d 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3281,7 +3281,7 @@ abstract class CommonObject while ($row = $this->db->fetch_row($resql)) { $rows[] = $row[0]; if ($includealltree) { - $rows = array_merge($rows, $this->getChildrenOfLine($row[0])); + $rows = array_merge($rows, $this->getChildrenOfLine($row[0], $includealltree)); } } } From 5b921d0dc4326c38e8b8cdd36cf3bca420b88603 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 11 Mar 2024 16:26:17 +0100 Subject: [PATCH 233/709] Update DoliDB.class.php --- htdocs/core/db/DoliDB.class.php | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index 4c0bfcbd0f3..1a21fb5c527 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -396,18 +396,16 @@ abstract class DoliDB implements Database } /** - * Return all results from query as an array of objects - * Note : This method executes a given SQL query and retrieves all row of results as an array of objects. It should only be used with SELECT queries - * be careful with this method use it only with some limit of results to avoid performances loss. + * Return all results from query as an array of objects. Using this is a bad practice and is discouraged. + * Note : It should only be used with SELECT queries and with a limit. If you are not able to defined/know what can be the limit, it + * just means this function is not what you need. Do not use it. * - * @param string $sql The sql query string - * @param bool $noLimitCheck set it to true to disable sql query check of limit - * @return bool|array Result + * @param string $sql The sql query string. Must end with "... LIMIT x" + * @return bool|array Result */ - public function getRows($sql, $noLimitCheck = false) + public function getRows($sql) { - - if (!$noLimitCheck && strpos($sql, 'LIMIT') === false) { + if (! preg_match('/LIMIT \d+$/', $sql)) { return false; } From 553587b6606f6f956883fba7be163315526f23c5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 11 Mar 2024 16:27:46 +0100 Subject: [PATCH 234/709] Update DoliDB.class.php --- htdocs/core/db/DoliDB.class.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index 1a21fb5c527..90cb227db73 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -381,11 +381,11 @@ abstract class DoliDB implements Database { $sql .= ' LIMIT 1'; - $res = $this->query($sql); - if ($res) { - $obj = $this->fetch_object($res); + $resql = $this->query($sql); + if ($resql) { + $obj = $this->fetch_object($resql); if ($obj) { - $this->free($res); + $this->free($resql); return $obj; } else { return 0; @@ -409,15 +409,15 @@ abstract class DoliDB implements Database return false; } - $res = $this->query($sql); - if ($res) { + $resql = $this->query($sql); + if ($resql) { $results = array(); - if ($this->num_rows($res) > 0) { - while ($obj = $this->fetch_object($res)) { + if ($this->num_rows($resql) > 0) { + while ($obj = $this->fetch_object($resql)) { $results[] = $obj; } } - $this->free($res); + $this->free($resql); return $results; } From b963a9ab368a02cff7c68b3304dfb4bba8d40ecd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 11 Mar 2024 16:30:33 +0100 Subject: [PATCH 235/709] Fix phpunit --- htdocs/core/db/DoliDB.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index 90cb227db73..b839770410f 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -397,8 +397,8 @@ abstract class DoliDB implements Database /** * Return all results from query as an array of objects. Using this is a bad practice and is discouraged. - * Note : It should only be used with SELECT queries and with a limit. If you are not able to defined/know what can be the limit, it - * just means this function is not what you need. Do not use it. + * Note : It should only be used with SELECT queries and with a limit. If you are not able to defined/know what can be the limit, it + * just means this function is not what you need. Do not use it. * * @param string $sql The sql query string. Must end with "... LIMIT x" * @return bool|array Result From 404d594f24aa51b9e49a6d7c3113b471f530895f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 11 Mar 2024 16:39:44 +0100 Subject: [PATCH 236/709] Removed not used file --- htdocs/langs/fr_FR/ai.lang | 1 - 1 file changed, 1 deletion(-) delete mode 100644 htdocs/langs/fr_FR/ai.lang diff --git a/htdocs/langs/fr_FR/ai.lang b/htdocs/langs/fr_FR/ai.lang deleted file mode 100644 index f6eb575e977..00000000000 --- a/htdocs/langs/fr_FR/ai.lang +++ /dev/null @@ -1 +0,0 @@ -AI_KEY_API_CHATGPT= Clé pour l'api IA \ No newline at end of file From b7acea0ec4c160cfb11bc44e3e2295bd02155717 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 16:47:38 +0100 Subject: [PATCH 237/709] Fix: PhanTypeMismatchDeclaredParamNullable notices # Fix: PhanTypeMismatchDeclaredParamNullable notices PHPDoc must indicate param is nullable if the default is null with explicit typing. (+Improved some other typing from generic Object to CommonObject). --- htdocs/core/lib/bank.lib.php | 13 +++++++------ .../modules/fichinter/doc/pdf_soleil.modules.php | 3 ++- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/htdocs/core/lib/bank.lib.php b/htdocs/core/lib/bank.lib.php index 75788627cec..ffde1206773 100644 --- a/htdocs/core/lib/bank.lib.php +++ b/htdocs/core/lib/bank.lib.php @@ -5,6 +5,7 @@ * Copyright (C) 2016 Juanjo Menent * Copyright (C) 2019 Nicolas ZABOURI * Copyright (C) 2021 Ferran Marcet + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -228,8 +229,8 @@ function account_statement_prepare_head($object, $num) /** * Prepare array with list of tabs * - * @param Object $object Object related to tabs - * @return array Array of tabs to shoc + * @param CommonObject $object Object related to tabs + * @return array Array of tabs to shoc */ function various_payment_prepare_head($object) { @@ -275,8 +276,8 @@ function various_payment_prepare_head($object) /** * Check SWIFT information for a bank account * - * @param Account $account A bank account (used to get BIC/SWIFT) - * @param string $swift Swift value (used to get BIC/SWIFT, param $account non used if provided) + * @param ?Account $account A bank account (used to get BIC/SWIFT) + * @param ?string $swift Swift value (used to get BIC/SWIFT, param $account non used if provided) * @return boolean True if information are valid, false otherwise */ function checkSwiftForAccount(Account $account = null, $swift = null) @@ -296,8 +297,8 @@ function checkSwiftForAccount(Account $account = null, $swift = null) /** * Check IBAN number information for a bank account. * - * @param Account $account A bank account - * @param string $ibantocheck Bank account number (used to get BAN, $account not used if provided) + * @param ?Account $account A bank account + * @param ?string $ibantocheck Bank account number (used to get BAN, $account not used if provided) * @return boolean True if information are valid, false otherwise */ function checkIbanForAccount(Account $account = null, $ibantocheck = null) diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index 8c2b45055fc..82871ffae52 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -6,6 +6,7 @@ * Copyright (C) 2011 Fabrice CHERRIER * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2015 Marcos García + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -449,7 +450,7 @@ class pdf_soleil extends ModelePDFFicheinter * @param Translate $outputlangs Langs object * @param int $hidetop Hide top bar of array * @param int $hidebottom Hide bottom bar of array - * @param Fichinter $object FichInter Object + * @param ?Fichinter $object FichInter Object * @return void */ protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, FichInter $object = null) From 200bc042bd239912de7825a682c6717165704ad5 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 16:48:55 +0100 Subject: [PATCH 238/709] Qual: Enable PhanTypeMismatchDeclaredParamNullable # Qual: Enable PhanTypeMismatchDeclaredParamNullable The few cases for PhanTypeMismatchDeclaredParamNullable were fixed, so the notification can be enabled --- dev/tools/phan/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php index 0bb240128f8..609f2cc267c 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -475,7 +475,7 @@ return [ // 'PhanPluginUnknownFunctionReturnType', // 'PhanPluginDescriptionlessCommentOnProtectedProperty', 'PhanPluginRedundantAssignmentInGlobalScope', - 'PhanTypeMismatchDeclaredParamNullable', + // 'PhanTypeMismatchDeclaredParamNullable', 'PhanTypeInvalidRightOperandOfAdd', // 'PhanPluginDescriptionlessCommentOnPrivateProperty', // 'PhanUndeclaredVariableDim', // Array initialisation on undeclared var: $abc['x']='ab' From 087390b44e4e8e8563797c3baa81f68f094a67dc Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:15:54 +0100 Subject: [PATCH 239/709] Change logic to help static tool analysis --- htdocs/admin/modulehelp.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/modulehelp.php b/htdocs/admin/modulehelp.php index 50e83f65fcb..22165d2c305 100644 --- a/htdocs/admin/modulehelp.php +++ b/htdocs/admin/modulehelp.php @@ -2,6 +2,7 @@ /* Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2017 Regis Houssin * Copyright (C) 2022 Charlene Benke + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -167,7 +168,10 @@ foreach ($modulesdir as $dir) { $familyinfo = array_merge($familyinfo, $objMod->familyinfo); $familykey = key($objMod->familyinfo); } else { - $familykey = empty($objMod->family) ? 'other' : $objMod->family; + $familykey = $objMod->family; + if (empty($familykey)) { + $familykey = 'other'; + } } $moduleposition = ($objMod->module_position ? $objMod->module_position : '50'); From 831aee8fa2f10da172915cf129d9fb8d5b3a0d07 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Mon, 11 Mar 2024 17:31:01 +0100 Subject: [PATCH 240/709] add link for redirect in setup module --- htdocs/ai/ajax/generate_content.php | 8 +++++++- htdocs/ai/class/ai.class.php | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/htdocs/ai/ajax/generate_content.php b/htdocs/ai/ajax/generate_content.php index 9b1adf13b84..c476a0b09f4 100644 --- a/htdocs/ai/ajax/generate_content.php +++ b/htdocs/ai/ajax/generate_content.php @@ -67,7 +67,13 @@ $function = 'textgeneration'; $generatedContent = $ai->generateContent($instructions, 'auto', $function); if (is_array($generatedContent) && $generatedContent['error']) { - print "Error : " . $generatedContent['message']; + // client errors + if ($generatedContent['code'] >= 400) { + print "Error : " . $generatedContent['message']; + print '
'.$langs->trans('Check Config of Module').''; + } else { + print "Error : " . $generatedContent['message']; + } } else { print $generatedContent; } diff --git a/htdocs/ai/class/ai.class.php b/htdocs/ai/class/ai.class.php index 399b3adb1ee..d3baf33421c 100644 --- a/htdocs/ai/class/ai.class.php +++ b/htdocs/ai/class/ai.class.php @@ -131,7 +131,7 @@ class Ai $response = curl_exec($ch); if (curl_errno($ch)) { - throw new Exception('cURL error: ' . curl_error($ch)); + throw new Exception('Wrong configuration !' . curl_error($ch)); } $statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); @@ -146,7 +146,7 @@ class Ai return $generatedEmailContent; } catch (Exception $e) { - return array('error' => true, 'message' => $e->getMessage()); + return array('error' => true, 'message' => $e->getMessage(), 'code' => $statusCode); } finally { curl_close($ch); } From 1350f4d29e2a75648d15c662f1e94ab09ac75679 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:38:36 +0100 Subject: [PATCH 241/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/adherents/class/adherent.class.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 531c089e1f1..0c593549865 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -15,6 +15,7 @@ * Copyright (C) 2020 Josep Lluís Amador * Copyright (C) 2021 Waël Almoman * Copyright (C) 2021 Philippe Grand + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -315,7 +316,7 @@ class Adherent extends CommonObject /** - * @var array fields + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), @@ -323,14 +324,14 @@ class Adherent extends CommonObject 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 15, 'index' => 1), 'ref_ext' => array('type' => 'varchar(128)', 'label' => 'Ref ext', 'enabled' => 1, 'visible' => 0, 'position' => 20), 'civility' => array('type' => 'varchar(6)', 'label' => 'Civility', 'enabled' => 1, 'visible' => -1, 'position' => 25), - 'lastname' => array('type' => 'varchar(50)', 'label' => 'Lastname', 'enabled' => 1, 'visible' => 1, 'position' => 30, 'showoncombobox'=>1), - 'firstname' => array('type' => 'varchar(50)', 'label' => 'Firstname', 'enabled' => 1, 'visible' => 1, 'position' => 35, 'showoncombobox'=>1), + 'lastname' => array('type' => 'varchar(50)', 'label' => 'Lastname', 'enabled' => 1, 'visible' => 1, 'position' => 30, 'showoncombobox' => 1), + 'firstname' => array('type' => 'varchar(50)', 'label' => 'Firstname', 'enabled' => 1, 'visible' => 1, 'position' => 35, 'showoncombobox' => 1), 'login' => array('type' => 'varchar(50)', 'label' => 'Login', 'enabled' => 1, 'visible' => 1, 'position' => 40), 'pass' => array('type' => 'varchar(50)', 'label' => 'Pass', 'enabled' => 1, 'visible' => -1, 'position' => 45), 'pass_crypted' => array('type' => 'varchar(128)', 'label' => 'Pass crypted', 'enabled' => 1, 'visible' => -1, 'position' => 50), 'morphy' => array('type' => 'varchar(3)', 'label' => 'MemberNature', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'position' => 55), 'fk_adherent_type' => array('type' => 'integer', 'label' => 'Fk adherent type', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'position' => 60), - 'societe' => array('type' => 'varchar(128)', 'label' => 'Societe', 'enabled' => 1, 'visible' => 1, 'position' => 65, 'showoncombobox'=>2), + 'societe' => array('type' => 'varchar(128)', 'label' => 'Societe', 'enabled' => 1, 'visible' => 1, 'position' => 65, 'showoncombobox' => 2), 'fk_soc' => array('type' => 'integer:Societe:societe/class/societe.class.php', 'label' => 'ThirdParty', 'enabled' => 1, 'visible' => 1, 'position' => 70), 'address' => array('type' => 'text', 'label' => 'Address', 'enabled' => 1, 'visible' => -1, 'position' => 75), 'zip' => array('type' => 'varchar(10)', 'label' => 'Zip', 'enabled' => 1, 'visible' => -1, 'position' => 80), @@ -341,14 +342,14 @@ class Adherent extends CommonObject 'phone_perso' => array('type' => 'varchar(30)', 'label' => 'Phone perso', 'enabled' => 1, 'visible' => -1, 'position' => 120), 'phone_mobile' => array('type' => 'varchar(30)', 'label' => 'Phone mobile', 'enabled' => 1, 'visible' => -1, 'position' => 125), 'email' => array('type' => 'varchar(255)', 'label' => 'Email', 'enabled' => 1, 'visible' => 1, 'position' => 126), - 'url' =>array('type'=>'varchar(255)', 'label'=>'Url', 'enabled'=>1, 'visible'=>-1, 'position'=>127), + 'url' => array('type' => 'varchar(255)', 'label' => 'Url', 'enabled' => 1, 'visible' => -1, 'position' => 127), 'socialnetworks' => array('type' => 'text', 'label' => 'Socialnetworks', 'enabled' => 1, 'visible' => -1, 'position' => 128), 'birth' => array('type' => 'date', 'label' => 'DateOfBirth', 'enabled' => 1, 'visible' => -1, 'position' => 130), 'gender' => array('type' => 'varchar(10)', 'label' => 'Gender', 'enabled' => 1, 'visible' => -1, 'position' => 132), 'photo' => array('type' => 'varchar(255)', 'label' => 'Photo', 'enabled' => 1, 'visible' => -1, 'position' => 135), 'public' => array('type' => 'smallint(6)', 'label' => 'Public', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 145), 'datefin' => array('type' => 'datetime', 'label' => 'DateEnd', 'enabled' => 1, 'visible' => 1, 'position' => 150), - 'default_lang' =>array('type'=>'varchar(6)', 'label'=>'Default lang', 'enabled'=>1, 'visible'=>-1, 'position'=> 153), + 'default_lang' => array('type' => 'varchar(6)', 'label' => 'Default lang', 'enabled' => 1, 'visible' => -1, 'position' => 153), 'note_public' => array('type' => 'text', 'label' => 'NotePublic', 'enabled' => 1, 'visible' => 0, 'position' => 155), 'note_private' => array('type' => 'text', 'label' => 'NotePrivate', 'enabled' => 1, 'visible' => 0, 'position' => 160), 'datevalid' => array('type' => 'datetime', 'label' => 'DateValidation', 'enabled' => 1, 'visible' => -1, 'position' => 165), @@ -2421,7 +2422,7 @@ class Adherent extends CommonObject } global $action; $hookmanager->initHooks(array($this->element . 'dao')); - $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $parameters = array('id' => $this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; @@ -3276,7 +3277,7 @@ class Adherent extends CommonObject $return .= '
'; $return .= ''; if (property_exists($this, 'photo') || !empty($this->photo)) { - $return.= Form::showphoto('memberphoto', $this, 0, 60, 0, 'photokanban photoref photowithmargin photologintooltip', 'small', 0, 1); + $return .= Form::showphoto('memberphoto', $this, 0, 60, 0, 'photokanban photoref photowithmargin photologintooltip', 'small', 0, 1); } else { $return .= img_picto('', 'user'); } From f6920538b62bd263aca4786411d09750978f5be1 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:38:38 +0100 Subject: [PATCH 242/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/adherents/class/subscription.class.php | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/htdocs/adherents/class/subscription.class.php b/htdocs/adherents/class/subscription.class.php index 111cb2c04ea..92a1edf1fe7 100644 --- a/htdocs/adherents/class/subscription.class.php +++ b/htdocs/adherents/class/subscription.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2006-2015 Laurent Destailleur + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -103,21 +104,21 @@ class Subscription extends CommonObject public $fk_bank; /** - * @var array Array with all fields into database and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), - 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>15), - 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>20), - 'fk_adherent' =>array('type'=>'integer', 'label'=>'Member', 'enabled'=>1, 'visible'=>-1, 'position'=>25), - 'dateadh' =>array('type'=>'datetime', 'label'=>'DateSubscription', 'enabled'=>1, 'visible'=>-1, 'position'=>30), - 'datef' =>array('type'=>'datetime', 'label'=>'DateEndSubscription', 'enabled'=>1, 'visible'=>-1, 'position'=>35), - 'subscription' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>-1, 'position'=>40, 'isameasure'=>1), - 'fk_bank' =>array('type'=>'integer', 'label'=>'BankId', 'enabled'=>1, 'visible'=>-1, 'position'=>45), - 'note' =>array('type'=>'html', 'label'=>'Note', 'enabled'=>1, 'visible'=>-1, 'position'=>50), - 'fk_type' =>array('type'=>'integer', 'label'=>'MemberType', 'enabled'=>1, 'visible'=>-1, 'position'=>55), - 'fk_user_creat' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'position'=>60), - 'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>65), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 15), + 'datec' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'visible' => -1, 'position' => 20), + 'fk_adherent' => array('type' => 'integer', 'label' => 'Member', 'enabled' => 1, 'visible' => -1, 'position' => 25), + 'dateadh' => array('type' => 'datetime', 'label' => 'DateSubscription', 'enabled' => 1, 'visible' => -1, 'position' => 30), + 'datef' => array('type' => 'datetime', 'label' => 'DateEndSubscription', 'enabled' => 1, 'visible' => -1, 'position' => 35), + 'subscription' => array('type' => 'double(24,8)', 'label' => 'Amount', 'enabled' => 1, 'visible' => -1, 'position' => 40, 'isameasure' => 1), + 'fk_bank' => array('type' => 'integer', 'label' => 'BankId', 'enabled' => 1, 'visible' => -1, 'position' => 45), + 'note' => array('type' => 'html', 'label' => 'Note', 'enabled' => 1, 'visible' => -1, 'position' => 50), + 'fk_type' => array('type' => 'integer', 'label' => 'MemberType', 'enabled' => 1, 'visible' => -1, 'position' => 55), + 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => 1, 'visible' => -2, 'position' => 60), + 'fk_user_valid' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserValidation', 'enabled' => 1, 'visible' => -1, 'position' => 65), ); @@ -295,7 +296,7 @@ class Subscription extends CommonObject $result = $member->update_end_date($user); if (!$error && !$notrigger) { - $this->context = array('member'=>$member); + $this->context = array('member' => $member); // Call triggers $result = $this->call_trigger('MEMBER_SUBSCRIPTION_MODIFY', $user); if ($result < 0) { From 67d01e2a9b470b703cb9a66fc9774a18337c718d Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:38:40 +0100 Subject: [PATCH 243/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/asset/class/asset.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index 9c034a3340b..e757f3efdd4 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2018 Alexandre Spangaro * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -93,7 +94,7 @@ class Asset extends CommonObject */ /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'css' => 'left', 'comment' => "Id"), From 47405621413e259af2a0d4e98c1ff0eb003514db Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:38:42 +0100 Subject: [PATCH 244/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- .../class/assetdepreciationoptions.class.php | 39 ++++++++++--------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/htdocs/asset/class/assetdepreciationoptions.class.php b/htdocs/asset/class/assetdepreciationoptions.class.php index e6aa273060c..a07ae6b5043 100644 --- a/htdocs/asset/class/assetdepreciationoptions.class.php +++ b/htdocs/asset/class/assetdepreciationoptions.class.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -64,7 +65,7 @@ class AssetDepreciationOptions extends CommonObject */ /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array(); @@ -77,15 +78,15 @@ class AssetDepreciationOptions extends CommonObject 'label' => 'AssetDepreciationOptionEconomic', 'table' => 'asset_depreciation_options_economic', 'fields' => array( - 'depreciation_type' => array('type'=>'smallint', 'label'=>'AssetDepreciationOptionDepreciationType', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>1, 'default'=>'0', 'arrayofkeyval'=>array('0'=>'AssetDepreciationOptionDepreciationTypeLinear', '1'=>'AssetDepreciationOptionDepreciationTypeDegressive', '2'=>'AssetDepreciationOptionDepreciationTypeExceptional'), 'validate'=>'1',), - 'degressive_coefficient' => array('type'=>'double(24,8)', 'label'=>'AssetDepreciationOptionDegressiveRate', 'enabled'=>'1', 'position'=>20, 'notnull'=>1, 'visible'=>1, 'default'=>'0', 'isameasure'=>'1', 'validate'=>'1','enabled_field' => 'economic:depreciation_type:1'), - 'duration' => array('type'=>'integer', 'label'=>'AssetDepreciationOptionDuration', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'default'=>'0', 'isameasure'=>'1', 'validate'=>'1',), - 'duration_type' => array('type'=>'smallint', 'label'=>'AssetDepreciationOptionDurationType', 'enabled'=>'1', 'position'=>40, 'notnull'=>1, 'visible'=>1, 'default'=>'0', 'arrayofkeyval'=>array('0'=>'AssetDepreciationOptionDurationTypeAnnual', '1'=>'AssetDepreciationOptionDurationTypeMonthly'/*, '2'=>'AssetDepreciationOptionDurationTypeDaily'*/), 'validate'=>'1',), - 'rate' => array('type'=>'double(24,8)', 'label'=>'AssetDepreciationOptionRate', 'enabled'=>'1', 'position'=>50, 'visible'=>3, 'default'=>'0', 'isameasure'=>'1', 'validate'=>'1', 'computed' => '$object->asset_depreciation_options->getRate("economic")',), - 'accelerated_depreciation_option' => array('type'=>'boolean', 'label'=>'AssetDepreciationOptionAcceleratedDepreciation', 'enabled'=>'1', 'position'=>60, 'column_break' => true, 'notnull'=>0, 'default'=>'0', 'visible'=>1, 'validate'=>'1',), - 'amount_base_depreciation_ht' => array('type'=>'price', 'label'=>'AssetDepreciationOptionAmountBaseDepreciationHT', 'enabled'=>'isset($object)&&get_class($object)=="Asset"', 'only_on_asset'=>1, 'position'=>90, 'notnull'=>0, 'required'=>1, 'visible'=>1, 'default'=>'$object->reversal_amount_ht > 0 ? $object->reversal_amount_ht : $object->acquisition_value_ht', 'isameasure'=>'1', 'validate'=>'1',), - 'amount_base_deductible_ht' => array('type'=>'price', 'label'=>'AssetDepreciationOptionAmountBaseDeductibleHT', 'enabled'=>'isset($object)&&get_class($object)=="Asset"', 'only_on_asset'=>1, 'position'=>100, 'notnull'=>0, 'visible'=>1, 'default'=>'0', 'isameasure'=>'1', 'validate'=>'1',), - 'total_amount_last_depreciation_ht' => array('type'=>'price', 'label'=>'AssetDepreciationOptionTotalAmountLastDepreciationHT', 'enabled'=>'isset($object)&&get_class($object)=="Asset"', 'only_on_asset'=>1, 'position'=>110, 'noteditable'=> 1, 'notnull'=>0, 'visible'=>1, 'default'=>'0', 'isameasure'=>'1', 'validate'=>'1',), + 'depreciation_type' => array('type' => 'smallint', 'label' => 'AssetDepreciationOptionDepreciationType', 'enabled' => '1', 'position' => 10, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'arrayofkeyval' => array('0' => 'AssetDepreciationOptionDepreciationTypeLinear', '1' => 'AssetDepreciationOptionDepreciationTypeDegressive', '2' => 'AssetDepreciationOptionDepreciationTypeExceptional'), 'validate' => '1',), + 'degressive_coefficient' => array('type' => 'double(24,8)', 'label' => 'AssetDepreciationOptionDegressiveRate', 'enabled' => '1', 'position' => 20, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'isameasure' => '1', 'validate' => '1','enabled_field' => 'economic:depreciation_type:1'), + 'duration' => array('type' => 'integer', 'label' => 'AssetDepreciationOptionDuration', 'enabled' => '1', 'position' => 30, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'isameasure' => '1', 'validate' => '1',), + 'duration_type' => array('type' => 'smallint', 'label' => 'AssetDepreciationOptionDurationType', 'enabled' => '1', 'position' => 40, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'arrayofkeyval' => array('0' => 'AssetDepreciationOptionDurationTypeAnnual', '1' => 'AssetDepreciationOptionDurationTypeMonthly'/*, '2'=>'AssetDepreciationOptionDurationTypeDaily'*/), 'validate' => '1',), + 'rate' => array('type' => 'double(24,8)', 'label' => 'AssetDepreciationOptionRate', 'enabled' => '1', 'position' => 50, 'visible' => 3, 'default' => '0', 'isameasure' => '1', 'validate' => '1', 'computed' => '$object->asset_depreciation_options->getRate("economic")',), + 'accelerated_depreciation_option' => array('type' => 'boolean', 'label' => 'AssetDepreciationOptionAcceleratedDepreciation', 'enabled' => '1', 'position' => 60, 'column_break' => true, 'notnull' => 0, 'default' => '0', 'visible' => 1, 'validate' => '1',), + 'amount_base_depreciation_ht' => array('type' => 'price', 'label' => 'AssetDepreciationOptionAmountBaseDepreciationHT', 'enabled' => 'isset($object)&&get_class($object)=="Asset"', 'only_on_asset' => 1, 'position' => 90, 'notnull' => 0, 'required' => 1, 'visible' => 1, 'default' => '$object->reversal_amount_ht > 0 ? $object->reversal_amount_ht : $object->acquisition_value_ht', 'isameasure' => '1', 'validate' => '1',), + 'amount_base_deductible_ht' => array('type' => 'price', 'label' => 'AssetDepreciationOptionAmountBaseDeductibleHT', 'enabled' => 'isset($object)&&get_class($object)=="Asset"', 'only_on_asset' => 1, 'position' => 100, 'notnull' => 0, 'visible' => 1, 'default' => '0', 'isameasure' => '1', 'validate' => '1',), + 'total_amount_last_depreciation_ht' => array('type' => 'price', 'label' => 'AssetDepreciationOptionTotalAmountLastDepreciationHT', 'enabled' => 'isset($object)&&get_class($object)=="Asset"', 'only_on_asset' => 1, 'position' => 110, 'noteditable' => 1, 'notnull' => 0, 'visible' => 1, 'default' => '0', 'isameasure' => '1', 'validate' => '1',), ), ), 'accelerated_depreciation' => array( @@ -93,14 +94,14 @@ class AssetDepreciationOptions extends CommonObject 'table' => 'asset_depreciation_options_fiscal', 'enabled_field' => 'economic:accelerated_depreciation_option:1', 'fields' => array( - 'depreciation_type' => array('type'=>'smallint', 'label'=>'AssetDepreciationOptionDepreciationType', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>1, 'default'=>'0', 'arrayofkeyval'=>array('0'=>'AssetDepreciationOptionDepreciationTypeLinear', '1'=>'AssetDepreciationOptionDepreciationTypeDegressive', '2'=>'AssetDepreciationOptionDepreciationTypeExceptional'), 'validate'=>'1',), - 'degressive_coefficient' => array('type'=>'double(24,8)', 'label'=>'AssetDepreciationOptionDegressiveRate', 'enabled'=>'1', 'position'=>20, 'notnull'=>1, 'visible'=>1, 'default'=>'0', 'isameasure'=>'1', 'validate'=>'1','enabled_field' => 'accelerated_depreciation:depreciation_type:1'), - 'duration' => array('type'=>'integer', 'label'=>'AssetDepreciationOptionDuration', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'default'=>'0', 'isameasure'=>'1', 'validate'=>'1',), - 'duration_type' => array('type'=>'smallint', 'label'=>'AssetDepreciationOptionDurationType', 'enabled'=>'1', 'position'=>40, 'notnull'=>1, 'visible'=>1, 'default'=>'0', 'arrayofkeyval'=>array('0'=>'AssetDepreciationOptionDurationTypeAnnual', '1'=>'AssetDepreciationOptionDurationTypeMonthly'/*, '2'=>'AssetDepreciationOptionDurationTypeDaily'*/), 'validate'=>'1',), - 'rate' => array('type'=>'double(24,8)', 'label'=>'AssetDepreciationOptionRate', 'enabled'=>'1', 'position'=>50, 'visible'=>3, 'default'=>'0', 'isameasure'=>'1', 'validate'=>'1', 'computed' => '$object->asset_depreciation_options->getRate("accelerated_depreciation")',), - 'amount_base_depreciation_ht' => array('type'=>'price', 'label'=>'AssetDepreciationOptionAmountBaseDepreciationHT', 'enabled'=>'isset($object)&&get_class($object)=="Asset"', 'only_on_asset'=>1, 'position'=>80, 'column_break' => true, 'notnull'=>0, 'required'=>1, 'visible'=>1, 'default'=>'$object->reversal_amount_ht > 0 ? $object->reversal_amount_ht : $object->acquisition_value_ht', 'isameasure'=>'1', 'validate'=>'1',), - 'amount_base_deductible_ht' => array('type'=>'price', 'label'=>'AssetDepreciationOptionAmountBaseDeductibleHT', 'enabled'=>'isset($object)&&get_class($object)=="Asset"', 'only_on_asset'=>1, 'position'=>90, 'notnull'=>0, 'visible'=>1, 'default'=>'0', 'isameasure'=>'1', 'validate'=>'1',), - 'total_amount_last_depreciation_ht' => array('type'=>'price', 'label'=>'AssetDepreciationOptionTotalAmountLastDepreciationHT', 'enabled'=>'isset($object)&&get_class($object)=="Asset"', 'only_on_asset'=>1, 'position'=>100, 'noteditable'=> 1, 'notnull'=>0, 'visible'=>1, 'default'=>'0', 'isameasure'=>'1', 'validate'=>'1',), + 'depreciation_type' => array('type' => 'smallint', 'label' => 'AssetDepreciationOptionDepreciationType', 'enabled' => '1', 'position' => 10, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'arrayofkeyval' => array('0' => 'AssetDepreciationOptionDepreciationTypeLinear', '1' => 'AssetDepreciationOptionDepreciationTypeDegressive', '2' => 'AssetDepreciationOptionDepreciationTypeExceptional'), 'validate' => '1',), + 'degressive_coefficient' => array('type' => 'double(24,8)', 'label' => 'AssetDepreciationOptionDegressiveRate', 'enabled' => '1', 'position' => 20, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'isameasure' => '1', 'validate' => '1','enabled_field' => 'accelerated_depreciation:depreciation_type:1'), + 'duration' => array('type' => 'integer', 'label' => 'AssetDepreciationOptionDuration', 'enabled' => '1', 'position' => 30, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'isameasure' => '1', 'validate' => '1',), + 'duration_type' => array('type' => 'smallint', 'label' => 'AssetDepreciationOptionDurationType', 'enabled' => '1', 'position' => 40, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'arrayofkeyval' => array('0' => 'AssetDepreciationOptionDurationTypeAnnual', '1' => 'AssetDepreciationOptionDurationTypeMonthly'/*, '2'=>'AssetDepreciationOptionDurationTypeDaily'*/), 'validate' => '1',), + 'rate' => array('type' => 'double(24,8)', 'label' => 'AssetDepreciationOptionRate', 'enabled' => '1', 'position' => 50, 'visible' => 3, 'default' => '0', 'isameasure' => '1', 'validate' => '1', 'computed' => '$object->asset_depreciation_options->getRate("accelerated_depreciation")',), + 'amount_base_depreciation_ht' => array('type' => 'price', 'label' => 'AssetDepreciationOptionAmountBaseDepreciationHT', 'enabled' => 'isset($object)&&get_class($object)=="Asset"', 'only_on_asset' => 1, 'position' => 80, 'column_break' => true, 'notnull' => 0, 'required' => 1, 'visible' => 1, 'default' => '$object->reversal_amount_ht > 0 ? $object->reversal_amount_ht : $object->acquisition_value_ht', 'isameasure' => '1', 'validate' => '1',), + 'amount_base_deductible_ht' => array('type' => 'price', 'label' => 'AssetDepreciationOptionAmountBaseDeductibleHT', 'enabled' => 'isset($object)&&get_class($object)=="Asset"', 'only_on_asset' => 1, 'position' => 90, 'notnull' => 0, 'visible' => 1, 'default' => '0', 'isameasure' => '1', 'validate' => '1',), + 'total_amount_last_depreciation_ht' => array('type' => 'price', 'label' => 'AssetDepreciationOptionTotalAmountLastDepreciationHT', 'enabled' => 'isset($object)&&get_class($object)=="Asset"', 'only_on_asset' => 1, 'position' => 100, 'noteditable' => 1, 'notnull' => 0, 'visible' => 1, 'default' => '0', 'isameasure' => '1', 'validate' => '1',), ), ), ); @@ -178,7 +179,7 @@ class AssetDepreciationOptions extends CommonObject $this->{$field_key} = $this->deprecation_options[$mode][$field_key] ?? null; } - $this->fields['rowid'] = array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"); + $this->fields['rowid'] = array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'css' => 'left', 'comment' => "Id"); if (empty($class_type)) { $this->fields['fk_asset'] = array('type' => 'integer:Asset:asset/class/asset.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label' => 'Asset', 'enabled' => '1', 'position' => 0, 'notnull' => 0, 'visible' => 0, 'index' => 1, 'validate' => '1',); } else { From 622a32b2bb3527f3f2dddd484d0f6431817fd8df Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:38:44 +0100 Subject: [PATCH 245/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/asset/class/assetmodel.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/asset/class/assetmodel.class.php b/htdocs/asset/class/assetmodel.class.php index 811f50252d7..5b995978015 100644 --- a/htdocs/asset/class/assetmodel.class.php +++ b/htdocs/asset/class/assetmodel.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2021 Open-Dsi * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -99,7 +100,7 @@ class AssetModel extends CommonObject */ /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'css' => 'left', 'comment' => "Id"), From f4b444cc0f4ce8adcd07e6f917f791cc60e62e3e Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:38:46 +0100 Subject: [PATCH 246/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/bom/class/bom.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 451926a030c..ac9173a4a07 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2023 Benjamin Falière * Copyright (C) 2023 Charlene Benke * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -110,7 +111,7 @@ class BOM extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -2, 'position' => 1, 'notnull' => 1, 'index' => 1, 'comment' => "Id",), From d494def49d37382737bed84677e3da4183cf2f73 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:38:48 +0100 Subject: [PATCH 247/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/bookcal/class/availabilities.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/bookcal/class/availabilities.class.php b/htdocs/bookcal/class/availabilities.class.php index e3320b531c7..a2bbcd6ffc8 100644 --- a/htdocs/bookcal/class/availabilities.class.php +++ b/htdocs/bookcal/class/availabilities.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2022 Alice Adminson * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -111,7 +112,7 @@ class Availabilities extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 2, 'noteditable' => '1', 'index' => 1, 'css' => 'left', 'comment' => "Id"), From bc8f023653e63235f5a52bacf42e2dd794878b34 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:38:50 +0100 Subject: [PATCH 248/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/bookcal/class/calendar.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/bookcal/class/calendar.class.php b/htdocs/bookcal/class/calendar.class.php index cad6ca0eeb2..a3320c04cda 100644 --- a/htdocs/bookcal/class/calendar.class.php +++ b/htdocs/bookcal/class/calendar.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2023-2024 Frédéric France * Copyright (C) 2023 Alice Adminson + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -111,7 +112,7 @@ class Calendar extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'css' => 'right', 'comment' => "Id"), From 4ec7a53e3f3fe5bbb319ee8aeb778c65e7e95397 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:38:52 +0100 Subject: [PATCH 249/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- .../action/class/actioncommreminder.class.php | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/htdocs/comm/action/class/actioncommreminder.class.php b/htdocs/comm/action/class/actioncommreminder.class.php index 4880e42300d..a55752b62c6 100644 --- a/htdocs/comm/action/class/actioncommreminder.class.php +++ b/htdocs/comm/action/class/actioncommreminder.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -75,20 +76,20 @@ class ActionCommReminder extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>-1, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",), - 'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>0, 'enabled'=>1, 'position'=>20, 'notnull'=>1, 'index'=>1,), - 'dateremind' => array('type'=>'datetime', 'label'=>'DateRemind', 'visible'=>1, 'enabled'=>1, 'position'=>60, 'notnull'=>1, 'index'=>1,), - 'typeremind' => array('type'=>'varchar(32)', 'label'=>'TypeRemind', 'visible'=>-1, 'enabled'=>1, 'position'=>55, 'notnull'=>1, 'comment'=>"email, browser, sms",), - 'fk_user' => array('type'=>'integer', 'label'=>'User', 'visible'=>-1, 'enabled'=>1, 'position'=>65, 'notnull'=>1, 'index'=>1,), - 'offsetvalue' => array('type'=>'integer', 'label'=>'OffsetValue', 'visible'=>1, 'enabled'=>1, 'position'=>56, 'notnull'=>1,), - 'offsetunit' => array('type'=>'varchar(1)', 'label'=>'OffsetUnit', 'visible'=>1, 'enabled'=>1, 'position'=>57, 'notnull'=>1, 'comment'=>"y, m, d, w, h, i",), - 'status' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>58, 'notnull'=>1, 'default'=>0, 'index'=>0, 'arrayofkeyval'=>array('0'=>'ToDo', '1'=>'Done')), - 'lasterror' => array('type'=>'varchar(128)', 'label'=>'LastError', 'visible'=>-1, 'enabled'=>1, 'position'=>59, 'index'=>0), - 'fk_actioncomm' => array('type'=>'integer', 'label'=>'Project', 'visible'=>1, 'enabled'=>1, 'position'=>70, 'notnull'=>1, 'index'=>1,), - 'fk_email_template' => array('type'=>'integer', 'label'=>'EmailTemplate', 'visible'=>1, 'enabled'=>1, 'position'=>80, 'notnull'=>0), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'visible' => -1, 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'index' => 1, 'comment' => "Id",), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'visible' => 0, 'enabled' => 1, 'position' => 20, 'notnull' => 1, 'index' => 1,), + 'dateremind' => array('type' => 'datetime', 'label' => 'DateRemind', 'visible' => 1, 'enabled' => 1, 'position' => 60, 'notnull' => 1, 'index' => 1,), + 'typeremind' => array('type' => 'varchar(32)', 'label' => 'TypeRemind', 'visible' => -1, 'enabled' => 1, 'position' => 55, 'notnull' => 1, 'comment' => "email, browser, sms",), + 'fk_user' => array('type' => 'integer', 'label' => 'User', 'visible' => -1, 'enabled' => 1, 'position' => 65, 'notnull' => 1, 'index' => 1,), + 'offsetvalue' => array('type' => 'integer', 'label' => 'OffsetValue', 'visible' => 1, 'enabled' => 1, 'position' => 56, 'notnull' => 1,), + 'offsetunit' => array('type' => 'varchar(1)', 'label' => 'OffsetUnit', 'visible' => 1, 'enabled' => 1, 'position' => 57, 'notnull' => 1, 'comment' => "y, m, d, w, h, i",), + 'status' => array('type' => 'integer', 'label' => 'Status', 'visible' => 1, 'enabled' => 1, 'position' => 58, 'notnull' => 1, 'default' => 0, 'index' => 0, 'arrayofkeyval' => array('0' => 'ToDo', '1' => 'Done')), + 'lasterror' => array('type' => 'varchar(128)', 'label' => 'LastError', 'visible' => -1, 'enabled' => 1, 'position' => 59, 'index' => 0), + 'fk_actioncomm' => array('type' => 'integer', 'label' => 'Project', 'visible' => 1, 'enabled' => 1, 'position' => 70, 'notnull' => 1, 'index' => 1,), + 'fk_email_template' => array('type' => 'integer', 'label' => 'EmailTemplate', 'visible' => 1, 'enabled' => 1, 'position' => 80, 'notnull' => 0), ); /** From ed703c72419a22841ac6cfcdadfcbd61b654fa86 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:38:55 +0100 Subject: [PATCH 250/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/comm/propal/class/propal.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 5097273a833..a19ee568c3b 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -19,6 +19,7 @@ * Copyright (C) 2022 OpenDSI * Copyright (C) 2022 Gauthier VERDOL * Copyright (C) 2023 William Mead + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -319,7 +320,7 @@ class Propal extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), From 3f5a3b03eeeeafc3f2164fa9fad6a659aa6ef404 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:38:57 +0100 Subject: [PATCH 251/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/commande/class/commande.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index d89d3b39dfb..e4cc13362b6 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -13,6 +13,7 @@ * Copyright (C) 2016-2022 Ferran Marcet * Copyright (C) 2021-2024 Frédéric France * Copyright (C) 2022 Gauthier VERDOL + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -310,7 +311,7 @@ class Commande extends CommonOrder // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), From ec18ec0605daecb570d938eaf79d40b09db42a0b Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:38:59 +0100 Subject: [PATCH 252/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/compta/bank/class/account.class.php | 83 +++++++++++----------- 1 file changed, 42 insertions(+), 41 deletions(-) diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 980139ac752..9efdbcd8451 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -10,6 +10,7 @@ * Copyright (C) 2016 Ferran Marcet * Copyright (C) 2019 JC Prieto * Copyright (C) 2022-2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -311,49 +312,49 @@ class Account extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), - 'ref' =>array('type'=>'varchar(12)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>25), - 'label' =>array('type'=>'varchar(30)', 'label'=>'Label', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>30), - 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>35, 'index'=>1), - 'bank' =>array('type'=>'varchar(60)', 'label'=>'Bank', 'enabled'=>1, 'visible'=>-1, 'position'=>40), - 'code_banque' =>array('type'=>'varchar(128)', 'label'=>'Code banque', 'enabled'=>1, 'visible'=>-1, 'position'=>45), - 'code_guichet' =>array('type'=>'varchar(6)', 'label'=>'Code guichet', 'enabled'=>1, 'visible'=>-1, 'position'=>50), - 'number' =>array('type'=>'varchar(255)', 'label'=>'Number', 'enabled'=>1, 'visible'=>-1, 'position'=>55), - 'cle_rib' =>array('type'=>'varchar(5)', 'label'=>'Cle rib', 'enabled'=>1, 'visible'=>-1, 'position'=>60), - 'bic' =>array('type'=>'varchar(11)', 'label'=>'Bic', 'enabled'=>1, 'visible'=>-1, 'position'=>65), - 'iban_prefix' =>array('type'=>'varchar(34)', 'label'=>'Iban prefix', 'enabled'=>1, 'visible'=>-1, 'position'=>70), - 'country_iban' =>array('type'=>'varchar(2)', 'label'=>'Country iban', 'enabled'=>1, 'visible'=>-1, 'position'=>75), - 'cle_iban' =>array('type'=>'varchar(2)', 'label'=>'Cle iban', 'enabled'=>1, 'visible'=>-1, 'position'=>80), - 'domiciliation' =>array('type'=>'varchar(255)', 'label'=>'Domiciliation', 'enabled'=>1, 'visible'=>-1, 'position'=>85), - 'state_id' =>array('type'=>'integer', 'label'=>'StateId', 'enabled'=>1, 'visible'=>-1, 'position'=>90), - 'fk_pays' =>array('type'=>'integer', 'label'=>'Country', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>95), - 'proprio' =>array('type'=>'varchar(60)', 'label'=>'Proprio', 'enabled'=>1, 'visible'=>-1, 'position'=>100), - 'owner_address' =>array('type'=>'varchar(255)', 'label'=>'Owner address', 'enabled'=>1, 'visible'=>-1, 'position'=>105), - 'owner_zip' =>array('type'=>'varchar(25)', 'label'=>'Owner zip', 'enabled'=>1, 'visible'=>-1, 'position'=>106), - 'owner_town' =>array('type'=>'varchar(50)', 'label'=>'Owner town', 'enabled'=>1, 'visible'=>-1, 'position'=>107), - 'owner_country_id' =>array('type'=>'integer', 'label'=>'Owner country', 'enabled'=>1, 'visible'=>-1, 'position'=>108), - 'courant' =>array('type'=>'smallint(6)', 'label'=>'Courant', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>110), - 'clos' =>array('type'=>'smallint(6)', 'label'=>'Clos', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>115), - 'rappro' =>array('type'=>'smallint(6)', 'label'=>'Rappro', 'enabled'=>1, 'visible'=>-1, 'position'=>120), - 'url' =>array('type'=>'varchar(128)', 'label'=>'Url', 'enabled'=>1, 'visible'=>-1, 'position'=>125), - 'account_number' =>array('type'=>'varchar(32)', 'label'=>'Account number', 'enabled'=>1, 'visible'=>-1, 'position'=>130), - 'fk_accountancy_journal' =>array('type'=>'integer', 'label'=>'Accountancy journal ID', 'enabled'=>1, 'visible'=>-1, 'position'=>132), - 'accountancy_journal' =>array('type'=>'varchar(20)', 'label'=>'Accountancy journal', 'enabled'=>1, 'visible'=>-1, 'position'=>135), - 'currency_code' =>array('type'=>'varchar(3)', 'label'=>'Currency code', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>140), - 'min_allowed' =>array('type'=>'integer', 'label'=>'Min allowed', 'enabled'=>1, 'visible'=>-1, 'position'=>145), - 'min_desired' =>array('type'=>'integer', 'label'=>'Min desired', 'enabled'=>1, 'visible'=>-1, 'position'=>150), - 'comment' =>array('type'=>'text', 'label'=>'Comment', 'enabled'=>1, 'visible'=>-1, 'position'=>155), - 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>156), - 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>157), - 'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'position'=>160), - 'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>165), - 'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>170), - 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>175), - 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>180), - 'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>185), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), + 'ref' => array('type' => 'varchar(12)', 'label' => 'Ref', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'showoncombobox' => 1, 'position' => 25), + 'label' => array('type' => 'varchar(30)', 'label' => 'Label', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 30), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 35, 'index' => 1), + 'bank' => array('type' => 'varchar(60)', 'label' => 'Bank', 'enabled' => 1, 'visible' => -1, 'position' => 40), + 'code_banque' => array('type' => 'varchar(128)', 'label' => 'Code banque', 'enabled' => 1, 'visible' => -1, 'position' => 45), + 'code_guichet' => array('type' => 'varchar(6)', 'label' => 'Code guichet', 'enabled' => 1, 'visible' => -1, 'position' => 50), + 'number' => array('type' => 'varchar(255)', 'label' => 'Number', 'enabled' => 1, 'visible' => -1, 'position' => 55), + 'cle_rib' => array('type' => 'varchar(5)', 'label' => 'Cle rib', 'enabled' => 1, 'visible' => -1, 'position' => 60), + 'bic' => array('type' => 'varchar(11)', 'label' => 'Bic', 'enabled' => 1, 'visible' => -1, 'position' => 65), + 'iban_prefix' => array('type' => 'varchar(34)', 'label' => 'Iban prefix', 'enabled' => 1, 'visible' => -1, 'position' => 70), + 'country_iban' => array('type' => 'varchar(2)', 'label' => 'Country iban', 'enabled' => 1, 'visible' => -1, 'position' => 75), + 'cle_iban' => array('type' => 'varchar(2)', 'label' => 'Cle iban', 'enabled' => 1, 'visible' => -1, 'position' => 80), + 'domiciliation' => array('type' => 'varchar(255)', 'label' => 'Domiciliation', 'enabled' => 1, 'visible' => -1, 'position' => 85), + 'state_id' => array('type' => 'integer', 'label' => 'StateId', 'enabled' => 1, 'visible' => -1, 'position' => 90), + 'fk_pays' => array('type' => 'integer', 'label' => 'Country', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 95), + 'proprio' => array('type' => 'varchar(60)', 'label' => 'Proprio', 'enabled' => 1, 'visible' => -1, 'position' => 100), + 'owner_address' => array('type' => 'varchar(255)', 'label' => 'Owner address', 'enabled' => 1, 'visible' => -1, 'position' => 105), + 'owner_zip' => array('type' => 'varchar(25)', 'label' => 'Owner zip', 'enabled' => 1, 'visible' => -1, 'position' => 106), + 'owner_town' => array('type' => 'varchar(50)', 'label' => 'Owner town', 'enabled' => 1, 'visible' => -1, 'position' => 107), + 'owner_country_id' => array('type' => 'integer', 'label' => 'Owner country', 'enabled' => 1, 'visible' => -1, 'position' => 108), + 'courant' => array('type' => 'smallint(6)', 'label' => 'Courant', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 110), + 'clos' => array('type' => 'smallint(6)', 'label' => 'Clos', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 115), + 'rappro' => array('type' => 'smallint(6)', 'label' => 'Rappro', 'enabled' => 1, 'visible' => -1, 'position' => 120), + 'url' => array('type' => 'varchar(128)', 'label' => 'Url', 'enabled' => 1, 'visible' => -1, 'position' => 125), + 'account_number' => array('type' => 'varchar(32)', 'label' => 'Account number', 'enabled' => 1, 'visible' => -1, 'position' => 130), + 'fk_accountancy_journal' => array('type' => 'integer', 'label' => 'Accountancy journal ID', 'enabled' => 1, 'visible' => -1, 'position' => 132), + 'accountancy_journal' => array('type' => 'varchar(20)', 'label' => 'Accountancy journal', 'enabled' => 1, 'visible' => -1, 'position' => 135), + 'currency_code' => array('type' => 'varchar(3)', 'label' => 'Currency code', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 140), + 'min_allowed' => array('type' => 'integer', 'label' => 'Min allowed', 'enabled' => 1, 'visible' => -1, 'position' => 145), + 'min_desired' => array('type' => 'integer', 'label' => 'Min desired', 'enabled' => 1, 'visible' => -1, 'position' => 150), + 'comment' => array('type' => 'text', 'label' => 'Comment', 'enabled' => 1, 'visible' => -1, 'position' => 155), + 'datec' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'visible' => -1, 'position' => 156), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 157), + 'fk_user_author' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'Fk user author', 'enabled' => 1, 'visible' => -1, 'position' => 160), + 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => 1, 'visible' => -2, 'notnull' => -1, 'position' => 165), + 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => 1, 'visible' => 0, 'position' => 170), + 'model_pdf' => array('type' => 'varchar(255)', 'label' => 'Model pdf', 'enabled' => 1, 'visible' => 0, 'position' => 175), + 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'position' => 180), + 'extraparams' => array('type' => 'varchar(255)', 'label' => 'Extraparams', 'enabled' => 1, 'visible' => -1, 'position' => 185), ); // END MODULEBUILDER PROPERTIES From a8a7d71426486dbf565fca5b516312b8c6192462 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:39:01 +0100 Subject: [PATCH 253/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/compta/bank/class/paymentvarious.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index 33ac0d8f817..fe7ea276767 100644 --- a/htdocs/compta/bank/class/paymentvarious.class.php +++ b/htdocs/compta/bank/class/paymentvarious.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -197,7 +198,7 @@ class PaymentVarious extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array fields definition + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( // TODO: fill this array @@ -744,7 +745,7 @@ class PaymentVarious extends CommonObject global $action; $hookmanager->initHooks(array('variouspayment')); - $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $parameters = array('id' => $this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; From 88ba7d1bc502e0903fe43796a8126c5679e4796b Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:39:03 +0100 Subject: [PATCH 254/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/compta/facture/class/facture-rec.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 50317b0ece3..957f7040a66 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -8,6 +8,7 @@ * Copyright (C) 2015 Marcos García * Copyright (C) 2017-2024 Frédéric France * Copyright (C) 2023 Nick Fragoulis + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -171,7 +172,7 @@ class FactureRec extends CommonInvoice // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), From 0c0f04f2d5284288cd0ffcf5184aa00a9b8d33bc Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:39:05 +0100 Subject: [PATCH 255/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/compta/facture/class/facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index e0e994959a7..6caa4a49b8c 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -290,7 +290,7 @@ class Facture extends CommonInvoice // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 1), From fd757539346ad5bc04b58967507e511c789bfc73 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:39:07 +0100 Subject: [PATCH 256/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/compta/prelevement/class/bonprelevement.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index abda85280a0..5a92797fdb7 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -6,6 +6,7 @@ * Copyright (C) 2014-2016 Ferran Marcet * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2019 JC Prieto + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -144,7 +145,7 @@ class BonPrelevement extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 10, 'notnull' => 1, 'visible' => 0,), From c88a9ea1eb8c601e35f8e00caaa689f7c8427941 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:39:09 +0100 Subject: [PATCH 257/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/contact/class/contact.class.php | 79 +++++++++++++------------- 1 file changed, 40 insertions(+), 39 deletions(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 9b6752305a7..8b46a8d4c5a 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -12,6 +12,7 @@ * Copyright (C) 2019 Nicolas ZABOURI * Copyright (C) 2020 Open-Dsi * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -97,45 +98,45 @@ class Contact extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'noteditable'=>1, 'notnull'=> 1, 'index'=>1, 'position'=>1, 'comment'=>'Id', 'css'=>'left'), - 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>3, 'notnull'=>1, 'position'=>30, 'index'=>1), - 'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>3, 'position'=>35), - 'civility' =>array('type'=>'varchar(6)', 'label'=>'Civility', 'enabled'=>1, 'visible'=>3, 'position'=>40), - 'lastname' =>array('type'=>'varchar(50)', 'label'=>'Lastname', 'enabled'=>1, 'visible'=>1, 'position'=>45, 'showoncombobox'=>1, 'searchall'=>1), - 'name_alias' =>array('type'=>'varchar(255)', 'label'=>'Name alias', 'enabled'=>1, 'visible'=>-1, 'position'=>46, 'searchall'=>1), - 'firstname' =>array('type'=>'varchar(50)', 'label'=>'Firstname', 'enabled'=>1, 'visible'=>1, 'position'=>50, 'showoncombobox'=>1, 'searchall'=>1), - 'poste' =>array('type'=>'varchar(80)', 'label'=>'PostOrFunction', 'enabled'=>1, 'visible'=>-1, 'position'=>52), - 'address' =>array('type'=>'varchar(255)', 'label'=>'Address', 'enabled'=>1, 'visible'=>-1, 'position'=>55), - 'zip' =>array('type'=>'varchar(25)', 'label'=>'Zip', 'enabled'=>1, 'visible'=>1, 'position'=>60), - 'town' =>array('type'=>'varchar(50)', 'label'=>'Town', 'enabled'=>1, 'visible'=>-1, 'position'=>65), - 'fk_departement' =>array('type'=>'integer', 'label'=>'Fk departement', 'enabled'=>1, 'visible'=>3, 'position'=>70), - 'fk_pays' =>array('type'=>'integer', 'label'=>'Fk pays', 'enabled'=>1, 'visible'=>3, 'position'=>75), - 'fk_soc' =>array('type'=>'integer', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>1, 'position'=>77, 'searchall'=>1), - 'birthday' =>array('type'=>'date', 'label'=>'Birthday', 'enabled'=>1, 'visible'=>-1, 'position'=>80), - 'phone' =>array('type'=>'varchar(30)', 'label'=>'Phone', 'enabled'=>1, 'visible'=>1, 'position'=>90, 'searchall'=>1), - 'phone_perso' =>array('type'=>'varchar(30)', 'label'=>'PhonePerso', 'enabled'=>1, 'visible'=>-1, 'position'=>95, 'searchall'=>1), - 'phone_mobile' =>array('type'=>'varchar(30)', 'label'=>'PhoneMobile', 'enabled'=>1, 'visible'=>1, 'position'=>100, 'searchall'=>1), - 'fax' =>array('type'=>'varchar(30)', 'label'=>'Fax', 'enabled'=>1, 'visible'=>-1, 'position'=>105, 'searchall'=>1), - 'email' =>array('type'=>'varchar(255)', 'label'=>'Email', 'enabled'=>1, 'visible'=>1, 'position'=>110, 'searchall'=>1), - 'socialnetworks' =>array('type'=>'text', 'label'=>'SocialNetworks', 'enabled'=>1, 'visible'=>3, 'position'=>115), - 'photo' =>array('type'=>'varchar(255)', 'label'=>'Photo', 'enabled'=>1, 'visible'=>3, 'position'=>170), - 'priv' =>array('type'=>'smallint(6)', 'label'=>'ContactVisibility', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>175), - 'fk_stcommcontact' =>array('type'=>'integer', 'label'=>'ProspectStatus', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>220), - 'fk_prospectcontactlevel' =>array('type'=>'varchar(12)', 'label'=>'ProspectLevel', 'enabled'=>1, 'visible'=>-1, 'position'=>255), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -2, 'noteditable' => 1, 'notnull' => 1, 'index' => 1, 'position' => 1, 'comment' => 'Id', 'css' => 'left'), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => 3, 'notnull' => 1, 'position' => 30, 'index' => 1), + 'ref_ext' => array('type' => 'varchar(255)', 'label' => 'Ref ext', 'enabled' => 1, 'visible' => 3, 'position' => 35), + 'civility' => array('type' => 'varchar(6)', 'label' => 'Civility', 'enabled' => 1, 'visible' => 3, 'position' => 40), + 'lastname' => array('type' => 'varchar(50)', 'label' => 'Lastname', 'enabled' => 1, 'visible' => 1, 'position' => 45, 'showoncombobox' => 1, 'searchall' => 1), + 'name_alias' => array('type' => 'varchar(255)', 'label' => 'Name alias', 'enabled' => 1, 'visible' => -1, 'position' => 46, 'searchall' => 1), + 'firstname' => array('type' => 'varchar(50)', 'label' => 'Firstname', 'enabled' => 1, 'visible' => 1, 'position' => 50, 'showoncombobox' => 1, 'searchall' => 1), + 'poste' => array('type' => 'varchar(80)', 'label' => 'PostOrFunction', 'enabled' => 1, 'visible' => -1, 'position' => 52), + 'address' => array('type' => 'varchar(255)', 'label' => 'Address', 'enabled' => 1, 'visible' => -1, 'position' => 55), + 'zip' => array('type' => 'varchar(25)', 'label' => 'Zip', 'enabled' => 1, 'visible' => 1, 'position' => 60), + 'town' => array('type' => 'varchar(50)', 'label' => 'Town', 'enabled' => 1, 'visible' => -1, 'position' => 65), + 'fk_departement' => array('type' => 'integer', 'label' => 'Fk departement', 'enabled' => 1, 'visible' => 3, 'position' => 70), + 'fk_pays' => array('type' => 'integer', 'label' => 'Fk pays', 'enabled' => 1, 'visible' => 3, 'position' => 75), + 'fk_soc' => array('type' => 'integer', 'label' => 'ThirdParty', 'enabled' => 1, 'visible' => 1, 'position' => 77, 'searchall' => 1), + 'birthday' => array('type' => 'date', 'label' => 'Birthday', 'enabled' => 1, 'visible' => -1, 'position' => 80), + 'phone' => array('type' => 'varchar(30)', 'label' => 'Phone', 'enabled' => 1, 'visible' => 1, 'position' => 90, 'searchall' => 1), + 'phone_perso' => array('type' => 'varchar(30)', 'label' => 'PhonePerso', 'enabled' => 1, 'visible' => -1, 'position' => 95, 'searchall' => 1), + 'phone_mobile' => array('type' => 'varchar(30)', 'label' => 'PhoneMobile', 'enabled' => 1, 'visible' => 1, 'position' => 100, 'searchall' => 1), + 'fax' => array('type' => 'varchar(30)', 'label' => 'Fax', 'enabled' => 1, 'visible' => -1, 'position' => 105, 'searchall' => 1), + 'email' => array('type' => 'varchar(255)', 'label' => 'Email', 'enabled' => 1, 'visible' => 1, 'position' => 110, 'searchall' => 1), + 'socialnetworks' => array('type' => 'text', 'label' => 'SocialNetworks', 'enabled' => 1, 'visible' => 3, 'position' => 115), + 'photo' => array('type' => 'varchar(255)', 'label' => 'Photo', 'enabled' => 1, 'visible' => 3, 'position' => 170), + 'priv' => array('type' => 'smallint(6)', 'label' => 'ContactVisibility', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'position' => 175), + 'fk_stcommcontact' => array('type' => 'integer', 'label' => 'ProspectStatus', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 220), + 'fk_prospectcontactlevel' => array('type' => 'varchar(12)', 'label' => 'ProspectLevel', 'enabled' => 1, 'visible' => -1, 'position' => 255), //no more used. Replace by a scan of email into mailing_unsubscribe. 'no_email' =>array('type'=>'smallint(6)', 'label'=>'No_Email', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>180), - 'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>3, 'position'=>195, 'searchall'=>1), - 'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>3, 'position'=>200, 'searchall'=>1), - 'default_lang' =>array('type'=>'varchar(6)', 'label'=>'Default lang', 'enabled'=>1, 'visible'=>3, 'position'=>205), - 'canvas' =>array('type'=>'varchar(32)', 'label'=>'Canvas', 'enabled'=>1, 'visible'=>3, 'position'=>210), - 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>300), - 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>305), - 'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>3, 'position'=>310), - 'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>3, 'position'=>315), - 'statut' =>array('type'=>'tinyint(4)', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>500), - 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-1, 'position'=>1000), + 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => 1, 'visible' => 3, 'position' => 195, 'searchall' => 1), + 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => 1, 'visible' => 3, 'position' => 200, 'searchall' => 1), + 'default_lang' => array('type' => 'varchar(6)', 'label' => 'Default lang', 'enabled' => 1, 'visible' => 3, 'position' => 205), + 'canvas' => array('type' => 'varchar(32)', 'label' => 'Canvas', 'enabled' => 1, 'visible' => 3, 'position' => 210), + 'datec' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'visible' => -1, 'position' => 300), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 305), + 'fk_user_creat' => array('type' => 'integer', 'label' => 'UserAuthor', 'enabled' => 1, 'visible' => 3, 'position' => 310), + 'fk_user_modif' => array('type' => 'integer', 'label' => 'UserModif', 'enabled' => 1, 'visible' => 3, 'position' => 315), + 'statut' => array('type' => 'tinyint(4)', 'label' => 'Status', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'position' => 500), + 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -1, 'position' => 1000), ); public $civility_id; // In fact we store civility_code @@ -1797,7 +1798,7 @@ class Contact extends CommonObject while ($obj = $this->db->fetch_object($resql)) { $transkey = "TypeContact_".$obj->element."_".$obj->source."_".$obj->code; $libelle_element = $langs->trans('ContactDefault_'.$obj->element); - $this->roles[$obj->contactroleid] = array('id'=>$obj->rowid, 'socid'=>$obj->socid, 'element'=>$obj->element, 'source'=>$obj->source, 'code'=>$obj->code, 'label'=>$libelle_element.' - '.($langs->trans($transkey) != $transkey ? $langs->trans($transkey) : $obj->label)); + $this->roles[$obj->contactroleid] = array('id' => $obj->rowid, 'socid' => $obj->socid, 'element' => $obj->element, 'source' => $obj->source, 'code' => $obj->code, 'label' => $libelle_element.' - '.($langs->trans($transkey) != $transkey ? $langs->trans($transkey) : $obj->label)); } } } else { @@ -1846,7 +1847,7 @@ class Contact extends CommonObject $i = 0; while ($i < $num) { $obj = $this->db->fetch_object($resql); - $tab[] = array('fk_socpeople'=>$obj->id, 'type_contact'=>$obj->fk_c_type_contact); + $tab[] = array('fk_socpeople' => $obj->id, 'type_contact' => $obj->fk_c_type_contact); $i++; } @@ -2178,7 +2179,7 @@ class Contact extends CommonObject $return .= ''; //var_dump($this->photo);exit; if (property_exists($this, 'photo') && !is_null($this->photo)) { - $return.= Form::showphoto('contact', $this, 0, 60, 0, 'photokanban photoref photowithmargin photologintooltip', 'small', 0, 1); + $return .= Form::showphoto('contact', $this, 0, 60, 0, 'photokanban photoref photowithmargin photologintooltip', 'small', 0, 1); } else { $return .= img_picto('', $this->picto); } From 640eb1b75d71ce326f4a4c536330106a634d7004 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:39:11 +0100 Subject: [PATCH 258/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/contrat/class/contrat.class.php | 108 ++++++++++++------------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 8139d7aa755..e15c3f57a3f 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -243,31 +243,31 @@ class Contrat extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), - 'ref' =>array('type'=>'varchar(50)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'showoncombobox'=>1, 'position'=>15, 'searchall'=>1), - 'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>20), - 'ref_customer' =>array('type'=>'varchar(50)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>25, 'searchall'=>1), - 'ref_supplier' =>array('type'=>'varchar(50)', 'label'=>'RefSupplier', 'enabled'=>1, 'visible'=>-1, 'position'=>26, 'searchall'=>1), - 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>30, 'index'=>1), - 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35), - 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>40), - 'date_contrat' =>array('type'=>'datetime', 'label'=>'Date contrat', 'enabled'=>1, 'visible'=>-1, 'position'=>45), - 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'isModEnabled("societe")', 'visible'=>-1, 'notnull'=>1, 'position'=>70), - 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:(fk_statut:=:1)', 'label'=>'Project', 'enabled'=>"isModEnabled('project')", 'visible'=>-1, 'position'=>75), - 'fk_commercial_signature' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative Signature', 'enabled'=>1, 'visible'=>-1, 'position'=>80), - 'fk_commercial_suivi' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative follower', 'enabled'=>1, 'visible'=>-1, 'position'=>85), - 'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>90), - 'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>105, 'searchall'=>1), - 'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110, 'searchall'=>1), - 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>115), - 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>120), - 'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>125), - 'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>135), - 'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'Last main doc', 'enabled'=>1, 'visible'=>-1, 'position'=>140), - 'statut' =>array('type'=>'smallint(6)', 'label'=>'Statut', 'enabled'=>1, 'visible'=>-1, 'position'=>500, 'notnull'=>1, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 2=>'Closed')) + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), + 'ref' => array('type' => 'varchar(50)', 'label' => 'Ref', 'enabled' => 1, 'visible' => -1, 'showoncombobox' => 1, 'position' => 15, 'searchall' => 1), + 'ref_ext' => array('type' => 'varchar(255)', 'label' => 'Ref ext', 'enabled' => 1, 'visible' => 0, 'position' => 20), + 'ref_customer' => array('type' => 'varchar(50)', 'label' => 'RefCustomer', 'enabled' => 1, 'visible' => -1, 'position' => 25, 'searchall' => 1), + 'ref_supplier' => array('type' => 'varchar(50)', 'label' => 'RefSupplier', 'enabled' => 1, 'visible' => -1, 'position' => 26, 'searchall' => 1), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 30, 'index' => 1), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 35), + 'datec' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'visible' => -1, 'position' => 40), + 'date_contrat' => array('type' => 'datetime', 'label' => 'Date contrat', 'enabled' => 1, 'visible' => -1, 'position' => 45), + 'fk_soc' => array('type' => 'integer:Societe:societe/class/societe.class.php', 'label' => 'ThirdParty', 'enabled' => 'isModEnabled("societe")', 'visible' => -1, 'notnull' => 1, 'position' => 70), + 'fk_projet' => array('type' => 'integer:Project:projet/class/project.class.php:1:(fk_statut:=:1)', 'label' => 'Project', 'enabled' => "isModEnabled('project')", 'visible' => -1, 'position' => 75), + 'fk_commercial_signature' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'SaleRepresentative Signature', 'enabled' => 1, 'visible' => -1, 'position' => 80), + 'fk_commercial_suivi' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'SaleRepresentative follower', 'enabled' => 1, 'visible' => -1, 'position' => 85), + 'fk_user_author' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 90), + 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => 1, 'visible' => 0, 'position' => 105, 'searchall' => 1), + 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => 1, 'visible' => 0, 'position' => 110, 'searchall' => 1), + 'model_pdf' => array('type' => 'varchar(255)', 'label' => 'Model pdf', 'enabled' => 1, 'visible' => 0, 'position' => 115), + 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'position' => 120), + 'extraparams' => array('type' => 'varchar(255)', 'label' => 'Extraparams', 'enabled' => 1, 'visible' => -1, 'position' => 125), + 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => 1, 'visible' => -2, 'notnull' => -1, 'position' => 135), + 'last_main_doc' => array('type' => 'varchar(255)', 'label' => 'Last main doc', 'enabled' => 1, 'visible' => -1, 'position' => 140), + 'statut' => array('type' => 'smallint(6)', 'label' => 'Statut', 'enabled' => 1, 'visible' => -1, 'position' => 500, 'notnull' => 1, 'arrayofkeyval' => array(0 => 'Draft', 1 => 'Validated', 2 => 'Closed')) ); // END MODULEBUILDER PROPERTIES @@ -2154,7 +2154,7 @@ class Contrat extends CommonObject global $action; $hookmanager->initHooks(array('contractdao')); - $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $parameters = array('id' => $this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; @@ -2744,7 +2744,7 @@ class Contrat extends CommonObject $error = 0; $this->output = ''; - $this->error=''; + $this->error = ''; $contractlineprocessed = array(); $contractignored = array(); @@ -2753,13 +2753,13 @@ class Contrat extends CommonObject dol_syslog(__METHOD__, LOG_DEBUG); $sql = 'SELECT c.rowid, c.ref_customer, cd.rowid as lid, cd.date_fin_validite, p.duration'; - $sql.= ' FROM '.MAIN_DB_PREFIX.'contrat as c, '.MAIN_DB_PREFIX.'contratdet as cd'; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON p.rowid = cd.fk_product'; - $sql.= ' WHERE cd.fk_contrat = c.rowid'; - $sql.= " AND date_format(cd.date_fin_validite, '%Y-%m-%d') <= date_format('".$this->db->idate($enddatetoscan)."', '%Y-%m-%d')"; - $sql.= " AND cd.statut = 4"; + $sql .= ' FROM '.MAIN_DB_PREFIX.'contrat as c, '.MAIN_DB_PREFIX.'contratdet as cd'; + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON p.rowid = cd.fk_product'; + $sql .= ' WHERE cd.fk_contrat = c.rowid'; + $sql .= " AND date_format(cd.date_fin_validite, '%Y-%m-%d') <= date_format('".$this->db->idate($enddatetoscan)."', '%Y-%m-%d')"; + $sql .= " AND cd.statut = 4"; if ($thirdparty_id > 0) { - $sql.=" AND c.fk_soc = ".((int) $thirdparty_id); + $sql .= " AND c.fk_soc = ".((int) $thirdparty_id); } //print $sql; @@ -2769,7 +2769,7 @@ class Contrat extends CommonObject include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - $i=0; + $i = 0; while ($i < $num) { $obj = $this->db->fetch_object($resql); if ($obj) { @@ -2806,7 +2806,7 @@ class Contrat extends CommonObject usort($object->linkedObjects['facture'], array('Contrat', 'contractCmpDate')); //dol_sort_array($object->linkedObjects['facture'], 'date'); - $someinvoicenotpaid=0; + $someinvoicenotpaid = 0; foreach ($object->linkedObjects['facture'] as $idinvoice => $invoice) { if ($invoice->statut == Facture::STATUS_DRAFT) { continue; @@ -2826,7 +2826,7 @@ class Contrat extends CommonObject if ($expirationdate && $expirationdate < $enddatetoscan) { dol_syslog("Define the newdate of end of services from expirationdate=".$expirationdate); $newdate = $expirationdate; - $protecti=0; //$protecti is to avoid infinite loop + $protecti = 0; //$protecti is to avoid infinite loop while ($newdate < $enddatetoscan && $protecti < 1000) { $newdate = dol_time_plus_duree($newdate, $duration_value, $duration_unit); $protecti++; @@ -2844,10 +2844,10 @@ class Contrat extends CommonObject $comment = 'Renew date of contract '.$object->ref.' line '.$obj->lid.' by doAutoRenewContracts'; $sqlupdate = 'UPDATE '.MAIN_DB_PREFIX."contratdet SET date_fin_validite = '".$this->db->idate($newdate)."'"; - $sqlupdate.= ' WHERE rowid = '.((int) $obj->lid); + $sqlupdate .= ' WHERE rowid = '.((int) $obj->lid); $resqlupdate = $this->db->query($sqlupdate); if ($resqlupdate) { - $contractlineprocessed[$obj->lid]=$object->ref; + $contractlineprocessed[$obj->lid] = $object->ref; $actioncode = 'RENEW_CONTRACT'; $now = dol_now(); @@ -2869,7 +2869,7 @@ class Contrat extends CommonObject $ret = $actioncomm->create($user); // User creating action } else { - $contracterror[$object->id]=$object->ref; + $contracterror[$object->id] = $object->ref; $error++; $errorforlocaltransaction++; @@ -2895,7 +2895,7 @@ class Contrat extends CommonObject $this->error = $this->db->lasterror(); } - $this->output .= count($contractlineprocessed).' contract line(s) with end date before '.dol_print_date($enddatetoscan, 'day').' were renewed'.(count($contractlineprocessed)>0 ? ' : '.implode(',', $contractlineprocessed) : ''); + $this->output .= count($contractlineprocessed).' contract line(s) with end date before '.dol_print_date($enddatetoscan, 'day').' were renewed'.(count($contractlineprocessed) > 0 ? ' : '.implode(',', $contractlineprocessed) : ''); return ($error ? 1 : 0); } @@ -3109,27 +3109,27 @@ class ContratLigne extends CommonObjectLine * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), - 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>30, 'index'=>1), - 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35), - 'qty' =>array('type'=>'integer', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>35, 'isameasure'=>1), - 'total_ht' =>array('type'=>'integer', 'label'=>'AmountHT', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>36, 'isameasure'=>1), - 'total_tva' =>array('type'=>'integer', 'label'=>'AmountVAT', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>37, 'isameasure'=>1), - 'total_ttc' =>array('type'=>'integer', 'label'=>'AmountTTC', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>38, 'isameasure'=>1), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 30, 'index' => 1), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 35), + 'qty' => array('type' => 'integer', 'label' => 'Quantity', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'position' => 35, 'isameasure' => 1), + 'total_ht' => array('type' => 'integer', 'label' => 'AmountHT', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 36, 'isameasure' => 1), + 'total_tva' => array('type' => 'integer', 'label' => 'AmountVAT', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 37, 'isameasure' => 1), + 'total_ttc' => array('type' => 'integer', 'label' => 'AmountTTC', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 38, 'isameasure' => 1), //'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>40), //'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>70), - 'fk_contrat' =>array('type'=>'integer:Contrat:contrat/class/contrat.class.php', 'label'=>'Contract', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>70), - 'fk_product' =>array('type'=>'integer:Product:product/class/product.class.php:1', 'label'=>'Product', 'enabled'=>1, 'visible'=>-1, 'position'=>75), + 'fk_contrat' => array('type' => 'integer:Contrat:contrat/class/contrat.class.php', 'label' => 'Contract', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 70), + 'fk_product' => array('type' => 'integer:Product:product/class/product.class.php:1', 'label' => 'Product', 'enabled' => 1, 'visible' => -1, 'position' => 75), //'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>90), - 'note_private' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>105), - 'note_public' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110), + 'note_private' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => 1, 'visible' => 0, 'position' => 105), + 'note_public' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => 1, 'visible' => 0, 'position' => 110), //'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>115), //'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>120), //'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>125), - 'fk_user_ouverture' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserStartingService', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>135), - 'fk_user_cloture' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserClosingService', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>135), - 'statut' =>array('type'=>'smallint(6)', 'label'=>'Statut', 'enabled'=>1, 'visible'=>-1, 'position'=>500, 'arrayofkeyval'=>array(0=>'Draft', 4=>'Open', 5=>'Closed')), - 'rang' =>array('type'=>'integer', 'label'=>'Rank', 'enabled'=>1, 'visible'=>0, 'position'=>500, 'default' =>0) + 'fk_user_ouverture' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserStartingService', 'enabled' => 1, 'visible' => -2, 'notnull' => -1, 'position' => 135), + 'fk_user_cloture' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserClosingService', 'enabled' => 1, 'visible' => -2, 'notnull' => -1, 'position' => 135), + 'statut' => array('type' => 'smallint(6)', 'label' => 'Statut', 'enabled' => 1, 'visible' => -1, 'position' => 500, 'arrayofkeyval' => array(0 => 'Draft', 4 => 'Open', 5 => 'Closed')), + 'rang' => array('type' => 'integer', 'label' => 'Rank', 'enabled' => 1, 'visible' => 0, 'position' => 500, 'default' => 0) ); // END MODULEBUILDER PROPERTIES @@ -3200,7 +3200,7 @@ class ContratLigne extends CommonObjectLine $params = array(); $reg = array(); if (preg_match('/class="(.*)"/', $moreatt, $reg)) { - $params = array('badgeParams'=>array('css' => $reg[1])); + $params = array('badgeParams' => array('css' => $reg[1])); } return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode, '', $params); } From 3730dbc31b55f334e734b20ce7a9818d273c79ec Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:39:13 +0100 Subject: [PATCH 259/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/core/class/defaultvalues.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/defaultvalues.class.php b/htdocs/core/class/defaultvalues.class.php index cdb14b5bd5a..1d8fb59c4c1 100644 --- a/htdocs/core/class/defaultvalues.class.php +++ b/htdocs/core/class/defaultvalues.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2021 Florian HENRY * Copyright (C) 2021-2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -86,7 +87,7 @@ class DefaultValues extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), From 1035e92861c6cf63116d3cff3b539fe6d5bbdea0 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:39:15 +0100 Subject: [PATCH 260/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- .../core/class/emailsenderprofile.class.php | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/htdocs/core/class/emailsenderprofile.class.php b/htdocs/core/class/emailsenderprofile.class.php index 00a8d800251..6aa1222c9d6 100644 --- a/htdocs/core/class/emailsenderprofile.class.php +++ b/htdocs/core/class/emailsenderprofile.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2015 Florian Henry * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -88,19 +89,19 @@ class EmailSenderProfile extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>-1, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>'Id',), - 'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>-1, 'enabled'=>1, 'position'=>20, 'notnull'=>1, 'index'=>1,), - 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>1), - 'email' => array('type'=>'varchar(255)', 'label'=>'Email', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1), - 'private' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'User', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'default'=>'0', 'notnull'=>1), - 'signature' => array('type'=>'html', 'label'=>'Signature', 'visible'=>3, 'enabled'=>1, 'position'=>400, 'notnull'=>-1, 'index'=>1,), - 'position' => array('type'=>'integer', 'label'=>'Position', 'visible'=>1, 'enabled'=>1, 'position'=>405, 'notnull'=>-1, 'index'=>1,), - 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,), - 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,), - 'active' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'default'=>1, 'position'=>1000, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array(0=>'Disabled', 1=>'Enabled')), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'visible' => -1, 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'index' => 1, 'comment' => 'Id',), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'visible' => -1, 'enabled' => 1, 'position' => 20, 'notnull' => 1, 'index' => 1,), + 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'visible' => 1, 'enabled' => 1, 'position' => 30, 'notnull' => 1), + 'email' => array('type' => 'varchar(255)', 'label' => 'Email', 'visible' => 1, 'enabled' => 1, 'position' => 40, 'notnull' => -1), + 'private' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'User', 'visible' => 1, 'enabled' => 1, 'position' => 50, 'default' => '0', 'notnull' => 1), + 'signature' => array('type' => 'html', 'label' => 'Signature', 'visible' => 3, 'enabled' => 1, 'position' => 400, 'notnull' => -1, 'index' => 1,), + 'position' => array('type' => 'integer', 'label' => 'Position', 'visible' => 1, 'enabled' => 1, 'position' => 405, 'notnull' => -1, 'index' => 1,), + 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'visible' => -1, 'enabled' => 1, 'position' => 500, 'notnull' => 1,), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'visible' => -1, 'enabled' => 1, 'position' => 500, 'notnull' => 1,), + 'active' => array('type' => 'integer', 'label' => 'Status', 'visible' => 1, 'enabled' => 1, 'default' => 1, 'position' => 1000, 'notnull' => 1, 'index' => 1, 'arrayofkeyval' => array(0 => 'Disabled', 1 => 'Enabled')), ); /** From dcf25336ba2145f6d6497ca5ce47aa1ddec116bc Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:39:17 +0100 Subject: [PATCH 261/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/core/class/timespent.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/timespent.class.php b/htdocs/core/class/timespent.class.php index a4327d55ae9..c3a830c5d48 100644 --- a/htdocs/core/class/timespent.class.php +++ b/htdocs/core/class/timespent.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2023-2024 Frédéric France * Copyright (C) 2023 Gauthier VERDOL + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -111,7 +112,7 @@ class TimeSpent extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'css' => 'left', 'comment' => "Id"), From 254dc732bd3770781fe0c20389cfd29d50572fbf Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:39:19 +0100 Subject: [PATCH 262/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- .../class/emailcollector.class.php | 93 ++++++++++--------- 1 file changed, 47 insertions(+), 46 deletions(-) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index bffa405796e..9400a7d9437 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -119,40 +120,40 @@ class EmailCollector extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>2, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1), - 'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20), - 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'help'=>'Example: MyCollector1', 'csslist'=>'tdoverflowmax200'), - 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>-1, 'searchall'=>1, 'help'=>'Example: My Email collector', 'csslist'=>'tdoverflowmax150'), - 'description' => array('type'=>'text', 'label'=>'Description', 'visible'=>-1, 'enabled'=>1, 'position'=>60, 'notnull'=>-1, 'cssview'=>'small', 'csslist'=>'small tdoverflowmax200'), - 'host' => array('type'=>'varchar(255)', 'label'=>'EMailHost', 'visible'=>1, 'enabled'=>1, 'position'=>90, 'notnull'=>1, 'searchall'=>1, 'comment'=>"IMAP server", 'help'=>'Example: imap.gmail.com', 'csslist'=>'tdoverflowmax125'), - 'port' => array('type'=>'varchar(10)', 'label'=>'EMailHostPort', 'visible'=>1, 'enabled'=>1, 'position'=>91, 'notnull'=>1, 'searchall'=>0, 'comment'=>"IMAP server port", 'help'=>'Example: 993', 'csslist'=>'tdoverflowmax50', 'default'=>'993'), - 'hostcharset' => array('type'=>'varchar(16)', 'label'=>'HostCharset', 'visible'=>-1, 'enabled'=>1, 'position'=>92, 'notnull'=>0, 'searchall'=>0, 'comment'=>"IMAP server charset", 'help'=>'Example: "UTF-8" (May be "US-ASCII" with some Office365)', 'default'=>'UTF-8'), - 'imap_encryption' => array('type'=>'varchar(16)', 'label'=>'ImapEncryption', 'visible'=>-1, 'enabled'=>1, 'position'=>93, 'searchall'=>0, 'comment'=>"IMAP encryption", 'help'=>'ImapEncryptionHelp', 'arrayofkeyval'=> array('ssl'=>'SSL', 'tls' => 'TLS', 'notls' => 'NOTLS'), 'default'=>'ssl'), - 'norsh' => array('type'=>'integer', 'label'=>'NoRSH', 'visible'=>-1, 'enabled'=>"!getDolGlobalInt('MAIN_IMAP_USE_PHPIMAP')", 'position'=>94, 'searchall'=>0, 'help'=>'NoRSHHelp', 'arrayofkeyval'=> array(0 =>'No', 1 => 'Yes'), 'default'=> 0), - 'acces_type' => array('type'=>'integer', 'label'=>'accessType', 'visible'=>-1, 'enabled'=>"getDolGlobalInt('MAIN_IMAP_USE_PHPIMAP')", 'position'=>101, 'notnull'=>1, 'index'=>1, 'comment'=>"IMAP login type", 'arrayofkeyval'=>array('0'=>'loginPassword', '1'=>'oauthToken'), 'default'=>'0', 'help'=>''), - 'login' => array('type'=>'varchar(128)', 'label'=>'Login', 'visible'=>-1, 'enabled'=>1, 'position'=>102, 'notnull'=>-1, 'index'=>1, 'comment'=>"IMAP login", 'help'=>'Example: myaccount@gmail.com'), - 'password' => array('type'=>'password', 'label'=>'Password', 'visible'=>-1, 'enabled'=>"1", 'position'=>103, 'notnull'=>-1, 'comment'=>"IMAP password", 'help'=>'WithGMailYouCanCreateADedicatedPassword'), - 'oauth_service' => array('type'=>'varchar(128)', 'label'=>'oauthService', 'visible'=>-1, 'enabled'=>"getDolGlobalInt('MAIN_IMAP_USE_PHPIMAP')", 'position'=>104, 'notnull'=>0, 'index'=>1, 'comment'=>"IMAP login oauthService", 'arrayofkeyval'=>array(), 'help'=>'TokenMustHaveBeenCreated'), - 'source_directory' => array('type'=>'varchar(255)', 'label'=>'MailboxSourceDirectory', 'visible'=>-1, 'enabled'=>1, 'position'=>109, 'notnull'=>1, 'default' => 'Inbox', 'help'=>'Example: INBOX, [Gmail]/Spam, [Gmail]/Draft, [Gmail]/Brouillons, [Gmail]/Sent Mail, [Gmail]/Messages envoyés, ...'), - 'target_directory' => array('type'=>'varchar(255)', 'label'=>'MailboxTargetDirectory', 'visible'=>1, 'enabled'=>1, 'position'=>110, 'notnull'=>0, 'help'=>"EmailCollectorTargetDir"), - 'maxemailpercollect' => array('type'=>'integer', 'label'=>'MaxEmailCollectPerCollect', 'visible'=>-1, 'enabled'=>1, 'position'=>111, 'default'=>50), - 'datelastresult' => array('type'=>'datetime', 'label'=>'DateLastCollectResult', 'visible'=>1, 'enabled'=>'$action != "create" && $action != "edit"', 'position'=>121, 'notnull'=>-1, 'csslist'=>'nowraponall'), - 'codelastresult' => array('type'=>'varchar(16)', 'label'=>'CodeLastResult', 'visible'=>1, 'enabled'=>'$action != "create" && $action != "edit"', 'position'=>122, 'notnull'=>-1,), - 'lastresult' => array('type'=>'varchar(255)', 'label'=>'LastResult', 'visible'=>1, 'enabled'=>'$action != "create" && $action != "edit"', 'position'=>123, 'notnull'=>-1, 'cssview'=>'small', 'csslist'=>'small tdoverflowmax200'), - 'datelastok' => array('type'=>'datetime', 'label'=>'DateLastcollectResultOk', 'visible'=>1, 'enabled'=>'$action != "create"', 'position'=>125, 'notnull'=>-1, 'csslist'=>'nowraponall'), - 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'visible'=>0, 'enabled'=>1, 'position'=>61, 'notnull'=>-1,), - 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'visible'=>0, 'enabled'=>1, 'position'=>62, 'notnull'=>-1,), - 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>-2, 'enabled'=>1, 'position'=>500, 'notnull'=>1,), - 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-2, 'enabled'=>1, 'position'=>501, 'notnull'=>1,), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'visible' => 2, 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'index' => 1), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'enabled' => 1, 'visible' => 0, 'default' => 1, 'notnull' => 1, 'index' => 1, 'position' => 20), + 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'showoncombobox' => 1, 'index' => 1, 'position' => 10, 'searchall' => 1, 'help' => 'Example: MyCollector1', 'csslist' => 'tdoverflowmax200'), + 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'visible' => 1, 'enabled' => 1, 'position' => 30, 'notnull' => -1, 'searchall' => 1, 'help' => 'Example: My Email collector', 'csslist' => 'tdoverflowmax150'), + 'description' => array('type' => 'text', 'label' => 'Description', 'visible' => -1, 'enabled' => 1, 'position' => 60, 'notnull' => -1, 'cssview' => 'small', 'csslist' => 'small tdoverflowmax200'), + 'host' => array('type' => 'varchar(255)', 'label' => 'EMailHost', 'visible' => 1, 'enabled' => 1, 'position' => 90, 'notnull' => 1, 'searchall' => 1, 'comment' => "IMAP server", 'help' => 'Example: imap.gmail.com', 'csslist' => 'tdoverflowmax125'), + 'port' => array('type' => 'varchar(10)', 'label' => 'EMailHostPort', 'visible' => 1, 'enabled' => 1, 'position' => 91, 'notnull' => 1, 'searchall' => 0, 'comment' => "IMAP server port", 'help' => 'Example: 993', 'csslist' => 'tdoverflowmax50', 'default' => '993'), + 'hostcharset' => array('type' => 'varchar(16)', 'label' => 'HostCharset', 'visible' => -1, 'enabled' => 1, 'position' => 92, 'notnull' => 0, 'searchall' => 0, 'comment' => "IMAP server charset", 'help' => 'Example: "UTF-8" (May be "US-ASCII" with some Office365)', 'default' => 'UTF-8'), + 'imap_encryption' => array('type' => 'varchar(16)', 'label' => 'ImapEncryption', 'visible' => -1, 'enabled' => 1, 'position' => 93, 'searchall' => 0, 'comment' => "IMAP encryption", 'help' => 'ImapEncryptionHelp', 'arrayofkeyval' => array('ssl' => 'SSL', 'tls' => 'TLS', 'notls' => 'NOTLS'), 'default' => 'ssl'), + 'norsh' => array('type' => 'integer', 'label' => 'NoRSH', 'visible' => -1, 'enabled' => "!getDolGlobalInt('MAIN_IMAP_USE_PHPIMAP')", 'position' => 94, 'searchall' => 0, 'help' => 'NoRSHHelp', 'arrayofkeyval' => array(0 => 'No', 1 => 'Yes'), 'default' => 0), + 'acces_type' => array('type' => 'integer', 'label' => 'accessType', 'visible' => -1, 'enabled' => "getDolGlobalInt('MAIN_IMAP_USE_PHPIMAP')", 'position' => 101, 'notnull' => 1, 'index' => 1, 'comment' => "IMAP login type", 'arrayofkeyval' => array('0' => 'loginPassword', '1' => 'oauthToken'), 'default' => '0', 'help' => ''), + 'login' => array('type' => 'varchar(128)', 'label' => 'Login', 'visible' => -1, 'enabled' => 1, 'position' => 102, 'notnull' => -1, 'index' => 1, 'comment' => "IMAP login", 'help' => 'Example: myaccount@gmail.com'), + 'password' => array('type' => 'password', 'label' => 'Password', 'visible' => -1, 'enabled' => "1", 'position' => 103, 'notnull' => -1, 'comment' => "IMAP password", 'help' => 'WithGMailYouCanCreateADedicatedPassword'), + 'oauth_service' => array('type' => 'varchar(128)', 'label' => 'oauthService', 'visible' => -1, 'enabled' => "getDolGlobalInt('MAIN_IMAP_USE_PHPIMAP')", 'position' => 104, 'notnull' => 0, 'index' => 1, 'comment' => "IMAP login oauthService", 'arrayofkeyval' => array(), 'help' => 'TokenMustHaveBeenCreated'), + 'source_directory' => array('type' => 'varchar(255)', 'label' => 'MailboxSourceDirectory', 'visible' => -1, 'enabled' => 1, 'position' => 109, 'notnull' => 1, 'default' => 'Inbox', 'help' => 'Example: INBOX, [Gmail]/Spam, [Gmail]/Draft, [Gmail]/Brouillons, [Gmail]/Sent Mail, [Gmail]/Messages envoyés, ...'), + 'target_directory' => array('type' => 'varchar(255)', 'label' => 'MailboxTargetDirectory', 'visible' => 1, 'enabled' => 1, 'position' => 110, 'notnull' => 0, 'help' => "EmailCollectorTargetDir"), + 'maxemailpercollect' => array('type' => 'integer', 'label' => 'MaxEmailCollectPerCollect', 'visible' => -1, 'enabled' => 1, 'position' => 111, 'default' => 50), + 'datelastresult' => array('type' => 'datetime', 'label' => 'DateLastCollectResult', 'visible' => 1, 'enabled' => '$action != "create" && $action != "edit"', 'position' => 121, 'notnull' => -1, 'csslist' => 'nowraponall'), + 'codelastresult' => array('type' => 'varchar(16)', 'label' => 'CodeLastResult', 'visible' => 1, 'enabled' => '$action != "create" && $action != "edit"', 'position' => 122, 'notnull' => -1,), + 'lastresult' => array('type' => 'varchar(255)', 'label' => 'LastResult', 'visible' => 1, 'enabled' => '$action != "create" && $action != "edit"', 'position' => 123, 'notnull' => -1, 'cssview' => 'small', 'csslist' => 'small tdoverflowmax200'), + 'datelastok' => array('type' => 'datetime', 'label' => 'DateLastcollectResultOk', 'visible' => 1, 'enabled' => '$action != "create"', 'position' => 125, 'notnull' => -1, 'csslist' => 'nowraponall'), + 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'visible' => 0, 'enabled' => 1, 'position' => 61, 'notnull' => -1,), + 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'visible' => 0, 'enabled' => 1, 'position' => 62, 'notnull' => -1,), + 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'visible' => -2, 'enabled' => 1, 'position' => 500, 'notnull' => 1,), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'visible' => -2, 'enabled' => 1, 'position' => 501, 'notnull' => 1,), //'date_validation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>502), - 'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'visible'=>-2, 'enabled'=>1, 'position'=>510, 'notnull'=>1,), - 'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'visible'=>-2, 'enabled'=>1, 'position'=>511, 'notnull'=>-1,), + 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'visible' => -2, 'enabled' => 1, 'position' => 510, 'notnull' => 1,), + 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'visible' => -2, 'enabled' => 1, 'position' => 511, 'notnull' => -1,), //'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512), - 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'visible'=>-2, 'enabled'=>1, 'position'=>1000, 'notnull'=>-1,), - 'status' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>1000, 'notnull'=>1, 'default'=>'0', 'index'=>1, 'arrayofkeyval'=>array('0'=>'Inactive', '1'=>'Active')) + 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'visible' => -2, 'enabled' => 1, 'position' => 1000, 'notnull' => -1,), + 'status' => array('type' => 'integer', 'label' => 'Status', 'visible' => 1, 'enabled' => 1, 'position' => 1000, 'notnull' => 1, 'default' => '0', 'index' => 1, 'arrayofkeyval' => array('0' => 'Inactive', '1' => 'Active')) ); @@ -614,7 +615,7 @@ class EmailCollector extends CommonObject //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); $hookmanager->initHooks(array('emailcollectordao')); - $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $parameters = array('id' => $this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; @@ -730,7 +731,7 @@ class EmailCollector extends CommonObject $i = 0; while ($i < $num) { $obj = $this->db->fetch_object($resql); - $this->filters[$obj->rowid] = array('id'=>$obj->rowid, 'type'=>$obj->type, 'rulevalue'=>$obj->rulevalue, 'status'=>$obj->status); + $this->filters[$obj->rowid] = array('id' => $obj->rowid, 'type' => $obj->type, 'rulevalue' => $obj->rulevalue, 'status' => $obj->status); $i++; } $this->db->free($resql); @@ -762,7 +763,7 @@ class EmailCollector extends CommonObject $i = 0; while ($i < $num) { $obj = $this->db->fetch_object($resql); - $this->actions[$obj->rowid] = array('id'=>$obj->rowid, 'type'=>$obj->type, 'actionparam'=>$obj->actionparam, 'status'=>$obj->status); + $this->actions[$obj->rowid] = array('id' => $obj->rowid, 'type' => $obj->type, 'actionparam' => $obj->actionparam, 'status' => $obj->status); $i++; } $this->db->free($resql); @@ -1673,8 +1674,8 @@ class EmailCollector extends CommonObject } else { $operationslog .= " - ".dol_escape_htmltag((string) $imapemail); } - $operationslog .= " - References: ".dol_escape_htmltag($headers['References']??'')." - Subject: ".dol_escape_htmltag($headers['Subject']); - dol_syslog("** Process email ".$iforemailloop." References: ".($headers['References']??'')." Subject: ".$headers['Subject']); + $operationslog .= " - References: ".dol_escape_htmltag($headers['References'] ?? '')." - Subject: ".dol_escape_htmltag($headers['Subject']); + dol_syslog("** Process email ".$iforemailloop." References: ".($headers['References'] ?? '')." Subject: ".$headers['Subject']); $trackidfoundintorecipienttype = ''; @@ -2678,7 +2679,7 @@ class EmailCollector extends CommonObject } if (!empty($attachments)) { // There is an attachment for the ticket -> store attachment - $ticket = New Ticket($this->db); + $ticket = new Ticket($this->db); $ticket->fetch($fk_element_id); $destdir = $conf->ticket->dir_output.'/'.$ticket->ref; if (!dol_is_dir($destdir)) { @@ -3248,23 +3249,23 @@ class EmailCollector extends CommonObject } $parameters = array( - 'connection'=> $connection, - 'imapemail'=>$imapemail, - 'overview'=>$overview, + 'connection' => $connection, + 'imapemail' => $imapemail, + 'overview' => $overview, 'from' => $from, 'fromtext' => $fromtext, - 'actionparam'=> $operation['actionparam'], + 'actionparam' => $operation['actionparam'], 'thirdpartyid' => $thirdpartyid, - 'objectid'=> $objectid, - 'objectemail'=> $objectemail, + 'objectid' => $objectid, + 'objectemail' => $objectemail, - 'messagetext'=>$messagetext, - 'subject'=>$subject, - 'header'=>$header, - 'attachments'=>$attachments, + 'messagetext' => $messagetext, + 'subject' => $subject, + 'header' => $header, + 'attachments' => $attachments, ); $reshook = $hookmanager->executeHooks('doCollectImapOneCollector', $parameters, $this, $operation['type']); From 8a00ee901f28540a0a871d735fef2e3be6c38e75 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:39:21 +0100 Subject: [PATCH 263/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- .../class/emailcollectoraction.class.php | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/htdocs/emailcollector/class/emailcollectoraction.class.php b/htdocs/emailcollector/class/emailcollectoraction.class.php index bdefd8a1f87..cafee277913 100644 --- a/htdocs/emailcollector/class/emailcollectoraction.class.php +++ b/htdocs/emailcollector/class/emailcollectoraction.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2017 Laurent Destailleur * Copyright (C) ---Put here your own copyright and developer email--- * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -78,20 +79,20 @@ class EmailCollectorAction extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",), - 'fk_emailcollector' => array('type'=>'integer', 'label'=>'Id of emailcollector', 'foreignkey'=>'emailcollector.rowid'), - 'type' => array('type'=>'varchar(128)', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1), - 'actionparam' => array('type'=>'text', 'label'=>'ParamForAction', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'notnull'=>-1), - 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>500, 'notnull'=>1,), - 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'position'=>501, 'notnull'=>1,), - 'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'llx_user.rowid',), - 'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1,), - 'position' => array('type'=>'integer', 'label'=>'Position', 'enabled'=>1, 'visible'=>1, 'position'=>600, 'default'=>'0',), - 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,), - 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'position'=>1000, 'notnull'=>1, 'default'=>1, 'arrayofkeyval'=>array('0'=>'Disabled', '1'=>'Enabled')), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'position' => 1, 'notnull' => 1, 'index' => 1, 'comment' => "Id",), + 'fk_emailcollector' => array('type' => 'integer', 'label' => 'Id of emailcollector', 'foreignkey' => 'emailcollector.rowid'), + 'type' => array('type' => 'varchar(128)', 'label' => 'Type', 'enabled' => 1, 'visible' => 1, 'position' => 10, 'notnull' => 1, 'index' => 1), + 'actionparam' => array('type' => 'text', 'label' => 'ParamForAction', 'enabled' => 1, 'visible' => 1, 'position' => 40, 'notnull' => -1), + 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'visible' => -2, 'position' => 500, 'notnull' => 1,), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'visible' => -2, 'position' => 501, 'notnull' => 1,), + 'fk_user_creat' => array('type' => 'integer', 'label' => 'UserAuthor', 'enabled' => 1, 'visible' => -2, 'position' => 510, 'notnull' => 1, 'foreignkey' => 'llx_user.rowid',), + 'fk_user_modif' => array('type' => 'integer', 'label' => 'UserModif', 'enabled' => 1, 'visible' => -2, 'position' => 511, 'notnull' => -1,), + 'position' => array('type' => 'integer', 'label' => 'Position', 'enabled' => 1, 'visible' => 1, 'position' => 600, 'default' => '0',), + 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'position' => 1000, 'notnull' => -1,), + 'status' => array('type' => 'integer', 'label' => 'Status', 'enabled' => 1, 'visible' => 1, 'position' => 1000, 'notnull' => 1, 'default' => 1, 'arrayofkeyval' => array('0' => 'Disabled', '1' => 'Enabled')), ); public $rowid; public $fk_emailcollector; @@ -337,7 +338,7 @@ class EmailCollectorAction extends CommonObject global $action, $hookmanager; $hookmanager->initHooks(array('emailcollectoractiondao')); - $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $parameters = array('id' => $this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; From 696d748375431e904dd00139d1c8d979e375af02 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:39:23 +0100 Subject: [PATCH 264/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- .../class/emailcollectorfilter.class.php | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/htdocs/emailcollector/class/emailcollectorfilter.class.php b/htdocs/emailcollector/class/emailcollectorfilter.class.php index 52acc3440d7..6e1442c50a5 100644 --- a/htdocs/emailcollector/class/emailcollectorfilter.class.php +++ b/htdocs/emailcollector/class/emailcollectorfilter.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2017 Laurent Destailleur * Copyright (C) ---Put here your own copyright and developer email--- * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -80,19 +81,19 @@ class EmailCollectorFilter extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",), - 'fk_emailcollector' => array('type'=>'integer', 'label'=>'Id of emailcollector', 'foreignkey'=>'emailcollector.rowid'), - 'type' => array('type'=>'varchar(128)', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'position'=>10, 'notnull'=>1,), - 'rulevalue' => array('type'=>'varchar(255)', 'label'=>'ValueOfRule', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>-1, 'help'=>"Value of Rule",), - 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>500, 'notnull'=>1,), - 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'position'=>501, 'notnull'=>1,), - 'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'llx_user.rowid',), - 'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1,), - 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,), - 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'position'=>1000, 'notnull'=>1, 'default'=>1, 'arrayofkeyval'=>array('0'=>'Disabled', '1'=>'Enabled')), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'position' => 1, 'notnull' => 1, 'index' => 1, 'comment' => "Id",), + 'fk_emailcollector' => array('type' => 'integer', 'label' => 'Id of emailcollector', 'foreignkey' => 'emailcollector.rowid'), + 'type' => array('type' => 'varchar(128)', 'label' => 'Type', 'enabled' => 1, 'visible' => 1, 'position' => 10, 'notnull' => 1,), + 'rulevalue' => array('type' => 'varchar(255)', 'label' => 'ValueOfRule', 'enabled' => 1, 'visible' => 1, 'position' => 30, 'notnull' => -1, 'help' => "Value of Rule",), + 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'visible' => -2, 'position' => 500, 'notnull' => 1,), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'visible' => -2, 'position' => 501, 'notnull' => 1,), + 'fk_user_creat' => array('type' => 'integer', 'label' => 'UserAuthor', 'enabled' => 1, 'visible' => -2, 'position' => 510, 'notnull' => 1, 'foreignkey' => 'llx_user.rowid',), + 'fk_user_modif' => array('type' => 'integer', 'label' => 'UserModif', 'enabled' => 1, 'visible' => -2, 'position' => 511, 'notnull' => -1,), + 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'position' => 1000, 'notnull' => -1,), + 'status' => array('type' => 'integer', 'label' => 'Status', 'enabled' => 1, 'visible' => 1, 'position' => 1000, 'notnull' => 1, 'default' => 1, 'arrayofkeyval' => array('0' => 'Disabled', '1' => 'Enabled')), ); public $rowid; public $fk_emailcollector; @@ -351,7 +352,7 @@ class EmailCollectorFilter extends CommonObject global $action, $hookmanager; $hookmanager->initHooks(array('emailcollectorfilterdao')); - $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $parameters = array('id' => $this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; From 829712cf200056dd97a8a1622b854935f9197e08 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:39:26 +0100 Subject: [PATCH 265/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- .../class/conferenceorboothattendee.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/eventorganization/class/conferenceorboothattendee.class.php b/htdocs/eventorganization/class/conferenceorboothattendee.class.php index 29f7fb8eafa..1712a02cec4 100644 --- a/htdocs/eventorganization/class/conferenceorboothattendee.class.php +++ b/htdocs/eventorganization/class/conferenceorboothattendee.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2017 Laurent Destailleur * Copyright (C) ---Put here your own copyright and developer email--- * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -99,7 +100,7 @@ class ConferenceOrBoothAttendee extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'css' => 'left', 'comment' => "Id"), From b323ae5d3dc95b30d3082895e86110cbbc9c30b3 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:39:28 +0100 Subject: [PATCH 266/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/expedition/class/expedition.class.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 1e880c2c91a..39eab0d71d0 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -13,6 +13,7 @@ * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2020 Lenin Rivas + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -91,7 +92,7 @@ class Expedition extends CommonObject /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array(); @@ -1691,7 +1692,7 @@ class Expedition extends CommonObject $line->pa_ht = $obj->pa_ht; // Local taxes - $localtax_array = array(0=>$obj->localtax1_type, 1=>$obj->localtax1_tx, 2=>$obj->localtax2_type, 3=>$obj->localtax2_tx); + $localtax_array = array(0 => $obj->localtax1_type, 1 => $obj->localtax1_tx, 2 => $obj->localtax2_type, 3 => $obj->localtax2_tx); $localtax1_tx = get_localtax($obj->tva_tx, 1, $this->thirdparty); $localtax2_tx = get_localtax($obj->tva_tx, 2, $this->thirdparty); @@ -1913,7 +1914,7 @@ class Expedition extends CommonObject $result .= $linkend; global $action; $hookmanager->initHooks(array($this->element . 'dao')); - $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $parameters = array('id' => $this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; @@ -2252,7 +2253,7 @@ class Expedition extends CommonObject // If stock increment is done on closing if (!$error && isModEnabled('stock') && getDolGlobalString('STOCK_CALCULATE_ON_SHIPMENT_CLOSE')) { $result = $this->manageStockMvtOnEvt($user); - if ($result<0) { + if ($result < 0) { $error++; } } @@ -2294,7 +2295,7 @@ class Expedition extends CommonObject { global $langs; - $error=0; + $error = 0; require_once DOL_DOCUMENT_ROOT . '/product/stock/class/mouvementstock.class.php'; @@ -2366,7 +2367,7 @@ class Expedition extends CommonObject } else { $this->error = $this->db->lasterror(); $this->errors[] = $this->db->lasterror(); - $error ++; + $error++; } return $error; From 61f9bd468db65bed681c2443f2d0582c77a03076 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:39:30 +0100 Subject: [PATCH 267/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- .../expensereport/class/expensereport_ik.class.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/expensereport/class/expensereport_ik.class.php b/htdocs/expensereport/class/expensereport_ik.class.php index 5079a6a5210..a1cc92421e4 100644 --- a/htdocs/expensereport/class/expensereport_ik.class.php +++ b/htdocs/expensereport/class/expensereport_ik.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2017 Pierre-Henry Favre + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -71,14 +72,14 @@ class ExpenseReportIk extends CommonObject /** * Attribute object linked with database - * @var array + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - 'rowid'=>array('type'=>'integer', 'index'=>true) - ,'fk_c_exp_tax_cat'=>array('type'=>'integer', 'index'=>true) - ,'fk_range'=>array('type'=>'integer', 'index'=>true) - ,'coef'=>array('type'=>'double') - ,'ikoffset'=>array('type'=>'double') + 'rowid' => array('type' => 'integer', 'index' => true) + ,'fk_c_exp_tax_cat' => array('type' => 'integer', 'index' => true) + ,'fk_range' => array('type' => 'integer', 'index' => true) + ,'coef' => array('type' => 'double') + ,'ikoffset' => array('type' => 'double') ); From b04317adb66173cec3e7894b4f5d31c88a955e9f Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:39:32 +0100 Subject: [PATCH 268/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- .../class/expensereport_rule.class.php | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/htdocs/expensereport/class/expensereport_rule.class.php b/htdocs/expensereport/class/expensereport_rule.class.php index 5966ba2399a..2e07990ac93 100644 --- a/htdocs/expensereport/class/expensereport_rule.class.php +++ b/htdocs/expensereport/class/expensereport_rule.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2017 Pierre-Henry Favre + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -109,20 +110,20 @@ class ExpenseReportRule extends CommonObject /** * Attribute object linked with database - * @var array + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - 'rowid'=>array('type'=>'integer', 'index'=>true) - ,'dates'=>array('type'=>'date') - ,'datee'=>array('type'=>'date') - ,'amount'=>array('type'=>'double') - ,'restrictive'=>array('type'=>'integer') - ,'fk_user'=>array('type'=>'integer') - ,'fk_usergroup'=>array('type'=>'integer') - ,'fk_c_type_fees'=>array('type'=>'integer') - ,'code_expense_rules_type'=>array('type'=>'string') - ,'is_for_all'=>array('type'=>'integer') - ,'entity'=>array('type'=>'integer') + 'rowid' => array('type' => 'integer', 'index' => true) + ,'dates' => array('type' => 'date') + ,'datee' => array('type' => 'date') + ,'amount' => array('type' => 'double') + ,'restrictive' => array('type' => 'integer') + ,'fk_user' => array('type' => 'integer') + ,'fk_usergroup' => array('type' => 'integer') + ,'fk_c_type_fees' => array('type' => 'integer') + ,'code_expense_rules_type' => array('type' => 'string') + ,'is_for_all' => array('type' => 'integer') + ,'entity' => array('type' => 'integer') ); From 23eea8430937063ae010d08f712a967a48867566 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:39:34 +0100 Subject: [PATCH 269/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/fourn/class/fournisseur.facture-rec.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index f592f36ea9f..4b5fd7a64ac 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -7,6 +7,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2015 Marcos García * Copyright (C) 2017-2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -189,7 +190,7 @@ class FactureFournisseurRec extends CommonInvoice // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), From e289e36fc1260105f604098aa381930292f670e6 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:39:36 +0100 Subject: [PATCH 270/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/hrm/class/evaluation.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/hrm/class/evaluation.class.php b/htdocs/hrm/class/evaluation.class.php index fe3dc78df7f..ccc97cc8f87 100644 --- a/htdocs/hrm/class/evaluation.class.php +++ b/htdocs/hrm/class/evaluation.class.php @@ -5,6 +5,7 @@ * Copyright (C) 2021 Jean-Pascal BOUDET * Copyright (C) 2021 Grégory BLEMAND * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -103,7 +104,7 @@ class Evaluation extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'css' => 'left', 'comment' => "Id"), From a2a2b3fa0e980632d34b884b2eed847549cc1b93 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:39:38 +0100 Subject: [PATCH 271/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/hrm/class/evaluationdet.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/hrm/class/evaluationdet.class.php b/htdocs/hrm/class/evaluationdet.class.php index 5a2d230bf59..50335a09417 100644 --- a/htdocs/hrm/class/evaluationdet.class.php +++ b/htdocs/hrm/class/evaluationdet.class.php @@ -5,6 +5,7 @@ * Copyright (C) 2021 Jean-Pascal BOUDET * Copyright (C) 2021 Grégory BLEMAND * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -102,7 +103,7 @@ class EvaluationLine extends CommonObjectLine // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'css' => 'left', 'comment' => "Id"), From 71fa5af141cff4f09f097b629267fa1d24fbd5f0 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:39:40 +0100 Subject: [PATCH 272/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/hrm/class/job.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/hrm/class/job.class.php b/htdocs/hrm/class/job.class.php index 08ef1dc33de..1e2bc91b1cd 100644 --- a/htdocs/hrm/class/job.class.php +++ b/htdocs/hrm/class/job.class.php @@ -5,6 +5,7 @@ * Copyright (C) 2021 Jean-Pascal BOUDET * Copyright (C) 2021 Grégory BLEMAND * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -101,7 +102,7 @@ class Job extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'css' => 'left', 'comment' => "Id"), From 7fb5c23758dae0f277ea43f3f2d25f4bf4078c1e Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:39:42 +0100 Subject: [PATCH 273/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/hrm/class/position.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/hrm/class/position.class.php b/htdocs/hrm/class/position.class.php index a65fc43e564..65d1e8c3557 100644 --- a/htdocs/hrm/class/position.class.php +++ b/htdocs/hrm/class/position.class.php @@ -5,6 +5,7 @@ * Copyright (C) 2021 Jean-Pascal BOUDET * Copyright (C) 2021 Grégory BLEMAND * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -101,7 +102,7 @@ class Position extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 2, 'index' => 1, 'css' => 'left', 'comment' => "Id"), From 4c56911ee89ba382a9a5db3364932e77adb47d95 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:39:44 +0100 Subject: [PATCH 274/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/hrm/class/skill.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/hrm/class/skill.class.php b/htdocs/hrm/class/skill.class.php index a7e799e7c47..8a91dbc816b 100644 --- a/htdocs/hrm/class/skill.class.php +++ b/htdocs/hrm/class/skill.class.php @@ -5,6 +5,7 @@ * Copyright (C) 2021 Jean-Pascal BOUDET * Copyright (C) 2021 Grégory BLEMAND * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -107,7 +108,7 @@ class Skill extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'css' => 'left', 'comment' => "Id"), From 3865c099544b01d6a943cfc87be89fc7b8b3a8f2 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:39:46 +0100 Subject: [PATCH 275/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/hrm/class/skilldet.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/hrm/class/skilldet.class.php b/htdocs/hrm/class/skilldet.class.php index 905ce049df9..fa9a4736b78 100644 --- a/htdocs/hrm/class/skilldet.class.php +++ b/htdocs/hrm/class/skilldet.class.php @@ -5,6 +5,7 @@ * Copyright (C) 2021 Jean-Pascal BOUDET * Copyright (C) 2021 Grégory BLEMAND * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -101,7 +102,7 @@ class Skilldet extends CommonObjectLine // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'css' => 'left', 'comment' => "Id"), From 54b2305e74cdd58325aba604d9e955085494047e Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:39:48 +0100 Subject: [PATCH 276/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/hrm/class/skillrank.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/hrm/class/skillrank.class.php b/htdocs/hrm/class/skillrank.class.php index 4f820c3a62f..103067d9154 100644 --- a/htdocs/hrm/class/skillrank.class.php +++ b/htdocs/hrm/class/skillrank.class.php @@ -5,6 +5,7 @@ * Copyright (C) 2021 Jean-Pascal BOUDET * Copyright (C) 2021 Grégory BLEMAND * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -103,7 +104,7 @@ class SkillRank extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'css' => 'left', 'comment' => "Id"), From 2ab17157d25923d16d50bfffa037203522b090c1 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:39:50 +0100 Subject: [PATCH 277/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/knowledgemanagement/class/knowledgerecord.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index 558922a7af8..74368e35e58 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -99,7 +99,7 @@ class KnowledgeRecord extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'css' => 'left', 'comment' => "Id"), From 26e487d69e3db8181d5a34f958a21c563d5670aa Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:39:52 +0100 Subject: [PATCH 278/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- .../template/class/myobject.class.php | 41 ++++++++++--------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 906cdc3d0e2..b0d8ce35479 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2023-2024 Frédéric France * Copyright (C) ---Put here your own copyright and developer email--- + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -115,30 +116,30 @@ class MyObject extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields into database and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'noteditable'=>1, 'notnull'=> 1, 'index'=>1, 'position'=>1, 'comment'=>'Id', 'css'=>'left'), - 'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>10), - 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'noteditable'=>0, 'default'=>'', 'notnull'=> 1, 'showoncombobox'=>1, 'index'=>1, 'position'=>20, 'searchall'=>1, 'comment'=>'Reference of object', 'validate'=>1), - 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth300', 'cssview'=>'wordbreak', 'help'=>'Help text', 'showoncombobox'=>2, 'validate'=>1, 'alwayseditable'=>1), - 'amount' => array('type'=>'price', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'default'=>'null', 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for amount', 'validate'=>1), - 'qty' => array('type'=>'real', 'label'=>'Qty', 'enabled'=>1, 'visible'=>1, 'default'=>'0', 'position'=>45, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for quantity', 'css'=>'maxwidth75imp', 'validate'=>1), - 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:((status:=:1) AND (entity:IN:__SHARED_ENTITIES__))', 'picto'=>'company', 'label'=>'ThirdParty', 'visible'=> 1, 'enabled'=>'isModEnabled("societe")', 'position'=>50, 'notnull'=>-1, 'index'=>1, 'help'=>'OrganizationEventLinkToThirdParty', 'validate'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx', 'csslist'=>'tdoverflowmax150'), - 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'picto'=>'project', 'enabled'=>'isModEnabled("project")', 'visible'=>-1, 'position'=>52, 'notnull'=>-1, 'index'=>1, 'validate'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx', 'csslist'=>'tdoverflowmax150'), - 'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>3, 'position'=>60, 'validate'=>1), - 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61, 'validate'=>1, 'cssview'=>'wordbreak'), - 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62, 'validate'=>1, 'cssview'=>'wordbreak'), - 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=> 1, 'position'=>500), - 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=> 0, 'position'=>501), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -2, 'noteditable' => 1, 'notnull' => 1, 'index' => 1, 'position' => 1, 'comment' => 'Id', 'css' => 'left'), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'default' => 1, 'index' => 1, 'position' => 10), + 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => 1, 'visible' => 1, 'noteditable' => 0, 'default' => '', 'notnull' => 1, 'showoncombobox' => 1, 'index' => 1, 'position' => 20, 'searchall' => 1, 'comment' => 'Reference of object', 'validate' => 1), + 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => 1, 'visible' => 1, 'position' => 30, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'help' => 'Help text', 'showoncombobox' => 2, 'validate' => 1, 'alwayseditable' => 1), + 'amount' => array('type' => 'price', 'label' => 'Amount', 'enabled' => 1, 'visible' => 1, 'default' => 'null', 'position' => 40, 'searchall' => 0, 'isameasure' => 1, 'help' => 'Help text for amount', 'validate' => 1), + 'qty' => array('type' => 'real', 'label' => 'Qty', 'enabled' => 1, 'visible' => 1, 'default' => '0', 'position' => 45, 'searchall' => 0, 'isameasure' => 1, 'help' => 'Help text for quantity', 'css' => 'maxwidth75imp', 'validate' => 1), + 'fk_soc' => array('type' => 'integer:Societe:societe/class/societe.class.php:1:((status:=:1) AND (entity:IN:__SHARED_ENTITIES__))', 'picto' => 'company', 'label' => 'ThirdParty', 'visible' => 1, 'enabled' => 'isModEnabled("societe")', 'position' => 50, 'notnull' => -1, 'index' => 1, 'help' => 'OrganizationEventLinkToThirdParty', 'validate' => 1, 'css' => 'maxwidth500 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150'), + 'fk_project' => array('type' => 'integer:Project:projet/class/project.class.php:1', 'label' => 'Project', 'picto' => 'project', 'enabled' => 'isModEnabled("project")', 'visible' => -1, 'position' => 52, 'notnull' => -1, 'index' => 1, 'validate' => 1, 'css' => 'maxwidth500 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150'), + 'description' => array('type' => 'text', 'label' => 'Description', 'enabled' => 1, 'visible' => 3, 'position' => 60, 'validate' => 1), + 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => 1, 'visible' => 0, 'position' => 61, 'validate' => 1, 'cssview' => 'wordbreak'), + 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => 1, 'visible' => 0, 'position' => 62, 'validate' => 1, 'cssview' => 'wordbreak'), + 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 500), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'visible' => -2, 'notnull' => 0, 'position' => 501), //'date_validation ' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>502), - 'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'picto'=>'user', 'enabled'=>1, 'visible'=>-2, 'notnull'=> 1, 'position'=>510, 'foreignkey'=>'user.rowid', 'csslist'=>'tdoverflowmax150'), - 'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'picto'=>'user', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511, 'csslist'=>'tdoverflowmax150'), + 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'picto' => 'user', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 510, 'foreignkey' => 'user.rowid', 'csslist' => 'tdoverflowmax150'), + 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'picto' => 'user', 'enabled' => 1, 'visible' => -2, 'notnull' => -1, 'position' => 511, 'csslist' => 'tdoverflowmax150'), //'fk_user_valid' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512), - 'last_main_doc' => array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>1, 'visible'=>0, 'notnull'=>0, 'position'=>600), - 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>0, 'position'=>1000), - 'model_pdf' => array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'notnull'=>-1, 'position'=>1010), - 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=> 1, 'default'=>0, 'index'=>1, 'position'=>2000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 9=>'Canceled'), 'validate'=>1), + 'last_main_doc' => array('type' => 'varchar(255)', 'label' => 'LastMainDoc', 'enabled' => 1, 'visible' => 0, 'notnull' => 0, 'position' => 600), + 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'notnull' => -1, 'index' => 0, 'position' => 1000), + 'model_pdf' => array('type' => 'varchar(255)', 'label' => 'Model pdf', 'enabled' => 1, 'visible' => 0, 'notnull' => -1, 'position' => 1010), + 'status' => array('type' => 'integer', 'label' => 'Status', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'default' => 0, 'index' => 1, 'position' => 2000, 'arrayofkeyval' => array(0 => 'Draft', 1 => 'Validated', 9 => 'Canceled'), 'validate' => 1), ); /** From c7221ff338d73c6a25e81da45d586c5d32963797 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:39:54 +0100 Subject: [PATCH 279/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/mrp/class/mo.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 9c1ade49f15..c896d3216cc 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -94,7 +94,7 @@ class Mo extends CommonObject */ /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -2, 'position' => 1, 'notnull' => 1, 'index' => 1, 'comment' => "Id",), From db110db3cb66d14609e2acbd6beca76ade561b80 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:39:56 +0100 Subject: [PATCH 280/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/opensurvey/class/opensurveysondage.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index 8d0d577cce7..cc28ad8c41d 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2013-2014 Laurent Destailleur * Copyright (C) 2014 Marcos García * Copyright (C) 2020-2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -100,7 +101,7 @@ class Opensurveysondage extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'id_sondage' => array('type' => 'varchar(16)', 'label' => 'Idsondage', 'enabled' => '1', 'position' => 10, 'notnull' => 1, 'visible' => -1,), From 8ff540ecab931fb45a32a4d827b23450b3b6a6cd Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:39:58 +0100 Subject: [PATCH 281/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/partnership/class/partnership.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index 606acb2ecd7..721121b8658 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -104,7 +104,7 @@ class Partnership extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'css' => 'left', 'comment' => "Id"), From 9d866f3dc3586a1fe291785bfd3f8a7e8e24cf57 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:40:01 +0100 Subject: [PATCH 282/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/product/class/product.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 3b31d2064e3..233b35edb76 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -16,6 +16,7 @@ * Copyright (C) 2017 Gustavo Novaro * Copyright (C) 2019-2024 Frédéric France * Copyright (C) 2023 Benjamin Falière + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -582,7 +583,7 @@ class Product extends CommonObject */ /** - * @var array fields of object product + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'index' => 1, 'position' => 1, 'comment' => 'Id'), From 37b466a1358ce3a25be97342a95d0edeaa3e4693 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:40:03 +0100 Subject: [PATCH 283/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/product/class/productcustomerprice.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/productcustomerprice.class.php b/htdocs/product/class/productcustomerprice.class.php index 03b55d72fcb..4507b0fbdb9 100644 --- a/htdocs/product/class/productcustomerprice.class.php +++ b/htdocs/product/class/productcustomerprice.class.php @@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; class ProductCustomerPrice extends CommonObject { /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => 1, 'visible' => 4, 'position' => 10, 'notnull' => 1, 'default' => '(PROV)', 'index' => 1, 'searchall' => 1, 'comment' => "Reference of object", 'showoncombobox' => '1', 'noteditable' => 1), From d55ebea8fbb6499b0819cb9521048a5f00e7f886 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:40:05 +0100 Subject: [PATCH 284/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/product/class/productfournisseurprice.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/productfournisseurprice.class.php b/htdocs/product/class/productfournisseurprice.class.php index f34ce5f9b64..ef09d7b4307 100644 --- a/htdocs/product/class/productfournisseurprice.class.php +++ b/htdocs/product/class/productfournisseurprice.class.php @@ -92,7 +92,7 @@ class ProductFournisseurPrice extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 10, 'notnull' => 1, 'visible' => 0,), From 1f328ddd812fd1aeb5d8916b5a9b8559cb2be376 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:40:07 +0100 Subject: [PATCH 285/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/product/inventory/class/inventory.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php index cb3da2f695a..6ce66586c6c 100644 --- a/htdocs/product/inventory/class/inventory.class.php +++ b/htdocs/product/inventory/class/inventory.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2015 Florian Henry * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -95,7 +96,7 @@ class Inventory extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'visible' => -1, 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'index' => 1, 'comment' => 'Id',), From 1106b9a40fdcdb15e2cdf1e71c1c77eac3ce9252 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:40:09 +0100 Subject: [PATCH 286/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/product/stock/class/entrepot.class.php | 41 ++++++++++--------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index c3106759f8e..203a3b77b9a 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -5,6 +5,7 @@ * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2016 Francis Appels * Copyright (C) 2019-2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -120,30 +121,30 @@ class Entrepot extends CommonObject /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - 'rowid' =>array('type'=>'integer', 'label'=>'ID', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>10), - 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>15), - 'ref' =>array('type'=>'varchar(255)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'showoncombobox'=>1, 'position'=>25, 'searchall'=>1), - 'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-2, 'position'=>35, 'searchall'=>1), - 'lieu' =>array('type'=>'varchar(64)', 'label'=>'LocationSummary', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'showoncombobox'=>2, 'searchall'=>1), - 'fk_parent' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php:1:((statut:=:1) AND (entity:IN:__SHARED_ENTITIES__))', 'label'=>'ParentWarehouse', 'enabled'=>1, 'visible'=>-2, 'position'=>41), - 'fk_project' =>array('type'=>'integer:Project:projet/class/project.class.php:1:(fk_statut:=:1)', 'label'=>'Project', 'enabled'=>'$conf->project->enabled', 'visible'=>-1, 'position'=>25), - 'address' =>array('type'=>'varchar(255)', 'label'=>'Address', 'enabled'=>1, 'visible'=>-2, 'position'=>45, 'searchall'=>1), - 'zip' =>array('type'=>'varchar(10)', 'label'=>'Zip', 'enabled'=>1, 'visible'=>-2, 'position'=>50, 'searchall'=>1), - 'town' =>array('type'=>'varchar(50)', 'label'=>'Town', 'enabled'=>1, 'visible'=>-2, 'position'=>55, 'searchall'=>1), - 'fk_departement' =>array('type'=>'integer', 'label'=>'State', 'enabled'=>1, 'visible'=>0, 'position'=>60), - 'fk_pays' =>array('type'=>'integer:Ccountry:core/class/ccountry.class.php', 'label'=>'Country', 'enabled'=>1, 'visible'=>-1, 'position'=>65), - 'phone' =>array('type'=>'varchar(20)', 'label'=>'Phone', 'enabled'=>1, 'visible'=>-2, 'position'=>70, 'searchall'=>1), - 'fax' =>array('type'=>'varchar(20)', 'label'=>'Fax', 'enabled'=>1, 'visible'=>-2, 'position'=>75, 'searchall'=>1), + 'rowid' => array('type' => 'integer', 'label' => 'ID', 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'position' => 10), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'enabled' => 1, 'visible' => 0, 'default' => 1, 'notnull' => 1, 'index' => 1, 'position' => 15), + 'ref' => array('type' => 'varchar(255)', 'label' => 'Ref', 'enabled' => 1, 'visible' => 1, 'showoncombobox' => 1, 'position' => 25, 'searchall' => 1), + 'description' => array('type' => 'text', 'label' => 'Description', 'enabled' => 1, 'visible' => -2, 'position' => 35, 'searchall' => 1), + 'lieu' => array('type' => 'varchar(64)', 'label' => 'LocationSummary', 'enabled' => 1, 'visible' => 1, 'position' => 40, 'showoncombobox' => 2, 'searchall' => 1), + 'fk_parent' => array('type' => 'integer:Entrepot:product/stock/class/entrepot.class.php:1:((statut:=:1) AND (entity:IN:__SHARED_ENTITIES__))', 'label' => 'ParentWarehouse', 'enabled' => 1, 'visible' => -2, 'position' => 41), + 'fk_project' => array('type' => 'integer:Project:projet/class/project.class.php:1:(fk_statut:=:1)', 'label' => 'Project', 'enabled' => '$conf->project->enabled', 'visible' => -1, 'position' => 25), + 'address' => array('type' => 'varchar(255)', 'label' => 'Address', 'enabled' => 1, 'visible' => -2, 'position' => 45, 'searchall' => 1), + 'zip' => array('type' => 'varchar(10)', 'label' => 'Zip', 'enabled' => 1, 'visible' => -2, 'position' => 50, 'searchall' => 1), + 'town' => array('type' => 'varchar(50)', 'label' => 'Town', 'enabled' => 1, 'visible' => -2, 'position' => 55, 'searchall' => 1), + 'fk_departement' => array('type' => 'integer', 'label' => 'State', 'enabled' => 1, 'visible' => 0, 'position' => 60), + 'fk_pays' => array('type' => 'integer:Ccountry:core/class/ccountry.class.php', 'label' => 'Country', 'enabled' => 1, 'visible' => -1, 'position' => 65), + 'phone' => array('type' => 'varchar(20)', 'label' => 'Phone', 'enabled' => 1, 'visible' => -2, 'position' => 70, 'searchall' => 1), + 'fax' => array('type' => 'varchar(20)', 'label' => 'Fax', 'enabled' => 1, 'visible' => -2, 'position' => 75, 'searchall' => 1), //'fk_user_author' =>array('type'=>'integer', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-2, 'position'=>82), - 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>300), - 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>301), - 'warehouse_usage' => array('type'=>'integer', 'label' => 'WarehouseUsage', 'enabled'=>'getDolGlobalInt("MAIN_FEATURES_LEVEL")', 'visible'=>1, 'position'=>400, 'arrayofkeyval'=>array(1=>'InternalWarehouse', 2=>'ExternalWarehouse')), + 'datec' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'visible' => -2, 'position' => 300), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 301), + 'warehouse_usage' => array('type' => 'integer', 'label' => 'WarehouseUsage', 'enabled' => 'getDolGlobalInt("MAIN_FEATURES_LEVEL")', 'visible' => 1, 'position' => 400, 'arrayofkeyval' => array(1 => 'InternalWarehouse', 2 => 'ExternalWarehouse')), //'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000), //'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'ModelPDF', 'enabled'=>1, 'visible'=>0, 'position'=>1010), - 'statut' =>array('type'=>'tinyint(4)', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'position'=>500, 'css'=>'minwidth50'), + 'statut' => array('type' => 'tinyint(4)', 'label' => 'Status', 'enabled' => 1, 'visible' => 1, 'position' => 500, 'css' => 'minwidth50'), ); /** @@ -825,7 +826,7 @@ class Entrepot extends CommonObject global $action; $hookmanager->initHooks(array('warehousedao')); - $parameters = array('id'=>$this->id, 'getnomurl' => &$result, 'withpicto' => $withpicto, 'option' => $option, 'showfullpath' => $showfullpath, 'notooltip'=> $notooltip); + $parameters = array('id' => $this->id, 'getnomurl' => &$result, 'withpicto' => $withpicto, 'option' => $option, 'showfullpath' => $showfullpath, 'notooltip' => $notooltip); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; From b54f4b4af5d4a2d0daca161d85651e2013f8a701 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:40:11 +0100 Subject: [PATCH 287/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- .../product/stock/class/productlot.class.php | 37 ++++++++++--------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php index 28f8b53c88b..8e48d272407 100644 --- a/htdocs/product/stock/class/productlot.class.php +++ b/htdocs/product/stock/class/productlot.class.php @@ -5,6 +5,7 @@ * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2023 Gauthier VERDOL + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -98,28 +99,28 @@ class Productlot extends CommonObject */ /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'noteditable'=>1, 'notnull'=> 1, 'index'=>1, 'position'=>1, 'comment'=>'Id', 'css'=>'left'), - 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>5, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'picto' => 'product', 'css'=>'maxwidth500 widthcentpercentminusxx', 'csslist'=>'maxwidth150'), - 'batch' => array('type'=>'varchar(30)', 'label'=>'Batch', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'comment'=>'Batch', 'searchall'=>1, 'picto'=>'lot', 'validate'=>1), - 'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20), - 'sellby' => array('type'=>'date', 'label'=>'SellByDate', 'enabled'=>'empty($conf->global->PRODUCT_DISABLE_SELLBY)?1:0', 'visible'=>1, 'notnull'=>0, 'position'=>60), - 'eatby' => array('type'=>'date', 'label'=>'EatByDate', 'enabled'=>'empty($conf->global->PRODUCT_DISABLE_EATBY)?1:0', 'visible'=>1, 'notnull'=>0, 'position'=>62), - 'eol_date' => array('type'=>'date', 'label'=>'EndOfLife', 'enabled'=>'getDolGlobalInt("PRODUCT_LOT_ENABLE_QUALITY_CONTROL")?1:0', 'visible'=>'getDolGlobalInt("PRODUCT_LOT_ENABLE_QUALITY_CONTROL")?5:0', 'position'=>70), - 'manufacturing_date' => array('type'=>'date', 'label'=>'ManufacturingDate', 'enabled'=>'getDolGlobalInt("PRODUCT_LOT_ENABLE_TRACEABILITY")?1:0', 'visible'=>'getDolGlobalInt("PRODUCT_LOT_ENABLE_TRACEABILITY")?5:0', 'position'=>80), - 'scrapping_date' => array('type'=>'date', 'label'=>'DestructionDate', 'enabled'=>'getDolGlobalInt("PRODUCT_LOT_ENABLE_TRACEABILITY")?1:0', 'visible'=>'getDolGlobalInt("PRODUCT_LOT_ENABLE_TRACEABILITY")?5:0', 'position'=>90), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -2, 'noteditable' => 1, 'notnull' => 1, 'index' => 1, 'position' => 1, 'comment' => 'Id', 'css' => 'left'), + 'fk_product' => array('type' => 'integer:Product:product/class/product.class.php', 'label' => 'Product', 'enabled' => 1, 'visible' => 1, 'position' => 5, 'notnull' => 1, 'index' => 1, 'searchall' => 1, 'picto' => 'product', 'css' => 'maxwidth500 widthcentpercentminusxx', 'csslist' => 'maxwidth150'), + 'batch' => array('type' => 'varchar(30)', 'label' => 'Batch', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'showoncombobox' => 1, 'index' => 1, 'position' => 10, 'comment' => 'Batch', 'searchall' => 1, 'picto' => 'lot', 'validate' => 1), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'enabled' => 1, 'visible' => 0, 'default' => 1, 'notnull' => 1, 'index' => 1, 'position' => 20), + 'sellby' => array('type' => 'date', 'label' => 'SellByDate', 'enabled' => 'empty($conf->global->PRODUCT_DISABLE_SELLBY)?1:0', 'visible' => 1, 'notnull' => 0, 'position' => 60), + 'eatby' => array('type' => 'date', 'label' => 'EatByDate', 'enabled' => 'empty($conf->global->PRODUCT_DISABLE_EATBY)?1:0', 'visible' => 1, 'notnull' => 0, 'position' => 62), + 'eol_date' => array('type' => 'date', 'label' => 'EndOfLife', 'enabled' => 'getDolGlobalInt("PRODUCT_LOT_ENABLE_QUALITY_CONTROL")?1:0', 'visible' => 'getDolGlobalInt("PRODUCT_LOT_ENABLE_QUALITY_CONTROL")?5:0', 'position' => 70), + 'manufacturing_date' => array('type' => 'date', 'label' => 'ManufacturingDate', 'enabled' => 'getDolGlobalInt("PRODUCT_LOT_ENABLE_TRACEABILITY")?1:0', 'visible' => 'getDolGlobalInt("PRODUCT_LOT_ENABLE_TRACEABILITY")?5:0', 'position' => 80), + 'scrapping_date' => array('type' => 'date', 'label' => 'DestructionDate', 'enabled' => 'getDolGlobalInt("PRODUCT_LOT_ENABLE_TRACEABILITY")?1:0', 'visible' => 'getDolGlobalInt("PRODUCT_LOT_ENABLE_TRACEABILITY")?5:0', 'position' => 90), //'commissionning_date' => array('type'=>'date', 'label'=>'FirstUseDate', 'enabled'=>'getDolGlobalInt("PRODUCT_LOT_ENABLE_TRACEABILITY", 0)', 'visible'=>5, 'position'=>100), - 'qc_frequency' => array('type'=>'integer', 'label'=>'QCFrequency', 'enabled'=>'getDolGlobalInt("PRODUCT_LOT_ENABLE_QUALITY_CONTROL")?1:0', 'visible'=>'getDolGlobalInt("PRODUCT_LOT_ENABLE_QUALITY_CONTROL")?5:0', 'position'=>110), - 'lifetime' => array('type'=>'integer', 'label'=>'Lifetime', 'enabled'=>'getDolGlobalInt("PRODUCT_LOT_ENABLE_QUALITY_CONTROL")?1:0', 'visible'=>'getDolGlobalInt("PRODUCT_LOT_ENABLE_QUALITY_CONTROL")?5:0', 'position'=>110), + 'qc_frequency' => array('type' => 'integer', 'label' => 'QCFrequency', 'enabled' => 'getDolGlobalInt("PRODUCT_LOT_ENABLE_QUALITY_CONTROL")?1:0', 'visible' => 'getDolGlobalInt("PRODUCT_LOT_ENABLE_QUALITY_CONTROL")?5:0', 'position' => 110), + 'lifetime' => array('type' => 'integer', 'label' => 'Lifetime', 'enabled' => 'getDolGlobalInt("PRODUCT_LOT_ENABLE_QUALITY_CONTROL")?1:0', 'visible' => 'getDolGlobalInt("PRODUCT_LOT_ENABLE_QUALITY_CONTROL")?5:0', 'position' => 110), 'model_pdf' => array('type' => 'varchar(255)', 'label' => 'Model pdf', 'enabled' => 1, 'visible' => 0, 'position' => 215), 'last_main_doc' => array('type' => 'varchar(255)', 'label' => 'LastMainDoc', 'enabled' => 1, 'visible' => -2, 'position' => 310), - 'datec' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>500), - 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>501), - 'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>510, 'foreignkey'=>'llx_user.rowid'), - 'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511), - 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>0, 'position'=>1000) + 'datec' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'position' => 500), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 501), + 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 510, 'foreignkey' => 'llx_user.rowid'), + 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => 1, 'visible' => -2, 'notnull' => -1, 'position' => 511), + 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'notnull' => -1, 'index' => 0, 'position' => 1000) ); /** @@ -161,7 +162,7 @@ class Productlot extends CommonObject */ public $import_key; - public $stats_supplier_order=array(); + public $stats_supplier_order = array(); /** From 58df99e873119def42b67aa40b74ce7412d86d15 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:40:13 +0100 Subject: [PATCH 288/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- .../product/stock/stocktransfer/class/stocktransfer.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/product/stock/stocktransfer/class/stocktransfer.class.php b/htdocs/product/stock/stocktransfer/class/stocktransfer.class.php index 7ba9d0105dc..d90a892382c 100644 --- a/htdocs/product/stock/stocktransfer/class/stocktransfer.class.php +++ b/htdocs/product/stock/stocktransfer/class/stocktransfer.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2021 Gauthier VERDOL * Copyright (C) 2022-2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -123,7 +124,7 @@ class StockTransfer extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'comment' => "Id"), From e996c4028a4982279a96d2e9cd474548b3722ce5 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:40:15 +0100 Subject: [PATCH 289/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- .../stock/stocktransfer/class/stocktransferline.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php b/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php index f726293c5e4..5a71cd70afd 100644 --- a/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php +++ b/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2021 Gauthier VERDOL * Copyright (C) ---Put here your own copyright and developer email--- * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -93,7 +94,7 @@ class StockTransferLine extends CommonObjectLine // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'comment' => "Id"), From d62e8f78b46415d00541880c8c7b725d3f043ac3 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:40:17 +0100 Subject: [PATCH 290/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/projet/class/project.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 763382fd70c..f245a9c727a 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -9,6 +9,7 @@ * Copyright (C) 2022 Charlene Benke * Copyright (C) 2023 Gauthier VERDOL * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -292,7 +293,7 @@ class Project extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'ID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), From 9d0e78985ca46f2efc7f1e8138517b60b4d4adfc Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:40:19 +0100 Subject: [PATCH 291/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/recruitment/class/recruitmentcandidature.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/recruitment/class/recruitmentcandidature.class.php b/htdocs/recruitment/class/recruitmentcandidature.class.php index bf874a1fa1f..8ccc0a498d0 100644 --- a/htdocs/recruitment/class/recruitmentcandidature.class.php +++ b/htdocs/recruitment/class/recruitmentcandidature.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -106,7 +107,7 @@ class RecruitmentCandidature extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'comment' => "Id"), From 5985ab8ce06781bebb92328438b69ce416b92982 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:40:21 +0100 Subject: [PATCH 292/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/recruitment/class/recruitmentjobposition.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/recruitment/class/recruitmentjobposition.class.php b/htdocs/recruitment/class/recruitmentjobposition.class.php index a288bc65f97..d035b8bd5eb 100644 --- a/htdocs/recruitment/class/recruitmentjobposition.class.php +++ b/htdocs/recruitment/class/recruitmentjobposition.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2020 Laurent Destailleur /* Copyright (C) 2022 Alexandre Spangaro * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -112,7 +113,7 @@ class RecruitmentJobPosition extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'comment' => "Id"), From 46a275c376c07ef517177d43a80ea4e637ff09fb Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:40:23 +0100 Subject: [PATCH 293/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/salaries/class/paymentsalary.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/salaries/class/paymentsalary.class.php b/htdocs/salaries/class/paymentsalary.class.php index 0de7eaaf457..70a714f02f3 100644 --- a/htdocs/salaries/class/paymentsalary.class.php +++ b/htdocs/salaries/class/paymentsalary.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2021 Gauthier VERDOL * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -152,7 +153,7 @@ class PaymentSalary extends CommonObject public $datev = ''; /** - * @var array + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'), From c370ad8dac385568a5b21247643a31c2f4dd7a6c Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:40:25 +0100 Subject: [PATCH 294/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/societe/class/companypaymentmode.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/societe/class/companypaymentmode.class.php b/htdocs/societe/class/companypaymentmode.class.php index 99901fc00c8..9494f434c3c 100644 --- a/htdocs/societe/class/companypaymentmode.class.php +++ b/htdocs/societe/class/companypaymentmode.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -82,7 +83,7 @@ class CompanyPaymentMode extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' =>array('type'=>'integer', 'label'=>'Rowid', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>10), From c36a03d7e085fc9ed538b51e24212985d92820c9 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:40:27 +0100 Subject: [PATCH 295/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/societe/class/societe.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index eedaa168c37..8150efa1be1 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -188,7 +188,7 @@ class Societe extends CommonObject */ /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -2, 'noteditable' => 1, 'notnull' => 1, 'index' => 1, 'position' => 1, 'comment' => 'Id', 'css' => 'left'), From d491c9f264148725fa9a55a99273052f492dbe94 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:40:29 +0100 Subject: [PATCH 296/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/ticket/class/cticketcategory.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/ticket/class/cticketcategory.class.php b/htdocs/ticket/class/cticketcategory.class.php index 1bc4f15c5bf..963c7647934 100644 --- a/htdocs/ticket/class/cticketcategory.class.php +++ b/htdocs/ticket/class/cticketcategory.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2017 Laurent Destailleur * Copyright (C) ---Put here your own copyright and developer email--- * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -97,7 +98,7 @@ class CTicketCategory extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), From 13fcaf19f2a018c367cb8cb41d8896251b3047f9 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:40:31 +0100 Subject: [PATCH 297/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/variants/class/ProductAttribute.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/variants/class/ProductAttribute.class.php b/htdocs/variants/class/ProductAttribute.class.php index f0014a0a7ab..ea66396479c 100644 --- a/htdocs/variants/class/ProductAttribute.class.php +++ b/htdocs/variants/class/ProductAttribute.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2016 Marcos García * Copyright (C) 2022 Open-Dsi * Copyright (C) 2023 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -97,7 +98,7 @@ class ProductAttribute extends CommonObject * Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor. */ /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields=array( 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), From c58a2db86b94d85f3fd0cd7e8b8e4932aee255da Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:40:33 +0100 Subject: [PATCH 298/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/variants/class/ProductAttributeValue.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/variants/class/ProductAttributeValue.class.php b/htdocs/variants/class/ProductAttributeValue.class.php index 7636df31290..556dbbfac30 100644 --- a/htdocs/variants/class/ProductAttributeValue.class.php +++ b/htdocs/variants/class/ProductAttributeValue.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2022 Open-Dsi + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -75,7 +76,7 @@ class ProductAttributeValue extends CommonObjectLine * Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor. */ /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields=array( 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), From b1148cf2626c2730826c5c1efbac6d3204b4a9f5 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:40:35 +0100 Subject: [PATCH 299/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/webhook/class/target.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/webhook/class/target.class.php b/htdocs/webhook/class/target.class.php index 484991e1dc7..d7bbc3af3a6 100644 --- a/htdocs/webhook/class/target.class.php +++ b/htdocs/webhook/class/target.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2017 Laurent Destailleur * Copyright (C) ---Put here your own copyright and developer email--- * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -100,7 +101,7 @@ class Target extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'css' => 'left', 'comment' => "Id"), From 8cf93e2cb323a0fe537db76a8d52dad84f776c77 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:40:37 +0100 Subject: [PATCH 300/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/website/class/websitepage.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index 7a0a42a0f9f..f005727a326 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -5,6 +5,7 @@ * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2020 Nicolas ZABOURI * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -162,7 +163,7 @@ class WebsitePage extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'index' => 1, 'position' => 1, 'comment' => 'Id'), From 6551b752d6163d98d3e48a25b127b128e34f6746 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:40:39 +0100 Subject: [PATCH 301/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/workstation/class/workstation.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/workstation/class/workstation.class.php b/htdocs/workstation/class/workstation.class.php index ad650d6c7b0..f34232c86d4 100644 --- a/htdocs/workstation/class/workstation.class.php +++ b/htdocs/workstation/class/workstation.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2020 Gauthier VERDOL * Copyright (C) 2023-2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -95,7 +96,7 @@ class Workstation extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'css' => 'left', 'comment' => "Id"), From 23ac94ac49bc9823c2f1d951c4e83c438a8e9237 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:40:41 +0100 Subject: [PATCH 302/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/workstation/class/workstationresource.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/workstation/class/workstationresource.class.php b/htdocs/workstation/class/workstationresource.class.php index c50a8417e90..56df285ace1 100644 --- a/htdocs/workstation/class/workstationresource.class.php +++ b/htdocs/workstation/class/workstationresource.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2020 Gauthier VERDOL + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -35,7 +36,7 @@ class WorkstationResource extends CommonObject public $element = 'workstationresource'; /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'fk_workstation' => array('type' => 'integer'), From b3aaa6c4e7c0e3a24a853754a7e7af75689205b4 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:40:43 +0100 Subject: [PATCH 303/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/workstation/class/workstationusergroup.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/workstation/class/workstationusergroup.class.php b/htdocs/workstation/class/workstationusergroup.class.php index e53bee221ef..7fed35b4b14 100644 --- a/htdocs/workstation/class/workstationusergroup.class.php +++ b/htdocs/workstation/class/workstationusergroup.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2020 Gauthier VERDOL + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -34,7 +35,7 @@ class WorkstationUserGroup extends CommonObject public $element = 'workstationusergroup'; /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'fk_workstation' => array('type' => 'integer'), From 5027cd4de9bb27daee12b2cac23878e4eca93e8c Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:40:45 +0100 Subject: [PATCH 304/709] Fix: Repeat fields typing in CommonClass children # Fix: Repeat fields typing in CommonClass children phpstan needs typing to be 'co-variant' and therefore typing must be repeated as the method is not to initialise the property in the constructor, but to override the proparty by a 'local' definition in the child class --- htdocs/zapier/class/hook.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/zapier/class/hook.class.php b/htdocs/zapier/class/hook.class.php index b5a25699205..9e953292cd6 100644 --- a/htdocs/zapier/class/hook.class.php +++ b/htdocs/zapier/class/hook.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2019-2024 Frédéric France + * Copyright (C) 2024 MDW * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or @@ -80,7 +81,7 @@ class Hook extends CommonObject */ /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array( From 6b34b8757f9a7821e1cde07420a2602920e2987e Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:43:57 +0100 Subject: [PATCH 305/709] fixup! Change logic to help static tool analysis --- htdocs/admin/modulehelp.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/modulehelp.php b/htdocs/admin/modulehelp.php index 22165d2c305..8116316dfa1 100644 --- a/htdocs/admin/modulehelp.php +++ b/htdocs/admin/modulehelp.php @@ -169,7 +169,7 @@ foreach ($modulesdir as $dir) { $familykey = key($objMod->familyinfo); } else { $familykey = $objMod->family; - if (empty($familykey)) { + if (empty($familykey) || $familykey === null) { $familykey = 'other'; } } From 8e422f15e38b5d65ec0d88c216b5a85074c2ea65 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Mon, 11 Mar 2024 18:00:43 +0100 Subject: [PATCH 306/709] New update in generate_content in module Ai --- htdocs/ai/class/ai.class.php | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/htdocs/ai/class/ai.class.php b/htdocs/ai/class/ai.class.php index 399b3adb1ee..5b4f4003248 100644 --- a/htdocs/ai/class/ai.class.php +++ b/htdocs/ai/class/ai.class.php @@ -20,6 +20,8 @@ * or see https://www.gnu.org/ */ require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"; +require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; + /** * Class for AI @@ -116,30 +118,27 @@ class Ai $fullInstructions = $prePrompt.' '.$instructions.' .'.$postPrompt; // TODO Replace this with a simple call of getDolURLContent(); - $ch = curl_init($this->apiEndpoint); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([ + // $ch = curl_init($this->apiEndpoint); + // curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + //curl_setopt($ch, CURLOPT_HTTPHEADER, [ + $payload = json_encode([ 'messages' => [ ['role' => 'user', 'content' => $fullInstructions] ], 'model' => $model - ])); - curl_setopt($ch, CURLOPT_HTTPHEADER, [ + ]); + + $headers = ([ 'Authorization: Bearer ' . $this->apiKey, 'Content-Type: application/json' ]); + $response = getURLContent($this->apiEndpoint, 'POST', $payload, $headers); - $response = curl_exec($ch); - if (curl_errno($ch)) { - throw new Exception('cURL error: ' . curl_error($ch)); - } - - $statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); - if ($statusCode != 200) { - throw new Exception('API request failed with status code ' . $statusCode); + if ($response['http_code'] != 200) { + throw new Exception('API request failed with status code ' . $response['http_code']); } // Decode JSON response - $decodedResponse = json_decode($response, true); + $decodedResponse = json_decode($response['content'], true); // Extraction content $generatedEmailContent = $decodedResponse['choices'][0]['message']['content']; @@ -147,8 +146,6 @@ class Ai return $generatedEmailContent; } catch (Exception $e) { return array('error' => true, 'message' => $e->getMessage()); - } finally { - curl_close($ch); } } } From fc6c93877b369d6974c0732072882de70c071971 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 18:02:19 +0100 Subject: [PATCH 307/709] fixup! Change logic to help static tool analysis --- htdocs/admin/modulehelp.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/modulehelp.php b/htdocs/admin/modulehelp.php index 8116316dfa1..e076187e563 100644 --- a/htdocs/admin/modulehelp.php +++ b/htdocs/admin/modulehelp.php @@ -169,9 +169,9 @@ foreach ($modulesdir as $dir) { $familykey = key($objMod->familyinfo); } else { $familykey = $objMod->family; - if (empty($familykey) || $familykey === null) { - $familykey = 'other'; - } + } + if (empty($familykey) || $familykey === null) { + $familykey = 'other'; } $moduleposition = ($objMod->module_position ? $objMod->module_position : '50'); From d916a70acff5eb14cb20c564a6d8014e056dd5e4 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Mon, 11 Mar 2024 18:03:33 +0100 Subject: [PATCH 308/709] Remove comments --- htdocs/ai/class/ai.class.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/htdocs/ai/class/ai.class.php b/htdocs/ai/class/ai.class.php index 5b4f4003248..ee3970912b6 100644 --- a/htdocs/ai/class/ai.class.php +++ b/htdocs/ai/class/ai.class.php @@ -117,10 +117,7 @@ class Ai } $fullInstructions = $prePrompt.' '.$instructions.' .'.$postPrompt; - // TODO Replace this with a simple call of getDolURLContent(); - // $ch = curl_init($this->apiEndpoint); - // curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - //curl_setopt($ch, CURLOPT_HTTPHEADER, [ + $payload = json_encode([ 'messages' => [ ['role' => 'user', 'content' => $fullInstructions] From 8e1b6543b8e9d0f5ea24abd8afddc05247feda5a Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 17:57:54 +0100 Subject: [PATCH 309/709] Qual: Typing : make all $module_parts fields optional and add missing # Qual: Typing : make all $module_parts fields optional and add missing According to the initialisations of the modules all fields for $module_parts are optional and some keys were missing in the definition. This is updated. --- htdocs/core/modules/DolibarrModules.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 2994a5c58b0..15fbe56aa32 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -8,6 +8,7 @@ * Copyright (C) 2014 Raphaël Doursenaud * Copyright (C) 2018 Josep Lluís Amador * Copyright (C) 2019-2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -140,7 +141,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it public $menu = array(); /** - * @var array{triggers:int,login:int,substitutions:int,menus:int,theme:int,tpl:int,barcode:int,models:int,css:string,js:string,hooks:string[]} Module parts + * @var array{triggers?:int<0,1>,login?:int<0,1>,substitutions?:int<0,1>,menus?:int<0,1>,theme?:int<0,1>,tpl?:int<0,1>,barcode?:int<0,1>,models?:int<0,1>,printing?:int<0,1>,css?:string[],js?:string[],hooks?:array{data:string[],entity:string},moduleforexternal?:int<0,1>,websitetemplates?:int<0,1>,contactelement?:int<0,1>} Module parts * array( * // Set this to 1 if module has its own trigger directory (/mymodule/core/triggers) * 'triggers' => 0, From 7bcb635a4e1de8b3a5e38af195d51825eb8aed04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Mon, 11 Mar 2024 18:13:48 +0100 Subject: [PATCH 310/709] clean code and phpdoc --- .../core/modules/asset/mod_asset_standard.php | 6 +++--- .../barcode/mod_barcode_product_standard.php | 4 ++-- .../mod_barcode_thirdparty_standard.php | 2 +- htdocs/core/modules/bom/mod_bom_advanced.php | 4 ++-- htdocs/core/modules/bom/mod_bom_standard.php | 11 +++++----- .../modules/cheque/mod_chequereceipt_mint.php | 18 ++--------------- .../cheque/mod_chequereceipt_thyme.php | 17 +--------------- .../modules/commande/mod_commande_marbre.php | 20 +++---------------- .../modules/commande/mod_commande_saphir.php | 19 ++---------------- .../modules/contract/mod_contract_magre.php | 16 +-------------- .../modules/contract/mod_contract_serpis.php | 19 ++---------------- .../modules/delivery/mod_delivery_jade.php | 20 +++---------------- .../modules/delivery/mod_delivery_saphir.php | 20 +++---------------- .../expedition/mod_expedition_ribera.php | 18 ++--------------- .../expedition/mod_expedition_safor.php | 19 +++--------------- .../expensereport/mod_expensereport_jade.php | 5 +++-- .../expensereport/mod_expensereport_sand.php | 5 +++-- .../core/modules/facture/mod_facture_mars.php | 5 +++-- .../modules/facture/mod_facture_mercure.php | 3 ++- .../modules/facture/mod_facture_terre.php | 5 +++-- .../societe/mod_codeclient_elephant.php | 2 +- .../societe/mod_codeclient_leopard.php | 4 ++-- .../modules/societe/mod_codeclient_monkey.php | 2 +- 23 files changed, 54 insertions(+), 190 deletions(-) diff --git a/htdocs/core/modules/asset/mod_asset_standard.php b/htdocs/core/modules/asset/mod_asset_standard.php index 7c34cc27931..1c957de8724 100644 --- a/htdocs/core/modules/asset/mod_asset_standard.php +++ b/htdocs/core/modules/asset/mod_asset_standard.php @@ -1,7 +1,7 @@ * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2022 Frédéric France + * Copyright (C) 2022-2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -78,7 +78,7 @@ class mod_asset_standard extends ModeleNumRefAsset * Checks if the numbers already in the database do not * cause conflicts that would prevent this numbering working. * - * @param Object $object Object we need next value for + * @param Asset $object Object we need next value for * @return boolean false if conflict, true if ok */ public function canBeActivated($object) @@ -118,7 +118,7 @@ class mod_asset_standard extends ModeleNumRefAsset /** * Return next free value * - * @param Object $object Object we need next value for + * @param Asset $object Object we need next value for * @return string|-1 Next value if OK, -1 if KO */ public function getNextValue($object) diff --git a/htdocs/core/modules/barcode/mod_barcode_product_standard.php b/htdocs/core/modules/barcode/mod_barcode_product_standard.php index c2df3f7c3a0..2190150ec62 100644 --- a/htdocs/core/modules/barcode/mod_barcode_product_standard.php +++ b/htdocs/core/modules/barcode/mod_barcode_product_standard.php @@ -127,8 +127,8 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode /** * Return literal barcode type code from numerical rowid type of barcode * - * @param Database $db Database - * @param int $type Type of barcode (EAN, ISBN, ...) as rowid + * @param DoliDB $db Database + * @param int $type Type of barcode (EAN, ISBN, ...) as rowid * @return string */ public function literalBarcodeType($db, $type = 0) diff --git a/htdocs/core/modules/barcode/mod_barcode_thirdparty_standard.php b/htdocs/core/modules/barcode/mod_barcode_thirdparty_standard.php index 118e87cbc3a..6825c1e53bb 100644 --- a/htdocs/core/modules/barcode/mod_barcode_thirdparty_standard.php +++ b/htdocs/core/modules/barcode/mod_barcode_thirdparty_standard.php @@ -139,7 +139,7 @@ class mod_barcode_thirdparty_standard extends ModeleNumRefBarCode /** * Return literal barcode type code from numerical rowid type of barcode * - * @param Database $db Database + * @param DoliDB $db Database * @param int $type Type of barcode (EAN, ISBN, ...) as rowid * @return string */ diff --git a/htdocs/core/modules/bom/mod_bom_advanced.php b/htdocs/core/modules/bom/mod_bom_advanced.php index 0e9f3d4f977..2428e79595d 100644 --- a/htdocs/core/modules/bom/mod_bom_advanced.php +++ b/htdocs/core/modules/bom/mod_bom_advanced.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2007 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) - * Copyright (C) 2019 Frédéric France + * Copyright (C) 2019-2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -119,7 +119,7 @@ class mod_bom_advanced extends ModeleNumRefBoms * Return next free value * * @param Product $objprod Object product - * @param Object $object Object we need next value for + * @param Bom $object Object we need next value for * @return string|0 Next value if OK, 0 if KO */ public function getNextValue($objprod, $object) diff --git a/htdocs/core/modules/bom/mod_bom_standard.php b/htdocs/core/modules/bom/mod_bom_standard.php index 1e26ba2254a..f4ba8293423 100644 --- a/htdocs/core/modules/bom/mod_bom_standard.php +++ b/htdocs/core/modules/bom/mod_bom_standard.php @@ -1,6 +1,7 @@ * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -76,8 +77,8 @@ class mod_bom_standard extends ModeleNumRefBoms * Checks if the numbers already in the database do not * cause conflicts that would prevent this numbering working. * - * @param Object $object Object we need next value for - * @return boolean false if conflict, true if ok + * @param Bom $object Object we need next value for + * @return boolean false if conflict, true if ok */ public function canBeActivated($object) { @@ -112,9 +113,9 @@ class mod_bom_standard extends ModeleNumRefBoms /** * Return next free value * - * @param Product $objprod Object product - * @param Object $object Object we need next value for - * @return string|-1 Next value if OK, -1 if KO + * @param Product $objprod Object product + * @param Bom $object Object we need next value for + * @return string|-1 Next value if OK, -1 if KO */ public function getNextValue($objprod, $object) { diff --git a/htdocs/core/modules/cheque/mod_chequereceipt_mint.php b/htdocs/core/modules/cheque/mod_chequereceipt_mint.php index 5106697211d..c42806e603e 100644 --- a/htdocs/core/modules/cheque/mod_chequereceipt_mint.php +++ b/htdocs/core/modules/cheque/mod_chequereceipt_mint.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -73,7 +74,7 @@ class mod_chequereceipt_mint extends ModeleNumRefChequeReceipts * Checks if the numbers already in the database do not * cause conflicts that would prevent this numbering working. * - * @param Object $object Object we need next value for + * @param RemiseCheque $object Object we need next value for * @return boolean false if conflict, true if ok */ public function canBeActivated($object) @@ -150,19 +151,4 @@ class mod_chequereceipt_mint extends ModeleNumRefChequeReceipts dol_syslog(__METHOD__." return ".$this->prefix.$yymm."-".$num); return $this->prefix.$yymm."-".$num; } - - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Return next free value - * - * @param Societe $objsoc Object third party - * @param string $objforref Object for number to search - * @return string Next free value - */ - public function chequereceipt_get_num($objsoc, $objforref) - { - // phpcs:enable - return $this->getNextValue($objsoc, $objforref); - } } diff --git a/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php b/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php index 5a2ae083d2f..44eff63035d 100644 --- a/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php +++ b/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php @@ -1,6 +1,6 @@ - * Copyright (C) 2019 Frédéric France + * Copyright (C) 2019-2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -131,19 +131,4 @@ class mod_chequereceipt_thyme extends ModeleNumRefChequeReceipts return $numFinal; } - - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Return next free value - * - * @param Societe $objsoc Object third party - * @param string $objforref Object for number to search - * @return string Next free value - */ - public function chequereceipt_get_num($objsoc, $objforref) - { - // phpcs:enable - return $this->getNextValue($objsoc, $objforref); - } } diff --git a/htdocs/core/modules/commande/mod_commande_marbre.php b/htdocs/core/modules/commande/mod_commande_marbre.php index ad664e10e3a..8583d30d46c 100644 --- a/htdocs/core/modules/commande/mod_commande_marbre.php +++ b/htdocs/core/modules/commande/mod_commande_marbre.php @@ -1,6 +1,7 @@ * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -88,7 +89,7 @@ class mod_commande_marbre extends ModeleNumRefCommandes * Checks if the numbers already in the database do not * cause conflicts that would prevent this numbering working. * - * @param Object $object Object we need next value for + * @param Commande $object Object we need next value for * @return boolean false if conflict, true if ok */ public function canBeActivated($object) @@ -125,7 +126,7 @@ class mod_commande_marbre extends ModeleNumRefCommandes * Return next free value * * @param Societe $objsoc Object thirdparty - * @param Object $object Object we need next value for + * @param Commande $object Object we need next value for * @return string|-1 Value if OK, -1 if KO */ public function getNextValue($objsoc, $object) @@ -165,19 +166,4 @@ class mod_commande_marbre extends ModeleNumRefCommandes dol_syslog("mod_commande_marbre::getNextValue return ".$this->prefix.$yymm."-".$num); return $this->prefix.$yymm."-".$num; } - - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Return next free value - * - * @param Societe $objsoc Object third party - * @param string $objforref Object for number to search - * @return string|-1 Next free value, -1 if KO - */ - public function commande_get_num($objsoc, $objforref) - { - // phpcs:enable - return $this->getNextValue($objsoc, $objforref); - } } diff --git a/htdocs/core/modules/commande/mod_commande_saphir.php b/htdocs/core/modules/commande/mod_commande_saphir.php index 2cc4331e98e..f727b9dff70 100644 --- a/htdocs/core/modules/commande/mod_commande_saphir.php +++ b/htdocs/core/modules/commande/mod_commande_saphir.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2007 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) - * Copyright (C) 2019 Frédéric France + * Copyright (C) 2019-2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -119,7 +119,7 @@ class mod_commande_saphir extends ModeleNumRefCommandes * Return next free value * * @param Societe $objsoc Object thirdparty - * @param Object $object Object we need next value for + * @param Commande $object Object we need next value for * @return string|0 Next value if OK, 0 if KO */ public function getNextValue($objsoc, $object) @@ -149,19 +149,4 @@ class mod_commande_saphir extends ModeleNumRefCommandes return $numFinal; } - - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Return next free value - * - * @param Societe $objsoc Object third party - * @param string $objforref Object for number to search - * @return string Next free value - */ - public function commande_get_num($objsoc, $objforref) - { - // phpcs:enable - return $this->getNextValue($objsoc, $objforref); - } } diff --git a/htdocs/core/modules/contract/mod_contract_magre.php b/htdocs/core/modules/contract/mod_contract_magre.php index f68e180a65c..ebd7957780f 100644 --- a/htdocs/core/modules/contract/mod_contract_magre.php +++ b/htdocs/core/modules/contract/mod_contract_magre.php @@ -105,7 +105,7 @@ class mod_contract_magre extends ModelNumRefContracts * Return next value * * @param Societe $objsoc third party object - * @param Object $contract contract object + * @param Contrat $contract contract object * @return string|0 Next value if OK, 0 if KO */ public function getNextValue($objsoc, $contract) @@ -125,18 +125,4 @@ class mod_contract_magre extends ModelNumRefContracts return $numFinal; } - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Return next value - * - * @param Societe $objsoc third party object - * @param Object $objforref contract object - * @return string|0 Value if OK, 0 if KO - */ - public function contract_get_num($objsoc, $objforref) - { - // phpcs:enable - return $this->getNextValue($objsoc, $objforref); - } } diff --git a/htdocs/core/modules/contract/mod_contract_serpis.php b/htdocs/core/modules/contract/mod_contract_serpis.php index fe155099ac7..d78c6ebbf89 100644 --- a/htdocs/core/modules/contract/mod_contract_serpis.php +++ b/htdocs/core/modules/contract/mod_contract_serpis.php @@ -76,7 +76,7 @@ class mod_contract_serpis extends ModelNumRefContracts /** * Test if existing numbers make problems with numbering * - * @param Object $object Object we need next value for + * @param Contrat $object Object we need next value for * @return boolean false if conflict, true if ok */ public function canBeActivated($object) @@ -113,7 +113,7 @@ class mod_contract_serpis extends ModelNumRefContracts * Return next value * * @param Societe $objsoc third party object - * @param Object $contract contract object + * @param Contrat $contract contract object * @return string|-1 Value if OK, -1 if KO */ public function getNextValue($objsoc, $contract) @@ -151,19 +151,4 @@ class mod_contract_serpis extends ModelNumRefContracts dol_syslog("mod_contract_serpis::getNextValue return ".$this->prefix.$yymm."-".$num); return $this->prefix.$yymm."-".$num; } - - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Return next value - * - * @param Societe $objsoc third party object - * @param Object $objforref contract object - * @return string|-1 Value if OK, -1 if KO - */ - public function contract_get_num($objsoc, $objforref) - { - // phpcs:enable - return $this->getNextValue($objsoc, $objforref); - } } diff --git a/htdocs/core/modules/delivery/mod_delivery_jade.php b/htdocs/core/modules/delivery/mod_delivery_jade.php index c29a5f7f4bd..95e3e0ff18e 100644 --- a/htdocs/core/modules/delivery/mod_delivery_jade.php +++ b/htdocs/core/modules/delivery/mod_delivery_jade.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005 Rodolphe Quiedeville * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -86,7 +87,7 @@ class mod_delivery_jade extends ModeleNumRefDeliveryOrder * Checks if the numbers already in the database do not * cause conflicts that would prevent this numbering working. * - * @param Object $object Object we need next value for + * @param Delivery $object Object we need next value for * @return boolean false if conflict, true if ok */ public function canBeActivated($object) @@ -126,7 +127,7 @@ class mod_delivery_jade extends ModeleNumRefDeliveryOrder * Return next free value * * @param Societe $objsoc Object thirdparty - * @param Object $object Object we need next value for + * @param Delivery $object Object we need next value for * @return string|-1 Value if OK, -1 if KO */ public function getNextValue($objsoc, $object) @@ -168,19 +169,4 @@ class mod_delivery_jade extends ModeleNumRefDeliveryOrder dol_syslog("mod_delivery_jade::getNextValue return ".$this->prefix.$yymm."-".$num); return $this->prefix.$yymm."-".$num; } - - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Return next free ref - * - * @param Societe $objsoc Object thirdparty - * @param Object $object Object livraison - * @return string|-1 Value if OK, -1 if KO - */ - public function delivery_get_num($objsoc = 0, $object = '') - { - // phpcs:enable - return $this->getNextValue($objsoc, $object); - } } diff --git a/htdocs/core/modules/delivery/mod_delivery_saphir.php b/htdocs/core/modules/delivery/mod_delivery_saphir.php index 209d848ec31..4d6bdb7c716 100644 --- a/htdocs/core/modules/delivery/mod_delivery_saphir.php +++ b/htdocs/core/modules/delivery/mod_delivery_saphir.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003-2007 Rodolphe Quiedeville * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2005-2007 Regis Houssin + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -121,7 +122,7 @@ class mod_delivery_saphir extends ModeleNumRefDeliveryOrder * Return next value * * @param Societe $objsoc Object third party - * @param Object $object Object delivery + * @param Delivery $object Object delivery * @return string|0 Value if OK, 0 if KO */ public function getNextValue($objsoc, $object) @@ -148,26 +149,11 @@ class mod_delivery_saphir extends ModeleNumRefDeliveryOrder * Return next free value * * @param Societe $objsoc Object third party - * @param string $objforref Object for number to search + * @param Delivery $objforref Object for number to search * @return string|0 Next free value, 0 if KO */ public function getNumRef($objsoc, $objforref) { return $this->getNextValue($objsoc, $objforref); } - - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Return next free ref - * - * @param Societe $objsoc Object thirdparty - * @param Object $object Object livraison - * @return string|0 Value if OK, 0 if KO - */ - public function delivery_get_num($objsoc = 0, $object = '') - { - // phpcs:enable - return $this->getNextValue($objsoc, $object); - } } diff --git a/htdocs/core/modules/expedition/mod_expedition_ribera.php b/htdocs/core/modules/expedition/mod_expedition_ribera.php index 2d8c5f7f138..4d85f303169 100644 --- a/htdocs/core/modules/expedition/mod_expedition_ribera.php +++ b/htdocs/core/modules/expedition/mod_expedition_ribera.php @@ -1,6 +1,6 @@ - * Copyright (C) 2019 Frédéric France + * Copyright (C) 2019-2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -117,7 +117,7 @@ class mod_expedition_ribera extends ModelNumRefExpedition * Return next value * * @param Societe $objsoc Third party object - * @param Object $shipment Shipment object + * @param Expedition $shipment Shipment object * @return string|0 Value if OK, 0 if KO */ public function getNextValue($objsoc, $shipment) @@ -139,18 +139,4 @@ class mod_expedition_ribera extends ModelNumRefExpedition return $numFinal; } - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Return next free value - * - * @param Societe $objsoc Third party object - * @param Object $objforref Shipment object - * @return string|0 Next free value, 0 if KO - */ - public function expedition_get_num($objsoc, $objforref) - { - // phpcs:enable - return $this->getNextValue($objsoc, $objforref); - } } diff --git a/htdocs/core/modules/expedition/mod_expedition_safor.php b/htdocs/core/modules/expedition/mod_expedition_safor.php index 579ba6a4d4f..98f20203fa2 100644 --- a/htdocs/core/modules/expedition/mod_expedition_safor.php +++ b/htdocs/core/modules/expedition/mod_expedition_safor.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -81,7 +82,7 @@ class mod_expedition_safor extends ModelNumRefExpedition /** * Test if existing numbers make problems with numbering * - * @param Object $object Object we need next value for + * @param Expedition $object Object we need next value for * @return boolean false if conflict, true if ok */ public function canBeActivated($object) @@ -118,7 +119,7 @@ class mod_expedition_safor extends ModelNumRefExpedition * Return next value * * @param Societe $objsoc Third party object - * @param Object $shipment Shipment object + * @param Expedition $shipment Shipment object * @return string|-1 Value if OK, -1 if KO */ public function getNextValue($objsoc, $shipment) @@ -156,18 +157,4 @@ class mod_expedition_safor extends ModelNumRefExpedition dol_syslog("mod_expedition_safor::getNextValue return ".$this->prefix.$yymm."-".$num); return $this->prefix.$yymm."-".$num; } - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Return next free value - * - * @param Societe $objsoc Third party object - * @param Object $objforref Shipment object - * @return string|-1 Next free value, -1 if KO - */ - public function expedition_get_num($objsoc, $objforref) - { - // phpcs:enable - return $this->getNextValue($objsoc, $objforref); - } } diff --git a/htdocs/core/modules/expensereport/mod_expensereport_jade.php b/htdocs/core/modules/expensereport/mod_expensereport_jade.php index 60de9d22014..ddac61f46c5 100644 --- a/htdocs/core/modules/expensereport/mod_expensereport_jade.php +++ b/htdocs/core/modules/expensereport/mod_expensereport_jade.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -82,8 +83,8 @@ class mod_expensereport_jade extends ModeleNumRefExpenseReport * Checks if the numbers already in the database do not * cause conflicts that would prevent this numbering working. * - * @param Object $object Object we need next value for - * @return boolean false if conflict, true if ok + * @param ExpenseReport $object Object we need next value for + * @return boolean false if conflict, true if ok */ public function canBeActivated($object) { diff --git a/htdocs/core/modules/expensereport/mod_expensereport_sand.php b/htdocs/core/modules/expensereport/mod_expensereport_sand.php index 8a0165e3799..5bb216e5f65 100644 --- a/htdocs/core/modules/expensereport/mod_expensereport_sand.php +++ b/htdocs/core/modules/expensereport/mod_expensereport_sand.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -120,8 +121,8 @@ class mod_expensereport_sand extends ModeleNumRefExpenseReport /** * Return next free value * - * @param Object $object Object we need next value for - * @return string|0 Next value if OK, 0 if KO + * @param ExpenseReport $object Object we need next value for + * @return string|0 Next value if OK, 0 if KO */ public function getNextValue($object) { diff --git a/htdocs/core/modules/facture/mod_facture_mars.php b/htdocs/core/modules/facture/mod_facture_mars.php index 10d42804a9c..71f9fb27eec 100644 --- a/htdocs/core/modules/facture/mod_facture_mars.php +++ b/htdocs/core/modules/facture/mod_facture_mars.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005-2008 Laurent Destailleur * Copyright (C) 2005-2018 Regis Houssin * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -96,7 +97,7 @@ class mod_facture_mars extends ModeleNumRefFactures * Checks if the numbers already in the database do not * cause conflicts that would prevent this numbering working. * - * @param Object $object Object we need next value for + * @param Facture $object Object we need next value for * @return boolean false if conflict, true if ok */ public function canBeActivated($object) @@ -243,7 +244,7 @@ class mod_facture_mars extends ModeleNumRefFactures * Return next free value * * @param Societe $objsoc Object third party - * @param string $objforref Object for number to search + * @param Facture $objforref Object for number to search * @param string $mode 'next' for next value or 'last' for last value * @return string Next free value */ diff --git a/htdocs/core/modules/facture/mod_facture_mercure.php b/htdocs/core/modules/facture/mod_facture_mercure.php index 1aae660c1a9..8d1194b7d4a 100644 --- a/htdocs/core/modules/facture/mod_facture_mercure.php +++ b/htdocs/core/modules/facture/mod_facture_mercure.php @@ -5,6 +5,7 @@ * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2013 uanjo Menent * Copyright (C) 2022 Anthony Berton + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -178,7 +179,7 @@ class mod_facture_mercure extends ModeleNumRefFactures * Return next free value * * @param Societe $objsoc Object third party - * @param string $objforref Object for number to search + * @param Facture $objforref Object for number to search * @param string $mode 'next' for next value or 'last' for last value * @return string|0 Next free value, 0 if KO */ diff --git a/htdocs/core/modules/facture/mod_facture_terre.php b/htdocs/core/modules/facture/mod_facture_terre.php index 3336340cd63..bf116118024 100644 --- a/htdocs/core/modules/facture/mod_facture_terre.php +++ b/htdocs/core/modules/facture/mod_facture_terre.php @@ -1,6 +1,7 @@ * Copyright (C) 2005-2015 Regis Houssin + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -112,7 +113,7 @@ class mod_facture_terre extends ModeleNumRefFactures * Checks if the numbers already in the database do not * cause conflicts that would prevent this numbering working. * - * @param Object $object Object we need next value for + * @param Facture $object Object we need next value for * @return boolean false if conflict, true if ok */ public function canBeActivated($object) @@ -283,7 +284,7 @@ class mod_facture_terre extends ModeleNumRefFactures * Return next free value * * @param Societe $objsoc Object third party - * @param string $objforref Object for number to search + * @param Facture $objforref Object for number to search * @param string $mode 'next' for next value or 'last' for last value * @return string|int<-1,0> Next free value, -1 or 0 if error */ diff --git a/htdocs/core/modules/societe/mod_codeclient_elephant.php b/htdocs/core/modules/societe/mod_codeclient_elephant.php index 9039c9a2907..c0787d83fe9 100644 --- a/htdocs/core/modules/societe/mod_codeclient_elephant.php +++ b/htdocs/core/modules/societe/mod_codeclient_elephant.php @@ -125,7 +125,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode * Return an example of result returned by getNextValue * * @param Translate $langs Object langs - * @param societe $objsoc Object thirdparty + * @param Societe $objsoc Object thirdparty * @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect) * @return string Return string example */ diff --git a/htdocs/core/modules/societe/mod_codeclient_leopard.php b/htdocs/core/modules/societe/mod_codeclient_leopard.php index 9729c15e7d7..4d4870a3f35 100644 --- a/htdocs/core/modules/societe/mod_codeclient_leopard.php +++ b/htdocs/core/modules/societe/mod_codeclient_leopard.php @@ -77,7 +77,7 @@ class mod_codeclient_leopard extends ModeleThirdPartyCode * Return an example of result returned by getNextValue * * @param Translate $langs Object langs - * @param societe $objsoc Object thirdparty + * @param Societe $objsoc Object thirdparty * @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect) * @return string Return string example */ @@ -89,7 +89,7 @@ class mod_codeclient_leopard extends ModeleThirdPartyCode /** * Return an example of result returned by getNextValue * - * @param societe $objsoc Object thirdparty + * @param Societe $objsoc Object thirdparty * @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect) * @return string Return next value */ diff --git a/htdocs/core/modules/societe/mod_codeclient_monkey.php b/htdocs/core/modules/societe/mod_codeclient_monkey.php index 1d843fd007e..7c9457bd904 100644 --- a/htdocs/core/modules/societe/mod_codeclient_monkey.php +++ b/htdocs/core/modules/societe/mod_codeclient_monkey.php @@ -77,7 +77,7 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode * Return an example of result returned by getNextValue * * @param Translate $langs Object langs - * @param societe $objsoc Object thirdparty + * @param Societe $objsoc Object thirdparty * @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect) * @return string Return string example */ From f19fc5c70ce7bc70f116e186fa5d6fadfb76ed7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Mon, 11 Mar 2024 18:18:59 +0100 Subject: [PATCH 311/709] clean code and phpdoc --- htdocs/core/modules/fichinter/mod_arctic.php | 5 +++-- htdocs/core/modules/fichinter/mod_pacific.php | 11 ++++++----- .../holiday/mod_holiday_immaculate.php | 16 +--------------- .../modules/holiday/mod_holiday_madonna.php | 19 ++----------------- .../modules/hrm/mod_evaluation_advanced.php | 4 ++-- .../modules/hrm/mod_evaluation_standard.php | 5 +++-- 6 files changed, 17 insertions(+), 43 deletions(-) diff --git a/htdocs/core/modules/fichinter/mod_arctic.php b/htdocs/core/modules/fichinter/mod_arctic.php index 4e23b6cb1e3..54362d39bd4 100644 --- a/htdocs/core/modules/fichinter/mod_arctic.php +++ b/htdocs/core/modules/fichinter/mod_arctic.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -121,7 +122,7 @@ class mod_arctic extends ModeleNumRefFicheinter * Return next free value * * @param Societe $objsoc Object thirdparty - * @param Object $object Object we need next value for + * @param Fichinter $object Object we need next value for * @return string|0 Value if OK, 0 if KO */ public function getNextValue($objsoc = 0, $object = '') @@ -148,7 +149,7 @@ class mod_arctic extends ModeleNumRefFicheinter * Return next free value * * @param Societe $objsoc Object third party - * @param Object $objforref Object for number to search + * @param Fichinter $objforref Object for number to search * @return string|0 Next free value, 0 if KO */ public function getNumRef($objsoc, $objforref) diff --git a/htdocs/core/modules/fichinter/mod_pacific.php b/htdocs/core/modules/fichinter/mod_pacific.php index 1892d9f3759..a1f90012125 100644 --- a/htdocs/core/modules/fichinter/mod_pacific.php +++ b/htdocs/core/modules/fichinter/mod_pacific.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005-2008 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -82,7 +83,7 @@ class mod_pacific extends ModeleNumRefFicheinter * Checks if the numbers already in the database do not * cause conflicts that would prevent this numbering working. * - * @param Object $object Object we need next value for + * @param Fichinter $object Object we need next value for * @return boolean false if conflict, true if ok */ public function canBeActivated($object) @@ -121,7 +122,7 @@ class mod_pacific extends ModeleNumRefFicheinter * Return next free value * * @param Societe $objsoc Object thirdparty - * @param Object $object Object we need next value for + * @param Fichinter $object Object we need next value for * @return string Value if KO, <0 if KO */ public function getNextValue($objsoc = 0, $object = '') @@ -161,9 +162,9 @@ class mod_pacific extends ModeleNumRefFicheinter /** * Return next free value * - * @param Societe $objsoc Object third party - * @param Object $objforref Object for number to search - * @return string Next free value + * @param Societe $objsoc Object third party + * @param Fichinter $objforref Object for number to search + * @return string Next free value */ public function getNumRef($objsoc, $objforref) { diff --git a/htdocs/core/modules/holiday/mod_holiday_immaculate.php b/htdocs/core/modules/holiday/mod_holiday_immaculate.php index ca246324929..434b9614985 100644 --- a/htdocs/core/modules/holiday/mod_holiday_immaculate.php +++ b/htdocs/core/modules/holiday/mod_holiday_immaculate.php @@ -105,7 +105,7 @@ class mod_holiday_immaculate extends ModelNumRefHolidays * Return next value * * @param Societe $objsoc third party object - * @param Object $holiday holiday object + * @param Holiday $holiday holiday object * @return string|0 Value if OK, 0 if KO */ public function getNextValue($objsoc, $holiday) @@ -125,18 +125,4 @@ class mod_holiday_immaculate extends ModelNumRefHolidays return $numFinal; } - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Return next value - * - * @param User $fuser User object - * @param Object $objforref Holiday object - * @return string|0 Value if OK, 0 if KO - */ - public function holiday_get_num($fuser, $objforref) - { - // phpcs:enable - return $this->getNextValue($fuser, $objforref); - } } diff --git a/htdocs/core/modules/holiday/mod_holiday_madonna.php b/htdocs/core/modules/holiday/mod_holiday_madonna.php index d2eeceeafc2..636ee4269d3 100644 --- a/htdocs/core/modules/holiday/mod_holiday_madonna.php +++ b/htdocs/core/modules/holiday/mod_holiday_madonna.php @@ -77,7 +77,7 @@ class mod_holiday_madonna extends ModelNumRefHolidays /** * Test if existing numbers make problems with numbering * - * @param Object $object Object we need next value for + * @param Holiday $object Object we need next value for * @return boolean false if conflict, true if ok */ public function canBeActivated($object) @@ -114,7 +114,7 @@ class mod_holiday_madonna extends ModelNumRefHolidays * Return next value * * @param Societe $objsoc third party object - * @param Object $holiday Holiday object + * @param Holiday $holiday Holiday object * @return string|-1 Value if OK, -1 if KO */ public function getNextValue($objsoc, $holiday) @@ -152,19 +152,4 @@ class mod_holiday_madonna extends ModelNumRefHolidays dol_syslog("mod_holiday_madonna::getNextValue return ".$this->prefix.$yymm."-".$num); return $this->prefix.$yymm."-".$num; } - - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Return next value - * - * @param User $fuser User object - * @param Object $objforref Holiday object - * @return string|-1 Value if OK, -1 if KO - */ - public function holiday_get_num($fuser, $objforref) - { - // phpcs:enable - return $this->getNextValue($fuser, $objforref); - } } diff --git a/htdocs/core/modules/hrm/mod_evaluation_advanced.php b/htdocs/core/modules/hrm/mod_evaluation_advanced.php index 2c89930a5ab..78d396d909b 100644 --- a/htdocs/core/modules/hrm/mod_evaluation_advanced.php +++ b/htdocs/core/modules/hrm/mod_evaluation_advanced.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2007 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) - * Copyright (C) 2019 Frédéric France + * Copyright (C) 2019-2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -123,7 +123,7 @@ class mod_evaluation_advanced extends ModeleNumRefEvaluation /** * Return next free value * - * @param Object $object Object we need next value for + * @param Evaluation $object Object we need next value for * @return string|0 Value if OK, 0 if KO */ public function getNextValue($object) diff --git a/htdocs/core/modules/hrm/mod_evaluation_standard.php b/htdocs/core/modules/hrm/mod_evaluation_standard.php index 17cb75ad4ea..418b7b1e5ba 100644 --- a/htdocs/core/modules/hrm/mod_evaluation_standard.php +++ b/htdocs/core/modules/hrm/mod_evaluation_standard.php @@ -1,6 +1,7 @@ * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -77,7 +78,7 @@ class mod_evaluation_standard extends ModeleNumRefEvaluation * Checks if the numbers already in the database do not * cause conflicts that would prevent this numbering working. * - * @param Object $object Object we need next value for + * @param Evaluation $object Object we need next value for * @return boolean false if conflict, true if ok */ public function canBeActivated($object) @@ -117,7 +118,7 @@ class mod_evaluation_standard extends ModeleNumRefEvaluation /** * Return next free value * - * @param Object $object Object we need next value for + * @param Evaluation $object Object we need next value for * @return string|-1 Value if OK, -1 if KO */ public function getNextValue($object) From 9cc32d70d29ea48bedecf85ebeba0e6b0a06cfdf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 11 Mar 2024 18:25:48 +0100 Subject: [PATCH 312/709] Clean code --- htdocs/societe/class/societe.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index eedaa168c37..8565e7260e1 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -4951,7 +4951,7 @@ class Societe extends CommonObject */ public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) { - global $conf, $user, $langs; + global $langs; if (!empty($moreparams) && !empty($moreparams['use_companybankid'])) { $modelpath = "core/modules/bank/doc/"; From 330abe14fe8568cfa499d59c44f5107580e6028a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 11 Mar 2024 18:28:20 +0100 Subject: [PATCH 313/709] FIX Option MAIN_DOC_USE_TIMING can be a string with date format --- .../core/modules/asset/doc/doc_generic_asset_odt.modules.php | 4 ++-- htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php | 4 ++-- .../modules/commande/doc/doc_generic_order_odt.modules.php | 4 ++-- .../modules/contract/doc/doc_generic_contract_odt.modules.php | 4 ++-- .../expedition/doc/doc_generic_shipment_odt.modules.php | 4 ++-- .../modules/facture/doc/doc_generic_invoice_odt.modules.php | 4 ++-- .../core/modules/member/doc/doc_generic_member_odt.class.php | 4 ++-- htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php | 4 ++-- .../modules/product/doc/doc_generic_product_odt.modules.php | 4 ++-- .../modules/project/doc/doc_generic_project_odt.modules.php | 4 ++-- .../modules/propale/doc/doc_generic_proposal_odt.modules.php | 4 ++-- .../reception/doc/doc_generic_reception_odt.modules.php | 4 ++-- htdocs/core/modules/societe/doc/doc_generic_odt.modules.php | 4 ++-- .../core/modules/stock/doc/doc_generic_stock_odt.modules.php | 4 ++-- .../doc/doc_generic_supplier_invoice_odt.modules.php | 4 ++-- .../doc/doc_generic_supplier_order_odt.modules.php | 4 ++-- .../doc/doc_generic_supplier_proposal_odt.modules.php | 4 ++-- .../modules/ticket/doc/doc_generic_ticket_odt.modules.php | 4 ++-- htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php | 4 ++-- .../usergroup/doc/doc_generic_usergroup_odt.modules.php | 4 ++-- .../doc/doc_generic_recruitmentjobposition_odt.modules.php | 4 ++-- 21 files changed, 42 insertions(+), 42 deletions(-) diff --git a/htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php b/htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php index 15d95bde92e..ca77c6f13d0 100644 --- a/htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php +++ b/htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php @@ -262,8 +262,8 @@ class doc_generic_asset_odt extends ModelePDFAsset //$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt'; // Get extension (ods or odt) $newfileformat = substr($newfile, strrpos($newfile, '.') + 1); - if (getDolGlobalInt('MAIN_DOC_USE_TIMING')) { - $format = getDolGlobalInt('MAIN_DOC_USE_TIMING'); + if (getDolGlobalString('MAIN_DOC_USE_TIMING')) { + $format = getDolGlobalString('MAIN_DOC_USE_TIMING'); if ($format == '1') { $format = '%Y%m%d%H%M%S'; } diff --git a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php index 1fcc55446a8..9e3df7965fb 100644 --- a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php +++ b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php @@ -274,8 +274,8 @@ class doc_generic_bom_odt extends ModelePDFBom //$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt'; // Get extension (ods or odt) $newfileformat = substr($newfile, strrpos($newfile, '.') + 1); - if (getDolGlobalInt('MAIN_DOC_USE_TIMING')) { - $format = getDolGlobalInt('MAIN_DOC_USE_TIMING'); + if (getDolGlobalString('MAIN_DOC_USE_TIMING')) { + $format = getDolGlobalString('MAIN_DOC_USE_TIMING'); if ($format == '1') { $format = '%Y%m%d%H%M%S'; } diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php index e8d7abfe0d7..63884795307 100644 --- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php +++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php @@ -280,8 +280,8 @@ class doc_generic_order_odt extends ModelePDFCommandes // Get extension (ods or odt) $newfileformat = substr($newfile, strrpos($newfile, '.') + 1); - if (getDolGlobalInt('MAIN_DOC_USE_TIMING')) { - $format = getDolGlobalInt('MAIN_DOC_USE_TIMING'); + if (getDolGlobalString('MAIN_DOC_USE_TIMING')) { + $format = getDolGlobalString('MAIN_DOC_USE_TIMING'); if ($format == '1') { $format = '%Y%m%d%H%M%S'; } diff --git a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php index 515109c4f20..dffded55555 100644 --- a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php +++ b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php @@ -278,8 +278,8 @@ class doc_generic_contract_odt extends ModelePDFContract // Get extension (ods or odt) $newfileformat = substr($newfile, strrpos($newfile, '.') + 1); - if (getDolGlobalInt('MAIN_DOC_USE_TIMING')) { - $format = getDolGlobalInt('MAIN_DOC_USE_TIMING'); + if (getDolGlobalString('MAIN_DOC_USE_TIMING')) { + $format = getDolGlobalString('MAIN_DOC_USE_TIMING'); if ($format == '1') { $format = '%Y%m%d%H%M%S'; } diff --git a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php index 219c0f47029..a678d8265c5 100644 --- a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php +++ b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php @@ -278,8 +278,8 @@ class doc_generic_shipment_odt extends ModelePdfExpedition //$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt'; // Get extension (ods or odt) $newfileformat = substr($newfile, strrpos($newfile, '.') + 1); - if (getDolGlobalInt('MAIN_DOC_USE_TIMING')) { - $format = getDolGlobalInt('MAIN_DOC_USE_TIMING'); + if (getDolGlobalString('MAIN_DOC_USE_TIMING')) { + $format = getDolGlobalString('MAIN_DOC_USE_TIMING'); if ($format == '1') { $format = '%Y%m%d%H%M%S'; } diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index b74934d96a4..6b28da3e1e1 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -278,8 +278,8 @@ class doc_generic_invoice_odt extends ModelePDFFactures // Get extension (ods or odt) $newfileformat = substr($newfile, strrpos($newfile, '.') + 1); - if (getDolGlobalInt('MAIN_DOC_USE_TIMING')) { - $format = getDolGlobalInt('MAIN_DOC_USE_TIMING'); + if (getDolGlobalString('MAIN_DOC_USE_TIMING')) { + $format = getDolGlobalString('MAIN_DOC_USE_TIMING'); if ($format == '1') { $format = '%Y%m%d%H%M%S'; } diff --git a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php index 2076e156bac..bff58b2737f 100644 --- a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php +++ b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php @@ -268,8 +268,8 @@ class doc_generic_member_odt extends ModelePDFMember // Get extension (ods or odt) $newfileformat = substr($newfile, strrpos($newfile, '.') + 1); - if (getDolGlobalInt('MAIN_DOC_USE_TIMING')) { - $format = getDolGlobalInt('MAIN_DOC_USE_TIMING'); + if (getDolGlobalString('MAIN_DOC_USE_TIMING')) { + $format = getDolGlobalString('MAIN_DOC_USE_TIMING'); if ($format == '1') { $format = '%Y%m%d%H%M%S'; } diff --git a/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php b/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php index fe18e6eb6ea..fe33eec3bba 100644 --- a/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php +++ b/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php @@ -267,8 +267,8 @@ class doc_generic_mo_odt extends ModelePDFMo //$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt'; // Get extension (ods or odt) $newfileformat = substr($newfile, strrpos($newfile, '.') + 1); - if (getDolGlobalInt('MAIN_DOC_USE_TIMING')) { - $format = getDolGlobalInt('MAIN_DOC_USE_TIMING'); + if (getDolGlobalString('MAIN_DOC_USE_TIMING')) { + $format = getDolGlobalString('MAIN_DOC_USE_TIMING'); if ($format == '1') { $format = '%Y%m%d%H%M%S'; } diff --git a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php index 2728bf266c2..8f799be03ae 100644 --- a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php +++ b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php @@ -276,8 +276,8 @@ class doc_generic_product_odt extends ModelePDFProduct // Get extension (ods or odt) $newfileformat = substr($newfile, strrpos($newfile, '.') + 1); - if (getDolGlobalInt('MAIN_DOC_USE_TIMING')) { - $format = getDolGlobalInt('MAIN_DOC_USE_TIMING'); + if (getDolGlobalString('MAIN_DOC_USE_TIMING')) { + $format = getDolGlobalString('MAIN_DOC_USE_TIMING'); if ($format == '1') { $format = '%Y%m%d%H%M%S'; } diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php index e8c1357e7a2..d3cf5e7440c 100644 --- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php +++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php @@ -559,8 +559,8 @@ class doc_generic_project_odt extends ModelePDFProjects //$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt'; // Get extension (ods or odt) $newfileformat = substr($newfile, strrpos($newfile, '.') + 1); - if (getDolGlobalInt('MAIN_DOC_USE_TIMING')) { - $format = getDolGlobalInt('MAIN_DOC_USE_TIMING'); + if (getDolGlobalString('MAIN_DOC_USE_TIMING')) { + $format = getDolGlobalString('MAIN_DOC_USE_TIMING'); if ($format == '1') { $format = '%Y%m%d%H%M%S'; } diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index 734ebdc5137..0c6ef9df011 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -312,8 +312,8 @@ class doc_generic_proposal_odt extends ModelePDFPropales // Get extension (ods or odt) $newfileformat = substr($newfile, strrpos($newfile, '.') + 1); - if (getDolGlobalInt('MAIN_DOC_USE_TIMING')) { - $format = getDolGlobalInt('MAIN_DOC_USE_TIMING'); + if (getDolGlobalString('MAIN_DOC_USE_TIMING')) { + $format = getDolGlobalString('MAIN_DOC_USE_TIMING'); if ($format == '1') { $format = '%Y%m%d%H%M%S'; } diff --git a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php index 2bc493eb580..71fcf65b197 100644 --- a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php +++ b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php @@ -271,8 +271,8 @@ class doc_generic_reception_odt extends ModelePdfReception //$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt'; // Get extension (ods or odt) $newfileformat = substr($newfile, strrpos($newfile, '.') + 1); - if (getDolGlobalInt('MAIN_DOC_USE_TIMING')) { - $format = getDolGlobalInt('MAIN_DOC_USE_TIMING'); + if (getDolGlobalString('MAIN_DOC_USE_TIMING')) { + $format = getDolGlobalString('MAIN_DOC_USE_TIMING'); if ($format == '1') { $format = '%Y%m%d%H%M%S'; } diff --git a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php index 261aeef9ad5..374c44c7a25 100644 --- a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php +++ b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php @@ -252,8 +252,8 @@ class doc_generic_odt extends ModeleThirdPartyDoc $newfiletmp = dol_sanitizeFileName(dol_string_nospecial($object->name)) . '-' . $newfiletmp; $newfiletmp = preg_replace('/__+/', '_', $newfiletmp); // Replace repeated _ into one _ (to avoid string with substitution syntax) } - if (getDolGlobalInt('MAIN_DOC_USE_TIMING')) { - $format = getDolGlobalInt('MAIN_DOC_USE_TIMING'); + if (getDolGlobalString('MAIN_DOC_USE_TIMING')) { + $format = getDolGlobalString('MAIN_DOC_USE_TIMING'); if ($format == '1') { $format = '%Y%m%d%H%M%S'; } diff --git a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php index 5aae143fc2b..a0e89ad1d76 100644 --- a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php +++ b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php @@ -278,8 +278,8 @@ class doc_generic_stock_odt extends ModelePDFStock // Get extension (ods or odt) $newfileformat = substr($newfile, strrpos($newfile, '.') + 1); - if (getDolGlobalInt('MAIN_DOC_USE_TIMING')) { - $format = getDolGlobalInt('MAIN_DOC_USE_TIMING'); + if (getDolGlobalString('MAIN_DOC_USE_TIMING')) { + $format = getDolGlobalString('MAIN_DOC_USE_TIMING'); if ($format == '1') { $format = '%Y%m%d%H%M%S'; } diff --git a/htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php b/htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php index 6031907b305..27cb836e420 100644 --- a/htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php +++ b/htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php @@ -271,8 +271,8 @@ class doc_generic_supplier_invoice_odt extends ModelePDFSuppliersInvoices //$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt'; // Get extension (ods or odt) $newfileformat = substr($newfile, strrpos($newfile, '.') + 1); - if (getDolGlobalInt('MAIN_DOC_USE_TIMING')) { - $format = getDolGlobalInt('MAIN_DOC_USE_TIMING'); + if (getDolGlobalString('MAIN_DOC_USE_TIMING')) { + $format = getDolGlobalString('MAIN_DOC_USE_TIMING'); if ($format == '1') { $format = '%Y%m%d%H%M%S'; } diff --git a/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php b/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php index 285be7c2799..ff7a4f33d36 100644 --- a/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php +++ b/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php @@ -266,8 +266,8 @@ class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders //$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt'; // Get extension (ods or odt) $newfileformat = substr($newfile, strrpos($newfile, '.') + 1); - if (getDolGlobalInt('MAIN_DOC_USE_TIMING')) { - $format = getDolGlobalInt('MAIN_DOC_USE_TIMING'); + if (getDolGlobalString('MAIN_DOC_USE_TIMING')) { + $format = getDolGlobalString('MAIN_DOC_USE_TIMING'); if ($format == '1') { $format = '%Y%m%d%H%M%S'; } diff --git a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php index bbc0fdb583a..35bf81667f8 100644 --- a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php @@ -300,8 +300,8 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal // Get extension (ods or odt) $newfileformat = substr($newfile, strrpos($newfile, '.') + 1); - if (getDolGlobalInt('MAIN_DOC_USE_TIMING')) { - $format = getDolGlobalInt('MAIN_DOC_USE_TIMING'); + if (getDolGlobalString('MAIN_DOC_USE_TIMING')) { + $format = getDolGlobalString('MAIN_DOC_USE_TIMING'); if ($format == '1') { $format = '%Y%m%d%H%M%S'; } diff --git a/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php b/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php index 7aa6b4a07e4..9b6646c313b 100644 --- a/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php +++ b/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php @@ -266,8 +266,8 @@ class doc_generic_ticket_odt extends ModelePDFTicket // Get extension (ods or odt) $newfileformat = substr($newfile, strrpos($newfile, '.') + 1); - if (getDolGlobalInt('MAIN_DOC_USE_TIMING')) { - $format = getDolGlobalInt('MAIN_DOC_USE_TIMING'); + if (getDolGlobalString('MAIN_DOC_USE_TIMING')) { + $format = getDolGlobalString('MAIN_DOC_USE_TIMING'); if ($format == '1') { $format = '%Y%m%d%H%M%S'; } diff --git a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php index d6e52e2f21e..6e671eadae0 100644 --- a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php +++ b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php @@ -300,8 +300,8 @@ class doc_generic_user_odt extends ModelePDFUser // Get extension (ods or odt) $newfileformat = substr($newfile, strrpos($newfile, '.') + 1); - if (getDolGlobalInt('MAIN_DOC_USE_TIMING')) { - $format = getDolGlobalInt('MAIN_DOC_USE_TIMING'); + if (getDolGlobalString('MAIN_DOC_USE_TIMING')) { + $format = getDolGlobalString('MAIN_DOC_USE_TIMING'); if ($format == '1') { $format = '%Y%m%d%H%M%S'; } diff --git a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php index 74ad5902966..666a7945e2d 100644 --- a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php +++ b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php @@ -282,8 +282,8 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup // Get extension (ods or odt) $newfileformat = substr($newfile, strrpos($newfile, '.') + 1); - if (getDolGlobalInt('MAIN_DOC_USE_TIMING')) { - $format = getDolGlobalInt('MAIN_DOC_USE_TIMING'); + if (getDolGlobalString('MAIN_DOC_USE_TIMING')) { + $format = getDolGlobalString('MAIN_DOC_USE_TIMING'); if ($format == '1') { $format = '%Y%m%d%H%M%S'; } diff --git a/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php b/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php index a93a724fbd9..da7640d708a 100644 --- a/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php +++ b/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php @@ -267,8 +267,8 @@ class doc_generic_recruitmentjobposition_odt extends ModelePDFRecruitmentJobPosi //$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt'; // Get extension (ods or odt) $newfileformat = substr($newfile, strrpos($newfile, '.') + 1); - if (getDolGlobalInt('MAIN_DOC_USE_TIMING')) { - $format = getDolGlobalInt('MAIN_DOC_USE_TIMING'); + if (getDolGlobalString('MAIN_DOC_USE_TIMING')) { + $format = getDolGlobalString('MAIN_DOC_USE_TIMING'); if ($format == '1') { $format = '%Y%m%d%H%M%S'; } From e160ba6ba441a42aa96bdd8044f48d86c4b9bcd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Mon, 11 Mar 2024 18:29:41 +0100 Subject: [PATCH 314/709] clean code and phpdoc --- .../modules/member/mod_member_advanced.php | 2 +- .../core/modules/member/mod_member_simple.php | 2 +- htdocs/core/modules/mrp/mod_mo_advanced.php | 4 ++-- htdocs/core/modules/mrp/mod_mo_standard.php | 5 +++-- .../product_batch/mod_lot_standard.php | 3 ++- .../modules/product_batch/mod_sn_standard.php | 3 ++- .../modules/project/mod_project_simple.php | 3 ++- .../modules/project/mod_project_universal.php | 16 +--------------- .../modules/propale/mod_propale_marbre.php | 5 +++-- .../modules/reception/mod_reception_beryl.php | 19 +++---------------- .../reception/mod_reception_moonstone.php | 18 ++---------------- .../societe/mod_codecompta_aquarium.php | 3 ++- .../mod_stocktransfer_advanced.php | 6 +++--- .../mod_stocktransfer_standard.php | 9 +++++---- 14 files changed, 32 insertions(+), 66 deletions(-) diff --git a/htdocs/core/modules/member/mod_member_advanced.php b/htdocs/core/modules/member/mod_member_advanced.php index 2147961ea82..4ed9bb1740c 100644 --- a/htdocs/core/modules/member/mod_member_advanced.php +++ b/htdocs/core/modules/member/mod_member_advanced.php @@ -79,7 +79,7 @@ class mod_member_advanced extends ModeleNumRefMembers * Checks if the numbers already in the database do not * cause conflicts that would prevent this numbering working. * - * @param Object $object Object we need next value for + * @param Adherent $object Object we need next value for * @return boolean false if conflict, true if ok */ public function canBeActivated($object) diff --git a/htdocs/core/modules/member/mod_member_simple.php b/htdocs/core/modules/member/mod_member_simple.php index c76d7a38c38..77b1bd8632d 100644 --- a/htdocs/core/modules/member/mod_member_simple.php +++ b/htdocs/core/modules/member/mod_member_simple.php @@ -79,7 +79,7 @@ class mod_member_simple extends ModeleNumRefMembers * Checks if the numbers already in the database do not * cause conflicts that would prevent this numbering working. * - * @param Object $object Object we need next value for + * @param Adherent $object Object we need next value for * @return boolean false if KO (there is a conflict), true if OK */ public function canBeActivated($object) diff --git a/htdocs/core/modules/mrp/mod_mo_advanced.php b/htdocs/core/modules/mrp/mod_mo_advanced.php index b04001e84d3..fe2948e1ea5 100644 --- a/htdocs/core/modules/mrp/mod_mo_advanced.php +++ b/htdocs/core/modules/mrp/mod_mo_advanced.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2007 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) - * Copyright (C) 2019 Frédéric France + * Copyright (C) 2019-2024 Frédéric France * Copyright (C) 2020 Josep Lluís Amador * * This program is free software; you can redistribute it and/or modify @@ -120,7 +120,7 @@ class mod_mo_advanced extends ModeleNumRefMos * Return next free value * * @param Product $objprod Object product - * @param Object $object Object we need next value for + * @param Mo $object Object we need next value for * @return string|0 Value if OK, 0 if KO */ public function getNextValue($objprod, $object) diff --git a/htdocs/core/modules/mrp/mod_mo_standard.php b/htdocs/core/modules/mrp/mod_mo_standard.php index d1e294fd3d3..191bf3439d6 100644 --- a/htdocs/core/modules/mrp/mod_mo_standard.php +++ b/htdocs/core/modules/mrp/mod_mo_standard.php @@ -1,6 +1,7 @@ * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -76,7 +77,7 @@ class mod_mo_standard extends ModeleNumRefMos * Checks if the numbers already in the database do not * cause conflicts that would prevent this numbering working. * - * @param Object $object Object we need next value for + * @param Mo $object Object we need next value for * @return boolean false if conflict, true if ok */ public function canBeActivated($object) @@ -113,7 +114,7 @@ class mod_mo_standard extends ModeleNumRefMos * Return next free value * * @param Product $objprod Object product - * @param Object $object Object we need next value for + * @param Mo $object Object we need next value for * @return string|-1 Value if OK, -1 if KO */ public function getNextValue($objprod, $object) diff --git a/htdocs/core/modules/product_batch/mod_lot_standard.php b/htdocs/core/modules/product_batch/mod_lot_standard.php index 82e4098a246..43a33dbba67 100644 --- a/htdocs/core/modules/product_batch/mod_lot_standard.php +++ b/htdocs/core/modules/product_batch/mod_lot_standard.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005-2010 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2021 Christophe Battarel + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -77,7 +78,7 @@ class mod_lot_standard extends ModeleNumRefBatch * Checks if the numbers already in the database do not * cause conflicts that would prevent this numbering working. * - * @param Object $object Object we need next value for + * @param Productlot $object Object we need next value for * @return boolean false if KO (there is a conflict), true if OK */ public function canBeActivated($object) diff --git a/htdocs/core/modules/product_batch/mod_sn_standard.php b/htdocs/core/modules/product_batch/mod_sn_standard.php index 42986330cf8..474b6531c65 100644 --- a/htdocs/core/modules/product_batch/mod_sn_standard.php +++ b/htdocs/core/modules/product_batch/mod_sn_standard.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005-2010 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2021 Christophe Battarel + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -77,7 +78,7 @@ class mod_sn_standard extends ModeleNumRefBatch * Checks if the numbers already in the database do not * cause conflicts that would prevent this numbering working. * - * @param Object $object Object we need next value for + * @param Productlot $object Object we need next value for * @return boolean false if KO (there is a conflict), true if OK */ public function canBeActivated($object) diff --git a/htdocs/core/modules/project/mod_project_simple.php b/htdocs/core/modules/project/mod_project_simple.php index 69229dcf77f..8dac1238ab2 100644 --- a/htdocs/core/modules/project/mod_project_simple.php +++ b/htdocs/core/modules/project/mod_project_simple.php @@ -1,6 +1,7 @@ * Copyright (C) 2010 Laurent Destailleur + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -85,7 +86,7 @@ class mod_project_simple extends ModeleNumRefProjects * Checks if the numbers already in the database do not * cause conflicts that would prevent this numbering working. * - * @param Object $object Object we need next value for + * @param Project $object Object we need next value for * @return boolean false if KO (there is a conflict), true if OK */ public function canBeActivated($object) diff --git a/htdocs/core/modules/project/mod_project_universal.php b/htdocs/core/modules/project/mod_project_universal.php index e4b280cf226..6ed05b3e728 100644 --- a/htdocs/core/modules/project/mod_project_universal.php +++ b/htdocs/core/modules/project/mod_project_universal.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -150,19 +151,4 @@ class mod_project_universal extends ModeleNumRefProjects return $numFinal; } - - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Return next reference not yet used as a reference - * - * @param Societe $objsoc Object third party - * @param Project $project Object project - * @return string|0 Next not used reference, 0 if KO - */ - public function project_get_num($objsoc = 0, $project = '') - { - // phpcs:enable - return $this->getNextValue($objsoc, $project); - } } diff --git a/htdocs/core/modules/propale/mod_propale_marbre.php b/htdocs/core/modules/propale/mod_propale_marbre.php index e5a8c1a0d9d..e38d8076604 100644 --- a/htdocs/core/modules/propale/mod_propale_marbre.php +++ b/htdocs/core/modules/propale/mod_propale_marbre.php @@ -1,6 +1,7 @@ * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -85,7 +86,7 @@ class mod_propale_marbre extends ModeleNumRefPropales * Checks if the numbers already in the database do not * cause conflicts that would prevent this numbering working. * - * @param Object $object Object we need next value for + * @param Propal $object Object we need next value for * @return boolean false if KO (there is a conflict), true if OK */ public function canBeActivated($object) @@ -167,7 +168,7 @@ class mod_propale_marbre extends ModeleNumRefPropales * Return next free value * * @param Societe $objsoc Object third party - * @param Object $objforref Object for number to search + * @param Propal $objforref Object for number to search * @return string|-1 Next free value, -1 if KO */ public function getNumRef($objsoc, $objforref) diff --git a/htdocs/core/modules/reception/mod_reception_beryl.php b/htdocs/core/modules/reception/mod_reception_beryl.php index 164732886a3..896d8f86fb6 100644 --- a/htdocs/core/modules/reception/mod_reception_beryl.php +++ b/htdocs/core/modules/reception/mod_reception_beryl.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -61,7 +62,7 @@ class mod_reception_beryl extends ModelNumRefReception /** * Test if existing numbers make problems with numbering * - * @param Object $object Object we need next value for + * @param Reception $object Object we need next value for * @return boolean false if KO (there is a conflict), true if OK */ public function canBeActivated($object) @@ -98,7 +99,7 @@ class mod_reception_beryl extends ModelNumRefReception * Return next value * * @param Societe $objsoc Third party object - * @param Object $reception Reception object + * @param Reception $reception Reception object * @return string|-1 Value if OK, -1 if KO */ public function getNextValue($objsoc, $reception) @@ -136,18 +137,4 @@ class mod_reception_beryl extends ModelNumRefReception dol_syslog("mod_reception_beryl::getNextValue return ".$this->prefix.$yymm."-".$num); return $this->prefix.$yymm."-".$num; } - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Return next free value - * - * @param Societe $objsoc Third party object - * @param Object $objforref Shipment object - * @return string|-1 Next free value, -1 if KO - */ - public function reception_get_num($objsoc, $objforref) - { - // phpcs:enable - return $this->getNextValue($objsoc, $objforref); - } } diff --git a/htdocs/core/modules/reception/mod_reception_moonstone.php b/htdocs/core/modules/reception/mod_reception_moonstone.php index 8742dede043..0ccf7ff1328 100644 --- a/htdocs/core/modules/reception/mod_reception_moonstone.php +++ b/htdocs/core/modules/reception/mod_reception_moonstone.php @@ -1,6 +1,6 @@ - * Copyright (C) 2019 Frédéric France + * Copyright (C) 2019-2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -98,7 +98,7 @@ class mod_reception_moonstone extends ModelNumRefReception * Return next value * * @param Societe $objsoc Third party object - * @param Object|null $reception Reception object + * @param Receptiont|null $reception Reception object * @return string|0 Value if OK, 0 if KO */ public function getNextValue($objsoc, $reception) @@ -124,18 +124,4 @@ class mod_reception_moonstone extends ModelNumRefReception return $numFinal; } - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Return next free value - * - * @param Societe $objsoc Third party object - * @param Object $objforref Reception object - * @return string|0 Next free value, 0 if KO - */ - public function reception_get_num($objsoc, $objforref) - { - // phpcs:enable - return $this->getNextValue($objsoc, $objforref); - } } diff --git a/htdocs/core/modules/societe/mod_codecompta_aquarium.php b/htdocs/core/modules/societe/mod_codecompta_aquarium.php index cd73e6a0473..264ee51741b 100644 --- a/htdocs/core/modules/societe/mod_codecompta_aquarium.php +++ b/htdocs/core/modules/societe/mod_codecompta_aquarium.php @@ -3,6 +3,7 @@ * Copyright (C) 2005 Eric Seigne * Copyright (C) 2006-2011 Laurent Destailleur * Copyright (C) 2024 MDW + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -130,7 +131,7 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode * Return an example of result returned by getNextValue * * @param Translate $langs Object langs - * @param societe $objsoc Object thirdparty + * @param Societe $objsoc Object thirdparty * @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect) * @return string Return string example */ diff --git a/htdocs/core/modules/stocktransfer/mod_stocktransfer_advanced.php b/htdocs/core/modules/stocktransfer/mod_stocktransfer_advanced.php index 21da56af6bc..5860b120342 100644 --- a/htdocs/core/modules/stocktransfer/mod_stocktransfer_advanced.php +++ b/htdocs/core/modules/stocktransfer/mod_stocktransfer_advanced.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2007 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) - * Copyright (C) 2019 Frédéric France + * Copyright (C) 2019-2024 Frédéric France * Copyright (C) 2021 Gauthier VERDOL * * This program is free software; you can redistribute it and/or modify @@ -124,8 +124,8 @@ class mod_stocktransfer_advanced extends ModeleNumRefStockTransfer /** * Return next free value * - * @param Object $object Object we need next value for - * @return string|0 Value if OK, 0 if KO + * @param StockTransfer $object Object we need next value for + * @return string|0 Value if OK, 0 if KO */ public function getNextValue($object) { diff --git a/htdocs/core/modules/stocktransfer/mod_stocktransfer_standard.php b/htdocs/core/modules/stocktransfer/mod_stocktransfer_standard.php index c1e16da016b..35e02b76fa4 100644 --- a/htdocs/core/modules/stocktransfer/mod_stocktransfer_standard.php +++ b/htdocs/core/modules/stocktransfer/mod_stocktransfer_standard.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005-2010 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2021 Gauthier VERDOL + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -78,8 +79,8 @@ class mod_stocktransfer_standard extends ModeleNumRefStockTransfer * Checks if the numbers already in the database do not * cause conflicts that would prevent this numbering working. * - * @param Object $object Object we need next value for - * @return boolean false if conflict, true if ok + * @param StockTransfer $object Object we need next value for + * @return boolean false if conflict, true if ok */ public function canBeActivated($object) { @@ -118,8 +119,8 @@ class mod_stocktransfer_standard extends ModeleNumRefStockTransfer /** * Return next free value * - * @param Object $object Object we need next value for - * @return string|-1 Value if OK, -1 if KO + * @param StockTransfer $object Object we need next value for + * @return string|-1 Value if OK, -1 if KO */ public function getNextValue($object) { From 6f3ba871e0ecc80d243c528c6e4c448ddbdd8825 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Mon, 11 Mar 2024 18:33:41 +0100 Subject: [PATCH 315/709] clean code and phpdoc --- .../mod_facture_fournisseur_cactus.php | 19 +++++++++-------- .../mod_facture_fournisseur_tulip.php | 21 ++++++++++--------- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php index 418db94b07e..95612da93f0 100644 --- a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php +++ b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php @@ -3,6 +3,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2013-2018 Philippe Grand * Copyright (C) 2016 Alexandre Spangaro + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -91,7 +92,7 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices /** * Tests if the numbers already in the database do not cause conflicts that would prevent this numbering. * - * @param Object $object Object we need next value for + * @param FactureFournisseur $object Object we need next value for * @return boolean false if KO (there is a conflict), true if OK */ public function canBeActivated($object) @@ -173,10 +174,10 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices /** * Return next value * - * @param Societe $objsoc Object third party - * @param Object $object Object invoice - * @param string $mode 'next' for next value or 'last' for last value - * @return string|-1 Value if OK, -1 if KO + * @param Societe $objsoc Object third party + * @param FactureFournisseur $object Object invoice + * @param string $mode 'next' for next value or 'last' for last value + * @return string|-1 Value if OK, -1 if KO */ public function getNextValue($objsoc, $object, $mode = 'next') { @@ -256,10 +257,10 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices /** * Return next free value * - * @param Societe $objsoc Object third party - * @param string $objforref Object for number to search - * @param string $mode 'next' for next value or 'last' for last value - * @return string Next free value + * @param Societe $objsoc Object third party + * @param FactureFournisseur $objforref Object for number to search + * @param string $mode 'next' for next value or 'last' for last value + * @return string Next free value */ public function getNumRef($objsoc, $objforref, $mode = 'next') { diff --git a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php index b567b7e5522..39643722cf5 100644 --- a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php +++ b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php @@ -5,6 +5,7 @@ * Copyright (C) 2013-2018 Philippe Grand * Copyright (C) 2013 Juanjo Menent * Copyright (C) 2016-2021 Alexandre Spangaro + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,8 +32,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/supplier_invoice/modules_facturefo /** - \class mod_facture_fournisseur_tulip - \brief Tulip Class of numbering models of suppliers invoices references + * \class mod_facture_fournisseur_tulip + * \brief Tulip Class of numbering models of suppliers invoices references */ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices { @@ -146,10 +147,10 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices /** * Return next value * - * @param Societe $objsoc Object third party - * @param Object $object Object invoice - * @param string $mode 'next' for next value or 'last' for last value - * @return string|0 Value if OK, 0 if KO + * @param Societe $objsoc Object third party + * @param FactureFournisseur $object Object invoice + * @param string $mode 'next' for next value or 'last' for last value + * @return string|0 Value if OK, 0 if KO */ public function getNextValue($objsoc, $object, $mode = 'next') { @@ -185,10 +186,10 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices /** * Return next free value * - * @param Societe $objsoc Object third party - * @param string $objforref Object for number to search - * @param string $mode 'next' for next value or 'last' for last value - * @return string Next free value + * @param Societe $objsoc Object third party + * @param FactureFournisseur $objforref Object for number to search + * @param string $mode 'next' for next value or 'last' for last value + * @return string Next free value */ public function getNumRef($objsoc, $objforref, $mode = 'next') { From 71a65557bb8e81e4c80941a5c90549d49cf7c232 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Mon, 11 Mar 2024 18:36:05 +0100 Subject: [PATCH 316/709] clean code and phpdoc --- .../reception/mod_reception_moonstone.php | 2 +- .../mod_commande_fournisseur_muguet.php | 24 ++++--------------- .../mod_commande_fournisseur_orchidee.php | 22 ++++------------- 3 files changed, 10 insertions(+), 38 deletions(-) diff --git a/htdocs/core/modules/reception/mod_reception_moonstone.php b/htdocs/core/modules/reception/mod_reception_moonstone.php index 0ccf7ff1328..9acf2cfd161 100644 --- a/htdocs/core/modules/reception/mod_reception_moonstone.php +++ b/htdocs/core/modules/reception/mod_reception_moonstone.php @@ -98,7 +98,7 @@ class mod_reception_moonstone extends ModelNumRefReception * Return next value * * @param Societe $objsoc Third party object - * @param Receptiont|null $reception Reception object + * @param Reception|null $reception Reception object * @return string|0 Value if OK, 0 if KO */ public function getNextValue($objsoc, $reception) diff --git a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php index 35aec96e909..1ff309bdcdf 100644 --- a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php +++ b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php @@ -1,6 +1,7 @@ * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -95,7 +96,7 @@ class mod_commande_fournisseur_muguet extends ModeleNumRefSuppliersOrders * Checks if the numbers already in the database do not * cause conflicts that would prevent this numbering working. * - * @param Object $object Object we need next value for + * @param CommandeFournisseur $object Object we need next value for * @return boolean false if KO (there is a conflict), true if OK */ public function canBeActivated($object) @@ -130,9 +131,9 @@ class mod_commande_fournisseur_muguet extends ModeleNumRefSuppliersOrders /** * Return next value * - * @param Societe $objsoc Object third party - * @param Object $object Object - * @return string Value if OK, 0 if KO + * @param Societe $objsoc Object third party + * @param CommandeFournisseur $object Object + * @return string Value if OK, 0 if KO */ public function getNextValue($objsoc = 0, $object = '') { @@ -170,19 +171,4 @@ class mod_commande_fournisseur_muguet extends ModeleNumRefSuppliersOrders return $this->prefix.$yymm."-".$num; } - - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Renvoie la reference de commande suivante non utilisee - * - * @param Societe $objsoc Object third party - * @param Object $object Object - * @return string Descriptive text - */ - public function commande_get_num($objsoc = 0, $object = '') - { - // phpcs:enable - return $this->getNextValue($objsoc, $object); - } } diff --git a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php index a0322ab2956..db138369a53 100644 --- a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php +++ b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003-2007 Rodolphe Quiedeville * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -121,9 +122,9 @@ class mod_commande_fournisseur_orchidee extends ModeleNumRefSuppliersOrders /** * Return next value * - * @param Societe $objsoc Object third party - * @param Object $object Object - * @return string|0 Value if OK, 0 if KO + * @param Societe $objsoc Object third party + * @param CommandeFournisseur $object Object + * @return string|0 Value if OK, 0 if KO */ public function getNextValue($objsoc = 0, $object = '') { @@ -143,19 +144,4 @@ class mod_commande_fournisseur_orchidee extends ModeleNumRefSuppliersOrders return $numFinal; } - - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Renvoie la reference de commande suivante non utilisee - * - * @param Societe $objsoc Object third party - * @param Object $object Object - * @return string Descriptive text - */ - public function commande_get_num($objsoc = 0, $object = '') - { - // phpcs:enable - return $this->getNextValue($objsoc, $object); - } } From 50e8c19b7e630a7e8492ea065d31cfa1b948ee62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Mon, 11 Mar 2024 18:50:18 +0100 Subject: [PATCH 317/709] clean code and phpdoc --- .../mod_supplier_payment_brodator.php | 22 +++------------- .../mod_supplier_payment_bronan.php | 26 +++++-------------- .../mod_supplier_proposal_marbre.php | 11 ++++---- .../takepos/mod_takepos_ref_simple.php | 5 ++-- .../takepos/mod_takepos_ref_universal.php | 3 ++- .../core/modules/ticket/mod_ticket_simple.php | 3 ++- .../workstation/mod_workstation_advanced.php | 4 +-- .../workstation/mod_workstation_standard.php | 5 ++-- 8 files changed, 28 insertions(+), 51 deletions(-) diff --git a/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php b/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php index b2a26199a32..6790389a328 100644 --- a/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php +++ b/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -118,9 +119,9 @@ class mod_supplier_payment_brodator extends ModeleNumRefSupplierPayments /** * Return next free value * - * @param Societe $objsoc Object thirdparty - * @param Object $object Object we need next value for - * @return string|0 Next value if OK, 0 if KO + * @param Societe $objsoc Object thirdparty + * @param PaiementFourn $object Object we need next value for + * @return string|0 Next value if OK, 0 if KO */ public function getNextValue($objsoc, $object) { @@ -140,19 +141,4 @@ class mod_supplier_payment_brodator extends ModeleNumRefSupplierPayments return $numFinal; } - - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Return next free value - * - * @param Societe $objsoc Object third party - * @param string $objforref Object for number to search - * @return string Next free value - */ - public function commande_get_num($objsoc, $objforref) - { - // phpcs:enable - return $this->getNextValue($objsoc, $objforref); - } } diff --git a/htdocs/core/modules/supplier_payment/mod_supplier_payment_bronan.php b/htdocs/core/modules/supplier_payment/mod_supplier_payment_bronan.php index 38d41158f04..710369855b8 100644 --- a/htdocs/core/modules/supplier_payment/mod_supplier_payment_bronan.php +++ b/htdocs/core/modules/supplier_payment/mod_supplier_payment_bronan.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -83,8 +84,8 @@ class mod_supplier_payment_bronan extends ModeleNumRefSupplierPayments * Checks if the numbers already in the database do not * cause conflicts that would prevent this numbering working. * - * @param Object $object Object we need next value for - * @return boolean false if KO (there is a conflict), true if OK + * @param PaiementFourn $object Object we need next value for + * @return boolean false if KO (there is a conflict), true if OK */ public function canBeActivated($object) { @@ -119,9 +120,9 @@ class mod_supplier_payment_bronan extends ModeleNumRefSupplierPayments /** * Return next free value * - * @param Societe $objsoc Object thirdparty - * @param Object $object Object we need next value for - * @return string|-1 Value if OK, -1 if KO + * @param Societe $objsoc Object thirdparty + * @param PaiementFourn $object Object we need next value for + * @return string|-1 Value if OK, -1 if KO */ public function getNextValue($objsoc, $object) { @@ -160,19 +161,4 @@ class mod_supplier_payment_bronan extends ModeleNumRefSupplierPayments dol_syslog(__METHOD__." return ".$this->prefix.$yymm."-".$num); return $this->prefix.$yymm."-".$num; } - - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Return next free value - * - * @param Societe $objsoc Object third party - * @param string $objforref Object for number to search - * @return string Next free value - */ - public function payment_get_num($objsoc, $objforref) - { - // phpcs:enable - return $this->getNextValue($objsoc, $objforref); - } } diff --git a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php index 97a3507ff3b..d1a638345d3 100644 --- a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php +++ b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php @@ -1,6 +1,7 @@ * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -85,8 +86,8 @@ class mod_supplier_proposal_marbre extends ModeleNumRefSupplierProposal * Checks if the numbers already in the database do not * cause conflicts that would prevent this numbering working. * - * @param Object $object Object we need next value for - * @return boolean false if KO (there is a conflict), true if OK + * @param SupplierProposal $object Object we need next value for + * @return boolean false if KO (there is a conflict), true if OK */ public function canBeActivated($object) { @@ -166,9 +167,9 @@ class mod_supplier_proposal_marbre extends ModeleNumRefSupplierProposal /** * Return next free value * - * @param Societe $objsoc Object third party - * @param Object $objforref Object for number to search - * @return string Next free value + * @param Societe $objsoc Object third party + * @param SupplierProposal $objforref Object for number to search + * @return string Next free value */ public function getNumRef($objsoc, $objforref) { diff --git a/htdocs/core/modules/takepos/mod_takepos_ref_simple.php b/htdocs/core/modules/takepos/mod_takepos_ref_simple.php index af9b41f3f97..616c43513dd 100644 --- a/htdocs/core/modules/takepos/mod_takepos_ref_simple.php +++ b/htdocs/core/modules/takepos/mod_takepos_ref_simple.php @@ -3,6 +3,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2013 Juanjo Menent * Copyright (C) 2020 Open-DSI + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -85,7 +86,7 @@ class mod_takepos_ref_simple extends ModeleNumRefTakepos * Test if the numbers already in the database do not cause any conflicts that will prevent this * of conflicts that will prevent this numbering from working. * - * @param Object $object Object we need next value for + * @param Facture $object Object we need next value for * @return boolean false if KO (there is a conflict), true if OK */ public function canBeActivated($object) @@ -208,7 +209,7 @@ class mod_takepos_ref_simple extends ModeleNumRefTakepos * Return next free value * * @param Societe $objsoc Object third party - * @param Object $objforref Object for number to search + * @param Facture $objforref Object for number to search * @return string Next free value */ public function getNumRef($objsoc, $objforref) diff --git a/htdocs/core/modules/takepos/mod_takepos_ref_universal.php b/htdocs/core/modules/takepos/mod_takepos_ref_universal.php index 35a02f4823c..1c06bfdd16a 100644 --- a/htdocs/core/modules/takepos/mod_takepos_ref_universal.php +++ b/htdocs/core/modules/takepos/mod_takepos_ref_universal.php @@ -5,6 +5,7 @@ * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2013 Juanjo Menent * Copyright (C) 2020 Open-DSI + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -151,7 +152,7 @@ class mod_takepos_ref_universal extends ModeleNumRefTakepos * Return next free value * * @param Societe $objsoc Object third party - * @param Object $objforref Object for number to search + * @param Facture $objforref Object for number to search * @return string Next free value */ public function getNumRef($objsoc, $objforref) diff --git a/htdocs/core/modules/ticket/mod_ticket_simple.php b/htdocs/core/modules/ticket/mod_ticket_simple.php index 943f26c2c50..eca05a8e700 100644 --- a/htdocs/core/modules/ticket/mod_ticket_simple.php +++ b/htdocs/core/modules/ticket/mod_ticket_simple.php @@ -1,6 +1,7 @@ * Copyright (C) 2010 Laurent Destailleur + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -81,7 +82,7 @@ class mod_ticket_simple extends ModeleNumRefTicket * Checks if the numbers already in the database do not * cause conflicts that would prevent this numbering working. * - * @param Object $object Object we need next value for + * @param Ticket $object Object we need next value for * @return boolean false if conflict, true if ok */ public function canBeActivated($object) diff --git a/htdocs/core/modules/workstation/mod_workstation_advanced.php b/htdocs/core/modules/workstation/mod_workstation_advanced.php index 3081519dad1..032083ba641 100644 --- a/htdocs/core/modules/workstation/mod_workstation_advanced.php +++ b/htdocs/core/modules/workstation/mod_workstation_advanced.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2007 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) - * Copyright (C) 2019 Frédéric France + * Copyright (C) 2019-2024 Frédéric France * Copyright (C) 2020 Gauthier VERDOL * * This program is free software; you can redistribute it and/or modify @@ -124,7 +124,7 @@ class mod_workstation_advanced extends ModeleNumRefWorkstation /** * Return next free value * - * @param Object $object Object we need next value for + * @param Workstation $object Object we need next value for * @return string|0 Next value if OK, 0 if KO */ public function getNextValue($object) diff --git a/htdocs/core/modules/workstation/mod_workstation_standard.php b/htdocs/core/modules/workstation/mod_workstation_standard.php index bb8938e6440..5d2b3cbde0e 100644 --- a/htdocs/core/modules/workstation/mod_workstation_standard.php +++ b/htdocs/core/modules/workstation/mod_workstation_standard.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005-2010 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2020 Gauthier VERDOL + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -77,7 +78,7 @@ class mod_workstation_standard extends ModeleNumRefWorkstation * Checks if the numbers already in the database do not * cause conflicts that would prevent this numbering working. * - * @param Object $object Object we need next value for + * @param Workstation $object Object we need next value for * @return boolean false if conflict, true if ok */ public function canBeActivated($object) @@ -115,7 +116,7 @@ class mod_workstation_standard extends ModeleNumRefWorkstation /** * Return next free value * - * @param Object $object Object we need next value for + * @param Workstation $object Object we need next value for * @return string|-1 Next value if OK, -1 if KO */ public function getNextValue($object) From 56a4dd46db7d489759af538cd1b301fd51bdc747 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 11 Mar 2024 20:41:56 +0100 Subject: [PATCH 318/709] Add a log --- htdocs/ai/ajax/generate_content.php | 2 +- htdocs/ai/class/ai.class.php | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/ai/ajax/generate_content.php b/htdocs/ai/ajax/generate_content.php index 9b1adf13b84..f60cef9ee09 100644 --- a/htdocs/ai/ajax/generate_content.php +++ b/htdocs/ai/ajax/generate_content.php @@ -67,7 +67,7 @@ $function = 'textgeneration'; $generatedContent = $ai->generateContent($instructions, 'auto', $function); if (is_array($generatedContent) && $generatedContent['error']) { - print "Error : " . $generatedContent['message']; + print "Error returned by API call: " . $generatedContent['message']; } else { print $generatedContent; } diff --git a/htdocs/ai/class/ai.class.php b/htdocs/ai/class/ai.class.php index 399b3adb1ee..fd1c7ca17c5 100644 --- a/htdocs/ai/class/ai.class.php +++ b/htdocs/ai/class/ai.class.php @@ -64,6 +64,10 @@ class Ai */ public function generateContent($instructions, $model = 'auto', $function = 'textgeneration') { + if (empty($this->apiKey)) { + return array('error' => true, 'message' => 'API key is no defined'); + } + if (empty($this->apiEndpoint)) { if ($function == 'textgeneration') { $this->apiEndpoint = 'https://api.openai.com/v1/chat/completions'; @@ -97,6 +101,8 @@ class Ai } } + dol_syslog("Call API for apiEndpoint=".$this->apiEndpoint." apiKey=".substr($this->apiKey, 0, 3).'***********, model='.$model); + try { $configurationsJson = getDolGlobalString('AI_CONFIGURATIONS_PROMPT'); $configurations = json_decode($configurationsJson, true); From 325cb587f62d50e255b51336ba8c196de9786b87 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 20:46:21 +0100 Subject: [PATCH 319/709] Qual: Exclude some tests from windows-ci until fixed # Qual: Exclude some tests from windows-ci until fixed Until #28598 and #28264 find some way to the develop branch, this update will skip the tests that currently fail on windows so that the results of other tests have an effect on the CI status and github annotations --- .github/workflows/windows-ci.yaml | 4 ++-- test/phpunit/FilesLibTest.php | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/windows-ci.yaml b/.github/workflows/windows-ci.yaml index c0e44dbb74f..f8441c438fc 100644 --- a/.github/workflows/windows-ci.yaml +++ b/.github/workflows/windows-ci.yaml @@ -114,7 +114,7 @@ jobs: curl "http://${{ env.PHPSERVER_DOMAIN_PORT }}" shell: powershell - name: Run PHPUnit tests - continue-on-error: true + # continue-on-error: true shell: cmd # setting up php.ini, starting the php server are currently in this step run: |- @@ -143,7 +143,7 @@ jobs: cat htdocs/conf/conf.php curl "http://${{ env.PHPSERVER_DOMAIN_PORT }}" REM 'DOSKEY' USED to recover error code (no pipefile equivalent in windows?) - ( php "%PHPROOT%\phpunit" -d memory_limit=-1 -c %CD%\test\phpunit\phpunittest.xml "test\phpunit\AllTests.php" & call doskey /exename=err err=%%^^errorlevel%% ) | "${{ env.TEE }}" "${{ env.PHPUNIT_LOG }}" + ( php "%PHPROOT%\phpunit" -d memory_limit=-1 -c %CD%\test\phpunit\phpunittest.xml "test\phpunit\AllTests.php" --exclude-group WindowsWaitingForFix & call doskey /exename=err err=%%^^errorlevel%% ) | "${{ env.TEE }}" "${{ env.PHPUNIT_LOG }}" for /f "tokens=2 delims==" %%A in ('doskey /m:err') do EXIT /B %%A - name: Convert Raw Log to Annotations uses: mdeweerd/logToCheckStyle@v2024.2.9 diff --git a/test/phpunit/FilesLibTest.php b/test/phpunit/FilesLibTest.php index 91cdcc816bd..32616542c2a 100644 --- a/test/phpunit/FilesLibTest.php +++ b/test/phpunit/FilesLibTest.php @@ -247,6 +247,7 @@ class FilesLibTest extends CommonClassTest * testDolCopyMoveDelete * * @return void + * @group WindowsWaitingForFix */ public function testDolCopyMoveDelete() { @@ -490,6 +491,7 @@ class FilesLibTest extends CommonClassTest * testDolDirMove * * @return void + * @group WindowsWaitingForFix */ public function testDolDirMove() { From 23ae21958b828c0bfb2564cb33c1a90738002045 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Mon, 11 Mar 2024 20:57:48 +0100 Subject: [PATCH 320/709] clean code and phpdoc --- htdocs/core/modules/delivery/mod_delivery_saphir.php | 1 + htdocs/core/modules/facture/mod_facture_mars.php | 1 + htdocs/core/modules/facture/mod_facture_mercure.php | 1 + htdocs/core/modules/facture/mod_facture_terre.php | 1 + htdocs/core/modules/fichinter/mod_arctic.php | 1 + htdocs/core/modules/fichinter/mod_pacific.php | 1 + htdocs/core/modules/propale/mod_propale_marbre.php | 1 + .../modules/supplier_invoice/mod_facture_fournisseur_cactus.php | 1 + .../modules/supplier_invoice/mod_facture_fournisseur_tulip.php | 1 + .../modules/supplier_proposal/mod_supplier_proposal_marbre.php | 1 + htdocs/core/modules/takepos/mod_takepos_ref_simple.php | 1 + htdocs/core/modules/takepos/mod_takepos_ref_universal.php | 1 + htdocs/fourn/class/fournisseur.facture.class.php | 2 +- 13 files changed, 13 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/delivery/mod_delivery_saphir.php b/htdocs/core/modules/delivery/mod_delivery_saphir.php index 4d6bdb7c716..b6669961cd0 100644 --- a/htdocs/core/modules/delivery/mod_delivery_saphir.php +++ b/htdocs/core/modules/delivery/mod_delivery_saphir.php @@ -151,6 +151,7 @@ class mod_delivery_saphir extends ModeleNumRefDeliveryOrder * @param Societe $objsoc Object third party * @param Delivery $objforref Object for number to search * @return string|0 Next free value, 0 if KO + * @deprecated see getNextValue */ public function getNumRef($objsoc, $objforref) { diff --git a/htdocs/core/modules/facture/mod_facture_mars.php b/htdocs/core/modules/facture/mod_facture_mars.php index 71f9fb27eec..94c45e0ce37 100644 --- a/htdocs/core/modules/facture/mod_facture_mars.php +++ b/htdocs/core/modules/facture/mod_facture_mars.php @@ -247,6 +247,7 @@ class mod_facture_mars extends ModeleNumRefFactures * @param Facture $objforref Object for number to search * @param string $mode 'next' for next value or 'last' for last value * @return string Next free value + * @deprecated see getNextValue */ public function getNumRef($objsoc, $objforref, $mode = 'next') { diff --git a/htdocs/core/modules/facture/mod_facture_mercure.php b/htdocs/core/modules/facture/mod_facture_mercure.php index 8d1194b7d4a..1043808be3a 100644 --- a/htdocs/core/modules/facture/mod_facture_mercure.php +++ b/htdocs/core/modules/facture/mod_facture_mercure.php @@ -182,6 +182,7 @@ class mod_facture_mercure extends ModeleNumRefFactures * @param Facture $objforref Object for number to search * @param string $mode 'next' for next value or 'last' for last value * @return string|0 Next free value, 0 if KO + * @deprecated see getNextValue */ public function getNumRef($objsoc, $objforref, $mode = 'next') { diff --git a/htdocs/core/modules/facture/mod_facture_terre.php b/htdocs/core/modules/facture/mod_facture_terre.php index bf116118024..07c6173a17b 100644 --- a/htdocs/core/modules/facture/mod_facture_terre.php +++ b/htdocs/core/modules/facture/mod_facture_terre.php @@ -287,6 +287,7 @@ class mod_facture_terre extends ModeleNumRefFactures * @param Facture $objforref Object for number to search * @param string $mode 'next' for next value or 'last' for last value * @return string|int<-1,0> Next free value, -1 or 0 if error + * @deprecated see getNextValue */ public function getNumRef($objsoc, $objforref, $mode = 'next') { diff --git a/htdocs/core/modules/fichinter/mod_arctic.php b/htdocs/core/modules/fichinter/mod_arctic.php index 54362d39bd4..e8f79c9c084 100644 --- a/htdocs/core/modules/fichinter/mod_arctic.php +++ b/htdocs/core/modules/fichinter/mod_arctic.php @@ -151,6 +151,7 @@ class mod_arctic extends ModeleNumRefFicheinter * @param Societe $objsoc Object third party * @param Fichinter $objforref Object for number to search * @return string|0 Next free value, 0 if KO + * @deprecated see getNextValue */ public function getNumRef($objsoc, $objforref) { diff --git a/htdocs/core/modules/fichinter/mod_pacific.php b/htdocs/core/modules/fichinter/mod_pacific.php index a1f90012125..2e7dfe34792 100644 --- a/htdocs/core/modules/fichinter/mod_pacific.php +++ b/htdocs/core/modules/fichinter/mod_pacific.php @@ -165,6 +165,7 @@ class mod_pacific extends ModeleNumRefFicheinter * @param Societe $objsoc Object third party * @param Fichinter $objforref Object for number to search * @return string Next free value + * @deprecated see getNextValue */ public function getNumRef($objsoc, $objforref) { diff --git a/htdocs/core/modules/propale/mod_propale_marbre.php b/htdocs/core/modules/propale/mod_propale_marbre.php index e38d8076604..c649f1139cb 100644 --- a/htdocs/core/modules/propale/mod_propale_marbre.php +++ b/htdocs/core/modules/propale/mod_propale_marbre.php @@ -170,6 +170,7 @@ class mod_propale_marbre extends ModeleNumRefPropales * @param Societe $objsoc Object third party * @param Propal $objforref Object for number to search * @return string|-1 Next free value, -1 if KO + * @deprecated see getNextValue */ public function getNumRef($objsoc, $objforref) { diff --git a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php index 95612da93f0..a3a4c321bf3 100644 --- a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php +++ b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php @@ -261,6 +261,7 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices * @param FactureFournisseur $objforref Object for number to search * @param string $mode 'next' for next value or 'last' for last value * @return string Next free value + * @deprecated see getNextValue */ public function getNumRef($objsoc, $objforref, $mode = 'next') { diff --git a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php index 39643722cf5..7fb38484e21 100644 --- a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php +++ b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php @@ -190,6 +190,7 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices * @param FactureFournisseur $objforref Object for number to search * @param string $mode 'next' for next value or 'last' for last value * @return string Next free value + * @deprecated see getNextValue */ public function getNumRef($objsoc, $objforref, $mode = 'next') { diff --git a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php index d1a638345d3..71949409f92 100644 --- a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php +++ b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php @@ -170,6 +170,7 @@ class mod_supplier_proposal_marbre extends ModeleNumRefSupplierProposal * @param Societe $objsoc Object third party * @param SupplierProposal $objforref Object for number to search * @return string Next free value + * @deprecated see getNextValue */ public function getNumRef($objsoc, $objforref) { diff --git a/htdocs/core/modules/takepos/mod_takepos_ref_simple.php b/htdocs/core/modules/takepos/mod_takepos_ref_simple.php index 616c43513dd..a4757350a57 100644 --- a/htdocs/core/modules/takepos/mod_takepos_ref_simple.php +++ b/htdocs/core/modules/takepos/mod_takepos_ref_simple.php @@ -211,6 +211,7 @@ class mod_takepos_ref_simple extends ModeleNumRefTakepos * @param Societe $objsoc Object third party * @param Facture $objforref Object for number to search * @return string Next free value + * @deprecated see getNextValue */ public function getNumRef($objsoc, $objforref) { diff --git a/htdocs/core/modules/takepos/mod_takepos_ref_universal.php b/htdocs/core/modules/takepos/mod_takepos_ref_universal.php index 1c06bfdd16a..8eb7c341643 100644 --- a/htdocs/core/modules/takepos/mod_takepos_ref_universal.php +++ b/htdocs/core/modules/takepos/mod_takepos_ref_universal.php @@ -154,6 +154,7 @@ class mod_takepos_ref_universal extends ModeleNumRefTakepos * @param Societe $objsoc Object third party * @param Facture $objforref Object for number to search * @return string Next free value + * @deprecated see getNextValue */ public function getNumRef($objsoc, $objforref) { diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index dc1f44735d7..5130c4ad2bd 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -2972,7 +2972,7 @@ class FactureFournisseur extends CommonInvoice $obj = new $classname(); $numref = ""; - $numref = $obj->getNumRef($soc, $this, $mode); + $numref = $obj->getNextValue($soc, $this, $mode); if ($numref != "") { return $numref; From aaf173a0d22266c8b7f0eebe10e0721c3a0b3357 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Mon, 11 Mar 2024 21:01:20 +0100 Subject: [PATCH 321/709] clean code and phpdoc --- htdocs/core/class/commonnumrefgenerator.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonnumrefgenerator.class.php b/htdocs/core/class/commonnumrefgenerator.class.php index c4edb202031..60104d09cd7 100644 --- a/htdocs/core/class/commonnumrefgenerator.class.php +++ b/htdocs/core/class/commonnumrefgenerator.class.php @@ -132,7 +132,7 @@ abstract class CommonNumRefGenerator * Checks if the numbers already in the database do not * cause conflicts that would prevent this numbering working. * - * @param Object $object Object we need next value for + * @param CommonObject $object Object we need next value for * @return boolean false if conflict, true if ok */ public function canBeActivated($object) From fbcfd89f88e2077cd322cf99d96a64e800d2ac0c Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 21:27:22 +0100 Subject: [PATCH 322/709] Fix PHPDoc date_start typo --- htdocs/accountancy/class/bookkeeping.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index f291093d063..3696c997737 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -2528,7 +2528,7 @@ class BookKeeping extends CommonObject * Get list of fiscal period * * @param string $filter Filter - * @return array|int Return integer <0 if KO, Fiscal periods : [[id, date_start, date_end, label], ...] + * @return array|int Return integer <0 if KO, Fiscal periods : [[id, date_start, date_end, label], ...] */ public function getFiscalPeriods($filter = '') { From cb35dabd8fe3aec02ac7f739481815a9763a3930 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 21:39:04 +0100 Subject: [PATCH 323/709] Qual: Document sendMail according to code --- htdocs/core/class/CMailFile.class.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index e782e83f662..1e1004a7959 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -7,6 +7,7 @@ * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2019-2023 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -274,7 +275,7 @@ class CMailFile // This converts an embed file with src="/viewimage.php?modulepart... into a cid link // TODO Exclude viewimage used for the read tracker ? $findimg = $this->findHtmlImages($dolibarr_main_data_root.'/medias'); - if ($findimg<0) { + if ($findimg < 0) { dol_syslog("CMailFile::CMailfile: Error on findHtmlImages"); $this->error = 'ErrorInAddAttachementsImageBaseOnMedia'; return; @@ -285,7 +286,7 @@ class CMailFile // Search into the body for error = 'ErrorInAddAttachementsImageBaseOnMedia'; return; @@ -388,7 +389,7 @@ class CMailFile $addr_cc = implode(',', $tabcc); //Verify for $addr_bcc - $replacebcc= false; + $replacebcc = false; $tabbcc = explode(',', $addr_bcc); foreach ($tabbcc as $key => $bcc) { if (in_array($bcc, $tabbcc)) { @@ -730,7 +731,7 @@ class CMailFile /** * Send mail that was prepared by constructor. * - * @return boolean True if mail sent, false otherwise + * @return negative-int|bool|string True if mail sent, false otherwise. Negative int if error in hook. String if incorrect send mode. */ public function sendfile() { From 6e5c4ef851475feb7a882955fefb66aa8f9e9227 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 21:43:50 +0100 Subject: [PATCH 324/709] Fix PHPDoc date_m typo --- htdocs/core/db/DoliDB.class.php | 2 +- htdocs/core/lib/files.lib.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index b839770410f..73470391fce 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -188,7 +188,7 @@ abstract class DoliDB implements Database dol_syslog("BEGIN Transaction".($textinlog ? ' '.$textinlog : ''), LOG_DEBUG); dol_syslog('', 0, 1); } - return $ret; + return (int) $ret; } else { $this->transaction_opened++; dol_syslog('', 0, 1); diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index d07f1960e15..8623989482c 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -256,7 +256,7 @@ function dol_dir_list($utf8_path, $types = "all", $recursive = 0, $filter = "", * @param string $sortcriteria Sort criteria ("","fullname","name","date","size") * @param int $sortorder Sort order (SORT_ASC, SORT_DESC) * @param int $mode 0=Return array minimum keys loaded (faster), 1=Force all keys like description - * @return array Array of array('name'=>'xxx','fullname'=>'/abc/xxx','date'=>'yyy','size'=>99,'type'=>'dir|file',...) + * @return array Array of array('name'=>'xxx','fullname'=>'/abc/xxx','date'=>'yyy','size'=>99,'type'=>'dir|file',...) * @see dol_dir_list() */ function dol_dir_list_in_database($path, $filter = "", $excludefilter = null, $sortcriteria = "name", $sortorder = SORT_ASC, $mode = 0) From 85efac2257914c3d5610776ebc655a0812e570de Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 21:47:38 +0100 Subject: [PATCH 325/709] Qual: Update PHPdoc to correspond to code --- htdocs/core/menus/standard/empty.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/menus/standard/empty.php b/htdocs/core/menus/standard/empty.php index 16809c89405..48e5edc719f 100644 --- a/htdocs/core/menus/standard/empty.php +++ b/htdocs/core/menus/standard/empty.php @@ -78,7 +78,7 @@ class MenuManager * * @param string $mode 'top', 'left', 'jmobile' * @param array $moredata An array with more data to output - * @return int 0 or nb of top menu entries if $mode = 'topnb' + * @return int|string 0 or nb of top menu entries if $mode = 'topnb', string inc ase of bad parameter */ public function showmenu($mode, $moredata = null) { From 4e20c644c227fdd94ae18719a1374dacae70a902 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 21:51:04 +0100 Subject: [PATCH 326/709] Qual: Correct PHPdoc typing --- htdocs/core/modules/barcode/modules_barcode.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/barcode/modules_barcode.class.php b/htdocs/core/modules/barcode/modules_barcode.class.php index f8026af15e1..1a2d056a17c 100644 --- a/htdocs/core/modules/barcode/modules_barcode.class.php +++ b/htdocs/core/modules/barcode/modules_barcode.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -54,7 +55,6 @@ abstract class ModeleBarCode */ abstract class ModeleNumRefBarCode extends CommonNumRefGenerator { - // variables inherited from CommonNumRefGenerator public $code_null; @@ -62,9 +62,9 @@ abstract class ModeleNumRefBarCode extends CommonNumRefGenerator /** * Return next value available * - * @param Product $objproduct Object Product - * @param string $type Type of barcode (EAN, ISBN, ...) - * @return string Value + * @param CommonObject $objproduct Object Product, Thirdparty + * @param string $type Type of barcode (EAN, ISBN, ...) + * @return string Value */ public function getNextValue($objproduct, $type = '') { From ad96de073a66b78a951942e523fd313ea67364d7 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 21:57:50 +0100 Subject: [PATCH 327/709] Fix: Correct type of field configuration values --- htdocs/ecm/class/ecmfiles.class.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/htdocs/ecm/class/ecmfiles.class.php b/htdocs/ecm/class/ecmfiles.class.php index 3aceab4db49..fcf77549177 100644 --- a/htdocs/ecm/class/ecmfiles.class.php +++ b/htdocs/ecm/class/ecmfiles.class.php @@ -157,26 +157,26 @@ class EcmFiles extends CommonObject public $section_id; public $fields = array( - 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'css' => 'left', 'comment' => "Id"), - 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => '1', 'position' => 20, 'notnull' => 1, 'visible' => -1, 'index' => 1, 'searchall' => 1, 'showoncombobox' => '1', 'validate' => '1', 'comment' => "contains hash from filename+filepath"), - 'label' => array('type' => 'varchar(128)', 'label' => 'Label', 'enabled' => '1', 'position' => 30, 'notnull' => 0, 'visible' => -1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'help' => "Help text", 'showoncombobox' => '2', 'validate' => '1', 'comment' => "contains hash of file content"), - 'share' => array('type' => 'varchar(128)', 'label' => 'Share', 'enabled' => '1', 'position' => 40, 'notnull' => 0, 'visible' => -1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'help' => "Help text", 'showoncombobox' => '2', 'validate' => '1', 'comment' => "contains hash for file sharing"), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), + 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => 1, 'position' => 20, 'notnull' => 1, 'visible' => -1, 'index' => 1, 'searchall' => 1, 'showoncombobox' => 1, 'validate' => 1, 'comment' => "contains hash from filename+filepath"), + 'label' => array('type' => 'varchar(128)', 'label' => 'Label', 'enabled' => 1, 'position' => 30, 'notnull' => 0, 'visible' => -1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'help' => "Help text", 'showoncombobox' => 2, 'validate' => 1, 'comment' => "contains hash of file content"), + 'share' => array('type' => 'varchar(128)', 'label' => 'Share', 'enabled' => 1, 'position' => 40, 'notnull' => 0, 'visible' => -1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'help' => "Help text", 'showoncombobox' => 2, 'validate' => 1, 'comment' => "contains hash for file sharing"), 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => -1, 'position' => 50, 'index' => 1), - 'filepath' => array('type' => 'varchar(255)', 'label' => 'FilePath', 'enabled' => '1', 'position' => 60, 'notnull' => 0, 'visible' => 0, 'searchall' => 0, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'help' => "Help text", 'showoncombobox' => '2', 'validate' => '1','comment' => "relative to dolibarr document dir. Example module/def"), - 'filename' => array('type' => 'varchar(255)', 'label' => 'FileName', 'enabled' => '1', 'position' => 70, 'notnull' => 0, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'help' => "Help text", 'showoncombobox' => '2', 'validate' => '1','comment' => "file name only without any directory"), - 'src_object_type' => array('type' => 'varchar(64)', 'label' => 'SourceType', 'enabled' => '1', 'position' => 80, 'notnull' => 0, 'visible' => 0, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'help' => "Help text", 'showoncombobox' => '2', 'validate' => '1','comment' => "Source object type ('proposal', 'invoice', ...)"), + 'filepath' => array('type' => 'varchar(255)', 'label' => 'FilePath', 'enabled' => 1, 'position' => 60, 'notnull' => 0, 'visible' => 0, 'searchall' => 0, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'help' => "Help text", 'showoncombobox' => 2, 'validate' => 1,'comment' => "relative to dolibarr document dir. Example module/def"), + 'filename' => array('type' => 'varchar(255)', 'label' => 'FileName', 'enabled' => 1, 'position' => 70, 'notnull' => 0, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'help' => "Help text", 'showoncombobox' => 2, 'validate' => 1,'comment' => "file name only without any directory"), + 'src_object_type' => array('type' => 'varchar(64)', 'label' => 'SourceType', 'enabled' => 1, 'position' => 80, 'notnull' => 0, 'visible' => 0, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'help' => "Help text", 'showoncombobox' => 2, 'validate' => 1,'comment' => "Source object type ('proposal', 'invoice', ...)"), 'src_object_id' => array('type' => 'integer', 'label' => 'SourceID', 'default' => 1, 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'position' => 90, 'index' => 1, 'comment' => "Source object id"), - 'fullpath_orig' => array('type' => 'varchar(750)', 'label' => 'FullPathOrig', 'enabled' => '1', 'position' => 100, 'notnull' => 0, 'visible' => 0, 'searchall' => 0, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'help' => "Help text", 'showoncombobox' => '2', 'validate' => '1','comment' => "full path of original filename, when file is uploaded from a local computer"), + 'fullpath_orig' => array('type' => 'varchar(750)', 'label' => 'FullPathOrig', 'enabled' => 1, 'position' => 100, 'notnull' => 0, 'visible' => 0, 'searchall' => 0, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'help' => "Help text", 'showoncombobox' => 2, 'validate' => 1,'comment' => "full path of original filename, when file is uploaded from a local computer"), 'description' => array('type' => 'text', 'label' => 'Description', 'enabled' => 1, 'visible' => 0, 'position' => 110), - 'keywords' => array('type' => 'varchar(750)', 'label' => 'Keywords', 'enabled' => '1', 'position' => 120, 'notnull' => 0, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'help' => "Help text", 'showoncombobox' => '2', 'validate' => '1','comment' => "list of keywords, separated with comma. Must be limited to most important keywords."), + 'keywords' => array('type' => 'varchar(750)', 'label' => 'Keywords', 'enabled' => 1, 'position' => 120, 'notnull' => 0, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'help' => "Help text", 'showoncombobox' => 2, 'validate' => 1,'comment' => "list of keywords, separated with comma. Must be limited to most important keywords."), 'cover' => array('type' => 'text', 'label' => 'Cover', 'enabled' => 1, 'visible' => 0, 'position' => 130, 'comment' => "is this file a file to use for a cover"), 'position' => array('type' => 'integer', 'label' => 'Position', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 140, 'index' => 1, 'comment' => "position of file among others"), - 'gen_or_uploaded' => array('type' => 'varchar(12)', 'label' => 'GenOrUpload', 'enabled' => '1', 'position' => 150, 'notnull' => 0, 'visible' => -1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'help' => "Help text", 'showoncombobox' => '2', 'validate' => '1','comment' => "'generated' or 'uploaded'"), - 'extraparams' => array('type' => 'varchar(255)', 'label' => 'ExtraParams', 'enabled' => '1', 'position' => 160, 'notnull' => 0, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'help' => "Help text", 'showoncombobox' => '2', 'validate' => '1', 'comment' => "for stocking other parameters with json format"), + 'gen_or_uploaded' => array('type' => 'varchar(12)', 'label' => 'GenOrUpload', 'enabled' => 1, 'position' => 150, 'notnull' => 0, 'visible' => -1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'help' => "Help text", 'showoncombobox' => 2, 'validate' => 1,'comment' => "'generated' or 'uploaded'"), + 'extraparams' => array('type' => 'varchar(255)', 'label' => 'ExtraParams', 'enabled' => 1, 'position' => 160, 'notnull' => 0, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'help' => "Help text", 'showoncombobox' => 2, 'validate' => 1, 'comment' => "for stocking other parameters with json format"), 'date_c' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'visible' => -1, 'position' => 170), 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 175), - 'fk_user_c' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => '1', 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), - 'fk_user_m' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => '1', 'position' => 511, 'notnull' => -1, 'visible' => -2,), + 'fk_user_c' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => 1, 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), + 'fk_user_m' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => 1, 'position' => 511, 'notnull' => -1, 'visible' => -2,), 'note_public' => array('type' => 'text', 'label' => 'NotePublic', 'enabled' => 1, 'visible' => 0, 'position' => 155), 'note_private' => array('type' => 'text', 'label' => 'NotePrivate', 'enabled' => 1, 'visible' => 0, 'position' => 160), 'acl' => array('type' => 'text', 'label' => 'NotePrivate', 'enabled' => 1, 'visible' => 0, 'position' => 160, 'comment' => "for future permission 'per file'"), From a300206c28e264f0d572bbe4a9d624ebc1422550 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Mon, 11 Mar 2024 21:59:48 +0100 Subject: [PATCH 328/709] clean code and phpdoc --- htdocs/core/modules/facture/mod_facture_mercure.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/facture/mod_facture_mercure.php b/htdocs/core/modules/facture/mod_facture_mercure.php index 1043808be3a..123ced406da 100644 --- a/htdocs/core/modules/facture/mod_facture_mercure.php +++ b/htdocs/core/modules/facture/mod_facture_mercure.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2007 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) - * Copyright (C) 2013 uanjo Menent + * Copyright (C) 2013 Juanjo Menent * Copyright (C) 2022 Anthony Berton * Copyright (C) 2024 Frédéric France * From 7a2045b646434aacb08e5b05e4b3524e68cb4b10 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 22:02:08 +0100 Subject: [PATCH 329/709] Fix PHPdoc for childtables --- .../class/emailcollector.class.php | 93 ++++++++++--------- 1 file changed, 47 insertions(+), 46 deletions(-) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index bffa405796e..b8323b5d1d2 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -88,7 +89,7 @@ class EmailCollector extends CommonObject public $fk_element = 'fk_emailcollector'; /** - * @var array List of child tables. To test if we can delete object. + * @var array> List of child tables. To test if we can delete object. */ protected $childtables = array(); @@ -122,37 +123,37 @@ class EmailCollector extends CommonObject * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>2, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1), - 'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20), - 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'help'=>'Example: MyCollector1', 'csslist'=>'tdoverflowmax200'), - 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>-1, 'searchall'=>1, 'help'=>'Example: My Email collector', 'csslist'=>'tdoverflowmax150'), - 'description' => array('type'=>'text', 'label'=>'Description', 'visible'=>-1, 'enabled'=>1, 'position'=>60, 'notnull'=>-1, 'cssview'=>'small', 'csslist'=>'small tdoverflowmax200'), - 'host' => array('type'=>'varchar(255)', 'label'=>'EMailHost', 'visible'=>1, 'enabled'=>1, 'position'=>90, 'notnull'=>1, 'searchall'=>1, 'comment'=>"IMAP server", 'help'=>'Example: imap.gmail.com', 'csslist'=>'tdoverflowmax125'), - 'port' => array('type'=>'varchar(10)', 'label'=>'EMailHostPort', 'visible'=>1, 'enabled'=>1, 'position'=>91, 'notnull'=>1, 'searchall'=>0, 'comment'=>"IMAP server port", 'help'=>'Example: 993', 'csslist'=>'tdoverflowmax50', 'default'=>'993'), - 'hostcharset' => array('type'=>'varchar(16)', 'label'=>'HostCharset', 'visible'=>-1, 'enabled'=>1, 'position'=>92, 'notnull'=>0, 'searchall'=>0, 'comment'=>"IMAP server charset", 'help'=>'Example: "UTF-8" (May be "US-ASCII" with some Office365)', 'default'=>'UTF-8'), - 'imap_encryption' => array('type'=>'varchar(16)', 'label'=>'ImapEncryption', 'visible'=>-1, 'enabled'=>1, 'position'=>93, 'searchall'=>0, 'comment'=>"IMAP encryption", 'help'=>'ImapEncryptionHelp', 'arrayofkeyval'=> array('ssl'=>'SSL', 'tls' => 'TLS', 'notls' => 'NOTLS'), 'default'=>'ssl'), - 'norsh' => array('type'=>'integer', 'label'=>'NoRSH', 'visible'=>-1, 'enabled'=>"!getDolGlobalInt('MAIN_IMAP_USE_PHPIMAP')", 'position'=>94, 'searchall'=>0, 'help'=>'NoRSHHelp', 'arrayofkeyval'=> array(0 =>'No', 1 => 'Yes'), 'default'=> 0), - 'acces_type' => array('type'=>'integer', 'label'=>'accessType', 'visible'=>-1, 'enabled'=>"getDolGlobalInt('MAIN_IMAP_USE_PHPIMAP')", 'position'=>101, 'notnull'=>1, 'index'=>1, 'comment'=>"IMAP login type", 'arrayofkeyval'=>array('0'=>'loginPassword', '1'=>'oauthToken'), 'default'=>'0', 'help'=>''), - 'login' => array('type'=>'varchar(128)', 'label'=>'Login', 'visible'=>-1, 'enabled'=>1, 'position'=>102, 'notnull'=>-1, 'index'=>1, 'comment'=>"IMAP login", 'help'=>'Example: myaccount@gmail.com'), - 'password' => array('type'=>'password', 'label'=>'Password', 'visible'=>-1, 'enabled'=>"1", 'position'=>103, 'notnull'=>-1, 'comment'=>"IMAP password", 'help'=>'WithGMailYouCanCreateADedicatedPassword'), - 'oauth_service' => array('type'=>'varchar(128)', 'label'=>'oauthService', 'visible'=>-1, 'enabled'=>"getDolGlobalInt('MAIN_IMAP_USE_PHPIMAP')", 'position'=>104, 'notnull'=>0, 'index'=>1, 'comment'=>"IMAP login oauthService", 'arrayofkeyval'=>array(), 'help'=>'TokenMustHaveBeenCreated'), - 'source_directory' => array('type'=>'varchar(255)', 'label'=>'MailboxSourceDirectory', 'visible'=>-1, 'enabled'=>1, 'position'=>109, 'notnull'=>1, 'default' => 'Inbox', 'help'=>'Example: INBOX, [Gmail]/Spam, [Gmail]/Draft, [Gmail]/Brouillons, [Gmail]/Sent Mail, [Gmail]/Messages envoyés, ...'), - 'target_directory' => array('type'=>'varchar(255)', 'label'=>'MailboxTargetDirectory', 'visible'=>1, 'enabled'=>1, 'position'=>110, 'notnull'=>0, 'help'=>"EmailCollectorTargetDir"), - 'maxemailpercollect' => array('type'=>'integer', 'label'=>'MaxEmailCollectPerCollect', 'visible'=>-1, 'enabled'=>1, 'position'=>111, 'default'=>50), - 'datelastresult' => array('type'=>'datetime', 'label'=>'DateLastCollectResult', 'visible'=>1, 'enabled'=>'$action != "create" && $action != "edit"', 'position'=>121, 'notnull'=>-1, 'csslist'=>'nowraponall'), - 'codelastresult' => array('type'=>'varchar(16)', 'label'=>'CodeLastResult', 'visible'=>1, 'enabled'=>'$action != "create" && $action != "edit"', 'position'=>122, 'notnull'=>-1,), - 'lastresult' => array('type'=>'varchar(255)', 'label'=>'LastResult', 'visible'=>1, 'enabled'=>'$action != "create" && $action != "edit"', 'position'=>123, 'notnull'=>-1, 'cssview'=>'small', 'csslist'=>'small tdoverflowmax200'), - 'datelastok' => array('type'=>'datetime', 'label'=>'DateLastcollectResultOk', 'visible'=>1, 'enabled'=>'$action != "create"', 'position'=>125, 'notnull'=>-1, 'csslist'=>'nowraponall'), - 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'visible'=>0, 'enabled'=>1, 'position'=>61, 'notnull'=>-1,), - 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'visible'=>0, 'enabled'=>1, 'position'=>62, 'notnull'=>-1,), - 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>-2, 'enabled'=>1, 'position'=>500, 'notnull'=>1,), - 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-2, 'enabled'=>1, 'position'=>501, 'notnull'=>1,), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'visible' => 2, 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'index' => 1), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'enabled' => 1, 'visible' => 0, 'default' => 1, 'notnull' => 1, 'index' => 1, 'position' => 20), + 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'showoncombobox' => 1, 'index' => 1, 'position' => 10, 'searchall' => 1, 'help' => 'Example: MyCollector1', 'csslist' => 'tdoverflowmax200'), + 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'visible' => 1, 'enabled' => 1, 'position' => 30, 'notnull' => -1, 'searchall' => 1, 'help' => 'Example: My Email collector', 'csslist' => 'tdoverflowmax150'), + 'description' => array('type' => 'text', 'label' => 'Description', 'visible' => -1, 'enabled' => 1, 'position' => 60, 'notnull' => -1, 'cssview' => 'small', 'csslist' => 'small tdoverflowmax200'), + 'host' => array('type' => 'varchar(255)', 'label' => 'EMailHost', 'visible' => 1, 'enabled' => 1, 'position' => 90, 'notnull' => 1, 'searchall' => 1, 'comment' => "IMAP server", 'help' => 'Example: imap.gmail.com', 'csslist' => 'tdoverflowmax125'), + 'port' => array('type' => 'varchar(10)', 'label' => 'EMailHostPort', 'visible' => 1, 'enabled' => 1, 'position' => 91, 'notnull' => 1, 'searchall' => 0, 'comment' => "IMAP server port", 'help' => 'Example: 993', 'csslist' => 'tdoverflowmax50', 'default' => '993'), + 'hostcharset' => array('type' => 'varchar(16)', 'label' => 'HostCharset', 'visible' => -1, 'enabled' => 1, 'position' => 92, 'notnull' => 0, 'searchall' => 0, 'comment' => "IMAP server charset", 'help' => 'Example: "UTF-8" (May be "US-ASCII" with some Office365)', 'default' => 'UTF-8'), + 'imap_encryption' => array('type' => 'varchar(16)', 'label' => 'ImapEncryption', 'visible' => -1, 'enabled' => 1, 'position' => 93, 'searchall' => 0, 'comment' => "IMAP encryption", 'help' => 'ImapEncryptionHelp', 'arrayofkeyval' => array('ssl' => 'SSL', 'tls' => 'TLS', 'notls' => 'NOTLS'), 'default' => 'ssl'), + 'norsh' => array('type' => 'integer', 'label' => 'NoRSH', 'visible' => -1, 'enabled' => "!getDolGlobalInt('MAIN_IMAP_USE_PHPIMAP')", 'position' => 94, 'searchall' => 0, 'help' => 'NoRSHHelp', 'arrayofkeyval' => array(0 => 'No', 1 => 'Yes'), 'default' => 0), + 'acces_type' => array('type' => 'integer', 'label' => 'accessType', 'visible' => -1, 'enabled' => "getDolGlobalInt('MAIN_IMAP_USE_PHPIMAP')", 'position' => 101, 'notnull' => 1, 'index' => 1, 'comment' => "IMAP login type", 'arrayofkeyval' => array('0' => 'loginPassword', '1' => 'oauthToken'), 'default' => '0', 'help' => ''), + 'login' => array('type' => 'varchar(128)', 'label' => 'Login', 'visible' => -1, 'enabled' => 1, 'position' => 102, 'notnull' => -1, 'index' => 1, 'comment' => "IMAP login", 'help' => 'Example: myaccount@gmail.com'), + 'password' => array('type' => 'password', 'label' => 'Password', 'visible' => -1, 'enabled' => "1", 'position' => 103, 'notnull' => -1, 'comment' => "IMAP password", 'help' => 'WithGMailYouCanCreateADedicatedPassword'), + 'oauth_service' => array('type' => 'varchar(128)', 'label' => 'oauthService', 'visible' => -1, 'enabled' => "getDolGlobalInt('MAIN_IMAP_USE_PHPIMAP')", 'position' => 104, 'notnull' => 0, 'index' => 1, 'comment' => "IMAP login oauthService", 'arrayofkeyval' => array(), 'help' => 'TokenMustHaveBeenCreated'), + 'source_directory' => array('type' => 'varchar(255)', 'label' => 'MailboxSourceDirectory', 'visible' => -1, 'enabled' => 1, 'position' => 109, 'notnull' => 1, 'default' => 'Inbox', 'help' => 'Example: INBOX, [Gmail]/Spam, [Gmail]/Draft, [Gmail]/Brouillons, [Gmail]/Sent Mail, [Gmail]/Messages envoyés, ...'), + 'target_directory' => array('type' => 'varchar(255)', 'label' => 'MailboxTargetDirectory', 'visible' => 1, 'enabled' => 1, 'position' => 110, 'notnull' => 0, 'help' => "EmailCollectorTargetDir"), + 'maxemailpercollect' => array('type' => 'integer', 'label' => 'MaxEmailCollectPerCollect', 'visible' => -1, 'enabled' => 1, 'position' => 111, 'default' => 50), + 'datelastresult' => array('type' => 'datetime', 'label' => 'DateLastCollectResult', 'visible' => 1, 'enabled' => '$action != "create" && $action != "edit"', 'position' => 121, 'notnull' => -1, 'csslist' => 'nowraponall'), + 'codelastresult' => array('type' => 'varchar(16)', 'label' => 'CodeLastResult', 'visible' => 1, 'enabled' => '$action != "create" && $action != "edit"', 'position' => 122, 'notnull' => -1,), + 'lastresult' => array('type' => 'varchar(255)', 'label' => 'LastResult', 'visible' => 1, 'enabled' => '$action != "create" && $action != "edit"', 'position' => 123, 'notnull' => -1, 'cssview' => 'small', 'csslist' => 'small tdoverflowmax200'), + 'datelastok' => array('type' => 'datetime', 'label' => 'DateLastcollectResultOk', 'visible' => 1, 'enabled' => '$action != "create"', 'position' => 125, 'notnull' => -1, 'csslist' => 'nowraponall'), + 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'visible' => 0, 'enabled' => 1, 'position' => 61, 'notnull' => -1,), + 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'visible' => 0, 'enabled' => 1, 'position' => 62, 'notnull' => -1,), + 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'visible' => -2, 'enabled' => 1, 'position' => 500, 'notnull' => 1,), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'visible' => -2, 'enabled' => 1, 'position' => 501, 'notnull' => 1,), //'date_validation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>502), - 'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'visible'=>-2, 'enabled'=>1, 'position'=>510, 'notnull'=>1,), - 'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'visible'=>-2, 'enabled'=>1, 'position'=>511, 'notnull'=>-1,), + 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'visible' => -2, 'enabled' => 1, 'position' => 510, 'notnull' => 1,), + 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'visible' => -2, 'enabled' => 1, 'position' => 511, 'notnull' => -1,), //'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512), - 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'visible'=>-2, 'enabled'=>1, 'position'=>1000, 'notnull'=>-1,), - 'status' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>1000, 'notnull'=>1, 'default'=>'0', 'index'=>1, 'arrayofkeyval'=>array('0'=>'Inactive', '1'=>'Active')) + 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'visible' => -2, 'enabled' => 1, 'position' => 1000, 'notnull' => -1,), + 'status' => array('type' => 'integer', 'label' => 'Status', 'visible' => 1, 'enabled' => 1, 'position' => 1000, 'notnull' => 1, 'default' => '0', 'index' => 1, 'arrayofkeyval' => array('0' => 'Inactive', '1' => 'Active')) ); @@ -614,7 +615,7 @@ class EmailCollector extends CommonObject //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); $hookmanager->initHooks(array('emailcollectordao')); - $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $parameters = array('id' => $this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; @@ -730,7 +731,7 @@ class EmailCollector extends CommonObject $i = 0; while ($i < $num) { $obj = $this->db->fetch_object($resql); - $this->filters[$obj->rowid] = array('id'=>$obj->rowid, 'type'=>$obj->type, 'rulevalue'=>$obj->rulevalue, 'status'=>$obj->status); + $this->filters[$obj->rowid] = array('id' => $obj->rowid, 'type' => $obj->type, 'rulevalue' => $obj->rulevalue, 'status' => $obj->status); $i++; } $this->db->free($resql); @@ -762,7 +763,7 @@ class EmailCollector extends CommonObject $i = 0; while ($i < $num) { $obj = $this->db->fetch_object($resql); - $this->actions[$obj->rowid] = array('id'=>$obj->rowid, 'type'=>$obj->type, 'actionparam'=>$obj->actionparam, 'status'=>$obj->status); + $this->actions[$obj->rowid] = array('id' => $obj->rowid, 'type' => $obj->type, 'actionparam' => $obj->actionparam, 'status' => $obj->status); $i++; } $this->db->free($resql); @@ -1673,8 +1674,8 @@ class EmailCollector extends CommonObject } else { $operationslog .= " - ".dol_escape_htmltag((string) $imapemail); } - $operationslog .= " - References: ".dol_escape_htmltag($headers['References']??'')." - Subject: ".dol_escape_htmltag($headers['Subject']); - dol_syslog("** Process email ".$iforemailloop." References: ".($headers['References']??'')." Subject: ".$headers['Subject']); + $operationslog .= " - References: ".dol_escape_htmltag($headers['References'] ?? '')." - Subject: ".dol_escape_htmltag($headers['Subject']); + dol_syslog("** Process email ".$iforemailloop." References: ".($headers['References'] ?? '')." Subject: ".$headers['Subject']); $trackidfoundintorecipienttype = ''; @@ -2678,7 +2679,7 @@ class EmailCollector extends CommonObject } if (!empty($attachments)) { // There is an attachment for the ticket -> store attachment - $ticket = New Ticket($this->db); + $ticket = new Ticket($this->db); $ticket->fetch($fk_element_id); $destdir = $conf->ticket->dir_output.'/'.$ticket->ref; if (!dol_is_dir($destdir)) { @@ -3248,23 +3249,23 @@ class EmailCollector extends CommonObject } $parameters = array( - 'connection'=> $connection, - 'imapemail'=>$imapemail, - 'overview'=>$overview, + 'connection' => $connection, + 'imapemail' => $imapemail, + 'overview' => $overview, 'from' => $from, 'fromtext' => $fromtext, - 'actionparam'=> $operation['actionparam'], + 'actionparam' => $operation['actionparam'], 'thirdpartyid' => $thirdpartyid, - 'objectid'=> $objectid, - 'objectemail'=> $objectemail, + 'objectid' => $objectid, + 'objectemail' => $objectemail, - 'messagetext'=>$messagetext, - 'subject'=>$subject, - 'header'=>$header, - 'attachments'=>$attachments, + 'messagetext' => $messagetext, + 'subject' => $subject, + 'header' => $header, + 'attachments' => $attachments, ); $reshook = $hookmanager->executeHooks('doCollectImapOneCollector', $parameters, $this, $operation['type']); From fb730e2c5b7498d6f746eca88a1047972929bbea Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 22:05:24 +0100 Subject: [PATCH 330/709] Qual: set default value to match PHPdoc type --- .../class/expensereport.class.php | 103 +++++++++--------- 1 file changed, 52 insertions(+), 51 deletions(-) diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 38d86dc15c7..a62d4dc04f2 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -5,6 +5,7 @@ * Copyright (C) 2018 Nicolas ZABOURI * Copyright (c) 2018-2024 Frédéric France * Copyright (C) 2016-2020 Ferran Marcet + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -230,49 +231,49 @@ class ExpenseReport extends CommonObject const STATUS_REFUSED = 99; public $fields = array( - 'rowid' =>array('type'=>'integer', 'label'=>'ID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), - 'ref' =>array('type'=>'varchar(50)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>15), - 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>20), - 'ref_number_int' =>array('type'=>'integer', 'label'=>'Ref number int', 'enabled'=>1, 'visible'=>-1, 'position'=>25), - 'ref_ext' =>array('type'=>'integer', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>-1, 'position'=>30), - 'total_ht' =>array('type'=>'double(24,8)', 'label'=>'Total ht', 'enabled'=>1, 'visible'=>-1, 'position'=>35), - 'total_tva' =>array('type'=>'double(24,8)', 'label'=>'Total tva', 'enabled'=>1, 'visible'=>-1, 'position'=>40), - 'localtax1' =>array('type'=>'double(24,8)', 'label'=>'Localtax1', 'enabled'=>1, 'visible'=>-1, 'position'=>45), - 'localtax2' =>array('type'=>'double(24,8)', 'label'=>'Localtax2', 'enabled'=>1, 'visible'=>-1, 'position'=>50), - 'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'Total ttc', 'enabled'=>1, 'visible'=>-1, 'position'=>55), - 'date_debut' =>array('type'=>'date', 'label'=>'Date debut', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>60), - 'date_fin' =>array('type'=>'date', 'label'=>'Date fin', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>65), - 'date_valid' =>array('type'=>'datetime', 'label'=>'Date valid', 'enabled'=>1, 'visible'=>-1, 'position'=>75), - 'date_approve' =>array('type'=>'datetime', 'label'=>'Date approve', 'enabled'=>1, 'visible'=>-1, 'position'=>80), - 'date_refuse' =>array('type'=>'datetime', 'label'=>'Date refuse', 'enabled'=>1, 'visible'=>-1, 'position'=>85), - 'date_cancel' =>array('type'=>'datetime', 'label'=>'Date cancel', 'enabled'=>1, 'visible'=>-1, 'position'=>90), - 'fk_user_author' =>array('type'=>'integer', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>100), - 'fk_user_modif' =>array('type'=>'integer', 'label'=>'Fk user modif', 'enabled'=>1, 'visible'=>-1, 'position'=>105), - 'fk_user_valid' =>array('type'=>'integer', 'label'=>'Fk user valid', 'enabled'=>1, 'visible'=>-1, 'position'=>110), - 'fk_user_validator' =>array('type'=>'integer', 'label'=>'Fk user validator', 'enabled'=>1, 'visible'=>-1, 'position'=>115), - 'fk_user_approve' =>array('type'=>'integer', 'label'=>'Fk user approve', 'enabled'=>1, 'visible'=>-1, 'position'=>120), - 'fk_user_refuse' =>array('type'=>'integer', 'label'=>'Fk user refuse', 'enabled'=>1, 'visible'=>-1, 'position'=>125), - 'fk_user_cancel' =>array('type'=>'integer', 'label'=>'Fk user cancel', 'enabled'=>1, 'visible'=>-1, 'position'=>130), - 'fk_c_paiement' =>array('type'=>'integer', 'label'=>'Fk c paiement', 'enabled'=>1, 'visible'=>-1, 'position'=>140), - 'paid' =>array('type'=>'integer', 'label'=>'Paid', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>145), - 'note_public' =>array('type'=>'html', 'label'=>'Note public', 'enabled'=>1, 'visible'=>0, 'position'=>150), - 'note_private' =>array('type'=>'html', 'label'=>'Note private', 'enabled'=>1, 'visible'=>0, 'position'=>155), - 'detail_refuse' =>array('type'=>'varchar(255)', 'label'=>'Detail refuse', 'enabled'=>1, 'visible'=>-1, 'position'=>160), - 'detail_cancel' =>array('type'=>'varchar(255)', 'label'=>'Detail cancel', 'enabled'=>1, 'visible'=>-1, 'position'=>165), - 'integration_compta' =>array('type'=>'integer', 'label'=>'Integration compta', 'enabled'=>1, 'visible'=>-1, 'position'=>170), - 'fk_bank_account' =>array('type'=>'integer', 'label'=>'Fk bank account', 'enabled'=>1, 'visible'=>-1, 'position'=>175), - 'fk_multicurrency' =>array('type'=>'integer', 'label'=>'Fk multicurrency', 'enabled'=>1, 'visible'=>-1, 'position'=>185), - 'multicurrency_code' =>array('type'=>'varchar(255)', 'label'=>'Multicurrency code', 'enabled'=>1, 'visible'=>-1, 'position'=>190), - 'multicurrency_tx' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency tx', 'enabled'=>1, 'visible'=>-1, 'position'=>195), - 'multicurrency_total_ht' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency total ht', 'enabled'=>1, 'visible'=>-1, 'position'=>200), - 'multicurrency_total_tva' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency total tva', 'enabled'=>1, 'visible'=>-1, 'position'=>205), - 'multicurrency_total_ttc' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency total ttc', 'enabled'=>1, 'visible'=>-1, 'position'=>210), - 'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>220), - 'date_create' =>array('type'=>'datetime', 'label'=>'Date create', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>300), - 'tms' =>array('type'=>'timestamp', 'label'=>'Tms', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>305), - 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-1, 'position'=>1000), - 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>1010), - 'fk_statut' =>array('type'=>'integer', 'label'=>'Fk statut', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500), + 'rowid' => array('type' => 'integer', 'label' => 'ID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), + 'ref' => array('type' => 'varchar(50)', 'label' => 'Ref', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'showoncombobox' => 1, 'position' => 15), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => '1', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 20), + 'ref_number_int' => array('type' => 'integer', 'label' => 'Ref number int', 'enabled' => 1, 'visible' => -1, 'position' => 25), + 'ref_ext' => array('type' => 'integer', 'label' => 'Ref ext', 'enabled' => 1, 'visible' => -1, 'position' => 30), + 'total_ht' => array('type' => 'double(24,8)', 'label' => 'Total ht', 'enabled' => 1, 'visible' => -1, 'position' => 35), + 'total_tva' => array('type' => 'double(24,8)', 'label' => 'Total tva', 'enabled' => 1, 'visible' => -1, 'position' => 40), + 'localtax1' => array('type' => 'double(24,8)', 'label' => 'Localtax1', 'enabled' => 1, 'visible' => -1, 'position' => 45), + 'localtax2' => array('type' => 'double(24,8)', 'label' => 'Localtax2', 'enabled' => 1, 'visible' => -1, 'position' => 50), + 'total_ttc' => array('type' => 'double(24,8)', 'label' => 'Total ttc', 'enabled' => 1, 'visible' => -1, 'position' => 55), + 'date_debut' => array('type' => 'date', 'label' => 'Date debut', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 60), + 'date_fin' => array('type' => 'date', 'label' => 'Date fin', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 65), + 'date_valid' => array('type' => 'datetime', 'label' => 'Date valid', 'enabled' => 1, 'visible' => -1, 'position' => 75), + 'date_approve' => array('type' => 'datetime', 'label' => 'Date approve', 'enabled' => 1, 'visible' => -1, 'position' => 80), + 'date_refuse' => array('type' => 'datetime', 'label' => 'Date refuse', 'enabled' => 1, 'visible' => -1, 'position' => 85), + 'date_cancel' => array('type' => 'datetime', 'label' => 'Date cancel', 'enabled' => 1, 'visible' => -1, 'position' => 90), + 'fk_user_author' => array('type' => 'integer', 'label' => 'Fk user author', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 100), + 'fk_user_modif' => array('type' => 'integer', 'label' => 'Fk user modif', 'enabled' => 1, 'visible' => -1, 'position' => 105), + 'fk_user_valid' => array('type' => 'integer', 'label' => 'Fk user valid', 'enabled' => 1, 'visible' => -1, 'position' => 110), + 'fk_user_validator' => array('type' => 'integer', 'label' => 'Fk user validator', 'enabled' => 1, 'visible' => -1, 'position' => 115), + 'fk_user_approve' => array('type' => 'integer', 'label' => 'Fk user approve', 'enabled' => 1, 'visible' => -1, 'position' => 120), + 'fk_user_refuse' => array('type' => 'integer', 'label' => 'Fk user refuse', 'enabled' => 1, 'visible' => -1, 'position' => 125), + 'fk_user_cancel' => array('type' => 'integer', 'label' => 'Fk user cancel', 'enabled' => 1, 'visible' => -1, 'position' => 130), + 'fk_c_paiement' => array('type' => 'integer', 'label' => 'Fk c paiement', 'enabled' => 1, 'visible' => -1, 'position' => 140), + 'paid' => array('type' => 'integer', 'label' => 'Paid', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 145), + 'note_public' => array('type' => 'html', 'label' => 'Note public', 'enabled' => 1, 'visible' => 0, 'position' => 150), + 'note_private' => array('type' => 'html', 'label' => 'Note private', 'enabled' => 1, 'visible' => 0, 'position' => 155), + 'detail_refuse' => array('type' => 'varchar(255)', 'label' => 'Detail refuse', 'enabled' => 1, 'visible' => -1, 'position' => 160), + 'detail_cancel' => array('type' => 'varchar(255)', 'label' => 'Detail cancel', 'enabled' => 1, 'visible' => -1, 'position' => 165), + 'integration_compta' => array('type' => 'integer', 'label' => 'Integration compta', 'enabled' => 1, 'visible' => -1, 'position' => 170), + 'fk_bank_account' => array('type' => 'integer', 'label' => 'Fk bank account', 'enabled' => 1, 'visible' => -1, 'position' => 175), + 'fk_multicurrency' => array('type' => 'integer', 'label' => 'Fk multicurrency', 'enabled' => 1, 'visible' => -1, 'position' => 185), + 'multicurrency_code' => array('type' => 'varchar(255)', 'label' => 'Multicurrency code', 'enabled' => 1, 'visible' => -1, 'position' => 190), + 'multicurrency_tx' => array('type' => 'double(24,8)', 'label' => 'Multicurrency tx', 'enabled' => 1, 'visible' => -1, 'position' => 195), + 'multicurrency_total_ht' => array('type' => 'double(24,8)', 'label' => 'Multicurrency total ht', 'enabled' => 1, 'visible' => -1, 'position' => 200), + 'multicurrency_total_tva' => array('type' => 'double(24,8)', 'label' => 'Multicurrency total tva', 'enabled' => 1, 'visible' => -1, 'position' => 205), + 'multicurrency_total_ttc' => array('type' => 'double(24,8)', 'label' => 'Multicurrency total ttc', 'enabled' => 1, 'visible' => -1, 'position' => 210), + 'extraparams' => array('type' => 'varchar(255)', 'label' => 'Extraparams', 'enabled' => 1, 'visible' => -1, 'position' => 220), + 'date_create' => array('type' => 'datetime', 'label' => 'Date create', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 300), + 'tms' => array('type' => 'timestamp', 'label' => 'Tms', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 305), + 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -1, 'position' => 1000), + 'model_pdf' => array('type' => 'varchar(255)', 'label' => 'Model pdf', 'enabled' => 1, 'visible' => 0, 'position' => 1010), + 'fk_statut' => array('type' => 'integer', 'label' => 'Fk statut', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 500), ); /** @@ -521,7 +522,7 @@ class ExpenseReport extends CommonObject if (!$error) { // Hook of thirdparty module if (is_object($hookmanager)) { - $parameters = array('objFrom'=>$objFrom); + $parameters = array('objFrom' => $objFrom); $action = ''; $reshook = $hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { @@ -1820,7 +1821,7 @@ class ExpenseReport extends CommonObject global $action; $hookmanager->initHooks(array($this->element . 'dao')); - $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $parameters = array('id' => $this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; @@ -2294,7 +2295,7 @@ class ExpenseReport extends CommonObject */ public function deleteLine($rowid, $fuser = '', $notrigger = 0) { - $error=0; + $error = 0; $this->db->begin(); @@ -2721,10 +2722,10 @@ class ExpenseReport extends CommonObject $sql = " SELECT count(n.qty) as cumul FROM ".MAIN_DB_PREFIX."expensereport_det n"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."expensereport e ON e.rowid = n.fk_expensereport"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_fees tf ON tf.id = n.fk_c_type_fees"; - $sql.= " WHERE e.fk_user_author = ".(int) $this->fk_user_author; - $sql.= " AND YEAR(n.date) = ".(int) $arrayDate['year']; - $sql.= " AND tf.code = 'EX_KME' "; - $sql.= " AND e.fk_statut = ".(int) ExpenseReport::STATUS_VALIDATED; + $sql .= " WHERE e.fk_user_author = ".(int) $this->fk_user_author; + $sql .= " AND YEAR(n.date) = ".(int) $arrayDate['year']; + $sql .= " AND tf.code = 'EX_KME' "; + $sql .= " AND e.fk_statut = ".(int) ExpenseReport::STATUS_VALIDATED; $resql = $this->db->query($sql); @@ -2748,7 +2749,7 @@ class ExpenseReport extends CommonObject for ($i = 0; $i < $num; $i++) { if ($i < ($num - 1)) { - if ($qty > $ranges[$i]->range_ik && $qty < $ranges[$i+1]->range_ik) { + if ($qty > $ranges[$i]->range_ik && $qty < $ranges[$i + 1]->range_ik) { $coef = $ranges[$i]->coef; $offset = $ranges[$i]->ikoffset; } From 1ea9a7fa4858f50c60d84c834b981a9645591716 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 22:10:04 +0100 Subject: [PATCH 331/709] Qual: set default value to match PHPdoc type --- htdocs/fourn/class/fournisseur.commande.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 407d1c7e0a9..a1be6fa35f8 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -14,6 +14,7 @@ * Copyright (C) 2021 Josep Lluís Amador * Copyright (C) 2022 Gauthier VERDOL * Copyright (C) 2024 Solution Libre SAS + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -396,7 +397,7 @@ class CommandeFournisseur extends CommonOrder 'multicurrency_total_ttc' => array('type' => 'double(24,8)', 'label' => 'MulticurrencyAmountTTC', 'enabled' => 'isModEnabled("multicurrency")', 'visible' => -1, 'position' => 240), 'date_creation' => array('type' => 'datetime', 'label' => 'Date creation', 'enabled' => 1, 'visible' => -1, 'position' => 500), 'fk_soc' => array('type' => 'integer:Societe:societe/class/societe.class.php', 'label' => 'ThirdParty', 'enabled' => 'isModEnabled("societe")', 'visible' => 1, 'notnull' => 1, 'position' => 50), - 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'position' => 1000, 'index' => 1), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => '1', 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'position' => 1000, 'index' => 1), 'tms' => array('type' => 'datetime', 'label' => "DateModificationShort", 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 501), 'last_main_doc' => array('type' => 'varchar(255)', 'label' => 'LastMainDoc', 'enabled' => 1, 'visible' => 0, 'position' => 700), 'fk_statut' => array('type' => 'smallint(6)', 'label' => 'Status', 'enabled' => 1, 'visible' => 1, 'position' => 701), From 7a7d342aaadb7fd7421c31416bcbfccb42d87da5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Mon, 11 Mar 2024 22:14:39 +0100 Subject: [PATCH 332/709] clean code and phpdoc --- dev/tools/phan/config.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php index 0bb240128f8..ae33dadbb32 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 Frédéric France */ define('DOL_PROJECT_ROOT', __DIR__.'/../../..'); define('DOL_DOCUMENT_ROOT', DOL_PROJECT_ROOT.'/htdocs'); @@ -535,7 +536,7 @@ return [ // 'PhanTypeInvalidThrowsIsInterface', // 'PhanPluginRedundantAssignmentInLoop', // 'PhanInvalidCommentForDeclarationType', - //'PhanParamSignatureMismatchInternal', + 'PhanParamSignatureMismatchInternal', // 'PhanPluginEmptyStatementForeachLoop', // 'PhanCompatibleDimAlternativeSyntax', 'PhanInvalidFQSENInClasslike', @@ -656,5 +657,4 @@ return [ 'sockets' => PHAN_DIR . '/stubs/sockets.phan_php', 'zip' => PHAN_DIR . '/stubs/zip.phan_php', ], - ]; From 44376cd066fa459ac68e6d6f400c4b0c45f75093 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 22:16:27 +0100 Subject: [PATCH 333/709] More specific type for childtablesoncascade --- htdocs/core/class/commonobject.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index a693c31ff2d..11be8c7e0c0 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -781,9 +781,9 @@ abstract class CommonObject protected $childtables = array(); /** - * @var array List of child tables. To know object to delete on cascade. - * If name is like '@ClassName:FilePathClass:ParentFkFieldName', it will - * call method deleteByParentField(parentId, ParentFkFieldName) to fetch and delete child object. + * @var string[] List of child tables. To know object to delete on cascade. + * If name is like '@ClassName:FilePathClass:ParentFkFieldName', it will + * call method deleteByParentField(parentId, ParentFkFieldName) to fetch and delete child object. */ protected $childtablesoncascade = array(); From b1b49811611d6e9e9efe63d062fb72b94862632c Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 22:19:49 +0100 Subject: [PATCH 334/709] Qual: Fix PHPdoc to match parent --- htdocs/salaries/class/salary.class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/salaries/class/salary.class.php b/htdocs/salaries/class/salary.class.php index 76a8982062e..0e242e38b39 100644 --- a/htdocs/salaries/class/salary.class.php +++ b/htdocs/salaries/class/salary.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2021 Gauthier VERDOL * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -49,9 +50,9 @@ class Salary extends CommonObject public $picto = 'salary'; /** - * @var array List of child tables. To test if we can delete object. + * @var array> List of child tables. To test if we can delete object. */ - protected $childtables = array('payment_salary' => array('name'=>'SalaryPayment', 'fk_element'=>'fk_salary')); + protected $childtables = array('payment_salary' => array('name' => 'SalaryPayment', 'fk_element' => 'fk_salary')); // /** // * @var array List of child tables. To know object to delete on cascade. @@ -572,7 +573,7 @@ class Salary extends CommonObject global $action, $hookmanager; $hookmanager->initHooks(array('salarypayment')); - $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $parameters = array('id' => $this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; From e60db40fa4421f59a2da72214c71f38a2604ca51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Mon, 11 Mar 2024 22:20:29 +0100 Subject: [PATCH 335/709] clean code and phpdoc --- dev/tools/phan/config.php | 3 ++- dev/tools/phan/config_fixer.php | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php index ae33dadbb32..36aca92b25e 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -536,7 +536,8 @@ return [ // 'PhanTypeInvalidThrowsIsInterface', // 'PhanPluginRedundantAssignmentInLoop', // 'PhanInvalidCommentForDeclarationType', - 'PhanParamSignatureMismatchInternal', + // 'PhanParamSignatureMismatchInternal', + 'PhanParamSignatureMismatch', // 'PhanPluginEmptyStatementForeachLoop', // 'PhanCompatibleDimAlternativeSyntax', 'PhanInvalidFQSENInClasslike', diff --git a/dev/tools/phan/config_fixer.php b/dev/tools/phan/config_fixer.php index a588483e3bf..8033331240b 100644 --- a/dev/tools/phan/config_fixer.php +++ b/dev/tools/phan/config_fixer.php @@ -1,4 +1,7 @@ + * Copyright (C) 2024 Frédéric France + */ // Uncomment require_once to enable corresponding fixer @@ -7,8 +10,6 @@ //require_once __DIR__.'/plugins/UrlEncodeStringifyFixer.php'; require_once __DIR__.'/plugins/SelectDateFixer.php'; -/* Copyright (C) 2024 MDW - */ define('DOL_PROJECT_ROOT', __DIR__.'/../../..'); define('DOL_DOCUMENT_ROOT', DOL_PROJECT_ROOT.'/htdocs'); define('PHAN_DIR', __DIR__); From f4e1026e7d2fa26ae7e6de372db43431dd161099 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 22:21:08 +0100 Subject: [PATCH 336/709] Qual: Fix PHPdoc to match parent --- htdocs/projet/class/task.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index a8217136ff6..5f97d8c9a3f 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -6,6 +6,7 @@ * Copyright (C) 2020 Juanjo Menent * Copyright (C) 2022 Charlene Benke * Copyright (C) 2023 Gauthier VERDOL + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -59,7 +60,7 @@ class Task extends CommonObjectLine public $picto = 'projecttask'; /** - * @var array List of child tables. To test if we can delete object. + * @var array> List of child tables. To test if we can delete object. */ protected $childtables = array( 'element_time' => array('name' => 'Task', 'parent' => 'projet_task', 'parentkey' => 'fk_element', 'parenttypefield' => 'elementtype', 'parenttypevalue' => 'task') @@ -881,7 +882,7 @@ class Task extends CommonObjectLine $result .= (($addlabel && $this->label) ? $sep.dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); } - $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $parameters = array('id' => $this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; From 71948cb559c54df3734998c27e409be9007bc50d Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 22:24:04 +0100 Subject: [PATCH 337/709] Qual: Fix PHPdoc to match parent --- htdocs/product/inventory/class/inventory.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php index cb3da2f695a..05a59a22875 100644 --- a/htdocs/product/inventory/class/inventory.class.php +++ b/htdocs/product/inventory/class/inventory.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2015 Florian Henry * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -204,11 +205,11 @@ class Inventory extends CommonObject public $class_element_line = 'Inventoryline'; /** - * @var array List of child tables. To test if we can delete object. + * @var array> List of child tables. To test if we can delete object. */ protected $childtables = array(); /** - * @var array List of child tables. To know object to delete on cascade. + * @var string[] List of child tables. To know object to delete on cascade. */ protected $childtablesoncascade = array('inventorydet'); From 303d0ef6791b5f490b2e5d6d56749213ef3c0bd8 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 22:25:57 +0100 Subject: [PATCH 338/709] Qual: Fix PHPdoc to match parent --- htdocs/product/class/product.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 3b31d2064e3..3be66063f6f 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -16,6 +16,7 @@ * Copyright (C) 2017 Gustavo Novaro * Copyright (C) 2019-2024 Frédéric France * Copyright (C) 2023 Benjamin Falière + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -76,7 +77,7 @@ class Product extends CommonObject public $oldcopy; /** - * @var array List of child tables. To test if we can delete object. + * @var array> List of child tables. To test if we can delete object. */ protected $childtables = array( 'supplier_proposaldet' => array('name' => 'SupplierProposal', 'parent' => 'supplier_proposal', 'parentkey' => 'fk_supplier_proposal'), @@ -113,7 +114,7 @@ class Product extends CommonObject public $regeximgext = '\.gif|\.jpg|\.jpeg|\.png|\.bmp|\.webp|\.xpm|\.xbm'; // See also into images.lib.php /** - * @deprecated + * @deprecated Use $label instead * @see $label */ public $libelle; From 03d14dfe56f268566b680dd95f8807d6bc8fa14e Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 22:27:35 +0100 Subject: [PATCH 339/709] Qual: set default value to match PHPdoc type --- htdocs/partnership/class/partnership_type.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/partnership/class/partnership_type.class.php b/htdocs/partnership/class/partnership_type.class.php index 335009e0e29..b5a6cc21656 100644 --- a/htdocs/partnership/class/partnership_type.class.php +++ b/htdocs/partnership/class/partnership_type.class.php @@ -6,6 +6,7 @@ * Copyright (C) 2018-2019 Thibault Foucart * Copyright (C) 2021 Waël Almoman * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -71,7 +72,7 @@ class PartnershipType extends CommonObject public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), - 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 15, 'index' => 1), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => '1', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 15, 'index' => 1), 'code' => array('type' => 'varchar(32)', 'label' => 'Code', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 20), 'label' => array('type' => 'varchar(64)', 'label' => 'Label', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 25, 'showoncombobox' => 1), 'active' => array('type' => 'integer', 'label' => 'Active', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 30), From 7fabf59b46cfc90d9a6b773cafa1ec69b47a7fe4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Mon, 11 Mar 2024 23:13:30 +0100 Subject: [PATCH 340/709] clean code and phpdoc --- htdocs/comm/remx.php | 5 +++-- htdocs/core/lib/usergroups.lib.php | 32 ++++++++++++++---------------- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index 994e30fb9f1..f1584aa8b30 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -2,7 +2,7 @@ /* Copyright (C) 2001-2004 Rodolphe Quiedeville * Copyright (C) 2004-2019 Laurent Destailleur * Copyright (C) 2008 Raphael Bertrand (Resultic) - * Copyright (C) 2019 Frédéric France + * Copyright (C) 2019-2024 Frédéric France * * 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 +45,7 @@ $backtopage = GETPOST('backtopage', 'alpha'); // Security check $socid = GETPOSTINT('id') ? GETPOSTINT('id') : GETPOSTINT('socid'); +/** @var User $user */ if ($user->socid > 0) { $socid = $user->socid; } @@ -55,7 +56,7 @@ if ($user->socid > 0) { } $result = restrictedArea($user, 'societe', $id, '&societe', '', 'fk_soc', 'rowid', 0); -$permissiontocreate = ($user->rights->societe->creer || $user->rights->facture->creer); +$permissiontocreate = ($user->hasRight('societe', 'creer') || $user->hasRight('facture', 'creer')); diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index 30db640ed07..87e6e367cb3 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -4,6 +4,7 @@ * Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2018 Ferran Marcet * Copyright (C) 2021-2023 Anthony Berton + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -237,7 +238,7 @@ function group_prepare_head($object) $canreadperms = true; if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) { - $canreadperms = ($user->admin || $user->rights->user->group_advance->readperms); + $canreadperms = ($user->admin || $user->hasRight('user', 'group_advance', 'readperms')); } $h = 0; @@ -504,17 +505,17 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) //Nothing } else { $listofdarkmodes = array( - '0' => $langs->trans("AlwaysDisabled"), - '1' => $langs->trans("AccordingToBrowser"), - '2' => $langs->trans("AlwaysEnabled") + $langs->trans("AlwaysDisabled"), + $langs->trans("AccordingToBrowser"), + $langs->trans("AlwaysEnabled") ); print ''; print ''.$langs->trans("DarkThemeMode").''; print ''; if ($edit) { - print $form->selectarray('THEME_DARKMODEENABLED', $listofdarkmodes, isset($conf->global->THEME_DARKMODEENABLED) ? $conf->global->THEME_DARKMODEENABLED : 0); + print $form->selectarray('THEME_DARKMODEENABLED', $listofdarkmodes, getDolGlobalInt('THEME_DARKMODEENABLED')); } else { - print $listofdarkmodes[isset($conf->global->THEME_DARKMODEENABLED) ? $conf->global->THEME_DARKMODEENABLED : 0]; + print $listofdarkmodes[getDolGlobalInt('THEME_DARKMODEENABLED')]; } print $form->textwithpicto('', $langs->trans("DoesNotWorkWithAllThemes")); print ''; @@ -545,11 +546,11 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print '';*/ } else { $listoftopmenumodes = array( - '0' => $langs->transnoentitiesnoconv("IconAndText"), - '1' => $langs->transnoentitiesnoconv("TextOnly"), - '2' => $langs->transnoentitiesnoconv("IconOnlyAllTextsOnHover"), - '3' => $langs->transnoentitiesnoconv("IconOnlyTextOnHover"), - '4' => $langs->transnoentitiesnoconv("IconOnly"), + $langs->transnoentitiesnoconv("IconAndText"), + $langs->transnoentitiesnoconv("TextOnly"), + $langs->transnoentitiesnoconv("IconOnlyAllTextsOnHover"), + $langs->transnoentitiesnoconv("IconOnlyTextOnHover"), + $langs->transnoentitiesnoconv("IconOnly"), ); print ''; print ''.$langs->trans("TopMenuDisableImages").''; @@ -637,13 +638,10 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print (empty($dolibarr_main_demo) && $edit)?'':' disabled="disabled"'; // Disabled for demo print '> '.$langs->trans("UsePersonalValue").''; print ''; - if ($edit) - { + if ($edit) { print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''),'THEME_ELDY_TOPMENU_BACK1','',1).' '; - } - else - { - $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''); + } else { + $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''); if ($color) print ''; else print ''; } From 7ad8f6b074180984bbb7685095fc70f7f59a7deb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Mon, 11 Mar 2024 23:18:01 +0100 Subject: [PATCH 341/709] clean code and phpdoc --- htdocs/core/lib/functions2.lib.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 1335da5649a..f5e95da450c 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -7,6 +7,7 @@ * Copyright (C) 2015-2016 Raphaël Doursenaud * Copyright (C) 2017 Juanjo Menent * Copyright (C) 2024 MDW + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -892,7 +893,7 @@ function array2table($data, $tableMarkup = 1, $tableoptions = '', $troptions = ' * @param string $table Table containing field with counter * @param string $field Field containing already used values of counter * @param string $where To add a filter on selection (for example to filter on invoice types) - * @param Societe $objsoc The company that own the object we need a counter for + * @param Societe|string $objsoc The company that own the object we need a counter for * @param string $date Date to use for the {y},{m},{d} tags. * @param string $mode 'next' for next value or 'last' for last value * @param bool $bentityon Activate the entity filter. Default is true (for modules not compatible with multicompany) @@ -2511,16 +2512,16 @@ function colorLighten($hex, $percent) /** - * @param string $hex color in hex - * @param float $alpha 0 to 1 to add alpha channel - * @param bool $returnArray true=return an array instead, false=return string - * @return string|array String or array + * @param string $hex color in hex + * @param float|false $alpha 0 to 1 to add alpha channel + * @param bool $returnArray true=return an array instead, false=return string + * @return string|array String or array */ function colorHexToRgb($hex, $alpha = false, $returnArray = false) { $string = ''; - $hex = str_replace('#', '', $hex); - $length = strlen($hex); + $hex = str_replace('#', '', $hex); + $length = strlen($hex); $rgb = array(); $rgb['r'] = hexdec($length == 6 ? substr($hex, 0, 2) : ($length == 3 ? str_repeat(substr($hex, 0, 1), 2) : 0)); $rgb['g'] = hexdec($length == 6 ? substr($hex, 2, 2) : ($length == 3 ? str_repeat(substr($hex, 1, 1), 2) : 0)); From b79328f4e613f0f635b5be1d2bec1953aa1c8d37 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 22:28:39 +0100 Subject: [PATCH 342/709] Qual: Fix PHPdoc to match parent --- htdocs/core/class/CMailFile.class.php | 2 +- htdocs/user/class/usergroup.class.php | 25 +++++++++++++------------ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 1e1004a7959..ea236ae12bc 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -731,7 +731,7 @@ class CMailFile /** * Send mail that was prepared by constructor. * - * @return negative-int|bool|string True if mail sent, false otherwise. Negative int if error in hook. String if incorrect send mode. + * @return int|bool|string True if mail sent, false otherwise. Negative int if error in hook. String if incorrect send mode. */ public function sendfile() { diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index 48ec6758351..25a188fa8ee 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -8,6 +8,7 @@ * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2019 Abbes Bahfir * Copyright (C) 2023-2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -111,13 +112,13 @@ class UserGroup extends CommonObject public $oldcopy; // To contains a clone of this when we need to save old properties of object public $fields = array( - 'rowid'=>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'), - 'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>5), - 'nom'=>array('type'=>'varchar(180)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Group name'), - 'note' => array('type'=>'html', 'label'=>'Description', 'enabled'=>1, 'visible'=>1, 'position'=>20, 'notnull'=>-1, 'searchall'=>1), - 'datec' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>50, 'notnull'=>1,), - 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'position'=>60, 'notnull'=>1,), - 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'ModelPDF', 'enabled'=>1, 'visible'=>0, 'position'=>100), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'index' => 1, 'position' => 1, 'comment' => 'Id'), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'default' => 1, 'index' => 1, 'position' => 5), + 'nom' => array('type' => 'varchar(180)', 'label' => 'Name', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'showoncombobox' => 1, 'index' => 1, 'position' => 10, 'searchall' => 1, 'comment' => 'Group name'), + 'note' => array('type' => 'html', 'label' => 'Description', 'enabled' => 1, 'visible' => 1, 'position' => 20, 'notnull' => -1, 'searchall' => 1), + 'datec' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'visible' => -2, 'position' => 50, 'notnull' => 1,), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'visible' => -2, 'position' => 60, 'notnull' => 1,), + 'model_pdf' => array('type' => 'varchar(255)', 'label' => 'ModelPDF', 'enabled' => 1, 'visible' => 0, 'position' => 100), ); /** @@ -126,12 +127,12 @@ class UserGroup extends CommonObject public $fk_element = 'fk_usergroup'; /** - * @var array List of child tables. To test if we can delete object. + * @var array> List of child tables. To test if we can delete object. */ protected $childtables = array(); /** - * @var array List of child tables. To know object to delete on cascade. + * @var string[] List of child tables. To know object to delete on cascade. */ protected $childtablesoncascade = array('usergroup_rights', 'usergroup_user'); @@ -407,7 +408,7 @@ class UserGroup extends CommonObject if (!$error) { $langs->load("other"); - $this->context = array('audit'=>$langs->trans("PermissionsAdd").($rid ? ' (id='.$rid.')' : '')); + $this->context = array('audit' => $langs->trans("PermissionsAdd").($rid ? ' (id='.$rid.')' : '')); // Call trigger $result = $this->call_trigger('USERGROUP_MODIFY', $user); @@ -536,7 +537,7 @@ class UserGroup extends CommonObject if (!$error) { $langs->load("other"); - $this->context = array('audit'=>$langs->trans("PermissionsDelete").($rid ? ' (id='.$rid.')' : '')); + $this->context = array('audit' => $langs->trans("PermissionsDelete").($rid ? ' (id='.$rid.')' : '')); // Call trigger $result = $this->call_trigger('USERGROUP_MODIFY', $user); @@ -860,7 +861,7 @@ class UserGroup extends CommonObject global $action; $hookmanager->initHooks(array('groupdao')); - $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $parameters = array('id' => $this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; From d9b63894d1b1de5ad636297994956867d72a7fea Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 22:29:48 +0100 Subject: [PATCH 343/709] Qual: Fix PHPdoc to match parent --- htdocs/societe/class/societe.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index eedaa168c37..5258417e0cc 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -83,7 +83,7 @@ class Societe extends CommonObject public $fieldsforcombobox = 'nom,name_alias'; /** - * @var array List of child tables. To test if we can delete object. + * @var array> List of child tables. To test if we can delete object. */ protected $childtables = array( 'supplier_proposal' => array('name' => 'SupplierProposal'), @@ -101,7 +101,7 @@ class Societe extends CommonObject ); /** - * @var array List of child tables. To know object to delete on cascade. + * @var string[] List of child tables. To know object to delete on cascade. * if name like with @ClassName:FilePathClass:ParentFkFieldName' it will call method deleteByParentField (with parentId as parameters) and FieldName to fetch and delete child object */ protected $childtablesoncascade = array( From 868c52dd1dce31160f39e01244e2d3e0e9affd39 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 22:32:48 +0100 Subject: [PATCH 344/709] Qual: Fix PHPdoc to match parent & default to match doc --- htdocs/mrp/class/mo.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 9c1ade49f15..1b92a3a2851 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -221,12 +221,12 @@ class Mo extends CommonObject public $class_element_line = 'MoLine'; /** - * @var array List of child tables. To test if we can delete object. + * @var array> List of child tables. To test if we can delete object. */ protected $childtables = array(); /** - * @var array List of child tables. To know object to delete on cascade. + * @var string[] List of child tables. To know object to delete on cascade. */ protected $childtablesoncascade = array('mrp_production'); @@ -2016,8 +2016,8 @@ class MoLine extends CommonObjectLine 'fk_product' => array('type' => 'integer', 'label' => 'Product', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 25), 'fk_warehouse' => array('type' => 'integer', 'label' => 'Warehouse', 'enabled' => 1, 'visible' => -1, 'position' => 30), 'qty' => array('type' => 'real', 'label' => 'Qty', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 35), - 'qty_frozen' => array('type' => 'smallint', 'label' => 'QuantityFrozen', 'enabled' => 1, 'visible' => 1, 'default' => 0, 'position' => 105, 'css' => 'maxwidth50imp', 'help' => 'QuantityConsumedInvariable'), - 'disable_stock_change' => array('type' => 'smallint', 'label' => 'DisableStockChange', 'enabled' => 1, 'visible' => 1, 'default' => 0, 'position' => 108, 'css' => 'maxwidth50imp', 'help' => 'DisableStockChangeHelp'), + 'qty_frozen' => array('type' => 'smallint', 'label' => 'QuantityFrozen', 'enabled' => 1, 'visible' => 1, 'default' => '0', 'position' => 105, 'css' => 'maxwidth50imp', 'help' => 'QuantityConsumedInvariable'), + 'disable_stock_change' => array('type' => 'smallint', 'label' => 'DisableStockChange', 'enabled' => 1, 'visible' => 1, 'default' => '0', 'position' => 108, 'css' => 'maxwidth50imp', 'help' => 'DisableStockChangeHelp'), 'batch' => array('type' => 'varchar(30)', 'label' => 'Batch', 'enabled' => 1, 'visible' => -1, 'position' => 140), 'role' => array('type' => 'varchar(10)', 'label' => 'Role', 'enabled' => 1, 'visible' => -1, 'position' => 145), 'fk_mrp_production' => array('type' => 'integer', 'label' => 'Fk mrp production', 'enabled' => 1, 'visible' => -1, 'position' => 150), From c8c003a437e7bbd3311eaab5b8842002ec66571d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Mon, 11 Mar 2024 23:46:48 +0100 Subject: [PATCH 345/709] restore rule --- dev/tools/phan/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php index 36aca92b25e..53982aaee7f 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -537,7 +537,7 @@ return [ // 'PhanPluginRedundantAssignmentInLoop', // 'PhanInvalidCommentForDeclarationType', // 'PhanParamSignatureMismatchInternal', - 'PhanParamSignatureMismatch', + // 'PhanParamSignatureMismatch', // 'PhanPluginEmptyStatementForeachLoop', // 'PhanCompatibleDimAlternativeSyntax', 'PhanInvalidFQSENInClasslike', From 6d92b164f0b14c877bba7bbebc225612ac6cccdc Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 22:35:23 +0100 Subject: [PATCH 346/709] Qual: set default value to match PHPdoc type --- htdocs/hrm/class/establishment.class.php | 39 ++++++++++++------------ 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/htdocs/hrm/class/establishment.class.php b/htdocs/hrm/class/establishment.class.php index 37ab22b84a9..d2faf176a86 100644 --- a/htdocs/hrm/class/establishment.class.php +++ b/htdocs/hrm/class/establishment.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -130,24 +131,24 @@ class Establishment extends CommonObject public $fields = array( - 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), - 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>15, 'index'=>1), - 'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>20), - 'label' =>array('type'=>'varchar(128)', 'label'=>'Label', 'enabled'=>1, 'visible'=>-1, 'showoncombobox'=>2, 'position'=>22), - 'address' =>array('type'=>'varchar(255)', 'label'=>'Address', 'enabled'=>1, 'visible'=>-1, 'position'=>25), - 'zip' =>array('type'=>'varchar(25)', 'label'=>'Zip', 'enabled'=>1, 'visible'=>-1, 'position'=>30), - 'town' =>array('type'=>'varchar(50)', 'label'=>'Town', 'enabled'=>1, 'visible'=>-1, 'position'=>35), - 'fk_state' =>array('type'=>'integer', 'label'=>'Fkstate', 'enabled'=>1, 'visible'=>-1, 'position'=>40), - 'fk_country' =>array('type'=>'integer', 'label'=>'Fkcountry', 'enabled'=>1, 'visible'=>-1, 'position'=>45), - 'profid1' =>array('type'=>'varchar(20)', 'label'=>'Profid1', 'enabled'=>1, 'visible'=>-1, 'position'=>50), - 'profid2' =>array('type'=>'varchar(20)', 'label'=>'Profid2', 'enabled'=>1, 'visible'=>-1, 'position'=>55), - 'profid3' =>array('type'=>'varchar(20)', 'label'=>'Profid3', 'enabled'=>1, 'visible'=>-1, 'position'=>60), - 'phone' =>array('type'=>'varchar(20)', 'label'=>'Phone', 'enabled'=>1, 'visible'=>-1, 'position'=>65), - 'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fkuserauthor', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>70), - 'fk_user_mod' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fkusermod', 'enabled'=>1, 'visible'=>-1, 'position'=>75), - 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>80), - 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>85), - 'status' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>-1, 'position'=>500), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => '1', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 15, 'index' => 1), + 'ref' => array('type' => 'varchar(30)', 'label' => 'Ref', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'showoncombobox' => 1, 'position' => 20), + 'label' => array('type' => 'varchar(128)', 'label' => 'Label', 'enabled' => 1, 'visible' => -1, 'showoncombobox' => 2, 'position' => 22), + 'address' => array('type' => 'varchar(255)', 'label' => 'Address', 'enabled' => 1, 'visible' => -1, 'position' => 25), + 'zip' => array('type' => 'varchar(25)', 'label' => 'Zip', 'enabled' => 1, 'visible' => -1, 'position' => 30), + 'town' => array('type' => 'varchar(50)', 'label' => 'Town', 'enabled' => 1, 'visible' => -1, 'position' => 35), + 'fk_state' => array('type' => 'integer', 'label' => 'Fkstate', 'enabled' => 1, 'visible' => -1, 'position' => 40), + 'fk_country' => array('type' => 'integer', 'label' => 'Fkcountry', 'enabled' => 1, 'visible' => -1, 'position' => 45), + 'profid1' => array('type' => 'varchar(20)', 'label' => 'Profid1', 'enabled' => 1, 'visible' => -1, 'position' => 50), + 'profid2' => array('type' => 'varchar(20)', 'label' => 'Profid2', 'enabled' => 1, 'visible' => -1, 'position' => 55), + 'profid3' => array('type' => 'varchar(20)', 'label' => 'Profid3', 'enabled' => 1, 'visible' => -1, 'position' => 60), + 'phone' => array('type' => 'varchar(20)', 'label' => 'Phone', 'enabled' => 1, 'visible' => -1, 'position' => 65), + 'fk_user_author' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'Fkuserauthor', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 70), + 'fk_user_mod' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'Fkusermod', 'enabled' => 1, 'visible' => -1, 'position' => 75), + 'datec' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 80), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 85), + 'status' => array('type' => 'integer', 'label' => 'Status', 'enabled' => 1, 'visible' => -1, 'position' => 500), ); @@ -505,7 +506,7 @@ class Establishment extends CommonObject global $action, $hookmanager; $hookmanager->initHooks(array('establishmentdao')); - $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $parameters = array('id' => $this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; From 217e3afda5332f0586ba0b9602cb81fd99007765 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 22:52:15 +0100 Subject: [PATCH 347/709] Qual: set default value to match PHPdoc type --- htdocs/bom/class/bom.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 451926a030c..f6a1d4f9deb 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2023 Benjamin Falière * Copyright (C) 2023 Charlene Benke * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -236,7 +237,7 @@ class BOM extends CommonObject // protected $childtables=array(); /** - * @var array List of child tables. To know object to delete on cascade. + * @var string[] List of child tables. To know object to delete on cascade. */ protected $childtablesoncascade = array('bom_bomline'); From 3c7cbac2400bb010e1b1399ba4beab3ac7f2c9f4 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 22:54:04 +0100 Subject: [PATCH 348/709] Qual: set default value to match PHPdoc type --- htdocs/ecm/class/ecmfiles.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/ecm/class/ecmfiles.class.php b/htdocs/ecm/class/ecmfiles.class.php index fcf77549177..69501fda02b 100644 --- a/htdocs/ecm/class/ecmfiles.class.php +++ b/htdocs/ecm/class/ecmfiles.class.php @@ -161,16 +161,16 @@ class EcmFiles extends CommonObject 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => 1, 'position' => 20, 'notnull' => 1, 'visible' => -1, 'index' => 1, 'searchall' => 1, 'showoncombobox' => 1, 'validate' => 1, 'comment' => "contains hash from filename+filepath"), 'label' => array('type' => 'varchar(128)', 'label' => 'Label', 'enabled' => 1, 'position' => 30, 'notnull' => 0, 'visible' => -1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'help' => "Help text", 'showoncombobox' => 2, 'validate' => 1, 'comment' => "contains hash of file content"), 'share' => array('type' => 'varchar(128)', 'label' => 'Share', 'enabled' => 1, 'position' => 40, 'notnull' => 0, 'visible' => -1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'help' => "Help text", 'showoncombobox' => 2, 'validate' => 1, 'comment' => "contains hash for file sharing"), - 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => -1, 'position' => 50, 'index' => 1), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => '1', 'enabled' => 1, 'visible' => -2, 'notnull' => -1, 'position' => 50, 'index' => 1), 'filepath' => array('type' => 'varchar(255)', 'label' => 'FilePath', 'enabled' => 1, 'position' => 60, 'notnull' => 0, 'visible' => 0, 'searchall' => 0, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'help' => "Help text", 'showoncombobox' => 2, 'validate' => 1,'comment' => "relative to dolibarr document dir. Example module/def"), 'filename' => array('type' => 'varchar(255)', 'label' => 'FileName', 'enabled' => 1, 'position' => 70, 'notnull' => 0, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'help' => "Help text", 'showoncombobox' => 2, 'validate' => 1,'comment' => "file name only without any directory"), 'src_object_type' => array('type' => 'varchar(64)', 'label' => 'SourceType', 'enabled' => 1, 'position' => 80, 'notnull' => 0, 'visible' => 0, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'help' => "Help text", 'showoncombobox' => 2, 'validate' => 1,'comment' => "Source object type ('proposal', 'invoice', ...)"), - 'src_object_id' => array('type' => 'integer', 'label' => 'SourceID', 'default' => 1, 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'position' => 90, 'index' => 1, 'comment' => "Source object id"), + 'src_object_id' => array('type' => 'integer', 'label' => 'SourceID', 'default' => '1', 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'position' => 90, 'index' => 1, 'comment' => "Source object id"), 'fullpath_orig' => array('type' => 'varchar(750)', 'label' => 'FullPathOrig', 'enabled' => 1, 'position' => 100, 'notnull' => 0, 'visible' => 0, 'searchall' => 0, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'help' => "Help text", 'showoncombobox' => 2, 'validate' => 1,'comment' => "full path of original filename, when file is uploaded from a local computer"), 'description' => array('type' => 'text', 'label' => 'Description', 'enabled' => 1, 'visible' => 0, 'position' => 110), 'keywords' => array('type' => 'varchar(750)', 'label' => 'Keywords', 'enabled' => 1, 'position' => 120, 'notnull' => 0, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'help' => "Help text", 'showoncombobox' => 2, 'validate' => 1,'comment' => "list of keywords, separated with comma. Must be limited to most important keywords."), 'cover' => array('type' => 'text', 'label' => 'Cover', 'enabled' => 1, 'visible' => 0, 'position' => 130, 'comment' => "is this file a file to use for a cover"), - 'position' => array('type' => 'integer', 'label' => 'Position', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 140, 'index' => 1, 'comment' => "position of file among others"), + 'position' => array('type' => 'integer', 'label' => 'Position', 'default' => '1', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 140, 'index' => 1, 'comment' => "position of file among others"), 'gen_or_uploaded' => array('type' => 'varchar(12)', 'label' => 'GenOrUpload', 'enabled' => 1, 'position' => 150, 'notnull' => 0, 'visible' => -1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'help' => "Help text", 'showoncombobox' => 2, 'validate' => 1,'comment' => "'generated' or 'uploaded'"), 'extraparams' => array('type' => 'varchar(255)', 'label' => 'ExtraParams', 'enabled' => 1, 'position' => 160, 'notnull' => 0, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'help' => "Help text", 'showoncombobox' => 2, 'validate' => 1, 'comment' => "for stocking other parameters with json format"), 'date_c' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'visible' => -1, 'position' => 170), From 77c10d653ea72bc14859716b3c954f7faf5e6903 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 22:55:05 +0100 Subject: [PATCH 349/709] Qual: set default value to match PHPdoc type --- htdocs/fichinter/class/fichinter.class.php | 59 +++++++++++----------- 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 0b29b094202..010427ab2a4 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -8,6 +8,7 @@ * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2023-2024 William Mead + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -38,33 +39,33 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php'; class Fichinter extends CommonObject { public $fields = array( - 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), - 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'isModEnabled("societe")', 'visible'=>-1, 'notnull'=>1, 'position'=>15), - 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:(fk_statut:=:1)', 'label'=>'Fk projet', 'enabled'=>'isModEnabled("project")', 'visible'=>-1, 'position'=>20), - 'fk_contrat' =>array('type'=>'integer', 'label'=>'Fk contrat', 'enabled'=>'$conf->contrat->enabled', 'visible'=>-1, 'position'=>25), - 'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>30), - 'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>35), - 'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>36), - 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>40, 'index'=>1), - 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>45), - 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>50), - 'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>55), - 'datei' =>array('type'=>'date', 'label'=>'Datei', 'enabled'=>1, 'visible'=>-1, 'position'=>60), - 'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'position'=>65), - 'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>70), - 'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>75), - 'dateo' =>array('type'=>'date', 'label'=>'Dateo', 'enabled'=>1, 'visible'=>-1, 'position'=>85), - 'datee' =>array('type'=>'date', 'label'=>'Datee', 'enabled'=>1, 'visible'=>-1, 'position'=>90), - 'datet' =>array('type'=>'date', 'label'=>'Datet', 'enabled'=>1, 'visible'=>-1, 'position'=>95), - 'duree' =>array('type'=>'double', 'label'=>'Duree', 'enabled'=>1, 'visible'=>-1, 'position'=>100), - 'description' =>array('type'=>'html', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>105, 'showoncombobox'=>2), - 'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110), - 'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>115), - 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>120), - 'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'Last main doc', 'enabled'=>1, 'visible'=>-1, 'position'=>125), - 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>130), - 'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>135), - 'fk_statut' =>array('type'=>'integer', 'label'=>'Fk statut', 'enabled'=>1, 'visible'=>-1, 'position'=>500), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), + 'fk_soc' => array('type' => 'integer:Societe:societe/class/societe.class.php', 'label' => 'ThirdParty', 'enabled' => 'isModEnabled("societe")', 'visible' => -1, 'notnull' => 1, 'position' => 15), + 'fk_projet' => array('type' => 'integer:Project:projet/class/project.class.php:1:(fk_statut:=:1)', 'label' => 'Fk projet', 'enabled' => 'isModEnabled("project")', 'visible' => -1, 'position' => 20), + 'fk_contrat' => array('type' => 'integer', 'label' => 'Fk contrat', 'enabled' => '$conf->contrat->enabled', 'visible' => -1, 'position' => 25), + 'ref' => array('type' => 'varchar(30)', 'label' => 'Ref', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'showoncombobox' => 1, 'position' => 30), + 'ref_ext' => array('type' => 'varchar(255)', 'label' => 'Ref ext', 'enabled' => 1, 'visible' => 0, 'position' => 35), + 'ref_client' => array('type' => 'varchar(255)', 'label' => 'RefCustomer', 'enabled' => 1, 'visible' => -1, 'position' => 36), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => '1', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 40, 'index' => 1), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 45), + 'datec' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'visible' => -1, 'position' => 50), + 'date_valid' => array('type' => 'datetime', 'label' => 'DateValidation', 'enabled' => 1, 'visible' => -1, 'position' => 55), + 'datei' => array('type' => 'date', 'label' => 'Datei', 'enabled' => 1, 'visible' => -1, 'position' => 60), + 'fk_user_author' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'Fk user author', 'enabled' => 1, 'visible' => -1, 'position' => 65), + 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => 1, 'visible' => -2, 'notnull' => -1, 'position' => 70), + 'fk_user_valid' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserValidation', 'enabled' => 1, 'visible' => -1, 'position' => 75), + 'dateo' => array('type' => 'date', 'label' => 'Dateo', 'enabled' => 1, 'visible' => -1, 'position' => 85), + 'datee' => array('type' => 'date', 'label' => 'Datee', 'enabled' => 1, 'visible' => -1, 'position' => 90), + 'datet' => array('type' => 'date', 'label' => 'Datet', 'enabled' => 1, 'visible' => -1, 'position' => 95), + 'duree' => array('type' => 'double', 'label' => 'Duree', 'enabled' => 1, 'visible' => -1, 'position' => 100), + 'description' => array('type' => 'html', 'label' => 'Description', 'enabled' => 1, 'visible' => -1, 'position' => 105, 'showoncombobox' => 2), + 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => 1, 'visible' => 0, 'position' => 110), + 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => 1, 'visible' => 0, 'position' => 115), + 'model_pdf' => array('type' => 'varchar(255)', 'label' => 'Model pdf', 'enabled' => 1, 'visible' => 0, 'position' => 120), + 'last_main_doc' => array('type' => 'varchar(255)', 'label' => 'Last main doc', 'enabled' => 1, 'visible' => -1, 'position' => 125), + 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'position' => 130), + 'extraparams' => array('type' => 'varchar(255)', 'label' => 'Extraparams', 'enabled' => 1, 'visible' => -1, 'position' => 135), + 'fk_statut' => array('type' => 'integer', 'label' => 'Fk statut', 'enabled' => 1, 'visible' => -1, 'position' => 500), ); /** @@ -945,7 +946,7 @@ class Fichinter extends CommonObject global $action; $hookmanager->initHooks(array('interventiondao')); - $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $parameters = array('id' => $this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; @@ -1326,7 +1327,7 @@ class Fichinter extends CommonObject // Hook of thirdparty module if (is_object($hookmanager)) { - $parameters = array('objFrom'=>$objFrom); + $parameters = array('objFrom' => $objFrom); $action = ''; $reshook = $hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { From eefe123dcb4b30fae29a34da77d108922169e454 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 11 Mar 2024 23:42:45 +0100 Subject: [PATCH 350/709] fixup! fix phpstan (#28727) --- .../barcode/mod_barcode_product_standard.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/htdocs/core/modules/barcode/mod_barcode_product_standard.php b/htdocs/core/modules/barcode/mod_barcode_product_standard.php index c2df3f7c3a0..9e830faa4c2 100644 --- a/htdocs/core/modules/barcode/mod_barcode_product_standard.php +++ b/htdocs/core/modules/barcode/mod_barcode_product_standard.php @@ -4,6 +4,7 @@ * Copyright (C) 2007-2012 Regis Houssin * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -157,14 +158,19 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode /** * Return next value * - * @param Product $objproduct Object product - * @param string $type Type of barcode (EAN, ISBN, ...) + * @param CommonObject $objproduct Object product + * @param string $type Type of barcode (EAN, ISBN, ...) * @return string Value if OK, '' if module not configured, <0 if KO */ public function getNextValue($objproduct, $type = '') { global $db, $conf; + if (!$objproduct instanceof Product) { + dol_syslog(get_class($this)."::getNextValue used on incompatible".get_class($objproduct), LOG_ERR); + return -1; + } + require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/barcode.lib.php'; // to be able to call function barcode_gen_ean_sum($ean) @@ -192,19 +198,19 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode $numFinal = get_next_value($db, $mask, 'product', $field, $where, '', $now); //Begin barcode with key: for barcode with key (EAN13...) calculate and substitute the last character (* or ?) used in the mask by the key - if ((substr($numFinal, -1)=='*') or (substr($numFinal, -1)=='?')) { // if last mask character is * or ? a joker, probably we have to calculate a key as last character (EAN13...) + if ((substr($numFinal, -1) == '*') or (substr($numFinal, -1) == '?')) { // if last mask character is * or ? a joker, probably we have to calculate a key as last character (EAN13...) $literaltype = ''; $literaltype = $this->literalBarcodeType($db, $type);//get literal_Barcode_Type switch ($literaltype) { case 'EAN13': //EAN13 rowid = 2 - if (strlen($numFinal)==13) {// be sure that the mask length is correct for EAN13 + if (strlen($numFinal) == 13) {// be sure that the mask length is correct for EAN13 $ean = substr($numFinal, 0, 12); //take first 12 digits - $eansum = barcode_gen_ean_sum($ean); + $eansum = barcode_gen_ean_sum($ean); $ean .= $eansum; //substitute the las character by the key $numFinal = $ean; } break; - // Other barcode cases with key could be written here + // Other barcode cases with key could be written here default: break; } From 8b79cfa0956be7a7de55b42e7983ab5ba47dc2f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Tue, 12 Mar 2024 00:16:06 +0100 Subject: [PATCH 351/709] clean --- htdocs/core/modules/barcode/modules_barcode.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/barcode/modules_barcode.class.php b/htdocs/core/modules/barcode/modules_barcode.class.php index f8026af15e1..ed2326edafb 100644 --- a/htdocs/core/modules/barcode/modules_barcode.class.php +++ b/htdocs/core/modules/barcode/modules_barcode.class.php @@ -62,11 +62,11 @@ abstract class ModeleNumRefBarCode extends CommonNumRefGenerator /** * Return next value available * - * @param Product $objproduct Object Product - * @param string $type Type of barcode (EAN, ISBN, ...) - * @return string Value + * @param CommonObject $objcommon CommonObject + * @param string $type Type of barcode (EAN, ISBN, ...) + * @return string Value */ - public function getNextValue($objproduct, $type = '') + public function getNextValue($objcommon, $type = '') { global $langs; return $langs->trans("Function_getNextValue_InModuleNotWorking"); From 4f64c683ee2525dff91d1099fa2e44f14cfa6eb1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Mar 2024 01:55:26 +0100 Subject: [PATCH 352/709] Better support for MAIN_OPTIMIZEFORTEXTBROWSER --- htdocs/core/class/conf.class.php | 11 ++++-- htdocs/core/lib/security2.lib.php | 2 +- htdocs/core/menus/standard/auguria.lib.php | 2 +- htdocs/core/menus/standard/eldy.lib.php | 2 +- htdocs/core/menus/standard/empty.php | 2 +- htdocs/core/search_page.php | 39 ++++++++++++---------- htdocs/core/tpl/login.tpl.php | 4 +-- htdocs/index.php | 8 ++--- htdocs/main.inc.php | 9 +++-- 9 files changed, 47 insertions(+), 32 deletions(-) diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 647354ef247..9f73b069950 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -1,4 +1,6 @@ * Copyright (C) 2003 Xavier Dutoit * Copyright (C) 2004-2020 Laurent Destailleur @@ -41,9 +43,14 @@ class Conf extends stdClass */ public $db; - //! To store properties found into database + /** + * @var Object To store global setup found into database + */ public $global; - //! To store browser info (->name, ->os, ->version, ->ua, ->layout, ...) + + /** + * @var Object To store browser info (->name, ->os, ->version, ->ua, ->layout, ...) + */ public $browser; //! To store some setup of generic modules diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index d08912c169e..33157cde1ce 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -149,7 +149,7 @@ if (!function_exists('dol_loginfunction')) { // Title $appli = constant('DOL_APPLICATION_TITLE'); - $title = $appli.' '.constant('DOL_VERSION'); + $title = $appli.(getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER') ? '' : ' '.constant('DOL_VERSION')); if (getDolGlobalString('MAIN_APPLICATION_TITLE')) { $title = getDolGlobalString('MAIN_APPLICATION_TITLE'); } diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index d727967222e..8509416d4fc 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -178,7 +178,7 @@ function print_auguria_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout } $showmode = 1; - if (empty($noout)) { + if (empty($noout) && !getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { print_start_menu_entry_auguria('', 'class="tmenuend"', $showmode); print_end_menu_entry_auguria($showmode); print_end_menu_array_auguria(); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index b5de6584a85..8ef3b8c9b90 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -590,7 +590,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = } $showmode = 1; - if (empty($noout)) { + if (empty($noout) && !getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { print_start_menu_entry('', 'class="tmenuend"', $showmode); print_end_menu_entry($showmode); print_end_menu_array(); diff --git a/htdocs/core/menus/standard/empty.php b/htdocs/core/menus/standard/empty.php index 16809c89405..0b925551848 100644 --- a/htdocs/core/menus/standard/empty.php +++ b/htdocs/core/menus/standard/empty.php @@ -139,7 +139,7 @@ class MenuManager } $showmode = 1; - if (empty($noout)) { + if (empty($noout) && !getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { print_start_menu_entry_empty('', 'class="tmenuend"', $showmode); } if (empty($noout)) { diff --git a/htdocs/core/search_page.php b/htdocs/core/search_page.php index adaa198087d..0f91b78b9ed 100644 --- a/htdocs/core/search_page.php +++ b/htdocs/core/search_page.php @@ -165,25 +165,28 @@ if (empty($reshook)) { $searchform .= '
'; -// Add search on URL -$ret = ''; -$ret .= '
'; -$ret .= ''; -$ret .= ''; -$ret .= ''; -$ret .= '
'; -$ret .= img_picto('', 'url', '', false, 0, 0, '', 'paddingright width20'); -$ret .= 'trans("OrPasteAnURL")).'"'; -$ret .= ' name="url" id="url" />'; -$ret .= ''; -$ret .= '
'; -$ret .= "
\n"; -$searchform .= $ret; +// Add search on URL +if ($conf->dol_use_jmobile) { + $ret = ''; + $ret .= '
'; + $ret .= ''; + $ret .= ''; + $ret .= ''; + $ret .= '
'; + $ret .= img_picto('', 'url', '', false, 0, 0, '', 'paddingright width20'); + $ret .= 'trans("OrPasteAnURL")).'"'; + $ret .= ' name="url" id="url" />'; + $ret .= ''; + $ret .= '
'; + $ret .= "
\n"; + + $searchform .= $ret; +} // Show all forms diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index 4d5dc2833dc..b2072e48eed 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -402,9 +402,9 @@ if (!empty($_SESSION['dol_loginmesg'])) { $message = $_SESSION['dol_loginmesg']; // By default this is an error message if (preg_match('//', $message)) { // if it contains this comment, this is a warning message $message = str_replace('', '', $message); - print '
'; + print '