Lines 22-52
return {
Link Here
|
22 |
|
22 |
|
23 |
say $out "Added new table 'item_bundles'"; |
23 |
say $out "Added new table 'item_bundles'"; |
24 |
|
24 |
|
25 |
my ($lost_val) = $dbh->selectrow_array( "SELECT MAX(CAST(authorised_value AS SIGNED)) FROM authorised_values WHERE category = 'LOST'", {} ); |
25 |
my ($exists) = $dbh->selectrow_array( "SELECT EXISTS(SELECT * FROM authorised_value WHERE lib = 'Missing from bundle'" ); |
26 |
$lost_val++; |
26 |
if ( !$exists ) { |
27 |
|
27 |
my ($lost_val) = $dbh->selectrow_array( "SELECT MAX(CAST(authorised_value AS SIGNED)) FROM authorised_values WHERE category = 'LOST'", {} ); |
28 |
$dbh->do(qq{ |
28 |
$lost_val++; |
29 |
INSERT INTO authorised_values (category,authorised_value,lib) VALUES ('LOST',$lost_val,'Missing from bundle') |
29 |
|
30 |
}); |
30 |
$dbh->do(qq{ |
31 |
say $out "Missing from bundle LOST AV added"; |
31 |
INSERT INTO authorised_values (category,authorised_value,lib) VALUES ('LOST',$lost_val,'Missing from bundle') |
32 |
|
32 |
}); |
33 |
my ($nfl_val) = $dbh->selectrow_array( "SELECT MAX(CAST(authorised_value AS SIGNED)) FROM authorised_values WHERE category = 'NOT_LOAN'", {} ); |
33 |
say $out "Missing from bundle LOST AV added"; |
34 |
$nfl_val++; |
34 |
|
35 |
|
35 |
my ($nfl_val) = $dbh->selectrow_array( "SELECT MAX(CAST(authorised_value AS SIGNED)) FROM authorised_values WHERE category = 'NOT_LOAN'", {} ); |
36 |
$dbh->do(qq{ |
36 |
$nfl_val++; |
37 |
INSERT INTO authorised_values (category,authorised_value,lib) VALUES ('NOT_LOAN',$nfl_val,'Added to bundle') |
37 |
|
38 |
}); |
38 |
$dbh->do(qq{ |
39 |
say $out "Added to bundle NOT_LOAN AV added"; |
39 |
INSERT INTO authorised_values (category,authorised_value,lib) VALUES ('NOT_LOAN',$nfl_val,'Added to bundle') |
40 |
|
40 |
}); |
41 |
$dbh->do(qq{ |
41 |
say $out "Added to bundle NOT_LOAN AV added"; |
42 |
INSERT IGNORE INTO systempreferences( `variable`, `value`, `options`, `explanation`, `type` ) |
42 |
|
43 |
VALUES |
43 |
|
44 |
( 'BundleLostValue', $lost_val, '', 'Sets the LOST AV value that represents "Missing from bundle" as a lost value', 'Free' ), |
44 |
$dbh->do(qq{ |
45 |
( 'BundleNotLoanValue', $nfl_val, '', 'Sets the NOT_LOAN AV value that represents "Added to bundle" as a not for loan value', 'Free') |
45 |
INSERT IGNORE INTO systempreferences( `variable`, `value`, `options`, `explanation`, `type` ) |
46 |
}); |
46 |
VALUES |
47 |
|
47 |
( 'BundleLostValue', $lost_val, '', 'Sets the LOST AV value that represents "Missing from bundle" as a lost value', 'Free' ), |
48 |
say $out "Added new system preference 'BundleLostValue'"; |
48 |
( 'BundleNotLoanValue', $nfl_val, '', 'Sets the NOT_LOAN AV value that represents "Added to bundle" as a not for loan value', 'Free') |
49 |
say $out "Added new system preference 'BundleNotLoanValue'"; |
49 |
}); |
|
|
50 |
|
51 |
say $out "Added new system preference 'BundleLostValue'"; |
52 |
say $out "Added new system preference 'BundleNotLoanValue'"; |
53 |
} |
50 |
|
54 |
|
51 |
if( index_exists( 'return_claims', 'issue_id' ) ) { |
55 |
if( index_exists( 'return_claims', 'issue_id' ) ) { |
52 |
$dbh->do(q{ |
56 |
$dbh->do(q{ |
53 |
- |
|
|