@@ -737,6 +737,7 @@ class workspaceTools
|
||||
$this->upgradeSchema($systemSchemaRbac, false, true, $onedb); // perform Upgrade to Rbac
|
||||
$this->upgradeData();
|
||||
$this->checkRbacPermissions();//check or add new permissions
|
||||
$this->checkSequenceNumber();
|
||||
|
||||
//There records in table "EMAIL_SERVER"
|
||||
$criteria = new Criteria("workflow");
|
||||
@@ -2307,4 +2308,16 @@ class workspaceTools
|
||||
CLI::logging(" All roles permissions already updated \n");
|
||||
}
|
||||
}
|
||||
|
||||
public function checkSequenceNumber()
|
||||
{
|
||||
$oRow = SequencesPeer::retrieveByPK("APP_NUMBER");
|
||||
$oAppSequence = new AppSequence();
|
||||
if (!is_null($oRow)) {
|
||||
$aFields = $oRow->toArray(BasePeer::TYPE_FIELDNAME);
|
||||
$oAppSequence->updateSequenceNumber($aFields['SEQ_VALUE']);
|
||||
} else {
|
||||
$oAppSequence->updateSequenceNumber(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
64
workflow/engine/classes/model/AppSequence.php
Normal file
64
workflow/engine/classes/model/AppSequence.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
require_once 'classes/model/om/BaseAppSequence.php';
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for representing a row from the 'APP_SEQUENCE' 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 AppSequence extends BaseAppSequence {
|
||||
|
||||
/**
|
||||
* Get an Set new sequence number
|
||||
*
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function sequenceNumber()
|
||||
{
|
||||
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)";
|
||||
$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) {
|
||||
throw ($e);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update sequence number
|
||||
*
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function updateSequenceNumber($number)
|
||||
{
|
||||
try {
|
||||
$con = Propel::getConnection('workflow');
|
||||
$stmt = $con->createStatement();
|
||||
$sql = "UPDATE APP_SEQUENCE SET ID=LAST_INSERT_ID('$number')";
|
||||
$stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC);
|
||||
} catch (\Exception $e) {
|
||||
throw ($e);
|
||||
}
|
||||
}
|
||||
|
||||
} // AppSequence
|
||||
23
workflow/engine/classes/model/AppSequencePeer.php
Normal file
23
workflow/engine/classes/model/AppSequencePeer.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
// include base peer class
|
||||
require_once 'classes/model/om/BaseAppSequencePeer.php';
|
||||
|
||||
// include object class
|
||||
include_once 'classes/model/AppSequence.php';
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'APP_SEQUENCE' 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 AppSequencePeer extends BaseAppSequencePeer {
|
||||
|
||||
} // AppSequencePeer
|
||||
@@ -354,7 +354,7 @@ class Application extends BaseApplication
|
||||
*/
|
||||
public function create($sProUid, $sUsrUid)
|
||||
{
|
||||
require_once ("classes/model/Sequences.php");
|
||||
require_once ("classes/model/AppSequence.php");
|
||||
$con = Propel::getConnection('workflow');
|
||||
|
||||
try {
|
||||
@@ -378,17 +378,12 @@ class Application extends BaseApplication
|
||||
$c = new Criteria();
|
||||
$c->clearSelectColumns();
|
||||
|
||||
$oSequences = new Sequences();
|
||||
$oSequences->lockSequenceTable();
|
||||
|
||||
$maxNumber = $oSequences->getSequeceNumber("APP_NUMBER");
|
||||
$oAppSequence = new AppSequence();
|
||||
$maxNumber = $oAppSequence->sequenceNumber();
|
||||
|
||||
$this->setAppNumber($maxNumber);
|
||||
$this->setAppData(serialize(['APP_NUMBER' => $maxNumber, 'PIN' => $pin]));
|
||||
|
||||
$oSequences->changeSequence('APP_NUMBER', $maxNumber);
|
||||
$oSequences->unlockSequenceTable();
|
||||
|
||||
if ($this->validate()) {
|
||||
$con->begin();
|
||||
$res = $this->save();
|
||||
|
||||
72
workflow/engine/classes/model/map/AppSequenceMapBuilder.php
Normal file
72
workflow/engine/classes/model/map/AppSequenceMapBuilder.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
require_once 'propel/map/MapBuilder.php';
|
||||
include_once 'creole/CreoleTypes.php';
|
||||
|
||||
|
||||
/**
|
||||
* This class adds structure of 'APP_SEQUENCE' 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 AppSequenceMapBuilder
|
||||
{
|
||||
|
||||
/**
|
||||
* The (dot-path) name of this class
|
||||
*/
|
||||
const CLASS_NAME = 'classes.model.map.AppSequenceMapBuilder';
|
||||
|
||||
/**
|
||||
* 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('APP_SEQUENCE');
|
||||
$tMap->setPhpName('AppSequence');
|
||||
|
||||
$tMap->setUseIdGenerator(true);
|
||||
|
||||
$tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null);
|
||||
|
||||
} // doBuild()
|
||||
|
||||
} // AppSequenceMapBuilder
|
||||
512
workflow/engine/classes/model/om/BaseAppSequence.php
Normal file
512
workflow/engine/classes/model/om/BaseAppSequence.php
Normal file
File diff suppressed because it is too large
Load Diff
569
workflow/engine/classes/model/om/BaseAppSequencePeer.php
Normal file
569
workflow/engine/classes/model/om/BaseAppSequencePeer.php
Normal file
File diff suppressed because it is too large
Load Diff
@@ -90,6 +90,9 @@
|
||||
</vendor>
|
||||
</index>
|
||||
</table>
|
||||
<table name="APP_SEQUENCE" idMethod="native">
|
||||
<column name="ID" type="INTEGER" required="true" primaryKey="true"/>
|
||||
</table>
|
||||
<table name="APP_DELEGATION">
|
||||
<vendor type="mysql">
|
||||
<parameter name="Name" value="APP_DELEGATION"/>
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
INSERT INTO USERS (USR_UID,USR_USERNAME,USR_PASSWORD,USR_FIRSTNAME,USR_LASTNAME,USR_EMAIL,USR_DUE_DATE,USR_CREATE_DATE,USR_UPDATE_DATE,USR_STATUS,USR_COUNTRY,USR_CITY,USR_LOCATION,USR_ADDRESS,USR_PHONE,USR_FAX,USR_CELLULAR,USR_ZIP_CODE,DEP_UID,USR_POSITION,USR_RESUME,USR_BIRTHDAY,USR_ROLE,USR_REPORTS_TO,USR_REPLACED_BY ) VALUES
|
||||
('00000000000000000000000000000001','admin','21232f297a57a5a743894a0e4a801fc3','Administrator',' ', 'admin@processmaker.com','2020-01-01','1999-11-30 00:00:00','2008-05-23 18:36:19','ACTIVE', 'US','FL','MMK','','', '1-305-402-0282','1-305-675-1400','','','Administrator', '','1999-02-25','PROCESSMAKER_ADMIN','','');
|
||||
|
||||
INSERT INTO APP_SEQUENCE (ID) VALUES ('0');
|
||||
|
||||
INSERT INTO CONTENT (CON_CATEGORY,CON_PARENT,CON_ID,CON_LANG,CON_VALUE) VALUES
|
||||
('ROL_NAME','','00000000000000000000000000000002','en','System Administrator'),
|
||||
('ROL_NAME','','00000000000000000000000000000003','en','Operator'),
|
||||
|
||||
@@ -37,6 +37,20 @@ CREATE TABLE `APPLICATION`
|
||||
KEY `indexAppStatus`(`APP_STATUS`),
|
||||
KEY `indexAppCreateDate`(`APP_CREATE_DATE`)
|
||||
)ENGINE=InnoDB DEFAULT CHARSET='utf8' COMMENT='The application';
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
#-- APP_SEQUENCE
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS `APP_SEQUENCE`;
|
||||
|
||||
|
||||
CREATE TABLE `APP_SEQUENCE`
|
||||
(
|
||||
`ID` INTEGER NOT NULL,
|
||||
PRIMARY KEY (`ID`)
|
||||
)ENGINE=InnoDB ;
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
#-- APP_DELEGATION
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user