}
     if (isset($round_policy_data['over_time_default'])) {
         $rpf->setOverTimeDefault($round_policy_data['over_time_default']);
     }
     if (isset($round_policy_data['under_time_default'])) {
         $rpf->setUnderTimeDefault($round_policy_data['under_time_default']);
     }
     if ($rpf->isValid()) {
         $rpf->Save();
         Redirect::Page(URLBuilder::getURL(NULL, 'RoundPolicyList.php'));
         break;
     }
 default:
     if (isset($id)) {
         BreadCrumb::setCrumb($title);
         $rplf = new RoundPolicyListFactory();
         $rplf->getByIdAndCompanyId($id, $current_company->getId());
         foreach ($rplf as $round_policy_obj) {
             //Debug::Arr($branch,'branch', __FILE__, __LINE__, __METHOD__,10);
             $round_policy_data = array('id' => $round_policy_obj->getId(), 'name' => $round_policy_obj->getName(), 'description' => $round_policy_obj->getDescription(), 'default' => $round_policy_obj->getDefault(), 'strict_start' => $round_policy_obj->getStrictStart(), 'strict_lunch_start' => $round_policy_obj->getStrictLunchStart(), 'strict_lunch_end' => $round_policy_obj->getStrictLunchEnd(), 'strict_end' => $round_policy_obj->getStrictEnd(), 'round_grace_start' => $round_policy_obj->getRoundGraceStart(), 'round_grace_lunch_start' => $round_policy_obj->getRoundGraceLunchStart(), 'round_grace_lunch_end' => $round_policy_obj->getRoundGraceLunchEnd(), 'round_grace_end' => $round_policy_obj->getRoundGraceEnd(), 'round_start' => $round_policy_obj->getRoundStart(), 'round_lunch_start' => $round_policy_obj->getRoundLunchStart(), 'round_lunch_end' => $round_policy_obj->getRoundLunchEnd(), 'round_end' => $round_policy_obj->getRoundEnd(), 'round_type_start' => $round_policy_obj->getRoundTypeStart(), 'round_type_lunch_start' => $round_policy_obj->getRoundTypeLunchStart(), 'round_type_lunch_end' => $round_policy_obj->getRoundTypeLunchEnd(), 'round_type_end' => $round_policy_obj->getRoundTypeEnd(), 'round_lunch_total' => $round_policy_obj->getRoundLunchTotal(), 'round_total' => $round_policy_obj->getRoundTotal(), 'enable_bank_time' => $round_policy_obj->getEnableBankTime(), 'over_time_default' => $round_policy_obj->getOverTimeDefault(), 'under_time_default' => $round_policy_obj->getUnderTimeDefault(), 'created_date' => $round_policy_obj->getCreatedDate(), 'created_by' => $round_policy_obj->getCreatedBy(), 'updated_date' => $round_policy_obj->getUpdatedDate(), 'updated_by' => $round_policy_obj->getUpdatedBy(), 'deleted_date' => $round_policy_obj->getDeletedDate(), 'deleted_by' => $round_policy_obj->getDeletedBy());
         }
     } elseif ($action != 'submit') {
         //Set defaults.
         $round_policy_data = array('round_grace_start' => 0, 'round_grace_lunch_start' => 0, 'round_grace_lunch_end' => 0, 'round_grace_end' => 0, 'round_start' => 900, 'round_lunch_start' => 60, 'round_lunch_end' => 900, 'round_end' => 900, 'round_type_start' => 30, 'round_type_lunch_start' => 10, 'round_type_lunch_end' => 30, 'round_type_end' => 10, 'round_lunch_total' => TRUE, 'round_total' => FALSE);
     }
     //Select box options;
     $round_type_options = $rpf->getOptions('round_type');
     $smarty->assign_by_ref('round_type_options', $round_type_options);
     $over_time_default_options = $rpf->getOptions('over_time_default');
     $smarty->assign_by_ref('over_time_default_options', $over_time_default_options);
     $under_time_default_options = $rpf->getOptions('under_time_default');
        break;
    case 'delete' or 'undelete':
        if (strtolower($action) == 'delete') {
            $delete = TRUE;
        } else {
            $delete = FALSE;
        }
        $rplf = new RoundPolicyListFactory();
        foreach ($ids as $id) {
            $rplf->getByIdAndCompanyId($id, $current_company->getId());
            foreach ($rplf as $round_policy_obj) {
                $round_policy_obj->setDeleted($delete);
                $round_policy_obj->Save();
            }
        }
        Redirect::Page(URLBuilder::getURL(NULL, 'RoundPolicyList.php'));
        break;
    default:
        $rplf = new RoundPolicyListFactory();
        $rplf->getByCompanyId($current_company->getId(), $current_user_prefs->getItemsPerPage(), $page, NULL, $sort_array);
        $pager = new Pager($rplf);
        foreach ($rplf as $round_policy_obj) {
            $round_policies[] = array('id' => $round_policy_obj->getId(), 'name' => $round_policy_obj->getName(), 'description' => $round_policy_obj->getDescription(), 'default' => $round_policy_obj->getDefault());
        }
        $smarty->assign_by_ref('round_policies', $round_policies);
        $smarty->assign_by_ref('sort_column', $sort_column);
        $smarty->assign_by_ref('sort_order', $sort_order);
        $smarty->assign_by_ref('paging_data', $pager->getPageVariables());
        break;
}
$smarty->display('round_policy/RoundPolicyList.tpl');