Bugzilla – Attachment 161041 Details for
Bug 35788
Remove Koha::Template::Plugin::Biblio::BookingsCount
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35788: Simplify code
Bug-35788-Simplify-code.patch (text/plain), 1.59 KB, created by
Tomás Cohen Arazi (tcohen)
on 2024-01-15 13:48:01 UTC
(
hide
)
Description:
Bug 35788: Simplify code
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2024-01-15 13:48:01 UTC
Size:
1.59 KB
patch
obsolete
>From 3fbd20d0f4bb3d6f41f367198e3b26c9f26b8607 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 15 Jan 2024 10:43:44 -0300 >Subject: [PATCH] Bug 35788: Simplify code > >We should not load DateUtils and deal with DateTime objects and >formatting when we can use the DB for it, using \'NOW()' should be >enough. > >This patch makes that change. To test: > >1. Apply the previous patches >2. Run: > $ ktd --shell > k$ prove t/db_dependent/Koha/Bookings.t >=> SUCCESS: Tests pass! >3. Apply this patch >4. Repeat 2 >=> SUCCESS: Tests pass! >5. Sign off :-D > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/Bookings.pm | 9 +++------ > 1 file changed, 3 insertions(+), 6 deletions(-) > >diff --git a/Koha/Bookings.pm b/Koha/Bookings.pm >index 03e59d92658..7f73a73ed34 100644 >--- a/Koha/Bookings.pm >+++ b/Koha/Bookings.pm >@@ -20,7 +20,6 @@ package Koha::Bookings; > use Modern::Perl; > > use Koha::Database; >-use Koha::DateUtils qw( dt_from_string ); > use Koha::Booking; > > use base qw(Koha::Objects); >@@ -39,22 +38,20 @@ Koha::Bookings - Koha Booking object set class > > $bookings->filter_by_future; > >- Will return the bookings starting from now. >+Will return the bookings starting from now. > > =cut > > sub filter_by_future { > my ($self) = @_; >- my $now = dt_from_string; >- my $dtf = Koha::Database->new->schema->storage->datetime_parser; >- return $self->search( { start_date => { '>' => $dtf->format_datetime($now) } } ); >+ return $self->search( { start_date => { '>' => \'NOW()' } } ); > } > > =head2 Internal Methods > > =cut > >-=head3 type >+=head3 _type > > =cut > >-- >2.43.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 35788
:
160961
|
161039
|
161040
| 161041