Bugzilla – Attachment 61041 Details for
Bug 18254
Remove C4::Items::GetItemsByBiblioitemnumber call from additem.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18254: Remove call to GetItemsByBiblioitemnumber call from additem.pl
Bug-18254-Remove-call-to-GetItemsByBiblioitemnumbe.patch (text/plain), 4.09 KB, created by
Jonathan Druart
on 2017-03-13 15:29:06 UTC
(
hide
)
Description:
Bug 18254: Remove call to GetItemsByBiblioitemnumber call from additem.pl
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2017-03-13 15:29:06 UTC
Size:
4.09 KB
patch
obsolete
>From a0ad0ae6ced5250c540840b7a0dc737d4ea4baac Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Sun, 12 Mar 2017 22:56:19 -0300 >Subject: [PATCH] Bug 18254: Remove call to GetItemsByBiblioitemnumber call > from additem.pl > >The code from additem to delete all the items of a bibliographic record >is very ackward. >This patch simplifies the algorithm and make the code more readable. > >Test plan: >Remove all the items of a bibliographic records >If at least 1 item is checked out you should get an error. > >No change with the current behavior is expected. >--- > cataloguing/additem.pl | 55 +++++++++++++++++++------------------------------- > 1 file changed, 21 insertions(+), 34 deletions(-) > >diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl >index 5d8c0d0..e8e1bc4 100755 >--- a/cataloguing/additem.pl >+++ b/cataloguing/additem.pl >@@ -643,41 +643,28 @@ if ($op eq "additem") { > #------------------------------------------------------------------------------- > } elsif ($op eq "delallitems") { > #------------------------------------------------------------------------------- >- my @biblioitems = &GetBiblioItemByBiblioNumber($biblionumber); >- my $errortest=0; >- my $itemfail; >- foreach my $biblioitem (@biblioitems) { >- my $items = &GetItemsByBiblioitemnumber( $biblioitem->{biblioitemnumber} ); >- >- foreach my $item (@$items) { >- $error =&DelItemCheck( $biblionumber, $item->{itemnumber} ); >- $itemfail =$item; >- if($error == 1){ >- next >- } >- else { >- push @errors,$error; >- $errortest++ >- } >- } >- if($errortest > 0){ >- $nextop="additem"; >- } >- else { >- my $defaultview = C4::Context->preference('IntranetBiblioDefaultView'); >- my $views = { C4::Search::enabled_staff_search_views }; >- if ($defaultview eq 'isbd' && $views->{can_view_ISBD}) { >- print $input->redirect("/cgi-bin/koha/catalogue/ISBDdetail.pl?biblionumber=$biblionumber&searchid=$searchid"); >- } elsif ($defaultview eq 'marc' && $views->{can_view_MARC}) { >- print $input->redirect("/cgi-bin/koha/catalogue/MARCdetail.pl?biblionumber=$biblionumber&searchid=$searchid"); >- } elsif ($defaultview eq 'labeled_marc' && $views->{can_view_labeledMARC}) { >- print $input->redirect("/cgi-bin/koha/catalogue/labeledMARCdetail.pl?biblionumber=$biblionumber&searchid=$searchid"); >- } else { >- print $input->redirect("/cgi-bin/koha/catalogue/detail.pl?biblionumber=$biblionumber&searchid=$searchid"); >- } >- exit; >+ my $itemnumbers = C4::Items::GetItemnumbersForBiblio( $biblionumber ); >+ foreach my $itemnumber ( @$itemnumbers ) { >+ $error = C4::Items::DelItemCheck( $biblionumber, $itemnumber ); >+ next if $error == 1; # Means ok >+ push @errors,$error; >+ } >+ if ( @errors ) { >+ $nextop="additem"; >+ } else { >+ my $defaultview = C4::Context->preference('IntranetBiblioDefaultView'); >+ my $views = { C4::Search::enabled_staff_search_views }; >+ if ($defaultview eq 'isbd' && $views->{can_view_ISBD}) { >+ print $input->redirect("/cgi-bin/koha/catalogue/ISBDdetail.pl?biblionumber=$biblionumber&searchid=$searchid"); >+ } elsif ($defaultview eq 'marc' && $views->{can_view_MARC}) { >+ print $input->redirect("/cgi-bin/koha/catalogue/MARCdetail.pl?biblionumber=$biblionumber&searchid=$searchid"); >+ } elsif ($defaultview eq 'labeled_marc' && $views->{can_view_labeledMARC}) { >+ print $input->redirect("/cgi-bin/koha/catalogue/labeledMARCdetail.pl?biblionumber=$biblionumber&searchid=$searchid"); >+ } else { >+ print $input->redirect("/cgi-bin/koha/catalogue/detail.pl?biblionumber=$biblionumber&searchid=$searchid"); > } >- } >+ exit; >+ } > #------------------------------------------------------------------------------- > } elsif ($op eq "saveitem") { > #------------------------------------------------------------------------------- >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 18254
:
61041
|
62207
|
64329