Пример #1
0
}
Debug::Arr($ids, 'Selected Objects', __FILE__, __LINE__, __METHOD__, 10);
$action = Misc::findSubmitButton();
switch ($action) {
    case 'add':
        Redirect::Page(URLBuilder::getURL(NULL, 'EditAbsencePolicy.php', FALSE));
        break;
    case 'delete' or 'undelete':
        if (strtolower($action) == 'delete') {
            $delete = TRUE;
        } else {
            $delete = FALSE;
        }
        $aplf = new AbsencePolicyListFactory();
        foreach ($ids as $id) {
            $aplf->getByIdAndCompanyId($id, $current_company->getId());
            foreach ($aplf as $ap_obj) {
                $ap_obj->setDeleted($delete);
                if ($ap_obj->isValid()) {
                    $ap_obj->Save();
                }
            }
        }
        Redirect::Page(URLBuilder::getURL(NULL, 'AbsencePolicyList.php'));
        break;
    default:
        $aplf = new AbsencePolicyListFactory();
        $aplf->getByCompanyId($current_company->getId());
        $pager = new Pager($aplf);
        $type_options = $aplf->getOptions('type');
        foreach ($aplf as $ap_obj) {
Пример #2
0
 function getAbsencePolicyBalance($absence_policy_id, $user_id)
 {
     global $current_company;
     if (!is_object($current_company)) {
         return FALSE;
     }
     $aplf = new AbsencePolicyListFactory();
     $aplf->getByIdAndCompanyId($absence_policy_id, $current_company->getId());
     if ($aplf->getRecordCount() > 0) {
         $ap_obj = $aplf->getCurrent();
         if ($ap_obj->getAccrualPolicyID() != '') {
             return $this->getAccrualBalance($ap_obj->getAccrualPolicyID(), $user_id);
         }
     }
     return FALSE;
 }