View | Details | Raw Unified | Return to bug 8017
Collapse All | Expand All

(-)a/C4/Members.pm (-13 / +6 lines)
Lines 1072-1081 C<items> tables of the Koha database. Link Here
1072
sub GetAllIssues {
1072
sub GetAllIssues {
1073
    my ( $borrowernumber, $order, $limit ) = @_;
1073
    my ( $borrowernumber, $order, $limit ) = @_;
1074
1074
1075
    #FIXME: sanity-check order and limit
1075
    my $dbh = C4::Context->dbh;
1076
    my $dbh   = C4::Context->dbh;
1077
    my $query =
1076
    my $query =
1078
  "SELECT *, issues.timestamp as issuestimestamp, issues.renewals AS renewals,items.renewals AS totalrenewals,items.timestamp AS itemstimestamp 
1077
'SELECT *, issues.timestamp as issuestimestamp, issues.renewals AS renewals,items.renewals AS totalrenewals,items.timestamp AS itemstimestamp
1079
  FROM issues 
1078
  FROM issues 
1080
  LEFT JOIN items on items.itemnumber=issues.itemnumber
1079
  LEFT JOIN items on items.itemnumber=issues.itemnumber
1081
  LEFT JOIN biblio ON items.biblionumber=biblio.biblionumber
1080
  LEFT JOIN biblio ON items.biblionumber=biblio.biblionumber
Lines 1088-1107 sub GetAllIssues { Link Here
1088
  LEFT JOIN biblio ON items.biblionumber=biblio.biblionumber
1087
  LEFT JOIN biblio ON items.biblionumber=biblio.biblionumber
1089
  LEFT JOIN biblioitems ON items.biblioitemnumber=biblioitems.biblioitemnumber
1088
  LEFT JOIN biblioitems ON items.biblioitemnumber=biblioitems.biblioitemnumber
1090
  WHERE borrowernumber=? AND old_issues.itemnumber IS NOT NULL
1089
  WHERE borrowernumber=? AND old_issues.itemnumber IS NOT NULL
1091
  order by $order";
1090
  order by ' . $order;
1092
    if ( $limit != 0 ) {
1091
    if ($limit) {
1093
        $query .= " limit $limit";
1092
        $query .= " limit $limit";
1094
    }
1093
    }
1095
1094
1096
    my $sth = $dbh->prepare($query);
1095
    my $sth = $dbh->prepare($query);
1097
    $sth->execute($borrowernumber, $borrowernumber);
1096
    $sth->execute( $borrowernumber, $borrowernumber );
1098
    my @result;
1097
    return $sth->fetchall_arrayref( {} );
1099
    my $i = 0;
1100
    while ( my $data = $sth->fetchrow_hashref ) {
1101
        push @result, $data;
1102
    }
1103
1104
    return \@result;
1105
}
1098
}
1106
1099
1107
1100
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt (-14 / +23 lines)
Lines 1-3 Link Here
1
[% USE KohaDates %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Circulation History for [% INCLUDE 'patron-title.inc' %]</title>
3
<title>Circulation History for [% INCLUDE 'patron-title.inc' %]</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'doc-head-close.inc' %]
Lines 26-32 Link Here
26
	<div class="yui-b">
27
	<div class="yui-b">
27
[% INCLUDE 'circ-toolbar.inc' %]
28
[% INCLUDE 'circ-toolbar.inc' %]
28
<h1>Circulation history</h1>
29
<h1>Circulation history</h1>
29
[% IF ( loop_reading ) %]
30
[% IF loop_reading %]
30
<form action="/cgi-bin/koha/members/readingrec.pl" method="get"><input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrowernumber %]" /></form>
31
<form action="/cgi-bin/koha/members/readingrec.pl" method="get"><input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrowernumber %]" /></form>
31
32
32
33
Lines 43-71 Link Here
43
    <th>Date due</th>
44
    <th>Date due</th>
44
    <th>Return date</th>
45
    <th>Return date</th>
45
</thead>
46
</thead>
46
[% FOREACH loop_readin IN loop_reading %]
47
[% FOREACH issue IN loop_reading %]
47
    [% IF ( loop_readin.returndate ) %]<tr>[% ELSE %]<tr class="onissue">[% END %]
48
    [% IF  issue.returndate  %]<tr>[% ELSE %]<tr class="onissue">[% END %]
48
        <td>
49
        <td>
49
            [% loop_readin.issuestimestamp %]
50
            [% issue.issuestimestamp | $KohaDates %]
50
        </td>
51
        </td>
51
        <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% loop_readin.biblionumber %]">[% loop_readin.title |html %]</a></td>
52
        <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% issue.biblionumber %]">[% issue.title |html %]</a></td>
52
53
53
        <td>[% loop_readin.author %]</td>
54
        <td>[% issue.author %]</td>
54
55
55
        <td>[% loop_readin.classification %]</td>
56
        <td>
57
            [% IF issue.classification %]
58
                [% issue.classification %]
59
            [% ELSE %]
60
                [% issue.itemcallnumber %]
61
            [% END %]
62
       </td>
56
63
57
        <td>[% loop_readin.barcode %]</td>
64
        <td>[% issue.barcode %]</td>
58
65
59
            <td>
66
            <td>
60
        [% loop_readin.renewals %]</td>
67
        [% issue.renewals %]</td>
61
            <td>
68
            <td>
62
        [% loop_readin.issuedate %]</td>
69
        [% issue.issuedate | $KohaDates %]</td>
63
            <td>
70
            <td>
64
        [% loop_readin.issuingbranch %]</td>
71
        [% issue.issuingbranch %]</td>
65
			<td>[% IF ( loop_readin.date_due ) %][% loop_readin.date_due %][% ELSE %]&nbsp;[% END %]</td>
72
			<td>[% IF issue.date_due %]
73
                    [% issue.date_due | $KohaDates %]
74
                [% ELSE %]&nbsp;[% END %]</td>
66
            <td>
75
            <td>
67
        [% IF ( loop_readin.returndate ) %]
76
        [% IF  issue.returndate %]
68
            [% loop_readin.returndate %]
77
            [% issue.returndate | $KohaDates %]
69
        [% ELSE %]
78
        [% ELSE %]
70
            Checked Out
79
            Checked Out
71
        [% END %]
80
        [% END %]
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-readingrecord.tt (-19 / +54 lines)
Lines 26-32 $(document).ready(function(){ Link Here
26
<!--CONTENT-->
26
<!--CONTENT-->
27
<h3><a href="/cgi-bin/koha/opac-user.pl">[% firstname %] [% surname %]'s account</a> <img src="[% themelang %]../../images/caret.gif" width="16" height="16" alt="&gt;" border="0" /> Checkout history</h3>
27
<h3><a href="/cgi-bin/koha/opac-user.pl">[% firstname %] [% surname %]'s account</a> <img src="[% themelang %]../../images/caret.gif" width="16" height="16" alt="&gt;" border="0" /> Checkout history</h3>
28
28
29
[% UNLESS ( count ) %]
29
[% IF READING_RECORD.size() == 0 %]
30
You have never borrowed anything from this library.
30
You have never borrowed anything from this library.
31
[% ELSE %]
31
[% ELSE %]
32
<div id="opac-user-readingrec" class="statictabs">
32
<div id="opac-user-readingrec" class="statictabs">
Lines 64-95 You have never borrowed anything from this library. Link Here
64
[% END %]
64
[% END %]
65
</tr>
65
</tr>
66
66
67
[% FOREACH READING_RECOR IN READING_RECORD %]
67
[% FOREACH issue IN READING_RECORD %]
68
68
69
[% UNLESS ( loop.odd ) %]<tr class="highlight">[% ELSE %]<tr>[% END %]
69
[% IF  loop.even  %]<tr class="highlight">[% ELSE %]<tr>[% END %]
70
<td>
70
<td>
71
[% IF ( OPACAmazonCoverImages ) %][% IF ( READING_RECOR.normalized_isbn ) %]<a href="http://www.amazon.com/gp/reader/[% READING_RECOR.normalized_isbn %]/ref=sib_dp_pt/002-7879865-0184864#reader-link"><img border="0" src="http://images.amazon.com/images/P/[% READING_RECOR.normalized_isbn %].01.THUMBZZZ.jpg" alt="Cover Image" /></a>[% ELSE %]<span class="no-image">No cover image available</span>[% END %][% END %]
71
[% IF  OPACAmazonCoverImages %]
72
    [% IF  issue.normalized_isbn %]
73
        <a href="http://www.amazon.com/gp/reader/[% issue.normalized_isbn %]/ref=sib_dp_pt/002-7879865-0184864#reader-link"><img border="0" src="http://images.amazon.com/images/P/[% issue.normalized_isbn %].01.THUMBZZZ.jpg" alt="Cover Image" /></a>
74
    [% ELSE %]
75
         <span class="no-image">No cover image available</span>
76
    [% END %]
77
[% END %]
72
78
73
    [% IF ( GoogleJackets ) %][% IF ( READING_RECOR.normalized_isbn ) %]<div style="block" title="[% READING_RECOR.biblionumber |url %]" class="[% READING_RECOR.normalized_isbn %]" id="gbs-thumbnail[% loop.count %]"></div>[% ELSE %]<span class="no-image">No cover image available</span>[% END %][% END %]
79
[% IF GoogleJackets %]
80
    [% IF  issue.normalized_isbn %]
81
        <div style="block" title="[% issue.biblionumber |url %]" class="[% issue.normalized_isbn %]" id="gbs-thumbnail[% loop.count %]"></div>
82
    [% ELSE %]
83
       <span class="no-image">No cover image available</span>
84
    [% END %]
85
[% END %]
74
86
75
    [% IF ( BakerTaylorEnabled ) %][% IF ( READING_RECOR.normalized_isbn ) %]<a href="https://[% BakerTaylorBookstoreURL |html %][% READING_RECOR.normalized_isbn %]"><img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL |html %][% READING_RECOR.normalized_isbn %]" /></a>[% ELSE %]<span class="no-image">No cover image available</span>[% END %][% END %]
87
[% IF BakerTaylorEnabled %]
88
    [% IF issue.normalized_isbn %]
89
      <a href="https://[% BakerTaylorBookstoreURL |html %][% issue.normalized_isbn %]"><img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL |html %][% issue.normalized_isbn %]" /></a>
90
    [% ELSE %]
91
       <span class="no-image">No cover image available</span>
92
    [% END %]
93
[% END %]
76
94
77
	[% IF ( SyndeticsEnabled ) %][% IF ( SyndeticsCoverImages ) %][% IF ( using_https ) %]
95
[% IF SyndeticsEnabled %]
78
	<img src="https://secure.syndetics.com/index.aspx?isbn=[% READING_RECOR.normalized_isbn %]/SC.GIF&amp;client=[% SyndeticsClientCode %]&amp;type=xw10&amp;upc=[% READING_RECOR.normalized_upc %]&amp;oclc=[% READING_RECOR.normalized_oclc %]" alt="" class="thumbnail" />
96
    [% IF SyndeticsCoverImages %]
79
	[% ELSE %]
97
        [% IF  using_https  %]
80
	<img src="http://www.syndetics.com/index.aspx?isbn=[% READING_RECOR.normalized_isbn %]/SC.GIF&amp;client=[% SyndeticsClientCode %]&amp;type=xw10&amp;upc=[% READING_RECOR.normalized_upc %]&amp;oclc=[% READING_RECOR.normalized_oclc %]" alt="" class="thumbnail" />[% END %][% END %][% END %]
98
<img src="https://secure.syndetics.com/index.aspx?isbn=[% issue.normalized_isbn %]/SC.GIF&amp;client=[% SyndeticsClientCode %]&amp;type=xw10&amp;upc=[% issue.normalized_upc %]&amp;oclc=[% issue.normalized_oclc %]" alt="" class="thumbnail" />
99
       [% ELSE %]
100
<img src="http://www.syndetics.com/index.aspx?isbn=[% issue.normalized_isbn %]/SC.GIF&amp;client=[% SyndeticsClientCode %]&amp;type=xw10&amp;upc=[% issue.normalized_upc %]&amp;oclc=[% issue.normalized_oclc %]" alt="" class="thumbnail" />
101
       [% END %]
102
    [% END %]
103
[% END %]
81
</td>
104
</td>
82
<td>[% IF ( READING_RECOR.BiblioDefaultViewmarc ) %]<a class="title" href="/cgi-bin/koha/opac-MARCdetail.pl?biblionumber=[% READING_RECOR.biblionumber |url %]">[% READING_RECOR.title |html %] [% IF ( READING_RECOR.subtitle ) %][% FOREACH subtitl IN READING_RECOR.subtitle %][% subtitl.subfield %][% END %][% END %]</a>[% ELSE %]
105
<td>
83
[% IF ( READING_RECOR.BiblioDefaultViewisbd ) %]<a class="title" href="/cgi-bin/koha/opac-ISBDdetail.pl?biblionumber=[% READING_RECOR.biblionumber |url %]">[% READING_RECOR.title |html %] [% IF ( READING_RECOR.subtitle ) %][% FOREACH subtitl IN READING_RECOR.subtitle %][% subtitl.subfield %][% END %][% END %]</a>[% ELSE %]
106
[% IF  issue.BiblioDefaultViewmarc %]
84
<a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% READING_RECOR.biblionumber |url %]">[% READING_RECOR.title |html %] [% IF ( READING_RECOR.subtitle ) %][% FOREACH subtitl IN READING_RECOR.subtitle %][% subtitl.subfield %][% END %][% END %]</a>[% END %][% END %]
107
     <a class="title" href="/cgi-bin/koha/opac-MARCdetail.pl?biblionumber=[% issue.biblionumber |url %]">[% issue.title |html %] [% IF  issue.subtitle  %][% FOREACH subtitl IN issue.subtitle %][% subtitl.subfield %][% END %][% END %]</a>
108
[% ELSIF issue.BiblioDefaultViewisbd %]
109
     <a class="title" href="/cgi-bin/koha/opac-ISBDdetail.pl?biblionumber=[% issue.biblionumber |url %]">[% issue.title |html %] [% IF issue.subtitle %][% FOREACH subtitl IN issue.subtitle %][% subtitl.subfield %][% END %][% END %]</a>
110
[% ELSE %]
111
     <a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% issue.biblionumber |url %]">[% issue.title |html %] [% IF issue.subtitle %][% FOREACH subtitl IN issue.subtitle %][% subtitl.subfield %][% END %][% END %]</a>
112
[% END %]
85
                    <span class="item-details">
113
                    <span class="item-details">
86
                        [% READING_RECOR.author %]
114
                        [% issue.author %]
87
                    </span></td>
115
                    </span></td>
88
<td>[% UNLESS ( noItemTypeImages ) %][% IF ( READING_RECOR.imageurl ) %]<img src="[% READING_RECOR.imageurl %]" alt="" />[% END %][% END %] [% READING_RECOR.description %]</td>
116
<td>
89
<td>[% READING_RECOR.itemcallnumber %]</td>
117
[% UNLESS ( noItemTypeImages ) %][% IF ( issue.imageurl ) %]<img src="[% issue.imageurl %]" alt="" />[% END %][% END %] [% issue.description %]</td>
90
<td>[% IF ( READING_RECOR.returndate ) %][% READING_RECOR.returndate | $KohaDates %][% ELSE %]<em>(Checked out)</em>[% END %]</td>
118
<td>[% issue.itemcallnumber %]</td>
91
[% IF ( OPACMySummaryHTML ) %]
119
<td>
92
<td>[% READING_RECOR.MySummaryHTML %]</td>
120
[% IF issue.returndate %]
121
    [% issue.returndate | $KohaDates %]
122
[% ELSE %]
123
    <em>(Checked out)</em>
124
[% END %]
125
</td>
126
[% IF OPACMySummaryHTML %]
127
    <td>[% issue.MySummaryHTML %]</td>
93
[% END %]
128
[% END %]
94
</tr>
129
</tr>
95
130
(-)a/members/readingrec.pl (-61 / +42 lines)
Lines 28-34 use CGI; Link Here
28
use C4::Auth;
28
use C4::Auth;
29
use C4::Output;
29
use C4::Output;
30
use C4::Members;
30
use C4::Members;
31
use C4::Branch;
31
use C4::Branch qw(GetBranches);
32
use List::MoreUtils qw/any uniq/;
32
use List::MoreUtils qw/any uniq/;
33
use Koha::DateUtils;
33
use Koha::DateUtils;
34
34
Lines 62-105 if ($input->param('borrowernumber')) { Link Here
62
62
63
my $order = 'date_due desc';
63
my $order = 'date_due desc';
64
my $limit = 0;
64
my $limit = 0;
65
my ( $issues ) = GetAllIssues($borrowernumber,$order,$limit);
65
my $issues = GetAllIssues($borrowernumber,$order,$limit);
66
66
67
my @loop_reading;
67
my $branches = GetBranches();
68
my @barcodes;
68
foreach my $issue ( @{$issues} ) {
69
my $today = C4::Dates->new();
69
    $issue->{issuingbranch} = $branches->{ $issue->{branchcode} }->{branchname};
70
$today = $today->output("iso");
71
72
foreach my $issue (@{$issues}){
73
 	my %line;
74
 	$line{issuestimestamp} = format_date($issue->{'issuestimestamp'});
75
	$line{biblionumber}    = $issue->{'biblionumber'};
76
	$line{title}           = $issue->{'title'};
77
	$line{author}          = $issue->{'author'};
78
	$line{classification}  = $issue->{'classification'} || $issue->{'itemcallnumber'};
79
	$line{date_due}        = format_sqldatetime($issue->{date_due});
80
	$line{returndate}      = format_sqldatetime($issue->{returndate});
81
	$line{issuedate}       = format_sqldatetime($issue->{issuedate});
82
	$line{issuingbranch}   = GetBranchName($issue->{'branchcode'});
83
	$line{renewals}        = $issue->{'renewals'};
84
	$line{barcode}         = $issue->{'barcode'};
85
	$line{volumeddesc}     = $issue->{'volumeddesc'};
86
	push(@loop_reading,\%line);
87
    my $return_dt = Koha::DateUtils::dt_from_string($issue->{'returndate'}, 'iso');
88
    if ( ( $input->param('op') eq 'export_barcodes' ) and ( $today eq $return_dt->ymd() ) ) {
89
        push( @barcodes, $issue->{'barcode'} );
90
    }
91
}
70
}
92
71
93
if ($input->param('op') eq 'export_barcodes') {
72
#   barcode export
94
    my $borrowercardnumber = GetMember( borrowernumber => $borrowernumber )->{'cardnumber'} ;
73
if ( $input->param('op') eq 'export_barcodes' ) {
74
    my $today = C4::Dates->new();
75
    $today = $today->output('iso');
76
    my @barcodes =
77
      map { $_->{barcode} } grep { $_->{returndate} =~ m/^$today/o } @{$issues};
78
    my $borrowercardnumber =
79
      GetMember( borrowernumber => $borrowernumber )->{'cardnumber'};
95
    my $delimiter = "\n";
80
    my $delimiter = "\n";
96
    binmode( STDOUT, ":encoding(UTF-8)");
81
    binmode( STDOUT, ":encoding(UTF-8)" );
97
    print $input->header(
82
    print $input->header(
98
        -type       => 'application/octet-stream',
83
        -type       => 'application/octet-stream',
99
        -charset    => 'utf-8',
84
        -charset    => 'utf-8',
100
        -attachment => "$today-$borrowercardnumber-checkinexport.txt"
85
        -attachment => "$today-$borrowercardnumber-checkinexport.txt"
101
    );
86
    );
102
    my $content = join($delimiter, uniq(@barcodes));
87
    my $content = join $delimiter, uniq(@barcodes);
103
    print $content;
88
    print $content;
104
    exit;
89
    exit;
105
}
90
}
Lines 116-121 if (! $limit){ Link Here
116
	$limit = 'full';
101
	$limit = 'full';
117
}
102
}
118
103
104
119
my ($picture, $dberror) = GetPatronImage($data->{'cardnumber'});
105
my ($picture, $dberror) = GetPatronImage($data->{'cardnumber'});
120
$template->param( picture => 1 ) if $picture;
106
$template->param( picture => 1 ) if $picture;
121
107
Lines 128-163 if (C4::Context->preference('ExtendedPatronAttributes')) { Link Here
128
}
114
}
129
115
130
$template->param(
116
$template->param(
131
						readingrecordview => 1,
117
    readingrecordview => 1,
132
						biblionumber => $data->{'biblionumber'},
118
    title             => $data->{title},
133
						title => $data->{'title'},
119
    initials          => $data->{initials},
134
						initials => $data->{'initials'},
120
    surname           => $data->{surname},
135
						surname => $data->{'surname'},
121
    othernames        => $data->{othernames},
136
						othernames => $data->{'othernames'},
122
    borrowernumber    => $borrowernumber,
137
						borrowernumber => $borrowernumber,
123
    firstname         => $data->{firstname},
138
						limit => $limit,
124
    cardnumber        => $data->{cardnumber},
139
						firstname => $data->{'firstname'},
125
    categorycode      => $data->{categorycode},
140
						cardnumber => $data->{'cardnumber'},
126
    category_type     => $data->{category_type},
141
					    categorycode => $data->{'categorycode'},
127
    categoryname      => $data->{description},
142
					    category_type => $data->{'category_type'},
128
    address           => $data->{address},
143
					   # category_description => $data->{'description'},
129
    address2          => $data->{address2},
144
					    categoryname	=> $data->{'description'},
130
    city              => $data->{city},
145
					    address => $data->{'address'},
131
    state             => $data->{state},
146
						address2 => $data->{'address2'},
132
    zipcode           => $data->{zipcode},
147
					    city => $data->{'city'},
133
    country           => $data->{country},
148
					    state => $data->{'state'},
134
    phone             => $data->{phone},
149
						zipcode => $data->{'zipcode'},
135
    email             => $data->{email},
150
						country => $data->{'country'},
136
    branchcode        => $data->{branchcode},
151
						phone => $data->{'phone'},
137
    is_child          => ( $data->{category_type} eq 'C' ),
152
						email => $data->{'email'},
138
    branchname        => $branches->{ $data->{branchcode} }->{branchname},
153
			   			branchcode => $data->{'branchcode'},
139
    loop_reading      => $issues,
154
			   			is_child        => ($data->{'category_type'} eq 'C'),
140
    activeBorrowerRelationship =>
155
			   			branchname => GetBranchName($data->{'branchcode'}),
141
      ( C4::Context->preference('borrowerRelationship') ne '' ),
156
						showfulllink => (scalar @loop_reading > 50),					
157
						loop_reading => \@loop_reading,
158
						activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''),
159
);
142
);
160
output_html_with_http_headers $input, $cookie, $template->output;
143
output_html_with_http_headers $input, $cookie, $template->output;
161
144
162
163
(-)a/opac/opac-readingrecord.pl (-53 / +53 lines)
Lines 27-34 use C4::Biblio; Link Here
27
use C4::Circulation;
27
use C4::Circulation;
28
use C4::Members;
28
use C4::Members;
29
use Koha::DateUtils;
29
use Koha::DateUtils;
30
use MARC::Record;
30
31
31
use C4::Output;
32
use C4::Output;
33
use C4::Charset qw(StripNonXmlChars);
32
34
33
my $query = new CGI;
35
my $query = new CGI;
34
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
36
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
Lines 50-114 $template->param(%{$borr}); Link Here
50
my $itemtypes = GetItemTypes();
52
my $itemtypes = GetItemTypes();
51
53
52
# get the record
54
# get the record
53
my $order  = $query->param('order') || '';
55
my $order = $query->param('order') || '';
54
if ( $order eq '' ) {
55
    $order = "date_due desc";
56
    $template->param( orderbydate => 1 );
57
}
58
59
if ( $order eq 'title' ) {
56
if ( $order eq 'title' ) {
60
    $template->param( orderbytitle => 1 );
57
    $template->param( orderbytitle => 1 );
61
}
58
}
62
59
elsif ( $order eq 'author' ) {
63
if ( $order eq 'author' ) {
64
    $template->param( orderbyauthor => 1 );
60
    $template->param( orderbyauthor => 1 );
65
}
61
}
66
67
my $limit = $query->param('limit') || 50;
68
if ( $limit eq 'full' ) {
69
    $limit = 0;
70
}
71
else {
62
else {
72
    $limit = 50;
63
    $order = "date_due desc";
64
    $template->param( orderbydate => 1 );
73
}
65
}
74
66
75
my ( $issues ) = GetAllIssues( $borrowernumber, $order, $limit );
67
76
68
my $limit = $query->param('limit');
77
69
$limit = ( $limit eq 'full' ) ? 0 : 50;
78
my @loop_reading;
70
79
71
my $issues = GetAllIssues( $borrowernumber, $order, $limit );
80
foreach my $issue (@{$issues} ) {
72
81
    my %line;
73
my $itype_attribute =
82
	
74
  ( C4::Context->preference('item-level_itypes') ) ? 'itype' : 'itemtype';
83
    my $record = GetMarcBiblio($issue->{'biblionumber'});
75
84
76
my $opac_summary_html = C4::Context->preference('OPACMySummaryHTML');
85
	# XISBN Stuff
77
foreach my $issue ( @{$issues} ) {
86
	my $isbn               = GetNormalizedISBN($issue->{'isbn'});
78
    $issue->{normalized_isbn} = GetNormalizedISBN( $issue->{isbn} );
87
	$line{normalized_isbn} = $isbn;
79
    if ( $issue->{$itype_attribute} ) {
88
    $line{biblionumber}    = $issue->{'biblionumber'};
80
        $issue->{description} =
89
    $line{title}           = $issue->{'title'};
81
          $itemtypes->{ $issue->{$itype_attribute} }->{description};
90
    $line{author}          = $issue->{'author'};
82
        $issue->{imageurl} =
91
    $line{itemcallnumber}  = $issue->{'itemcallnumber'};
83
          getitemtypeimagelocation( 'opac',
92
    $line{date_due}        = $issue->{'date_due'};
84
            $itemtypes->{ $issue->{$itype_attribute} }->{imageurl} );
93
    $line{returndate}      = $issue->{'returndate'};
85
    }
94
    $line{volumeddesc}     = $issue->{'volumeddesc'};
86
    if ( $issue->{marcxml} ) {
95
    $issue->{'itemtype'}   = C4::Context->preference('item-level_itypes') ? $issue->{'itype'} : $issue->{'itemtype'};
87
        my $marcxml = StripNonXmlChars( $issue->{marcxml} );
96
    if($issue->{'itemtype'}) {
88
        my $marc_rec =
97
        $line{'description'}   = $itemtypes->{ $issue->{'itemtype'} }->{'description'};
89
          MARC::Record::new_from_xml( $marcxml, 'utf8',
98
        $line{imageurl}        = getitemtypeimagelocation( 'opac', $itemtypes->{ $issue->{'itemtype'}  }->{'imageurl'} );
90
            C4::Context->preference('marcflavour') );
91
        $issue->{subtitle} =
92
          GetRecordValue( 'subtitle', $marc_rec, $issue->{frameworkcode} );
99
    }
93
    }
100
    # My Summary HTML
94
    # My Summary HTML
101
    if (my $my_summary_html = C4::Context->preference('OPACMySummaryHTML')){
95
    if ($opac_summary_html) {
102
        $line{author} ? $my_summary_html =~ s/{AUTHOR}/$line{author}/g : $my_summary_html =~ s/{AUTHOR}//g;
96
        my $my_summary_html = $opac_summary_html;
103
        $line{title} =~ s/\/+$//; # remove trailing slash
97
        $issue->{author}
104
        $line{title} =~ s/\s+$//; # remove trailing space
98
          ? $my_summary_html =~ s/{AUTHOR}/$issue->{author}/g
105
        $line{title} ? $my_summary_html =~ s/{TITLE}/$line{title}/g : $my_summary_html =~ s/{TITLE}//g;
99
          : $my_summary_html =~ s/{AUTHOR}//g;
106
        $line{normalized_isbn} ? $my_summary_html =~ s/{ISBN}/$line{normalized_isbn}/g : $my_summary_html =~ s/{ISBN}//g;
100
        my $title = $issue->{title};
107
        $line{biblionumber} ? $my_summary_html =~ s/{BIBLIONUMBER}/$line{biblionumber}/g : $my_summary_html =~ s/{BIBLIONUMBER}//g;
101
        $title =~ s/\/+$//;    # remove trailing slash
108
        $line{MySummaryHTML} = $my_summary_html;
102
        $title =~ s/\s+$//;    # remove trailing space
103
        $title
104
          ? $my_summary_html =~ s/{TITLE}/$title/g
105
          : $my_summary_html =~ s/{TITLE}//g;
106
        $issue->{normalized_isbn}
107
          ? $my_summary_html =~ s/{ISBN}/$issue->{normalized_isbn}/g
108
          : $my_summary_html =~ s/{ISBN}//g;
109
        $issue->{biblionumber}
110
          ? $my_summary_html =~ s/{BIBLIONUMBER}/$issue->{biblionumber}/g
111
          : $my_summary_html =~ s/{BIBLIONUMBER}//g;
112
        $issue->{MySummaryHTML} = $my_summary_html;
109
    }
113
    }
110
    push( @loop_reading, \%line );
111
    $line{subtitle} = GetRecordValue('subtitle', $record, GetFrameworkCode($issue->{'biblionumber'}));
112
}
114
}
113
115
114
if (C4::Context->preference('BakerTaylorEnabled')) {
116
if (C4::Context->preference('BakerTaylorEnabled')) {
Lines 135-146 for(qw(AmazonCoverImages GoogleJackets)) { # BakerTaylorEnabled handled above Link Here
135
}
137
}
136
138
137
$template->param(
139
$template->param(
138
    READING_RECORD => \@loop_reading,
140
    READING_RECORD => $issues,
139
    limit          => $limit,
141
    limit          => $limit,
140
    showfulllink   => 1,
142
    showfulllink   => 1,
141
	readingrecview => 1,
143
    readingrecview => 1,
142
	count          => scalar @loop_reading,
144
    OPACMySummaryHTML => $opac_summary_html ? 1 : 0,
143
    OPACMySummaryHTML => (C4::Context->preference("OPACMySummaryHTML")) ? 1 : 0,
144
);
145
);
145
146
146
output_html_with_http_headers $query, $cookie, $template->output;
147
output_html_with_http_headers $query, $cookie, $template->output;
147
- 

Return to bug 8017