Merged in bugfix/HOR-3670-HQ (pull request #5924)

HOR-3670

Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
jonathan Quispe
2017-08-11 20:11:14 +00:00
committed by Julio Cesar Laura Avendaño
10 changed files with 958 additions and 1122 deletions

View File

@@ -1,70 +1,21 @@
<?php
/**
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2012 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 5304 Ventura Drive,
* Delray Beach, FL, 33484, USA, or email info@colosa.com.
*
*/
require_once "classes/model/Application.php";
require_once "classes/model/AppDelegation.php";
require_once "classes/model/AppThread.php";
require_once "classes/model/Content.php";
require_once "classes/model/Users.php";
require_once "classes/model/GroupUser.php";
require_once "classes/model/Task.php";
require_once "classes/model/TaskUser.php";
require_once "classes/model/Dynaform.php";
require_once "classes/model/ProcessVariables.php";
require_once "entities/SolrRequestData.php";
require_once "entities/SolrUpdateDocument.php";
require_once "entities/AppSolrQueue.php";
require_once "classes/model/AppSolrQueue.php";
/**
* Invalid search text for Solr exception
*
* @author Herbert Saal Gutierrez
*
*/
/**
* Application without Delegations exception
*
* @author Herbert Saal Gutierrez
*
* @category Colosa
* @copyright Copyright (c) 2005-2012 Colosa Inc. (http://www.colosa.com)
*/class ApplicationWithoutDelegationRecordsException extends Exception
*/
class ApplicationWithoutDelegationRecordsException extends Exception
{
// Redefine the exception so message isn't optional
public function __construct($message, $code = 0)
{
// some code
// make sure everything is assigned properly
parent::__construct ($message, $code);
}
// custom string representation of object
public function __toString()
{
return __CLASS__ . ": [{$this->code}]: {$this->message}\n";
}
// Redefine the exception so message isn't optional
public function __construct($message, $code = 0)
{
// some code
// make sure everything is assigned properly
parent::__construct($message, $code);
}
// custom string representation of object
public function __toString()
{
return __CLASS__ . ": [{$this->code}]: {$this->message}\n";
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,6 @@
<?php
class featuresDetail
class FeaturesDetail
{
public $featureName;
public $description = null;

View File

@@ -313,7 +313,7 @@ class PMLicensedFeatures
$addons = AddonsManagerPeer::doSelect($criteria);
foreach ($addons as $addon) {
$this->features[] = $addon->getAddonId();
$detail = new featuresDetail($addon->getAddonNick(), $addon->getAddonDescription());
$detail = new FeaturesDetail($addon->getAddonNick(), $addon->getAddonDescription());
$this->featuresDetails[$addon->getAddonId()] = $detail;
}
}

View File

@@ -12,18 +12,14 @@
* only if this copyright statement is not removed
*--------------------------------------------------*/
/**
*
* @package workflow.engine.classes
*/
/**
* This class is derived from the class archive, is imployed to use files .
* tar
*
* @package workflow.engine.classes
*
*/class tar_file extends archive
*/
class tar_file extends Archive
{
/**
@@ -31,9 +27,9 @@
*
* @param string $name
*/
public function tar_file ($name)
public function tar_file($name)
{
$this->archive( $name );
$this->archive($name);
$this->options['type'] = "tar";
}
@@ -43,50 +39,50 @@
*
* @return boolean
*/
public function create_tar ()
public function create_tar()
{
$pwd = getcwd();
chdir( $this->options['basedir'] );
chdir($this->options['basedir']);
foreach ($this->files as $current) {
if ($current['name'] == $this->options['name']) {
continue;
}
if (strlen( $current['name2'] ) > 99) {
$path = substr( $current['name2'], 0, strpos( $current['name2'], "/", strlen( $current['name2'] ) - 100 ) + 1 );
$current['name2'] = substr( $current['name2'], strlen( $path ) );
if (strlen( $path ) > 154 || strlen( $current['name2'] ) > 99) {
if (strlen($current['name2']) > 99) {
$path = substr($current['name2'], 0, strpos($current['name2'], "/", strlen($current['name2']) - 100) + 1);
$current['name2'] = substr($current['name2'], strlen($path));
if (strlen($path) > 154 || strlen($current['name2']) > 99) {
$this->error[] = "Could not add {$path}{$current['name2']} to archive because the filename is too long.";
continue;
}
}
$block = pack( "a100a8a8a8a12a12a8a1a100a6a2a32a32a8a8a155a12", $current['name2'], sprintf( "%07o", $current['stat'][2] ), sprintf( "%07o", $current['stat'][4] ), sprintf( "%07o", $current['stat'][5] ), sprintf( "%011o", $current['type'] == 2 ? 0 : $current['stat'][7] ), sprintf( "%011o", $current['stat'][9] ), " ", $current['type'], $current['type'] == 2 ? @readlink( $current['name'] ) : "", "ustar ", " ", "Unknown", "Unknown", "", "", ! empty( $path ) ? $path : "", "" );
$block = pack("a100a8a8a8a12a12a8a1a100a6a2a32a32a8a8a155a12", $current['name2'], sprintf("%07o", $current['stat'][2]), sprintf("%07o", $current['stat'][4]), sprintf("%07o", $current['stat'][5]), sprintf("%011o", $current['type'] == 2 ? 0 : $current['stat'][7]), sprintf("%011o", $current['stat'][9]), " ", $current['type'], $current['type'] == 2 ? @readlink($current['name']) : "", "ustar ", " ", "Unknown", "Unknown", "", "", !empty($path) ? $path : "", "");
$checksum = 0;
for ($i = 0; $i < 512; $i ++) {
$checksum += ord( substr( $block, $i, 1 ) );
for ($i = 0; $i < 512; $i++) {
$checksum += ord(substr($block, $i, 1));
}
$checksum = pack( "a8", sprintf( "%07o", $checksum ) );
$block = substr_replace( $block, $checksum, 148, 8 );
$checksum = pack("a8", sprintf("%07o", $checksum));
$block = substr_replace($block, $checksum, 148, 8);
if ($current['type'] == 2 || $current['stat'][7] == 0) {
$this->add_data( $block );
} elseif ($fp = @fopen( $current['name'], "rb" )) {
$this->add_data( $block );
while ($temp = fread( $fp, 1048576 )) {
$this->add_data( $temp );
$this->add_data($block);
} elseif ($fp = @fopen($current['name'], "rb")) {
$this->add_data($block);
while ($temp = fread($fp, 1048576)) {
$this->add_data($temp);
}
if ($current['stat'][7] % 512 > 0) {
$temp = "";
for ($i = 0; $i < 512 - $current['stat'][7] % 512; $i ++) {
for ($i = 0; $i < 512 - $current['stat'][7] % 512; $i++) {
$temp .= "\0";
}
$this->add_data( $temp );
$this->add_data($temp);
}
fclose( $fp );
fclose($fp);
} else {
$this->error[] = "Could not open file {$current['name']} for reading. It was not added.";
}
}
$this->add_data( pack( "a1024", "" ) );
chdir( $pwd );
$this->add_data(pack("a1024", ""));
chdir($pwd);
return 1;
}
@@ -95,58 +91,58 @@
*
* @return void
*/
public function extract_files ()
public function extract_files()
{
$pwd = getcwd();
chdir( $this->options['basedir'] );
chdir($this->options['basedir']);
if ($fp = $this->open_archive()) {
if ($this->options['inmemory'] == 1) {
$this->files = array ();
$this->files = array();
}
while ($block = fread( $fp, 512 )) {
$temp = unpack( "a100name/a8mode/a8uid/a8gid/a12size/a12mtime/a8checksum/a1type/a100symlink/a6magic/a2temp/a32temp/a32temp/a8temp/a8temp/a155prefix/a12temp", $block );
$file = array ('name' => $this->options['basedir'] . '/' . $temp['prefix'] . $temp['name'],'stat' => array (2 => $temp['mode'],4 => octdec( $temp['uid'] ),5 => octdec( $temp['gid'] ),7 => octdec( $temp['size'] ),9 => octdec( $temp['mtime'] )
),'checksum' => octdec( $temp['checksum'] ),'type' => $temp['type'],'magic' => $temp['magic']
while ($block = fread($fp, 512)) {
$temp = unpack("a100name/a8mode/a8uid/a8gid/a12size/a12mtime/a8checksum/a1type/a100symlink/a6magic/a2temp/a32temp/a32temp/a8temp/a8temp/a155prefix/a12temp", $block);
$file = array('name' => $this->options['basedir'] . '/' . $temp['prefix'] . $temp['name'], 'stat' => array(2 => $temp['mode'], 4 => octdec($temp['uid']), 5 => octdec($temp['gid']), 7 => octdec($temp['size']), 9 => octdec($temp['mtime'])
), 'checksum' => octdec($temp['checksum']), 'type' => $temp['type'], 'magic' => $temp['magic']
);
if ($file['checksum'] == 0x00000000) {
break;
} elseif (substr( $file['magic'], 0, 5 ) != "ustar") {
} elseif (substr($file['magic'], 0, 5) != "ustar") {
$this->error[] = "This script does not support extracting this type of tar file.";
break;
}
$block = substr_replace( $block, " ", 148, 8 );
$block = substr_replace($block, " ", 148, 8);
$checksum = 0;
for ($i = 0; $i < 512; $i ++) {
$checksum += ord( substr( $block, $i, 1 ) );
for ($i = 0; $i < 512; $i++) {
$checksum += ord(substr($block, $i, 1));
}
if ($file['checksum'] != $checksum) {
$this->error[] = "Could not extract from {$this->options['name']}, it is corrupt.";
}
if ($this->options['inmemory'] == 1) {
$file['data'] = fread( $fp, $file['stat'][7] );
fread( $fp, (512 - $file['stat'][7] % 512) == 512 ? 0 : (512 - $file['stat'][7] % 512) );
unset( $file['checksum'], $file['magic'] );
$file['data'] = fread($fp, $file['stat'][7]);
fread($fp, (512 - $file['stat'][7] % 512) == 512 ? 0 : (512 - $file['stat'][7] % 512));
unset($file['checksum'], $file['magic']);
$this->files[] = $file;
} elseif ($file['type'] == 5) {
if (! is_dir( $file['name'] )) {
if (!is_dir($file['name'])) {
//mkdir($file['name'], $file['stat'][2]);
mkdir( $file['name'], 0775 );
mkdir($file['name'], 0775);
}
} elseif ($this->options['overwrite'] == 0 && file_exists( $file['name'] )) {
} elseif ($this->options['overwrite'] == 0 && file_exists($file['name'])) {
$this->error[] = "{$file['name']} already exist.";
continue;
} elseif ($file['type'] == 2) {
symlink( $temp['symlink'], $file['name'] );
symlink($temp['symlink'], $file['name']);
//chmod($file['name'], $file['stat'][2]);
} elseif ($new = @fopen( $file['name'], "wb" )) {
fwrite( $new, fread( $fp, $file['stat'][7] ) );
} elseif ($new = @fopen($file['name'], "wb")) {
fwrite($new, fread($fp, $file['stat'][7]));
if ((512 - $file['stat'][7] % 512) != 512) {
fread( $fp, (512 - $file['stat'][7] % 512) );
fread($fp, (512 - $file['stat'][7] % 512));
}
//fread($fp, (512 - $file['stat'][7] % 512) == 512 ? 0 : (512 - $file['stat'][7] % 512));
fclose( $new );
fclose($new);
//chmod($file['name'], $file['stat'][2]);
chmod( $file['name'], 0777 );
chmod($file['name'], 0777);
$this->files[] = $file['name'];
} else {
$this->error[] = "Could not open {$file['name']} for writing.";
@@ -154,13 +150,13 @@
}
//chown($file['name'], $file['stat'][4]);
//chgrp($file['name'], $file['stat'][5]);
@touch( $file['name'], $file['stat'][9] );
unset( $file );
@touch($file['name'], $file['stat'][9]);
unset($file);
}
} else {
$this->error[] = "Could not open file {$this->options['name']}";
}
chdir( $pwd );
chdir($pwd);
}
/**
@@ -168,8 +164,8 @@
*
* @return void
*/
public function open_archive ()
public function open_archive()
{
return @fopen( $this->options['name'], "rb" );
return @fopen($this->options['name'], "rb");
}
}

View File

@@ -12,22 +12,18 @@
* only if this copyright statement is not removed
*--------------------------------------------------*/
/**
*
* @package workflow.engine.classes
*/
/**
* This class is derived from the class archive, is imployed to use files .
* zip
*
* @package workflow.engine.classes
*/class zip_file extends archive
*/
class zip_file extends Archive
{
public function zip_file ($name)
public function zip_file($name)
{
$this->archive( $name );
$this->archive($name);
$this->options['type'] = "zip";
}
@@ -37,77 +33,77 @@
*
* @return boolean
*/
public function create_zip ()
public function create_zip()
{
$files = 0;
$offset = 0;
$central = "";
if (! empty( $this->options['sfx'] )) {
if ($fp = @fopen( $this->options['sfx'], "rb" )) {
$temp = fread( $fp, filesize( $this->options['sfx'] ) );
fclose( $fp );
$this->add_data( $temp );
$offset += strlen( $temp );
unset( $temp );
if (!empty($this->options['sfx'])) {
if ($fp = @fopen($this->options['sfx'], "rb")) {
$temp = fread($fp, filesize($this->options['sfx']));
fclose($fp);
$this->add_data($temp);
$offset += strlen($temp);
unset($temp);
} else {
$this->error[] = "Could not open sfx module from {$this->options['sfx']}.";
}
}
$pwd = getcwd();
chdir( $this->options['basedir'] );
chdir($this->options['basedir']);
foreach ($this->files as $current) {
if ($current['name'] == $this->options['name']) {
continue;
}
$timedate = explode( " ", date( "Y n j G i s", $current['stat'][9] ) );
$timedate = explode(" ", date("Y n j G i s", $current['stat'][9]));
$timedate = ($timedate[0] - 1980 << 25) | ($timedate[1] << 21) | ($timedate[2] << 16) | ($timedate[3] << 11) | ($timedate[4] << 5) | ($timedate[5]);
$block = pack( "VvvvV", 0x04034b50, 0x000A, 0x0000, (isset( $current['method'] ) || $this->options['method'] == 0) ? 0x0000 : 0x0008, $timedate );
$block = pack("VvvvV", 0x04034b50, 0x000A, 0x0000, (isset($current['method']) || $this->options['method'] == 0) ? 0x0000 : 0x0008, $timedate);
if ($current['stat'][7] == 0 && $current['type'] == 5) {
$block .= pack( "VVVvv", 0x00000000, 0x00000000, 0x00000000, strlen( $current['name2'] ) + 1, 0x0000 );
$block .= pack("VVVvv", 0x00000000, 0x00000000, 0x00000000, strlen($current['name2']) + 1, 0x0000);
$block .= $current['name2'] . "/";
$this->add_data( $block );
$central .= pack( "VvvvvVVVVvvvvvVV", 0x02014b50, 0x0014, $this->options['method'] == 0 ? 0x0000 : 0x000A, 0x0000, (isset( $current['method'] ) || $this->options['method'] == 0) ? 0x0000 : 0x0008, $timedate, 0x00000000, 0x00000000, 0x00000000, strlen( $current['name2'] ) + 1, 0x0000, 0x0000, 0x0000, 0x0000, $current['type'] == 5 ? 0x00000010 : 0x00000000, $offset );
$this->add_data($block);
$central .= pack("VvvvvVVVVvvvvvVV", 0x02014b50, 0x0014, $this->options['method'] == 0 ? 0x0000 : 0x000A, 0x0000, (isset($current['method']) || $this->options['method'] == 0) ? 0x0000 : 0x0008, $timedate, 0x00000000, 0x00000000, 0x00000000, strlen($current['name2']) + 1, 0x0000, 0x0000, 0x0000, 0x0000, $current['type'] == 5 ? 0x00000010 : 0x00000000, $offset);
$central .= $current['name2'] . "/";
$files ++;
$offset += (31 + strlen( $current['name2'] ));
$files++;
$offset += (31 + strlen($current['name2']));
} elseif ($current['stat'][7] == 0) {
$block .= pack( "VVVvv", 0x00000000, 0x00000000, 0x00000000, strlen( $current['name2'] ), 0x0000 );
$block .= pack("VVVvv", 0x00000000, 0x00000000, 0x00000000, strlen($current['name2']), 0x0000);
$block .= $current['name2'];
$this->add_data( $block );
$central .= pack( "VvvvvVVVVvvvvvVV", 0x02014b50, 0x0014, $this->options['method'] == 0 ? 0x0000 : 0x000A, 0x0000, (isset( $current['method'] ) || $this->options['method'] == 0) ? 0x0000 : 0x0008, $timedate, 0x00000000, 0x00000000, 0x00000000, strlen( $current['name2'] ), 0x0000, 0x0000, 0x0000, 0x0000, $current['type'] == 5 ? 0x00000010 : 0x00000000, $offset );
$this->add_data($block);
$central .= pack("VvvvvVVVVvvvvvVV", 0x02014b50, 0x0014, $this->options['method'] == 0 ? 0x0000 : 0x000A, 0x0000, (isset($current['method']) || $this->options['method'] == 0) ? 0x0000 : 0x0008, $timedate, 0x00000000, 0x00000000, 0x00000000, strlen($current['name2']), 0x0000, 0x0000, 0x0000, 0x0000, $current['type'] == 5 ? 0x00000010 : 0x00000000, $offset);
$central .= $current['name2'];
$files ++;
$offset += (30 + strlen( $current['name2'] ));
} elseif ($fp = @fopen( $current['name'], "rb" )) {
$temp = fread( $fp, $current['stat'][7] );
fclose( $fp );
$crc32 = G::encryptCrc32( $temp );
if (! isset( $current['method'] ) && $this->options['method'] == 1) {
$temp = gzcompress( $temp, $this->options['level'] );
$size = strlen( $temp ) - 6;
$temp = substr( $temp, 2, $size );
$files++;
$offset += (30 + strlen($current['name2']));
} elseif ($fp = @fopen($current['name'], "rb")) {
$temp = fread($fp, $current['stat'][7]);
fclose($fp);
$crc32 = G::encryptCrc32($temp);
if (!isset($current['method']) && $this->options['method'] == 1) {
$temp = gzcompress($temp, $this->options['level']);
$size = strlen($temp) - 6;
$temp = substr($temp, 2, $size);
} else {
$size = strlen( $temp );
$size = strlen($temp);
}
$block .= pack( "VVVvv", $crc32, $size, $current['stat'][7], strlen( $current['name2'] ), 0x0000 );
$block .= pack("VVVvv", $crc32, $size, $current['stat'][7], strlen($current['name2']), 0x0000);
$block .= $current['name2'];
$this->add_data( $block );
$this->add_data( $temp );
unset( $temp );
$central .= pack( "VvvvvVVVVvvvvvVV", 0x02014b50, 0x0014, $this->options['method'] == 0 ? 0x0000 : 0x000A, 0x0000, (isset( $current['method'] ) || $this->options['method'] == 0) ? 0x0000 : 0x0008, $timedate, $crc32, $size, $current['stat'][7], strlen( $current['name2'] ), 0x0000, 0x0000, 0x0000, 0x0000, 0x00000000, $offset );
$this->add_data($block);
$this->add_data($temp);
unset($temp);
$central .= pack("VvvvvVVVVvvvvvVV", 0x02014b50, 0x0014, $this->options['method'] == 0 ? 0x0000 : 0x000A, 0x0000, (isset($current['method']) || $this->options['method'] == 0) ? 0x0000 : 0x0008, $timedate, $crc32, $size, $current['stat'][7], strlen($current['name2']), 0x0000, 0x0000, 0x0000, 0x0000, 0x00000000, $offset);
$central .= $current['name2'];
$files ++;
$offset += (30 + strlen( $current['name2'] ) + $size);
$files++;
$offset += (30 + strlen($current['name2']) + $size);
} else {
$this->error[] = "Could not open file {$current['name']} for reading. It was not added.";
}
}
$this->add_data( $central );
$this->add_data( pack( "VvvvvVVv", 0x06054b50, 0x0000, 0x0000, $files, $files, strlen( $central ), $offset, ! empty( $this->options['comment'] ) ? strlen( $this->options['comment'] ) : 0x0000 ) );
if (! empty( $this->options['comment'] )) {
$this->add_data( $this->options['comment'] );
$this->add_data($central);
$this->add_data(pack("VvvvvVVv", 0x06054b50, 0x0000, 0x0000, $files, $files, strlen($central), $offset, !empty($this->options['comment']) ? strlen($this->options['comment']) : 0x0000));
if (!empty($this->options['comment'])) {
$this->add_data($this->options['comment']);
}
chdir( $pwd );
chdir($pwd);
return 1;
}
}

View File

@@ -9,11 +9,8 @@ use ProcessMaker\Plugins\PluginRegistry;
use Exception;
use WsBase;
use RBAC;
use Applications;
/**
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*/
class Cases
{
private $formatFieldNameInUppercase = true;
@@ -261,7 +258,7 @@ class Cases
$newerThan = (!empty($dataList['newerThan']))? $dataList['newerThan'] : '';
$oldestThan = (!empty($dataList['oldestthan']))? $dataList['oldestthan'] : '';
$apps = new \Applications();
$apps = new Applications();
$response = $apps->getAll(
$userUid,
$start,
@@ -335,7 +332,7 @@ class Cases
$dateTo = (!empty( $dataList["dateTo"] )) ? substr( $dataList["dateTo"], 0, 10 ) : "";
$filterStatus = isset( $dataList["filterStatus"] ) ? strtoupper( $dataList["filterStatus"] ) : "";
$apps = new \Applications();
$apps = new Applications();
$response = $apps->searchAll(
$userId,
$start,
@@ -2317,7 +2314,7 @@ class Cases
$tas_uid = $aCaseField["TAS_UID"];
$pro_uid = $aCaseField["PRO_UID"];
$oApplication = new \Applications();
$oApplication = new Applications();
$aField = $oApplication->getSteps($app_uid, $del_index, $tas_uid, $pro_uid);
return $aField;