Skip to content

Commit

Permalink
Merge pull request #1795 from civicrm/staging
Browse files Browse the repository at this point in the history
Sync master with staging
  • Loading branch information
davialexandre authored May 5, 2017
2 parents 349570a + e74e68c commit 4850eb6
Show file tree
Hide file tree
Showing 98 changed files with 3,101 additions and 541 deletions.
18 changes: 18 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## Overview
_A brief description of the pull request. Try to keep it non-technical. Please mark your pull request with the appropriate [label(s)](https://github.com/civicrm/civihr/blob/staging/CONTRIBUTING.md#label-types)_

## Before
_The current status. Please provide screenshots or gifs ([LICEcap](http://www.cockos.com/licecap/), [SilentCast](https://github.com/colinkeenan/silentcast)) where appropriate._

## After
_What has been changed. Please provide screenshots or gifs ([LICEcap](http://www.cockos.com/licecap/), [SilentCast](https://github.com/colinkeenan/silentcast)) where appropriate._

## Technical Details
_If the PR introduces noteworthy technical changes, please describe them here. Provide code snippets if necessary_

## Comments
_Anything else you would like the reviewer to note_

---

- [ ] Tests Pass
10 changes: 10 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## Contributing

CiviHR is an open-source project and we welcome new contributions from the community.

## Label Types
We use the following label types for issues and pull requests:

- Bug: Fixes an error on an existing feature.
- Enhancement: Improves an existing feature without changing how it behaves (examples: performance improvement, code refactoring, adding new tests).
- New Feature: Adds a new feature to the system. It can be a completely new feature (like a new extension) or an addition to an existing feature.
7 changes: 5 additions & 2 deletions bin/drush-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
##################################
## List of CiviHR core extensions
CORE_EXTS=\
uk.co.compucorp.civicrm.hrcore
uk.co.compucorp.civicrm.hrcore,\
uk.co.compucorp.civicrm.hremails

## List of extensions defining basic entity types
ENTITY_EXTS=\
Expand Down Expand Up @@ -41,10 +42,12 @@ org.civicrm.styleguide
# It expect one parameter ($1) which points to civicrm absolute path
function set_default_localisation_settings() {
LOC_FILE="en_US"
if wget -q "https://download.civicrm.org/civicrm-l10n-core/mo/en_GB/civicrm.mo" > /dev/null; then
if wget -q -t 3 --timeout=30 "https://download.civicrm.org/civicrm-l10n-core/mo/en_GB/civicrm.mo" > /dev/null; then
mkdir -p $1/l10n/en_GB/LC_MESSAGES/
mv civicrm.mo $1/l10n/en_GB/LC_MESSAGES/civicrm.mo
LOC_FILE="en_GB"
else
echo "Could not download en_GB translation file";
fi

UKID=$(drush cvapi Country.getsingle return="id" iso_code="GB" | grep -oh '[0-9]*')
Expand Down
1 change: 1 addition & 0 deletions bin/git-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ hrjobcontract \
org.civicrm.reqangular \
uk.co.compucorp.civicrm.appraisals \
uk.co.compucorp.civicrm.hrcore \
uk.co.compucorp.civicrm.hremails \
uk.co.compucorp.civicrm.hrleaveandabsences
)

Expand Down
4 changes: 2 additions & 2 deletions com.civicrm.hrjobroles/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<author>gregmeszaros</author>
<email>[email protected]</email>
</maintainer>
<releaseDate>2017-04-07</releaseDate>
<version>1.6.8</version>
<releaseDate>2017-05-05</releaseDate>
<version>1.6.9</version>
<develStage>alpha</develStage>
<compatibility>
<ver>4.7</ver>
Expand Down
4 changes: 2 additions & 2 deletions contactaccessrights/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<author>Robin Mitra</author>
<email>[email protected]</email>
</maintainer>
<releaseDate>2017-04-07</releaseDate>
<version>1.6.8</version>
<releaseDate>2017-05-05</releaseDate>
<version>1.6.9</version>
<develStage>alpha</develStage>
<compatibility>
<ver>4.7</ver>
Expand Down
4 changes: 2 additions & 2 deletions contactsummary/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<author>Robin Mitra</author>
<email>[email protected]</email>
</maintainer>
<releaseDate>2017-04-07</releaseDate>
<version>1.6.8</version>
<releaseDate>2017-05-05</releaseDate>
<version>1.6.9</version>
<develStage>alpha</develStage>
<compatibility>
<ver>4.7</ver>
Expand Down
3 changes: 2 additions & 1 deletion hrabsence/api/v3/Activity/Getabsences.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ function civicrm_api3_activity_getabsences($params) {
$entity = _civicrm_api3_get_BAO(__FUNCTION__);
$bao = CRM_Core_DAO::executeQuery($select->toSQL(), array(), TRUE, 'CRM_Activity_BAO_Activity');
$activities = _civicrm_api3_dao_to_array($bao, $params, FALSE, $entity, FALSE);
$activities = _civicrm_api3_activity_get_formatResult($params, $activities);
$options = _civicrm_api3_get_options_from_params($params, FALSE, 'Activity', 'get');
$activities = _civicrm_api3_activity_get_formatResult($params, $activities, $options);
return civicrm_api3_create_success($activities, $params, $entity, 'getAbsences');
}
4 changes: 2 additions & 2 deletions hrabsence/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<author>CiviCRM LLC</author>
<email>[email protected]</email>
</maintainer>
<releaseDate>2017-04-07</releaseDate>
<version>1.6.8</version>
<releaseDate>2017-05-05</releaseDate>
<version>1.6.9</version>
<develStage>beta</develStage>
<compatibility>
<ver>4.7</ver>
Expand Down
4 changes: 2 additions & 2 deletions hrbank/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<author>CiviCRM LLC</author>
<email>[email protected]</email>
</maintainer>
<releaseDate>2017-04-07</releaseDate>
<version>1.6.8</version>
<releaseDate>2017-05-05</releaseDate>
<version>1.6.9</version>
<develStage>beta</develStage>
<compatibility>
<ver>4.7</ver>
Expand Down
4 changes: 2 additions & 2 deletions hrcareer/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<author>CiviCRM LLC</author>
<email>[email protected]</email>
</maintainer>
<releaseDate>2017-04-07</releaseDate>
<version>1.6.8</version>
<releaseDate>2017-05-05</releaseDate>
<version>1.6.9</version>
<develStage>beta</develStage>
<compatibility>
<ver>4.7</ver>
Expand Down
4 changes: 2 additions & 2 deletions hrcase/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<author>CiviCRM LLC</author>
<email>[email protected]</email>
</maintainer>
<releaseDate>2017-04-07</releaseDate>
<version>1.6.8</version>
<releaseDate>2017-05-05</releaseDate>
<version>1.6.9</version>
<develStage>beta</develStage>
<compatibility>
<ver>4.7</ver>
Expand Down
4 changes: 2 additions & 2 deletions hrdemog/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<author>CiviCRM LLC</author>
<email>[email protected]</email>
</maintainer>
<releaseDate>2017-04-07</releaseDate>
<version>1.6.8</version>
<releaseDate>2017-05-05</releaseDate>
<version>1.6.9</version>
<develStage>beta</develStage>
<compatibility>
<ver>4.7</ver>
Expand Down
4 changes: 2 additions & 2 deletions hrident/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<author>CiviCRM LLC</author>
<email>[email protected]</email>
</maintainer>
<releaseDate>2017-04-07</releaseDate>
<version>1.6.8</version>
<releaseDate>2017-05-05</releaseDate>
<version>1.6.9</version>
<develStage>beta</develStage>
<compatibility>
<ver>4.7</ver>
Expand Down
4 changes: 2 additions & 2 deletions hrim/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<author>CiviCRM LLC</author>
<email>[email protected]</email>
</maintainer>
<releaseDate>2017-04-07</releaseDate>
<version>1.6.8</version>
<releaseDate>2017-05-05</releaseDate>
<version>1.6.9</version>
<develStage>beta</develStage>
<compatibility>
<ver>4.7</ver>
Expand Down
13 changes: 0 additions & 13 deletions hrjobcontract/CRM/Hrjobcontract/BAO/HRJobContractRevision.php
Original file line number Diff line number Diff line change
Expand Up @@ -315,19 +315,6 @@ private static function buildEntityQueryArray($entity, $revision, $query) {
";
break;

case 'pension':
$query['select'][] = "pension_ov.label as {$entity}__pension_type_label";

$query['join'][] = "LEFT JOIN $table ON {$table}.jobcontract_revision_id = " . $revision["{$entity}_revision_id"];
$query['join'][] = "LEFT JOIN civicrm_option_group pension_og ON pension_og.name = 'hrjc_pension_type'";
$query['join'][] = "
LEFT JOIN civicrm_option_value pension_ov ON (
pension_ov.option_group_id = pension_og.id
AND pension_ov.value = {$table}.pension_type
)
";
break;

default:
$query['from'][] = $table;
$query['where'][] = "{$table}.jobcontract_revision_id = " . $revision["{$entity}_revision_id"];
Expand Down
20 changes: 9 additions & 11 deletions hrjobcontract/CRM/Hrjobcontract/BAO/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,16 @@ function whereClauseSingle(&$values, &$query) {
$display = implode(' ' . ts('or') . ' ', $value);
}
$query->_qill[$grouping][] = ts('%1 %2', array(1 => $fields[$name]['title'], 2 => $op)) . ' ' . $display;
$query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_hrjobcontract_pension.is_enrolled", $op, $options);
$query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause('civicrm_hrjobcontract_pension.is_enrolled', $op, $options);
$query->_tables['civicrm_hrjobcontract_pension'] = $query->_whereTables['civicrm_hrjobcontract_pension'] = 1;
return;

case 'hrjobcontract_pension_pension_type':
$query->_qill[$grouping][] = 'Pension Provider contains "' . $value . '"';
$query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause('pension_provider.sort_name', 'LIKE', '%' . $value . '%');
$query->_tables['civicrm_hrjobcontract'] = $query->_whereTables['civicrm_hrjobcontract_pension'] = 1;
return;

case 'hrjobcontract_details_period_start_date_low':
case 'hrjobcontract_details_period_start_date_high':
$query->dateQueryBuilder($values,
Expand Down Expand Up @@ -343,6 +349,7 @@ function from($name, $mode, $side) {
break;
case 'civicrm_hrjobcontract_pension':
$from .= " $side JOIN civicrm_hrjobcontract_pension ON rev.pension_revision_id = civicrm_hrjobcontract_pension.jobcontract_revision_id ";
$from .= " $side JOIN civicrm_contact pension_provider ON civicrm_hrjobcontract_pension.pension_type = pension_provider.id ";
break;
case 'civicrm_hrjobcontract_pay':
$from .= " $side JOIN civicrm_hrjobcontract_pay ON rev.pay_revision_id = civicrm_hrjobcontract_pay.jobcontract_revision_id ";
Expand Down Expand Up @@ -572,16 +579,7 @@ public function buildAdvancedSearchPaneForm(&$form, $type) {
$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->addElement('text', 'hrjobcontract_pension_pension_type', ts('Pension Provider (Complete OR Partial Name)'), CRM_Core_DAO::getAttribute('CRM_Hrjobcontract_DAO_HRJobPension', 'pension_type'));

$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');
Expand Down
26 changes: 11 additions & 15 deletions hrjobcontract/CRM/Hrjobcontract/DAO/HRJobPension.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class CRM_Hrjobcontract_DAO_HRJobPension extends CRM_Hrjobcontract_DAO_Base
/**
* Pension Type
*
* @var string
* @var int
*/
public $pension_type;
/**
Expand Down Expand Up @@ -183,9 +183,8 @@ static function &fields()
'export' => true,
'import' => true,
'where' => 'civicrm_hrjobcontract_pension.is_enrolled',
'headerPattern' => '',
'dataPattern' => '',
'headerPattern' => '/^pension\:\s?is\s?enrolled/i',
'dataPattern' => '',
) ,
'hrjobcontract_pension_ee_contrib_pct' => array(
'name' => 'ee_contrib_pct',
Expand All @@ -194,9 +193,8 @@ static function &fields()
'export' => true,
'import' => true,
'where' => 'civicrm_hrjobcontract_pension.ee_contrib_pct',
'headerPattern' => '',
'dataPattern' => '',
'headerPattern' => '/^employee\s?contribution\s?percentage/i',
'dataPattern' => '',
) ,
'hrjobcontract_pension_er_contrib_pct' => array(
'name' => 'er_contrib_pct',
Expand All @@ -205,25 +203,24 @@ static function &fields()
'export' => true,
'import' => true,
'where' => 'civicrm_hrjobcontract_pension.er_contrib_pct',
'headerPattern' => '',
'dataPattern' => '',
'headerPattern' => '/^employer\s?contribution\s?percentage/i',
'dataPattern' => '',
) ,
'hrjobcontract_pension_pension_type' => array(
'name' => 'pension_type',
'type' => CRM_Utils_Type::T_STRING,
'type' => CRM_Utils_Type::T_INT,
'title' => ts('Pension Provider') ,
'maxlength' => 63,
'size' => CRM_Utils_Type::BIG,
'export' => true,
'import' => true,
'where' => 'civicrm_hrjobcontract_pension.pension_type',
'headerPattern' => '',
'headerPattern' => '/^pension\s?provider/i',
'dataPattern' => '',
'FKClassName' => 'CRM_Contact_DAO_Contact',
'pseudoconstant' => array(
'optionGroupName' => 'hrjc_pension_type',
'table' => 'civicrm_contact',
'keyColumn' => 'id',
'labelColumn' => 'display_name',
),
'headerPattern' => '/^pension\s?provider/i',
) ,
'hrjobcontract_pension_ee_contrib_abs' => array(
'name' => 'ee_contrib_abs',
Expand All @@ -232,9 +229,8 @@ static function &fields()
'export' => true,
'import' => true,
'where' => 'civicrm_hrjobcontract_pension.ee_contrib_abs',
'headerPattern' => '',
'dataPattern' => '',
'headerPattern' => '/^employee\s?contribution\s?absolute\s?amount/i',
'dataPattern' => '',
) ,
'hrjobcontract_pension_ee_evidence_note' => array(
'name' => 'ee_evidence_note',
Expand Down
18 changes: 10 additions & 8 deletions hrjobcontract/CRM/Hrjobcontract/Import/Parser/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,6 @@ private function validateField($key, $value) {
case 'HRJobPay-pay_scale':
case 'HRJobPay-pay_currency':
case 'HRJobContractRevision-change_reason':
case 'HRJobPension-pension_type':
case 'HRJobDetails-contract_type':
case 'HRJobHour-hours_type':
case 'HRJobPay-pay_cycle':
Expand All @@ -595,7 +594,7 @@ private function validateField($key, $value) {
if ($optionID !== FALSE) {
$convertedValue = $optionID;
} else {
$errorMessage = "{$this->_fields[$key]->_title} is not valid";
$errorMessage = "Value '$value' for {$this->_fields[$key]->_title} is not valid";
}
break;
case 'HRJobPay-pay_unit':
Expand Down Expand Up @@ -623,19 +622,22 @@ private function validateField($key, $value) {
$errorMessage = "{$this->_fields[$key]->_title} is not a valid date";
}
break;
case 'HRJobPension-pension_type':
case 'HRJobHealth-provider':
case 'HRJobHealth-provider_life_insurance':
$providerType = 'Health_Insurance_Provider';
if ($key == 'HRJobHealth-provider_life_insurance') {
$providerType = 'Life_Insurance_Provider';
}
$contactTypeMapping = [
'HRJobPension-pension_type' => 'Pension_Provider',
'HRJobHealth-provider' => 'Health_Insurance_Provider',
'HRJobHealth-provider_life_insurance' => 'Life_Insurance_Provider'
];

$convertedValue = NULL;
$result = CRM_Hrjobcontract_BAO_HRJobHealth::checkProvider($value, $providerType);
$result = CRM_Hrjobcontract_BAO_HRJobHealth::checkProvider($value, $contactTypeMapping[$key]);
if ($result != 0) {
$convertedValue = $result;
}
else {
$errorMessage = "{$this->_fields[$key]->_title} is not an existing provider";
$errorMessage = "{$this->_fields[$key]->_title} with ID [$value] is not an existing provider";
}
break;
case 'HRJobLeave-leave_amount':
Expand Down
1 change: 0 additions & 1 deletion hrjobcontract/CRM/Hrjobcontract/Import/Parser/BaseClass.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ function init() {
// Fetch select list options from the database and cache them
$this->_optionsList['HRJobHour-hours_type'] = CRM_Hrjobcontract_SelectValues::buildDbOptions('hrjc_hours_type');
$this->_optionsList['HRJobHour-location_standard_hours'] = CRM_Hrjobcontract_SelectValues::buildHourLocations();
$this->_optionsList['HRJobPension-pension_type'] = CRM_Hrjobcontract_SelectValues::buildDbOptions('hrjc_pension_type');
$this->_optionsList['HRJobPay-pay_cycle'] = CRM_Hrjobcontract_SelectValues::buildDbOptions('hrjc_pay_cycle');
$this->_optionsList['HRJobPay-pay_scale'] = CRM_Hrjobcontract_SelectValues::buildPayScales();
$this->_optionsList['HRJobPay-pay_currency'] = CRM_Hrjobcontract_SelectValues::buildCurrency();
Expand Down
Loading

0 comments on commit 4850eb6

Please sign in to comment.