fixed expiry times

This commit is contained in:
Roland Gruber 2008-03-25 19:01:10 +00:00
parent 8c72fe4dfd
commit 714914a845
1 changed files with 8 additions and 4 deletions

View File

@ -134,7 +134,7 @@ class phpGroupwareUser extends baseModule {
$return = array(); $return = array();
if (isset($this->attributes['objectClass']) && in_array('phpgwAccount', $this->attributes['objectClass'])) { if (isset($this->attributes['objectClass']) && in_array('phpgwAccount', $this->attributes['objectClass'])) {
$phpgwAccountExpires = ''; $phpgwAccountExpires = '';
if (isset($this->attributes['phpgwAccountExpires'][0])) { if (isset($this->attributes['phpgwAccountExpires'][0]) && ($this->attributes['phpgwAccountExpires'][0] != "-1")) {
$date = getdate($this->attributes['phpgwAccountExpires'][0]); $date = getdate($this->attributes['phpgwAccountExpires'][0]);
$phpgwAccountExpires = $date['mday'] . '.' . $date['mon'] . '.' . $date['year']; $phpgwAccountExpires = $date['mday'] . '.' . $date['mon'] . '.' . $date['year'];
} }
@ -195,6 +195,7 @@ class phpGroupwareUser extends baseModule {
public function process_attributes() { public function process_attributes() {
if (isset($_POST['form_subpage_phpGroupwareUser_attributes_addObjectClass'])) { if (isset($_POST['form_subpage_phpGroupwareUser_attributes_addObjectClass'])) {
$this->attributes['objectClass'][] = 'phpgwAccount'; $this->attributes['objectClass'][] = 'phpgwAccount';
$this->attributes['phpgwAccountExpires'][0] = "-1";
} }
elseif (isset($_POST['form_subpage_phpGroupwareUser_attributes_remObjectClass'])) { elseif (isset($_POST['form_subpage_phpGroupwareUser_attributes_remObjectClass'])) {
for ($i = 0; $i < sizeof($this->attributes['objectClass']); $i++) { for ($i = 0; $i < sizeof($this->attributes['objectClass']); $i++) {
@ -224,8 +225,8 @@ class phpGroupwareUser extends baseModule {
$text = _('Account expiration date'); $text = _('Account expiration date');
$help = "phpgwAccountExpires"; $help = "phpgwAccountExpires";
} }
$time = 0; $time = time();
if (isset($this->attributes[$attr][0])) { if (isset($this->attributes[$attr][0]) && ($this->attributes[$attr][0] != "-1")) {
$time = $this->attributes[$attr][0]; $time = $this->attributes[$attr][0];
} }
$date = getdate($time); $date = getdate($time);
@ -281,7 +282,7 @@ class phpGroupwareUser extends baseModule {
} }
elseif (strpos($buttonName, '_del') !== false) { elseif (strpos($buttonName, '_del') !== false) {
// remove attribute value // remove attribute value
unset($this->attributes[$attr]); $this->attributes[$attr][0] = "-1";
} }
return $return; return $return;
} }
@ -429,6 +430,9 @@ class phpGroupwareUser extends baseModule {
$messages[] = $errMsg; $messages[] = $errMsg;
} }
} }
else {
$partialAccounts[$i]['phpgwAccountExpires'] = "-1";
}
} }
return $messages; return $messages;
} }