IDEMPIERE-669 Zk: User Feedback Service. Make more extensible.
This commit is contained in:
parent
2bfa8b0e03
commit
e30f4dca4e
|
@ -676,6 +676,14 @@ public final class MLookup extends Lookup implements Serializable
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return lookup info
|
||||||
|
*/
|
||||||
|
public MLookupInfo getLookupInfo()
|
||||||
|
{
|
||||||
|
return m_info;
|
||||||
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* MLookup Loader
|
* MLookup Loader
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -75,12 +75,12 @@ public class FeedbackRequestWindow extends Window implements EventListener<Event
|
||||||
|
|
||||||
private static CLogger log = CLogger.getCLogger(FeedbackRequestWindow.class);
|
private static CLogger log = CLogger.getCLogger(FeedbackRequestWindow.class);
|
||||||
|
|
||||||
private WTableDirEditor requestTypeField, priorityField, salesRepField;
|
protected WTableDirEditor requestTypeField, priorityField, salesRepField;
|
||||||
private Textbox txtSummary;
|
protected Textbox txtSummary;
|
||||||
private ConfirmPanel confirmPanel;
|
protected ConfirmPanel confirmPanel;
|
||||||
|
|
||||||
private List<DataSource> attachments = new ArrayList<DataSource>();
|
protected List<DataSource> attachments = new ArrayList<DataSource>();
|
||||||
private Div attachmentBox;
|
protected Div attachmentBox;
|
||||||
|
|
||||||
public FeedbackRequestWindow() {
|
public FeedbackRequestWindow() {
|
||||||
|
|
||||||
|
@ -224,15 +224,33 @@ public class FeedbackRequestWindow extends Window implements EventListener<Event
|
||||||
if (salesRepField.getValue() == null || salesRepField.getValue().equals("0"))
|
if (salesRepField.getValue() == null || salesRepField.getValue().equals("0"))
|
||||||
throw new WrongValueException(salesRepField.getComponent(), Msg.translate(Env.getCtx(), "FillMandatory"));
|
throw new WrongValueException(salesRepField.getComponent(), Msg.translate(Env.getCtx(), "FillMandatory"));
|
||||||
|
|
||||||
|
saveRequest();
|
||||||
|
|
||||||
|
this.detach();
|
||||||
|
}
|
||||||
|
else if (e.getTarget() == confirmPanel.getButton(ConfirmPanel.A_CANCEL))
|
||||||
|
{
|
||||||
|
this.detach();
|
||||||
|
}
|
||||||
|
else if (e instanceof UploadEvent)
|
||||||
|
{
|
||||||
|
UploadEvent ue = (UploadEvent) e;
|
||||||
|
Media media = ue.getMedia();
|
||||||
|
if (media != null)
|
||||||
|
{
|
||||||
|
byte[] data = getMediaData(media);
|
||||||
|
ByteArrayDataSource dataSource = new ByteArrayDataSource(data, media.getContentType());
|
||||||
|
dataSource.setName(media.getName());
|
||||||
|
addAttachment(dataSource, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void saveRequest() throws IOException {
|
||||||
Trx trx = Trx.get(Trx.createTrxName("SaveNewRequest"), true);
|
Trx trx = Trx.get(Trx.createTrxName("SaveNewRequest"), true);
|
||||||
try {
|
try {
|
||||||
trx.start();
|
trx.start();
|
||||||
MRequest request = new MRequest(Env.getCtx(), 0, trx.getTrxName());
|
MRequest request = createMRequest(trx);
|
||||||
request.setAD_Org_ID(Env.getAD_Org_ID(Env.getCtx()));
|
|
||||||
request.setR_RequestType_ID((Integer) requestTypeField.getValue());
|
|
||||||
request.setPriority((String) priorityField.getValue());
|
|
||||||
request.setSummary(txtSummary.getText());
|
|
||||||
request.setSalesRep_ID((Integer) salesRepField.getValue());
|
|
||||||
|
|
||||||
boolean success = request.save();
|
boolean success = request.save();
|
||||||
if (success)
|
if (success)
|
||||||
|
@ -269,25 +287,16 @@ public class FeedbackRequestWindow extends Window implements EventListener<Event
|
||||||
} finally {
|
} finally {
|
||||||
trx.close();
|
trx.close();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.detach();
|
protected MRequest createMRequest(Trx trx) {
|
||||||
}
|
MRequest request = new MRequest(Env.getCtx(), 0, trx.getTrxName());
|
||||||
else if (e.getTarget() == confirmPanel.getButton(ConfirmPanel.A_CANCEL))
|
request.setAD_Org_ID(Env.getAD_Org_ID(Env.getCtx()));
|
||||||
{
|
request.setR_RequestType_ID((Integer) requestTypeField.getValue());
|
||||||
this.detach();
|
request.setPriority((String) priorityField.getValue());
|
||||||
}
|
request.setSummary(txtSummary.getText());
|
||||||
else if (e instanceof UploadEvent)
|
request.setSalesRep_ID((Integer) salesRepField.getValue());
|
||||||
{
|
return request;
|
||||||
UploadEvent ue = (UploadEvent) e;
|
|
||||||
Media media = ue.getMedia();
|
|
||||||
if (media != null)
|
|
||||||
{
|
|
||||||
byte[] data = getMediaData(media);
|
|
||||||
ByteArrayDataSource dataSource = new ByteArrayDataSource(data, media.getContentType());
|
|
||||||
dataSource.setName(media.getName());
|
|
||||||
addAttachment(dataSource, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addAttachment(DataSource dataSource, boolean removable) {
|
public void addAttachment(DataSource dataSource, boolean removable) {
|
||||||
|
|
|
@ -467,6 +467,11 @@ ContextMenuListener, IZoomableEditor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Lookup getLookup()
|
||||||
|
{
|
||||||
|
return lookup;
|
||||||
|
}
|
||||||
|
|
||||||
private void onNewRecord() {
|
private void onNewRecord() {
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class DefaultFeedbackService implements IFeedbackService {
|
||||||
new CreateNewRequestAction();
|
new CreateNewRequestAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class EmailSupportAction implements EventListener<Event>{
|
protected static class EmailSupportAction implements EventListener<Event>{
|
||||||
|
|
||||||
private boolean errorOnly;
|
private boolean errorOnly;
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ public class DefaultFeedbackService implements IFeedbackService {
|
||||||
showEmailDialog(imageBytes);
|
showEmailDialog(imageBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showEmailDialog(byte[] imageBytes) {
|
protected void showEmailDialog(byte[] imageBytes) {
|
||||||
DataSource ds = FeedbackManager.getLogAttachment(errorOnly);
|
DataSource ds = FeedbackManager.getLogAttachment(errorOnly);
|
||||||
|
|
||||||
WEMailDialog dialog = new WEMailDialog(
|
WEMailDialog dialog = new WEMailDialog(
|
||||||
|
@ -122,7 +122,7 @@ public class DefaultFeedbackService implements IFeedbackService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class CreateNewRequestAction implements EventListener<Event>{
|
protected static class CreateNewRequestAction implements EventListener<Event>{
|
||||||
protected CreateNewRequestAction() {
|
protected CreateNewRequestAction() {
|
||||||
SessionManager.getAppDesktop().getComponent().addEventListener("onCreateFeedbackRequest", this);
|
SessionManager.getAppDesktop().getComponent().addEventListener("onCreateFeedbackRequest", this);
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ public class DefaultFeedbackService implements IFeedbackService {
|
||||||
showRequestDialog(imageBytes);
|
showRequestDialog(imageBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showRequestDialog(byte[] imageBytes) {
|
protected void showRequestDialog(byte[] imageBytes) {
|
||||||
FeedbackRequestWindow window = new FeedbackRequestWindow();
|
FeedbackRequestWindow window = new FeedbackRequestWindow();
|
||||||
AEnv.showWindow(window);
|
AEnv.showWindow(window);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue