diff --git a/htdocs/compta/cashcontrol/class/cashcontrol.class.php b/htdocs/compta/cashcontrol/class/cashcontrol.class.php index b3aa0965896..71fde5be880 100644 --- a/htdocs/compta/cashcontrol/class/cashcontrol.class.php +++ b/htdocs/compta/cashcontrol/class/cashcontrol.class.php @@ -511,6 +511,12 @@ class CashControl extends CommonObject */ public function delete(User $user, $notrigger = 0) { + // Test is status of cashcontrol is close + if ($this->status == $this::STATUS_CLOSED) { + $this->error = 'ErrorDeletingAClosedCashControlIsNotPossible'; + return -1; + } + return $this->deleteCommon($user, $notrigger); //return $this->deleteCommon($user, $notrigger, 1); } diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index fb9561c062a..bf383db72d9 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -388,6 +388,7 @@ ErrorModuleBuilderFailedToInit=Failed to init the object with the new %s (%s) ErrorThirdPartyNotFound=Error ThirdParty Not Found ErrorDynamicPHPContentNotAllowed=Error: %s=1 so dynamic PHP content is allowed only if RCE PHP functions (exec, shell_exec, ...) are all disabled. ErrorTooManyLinksIntoHTMLString=The HTML content contains too many links or images. Reduce the number or raise MAIN_SECURITY_MAX_IMG_IN_HTML_CONTENT. +ErrorDeletingAClosedCashControlIsNotPossible=Deleting a closed cash control is not possible # Warnings WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup.