[Vtigercrm-commits] [vtiger-commits] r10865 - in /vtigercrm/branches/5.0.3: Smarty/templates/Reports.tpl modules/Reports/CheckReport.php modules/Reports/SaveReportFolder.php
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Fri May 11 09:07:46 EDT 2007
Author: richie
Date: Fri May 11 07:07:37 2007
New Revision: 10865
Log:
* Fixed the issue in folder name duplication
Modified:
vtigercrm/branches/5.0.3/Smarty/templates/Reports.tpl
vtigercrm/branches/5.0.3/modules/Reports/CheckReport.php
vtigercrm/branches/5.0.3/modules/Reports/SaveReportFolder.php
Modified: vtigercrm/branches/5.0.3/Smarty/templates/Reports.tpl
==============================================================================
--- vtigercrm/branches/5.0.3/Smarty/templates/Reports.tpl (original)
+++ vtigercrm/branches/5.0.3/Smarty/templates/Reports.tpl Fri May 11 07:07:37 2007
@@ -181,8 +181,17 @@
method: 'post',
postBody: 'action=ReportsAjax&mode=ajax&file=CheckReport&module=Reports&check=folderCheck&folderName='+getObj('folder_name').value,
onComplete: function(response) {
+ var folderid = getObj('folder_id').value;
+ var resresult =response.responseText.split("::");
var mode = getObj('fldrsave_mode').value;
- if((response.responseText ==1 || response.responseText != 0) && (mode == 'Edit' || mode =='save') &&response.responseText != 999)
+ if(resresult[0] != 0 && mode =='save' && resresult[0] != 999)
+ {
+ {/literal}
+ alert("{$APP.FOLDER_NAME_ALREADY_EXISTS}");
+ return false;
+ {literal}
+ }
+ else if(((resresult[0] != 1 && resresult[0] != 0) || (resresult[0] == 1 && resresult[0] != 0 && resresult[1] != folderid )) && mode =='Edit' && resresult[0] != 999)
{
{/literal}
alert("{$APP.FOLDER_NAME_ALREADY_EXISTS}");
Modified: vtigercrm/branches/5.0.3/modules/Reports/CheckReport.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Reports/CheckReport.php (original)
+++ vtigercrm/branches/5.0.3/modules/Reports/CheckReport.php Fri May 11 07:07:37 2007
@@ -13,7 +13,7 @@
require_once('include/database/PearDatabase.php');
$check=$_REQUEST['check'];
global $default_charset;
-
+$id='';
if($_REQUEST['check']== 'reportCheck')
{
$reportName = $_REQUEST['reportName'];
@@ -32,15 +32,11 @@
echo "999";
}else
{
- $SQL="select * from vtiger_reportfolder where foldername='".$folderName."'";
+ $SQL="select * from vtiger_reportfolder where foldername='".trim($folderName)."'";
$sqlresult = $adb->query($SQL);
- echo trim($adb->num_rows($sqlresult));
+ $id = $adb->query_result($sqlresult,0,"folderid");
+ echo trim($adb->num_rows($sqlresult)."::".$id);
}
}
?>
-
-
-
-
-
Modified: vtigercrm/branches/5.0.3/modules/Reports/SaveReportFolder.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Reports/SaveReportFolder.php (original)
+++ vtigercrm/branches/5.0.3/modules/Reports/SaveReportFolder.php Fri May 11 07:07:37 2007
@@ -37,7 +37,7 @@
{
$sql = "INSERT INTO vtiger_reportfolder ";
$sql .= "(FOLDERID,FOLDERNAME,DESCRIPTION,STATE) ";
- $sql .= "VALUES ('','".$foldername."','".$folderdesc."','CUSTOMIZED')";
+ $sql .= "VALUES ('','".trim($foldername)."','".$folderdesc."','CUSTOMIZED')";
$result = $adb->query($sql);
if($result!=false)
{
@@ -56,7 +56,7 @@
if($rfid != "")
{
$sql = "update vtiger_reportfolder set ";
- $sql .= "FOLDERNAME='".$foldername."', ";
+ $sql .= "FOLDERNAME='".trim($foldername)."', ";
$sql .= "DESCRIPTION='".$folderdesc."' ";
$sql .= "where folderid=".$rfid;
$result = $adb->query($sql);
More information about the vtigercrm-commits
mailing list