From 16032399fa75d50704a4810a6fc89ee3b624e879 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 7 Jul 2021 19:25:08 +0200 Subject: [PATCH] IDEMPIERE-3101 implement OAuth2 for mail (gmail, outlook and other mail system) (#772) Save the ad_pinstance_log record out of the method to independize it from the pinstance --- .../src/org/compiere/model/MAuthorizationCredential.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MAuthorizationCredential.java b/org.adempiere.base/src/org/compiere/model/MAuthorizationCredential.java index d3988dbd73..79a53d7308 100644 --- a/org.adempiere.base/src/org/compiere/model/MAuthorizationCredential.java +++ b/org.adempiere.base/src/org/compiere/model/MAuthorizationCredential.java @@ -108,6 +108,7 @@ public class MAuthorizationCredential extends X_AD_AuthorizationCredential { } MPInstanceLog pilog = pinstance.addLog(null, 0, null, null, MAuthorizationAccount.Table_ID, 0); msg = processToken(Env.getCtx(), code, paramScope.getP_String(), pilog); + pilog.saveEx(); } catch (Exception ex) { ex.printStackTrace(); msg = Msg.getMsg(getCtx(), "Error") + ex.getLocalizedMessage(); @@ -122,7 +123,7 @@ public class MAuthorizationCredential extends X_AD_AuthorizationCredential { * @param ctx * @param code * @param paramScope - * @param pilog + * @param pilog MPInstanceLog to set the log message and record_ID, it is not saved, the caller must save it * @return String message indicating success */ public String processToken(Properties ctx, String code, String paramScope, MPInstanceLog pilog) { @@ -198,7 +199,6 @@ public class MAuthorizationCredential extends X_AD_AuthorizationCredential { String logmsg = Msg.parseTranslation(ctx, (newAccount ? "@Created@" : "@Updated@") + " @AD_AuthorizationAccount_ID@ for ") + account.getEMail(); pilog.setP_Msg(logmsg); pilog.setRecord_ID(account.getAD_AuthorizationAccount_ID()); - pilog.saveEx(); } account.syncOthers(); if (newAccount)