Bugzilla – Attachment 70352 Details for
Bug 19935
Move C4::Members::GetPendingIssues to the Koha namespace
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19935: Replace GetPendingIssues - IssueSlip
Bug-19935-Replace-GetPendingIssues---IssueSlip.patch (text/plain), 4.98 KB, created by
Jonathan Druart
on 2018-01-09 14:31:19 UTC
(
hide
)
Description:
Bug 19935: Replace GetPendingIssues - IssueSlip
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2018-01-09 14:31:19 UTC
Size:
4.98 KB
patch
obsolete
>From 019d59e6764bd07f64ef5bc651a79e637a3f2ceb Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 8 Jan 2018 15:49:18 -0300 >Subject: [PATCH] Bug 19935: Replace GetPendingIssues - IssueSlip > >Luckily we have a good test coverage here! > >Test plan: >Print issue slips before and after these patches (with overdues, etc.) >They should be the same. >--- > C4/Members.pm | 95 +++++++++++++++++++++++++++++++++++------------------------ > 1 file changed, 56 insertions(+), 39 deletions(-) > >diff --git a/C4/Members.pm b/C4/Members.pm >index 5332f44ebb..c56f142ead 100644 >--- a/C4/Members.pm >+++ b/C4/Members.pm >@@ -944,56 +944,73 @@ sub IssueSlip { > my $patron = Koha::Patrons->find( $borrowernumber ); > return unless $patron; > >- my @issues = @{ GetPendingIssues($borrowernumber) }; >- >- for my $issue (@issues) { >- $issue->{date_due} = $issue->{date_due_sql}; >- if ($quickslip) { >- my $today = output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }); >- if ( substr( $issue->{issuedate}, 0, 10 ) eq $today >- or substr( $issue->{lastreneweddate}, 0, 10 ) eq $today ) { >- $issue->{now} = 1; >- }; >- } >- } >- >- # Sort on timestamp then on issuedate then on issue_id >- # useful for tests and could be if modified in a batch >- @issues = sort { >- $b->{timestamp} <=> $a->{timestamp} >- or $b->{issuedate} <=> $a->{issuedate} >- or $b->{issue_id} <=> $a->{issue_id} >- } @issues; >+ my $pending_checkouts = $patron->pending_checkouts; # Should be $patron->checkouts->pending? > > my ($letter_code, %repeat, %loops); > if ( $quickslip ) { >+ my $today_start = dt_from_string->set( hour => 0, minute => 0, second => 0 ); >+ my $today_end = dt_from_string->set( hour => 23, minute => 59, second => 0 ); >+ $today_start = Koha::Database->new->schema->storage->datetime_parser->format_datetime( $today_start ); >+ $today_end = Koha::Database->new->schema->storage->datetime_parser->format_datetime( $today_end ); > $letter_code = 'ISSUEQSLIP'; >- my @checkouts = map { >- 'biblio' => $_, >- 'items' => $_, >- 'biblioitems' => $_, >- 'issues' => $_, >- }, grep { $_->{'now'} } @issues; >+ >+ # issue date or lastreneweddate is today >+ my $todays_checkouts = $pending_checkouts->search( >+ { >+ -or => { >+ issuedate => { >+ '>=' => $today_start, >+ '<=' => $today_end, >+ }, >+ lastreneweddate => >+ { '>=' => $today_start, '<=' => $today_end, } >+ } >+ } >+ ); >+ my @checkouts; >+ while ( my $c = $todays_checkouts->next ) { >+ my $all = $c->unblessed_all_relateds; >+ push @checkouts, { >+ biblio => $all, >+ items => $all, >+ biblioitems => $all, >+ issues => $all, >+ }; >+ } >+ > %repeat = ( >- checkedout => \@checkouts, # History syntax >+ checkedout => \@checkouts, # Historical syntax > ); > %loops = ( > issues => [ map { $_->{issues}{itemnumber} } @checkouts ], # TT syntax > ); > } > else { >- my @checkouts = map { >- 'biblio' => $_, >- 'items' => $_, >- 'biblioitems' => $_, >- 'issues' => $_, >- }, grep { !$_->{'overdue'} } @issues; >- my @overdues = map { >- 'biblio' => $_, >- 'items' => $_, >- 'biblioitems' => $_, >- 'issues' => $_, >- }, grep { $_->{'overdue'} } @issues; >+ my $today = Koha::Database->new->schema->storage->datetime_parser->format_datetime( dt_from_string ); >+ # Checkouts due in the future >+ my $checkouts = $pending_checkouts->search({ date_due => { '>' => $today } }); >+ my @checkouts; my @overdues; >+ while ( my $c = $checkouts->next ) { >+ my $all = $c->unblessed_all_relateds; >+ push @checkouts, { >+ biblio => $all, >+ items => $all, >+ biblioitems => $all, >+ issues => $all, >+ }; >+ } >+ >+ # Checkouts due in the past are overdues >+ my $overdues = $pending_checkouts->search({ date_due => { '<=' => $today } }); >+ while ( my $o = $overdues->next ) { >+ my $all = $o->unblessed_all_relateds; >+ push @overdues, { >+ biblio => $all, >+ items => $all, >+ biblioitems => $all, >+ issues => $all, >+ }; >+ } > my $news = GetNewsToDisplay( "slip", $branch ); > my @news = map { > $_->{'timestamp'} = $_->{'newdate'}; >-- >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 19935
:
70351
|
70352
|
70353
|
70354
|
70355
|
70356
|
70357
|
70358
|
70359
|
70360
|
70361
|
71807
|
71808
|
71809
|
71810
|
71811
|
71812
|
71813
|
72752
|
72753
|
72754
|
72755
|
72756
|
72757
|
72758
|
72759
|
72760
|
72761
|
72762
|
73557
|
73558
|
73559
|
73560
|
73561
|
73562
|
73563
|
73564
|
73565
|
73566
|
73567
|
73568
|
73569
|
73570
|
73571
|
73572
|
73573
|
73574
|
73575
|
73576
|
73577
|
73578
|
73579
|
73580
|
73581
|
73582