BUG 8376 The Key Autoincrement in PMT Dynaform is requeried SOLVED

- I add the field Key Autoincrement no requeried in PMT dynaform
This commit is contained in:
Brayan Osmar Pereyra Suxo
2012-07-19 18:53:48 -04:00
parent b0166dea9a
commit f1484ca998
3 changed files with 50 additions and 13 deletions

View File

@@ -406,8 +406,16 @@ class AdditionalTables extends BaseAdditionalTables
$stmt = $oConnection->createStatement();
require_once $sPath . $sClassName . '.php';
$sKeys = '';
$keysAutoIncrement = 0;
$keyUIDAutoIncrement = '';
foreach ($aData['FIELDS'] as $aField) {
if ($aField['FLD_KEY'] == 1) {
if ($aField['FLD_AUTO_INCREMENT'] == 1) {
if ($keysAutoIncrement == 0) {
$keyUIDAutoIncrement = $aField['FLD_NAME'];
}
$keysAutoIncrement++;
}
$vValue = $aFields[$aField['FLD_NAME']];
eval('$' . $aField['FLD_NAME'] . ' = $vValue;');
$sKeys .= '$' . $aField['FLD_NAME'] . ',';
@@ -421,7 +429,16 @@ class AdditionalTables extends BaseAdditionalTables
}
}
if ($oClass->validate()) {
$iResult = $oClass->save();
$iResult = $oClass->save();
if ($keysAutoIncrement == 1 && $aFields[$keyUIDAutoIncrement] == '' && isset($_SESSION['APPLICATION']) && $_SESSION['APPLICATION'] != '') {
G::LoadClass('case');
$oCaseKeyAuto = new Cases();
$newId = $oClass->getId();
$aFields = $oCaseKeyAuto->loadCase($_SESSION['APPLICATION']);
$aFields['APP_DATA'][$keyUIDAutoIncrement] = $newId;
$_POST['form'][$keyUIDAutoIncrement] = $newId;
$oCaseKeyAuto->updateCase($_SESSION['APPLICATION'], $aFields);
}
}
return true;
} catch (Exception $oError) {