Lines 208-230
$dbh->do(
Link Here
|
208 |
.10, 1 |
208 |
.10, 1 |
209 |
); |
209 |
); |
210 |
|
210 |
|
211 |
# Test C4::Circulation::ProcessOfflinePayment |
|
|
212 |
my $sth = C4::Context->dbh->prepare("SELECT COUNT(*) FROM accountlines WHERE amount = '-123.45' AND accounttype = 'Pay'"); |
213 |
$sth->execute(); |
214 |
my ( $original_count ) = $sth->fetchrow_array(); |
215 |
|
216 |
C4::Context->dbh->do("INSERT INTO borrowers ( cardnumber, surname, firstname, categorycode, branchcode ) VALUES ( '99999999999', 'Hall', 'Kyle', ?, ? )", undef, $patron_category->{categorycode}, $library2->{branchcode} ); |
217 |
|
218 |
C4::Circulation::ProcessOfflinePayment({ cardnumber => '99999999999', amount => '123.45' }); |
219 |
|
220 |
$sth->execute(); |
221 |
my ( $new_count ) = $sth->fetchrow_array(); |
222 |
|
223 |
ok( $new_count == $original_count + 1, 'ProcessOfflinePayment makes payment correctly' ); |
224 |
|
225 |
C4::Context->dbh->do("DELETE FROM accountlines WHERE borrowernumber IN ( SELECT borrowernumber FROM borrowers WHERE cardnumber = '99999999999' )"); |
226 |
C4::Context->dbh->do("DELETE FROM borrowers WHERE cardnumber = '99999999999'"); |
227 |
C4::Context->dbh->do("DELETE FROM accountlines"); |
228 |
{ |
211 |
{ |
229 |
# CanBookBeRenewed tests |
212 |
# CanBookBeRenewed tests |
230 |
C4::Context->set_preference('ItemsDeniedRenewal',''); |
213 |
C4::Context->set_preference('ItemsDeniedRenewal',''); |
Lines 2909-2914
subtest 'AddRenewal and AddIssuingCharge tests' => sub {
Link Here
|
2909 |
$schema->storage->txn_rollback; |
2892 |
$schema->storage->txn_rollback; |
2910 |
}; |
2893 |
}; |
2911 |
|
2894 |
|
|
|
2895 |
subtest 'ProcessOfflinePayment() tests' => sub { |
2896 |
|
2897 |
plan tests => 4; |
2898 |
|
2899 |
$schema->storage->txn_begin; |
2900 |
|
2901 |
my $amount = 123; |
2902 |
|
2903 |
my $patron = $builder->build_object({ class => 'Koha::Patrons' }); |
2904 |
my $library = $builder->build_object({ class => 'Koha::Libraries' }); |
2905 |
my $result = C4::Circulation::ProcessOfflinePayment({ cardnumber => $patron->cardnumber, amount => $amount, branchcode => $library->id }); |
2906 |
|
2907 |
is( $result, 'Success.', 'The right string is returned' ); |
2908 |
|
2909 |
my $lines = $patron->account->lines; |
2910 |
is( $lines->count, 1, 'line created correctly'); |
2911 |
|
2912 |
my $line = $lines->next; |
2913 |
is( $line->amount+0, $amount * -1, 'amount picked from params' ); |
2914 |
is( $line->branchcode, $library->id, 'branchcode set correctly' ); |
2915 |
|
2916 |
$schema->storage->txn_rollback; |
2917 |
}; |
2918 |
|
2919 |
|
2912 |
|
2920 |
|
2913 |
sub set_userenv { |
2921 |
sub set_userenv { |
2914 |
my ( $library ) = @_; |
2922 |
my ( $library ) = @_; |
2915 |
- |
|
|