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

(-)a/Koha/Patron.pm (-3 / +7 lines)
Lines 377-385 sub store { Link Here
377
                    $self->add_enrolment_fee_if_needed(1)
377
                    $self->add_enrolment_fee_if_needed(1)
378
                        if C4::Context->preference('FeeOnChangePatronCategory');
378
                        if C4::Context->preference('FeeOnChangePatronCategory');
379
379
380
                    # Clean up guarantors on category change if required
380
                    # Clean up both patron and non-patron guarantors on category change if required
381
                    $self->guarantor_relationships->delete
381
                    unless ( $self->category->can_be_guarantee ) {
382
                        unless ( $self->category->can_be_guarantee );
382
                        $self->guarantor_relationships->delete;
383
                        $self->contactname(undef);
384
                        $self->contactfirstname(undef);
385
                        $self->relationship(undef);
386
                    }
383
387
384
                }
388
                }
385
389
(-)a/t/db_dependent/Patrons.t (-2 / +5 lines)
Lines 116-122 foreach my $b ( $patrons->as_list() ) { Link Here
116
}
116
}
117
117
118
subtest "Update patron categories" => sub {
118
subtest "Update patron categories" => sub {
119
    plan tests => 29;
119
    plan tests => 30;
120
    t::lib::Mocks::mock_preference( 'borrowerRelationship', 'test' );
120
    t::lib::Mocks::mock_preference( 'borrowerRelationship', 'test' );
121
    my $c_categorycode = $builder->build(
121
    my $c_categorycode = $builder->build(
122
        {
122
        {
Lines 318-323 subtest "Update patron categories" => sub { Link Here
318
        Koha::Patrons->find( $adult1->borrowernumber )->guarantee_relationships->guarantees->count, 1,
318
        Koha::Patrons->find( $adult1->borrowernumber )->guarantee_relationships->guarantees->count, 1,
319
        'Guarantee was removed when made adult'
319
        'Guarantee was removed when made adult'
320
    );
320
    );
321
    is(
322
        Koha::Patrons->find( $child3->borrowernumber )->relationship, undef,
323
        'Non-patron guarantor relationship dropped when child patron updated to adult'
324
    );
321
    is(
325
    is(
322
        Koha::Patrons->search_patrons_to_update_category( { from => $c_categorycode_2 } )
326
        Koha::Patrons->search_patrons_to_update_category( { from => $c_categorycode_2 } )
323
            ->update_category_to( { category => $a_categorycode_2 } ), 1,
327
            ->update_category_to( { category => $a_categorycode_2 } ), 1,
324
- 

Return to bug 39233