[Vtigercrm-developers] [PATH] fix missing __toString() methods

Enrico Weigelt weigelt at metux.de
Wed Sep 26 05:36:44 PDT 2007


Hi folks,

this patch fixes some missing __toString() methods which cause
vt to crash when certain objects are accessed as strings.

IMHO this should go to 5.1 and 5.1_jens asap.

cu
-- 
----------------------------------------------------------------------
 Enrico Weigelt, metux IT service -- http://www.metux.de/

 cellphone: +49 174 7066481   email: info at metux.de   skype: nekrad666
----------------------------------------------------------------------
 Embedded-Linux / Portierung / Opensource-QM / Verteilte Systeme
----------------------------------------------------------------------
-------------- next part --------------
diff -ruN cleaned/data/CRMEntity.php working/data/CRMEntity.php
--- cleaned/data/CRMEntity.php	2007-05-03 17:50:00.000000000 +0200
+++ working/data/CRMEntity.php	2007-05-03 23:38:06.000000000 +0200
@@ -25,10 +25,16 @@
 require_once('data/Tracker.php');
 require_once('include/utils/utils.php');
 require_once('include/utils/UserInfoUtil.php');
-
-class CRMEntity
-{
-  /**
+
+class CRMEntity
+{
+    /* generic toString() method 		added by nekrad */
+    function __toString()
+    {
+	return serialize($this);
+    }
+
+  /**
    * This method implements a generic insert and update logic for any SugarBean
    * This method only works for subclasses that implement the same variable names.
    * This method uses the presence of an id vtiger_field that is not null to signify and update.
diff -ruN cleaned/modules/Users/Users.php working/modules/Users/Users.php
--- cleaned/modules/Users/Users.php	2007-05-04 02:32:05.000000000 +0200
+++ working/modules/Users/Users.php	2007-05-04 02:59:03.000000000 +0200
@@ -163,6 +163,11 @@
 		$this->log->debug("Exiting Users() method ...");
 	}
 
+	function __toString()
+	{
+	    return "[[USERS]]";
+	}
+
 	// Mike Crowe Mod --------------------------------------------------------Default ordering for us
 	/**
 	 * Function to get sort order


More information about the vtigercrm-developers mailing list