https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17944
--- Comment #40 from Alex Buckley <[email protected]> --- (In reply to Jonathan Druart in comment 39) Hi Jonathan I have squashed all the bugs together locally and I have implemented a delete method in ItemType.pm to override Koha::Object->delete. I have implemented a try catch so if the delete doesn't work then catch is run and Koha::Exceptions::CannotDeleteDefault->throw is run (as shown below) >116 sub delete{ >117 my ( $self ) = @_; >118 try { >119 my $deleted = $self->SUPER::delete($self); >120 logaction( 'ITEMTYPE', 'DELETE', $self->reserve_id, Dumper( >>$self->unblessed) ) >121 if C4::Context->preference('ItemTypeLog'); >122 return $deleted; >123 } catch { >124 Koha::Exceptions::CannotDeleteDefault->throw('itemtype >>could not be deleted'); >125 } >126 } However I am a bit confused where you would like the Koha::ItemType->delete call to be in itemtypes.pl. Correct me if I am wrong but I think it cant go in elsif ( $op eq 'delete_confirm') block because putting a caller to delete into this block means if the delete runs successfully the user has no choice to confirm (or not) the deletion. -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list [email protected] http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
