} if ($branch_data['fax_phone'] != '') { $bf->setFaxPhone($branch_data['fax_phone']); } if ($bf->isValid()) { $bf->Save(); Redirect::Page(URLBuilder::getURL(NULL, 'BranchList.php')); break; } default: if (isset($id)) { BreadCrumb::setCrumb($title); $blf = new BranchListFactory(); $blf->GetByIdAndCompanyId($id, $current_company->getId()); foreach ($blf as $branch) { $branch_data = array('id' => $branch->getId(), 'status' => $branch->getStatus(), 'manual_id' => $branch->getManualID(), 'name' => $branch->getName(), 'address1' => $branch->getAddress1(), 'address2' => $branch->getAddress2(), 'city' => $branch->getCity(), 'province' => $branch->getProvince(), 'country' => $branch->getCountry(), 'postal_code' => $branch->getPostalCode(), 'work_phone' => $branch->getWorkPhone(), 'fax_phone' => $branch->getFaxPhone(), 'created_date' => $branch->getCreatedDate(), 'created_by' => $branch->getCreatedBy(), 'updated_date' => $branch->getUpdatedDate(), 'updated_by' => $branch->getUpdatedBy(), 'deleted_date' => $branch->getDeletedDate(), 'deleted_by' => $branch->getDeletedBy()); } } elseif ($action != 'submit') { $next_available_manual_id = BranchListFactory::getNextAvailableManualId($current_company->getId()); $branch_data = array('country' => $current_company->getCountry(), 'province' => $current_company->getProvince(), 'next_available_manual_id' => $next_available_manual_id); } //Select box options; $branch_data['status_options'] = $bf->getOptions('status'); $cf = new CompanyFactory(); $branch_data['country_options'] = $cf->getOptions('country'); $branch_data['province_options'] = $cf->getOptions('province', $branch_data['country']); $smarty->assign_by_ref('branch_data', $branch_data); break; } $smarty->assign_by_ref('bf', $bf); $smarty->display('branch/EditBranch.tpl');