Fixed #13396 - do not allow checkout to undeployable status types

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe
2024-09-24 15:35:00 +01:00
parent 8cf1e4dceb
commit ba69259f2d
5 changed files with 135 additions and 25 deletions
+12 -1
View File
@@ -930,9 +930,20 @@ class Asset extends Depreciable
* */
public function checkInvalidNextAuditDate()
{
if (($this->last_audit_date) && ($this->next_audit_date) && ($this->last_audit_date > $this->next_audit_date)) {
// Deliberately parse the dates as Y-m-d (without H:i:s) to compare them
if ($this->last_audit_date) {
$last = Carbon::parse($this->last_audit_date)->format('Y-m-d');
}
if ($this->next_audit_date) {
$next = Carbon::parse($this->next_audit_date)->format('Y-m-d');
}
if ((isset($last) && (isset($next))) && ($last > $next)) {
return true;
}
return false;
}