Bugzilla – Attachment 144922 Details for
Bug 32505
Cannot search by dateofbirth in specified dateformat
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32505: Restore patron search by formatted dob
Bug-32505-Restore-patron-search-by-formatted-dob.patch (text/plain), 2.30 KB, created by
Jonathan Druart
on 2023-01-02 16:19:48 UTC
(
hide
)
Description:
Bug 32505: Restore patron search by formatted dob
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-01-02 16:19:48 UTC
Size:
2.30 KB
patch
obsolete
>From 5f09b598cac3110a082096c684d5330b4f1fa514 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 2 Jan 2023 17:12:40 +0100 >Subject: [PATCH] Bug 32505: Restore patron search by formatted dob > >Prior to the rewrite of the patron searches (bug 30063 and friends) it >was possible to search for a patron using their date of birth, formatted >following the dateformat syspref. > >Now it only works if the date is iso formatted. > >This patch is providing a fix to restore the behaviour, but does not >make it consistent. Only searching patrons by date of birth is fixed >here, when we actually want to fix the problem for the REST API DT >wrapper instead. > >Test plan: >Search for patrons given their date of birth. You need to select "date >of birth" in the "Search field" dropdown, or set it in >DefaultPatronSearchFields. > >Note that the column filtering is still not working, but I guess it was >the case already in older versions. Ideally we will need to have a >"datatype" attribute passed to the the 'th' and retrieved from >datatables.js to add this same trick and build the query appropriately. >--- > .../intranet-tmpl/prog/en/includes/patron-search.inc | 8 ++++++++ > 1 file changed, 8 insertions(+) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc >index de4ba90c0de..b5794d02e66 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc >@@ -328,6 +328,14 @@ > let sub_or = []; > search_fields.split(',').forEach(function(attr,ii){ > sub_or.push({["me."+attr]:{"like":(search_type == "contain" ? "%" : "" ) + pattern + "%"}}); >+ if ( attr == 'dateofbirth' ) { >+ try { >+ let d = $date_to_rfc3339(pattern); >+ sub_or.push({["me."+attr]:d}); >+ } catch { >+ // Hide the warning if the date is not correct >+ } >+ } > }); > subquery_and.push(sub_or); > }); >-- >2.25.1
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 32505
:
144922
|
144937
|
145096
|
145135
|
147377