[Vtigercrm-commits] [vtiger-commits] r10819 - in /vtigercrm/branches/5.0.3: Smarty/templates/ include/js/ include/utils/ modules/Contacts/ modules/Emails/ modules/Leads/
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Mon Apr 30 08:45:14 EDT 2007
Author: richie
Date: Mon Apr 30 06:44:55 2007
New Revision: 10819
Log:
fix for Leads - the 'AddEmail' option in call related list view page showing the popup menu even the value is empty. Fixes #3319 --minnie
Modified:
vtigercrm/branches/5.0.3/Smarty/templates/RelatedListContents.tpl
vtigercrm/branches/5.0.3/Smarty/templates/SelectEmail.tpl
vtigercrm/branches/5.0.3/include/js/Mail.js
vtigercrm/branches/5.0.3/include/utils/CommonUtils.php
vtigercrm/branches/5.0.3/modules/Contacts/CallRelatedList.php
vtigercrm/branches/5.0.3/modules/Emails/Emails.php
vtigercrm/branches/5.0.3/modules/Emails/mailSelect.php
vtigercrm/branches/5.0.3/modules/Leads/CallRelatedList.php
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 Mon Apr 30 06:44:55 2007
@@ -127,7 +127,15 @@
{elseif $header eq 'Emails'}
<input type="hidden" name="email_directing_module">
<input type="hidden" name="record">
+ {if $PERMIT eq '0'}
+ {if $MAIL_CHECK eq 'true'}
<input title="{$APP.LBL_ADD_NEW} {$APP.Email}" accessyKey="F" class="crmbutton small create" onclick="fnvshobj(this,'sendmail_cont');sendmail('{$MODULE}',{$ID});" type="button" name="button" value="{$APP.LBL_ADD_NEW} {$APP.Email}"></td>
+ {else}
+ <input title="{$APP.LBL_ADD_NEW} {$APP.Email}" accessyKey="F" class="crmbutton small create" onclick="javascript:alert('{$APP.LBL_THIS}{$APP.$MODULE}{$APP.DOESNOT_HAVE_MAILIDS}');" type="button" name="button" value="{$APP.LBL_ADD_NEW} {$APP.Email}"></td>
+ {/if}
+ {else}
+ <input title="{$APP.LBL_ADD_NEW} {$APP.Email}" accessyKey="F" class="crmbutton small create" onclick="fnvshobj(this,'sendmail_cont');sendmail('{$MODULE}',{$ID});" type="button" name="button" value="{$APP.LBL_ADD_NEW} {$APP.Email}"></td>
+ {/if}
{elseif $header eq 'Users'}
{if $MODULE eq 'Calendar'}
<input title="Change" accessKey="" tabindex="2" type="button" class="crmbutton small edit" value="{$APP.LBL_SELECT_USER_BUTTON_LABEL}" name="button" LANGUAGE=javascript onclick='return window.open("index.php?module=Users&return_module=Calendar&return_action={$return_modname}&activity_mode=Events&action=Popup&popuptype=detailview&form=EditView&form_submit=true&select=enable&return_id={$ID}&recordid={$ID}","test","width=640,height=525,resizable=0,scrollbars=0")';>
Modified: vtigercrm/branches/5.0.3/Smarty/templates/SelectEmail.tpl
==============================================================================
--- vtigercrm/branches/5.0.3/Smarty/templates/SelectEmail.tpl (original)
+++ vtigercrm/branches/5.0.3/Smarty/templates/SelectEmail.tpl Mon Apr 30 06:44:55 2007
@@ -24,7 +24,6 @@
</td>
</tr>
</table>
-{if $PERMIT eq '0'}
<table border=0 cellspacing=0 cellpadding=5 width=95% align=center>
<tr><td class="small">
<table border=0 cellspacing=0 cellpadding=5 width=100% align=center bgcolor=white>
@@ -44,11 +43,15 @@
{else}
<td align="center"><input type="checkbox" value="{$fieldid}" name="semail" /></td>
{/if}
+ {if $PERMIT eq '0'}
{if $ONE_RECORD eq 'true'}
- <td align="left"><b>{$elements.0} </b><br>{$MAILDATA[$smarty.foreach.emailids.iteration]}</td>
+ <td align="left"><b>{$elements.0}</b><br>{$MAILDATA[$smarty.foreach.emailids.index]}</td>
{else}
<td align="left"><b>{$elements.0}</b></td>
{/if}
+ {else}
+ <td align="left"><b>{$elements.0}</b><br>{$MAILDATA[$smarty.foreach.emailids.index]}</td>
+ {/if}
</tr>
{/foreach}
</table>
@@ -64,15 +67,4 @@
<input type="button" name="{$APP.LBL_CANCEL_BUTTON_LABEL}" value=" {$APP.LBL_CANCEL_BUTTON_LABEL} " class="crmbutton small cancel" onclick="fninvsh('roleLay');" />
</td></tr>
</table>
-{else}
- <table border=0 cellspacing=0 cellpadding=5 width=95% align=center>
- <tr><td class="small">
- <table border=0 cellspacing=0 cellpadding=5 width=100% align=center bgcolor=white>
- <tr><td align="center">
- <b>{$MOD.LBL_MAILSELECT_INFO3}</b>
- </td></tr>
- </table>
- </td></tr>
- </table>
-{/if}
</div>
Modified: vtigercrm/branches/5.0.3/include/js/Mail.js
==============================================================================
--- vtigercrm/branches/5.0.3/include/js/Mail.js (original)
+++ vtigercrm/branches/5.0.3/include/js/Mail.js Mon Apr 30 06:44:55 2007
@@ -122,7 +122,13 @@
method: 'post',
postBody: "module=Emails&return_module="+module+"&action=EmailsAjax&file=mailSelect&idlist="+idstrings,
onComplete: function(response) {
- getObj('sendmail_cont').innerHTML=response.responseText;
+ if(response.responseText == "Mail Ids not permitted")
+ {
+ var url= 'index.php?module=Emails&action=EmailsAjax&pmodule='+module+'&file=EditView&sendmail=true';
+ openPopUp('xComposeEmail',this,url,'createemailWin',820,689,'menubar=no,toolbar=no,location=no,status=no,resizable=no');
+ }
+ else
+ getObj('sendmail_cont').innerHTML=response.responseText;
}
}
);
Modified: vtigercrm/branches/5.0.3/include/utils/CommonUtils.php
==============================================================================
--- vtigercrm/branches/5.0.3/include/utils/CommonUtils.php (original)
+++ vtigercrm/branches/5.0.3/include/utils/CommonUtils.php Mon Apr 30 06:44:55 2007
@@ -2858,5 +2858,40 @@
}
+function is_emailId($entity_id)
+{
+ global $log,$adb;
+ $log->debug("Entering is_EmailId(".$module.",".$entity_id.") method");
+
+ $module = getSalesEntityType($entity_id);
+ if($module == 'Contacts')
+ {
+ $sql = "select email,yahooid from vtiger_contactdetails inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_contactdetails.contactid where contactid = ".$entity_id;
+ $result = $adb->query($sql);
+ $email1 = $adb->query_result($result,0,"email");
+ $email2 = $adb->query_result($result,0,"yahooid");
+ if(($email1 != "" || $email2 != "") || ($email1 != "" && $email2 != ""))
+ {
+ $check_mailids = "true";
+ }
+ else
+ $check_mailids = "false";
+ }
+ elseif($module == 'Leads')
+ {
+ $sql = "select email,yahooid from vtiger_leaddetails inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_leaddetails.leadid where leadid = ".$entity_id;
+ $result = $adb->query($sql);
+ $email1 = $adb->query_result($result,0,"email");
+ $email2 = $adb->query_result($result,0,"yahooid");
+ if(($email1 != "" || $email2 != "") || ($email1 != "" && $email2 != ""))
+ {
+ $check_mailids = "true";
+ }
+ else
+ $check_mailids = "false";
+ }
+ $log->debug("Exiting is_EmailId() method ...");
+ return $check_mailids;
+}
?>
Modified: vtigercrm/branches/5.0.3/modules/Contacts/CallRelatedList.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Contacts/CallRelatedList.php (original)
+++ vtigercrm/branches/5.0.3/modules/Contacts/CallRelatedList.php Mon Apr 30 06:44:55 2007
@@ -46,6 +46,7 @@
global $app_strings;
global $theme;
global $currentModule;
+global $current_user;
$theme_path="themes/".$theme."/";
$image_path=$theme_path."images/";
require_once($theme_path.'layout_utils.php');
@@ -62,6 +63,20 @@
}
$parent_email = getEmailParentsList('Contacts',$_REQUEST['record']);
$smarty->assign("HIDDEN_PARENTS_LIST",$parent_email);
+
+if(isset($_REQUEST['record']) && $_REQUEST['record']!='')
+{
+ $userid = $current_user->id;
+ $sql = "select fieldname from vtiger_field where uitype = 13 and tabid = 4";
+ $result = $adb->query($sql);
+ $num_fieldnames = $adb->num_rows($result);
+ for($i = 0; $i < $num_fieldnames; $i++)
+ {
+ $fieldname = $adb->query_result($result,$i,"fieldname");
+ $permit= getFieldVisibilityPermission("Contacts",$userid,$fieldname);
+ }
+}
+
$category = getparenttab();
$smarty->assign("CATEGORY",$category);
$smarty->assign("ID",$focus->id);
@@ -81,6 +96,8 @@
$check_button = Button_Check($module);
$smarty->assign("CHECK", $check_button);
+$smarty->assign("MAIL_CHECK", is_emailId($RECORD));
+$smarty->assign("PERMIT",$permit);
$smarty->display("RelatedLists.tpl");
}
?>
Modified: vtigercrm/branches/5.0.3/modules/Emails/Emails.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Emails/Emails.php (original)
+++ vtigercrm/branches/5.0.3/modules/Emails/Emails.php Mon Apr 30 06:44:55 2007
@@ -441,45 +441,51 @@
function get_to_emailids($module)
{
global $adb;
- $query = 'select columnname,fieldid from vtiger_field where fieldid in('.ereg_replace(':',',',$_REQUEST["field_lists"]).')';
- $result = $adb->query($query);
- $columns = Array();
- $idlists = '';
- $mailids = '';
- while($row = $adb->fetch_array($result))
- {
- $columns[]=$row['columnname'];
- $fieldid[]=$row['fieldid'];
- }
- $columnlists = implode(',',$columns);
- $crmids = ereg_replace(':',',',$_REQUEST["idlist"]);
- switch($module)
- {
- case 'Leads':
- $query = 'select crmid,concat(lastname," ",firstname) as entityname,'.$columnlists.' from vtiger_leaddetails inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_leaddetails.leadid left join vtiger_leadscf on vtiger_leadscf.leadid = vtiger_leaddetails.leadid where vtiger_crmentity.deleted=0 and vtiger_crmentity.crmid in ('.$crmids.')';
- break;
- case 'Contacts':
- $query = 'select crmid,concat(lastname," ",firstname) as entityname,'.$columnlists.' from vtiger_contactdetails inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_contactdetails.contactid left join vtiger_contactscf on vtiger_contactscf.contactid = vtiger_contactdetails.contactid where vtiger_crmentity.deleted=0 and vtiger_crmentity.crmid in ('.$crmids.')';
- break;
- case 'Accounts':
- $query = 'select crmid,accountname as entityname,'.$columnlists.' from vtiger_account inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_account.accountid left join vtiger_accountscf on vtiger_accountscf.accountid = vtiger_account.accountid where vtiger_crmentity.deleted=0 and vtiger_crmentity.crmid in ('.$crmids.')';
- break;
+ if(isset($_REQUEST["field_lists"]) && $_REQUEST["field_lists"] != "")
+ {
+ $query = 'select columnname,fieldid from vtiger_field where fieldid in('.ereg_replace(':',',',$_REQUEST["field_lists"]).')';
+ $result = $adb->query($query);
+ $columns = Array();
+ $idlists = '';
+ $mailids = '';
+ while($row = $adb->fetch_array($result))
+ {
+ $columns[]=$row['columnname'];
+ $fieldid[]=$row['fieldid'];
+ }
+ $columnlists = implode(',',$columns);
+ $crmids = ereg_replace(':',',',$_REQUEST["idlist"]);
+ switch($module)
+ {
+ case 'Leads':
+ $query = 'select crmid,concat(lastname," ",firstname) as entityname,'.$columnlists.' from vtiger_leaddetails inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_leaddetails.leadid left join vtiger_leadscf on vtiger_leadscf.leadid = vtiger_leaddetails.leadid where vtiger_crmentity.deleted=0 and vtiger_crmentity.crmid in ('.$crmids.')';
+ break;
+ case 'Contacts':
+ $query = 'select crmid,concat(lastname," ",firstname) as entityname,'.$columnlists.' from vtiger_contactdetails inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_contactdetails.contactid left join vtiger_contactscf on vtiger_contactscf.contactid = vtiger_contactdetails.contactid where vtiger_crmentity.deleted=0 and vtiger_crmentity.crmid in ('.$crmids.')';
+ break;
+ case 'Accounts':
+ $query = 'select crmid,accountname as entityname,'.$columnlists.' from vtiger_account inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_account.accountid left join vtiger_accountscf on vtiger_accountscf.accountid = vtiger_account.accountid where vtiger_crmentity.deleted=0 and vtiger_crmentity.crmid in ('.$crmids.')';
+ break;
+ }
+ $result = $adb->query($query);
+ while($row = $adb->fetch_array($result))
+ {
+ $name = $row['entityname'];
+ for($i=0;$i<count($columns);$i++)
+ {
+ if($row[$columns[$i]] != NULL && $row[$columns[$i]] !='')
+ {
+ $idlists .= $row['crmid'].'@'.$fieldid[$i].'|';
+ $mailids .= $name.'<'.$row[$columns[$i]].'>,';
+ }
+ }
+ }
+
+ $return_data = Array('idlists'=>$idlists,'mailds'=>$mailids);
+ }else
+ {
+ $return_data = Array('idlists'=>"",'mailds'=>"");
}
- $result = $adb->query($query);
- while($row = $adb->fetch_array($result))
- {
- $name = $row['entityname'];
- for($i=0;$i<count($columns);$i++)
- {
- if($row[$columns[$i]] != NULL && $row[$columns[$i]] !='')
- {
- $idlists .= $row['crmid'].'@'.$fieldid[$i].'|';
- $mailids .= $name.'<'.$row[$columns[$i]].'>,';
- }
- }
- }
-
- $return_data = Array('idlists'=>$idlists,'mailds'=>$mailids);
return $return_data;
}
Modified: vtigercrm/branches/5.0.3/modules/Emails/mailSelect.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Emails/mailSelect.php (original)
+++ vtigercrm/branches/5.0.3/modules/Emails/mailSelect.php Mon Apr 30 06:44:55 2007
@@ -12,7 +12,7 @@
require_once('include/database/PearDatabase.php');
-global $app_strings,$mod_strings,$current_user,$theme;
+global $app_strings,$mod_strings,$current_user,$theme,$adb;
$image_path = 'themes/'.$theme.'/images/';
$idlist = $_REQUEST['idlist'];
$pmodule=$_REQUEST['return_module'];
@@ -25,51 +25,39 @@
$smarty = new vtigerCRM_Smarty;
$userid = $current_user->id;
-if($pmodule == "Contacts")
+if($pmodule=='Accounts')
{
- $permit = getFieldVisibilityPermission("Contacts", $userid, "email");
-}
-elseif($pmodule == "Accounts")
-{
- $permit = getFieldVisibilityPermission("Accounts", $userid, "email1");
-}
-elseif($pmodule == "Leads")
-{
- $permit = getFieldVisibilityPermission("Leads", $userid, "email");
-}
-if($permit == '0');
-{
- $smarty->assign("PERMIT", $permit);
-}
-
-if ($pmodule=='Accounts')
-{
- $querystr="select fieldid,fieldlabel,columnname,tablename from vtiger_field where tabid=6 and uitype=13;";
+ $querystr="select fieldid,fieldname,fieldlabel,columnname,tablename from vtiger_field where tabid=6 and uitype=13";
}
elseif ($pmodule=='Contacts')
{
- $querystr="select fieldid,fieldlabel,columnname from vtiger_field where tabid=4 and uitype=13;";
+ $querystr="select fieldid,fieldname,fieldlabel,columnname from vtiger_field where tabid=4 and uitype=13";
}
elseif ($pmodule=='Leads')
{
- $querystr="select fieldid,fieldlabel,columnname from vtiger_field where tabid=7 and uitype=13;";
+ $querystr="select fieldid,fieldname,fieldlabel,columnname from vtiger_field where tabid=7 and uitype=13";
}
-$result=$adb->query($querystr);
-$numrows = $adb->num_rows($result);
+$res=$adb->query($querystr);
+$numrows = $adb->num_rows($res);
$returnvalue = Array();
-for ($i=0;$i<$numrows;$i++)
+for($i = 0; $i < $numrows; $i++)
{
$value = Array();
- $temp=$adb->query_result($result,$i,'columnname');
- $columnlists [] = $temp;
- $fieldid=$adb->query_result($result,$i,'fieldid');
- $value[] =$adb->query_result($result,$i,'fieldlabel');
- $returnvalue [$fieldid]= $value;
+ $fieldname = $adb->query_result($res,$i,"fieldname");
+ $permit = getFieldVisibilityPermission($pmodule, $userid, $fieldname);
+ if($permit == '0')
+ {
+ $temp=$adb->query_result($res,$i,'columnname');
+ $columnlists [] = $temp;
+ $fieldid=$adb->query_result($res,$i,'fieldid');
+ $value[] =$adb->query_result($res,$i,'fieldlabel');
+ $returnvalue [$fieldid]= $value;
+ }
}
-if($single_record)
+if($single_record && count($columnlists) > 0)
{
- $count = 1;
+ $count = 0;
switch($pmodule)
{
case 'Accounts':
@@ -101,6 +89,7 @@
break;
}
}
+$smarty->assign('PERMIT',$permit);
$smarty->assign('ENTITY_NAME',$entity_name);
$smarty->assign('ONE_RECORD',$single_record);
$smarty->assign('MAILDATA',$field_value);
@@ -111,5 +100,8 @@
$smarty->assign("FROM_MODULE", $pmodule);
$smarty->assign("IMAGE_PATH",$image_path);
-$smarty->display("SelectEmail.tpl");
+if(count($columnlists) > 0)
+ $smarty->display("SelectEmail.tpl");
+else
+ echo "Mail Ids not permitted";
?>
Modified: vtigercrm/branches/5.0.3/modules/Leads/CallRelatedList.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Leads/CallRelatedList.php (original)
+++ vtigercrm/branches/5.0.3/modules/Leads/CallRelatedList.php Mon Apr 30 06:44:55 2007
@@ -39,6 +39,7 @@
global $app_strings;
global $theme;
global $currentModule;
+global $current_user;
$theme_path="themes/".$theme."/";
$image_path=$theme_path."images/";
@@ -58,7 +59,20 @@
{
unset($_SESSION['rlvs']);
}
-
+
+if(isset($_REQUEST['record']) && $_REQUEST['record']!='')
+{
+ $userid = $current_user->id;
+ $sql = "select fieldname from vtiger_field where uitype = 13 and tabid = 7";
+ $result = $adb->query($sql);
+ $num_fieldnames = $adb->num_rows($result);
+ for($i = 0; $i < $num_fieldnames; $i++)
+ {
+ $fieldname = $adb->query_result($result,$i,"fieldname");
+ $permit= getFieldVisibilityPermission("Leads",$userid,$fieldname);
+ }
+}
+
$category = getParentTab();
$smarty->assign("CATEGORY",$category);
$parent_email = getEmailParentsList('Leads',$focus->id);
@@ -80,6 +94,8 @@
$check_button = Button_Check($module);
$smarty->assign("CHECK", $check_button);
+$smarty->assign("MAIL_CHECK", is_emailId($RECORD));
+$smarty->assign("PERMIT",$permit);
$smarty->display("RelatedLists.tpl");
}
?>
More information about the vtigercrm-commits
mailing list