[Vtigercrm-commits] [vtiger-commits] r7976 - /vtigercrm/trunk/soap/webforms.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Thu Jul 13 07:58:50 EDT 2006


Author: saraj
Date: Thu Jul 13 05:58:47 2006
New Revision: 7976

Log:
* Added function to unsubscribe

Modified:
    vtigercrm/trunk/soap/webforms.php

Modified: vtigercrm/trunk/soap/webforms.php
==============================================================================
--- vtigercrm/trunk/soap/webforms.php (original)
+++ vtigercrm/trunk/soap/webforms.php Thu Jul 13 05:58:47 2006
@@ -48,6 +48,14 @@
 		'department'=>'xsd:string',
 		'description'=>'xsd:string',
 		'assigned_user_id'=>'xsd:string'
+	     ),
+	array('return'=>'xsd:string'),
+	$NAMESPACE);
+
+$server->register(
+	'unsubscribe_email',
+	array(
+		'email_address'=>'xsd:string'
 	     ),
 	array('return'=>'xsd:string'),
 	$NAMESPACE);
@@ -122,7 +130,35 @@
 	return $msg;
 }
 
+function unsubscribe_email($emailid)
+{
+	global $adb;
+	$adb->println("Enter into the function unsubscribe_email($emailid)");
+	
+	$contact_res = $adb->query("select emailoptout from vtiger_contactdetails where email=\"$emailid\"");
+	$contact_noofrows = $adb->num_rows($contact_res);
+	$emailoptout = $adb->query_result($contact_res,0,'emailoptout');
 
+	if($contact_noofrows > 0)
+	{
+		if($emailoptout != 1)
+		{
+			$adb->query("update vtiger_contactdetails set emailoptout=1 where email=\"$emailid\"");
+			$msg = "You have been unsubscribed.";
+		}
+		else
+		{
+			$msg = "You are already unsubscribed.";
+		}
+	}
+	else
+	{
+		$msg = "There are no record available for this mail address.";
+	}
+
+	$adb->println("Exit from the function unsubscribe_email($emailid)");
+	return $msg;
+}
 
 
 //$log->fatal("In soap.php");





More information about the vtigercrm-commits mailing list