Solving conflicts updating with last changes in develop branch

This commit is contained in:
Julio Cesar Laura Avendaño
2020-12-03 20:19:49 +00:00
66 changed files with 3721 additions and 1224 deletions

View File

@@ -314,6 +314,8 @@ class AppFolder extends BaseAppFolder
$oCriteria->addSelectColumn( AppDocumentPeer::APP_DOC_STATUS_DATE);
$oCriteria->addSelectColumn( AppDocumentPeer::APP_DOC_FIELDNAME);
$oCriteria->addSelectColumn(AppDocumentPeer::APP_DOC_DRIVE_DOWNLOAD);
$oCriteria->addJoin(AppDocumentPeer::APP_UID, ApplicationPeer::APP_UID);
$oCriteria->add(ApplicationPeer::APP_NUMBER, 0, Criteria::GREATER_THAN);
if ((is_array( $docIdFilter )) && (count( $docIdFilter ) > 0)) {
//Search by App Doc UID no matter what Folder it is

View File

@@ -16,27 +16,34 @@ require_once 'classes/model/om/BaseAppSequence.php';
*/
class AppSequence extends BaseAppSequence {
const APP_TYPE_NORMAL = 'NORMAL';
const APP_TYPE_WEB_ENTRY = 'WEB_ENTRY';
/**
* Get an Set new sequence number
*
* @param string $sequenceType
* @return mixed
* @throws Exception
*/
public function sequenceNumber()
public function sequenceNumber($sequenceType)
{
try {
$con = Propel::getConnection('workflow');
$stmt = $con->createStatement();
//UPDATE SEQUENCES SET SEQ_VALUE = LAST_INSERT_ID(SEQ_VALUE + 1);
$sql = "UPDATE APP_SEQUENCE SET ID=LAST_INSERT_ID(ID+1)";
$sql = "UPDATE APP_SEQUENCE SET ID=LAST_INSERT_ID(ID+1) WHERE APP_TYPE = '{$sequenceType}'";
$stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC);
//SELECT LAST_INSERT_ID()
$sql = "SELECT LAST_INSERT_ID()";
$rs = $stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC);
$rs->next();
$row = $rs->getRow();
$result = $row['LAST_INSERT_ID()'];
} catch (\Exception $e) {
// If the type is WEB_ENTRY, we need to change to negative
if ($sequenceType === 'WEB_ENTRY') {
$result *= -1;
}
} catch (Exception $e) {
throw ($e);
}
return $result;
@@ -46,26 +53,36 @@ class AppSequence extends BaseAppSequence {
/**
* Update sequence number
*
* @return mixed
* @param int $number
* @param string $sequenceType
*
* @throws Exception
*/
public function updateSequenceNumber($number)
public function updateSequenceNumber($number, $sequenceType = AppSequence::APP_TYPE_NORMAL)
{
try {
$con = Propel::getConnection('workflow');
$stmt = $con->createStatement();
$c = new Criteria();
$rs = AppSequencePeer::doSelectRS($c);
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$rs->next();
$row = $rs->getRow();
// Get the current connection
$connection = Propel::getConnection('workflow');
// Create a statement instance
$statement = $connection->createStatement();
// Get the record according to the sequence type
$criteria = new Criteria();
$criteria->add(AppSequencePeer::APP_TYPE, $sequenceType);
$rsCriteria = AppSequencePeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$rsCriteria->next();
$row = $rsCriteria->getRow();
// Insert/Update sequence table with the number sent
if ($row) {
$sql = "UPDATE APP_SEQUENCE SET ID=LAST_INSERT_ID('$number')";
$sql = "UPDATE APP_SEQUENCE SET ID=LAST_INSERT_ID('{$number}') WHERE APP_TYPE = '{$sequenceType}'";
} else {
$sql = "INSERT INTO APP_SEQUENCE (ID) VALUES ('$number');";
$sql = "INSERT INTO APP_SEQUENCE (ID, APP_TYPE) VALUES ('{$number}', '{$sequenceType}')";
}
$stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC);
} catch (\Exception $e) {
$statement->executeQuery($sql, ResultSet::FETCHMODE_ASSOC);
} catch (Exception $e) {
throw ($e);
}
}

View File

@@ -207,30 +207,31 @@ class Application extends BaseApplication
}
/**
* Creates the Application
* Creates an Application
*
* @param
* $sProUid the process id
* $sUsrUid the userid
* @return void
* @param string $processUid
* @param string $userUid
* @param string $sequenceType
* @throws PropelException
* @throws Exception
* @return string
*/
public function create($sProUid, $sUsrUid)
public function create($processUid, $userUid, $sequenceType)
{
require_once ("classes/model/AppSequence.php");
$con = Propel::getConnection('workflow');
try {
//fill the default values for new application row
// Fill the default values for new application row
$this->setAppUid(G::generateUniqueID());
$this->setAppParent('');
$this->setAppStatus('DRAFT');
$this->setAppStatusId(1);
$this->setProUid($sProUid);
$this->setProUid($processUid);
$this->setAppProcStatus('');
$this->setAppProcCode('');
$this->setAppParallel('N');
$this->setAppInitUser($sUsrUid);
$this->setAppCurUser($sUsrUid);
$this->setAppInitUser($userUid);
$this->setAppCurUser($userUid);
$this->setAppCreateDate('now');
$this->setAppInitDate('now');
$this->setAppUpdateDate('now');
@@ -241,8 +242,8 @@ class Application extends BaseApplication
$c = new Criteria();
$c->clearSelectColumns();
$oAppSequence = new AppSequence();
$maxNumber = $oAppSequence->sequenceNumber();
$appSequence = new AppSequence();
$maxNumber = $appSequence->sequenceNumber($sequenceType);
$this->setAppNumber($maxNumber);
$this->setAppData(serialize(['APP_NUMBER' => $maxNumber, 'PIN' => $pin]));
@@ -253,9 +254,7 @@ class Application extends BaseApplication
$con->begin();
$this->setAppTitleContent('#' . $maxNumber);
$this->setAppDescriptionContent('');
//to do: ID_CASE in translation $this->setAppTitle(G::LoadTranslation('ID_CASE') . $maxNumber);
//Content::insertContent('APP_PROC_CODE', '', $this->getAppUid(), $lang, '');
$res = $this->save();
$this->save();
$con->commit();
return $this->getAppUid();

View File

@@ -65,7 +65,9 @@ class AppSequenceMapBuilder
$tMap->setUseIdGenerator(false);
$tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null);
$tMap->addColumn('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null);
$tMap->addColumn('APP_TYPE', 'AppType', 'string', CreoleTypes::VARCHAR, true, 20);
} // doBuild()

View File

@@ -67,7 +67,7 @@ class AppTimeoutActionExecutedMapBuilder
$tMap->addPrimaryKey('APP_UID', 'AppUid', 'string', CreoleTypes::VARCHAR, true, 32);
$tMap->addColumn('DEL_INDEX', 'DelIndex', 'int', CreoleTypes::INTEGER, true, null);
$tMap->addPrimaryKey('DEL_INDEX', 'DelIndex', 'int', CreoleTypes::INTEGER, true, null);
$tMap->addColumn('EXECUTION_DATE', 'ExecutionDate', 'int', CreoleTypes::TIMESTAMP, false, null);

View File

@@ -33,6 +33,12 @@ abstract class BaseAppSequence extends BaseObject implements Persistent
*/
protected $id;
/**
* The value for the app_type field.
* @var string
*/
protected $app_type = 'NORMAL';
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
@@ -58,6 +64,17 @@ abstract class BaseAppSequence extends BaseObject implements Persistent
return $this->id;
}
/**
* Get the [app_type] column value.
*
* @return string
*/
public function getAppType()
{
return $this->app_type;
}
/**
* Set the value of [id] column.
*
@@ -80,6 +97,28 @@ abstract class BaseAppSequence extends BaseObject implements Persistent
} // setId()
/**
* Set the value of [app_type] column.
*
* @param string $v new value
* @return void
*/
public function setAppType($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->app_type !== $v || $v === 'NORMAL') {
$this->app_type = $v;
$this->modifiedColumns[] = AppSequencePeer::APP_TYPE;
}
} // setAppType()
/**
* Hydrates (populates) the object variables with values from the database resultset.
*
@@ -99,12 +138,14 @@ abstract class BaseAppSequence extends BaseObject implements Persistent
$this->id = $rs->getInt($startcol + 0);
$this->app_type = $rs->getString($startcol + 1);
$this->resetModified();
$this->setNew(false);
// FIXME - using NUM_COLUMNS may be clearer.
return $startcol + 1; // 1 = AppSequencePeer::NUM_COLUMNS - AppSequencePeer::NUM_LAZY_LOAD_COLUMNS).
return $startcol + 2; // 2 = AppSequencePeer::NUM_COLUMNS - AppSequencePeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) {
throw new PropelException("Error populating AppSequence object", $e);
@@ -311,6 +352,9 @@ abstract class BaseAppSequence extends BaseObject implements Persistent
case 0:
return $this->getId();
break;
case 1:
return $this->getAppType();
break;
default:
return null;
break;
@@ -332,6 +376,7 @@ abstract class BaseAppSequence extends BaseObject implements Persistent
$keys = AppSequencePeer::getFieldNames($keyType);
$result = array(
$keys[0] => $this->getId(),
$keys[1] => $this->getAppType(),
);
return $result;
}
@@ -366,6 +411,9 @@ abstract class BaseAppSequence extends BaseObject implements Persistent
case 0:
$this->setId($value);
break;
case 1:
$this->setAppType($value);
break;
} // switch()
}
@@ -393,6 +441,10 @@ abstract class BaseAppSequence extends BaseObject implements Persistent
$this->setId($arr[$keys[0]]);
}
if (array_key_exists($keys[1], $arr)) {
$this->setAppType($arr[$keys[1]]);
}
}
/**
@@ -408,6 +460,10 @@ abstract class BaseAppSequence extends BaseObject implements Persistent
$criteria->add(AppSequencePeer::ID, $this->id);
}
if ($this->isColumnModified(AppSequencePeer::APP_TYPE)) {
$criteria->add(AppSequencePeer::APP_TYPE, $this->app_type);
}
return $criteria;
}
@@ -424,30 +480,33 @@ abstract class BaseAppSequence extends BaseObject implements Persistent
{
$criteria = new Criteria(AppSequencePeer::DATABASE_NAME);
$criteria->add(AppSequencePeer::ID, $this->id);
return $criteria;
}
/**
* Returns the primary key for this object (row).
* @return int
* Returns NULL since this table doesn't have a primary key.
* This method exists only for BC and is deprecated!
* @return null
*/
public function getPrimaryKey()
{
return $this->getId();
return null;
}
/**
* Generic method to set the primary key (id column).
* Dummy primary key setter.
*
* @param int $key Primary key.
* @return void
* This function only exists to preserve backwards compatibility. It is no longer
* needed or required by the Persistent interface. It will be removed in next BC-breaking
* release of Propel.
*
* @deprecated
*/
public function setPrimaryKey($key)
{
$this->setId($key);
}
public function setPrimaryKey($pk)
{
// do nothing, because this object doesn't have any primary keys
}
/**
* Sets contents of passed object to values from current object.
@@ -462,11 +521,13 @@ abstract class BaseAppSequence extends BaseObject implements Persistent
public function copyInto($copyObj, $deepCopy = false)
{
$copyObj->setId($this->id);
$copyObj->setAppType($this->app_type);
$copyObj->setNew(true);
$copyObj->setId(NULL); // this is a pkey column, so set to default value
}
/**

View File

@@ -25,7 +25,7 @@ abstract class BaseAppSequencePeer
const CLASS_DEFAULT = 'classes.model.AppSequence';
/** The total number of columns. */
const NUM_COLUMNS = 1;
const NUM_COLUMNS = 2;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
@@ -34,6 +34,9 @@ abstract class BaseAppSequencePeer
/** the column name for the ID field */
const ID = 'APP_SEQUENCE.ID';
/** the column name for the APP_TYPE field */
const APP_TYPE = 'APP_SEQUENCE.APP_TYPE';
/** The PHP to DB Name Mapping */
private static $phpNameMap = null;
@@ -45,10 +48,10 @@ abstract class BaseAppSequencePeer
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('Id', ),
BasePeer::TYPE_COLNAME => array (AppSequencePeer::ID, ),
BasePeer::TYPE_FIELDNAME => array ('ID', ),
BasePeer::TYPE_NUM => array (0, )
BasePeer::TYPE_PHPNAME => array ('Id', 'AppType', ),
BasePeer::TYPE_COLNAME => array (AppSequencePeer::ID, AppSequencePeer::APP_TYPE, ),
BasePeer::TYPE_FIELDNAME => array ('ID', 'APP_TYPE', ),
BasePeer::TYPE_NUM => array (0, 1, )
);
/**
@@ -58,10 +61,10 @@ abstract class BaseAppSequencePeer
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('Id' => 0, ),
BasePeer::TYPE_COLNAME => array (AppSequencePeer::ID => 0, ),
BasePeer::TYPE_FIELDNAME => array ('ID' => 0, ),
BasePeer::TYPE_NUM => array (0, )
BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'AppType' => 1, ),
BasePeer::TYPE_COLNAME => array (AppSequencePeer::ID => 0, AppSequencePeer::APP_TYPE => 1, ),
BasePeer::TYPE_FIELDNAME => array ('ID' => 0, 'APP_TYPE' => 1, ),
BasePeer::TYPE_NUM => array (0, 1, )
);
/**
@@ -164,10 +167,12 @@ abstract class BaseAppSequencePeer
$criteria->addSelectColumn(AppSequencePeer::ID);
$criteria->addSelectColumn(AppSequencePeer::APP_TYPE);
}
const COUNT = 'COUNT(APP_SEQUENCE.ID)';
const COUNT_DISTINCT = 'COUNT(DISTINCT APP_SEQUENCE.ID)';
const COUNT = 'COUNT(*)';
const COUNT_DISTINCT = 'COUNT(DISTINCT *)';
/**
* Returns the number of rows matching criteria.
@@ -376,9 +381,6 @@ abstract class BaseAppSequencePeer
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
$comparison = $criteria->getComparison(AppSequencePeer::ID);
$selectCriteria->add(AppSequencePeer::ID, $criteria->remove(AppSequencePeer::ID), $comparison);
} else {
$criteria = $values->buildCriteria(); // gets full criteria
$selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
@@ -436,11 +438,22 @@ abstract class BaseAppSequencePeer
$criteria = clone $values; // rename for clarity
} elseif ($values instanceof AppSequence) {
$criteria = $values->buildPkeyCriteria();
$criteria = $values->buildCriteria();
} else {
// it must be the primary key
$criteria = new Criteria(self::DATABASE_NAME);
$criteria->add(AppSequencePeer::ID, (array) $values, Criteria::IN);
// primary key is composite; we therefore, expect
// the primary key passed to be an array of pkey
// values
if (count($values) == count($values, COUNT_RECURSIVE)) {
// array is not multi-dimensional
$values = array($values);
}
$vals = array();
foreach ($values as $value) {
}
}
// Set the correct dbName
@@ -498,54 +511,6 @@ abstract class BaseAppSequencePeer
return BasePeer::doValidate(AppSequencePeer::DATABASE_NAME, AppSequencePeer::TABLE_NAME, $columns);
}
/**
* Retrieve a single object by pkey.
*
* @param mixed $pk the primary key.
* @param Connection $con the connection to use
* @return AppSequence
*/
public static function retrieveByPK($pk, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$criteria = new Criteria(AppSequencePeer::DATABASE_NAME);
$criteria->add(AppSequencePeer::ID, $pk);
$v = AppSequencePeer::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(AppSequencePeer::ID, $pks, Criteria::IN);
$objs = AppSequencePeer::doSelect($criteria, $con);
}
return $objs;
}
}

View File

@@ -565,28 +565,40 @@ abstract class BaseAppTimeoutActionExecuted extends BaseObject implements Persis
$criteria = new Criteria(AppTimeoutActionExecutedPeer::DATABASE_NAME);
$criteria->add(AppTimeoutActionExecutedPeer::APP_UID, $this->app_uid);
$criteria->add(AppTimeoutActionExecutedPeer::DEL_INDEX, $this->del_index);
return $criteria;
}
/**
* Returns the primary key for this object (row).
* @return string
* Returns the composite primary key for this object.
* The array elements will be in same order as specified in XML.
* @return array
*/
public function getPrimaryKey()
{
return $this->getAppUid();
$pks = array();
$pks[0] = $this->getAppUid();
$pks[1] = $this->getDelIndex();
return $pks;
}
/**
* Generic method to set the primary key (app_uid column).
* Set the [composite] primary key.
*
* @param string $key Primary key.
* @param array $keys The elements of the composite key (order must match the order in XML file).
* @return void
*/
public function setPrimaryKey($key)
public function setPrimaryKey($keys)
{
$this->setAppUid($key);
$this->setAppUid($keys[0]);
$this->setDelIndex($keys[1]);
}
/**
@@ -602,8 +614,6 @@ abstract class BaseAppTimeoutActionExecuted extends BaseObject implements Persis
public function copyInto($copyObj, $deepCopy = false)
{
$copyObj->setDelIndex($this->del_index);
$copyObj->setExecutionDate($this->execution_date);
@@ -611,6 +621,8 @@ abstract class BaseAppTimeoutActionExecuted extends BaseObject implements Persis
$copyObj->setAppUid(''); // this is a pkey column, so set to default value
$copyObj->setDelIndex('0'); // this is a pkey column, so set to default value
}
/**

View File

@@ -389,6 +389,9 @@ abstract class BaseAppTimeoutActionExecutedPeer
$comparison = $criteria->getComparison(AppTimeoutActionExecutedPeer::APP_UID);
$selectCriteria->add(AppTimeoutActionExecutedPeer::APP_UID, $criteria->remove(AppTimeoutActionExecutedPeer::APP_UID), $comparison);
$comparison = $criteria->getComparison(AppTimeoutActionExecutedPeer::DEL_INDEX);
$selectCriteria->add(AppTimeoutActionExecutedPeer::DEL_INDEX, $criteria->remove(AppTimeoutActionExecutedPeer::DEL_INDEX), $comparison);
} else {
$criteria = $values->buildCriteria(); // gets full criteria
$selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
@@ -450,7 +453,22 @@ abstract class BaseAppTimeoutActionExecutedPeer
} else {
// it must be the primary key
$criteria = new Criteria(self::DATABASE_NAME);
$criteria->add(AppTimeoutActionExecutedPeer::APP_UID, (array) $values, Criteria::IN);
// primary key is composite; we therefore, expect
// the primary key passed to be an array of pkey
// values
if (count($values) == count($values, COUNT_RECURSIVE)) {
// array is not multi-dimensional
$values = array($values);
}
$vals = array();
foreach ($values as $value) {
$vals[0][] = $value[0];
$vals[1][] = $value[1];
}
$criteria->add(AppTimeoutActionExecutedPeer::APP_UID, $vals[0], Criteria::IN);
$criteria->add(AppTimeoutActionExecutedPeer::DEL_INDEX, $vals[1], Criteria::IN);
}
// Set the correct dbName
@@ -510,51 +528,23 @@ abstract class BaseAppTimeoutActionExecutedPeer
}
/**
* Retrieve a single object by pkey.
*
* @param mixed $pk the primary key.
* @param Connection $con the connection to use
* Retrieve object using using composite pkey values.
* @param string $app_uid
* @param int $del_index
* @param Connection $con
* @return AppTimeoutActionExecuted
*/
public static function retrieveByPK($pk, $con = null)
public static function retrieveByPK($app_uid, $del_index, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$criteria = new Criteria(AppTimeoutActionExecutedPeer::DATABASE_NAME);
$criteria->add(AppTimeoutActionExecutedPeer::APP_UID, $pk);
$criteria = new Criteria();
$criteria->add(AppTimeoutActionExecutedPeer::APP_UID, $app_uid);
$criteria->add(AppTimeoutActionExecutedPeer::DEL_INDEX, $del_index);
$v = AppTimeoutActionExecutedPeer::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(AppTimeoutActionExecutedPeer::APP_UID, $pks, Criteria::IN);
$objs = AppTimeoutActionExecutedPeer::doSelect($criteria, $con);
}
return $objs;
return !empty($v) ? $v[0] : null;
}
}