Пример #1
0
 public function buildAdvancedSearchPaneForm(&$form, $type)
 {
     //if (!CRM_Core_Permission::check('access HRJobs')) { echo 'not accessible'; return; }
     if ($type == 'hrjobcontract') {
         $form->add('hidden', 'hidden_hrjobcontract', 1);
         $form->addElement('text', 'hrjobcontract_details_position', ts('Position'), CRM_Core_DAO::getAttribute('CRM_Hrjobcontract_DAO_HRJobDetails', 'position'));
         $form->addElement('text', 'hrjobcontract_details_title', ts('Title'), CRM_Core_DAO::getAttribute('CRM_Hrjobcontract_DAO_HRJobDetails', 'title'));
         $form->addElement('text', 'hrjobcontract_details_funding_notes', ts('Funding Notes'), CRM_Core_DAO::getAttribute('CRM_Hrjobcontract_DAO_HRJobDetails', 'funding_notes'));
         $form->addElement('text', 'hrjobcontract_details_notice_amount', ts('Notice Period from Employer (Amount)'), CRM_Core_DAO::getAttribute('CRM_Hrjobcontract_DAO_HRJobDetails', 'notice_amount'));
         $form->add('select', 'hrjobcontract_details_notice_unit', ts('Notice Period from Employer (Amount)'), CRM_Hrjobcontract_SelectValues::commonUnit(), FALSE, array('id' => 'hrjobcontract_details_notice_unit', 'multiple' => true));
         $form->addElement('text', 'hrjobcontract_details_notice_amount_employee', ts('Notice Period from Employee (Amount)'), CRM_Core_DAO::getAttribute('CRM_Hrjobcontract_DAO_HRJobDetails', 'notice_amount_employee'));
         $form->add('select', 'hrjobcontract_details_notice_unit_employee', ts('Notice Period from Employer (Amount)'), CRM_Hrjobcontract_SelectValues::commonUnit(), FALSE, array('id' => 'hrjobcontract_details_notice_unit_employee', 'multiple' => true));
         $hrjcLocation = CRM_Core_PseudoConstant::get('CRM_Hrjobcontract_DAO_HRJobDetails', 'hrjobcontract_details_location');
         $form->add('select', 'hrjobcontract_details_location', ts('Normal Place of Work'), $hrjcLocation, FALSE, array('id' => 'hrjobcontract_details_location', 'multiple' => true));
         $form->add('select', 'hrjobcontract_role_role_level_type', ts('Level'), CRM_Core_PseudoConstant::get('CRM_Hrjobcontract_DAO_HRJobRole', 'hrjobcontract_role_role_level_type'), FALSE, array('id' => 'hrjobcontract_role_role_level_type', 'multiple' => true));
         $form->add('select', 'hrjobcontract_details_contract_type', ts('Contract Type'), CRM_Core_PseudoConstant::get('CRM_Hrjobcontract_DAO_HRJobDetails', 'hrjobcontract_details_contract_type'), FALSE, array('id' => 'hrjobcontract_details_contract_type', 'multiple' => true));
         CRM_Core_Form_Date::buildDateRange($form, 'hrjobcontract_details_period_start_date', 1, '_low', '_high', ts('From:'), FALSE, FALSE);
         CRM_Core_Form_Date::buildDateRange($form, 'hrjobcontract_details_period_end_date', 1, '_low', '_high', ts('From:'), FALSE, FALSE);
         //$form->addYesNo( 'hrjobcontract_details_is_primary', ts('Is Primary?'));
         $form->add('select', 'hrjobcontract_details_is_primary', ts('Is Primary'), array('' => '- select -', 0 => 'No', 1 => 'Yes'), FALSE, array('id' => 'hrjobcontract_details_is_primary', 'multiple' => false));
     }
     if ($type == 'hrjobcontract_health') {
         $form->add('hidden', 'hidden_hrjobcontract_health', 1);
         //$form->add('checkbox', 'hrjobcontract_health_is_healthcare', ts('Is healthcare provided?'));
         $form->addElement('text', 'hrjobcontract_health_health_provider', ts('Healthcare Provider (Complete OR Partial Name)'), CRM_Core_DAO::getAttribute('CRM_Hrjobcontract_DAO_HRJobHealth', 'provider'));
         $form->add('select', 'hrjobcontract_health_health_plan_type', ts('Healthcare Plan Type'), CRM_Hrjobcontract_SelectValues::planType(), FALSE, array('id' => 'hrjobcontract_health_health_plan_type', 'multiple' => true));
         $form->addElement('text', 'hrjobcontract_health_description', ts('Description Health Insurance'), CRM_Core_DAO::getAttribute('CRM_Hrjobcontract_DAO_HRJobHealth', 'description'));
         $form->addElement('text', 'hrjobcontract_health_dependents', ts('Healthcare Dependents'), CRM_Core_DAO::getAttribute('CRM_Hrjobcontract_DAO_HRJobHealth', 'dependents'));
         $form->addElement('text', 'hrjobcontract_health_health_provider_life_insurance', ts('Life insurance Provider (Complete OR Partial Name)'), CRM_Core_DAO::getAttribute('CRM_Hrjobcontract_DAO_HRJobHealth', 'provider_life_insurance'));
         $form->add('select', 'hrjobcontract_health_life_insurance_plan_type', ts('Life insurance Plan Type'), CRM_Hrjobcontract_SelectValues::planTypeLifeInsurance(), FALSE, array('id' => 'hrjobcontract_health_life_insurance_plan_type', 'multiple' => true));
         $form->addElement('text', 'hrjobcontract_health_description_life_insurance', ts('Description Life Insurance'), CRM_Core_DAO::getAttribute('CRM_Hrjobcontract_DAO_HRJobHealth', 'description_life_insurance'));
         $form->addElement('text', 'hrjobcontract_health_dependents_life_insurance', ts('Life Insurance Dependents'), CRM_Core_DAO::getAttribute('CRM_Hrjobcontract_DAO_HRJobHealth', 'dependents_life_insurance'));
     }
     if ($type == 'hrjobcontract_hour') {
         $form->add('hidden', 'hidden_hrjobcontract_hour', 1);
         $hoursLocation = new CRM_Hrjobcontract_BAO_HoursLocation();
         $hoursLocation->find();
         $hoursLocationOptions = array();
         while ($hoursLocation->fetch()) {
             $hoursLocationOptions[$hoursLocation->id] = $hoursLocation->location;
         }
         $form->add('select', 'hrjobcontract_hour_location_standard_hours', ts('Location/Standard hours'), $hoursLocationOptions, FALSE, array('id' => 'hrjobcontract_hour_location_standard_hours', 'multiple' => true));
         $hoursType = CRM_Core_PseudoConstant::get('CRM_Hrjobcontract_DAO_HRJobHour', 'hrjobcontract_hour_hours_type');
         $form->add('select', 'hrjobcontract_hour_hours_type', ts('Hours Types'), $hoursType, FALSE, array('id' => 'hrjobcontract_hour_hours_type', 'multiple' => true));
         $form->add('text', 'hrjobcontract_hour_hours_amount', ts('Actual Hours (Amount)'), array('size' => 8, 'maxlength' => 8));
         $form->add('select', 'hrjobcontract_hour_hours_unit', ts('Actual Hours (Unit)'), CRM_Hrjobcontract_SelectValues::commonUnit(), FALSE, array('id' => 'hrjobcontract_hour_hours_unit', 'multiple' => true));
         $form->add('text', 'hrjobcontract_hour_hours_fte', ts('Full-Time Equivalence'), array('size' => 8, 'maxlength' => 8));
         $form->add('text', 'hrjobcontract_hour_hours_fte_num', ts('Full-Time Numerator Equivalence'), array('size' => 8, 'maxlength' => 8));
         $form->add('text', 'hrjobcontract_hour_fte_denom', ts('Full-Time Denominator Equivalence'), array('size' => 8, 'maxlength' => 8));
         $form->add('text', 'hrjobcontract_hour_hours_amount_low', ts('From'), array('size' => 8, 'maxlength' => 8));
         $form->addRule('hrjobcontract_hour_hours_amount_low', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('9.99', ' '))), 'money');
         $form->add('text', 'hrjobcontract_hour_hours_amount_high', ts('To'), array('size' => 8, 'maxlength' => 8));
         $form->addRule('hrjobcontract_hour_hours_amount_high', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money');
         $form->add('text', 'hrjobcontract_hour_hours_fte_low', ts('From'), array('size' => 8, 'maxlength' => 8));
         $form->addRule('hrjobcontract_hour_hours_fte_low', ts('Please enter a valid decimal value (e.g. %1).', array(1 => CRM_Utils_Money::format('9.99', ' '))), 'money');
         $form->add('text', 'hrjobcontract_hour_hours_fte_high', ts('To'), array('size' => 8, 'maxlength' => 8));
         $form->addRule('hrjobcontract_hour_hours_fte_high', ts('Please enter a valid decimal value (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money');
     }
     if ($type == 'hrjobcontract_leave') {
         $form->add('hidden', 'hidden_hrjobcontract_leave', 1);
         $leaveTypeOptions = array();
         $absenceType = new CRM_HRAbsence_BAO_HRAbsenceType();
         $absenceType->find();
         while ($absenceType->fetch()) {
             $leaveTypeOptions[$absenceType->id] = $absenceType->title;
         }
         $form->add('select', 'hrjobcontract_leave_leave_type', ts('Leave Type'), $leaveTypeOptions, FALSE, array('id' => 'hrjobcontract_leave_leave_type', 'multiple' => true));
     }
     if ($type == 'hrjobcontract_pay') {
         $form->add('hidden', 'hidden_hrjobcontract_pay', 1);
         $payScaleOptions = array();
         $payScale = new CRM_Hrjobcontract_BAO_PayScale();
         $payScale->find();
         while ($payScale->fetch()) {
             $payScaleOptions[$payScale->id] = $payScale->pay_scale;
             if (!empty($payScale->pay_grade)) {
                 $payScaleOptions[$payScale->id] .= ' - ' . $payScale->pay_grade . ' - ' . $payScale->currency . ' ' . $payScale->amount . ' per ' . $payScale->periodicity;
             }
         }
         $form->add('select', 'hrjobcontract_pay_pay_scale', ts('Pay Scale'), $payScaleOptions, FALSE, array('id' => 'hrjobcontract_pay_pay_scale', 'multiple' => true));
         $form->add('select', 'hrjobcontract_pay_is_paid', ts('Paid / Unpaid'), CRM_Core_PseudoConstant::get('CRM_Hrjobcontract_DAO_HRJobPay', 'is_paid'), FALSE, array('id' => 'hrjobcontract_pay_is_paid', 'multiple' => 'multiple', 'title' => ts('- select -')));
         $form->add('text', 'hrjobcontract_pay_pay_amount', ts('Pay Amount'), array('size' => 8, 'maxlength' => 8));
         $form->addRule('hrjobcontract_pay_pay_amount', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('9.99', ' '))), 'money');
         $form->add('text', 'hrjobcontract_pay_pay_amount_low', ts('From'), array('size' => 8, 'maxlength' => 8));
         $form->addRule('hrjobcontract_pay_pay_amount_low', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('9.99', ' '))), 'money');
         $form->add('text', 'hrjobcontract_pay_pay_amount_high', ts('To'), array('size' => 8, 'maxlength' => 8));
         $form->addRule('hrjobcontract_pay_pay_amount_high', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money');
         $form->add('select', 'hrjobcontract_pay_pay_unit', ts('Pay Unit'), CRM_Hrjobcontract_SelectValues::payUnit(), FALSE, array('id' => 'hrjobcontract_pay_pay_unit', 'multiple' => true));
         $form->add('select', 'hrjobcontract_pay_pay_currency', ts('Pay Currency'), array_keys(CRM_Hrjobcontract_Page_JobContractTab::getCurrencyFormats()), FALSE, array('id' => 'hrjobcontract_pay_pay_currency', 'multiple' => true));
         $form->add('text', 'hrjobcontract_pay_pay_annualized_est', ts('Estimated Annual Pay'), array('size' => 8, 'maxlength' => 8));
         $form->addRule('hrjobcontract_pay_pay_annualized_est', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('9.99', ' '))), 'money');
         $form->add('text', 'hrjobcontract_pay_pay_annualized_est_low', ts('From'), array('size' => 8, 'maxlength' => 8));
         $form->addRule('hrjobcontract_pay_pay_annualized_est_low', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('9.99', ' '))), 'money');
         $form->add('text', 'hrjobcontract_pay_pay_annualized_est_high', ts('To'), array('size' => 8, 'maxlength' => 8));
         $form->addRule('hrjobcontract_pay_pay_annualized_est_high', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money');
         $form->add('select', 'hrjobcontract_pay_pay_is_auto_est', ts('Estimated Auto Pay'), array('' => '- select -', 0 => 'No', 1 => 'Yes'), FALSE, array('id' => 'hrjobcontract_pay_pay_is_auto_est', 'multiple' => false));
         // TODO: Annual Benefits + Annual Deductions
         $payCycleOptions = array();
         $payCycles = array();
         CRM_Core_OptionGroup::getAssoc('hrjc_pay_cycle', $payCycles, true);
         foreach ($payCycles as $payCycle) {
             $payCycleOptions[$payCycle['value']] = $payCycle['label'];
         }
         $form->add('select', 'hrjobcontract_pay_pay_cycle', ts('Pay Cycle'), $payCycleOptions, FALSE, array('id' => 'hrjobcontract_pay_pay_cycle', 'multiple' => true));
         $form->add('text', 'hrjobcontract_pay_pay_per_cycle_gross', ts('Pay Per Cycle Gross'), array('size' => 8, 'maxlength' => 8));
         $form->addRule('hrjobcontract_pay_pay_per_cycle_gross', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('9.99', ' '))), 'money');
         $form->add('text', 'hrjobcontract_pay_pay_per_cycle_gross_low', ts('From'), array('size' => 8, 'maxlength' => 8));
         $form->addRule('hrjobcontract_pay_pay_per_cycle_gross_low', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('9.99', ' '))), 'money');
         $form->add('text', 'hrjobcontract_pay_pay_per_cycle_gross_high', ts('To'), array('size' => 8, 'maxlength' => 8));
         $form->addRule('hrjobcontract_pay_pay_per_cycle_gross_high', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money');
         $form->add('text', 'hrjobcontract_pay_pay_per_cycle_net', ts('Pay Per Cycle Net'), array('size' => 8, 'maxlength' => 8));
         $form->addRule('hrjobcontract_pay_pay_per_cycle_net', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('9.99', ' '))), 'money');
         $form->add('text', 'hrjobcontract_pay_pay_per_cycle_net_low', ts('From'), array('size' => 8, 'maxlength' => 8));
         $form->addRule('hrjobcontract_pay_pay_per_cycle_net_low', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('9.99', ' '))), 'money');
         $form->add('text', 'hrjobcontract_pay_pay_per_cycle_net_high', ts('To'), array('size' => 8, 'maxlength' => 8));
         $form->addRule('hrjobcontract_pay_pay_per_cycle_net_high', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money');
     }
     if ($type == 'hrjobcontract_pension') {
         $form->add('hidden', 'hidden_hrjobcontract_pension', 1);
         $form->add('select', 'hrjobcontract_pension_is_enrolled', ts('Is Enrolled'), array(0 => 'No', 1 => 'Yes', 2 => 'Opted out'), FALSE, array('id' => 'hrjobcontract_pension_is_enrolled', 'multiple' => true));
         $form->add('text', 'hrjobcontract_pension_ee_contrib_pct_low', ts('From'), array('size' => 8, 'maxlength' => 8));
         $form->addRule('hrjobcontract_pension_ee_contrib_pct_low', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('9.99', ' '))), 'money');
         $form->add('text', 'hrjobcontract_pension_ee_contrib_pct_high', ts('To'), array('size' => 8, 'maxlength' => 8));
         $form->addRule('hrjobcontract_pension_ee_contrib_pct_high', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money');
         $form->add('text', 'hrjobcontract_pension_er_contrib_pct_low', ts('From'), array('size' => 8, 'maxlength' => 8));
         $form->addRule('hrjobcontract_pension_er_contrib_pct_low', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('9.99', ' '))), 'money');
         $form->add('text', 'hrjobcontract_pension_er_contrib_pct_high', ts('To'), array('size' => 8, 'maxlength' => 8));
         $form->addRule('hrjobcontract_pension_er_contrib_pct_high', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money');
         $pensionTypes = array();
         $pensionTypeOptions = array();
         CRM_Core_OptionGroup::getAssoc('hrjc_pension_type', $pensionTypes, true);
         foreach ($pensionTypes as $pensionType) {
             $pensionTypeOptions[$pensionType['value']] = $pensionType['label'];
         }
         $form->add('select', 'hrjobcontract_pension_pension_type', ts('Pension Provider'), $pensionTypeOptions, FALSE, array('id' => 'hrjobcontract_pension_pension_type', 'multiple' => true));
         $form->add('text', 'hrjobcontract_pension_ee_contrib_abs_low', ts('From'), array('size' => 8, 'maxlength' => 8));
         $form->addRule('hrjobcontract_pension_ee_contrib_abs_low', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('9.99', ' '))), 'money');
         $form->add('text', 'hrjobcontract_pension_ee_contrib_abs_high', ts('To'), array('size' => 8, 'maxlength' => 8));
         $form->addRule('hrjobcontract_pension_ee_contrib_abs_high', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money');
         $form->addElement('text', 'hrjobcontract_pension_ee_evidence_note', ts('Pension Evidence Note'), CRM_Core_DAO::getAttribute('CRM_Hrjobcontract_DAO_HRJobPension', 'ee_evidence_note'));
     }
 }
 protected function _initialize()
 {
     // annual benefits options:
     CRM_Core_OptionGroup::getAssoc('hrjc_benefit_name', $this->_annualOptions['benefit']['name']);
     CRM_Core_OptionGroup::getAssoc('hrjc_benefit_type', $this->_annualOptions['benefit']['type']);
     foreach ($this->_annualOptions['benefit']['name']['label'] as $key => $value) {
         $this->_annualOptionsFlipped['benefit']['name'][$value] = $key;
     }
     foreach ($this->_annualOptions['benefit']['type']['label'] as $key => $value) {
         $this->_annualOptionsFlipped['benefit']['type'][$value] = $key;
     }
     // annual deductions options:
     CRM_Core_OptionGroup::getAssoc('hrjc_deduction_name', $this->_annualOptions['deduction']['name']);
     CRM_Core_OptionGroup::getAssoc('hrjc_deduction_type', $this->_annualOptions['deduction']['type']);
     foreach ($this->_annualOptions['deduction']['name']['label'] as $key => $value) {
         $this->_annualOptionsFlipped['deduction']['name'][$value] = $key;
     }
     foreach ($this->_annualOptions['deduction']['type']['label'] as $key => $value) {
         $this->_annualOptionsFlipped['deduction']['type'][$value] = $key;
     }
     // contract type options:
     $contractTypeOptions = array();
     CRM_Core_OptionGroup::getAssoc('hrjc_contract_type', $contractTypeOptions, true);
     foreach ($contractTypeOptions as $contractType) {
         $this->_contractTypeOptions[$contractType['value']] = $contractType;
         $this->_contractTypeOptionsFlipped[$contractType['label']] = $contractType['value'];
     }
     // hours location options:
     $hoursLocation = new CRM_Hrjobcontract_BAO_HoursLocation();
     $hoursLocation->find();
     while ($hoursLocation->fetch()) {
         $this->_hoursLocationOptions[$hoursLocation->id] = (array) $hoursLocation;
     }
     // hours type options:
     $hoursTypeOptions = array();
     CRM_Core_OptionGroup::getAssoc('hrjc_hours_type', $hoursType, true);
     foreach ($hoursType as $hourType) {
         $this->_hoursTypeOptions[$hourType['value']] = $hourType;
         $this->_hoursTypeOptionsFlipped[$hourType['label']] = $hourType['value'];
     }
     // leave types options:
     $absenceType = new CRM_HRAbsence_BAO_HRAbsenceType();
     $absenceType->find();
     while ($absenceType->fetch()) {
         $absenceTypeArray = (array) $absenceType;
         $this->_leaveTypes[$absenceType->id] = $absenceTypeArray;
         $this->_leaveTypesFlipped[$absenceTypeArray['title']] = $absenceType->id;
     }
     // location options:
     $locationOptions = array();
     CRM_Core_OptionGroup::getAssoc('hrjc_location', $locationOptions, true);
     foreach ($locationOptions as $location) {
         $this->_locationOptions[$location['value']] = $location;
         $this->_locationOptionsFlipped[$location['label']] = $location['value'];
     }
     // pay cycle options:
     $payCycleOptions = array();
     CRM_Core_OptionGroup::getAssoc('hrjc_pay_cycle', $payCycleOptions, true);
     foreach ($payCycleOptions as $payCycle) {
         $this->_payCycleOptions[$payCycle['value']] = $payCycle;
         $this->_payCycleOptionsFlipped[$payCycle['label']] = $payCycle['value'];
     }
     // pay scale options:
     $payScale = new CRM_Hrjobcontract_BAO_PayScale();
     $payScale->find();
     while ($payScale->fetch()) {
         $this->_payScaleOptions[$payScale->id] = (array) $payScale;
     }
     // pension type options:
     $pensionTypeOptions = array();
     CRM_Core_OptionGroup::getAssoc('hrjc_pension_type', $pensionTypeOptions, true);
     foreach ($pensionTypeOptions as $pensionType) {
         $this->_pensionTypeOptions[$pensionType['value']] = $pensionType;
         $this->_pensionTypeOptionsFlipped[$pensionType['label']] = $pensionType['value'];
     }
 }