Bugzilla – Attachment 97433 Details for
Bug 24296
Move stock rotation transfer triggers from `comments` to `reason`
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24296: Update stockrotation process to use branchtransfers.trigger
Bug-24296-Update-stockrotation-process-to-use-bran.patch (text/plain), 7.43 KB, created by
Martin Renvoize (ashimema)
on 2020-01-16 09:03:14 UTC
(
hide
)
Description:
Bug 24296: Update stockrotation process to use branchtransfers.trigger
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-01-16 09:03:14 UTC
Size:
7.43 KB
patch
obsolete
>From 0e2d35fff00e7cf63aa4cf29e9da72e92608d490 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 16 Jan 2020 08:57:46 +0000 >Subject: [PATCH] Bug 24296: Update stockrotation process to use > branchtransfers.trigger > >This patch updates all occurences of stockrotation related lookups of >branchtransfers status from using the 'comments' field to using the new >'trigger' field. > >Test plan: >1) Work through the process of creating a stock rotation plan and adding > items to the plan.. no errors should be encoutered during this process. >2) Run the stockrotation cronjob to move some items on.. no errors > should be encountered. >3) Navigate to the transferstosend page in the circulation area of the > staff client.. no errors should be encountered. >--- > Koha/StockRotationItem.pm | 9 +++++---- > circ/transferstosend.pl | 2 +- > .../prog/en/modules/circ/transferstosend.tt | 2 +- > t/db_dependent/StockRotationItems.t | 12 ++++++------ > 4 files changed, 13 insertions(+), 12 deletions(-) > >diff --git a/Koha/StockRotationItem.pm b/Koha/StockRotationItem.pm >index 3db643a7c4..77aebe724c 100644 >--- a/Koha/StockRotationItem.pm >+++ b/Koha/StockRotationItem.pm >@@ -119,7 +119,7 @@ sub needs_advancing { > return 0 if $self->itemnumber->get_transfer; # intransfer: don't advance. > return 1 if $self->fresh; # Just on rota: advance. > my $completed = $self->itemnumber->_result->branchtransfers->search( >- { 'comments' => "StockrotationAdvance" }, >+ { 'trigger' => "StockrotationAdvance" }, > { order_by => { -desc => 'datearrived' } } > ); > # Do maths on whether we need to be moved on. >@@ -156,7 +156,8 @@ sub repatriate { > 'frombranch' => $self->itemnumber->holdingbranch, > 'tobranch' => $self->stage->branchcode_id, > 'datesent' => DateTime->now, >- 'comments' => $msg || "StockrotationRepatriation", >+ 'comments' => $msg, >+ 'trigger' => "StockrotationRepatriation" > })->store; > $self->itemnumber->homebranch($self->stage->branchcode_id)->store; > return $transfer_stored; >@@ -185,7 +186,7 @@ sub advance { > 'itemnumber' => $self->itemnumber_id, > 'frombranch' => $item->holdingbranch, > 'datesent' => DateTime->now, >- 'comments' => "StockrotationAdvance" >+ 'trigger' => "StockrotationAdvance" > }); > > if ( $self->indemand && !$self->fresh ) { >@@ -247,7 +248,7 @@ sub toggle_indemand { > if ($new_indemand) { > my $item = $self->itemnumber; > my $transfer = $item->get_transfer; >- if ($transfer && $transfer->comments eq 'StockrotationAdvance') { >+ if ($transfer && $transfer->trigger eq 'StockrotationAdvance') { > my $stage = $self->stage; > my $new_stage; > if ( $stage->rota->cyclical && !$stage->first_sibling ) { # First stage >diff --git a/circ/transferstosend.pl b/circ/transferstosend.pl >index adfdbd0846..11042e813a 100755 >--- a/circ/transferstosend.pl >+++ b/circ/transferstosend.pl >@@ -48,7 +48,7 @@ my @transfers = Koha::Libraries->search( > 'branchtransfers_tobranches.frombranch' => $branchcode, > 'branchtransfers_tobranches.datesent' => { '!=' => undef }, > 'branchtransfers_tobranches.datearrived' => undef, >- 'branchtransfers_tobranches.comments' => >+ 'branchtransfers_tobranches.trigger' => > [ "StockrotationAdvance", "StockrotationRepatriation" ] > }, > { >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transferstosend.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transferstosend.tt >index 7a6626c30e..474e555120 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transferstosend.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transferstosend.tt >@@ -55,7 +55,7 @@ > <td>[% Branches.GetName( transfer.item.homebranch ) | html %]</td> > <td>[% transfer.item.itemcallnumber | html %]</td> > <td class="actions"> >- [% IF transfer.comments == 'StockrotationAdvance' %] >+ [% IF transfer.trigger == 'StockrotationAdvance' %] > <a href="/cgi-bin/koha/catalogue/stockrotation.pl?op=toggle_in_demand&stage_id=4&item_id=[% transfer.itemnumber %]&biblionumber=[% transfer.item.biblionumber %]" class="btn btn-default btn-xs"><i class="fa fa-fire"></i> Mark "In demand"</a> > [% END %] > </td> >diff --git a/t/db_dependent/StockRotationItems.t b/t/db_dependent/StockRotationItems.t >index 64697dbfaa..bcbf26118d 100644 >--- a/t/db_dependent/StockRotationItems.t >+++ b/t/db_dependent/StockRotationItems.t >@@ -175,7 +175,7 @@ subtest "Tests for needs_advancing." => sub { > 'tobranch' => $dbitem->stage->branchcode_id, > 'datesent' => DateTime->now, > 'datearrived' => undef, >- 'comments' => "StockrotationAdvance", >+ 'trigger' => "StockrotationAdvance", > })->store; > > # Test item will not be advanced if in transit. >@@ -307,7 +307,7 @@ subtest "Tests for investigate (singular)." => sub { > 'tobranch' => $dbitem->itemnumber->homebranch, > 'datesent' => DateTime->now, > 'datearrived' => DateTime->now, >- 'comments' => "StockrotationAdvance", >+ 'trigger' => "StockrotationAdvance", > })->store; > is($dbitem->investigate->{reason}, 'repatriation', "older item repatriates."); > >@@ -323,7 +323,7 @@ subtest "Tests for investigate (singular)." => sub { > 'tobranch' => $dbitem->stage->branchcode_id, > 'datesent' => DateTime->now, > 'datearrived' => DateTime->now, >- 'comments' => "StockrotationAdvance", >+ 'trigger' => "StockrotationAdvance", > })->store; > $dbitem->itemnumber->homebranch($dbitem->stage->branchcode_id)->store; > $dbitem->itemnumber->holdingbranch($dbitem->stage->branchcode_id)->store; >@@ -342,7 +342,7 @@ subtest "Tests for investigate (singular)." => sub { > 'tobranch' => $dbitem->stage->branchcode_id, > 'datesent' => DateTime->now - $sent_duration, > 'datearrived' => DateTime->now - $arrived_duration, >- 'comments' => "StockrotationAdvance", >+ 'trigger' => "StockrotationAdvance", > })->store; > $dbitem->itemnumber->homebranch($dbitem->stage->branchcode_id)->store; > $dbitem->itemnumber->holdingbranch($dbitem->stage->branchcode_id)->store; >@@ -362,7 +362,7 @@ subtest "Tests for investigate (singular)." => sub { > 'tobranch' => $dbitem->stage->branchcode_id, > 'datesent' => DateTime->now - $sent_duration, > 'datearrived' => DateTime->now - $arrived_duration, >- 'comments' => "StockrotationAdvance", >+ 'trigger' => "StockrotationAdvance", > })->store; > $dbitem->itemnumber->homebranch($dbitem->stage->branchcode_id)->store; > $dbitem->itemnumber->holdingbranch($dbitem->stage->branchcode_id)->store; >@@ -382,7 +382,7 @@ subtest "Tests for investigate (singular)." => sub { > 'tobranch' => $dbitem->stage->branchcode_id, > 'datesent' => DateTime->now - $sent_duration, > 'datearrived' => DateTime->now - $arrived_duration, >- 'comments' => "StockrotationAdvance", >+ 'trigger' => "StockrotationAdvance", > })->store; > is($dbitem->investigate->{reason}, 'repatriation', > "Item advances, but not at stage branch."); >-- >2.20.1
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 24296
:
97433
|
97434
|
97504
|
97505
|
97517
|
97518
|
97533
|
97534
|
98024
|
98025