BUG 9523 Edit Process Doesn't have validate in title SOLVED
- I add validate for porcess's title
This commit is contained in:
@@ -445,6 +445,7 @@ class processMap {
|
|||||||
|
|
||||||
//If the function returns a DEFAULT calendar it means that this object doesn't have assigned any calendar
|
//If the function returns a DEFAULT calendar it means that this object doesn't have assigned any calendar
|
||||||
$aFields['PRO_CALENDAR'] = $calendarInfo ['CALENDAR_APPLIED'] != 'DEFAULT' ? $calendarInfo ['CALENDAR_UID'] : "";
|
$aFields['PRO_CALENDAR'] = $calendarInfo ['CALENDAR_APPLIED'] != 'DEFAULT' ? $calendarInfo ['CALENDAR_UID'] : "";
|
||||||
|
$aFields['SYS_LANG'] = SYS_LANG;
|
||||||
|
|
||||||
global $G_PUBLISH;
|
global $G_PUBLISH;
|
||||||
$G_PUBLISH = new Publisher ( );
|
$G_PUBLISH = new Publisher ( );
|
||||||
|
|||||||
@@ -53,6 +53,8 @@ switch($function){
|
|||||||
$_POST['form']['PRO_UID'] = $_GET['PRO_UID'];
|
$_POST['form']['PRO_UID'] = $_GET['PRO_UID'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$_POST['form']['PRO_TITLE'] = trim($_POST['form']['PRO_TITLE']);
|
||||||
|
|
||||||
G::LoadClass('processMap');
|
G::LoadClass('processMap');
|
||||||
$oProcessMap = new ProcessMap();
|
$oProcessMap = new ProcessMap();
|
||||||
if (!isset($_POST['form']['PRO_UID'])) {
|
if (!isset($_POST['form']['PRO_UID'])) {
|
||||||
|
|||||||
@@ -19,6 +19,9 @@
|
|||||||
<tr style="display: none;">
|
<tr style="display: none;">
|
||||||
<td colspan="2">{$form.THETYPE}</td>
|
<td colspan="2">{$form.THETYPE}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr style="display: none;">
|
||||||
|
<td colspan="2">{$form.SYS_LANG} {$form.PRO_VALIDATE_TITLE}</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="FormLabel" width="{$form_labelWidth}"><font color="red">* </font>{$PRO_TITLE}</td>
|
<td class="FormLabel" width="{$form_labelWidth}"><font color="red">* </font>{$PRO_TITLE}</td>
|
||||||
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.PRO_TITLE}</td>
|
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.PRO_TITLE}</td>
|
||||||
|
|||||||
@@ -9,10 +9,24 @@
|
|||||||
|
|
||||||
<THETYPE type="hidden"/>
|
<THETYPE type="hidden"/>
|
||||||
|
|
||||||
<PRO_TITLE type="text" size="50" maxlength="255" defaultvalue="" required="1" group="1" dependentfields="" linkfield="" strto="" readonly="0" noshowingrid="0" readonlyingrid="0" totalizeable="0" sqlconnection="">
|
<SYS_LANG type="text"/>
|
||||||
|
|
||||||
|
<PRO_TITLE type="text" size="50" maxlength="255" defaultvalue="" required="1" group="1" dependentfields="PRO_VALIDATE_TITLE" linkfield="" strto="" readonly="0" noshowingrid="0" readonlyingrid="0" totalizeable="0" sqlconnection="">
|
||||||
<en>Title</en>
|
<en>Title</en>
|
||||||
</PRO_TITLE>
|
</PRO_TITLE>
|
||||||
|
|
||||||
|
<PRO_VALIDATE_TITLE type="text">
|
||||||
|
SELECT
|
||||||
|
PRO_UID
|
||||||
|
FROM
|
||||||
|
PROCESS
|
||||||
|
INNER JOIN CONTENT ON (CONTENT.CON_ID = PROCESS.PRO_UID)
|
||||||
|
WHERE
|
||||||
|
CON_LANG = @@SYS_LANG AND
|
||||||
|
CON_VALUE = TRIM(@@PRO_TITLE)
|
||||||
|
<en>Title</en>
|
||||||
|
</PRO_VALIDATE_TITLE>
|
||||||
|
|
||||||
<PRO_DESCRIPTION type="textarea" rows="8" cols="60">
|
<PRO_DESCRIPTION type="textarea" rows="8" cols="60">
|
||||||
<en>Description</en>
|
<en>Description</en>
|
||||||
</PRO_DESCRIPTION>
|
</PRO_DESCRIPTION>
|
||||||
@@ -66,30 +80,56 @@
|
|||||||
|
|
||||||
<JS type="javascript" replacetags="1">
|
<JS type="javascript" replacetags="1">
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
var validateNameProcess = true;
|
||||||
|
var naProcess = new input(getField('PRO_TITLE'));
|
||||||
|
naProcess.passed();
|
||||||
|
|
||||||
var verifyProcessInformation = function(oForm) {
|
var verifyProcessInformation = function(oForm) {
|
||||||
var oAux;
|
if (validateNameProcess) {
|
||||||
var bContinue = true;
|
var oAux;
|
||||||
oAux = oForm.elements['form[PRO_TITLE]'];
|
var bContinue = true;
|
||||||
if (oAux.value == '') {
|
oAux = oForm.elements['form[PRO_TITLE]'];
|
||||||
alert('@G::LoadTranslation(ID_PROCESS_TITLE_REQUIRED)');
|
if (oAux.value == '') {
|
||||||
oAux.focus();
|
alert('@G::LoadTranslation(ID_PROCESS_TITLE_REQUIRED)');
|
||||||
bContinue = false;
|
oAux.focus();
|
||||||
}
|
bContinue = false;
|
||||||
|
}
|
||||||
|
|
||||||
var regExp = /^(?!^(PRN|AUX|CLOCK\$|NUL|CON|COM\d|LPT\d|\..*)(\..+)?$)[^\x00-\x1f\\?*:\";|/]+$/;
|
var regExp = /^(?!^(PRN|AUX|CLOCK\$|NUL|CON|COM\d|LPT\d|\..*)(\..+)?$)[^\x00-\x1f\\?*:\";|/]+$/;
|
||||||
if (oAux.value.search(regExp)==-1) {
|
|
||||||
alert('@G::LoadTranslation(ID_INVALID_PROCESS_NAME)');
|
if (oAux.value.search(regExp)==-1) {
|
||||||
oAux.focus();
|
alert('@G::LoadTranslation(ID_INVALID_PROCESS_NAME)');
|
||||||
bContinue = false;
|
oAux.focus();
|
||||||
}
|
bContinue = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (bContinue) {
|
if (bContinue) {
|
||||||
ajax_post(oForm.action, oForm, 'POST');
|
ajax_post(oForm.action, oForm, 'POST');
|
||||||
Pm.data.db.title.label = Pm.data.db.title.object.elements.label.innerHTML = getField('PRO_TITLE').value.escapeHTML();
|
Pm.data.db.title.label = Pm.data.db.title.object.elements.label.innerHTML = getField('PRO_TITLE').value.escapeHTML();
|
||||||
Pm.tmp.editProcessPanel.remove();
|
Pm.tmp.editProcessPanel.remove();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
var nProcess = new input(getField('PRO_TITLE'));
|
||||||
|
nProcess.focus();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
leimnud.event.add(getField('PRO_TITLE'), 'change', function() {
|
||||||
|
var nProcess = new input(getField('PRO_TITLE'));
|
||||||
|
getField('PRO_TITLE').value = getField('PRO_TITLE').value.replace(/^\s*|\s*$/g,"");
|
||||||
|
|
||||||
|
if ( (getField('PRO_VALIDATE_TITLE').value == '') ||
|
||||||
|
(getField('PRO_VALIDATE_TITLE').value == getField('PRO_UID').value)
|
||||||
|
) {
|
||||||
|
validateNameProcess = true;
|
||||||
|
nProcess.passed();
|
||||||
|
} else {
|
||||||
|
validateNameProcess = false;
|
||||||
|
nProcess.failed();
|
||||||
|
nProcess.focus();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
function cancel() {
|
function cancel() {
|
||||||
Pm.tmp.editProcessPanel.remove();
|
Pm.tmp.editProcessPanel.remove();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user