Bugzilla – Attachment 3204 Details for
Bug 3483
Show number of OPAC renewals
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Squashed commit
patch.txt (text/plain), 11.03 KB, created by
Marcel de Rooy
on 2011-02-24 13:17:43 UTC
(
hide
)
Description:
Squashed commit
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2011-02-24 13:17:43 UTC
Size:
11.03 KB
patch
obsolete
>From 7931c58b843ae1d6c8e7cd82c65d6a885c9f3615 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Thu, 24 Feb 2011 14:05:32 +0100 >Subject: [PATCH] Squashed commit of the following: >Content-Type: text/plain; charset="utf-8" > >commit af0e18a3b28f736f8493162463621b9929547d35 >Author: Owen Leonard <oleonard@myacpl.org> >Date: Fri Dec 31 14:49:44 2010 -0500 > > Removing markup from incorrect merge > >commit adb048eabc3929872d724841f152a1948d5b842a >Author: dev3 <dev3@debKOHA2.corporate.ptfs.com> >Date: Wed May 5 23:50:29 2010 -0400 > > port this feature from checkout page onto details page. > >commit 9557c0c82faf86cb61a18483c4cf36170fc85a18 >Author: J. David Bavousett <dbavousett@ptfs.com> >Date: Wed May 5 23:34:28 2010 -0400 > > Fixed derangement of procedural call > >commit c0b0f5178e042566430f0fb053e0899e5b5cf535 >Author: PTFS <koha-dev@ptfs.com> >Date: Fri Mar 13 19:44:42 2009 -0400 > > 3-1 Renewals List - detail in checkout screen shows total number of items renewed and number renewed via OPAC, if any. > > On the circ screen, if the patron has renewed an item via the opac, the number of > opac renewals is listed beside the total number of renewals. >--- > C4/Circulation.pm | 77 +++++++++++++++----- > circ/circulation.pl | 4 + > .../prog/en/modules/circ/circulation.tmpl | 4 +- > .../prog/en/modules/members/moremember.tmpl | 2 +- > members/moremember.pl | 5 ++ > opac/opac-renew.pl | 2 +- > 6 files changed, 71 insertions(+), 23 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index b741794..0e618c5 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -60,6 +60,7 @@ BEGIN { > push @EXPORT, qw( > &FixOverduesOnReturn > &barcodedecode >+ GetRenewalDetails > ); > > # subs to deal with issuing a book >@@ -2148,14 +2149,15 @@ from the book's item type. > =cut > > sub AddRenewal { >- my $borrowernumber = shift or return undef; >- my $itemnumber = shift or return undef; >- my $branch = shift; >- my $datedue = shift; >- my $lastreneweddate = shift || C4::Dates->new()->output('iso'); >+ my $borrowernumber = shift or return undef; >+ my $itemnumber = shift or return undef; >+ > my $item = GetItem($itemnumber) or return undef; > my $biblio = GetBiblioFromItemNumber($itemnumber) or return undef; >- >+ my $branch = (@_) ? shift : $item->{homebranch}; # opac-renew doesn't send branch >+ my $datedue = shift; >+ my $lastreneweddate = shift; >+ my $source = shift; > my $dbh = C4::Context->dbh; > # Find the issues record for this book > my $sth = >@@ -2166,25 +2168,33 @@ sub AddRenewal { > $sth->execute( $borrowernumber, $itemnumber ); > my $issuedata = $sth->fetchrow_hashref; > $sth->finish; >- if($datedue && ! $datedue->output('iso')){ >- warn "Invalid date passed to AddRenewal."; >- return undef; >- } >+ > # If the due date wasn't specified, calculate it by adding the >- # book's loan length to today's date or the current due date >- # based on the value of the RenewalPeriodBase syspref. >- unless ($datedue) { >+ # book's loan length to today's date. >+ unless ($datedue && $datedue->output('iso')) { > > my $borrower = C4::Members::GetMemberDetails( $borrowernumber, 0 ) or return undef; > my $loanlength = GetLoanLength( >- $borrower->{'categorycode'}, >- (C4::Context->preference('item-level_itypes')) ? $biblio->{'itype'} : $biblio->{'itemtype'} , >- $issuedata->{'branchcode'} ); # that's the circ control branch. >- >+ $borrower->{'categorycode'}, >+ (C4::Context->preference('item-level_itypes')) ? $biblio->{'itype'} : $biblio->{'itemtype'} , >+ $item->{homebranch} # item's homebranch determines loanlength OR do we want the branch specified by the AddRenewal argument? >+ ); >+ #FIXME -- use circControl? > $datedue = (C4::Context->preference('RenewalPeriodBase') eq 'date_due') ? > C4::Dates->new($issuedata->{date_due}, 'iso') : > C4::Dates->new(); >- $datedue = CalcDateDue($datedue,$loanlength,$issuedata->{'branchcode'},$borrower); >+ $datedue = CalcDateDue(C4::Dates->new(),$loanlength,$branch); # this branch is the transactional branch. >+ # The question of whether to use item's homebranch calendar is open. >+ } >+ >+ # $lastreneweddate defaults to today. >+ unless (defined $lastreneweddate) { >+ $lastreneweddate = strftime( "%Y-%m-%d", localtime ); >+ } >+ >+ if($datedue && ! $datedue->output('iso')){ >+ warn "Invalid date passed to AddRenewal."; >+ return undef; > } > > # Update the issues record to have the new due date, and a new count >@@ -2221,7 +2231,7 @@ sub AddRenewal { > $sth->finish; > } > # Log the renewal >- UpdateStats( $branch, 'renew', $charge, '', $itemnumber, $item->{itype}, $borrowernumber); >+ UpdateStats( $branch, 'renew', $charge, $source, $itemnumber, $item->{itype}, $borrowernumber); > return $datedue; > } > >@@ -2397,6 +2407,35 @@ sub GetTransfersFromTo { > return (@gettransfers); > } > >+=head2 GetRenewalDetails >+ >+( $intranet_renewals, $opac_renewals ) = GetRenewalDetails( $itemnumber, $renewals_limit ); >+ >+Returns the number of renewals through intranet and opac for the given itemnumber, limited by $renewals_limit >+ >+=cut >+ >+sub GetRenewalDetails { >+ my ( $itemnumber, $renewals_limit ) = @_; >+ my $dbh = C4::Context->dbh; >+ my $query = "SELECT * FROM statistics WHERE type = 'renew' AND itemnumber = ? ORDER BY datetime DESC LIMIT ?"; >+ my $sth = $dbh->prepare($query); >+ $sth->execute( $itemnumber, $renewals_limit ); >+ >+ my $renewals_intranet = 0; >+ my $renewals_opac = 0; >+ >+ while ( my $data = $sth->fetchrow_hashref ) { >+ if ( $data->{'other'} eq 'opac' ) { >+ $renewals_opac++; >+ } else { >+ $renewals_intranet++; >+ } >+ } >+ >+ return ( $renewals_intranet, $renewals_opac ); >+} >+ > =head2 DeleteTransfer > > &DeleteTransfer($itemnumber); >diff --git a/circ/circulation.pl b/circ/circulation.pl >index ab681f1..8feaede 100755 >--- a/circ/circulation.pl >+++ b/circ/circulation.pl >@@ -454,6 +454,10 @@ if ($borrower) { > ($it->{'author'} eq '') and $it->{'author'} = ' '; > $it->{'renew_failed'} = $renew_failed{$it->{'itemnumber'}}; > >+ if ( $it->{'renewals'} ) { >+ ( $it->{'renewals_intranet'}, $it->{'renewals_opac'} ) = GetRenewalDetails( $it->{'itemnumber'}, $it->{'renewals'} ); >+ } >+ > if ( $todaysdate eq $it->{'issuedate'} or $todaysdate eq $it->{'lastreneweddate'} ) { > push @todaysissues, $it; > } else { >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl >index 9663e02..16b9376 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl >@@ -659,7 +659,7 @@ No patron matched <span class="ex"><!-- TMPL_VAR name="message" --></span> > <!-- TMPL_IF NAME="renew_failed" --> > <td class="problem">Renewal Failed</td> > <!-- TMPL_ELSE --> >- <td><span style="padding: 0 1em;"><!-- TMPL_IF NAME="renewals" --><!-- TMPL_VAR NAME="renewals" --><!-- TMPL_ELSE -->0<!-- /TMPL_IF --></span> >+ <td><span style="padding: 0 1em;"><!-- TMPL_IF NAME="renewals" --><!-- TMPL_VAR NAME="renewals" --> <!-- TMPL_IF NAME="renewals_opac" -->( <!-- TMPL_VAR NAME="renewals_opac" --> via OPAC ) <!-- /TMPL_IF --><!-- TMPL_ELSE -->0<!-- /TMPL_IF --></span> > <!-- TMPL_IF NAME="can_renew" --> > <input type="checkbox" name="all_items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" checked="checked" style="display: none;" /> > <!-- TMPL_IF NAME="od" --> >@@ -726,7 +726,7 @@ No patron matched <span class="ex"><!-- TMPL_VAR name="message" --></span> > <!-- TMPL_IF NAME="renew_failed" --> > <td class="problem">Renewal Failed</td> > <!-- TMPL_ELSE --> >- <td><span style="padding: 0 1em;"><!-- TMPL_IF NAME="renewals" --><!-- TMPL_VAR NAME="renewals" --><!-- TMPL_ELSE -->0<!-- /TMPL_IF --></span> >+ <td><span style="padding: 0 1em;"><!-- TMPL_IF NAME="renewals" --><!-- TMPL_VAR NAME="renewals" --> <!-- TMPL_IF NAME="renewals_opac" -->( <!-- TMPL_VAR NAME="renewals_opac" --> via OPAC ) <!-- /TMPL_IF --><!-- TMPL_ELSE -->0<!-- /TMPL_IF --></span> > <!-- TMPL_IF NAME="can_renew" --> > <input type="checkbox" name="all_items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" checked="checked" style="display: none;" /> > <!-- TMPL_IF NAME="od" --> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tmpl >index 030c78a..783ee19 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tmpl >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tmpl >@@ -437,7 +437,7 @@ function validate1(date) { > <!-- TMPL_IF NAME="renew_failed" --> > <td class="problem">Renewal Failed</td> > <!-- TMPL_ELSE --> >- <td><span style="padding: 0 1em;"><!-- TMPL_IF NAME="renewals" --><!-- TMPL_VAR NAME="renewals" --><!-- TMPL_ELSE -->0<!-- /TMPL_IF --></span> >+ <td><span style="padding: 0 1em;"><!-- TMPL_IF NAME="renewals" --><!-- TMPL_VAR NAME="renewals" --> <!-- TMPL_IF NAME="renewals_opac" -->( <!-- TMPL_VAR NAME="renewals_opac" --> via OPAC ) <!-- /TMPL_IF --><!-- TMPL_ELSE -->0<!-- /TMPL_IF --></span> > <!-- TMPL_IF name="norenew" --> > <!-- TMPL_IF NAME="can_confirm" --><span class="renewals-allowed" style="display: none"> > <input type="checkbox" name="all_items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" checked="checked" style="display: none;" /> >diff --git a/members/moremember.pl b/members/moremember.pl >index aa8165b..0bef49a 100755 >--- a/members/moremember.pl >+++ b/members/moremember.pl >@@ -291,6 +291,11 @@ for ( my $i = 0 ; $i < $issuecount ; $i++ ) { > > $row{'charge'} = sprintf( "%.2f", $charge ); > >+ if ( $row{'renewals'} ) { >+ ( $row{'renewals_intranet'}, $row{'renewals_opac'} ) = GetRenewalDetails( $row{'itemnumber'}, $row{'renewals'} ); >+ } >+ >+ > my ( $renewokay,$renewerror ) = CanBookBeRenewed( $borrowernumber, $issue->[$i]{'itemnumber'}, $override_limit ); > $row{'norenew'} = !$renewokay; > $row{'can_confirm'} = ( !$renewokay && $renewerror ne 'on_reserve' ); >diff --git a/opac/opac-renew.pl b/opac/opac-renew.pl >index 205f48a..489a182 100755 >--- a/opac/opac-renew.pl >+++ b/opac/opac-renew.pl >@@ -30,7 +30,7 @@ my $opacrenew = C4::Context->preference("OpacRenewalAllowed"); > for my $itemnumber ( @items ) { > my ($status,$error) = CanBookBeRenewed( $borrowernumber, $itemnumber ); > if ( $status == 1 && $opacrenew == 1 ) { >- AddRenewal( $borrowernumber, $itemnumber ); >+ AddRenewal( $borrowernumber, $itemnumber, '', '', '', my $source = 'opac' ); > } > } > # FIXME: else return ERROR to user!! >-- >1.6.0.6 >
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 3483
:
1346
|
3203
|
3204
|
3206