From 1a8f540dc83c6d0fc97fc6a0b527dc09a82fff57 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 23 Feb 2026 00:35:33 +0100 Subject: [PATCH 1/4] Fix: CI (#37320) * Fix: http_response_code type # Fix: http_response_code type - Fixed http_response_code type * Fix: Initialize refcashcontrol variable Initialize refcashcontrol variable to 0 to ensure it is defined before use in the invoice.php script. * Fix: Remove redundant check for BILL_SENTBYMAIL & $object type # Fix: Remove redundant check for BILL_SENTBYMAIL & $object type - Removed redundant check for BILL_SENTBYMAIL * Fix: Correct date calculation for full year cash control # Fix: Correct date calculation for full year cash control Calculates the start date by subtracting one year from the end date. * Qual: Add default batch value for invoice processing # Qual: Add default batch value for invoice processing Adds default empty string for the batch variable. --------- Co-authored-by: Laurent Destailleur --- .../compta/cashcontrol/cashcontrol_card.php | 6 ++-- htdocs/takepos/invoice.php | 2 ++ htdocs/takepos/send.php | 28 +++++++++---------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/htdocs/compta/cashcontrol/cashcontrol_card.php b/htdocs/compta/cashcontrol/cashcontrol_card.php index 4cda6c55b08..ce0e82b5e83 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_card.php +++ b/htdocs/compta/cashcontrol/cashcontrol_card.php @@ -6,7 +6,7 @@ * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2016 Marcos García * Copyright (C) 2018 Andreu Bisquerra - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 MDW * Copyright (C) 2024-2025 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -136,7 +136,7 @@ if ($object->id > 0) { $datestart = dol_time_plus_duree($dateend, -1, 'm', 0); } elseif (empty($object->day_close) && empty($object->month_close)) { // Full year $dateend = dol_mktime((int) $object->hour_close, (int) $object->min_close, (int) $object->sec_close, 12, 31, $object->year_close, 'gmt'); - $datestart = dol_time_plus_duree($datestart, -1, 'y', 0); + $datestart = dol_time_plus_duree($dateend, -1, 'y', 0); } else { $dateend = dol_mktime((int) $object->hour_close, (int) $object->min_close, (int) $object->sec_close, $object->month_close, $object->day_close, $object->year_close, 'gmt'); $datestart = dol_time_plus_duree($dateend, -1, 'd', 0); @@ -803,7 +803,7 @@ if ($action == "create" || $action == "start") { $object->fetch($id); print $object->opening; } else { - print (GETPOSTISSET('opening') ? price2num(GETPOST('opening', 'alpha')) : price($initialbalanceforterminal[$terminalid]['cash'])); + print(GETPOSTISSET('opening') ? price2num(GETPOST('opening', 'alpha')) : price($initialbalanceforterminal[$terminalid]['cash'])); } print '">'; print ''; diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index a2bcd7e6ea3..131ec5dc959 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -70,6 +70,7 @@ $idproduct = GETPOSTINT('idproduct'); $place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is id of table for Bar or Restaurant $placeid = 0; // $placeid is ID of invoice $mobilepage = GETPOST('mobilepage', 'alpha'); +$batch = ''; // Default no batch if missing // Terminal is stored into $_SESSION["takeposterminal"]; @@ -227,6 +228,7 @@ if (empty($reshook)) { $sql .= ")"; $sql .= " AND status = 1"; + $refcashcontrol = 0; $resql = $db->query($sql); if ($resql) { $obj = $db->fetch_object($resql); diff --git a/htdocs/takepos/send.php b/htdocs/takepos/send.php index 54977c43428..6d40cb76bbd 100644 --- a/htdocs/takepos/send.php +++ b/htdocs/takepos/send.php @@ -2,7 +2,7 @@ /* Copyright (C) 2019 Thibault FOUCART * Copyright (C) 2020 Andreu Bisquerra Gaya * Copyright (C) 2024 Frédéric France - * Copyright (C) 2025 MDW + * Copyright (C) 2025-2026 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -133,7 +133,7 @@ if ($action == "send" && $user->hasRight('takepos', 'run')) { print 'Failed to send email: '.$mail->error; - http_response_code('500'); + http_response_code(500); } else { $result = $mail->sendfile(); if ($result) { @@ -143,19 +143,17 @@ if ($action == "send" && $user->hasRight('takepos', 'run')) { $object->context['email_to'] = $sendto; $object->context['email_msgid'] = $mail->msgid; - // Same code than into actions_sendmail.inc.php - if ($triggersendname == 'BILL_SENTBYMAIL' && $object instanceof Facture) { - /* @var Facture $object */ + // Same code as in actions_sendmail.inc.php + // if ($triggersendname === 'BILL_SENTBYMAIL' && $object instanceof Facture) { // Always true ($triggersendname is set above, and $object = $invoice = Facture object + // If sending email for invoice, we increase the counter of invoices sent by email + $sql = "UPDATE ".MAIN_DB_PREFIX."facture SET email_sent_counter = email_sent_counter + 1"; + $sql .= " WHERE rowid = ".((int) $object->id); - // If sending email for invoice, we increase the counter of invoices sent by email - $sql = "UPDATE ".MAIN_DB_PREFIX."facture SET email_sent_counter = email_sent_counter + 1"; - $sql .= " WHERE rowid = ".((int) $object->id); - - $resql = $db->query($sql); - if ($resql) { - $object->email_sent_counter += 1; - } + $resql = $db->query($sql); + if ($resql) { + $object->email_sent_counter += 1; } + // } $result = $object->call_trigger($triggersendname, $user); // @phan-suppress-current-line PhanPossiblyUndeclaredGlobalVariable if ($result < 0) { @@ -170,12 +168,12 @@ if ($action == "send" && $user->hasRight('takepos', 'run')) { print "\n"; print 'If template ask to join file, it may include the file '.implode(',', $joinFile); } else { - http_response_code('500'); + http_response_code(500); } } else { print 'Failed to send email: '.$mail->error; - http_response_code('500'); + http_response_code(500); } } From e52c212a8183091febb43daf7e010e0a2ae43e7d Mon Sep 17 00:00:00 2001 From: minimexat Date: Mon, 23 Feb 2026 00:38:56 +0100 Subject: [PATCH 2/4] fix(expedition): add 'shipping' as valid modulepart alias in dol_check_secure_access_document (#37307) Co-authored-by: f-hoedl --- htdocs/core/lib/files.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 03d2db69158..7ad5021c52d 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -3465,7 +3465,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $accessallowed = 1; } $original_file = $conf->accounting->dir_output.'/'.$original_file; - } elseif (($modulepart == 'expedition' || $modulepart == 'shipment') && !empty($conf->expedition->dir_output)) { + } elseif (($modulepart == 'expedition' || $modulepart == 'shipment' || $modulepart == 'shipping') && !empty($conf->expedition->dir_output)) { // Wrapping pour les expedition if ($fuser->hasRight('expedition', $lire) || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; From 9560eb00bde4906440046c57e796a6e334359624 Mon Sep 17 00:00:00 2001 From: William Mead Date: Mon, 23 Feb 2026 00:40:39 +0100 Subject: [PATCH 3/4] Updated PHPDoc with since tag (#37299) Co-authored-by: Laurent Destailleur --- .../facture/class/api_invoices.class.php | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index cd653ce48de..8393d4c64e3 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -29,6 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php'; /** * API class for invoices * + * @since 5.0.0 Initial implementation * @access protected * @class DolibarrApiAccess {@requires user,external} */ @@ -68,6 +69,8 @@ class Invoices extends DolibarrApi * * Return an array with invoice information * + * @since 3.8.0 Initial implementation + * * @param int $id ID of invoice * @param int $contact_list 0:Return array contains all properties, 1:Return array contains just id, -1: Do not return contacts/adddesses * @param string $properties Restrict the data returned to these properties. Ignored if empty. Comma separated list of properties names @@ -92,6 +95,8 @@ class Invoices extends DolibarrApi * * Return an array with invoice information * + * @since 12.0.0 Initial implementation + * * @param string $ref Ref of object * @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id, -1: Do not return contacts/adddesses * @return Object Object with cleaned properties @@ -110,6 +115,8 @@ class Invoices extends DolibarrApi * * Return an array with invoice information * + * @since 12.0.0 Initial implementation + * * @param string $ref_ext External reference of object * @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id, -1: Do not return contacts/adddesses * @return Object Object with cleaned properties @@ -188,6 +195,8 @@ class Invoices extends DolibarrApi * * Get a list of invoices * + * @since 5.0.0 Initial implementation + * * @param string $sortfield Sort field * @param string $sortorder Sort order * @param int $limit Limit for list @@ -342,6 +351,8 @@ class Invoices extends DolibarrApi /** * Create invoice object * + * @since 3.8.0 Initial implementation + * * @param array $request_data Request data * @phan-param ?array $request_data * @phpstan-param ?array $request_data @@ -397,6 +408,8 @@ class Invoices extends DolibarrApi /** * Create an invoice using an existing order. * + * @since 7.0.0 Initial implementation + * * @param int $orderid Id of the order * @return Object Object with cleaned properties * @@ -442,6 +455,8 @@ class Invoices extends DolibarrApi /** * Create an invoice using a contract. * + * @since 20.0.0 Initial implementation + * * @param int $contractid Id of the contract * @return Object Object with cleaned properties * @@ -483,6 +498,8 @@ class Invoices extends DolibarrApi /** * Get lines of an invoice * + * @since 7.0.0 Initial implementation + * * @param int $id Id of invoice * @return array Array of lines * @phan-return CommonInvoiceLine[] @@ -515,6 +532,8 @@ class Invoices extends DolibarrApi /** * Update a line to a given invoice * + * @since 6.0.3 Initial implementation + * * @param int $id Id of invoice to update * @param int $lineid Id of line to update * @param array $request_data InvoiceLine data @@ -589,6 +608,8 @@ class Invoices extends DolibarrApi /** * Add a contact type of given invoice * + * @since 10.0.0 Initial implementation + * * @param int $id Id of invoice to update * @param int $contactid Id of contact to add * @param string $type Type (code in dictionary) of the contact (BILLING, SHIPPING, CUSTOMER + possibly your own) @@ -716,6 +737,8 @@ class Invoices extends DolibarrApi * * Return an array with contact information * + * @since 23.0.0 Initial implementation + * * @param int $id ID of invoice * @param string $type Type of the contact (BILLING, SHIPPING, CUSTOMER) * @return array Array with contact and user associated @@ -750,6 +773,8 @@ class Invoices extends DolibarrApi /** * Delete a contact type of given invoice * + * @since 10.0.0 Initial implementation + * * @param int $id Id of invoice to update * @param int $contactid Row key of the contact in the array contact_ids. * @param string $type Type of the contact (BILLING, SHIPPING, CUSTOMER). @@ -795,6 +820,8 @@ class Invoices extends DolibarrApi /** * Deletes a line of a given invoice * + * @since 7.0.0 Initial implementation + * * @param int $id Id of invoice * @param int $lineid Id of the line to delete * @return Object Object with cleaned properties @@ -838,6 +865,8 @@ class Invoices extends DolibarrApi /** * Update invoice * + * @since 3.8.0 Initial implementation + * * @param int $id Id of invoice to update * @param array $request_data Datas * @phan-param ?array $request_data @@ -902,6 +931,8 @@ class Invoices extends DolibarrApi /** * Delete invoice * + * @since 3.8.0 Initial implementation + * * @param int $id Invoice ID * @return array * @phan-return array{success:array{code:int,message:string}} @@ -942,6 +973,8 @@ class Invoices extends DolibarrApi /** * Add a line to a given invoice * + * @since 7.0.0 Initial implementation + * * Example of POST query : * { * "desc": "Desc", "subprice": "1.00000000", "qty": "1", "tva_tx": "20.000", "localtax1_tx": "0.000", "localtax2_tx": "0.000", @@ -1036,6 +1069,8 @@ class Invoices extends DolibarrApi /** * Adds a contact to an invoice * + * @since 8.0.0 Initial implementation + * * @param int $id Order ID * @param int $fk_socpeople Id of thirdparty contact (if source = 'external') or id of user (if source = 'internal') to link * @param string $type_contact Type of contact (code). Must a code found into table llx_c_type_contact. For example: BILLING @@ -1088,6 +1123,8 @@ class Invoices extends DolibarrApi /** * Sets an invoice as draft * + * @since 7.0.0 Initial implementation + * * @param int $id Order ID * @param int $idwarehouse Warehouse ID * @return Object Object with cleaned properties @@ -1133,6 +1170,8 @@ class Invoices extends DolibarrApi /** * Validate an invoice * + * @since 6.0.0 Initial implementation + * * If you get a bad value for param notrigger check that ou provide this in body * { * "idwarehouse": 0, @@ -1189,6 +1228,8 @@ class Invoices extends DolibarrApi /** * Sets an invoice as paid * + * @since 7.0.0 Initial implementation + * * @param int $id Order ID * @param string $close_code Code filled if we classify to 'Paid completely' when payment is not complete (for escompte for example) * @param string $close_note Comment defined if we classify to 'Paid' when payment is not complete (for escompte for example) @@ -1241,6 +1282,8 @@ class Invoices extends DolibarrApi /** * Sets an invoice as unpaid * + * @since 7.0.0 Initial implementation + * * @param int $id Order ID * @return Object Object with cleaned properties * @@ -1290,6 +1333,8 @@ class Invoices extends DolibarrApi /** * Get discount from invoice * + * @since 13.0.0 Initial implementation + * * @param int $id Id of invoice * @return Object Object with cleaned properties * @@ -1328,6 +1373,8 @@ class Invoices extends DolibarrApi /** * Create a discount (credit available) for a credit note or a deposit. * + * @since 10.0.0 Initial implementation + * * @param int $id Invoice ID * @return Object Object with cleaned properties * @@ -1523,6 +1570,8 @@ class Invoices extends DolibarrApi * * Note that this consume the discount. * + * @since 7.0.0 Initial implementation + * * @param int $id Id of invoice * @param int $discountid Id of discount * @return int @@ -1568,6 +1617,8 @@ class Invoices extends DolibarrApi * * Note that this consume the credit note. * + * @since 7.0.0 Initial implementation + * * @param int $id Id of invoice * @param int $discountid Id of a discount coming from a credit note * @return int @@ -1613,6 +1664,8 @@ class Invoices extends DolibarrApi /** * Get list of payments of a given invoice * + * @since 7.0.0 Initial implementation + * * @param int $id Id of invoice * @return array * @phan-return array @@ -1655,6 +1708,8 @@ class Invoices extends DolibarrApi /** * Add payment line to a specific invoice with the remain to pay as amount. * + * @since 7.0.0 Initial implementation + * * @param int $id Id of invoice * @param string $datepaye {@from body} Payment date * @param int $paymentid {@from body} Payment mode Id {@min 1} @@ -1775,6 +1830,8 @@ class Invoices extends DolibarrApi * Warning: Take care that all invoices are owned by the same customer. * Example of value for parameter arrayofamounts: {"1": {"amount": "99.99", "multicurrency_amount": ""}, "2": {"amount": "", "multicurrency_amount": "10"}} * + * @since 8.0.0 Initial implementation + * * @param array $arrayofamounts {@from body} Array with id of invoices with amount to pay for each invoice * @phan-param array $arrayofamounts * @phpstan-param array $arrayofamounts @@ -1925,6 +1982,8 @@ class Invoices extends DolibarrApi /** * Update a payment * + * @since 13.0.0 Initial implementation + * * @param int $id Id of payment * @param string $num_payment Payment number * @@ -2026,6 +2085,8 @@ class Invoices extends DolibarrApi * * Return an array with invoice information * + * @since 16.0.0 Initial implementation + * * @param int $id ID of template invoice * @param int $contact_list 0:Return array contains all properties, 1:Return array contains just id, -1: Do not return contacts/adddesses * @return Object Object with cleaned properties @@ -2045,6 +2106,8 @@ class Invoices extends DolibarrApi * * Get a list of template invoices * + * @since 23.0.0 Initial implementation + * * @param string $sortfield Sort field * @param string $sortorder Sort order * @param int $limit Limit for list From 095f72a3a7f70fd2fd6a449563ac6448613afa9e Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 23 Feb 2026 00:41:04 +0100 Subject: [PATCH 4/4] Qual: Update pre-commit hooks and dependencies (#37313) Updated the following pre-commit hooks and dependencies: - gitleaks: v8.29.0 -> v8.30.0 - actionlint: v1.7.10 -> v1.7.11 - yamllint: v1.37.1 -> v1.38.0 - sqlfluff: 3.3.1 -> 4.0.4 - Added LT15 to exclude_rules in pyproject.toml (new since 3.3.1) Co-authored-by: Laurent Destailleur --- .pre-commit-config.yaml | 8 ++++---- pyproject.toml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2011047d069..6e0675cc57f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -60,13 +60,13 @@ repos: # Gitleaks is a SAST tool for detecting and preventing hardcoded secrets like passwords, api keys, and tokens in git repos - repo: https://github.com/gitleaks/gitleaks.git - rev: v8.29.0 + rev: v8.30.0 hooks: - id: gitleaks # Check github actions - repo: https://github.com/rhysd/actionlint - rev: v1.7.10 + rev: v1.7.11 hooks: - id: actionlint stages: [manual] # To run: pre-commit run -a --hook-stage=manual actionlint @@ -196,7 +196,7 @@ repos: # Check format of yaml files - repo: https://github.com/adrienverge/yamllint.git - rev: v1.37.1 + rev: v1.38.0 hooks: - id: yamllint args: @@ -257,7 +257,7 @@ repos: # Check sql file syntax - repo: https://github.com/sqlfluff/sqlfluff - rev: 3.3.1 + rev: 4.0.4 hooks: - id: sqlfluff-lint stages: [pre-commit, manual] # manual needed for ci diff --git a/pyproject.toml b/pyproject.toml index 325a82e4043..c90e42a930d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -61,7 +61,7 @@ processes = -1 #verbose = 1 #exclude_rules = "LT01,CP01,RF04" # RF04 | Keywords should not be used as identifiers. (rowid, login, position, ...) -exclude_rules = "LT01,LT02,LT05,LT12,LT13,LT14,CP01,CP02,CP04,CP05,RF04" +exclude_rules = "LT01,LT02,LT05,LT12,LT13,LT14,LT15,CP01,CP02,CP04,CP05,RF04" dialect = "mysql" # Default byte limit is 20000, must set limit - some files are too big. large_file_skip_byte_limit = 100000