From 26738f150206c944007fc21158af9143798d9e52 Mon Sep 17 00:00:00 2001 From: Alex Sassmannshausen Date: Wed, 26 Apr 2017 16:57:54 +0200 Subject: [PATCH] Bug 11897: Use camel case in Koha namespace modules. * Koha/Item.pm (stockrotationitem, add_to_rota): Use camel case. * Koha/Library.pm (stockrotationstages): Use camel case. * Koha/REST/V1/Stage.pm (move): Use camel case. * Koha/StockRotationItem.pm: New name for 'Koha/Stockrotationitem.pm'. (stage, advance): Use camel case. * Koha/StockRotationItems.pm: New name for 'Koha/Stockrotationitems.pm'. (object_class): Use camel case. * Koha/StockRotationRota.pm: New name for 'Koha/Stockrotationrota.pm'. (stockrotationstages, stockrotationitems, add_item): Use camel case. * Koha/StockRotationRotas.pm: New name for 'Koha/Stockrotationrotas.pm'. (object_class): Use camel case. * Koha/StockRotationStage.pm: New name for 'Koha/Stockrotationstage.pm'. (stockrotationitems, rota, siblings, next_siblings, previous_siblings) (next_sibling, previous_sibling, first_sibling, last_sibling): Use camel case. * Koha/StockRotationStages.pm: New name for 'Koha/Stockrotationstages.pm'. (object_class): Use camel case. * Koha/Util/StockRotation.pm: New name for 'Koha/Util/Stockrotation.pm'. (toggle_indemand, move_to_next_stage, remove_from_stage): Use camel case. * koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref: Improve wording. * misc/cronjobs/stockrotation.pl: Use camel case. * catalogue/stockrotation.pl: Use camel case. * tools/stockrotation.pl: Use camel case. * t/db_dependent/Items.t: Use camel case. * t/db_dependent/Koha/Libraries.t: Use camel case. * t/db_dependent/StockRotationItems.t: New name for 't/db_dependent/Stockrotationitems.t' & use camel case. * t/db_dependent/StockRotationRotas.t: New name for 't/db_dependent/Stockrotationrotas.t' & use camel case. * t/db_dependent/StockRotationStages.t: New name for 't/db_dependent/Stockrotationstages.t' & use camel case. * t/db_dependent/api/v1/stockrotationstage.t: Use camel case. https://bugs.koha-community.org/show_bug.cgi?id=11897 Signed-off-by: Kathleen Milne --- Koha/Item.pm | 8 ++-- Koha/Library.pm | 4 +- Koha/REST/V1/Stage.pm | 8 ++-- .../{Stockrotationitem.pm => StockRotationItem.pm} | 18 ++++---- ...Stockrotationitems.pm => StockRotationItems.pm} | 12 +++--- .../{Stockrotationrota.pm => StockRotationRota.pm} | 22 +++++----- ...Stockrotationrotas.pm => StockRotationRotas.pm} | 12 +++--- ...Stockrotationstage.pm => StockRotationStage.pm} | 34 +++++++-------- ...ockrotationstages.pm => StockRotationStages.pm} | 12 +++--- Koha/Util/{Stockrotation.pm => StockRotation.pm} | 14 +++---- catalogue/stockrotation.pl | 8 ++-- .../en/modules/admin/preferences/circulation.pref | 4 +- misc/cronjobs/stockrotation.pl | 4 +- t/db_dependent/Items.t | 10 ++--- t/db_dependent/Koha/Libraries.t | 2 +- .../{Stockrotationitems.t => StockRotationItems.t} | 48 +++++++++++----------- .../{Stockrotationrotas.t => StockRotationRotas.t} | 24 +++++------ ...Stockrotationstages.t => StockRotationStages.t} | 34 +++++++-------- t/db_dependent/api/v1/stockrotationstage.t | 2 +- tools/stockrotation.pl | 34 +++++++-------- 20 files changed, 157 insertions(+), 157 deletions(-) rename Koha/{Stockrotationitem.pm => StockRotationItem.pm} (94%) rename Koha/{Stockrotationitems.pm => StockRotationItems.pm} (92%) rename Koha/{Stockrotationrota.pm => StockRotationRota.pm} (88%) rename Koha/{Stockrotationrotas.pm => StockRotationRotas.pm} (87%) rename Koha/{Stockrotationstage.pm => StockRotationStage.pm} (90%) rename Koha/{Stockrotationstages.pm => StockRotationStages.pm} (85%) rename Koha/Util/{Stockrotation.pm => StockRotation.pm} (93%) rename t/db_dependent/{Stockrotationitems.t => StockRotationItems.t} (90%) rename t/db_dependent/{Stockrotationrotas.t => StockRotationRotas.t} (86%) rename t/db_dependent/{Stockrotationstages.t => StockRotationStages.t} (92%) diff --git a/Koha/Item.pm b/Koha/Item.pm index 30e799766b..cba8d5adf6 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -30,8 +30,8 @@ use Koha::IssuingRules; use Koha::Item::Transfer; use Koha::Patrons; use Koha::Libraries; -use Koha::Stockrotationitem; -use Koha::Stockrotationrotas; +use Koha::StockRotationItem; +use Koha::StockRotationRotas; use base qw(Koha::Object); @@ -249,7 +249,7 @@ sub stockrotationitem { my ( $self ) = @_; my $rs = $self->_result->stockrotationitem; return 0 if !$rs; - return Koha::Stockrotationitem->_new_from_dbic( $rs ); + return Koha::StockRotationItem->_new_from_dbic( $rs ); } =head3 add_to_rota @@ -264,7 +264,7 @@ with a rota, then we will move it to the new rota. sub add_to_rota { my ( $self, $rota_id ) = @_; - Koha::Stockrotationrotas->find($rota_id)->add_item($self->itemnumber); + Koha::StockRotationRotas->find($rota_id)->add_item($self->itemnumber); return $self; } diff --git a/Koha/Library.pm b/Koha/Library.pm index e5e7154ac8..906f206932 100644 --- a/Koha/Library.pm +++ b/Koha/Library.pm @@ -24,7 +24,7 @@ use Carp; use C4::Context; use Koha::Database; -use Koha::Stockrotationstages; +use Koha::StockRotationStages; use base qw(Koha::Object); @@ -84,7 +84,7 @@ Returns the stockrotation stages associated with this Library. sub stockrotationstages { my ( $self ) = @_; my $rs = $self->_result->stockrotationstages; - return Koha::Stockrotationstages->_new_from_dbic( $rs ); + return Koha::StockRotationStages->_new_from_dbic( $rs ); } =head3 get_effective_marcorgcode diff --git a/Koha/REST/V1/Stage.pm b/Koha/REST/V1/Stage.pm index 42d48101c9..5d2cfcb398 100644 --- a/Koha/REST/V1/Stage.pm +++ b/Koha/REST/V1/Stage.pm @@ -19,14 +19,14 @@ use Modern::Perl; use Mojo::Base 'Mojolicious::Controller'; -use Koha::Stockrotationrotas; -use Koha::Stockrotationstages; +use Koha::StockRotationRotas; +use Koha::StockRotationStages; sub move { my ($c, $args, $cb) = @_; - my $rota = Koha::Stockrotationrotas->find($args->{rota_id}); - my $stage = Koha::Stockrotationstages->find($args->{stage_id}); + my $rota = Koha::StockRotationRotas->find($args->{rota_id}); + my $stage = Koha::StockRotationStages->find($args->{stage_id}); if ($stage && $rota) { my $result = $stage->move_to($args->{position}); diff --git a/Koha/Stockrotationitem.pm b/Koha/StockRotationItem.pm similarity index 94% rename from Koha/Stockrotationitem.pm rename to Koha/StockRotationItem.pm index b4aaaeca7b..e451bb08db 100644 --- a/Koha/Stockrotationitem.pm +++ b/Koha/StockRotationItem.pm @@ -1,4 +1,4 @@ -package Koha::Stockrotationitem; +package Koha::StockRotationItem; # Copyright PTFS Europe 2016 # @@ -25,17 +25,17 @@ use Koha::Database; use Koha::DateUtils qw/dt_from_string/; use Koha::Item::Transfer; use Koha::Item; -use Koha::Stockrotationstage; +use Koha::StockRotationStage; use base qw(Koha::Object); =head1 NAME -Stockrotationitem - Koha Stockrotationitem Object class +StockRotationItem - Koha StockRotationItem Object class =head1 SYNOPSIS -Stockrotationitem class used primarily by stockrotation .pls and the stock +StockRotationItem class used primarily by stockrotation .pls and the stock rotation cron script. =head1 DESCRIPTION @@ -58,7 +58,7 @@ sub _type { =head3 itemnumber - my $item = Koha::Stockrotationitem->itemnumber; + my $item = Koha::StockRotationItem->itemnumber; Returns the item associated with the current stock rotation item. @@ -72,7 +72,7 @@ sub itemnumber { =head3 stage - my $stage = Koha::Stockrotationitem->stage; + my $stage = Koha::StockRotationItem->stage; Returns the stage associated with the current stock rotation item. @@ -81,7 +81,7 @@ Returns the stage associated with the current stock rotation item. sub stage { my ( $self ) = @_; my $rs = $self->_result->stage; - return Koha::Stockrotationstage->_new_from_dbic( $rs ); + return Koha::StockRotationStage->_new_from_dbic( $rs ); } =head3 needs_repatriating @@ -171,7 +171,7 @@ transfer it to the next stage in its rota. If this is the last stage in the rota and this rota is cyclical, we return to the first stage. If it is not cyclical, then we delete this -Stockrotationitem. +StockRotationItem. If this item is 'indemand', and advance is invoked, we disable 'indemand' and advance the item as per usual. @@ -209,7 +209,7 @@ sub advance { $transfer->tobranch($new_stage->branchcode_id); $transfer->datearrived(DateTime->now); } else { - $self->delete; # Stockrotationitem is done. + $self->delete; # StockRotationItem is done. return 1; } } else { diff --git a/Koha/Stockrotationitems.pm b/Koha/StockRotationItems.pm similarity index 92% rename from Koha/Stockrotationitems.pm rename to Koha/StockRotationItems.pm index 98c9dbb200..8fde691ae4 100644 --- a/Koha/Stockrotationitems.pm +++ b/Koha/StockRotationItems.pm @@ -1,4 +1,4 @@ -package Koha::Stockrotationitems; +package Koha::StockRotationItems; # Copyright PTFS Europe 2016 # @@ -20,17 +20,17 @@ package Koha::Stockrotationitems; use Modern::Perl; use Koha::Database; -use Koha::Stockrotationitem; +use Koha::StockRotationItem; use base qw(Koha::Objects); =head1 NAME -Stockrotationitems - Koha Stockrotationitems Object class +StockRotationItems - Koha StockRotationItems Object class =head1 SYNOPSIS -Stockrotationitems class used primarily by stockrotation .pls and the stock +StockRotationItems class used primarily by stockrotation .pls and the stock rotation cron script. =head1 DESCRIPTION @@ -52,7 +52,7 @@ sub _type { } sub object_class { - return 'Koha::Stockrotationitem'; + return 'Koha::StockRotationItem'; } =head3 investigate @@ -69,7 +69,7 @@ The report generated here will be used on the stage level to slot our item reports into appropriate sections of the branched report. For details of intent and context of this procedure, please see -Koha::Stockrotationrota->investigate. +Koha::StockRotationRota->investigate. =cut diff --git a/Koha/Stockrotationrota.pm b/Koha/StockRotationRota.pm similarity index 88% rename from Koha/Stockrotationrota.pm rename to Koha/StockRotationRota.pm index f96c1f021c..e6aa4b2385 100644 --- a/Koha/Stockrotationrota.pm +++ b/Koha/StockRotationRota.pm @@ -1,4 +1,4 @@ -package Koha::Stockrotationrota; +package Koha::StockRotationRota; # Copyright PTFS Europe 2016 # @@ -20,19 +20,19 @@ package Koha::Stockrotationrota; use Modern::Perl; use Koha::Database; -use Koha::Stockrotationstages; -use Koha::Stockrotationitem; -use Koha::Stockrotationitems; +use Koha::StockRotationStages; +use Koha::StockRotationItem; +use Koha::StockRotationItems; use base qw(Koha::Object); =head1 NAME -Stockrotationrota - Koha Stockrotationrota Object class +StockRotationRota - Koha StockRotationRota Object class =head1 SYNOPSIS -Stockrotationrota class used primarily by stockrotation .pls and the stock +StockRotationRota class used primarily by stockrotation .pls and the stock rotation cron script. =head1 DESCRIPTION @@ -47,7 +47,7 @@ Standard Koha::Objects definitions, and additional methods. =head3 stockrotationstages - my $stages = Koha::Stockrotationrota->stockrotationstages; + my $stages = Koha::StockRotationRota->stockrotationstages; Returns the stages associated with the current rota. @@ -56,7 +56,7 @@ Returns the stages associated with the current rota. sub stockrotationstages { my ( $self ) = @_; my $rs = $self->_result->stockrotationstages; - return Koha::Stockrotationstages->_new_from_dbic( $rs ); + return Koha::StockRotationStages->_new_from_dbic( $rs ); } =head3 add_item @@ -71,12 +71,12 @@ a rota, move it from that rota to this rota. sub add_item { my ( $self, $itemnumber ) = @_; - my $sritem = Koha::Stockrotationitems->find($itemnumber); + my $sritem = Koha::StockRotationItems->find($itemnumber); if ($sritem) { $sritem->stage_id($self->first_stage->stage_id) ->indemand(0)->fresh(1)->store; } else { - $sritem = Koha::Stockrotationitem->new({ + $sritem = Koha::StockRotationItem->new({ itemnumber_id => $itemnumber, stage_id => $self->first_stage->stage_id, indemand => 0, @@ -112,7 +112,7 @@ Return all items associated with this rota via its stages. sub stockrotationitems { my ( $self ) = @_; - my $rs = Koha::Stockrotationitems->search( + my $rs = Koha::StockRotationItems->search( { 'stage.rota_id' => $self->rota_id }, { join => [ qw/stage/ ] } ); return $rs; diff --git a/Koha/Stockrotationrotas.pm b/Koha/StockRotationRotas.pm similarity index 87% rename from Koha/Stockrotationrotas.pm rename to Koha/StockRotationRotas.pm index 6981b6a133..c308a9246b 100644 --- a/Koha/Stockrotationrotas.pm +++ b/Koha/StockRotationRotas.pm @@ -1,4 +1,4 @@ -package Koha::Stockrotationrotas; +package Koha::StockRotationRotas; # Copyright PTFS Europe 2016 # @@ -20,17 +20,17 @@ package Koha::Stockrotationrotas; use Modern::Perl; use Koha::Database; -use Koha::Stockrotationrota; +use Koha::StockRotationRota; use base qw(Koha::Objects); =head1 NAME -Stockrotationrotas - Koha Stockrotationrotas Object class +StockRotationRotas - Koha StockRotationRotas Object class =head1 SYNOPSIS -Stockrotationrotas class used primarily by stockrotation .pls and the stock +StockRotationRotas class used primarily by stockrotation .pls and the stock rotation cron script. =head1 DESCRIPTION @@ -50,7 +50,7 @@ Standard Koha::Objects definitions, and additional methods. Return a report detailing the current status and required actions for all relevant items spread over rotas. -See Koha::Stockrotationrota->investigate for details. +See Koha::StockRotationRota->investigate for details. =cut @@ -89,7 +89,7 @@ sub _type { } sub object_class { - return 'Koha::Stockrotationrota'; + return 'Koha::StockRotationRota'; } 1; diff --git a/Koha/Stockrotationstage.pm b/Koha/StockRotationStage.pm similarity index 90% rename from Koha/Stockrotationstage.pm rename to Koha/StockRotationStage.pm index b167dcc7e6..eadb71686e 100644 --- a/Koha/Stockrotationstage.pm +++ b/Koha/StockRotationStage.pm @@ -1,4 +1,4 @@ -package Koha::Stockrotationstage; +package Koha::StockRotationStage; # Copyright PTFS Europe 2016 # @@ -21,17 +21,17 @@ use Modern::Perl; use Koha::Database; use Koha::Library; -use Koha::Stockrotationrota; +use Koha::StockRotationRota; use base qw(Koha::Object); =head1 NAME -Stockrotationstage - Koha Stockrotationstage Object class +StockRotationStage - Koha StockRotationStage Object class =head1 SYNOPSIS -Stockrotationstage class used primarily by stockrotation .pls and the stock +StockRotationStage class used primarily by stockrotation .pls and the stock rotation cron script. =head1 DESCRIPTION @@ -64,7 +64,7 @@ sub _relation { =head3 stockrotationitems - my $stages = Koha::Stockrotationstage->stockrotationitems; + my $stages = Koha::StockRotationStage->stockrotationitems; Returns the items associated with the current stage. @@ -72,12 +72,12 @@ Returns the items associated with the current stage. sub stockrotationitems { my ( $self ) = @_; - return &{$self->_relation(qw/ stockrotationitems Stockrotationitems /)}; + return &{$self->_relation(qw/ stockrotationitems StockRotationItems /)}; } =head3 branchcode - my $branch = Koha::Stockrotationstage->branchcode; + my $branch = Koha::StockRotationStage->branchcode; Returns the branch associated with the current stage. @@ -90,7 +90,7 @@ sub branchcode { =head3 rota - my $rota = Koha::Stockrotationstage->rota; + my $rota = Koha::StockRotationStage->rota; Returns the rota associated with the current stage. @@ -98,7 +98,7 @@ Returns the rota associated with the current stage. sub rota { my ( $self ) = @_; - return &{$self->_relation(qw/ rota Stockrotationrota /)}; + return &{$self->_relation(qw/ rota StockRotationRota /)}; } =head3 siblings @@ -111,7 +111,7 @@ Koha::Object wrapper around DBIx::Class::Ordered. sub siblings { my ( $self ) = @_; - return &{$self->_relation(qw/ siblings Stockrotationstages /)}; + return &{$self->_relation(qw/ siblings StockRotationStages /)}; } =head3 next_siblings @@ -124,7 +124,7 @@ Koha::Object wrapper around DBIx::Class::Ordered. sub next_siblings { my ( $self ) = @_; - return &{$self->_relation(qw/ next_siblings Stockrotationstages /)}; + return &{$self->_relation(qw/ next_siblings StockRotationStages /)}; } =head3 previous_siblings @@ -137,7 +137,7 @@ Koha::Object wrapper around DBIx::Class::Ordered. sub previous_siblings { my ( $self ) = @_; - return &{$self->_relation(qw/ previous_siblings Stockrotationstages /)}; + return &{$self->_relation(qw/ previous_siblings StockRotationStages /)}; } =head3 next_sibling @@ -150,7 +150,7 @@ Koha::Object wrapper around DBIx::Class::Ordered. sub next_sibling { my ( $self ) = @_; - return &{$self->_relation(qw/ next_sibling Stockrotationstage /)}; + return &{$self->_relation(qw/ next_sibling StockRotationStage /)}; } =head3 previous_sibling @@ -163,7 +163,7 @@ Koha::Object Wrapper around DBIx::Class::Ordered. sub previous_sibling { my ( $self ) = @_; - return &{$self->_relation(qw/ previous_sibling Stockrotationstage /)}; + return &{$self->_relation(qw/ previous_sibling StockRotationStage /)}; } =head3 first_sibling @@ -176,7 +176,7 @@ Koha::Object Wrapper around DBIx::Class::Ordered. sub first_sibling { my ( $self ) = @_; - return &{$self->_relation(qw/ first_sibling Stockrotationstage /)}; + return &{$self->_relation(qw/ first_sibling StockRotationStage /)}; } =head3 last_sibling @@ -189,7 +189,7 @@ Koha::Object Wrapper around DBIx::Class::Ordered. sub last_sibling { my ( $self ) = @_; - return &{$self->_relation(qw/ last_sibling Stockrotationstage /)}; + return &{$self->_relation(qw/ last_sibling StockRotationStage /)}; } =head3 move_previous @@ -294,7 +294,7 @@ that is passed to it. It slots item reports into the branched and temporary rota sections of the report. It also increments a number of counters. For details of intent and context of this procedure, please see -Koha::Stockrotationrota->investigate. +Koha::StockRotationRota->investigate. =cut diff --git a/Koha/Stockrotationstages.pm b/Koha/StockRotationStages.pm similarity index 85% rename from Koha/Stockrotationstages.pm rename to Koha/StockRotationStages.pm index 22545f0b79..00faaab28d 100644 --- a/Koha/Stockrotationstages.pm +++ b/Koha/StockRotationStages.pm @@ -1,4 +1,4 @@ -package Koha::Stockrotationstages; +package Koha::StockRotationStages; # Copyright PTFS Europe 2016 # @@ -20,17 +20,17 @@ package Koha::Stockrotationstages; use Modern::Perl; use Koha::Database; -use Koha::Stockrotationstage; +use Koha::StockRotationStage; use base qw(Koha::Objects); =head1 NAME -Stockrotationstages - Koha Stockrotationstages Object class +StockRotationStages - Koha StockRotationStages Object class =head1 SYNOPSIS -Stockrotationstages class used primarily by stockrotation .pls and the stock +StockRotationStages class used primarily by stockrotation .pls and the stock rotation cron script. =head1 DESCRIPTION @@ -51,7 +51,7 @@ Return a report detailing the current status and required actions for all relevant items spread over the set of stages. For details of intent and context of this procedure, please see -Koha::Stockrotationrota->investigate. +Koha::StockRotationRota->investigate. =cut @@ -74,7 +74,7 @@ sub _type { } sub object_class { - return 'Koha::Stockrotationstage'; + return 'Koha::StockRotationStage'; } 1; diff --git a/Koha/Util/Stockrotation.pm b/Koha/Util/StockRotation.pm similarity index 93% rename from Koha/Util/Stockrotation.pm rename to Koha/Util/StockRotation.pm index 481e45af5e..13c78e5675 100644 --- a/Koha/Util/Stockrotation.pm +++ b/Koha/Util/StockRotation.pm @@ -1,4 +1,4 @@ -package Koha::Util::Stockrotation; +package Koha::Util::StockRotation; # Module contains subroutines used with Stock Rotation # @@ -22,7 +22,7 @@ package Koha::Util::Stockrotation; use Modern::Perl; use Koha::Items; -use Koha::Stockrotationitems; +use Koha::StockRotationItems; use Koha::Database; our ( @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS ); @@ -44,7 +44,7 @@ BEGIN { =head1 NAME -Koha::Util::Stockrotation - utility class with routines for Stock Rotation +Koha::Util::StockRotation - utility class with routines for Stock Rotation =head1 FUNCTIONS @@ -66,7 +66,7 @@ sub get_branches { =head2 get_stages - returns an arrayref of Stockrotationstage objects representing + returns an arrayref of StockRotationStage objects representing all stages for a passed rota =cut @@ -100,7 +100,7 @@ sub toggle_indemand { my ($item_id, $stage_id) = @_; # Get the item object - my $item = Koha::Stockrotationitems->find( + my $item = Koha::StockRotationItems->find( { itemnumber_id => $item_id, stage_id => $stage_id @@ -126,7 +126,7 @@ sub move_to_next_stage { my ($item_id, $stage_id) = shift; # Get the item object - my $item = Koha::Stockrotationitems->find( + my $item = Koha::StockRotationItems->find( { itemnumber_id => $item_id, stage_id => $stage_id @@ -148,7 +148,7 @@ sub remove_from_stage { my ($item_id, $stage_id) = @_; # Get the item object and delete it - Koha::Stockrotationitems->find( + Koha::StockRotationItems->find( { itemnumber_id => $item_id, stage_id => $stage_id diff --git a/catalogue/stockrotation.pl b/catalogue/stockrotation.pl index d12b17c62a..8969b5bb12 100755 --- a/catalogue/stockrotation.pl +++ b/catalogue/stockrotation.pl @@ -33,9 +33,9 @@ use C4::Search; use Koha::Biblio; use Koha::Item; -use Koha::Stockrotationrotas; -use Koha::Stockrotationstages; -use Koha::Util::Stockrotation qw(:ALL); +use Koha::StockRotationRotas; +use Koha::StockRotationStages; +use Koha::Util::StockRotation qw(:ALL); my $input = new CGI; @@ -63,7 +63,7 @@ if (!defined $op) { my $items = $biblio->items; # Get only rotas with stages - my $rotas = Koha::Stockrotationrotas->search( + my $rotas = Koha::StockRotationRotas->search( { 'stockrotationstages.stage_id' => { '!=', undef } }, diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref index 329a228b7f..7655949f55 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -868,7 +868,7 @@ Circulation: yes: Enable no: Disable - "housebound module" - Stockrotation module: + Stock Rotation module: - - pref: StockRotation choices: @@ -880,7 +880,7 @@ Circulation: choices: yes: Enable no: Disable - - "Prevent branchtransfers on items in stockrotation rotas" + - "Prevent branchtransfers on items in stock rotation rotas" Article Requests: - - pref: ArticleRequests diff --git a/misc/cronjobs/stockrotation.pl b/misc/cronjobs/stockrotation.pl index 0926b9eb05..d8914e42d9 100755 --- a/misc/cronjobs/stockrotation.pl +++ b/misc/cronjobs/stockrotation.pl @@ -112,7 +112,7 @@ use Getopt::Long qw/HelpMessage :config gnu_getopt/; use Mail::Sendmail; use C4::Context; use Koha::Email; -use Koha::Stockrotationrotas; +use Koha::StockRotationRotas; my $admin_email = ''; my $branch = 0; @@ -464,7 +464,7 @@ sub emit { #### Main Code # Compile Stockrotation Report data -my $rotas = Koha::Stockrotationrotas->search; +my $rotas = Koha::StockRotationRotas->search; my $data = $rotas->investigate; # Perform db updates if requested diff --git a/t/db_dependent/Items.t b/t/db_dependent/Items.t index f71e649e2a..fb5ca76b13 100755 --- a/t/db_dependent/Items.t +++ b/t/db_dependent/Items.t @@ -772,7 +772,7 @@ subtest 'Check stockrotationitem relationship' => sub { }); my $sritem = Koha::Items->find($item->{itemnumber})->stockrotationitem; - isa_ok( $sritem, 'Koha::Stockrotationitem', "Relationship works and correctly creates Koha::Object." ); + isa_ok( $sritem, 'Koha::StockRotationItem', "Relationship works and correctly creates Koha::Object." ); $schema->storage->txn_rollback; }; @@ -785,7 +785,7 @@ subtest 'Check add_to_rota method' => sub { my $builder = t::lib::TestBuilder->new; my $item = $builder->build({ source => 'Item' }); my $rota = $builder->build({ source => 'Stockrotationrota' }); - my $srrota = Koha::Stockrotationrotas->find($rota->{rota_id}); + my $srrota = Koha::StockRotationRotas->find($rota->{rota_id}); $builder->build({ source => 'Stockrotationstage', @@ -796,14 +796,14 @@ subtest 'Check add_to_rota method' => sub { $sritem->add_to_rota($rota->{rota_id}); is( - Koha::Stockrotationitems->find($item->{itemnumber})->stage_id, + Koha::StockRotationItems->find($item->{itemnumber})->stage_id, $srrota->stockrotationstages->next->stage_id, "Adding to a rota a new sritem item being assigned to its first stage." ); my $newrota = $builder->build({ source => 'Stockrotationrota' }); - my $srnewrota = Koha::Stockrotationrotas->find($newrota->{rota_id}); + my $srnewrota = Koha::StockRotationRotas->find($newrota->{rota_id}); $builder->build({ source => 'Stockrotationstage', @@ -813,7 +813,7 @@ subtest 'Check add_to_rota method' => sub { $sritem->add_to_rota($newrota->{rota_id}); is( - Koha::Stockrotationitems->find($item->{itemnumber})->stage_id, + Koha::StockRotationItems->find($item->{itemnumber})->stage_id, $srnewrota->stockrotationstages->next->stage_id, "Moving an item results in that sritem being assigned to the new first stage." ); diff --git a/t/db_dependent/Koha/Libraries.t b/t/db_dependent/Koha/Libraries.t index 98f98a5a1f..911903108f 100644 --- a/t/db_dependent/Koha/Libraries.t +++ b/t/db_dependent/Koha/Libraries.t @@ -109,7 +109,7 @@ my $srstages = Koha::Libraries->find($new_library_sr->{branchcode}) ->stockrotationstages; is( $srstages->count, 3, 'Correctly fetched stockrotationstages associated with this branch'); -isa_ok( $srstages->next, 'Koha::Stockrotationstage', "Relationship correctly creates Koha::Objects." ); +isa_ok( $srstages->next, 'Koha::StockRotationStage', "Relationship correctly creates Koha::Objects." ); $schema->storage->txn_rollback; diff --git a/t/db_dependent/Stockrotationitems.t b/t/db_dependent/StockRotationItems.t similarity index 90% rename from t/db_dependent/Stockrotationitems.t rename to t/db_dependent/StockRotationItems.t index 4a80f35ecf..5f3e235671 100644 --- a/t/db_dependent/Stockrotationitems.t +++ b/t/db_dependent/StockRotationItems.t @@ -29,8 +29,8 @@ use Test::More tests => 8; my $schema = Koha::Database->new->schema; -use_ok('Koha::Stockrotationitems'); -use_ok('Koha::Stockrotationitem'); +use_ok('Koha::StockRotationItems'); +use_ok('Koha::StockRotationItem'); my $builder = t::lib::TestBuilder->new; @@ -51,10 +51,10 @@ subtest 'Basic object tests' => sub { }, }); - my $sritem = Koha::Stockrotationitems->find($item->{itemnumber_id}); + my $sritem = Koha::StockRotationItems->find($item->{itemnumber_id}); isa_ok( $sritem, - 'Koha::Stockrotationitem', + 'Koha::StockRotationItem', "Correctly create and load a stock rotation item." ); @@ -63,7 +63,7 @@ subtest 'Basic object tests' => sub { is( $sritem->itemnumber->itemnumber, $itm->{itemnumber}, "Related rota OK." ); # Relationship to stage - isa_ok( $sritem->stage, 'Koha::Stockrotationstage', "Fetched related stage." ); + isa_ok( $sritem->stage, 'Koha::StockRotationStage', "Fetched related stage." ); is( $sritem->stage->stage_id, $stage->{stage_id}, "Related stage OK." ); @@ -78,7 +78,7 @@ subtest 'Tests for needs_repatriating' => sub { # Setup a pristine stockrotation context. my $sritem = $builder->build({ source => 'Stockrotationitem' }); - my $dbitem = Koha::Stockrotationitems->find($sritem->{itemnumber_id}); + my $dbitem = Koha::StockRotationItems->find($sritem->{itemnumber_id}); $dbitem->itemnumber->homebranch($dbitem->stage->branchcode_id); $dbitem->itemnumber->holdingbranch($dbitem->stage->branchcode_id); $dbitem->stage->position(1); @@ -113,7 +113,7 @@ subtest 'Tests for needs_repatriating' => sub { # - homebranch != stockrotationstage.branch & not in transit [1] is( $dbitem->needs_repatriating, 1, - "Homebranch != Stockrotationstage.Branchcode_id & not in transit." + "Homebranch != StockRotationStage.Branchcode_id & not in transit." ); # Set to in transit (by implication). @@ -131,7 +131,7 @@ subtest "Tests for repatriate." => sub { plan tests => 3; $schema->storage->txn_begin; my $sritem = $builder->build({ source => 'Stockrotationitem' }); - my $dbitem = Koha::Stockrotationitems->find($sritem->{itemnumber_id}); + my $dbitem = Koha::StockRotationItems->find($sritem->{itemnumber_id}); $dbitem->stage->position(1); $dbitem->stage->duration(50); my $branch = $builder->build({ source => 'Branch' }); @@ -155,7 +155,7 @@ subtest "Tests for needs_advancing." => sub { source => 'Stockrotationitem', value => { 'fresh' => 1, }, }); - my $dbitem = Koha::Stockrotationitems->find($sritem->{itemnumber_id}); + my $dbitem = Koha::StockRotationItems->find($sritem->{itemnumber_id}); is($dbitem->needs_advancing, 1, "An item that is fresh will always need advancing."); # Setup a pristine stockrotation context. @@ -163,7 +163,7 @@ subtest "Tests for needs_advancing." => sub { source => 'Stockrotationitem', value => { 'fresh' => 0,} }); - $dbitem = Koha::Stockrotationitems->find($sritem->{itemnumber_id}); + $dbitem = Koha::StockRotationItems->find($sritem->{itemnumber_id}); $dbitem->itemnumber->homebranch($dbitem->stage->branchcode_id); $dbitem->itemnumber->holdingbranch($dbitem->stage->branchcode_id); $dbitem->stage->position(1); @@ -213,7 +213,7 @@ subtest "Tests for advance." => sub { source => 'Stockrotationitem', value => { 'fresh' => 1 } }); - my $dbitem = Koha::Stockrotationitems->find($sritem->{itemnumber_id}); + my $dbitem = Koha::StockRotationItems->find($sritem->{itemnumber_id}); $dbitem->itemnumber->holdingbranch($dbitem->stage->branchcode_id); my $dbstage = $dbitem->stage; $dbstage->position(1)->duration(50)->store; # Configure stage. @@ -233,14 +233,14 @@ subtest "Tests for advance." => sub { $dbstage->rota->cyclical(1)->store; # Set Rota to cyclical. ok($dbitem->advance, "Single stage cyclical advance done."); ## Refetch dbitem - $dbitem = Koha::Stockrotationitems->find($sritem->{itemnumber_id}); + $dbitem = Koha::StockRotationItems->find($sritem->{itemnumber_id}); is($dbitem->stage->stage_id, $dbstage->stage_id, "Single stage cyclical stage OK."); # Test with indemand advance $dbitem->indemand(1)->store; ok($dbitem->advance, "Indemand item advance done."); ## Refetch dbitem - $dbitem = Koha::Stockrotationitems->find($sritem->{itemnumber_id}); + $dbitem = Koha::StockRotationItems->find($sritem->{itemnumber_id}); is($dbitem->indemand, 0, "Indemand OK."); is($dbitem->stage->stage_id, $dbstage->stage_id, "Indemand item advance stage OK."); @@ -249,14 +249,14 @@ subtest "Tests for advance." => sub { source => 'Stockrotationstage', values => { duration => 50 } }); - my $dbstage2 = Koha::Stockrotationstages->find($srstage->{stage_id}); + my $dbstage2 = Koha::StockRotationStages->find($srstage->{stage_id}); $dbstage2->move_to_group($dbitem->stage->rota_id); $dbstage2->move_last; # Test a straight up advance ok($dbitem->advance, "Advancement done."); ## Refetch dbitem - $dbitem = Koha::Stockrotationitems->find($sritem->{itemnumber_id}); + $dbitem = Koha::StockRotationItems->find($sritem->{itemnumber_id}); ## Test results is($dbitem->stage->stage_id, $dbstage2->stage_id, "Stage updated."); my $intransfer = $dbitem->itemnumber->get_transfer; @@ -273,8 +273,8 @@ subtest "Tests for advance." => sub { # Advance again, Remove from rota. ok($dbitem->advance, "Non-cyclical advance."); ## Refetch dbitem - $dbitem = Koha::Stockrotationitems->find($sritem->{itemnumber_id}); - is($dbitem, undef, "Stockrotationitem has been removed."); + $dbitem = Koha::StockRotationItems->find($sritem->{itemnumber_id}); + is($dbitem, undef, "StockRotationItem has been removed."); $schema->storage->txn_rollback; }; @@ -285,12 +285,12 @@ subtest "Tests for investigate (singular)." => sub { # Test brand new item's investigation ['initiation'] my $sritem = $builder->build({ source => 'Stockrotationitem', value => { fresh => 1 } }); - my $dbitem = Koha::Stockrotationitems->find($sritem->{itemnumber_id}); + my $dbitem = Koha::StockRotationItems->find($sritem->{itemnumber_id}); is($dbitem->investigate->{reason}, 'initiation', "fresh item initiates."); # Test brand new item at stagebranch ['initiation'] $sritem = $builder->build({ source => 'Stockrotationitem', value => { fresh => 1 } }); - $dbitem = Koha::Stockrotationitems->find($sritem->{itemnumber_id}); + $dbitem = Koha::StockRotationItems->find($sritem->{itemnumber_id}); $dbitem->itemnumber->homebranch($dbitem->stage->branchcode_id)->store; $dbitem->itemnumber->holdingbranch($dbitem->stage->branchcode_id)->store; is($dbitem->investigate->{reason}, 'initiation', "fresh item at stagebranch initiates."); @@ -300,7 +300,7 @@ subtest "Tests for investigate (singular)." => sub { source => 'Stockrotationitem', value => { 'fresh' => 0,} }); - $dbitem = Koha::Stockrotationitems->find($sritem->{itemnumber_id}); + $dbitem = Koha::StockRotationItems->find($sritem->{itemnumber_id}); my $dbtransfer = Koha::Item::Transfer->new({ 'itemnumber' => $dbitem->itemnumber_id, 'frombranch' => $dbitem->itemnumber->homebranch, @@ -316,7 +316,7 @@ subtest "Tests for investigate (singular)." => sub { source => 'Stockrotationitem', value => { 'fresh' => 0,} }); - $dbitem = Koha::Stockrotationitems->find($sritem->{itemnumber_id}); + $dbitem = Koha::StockRotationItems->find($sritem->{itemnumber_id}); $dbtransfer = Koha::Item::Transfer->new({ 'itemnumber' => $dbitem->itemnumber_id, 'frombranch' => $dbitem->itemnumber->homebranch, @@ -331,7 +331,7 @@ subtest "Tests for investigate (singular)." => sub { # Test item due for advancement ['advancement'] $sritem = $builder->build({ source => 'Stockrotationitem', value => { fresh => 0 } }); - $dbitem = Koha::Stockrotationitems->find($sritem->{itemnumber_id}); + $dbitem = Koha::StockRotationItems->find($sritem->{itemnumber_id}); $dbitem->indemand(0)->store; $dbitem->stage->duration(50)->store; my $sent_duration = DateTime::Duration->new( days => 55); @@ -351,7 +351,7 @@ subtest "Tests for investigate (singular)." => sub { # Test item due for advancement but in-demand ['in-demand'] $sritem = $builder->build({ source => 'Stockrotationitem', value => { fresh => 0 } }); - $dbitem = Koha::Stockrotationitems->find($sritem->{itemnumber_id}); + $dbitem = Koha::StockRotationItems->find($sritem->{itemnumber_id}); $dbitem->indemand(1)->store; $dbitem->stage->duration(50)->store; $sent_duration = DateTime::Duration->new( days => 55); @@ -371,7 +371,7 @@ subtest "Tests for investigate (singular)." => sub { # Test item ready for advancement, but at wrong library ['repatriation'] $sritem = $builder->build({ source => 'Stockrotationitem', value => { fresh => 0 } }); - $dbitem = Koha::Stockrotationitems->find($sritem->{itemnumber_id}); + $dbitem = Koha::StockRotationItems->find($sritem->{itemnumber_id}); $dbitem->indemand(0)->store; $dbitem->stage->duration(50)->store; $sent_duration = DateTime::Duration->new( days => 55); diff --git a/t/db_dependent/Stockrotationrotas.t b/t/db_dependent/StockRotationRotas.t similarity index 86% rename from t/db_dependent/Stockrotationrotas.t rename to t/db_dependent/StockRotationRotas.t index d20c7dfec1..f1b2aa6d78 100644 --- a/t/db_dependent/Stockrotationrotas.t +++ b/t/db_dependent/StockRotationRotas.t @@ -26,8 +26,8 @@ use Test::More tests => 5; my $schema = Koha::Database->new->schema; -use_ok('Koha::Stockrotationrotas'); -use_ok('Koha::Stockrotationrota'); +use_ok('Koha::StockRotationRotas'); +use_ok('Koha::StockRotationRota'); subtest 'Basic object tests' => sub { @@ -39,10 +39,10 @@ subtest 'Basic object tests' => sub { my $rota = $builder->build({ source => 'Stockrotationrota' }); - my $srrota = Koha::Stockrotationrotas->find($rota->{rota_id}); + my $srrota = Koha::StockRotationRotas->find($rota->{rota_id}); isa_ok( $srrota, - 'Koha::Stockrotationrota', + 'Koha::StockRotationRota', "Correctly create and load a stock rotation rota." ); @@ -62,7 +62,7 @@ subtest 'Basic object tests' => sub { my $srstages = $srrota->stockrotationstages; is( $srstages->count, 3, 'Correctly fetched stockrotationstages associated with this rota'); - isa_ok( $srstages->next, 'Koha::Stockrotationstage', "Relationship correctly creates Koha::Objects." ); + isa_ok( $srstages->next, 'Koha::StockRotationStage', "Relationship correctly creates Koha::Objects." ); #### Test add_item @@ -71,14 +71,14 @@ subtest 'Basic object tests' => sub { $srrota->add_item($item->{itemnumber}); is( - Koha::Stockrotationitems->find($item->{itemnumber})->stage_id, + Koha::StockRotationItems->find($item->{itemnumber})->stage_id, $srrota->first_stage->stage_id, "Adding an item results in a new sritem item being assigned to the first stage." ); my $newrota = $builder->build({ source => 'Stockrotationrota' }); - my $srnewrota = Koha::Stockrotationrotas->find($newrota->{rota_id}); + my $srnewrota = Koha::StockRotationRotas->find($newrota->{rota_id}); $builder->build({ source => 'Stockrotationstage', @@ -88,7 +88,7 @@ subtest 'Basic object tests' => sub { $srnewrota->add_item($item->{itemnumber}); is( - Koha::Stockrotationitems->find($item->{itemnumber})->stage_id, + Koha::StockRotationItems->find($item->{itemnumber})->stage_id, $srnewrota->stockrotationstages->next->stage_id, "Moving an item results in that sritem being assigned to the new first stage." ); @@ -118,15 +118,15 @@ subtest '->first_stage test' => sub { value => { rota_id => $rota->{rota_id} }, }); - my $srrota = Koha::Stockrotationrotas->find($rota->{rota_id}); - my $srstage2 = Koha::Stockrotationstages->find($stage2->{stage_id}); + my $srrota = Koha::StockRotationRotas->find($rota->{rota_id}); + my $srstage2 = Koha::StockRotationStages->find($stage2->{stage_id}); my $firststage = $srstage2->first_sibling || $srstage2; is( $srrota->first_stage->stage_id, $firststage->stage_id, "First stage works" ); $srstage2->move_first; - is( Koha::Stockrotationrotas->find($rota->{rota_id})->first_stage->stage_id, $stage2->{stage_id}, "Stage re-organized" ); + is( Koha::StockRotationRotas->find($rota->{rota_id})->first_stage->stage_id, $stage2->{stage_id}, "Stage re-organized" ); $schema->storage->txn_rollback; }; @@ -162,7 +162,7 @@ subtest '->items test' => sub { $stage3->{stage_id}, $stage3->{stage_id}, ); - my $srrota = Koha::Stockrotationrotas->find($rota->{rota_id}); + my $srrota = Koha::StockRotationRotas->find($rota->{rota_id}); is( $srrota->stockrotationitems->count, diff --git a/t/db_dependent/Stockrotationstages.t b/t/db_dependent/StockRotationStages.t similarity index 92% rename from t/db_dependent/Stockrotationstages.t rename to t/db_dependent/StockRotationStages.t index 145d318643..e6ea69315e 100644 --- a/t/db_dependent/Stockrotationstages.t +++ b/t/db_dependent/StockRotationStages.t @@ -26,8 +26,8 @@ use Test::More tests => 6; my $schema = Koha::Database->new->schema; -use_ok('Koha::Stockrotationstages'); -use_ok('Koha::Stockrotationstage'); +use_ok('Koha::StockRotationStages'); +use_ok('Koha::StockRotationStage'); my $builder = t::lib::TestBuilder->new; @@ -46,10 +46,10 @@ subtest 'Basic object tests' => sub { }, }); - my $srstage = Koha::Stockrotationstages->find($stage->{stage_id}); + my $srstage = Koha::StockRotationStages->find($stage->{stage_id}); isa_ok( $srstage, - 'Koha::Stockrotationstage', + 'Koha::StockRotationStage', "Correctly create and load a stock rotation stage." ); @@ -58,7 +58,7 @@ subtest 'Basic object tests' => sub { is( $srstage->branchcode->branchcode, $library->{branchcode}, "Related branch OK." ); # Relationship to rota - isa_ok( $srstage->rota, 'Koha::Stockrotationrota', "Fetched related rota." ); + isa_ok( $srstage->rota, 'Koha::StockRotationRota', "Fetched related rota." ); is( $srstage->rota->rota_id, $rota->{rota_id}, "Related rota OK." ); $schema->storage->txn_rollback; @@ -92,7 +92,7 @@ subtest 'DBIx::Class::Ordered tests' => sub { value => { rota_id => $rota->{rota_id}, position => 5 } }); - my $srstage = Koha::Stockrotationstages->find($stage->{stage_id}); + my $srstage = Koha::StockRotationStages->find($stage->{stage_id}); is($srstage->siblings->count, 4, "Siblings works."); is($srstage->previous_siblings->count, 2, "Previous Siblings works."); @@ -107,7 +107,7 @@ subtest 'DBIx::Class::Ordered tests' => sub { # Test plain relations: while ( my ( $srxsr, $check ) = each %{$map} ) { my $sr = $srstage->$srxsr; - isa_ok($sr, 'Koha::Stockrotationstage', "Fetched using '$srxsr'."); + isa_ok($sr, 'Koha::StockRotationStage', "Fetched using '$srxsr'."); is($sr->stage_id, $check->{stage_id}, "'$srxsr' data is correct."); }; @@ -146,12 +146,12 @@ subtest 'DBIx::Class::Ordered tests' => sub { # Group manipulation my $newrota = $builder->build({ source => 'Stockrotationrota' }); ok($srstage->move_to_group($newrota->{rota_id}), "Move to Group."); - is(Koha::Stockrotationstages->find($srstage->stage_id)->rota_id, $newrota->{rota_id}, "Moved correctly."); + is(Koha::StockRotationStages->find($srstage->stage_id)->rota_id, $newrota->{rota_id}, "Moved correctly."); # Delete in ordered context ok($srstage->delete, "Deleted OK."); is( - Koha::Stockrotationstages->find($stageprevious)->next_sibling->stage_id, + Koha::StockRotationStages->find($stageprevious)->next_sibling->stage_id, $stagenext->{stage_id}, "Delete, correctly re-ordered." ); @@ -178,7 +178,7 @@ subtest 'Relationship to stockrotationitems' => sub { value => { stage_id => $stage->{stage_id} }, }); - my $srstage = Koha::Stockrotationstages->find($stage->{stage_id}); + my $srstage = Koha::StockRotationStages->find($stage->{stage_id}); my $sritems = $srstage->stockrotationitems; is( $sritems->count, 3, @@ -186,7 +186,7 @@ subtest 'Relationship to stockrotationitems' => sub { ); isa_ok( - $sritems->next, 'Koha::Stockrotationitem', + $sritems->next, 'Koha::StockRotationItem', "Relationship correctly creates Koha::Objects." ); @@ -200,7 +200,7 @@ subtest 'Tests for investigate (singular)' => sub { # In this subtest series we will primarily be testing whether items end up # in the correct 'branched' section of the stage-report. We don't care - # for item reasons here, as they are tested in Stockrotationitems. + # for item reasons here, as they are tested in StockRotationItems. # We will run tests on first on an empty report (the base-case) and then # on a populated report. @@ -291,13 +291,13 @@ subtest 'Tests for investigate (singular)' => sub { fresh => 1, } }); - my $dbitem = Koha::Stockrotationitems->find($item); + my $dbitem = Koha::StockRotationItems->find($item); $dbitem->itemnumber->homebranch($code) ->holdingbranch($code)->store; $cnt++; } } - my $report = Koha::Stockrotationstages + my $report = Koha::StockRotationStages ->find($stage1->{stage_id})->investigate; my $results = []; foreach my $lib ( @{$libraries} ) { @@ -330,14 +330,14 @@ subtest 'Tests for investigate (singular)' => sub { fresh => 1, } }); - my $dbitem = Koha::Stockrotationitems->find($item); + my $dbitem = Koha::StockRotationItems->find($item); $dbitem->itemnumber->homebranch($code) ->holdingbranch($code)->store; $cnt++; } } - $report = Koha::Stockrotationstages + $report = Koha::StockRotationStages ->find($stage2->{stage_id})->investigate($report); $results = []; foreach my $lib ( @{$libraries} ) { @@ -358,7 +358,7 @@ subtest 'Tests for investigate (singular)' => sub { } } - $report = Koha::Stockrotationstages + $report = Koha::StockRotationStages ->find($stage1->{stage_id})->investigate; $results = []; foreach my $lib ( @{$libraries} ) { diff --git a/t/db_dependent/api/v1/stockrotationstage.t b/t/db_dependent/api/v1/stockrotationstage.t index 2ec336563e..c76e9b1891 100644 --- a/t/db_dependent/api/v1/stockrotationstage.t +++ b/t/db_dependent/api/v1/stockrotationstage.t @@ -25,7 +25,7 @@ use t::lib::TestBuilder; use t::lib::Mocks; use C4::Auth; -use Koha::Stockrotationstages; +use Koha::StockRotationStages; my $schema = Koha::Database->new->schema; my $builder = t::lib::TestBuilder->new; diff --git a/tools/stockrotation.pl b/tools/stockrotation.pl index 007427078e..b3bf48a689 100755 --- a/tools/stockrotation.pl +++ b/tools/stockrotation.pl @@ -31,11 +31,11 @@ use C4::Auth; use C4::Output; use Koha::Libraries; -use Koha::Stockrotationrotas; -use Koha::Stockrotationitems; -use Koha::Stockrotationstages; +use Koha::StockRotationRotas; +use Koha::StockRotationItems; +use Koha::StockRotationStages; use Koha::Item; -use Koha::Util::Stockrotation qw(:ALL); +use Koha::Util::StockRotation qw(:ALL); my $input = new CGI; @@ -58,7 +58,7 @@ my $op = $params{op}; if (!defined $op) { # No operation is supplied, we're just displaying the list of rotas - my $rotas = Koha::Stockrotationrotas->search->as_list; + my $rotas = Koha::StockRotationRotas->search->as_list; $template->param( existing_rotas => $rotas, @@ -84,7 +84,7 @@ if (!defined $op) { } else { # ID supplied, we're editing an existing rota - $rota = Koha::Stockrotationrotas->find($rota_id); + $rota = Koha::StockRotationRotas->find($rota_id); } @@ -96,7 +96,7 @@ if (!defined $op) { } elsif ($op eq 'toggle_rota') { # Find and update the active status of the rota - my $rota = Koha::Stockrotationrotas->find($params{rota_id}); + my $rota = Koha::StockRotationRotas->find($params{rota_id}); my $new_active = ($rota->active == 1) ? 0 : 1; @@ -128,7 +128,7 @@ if (!defined $op) { } elsif ($op eq 'manage_stages') { - my $rota = Koha::Stockrotationrotas->find($params{rota_id}); + my $rota = Koha::StockRotationRotas->find($params{rota_id}); $template->param( rota => $rota, @@ -158,7 +158,7 @@ if (!defined $op) { } else { # ID supplied, we're editing an existing stage - my $stage = Koha::Stockrotationstages->find($stage_id); + my $stage = Koha::StockRotationStages->find($stage_id); $template->param( branches => get_branches(), @@ -182,7 +182,7 @@ if (!defined $op) { } elsif ($op eq 'confirm_delete_stage') { # Get the stage we're deleting - my $stage = Koha::Stockrotationstages->find($params{stage_id}); + my $stage = Koha::StockRotationStages->find($params{stage_id}); $template->param( op => $op, @@ -192,7 +192,7 @@ if (!defined $op) { } elsif ($op eq 'delete_stage') { # Get the stage we're deleting - my $stage = Koha::Stockrotationstages->find($params{stage_id}); + my $stage = Koha::StockRotationStages->find($params{stage_id}); # Get the ID of the rota with which this stage is associated # (so we can return to the "Manage stages" page after deletion) @@ -234,11 +234,11 @@ if (!defined $op) { } elsif ($op eq 'manage_items') { - my $rota = Koha::Stockrotationrotas->find($params{rota_id}); + my $rota = Koha::StockRotationRotas->find($params{rota_id}); # Get all items on this rota, for each prefetch their # stage and biblio objects - my $items = Koha::Stockrotationitems->search( + my $items = Koha::StockRotationItems->search( { 'stage.rota_id' => $params{rota_id} }, { prefetch => { @@ -430,7 +430,7 @@ sub process_rota { # Passed validation # Find the rota we're updating - my $rota = Koha::Stockrotationrotas->find($sub_rota->{id}); + my $rota = Koha::StockRotationRotas->find($sub_rota->{id}); if ($rota) { @@ -446,7 +446,7 @@ sub process_rota { } else { - $rota = Koha::Stockrotationrota->new({ + $rota = Koha::StockRotationRota->new({ title => $sub_rota->{title}, cyclical => $sub_rota->{cyclical}, active => $sub_rota->{active}, @@ -487,7 +487,7 @@ sub process_stage { # Passed validation # Find the stage we're updating - my $stage = Koha::Stockrotationstages->find($sub_stage->{stage_id}); + my $stage = Koha::StockRotationStages->find($sub_stage->{stage_id}); if ($stage) { @@ -501,7 +501,7 @@ sub process_stage { } else { # Creating a new stage - $stage = Koha::Stockrotationstage->new({ + $stage = Koha::StockRotationStage->new({ branchcode_id => $sub_stage->{branchcode}, rota_id => $rota_id, duration => $sub_stage->{duration} -- 2.13.4