From c5c83ed8d7235a773617688d088d74c88ce5c05d Mon Sep 17 00:00:00 2001
From: Nahuel ANGELINETTI
+ &order=issuestimestamp&limit=">Date + | &order=title&limit=">Title | @@ -42,21 +45,20 @@||||||||
---|---|---|---|---|---|---|---|---|---|
+ | + + | +"> | -- | +- | - | +- | - | +diff --git a/members/readingrec.pl b/members/readingrec.pl index 076b1a4325..b899ac17f9 100755 --- a/members/readingrec.pl +++ b/members/readingrec.pl @@ -29,6 +29,8 @@ use C4::Auth; use C4::Output; use C4::Members; use C4::Branch; +use List::MoreUtils qw/any/; + use C4::Dates qw/format_date/; my $input = CGI->new; @@ -54,6 +56,17 @@ if ($order2 eq ''){ $order2="date_due desc"; } my $limit=$input->param('limit'); +======= +my $borrowernumber = $input->param('borrowernumber'); +my $limit = $input->param('limit'); +my $order = $input->param('order') || ''; + +$order = "issuestimestamp desc" if not any { $order =~ $_ } ('issuestimestamp', 'title', 'author', 'returndate'); + +#get borrower details +my $data=GetMember('borrowernumber'=>$borrowernumber); + +>>>>>>> (MT #2920) fix reading record scripts:members/readingrec.pl if ($limit){ if ($limit eq 'full'){ @@ -63,7 +76,7 @@ if ($limit){ else { $limit=50; } -my ($count,$issues)=GetAllIssues($borrowernumber,$order2,$limit); +my ( $issues ) = GetAllIssues($borrowernumber,$order,$limit); my ($template, $loggedinuser, $cookie) = get_template_and_user({template_name => "members/readingrec.tmpl", @@ -76,18 +89,19 @@ my ($template, $loggedinuser, $cookie) my @loop_reading; -for (my $i=0;$i<$count;$i++){ +foreach my $issue (@{$issues}){ my %line; - $line{biblionumber}=$issues->[$i]->{'biblionumber'}; - $line{title}=$issues->[$i]->{'title'}; - $line{author}=$issues->[$i]->{'author'}; - $line{classification} = $issues->[$i]->{'classification'} || $issues->[$i]->{'itemcallnumber'}; - $line{date_due}=format_date($issues->[$i]->{'date_due'}); - $line{returndate}=format_date($issues->[$i]->{'returndate'}); - $line{issuedate}=format_date($issues->[$i]->{'issuedate'}); - $line{renewals}=$issues->[$i]->{'renewals'}; - $line{barcode}=$issues->[$i]->{'barcode'}; - $line{volumeddesc}=$issues->[$i]->{'volumeddesc'}; + $line{issuestimestamp} = format_date($issue->{'issuestimestamp'}); + $line{biblionumber} = $issue->{'biblionumber'}; + $line{title} = $issue->{'title'}; + $line{author} = $issue->{'author'}; + $line{classification} = $issue->{'classification'} || $issue->{'itemcallnumber'}; + $line{date_due} = format_date($issue->{'date_due'}); + $line{returndate} = format_date($issue->{'returndate'}); + $line{issuedate} = format_date($issue->{'issuedate'}); + $line{renewals} = $issue->{'renewals'}; + $line{barcode} = $issue->{'barcode'}; + $line{volumeddesc} = $issue->{'volumeddesc'}; push(@loop_reading,\%line); } @@ -130,7 +144,7 @@ $template->param( branchcode => $data->{'branchcode'}, is_child => ($data->{'category_type'} eq 'C'), branchname => GetBranchName($data->{'branchcode'}), - showfulllink => ($count > 50), + showfulllink => (scalar @loop_reading > 50), loop_reading => \@loop_reading); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/opac/opac-readingrecord.pl b/opac/opac-readingrecord.pl index b09a78b9c7..21a90b61ef 100755 --- a/opac/opac-readingrecord.pl +++ b/opac/opac-readingrecord.pl @@ -72,7 +72,7 @@ else { $limit = 50; } -my ( $count, $issues ) = GetAllIssues( $borrowernumber, $order, $limit ); +my ( $issues ) = GetAllIssues( $borrowernumber, $order, $limit ); my @bordat; $bordat[0] = $borr; @@ -80,14 +80,15 @@ $template->param( BORROWER_INFO => \@bordat ); my @loop_reading; -for ( my $i = 0 ; $i < $count ; $i++ ) { +foreach my $issue (@{$issues} ) { my %line; my $record = GetMarcBiblio($issues->[$i]->{'biblionumber'}); # XISBN Stuff - my $isbn = GetNormalizedISBN($issues->[$i]->{'isbn'}); + my $isbn = GetNormalizedISBN($issue->{'isbn'}); $line{normalized_isbn} = $isbn; +<<<<<<< HEAD:opac/opac-readingrecord.pl $line{biblionumber} = $issues->[$i]->{'biblionumber'}; $line{title} = $issues->[$i]->{'title'}; $line{author} = $issues->[$i]->{'author'}; @@ -100,6 +101,17 @@ for ( my $i = 0 ; $i < $count ; $i++ ) { $line{'itypedescription'} = $itemtypes->{ $issues->[$i]->{'itemtype'} }->{'description'}; $line{imageurl} = getitemtypeimagelocation( 'opac', $itemtypes->{ $issues->[$i]->{'itemtype'} }->{'imageurl'} ); } +======= + $line{biblionumber} = $issue->{'biblionumber'}; + $line{title} = $issue->{'title'}; + $line{author} = $issue->{'author'}; + $line{itemcallnumber} = $issue->{'itemcallnumber'}; + $line{date_due} = format_date( $issue->{'date_due'} ); + $line{returndate} = format_date( $issue->{'returndate'} ); + $line{volumeddesc} = $issue->{'volumeddesc'}; + $line{'description'} = $itemtypes->{ $issue->{'itemtype'} }->{'description'}; + $line{imageurl} = getitemtypeimagelocation( 'opac', $itemtypes->{ $issue->{'itemtype'} }->{'imageurl'} ); +>>>>>>> (MT #2920) fix reading record scripts:opac/opac-readingrecord.pl push( @loop_reading, \%line ); $line{subtitle} = GetRecordValue('subtitle', $record, GetFrameworkCode($issues->[$i]->{'biblionumber'})); } @@ -128,11 +140,11 @@ for(qw(AmazonCoverImages GoogleJackets)) { # BakerTaylorEnabled handled above } $template->param( - count => $count, READING_RECORD => \@loop_reading, limit => $limit, showfulllink => 1, - readingrecview => 1 + readingrecview => 1, + count => scalar @loop_reading, ); -output_html_with_http_headers $query, $cookie, $template->output; \ No newline at end of file +output_html_with_http_headers $query, $cookie, $template->output; -- 2.39.5 |