View | Details | Raw Unified | Return to bug 10681
Collapse All | Expand All

(-)a/C4/Circulation.pm (-20 lines)
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 2202-2208 sub _FixAccountForLostAndReturned { Link Here
2202
                (?,?,?,?)");
2201
                (?,?,?,?)");
2203
            $usth->execute($data->{'borrowernumber'},$accdata->{'accountno'},$nextaccntno,$newamtos);
2202
            $usth->execute($data->{'borrowernumber'},$accdata->{'accountno'},$nextaccntno,$newamtos);
2204
        }
2203
        }
2205
        $msth->finish;  # $msth might actually have data left
2206
    }
2204
    }
2207
    $amountleft *= -1 if ($amountleft > 0);
2205
    $amountleft *= -1 if ($amountleft > 0);
2208
    my $desc = "Item Returned " . $item_id;
2206
    my $desc = "Item Returned " . $item_id;
Lines 2434-2440 END_SQL Link Here
2434
    my $sth = $dbh->prepare( $statement );
2432
    my $sth = $dbh->prepare( $statement );
2435
    $sth->execute( @bind_parameters );
2433
    $sth->execute( @bind_parameters );
2436
    my $upcoming_dues = $sth->fetchall_arrayref({});
2434
    my $upcoming_dues = $sth->fetchall_arrayref({});
2437
    $sth->finish;
2438
2435
2439
    return $upcoming_dues;
2436
    return $upcoming_dues;
2440
}
2437
}
Lines 2535-2541 sub AddRenewal { Link Here
2535
      );
2532
      );
2536
    $sth->execute( $borrowernumber, $itemnumber );
2533
    $sth->execute( $borrowernumber, $itemnumber );
2537
    my $issuedata = $sth->fetchrow_hashref;
2534
    my $issuedata = $sth->fetchrow_hashref;
2538
    $sth->finish;
2539
    if(defined $datedue && ref $datedue ne 'DateTime' ) {
2535
    if(defined $datedue && ref $datedue ne 'DateTime' ) {
2540
        carp 'Invalid date passed to AddRenewal.';
2536
        carp 'Invalid date passed to AddRenewal.';
2541
        return;
2537
        return;
Lines 2563-2569 sub AddRenewal { Link Here
2563
    );
2559
    );
2564
2560
2565
    $sth->execute( $datedue->strftime('%Y-%m-%d %H:%M'), $renews, $lastreneweddate, $borrowernumber, $itemnumber );
2561
    $sth->execute( $datedue->strftime('%Y-%m-%d %H:%M'), $renews, $lastreneweddate, $borrowernumber, $itemnumber );
2566
    $sth->finish;
2567
2562
2568
    # Update the renewal count on the item, and tell zebra to reindex
2563
    # Update the renewal count on the item, and tell zebra to reindex
2569
    $renews = $biblio->{'renewals'} + 1;
2564
    $renews = $biblio->{'renewals'} + 1;
Lines 2635-2641 sub GetRenewCount { Link Here
2635
    $sth->execute( $bornum, $itemno );
2630
    $sth->execute( $bornum, $itemno );
2636
    my $data = $sth->fetchrow_hashref;
2631
    my $data = $sth->fetchrow_hashref;
2637
    $renewcount = $data->{'renewals'} if $data->{'renewals'};
2632
    $renewcount = $data->{'renewals'} if $data->{'renewals'};
2638
    $sth->finish;
2639
    # $item and $borrower should be calculated
2633
    # $item and $borrower should be calculated
2640
    my $branchcode = _GetCircControlBranch($item, $borrower);
2634
    my $branchcode = _GetCircControlBranch($item, $borrower);
2641
    
2635
    
Lines 2704-2710 sub GetIssuingCharges { Link Here
2704
        }
2698
        }
2705
    }
2699
    }
2706
2700
2707
    $sth->finish; # we havent _explicitly_ fetched all rows
2708
    return ( $charge, $item_type );
2701
    return ( $charge, $item_type );
2709
}
2702
}
2710
2703
Lines 2766-2772 sub AddIssuingCharge { Link Here
2766
    ";
2759
    ";
2767
    my $sth = $dbh->prepare($query);
2760
    my $sth = $dbh->prepare($query);
2768
    $sth->execute( $borrowernumber, $itemnumber, $nextaccntno, $charge, $charge, $manager_id );
2761
    $sth->execute( $borrowernumber, $itemnumber, $nextaccntno, $charge, $charge, $manager_id );
2769
    $sth->finish;
2770
}
2762
}
2771
2763
2772
=head2 GetTransfers
2764
=head2 GetTransfers
Lines 2791-2797 sub GetTransfers { Link Here
2791
    my $sth = $dbh->prepare($query);
2783
    my $sth = $dbh->prepare($query);
2792
    $sth->execute($itemnumber);
2784
    $sth->execute($itemnumber);
2793
    my @row = $sth->fetchrow_array();
2785
    my @row = $sth->fetchrow_array();
2794
    $sth->finish;
2795
    return @row;
2786
    return @row;
2796
}
2787
}
2797
2788
Lines 2821-2827 sub GetTransfersFromTo { Link Here
2821
    while ( my $data = $sth->fetchrow_hashref ) {
2812
    while ( my $data = $sth->fetchrow_hashref ) {
2822
        push @gettransfers, $data;
2813
        push @gettransfers, $data;
2823
    }
2814
    }
2824
    $sth->finish;
2825
    return (@gettransfers);
2815
    return (@gettransfers);
2826
}
2816
}
2827
2817
Lines 2840-2846 sub DeleteTransfer { Link Here
2840
         AND datearrived IS NULL "
2830
         AND datearrived IS NULL "
2841
    );
2831
    );
2842
    $sth->execute($itemnumber);
2832
    $sth->execute($itemnumber);
2843
    $sth->finish;
2844
}
2833
}
2845
2834
2846
=head2 AnonymiseIssueHistory
2835
=head2 AnonymiseIssueHistory
Lines 2985-2991 sub updateWrongTransfer { Link Here
2985
			"update branchtransfers set datearrived = now(),tobranch=?,comments='wrongtransfer' where itemnumber= ? AND datearrived IS NULL"
2974
			"update branchtransfers set datearrived = now(),tobranch=?,comments='wrongtransfer' where itemnumber= ? AND datearrived IS NULL"
2986
          	);
2975
          	);
2987
        	$sth->execute($FromLibrary,$itemNumber);
2976
        	$sth->execute($FromLibrary,$itemNumber);
2988
        	$sth->finish;
2989
2977
2990
# second step create a new line of branchtransfer to the right location .
2978
# second step create a new line of branchtransfer to the right location .
2991
	ModItemTransfer($itemNumber, $FromLibrary, $waitingAtLibrary);
2979
	ModItemTransfer($itemNumber, $FromLibrary, $waitingAtLibrary);
Lines 3129-3135 my $query = qq|SELECT count(*) Link Here
3129
my $sth = $dbh->prepare($query);
3117
my $sth = $dbh->prepare($query);
3130
$sth->execute($branchcode,$week_day);
3118
$sth->execute($branchcode,$week_day);
3131
my $result=$sth->fetchrow;
3119
my $result=$sth->fetchrow;
3132
$sth->finish;
3133
return $result;
3120
return $result;
3134
}
3121
}
3135
3122
Lines 3161-3167 my $query=qq|SELECT count(*) Link Here
3161
my $sth = $dbh->prepare($query);
3148
my $sth = $dbh->prepare($query);
3162
$sth->execute($years,$month,$day,$branchcode);
3149
$sth->execute($years,$month,$day,$branchcode);
3163
my $countspecial=$sth->fetchrow ;
3150
my $countspecial=$sth->fetchrow ;
3164
$sth->finish;
3165
return $countspecial;
3151
return $countspecial;
3166
}
3152
}
3167
3153
Lines 3190-3196 my $query=qq|SELECT count(*) Link Here
3190
my $sth = $dbh->prepare($query);
3176
my $sth = $dbh->prepare($query);
3191
$sth->execute($month,$day,$branchcode);
3177
$sth->execute($month,$day,$branchcode);
3192
my $countspecial=$sth->fetchrow ;
3178
my $countspecial=$sth->fetchrow ;
3193
$sth->finish;
3194
return $countspecial;
3179
return $countspecial;
3195
}
3180
}
3196
3181
Lines 3206-3212 my $query=qq|SELECT count(*) Link Here
3206
my $sth = $dbh->prepare($query);
3191
my $sth = $dbh->prepare($query);
3207
$sth->execute($barcode);
3192
$sth->execute($barcode);
3208
my $exist=$sth->fetchrow ;
3193
my $exist=$sth->fetchrow ;
3209
$sth->finish;
3210
return $exist;
3194
return $exist;
3211
}
3195
}
3212
3196
Lines 3297-3303 sub LostItem{ Link Here
3297
                           WHERE issues.itemnumber=?");
3281
                           WHERE issues.itemnumber=?");
3298
    $sth->execute($itemnumber);
3282
    $sth->execute($itemnumber);
3299
    my $issues=$sth->fetchrow_hashref();
3283
    my $issues=$sth->fetchrow_hashref();
3300
    $sth->finish;
3301
3284
3302
    # if a borrower lost the item, add a replacement cost to the their record
3285
    # if a borrower lost the item, add a replacement cost to the their record
3303
    if ( my $borrowernumber = $issues->{borrowernumber} ){
3286
    if ( my $borrowernumber = $issues->{borrowernumber} ){
Lines 3316-3322 sub GetOfflineOperations { Link Here
3316
    my $sth = $dbh->prepare("SELECT * FROM pending_offline_operations WHERE branchcode=? ORDER BY timestamp");
3299
    my $sth = $dbh->prepare("SELECT * FROM pending_offline_operations WHERE branchcode=? ORDER BY timestamp");
3317
    $sth->execute(C4::Context->userenv->{'branch'});
3300
    $sth->execute(C4::Context->userenv->{'branch'});
3318
    my $results = $sth->fetchall_arrayref({});
3301
    my $results = $sth->fetchall_arrayref({});
3319
    $sth->finish;
3320
    return $results;
3302
    return $results;
3321
}
3303
}
3322
3304
Lines 3325-3331 sub GetOfflineOperation { Link Here
3325
    my $sth = $dbh->prepare("SELECT * FROM pending_offline_operations WHERE operationid=?");
3307
    my $sth = $dbh->prepare("SELECT * FROM pending_offline_operations WHERE operationid=?");
3326
    $sth->execute( shift );
3308
    $sth->execute( shift );
3327
    my $result = $sth->fetchrow_hashref;
3309
    my $result = $sth->fetchrow_hashref;
3328
    $sth->finish;
3329
    return $result;
3310
    return $result;
3330
}
3311
}
3331
3312
3332
- 

Return to bug 10681