Warenwirtschaft: F-17 — Köln-Default zentral (Location::defaultId), auch beim Ausschuss, nur aktive Standorte
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
731b2461e2
commit
2859aa0dbb
4 changed files with 31 additions and 3 deletions
|
|
@ -28,4 +28,17 @@ class Location extends Model
|
|||
'active' => 'boolean',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* AP-50 / Prüfung 08.09.2026 F-17: Standard-Lagerort für alle Erfassungsmasken
|
||||
* (Einkauf, Produktion, Ausschuss) — Köln, sofern aktiv; sonst der erste aktive
|
||||
* Standort. Inaktive Standorte stehen nicht zur Auswahl und werden nicht vorbelegt.
|
||||
*/
|
||||
public static function defaultId(): ?int
|
||||
{
|
||||
$id = static::query()->where('active', true)->where('name', 'like', '%öln%')->orderBy('id')->value('id')
|
||||
?? static::query()->where('active', true)->orderBy('name')->value('id');
|
||||
|
||||
return $id !== null ? (int) $id : null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue