CODE STYLE Format
Change format
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* ReportTable.php
|
* ReportTable.php
|
||||||
|
*
|
||||||
* @package workflow.engine.classes.model
|
* @package workflow.engine.classes.model
|
||||||
*
|
*
|
||||||
* ProcessMaker Open Source Edition
|
* ProcessMaker Open Source Edition
|
||||||
@@ -27,7 +28,6 @@
|
|||||||
require_once 'classes/model/Content.php';
|
require_once 'classes/model/Content.php';
|
||||||
require_once 'classes/model/om/BaseReportTable.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.
|
||||||
*
|
*
|
||||||
@@ -39,18 +39,22 @@ require_once 'classes/model/om/BaseReportTable.php';
|
|||||||
*
|
*
|
||||||
* @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
|
* This value goes in the content table
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $rep_tab_title = '';
|
protected $rep_tab_title = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the rep_tab_title column value.
|
* Get the rep_tab_title column value.
|
||||||
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getRepTabTitle() {
|
public function getRepTabTitle ()
|
||||||
|
{
|
||||||
if ($this->getRepTabUid() == "") {
|
if ($this->getRepTabUid() == "") {
|
||||||
throw (new Exception( "Error in getRepTabTitle, the getRepTabUid() can't be blank" ));
|
throw (new Exception( "Error in getRepTabTitle, the getRepTabUid() can't be blank" ));
|
||||||
}
|
}
|
||||||
@@ -84,78 +88,74 @@ class ReportTable extends BaseReportTable {
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$oRow = ReportTablePeer::retrieveByPK( $RepTabUid );
|
$oRow = ReportTablePeer::retrieveByPK( $RepTabUid );
|
||||||
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 );
|
||||||
$this->setRepTabTitle( $aFields['REP_TAB_TITLE'] = $this->getRepTabTitle() );
|
$this->setRepTabTitle( $aFields['REP_TAB_TITLE'] = $this->getRepTabTitle() );
|
||||||
return $aFields;
|
return $aFields;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
//throw( new Exception( "The row '$RepTabUid' in table ReportTable doesn't exist!" ));
|
//throw( new Exception( "The row '$RepTabUid' in table ReportTable doesn't exist!" ));
|
||||||
return array ();
|
return array ();
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create ($aData)
|
public function create ($aData)
|
||||||
{
|
{
|
||||||
$con = Propel::getConnection( ReportTablePeer::DATABASE_NAME );
|
$con = Propel::getConnection( ReportTablePeer::DATABASE_NAME );
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
$con->begin();
|
$con->begin();
|
||||||
if ( isset ( $aData['REP_TAB_UID'] ) && $aData['REP_TAB_UID']== '' )
|
if (isset( $aData['REP_TAB_UID'] ) && $aData['REP_TAB_UID'] == '') {
|
||||||
unset( $aData['REP_TAB_UID'] );
|
unset( $aData['REP_TAB_UID'] );
|
||||||
if ( !isset ( $aData['REP_TAB_UID'] ) )
|
}
|
||||||
|
if (! isset( $aData['REP_TAB_UID'] )) {
|
||||||
$this->setRepTabUid( G::generateUniqueID() );
|
$this->setRepTabUid( G::generateUniqueID() );
|
||||||
else
|
} else {
|
||||||
$this->setRepTabUid( $aData['REP_TAB_UID'] );
|
$this->setRepTabUid( $aData['REP_TAB_UID'] );
|
||||||
|
}
|
||||||
|
|
||||||
$this->setProUid( $aData['PRO_UID'] );
|
$this->setProUid( $aData['PRO_UID'] );
|
||||||
$this->setRepTabName( $aData['REP_TAB_NAME'] );
|
$this->setRepTabName( $aData['REP_TAB_NAME'] );
|
||||||
$this->setRepTabType( $aData['REP_TAB_TYPE'] );
|
$this->setRepTabType( $aData['REP_TAB_TYPE'] );
|
||||||
if ( !isset ( $aData['REP_TAB_GRID'] ) )
|
if (! isset( $aData['REP_TAB_GRID'] )) {
|
||||||
$this->setRepTabGrid( "" );
|
$this->setRepTabGrid( "" );
|
||||||
else
|
} else {
|
||||||
$this->setRepTabGrid( $aData['REP_TAB_GRID'] );
|
$this->setRepTabGrid( $aData['REP_TAB_GRID'] );
|
||||||
if ( !isset ( $aData['REP_TAB_CONNECTION'] ) )
|
}
|
||||||
|
if (! isset( $aData['REP_TAB_CONNECTION'] )) {
|
||||||
$this->setRepTabConnection( "report" );
|
$this->setRepTabConnection( "report" );
|
||||||
else
|
} else {
|
||||||
$this->setRepTabConnection( $aData['REP_TAB_CONNECTION'] );
|
$this->setRepTabConnection( $aData['REP_TAB_CONNECTION'] );
|
||||||
|
}
|
||||||
$this->setRepTabCreateDate( date( 'Y-m-d H:i:s' ) );
|
$this->setRepTabCreateDate( date( 'Y-m-d H:i:s' ) );
|
||||||
$this->setRepTabStatus( 'ACTIVE' );
|
$this->setRepTabStatus( 'ACTIVE' );
|
||||||
|
|
||||||
if($this->validate())
|
if ($this->validate()) {
|
||||||
{
|
if (! isset( $aData['REP_TAB_TITLE'] )) {
|
||||||
if ( !isset ( $aData['REP_TAB_TITLE'] ) )
|
|
||||||
$this->setRepTabTitle( "" );
|
$this->setRepTabTitle( "" );
|
||||||
else
|
} else {
|
||||||
$this->setRepTabTitle( $aData['REP_TAB_TITLE'] );
|
$this->setRepTabTitle( $aData['REP_TAB_TITLE'] );
|
||||||
|
}
|
||||||
$result = $this->save();
|
$result = $this->save();
|
||||||
$con->commit();
|
$con->commit();
|
||||||
return $result;
|
return $result;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$con->rollback();
|
$con->rollback();
|
||||||
throw (new Exception( "Failed Validation in class " . get_class( $this ) . "." ));
|
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 );
|
$con = Propel::getConnection( ReportTablePeer::DATABASE_NAME );
|
||||||
try
|
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 );
|
||||||
@@ -169,34 +169,31 @@ class ReportTable extends BaseReportTable {
|
|||||||
$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)) $contentResult+=$this->setRepTabTitle($fields["REP_TAB_TITLE"]);
|
if (array_key_exists( "REP_TAB_TITLE", $fields )) {
|
||||||
|
$contentResult += $this->setRepTabTitle( $fields["REP_TAB_TITLE"] );
|
||||||
|
}
|
||||||
$result = $this->save();
|
$result = $this->save();
|
||||||
$result = ($result == 0) ? ($contentResult > 0 ? 1 : 0) : $result;
|
$result = ($result == 0) ? ($contentResult > 0 ? 1 : 0) : $result;
|
||||||
$con->commit();
|
$con->commit();
|
||||||
return $result;
|
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) {
|
||||||
catch(Exception $e)
|
|
||||||
{
|
|
||||||
$con->rollback();
|
$con->rollback();
|
||||||
throw ($e);
|
throw ($e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function remove ($RepTabUid)
|
public function remove ($RepTabUid)
|
||||||
{
|
{
|
||||||
$con = Propel::getConnection( ReportTablePeer::DATABASE_NAME );
|
$con = Propel::getConnection( ReportTablePeer::DATABASE_NAME );
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
$con->begin();
|
$con->begin();
|
||||||
$oRepTab = ReportTablePeer::retrieveByPK( $RepTabUid );
|
$oRepTab = ReportTablePeer::retrieveByPK( $RepTabUid );
|
||||||
if (! is_null( $oRepTab )) {
|
if (! is_null( $oRepTab )) {
|
||||||
@@ -205,27 +202,26 @@ class ReportTable extends BaseReportTable {
|
|||||||
$con->commit();
|
$con->commit();
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
} catch (Exception $e) {
|
||||||
catch(Exception $e)
|
|
||||||
{
|
|
||||||
$con->rollback();
|
$con->rollback();
|
||||||
throw ($e);
|
throw ($e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function reportTableExists ( $RepTabUid ) {
|
public function reportTableExists ($RepTabUid)
|
||||||
|
{
|
||||||
$con = Propel::getConnection( ReportTablePeer::DATABASE_NAME );
|
$con = Propel::getConnection( ReportTablePeer::DATABASE_NAME );
|
||||||
try {
|
try {
|
||||||
$oRepTabUid = ReportTablePeer::retrieveByPk( $RepTabUid );
|
$oRepTabUid = ReportTablePeer::retrieveByPk( $RepTabUid );
|
||||||
if (is_object( $oRepTabUid ) && get_class( $oRepTabUid ) == 'ReportTable') {
|
if (is_object( $oRepTabUid ) && get_class( $oRepTabUid ) == 'ReportTable') {
|
||||||
return true;
|
return true;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // ReportTable
|
}
|
||||||
|
// ReportTable
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Route.php
|
* Route.php
|
||||||
|
*
|
||||||
* @package workflow.engine.classes.model
|
* @package workflow.engine.classes.model
|
||||||
*
|
*
|
||||||
* ProcessMaker Open Source Edition
|
* ProcessMaker Open Source Edition
|
||||||
@@ -38,7 +39,8 @@ require_once 'classes/model/Content.php';
|
|||||||
*
|
*
|
||||||
* @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
|
||||||
@@ -49,26 +51,25 @@ class Route extends BaseRoute {
|
|||||||
{
|
{
|
||||||
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 {
|
||||||
else {
|
|
||||||
throw (new Exception( 'This row doesn\'t exist!' ));
|
throw (new Exception( 'This row doesn\'t exist!' ));
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the application document registry
|
* Create the application document registry
|
||||||
|
*
|
||||||
* @param array $aData
|
* @param array $aData
|
||||||
* @return string
|
* @return string
|
||||||
**/
|
*
|
||||||
|
*/
|
||||||
public function create ($aData)
|
public function create ($aData)
|
||||||
{
|
{
|
||||||
$oConnection = Propel::getConnection( RoutePeer::DATABASE_NAME );
|
$oConnection = Propel::getConnection( RoutePeer::DATABASE_NAME );
|
||||||
@@ -78,9 +79,12 @@ class Route extends BaseRoute {
|
|||||||
$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'), 'FALSE');
|
$aData['ROU_TO_LAST_USER'] = $this->validateValue( isset( $aData['ROU_TO_LAST_USER'] ) ? $aData['ROU_TO_LAST_USER'] : '', array ('TRUE','FALSE'
|
||||||
$aData['ROU_OPTIONAL'] = $this->validateValue(isset($aData['ROU_OPTIONAL']) ? $aData['ROU_OPTIONAL'] : '', array('TRUE', 'FALSE'), 'FALSE');
|
), 'FALSE' );
|
||||||
$aData['ROU_SEND_EMAIL'] = $this->validateValue(isset($aData['ROU_SEND_EMAIL']) ? $aData['ROU_SEND_EMAIL']: '', array('TRUE', 'FALSE'), 'TRUE');
|
$aData['ROU_OPTIONAL'] = $this->validateValue( isset( $aData['ROU_OPTIONAL'] ) ? $aData['ROU_OPTIONAL'] : '', array ('TRUE','FALSE'
|
||||||
|
), 'FALSE' );
|
||||||
|
$aData['ROU_SEND_EMAIL'] = $this->validateValue( isset( $aData['ROU_SEND_EMAIL'] ) ? $aData['ROU_SEND_EMAIL'] : '', array ('TRUE','FALSE'
|
||||||
|
), 'TRUE' );
|
||||||
|
|
||||||
$oRoute->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
|
$oRoute->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
|
||||||
|
|
||||||
@@ -89,8 +93,7 @@ class Route extends BaseRoute {
|
|||||||
$iResult = $oRoute->save();
|
$iResult = $oRoute->save();
|
||||||
$oConnection->commit();
|
$oConnection->commit();
|
||||||
return $sRouteUID;
|
return $sRouteUID;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$sMessage = '';
|
$sMessage = '';
|
||||||
$aValidationFailures = $oRoute->getValidationFailures();
|
$aValidationFailures = $oRoute->getValidationFailures();
|
||||||
foreach ($aValidationFailures as $oValidationFailure) {
|
foreach ($aValidationFailures as $oValidationFailure) {
|
||||||
@@ -98,34 +101,36 @@ class Route extends BaseRoute {
|
|||||||
}
|
}
|
||||||
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 );
|
$oConnection = Propel::getConnection( RoutePeer::DATABASE_NAME );
|
||||||
try {
|
try {
|
||||||
$oRoute = RoutePeer::retrieveByPK( $aData['ROU_UID'] );
|
$oRoute = RoutePeer::retrieveByPK( $aData['ROU_UID'] );
|
||||||
if (!is_null($oRoute))
|
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'] )) {
|
if (isset( $aData['ROU_OPTIONAL'] )) {
|
||||||
$aData['ROU_OPTIONAL'] = $this->validateValue($aData['ROU_OPTIONAL'], array('TRUE', 'FALSE'), 'FALSE');
|
$aData['ROU_OPTIONAL'] = $this->validateValue( $aData['ROU_OPTIONAL'], array ('TRUE','FALSE'
|
||||||
|
), 'FALSE' );
|
||||||
}
|
}
|
||||||
if (isset( $aData['ROU_SEND_EMAIL'] )) {
|
if (isset( $aData['ROU_SEND_EMAIL'] )) {
|
||||||
$aData['ROU_SEND_EMAIL'] = $this->validateValue($aData['ROU_SEND_EMAIL'], array('TRUE', 'FALSE'), 'TRUE');
|
$aData['ROU_SEND_EMAIL'] = $this->validateValue( $aData['ROU_SEND_EMAIL'], array ('TRUE','FALSE'
|
||||||
|
), 'TRUE' );
|
||||||
}
|
}
|
||||||
|
|
||||||
$oRoute->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
|
$oRoute->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
|
||||||
@@ -134,8 +139,7 @@ class Route extends BaseRoute {
|
|||||||
$iResult = $oRoute->save();
|
$iResult = $oRoute->save();
|
||||||
$oConnection->commit();
|
$oConnection->commit();
|
||||||
return $iResult;
|
return $iResult;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$sMessage = '';
|
$sMessage = '';
|
||||||
$aValidationFailures = $oRoute->getValidationFailures();
|
$aValidationFailures = $oRoute->getValidationFailures();
|
||||||
foreach ($aValidationFailures as $oValidationFailure) {
|
foreach ($aValidationFailures as $oValidationFailure) {
|
||||||
@@ -143,12 +147,10 @@ class Route extends BaseRoute {
|
|||||||
}
|
}
|
||||||
throw (new Exception( 'The ROUTE tables cannot be updated!<br />' . $sMessage ));
|
throw (new Exception( 'The ROUTE tables cannot be updated!<br />' . $sMessage ));
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
throw (new Exception( "The row " . $aData['ROU_UID'] . " doesn't exist!" ));
|
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);
|
||||||
}
|
}
|
||||||
@@ -156,43 +158,41 @@ class Route extends BaseRoute {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the application document registry
|
* Remove the application document registry
|
||||||
|
*
|
||||||
* @param array $aData
|
* @param array $aData
|
||||||
* @return string
|
* @return string
|
||||||
**/
|
*
|
||||||
|
*/
|
||||||
public function remove ($sRouUid)
|
public function remove ($sRouUid)
|
||||||
{
|
{
|
||||||
$oConnection = Propel::getConnection( RoutePeer::DATABASE_NAME );
|
$oConnection = Propel::getConnection( RoutePeer::DATABASE_NAME );
|
||||||
try {
|
try {
|
||||||
$oRoute = RoutePeer::retrieveByPK( $sRouUid );
|
$oRoute = RoutePeer::retrieveByPK( $sRouUid );
|
||||||
if (!is_null($oRoute))
|
if (! is_null( $oRoute )) {
|
||||||
{
|
|
||||||
$oConnection->begin();
|
$oConnection->begin();
|
||||||
$iResult = $oRoute->delete();
|
$iResult = $oRoute->delete();
|
||||||
$oConnection->commit();
|
$oConnection->commit();
|
||||||
return $iResult;
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function routeExists ( $sRouUid ) {
|
public 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) {
|
||||||
catch (Exception $oError) {
|
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -205,12 +205,13 @@ class Route extends BaseRoute {
|
|||||||
* @param $default string default value, if the tested value is not valid the default value is returned
|
* @param $default string default value, if the tested value is not valid the default value is returned
|
||||||
* @return the tested and accepted value
|
* @return the tested and accepted value
|
||||||
*/
|
*/
|
||||||
function validateValue($value, $validValues, $default)
|
public function validateValue ($value, $validValues, $default)
|
||||||
{
|
{
|
||||||
if (! in_array( $value, $validValues )) {
|
if (! in_array( $value, $validValues )) {
|
||||||
$value = $default;
|
$value = $default;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
} // Route
|
}
|
||||||
|
// Route
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
<?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/Content.php';
|
||||||
require_once 'classes/model/om/BaseStage.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.
|
||||||
*
|
*
|
||||||
@@ -19,19 +19,22 @@ require_once 'classes/model/om/BaseStage.php';
|
|||||||
*
|
*
|
||||||
* @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.
|
* Get the stg_title column value.
|
||||||
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getStgTitle() {
|
public function getStgTitle ()
|
||||||
|
{
|
||||||
if ($this->getStgUid() == "") {
|
if ($this->getStgUid() == "") {
|
||||||
throw (new Exception( "Error in getStgTitle, the getStgUid() can't be blank" ));
|
throw (new Exception( "Error in getStgTitle, the getStgUid() can't be blank" ));
|
||||||
}
|
}
|
||||||
@@ -65,30 +68,30 @@ class Stage extends BaseStage {
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$oRow = StagePeer::retrieveByPK( $StgUid );
|
$oRow = StagePeer::retrieveByPK( $StgUid );
|
||||||
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 );
|
||||||
$this->setStgTitle( $aFields['STG_TITLE'] = $this->getStgTitle() );
|
$this->setStgTitle( $aFields['STG_TITLE'] = $this->getStgTitle() );
|
||||||
return $aFields;
|
return $aFields;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
throw (new Exception( "The row '$StgUid' in table Stage doesn't exist!" ));
|
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 );
|
$oConnection = Propel::getConnection( StagePeer::DATABASE_NAME );
|
||||||
try {
|
try {
|
||||||
if ( isset ( $aData['STG_UID'] ) && $aData['STG_UID']== '' )
|
if (isset( $aData['STG_UID'] ) && $aData['STG_UID'] == '') {
|
||||||
unset( $aData['STG_UID'] );
|
unset( $aData['STG_UID'] );
|
||||||
if ( !isset ( $aData['STG_UID'] ) )
|
}
|
||||||
|
if (! isset( $aData['STG_UID'] )) {
|
||||||
$aData['STG_UID'] = G::generateUniqueID();
|
$aData['STG_UID'] = G::generateUniqueID();
|
||||||
|
}
|
||||||
$oStage = new Stage();
|
$oStage = new Stage();
|
||||||
$oStage->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
|
$oStage->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
|
||||||
$oStage->setStgTitle( $aData['STG_TITLE'] );
|
$oStage->setStgTitle( $aData['STG_TITLE'] );
|
||||||
@@ -97,8 +100,7 @@ class Stage extends BaseStage {
|
|||||||
$iResult = $oStage->save();
|
$iResult = $oStage->save();
|
||||||
$oConnection->commit();
|
$oConnection->commit();
|
||||||
return $aData['STG_UID'];
|
return $aData['STG_UID'];
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$sMessage = '';
|
$sMessage = '';
|
||||||
$aValidationFailures = $oStage->getValidationFailures();
|
$aValidationFailures = $oStage->getValidationFailures();
|
||||||
foreach ($aValidationFailures as $oValidationFailure) {
|
foreach ($aValidationFailures as $oValidationFailure) {
|
||||||
@@ -106,8 +108,7 @@ class Stage extends BaseStage {
|
|||||||
}
|
}
|
||||||
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);
|
||||||
}
|
}
|
||||||
@@ -116,30 +117,26 @@ class Stage extends BaseStage {
|
|||||||
public function update ($fields)
|
public function update ($fields)
|
||||||
{
|
{
|
||||||
$con = Propel::getConnection( StagePeer::DATABASE_NAME );
|
$con = Propel::getConnection( StagePeer::DATABASE_NAME );
|
||||||
try
|
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)) $contentResult+=$this->setStgTitle($fields["STG_TITLE"]);
|
if (array_key_exists( "STG_TITLE", $fields )) {
|
||||||
|
$contentResult += $this->setStgTitle( $fields["STG_TITLE"] );
|
||||||
|
}
|
||||||
$result = $this->save();
|
$result = $this->save();
|
||||||
$result = ($result == 0) ? ($contentResult > 0 ? 1 : 0) : $result;
|
$result = ($result == 0) ? ($contentResult > 0 ? 1 : 0) : $result;
|
||||||
$con->commit();
|
$con->commit();
|
||||||
return $result;
|
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) {
|
||||||
catch(Exception $e)
|
|
||||||
{
|
|
||||||
$con->rollback();
|
$con->rollback();
|
||||||
throw ($e);
|
throw ($e);
|
||||||
}
|
}
|
||||||
@@ -148,8 +145,7 @@ class Stage extends BaseStage {
|
|||||||
public function remove ($StgUid)
|
public function remove ($StgUid)
|
||||||
{
|
{
|
||||||
$con = Propel::getConnection( StagePeer::DATABASE_NAME );
|
$con = Propel::getConnection( StagePeer::DATABASE_NAME );
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
$con->begin();
|
$con->begin();
|
||||||
$oStage = StagePeer::retrieveByPK( $StgUid );
|
$oStage = StagePeer::retrieveByPK( $StgUid );
|
||||||
if (! is_null( $oStage )) {
|
if (! is_null( $oStage )) {
|
||||||
@@ -158,15 +154,14 @@ class Stage extends BaseStage {
|
|||||||
$con->commit();
|
$con->commit();
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
} catch (Exception $e) {
|
||||||
catch(Exception $e)
|
|
||||||
{
|
|
||||||
$con->rollback();
|
$con->rollback();
|
||||||
throw ($e);
|
throw ($e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function reorderPositions($sProcessUID, $iIndex) {
|
public function reorderPositions ($sProcessUID, $iIndex)
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
$oCriteria = new Criteria( 'workflow' );
|
$oCriteria = new Criteria( 'workflow' );
|
||||||
$oCriteria->add( StagePeer::PRO_UID, $sProcessUID );
|
$oCriteria->add( StagePeer::PRO_UID, $sProcessUID );
|
||||||
@@ -175,26 +170,24 @@ class Stage extends BaseStage {
|
|||||||
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||||
$oDataset->next();
|
$oDataset->next();
|
||||||
while ($aRow = $oDataset->getRow()) {
|
while ($aRow = $oDataset->getRow()) {
|
||||||
$this->update(array('STG_UID' => $aRow['STG_UID'],
|
$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
|
||||||
'PRO_UID' => $aRow['PRO_UID'],
|
) );
|
||||||
'STG_POSX' => $aRow['STG_POSX'],
|
|
||||||
'STG_POSY' => $aRow['STG_POSY'],
|
|
||||||
'STG_INDEX' => $aRow['STG_INDEX'] - 1));
|
|
||||||
$oDataset->next();
|
$oDataset->next();
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $oException) {
|
||||||
catch (Exception $oException) {
|
|
||||||
throw $Exception;
|
throw $Exception;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function Exists ( $sUid ) {
|
public function Exists ($sUid)
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
$oObj = StagePeer::retrieveByPk( $sUid );
|
$oObj = StagePeer::retrieveByPk( $sUid );
|
||||||
return (is_object( $oObj ) && get_class( $oObj ) == 'Stage');
|
return (is_object( $oObj ) && get_class( $oObj ) == 'Stage');
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // Stage
|
}
|
||||||
|
// Stage
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
<?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.
|
||||||
*
|
*
|
||||||
@@ -18,56 +18,56 @@ require_once 'classes/model/om/BaseStepSupervisor.php';
|
|||||||
*
|
*
|
||||||
* @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 {
|
||||||
else {
|
|
||||||
throw (new Exception( "The row '$Uid' in table StepSupervisor doesn't exist!" ));
|
throw (new Exception( "The row '$Uid' in table StepSupervisor doesn't exist!" ));
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function Exists ( $Uid ) {
|
public function Exists ($Uid)
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
$oPro = StepSupervisorPeer::retrieveByPk( $Uid );
|
$oPro = StepSupervisorPeer::retrieveByPk( $Uid );
|
||||||
if (is_object( $oPro ) && get_class( $oPro ) == 'StepSupervisor') {
|
if (is_object( $oPro ) && get_class( $oPro ) == 'StepSupervisor') {
|
||||||
return true;
|
return true;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the step supervisor registry
|
* Create the step supervisor registry
|
||||||
|
*
|
||||||
* @param array $aData
|
* @param array $aData
|
||||||
* @return boolean
|
* @return boolean
|
||||||
**/
|
*
|
||||||
|
*/
|
||||||
public function create ($aData)
|
public function create ($aData)
|
||||||
{
|
{
|
||||||
$oConnection = Propel::getConnection( StepSupervisorPeer::DATABASE_NAME );
|
$oConnection = Propel::getConnection( StepSupervisorPeer::DATABASE_NAME );
|
||||||
try {
|
try {
|
||||||
if ( isset ( $aData['STEP_UID'] ) && $aData['STEP_UID']== '' )
|
if (isset( $aData['STEP_UID'] ) && $aData['STEP_UID'] == '') {
|
||||||
unset( $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()) {
|
||||||
@@ -75,8 +75,7 @@ class StepSupervisor extends BaseStepSupervisor {
|
|||||||
$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) {
|
||||||
@@ -84,8 +83,7 @@ class StepSupervisor extends BaseStepSupervisor {
|
|||||||
}
|
}
|
||||||
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);
|
||||||
}
|
}
|
||||||
@@ -93,24 +91,24 @@ class StepSupervisor extends BaseStepSupervisor {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 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 {
|
||||||
else {
|
|
||||||
$sMessage = '';
|
$sMessage = '';
|
||||||
$aValidationFailures = $oStepSupervisor->getValidationFailures();
|
$aValidationFailures = $oStepSupervisor->getValidationFailures();
|
||||||
foreach ($aValidationFailures as $oValidationFailure) {
|
foreach ($aValidationFailures as $oValidationFailure) {
|
||||||
@@ -118,12 +116,10 @@ class StepSupervisor extends BaseStepSupervisor {
|
|||||||
}
|
}
|
||||||
throw (new Exception( 'The registry cannot be updated!<br />' . $sMessage ));
|
throw (new Exception( 'The registry cannot be updated!<br />' . $sMessage ));
|
||||||
}
|
}
|
||||||
}
|
} 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);
|
||||||
}
|
}
|
||||||
@@ -131,9 +127,11 @@ class StepSupervisor extends BaseStepSupervisor {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the step supervisor registry
|
* Remove the step supervisor registry
|
||||||
|
*
|
||||||
* @param string $sStepUID
|
* @param string $sStepUID
|
||||||
* @return integer
|
* @return integer
|
||||||
**/
|
*
|
||||||
|
*/
|
||||||
public function remove ($sStepUID)
|
public function remove ($sStepUID)
|
||||||
{
|
{
|
||||||
$oConnection = Propel::getConnection( StepSupervisorPeer::DATABASE_NAME );
|
$oConnection = Propel::getConnection( StepSupervisorPeer::DATABASE_NAME );
|
||||||
@@ -143,8 +141,7 @@ class StepSupervisor extends BaseStepSupervisor {
|
|||||||
$iResult = $this->delete();
|
$iResult = $this->delete();
|
||||||
$oConnection->commit();
|
$oConnection->commit();
|
||||||
return $iResult;
|
return $iResult;
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
|
||||||
$oConnection->rollback();
|
$oConnection->rollback();
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
@@ -152,10 +149,13 @@ class StepSupervisor extends BaseStepSupervisor {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the next position for a atep
|
* Get the next position for a atep
|
||||||
|
*
|
||||||
* @param string $sProcessUID
|
* @param string $sProcessUID
|
||||||
* @return integer
|
* @return integer
|
||||||
**/
|
*
|
||||||
function getNextPosition($sProcessUID, $sType) {
|
*/
|
||||||
|
public 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' );
|
||||||
@@ -166,18 +166,20 @@ class StepSupervisor extends BaseStepSupervisor {
|
|||||||
$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) {
|
*/
|
||||||
|
public function reorderPositions ($sProcessUID, $iPosition, $sType)
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
$oCriteria = new Criteria( 'workflow' );
|
$oCriteria = new Criteria( 'workflow' );
|
||||||
$oCriteria->add( StepSupervisorPeer::PRO_UID, $sProcessUID );
|
$oCriteria->add( StepSupervisorPeer::PRO_UID, $sProcessUID );
|
||||||
@@ -185,35 +187,34 @@ class StepSupervisor extends BaseStepSupervisor {
|
|||||||
$oCriteria->add( StepSupervisorPeer::STEP_POSITION, $iPosition, '>' );
|
$oCriteria->add( StepSupervisorPeer::STEP_POSITION, $iPosition, '>' );
|
||||||
$oDataset = StepSupervisorPeer::doSelectRS( $oCriteria );
|
$oDataset = StepSupervisorPeer::doSelectRS( $oCriteria );
|
||||||
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||||
$oDataset->next();var_dump(StepSupervisorPeer::doCount($oCriteria));
|
$oDataset->next();
|
||||||
while ($aRow = $oDataset->getRow()) {var_dump($aRow);echo "\n";
|
var_dump( StepSupervisorPeer::doCount( $oCriteria ) );
|
||||||
$this->update(array('STEP_UID' => $aRow['STEP_UID'],
|
while ($aRow = $oDataset->getRow()) {
|
||||||
'PRO_UID' => $aRow['PRO_UID'],
|
var_dump( $aRow );
|
||||||
'STEP_TYPE_OBJ' => $aRow['STEP_TYPE_OBJ'],
|
echo "\n";
|
||||||
'STEP_UID_OBJ' => $aRow['STEP_UID_OBJ'],
|
$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
|
||||||
'STEP_POSITION' => $aRow['STEP_POSITION'] - 1));
|
) );
|
||||||
$oDataset->next();
|
$oDataset->next();
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $oException) {
|
||||||
catch (Exception $oException) {
|
|
||||||
throw $Exception;
|
throw $Exception;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function removeByObject ($sType, $sObjUid)
|
||||||
function removeByObject($sType, $sObjUid) {
|
{
|
||||||
try {
|
try {
|
||||||
$oCriteria = new Criteria( 'workflow' );
|
$oCriteria = new Criteria( 'workflow' );
|
||||||
$oCriteria->add( StepSupervisorPeer::STEP_TYPE_OBJ, $sType );
|
$oCriteria->add( StepSupervisorPeer::STEP_TYPE_OBJ, $sType );
|
||||||
$oCriteria->add( StepSupervisorPeer::STEP_UID_OBJ, $sObjUid );
|
$oCriteria->add( StepSupervisorPeer::STEP_UID_OBJ, $sObjUid );
|
||||||
StepSupervisorPeer::doDelete( $oCriteria );
|
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 = new Criteria( 'workflow' );
|
||||||
$oCriteria->add( StepSupervisorPeer::STEP_UID_OBJ, $sObjUID );
|
$oCriteria->add( StepSupervisorPeer::STEP_UID_OBJ, $sObjUID );
|
||||||
@@ -222,9 +223,7 @@ function loadInfo($sObjUID){
|
|||||||
$oDataset->next();
|
$oDataset->next();
|
||||||
$aRow = $oDataset->getRow();
|
$aRow = $oDataset->getRow();
|
||||||
return ($aRow);
|
return ($aRow);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
// StepSupervisor
|
||||||
|
|
||||||
|
|
||||||
} // StepSupervisor
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* class.pmSugar.pmFunctions.php
|
* class.pmSugar.pmFunctions.php
|
||||||
*
|
*
|
||||||
@@ -16,7 +17,8 @@
|
|||||||
////////////////////////////////////////////////////
|
////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
function getSoapClientOptions() {
|
function getSoapClientOptions ()
|
||||||
|
{
|
||||||
$options = array ('trace' => 1);
|
$options = array ('trace' => 1);
|
||||||
|
|
||||||
//Apply proxy settings
|
//Apply proxy settings
|
||||||
@@ -40,22 +42,24 @@ function getSoapClientOptions() {
|
|||||||
/**
|
/**
|
||||||
* This collection of triggers allows to interact by getting and sending information to SugarCRM
|
* This collection of triggers allows to interact by getting and sending information to SugarCRM
|
||||||
* @class pmSugar
|
* @class pmSugar
|
||||||
|
*
|
||||||
* @name Sugar CRM Triggers
|
* @name Sugar CRM Triggers
|
||||||
* @icon /images/triggers/icon_SugarCRM.gif
|
* @icon /images/triggers/icon_SugarCRM.gif
|
||||||
* @className class.pmSugar.pmFunctions.php
|
* @className class.pmSugar.pmFunctions.php
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function sugarLogin($sugarSoap, $user, $password) {
|
function sugarLogin ($sugarSoap, $user, $password)
|
||||||
|
{
|
||||||
$client = new SoapClient( $sugarSoap, getSoapClientOptions() );
|
$client = new SoapClient( $sugarSoap, getSoapClientOptions() );
|
||||||
$auth_array = array ('user_auth' => array ('user_name' => $user,'password' => md5( $password ),'version' => '1.0') );
|
$auth_array = array ('user_auth' => array ('user_name' => $user,'password' => md5( $password ),'version' => '1.0') );
|
||||||
$login_results = $client->__SoapCall( 'login', $auth_array );
|
$login_results = $client->__SoapCall( 'login', $auth_array );
|
||||||
|
|
||||||
$session_id = $login_results->id;
|
$session_id = $login_results->id;
|
||||||
$user_guid = $client->__SoapCall( 'get_user_id', array ($session_id) );
|
$user_guid = $client->__SoapCall( 'get_user_id', array ($session_id) );
|
||||||
return $session_id;
|
return $session_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
function objectToArray($object) {
|
function objectToArray ($object)
|
||||||
|
{
|
||||||
if (! is_object( $object ) && ! is_array( $object )) {
|
if (! is_object( $object ) && ! is_array( $object )) {
|
||||||
return $object;
|
return $object;
|
||||||
}
|
}
|
||||||
@@ -66,9 +70,8 @@ function objectToArray($object) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @method
|
|
||||||
*
|
*
|
||||||
* Gets SugarCRM entry using get_entry web service.
|
* @method Gets SugarCRM entry using get_entry web service.
|
||||||
*
|
*
|
||||||
* @name GetSugarEntry
|
* @name GetSugarEntry
|
||||||
* @label Get SugarCRM Entry
|
* @label Get SugarCRM Entry
|
||||||
@@ -86,11 +89,11 @@ function objectToArray($object) {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function GetSugarEntry($sugarSoap, $user, $password, $module, $id, $selectFields, $linkNameToFieldsArray, $resultType = 'array') {
|
function GetSugarEntry ($sugarSoap, $user, $password, $module, $id, $selectFields, $linkNameToFieldsArray, $resultType = 'array')
|
||||||
|
{
|
||||||
$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, 'id' => $id,
|
$request_array = array ('session' => $sessionId,'module_name' => $module,'id' => $id,'select_fields' => $select_fields,'link_name_to_fields_array' => $linkNameToFieldsArray);
|
||||||
'select_fields' => $select_fields, 'link_name_to_fields_array' => $linkNameToFieldsArray);
|
|
||||||
$sugarEntry = $client->__SoapCall( 'get_entry', $request_array );
|
$sugarEntry = $client->__SoapCall( 'get_entry', $request_array );
|
||||||
|
|
||||||
if ($resultType == 'array') {
|
if ($resultType == 'array') {
|
||||||
@@ -101,9 +104,8 @@ function GetSugarEntry($sugarSoap, $user, $password, $module, $id, $selectFields
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @method
|
|
||||||
*
|
*
|
||||||
* Gets SugarCRM entries from the indicated module.
|
* @method Gets SugarCRM entries from the indicated module.
|
||||||
*
|
*
|
||||||
* @name GetSugarEntries
|
* @name GetSugarEntries
|
||||||
* @label Get SugarCRM Entries
|
* @label Get SugarCRM Entries
|
||||||
@@ -122,25 +124,31 @@ function GetSugarEntry($sugarSoap, $user, $password, $module, $id, $selectFields
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function GetSugarEntries($sugarSoap, $user, $password, $module, $query, $orderBy, $selectedFields, $maxResults, $resultType="array") {
|
function GetSugarEntries ($sugarSoap, $user, $password, $module, $query, $orderBy, $selectedFields, $maxResults, $resultType = "array")
|
||||||
|
{
|
||||||
$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,'query' => $query,'order_by' => $orderBy,'offset' => "",'select_fields' => "",'max_result' => $maxResults);
|
$request_array = array ('session' => $sessionId,'module_name' => $module,'query' => $query,'order_by' => $orderBy,'offset' => "",'select_fields' => "",'max_result' => $maxResults);
|
||||||
$sugarEntriesO = $client->__SoapCall( 'get_entry_list', $request_array );
|
$sugarEntriesO = $client->__SoapCall( 'get_entry_list', $request_array );
|
||||||
|
|
||||||
switch ($resultType) {
|
switch ($resultType) {
|
||||||
case 'array':$sugarEntries = objectToArray ( $sugarEntriesO ); break;
|
case 'array':
|
||||||
case 'object':$sugarEntries = $sugarEntriesO; break;
|
$sugarEntries = objectToArray( $sugarEntriesO );
|
||||||
default: $sugarEntries = objectToArray ( $sugarEntries );
|
break;
|
||||||
|
case 'object':
|
||||||
|
$sugarEntries = $sugarEntriesO;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$sugarEntries = objectToArray( $sugarEntries );
|
||||||
}
|
}
|
||||||
|
|
||||||
return $sugarEntries;
|
return $sugarEntries;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @method
|
|
||||||
*
|
*
|
||||||
* Gets SugarCRM entries from the Calls module
|
* @method Gets SugarCRM entries from the Calls module
|
||||||
*
|
*
|
||||||
* @name GetSugarCalls
|
* @name GetSugarCalls
|
||||||
* @label Gets SugarCRM entries from the Calls module
|
* @label Gets SugarCRM entries from the Calls module
|
||||||
@@ -158,14 +166,15 @@ function GetSugarEntries($sugarSoap, $user, $password, $module, $query, $orderBy
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function GetSugarCalls($sugarSoap, $user, $password, $query, $orderBy, $selectedFields, $maxResults, $resultType="array") {
|
function GetSugarCalls ($sugarSoap, $user, $password, $query, $orderBy, $selectedFields, $maxResults, $resultType = "array")
|
||||||
|
{
|
||||||
$module = "Calls";
|
$module = "Calls";
|
||||||
return GetSugarEntries( $sugarSoap, $user, $password, $module, $query, $orderBy, $selectedFields, $maxResults, $resultType );
|
return GetSugarEntries( $sugarSoap, $user, $password, $module, $query, $orderBy, $selectedFields, $maxResults, $resultType );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @method
|
|
||||||
*
|
*
|
||||||
* Gets SugarCRM entries from the Leads module.
|
* @method Gets SugarCRM entries from the Leads module.
|
||||||
*
|
*
|
||||||
* @name GetSugarLeads
|
* @name GetSugarLeads
|
||||||
* @label Gets SugarCRM entries from the Leads module.
|
* @label Gets SugarCRM entries from the Leads module.
|
||||||
@@ -183,14 +192,15 @@ function GetSugarCalls($sugarSoap, $user, $password, $query, $orderBy, $selected
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function GetSugarLeads($sugarSoap, $user, $password, $query, $orderBy, $selectedFields, $maxResults, $resultType="array") {
|
function GetSugarLeads ($sugarSoap, $user, $password, $query, $orderBy, $selectedFields, $maxResults, $resultType = "array")
|
||||||
|
{
|
||||||
$module = "Leads";
|
$module = "Leads";
|
||||||
return GetSugarEntries( $sugarSoap, $user, $password, $module, $query, $orderBy, $selectedFields, $maxResults, $resultType );
|
return GetSugarEntries( $sugarSoap, $user, $password, $module, $query, $orderBy, $selectedFields, $maxResults, $resultType );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @method
|
|
||||||
*
|
*
|
||||||
* Gets SugarCRM entries from the Contacts module.
|
* @method Gets SugarCRM entries from the Contacts module.
|
||||||
*
|
*
|
||||||
* @name GetSugarContacts
|
* @name GetSugarContacts
|
||||||
* @label Gets SugarCRM entries from the Contacts module.
|
* @label Gets SugarCRM entries from the Contacts module.
|
||||||
@@ -208,14 +218,15 @@ function GetSugarLeads($sugarSoap, $user, $password, $query, $orderBy, $selected
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function GetSugarContacts($sugarSoap, $user, $password, $query, $orderBy, $selectedFields, $maxResults, $resultType="array") {
|
function GetSugarContacts ($sugarSoap, $user, $password, $query, $orderBy, $selectedFields, $maxResults, $resultType = "array")
|
||||||
|
{
|
||||||
$module = "Contacts";
|
$module = "Contacts";
|
||||||
return GetSugarEntries( $sugarSoap, $user, $password, $module, $query, $orderBy, $selectedFields, $maxResults, $resultType );
|
return GetSugarEntries( $sugarSoap, $user, $password, $module, $query, $orderBy, $selectedFields, $maxResults, $resultType );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @method
|
|
||||||
*
|
*
|
||||||
* Gets SugarCRM entries from the Opportunities module.
|
* @method Gets SugarCRM entries from the Opportunities module.
|
||||||
*
|
*
|
||||||
* @name GetSugarOpportunities
|
* @name GetSugarOpportunities
|
||||||
* @label Gets SugarCRM entries from the Opportunities module.
|
* @label Gets SugarCRM entries from the Opportunities module.
|
||||||
@@ -233,15 +244,15 @@ function GetSugarContacts($sugarSoap, $user, $password, $query, $orderBy, $selec
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function GetSugarOpportunities($sugarSoap, $user, $password, $query, $orderBy, $selectedFields, $maxResults, $resultType="array") {
|
function GetSugarOpportunities ($sugarSoap, $user, $password, $query, $orderBy, $selectedFields, $maxResults, $resultType = "array")
|
||||||
|
{
|
||||||
$module = "Opportunities";
|
$module = "Opportunities";
|
||||||
return GetSugarEntries( $sugarSoap, $user, $password, $module, $query, $orderBy, $selectedFields, $maxResults, $resultType );
|
return GetSugarEntries( $sugarSoap, $user, $password, $module, $query, $orderBy, $selectedFields, $maxResults, $resultType );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @method
|
|
||||||
*
|
*
|
||||||
* Gets SugarCRM entries from the Account module.
|
* @method Gets SugarCRM entries from the Account module.
|
||||||
*
|
*
|
||||||
* @name GetSugarAccount
|
* @name GetSugarAccount
|
||||||
* @label Gets SugarCRM entries from the Account module.
|
* @label Gets SugarCRM entries from the Account module.
|
||||||
@@ -259,16 +270,15 @@ function GetSugarOpportunities($sugarSoap, $user, $password, $query, $orderBy, $
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function GetSugarAccount($sugarSoap, $user, $password, $query, $orderBy, $selectedFields, $maxResults, $resultType="array") {
|
function GetSugarAccount ($sugarSoap, $user, $password, $query, $orderBy, $selectedFields, $maxResults, $resultType = "array")
|
||||||
|
{
|
||||||
$module = "Accounts";
|
$module = "Accounts";
|
||||||
return GetSugarEntries( $sugarSoap, $user, $password, $module, $query, $orderBy, $selectedFields, $maxResults, $resultType );
|
return GetSugarEntries( $sugarSoap, $user, $password, $module, $query, $orderBy, $selectedFields, $maxResults, $resultType );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @method
|
|
||||||
*
|
*
|
||||||
* Creates SugarCRM entries from the Account module.
|
* @method Creates SugarCRM entries from the Account module.
|
||||||
*
|
*
|
||||||
* @name CreateSugarAccount
|
* @name CreateSugarAccount
|
||||||
*
|
*
|
||||||
@@ -283,30 +293,33 @@ function GetSugarAccount($sugarSoap, $user, $password, $query, $orderBy, $select
|
|||||||
* @return array/object | $sugarAccount | Sugar Opportunities (array or object)
|
* @return array/object | $sugarAccount | Sugar Opportunities (array or object)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function CreateSugarAccount($sugarSoap, $user, $password, $name, $resultType="array") {
|
function CreateSugarAccount ($sugarSoap, $user, $password, $name, $resultType = "array")
|
||||||
|
{
|
||||||
|
|
||||||
$module = "Accounts";
|
$module = "Accounts";
|
||||||
$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 )
|
|
||||||
) );
|
|
||||||
$sugarEntriesO = $client->__SoapCall( 'set_entry', $request_array );
|
$sugarEntriesO = $client->__SoapCall( 'set_entry', $request_array );
|
||||||
$account_id = $sugarEntriesO->id;
|
$account_id = $sugarEntriesO->id;
|
||||||
|
|
||||||
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':
|
||||||
|
$sugarEntries = $sugarEntries;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$sugarEntries = objectToArray( $sugarEntries );
|
||||||
}
|
}
|
||||||
//return $sugarEntries;
|
//return $sugarEntries;
|
||||||
return $account_id;
|
return $account_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @method
|
|
||||||
*
|
*
|
||||||
* Creates SugarCRM entries from the Account module
|
* @method Creates SugarCRM entries from the Account module
|
||||||
*
|
*
|
||||||
* @name CreateSugarContact
|
* @name CreateSugarContact
|
||||||
*
|
*
|
||||||
@@ -326,8 +339,8 @@ function CreateSugarAccount($sugarSoap, $user, $password, $name, $resultType="a
|
|||||||
* @return array/object | $sugarContact | Sugar Opportunities (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") {
|
function CreateSugarContact ($sugarSoap, $user, $password, $first_name, $last_name, $email, $title, $phone, $account_id, $resultType = "array")
|
||||||
|
{
|
||||||
$module = "Contacts";
|
$module = "Contacts";
|
||||||
/* $aValue = array(
|
/* $aValue = array(
|
||||||
array("name" => 'id', "value" => G::generateUniqueID()),
|
array("name" => 'id', "value" => G::generateUniqueID()),
|
||||||
@@ -338,34 +351,37 @@ function CreateSugarContact($sugarSoap, $user, $password, $first_name, $last_nam
|
|||||||
$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':
|
||||||
|
$sugarEntries = $sugarEntries;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$sugarEntries = objectToArray( $sugarEntries );
|
||||||
}
|
}
|
||||||
return $sugarEntries;
|
return $sugarEntries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @method
|
|
||||||
*
|
*
|
||||||
* Creates SugarCRM entries from the Opportunities module.
|
* @method Creates SugarCRM entries from the Opportunities module.
|
||||||
*
|
*
|
||||||
* @name CreateSugarOpportunity
|
* @name CreateSugarOpportunity
|
||||||
|
*
|
||||||
* @label Creates SugarCRM entries from the Opportunities module.
|
* @label Creates SugarCRM entries from the Opportunities module.
|
||||||
*
|
*
|
||||||
* @param string | $sugarSoap | Sugar SOAP URL | http://www.example.com/sugar/soap.php?wsdl
|
* @param string | $sugarSoap | Sugar SOAP URL | http://www.example.com/sugar/soap.php?wsdl
|
||||||
@@ -381,7 +397,8 @@ function CreateSugarContact($sugarSoap, $user, $password, $first_name, $last_nam
|
|||||||
* @return array/object | $sugarOpportunity | Sugar Opportunities (array or object)
|
* @return array/object | $sugarOpportunity | Sugar Opportunities (array or object)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function CreateSugarOpportunity($sugarSoap, $user, $password, $name,$account_id,$amount, $date_closed, $sales_stage,$resultType="array") {
|
function CreateSugarOpportunity ($sugarSoap, $user, $password, $name, $account_id, $amount, $date_closed, $sales_stage, $resultType = "array")
|
||||||
|
{
|
||||||
// * @param string | $account_id | Account Id
|
// * @param string | $account_id | Account Id
|
||||||
$module = "Opportunities";
|
$module = "Opportunities";
|
||||||
|
|
||||||
@@ -397,30 +414,33 @@ function CreateSugarOpportunity($sugarSoap, $user, $password, $name,$account_id,
|
|||||||
$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) {
|
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':
|
||||||
|
$sugarEntries = $sugarEntries;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$sugarEntries = objectToArray( $sugarEntries );
|
||||||
}
|
}
|
||||||
return $sugarEntries;
|
return $sugarEntries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @method
|
|
||||||
*
|
*
|
||||||
* Creates SugarCRM entries from the Account module
|
* @method Creates SugarCRM entries from the Account module
|
||||||
*
|
*
|
||||||
* @name CreateSugarLeads
|
* @name CreateSugarLeads
|
||||||
*
|
*
|
||||||
@@ -440,28 +460,37 @@ function CreateSugarOpportunity($sugarSoap, $user, $password, $name,$account_id,
|
|||||||
* @return array/object | $sugarContact | Sugar Opportunities (array or object)
|
* @return array/object | $sugarContact | Sugar Opportunities (array or object)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function CreateSugarLeads($sugarSoap, $user, $password, $first_name, $last_name, $email, $title, $phone, $account_id, $resultType="array") {
|
function CreateSugarLeads ($sugarSoap, $user, $password, $first_name, $last_name, $email, $title, $phone, $account_id, $resultType = "array")
|
||||||
|
{
|
||||||
|
|
||||||
$module = "Leads";
|
$module = "Leads";
|
||||||
$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':
|
||||||
|
$sugarEntries = $sugarEntries;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$sugarEntries = objectToArray( $sugarEntries );
|
||||||
}
|
}
|
||||||
return $sugarEntries;
|
return $sugarEntries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user