Bug 18421: Add Coce to the staff intranet
[koha.git] / installer / data / mysql / atomicupdate / bug_18421_add_coce_intranet.perl
1 #! /usr/bin/perl
2
3 use Modern::Perl;
4 use C4::Context;
5
6 my $dbh=C4::Context->dbh;
7
8 ################
9 # IntranetCoce #
10 ################
11
12 # validate systempreferences.Coce and save the config for OpacCoce
13 my $current_coce_pref = C4::Context->preference('Coce') || 0;
14
15 # add two new systempreferences in order to have distinct behavior between intranet and OPAC
16 $dbh->do("INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES
17         ('IntranetCoce','0', NULL, 'If on, enables cover retrieval from the configured Coce server in the staff intranet', 'YesNo'),
18         ('OpacCoce','$current_coce_pref', NULL, 'If on, enables cover retrieval from the configured Coce server in the OPAC', 'YesNo')
19         ;") or die "Error applying Bug 18421: error inserting new values into database: ". $dbh->errstr . "\n";
20
21 $dbh->do("DELETE IGNORE FROM systempreferences WHERE variable = 'Coce';")
22     or die "Error applying Bug 18421: error deleting the old syspref 'Coce': ". $dbh->errstr . "\n";
23
24 print "Upgrade to XX.XX done (Bug 18421: Add Coce image cache to the Intranet)\n";