Link to discussion if project producer has no email

This commit is contained in:
Alex Cabal 2024-12-16 00:14:51 -06:00
parent 5782d6ca7d
commit 93a1b40b89
2 changed files with 11 additions and 9 deletions

View file

@ -36,6 +36,8 @@ $includeStatus = $includeStatus ?? true;
<td class="producer"> <td class="producer">
<? if($project->ProducerEmail !== null){ ?> <? if($project->ProducerEmail !== null){ ?>
<a href="mailto:<?= Formatter::EscapeHtml($project->ProducerEmail) ?>"><?= Formatter::EscapeHtml($project->ProducerName) ?></a> <a href="mailto:<?= Formatter::EscapeHtml($project->ProducerEmail) ?>"><?= Formatter::EscapeHtml($project->ProducerName) ?></a>
<? }elseif($project->DiscussionUrl !== null){ ?>
<a href="<?= Formatter::EscapeHtml($project->DiscussionUrl) ?>"><?= Formatter::EscapeHtml($project->ProducerName) ?></a>
<? }else{ ?> <? }else{ ?>
<?= Formatter::EscapeHtml($project->ProducerName) ?> <?= Formatter::EscapeHtml($project->ProducerName) ?>
<? } ?> <? } ?>

View file

@ -73,15 +73,6 @@ try{
$ebookPlaceholder->FillFromHttpPost(); $ebookPlaceholder->FillFromHttpPost();
$ebook->EbookPlaceholder = $ebookPlaceholder; $ebook->EbookPlaceholder = $ebookPlaceholder;
$ebook->FillIdentifierFromTitleAndContributors();
try{
$existingEbook = Ebook::GetByIdentifier($ebook->Identifier);
throw new Exceptions\DuplicateEbookException($ebook->Identifier);
}
catch(Exceptions\EbookNotFoundException){
// Pass and create the placeholder. There is no existing ebook with this identifier.
}
// Do we have a `Project` to create at the same time? // Do we have a `Project` to create at the same time?
$project = null; $project = null;
if($ebookPlaceholder->IsInProgress){ if($ebookPlaceholder->IsInProgress){
@ -92,6 +83,15 @@ try{
$project->Validate(); $project->Validate();
} }
$ebook->FillIdentifierFromTitleAndContributors();
try{
$existingEbook = Ebook::GetByIdentifier($ebook->Identifier);
throw new Exceptions\DuplicateEbookException($ebook->Identifier);
}
catch(Exceptions\EbookNotFoundException){
// Pass and create the placeholder. There is no existing ebook with this identifier.
}
// These properties must be set before calling `Ebook::Create()` to prevent the getters from triggering DB queries or accessing `Ebook::$EbookId` before it is set. // These properties must be set before calling `Ebook::Create()` to prevent the getters from triggering DB queries or accessing `Ebook::$EbookId` before it is set.
$ebook->Tags = []; $ebook->Tags = [];
$ebook->LocSubjects = []; $ebook->LocSubjects = [];