IDEMPIERE-2533 Calendar (Event) - Create request has wrong Dyn Validation (#1971)

This commit is contained in:
Carlos Ruiz 2023-08-21 09:48:40 +02:00 committed by GitHub
parent 3559371414
commit 7cd514e60a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 4 deletions

View File

@ -164,6 +164,10 @@ public class CalendarWindow extends Window implements EventListener<Event>, ITab
btnSwitchTimeZone = (Button) component.getFellow("btnSwitchTimeZone"); btnSwitchTimeZone = (Button) component.getFellow("btnSwitchTimeZone");
btnSwitchTimeZone.addEventListener(Events.ON_CLICK, this); btnSwitchTimeZone.addEventListener(Events.ON_CLICK, this);
String alternateTimeZone = MSysConfig.getValue(MSysConfig.CALENDAR_ALTERNATE_TIMEZONE, "Pacific Time=PST", Env.getAD_Client_ID(Env.getCtx()));
if (Util.isEmpty(alternateTimeZone, true))
btnSwitchTimeZone.setVisible(false);
lblDate = (Label) component.getFellow("lblDate"); lblDate = (Label) component.getFellow("lblDate");
lblDate.addEventListener(Events.ON_CREATE, this); lblDate.addEventListener(Events.ON_CREATE, this);

View File

@ -452,6 +452,7 @@ public class DPCalendar extends DashboardPanel implements EventListener<Event>,
} }
} else { } else {
desktop = new WeakReference<Desktop>(getDesktop()); desktop = new WeakReference<Desktop>(getDesktop());
if (desktop.get() != null)
desktop.get().addListener(listener); desktop.get().addListener(listener);
} }

View File

@ -18,6 +18,7 @@ import java.util.Calendar;
import java.util.Properties; import java.util.Properties;
import java.util.logging.Level; import java.util.logging.Level;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.webui.component.Borderlayout; import org.adempiere.webui.component.Borderlayout;
import org.adempiere.webui.component.Column; import org.adempiere.webui.component.Column;
import org.adempiere.webui.component.Columns; import org.adempiere.webui.component.Columns;
@ -152,8 +153,14 @@ public class RequestWindow extends Window implements EventListener<Event> {
if(confidentialField.getComponent().getItemCount() > 1) if(confidentialField.getComponent().getItemCount() > 1)
confidentialField.setValue(confidentialField.getComponent().getItemAtIndex(1).getValue()); confidentialField.setValue(confidentialField.getComponent().getItemAtIndex(1).getValue());
columnID = MColumn.getColumn_ID(MRequest.Table_Name, MRequest.COLUMNNAME_SalesRep_ID); MColumn columnSR = MColumn.get(Env.getCtx(), MRequest.Table_Name, MRequest.COLUMNNAME_SalesRep_ID);
lookup = MLookupFactory.get(ctx, 0, 0, columnID, DisplayType.TableDir); try {
lookup = MLookupFactory.get(Env.getCtx(), 0, columnSR.getAD_Column_ID(), DisplayType.TableDir,
Env.getLanguage(Env.getCtx()), columnSR.getColumnName(), columnSR.getAD_Reference_Value_ID(), false,
"(EXISTS (SELECT * FROM C_BPartner bp WHERE AD_User.C_BPartner_ID=bp.C_BPartner_ID AND (bp.IsEmployee='Y' OR bp.IsSalesRep='Y')) OR AD_User_ID=@#AD_User_ID@)");
} catch (Exception e) {
throw new AdempiereException(e);
}
salesRepField = new WTableDirEditor("SalesRep_ID", true, false, true, lookup); salesRepField = new WTableDirEditor("SalesRep_ID", true, false, true, lookup);
salesRepField.setValue(Env.getContextAsInt(ctx, "SalesRep_ID")); salesRepField.setValue(Env.getContextAsInt(ctx, "SalesRep_ID"));
if(salesRepField.getValue() == null || salesRepField.getValue().equals(0)) if(salesRepField.getValue() == null || salesRepField.getValue().equals(0))