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 lookup info
|
||||
*/
|
||||
public MLookupInfo getLookupInfo()
|
||||
{
|
||||
return m_info;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* MLookup Loader
|
||||
*/
|
||||
|
|
|
@ -75,12 +75,12 @@ public class FeedbackRequestWindow extends Window implements EventListener<Event
|
|||
|
||||
private static CLogger log = CLogger.getCLogger(FeedbackRequestWindow.class);
|
||||
|
||||
private WTableDirEditor requestTypeField, priorityField, salesRepField;
|
||||
private Textbox txtSummary;
|
||||
private ConfirmPanel confirmPanel;
|
||||
protected WTableDirEditor requestTypeField, priorityField, salesRepField;
|
||||
protected Textbox txtSummary;
|
||||
protected ConfirmPanel confirmPanel;
|
||||
|
||||
private List<DataSource> attachments = new ArrayList<DataSource>();
|
||||
private Div attachmentBox;
|
||||
protected List<DataSource> attachments = new ArrayList<DataSource>();
|
||||
protected Div attachmentBox;
|
||||
|
||||
public FeedbackRequestWindow() {
|
||||
|
||||
|
@ -224,15 +224,33 @@ public class FeedbackRequestWindow extends Window implements EventListener<Event
|
|||
if (salesRepField.getValue() == null || salesRepField.getValue().equals("0"))
|
||||
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);
|
||||
try {
|
||||
trx.start();
|
||||
MRequest request = new MRequest(Env.getCtx(), 0, trx.getTrxName());
|
||||
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());
|
||||
MRequest request = createMRequest(trx);
|
||||
|
||||
boolean success = request.save();
|
||||
if (success)
|
||||
|
@ -269,25 +287,16 @@ public class FeedbackRequestWindow extends Window implements EventListener<Event
|
|||
} finally {
|
||||
trx.close();
|
||||
}
|
||||
}
|
||||
|
||||
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 MRequest createMRequest(Trx trx) {
|
||||
MRequest request = new MRequest(Env.getCtx(), 0, trx.getTrxName());
|
||||
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());
|
||||
return request;
|
||||
}
|
||||
|
||||
public void addAttachment(DataSource dataSource, boolean removable) {
|
||||
|
|
|
@ -467,6 +467,11 @@ ContextMenuListener, IZoomableEditor
|
|||
}
|
||||
}
|
||||
|
||||
public Lookup getLookup()
|
||||
{
|
||||
return lookup;
|
||||
}
|
||||
|
||||
private void onNewRecord() {
|
||||
try
|
||||
{
|
||||
|
|
|
@ -62,7 +62,7 @@ public class DefaultFeedbackService implements IFeedbackService {
|
|||
new CreateNewRequestAction();
|
||||
}
|
||||
|
||||
private static class EmailSupportAction implements EventListener<Event>{
|
||||
protected static class EmailSupportAction implements EventListener<Event>{
|
||||
|
||||
private boolean errorOnly;
|
||||
|
||||
|
@ -96,7 +96,7 @@ public class DefaultFeedbackService implements IFeedbackService {
|
|||
showEmailDialog(imageBytes);
|
||||
}
|
||||
|
||||
private void showEmailDialog(byte[] imageBytes) {
|
||||
protected void showEmailDialog(byte[] imageBytes) {
|
||||
DataSource ds = FeedbackManager.getLogAttachment(errorOnly);
|
||||
|
||||
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() {
|
||||
SessionManager.getAppDesktop().getComponent().addEventListener("onCreateFeedbackRequest", this);
|
||||
|
||||
|
@ -152,7 +152,7 @@ public class DefaultFeedbackService implements IFeedbackService {
|
|||
showRequestDialog(imageBytes);
|
||||
}
|
||||
|
||||
private void showRequestDialog(byte[] imageBytes) {
|
||||
protected void showRequestDialog(byte[] imageBytes) {
|
||||
FeedbackRequestWindow window = new FeedbackRequestWindow();
|
||||
AEnv.showWindow(window);
|
||||
|
||||
|
|
Loading…
Reference in New Issue