IDEMPIERE-3528 Add to Favorite for Menu Search Panel / fix problem because the unique key of AD_TreeBar is not including ad_client_id

This commit is contained in:
Carlos Ruiz 2019-03-18 19:57:10 -03:00
parent a56d51fc8a
commit 5e8c2b26aa
3 changed files with 21 additions and 4 deletions

View File

@ -0,0 +1,8 @@
UPDATE ad_treebar SET ad_client_id=(SELECT ad_client_id FROM ad_user WHERE ad_user.ad_user_id=ad_treebar.ad_user_id)
WHERE ad_client_id!=(SELECT ad_client_id FROM ad_user WHERE ad_user.ad_user_id=ad_treebar.ad_user_id);
UPDATE ad_treebar SET ad_org_id=0 WHERE ad_org_id!=0;
SELECT register_migration_script('201903181955_IDEMPIERE-3528.sql') FROM dual
;

View File

@ -0,0 +1,8 @@
UPDATE ad_treebar SET ad_client_id=(SELECT ad_client_id FROM ad_user WHERE ad_user.ad_user_id=ad_treebar.ad_user_id)
WHERE ad_client_id!=(SELECT ad_client_id FROM ad_user WHERE ad_user.ad_user_id=ad_treebar.ad_user_id);
UPDATE ad_treebar SET ad_org_id=0 WHERE ad_org_id!=0;
SELECT register_migration_script('201903181955_IDEMPIERE-3528.sql') FROM dual
;

View File

@ -3,6 +3,8 @@
*/
package org.adempiere.webui.desktop;
import static org.compiere.model.SystemIDs.TREE_MENUPRIMARY;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.LinkedHashMap;
@ -12,12 +14,11 @@ import java.util.Map;
import org.adempiere.util.Callback;
import org.compiere.model.MTree;
import org.compiere.model.MTreeNode;
import org.compiere.model.MUser;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.zkoss.zk.ui.Session;
import static org.compiere.model.SystemIDs.TREE_MENUPRIMARY;
/**
* @author hengsin
*
@ -83,8 +84,8 @@ public class FavouriteController {
private boolean barDBupdate(boolean add, int Node_ID)
{
int AD_Client_ID = Env.getAD_Client_ID(Env.getCtx());
int AD_Org_ID = Env.getContextAsInt(Env.getCtx(), "#AD_Org_ID");
int AD_Client_ID = MUser.get(Env.getCtx()).getAD_Client_ID();
int AD_Org_ID = 0;
int AD_User_ID = Env.getContextAsInt(Env.getCtx(), "#AD_User_ID");
StringBuilder sql = new StringBuilder();
if (add)