Lines 247-258
sub kocIssueItem {
Link Here
|
247 |
my $item = GetBiblioFromItemNumber( undef, $circ->{ 'barcode' } ); |
247 |
my $item = GetBiblioFromItemNumber( undef, $circ->{ 'barcode' } ); |
248 |
my $issue = GetItemIssue( $item->{'itemnumber'} ); |
248 |
my $issue = GetItemIssue( $item->{'itemnumber'} ); |
249 |
|
249 |
|
250 |
my $issuingrule = GetIssuingRule( $borrower->{ 'categorycode' }, $item->{ 'itemtype' }, $branchcode ); |
|
|
251 |
my $issuelength = $issuingrule->{ 'issuelength' }; |
252 |
my ( $year, $month, $day ) = split( /-/, $circ->{'date'} ); |
253 |
( $year, $month, $day ) = Add_Delta_Days( $year, $month, $day, $issuelength ); |
254 |
my $date_due = sprintf("%04d-%02d-%02d", $year, $month, $day); |
255 |
|
256 |
if ( $issue->{ 'date_due' } ) { ## Item is currently checked out to another person. |
250 |
if ( $issue->{ 'date_due' } ) { ## Item is currently checked out to another person. |
257 |
#warn "Item Currently Issued."; |
251 |
#warn "Item Currently Issued."; |
258 |
my $issue = GetOpenIssue( $item->{'itemnumber'} ); |
252 |
my $issue = GetOpenIssue( $item->{'itemnumber'} ); |
Lines 260-271
sub kocIssueItem {
Link Here
|
260 |
if ( $issue->{'borrowernumber'} eq $borrower->{'borrowernumber'} ) { ## Issued to this person already, renew it. |
254 |
if ( $issue->{'borrowernumber'} eq $borrower->{'borrowernumber'} ) { ## Issued to this person already, renew it. |
261 |
#warn "Item issued to this member already, renewing."; |
255 |
#warn "Item issued to this member already, renewing."; |
262 |
|
256 |
|
263 |
my $date_due_object = C4::Dates->new($date_due ,'iso'); |
|
|
264 |
C4::Circulation::AddRenewal( |
257 |
C4::Circulation::AddRenewal( |
265 |
$issue->{'borrowernumber'}, # borrowernumber |
258 |
$issue->{'borrowernumber'}, # borrowernumber |
266 |
$item->{'itemnumber'}, # itemnumber |
259 |
$item->{'itemnumber'}, # itemnumber |
267 |
undef, # branch |
260 |
undef, # branch |
268 |
$date_due_object, # datedue |
261 |
undef, # datedue - let AddRenewal calculate it automatically |
269 |
$circ->{'date'}, # issuedate |
262 |
$circ->{'date'}, # issuedate |
270 |
) unless ($DEBUG); |
263 |
) unless ($DEBUG); |
271 |
|
264 |
|
Lines 288-295
sub kocIssueItem {
Link Here
|
288 |
my ( $c_y, $c_m, $c_d ) = split( /-/, $circ->{'date'} ); |
281 |
my ( $c_y, $c_m, $c_d ) = split( /-/, $circ->{'date'} ); |
289 |
|
282 |
|
290 |
if ( Date_to_Days( $i_y, $i_m, $i_d ) < Date_to_Days( $c_y, $c_m, $c_d ) ) { ## Current issue to a different persion is older than this issue, return and issue. |
283 |
if ( Date_to_Days( $i_y, $i_m, $i_d ) < Date_to_Days( $c_y, $c_m, $c_d ) ) { ## Current issue to a different persion is older than this issue, return and issue. |
291 |
my $date_due_object = C4::Dates->new($date_due ,'iso'); |
284 |
C4::Circulation::AddIssue( $borrower, $circ->{'barcode'}, undef, undef, $circ->{'date'} ) unless ( DEBUG ); |
292 |
C4::Circulation::AddIssue( $borrower, $circ->{'barcode'}, $date_due_object ) unless ( DEBUG ); |
|
|
293 |
push( @output, { issue => 1, |
285 |
push( @output, { issue => 1, |
294 |
title => $item->{ 'title' }, |
286 |
title => $item->{ 'title' }, |
295 |
biblionumber => $item->{'biblionumber'}, |
287 |
biblionumber => $item->{'biblionumber'}, |
Lines 309-316
sub kocIssueItem {
Link Here
|
309 |
|
301 |
|
310 |
} |
302 |
} |
311 |
} else { ## Item is not checked out to anyone at the moment, go ahead and issue it |
303 |
} else { ## Item is not checked out to anyone at the moment, go ahead and issue it |
312 |
my $date_due_object = C4::Dates->new($date_due ,'iso'); |
304 |
C4::Circulation::AddIssue( $borrower, $circ->{'barcode'}, undef, undef, $circ->{'date'} ) unless ( DEBUG ); |
313 |
C4::Circulation::AddIssue( $borrower, $circ->{'barcode'}, $date_due_object ) unless ( DEBUG ); |
|
|
314 |
push( @output, { issue => 1, |
305 |
push( @output, { issue => 1, |
315 |
title => $item->{ 'title' }, |
306 |
title => $item->{ 'title' }, |
316 |
biblionumber => $item->{'biblionumber'}, |
307 |
biblionumber => $item->{'biblionumber'}, |
317 |
- |
|
|