IDEMPIERE-926 - SynchronizeTerminology doesn't update info window name in the menu

This commit is contained in:
Carlos Ruiz 2013-05-29 11:03:26 -05:00
parent a24672d4e7
commit c8da100ab2
6 changed files with 75 additions and 27 deletions

View File

@ -117,6 +117,12 @@ UPDATE AD_MENU m SET Name = (SELECT Name FROM AD_TASK f WHERE m.AD_Task_ID=f.AD_
UPDATE AD_MENU_TRL mt SET Name = (SELECT ft.Name FROM AD_TASK_TRL ft, AD_MENU m WHERE mt.AD_Menu_ID=m.AD_Menu_ID AND m.AD_Task_ID=ft.AD_Task_ID AND mt.AD_LANGUAGE=ft.AD_LANGUAGE), Description = (SELECT ft.Description FROM AD_TASK_TRL ft, AD_MENU m WHERE mt.AD_Menu_ID=m.AD_Menu_ID AND m.AD_Task_ID=ft.AD_Task_ID AND mt.AD_LANGUAGE=ft.AD_LANGUAGE), IsTranslated = (SELECT ft.IsTranslated FROM AD_TASK_TRL ft, AD_MENU m WHERE mt.AD_Menu_ID=m.AD_Menu_ID AND m.AD_Task_ID=ft.AD_Task_ID AND mt.AD_LANGUAGE=ft.AD_LANGUAGE) WHERE EXISTS (SELECT 1 FROM AD_TASK_TRL ft, AD_MENU m WHERE mt.AD_Menu_ID=m.AD_Menu_ID AND m.AD_Task_ID=ft.AD_Task_ID AND mt.AD_LANGUAGE=ft.AD_LANGUAGE AND m.AD_Task_ID IS NOT NULL AND m.Action = 'T' AND m.IsCentrallyMaintained='Y' AND m.IsActive='Y')
;
UPDATE AD_MENU m SET Name = (SELECT Name FROM AD_InfoWindow f WHERE m.AD_InfoWindow_ID=f.AD_InfoWindow_ID), Description = (SELECT Description FROM AD_InfoWindow f WHERE m.AD_InfoWindow_ID=f.AD_InfoWindow_ID) WHERE m.AD_InfoWindow_ID IS NOT NULL AND m.Action = 'I' AND m.IsCentrallyMaintained='Y' AND m.IsActive='Y'
;
UPDATE AD_MENU_TRL mt SET Name = (SELECT ft.Name FROM AD_InfoWindow_TRL ft, AD_MENU m WHERE mt.AD_Menu_ID=m.AD_Menu_ID AND m.AD_InfoWindow_ID=ft.AD_InfoWindow_ID AND mt.AD_LANGUAGE=ft.AD_LANGUAGE), Description = (SELECT ft.Description FROM AD_InfoWindow_TRL ft, AD_MENU m WHERE mt.AD_Menu_ID=m.AD_Menu_ID AND m.AD_InfoWindow_ID=ft.AD_InfoWindow_ID AND mt.AD_LANGUAGE=ft.AD_LANGUAGE), IsTranslated = (SELECT ft.IsTranslated FROM AD_InfoWindow_TRL ft, AD_MENU m WHERE mt.AD_Menu_ID=m.AD_Menu_ID AND m.AD_InfoWindow_ID=ft.AD_InfoWindow_ID AND mt.AD_LANGUAGE=ft.AD_LANGUAGE) WHERE EXISTS (SELECT 1 FROM AD_InfoWindow_TRL ft, AD_MENU m WHERE mt.AD_Menu_ID=m.AD_Menu_ID AND m.AD_InfoWindow_ID=ft.AD_InfoWindow_ID AND mt.AD_LANGUAGE=ft.AD_LANGUAGE AND m.AD_InfoWindow_ID IS NOT NULL AND m.Action = 'I' AND m.IsCentrallyMaintained='Y' AND m.IsActive='Y')
;
UPDATE AD_COLUMN_TRL ct SET Name = (SELECT e.Name FROM AD_COLUMN c INNER JOIN AD_ELEMENT_TRL e ON (c.AD_Element_ID=e.AD_Element_ID) WHERE ct.AD_Column_ID=c.AD_Column_ID AND ct.AD_LANGUAGE=e.AD_LANGUAGE) WHERE EXISTS (SELECT 1 FROM AD_COLUMN c INNER JOIN AD_ELEMENT_TRL e ON (c.AD_Element_ID=e.AD_Element_ID) WHERE ct.AD_Column_ID=c.AD_Column_ID AND ct.AD_LANGUAGE=e.AD_LANGUAGE AND ct.Name<>e.Name)
;

View File

@ -117,6 +117,12 @@ UPDATE AD_MENU SET Name = (SELECT Name FROM AD_TASK f WHERE AD_MENU.AD_Task_ID=f
UPDATE AD_MENU_TRL SET Name = (SELECT ft.Name FROM AD_TASK_TRL ft, AD_MENU m WHERE AD_MENU_TRL.AD_Menu_ID=m.AD_Menu_ID AND m.AD_Task_ID=ft.AD_Task_ID AND AD_MENU_TRL.AD_LANGUAGE=ft.AD_LANGUAGE), Description = (SELECT ft.Description FROM AD_TASK_TRL ft, AD_MENU m WHERE AD_MENU_TRL.AD_Menu_ID=m.AD_Menu_ID AND m.AD_Task_ID=ft.AD_Task_ID AND AD_MENU_TRL.AD_LANGUAGE=ft.AD_LANGUAGE), IsTranslated = (SELECT ft.IsTranslated FROM AD_TASK_TRL ft, AD_MENU m WHERE AD_MENU_TRL.AD_Menu_ID=m.AD_Menu_ID AND m.AD_Task_ID=ft.AD_Task_ID AND AD_MENU_TRL.AD_LANGUAGE=ft.AD_LANGUAGE) WHERE EXISTS (SELECT 1 FROM AD_TASK_TRL ft, AD_MENU m WHERE AD_MENU_TRL.AD_Menu_ID=m.AD_Menu_ID AND m.AD_Task_ID=ft.AD_Task_ID AND AD_MENU_TRL.AD_LANGUAGE=ft.AD_LANGUAGE AND m.AD_Task_ID IS NOT NULL AND m."action" = 'T' AND m.IsCentrallyMaintained='Y' AND m.IsActive='Y')
;
UPDATE AD_MENU SET Name = (SELECT Name FROM AD_InfoWindow f WHERE AD_MENU.AD_InfoWindow_ID=f.AD_InfoWindow_ID), Description = (SELECT Description FROM AD_InfoWindow f WHERE AD_MENU.AD_InfoWindow_ID=f.AD_InfoWindow_ID) WHERE AD_MENU.AD_InfoWindow_ID IS NOT NULL AND AD_MENU."action" = 'I' AND AD_MENU.IsCentrallyMaintained='Y' AND AD_MENU.IsActive='Y'
;
UPDATE AD_MENU_TRL SET Name = (SELECT ft.Name FROM AD_InfoWindow_TRL ft, AD_MENU m WHERE AD_MENU_TRL.AD_Menu_ID=m.AD_Menu_ID AND m.AD_InfoWindow_ID=ft.AD_InfoWindow_ID AND AD_MENU_TRL.AD_LANGUAGE=ft.AD_LANGUAGE), Description = (SELECT ft.Description FROM AD_InfoWindow_TRL ft, AD_MENU m WHERE AD_MENU_TRL.AD_Menu_ID=m.AD_Menu_ID AND m.AD_InfoWindow_ID=ft.AD_InfoWindow_ID AND AD_MENU_TRL.AD_LANGUAGE=ft.AD_LANGUAGE), IsTranslated = (SELECT ft.IsTranslated FROM AD_InfoWindow_TRL ft, AD_MENU m WHERE AD_MENU_TRL.AD_Menu_ID=m.AD_Menu_ID AND m.AD_InfoWindow_ID=ft.AD_InfoWindow_ID AND AD_MENU_TRL.AD_LANGUAGE=ft.AD_LANGUAGE) WHERE EXISTS (SELECT 1 FROM AD_InfoWindow_TRL ft, AD_MENU m WHERE AD_MENU_TRL.AD_Menu_ID=m.AD_Menu_ID AND m.AD_InfoWindow_ID=ft.AD_InfoWindow_ID AND AD_MENU_TRL.AD_LANGUAGE=ft.AD_LANGUAGE AND m.AD_InfoWindow_ID IS NOT NULL AND m."action" = 'I' AND m.IsCentrallyMaintained='Y' AND m.IsActive='Y')
;
UPDATE AD_COLUMN_TRL SET Name = (SELECT e.Name FROM AD_COLUMN c INNER JOIN AD_ELEMENT_TRL e ON (c.AD_Element_ID=e.AD_Element_ID) WHERE AD_COLUMN_TRL.AD_Column_ID=c.AD_Column_ID AND AD_COLUMN_TRL.AD_LANGUAGE=e.AD_LANGUAGE) WHERE EXISTS (SELECT 1 FROM AD_COLUMN c INNER JOIN AD_ELEMENT_TRL e ON (c.AD_Element_ID=e.AD_Element_ID) WHERE AD_COLUMN_TRL.AD_Column_ID=c.AD_Column_ID AND AD_COLUMN_TRL.AD_LANGUAGE=e.AD_LANGUAGE AND AD_COLUMN_TRL.Name<>e.Name)
;

View File

@ -72,6 +72,20 @@ public class MForm extends X_AD_Form
MFormAccess pa = new MFormAccess(this, AD_Role_ID);
pa.saveEx();
}
// Menu
else if (is_ValueChanged("IsActive") || is_ValueChanged("Name")
|| is_ValueChanged("Description"))
{
MMenu[] menues = MMenu.get(getCtx(), "AD_Form_ID=" + getAD_Form_ID(), get_TrxName());
for (int i = 0; i < menues.length; i++)
{
menues[i].setName(getName());
menues[i].setDescription(getDescription());
menues[i].setIsActive(isActive());
menues[i].saveEx();
}
//
}
return success;
} // afterSave

View File

@ -34,7 +34,7 @@ public class MInfoWindow extends X_AD_InfoWindow
/**
*
*/
private static final long serialVersionUID = 4040291733093824436L;
private static final long serialVersionUID = -8062633099053363108L;
/**
* Standard Constructor
@ -130,7 +130,7 @@ public class MInfoWindow extends X_AD_InfoWindow
@Override
protected boolean afterSave(boolean newRecord, boolean success) {
if (newRecord && success) // Add to all automatic roles
if (newRecord) // Add to all automatic roles
{
MRole[] roles = MRole.getOf(getCtx(), "IsManual='N'");
for (int i = 0; i < roles.length; i++)
@ -139,6 +139,20 @@ public class MInfoWindow extends X_AD_InfoWindow
wa.saveEx();
}
}
// Menu
else if (is_ValueChanged("IsActive") || is_ValueChanged("Name")
|| is_ValueChanged("Description"))
{
MMenu[] menues = MMenu.get(getCtx(), "AD_InfoWindow_ID=" + getAD_InfoWindow_ID(), get_TrxName());
for (int i = 0; i < menues.length; i++)
{
menues[i].setName(getName());
menues[i].setDescription(getDescription());
menues[i].setIsActive(isActive());
menues[i].saveEx();
}
//
}
return super.afterSave(newRecord, success);
}

View File

@ -35,7 +35,7 @@ public class MTask extends X_AD_Task
/**
*
*/
private static final long serialVersionUID = -3798377076931060582L;
private static final long serialVersionUID = 5286481246615520755L;
/**
* Standard Constructor
@ -143,5 +143,34 @@ public class MTask extends X_AD_Task
.append ("]");
return sb.toString ();
} // toString
/**
* After Save.
* @param newRecord new record
* @param success success
* @return true if save complete (if not overwritten true)
*/
protected boolean afterSave (boolean newRecord, boolean success)
{
if (log.isLoggable(Level.FINE)) log.fine("Success=" + success);
if (! newRecord)
{
// Menu/Workflow
if (is_ValueChanged("IsActive") || is_ValueChanged("Name")
|| is_ValueChanged("Description"))
{
MMenu[] menues = MMenu.get(getCtx(), "AD_Task_ID=" + getAD_Task_ID(), get_TrxName());
for (int i = 0; i < menues.length; i++)
{
menues[i].setIsActive(isActive());
menues[i].setName(getName());
menues[i].setDescription(getDescription());
menues[i].saveEx();
}
}
}
return success;
} // afterSave
} // MTask

View File

@ -55,8 +55,7 @@ public class MWorkflow extends X_AD_Workflow
/**
*
*/
private static final long serialVersionUID = 4925514638954671534L;
private static final long serialVersionUID = 1905448790453650036L;
/**
* Get Workflow from Cache
@ -637,7 +636,7 @@ public class MWorkflow extends X_AD_Workflow
}
// Menu/Workflow
else if (is_ValueChanged("IsActive") || is_ValueChanged(COLUMNNAME_Name)
|| is_ValueChanged(COLUMNNAME_Description) || is_ValueChanged(COLUMNNAME_Help))
|| is_ValueChanged(COLUMNNAME_Description))
{
MMenu[] menues = MMenu.get(getCtx(), "AD_Workflow_ID=" + getAD_Workflow_ID(), get_TrxName());
for (int i = 0; i < menues.length; i++)
@ -647,26 +646,6 @@ public class MWorkflow extends X_AD_Workflow
menues[i].setDescription(getDescription());
menues[i].saveEx();
}
// TODO: teo_sarca: why do we need to sync node name with workflow name? - see BF 2665963
// X_AD_WF_Node[] nodes = MWindow.getWFNodes(getCtx(), "AD_Workflow_ID=" + getAD_Workflow_ID(), get_TrxName());
// for (int i = 0; i < nodes.length; i++)
// {
// boolean changed = false;
// if (nodes[i].isActive() != isActive())
// {
// nodes[i].setIsActive(isActive());
// changed = true;
// }
// if (nodes[i].isCentrallyMaintained())
// {
// nodes[i].setName(getName());
// nodes[i].setDescription(getDescription());
// nodes[i].setHelp(getHelp());
// changed = true;
// }
// if (changed)
// nodes[i].saveEx();
// }
}
return success;