[Vtigercrm-commits] [vtiger-commits] r10201 - in /vtigercrm/branches/5.0.3: Smarty/templates/DetailView.tpl include/js/ListView.js include/js/general.js include/language/en_us.lang.php include/utils/DeleteUtils.php modules/Users/massdelete.php
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Mon Feb 19 09:30:40 EST 2007
Author: saraj
Date: Mon Feb 19 07:30:28 2007
New Revision: 10201
Log:
'Top Organisation' at home does also list organisations that have been deleted already - fixed . Fixes #3021
Modified:
vtigercrm/branches/5.0.3/Smarty/templates/DetailView.tpl
vtigercrm/branches/5.0.3/include/js/ListView.js
vtigercrm/branches/5.0.3/include/js/general.js
vtigercrm/branches/5.0.3/include/language/en_us.lang.php
vtigercrm/branches/5.0.3/include/utils/DeleteUtils.php
vtigercrm/branches/5.0.3/modules/Users/massdelete.php
Modified: vtigercrm/branches/5.0.3/Smarty/templates/DetailView.tpl
==============================================================================
--- vtigercrm/branches/5.0.3/Smarty/templates/DetailView.tpl (original)
+++ vtigercrm/branches/5.0.3/Smarty/templates/DetailView.tpl Mon Feb 19 07:30:28 2007
@@ -216,7 +216,7 @@
<input title="{$APP.LBL_DUPLICATE_BUTTON_TITLE}" accessKey="{$APP.LBL_DUPLICATE_BUTTON_KEY}" class="crmbutton small create" onclick="this.form.return_module.value='{$MODULE}'; this.form.return_action.value='DetailView'; this.form.isDuplicate.value='true';this.form.module.value='{$MODULE}'; this.form.action.value='EditView'" type="submit" name="Duplicate" value="{$APP.LBL_DUPLICATE_BUTTON_LABEL}">
{/if}
{if $DELETE eq 'permitted'}
- <input title="{$APP.LBL_DELETE_BUTTON_TITLE}" accessKey="{$APP.LBL_DELETE_BUTTON_KEY}" class="crmbutton small delete" onclick="this.form.return_module.value='{$MODULE}'; this.form.return_action.value='index'; this.form.action.value='Delete'; return confirm('{$APP.NTC_DELETE_CONFIRMATION}')" type="submit" name="Delete" value="{$APP.LBL_DELETE_BUTTON_LABEL}">
+ <input title="{$APP.LBL_DELETE_BUTTON_TITLE}" accessKey="{$APP.LBL_DELETE_BUTTON_KEY}" class="crmbutton small delete" onclick="this.form.return_module.value='{$MODULE}'; this.form.return_action.value='index'; this.form.action.value='Delete'; {if $MODULE eq 'Accounts'} return confirm('{$APP.NTC_ACCOUNT_DELETE_CONFIRMATION}')" {else} return confirm('{$APP.NTC_DELETE_CONFIRMATION}')" {/if} type="submit" name="Delete" value="{$APP.LBL_DELETE_BUTTON_LABEL}">
{/if}
</td>
@@ -374,7 +374,7 @@
<input title="{$APP.LBL_DUPLICATE_BUTTON_TITLE}" accessKey="{$APP.LBL_DUPLICATE_BUTTON_KEY}" class="crmbutton small create" onclick="this.form.return_module.value='{$MODULE}'; this.form.return_action.value='DetailView'; this.form.isDuplicate.value='true';this.form.module.value='{$MODULE}'; this.form.action.value='EditView'" type="submit" name="Duplicate" value="{$APP.LBL_DUPLICATE_BUTTON_LABEL}">
{/if}
{if $DELETE eq 'permitted'}
- <input title="{$APP.LBL_DELETE_BUTTON_TITLE}" accessKey="{$APP.LBL_DELETE_BUTTON_KEY}" class="crmbutton small delete" onclick="this.form.return_module.value='{$MODULE}'; this.form.return_action.value='index'; this.form.action.value='Delete'; return confirm('{$APP.NTC_DELETE_CONFIRMATION}')" type="submit" name="Delete" value="{$APP.LBL_DELETE_BUTTON_LABEL}">
+ <input title="{$APP.LBL_DELETE_BUTTON_TITLE}" accessKey="{$APP.LBL_DELETE_BUTTON_KEY}" class="crmbutton small delete" onclick="this.form.return_module.value='{$MODULE}'; this.form.return_action.value='index'; this.form.action.value='Delete'; {if $MODULE eq 'Accounts'} return confirm('{$APP.NTC_ACCOUNT_DELETE_CONFIRMATION}')" {else} return confirm('{$APP.NTC_DELETE_CONFIRMATION}')" {/if} type="submit" name="Delete" value="{$APP.LBL_DELETE_BUTTON_LABEL}">
{/if}
</td>
Modified: vtigercrm/branches/5.0.3/include/js/ListView.js
==============================================================================
--- vtigercrm/branches/5.0.3/include/js/ListView.js (original)
+++ vtigercrm/branches/5.0.3/include/js/ListView.js Mon Feb 19 07:30:28 2007
@@ -72,7 +72,8 @@
alert("Please select at least one entity");
return false;
}
- if(confirm("Are you sure you want to delete the selected "+xx+" records ?"))
+ var alert_str = (module=="Accounts") ? "Deleting this account(s) will remove its related Potentials,Quotes,Sales Order & Invoice. Are you sure you want to delete the selected "+xx+" records?" : "Are you sure you want to delete the selected "+xx+" records ?";
+ if(confirm(alert_str))
{
$("status").style.display="inline";
Modified: vtigercrm/branches/5.0.3/include/js/general.js
==============================================================================
--- vtigercrm/branches/5.0.3/include/js/general.js (original)
+++ vtigercrm/branches/5.0.3/include/js/general.js Mon Feb 19 07:30:28 2007
@@ -622,7 +622,7 @@
var splitval=val.split(".")
- if(splitval[0]>2147483647)
+ if(splitval[0]>18446744073709551615)
{
alert( fldLabel + " exceeds the maximum limit ");
return false;
Modified: vtigercrm/branches/5.0.3/include/language/en_us.lang.php
==============================================================================
--- vtigercrm/branches/5.0.3/include/language/en_us.lang.php (original)
+++ vtigercrm/branches/5.0.3/include/language/en_us.lang.php Mon Feb 19 07:30:28 2007
@@ -176,6 +176,7 @@
'NTC_TIME_FORMAT' => '(24:00)',
'NTC_DATE_TIME_FORMAT' => '(yyyy-mm-dd 24:00)',
'NTC_DELETE_CONFIRMATION' => 'Are you sure you want to delete this record?',
+'NTC_ACCOUNT_DELETE_CONFIRMATION' => 'Deleting this account will remove its related Potentials,Quotes,Sales Order & Invoice. Are you sure you want to delete this account?',
'ERR_DELETE_RECORD' => 'A record number must be specified to delete the contact.',
'ERR_CREATING_TABLE' => 'Error creating table: ',
'ERR_CREATING_FIELDS' => 'Error filling in additional detail fields: ',
Modified: vtigercrm/branches/5.0.3/include/utils/DeleteUtils.php
==============================================================================
--- vtigercrm/branches/5.0.3/include/utils/DeleteUtils.php (original)
+++ vtigercrm/branches/5.0.3/include/utils/DeleteUtils.php Mon Feb 19 07:30:28 2007
@@ -49,11 +49,13 @@
$sql = "delete from vtiger_seproductsrel where crmid=$record and productid=$return_id";
$adb->query($sql);
}
+ delAccRelRecords($record);
if($return_id!='')
{
$sql ='delete from vtiger_seactivityrel where crmid = '.$record.' and activityid = '.$return_id;
$adb->query($sql);
}
+
break;
case Campaigns:
if($return_module == "Leads") {
@@ -373,4 +375,55 @@
}
$log->debug("Entering DeleteEntity method ...");
}
+
+function delAccRelRecords($record){
+
+ global $adb;
+
+ //Deleting Account related Potentials.
+ $pot_q = "select vtiger_crmentity.crmid from vtiger_crmentity inner join vtiger_potential on vtiger_crmentity.crmid=vtiger_potential.potentialid inner join vtiger_account on vtiger_account.accountid=vtiger_potential.accountid where vtiger_crmentity.deleted=0 and vtiger_potential.accountid=".$record;
+ $pot_res = $adb->query($pot_q);
+ for($k=0;$k < $adb->num_rows($pot_res);$k++)
+ {
+ $pot_id = $adb->query_result($pot_res,$k,"crmid");
+ $sql = 'update vtiger_crmentity set deleted = 1 where crmid = '.$pot_id;
+ $adb->query($sql);
+ }
+ //Deleting Account related Sales Orders.
+ $so_q = "select vtiger_crmentity.crmid from vtiger_crmentity inner join vtiger_salesorder on vtiger_crmentity.crmid=vtiger_salesorder.salesorderid inner join vtiger_account on vtiger_account.accountid=vtiger_salesorder.accountid where vtiger_crmentity.deleted=0 and vtiger_salesorder.accountid=".$record;
+ $so_res = $adb->query($so_q);
+ for($k=0;$k < $adb->num_rows($so_res);$k++)
+ {
+ $so_id = $adb->query_result($so_res,$k,"crmid");
+ $sql = 'update vtiger_crmentity set deleted = 1 where crmid = '.$so_id;
+ $adb->query($sql);
+ }
+ //Deleting Account related Quotes.
+ $quo_q = "select vtiger_crmentity.crmid from vtiger_crmentity inner join vtiger_quotes on vtiger_crmentity.crmid=vtiger_quotes.quoteid inner join vtiger_account on vtiger_account.accountid=vtiger_quotes.accountid where vtiger_crmentity.deleted=0 and vtiger_quotes.accountid=".$record;
+ $quo_res = $adb->query($quo_q);
+ for($k=0;$k < $adb->num_rows($quo_res);$k++)
+ {
+ $quo_id = $adb->query_result($quo_res,$k,"crmid");
+ $sql = 'update vtiger_crmentity set deleted = 1 where crmid = '.$quo_id;
+ $adb->query($sql);
+ }
+ //Deleting Account related Invoices.
+ $inv_q = "select vtiger_crmentity.crmid from vtiger_crmentity inner join vtiger_invoice on vtiger_crmentity.crmid=vtiger_invoice.invoiceid inner join vtiger_account on vtiger_account.accountid=vtiger_invoice.accountid where vtiger_crmentity.deleted=0 and vtiger_invoice.accountid=".$record;
+ $inv_res = $adb->query($inv_q);
+ for($k=0;$k < $adb->num_rows($inv_res);$k++)
+ {
+ $inv_id = $adb->query_result($inv_res,$k,"crmid");
+ $sql = 'update vtiger_crmentity set deleted = 1 where crmid = '.$inv_id;
+ $adb->query($sql);
+ }
+ //Deleting Contact-Account Relation.
+ $con_q = "update vtiger_contactdetails set accountid = '' where accountid = ".$record;
+ $con_res = $adb->query($con_q);
+ $adb->query($con_q);
+
+ //Deleting Trouble Tickets-Account Relation.
+ $tt_q = "update vtiger_troubletickets set parent_id = '' where parent_id = ".$record;
+ $tt_res = $adb->query($tt_q);
+ $adb->query($tt_q);
+}
?>
Modified: vtigercrm/branches/5.0.3/modules/Users/massdelete.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Users/massdelete.php (original)
+++ vtigercrm/branches/5.0.3/modules/Users/massdelete.php Mon Feb 19 07:30:28 2007
@@ -33,6 +33,8 @@
$freetag->delete_all_object_tags_for_user($current_user->id,$id);
$sql="update vtiger_crmentity set deleted=1 where crmid='" .$id ."'";
$result = $adb->query($sql);
+ if($returnmodule == 'Accounts')
+ delAccRelRecords($id);
}
else
{
More information about the vtigercrm-commits
mailing list