Skip to content

Commit

Permalink
Merge pull request #2832 from compucorp/staging
Browse files Browse the repository at this point in the history
Sync master with staging
  • Loading branch information
davialexandre authored Aug 20, 2018
2 parents 15943b5 + 2e38090 commit 350bb6a
Show file tree
Hide file tree
Showing 289 changed files with 25,936 additions and 26,409 deletions.
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ def testJS(hrcoreFolder, java.util.LinkedHashMap extension) {
// workspace, where Jenkins will read it
sh """
cd $CIVICRM_EXT_ROOT/civihr/${hrcoreFolder}
gulp test --ext ${extension.folder} --reporters junit,progress || true
npx gulp test --ext ${extension.folder} --reporters junit,progress || true
cd $CIVICRM_EXT_ROOT/civihr/${extension.folder}
mv test-reports/*.xml $WORKSPACE/$KARMA_TESTS_REPORT_FOLDER/ || true
Expand Down
5 changes: 3 additions & 2 deletions bin/apply-core-fork-patch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
set -e

API_URL_BASE="https://api.github.com/repos/compucorp/civicrm-core"
REPO_BASE_URL="https://github.com/compucorp/civicrm-core"
LAST_COMMIT_PATCHED_FILE="core-fork-last-commit-patched.txt"
PATCH_FILE="fork-patch.diff"

Expand All @@ -27,7 +28,7 @@ applyPatch () {
# Creates a diff patch file by sending a request to the given GitHub API url
#
# Globals:
# $API_URL_BASE
# $REPO_BASE_URL
# $civiRoot
# $PATCH_FILE
# Arguments:
Expand All @@ -37,7 +38,7 @@ applyPatch () {
# None
#######################################
createPatch () {
curl "$API_URL_BASE/compare/$1...$2" -s -H "Accept: application/vnd.github.v3.diff" > "$civiRoot/$PATCH_FILE"
curl "$REPO_BASE_URL/compare/$1...$2.diff" -s > "$civiRoot/$PATCH_FILE"
}

#######################################
Expand Down
1 change: 0 additions & 1 deletion bin/drush-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ uk.co.compucorp.civicrm.hremails
## List of extensions defining basic entity types
ENTITY_EXTS=\
org.civicrm.hrbank,\
org.civicrm.hrdemog,\
org.civicrm.hrjobcontract,\
com.civicrm.hrjobroles,\
org.civicrm.hrmed,\
Expand Down
1 change: 0 additions & 1 deletion bin/git-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ fileName=""
ENTITY_EXTS=( hrbank \
hrcareer \
hrcase \
hrdemog \
hrim \
hrmed \
hrprofile \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,14 @@ private function addJoins(CRM_Utils_SQL_Select $query) {
private function addWhere(CRM_Utils_SQL_Select $customQuery) {
if (!empty($this->params['contact_id'])) {
$conditions[] = 'jc.contact_id IN (' . implode(',' , $this->params['contact_id']) . ')';
$customQuery->where($conditions);
unset($this->params['contact_id']);
}

$today = date('Y-m-d H:i:s');
$dateRestriction = 'a.start_date <= "' . $today . '"';
$dateRestriction .= ' AND (a.end_date >= "' . $today . '" OR a.end_date IS NULL)';
$conditions[] = $dateRestriction;
$customQuery->where($conditions);
}

/**
Expand Down
39 changes: 31 additions & 8 deletions com.civicrm.hrjobroles/CRM/Hrjobroles/BAO/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,26 @@ public function from($name, $mode, $side) {
}

public function where(&$query) {
$grouping = NULL;
foreach ($query->_params as $param) {
if ($this->isAJobRoleParam($param)) {
if ($query->_mode == CRM_Contact_BAO_QUERY::MODE_CONTACTS) {
$query->_useDistinct = TRUE;
}
$this->whereClauseSingle($param, $query);
}
$grouping = NULL;
$filterJobRoleByDate = $filterJobRole = FALSE;
foreach ($query->_params as $param) {
if ($this->isAJobRoleParam($param)) {
$filterJobRole = TRUE;
$paramHasDate = strpos($param[0], 'date');
if (!$filterJobRoleByDate && $paramHasDate) {
$filterJobRoleByDate = TRUE;
}

if ($query->_mode == CRM_Contact_BAO_QUERY::MODE_CONTACTS) {
$query->_useDistinct = TRUE;
}

$this->whereClauseSingle($param, $query);
}
}
if (!$filterJobRoleByDate && $filterJobRole) {
$this->applyJobRoleDateFiltering($query);
}
}

private function isAJobRoleParam($param) {
Expand All @@ -90,6 +101,18 @@ private function isAJobRoleParam($param) {
return false;
}

/**
* Applies date filtering for active job roles
*
* @param CRM_Contact_BAO_Query $query
*/
private function applyJobRoleDateFiltering(&$query) {
$today = date('Y-m-d H:i:s');
$dateRestriction = 'civicrm_hrjobroles.start_date <= "' . $today . '"';
$dateRestriction .= ' AND (civicrm_hrjobroles.end_date >= "' . $today . '" OR civicrm_hrjobroles.end_date IS NULL)';
$query->_where[] = [$dateRestriction];
}

private function whereClauseSingle($values, &$query) {
list($name, $op, $value, $grouping, $wildcard) = $values;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ class CRM_Hrjobroles_Test_Fabricator_HrJobRoles {
* @throws \Exception
*/
public static function fabricate($params) {
if (empty($params['start_date'])) {
$params['start_date'] = date('Y-m-d H:i:s');
}

$result = civicrm_api3(
'HrJobRoles',
'create',
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>Compucorp Ltd</author>
<email>info@compucorp.co.uk</email>
</maintainer>
<releaseDate>2018-07-24</releaseDate>
<version>1.7.9</version>
<releaseDate>2018-08-20</releaseDate>
<version>1.7.10</version>
<develStage>stable</develStage>
<compatibility>
<ver>4.7</ver>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ public function testTheGetActionReturnsMultipleJobRoles() {
$contact2 = ContactFabricator::fabricate();
$contract1 = HRJobContractFabricator::fabricate(['contact_id' => $contact1['id']]);
$contract2 = HRJobContractFabricator::fabricate(['contact_id' => $contact2['id']]);
$jobRole1 = HRJobRolesFabricator::fabricate(['job_contract_id' => $contract1['id'],]);
$jobRole2 = HRJobRolesFabricator::fabricate(['job_contract_id' => $contract1['id'],]);
$jobRole3 = HRJobRolesFabricator::fabricate(['job_contract_id' => $contract2['id'],]);
$jobRole1 = HRJobRolesFabricator::fabricate(['job_contract_id' => $contract1['id']]);
$jobRole2 = HRJobRolesFabricator::fabricate(['job_contract_id' => $contract1['id']]);
$jobRole3 = HRJobRolesFabricator::fabricate(['job_contract_id' => $contract2['id']]);

$contactJobRoles = civicrm_api3($this->entity, $this->action)['values'];

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>Compucorp Ltd</author>
<email>info@compucorp.co.uk</email>
</maintainer>
<releaseDate>2018-07-24</releaseDate>
<version>1.7.9</version>
<releaseDate>2018-08-20</releaseDate>
<version>1.7.10</version>
<develStage>stable</develStage>
<compatibility>
<ver>4.7</ver>
Expand Down
2 changes: 1 addition & 1 deletion contactaccessrights/js/dist/access-rights.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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>Compucorp Ltd</author>
<email>info@compucorp.co.uk</email>
</maintainer>
<releaseDate>2018-07-24</releaseDate>
<version>1.7.9</version>
<releaseDate>2018-08-20</releaseDate>
<version>1.7.10</version>
<develStage>stable</develStage>
<compatibility>
<ver>4.7</ver>
Expand Down
4 changes: 2 additions & 2 deletions contactsummary/js/dist/contact-summary.min.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ define([
var $httpBackend, $rootScope, $q, contractServiceMock, controller, ctrlConstructor,
jobRoleServiceMock, pubSub;

beforeEach(module('contactsummary', 'contactsummary.mocks'));
beforeEach(module('contactsummary', 'contactsummary.mocks', 'contact-summary.templates'));

beforeEach(module(function ($provide) {
$provide.factory('contractService', function () {
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>info@civicrm.org</email>
</maintainer>
<releaseDate>2018-07-24</releaseDate>
<version>1.7.9</version>
<releaseDate>2018-08-20</releaseDate>
<version>1.7.10</version>
<develStage>stable</develStage>
<compatibility>
<ver>4.7</ver>
Expand Down
2 changes: 1 addition & 1 deletion hrcareer/hrcareer.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,6 @@ function hrcareer_civicrm_pageRun($page) {
->addScriptFile('civicrm', 'js/jquery/jquery.crmRevisionLink.js', CRM_Core_Resources::DEFAULT_WEIGHT, 'html-header');

CRM_Core_Resources::singleton()
->addScriptFile('org.civicrm.hrcareer', 'js/hrcareer.js');
->addScriptFile('org.civicrm.hrcareer', 'js/dist/hrcareer.min.js', 1010);
}
}
Loading

0 comments on commit 350bb6a

Please sign in to comment.