Schütze den vorherigen Programmstand vor Kompositionen unbekannter Art
Eine Komposition mit einem kind-Wert, den erst ein neuerer Stand schreibt, gilt als nicht vorhanden (globaler Bereichsfilter statt Absturz im Enum-Cast). Aufbauten mit solchen Bestandteilen werden hier weder veröffentlicht noch als Angebot aktiviert, der Editor bleibt schreibgeschützt, die Mitgliederansicht zeigt den Bestandteil nicht. Grundlage für die Übungsverwaltung, damit ein Rückfall nichts verliert oder offenlegt. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
da02e0bbda
commit
ef56befc0e
16 files changed
+513
-5
No files matched your search
@@ -15,6 +15,7 @@
|
||||
use App\Domain\Catalog\DomainRuleException;
|
||||
use App\Domain\Catalog\EditorialVocabulary;
|
||||
use App\Domain\Catalog\EditorialWorkingDraft;
|
||||
use App\Domain\Catalog\ForeignCompositions;
|
||||
use App\Domain\Catalog\IdentityDimension;
|
||||
use App\Domain\Catalog\IdentityDimensionValue;
|
||||
use App\Domain\Catalog\IdentityProfile;
|
||||
@@ -489,8 +490,39 @@ public function cancelText(): void
|
||||
$this->newTextBody = '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Rückfallschutz: Enthält dieser Aufbau (in einer Fassung oder im Entwurf) einen Bestandteil, den dieser Programmstand
|
||||
* nicht kennt, bleibt er schreibgeschützt. Der Editor könnte den Bestandteil sonst nicht laden und würde ihn beim
|
||||
* Speichern oder Freigeben still weglassen.
|
||||
*/
|
||||
public function schreibschutz(): ?string
|
||||
{
|
||||
$foreign = app(ForeignCompositions::class);
|
||||
$reason = 'Dieser Aufbau enthält einen Bestandteil aus einer neueren Programmversion. Er kann hier nur angesehen werden, damit nichts verloren geht.';
|
||||
|
||||
if ($foreign->compositionHasForeignMembers((int) $this->getRecord()->getKey())) {
|
||||
return $reason;
|
||||
}
|
||||
|
||||
$draft = app(EditorialWorkingDraft::class)->read($this->getRecord());
|
||||
|
||||
foreach (is_array($draft['members'] ?? null) ? $draft['members'] : [] as $member) {
|
||||
if (is_array($member) && $foreign->isForeignTarget((string) ($member['target'] ?? ''))) {
|
||||
return $reason;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function saveDraft(): void
|
||||
{
|
||||
if (($reason = $this->schreibschutz()) !== null) {
|
||||
$this->feedback = $reason;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->commitRoleDraft();
|
||||
$minutes = $this->minutes($this->durationMinutes);
|
||||
|
||||
@@ -508,6 +540,13 @@ public function saveDraft(): void
|
||||
|
||||
public function armRelease(): void
|
||||
{
|
||||
if (($reason = $this->schreibschutz()) !== null) {
|
||||
$this->releaseArmed = false;
|
||||
$this->feedback = $reason;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->commitRoleDraft();
|
||||
|
||||
if ($this->members === []) {
|
||||
@@ -585,6 +624,12 @@ protected function selectFirstPart(): void
|
||||
|
||||
public function discardDraft(): void
|
||||
{
|
||||
if (($reason = $this->schreibschutz()) !== null) {
|
||||
$this->feedback = $reason;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var Composition $record */
|
||||
$record = $this->getRecord();
|
||||
app(EditorialWorkingDraft::class)->clear($record);
|
||||
@@ -1521,6 +1566,12 @@ public function presentationChips(): array
|
||||
|
||||
public function publishRevision(): bool
|
||||
{
|
||||
if (($reason = $this->schreibschutz()) !== null) {
|
||||
$this->feedback = $reason;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->commitRoleDraft();
|
||||
|
||||
if ($this->members === []) {
|
||||
@@ -1929,6 +1980,12 @@ protected function persistRedaktion(): bool
|
||||
|
||||
protected function persistDraft(): bool
|
||||
{
|
||||
if (($reason = $this->schreibschutz()) !== null) {
|
||||
$this->feedback = $reason;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->minutes($this->durationMinutes) === false) {
|
||||
$this->feedback = 'Der Zeitbedarf ist eine Zahl von Minuten oder bleibt leer.';
|
||||
|
||||
|
||||
Reference in new issue
Block a user