protected function btnSave_Click($strFormId, $strControlId, $strParameter) { // Make sure the new HeadOfHousehold is ONLY a member of this one household $objNewHeadPerson = Person::Load($this->lstHead->SelectedValue); switch ($objNewHeadPerson->GetHouseholdStatus()) { case Person::HouseholdStatusMemberOfOne: // Good! Do nothing and move on break; case Person::HouseholdStatusMemberOfMultiple: $this->dlgMessage->MessageHtml = sprintf('%s is a member of another household and thus cannot be head of this new household.', QApplication::HtmlEntities($objNewHeadPerson->Name)); $this->dlgMessage->ShowDialogBox(); return; case Person::HouseholdStatusNone: case Person::HouseholdStatusHeadOfOne: case Person::HouseholdStatusHeadOfFamily: case Person::HouseholdStatusError: default: $this->dlgMessage->MessageHtml = sprintf('An unknown data error occurred while trying to split <strong>%s</strong>. Please contact a ChMS Administrator to report the issue.', QApplication::HtmlEntities($this->objHousehold->Name)); $this->dlgMessage->ShowDialogBox(); return; } if (!$this->pnlAddress->objDelegate->btnSave_Click()) { return; } $objNewAddress = $this->pnlAddress->objDelegate->mctAddress->Address; $objNewHousehold = $this->objHousehold->SplitHousehold($this->objSelectedPersonArray, $objNewHeadPerson, $objNewAddress); QApplication::Redirect('/households/view.php/' . $objNewHousehold->Id); }