CODE STYLE Format

Change format
This commit is contained in:
norahmollo
2012-10-19 18:50:57 +00:00
parent b17a5eff62
commit 9e9f4be8e6
5 changed files with 1342 additions and 1324 deletions

View File

@@ -1,231 +1,227 @@
<?php <?php
/** /**
* ReportTable.php * ReportTable.php
* @package workflow.engine.classes.model *
* * @package workflow.engine.classes.model
* ProcessMaker Open Source Edition *
* Copyright (C) 2004 - 2011 Colosa Inc. * ProcessMaker Open Source Edition
* * Copyright (C) 2004 - 2011 Colosa Inc.
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Affero General Public License as * This program is free software: you can redistribute it and/or modify
* published by the Free Software Foundation, either version 3 of the * it under the terms of the GNU Affero General Public License as
* License, or (at your option) any later version. * 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 * This program is distributed in the hope that it will be useful,
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * but WITHOUT ANY WARRANTY; without even the implied warranty of
* GNU Affero General Public License for more details. * 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/>. * 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, 2566 Le Jeune Rd., *
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/ *
*/
require_once 'classes/model/Content.php';
require_once 'classes/model/om/BaseReportTable.php'; require_once 'classes/model/Content.php';
require_once 'classes/model/om/BaseReportTable.php';
/** /**
* Skeleton subclass for representing a row from the 'REPORT_TABLE' table. * Skeleton subclass for representing a row from the 'REPORT_TABLE' table.
* *
* *
* *
* You should add additional methods to this class to meet the * You should add additional methods to this class to meet the
* application requirements. This class will only be generated as * application requirements. This class will only be generated as
* long as it does not already exist in the output directory. * long as it does not already exist in the output directory.
* *
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
*/ */
class ReportTable extends BaseReportTable { class ReportTable extends BaseReportTable
/** {
* This value goes in the content table /**
* @var string * This value goes in the content table
*/ *
protected $rep_tab_title = ''; * @var string
*/
/** protected $rep_tab_title = '';
* Get the rep_tab_title column value.
* @return string /**
*/ * Get the rep_tab_title column value.
public function getRepTabTitle() { *
if ( $this->getRepTabUid() == "" ) { * @return string
throw ( new Exception( "Error in getRepTabTitle, the getRepTabUid() can't be blank") ); */
} public function getRepTabTitle ()
$lang = defined ( 'SYS_LANG' ) ? SYS_LANG : 'en'; {
$this->rep_tab_title = Content::load ( 'REP_TAB_TITLE', '', $this->getRepTabUid(), $lang ); if ($this->getRepTabUid() == "") {
return $this->rep_tab_title; throw (new Exception( "Error in getRepTabTitle, the getRepTabUid() can't be blank" ));
} }
$lang = defined( 'SYS_LANG' ) ? SYS_LANG : 'en';
/** $this->rep_tab_title = Content::load( 'REP_TAB_TITLE', '', $this->getRepTabUid(), $lang );
* Set the rep_tab_title column value. return $this->rep_tab_title;
* }
* @param string $v new value
* @return void /**
*/ * Set the rep_tab_title column value.
public function setRepTabTitle($v) *
{ * @param string $v new value
if ( $this->getRepTabUid() == "" ) { * @return void
throw ( new Exception( "Error in setRepTabTitle, the setRepTabUid() can't be blank") ); */
} public function setRepTabTitle ($v)
$v=isset($v)?((string)$v):''; {
$lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en'; if ($this->getRepTabUid() == "") {
if ($this->rep_tab_title !== $v || $v==="") { throw (new Exception( "Error in setRepTabTitle, the setRepTabUid() can't be blank" ));
$this->rep_tab_title = $v; }
$res = Content::addContent( 'REP_TAB_TITLE', '', $this->getRepTabUid(), $lang, $this->rep_tab_title ); $v = isset( $v ) ? ((string) $v) : '';
return $res; $lang = defined( 'SYS_LANG' ) ? SYS_LANG : 'en';
} if ($this->rep_tab_title !== $v || $v === "") {
return 0; $this->rep_tab_title = $v;
} $res = Content::addContent( 'REP_TAB_TITLE', '', $this->getRepTabUid(), $lang, $this->rep_tab_title );
return $res;
public function load($RepTabUid) }
{ return 0;
try { }
$oRow = ReportTablePeer::retrieveByPK( $RepTabUid );
if (!is_null($oRow)) public function load ($RepTabUid)
{ {
$aFields = $oRow->toArray(BasePeer::TYPE_FIELDNAME); try {
$this->fromArray($aFields, BasePeer::TYPE_FIELDNAME); $oRow = ReportTablePeer::retrieveByPK( $RepTabUid );
$this->setNew(false); if (! is_null( $oRow )) {
$this->setRepTabTitle($aFields['REP_TAB_TITLE']=$this->getRepTabTitle()); $aFields = $oRow->toArray( BasePeer::TYPE_FIELDNAME );
return $aFields; $this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
} $this->setNew( false );
else { $this->setRepTabTitle( $aFields['REP_TAB_TITLE'] = $this->getRepTabTitle() );
//throw( new Exception( "The row '$RepTabUid' in table ReportTable doesn't exist!" )); return $aFields;
return array(); } else {
} //throw( new Exception( "The row '$RepTabUid' in table ReportTable doesn't exist!" ));
} return array ();
catch (Exception $oError) { }
throw($oError); } catch (Exception $oError) {
} throw ($oError);
} }
public function create($aData) }
{
$con = Propel::getConnection(ReportTablePeer::DATABASE_NAME); public function create ($aData)
try {
{ $con = Propel::getConnection( ReportTablePeer::DATABASE_NAME );
$con->begin(); try {
if ( isset ( $aData['REP_TAB_UID'] ) && $aData['REP_TAB_UID']== '' ) $con->begin();
unset ( $aData['REP_TAB_UID'] ); if (isset( $aData['REP_TAB_UID'] ) && $aData['REP_TAB_UID'] == '') {
if ( !isset ( $aData['REP_TAB_UID'] ) ) unset( $aData['REP_TAB_UID'] );
$this->setRepTabUid(G::generateUniqueID()); }
else if (! isset( $aData['REP_TAB_UID'] )) {
$this->setRepTabUid($aData['REP_TAB_UID'] ); $this->setRepTabUid( G::generateUniqueID() );
} else {
$this->setProUid($aData['PRO_UID']); $this->setRepTabUid( $aData['REP_TAB_UID'] );
$this->setRepTabName($aData['REP_TAB_NAME']); }
$this->setRepTabType($aData['REP_TAB_TYPE']);
if ( !isset ( $aData['REP_TAB_GRID'] ) ) $this->setProUid( $aData['PRO_UID'] );
$this->setRepTabGrid(""); $this->setRepTabName( $aData['REP_TAB_NAME'] );
else $this->setRepTabType( $aData['REP_TAB_TYPE'] );
$this->setRepTabGrid( $aData['REP_TAB_GRID'] ); if (! isset( $aData['REP_TAB_GRID'] )) {
if ( !isset ( $aData['REP_TAB_CONNECTION'] ) ) $this->setRepTabGrid( "" );
$this->setRepTabConnection("report"); } else {
else $this->setRepTabGrid( $aData['REP_TAB_GRID'] );
$this->setRepTabConnection( $aData['REP_TAB_CONNECTION'] ); }
$this->setRepTabCreateDate(date('Y-m-d H:i:s')); if (! isset( $aData['REP_TAB_CONNECTION'] )) {
$this->setRepTabStatus('ACTIVE'); $this->setRepTabConnection( "report" );
} else {
if($this->validate()) $this->setRepTabConnection( $aData['REP_TAB_CONNECTION'] );
{ }
if ( !isset ( $aData['REP_TAB_TITLE'] ) ) $this->setRepTabCreateDate( date( 'Y-m-d H:i:s' ) );
$this->setRepTabTitle(""); $this->setRepTabStatus( 'ACTIVE' );
else
$this->setRepTabTitle( $aData['REP_TAB_TITLE'] ); if ($this->validate()) {
if (! isset( $aData['REP_TAB_TITLE'] )) {
$result=$this->save(); $this->setRepTabTitle( "" );
$con->commit(); } else {
return $result; $this->setRepTabTitle( $aData['REP_TAB_TITLE'] );
} }
else $result = $this->save();
{ $con->commit();
$con->rollback(); return $result;
throw(new Exception("Failed Validation in class ".get_class($this).".")); } else {
} $con->rollback();
} throw (new Exception( "Failed Validation in class " . get_class( $this ) . "." ));
catch(Exception $e) }
{ } catch (Exception $e) {
$con->rollback(); $con->rollback();
throw($e); throw ($e);
} }
} }
public function update($fields)
{ public function update ($fields)
$con = Propel::getConnection(ReportTablePeer::DATABASE_NAME); {
try $con = Propel::getConnection( ReportTablePeer::DATABASE_NAME );
{ try {
$con->begin(); $con->begin();
$this->load($fields['REP_TAB_UID']); $this->load( $fields['REP_TAB_UID'] );
$this->fromArray($fields,BasePeer::TYPE_FIELDNAME); $this->fromArray( $fields, BasePeer::TYPE_FIELDNAME );
$sDataBase = 'database_' . strtolower(DB_ADAPTER); $sDataBase = 'database_' . strtolower( DB_ADAPTER );
if(G::LoadSystemExist($sDataBase)){ if (G::LoadSystemExist( $sDataBase )) {
G::LoadSystem($sDataBase); G::LoadSystem( $sDataBase );
$oDataBase = new database(); $oDataBase = new database();
$oValidate = $oDataBase->getValidate($this->validate()); $oValidate = $oDataBase->getValidate( $this->validate() );
} else { } else {
$oValidate = $this->validate(); $oValidate = $this->validate();
} }
// if($this->validate()) // if($this->validate())
if($oValidate) if ($oValidate) {
{ $contentResult = 0;
$contentResult=0; if (array_key_exists( "REP_TAB_TITLE", $fields )) {
if (array_key_exists("REP_TAB_TITLE", $fields)) $contentResult+=$this->setRepTabTitle($fields["REP_TAB_TITLE"]); $contentResult += $this->setRepTabTitle( $fields["REP_TAB_TITLE"] );
$result=$this->save(); }
$result=($result==0)?($contentResult>0?1:0):$result; $result = $this->save();
$con->commit(); $result = ($result == 0) ? ($contentResult > 0 ? 1 : 0) : $result;
return $result; $con->commit();
} return $result;
else } else {
{ $con->rollback();
$con->rollback(); $validationE = new Exception( "Failed Validation in class " . get_class( $this ) . "." );
$validationE=new Exception("Failed Validation in class ".get_class($this)."."); $validationE->aValidationFailures = $this->getValidationFailures();
$validationE->aValidationFailures = $this->getValidationFailures(); throw ($validationE);
throw($validationE); }
} } catch (Exception $e) {
} $con->rollback();
catch(Exception $e) throw ($e);
{ }
$con->rollback(); }
throw($e);
} public function remove ($RepTabUid)
} {
public function remove($RepTabUid) $con = Propel::getConnection( ReportTablePeer::DATABASE_NAME );
{ try {
$con = Propel::getConnection(ReportTablePeer::DATABASE_NAME); $con->begin();
try $oRepTab = ReportTablePeer::retrieveByPK( $RepTabUid );
{ if (! is_null( $oRepTab )) {
$con->begin(); Content::removeContent( 'REP_TAB_TITLE', '', $this->getRepTabUid() );
$oRepTab = ReportTablePeer::retrieveByPK( $RepTabUid ); $result = $oRepTab->delete();
if (!is_null($oRepTab)) { $con->commit();
Content::removeContent( 'REP_TAB_TITLE', '', $this->getRepTabUid()); }
$result = $oRepTab->delete(); return $result;
$con->commit(); } catch (Exception $e) {
} $con->rollback();
return $result; throw ($e);
} }
catch(Exception $e) }
{
$con->rollback(); public function reportTableExists ($RepTabUid)
throw($e); {
} $con = Propel::getConnection( ReportTablePeer::DATABASE_NAME );
} try {
$oRepTabUid = ReportTablePeer::retrieveByPk( $RepTabUid );
function reportTableExists ( $RepTabUid ) { if (is_object( $oRepTabUid ) && get_class( $oRepTabUid ) == 'ReportTable') {
$con = Propel::getConnection(ReportTablePeer::DATABASE_NAME); return true;
try { } else {
$oRepTabUid = ReportTablePeer::retrieveByPk( $RepTabUid ); return false;
if (is_object($oRepTabUid) && get_class ($oRepTabUid) == 'ReportTable' ) { }
return true; } catch (Exception $oError) {
} throw ($oError);
else { }
return false; }
} }
} // ReportTable
catch (Exception $oError) {
throw($oError);
}
}
} // ReportTable

View File

@@ -1,216 +1,217 @@
<?php <?php
/** /**
* Route.php * Route.php
* @package workflow.engine.classes.model *
* * @package workflow.engine.classes.model
* ProcessMaker Open Source Edition *
* Copyright (C) 2004 - 2011 Colosa Inc. * ProcessMaker Open Source Edition
* * Copyright (C) 2004 - 2011 Colosa Inc.
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Affero General Public License as * This program is free software: you can redistribute it and/or modify
* published by the Free Software Foundation, either version 3 of the * it under the terms of the GNU Affero General Public License as
* License, or (at your option) any later version. * 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 * This program is distributed in the hope that it will be useful,
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * but WITHOUT ANY WARRANTY; without even the implied warranty of
* GNU Affero General Public License for more details. * 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/>. * 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, 2566 Le Jeune Rd., *
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/ *
*/
require_once 'classes/model/om/BaseRoute.php';
require_once 'classes/model/Content.php'; require_once 'classes/model/om/BaseRoute.php';
require_once 'classes/model/Content.php';
/**
* Skeleton subclass for representing a row from the 'ROUTE' table. /**
* * Skeleton subclass for representing a row from the 'ROUTE' table.
* *
* *
* You should add additional methods to this class to meet the *
* application requirements. This class will only be generated as * You should add additional methods to this class to meet the
* long as it does not already exist in the output directory. * application requirements. This class will only be generated as
* * long as it does not already exist in the output directory.
* @package workflow.engine.classes.model *
*/ * @package workflow.engine.classes.model
class Route extends BaseRoute { */
class Route extends BaseRoute
/* {
/*
* Load the application document registry * Load the application document registry
* @param string $sRouUid * @param string $sRouUid
* @return variant * @return variant
*/ */
public function load($sRouUid) public function load ($sRouUid)
{ {
try { try {
$oRoute = RoutePeer::retrieveByPK($sRouUid); $oRoute = RoutePeer::retrieveByPK( $sRouUid );
if (!is_null($oRoute)) if (! is_null( $oRoute )) {
{ $aFields = $oRoute->toArray( BasePeer::TYPE_FIELDNAME );
$aFields = $oRoute->toArray(BasePeer::TYPE_FIELDNAME); $this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
$this->fromArray($aFields, BasePeer::TYPE_FIELDNAME); return $aFields;
return $aFields; } else {
} throw (new Exception( 'This row doesn\'t exist!' ));
else { }
throw(new Exception('This row doesn\'t exist!')); } catch (Exception $oError) {
} throw ($oError);
} }
catch (Exception $oError) { }
throw($oError);
} /**
} * Create the application document registry
*
/** * @param array $aData
* Create the application document registry * @return string
* @param array $aData *
* @return string */
**/ public function create ($aData)
public function create($aData) {
{ $oConnection = Propel::getConnection( RoutePeer::DATABASE_NAME );
$oConnection = Propel::getConnection(RoutePeer::DATABASE_NAME); try {
try { $sRouteUID = G::generateUniqueID();
$sRouteUID = G::generateUniqueID(); $aData['ROU_UID'] = $sRouteUID;
$aData['ROU_UID'] = $sRouteUID; $oRoute = new Route();
$oRoute = new Route();
// validating default values
// validating default values $aData['ROU_TO_LAST_USER'] = $this->validateValue( isset( $aData['ROU_TO_LAST_USER'] ) ? $aData['ROU_TO_LAST_USER'] : '', array ('TRUE','FALSE'
$aData['ROU_TO_LAST_USER'] = $this->validateValue(isset($aData['ROU_TO_LAST_USER']) ? $aData['ROU_TO_LAST_USER'] : '', array('TRUE', 'FALSE'), 'FALSE'); ), 'FALSE' );
$aData['ROU_OPTIONAL'] = $this->validateValue(isset($aData['ROU_OPTIONAL']) ? $aData['ROU_OPTIONAL'] : '', array('TRUE', 'FALSE'), 'FALSE'); $aData['ROU_OPTIONAL'] = $this->validateValue( isset( $aData['ROU_OPTIONAL'] ) ? $aData['ROU_OPTIONAL'] : '', array ('TRUE','FALSE'
$aData['ROU_SEND_EMAIL'] = $this->validateValue(isset($aData['ROU_SEND_EMAIL']) ? $aData['ROU_SEND_EMAIL']: '', array('TRUE', 'FALSE'), 'TRUE'); ), 'FALSE' );
$aData['ROU_SEND_EMAIL'] = $this->validateValue( isset( $aData['ROU_SEND_EMAIL'] ) ? $aData['ROU_SEND_EMAIL'] : '', array ('TRUE','FALSE'
$oRoute->fromArray($aData, BasePeer::TYPE_FIELDNAME); ), 'TRUE' );
if ($oRoute->validate()) { $oRoute->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
$oConnection->begin();
$iResult = $oRoute->save(); if ($oRoute->validate()) {
$oConnection->commit(); $oConnection->begin();
return $sRouteUID; $iResult = $oRoute->save();
} $oConnection->commit();
else { return $sRouteUID;
$sMessage = ''; } else {
$aValidationFailures = $oRoute->getValidationFailures(); $sMessage = '';
foreach($aValidationFailures as $oValidationFailure) { $aValidationFailures = $oRoute->getValidationFailures();
$sMessage .= $oValidationFailure->getMessage() . '<br />'; foreach ($aValidationFailures as $oValidationFailure) {
} $sMessage .= $oValidationFailure->getMessage() . '<br />';
throw(new Exception('The registry cannot be created!<br />'.$sMessage)); }
} throw (new Exception( 'The registry cannot be created!<br />' . $sMessage ));
} }
catch (Exception $oError) { } catch (Exception $oError) {
$oConnection->rollback(); $oConnection->rollback();
throw($oError); throw ($oError);
} }
} }
/**
/** * Update the application document registry
* Update the application document registry *
* @param array $aData * @param array $aData
* @return string * @return string
**/ *
public function update($aData) */
{ public function update ($aData)
$oConnection = Propel::getConnection(RoutePeer::DATABASE_NAME); {
try { $oConnection = Propel::getConnection( RoutePeer::DATABASE_NAME );
$oRoute = RoutePeer::retrieveByPK($aData['ROU_UID']); try {
if (!is_null($oRoute)) $oRoute = RoutePeer::retrieveByPK( $aData['ROU_UID'] );
{ if (! is_null( $oRoute )) {
// validating default values // validating default values
if (isset($aData['ROU_TO_LAST_USER'])) { if (isset( $aData['ROU_TO_LAST_USER'] )) {
$aData['ROU_TO_LAST_USER'] = $this->validateValue($aData['ROU_TO_LAST_USER'], array('TRUE', 'FALSE'), 'FALSE'); $aData['ROU_TO_LAST_USER'] = $this->validateValue( $aData['ROU_TO_LAST_USER'], array ('TRUE','FALSE'
} ), 'FALSE' );
if (isset($aData['ROU_OPTIONAL'])) { }
$aData['ROU_OPTIONAL'] = $this->validateValue($aData['ROU_OPTIONAL'], array('TRUE', 'FALSE'), 'FALSE'); if (isset( $aData['ROU_OPTIONAL'] )) {
} $aData['ROU_OPTIONAL'] = $this->validateValue( $aData['ROU_OPTIONAL'], array ('TRUE','FALSE'
if (isset($aData['ROU_SEND_EMAIL'])) { ), 'FALSE' );
$aData['ROU_SEND_EMAIL'] = $this->validateValue($aData['ROU_SEND_EMAIL'], array('TRUE', 'FALSE'), 'TRUE'); }
} if (isset( $aData['ROU_SEND_EMAIL'] )) {
$aData['ROU_SEND_EMAIL'] = $this->validateValue( $aData['ROU_SEND_EMAIL'], array ('TRUE','FALSE'
$oRoute->fromArray($aData, BasePeer::TYPE_FIELDNAME); ), 'TRUE' );
if ($oRoute->validate()) { }
$oConnection->begin();
$iResult = $oRoute->save(); $oRoute->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
$oConnection->commit(); if ($oRoute->validate()) {
return $iResult; $oConnection->begin();
} $iResult = $oRoute->save();
else { $oConnection->commit();
$sMessage = ''; return $iResult;
$aValidationFailures = $oRoute->getValidationFailures(); } else {
foreach($aValidationFailures as $oValidationFailure) { $sMessage = '';
$sMessage .= $oValidationFailure->getMessage() . '<br />'; $aValidationFailures = $oRoute->getValidationFailures();
} foreach ($aValidationFailures as $oValidationFailure) {
throw(new Exception('The ROUTE tables cannot be updated!<br />'.$sMessage)); $sMessage .= $oValidationFailure->getMessage() . '<br />';
} }
} throw (new Exception( 'The ROUTE tables cannot be updated!<br />' . $sMessage ));
else { }
throw(new Exception( "The row " . $aData['ROU_UID'] . " doesn't exist!" )); } else {
} throw (new Exception( "The row " . $aData['ROU_UID'] . " doesn't exist!" ));
} }
catch (Exception $oError) { } catch (Exception $oError) {
$oConnection->rollback(); $oConnection->rollback();
throw($oError); throw ($oError);
} }
} }
/** /**
* Remove the application document registry * Remove the application document registry
* @param array $aData *
* @return string * @param array $aData
**/ * @return string
public function remove($sRouUid) *
{ */
$oConnection = Propel::getConnection(RoutePeer::DATABASE_NAME); public function remove ($sRouUid)
try { {
$oRoute = RoutePeer::retrieveByPK($sRouUid); $oConnection = Propel::getConnection( RoutePeer::DATABASE_NAME );
if (!is_null($oRoute)) try {
{ $oRoute = RoutePeer::retrieveByPK( $sRouUid );
$oConnection->begin(); if (! is_null( $oRoute )) {
$iResult = $oRoute->delete(); $oConnection->begin();
$oConnection->commit(); $iResult = $oRoute->delete();
return $iResult; $oConnection->commit();
} return $iResult;
else { } else {
throw(new Exception('This row doesn\'t exist!')); throw (new Exception( 'This row doesn\'t exist!' ));
} }
} } catch (Exception $oError) {
catch (Exception $oError) { $oConnection->rollback();
$oConnection->rollback(); throw ($oError);
throw($oError); }
} }
}
public function routeExists ($sRouUid)
function routeExists ( $sRouUid ) { {
$con = Propel::getConnection(RoutePeer::DATABASE_NAME); $con = Propel::getConnection( RoutePeer::DATABASE_NAME );
try { try {
$oRouUid = RoutePeer::retrieveByPk( $sRouUid ); $oRouUid = RoutePeer::retrieveByPk( $sRouUid );
if (is_object($oRouUid) && get_class ($oRouUid) == 'Route' ) { if (is_object( $oRouUid ) && get_class( $oRouUid ) == 'Route') {
return true; return true;
} } else {
else { return false;
return false; }
} } catch (Exception $oError) {
} throw ($oError);
catch (Exception $oError) { }
throw($oError); }
}
} /**
* Validate value for a variable that only accepts some determinated values
/** *
* Validate value for a variable that only accepts some determinated values * @param $value string - value to test
* * @param $validValues array - list of valid values
* @param $value string - value to test * @param $default string default value, if the tested value is not valid the default value is returned
* @param $validValues array - list of valid values * @return the tested and accepted value
* @param $default string default value, if the tested value is not valid the default value is returned */
* @return the tested and accepted value public function validateValue ($value, $validValues, $default)
*/ {
function validateValue($value, $validValues, $default) if (! in_array( $value, $validValues )) {
{ $value = $default;
if (!in_array($value, $validValues)) { }
$value = $default; return $value;
} }
}
return $value; // Route
}
} // Route

View File

@@ -1,200 +1,193 @@
<?php <?php
/** /**
* Stage.php * Stage.php
* @package workflow.engine.classes.model *
*/ * @package workflow.engine.classes.model
*/
require_once 'classes/model/Content.php';
require_once 'classes/model/om/BaseStage.php'; require_once 'classes/model/Content.php';
require_once 'classes/model/om/BaseStage.php';
/** /**
* Skeleton subclass for representing a row from the 'STAGE' table. * Skeleton subclass for representing a row from the 'STAGE' table.
* *
* *
* *
* You should add additional methods to this class to meet the * You should add additional methods to this class to meet the
* application requirements. This class will only be generated as * application requirements. This class will only be generated as
* long as it does not already exist in the output directory. * long as it does not already exist in the output directory.
* *
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
*/ */
class Stage extends BaseStage { class Stage extends BaseStage
{
/** /**
* This value goes in the content table * This value goes in the content table
* @var string *
*/ * @var string
protected $stg_title = ''; */
protected $stg_title = '';
/**
* Get the stg_title column value. /**
* @return string * Get the stg_title column value.
*/ *
public function getStgTitle() { * @return string
if ( $this->getStgUid() == "" ) { */
throw ( new Exception( "Error in getStgTitle, the getStgUid() can't be blank") ); public function getStgTitle ()
} {
$lang = defined ( 'SYS_LANG' ) ? SYS_LANG : 'en'; if ($this->getStgUid() == "") {
$this->stg_title = Content::load ( 'STG_TITLE', '', $this->getStgUid(), $lang ); throw (new Exception( "Error in getStgTitle, the getStgUid() can't be blank" ));
return $this->stg_title; }
} $lang = defined( 'SYS_LANG' ) ? SYS_LANG : 'en';
$this->stg_title = Content::load( 'STG_TITLE', '', $this->getStgUid(), $lang );
/** return $this->stg_title;
* Set the stg_title column value. }
*
* @param string $v new value /**
* @return void * Set the stg_title column value.
*/ *
public function setStgTitle($v) * @param string $v new value
{ * @return void
if ( $this->getStgUid() == "" ) { */
throw ( new Exception( "Error in setStgTitle, the setStgUid() can't be blank") ); public function setStgTitle ($v)
} {
$v=isset($v)?((string)$v):''; if ($this->getStgUid() == "") {
$lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en'; throw (new Exception( "Error in setStgTitle, the setStgUid() can't be blank" ));
if ($this->stg_title !== $v || $v==="") { }
$this->stg_title = $v; $v = isset( $v ) ? ((string) $v) : '';
$res = Content::addContent( 'STG_TITLE', '', $this->getStgUid(), $lang, $this->stg_title ); $lang = defined( 'SYS_LANG' ) ? SYS_LANG : 'en';
return $res; if ($this->stg_title !== $v || $v === "") {
} $this->stg_title = $v;
return 0; $res = Content::addContent( 'STG_TITLE', '', $this->getStgUid(), $lang, $this->stg_title );
} return $res;
}
public function load($StgUid) return 0;
{ }
try {
$oRow = StagePeer::retrieveByPK( $StgUid ); public function load ($StgUid)
if (!is_null($oRow)) {
{ try {
$aFields = $oRow->toArray(BasePeer::TYPE_FIELDNAME); $oRow = StagePeer::retrieveByPK( $StgUid );
$this->fromArray($aFields, BasePeer::TYPE_FIELDNAME); if (! is_null( $oRow )) {
$this->setNew(false); $aFields = $oRow->toArray( BasePeer::TYPE_FIELDNAME );
$this->setStgTitle($aFields['STG_TITLE'] = $this->getStgTitle()); $this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
return $aFields; $this->setNew( false );
} $this->setStgTitle( $aFields['STG_TITLE'] = $this->getStgTitle() );
else { return $aFields;
throw( new Exception( "The row '$StgUid' in table Stage doesn't exist!" )); } else {
} throw (new Exception( "The row '$StgUid' in table Stage doesn't exist!" ));
} }
catch (Exception $oError) { } catch (Exception $oError) {
throw($oError); throw ($oError);
} }
} }
public function create($aData) { public function create ($aData)
$oConnection = Propel::getConnection(StagePeer::DATABASE_NAME); {
try { $oConnection = Propel::getConnection( StagePeer::DATABASE_NAME );
if ( isset ( $aData['STG_UID'] ) && $aData['STG_UID']== '' ) try {
unset ( $aData['STG_UID'] ); if (isset( $aData['STG_UID'] ) && $aData['STG_UID'] == '') {
if ( !isset ( $aData['STG_UID'] ) ) unset( $aData['STG_UID'] );
$aData['STG_UID'] = G::generateUniqueID(); }
$oStage = new Stage(); if (! isset( $aData['STG_UID'] )) {
$oStage->fromArray($aData, BasePeer::TYPE_FIELDNAME); $aData['STG_UID'] = G::generateUniqueID();
$oStage->setStgTitle($aData['STG_TITLE']); }
if ($oStage->validate()) { $oStage = new Stage();
$oConnection->begin(); $oStage->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
$iResult = $oStage->save(); $oStage->setStgTitle( $aData['STG_TITLE'] );
$oConnection->commit(); if ($oStage->validate()) {
return $aData['STG_UID']; $oConnection->begin();
} $iResult = $oStage->save();
else { $oConnection->commit();
$sMessage = ''; return $aData['STG_UID'];
$aValidationFailures = $oStage->getValidationFailures(); } else {
foreach($aValidationFailures as $oValidationFailure) { $sMessage = '';
$sMessage .= $oValidationFailure->getMessage() . '<br />'; $aValidationFailures = $oStage->getValidationFailures();
} foreach ($aValidationFailures as $oValidationFailure) {
throw(new Exception('The registry cannot be created!<br />'.$sMessage)); $sMessage .= $oValidationFailure->getMessage() . '<br />';
} }
} throw (new Exception( 'The registry cannot be created!<br />' . $sMessage ));
catch (Exception $oError) { }
$oConnection->rollback(); } catch (Exception $oError) {
throw($oError); $oConnection->rollback();
} throw ($oError);
} }
}
public function update($fields)
{ public function update ($fields)
$con = Propel::getConnection(StagePeer::DATABASE_NAME); {
try $con = Propel::getConnection( StagePeer::DATABASE_NAME );
{ try {
$con->begin(); $con->begin();
$this->load($fields['STG_UID']); $this->load( $fields['STG_UID'] );
$this->fromArray($fields, BasePeer::TYPE_FIELDNAME); $this->fromArray( $fields, BasePeer::TYPE_FIELDNAME );
if($this->validate()) if ($this->validate()) {
{ $contentResult = 0;
$contentResult=0; if (array_key_exists( "STG_TITLE", $fields )) {
if (array_key_exists("STG_TITLE", $fields)) $contentResult+=$this->setStgTitle($fields["STG_TITLE"]); $contentResult += $this->setStgTitle( $fields["STG_TITLE"] );
$result=$this->save(); }
$result=($result==0)?($contentResult>0?1:0):$result; $result = $this->save();
$con->commit(); $result = ($result == 0) ? ($contentResult > 0 ? 1 : 0) : $result;
return $result; $con->commit();
} return $result;
else } else {
{ $con->rollback();
$con->rollback(); $validationE = new Exception( "Failed Validation in class " . get_class( $this ) . "." );
$validationE=new Exception("Failed Validation in class ".get_class($this)."."); $validationE->aValidationFailures = $this->getValidationFailures();
$validationE->aValidationFailures = $this->getValidationFailures(); throw ($validationE);
throw($validationE); }
} } catch (Exception $e) {
} $con->rollback();
catch(Exception $e) throw ($e);
{ }
$con->rollback(); }
throw($e);
} public function remove ($StgUid)
} {
$con = Propel::getConnection( StagePeer::DATABASE_NAME );
public function remove($StgUid) try {
{ $con->begin();
$con = Propel::getConnection(StagePeer::DATABASE_NAME); $oStage = StagePeer::retrieveByPK( $StgUid );
try if (! is_null( $oStage )) {
{ Content::removeContent( 'STG_TITLE', '', $this->getStgUid() );
$con->begin(); $result = $oStage->delete();
$oStage = StagePeer::retrieveByPK( $StgUid ); $con->commit();
if (!is_null($oStage)) { }
Content::removeContent( 'STG_TITLE', '', $this->getStgUid()); return $result;
$result = $oStage->delete(); } catch (Exception $e) {
$con->commit(); $con->rollback();
} throw ($e);
return $result; }
} }
catch(Exception $e)
{ public function reorderPositions ($sProcessUID, $iIndex)
$con->rollback(); {
throw($e); try {
} $oCriteria = new Criteria( 'workflow' );
} $oCriteria->add( StagePeer::PRO_UID, $sProcessUID );
$oCriteria->add( StagePeer::STG_INDEX, $iIndex, '>' );
function reorderPositions($sProcessUID, $iIndex) { $oDataset = StagePeer::doSelectRS( $oCriteria );
try { $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oCriteria = new Criteria('workflow'); $oDataset->next();
$oCriteria->add(StagePeer::PRO_UID, $sProcessUID); while ($aRow = $oDataset->getRow()) {
$oCriteria->add(StagePeer::STG_INDEX, $iIndex, '>'); $this->update( array ('STG_UID' => $aRow['STG_UID'],'PRO_UID' => $aRow['PRO_UID'],'STG_POSX' => $aRow['STG_POSX'],'STG_POSY' => $aRow['STG_POSY'],'STG_INDEX' => $aRow['STG_INDEX'] - 1
$oDataset = StagePeer::doSelectRS($oCriteria); ) );
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next();
$oDataset->next(); }
while ($aRow = $oDataset->getRow()) { } catch (Exception $oException) {
$this->update(array('STG_UID' => $aRow['STG_UID'], throw $Exception;
'PRO_UID' => $aRow['PRO_UID'], }
'STG_POSX' => $aRow['STG_POSX'], }
'STG_POSY' => $aRow['STG_POSY'],
'STG_INDEX' => $aRow['STG_INDEX'] - 1)); public function Exists ($sUid)
$oDataset->next(); {
} try {
} $oObj = StagePeer::retrieveByPk( $sUid );
catch (Exception $oException) { return (is_object( $oObj ) && get_class( $oObj ) == 'Stage');
throw $Exception; } catch (Exception $oError) {
} throw ($oError);
} }
}
function Exists ( $sUid ) { }
try { // Stage
$oObj = StagePeer::retrieveByPk($sUid);
return (is_object($oObj) && get_class($oObj) == 'Stage');
}
catch (Exception $oError) {
throw($oError);
}
}
} // Stage

View File

@@ -1,230 +1,229 @@
<?php <?php
/** /**
* StepSupervisor.php * StepSupervisor.php
* @package workflow.engine.classes.model *
*/ * @package workflow.engine.classes.model
*/
require_once 'classes/model/om/BaseStepSupervisor.php';
require_once 'classes/model/om/BaseStepSupervisor.php';
/** /**
* Skeleton subclass for representing a row from the 'STEP_SUPERVISOR' table. * Skeleton subclass for representing a row from the 'STEP_SUPERVISOR' table.
* *
* *
* *
* You should add additional methods to this class to meet the * You should add additional methods to this class to meet the
* application requirements. This class will only be generated as * application requirements. This class will only be generated as
* long as it does not already exist in the output directory. * long as it does not already exist in the output directory.
* *
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
*/ */
class StepSupervisor extends BaseStepSupervisor { class StepSupervisor extends BaseStepSupervisor
{
public function load($Uid) public function load ($Uid)
{ {
try { try {
$oRow = StepSupervisorPeer::retrieveByPK( $Uid ); $oRow = StepSupervisorPeer::retrieveByPK( $Uid );
if (!is_null($oRow)) if (! is_null( $oRow )) {
{ $aFields = $oRow->toArray( BasePeer::TYPE_FIELDNAME );
$aFields = $oRow->toArray(BasePeer::TYPE_FIELDNAME); $this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
$this->fromArray($aFields,BasePeer::TYPE_FIELDNAME); $this->setNew( false );
$this->setNew(false); return $aFields;
return $aFields; } else {
} throw (new Exception( "The row '$Uid' in table StepSupervisor doesn't exist!" ));
else { }
throw( new Exception( "The row '$Uid' in table StepSupervisor doesn't exist!" )); } catch (Exception $oError) {
} throw ($oError);
} }
catch (Exception $oError) { }
throw($oError);
} public function Exists ($Uid)
} {
try {
function Exists ( $Uid ) { $oPro = StepSupervisorPeer::retrieveByPk( $Uid );
try { if (is_object( $oPro ) && get_class( $oPro ) == 'StepSupervisor') {
$oPro = StepSupervisorPeer::retrieveByPk( $Uid ); return true;
if (is_object($oPro) && get_class ($oPro) == 'StepSupervisor' ) { } else {
return true; return false;
} }
else { } catch (Exception $oError) {
return false; throw ($oError);
} }
} }
catch (Exception $oError) {
throw($oError); /**
} * Create the step supervisor registry
} *
* @param array $aData
/** * @return boolean
* Create the step supervisor registry *
* @param array $aData */
* @return boolean public function create ($aData)
**/ {
public function create($aData) $oConnection = Propel::getConnection( StepSupervisorPeer::DATABASE_NAME );
{ try {
$oConnection = Propel::getConnection(StepSupervisorPeer::DATABASE_NAME); if (isset( $aData['STEP_UID'] ) && $aData['STEP_UID'] == '') {
try { unset( $aData['STEP_UID'] );
if ( isset ( $aData['STEP_UID'] ) && $aData['STEP_UID']== '' ) }
unset ( $aData['STEP_UID'] ); if (! isset( $aData['STEP_UID'] )) {
if ( !isset ( $aData['STEP_UID'] ) ) $aData['STEP_UID'] = G::generateUniqueID();
$aData['STEP_UID'] = G::generateUniqueID(); }
$oStepSupervisor = new StepSupervisor(); $oStepSupervisor = new StepSupervisor();
$oStepSupervisor->fromArray($aData, BasePeer::TYPE_FIELDNAME); $oStepSupervisor->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
if ($oStepSupervisor->validate()) { if ($oStepSupervisor->validate()) {
$oConnection->begin(); $oConnection->begin();
$iResult = $oStepSupervisor->save(); $iResult = $oStepSupervisor->save();
$oConnection->commit(); $oConnection->commit();
return true; return true;
} } else {
else { $sMessage = '';
$sMessage = ''; $aValidationFailures = $oStepSupervisor->getValidationFailures();
$aValidationFailures = $oStepSupervisor->getValidationFailures(); foreach ($aValidationFailures as $oValidationFailure) {
foreach($aValidationFailures as $oValidationFailure) { $sMessage .= $oValidationFailure->getMessage() . '<br />';
$sMessage .= $oValidationFailure->getMessage() . '<br />'; }
} throw (new Exception( 'The registry cannot be created!<br />' . $sMessage ));
throw(new Exception('The registry cannot be created!<br />'.$sMessage)); }
} } catch (Exception $oError) {
} $oConnection->rollback();
catch (Exception $oError) { throw ($oError);
$oConnection->rollback(); }
throw($oError); }
}
} /**
* Update the step supervisor registry
/** *
* Update the step supervisor registry * @param array $aData
* @param array $aData * @return integer
* @return integer *
**/ */
public function update($aData) public function update ($aData)
{ {
$oConnection = Propel::getConnection(StepSupervisorPeer::DATABASE_NAME); $oConnection = Propel::getConnection( StepSupervisorPeer::DATABASE_NAME );
try { try {
$oStepSupervisor = StepSupervisorPeer::retrieveByPK($aData['STEP_UID']); $oStepSupervisor = StepSupervisorPeer::retrieveByPK( $aData['STEP_UID'] );
if (!is_null($oStepSupervisor)) if (! is_null( $oStepSupervisor )) {
{ $oStepSupervisor->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
$oStepSupervisor->fromArray($aData, BasePeer::TYPE_FIELDNAME); if ($oStepSupervisor->validate()) {
if ($oStepSupervisor->validate()) { $oConnection->begin();
$oConnection->begin(); $iResult = $oStepSupervisor->save();
$iResult = $oStepSupervisor->save(); $oConnection->commit();
$oConnection->commit(); return $iResult;
return $iResult; } else {
} $sMessage = '';
else { $aValidationFailures = $oStepSupervisor->getValidationFailures();
$sMessage = ''; foreach ($aValidationFailures as $oValidationFailure) {
$aValidationFailures = $oStepSupervisor->getValidationFailures(); $sMessage .= $oValidationFailure->getMessage() . '<br />';
foreach($aValidationFailures as $oValidationFailure) { }
$sMessage .= $oValidationFailure->getMessage() . '<br />'; throw (new Exception( 'The registry cannot be updated!<br />' . $sMessage ));
} }
throw(new Exception('The registry cannot be updated!<br />'.$sMessage)); } else {
} throw (new Exception( 'This row doesn\'t exist!' ));
} }
else { } catch (Exception $oError) {
throw(new Exception('This row doesn\'t exist!')); $oConnection->rollback();
} throw ($oError);
} }
catch (Exception $oError) { }
$oConnection->rollback();
throw($oError); /**
} * Remove the step supervisor registry
} *
* @param string $sStepUID
/** * @return integer
* Remove the step supervisor registry *
* @param string $sStepUID */
* @return integer public function remove ($sStepUID)
**/ {
public function remove($sStepUID) $oConnection = Propel::getConnection( StepSupervisorPeer::DATABASE_NAME );
{ try {
$oConnection = Propel::getConnection(StepSupervisorPeer::DATABASE_NAME); $oConnection->begin();
try { $this->setStepUid( $sStepUID );
$oConnection->begin(); $iResult = $this->delete();
$this->setStepUid($sStepUID); $oConnection->commit();
$iResult = $this->delete(); return $iResult;
$oConnection->commit(); } catch (Exception $oError) {
return $iResult; $oConnection->rollback();
} throw ($oError);
catch (Exception $oError) { }
$oConnection->rollback(); }
throw($oError);
} /**
} * Get the next position for a atep
*
/** * @param string $sProcessUID
* Get the next position for a atep * @return integer
* @param string $sProcessUID *
* @return integer */
**/ public function getNextPosition ($sProcessUID, $sType)
function getNextPosition($sProcessUID, $sType) { {
try { try {
$oCriteria = new Criteria('workflow'); $oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn('(COUNT(*) + 1) AS POSITION'); $oCriteria->addSelectColumn( '(COUNT(*) + 1) AS POSITION' );
$oCriteria->add(StepSupervisorPeer::PRO_UID, $sProcessUID); $oCriteria->add( StepSupervisorPeer::PRO_UID, $sProcessUID );
$oCriteria->add(StepSupervisorPeer::STEP_TYPE_OBJ, $sType); $oCriteria->add( StepSupervisorPeer::STEP_TYPE_OBJ, $sType );
$oDataset = StepSupervisorPeer::doSelectRS($oCriteria); $oDataset = StepSupervisorPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next(); $oDataset->next();
$aRow = $oDataset->getRow(); $aRow = $oDataset->getRow();
return (int)$aRow['POSITION']; return (int) $aRow['POSITION'];
} } catch (Exception $oException) {
catch (Exception $oException) { throw $Exception;
throw $Exception; }
} }
}
/**
/** * Reorder the steps positions
* Reorder the steps positions *
* @param string $sProcessUID * @param string $sProcessUID
* @param string $iPosition * @param string $iPosition
**/ *
function reorderPositions($sProcessUID, $iPosition, $sType) { */
try { public function reorderPositions ($sProcessUID, $iPosition, $sType)
$oCriteria = new Criteria('workflow'); {
$oCriteria->add(StepSupervisorPeer::PRO_UID, $sProcessUID); try {
$oCriteria->add(StepSupervisorPeer::STEP_TYPE_OBJ, $sType); $oCriteria = new Criteria( 'workflow' );
$oCriteria->add(StepSupervisorPeer::STEP_POSITION, $iPosition, '>'); $oCriteria->add( StepSupervisorPeer::PRO_UID, $sProcessUID );
$oDataset = StepSupervisorPeer::doSelectRS($oCriteria); $oCriteria->add( StepSupervisorPeer::STEP_TYPE_OBJ, $sType );
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oCriteria->add( StepSupervisorPeer::STEP_POSITION, $iPosition, '>' );
$oDataset->next();var_dump(StepSupervisorPeer::doCount($oCriteria)); $oDataset = StepSupervisorPeer::doSelectRS( $oCriteria );
while ($aRow = $oDataset->getRow()) {var_dump($aRow);echo "\n"; $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$this->update(array('STEP_UID' => $aRow['STEP_UID'], $oDataset->next();
'PRO_UID' => $aRow['PRO_UID'], var_dump( StepSupervisorPeer::doCount( $oCriteria ) );
'STEP_TYPE_OBJ' => $aRow['STEP_TYPE_OBJ'], while ($aRow = $oDataset->getRow()) {
'STEP_UID_OBJ' => $aRow['STEP_UID_OBJ'], var_dump( $aRow );
'STEP_POSITION' => $aRow['STEP_POSITION'] - 1)); echo "\n";
$oDataset->next(); $this->update( array ('STEP_UID' => $aRow['STEP_UID'],'PRO_UID' => $aRow['PRO_UID'],'STEP_TYPE_OBJ' => $aRow['STEP_TYPE_OBJ'],'STEP_UID_OBJ' => $aRow['STEP_UID_OBJ'],'STEP_POSITION' => $aRow['STEP_POSITION'] - 1
} ) );
} $oDataset->next();
catch (Exception $oException) { }
throw $Exception; } catch (Exception $oException) {
} throw $Exception;
} }
}
function removeByObject($sType, $sObjUid) { public function removeByObject ($sType, $sObjUid)
try { {
$oCriteria = new Criteria('workflow'); try {
$oCriteria->add(StepSupervisorPeer::STEP_TYPE_OBJ, $sType); $oCriteria = new Criteria( 'workflow' );
$oCriteria->add(StepSupervisorPeer::STEP_UID_OBJ, $sObjUid); $oCriteria->add( StepSupervisorPeer::STEP_TYPE_OBJ, $sType );
StepSupervisorPeer::doDelete($oCriteria); $oCriteria->add( StepSupervisorPeer::STEP_UID_OBJ, $sObjUid );
} StepSupervisorPeer::doDelete( $oCriteria );
catch(Exception $e) { } catch (Exception $e) {
throw($e); throw ($e);
} }
} }
function loadInfo($sObjUID){ public function loadInfo ($sObjUID)
{
$oCriteria = new Criteria('workflow');
$oCriteria->add(StepSupervisorPeer::STEP_UID_OBJ, $sObjUID); $oCriteria = new Criteria( 'workflow' );
$oDataset = StepSupervisorPeer::doSelectRS($oCriteria); $oCriteria->add( StepSupervisorPeer::STEP_UID_OBJ, $sObjUID );
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset = StepSupervisorPeer::doSelectRS( $oCriteria );
$oDataset->next(); $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$aRow = $oDataset->getRow(); $oDataset->next();
return($aRow); $aRow = $oDataset->getRow();
return ($aRow);
}
} }
// StepSupervisor
} // StepSupervisor

View File

@@ -1,12 +1,13 @@
<?php <?php
/**
* class.pmSugar.pmFunctions.php /**
* * class.pmSugar.pmFunctions.php
* ProcessMaker Open Source Edition *
* Copyright (C) 2004 - 2008 Colosa Inc. * ProcessMaker Open Source Edition
* * * Copyright (C) 2004 - 2008 Colosa Inc.
*/ * *
*/
//////////////////////////////////////////////////// ////////////////////////////////////////////////////
// pmSugar PM Functions // pmSugar PM Functions
// //
@@ -14,454 +15,482 @@
// //
// License: LGPL, see LICENSE // License: LGPL, see LICENSE
//////////////////////////////////////////////////// ////////////////////////////////////////////////////
function getSoapClientOptions() { function getSoapClientOptions ()
$options = array('trace' => 1); {
$options = array ('trace' => 1);
//Apply proxy settings
$sysConf = System::getSystemConfiguration(); //Apply proxy settings
if ($sysConf['proxy_host'] != '') { $sysConf = System::getSystemConfiguration();
$options['proxy_host'] = $sysConf['proxy_host']; if ($sysConf['proxy_host'] != '') {
if ($sysConf['proxy_port'] != '') { $options['proxy_host'] = $sysConf['proxy_host'];
$options['proxy_port'] = $sysConf['proxy_port']; if ($sysConf['proxy_port'] != '') {
} $options['proxy_port'] = $sysConf['proxy_port'];
if ($sysConf['proxy_user'] != '') { }
$options['proxy_login'] = $sysConf['proxy_user']; if ($sysConf['proxy_user'] != '') {
} $options['proxy_login'] = $sysConf['proxy_user'];
if ($sysConf['proxy_pass'] != '') { }
$options['proxy_password'] = $sysConf['proxy_pass']; if ($sysConf['proxy_pass'] != '') {
} $options['proxy_password'] = $sysConf['proxy_pass'];
} }
}
return $options;
} return $options;
}
/**
* This collection of triggers allows to interact by getting and sending information to SugarCRM /**
* @class pmSugar * This collection of triggers allows to interact by getting and sending information to SugarCRM
* @name Sugar CRM Triggers * @class pmSugar
* @icon /images/triggers/icon_SugarCRM.gif *
* @className class.pmSugar.pmFunctions.php * @name Sugar CRM Triggers
*/ * @icon /images/triggers/icon_SugarCRM.gif
* @className class.pmSugar.pmFunctions.php
function sugarLogin($sugarSoap, $user, $password) { */
$client = new SoapClient ( $sugarSoap, getSoapClientOptions() );
$auth_array = array ('user_auth' => array ('user_name' => $user, 'password' => md5 ( $password ), 'version' => '1.0' ) ); function sugarLogin ($sugarSoap, $user, $password)
$login_results = $client->__SoapCall ( 'login', $auth_array ); {
$client = new SoapClient( $sugarSoap, getSoapClientOptions() );
$session_id = $login_results->id; $auth_array = array ('user_auth' => array ('user_name' => $user,'password' => md5( $password ),'version' => '1.0') );
$user_guid = $client->__SoapCall ( 'get_user_id', array ($session_id ) ); $login_results = $client->__SoapCall( 'login', $auth_array );
return $session_id; $session_id = $login_results->id;
} $user_guid = $client->__SoapCall( 'get_user_id', array ($session_id) );
return $session_id;
function objectToArray($object) { }
if (! is_object ( $object ) && ! is_array ( $object )) {
return $object; function objectToArray ($object)
} {
if (is_object ( $object )) { if (! is_object( $object ) && ! is_array( $object )) {
$object = get_object_vars ( $object ); return $object;
} }
return array_map ( "objectToArray", $object ); if (is_object( $object )) {
} $object = get_object_vars( $object );
}
/** return array_map( "objectToArray", $object );
* @method }
*
* Gets SugarCRM entry using get_entry web service. /**
* *
* @name GetSugarEntry * @method Gets SugarCRM entry using get_entry web service.
* @label Get SugarCRM Entry *
* * @name GetSugarEntry
* @param string | $sugarSoap | Sugar SOAP URL | http://www.example.com/sugar/soap.php?wsdl [^] * @label Get SugarCRM Entry
* @param string | $user | User *
* @param string | $password | Password * @param string | $sugarSoap | Sugar SOAP URL | http://www.example.com/sugar/soap.php?wsdl [^]
* @param string | $module | The name of the module from which to retrieve records. * @param string | $user | User
* @param string | $id | The SugarBeans ID. * @param string | $password | Password
* @param string | $selectedFields | Optional. The list of fields to be returned in the results. * @param string | $module | The name of the module from which to retrieve records.
* @param string | $linkNameToFieldsArray | A list of link names and the fields to be returned for each link name. * @param string | $id | The SugarBeans ID.
* @param string | $resultType=array | Result type (array or object) * @param string | $selectedFields | Optional. The list of fields to be returned in the results.
* * @param string | $linkNameToFieldsArray | A list of link names and the fields to be returned for each link name.
* @return array/object | $sugarEntries | Sugar Entries (array or object) * @param string | $resultType=array | Result type (array or object)
* *
*/ * @return array/object | $sugarEntries | Sugar Entries (array or object)
*
function GetSugarEntry($sugarSoap, $user, $password, $module, $id, $selectFields, $linkNameToFieldsArray, $resultType = 'array') { */
$sessionId = sugarLogin ( $sugarSoap, $user, $password );
$client = new SoapClient ( $sugarSoap, getSoapClientOptions() ); function GetSugarEntry ($sugarSoap, $user, $password, $module, $id, $selectFields, $linkNameToFieldsArray, $resultType = 'array')
$request_array = array ('session' => $sessionId, 'module_name' => $module, 'id' => $id, {
'select_fields' => $select_fields, 'link_name_to_fields_array' => $linkNameToFieldsArray); $sessionId = sugarLogin( $sugarSoap, $user, $password );
$sugarEntry = $client->__SoapCall ( 'get_entry', $request_array ); $client = new SoapClient( $sugarSoap, getSoapClientOptions() );
$request_array = array ('session' => $sessionId,'module_name' => $module,'id' => $id,'select_fields' => $select_fields,'link_name_to_fields_array' => $linkNameToFieldsArray);
if($resultType == 'array'){ $sugarEntry = $client->__SoapCall( 'get_entry', $request_array );
$sugarEntry = objectToArray ( $sugarEntry );
} if ($resultType == 'array') {
$sugarEntry = objectToArray( $sugarEntry );
return $sugarEntry; }
}
return $sugarEntry;
/** }
* @method
* /**
* Gets SugarCRM entries from the indicated module. *
* * @method Gets SugarCRM entries from the indicated module.
* @name GetSugarEntries *
* @label Get SugarCRM Entries * @name GetSugarEntries
* * @label Get SugarCRM Entries
* @param string | $sugarSoap | Sugar SOAP URL | http://www.example.com/sugar/soap.php?wsdl *
* @param string | $user | User * @param string | $sugarSoap | Sugar SOAP URL | http://www.example.com/sugar/soap.php?wsdl
* @param string | $password | Password * @param string | $user | User
* @param string | $module | Module * @param string | $password | Password
* @param string | $query | Query * @param string | $module | Module
* @param string | $orderBy | Order By * @param string | $query | Query
* @param string | $selectedFields | Selected Fields * @param string | $orderBy | Order By
* @param string | $maxResults=50 | Max Results * @param string | $selectedFields | Selected Fields
* @param string | $resultType=array | Result type (array or object) * @param string | $maxResults=50 | Max Results
* * @param string | $resultType=array | Result type (array or object)
* @return array/object | $sugarEntries | Sugar Entries (array or object) *
* * @return array/object | $sugarEntries | Sugar Entries (array or object)
*/ *
*/
function GetSugarEntries($sugarSoap, $user, $password, $module, $query, $orderBy, $selectedFields, $maxResults, $resultType="array") {
$sessionId = sugarLogin ( $sugarSoap, $user, $password ); function GetSugarEntries ($sugarSoap, $user, $password, $module, $query, $orderBy, $selectedFields, $maxResults, $resultType = "array")
$client = new SoapClient ( $sugarSoap, getSoapClientOptions() ); {
$request_array = array ('session' => $sessionId, 'module_name' => $module, 'query' => $query, 'order_by' => $orderBy, 'offset'=>"", 'select_fields'=>"", 'max_result'=>$maxResults ); $sessionId = sugarLogin( $sugarSoap, $user, $password );
$sugarEntriesO = $client->__SoapCall ( 'get_entry_list', $request_array ); $client = new SoapClient( $sugarSoap, getSoapClientOptions() );
$request_array = array ('session' => $sessionId,'module_name' => $module,'query' => $query,'order_by' => $orderBy,'offset' => "",'select_fields' => "",'max_result' => $maxResults);
switch($resultType){ $sugarEntriesO = $client->__SoapCall( 'get_entry_list', $request_array );
case 'array':$sugarEntries = objectToArray ( $sugarEntriesO ); break;
case 'object':$sugarEntries = $sugarEntriesO; break; switch ($resultType) {
default: $sugarEntries = objectToArray ( $sugarEntries ); case 'array':
} $sugarEntries = objectToArray( $sugarEntriesO );
break;
return $sugarEntries; case 'object':
$sugarEntries = $sugarEntriesO;
} break;
/** default:
* @method $sugarEntries = objectToArray( $sugarEntries );
* }
* Gets SugarCRM entries from the Calls module
* return $sugarEntries;
* @name GetSugarCalls
* @label Gets SugarCRM entries from the Calls module }
*
* @param string | $sugarSoap | Sugar SOAP URL | http://www.example.com/sugar/soap.php?wsdl /**
* @param string | $user | User *
* @param string | $password | Password * @method Gets SugarCRM entries from the Calls module
* @param string | $query | Query *
* @param string | $orderBy | Order By * @name GetSugarCalls
* @param string | $selectedFields | Selected Fields * @label Gets SugarCRM entries from the Calls module
* @param string | $maxResults=50 | Max Results *
* @param string | $resultType=array | Result type (array or object) * @param string | $sugarSoap | Sugar SOAP URL | http://www.example.com/sugar/soap.php?wsdl
* * @param string | $user | User
* @return array/object | $sugarCalls | Sugar Calls (array or object) * @param string | $password | Password
* * @param string | $query | Query
*/ * @param string | $orderBy | Order By
* @param string | $selectedFields | Selected Fields
function GetSugarCalls($sugarSoap, $user, $password, $query, $orderBy, $selectedFields, $maxResults, $resultType="array") { * @param string | $maxResults=50 | Max Results
$module="Calls"; * @param string | $resultType=array | Result type (array or object)
return GetSugarEntries($sugarSoap, $user, $password, $module, $query, $orderBy, $selectedFields, $maxResults, $resultType); *
} * @return array/object | $sugarCalls | Sugar Calls (array or object)
/** *
* @method */
*
* Gets SugarCRM entries from the Leads module. function GetSugarCalls ($sugarSoap, $user, $password, $query, $orderBy, $selectedFields, $maxResults, $resultType = "array")
* {
* @name GetSugarLeads $module = "Calls";
* @label Gets SugarCRM entries from the Leads module. return GetSugarEntries( $sugarSoap, $user, $password, $module, $query, $orderBy, $selectedFields, $maxResults, $resultType );
* }
* @param string | $sugarSoap | Sugar SOAP URL | http://www.example.com/sugar/soap.php?wsdl
* @param string | $user | User /**
* @param string | $password | Password *
* @param string | $query | Query * @method Gets SugarCRM entries from the Leads module.
* @param string | $orderBy | Order By *
* @param string | $selectedFields | Selected Fields * @name GetSugarLeads
* @param string | $maxResults=50 | Max Results * @label Gets SugarCRM entries from the Leads module.
* @param string | $resultType=array | Result type (array or object) *
* * @param string | $sugarSoap | Sugar SOAP URL | http://www.example.com/sugar/soap.php?wsdl
* @return array/object | $sugarLeads | Sugar Leads (array or object) * @param string | $user | User
* * @param string | $password | Password
*/ * @param string | $query | Query
* @param string | $orderBy | Order By
function GetSugarLeads($sugarSoap, $user, $password, $query, $orderBy, $selectedFields, $maxResults, $resultType="array") { * @param string | $selectedFields | Selected Fields
$module="Leads"; * @param string | $maxResults=50 | Max Results
return GetSugarEntries($sugarSoap, $user, $password, $module, $query, $orderBy, $selectedFields, $maxResults, $resultType); * @param string | $resultType=array | Result type (array or object)
} *
/** * @return array/object | $sugarLeads | Sugar Leads (array or object)
* @method *
* */
* Gets SugarCRM entries from the Contacts module.
* function GetSugarLeads ($sugarSoap, $user, $password, $query, $orderBy, $selectedFields, $maxResults, $resultType = "array")
* @name GetSugarContacts {
* @label Gets SugarCRM entries from the Contacts module. $module = "Leads";
* return GetSugarEntries( $sugarSoap, $user, $password, $module, $query, $orderBy, $selectedFields, $maxResults, $resultType );
* @param string | $sugarSoap | Sugar SOAP URL | http://www.example.com/sugar/soap.php?wsdl }
* @param string | $user | User
* @param string | $password | Password /**
* @param string | $query | Query *
* @param string | $orderBy | Order By * @method Gets SugarCRM entries from the Contacts module.
* @param string | $selectedFields | Selected Fields *
* @param string | $maxResults=50 | Max Results * @name GetSugarContacts
* @param string | $resultType=array | Result type (array or object) * @label Gets SugarCRM entries from the Contacts module.
* *
* @return array/object | $sugarContacts | Sugar Contacts (array or object) * @param string | $sugarSoap | Sugar SOAP URL | http://www.example.com/sugar/soap.php?wsdl
* * @param string | $user | User
*/ * @param string | $password | Password
* @param string | $query | Query
function GetSugarContacts($sugarSoap, $user, $password, $query, $orderBy, $selectedFields, $maxResults, $resultType="array") { * @param string | $orderBy | Order By
$module="Contacts"; * @param string | $selectedFields | Selected Fields
return GetSugarEntries($sugarSoap, $user, $password, $module, $query, $orderBy, $selectedFields, $maxResults, $resultType); * @param string | $maxResults=50 | Max Results
} * @param string | $resultType=array | Result type (array or object)
/** *
* @method * @return array/object | $sugarContacts | Sugar Contacts (array or object)
* *
* Gets SugarCRM entries from the Opportunities module. */
*
* @name GetSugarOpportunities function GetSugarContacts ($sugarSoap, $user, $password, $query, $orderBy, $selectedFields, $maxResults, $resultType = "array")
* @label Gets SugarCRM entries from the Opportunities module. {
* $module = "Contacts";
* @param string | $sugarSoap | Sugar SOAP URL | http://www.example.com/sugar/soap.php?wsdl return GetSugarEntries( $sugarSoap, $user, $password, $module, $query, $orderBy, $selectedFields, $maxResults, $resultType );
* @param string | $user | User }
* @param string | $password | Password
* @param string | $query | Query /**
* @param string | $orderBy | Order By *
* @param string | $selectedFields | Selected Fields * @method Gets SugarCRM entries from the Opportunities module.
* @param string | $maxResults=50 | Max Results *
* @param string | $resultType=array | Result type (array or object) * @name GetSugarOpportunities
* * @label Gets SugarCRM entries from the Opportunities module.
* @return array/object | $sugarAccount | Sugar Opportunities (array or object) *
* * @param string | $sugarSoap | Sugar SOAP URL | http://www.example.com/sugar/soap.php?wsdl
*/ * @param string | $user | User
* @param string | $password | Password
function GetSugarOpportunities($sugarSoap, $user, $password, $query, $orderBy, $selectedFields, $maxResults, $resultType="array") { * @param string | $query | Query
$module="Opportunities"; * @param string | $orderBy | Order By
return GetSugarEntries($sugarSoap, $user, $password, $module, $query, $orderBy, $selectedFields, $maxResults, $resultType); * @param string | $selectedFields | Selected Fields
} * @param string | $maxResults=50 | Max Results
* @param string | $resultType=array | Result type (array or object)
/** *
* @method * @return array/object | $sugarAccount | Sugar Opportunities (array or object)
* *
* Gets SugarCRM entries from the Account module. */
*
* @name GetSugarAccount function GetSugarOpportunities ($sugarSoap, $user, $password, $query, $orderBy, $selectedFields, $maxResults, $resultType = "array")
* @label Gets SugarCRM entries from the Account module. {
* $module = "Opportunities";
* @param string | $sugarSoap | Sugar SOAP URL | http://www.example.com/sugar/soap.php?wsdl return GetSugarEntries( $sugarSoap, $user, $password, $module, $query, $orderBy, $selectedFields, $maxResults, $resultType );
* @param string | $user | User }
* @param string | $password | Password
* @param string | $query | Query /**
* @param string | $orderBy | Order By *
* @param string | $selectedFields | Selected Fields * @method Gets SugarCRM entries from the Account module.
* @param string | $maxResults=50 | Max Results *
* @param string | $resultType=array | Result type (array or object) * @name GetSugarAccount
* * @label Gets SugarCRM entries from the Account module.
* @return array/object | $sugarAccount | Sugar Opportunities (array or object) *
* * @param string | $sugarSoap | Sugar SOAP URL | http://www.example.com/sugar/soap.php?wsdl
*/ * @param string | $user | User
* @param string | $password | Password
function GetSugarAccount($sugarSoap, $user, $password, $query, $orderBy, $selectedFields, $maxResults, $resultType="array") { * @param string | $query | Query
$module="Accounts"; * @param string | $orderBy | Order By
return GetSugarEntries($sugarSoap, $user, $password, $module, $query, $orderBy, $selectedFields, $maxResults, $resultType); * @param string | $selectedFields | Selected Fields
} * @param string | $maxResults=50 | Max Results
* @param string | $resultType=array | Result type (array or object)
*
/** * @return array/object | $sugarAccount | Sugar Opportunities (array or object)
* @method *
* */
* Creates SugarCRM entries from the Account module.
* function GetSugarAccount ($sugarSoap, $user, $password, $query, $orderBy, $selectedFields, $maxResults, $resultType = "array")
* @name CreateSugarAccount {
* $module = "Accounts";
* @label Creates SugarCRM entries from the Account module. return GetSugarEntries( $sugarSoap, $user, $password, $module, $query, $orderBy, $selectedFields, $maxResults, $resultType );
* }
* @param string | $sugarSoap | Sugar SOAP URL | http://www.example.com/sugar/soap.php?wsdl
* @param string | $user | User /**
* @param string | $password | Password *
* @param string | $name | Account name * @method Creates SugarCRM entries from the Account module.
* @param string | $resultType=array | Result type (array or object) *
* * @name CreateSugarAccount
* @return array/object | $sugarAccount | Sugar Opportunities (array or object) *
* * @label Creates SugarCRM entries from the Account module.
*/ *
function CreateSugarAccount($sugarSoap, $user, $password, $name, $resultType="array") { * @param string | $sugarSoap | Sugar SOAP URL | http://www.example.com/sugar/soap.php?wsdl
* @param string | $user | User
$module = "Accounts"; * @param string | $password | Password
$sessionId = sugarLogin ( $sugarSoap, $user, $password ); * @param string | $name | Account name
$client = new SoapClient ( $sugarSoap, getSoapClientOptions() ); * @param string | $resultType=array | Result type (array or object)
$request_array = array ('session' => $sessionId, 'module_name' => $module, 'name_value_list' => array( *
array("name" => 'name', "value" => $name ) * @return array/object | $sugarAccount | Sugar Opportunities (array or object)
) ); *
$sugarEntriesO = $client->__SoapCall ( 'set_entry', $request_array ); */
$account_id = $sugarEntriesO ->id; function CreateSugarAccount ($sugarSoap, $user, $password, $name, $resultType = "array")
{
switch($resultType){
case 'array':$sugarEntries = objectToArray ( $sugarEntriesO );break; $module = "Accounts";
case 'object':$sugarEntries = $sugarEntries ;break; $sessionId = sugarLogin( $sugarSoap, $user, $password );
default: $sugarEntries = objectToArray ( $sugarEntries ); $client = new SoapClient( $sugarSoap, getSoapClientOptions() );
} $request_array = array ('session' => $sessionId,'module_name' => $module,'name_value_list' => array (array ("name" => 'name',"value" => $name)));
//return $sugarEntries; $sugarEntriesO = $client->__SoapCall( 'set_entry', $request_array );
return $account_id; $account_id = $sugarEntriesO->id;
}
switch ($resultType) {
/** case 'array':
* @method $sugarEntries = objectToArray( $sugarEntriesO );
* break;
* Creates SugarCRM entries from the Account module case 'object':
* $sugarEntries = $sugarEntries;
* @name CreateSugarContact break;
* default:
* @label Creates SugarCRM entries from the Account module $sugarEntries = objectToArray( $sugarEntries );
* }
* @param string | $sugarSoap | Sugar SOAP URL | http://www.example.com/sugar/soap.php?wsdl //return $sugarEntries;
* @param string | $user | User return $account_id;
* @param string | $password | Password }
* @param string | $first_name | First Name
* @param string | $last_name | Last Name /**
* @param string | $email | Email *
* @param string | $title | Title * @method Creates SugarCRM entries from the Account module
* @param string | $phone | Phone Work *
* @param string | $account_id | Valid id account * @name CreateSugarContact
* @param string | $resultType=array | Result type (array or object) *
* * @label Creates SugarCRM entries from the Account module
* @return array/object | $sugarContact | Sugar Opportunities (array or object) *
* * @param string | $sugarSoap | Sugar SOAP URL | http://www.example.com/sugar/soap.php?wsdl
*/ * @param string | $user | User
function CreateSugarContact($sugarSoap, $user, $password, $first_name, $last_name, $email, $title, $phone, $account_id, $resultType="array") { * @param string | $password | Password
* @param string | $first_name | First Name
$module = "Contacts"; * @param string | $last_name | Last Name
/* $aValue = array( * @param string | $email | Email
* @param string | $title | Title
* @param string | $phone | Phone Work
* @param string | $account_id | Valid id account
* @param string | $resultType=array | Result type (array or object)
*
* @return array/object | $sugarContact | Sugar Opportunities (array or object)
*
*/
function CreateSugarContact ($sugarSoap, $user, $password, $first_name, $last_name, $email, $title, $phone, $account_id, $resultType = "array")
{
$module = "Contacts";
/* $aValue = array(
array("name" => 'id', "value" => G::generateUniqueID()), array("name" => 'id', "value" => G::generateUniqueID()),
array("name" => 'first_name', "value" => $first_name), array("name" => 'first_name', "value" => $first_name),
array("name" => 'last_name', "value" => $last_name), array("name" => 'last_name', "value" => $last_name),
); );
*/ */
$sessionId = sugarLogin ( $sugarSoap, $user, $password ); $sessionId = sugarLogin( $sugarSoap, $user, $password );
$client = new SoapClient ( $sugarSoap, getSoapClientOptions() ); $client = new SoapClient( $sugarSoap, getSoapClientOptions() );
$request_array = array ('session' => $sessionId, 'module_name' => $module, array( $request_array = array ('session' => $sessionId,'module_name' => $module,array (array ("name" => 'first_name',"value" => $first_name
array("name" => 'first_name',"value" => $first_name), ),array ("name" => 'last_name',"value" => $last_name
array("name" => 'last_name',"value" => $last_name), ),array ("name" => 'email1',"value" => $email
array("name" => 'email1',"value" => $email), ),array ("name" => 'title',"value" => $title
array("name" => 'title',"value" => $title), ),array ("name" => 'phone_work',"value" => $phone
array("name" => 'phone_work',"value" => $phone), ),
// array("name" => 'account_id',"value" => '8cd10a60-101f-4363-1e0b-4cfd4106bd7e') // array("name" => 'account_id',"value" => '8cd10a60-101f-4363-1e0b-4cfd4106bd7e')
array("name" => 'account_id',"value" => $account_id) array ("name" => 'account_id',"value" => $account_id
)); )));
$sugarEntriesO = $client->__SoapCall ( 'set_entry', $request_array ); $sugarEntriesO = $client->__SoapCall( 'set_entry', $request_array );
switch($resultType){ switch ($resultType) {
case 'array':$sugarEntries = objectToArray ( $sugarEntriesO ); break; case 'array':
case 'object':$sugarEntries = $sugarEntries; break; $sugarEntries = objectToArray( $sugarEntriesO );
default: $sugarEntries = objectToArray ( $sugarEntries ); break;
} case 'object':
return $sugarEntries; $sugarEntries = $sugarEntries;
} break;
default:
$sugarEntries = objectToArray( $sugarEntries );
/** }
* @method return $sugarEntries;
* }
* Creates SugarCRM entries from the Opportunities module.
* /**
* @name CreateSugarOpportunity *
* @method Creates SugarCRM entries from the Opportunities module.
* @label Creates SugarCRM entries from the Opportunities module. *
* * @name CreateSugarOpportunity
* @param string | $sugarSoap | Sugar SOAP URL | http://www.example.com/sugar/soap.php?wsdl *
* @param string | $user | User * @label Creates SugarCRM entries from the Opportunities module.
* @param string | $password | Password *
* @param string | $name | Name * @param string | $sugarSoap | Sugar SOAP URL | http://www.example.com/sugar/soap.php?wsdl
* @param string | $account_id | Valid id account * @param string | $user | User
* @param string | $amount | Amount * @param string | $password | Password
* @param string | $date_closed | Date Closed * @param string | $name | Name
* @param string | $sales_stage | Prospecting, Qualification, Needs Analysis, Value Proposition, Id. Decision Makers, Perception Analysis, Proposal/Price Quote, Negotiation/Review, Closed Won, Closed Lost * @param string | $account_id | Valid id account
* @param string | $resultType=array | Result type (array or object) * @param string | $amount | Amount
* * @param string | $date_closed | Date Closed
* @return array/object | $sugarOpportunity | Sugar Opportunities (array or object) * @param string | $sales_stage | Prospecting, Qualification, Needs Analysis, Value Proposition, Id. Decision Makers, Perception Analysis, Proposal/Price Quote, Negotiation/Review, Closed Won, Closed Lost
* * @param string | $resultType=array | Result type (array or object)
*/ *
function CreateSugarOpportunity($sugarSoap, $user, $password, $name,$account_id,$amount, $date_closed, $sales_stage,$resultType="array") { * @return array/object | $sugarOpportunity | Sugar Opportunities (array or object)
// * @param string | $account_id | Account Id *
$module = "Opportunities"; */
function CreateSugarOpportunity ($sugarSoap, $user, $password, $name, $account_id, $amount, $date_closed, $sales_stage, $resultType = "array")
/* $aValue = array( {
// * @param string | $account_id | Account Id
$module = "Opportunities";
/* $aValue = array(
array("name" => 'id', "value" => G::generateUniqueID()), array("name" => 'id', "value" => G::generateUniqueID()),
array("name" => 'name', "value" => $name), array("name" => 'name', "value" => $name),
array("name" => 'account_name', "value" => $account_name), array("name" => 'account_name', "value" => $account_name),
array("name" => 'amount', "value" => $amount), array("name" => 'amount', "value" => $amount),
array("name" => 'date_closed', "value" => $date_closed), array("name" => 'date_closed', "value" => $date_closed),
array("name" => 'sales_stage', "value" => $sales_stage) array("name" => 'sales_stage', "value" => $sales_stage)
);*/ );*/
$sessionId = sugarLogin ( $sugarSoap, $user, $password ); $sessionId = sugarLogin( $sugarSoap, $user, $password );
$client = new SoapClient ( $sugarSoap, getSoapClientOptions() ); $client = new SoapClient( $sugarSoap, getSoapClientOptions() );
$request_array = array ('session' => $sessionId, 'module_name' => $module, 'name_value_list' =>array( $request_array = array ('session' => $sessionId,'module_name' => $module,'name_value_list' => array (array ('name' => 'name','value' => $name
array('name' => 'name','value' => $name), ),array ("name" => 'account_id',"value" => $account_id
array("name" => 'account_id',"value" => $account_id), ),array ('name' => 'amount','value' => $amount
array('name' => 'amount','value' => $amount), ),array ('name' => 'date_closed','value' => $date_closed
array('name' => 'date_closed','value' => $date_closed), ),array ('name' => 'sales_stage','value' => $sales_stage
array('name' => 'sales_stage','value' => $sales_stage), )
)); )
);
$sugarEntriesO = $client->__SoapCall ( 'set_entry', $request_array );
$sugarEntriesO = $client->__SoapCall( 'set_entry', $request_array );
switch($resultType){
case 'array':$sugarEntries = objectToArray ( $sugarEntriesO ); break; switch ($resultType) {
case 'object':$sugarEntries = $sugarEntries; break; case 'array':
default: $sugarEntries = objectToArray ( $sugarEntries ); $sugarEntries = objectToArray( $sugarEntriesO );
} break;
return $sugarEntries; case 'object':
} $sugarEntries = $sugarEntries;
break;
default:
$sugarEntries = objectToArray( $sugarEntries );
/** }
* @method return $sugarEntries;
* }
* Creates SugarCRM entries from the Account module
* /**
* @name CreateSugarLeads *
* * @method Creates SugarCRM entries from the Account module
* @label Creates SugarCRM entries from the Account module *
* * @name CreateSugarLeads
* @param string | $sugarSoap | Sugar SOAP URL | http://www.example.com/sugar/soap.php?wsdl *
* @param string | $user | User * @label Creates SugarCRM entries from the Account module
* @param string | $password | Password *
* @param string | $first_name | First Name * @param string | $sugarSoap | Sugar SOAP URL | http://www.example.com/sugar/soap.php?wsdl
* @param string | $last_name | Last Name * @param string | $user | User
* @param string | $email | Email * @param string | $password | Password
* @param string | $title | Title * @param string | $first_name | First Name
* @param string | $phone | Phone Work * @param string | $last_name | Last Name
* @param string | $account_id | Valid id account * @param string | $email | Email
* @param string | $resultType=array | Result type (array or object) * @param string | $title | Title
* * @param string | $phone | Phone Work
* @return array/object | $sugarContact | Sugar Opportunities (array or object) * @param string | $account_id | Valid id account
* * @param string | $resultType=array | Result type (array or object)
*/ *
function CreateSugarLeads($sugarSoap, $user, $password, $first_name, $last_name, $email, $title, $phone, $account_id, $resultType="array") { * @return array/object | $sugarContact | Sugar Opportunities (array or object)
*
$module = "Leads"; */
$sessionId = sugarLogin ( $sugarSoap, $user, $password ); function CreateSugarLeads ($sugarSoap, $user, $password, $first_name, $last_name, $email, $title, $phone, $account_id, $resultType = "array")
$client = new SoapClient ( $sugarSoap, getSoapClientOptions() ); {
$request_array = array ('session' => $sessionId, 'module_name' => $module, array( $module = "Leads";
array("name" => 'first_name',"value" => $first_name), $sessionId = sugarLogin( $sugarSoap, $user, $password );
array("name" => 'last_name',"value" => $last_name), $client = new SoapClient( $sugarSoap, getSoapClientOptions() );
array("name" => 'email1',"value" => $email),
array("name" => 'title',"value" => $title), $request_array = array ('session' => $sessionId,'module_name' => $module,array (array ("name" => 'first_name',"value" => $first_name
array("name" => 'phone_work',"value" => $phone), ),array ("name" => 'last_name',"value" => $last_name
// array("name" => 'account_id',"value" => '8cd10a60-101f-4363-1e0b-4cfd4106bd7e') ),array ("name" => 'email1',"value" => $email
array("name" => 'account_id',"value" => $account_id) ),array ("name" => 'title',"value" => $title
)); ),array ("name" => 'phone_work',"value" => $phone
),
$sugarEntriesO = $client->__SoapCall ( 'set_entry', $request_array ); // array("name" => 'account_id',"value" => '8cd10a60-101f-4363-1e0b-4cfd4106bd7e')
array ("name" => 'account_id',"value" => $account_id
switch($resultType){ )
case 'array':$sugarEntries = objectToArray ( $sugarEntriesO ); break; )
case 'object':$sugarEntries = $sugarEntries; break; );
default: $sugarEntries = objectToArray ( $sugarEntries );
} $sugarEntriesO = $client->__SoapCall( 'set_entry', $request_array );
return $sugarEntries;
} switch ($resultType) {
case 'array':
$sugarEntries = objectToArray( $sugarEntriesO );
break;
case 'object':
$sugarEntries = $sugarEntries;
break;
default:
$sugarEntries = objectToArray( $sugarEntries );
}
return $sugarEntries;
}