Lines 1-13
Link Here
|
1 |
$DBversion = 'XXX'; # will be replaced by the RM |
1 |
$DBversion = 'XXX'; # will be replaced by the RM |
2 |
if( CheckVersion( $DBversion ) ) { |
2 |
if ( CheckVersion($DBversion) ) { |
3 |
|
3 |
|
4 |
if( column_exists( 'items', 'paidfor' ) ) { |
4 |
if ( column_exists( 'items', 'paidfor' ) ) { |
5 |
$dbh->do(q|ALTER TABLE items DROP COLUMN paidfor|); |
5 |
my ($count) = $dbh->selectrow_array( |
|
|
6 |
qq| |
7 |
SELECT COUNT(*) |
8 |
FROM items |
9 |
WHERE paidfor IS NOT NULL AND paidfor <> "" |
10 |
| |
11 |
); |
12 |
if ($count) { |
13 |
warn "Warning - Cannot remove column items.paidfor. At least one value exists"; |
14 |
} |
15 |
else { |
16 |
$dbh->do(q|ALTER TABLE items DROP COLUMN paidfor|); |
17 |
$dbh->do(q| |
18 |
DELETE FROM marc_subfield_structure |
19 |
WHERE tagfield = '952' |
20 |
AND tagsubfield = 'x' |
21 |
AND kohafield = 'items.paidfor' |
22 |
|); |
23 |
} |
6 |
} |
24 |
} |
7 |
|
25 |
|
8 |
if ( column_exists( 'deleteditems', 'paidfor' ) ) { |
26 |
if ( column_exists( 'deleteditems', 'paidfor' ) ) { |
9 |
$dbh->do(q|ALTER TABLE deleteditems DROP COLUMN paidfor|); |
27 |
my ($count) = $dbh->selectrow_array( |
|
|
28 |
qq| |
29 |
SELECT COUNT(*) |
30 |
FROM items |
31 |
WHERE paidfor IS NOT NULL AND paidfor <> "" |
32 |
| |
33 |
); |
34 |
if ($count) { |
35 |
warn "Warning - Cannot remove column deleteditems.paidfor. At least one value exists"; |
36 |
} |
37 |
else { |
38 |
$dbh->do(q|ALTER TABLE deleteditems DROP COLUMN paidfor|); |
39 |
} |
10 |
} |
40 |
} |
11 |
|
41 |
|
12 |
NewVersion( $DBversion, 26268, "Remove items.paidfor field"); |
42 |
NewVersion( $DBversion, 26268, "Remove items.paidfor field" ); |
13 |
} |
43 |
} |
14 |
- |
|
|