IDEMPIERE-3220 read-only field can edit by development tool / peer review
This commit is contained in:
parent
ec1d6bdc00
commit
cfb33c3e20
|
|
@ -33,7 +33,7 @@ import org.zkoss.zul.impl.InputElement;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* this service is interception into desktop process,
|
* this service is interception into desktop process,
|
||||||
* it will denied request to modify a readonly file or action on readonly button
|
* it will deny request to modify a readonly field or action on readonly button
|
||||||
* @author hieplq
|
* @author hieplq
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
@ -82,15 +82,15 @@ public class ValidateReadonlyComponent implements AuService {
|
||||||
Combobox comb = null;
|
Combobox comb = null;
|
||||||
Button button = null;
|
Button button = null;
|
||||||
|
|
||||||
if (comp instanceof Combobox){// have to check before InputElement
|
if (comp instanceof Combobox) {// have to check before InputElement
|
||||||
comb = (Combobox)comp;
|
comb = (Combobox)comp;
|
||||||
}if (comp instanceof InputElement){
|
} else if (comp instanceof InputElement) {
|
||||||
inputComp = (InputElement)comp;// textbox, datebox, numberbox,...
|
inputComp = (InputElement)comp;// textbox, datebox, numberbox,...
|
||||||
}else if (comp instanceof Checkbox){
|
} else if (comp instanceof Checkbox) {
|
||||||
checkbox = (Checkbox)comp;
|
checkbox = (Checkbox)comp;
|
||||||
}if (comp instanceof Button){// have to check latest
|
} else if (comp instanceof Button) {// have to check latest
|
||||||
button = (Button)comp;
|
button = (Button)comp;
|
||||||
}else {//HtmlBasedComponent
|
} else {//HtmlBasedComponent
|
||||||
log.log(Level.SEVERE, String.format("Consider to denied event of control %1$s when it's readonly on event %2$s", comp.getClass(), cmd));
|
log.log(Level.SEVERE, String.format("Consider to denied event of control %1$s when it's readonly on event %2$s", comp.getClass(), cmd));
|
||||||
return false;// just log to investigate don't lock process
|
return false;// just log to investigate don't lock process
|
||||||
}
|
}
|
||||||
|
|
@ -102,15 +102,15 @@ public class ValidateReadonlyComponent implements AuService {
|
||||||
(comb != null && (Events.ON_CHANGE.equals(cmd) || Events.ON_SELECT.equals(cmd) || Events.ON_OPEN.equals(cmd))) ||
|
(comb != null && (Events.ON_CHANGE.equals(cmd) || Events.ON_SELECT.equals(cmd) || Events.ON_OPEN.equals(cmd))) ||
|
||||||
(button != null && (Events.ON_CLICK.equals(cmd) || Events.ON_OK.equals(cmd) || Events.ON_UPLOAD.equals(cmd)));;
|
(button != null && (Events.ON_CLICK.equals(cmd) || Events.ON_OK.equals(cmd) || Events.ON_UPLOAD.equals(cmd)));;
|
||||||
|
|
||||||
// for combobox each change have both event onchange and onselect, so will have dupplicate message
|
// for combobox each change have both event onchange and onselect, so will have duplicate message
|
||||||
// dupplicate is acceptable for hack guy
|
// duplicate is acceptable for hack guy
|
||||||
if (editing){
|
if (editing){
|
||||||
comp.invalidate();
|
comp.invalidate();
|
||||||
throw new WrongValueException ("I know you. Don't try to hack me");
|
throw new WrongValueException ("Field is read only");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue