From 8a065356eaf669405473e7528f785f249487a81e Mon Sep 17 00:00:00 2001 From: dheeyi william Date: Thu, 19 Jan 2017 10:27:02 -0400 Subject: [PATCH 1/9] HOR-2483 [MANTIS 21846] When output document is set to "Open the file" once click on the generated file link, the downloaded output document have an incorrect name. --- gulliver/system/class.g.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/gulliver/system/class.g.php b/gulliver/system/class.g.php index 6b593fb25..39e22b3ff 100644 --- a/gulliver/system/class.g.php +++ b/gulliver/system/class.g.php @@ -1232,8 +1232,10 @@ class G case 'txt': G::sendHeaders( $filename, 'text/html', $download, $downloadFileName ); break; - case 'doc': case 'pdf': + G::sendHeaders( $filename, 'application/pdf', $download, $downloadFileName ); + break; + case 'doc': case 'pm': case 'po': G::sendHeaders( $filename, 'application/octet-stream', $download, $downloadFileName ); @@ -1283,12 +1285,14 @@ class G { if ($download) { if ($downloadFileName == '') { - $aAux = explode( '/', $filename ); - $downloadFileName = $aAux[count( $aAux ) - 1]; + $aAux = explode('/', $filename); + $downloadFileName = $aAux[count($aAux) - 1]; } - header( 'Content-Disposition: attachment; filename="' . $downloadFileName . '"' ); + header('Content-Disposition: attachment; filename="' . $downloadFileName . '"'); + } else { + header('Content-Disposition: inline; filename="' . $downloadFileName . '"'); } - header( 'Content-Type: ' . $contentType ); + header('Content-Type: ' . $contentType); //if userAgent (BROWSER) is MSIE we need special headers to avoid MSIE behaivor. $userAgent = strtolower( $_SERVER['HTTP_USER_AGENT'] ); From 30b23873f38c07f3ae987e8821c5edc74f5202d8 Mon Sep 17 00:00:00 2001 From: dheeyi william Date: Fri, 20 Jan 2017 14:40:55 -0400 Subject: [PATCH 2/9] HOR-2462 [Zendesk 4018]- Grid is not able to delete data when populated by trigger --- workflow/engine/classes/class.pmDynaform.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/workflow/engine/classes/class.pmDynaform.php b/workflow/engine/classes/class.pmDynaform.php index 125166c24..d20c56dc1 100644 --- a/workflow/engine/classes/class.pmDynaform.php +++ b/workflow/engine/classes/class.pmDynaform.php @@ -1909,6 +1909,12 @@ class pmDynaform if ($validatorClass !== null) { $validatorClass->validatePost($post); } + //Clears the data in the appData for grids + if (array_key_exists($json->id, $this->fields) && $json->type === 'grid' && + !array_key_exists($json->id, $post) + ) { + $post[$json->variable] = array(array()); + } } }; $json = G::json_decode($this->record["DYN_CONTENT"]); From 7423148b862b0bc780502a6290608962c31c4105 Mon Sep 17 00:00:00 2001 From: dheeyi william Date: Thu, 26 Jan 2017 11:58:46 -0400 Subject: [PATCH 3/9] HOR-2527 CLONE - Array variable is not working in Mobile --- workflow/engine/classes/class.pmDynaform.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/workflow/engine/classes/class.pmDynaform.php b/workflow/engine/classes/class.pmDynaform.php index 125166c24..2ab1441e5 100644 --- a/workflow/engine/classes/class.pmDynaform.php +++ b/workflow/engine/classes/class.pmDynaform.php @@ -27,6 +27,7 @@ class pmDynaform private $context = array(); private $dataSources = null; private $databaseProviders = null; + private $propertyExclude = array(); public function __construct($fields = array()) { @@ -37,6 +38,7 @@ class pmDynaform $this->serverConf = &serverConf::getSingleton(); $this->isRTL = ($this->serverConf->isRtl(SYS_LANG)) ? 'true' : 'false'; $this->fields = $fields; + $this->propertyExclude = array('dataVariable'); $this->getDynaform(); $this->getDynaforms(); $this->synchronizeSubDynaform(); @@ -196,11 +198,13 @@ class pmDynaform if (is_string($value) && in_array(substr($value, 0, 2), $prefixs)) { $triggerValue = substr($value, 2); if (isset($this->fields["APP_DATA"][$triggerValue])) { - if ($key !== "dataVariable") { + if (!in_array($key, $this->propertyExclude)) { $json->{$key} = $this->fields["APP_DATA"][$triggerValue]; } } else { - $json->{$key} = ""; + if (!in_array($key, $this->propertyExclude)) { + $json->{$key} = ""; + } } } //set properties from 'formInstance' variable From a3a1a0c2e93a203c147ab9b47c2cc545460a90c1 Mon Sep 17 00:00:00 2001 From: dheeyi william Date: Thu, 26 Jan 2017 14:29:33 -0400 Subject: [PATCH 4/9] HOR-2527 CLONE - Array variable is not working in Mobile --- workflow/engine/classes/class.pmDynaform.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/workflow/engine/classes/class.pmDynaform.php b/workflow/engine/classes/class.pmDynaform.php index 2ab1441e5..1fb8638ab 100644 --- a/workflow/engine/classes/class.pmDynaform.php +++ b/workflow/engine/classes/class.pmDynaform.php @@ -27,7 +27,7 @@ class pmDynaform private $context = array(); private $dataSources = null; private $databaseProviders = null; - private $propertyExclude = array(); + private $propertiesToExclude = array(); public function __construct($fields = array()) { @@ -38,7 +38,7 @@ class pmDynaform $this->serverConf = &serverConf::getSingleton(); $this->isRTL = ($this->serverConf->isRtl(SYS_LANG)) ? 'true' : 'false'; $this->fields = $fields; - $this->propertyExclude = array('dataVariable'); + $this->propertiesToExclude = array('dataVariable'); $this->getDynaform(); $this->getDynaforms(); $this->synchronizeSubDynaform(); @@ -198,11 +198,11 @@ class pmDynaform if (is_string($value) && in_array(substr($value, 0, 2), $prefixs)) { $triggerValue = substr($value, 2); if (isset($this->fields["APP_DATA"][$triggerValue])) { - if (!in_array($key, $this->propertyExclude)) { + if (!in_array($key, $this->propertiesToExclude)) { $json->{$key} = $this->fields["APP_DATA"][$triggerValue]; } } else { - if (!in_array($key, $this->propertyExclude)) { + if (!in_array($key, $this->propertiesToExclude)) { $json->{$key} = ""; } } From eec8aa5f0843f8a18b91ad78846b91f05e58d385 Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Tue, 31 Jan 2017 17:43:50 -0400 Subject: [PATCH 5/9] HOR-2624 --- workflow/engine/classes/class.case.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/workflow/engine/classes/class.case.php b/workflow/engine/classes/class.case.php index 8a938d803..6d56a8544 100644 --- a/workflow/engine/classes/class.case.php +++ b/workflow/engine/classes/class.case.php @@ -4433,6 +4433,11 @@ class Cases /*----------------------------------********---------------------------------*/ $this->getExecuteTriggerProcess($sApplicationUID, 'REASSIGNED'); + + //Delete record of the table LIST_UNASSIGNED + $unassigned = new ListUnassigned(); + $unassigned->remove($sApplicationUID, $iDelegation); + return true; } From c2f92115264c292baa1dbf6c85148f67b285e024 Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Wed, 1 Feb 2017 12:28:15 -0400 Subject: [PATCH 6/9] HOR-2487 --- workflow/engine/classes/model/AppDelegation.php | 11 ++++++----- workflow/engine/methods/cases/cases_Step.php | 2 +- .../engine/src/ProcessMaker/Core/RoutingScreen.php | 3 +++ 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/workflow/engine/classes/model/AppDelegation.php b/workflow/engine/classes/model/AppDelegation.php index 7feeaa1df..abb930c01 100644 --- a/workflow/engine/classes/model/AppDelegation.php +++ b/workflow/engine/classes/model/AppDelegation.php @@ -442,6 +442,7 @@ class AppDelegation extends BaseAppDelegation //Get Task properties $task = TaskPeer::retrieveByPK( $this->getTasUid() ); + $aData = array(); $aData['TAS_UID'] = $this->getTasUid(); //Added to allow User defined Timing Control at Run time from Derivation screen if (isset( $sNextTasParam['NEXT_TASK']['TAS_TRANSFER_HIDDEN_FLY'] ) && $sNextTasParam['NEXT_TASK']['TAS_TRANSFER_HIDDEN_FLY'] == 'true') { @@ -471,7 +472,7 @@ class AppDelegation extends BaseAppDelegation //Calendar - Use the dates class to calculate dates $calendar = new calendar(); - $arrayCalendarData = array(); + $arrayCalendarData = $calendar->getCalendarData($aCalendarUID); if ($calendar->pmCalendarUid == "") { $calendar->getCalendar(null, $this->getProUid(), $this->getTasUid()); @@ -480,11 +481,11 @@ class AppDelegation extends BaseAppDelegation } //Due date - /*$iDueDate = $calendar->calculateDate( $this->getDelDelegateDate(), $aData['TAS_DURATION'], $aData['TAS_TIMEUNIT'] //hours or days, ( we only accept this two types or maybe weeks - );*/ - $dueDate = $calendar->dashCalculateDate($this->getDelDelegateDate(), $aData["TAS_DURATION"], $aData["TAS_TIMEUNIT"], $arrayCalendarData); + $initDate = $this->getDelDelegateDate(); + $timeZone = \ProcessMaker\Util\DateTime::convertUtcToTimeZone($initDate); + $dueDate = $calendar->dashCalculateDate($timeZone, $aData["TAS_DURATION"], $aData["TAS_TIMEUNIT"], $arrayCalendarData); - //Return + $dueDate = \ProcessMaker\Util\DateTime::convertDataToUtc($dueDate); return $dueDate; } diff --git a/workflow/engine/methods/cases/cases_Step.php b/workflow/engine/methods/cases/cases_Step.php index 8b1b1ff3f..24f085044 100644 --- a/workflow/engine/methods/cases/cases_Step.php +++ b/workflow/engine/methods/cases/cases_Step.php @@ -1009,7 +1009,7 @@ try { $aFields['TASK'][$sKey]['NEXT_TASK']['TAS_TRANSFER_HIDDEN_FLY'] = ""; if ($aValues['NEXT_TASK']['TAS_TRANSFER_FLY'] == 'true') { $aFields['TASK'][$sKey]['NEXT_TASK']['TAS_DURATION'] = ''; - $hoursSelected = $daysSelected = ''; + $hoursSelected = $daysSelected = $minSelected = ''; if ($aFields['TASK'][$sKey]['NEXT_TASK']['TAS_TIMEUNIT'] == 'HOURS') { $hoursSelected = "selected = 'selected'"; } else { diff --git a/workflow/engine/src/ProcessMaker/Core/RoutingScreen.php b/workflow/engine/src/ProcessMaker/Core/RoutingScreen.php index d6dd9c209..dafe61a98 100644 --- a/workflow/engine/src/ProcessMaker/Core/RoutingScreen.php +++ b/workflow/engine/src/ProcessMaker/Core/RoutingScreen.php @@ -65,6 +65,9 @@ class RoutingScreen extends \Derivation } else { $aDataMerged[$key]['NEXT_ROUTING'][] = $post[$i]; } + if (isset($post[$i]['NEXT_TASK'])) { + $aDataMerged[$key]['NEXT_TASK'] = $post[$i]['NEXT_TASK']; + } } } } From 88f31578f33c9dc84e9ab232073f46d4e561ecb7 Mon Sep 17 00:00:00 2001 From: Taylor Dondich Date: Mon, 6 Feb 2017 15:01:52 -0800 Subject: [PATCH 7/9] Add initial Jenkinsfile. --- Jenkinsfile | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 000000000..b567a76c9 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,96 @@ +#!groovy +node { + /** + * Branch should be in gitflow format. If not, then we'll abort. + */ + + if(!env.BRANCH_NAME.matches(/(feature|hotfix|release)\/.+/)) { + hipchatSend message: "${env.BRANCH_NAME} Build: Does not match gitflow naming. Aborted", room: 'engineering' + error "Job does not follow gitflow naming format." + } + // Parse out our short name and potential jira ticket. Null if not associated. If null, then for now we won't notify + // on jira ticket + def jiraTicket = env.BRANCH_NAME.find(/HOR-\d+/) + + def shortname = env.BRANCH_NAME.replace('/', '-').toLowerCase() + def dbSuffix = shortname.replace('-', '') + + echo "Building for ${env.BRANCH_NAME}" + + // Checkout source + checkout scm + + try { + stage('Start Notification') { + if(jiraTicket) { + jiraComment issueKey: jiraTicket, body: "Build ${env.BUILD_NUMBER} Starting.\nTicket will be updated once build is completed.\n\n${env.BUILD_URL}" + } + hipchatSend message: "${env.BRANCH_NAME} Build: ${env.BUILD_NUMBER} Starting.\n${env.BUILD_URL}", room: 'engineering' + } + + stage('Dependencies') { + echo "Running Composer" + sh 'composer install' + echo "Running rake" + sh 'rake' + } + + stage('Generate QA MySQL Databases') { + withCredentials([string(credentialsId: 'qa-rds-hostname', variable: 'rdsHostname'), usernamePassword(credentialsId: 'qa-rds-credentials', passwordVariable: 'rdsPassword', usernameVariable: 'rdsUsername')]) { + echo 'Dropping existing database and recreating.' + sh "mysql -h ${rdsHostname} -u ${rdsUsername} -p${rdsPassword} -e 'drop database if exists qa205${dbSuffix}; create database qa205${dbSuffix}'" + sh "mysql -h ${rdsHostname} -u ${rdsUsername} -p${rdsPassword} -e 'drop database if exists qa300${dbSuffix}; create database qa300${dbSuffix}'" + } + } + + stage('Publish to QA-205') { + sshagent(['processmaker-deploy']) { + echo 'Dropping existing files and recreating' + sh "ssh processmaker@build-qa205.processmaker.net 'rm -Rf /home/processmaker/${shortname}'" + sh "scp -r ./ processmaker@build-qa205.processmaker.net:~/${shortname}" + echo 'Creating necessary directories' + sh "ssh processmaker@build-qa205.processmaker.net 'mkdir -p /home/processmaker/${shortname}/workflow/engine/js/labels'" + sh "ssh processmaker@build-qa205.processmaker.net 'mkdir -p /home/processmaker/${shortname}/workflow/public_html/translations'" + } + } + + stage('Publish to QA-300') { + sshagent(['processmaker-deploy']) { + echo 'Dropping existing files and recreating' + sh "ssh processmaker@build-qa300.processmaker.net 'rm -Rf /home/processmaker/${shortname}'" + sh "scp -r ./ processmaker@build-qa300.processmaker.net:~/${shortname}" + echo 'Creating necessary directories' + sh "ssh processmaker@build-qa300.processmaker.net 'mkdir -p /home/processmaker/${shortname}/workflow/engine/js/labels'" + sh "ssh processmaker@build-qa300.processmaker.net 'mkdir -p /home/processmaker/${shortname}/workflow/public_html/translations'" + } + } + + stage('Success Notification') { + withCredentials([string(credentialsId: 'qa-rds-hostname', variable: 'rdsHostname'), usernamePassword(credentialsId: 'qa-rds-credentials', passwordVariable: 'rdsPassword', usernameVariable: 'rdsUsername')]) { + if(jiraTicket) { + jiraComment issueKey: jiraTicket, body: "" + + "Build ${env.BUILD_NUMBER} Completed.\n" + + "5.6 Build: https://${shortname}.qa205.processmaker.net\n" + + "Database Host: ${rdsHostname}\n" + + "Username: ${rdsUsername}\n" + + "Password: ${rdsPassword}\n" + + "Database: qa205${dbSuffix}\n\n" + + "7.0 Build: https://${shortname}.qa300.processmaker.net\n" + + "Database Host: ${rdsHostname}\n" + + "Username: ${rdsUsername}\n" + + "Password: ${rdsPassword}\n" + + "Database: qa300${dbSuffix}\n\n" + + "${env.BUILD_URL}" + } + hipchatSend room: 'engineering', message: "" + + "${env.BRANCH_NAME} Build: ${env.BUILD_NUMBER} Completed.\n" + + "${env.BUILD_URL}" + } + } + } catch(error) { + if(jiraTicket) { + jiraComment issueKey: jiraTicket, body: "Build ${env.BUILD_NUMBER} Failed: ${error}\n\n${env.BUILD_URL}" + } + hipchatSend message: "${env.BRANCH_NAME} Build: ${env.BUILD_NUMBER} Failed: ${error}\n${env.BUILD_URL}", room: 'engineering' + } +} \ No newline at end of file From b8ff3add6b77c7e83f63e6bfa8c60ab0b8e81b5b Mon Sep 17 00:00:00 2001 From: Taylor Dondich Date: Mon, 6 Feb 2017 15:05:42 -0800 Subject: [PATCH 8/9] Update Jenkins file to replace periods with dashes in shortname and dbsuffix naming. --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index b567a76c9..170ca59a7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -13,7 +13,7 @@ node { def jiraTicket = env.BRANCH_NAME.find(/HOR-\d+/) def shortname = env.BRANCH_NAME.replace('/', '-').toLowerCase() - def dbSuffix = shortname.replace('-', '') + def dbSuffix = shortname.replace('-', '').replace('.', '') echo "Building for ${env.BRANCH_NAME}" From db66e03953b84ccc7149652898619f64c24e5667 Mon Sep 17 00:00:00 2001 From: Taylor Dondich Date: Mon, 6 Feb 2017 15:15:01 -0800 Subject: [PATCH 9/9] Fix for the right place to add dashes. --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 170ca59a7..b10158ce7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -12,8 +12,8 @@ node { // on jira ticket def jiraTicket = env.BRANCH_NAME.find(/HOR-\d+/) - def shortname = env.BRANCH_NAME.replace('/', '-').toLowerCase() - def dbSuffix = shortname.replace('-', '').replace('.', '') + def shortname = env.BRANCH_NAME.replace('/', '-').replace('.', '-').toLowerCase() + def dbSuffix = shortname.replace('-', '') echo "Building for ${env.BRANCH_NAME}"