[Vtigercrm-commits] [vtiger-commits] r5834 - in /vtigercrm/trunk: Smarty/templates/ImportStep2.tpl modules/Import/Forms.php modules/Import/ImportStep3.php
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Wed May 10 09:31:34 EDT 2006
Author: saraj
Date: Wed May 10 07:31:28 2006
New Revision: 5834
Log:
* Modified to validate the import field mapping and the field map save validation - trac issues - 165, 722
Modified:
vtigercrm/trunk/Smarty/templates/ImportStep2.tpl
vtigercrm/trunk/modules/Import/Forms.php
vtigercrm/trunk/modules/Import/ImportStep3.php
Modified: vtigercrm/trunk/Smarty/templates/ImportStep2.tpl
==============================================================================
--- vtigercrm/trunk/Smarty/templates/ImportStep2.tpl (original)
+++ vtigercrm/trunk/Smarty/templates/ImportStep2.tpl Wed May 10 07:31:28 2006
@@ -147,9 +147,9 @@
</tr>
<tr bgcolor="#ECECEC">
<td align="left" style="padding-left:40px;" >
- <input type="checkbox" name="save_map" onclick="set_readonly(this.form)" />
+ <input type="checkbox" id="save_map" name="save_map" onclick="set_readonly(this.form)" />
Save above Mapping as :
- <input type="text" readonly name="save_map_as" value="" class="importBox" >
+ <input type="text" readonly id="save_map_as" name="save_map_as" value="" class="importBox" >
</td>
</tr>
<tr bgcolor="#ECECEC"><td><hr /></td></tr>
@@ -157,7 +157,7 @@
<td align="right" style="padding-right:40px;" >
<input type="submit" name="button" value=" ‹ Back " class="classBtn" onclick="this.form.action.value='Import';this.form.step.value='2'; return true;" />
- <input type="submit" name="button" value=" Import Now › " class="classBtn" onclick="this.form.action.value='Import';this.form.step.value='4'; return verify_data(Import)" />
+ <input type="submit" name="button" value=" Import Now › " class="classBtn" onclick="this.form.action.value='Import';this.form.step.value='4'; return validate_import_map()" />
</td>
</tr>
<tr bgcolor="#ECECEC"><td align="right" > </td></tr>
Modified: vtigercrm/trunk/modules/Import/Forms.php
==============================================================================
--- vtigercrm/trunk/modules/Import/Forms.php (original)
+++ vtigercrm/trunk/modules/Import/Forms.php Wed May 10 07:31:28 2006
@@ -188,7 +188,7 @@
require_once('include/database/PearDatabase.php');
global $adb;
- $output = "<select name=\"colnum" . $colnum ."\">\n";
+ $output = "<select id=\"colnum" . $colnum ."\" name=\"colnum" . $colnum ."\">\n";
$output .= "<option value=\"-1\">". $mod_strings['LBL_DONT_MAP'] . "</option>";
$count = 0;
Modified: vtigercrm/trunk/modules/Import/ImportStep3.php
==============================================================================
--- vtigercrm/trunk/modules/Import/ImportStep3.php (original)
+++ vtigercrm/trunk/modules/Import/ImportStep3.php Wed May 10 07:31:28 2006
@@ -440,3 +440,59 @@
$smarty->display('ImportStep2.tpl');
?>
+<script language="javascript" type="text/javascript">
+function validate_import_map()
+{
+ var tagName;
+ var count = 0;
+ var required_count = 0;
+ var field_count = "<?php echo $field_count; ?>";
+ var required_fields = new Array();
+
+ <?php
+ foreach($focus->required_fields as $name => $index)
+ {
+ ?>
+ required_fields[count] = "<?php echo $name; ?>";
+ count = count + 1;
+ <?php
+ }
+ ?>
+ for(loop_count = 0; loop_count<field_count;loop_count++)
+ {
+ tagName = document.getElementById('colnum'+loop_count);
+ optionData = tagName.options[tagName.selectedIndex].value;
+ for(inner_loop = 0; inner_loop<required_fields.length;inner_loop++)
+ {
+ if(optionData == required_fields[inner_loop])
+ {
+ required_count = required_count +1;
+ }
+ }
+ }
+
+ var err_msg = '';
+ if(required_count != required_fields.length)
+ {
+ err_msg = "Please Map All Required Fileds";
+ }
+ else
+ {
+ //This is to check whether the save map name has been given or not when save map check box is checked
+ if(document.getElementById("save_map").checked == true)
+ {
+ if(trim(document.getElementById("save_map_as").value) == '')
+ {
+ err_msg = "Please Enter Save Map Name";
+ }
+ }
+ }
+ if(err_msg != '')
+ {
+ alert(err_msg);
+ return false;
+ }
+ else
+ return true;
+}
+</script>
More information about the vtigercrm-commits
mailing list