Bugzilla – Attachment 42343 Details for
Bug 14717
Prevent 0000-00-00 dates in patron data
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14717: Prevent 0000-00-00 on updating a patron
Bug-14717-Prevent-0000-00-00-on-updating-a-patron.patch (text/plain), 3.81 KB, created by
Jonathan Druart
on 2015-09-03 15:10:05 UTC
(
hide
)
Description:
Bug 14717: Prevent 0000-00-00 on updating a patron
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2015-09-03 15:10:05 UTC
Size:
3.81 KB
patch
obsolete
>From 61115b65dfd5c791f70f06728a50a196a89e2ebb Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 3 Sep 2015 16:03:17 +0100 >Subject: [PATCH] Bug 14717: Prevent 0000-00-00 on updating a patron > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > C4/Members.pm | 1 + > t/db_dependent/Members.t | 26 ++++++++++++++++++++++++-- > 2 files changed, 25 insertions(+), 2 deletions(-) > >diff --git a/C4/Members.pm b/C4/Members.pm >index 0f4aeba..0b8e7d7 100644 >--- a/C4/Members.pm >+++ b/C4/Members.pm >@@ -667,6 +667,7 @@ sub ModMember { > $new_borrower->{dateofbirth} ||= undef if exists $new_borrower->{dateofbirth}; > $new_borrower->{dateenrolled} ||= undef if exists $new_borrower->{dateenrolled}; > $new_borrower->{dateexpiry} ||= undef if exists $new_borrower->{dateexpiry}; >+ $new_borrower->{debarred} ||= undef if exists $new_borrower->{debarred}; > my $rs = $schema->resultset('Borrower')->search({ > borrowernumber => $new_borrower->{borrowernumber}, > }); >diff --git a/t/db_dependent/Members.t b/t/db_dependent/Members.t >index ad9ef7e..b2ebc9c 100755 >--- a/t/db_dependent/Members.t >+++ b/t/db_dependent/Members.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 62; >+use Test::More tests => 74; > use Test::MockModule; > use Data::Dumper; > use C4::Context; >@@ -217,7 +217,9 @@ is( $borrower, undef, 'DelMember should remove the patron' ); > categorycode => "S", > branchcode => "MPL", > dateofbirth => '', >- dateexpiry => '9999-12-31', >+ debarred => '', >+ dateexpiry => '', >+ dateenrolled => '', > ); > # Add a new borrower > my $borrowernumber = AddMember( %data ); >@@ -230,6 +232,26 @@ is( Check_Userid( 'tomasito.none', '' ), 0, > is( Check_Userid( 'tomasitoxxx', '' ), 1, > 'non-existent userid -> unique (blank borrowernumber)' ); > >+$borrower = GetMember( borrowernumber => $borrowernumber ); >+is( $borrower->{dateofbirth}, undef, 'AddMember should undef dateofbirth if empty string is given'); >+is( $borrower->{debarred}, undef, 'AddMember should undef debarred if empty string is given'); >+isnt( $borrower->{dateexpiry}, '0000-00-00', 'AddMember should not set dateexpiry to 0000-00-00 if empty string is given'); >+isnt( $borrower->{dateenrolled}, '0000-00-00', 'AddMember should not set dateenrolled to 0000-00-00 if empty string is given'); >+ >+ModMember( borrowernumber => $borrowernumber, dateofbirth => '', debarred => '', dateexpiry => '', dateenrolled => '' ); >+$borrower = GetMember( borrowernumber => $borrowernumber ); >+is( $borrower->{dateofbirth}, undef, 'ModMember should undef dateofbirth if empty string is given'); >+is( $borrower->{debarred}, undef, 'ModMember should undef debarred if empty string is given'); >+isnt( $borrower->{dateexpiry}, '0000-00-00', 'ModMember should not set dateexpiry to 0000-00-00 if empty string is given'); >+isnt( $borrower->{dateenrolled}, '0000-00-00', 'ModMember should not set dateenrolled to 0000-00-00 if empty string is given'); >+ >+ModMember( borrowernumber => $borrowernumber, dateofbirth => '1970-01-01', debarred => '2042-01-01', dateexpiry => '9999-12-31', dateenrolled => '2015-09-06' ); >+$borrower = GetMember( borrowernumber => $borrowernumber ); >+is( $borrower->{dateofbirth}, '1970-01-01', 'ModMember should correctly set dateofbirth if a valid date is given'); >+is( $borrower->{debarred}, '2042-01-01', 'ModMember should correctly set debarred if a valid date is given'); >+is( $borrower->{dateexpiry}, '9999-12-31', 'ModMember should correctly set dateexpiry if a valid date is given'); >+is( $borrower->{dateenrolled}, '2015-09-06', 'ModMember should correctly set dateenrolled if a valid date is given'); >+ > # Add a new borrower with the same userid but different cardnumber > $data{ cardnumber } = "987654321"; > my $new_borrowernumber = AddMember( %data ); >-- >2.1.0
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 14717
:
41871
|
42331
|
42342
|
42343
|
42344
|
42356
|
42357
|
42358