274 lines
6.6 KiB
JavaScript
274 lines
6.6 KiB
JavaScript
function DisplayErrorMessage() {
|
|
if (Le(m_nLastError,-1)) {
|
|
return;
|
|
}
|
|
if (Eq(typeof(m_cErrorInChild),'undefined') || Empty(m_cErrorInChild)) {
|
|
var l_cErrorMsg = m_cLastMsgError;
|
|
if (Eq(l_cErrorMsg,'')) {
|
|
if (Eq(m_nLastError,1)) {
|
|
l_cErrorMsg='MSG_OBBLI_FIELD';
|
|
} else if (Eq(m_nLastError,2)) {
|
|
l_cErrorMsg='MSG_VALUE_NOT_ALLOWED';
|
|
} else if (Eq(m_nLastError,3)) {
|
|
l_cErrorMsg='MSG_VALUE_NOT_ALLOWED';
|
|
} else {
|
|
l_cErrorMsg='MSG_UNSPEC_ERROR';
|
|
}
|
|
}
|
|
if (Eq(m_nLastError,1)) {
|
|
WindowAlert(Translate(m_cObblFieldName)+' : '+Translate(l_cErrorMsg));
|
|
} else {
|
|
if (Eq(l_cErrorMsg,'MSG_VALUE_NOT_ALLOWED') && Ne(m_cLastWorkVarErrorMsg,'')) {
|
|
WindowAlert(Translate(m_cLastWorkVarErrorMsg)+': '+Translate(l_cErrorMsg));
|
|
} else {
|
|
WindowAlert(Translate(l_cErrorMsg));
|
|
}
|
|
}
|
|
if (Ne(m_cLastWorkVarError,'')) {
|
|
SetControlFocus(m_cLastWorkVarError);
|
|
SetErrorField(m_cLastWorkVarError,true);
|
|
m_cLastWorkVarError='';
|
|
}
|
|
} else if (Ne(typeof('DisplayErrorMessage_'+m_cErrorInChild),'undefined')) {
|
|
DisplayErrorMessageOfChild(m_cErrorInChild);
|
|
}
|
|
}
|
|
function ResetErrorVars() {
|
|
m_nLastError=0;
|
|
m_cLastMsgError='';
|
|
m_cLastWorkVarError='';
|
|
m_cLastWorkVarErrorMsg='';
|
|
m_cErrorInChild='';
|
|
}
|
|
function EnableControlsUnderCondition() {
|
|
}
|
|
function EnableControlsUnderCondition_WhenReady(inherit) {
|
|
if (Eq(inherit,null)) {
|
|
inherit=true;
|
|
}
|
|
var l_bEnabled = true;
|
|
// * --- Area Manuale = UI - Enable Controls Init
|
|
// * --- Fine Area Manuale
|
|
if (window.Z && window.Z.Tabs) {
|
|
Z.Tabs.Get('tabs').CheckTabStrip();
|
|
}
|
|
LibJavascript.forEachItem(m_FoundlingEditExpression,i_body_0)
|
|
function i_body_0(child){
|
|
child();
|
|
}
|
|
DisableUI();
|
|
if (inherit && IsWndAccessible(m_oFather) && ! (m_oFather.m_bCalculating)) {
|
|
m_oFather.EnableControlsUnderCondition();
|
|
}
|
|
HideControlsUnderCondition();
|
|
ObligatoryControlsUnderCondition();
|
|
// * --- Area Manuale = UI - Enable Controls End
|
|
// * --- Fine Area Manuale
|
|
}
|
|
function ObligatoryControlsUnderCondition() {
|
|
var l_bObligatory = true;
|
|
}
|
|
function SetDynamicClasses() {
|
|
var c;
|
|
}
|
|
function SetDynamicTooltip() {
|
|
var c;
|
|
}
|
|
function Set_userid(ctrlValue,kmode,e) {
|
|
if (Ne(w_userid,ctrlValue)) {
|
|
var ctl = _GetCtl(e,'ZPLLDHVTOQ');
|
|
if (_tracker.goon(ctl,ctrlValue)) {
|
|
w_userid=ctrlValue;
|
|
SetModified();
|
|
var l_bResult = true;
|
|
SetErrorField(ctl,false);
|
|
l_bResult=_ChkObl('ZPLLDHVTOQ',0);
|
|
DoUpdate(l_bResult);
|
|
SPBOUILib.SetInputValue('ZPLLDHVTOQ',function(){return WtH(w_userid,'N',9,0,'999999')},w_userid);
|
|
return l_bResult;
|
|
} else {
|
|
ctl.value=WtH('','N',9,0,'999999');
|
|
_ResetTracker();
|
|
return true;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
function Set_ssoid(ctrlValue,kmode,e) {
|
|
if (Ne(w_ssoid,ctrlValue)) {
|
|
var ctl = _GetCtl(e,'KETCZPSXKD');
|
|
if (_tracker.goon(ctl,ctrlValue)) {
|
|
w_ssoid=ctrlValue;
|
|
SetModified();
|
|
var l_bResult = true;
|
|
SetErrorField(ctl,false);
|
|
l_bResult=_ChkObl('KETCZPSXKD',0);
|
|
DoUpdate(l_bResult);
|
|
return l_bResult;
|
|
} else {
|
|
ctl.value=WtH('','C',100,0,'');
|
|
_ResetTracker();
|
|
return true;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
function Calculate() {
|
|
var l_bTmpRes;
|
|
var l_bResult = true;
|
|
m_bCalculating=true;
|
|
LibJavascript.forEachItem(m_FoundlingCopyWorkVar,i_body_1)
|
|
function i_body_1(child){
|
|
child();
|
|
}
|
|
// * --- Area Manuale = UI - Calculate
|
|
// * --- Fine Area Manuale
|
|
m_bCalculating=false;
|
|
}
|
|
function SaveDependsOn() {
|
|
}
|
|
function SaveLabelDependsOn() {
|
|
}
|
|
function SendData(formaction,url,data) {
|
|
if (Eq(m_bAlreadySubmitted,true)) {
|
|
WindowAlert(Translate('MSG_SERVER_DATA'));
|
|
return;
|
|
}
|
|
var Frm = document.FSender;
|
|
var bResult = true;
|
|
function l_Checks() {
|
|
bResult=bResult && Check() && CheckPwdOTP();
|
|
}
|
|
if (IsWndAccessible(m_oFather)) {
|
|
if (Eq(m_nChildStatus,2)) {
|
|
m_oFather.SendData(formaction,url,data);
|
|
} else if (Eq(m_nChildStatus,1)) {
|
|
if (Eq(formaction,'save')) {
|
|
if ( ! (Check())) {
|
|
DisplayErrorMessage();
|
|
return;
|
|
}
|
|
if ( ! (m_oFather.SaveContext_spadministration_ssomap_child())) {
|
|
WindowAlert(Translate('MSG_CANNOT_UPDATE_CALLERVAR'));
|
|
return;
|
|
}
|
|
InnerChildSendData(bResult);
|
|
} else if (Eq(formaction,'moveto') && m_bUpdated) {
|
|
WindowConfirm(Translate('MSG_LEAVE_MOD'),InnerChildSendData);
|
|
} else {
|
|
InnerChildSendData(bResult);
|
|
}
|
|
function InnerChildSendData(bResult) {
|
|
if (bResult) {
|
|
if (Eq(m_cFunction,'view') || Eq(m_cFunction,'query') || Ne(m_nLastError,1)) {
|
|
m_oFather.focus();
|
|
WindowClose();
|
|
}
|
|
if (Ne(m_cFunction,'view') && Ne(m_cFunction,'query')) {
|
|
ResetErrorVars();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
if (Eq(formaction,'moveto') && m_bUpdated) {
|
|
bResult=WindowConfirm(Translate('MSG_LEAVE_MOD'));
|
|
}
|
|
if (bResult) {
|
|
if (Eq(formaction,'moveto') || (Eq(m_cFunction,'edit') && ! (m_bUpdated))) {
|
|
formaction='discard';
|
|
}
|
|
if (Eq(formaction,'save')) {
|
|
NotifyEvent('Before Save');
|
|
l_Checks();
|
|
}
|
|
if (bResult) {
|
|
Frm.m_cSelectedPage.value=GetSelectedPage(InitWvApplet()).asString();
|
|
SubmitForm.SetAction(formaction);
|
|
SubmitForm.SetPwdAndOTP();
|
|
Frm.m_cAltInterface.value=m_cAltInterface;
|
|
Frm.m_cLayerInterface.value=m_cLayerInterface;
|
|
FillWv();
|
|
Frm.m_cWv.value=WvApplet().asString(1);
|
|
if (Ne(parent,window) && parent.ZtVWeb) {
|
|
parent.ZtVWeb.raiseEventToEvalParms('spadministration_ssomap_child_beforeSubmit',{'action':formaction});
|
|
}
|
|
Frm.submit();
|
|
m_bAlreadySubmitted=true;
|
|
InstTR();
|
|
} else {
|
|
DisplayErrorMessage();
|
|
if (Ne(parent,window) && parent.ZtVWeb) {
|
|
parent.ZtVWeb.raiseEventToEvalParms('spadministration_ssomap_child_dataNotSent',{'action':formaction});
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
CheckChild.child=[];
|
|
function Check() {
|
|
var l_bResult = true;
|
|
ResetErrorVars();
|
|
m_nLastError=0;
|
|
if ( ! (_ChkObl('ZPLLDHVTOQ',1))) {
|
|
_SignErr('ZPLLDHVTOQ');
|
|
m_cLastWorkVarErrorMsg='112233637';
|
|
l_bResult=false;
|
|
w_userid=HtW('','N');
|
|
} else if ( ! (_ChkObl('KETCZPSXKD',1))) {
|
|
_SignErr('KETCZPSXKD');
|
|
m_cLastWorkVarErrorMsg='7014051';
|
|
l_bResult=false;
|
|
w_ssoid=HtW('','C');
|
|
}
|
|
if (l_bResult) {
|
|
l_bResult=CheckChild(0);
|
|
}
|
|
// * --- Area Manuale = UI - Check Form
|
|
// * --- Fine Area Manuale
|
|
return l_bResult;
|
|
}
|
|
function link_index(lc) {
|
|
return -1;
|
|
}
|
|
function link_url(index) {
|
|
var l_oWv;
|
|
}
|
|
function FillWv() {
|
|
var l_oWv = InitWvApplet();
|
|
l_oWv.setValue('m_CheckVars',JSON.stringify(m_CheckVars));
|
|
l_oWv.setValue('userid',WtA(w_userid,'N'));
|
|
l_oWv.setValue('ssoid',WtA(w_ssoid,'C'));
|
|
_FillChildren(l_oWv);
|
|
if (m_bExtended) {
|
|
ExtendWv(l_oWv);
|
|
}
|
|
if (Ne(m_cFunction,'view')) {
|
|
l_oWv.setValue('m_bUpdated',WtA(m_bUpdated,'L'));
|
|
l_oWv.setValue('m_cPrvsStt',WtA(m_cPrvsStt,'C'));
|
|
}
|
|
l_oWv.setValue('m_bLoaded',WtA(m_bLoaded,'L'));
|
|
l_oWv.setValue('m_cOldCPCCCHK',WtA(m_cOldCPCCCHK,'C'));
|
|
}
|
|
_FillChildren.n=[];
|
|
FillWv.n=["userid","ssoid"];
|
|
function SetModified() {
|
|
m_bUpdated=true;
|
|
if (IsWndAccessible(m_oFather)) {
|
|
m_oFather.SetModified_spadministration_ssomap_child();
|
|
}
|
|
}
|
|
function EnableEntityWhenReady(enable) {
|
|
if (enable) {
|
|
var c;
|
|
if(c=Ctrl('ZPLLDHVTOQ')) SetDisabled(c,true);
|
|
if(c=Ctrl('KETCZPSXKD')) SetDisabled(c,true);
|
|
} else {
|
|
var c;
|
|
if(c=Ctrl('ZPLLDHVTOQ')) SetDisabled(c,false);
|
|
if(c=Ctrl('KETCZPSXKD')) SetDisabled(c,false);
|
|
EnableControlsUnderCondition(false);
|
|
}
|
|
m_bChildDisabled=enable;
|
|
}
|