[Vtigercrm-commits] [vtiger-commits] r10022 - in /vtigercrm/branches/5.0.3: Smarty/templates/SelectEmail.tpl include/js/general.js modules/Emails/mailSelect.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Thu Jan 4 05:41:16 EST 2007


Author: richie
Date: Thu Jan  4 03:41:08 2007
New Revision: 10022

Log:
check added to avoid email for contacts without email

Modified:
    vtigercrm/branches/5.0.3/Smarty/templates/SelectEmail.tpl
    vtigercrm/branches/5.0.3/include/js/general.js
    vtigercrm/branches/5.0.3/modules/Emails/mailSelect.php

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 Thu Jan  4 03:41:08 2007
@@ -10,6 +10,7 @@
  ********************************************************************************/
 -->*}
 <!-- BEGIN: main -->
+{if $EMAIL_ID neq '' || $YAHOO_ID neq ''}
 <div id="roleLay" style="z-index:12;display:block;width:400px;" class="layerPopup">
 <table border=0 cellspacing=0 cellpadding=5 width=100% class=layerHeadingULine>
 <tr>
@@ -38,9 +39,9 @@
 			{foreach name=emailids key=fieldid item=elements from=$MAILINFO}
 			<tr>
 				{if $smarty.foreach.emailids.iteration eq 1}	
-					<td align="center"><input checked type="checkbox" value="{$fieldid}" name="email"/></td>
-				{else}
-					<td align="center"><input type="checkbox" value="{$fieldid}" name="email"/></td>
+					<td align="center"><input  type="checkbox" value="{$fieldid}" name="email" onClick="checkEmailid('{$ENTITY_NAME}','{$EMAIL_ID}',0,'{$elements.0}')"/></td>
+			{else}
+					<td align="center"><input type="checkbox" value="{$fieldid}" name="email" onClick="checkEmailid('{$ENTITY_NAME}','{$YAHOO_ID}',1,'{$elements.0}')" /></td>
 				{/if}
 				{if $ONE_RECORD eq 'true'}	
 					<td align="left"><b>{$elements.0} </b><br>{$MAILDATA[$smarty.foreach.emailids.iteration]}</td>
@@ -65,5 +66,7 @@
 	</td>
 </tr>
 </table>
-</div> 
-
+</div>
+{else} 
+	<font color='red'>"{$ENTITY_NAME}" doesn't have an emailid</font>
+{/if}

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 Thu Jan  4 03:41:08 2007
@@ -1859,3 +1859,24 @@
 	else
 		window.open("index.php?module=SalesOrder&action=Popup&html=Popup_picker&popuptype=specific&form=EditView","test","width=640,height=602,resizable=0,scrollbars=0");
 }
+
+/**check whether emailid is available for a specific contact or not.
+contactname->name of the contact
+mailaddress->emailaddress
+index->checkbox index
+type->whether its a yahooid or emailid*/
+
+function checkEmailid(contactname,mailaddress,index,type)
+{
+        mail = document.SendMail.elements;
+        mailid = mail[index].checked;
+        if(mailid == true)
+        {
+                if(mailaddress == '')
+                {
+                        alert("'"+contactname+"'"+" doesn't have "+type);
+                        mail[index].checked=false;
+                }
+        }
+
+}

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 Thu Jan  4 03:41:08 2007
@@ -83,10 +83,14 @@
 				$field_value[$count++] = $adb->query_result($result,0,$columnname);
 			}	
 			$entity_name = $adb->query_result($result,0,'contactname');
+			$emailid = $adb->query_result($result,0,'email');
+			$yahooid = $adb->query_result($result,0,'yahooid');
 			break;	
 	}	
 }
 $smarty->assign('ENTITY_NAME',$entity_name);
+$smarty->assign('EMAIL_ID',$emailid);
+$smarty->assign('YAHOO_ID',$yahooid);
 $smarty->assign('ONE_RECORD',$single_record);
 $smarty->assign('MAILDATA',$field_value);
 $smarty->assign('MAILINFO',$returnvalue);





More information about the vtigercrm-commits mailing list