Bugzilla – Attachment 170698 Details for
Bug 31143
We should attempt to fix/identify all cases where '0000-00-00' may still remain in the database
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31143: Work around subtracting datetime if date_of_birth undef
Bug-31143-Work-around-subtracting-datetime-if-date.patch (text/plain), 1.32 KB, created by
David Nind
on 2024-08-26 05:08:57 UTC
(
hide
)
Description:
Bug 31143: Work around subtracting datetime if date_of_birth undef
Filename:
MIME Type:
Creator:
David Nind
Created:
2024-08-26 05:08:57 UTC
Size:
1.32 KB
patch
obsolete
>From e3ce4ff00fddaf6f295eed0b05ad28760086c2bc Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Date: Tue, 6 Aug 2024 09:41:32 +0000 >Subject: [PATCH] Bug 31143: Work around subtracting datetime if date_of_birth > undef > >To test: >1) Run the following SQL: >update borrowers set dateofbirth = '0000-00-00' where borrowernumber = 45; >2) Access the borrower edit page through staff UI: >http://localhost:8081/cgi-bin/koha/members/memberentry.pl?op=edit_form&destination=circ&borrowernumber=45 >3) Notice you get an error >4) Run the script: >perl misc/maintenance/search_for_data_inconsistencies.pl >5) Notice you get an error >6) Apply patch restart plack and repeat -> no errors > >This is not perfect but its all I have time for, for now. Follow-ups are welcomed as always. > >Signed-off-by: David Nind <david@davidnind.com> >--- > Koha/Patron.pm | 1 + > 1 file changed, 1 insertion(+) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index 7234a3be5b..0d195e5ee8 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -1527,6 +1527,7 @@ sub get_age { > my $date_of_birth = dt_from_string( $self->dateofbirth, undef, 'floating' ); > my $today = dt_from_string(undef, undef, 'floating')->truncate( to => 'day' ); > >+ return 0 unless $date_of_birth; > return $today->subtract_datetime( $date_of_birth )->years; > } > >-- >2.39.2
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 31143
:
154299
|
154399
|
155964
|
168636
|
168770
|
168775
|
168776
|
170086
|
170697
|
170698
|
171812
|
171813
|
171814
|
171815
|
171816
|
171817
|
171918
|
171976
|
171977
|
172138
|
172139
|
172140
|
172141
|
172143
|
172144
|
172145
|
172146
|
173900