mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-24 05:44:25 +01:00
Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2018 Andreu Bisquerra <jove@bisquerra.com>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024-2026 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* 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 '</td>';
|
||||
|
||||
@@ -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<string,string> $request_data
|
||||
* @phpstan-param ?array<string,string> $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<int,mixed> 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<string,string> $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<array{amount:int|float,date:int,num:string,ref:string,ref_ext?:string,fk_bank_line?:int,type:string}>
|
||||
@@ -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<string,array{amount:string,multicurrency_amount:string}> $arrayofamounts
|
||||
* @phpstan-param array<string,array{amount:string,multicurrency_amount:string}> $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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/* Copyright (C) 2019 Thibault FOUCART <support@ptibogxiv.net>
|
||||
* Copyright (C) 2020 Andreu Bisquerra Gaya <jove@bisquerra.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2025-2026 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user