IDEMPIERE-5989 Attachments are not accessible after upgrade from Idempiere 10 to Idempiere 11 (#2185)
* IDEMPIERE-5989 Attachments are not accessible after upgrade from Idempiere 10 to Idempiere 11 IDEMPIERE-5567 Fix issue when the window doesn't have the UUID field * - change for a more robust method (similar approach to other points)
This commit is contained in:
parent
735a735fbb
commit
0b5c7e2256
|
@ -2126,7 +2126,8 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
|||
if (!canHaveAttachment())
|
||||
return 0;
|
||||
String recordUU = m_mTable.getKeyUUID(m_currentRow);
|
||||
return MAttachment.getID(m_vo.AD_Table_ID, recordUU);
|
||||
int recordID = m_mTable.getKeyID(m_currentRow);
|
||||
return MAttachment.getID(m_vo.AD_Table_ID, recordID, recordUU);
|
||||
} // getAttachmentID
|
||||
|
||||
/**
|
||||
|
@ -2147,7 +2148,8 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
|||
if (!canHaveAttachment())
|
||||
return 0;
|
||||
String recordUU = m_mTable.getKeyUUID(m_currentRow);
|
||||
return MChat.getID(m_vo.AD_Table_ID, recordUU);
|
||||
int recordID = m_mTable.getKeyID(m_currentRow);
|
||||
return MChat.getID(m_vo.AD_Table_ID, recordID, recordUU);
|
||||
} // getCM_ChatID
|
||||
|
||||
/**
|
||||
|
@ -2167,7 +2169,8 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
|||
if (!canHaveAttachment())
|
||||
return 0;
|
||||
String recordUU = m_mTable.getKeyUUID(m_currentRow);
|
||||
return MPostIt.getID(m_vo.AD_Table_ID, recordUU);
|
||||
int recordID = m_mTable.getKeyID(m_currentRow);
|
||||
return MPostIt.getID(m_vo.AD_Table_ID, recordID, recordUU);
|
||||
} // getAD_PostIt_ID
|
||||
|
||||
/**
|
||||
|
@ -2178,7 +2181,8 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
|||
if (!canHaveAttachment())
|
||||
return false;
|
||||
String recordUU = m_mTable.getKeyUUID(m_currentRow);
|
||||
return MLabelAssignment.hasAnyAssignment(m_vo.AD_Table_ID, recordUU);
|
||||
int recordID = m_mTable.getKeyID(m_currentRow);
|
||||
return MLabelAssignment.hasAnyAssignment(m_vo.AD_Table_ID, recordID, recordUU);
|
||||
} // hasLabel
|
||||
|
||||
/**
|
||||
|
|
|
@ -165,7 +165,7 @@ public class MAttachment extends X_AD_Attachment
|
|||
*/
|
||||
public MAttachment(Properties ctx, int AD_Table_ID, int Record_ID, String Record_UU, String trxName)
|
||||
{
|
||||
this (ctx, MAttachment.getID(AD_Table_ID, Record_UU) > 0 ? MAttachment.getID(AD_Table_ID, Record_UU) : 0, trxName);
|
||||
this (ctx, (MAttachment.getID(AD_Table_ID, Record_ID, Record_UU) > 0 ? MAttachment.getID(AD_Table_ID, Record_ID, Record_UU) : 0), trxName);
|
||||
if (get_ID() == 0) {
|
||||
setAD_Table_ID (AD_Table_ID);
|
||||
setRecord_ID (Record_ID);
|
||||
|
@ -659,7 +659,7 @@ public class MAttachment extends X_AD_Attachment
|
|||
* @param Table_ID
|
||||
* @param Record_ID
|
||||
* @return AD_Attachment_ID
|
||||
* @deprecated Use {@link MAttachment#getID(int, String)} instead
|
||||
* @deprecated Use {@link MAttachment#getID(int, int, String)} instead
|
||||
*/
|
||||
public static int getID(int Table_ID, int Record_ID) {
|
||||
String sql="SELECT AD_Attachment_ID FROM AD_Attachment WHERE AD_Table_ID=? AND Record_ID=?";
|
||||
|
@ -671,10 +671,13 @@ public class MAttachment extends X_AD_Attachment
|
|||
* IDEMPIERE-530
|
||||
* Get the attachment ID based on table_id and record_uu
|
||||
* @param Table_ID
|
||||
* @param Record_ID
|
||||
* @param Record_UU record UUID
|
||||
* @return AD_Attachment_ID
|
||||
*/
|
||||
public static int getID(int Table_ID, String Record_UU) {
|
||||
public static int getID(int Table_ID, int Record_ID, String Record_UU) {
|
||||
if (Util.isEmpty(Record_UU))
|
||||
return getID(Table_ID, Record_ID);
|
||||
String sql="SELECT AD_Attachment_ID FROM AD_Attachment WHERE AD_Table_ID=? AND Record_UU=?";
|
||||
int attachid = DB.getSQLValue(null, sql, Table_ID, Record_UU);
|
||||
return attachid;
|
||||
|
|
|
@ -227,7 +227,7 @@ public class MChat extends X_CM_Chat
|
|||
* @param Table_ID
|
||||
* @param Record_ID
|
||||
* @return CM_Chat_ID
|
||||
* @deprecated Use {@link MChat#getID(int, String)} instead
|
||||
* @deprecated Use {@link MChat#getID(int, int, String)} instead
|
||||
*/
|
||||
public static int getID(int Table_ID, int Record_ID) {
|
||||
String sql="SELECT CM_Chat_ID FROM CM_Chat WHERE AD_Table_ID=? AND Record_ID=?";
|
||||
|
@ -239,9 +239,12 @@ public class MChat extends X_CM_Chat
|
|||
* Get the chat ID based on table_id and record_uu
|
||||
* @param Table_ID
|
||||
* @param Record_UU
|
||||
* @param Record_ID
|
||||
* @return CM_Chat_ID
|
||||
*/
|
||||
public static int getID(int Table_ID, String Record_UU) {
|
||||
public static int getID(int Table_ID, int Record_ID, String Record_UU) {
|
||||
if (Util.isEmpty(Record_UU))
|
||||
return getID(Table_ID, Record_ID);
|
||||
String sql="SELECT CM_Chat_ID FROM CM_Chat WHERE AD_Table_ID=? AND Record_UU=?";
|
||||
int chatID = DB.getSQLValueEx(null, sql, Table_ID, Record_UU);
|
||||
return chatID;
|
||||
|
|
|
@ -87,10 +87,13 @@ public class MLabelAssignment extends X_AD_LabelAssignment {
|
|||
/**
|
||||
* Check if record has any label assigned
|
||||
* @param Table_ID
|
||||
* @param Record_ID
|
||||
* @param Record_UU
|
||||
* @return true if record has any label assigned
|
||||
*/
|
||||
public static boolean hasAnyAssignment(int Table_ID, String Record_UU) {
|
||||
public static boolean hasAnyAssignment(int Table_ID, int Record_ID, String Record_UU) {
|
||||
if (Util.isEmpty(Record_UU))
|
||||
return hasAnyAssignment(Table_ID, Record_ID);
|
||||
String sql="SELECT COUNT(*) FROM AD_LabelAssignment WHERE AD_Table_ID=? AND Record_UU=?";
|
||||
int counter = DB.getSQLValueEx(null, sql, Table_ID, Record_UU);
|
||||
return counter > 0;
|
||||
|
|
|
@ -128,7 +128,7 @@ public class MPostIt extends X_AD_PostIt
|
|||
* @param Table_ID
|
||||
* @param Record_ID
|
||||
* @return AD_PostIt_ID
|
||||
* @deprecated Use {@link MPostIt#getID(int, String)} instead
|
||||
* @deprecated Use {@link MPostIt#getID(int, int, String)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public static int getID(int Table_ID, int Record_ID) {
|
||||
|
@ -139,10 +139,13 @@ public class MPostIt extends X_AD_PostIt
|
|||
|
||||
/**
|
||||
* @param Table_ID
|
||||
* @param Record_ID
|
||||
* @param Record_UU
|
||||
* @return AD_PostIt_ID
|
||||
*/
|
||||
public static int getID(int Table_ID, String Record_UU) {
|
||||
public static int getID(int Table_ID, int Record_ID, String Record_UU) {
|
||||
if (Util.isEmpty(Record_UU))
|
||||
return getID(Table_ID, Record_ID);
|
||||
String sql="SELECT AD_PostIt_ID FROM AD_PostIt WHERE AD_Table_ID=? AND Record_UU=?";
|
||||
int postItID = DB.getSQLValueEx(null, sql, Table_ID, Record_UU);
|
||||
return postItID;
|
||||
|
|
|
@ -88,7 +88,13 @@ public class LabelsPanel extends Div implements EventListener<Event> {
|
|||
this.abstractADWindowContent = abstractADWindowContent;
|
||||
this.AD_Table_ID = AD_Table_ID;
|
||||
this.Record_ID = Record_ID;
|
||||
if (Record_ID > 0 && Record_UU == null) {
|
||||
MTable table = MTable.get(AD_Table_ID);
|
||||
PO po = table.getPO(Record_ID, null);
|
||||
this.Record_UU = po.get_UUID();
|
||||
} else {
|
||||
this.Record_UU = Record_UU;
|
||||
}
|
||||
setStyle("padding:0px 5px;");
|
||||
addEventListener(LabelsSearchController.ON_POST_SELECT_LABELITEM_EVENT, this);
|
||||
update();
|
||||
|
|
Loading…
Reference in New Issue