This is an automated email from the ASF dual-hosted git repository.
jleroux pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git The following commit(s) were added to refs/heads/trunk by this push: new c8a7c7d Fixed: Create Payment service throws an exception when receiving payment on order (OFBIZ-11754) (#166) c8a7c7d is described below commit c8a7c7dd2344b2377f47331e8c7629c454144c5b Author: Priya Sharma <[hidden email]> AuthorDate: Sat May 30 15:23:53 2020 +0530 Fixed: Create Payment service throws an exception when receiving payment on order (OFBIZ-11754) (#166) * [Fixed] Create Payment service throws exception when receiving payment on order - Since the MODULE variable could not be found, the service was throwing error - Instead used the groovy method directly to print the log instead, which has access to the module variable implicitly. - Removed the unused import as Debug class is not longer needed here. (OFBIZ-11754) * [Improved] The content groovy services to avoid the error in case we try to log a detail, since the module variable is not found. (OFBIZ-11754) * Update ContentServices.groovy * [Improved] Added error logs instead of info logs for service excpetions logging. (OFBIZ-11754) Co-authored-by: Priya Sharma <[hidden email]> Co-authored-by: Suraj Khurana <[hidden email]> --- .../groovyScripts/payment/PaymentServices.groovy | 8 +++----- .../groovyScripts/content/ContentServices.groovy | 24 ++++++++++------------ 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/applications/accounting/groovyScripts/payment/PaymentServices.groovy b/applications/accounting/groovyScripts/payment/PaymentServices.groovy index 4032017..3317ccd 100644 --- a/applications/accounting/groovyScripts/payment/PaymentServices.groovy +++ b/applications/accounting/groovyScripts/payment/PaymentServices.groovy @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ -import org.apache.ofbiz.base.util.Debug import org.apache.ofbiz.base.util.UtilDateTime import org.apache.ofbiz.base.util.UtilFormatOut import org.apache.ofbiz.base.util.UtilProperties @@ -27,7 +26,6 @@ import org.apache.ofbiz.service.ModelService import org.apache.ofbiz.service.ServiceUtil import java.sql.Timestamp -MODULE = "PaymentServices.groovy" def createPayment() { if (!security.hasEntityPermission("ACCOUNTING", "_CREATE", parameters.userLogin) && (!security.hasEntityPermission("PAY_INFO", "_CREATE", parameters.userLogin) && userLogin.partyId != parameters.partyIdFrom && userLogin.partyId != parameters.partyIdTo)) { return error(UtilProperties.getResourceBundleMap("AccountingUiLabels", locale)?.AccountingCreatePaymentPermissionError) @@ -41,7 +39,7 @@ def createPayment() { if (parameters.paymentMethodId) { GenericValue paymentMethod = from("PaymentMethod").where("paymentMethodId", parameters.paymentMethodId).queryOne() if (parameters.paymentMethodTypeId != paymentMethod.paymentMethodTypeId) { - Debug.logInfo("Replacing passed payment method type [" + parameters.paymentMethodTypeId + "] with payment method type [" + paymentMethod.paymentMethodTypeId + "] for payment method [" + parameters.paymentMethodId +"]", MODULE) + logInfo("Replacing passed payment method type [" + parameters.paymentMethodTypeId + "] with payment method type [" + paymentMethod.paymentMethodTypeId + "] for payment method [" + parameters.paymentMethodId +"]") parameters.paymentMethodTypeId = paymentMethod.paymentMethodTypeId } } @@ -96,8 +94,8 @@ def updatePayment() { if (payment.paymentMethodId) { paymentMethod = from("PaymentMethod").where("paymentMethodId", payment.paymentMethodId).queryOne() if (payment.paymentMethodTypeId != paymentMethod.paymentMethodTypeId) { - Debug.logInfo("Replacing passed payment method type [" + parameters.paymentMethodTypeId + "] with payment method type [" + - paymentMethod.paymentMethodTypeId + "] for payment method [" + parameters.paymentMethodId +"]", MODULE) + logInfo("Replacing passed payment method type [" + parameters.paymentMethodTypeId + "] with payment method type [" + + paymentMethod.paymentMethodTypeId + "] for payment method [" + parameters.paymentMethodId +"]") } payment.paymentMethodTypeId = paymentMethod.paymentMethodTypeId } diff --git a/applications/content/groovyScripts/content/ContentServices.groovy b/applications/content/groovyScripts/content/ContentServices.groovy index c9680dd..efb8bd0 100644 --- a/applications/content/groovyScripts/content/ContentServices.groovy +++ b/applications/content/groovyScripts/content/ContentServices.groovy @@ -28,10 +28,8 @@ import org.apache.ofbiz.service.GenericServiceException; import org.apache.ofbiz.service.ModelService import org.apache.ofbiz.service.ServiceUtil -import org.apache.ofbiz.base.util.Debug import org.apache.ofbiz.base.util.UtilDateTime -MODULE = "ContentServices.groovy" def createTextAndUploadedContent(){ Map result = success() @@ -115,7 +113,7 @@ def createContentAlternativeUrl() { dataResourceId = serviceResult.dataResourceId } } catch (GenericServiceException e) { - Debug.logInfo(e, MODULE) + logError(e.getMessage()) } if (dataResourceId) { serviceContext.clear() @@ -129,7 +127,7 @@ def createContentAlternativeUrl() { contentIdTo = serviceResult.contentId } } catch (GenericServiceException e) { - Debug.logInfo(e, MODULE) + logError(e.getMessage()) } if (contentIdTo) { serviceContext.clear() @@ -143,7 +141,7 @@ def createContentAlternativeUrl() { contentIdTo = serviceResult.contentId } } catch (GenericServiceException e) { - Debug.logInfo(e, MODULE) + logError(e.getMessage()) } } } @@ -165,7 +163,7 @@ def createContentAlternativeUrl() { contentIdTo = serviceResult.contentId } } catch (GenericServiceException e) { - Debug.logInfo(e, MODULE) + logError(e.getMessage()) } contentCreated = "Y" } @@ -208,16 +206,16 @@ def createArticleContent() { String contentId = null if (textData) { int textDataLen = textData.length() - Debug.logInfo("textDataLen: " + textDataLen, module) + logInfo("textDataLen: " + textDataLen) int descriptLen = 0 if (parameters.descriptLen) { descriptLen = (int) parameters.descriptLen - Debug.logInfo("descriptLen: " + descriptLen, module) + logInfo("descriptLen: " + descriptLen) } int subStringLen = Math.min(descriptLen, textDataLen) - Debug.logInfo("subStringLen: " + subStringLen, module) + logInfo("subStringLen: " + subStringLen) subDescript = textData.substring(0, subStringLen) - Debug.logInfo("subDescript: " + subDescript, module) + logInfo("subDescript: " + subDescript) } if ("PUBLISH_LINK".equals(contentAssocTypeId)) { ownerContentId = pubPtContentId @@ -281,7 +279,7 @@ def createArticleContent() { createText.textData = textData createText.contentIdFrom = contentIdFrom createText.partyId = userLogin.partyId - Debug.logInfo("calling createTextContent with map: " + createText, module) + logInfo("calling createTextContent with map: " + createText) Map serviceResult = run service: "createTextContent", with: createText String textContentId = ServiceUtil.isSuccess(serviceResult)? serviceResult.contentId : null if (!contentId) { @@ -312,7 +310,7 @@ def createArticleContent() { contentAssocMap.contentId = pubPtContentId contentAssocMap.contentIdTo = contentId contentAssocMap.contentAssocTypeId = "RESPONSE" - Debug.logInfo("contentAssocMap: " + contentAssocMap, module) + logInfo("contentAssocMap: " + contentAssocMap) run service: "createContentAssoc", with: contentAssocMap } Map result = success() @@ -358,4 +356,4 @@ def updateDownloadContent() { result = runService("updateOtherDataResource", [dataResourceId: parameters.fileDataResourceId, dataResourceContent: parameters.file]) } return result -} \ No newline at end of file +} |
Free forum by Nabble | Edit this page |