Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2026-02-23 19:55:37 +01:00
commit 7e20cd27f6
4 changed files with 47 additions and 11 deletions

View file

@ -15648,8 +15648,10 @@ function readfileLowMemory($fullpath_original_file_osencoded, $method = -1)
}
// Be sure we don't have output buffering enabled to have readfile working correctly
while (ob_get_level()) {
ob_end_flush();
$level = ob_get_level();
ob_start();
while (ob_get_level() > $level) {
ob_end_clean();
}
// Solution 0

View file

@ -1035,7 +1035,7 @@ Permission2515=Setup documents directories
Permission2610=Generate/modify users API key
Permission2801=Use FTP client in read mode (browse and download only)
Permission2802=Use FTP client in write mode (delete or upload files)
Permission3201=Read Unalterable Logs and signature
Permission3201=Read, Export and Control Immutable Logs and signature
Permission3301=Generate new modules
Permission4001=Read skill/job/position
Permission4002=Create/modify skill/job/position

View file

@ -5,6 +5,7 @@
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2025 Jessica Kowal <jessicakowal69@gmail.com>
* Copyright (C) 2025 Charlene Benke <charlene@patas-monkey.com>
* Copyright (C) 2026 William Mead <william@m34d.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
@ -106,17 +107,18 @@ class Tasks extends DolibarrApi
*
* @since 5.0.0 Initial implementation
*
* @param string $sortfield Sort field
* @param string $sortorder Sort order
* @param int $limit Limit for list
* @param int $page Page number
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
* @param string $properties Restrict the data returned to these properties. Ignored if empty. Comma separated list of properties names
* @return array Array of project objects
* @param string $sortfield Sort field
* @param string $sortorder Sort order
* @param int $limit Limit for list
* @param int $page Page number
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
* @param string $properties Restrict the data returned to these properties. Ignored if empty. Comma separated list of properties names
* @param bool $pagination_data If this parameter is set to true the response will include pagination data. Default value is false. Page starts from 0
* @return array Array of project objects
* @phan-return Task[]
* @phpstan-return Task[]
*/
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '', $properties = '')
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '', $properties = '', $pagination_data = false)
{
global $db, $conf;
@ -160,6 +162,9 @@ class Tasks extends DolibarrApi
}
}
//this query will return total tasks with the filters given
$sqlTotals = str_replace('SELECT t.rowid', 'SELECT count(t.rowid) as total', $sql);
$sql .= $this->db->order($sortfield, $sortorder);
if ($limit) {
if ($page < 0) {
@ -189,6 +194,23 @@ class Tasks extends DolibarrApi
throw new RestException(503, 'Error when retrieve task list : ' . $this->db->lasterror());
}
//if $pagination_data is true the response will contain element data with all values and element pagination with pagination data(total,page,limit)
if ($pagination_data) {
$totalsResult = $this->db->query($sqlTotals);
$total = $this->db->fetch_object($totalsResult)->total;
$tmp = $obj_ret;
$obj_ret = [];
$obj_ret['data'] = $tmp;
$obj_ret['pagination'] = [
'total' => (int) $total,
'page' => $page, //count starts from 0
'page_count' => ceil((int) $total / $limit),
'limit' => $limit
];
}
return $obj_ret;
}

View file

@ -191,6 +191,18 @@ dol_syslog("***** Stripe IPN was called with event->type=".$event->type." servic
sleep(2);
// Hook to allow external modules to handle Stripe webhook events
$hookmanager = new HookManager($db);
$hookmanager->initHooks(array('stripeipn'));
$parameters = array('event' => $event, 'servicestatus' => $servicestatus, 'service' => $service);
$reshook = $hookmanager->executeHooks('stripeWebhookEvent', $parameters, $event->data->object, $event->type);
if ($reshook > 0) {
// A hook handled the event entirely, stop processing
http_response_code(200);
return;
}
if ($event->type == 'payout.created' && getDolGlobalString('STRIPE_AUTO_RECORD_PAYOUT')) {
// When a payout is created by Stripe to transfer money to your account
dol_syslog("object = ".formatLogObject($event->data));