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

(-)a/admin/float_limits.pl (-10 / +13 lines)
Lines 48-68 if ( $op eq 'cud-set_float_limits' ) { Link Here
48
48
49
    $schema->txn_do(
49
    $schema->txn_do(
50
        sub {
50
        sub {
51
            $schema->storage->dbh->do("DELETE FROM library_float_limits");
51
            # Clear all existing float limits using DBIC
52
            Koha::Library::FloatLimits->delete;
52
            foreach my $branch (@branches) {
53
            foreach my $branch (@branches) {
53
                foreach my $itemtype (@itemtypes) {
54
                foreach my $itemtype (@itemtypes) {
54
                    my $branchcode = $branch->id;
55
                    my $branchcode = $branch->id;
55
                    my $itype      = $itemtype->id;
56
                    my $itype      = $itemtype->id;
56
57
57
                    my $limit = $input->param( "limit_" . $branchcode . "_" . $itype );
58
                    my $limit = $input->param( "limit_" . $branchcode . "_" . $itype );
58
                    Koha::Library::FloatLimit->new(
59
59
                        {
60
                    # Validate: must be empty or a non-negative integer
60
                            branchcode  => $branchcode,
61
                    if ( $limit ne q{} && $limit =~ /^\d+$/ && $limit >= 0 ) {
61
                            itemtype    => $itype,
62
                        Koha::Library::FloatLimit->new(
62
                            float_limit => $limit,
63
                            {
63
                        }
64
                                branchcode  => $branchcode,
64
                    )->store()
65
                                itemtype    => $itype,
65
                        if $limit ne q{};    # update or insert
66
                                float_limit => $limit,
67
                            }
68
                        )->store();    # update or insert
69
                    }
66
                }
70
                }
67
            }
71
            }
68
            $template->param( float_limits_updated => 1 );
72
            $template->param( float_limits_updated => 1 );
69
- 

Return to bug 28530