From b85f11d738b07df20159dcbbf69c9113e3ce68d2 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 16 Jun 2011 21:56:58 -0500 Subject: [PATCH] fixes #40 New resource assignment cannot be saved if logged in without org http://bitbucket.org/idempiere/idempiere/issue/40 --- .../src/org/adempiere/webui/editor/WAssignmentEditor.java | 8 ++++++++ .../src/org/adempiere/webui/window/InfoSchedule.java | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WAssignmentEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WAssignmentEditor.java index 8622b63878..1936b9a602 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WAssignmentEditor.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WAssignmentEditor.java @@ -131,6 +131,14 @@ public class WAssignmentEditor extends WEditor { Integer oldValue = (Integer)getValue(); int S_ResourceAssignment_ID = oldValue == null ? 0 : oldValue.intValue(); MResourceAssignment ma = new MResourceAssignment(Env.getCtx(), S_ResourceAssignment_ID, null); + if (S_ResourceAssignment_ID == 0) { + if (gridField != null && gridField.getGridTab() != null) { + // assign the resource of the document if any + Object org = gridField.getGridTab().getValue("AD_Org_ID"); + if (org != null && org instanceof Integer) + ma.setAD_Org_ID((Integer) org); + } + } // Start VAssignment Dialog if (S_ResourceAssignment_ID != 0) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/InfoSchedule.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/InfoSchedule.java index dbdec558b9..833efbbb19 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/InfoSchedule.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/InfoSchedule.java @@ -530,7 +530,11 @@ public class InfoSchedule extends Window implements EventListener break; } if (slot != null) { - MResourceAssignment ma = new MResourceAssignment(Env.getCtx(), 0, null); + MResourceAssignment ma; + if (m_mAssignment == null) + ma = new MResourceAssignment(Env.getCtx(), 0, null); + else + ma = m_mAssignment; ma.setS_Resource_ID(S_Resource_ID); ma.setAssignDateFrom(TimeUtil.getDayTime(start, slot.getStartTime()));