Tweak donation banners and some type safety

This commit is contained in:
Alex Cabal 2025-01-06 13:25:02 -06:00
parent c07b4cec1e
commit 0105bfefa4
3 changed files with 5 additions and 4 deletions

View file

@ -38,13 +38,13 @@ try{
catch(Exceptions\DuplicateEbookException $ex){
// If the `Ebook` already exists, create the `Project` anyway.
$project->Ebook = Ebook::GetByIdentifier($project->Ebook->Identifier);
if(!$project->Ebook->EbookPlaceholder?->IsInProgress){
if($project->Ebook->EbookPlaceholder !== null && !$project->Ebook->EbookPlaceholder->IsInProgress){
$project->EbookId = $project->Ebook->EbookId;
$_SESSION['is-only-ebook-project-created'] = true;
// Set the placeholder to in progress.
$project->Ebook->EbookPlaceholder?->IsInProgress = true;
$project->Ebook->EbookPlaceholder?->Save();
$project->Ebook->EbookPlaceholder->IsInProgress = true;
$project->Ebook->EbookPlaceholder->Save();
}
else{
// `Ebook` exists and it's not a placeholder, so really fail.