CODE STYLE Formating worflow/engine/classes/model/AppFolder.php
CODE STYLE Formating worflow/engine/classes/model/Step.php Change format files in worflow/engine/classes/model/AppFolder.php Change format files in worflow/engine/classes/model/Step.php
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* AppFolder.php
|
||||
*
|
||||
* @package workflow.engine.classes.model
|
||||
*/
|
||||
|
||||
@@ -15,21 +16,29 @@ require_once 'classes/model/Application.php';
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
*/
|
||||
/**
|
||||
*
|
||||
* @author hugo loza
|
||||
* @package workflow.engine.classes.model
|
||||
*/
|
||||
class AppFolder extends BaseAppFolder {
|
||||
class AppFolder extends BaseAppFolder
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $folderName
|
||||
* @param strin(32) $folderParent
|
||||
* @return Ambigous <>|number
|
||||
*/
|
||||
function createFolder($folderName, $folderParent = "/", $action="createifnotexists") {
|
||||
$validActions=array("createifnotexists","create","update");
|
||||
if(!in_array($action,$validActions)) $action="createifnotexists";
|
||||
function createFolder ($folderName, $folderParent = "/", $action = "createifnotexists")
|
||||
{
|
||||
$validActions = array ("createifnotexists","create","update"
|
||||
);
|
||||
if (! in_array( $action, $validActions )) {
|
||||
$action = "createifnotexists";
|
||||
}
|
||||
|
||||
//Clean Folder and Parent names (delete spaces...)
|
||||
$folderName = trim( $folderName );
|
||||
$folderParent = trim( $folderParent );
|
||||
@@ -40,13 +49,15 @@ class AppFolder extends BaseAppFolder {
|
||||
$oDataset = AppFolderPeer::doSelectRS( $oCriteria );
|
||||
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$oDataset->next();
|
||||
if ($aRow = $oDataset->getRow ()) {//Folder exist, then return the ID
|
||||
if ($aRow = $oDataset->getRow()) {
|
||||
//Folder exist, then return the ID
|
||||
$response['success'] = false;
|
||||
$response['message'] = $response['error'] = "Can't create folder <br /> A folder with same name already exist. <br /> $folderName";
|
||||
$response['folderUID'] = $aRow['FOLDER_UID'];
|
||||
//return ($aRow ['FOLDER_UID']);
|
||||
return ($response);
|
||||
} else {//Folder doesn't exist. Create and return the ID
|
||||
} else {
|
||||
//Folder doesn't exist. Create and return the ID
|
||||
$folderUID = G::GenerateUniqueID();
|
||||
$tr = new AppFolder();
|
||||
$tr->setFolderUid( $folderUID );
|
||||
@@ -70,30 +81,30 @@ class AppFolder extends BaseAppFolder {
|
||||
$msg .= $objValidationFailure->getMessage() . "<br/>";
|
||||
}
|
||||
$response['success'] = false;
|
||||
|
||||
$response['message'] = $response['error'] = "Can't create folder \n A \n " . $msg;
|
||||
return ($response);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $folderPath
|
||||
* @param strin(32) $sessionID
|
||||
* @return string Last Folder ID generated
|
||||
*/
|
||||
function createFromPath($folderPath, $sessionID = "") {
|
||||
if ($sessionID == "")
|
||||
function createFromPath ($folderPath, $sessionID = "")
|
||||
{
|
||||
if ($sessionID == "") {
|
||||
$sessionID = $_SESSION['APPLICATION'];
|
||||
//Get current Application Fields
|
||||
}
|
||||
|
||||
$oApplication = new Application();
|
||||
|
||||
$appFields = $oApplication->Load( $sessionID );
|
||||
|
||||
$folderPathParsed = G::replaceDataField( $folderPath, $appFields );
|
||||
$folderPathParsed = G::replaceDataField( $folderPath, unserialize( $appFields['APP_DATA'] ) );
|
||||
|
||||
$folderPathParsedArray = explode( "/", $folderPathParsed );
|
||||
|
||||
$folderRoot = "/"; //Always starting from Root
|
||||
foreach ($folderPathParsedArray as $folderName) {
|
||||
if (trim( $folderName ) != "") {
|
||||
@@ -105,50 +116,51 @@ class AppFolder extends BaseAppFolder {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $fileTags
|
||||
* @param string(32) $sessionID Application ID
|
||||
* @return string
|
||||
*/
|
||||
function parseTags($fileTags, $sessionID = "") {
|
||||
function parseTags ($fileTags, $sessionID = "")
|
||||
{
|
||||
|
||||
if ($sessionID == "")
|
||||
if ($sessionID == "") {
|
||||
$sessionID = $_SESSION['APPLICATION'];
|
||||
//Get current Application Fields
|
||||
}
|
||||
|
||||
$oApplication = new Application();
|
||||
|
||||
$appFields = $oApplication->Load( $sessionID );
|
||||
|
||||
$fileTagsParsed = G::replaceDataField( $fileTags, $appFields );
|
||||
$fileTagsParsed = G::replaceDataField( $fileTags, unserialize( $appFields['APP_DATA'] ) );
|
||||
|
||||
return $fileTagsParsed;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string(32) $folderID
|
||||
* @return multitype:
|
||||
*/
|
||||
function getFolderList($folderID, $limit=0, $start=0) {
|
||||
function getFolderList ($folderID, $limit = 0, $start = 0)
|
||||
{
|
||||
$Criteria = new Criteria( 'workflow' );
|
||||
$Criteria->clearSelectColumns()->clearOrderByColumns();
|
||||
|
||||
$Criteria->addSelectColumn( AppFolderPeer::FOLDER_UID );
|
||||
$Criteria->addSelectColumn( AppFolderPeer::FOLDER_PARENT_UID );
|
||||
$Criteria->addSelectColumn( AppFolderPeer::FOLDER_NAME );
|
||||
$Criteria->addSelectColumn( AppFolderPeer::FOLDER_CREATE_DATE );
|
||||
$Criteria->addSelectColumn( AppFolderPeer::FOLDER_UPDATE_DATE );
|
||||
|
||||
$Criteria->add( appFolderPeer::FOLDER_PARENT_UID, $folderID, CRITERIA::EQUAL );
|
||||
|
||||
$Criteria->addAscendingOrderByColumn( AppFolderPeer::FOLDER_NAME );
|
||||
|
||||
$response['totalFoldersCount'] = AppFolderPeer::doCount( $Criteria );
|
||||
$response['folders'] = array ();
|
||||
|
||||
if ($limit != 0) {
|
||||
|
||||
$Criteria->setLimit( $limit );
|
||||
$Criteria->setOffset( $start );
|
||||
}
|
||||
|
||||
$rs = appFolderPeer::doSelectRS( $Criteria );
|
||||
$rs->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$rs->next();
|
||||
@@ -159,11 +171,14 @@ if($limit != 0){
|
||||
}
|
||||
return ($response);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string(32) $folderUid
|
||||
* @return array <multitype:, mixed>
|
||||
*/
|
||||
function load($folderUid) {
|
||||
function load ($folderUid)
|
||||
{
|
||||
$tr = AppFolderPeer::retrieveByPK( $folderUid );
|
||||
if ((is_object( $tr ) && get_class( $tr ) == 'AppFolder')) {
|
||||
$fields['FOLDER_UID'] = $tr->getFolderUid();
|
||||
@@ -187,10 +202,12 @@ if($limit != 0){
|
||||
}
|
||||
return $fields;
|
||||
}
|
||||
function getFolderStructure($folderId) {
|
||||
|
||||
function getFolderStructure ($folderId)
|
||||
{
|
||||
$folderObj = $this->load( $folderId );
|
||||
$folderArray [$folderObj ['FOLDER_UID']] = array ("NAME" => $folderObj ['FOLDER_NAME'], "PARENT" => $folderObj ['FOLDER_PARENT_UID'] );
|
||||
$folderArray[$folderObj['FOLDER_UID']] = array ("NAME" => $folderObj['FOLDER_NAME'],"PARENT" => $folderObj['FOLDER_PARENT_UID']
|
||||
);
|
||||
$folderArray['PATH_ARRAY'][] = $folderObj['FOLDER_NAME'];
|
||||
|
||||
while ($folderObj['FOLDER_PARENT_UID'] != "") {
|
||||
@@ -203,7 +220,8 @@ if($limit != 0){
|
||||
return $folderArray;
|
||||
}
|
||||
|
||||
function getFolderContent($folderID, $docIdFilter = array(), $keyword = NULL, $searchType = NULL, $limit=0, $start=0, $user='', $onlyActive=false) {
|
||||
function getFolderContent ($folderID, $docIdFilter = array(), $keyword = null, $searchType = null, $limit = 0, $start = 0, $user = '', $onlyActive = false)
|
||||
{
|
||||
require_once ("classes/model/AppDocument.php");
|
||||
require_once ("classes/model/InputDocument.php");
|
||||
require_once ("classes/model/OutputDocument.php");
|
||||
@@ -217,11 +235,12 @@ if($limit != 0){
|
||||
$oAppDocument = new AppDocument();
|
||||
$oCriteria = new Criteria();
|
||||
|
||||
if ((is_array ( $docIdFilter )) && (count ( $docIdFilter ) > 0)) { //Search by App Doc UID no matter what Folder it is
|
||||
if ((is_array( $docIdFilter )) && (count( $docIdFilter ) > 0)) {
|
||||
//Search by App Doc UID no matter what Folder it is
|
||||
$oCriteria->add( AppDocumentPeer::APP_DOC_UID, $docIdFilter, CRITERIA::IN );
|
||||
} elseif ($folderID != NULL) {
|
||||
} elseif ($folderID != null) {
|
||||
if ($folderID == "/") {
|
||||
$oCriteria->add ( AppDocumentPeer::FOLDER_UID, array('root','',NULL), CRITERIA::IN );
|
||||
$oCriteria->add( AppDocumentPeer::FOLDER_UID, array ('root','',null), CRITERIA::IN );
|
||||
} else {
|
||||
$oCriteria->add( AppDocumentPeer::FOLDER_UID, $folderID );
|
||||
}
|
||||
@@ -259,20 +278,15 @@ if($limit != 0){
|
||||
|
||||
$oCase->verifyTable();
|
||||
|
||||
|
||||
$oCriteria->addAscendingOrderByColumn( AppDocumentPeer::APP_DOC_INDEX );
|
||||
$oCriteria->addDescendingOrderByColumn( AppDocumentPeer::DOC_VERSION );
|
||||
|
||||
|
||||
$response['totalDocumentsCount'] = AppDocumentPeer::doCount( $oCriteria );
|
||||
$response['documents'] = array ();
|
||||
|
||||
|
||||
|
||||
$oCriteria->setLimit( $limit );
|
||||
$oCriteria->setOffset( $start );
|
||||
|
||||
|
||||
$rs = AppDocumentPeer::doSelectRS( $oCriteria );
|
||||
$rs->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$rs->next();
|
||||
@@ -281,10 +295,8 @@ if($limit != 0){
|
||||
//**** start get Doc Info
|
||||
$oApp = new Application();
|
||||
if (($oApp->exists( $row['APP_UID'] )) || ($row['APP_UID'] == "00000000000000000000000000000000")) {
|
||||
|
||||
//$completeInfo = array("APP_DOC_FILENAME" => $row ["APP_DOC_UID"],"APP_DOC_UID"=>$row ['APP_UID']);
|
||||
$completeInfo = $this->getCompleteDocumentInfo( $row['APP_UID'], $row['APP_DOC_UID'], $row['DOC_VERSION'], $row['DOC_UID'], $row['USR_UID'] );
|
||||
|
||||
$oAppDocument = new AppDocument();
|
||||
$lastVersion = $oAppDocument->getLastAppDocVersion( $row['APP_DOC_UID'], $row['APP_UID'] );
|
||||
//$filesResult [] = $completeInfo;
|
||||
@@ -294,16 +306,17 @@ if($limit != 0){
|
||||
if (in_array( $row['APP_DOC_UID'], $docIdFilter )) {
|
||||
$response['documents'][] = $completeInfo;
|
||||
}
|
||||
} elseif ($lastVersion == $row ['DOC_VERSION']) { //Only Last Document version
|
||||
} elseif ($lastVersion == $row['DOC_VERSION']) {
|
||||
//Only Last Document version
|
||||
if ($searchType == "ALL") { // If search in name of docs is active then filter
|
||||
if ((stripos( $completeInfo['APP_DOC_FILENAME'], $keyword ) !== false) || (stripos( $completeInfo['APP_DOC_TAGS'], $keyword ) !== false)) {
|
||||
$response['documents'][] = $completeInfo;
|
||||
}
|
||||
} else {//No search filter active
|
||||
} else {
|
||||
//No search filter active
|
||||
$response['documents'][] = $completeInfo;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -311,7 +324,9 @@ if($limit != 0){
|
||||
}
|
||||
return ($response);
|
||||
}
|
||||
function getCompleteDocumentInfo($appUid, $appDocUid, $docVersion, $docUid, $usrId) {
|
||||
|
||||
function getCompleteDocumentInfo ($appUid, $appDocUid, $docVersion, $docUid, $usrId)
|
||||
{
|
||||
require_once ("classes/model/AppDocument.php");
|
||||
require_once ("classes/model/InputDocument.php");
|
||||
require_once ("classes/model/OutputDocument.php");
|
||||
@@ -388,7 +403,6 @@ if($limit != 0){
|
||||
///////
|
||||
if (! empty( $row1["APP_DOC_PLUGIN"] )) {
|
||||
$pluginRegistry = &PMPluginRegistry::getSingleton();
|
||||
|
||||
$pluginName = $row1["APP_DOC_PLUGIN"];
|
||||
$fieldValue = "";
|
||||
|
||||
@@ -398,23 +412,18 @@ if($limit != 0){
|
||||
if ($pluginDetail) {
|
||||
if ($pluginDetail->enabled) {
|
||||
require_once (PATH_PLUGINS . $pluginName . ".php");
|
||||
|
||||
$pluginNameClass = $pluginName . "Plugin";
|
||||
|
||||
$objPluginClass = new $pluginNameClass( $pluginName );
|
||||
|
||||
if (isset( $objPluginClass->sMethodGetUrlDownload ) && ! empty( $objPluginClass->sMethodGetUrlDownload )) {
|
||||
if (file_exists( PATH_PLUGINS . $pluginName . PATH_SEP . "class." . $pluginName . ".php" )) {
|
||||
require_once (PATH_PLUGINS . $pluginName . PATH_SEP . "class." . $pluginName . ".php");
|
||||
|
||||
$pluginNameClass = $pluginName . "Class";
|
||||
|
||||
$objClass = new $pluginNameClass();
|
||||
|
||||
if (method_exists( $objClass, $objPluginClass->sMethodGetUrlDownload )) {
|
||||
eval( "\$url = \$objClass->" . $objPluginClass->sMethodGetUrlDownload . "(\"" . $row1["APP_DOC_UID"] . "\");" );
|
||||
$downloadLink = $url;
|
||||
|
||||
$fieldValue = $row1["APP_DOC_PLUGIN"];
|
||||
}
|
||||
}
|
||||
@@ -422,7 +431,6 @@ if($limit != 0){
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$row1["APP_DOC_PLUGIN"] = $fieldValue;
|
||||
}
|
||||
break;
|
||||
@@ -435,7 +443,6 @@ if($limit != 0){
|
||||
$downloadLabel = G::LoadTranslation( 'ID_DOWNLOAD' );
|
||||
$downloadLabel1 = "";
|
||||
break;
|
||||
|
||||
}
|
||||
$oUser = new Users();
|
||||
if (($usrId != "-1") && ($oUser->userExists( $usrId ))) {
|
||||
@@ -460,12 +467,11 @@ if($limit != 0){
|
||||
}
|
||||
$row6['APP_DOC_UID_VERSION'] = $appDocUid . "_" . $docVersion;
|
||||
|
||||
if ($appUid == "00000000000000000000000000000000") { //External Files
|
||||
if ($appUid == "00000000000000000000000000000000") {
|
||||
//External Files
|
||||
$row1['APP_DOC_TYPE'] = G::LoadTranslation( 'ID_EXTERNAL_FILE' );
|
||||
}
|
||||
//**** End get docinfo
|
||||
|
||||
|
||||
$infoMerged = array_merge( $row1, $row2, $row3, $row4, $row5, $row6 );
|
||||
//krumo($infoMerged);
|
||||
//****************************************************************************************************
|
||||
@@ -476,7 +482,10 @@ if($limit != 0){
|
||||
}
|
||||
|
||||
if (! is_array( $aObjectPermissions )) {
|
||||
$aObjectPermissions = array ('DYNAFORMS' => array (- 1 ), 'INPUT_DOCUMENTS' => array (- 1 ), 'OUTPUT_DOCUMENTS' => array (- 1 ) );
|
||||
$aObjectPermissions = array ('DYNAFORMS' => array (- 1),
|
||||
'INPUT_DOCUMENTS' => array (- 1),
|
||||
'OUTPUT_DOCUMENTS' => array (- 1)
|
||||
);
|
||||
}
|
||||
if (! isset( $aObjectPermissions['DYNAFORMS'] )) {
|
||||
$aObjectPermissions['DYNAFORMS'] = array (- 1);
|
||||
@@ -500,12 +509,12 @@ if($limit != 0){
|
||||
}
|
||||
}
|
||||
//****************************************************************************************************
|
||||
|
||||
|
||||
return array_merge( $infoMerged, $aObjectPermissions );
|
||||
}
|
||||
}
|
||||
function getFolderChilds($folderID, $folderArray) {
|
||||
|
||||
function getFolderChilds ($folderID, $folderArray)
|
||||
{
|
||||
$folderList = $this->getFolderList( $folderID );
|
||||
$foldersList = array ();
|
||||
foreach ($folderList as $key => $folderObj) {
|
||||
@@ -515,7 +524,8 @@ if($limit != 0){
|
||||
return (array_merge( $folderArray, $foldersList ));
|
||||
}
|
||||
|
||||
function getFolderTags($rootFolder) {
|
||||
function getFolderTags ($rootFolder)
|
||||
{
|
||||
$folderArray[$rootFolder] = $rootFolder;
|
||||
$foldersToProcess = $this->getFolderChilds( $rootFolder, $folderArray );
|
||||
$tagsInfo = array ();
|
||||
@@ -535,9 +545,13 @@ if($limit != 0){
|
||||
return $tagsInfo;
|
||||
|
||||
}
|
||||
function remove ($FolderUid, $rootfolder ) {
|
||||
|
||||
function remove ($FolderUid, $rootfolder)
|
||||
{
|
||||
$oCriteria = new Criteria( 'workflow' );
|
||||
$oCriteria->add( AppFolderPeer::FOLDER_UID, $FolderUid );
|
||||
AppFolderPeer::doDelete( $oCriteria );
|
||||
}
|
||||
} // AppFolder
|
||||
}
|
||||
// AppFolder
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* Step.php
|
||||
*
|
||||
* @package workflow.engine.classes.model
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
@@ -26,7 +27,6 @@
|
||||
|
||||
require_once 'classes/model/om/BaseStep.php';
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for representing a row from the 'STEP' table.
|
||||
*
|
||||
@@ -38,63 +38,67 @@ require_once 'classes/model/om/BaseStep.php';
|
||||
*
|
||||
* @package workflow.engine.classes.model
|
||||
*/
|
||||
class Step extends BaseStep {
|
||||
function create($aData)
|
||||
class Step extends BaseStep
|
||||
{
|
||||
|
||||
public function create ($aData)
|
||||
{
|
||||
$con = Propel::getConnection( StepPeer::DATABASE_NAME );
|
||||
try
|
||||
{
|
||||
if ( isset ( $aData['STEP_UID'] ) && $aData['STEP_UID']== '' )
|
||||
try {
|
||||
if (isset( $aData['STEP_UID'] ) && $aData['STEP_UID'] == '') {
|
||||
unset( $aData['STEP_UID'] );
|
||||
if ( isset ( $aData['STEP_UID'] ) )
|
||||
}
|
||||
if (isset( $aData['STEP_UID'] )) {
|
||||
$sStepUID = $aData['STEP_UID'];
|
||||
else
|
||||
} else {
|
||||
$sStepUID = G::generateUniqueID();
|
||||
}
|
||||
|
||||
$con->begin();
|
||||
$this->setStepUid( $sStepUID );
|
||||
$this->setProUid( $aData['PRO_UID'] );
|
||||
$this->setTasUid( $aData['TAS_UID'] );
|
||||
|
||||
if (isset ( $aData['STEP_TYPE_OBJ'] ))
|
||||
if (isset( $aData['STEP_TYPE_OBJ'] )) {
|
||||
$this->setStepTypeObj( $aData['STEP_TYPE_OBJ'] );
|
||||
else
|
||||
} else {
|
||||
$this->setStepTypeObj( "DYNAFORM" );
|
||||
}
|
||||
|
||||
if (isset ( $aData['STEP_UID_OBJ'] ))
|
||||
if (isset( $aData['STEP_UID_OBJ'] )) {
|
||||
$this->setStepUidObj( $aData['STEP_UID_OBJ'] );
|
||||
else
|
||||
} else {
|
||||
$this->setStepUidObj( "" );
|
||||
}
|
||||
|
||||
if (isset ( $aData['STEP_CONDITION'] ))
|
||||
if (isset( $aData['STEP_CONDITION'] )) {
|
||||
$this->setStepCondition( $aData['STEP_CONDITION'] );
|
||||
else
|
||||
} else {
|
||||
$this->setStepCondition( "" );
|
||||
}
|
||||
|
||||
if (isset ( $aData['STEP_POSITION'] ))
|
||||
if (isset( $aData['STEP_POSITION'] )) {
|
||||
$this->setStepPosition( $aData['STEP_POSITION'] );
|
||||
else
|
||||
} else {
|
||||
$this->setStepPosition( "" );
|
||||
}
|
||||
|
||||
if (isset ( $aData['STEP_MODE'] ))
|
||||
if (isset( $aData['STEP_MODE'] )) {
|
||||
$this->setStepMode( $aData['STEP_MODE'] );
|
||||
else
|
||||
} else {
|
||||
$this->setStepMode( "" );
|
||||
}
|
||||
|
||||
if($this->validate())
|
||||
{
|
||||
if ($this->validate()) {
|
||||
$result = $this->save();
|
||||
$con->commit();
|
||||
return $sStepUID;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$con->rollback();
|
||||
throw (new Exception( "Failed Validation in class " . get_class( $this ) . "." ));
|
||||
}
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
|
||||
} catch (Exception $e) {
|
||||
$con->rollback();
|
||||
throw ($e);
|
||||
}
|
||||
@@ -104,18 +108,15 @@ class Step extends BaseStep {
|
||||
{
|
||||
try {
|
||||
$oRow = StepPeer::retrieveByPK( $StepUid );
|
||||
if (!is_null($oRow))
|
||||
{
|
||||
if (! is_null( $oRow )) {
|
||||
$aFields = $oRow->toArray( BasePeer::TYPE_FIELDNAME );
|
||||
$this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
|
||||
$this->setNew( false );
|
||||
return $aFields;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
throw (new Exception( "The row '$StepUid' in table StepUid doesn't exist!" ));
|
||||
}
|
||||
}
|
||||
catch (Exception $oError) {
|
||||
} catch (Exception $oError) {
|
||||
throw ($oError);
|
||||
}
|
||||
}
|
||||
@@ -130,13 +131,11 @@ class Step extends BaseStep {
|
||||
if (StepPeer::doCount( $c ) > 0) {
|
||||
$rs = StepPeer::doSelect( $c );
|
||||
return $rs[0];
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception $oError) {
|
||||
} catch (Exception $oError) {
|
||||
throw ($oError);
|
||||
}
|
||||
}
|
||||
@@ -156,15 +155,12 @@ class Step extends BaseStep {
|
||||
$c->add( StepPeer::STEP_TYPE_OBJ, $sType );
|
||||
$c->add( StepPeer::STEP_UID_OBJ, $sUid );
|
||||
$rs = StepPeer::doSelect( $c );
|
||||
if (!is_null($rs) && !is_null($rs[0]))
|
||||
{
|
||||
if (! is_null( $rs ) && ! is_null( $rs[0] )) {
|
||||
return $rs[0];
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
throw (new Exception( "You tried to call to loadByType method without send the Task UID or Type or Object UID !" ));
|
||||
}
|
||||
}
|
||||
catch (Exception $oError) {
|
||||
} catch (Exception $oError) {
|
||||
throw ($oError);
|
||||
}
|
||||
}
|
||||
@@ -174,33 +170,28 @@ class Step extends BaseStep {
|
||||
* @param array $fields
|
||||
* @return variant
|
||||
*/
|
||||
function update($fields)
|
||||
public function update ($fields)
|
||||
{
|
||||
$con = Propel::getConnection( StepPeer::DATABASE_NAME );
|
||||
try
|
||||
{
|
||||
try {
|
||||
$con->begin();
|
||||
$this->load( $fields['STEP_UID'] );
|
||||
$this->fromArray( $fields, BasePeer::TYPE_FIELDNAME );
|
||||
if($this->validate())
|
||||
{
|
||||
if ($this->validate()) {
|
||||
$result = $this->save();
|
||||
$con->commit();
|
||||
return $result;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$con->rollback();
|
||||
throw (new Exception( "Failed Validation in class " . get_class( $this ) . "." ));
|
||||
}
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
} catch (Exception $e) {
|
||||
$con->rollback();
|
||||
throw ($e);
|
||||
}
|
||||
}
|
||||
function remove($sStepUID)
|
||||
|
||||
public function remove ($sStepUID)
|
||||
{
|
||||
require_once ('classes/model/StepTrigger.php');
|
||||
$oStepTriggers = new StepTrigger();
|
||||
@@ -230,24 +221,22 @@ class Step extends BaseStep {
|
||||
$oConnection = Propel::getConnection( StepPeer::DATABASE_NAME );
|
||||
try {
|
||||
$oStep = StepPeer::retrieveByPK( $sStepUID );
|
||||
if (!is_null($oStep))
|
||||
{
|
||||
if (! is_null( $oStep )) {
|
||||
$oConnection->begin();
|
||||
$iResult = $oStep->delete();
|
||||
$oConnection->commit();
|
||||
return $iResult;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
throw (new Exception( 'This row doesn\'t exist!' ));
|
||||
}
|
||||
}
|
||||
catch (Exception $oError) {
|
||||
} catch (Exception $oError) {
|
||||
$oConnection->rollback();
|
||||
throw ($oError);
|
||||
}
|
||||
}
|
||||
|
||||
function getNextPosition($sTaskUID) {
|
||||
public function getNextPosition ($sTaskUID)
|
||||
{
|
||||
try {
|
||||
$oCriteria = new Criteria( 'workflow' );
|
||||
$oCriteria->addSelectColumn( '(COUNT(*) + 1) AS POSITION' );
|
||||
@@ -257,13 +246,13 @@ class Step extends BaseStep {
|
||||
$oDataset->next();
|
||||
$aRow = $oDataset->getRow();
|
||||
return (int) $aRow['POSITION'];
|
||||
}
|
||||
catch (Exception $oException) {
|
||||
} catch (Exception $oException) {
|
||||
throw $Exception;
|
||||
}
|
||||
}
|
||||
|
||||
function reOrder($sStepUID, $iPosition) {
|
||||
public function reOrder ($sStepUID, $iPosition)
|
||||
{
|
||||
try {
|
||||
/*$oCriteria1 = new Criteria('workflow');
|
||||
$oCriteria1->add(StepPeer::STEP_POSITION, StepPeer::STEP_POSITION);
|
||||
@@ -285,13 +274,13 @@ class Step extends BaseStep {
|
||||
$oStep->save();
|
||||
$oDataset->next();
|
||||
}
|
||||
}
|
||||
catch (Exception $oException) {
|
||||
} catch (Exception $oException) {
|
||||
throw $oException;
|
||||
}
|
||||
}
|
||||
|
||||
function up($sStepUID = '', $sTaskUID = '', $iPosition = 0) {
|
||||
public function up ($sStepUID = '', $sTaskUID = '', $iPosition = 0)
|
||||
{
|
||||
try {
|
||||
if ($iPosition > 1) {
|
||||
$oCriteria1 = new Criteria( 'workflow' );
|
||||
@@ -306,13 +295,13 @@ class Step extends BaseStep {
|
||||
$oCriteria2->add( StepPeer::STEP_UID, $sStepUID );
|
||||
BasePeer::doUpdate( $oCriteria2, $oCriteria1, Propel::getConnection( 'workflow' ) );
|
||||
}
|
||||
}
|
||||
catch (Exception $oException) {
|
||||
} catch (Exception $oException) {
|
||||
throw $oException;
|
||||
}
|
||||
}
|
||||
|
||||
function down($sStepUID = '', $sTaskUID = '', $iPosition = 0) {
|
||||
public function down ($sStepUID = '', $sTaskUID = '', $iPosition = 0)
|
||||
{
|
||||
try {
|
||||
$oCriteria = new Criteria( 'workflow' );
|
||||
$oCriteria->addSelectColumn( 'COUNT(*) AS MAX_POSITION' );
|
||||
@@ -334,13 +323,13 @@ class Step extends BaseStep {
|
||||
$oCriteria2->add( StepPeer::STEP_UID, $sStepUID );
|
||||
BasePeer::doUpdate( $oCriteria2, $oCriteria1, Propel::getConnection( 'workflow' ) );
|
||||
}
|
||||
}
|
||||
catch (Exception $oException) {
|
||||
} catch (Exception $oException) {
|
||||
throw $oException;
|
||||
}
|
||||
}
|
||||
|
||||
function removeStep($sType = '', $sObjUID = '') {
|
||||
public function removeStep ($sType = '', $sObjUID = '')
|
||||
{
|
||||
try {
|
||||
$oCriteria = new Criteria( 'workflow' );
|
||||
$oCriteria->add( StepPeer::STEP_TYPE_OBJ, $sType );
|
||||
@@ -353,8 +342,7 @@ class Step extends BaseStep {
|
||||
$this->remove( $aRow['STEP_UID'] );
|
||||
$oDataset->next();
|
||||
}
|
||||
}
|
||||
catch (Exception $oException) {
|
||||
} catch (Exception $oException) {
|
||||
throw $oException;
|
||||
}
|
||||
}
|
||||
@@ -365,18 +353,17 @@ class Step extends BaseStep {
|
||||
* @param string $sUid the uid of the
|
||||
*/
|
||||
|
||||
function StepExists ( $sUid ) {
|
||||
public function StepExists ($sUid)
|
||||
{
|
||||
$con = Propel::getConnection( StepPeer::DATABASE_NAME );
|
||||
try {
|
||||
$oObj = StepPeer::retrieveByPk( $sUid );
|
||||
if (is_object( $oObj ) && get_class( $oObj ) == 'Step') {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (Exception $oError) {
|
||||
} catch (Exception $oError) {
|
||||
throw ($oError);
|
||||
}
|
||||
}
|
||||
@@ -387,7 +374,8 @@ class Step extends BaseStep {
|
||||
* @param string $sproUid the uid of the process
|
||||
* @param string $sObjUID the uid of the dynaform
|
||||
*/
|
||||
function loadInfoAssigDynaform($sproUid,$sObjUID){
|
||||
public function loadInfoAssigDynaform ($sproUid, $sObjUID)
|
||||
{
|
||||
|
||||
require_once ("classes/model/DynaformPeer.php");
|
||||
G::LoadSystem( 'dynaformhandler' );
|
||||
@@ -400,7 +388,6 @@ class Step extends BaseStep {
|
||||
$oDataset->next();
|
||||
$aRow = $oDataset->getRow();
|
||||
|
||||
|
||||
if ($aRow['DYN_TYPE'] != 'xmlform') {
|
||||
|
||||
$oC1 = new Criteria( 'workflow' );
|
||||
@@ -439,15 +426,14 @@ class Step extends BaseStep {
|
||||
$aRow = $oDataset->getRow();
|
||||
return ($aRow);
|
||||
}
|
||||
die;
|
||||
die();
|
||||
}
|
||||
|
||||
function getAttribute($node, $attName){
|
||||
public function getAttribute ($node, $attName)
|
||||
{
|
||||
|
||||
foreach ( $node->attributes as $attribute )
|
||||
{
|
||||
if ( $attribute->name == $attName )
|
||||
{
|
||||
foreach ($node->attributes as $attribute) {
|
||||
if ($attribute->name == $attName) {
|
||||
return $attribute->value;
|
||||
}
|
||||
|
||||
@@ -460,8 +446,8 @@ class Step extends BaseStep {
|
||||
* @param string $sproUid the uid of the process
|
||||
* @param string $sdbsUid the uid of the db connection
|
||||
*/
|
||||
function loadInfoAssigConnecctionDB($sproUid,$sdbsUid){
|
||||
|
||||
public function loadInfoAssigConnecctionDB ($sproUid, $sdbsUid)
|
||||
{
|
||||
require_once ("classes/model/DynaformPeer.php");
|
||||
G::LoadSystem( 'dynaformhandler' );
|
||||
$swDynaform = true;
|
||||
@@ -499,6 +485,7 @@ class Step extends BaseStep {
|
||||
$swDynaform = false;
|
||||
} //end foreach
|
||||
|
||||
|
||||
} //end if
|
||||
$oDataset->next();
|
||||
} //end while
|
||||
@@ -510,7 +497,7 @@ class Step extends BaseStep {
|
||||
//there is a db connection, you can not delete this connection
|
||||
return false;
|
||||
}
|
||||
die;
|
||||
die();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -518,7 +505,7 @@ class Step extends BaseStep {
|
||||
*
|
||||
* @author Erik A. O. <erik@colosa.com>
|
||||
*/
|
||||
function getAllCaseSteps($PRO_UID, $TAS_UID, $APP_UID)
|
||||
public function getAllCaseSteps ($PRO_UID, $TAS_UID, $APP_UID)
|
||||
{
|
||||
|
||||
$c = new Criteria();
|
||||
@@ -537,7 +524,8 @@ class Step extends BaseStep {
|
||||
* @param string $sdbsUid the uid of the db connection
|
||||
* @author krlos <carlos@colosa.com>
|
||||
*/
|
||||
function lookingforUidGrids($sproUid,$sObjUID) {
|
||||
public function lookingforUidGrids ($sproUid, $sObjUID)
|
||||
{
|
||||
|
||||
require_once ("classes/model/DynaformPeer.php");
|
||||
G::LoadSystem( 'dynaformhandler' );
|
||||
@@ -551,7 +539,6 @@ class Step extends BaseStep {
|
||||
$aRow = $oDataset->getRow();
|
||||
|
||||
if ($aRow['DYN_TYPE'] == 'xmlform') {
|
||||
|
||||
$oC1 = new Criteria( 'workflow' );
|
||||
$oC1->add( DynaformPeer::PRO_UID, $sproUid );
|
||||
$oC1->add( DynaformPeer::DYN_TYPE, "xmlform" );
|
||||
@@ -581,21 +568,6 @@ class Step extends BaseStep {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // Step
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
// Step
|
||||
|
||||
|
||||
Reference in New Issue
Block a user