Lines 52-80
my $query = new CGI;
Link Here
|
52 |
my $sessionID = $query->cookie("CGISESSID") ; |
52 |
my $sessionID = $query->cookie("CGISESSID") ; |
53 |
my $session = get_session($sessionID); |
53 |
my $session = get_session($sessionID); |
54 |
|
54 |
|
55 |
# new op dev the branch and the printer are now defined by the userenv |
55 |
# branch and printer are now defined by the userenv |
56 |
# but first we have to check if someone has tried to change them |
56 |
# but first we have to check if someone has tried to change them |
57 |
|
57 |
|
58 |
my $branch = $query->param('branch'); |
58 |
my $branch = $query->param('branch'); |
59 |
if ($branch){ |
59 |
if ($branch){ |
60 |
# update our session so the userenv is updated |
60 |
# update our session so the userenv is updated |
61 |
$session->param('branch',$branch); |
61 |
$session->param('branch', $branch); |
62 |
my $branchname = GetBranchName($branch); |
62 |
$session->param('branchname', GetBranchName($branch)); |
63 |
$session->param('branchname',$branchname); |
|
|
64 |
} |
63 |
} |
65 |
|
64 |
|
66 |
my $printer = $query->param('printer'); |
65 |
my $printer = $query->param('printer'); |
67 |
if ($printer){ |
66 |
if ($printer){ |
68 |
# update our session so the userenv is updated |
67 |
# update our session so the userenv is updated |
69 |
$session->param('branchprinter',$printer); |
68 |
$session->param('branchprinter', $printer); |
70 |
} |
69 |
} |
71 |
|
70 |
|
72 |
if (!C4::Context->userenv && !$branch){ |
71 |
if (!C4::Context->userenv && !$branch){ |
73 |
if ($session->param('branch') eq 'NO_LIBRARY_SET'){ |
72 |
if ($session->param('branch') eq 'NO_LIBRARY_SET'){ |
74 |
# no branch set we can't issue |
73 |
# no branch set we can't issue |
75 |
print $query->redirect("/cgi-bin/koha/circ/selectbranchprinter.pl"); |
74 |
print $query->redirect("/cgi-bin/koha/circ/selectbranchprinter.pl"); |
76 |
exit; |
75 |
exit; |
77 |
} |
76 |
} |
78 |
} |
77 |
} |
79 |
|
78 |
|
80 |
my ( $template, $loggedinuser, $cookie ) = get_template_and_user ( |
79 |
my ( $template, $loggedinuser, $cookie ) = get_template_and_user ( |
Lines 88-113
my ( $template, $loggedinuser, $cookie ) = get_template_and_user (
Link Here
|
88 |
); |
87 |
); |
89 |
|
88 |
|
90 |
my $branches = GetBranches(); |
89 |
my $branches = GetBranches(); |
91 |
my $printers = GetPrinters(); |
|
|
92 |
|
90 |
|
93 |
my @failedrenews = $query->param('failedrenew'); |
91 |
my @failedrenews = $query->param('failedrenew'); # expected to be itemnumbers |
94 |
my %renew_failed; |
92 |
my %renew_failed; |
95 |
for (@failedrenews) { $renew_failed{$_} = 1; } |
93 |
for (@failedrenews) { $renew_failed{$_} = 1; } |
96 |
|
94 |
|
97 |
my $findborrower = $query->param('findborrower'); |
95 |
my $findborrower = $query->param('findborrower'); |
98 |
$findborrower =~ s|,| |g; |
96 |
$findborrower =~ s|,| |g; |
99 |
#$findborrower =~ s|'| |g; |
|
|
100 |
my $borrowernumber = $query->param('borrowernumber'); |
97 |
my $borrowernumber = $query->param('borrowernumber'); |
101 |
|
98 |
|
102 |
$branch = C4::Context->userenv->{'branch'}; |
99 |
$branch = C4::Context->userenv->{'branch'}; |
103 |
$printer = C4::Context->userenv->{'branchprinter'}; |
100 |
$printer = C4::Context->userenv->{'branchprinter'}; |
104 |
|
101 |
|
105 |
|
102 |
|
106 |
# If Autolocated is not activated, we show the Circulation Parameters to chage settings of librarian |
103 |
# If AutoLocation is not activated, we show the Circulation Parameters to chage settings of librarian |
107 |
if (C4::Context->preference("AutoLocation") ne 1) { # FIXME: string comparison to number |
104 |
if (C4::Context->preference("AutoLocation") != 1) { |
108 |
$template->param(ManualLocation => 1); |
105 |
$template->param(ManualLocation => 1); |
109 |
} |
106 |
} |
110 |
|
107 |
|
|
|
108 |
if (C4::Context->preference("DisplayClearScreenButton")) { |
109 |
$template->param(DisplayClearScreenButton => 1); |
110 |
} |
111 |
|
111 |
my $barcode = $query->param('barcode') || ''; |
112 |
my $barcode = $query->param('barcode') || ''; |
112 |
$barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespace |
113 |
$barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespace |
113 |
|
114 |
|
Lines 131-145
if ( $barcode ) {
Link Here
|
131 |
} |
132 |
} |
132 |
} |
133 |
} |
133 |
|
134 |
|
134 |
#set up cookie..... |
|
|
135 |
# my $branchcookie; |
136 |
# my $printercookie; |
137 |
# if ($query->param('setcookies')) { |
138 |
# $branchcookie = $query->cookie(-name=>'branch', -value=>"$branch", -expires=>'+1y'); |
139 |
# $printercookie = $query->cookie(-name=>'printer', -value=>"$printer", -expires=>'+1y'); |
140 |
# } |
141 |
# |
142 |
|
143 |
my ($datedue,$invalidduedate,$globalduedate); |
135 |
my ($datedue,$invalidduedate,$globalduedate); |
144 |
|
136 |
|
145 |
if(C4::Context->preference('globalDueDate') && (C4::Context->preference('globalDueDate') =~ C4::Dates->regexp('syspref'))){ |
137 |
if(C4::Context->preference('globalDueDate') && (C4::Context->preference('globalDueDate') =~ C4::Dates->regexp('syspref'))){ |
Lines 148-166
if(C4::Context->preference('globalDueDate') && (C4::Context->preference('globalD
Link Here
|
148 |
my $duedatespec_allow = C4::Context->preference('SpecifyDueDate'); |
140 |
my $duedatespec_allow = C4::Context->preference('SpecifyDueDate'); |
149 |
if($duedatespec_allow){ |
141 |
if($duedatespec_allow){ |
150 |
if ($duedatespec) { |
142 |
if ($duedatespec) { |
151 |
if ($duedatespec =~ C4::Dates->regexp('syspref')) { |
143 |
if ($duedatespec =~ C4::Dates->regexp('syspref')) { |
152 |
my $tempdate = C4::Dates->new($duedatespec); |
144 |
my $tempdate = C4::Dates->new($duedatespec); |
153 |
if ($tempdate and $tempdate->output('iso') gt C4::Dates->new()->output('iso')) { |
145 |
if ($tempdate and $tempdate->output('iso') gt C4::Dates->new()->output('iso')) { |
154 |
# i.e., it has to be later than today/now |
146 |
# i.e., it has to be later than today/now |
155 |
$datedue = $tempdate; |
147 |
$datedue = $tempdate; |
156 |
} else { |
148 |
} else { |
157 |
$invalidduedate = 1; |
149 |
$invalidduedate = 1; |
158 |
$template->param(IMPOSSIBLE=>1, INVALID_DATE=>$duedatespec); |
150 |
$template->param(IMPOSSIBLE=>1, INVALID_DATE=>$duedatespec); |
159 |
} |
151 |
} |
160 |
} else { |
152 |
} else { |
161 |
$invalidduedate = 1; |
153 |
$invalidduedate = 1; |
162 |
$template->param(IMPOSSIBLE=>1, INVALID_DATE=>$duedatespec); |
154 |
$template->param(IMPOSSIBLE=>1, INVALID_DATE=>$duedatespec); |
163 |
} |
155 |
} |
164 |
} else { |
156 |
} else { |
165 |
# pass global due date to tmpl if specifyduedate is true |
157 |
# pass global due date to tmpl if specifyduedate is true |
166 |
# and we have no barcode (loading circ page but not checking out) |
158 |
# and we have no barcode (loading circ page but not checking out) |
Lines 170-176
if($duedatespec_allow){
Link Here
|
170 |
} |
162 |
} |
171 |
} |
163 |
} |
172 |
} else { |
164 |
} else { |
173 |
$datedue = $globalduedate if($globalduedate); |
165 |
$datedue = $globalduedate if ($globalduedate); |
174 |
} |
166 |
} |
175 |
|
167 |
|
176 |
my $todaysdate = C4::Dates->new->output('iso'); |
168 |
my $todaysdate = C4::Dates->new->output('iso'); |
Lines 229-235
if ($findborrower) {
Link Here
|
229 |
|
221 |
|
230 |
# get the borrower information..... |
222 |
# get the borrower information..... |
231 |
my $borrower; |
223 |
my $borrower; |
232 |
my @lines; |
|
|
233 |
if ($borrowernumber) { |
224 |
if ($borrowernumber) { |
234 |
$borrower = GetMemberDetails( $borrowernumber, 0 ); |
225 |
$borrower = GetMemberDetails( $borrowernumber, 0 ); |
235 |
my ( $od, $issue, $fines ) = GetMemberIssuesAndFines( $borrowernumber ); |
226 |
my ( $od, $issue, $fines ) = GetMemberIssuesAndFines( $borrowernumber ); |
Lines 239-247
if ($borrowernumber) {
Link Here
|
239 |
my ($warning_year, $warning_month, $warning_day) = split /-/, $borrower->{'dateexpiry'}; |
230 |
my ($warning_year, $warning_month, $warning_day) = split /-/, $borrower->{'dateexpiry'}; |
240 |
my ( $enrol_year, $enrol_month, $enrol_day) = split /-/, $borrower->{'dateenrolled'}; |
231 |
my ( $enrol_year, $enrol_month, $enrol_day) = split /-/, $borrower->{'dateenrolled'}; |
241 |
# Renew day is calculated by adding the enrolment period to today |
232 |
# Renew day is calculated by adding the enrolment period to today |
242 |
my ( $renew_year, $renew_month, $renew_day) = |
233 |
my ( $renew_year, $renew_month, $renew_day); |
243 |
Add_Delta_YM( $enrol_year, $enrol_month, $enrol_day, |
234 |
if ($enrol_year*$enrol_month*$enrol_day>0) { |
244 |
0 , $borrower->{'enrolmentperiod'}) if ($enrol_year*$enrol_month*$enrol_day>0); |
235 |
( $renew_year, $renew_month, $renew_day) = |
|
|
236 |
Add_Delta_YM( $enrol_year, $enrol_month, $enrol_day, |
237 |
0 , $borrower->{'enrolmentperiod'}); |
238 |
} |
245 |
# if the expiry date is before today ie they have expired |
239 |
# if the expiry date is before today ie they have expired |
246 |
if ( $warning_year*$warning_month*$warning_day==0 |
240 |
if ( $warning_year*$warning_month*$warning_day==0 |
247 |
|| Date_to_Days($today_year, $today_month, $today_day ) |
241 |
|| Date_to_Days($today_year, $today_month, $today_day ) |
Lines 266-272
if ($borrowernumber) {
Link Here
|
266 |
if (C4::Context->preference('ReturnBeforeExpiry')){ |
260 |
if (C4::Context->preference('ReturnBeforeExpiry')){ |
267 |
$template->param("returnbeforeexpiry" => 1); |
261 |
$template->param("returnbeforeexpiry" => 1); |
268 |
} |
262 |
} |
269 |
} |
263 |
} |
270 |
$template->param( |
264 |
$template->param( |
271 |
overduecount => $od, |
265 |
overduecount => $od, |
272 |
issuecount => $issue, |
266 |
issuecount => $issue, |
Lines 279-322
if ($borrowernumber) {
Link Here
|
279 |
# |
273 |
# |
280 |
# |
274 |
# |
281 |
if ($barcode) { |
275 |
if ($barcode) { |
282 |
# always check for blockers on issuing |
276 |
# always check for blockers on issuing |
283 |
my ( $error, $question ) = |
277 |
my ( $error, $question ) = |
284 |
CanBookBeIssued( $borrower, $barcode, $datedue , $inprocess ); |
278 |
CanBookBeIssued( $borrower, $barcode, $datedue , $inprocess ); |
285 |
my $blocker = $invalidduedate ? 1 : 0; |
279 |
my $blocker = $invalidduedate ? 1 : 0; |
286 |
|
280 |
|
287 |
delete $question->{'DEBT'} if ($debt_confirmed); |
281 |
delete $question->{'DEBT'} if ($debt_confirmed); |
288 |
foreach my $impossible ( keys %$error ) { |
282 |
foreach my $impossible ( keys %$error ) { |
289 |
$template->param( |
283 |
$template->param( |
290 |
$impossible => $$error{$impossible}, |
284 |
$impossible => $$error{$impossible}, |
291 |
IMPOSSIBLE => 1 |
285 |
IMPOSSIBLE => 1 |
292 |
); |
286 |
); |
293 |
$blocker = 1; |
287 |
$blocker = 1; |
294 |
} |
288 |
} |
295 |
if( !$blocker ){ |
289 |
if( !$blocker ){ |
296 |
my $confirm_required = 0; |
290 |
my $confirm_required = 0; |
297 |
unless($issueconfirmed){ |
291 |
unless($issueconfirmed){ |
298 |
# Get the item title for more information |
292 |
# Get the item title for more information |
299 |
my $getmessageiteminfo = GetBiblioFromItemNumber(undef,$barcode); |
293 |
my $getmessageiteminfo = GetBiblioFromItemNumber(undef,$barcode); |
300 |
$template->param( itemhomebranch => $getmessageiteminfo->{'homebranch'} ); |
294 |
$template->param( itemhomebranch => $getmessageiteminfo->{'homebranch'} ); |
301 |
|
295 |
|
302 |
# pass needsconfirmation to template if issuing is possible and user hasn't yet confirmed. |
296 |
# pass needsconfirmation to template if issuing is possible and user hasn't yet confirmed. |
303 |
foreach my $needsconfirmation ( keys %$question ) { |
297 |
foreach my $needsconfirmation ( keys %$question ) { |
304 |
$template->param( |
298 |
$template->param( |
305 |
$needsconfirmation => $$question{$needsconfirmation}, |
299 |
$needsconfirmation => $$question{$needsconfirmation}, |
306 |
getTitleMessageIteminfo => $getmessageiteminfo->{'title'}, |
300 |
getTitleMessageIteminfo => $getmessageiteminfo->{'title'}, |
307 |
NEEDSCONFIRMATION => 1 |
301 |
NEEDSCONFIRMATION => 1 |
308 |
); |
302 |
); |
309 |
$confirm_required = 1; |
303 |
$confirm_required = 1; |
310 |
} |
304 |
} |
311 |
} |
305 |
} |
312 |
unless($confirm_required) { |
306 |
unless($confirm_required) { |
313 |
AddIssue( $borrower, $barcode, $datedue, $cancelreserve ); |
307 |
AddIssue( $borrower, $barcode, $datedue, $cancelreserve ); |
314 |
$inprocess = 1; |
308 |
$inprocess = 1; |
315 |
if($globalduedate && ! $stickyduedate && $duedatespec_allow ){ |
309 |
if($globalduedate && ! $stickyduedate && $duedatespec_allow ){ |
316 |
$duedatespec = $globalduedate->output(); |
310 |
$duedatespec = $globalduedate->output(); |
317 |
$stickyduedate = 1; |
311 |
$stickyduedate = 1; |
318 |
} |
312 |
} |
319 |
} |
313 |
} |
320 |
} |
314 |
} |
321 |
|
315 |
|
322 |
# FIXME If the issue is confirmed, we launch another time GetMemberIssuesAndFines, now display the issue count after issue |
316 |
# FIXME If the issue is confirmed, we launch another time GetMemberIssuesAndFines, now display the issue count after issue |
Lines 332-339
if ($borrowernumber) {
Link Here
|
332 |
################################################################################## |
326 |
################################################################################## |
333 |
# BUILD HTML |
327 |
# BUILD HTML |
334 |
# show all reserves of this borrower, and the position of the reservation .... |
328 |
# show all reserves of this borrower, and the position of the reservation .... |
335 |
my $borrowercategory; |
|
|
336 |
my $category_type; |
337 |
if ($borrowernumber) { |
329 |
if ($borrowernumber) { |
338 |
|
330 |
|
339 |
# new op dev |
331 |
# new op dev |
Lines 361-367
if ($borrowernumber) {
Link Here
|
361 |
$getreserv{barcodereserv} = $getiteminfo->{'barcode'}; |
353 |
$getreserv{barcodereserv} = $getiteminfo->{'barcode'}; |
362 |
$getreserv{itemcallnumber} = $getiteminfo->{'itemcallnumber'}; |
354 |
$getreserv{itemcallnumber} = $getiteminfo->{'itemcallnumber'}; |
363 |
$getreserv{biblionumber} = $getiteminfo->{'biblionumber'}; |
355 |
$getreserv{biblionumber} = $getiteminfo->{'biblionumber'}; |
364 |
$getreserv{waitingat} = GetBranchName( $num_res->{'branchcode'} ); |
356 |
$getreserv{waitingat} = GetBranchName( $num_res->{'branchcode'} ); |
365 |
# check if we have a waiting status for reservations |
357 |
# check if we have a waiting status for reservations |
366 |
if ( $num_res->{'found'} eq 'W' ) { |
358 |
if ( $num_res->{'found'} eq 'W' ) { |
367 |
$getreserv{color} = 'reserved'; |
359 |
$getreserv{color} = 'reserved'; |
Lines 373-379
if ($borrowernumber) {
Link Here
|
373 |
$getWaitingReserveInfo{author} = $getiteminfo->{'author'}; |
365 |
$getWaitingReserveInfo{author} = $getiteminfo->{'author'}; |
374 |
$getWaitingReserveInfo{reservedate} = format_date( $num_res->{'reservedate'} ); |
366 |
$getWaitingReserveInfo{reservedate} = format_date( $num_res->{'reservedate'} ); |
375 |
$getWaitingReserveInfo{waitingat} = GetBranchName( $num_res->{'branchcode'} ); |
367 |
$getWaitingReserveInfo{waitingat} = GetBranchName( $num_res->{'branchcode'} ); |
376 |
if($num_res->{'branchcode'} eq $branch){ $getWaitingReserveInfo{waitinghere} = 1; } |
368 |
$getWaitingReserveInfo{waitinghere} = 1 if $num_res->{'branchcode'} eq $branch; |
377 |
} |
369 |
} |
378 |
# check transfers with the itemnumber foud in th reservation loop |
370 |
# check transfers with the itemnumber foud in th reservation loop |
379 |
if ($transfertwhen) { |
371 |
if ($transfertwhen) { |
Lines 381-404
if ($borrowernumber) {
Link Here
|
381 |
$getreserv{transfered} = 1; |
373 |
$getreserv{transfered} = 1; |
382 |
$getreserv{datesent} = format_date($transfertwhen); |
374 |
$getreserv{datesent} = format_date($transfertwhen); |
383 |
$getreserv{frombranch} = GetBranchName($transfertfrom); |
375 |
$getreserv{frombranch} = GetBranchName($transfertfrom); |
384 |
} |
376 |
} elsif ($getiteminfo->{'holdingbranch'} ne $num_res->{'branchcode'}) { |
385 |
|
|
|
386 |
if ( ( $getiteminfo->{'holdingbranch'} ne $num_res->{'branchcode'} ) |
387 |
and not $transfertwhen ) |
388 |
{ |
389 |
$getreserv{nottransfered} = 1; |
377 |
$getreserv{nottransfered} = 1; |
390 |
$getreserv{nottransferedby} = |
378 |
$getreserv{nottransferedby} = GetBranchName( $getiteminfo->{'holdingbranch'} ); |
391 |
GetBranchName( $getiteminfo->{'holdingbranch'} ); |
|
|
392 |
} |
379 |
} |
393 |
|
380 |
|
394 |
# if we don't have a reserv on item, we put the biblio infos and the waiting position |
381 |
# if we don't have a reserv on item, we put the biblio infos and the waiting position |
395 |
if ( $getiteminfo->{'title'} eq '' ) { |
382 |
if ( $getiteminfo->{'title'} eq '' ) { |
396 |
my $getbibinfo = GetBiblioData( $num_res->{'biblionumber'} ); |
383 |
my $getbibinfo = GetBiblioData( $num_res->{'biblionumber'} ); |
397 |
my $getbibtype = getitemtypeinfo( $getbibinfo->{'itemtype'} ); # fixme - we should have item-level reserves here ? |
384 |
|
398 |
$getreserv{color} = 'inwait'; |
385 |
$getreserv{color} = 'inwait'; |
399 |
$getreserv{title} = $getbibinfo->{'title'}; |
386 |
$getreserv{title} = $getbibinfo->{'title'}; |
400 |
$getreserv{nottransfered} = 0; |
387 |
$getreserv{nottransfered} = 0; |
401 |
$getreserv{itemtype} = $getbibtype->{'description'}; |
388 |
$getreserv{itemtype} = $itemtypeinfo->{'description'}; |
402 |
$getreserv{author} = $getbibinfo->{'author'}; |
389 |
$getreserv{author} = $getbibinfo->{'author'}; |
403 |
$getreserv{biblionumber} = $num_res->{'biblionumber'}; |
390 |
$getreserv{biblionumber} = $num_res->{'biblionumber'}; |
404 |
} |
391 |
} |
Lines 406-412
if ($borrowernumber) {
Link Here
|
406 |
push( @reservloop, \%getreserv ); |
393 |
push( @reservloop, \%getreserv ); |
407 |
|
394 |
|
408 |
# if we have a reserve waiting, initiate waitingreserveloop |
395 |
# if we have a reserve waiting, initiate waitingreserveloop |
409 |
if ($getreserv{waiting} eq 1) { |
396 |
if ($getreserv{waiting} == 1) { |
410 |
push (@WaitingReserveLoop, \%getWaitingReserveInfo) |
397 |
push (@WaitingReserveLoop, \%getWaitingReserveInfo) |
411 |
} |
398 |
} |
412 |
|
399 |
|
Lines 426-446
my $todaysissues = '';
Link Here
|
426 |
my $previssues = ''; |
413 |
my $previssues = ''; |
427 |
my @todaysissues; |
414 |
my @todaysissues; |
428 |
my @previousissues; |
415 |
my @previousissues; |
429 |
my $allowborrow; |
|
|
430 |
## ADDED BY JF: new itemtype issuingrules counter stuff |
416 |
## ADDED BY JF: new itemtype issuingrules counter stuff |
431 |
my $issued_itemtypes_loop; |
|
|
432 |
my $issued_itemtypes_count; |
417 |
my $issued_itemtypes_count; |
433 |
my $issued_itemtypes_allowed_count; # hashref with total allowed by itemtype |
|
|
434 |
my $issued_itemtypes_remaining; # hashref with remaining |
435 |
my $issued_itemtypes_flags; #hashref that stores flags |
436 |
my @issued_itemtypes_count_loop; |
418 |
my @issued_itemtypes_count_loop; |
|
|
419 |
my $totalprice = 0; |
437 |
|
420 |
|
438 |
if ($borrower) { |
421 |
if ($borrower) { |
439 |
# get each issue of the borrower & separate them in todayissues & previous issues |
422 |
# get each issue of the borrower & separate them in todayissues & previous issues |
440 |
my ($issueslist) = GetPendingIssues($borrower->{'borrowernumber'}); |
423 |
my ($issueslist) = GetPendingIssues($borrower->{'borrowernumber'}); |
441 |
|
|
|
442 |
# split in 2 arrays for today & previous |
424 |
# split in 2 arrays for today & previous |
443 |
foreach my $it ( @$issueslist ) { |
425 |
foreach my $it ( @$issueslist ) { |
|
|
426 |
my $itemtypeinfo = getitemtypeinfo( (C4::Context->preference('item-level_itypes')) ? $it->{'itype'} : $it->{'itemtype'} ); |
444 |
# set itemtype per item-level_itype syspref - FIXME this is an ugly hack |
427 |
# set itemtype per item-level_itype syspref - FIXME this is an ugly hack |
445 |
$it->{'itemtype'} = ( C4::Context->preference( 'item-level_itypes' ) ) ? $it->{'itype'} : $it->{'itemtype'}; |
428 |
$it->{'itemtype'} = ( C4::Context->preference( 'item-level_itypes' ) ) ? $it->{'itype'} : $it->{'itemtype'}; |
446 |
|
429 |
|
Lines 453-463
if ($borrower) {
Link Here
|
453 |
); |
436 |
); |
454 |
$it->{"renew_error_${can_renew_error}"} = 1 if defined $can_renew_error; |
437 |
$it->{"renew_error_${can_renew_error}"} = 1 if defined $can_renew_error; |
455 |
my ( $restype, $reserves ) = CheckReserves( $it->{'itemnumber'} ); |
438 |
my ( $restype, $reserves ) = CheckReserves( $it->{'itemnumber'} ); |
456 |
$it->{'can_renew'} = $can_renew; |
439 |
$it->{'can_renew'} = $can_renew; |
457 |
$it->{'can_confirm'} = !$can_renew && !$restype; |
440 |
$it->{'can_confirm'} = !$can_renew && !$restype; |
458 |
$it->{'renew_error'} = $restype; |
441 |
$it->{'renew_error'} = $restype; |
459 |
|
442 |
$it->{'checkoutdate'} = C4::Dates->new($it->{'issuedate'},'iso')->output('syspref'); |
|
|
443 |
|
444 |
$totalprice += $it->{'replacementprice'}; |
445 |
$it->{'itemtype'} = $itemtypeinfo->{'description'}; |
446 |
$it->{'itemtype_image'} = $itemtypeinfo->{'imageurl'}; |
460 |
$it->{'dd'} = format_date($it->{'date_due'}); |
447 |
$it->{'dd'} = format_date($it->{'date_due'}); |
|
|
448 |
$it->{'displaydate'} = format_date($it->{'issuedate'}); |
461 |
$it->{'od'} = ( $it->{'date_due'} lt $todaysdate ) ? 1 : 0 ; |
449 |
$it->{'od'} = ( $it->{'date_due'} lt $todaysdate ) ? 1 : 0 ; |
462 |
($it->{'author'} eq '') and $it->{'author'} = ' '; |
450 |
($it->{'author'} eq '') and $it->{'author'} = ' '; |
463 |
$it->{'renew_failed'} = $renew_failed{$it->{'itemnumber'}}; |
451 |
$it->{'renew_failed'} = $renew_failed{$it->{'itemnumber'}}; |
Lines 490-502
if ($borrower) {
Link Here
|
490 |
my $dbh = C4::Context->dbh; |
478 |
my $dbh = C4::Context->dbh; |
491 |
|
479 |
|
492 |
# how many of each is allowed? |
480 |
# how many of each is allowed? |
493 |
my $issueqty_sth = $dbh->prepare( " |
481 |
my $issueqty_sth = $dbh->prepare( |
494 |
SELECT itemtypes.description AS description,issuingrules.itemtype,maxissueqty |
482 |
'SELECT itemtypes.description AS description,issuingrules.itemtype,maxissueqty ' . |
495 |
FROM issuingrules |
483 |
'FROM issuingrules LEFT JOIN itemtypes ON (itemtypes.itemtype=issuingrules.itemtype) ' . |
496 |
LEFT JOIN itemtypes ON (itemtypes.itemtype=issuingrules.itemtype) |
484 |
'WHERE categorycode=?' |
497 |
WHERE categorycode=? |
485 |
); |
498 |
" ); |
486 |
$issueqty_sth->execute(q{*}); # This is a literal asterisk, not a wildcard. |
499 |
$issueqty_sth->execute("*"); # This is a literal asterisk, not a wildcard. |
|
|
500 |
|
487 |
|
501 |
while ( my $data = $issueqty_sth->fetchrow_hashref() ) { |
488 |
while ( my $data = $issueqty_sth->fetchrow_hashref() ) { |
502 |
|
489 |
|
Lines 507-522
while ( my $data = $issueqty_sth->fetchrow_hashref() ) {
Link Here
|
507 |
$issued_itemtypes_count->{ $data->{'description'} } ); |
494 |
$issued_itemtypes_count->{ $data->{'description'} } ); |
508 |
|
495 |
|
509 |
# can't have a negative number of remaining |
496 |
# can't have a negative number of remaining |
510 |
if ( $data->{'left'} < 0 ) { $data->{'left'} = "0" } |
497 |
if ( $data->{'left'} < 0 ) { $data->{'left'} = '0' } |
511 |
$data->{'flag'} = 1 unless ( $data->{'maxissueqty'} > $data->{'count'} ); |
498 |
if ( $data->{maxissueqty} <= $data->{count} ) { |
512 |
unless ( ( $data->{'maxissueqty'} < 1 ) |
499 |
$data->{flag} = 1; |
513 |
|| ( $data->{'itemtype'} eq "*" ) |
500 |
} |
514 |
|| ( $data->{'itemtype'} eq "CIRC" ) ) |
501 |
if ( $data->{maxissueqty} > 0 && $data->{itemtype} !~m/^(\*|CIRC)$/ ) { |
515 |
{ |
|
|
516 |
push @issued_itemtypes_count_loop, $data; |
502 |
push @issued_itemtypes_count_loop, $data; |
517 |
} |
503 |
} |
518 |
} |
504 |
} |
519 |
$issued_itemtypes_loop = \@issued_itemtypes_count_loop; |
|
|
520 |
|
505 |
|
521 |
#### / JF |
506 |
#### / JF |
522 |
|
507 |
|
Lines 548-556
if ($borrowerslist) {
Link Here
|
548 |
|
533 |
|
549 |
#title |
534 |
#title |
550 |
my $flags = $borrower->{'flags'}; |
535 |
my $flags = $borrower->{'flags'}; |
551 |
my $flag; |
536 |
foreach my $flag ( sort keys %$flags ) { |
552 |
|
|
|
553 |
foreach $flag ( sort keys %$flags ) { |
554 |
$template->param( flagged=> 1); |
537 |
$template->param( flagged=> 1); |
555 |
$flags->{$flag}->{'message'} =~ s#\n#<br />#g; |
538 |
$flags->{$flag}->{'message'} =~ s#\n#<br />#g; |
556 |
if ( $flags->{$flag}->{'noissues'} ) { |
539 |
if ( $flags->{$flag}->{'noissues'} ) { |
Lines 561-573
foreach $flag ( sort keys %$flags ) {
Link Here
|
561 |
if ( $flag eq 'GNA' ) { |
544 |
if ( $flag eq 'GNA' ) { |
562 |
$template->param( gna => 'true' ); |
545 |
$template->param( gna => 'true' ); |
563 |
} |
546 |
} |
564 |
if ( $flag eq 'LOST' ) { |
547 |
elsif ( $flag eq 'LOST' ) { |
565 |
$template->param( lost => 'true' ); |
548 |
$template->param( lost => 'true' ); |
566 |
} |
549 |
} |
567 |
if ( $flag eq 'DBARRED' ) { |
550 |
elsif ( $flag eq 'DBARRED' ) { |
568 |
$template->param( dbarred => 'true' ); |
551 |
$template->param( dbarred => 'true' ); |
569 |
} |
552 |
} |
570 |
if ( $flag eq 'CHARGES' ) { |
553 |
elsif ( $flag eq 'CHARGES' ) { |
571 |
$template->param( |
554 |
$template->param( |
572 |
charges => 'true', |
555 |
charges => 'true', |
573 |
chargesmsg => $flags->{'CHARGES'}->{'message'}, |
556 |
chargesmsg => $flags->{'CHARGES'}->{'message'}, |
Lines 575-581
foreach $flag ( sort keys %$flags ) {
Link Here
|
575 |
charges_is_blocker => 1 |
558 |
charges_is_blocker => 1 |
576 |
); |
559 |
); |
577 |
} |
560 |
} |
578 |
if ( $flag eq 'CREDITS' ) { |
561 |
elsif ( $flag eq 'CREDITS' ) { |
579 |
$template->param( |
562 |
$template->param( |
580 |
credits => 'true', |
563 |
credits => 'true', |
581 |
creditsmsg => $flags->{'CREDITS'}->{'message'} |
564 |
creditsmsg => $flags->{'CREDITS'}->{'message'} |
Lines 591-603
foreach $flag ( sort keys %$flags ) {
Link Here
|
591 |
chargesamount => $flags->{'CHARGES'}->{'amount'}, |
574 |
chargesamount => $flags->{'CHARGES'}->{'amount'}, |
592 |
); |
575 |
); |
593 |
} |
576 |
} |
594 |
if ( $flag eq 'CREDITS' ) { |
577 |
elsif ( $flag eq 'CREDITS' ) { |
595 |
$template->param( |
578 |
$template->param( |
596 |
credits => 'true', |
579 |
credits => 'true', |
597 |
creditsmsg => $flags->{'CREDITS'}->{'message'} |
580 |
creditsmsg => $flags->{'CREDITS'}->{'message'} |
598 |
); |
581 |
); |
599 |
} |
582 |
} |
600 |
if ( $flag eq 'ODUES' ) { |
583 |
elsif ( $flag eq 'ODUES' ) { |
601 |
$template->param( |
584 |
$template->param( |
602 |
odues => 'true', |
585 |
odues => 'true', |
603 |
flagged => 1, |
586 |
flagged => 1, |
Lines 605-624
foreach $flag ( sort keys %$flags ) {
Link Here
|
605 |
); |
588 |
); |
606 |
|
589 |
|
607 |
my $items = $flags->{$flag}->{'itemlist'}; |
590 |
my $items = $flags->{$flag}->{'itemlist'}; |
608 |
# useless ??? |
591 |
if ( ! $query->param('module') || $query->param('module') ne 'returns' ) { |
609 |
# { |
|
|
610 |
# my @itemswaiting; |
611 |
# foreach my $item (@$items) { |
612 |
# my ($iteminformation) = |
613 |
# getiteminformation( $item->{'itemnumber'}, 0 ); |
614 |
# push @itemswaiting, $iteminformation; |
615 |
# } |
616 |
# } |
617 |
if ( $query->param('module') ne 'returns' ) { |
618 |
$template->param( nonreturns => 'true' ); |
592 |
$template->param( nonreturns => 'true' ); |
619 |
} |
593 |
} |
620 |
} |
594 |
} |
621 |
if ( $flag eq 'NOTES' ) { |
595 |
elsif ( $flag eq 'NOTES' ) { |
622 |
$template->param( |
596 |
$template->param( |
623 |
notes => 'true', |
597 |
notes => 'true', |
624 |
flagged => 1, |
598 |
flagged => 1, |
Lines 629-635
foreach $flag ( sort keys %$flags ) {
Link Here
|
629 |
} |
603 |
} |
630 |
|
604 |
|
631 |
my $amountold = $borrower->{flags}->{'CHARGES'}->{'message'} || 0; |
605 |
my $amountold = $borrower->{flags}->{'CHARGES'}->{'message'} || 0; |
632 |
my @temp = split( /\$/, $amountold ); |
606 |
$amountold =~ s/^.*\$//; # remove upto the $, if any |
|
|
607 |
|
608 |
my ( $total, $accts, $numaccts) = GetMemberAccountRecords( $borrowernumber ); |
633 |
|
609 |
|
634 |
if ( $borrower->{'category_type'} eq 'C') { |
610 |
if ( $borrower->{'category_type'} eq 'C') { |
635 |
my ( $catcodes, $labels ) = GetborCatFromCatType( 'A', 'WHERE category_type = ?' ); |
611 |
my ( $catcodes, $labels ) = GetborCatFromCatType( 'A', 'WHERE category_type = ?' ); |
Lines 646-653
if ( C4::Context->preference("memberofinstitution") ) {
Link Here
|
646 |
my %org_labels; |
622 |
my %org_labels; |
647 |
foreach my $organisation ( keys %$organisations ) { |
623 |
foreach my $organisation ( keys %$organisations ) { |
648 |
push @orgs, $organisation; |
624 |
push @orgs, $organisation; |
649 |
$org_labels{$organisation} = |
625 |
$org_labels{$organisation} = $organisations->{$organisation}->{'surname'}; |
650 |
$organisations->{$organisation}->{'surname'}; |
|
|
651 |
} |
626 |
} |
652 |
$member_of_institution = 1; |
627 |
$member_of_institution = 1; |
653 |
$CGIorganisations = CGI::popup_menu( |
628 |
$CGIorganisations = CGI::popup_menu( |
Lines 658-687
if ( C4::Context->preference("memberofinstitution") ) {
Link Here
|
658 |
); |
633 |
); |
659 |
} |
634 |
} |
660 |
|
635 |
|
661 |
$amountold = $temp[1]; |
636 |
my $lib_messages_loop = GetMessages( $borrowernumber, 'L', $branch ); |
|
|
637 |
if($lib_messages_loop){ $template->param(flagged => 1 ); } |
638 |
|
639 |
my $bor_messages_loop = GetMessages( $borrowernumber, 'B', $branch ); |
640 |
if($bor_messages_loop){ $template->param(flagged => 1 ); } |
641 |
|
642 |
# Computes full borrower address |
643 |
my (undef, $roadttype_hashref) = &GetRoadTypes(); |
644 |
my $address = $borrower->{'streetnumber'}.' '.$roadttype_hashref->{$borrower->{'streettype'}}.' '.$borrower->{'address'}; |
662 |
|
645 |
|
663 |
$template->param( |
646 |
$template->param( |
664 |
issued_itemtypes_count_loop => $issued_itemtypes_loop, |
647 |
issued_itemtypes_count_loop => \@issued_itemtypes_count_loop, |
665 |
findborrower => $findborrower, |
648 |
lib_messages_loop => $lib_messages_loop, |
666 |
borrower => $borrower, |
649 |
bor_messages_loop => $bor_messages_loop, |
667 |
borrowernumber => $borrowernumber, |
650 |
all_messages_del => C4::Context->preference('AllowAllMessageDeletion'), |
668 |
branch => $branch, |
651 |
findborrower => $findborrower, |
669 |
branchname => GetBranchName($borrower->{'branchcode'}), |
652 |
borrower => $borrower, |
670 |
printer => $printer, |
653 |
borrowernumber => $borrowernumber, |
671 |
printername => $printer, |
654 |
branch => $branch, |
672 |
firstname => $borrower->{'firstname'}, |
655 |
branchname => GetBranchName($borrower->{'branchcode'}), |
673 |
surname => $borrower->{'surname'}, |
656 |
printer => $printer, |
|
|
657 |
printername => $printer, |
658 |
firstname => $borrower->{'firstname'}, |
659 |
surname => $borrower->{'surname'}, |
660 |
othernames => $borrower->{'othernames'}, |
674 |
dateexpiry => format_date($newexpiry), |
661 |
dateexpiry => format_date($newexpiry), |
675 |
expiry => format_date($borrower->{'dateexpiry'}), |
662 |
expiry => format_date($borrower->{'dateexpiry'}), |
676 |
categorycode => $borrower->{'categorycode'}, |
663 |
categorycode => $borrower->{'categorycode'}, |
677 |
categoryname => $borrower->{description}, |
664 |
categoryname => $borrower->{description}, |
678 |
address => $borrower->{'address'}, |
665 |
address => $address, |
679 |
address2 => $borrower->{'address2'}, |
666 |
address2 => $borrower->{'address2'}, |
680 |
email => $borrower->{'email'}, |
667 |
email => $borrower->{'email'}, |
681 |
emailpro => $borrower->{'emailpro'}, |
668 |
emailpro => $borrower->{'emailpro'}, |
682 |
borrowernotes => $borrower->{'borrowernotes'}, |
669 |
borrowernotes => $borrower->{'borrowernotes'}, |
683 |
city => $borrower->{'city'}, |
670 |
city => $borrower->{'city'}, |
684 |
zipcode => $borrower->{'zipcode'}, |
671 |
zipcode => $borrower->{'zipcode'}, |
|
|
672 |
country => $borrower->{'country'}, |
685 |
phone => $borrower->{'phone'} || $borrower->{'mobile'}, |
673 |
phone => $borrower->{'phone'} || $borrower->{'mobile'}, |
686 |
cardnumber => $borrower->{'cardnumber'}, |
674 |
cardnumber => $borrower->{'cardnumber'}, |
687 |
amountold => $amountold, |
675 |
amountold => $amountold, |
Lines 690-701
$template->param(
Link Here
|
690 |
duedatespec => $duedatespec, |
678 |
duedatespec => $duedatespec, |
691 |
message => $message, |
679 |
message => $message, |
692 |
CGIselectborrower => $CGIselectborrower, |
680 |
CGIselectborrower => $CGIselectborrower, |
|
|
681 |
totalprice => sprintf('%.2f', $totalprice), |
682 |
totaldue => sprintf('%.2f', $total), |
693 |
todayissues => \@todaysissues, |
683 |
todayissues => \@todaysissues, |
694 |
previssues => \@previousissues, |
684 |
previssues => \@previousissues, |
695 |
inprocess => $inprocess, |
685 |
inprocess => $inprocess, |
696 |
memberofinstution => $member_of_institution, |
686 |
memberofinstution => $member_of_institution, |
697 |
CGIorganisations => $CGIorganisations, |
687 |
CGIorganisations => $CGIorganisations, |
698 |
is_child => ($borrower->{'category_type'} eq 'C'), |
688 |
is_child => ($borrower->{'category_type'} eq 'C'), |
699 |
circview => 1, |
689 |
circview => 1, |
700 |
); |
690 |
); |
701 |
|
691 |
|
Lines 704-716
if ($stickyduedate) {
Link Here
|
704 |
$session->param( 'stickyduedate', $duedatespec ); |
694 |
$session->param( 'stickyduedate', $duedatespec ); |
705 |
} |
695 |
} |
706 |
|
696 |
|
707 |
#if ($branchcookie) { |
|
|
708 |
#$cookie=[$cookie, $branchcookie, $printercookie]; |
709 |
#} |
710 |
|
711 |
my ($picture, $dberror) = GetPatronImage($borrower->{'cardnumber'}); |
697 |
my ($picture, $dberror) = GetPatronImage($borrower->{'cardnumber'}); |
712 |
$template->param( picture => 1 ) if $picture; |
698 |
$template->param( picture => 1 ) if $picture; |
713 |
|
699 |
|
|
|
700 |
# get authorised values with type of BOR_NOTES |
701 |
my @canned_notes; |
702 |
my $sth = $dbh->prepare('SELECT * FROM authorised_values WHERE category = "BOR_NOTES"'); |
703 |
$sth->execute(); |
704 |
while ( my $row = $sth->fetchrow_hashref() ) { |
705 |
push @canned_notes, $row; |
706 |
} |
707 |
if ( scalar( @canned_notes ) ) { |
708 |
$template->param( canned_bor_notes_loop => \@canned_notes ); |
709 |
} |
714 |
|
710 |
|
715 |
$template->param( |
711 |
$template->param( |
716 |
debt_confirmed => $debt_confirmed, |
712 |
debt_confirmed => $debt_confirmed, |