Bugzilla – Attachment 77888 Details for
Bug 21202
C4::Items - Remove GetItemsByBiblioitemnumber
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21202: Replace C4::Items::GetItemsByBiblioitemnumber calls
Bug-21202-Replace-C4ItemsGetItemsByBiblioitemnumbe.patch (text/plain), 4.67 KB, created by
Josef Moravec
on 2018-08-16 10:33:32 UTC
(
hide
)
Description:
Bug 21202: Replace C4::Items::GetItemsByBiblioitemnumber calls
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2018-08-16 10:33:32 UTC
Size:
4.67 KB
patch
obsolete
>From 63676cb4bd9de2229f86f3a1f4e73cdcb0a44f6d Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 6 Aug 2018 17:56:38 -0300 >Subject: [PATCH] Bug 21202: Replace C4::Items::GetItemsByBiblioitemnumber > calls > >http://lists.koha-community.org/pipermail/koha-devel/2018-August/044757.html > >Prior to this patch, GetRecords returned timestampX, cardX and borrowerX for >the last 3 patrons who checked out the items. > >I have no idea if it is a desired effects but, as this code has been >there for a very long time (2005), I suspect it's not. >The "doc" (/ilsdi.pl?service=Describe&verb=GetRecords) does not say >anything about the checkouts info. > >Test plan: >hit /ilsdi.pl?service=GetRecords&id=1 >and confirm the info about items are displayed correctly > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >--- > C4/ILSDI/Services.pm | 2 +- > C4/Items.pm | 58 ---------------------------------------------------- > 2 files changed, 1 insertion(+), 59 deletions(-) > >diff --git a/C4/ILSDI/Services.pm b/C4/ILSDI/Services.pm >index 9498a77..1146f6c 100644 >--- a/C4/ILSDI/Services.pm >+++ b/C4/ILSDI/Services.pm >@@ -228,7 +228,7 @@ sub GetRecords { > my $biblioitemnumber = $biblioitem->{'biblioitemnumber'}; > my $holds = $biblio->current_holds->unblessed; > my $issues = GetBiblioIssues($biblionumber); >- my $items = GetItemsByBiblioitemnumber($biblioitemnumber); >+ my $items = $biblio->items->unblessed; > > # We loop over the items to clean them > foreach my $item (@$items) { >diff --git a/C4/Items.pm b/C4/Items.pm >index bf464c3..94eed1a 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -69,7 +69,6 @@ BEGIN { > CheckItemPreSave > > GetItemsForInventory >- GetItemsByBiblioitemnumber > GetItemsInfo > GetItemsLocationInfo > GetHostItemsInfo >@@ -775,11 +774,6 @@ The following functions provide various ways of > getting an item record, a set of item records, or > lists of authorized values for certain item fields. > >-Some of the functions in this group are candidates >-for refactoring -- for example, some of the code >-in C<GetItemsByBiblioitemnumber> and C<GetItemsInfo> >-has copy-and-paste work. >- > =cut > > =head2 GetItemsForInventory >@@ -932,58 +926,6 @@ sub GetItemsForInventory { > return (\@results, $iTotalRecords); > } > >-=head2 GetItemsByBiblioitemnumber >- >- GetItemsByBiblioitemnumber($biblioitemnumber); >- >-Returns an arrayref of hashrefs suitable for use in a TMPL_LOOP >-Called by C<C4::XISBN> >- >-=cut >- >-sub GetItemsByBiblioitemnumber { >- my ( $bibitem ) = @_; >- my $dbh = C4::Context->dbh; >- my $sth = $dbh->prepare("SELECT * FROM items WHERE items.biblioitemnumber = ?") || die $dbh->errstr; >- # Get all items attached to a biblioitem >- my $i = 0; >- my @results; >- $sth->execute($bibitem) || die $sth->errstr; >- while ( my $data = $sth->fetchrow_hashref ) { >- # Foreach item, get circulation information >- my $sth2 = $dbh->prepare( "SELECT * FROM issues,borrowers >- WHERE itemnumber = ? >- AND issues.borrowernumber = borrowers.borrowernumber" >- ); >- $sth2->execute( $data->{'itemnumber'} ); >- if ( my $data2 = $sth2->fetchrow_hashref ) { >- # if item is out, set the due date and who it is out too >- $data->{'date_due'} = $data2->{'date_due'}; >- $data->{'cardnumber'} = $data2->{'cardnumber'}; >- $data->{'borrowernumber'} = $data2->{'borrowernumber'}; >- } >- else { >- # set date_due to blank, so in the template we check itemlost, and withdrawn >- $data->{'date_due'} = ''; >- } # else >- # Find the last 3 people who borrowed this item. >- my $query2 = "SELECT * FROM old_issues, borrowers WHERE itemnumber = ? >- AND old_issues.borrowernumber = borrowers.borrowernumber >- ORDER BY returndate desc,timestamp desc LIMIT 3"; >- $sth2 = $dbh->prepare($query2) || die $dbh->errstr; >- $sth2->execute( $data->{'itemnumber'} ) || die $sth2->errstr; >- my $i2 = 0; >- while ( my $data2 = $sth2->fetchrow_hashref ) { >- $data->{"timestamp$i2"} = $data2->{'timestamp'}; >- $data->{"card$i2"} = $data2->{'cardnumber'}; >- $data->{"borrower$i2"} = $data2->{'borrowernumber'}; >- $i2++; >- } >- push(@results,$data); >- } >- return (\@results); >-} >- > =head2 GetItemsInfo > > @results = GetItemsInfo($biblionumber); >-- >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 21202
:
77703
|
77888
|
78079
|
78108