fix: show article name and admin link in stock alert email

Fix ``AlerteStock`` to use ``name`` instead of non-existent ``title``
field on articles, so the article name actually appears in the email.
Add ``lien_article`` variable with a direct link to the admin article
edit page. Update the DB template with a button and text link.
This commit is contained in:
Valentin Lab
2026-02-20 12:08:57 +01:00
parent 94af725373
commit ef52addc7d
2 changed files with 132 additions and 1 deletions

View File

@@ -23,14 +23,20 @@ class AlerteStock extends TemplateMailable
public $seuil;
public $lien_article;
public $lien_offre;
protected static $templateModelClass = MailTemplate::class;
public function __construct($offer)
{
$this->article = $offer->article->title ?? 'Article #'.$offer->article_id;
$this->article = $offer->article->name ?? 'Article #'.$offer->article_id;
$this->offre = $offer->id;
$this->stock_restant = $offer->stock_current;
$this->seuil = $offer->minimum_ondemand;
$this->lien_article = url('/Admin/Shop/Articles/edit/'.$offer->article_id);
$this->lien_offre = url('/Admin/Shop/Offers/edit/'.$offer->id);
}
public function envelope()