320 lines
7.8 KiB
JavaScript
320 lines
7.8 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() {
|
|
var l_bEnabled = true;
|
|
// * --- Area Manuale = UI - Enable Controls Init
|
|
// * --- Fine Area Manuale
|
|
if (window.Z && window.Z.Tabs) {
|
|
Z.Tabs.Get('tabs').CheckTabStrip();
|
|
}
|
|
if (IsDisabledByStateDriver('box_KEXVXSBZNH')) {
|
|
DisableInputsInContainer(Ctrl('KEXVXSBZNH'),true);
|
|
}
|
|
if (IsDisabledByStateDriver('box_BIGLLUNRZE')) {
|
|
DisableInputsInContainer(Ctrl('BIGLLUNRZE'),true);
|
|
}
|
|
LibJavascript.forEachItem(m_FoundlingEditExpression,i_body_0)
|
|
function i_body_0(child){
|
|
child();
|
|
}
|
|
DisableUI();
|
|
HideControlsUnderCondition();
|
|
ObligatoryControlsUnderCondition();
|
|
ExpandCollapseBoxesUnderCondition();
|
|
// * --- Area Manuale = UI - Enable Controls End
|
|
// * --- Fine Area Manuale
|
|
}
|
|
function ObligatoryControlsUnderCondition() {
|
|
var l_bObligatory = true;
|
|
SetObligatory(Ctrl('TWBOJVJHUV'),w_bPrinter || IsObligatoryByStateDriver('printer'));
|
|
SetObligatory(Ctrl('BGAXFHUKER'), ! (w_bPrinter) || IsObligatoryByStateDriver('queue'));
|
|
}
|
|
function SetDynamicClasses() {
|
|
var c;
|
|
}
|
|
function SetDynamicTooltip() {
|
|
var c;
|
|
}
|
|
function Set_code(ctrlValue,kmode,e) {
|
|
if (Ne(w_code,ctrlValue)) {
|
|
var ctl = _GetCtl(e,'EASNYTBCXF');
|
|
if (_tracker.goon(ctl,ctrlValue)) {
|
|
w_code=ctrlValue;
|
|
SetModified();
|
|
var l_bResult = true;
|
|
SetErrorField(ctl,false);
|
|
l_bResult=_ChkObl('EASNYTBCXF',0);
|
|
DoUpdate(l_bResult);
|
|
return l_bResult;
|
|
} else {
|
|
ctl.value=WtH('','C',10,0,'');
|
|
_ResetTracker();
|
|
return true;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
function Set_bPrinter(ctrlValue,kmode,e) {
|
|
if (Ne(w_bPrinter,ctrlValue)) {
|
|
var ctl = _GetCtl(e,'YMLUFDPGUE');
|
|
if (_tracker.goon(ctl,ctrlValue)) {
|
|
w_bPrinter=ctrlValue;
|
|
SetModified();
|
|
var l_bResult = true;
|
|
SetErrorField(ctl,false);
|
|
l_bResult=_ChkObl('YMLUFDPGUE',0);
|
|
DoUpdate(l_bResult);
|
|
return l_bResult;
|
|
} else {
|
|
ctl.value=WtH(false,'L',1,0,'');
|
|
_ResetTracker();
|
|
return true;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
function Set_printer(ctrlValue,kmode,e) {
|
|
if (Ne(w_printer,ctrlValue)) {
|
|
var ctl = _GetCtl(e,'TWBOJVJHUV');
|
|
if (_tracker.goon(ctl,ctrlValue)) {
|
|
w_printer=ctrlValue;
|
|
SetModified();
|
|
var l_bResult = true;
|
|
SetErrorField(ctl,false);
|
|
l_bResult=_ChkObl('TWBOJVJHUV',0);
|
|
DoUpdate(l_bResult);
|
|
return l_bResult;
|
|
} else {
|
|
ctl.value=WtH('','C',80,0,'');
|
|
_ResetTracker();
|
|
return true;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
function Set_prndescription(ctrlValue,kmode,e) {
|
|
if (Ne(w_prndescription,ctrlValue)) {
|
|
var ctl = _GetCtl(e,'JICLLDYGVB');
|
|
if (_tracker.goon(ctl,ctrlValue)) {
|
|
w_prndescription=ctrlValue;
|
|
SetModified();
|
|
var l_bResult = true;
|
|
SetErrorField(ctl,false);
|
|
l_bResult=_ChkObl('JICLLDYGVB',0);
|
|
DoUpdate(l_bResult);
|
|
return l_bResult;
|
|
} else {
|
|
ctl.value=WtH('','C',30,0,'');
|
|
_ResetTracker();
|
|
return true;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
function Set_queue(ctrlValue,kmode,e) {
|
|
if (Ne(w_queue,ctrlValue)) {
|
|
var ctl = _GetCtl(e,'BGAXFHUKER');
|
|
if (_tracker.goon(ctl,ctrlValue)) {
|
|
w_queue=ctrlValue;
|
|
SetModified();
|
|
var l_bResult = true;
|
|
SetErrorField(ctl,false);
|
|
l_bResult=_ChkObl('BGAXFHUKER',0);
|
|
DoUpdate(l_bResult);
|
|
return l_bResult;
|
|
} else {
|
|
ctl.value=WtH('','C',80,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 (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_printers_beforeSubmit',{'action':formaction});
|
|
}
|
|
Frm.submit();
|
|
m_bAlreadySubmitted=true;
|
|
InstTR();
|
|
} else {
|
|
DisplayErrorMessage();
|
|
if (Ne(parent,window) && parent.ZtVWeb) {
|
|
parent.ZtVWeb.raiseEventToEvalParms('spadministration_printers_dataNotSent',{'action':formaction});
|
|
}
|
|
}
|
|
}
|
|
}
|
|
CheckChild.child=[];
|
|
function Check() {
|
|
var l_bResult = true;
|
|
ResetErrorVars();
|
|
m_nLastError=0;
|
|
if ( ! (_ChkObl('EASNYTBCXF',1))) {
|
|
_SignErr('EASNYTBCXF');
|
|
m_cLastWorkVarErrorMsg='960685589';
|
|
l_bResult=false;
|
|
w_code=HtW('','C');
|
|
} else if ( ! (_ChkObl('YMLUFDPGUE',1))) {
|
|
_SignErr('YMLUFDPGUE');
|
|
m_cLastWorkVarErrorMsg='11511372462';
|
|
l_bResult=false;
|
|
w_bPrinter=HtW('','L');
|
|
} else if ( ! (_ChkObl('TWBOJVJHUV',1))) {
|
|
_SignErr('TWBOJVJHUV');
|
|
m_cLastWorkVarErrorMsg='10807759882';
|
|
l_bResult=false;
|
|
w_printer=HtW('','C');
|
|
} else if ( ! (_ChkObl('BGAXFHUKER',1))) {
|
|
_SignErr('BGAXFHUKER');
|
|
m_cLastWorkVarErrorMsg='11700314187';
|
|
l_bResult=false;
|
|
w_queue=HtW('','C');
|
|
} else if ( ! (_ChkObl('JICLLDYGVB',1))) {
|
|
_SignErr('JICLLDYGVB');
|
|
m_cLastWorkVarErrorMsg='1360773004';
|
|
l_bResult=false;
|
|
w_prndescription=HtW('','C');
|
|
}
|
|
if (l_bResult) {
|
|
l_bResult=CheckChild(0);
|
|
}
|
|
// * --- Area Manuale = UI - Check Form
|
|
// * --- spadministration_printers
|
|
var pcheck = w_spreportprinters.Check();
|
|
if( pcheck == false ) {
|
|
m_nLastError = -1;//no display again
|
|
return pcheck;
|
|
}
|
|
|
|
if(w_bPrinter) {
|
|
var pret = w_spreportprinters.getPrinterConf();
|
|
setPrinter(pret.printer, pret.printerconf);
|
|
}
|
|
else {
|
|
setPrinter('queue:'+w_queue, '');
|
|
}
|
|
|
|
|
|
// * --- 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('code',WtA(w_code,'C'));
|
|
l_oWv.setValue('prnconnection',WtA(w_prnconnection,'C'));
|
|
l_oWv.setValue('prnconfiguration',WtA(w_prnconfiguration,'M'));
|
|
l_oWv.setValue('prndescription',WtA(w_prndescription,'C'));
|
|
l_oWv.setValue('bPrinter',WtA(w_bPrinter,'L'));
|
|
l_oWv.setValue('printer',WtA(w_printer,'C'));
|
|
l_oWv.setValue('queue',WtA(w_queue,'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=["code","prnconnection","prnconfiguration","prndescription","bPrinter","printer","queue"];
|
|
function SetModified() {
|
|
m_bUpdated=true;
|
|
}
|