Permalink
Browse files

[#29635103] Fix for Edit links updating dateexpiry

Using the individual Edit links from the patron details display
was inappropriately updating an existing expiration date; fixes
that so the field is only updated when a new record is created.
  • Loading branch information...
1 parent 9f1a501 commit 269d61c3a5576a517652b000518a4af8c985d46e jwt01 committed with ctfliblime Sep 13, 2012
Showing with 10 additions and 9 deletions.
  1. +10 −9 cgi/members/memberentry.pl
View
@@ -190,17 +190,18 @@ BEGIN
# If dateexpiry was blank - set it to default value, with
# format specified per $syspref for Koha variable "dateformat".
- $newdata{'categorycode'} = $categorycode;
- if (! defined $newdata{'dateexpiry'} or ! $newdata{'dateexpiry'}) {
- my $denr = $newdata{'dateenrolled'} // C4::Dates->today('iso');
-
- if ($denr =~ /$syspref/) {
- # if match syspref format, then convert to ISO
- $denr = format_date_in_iso($denr);
+ unless ($borrower_data->{'dateexpiry'}){
+ $newdata{'categorycode'} = $categorycode;
+ if (! defined $newdata{'dateexpiry'} or ! $newdata{'dateexpiry'}) {
+ my $denr = $newdata{'dateenrolled'} // C4::Dates->today('iso');
+
+ if ($denr =~ /$syspref/) {
+ # if match syspref format, then convert to ISO
+ $denr = format_date_in_iso($denr);
+ }
+ $newdata{dateexpiry} = GetExpiryDate($newdata{categorycode}, $denr);
}
- $newdata{dateexpiry} = GetExpiryDate($newdata{categorycode}, $denr);
}
-
foreach (qw(dateenrolled dateexpiry dateofbirth)) {
my $userdate = $newdata{$_} or next;
if ($userdate =~ /$syspref/) {

0 comments on commit 269d61c

Please sign in to comment.