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

(-)a/Koha/Schema/Result/LibraryFloatLimit.pm (+123 lines)
Line 0 Link Here
1
use utf8;
2
3
package Koha::Schema::Result::LibraryFloatLimit;
4
5
# Created by DBIx::Class::Schema::Loader
6
# DO NOT MODIFY THE FIRST PART OF THIS FILE
7
8
=head1 NAME
9
10
Koha::Schema::Result::LibraryFloatLimit
11
12
=cut
13
14
use strict;
15
use warnings;
16
17
use base 'DBIx::Class::Core';
18
19
=head1 TABLE: C<library_float_limits>
20
21
=cut
22
23
__PACKAGE__->table("library_float_limits");
24
25
=head1 ACCESSORS
26
27
=head2 branchcode
28
29
  data_type: 'varchar'
30
  is_foreign_key: 1
31
  is_nullable: 0
32
  size: 10
33
34
=head2 itemtype
35
36
  data_type: 'varchar'
37
  is_foreign_key: 1
38
  is_nullable: 0
39
  size: 10
40
41
=head2 float_limit
42
43
  data_type: 'integer'
44
  is_nullable: 1
45
46
=cut
47
48
__PACKAGE__->add_columns(
49
    "branchcode",
50
    { data_type => "varchar", is_foreign_key => 1, is_nullable => 0, size => 10 },
51
    "itemtype",
52
    { data_type => "varchar", is_foreign_key => 1, is_nullable => 0, size => 10 },
53
    "float_limit",
54
    { data_type => "integer", is_nullable => 1 },
55
);
56
57
=head1 PRIMARY KEY
58
59
=over 4
60
61
=item * L</branchcode>
62
63
=item * L</itemtype>
64
65
=back
66
67
=cut
68
69
__PACKAGE__->set_primary_key( "branchcode", "itemtype" );
70
71
=head1 RELATIONS
72
73
=head2 branchcode
74
75
Type: belongs_to
76
77
Related object: L<Koha::Schema::Result::Branch>
78
79
=cut
80
81
__PACKAGE__->belongs_to(
82
    "branchcode",
83
    "Koha::Schema::Result::Branch",
84
    { branchcode    => "branchcode" },
85
    { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
86
);
87
88
=head2 itemtype
89
90
Type: belongs_to
91
92
Related object: L<Koha::Schema::Result::Itemtype>
93
94
=cut
95
96
__PACKAGE__->belongs_to(
97
    "itemtype",
98
    "Koha::Schema::Result::Itemtype",
99
    { itemtype      => "itemtype" },
100
    { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
101
);
102
103
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-12-19 18:47:35
104
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:AnpZIyNq9oO1vmDSXmQEMQ
105
106
=head2 koha_object_class
107
108
=cut
109
110
sub koha_object_class {
111
    'Koha::Library::FloatLimit';
112
}
113
114
=head2 koha_objects_class
115
116
=cut
117
118
sub koha_objects_class {
119
    'Koha::Library::FloatLimits';
120
}
121
122
# You can replace this text with custom code or comments, and it will be preserved on regeneration
123
1;
(-)a/installer/data/mysql/atomicupdate/bug_28530.pl (+40 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number  => "28530",
5
    description => "Add library float limits",
6
    up          => sub {
7
        my ($args) = @_;
8
        my ( $dbh, $out ) = @$args{qw(dbh out)};
9
10
        $dbh->do(
11
            q{
12
            ALTER TABLE branchtransfers MODIFY COLUMN `reason` enum('Manual','StockrotationAdvance','StockrotationRepatriation','ReturnToHome','ReturnToHolding','RotatingCollection','Reserve','LostReserve','CancelReserve','TransferCancellation','Recall','RecallCancellation', 'LibraryFloatLimit') DEFAULT NULL COMMENT 'what triggered the transfer'
13
        }
14
        );
15
16
        $dbh->do(
17
            q{
18
                INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
19
                ('UseLibraryFloatLimits', '0', '', 'Enables library float limits', 'YesNo');
20
            }
21
        );
22
        say $out "Added new system preference 'UseLibraryFloatLimits'";
23
24
        unless ( TableExists('library_float_limits') ) {
25
            $dbh->do(
26
                q{
27
                CREATE TABLE `library_float_limits` (
28
                `branchcode` varchar(10) NOT NULL,
29
                `itemtype` varchar(10) NOT NULL,
30
                `float_limit` int(11) NULL DEFAULT NULL,
31
                PRIMARY KEY (`branchcode`,`itemtype`),
32
                CONSTRAINT `library_float_limits_ibfk_bc` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
33
                CONSTRAINT `library_float_limits_ibfk_it` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE
34
                ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
35
            }
36
            );
37
        }
38
        say $out "Added new table 'library_float_limits'";
39
    },
40
};
(-)a/installer/data/mysql/kohastructure.sql (-1 / +14 lines)
Lines 1714-1720 CREATE TABLE `branchtransfers` ( Link Here
1714
  `datecancelled` datetime DEFAULT NULL COMMENT 'the date the transfer was cancelled',
1714
  `datecancelled` datetime DEFAULT NULL COMMENT 'the date the transfer was cancelled',
1715
  `tobranch` varchar(10) NOT NULL DEFAULT '' COMMENT 'the branch the transfer was going to',
1715
  `tobranch` varchar(10) NOT NULL DEFAULT '' COMMENT 'the branch the transfer was going to',
1716
  `comments` longtext DEFAULT NULL COMMENT 'any comments related to the transfer',
1716
  `comments` longtext DEFAULT NULL COMMENT 'any comments related to the transfer',
1717
  `reason` enum('Manual','StockrotationAdvance','StockrotationRepatriation','ReturnToHome','ReturnToHolding','RotatingCollection','Reserve','LostReserve','CancelReserve','TransferCancellation','Recall','RecallCancellation') DEFAULT NULL COMMENT 'what triggered the transfer',
1717
  `reason` enum('Manual','StockrotationAdvance','StockrotationRepatriation','ReturnToHome','ReturnToHolding','RotatingCollection','Reserve','LostReserve','CancelReserve','TransferCancellation','Recall','RecallCancellation','LibraryFloatLimit') DEFAULT NULL COMMENT 'what triggered the transfer',
1718
  `cancellation_reason` enum('Manual','StockrotationAdvance','StockrotationRepatriation','ReturnToHome','ReturnToHolding','RotatingCollection','Reserve','LostReserve','CancelReserve','ItemLost','WrongTransfer','RecallCancellation') DEFAULT NULL COMMENT 'what triggered the transfer cancellation',
1718
  `cancellation_reason` enum('Manual','StockrotationAdvance','StockrotationRepatriation','ReturnToHome','ReturnToHolding','RotatingCollection','Reserve','LostReserve','CancelReserve','ItemLost','WrongTransfer','RecallCancellation') DEFAULT NULL COMMENT 'what triggered the transfer cancellation',
1719
  PRIMARY KEY (`branchtransfer_id`),
1719
  PRIMARY KEY (`branchtransfer_id`),
1720
  KEY `frombranch` (`frombranch`),
1720
  KEY `frombranch` (`frombranch`),
Lines 6578-6583 CREATE TABLE `transport_cost` ( Link Here
6578
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6578
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6579
/*!40101 SET character_set_client = @saved_cs_client */;
6579
/*!40101 SET character_set_client = @saved_cs_client */;
6580
6580
6581
DROP TABLE IF EXISTS `library_float_limits`;
6582
/*!40101 SET @saved_cs_client     = @@character_set_client */;
6583
/*!40101 SET character_set_client = utf8 */;
6584
CREATE TABLE `library_float_limits` (
6585
  `branchcode` varchar(10) NOT NULL,
6586
  `itemtype` varchar(10) NOT NULL,
6587
  `float_limit` int(11) NULL DEFAULT NULL,
6588
  PRIMARY KEY (`branchcode`,`itemtype`),
6589
  CONSTRAINT `library_float_limits_ibfk_bc` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
6590
  CONSTRAINT `library_float_limits_ibfk_it` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE
6591
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6592
/*!40101 SET character_set_client = @saved_cs_client */;
6593
6581
--
6594
--
6582
-- Table structure for table `uploaded_files`
6595
-- Table structure for table `uploaded_files`
6583
--
6596
--
(-)a/installer/data/mysql/mandatory/sysprefs.sql (+1 lines)
Lines 869-874 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
869
('useDefaultReplacementCost', '0', NULL, 'default replacement cost defined in item type', 'YesNo'),
869
('useDefaultReplacementCost', '0', NULL, 'default replacement cost defined in item type', 'YesNo'),
870
('useDischarge','0','','Allows librarians to discharge borrowers and borrowers to request a discharge','YesNo'),
870
('useDischarge','0','','Allows librarians to discharge borrowers and borrowers to request a discharge','YesNo'),
871
('UseICUStyleQuotes','0','1','Tell Koha whether to use ICU style quotes ({) or default (") when tracing subjects .','YesNo'),
871
('UseICUStyleQuotes','0','1','Tell Koha whether to use ICU style quotes ({) or default (") when tracing subjects .','YesNo'),
872
('UseLibraryFloatLimits', '0', '', 'Enables library float limits', 'YesNo'),
872
('UseLocationAsAQInSIP', '0', '', 'Use permanent_location instead of homebranch for AQ in SIP response', 'YesNo'),
873
('UseLocationAsAQInSIP', '0', '', 'Use permanent_location instead of homebranch for AQ in SIP response', 'YesNo'),
873
('UseOCLCEncodingLevels','0',NULL,'If enabled, include OCLC encoding levels in leader value builder dropdown for position 17.','YesNo'),
874
('UseOCLCEncodingLevels','0',NULL,'If enabled, include OCLC encoding levels in leader value builder dropdown for position 17.','YesNo'),
874
('UseRecalls','0',NULL,'Enable or disable recalls','YesNo'),
875
('UseRecalls','0',NULL,'Enable or disable recalls','YesNo'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (-1 / +6 lines)
Lines 286-291 Circulation: Link Here
286
                  1: Use
286
                  1: Use
287
                  0: "Don't use"
287
                  0: "Don't use"
288
            - the transport cost matrix for calculating optimal holds filling between libraries.
288
            - the transport cost matrix for calculating optimal holds filling between libraries.
289
        -
290
            - pref: UseLibraryFloatLimits
291
              choices:
292
                  1: Use
293
                  0: "Don't use"
294
            - library float limits to determine if an item should be transferred to another library.
289
        -
295
        -
290
            - Use the calendar and circulation rules of
296
            - Use the calendar and circulation rules of
291
            - pref: CircControl
297
            - pref: CircControl
292
- 

Return to bug 28530