Commit f4a74ee5 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Fix for adding institution membership expiry date

parent 286ce9ea
...@@ -99,7 +99,7 @@ class Institution { ...@@ -99,7 +99,7 @@ class Institution {
} }
} elseif ($name == 'maxuseraccounts') { } elseif ($name == 'maxuseraccounts') {
if (!empty($value) && (!is_numeric($value) || $value < 0 || $value > 9999999999)) { if (!empty($value) && (!is_numeric($value) || $value < 0 || $value > 9999999999)) {
throw new ParamOutOfRangeException("'defaultmembershipperiod' should be a number between 1 and 9,999,999,999"); throw new ParamOutOfRangeException("'maxuseraccounts' should be a number between 1 and 9,999,999,999");
} }
} }
$this->members[$name] = $value; $this->members[$name] = $value;
...@@ -238,8 +238,9 @@ class Institution { ...@@ -238,8 +238,9 @@ class Institution {
$userinst->usr = $user->id; $userinst->usr = $user->id;
$now = time(); $now = time();
$userinst->ctime = db_format_timestamp($now); $userinst->ctime = db_format_timestamp($now);
if (!empty($this->defaultmembershipperiod)) { $defaultexpiry = $this->defaultmembershipperiod;
$userinst->expiry = db_format_timestamp($now + $this->defaultmembershipperiod); if (!empty($defaultexpiry)) {
$userinst->expiry = db_format_timestamp($now + $defaultexpiry);
} }
$message = (object) array( $message = (object) array(
'users' => array($user->id), 'users' => array($user->id),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment