BUG 11510 Números de casos duplicados SOLVED

- Al parecer existe un problema de concurrencia al crear los casos en processmaker, de tal forma que si se intenta crear 2 casos al mismo tiempo el número del caso termina siendo el mismo para ambos casos.
- Centralized incrementing of the sequence of the cases of the application.
This commit is contained in:
Hector Cortez
2013-05-31 11:14:58 -04:00
parent 51c6bdd12a
commit 769d10aad4
2 changed files with 17 additions and 15 deletions

View File

@@ -375,20 +375,11 @@ class Application extends BaseApplication
$oSequences = new Sequences();
$oSequences->lockSequenceTable();
if ($oSequences->nameExists("APP_NUMBER") ) {
$maxNumber = $oSequences->getSequeceNumber("APP_NUMBER");
} else {
$c->addSelectColumn('MAX(' . ApplicationPeer::APP_NUMBER . ')'); //the appnumber is based in all processes
//active, not only in the specified
//process guid
$result = ApplicationPeer::doSelectRS($c);
$result->next();
$row = $result->getRow();
$maxNumber = $row[0] + 1;
}
$maxNumber = $oSequences->getSequeceNumber("APP_NUMBER");
$this->setAppNumber($maxNumber);
$oSequences->changeSequence('APP_NUMBER', $maxNumber);
$oSequences->unlockSequenceTable();
if ($this->validate()) {
$con->begin();
@@ -403,7 +394,6 @@ class Application extends BaseApplication
$con->commit();
$oSequences->unlockSequenceTable();
return $this->getAppUid();
} else {
$msg = '';
@@ -411,7 +401,6 @@ class Application extends BaseApplication
foreach ($this->getValidationFailures() as $objValidationFailure) {
$msg .= $objValidationFailure->getMessage() . "<br/>";
}
$oSequences->unlockSequenceTable();
throw (new PropelException('The APPLICATION row cannot be created!', new PropelException($msg)));
}