Bugzilla – Attachment 59172 Details for
Bug 17933
Internal software error when searching patron without birth date
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17933 - Internal software error when searching patron without birth date
Bug-17933---Internal-software-error-when-searching.patch (text/plain), 2.06 KB, created by
Dobrica Pavlinusic
on 2017-01-18 17:14:54 UTC
(
hide
)
Description:
Bug 17933 - Internal software error when searching patron without birth date
Filename:
MIME Type:
Creator:
Dobrica Pavlinusic
Created:
2017-01-18 17:14:54 UTC
Size:
2.06 KB
patch
obsolete
>From e76966ccf6e19873529d391cd8f35853826a0137 Mon Sep 17 00:00:00 2001 >From: Dobrica Pavlinusic <dpavlin@rot13.org> >Date: Wed, 18 Jan 2017 17:12:30 +0100 >Subject: [PATCH] Bug 17933 - Internal software error when searching patron > without birth date > >When patrons don't have date of birth (which is not required) patron >search results on moremember page produce internal server error since we >can't convert MySQL invalid date 0000-00-00 to datetime object and >call strfdate on it. > >Additionally, since we assign dates to template variables and after >than assign whole $data hash to template, later assigment overrides >previous one, so we see birth date field even for patrons which don't >have one. > >This patch fixes both of those problems. > >Test: >1. edit patron and remove it's birth date >2. try to search for it, and verify server error >3. apply patch >4. repeat search for patron and verify that it works and doesn't > have enpty birth date field >--- > Koha/Patron.pm | 3 ++- > members/moremember.pl | 2 +- > 2 files changed, 3 insertions(+), 2 deletions(-) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index 3790884..1b9ece4 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -544,7 +544,8 @@ Return the age of the patron > sub get_age { > my ($self) = @_; > my $today_str = dt_from_string->strftime("%Y-%m-%d"); >- my $dob_str = dt_from_string( $self->dateofbirth )->strftime("%Y-%m-%d"); >+ my $dob_str = dt_from_string( $self->dateofbirth ) || return; >+ $dob_str = $dob_str->strftime("%Y-%m-%d"); > > my ( $dob_y, $dob_m, $dob_d ) = split /-/, $dob_str; > my ( $today_y, $today_m, $today_d ) = split /-/, $today_str; >diff --git a/members/moremember.pl b/members/moremember.pl >index 55b0901..07277d5 100755 >--- a/members/moremember.pl >+++ b/members/moremember.pl >@@ -140,7 +140,7 @@ foreach (qw(dateenrolled dateexpiry dateofbirth)) { > $data->{$_} = ''; > next; > } >- $template->param( $_ => dt_from_string( $userdate ) ); >+ $data->{$_} = dt_from_string( $userdate ); > } > $data->{'IS_ADULT'} = ( $data->{'categorycode'} ne 'I' ); > >-- >2.1.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 17933
:
59172
|
59194
|
59214
|
59215
|
59733
|
59734
|
59735
|
59736
|
60356
|
60357
|
60358