BUG 5357 The Trigger Wizard doesn't check whether the user... SOLVED

- No validation is performed.
- Was add validation in the Trigger Wizard.
This commit is contained in:
Marco Antonio Nina
2012-09-28 12:07:28 -04:00
parent e31c8d2651
commit d2ac677428
8 changed files with 84 additions and 57 deletions

View File

@@ -113,19 +113,15 @@
</td>
</tr>
<tr>
<input type="hidden" name="PMFUNTION_NAME"
value="{PMFUNTION}">
<input type="hidden" name="LIBRARY_CLASS"
value="{LIBRARY_CLASS}">
<input type="hidden" id="FIELDS_REQUIRED" name="FIELDS_REQUIRED" value="{FIELDS_REQUIRED}">
<input type="hidden" name="PMFUNTION_NAME" value="{PMFUNTION}">
<input type="hidden" name="LIBRARY_CLASS" value="{LIBRARY_CLASS}">
<input type="hidden" id="PRO_UID" name="PRO_UID" value="{PRO_UID}">
<input type="hidden" id="ALLFUNCTION" name="ALLFUNCTION"
value="{ALLFUNCTION}">
<input type="hidden" name="PAGED_TABLE_ID"
id="PAGED_TABLE_ID" value="{PAGED_TABLE_ID}">
<input type="hidden" name="LIBRARY_NAME"
id="LIBRARY_NAME" value="{LIBRARY_NAME}">
<input type="hidden" name="PMFUNTION_LABEL"
id="PMFUNTION_LABEL" value="{PMFUNTION_LABEL}">
<input type="hidden" id="ALLFUNCTION" name="ALLFUNCTION" value="{ALLFUNCTION}">
<input type="hidden" name="PAGED_TABLE_ID" id="PAGED_TABLE_ID" value="{PAGED_TABLE_ID}">
<input type="hidden" name="LIBRARY_NAME" id="LIBRARY_NAME" value="{LIBRARY_NAME}">
<input type="hidden" name="PMFUNTION_LABEL" id="PMFUNTION_LABEL" value="{PMFUNTION_LABEL}">
<td class="FormButton" colspan="2" align=""><input
style="" class='module_app_button___gray ' id="savek"
name="savek" type='button' value="{ID_SAVE}"

View File

@@ -61,15 +61,21 @@ try {
$methodreturnDescription = (trim(strtoupper($methodreturnA[3])) == strtoupper(G::LoadTranslation('ID_NONE')))
? G::LoadTranslation ( 'ID_NOT_REQUIRED') : $methodreturnA[3];
$methodReturnLabel = isset ( $methodreturnA[3] ) ? $methodreturnDescription : $methodReturn;
$fieldRequired = array ();
if ( (isset($methodreturnA[0]) && isset($methodreturnA[1]))
&& (trim(strtoupper($methodreturnA[0]) ) != strtoupper(G::LoadTranslation ( 'ID_NONE')) ) ) {
$methodReturnLabelRequired = (trim( $methodreturnA[1] ) != "" )
? G::LoadTranslation ( "ID_REQUIRED_FIELD" ) : $methodreturnA[1];
if (trim( $methodreturnA[1] ) != "") {
$methodReturnLabelRequired = G::LoadTranslation ( "ID_REQUIRED_FIELD" );
$fieldRequired[] = 'TRI_ANSWER';
} else {
$methodReturnLabelRequired = $methodreturnA[1];
}
$methodReturnLabel .= "<br>" . trim( $methodReturnLabelRequired ) . " | " . trim($methodreturnA[0]);
} else {
$bReturnValue = false;
$displayMode = 'display:none';
}
$aParametersFun = $methodParameters;
$triggerWizardTemplate = PATH_TPL . 'triggers' . PATH_SEP . 'triggers_CreateWizard.html';
$template = new TemplatePower ( $triggerWizardTemplate );
@@ -112,6 +118,7 @@ try {
$sPMfunction = $sNameFun . " (";
$methodParametersOnlyNames = array ();
if (count ( $aParametersFun ) > 0) {
$template->newBlock ( 'paremetersTriggersGroup' );
$template->assign ( 'PARAMETERS_LABEL', G::LoadTranslation ( 'ID_PARAMETERS' ) );
@@ -145,16 +152,19 @@ try {
str_replace ( "'", "", str_replace ( '"', '', $paramDefaultValue ) ) );
$fieldDescription = ($paramDescription!="")?$paramDescription . "<br>":"";
$fieldDescription .= $paramDefaultValue != ""
? $paramDefaultValue . " | " . $paramType
: G::LoadTranslation ( "ID_REQUIRED_FIELD" ) . " | " . $paramType;
if ($paramDefaultValue != "") {
$fieldDescription .= $paramDefaultValue . " | " . $paramType;
} else {
$fieldDescription .= G::LoadTranslation ( "ID_REQUIRED_FIELD" ) . " | " . $paramType;
$fieldRequired[] = trim (str_replace ("$", "", $paramName));
}
$template->assign ( 'ADD_TRI_DESCRIPTION', $fieldDescription );
$nrows ++;
}
}
}
$template->gotoBlock ( '_ROOT' );
$template->assign ('FIELDS_REQUIRED', implode ( ",", $fieldRequired ));
$template->assign ( 'ALLFUNCTION', implode ( ",", $methodParametersOnlyNames ) );
$sPMfunction .= ");";
$content = $template->getOutputContent ();

View File

@@ -120,18 +120,14 @@
</td>
</tr>
<tr>
<input type="hidden" name="PMFUNTION_NAME"
value="{PMFUNTION}">
<input type="hidden" name="LIBRARY_CLASS"
value="{LIBRARY_CLASS}">
<input type="hidden" id="FIELDS_REQUIRED" name="FIELDS_REQUIRED" value="{FIELDS_REQUIRED}">
<input type="hidden" name="PMFUNTION_NAME" value="{PMFUNTION}">
<input type="hidden" name="LIBRARY_CLASS" value="{LIBRARY_CLASS}">
<input type="hidden" id="PRO_UID" name="PRO_UID" value="{PRO_UID}">
<input type="hidden" id="ALLFUNCTION" name="ALLFUNCTION" value="{ALLFUNCTION}">
<input type="hidden" name="PAGED_TABLE_ID"
id="PAGED_TABLE_ID" value="{PAGED_TABLE_ID}">
<input type="hidden" name="LIBRARY_NAME"
id="LIBRARY_NAME" value="{LIBRARY_NAME}">
<input type="hidden" name="PMFUNTION_LABEL"
id="PMFUNTION_LABEL" value="{PMFUNTION_LABEL}">
<input type="hidden" name="PAGED_TABLE_ID" id="PAGED_TABLE_ID" value="{PAGED_TABLE_ID}">
<input type="hidden" name="LIBRARY_NAME" id="LIBRARY_NAME" value="{LIBRARY_NAME}">
<input type="hidden" name="PMFUNTION_LABEL" id="PMFUNTION_LABEL" value="{PMFUNTION_LABEL}">
<td class="FormButton" colspan="2" align=""><input
style="" class='module_app_button___gray ' id="savek"
name="savek" type='button' value="{ID_SAVE}"

View File

@@ -54,6 +54,7 @@ try {
$bReturnValue = true;
$displayMode = 'display:block';
$methodreturnDescription = "";
$fieldRequired = array ();
if (isset($methodreturnA[3])) {
$methodreturnDescription = (trim(strtoupper($methodreturnA [3])) == strtoupper(G::LoadTranslation ('ID_NONE')))
? G::LoadTranslation ( 'ID_NOT_REQUIRED')
@@ -62,8 +63,12 @@ try {
$methodReturnLabel = isset ( $methodreturnA [3] ) ? $methodreturnDescription : $methodReturn;
if ( (isset($methodreturnA[0]) && isset($methodreturnA[1]))
&& (trim(strtoupper($methodreturnA[0]) ) != strtoupper(G::LoadTranslation ( 'ID_NONE')) ) ) {
$methodReturnLabelRequired = (trim( $methodreturnA[1] ) != "" )
? G::LoadTranslation ( "ID_REQUIRED_FIELD" ) : $methodreturnA[1];
if (trim( $methodreturnA[1] ) != "") {
$methodReturnLabelRequired = G::LoadTranslation ( "ID_REQUIRED_FIELD" );
$fieldRequired[] = 'TRI_ANSWER';
} else {
$methodReturnLabelRequired = $methodreturnA[1];
}
$methodReturnLabel .= "<br>" . trim( $methodReturnLabelRequired ) . " | " . trim($methodreturnA[0]);
} else {
$bReturnValue = false;
@@ -148,10 +153,14 @@ try {
// str_replace ( '"', '', $paramDefaultValue ) ) );
$paramValue = $_GET[trim( str_replace( "$", "", $paramName ) )];
$template->assign ( 'ADD_TRI_VALUE', str_replace("\'", "&apos;", $paramValue) );
$fieldDescription = ($paramDescription!="")?$paramDescription . "<br>":"";
$fieldDescription .= $paramDefaultValue != ""
? $paramDefaultValue . " | " . $paramType
: G::LoadTranslation ( "ID_REQUIRED_FIELD" ) . " | " . $paramType;
if ($paramDefaultValue != "") {
$fieldDescription = $paramDescription . "<br>";
$fieldDescription .= $paramDefaultValue . " | " . $paramType;
} else {
$fieldDescription = "";
$fieldDescription .= G::LoadTranslation ( "ID_REQUIRED_FIELD" ) . " | " . $paramType;
$fieldRequired[] = trim (str_replace ("$", "", $paramName));
}
$template->assign ( 'ADD_TRI_DESCRIPTION', $fieldDescription );
$nrows ++;
@@ -160,6 +169,7 @@ try {
}
$template->gotoBlock ( '_ROOT' );
$template->assign ('FIELDS_REQUIRED', implode ( ",", $fieldRequired ));
$template->assign ( 'ALLFUNCTION', implode ( ",", $methodParametersOnlyNames ) );
$sPMfunction .= ");";
$content = $template->getOutputContent ();

View File

@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<dynaForm name="triggersProperties" type="xmlform" width="100%" labelWidth="20%" enableTemplate="1">
<PRO_UID type="hidden"/>
<FIELDS_REQUIRED type="hidden"/>
<TITLE type="title" group="1">

View File

@@ -7,6 +7,7 @@
<td valign="top">
<input class="notValidateThisFields" name="__notValidateThisFields__" id="__notValidateThisFields__" value="" type="hidden">
<input name="DynaformRequiredFields" id="DynaformRequiredFields" value="{$form_objectRequiredFields}" type="hidden">
<input name="FIELDS_REQUIRED" id="FIELDS_REQUIRED" value="{$FIELDS_REQUIRED}" type="hidden">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody><tr style="display: none;">
<td colspan="2">{$form.TRI_UID}{$form.PRO_UID}</td>

View File

@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<dynaForm name="triggersProperties" type="xmlform" width="100%" labelWidth="20%" enableTemplate="1">
<PRO_UID type="hidden"/>
<FIELDS_REQUIRED type="hidden"/>
<TITLE type="title" group="1">
<en>Trigger Information</en>
</TITLE>

View File

@@ -9,6 +9,7 @@
<PRO_UID type="private"/>
<FIELDS_REQUIRED type="private"/>
<triggersEdit type="private" defaultValue="../triggers/triggers_Edit"/>
@@ -94,11 +95,21 @@
if(document.getElementById('TRI_UID')) {
var triUid = document.getElementById('TRI_UID').value;
}
if(triUid==''){
var triTitle =document.getElementById('TRI_TITLE').value;
if(triTitle==''){
alert(G_STRINGS.ID_REQUIRED_NAME_TRIGGERS);return false;
}
var fieldsRequired = document.getElementById('FIELDS_REQUIRED').value;
fieldsRequired = fieldsRequired.split(",");
for (i=0; i<fieldsRequired.length; i++)
{
var field = document.getElementById(fieldsRequired[i]).value;
if (field == '') {
alert(_('ID_REQUIRED_FIELDS_ERROR'));return false;
}
}
if(triUid==''){
reqName=ajax_function("../triggers/triggers_Save",'lookforNameTrigger','NAMETRIGGER='+encodeURIComponent(triTitle)+'&proUid='+(document.getElementById('PRO_UID').value),'POST') ;
if(!reqName){
alert(G_STRINGS.ID_EXIST_TRIGGERS);return false;
@@ -108,6 +119,7 @@
@#PAGED_TABLE_ID.refresh();
}
}else{
ajax_post(form.action, form, 'POST');
currentPopupWindow.remove();
@#PAGED_TABLE_ID.refresh();