2 if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 /*********************************************************************************
4 * SugarCRM Community Edition is a customer relationship management program developed by
5 * SugarCRM, Inc. Copyright (C) 2004-2012 SugarCRM Inc.
7 * This program is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU Affero General Public License version 3 as published by the
9 * Free Software Foundation with the addition of the following permission added
10 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
11 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
12 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
19 * You should have received a copy of the GNU Affero General Public License along with
20 * this program; if not, see http://www.gnu.org/licenses or write to the Free
21 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
25 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
27 * The interactive user interfaces in modified source and object code versions
28 * of this program must display Appropriate Legal Notices, as required under
29 * Section 5 of the GNU Affero General Public License version 3.
31 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
32 * these Appropriate Legal Notices must retain the display of the "Powered by
33 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
34 * technical reasons, the Appropriate Legal Notices must display the words
35 * "Powered by SugarCRM".
36 ********************************************************************************/
42 * This is class to encapsulate Activity specific behavior. Subclasses include Meetings and Calls. This was used
43 * to manage the unique many-to-many handling relationships present in the Meetings and Calls beans.
47 require_once('data/SugarBean.php');
48 abstract class Activity extends SugarBean
51 //Member variable to store value of related records when secondary selects are made via create_new_list_query
52 protected $secondary_select_count;
54 //Member variable to indicate whether or not this create_new_list_query is called from list view display
55 //If so, we set this to true so we may allow for the bean subclasses to appropriately format
56 protected $alter_many_to_many_query;
59 * createManyToManyDetailHoverLink
61 * This is a function to encapsulate creating a hover link for additional data. It is called from subclasses that set alter_many_to_many_query
62 * to true and wish to display a popup window listing the additional data from the many-to-many relationship.
64 * @param string $displayText String value to display in the link portion
65 * @param string $exclude_id String id of the displayed related record so as to exclude it from the popup window
66 * @return String HTML formatted contents to display a link with a + sign to generate a call to render a popup window
69 public function createManyToManyDetailHoverLink($displayText, $exclude_id)
71 return "<span id='span_{$this->id}_{$this->table_name}'>{$displayText}<a href='#' style='text-decoration:none;'
72 onMouseOver=\"javascript:toggleMore('span_{$this->id}_{$this->table_name}','','{$this->module_dir}','DisplayInline','bean_id={$this->id}&related_id={$exclude_id}');\"
73 onFocus=\"javascript:toggleMore('span_{$this->id}_{$this->table_name}','','{$this->module_dir}','DisplayInline','bean_id={$this->id}&related_id={$exclude_id}');\"> +</a></span>";
78 * create_new_list_query
80 * Override from SugarBean. The key here is that we are always setting $singleSelect to false for list views.
82 * @param string $order_by custom order by clause
83 * @param string $where custom where clause
84 * @param array $filter Optioanal
85 * @param array $params Optional *
86 * @param int $show_deleted Optional, default 0, show deleted records is set to 1.
87 * @param string $join_type
88 * @param boolean $return_array Optional, default false, response as array
89 * @param object $parentbean creating a subquery for this bean.
90 * @param boolean $singleSelect Optional, default false.
91 * @return String select query string, optionally an array value will be returned if $return_array= true.
93 function create_new_list_query($order_by, $where,$filter=array(),$params=array(), $show_deleted = 0,$join_type='', $return_array = false,$parentbean=null, $singleSelect = true, $ifListForExport = false)
95 if(!isset($params['collection_list']))
97 $this->alter_many_to_many_query = true;
98 $singleSelect = false;
101 return parent::create_new_list_query($order_by, $where, $filter, $params, $show_deleted, $join_type, $return_array, $parentbean, $singleSelect, $ifListForExport);
108 * Loads a row of data into instance of a bean. The data is passed as an array to this function
109 * We override this instead of populateFromRow since this function is called from list view displays whereas
110 * populateFromRow could be called in many other views.
112 * @param array $arr Array of data fetched from the database
115 function loadFromRow($arr)
117 parent::loadFromRow($arr);
118 if(isset($arr['secondary_select_count']))
120 $this->secondary_select_count = $arr['secondary_select_count'];