This commit is contained in:
Roly Rudy Gutierrez Pinto
2015-01-30 14:41:26 -04:00
parent bcae063ede
commit 6c8d06059d
3 changed files with 13 additions and 11 deletions

View File

@@ -568,7 +568,7 @@ class Process extends BaseProcess
return (is_object( $oPro ) && get_class( $oPro ) == 'Process'); return (is_object( $oPro ) && get_class( $oPro ) == 'Process');
} }
public static function existsByProTitle ($PRO_TITLE) public static function existsByProTitle ($proTitle)
{ {
$oCriteria = new Criteria("workflow"); $oCriteria = new Criteria("workflow");
@@ -576,7 +576,7 @@ class Process extends BaseProcess
$oCriteria->add( ContentPeer::CON_CATEGORY, 'PRO_TITLE' ); $oCriteria->add( ContentPeer::CON_CATEGORY, 'PRO_TITLE' );
$oCriteria->add( ContentPeer::CON_LANG, SYS_LANG ); $oCriteria->add( ContentPeer::CON_LANG, SYS_LANG );
$oCriteria->add( ContentPeer::CON_VALUE, $PRO_TITLE ); $oCriteria->add( ContentPeer::CON_VALUE, $proTitle );
$oDataset = ContentPeer::doSelectRS( $oCriteria, Propel::getDbConnection('workflow_ro') ); $oDataset = ContentPeer::doSelectRS( $oCriteria, Propel::getDbConnection('workflow_ro') );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
@@ -586,31 +586,31 @@ class Process extends BaseProcess
return ((int)($aRow["NUM_REC"]) > 0)? true : false; return ((int)($aRow["NUM_REC"]) > 0)? true : false;
} }
public static function getByProTitle($PRO_TITLE) { public static function getByProTitle($proTitle) {
$oCriteria = new Criteria("workflow"); $oCriteria = new Criteria("workflow");
$oCriteria->addSelectColumn(ContentPeer::CON_ID); $oCriteria->addSelectColumn(ContentPeer::CON_ID);
$oCriteria->add(ContentPeer::CON_CATEGORY, 'PRO_TITLE'); $oCriteria->add(ContentPeer::CON_CATEGORY, 'PRO_TITLE');
$oCriteria->add(ContentPeer::CON_LANG, SYS_LANG); $oCriteria->add(ContentPeer::CON_LANG, SYS_LANG);
$oCriteria->add(ContentPeer::CON_VALUE, $PRO_TITLE); $oCriteria->add(ContentPeer::CON_VALUE, $proTitle);
$oDataset = ContentPeer::doSelectRS($oCriteria, Propel::getDbConnection('workflow_ro')); $oDataset = ContentPeer::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();
$oProcess = new Process(); $oProcess = new Process();
return $oProcess->load($aRow["CON_ID"]); return isset($aRow["CON_ID"]) ? $oProcess->load($aRow["CON_ID"]) : null;
} }
public static function getNextTitle($PRO_TITLE) { public static function getNextTitle($proTitle) {
$oCriteria = new Criteria('workflow'); $oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(ContentPeer::CON_VALUE); $oCriteria->addSelectColumn(ContentPeer::CON_VALUE);
$oCriteria->add(ContentPeer::CON_CATEGORY, 'PRO_TITLE'); $oCriteria->add(ContentPeer::CON_CATEGORY, 'PRO_TITLE');
$oCriteria->add(ContentPeer::CON_LANG, SYS_LANG); $oCriteria->add(ContentPeer::CON_LANG, SYS_LANG);
$oCriteria->add(ContentPeer::CON_VALUE, $PRO_TITLE . '-%', Criteria::LIKE); $oCriteria->add(ContentPeer::CON_VALUE, $proTitle . '-%', Criteria::LIKE);
$oCriteria->addAscendingOrderByColumn(ContentPeer::CON_VALUE); $oCriteria->addAscendingOrderByColumn(ContentPeer::CON_VALUE);
$oDataset = ContentPeer::doSelectRS($oCriteria, Propel::getDbConnection('workflow_ro')); $oDataset = ContentPeer::doSelectRS($oCriteria, Propel::getDbConnection('workflow_ro'));
@@ -628,7 +628,7 @@ class Process extends BaseProcess
$row["CON_VALUE"] = $number; $row["CON_VALUE"] = $number;
$data[] = $row; $data[] = $row;
} }
return $PRO_TITLE . "-" . ($may + 1); return $proTitle . "-" . ($may + 1);
} }
public function getAllProcessesCount () public function getAllProcessesCount ()

View File

@@ -200,8 +200,10 @@ if (isset($_FILES["PROCESS_FILENAME"]) &&
try { try {
if ($createMode === "overwrite") { if ($createMode === "overwrite") {
$process = Process::getByProTitle($data["PRO_TITLE"]); $process = Process::getByProTitle($data["PRO_TITLE"]);
$oProcess = new Process(); if ($process !== null) {
$oProcess->remove($process["PRO_UID"]); $oProcess = new Process();
$oProcess->remove($process["PRO_UID"]);
}
} }
if ($createMode === "rename") { if ($createMode === "rename") {
$data["PRO_TITLE"] = Process::getNextTitle($data["PRO_TITLE"]); $data["PRO_TITLE"] = Process::getNextTitle($data["PRO_TITLE"]);

View File

@@ -307,7 +307,7 @@ Ext.onReady(function(){
importProcess(); importProcess();
} }
},{ },{
text: _('ID_IMPORT') + " BPMN", text: _('ID_IMPORT_BPMN'),
iconCls: 'silk-add', iconCls: 'silk-add',
icon: '/images/import.gif', icon: '/images/import.gif',
handler : function(){ handler : function(){