diff --git a/PEAR.php b/PEAR.php index a94a3de419d274af59b22b90c85fd723c6de87f2..be09432e118527112e384613c38da4de9e0efd61 100644 --- a/PEAR.php +++ b/PEAR.php @@ -156,7 +156,7 @@ class PEAR // }}} // {{{ constructor - + /** * Constructor. Registers this object in * $_PEAR_destructor_object_list for destructor emulation if a @@ -167,7 +167,7 @@ class PEAR * @access public * @return void */ - function PEAR($error_class = null) + function __construct($error_class = null) { $classname = strtolower(get_class($this)); if ($this->_debug) { @@ -191,6 +191,13 @@ class PEAR } } } + function PEAR($error_class = null) + { + // PHP4-style constructor. + // This will NOT be invoked, unless a sub-class that extends `foo` calls it. + // In that case, call the new-style constructor to keep compatibility. + self::__construct($error_class); + } // }}} // {{{ destructor @@ -842,7 +849,7 @@ class PEAR_Error * @access public * */ - function PEAR_Error($message = 'unknown error', $code = null, + function __construct($message = 'unknown error', $code = null, $mode = null, $options = null, $userinfo = null) { if ($mode === null) { @@ -900,6 +907,15 @@ class PEAR_Error eval('$e = new Exception($this->message, $this->code);throw($e);'); } } + function PEAR_Error($message = 'unknown error', $code = null, + $mode = null, $options = null, $userinfo = null) + { + // PHP4-style constructor. + // This will NOT be invoked, unless a sub-class that extends `foo` calls it. + // In that case, call the new-style constructor to keep compatibility. + self::__construct($message, $code,$mode, $options, $userinfo); + + } // }}} // {{{ getMode() diff --git a/config.php b/config.php index e835cce53fec0800deece75922c04a445fbaf1ec..f7c45f4369a9d84543468217fb2f70f2ff6d0cd6 100644 --- a/config.php +++ b/config.php @@ -30,15 +30,15 @@ class VtigerConfig { static function get($key, $defvalue='') { if (self::has($key)) { - global $$key; - return $$key; + global ${$key}; + return ${$key}; } return $defvalue; } static function has($key) { - global $$key; - return (isset($$key)); + global ${$key}; + return (isset(${$key})); } static function getOD($key, $defvalue='') { diff --git a/data/Tracker.php b/data/Tracker.php index cc2e9623e49be668432b0e60cf308b492bb076c5..706dbc300b307a763cd47aef592ae5128fae7ee4 100755 --- a/data/Tracker.php +++ b/data/Tracker.php @@ -44,14 +44,21 @@ class Tracker { "item_id", "item_summary" ); - - function Tracker() + function __construct() { $this->log = LoggerManager::getLogger('Tracker'); - // $this->db = PearDatabase::getInstance(); - global $adb; + // $this->db = PearDatabase::getInstance(); + global $adb; $this->db = $adb; } + function Tracker() + { + + // PHP4-style constructor. + // This will NOT be invoked, unless a sub-class that extends `foo` calls it. + // In that case, call the new-style constructor to keep compatibility. + self::__construct(); + } /** * Add this new item to the vtiger_tracker vtiger_table. If there are too many items (global config for now) diff --git a/include/ListView/ListViewSession.php b/include/ListView/ListViewSession.php index 4d4c17c7b78ce2bbafb2ea46b639b0caa5da0030..2219ecd5d0dcb31bfd2cb85dd3e2dda4bf88e341 100644 --- a/include/ListView/ListViewSession.php +++ b/include/ListView/ListViewSession.php @@ -25,15 +25,21 @@ class ListViewSession { * Portions created by vtigerCRM are Copyright (C) vtigerCRM. * All Rights Reserved. */ - - function ListViewSession() - { - global $log,$currentModule; + function __construct() + { + global $log,$currentModule; $log->debug("Entering ListViewSession() method ..."); $this->module = $currentModule; $this->sortby = 'ASC'; $this->start =1; + } + function ListViewSession() + { + // PHP4-style constructor. + // This will NOT be invoked, unless a sub-class that extends `foo` calls it. + // In that case, call the new-style constructor to keep compatibility. + self::__construct(); } function getCurrentPage($currentModule,$viewId){ diff --git a/include/ListView/RelatedListViewSession.php b/include/ListView/RelatedListViewSession.php index 4fc135e449e97d097d0505f1f8632bb685cbda3a..2aea4153630a5d4a247b90a9300543f8fa4067ec 100644 --- a/include/ListView/RelatedListViewSession.php +++ b/include/ListView/RelatedListViewSession.php @@ -23,13 +23,20 @@ class RelatedListViewSession { var $sorder = null; var $sortby = null; var $page_view = null; - - function RelatedListViewSession() { - global $log,$currentModule; + + function __construct() + { + global $log,$currentModule; $log->debug("Entering RelatedListViewSession() method ..."); $this->module = $currentModule; $this->start =1; + } + function RelatedListViewSession() { + // PHP4-style constructor. + // This will NOT be invoked, unless a sub-class that extends `foo` calls it. + // In that case, call the new-style constructor to keep compatibility. + self::__construct(); } public static function addRelatedModuleToSession($relationId, $header) { diff --git a/include/Webservices/EntityMeta.php b/include/Webservices/EntityMeta.php index 3a4e9e70211f31a69ebd3a46d68f3b2945152f5c..831eb69b533edd238ec5947c7fd4f5ae52ca4ccc 100644 --- a/include/Webservices/EntityMeta.php +++ b/include/Webservices/EntityMeta.php @@ -34,12 +34,19 @@ abstract class EntityMeta{ protected $ownerFields; protected $moduleFields = null; - protected function EntityMeta($webserviceObject,$user){ - $this->webserviceObject = $webserviceObject; + protected function __construct($webserviceObject,$user) + { + $this->webserviceObject = $webserviceObject; $this->objectName = $this->webserviceObject->getEntityName(); $this->objectId = $this->webserviceObject->getEntityId(); $this->user = $user; + } + protected function EntityMeta($webserviceObject,$user){ + // PHP4-style constructor. + // This will NOT be invoked, unless a sub-class that extends `foo` calls it. + // In that case, call the new-style constructor to keep compatibility. + self::__construct($webserviceObject,$user); } public function getEmailFields(){ diff --git a/include/Webservices/OperationManager.php b/include/Webservices/OperationManager.php index 63e8d5a79099dfe845eee28a889ca5fdb1c1bbd9..7f9f959127fd9e8f6fca3f888bdb5d0d1ce32eb3 100644 --- a/include/Webservices/OperationManager.php +++ b/include/Webservices/OperationManager.php @@ -35,9 +35,8 @@ private $preLogin; private $operationId; private $operationParams; - - function OperationManager($adb,$operationName,$format, $sessionManager){ - + function __construct($adb,$operationName,$format, $sessionManager) + { $this->format = strtolower($format); $this->sessionManager = $sessionManager; $this->formatObjects = array(); @@ -58,6 +57,13 @@ $this->inParamProcess["encoded"] = &$this->formatObjects[$this->format]["decode"]; $this->fillOperationDetails($operationName); } + function OperationManager($adb,$operationName,$format, $sessionManager){ + // PHP4-style constructor. + // This will NOT be invoked, unless a sub-class that extends `foo` calls it. + // In that case, call the new-style constructor to keep compatibility. + self::__construct($adb,$operationName,$format, $sessionManager); + + } function isPreLoginOperation(){ return $this->preLogin == 1; diff --git a/include/Webservices/PreserveGlobal.php b/include/Webservices/PreserveGlobal.php index ade32710210ba4912ee6f18e8ec0c6eb5bc15723..b0c9d7a70fbd1e731dfb74e4d74788e04f0ba2b3 100644 --- a/include/Webservices/PreserveGlobal.php +++ b/include/Webservices/PreserveGlobal.php @@ -14,42 +14,42 @@ class VTWS_PreserveGlobal{ static function preserveGlobal($name,$value){ //$name store the name of the global. - global $$name; + global ${$name}; //To not push null value . Ideally we should not push null value for any name //But current user null is dangerous so we are checking for only current user - if(!empty($$name) || $name != 'current_user') { + if(!empty(${$name}) || $name != 'current_user') { if(!is_array(VTWS_PreserveGlobal::$globalData[$name])){ VTWS_PreserveGlobal::$globalData[$name] = array(); } - VTWS_PreserveGlobal::$globalData[$name][] = $$name; + VTWS_PreserveGlobal::$globalData[$name][] = ${$name}; } - $$name = $value; - return $$name; + ${$name} = $value; + return ${$name}; } static function restore($name){ //$name store the name of the global. - global $$name; + global ${$name}; if(is_array(VTWS_PreserveGlobal::$globalData[$name]) && count(VTWS_PreserveGlobal::$globalData[$name]) > 0){ - $$name = array_pop(VTWS_PreserveGlobal::$globalData[$name]); + ${$name} = array_pop(VTWS_PreserveGlobal::$globalData[$name]); } - $$name; + ${$name}; } static function getGlobal($name){ - global $$name; - return VTWS_PreserveGlobal::preserveGlobal($name,$$name); + global ${$name}; + return VTWS_PreserveGlobal::preserveGlobal($name,${$name}); } static function flush(){ foreach (VTWS_PreserveGlobal::$globalData as $name => $detail) { //$name store the name of the global. - global $$name; + global ${$name}; if(is_array(VTWS_PreserveGlobal::$globalData[$name]) && count(VTWS_PreserveGlobal::$globalData[$name]) > 0) { - $$name = array_pop(VTWS_PreserveGlobal::$globalData[$name]); + ${$name} = array_pop(VTWS_PreserveGlobal::$globalData[$name]); } } } diff --git a/include/Webservices/QueryParser.php b/include/Webservices/QueryParser.php index 1cbca970e7212710a7438ed0943edeacdbb6e3f7..7333463d42bfce5bad6c8ca264552db916ac7ea2 100644 --- a/include/Webservices/QueryParser.php +++ b/include/Webservices/QueryParser.php @@ -19,11 +19,19 @@ private $hasError ; private $error ; private $user; - function Parser($user, $q){ + function __construct($user, $q) + { $this->query = $q; $this->out = array(); $this->hasError = false; - $this->user = $user; + $this->user = $user; + } + + function Parser($user, $q){ + // PHP4-style constructor. + // This will NOT be invoked, unless a sub-class that extends `foo` calls it. + // In that case, call the new-style constructor to keep compatibility. + self::__construct($user, $q); } function parse(){ diff --git a/include/Webservices/SessionManager.php b/include/Webservices/SessionManager.php index fff4e25cb30f034aa4f993f633b2e90309bd005c..e325d9914464ef0f641bdf28c49f8765aff4a642 100644 --- a/include/Webservices/SessionManager.php +++ b/include/Webservices/SessionManager.php @@ -26,8 +26,8 @@ private $sessionVar = "__SessionExists"; private $error ; - function SessionManager(){ - + function __construct() + { global $maxWebServiceSessionLifeSpan, $maxWebServiceSessionIdleTime; $now = time(); @@ -42,6 +42,13 @@ //otherwise it subtracts the time from previous time HTTP_Session2::setIdle($this->idleLife, true); } + function SessionManager(){ + // PHP4-style constructor. + // This will NOT be invoked, unless a sub-class that extends `foo` calls it. + // In that case, call the new-style constructor to keep compatibility. + self::__construct(); + + } function isValid(){ diff --git a/include/Webservices/State.php b/include/Webservices/State.php index c5c162174bf6ecd460edabbe347dba7551efab17..a91c952182348bce94a82d47dac2d1f93b45b550 100644 --- a/include/Webservices/State.php +++ b/include/Webservices/State.php @@ -14,11 +14,18 @@ var $result ; var $error; - function State(){ + function __construct() + { $this->success = false; $this->result = array(); $this->error = array(); } + function State(){ + // PHP4-style constructor. + // This will NOT be invoked, unless a sub-class that extends `foo` calls it. + // In that case, call the new-style constructor to keep compatibility. + self::__construct(); + } } diff --git a/include/Webservices/VtigerCRMActorMeta.php b/include/Webservices/VtigerCRMActorMeta.php index cab7a7c92adce777c40efba01214b59b86b266f6..962af7092013fdc6ed65838183ad9e0c29fa09eb 100644 --- a/include/Webservices/VtigerCRMActorMeta.php +++ b/include/Webservices/VtigerCRMActorMeta.php @@ -13,7 +13,8 @@ class VtigerCRMActorMeta extends EntityMeta { protected static $fieldTypeMapping = array(); protected static $referenceTypeMapping = array(); - function VtigerCRMActorMeta($tableName,$webserviceObject,$adb,$user){ + function __construct($tableName,$webserviceObject,$adb,$user) + { parent::__construct($webserviceObject,$user); $this->baseTable = $tableName; $this->idColumn = null; @@ -23,6 +24,12 @@ class VtigerCRMActorMeta extends EntityMeta { $this->tableIndexList = null; $this->defaultTableList = array(); } + function VtigerCRMActorMeta($tableName,$webserviceObject,$adb,$user){ + // PHP4-style constructor. + // This will NOT be invoked, unless a sub-class that extends `foo` calls it. + // In that case, call the new-style constructor to keep compatibility. + self::__construct($tableName,$webserviceObject,$adb,$user); + } public function getIdColumn() { if($this->idColumn === null) { diff --git a/include/Webservices/VtigerCRMObject.php b/include/Webservices/VtigerCRMObject.php index 033ffd683accbab464093150b96c9931286d6d76..45f472ca0812f228239619f40c41cba2274aa98c 100644 --- a/include/Webservices/VtigerCRMObject.php +++ b/include/Webservices/VtigerCRMObject.php @@ -13,8 +13,8 @@ class VtigerCRMObject{ private $moduleName ; private $moduleId ; private $instance ; - - function VtigerCRMObject($moduleCredential, $isId=false){ + function __construct($moduleCredential, $isId=false) + { if($isId){ $this->moduleId = $moduleCredential; @@ -26,6 +26,12 @@ class VtigerCRMObject{ $this->instance = null; $this->getInstance(); } + function VtigerCRMObject($moduleCredential, $isId=false){ + // PHP4-style constructor. + // This will NOT be invoked, unless a sub-class that extends `foo` calls it. + // In that case, call the new-style constructor to keep compatibility. + self::__construct($moduleCredential, $isId); + } public function getModuleName(){ return $this->moduleName; diff --git a/include/Webservices/VtigerCRMObjectMeta.php b/include/Webservices/VtigerCRMObjectMeta.php index dc4afcb3d7a82c5dbb933f3793f5c8f463897841..d0941fd818888942d47cee4bafd78bb3dcd6296d 100644 --- a/include/Webservices/VtigerCRMObjectMeta.php +++ b/include/Webservices/VtigerCRMObjectMeta.php @@ -21,7 +21,8 @@ class VtigerCRMObjectMeta extends EntityMeta { private $hasDeleteAccess; private $assignUsers; - function VtigerCRMObjectMeta($webserviceObject,$user){ + function __construct($webserviceObject,$user) + { parent::__construct($webserviceObject,$user); @@ -50,6 +51,12 @@ class VtigerCRMObjectMeta extends EntityMeta { } $this->tabId = null; } + function VtigerCRMObjectMeta($webserviceObject,$user){ + // PHP4-style constructor. + // This will NOT be invoked, unless a sub-class that extends `foo` calls it. + // In that case, call the new-style constructor to keep compatibility. + self::__construct($webserviceObject,$user); + } /** * returns tabid of the current object. diff --git a/include/Webservices/VtigerModuleOperation.php b/include/Webservices/VtigerModuleOperation.php index 930d1ce5ae9de5f4048b144fb94a76447c1bb435..0ee1ca18fa546b1348516c4f2451f512bd654630 100644 --- a/include/Webservices/VtigerModuleOperation.php +++ b/include/Webservices/VtigerModuleOperation.php @@ -13,11 +13,18 @@ class VtigerModuleOperation extends WebserviceEntityOperation { protected $isEntity = true; protected $partialDescribeFields = null; - public function VtigerModuleOperation($webserviceObject,$user,$adb,$log){ + public function __construct($webserviceObject,$user,$adb,$log) + { parent::__construct($webserviceObject,$user,$adb,$log); $this->meta = $this->getMetaInstance(); $this->tabId = $this->meta->getTabId(); } + public function VtigerModuleOperation($webserviceObject,$user,$adb,$log){ + // PHP4-style constructor. + // This will NOT be invoked, unless a sub-class that extends `foo` calls it. + // In that case, call the new-style constructor to keep compatibility. + self::__construct($webserviceObject,$user,$adb,$log); + } protected function getMetaInstance(){ if(empty(WebserviceEntityOperation::$metaCache[$this->webserviceObject->getEntityName()][$this->user->id])){ diff --git a/include/Webservices/VtigerWebserviceObject.php b/include/Webservices/VtigerWebserviceObject.php index 23783a98f5beaff4330c88ce7228d5d8d11a5ae4..73581148ac4feb15bf858a7166eef112d39ddae3 100644 --- a/include/Webservices/VtigerWebserviceObject.php +++ b/include/Webservices/VtigerWebserviceObject.php @@ -15,7 +15,8 @@ class VtigerWebserviceObject{ private $handlerPath; private $handlerClass; - private function VtigerWebserviceObject($entityId,$entityName,$handler_path,$handler_class){ + private function __construct($entityId,$entityName,$handler_path,$handler_class) + { $this->id = $entityId; $this->name = $entityName; // Quick Fix to override default Actor class & path (good to update DB itself) @@ -28,6 +29,13 @@ class VtigerWebserviceObject{ $this->handlerClass = $handler_class; } + private function VtigerWebserviceObject($entityId,$entityName,$handler_path,$handler_class){ + // PHP4-style constructor. + // This will NOT be invoked, unless a sub-class that extends `foo` calls it. + // In that case, call the new-style constructor to keep compatibility. + self::__construct($entityId,$entityName,$handler_path,$handler_class); + } + // Cache variables to enable result re-use private static $_fromNameCache = array(); diff --git a/include/Webservices/WebServiceError.php b/include/Webservices/WebServiceError.php index 13725b7b366d4088bbd0d7c345f11ca698cf3395..9f8009aba4621429c45f74f1e54a2804a83bff5c 100644 --- a/include/Webservices/WebServiceError.php +++ b/include/Webservices/WebServiceError.php @@ -13,11 +13,17 @@ public $code; public $message; - - function WebServiceException($errCode,$msg){ + function __construct($errCode,$msg) + { $this->code = $errCode; $this->message = $msg; } + function WebServiceException($errCode,$msg){ + // PHP4-style constructor. + // This will NOT be invoked, unless a sub-class that extends `foo` calls it. + // In that case, call the new-style constructor to keep compatibility. + self::__construct($errCode,$msg); + } } diff --git a/include/Webservices/WebserviceEntityOperation.php b/include/Webservices/WebserviceEntityOperation.php index d53176a5da3d52f797a2d3434ffa1d43a81defea..876d2d45d8e158ddf39baeb0995b047aab1dc0f8 100644 --- a/include/Webservices/WebserviceEntityOperation.php +++ b/include/Webservices/WebserviceEntityOperation.php @@ -21,12 +21,19 @@ abstract class WebserviceEntityOperation{ protected static $metaCache = array(); - protected function WebserviceEntityOperation($webserviceObject,$user,$adb,$log){ + protected function __construct($webserviceObject,$user,$adb,$log) + { $this->user = $user; $this->log = $log; $this->webserviceObject = $webserviceObject; $this->pearDB = $adb; } + protected function WebserviceEntityOperation($webserviceObject,$user,$adb,$log){ + // PHP4-style constructor. + // This will NOT be invoked, unless a sub-class that extends `foo` calls it. + // In that case, call the new-style constructor to keep compatibility. + self::__construct($webserviceObject,$user,$adb,$log); + } public function create($elementType,$element){ throw new WebServiceException(WebServiceErrorCode::$OPERATIONNOTSUPPORTED, diff --git a/include/utils/RecurringType.php b/include/utils/RecurringType.php index 0d2d56a5805ea86c4367298d81ec7a4dab365acf..f7ce0af3c823f62d4d861ca42e931e305c8c90d7 100644 --- a/include/utils/RecurringType.php +++ b/include/utils/RecurringType.php @@ -31,8 +31,9 @@ class RecurringType { * Constructor for class RecurringType * @param array $repeat_arr - array contains recurring info */ - function RecurringType($repeat_arr) { - + function __construct($repeat_arr) + { + $st_date = explode("-", $repeat_arr["startdate"]); $st_time = explode(":", $repeat_arr["starttime"]); $end_date = explode("-", $repeat_arr["enddate"]); @@ -75,6 +76,12 @@ class RecurringType { $this->recurringdates = $this->_getRecurringDates(); } + function RecurringType($repeat_arr) { + // PHP4-style constructor. + // This will NOT be invoked, unless a sub-class that extends `foo` calls it. + // In that case, call the new-style constructor to keep compatibility. + self::__construct($repeat_arr); + } public static function fromUserRequest($requestArray) { // All the information from the user is received in User Time zone diff --git a/include/utils/export.php b/include/utils/export.php index 41720fbd11fadaf66df762a3dd9a84a848a75edd..0fb897570e82686e5bff15106e77a6a89f4442b9 100755 --- a/include/utils/export.php +++ b/include/utils/export.php @@ -276,9 +276,16 @@ class ExportUtils{ var $fieldsArr = array(); var $picklistValues = array(); - function ExportUtils($module, $fields_array){ + function __construct($module, $fields_array) + { self::__init($module, $fields_array); } + function ExportUtils($module, $fields_array){ + // PHP4-style constructor. + // This will NOT be invoked, unless a sub-class that extends calls it. + // In that case, call the new-style constructor to keep compatibility. + self::__construct($module, $fields_array); + } function __init($module, $fields_array){ diff --git a/modules/Accounts/Accounts.php b/modules/Accounts/Accounts.php index 821a5534f1ed57fa9f7beb4d784b6bcf5e533b31..80b094869766f351732b3db7613d41541861f3b6 100644 --- a/modules/Accounts/Accounts.php +++ b/modules/Accounts/Accounts.php @@ -102,11 +102,14 @@ class Accounts extends CRMEntity { 'Project' => array('table_name' => 'vtiger_project', 'table_index' => 'projectid', 'rel_index' => 'linktoaccountscontacts'), 'PurchaseOrder' => array('table_name' => 'vtiger_purchaseorder', 'table_index' => 'purchaseorderid', 'rel_index' => 'accountid'), ); - + function __construct() + { + $this->log =LoggerManager::getLogger('account'); + $this->db = PearDatabase::getInstance(); + $this->column_fields = getColumnFields('Accounts'); + } function Accounts() { - $this->log =LoggerManager::getLogger('account'); - $this->db = PearDatabase::getInstance(); - $this->column_fields = getColumnFields('Accounts'); + self::__construct(); } /** Function to handle module specific operations when saving a entity diff --git a/modules/Calendar/Activity.php b/modules/Calendar/Activity.php index 42a06897ea4b04378c5d61c954a84629b8bd2f0b..c30f3b0f0071e48d91d6c735e1915ef79b417bcb 100644 --- a/modules/Calendar/Activity.php +++ b/modules/Calendar/Activity.php @@ -103,11 +103,14 @@ class Activity extends CRMEntity { var $default_sort_order = 'ASC'; //var $groupTable = Array('vtiger_activitygrouprelation','activityid'); - + function __construct() + { + $this->log = LoggerManager::getLogger('Calendar'); + $this->db = PearDatabase::getInstance(); + $this->column_fields = getColumnFields('Calendar'); + } function Activity() { - $this->log = LoggerManager::getLogger('Calendar'); - $this->db = PearDatabase::getInstance(); - $this->column_fields = getColumnFields('Calendar'); + self::__construct(); } function save_module($module) diff --git a/modules/Calendar/Appointment.php b/modules/Calendar/Appointment.php index 5730e3892d2417c90ca8fe027390f10cfa09c946..cf2fb0780368fed53dd3ecc204d183cb1551fce0 100644 --- a/modules/Calendar/Appointment.php +++ b/modules/Calendar/Appointment.php @@ -42,12 +42,15 @@ class Appointment var $shared = false; var $recurring; var $dur_hour; - + function __construct() + { + $this->participant = Array(); + $this->participant_state = Array(); + $this->description = ""; + } function Appointment() { - $this->participant = Array(); - $this->participant_state = Array(); - $this->description = ""; + self::__construct(); } /** To get the events of the specified user and shared events diff --git a/modules/Calendar/Calendar.php b/modules/Calendar/Calendar.php index bfd88d8bcad9f593556b0f443813c130b68e46aa..b28c142b4624358b851acc93cf63f73e78f46715 100644 --- a/modules/Calendar/Calendar.php +++ b/modules/Calendar/Calendar.php @@ -28,12 +28,16 @@ class Calendar /* constructor */ + function __construct($view='',$data=Array()) + { + $this->view = $view; + $this->date_time = new vt_DateTime($data,true); + $this->constructLayout(); + } //var $groupTable = Array('vtiger_activitygrouprelation','activityid'); function Calendar($view='',$data=Array()) { - $this->view = $view; - $this->date_time = new vt_DateTime($data,true); - $this->constructLayout(); + self::__construct($view,$data); } /** * Function to get calendarview Label @@ -256,17 +260,23 @@ class Layout * @param string $view - calendarview * @param string $time - time string */ - + function __construct($view,$time) + { + $this->view = $view; + $this->start_time = $time; + if ($view == 'month') { + $this->end_time = $this->start_time->getMonthendtime(); + } + if ($view == 'day') { + $this->end_time = $this->start_time->getDayendtime(); + } + if ($view == 'hour') { + $this->end_time = $this->start_time->getHourendtime(); + } + } function Layout($view,$time) { - $this->view = $view; - $this->start_time = $time; - if ( $view == 'month') - $this->end_time = $this->start_time->getMonthendtime(); - if ( $view == 'day') - $this->end_time = $this->start_time->getDayendtime(); - if ( $view == 'hour') - $this->end_time = $this->start_time->getHourendtime(); + self::__construct($view,$time); } /** diff --git a/modules/Calendar/Date.php b/modules/Calendar/Date.php index b3f9df5a5d7ab206eb07dd143cb780034ee96ef7..0bd74ac34f79588c0fa3d7e9fa9aca7a0d370b7c 100644 --- a/modules/Calendar/Date.php +++ b/modules/Calendar/Date.php @@ -39,55 +39,59 @@ class vt_DateTime * @param array $timearr - collection of string * @param string $check - check string */ + function __construct(&$timearr,$check) + { + if (! isset( $timearr) || count($timearr) == 0 ) + { + $this->setDateTime(null); + } + else if ( isset( $timearr['ts'])) + { + $this->setDateTime($timearr['ts']); + } + else + { + if(isset($timearr['hour']) && $timearr['hour'] !== '') + { + $this->hour = $timearr['hour']; + } + if(isset($timearr['min']) && $timearr['min'] !== '') + { + $this->minute = $timearr['min']; + } + if(isset($timearr['sec']) && $timearr['sec'] !== '') + { + $this->second = $timearr['sec']; + } + if(isset($timearr['day']) && $timearr['day'] !== '') + { + $this->day = $timearr['day']; + } + if(isset($timearr['week']) && $timearr['week'] !== '') + { + $this->week = $timearr['week']; + } + if(isset($timearr['month']) && $timearr['month'] !== '') + { + $this->month = $timearr['month']; + } + if(isset($timearr['year']) && $timearr['year'] >= 1970) + { + $this->year = $timearr['year']; + } + else + { + return null; + } + } + if ($check) + { + $this->getDateTime(); + } + } function vt_DateTime(&$timearr,$check) { - if (! isset( $timearr) || count($timearr) == 0 ) - { - $this->setDateTime(null); - } - else if ( isset( $timearr['ts'])) - { - $this->setDateTime($time['ts']); - } - else - { - if(isset($timearr['hour']) && $timearr['hour'] !== '') - { - $this->hour = $timearr['hour']; - } - if(isset($timearr['min']) && $timearr['min'] !== '') - { - $this->minute = $timearr['min']; - } - if(isset($timearr['sec']) && $timearr['sec'] !== '') - { - $this->second = $timearr['sec']; - } - if(isset($timearr['day']) && $timearr['day'] !== '') - { - $this->day = $timearr['day']; - } - if(isset($timearr['week']) && $timearr['week'] !== '') - { - $this->week = $timearr['week']; - } - if(isset($timearr['month']) && $timearr['month'] !== '') - { - $this->month = $timearr['month']; - } - if(isset($timearr['year']) && $timearr['year'] >= 1970) - { - $this->year = $timearr['year']; - } - else - { - return null; - } - } - if ($check) - { - $this->getDateTime(); - } + self::__construct($timearr,$check); } /** diff --git a/modules/Calendar/iCal/iCalendar_components.php b/modules/Calendar/iCal/iCalendar_components.php index e916c6900bc87701900371e3ca613d09a474d779..bbaf6034b27a1edbb831816a54b70515fd5619f3 100644 --- a/modules/Calendar/iCal/iCalendar_components.php +++ b/modules/Calendar/iCal/iCalendar_components.php @@ -8,9 +8,13 @@ class iCalendar_component { var $valid_properties = NULL; var $valid_components = NULL; - function iCalendar_component() { + function __construct() + { $this->construct(); } + function iCalendar_component() { + self::__construct(); + } function construct() { // Initialize the components array diff --git a/modules/Calendar/iCal/iCalendar_properties.php b/modules/Calendar/iCal/iCalendar_properties.php index ad7eb14eb844d20ff24b57d601722b6b088c73b0..b1f320361ab2535583928cc3e148d83a8e3976ba 100644 --- a/modules/Calendar/iCal/iCalendar_properties.php +++ b/modules/Calendar/iCal/iCalendar_properties.php @@ -13,10 +13,10 @@ class iCalendar_property { var $val_default = NULL; function iCalendar_property() { - $this->construct(); + self::__construct(); } - function construct() { + function __construct() { $this->parameters = array(); } diff --git a/modules/Calendar/iCal/ical-parser-class.php b/modules/Calendar/iCal/ical-parser-class.php index ed4d3c3237e9ddf8a2abd16d2e2fcb984aa1eb22..7395c2e260669e3da5bb674e0efbffebec9a8fe5 100644 --- a/modules/Calendar/iCal/ical-parser-class.php +++ b/modules/Calendar/iCal/ical-parser-class.php @@ -4,9 +4,12 @@ class iCal { var $folders; - function iCal() { + function __construct() { $this->folders = 'cache/import/'; } + function iCal() { + self::__construct(); + } function iCalReader($filename,$root_directory='') { $iCaltoArray = $this->iCalDecoder($filename,$root_directory); diff --git a/modules/Campaigns/Campaigns.php b/modules/Campaigns/Campaigns.php index 93fa0c1a0161c44dc97b21fe40877f429880a8ed..0e30a887d8af1a687df3537ad08a013685d72c4b 100644 --- a/modules/Campaigns/Campaigns.php +++ b/modules/Campaigns/Campaigns.php @@ -68,12 +68,14 @@ class Campaigns extends CRMEntity { // For Alphabetical search var $def_basicsearch_col = 'campaignname'; - + function __construct() { + $this->log =LoggerManager::getLogger('campaign'); + $this->db = PearDatabase::getInstance(); + $this->column_fields = getColumnFields('Campaigns'); + } function Campaigns() { - $this->log =LoggerManager::getLogger('campaign'); - $this->db = PearDatabase::getInstance(); - $this->column_fields = getColumnFields('Campaigns'); + self::__construct(); } /** Function to handle module specific operations when saving a entity diff --git a/modules/Contacts/Contacts.php b/modules/Contacts/Contacts.php index 1a53e84d561d641057f1c4c9d955ca7c6b503d5e..61e4c11efb67653ecb9a04eab5b4fc4f31790997 100644 --- a/modules/Contacts/Contacts.php +++ b/modules/Contacts/Contacts.php @@ -144,11 +144,13 @@ class Contacts extends CRMEntity { 'Emails' => array('table_name' => 'vtiger_seactivityrel', 'table_index' => 'crmid', 'rel_index' => 'activityid'), 'Vendors' => array('table_name' => 'vtiger_vendorcontactrel', 'table_index' => 'vendorid', 'rel_index' => 'contactid'), ); - + function __construct() { + $this->log = LoggerManager::getLogger('contact'); + $this->db = PearDatabase::getInstance(); + $this->column_fields = getColumnFields('Contacts'); + } function Contacts() { - $this->log = LoggerManager::getLogger('contact'); - $this->db = PearDatabase::getInstance(); - $this->column_fields = getColumnFields('Contacts'); + self::__construct(); } // Mike Crowe Mod --------------------------------------------------------Default ordering for us diff --git a/modules/CustomView/CustomView.php b/modules/CustomView/CustomView.php index db8bf8c97d353c0b67214672e6dd9f6172a8827a..af3ea9c50a6ec8a4ea64fbca1272d75940fc1add 100644 --- a/modules/CustomView/CustomView.php +++ b/modules/CustomView/CustomView.php @@ -52,16 +52,19 @@ class CustomView extends CRMEntity { * @param $module -- The module Name:: Type String(optional) * @returns nothing */ + function __construct($module = "") { + global $current_user; + $this->customviewmodule = $module; + $this->escapemodule[] = $module . "_"; + $this->escapemodule[] = "_"; + $this->smownerid = $current_user->id; + $this->moduleMetaInfo = array(); + if ($module != "" && $module != 'Calendar') { + $this->meta = $this->getMeta($module, $current_user); + } + } function CustomView($module = "") { - global $current_user, $adb; - $this->customviewmodule = $module; - $this->escapemodule[] = $module . "_"; - $this->escapemodule[] = "_"; - $this->smownerid = $current_user->id; - $this->moduleMetaInfo = array(); - if ($module != "" && $module != 'Calendar') { - $this->meta = $this->getMeta($module, $current_user); - } + self::__construct($module); } /** diff --git a/modules/Documents/Documents.php b/modules/Documents/Documents.php index 4d1319a1a31c95cf96f0610b3067138b6a441961..b1c53de169278c92bc68d65ae3daa53ba8591764 100644 --- a/modules/Documents/Documents.php +++ b/modules/Documents/Documents.php @@ -70,12 +70,16 @@ class Documents extends CRMEntity { //Added these variables which are used as default order by and sortorder in ListView var $default_order_by = 'title'; var $default_sort_order = 'ASC'; + + function __construct() { + $this->log = LoggerManager::getLogger('notes'); + $this->log->debug("Entering Documents() method ..."); + $this->db = PearDatabase::getInstance(); + $this->column_fields = getColumnFields('Documents'); + $this->log->debug("Exiting Documents method ..."); + } function Documents() { - $this->log = LoggerManager::getLogger('notes'); - $this->log->debug("Entering Documents() method ..."); - $this->db = PearDatabase::getInstance(); - $this->column_fields = getColumnFields('Documents'); - $this->log->debug("Exiting Documents method ..."); + self::__construct(); } function save_module($module) diff --git a/modules/Emails/Emails.php b/modules/Emails/Emails.php index e926d382f020a42d85c7067e3c3f66b7ad66c961..e05b9fa3d06f81b73e48ef4091a0dd45542e4ec9 100644 --- a/modules/Emails/Emails.php +++ b/modules/Emails/Emails.php @@ -67,13 +67,16 @@ class Emails extends CRMEntity { /** This function will set the columnfields for Email module */ + function __construct() { + $this->log = LoggerManager::getLogger('email'); + $this->log->debug("Entering Emails() method ..."); + $this->log = LoggerManager::getLogger('email'); + $this->db = PearDatabase::getInstance(); + $this->column_fields = getColumnFields('Emails'); + $this->log->debug("Exiting Email method ..."); + } function Emails() { - $this->log = LoggerManager::getLogger('email'); - $this->log->debug("Entering Emails() method ..."); - $this->log = LoggerManager::getLogger('email'); - $this->db = PearDatabase::getInstance(); - $this->column_fields = getColumnFields('Emails'); - $this->log->debug("Exiting Email method ..."); + self::__construct(); } function save_module($module) { diff --git a/modules/Faq/Faq.php b/modules/Faq/Faq.php index 992fd0a755419fc59b725a30f894c8a2a8d2f9eb..3cbd5f538c89a44955da23a439ccfa2909cfdc35 100755 --- a/modules/Faq/Faq.php +++ b/modules/Faq/Faq.php @@ -79,12 +79,15 @@ class Faq extends CRMEntity { /** Constructor which will set the column_fields in this object */ + function __construct() { + $this->log =LoggerManager::getLogger('faq'); + $this->log->debug("Entering Faq() method ..."); + $this->db = PearDatabase::getInstance(); + $this->column_fields = getColumnFields('Faq'); + $this->log->debug("Exiting Faq method ..."); + } function Faq() { - $this->log =LoggerManager::getLogger('faq'); - $this->log->debug("Entering Faq() method ..."); - $this->db = PearDatabase::getInstance(); - $this->column_fields = getColumnFields('Faq'); - $this->log->debug("Exiting Faq method ..."); + self::__construct(); } function save_module($module) diff --git a/modules/HelpDesk/HelpDesk.php b/modules/HelpDesk/HelpDesk.php index 0d83c3d3a9926af7b77129c90d6ffa295a1d05e7..bea2dfdab343414caa27a6a5cfbd9701325d152d 100644 --- a/modules/HelpDesk/HelpDesk.php +++ b/modules/HelpDesk/HelpDesk.php @@ -100,13 +100,16 @@ class HelpDesk extends CRMEntity { /** Constructor which will set the column_fields in this object */ + function __construct() { + $this->log =LoggerManager::getLogger('helpdesk'); + $this->log->debug("Entering HelpDesk() method ..."); + $this->db = PearDatabase::getInstance(); + $this->column_fields = getColumnFields('HelpDesk'); + $this->log->debug("Exiting HelpDesk method ..."); + } function HelpDesk() { - $this->log =LoggerManager::getLogger('helpdesk'); - $this->log->debug("Entering HelpDesk() method ..."); - $this->db = PearDatabase::getInstance(); - $this->column_fields = getColumnFields('HelpDesk'); - $this->log->debug("Exiting HelpDesk method ..."); + self::__construct(); } diff --git a/modules/Install/models/ConfigFileUtils.php b/modules/Install/models/ConfigFileUtils.php index 378d122b7cbaf26079e2daf3b5cc25d6b68b1524..4eff068d46765d0150adb1663644d6b2e94bfd65 100644 --- a/modules/Install/models/ConfigFileUtils.php +++ b/modules/Install/models/ConfigFileUtils.php @@ -24,32 +24,36 @@ class Install_ConfigFileUtils_Model { private $currencyName; private $adminEmail; + function __construct($configFileParameters) { + if (isset($configFileParameters['root_directory'])){ + $this->rootDirectory = $configFileParameters['root_directory']; + } + + if (isset($configFileParameters['db_hostname'])) { + if(strpos($configFileParameters['db_hostname'], ":")) { + list($this->dbHostname,$this->dbPort) = explode(":",$configFileParameters['db_hostname']); + } else { + $this->dbHostname = $configFileParameters['db_hostname']; + } + } + + if (isset($configFileParameters['db_username'])) $this->dbUsername = $configFileParameters['db_username']; + if (isset($configFileParameters['db_password'])) $this->dbPassword = $configFileParameters['db_password']; + if (isset($configFileParameters['db_name'])) $this->dbName = $configFileParameters['db_name']; + if (isset($configFileParameters['db_type'])) $this->dbType = $configFileParameters['db_type']; + if (isset($configFileParameters['site_URL'])) $this->siteUrl = $configFileParameters['site_URL']; + if (isset($configFileParameters['admin_email'])) $this->adminEmail = $configFileParameters['admin_email']; + if (isset($configFileParameters['currency_name'])) $this->currencyName = $configFileParameters['currency_name']; + if (isset($configFileParameters['vt_charset'])) $this->vtCharset = $configFileParameters['vt_charset']; + if (isset($configFileParameters['default_language'])) $this->vtDefaultLanguage = $configFileParameters['default_language']; + + // update default port + if ($this->dbPort == '') $this->dbPort = self::getDbDefaultPort($this->dbType); + + $this->cacheDir = 'cache/'; + } function Install_ConfigFileUtils_Model($configFileParameters) { - if (isset($configFileParameters['root_directory'])) - $this->rootDirectory = $configFileParameters['root_directory']; - - if (isset($configFileParameters['db_hostname'])) { - if(strpos($configFileParameters['db_hostname'], ":")) { - list($this->dbHostname,$this->dbPort) = explode(":",$configFileParameters['db_hostname']); - } else { - $this->dbHostname = $configFileParameters['db_hostname']; - } - } - - if (isset($configFileParameters['db_username'])) $this->dbUsername = $configFileParameters['db_username']; - if (isset($configFileParameters['db_password'])) $this->dbPassword = $configFileParameters['db_password']; - if (isset($configFileParameters['db_name'])) $this->dbName = $configFileParameters['db_name']; - if (isset($configFileParameters['db_type'])) $this->dbType = $configFileParameters['db_type']; - if (isset($configFileParameters['site_URL'])) $this->siteUrl = $configFileParameters['site_URL']; - if (isset($configFileParameters['admin_email'])) $this->adminEmail = $configFileParameters['admin_email']; - if (isset($configFileParameters['currency_name'])) $this->currencyName = $configFileParameters['currency_name']; - if (isset($configFileParameters['vt_charset'])) $this->vtCharset = $configFileParameters['vt_charset']; - if (isset($configFileParameters['default_language'])) $this->vtDefaultLanguage = $configFileParameters['default_language']; - - // update default port - if ($this->dbPort == '') $this->dbPort = self::getDbDefaultPort($this->dbType); - - $this->cacheDir = 'cache/'; + self::__construct($configFileParameters); } static function getDbDefaultPort($dbType) { diff --git a/modules/Invoice/Invoice.php b/modules/Invoice/Invoice.php index 01b57227b8896b1b9ad4cd20382a6e0bcb0c6d47..46f8f255f99a2f296bb03e55a4a753a83a752cd9 100755 --- a/modules/Invoice/Invoice.php +++ b/modules/Invoice/Invoice.php @@ -104,12 +104,15 @@ class Invoice extends CRMEntity { /** Constructor which will set the column_fields in this object */ + function __construct() { + $this->log =LoggerManager::getLogger('Invoice'); + $this->log->debug("Entering Invoice() method ..."); + $this->db = PearDatabase::getInstance(); + $this->column_fields = getColumnFields('Invoice'); + $this->log->debug("Exiting Invoice method ..."); + } function Invoice() { - $this->log =LoggerManager::getLogger('Invoice'); - $this->log->debug("Entering Invoice() method ..."); - $this->db = PearDatabase::getInstance(); - $this->column_fields = getColumnFields('Invoice'); - $this->log->debug("Exiting Invoice method ..."); + self::__construct(); } diff --git a/modules/Leads/Leads.php b/modules/Leads/Leads.php index bd7bb6ae64d8841a7d91e71bdfcd38de2ee72f81..25f47856a2236e5c0d91c1fd928b8d34335ce6db 100755 --- a/modules/Leads/Leads.php +++ b/modules/Leads/Leads.php @@ -85,12 +85,15 @@ class Leads extends CRMEntity { var $LBL_LEAD_MAPPING = 'LBL_LEAD_MAPPING'; //var $groupTable = Array('vtiger_leadgrouprelation','leadid'); + function __construct() { + $this->log = LoggerManager::getLogger('lead'); + $this->log->debug("Entering Leads() method ..."); + $this->db = PearDatabase::getInstance(); + $this->column_fields = getColumnFields('Leads'); + $this->log->debug("Exiting Lead method ..."); + } function Leads() { - $this->log = LoggerManager::getLogger('lead'); - $this->log->debug("Entering Leads() method ..."); - $this->db = PearDatabase::getInstance(); - $this->column_fields = getColumnFields('Leads'); - $this->log->debug("Exiting Lead method ..."); + self::__construct(); } /** Function to handle module specific operations when saving a entity diff --git a/modules/Potentials/Potentials.php b/modules/Potentials/Potentials.php index b58308fa05847f9ba8e74e77872338f1ada689f4..96e1f9a9c75b86b32edd9c9cfb0d4494cc34da1e 100644 --- a/modules/Potentials/Potentials.php +++ b/modules/Potentials/Potentials.php @@ -92,10 +92,13 @@ class Potentials extends CRMEntity { var $LBL_POTENTIAL_MAPPING = 'LBL_OPPORTUNITY_MAPPING'; //var $groupTable = Array('vtiger_potentialgrouprelation','potentialid'); - function Potentials() { - $this->log = LoggerManager::getLogger('potential'); - $this->db = PearDatabase::getInstance(); - $this->column_fields = getColumnFields('Potentials'); + function __construct() { + $this->log = LoggerManager::getLogger('potential'); + $this->db = PearDatabase::getInstance(); + $this->column_fields = getColumnFields('Potentials'); + } + function Potentials() { + self::__construct(); } function save_module($module) diff --git a/modules/PriceBooks/PriceBooks.php b/modules/PriceBooks/PriceBooks.php index 514e0936b2f00c75230193e7c3eb0e817269c5ba..06d5e6d202bfb197cd4ba2c3f4e655741895704a 100755 --- a/modules/PriceBooks/PriceBooks.php +++ b/modules/PriceBooks/PriceBooks.php @@ -54,12 +54,15 @@ class PriceBooks extends CRMEntity { /** Constructor which will set the column_fields in this object */ + function __construct() { + $this->log =LoggerManager::getLogger('pricebook'); + $this->log->debug("Entering PriceBooks() method ..."); + $this->db = PearDatabase::getInstance(); + $this->column_fields = getColumnFields('PriceBooks'); + $this->log->debug("Exiting PriceBook method ..."); + } function PriceBooks() { - $this->log =LoggerManager::getLogger('pricebook'); - $this->log->debug("Entering PriceBooks() method ..."); - $this->db = PearDatabase::getInstance(); - $this->column_fields = getColumnFields('PriceBooks'); - $this->log->debug("Exiting PriceBook method ..."); + self::__construct(); } function save_module($module) diff --git a/modules/Products/Products.php b/modules/Products/Products.php index 3d24496771876d84dc1b17190dadeb06bafd50bb..4ea28bde20aea80b14076fa4e3a55920db1a3951 100755 --- a/modules/Products/Products.php +++ b/modules/Products/Products.php @@ -73,12 +73,15 @@ class Products extends CRMEntity { /** Constructor which will set the column_fields in this object */ + function __construct() { + $this->log =LoggerManager::getLogger('product'); + $this->log->debug("Entering Products() method ..."); + $this->db = PearDatabase::getInstance(); + $this->column_fields = getColumnFields('Products'); + $this->log->debug("Exiting Product method ..."); + } function Products() { - $this->log =LoggerManager::getLogger('product'); - $this->log->debug("Entering Products() method ..."); - $this->db = PearDatabase::getInstance(); - $this->column_fields = getColumnFields('Products'); - $this->log->debug("Exiting Product method ..."); + self::__construct(); } function save_module($module) diff --git a/modules/PurchaseOrder/PurchaseOrder.php b/modules/PurchaseOrder/PurchaseOrder.php index 81c15375af4e4c61f662b58413ecc3a4a5836cd9..452e3510f7cd5eabc2035f690c49bf38efb6e18f 100644 --- a/modules/PurchaseOrder/PurchaseOrder.php +++ b/modules/PurchaseOrder/PurchaseOrder.php @@ -97,10 +97,13 @@ class PurchaseOrder extends CRMEntity { * This function creates an instance of LoggerManager class using getLogger method * creates an instance for PearDatabase class and get values for column_fields array of Order class. */ + function __construct() { + $this->log =LoggerManager::getLogger('PurchaseOrder'); + $this->db = PearDatabase::getInstance(); + $this->column_fields = getColumnFields('PurchaseOrder'); + } function PurchaseOrder() { - $this->log =LoggerManager::getLogger('PurchaseOrder'); - $this->db = PearDatabase::getInstance(); - $this->column_fields = getColumnFields('PurchaseOrder'); + self::__construct(); } function save_module($module) diff --git a/modules/Quotes/Quotes.php b/modules/Quotes/Quotes.php index 4df4199d4381098a513385b00c4a655fc561ed09..19089618a8192db16149ac20a342cc755223cd40 100755 --- a/modules/Quotes/Quotes.php +++ b/modules/Quotes/Quotes.php @@ -104,10 +104,13 @@ class Quotes extends CRMEntity { /** Constructor which will set the column_fields in this object */ + function __construct() { + $this->log =LoggerManager::getLogger('quote'); + $this->db = PearDatabase::getInstance(); + $this->column_fields = getColumnFields('Quotes'); + } function Quotes() { - $this->log =LoggerManager::getLogger('quote'); - $this->db = PearDatabase::getInstance(); - $this->column_fields = getColumnFields('Quotes'); + self::__construct(); } function save_module() diff --git a/modules/Reports/ReportRun.php b/modules/Reports/ReportRun.php index c846d9678e63c1bae180c8045260cd4f60b4a09e..cc3452b7701fd6d2c6deab5ff5b2124843f711fc 100644 --- a/modules/Reports/ReportRun.php +++ b/modules/Reports/ReportRun.php @@ -325,15 +325,18 @@ class ReportRun extends CRMEntity { * To ensure single-instance is present for $reportid * as we optimize using ReportRunPlanner and setup temporary tables. */ + function __construct($reportid) { + $oReport = new Reports($reportid); + $this->reportid = $reportid; + $this->primarymodule = $oReport->primodule; + $this->secondarymodule = $oReport->secmodule; + $this->reporttype = $oReport->reporttype; + $this->reportname = $oReport->reportname; + $this->queryPlanner = new ReportRunQueryPlanner(); + $this->queryPlanner->reportRun = $this; + } function ReportRun($reportid) { - $oReport = new Reports($reportid); - $this->reportid = $reportid; - $this->primarymodule = $oReport->primodule; - $this->secondarymodule = $oReport->secmodule; - $this->reporttype = $oReport->reporttype; - $this->reportname = $oReport->reportname; - $this->queryPlanner = new ReportRunQueryPlanner(); - $this->queryPlanner->reportRun = $this; + self::__construct($reportid); } public static function getInstance($reportid) { diff --git a/modules/Reports/Reports.php b/modules/Reports/Reports.php index 65efa848d6780969c49a20cd51a94017894d7d3f..44ceb2a5f16bd642b635f881ecf8868f3939b39c 100644 --- a/modules/Reports/Reports.php +++ b/modules/Reports/Reports.php @@ -110,87 +110,89 @@ class Reports extends CRMEntity{ * This function accepts the vtiger_reportid as argument * It sets primodule,secmodule,reporttype,reportname,reportdescription,folderid for the given vtiger_reportid */ - + function __construct($reportid="") { + global $adb,$current_user,$theme,$mod_strings; + $this->initListOfModules(); + if($reportid != "") + { + // Lookup information in cache first + $cachedInfo = VTCacheUtils::lookupReport_Info($current_user->id, $reportid); + $subordinate_users = VTCacheUtils::lookupReport_SubordinateUsers($reportid); + + $reportModel = Reports_Record_Model::getCleanInstance($reportid); + $sharingType = $reportModel->get('sharingtype'); + + if($cachedInfo === false) { + $ssql = "select vtiger_reportmodules.*,vtiger_report.* from vtiger_report inner join vtiger_reportmodules on vtiger_report.reportid = vtiger_reportmodules.reportmodulesid"; + $ssql .= " where vtiger_report.reportid = ?"; + $params = array($reportid); + + require_once('include/utils/GetUserGroups.php'); + require('user_privileges/user_privileges_'.$current_user->id.'.php'); + $userGroups = new GetUserGroups(); + $userGroups->getAllUserGroups($current_user->id); + $user_groups = $userGroups->user_groups; + if(!empty($user_groups) && $sharingType == 'Private'){ + $user_group_query = " (shareid IN (".generateQuestionMarks($user_groups).") AND setype='groups') OR"; + array_push($params, $user_groups); + } + + $non_admin_query = " vtiger_report.reportid IN (SELECT reportid from vtiger_reportsharing WHERE $user_group_query (shareid=? AND setype='users'))"; + if($sharingType == 'Private'){ + $ssql .= " and (( (".$non_admin_query.") or vtiger_report.sharingtype='Public' or vtiger_report.owner = ? or vtiger_report.owner in(select vtiger_user2role.userid from vtiger_user2role inner join vtiger_users on vtiger_users.id=vtiger_user2role.userid inner join vtiger_role on vtiger_role.roleid=vtiger_user2role.roleid where vtiger_role.parentrole like '".$current_user_parent_role_seq."::%'))"; + array_push($params, $current_user->id); + array_push($params, $current_user->id); + } + + $query = $adb->pquery("select userid from vtiger_user2role inner join vtiger_users on vtiger_users.id=vtiger_user2role.userid inner join vtiger_role on vtiger_role.roleid=vtiger_user2role.roleid where vtiger_role.parentrole like '".$current_user_parent_role_seq."::%'",array()); + $subordinate_users = Array(); + for($i=0;$i<$adb->num_rows($query);$i++){ + $subordinate_users[] = $adb->query_result($query,$i,'userid'); + } + + // Update subordinate user information for re-use + VTCacheUtils::updateReport_SubordinateUsers($reportid, $subordinate_users); + + //Report sharing for vtiger7 + $queryObj = new stdClass(); + $queryObj->query = $ssql; + $queryObj->queryParams = $params; + $queryObj = self::getReportSharingQuery($queryObj, $sharingType); + + $result = $adb->pquery($queryObj->query, $queryObj->queryParams); + if($result && $adb->num_rows($result)) { + $reportmodulesrow = $adb->fetch_array($result); + + // Update information in cache now + VTCacheUtils::updateReport_Info( + $current_user->id, $reportid, $reportmodulesrow["primarymodule"], + $reportmodulesrow["secondarymodules"], $reportmodulesrow["reporttype"], + $reportmodulesrow["reportname"], $reportmodulesrow["description"], + $reportmodulesrow["folderid"], $reportmodulesrow["owner"] + ); + } + + // Re-look at cache to maintain code-consistency below + $cachedInfo = VTCacheUtils::lookupReport_Info($current_user->id, $reportid); + } + + if($cachedInfo) { + $this->primodule = $cachedInfo["primarymodule"]; + $this->secmodule = $cachedInfo["secondarymodules"]; + $this->reporttype = $cachedInfo["reporttype"]; + $this->reportname = decode_html($cachedInfo["reportname"]); + $this->reportdescription = decode_html($cachedInfo["description"]); + $this->folderid = $cachedInfo["folderid"]; + if($is_admin==true || in_array($cachedInfo["owner"],$subordinate_users) || $cachedInfo["owner"]==$current_user->id) + $this->is_editable = 'true'; + else + $this->is_editable = 'false'; + } + } + } function Reports($reportid="") { - global $adb,$current_user,$theme,$mod_strings; - $this->initListOfModules(); - if($reportid != "") - { - // Lookup information in cache first - $cachedInfo = VTCacheUtils::lookupReport_Info($current_user->id, $reportid); - $subordinate_users = VTCacheUtils::lookupReport_SubordinateUsers($reportid); - - $reportModel = Reports_Record_Model::getCleanInstance($reportid); - $sharingType = $reportModel->get('sharingtype'); - - if($cachedInfo === false) { - $ssql = "select vtiger_reportmodules.*,vtiger_report.* from vtiger_report inner join vtiger_reportmodules on vtiger_report.reportid = vtiger_reportmodules.reportmodulesid"; - $ssql .= " where vtiger_report.reportid = ?"; - $params = array($reportid); - - require_once('include/utils/GetUserGroups.php'); - require('user_privileges/user_privileges_'.$current_user->id.'.php'); - $userGroups = new GetUserGroups(); - $userGroups->getAllUserGroups($current_user->id); - $user_groups = $userGroups->user_groups; - if(!empty($user_groups) && $sharingType == 'Private'){ - $user_group_query = " (shareid IN (".generateQuestionMarks($user_groups).") AND setype='groups') OR"; - array_push($params, $user_groups); - } - - $non_admin_query = " vtiger_report.reportid IN (SELECT reportid from vtiger_reportsharing WHERE $user_group_query (shareid=? AND setype='users'))"; - if($sharingType == 'Private'){ - $ssql .= " and (( (".$non_admin_query.") or vtiger_report.sharingtype='Public' or vtiger_report.owner = ? or vtiger_report.owner in(select vtiger_user2role.userid from vtiger_user2role inner join vtiger_users on vtiger_users.id=vtiger_user2role.userid inner join vtiger_role on vtiger_role.roleid=vtiger_user2role.roleid where vtiger_role.parentrole like '".$current_user_parent_role_seq."::%'))"; - array_push($params, $current_user->id); - array_push($params, $current_user->id); - } - - $query = $adb->pquery("select userid from vtiger_user2role inner join vtiger_users on vtiger_users.id=vtiger_user2role.userid inner join vtiger_role on vtiger_role.roleid=vtiger_user2role.roleid where vtiger_role.parentrole like '".$current_user_parent_role_seq."::%'",array()); - $subordinate_users = Array(); - for($i=0;$i<$adb->num_rows($query);$i++){ - $subordinate_users[] = $adb->query_result($query,$i,'userid'); - } - - // Update subordinate user information for re-use - VTCacheUtils::updateReport_SubordinateUsers($reportid, $subordinate_users); - - //Report sharing for vtiger7 - $queryObj = new stdClass(); - $queryObj->query = $ssql; - $queryObj->queryParams = $params; - $queryObj = self::getReportSharingQuery($queryObj, $sharingType); - - $result = $adb->pquery($queryObj->query, $queryObj->queryParams); - if($result && $adb->num_rows($result)) { - $reportmodulesrow = $adb->fetch_array($result); - - // Update information in cache now - VTCacheUtils::updateReport_Info( - $current_user->id, $reportid, $reportmodulesrow["primarymodule"], - $reportmodulesrow["secondarymodules"], $reportmodulesrow["reporttype"], - $reportmodulesrow["reportname"], $reportmodulesrow["description"], - $reportmodulesrow["folderid"], $reportmodulesrow["owner"] - ); - } - - // Re-look at cache to maintain code-consistency below - $cachedInfo = VTCacheUtils::lookupReport_Info($current_user->id, $reportid); - } - - if($cachedInfo) { - $this->primodule = $cachedInfo["primarymodule"]; - $this->secmodule = $cachedInfo["secondarymodules"]; - $this->reporttype = $cachedInfo["reporttype"]; - $this->reportname = decode_html($cachedInfo["reportname"]); - $this->reportdescription = decode_html($cachedInfo["description"]); - $this->folderid = $cachedInfo["folderid"]; - if($is_admin==true || in_array($cachedInfo["owner"],$subordinate_users) || $cachedInfo["owner"]==$current_user->id) - $this->is_editable = 'true'; - else - $this->is_editable = 'false'; - } - } + self::__construct($reportid); } // Update the module list for listing columns for report creation. diff --git a/modules/SalesOrder/SalesOrder.php b/modules/SalesOrder/SalesOrder.php index 3e4b3e8bab1971a214804203f8f512173929c855..4e20c2ac8fd852651b83a84321911a949d8844a7 100644 --- a/modules/SalesOrder/SalesOrder.php +++ b/modules/SalesOrder/SalesOrder.php @@ -106,10 +106,13 @@ class SalesOrder extends CRMEntity { * This function creates an instance of LoggerManager class using getLogger method * creates an instance for PearDatabase class and get values for column_fields array of SalesOrder class. */ + function __construct() { + $this->log =LoggerManager::getLogger('SalesOrder'); + $this->db = PearDatabase::getInstance(); + $this->column_fields = getColumnFields('SalesOrder'); + } function SalesOrder() { - $this->log =LoggerManager::getLogger('SalesOrder'); - $this->db = PearDatabase::getInstance(); - $this->column_fields = getColumnFields('SalesOrder'); + self::__construct(); } function save_module($module) diff --git a/modules/Users/DefaultDataPopulator.php b/modules/Users/DefaultDataPopulator.php index 4b390a8cf253a6c0672b510dfbc2657bb5848604..4afad78586e55f803464df244a06eab7c66b862c 100644 --- a/modules/Users/DefaultDataPopulator.php +++ b/modules/Users/DefaultDataPopulator.php @@ -17,9 +17,12 @@ require_once('include/utils/utils.php'); */ class DefaultDataPopulator extends CRMEntity { + function __construct() { + $this->log = LoggerManager::getLogger('DefaultDataPopulator'); + $this->db = PearDatabase::getInstance(); + } function DefaultDataPopulator() { - $this->log = LoggerManager::getLogger('DefaultDataPopulator'); - $this->db = PearDatabase::getInstance(); + self::__construct(); } var $new_schema = true; diff --git a/modules/Users/Users.php b/modules/Users/Users.php index fc81bbf7f88f8c9cd9dddd7146a45cc240c725d1..6c024b967b63c8567bdb775120487fdcf970f5f1 100755 --- a/modules/Users/Users.php +++ b/modules/Users/Users.php @@ -132,21 +132,23 @@ class Users extends CRMEntity { instantiates the Logger class and PearDatabase Class * */ - + function __construct() { + $this->log = LoggerManager::getLogger('user'); + $this->log->debug("Entering Users() method ..."); + $this->db = PearDatabase::getInstance(); + $this->DEFAULT_PASSWORD_CRYPT_TYPE = (version_compare(PHP_VERSION, '5.3.0') >= 0)? 'PHP5.3MD5': 'MD5'; + if (version_compare(PHP_VERSION, '5.5.0') >= 0) { + $this->DEFAULT_PASSWORD_CRYPT_TYPE = 'PHASH'; + } + $this->column_fields = getColumnFields('Users'); + $this->column_fields['currency_name'] = ''; + $this->column_fields['currency_code'] = ''; + $this->column_fields['currency_symbol'] = ''; + $this->column_fields['conv_rate'] = ''; + $this->log->debug("Exiting Users() method ..."); + } function Users() { - $this->log = LoggerManager::getLogger('user'); - $this->log->debug("Entering Users() method ..."); - $this->db = PearDatabase::getInstance(); - $this->DEFAULT_PASSWORD_CRYPT_TYPE = (version_compare(PHP_VERSION, '5.3.0') >= 0)? 'PHP5.3MD5': 'MD5'; - if (version_compare(PHP_VERSION, '5.5.0') >= 0) { - $this->DEFAULT_PASSWORD_CRYPT_TYPE = 'PHASH'; - } - $this->column_fields = getColumnFields('Users'); - $this->column_fields['currency_name'] = ''; - $this->column_fields['currency_code'] = ''; - $this->column_fields['currency_symbol'] = ''; - $this->column_fields['conv_rate'] = ''; - $this->log->debug("Exiting Users() method ..."); + self::__construct(); } /** diff --git a/modules/Vendors/Vendors.php b/modules/Vendors/Vendors.php index d76741a1f6c8f7f6743ef30ded093b4968eab647..e9cd0c16b4bc5259d0403b2ff22fbaa98b711731 100755 --- a/modules/Vendors/Vendors.php +++ b/modules/Vendors/Vendors.php @@ -64,12 +64,15 @@ class Vendors extends CRMEntity { /** Constructor which will set the column_fields in this object */ + function __construct() { + $this->log =LoggerManager::getLogger('vendor'); + $this->log->debug("Entering Vendors() method ..."); + $this->db = PearDatabase::getInstance(); + $this->column_fields = getColumnFields('Vendors'); + $this->log->debug("Exiting Vendor method ..."); + } function Vendors() { - $this->log =LoggerManager::getLogger('vendor'); - $this->log->debug("Entering Vendors() method ..."); - $this->db = PearDatabase::getInstance(); - $this->column_fields = getColumnFields('Vendors'); - $this->log->debug("Exiting Vendor method ..."); + self::__construct(); } function save_module($module) diff --git a/pkg/vtiger/modules/PBXManager/modules/PBXManager/PBXManager.php b/pkg/vtiger/modules/PBXManager/modules/PBXManager/PBXManager.php index 4a9262e4a4eef7a43cd71b85c4564657753c480a..b7bfa4f2574b01b285f71dfb3515383470e8789e 100644 --- a/pkg/vtiger/modules/PBXManager/modules/PBXManager/PBXManager.php +++ b/pkg/vtiger/modules/PBXManager/modules/PBXManager/PBXManager.php @@ -74,10 +74,13 @@ class PBXManager extends CRMEntity { var $default_order_by = 'customernumber'; var $default_sort_order = 'ASC'; - function PBXManager(){ + function __construct() { $this->db = PearDatabase::getInstance(); $this->column_fields = getColumnFields('PBXManager'); } + function PBXManager(){ + self::__construct(); + } /** * Invoked when special actions are performed on the module. diff --git a/vtlib/Vtiger/Package.php b/vtlib/Vtiger/Package.php index 4ec88da12259dc2fb6f34908dac1b0deb26dbc15..60c1a5dd96b92a3241ea8b6e0986eceb80a40288 100644 --- a/vtlib/Vtiger/Package.php +++ b/vtlib/Vtiger/Package.php @@ -18,8 +18,11 @@ class Vtiger_Package extends Vtiger_PackageUpdate { /** * Constructor */ + function __construct() { + parent::__construct(); + } function Vtiger_Package() { - parent::__construct(); + self::__construct(); } } ?> diff --git a/vtlib/Vtiger/PackageExport.php b/vtlib/Vtiger/PackageExport.php index 64a71c5b9d4e74940478f3bd356efedefb57d71b..ac5346e7d017cdee3a465853b4c6e18e507e46e3 100644 --- a/vtlib/Vtiger/PackageExport.php +++ b/vtlib/Vtiger/PackageExport.php @@ -24,10 +24,13 @@ class Vtiger_PackageExport { /** * Constructor */ - function Vtiger_PackageExport() { - if(is_dir($this->_export_tmpdir) === FALSE) { + function __construct() { + if(is_dir($this->_export_tmpdir) === FALSE) { mkdir($this->_export_tmpdir); - } + } + } + function Vtiger_PackageExport() { + self::__construct(); } /** Output Handlers */ diff --git a/vtlib/Vtiger/PackageImport.php b/vtlib/Vtiger/PackageImport.php index f6b974b168e4b347017a613e1bba979668d92ad4..468030faaa43e2701d8d1566a7316d6ecb1ae86e 100644 --- a/vtlib/Vtiger/PackageImport.php +++ b/vtlib/Vtiger/PackageImport.php @@ -40,8 +40,11 @@ class Vtiger_PackageImport extends Vtiger_PackageExport { /** * Constructor */ + function __construct() { + parent::__construct(); + } function Vtiger_PackageImport() { - parent::__construct(); + self::__construct(); } /** diff --git a/vtlib/Vtiger/PackageUpdate.php b/vtlib/Vtiger/PackageUpdate.php index bcadacadbce44568e13b29aa9a7732762ffbcdd8..f57fa7cc0e828a3c5895bd4ed61ef52d06c01594 100644 --- a/vtlib/Vtiger/PackageUpdate.php +++ b/vtlib/Vtiger/PackageUpdate.php @@ -20,8 +20,11 @@ class Vtiger_PackageUpdate extends Vtiger_PackageImport { /** * Constructor */ + function __construct() { + parent::__construct(); + } function Vtiger_PackageUpdate() { - parent::__construct(); + self::__construct(); } /** diff --git a/vtlib/thirdparty/network/PEAR.php b/vtlib/thirdparty/network/PEAR.php index 45665a575526e07c154a4902dced3c49625ecd17..b4c38c9354dc2522bc654d0e8d9ed5485edf580f 100644 --- a/vtlib/thirdparty/network/PEAR.php +++ b/vtlib/thirdparty/network/PEAR.php @@ -167,8 +167,7 @@ class PEAR * @access public * @return void */ - function PEAR($error_class = null) - { + function __construct($error_class = null) { $classname = strtolower(get_class($this)); if ($this->_debug) { print "PEAR constructor called, class=$classname\n"; @@ -191,6 +190,10 @@ class PEAR } } } + function PEAR($error_class = null) + { + self::__construct($error_class); + } // }}} // {{{ destructor @@ -858,9 +861,8 @@ class PEAR_Error * @access public * */ - function PEAR_Error($message = 'unknown error', $code = null, - $mode = null, $options = null, $userinfo = null) - { + function __construct($message = 'unknown error', $code = null, + $mode = null, $options = null, $userinfo = null) { if ($mode === null) { $mode = PEAR_ERROR_RETURN; } @@ -917,6 +919,11 @@ class PEAR_Error eval('$e = new Exception($this->message, $this->code);throw($e);'); } } + function PEAR_Error($message = 'unknown error', $code = null, + $mode = null, $options = null, $userinfo = null) + { + self::__construct($message, $code, $mode , $options , $userinfo ); + } // }}} // {{{ getMode() diff --git a/vtlib/thirdparty/network/Request.php b/vtlib/thirdparty/network/Request.php index 1d46bd61d5903b7a541f6bb456a2ca3c486d3543..d25a390ffcd7c7f98b85c70e387a6c31cba2c97a 100644 --- a/vtlib/thirdparty/network/Request.php +++ b/vtlib/thirdparty/network/Request.php @@ -310,8 +310,7 @@ class HTTP_Request * </ul> * @access public */ - function HTTP_Request($url = '', $params = array()) - { + function __construct($url = '', $params = array()) { $this->_method = HTTP_REQUEST_METHOD_GET; $this->_http = HTTP_REQUEST_HTTP_VER_1_1; $this->_requestHeaders = array(); @@ -362,6 +361,10 @@ class HTTP_Request $this->addHeader('Accept-Encoding', 'gzip'); } } + function HTTP_Request($url = '', $params = array()) + { + self::__construct($url, $params); + } /** * Generates a Host header for HTTP/1.1 requests @@ -1196,11 +1199,14 @@ class HTTP_Response * @param Net_Socket socket to read the response from * @param array listeners attached to request */ - function HTTP_Response(&$sock, &$listeners) - { + function __construct(&$sock, &$listeners) { $this->_sock = $sock; $this->_listeners = $listeners; } + function HTTP_Response(&$sock, &$listeners) + { + self::__construct($sock, $listeners); + } /** diff --git a/vtlib/thirdparty/network/Request/Listener.php b/vtlib/thirdparty/network/Request/Listener.php index c9095ebc902891ce786bb2f3592c5e12b0352800..7e4f891c7f623541a87e3281311b57cff34aee09 100644 --- a/vtlib/thirdparty/network/Request/Listener.php +++ b/vtlib/thirdparty/network/Request/Listener.php @@ -67,9 +67,12 @@ class HTTP_Request_Listener * * @access public */ + function __construct() { + $this->_id = md5(uniqid('http_request_', 1)); + } function HTTP_Request_Listener() { - $this->_id = md5(uniqid('http_request_', 1)); + self::__construct(); }