Lines 36-44
use Getopt::Long;
Link Here
|
36 |
# Koha modules |
36 |
# Koha modules |
37 |
use C4::Context; |
37 |
use C4::Context; |
38 |
use C4::Installer; |
38 |
use C4::Installer; |
39 |
use C4::Dates; |
|
|
40 |
use Koha::Database; |
39 |
use Koha::Database; |
41 |
use Koha; |
40 |
use Koha; |
|
|
41 |
use Koha::DateUtils; |
42 |
|
42 |
|
43 |
use MARC::Record; |
43 |
use MARC::Record; |
44 |
use MARC::File::XML ( BinaryEncoding => 'utf8' ); |
44 |
use MARC::File::XML ( BinaryEncoding => 'utf8' ); |
Lines 4170-4179
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
Link Here
|
4170 |
$dbh->do("ALTER TABLE `issuingrules` ADD hardduedatecompare tinyint NOT NULL default 0 AFTER hardduedate"); |
4170 |
$dbh->do("ALTER TABLE `issuingrules` ADD hardduedatecompare tinyint NOT NULL default 0 AFTER hardduedate"); |
4171 |
my $duedate; |
4171 |
my $duedate; |
4172 |
if (C4::Context->preference("globalDueDate")) { |
4172 |
if (C4::Context->preference("globalDueDate")) { |
4173 |
$duedate = C4::Dates::format_date_in_iso(C4::Context->preference("globalDueDate")); |
4173 |
$duedate = eval { output_pref( { dt => dt_from_string( C4::Context->preference("globalDueDate") ), dateonly => 1, dateformat => 'iso' } ); }; |
4174 |
$dbh->do("UPDATE `issuingrules` SET hardduedate = '$duedate', hardduedatecompare = 0"); |
4174 |
$dbh->do("UPDATE `issuingrules` SET hardduedate = '$duedate', hardduedatecompare = 0"); |
4175 |
} elsif (C4::Context->preference("ceilingDueDate")) { |
4175 |
} elsif (C4::Context->preference("ceilingDueDate")) { |
4176 |
$duedate = C4::Dates::format_date_in_iso(C4::Context->preference("ceilingDueDate")); |
4176 |
$duedate = eval { output_pref( { dt => dt_from_string( C4::Context->preference("ceilingDueDate") ), dateonly => 1, dateformat => 'iso' } ); }; |
4177 |
$dbh->do("UPDATE `issuingrules` SET hardduedate = '$duedate', hardduedatecompare = -1"); |
4177 |
$dbh->do("UPDATE `issuingrules` SET hardduedate = '$duedate', hardduedatecompare = -1"); |
4178 |
} |
4178 |
} |
4179 |
$dbh->do("DELETE FROM `systempreferences` WHERE variable = 'globalDueDate' OR variable = 'ceilingDueDate'"); |
4179 |
$dbh->do("DELETE FROM `systempreferences` WHERE variable = 'globalDueDate' OR variable = 'ceilingDueDate'"); |