Bugzilla – Attachment 64817 Details for
Bug 18276
Koha::Biblio - Remove GetBiblioFromItemNumber
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18276: barcode may be nonexistent when checking out/in
Bug-18276-barcode-may-be-nonexistent-when-checking.patch (text/plain), 6.10 KB, created by
Jonathan Druart
on 2017-07-05 17:58:40 UTC
(
hide
)
Description:
Bug 18276: barcode may be nonexistent when checking out/in
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2017-07-05 17:58:40 UTC
Size:
6.10 KB
patch
obsolete
>From b450a5e4e67a5ec4b625564d28fb1df1554388f7 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 5 Jul 2017 14:53:57 -0300 >Subject: [PATCH] Bug 18276: barcode may be nonexistent when checking out/in > >--- > circ/circulation.pl | 14 +++++------ > circ/returns.pl | 67 ++++++++++++++++++++++++++++------------------------- > 2 files changed, 42 insertions(+), 39 deletions(-) > >diff --git a/circ/circulation.pl b/circ/circulation.pl >index 895d61ce21..bfe88cfd3d 100755 >--- a/circ/circulation.pl >+++ b/circ/circulation.pl >@@ -331,10 +331,13 @@ if (@$barcodes) { > $template_params->{messages} = $messages; > > my $item = Koha::Items->find({ barcode => $barcode }); >- my $biblio = $item->biblio; >+ my ( $biblio, $mss ); > >- my $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $biblio->frameworkcode, kohafield => 'items.notforloan', authorised_value => { not => undef } }); >- $template_params->{authvalcode_notforloan} = $mss->count ? $mss->next->authorised_value : undef; >+ if ( $item ) { >+ $biblio = $item->biblio; >+ my $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $biblio->frameworkcode, kohafield => 'items.notforloan', authorised_value => { not => undef } }); >+ $template_params->{authvalcode_notforloan} = $mss->count ? $mss->next->authorised_value : undef; >+ } > > # Fix for bug 7494: optional checkout-time fallback search for a book > >@@ -412,10 +415,6 @@ if (@$barcodes) { > ); > } > >- $template->param( >- itembiblionumber => $biblio->biblionumber >- ); >- > > # FIXME If the issue is confirmed, we launch another time checkouts->count, now display the issue count after issue > $patron = Koha::Patrons->find( $borrowernumber ); >@@ -424,6 +423,7 @@ if (@$barcodes) { > if ( $item ) { > $template_params->{item} = $item; > $template_params->{biblio} = $biblio; >+ $template_params->{itembiblionumber} = $biblio->biblionumber; > } > push @$checkout_infos, $template_params; > } >diff --git a/circ/returns.pl b/circ/returns.pl >index 03fbb8370e..7b96290f6d 100755 >--- a/circ/returns.pl >+++ b/circ/returns.pl >@@ -259,42 +259,44 @@ if ($barcode) { > $barcode = barcodedecode($barcode) if C4::Context->preference('itemBarcodeInputFilter'); > my $item = Koha::Items->find({ barcode => $barcode }); > >- # Check if we should display a checkin message, based on the the item >- # type of the checked in item >- my $itemtype = Koha::ItemTypes->find( $item->effective_itemtype ); >- if ( $itemtype && $itemtype->checkinmsg ) { >- $template->param( >- checkinmsg => $itemtype->checkinmsg, >- checkinmsgtype => $itemtype->checkinmsgtype, >- ); >- } >+ if ( $item ) { >+ # Check if we should display a checkin message, based on the the item >+ # type of the checked in item >+ my $itemtype = Koha::ItemTypes->find( $item->effective_itemtype ); >+ if ( $itemtype && $itemtype->checkinmsg ) { >+ $template->param( >+ checkinmsg => $itemtype->checkinmsg, >+ checkinmsgtype => $itemtype->checkinmsgtype, >+ ); >+ } > >- # make sure return branch respects home branch circulation rules, default to homebranch >- my $hbr = GetBranchItemRule($item->homebranch, $itemtype ? $itemtype->itemtype : undef )->{'returnbranch'} || "homebranch"; >- $returnbranch = $item->$hbr; >+ # make sure return branch respects home branch circulation rules, default to homebranch >+ my $hbr = GetBranchItemRule($item->homebranch, $itemtype ? $itemtype->itemtype : undef )->{'returnbranch'} || "homebranch"; >+ $returnbranch = $item->$hbr; > >- my $materials = $item->materials; >- my $descriptions = Koha::AuthorisedValues->get_description_by_koha_field({frameworkcode => '', kohafield =>'items.materials', authorised_value => $materials }); >- $materials = $descriptions->{lib} // $materials; >+ my $materials = $item->materials; >+ my $descriptions = Koha::AuthorisedValues->get_description_by_koha_field({frameworkcode => '', kohafield =>'items.materials', authorised_value => $materials }); >+ $materials = $descriptions->{lib} // $materials; > >- my $issue = Koha::Checkouts->find( { itemnumber => $itemnumber } ); >+ my $issue = Koha::Checkouts->find( { itemnumber => $itemnumber } ); > >- my $biblio = $item->biblio; >- $template->param( >- title => $biblio->title, >- homebranch => $item->homebranch, >- holdingbranch => $item->holdingbranch, >- returnbranch => $returnbranch, >- author => $biblio->author, >- itembarcode => $item->barcode, >- itemtype => $item->effective_itemtype, >- ccode => $item->ccode, >- itembiblionumber => $biblio->biblionumber, >- biblionumber => $biblio->biblionumber, >- borrower => $borrower, >- additional_materials => $materials, >- issue => $issue, >- ); >+ my $biblio = $item->biblio; >+ $template->param( >+ title => $biblio->title, >+ homebranch => $item->homebranch, >+ holdingbranch => $item->holdingbranch, >+ returnbranch => $returnbranch, >+ author => $biblio->author, >+ itembarcode => $item->barcode, >+ itemtype => $item->effective_itemtype, >+ ccode => $item->ccode, >+ itembiblionumber => $biblio->biblionumber, >+ biblionumber => $biblio->biblionumber, >+ borrower => $borrower, >+ additional_materials => $materials, >+ issue => $issue, >+ ); >+ } # FIXME else we should not call AddReturn but set BadBarcode directly instead > > my %input = ( > counter => 0, >@@ -302,6 +304,7 @@ if ($barcode) { > barcode => $barcode, > ); > >+ > # do the return > ( $returned, $messages, $issueinformation, $borrower ) = > AddReturn( $barcode, $userenv_branch, $exemptfine, $dropboxmode, $return_date_override, $dropboxdate ); >-- >2.11.0
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 18276
:
61122
|
61123
|
61124
|
61125
|
61126
|
61177
|
61178
|
61179
|
61180
|
61181
|
62081
|
62082
|
62083
|
62084
|
62085
|
62476
|
62477
|
62478
|
62479
|
62480
|
62481
|
63121
|
63122
|
63123
|
63124
|
63125
|
63126
|
63166
|
63294
|
63295
|
63296
|
63297
|
63298
|
63299
|
63300
|
64748
|
64809
|
64810
|
64811
|
64812
|
64813
|
64814
|
64815
|
64816
|
64817
|
64878
|
64879
|
64880
|
64881
|
64882
|
64883
|
64884
|
64885
|
64886
|
64887
|
64974
|
64975