|
Lines 502-509
subtest 'renew_account' => sub {
Link Here
|
| 502 |
); |
502 |
); |
| 503 |
my $number_of_logs = |
503 |
my $number_of_logs = |
| 504 |
$schema->resultset('ActionLog') |
504 |
$schema->resultset('ActionLog') |
| 505 |
->search( { module => 'MEMBERS', action => 'RENEW', object => $retrieved_patron->borrowernumber } ) |
505 |
->search( { module => 'MEMBERS', action => 'RENEW', object => $retrieved_patron->borrowernumber } )->count; |
| 506 |
->count; |
|
|
| 507 |
is( $number_of_logs, 1, 'With BorrowersLog, Koha::Patron->renew_account should have logged' ); |
506 |
is( $number_of_logs, 1, 'With BorrowersLog, Koha::Patron->renew_account should have logged' ); |
| 508 |
|
507 |
|
| 509 |
t::lib::Mocks::mock_preference( 'BorrowerRenewalPeriodBase', 'now' ); |
508 |
t::lib::Mocks::mock_preference( 'BorrowerRenewalPeriodBase', 'now' ); |
|
Lines 519-526
subtest 'renew_account' => sub {
Link Here
|
| 519 |
is( dt_from_string($retrieved_expiry_date), $a_year_later, "today + 12 months must be $a_year_later" ); |
518 |
is( dt_from_string($retrieved_expiry_date), $a_year_later, "today + 12 months must be $a_year_later" ); |
| 520 |
$number_of_logs = |
519 |
$number_of_logs = |
| 521 |
$schema->resultset('ActionLog') |
520 |
$schema->resultset('ActionLog') |
| 522 |
->search( { module => 'MEMBERS', action => 'RENEW', object => $retrieved_patron->borrowernumber } ) |
521 |
->search( { module => 'MEMBERS', action => 'RENEW', object => $retrieved_patron->borrowernumber } )->count; |
| 523 |
->count; |
|
|
| 524 |
is( $number_of_logs, 1, 'Without BorrowersLog, Koha::Patron->renew_account should not have logged' ); |
522 |
is( $number_of_logs, 1, 'Without BorrowersLog, Koha::Patron->renew_account should not have logged' ); |
| 525 |
|
523 |
|
| 526 |
t::lib::Mocks::mock_preference( 'BorrowerRenewalPeriodBase', 'combination' ); |
524 |
t::lib::Mocks::mock_preference( 'BorrowerRenewalPeriodBase', 'combination' ); |
|
Lines 656-663
subtest "delete" => sub {
Link Here
|
| 656 |
|
654 |
|
| 657 |
my $number_of_logs = |
655 |
my $number_of_logs = |
| 658 |
$schema->resultset('ActionLog') |
656 |
$schema->resultset('ActionLog') |
| 659 |
->search( { module => 'MEMBERS', action => 'DELETE', object => $patron->borrowernumber } ) |
657 |
->search( { module => 'MEMBERS', action => 'DELETE', object => $patron->borrowernumber } )->count; |
| 660 |
->count; |
|
|
| 661 |
is( $number_of_logs, 1, 'With BorrowersLog, Koha::Patron->delete should have logged' ); |
658 |
is( $number_of_logs, 1, 'With BorrowersLog, Koha::Patron->delete should have logged' ); |
| 662 |
|
659 |
|
| 663 |
# Test deletion with designated fallback owner |
660 |
# Test deletion with designated fallback owner |
|
Lines 730-737
subtest 'add_enrolment_fee_if_needed' => sub {
Link Here
|
| 730 |
foreach ( keys %{$enrolmentfees} ) { |
727 |
foreach ( keys %{$enrolmentfees} ) { |
| 731 |
( Koha::Patron::Categories->find($_) |
728 |
( Koha::Patron::Categories->find($_) |
| 732 |
// $builder->build_object( { class => 'Koha::Patron::Categories', value => { categorycode => $_ } } ) ) |
729 |
// $builder->build_object( { class => 'Koha::Patron::Categories', value => { categorycode => $_ } } ) ) |
| 733 |
->enrolmentfee( $enrolmentfees->{$_} ) |
730 |
->enrolmentfee( $enrolmentfees->{$_} )->store; |
| 734 |
->store; |
|
|
| 735 |
} |
731 |
} |
| 736 |
my $enrolmentfee_K = $enrolmentfees->{K}; |
732 |
my $enrolmentfee_K = $enrolmentfees->{K}; |
| 737 |
my $enrolmentfee_J = $enrolmentfees->{J}; |
733 |
my $enrolmentfee_J = $enrolmentfees->{J}; |
|
Lines 2658-2665
subtest '->set_password' => sub {
Link Here
|
| 2658 |
|
2654 |
|
| 2659 |
my $number_of_logs = |
2655 |
my $number_of_logs = |
| 2660 |
$schema->resultset('ActionLog') |
2656 |
$schema->resultset('ActionLog') |
| 2661 |
->search( { module => 'MEMBERS', action => 'CHANGE PASS', object => $patron->borrowernumber } ) |
2657 |
->search( { module => 'MEMBERS', action => 'CHANGE PASS', object => $patron->borrowernumber } )->count; |
| 2662 |
->count; |
|
|
| 2663 |
is( $number_of_logs, 0, 'Without BorrowersLog, Koha::Patron->set_password doesn\'t log password changes' ); |
2658 |
is( $number_of_logs, 0, 'Without BorrowersLog, Koha::Patron->set_password doesn\'t log password changes' ); |
| 2664 |
|
2659 |
|
| 2665 |
# Enable logging password changes |
2660 |
# Enable logging password changes |
|
Lines 3189-3196
subtest "search_patrons_to_update_category tests" => sub {
Link Here
|
| 3189 |
class => 'Koha::Patrons', |
3184 |
class => 'Koha::Patrons', |
| 3190 |
value => { |
3185 |
value => { |
| 3191 |
categorycode => $category_code, |
3186 |
categorycode => $category_code, |
| 3192 |
dateofbirth => $current_dt->clone->subtract( years => $category->upperagelimit + 1 ) |
3187 |
dateofbirth => |
| 3193 |
->subtract( days => 1 ) |
3188 |
$current_dt->clone->subtract( years => $category->upperagelimit + 1 )->subtract( days => 1 ) |
| 3194 |
->ymd, |
3189 |
->ymd, |
| 3195 |
} |
3190 |
} |
| 3196 |
} |
3191 |
} |
|
Lines 3640-3647
subtest 'filter_by_have_permission' => sub {
Link Here
|
| 3640 |
is_deeply( |
3635 |
is_deeply( |
| 3641 |
[ |
3636 |
[ |
| 3642 |
Koha::Patrons->search( { branchcode => $library->branchcode } ) |
3637 |
Koha::Patrons->search( { branchcode => $library->branchcode } ) |
| 3643 |
->filter_by_have_permission('suggestions.suggestions_manage') |
3638 |
->filter_by_have_permission('suggestions.suggestions_manage')->get_column('borrowernumber') |
| 3644 |
->get_column('borrowernumber') |
|
|
| 3645 |
], |
3639 |
], |
| 3646 |
[ $patron_1->borrowernumber, $patron_2->borrowernumber ], |
3640 |
[ $patron_1->borrowernumber, $patron_2->borrowernumber ], |
| 3647 |
'Superlibrarian and patron with suggestions.suggestions_manage' |
3641 |
'Superlibrarian and patron with suggestions.suggestions_manage' |
|
Lines 3650-3657
subtest 'filter_by_have_permission' => sub {
Link Here
|
| 3650 |
is_deeply( |
3644 |
is_deeply( |
| 3651 |
[ |
3645 |
[ |
| 3652 |
Koha::Patrons->search( { branchcode => $library->branchcode } ) |
3646 |
Koha::Patrons->search( { branchcode => $library->branchcode } ) |
| 3653 |
->filter_by_have_permission('acquisition.order_manage') |
3647 |
->filter_by_have_permission('acquisition.order_manage')->get_column('borrowernumber') |
| 3654 |
->get_column('borrowernumber') |
|
|
| 3655 |
], |
3648 |
], |
| 3656 |
[ $patron_1->borrowernumber, $patron_3->borrowernumber ], |
3649 |
[ $patron_1->borrowernumber, $patron_3->borrowernumber ], |
| 3657 |
'Superlibrarian and patron with acquisition.order_manage' |
3650 |
'Superlibrarian and patron with acquisition.order_manage' |
|
Lines 3660-3667
subtest 'filter_by_have_permission' => sub {
Link Here
|
| 3660 |
is_deeply( |
3653 |
is_deeply( |
| 3661 |
[ |
3654 |
[ |
| 3662 |
Koha::Patrons->search( { branchcode => $library->branchcode } ) |
3655 |
Koha::Patrons->search( { branchcode => $library->branchcode } ) |
| 3663 |
->filter_by_have_permission('parameters.manage_cities') |
3656 |
->filter_by_have_permission('parameters.manage_cities')->get_column('borrowernumber') |
| 3664 |
->get_column('borrowernumber') |
|
|
| 3665 |
], |
3657 |
], |
| 3666 |
[ $patron_1->borrowernumber ], |
3658 |
[ $patron_1->borrowernumber ], |
| 3667 |
'Only Superlibrarian is returned' |
3659 |
'Only Superlibrarian is returned' |
|
Lines 3669-3676
subtest 'filter_by_have_permission' => sub {
Link Here
|
| 3669 |
|
3661 |
|
| 3670 |
is_deeply( |
3662 |
is_deeply( |
| 3671 |
[ |
3663 |
[ |
| 3672 |
Koha::Patrons->search( { branchcode => $library->branchcode } ) |
3664 |
Koha::Patrons->search( { branchcode => $library->branchcode } )->filter_by_have_permission('suggestions') |
| 3673 |
->filter_by_have_permission('suggestions') |
|
|
| 3674 |
->get_column('borrowernumber') |
3665 |
->get_column('borrowernumber') |
| 3675 |
], |
3666 |
], |
| 3676 |
[ $patron_1->borrowernumber, $patron_2->borrowernumber ], |
3667 |
[ $patron_1->borrowernumber, $patron_2->borrowernumber ], |
| 3677 |
- |
|
|