View | Details | Raw Unified | Return to bug 28530
Collapse All | Expand All

(-)a/C4/Circulation.pm (+14 lines)
Lines 52-57 use Koha::Patrons; Link Here
52
use Koha::Patron::Debarments qw( DelUniqueDebarment AddUniqueDebarment );
52
use Koha::Patron::Debarments qw( DelUniqueDebarment AddUniqueDebarment );
53
use Koha::Database;
53
use Koha::Database;
54
use Koha::Libraries;
54
use Koha::Libraries;
55
use Koha::Library::FloatLimits;
55
use Koha::Account::Lines;
56
use Koha::Account::Lines;
56
use Koha::Holds;
57
use Koha::Holds;
57
use Koha::Account::Lines;
58
use Koha::Account::Lines;
Lines 2272-2277 sub AddReturn { Link Here
2272
    # if $hbr was "noreturn" or any other non-item table value, then it should 'float' (i.e. stay at this branch)
2273
    # if $hbr was "noreturn" or any other non-item table value, then it should 'float' (i.e. stay at this branch)
2273
    my $transfer_trigger = $hbr eq 'homebranch' ? 'ReturnToHome' : $hbr eq 'holdingbranch' ? 'ReturnToHolding' : undef;
2274
    my $transfer_trigger = $hbr eq 'homebranch' ? 'ReturnToHome' : $hbr eq 'holdingbranch' ? 'ReturnToHolding' : undef;
2274
2275
2276
    # check library float limits if enabled if the item isn't being transferred away
2277
    if ( ( $returnbranch eq $branch ) && C4::Context->preference('UseLibraryFloatLimits') ) {
2278
        my $effective_itemtype = $item->effective_itemtype;
2279
        my $limit = Koha::Library::FloatLimits->find( { itemtype => $effective_itemtype, branchcode => $branch } );
2280
        if ($limit) {
2281
            my $transfer_library = Koha::Library::FloatLimits->lowest_ratio_library( $item, $branch );
2282
            if ( $transfer_library && $transfer_library->branchcode ne $branch ) {
2283
                $returnbranch     = $transfer_library->branchcode;
2284
                $transfer_trigger = 'LibraryFloatLimit';
2285
            }
2286
        }
2287
    }
2288
2275
    my $borrowernumber   = $patron ? $patron->borrowernumber : undef;    # we don't know if we had a borrower or not
2289
    my $borrowernumber   = $patron ? $patron->borrowernumber : undef;    # we don't know if we had a borrower or not
2276
    my $patron_unblessed = $patron ? $patron->unblessed      : {};
2290
    my $patron_unblessed = $patron ? $patron->unblessed      : {};
2277
2291
(-)a/Koha/Library/FloatLimits.pm (-24 / +124 lines)
Lines 1-5 Link Here
1
## Please see file perltidy.ERR
2
## Please see file perltidy.ERR
3
package Koha::Library::FloatLimits;
1
package Koha::Library::FloatLimits;
4
2
5
# Copyright ByWater Solutions 2016
3
# Copyright ByWater Solutions 2016
Lines 24-29 use Modern::Perl; Link Here
24
use Koha::Database;
22
use Koha::Database;
25
23
26
use Koha::Library::FloatLimit;
24
use Koha::Library::FloatLimit;
25
use Koha::Libraries;
27
use C4::Circulation qw(IsBranchTransferAllowed);
26
use C4::Circulation qw(IsBranchTransferAllowed);
28
27
29
use base qw(Koha::Objects);
28
use base qw(Koha::Objects);
Lines 43-82 Koha::Library::FloatLimits - Koha Library::FloatLimit object set class Link Here
43
sub lowest_ratio_library {
42
sub lowest_ratio_library {
44
    my ( $self, $item, $branchcode ) = @_;
43
    my ( $self, $item, $branchcode ) = @_;
45
44
46
    my $field = C4::Context->preference('item-level_itypes') ? 'items.itype' : 'biblioitems.itemtype';
45
    my $schema = Koha::Database->new->schema;
47
    my $query = qq{
46
48
        SELECT branchcode
47
    my @float_limits = $schema->resultset('LibraryFloatLimit')->search(
49
        FROM library_float_limits
48
        {
50
        LEFT JOIN items ON ( items.itype = library_float_limits.itemtype AND items.holdingbranch = library_float_limits.branchcode )
49
            itemtype    => $item->effective_itemtype,
51
        LEFT JOIN biblioitems ON ( items.biblioitemnumber = biblioitems.biblioitemnumber )
50
            float_limit => { '!=' => 0 }
52
        WHERE library_float_limits.itemtype = ?
51
        }
53
              AND ( $field = ? OR $field IS NULL )
52
    )->all;
54
              AND library_float_limits.float_limit != 0
53
55
        GROUP BY branchcode
54
    return unless @float_limits;
56
        ORDER BY COUNT(items.holdingbranch)/library_float_limits.float_limit ASC, library_float_limits.float_limit DESC;
55
57
    };
56
    my @candidates;
58
57
    my $use_item_level = C4::Context->preference('item-level_itypes');
59
    my $results = C4::Context->dbh->selectall_arrayref(
58
60
        $query, { Slice => {} }, $item->effective_itemtype,
59
    foreach my $limit (@float_limits) {
61
        $item->effective_itemtype
60
        my $branch          = $limit->get_column('branchcode');
62
    );
61
        my $float_limit_val = $limit->get_column('float_limit');
62
63
        my $item_count;
64
65
        if ($use_item_level) {
66
            my $at_branch_count = Koha::Items->search(
67
                {
68
                    itype         => $item->effective_itemtype,
69
                    holdingbranch => $branch,
70
                    onloan        => undef
71
                },
72
            )->count;
73
74
            # Count items in transit TO this branch
75
            my $in_transit_to_count = Koha::Items->search(
76
                {
77
                    itype => $item->effective_itemtype,
78
79
                    # Join with active transfers where this branch is the destination
80
                },
81
                {
82
                    join  => 'branchtransfers',
83
                    where => {
84
                        'branchtransfers.tobranch'      => $branch,
85
                        'branchtransfers.datearrived'   => undef,     # Still in transit
86
                        'branchtransfers.datecancelled' => undef,     #Not cancelled
87
                    },
88
                    distinct => 1
89
                }
90
            )->count;
91
92
            my $in_transit_from_count = Koha::Items->search(
93
                { itype => $item->effective_itemtype },
94
                {
95
                    join  => 'branchtransfers',
96
                    where => {
97
                        'branchtransfers.frombranch'    => $branch,
98
                        'branchtransfers.datearrived'   => undef,     # Still in transit
99
                        'branchtransfers.datecancelled' => undef,     #Not cancelled
100
                    },
101
                    distinct => 1
102
                }
103
            )->count;
104
            $item_count = $at_branch_count + $in_transit_to_count - $in_transit_from_count;
105
        } else {
106
            my $at_branch_count = Koha::Items->search(
107
                {
108
                    holdingbranch         => $branch,
109
                    'biblioitem.itemtype' => $item->effective_itemtype,
110
                    onloan                => undef
111
                },
112
            )->count;
113
114
            # Count items in transit TO this branch
115
            my $in_transit_to_count = Koha::Items->search(
116
                {
117
                    itype => $item->effective_itemtype,
118
                },
119
                {
120
                    join  => 'branchtransfers',
121
                    where => {
122
                        'branchtransfers.tobranch'      => $branch,
123
                        'branchtransfers.datearrived'   => undef,     # Still in transit
124
                        'branchtransfers.datecancelled' => undef,     #Not cancelled
125
                    },
126
                    distinct => 1
127
                }
128
            )->count;
129
130
            my $in_transit_from_count = Koha::Items->search(
131
                {
132
                    itype => $item->effective_itemtype,
133
                },
134
                {
135
                    join  => 'branchtransfers',
136
                    where => {
137
                        'branchtransfers.frombranch'    => $branch,
138
                        'branchtransfers.datearrived'   => undef,     # Still in transit
139
                        'branchtransfers.datecancelled' => undef,     #Not cancelled
140
                    },
141
                    distinct => 1
142
                }
143
            )->count;
144
            $item_count = $at_branch_count + $in_transit_to_count - $in_transit_from_count;
145
        }
146
147
        my $ratio = $item_count / $float_limit_val;
148
149
        push @candidates, {
150
            branchcode  => $branch,
151
            ratio       => $ratio,
152
            float_limit => $float_limit_val
153
        };
154
    }
155
156
    # sort the branches by lowest ratio in the event of a tie choose a random branch
157
    @candidates = sort { $a->{ratio} <=> $b->{ratio} || rand() <=> rand() } @candidates;
63
158
64
    my $UseBranchTransferLimits = C4::Context->preference("UseBranchTransferLimits");
159
    my $UseBranchTransferLimits = C4::Context->preference("UseBranchTransferLimits");
65
    my $BranchTransferLimitsType =
160
    my $BranchTransferLimitsType =
66
        C4::Context->preference("BranchTransferLimitsType") eq 'itemtype' ? 'effective_itemtype' : 'ccode';
161
        C4::Context->preference("BranchTransferLimitsType") eq 'itemtype' ? 'effective_itemtype' : 'ccode';
67
162
68
    foreach my $r (@$results) {
163
    my $transfer_branch;
164
    for my $candidate (@candidates) {
69
        if ($UseBranchTransferLimits) {
165
        if ($UseBranchTransferLimits) {
70
            my $allowed = C4::Circulation::IsBranchTransferAllowed(
166
            my $allowed = C4::Circulation::IsBranchTransferAllowed(
71
                $r->{branchcode},    # to
167
                $candidate->{branchcode},
72
                $branchcode,         # from
168
                $branchcode,
73
                $item->$BranchTransferLimitsType
169
                $item->$BranchTransferLimitsType
74
            );
170
            );
75
            return $r->{branchcode} if $allowed;
171
            $transfer_branch = Koha::Libraries->find( $candidate->{branchcode} ) if $allowed;
172
            last;
76
        } else {
173
        } else {
77
            return $r->{branchcode};
174
            $transfer_branch = Koha::Libraries->find( $candidate->{branchcode} );
175
            last;
78
        }
176
        }
79
    }
177
    }
178
179
    return $transfer_branch;
80
}
180
}
81
181
82
=head3 _type
182
=head3 _type
(-)a/Koha/Schema/Result/Branch.pm (-3 / +18 lines)
Lines 800-805 __PACKAGE__->has_many( Link Here
800
  { cascade_copy => 0, cascade_delete => 0 },
800
  { cascade_copy => 0, cascade_delete => 0 },
801
);
801
);
802
802
803
=head2 library_float_limits
804
805
Type: has_many
806
807
Related object: L<Koha::Schema::Result::LibraryFloatLimit>
808
809
=cut
810
811
__PACKAGE__->has_many(
812
  "library_float_limits",
813
  "Koha::Schema::Result::LibraryFloatLimit",
814
  { "foreign.branchcode" => "self.branchcode" },
815
  { cascade_copy => 0, cascade_delete => 0 },
816
);
817
803
=head2 library_groups
818
=head2 library_groups
804
819
805
Type: has_many
820
Type: has_many
Lines 996-1003 __PACKAGE__->has_many( Link Here
996
);
1011
);
997
1012
998
1013
999
# Created by DBIx::Class::Schema::Loader v0.07051 @ 2024-05-03 13:13:25
1014
# Created by DBIx::Class::Schema::Loader v0.07051 @ 2024-07-02 11:14:12
1000
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:HiH1QNlDqKcq9GeM85Pu0A
1015
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:3TsuWEa3C2DEKJ1gR+V2Ig
1001
1016
1002
__PACKAGE__->has_many(
1017
__PACKAGE__->has_many(
1003
    "additional_field_values",
1018
    "additional_field_values",
Lines 1040-1043 sub koha_objects_class { Link Here
1040
    'Koha::Libraries';
1055
    'Koha::Libraries';
1041
}
1056
}
1042
1057
1043
1;
1058
1;
(-)a/Koha/Schema/Result/Branchtransfer.pm (-4 / +5 lines)
Lines 103-109 any comments related to the transfer Link Here
103
=head2 reason
103
=head2 reason
104
104
105
  data_type: 'enum'
105
  data_type: 'enum'
106
  extra: {list => ["Manual","StockrotationAdvance","StockrotationRepatriation","ReturnToHome","ReturnToHolding","RotatingCollection","Reserve","LostReserve","CancelReserve","TransferCancellation","Recall","RecallCancellation"]}
106
  extra: {list => ["Manual","StockrotationAdvance","StockrotationRepatriation","ReturnToHome","ReturnToHolding","RotatingCollection","Reserve","LostReserve","CancelReserve","TransferCancellation","Recall","RecallCancellation","LibraryFloatLimit"]}
107
  is_nullable: 1
107
  is_nullable: 1
108
108
109
what triggered the transfer
109
what triggered the transfer
Lines 188-193 __PACKAGE__->add_columns( Link Here
188
        "TransferCancellation",
188
        "TransferCancellation",
189
        "Recall",
189
        "Recall",
190
        "RecallCancellation",
190
        "RecallCancellation",
191
        "LibraryFloatLimit",
191
      ],
192
      ],
192
    },
193
    },
193
    is_nullable => 1,
194
    is_nullable => 1,
Lines 275-282 __PACKAGE__->belongs_to( Link Here
275
);
276
);
276
277
277
278
278
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-10-03 16:48:17
279
# Created by DBIx::Class::Schema::Loader v0.07051 @ 2024-07-02 11:14:12
279
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:BkhtfptiDqKKSv/hmCQy3w
280
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:qJ8/zlwESoKfSq3JJY8Jug
280
281
281
=head2 koha_object_class
282
=head2 koha_object_class
282
283
Lines 298-301 sub koha_objects_class { Link Here
298
    'Koha::Item::Transfers';
299
    'Koha::Item::Transfers';
299
}
300
}
300
301
301
1;
302
1;
(-)a/Koha/Schema/Result/Itemtype.pm (-1 / +16 lines)
Lines 293-298 __PACKAGE__->has_many( Link Here
293
  { cascade_copy => 0, cascade_delete => 0 },
293
  { cascade_copy => 0, cascade_delete => 0 },
294
);
294
);
295
295
296
=head2 library_float_limits
297
298
Type: has_many
299
300
Related object: L<Koha::Schema::Result::LibraryFloatLimit>
301
302
=cut
303
304
__PACKAGE__->has_many(
305
  "library_float_limits",
306
  "Koha::Schema::Result::LibraryFloatLimit",
307
  { "foreign.itemtype" => "self.itemtype" },
308
  { cascade_copy => 0, cascade_delete => 0 },
309
);
310
296
=head2 old_reserves
311
=head2 old_reserves
297
312
298
Type: has_many
313
Type: has_many
Lines 393-396 sub koha_objects_class { Link Here
393
    'Koha::ItemTypes';
408
    'Koha::ItemTypes';
394
}
409
}
395
410
396
1;
411
1;
(-)a/admin/float_limits.pl (-1 / +1 lines)
Lines 44-50 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
44
44
45
my $op = $input->param('op');
45
my $op = $input->param('op');
46
46
47
if ( $op eq 'set_float_limits' ) {
47
if ( $op eq 'cud-set_float_limits' ) {
48
    my $schema    = Koha::Database->new()->schema();
48
    my $schema    = Koha::Database->new()->schema();
49
    my @branches  = Koha::Libraries->search()->as_list;
49
    my @branches  = Koha::Libraries->search()->as_list;
50
    my @itemtypes = Koha::ItemTypes->search()->as_list;
50
    my @itemtypes = Koha::ItemTypes->search()->as_list;
(-)a/circ/returns.pl (-2 / +15 lines)
Lines 303-309 if ( $barcode && ( $op eq 'cud-checkin' || $op eq 'cud-affect_reserve' ) ) { Link Here
303
        my $biblio   = $item->biblio;
303
        my $biblio   = $item->biblio;
304
        $template->param(
304
        $template->param(
305
            title                => $biblio->title,
305
            title                => $biblio->title,
306
            returnbranch         => $returnbranch,
307
            author               => $biblio->author,
306
            author               => $biblio->author,
308
            itembiblionumber     => $biblio->biblionumber,
307
            itembiblionumber     => $biblio->biblionumber,
309
            biblionumber         => $biblio->biblionumber,
308
            biblionumber         => $biblio->biblionumber,
Lines 413-418 if ( $barcode && ( $op eq 'cud-checkin' || $op eq 'cud-affect_reserve' ) ) { Link Here
413
        );
412
        );
414
    }
413
    }
415
414
415
    $returnbranch = $messages->{NeedsTransfer} if $messages->{NeedsTransfer};
416
416
    # Mark missing bundle items as lost and report unexpected items
417
    # Mark missing bundle items as lost and report unexpected items
417
    if (   $item
418
    if (   $item
418
        && $item->is_bundle
419
        && $item->is_bundle
Lines 509-514 my $recalled = 0; Link Here
509
# new op dev : we check if the document must be returned to his homebranch directly,
510
# new op dev : we check if the document must be returned to his homebranch directly,
510
#  if the document is transferred, we have warning message .
511
#  if the document is transferred, we have warning message .
511
512
513
if ( $messages->{'LibraryFloatLimitTransferRequest'} ) {
514
    $template->param(
515
        LibraryFloatLimitTransferRequest => 1,
516
        itemnumber                       => $itemnumber,
517
    );
518
}
519
512
if ( $messages->{'WasTransfered'} ) {
520
if ( $messages->{'WasTransfered'} ) {
513
    $template->param(
521
    $template->param(
514
        found      => 1,
522
        found      => 1,
Lines 741-746 foreach my $code ( keys %$messages ) { Link Here
741
        ;
749
        ;
742
    } elsif ( $code eq 'TransferredRecall' ) {
750
    } elsif ( $code eq 'TransferredRecall' ) {
743
        ;
751
        ;
752
    } elsif ( $code eq 'LibraryFloatLimitTransferRequest' ) {
753
        ;
744
    } elsif ( $code eq 'InBundle' ) {
754
    } elsif ( $code eq 'InBundle' ) {
745
        $template->param( InBundle => $messages->{InBundle} );
755
        $template->param( InBundle => $messages->{InBundle} );
746
    } elsif ( $code eq 'UpdateLastSeenError' ) {
756
    } elsif ( $code eq 'UpdateLastSeenError' ) {
Lines 819-825 if ($barcode) { Link Here
819
    }
829
    }
820
}
830
}
821
831
822
$template->param( itemnumber => $itemnumber );
832
$template->param(
833
    itemnumber   => $itemnumber,
834
    returnbranch => $returnbranch,
835
);
823
836
824
# Checking if there is a Fast Cataloging Framework
837
# Checking if there is a Fast Cataloging Framework
825
$template->param( fast_cataloging => 1 ) if Koha::BiblioFrameworks->find('FA');
838
$template->param( fast_cataloging => 1 ) if Koha::BiblioFrameworks->find('FA');
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc (-34 / +34 lines)
Lines 24-63 Link Here
24
        </ul>
24
        </ul>
25
    [% END %]
25
    [% END %]
26
26
27
        [% IF ( CAN_user_parameters_manage_patron_categories || CAN_user_parameters_manage_circ_rules || CAN_user_parameters_manage_patron_attributes || CAN_user_parameters_manage_transfers || CAN_user_parameters_manage_item_circ_alerts || CAN_user_parameters_manage_cities || CAN_user_parameters_manage_curbside_pickups || CAN_user_parameters_manage_patron_restrictions ) %]
27
    [% IF ( CAN_user_parameters_manage_patron_categories || CAN_user_parameters_manage_circ_rules || CAN_user_parameters_manage_patron_attributes || CAN_user_parameters_manage_transfers || CAN_user_parameters_manage_item_circ_alerts || CAN_user_parameters_manage_cities || CAN_user_parameters_manage_curbside_pickups || CAN_user_parameters_manage_patron_restrictions ) %]
28
            <h5>Patrons and circulation</h5>
28
        <h5>Patrons and circulation</h5>
29
            <ul>
29
        <ul>
30
                [% IF ( CAN_user_parameters_manage_patron_categories ) %]
30
            [% IF ( CAN_user_parameters_manage_patron_categories ) %]
31
                    <li><a href="/cgi-bin/koha/admin/categories.pl">Patron categories</a></li>
31
                <li><a href="/cgi-bin/koha/admin/categories.pl">Patron categories</a></li>
32
                [% END %]
32
            [% END %]
33
                [% IF ( CAN_user_parameters_manage_circ_rules ) %]
33
            [% IF ( CAN_user_parameters_manage_circ_rules ) %]
34
                    <li><a href="/cgi-bin/koha/admin/smart-rules.pl">Circulation and fine rules</a></li>
34
                <li><a href="/cgi-bin/koha/admin/smart-rules.pl">Circulation and fine rules</a></li>
35
                [% END %]
35
            [% END %]
36
                [% IF ( CAN_user_parameters_manage_patron_attributes ) %]
36
            [% IF ( CAN_user_parameters_manage_patron_attributes ) %]
37
                    <li><a href="/cgi-bin/koha/admin/patron-attr-types.pl">Patron attribute types</a></li>
37
                <li><a href="/cgi-bin/koha/admin/patron-attr-types.pl">Patron attribute types</a></li>
38
                [% END %]
38
            [% END %]
39
                [% IF ( CAN_user_parameters_manage_transfers ) %]
39
            [% IF ( CAN_user_parameters_manage_transfers ) %]
40
                    <li><a href="/cgi-bin/koha/admin/branch_transfer_limits.pl">Library transfer limits</a></li>
40
                <li><a href="/cgi-bin/koha/admin/branch_transfer_limits.pl">Library transfer limits</a></li>
41
                    <li><a href="/cgi-bin/koha/admin/transport-cost-matrix.pl">Transport cost matrix</a></li>
41
                <li><a href="/cgi-bin/koha/admin/transport-cost-matrix.pl">Transport cost matrix</a></li>
42
                    <li><a href="/cgi-bin/koha/admin/float_limits.pl">Library float limits</a></li>
42
                <li><a href="/cgi-bin/koha/admin/float_limits.pl">Library float limits</a></li>
43
                [% END %]
43
            [% END %]
44
                [% IF ( CAN_user_parameters_manage_item_circ_alerts ) %]
44
            [% IF ( CAN_user_parameters_manage_item_circ_alerts ) %]
45
                    <li><a href="/cgi-bin/koha/admin/item_circulation_alerts.pl">Item circulation alerts</a></li>
45
                <li><a href="/cgi-bin/koha/admin/item_circulation_alerts.pl">Item circulation alerts</a></li>
46
                [% END %]
46
            [% END %]
47
                [% IF ( Koha.Preference('UseCirculationDesks') && CAN_user_parameters_manage_libraries ) %]
47
            [% IF ( Koha.Preference('UseCirculationDesks') && CAN_user_parameters_manage_libraries ) %]
48
                    <li><a href="/cgi-bin/koha/admin/desks.pl">Desks</a></li>
48
                <li><a href="/cgi-bin/koha/admin/desks.pl">Desks</a></li>
49
                [% END %]
49
            [% END %]
50
                [% IF ( CAN_user_parameters_manage_cities ) %]
50
            [% IF ( CAN_user_parameters_manage_cities ) %]
51
                    <li><a href="/cgi-bin/koha/admin/cities.pl">Cities and towns</a></li>
51
                <li><a href="/cgi-bin/koha/admin/cities.pl">Cities and towns</a></li>
52
                [% END %]
52
            [% END %]
53
                [% IF ( CAN_user_parameters_manage_curbside_pickups ) %]
53
            [% IF ( CAN_user_parameters_manage_curbside_pickups ) %]
54
                    <li><a href="/cgi-bin/koha/admin/curbside_pickup.pl">Curbside pickup</a></li>
54
                <li><a href="/cgi-bin/koha/admin/curbside_pickup.pl">Curbside pickup</a></li>
55
                [% END %]
55
            [% END %]
56
                [% IF ( CAN_user_parameters_manage_patron_restrictions ) %]
56
            [% IF ( CAN_user_parameters_manage_patron_restrictions ) %]
57
                    <li><a href="/cgi-bin/koha/admin/restrictions.pl">Patron restriction types</a></li>
57
                <li><a href="/cgi-bin/koha/admin/restrictions.pl">Patron restriction types</a></li>
58
                [% END %]
58
            [% END %]
59
            </ul>
59
        </ul>
60
        [% END %]
60
    [% END %]
61
61
62
    [% IF ( CAN_user_parameters_manage_accounts || ( Koha.Preference('UseCashRegisters') && CAN_user_parameters_manage_cash_registers ) ) %]
62
    [% IF ( CAN_user_parameters_manage_accounts || ( Koha.Preference('UseCashRegisters') && CAN_user_parameters_manage_cash_registers ) ) %]
63
        <h5>Accounting</h5>
63
        <h5>Accounting</h5>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt (+2 lines)
Lines 108-113 Link Here
108
                        >
108
                        >
109
                        <dt><a href="/cgi-bin/koha/admin/transport-cost-matrix.pl">Transport cost matrix</a></dt>
109
                        <dt><a href="/cgi-bin/koha/admin/transport-cost-matrix.pl">Transport cost matrix</a></dt>
110
                        <dd>Define transport costs between branches</dd>
110
                        <dd>Define transport costs between branches</dd>
111
                        <dt><a href="/cgi-bin/koha/admin/float_limits.pl">Library float limits</a></dt>
112
                        <dd>Define when items should be transferred to other libraries on checkin to balance floating collections</dd>
111
                    [% END %]
113
                    [% END %]
112
                    [% IF ( CAN_user_parameters_manage_item_circ_alerts ) %]
114
                    [% IF ( CAN_user_parameters_manage_item_circ_alerts ) %]
113
                        <dt><a href="/cgi-bin/koha/admin/item_circulation_alerts.pl">Item circulation alerts</a></dt>
115
                        <dt><a href="/cgi-bin/koha/admin/item_circulation_alerts.pl">Item circulation alerts</a></dt>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/float_limits.tt (-2 / +3 lines)
Lines 38-44 Link Here
38
38
39
<div class="main container-fluid">
39
<div class="main container-fluid">
40
    <div class="row">
40
    <div class="row">
41
        <div class="col-sm-10 col-sm-push-2">
41
        <div class="col-sm-10 order-sm-1 col-sm-push-2">
42
            <main>
42
            <main>
43
                <h1 class="parameters"> Library float limits </h1>
43
                <h1 class="parameters"> Library float limits </h1>
44
44
Lines 53-59 Link Here
53
                [% END %]
53
                [% END %]
54
54
55
                <form method="post" action="/cgi-bin/koha/admin/float_limits.pl" id="float_limit_form">
55
                <form method="post" action="/cgi-bin/koha/admin/float_limits.pl" id="float_limit_form">
56
                    <input type="hidden" name="op" value="set_float_limits" />
56
                    [% INCLUDE 'csrf-token.inc' %]
57
                    <input type="hidden" name="op" value="cud-set_float_limits" />
57
                    <fieldset id="float_limits">
58
                    <fieldset id="float_limits">
58
                        <div class="help">
59
                        <div class="help">
59
                            <p>Specify the total number of items per itemtype that are allowed to float at each library.</p>
60
                            <p>Specify the total number of items per itemtype that are allowed to float at each library.</p>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt (+2 lines)
Lines 120-125 Link Here
120
                <p>
120
                <p>
121
                    [%- SWITCH trigger -%]
121
                    [%- SWITCH trigger -%]
122
122
123
                    [%- CASE 'LibraryFloatLimit' -%]
124
                        <span>Library has exceeded float limit for this item type</span>
123
                    [%- CASE 'Manual' -%]
125
                    [%- CASE 'Manual' -%]
124
                        <span>Manual</span>
126
                        <span>Manual</span>
125
                    [%- CASE 'StockrotationAdvance' -%]
127
                    [%- CASE 'StockrotationAdvance' -%]
(-)a/t/db_dependent/Koha/Library/FloatLimits.t (-8 / +1 lines)
Lines 19-25 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 7;
22
use Test::More tests => 6;
23
23
24
use Koha::Database;
24
use Koha::Database;
25
use C4::Circulation qw(CreateBranchTransferLimit);
25
use C4::Circulation qw(CreateBranchTransferLimit);
Lines 127-138 CreateBranchTransferLimit( $to, $from, $code ); Link Here
127
is( C4::Circulation::IsBranchTransferAllowed( $to, $from, $code ), 0, "Transfer to best library is no longer allowed" );
127
is( C4::Circulation::IsBranchTransferAllowed( $to, $from, $code ), 0, "Transfer to best library is no longer allowed" );
128
say "C4::Circulation::IsBranchTransferAllowed( $to, $from, $code )";
128
say "C4::Circulation::IsBranchTransferAllowed( $to, $from, $code )";
129
129
130
is(
131
    Koha::Library::FloatLimits->lowest_ratio_library( $item, $library1->{branchcode} )->branchcode,
132
    $library2->{branchcode},
133
    "Correct library selected for float limit transfer when best cannot be used"
134
);
135
136
subtest 'onloan items excluded from ratio calculation' => sub {
130
subtest 'onloan items excluded from ratio calculation' => sub {
137
    plan tests => 5;
131
    plan tests => 5;
138
132
139
- 

Return to bug 28530