From bafc25c9d27ffd90d9bf0c55917ee2fe8c28e8c3 Mon Sep 17 00:00:00 2001 From: Koustubha Kale Date: Wed, 14 Dec 2011 15:48:16 +0530 Subject: [PATCH] Renew membership from expiry date or from current date based on a syspref This patch adds a system preference under Patron -> BorrowerRenewalPeriodBase Using this preference the patch allows renewal of Patron account either from todays date or from existing expiry date in the patrons account. To test : Apply patch; Set System Preference BorrowerRenewalPeriodBase ( under Patron ) to "current membership expiry date"; Renew a patron; You will observe that patrons account expiry date has been calculated from previuos expiry date instead of today's date ( as is the default in Koha prior to this patch ). --- C4/Members.pm | 4 +++- ..._6843_Renew_membership_from_expiry_or_current_date.pl | 9 +++++++++ installer/data/mysql/sysprefs.sql | 1 + .../prog/en/modules/admin/preferences/patrons.pref | 6 ++++++ 4 files changed, 19 insertions(+), 1 deletion(-) create mode 100755 installer/data/mysql/atomicupdate/bug_6843_Renew_membership_from_expiry_or_current_date.pl diff --git a/C4/Members.pm b/C4/Members.pm index 1d7bc42920..b81872c5b5 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -1687,7 +1687,9 @@ sub ExtendMemberSubscriptionTo { my $dbh = C4::Context->dbh; my $borrower = GetMember('borrowernumber'=>$borrowerid); unless ($date){ - $date=POSIX::strftime("%Y-%m-%d",localtime()); + $date = (C4::Context->preference('BorrowerRenewalPeriodBase') eq 'dateexpiry') ? + C4::Dates->new($borrower->{'dateexpiry'}, 'iso')->output("iso") : + C4::Dates->new()->output("iso"); $date = GetExpiryDate( $borrower->{'categorycode'}, $date ); } my $sth = $dbh->do(<dbh; +$dbh->do(<