Related to issue 30070: code review improvements
authorVíctor Martínez Romanos <victor.martinez@openbravo.com>
Tue, 02 Jun 2015 18:13:05 +0200
changeset 26862 cf75c68bd2e0
parent 26861 72a46a4bb692
child 26864 10f9c780eb22
Related to issue 30070: code review improvements

Improved exception message with a bit of context.
Set Document No. related fields as centrally maintained = N and renamed to Invoice No. and Order No.
src-db/database/sourcedata/AD_FIELD.xml
src/org/openbravo/erpCommon/utility/ReferencedLink.java
--- a/src-db/database/sourcedata/AD_FIELD.xml	Tue Jun 02 11:59:51 2015 +0200
+++ b/src-db/database/sourcedata/AD_FIELD.xml	Tue Jun 02 18:13:05 2015 +0200
@@ -197905,10 +197905,10 @@
 <!--34E0280E1EA348DE8BC1CEEFD0508424-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
 <!--34E0280E1EA348DE8BC1CEEFD0508424-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--34E0280E1EA348DE8BC1CEEFD0508424-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--34E0280E1EA348DE8BC1CEEFD0508424-->  <NAME><![CDATA[Document No.]]></NAME>
+<!--34E0280E1EA348DE8BC1CEEFD0508424-->  <NAME><![CDATA[Order No.]]></NAME>
 <!--34E0280E1EA348DE8BC1CEEFD0508424-->  <DESCRIPTION><![CDATA[An often automatically generated identifier for all documents.]]></DESCRIPTION>
 <!--34E0280E1EA348DE8BC1CEEFD0508424-->  <HELP><![CDATA[The document number is usually automatically generated by the system and determined by the document type of the document. If the document is not saved, the preliminary number is displayed in "<>". If the document type of your document has no automatic document sequence defined, the field will be empty when creating a new document. This is for documents which usually have an external number (like vendor invoice).  If you leave the field empty, the system will generate a document number for you. The document sequence used for this fallback number is defined in the "Document Sequence" window with the name "DocumentNo_<TableName>", where TableName is the actual name of the table inside the database (e.g. C_Order).]]></HELP>
-<!--34E0280E1EA348DE8BC1CEEFD0508424-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--34E0280E1EA348DE8BC1CEEFD0508424-->  <ISCENTRALLYMAINTAINED><![CDATA[N]]></ISCENTRALLYMAINTAINED>
 <!--34E0280E1EA348DE8BC1CEEFD0508424-->  <AD_TAB_ID><![CDATA[809C66481863428C8D714F2018644CC6]]></AD_TAB_ID>
 <!--34E0280E1EA348DE8BC1CEEFD0508424-->  <AD_COLUMN_ID><![CDATA[2169]]></AD_COLUMN_ID>
 <!--34E0280E1EA348DE8BC1CEEFD0508424-->  <PROPERTY><![CDATA[orderPaymentSchedule.order.documentNo]]></PROPERTY>
@@ -227041,10 +227041,10 @@
 <!--6A80E7A6014749B4926F6822651F1A2B-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
 <!--6A80E7A6014749B4926F6822651F1A2B-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--6A80E7A6014749B4926F6822651F1A2B-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--6A80E7A6014749B4926F6822651F1A2B-->  <NAME><![CDATA[Document No.]]></NAME>
+<!--6A80E7A6014749B4926F6822651F1A2B-->  <NAME><![CDATA[Invoice No.]]></NAME>
 <!--6A80E7A6014749B4926F6822651F1A2B-->  <DESCRIPTION><![CDATA[An often automatically generated identifier for all documents.]]></DESCRIPTION>
 <!--6A80E7A6014749B4926F6822651F1A2B-->  <HELP><![CDATA[The document number is usually automatically generated by the system and determined by the document type of the document. If the document is not saved, the preliminary number is displayed in "<>". If the document type of your document has no automatic document sequence defined, the field will be empty when creating a new document. This is for documents which usually have an external number (like vendor invoice).  If you leave the field empty, the system will generate a document number for you. The document sequence used for this fallback number is defined in the "Document Sequence" window with the name "DocumentNo_<TableName>", where TableName is the actual name of the table inside the database (e.g. C_Order).]]></HELP>
-<!--6A80E7A6014749B4926F6822651F1A2B-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--6A80E7A6014749B4926F6822651F1A2B-->  <ISCENTRALLYMAINTAINED><![CDATA[N]]></ISCENTRALLYMAINTAINED>
 <!--6A80E7A6014749B4926F6822651F1A2B-->  <AD_TAB_ID><![CDATA[809C66481863428C8D714F2018644CC6]]></AD_TAB_ID>
 <!--6A80E7A6014749B4926F6822651F1A2B-->  <AD_COLUMN_ID><![CDATA[3492]]></AD_COLUMN_ID>
 <!--6A80E7A6014749B4926F6822651F1A2B-->  <PROPERTY><![CDATA[invoicePaymentSchedule.invoice.documentNo]]></PROPERTY>
@@ -253463,10 +253463,10 @@
 <!--9722B8A10DCA4CF5AED5779B782113FC-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
 <!--9722B8A10DCA4CF5AED5779B782113FC-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--9722B8A10DCA4CF5AED5779B782113FC-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--9722B8A10DCA4CF5AED5779B782113FC-->  <NAME><![CDATA[Document No.]]></NAME>
+<!--9722B8A10DCA4CF5AED5779B782113FC-->  <NAME><![CDATA[Invoice No.]]></NAME>
 <!--9722B8A10DCA4CF5AED5779B782113FC-->  <DESCRIPTION><![CDATA[An often automatically generated identifier for all documents.]]></DESCRIPTION>
 <!--9722B8A10DCA4CF5AED5779B782113FC-->  <HELP><![CDATA[The document number is usually automatically generated by the system and determined by the document type of the document. If the document is not saved, the preliminary number is displayed in "<>". If the document type of your document has no automatic document sequence defined, the field will be empty when creating a new document. This is for documents which usually have an external number (like vendor invoice).  If you leave the field empty, the system will generate a document number for you. The document sequence used for this fallback number is defined in the "Document Sequence" window with the name "DocumentNo_<TableName>", where TableName is the actual name of the table inside the database (e.g. C_Order).]]></HELP>
-<!--9722B8A10DCA4CF5AED5779B782113FC-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--9722B8A10DCA4CF5AED5779B782113FC-->  <ISCENTRALLYMAINTAINED><![CDATA[N]]></ISCENTRALLYMAINTAINED>
 <!--9722B8A10DCA4CF5AED5779B782113FC-->  <AD_TAB_ID><![CDATA[34DA12C2E9E3424E9A853563BEFDE81F]]></AD_TAB_ID>
 <!--9722B8A10DCA4CF5AED5779B782113FC-->  <AD_COLUMN_ID><![CDATA[3492]]></AD_COLUMN_ID>
 <!--9722B8A10DCA4CF5AED5779B782113FC-->  <PROPERTY><![CDATA[invoicePaymentSchedule.invoice.documentNo]]></PROPERTY>
@@ -256150,10 +256150,10 @@
 <!--9E5508C17547495AA904EE61BEF0F2CF-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
 <!--9E5508C17547495AA904EE61BEF0F2CF-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--9E5508C17547495AA904EE61BEF0F2CF-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--9E5508C17547495AA904EE61BEF0F2CF-->  <NAME><![CDATA[Document No.]]></NAME>
+<!--9E5508C17547495AA904EE61BEF0F2CF-->  <NAME><![CDATA[Order No.]]></NAME>
 <!--9E5508C17547495AA904EE61BEF0F2CF-->  <DESCRIPTION><![CDATA[An often automatically generated identifier for all documents.]]></DESCRIPTION>
 <!--9E5508C17547495AA904EE61BEF0F2CF-->  <HELP><![CDATA[The document number is usually automatically generated by the system and determined by the document type of the document. If the document is not saved, the preliminary number is displayed in "<>". If the document type of your document has no automatic document sequence defined, the field will be empty when creating a new document. This is for documents which usually have an external number (like vendor invoice).  If you leave the field empty, the system will generate a document number for you. The document sequence used for this fallback number is defined in the "Document Sequence" window with the name "DocumentNo_<TableName>", where TableName is the actual name of the table inside the database (e.g. C_Order).]]></HELP>
-<!--9E5508C17547495AA904EE61BEF0F2CF-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--9E5508C17547495AA904EE61BEF0F2CF-->  <ISCENTRALLYMAINTAINED><![CDATA[N]]></ISCENTRALLYMAINTAINED>
 <!--9E5508C17547495AA904EE61BEF0F2CF-->  <AD_TAB_ID><![CDATA[34DA12C2E9E3424E9A853563BEFDE81F]]></AD_TAB_ID>
 <!--9E5508C17547495AA904EE61BEF0F2CF-->  <AD_COLUMN_ID><![CDATA[2169]]></AD_COLUMN_ID>
 <!--9E5508C17547495AA904EE61BEF0F2CF-->  <PROPERTY><![CDATA[orderPaymentSchedule.order.documentNo]]></PROPERTY>
--- a/src/org/openbravo/erpCommon/utility/ReferencedLink.java	Tue Jun 02 11:59:51 2015 +0200
+++ b/src/org/openbravo/erpCommon/utility/ReferencedLink.java	Tue Jun 02 18:13:05 2015 +0200
@@ -245,7 +245,11 @@
           OBContext.setAdminMode();
           if (StringUtils.isEmpty(strKeyReferenceId)
               || StringUtils.equals(strKeyReferenceId, "null")) {
-            throw new ServletException("Record empty");
+            throw new ServletException(
+                String
+                    .format(
+                        "Empty Record: browse to referenced record not possible. strTableReferenceId = '%s',  strWindowId = '%s' ",
+                        strTableReferenceId, strWindowId));
           } else {
             FIN_PaymentSchedule paymentSchedule = OBDal.getInstance().get(
                 FIN_PaymentSchedule.class, strKeyReferenceId);