[Vtigercrm-commits] [vtiger-commits] r5077 - in /vtigercrm/trunk: include/utils/ modules/Accounts/ modules/Accounts/language/ modules/Contacts/ modules/Contacts/language/ modules/Emails/ modules/Potentials/ modules/Users/ schema/

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Wed Apr 12 08:11:32 EDT 2006


Author: saraj
Date: Wed Apr 12 06:11:16 2006
New Revision: 5077

Log:
* Modified to send notification mail to the assigned to owner when create or update the entities Contact and Account

Modified:
    vtigercrm/trunk/include/utils/CommonUtils.php
    vtigercrm/trunk/modules/Accounts/Save.php
    vtigercrm/trunk/modules/Accounts/language/en_us.lang.php
    vtigercrm/trunk/modules/Contacts/Save.php
    vtigercrm/trunk/modules/Contacts/language/en_us.lang.php
    vtigercrm/trunk/modules/Emails/mail.php
    vtigercrm/trunk/modules/Potentials/Save.php
    vtigercrm/trunk/modules/Users/Security.php
    vtigercrm/trunk/schema/DatabaseSchema.xml

Modified: vtigercrm/trunk/include/utils/CommonUtils.php
==============================================================================
--- vtigercrm/trunk/include/utils/CommonUtils.php (original)
+++ vtigercrm/trunk/include/utils/CommonUtils.php Wed Apr 12 06:11:16 2006
@@ -1572,5 +1572,80 @@
 	return $form_data;
 }
 
+/**	Function to send the Notification mail to the assigned to owner about the entity creation or updation
+  *	@param string $module -- module name
+  *	@param object $focus  -- reference of the object
+**/
+function sendNotificationToOwner($module,$focus)
+{
+	require_once("modules/Emails/mail.php");
+	global $current_user;
+
+	$ownername = getUserName($focus->column_fields['assigned_user_id']);
+	$ownermailid = getUserEmailId('id',$focus->column_fields['assigned_user_id']);
+
+	if($module == 'Contacts')
+	{
+		$objectname = $focus->column_fields['lastname'].' '.$focus->column_fields['firstname'];
+		$mod_name = 'Contact';
+		$object_column_fields = array(
+						'lastname'=>'Last Name',
+						'firstname'=>'First Name',
+						'leadsource'=>'Lead Source',
+						'department'=>'Department',
+						'description'=>'Description',
+					     );
+	}
+	if($module == 'Accounts')
+	{
+		$objectname = $focus->column_fields['accountname'];
+		$mod_name = 'Account';
+		$object_column_fields = array(
+						'accountname'=>'Account Name',
+						'rating'=>'Rating',
+						'industry'=>'Industry',
+						'accounttype'=>'Account Type',
+						'description'=>'Description',
+					     );
+	}
+	if($module == 'Potentials')
+	{
+		$objectname = $focus->column_fields['potentialname'];
+		$mod_name = 'Potential';
+		$object_column_fields = array(
+						'potentialname'=>'Potential Name',
+						'amount'=>'Amount',
+						'closingdate'=>'Expected Close Date',
+						'opportunity_type'=>'Opportunity Type',
+						'description'=>'Description',
+			      		     );
+	}	
+	
+	$description = 'Dear '.$ownername.',<br><br>';
+
+	if($focus->mode == 'edit')
+	{
+		$subject = 'Regarding '.$mod_name.' updation - '.$objectname;
+		$description .= 'The '.$mod_name.' has been updated.';
+	}
+	else
+	{
+		$subject = 'Regarding '.$mod_name.' assignment - '.$objectname;
+		$description .= 'The '.$mod_name.' has been assigned to you.';
+	}
+	$description .= 'The '.$mod_name.' details are:<br><br>';
+	$description .= $mod_name.' Id : '.$focus->id.'<br>';
+
+	foreach($object_column_fields as $fieldname => $fieldlabel)
+	{
+		$description .= $fieldlabel.' : <b>'.$focus->column_fields[$fieldname].'</b><br>';
+	}
+
+	$description .= '<br><br>Thanks <br>'.$current_user->user_name;
+	$status = send_mail($module,$ownermailid,$current_user->user_name,'',$subject,$description);
+
+	return $status;
+}
+
 
 ?>

Modified: vtigercrm/trunk/modules/Accounts/Save.php
==============================================================================
Binary files - no diff available.

Modified: vtigercrm/trunk/modules/Accounts/language/en_us.lang.php
==============================================================================
Binary files - no diff available.

Modified: vtigercrm/trunk/modules/Contacts/Save.php
==============================================================================
Binary files - no diff available.

Modified: vtigercrm/trunk/modules/Contacts/language/en_us.lang.php
==============================================================================
Binary files - no diff available.

Modified: vtigercrm/trunk/modules/Emails/mail.php
==============================================================================
--- vtigercrm/trunk/modules/Emails/mail.php (original)
+++ vtigercrm/trunk/modules/Emails/mail.php Wed Apr 12 06:11:16 2006
@@ -149,6 +149,7 @@
 
 	$mail->Subject = $subject;
 	$mail->Body = nl2br($contents);
+	//$mail->Body = html_entity_decode(nl2br($contents));	//if we get html tags in mail then we will use this line
 
 	$mail->IsSMTP();		//set mailer to use SMTP
 	//$mail->Host = "smtp1.example.com;smtp2.example.com";  // specify main and backup server

Modified: vtigercrm/trunk/modules/Potentials/Save.php
==============================================================================
Binary files - no diff available.

Modified: vtigercrm/trunk/modules/Users/Security.php
==============================================================================
--- vtigercrm/trunk/modules/Users/Security.php (original)
+++ vtigercrm/trunk/modules/Users/Security.php Wed Apr 12 06:11:16 2006
@@ -175,9 +175,10 @@
  $this->db->query("insert into field values (6,".$this->db->getUniqueID("field").",'annualrevenue','account',1,'71','annual_revenue','Annual Revenue',1,0,0,100,16,9,1,'I~O',1,null,'ADV')");
  //Added field emailoptout for accounts -- after 4.2 patch2
  $this->db->query("insert into field values (6,".$this->db->getUniqueID("field").",'emailoptout','account',1,'56','emailoptout','Email Opt Out',1,0,0,100,17,9,1,'C~O',1,null,'ADV')");
- $this->db->query("insert into field values (6,".$this->db->getUniqueID("field").",'smownerid','crmentity',1,'53','assigned_user_id','Assigned To',1,0,0,100,18,9,1,'V~M',1,null,'BAS')");
- $this->db->query("insert into field values (6,".$this->db->getUniqueID("field").",'createdtime','crmentity',1,'70','createdtime','Created Time',1,0,0,100,19,9,2,'T~O',1,null,'BAS')");
- $this->db->query("insert into field values (6,".$this->db->getUniqueID("field").",'modifiedtime','crmentity',1,'70','modifiedtime','Modified Time',1,0,0,100,19,9,2,'T~O',1,null,'BAS')");
+ $this->db->query("insert into field values (6,".$this->db->getUniqueID("field").",'notify_owner','account',1,56,'notify_owner','Notify Owner',1,0,0,10,18,9,1,'C~O',1,NULL,'ADV')");
+ $this->db->query("insert into field values (6,".$this->db->getUniqueID("field").",'smownerid','crmentity',1,'53','assigned_user_id','Assigned To',1,0,0,100,19,9,1,'V~M',1,null,'BAS')");
+ $this->db->query("insert into field values (6,".$this->db->getUniqueID("field").",'createdtime','crmentity',1,'70','createdtime','Created Time',1,0,0,100,20,9,2,'T~O',1,null,'BAS')");
+ $this->db->query("insert into field values (6,".$this->db->getUniqueID("field").",'modifiedtime','crmentity',1,'70','modifiedtime','Modified Time',1,0,0,100,21,9,2,'T~O',1,null,'BAS')");
 
 
 
@@ -287,8 +288,9 @@
  $this->db->query("insert into field values (4,".$this->db->getUniqueID("field").",'emailoptout','contactdetails',1,'56','emailoptout','Email Opt Out',1,0,0,100,21,4,1,'C~O',1,null,'ADV')");
  $this->db->query("insert into field values (4,".$this->db->getUniqueID("field").",'smownerid','crmentity',1,'53','assigned_user_id','Assigned To',1,0,0,100,22,4,1,'V~M',1,null,'BAS')");
  $this->db->query("insert into field values (4,".$this->db->getUniqueID("field").",'reference','contactdetails',1,'56','reference','Reference',1,0,0,10,23,4,1,'C~O',1,null,'ADV')");
-$this->db->query("insert into field values (4,".$this->db->getUniqueID("field").",'createdtime','crmentity',1,'70','createdtime','Created Time',1,0,0,100,24,4,2,'T~O',1,null,'BAS')");
- $this->db->query("insert into field values (4,".$this->db->getUniqueID("field").",'modifiedtime','crmentity',1,'70','modifiedtime','Modified Time',1,0,0,100,25,4,2,'T~O',1,null,'BAS')");
+ $this->db->query("insert into field values (4,".$this->db->getUniqueID("field").",'notify_owner','contactdetails',1,'56','notify_owner','Notify Owner',1,0,0,10,24,4,1,'C~O',1,null,'ADV')");
+ $this->db->query("insert into field values (4,".$this->db->getUniqueID("field").",'createdtime','crmentity',1,'70','createdtime','Created Time',1,0,0,100,25,4,2,'T~O',1,null,'BAS')");
+ $this->db->query("insert into field values (4,".$this->db->getUniqueID("field").",'modifiedtime','crmentity',1,'70','modifiedtime','Modified Time',1,0,0,100,26,4,2,'T~O',1,null,'BAS')");
 
 //Block4 -- End
 

Modified: vtigercrm/trunk/schema/DatabaseSchema.xml
==============================================================================
--- vtigercrm/trunk/schema/DatabaseSchema.xml (original)
+++ vtigercrm/trunk/schema/DatabaseSchema.xml Wed Apr 12 06:11:16 2006
@@ -365,7 +365,11 @@
 		</field>
 		<field name="emailoptout" type="C" size="3">
                         <DEFAULT value="0"/>
-                </field>
+		</field>
+		<field name="notify_owner" type="C" size="3">
+			<DEFAULT value="0"/>
+		</field>
+
 		<index name="account_type">
                         <col>account_type</col>
                 </index>	
@@ -500,7 +504,10 @@
 		</field>
 		<field name="imagename" type="C" size="150"></field>
 		<field name="reference" type="C" size="3"></field>
-             		 
+		<field name="notify_owner" type="C" size="3">
+			<DEFAULT value="0"/>
+		</field>
+             
 		 <index name="ContactDetails_IDX1">
 			<col>accountid</col>
 		</index>





More information about the vtigercrm-commits mailing list