Bugzilla – Attachment 33764 Details for
Bug 13315
Add feedback for last item checked out to circulation.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13315 - Add feedback for last item checked out to circulation.pl
Bug-13315---Add-feedback-for-last-item-checked-out.patch (text/plain), 9.83 KB, created by
Kyle M Hall (khall)
on 2014-11-20 18:40:00 UTC
(
hide
)
Description:
Bug 13315 - Add feedback for last item checked out to circulation.pl
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2014-11-20 18:40:00 UTC
Size:
9.83 KB
patch
obsolete
>From 18814771d353f3d94ae9215e1d5865b6f7692c92 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Thu, 20 Nov 2014 12:39:21 -0500 >Subject: [PATCH] Bug 13315 - Add feedback for last item checked out to circulation.pl > >It seems that many librarians find it disconcerting to have no feedback >with the new checkouts table. It seems that many of them wait for it to >fully load, check to verify the item was checked out, and only then >check out the next item. > >To help alleviate this issue, we can have the checkouts page give >feedback about the item that was just checked out. > >Test Plan: >1) Apply this patch >2) Check an item out >3) Note the message "$title ($barcode) due on $date_due" >--- > C4/Circulation.pm | 29 +++++++++---------- > C4/SIP/ILS/Transaction/Checkout.pm | 4 ++- > C4/SIP/ILS/Transaction/Renew.pm | 5 +++- > circ/circulation.pl | 3 +- > .../prog/en/modules/circ/circulation.tt | 4 +++ > t/db_dependent/Circulation.t | 18 +++++++----- > t/db_dependent/rollingloans.t | 5 ++- > 7 files changed, 41 insertions(+), 27 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 062b165..ecc0a1e 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -1193,6 +1193,8 @@ sub AddIssue { > my $dbh = C4::Context->dbh; > my $barcodecheck=CheckValidBarcode($barcode); > >+ my $issue; >+ > if ($datedue && ref $datedue ne 'DateTime') { > $datedue = dt_from_string($datedue); > } >@@ -1263,12 +1265,6 @@ sub AddIssue { > } > > # Record in the database the fact that the book was issued. >- my $sth = >- $dbh->prepare( >- "INSERT INTO issues >- (borrowernumber, itemnumber,issuedate, date_due, branchcode, onsite_checkout, auto_renew) >- VALUES (?,?,?,?,?,?,?)" >- ); > unless ($datedue) { > my $itype = ( C4::Context->preference('item-level_itypes') ) ? $biblio->{'itype'} : $biblio->{'itemtype'}; > $datedue = CalcDateDue( $issuedate, $itype, $branch, $borrower ); >@@ -1276,15 +1272,18 @@ sub AddIssue { > } > $datedue->truncate( to => 'minute'); > >- $sth->execute( >- $borrower->{'borrowernumber'}, # borrowernumber >- $item->{'itemnumber'}, # itemnumber >- $issuedate->strftime('%Y-%m-%d %H:%M:%S'), # issuedate >- $datedue->strftime('%Y-%m-%d %H:%M:%S'), # date_due >- C4::Context->userenv->{'branch'}, # branchcode >- $onsite_checkout, >- $auto_renew ? 1 : 0 # automatic renewal >+ $issue = Koha::Database->new()->schema()->resultset('Issue')->create( >+ { >+ borrowernumber => $borrower->{'borrowernumber'}, >+ itemnumber => $item->{'itemnumber'}, >+ issuedate => $issuedate->strftime('%Y-%m-%d %H:%M:%S'), >+ date_due => $datedue->strftime('%Y-%m-%d %H:%M:%S'), >+ branchcode => C4::Context->userenv->{'branch'}, >+ onsite_checkout => $onsite_checkout, >+ auto_renew => $auto_renew ? 1 : 0 >+ } > ); >+ > if ( C4::Context->preference('ReturnToShelvingCart') ) { ## ReturnToShelvingCart is on, anything issued should be taken off the cart. > CartToShelf( $item->{'itemnumber'} ); > } >@@ -1354,7 +1353,7 @@ sub AddIssue { > logaction("CIRCULATION", "ISSUE", $borrower->{'borrowernumber'}, $biblio->{'itemnumber'}) > if C4::Context->preference("IssueLog"); > } >- return ($datedue); # not necessarily the same as when it came in! >+ return $issue; > } > > =head2 GetLoanLength >diff --git a/C4/SIP/ILS/Transaction/Checkout.pm b/C4/SIP/ILS/Transaction/Checkout.pm >index edc1d04..58a8205 100644 >--- a/C4/SIP/ILS/Transaction/Checkout.pm >+++ b/C4/SIP/ILS/Transaction/Checkout.pm >@@ -20,6 +20,7 @@ use C4::Circulation; > use C4::Members; > use C4::Reserves qw(ModReserveFill); > use C4::Debug; >+use Koha::DateUtils; > use parent qw(ILS::Transaction); > > our $debug; >@@ -125,7 +126,8 @@ sub do_checkout { > $debug and warn "do_checkout: calling AddIssue(\$borrower,$barcode, $overridden_duedate, 0)\n" > # . "w/ \$borrower: " . Dumper($borrower) > . "w/ C4::Context->userenv: " . Dumper(C4::Context->userenv); >- my $due_dt = AddIssue($borrower, $barcode, $overridden_duedate, 0); >+ my $issue = AddIssue( $borrower, $barcode, $overridden_duedate, 0 ); >+ my $due_dt = dt_from_string( $issue->date_due() ); > if ($due_dt) { > $self->{due} = $due_dt->clone(); > } else { >diff --git a/C4/SIP/ILS/Transaction/Renew.pm b/C4/SIP/ILS/Transaction/Renew.pm >index aa300d4..b44516c 100644 >--- a/C4/SIP/ILS/Transaction/Renew.pm >+++ b/C4/SIP/ILS/Transaction/Renew.pm >@@ -12,6 +12,8 @@ use ILS; > use C4::Circulation; > use C4::Members; > >+use Koha::DateUtils; >+ > use parent qw(ILS::Transaction); > > my %fields = ( >@@ -36,7 +38,8 @@ sub do_renew_for { > my ($renewokay,$renewerror) = CanBookBeRenewed($borrower->{borrowernumber},$self->{item}->{itemnumber}); > if ($renewokay){ > $self->{due} = undef; >- my $due_date = AddIssue( $borrower, $self->{item}->id, undef, 0 ); >+ my $issue = AddIssue( $borrower, $self->{item}->id, undef, 0 ); >+ my $due_date = dt_from_string( $issue->date_due() ); > if ($due_date) { > $self->{due} = $due_date; > } >diff --git a/circ/circulation.pl b/circ/circulation.pl >index 6e9f449..61ea4f0 100755 >--- a/circ/circulation.pl >+++ b/circ/circulation.pl >@@ -372,7 +372,8 @@ if ($barcode) { > } > } > unless($confirm_required) { >- AddIssue( $borrower, $barcode, $datedue, $cancelreserve, undef, undef, { onsite_checkout => $onsite_checkout, auto_renew => $session->param('auto_renew') } ); >+ my $issue = AddIssue( $borrower, $barcode, $datedue, $cancelreserve, undef, undef, { onsite_checkout => $onsite_checkout, auto_renew => $session->param('auto_renew') } ); >+ $template->param( issue => $issue ); > $session->clear('auto_renew'); > $inprocess = 1; > } >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >index b938724..576066d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >@@ -752,6 +752,10 @@ No patron matched <span class="ex">[% message %]</span> > > </div> > </div> >+[% IF ( issue ) %] >+ <div class="dialog message">[% issue.item.biblio.title %] ([% issue.item.barcode %]) due on [% issue.date_due | $KohaDates %]</div> >+[% END %] >+ > > <div class="yui-g"><div id="patronlists" class="toptabs"> > >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index 58dbc2b..f6cefcc 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -270,11 +270,13 @@ C4::Context->dbh->do("DELETE FROM accountlines"); > my $checkitem = undef; > my $found = undef; > >- my $datedue = AddIssue( $renewing_borrower, $barcode); >- is (defined $datedue, 1, "Item 1 checked out, due date: $datedue"); >+ my $issue = AddIssue( $renewing_borrower, $barcode); >+ my $datedue = dt_from_string( $issue->date_due() ); >+ is (defined $issue->date_due(), 1, "Item 1 checked out, due date: " . $issue->date_due() ); > >- my $datedue2 = AddIssue( $renewing_borrower, $barcode2); >- is (defined $datedue2, 1, "Item 2 checked out, due date: $datedue2"); >+ my $issue2 = AddIssue( $renewing_borrower, $barcode2); >+ my $datedue = dt_from_string( $issue->date_due() ); >+ is (defined $issue2, 1, "Item 2 checked out, due date: " . $issue2->date_due()); > > my $borrowing_borrowernumber = GetItemIssue($itemnumber)->{borrowernumber}; > is ($borrowing_borrowernumber, $renewing_borrowernumber, "Item checked out to $renewing_borrower->{firstname} $renewing_borrower->{surname}"); >@@ -494,8 +496,10 @@ C4::Context->dbh->do("DELETE FROM accountlines"); > my $two_days_ahead = DateTime->today(time_zone => C4::Context->tz())->add( days => 2 ); > my $today = DateTime->today(time_zone => C4::Context->tz()); > >- my $datedue = AddIssue( $a_borrower, $barcode, $yesterday ); >- my $datedue2 = AddIssue( $a_borrower, $barcode2, $two_days_ahead ); >+ my $issue = AddIssue( $a_borrower, $barcode, $yesterday ); >+ my $datedue = dt_from_string( $issue->date_due() ); >+ my $issue2 = AddIssue( $a_borrower, $barcode2, $two_days_ahead ); >+ my $datedue2 = dt_from_string( $issue->date_due() ); > > my $upcoming_dues; > >@@ -517,7 +521,7 @@ C4::Context->dbh->do("DELETE FROM accountlines"); > > # Bug 11218 - Due notices not generated - GetUpcomingDueIssues needs to select due today items as well > >- my $datedue3 = AddIssue( $a_borrower, $barcode3, $today ); >+ my $issue3 = AddIssue( $a_borrower, $barcode3, $today ); > > $upcoming_dues = C4::Circulation::GetUpcomingDueIssues( { days_in_advance => -1 } ); > is ( scalar ( @$upcoming_dues), 0, "Overdues can not be selected" ); >diff --git a/t/db_dependent/rollingloans.t b/t/db_dependent/rollingloans.t >index 55fa58b..2b6ca50 100644 >--- a/t/db_dependent/rollingloans.t >+++ b/t/db_dependent/rollingloans.t >@@ -6,6 +6,7 @@ use C4::Context; > use C4::Circulation; > use C4::Members; > use C4::Items; >+use Koha::DateUtils; > > use Test::More tests => 8; > C4::Context->_new_userenv(1234567); >@@ -42,8 +43,8 @@ sub try_issue { > my $issuedate = '2011-05-16'; > my $borrower = GetMemberDetails(0, $cardnumber); > my ($issuingimpossible,$needsconfirmation) = CanBookBeIssued( $borrower, $item ); >- my $due_date = AddIssue($borrower, $item, undef, 0, $issuedate); >- return $due_date; >+ my $issue = AddIssue($borrower, $item, undef, 0, $issuedate); >+ return dt_from_string( $issue->due_date() ); > } > > sub try_return { >-- >1.7.2.5
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 13315
:
33764
|
33765
|
34250
|
34251
|
34253
|
34254
|
34384
|
34385
|
36290
|
36291
|
36292
|
37776