Lines 1193-1198
sub AddIssue {
Link Here
|
1193 |
my $dbh = C4::Context->dbh; |
1193 |
my $dbh = C4::Context->dbh; |
1194 |
my $barcodecheck=CheckValidBarcode($barcode); |
1194 |
my $barcodecheck=CheckValidBarcode($barcode); |
1195 |
|
1195 |
|
|
|
1196 |
my $issue; |
1197 |
|
1196 |
if ($datedue && ref $datedue ne 'DateTime') { |
1198 |
if ($datedue && ref $datedue ne 'DateTime') { |
1197 |
$datedue = dt_from_string($datedue); |
1199 |
$datedue = dt_from_string($datedue); |
1198 |
} |
1200 |
} |
Lines 1263-1274
sub AddIssue {
Link Here
|
1263 |
} |
1265 |
} |
1264 |
|
1266 |
|
1265 |
# Record in the database the fact that the book was issued. |
1267 |
# Record in the database the fact that the book was issued. |
1266 |
my $sth = |
|
|
1267 |
$dbh->prepare( |
1268 |
"INSERT INTO issues |
1269 |
(borrowernumber, itemnumber,issuedate, date_due, branchcode, onsite_checkout, auto_renew) |
1270 |
VALUES (?,?,?,?,?,?,?)" |
1271 |
); |
1272 |
unless ($datedue) { |
1268 |
unless ($datedue) { |
1273 |
my $itype = ( C4::Context->preference('item-level_itypes') ) ? $biblio->{'itype'} : $biblio->{'itemtype'}; |
1269 |
my $itype = ( C4::Context->preference('item-level_itypes') ) ? $biblio->{'itype'} : $biblio->{'itemtype'}; |
1274 |
$datedue = CalcDateDue( $issuedate, $itype, $branch, $borrower ); |
1270 |
$datedue = CalcDateDue( $issuedate, $itype, $branch, $borrower ); |
Lines 1276-1290
sub AddIssue {
Link Here
|
1276 |
} |
1272 |
} |
1277 |
$datedue->truncate( to => 'minute'); |
1273 |
$datedue->truncate( to => 'minute'); |
1278 |
|
1274 |
|
1279 |
$sth->execute( |
1275 |
$issue = Koha::Database->new()->schema()->resultset('Issue')->create( |
1280 |
$borrower->{'borrowernumber'}, # borrowernumber |
1276 |
{ |
1281 |
$item->{'itemnumber'}, # itemnumber |
1277 |
borrowernumber => $borrower->{'borrowernumber'}, |
1282 |
$issuedate->strftime('%Y-%m-%d %H:%M:%S'), # issuedate |
1278 |
itemnumber => $item->{'itemnumber'}, |
1283 |
$datedue->strftime('%Y-%m-%d %H:%M:%S'), # date_due |
1279 |
issuedate => $issuedate->strftime('%Y-%m-%d %H:%M:%S'), |
1284 |
C4::Context->userenv->{'branch'}, # branchcode |
1280 |
date_due => $datedue->strftime('%Y-%m-%d %H:%M:%S'), |
1285 |
$onsite_checkout, |
1281 |
branchcode => C4::Context->userenv->{'branch'}, |
1286 |
$auto_renew ? 1 : 0 # automatic renewal |
1282 |
onsite_checkout => $onsite_checkout, |
|
|
1283 |
auto_renew => $auto_renew ? 1 : 0 |
1284 |
} |
1287 |
); |
1285 |
); |
|
|
1286 |
|
1288 |
if ( C4::Context->preference('ReturnToShelvingCart') ) { ## ReturnToShelvingCart is on, anything issued should be taken off the cart. |
1287 |
if ( C4::Context->preference('ReturnToShelvingCart') ) { ## ReturnToShelvingCart is on, anything issued should be taken off the cart. |
1289 |
CartToShelf( $item->{'itemnumber'} ); |
1288 |
CartToShelf( $item->{'itemnumber'} ); |
1290 |
} |
1289 |
} |
Lines 1354-1360
sub AddIssue {
Link Here
|
1354 |
logaction("CIRCULATION", "ISSUE", $borrower->{'borrowernumber'}, $biblio->{'itemnumber'}) |
1353 |
logaction("CIRCULATION", "ISSUE", $borrower->{'borrowernumber'}, $biblio->{'itemnumber'}) |
1355 |
if C4::Context->preference("IssueLog"); |
1354 |
if C4::Context->preference("IssueLog"); |
1356 |
} |
1355 |
} |
1357 |
return ($datedue); # not necessarily the same as when it came in! |
1356 |
return $issue; |
1358 |
} |
1357 |
} |
1359 |
|
1358 |
|
1360 |
=head2 GetLoanLength |
1359 |
=head2 GetLoanLength |