Merged in dheeyi/processmaker/HOR-2018 (pull request #4992)

R-2018
This commit is contained in:
Julio Cesar Laura Avendaño
2016-10-10 10:23:32 -04:00
2 changed files with 13 additions and 11 deletions

View File

@@ -503,16 +503,21 @@ class Process extends BaseProcess
return (is_object( $oPro ) && get_class( $oPro ) == 'Process'); return (is_object( $oPro ) && get_class( $oPro ) == 'Process');
} }
public static function existsByProTitle ($proTitle) /**
* @param $proTitle
* @return bool
* @throws PropelException
*/
public static function existsByProTitle($proTitle)
{ {
$oCriteria = new Criteria("workflow"); $oCriteria = new Criteria("workflow");
$oCriteria->addSelectColumn(ProcessPeer::PRO_TITLE); $oCriteria->addSelectColumn(ProcessPeer::PRO_TITLE);
$oCriteria->add( ProcessPeer::PRO_TITLE, $proTitle ); $oCriteria->add(ProcessPeer::PRO_TITLE, $proTitle);
$oDataset = ProcessPeer::doSelectRS( $oCriteria, Propel::getDbConnection('workflow_ro') ); $oDataset = ProcessPeer::doSelectRS($oCriteria, Propel::getDbConnection('workflow_ro'));
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next(); $oDataset->next();
$aRow = $oDataset->getRow(); $aRow = $oDataset->getRow();
return ($aRow)? true : false; return ($aRow) ? true : false;
} }
public static function getByProTitle($proTitle) public static function getByProTitle($proTitle)

View File

@@ -81,7 +81,6 @@ abstract class Importer
public function import($option = self::IMPORT_OPTION_CREATE_NEW, $optionGroup = self::GROUP_IMPORT_OPTION_CREATE_NEW, $generateUidFromJs = null, $objectsToImport = '') public function import($option = self::IMPORT_OPTION_CREATE_NEW, $optionGroup = self::GROUP_IMPORT_OPTION_CREATE_NEW, $generateUidFromJs = null, $objectsToImport = '')
{ {
$this->prepare(); $this->prepare();
//Verify data //Verify data
switch ($option) { switch ($option) {
case self::IMPORT_OPTION_CREATE_NEW: case self::IMPORT_OPTION_CREATE_NEW:
@@ -159,13 +158,11 @@ abstract class Importer
//Import //Import
$name = $this->importData["tables"]["bpmn"]["project"][0]["prj_name"]; $name = $this->importData["tables"]["bpmn"]["project"][0]["prj_name"];
switch ($option) {
case self::IMPORT_OPTION_CREATE_NEW:
if (\Process::existsByProTitle($name) && !is_null($generateUidFromJs)) { if (\Process::existsByProTitle($name) && !is_null($generateUidFromJs)) {
$name = $name . ' ' . date('Y-m-d H:i:s'); $name = $name . ' ' . date('Y-m-d H:i:s');
} }
switch ($option) {
case self::IMPORT_OPTION_CREATE_NEW:
//Shouldn't generate new UID for all objects //Shouldn't generate new UID for all objects
$generateUid = false; $generateUid = false;
break; break;