|
Lines 25-31
use JSON qw(to_json);
Link Here
|
| 25 |
|
25 |
|
| 26 |
use C4::Auth qw(check_cookie_auth haspermission get_session); |
26 |
use C4::Auth qw(check_cookie_auth haspermission get_session); |
| 27 |
use C4::Biblio qw(GetMarcBiblio GetFrameworkCode GetRecordValue ); |
27 |
use C4::Biblio qw(GetMarcBiblio GetFrameworkCode GetRecordValue ); |
| 28 |
use C4::Circulation qw(GetIssuingCharges CanBookBeRenewed GetRenewCount GetSoonestRenewDate); |
28 |
use C4::Circulation qw(CanBookBeRenewed GetRenewCount GetSoonestRenewDate); |
| 29 |
use C4::Overdues qw(GetFine); |
29 |
use C4::Overdues qw(GetFine); |
| 30 |
use C4::Context; |
30 |
use C4::Context; |
| 31 |
|
31 |
|
|
Lines 64-70
binmode STDOUT, ":encoding(UTF-8)";
Link Here
|
| 64 |
print $input->header( -type => 'text/plain', -charset => 'UTF-8' ); |
64 |
print $input->header( -type => 'text/plain', -charset => 'UTF-8' ); |
| 65 |
|
65 |
|
| 66 |
my @parameters; |
66 |
my @parameters; |
| 67 |
my $sql = ' |
67 |
my $sql = <<EOQ; |
| 68 |
SELECT |
68 |
SELECT |
| 69 |
issuedate, |
69 |
issuedate, |
| 70 |
date_due, |
70 |
date_due, |
|
Lines 101-106
my $sql = '
Link Here
|
| 101 |
location, |
101 |
location, |
| 102 |
items.enumchron, |
102 |
items.enumchron, |
| 103 |
|
103 |
|
|
|
104 |
acc.amountoutstanding, |
| 105 |
|
| 104 |
DATEDIFF( issuedate, CURRENT_DATE() ) AS not_issued_today |
106 |
DATEDIFF( issuedate, CURRENT_DATE() ) AS not_issued_today |
| 105 |
FROM issues |
107 |
FROM issues |
| 106 |
LEFT JOIN items USING ( itemnumber ) |
108 |
LEFT JOIN items USING ( itemnumber ) |
|
Lines 109-116
my $sql = '
Link Here
|
| 109 |
LEFT JOIN borrowers USING ( borrowernumber ) |
111 |
LEFT JOIN borrowers USING ( borrowernumber ) |
| 110 |
LEFT JOIN branches ON ( issues.branchcode = branches.branchcode ) |
112 |
LEFT JOIN branches ON ( issues.branchcode = branches.branchcode ) |
| 111 |
LEFT JOIN branches branches2 ON ( items.homebranch = branches2.branchcode ) |
113 |
LEFT JOIN branches branches2 ON ( items.homebranch = branches2.branchcode ) |
|
|
114 |
LEFT OUTER JOIN ( |
| 115 |
SELECT borrowernumber, itemnumber, SUM(amountoutstanding) AS amountoutstanding |
| 116 |
FROM accountlines WHERE accounttype = 'Rent' |
| 117 |
GROUP BY borrowernumber, itemnumber |
| 118 |
) acc USING ( borrowernumber, itemnumber ) |
| 112 |
WHERE borrowernumber |
119 |
WHERE borrowernumber |
| 113 |
'; |
120 |
EOQ |
| 114 |
|
121 |
|
| 115 |
if ( @borrowernumber == 1 ) { |
122 |
if ( @borrowernumber == 1 ) { |
| 116 |
$sql .= '= ?'; |
123 |
$sql .= '= ?'; |
|
Lines 131-137
my $item_level_itypes = C4::Context->preference('item-level_itypes');
Link Here
|
| 131 |
my @checkouts_today; |
138 |
my @checkouts_today; |
| 132 |
my @checkouts_previous; |
139 |
my @checkouts_previous; |
| 133 |
while ( my $c = $sth->fetchrow_hashref() ) { |
140 |
while ( my $c = $sth->fetchrow_hashref() ) { |
| 134 |
my ($charge) = GetIssuingCharges( $c->{itemnumber}, $c->{borrowernumber} ); |
|
|
| 135 |
my $fine = GetFine( $c->{itemnumber}, $c->{borrowernumber} ); |
141 |
my $fine = GetFine( $c->{itemnumber}, $c->{borrowernumber} ); |
| 136 |
|
142 |
|
| 137 |
my ( $can_renew, $can_renew_error ) = |
143 |
my ( $can_renew, $can_renew_error ) = |
|
Lines 179-185
while ( my $c = $sth->fetchrow_hashref() ) {
Link Here
|
| 179 |
branchcode => $c->{branchcode}, |
185 |
branchcode => $c->{branchcode}, |
| 180 |
branchname => $c->{branchname}, |
186 |
branchname => $c->{branchname}, |
| 181 |
itemcallnumber => $c->{itemcallnumber} || q{}, |
187 |
itemcallnumber => $c->{itemcallnumber} || q{}, |
| 182 |
charge => $charge, |
188 |
charge => $c->{amountoutstanding} || 0.00, |
| 183 |
fine => $fine, |
189 |
fine => $fine, |
| 184 |
price => $c->{replacementprice} || q{}, |
190 |
price => $c->{replacementprice} || q{}, |
| 185 |
can_renew => $can_renew, |
191 |
can_renew => $can_renew, |
| 186 |
- |
|
|