Benenne Artikel im Shop und in den Listen nach ihrem Inhalt statt nach der Kennung
Die Produktseite zeigte im Leistungsumfang die Kennung, obwohl die Redaktion den Namen aus dem Inhalt übernimmt. ProductOptions und PublicationReadiness lösen den Namen jetzt wie die Redaktion auf: eigener Name, sonst Name des Inhalts, zuletzt Kennung. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d49b178ebd
commit
4520dba2f0
3 files changed
+38
-8
No files matched your search
@@ -8,6 +8,7 @@
|
||||
use App\Domain\Catalog\BundleStatus;
|
||||
use App\Domain\Catalog\BundleVersion;
|
||||
use App\Domain\Catalog\DomainRuleException;
|
||||
use App\Domain\Catalog\EditorialProfileReader;
|
||||
use App\Domain\Catalog\LicenseArticle;
|
||||
use App\Domain\Catalog\Offer;
|
||||
use App\Domain\Catalog\OfferService;
|
||||
@@ -47,7 +48,7 @@ public function articleUsable(LicenseArticle $article): bool
|
||||
/** Anzeige in Auswahllisten: Name, Kennung und Stand statt der bloßen Kennung. */
|
||||
public function articleLabel(LicenseArticle $article): string
|
||||
{
|
||||
$title = trim((string) ($article->display_title ?: $article->working_title));
|
||||
$title = $this->articleName($article);
|
||||
$name = $title !== '' ? $title.' ('.$article->code.')' : (string) $article->code;
|
||||
$release = $article->currentRelease;
|
||||
|
||||
@@ -58,6 +59,14 @@ public function articleLabel(LicenseArticle $article): string
|
||||
return $name.' · '.($release === null ? 'noch ohne Stand, nicht verwendbar' : 'Stand gesperrt, nicht verwendbar');
|
||||
}
|
||||
|
||||
/** Name wie in der Redaktion: eigener Name oder Name des Inhalts, sonst der Arbeitstitel; leer ohne beides. */
|
||||
public function articleName(LicenseArticle $article): string
|
||||
{
|
||||
$name = app(EditorialProfileReader::class)->read($article, 'artikel')->value('display_title');
|
||||
|
||||
return trim((string) (filled($name) ? $name : $article->working_title));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<int, string>
|
||||
*/
|
||||
@@ -113,7 +122,7 @@ public function unusableArticles(array $articleIds): array
|
||||
*/
|
||||
public function unusableMessage(array $articles, string $zweck): string
|
||||
{
|
||||
$namen = implode(', ', array_map(fn (LicenseArticle $article): string => '„'.($article->display_title ?: $article->working_title ?: $article->code).'“ ('.$article->code.')', $articles));
|
||||
$namen = implode(', ', array_map(fn (LicenseArticle $article): string => '„'.($this->articleName($article) ?: $article->code).'“ ('.$article->code.')', $articles));
|
||||
|
||||
return (count($articles) === 1 ? 'Der Lizenzartikel ' : 'Die Lizenzartikel ').$namen
|
||||
.(count($articles) === 1 ? ' hat' : ' haben')
|
||||
@@ -142,11 +151,11 @@ public function forArticle(LicenseArticle $article): array
|
||||
],
|
||||
[
|
||||
'titel' => 'Name und Beschreibung',
|
||||
'text' => filled($article->display_title)
|
||||
? 'Der Name „'.$article->display_title.'“ erscheint in Paketen, Angeboten und der Bibliothek.'
|
||||
: 'Ohne eigenen Namen erscheint die Kennung „'.$article->code.'“. Name, Teaser und Beschreibung pflegst du in der Redaktion.',
|
||||
'stand' => filled($article->display_title) ? 'erledigt' : 'optional',
|
||||
'aktion' => filled($article->display_title) ? null : ['label' => 'Redaktion bearbeiten', 'wire' => "openRedaktion('texte')"],
|
||||
'text' => $this->articleName($article) !== ''
|
||||
? 'Der Name „'.$this->articleName($article).'“ erscheint in Paketen, Angeboten, im Shop und in der Bibliothek.'
|
||||
: 'Ohne Name erscheint die Kennung „'.$article->code.'“. Name, Teaser und Beschreibung pflegst du in der Redaktion.',
|
||||
'stand' => $this->articleName($article) !== '' ? 'erledigt' : 'optional',
|
||||
'aktion' => $this->articleName($article) !== '' ? null : ['label' => 'Redaktion bearbeiten', 'wire' => "openRedaktion('texte')"],
|
||||
],
|
||||
[
|
||||
'titel' => 'In einem Paket oder Angebot verwenden',
|
||||
|
||||
Reference in new issue
Block a user