Lines 40-46
Koha::Library::FloatLimits - Koha Library::FloatLimit object set class
Link Here
|
40 |
=cut |
40 |
=cut |
41 |
|
41 |
|
42 |
sub lowest_ratio_library { |
42 |
sub lowest_ratio_library { |
43 |
my ( $self, $item, $branchcode ) = @_; |
43 |
my ( $self, $item, $branchcode, $from_branch ) = @_; |
44 |
my $schema = Koha::Database->new->schema; |
44 |
my $schema = Koha::Database->new->schema; |
45 |
|
45 |
|
46 |
my @float_limits = $schema->resultset('LibraryFloatLimit')->search( |
46 |
my @float_limits = $schema->resultset('LibraryFloatLimit')->search( |
Lines 116-121
sub lowest_ratio_library {
Link Here
|
116 |
} |
116 |
} |
117 |
)->count; |
117 |
)->count; |
118 |
$item_count = $at_branch_count + $in_transit_to_count - $in_transit_from_count; |
118 |
$item_count = $at_branch_count + $in_transit_to_count - $in_transit_from_count; |
|
|
119 |
|
120 |
# artifically adjust counts for the item being checked in |
121 |
if ($from_branch) { |
122 |
|
123 |
# This is the checkin branch - artifically add 1 |
124 |
if ( $branch eq $branchcode ) { |
125 |
$item_count++; |
126 |
} |
127 |
|
128 |
# This is where the item came from - artifically subtract 1 |
129 |
if ( $branch eq $from_branch ) { |
130 |
$item_count--; |
131 |
} |
132 |
} |
133 |
|
119 |
} else { |
134 |
} else { |
120 |
my $at_branch_count = Koha::Items->search( |
135 |
my $at_branch_count = Koha::Items->search( |
121 |
{ |
136 |
{ |
Lines 156-161
sub lowest_ratio_library {
Link Here
|
156 |
} |
171 |
} |
157 |
)->count; |
172 |
)->count; |
158 |
$item_count = $at_branch_count + $in_transit_to_count - $in_transit_from_count; |
173 |
$item_count = $at_branch_count + $in_transit_to_count - $in_transit_from_count; |
|
|
174 |
|
175 |
# artifically adjust counts for the item being checked in |
176 |
if ($from_branch) { |
177 |
|
178 |
# This is the checkin branch - artifically add 1 |
179 |
if ( $branch eq $branchcode ) { |
180 |
$item_count++; |
181 |
} |
182 |
|
183 |
# This is where the item came from - artifically subtract 1 |
184 |
if ( $branch eq $from_branch ) { |
185 |
$item_count--; |
186 |
} |
187 |
} |
159 |
} |
188 |
} |
160 |
|
189 |
|
161 |
my $ratio = $item_count / $float_limit_val; |
190 |
my $ratio = $item_count / $float_limit_val; |
162 |
- |
|
|