Compare commits

...

7 Commits
22.0.3 ... 15.0

Author SHA1 Message Date
Laurent Destailleur
722c31d182 Merge branch '14.0' of git@github.com:Dolibarr/dolibarr.git into 15.0 2025-12-15 15:52:34 +01:00
Laurent Destailleur
ba2c173936 Merge pull request #36203 from Easya-Solutions/14.0_fix-purge-files-api-temp
FIX re-create API temp dir after purging temp files
2025-12-15 15:51:52 +01:00
lvessiller-opendsi
0beee0bec5 Merge branch '14.0' into 14.0_fix-purge-files-api-temp 2025-12-01 11:53:59 +01:00
Laurent Destailleur
32f160355b Merge branch '14.0' of git@github.com:Dolibarr/dolibarr.git into 15.0 2025-11-24 16:03:52 +01:00
lvessiller-opendsi
30ecf80732 FIX keep user who validate proposal on update (#36257) 2025-11-14 15:53:31 +01:00
VESSILLER
c2ae7d2da1 FIX create API temp directory in Dolibarr API constructor 2025-11-13 14:01:34 +01:00
VESSILLER
71ec381d3e FIX re-create API temp dir after purging temp files 2025-11-10 10:56:07 +01:00
4 changed files with 23 additions and 9 deletions

View File

@@ -58,6 +58,18 @@ class DolibarrApi
$this->db = $db;
$production_mode = (empty($conf->global->API_PRODUCTION_MODE) ? false : true);
if ($production_mode) {
// Create the directory Defaults::$cacheDirectory if it does not exist. If dir does not exist, using production_mode generates an error 500.
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
if (!dol_is_dir(Defaults::$cacheDirectory)) {
dol_mkdir(Defaults::$cacheDirectory, DOL_DATA_ROOT);
}
if (getDolGlobalString('MAIN_API_DEBUG')) {
dol_syslog("Debug API construct::cacheDirectory=".Defaults::$cacheDirectory, LOG_DEBUG, 0, '_api');
}
}
$this->r = new Restler($production_mode, $refreshCache);
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));

View File

@@ -183,7 +183,6 @@ class Propal extends CommonObject
public $fin_validite;
public $user_author_id;
public $user_valid_id;
public $user_close_id;
/**
@@ -1382,7 +1381,7 @@ class Propal extends CommonObject
// Clear fields
$object->user_author = $user->id;
$object->user_valid = '';
$object->user_validation_id = 0;
$object->date = $now;
$object->datep = $now; // deprecated
$object->fin_validite = $object->date + ($object->duree_validite * 24 * 3600);
@@ -1575,7 +1574,7 @@ class Propal extends CommonObject
$this->extraparams = (array) json_decode($obj->extraparams, true);
$this->user_author_id = $obj->fk_user_author;
$this->user_valid_id = $obj->fk_user_valid;
$this->user_validation_id = $obj->fk_user_valid;
$this->user_close_id = $obj->fk_user_cloture;
//Incoterms
@@ -1677,7 +1676,7 @@ class Propal extends CommonObject
$sql .= " total_ttc=".(isset($this->total_ttc) ? $this->total_ttc : "null").",";
$sql .= " fk_statut=".(isset($this->statut) ? $this->statut : "null").",";
$sql .= " fk_user_author=".(isset($this->user_author_id) ? $this->user_author_id : "null").",";
$sql .= " fk_user_valid=".(isset($this->user_valid) ? $this->user_valid : "null").",";
$sql .= " fk_user_valid = ".(!empty($this->user_validation_id) ? (int) $this->user_validation_id : "null").",";
$sql .= " fk_projet=".(isset($this->fk_project) ? $this->fk_project : "null").",";
$sql .= " fk_cond_reglement=".(isset($this->cond_reglement_id) ? $this->cond_reglement_id : "null").",";
$sql .= " fk_mode_reglement=".(isset($this->mode_reglement_id) ? $this->mode_reglement_id : "null").",";
@@ -1963,7 +1962,7 @@ class Propal extends CommonObject
$this->ref = $num;
$this->brouillon = 0;
$this->statut = self::STATUS_VALIDATED;
$this->user_valid_id = $user->id;
$this->user_validation_id = $user->id;
$this->datev = $now;
$this->db->commit();
@@ -3219,9 +3218,7 @@ class Propal extends CommonObject
$this->user_creation = $cuser;
if ($obj->fk_user_valid) {
$vuser = new User($this->db);
$vuser->fetch($obj->fk_user_valid);
$this->user_validation = $vuser;
$this->user_validation_id = $obj->fk_user_valid;
}
if ($obj->fk_user_signature) {

View File

@@ -490,6 +490,11 @@ abstract class CommonObject
*/
public $date_modification; // Date last change (tms field)
/**
* @var int|null User id of validation
*/
public $user_validation_id;
public $next_prev_filter;
/**

View File

@@ -169,7 +169,7 @@ class Utils
}
// Recreate temp dir that are not automatically recreated by core code for performance purpose, we need them
if (!empty($conf->api->enabled)) {
if (isModEnabled('api')) {
dol_mkdir($conf->api->dir_temp);
}
dol_mkdir($conf->user->dir_temp);