Example #1
0
 /**
  * Get default roe data for creating new roe.
  * @return array
  */
 function getROEDefaultData($user_id = NULL)
 {
     $company_obj = $this->getCurrentCompanyObject();
     if ($user_id > 0) {
         //Debug::Text('Current User Id: '.$user_id, __FILE__, __LINE__, __METHOD__,10);
         $rf = new ROEFactory();
         $first_date = $rf->calculateFirstDate($user_id);
         $last_date = $rf->calculateLastDate($user_id);
         $pay_period = $rf->calculatePayPeriodType($user_id, $last_date);
         Debug::Text('Getting roe default data...', __FILE__, __LINE__, __METHOD__, 10);
         $data = array('company_id' => $company_obj->getId(), 'user_id' => $user_id, 'pay_period_type_id' => $pay_period['pay_period_type_id'], 'first_date' => TTDate::getAPIDate('DATE', $first_date), 'last_date' => TTDate::getAPIDate('DATE', $last_date), 'pay_period_end_date' => TTDate::getAPIDate('DATE', $pay_period['pay_period_end_date']));
     } else {
         $data = array('company_id' => $company_obj->getId());
     }
     return $this->returnHandler($data);
 }
Example #2
0
 * $Date: 2009-10-07 16:10:54 -0700 (Wed, 07 Oct 2009) $
 */
require_once '../../includes/global.inc.php';
require_once Environment::getBasePath() . 'includes/Interface.inc.php';
//Debug::setVerbosity(11);
if (!$permission->Check('roe', 'enabled') or !($permission->Check('roe', 'edit') or $permission->Check('roe', 'edit_own'))) {
    $permission->Redirect(FALSE);
    //Redirect
}
$smarty->assign('title', TTi18n::gettext($title = 'Edit Record Of Employment'));
// See index.php
/*
 * Get FORM variables
 */
extract(FormVariables::GetVariables(array('action', 'id', 'roe_data', 'setup_data', 'user_id')));
$roef = new ROEFactory();
if (isset($roe_data)) {
    if ($roe_data['first_date'] != '') {
        $roe_data['first_date'] = TTDate::parseDateTime($roe_data['first_date']);
    }
    if ($roe_data['last_date'] != '') {
        $roe_data['last_date'] = TTDate::parseDateTime($roe_data['last_date']);
    }
    if ($roe_data['pay_period_end_date'] != '') {
        $roe_data['pay_period_end_date'] = TTDate::parseDateTime($roe_data['pay_period_end_date']);
    }
    if ($roe_data['recall_date'] != '') {
        $roe_data['recall_date'] = TTDate::parseDateTime($roe_data['recall_date']);
    }
}
$ugdlf = new UserGenericDataListFactory();