[Vtigercrm-commits] [vtiger-commits] r10343 - in /vtigercrm/branches/5.0.3: Smarty/templates/Inventory/InventoryDetailView.tpl include/js/ListView.js include/language/en_us.lang.php include/utils/DeleteUtils.php modules/Vendors/Delete.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Mon Mar 5 07:33:16 EST 2007


Author: saraj
Date: Mon Mar  5 05:32:35 2007
New Revision: 10343

Log:
fix for vendor related purchase order is not getting deleted. Fixes #3102   --Minnie

Modified:
    vtigercrm/branches/5.0.3/Smarty/templates/Inventory/InventoryDetailView.tpl
    vtigercrm/branches/5.0.3/include/js/ListView.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/Vendors/Delete.php

Modified: vtigercrm/branches/5.0.3/Smarty/templates/Inventory/InventoryDetailView.tpl
==============================================================================
--- vtigercrm/branches/5.0.3/Smarty/templates/Inventory/InventoryDetailView.tpl (original)
+++ vtigercrm/branches/5.0.3/Smarty/templates/Inventory/InventoryDetailView.tpl Mon Mar  5 05:32:35 2007
@@ -125,7 +125,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}">&nbsp;
 				{/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}">&nbsp;
+				<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 'Vendors'} return confirm('{$APP.NTC_VENDOR_DELETE_CONFIRMATION}')" {else} return confirm('{$APP.NTC_DELETE_CONFIRMATION}')" {/if} type="submit" name="Delete" value="{$APP.LBL_DELETE_BUTTON_LABEL}">&nbsp;
 				{/if}
 			</td>
                    </tr>
@@ -240,7 +240,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}">&nbsp;
 				{/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}">&nbsp;
+				<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 'Vendors'} return confirm('{$APP.NTC_VENDOR_DELETE_CONFIRMATION}')" {else} return confirm('{$APP.NTC_DELETE_CONFIRMATION}')" {/if} type="submit" name="Delete" value="{$APP.LBL_DELETE_BUTTON_LABEL}">&nbsp;
 				{/if}
 			</td>
                    </tr>

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 Mar  5 05:32:35 2007
@@ -72,7 +72,13 @@
             alert("Please select at least one entity");
             return false;
         }
-		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 ?";
+		var alert_str = "Are you sure you want to delete the selected "+xx+" records ?";
+
+		if(module=="Accounts")
+			alert_str = "Deleting this account(s) will remove its related Potentials,Quotes,Sales Orders & Invoice. Are you sure you want to delete the selected "+xx+" records?";
+		else if(module=="Vendors")
+			alert_str = "Deleting this vendor(s) will remove its related Purchase Orders. Are you sure you want to delete the selected "+xx+" records?";
+
 		if(confirm(alert_str))
 		{
 			

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 Mar  5 05:32:35 2007
@@ -176,7 +176,8 @@
 '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?',
+'NTC_ACCOUNT_DELETE_CONFIRMATION' => 'Deleting this account will remove its related Potentials,Quotes,Sales Orders & Invoice. Are you sure you want to delete this account?',
+'NTC_VENDOR_DELETE_CONFIRMATION' => 'Deleting this vendor will remove its related Purchase Orders. Are you sure you want to delete this vendor?',
 '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 Mar  5 05:32:35 2007
@@ -428,7 +428,29 @@
 
 	//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);
 }
+
+function delVendorRelRecords($record){
+	
+	global $adb;
+
+	//Deleting Vendor related PO.
+	$po_q = "select vtiger_crmentity.crmid from vtiger_crmentity inner join vtiger_purchaseorder on vtiger_crmentity.crmid=vtiger_purchaseorder.purchaseorderid inner join vtiger_vendor on vtiger_vendor.vendorid=vtiger_purchaseorder.vendorid where vtiger_crmentity.deleted=0 and vtiger_purchaseorder.vendorid=".$record;
+	$po_res = $adb->query($po_q);
+	for($k=0;$k < $adb->num_rows($po_res);$k++)
+	{
+		$po_id = $adb->query_result($po_res,$k,"crmid");
+		$sql = 'update vtiger_crmentity set deleted = 1 where crmid = '.$po_id;
+		$adb->query($sql);
+	}
+
+	//Deleting Product-Vendor Relation.
+	$pro_q = "update vtiger_products set vendor_id = '' where vendor_id = ".$record;
+	$adb->query($pro_q);
+	//Deleting Contact-Vendor Relaton
+	$vc_sql = "delete from vtiger_vendorcontactrel where vendorid=".$record;
+	$adb->query($vc_sql);
+}
+
 ?>

Modified: vtigercrm/branches/5.0.3/modules/Vendors/Delete.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Vendors/Delete.php (original)
+++ vtigercrm/branches/5.0.3/modules/Vendors/Delete.php Mon Mar  5 05:32:35 2007
@@ -29,11 +29,11 @@
 if(!isset($_REQUEST['record']))
 	die($mod_strings['ERR_DELETE_RECORD']);
 
-
+	
 if($_REQUEST['module'] == $_REQUEST['return_module'])
 {
+	delVendorRelRecords($_REQUEST['record']);
 	$focus->mark_deleted($_REQUEST['record']);
-	$smod ="smodule=VENDOR&";
 }
-header("Location: index.php?".$smod."module=".$_REQUEST['return_module']."&action=".$_REQUEST['return_action']."&record=".$_REQUEST['return_id']."&relmodule=".$_REQUEST['module']);
+header("Location: index.php?module=".$_REQUEST['return_module']."&action=".$_REQUEST['return_action']."&record=".$_REQUEST['return_id']."&relmodule=".$_REQUEST['module']);
 ?>





More information about the vtigercrm-commits mailing list