HOR-1330 Modificar el upgrade para colocar los valores de las nuevas columnas copiadas de CONTENT
up observations remove method migrate_content in database-upgrade fix in Application and InputDocument
This commit is contained in:
@@ -3099,5 +3099,50 @@ class workspaceTools
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Migrate this workspace table Content.
|
||||
*
|
||||
* @param $className
|
||||
* @param $fields
|
||||
* @param $workSpace
|
||||
* @param mixed|string $sys_lang
|
||||
* @throws Exception
|
||||
*/
|
||||
public function migrateContent($className, $fields, $workSpace, $sys_lang = SYS_LANG)
|
||||
{
|
||||
try {
|
||||
$this->initPropel(true);
|
||||
$_SESSION['sys_sys'] = $workSpace;
|
||||
$fieldUidName = $fields['uid'];
|
||||
$oCriteria = new Criteria();
|
||||
$oCriteria->clearSelectColumns();
|
||||
$oCriteria->addAsColumn($fieldUidName, ContentPeer::CON_ID);
|
||||
$oCriteria->addSelectColumn(ContentPeer::CON_CATEGORY);
|
||||
$oCriteria->addSelectColumn(ContentPeer::CON_VALUE);
|
||||
$oCriteria->add(ContentPeer::CON_CATEGORY, $fields['fields'], Criteria::IN);
|
||||
$oCriteria->add(ContentPeer::CON_LANG, $sys_lang);
|
||||
$oDataset = ContentPeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$methods = $fields['methods'];
|
||||
while ($oDataset->next()) {
|
||||
$row = $oDataset->getRow();
|
||||
$fieldName = $row['CON_CATEGORY'];
|
||||
$fieldName = isset($fields['alias']) && isset($fields['alias'][$fieldName]) ? $fields['alias'][$fieldName] : $fieldName;
|
||||
unset($row['CON_CATEGORY']);
|
||||
$fieldValue = $row['CON_VALUE'];
|
||||
unset($row['CON_VALUE']);
|
||||
$row[$fieldName] = $fieldValue;
|
||||
$oTable = new $className();
|
||||
$mExists = $methods['exists'];
|
||||
if ($oTable->$mExists($row[$fieldUidName])){
|
||||
$oTable->update($row);
|
||||
}
|
||||
}
|
||||
$classNamePeer = $className . 'Peer';
|
||||
CLI::logging("|--> Add content in table " . $classNamePeer::TABLE_NAME . "\n");
|
||||
} catch (Exception $e) {
|
||||
throw ($e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ class Application extends BaseApplication
|
||||
}
|
||||
|
||||
if ($this->getAppUid() == '') {
|
||||
throw (new Exception( "Error in getAppTitle, the APP_UID can't be blank"));
|
||||
throw (new Exception( "Error in getAppTitleContent, the APP_UID can't be blank"));
|
||||
}
|
||||
|
||||
$lang = defined('SYS_LANG')? SYS_LANG : 'en';
|
||||
@@ -80,7 +80,7 @@ class Application extends BaseApplication
|
||||
public function setAppTitleContent($v)
|
||||
{
|
||||
if ($this->getAppUid() == '') {
|
||||
throw (new Exception( "Error in setAppTitle, the APP_UID can't be blank"));
|
||||
throw (new Exception( "Error in setAppTitleContent, the APP_UID can't be blank"));
|
||||
}
|
||||
|
||||
//Since the native PHP type for this column is string,
|
||||
@@ -103,7 +103,7 @@ class Application extends BaseApplication
|
||||
public function getAppDescriptionContent()
|
||||
{
|
||||
if ($this->getAppUid() == '') {
|
||||
throw (new Exception( "Error in getAppDescription, the APP_UID can't be blank"));
|
||||
throw (new Exception( "Error in getAppDescriptionContent, the APP_UID can't be blank"));
|
||||
}
|
||||
|
||||
$lang = defined('SYS_LANG')? SYS_LANG : 'en';
|
||||
@@ -121,7 +121,7 @@ class Application extends BaseApplication
|
||||
public function setAppDescriptionContent($v)
|
||||
{
|
||||
if ($this->getAppUid() == '') {
|
||||
throw ( new Exception( "Error in setAppTitle, the APP_UID can't be blank") );
|
||||
throw ( new Exception( "Error in setAppDescriptionContent, the APP_UID can't be blank") );
|
||||
}
|
||||
|
||||
// Since the native PHP type for this column is string,
|
||||
@@ -295,10 +295,10 @@ class Application extends BaseApplication
|
||||
|
||||
if ($oApp->validate()) {
|
||||
if (isset($aData['APP_TITLE'])) {
|
||||
$this->setAppTitleContent($aData['APP_TITLE']);
|
||||
$oApp->setAppTitleContent($aData['APP_TITLE']);
|
||||
}
|
||||
if (isset($aData['APP_DESCRIPTION'])) {
|
||||
$this->setAppDescriptionContent($aData['APP_DESCRIPTION']);
|
||||
$oApp->setAppDescriptionContent($aData['APP_DESCRIPTION']);
|
||||
}
|
||||
|
||||
//if ( isset ( $aData['APP_PROC_CODE'] ) )
|
||||
@@ -311,7 +311,7 @@ class Application extends BaseApplication
|
||||
} else {
|
||||
$msg = '';
|
||||
|
||||
foreach ($this->getValidationFailures() as $objValidationFailure) {
|
||||
foreach ($oApp->getValidationFailures() as $objValidationFailure) {
|
||||
$msg .= $objValidationFailure->getMessage() . "<br/>";
|
||||
}
|
||||
|
||||
|
||||
@@ -197,23 +197,29 @@ class InputDocument extends BaseInputDocument
|
||||
$iResult = $oInputDocument->save();
|
||||
$oConnection->commit();
|
||||
//Add Audit Log
|
||||
switch ($aData['INP_DOC_FORM_NEEDED']){
|
||||
case 'VIRTUAL':
|
||||
$docType = 'Digital';
|
||||
break;
|
||||
case 'REAL':
|
||||
$docType = 'Printed';
|
||||
break;
|
||||
case 'VREAL':
|
||||
$docType = 'Digital/Printed';
|
||||
break;
|
||||
$docType = '';
|
||||
if(!empty($aData['INP_DOC_FORM_NEEDED'])) {
|
||||
switch ($aData['INP_DOC_FORM_NEEDED']) {
|
||||
case 'VIRTUAL':
|
||||
$docType = 'Digital';
|
||||
break;
|
||||
case 'REAL':
|
||||
$docType = 'Printed';
|
||||
break;
|
||||
case 'VREAL':
|
||||
$docType = 'Digital/Printed';
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(isset($aData['INP_DOC_VERSIONING']) && $aData['INP_DOC_VERSIONING'] == 1){
|
||||
$enableVersion = 'Yes';
|
||||
}else{
|
||||
$enableVersion = 'No';
|
||||
}
|
||||
$description = "Input Document Title: ".$aData['INP_DOC_TITLE'].", Input Document Uid: ".$aData['INP_DOC_UID'].", Document Type: ".$docType;
|
||||
$description = '';
|
||||
if (!empty( $aData['INP_DOC_TITLE'] )) {
|
||||
$description = "Input Document Title: ".$aData['INP_DOC_TITLE'].", Input Document Uid: ".$aData['INP_DOC_UID'].", Document Type: ".$docType;
|
||||
}
|
||||
if(!empty($aData['INP_DOC_DESCRIPTION'])){
|
||||
$description .= ", Description: ".$aData['INP_DOC_DESCRIPTION'];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user