Exemplo n.º 1
0
$smarty->assign('title', TTi18n::gettext($title = 'Edit Overtime Policy'));
// See index.php
/*
 * Get FORM variables
 */
extract(FormVariables::GetVariables(array('action', 'id', 'data')));
if (isset($data['trigger_time'])) {
    $data['trigger_time'] = TTDate::parseTimeUnit($data['trigger_time']);
}
$otpf = new OverTimePolicyFactory();
$action = Misc::findSubmitButton();
$action = strtolower($action);
switch ($action) {
    case 'submit':
        Debug::Text('Submit!', __FILE__, __LINE__, __METHOD__, 10);
        $otpf->setId($data['id']);
        $otpf->setCompany($current_company->getId());
        $otpf->setName($data['name']);
        $otpf->setType($data['type_id']);
        //$otpf->setLevel( $data['level'] );
        $otpf->setTriggerTime($data['trigger_time']);
        $otpf->setRate($data['rate']);
        $otpf->setWageGroup($data['wage_group_id']);
        $otpf->setAccrualPolicyId($data['accrual_policy_id']);
        $otpf->setAccrualRate($data['accrual_rate']);
        $otpf->setPayStubEntryAccountId($data['pay_stub_entry_account_id']);
        if ($otpf->isValid()) {
            $otpf->Save();
            Redirect::Page(URLBuilder::getURL(NULL, 'OverTimePolicyList.php'));
            break;
        }