Bugzilla – Attachment 46433 Details for
Bug 15261
Verify if checkout or hold request periods overlap with existing holds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15261: remove Date::Range and Date::Simple dependencies
Bug-15261-remove-DateRange-and-DateSimple-dependen.patch (text/plain), 2.42 KB, created by
Alex Arnaud
on 2016-01-08 14:13:19 UTC
(
hide
)
Description:
Bug 15261: remove Date::Range and Date::Simple dependencies
Filename:
MIME Type:
Creator:
Alex Arnaud
Created:
2016-01-08 14:13:19 UTC
Size:
2.42 KB
patch
obsolete
>From 6fcad17f41a61c608f7005751f0084ac02f7807b Mon Sep 17 00:00:00 2001 >From: Alex Arnaud <alex.arnaud@biblibre.com> >Date: Fri, 18 Dec 2015 15:38:24 +0100 >Subject: [PATCH] Bug 15261: remove Date::Range and Date::Simple dependencies > >--- > C4/Installer/PerlDependencies.pm | 10 ---------- > Koha/DateUtils.pm | 32 +++++++++++++++++++++++++------- > 2 files changed, 25 insertions(+), 17 deletions(-) > >diff --git a/C4/Installer/PerlDependencies.pm b/C4/Installer/PerlDependencies.pm >index c99e651..778e101 100644 >--- a/C4/Installer/PerlDependencies.pm >+++ b/C4/Installer/PerlDependencies.pm >@@ -787,16 +787,6 @@ our $PERL_DEPS = { > 'required' => '0', > 'min_ver' => '0.03', > }, >- 'Date::Range' => { >- 'usage' => 'Compare date range', >- 'required' => '1', >- 'min_ver' => '1.41', >- }, >- 'Date::Simple' => { >- 'usage' => 'Works with Date::Range', >- 'required' => '1', >- 'min_ver' => '3.03', >- } > }; > > 1; >diff --git a/Koha/DateUtils.pm b/Koha/DateUtils.pm >index d0064ca..c02d673 100644 >--- a/Koha/DateUtils.pm >+++ b/Koha/DateUtils.pm >@@ -18,8 +18,6 @@ package Koha::DateUtils; > > use Modern::Perl; > use DateTime; >-use Date::Range; >-use Date::Simple; > use C4::Context; > use Carp; > >@@ -310,11 +308,31 @@ sub format_sqldatetime { > sub date_ranges_overlap { > my ($start1, $end1, $start2, $end2) = @_; > >- my $range1 = Date::Range->new(Date::Simple->new($start1), Date::Simple->new($end1)); >- my $range2 = Date::Range->new(Date::Simple->new($start2), Date::Simple->new($end2)); >- >- if ($range1->overlaps($range2)) { >- return $range1->overlap($range2); >+ $start1 = dt_from_string( $start1, 'iso' ); >+ $end1 = dt_from_string( $end1, 'iso' ); >+ $start2 = dt_from_string( $start2, 'iso' ); >+ $end2 = dt_from_string( $end2, 'iso' ); >+ >+ if ( >+ # Start of range 2 is in the range 1. >+ ( >+ DateTime->compare($start2, $start1) >= 0 >+ && DateTime->compare($start2, $end1) <= 0 >+ ) >+ || >+ # End of range 2 is in the range 1. >+ ( >+ DateTime->compare($end2, $start1) >= 0 >+ && DateTime->compare($end2, $end1) <= 0 >+ ) >+ || >+ # Range 2 start before and end after range 1. >+ ( >+ DateTime->compare($start2, $start1) < 0 >+ && DateTime->compare($end2, $end1) > 0 >+ ) >+ ) { >+ return 1; > } > > return; >-- >1.7.10.4
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 15261
:
45216
|
45833
|
45841
|
46432
|
46433
|
46441
|
46442
|
49001
|
49002
|
49003
|
52704
|
59643
|
61534
|
61539
|
61544
|
67088
|
67094
|
67143
|
68660
|
68661
|
68662
|
68663
|
68664
|
68852
|
68853
|
72956
|
72957
|
76221
|
76222
|
88292
|
88293
|
88297
|
88298
|
92376
|
92377
|
92584
|
92585
|
92664
|
93136
|
94871
|
98383
|
98424
|
98672
|
106944
|
106949
|
120822
|
123405
|
125793
|
125794
|
125795
|
125796
|
131569
|
131570
|
131571
|
131572
|
131573