Bug 23463: Replace new occurrence of AddItem
[srvgit] / Koha / StockRotationItem.pm
index e451bb0..430dfcb 100644 (file)
@@ -4,18 +4,18 @@ package Koha::StockRotationItem;
 #
 # This file is part of Koha.
 #
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 3 of the License, or (at your option) any later
-# version.
+# Koha is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
 #
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+# Koha is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
 #
-# You should have received a copy of the GNU General Public License along
-# with Koha; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+# You should have received a copy of the GNU General Public License
+# along with Koha; if not, see <http://www.gnu.org/licenses>.
 
 use Modern::Perl;
 
@@ -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" },
+        { 'reason' => "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,
+        'reason'     => "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"
+        'reason'     => "StockrotationAdvance"
     });
 
     if ( $self->indemand && !$self->fresh ) {