Bugzilla – Attachment 181401 Details for
Bug 39717
Stock rotation stages cannot be moved
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39717: Use numeric comparison for stock rotation stages
Bug-39717-Use-numeric-comparison-for-stock-rotatio.patch (text/plain), 2.65 KB, created by
Martin Renvoize (ashimema)
on 2025-04-24 08:11:09 UTC
(
hide
)
Description:
Bug 39717: Use numeric comparison for stock rotation stages
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2025-04-24 08:11:09 UTC
Size:
2.65 KB
patch
obsolete
>From 46dc760f258bd6c82f95dba1205b7a2600d9d352 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 23 Apr 2025 20:03:27 +0000 >Subject: [PATCH] Bug 39717: Use numeric comparison for stock rotation stages > >To test: > 1 - Enable SotckRotation > http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=StockRotation > 2 - Browse to "Cataloging -> StockRotation" > 3 - 'New rota' - fill out the form and save > 4 - Manage->stages > 5 - Add many stages, more than 10 at least > 6 - Try to move a stage form the bottom to position 3 > 7 - Note message above list: Saving changes... Error: Bad Request > 8 - Apply patch, restart_all > 9 - Attempt to move stages, try many combinations >10 - Success! > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> >--- > Koha/StockRotationStage.pm | 2 +- > t/db_dependent/StockRotationStages.t | 14 +++++++++++++- > 2 files changed, 14 insertions(+), 2 deletions(-) > >diff --git a/Koha/StockRotationStage.pm b/Koha/StockRotationStage.pm >index aed3d2b40c8..deb06880975 100644 >--- a/Koha/StockRotationStage.pm >+++ b/Koha/StockRotationStage.pm >@@ -255,7 +255,7 @@ Koha::Object Wrapper around DBIx::Class::Ordered. > sub move_to { > my ( $self, $position ) = @_; > return $self->_result->move_to($position) >- if ( $position le $self->rota->stockrotationstages->count ); >+ if ( $position <= $self->rota->stockrotationstages->count ); > return 0; > } > >diff --git a/t/db_dependent/StockRotationStages.t b/t/db_dependent/StockRotationStages.t >index 4547e035fe1..32cd5eb4139 100755 >--- a/t/db_dependent/StockRotationStages.t >+++ b/t/db_dependent/StockRotationStages.t >@@ -68,7 +68,7 @@ subtest 'Basic object tests' => sub { > }; > > subtest 'DBIx::Class::Ordered tests' => sub { >- plan tests => 33; >+ plan tests => 34; > > $schema->storage->txn_begin; > >@@ -157,6 +157,18 @@ subtest 'DBIx::Class::Ordered tests' => sub { > is( $srstage->previous_sibling->stage_id, $stageprevious->{stage_id}, "Move, correct previous." ); > is( $srstage->next_sibling->stage_id, $stagenext->{stage_id}, "Move, correct next." ); > >+ for ( my $i = 6 ; $i < 20 ; $i++ ) { >+ $builder->build( >+ { >+ source => 'Stockrotationstage', >+ value => { rota_id => $rota->{rota_id}, position => $i } >+ } >+ ); >+ } >+ >+ # 4 <= 20 = true, but 4 le 20 = false >+ ok( $srstage->move_to(4), "Moved." ); >+ > # Group manipulation > my $newrota = $builder->build( { source => 'Stockrotationrota' } ); > ok( $srstage->move_to_group( $newrota->{rota_id} ), "Move to Group." ); >-- >2.49.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 39717
:
181395
|
181396
| 181401