[Vtigercrm-commits] [vtiger-commits] r10581 - in /vtigercrm/branches/5.0.3: ./ Smarty/templates/ include/utils/ modules/Accounts/ modules/Contacts/ modules/Leads/ modules/Vendors/
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Fri Apr 6 05:57:29 EDT 2007
Author: richie
Date: Fri Apr 6 03:56:37 2007
New Revision: 10581
Log:
fix for Potentials Related list : Select Product popup displays all the products. Fixes #3389 --minnie
Modified:
vtigercrm/branches/5.0.3/Popup.php
vtigercrm/branches/5.0.3/Smarty/templates/RelatedListContents.tpl
vtigercrm/branches/5.0.3/include/utils/ListViewUtils.php
vtigercrm/branches/5.0.3/modules/Accounts/updateRelations.php
vtigercrm/branches/5.0.3/modules/Contacts/updateRelations.php
vtigercrm/branches/5.0.3/modules/Leads/updateRelations.php
vtigercrm/branches/5.0.3/modules/Vendors/updateRelations.php
Modified: vtigercrm/branches/5.0.3/Popup.php
==============================================================================
--- vtigercrm/branches/5.0.3/Popup.php (original)
+++ vtigercrm/branches/5.0.3/Popup.php Fri Apr 6 03:56:37 2007
@@ -131,6 +131,7 @@
}
if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] !='')
$smarty->assign("RETURN_MODULE",$_REQUEST['return_module']);
+ if (isset($_REQUEST['select'])) $smarty->assign("SELECT",'enable');
$alphabetical = AlphabeticalSearch($currentModule,'Popup','productname','true','basic',$popuptype,"","","");
break;
case 'Vendors':
Modified: vtigercrm/branches/5.0.3/Smarty/templates/RelatedListContents.tpl
==============================================================================
--- vtigercrm/branches/5.0.3/Smarty/templates/RelatedListContents.tpl (original)
+++ vtigercrm/branches/5.0.3/Smarty/templates/RelatedListContents.tpl Fri Apr 6 03:56:37 2007
@@ -57,7 +57,7 @@
<!-- input title="{$APP.LBL_ADD_NEW} {$APP.Product}" accessyKey="F" class="crmbutton small save" onclick="this.form.action.value='EditView';this.form.module.value='Products';this.form.return_module.value='{$MODULE}';this.form.return_action.value='{$return_modname}'" type="submit" name="button" value="{$APP.LBL_ADD_NEW} {$APP.Product}"></td -->
{elseif $MODULE eq 'Vendors'}
- <input title="{$APP.LBL_SELECT_BUTTON_LABEL} {$APP.Product}" accessyKey="F" class="crmbutton small create" LANGUAGE=javascript onclick='return window.open("index.php?module=Products&return_module=Vendors&action=Popup&return_action={$return_modname}&popuptype=detailview&form=DetailView&form_submit=false&recordid={$ID}","test","width=640,height=602,resizable=0,scrollbars=0");' type="button" name="button" value="{$APP.LBL_SELECT_BUTTON_LABEL} {$APP.Product}">
+ <input title="{$APP.LBL_SELECT_BUTTON_LABEL} {$APP.Product}" accessyKey="F" class="crmbutton small create" LANGUAGE=javascript onclick='return window.open("index.php?module=Products&return_module=Vendors&action=Popup&return_action={$return_modname}&popuptype=detailview&select=enable&form=DetailView&form_submit=false&recordid={$ID}","test","width=640,height=602,resizable=0,scrollbars=0");' type="button" name="button" value="{$APP.LBL_SELECT_BUTTON_LABEL} {$APP.Product}">
<input title="{$APP.LBL_ADD_NEW} {$APP.Product}" accessyKey="F" class="crmbutton small create" onclick="this.form.action.value='EditView';this.form.module.value='Products';this.form.return_module.value='{$MODULE}';this.form.return_action.value='{$return_modname}'; this.form.parent_id.value='';" type="submit" name="button" value="{$APP.LBL_ADD_NEW} {$APP.Product}"></td>
{else}
<input title="{$APP.LBL_ADD_NEW} {$APP.Product}" accessyKey="F" class="crmbutton small create" onclick="this.form.action.value='EditView';this.form.module.value='Products';this.form.return_module.value='{$MODULE}';this.form.return_action.value='{$return_modname}'" type="submit" name="button" value="{$APP.LBL_ADD_NEW} {$APP.Product}"></td>
Modified: vtigercrm/branches/5.0.3/include/utils/ListViewUtils.php
==============================================================================
--- vtigercrm/branches/5.0.3/include/utils/ListViewUtils.php (original)
+++ vtigercrm/branches/5.0.3/include/utils/ListViewUtils.php Fri Apr 6 03:56:37 2007
@@ -2963,6 +2963,13 @@
$field = $selectfield = 'campaignid';
$table = 'vtiger_campaign';
}
+ elseif($currentmodule == "Products" && ($returnmodule == "Potentials" || $returnmodule == "Accounts" || $returnmodule == "Contacts"))
+ {
+ $reltable = 'vtiger_seproductsrel';
+ $condition = 'WHERE crmid = '.$recordid.' and setype = "'.$returnmodule.'"';
+ $field = $selectfield ='productid';
+ $table = 'vtiger_products';
+ }
if($reltable != null)
$query = "SELECT ".$selectfield." FROM ".$reltable." ".$condition;
Modified: vtigercrm/branches/5.0.3/modules/Accounts/updateRelations.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Accounts/updateRelations.php (original)
+++ vtigercrm/branches/5.0.3/modules/Accounts/updateRelations.php Fri Apr 6 03:56:37 2007
@@ -12,7 +12,7 @@
require_once('include/database/PearDatabase.php');
require_once('user_privileges/default_module_view.php');
global $adb, $singlepane_view;
-
+$idlist = $_REQUEST['idlist'];
$dest_mod = $_REQUEST['destination_module'];
if($singlepane_view == 'true')
@@ -20,22 +20,21 @@
else
$action = "CallRelatedList";
-//save the relationship when we select Product from Account RelatedList
-if($dest_mod == 'Products')
+if(isset($_REQUEST['idlist']) && $_REQUEST['idlist'] != '')
{
- $accountid = $_REQUEST['parid'];
- $productid = $_REQUEST['entityid'];
- if($accountid != '' && $productid != '')
- $adb->query("insert into vtiger_seproductsrel values($accountid,$productid,'Accounts')");
-
- $record = $accountid;
+ //split the string and store in an array
+ $storearray = explode (";",$idlist);
+ foreach($storearray as $id)
+ {
+ if($id != '')
+ {
+ $adb->query("insert into vtiger_seproductsrel values(".$_REQUEST["parentid"].",".$id.",'Accounts')");
+ }
+ }
+ header("Location: index.php?action=$action&module=Accounts&record=".$_REQUEST["parentid"]);
+}elseif(isset($_REQUEST['entityid']) && $_REQUEST['entityid'] != ''){
+ $adb->query("insert into vtiger_seproductsrel values (". $_REQUEST["parid"] .",".$_REQUEST["entityid"] .",'Accounts')");
+ header("Location: index.php?action=$action&module=Accounts&record=".$_REQUEST["parid"]);
}
-
-$module = "Accounts";
-if($_REQUEST['return_module'] != '') $module = $_REQUEST['return_module'];
-
-header("Location: index.php?action=$action&module=$module&record=".$record);
-
-
?>
Modified: vtigercrm/branches/5.0.3/modules/Contacts/updateRelations.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Contacts/updateRelations.php (original)
+++ vtigercrm/branches/5.0.3/modules/Contacts/updateRelations.php Fri Apr 6 03:56:37 2007
@@ -13,25 +13,10 @@
global $adb, $singlepane_view;
$idlist = $_REQUEST['idlist'];
$dest_mod = $_REQUEST['destination_module'];
-$rel_table = 'vtiger_campaigncontrel';
$record = $_REQUEST['record'];
-if($singlepane_view == 'true')
- $action = "DetailView";
-else
- $action = "CallRelatedList";
-
-//save the relationship when we select Product from Contact RelatedList
-if($dest_mod == 'Products')
-{
- $contactid = $_REQUEST['parid'];
- $productid = $_REQUEST['entityid'];
- if($contactid != '' && $productid != '')
- $adb->query("insert into vtiger_seproductsrel values ($contactid,$productid,'Contacts')");
-
- $record = $contactid;
-}
-
+if($singlepane_view == 'true') $action = "DetailView";
+else $action = "CallRelatedList";
if(isset($_REQUEST['idlist']) && $_REQUEST['idlist'] != '')
{
@@ -41,16 +26,20 @@
{
if($id != '')
{
- $sql = "insert into ".$rel_table." values(".$id.",".$_REQUEST["parentid"].")";
- $adb->query($sql);
+ if($dest_mod == 'Products')
+ $adb->query("insert into vtiger_seproductsrel values (".$_REQUEST["parentid"].",".$id.",'Contacts')");
+ elseif($dest_mod == 'Campaigns')
+ $adb->query("insert into vtiger_campaigncontrel values(".$id.",".$_REQUEST["parentid"].")");
}
}
$record = $_REQUEST["parentid"];
}
elseif(isset($_REQUEST['entityid']) && $_REQUEST['entityid'] != '')
-{
- $sql = "insert into ".$rel_table." values(".$_REQUEST["entityid"].",".$_REQUEST["parid"].")";
- $adb->query($sql);
+{
+ if($dest_mod == 'Products')
+ $adb->query("insert into vtiger_seproductsrel values (".$_REQUEST["parid"].",".$_REQUEST["entityid"].",'Contacts')");
+ elseif($dest_mod == 'Campaigns')
+ $adb->query("insert into vtiger_campaigncontrel values(".$_REQUEST["entityid"].",".$_REQUEST["parid"].")");
$record = $_REQUEST["parid"];
}
elseif(isset($_REQUEST['pot_id']) && $_REQUEST['pot_id'] != '')
@@ -59,11 +48,6 @@
$adb->query($sql);
}
-
-$module = 'Contacts';
-if($_REQUEST['return_module'] != '') $module = $_REQUEST['return_module'];
-
-
-header("Location: index.php?action=$action&module=$module&record=".$record);
+header("Location: index.php?action=$action&module=Contacts&record=".$record);
?>
Modified: vtigercrm/branches/5.0.3/modules/Leads/updateRelations.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Leads/updateRelations.php (original)
+++ vtigercrm/branches/5.0.3/modules/Leads/updateRelations.php Fri Apr 6 03:56:37 2007
@@ -14,23 +14,9 @@
global $adb, $singlepane_view;
$idlist = $_REQUEST['idlist'];
$dest_mod = $_REQUEST['destination_module'];
-$rel_table = 'vtiger_campaignleadrel';
-if($singlepane_view == 'true')
- $action = "DetailView";
-else
- $action = "CallRelatedList";
-
-//save the relationship when we select Product from Lead RelatedList
-if($dest_mod == 'Products')
-{
- $leadid = $_REQUEST['parid'];
- $productid = $_REQUEST['entityid'];
- if($leadid != '' && $productid != '')
- $adb->query("insert into vtiger_seproductsrel values($leadid,$productid,'Leads')");
-
- $record = $leadid;
-}
+if($singlepane_view == 'true') $action = "DetailView";
+else $action = "CallRelatedList";
if(isset($_REQUEST['idlist']) && $_REQUEST['idlist'] != '')
{
@@ -40,25 +26,24 @@
{
if($id != '')
{
- $sql = "insert into ".$rel_table." values(".$id.",".$_REQUEST["parentid"].")";
- $adb->query($sql);
+ if($dest_mod == 'Products')
+ $adb->query("insert into vtiger_seproductsrel values (".$_REQUEST["parentid"].",".$id.",'Leads')");
+ elseif($dest_mod == 'Campaigns')
+ $adb->query("insert into vtiger_campaignleadrel values(".$id.",".$_REQUEST["parentid"].")");
}
}
-
$record = $_REQUEST["parentid"];
}
elseif(isset($_REQUEST['entityid']) && $_REQUEST['entityid'] != '')
-{
- $sql = "insert into ".$rel_table." values(".$_REQUEST["entityid"].",".$_REQUEST["parid"].")";
- $adb->query($sql);
-
+{
+ if($dest_mod == 'Products')
+ $adb->query("insert into vtiger_seproductsrel values (".$_REQUEST["parid"].",".$_REQUEST["entityid"].",'Leads')");
+ elseif($dest_mod == 'Campaigns')
+ $adb->query("insert into vtiger_campaignleadrel values(".$_REQUEST["entityid"].",".$_REQUEST["parid"].")");
$record = $_REQUEST["parid"];
}
-$module = "Leads";
-if($_REQUEST['return_module'] != '') $module = $_REQUEST['return_module'];
-
-header("Location: index.php?action=$action&module=$module&record=".$record);
+header("Location: index.php?action=$action&module=Leads&record=".$record);
Modified: vtigercrm/branches/5.0.3/modules/Vendors/updateRelations.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Vendors/updateRelations.php (original)
+++ vtigercrm/branches/5.0.3/modules/Vendors/updateRelations.php Fri Apr 6 03:56:37 2007
@@ -25,7 +25,17 @@
//This will be true, when we select product from vendor related list
if($_REQUEST['destination_module']=='Products')
{
- if($_REQUEST['parid'] != '' && $_REQUEST['entityid'] != '')
+ if(isset($_REQUEST['idlist']) && $_REQUEST['idlist'] != '')
+ {
+ $record = $_REQUEST["parentid"];
+ $storearray = explode (";",$idlist);
+ foreach($storearray as $id)
+ {
+ if($id != '')
+ $adb->query("update vtiger_products set vendor_id=".$record." where productid=".$id);
+ }
+ }
+ elseif($_REQUEST['parid'] != '' && $_REQUEST['entityid'] != '')
{
$sql = "update vtiger_products set vendor_id=".$_REQUEST['parid']." where productid=".$_REQUEST['entityid'];
$adb->query($sql);
More information about the vtigercrm-commits
mailing list