Bugzilla – Attachment 44745 Details for
Bug 14998
Remove C4::Dates from installer and maintenance folders
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14998 - Remove C4::Dates from installer and maintenance folders
Bug-14998---Remove-C4Dates-from-installer-and-main.patch (text/plain), 4.19 KB, created by
Jonathan Druart
on 2015-11-11 12:43:58 UTC
(
hide
)
Description:
Bug 14998 - Remove C4::Dates from installer and maintenance folders
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2015-11-11 12:43:58 UTC
Size:
4.19 KB
patch
obsolete
>From 5b00ec77cd978959fbb8db1d25adcf610114e0f1 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Marc=20V=C3=A9ron?= <veron@veron.ch> >Date: Sat, 10 Oct 2015 11:38:20 +0200 >Subject: [PATCH] Bug 14998 - Remove C4::Dates from installer and maintenance > folders > >- installer/data/mysql/updatedatabase.pl >- misc/maintenance/fix_accountlines_date.pl > >To test for updatedatabase.pl > >- perl installer/data/mysql/updatedatabase.pl >- review code. Difficult to test, because the code affects > $DBversion = '3.03.00.035' > >To test for misc/maintenance/fix_accountlines_date.pl > - review code > - The file seems to be a file used for an update, could it be obsolete? > If yes, remove it in a follow-up > >Signed-off-by: Frederic Demians <f.demians@tamil.fr> > Code OK. Tested updatedatabase.pl with an old DB backup: OK. > fix_accountlines_date.pl still working after the patch. Could be removed from > master IMO. > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > installer/data/mysql/updatedatabase.pl | 6 +++--- > misc/maintenance/fix_accountlines_date.pl | 14 +++++++------- > 2 files changed, 10 insertions(+), 10 deletions(-) > >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index b66371a..79f6062 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -36,9 +36,9 @@ use Getopt::Long; > # Koha modules > use C4::Context; > use C4::Installer; >-use C4::Dates; > use Koha::Database; > use Koha; >+use Koha::DateUtils; > > use MARC::Record; > use MARC::File::XML ( BinaryEncoding => 'utf8' ); >@@ -4170,10 +4170,10 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { > $dbh->do("ALTER TABLE `issuingrules` ADD hardduedatecompare tinyint NOT NULL default 0 AFTER hardduedate"); > my $duedate; > if (C4::Context->preference("globalDueDate")) { >- $duedate = C4::Dates::format_date_in_iso(C4::Context->preference("globalDueDate")); >+ $duedate = eval { output_pref( { dt => dt_from_string( C4::Context->preference("globalDueDate") ), dateonly => 1, dateformat => 'iso' } ); }; > $dbh->do("UPDATE `issuingrules` SET hardduedate = '$duedate', hardduedatecompare = 0"); > } elsif (C4::Context->preference("ceilingDueDate")) { >- $duedate = C4::Dates::format_date_in_iso(C4::Context->preference("ceilingDueDate")); >+ $duedate = eval { output_pref( { dt => dt_from_string( C4::Context->preference("ceilingDueDate") ), dateonly => 1, dateformat => 'iso' } ); }; > $dbh->do("UPDATE `issuingrules` SET hardduedate = '$duedate', hardduedatecompare = -1"); > } > $dbh->do("DELETE FROM `systempreferences` WHERE variable = 'globalDueDate' OR variable = 'ceilingDueDate'"); >diff --git a/misc/maintenance/fix_accountlines_date.pl b/misc/maintenance/fix_accountlines_date.pl >index 896edfa..e0c97f6 100755 >--- a/misc/maintenance/fix_accountlines_date.pl >+++ b/misc/maintenance/fix_accountlines_date.pl >@@ -27,9 +27,9 @@ BEGIN { > } > > use C4::Context; >-use C4::Dates; > use Getopt::Long; > use Pod::Usage; >+use Koha::DateUtils; > > =head1 NAME > >@@ -146,16 +146,16 @@ while (my $accountline = $sth->fetchrow_hashref) { > > if ($mode eq 'us') { > if ($description =~ /$US_DATE/) { # mm/dd/yyyy >- my $date = C4::Dates->new($1, 'us'); >- print "Converting $1 (us) to " . $date->output() . "\n" if $DEBUG; >- $description =~ s/$US_DATE/$date->output()/; >+ my $date = eval { output_pref( { dt => dt_from_string( $1 ), dateonly => 1, dateformat => 'us' } ); }; >+ print "Converting $1 (us) to " . $date . "\n" if $DEBUG;i >+ $description =~ s/$US_DATE/$date/; > $updated = 1; > } > } elsif ($mode eq 'metric') { > if ($description =~ /$METRIC_DATE/) { # dd/mm/yyyy >- my $date = C4::Dates->new($1, 'metric'); >- print "Converting $1 (metric) to " . $date->output() . "\n" if $DEBUG; >- $description =~ s/$METRIC_DATE/$date->output()/; >+ my $date = eval { output_pref( { dt => dt_from_string( $1 ), dateonly => 1, dateformat => 'metric' } ); }; >+ print "Converting $1 (metric) to " . $date . "\n" if $DEBUG; >+ $description =~ s/$METRIC_DATE/$date/; > $updated = 2; > } > } >-- >2.1.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 14998
:
43316
|
44092
|
44415
| 44745 |
44746