@@ -42,28 +42,28 @@ |
||
42 | 42 | |
43 | 43 | |
44 | 44 | class SugarWidgetFieldDateTimecombo extends SugarWidgetFieldDateTime { |
45 | - var $reporter; |
|
46 | - var $assigned_user=null; |
|
45 | + var $reporter; |
|
46 | + var $assigned_user=null; |
|
47 | 47 | |
48 | 48 | function SugarWidgetFieldDateTimecombo(&$layout_manager) { |
49 | 49 | parent::SugarWidgetFieldDateTime($layout_manager); |
50 | 50 | $this->reporter = $this->layout_manager->getAttribute('reporter'); |
51 | 51 | } |
52 | - //TODO:now for date time field , we just search from date start to date end. The time is from 00:00:00 to 23:59:59 |
|
53 | - //If there is requirement, we can modify report.js::addFilterInputDatetimesBetween and this function |
|
54 | - function queryFilterBetween_Datetimes(& $layout_def) { |
|
55 | - global $timedate; |
|
56 | - if($this->getAssignedUser()) { |
|
57 | - $begin = $timedate->handle_offset($layout_def['input_name0'], $timedate->get_db_date_time_format(), false, $this->assigned_user); |
|
58 | - $end = $timedate->handle_offset($layout_def['input_name2'], $timedate->get_db_date_time_format(), false, $this->assigned_user); |
|
59 | - } |
|
60 | - else { |
|
61 | - $begin = $layout_def['input_name0']; |
|
62 | - $end = $layout_def['input_name1']; |
|
63 | - } |
|
64 | - return "(".$this->_get_column_select($layout_def).">=".$this->reporter->db->convert($this->reporter->db->quoted($begin), "datetime"). |
|
65 | - " AND\n ".$this->_get_column_select($layout_def)."<=".$this->reporter->db->convert($this->reporter->db->quoted($end), "datetime"). |
|
66 | - ")\n"; |
|
67 | - } |
|
52 | + //TODO:now for date time field , we just search from date start to date end. The time is from 00:00:00 to 23:59:59 |
|
53 | + //If there is requirement, we can modify report.js::addFilterInputDatetimesBetween and this function |
|
54 | + function queryFilterBetween_Datetimes(& $layout_def) { |
|
55 | + global $timedate; |
|
56 | + if($this->getAssignedUser()) { |
|
57 | + $begin = $timedate->handle_offset($layout_def['input_name0'], $timedate->get_db_date_time_format(), false, $this->assigned_user); |
|
58 | + $end = $timedate->handle_offset($layout_def['input_name2'], $timedate->get_db_date_time_format(), false, $this->assigned_user); |
|
59 | + } |
|
60 | + else { |
|
61 | + $begin = $layout_def['input_name0']; |
|
62 | + $end = $layout_def['input_name1']; |
|
63 | + } |
|
64 | + return "(".$this->_get_column_select($layout_def).">=".$this->reporter->db->convert($this->reporter->db->quoted($begin), "datetime"). |
|
65 | + " AND\n ".$this->_get_column_select($layout_def)."<=".$this->reporter->db->convert($this->reporter->db->quoted($end), "datetime"). |
|
66 | + ")\n"; |
|
67 | + } |
|
68 | 68 | |
69 | 69 | } |
@@ -46,60 +46,60 @@ discard block |
||
46 | 46 | class SugarWidgetSubPanelTopButton extends SugarWidget |
47 | 47 | { |
48 | 48 | var $module; |
49 | - var $title; |
|
50 | - var $access_key; |
|
51 | - var $form_value; |
|
52 | - var $additional_form_fields; |
|
53 | - var $acl; |
|
49 | + var $title; |
|
50 | + var $access_key; |
|
51 | + var $form_value; |
|
52 | + var $additional_form_fields; |
|
53 | + var $acl; |
|
54 | 54 | |
55 | 55 | //TODO rename defines to layout defs and make it a member variable instead of passing it multiple layers with extra copying. |
56 | 56 | |
57 | - /** Take the keys for the strings and look them up. Module is literal, the rest are label keys |
|
58 | - */ |
|
59 | - function SugarWidgetSubPanelTopButton($module='', $title='', $access_key='', $form_value='') |
|
60 | - { |
|
61 | - global $app_strings; |
|
62 | - |
|
63 | - if(is_array($module)) |
|
64 | - { |
|
65 | - // it is really the class details from the mapping |
|
66 | - $class_details = $module; |
|
67 | - |
|
68 | - // If keys were passed into the constructor, translate them from keys to values. |
|
69 | - if(!empty($class_details['module'])) |
|
70 | - $this->module = $class_details['module']; |
|
71 | - if(!empty($class_details['title'])) |
|
72 | - $this->title = $app_strings[$class_details['title']]; |
|
73 | - if(!empty($class_details['access_key'])) |
|
74 | - $this->access_key = $app_strings[$class_details['access_key']]; |
|
75 | - if(!empty($class_details['form_value'])) |
|
76 | - $this->form_value = translate($class_details['form_value'], $this->module); |
|
77 | - if(!empty($class_details['additional_form_fields'])) |
|
78 | - $this->additional_form_fields = $class_details['additional_form_fields']; |
|
79 | - if(!empty($class_details['ACL'])){ |
|
80 | - $this->acl = $class_details['ACL']; |
|
81 | - } |
|
82 | - } |
|
83 | - else |
|
84 | - { |
|
85 | - $this->module = $module; |
|
86 | - |
|
87 | - // If keys were passed into the constructor, translate them from keys to values. |
|
88 | - if(!empty($title)) |
|
89 | - $this->title = $app_strings[$title]; |
|
90 | - if(!empty($access_key)) |
|
91 | - $this->access_key = $app_strings[$access_key]; |
|
92 | - if(!empty($form_value)) |
|
93 | - $this->form_value = translate($form_value, $module); |
|
94 | - } |
|
95 | - } |
|
57 | + /** Take the keys for the strings and look them up. Module is literal, the rest are label keys |
|
58 | + */ |
|
59 | + function SugarWidgetSubPanelTopButton($module='', $title='', $access_key='', $form_value='') |
|
60 | + { |
|
61 | + global $app_strings; |
|
62 | + |
|
63 | + if(is_array($module)) |
|
64 | + { |
|
65 | + // it is really the class details from the mapping |
|
66 | + $class_details = $module; |
|
67 | + |
|
68 | + // If keys were passed into the constructor, translate them from keys to values. |
|
69 | + if(!empty($class_details['module'])) |
|
70 | + $this->module = $class_details['module']; |
|
71 | + if(!empty($class_details['title'])) |
|
72 | + $this->title = $app_strings[$class_details['title']]; |
|
73 | + if(!empty($class_details['access_key'])) |
|
74 | + $this->access_key = $app_strings[$class_details['access_key']]; |
|
75 | + if(!empty($class_details['form_value'])) |
|
76 | + $this->form_value = translate($class_details['form_value'], $this->module); |
|
77 | + if(!empty($class_details['additional_form_fields'])) |
|
78 | + $this->additional_form_fields = $class_details['additional_form_fields']; |
|
79 | + if(!empty($class_details['ACL'])){ |
|
80 | + $this->acl = $class_details['ACL']; |
|
81 | + } |
|
82 | + } |
|
83 | + else |
|
84 | + { |
|
85 | + $this->module = $module; |
|
86 | + |
|
87 | + // If keys were passed into the constructor, translate them from keys to values. |
|
88 | + if(!empty($title)) |
|
89 | + $this->title = $app_strings[$title]; |
|
90 | + if(!empty($access_key)) |
|
91 | + $this->access_key = $app_strings[$access_key]; |
|
92 | + if(!empty($form_value)) |
|
93 | + $this->form_value = translate($form_value, $module); |
|
94 | + } |
|
95 | + } |
|
96 | 96 | |
97 | 97 | public function getWidgetId($buttonSuffix = true) |
98 | 98 | { |
99 | - $widgetID = parent::getWidgetId() . '_'.preg_replace('[ ]', '', mb_strtolower($this->form_value, 'UTF-8')); |
|
100 | - if($buttonSuffix){ |
|
101 | - $widgetID .= '_button'; |
|
102 | - } |
|
99 | + $widgetID = parent::getWidgetId() . '_'.preg_replace('[ ]', '', mb_strtolower($this->form_value, 'UTF-8')); |
|
100 | + if($buttonSuffix){ |
|
101 | + $widgetID .= '_button'; |
|
102 | + } |
|
103 | 103 | return $widgetID; |
104 | 104 | } |
105 | 105 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | } |
126 | 126 | |
127 | 127 | |
128 | - if(!empty($this->module)) |
|
128 | + if(!empty($this->module)) |
|
129 | 129 | { |
130 | 130 | $defines['child_module_name'] = $this->module; |
131 | 131 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | } |
136 | 136 | |
137 | 137 | $defines['parent_bean_name'] = get_class( $defines['focus']); |
138 | - $relationship_name = $this->get_subpanel_relationship_name($defines); |
|
138 | + $relationship_name = $this->get_subpanel_relationship_name($defines); |
|
139 | 139 | |
140 | 140 | |
141 | 141 | $formValues = array(); |
@@ -150,10 +150,10 @@ discard block |
||
150 | 150 | // #26451,add these fields for custom one-to-many relate field. |
151 | 151 | if(!empty($defines['child_module_name'])){ |
152 | 152 | $formValues[$relationship_name."_name"] = $defines['focus']->name; |
153 | - $childFocusName = !empty($GLOBALS['beanList'][$defines['child_module_name']]) ? $GLOBALS['beanList'][$defines['child_module_name']] : ""; |
|
154 | - if(!empty($GLOBALS['dictionary'][ $childFocusName ]["fields"][$relationship_name .'_name']['id_name'])){ |
|
155 | - $formValues[$GLOBALS['dictionary'][ $childFocusName ]["fields"][$relationship_name .'_name']['id_name']] = $defines['focus']->id; |
|
156 | - } |
|
153 | + $childFocusName = !empty($GLOBALS['beanList'][$defines['child_module_name']]) ? $GLOBALS['beanList'][$defines['child_module_name']] : ""; |
|
154 | + if(!empty($GLOBALS['dictionary'][ $childFocusName ]["fields"][$relationship_name .'_name']['id_name'])){ |
|
155 | + $formValues[$GLOBALS['dictionary'][ $childFocusName ]["fields"][$relationship_name .'_name']['id_name']] = $defines['focus']->id; |
|
156 | + } |
|
157 | 157 | } |
158 | 158 | } |
159 | 159 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | $additionalFormFields['parent_id'] = $defines['focus']->account_id; |
217 | 217 | $additionalFormFields['account_id'] = $defines['focus']->account_id; |
218 | 218 | } else if($defines['focus']->object_name=='Contract') { |
219 | - $additionalFormFields['contract_id'] = $defines['focus']->id; |
|
219 | + $additionalFormFields['contract_id'] = $defines['focus']->id; |
|
220 | 220 | } else { |
221 | 221 | $additionalFormFields['parent_id'] = $defines['focus']->id; |
222 | 222 | } |
@@ -266,17 +266,17 @@ discard block |
||
266 | 266 | } |
267 | 267 | } |
268 | 268 | |
269 | - /** This default function is used to create the HTML for a simple button */ |
|
270 | - function display($defines, $additionalFormFields = null, $nonbutton = false) |
|
271 | - { |
|
272 | - $temp=''; |
|
273 | - $inputID = $this->getWidgetId(); |
|
269 | + /** This default function is used to create the HTML for a simple button */ |
|
270 | + function display($defines, $additionalFormFields = null, $nonbutton = false) |
|
271 | + { |
|
272 | + $temp=''; |
|
273 | + $inputID = $this->getWidgetId(); |
|
274 | 274 | |
275 | - if(!empty($this->acl) && ACLController::moduleSupportsACL($defines['module']) && !ACLController::checkAccess($defines['module'], $this->acl, true)){ |
|
276 | - return $temp; |
|
277 | - } |
|
275 | + if(!empty($this->acl) && ACLController::moduleSupportsACL($defines['module']) && !ACLController::checkAccess($defines['module'], $this->acl, true)){ |
|
276 | + return $temp; |
|
277 | + } |
|
278 | 278 | |
279 | - global $app_strings; |
|
279 | + global $app_strings; |
|
280 | 280 | |
281 | 281 | if ( isset($_REQUEST['layout_def_key']) && $_REQUEST['layout_def_key'] == 'UserEAPM' ) { |
282 | 282 | // Subpanels generally don't go on the editview, so we have to handle this special |
@@ -291,39 +291,39 @@ discard block |
||
291 | 291 | $button = "<a onclick=''>$this->form_value"; |
292 | 292 | } |
293 | 293 | return $button; |
294 | - } |
|
295 | - |
|
296 | - /** |
|
297 | - * Returns a string that is the JSON encoded version of the popup request. |
|
298 | - * Perhaps this function should be moved to a more globally accessible location? |
|
299 | - */ |
|
300 | - function _create_json_encoded_popup_request($popup_request_data) |
|
301 | - { |
|
302 | - return json_encode($popup_request_data); |
|
303 | - } |
|
304 | - |
|
305 | - /** |
|
306 | - * get_subpanel_relationship_name |
|
307 | - * Get the relationship name based on the subapnel definition |
|
308 | - * @param mixed $defines The subpanel definition |
|
309 | - */ |
|
310 | - function get_subpanel_relationship_name($defines) { |
|
311 | - $relationship_name = ''; |
|
312 | - if(!empty($defines)) { |
|
313 | - $relationship_name = isset($defines['module']) ? $defines['module'] : ''; |
|
314 | - $dataSource = $defines['subpanel_definition']->get_data_source_name(true); |
|
315 | - if (!empty($dataSource)) { |
|
316 | - $relationship_name = $dataSource; |
|
317 | - //Try to set the relationship name to the real relationship, not the link. |
|
318 | - if (!empty($defines['subpanel_definition']->parent_bean->field_defs[$dataSource]) |
|
319 | - && !empty($defines['subpanel_definition']->parent_bean->field_defs[$dataSource]['relationship'])) |
|
320 | - { |
|
321 | - $relationship_name = $defines['subpanel_definition']->parent_bean->field_defs[$dataSource]['relationship']; |
|
322 | - } |
|
323 | - } |
|
324 | - } |
|
325 | - return $relationship_name; |
|
326 | - } |
|
294 | + } |
|
295 | + |
|
296 | + /** |
|
297 | + * Returns a string that is the JSON encoded version of the popup request. |
|
298 | + * Perhaps this function should be moved to a more globally accessible location? |
|
299 | + */ |
|
300 | + function _create_json_encoded_popup_request($popup_request_data) |
|
301 | + { |
|
302 | + return json_encode($popup_request_data); |
|
303 | + } |
|
304 | + |
|
305 | + /** |
|
306 | + * get_subpanel_relationship_name |
|
307 | + * Get the relationship name based on the subapnel definition |
|
308 | + * @param mixed $defines The subpanel definition |
|
309 | + */ |
|
310 | + function get_subpanel_relationship_name($defines) { |
|
311 | + $relationship_name = ''; |
|
312 | + if(!empty($defines)) { |
|
313 | + $relationship_name = isset($defines['module']) ? $defines['module'] : ''; |
|
314 | + $dataSource = $defines['subpanel_definition']->get_data_source_name(true); |
|
315 | + if (!empty($dataSource)) { |
|
316 | + $relationship_name = $dataSource; |
|
317 | + //Try to set the relationship name to the real relationship, not the link. |
|
318 | + if (!empty($defines['subpanel_definition']->parent_bean->field_defs[$dataSource]) |
|
319 | + && !empty($defines['subpanel_definition']->parent_bean->field_defs[$dataSource]['relationship'])) |
|
320 | + { |
|
321 | + $relationship_name = $defines['subpanel_definition']->parent_bean->field_defs[$dataSource]['relationship']; |
|
322 | + } |
|
323 | + } |
|
324 | + } |
|
325 | + return $relationship_name; |
|
326 | + } |
|
327 | 327 | |
328 | 328 | } |
329 | 329 | ?> |
@@ -46,60 +46,60 @@ discard block |
||
46 | 46 | class SugarWidgetSubPanelTopButton_c extends SugarWidget |
47 | 47 | { |
48 | 48 | var $module; |
49 | - var $title; |
|
50 | - var $access_key; |
|
51 | - var $form_value; |
|
52 | - var $additional_form_fields; |
|
53 | - var $acl; |
|
49 | + var $title; |
|
50 | + var $access_key; |
|
51 | + var $form_value; |
|
52 | + var $additional_form_fields; |
|
53 | + var $acl; |
|
54 | 54 | |
55 | 55 | //TODO rename defines to layout defs and make it a member variable instead of passing it multiple layers with extra copying. |
56 | 56 | |
57 | - /** Take the keys for the strings and look them up. Module is literal, the rest are label keys |
|
58 | - */ |
|
59 | - function SugarWidgetSubPanelTopButton($module='', $title='', $access_key='', $form_value='') |
|
60 | - { |
|
61 | - global $app_strings; |
|
62 | - |
|
63 | - if(is_array($module)) |
|
64 | - { |
|
65 | - // it is really the class details from the mapping |
|
66 | - $class_details = $module; |
|
67 | - |
|
68 | - // If keys were passed into the constructor, translate them from keys to values. |
|
69 | - if(!empty($class_details['module'])) |
|
70 | - $this->module = $class_details['module']; |
|
71 | - if(!empty($class_details['title'])) |
|
72 | - $this->title = $app_strings[$class_details['title']]; |
|
73 | - if(!empty($class_details['access_key'])) |
|
74 | - $this->access_key = $app_strings[$class_details['access_key']]; |
|
75 | - if(!empty($class_details['form_value'])) |
|
76 | - $this->form_value = translate($class_details['form_value'], $this->module); |
|
77 | - if(!empty($class_details['additional_form_fields'])) |
|
78 | - $this->additional_form_fields = $class_details['additional_form_fields']; |
|
79 | - if(!empty($class_details['ACL'])){ |
|
80 | - $this->acl = $class_details['ACL']; |
|
81 | - } |
|
82 | - } |
|
83 | - else |
|
84 | - { |
|
85 | - $this->module = $module; |
|
86 | - |
|
87 | - // If keys were passed into the constructor, translate them from keys to values. |
|
88 | - if(!empty($title)) |
|
89 | - $this->title = $app_strings[$title]; |
|
90 | - if(!empty($access_key)) |
|
91 | - $this->access_key = $app_strings[$access_key]; |
|
92 | - if(!empty($form_value)) |
|
93 | - $this->form_value = translate($form_value, $module); |
|
94 | - } |
|
95 | - } |
|
57 | + /** Take the keys for the strings and look them up. Module is literal, the rest are label keys |
|
58 | + */ |
|
59 | + function SugarWidgetSubPanelTopButton($module='', $title='', $access_key='', $form_value='') |
|
60 | + { |
|
61 | + global $app_strings; |
|
62 | + |
|
63 | + if(is_array($module)) |
|
64 | + { |
|
65 | + // it is really the class details from the mapping |
|
66 | + $class_details = $module; |
|
67 | + |
|
68 | + // If keys were passed into the constructor, translate them from keys to values. |
|
69 | + if(!empty($class_details['module'])) |
|
70 | + $this->module = $class_details['module']; |
|
71 | + if(!empty($class_details['title'])) |
|
72 | + $this->title = $app_strings[$class_details['title']]; |
|
73 | + if(!empty($class_details['access_key'])) |
|
74 | + $this->access_key = $app_strings[$class_details['access_key']]; |
|
75 | + if(!empty($class_details['form_value'])) |
|
76 | + $this->form_value = translate($class_details['form_value'], $this->module); |
|
77 | + if(!empty($class_details['additional_form_fields'])) |
|
78 | + $this->additional_form_fields = $class_details['additional_form_fields']; |
|
79 | + if(!empty($class_details['ACL'])){ |
|
80 | + $this->acl = $class_details['ACL']; |
|
81 | + } |
|
82 | + } |
|
83 | + else |
|
84 | + { |
|
85 | + $this->module = $module; |
|
86 | + |
|
87 | + // If keys were passed into the constructor, translate them from keys to values. |
|
88 | + if(!empty($title)) |
|
89 | + $this->title = $app_strings[$title]; |
|
90 | + if(!empty($access_key)) |
|
91 | + $this->access_key = $app_strings[$access_key]; |
|
92 | + if(!empty($form_value)) |
|
93 | + $this->form_value = translate($form_value, $module); |
|
94 | + } |
|
95 | + } |
|
96 | 96 | |
97 | 97 | public function getWidgetId($buttonSuffix = true) |
98 | 98 | { |
99 | - $widgetID = parent::getWidgetId() . '_'.preg_replace('[ ]', '', strtolower($this->form_value)); |
|
100 | - if($buttonSuffix){ |
|
101 | - $widgetID .= '_button'; |
|
102 | - } |
|
99 | + $widgetID = parent::getWidgetId() . '_'.preg_replace('[ ]', '', strtolower($this->form_value)); |
|
100 | + if($buttonSuffix){ |
|
101 | + $widgetID .= '_button'; |
|
102 | + } |
|
103 | 103 | return $widgetID; |
104 | 104 | } |
105 | 105 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | } |
126 | 126 | |
127 | 127 | |
128 | - if(!empty($this->module)) |
|
128 | + if(!empty($this->module)) |
|
129 | 129 | { |
130 | 130 | $defines['child_module_name'] = $this->module; |
131 | 131 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | } |
136 | 136 | |
137 | 137 | $defines['parent_bean_name'] = get_class( $defines['focus']); |
138 | - $relationship_name = $this->get_subpanel_relationship_name($defines); |
|
138 | + $relationship_name = $this->get_subpanel_relationship_name($defines); |
|
139 | 139 | |
140 | 140 | |
141 | 141 | $formValues = array(); |
@@ -150,10 +150,10 @@ discard block |
||
150 | 150 | // #26451,add these fields for custom one-to-many relate field. |
151 | 151 | if(!empty($defines['child_module_name'])){ |
152 | 152 | $formValues[$relationship_name."_name"] = $defines['focus']->name; |
153 | - $childFocusName = !empty($GLOBALS['beanList'][$defines['child_module_name']]) ? $GLOBALS['beanList'][$defines['child_module_name']] : ""; |
|
154 | - if(!empty($GLOBALS['dictionary'][ $childFocusName ]["fields"][$relationship_name .'_name']['id_name'])){ |
|
155 | - $formValues[$GLOBALS['dictionary'][ $childFocusName ]["fields"][$relationship_name .'_name']['id_name']] = $defines['focus']->id; |
|
156 | - } |
|
153 | + $childFocusName = !empty($GLOBALS['beanList'][$defines['child_module_name']]) ? $GLOBALS['beanList'][$defines['child_module_name']] : ""; |
|
154 | + if(!empty($GLOBALS['dictionary'][ $childFocusName ]["fields"][$relationship_name .'_name']['id_name'])){ |
|
155 | + $formValues[$GLOBALS['dictionary'][ $childFocusName ]["fields"][$relationship_name .'_name']['id_name']] = $defines['focus']->id; |
|
156 | + } |
|
157 | 157 | } |
158 | 158 | } |
159 | 159 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | $additionalFormFields['parent_id'] = $defines['focus']->account_id; |
217 | 217 | $additionalFormFields['account_id'] = $defines['focus']->account_id; |
218 | 218 | } else if($defines['focus']->object_name=='Contract') { |
219 | - $additionalFormFields['contract_id'] = $defines['focus']->id; |
|
219 | + $additionalFormFields['contract_id'] = $defines['focus']->id; |
|
220 | 220 | } else { |
221 | 221 | $additionalFormFields['parent_id'] = $defines['focus']->id; |
222 | 222 | } |
@@ -266,17 +266,17 @@ discard block |
||
266 | 266 | } |
267 | 267 | } |
268 | 268 | |
269 | - /** This default function is used to create the HTML for a simple button */ |
|
270 | - function display($defines, $additionalFormFields = null, $nonbutton = false) |
|
271 | - { |
|
272 | - $temp=''; |
|
273 | - $inputID = $this->getWidgetId(); |
|
269 | + /** This default function is used to create the HTML for a simple button */ |
|
270 | + function display($defines, $additionalFormFields = null, $nonbutton = false) |
|
271 | + { |
|
272 | + $temp=''; |
|
273 | + $inputID = $this->getWidgetId(); |
|
274 | 274 | |
275 | - if(!empty($this->acl) && ACLController::moduleSupportsACL($defines['module']) && !ACLController::checkAccess($defines['module'], $this->acl, true)){ |
|
276 | - return $temp; |
|
277 | - } |
|
275 | + if(!empty($this->acl) && ACLController::moduleSupportsACL($defines['module']) && !ACLController::checkAccess($defines['module'], $this->acl, true)){ |
|
276 | + return $temp; |
|
277 | + } |
|
278 | 278 | |
279 | - global $app_strings; |
|
279 | + global $app_strings; |
|
280 | 280 | |
281 | 281 | if ( isset($_REQUEST['layout_def_key']) && $_REQUEST['layout_def_key'] == 'UserEAPM' ) { |
282 | 282 | // Subpanels generally don't go on the editview, so we have to handle this special |
@@ -289,42 +289,42 @@ discard block |
||
289 | 289 | } |
290 | 290 | |
291 | 291 | if ($nonbutton) { |
292 | - // $button = "<a onclick=''>$this->form_value"; |
|
292 | + // $button = "<a onclick=''>$this->form_value"; |
|
293 | 293 | } |
294 | 294 | return $button; |
295 | - } |
|
296 | - |
|
297 | - /** |
|
298 | - * Returns a string that is the JSON encoded version of the popup request. |
|
299 | - * Perhaps this function should be moved to a more globally accessible location? |
|
300 | - */ |
|
301 | - function _create_json_encoded_popup_request($popup_request_data) |
|
302 | - { |
|
303 | - return json_encode($popup_request_data); |
|
304 | - } |
|
305 | - |
|
306 | - /** |
|
307 | - * get_subpanel_relationship_name |
|
308 | - * Get the relationship name based on the subapnel definition |
|
309 | - * @param mixed $defines The subpanel definition |
|
310 | - */ |
|
311 | - function get_subpanel_relationship_name($defines) { |
|
312 | - $relationship_name = ''; |
|
313 | - if(!empty($defines)) { |
|
314 | - $relationship_name = isset($defines['module']) ? $defines['module'] : ''; |
|
315 | - $dataSource = $defines['subpanel_definition']->get_data_source_name(true); |
|
316 | - if (!empty($dataSource)) { |
|
317 | - $relationship_name = $dataSource; |
|
318 | - //Try to set the relationship name to the real relationship, not the link. |
|
319 | - if (!empty($defines['subpanel_definition']->parent_bean->field_defs[$dataSource]) |
|
320 | - && !empty($defines['subpanel_definition']->parent_bean->field_defs[$dataSource]['relationship'])) |
|
321 | - { |
|
322 | - $relationship_name = $defines['subpanel_definition']->parent_bean->field_defs[$dataSource]['relationship']; |
|
323 | - } |
|
324 | - } |
|
325 | - } |
|
326 | - return $relationship_name; |
|
327 | - } |
|
295 | + } |
|
296 | + |
|
297 | + /** |
|
298 | + * Returns a string that is the JSON encoded version of the popup request. |
|
299 | + * Perhaps this function should be moved to a more globally accessible location? |
|
300 | + */ |
|
301 | + function _create_json_encoded_popup_request($popup_request_data) |
|
302 | + { |
|
303 | + return json_encode($popup_request_data); |
|
304 | + } |
|
305 | + |
|
306 | + /** |
|
307 | + * get_subpanel_relationship_name |
|
308 | + * Get the relationship name based on the subapnel definition |
|
309 | + * @param mixed $defines The subpanel definition |
|
310 | + */ |
|
311 | + function get_subpanel_relationship_name($defines) { |
|
312 | + $relationship_name = ''; |
|
313 | + if(!empty($defines)) { |
|
314 | + $relationship_name = isset($defines['module']) ? $defines['module'] : ''; |
|
315 | + $dataSource = $defines['subpanel_definition']->get_data_source_name(true); |
|
316 | + if (!empty($dataSource)) { |
|
317 | + $relationship_name = $dataSource; |
|
318 | + //Try to set the relationship name to the real relationship, not the link. |
|
319 | + if (!empty($defines['subpanel_definition']->parent_bean->field_defs[$dataSource]) |
|
320 | + && !empty($defines['subpanel_definition']->parent_bean->field_defs[$dataSource]['relationship'])) |
|
321 | + { |
|
322 | + $relationship_name = $defines['subpanel_definition']->parent_bean->field_defs[$dataSource]['relationship']; |
|
323 | + } |
|
324 | + } |
|
325 | + } |
|
326 | + return $relationship_name; |
|
327 | + } |
|
328 | 328 | |
329 | 329 | } |
330 | 330 | ?> |
@@ -45,14 +45,14 @@ discard block |
||
45 | 45 | //TODO Rename this to edit link |
46 | 46 | class SugarWidgetSubPanelRelFieldEditButton extends SugarWidgetField |
47 | 47 | { |
48 | - function displayHeaderCell(&$layout_def) |
|
49 | - { |
|
50 | - return ' '; |
|
51 | - } |
|
48 | + function displayHeaderCell(&$layout_def) |
|
49 | + { |
|
50 | + return ' '; |
|
51 | + } |
|
52 | 52 | |
53 | - function displayList(&$layout_def) |
|
54 | - { |
|
55 | - die("<pre>" . print_r($layout_def, true) . "</pre>"); |
|
53 | + function displayList(&$layout_def) |
|
54 | + { |
|
55 | + die("<pre>" . print_r($layout_def, true) . "</pre>"); |
|
56 | 56 | |
57 | 57 | $rel = $layout_def['linked_field']; |
58 | 58 | $module = $layout_def['module']; |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | |
61 | 61 | global $app_strings; |
62 | 62 | |
63 | - $edit_icon_html = SugarThemeRegistry::current()->getImage( 'edit_inline', |
|
64 | - 'align="absmiddle" alt="' . $app_strings['LNK_EDIT'] . '" border="0"'); |
|
63 | + $edit_icon_html = SugarThemeRegistry::current()->getImage( 'edit_inline', |
|
64 | + 'align="absmiddle" alt="' . $app_strings['LNK_EDIT'] . '" border="0"'); |
|
65 | 65 | |
66 | 66 | $script = " |
67 | 67 | function editRel(name, id, module) { |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | }"; |
90 | 90 | |
91 | 91 | return "<script>$script</script>" |
92 | - . '<div onclick="editRel(\'p1_b1_accounts\', \'cac203f3-0380-495f-3231-4cf58f089f00\', \'Accounts\')">' |
|
93 | - . $edit_icon_html . "</div>"; |
|
94 | - } |
|
92 | + . '<div onclick="editRel(\'p1_b1_accounts\', \'cac203f3-0380-495f-3231-4cf58f089f00\', \'Accounts\')">' |
|
93 | + . $edit_icon_html . "</div>"; |
|
94 | + } |
|
95 | 95 | |
96 | 96 | } |
97 | 97 |
@@ -48,7 +48,7 @@ |
||
48 | 48 | global $mod_strings; |
49 | 49 | |
50 | 50 | $button = "<form id='ManageDelegatesForm' name='ManageDelegatesForm' method='post' action=''>"; |
51 | - // $button .= "<input id='custom_hidden_5' type='hidden' name='custom_hidden_5' value=''/>"; |
|
51 | + // $button .= "<input id='custom_hidden_5' type='hidden' name='custom_hidden_5' value=''/>"; |
|
52 | 52 | $button .= "<input id='Manage_Delegates' class='button' type='button' name='Manage_Delegates' onclick='manage_delegates()' value='".$mod_strings['LBL_MANAGE_DELEGATES']."'/>\n</form>"; |
53 | 53 | return $button; |
54 | 54 | } |
@@ -45,57 +45,57 @@ |
||
45 | 45 | |
46 | 46 | class SugarWidgetSubPanelTopComposeEmailButton extends SugarWidgetSubPanelTopButton |
47 | 47 | { |
48 | - var $form_value = ''; |
|
48 | + var $form_value = ''; |
|
49 | 49 | |
50 | 50 | public function getWidgetId($buttonSuffix = true) |
51 | 51 | { |
52 | - global $app_strings; |
|
53 | - $this->form_value = $app_strings['LBL_COMPOSE_EMAIL_BUTTON_LABEL']; |
|
54 | - return parent::getWidgetId(); |
|
52 | + global $app_strings; |
|
53 | + $this->form_value = $app_strings['LBL_COMPOSE_EMAIL_BUTTON_LABEL']; |
|
54 | + return parent::getWidgetId(); |
|
55 | 55 | } |
56 | 56 | |
57 | - function display($defines, $additionalFormFields = NULL, $nonbutton = false) |
|
58 | - { |
|
59 | - if((ACLController::moduleSupportsACL($defines['module']) && !ACLController::checkAccess($defines['module'], 'edit', true) || |
|
60 | - $defines['module'] == "Activities" & !ACLController::checkAccess("Emails", 'edit', true))){ |
|
61 | - $temp = ''; |
|
62 | - return $temp; |
|
63 | - } |
|
57 | + function display($defines, $additionalFormFields = NULL, $nonbutton = false) |
|
58 | + { |
|
59 | + if((ACLController::moduleSupportsACL($defines['module']) && !ACLController::checkAccess($defines['module'], 'edit', true) || |
|
60 | + $defines['module'] == "Activities" & !ACLController::checkAccess("Emails", 'edit', true))){ |
|
61 | + $temp = ''; |
|
62 | + return $temp; |
|
63 | + } |
|
64 | 64 | |
65 | - global $app_strings,$current_user,$sugar_config,$beanList,$beanFiles; |
|
66 | - $title = $app_strings['LBL_COMPOSE_EMAIL_BUTTON_TITLE']; |
|
67 | - //$accesskey = $app_strings['LBL_COMPOSE_EMAIL_BUTTON_KEY']; |
|
68 | - $value = $app_strings['LBL_COMPOSE_EMAIL_BUTTON_LABEL']; |
|
69 | - $parent_type = $defines['focus']->module_dir; |
|
70 | - $parent_id = $defines['focus']->id; |
|
65 | + global $app_strings,$current_user,$sugar_config,$beanList,$beanFiles; |
|
66 | + $title = $app_strings['LBL_COMPOSE_EMAIL_BUTTON_TITLE']; |
|
67 | + //$accesskey = $app_strings['LBL_COMPOSE_EMAIL_BUTTON_KEY']; |
|
68 | + $value = $app_strings['LBL_COMPOSE_EMAIL_BUTTON_LABEL']; |
|
69 | + $parent_type = $defines['focus']->module_dir; |
|
70 | + $parent_id = $defines['focus']->id; |
|
71 | 71 | |
72 | - //martin Bug 19660 |
|
73 | - $userPref = $current_user->getPreference('email_link_type'); |
|
74 | - $defaultPref = $sugar_config['email_default_client']; |
|
75 | - if($userPref != '') { |
|
76 | - $client = $userPref; |
|
77 | - } else { |
|
78 | - $client = $defaultPref; |
|
79 | - } |
|
80 | - if($client != 'sugar') { |
|
81 | - $bean = $defines['focus']; |
|
82 | - // awu: Not all beans have emailAddress property, we must account for this |
|
83 | - if (isset($bean->emailAddress)){ |
|
84 | - $to_addrs = $bean->emailAddress->getPrimaryAddress($bean); |
|
85 | - $button = "<input class='button' type='button' value='$value' id='". $this->getWidgetId() . "' name='".preg_replace('[ ]', '', $value)."' title='$title' onclick=\"location.href='mailto:$to_addrs';return false;\" />"; |
|
86 | - } |
|
87 | - else{ |
|
88 | - $button = "<input class='button' type='button' value='$value' id='". $this->getWidgetId() ."' name='".preg_replace('[ ]', '', $value)."' title='$title' onclick=\"location.href='mailto:';return false;\" />"; |
|
89 | - } |
|
90 | - } else { |
|
91 | - //Generate the compose package for the quick create options. |
|
92 | - $composeData = array("parent_id" => $parent_id, "parent_type"=>$parent_type); |
|
72 | + //martin Bug 19660 |
|
73 | + $userPref = $current_user->getPreference('email_link_type'); |
|
74 | + $defaultPref = $sugar_config['email_default_client']; |
|
75 | + if($userPref != '') { |
|
76 | + $client = $userPref; |
|
77 | + } else { |
|
78 | + $client = $defaultPref; |
|
79 | + } |
|
80 | + if($client != 'sugar') { |
|
81 | + $bean = $defines['focus']; |
|
82 | + // awu: Not all beans have emailAddress property, we must account for this |
|
83 | + if (isset($bean->emailAddress)){ |
|
84 | + $to_addrs = $bean->emailAddress->getPrimaryAddress($bean); |
|
85 | + $button = "<input class='button' type='button' value='$value' id='". $this->getWidgetId() . "' name='".preg_replace('[ ]', '', $value)."' title='$title' onclick=\"location.href='mailto:$to_addrs';return false;\" />"; |
|
86 | + } |
|
87 | + else{ |
|
88 | + $button = "<input class='button' type='button' value='$value' id='". $this->getWidgetId() ."' name='".preg_replace('[ ]', '', $value)."' title='$title' onclick=\"location.href='mailto:';return false;\" />"; |
|
89 | + } |
|
90 | + } else { |
|
91 | + //Generate the compose package for the quick create options. |
|
92 | + $composeData = array("parent_id" => $parent_id, "parent_type"=>$parent_type); |
|
93 | 93 | require_once('modules/Emails/EmailUI.php'); |
94 | 94 | $eUi = new EmailUI(); |
95 | 95 | $j_quickComposeOptions = $eUi->generateComposePackageForQuickCreate($composeData, http_build_query($composeData), false, $defines['focus']); |
96 | 96 | |
97 | 97 | $button = "<input title='$title' id='". $this->getWidgetId()."' onclick='SUGAR.quickCompose.init($j_quickComposeOptions);' class='button' type='submit' name='".preg_replace('[ ]', '', $value)."_button' value='$value' />"; |
98 | - } |
|
99 | - return $button; |
|
100 | - } |
|
98 | + } |
|
99 | + return $button; |
|
100 | + } |
|
101 | 101 | } |
@@ -45,120 +45,120 @@ |
||
45 | 45 | |
46 | 46 | class SugarWidgetSubPanelTopScheduleCallButton extends SugarWidgetSubPanelTopButtonQuickCreate |
47 | 47 | { |
48 | - function &_get_form($defines, $additionalFormFields = null, $asUrl = false) |
|
49 | - { |
|
50 | - global $app_strings; |
|
51 | - global $currentModule; |
|
52 | - |
|
53 | - $this->module="Calls"; |
|
54 | - $this->subpanelDiv = "activities"; |
|
55 | - |
|
56 | - // Create the additional form fields with real values if they were not passed in |
|
57 | - if(empty($additionalFormFields) && $this->additional_form_fields) |
|
58 | - { |
|
59 | - foreach($this->additional_form_fields as $key=>$value) |
|
60 | - { |
|
61 | - if(!empty($defines['focus']->$value)) |
|
62 | - { |
|
63 | - $additionalFormFields[$key] = $defines['focus']->$value; |
|
64 | - } |
|
65 | - else |
|
66 | - { |
|
67 | - $additionalFormFields[$key] = ''; |
|
68 | - } |
|
69 | - } |
|
70 | - } |
|
71 | - |
|
72 | - if(!empty($this->module)) |
|
73 | - { |
|
74 | - $defines['child_module_name'] = $this->module; |
|
75 | - } |
|
76 | - else |
|
77 | - { |
|
78 | - $defines['child_module_name'] = $defines['module']; |
|
79 | - } |
|
80 | - |
|
81 | - if(!empty($this->subpanelDiv)) |
|
82 | - { |
|
83 | - $defines['subpanelDiv'] = $this->subpanelDiv; |
|
84 | - } |
|
85 | - |
|
86 | - $defines['parent_bean_name'] = get_class( $defines['focus']); |
|
87 | - |
|
88 | - $form = 'form' . $defines['child_module_name']; |
|
89 | - $button = '<form onsubmit="return SUGAR.subpanelUtils.sendAndRetrieve(this.id, \'subpanel_' . strtolower($defines['subpanelDiv']) . '\', \'' . addslashes($app_strings['LBL_LOADING']) . '\');" action="index.php" method="post" name="form" id="form' . $form . "\">\n"; |
|
90 | - |
|
91 | - //module_button is used to override the value of module name |
|
92 | - $button .= "<input type='hidden' name='target_module' value='".$defines['child_module_name']."'>\n"; |
|
93 | - $button .= "<input type='hidden' name='".strtolower($defines['parent_bean_name'])."_id' value='".$defines['focus']->id."'>\n"; |
|
94 | - |
|
95 | - if(isset($defines['focus']->name)) |
|
96 | - { |
|
97 | - $button .= "<input type='hidden' name='".strtolower($defines['parent_bean_name'])."_name' value='".$defines['focus']->name."'>"; |
|
98 | - } |
|
99 | - |
|
100 | - $button .= '<input type="hidden" name="to_pdf" value="true" />'; |
|
48 | + function &_get_form($defines, $additionalFormFields = null, $asUrl = false) |
|
49 | + { |
|
50 | + global $app_strings; |
|
51 | + global $currentModule; |
|
52 | + |
|
53 | + $this->module="Calls"; |
|
54 | + $this->subpanelDiv = "activities"; |
|
55 | + |
|
56 | + // Create the additional form fields with real values if they were not passed in |
|
57 | + if(empty($additionalFormFields) && $this->additional_form_fields) |
|
58 | + { |
|
59 | + foreach($this->additional_form_fields as $key=>$value) |
|
60 | + { |
|
61 | + if(!empty($defines['focus']->$value)) |
|
62 | + { |
|
63 | + $additionalFormFields[$key] = $defines['focus']->$value; |
|
64 | + } |
|
65 | + else |
|
66 | + { |
|
67 | + $additionalFormFields[$key] = ''; |
|
68 | + } |
|
69 | + } |
|
70 | + } |
|
71 | + |
|
72 | + if(!empty($this->module)) |
|
73 | + { |
|
74 | + $defines['child_module_name'] = $this->module; |
|
75 | + } |
|
76 | + else |
|
77 | + { |
|
78 | + $defines['child_module_name'] = $defines['module']; |
|
79 | + } |
|
80 | + |
|
81 | + if(!empty($this->subpanelDiv)) |
|
82 | + { |
|
83 | + $defines['subpanelDiv'] = $this->subpanelDiv; |
|
84 | + } |
|
85 | + |
|
86 | + $defines['parent_bean_name'] = get_class( $defines['focus']); |
|
87 | + |
|
88 | + $form = 'form' . $defines['child_module_name']; |
|
89 | + $button = '<form onsubmit="return SUGAR.subpanelUtils.sendAndRetrieve(this.id, \'subpanel_' . strtolower($defines['subpanelDiv']) . '\', \'' . addslashes($app_strings['LBL_LOADING']) . '\');" action="index.php" method="post" name="form" id="form' . $form . "\">\n"; |
|
90 | + |
|
91 | + //module_button is used to override the value of module name |
|
92 | + $button .= "<input type='hidden' name='target_module' value='".$defines['child_module_name']."'>\n"; |
|
93 | + $button .= "<input type='hidden' name='".strtolower($defines['parent_bean_name'])."_id' value='".$defines['focus']->id."'>\n"; |
|
94 | + |
|
95 | + if(isset($defines['focus']->name)) |
|
96 | + { |
|
97 | + $button .= "<input type='hidden' name='".strtolower($defines['parent_bean_name'])."_name' value='".$defines['focus']->name."'>"; |
|
98 | + } |
|
99 | + |
|
100 | + $button .= '<input type="hidden" name="to_pdf" value="true" />'; |
|
101 | 101 | $button .= '<input type="hidden" name="tpl" value="QuickCreate.tpl" />'; |
102 | - $button .= '<input type="hidden" name="return_module" value="' . $currentModule . "\" />\n"; |
|
103 | - $button .= '<input type="hidden" name="return_action" value="' . $defines['action'] . "\" />\n"; |
|
104 | - $button .= '<input type="hidden" name="return_id" value="' . $defines['focus']->id . "\" />\n"; |
|
105 | - $button .= '<input type="hidden" name="record" value="" />'; |
|
106 | - |
|
107 | - // TODO: move this out and get $additionalFormFields working properly |
|
108 | - if(empty($additionalFormFields['parent_type'])) |
|
109 | - { |
|
110 | - if($defines['focus']->object_name=='Contact') { |
|
111 | - $additionalFormFields['parent_type'] = 'Accounts'; |
|
112 | - } |
|
113 | - else { |
|
114 | - $additionalFormFields['parent_type'] = $defines['focus']->module_dir; |
|
115 | - } |
|
116 | - } |
|
117 | - if(empty($additionalFormFields['parent_name'])) |
|
118 | - { |
|
119 | - if($defines['focus']->object_name=='Contact') { |
|
120 | - $additionalFormFields['parent_name'] = $defines['focus']->account_name; |
|
121 | - $additionalFormFields['account_name'] = $defines['focus']->account_name; |
|
122 | - } |
|
123 | - else { |
|
124 | - $additionalFormFields['parent_name'] = $defines['focus']->name; |
|
125 | - } |
|
126 | - } |
|
127 | - if(empty($additionalFormFields['parent_id'])) |
|
128 | - { |
|
129 | - if($defines['focus']->object_name=='Contact') { |
|
130 | - $additionalFormFields['parent_id'] = $defines['focus']->account_id; |
|
131 | - $additionalFormFields['account_id'] = $defines['focus']->account_id; |
|
132 | - } |
|
133 | - else { |
|
134 | - $additionalFormFields['parent_id'] = $defines['focus']->id; |
|
135 | - } |
|
136 | - } |
|
137 | - |
|
138 | - $button .= '<input type="hidden" name="action" value="SubpanelCreates" />' . "\n"; |
|
139 | - $button .= '<input type="hidden" name="module" value="Home" />' . "\n"; |
|
140 | - $button .= '<input type="hidden" name="target_action" value="QuickCreate" />' . "\n"; |
|
141 | - |
|
142 | - // fill in additional form fields for all but action |
|
143 | - foreach($additionalFormFields as $key => $value) |
|
144 | - { |
|
145 | - if($key != 'action') |
|
146 | - { |
|
147 | - $button .= '<input type="hidden" name="' . $key . '" value="' . $value . '" />' . "\n"; |
|
148 | - } |
|
149 | - } |
|
150 | - $button .= getVersionedScript('include/SugarFields/Fields/Datetimecombo/Datetimecombo.js')."\n"; |
|
151 | - return $button; |
|
152 | - } |
|
153 | - |
|
154 | - function display($defines, $additionalFormFields = null, $nonbutton = false) |
|
155 | - { |
|
156 | - $focus = new Call; |
|
157 | - if ( !$focus->ACLAccess('EditView') ) { |
|
158 | - return ''; |
|
159 | - } |
|
160 | - |
|
161 | - return parent::display($defines, $additionalFormFields); |
|
162 | - } |
|
102 | + $button .= '<input type="hidden" name="return_module" value="' . $currentModule . "\" />\n"; |
|
103 | + $button .= '<input type="hidden" name="return_action" value="' . $defines['action'] . "\" />\n"; |
|
104 | + $button .= '<input type="hidden" name="return_id" value="' . $defines['focus']->id . "\" />\n"; |
|
105 | + $button .= '<input type="hidden" name="record" value="" />'; |
|
106 | + |
|
107 | + // TODO: move this out and get $additionalFormFields working properly |
|
108 | + if(empty($additionalFormFields['parent_type'])) |
|
109 | + { |
|
110 | + if($defines['focus']->object_name=='Contact') { |
|
111 | + $additionalFormFields['parent_type'] = 'Accounts'; |
|
112 | + } |
|
113 | + else { |
|
114 | + $additionalFormFields['parent_type'] = $defines['focus']->module_dir; |
|
115 | + } |
|
116 | + } |
|
117 | + if(empty($additionalFormFields['parent_name'])) |
|
118 | + { |
|
119 | + if($defines['focus']->object_name=='Contact') { |
|
120 | + $additionalFormFields['parent_name'] = $defines['focus']->account_name; |
|
121 | + $additionalFormFields['account_name'] = $defines['focus']->account_name; |
|
122 | + } |
|
123 | + else { |
|
124 | + $additionalFormFields['parent_name'] = $defines['focus']->name; |
|
125 | + } |
|
126 | + } |
|
127 | + if(empty($additionalFormFields['parent_id'])) |
|
128 | + { |
|
129 | + if($defines['focus']->object_name=='Contact') { |
|
130 | + $additionalFormFields['parent_id'] = $defines['focus']->account_id; |
|
131 | + $additionalFormFields['account_id'] = $defines['focus']->account_id; |
|
132 | + } |
|
133 | + else { |
|
134 | + $additionalFormFields['parent_id'] = $defines['focus']->id; |
|
135 | + } |
|
136 | + } |
|
137 | + |
|
138 | + $button .= '<input type="hidden" name="action" value="SubpanelCreates" />' . "\n"; |
|
139 | + $button .= '<input type="hidden" name="module" value="Home" />' . "\n"; |
|
140 | + $button .= '<input type="hidden" name="target_action" value="QuickCreate" />' . "\n"; |
|
141 | + |
|
142 | + // fill in additional form fields for all but action |
|
143 | + foreach($additionalFormFields as $key => $value) |
|
144 | + { |
|
145 | + if($key != 'action') |
|
146 | + { |
|
147 | + $button .= '<input type="hidden" name="' . $key . '" value="' . $value . '" />' . "\n"; |
|
148 | + } |
|
149 | + } |
|
150 | + $button .= getVersionedScript('include/SugarFields/Fields/Datetimecombo/Datetimecombo.js')."\n"; |
|
151 | + return $button; |
|
152 | + } |
|
153 | + |
|
154 | + function display($defines, $additionalFormFields = null, $nonbutton = false) |
|
155 | + { |
|
156 | + $focus = new Call; |
|
157 | + if ( !$focus->ACLAccess('EditView') ) { |
|
158 | + return ''; |
|
159 | + } |
|
160 | + |
|
161 | + return parent::display($defines, $additionalFormFields); |
|
162 | + } |
|
163 | 163 | } |
164 | 164 | ?> |
@@ -47,103 +47,103 @@ discard block |
||
47 | 47 | { |
48 | 48 | |
49 | 49 | |
50 | - function &_get_form($defines, $additionalFormFields = null, $asUrl = false) |
|
51 | - { |
|
52 | - global $app_strings; |
|
53 | - global $currentModule; |
|
54 | - |
|
55 | - // Create the additional form fields with real values if they were not passed in |
|
56 | - if(empty($additionalFormFields) && $this->additional_form_fields) |
|
57 | - { |
|
58 | - foreach($this->additional_form_fields as $key=>$value) |
|
59 | - { |
|
60 | - if(!empty($defines['focus']->$value)) |
|
61 | - { |
|
62 | - $additionalFormFields[$key] = $defines['focus']->$value; |
|
63 | - } |
|
64 | - else |
|
65 | - { |
|
66 | - $additionalFormFields[$key] = ''; |
|
67 | - } |
|
68 | - } |
|
69 | - } |
|
70 | - |
|
71 | - if(!empty($this->module)) |
|
72 | - { |
|
73 | - $defines['child_module_name'] = $this->module; |
|
74 | - } |
|
75 | - else |
|
76 | - { |
|
77 | - $defines['child_module_name'] = $defines['module']; |
|
78 | - } |
|
79 | - |
|
80 | - $defines['parent_bean_name'] = get_class( $defines['focus']); |
|
81 | - |
|
82 | - $relationship_name = $this->get_subpanel_relationship_name($defines); |
|
83 | - |
|
84 | - $form = 'form' . $relationship_name; |
|
85 | - $button = '<form onsubmit="return SUGAR.subpanelUtils.sendAndRetrieve(this.id, \'subpanel_' . $defines['subpanel_definition']->name . '\', \'' . addslashes($app_strings['LBL_LOADING']) . '\');" action="index.php" method="post" name="form" id="form' . $form . "\">\n"; |
|
86 | - |
|
87 | - //module_button is used to override the value of module name |
|
88 | - $button .= "<input type='hidden' name='target_module' value='".$defines['child_module_name']."'>\n"; |
|
89 | - $button .= "<input type='hidden' name='".strtolower($defines['parent_bean_name'])."_id' value='".$defines['focus']->id."'>\n"; |
|
90 | - |
|
91 | - if(isset($defines['focus']->name)) |
|
92 | - { |
|
93 | - $button .= "<input type='hidden' name='".strtolower($defines['parent_bean_name'])."_name' value='".$defines['focus']->name."'>"; |
|
94 | - #26451,add these fields for custom one-to-many relate field. |
|
50 | + function &_get_form($defines, $additionalFormFields = null, $asUrl = false) |
|
51 | + { |
|
52 | + global $app_strings; |
|
53 | + global $currentModule; |
|
54 | + |
|
55 | + // Create the additional form fields with real values if they were not passed in |
|
56 | + if(empty($additionalFormFields) && $this->additional_form_fields) |
|
57 | + { |
|
58 | + foreach($this->additional_form_fields as $key=>$value) |
|
59 | + { |
|
60 | + if(!empty($defines['focus']->$value)) |
|
61 | + { |
|
62 | + $additionalFormFields[$key] = $defines['focus']->$value; |
|
63 | + } |
|
64 | + else |
|
65 | + { |
|
66 | + $additionalFormFields[$key] = ''; |
|
67 | + } |
|
68 | + } |
|
69 | + } |
|
70 | + |
|
71 | + if(!empty($this->module)) |
|
72 | + { |
|
73 | + $defines['child_module_name'] = $this->module; |
|
74 | + } |
|
75 | + else |
|
76 | + { |
|
77 | + $defines['child_module_name'] = $defines['module']; |
|
78 | + } |
|
79 | + |
|
80 | + $defines['parent_bean_name'] = get_class( $defines['focus']); |
|
81 | + |
|
82 | + $relationship_name = $this->get_subpanel_relationship_name($defines); |
|
83 | + |
|
84 | + $form = 'form' . $relationship_name; |
|
85 | + $button = '<form onsubmit="return SUGAR.subpanelUtils.sendAndRetrieve(this.id, \'subpanel_' . $defines['subpanel_definition']->name . '\', \'' . addslashes($app_strings['LBL_LOADING']) . '\');" action="index.php" method="post" name="form" id="form' . $form . "\">\n"; |
|
86 | + |
|
87 | + //module_button is used to override the value of module name |
|
88 | + $button .= "<input type='hidden' name='target_module' value='".$defines['child_module_name']."'>\n"; |
|
89 | + $button .= "<input type='hidden' name='".strtolower($defines['parent_bean_name'])."_id' value='".$defines['focus']->id."'>\n"; |
|
90 | + |
|
91 | + if(isset($defines['focus']->name)) |
|
92 | + { |
|
93 | + $button .= "<input type='hidden' name='".strtolower($defines['parent_bean_name'])."_name' value='".$defines['focus']->name."'>"; |
|
94 | + #26451,add these fields for custom one-to-many relate field. |
|
95 | 95 | if(!empty($defines['child_module_name'])){ |
96 | - $button .= "<input type='hidden' name='". $relationship_name ."_name' value='".$defines['focus']->name."'>"; |
|
97 | - $childFocusName = !empty($GLOBALS['beanList'][$defines['child_module_name']]) ? $GLOBALS['beanList'][$defines['child_module_name']] : ""; |
|
98 | - if(!empty($GLOBALS['dictionary'][ $childFocusName ]["fields"][$relationship_name .'_name']['id_name'])){ |
|
99 | - $button .= "<input type='hidden' name='". $GLOBALS['dictionary'][ $childFocusName ]["fields"][$relationship_name .'_name']['id_name'] ."' value='".$defines['focus']->id."'>"; |
|
100 | - } |
|
96 | + $button .= "<input type='hidden' name='". $relationship_name ."_name' value='".$defines['focus']->name."'>"; |
|
97 | + $childFocusName = !empty($GLOBALS['beanList'][$defines['child_module_name']]) ? $GLOBALS['beanList'][$defines['child_module_name']] : ""; |
|
98 | + if(!empty($GLOBALS['dictionary'][ $childFocusName ]["fields"][$relationship_name .'_name']['id_name'])){ |
|
99 | + $button .= "<input type='hidden' name='". $GLOBALS['dictionary'][ $childFocusName ]["fields"][$relationship_name .'_name']['id_name'] ."' value='".$defines['focus']->id."'>"; |
|
100 | + } |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | //Set the return_name form variable that will allow EditView2.php |
104 | 104 | $additionalFormFields['return_name'] = $defines['focus']->name; |
105 | - } |
|
105 | + } |
|
106 | 106 | |
107 | - if(!empty($defines['view'])) |
|
108 | - $button .= '<input type="hidden" name="target_view" value="'. $defines['view'] . '" />'; |
|
109 | - $button .= '<input type="hidden" name="to_pdf" value="true" />'; |
|
107 | + if(!empty($defines['view'])) |
|
108 | + $button .= '<input type="hidden" name="target_view" value="'. $defines['view'] . '" />'; |
|
109 | + $button .= '<input type="hidden" name="to_pdf" value="true" />'; |
|
110 | 110 | $button .= '<input type="hidden" name="tpl" value="QuickCreate.tpl" />'; |
111 | - $button .= '<input type="hidden" name="return_module" value="' . $currentModule . "\" />\n"; |
|
112 | - $button .= '<input type="hidden" name="return_action" value="' . $defines['action'] . "\" />\n"; |
|
113 | - $button .= '<input type="hidden" name="return_id" value="' . $defines['focus']->id . "\" />\n"; |
|
114 | - $button .= '<input type="hidden" name="return_relationship" value="' . $relationship_name . "\" />\n"; |
|
115 | - $button .= '<input type="hidden" name="record" value="" />'; |
|
116 | - |
|
117 | - // TODO: move this out and get $additionalFormFields working properly |
|
118 | - if(empty($additionalFormFields['parent_type'])) |
|
119 | - { |
|
120 | - if($defines['focus']->object_name=='Contact') { |
|
121 | - $additionalFormFields['parent_type'] = 'Accounts'; |
|
122 | - } |
|
123 | - else { |
|
124 | - $additionalFormFields['parent_type'] = $defines['focus']->module_dir; |
|
125 | - } |
|
126 | - } |
|
127 | - if(empty($additionalFormFields['parent_name'])) |
|
128 | - { |
|
129 | - if($defines['focus']->object_name=='Contact') { |
|
130 | - $additionalFormFields['parent_name'] = $defines['focus']->account_name; |
|
131 | - $additionalFormFields['account_name'] = $defines['focus']->account_name; |
|
132 | - } |
|
133 | - else { |
|
134 | - $additionalFormFields['parent_name'] = $defines['focus']->name; |
|
135 | - } |
|
136 | - } |
|
137 | - if(empty($additionalFormFields['parent_id'])) |
|
138 | - { |
|
139 | - if($defines['focus']->object_name=='Contact') { |
|
140 | - $additionalFormFields['parent_id'] = $defines['focus']->account_id; |
|
141 | - $additionalFormFields['account_id'] = $defines['focus']->account_id; |
|
142 | - } |
|
143 | - else { |
|
144 | - $additionalFormFields['parent_id'] = $defines['focus']->id; |
|
145 | - } |
|
146 | - } |
|
111 | + $button .= '<input type="hidden" name="return_module" value="' . $currentModule . "\" />\n"; |
|
112 | + $button .= '<input type="hidden" name="return_action" value="' . $defines['action'] . "\" />\n"; |
|
113 | + $button .= '<input type="hidden" name="return_id" value="' . $defines['focus']->id . "\" />\n"; |
|
114 | + $button .= '<input type="hidden" name="return_relationship" value="' . $relationship_name . "\" />\n"; |
|
115 | + $button .= '<input type="hidden" name="record" value="" />'; |
|
116 | + |
|
117 | + // TODO: move this out and get $additionalFormFields working properly |
|
118 | + if(empty($additionalFormFields['parent_type'])) |
|
119 | + { |
|
120 | + if($defines['focus']->object_name=='Contact') { |
|
121 | + $additionalFormFields['parent_type'] = 'Accounts'; |
|
122 | + } |
|
123 | + else { |
|
124 | + $additionalFormFields['parent_type'] = $defines['focus']->module_dir; |
|
125 | + } |
|
126 | + } |
|
127 | + if(empty($additionalFormFields['parent_name'])) |
|
128 | + { |
|
129 | + if($defines['focus']->object_name=='Contact') { |
|
130 | + $additionalFormFields['parent_name'] = $defines['focus']->account_name; |
|
131 | + $additionalFormFields['account_name'] = $defines['focus']->account_name; |
|
132 | + } |
|
133 | + else { |
|
134 | + $additionalFormFields['parent_name'] = $defines['focus']->name; |
|
135 | + } |
|
136 | + } |
|
137 | + if(empty($additionalFormFields['parent_id'])) |
|
138 | + { |
|
139 | + if($defines['focus']->object_name=='Contact') { |
|
140 | + $additionalFormFields['parent_id'] = $defines['focus']->account_id; |
|
141 | + $additionalFormFields['account_id'] = $defines['focus']->account_id; |
|
142 | + } |
|
143 | + else { |
|
144 | + $additionalFormFields['parent_id'] = $defines['focus']->id; |
|
145 | + } |
|
146 | + } |
|
147 | 147 | |
148 | 148 | if(strtolower($defines['child_module_name']) =='contracts') { |
149 | 149 | //set variables to account name, or parent account name |
@@ -161,43 +161,43 @@ discard block |
||
161 | 161 | } |
162 | 162 | } |
163 | 163 | |
164 | - $button .= '<input type="hidden" name="action" value="SubpanelCreates" />' . "\n"; |
|
165 | - $button .= '<input type="hidden" name="module" value="Home" />' . "\n"; |
|
166 | - $button .= '<input type="hidden" name="target_action" value="QuickCreate" />' . "\n"; |
|
167 | - |
|
168 | - // fill in additional form fields for all but action |
|
169 | - foreach($additionalFormFields as $key => $value) |
|
170 | - { |
|
171 | - if($key != 'action') |
|
172 | - { |
|
173 | - $button .= '<input type="hidden" name="' . $key . '" value=\'' . $value . '\' />' . "\n"; |
|
174 | - } |
|
175 | - } |
|
176 | - |
|
177 | - return $button; |
|
178 | - } |
|
179 | - |
|
180 | - /** |
|
181 | - * get_subpanel_relationship_name |
|
182 | - * Get the relationship name based on the subapnel definition |
|
183 | - * @param mixed $defines The subpanel definition |
|
184 | - */ |
|
185 | - function get_subpanel_relationship_name($defines) { |
|
186 | - $relationship_name = ''; |
|
187 | - if(!empty($defines)) { |
|
188 | - $relationship_name = isset($defines['module']) ? $defines['module'] : ''; |
|
189 | - $dataSource = $defines['subpanel_definition']->get_data_source_name(true); |
|
190 | - if (!empty($dataSource)) { |
|
191 | - $relationship_name = $dataSource; |
|
192 | - //Try to set the relationship name to the real relationship, not the link. |
|
193 | - if (!empty($defines['subpanel_definition']->parent_bean->field_defs[$dataSource]) |
|
194 | - && !empty($defines['subpanel_definition']->parent_bean->field_defs[$dataSource]['relationship'])) |
|
195 | - { |
|
196 | - $relationship_name = $defines['subpanel_definition']->parent_bean->field_defs[$dataSource]['relationship']; |
|
197 | - } |
|
198 | - } |
|
199 | - } |
|
200 | - return $relationship_name; |
|
201 | - } |
|
164 | + $button .= '<input type="hidden" name="action" value="SubpanelCreates" />' . "\n"; |
|
165 | + $button .= '<input type="hidden" name="module" value="Home" />' . "\n"; |
|
166 | + $button .= '<input type="hidden" name="target_action" value="QuickCreate" />' . "\n"; |
|
167 | + |
|
168 | + // fill in additional form fields for all but action |
|
169 | + foreach($additionalFormFields as $key => $value) |
|
170 | + { |
|
171 | + if($key != 'action') |
|
172 | + { |
|
173 | + $button .= '<input type="hidden" name="' . $key . '" value=\'' . $value . '\' />' . "\n"; |
|
174 | + } |
|
175 | + } |
|
176 | + |
|
177 | + return $button; |
|
178 | + } |
|
179 | + |
|
180 | + /** |
|
181 | + * get_subpanel_relationship_name |
|
182 | + * Get the relationship name based on the subapnel definition |
|
183 | + * @param mixed $defines The subpanel definition |
|
184 | + */ |
|
185 | + function get_subpanel_relationship_name($defines) { |
|
186 | + $relationship_name = ''; |
|
187 | + if(!empty($defines)) { |
|
188 | + $relationship_name = isset($defines['module']) ? $defines['module'] : ''; |
|
189 | + $dataSource = $defines['subpanel_definition']->get_data_source_name(true); |
|
190 | + if (!empty($dataSource)) { |
|
191 | + $relationship_name = $dataSource; |
|
192 | + //Try to set the relationship name to the real relationship, not the link. |
|
193 | + if (!empty($defines['subpanel_definition']->parent_bean->field_defs[$dataSource]) |
|
194 | + && !empty($defines['subpanel_definition']->parent_bean->field_defs[$dataSource]['relationship'])) |
|
195 | + { |
|
196 | + $relationship_name = $defines['subpanel_definition']->parent_bean->field_defs[$dataSource]['relationship']; |
|
197 | + } |
|
198 | + } |
|
199 | + } |
|
200 | + return $relationship_name; |
|
201 | + } |
|
202 | 202 | } |
203 | 203 | ?> |
@@ -42,59 +42,59 @@ |
||
42 | 42 | |
43 | 43 | class SugarWidgetFieldInt extends SugarWidgetReportField |
44 | 44 | { |
45 | - function displayList($layout_def) |
|
46 | - { |
|
45 | + function displayList($layout_def) |
|
46 | + { |
|
47 | 47 | |
48 | - return $this->displayListPlain($layout_def); |
|
49 | - } |
|
48 | + return $this->displayListPlain($layout_def); |
|
49 | + } |
|
50 | 50 | |
51 | - function queryFilterEquals(&$layout_def) |
|
52 | - { |
|
51 | + function queryFilterEquals(&$layout_def) |
|
52 | + { |
|
53 | 53 | return $this->_get_column_select($layout_def)."= '".$GLOBALS['db']->quote($layout_def['input_name0'])."'\n"; |
54 | - } |
|
54 | + } |
|
55 | 55 | |
56 | - function queryFilterNot_Equals(&$layout_def) |
|
57 | - { |
|
56 | + function queryFilterNot_Equals(&$layout_def) |
|
57 | + { |
|
58 | 58 | return $this->_get_column_select($layout_def)."!='".$GLOBALS['db']->quote($layout_def['input_name0'])."'\n"; |
59 | - } |
|
59 | + } |
|
60 | 60 | |
61 | - function queryFilterGreater(&$layout_def) |
|
62 | - { |
|
61 | + function queryFilterGreater(&$layout_def) |
|
62 | + { |
|
63 | 63 | return $this->_get_column_select($layout_def)." > '".$GLOBALS['db']->quote($layout_def['input_name0'])."'\n"; |
64 | - } |
|
64 | + } |
|
65 | 65 | |
66 | - function queryFilterLess(&$layout_def) |
|
67 | - { |
|
66 | + function queryFilterLess(&$layout_def) |
|
67 | + { |
|
68 | 68 | return $this->_get_column_select($layout_def)." < '".$GLOBALS['db']->quote($layout_def['input_name0'])."'\n"; |
69 | - } |
|
69 | + } |
|
70 | 70 | |
71 | - function queryFilterBetween(&$layout_def) |
|
72 | - { |
|
73 | - return $this->_get_column_select($layout_def)." BETWEEN '".$GLOBALS['db']->quote($layout_def['input_name0']). "' AND '" . $GLOBALS['db']->quote($layout_def['input_name1']) . "'\n"; |
|
74 | - } |
|
71 | + function queryFilterBetween(&$layout_def) |
|
72 | + { |
|
73 | + return $this->_get_column_select($layout_def)." BETWEEN '".$GLOBALS['db']->quote($layout_def['input_name0']). "' AND '" . $GLOBALS['db']->quote($layout_def['input_name1']) . "'\n"; |
|
74 | + } |
|
75 | 75 | |
76 | - function queryFilterStarts_With(&$layout_def) |
|
77 | - { |
|
78 | - return $this->queryFilterEquals($layout_def); |
|
79 | - } |
|
76 | + function queryFilterStarts_With(&$layout_def) |
|
77 | + { |
|
78 | + return $this->queryFilterEquals($layout_def); |
|
79 | + } |
|
80 | 80 | |
81 | - function displayInput(&$layout_def) |
|
82 | - { |
|
83 | - return '<input type="text" size="20" value="' . $layout_def['input_name0'] . '" name="' . $layout_def['name'] . '">'; |
|
81 | + function displayInput(&$layout_def) |
|
82 | + { |
|
83 | + return '<input type="text" size="20" value="' . $layout_def['input_name0'] . '" name="' . $layout_def['name'] . '">'; |
|
84 | 84 | |
85 | - } |
|
85 | + } |
|
86 | 86 | |
87 | - function display($layout_def) |
|
88 | - { |
|
89 | - //Bug40995 |
|
90 | - if(isset($obj->layout_manager->defs['reporter']->focus->field_name_map[$layout_def['name']]['precision'])) |
|
91 | - { |
|
92 | - $precision=$obj->layout_manager->defs['reporter']->focus->field_name_map[$layout_def['name']]['precision']; |
|
93 | - $layout_def['precision']=$precision; |
|
94 | - } |
|
95 | - //Bug40995 |
|
96 | - return parent::display($layout_def); |
|
97 | - } |
|
87 | + function display($layout_def) |
|
88 | + { |
|
89 | + //Bug40995 |
|
90 | + if(isset($obj->layout_manager->defs['reporter']->focus->field_name_map[$layout_def['name']]['precision'])) |
|
91 | + { |
|
92 | + $precision=$obj->layout_manager->defs['reporter']->focus->field_name_map[$layout_def['name']]['precision']; |
|
93 | + $layout_def['precision']=$precision; |
|
94 | + } |
|
95 | + //Bug40995 |
|
96 | + return parent::display($layout_def); |
|
97 | + } |
|
98 | 98 | |
99 | 99 | } |
100 | 100 |