[Koha-bugs] [Bug 17944] Remove the sql code from itemtypes.pl administrative perl script

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed May 3 15:06:43 CEST 2017


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17944

--- Comment #40 from Alex Buckley <alexbuckley at catalyst.net.nz> ---
(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.


More information about the Koha-bugs mailing list