Envio temporal
This commit is contained in:
21
workflow/engine/classes/class.formBatchRouting.php
Normal file
21
workflow/engine/classes/class.formBatchRouting.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
class FormBatchRouting extends Form
|
||||
{
|
||||
public function getVars($bWhitSystemVars = true)
|
||||
{
|
||||
$aFields = array ();
|
||||
if ($bWhitSystemVars) {
|
||||
$aAux = G::getSystemConstants();
|
||||
foreach ($aAux as $sName => $sValue) {
|
||||
$aFields[] = array ("sName" => $sName, "sType" => "system");
|
||||
}
|
||||
}
|
||||
foreach ($this->fields as $k => $v) {
|
||||
if (($v->type != "title") && ($v->type != "subtitle") && ($v->type != "file") && ($v->type != "button") && ($v->type != "reset") && ($v->type != "submit") && ($v->type != "listbox") && ($v->type != "checkgroup") && ($v->type != "grid") && ($v->type != "javascript")) {
|
||||
$aFields[] = array ('sName' => trim( $k ),'sType' => trim( $v->type ));
|
||||
}
|
||||
}
|
||||
return $aFields;
|
||||
}
|
||||
}
|
||||
|
||||
43
workflow/engine/classes/class.library.php
Normal file
43
workflow/engine/classes/class.library.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
class Library
|
||||
{
|
||||
public static function getCasesNumRec($userUid)
|
||||
{
|
||||
$cnn = Propel::getConnection("workflow");
|
||||
$stmt = $cnn->createStatement();
|
||||
|
||||
//Number of records active
|
||||
$criteria = new Criteria("workflow");
|
||||
|
||||
//SELECT
|
||||
$criteria->addSelectColumn(CaseConsolidatedPeer::CON_STATUS);
|
||||
//FROM
|
||||
//WHERE
|
||||
$criteria->add(CaseConsolidatedPeer::CON_STATUS, "ACTIVE");
|
||||
|
||||
$activeNumRec = CaseConsolidatedPeer::doCount($criteria);
|
||||
|
||||
//Number of records
|
||||
$numRec = 0;
|
||||
|
||||
$sql = "SELECT COUNT(APP_CACHE_VIEW.TAS_UID) AS NUMREC
|
||||
FROM CASE_CONSOLIDATED
|
||||
LEFT JOIN APP_CACHE_VIEW ON (CASE_CONSOLIDATED.TAS_UID = APP_CACHE_VIEW.TAS_UID)
|
||||
WHERE APP_CACHE_VIEW.USR_UID = '$userUid' AND
|
||||
APP_CACHE_VIEW.DEL_THREAD_STATUS = 'OPEN' AND
|
||||
APP_CACHE_VIEW.APP_STATUS = 'TO_DO'";
|
||||
|
||||
$rsSql = $stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
while ($rsSql->next()) {
|
||||
$row = $rsSql->getRow();
|
||||
|
||||
$numRec = $row["NUMREC"];
|
||||
}
|
||||
|
||||
$numRec = ($activeNumRec > 0)? $numRec : 0;
|
||||
|
||||
return $numRec;
|
||||
}
|
||||
}
|
||||
|
||||
19
workflow/engine/classes/model/CaseConsolidated.php
Normal file
19
workflow/engine/classes/model/CaseConsolidated.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
require_once 'classes/model/om/BaseCaseConsolidated.php';
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for representing a row from the 'CASE_CONSOLIDATED' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
* @package classes.model
|
||||
*/
|
||||
class CaseConsolidated extends BaseCaseConsolidated {
|
||||
|
||||
} // CaseConsolidated
|
||||
23
workflow/engine/classes/model/CaseConsolidatedPeer.php
Normal file
23
workflow/engine/classes/model/CaseConsolidatedPeer.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
// include base peer class
|
||||
require_once 'classes/model/om/BaseCaseConsolidatedPeer.php';
|
||||
|
||||
// include object class
|
||||
include_once 'classes/model/CaseConsolidated.php';
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'CASE_CONSOLIDATED' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
* @package classes.model
|
||||
*/
|
||||
class CaseConsolidatedPeer extends BaseCaseConsolidatedPeer {
|
||||
|
||||
} // CaseConsolidatedPeer
|
||||
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
require_once 'propel/map/MapBuilder.php';
|
||||
include_once 'creole/CreoleTypes.php';
|
||||
|
||||
|
||||
/**
|
||||
* This class adds structure of 'CASE_CONSOLIDATED' table to 'workflow' DatabaseMap object.
|
||||
*
|
||||
*
|
||||
*
|
||||
* These statically-built map classes are used by Propel to do runtime db structure discovery.
|
||||
* For example, the createSelectSql() method checks the type of a given column used in an
|
||||
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
|
||||
* (i.e. if it's a text column type).
|
||||
*
|
||||
* @package workflow.classes.model.map
|
||||
*/
|
||||
class CaseConsolidatedMapBuilder
|
||||
{
|
||||
|
||||
/**
|
||||
* The (dot-path) name of this class
|
||||
*/
|
||||
const CLASS_NAME = 'classes.model.map.CaseConsolidatedMapBuilder';
|
||||
|
||||
/**
|
||||
* The database map.
|
||||
*/
|
||||
private $dbMap;
|
||||
|
||||
/**
|
||||
* Tells us if this DatabaseMapBuilder is built so that we
|
||||
* don't have to re-build it every time.
|
||||
*
|
||||
* @return boolean true if this DatabaseMapBuilder is built, false otherwise.
|
||||
*/
|
||||
public function isBuilt()
|
||||
{
|
||||
return ($this->dbMap !== null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the databasemap this map builder built.
|
||||
*
|
||||
* @return the databasemap
|
||||
*/
|
||||
public function getDatabaseMap()
|
||||
{
|
||||
return $this->dbMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* The doBuild() method builds the DatabaseMap
|
||||
*
|
||||
* @return void
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function doBuild()
|
||||
{
|
||||
$this->dbMap = Propel::getDatabaseMap('workflow');
|
||||
|
||||
$tMap = $this->dbMap->addTable('CASE_CONSOLIDATED');
|
||||
$tMap->setPhpName('CaseConsolidated');
|
||||
|
||||
$tMap->setUseIdGenerator(false);
|
||||
|
||||
$tMap->addPrimaryKey('TAS_UID', 'TasUid', 'string', CreoleTypes::VARCHAR, true, 32);
|
||||
|
||||
$tMap->addColumn('DYN_UID', 'DynUid', 'string', CreoleTypes::VARCHAR, true, 32);
|
||||
|
||||
$tMap->addColumn('REP_TAB_UID', 'RepTabUid', 'string', CreoleTypes::VARCHAR, true, 32);
|
||||
|
||||
$tMap->addColumn('CON_STATUS', 'ConStatus', 'string', CreoleTypes::VARCHAR, true, 20);
|
||||
|
||||
} // doBuild()
|
||||
|
||||
} // CaseConsolidatedMapBuilder
|
||||
684
workflow/engine/classes/model/om/BaseCaseConsolidated.php
Normal file
684
workflow/engine/classes/model/om/BaseCaseConsolidated.php
Normal file
@@ -0,0 +1,684 @@
|
||||
<?php
|
||||
|
||||
require_once 'propel/om/BaseObject.php';
|
||||
|
||||
require_once 'propel/om/Persistent.php';
|
||||
|
||||
|
||||
include_once 'propel/util/Criteria.php';
|
||||
|
||||
include_once 'classes/model/CaseConsolidatedPeer.php';
|
||||
|
||||
/**
|
||||
* Base class that represents a row from the 'CASE_CONSOLIDATED' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @package workflow.classes.model.om
|
||||
*/
|
||||
abstract class BaseCaseConsolidated extends BaseObject implements Persistent
|
||||
{
|
||||
|
||||
/**
|
||||
* The Peer class.
|
||||
* Instance provides a convenient way of calling static methods on a class
|
||||
* that calling code may not be able to identify.
|
||||
* @var CaseConsolidatedPeer
|
||||
*/
|
||||
protected static $peer;
|
||||
|
||||
/**
|
||||
* The value for the tas_uid field.
|
||||
* @var string
|
||||
*/
|
||||
protected $tas_uid = '';
|
||||
|
||||
/**
|
||||
* The value for the dyn_uid field.
|
||||
* @var string
|
||||
*/
|
||||
protected $dyn_uid = '';
|
||||
|
||||
/**
|
||||
* The value for the rep_tab_uid field.
|
||||
* @var string
|
||||
*/
|
||||
protected $rep_tab_uid = '';
|
||||
|
||||
/**
|
||||
* The value for the con_status field.
|
||||
* @var string
|
||||
*/
|
||||
protected $con_status = 'ACTIVE';
|
||||
|
||||
/**
|
||||
* Flag to prevent endless save loop, if this object is referenced
|
||||
* by another object which falls in this transaction.
|
||||
* @var boolean
|
||||
*/
|
||||
protected $alreadyInSave = false;
|
||||
|
||||
/**
|
||||
* Flag to prevent endless validation loop, if this object is referenced
|
||||
* by another object which falls in this transaction.
|
||||
* @var boolean
|
||||
*/
|
||||
protected $alreadyInValidation = false;
|
||||
|
||||
/**
|
||||
* Get the [tas_uid] column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTasUid()
|
||||
{
|
||||
|
||||
return $this->tas_uid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [dyn_uid] column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDynUid()
|
||||
{
|
||||
|
||||
return $this->dyn_uid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [rep_tab_uid] column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRepTabUid()
|
||||
{
|
||||
|
||||
return $this->rep_tab_uid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [con_status] column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getConStatus()
|
||||
{
|
||||
|
||||
return $this->con_status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of [tas_uid] column.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return void
|
||||
*/
|
||||
public function setTasUid($v)
|
||||
{
|
||||
|
||||
// Since the native PHP type for this column is string,
|
||||
// we will cast the input to a string (if it is not).
|
||||
if ($v !== null && !is_string($v)) {
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->tas_uid !== $v || $v === '') {
|
||||
$this->tas_uid = $v;
|
||||
$this->modifiedColumns[] = CaseConsolidatedPeer::TAS_UID;
|
||||
}
|
||||
|
||||
} // setTasUid()
|
||||
|
||||
/**
|
||||
* Set the value of [dyn_uid] column.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return void
|
||||
*/
|
||||
public function setDynUid($v)
|
||||
{
|
||||
|
||||
// Since the native PHP type for this column is string,
|
||||
// we will cast the input to a string (if it is not).
|
||||
if ($v !== null && !is_string($v)) {
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->dyn_uid !== $v || $v === '') {
|
||||
$this->dyn_uid = $v;
|
||||
$this->modifiedColumns[] = CaseConsolidatedPeer::DYN_UID;
|
||||
}
|
||||
|
||||
} // setDynUid()
|
||||
|
||||
/**
|
||||
* Set the value of [rep_tab_uid] column.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return void
|
||||
*/
|
||||
public function setRepTabUid($v)
|
||||
{
|
||||
|
||||
// Since the native PHP type for this column is string,
|
||||
// we will cast the input to a string (if it is not).
|
||||
if ($v !== null && !is_string($v)) {
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->rep_tab_uid !== $v || $v === '') {
|
||||
$this->rep_tab_uid = $v;
|
||||
$this->modifiedColumns[] = CaseConsolidatedPeer::REP_TAB_UID;
|
||||
}
|
||||
|
||||
} // setRepTabUid()
|
||||
|
||||
/**
|
||||
* Set the value of [con_status] column.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return void
|
||||
*/
|
||||
public function setConStatus($v)
|
||||
{
|
||||
|
||||
// Since the native PHP type for this column is string,
|
||||
// we will cast the input to a string (if it is not).
|
||||
if ($v !== null && !is_string($v)) {
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->con_status !== $v || $v === 'ACTIVE') {
|
||||
$this->con_status = $v;
|
||||
$this->modifiedColumns[] = CaseConsolidatedPeer::CON_STATUS;
|
||||
}
|
||||
|
||||
} // setConStatus()
|
||||
|
||||
/**
|
||||
* Hydrates (populates) the object variables with values from the database resultset.
|
||||
*
|
||||
* An offset (1-based "start column") is specified so that objects can be hydrated
|
||||
* with a subset of the columns in the resultset rows. This is needed, for example,
|
||||
* for results of JOIN queries where the resultset row includes columns from two or
|
||||
* more tables.
|
||||
*
|
||||
* @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos.
|
||||
* @param int $startcol 1-based offset column which indicates which restultset column to start with.
|
||||
* @return int next starting column
|
||||
* @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
|
||||
*/
|
||||
public function hydrate(ResultSet $rs, $startcol = 1)
|
||||
{
|
||||
try {
|
||||
|
||||
$this->tas_uid = $rs->getString($startcol + 0);
|
||||
|
||||
$this->dyn_uid = $rs->getString($startcol + 1);
|
||||
|
||||
$this->rep_tab_uid = $rs->getString($startcol + 2);
|
||||
|
||||
$this->con_status = $rs->getString($startcol + 3);
|
||||
|
||||
$this->resetModified();
|
||||
|
||||
$this->setNew(false);
|
||||
|
||||
// FIXME - using NUM_COLUMNS may be clearer.
|
||||
return $startcol + 4; // 4 = CaseConsolidatedPeer::NUM_COLUMNS - CaseConsolidatedPeer::NUM_LAZY_LOAD_COLUMNS).
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating CaseConsolidated object", $e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes this object from datastore and sets delete attribute.
|
||||
*
|
||||
* @param Connection $con
|
||||
* @return void
|
||||
* @throws PropelException
|
||||
* @see BaseObject::setDeleted()
|
||||
* @see BaseObject::isDeleted()
|
||||
*/
|
||||
public function delete($con = null)
|
||||
{
|
||||
if ($this->isDeleted()) {
|
||||
throw new PropelException("This object has already been deleted.");
|
||||
}
|
||||
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(CaseConsolidatedPeer::DATABASE_NAME);
|
||||
}
|
||||
|
||||
try {
|
||||
$con->begin();
|
||||
CaseConsolidatedPeer::doDelete($this, $con);
|
||||
$this->setDeleted(true);
|
||||
$con->commit();
|
||||
} catch (PropelException $e) {
|
||||
$con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores the object in the database. If the object is new,
|
||||
* it inserts it; otherwise an update is performed. This method
|
||||
* wraps the doSave() worker method in a transaction.
|
||||
*
|
||||
* @param Connection $con
|
||||
* @return int The number of rows affected by this insert/update
|
||||
* @throws PropelException
|
||||
* @see doSave()
|
||||
*/
|
||||
public function save($con = null)
|
||||
{
|
||||
if ($this->isDeleted()) {
|
||||
throw new PropelException("You cannot save an object that has been deleted.");
|
||||
}
|
||||
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(CaseConsolidatedPeer::DATABASE_NAME);
|
||||
}
|
||||
|
||||
try {
|
||||
$con->begin();
|
||||
$affectedRows = $this->doSave($con);
|
||||
$con->commit();
|
||||
return $affectedRows;
|
||||
} catch (PropelException $e) {
|
||||
$con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores the object in the database.
|
||||
*
|
||||
* If the object is new, it inserts it; otherwise an update is performed.
|
||||
* All related objects are also updated in this method.
|
||||
*
|
||||
* @param Connection $con
|
||||
* @return int The number of rows affected by this insert/update and any referring
|
||||
* @throws PropelException
|
||||
* @see save()
|
||||
*/
|
||||
protected function doSave($con)
|
||||
{
|
||||
$affectedRows = 0; // initialize var to track total num of affected rows
|
||||
if (!$this->alreadyInSave) {
|
||||
$this->alreadyInSave = true;
|
||||
|
||||
|
||||
// If this object has been modified, then save it to the database.
|
||||
if ($this->isModified()) {
|
||||
if ($this->isNew()) {
|
||||
$pk = CaseConsolidatedPeer::doInsert($this, $con);
|
||||
$affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which
|
||||
// should always be true here (even though technically
|
||||
// BasePeer::doInsert() can insert multiple rows).
|
||||
|
||||
$this->setNew(false);
|
||||
} else {
|
||||
$affectedRows += CaseConsolidatedPeer::doUpdate($this, $con);
|
||||
}
|
||||
$this->resetModified(); // [HL] After being saved an object is no longer 'modified'
|
||||
}
|
||||
|
||||
$this->alreadyInSave = false;
|
||||
}
|
||||
return $affectedRows;
|
||||
} // doSave()
|
||||
|
||||
/**
|
||||
* Array of ValidationFailed objects.
|
||||
* @var array ValidationFailed[]
|
||||
*/
|
||||
protected $validationFailures = array();
|
||||
|
||||
/**
|
||||
* Gets any ValidationFailed objects that resulted from last call to validate().
|
||||
*
|
||||
*
|
||||
* @return array ValidationFailed[]
|
||||
* @see validate()
|
||||
*/
|
||||
public function getValidationFailures()
|
||||
{
|
||||
return $this->validationFailures;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates the objects modified field values and all objects related to this table.
|
||||
*
|
||||
* If $columns is either a column name or an array of column names
|
||||
* only those columns are validated.
|
||||
*
|
||||
* @param mixed $columns Column name or an array of column names.
|
||||
* @return boolean Whether all columns pass validation.
|
||||
* @see doValidate()
|
||||
* @see getValidationFailures()
|
||||
*/
|
||||
public function validate($columns = null)
|
||||
{
|
||||
$res = $this->doValidate($columns);
|
||||
if ($res === true) {
|
||||
$this->validationFailures = array();
|
||||
return true;
|
||||
} else {
|
||||
$this->validationFailures = $res;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function performs the validation work for complex object models.
|
||||
*
|
||||
* In addition to checking the current object, all related objects will
|
||||
* also be validated. If all pass then <code>true</code> is returned; otherwise
|
||||
* an aggreagated array of ValidationFailed objects will be returned.
|
||||
*
|
||||
* @param array $columns Array of column names to validate.
|
||||
* @return mixed <code>true</code> if all validations pass;
|
||||
array of <code>ValidationFailed</code> objects otherwise.
|
||||
*/
|
||||
protected function doValidate($columns = null)
|
||||
{
|
||||
if (!$this->alreadyInValidation) {
|
||||
$this->alreadyInValidation = true;
|
||||
$retval = null;
|
||||
|
||||
$failureMap = array();
|
||||
|
||||
|
||||
if (($retval = CaseConsolidatedPeer::doValidate($this, $columns)) !== true) {
|
||||
$failureMap = array_merge($failureMap, $retval);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$this->alreadyInValidation = false;
|
||||
}
|
||||
|
||||
return (!empty($failureMap) ? $failureMap : true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a field from the object by name passed in as a string.
|
||||
*
|
||||
* @param string $name name
|
||||
* @param string $type The type of fieldname the $name is of:
|
||||
* one of the class type constants TYPE_PHPNAME,
|
||||
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
|
||||
* @return mixed Value of field.
|
||||
*/
|
||||
public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
|
||||
{
|
||||
$pos = CaseConsolidatedPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
|
||||
return $this->getByPosition($pos);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a field from the object by Position as specified in the xml schema.
|
||||
* Zero-based.
|
||||
*
|
||||
* @param int $pos position in xml schema
|
||||
* @return mixed Value of field at $pos
|
||||
*/
|
||||
public function getByPosition($pos)
|
||||
{
|
||||
switch($pos) {
|
||||
case 0:
|
||||
return $this->getTasUid();
|
||||
break;
|
||||
case 1:
|
||||
return $this->getDynUid();
|
||||
break;
|
||||
case 2:
|
||||
return $this->getRepTabUid();
|
||||
break;
|
||||
case 3:
|
||||
return $this->getConStatus();
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
break;
|
||||
} // switch()
|
||||
}
|
||||
|
||||
/**
|
||||
* Exports the object as an array.
|
||||
*
|
||||
* You can specify the key type of the array by passing one of the class
|
||||
* type constants.
|
||||
*
|
||||
* @param string $keyType One of the class type constants TYPE_PHPNAME,
|
||||
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
|
||||
* @return an associative array containing the field names (as keys) and field values
|
||||
*/
|
||||
public function toArray($keyType = BasePeer::TYPE_PHPNAME)
|
||||
{
|
||||
$keys = CaseConsolidatedPeer::getFieldNames($keyType);
|
||||
$result = array(
|
||||
$keys[0] => $this->getTasUid(),
|
||||
$keys[1] => $this->getDynUid(),
|
||||
$keys[2] => $this->getRepTabUid(),
|
||||
$keys[3] => $this->getConStatus(),
|
||||
);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a field from the object by name passed in as a string.
|
||||
*
|
||||
* @param string $name peer name
|
||||
* @param mixed $value field value
|
||||
* @param string $type The type of fieldname the $name is of:
|
||||
* one of the class type constants TYPE_PHPNAME,
|
||||
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
|
||||
* @return void
|
||||
*/
|
||||
public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
|
||||
{
|
||||
$pos = CaseConsolidatedPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
|
||||
return $this->setByPosition($pos, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a field from the object by Position as specified in the xml schema.
|
||||
* Zero-based.
|
||||
*
|
||||
* @param int $pos position in xml schema
|
||||
* @param mixed $value field value
|
||||
* @return void
|
||||
*/
|
||||
public function setByPosition($pos, $value)
|
||||
{
|
||||
switch($pos) {
|
||||
case 0:
|
||||
$this->setTasUid($value);
|
||||
break;
|
||||
case 1:
|
||||
$this->setDynUid($value);
|
||||
break;
|
||||
case 2:
|
||||
$this->setRepTabUid($value);
|
||||
break;
|
||||
case 3:
|
||||
$this->setConStatus($value);
|
||||
break;
|
||||
} // switch()
|
||||
}
|
||||
|
||||
/**
|
||||
* Populates the object using an array.
|
||||
*
|
||||
* This is particularly useful when populating an object from one of the
|
||||
* request arrays (e.g. $_POST). This method goes through the column
|
||||
* names, checking to see whether a matching key exists in populated
|
||||
* array. If so the setByName() method is called for that column.
|
||||
*
|
||||
* You can specify the key type of the array by additionally passing one
|
||||
* of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME,
|
||||
* TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId')
|
||||
*
|
||||
* @param array $arr An array to populate the object from.
|
||||
* @param string $keyType The type of keys the array uses.
|
||||
* @return void
|
||||
*/
|
||||
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
|
||||
{
|
||||
$keys = CaseConsolidatedPeer::getFieldNames($keyType);
|
||||
|
||||
if (array_key_exists($keys[0], $arr)) {
|
||||
$this->setTasUid($arr[$keys[0]]);
|
||||
}
|
||||
|
||||
if (array_key_exists($keys[1], $arr)) {
|
||||
$this->setDynUid($arr[$keys[1]]);
|
||||
}
|
||||
|
||||
if (array_key_exists($keys[2], $arr)) {
|
||||
$this->setRepTabUid($arr[$keys[2]]);
|
||||
}
|
||||
|
||||
if (array_key_exists($keys[3], $arr)) {
|
||||
$this->setConStatus($arr[$keys[3]]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a Criteria object containing the values of all modified columns in this object.
|
||||
*
|
||||
* @return Criteria The Criteria object containing all modified values.
|
||||
*/
|
||||
public function buildCriteria()
|
||||
{
|
||||
$criteria = new Criteria(CaseConsolidatedPeer::DATABASE_NAME);
|
||||
|
||||
if ($this->isColumnModified(CaseConsolidatedPeer::TAS_UID)) {
|
||||
$criteria->add(CaseConsolidatedPeer::TAS_UID, $this->tas_uid);
|
||||
}
|
||||
|
||||
if ($this->isColumnModified(CaseConsolidatedPeer::DYN_UID)) {
|
||||
$criteria->add(CaseConsolidatedPeer::DYN_UID, $this->dyn_uid);
|
||||
}
|
||||
|
||||
if ($this->isColumnModified(CaseConsolidatedPeer::REP_TAB_UID)) {
|
||||
$criteria->add(CaseConsolidatedPeer::REP_TAB_UID, $this->rep_tab_uid);
|
||||
}
|
||||
|
||||
if ($this->isColumnModified(CaseConsolidatedPeer::CON_STATUS)) {
|
||||
$criteria->add(CaseConsolidatedPeer::CON_STATUS, $this->con_status);
|
||||
}
|
||||
|
||||
|
||||
return $criteria;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a Criteria object containing the primary key for this object.
|
||||
*
|
||||
* Unlike buildCriteria() this method includes the primary key values regardless
|
||||
* of whether or not they have been modified.
|
||||
*
|
||||
* @return Criteria The Criteria object containing value(s) for primary key(s).
|
||||
*/
|
||||
public function buildPkeyCriteria()
|
||||
{
|
||||
$criteria = new Criteria(CaseConsolidatedPeer::DATABASE_NAME);
|
||||
|
||||
$criteria->add(CaseConsolidatedPeer::TAS_UID, $this->tas_uid);
|
||||
|
||||
return $criteria;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the primary key for this object (row).
|
||||
* @return string
|
||||
*/
|
||||
public function getPrimaryKey()
|
||||
{
|
||||
return $this->getTasUid();
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic method to set the primary key (tas_uid column).
|
||||
*
|
||||
* @param string $key Primary key.
|
||||
* @return void
|
||||
*/
|
||||
public function setPrimaryKey($key)
|
||||
{
|
||||
$this->setTasUid($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets contents of passed object to values from current object.
|
||||
*
|
||||
* If desired, this method can also make copies of all associated (fkey referrers)
|
||||
* objects.
|
||||
*
|
||||
* @param object $copyObj An object of CaseConsolidated (or compatible) type.
|
||||
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function copyInto($copyObj, $deepCopy = false)
|
||||
{
|
||||
|
||||
$copyObj->setDynUid($this->dyn_uid);
|
||||
|
||||
$copyObj->setRepTabUid($this->rep_tab_uid);
|
||||
|
||||
$copyObj->setConStatus($this->con_status);
|
||||
|
||||
|
||||
$copyObj->setNew(true);
|
||||
|
||||
$copyObj->setTasUid(''); // this is a pkey column, so set to default value
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes a copy of this object that will be inserted as a new row in table when saved.
|
||||
* It creates a new object filling in the simple attributes, but skipping any primary
|
||||
* keys that are defined for the table.
|
||||
*
|
||||
* If desired, this method can also make copies of all associated (fkey referrers)
|
||||
* objects.
|
||||
*
|
||||
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
|
||||
* @return CaseConsolidated Clone of current object.
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function copy($deepCopy = false)
|
||||
{
|
||||
// we use get_class(), because this might be a subclass
|
||||
$clazz = get_class($this);
|
||||
$copyObj = new $clazz();
|
||||
$this->copyInto($copyObj, $deepCopy);
|
||||
return $copyObj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a peer instance associated with this om.
|
||||
*
|
||||
* Since Peer classes are not to have any instance attributes, this method returns the
|
||||
* same instance for all member of this class. The method could therefore
|
||||
* be static, but this would prevent one from overriding the behavior.
|
||||
*
|
||||
* @return CaseConsolidatedPeer
|
||||
*/
|
||||
public function getPeer()
|
||||
{
|
||||
if (self::$peer === null) {
|
||||
self::$peer = new CaseConsolidatedPeer();
|
||||
}
|
||||
return self::$peer;
|
||||
}
|
||||
}
|
||||
|
||||
582
workflow/engine/classes/model/om/BaseCaseConsolidatedPeer.php
Normal file
582
workflow/engine/classes/model/om/BaseCaseConsolidatedPeer.php
Normal file
@@ -0,0 +1,582 @@
|
||||
<?php
|
||||
|
||||
require_once 'propel/util/BasePeer.php';
|
||||
// The object class -- needed for instanceof checks in this class.
|
||||
// actual class may be a subclass -- as returned by CaseConsolidatedPeer::getOMClass()
|
||||
include_once 'classes/model/CaseConsolidated.php';
|
||||
|
||||
/**
|
||||
* Base static class for performing query and update operations on the 'CASE_CONSOLIDATED' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @package workflow.classes.model.om
|
||||
*/
|
||||
abstract class BaseCaseConsolidatedPeer
|
||||
{
|
||||
|
||||
/** the default database name for this class */
|
||||
const DATABASE_NAME = 'workflow';
|
||||
|
||||
/** the table name for this class */
|
||||
const TABLE_NAME = 'CASE_CONSOLIDATED';
|
||||
|
||||
/** A class that can be returned by this peer. */
|
||||
const CLASS_DEFAULT = 'classes.model.CaseConsolidated';
|
||||
|
||||
/** The total number of columns. */
|
||||
const NUM_COLUMNS = 4;
|
||||
|
||||
/** The number of lazy-loaded columns. */
|
||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||
|
||||
|
||||
/** the column name for the TAS_UID field */
|
||||
const TAS_UID = 'CASE_CONSOLIDATED.TAS_UID';
|
||||
|
||||
/** the column name for the DYN_UID field */
|
||||
const DYN_UID = 'CASE_CONSOLIDATED.DYN_UID';
|
||||
|
||||
/** the column name for the REP_TAB_UID field */
|
||||
const REP_TAB_UID = 'CASE_CONSOLIDATED.REP_TAB_UID';
|
||||
|
||||
/** the column name for the CON_STATUS field */
|
||||
const CON_STATUS = 'CASE_CONSOLIDATED.CON_STATUS';
|
||||
|
||||
/** The PHP to DB Name Mapping */
|
||||
private static $phpNameMap = null;
|
||||
|
||||
|
||||
/**
|
||||
* holds an array of fieldnames
|
||||
*
|
||||
* first dimension keys are the type constants
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
private static $fieldNames = array (
|
||||
BasePeer::TYPE_PHPNAME => array ('TasUid', 'DynUid', 'RepTabUid', 'ConStatus', ),
|
||||
BasePeer::TYPE_COLNAME => array (CaseConsolidatedPeer::TAS_UID, CaseConsolidatedPeer::DYN_UID, CaseConsolidatedPeer::REP_TAB_UID, CaseConsolidatedPeer::CON_STATUS, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('TAS_UID', 'DYN_UID', 'REP_TAB_UID', 'CON_STATUS', ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
|
||||
);
|
||||
|
||||
/**
|
||||
* holds an array of keys for quick access to the fieldnames array
|
||||
*
|
||||
* first dimension keys are the type constants
|
||||
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
private static $fieldKeys = array (
|
||||
BasePeer::TYPE_PHPNAME => array ('TasUid' => 0, 'DynUid' => 1, 'RepTabUid' => 2, 'ConStatus' => 3, ),
|
||||
BasePeer::TYPE_COLNAME => array (CaseConsolidatedPeer::TAS_UID => 0, CaseConsolidatedPeer::DYN_UID => 1, CaseConsolidatedPeer::REP_TAB_UID => 2, CaseConsolidatedPeer::CON_STATUS => 3, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('TAS_UID' => 0, 'DYN_UID' => 1, 'REP_TAB_UID' => 2, 'CON_STATUS' => 3, ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
|
||||
);
|
||||
|
||||
/**
|
||||
* @return MapBuilder the map builder for this peer
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function getMapBuilder()
|
||||
{
|
||||
include_once 'classes/model/map/CaseConsolidatedMapBuilder.php';
|
||||
return BasePeer::getMapBuilder('classes.model.map.CaseConsolidatedMapBuilder');
|
||||
}
|
||||
/**
|
||||
* Gets a map (hash) of PHP names to DB column names.
|
||||
*
|
||||
* @return array The PHP to DB name map for this peer
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
* @deprecated Use the getFieldNames() and translateFieldName() methods instead of this.
|
||||
*/
|
||||
public static function getPhpNameMap()
|
||||
{
|
||||
if (self::$phpNameMap === null) {
|
||||
$map = CaseConsolidatedPeer::getTableMap();
|
||||
$columns = $map->getColumns();
|
||||
$nameMap = array();
|
||||
foreach ($columns as $column) {
|
||||
$nameMap[$column->getPhpName()] = $column->getColumnName();
|
||||
}
|
||||
self::$phpNameMap = $nameMap;
|
||||
}
|
||||
return self::$phpNameMap;
|
||||
}
|
||||
/**
|
||||
* Translates a fieldname to another type
|
||||
*
|
||||
* @param string $name field name
|
||||
* @param string $fromType One of the class type constants TYPE_PHPNAME,
|
||||
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
|
||||
* @param string $toType One of the class type constants
|
||||
* @return string translated name of the field.
|
||||
*/
|
||||
static public function translateFieldName($name, $fromType, $toType)
|
||||
{
|
||||
$toNames = self::getFieldNames($toType);
|
||||
$key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
|
||||
if ($key === null) {
|
||||
throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
|
||||
}
|
||||
return $toNames[$key];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of of field names.
|
||||
*
|
||||
* @param string $type The type of fieldnames to return:
|
||||
* One of the class type constants TYPE_PHPNAME,
|
||||
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
|
||||
* @return array A list of field names
|
||||
*/
|
||||
|
||||
static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
|
||||
{
|
||||
if (!array_key_exists($type, self::$fieldNames)) {
|
||||
throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.');
|
||||
}
|
||||
return self::$fieldNames[$type];
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method which changes table.column to alias.column.
|
||||
*
|
||||
* Using this method you can maintain SQL abstraction while using column aliases.
|
||||
* <code>
|
||||
* $c->addAlias("alias1", TablePeer::TABLE_NAME);
|
||||
* $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
|
||||
* </code>
|
||||
* @param string $alias The alias for the current table.
|
||||
* @param string $column The column name for current table. (i.e. CaseConsolidatedPeer::COLUMN_NAME).
|
||||
* @return string
|
||||
*/
|
||||
public static function alias($alias, $column)
|
||||
{
|
||||
return str_replace(CaseConsolidatedPeer::TABLE_NAME.'.', $alias.'.', $column);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add all the columns needed to create a new object.
|
||||
*
|
||||
* Note: any columns that were marked with lazyLoad="true" in the
|
||||
* XML schema will not be added to the select list and only loaded
|
||||
* on demand.
|
||||
*
|
||||
* @param criteria object containing the columns to add.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function addSelectColumns(Criteria $criteria)
|
||||
{
|
||||
|
||||
$criteria->addSelectColumn(CaseConsolidatedPeer::TAS_UID);
|
||||
|
||||
$criteria->addSelectColumn(CaseConsolidatedPeer::DYN_UID);
|
||||
|
||||
$criteria->addSelectColumn(CaseConsolidatedPeer::REP_TAB_UID);
|
||||
|
||||
$criteria->addSelectColumn(CaseConsolidatedPeer::CON_STATUS);
|
||||
|
||||
}
|
||||
|
||||
const COUNT = 'COUNT(CASE_CONSOLIDATED.TAS_UID)';
|
||||
const COUNT_DISTINCT = 'COUNT(DISTINCT CASE_CONSOLIDATED.TAS_UID)';
|
||||
|
||||
/**
|
||||
* Returns the number of rows matching criteria.
|
||||
*
|
||||
* @param Criteria $criteria
|
||||
* @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
|
||||
* @param Connection $con
|
||||
* @return int Number of matching rows.
|
||||
*/
|
||||
public static function doCount(Criteria $criteria, $distinct = false, $con = null)
|
||||
{
|
||||
// we're going to modify criteria, so copy it first
|
||||
$criteria = clone $criteria;
|
||||
|
||||
// clear out anything that might confuse the ORDER BY clause
|
||||
$criteria->clearSelectColumns()->clearOrderByColumns();
|
||||
if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||
$criteria->addSelectColumn(CaseConsolidatedPeer::COUNT_DISTINCT);
|
||||
} else {
|
||||
$criteria->addSelectColumn(CaseConsolidatedPeer::COUNT);
|
||||
}
|
||||
|
||||
// just in case we're grouping: add those columns to the select statement
|
||||
foreach ($criteria->getGroupByColumns() as $column) {
|
||||
$criteria->addSelectColumn($column);
|
||||
}
|
||||
|
||||
$rs = CaseConsolidatedPeer::doSelectRS($criteria, $con);
|
||||
if ($rs->next()) {
|
||||
return $rs->getInt(1);
|
||||
} else {
|
||||
// no rows returned; we infer that means 0 matches.
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Method to select one object from the DB.
|
||||
*
|
||||
* @param Criteria $criteria object used to create the SELECT statement.
|
||||
* @param Connection $con
|
||||
* @return CaseConsolidated
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doSelectOne(Criteria $criteria, $con = null)
|
||||
{
|
||||
$critcopy = clone $criteria;
|
||||
$critcopy->setLimit(1);
|
||||
$objects = CaseConsolidatedPeer::doSelect($critcopy, $con);
|
||||
if ($objects) {
|
||||
return $objects[0];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* Method to do selects.
|
||||
*
|
||||
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
|
||||
* @param Connection $con
|
||||
* @return array Array of selected Objects
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doSelect(Criteria $criteria, $con = null)
|
||||
{
|
||||
return CaseConsolidatedPeer::populateObjects(CaseConsolidatedPeer::doSelectRS($criteria, $con));
|
||||
}
|
||||
/**
|
||||
* Prepares the Criteria object and uses the parent doSelect()
|
||||
* method to get a ResultSet.
|
||||
*
|
||||
* Use this method directly if you want to just get the resultset
|
||||
* (instead of an array of objects).
|
||||
*
|
||||
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
|
||||
* @param Connection $con the connection to use
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
* @return ResultSet The resultset object with numerically-indexed fields.
|
||||
* @see BasePeer::doSelect()
|
||||
*/
|
||||
public static function doSelectRS(Criteria $criteria, $con = null)
|
||||
{
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(self::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if (!$criteria->getSelectColumns()) {
|
||||
$criteria = clone $criteria;
|
||||
CaseConsolidatedPeer::addSelectColumns($criteria);
|
||||
}
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(self::DATABASE_NAME);
|
||||
|
||||
// BasePeer returns a Creole ResultSet, set to return
|
||||
// rows indexed numerically.
|
||||
return BasePeer::doSelect($criteria, $con);
|
||||
}
|
||||
/**
|
||||
* The returned array will contain objects of the default type or
|
||||
* objects that inherit from the default.
|
||||
*
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function populateObjects(ResultSet $rs)
|
||||
{
|
||||
$results = array();
|
||||
|
||||
// set the class once to avoid overhead in the loop
|
||||
$cls = CaseConsolidatedPeer::getOMClass();
|
||||
$cls = Propel::import($cls);
|
||||
// populate the object(s)
|
||||
while ($rs->next()) {
|
||||
|
||||
$obj = new $cls();
|
||||
$obj->hydrate($rs);
|
||||
$results[] = $obj;
|
||||
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
/**
|
||||
* Returns the TableMap related to this peer.
|
||||
* This method is not needed for general use but a specific application could have a need.
|
||||
* @return TableMap
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function getTableMap()
|
||||
{
|
||||
return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* The class that the Peer will make instances of.
|
||||
*
|
||||
* This uses a dot-path notation which is tranalted into a path
|
||||
* relative to a location on the PHP include_path.
|
||||
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
|
||||
*
|
||||
* @return string path.to.ClassName
|
||||
*/
|
||||
public static function getOMClass()
|
||||
{
|
||||
return CaseConsolidatedPeer::CLASS_DEFAULT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method perform an INSERT on the database, given a CaseConsolidated or Criteria object.
|
||||
*
|
||||
* @param mixed $values Criteria or CaseConsolidated object containing data that is used to create the INSERT statement.
|
||||
* @param Connection $con the connection to use
|
||||
* @return mixed The new primary key.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doInsert($values, $con = null)
|
||||
{
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(self::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($values instanceof Criteria) {
|
||||
$criteria = clone $values; // rename for clarity
|
||||
} else {
|
||||
$criteria = $values->buildCriteria(); // build Criteria from CaseConsolidated object
|
||||
}
|
||||
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(self::DATABASE_NAME);
|
||||
|
||||
try {
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table (I guess, conceivably)
|
||||
$con->begin();
|
||||
$pk = BasePeer::doInsert($criteria, $con);
|
||||
$con->commit();
|
||||
} catch (PropelException $e) {
|
||||
$con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $pk;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method perform an UPDATE on the database, given a CaseConsolidated or Criteria object.
|
||||
*
|
||||
* @param mixed $values Criteria or CaseConsolidated object containing data create the UPDATE statement.
|
||||
* @param Connection $con The connection to use (specify Connection exert more control over transactions).
|
||||
* @return int The number of affected rows (if supported by underlying database driver).
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doUpdate($values, $con = null)
|
||||
{
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(self::DATABASE_NAME);
|
||||
}
|
||||
|
||||
$selectCriteria = new Criteria(self::DATABASE_NAME);
|
||||
|
||||
if ($values instanceof Criteria) {
|
||||
$criteria = clone $values; // rename for clarity
|
||||
|
||||
$comparison = $criteria->getComparison(CaseConsolidatedPeer::TAS_UID);
|
||||
$selectCriteria->add(CaseConsolidatedPeer::TAS_UID, $criteria->remove(CaseConsolidatedPeer::TAS_UID), $comparison);
|
||||
|
||||
} else {
|
||||
$criteria = $values->buildCriteria(); // gets full criteria
|
||||
$selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
|
||||
}
|
||||
|
||||
// set the correct dbName
|
||||
$criteria->setDbName(self::DATABASE_NAME);
|
||||
|
||||
return BasePeer::doUpdate($selectCriteria, $criteria, $con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to DELETE all rows from the CASE_CONSOLIDATED table.
|
||||
*
|
||||
* @return int The number of affected rows (if supported by underlying database driver).
|
||||
*/
|
||||
public static function doDeleteAll($con = null)
|
||||
{
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(self::DATABASE_NAME);
|
||||
}
|
||||
$affectedRows = 0; // initialize var to track total num of affected rows
|
||||
try {
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
||||
$con->begin();
|
||||
$affectedRows += BasePeer::doDeleteAll(CaseConsolidatedPeer::TABLE_NAME, $con);
|
||||
$con->commit();
|
||||
return $affectedRows;
|
||||
} catch (PropelException $e) {
|
||||
$con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method perform a DELETE on the database, given a CaseConsolidated or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or CaseConsolidated object or primary key or array of primary keys
|
||||
* which is used to create the DELETE statement
|
||||
* @param Connection $con the connection to use
|
||||
* @return int The number of affected rows (if supported by underlying database driver).
|
||||
* This includes CASCADE-related rows
|
||||
* if supported by native driver or if emulated using Propel.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doDelete($values, $con = null)
|
||||
{
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(CaseConsolidatedPeer::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($values instanceof Criteria) {
|
||||
$criteria = clone $values; // rename for clarity
|
||||
} elseif ($values instanceof CaseConsolidated) {
|
||||
|
||||
$criteria = $values->buildPkeyCriteria();
|
||||
} else {
|
||||
// it must be the primary key
|
||||
$criteria = new Criteria(self::DATABASE_NAME);
|
||||
$criteria->add(CaseConsolidatedPeer::TAS_UID, (array) $values, Criteria::IN);
|
||||
}
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(self::DATABASE_NAME);
|
||||
|
||||
$affectedRows = 0; // initialize var to track total num of affected rows
|
||||
|
||||
try {
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
||||
$con->begin();
|
||||
|
||||
$affectedRows += BasePeer::doDelete($criteria, $con);
|
||||
$con->commit();
|
||||
return $affectedRows;
|
||||
} catch (PropelException $e) {
|
||||
$con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates all modified columns of given CaseConsolidated object.
|
||||
* If parameter $columns is either a single column name or an array of column names
|
||||
* than only those columns are validated.
|
||||
*
|
||||
* NOTICE: This does not apply to primary or foreign keys for now.
|
||||
*
|
||||
* @param CaseConsolidated $obj The object to validate.
|
||||
* @param mixed $cols Column name or array of column names.
|
||||
*
|
||||
* @return mixed TRUE if all columns are valid or the error message of the first invalid column.
|
||||
*/
|
||||
public static function doValidate(CaseConsolidated $obj, $cols = null)
|
||||
{
|
||||
$columns = array();
|
||||
|
||||
if ($cols) {
|
||||
$dbMap = Propel::getDatabaseMap(CaseConsolidatedPeer::DATABASE_NAME);
|
||||
$tableMap = $dbMap->getTable(CaseConsolidatedPeer::TABLE_NAME);
|
||||
|
||||
if (! is_array($cols)) {
|
||||
$cols = array($cols);
|
||||
}
|
||||
|
||||
foreach ($cols as $colName) {
|
||||
if ($tableMap->containsColumn($colName)) {
|
||||
$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
|
||||
$columns[$colName] = $obj->$get();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
return BasePeer::doValidate(CaseConsolidatedPeer::DATABASE_NAME, CaseConsolidatedPeer::TABLE_NAME, $columns);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve a single object by pkey.
|
||||
*
|
||||
* @param mixed $pk the primary key.
|
||||
* @param Connection $con the connection to use
|
||||
* @return CaseConsolidated
|
||||
*/
|
||||
public static function retrieveByPK($pk, $con = null)
|
||||
{
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(self::DATABASE_NAME);
|
||||
}
|
||||
|
||||
$criteria = new Criteria(CaseConsolidatedPeer::DATABASE_NAME);
|
||||
|
||||
$criteria->add(CaseConsolidatedPeer::TAS_UID, $pk);
|
||||
|
||||
|
||||
$v = CaseConsolidatedPeer::doSelect($criteria, $con);
|
||||
|
||||
return !empty($v) > 0 ? $v[0] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve multiple objects by pkey.
|
||||
*
|
||||
* @param array $pks List of primary keys
|
||||
* @param Connection $con the connection to use
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function retrieveByPKs($pks, $con = null)
|
||||
{
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(self::DATABASE_NAME);
|
||||
}
|
||||
|
||||
$objs = null;
|
||||
if (empty($pks)) {
|
||||
$objs = array();
|
||||
} else {
|
||||
$criteria = new Criteria();
|
||||
$criteria->add(CaseConsolidatedPeer::TAS_UID, $pks, Criteria::IN);
|
||||
$objs = CaseConsolidatedPeer::doSelect($criteria, $con);
|
||||
}
|
||||
return $objs;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// static code to register the map builder for this Peer with the main Propel class
|
||||
if (Propel::isInit()) {
|
||||
// the MapBuilder classes register themselves with Propel during initialization
|
||||
// so we need to load them here.
|
||||
try {
|
||||
BaseCaseConsolidatedPeer::getMapBuilder();
|
||||
} catch (Exception $e) {
|
||||
Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR);
|
||||
}
|
||||
} else {
|
||||
// even if Propel is not yet initialized, the map builder class can be registered
|
||||
// now and then it will be loaded when Propel initializes.
|
||||
require_once 'classes/model/map/CaseConsolidatedMapBuilder.php';
|
||||
Propel::registerMapBuilder('classes.model.map.CaseConsolidatedMapBuilder');
|
||||
}
|
||||
|
||||
@@ -1930,6 +1930,32 @@
|
||||
</vendor>
|
||||
</index>
|
||||
</table>
|
||||
<table name="CASE_CONSOLIDATED">
|
||||
<vendor type="mysql">
|
||||
<parameter name="Name" value="CASE_CONSOLIDATED"/>
|
||||
<parameter name="Engine" value="InnoDB"/>
|
||||
<parameter name="Version" value="10"/>
|
||||
<parameter name="Row_format" value="Dynamic"/>
|
||||
<parameter name="Rows" value="18"/>
|
||||
<parameter name="Avg_row_length" value="106"/>
|
||||
<parameter name="Data_length" value="1956"/>
|
||||
<parameter name="Max_data_length" value="281474976710655"/>
|
||||
<parameter name="Index_length" value="2048"/>
|
||||
<parameter name="Data_free" value="40"/>
|
||||
<parameter name="Auto_increment" value=""/>
|
||||
<parameter name="Create_time" value="2015-16-03 11:50:00"/>
|
||||
<parameter name="Update_time" value="2015-16-03 11:50:00"/>
|
||||
<parameter name="Check_time" value=""/>
|
||||
<parameter name="Collation" value="utf8_general_ci"/>
|
||||
<parameter name="Checksum" value=""/>
|
||||
<parameter name="Create_options" value=""/>
|
||||
<parameter name="Comment" value=""/>
|
||||
</vendor>
|
||||
<column name="TAS_UID" type="VARCHAR" size="32" required="true" primaryKey="true" default=""/>
|
||||
<column name="DYN_UID" type="VARCHAR" size="32" required="true" default=""/>
|
||||
<column name="REP_TAB_UID" type="VARCHAR" size="32" required="true" default=""/>
|
||||
<column name="CON_STATUS" type="VARCHAR" size="20" required="true" default="ACTIVE"/>
|
||||
</table>
|
||||
<table name="STAGE">
|
||||
<vendor type="mysql">
|
||||
<parameter name="Name" value="STAGE"/>
|
||||
|
||||
@@ -880,6 +880,21 @@ CREATE TABLE `CASE_TRACKER_OBJECT`
|
||||
KEY `indexCaseTrackerObject`(`PRO_UID`, `CTO_UID_OBJ`)
|
||||
)ENGINE=InnoDB DEFAULT CHARSET='utf8';
|
||||
#-----------------------------------------------------------------------------
|
||||
#-- CASE_CONSOLIDATED
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS `CASE_CONSOLIDATED`;
|
||||
|
||||
|
||||
CREATE TABLE `CASE_CONSOLIDATED`
|
||||
(
|
||||
`TAS_UID` VARCHAR(32) default '' NOT NULL,
|
||||
`DYN_UID` VARCHAR(32) default '' NOT NULL,
|
||||
`REP_TAB_UID` VARCHAR(32) default '' NOT NULL,
|
||||
`CON_STATUS` VARCHAR(20) default 'ACTIVE' NOT NULL,
|
||||
PRIMARY KEY (`TAS_UID`)
|
||||
)ENGINE=InnoDB DEFAULT CHARSET='utf8';
|
||||
#-----------------------------------------------------------------------------
|
||||
#-- STAGE
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -29,6 +29,10 @@ $G_TMP_MENU->AddIdRawOption('FOLDERS', '', G::LoadTranslation('ID_CASES_MENU_FOL
|
||||
$G_TMP_MENU->AddIdRawOption('CASES_START_CASE', 'casesStartPage?action=startCase',
|
||||
G::LoadTranslation('ID_NEW_CASE'), '');
|
||||
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$G_TMP_MENU->AddIdRawOption('CASE_CONSOLIDATED_1', 'casesConsolidatedListExtJs?action=consolidated', 'Batch Routing', '');
|
||||
/*----------------------------------********---------------------------------*/
|
||||
|
||||
$G_TMP_MENU->AddIdRawOption('CASES_INBOX', 'casesListExtJs?action=todo', G::LoadTranslation('ID_INBOX'),
|
||||
'icon-cases-inbox.png');
|
||||
$G_TMP_MENU->AddIdRawOption('CASES_DRAFT', 'casesListExtJs?action=draft', G::LoadTranslation('ID_DRAFT'),
|
||||
|
||||
335
workflow/engine/methods/cases/casesConsolidatedListExtJs.php
Normal file
335
workflow/engine/methods/cases/casesConsolidatedListExtJs.php
Normal file
@@ -0,0 +1,335 @@
|
||||
<?php
|
||||
|
||||
$action = (isset($_REQUEST["action"])) ? $_REQUEST["action"] : "consolidated";
|
||||
|
||||
$oCriteria = new Criteria("workflow");
|
||||
$oCriteria->addSelectColumn(CaseConsolidatedPeer::CON_STATUS);
|
||||
$oCriteria->add(CaseConsolidatedPeer::CON_STATUS, "ACTIVE");
|
||||
$activeNumRows = CaseConsolidatedPeer::doCount($oCriteria);
|
||||
|
||||
G::LoadClass ("BasePeer");
|
||||
G::LoadClass ("configuration");
|
||||
G::loadClass("pmFunctions");
|
||||
|
||||
$headPublisher = &headPublisher::getSingleton();
|
||||
|
||||
//cambiar esto por PROPEL //CASE_CONSOLIDATED TASK
|
||||
$usrUid = $_SESSION["USER_LOGGED"];
|
||||
|
||||
$oCriteria = new Criteria("workflow");
|
||||
$oCriteria->addSelectColumn("*");
|
||||
$oCriteria->addSelectColumn(CaseConsolidatedPeer::TAS_UID);
|
||||
$oCriteria->addJoin(CaseConsolidatedPeer::TAS_UID,ContentPeer::CON_ID, Criteria::LEFT_JOIN);
|
||||
$oCriteria->addJoin(CaseConsolidatedPeer::TAS_UID,TaskPeer::TAS_UID, Criteria::LEFT_JOIN);
|
||||
$oCriteria->addAnd(ContentPeer::CON_CATEGORY, "TAS_TITLE");
|
||||
$oCriteria->addAnd(ContentPeer::CON_LANG, "en");
|
||||
|
||||
$params = array(); //This will be filled with the parameters
|
||||
$sql = BasePeer::createSelectSql($oCriteria, $params);
|
||||
|
||||
$oDataset = CaseConsolidatedPeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
//$oDataset->next();
|
||||
while ($oDataset->next()) {
|
||||
$aRow = $oDataset->getRow();
|
||||
//$aTaskConsolidated [] = $aRow;
|
||||
}
|
||||
|
||||
$query = "SELECT *
|
||||
FROM CASE_CONSOLIDATED LEFT JOIN CONTENT ON
|
||||
(CASE_CONSOLIDATED.TAS_UID = CONTENT.CON_ID) LEFT JOIN TASK ON (CASE_CONSOLIDATED.TAS_UID = TASK.TAS_UID)
|
||||
WHERE CONTENT.CON_CATEGORY='TAS_TITLE' AND CONTENT.CON_LANG='en'";
|
||||
$aTaskConsolidated = executeQuery($query);
|
||||
|
||||
$conf = new Configurations();
|
||||
|
||||
try {
|
||||
$confCasesList = $conf->getConfiguration("casesList", $action);
|
||||
$generalConfCasesList = $conf->getConfiguration("ENVIRONMENT_SETTINGS", "");
|
||||
} catch (Exception $e) {
|
||||
$confCasesList = array();
|
||||
$generalConfCasesList = array();
|
||||
}
|
||||
|
||||
$config = getAdditionalFields($action, $confCasesList);
|
||||
|
||||
if (isset($generalConfCasesList["casesListRowNumber"]) && !empty($generalConfCasesList["casesListRowNumber"])) {
|
||||
$pageSize = intval($generalConfCasesList["casesListRowNumber"]);
|
||||
} else {
|
||||
$pageSize = intval($config["rowsperpage"]);
|
||||
}
|
||||
|
||||
$arrayTabItem = array();
|
||||
$aAllData = array();
|
||||
//$aQTY = array();
|
||||
$i = 0;
|
||||
|
||||
//SQL
|
||||
$cnn = Propel::getConnection("workflow");
|
||||
$stmt = $cnn->createStatement();
|
||||
|
||||
//foreach ($aTaskConsolidated as $value)
|
||||
//{
|
||||
$i++;
|
||||
|
||||
$sql = "SELECT COUNT(APP_CACHE_VIEW.TAS_UID) AS NUMREC,
|
||||
APP_CACHE_VIEW.PRO_UID,
|
||||
(SELECT CON.CON_VALUE
|
||||
FROM CONTENT AS CON
|
||||
WHERE CON.CON_ID = APP_CACHE_VIEW.PRO_UID AND CON.CON_CATEGORY = 'PRO_TITLE' AND CON.CON_LANG = '" . SYS_LANG . "'
|
||||
) AS PROCESS_TITLE,
|
||||
APP_CACHE_VIEW.TAS_UID,
|
||||
CONTASK.CON_VALUE AS TASK_TITLE,
|
||||
CASE_CONSOLIDATED.DYN_UID
|
||||
FROM CASE_CONSOLIDATED
|
||||
LEFT JOIN CONTENT AS CONTASK ON (CASE_CONSOLIDATED.TAS_UID = CONTASK.CON_ID AND CONTASK.CON_CATEGORY = 'TAS_TITLE' AND CONTASK.CON_LANG = '" . SYS_LANG . "')
|
||||
LEFT JOIN APP_CACHE_VIEW ON (CASE_CONSOLIDATED.TAS_UID = APP_CACHE_VIEW.TAS_UID)
|
||||
WHERE APP_CACHE_VIEW.USR_UID = '$usrUid' AND
|
||||
APP_CACHE_VIEW.DEL_THREAD_STATUS = 'OPEN' AND
|
||||
APP_CACHE_VIEW.APP_STATUS = 'TO_DO'
|
||||
GROUP BY APP_CACHE_VIEW.TAS_UID";
|
||||
|
||||
$rsSql = $stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
while ($rsSql->next()) {
|
||||
$row = $rsSql->getRow();
|
||||
|
||||
$processUid = $row["PRO_UID"];
|
||||
$proTitle = $row["PROCESS_TITLE"];
|
||||
$taskUid = $row["TAS_UID"];
|
||||
$taskTitle = $row["TASK_TITLE"];
|
||||
$dynaformUid = $row["DYN_UID"];
|
||||
|
||||
$tabTitle = $taskTitle . " (" . (($activeNumRows > 0)? $row["NUMREC"] : 0) . ")";
|
||||
|
||||
$grdTitle = htmlentities($proTitle . " / " . $tabTitle, ENT_QUOTES, "UTF-8");
|
||||
$tabTitle = htmlentities(substr($proTitle, 0, 25) . ((strlen($proTitle) > 25)? "..." : null) . " / " . $tabTitle, ENT_QUOTES, "UTF-8");
|
||||
|
||||
$arrayTabItem[] = "
|
||||
{
|
||||
title: \"<span onmouseover=\\\"toolTipTab('$grdTitle', 1);\\\" onmouseout=\\\"toolTipTab('', 0);\\\">$tabTitle</span>\",
|
||||
listeners: {
|
||||
activate: function ()
|
||||
{
|
||||
generateGrid(\"$processUid\", \"$taskUid\", \"$dynaformUid\");
|
||||
}
|
||||
}
|
||||
}";
|
||||
}
|
||||
|
||||
if (count($arrayTabItem) > 0) {
|
||||
$urlProxy = '/api/1.0/' . SYS_SYS . '/consolidated/';
|
||||
$clientId = 'x-pm-local-client';
|
||||
$client = getClientCredentials($clientId);
|
||||
$authCode = getAuthorizationCode($client);
|
||||
$debug = false; //System::isDebugMode();
|
||||
|
||||
$loader = Maveriks\Util\ClassLoader::getInstance();
|
||||
$loader->add(PATH_TRUNK . 'vendor/bshaffer/oauth2-server-php/src/', "OAuth2");
|
||||
|
||||
$request = array(
|
||||
'grant_type' => 'authorization_code',
|
||||
'code' => $authCode
|
||||
);
|
||||
$server = array(
|
||||
'REQUEST_METHOD' => 'POST'
|
||||
);
|
||||
$headers = array(
|
||||
"PHP_AUTH_USER" => $client['CLIENT_ID'],
|
||||
"PHP_AUTH_PW" => $client['CLIENT_SECRET'],
|
||||
"Content-Type" => "multipart/form-data;",
|
||||
"Authorization" => "Basic " . base64_encode($client['CLIENT_ID'] . ":" . $client['CLIENT_SECRET'])
|
||||
);
|
||||
|
||||
$request = new \OAuth2\Request(array(), $request, array(), array(), array(), $server, null, $headers);
|
||||
$oauthServer = new \ProcessMaker\Services\OAuth2\Server();
|
||||
$response = $oauthServer->postToken($request, true);
|
||||
|
||||
$clientToken = $response->getParameters();
|
||||
$clientToken["client_id"] = $client['CLIENT_ID'];
|
||||
$clientToken["client_secret"] = $client['CLIENT_SECRET'];
|
||||
|
||||
|
||||
$items = "[" . implode(",", $arrayTabItem) ."]";
|
||||
|
||||
$userUid = (isset($_SESSION["USER_LOGGED"]) && $_SESSION["USER_LOGGED"] != "")? $_SESSION["USER_LOGGED"] : null;
|
||||
$processes = getProcessArray($action, $userUid);
|
||||
|
||||
$headPublisher->assign("pageSize", $pageSize); //Sending the page size
|
||||
$headPublisher->assign("action", $action); //Sending the fields to get from proxy
|
||||
$headPublisher->assign("Items", $items);
|
||||
$headPublisher->assign("processValues", $processes); //Sending the columns to display in grid
|
||||
$headPublisher->assign("varSkin", SYS_SKIN); //Sending the current Skin
|
||||
$headPublisher->assign("FORMATS", $conf->getFormats());
|
||||
$headPublisher->assign("urlProxy", $urlProxy);
|
||||
$headPublisher->assign('credentials', $clientToken );
|
||||
|
||||
$headPublisher->addExtJsScript("app/main", true);
|
||||
$headPublisher->addExtJsScript("cases/casesListConsolidated", false); //Adding a JavaScript file .js
|
||||
$headPublisher->addContent("cases/casesListConsolidated"); //Adding a HTML file .html
|
||||
|
||||
G::RenderPage("publish", "extJs");
|
||||
} else {
|
||||
echo "<span style=\"font: 0.75em normal arial, verdana, helvetica, sans-serif;\">" . G::LoadTranslation("ID_NO_RECORDS_FOUND") . "</span>";
|
||||
}
|
||||
|
||||
|
||||
|
||||
function getProcessArray($action, $userUid)
|
||||
{
|
||||
$processes = array();
|
||||
$processes[] = array("", G::LoadTranslation("ID_ALL_PROCESS"));
|
||||
|
||||
switch ($action) {
|
||||
case "simple_search":
|
||||
case "search":
|
||||
//In search action, the query to obtain all process is too slow, so we need to query directly to
|
||||
//process and content tables, and for that reason we need the current language in AppCacheView.
|
||||
G::loadClass("configuration");
|
||||
$oConf = new Configurations;
|
||||
$oConf->loadConfig($x, "APP_CACHE_VIEW_ENGINE", "", "", "", "");
|
||||
$appCacheViewEngine = $oConf->aConfig;
|
||||
$lang = isset($appCacheViewEngine["LANG"])? $appCacheViewEngine["LANG"] : "en";
|
||||
|
||||
$cProcess = new Criteria("workflow");
|
||||
$cProcess->clearSelectColumns();
|
||||
$cProcess->addSelectColumn(ProcessPeer::PRO_UID);
|
||||
$cProcess->addSelectColumn(ContentPeer::CON_VALUE);
|
||||
|
||||
$del = DBAdapter::getStringDelimiter();
|
||||
|
||||
$conds = array();
|
||||
$conds[] = array(ProcessPeer::PRO_UID, ContentPeer::CON_ID);
|
||||
$conds[] = array(ContentPeer::CON_CATEGORY, $del . "PRO_TITLE" . $del);
|
||||
$conds[] = array(ContentPeer::CON_LANG, $del . $lang . $del);
|
||||
$cProcess->addJoinMC($conds, Criteria::LEFT_JOIN);
|
||||
$cProcess->add(ProcessPeer::PRO_STATUS, "ACTIVE");
|
||||
$oDataset = ProcessPeer::doSelectRS($cProcess);
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
$oDataset->next();
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
$processes[] = array($aRow["PRO_UID"], $aRow["CON_VALUE"]);
|
||||
$oDataset->next();
|
||||
}
|
||||
|
||||
return ($processes);
|
||||
break;
|
||||
case "consolidated":
|
||||
default:
|
||||
$oAppCache = new AppCacheView();
|
||||
$cProcess = $oAppCache->getToDoListCriteria($userUid); //fast enough
|
||||
break;
|
||||
}
|
||||
|
||||
$cProcess->clearSelectColumns();
|
||||
$cProcess->setDistinct();
|
||||
$cProcess->addSelectColumn(AppCacheViewPeer::PRO_UID);
|
||||
$cProcess->addSelectColumn(AppCacheViewPeer::APP_PRO_TITLE);
|
||||
$oDataset = AppCacheViewPeer::doSelectRS($cProcess);
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
$processes[] = array($aRow["PRO_UID"], $aRow["APP_PRO_TITLE"]);
|
||||
$oDataset->next();
|
||||
}
|
||||
|
||||
return ($processes);
|
||||
}
|
||||
|
||||
function getConsolidated()
|
||||
{
|
||||
$caseColumns = array ();
|
||||
$caseColumns[] = array("header" =>"#", "dataIndex" => "APP_NUMBER", "width" => 45, "align" => "center");
|
||||
$caseColumns[] = array("header" =>"Case", "dataIndex" => "APP_TITLE", "width" => 150);
|
||||
$caseColumns[] = array("header" =>"UserUid", "dataIndex" => "USR_UID", "width" => 50, "hidden" => true, "hideable" => false);
|
||||
$caseColumns[] = array("header" =>"PreUsrUid", "dataIndex" => "PREVIOUS_USR_UID", "width" => 50, "hidden" => true, "hideable" => false);
|
||||
$caseColumns[] = array("header" =>"Task", "dataIndex" => "APP_TAS_TITLE", "width" => 120);
|
||||
$caseColumns[] = array("header" =>"Process", "dataIndex" => "APP_PRO_TITLE", "width" => 120);
|
||||
$caseColumns[] = array("header" =>"Sent by", "dataIndex" => "APP_DEL_PREVIOUS_USER", "width" => 90);
|
||||
$caseColumns[] = array("header" =>"Due Date", "dataIndex" => "DEL_TASK_DUE_DATE", "width" => 110);
|
||||
$caseColumns[] = array("header" =>"Last Modify", "dataIndex" => "APP_UPDATE_DATE", "width" => 110);
|
||||
$caseColumns[] = array("header" =>"Priority", "dataIndex" => "DEL_PRIORITY", "width" => 50);
|
||||
|
||||
$caseReaderFields = array();
|
||||
$caseReaderFields[] = array("name" => "APP_UID");
|
||||
$caseReaderFields[] = array("name" => "USR_UID");
|
||||
$caseReaderFields[] = array("name" => "PREVIOUS_USR_UID");
|
||||
$caseReaderFields[] = array("name" => "DEL_INDEX");
|
||||
$caseReaderFields[] = array("name" => "APP_NUMBER");
|
||||
$caseReaderFields[] = array("name" => "APP_TITLE");
|
||||
$caseReaderFields[] = array("name" => "APP_PRO_TITLE");
|
||||
$caseReaderFields[] = array("name" => "APP_TAS_TITLE");
|
||||
$caseReaderFields[] = array("name" => "APP_DEL_PREVIOUS_USER");
|
||||
$caseReaderFields[] = array("name" => "DEL_TASK_DUE_DATE");
|
||||
$caseReaderFields[] = array("name" => "APP_UPDATE_DATE");
|
||||
$caseReaderFields[] = array("name" => "DEL_PRIORITY");
|
||||
$caseReaderFields[] = array("name" => "APP_FINISH_DATE");
|
||||
$caseReaderFields[] = array("name" => "APP_CURRENT_USER");
|
||||
$caseReaderFields[] = array("name" => "APP_STATUS");
|
||||
|
||||
return (array("caseColumns" => $caseColumns, "caseReaderFields" => $caseReaderFields, "rowsperpage" => 20, "dateformat" => "M d, Y"));
|
||||
}
|
||||
|
||||
function getAdditionalFields($action, $confCasesList)
|
||||
{
|
||||
$caseColumns = array();
|
||||
$caseReaderFields = array();
|
||||
|
||||
if (!empty($confCasesList) && !empty($confCasesList["second"]["data"])) {
|
||||
foreach ($confCasesList["second"]["data"] as $fieldData) {
|
||||
if ($fieldData["fieldType"] != "key") {
|
||||
$label = $fieldData["label"];
|
||||
$caseColumns[] = array("header" => $label, "dataIndex" => $fieldData["name"], "width" => $fieldData["width"], "align" => $fieldData["align"]);
|
||||
$caseReaderFields[] = array("name" => $fieldData["name"]);
|
||||
}
|
||||
}
|
||||
return (array("caseColumns" => $caseColumns, "caseReaderFields" => $caseReaderFields, "rowsperpage" => $confCasesList["rowsperpage"], "dateformat" => $confCasesList["dateformat"]));
|
||||
} else {
|
||||
switch ($action) {
|
||||
case "consolidated":
|
||||
default:
|
||||
$action = "consolidated";
|
||||
$config = getConsolidated();
|
||||
break;
|
||||
}
|
||||
return ($config);
|
||||
}
|
||||
}
|
||||
|
||||
function getClientCredentials($clientId)
|
||||
{
|
||||
$oauthQuery = new ProcessMaker\Services\OAuth2\PmPdo(getDsn());
|
||||
return $oauthQuery->getClientDetails($clientId);
|
||||
}
|
||||
|
||||
function getDsn()
|
||||
{
|
||||
list($host, $port) = strpos(DB_HOST, ':') !== false ? explode(':', DB_HOST) : array(DB_HOST, '');
|
||||
$port = empty($port) ? '' : ";port=$port";
|
||||
$dsn = DB_ADAPTER.':host='.$host.';dbname='.DB_NAME.$port;
|
||||
|
||||
return array('dsn' => $dsn, 'username' => DB_USER, 'password' => DB_PASS);
|
||||
}
|
||||
|
||||
|
||||
function getAuthorizationCode($client)
|
||||
{
|
||||
\ProcessMaker\Services\OAuth2\Server::setDatabaseSource(getDsn());
|
||||
\ProcessMaker\Services\OAuth2\Server::setPmClientId($client['CLIENT_ID']);
|
||||
|
||||
$oauthServer = new \ProcessMaker\Services\OAuth2\Server();
|
||||
$userId = $_SESSION['USER_LOGGED'];
|
||||
$authorize = true;
|
||||
$_GET = array_merge($_GET, array(
|
||||
'response_type' => 'code',
|
||||
'client_id' => $client['CLIENT_ID'],
|
||||
'scope' => implode(' ', $oauthServer->getScope())
|
||||
));
|
||||
|
||||
$response = $oauthServer->postAuthorize($authorize, $userId, true);
|
||||
$code = substr($response->getHttpHeader('Location'), strpos($response->getHttpHeader('Location'), 'code=')+5, 40);
|
||||
|
||||
return $code;
|
||||
}
|
||||
953
workflow/engine/src/ProcessMaker/BusinessModel/Consolidated.php
Normal file
953
workflow/engine/src/ProcessMaker/BusinessModel/Consolidated.php
Normal file
@@ -0,0 +1,953 @@
|
||||
<?php
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
|
||||
use \G;
|
||||
use \Smarty;
|
||||
use \Criteria;
|
||||
use \ReportTablePeer;
|
||||
use \ResultSet;
|
||||
use \AppCacheViewPeer;
|
||||
use \CaseConsolidatedPeer;
|
||||
use \ContentPeer;
|
||||
|
||||
/**
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
class Consolidated
|
||||
{
|
||||
/**
|
||||
* Get Consolidated
|
||||
*
|
||||
* @access public
|
||||
* @param string $tas_uid, Task Uid
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function get ($tas_uid)
|
||||
{
|
||||
$criteria = new Criteria();
|
||||
$criteria->addSelectColumn(CaseConsolidatedPeer::DYN_UID);
|
||||
$criteria->addSelectColumn(\ReportTablePeer::REP_TAB_NAME);
|
||||
$criteria->addSelectColumn(ContentPeer::CON_VALUE);
|
||||
$criteria->addSelectColumn(CaseConsolidatedPeer::CON_STATUS);
|
||||
|
||||
$criteria->addJoin( CaseConsolidatedPeer::REP_TAB_UID, ReportTablePeer::REP_TAB_UID, Criteria::LEFT_JOIN );
|
||||
$criteria->addJoin( CaseConsolidatedPeer::REP_TAB_UID, ContentPeer::CON_ID, Criteria::LEFT_JOIN );
|
||||
$criteria->add( ContentPeer::CON_CATEGORY, "REP_TAB_TITLE");
|
||||
$criteria->add( ContentPeer::CON_LANG, SYS_LANG);
|
||||
|
||||
$criteria->add( CaseConsolidatedPeer::TAS_UID, $tas_uid, Criteria::EQUAL );
|
||||
$criteria->add( CaseConsolidatedPeer::CON_STATUS, 'ACTIVE', Criteria::EQUAL );
|
||||
|
||||
$dataset = CaseConsolidatedPeer::doSelectRS($criteria);
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
if ($dataset->next()) {
|
||||
$response = $dataset->getRow();
|
||||
} else {
|
||||
$response = array(
|
||||
'REP_TAB_NAME' => '__' . $tas_uid,
|
||||
'CON_VALUE' => '__' . $tas_uid,
|
||||
);
|
||||
}
|
||||
return array_change_key_case($response, CASE_LOWER);;
|
||||
}
|
||||
|
||||
/**
|
||||
* Put Data Generate
|
||||
*
|
||||
* @access public
|
||||
* @param string $app_uid, Process Uid
|
||||
* @param string $app_number, Task Uid
|
||||
* @param string $del_index, Task Uid
|
||||
* @param string $usr_uid, Task Uid
|
||||
* @return string
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function postDerivate ($app_uid, $app_number, $del_index, $usr_uid)
|
||||
{
|
||||
G::LoadClass("library");
|
||||
G::LoadClass("wsBase");
|
||||
G::LoadClass("case");
|
||||
|
||||
$ws = new \wsBase();
|
||||
$oCase = new \Cases();
|
||||
|
||||
if (!isset($Fields["DEL_INIT_DATE"])) {
|
||||
$oCase->setDelInitDate($app_uid, $del_index);
|
||||
$aFields = $oCase->loadCase($app_uid, $del_index);
|
||||
}
|
||||
|
||||
$res = $ws->derivateCase($usr_uid, $app_uid, $del_index, true);
|
||||
$messageDerivateCase = null;
|
||||
|
||||
if (is_array($res)) {
|
||||
$messageDerivateCase = "<ul type='square'>";
|
||||
|
||||
if (count($res["routing"]) > 0) {
|
||||
foreach ($res["routing"] as $k => $field) {
|
||||
$messageDerivateCase = $messageDerivateCase . "<li>" . $res["routing"][$k]->taskName . " - " . $res["routing"][$k]->userName;
|
||||
}
|
||||
} else {
|
||||
$messageDerivateCase = explode("-", $res["message"]);
|
||||
$messageDerivateCase = "<li>" . $messageDerivateCase[0];
|
||||
}
|
||||
|
||||
$messageDerivateCase = $messageDerivateCase . "</ul>";
|
||||
}
|
||||
|
||||
$response = array();
|
||||
|
||||
$response["casesNumRec"] = \Library::getCasesNumRec($usr_uid);
|
||||
|
||||
if (is_array($res)) {
|
||||
$response ["message"] = "<b>" . G::LoadTranslation("ID_CASE") . " " . $app_number . "</b> Summary of Derivations: <br> " . $messageDerivateCase;
|
||||
} else {
|
||||
$response ["message"] = G::LoadTranslation("ID_CASE") . " " . $app_number . " " . $res->message;
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Put Data Generate
|
||||
*
|
||||
* @access public
|
||||
* @param string $pro_uid, Process Uid
|
||||
* @param string $tas_uid, Task Uid
|
||||
* @param string $dyn_uid, Dynaform Uid
|
||||
* @return string
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function putDataGrid ($pro_uid, $tas_uid, $dyn_uid, $usr_uid, $data)
|
||||
{
|
||||
$option = (isset($data["option"]))? $data["option"] : null;
|
||||
$response = array();
|
||||
switch ($option) {
|
||||
case "ALL":
|
||||
$dataUpdate = $data["dataUpdate"];
|
||||
$status = 1;
|
||||
try {
|
||||
$array = explode("(sep1 /)", $dataUpdate);
|
||||
for ($i = 0; $i <= count($array) - 1; $i++) {
|
||||
$arrayAux = explode("(sep2 /)", $array[$i]);
|
||||
$data = array(
|
||||
'APP_UID' => $arrayAux[0],
|
||||
$arrayAux[1] => $arrayAux[2]
|
||||
);
|
||||
self::consolidatedUpdate($dyn_uid, $data, $usr_uid);
|
||||
}
|
||||
$response["status"] = "OK";
|
||||
} catch (\Exception $e) {
|
||||
$response["message"] = $e->getMessage();
|
||||
$status = 0;
|
||||
}
|
||||
if ($status == 0) {
|
||||
$response["status"] = "ERROR";
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$dynUid = $dyn_uid;
|
||||
$data = $data['data'];
|
||||
|
||||
$status = 1;
|
||||
|
||||
try {
|
||||
self::consolidatedUpdate($dynUid, $data, $usr_uid);
|
||||
$response["status"] = "OK";
|
||||
$response["success"] = true;
|
||||
} catch (\Exception $e) {
|
||||
$response["message"] = $e->getMessage();
|
||||
$status = 0;
|
||||
}
|
||||
|
||||
if ($status == 0) {
|
||||
$response["status"] = "ERROR";
|
||||
$response["success"] = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
/**
|
||||
* Get Data Generate
|
||||
*
|
||||
* @access public
|
||||
* @param string $pro_uid, Process Uid
|
||||
* @param string $tas_uid, Task Uid
|
||||
* @param string $dyn_uid, Dynaform Uid
|
||||
* @return string
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function getDataGrid ($pro_uid, $tas_uid, $dyn_uid, $usr_uid, $start = '', $limit = '', $search = '')
|
||||
{
|
||||
$start = !empty($start) ? $start : "0";
|
||||
$limit = !empty($limit) ? $limit : "20";
|
||||
$search = !empty($search) ? $search : "";
|
||||
|
||||
$callback = isset($_REQUEST["callback"])? $_REQUEST["callback"] : "stcCallback1001";
|
||||
$dir = isset($_REQUEST["dir"])? $_REQUEST["dir"] : "DESC";
|
||||
$sort = isset($_REQUEST["sort"])? $_REQUEST["sort"] : "";
|
||||
$filter = isset($_REQUEST["filter"])? $_REQUEST["filter"] : "";
|
||||
$user = isset($_REQUEST["user"])? $_REQUEST["user"] : "";
|
||||
$status = isset($_REQUEST["status"])? strtoupper($_REQUEST["status"]) : "";
|
||||
$action = isset($_GET["action"])? $_GET["action"] : (isset($_REQUEST["action"])? $_REQUEST["action"] : "todo");
|
||||
$type = isset($_GET["type"])? $_GET["type"] : (isset($_REQUEST["type"])? $_REQUEST["type"] : "extjs");
|
||||
$user = isset($_REQUEST["user"])? $_REQUEST["user"] : "";
|
||||
$dateFrom = isset($_REQUEST["dateFrom"])? substr($_REQUEST["dateFrom"], 0, 10) : "";
|
||||
$dateTo = isset($_REQUEST["dateTo"])? substr($_REQUEST["dateTo"], 0, 10) : "";
|
||||
|
||||
$rowUid = isset($_REQUEST["rowUid"])? $_REQUEST["rowUid"] : "";
|
||||
$dropdownList = isset($_REQUEST ["dropList"])? G::json_decode($_REQUEST ["dropList"]) : array();
|
||||
|
||||
try {
|
||||
G::LoadClass("pmFunctions");
|
||||
G::LoadClass("BasePeer");
|
||||
G::LoadClass("configuration");
|
||||
G::LoadClass("case");
|
||||
G::LoadClass("reportTables");
|
||||
|
||||
$response = array();
|
||||
$searchFields = array();
|
||||
//
|
||||
$query = "SELECT REP_TAB_UID
|
||||
FROM CASE_CONSOLIDATED
|
||||
WHERE TAS_UID = '" . $tas_uid . "'";
|
||||
$caseConsolidated = executeQuery($query);
|
||||
|
||||
$tableUid = null;
|
||||
$tableName = null;
|
||||
|
||||
foreach ($caseConsolidated as $item) {
|
||||
$criteria = new Criteria();
|
||||
$criteria->addSelectColumn(ReportTablePeer::REP_TAB_NAME);
|
||||
$criteria->add(ReportTablePeer::REP_TAB_UID,$item["REP_TAB_UID"]);
|
||||
|
||||
$result = ReportTablePeer::doSelectRS($criteria);
|
||||
$result->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
if ($result->next()) {
|
||||
$row = $result->getRow();
|
||||
|
||||
$tableUid = $item["REP_TAB_UID"];
|
||||
$tableName = $row["REP_TAB_NAME"];
|
||||
} else {
|
||||
throw (new Exception("Not found the report table"));
|
||||
}
|
||||
}
|
||||
|
||||
$className = $tableName;
|
||||
|
||||
if (!class_exists($className)) {
|
||||
require_once (PATH_DB . SYS_SYS . PATH_SEP . "classes" . PATH_SEP . $className . ".php");
|
||||
}
|
||||
|
||||
$oCriteria = new Criteria("workflow");
|
||||
|
||||
$oCriteria->addSelectColumn("*");
|
||||
$oCriteria->addSelectColumn($tableName . ".APP_UID");
|
||||
|
||||
$oCriteria->addJoin($tableName . ".APP_UID", AppCacheViewPeer::APP_UID, Criteria::LEFT_JOIN);
|
||||
|
||||
$oCriteria->add(AppCacheViewPeer::DEL_THREAD_STATUS, "OPEN");
|
||||
$oCriteria->add(AppCacheViewPeer::TAS_UID, $tas_uid);
|
||||
$oCriteria->add(AppCacheViewPeer::USR_UID, $usr_uid);
|
||||
$oCriteria->add(AppCacheViewPeer::APP_STATUS, "TO_DO");
|
||||
|
||||
if ($search != "") {
|
||||
$filename = $pro_uid . PATH_SEP . $dyn_uid . ".xml";
|
||||
|
||||
if (!class_exists('Smarty')) {
|
||||
require_once(PATH_THIRDPARTY . 'smarty' . PATH_SEP . 'libs' . PATH_SEP . 'Smarty.class.php');
|
||||
}
|
||||
$G_FORM = new \xmlform();
|
||||
$G_FORM->home = PATH_DYNAFORM;
|
||||
$G_FORM->parseFile($filename, SYS_LANG, true);
|
||||
|
||||
foreach ($G_FORM->fields as $key => $val) {
|
||||
switch ($val->type) {
|
||||
case "text":
|
||||
case "textarea":
|
||||
case "currency":
|
||||
case "percentage":
|
||||
$searchFields[] = $val->name;
|
||||
$dataType[] = $val->type;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$oNewCriteria = new Criteria("workflow");
|
||||
$oTmpCriteria = null;
|
||||
$sw = 0;
|
||||
|
||||
foreach ($searchFields as $index => $value) {
|
||||
$value = strtoupper($value);
|
||||
eval("\$field = " . $tableName . "Peer::" . $value . ";");
|
||||
|
||||
if ($sw == 0) {
|
||||
if ($dataType[$index] == 'currency' || $dataType[$index] == 'percentage') {
|
||||
if ( is_numeric($search) || is_float($search) ) {
|
||||
$oTmpCriteria = $oNewCriteria->getNewCriterion($field, $search);
|
||||
}
|
||||
} else {
|
||||
$oTmpCriteria = $oNewCriteria->getNewCriterion($field, "%" . $search . "%", Criteria::LIKE);
|
||||
}
|
||||
} else {
|
||||
if ($dataType[$index] == 'currency' || $dataType[$index] == 'percentage') {
|
||||
if ( is_numeric($search) || is_float($search) ) {
|
||||
$oTmpCriteria = $oNewCriteria->getNewCriterion($field, $search)->addOr($oTmpCriteria);
|
||||
}
|
||||
} else {
|
||||
$oTmpCriteria = $oNewCriteria->getNewCriterion($field, "%" . $search . "%", Criteria::LIKE)->addOr($oTmpCriteria);
|
||||
}
|
||||
}
|
||||
|
||||
$sw = 1;
|
||||
}
|
||||
|
||||
if ($oTmpCriteria != null) {
|
||||
$oCriteria->add(
|
||||
$oCriteria->getNewCriterion(AppCacheViewPeer::APP_NUMBER, $search, Criteria::LIKE)->addOr($oTmpCriteria)
|
||||
);
|
||||
} else {
|
||||
$oCriteria->add($oCriteria->getNewCriterion(AppCacheViewPeer::APP_NUMBER, $search, Criteria::LIKE));
|
||||
}
|
||||
}
|
||||
|
||||
if ($sort != "") {
|
||||
$reportTable = new ReportTables();
|
||||
$arrayReportTableVar = $reportTable->getTableVars($tableUid);
|
||||
|
||||
if (in_array($sort, $arrayReportTableVar)) {
|
||||
$sort = strtoupper($sort);
|
||||
eval("\$field = " . $tableName . "Peer::" . $sort . ";");
|
||||
} else {
|
||||
eval("\$field = AppCacheViewPeer::" . $sort . ";");
|
||||
}
|
||||
|
||||
if ($dir == "ASC") {
|
||||
$oCriteria->addAscendingOrderByColumn($field);
|
||||
} else {
|
||||
$oCriteria->addDescendingOrderByColumn($field);
|
||||
}
|
||||
} else {
|
||||
$oCriteria->addDescendingOrderByColumn(AppCacheViewPeer::APP_NUMBER);
|
||||
}
|
||||
|
||||
//pagination pagination attributes
|
||||
$oCriteria->setLimit($limit);
|
||||
$oCriteria->setOffset($start);
|
||||
//end of pagination attributes
|
||||
|
||||
$oDataset = AppCacheViewPeer::doSelectRS($oCriteria);
|
||||
//eval('$oDataset = '.$className.'Peer::doSelectRS($oCriteria);');
|
||||
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
//$oDataset->next();
|
||||
|
||||
$aTaskConsolidated = array();
|
||||
|
||||
while ($oDataset->next()) {
|
||||
$aRow = $oDataset->getRow();
|
||||
|
||||
foreach ($aRow as $datakey => $dataField) {
|
||||
foreach ($dropdownList as $tmpField) {
|
||||
if ($tmpField == $datakey) {
|
||||
$appUid = $aRow["APP_UID"];
|
||||
$fieldVal = $aRow[$tmpField];
|
||||
$aRow[$tmpField] = self::getDropdownLabel($appUid, $pro_uid, $dyn_uid, $tmpField, $fieldVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$aTaskConsolidated[] = $aRow;
|
||||
}
|
||||
|
||||
foreach ($aTaskConsolidated as $key => $val) {
|
||||
foreach ($val as $iKey => $iVal) {
|
||||
if (self::checkValidDate($iVal)) {
|
||||
$val[$iKey] = str_replace("-", "/", $val[$iKey]);
|
||||
}
|
||||
}
|
||||
$response["data"][] = $val;
|
||||
}
|
||||
|
||||
$query = "SELECT COUNT(APP_CACHE_VIEW.TAS_UID) AS QTY
|
||||
FROM CASE_CONSOLIDATED
|
||||
LEFT JOIN CONTENT ON (CASE_CONSOLIDATED.TAS_UID = CONTENT.CON_ID)
|
||||
LEFT JOIN APP_CACHE_VIEW ON (CASE_CONSOLIDATED.TAS_UID = APP_CACHE_VIEW.TAS_UID)
|
||||
LEFT JOIN TASK ON (CASE_CONSOLIDATED.TAS_UID = TASK.TAS_UID)
|
||||
WHERE CONTENT.CON_CATEGORY = 'TAS_TITLE' AND
|
||||
CONTENT.CON_LANG = 'en' AND
|
||||
APP_CACHE_VIEW.DEL_THREAD_STATUS = 'OPEN' AND
|
||||
USR_UID = '" . $usr_uid . "' AND
|
||||
APP_CACHE_VIEW.TAS_UID = '" . $tas_uid . "'";
|
||||
$count = executeQuery($query);
|
||||
|
||||
$totalCount = 0;
|
||||
foreach ($count as $item) {
|
||||
$totalCount = $totalCount + $item["QTY"];
|
||||
}
|
||||
|
||||
$response["totalCount"] = $totalCount;
|
||||
echo G::json_encode($response);
|
||||
} catch (Exception $e) {
|
||||
$msg = array("error" => $e->getMessage());
|
||||
echo G::json_encode($msg);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Data Generate
|
||||
*
|
||||
* @access public
|
||||
* @param string $pro_uid, Process Uid
|
||||
* @param string $tas_uid, Task Uid
|
||||
* @param string $dyn_uid, Dynaform Uid
|
||||
* @return string
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function getDataGenerate($pro_uid, $tas_uid, $dyn_uid)
|
||||
{
|
||||
G::LoadClass ('case');
|
||||
G::LoadClass ('pmFunctions');
|
||||
G::LoadClass ("configuration");
|
||||
$hasTextArea = false;
|
||||
|
||||
$conf = new \Configurations();
|
||||
$generalConfCasesList = $conf->getConfiguration("ENVIRONMENT_SETTINGS", "");
|
||||
if (isset($generalConfCasesList["casesListDateFormat"]) && !empty($generalConfCasesList["casesListDateFormat"])) {
|
||||
$dateFormat = $generalConfCasesList["casesListDateFormat"];
|
||||
} else {
|
||||
$dateFormat = "Y/m/d";
|
||||
}
|
||||
|
||||
$filename = $pro_uid . PATH_SEP . $dyn_uid . ".xml";
|
||||
|
||||
if (!class_exists('Smarty')) {
|
||||
require_once(PATH_THIRDPARTY . 'smarty' . PATH_SEP . 'libs' . PATH_SEP . 'Smarty.class.php');
|
||||
}
|
||||
$xmlfrm = new \XmlForm();
|
||||
$xmlfrm->home = PATH_DYNAFORM;
|
||||
$xmlfrm->parseFile($filename, SYS_LANG, true);
|
||||
|
||||
$caseColumns = array();
|
||||
$caseReaderFields = array();
|
||||
|
||||
$dropList = array();
|
||||
$comboBoxYesNoList = array();
|
||||
|
||||
$caseColumns[] = array("header" => "APP_UID", "dataIndex" => "APP_UID", "width" => 100, "hidden" => true, "hideable" => false);
|
||||
$caseColumns[] = array("header" => "#", "dataIndex" => "APP_NUMBER", "width" => 40, "sortable" => true);
|
||||
$caseColumns[] = array("header" => G::LoadTranslation("ID_TITLE"), "dataIndex" => "APP_TITLE", "width" => 180, "renderer" => "renderTitle", "sortable" => true);
|
||||
$caseColumns[] = array("header" => G::LoadTranslation("ID_SUMMARY"), "width" => 60, "renderer" => "renderSummary", "align" => "center");
|
||||
$caseColumns[] = array("header" => "DEL_INDEX", "dataIndex" => "DEL_INDEX", "width" => 100, "hidden" => true, "hideable" => false);
|
||||
|
||||
$caseReaderFields[] = array("name" => "APP_UID");
|
||||
$caseReaderFields[] = array("name" => "APP_NUMBER");
|
||||
$caseReaderFields[] = array("name" => "APP_TITLE");
|
||||
$caseReaderFields[] = array("name" => "DEL_INDEX");
|
||||
|
||||
//$caseColumns[] = array("header" => "FLAG", "dataIndex" => "FLAG", "width" => 55, "xtype"=>"checkcolumn");
|
||||
//$caseReaderFields[] = array("name" => "FLAG", "type"=>"bool");
|
||||
|
||||
foreach ($xmlfrm->fields as $index => $value) {
|
||||
$field = $value;
|
||||
|
||||
$editor = null;
|
||||
$renderer = null;
|
||||
|
||||
$readOnly = (isset($field->readOnly))? $field->readOnly : null;
|
||||
$required = (isset($field->required))? $field->required : null;
|
||||
$validate = (isset($field->validate))? strtolower($field->validate) : null;
|
||||
|
||||
$fieldReadOnly = ($readOnly . "" == "1")? "readOnly: true," : null;
|
||||
$fieldRequired = ($required . "" == "1")? "allowBlank: false," : null;
|
||||
$fieldValidate = ($validate == "alpha" || $validate == "alphanum" || $validate == "email" || $validate == "int" || $validate == "real")? "vtype: \"$validate\"," : null;
|
||||
|
||||
$fieldLabel = (($fieldRequired != null)? "<span style='color: red;'>*</span> ": null) . $field->label;
|
||||
$fieldDisabled = ($field->mode != "edit")? "true" : "false";
|
||||
|
||||
switch ($field->type) {
|
||||
case "dropdown":
|
||||
$dropList[] = $field->name;
|
||||
$align = "left";
|
||||
|
||||
$editor = "* new Ext.form.ComboBox({
|
||||
id: \"cbo" . $field->name . "_" . $pro_uid . "\",
|
||||
|
||||
valueField: 'value',
|
||||
displayField: 'text',
|
||||
|
||||
/*store: comboStore,*/
|
||||
store: new Ext.data.JsonStore({
|
||||
storeId: \"store" . $field->name . "_" . $pro_uid . "\",
|
||||
proxy: new Ext.data.HttpProxy({
|
||||
url: 'proxyDataCombobox'
|
||||
}),
|
||||
root: 'records',
|
||||
fields: [{name: 'value'},
|
||||
{name: 'text'}
|
||||
]
|
||||
}),
|
||||
|
||||
triggerAction: 'all',
|
||||
mode: 'local',
|
||||
editable: false,
|
||||
disabled: $fieldDisabled,
|
||||
lazyRender: false,
|
||||
|
||||
$fieldReadOnly
|
||||
$fieldRequired
|
||||
$fieldValidate
|
||||
cls: \"\"
|
||||
}) *";
|
||||
|
||||
$width = $field->colWidth;
|
||||
|
||||
$caseColumns[] = array("xtype" => "combocolumn", "gridId" => "gridId", "header" => $fieldLabel, "dataIndex" => $field->name, "width" => (int)($width), "align" => $align, "editor" => $editor, "frame" => "true", "clicksToEdit" => "1");
|
||||
$caseReaderFields[] = array("name" => $field->name);
|
||||
break;
|
||||
case "date":
|
||||
//minValue: '01/01/06',
|
||||
//disabledDays: [0, 6],
|
||||
//disabledDaysText: 'Plants are not available on the weekends'
|
||||
|
||||
$align = "center";
|
||||
$size = 100;
|
||||
|
||||
if (isset($field->size)) {
|
||||
$size = $field->size * 10;
|
||||
}
|
||||
|
||||
$width = $size;
|
||||
|
||||
$editor = "* new Ext.form.DateField({
|
||||
format: \"$dateFormat\",
|
||||
|
||||
$fieldReadOnly
|
||||
$fieldRequired
|
||||
$fieldValidate
|
||||
cls: \"\"
|
||||
}) *";
|
||||
|
||||
//$renderer = "* formatDate *";
|
||||
$renderer = "* function (value){
|
||||
return Ext.isDate(value)? value.dateFormat('{$dateFormat}') : value;
|
||||
} *";
|
||||
|
||||
if ($field->mode != "edit") {
|
||||
$editor = null;
|
||||
}
|
||||
|
||||
$caseColumns[] = array("header" => $fieldLabel, "dataIndex" => $field->name, "width" => (int)($width), "editor" => $editor, "renderer" => $renderer, "frame" => true, "clicksToEdit" => 1, "sortable" => true);
|
||||
$caseReaderFields[] = array("name" => $field->name, "type" => "date");
|
||||
break;
|
||||
case "currency":
|
||||
//align: 'right',
|
||||
//renderer: 'usMoney',
|
||||
//allowBlank: false,
|
||||
//allowNegative: false,
|
||||
$align = 'right';
|
||||
$size = 100;
|
||||
|
||||
if (isset($field->size)) {
|
||||
$size = $field->size * 10;
|
||||
}
|
||||
|
||||
$width = $size;
|
||||
|
||||
$editor = "* new Ext.form.NumberField({
|
||||
maxValue: 1000000,
|
||||
allowDecimals: true,
|
||||
allowNegative: true,
|
||||
|
||||
$fieldReadOnly
|
||||
$fieldRequired
|
||||
$fieldValidate
|
||||
cls: \"\"
|
||||
}) *";
|
||||
|
||||
if ($field->mode != "edit") {
|
||||
$editor = null;
|
||||
}
|
||||
|
||||
$caseColumns[] = array("header" => $fieldLabel, "dataIndex" => $field->name, "width" => (int)($width), "align" => $align, "editor" => $editor, "frame" => true, "clicksToEdit" => 1, "sortable" => true);
|
||||
$caseReaderFields[] = array("name" => $field->name);
|
||||
break;
|
||||
case "percentage":
|
||||
$align = 'right';
|
||||
$size = 100;
|
||||
|
||||
if (isset($field->size)) {
|
||||
$size = $field->size * 10;
|
||||
}
|
||||
|
||||
$width = $size;
|
||||
|
||||
$editor = "* new Ext.form.NumberField({
|
||||
maxValue: 100,
|
||||
allowDecimals: true,
|
||||
|
||||
$fieldReadOnly
|
||||
$fieldRequired
|
||||
$fieldValidate
|
||||
cls: \"\"
|
||||
}) *";
|
||||
|
||||
$renderer = "* function (value){
|
||||
return (value + ' %');
|
||||
} *";
|
||||
|
||||
if ($field->mode != "edit") {
|
||||
$editor = null;
|
||||
}
|
||||
|
||||
$caseColumns[] = array("header" => $fieldLabel, "dataIndex" => $field->name, "width" => (int)($width), "align" => $align, "editor" => $editor, "renderer" => $renderer, "frame" => true, "clicksToEdit" => 1, "sortable" => true);
|
||||
$caseReaderFields[] = array("name" => $field->name);
|
||||
break;
|
||||
case "textarea":
|
||||
$align = 'left';
|
||||
$size = 200;
|
||||
|
||||
if (isset($field->size)) {
|
||||
$size = $field->size * 15;
|
||||
}
|
||||
|
||||
$width = $size;
|
||||
|
||||
$editor = "* new Ext.form.TextArea({
|
||||
growMin: 60,
|
||||
growMax: 1000,
|
||||
grow: true,
|
||||
autoHeight: true,
|
||||
disabled: $fieldDisabled,
|
||||
enterIsSpecial: false,
|
||||
preventScrollbars: false,
|
||||
|
||||
$fieldReadOnly
|
||||
$fieldRequired
|
||||
$fieldValidate
|
||||
cls: \"\"
|
||||
}) *";
|
||||
|
||||
$renderer = "* function (value) { return (value); } *";
|
||||
|
||||
$caseColumns[] = array("header" => $fieldLabel, "dataIndex" => $field->name, "width" => (int)($width), "align" => $align, "editor" => $editor, "renderer" => $renderer, "frame" => true, "clicksToEdit" => 1, "sortable" => true);
|
||||
$caseReaderFields[] = array("name" => $field->name);
|
||||
|
||||
$hasTextArea = true;
|
||||
break;
|
||||
case "link":
|
||||
$align = 'center';
|
||||
$size = 100;
|
||||
|
||||
if (isset($field->size)) {
|
||||
$size = $field->size * 10;
|
||||
}
|
||||
|
||||
$width = $size;
|
||||
$editor = null;
|
||||
|
||||
$renderer = "* function (value)
|
||||
{
|
||||
return linkRenderer(value);
|
||||
} *";
|
||||
|
||||
$caseColumns[] = array("header" => $fieldLabel, "dataIndex" => $field->name, "width" => (int)($width), "align" => $align, "editor" => $editor, "renderer" => $renderer, "frame" => true, "hidden" => false, "hideable" => false, "clicksToEdit" => 1, "sortable" => true);
|
||||
$caseReaderFields[] = array("name" => $field->name);
|
||||
break;
|
||||
case "hidden":
|
||||
$align = 'left';
|
||||
$size = 100;
|
||||
|
||||
if (isset($field->size)) {
|
||||
$size = $field->size * 10;
|
||||
}
|
||||
|
||||
$width = $size;
|
||||
|
||||
$editor = "* new Ext.form.TextField({ allowBlank: false }) *";
|
||||
|
||||
$caseColumns[] = array("header" => $fieldLabel, "dataIndex" => $field->name, "width" => (int)$width, "align" => $align, "editor" => $editor, "frame" => "true", "hidden" => "true", "hideable" => false, "clicksToEdit" => "1");
|
||||
$caseReaderFields[] = array("name" => $field->name);
|
||||
break;
|
||||
case "yesno":
|
||||
$align = "right";
|
||||
$size = 100;
|
||||
|
||||
if (isset($field->size)) {
|
||||
$size = $field->size * 10;
|
||||
}
|
||||
|
||||
$width = $size;
|
||||
$dropList[] = $field->name;
|
||||
$comboBoxYesNoList[] = $field->name;
|
||||
|
||||
$editor="* new Ext.form.ComboBox({
|
||||
id: \"cbo" . $field->name . "_" . $pro_uid . "\",
|
||||
|
||||
valueField: 'value',
|
||||
displayField: 'text',
|
||||
|
||||
store: new Ext.data.ArrayStore({
|
||||
storeId: \"store" . $field->name . "_" . $pro_uid . "\",
|
||||
fields: ['value', 'text'],
|
||||
data: [[1, 'YES'],
|
||||
[0, 'NO']
|
||||
]
|
||||
}),
|
||||
|
||||
typeAhead: true,
|
||||
|
||||
triggerAction: 'all',
|
||||
mode: 'local',
|
||||
editable: false,
|
||||
disabled : $fieldDisabled,
|
||||
lazyRender: true,
|
||||
|
||||
$fieldReadOnly
|
||||
$fieldRequired
|
||||
$fieldValidate
|
||||
cls: \"\"
|
||||
}) *";
|
||||
|
||||
/*
|
||||
$renderer = "* function(value) {
|
||||
idx = this.editor.store.find(this.editor.valueField, value);
|
||||
if (currentFieldEdited == '{$field->name}') {
|
||||
if (rec = this.editor.store.getAt(idx)) {
|
||||
rowLabels['{$field->name}'] = rec.get(this.editor.displayField);
|
||||
return rec.get(this.editor.displayField);
|
||||
}
|
||||
else {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (typeof(currentFieldEdited) == 'undefined') {
|
||||
return value;
|
||||
}
|
||||
else {
|
||||
return (rowLabels['{$field->name}']);
|
||||
}
|
||||
}
|
||||
} *";
|
||||
*/
|
||||
|
||||
//$caseColumns[] = array('header' => $fieldLabel, 'dataIndex' => $field->name, 'width' => (int)$width, 'align' => $align, 'editor' => $editor, 'renderer' => $renderer, 'frame' => 'true', 'clicksToEdit' => '1');
|
||||
$caseColumns[] = array("xtype" => "combocolumn", "gridId" => "gridId", "header" => $fieldLabel, "dataIndex" => $field->name, "width" => (int)($width), "align" => $align, "editor" => $editor, "frame" => "true", "clicksToEdit" => "1");
|
||||
$caseReaderFields[] = array("name" => $field->name);
|
||||
break;
|
||||
case "text":
|
||||
default:
|
||||
$align = "left";
|
||||
$size = 100;
|
||||
|
||||
if (isset($field->size)) {
|
||||
$size = $field->size * 10;
|
||||
}
|
||||
|
||||
$width = $size;
|
||||
$editor = "* new Ext.form.TextField({ $fieldReadOnly $fieldRequired $fieldValidate cls: \"\"}) *";
|
||||
|
||||
if ($field->mode != "edit") {
|
||||
$editor = null;
|
||||
}
|
||||
|
||||
$caseColumns[] = array("header" => $fieldLabel, "dataIndex" => $field->name, "width" => (int)($width), "align" => $align, "editor" => $editor, "frame" => true, "clicksToEdit" => 1, "sortable" => true);
|
||||
$caseReaderFields[] = array("name" => $field->name);
|
||||
}
|
||||
}
|
||||
|
||||
@unlink(PATH_C . "ws" . PATH_SEP . SYS_SYS . PATH_SEP . "xmlform" . PATH_SEP . $pro_uid . PATH_SEP . $dyn_uid . "." . SYS_LANG);
|
||||
|
||||
|
||||
|
||||
$array ['columnModel'] = $caseColumns;
|
||||
$array ['readerFields'] = $caseReaderFields;
|
||||
$array ["dropList"] = $dropList;
|
||||
$array ["comboBoxYesNoList"] = $comboBoxYesNoList;
|
||||
$array ['hasTextArea'] = $hasTextArea;
|
||||
|
||||
$temp = G::json_encode($array);
|
||||
|
||||
//$temp = str_replace("***","'",$temp);
|
||||
$temp = str_replace('"*','', $temp);
|
||||
$temp = str_replace('*"','', $temp);
|
||||
$temp = str_replace('\t','', $temp);
|
||||
$temp = str_replace('\n','', $temp);
|
||||
$temp = str_replace('\/','/', $temp);
|
||||
$temp = str_replace('\"','"', $temp);
|
||||
$temp = str_replace('"checkcolumn"','\'checkcolumn\'',$temp);
|
||||
|
||||
print $temp;
|
||||
die();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get Dropdown Label
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function getDropdownLabel($appUid, $pro_uid, $dyn_uid, $fieldName, $fieldVal)
|
||||
{
|
||||
$oCase = new Cases();
|
||||
$filename = $pro_uid . PATH_SEP . $dyn_uid . ".xml";
|
||||
|
||||
$G_FORM = new xmlform();
|
||||
$G_FORM->home = PATH_DYNAFORM;
|
||||
$G_FORM->parseFile($filename, SYS_LANG, true);
|
||||
|
||||
$aFields = $oCase->loadCase($appUid);
|
||||
|
||||
$arrayTmp = array();
|
||||
$array = array();
|
||||
$sqlQuery = null;
|
||||
|
||||
foreach ($G_FORM->fields as $key => $val) {
|
||||
if ($fieldName == $val->name) {
|
||||
if ($G_FORM->fields[$key]->sql != "") {
|
||||
$sqlQuery = G::replaceDataField($G_FORM->fields[$key]->sql, $aFields ["APP_DATA"]);
|
||||
}
|
||||
if ((is_array($val->options)) && (!empty($val->options))) {
|
||||
foreach ($val->options as $key1 => $val1) {
|
||||
$array[] = array("id" => $key1, "value" => $val1);
|
||||
}
|
||||
}
|
||||
if ($val->type == "yesno") {
|
||||
$array[] = array("id" => 1, "value" => strtoupper(G::LoadTranslation("ID_YES")));
|
||||
$array[] = array("id" => 0, "value" => strtoupper(G::LoadTranslation("ID_NO")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($sqlQuery != null) {
|
||||
$aResult = executeQuery($sqlQuery);
|
||||
if ($aResult == false) {
|
||||
$aResult = array();
|
||||
}
|
||||
} else {
|
||||
$aResult = array();
|
||||
}
|
||||
|
||||
foreach ($aResult as $field) {
|
||||
$i = 0;
|
||||
foreach ($field as $key => $value) {
|
||||
if ($i == 0) {
|
||||
$arrayTmp["id"] = $value;
|
||||
if (count($field) == 1) {
|
||||
$arrayTmp["value"] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
if ($i == 1) {
|
||||
$arrayTmp["value"] = $value;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$array[] = $arrayTmp;
|
||||
}
|
||||
|
||||
foreach ($array as $newKey => $newValue) {
|
||||
if ($newValue["id"] == $fieldVal) {
|
||||
return $newValue["value"];
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check Valid Date
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function checkValidDate($field)
|
||||
{
|
||||
if (($timestamp = strtotime($field)) === false || is_double($field) || is_float($field) || is_bool($field) || is_int($field)) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* consolidatedUpdate
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
function consolidatedUpdate($dynaformUid, $dataUpdate, $usr_uid)
|
||||
{
|
||||
G::LoadClass("case");
|
||||
G::LoadClass("pmFunctions");
|
||||
|
||||
$delIndex = 1;
|
||||
$oCase = new \Cases();
|
||||
|
||||
$array = array();
|
||||
$array["form"] = $dataUpdate;
|
||||
|
||||
$appUid = $array["form"]["APP_UID"];
|
||||
|
||||
$fields = $oCase->loadCase($appUid);
|
||||
|
||||
if (!isset($fields["DEL_INIT_DATE"])) {
|
||||
$oCase->setDelInitDate($appUid, $delIndex);
|
||||
//$aFields = $oCase->loadCase($appUid, $delIndex);
|
||||
$fields = $oCase->loadCase($appUid, $delIndex);
|
||||
}
|
||||
|
||||
$auxAppDataApplication = $fields["APP_DATA"]["APPLICATION"];
|
||||
$auxAppDataProcess = $fields["APP_DATA"]["PROCESS"];
|
||||
$auxAppDataTask = $fields["APP_DATA"]["TASK"];
|
||||
$auxAppDataIndex = $fields["APP_DATA"]["INDEX"];
|
||||
|
||||
foreach ($array["form"] as $key => $value) {
|
||||
$array["form"][$key] = (string)$array["form"][$key];
|
||||
}
|
||||
$_POST['form'] = $array["form"];
|
||||
if (!class_exists('Smarty')) {
|
||||
require_once(PATH_THIRDPARTY . 'smarty' . PATH_SEP . 'libs' . PATH_SEP . 'Smarty.class.php');
|
||||
}
|
||||
$oForm = new \Form( $auxAppDataProcess . "/" . $dynaformUid , PATH_DYNAFORM );
|
||||
$oForm->validatePost();
|
||||
$array["form"] = $_POST['form'];
|
||||
|
||||
$fields["APP_DATA"] = array_merge($fields["APP_DATA"], G::getSystemConstants());
|
||||
$fields["APP_DATA"] = array_merge($fields["APP_DATA"], $array["form"]);
|
||||
|
||||
$fields["APP_DATA"]["APPLICATION"] = $auxAppDataApplication;
|
||||
$fields["APP_DATA"]["PROCESS"] = $auxAppDataProcess;
|
||||
$fields["APP_DATA"]["TASK"] = $auxAppDataTask;
|
||||
$fields["APP_DATA"]["INDEX"] = $auxAppDataIndex;
|
||||
|
||||
$aData = array();
|
||||
$aData["APP_NUMBER"] = $fields["APP_NUMBER"];
|
||||
$aData["APP_PROC_STATUS"] = $fields["APP_PROC_STATUS"];
|
||||
$aData["APP_DATA"] = $fields["APP_DATA"];
|
||||
$aData["DEL_INDEX"] = $delIndex;
|
||||
$aData["TAS_UID"] = $fields["APP_DATA"]["TASK"];
|
||||
$aData["CURRENT_DYNAFORM"] = $dynaformUid;
|
||||
$aData["USER_UID"] = $usr_uid;
|
||||
$aData["APP_STATUS"] = $fields["APP_STATUS"];
|
||||
$aData["PRO_UID"] = $fields["APP_DATA"]["PROCESS"];
|
||||
|
||||
$oCase->updateCase($appUid, $aData);
|
||||
}
|
||||
}
|
||||
156
workflow/engine/src/ProcessMaker/Services/Api/Consolidated.php
Normal file
156
workflow/engine/src/ProcessMaker/Services/Api/Consolidated.php
Normal file
@@ -0,0 +1,156 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
|
||||
/**
|
||||
* Consolidated Api Controller
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
class Consolidated extends Api
|
||||
{
|
||||
/**
|
||||
* Get Consolidated
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET /:tas_uid
|
||||
*/
|
||||
public function doGet($tas_uid)
|
||||
{
|
||||
try {
|
||||
$consolidated = new \ProcessMaker\BusinessModel\Consolidated();
|
||||
return $consolidated->get($tas_uid);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Post Consolidated
|
||||
*
|
||||
* @param array $request_data
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
*/
|
||||
public function doPost($request_data)
|
||||
{
|
||||
try {
|
||||
$consolidated = new \ProcessMaker\BusinessModel\Consolidated();
|
||||
return $consolidated->post($request_data);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get for Generate Consolidated
|
||||
*
|
||||
* @param string $pro_uid {@min 1} {@max 32}
|
||||
* @param string $tas_uid {@min 1} {@max 32}
|
||||
* @param string $dyn_uid {@min 1} {@max 32}
|
||||
* @return string
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET /generate/:pro_uid/:tas_uid/:dyn_uid
|
||||
*/
|
||||
public function doGetGenerateConsolidated($pro_uid, $tas_uid, $dyn_uid)
|
||||
{
|
||||
try {
|
||||
$consolidated = new \ProcessMaker\BusinessModel\Consolidated();
|
||||
return $consolidated->getDataGenerate($pro_uid, $tas_uid, $dyn_uid);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Cases Consolidated
|
||||
*
|
||||
* @param string $tas_uid {@min 1} {@max 32}
|
||||
* @param string $dyn_uid {@min 1} {@max 32}
|
||||
* @param string $pro_uid {@min 1} {@max 32}
|
||||
* @param string $start {@from path}
|
||||
* @param string $limit {@from path}
|
||||
* @param string $search {@from path}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET /cases/:tas_uid/:dyn_uid/:pro_uid
|
||||
*/
|
||||
public function doGetCasesConsolidated($tas_uid, $dyn_uid, $pro_uid, $start = '', $limit = '', $search = '')
|
||||
{
|
||||
try {
|
||||
$usr_uid = $this->getUserId();
|
||||
$consolidated = new \ProcessMaker\BusinessModel\Consolidated();
|
||||
$consolidated->getDataGrid($tas_uid, $dyn_uid, $pro_uid, $usr_uid, $start, $limit, $search);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Cases Consolidated
|
||||
*
|
||||
* @param string $tas_uid {@min 1} {@max 32}
|
||||
* @param string $dyn_uid {@min 1} {@max 32}
|
||||
* @param string $pro_uid {@min 1} {@max 32}
|
||||
* @param array $request_data
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url PUT /cases/:tas_uid/:dyn_uid/:pro_uid
|
||||
*/
|
||||
public function doPutCasesConsolidated($tas_uid, $dyn_uid, $pro_uid, $request_data)
|
||||
{
|
||||
try {
|
||||
$usr_uid = $this->getUserId();
|
||||
$consolidated = new \ProcessMaker\BusinessModel\Consolidated();
|
||||
return $consolidated->putDataGrid($tas_uid, $dyn_uid, $pro_uid, $usr_uid, $request_data);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Post Derivate
|
||||
*
|
||||
* @param string $app_uid {@min 1} {@max 32}
|
||||
* @param string $app_number
|
||||
* @param string $del_index
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url POST /derivate/:app_uid/:app_number/:del_index
|
||||
*/
|
||||
public function doPostDerivate($app_uid, $app_number, $del_index)
|
||||
{
|
||||
try {
|
||||
$usr_uid = $this->getUserId();
|
||||
$consolidated = new \ProcessMaker\BusinessModel\Consolidated();
|
||||
return $consolidated->postDerivate($app_uid, $app_number, $del_index, $usr_uid);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -99,4 +99,7 @@ debug = 1
|
||||
email = "ProcessMaker\Services\Api\EmailServer"
|
||||
|
||||
[alias: light]
|
||||
light = "ProcessMaker\Services\Api\Light"
|
||||
light = "ProcessMaker\Services\Api\Light"
|
||||
|
||||
[alias: consolidated]
|
||||
list = "ProcessMaker\Services\Api\Consolidated"
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
<div id="toolTipTab" style="display: none; position: absolute; z-index: 5000; border: 1px solid #A6A6A6; padding: 0.20em; background: #F1F1F1; color: #3E3E3E; font: normal 12px helvetica, arial, verdana, sans-serif;"></div>
|
||||
<div id="cases-grid"></div>
|
||||
|
||||
1100
workflow/engine/templates/cases/casesListConsolidated.js
Normal file
1100
workflow/engine/templates/cases/casesListConsolidated.js
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user