예제 #1
0
 function createUserWageGroups($company_id)
 {
     $wgf = new WageGroupFactory();
     $wgf->setCompany($company_id);
     $wgf->setName('Alternate Wage #1');
     if ($wgf->isValid()) {
         $this->user_wage_groups[0] = $wgf->Save();
         Debug::Text('aUser Wage Group ID: ' . $this->user_wage_groups[0], __FILE__, __LINE__, __METHOD__, 10);
     }
     $wgf = new WageGroupFactory();
     $wgf->setCompany($company_id);
     $wgf->setName('Alternate Wage #2');
     if ($wgf->isValid()) {
         $this->user_wage_groups[1] = $wgf->Save();
         Debug::Text('bUser Wage Group ID: ' . $this->user_wage_groups[1], __FILE__, __LINE__, __METHOD__, 10);
     }
     return TRUE;
 }
예제 #2
0
$smarty->assign('title', TTi18n::gettext($title = 'Edit Wage Group'));
// See index.php
/*
 * Get FORM variables
 */
extract(FormVariables::GetVariables(array('action', 'id', 'group_data')));
$wgf = new WageGroupFactory();
$action = Misc::findSubmitButton();
switch ($action) {
    case 'submit':
        Debug::Text('Submit!', __FILE__, __LINE__, __METHOD__, 10);
        $wgf->setId($group_data['id']);
        $wgf->setCompany($current_company->getId());
        $wgf->setName($group_data['name']);
        if ($wgf->isValid()) {
            $wgf->Save();
            Redirect::Page(URLBuilder::getURL(NULL, 'WageGroupList.php'));
            break;
        }
    default:
        if (isset($id)) {
            BreadCrumb::setCrumb($title);
            $wglf = new WageGroupListFactory();
            $wglf->GetByIdAndCompanyId($id, $current_company->getId());
            foreach ($wglf as $group_obj) {
                //Debug::Arr($title_obj,'Title Object', __FILE__, __LINE__, __METHOD__,10);
                $group_data = array('id' => $group_obj->getId(), 'name' => $group_obj->getName(), 'created_date' => $group_obj->getCreatedDate(), 'created_by' => $group_obj->getCreatedBy(), 'updated_date' => $group_obj->getUpdatedDate(), 'updated_by' => $group_obj->getUpdatedBy(), 'deleted_date' => $group_obj->getDeletedDate(), 'deleted_by' => $group_obj->getDeletedBy());
            }
        }
        $smarty->assign_by_ref('group_data', $group_data);
        break;