Merge remote-tracking branch 'origin/feature/HOR-3559' into feature/HOR-3629
This commit is contained in:
@@ -52,58 +52,43 @@ class Common
|
||||
}
|
||||
|
||||
$files = glob("$path/$singlePattern", $flags);
|
||||
$dirs = glob("$path/*", GLOB_MARK|GLOB_ONLYDIR|GLOB_NOSORT);
|
||||
$dirs = glob("$path/*", GLOB_MARK | GLOB_ONLYDIR | GLOB_NOSORT);
|
||||
|
||||
if(is_array($dirs)){
|
||||
if (is_array($dirs)) {
|
||||
foreach ($dirs as $dir) {
|
||||
$files = array_merge($files, self::rglob("$dir/$singlePattern", $flags));
|
||||
}
|
||||
}
|
||||
|
||||
if ($onlyFiles) {
|
||||
$files = array_filter($files, function($v) { return is_dir($v) ? false : true;});
|
||||
$files = array_filter($files, function ($v) {
|
||||
return is_dir($v) ? false : true;
|
||||
});
|
||||
}
|
||||
|
||||
return $files;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the last version given a pattern of file name
|
||||
*
|
||||
* @param string $pattern a valid pattern for glob(...) native function
|
||||
* @param int $flag php flags for glob(...) native function
|
||||
* @return int|string
|
||||
*
|
||||
* Example:
|
||||
* - Given the following files inside a directory:
|
||||
* /example/path/myApplication-v1.tar
|
||||
* /example/path/myApplication-v2.tar
|
||||
* /example/path/myApplication-v3.tar
|
||||
* /example/path/myApplication-v5.tar
|
||||
* /example/path/myApplication-v7.tar
|
||||
*
|
||||
* $lastVer = ProcessMaker\Util\Common::getLastVersion("/example/path/myApplication-*.tar");
|
||||
*
|
||||
* It will returns: 7
|
||||
* This method get the last version of file when exists a special characters
|
||||
* @param $pattern
|
||||
* @param $extension
|
||||
* @param int $flag
|
||||
* @return int
|
||||
*/
|
||||
public static function getLastVersion($pattern, $flag = 0)
|
||||
public static function getLastVersionSpecialCharacters($dir, $pattern, $extension, $flag = 0)
|
||||
{
|
||||
$files = glob($pattern, $flag);
|
||||
$files = glob($dir . quotemeta($pattern) . "-*." . $extension, $flag);
|
||||
$maxVersion = 0;
|
||||
|
||||
$pattern = str_replace("*", '([0-9\.]+)', basename($pattern));
|
||||
|
||||
$pattern = preg_quote(basename($pattern)) . '-([0-9\.]+)pmx';
|
||||
foreach ($files as $file) {
|
||||
$filename = basename($file);
|
||||
|
||||
if (preg_match('/'.$pattern.'/', $filename, $match)) {
|
||||
|
||||
if (preg_match('/' . $pattern . '/', $filename, $match)) {
|
||||
if ($maxVersion < $match[1]) {
|
||||
$maxVersion = $match[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $maxVersion;
|
||||
}
|
||||
|
||||
@@ -141,8 +126,8 @@ class Common
|
||||
}
|
||||
|
||||
while ($parent_folder_path = array_pop($folder_path)) {
|
||||
if (! @is_dir($parent_folder_path)) {
|
||||
if (! @mkdir($parent_folder_path, $rights)) {
|
||||
if (!@is_dir($parent_folder_path)) {
|
||||
if (!@mkdir($parent_folder_path, $rights)) {
|
||||
umask($oldumask);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,8 @@
|
||||
/**
|
||||
* require_once pakeFunction.php
|
||||
*/
|
||||
require_once( PATH_THIRDPARTY . 'pake' . PATH_SEP . 'pakeFunction.php');
|
||||
require_once( PATH_THIRDPARTY . 'pake' . PATH_SEP . 'pakeGetopt.class.php');
|
||||
require_once( PATH_CORE . 'config' . PATH_SEP . 'environments.php');
|
||||
|
||||
// trap -V before pake
|
||||
|
||||
@@ -638,7 +638,7 @@ class G
|
||||
* @param string $strSkin
|
||||
* @return void
|
||||
*/
|
||||
public function RenderPage ($strTemplate = "default", $strSkin = SYS_SKIN, $objContent = null, $layout = '')
|
||||
public static function RenderPage ($strTemplate = "default", $strSkin = SYS_SKIN, $objContent = null, $layout = '')
|
||||
{
|
||||
global $G_CONTENT;
|
||||
global $G_TEMPLATE;
|
||||
@@ -3238,20 +3238,34 @@ class G
|
||||
* @param (array) additional characteres map
|
||||
*
|
||||
*/
|
||||
public function inflect ($string, $replacement = '_', $map = array())
|
||||
public function inflect($string, $replacement = '_', $map = array())
|
||||
{
|
||||
if (is_array( $replacement )) {
|
||||
if (is_array($replacement)) {
|
||||
$map = $replacement;
|
||||
$replacement = '_';
|
||||
}
|
||||
|
||||
$quotedReplacement = preg_quote( $replacement, '/' );
|
||||
$quotedReplacement = preg_quote($replacement, '/');
|
||||
|
||||
$default = array ('/à|á|å|â/' => 'a','/è|é|ê|ẽ|ë/' => 'e','/ì|í|î/' => 'i','/ò|ó|ô|ø/' => 'o','/ù|ú|ů|û/' => 'u','/ç/' => 'c','/ñ/' => 'n','/ä|æ/' => 'ae','/ö/' => 'oe','/ü/' => 'ue','/Ä/' => 'Ae','/Ü/' => 'Ue','/Ö/' => 'Oe','/ß/' => 'ss','/\.|\,|\:|\-|\\|\//' => " ",'/\\s+/' => $replacement
|
||||
);
|
||||
$default = array('/à|á|å|â/' => 'a',
|
||||
'/è|é|ê|ẽ|ë/' => 'e',
|
||||
'/ì|í|î/' => 'i',
|
||||
'/ò|ó|ô|ø/' => 'o',
|
||||
'/ù|ú|ů|û/' => 'u',
|
||||
'/ç/' => 'c',
|
||||
'/ñ/' => 'n',
|
||||
'/ä|æ/' => 'ae',
|
||||
'/ö/' => 'oe',
|
||||
'/ü/' => 'ue',
|
||||
'/Ä/' => 'Ae',
|
||||
'/Ü/' => 'Ue',
|
||||
'/Ö/' => 'Oe',
|
||||
'/ß/' => 'ss',
|
||||
'/[\.|\,|\+|\"|\:|\;|\-|\\|\/]/' => " ",
|
||||
'/\\s+/' => $replacement);
|
||||
|
||||
$map = array_merge( $default, $map );
|
||||
return preg_replace( array_keys( $map ), array_values( $map ), $string );
|
||||
$map = array_merge($default, $map);
|
||||
return preg_replace(array_keys($map), array_values($map), $string);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -5736,7 +5750,7 @@ class G
|
||||
*
|
||||
* @return showRes($string)
|
||||
*/
|
||||
public function outRes ($sInfVar)
|
||||
public static function outRes ($sInfVar)
|
||||
{
|
||||
echo $sInfVar;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ class PMException extends Exception
|
||||
return __CLASS__ . ": [{$this->code}]: {$this->message}\n";
|
||||
}
|
||||
|
||||
public function registerErrorLog($error, $token){
|
||||
public static function registerErrorLog($error, $token){
|
||||
$ws = (defined("SYS_SYS"))? SYS_SYS : "Wokspace Undefined";
|
||||
Bootstrap::registerMonolog('ExceptionCron', 400, $error->getMessage(), array('token'=>$token), $ws, 'processmaker.log');
|
||||
}
|
||||
|
||||
@@ -155,6 +155,23 @@ class RBAC
|
||||
'emailsAjax.php' => array(
|
||||
'MessageList' => array('PM_SETUP', 'PM_SETUP_LOGS'),
|
||||
'updateStatusMessage' => array('PM_SETUP', 'PM_SETUP_LOGS'),
|
||||
),
|
||||
'processCategory_Ajax.php' => array(
|
||||
'processCategoryList' => array('PM_SETUP', 'PM_SETUP_PROCESS_CATEGORIES'),
|
||||
'updatePageSize' => array('PM_SETUP', 'PM_SETUP_PROCESS_CATEGORIES'),
|
||||
'checkCategoryName' => array('PM_SETUP', 'PM_SETUP_PROCESS_CATEGORIES'),
|
||||
'saveNewCategory' => array('PM_SETUP', 'PM_SETUP_PROCESS_CATEGORIES'),
|
||||
'checkEditCategoryName' => array('PM_SETUP', 'PM_SETUP_PROCESS_CATEGORIES'),
|
||||
'updateCategory' => array('PM_SETUP', 'PM_SETUP_PROCESS_CATEGORIES'),
|
||||
'canDeleteCategory' => array('PM_SETUP', 'PM_SETUP_PROCESS_CATEGORIES'),
|
||||
'deleteCategory' => array('PM_SETUP', 'PM_SETUP_PROCESS_CATEGORIES')
|
||||
),
|
||||
'emailServerAjax.php' => array(
|
||||
'INS' => array('PM_SETUP'),
|
||||
'UPD' => array('PM_SETUP'),
|
||||
'DEL' => array('PM_SETUP'),
|
||||
'LST' => array('PM_SETUP'),
|
||||
'TEST' => array('PM_SETUP')
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
$option = (isset($_POST["option"]))? $_POST["option"] : "";
|
||||
|
||||
$response = array();
|
||||
|
||||
$RBAC->allows(basename(__FILE__), $option);
|
||||
switch ($option) {
|
||||
case "INS":
|
||||
$arrayData = array();
|
||||
|
||||
@@ -21,14 +21,18 @@
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*/
|
||||
if ($RBAC->userCanAccess( 'PM_SETUP' ) != 1 && $RBAC->userCanAccess( 'PM_SETUP_ADVANCE' ) != 1) {
|
||||
G::SendTemporalMessage( 'krlos', 'error', 'labels' );
|
||||
die();
|
||||
|
||||
use ProcessMaker\Exception\RBACException;
|
||||
|
||||
/** @var RBAC $RBAC */
|
||||
global $RBAC;
|
||||
if ($RBAC->userCanAccess('PM_SETUP') != 1 && $RBAC->userCanAccess('PM_SETUP_PROCESS_CATEGORIES') != 1) {
|
||||
throw new RBACException('ID_USER_HAVENT_RIGHTS_PAGE', -1);
|
||||
}
|
||||
|
||||
$c = new Configurations();
|
||||
$configPage = $c->getConfiguration( 'processCategoryList', 'pageSize', '', $_SESSION['USER_LOGGED'] );
|
||||
$Config['pageSize'] = isset( $configPage['pageSize'] ) ? $configPage['pageSize'] : 20;
|
||||
$configPage = $c->getConfiguration('processCategoryList', 'pageSize', '', $_SESSION['USER_LOGGED']);
|
||||
$Config['pageSize'] = isset($configPage['pageSize']) ? $configPage['pageSize'] : 20;
|
||||
|
||||
$G_MAIN_MENU = 'workflow';
|
||||
$G_SUB_MENU = 'processCategory';
|
||||
@@ -37,9 +41,9 @@ $G_ID_SUB_MENU_SELECTED = '';
|
||||
|
||||
$G_PUBLISH = new Publisher();
|
||||
|
||||
$oHeadPublisher = & headPublisher::getSingleton();
|
||||
$oHeadPublisher->addExtJsScript( 'processCategory/processCategoryList', false ); //adding a javascript file .js
|
||||
$oHeadPublisher->addContent( 'processCategory/processCategoryList' ); //adding a html file .html.
|
||||
$oHeadPublisher->assign( 'FORMATS', $c->getFormats() );
|
||||
$oHeadPublisher->assign( 'CONFIG', $Config );
|
||||
G::RenderPage( 'publish', 'extJs' );
|
||||
$oHeadPublisher = &headPublisher::getSingleton();
|
||||
$oHeadPublisher->addExtJsScript('processCategory/processCategoryList', false); //adding a javascript file .js
|
||||
$oHeadPublisher->addContent('processCategory/processCategoryList'); //adding a html file .html.
|
||||
$oHeadPublisher->assign('FORMATS', $c->getFormats());
|
||||
$oHeadPublisher->assign('CONFIG', $Config);
|
||||
G::RenderPage('publish', 'extJs');
|
||||
@@ -22,158 +22,171 @@
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*/
|
||||
|
||||
if (isset( $_REQUEST['action'] )) {
|
||||
use ProcessMaker\Exception\RBACException;
|
||||
|
||||
/** @var RBAC $RBAC */
|
||||
global $RBAC;
|
||||
switch ($RBAC->userCanAccess('PM_LOGIN')) {
|
||||
case -2:
|
||||
throw new RBACException('ID_USER_HAVENT_RIGHTS_SYSTEM', -2);
|
||||
break;
|
||||
case -1:
|
||||
throw new RBACException('ID_USER_HAVENT_RIGHTS_PAGE', -1);
|
||||
break;
|
||||
}
|
||||
$RBAC->allows(basename(__FILE__), $_REQUEST['action']);
|
||||
|
||||
if (isset($_REQUEST['action'])) {
|
||||
switch ($_REQUEST['action']) {
|
||||
case 'processCategoryList':
|
||||
$co = new Configurations();
|
||||
$config = $co->getConfiguration( 'processCategoryList', 'pageSize', '', $_SESSION['USER_LOGGED'] );
|
||||
$limit_size = isset( $config['pageSize'] ) ? $config['pageSize'] : 20;
|
||||
$config = $co->getConfiguration('processCategoryList', 'pageSize', '', $_SESSION['USER_LOGGED']);
|
||||
$limit_size = isset($config['pageSize']) ? $config['pageSize'] : 20;
|
||||
|
||||
$start = isset( $_POST['start'] ) ? $_POST['start'] : 0;
|
||||
$limit = isset( $_POST['limit'] ) ? $_POST['limit'] : $limit_size;
|
||||
$filter = isset( $_REQUEST['textFilter'] ) ? $_REQUEST['textFilter'] : '';
|
||||
$dir = isset( $_POST['dir'] ) ? $_POST['dir'] : 'ASC';
|
||||
$sort = isset( $_POST['sort'] ) ? $_POST['sort'] : 'CATEGORY_NAME';
|
||||
$start = isset($_POST['start']) ? $_POST['start'] : 0;
|
||||
$limit = isset($_POST['limit']) ? $_POST['limit'] : $limit_size;
|
||||
$filter = isset($_REQUEST['textFilter']) ? $_REQUEST['textFilter'] : '';
|
||||
$dir = isset($_POST['dir']) ? $_POST['dir'] : 'ASC';
|
||||
$sort = isset($_POST['sort']) ? $_POST['sort'] : 'CATEGORY_NAME';
|
||||
|
||||
$oCriteria = new Criteria( 'workflow' );
|
||||
$oCriteria->addSelectColumn( 'COUNT(*) AS CNT' );
|
||||
$oCriteria->add( ProcessCategoryPeer::CATEGORY_UID, '', Criteria::NOT_EQUAL );
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->addSelectColumn('COUNT(*) AS CNT');
|
||||
$oCriteria->add(ProcessCategoryPeer::CATEGORY_UID, '', Criteria::NOT_EQUAL);
|
||||
if ($filter != '') {
|
||||
$oCriteria->add( ProcessCategoryPeer::CATEGORY_NAME, '%' . $filter . '%', Criteria::LIKE );
|
||||
$oCriteria->add(ProcessCategoryPeer::CATEGORY_NAME, '%' . $filter . '%', Criteria::LIKE);
|
||||
}
|
||||
$oDat = ProcessCategoryPeer::doSelectRS( $oCriteria );
|
||||
$oDat->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$oDat = ProcessCategoryPeer::doSelectRS($oCriteria);
|
||||
$oDat->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDat->next();
|
||||
$row = $oDat->getRow();
|
||||
$total_categories = $row['CNT'];
|
||||
|
||||
$oCriteria->clear();
|
||||
$oCriteria->addSelectColumn( ProcessCategoryPeer::CATEGORY_UID );
|
||||
$oCriteria->addSelectColumn( ProcessCategoryPeer::CATEGORY_NAME );
|
||||
$oCriteria->add( ProcessCategoryPeer::CATEGORY_UID, '', Criteria::NOT_EQUAL );
|
||||
$oCriteria->addSelectColumn(ProcessCategoryPeer::CATEGORY_UID);
|
||||
$oCriteria->addSelectColumn(ProcessCategoryPeer::CATEGORY_NAME);
|
||||
$oCriteria->add(ProcessCategoryPeer::CATEGORY_UID, '', Criteria::NOT_EQUAL);
|
||||
if ($filter != '') {
|
||||
$oCriteria->add( ProcessCategoryPeer::CATEGORY_NAME, '%' . $filter . '%', Criteria::LIKE );
|
||||
$oCriteria->add(ProcessCategoryPeer::CATEGORY_NAME, '%' . $filter . '%', Criteria::LIKE);
|
||||
}
|
||||
|
||||
|
||||
//SQL Injection via 'sort' parameter
|
||||
if (!in_array($sort, array_merge(ProcessCategoryPeer::getFieldNames(BasePeer::TYPE_FIELDNAME), ['TOTAL_PROCESSES']))) {
|
||||
throw new Exception(G::LoadTranslation('ID_INVALID_VALUE_FOR', array('$sort')));
|
||||
}
|
||||
|
||||
if ($dir == "DESC") {
|
||||
$oCriteria->addDescendingOrderByColumn($sort);
|
||||
} else {
|
||||
$oCriteria->addAscendingOrderByColumn($sort);
|
||||
}
|
||||
|
||||
$oCriteria->setLimit( $limit );
|
||||
$oCriteria->setOffset( $start );
|
||||
$oDataset = ProcessCategoryPeer::doSelectRS( $oCriteria );
|
||||
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$oCriteria->setLimit($limit);
|
||||
$oCriteria->setOffset($start);
|
||||
$oDataset = ProcessCategoryPeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
$proc = new Process();
|
||||
$aProcess = $proc->getAllProcessesByCategory();
|
||||
$result = "";
|
||||
$aCat = array ();
|
||||
$result = [];
|
||||
$aCat = array();
|
||||
while ($oDataset->next()) {
|
||||
$aCat[] = $oDataset->getRow();
|
||||
$index = sizeof( $aCat ) - 1;
|
||||
$aCat[$index]['TOTAL_PROCESSES'] = isset( $aProcess[$aCat[$index]['CATEGORY_UID']] ) ? $aProcess[$aCat[$index]['CATEGORY_UID']] : 0;
|
||||
$index = sizeof($aCat) - 1;
|
||||
$aCat[$index]['TOTAL_PROCESSES'] = isset($aProcess[$aCat[$index]['CATEGORY_UID']]) ? $aProcess[$aCat[$index]['CATEGORY_UID']] : 0;
|
||||
}
|
||||
$result['data'] = $aCat;
|
||||
$result['totalCount'] = $total_categories;
|
||||
echo G::json_encode( $result );
|
||||
echo G::json_encode($result);
|
||||
break;
|
||||
case 'updatePageSize':
|
||||
$c = new Configurations();
|
||||
$arr['pageSize'] = $_REQUEST['size'];
|
||||
$arr['dateSave'] = date( 'Y-m-d H:i:s' );
|
||||
$config = Array ();
|
||||
$arr['dateSave'] = date('Y-m-d H:i:s');
|
||||
$config = Array();
|
||||
$config[] = $arr;
|
||||
$c->aConfig = $config;
|
||||
$c->saveConfig( 'processCategoryList', 'pageSize', '', $_SESSION['USER_LOGGED'] );
|
||||
$c->saveConfig('processCategoryList', 'pageSize', '', $_SESSION['USER_LOGGED']);
|
||||
echo '{success: true}';
|
||||
break;
|
||||
case 'checkCategoryName':
|
||||
require_once 'classes/model/ProcessCategory.php';
|
||||
$catName = $_REQUEST['cat_name'];
|
||||
$oCriteria = new Criteria( 'workflow' );
|
||||
$oCriteria->addSelectColumn( ProcessCategoryPeer::CATEGORY_NAME );
|
||||
$oCriteria->add( ProcessCategoryPeer::CATEGORY_NAME, $catName );
|
||||
$oDataset = ProcessCategoryPeer::doSelectRS( $oCriteria );
|
||||
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->addSelectColumn(ProcessCategoryPeer::CATEGORY_NAME);
|
||||
$oCriteria->add(ProcessCategoryPeer::CATEGORY_NAME, $catName);
|
||||
$oDataset = ProcessCategoryPeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
$row = $oDataset->getRow();
|
||||
$response = isset( $row['CATEGORY_NAME'] ) ? 'false' : 'true';
|
||||
$response = isset($row['CATEGORY_NAME']) ? 'false' : 'true';
|
||||
echo $response;
|
||||
break;
|
||||
case 'saveNewCategory':
|
||||
try {
|
||||
require_once 'classes/model/ProcessCategory.php';
|
||||
$catName = trim( $_REQUEST['category'] );
|
||||
$catName = trim($_REQUEST['category']);
|
||||
$pcat = new ProcessCategory();
|
||||
$pcat->setNew( true );
|
||||
$pcat->setCategoryUid( G::GenerateUniqueID() );
|
||||
$pcat->setCategoryName( $catName );
|
||||
$pcat->setNew(true);
|
||||
$pcat->setCategoryUid(G::GenerateUniqueID());
|
||||
$pcat->setCategoryName($catName);
|
||||
$pcat->save();
|
||||
G::auditLog("CreateCategory", "Category Name: ".$catName);
|
||||
G::auditLog("CreateCategory", "Category Name: " . $catName);
|
||||
echo '{success: true}';
|
||||
} catch (Exception $ex) {
|
||||
$varEcho = '{success: false, error: ' . $ex->getMessage() . '}';
|
||||
G::outRes( $varEcho );
|
||||
G::outRes($varEcho);
|
||||
}
|
||||
break;
|
||||
case 'checkEditCategoryName':
|
||||
require_once 'classes/model/ProcessCategory.php';
|
||||
$catUID = $_REQUEST['cat_uid'];
|
||||
$catName = $_REQUEST['cat_name'];
|
||||
$oCriteria = new Criteria( 'workflow' );
|
||||
$oCriteria->addSelectColumn( ProcessCategoryPeer::CATEGORY_NAME );
|
||||
$oCriteria->add( ProcessCategoryPeer::CATEGORY_NAME, $catName );
|
||||
$oCriteria->add( ProcessCategoryPeer::CATEGORY_UID, $catUID, Criteria::NOT_EQUAL );
|
||||
$oDataset = ProcessCategoryPeer::doSelectRS( $oCriteria );
|
||||
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->addSelectColumn(ProcessCategoryPeer::CATEGORY_NAME);
|
||||
$oCriteria->add(ProcessCategoryPeer::CATEGORY_NAME, $catName);
|
||||
$oCriteria->add(ProcessCategoryPeer::CATEGORY_UID, $catUID, Criteria::NOT_EQUAL);
|
||||
$oDataset = ProcessCategoryPeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
$row = $oDataset->getRow();
|
||||
$response = isset( $row['CATEGORY_NAME'] ) ? 'false' : 'true';
|
||||
$response = isset($row['CATEGORY_NAME']) ? 'false' : 'true';
|
||||
echo $response;
|
||||
break;
|
||||
case 'updateCategory':
|
||||
try {
|
||||
require_once 'classes/model/ProcessCategory.php';
|
||||
$catUID = $_REQUEST['cat_uid'];
|
||||
$catName = trim( $_REQUEST['category'] );
|
||||
$catName = trim($_REQUEST['category']);
|
||||
$pcat = new ProcessCategory();
|
||||
$pcat->setNew( false );
|
||||
$pcat->setCategoryUid( $catUID );
|
||||
$pcat->setCategoryName( $catName );
|
||||
$pcat->setNew(false);
|
||||
$pcat->setCategoryUid($catUID);
|
||||
$pcat->setCategoryName($catName);
|
||||
$pcat->save();
|
||||
g::auditLog("UpdateCategory", "Category Name: ".$catName." Category ID: (".$catUID.") ");
|
||||
g::auditLog("UpdateCategory", "Category Name: " . $catName . " Category ID: (" . $catUID . ") ");
|
||||
echo '{success: true}';
|
||||
} catch (Exception $ex) {
|
||||
$varEcho = '{success: false, error: ' . $ex->getMessage() . '}';
|
||||
G::outRes( $varEcho );
|
||||
G::outRes($varEcho);
|
||||
}
|
||||
break;
|
||||
case 'canDeleteCategory':
|
||||
require_once 'classes/model/Process.php';
|
||||
$proc = new Process();
|
||||
$aProcess = $proc->getAllProcessesByCategory();
|
||||
$catUID = $_REQUEST['CAT_UID'];
|
||||
$response = isset( $aProcess[$catUID] ) ? 'false' : 'true';
|
||||
$response = isset($aProcess[$catUID]) ? 'false' : 'true';
|
||||
echo $response;
|
||||
break;
|
||||
case 'deleteCategory':
|
||||
try {
|
||||
require_once 'classes/model/ProcessCategory.php';
|
||||
$catUID = $_REQUEST['cat_uid'];
|
||||
$cat = new ProcessCategory();
|
||||
$cat->setCategoryUid( $catUID );
|
||||
$catName = $cat->loadByCategoryId( $catUID );
|
||||
$cat->setCategoryUid($catUID);
|
||||
$catName = $cat->loadByCategoryId($catUID);
|
||||
$cat->delete();
|
||||
G::auditLog("DeleteCategory", "Category Name: ".$catName." Category ID: (".$catUID.") ");
|
||||
G::auditLog("DeleteCategory", "Category Name: " . $catName . " Category ID: (" . $catUID . ") ");
|
||||
$varEcho = '{success: true}';
|
||||
G::outRes( $varEcho );
|
||||
G::outRes($varEcho);
|
||||
} catch (Exception $ex) {
|
||||
$token = strtotime("now");
|
||||
PMException::registerErrorLog($ex, $token);
|
||||
$resJson = '{success: false, error: ' . G::LoadTranslation("ID_EXCEPTION_LOG_INTERFAZ", array($token)) . '}';
|
||||
G::outRes( $resJson );
|
||||
G::outRes($resJson);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*/
|
||||
use ProcessMaker\Util\Common;
|
||||
|
||||
$response = new StdClass();
|
||||
$outputDir = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP;
|
||||
@@ -42,7 +43,7 @@ try {
|
||||
$projectName = $exporter->getProjectName();
|
||||
$getProjectName = $exporter->truncateName($projectName, false);
|
||||
|
||||
$version = ProcessMaker\Util\Common::getLastVersion($outputDir . $getProjectName . "-*.pmx") + 1;
|
||||
$version = Common::getLastVersionSpecialCharacters($outputDir, $getProjectName, "pmx") + 1;
|
||||
$outputFilename = sprintf("%s-%s.%s", str_replace(" ", "_", $getProjectName), $version, "pmx");
|
||||
$outputFilename = $exporter->saveExport($outputDir . $outputFilename);
|
||||
/*----------------------------------********---------------------------------*/
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -3,6 +3,7 @@
|
||||
namespace ProcessMaker\BusinessModel\Migrator;
|
||||
|
||||
use ProcessMaker\Project;
|
||||
use ProcessMaker\Util\Common;
|
||||
|
||||
class GranularExporter
|
||||
{
|
||||
@@ -64,7 +65,7 @@ class GranularExporter
|
||||
$this->prjName = $projectData['PRJ_NAME'];
|
||||
$getProjectName = $this->publisher->truncateName($projectData['PRJ_NAME'], false);
|
||||
$outputDir = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP;
|
||||
$version = \ProcessMaker\Util\Common::getLastVersion($outputDir . $getProjectName . "-*.pmx2") + 1;
|
||||
$version = Common::getLastVersionSpecialCharacters($outputDir, $getProjectName, "pmx2") + 1;
|
||||
$outputFilename = $outputDir . sprintf("%s-%s.%s", str_replace(" ", "_", $getProjectName), $version, "pmx2");
|
||||
|
||||
$bpnmDefinition = array(
|
||||
|
||||
@@ -6,6 +6,7 @@ use ProcessMaker\Project;
|
||||
use ProcessMaker\Project\Adapter;
|
||||
use ProcessMaker\BusinessModel\Migrator;
|
||||
use ProcessMaker\BusinessModel\Migrator\ImportException;
|
||||
use ProcessMaker\Util\Common;
|
||||
|
||||
abstract class Importer
|
||||
{
|
||||
@@ -771,7 +772,7 @@ abstract class Importer
|
||||
$getProjectName = $exporter->truncateName($exporter->getProjectName(), false);
|
||||
|
||||
$outputDir = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP;
|
||||
$version = \ProcessMaker\Util\Common::getLastVersion($outputDir . $getProjectName . "-*.pmx") + 1;
|
||||
$version = Common::getLastVersionSpecialCharacters($outputDir, $getProjectName, "pmx") + 1;
|
||||
$outputFilename = $outputDir . sprintf("%s-%s.%s", str_replace(" ", "_", $getProjectName), $version, "pmx");
|
||||
|
||||
$exporter->setMetadata("export_version", $version);
|
||||
|
||||
@@ -10,6 +10,7 @@ use \ProcessMaker\BusinessModel\Validator;
|
||||
use \ProcessMaker\BusinessModel\Migrator\GranularExporter;
|
||||
use \ProcessMaker\BusinessModel\Migrator\ExportObjects;
|
||||
use \ProcessMaker\Util\IO\HttpStream;
|
||||
use \ProcessMaker\Util\Common;
|
||||
|
||||
/**
|
||||
* Class Project
|
||||
@@ -182,7 +183,7 @@ class Project extends Api
|
||||
$getProjectName = $exporter->truncateName($exporter->getProjectName(), false);
|
||||
|
||||
$outputDir = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP;
|
||||
$version = \ProcessMaker\Util\Common::getLastVersion($outputDir . $getProjectName . "-*.pmx") + 1;
|
||||
$version = Common::getLastVersionSpecialCharacters($outputDir, $getProjectName, "pmx") + 1;
|
||||
$outputFilename = $outputDir . sprintf("%s-%s.%s", str_replace(" ", "_", $getProjectName), $version, "pmx");
|
||||
|
||||
$exporter->setMetadata("export_version", $version);
|
||||
|
||||
Reference in New Issue
Block a user