Bug 21637: Fixed upercase letter in EasyAnalyticalRecords syspref
[koha.git] / Koha / StockRotationItems.pm
blobc78c2676c3cbf7456a314e147a51a5ba1f6206bd
1 package Koha::StockRotationItems;
3 # Copyright PTFS Europe 2016
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 3 of the License, or (at your option) any later
10 # version.
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License along
17 # with Koha; if not, write to the Free Software Foundation, Inc.,
18 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 use Modern::Perl;
22 use Koha::Database;
23 use Koha::StockRotationItem;
25 use base qw(Koha::Objects);
27 =head1 NAME
29 StockRotationItems - Koha StockRotationItems Object class
31 =head1 SYNOPSIS
33 StockRotationItems class used primarily by stockrotation .pls and the stock
34 rotation cron script.
36 =head1 DESCRIPTION
38 Standard Koha::Objects definitions, and additional methods.
40 =head1 API
42 =head2 Class Methods
44 =cut
46 =head3 _type
48 =cut
50 sub _type {
51 return 'Stockrotationitem';
54 =head3 object_class
56 =cut
58 sub object_class {
59 return 'Koha::StockRotationItem';
62 =head3 investigate
64 my $report = $items->investigate;
66 Return a stockrotation report about this set of stockrotationitems.
68 In this part of the overall investigation process we split individual item
69 reports into appropriate action segments of our items report and increment
70 some counters.
72 The report generated here will be used on the stage level to slot our item
73 reports into appropriate sections of the branched report.
75 For details of intent and context of this procedure, please see
76 Koha::StockRotationRota->investigate.
78 =cut
80 sub investigate {
81 my ( $self ) = @_;
83 my $items_report = {
84 items => [],
85 log => [],
86 initiable_items => [],
87 repatriable_items => [],
88 advanceable_items => [],
89 indemand_items => [],
90 actionable => 0,
91 stationary => 0,
93 while ( my $item = $self->next ) {
94 my $report = $item->investigate;
95 if ( $report->{reason} eq 'initiation' ) {
96 $items_report->{initiable}++;
97 $items_report->{actionable}++;
98 push @{$items_report->{items}}, $report;
99 push @{$items_report->{initiable_items}}, $report;
100 } elsif ( $report->{reason} eq 'repatriation' ) {
101 $items_report->{repatriable}++;
102 $items_report->{actionable}++;
103 push @{$items_report->{items}}, $report;
104 push @{$items_report->{repatriable_items}}, $report;
105 } elsif ( $report->{reason} eq 'advancement' ) {
106 $items_report->{actionable}++;
107 push @{$items_report->{items}}, $report;
108 push @{$items_report->{advanceable_items}}, $report;
109 } elsif ( $report->{reason} eq 'in-demand' ) {
110 $items_report->{actionable}++;
111 push @{$items_report->{items}}, $report;
112 push @{$items_report->{indemand_items}}, $report;
113 } else {
114 $items_report->{stationary}++;
115 push @{$items_report->{log}}, $report;
119 return $items_report;
124 =head1 AUTHOR
126 Alex Sassmannshausen <alex.sassmannshausen@ptfs-europe.com>
128 =cut