Merge branch 'new/bug11221'

This commit is contained in:
Galen Charlton 2013-11-19 15:45:22 +00:00
commit 942226d333
2 changed files with 14 additions and 5 deletions

View file

@ -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;

View file

@ -6,7 +6,7 @@
use strict;
use warnings;
use Test::More tests => 22;
use Test::More tests => 23;
use Data::Dumper;
BEGIN {
@ -59,6 +59,7 @@ my %data = (
surname => $SURNAME,
categorycode => $CATEGORYCODE,
branchcode => $BRANCHCODE,
dateofbirth => ''
);
my $addmem=AddMember(%data);
@ -74,6 +75,8 @@ ok ( $member->{firstname} eq $FIRSTNAME &&
, "Got member")
or diag("Mismatching member details: ".Dumper(\%data, $member));
is($member->{dateofbirth}, undef, "Empty dates handled correctly");
$member->{firstname} = $CHANGED_FIRSTNAME;
$member->{email} = $EMAIL;
$member->{ethnicity} = $ETHNICITY;
@ -166,7 +169,7 @@ is ($notice_email, $EMAIL, "GetNoticeEmailAddress returns correct value when Aut
C4::Context->set_preference( 'AutoEmailPrimaryAddress', 'emailpro' );
C4::Context->clear_syspref_cache();
my $notice_email = GetNoticeEmailAddress($member->{'borrowernumber'});
$notice_email = GetNoticeEmailAddress($member->{'borrowernumber'});
is ($notice_email, $EMAILPRO, "GetNoticeEmailAddress returns correct value when AutoEmailPrimaryAddress is emailpro");