Bug 29495: Add code level constraint replacement
This patch adds a check in Koha::Checkouts::ReturnClaim::store to replace the database level foreign key check. Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
c2773d89f5
commit
c5d48ed278
|
|
@ -53,6 +53,16 @@ sub store {
|
|||
Koha::Exceptions::Checkouts::ReturnClaims::NoCreatedBy->throw();
|
||||
}
|
||||
|
||||
unless ( !$self->issue_id
|
||||
|| Koha::Checkouts->find( $self->issue_id )
|
||||
|| Koha::Old::Checkouts->find( $self->issue_id ) )
|
||||
{
|
||||
Koha::Exceptions::Object::FKConstraint->throw(
|
||||
error => 'Broken FK constraint',
|
||||
broken_fk => 'issue_id'
|
||||
);
|
||||
}
|
||||
|
||||
return $self->SUPER::store;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue