From bbbba45fc1d87c3c438226e2c22e814c8d280b7b Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Wed, 5 Feb 2025 11:19:36 +0100 Subject: [PATCH 1/2] FIX wrong message on update shipment --- htdocs/expedition/dispatch.php | 2 +- htdocs/langs/en_US/sendings.lang | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/expedition/dispatch.php b/htdocs/expedition/dispatch.php index bf7b23b21d3..fd9f2f7f1b9 100644 --- a/htdocs/expedition/dispatch.php +++ b/htdocs/expedition/dispatch.php @@ -342,7 +342,7 @@ if ($action == 'updatelines' && $usercancreate) { setEventMessages($error, $errors, 'errors'); } else { $db->commit(); - setEventMessages($langs->trans("ReceptionUpdated"), null); + setEventMessages($langs->trans("ShipmentUpdated"), null); header("Location: ".DOL_URL_ROOT.'/expedition/dispatch.php?id='.$object->id); exit; diff --git a/htdocs/langs/en_US/sendings.lang b/htdocs/langs/en_US/sendings.lang index b3fc779dd2f..87975084a50 100644 --- a/htdocs/langs/en_US/sendings.lang +++ b/htdocs/langs/en_US/sendings.lang @@ -63,6 +63,7 @@ NoProductToShipFoundIntoStock=No product to ship found in warehouse %s. C WeightVolShort=Weight/Vol. ValidateOrderFirstBeforeShipment=You must first validate the order before being able to make shipments. NoLineGoOnTabToAddSome=No line, go on tab "%s" to add +ShipmentUpdated=Shipment successfully updated # Sending methods # ModelDocument From 9fc78cd1b6dd92ba21e9268883126db12d048ef9 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Wed, 5 Feb 2025 18:16:09 +0100 Subject: [PATCH 2/2] Fix regression --- htdocs/core/lib/files.lib.php | 2 +- htdocs/projet/tasks/task.php | 2 +- test/phpunit/FilesLibTest.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index ee9b55b21c3..ba7a1e82968 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1448,7 +1448,7 @@ function dol_delete_file($file, $disableglob = 0, $nophperrors = 0, $nohook = 0, } } } else { - $ok = false; // to avoid false positive + $ok = true; // nothing to delete when glob is on must return ok dol_syslog("No files to delete found", LOG_DEBUG); } } else { diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 4f1ca11848b..7e3070dd41f 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -210,7 +210,7 @@ if ($action == 'remove_file' && $user->rights->projet->creer) { $upload_dir = $conf->project->dir_output."/".dol_sanitizeFileName($projectstatic->ref)."/".dol_sanitizeFileName($object->ref); $file = $upload_dir.'/'.dol_sanitizeFileName(GETPOST('file')); - $ret = dol_delete_file($file); + $ret = dol_delete_file($file, 1); if ($ret) { setEventMessages($langs->trans("FileWasRemoved", GETPOST('file')), null, 'mesgs'); } else { diff --git a/test/phpunit/FilesLibTest.php b/test/phpunit/FilesLibTest.php index 8f235f3e868..58dc52b6f4b 100644 --- a/test/phpunit/FilesLibTest.php +++ b/test/phpunit/FilesLibTest.php @@ -372,7 +372,7 @@ class FilesLibTest extends PHPUnit\Framework\TestCase // Again to test there is error when deleting a non existing file with option disableglob $result=dol_delete_file($conf->admin->dir_temp.'/file3.csv', 1, 1); print __METHOD__." result=".$result."\n"; - $this->assertFalse($result, 'delete file that does not exists with disableglo must return ko'); + $this->assertFalse($result, 'delete file that does not exists with disabling glob must return ko'); // Again to test there is no error when deleting a non existing file without option disableglob $result=dol_delete_file($conf->admin->dir_temp.'/file3csv', 0, 1);