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

(-)a/Koha/StockRotationStage.pm (-1 / +1 lines)
Lines 255-261 Koha::Object Wrapper around DBIx::Class::Ordered. Link Here
255
sub move_to {
255
sub move_to {
256
    my ( $self, $position ) = @_;
256
    my ( $self, $position ) = @_;
257
    return $self->_result->move_to($position)
257
    return $self->_result->move_to($position)
258
        if ( $position le $self->rota->stockrotationstages->count );
258
        if ( $position <= $self->rota->stockrotationstages->count );
259
    return 0;
259
    return 0;
260
}
260
}
261
261
(-)a/t/db_dependent/StockRotationStages.t (-2 / +13 lines)
Lines 68-74 subtest 'Basic object tests' => sub { Link Here
68
};
68
};
69
69
70
subtest 'DBIx::Class::Ordered tests' => sub {
70
subtest 'DBIx::Class::Ordered tests' => sub {
71
    plan tests => 33;
71
    plan tests => 34;
72
72
73
    $schema->storage->txn_begin;
73
    $schema->storage->txn_begin;
74
74
Lines 157-162 subtest 'DBIx::Class::Ordered tests' => sub { Link Here
157
    is( $srstage->previous_sibling->stage_id, $stageprevious->{stage_id}, "Move, correct previous." );
157
    is( $srstage->previous_sibling->stage_id, $stageprevious->{stage_id}, "Move, correct previous." );
158
    is( $srstage->next_sibling->stage_id,     $stagenext->{stage_id},     "Move, correct next." );
158
    is( $srstage->next_sibling->stage_id,     $stagenext->{stage_id},     "Move, correct next." );
159
159
160
    for ( my $i = 6 ; $i < 20 ; $i++ ) {
161
        $builder->build(
162
            {
163
                source => 'Stockrotationstage',
164
                value  => { rota_id => $rota->{rota_id}, position => $i }
165
            }
166
        );
167
    }
168
169
    # 4 <= 20 = true, but 4 le 20 = false
170
    ok( $srstage->move_to(4), "Moved." );
171
160
    # Group manipulation
172
    # Group manipulation
161
    my $newrota = $builder->build( { source => 'Stockrotationrota' } );
173
    my $newrota = $builder->build( { source => 'Stockrotationrota' } );
162
    ok( $srstage->move_to_group( $newrota->{rota_id} ), "Move to Group." );
174
    ok( $srstage->move_to_group( $newrota->{rota_id} ), "Move to Group." );
163
- 

Return to bug 39717