Skip to content

Commit 8eb9c24

Browse files
committed
Fix insert circ rules since bug 18925
1 parent 576054e commit 8eb9c24

1 file changed

Lines changed: 47 additions & 27 deletions

File tree

insert_data.pl

Lines changed: 47 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -116,33 +116,53 @@ sub insert_default_circ_rule {
116116
say "Inserting default circ rule..."
117117
if $verbose;
118118
my $dbh = C4::Context->dbh;
119-
$dbh->do(
120-
q|INSERT INTO issuingrules (
121-
categorycode, itemtype, branchcode,
122-
maxissueqty
123-
| . ( $VERSION >= '32100035' ? ', maxonsiteissueqty' : '' ) . q|
124-
, issuelength
125-
, lengthunit
126-
, renewalperiod
127-
, reservesallowed
128-
| . ( $VERSION >= '160600018' ? ', holds_per_record' : '' ) . q|
129-
| . ( $VERSION >= '31900017' ? ', onshelfholds' : '' ) . q|
130-
| . ( $VERSION >= '31900017' ? ', opacitemholds' : '' ) . q|
131-
| . ( $VERSION >= '160600037' ? ', article_requests' : '' ) . q|
132-
) VALUES (
133-
'*', '*', '*',
134-
5
135-
| . ( $VERSION >= '32100035' ? ', 5' : '' ) . q|
136-
, 5
137-
, 'days'
138-
, 5
139-
, 5
140-
| . ( $VERSION >= '160600018' ? ', 2 ' : '' ) . q|
141-
| . ( $VERSION >= '31900017' ? ', 1 ' : '' ) . q|
142-
| . ( $VERSION >= '31900017' ? ', "Y" ' : '' ) . q|
143-
| . ( $VERSION >= '160600037' ? ', "yes" ' : '' ) . q|
144-
)|
145-
);
119+
if ( $VERSION >= '181200020' ) {
120+
my $sth = $dbh->prepare (
121+
q|INSERT INTO circulation_rules (
122+
categorycode, itemtype, branchcode, rule_name, rule_value
123+
) VALUES (
124+
NULL, NULL, NULL, ?, ?
125+
)|
126+
);
127+
$sth->execute('maxissueqty', 5);
128+
$sth->execute('maxonsiteissueqty', 5);
129+
$sth->execute('issuelength', 5);
130+
$sth->execute('lengthunit', 'days');
131+
$sth->execute('renewalperiod', 5);
132+
$sth->execute('reservesallowed', 5);
133+
$sth->execute('holds_per_record', 2);
134+
$sth->execute('onshelfholds', 1);
135+
$sth->execute('opacitemholds', 'Y');
136+
$sth->execute('article_requests', 'yes');
137+
} else {
138+
$dbh->do(
139+
q|INSERT INTO issuingrules (
140+
categorycode, itemtype, branchcode,
141+
maxissueqty
142+
| . ( $VERSION >= '32100035' ? ', maxonsiteissueqty' : '' ) . q|
143+
, issuelength
144+
, lengthunit
145+
, renewalperiod
146+
, reservesallowed
147+
| . ( $VERSION >= '160600018' ? ', holds_per_record' : '' ) . q|
148+
| . ( $VERSION >= '31900017' ? ', onshelfholds' : '' ) . q|
149+
| . ( $VERSION >= '31900017' ? ', opacitemholds' : '' ) . q|
150+
| . ( $VERSION >= '160600037' ? ', article_requests' : '' ) . q|
151+
) VALUES (
152+
'*', '*', '*',
153+
5
154+
| . ( $VERSION >= '32100035' ? ', 5' : '' ) . q|
155+
, 5
156+
, 'days'
157+
, 5
158+
, 5
159+
| . ( $VERSION >= '160600018' ? ', 2 ' : '' ) . q|
160+
| . ( $VERSION >= '31900017' ? ', 1 ' : '' ) . q|
161+
| . ( $VERSION >= '31900017' ? ', "Y" ' : '' ) . q|
162+
| . ( $VERSION >= '160600037' ? ', "yes" ' : '' ) . q|
163+
)|
164+
);
165+
}
146166
}
147167

148168
sub configure_plugins {

0 commit comments

Comments
 (0)