Lines 858-864
sub CanBookBeIssued {
Link Here
|
858 |
my $sth = $dbh->prepare("SELECT notforloan FROM itemtypes WHERE itemtype = ?"); |
858 |
my $sth = $dbh->prepare("SELECT notforloan FROM itemtypes WHERE itemtype = ?"); |
859 |
$sth->execute($item->{'itemtype'}); |
859 |
$sth->execute($item->{'itemtype'}); |
860 |
my $notforloan=$sth->fetchrow_hashref(); |
860 |
my $notforloan=$sth->fetchrow_hashref(); |
861 |
$sth->finish(); |
|
|
862 |
if ($notforloan->{'notforloan'}) { |
861 |
if ($notforloan->{'notforloan'}) { |
863 |
if (!C4::Context->preference("AllowNotForLoanOverride")) { |
862 |
if (!C4::Context->preference("AllowNotForLoanOverride")) { |
864 |
$issuingimpossible{NOT_FOR_LOAN} = 1; |
863 |
$issuingimpossible{NOT_FOR_LOAN} = 1; |
Lines 2204-2210
sub _FixAccountForLostAndReturned {
Link Here
|
2204 |
(?,?,?,?)"); |
2203 |
(?,?,?,?)"); |
2205 |
$usth->execute($data->{'borrowernumber'},$accdata->{'accountno'},$nextaccntno,$newamtos); |
2204 |
$usth->execute($data->{'borrowernumber'},$accdata->{'accountno'},$nextaccntno,$newamtos); |
2206 |
} |
2205 |
} |
2207 |
$msth->finish; # $msth might actually have data left |
|
|
2208 |
} |
2206 |
} |
2209 |
$amountleft *= -1 if ($amountleft > 0); |
2207 |
$amountleft *= -1 if ($amountleft > 0); |
2210 |
my $desc = "Item Returned " . $item_id; |
2208 |
my $desc = "Item Returned " . $item_id; |
Lines 2436-2442
END_SQL
Link Here
|
2436 |
my $sth = $dbh->prepare( $statement ); |
2434 |
my $sth = $dbh->prepare( $statement ); |
2437 |
$sth->execute( @bind_parameters ); |
2435 |
$sth->execute( @bind_parameters ); |
2438 |
my $upcoming_dues = $sth->fetchall_arrayref({}); |
2436 |
my $upcoming_dues = $sth->fetchall_arrayref({}); |
2439 |
$sth->finish; |
|
|
2440 |
|
2437 |
|
2441 |
return $upcoming_dues; |
2438 |
return $upcoming_dues; |
2442 |
} |
2439 |
} |
Lines 2538-2544
sub AddRenewal {
Link Here
|
2538 |
); |
2535 |
); |
2539 |
$sth->execute( $borrowernumber, $itemnumber ); |
2536 |
$sth->execute( $borrowernumber, $itemnumber ); |
2540 |
my $issuedata = $sth->fetchrow_hashref; |
2537 |
my $issuedata = $sth->fetchrow_hashref; |
2541 |
$sth->finish; |
|
|
2542 |
if(defined $datedue && ref $datedue ne 'DateTime' ) { |
2538 |
if(defined $datedue && ref $datedue ne 'DateTime' ) { |
2543 |
carp 'Invalid date passed to AddRenewal.'; |
2539 |
carp 'Invalid date passed to AddRenewal.'; |
2544 |
return; |
2540 |
return; |
Lines 2566-2572
sub AddRenewal {
Link Here
|
2566 |
); |
2562 |
); |
2567 |
|
2563 |
|
2568 |
$sth->execute( $datedue->strftime('%Y-%m-%d %H:%M'), $renews, $lastreneweddate, $borrowernumber, $itemnumber ); |
2564 |
$sth->execute( $datedue->strftime('%Y-%m-%d %H:%M'), $renews, $lastreneweddate, $borrowernumber, $itemnumber ); |
2569 |
$sth->finish; |
|
|
2570 |
|
2565 |
|
2571 |
# Update the renewal count on the item, and tell zebra to reindex |
2566 |
# Update the renewal count on the item, and tell zebra to reindex |
2572 |
$renews = $biblio->{'renewals'} + 1; |
2567 |
$renews = $biblio->{'renewals'} + 1; |
Lines 2638-2644
sub GetRenewCount {
Link Here
|
2638 |
$sth->execute( $bornum, $itemno ); |
2633 |
$sth->execute( $bornum, $itemno ); |
2639 |
my $data = $sth->fetchrow_hashref; |
2634 |
my $data = $sth->fetchrow_hashref; |
2640 |
$renewcount = $data->{'renewals'} if $data->{'renewals'}; |
2635 |
$renewcount = $data->{'renewals'} if $data->{'renewals'}; |
2641 |
$sth->finish; |
|
|
2642 |
# $item and $borrower should be calculated |
2636 |
# $item and $borrower should be calculated |
2643 |
my $branchcode = _GetCircControlBranch($item, $borrower); |
2637 |
my $branchcode = _GetCircControlBranch($item, $borrower); |
2644 |
|
2638 |
|
Lines 2707-2713
sub GetIssuingCharges {
Link Here
|
2707 |
} |
2701 |
} |
2708 |
} |
2702 |
} |
2709 |
|
2703 |
|
2710 |
$sth->finish; # we havent _explicitly_ fetched all rows |
|
|
2711 |
return ( $charge, $item_type ); |
2704 |
return ( $charge, $item_type ); |
2712 |
} |
2705 |
} |
2713 |
|
2706 |
|
Lines 2769-2775
sub AddIssuingCharge {
Link Here
|
2769 |
"; |
2762 |
"; |
2770 |
my $sth = $dbh->prepare($query); |
2763 |
my $sth = $dbh->prepare($query); |
2771 |
$sth->execute( $borrowernumber, $itemnumber, $nextaccntno, $charge, $charge, $manager_id ); |
2764 |
$sth->execute( $borrowernumber, $itemnumber, $nextaccntno, $charge, $charge, $manager_id ); |
2772 |
$sth->finish; |
|
|
2773 |
} |
2765 |
} |
2774 |
|
2766 |
|
2775 |
=head2 GetTransfers |
2767 |
=head2 GetTransfers |
Lines 2794-2800
sub GetTransfers {
Link Here
|
2794 |
my $sth = $dbh->prepare($query); |
2786 |
my $sth = $dbh->prepare($query); |
2795 |
$sth->execute($itemnumber); |
2787 |
$sth->execute($itemnumber); |
2796 |
my @row = $sth->fetchrow_array(); |
2788 |
my @row = $sth->fetchrow_array(); |
2797 |
$sth->finish; |
|
|
2798 |
return @row; |
2789 |
return @row; |
2799 |
} |
2790 |
} |
2800 |
|
2791 |
|
Lines 2824-2830
sub GetTransfersFromTo {
Link Here
|
2824 |
while ( my $data = $sth->fetchrow_hashref ) { |
2815 |
while ( my $data = $sth->fetchrow_hashref ) { |
2825 |
push @gettransfers, $data; |
2816 |
push @gettransfers, $data; |
2826 |
} |
2817 |
} |
2827 |
$sth->finish; |
|
|
2828 |
return (@gettransfers); |
2818 |
return (@gettransfers); |
2829 |
} |
2819 |
} |
2830 |
|
2820 |
|
Lines 2843-2849
sub DeleteTransfer {
Link Here
|
2843 |
AND datearrived IS NULL " |
2833 |
AND datearrived IS NULL " |
2844 |
); |
2834 |
); |
2845 |
$sth->execute($itemnumber); |
2835 |
$sth->execute($itemnumber); |
2846 |
$sth->finish; |
|
|
2847 |
} |
2836 |
} |
2848 |
|
2837 |
|
2849 |
=head2 AnonymiseIssueHistory |
2838 |
=head2 AnonymiseIssueHistory |
Lines 2988-2994
sub updateWrongTransfer {
Link Here
|
2988 |
"update branchtransfers set datearrived = now(),tobranch=?,comments='wrongtransfer' where itemnumber= ? AND datearrived IS NULL" |
2977 |
"update branchtransfers set datearrived = now(),tobranch=?,comments='wrongtransfer' where itemnumber= ? AND datearrived IS NULL" |
2989 |
); |
2978 |
); |
2990 |
$sth->execute($FromLibrary,$itemNumber); |
2979 |
$sth->execute($FromLibrary,$itemNumber); |
2991 |
$sth->finish; |
|
|
2992 |
|
2980 |
|
2993 |
# second step create a new line of branchtransfer to the right location . |
2981 |
# second step create a new line of branchtransfer to the right location . |
2994 |
ModItemTransfer($itemNumber, $FromLibrary, $waitingAtLibrary); |
2982 |
ModItemTransfer($itemNumber, $FromLibrary, $waitingAtLibrary); |
Lines 3132-3138
my $query = qq|SELECT count(*)
Link Here
|
3132 |
my $sth = $dbh->prepare($query); |
3120 |
my $sth = $dbh->prepare($query); |
3133 |
$sth->execute($branchcode,$week_day); |
3121 |
$sth->execute($branchcode,$week_day); |
3134 |
my $result=$sth->fetchrow; |
3122 |
my $result=$sth->fetchrow; |
3135 |
$sth->finish; |
|
|
3136 |
return $result; |
3123 |
return $result; |
3137 |
} |
3124 |
} |
3138 |
|
3125 |
|
Lines 3164-3170
my $query=qq|SELECT count(*)
Link Here
|
3164 |
my $sth = $dbh->prepare($query); |
3151 |
my $sth = $dbh->prepare($query); |
3165 |
$sth->execute($years,$month,$day,$branchcode); |
3152 |
$sth->execute($years,$month,$day,$branchcode); |
3166 |
my $countspecial=$sth->fetchrow ; |
3153 |
my $countspecial=$sth->fetchrow ; |
3167 |
$sth->finish; |
|
|
3168 |
return $countspecial; |
3154 |
return $countspecial; |
3169 |
} |
3155 |
} |
3170 |
|
3156 |
|
Lines 3193-3199
my $query=qq|SELECT count(*)
Link Here
|
3193 |
my $sth = $dbh->prepare($query); |
3179 |
my $sth = $dbh->prepare($query); |
3194 |
$sth->execute($month,$day,$branchcode); |
3180 |
$sth->execute($month,$day,$branchcode); |
3195 |
my $countspecial=$sth->fetchrow ; |
3181 |
my $countspecial=$sth->fetchrow ; |
3196 |
$sth->finish; |
|
|
3197 |
return $countspecial; |
3182 |
return $countspecial; |
3198 |
} |
3183 |
} |
3199 |
|
3184 |
|
Lines 3209-3215
my $query=qq|SELECT count(*)
Link Here
|
3209 |
my $sth = $dbh->prepare($query); |
3194 |
my $sth = $dbh->prepare($query); |
3210 |
$sth->execute($barcode); |
3195 |
$sth->execute($barcode); |
3211 |
my $exist=$sth->fetchrow ; |
3196 |
my $exist=$sth->fetchrow ; |
3212 |
$sth->finish; |
|
|
3213 |
return $exist; |
3197 |
return $exist; |
3214 |
} |
3198 |
} |
3215 |
|
3199 |
|
Lines 3300-3306
sub LostItem{
Link Here
|
3300 |
WHERE issues.itemnumber=?"); |
3284 |
WHERE issues.itemnumber=?"); |
3301 |
$sth->execute($itemnumber); |
3285 |
$sth->execute($itemnumber); |
3302 |
my $issues=$sth->fetchrow_hashref(); |
3286 |
my $issues=$sth->fetchrow_hashref(); |
3303 |
$sth->finish; |
|
|
3304 |
|
3287 |
|
3305 |
# if a borrower lost the item, add a replacement cost to the their record |
3288 |
# if a borrower lost the item, add a replacement cost to the their record |
3306 |
if ( my $borrowernumber = $issues->{borrowernumber} ){ |
3289 |
if ( my $borrowernumber = $issues->{borrowernumber} ){ |
Lines 3319-3325
sub GetOfflineOperations {
Link Here
|
3319 |
my $sth = $dbh->prepare("SELECT * FROM pending_offline_operations WHERE branchcode=? ORDER BY timestamp"); |
3302 |
my $sth = $dbh->prepare("SELECT * FROM pending_offline_operations WHERE branchcode=? ORDER BY timestamp"); |
3320 |
$sth->execute(C4::Context->userenv->{'branch'}); |
3303 |
$sth->execute(C4::Context->userenv->{'branch'}); |
3321 |
my $results = $sth->fetchall_arrayref({}); |
3304 |
my $results = $sth->fetchall_arrayref({}); |
3322 |
$sth->finish; |
|
|
3323 |
return $results; |
3305 |
return $results; |
3324 |
} |
3306 |
} |
3325 |
|
3307 |
|
Lines 3328-3334
sub GetOfflineOperation {
Link Here
|
3328 |
my $sth = $dbh->prepare("SELECT * FROM pending_offline_operations WHERE operationid=?"); |
3310 |
my $sth = $dbh->prepare("SELECT * FROM pending_offline_operations WHERE operationid=?"); |
3329 |
$sth->execute( shift ); |
3311 |
$sth->execute( shift ); |
3330 |
my $result = $sth->fetchrow_hashref; |
3312 |
my $result = $sth->fetchrow_hashref; |
3331 |
$sth->finish; |
|
|
3332 |
return $result; |
3313 |
return $result; |
3333 |
} |
3314 |
} |
3334 |
|
3315 |
|
3335 |
- |
|
|