mirror of
https://github.com/standardebooks/web.git
synced 2025-07-08 15:50:29 -04:00
Fix validation of existing artwork name when creating a new artwork
This commit is contained in:
parent
4bec47a389
commit
59083baf8c
1 changed files with 7 additions and 10 deletions
|
@ -509,18 +509,15 @@ class Artwork{
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for existing `Artwork` objects with the same URL but different `ArtworkID`s.
|
// Check for existing `Artwork` objects with the same URL but different `ArtworkID`s.
|
||||||
if(isset($this->ArtworkId)){
|
|
||||||
try{
|
try{
|
||||||
$existingArtwork = Artwork::GetByUrl($this->Artist->UrlName, $this->UrlName);
|
$existingArtwork = Artwork::GetByUrl($this->Artist->UrlName, $this->UrlName);
|
||||||
if($existingArtwork->ArtworkId != $this->ArtworkId){
|
if(!isset($this->ArtworkId) || $existingArtwork->ArtworkId != $this->ArtworkId){
|
||||||
// Duplicate found, alert the user.
|
|
||||||
$error->Add(new Exceptions\ArtworkAlreadyExistsException());
|
$error->Add(new Exceptions\ArtworkAlreadyExistsException());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(Exceptions\ArtworkNotFoundException){
|
catch(Exceptions\ArtworkNotFoundException){
|
||||||
// No duplicates found, continue.
|
// No duplicates found, continue.
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if($isImageRequired){
|
if($isImageRequired){
|
||||||
if($imagePath === null){
|
if($imagePath === null){
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue