Lines 22-42
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 ($lost_val) = $dbh->selectrow_array( |
26 |
$lost_val++; |
26 |
"SELECT CAST(authorised_value AS SIGNED) FROM authorised_values WHERE category = 'LOST' AND lib = 'Missing from bundle' LIMIT 1", |
|
|
27 |
{} |
28 |
); |
27 |
|
29 |
|
28 |
$dbh->do(qq{ |
30 |
if ( !$lost_val ) { |
29 |
INSERT INTO authorised_values (category,authorised_value,lib) VALUES ('LOST',$lost_val,'Missing from bundle') |
|
|
30 |
}); |
31 |
say $out "Missing from bundle LOST AV added"; |
32 |
|
31 |
|
33 |
my ($nfl_val) = $dbh->selectrow_array( "SELECT MAX(CAST(authorised_value AS SIGNED)) FROM authorised_values WHERE category = 'NOT_LOAN'", {} ); |
32 |
($lost_val) = $dbh->selectrow_array( |
34 |
$nfl_val++; |
33 |
"SELECT MAX(CAST(authorised_value AS SIGNED)) FROM authorised_values WHERE category = 'LOST'", {} ); |
|
|
34 |
$lost_val++; |
35 |
|
35 |
|
36 |
$dbh->do(qq{ |
36 |
$dbh->do( |
37 |
INSERT INTO authorised_values (category,authorised_value,lib) VALUES ('NOT_LOAN',$nfl_val,'Added to bundle') |
37 |
qq{) |
38 |
}); |
38 |
INSERT INTO authorised_values (category,authorised_value,lib) VALUES ('LOST',$lost_val,'Missing from bundle') |
39 |
say $out "Added to bundle NOT_LOAN AV added"; |
39 |
} |
|
|
40 |
); |
41 |
say $out "Missing from bundle LOST AV added"; |
42 |
} |
43 |
|
44 |
my ($nfl_val) = $dbh->selectrow_array( |
45 |
"SELECT CAST(authorised_value AS SIGNED) FROM authorised_values WHERE category = 'NOT_LOAN' AND lib = 'Added to bundle' LIMIT 1", |
46 |
{} |
47 |
); |
48 |
|
49 |
if ( !$nfl_val ) { |
50 |
|
51 |
($nfl_val) = $dbh->selectrow_array( |
52 |
"SELECT MAX(CAST(authorised_value AS SIGNED)) FROM authorised_values WHERE category = 'NOT_LOAN'", {} ); |
53 |
$nfl_val++; |
54 |
|
55 |
$dbh->do( |
56 |
qq{ |
57 |
INSERT INTO authorised_values (category,authorised_value,lib) VALUES ('NOT_LOAN',$nfl_val,'Added to bundle') |
58 |
} |
59 |
); |
60 |
say $out "Added to bundle NOT_LOAN AV added"; |
61 |
} |
40 |
|
62 |
|
41 |
$dbh->do(qq{ |
63 |
$dbh->do(qq{ |
42 |
INSERT IGNORE INTO systempreferences( `variable`, `value`, `options`, `explanation`, `type` ) |
64 |
INSERT IGNORE INTO systempreferences( `variable`, `value`, `options`, `explanation`, `type` ) |
43 |
- |
|
|