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

This commit is contained in:
Laurent Destailleur 2024-03-01 20:20:00 +01:00
commit 7d2928fe1f
4 changed files with 29 additions and 25 deletions

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2020 Thibault FOUCART <support@ptibogxiv.net>
* Copyright (C) 2023 Joachim Kueter <git-jk@bloxera.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -930,14 +931,15 @@ class Invoices extends DolibarrApi
* "notrigger": 0
* }
*
* @param int $id Invoice ID
* @param int $idwarehouse Warehouse ID
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return Object|false Object with cleaned properties
* @param int $id Invoice ID
* @param string $force_number force ref invoice
* @param int $idwarehouse Warehouse ID
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return Object|false Object with cleaned properties
*
* @url POST {id}/validate
*/
public function validate($id, $idwarehouse = 0, $notrigger = 0)
public function validate($id, $force_number = '', $idwarehouse = 0, $notrigger = 0)
{
if (!DolibarrApiAccess::$user->hasRight('facture', 'creer')) {
throw new RestException(403);
@ -951,7 +953,7 @@ class Invoices extends DolibarrApi
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$result = $this->invoice->validate(DolibarrApiAccess::$user, '', $idwarehouse, $notrigger);
$result = $this->invoice->validate(DolibarrApiAccess::$user, $force_number, $idwarehouse, $notrigger);
if ($result == 0) {
throw new RestException(304, 'Error nothing done. May be object is already validated');
}

View File

@ -2620,7 +2620,7 @@ function dol_compress_dir($inputdir, $outputfile, $mode = "zip", $excludefiles =
* @param int $mode 0=Return array minimum keys loaded (faster), 1=Force all keys like date and size to be loaded (slower), 2=Force load of date only, 3=Force load of size only
* @return array Array with properties (full path, date, ...) of to most recent file
*/
function dol_most_recent_file($dir, $regexfilter = '', $excludefilter = array('(\.meta|_preview.*\.png)$', '^\.'), $nohook = 0, $mode = '')
function dol_most_recent_file($dir, $regexfilter = '', $excludefilter = array('(\.meta|_preview.*\.png)$', '^\.'), $nohook = 0, $mode = 0)
{
$tmparray = dol_dir_list($dir, 'files', 0, $regexfilter, $excludefilter, 'date', SORT_DESC, $mode, $nohook);
return isset($tmparray[0]) ? $tmparray[0] : null;

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Ion Agorria <ion@agorria.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -169,11 +170,11 @@ class PriceGlobalVariable
/**
* Update object into database
*
* @param User $user User that modifies
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int Return integer <0 if KO, >0 if OK
* @param User|null $user User that modifies
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int Return integer <0 if KO, >0 if OK
*/
public function update($user = 0, $notrigger = 0)
public function update($user = null, $notrigger = 0)
{
$error = 0;

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Ion Agorria <ion@agorria.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -189,11 +190,11 @@ class PriceGlobalVariableUpdater
/**
* Update object into database
*
* @param User $user User that modifies
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int Return integer <0 if KO, >0 if OK
* @param User|null $user User that modifies
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int Return integer <0 if KO, >0 if OK
*/
public function update($user = 0, $notrigger = 0)
public function update($user = null, $notrigger = 0)
{
$error = 0;
@ -557,12 +558,12 @@ class PriceGlobalVariableUpdater
/**
* Update next_update into database
*
* @param string $next_update Next update to write
* @param User $user User that modifies
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int Return integer <0 if KO, >0 if OK
* @param string $next_update Next update to write
* @param User|null $user User that modifies
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int Return integer <0 if KO, >0 if OK
*/
public function update_next_update($next_update, $user = 0, $notrigger = 0)
public function update_next_update($next_update, $user = null, $notrigger = 0)
{
// phpcs:enable
$error = 0;
@ -602,12 +603,12 @@ class PriceGlobalVariableUpdater
/**
* Update last_status into database
*
* @param string $last_status Status to write
* @param User $user User that modifies
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int Return integer <0 if KO, >0 if OK
* @param string $last_status Status to write
* @param User|null $user User that modifies
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int Return integer <0 if KO, >0 if OK
*/
public function update_status($last_status, $user = 0, $notrigger = 0)
public function update_status($last_status, $user = null, $notrigger = 0)
{
// phpcs:enable
$error = 0;