Bugzilla – Attachment 22978 Details for
Bug 11221
New patrons are created with invalid dateofbirth value if field is left empty
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11221: SQLHelper::_filter_hash does not manage well dates
Bug-11221-SQLHelperfilterhash-does-not-manage-well.patch (text/plain), 1.98 KB, created by
Chris Cormack
on 2013-11-17 07:07:57 UTC
(
hide
)
Description:
Bug 11221: SQLHelper::_filter_hash does not manage well dates
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2013-11-17 07:07:57 UTC
Size:
1.98 KB
patch
obsolete
>From 5260e18320f3dc14cc7875b801b6a32377bfc64d Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Tue, 12 Nov 2013 15:07:54 +0100 >Subject: [PATCH] Bug 11221: SQLHelper::_filter_hash does not manage well dates > >The default values for date fields is undef, so if a date field contains >an empty string, we should insert NULL in the DB. >The format_date_in_iso routine should be only called if a date is >defined, is not equal to an empty string and does not match the iso >regex. > >Partial test plan: >1. Create a new patron. Leave dateofbirth empty. >2. Save the record. >3. Open the record for editing. >4. Save the record without making changes. >5. Koha gives no error. > >Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> >--- > C4/SQLHelper.pm | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > >diff --git a/C4/SQLHelper.pm b/C4/SQLHelper.pm >index f1fa7b5..b867094 100644 >--- a/C4/SQLHelper.pm >+++ b/C4/SQLHelper.pm >@@ -404,9 +404,15 @@ sub _filter_hash{ > my $elements=join "|",@columns_filtered; > foreach my $field (grep {/\b($elements)\b/} keys %$filter_input){ > ## supposed to be a hash of simple values, hashes of arrays could be implemented >- $filter_input->{$field}=format_date_in_iso($filter_input->{$field}) >- if $columns->{$field}{Type}=~/date/ && >- ($filter_input->{$field} && $filter_input->{$field} !~C4::Dates->regexp("iso")); >+ if ( $columns->{$field}{Type}=~/date/ ) { >+ if ( defined $filter_input->{$field} ) { >+ if ( $filter_input->{$field} eq q{} ) { >+ $filter_input->{$field} = undef; >+ } elsif ( $filter_input->{$field} !~ C4::Dates->regexp("iso") ) { >+ $filter_input->{$field} = format_date_in_iso($filter_input->{$field}); >+ } >+ } >+ } > my ($tmpkeys, $localvalues)=_Process_Operands($filter_input->{$field},"$tablename.$field",$searchtype,$columns); > if (@$tmpkeys){ > push @values, @$localvalues; >-- >1.8.4.3
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 11221
:
22879
|
22978
|
22979
|
22993
|
22994