Bug 8129 - Quickslips not printing
[koha.git] / C4 / Members.pm
index f5be65e..ce54952 100644 (file)
@@ -998,7 +998,6 @@ sub GetPendingIssues {
     # must avoid biblioitems.* to prevent large marc and marcxml fields from killing performance
     # FIXME: namespace collision: each table has "timestamp" fields.  Which one is "timestamp" ?
     # FIXME: circ/ciculation.pl tries to sort by timestamp!
-    # FIXME: C4::Print::printslip tries to sort by timestamp!
     # FIXME: namespace collision: other collisions possible.
     # FIXME: most of this data isn't really being used by callers.
     my $query =
@@ -1185,6 +1184,11 @@ sub GetBorNotifyAcctRecord {
     $sth->execute( $borrowernumber, $notifyid );
     my $total = 0;
     while ( my $data = $sth->fetchrow_hashref ) {
+        if ( $data->{itemnumber} ) {
+            my $biblio = GetBiblioFromItemNumber( $data->{itemnumber} );
+            $data->{biblionumber} = $biblio->{biblionumber};
+            $data->{title}        = $biblio->{title};
+        }
         $acctlines[$numlines] = $data;
         $numlines++;
         $total += int(100 * $data->{'amountoutstanding'});
@@ -2275,14 +2279,14 @@ sub IssueSlip {
 
 #   return unless ( C4::Context->boolean_preference('printcirculationslips') );
 
-    my $today       = POSIX::strftime("%Y-%m-%d", localtime);
+    my $now       = POSIX::strftime("%Y-%m-%d", localtime);
 
     my $issueslist = GetPendingIssues($borrowernumber);
     foreach my $it (@$issueslist){
-        if ($it->{'issuedate'} eq $today) {
-            $it->{'today'} = 1;
+        if ((substr $it->{'issuedate'}, 0, 10) eq $now) {
+            $it->{'now'} = 1;
         }
-        elsif ($it->{'date_due'} le $today) {
+        elsif ((substr $it->{'date_due'}, 0, 10) le $now) {
             $it->{'overdue'} = 1;
         }
 
@@ -2298,7 +2302,7 @@ sub IssueSlip {
                 'biblio' => $_,
                 'items'  => $_,
                 'issues' => $_,
-            }, grep { $_->{'today'} } @issues ],
+            }, grep { $_->{'now'} } @issues ],
         );
     }
     else {