[Koha-patches] [PATCH] MT3212 : members modification wipeout dateexpiry

Henri-Damien LAURENT henridamien.laurent at biblibre.com
Wed Apr 7 15:01:22 CEST 2010


Members modification when not in Library information mode would wipe out dateexpiry information

Signed-off-by: Henri-Damien LAURENT <henridamien.laurent at biblibre.com>
---
 members/memberentry.pl |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/members/memberentry.pl b/members/memberentry.pl
index 8aff67a..c99dcb9 100755
--- a/members/memberentry.pl
+++ b/members/memberentry.pl
@@ -130,6 +130,7 @@ if ($op eq 'insert' || $op eq 'modify' || $op eq 'save') {
     my $syspref = $dateobject->regexp();		# same syspref format for all 3 dates
     my $iso     = $dateobject->regexp('iso');	#
     foreach (qw(dateenrolled dateexpiry dateofbirth)) {
+        next unless exists $newdata{$_};
         my $userdate = $newdata{$_} or next;
         if ($userdate =~ /$syspref/) {
             $newdata{$_} = format_date_in_iso($userdate);	# if they match syspref format, then convert to ISO
@@ -274,7 +275,7 @@ if ($op eq 'save' || $op eq 'insert'){
 }
 
 if ($op eq 'modify' || $op eq 'insert' || $op eq 'save' ){
-    unless ($newdata{'dateexpiry'}){
+    if (exists ($newdata{'dateexpiry'}) && !($newdata{'dateexpiry'})){
         my $arg2 = $newdata{'dateenrolled'} || C4::Dates->today('iso');
         $newdata{'dateexpiry'} = GetExpiryDate($newdata{'categorycode'},$arg2);
     }
@@ -373,8 +374,6 @@ if (C4::Context->preference("IndependantBranches")) {
     }
 }
 if ($op eq 'add'){
-    my $arg2 = $newdata{'dateenrolled'} || C4::Dates->today('iso');
-    $data{'dateexpiry'} = GetExpiryDate($newdata{'categorycode'},$arg2);
     $template->param( updtype => 'I', step_1=>1, step_2=>1, step_3=>1, step_4=>1, step_5 => 1, step_6 => 1);
 }
 if ($op eq "modify")  {
-- 
1.6.3.3




More information about the Koha-patches mailing list