function processPost($formvalues) { $session = SessionWrapper::getInstance(); // debugMessage($formvalues); // trim spaces from the name field if (!isArrayKeyAnEmptyString('c_username', $formvalues)) { $formvalues['username'] = $formvalues['c_username']; } if (isArrayKeyAnEmptyString('status', $formvalues)) { unset($formvalues['status']); } if (isArrayKeyAnEmptyString('defaultdepartmentid', $formvalues)) { unset($formvalues['defaultdepartmentid']); } if (isArrayKeyAnEmptyString('defaultuserid', $formvalues)) { unset($formvalues['defaultuserid']); } if (!isArrayKeyAnEmptyString('workingdaysids', $formvalues)) { $formvalues['workingdays'] = implode(',', $formvalues['workingdaysids']); } else { if (!isArrayKeyAnEmptyString('workingdays_old', $formvalues)) { if (isArrayKeyAnEmptyString('workingdaysids', $formvalues)) { $formvalues['workingdays'] = NULL; } } else { unset($formvalues['workingdays']); } } if (isArrayKeyAnEmptyString('isinvited', $formvalues)) { $formvalues['isinvited'] = NULL; } if (isArrayKeyAnEmptyString('hasacceptedinvite', $formvalues)) { $formvalues['hasacceptedinvite'] = NULL; } if (isArrayKeyAnEmptyString('dateinvited', $formvalues)) { unset($formvalues['dateinvited']); } if (isArrayKeyAnEmptyString('id', $formvalues)) { $formvalues['startdate'] = DEFAULT_DATETIME; } if (!isArrayKeyAnEmptyString('sendinvite', $formvalues)) { if ($formvalues['sendinvite'] == 1) { $this->setIsBeingInvited(1); $formvalues['isinvited'] = 1; $formvalues['invitedbyid'] = $session->getVar('userid'); $formvalues['dateinvited'] = DEFAULT_DATETIME; $formvalues['hasacceptedinvite'] = 0; } } $updateuser = false; if (!isArrayKeyAnEmptyString('defaultuserid', $formvalues)) { $user = new UserAccount(); $user->populate($formvalues['defaultuserid']); if ($user->isUserInActive()) { $updateuser = true; $formvalues['defaultuser']['id'] = $formvalues['defaultuserid']; } } else { $updateuser = true; $formvalues['defaultuser']['status'] = 0; $formvalues['defaultuser']['datecreated'] = date('Y-m-d', time()); $formvalues['defaultuser']['createdby'] = $session->getVar('userid'); $formvalues['defaultuser']['usergroups'][0]["groupid"] = 3; $formvalues['defaultuser']['type'] = 3; } if ($updateuser) { $names = explode(' ', $this->getContactPerson()); debugMessage($names); $formvalues['defaultuser']['firstname'] = $names[0]; if (!isArrayKeyAnEmptyString(1, $names)) { $formvalues['defaultuser']['lastname'] = $names[1]; } else { $formvalues['defaultuser']['lastname'] = '.'; } if (!isArrayKeyAnEmptyString(2, $names)) { $formvalues['defaultuser']['othername'] = $names[2]; } $formvalues['defaultuser']['email'] = $this->getEmail(); if ($this->getIsBeinginvited() == '1') { $formvalues['defaultuser']['hasacceptedinvite'] = 0; $formvalues['defaultuser']['dateinvited'] = date('Y-m-d', time()); $formvalues['defaultuser']['invitedbyid'] = $session->getVar('userid'); $formvalues['defaultuser']['isinvited'] = 1; } } if (isArrayKeyAnEmptyString('openinghour', $formvalues)) { unset($formvalues['openinghour']); } else { $formvalues['openinghour'] = date("H:i:s", strtotime($formvalues['openinghour'])); } if (isArrayKeyAnEmptyString('closinghour', $formvalues)) { unset($formvalues['closinghour']); } else { $formvalues['closinghour'] = date("H:i:s", strtotime($formvalues['closinghour'])); } if (isArrayKeyAnEmptyString('yearstart', $formvalues)) { unset($formvalues['yearstart']); } else { $formvalues['yearstart'] = date('Y-m-d', strtotime($formvalues['yearstart'])); } if (isArrayKeyAnEmptyString('yearend', $formvalues)) { unset($formvalues['yearend']); } else { $formvalues['yearend'] = date('Y-m-d', strtotime($formvalues['yearend'])); } if (isArrayKeyAnEmptyString('headertype', $formvalues)) { $formvalues['headertype'] = 0; } // debugMessage($formvalues); exit(); parent::processPost($formvalues); }