[Koha-bugs] [Bug 9231] Batch revert staged MARC records fails if one or more records in a batch have been deleted.

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri May 3 10:43:53 CEST 2013


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9231

--- Comment #5 from Chris Cormack <chris at bigballofwax.co.nz> ---
Comment on attachment 17910
  --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=17910
Bug 9231 - Batch revert staged MARC records fails if one or more records in a
batch have been deleted.

Review of attachment 17910:
 --> (http://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=9231&attachment=17910)
-----------------------------------------------------------------

::: C4/Items.pm
@@ +619,4 @@
>  
>      # backup the record
>      my $copy2deleted = $dbh->prepare("UPDATE deleteditems SET marc=? WHERE itemnumber=?");
> +    eval { $copy2deleted->execute( $record->as_usmarc(), $itemnumber ); }; warn $@ if $@;

If the error is caused by $record being undefined, wouldn't it be better to do

if ($record){
  my $copy2deleted = $dbh->prepare("UPDATE deleteditems SET marc=? WHERE
itemnumber=?");
  $copy2deleted->execute( $record->as_usmarc(), $itemnumber );
}

To save creating a handle and hitting the db when we don't need to, could even
do an
else {
  log deleted one here to tell the user
}

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list