@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | |
42 | 42 | class SugarWidgetFieldFloat extends SugarWidgetFieldInt |
43 | 43 | { |
44 | - function displayList($layout_def) |
|
45 | - { |
|
44 | + function displayList($layout_def) |
|
45 | + { |
|
46 | 46 | |
47 | 47 | $vardef = $this->getVardef($layout_def); |
48 | 48 | |
@@ -51,37 +51,37 @@ discard block |
||
51 | 51 | } else { |
52 | 52 | $precision = null; |
53 | 53 | } |
54 | - return format_number(parent::displayListPlain($layout_def), $precision, $precision); |
|
55 | - } |
|
54 | + return format_number(parent::displayListPlain($layout_def), $precision, $precision); |
|
55 | + } |
|
56 | 56 | |
57 | - function displayListPlain($layout_def) |
|
58 | - { |
|
59 | - return $this->displayList($layout_def); |
|
60 | - } |
|
61 | - function queryFilterEquals(&$layout_def) |
|
62 | - { |
|
57 | + function displayListPlain($layout_def) |
|
58 | + { |
|
59 | + return $this->displayList($layout_def); |
|
60 | + } |
|
61 | + function queryFilterEquals(&$layout_def) |
|
62 | + { |
|
63 | 63 | return $this->_get_column_select($layout_def)."= ".$GLOBALS['db']->quote(unformat_number($layout_def['input_name0']))."\n"; |
64 | - } |
|
64 | + } |
|
65 | 65 | |
66 | - function queryFilterNot_Equals(&$layout_def) |
|
67 | - { |
|
68 | - return $this->_get_column_select($layout_def)."!=".$GLOBALS['db']->quote(unformat_number($layout_def['input_name0']))."\n"; |
|
69 | - } |
|
66 | + function queryFilterNot_Equals(&$layout_def) |
|
67 | + { |
|
68 | + return $this->_get_column_select($layout_def)."!=".$GLOBALS['db']->quote(unformat_number($layout_def['input_name0']))."\n"; |
|
69 | + } |
|
70 | 70 | |
71 | - function queryFilterGreater(&$layout_def) |
|
72 | - { |
|
71 | + function queryFilterGreater(&$layout_def) |
|
72 | + { |
|
73 | 73 | return $this->_get_column_select($layout_def)." > ".$GLOBALS['db']->quote(unformat_number($layout_def['input_name0']))."\n"; |
74 | - } |
|
74 | + } |
|
75 | 75 | |
76 | - function queryFilterLess(&$layout_def) |
|
77 | - { |
|
78 | - return $this->_get_column_select($layout_def)." < ".$GLOBALS['db']->quote(unformat_number($layout_def['input_name0']))."\n"; |
|
79 | - } |
|
76 | + function queryFilterLess(&$layout_def) |
|
77 | + { |
|
78 | + return $this->_get_column_select($layout_def)." < ".$GLOBALS['db']->quote(unformat_number($layout_def['input_name0']))."\n"; |
|
79 | + } |
|
80 | 80 | |
81 | - function queryFilterBetween(&$layout_def) |
|
82 | - { |
|
83 | - return $this->_get_column_select($layout_def)." BETWEEN ".$GLOBALS['db']->quote(unformat_number($layout_def['input_name0'])). " AND " . $GLOBALS['db']->quote(unformat_number($layout_def['input_name1'])) . "\n"; |
|
84 | - } |
|
81 | + function queryFilterBetween(&$layout_def) |
|
82 | + { |
|
83 | + return $this->_get_column_select($layout_def)." BETWEEN ".$GLOBALS['db']->quote(unformat_number($layout_def['input_name0'])). " AND " . $GLOBALS['db']->quote(unformat_number($layout_def['input_name1'])) . "\n"; |
|
84 | + } |
|
85 | 85 | |
86 | 86 | |
87 | 87 | } |
@@ -51,13 +51,13 @@ |
||
51 | 51 | $ops = $layout_def['options']; |
52 | 52 | } |
53 | 53 | elseif (isset($layout_def['options']) && isset($app_list_strings[$layout_def['options']])){ |
54 | - $ops = $app_list_strings[$layout_def['options']]; |
|
54 | + $ops = $app_list_strings[$layout_def['options']]; |
|
55 | 55 | if(array_key_exists('', $app_list_strings[$layout_def['options']])) { |
56 | - unset($ops['']); |
|
57 | - } |
|
56 | + unset($ops['']); |
|
57 | + } |
|
58 | 58 | } |
59 | 59 | else{ |
60 | - $ops = array(); |
|
60 | + $ops = array(); |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | else { |
@@ -46,8 +46,8 @@ |
||
46 | 46 | |
47 | 47 | class SugarWidgetSubPanelTopMessage extends SugarWidgetSubPanelTopButton |
48 | 48 | { |
49 | - function display($defines) |
|
50 | - { |
|
49 | + function display($defines) |
|
50 | + { |
|
51 | 51 | return $defines['message']; |
52 | - } |
|
52 | + } |
|
53 | 53 | } |
54 | 54 | \ No newline at end of file |
@@ -58,39 +58,39 @@ discard block |
||
58 | 58 | } |
59 | 59 | |
60 | 60 | public function queryFilteris($layout_def) { |
61 | - $input_name0 = $layout_def['input_name0']; |
|
62 | - if (is_array($layout_def['input_name0'])) { |
|
63 | - $input_name0 = $layout_def['input_name0'][0]; |
|
64 | - } |
|
65 | - return $this->_get_column_select($layout_def)." = ".$this->reporter->db->quoted($input_name0)."\n"; |
|
66 | - } |
|
67 | - |
|
68 | - public function queryFilteris_not($layout_def) { |
|
69 | - $input_name0 = $layout_def['input_name0']; |
|
70 | - if (is_array($layout_def['input_name0'])) { |
|
71 | - $input_name0 = $layout_def['input_name0'][0]; |
|
72 | - } |
|
73 | - return $this->_get_column_select($layout_def)." <> ".$this->reporter->db->quoted($input_name0)."\n"; |
|
74 | - } |
|
75 | - |
|
76 | - public function queryFilterone_of($layout_def) { |
|
77 | - $arr = array (); |
|
78 | - foreach ($layout_def['input_name0'] as $value) { |
|
79 | - $arr[] = $this->reporter->db->quoted($value); |
|
80 | - } |
|
81 | - $str = implode(",", $arr); |
|
82 | - return $this->_get_column_select($layout_def)." IN (".$str.")\n"; |
|
83 | - } |
|
84 | - |
|
85 | - public function queryFilternot_one_of($layout_def) { |
|
86 | - $arr = array (); |
|
87 | - foreach ($layout_def['input_name0'] as $value) { |
|
88 | - $arr[] = $this->reporter->db->quoted($value); |
|
89 | - } |
|
90 | - $reporter = $this->layout_manager->getAttribute("reporter"); |
|
91 | - $str = implode(",", $arr); |
|
92 | - return $this->_get_column_select($layout_def)." NOT IN (".$str.")\n"; |
|
93 | - } |
|
61 | + $input_name0 = $layout_def['input_name0']; |
|
62 | + if (is_array($layout_def['input_name0'])) { |
|
63 | + $input_name0 = $layout_def['input_name0'][0]; |
|
64 | + } |
|
65 | + return $this->_get_column_select($layout_def)." = ".$this->reporter->db->quoted($input_name0)."\n"; |
|
66 | + } |
|
67 | + |
|
68 | + public function queryFilteris_not($layout_def) { |
|
69 | + $input_name0 = $layout_def['input_name0']; |
|
70 | + if (is_array($layout_def['input_name0'])) { |
|
71 | + $input_name0 = $layout_def['input_name0'][0]; |
|
72 | + } |
|
73 | + return $this->_get_column_select($layout_def)." <> ".$this->reporter->db->quoted($input_name0)."\n"; |
|
74 | + } |
|
75 | + |
|
76 | + public function queryFilterone_of($layout_def) { |
|
77 | + $arr = array (); |
|
78 | + foreach ($layout_def['input_name0'] as $value) { |
|
79 | + $arr[] = $this->reporter->db->quoted($value); |
|
80 | + } |
|
81 | + $str = implode(",", $arr); |
|
82 | + return $this->_get_column_select($layout_def)." IN (".$str.")\n"; |
|
83 | + } |
|
84 | + |
|
85 | + public function queryFilternot_one_of($layout_def) { |
|
86 | + $arr = array (); |
|
87 | + foreach ($layout_def['input_name0'] as $value) { |
|
88 | + $arr[] = $this->reporter->db->quoted($value); |
|
89 | + } |
|
90 | + $reporter = $this->layout_manager->getAttribute("reporter"); |
|
91 | + $str = implode(",", $arr); |
|
92 | + return $this->_get_column_select($layout_def)." NOT IN (".$str.")\n"; |
|
93 | + } |
|
94 | 94 | |
95 | 95 | function & displayList($layout_def) { |
96 | 96 | if(!empty($layout_def['column_key'])){ |
@@ -116,84 +116,84 @@ discard block |
||
116 | 116 | $field_type = $field_def['type']; |
117 | 117 | $div_id = $field_def['module'] ."&$record&$field_name"; |
118 | 118 | $str = "<div id='$div_id'>" . $cell . " " |
119 | - . SugarThemeRegistry::current()->getImage( |
|
119 | + . SugarThemeRegistry::current()->getImage( |
|
120 | 120 | "edit_inline", |
121 | 121 | "border='0' alt='Edit Layout' align='bottom' onClick='SUGAR.reportsInlineEdit.inlineEdit(" . |
122 | 122 | "\"$div_id\",\"$cell\",\"$module\",\"$record\",\"$field_name\",\"$field_type\");'" |
123 | - ) |
|
124 | - . "</div>"; |
|
123 | + ) |
|
124 | + . "</div>"; |
|
125 | 125 | } |
126 | 126 | } |
127 | 127 | return $str; |
128 | 128 | } |
129 | - function & displayListPlain($layout_def) { |
|
130 | - if(!empty($layout_def['column_key'])){ |
|
131 | - $field_def = $this->reporter->all_fields[$layout_def['column_key']]; |
|
132 | - }else if(!empty($layout_def['fields'])){ |
|
133 | - $field_def = $layout_def['fields']; |
|
134 | - } |
|
135 | - |
|
136 | - if (!empty($layout_def['table_key'] ) &&( empty ($field_def['fields']) || empty ($field_def['fields'][0]) || empty ($field_def['fields'][1]))){ |
|
137 | - $value = $this->_get_list_value($layout_def); |
|
138 | - }else if(!empty($layout_def['name']) && !empty($layout_def['fields'])){ |
|
139 | - $key = strtoupper($layout_def['name']); |
|
140 | - $value = $layout_def['fields'][$key]; |
|
141 | - } |
|
142 | - $cell = ''; |
|
143 | - |
|
144 | - if(isset($field_def['options'])){ |
|
145 | - $cell = translate($field_def['options'], $field_def['module'], $value); |
|
146 | - }else if(isset($field_def['type']) && $field_def['type'] == 'enum' && isset($field_def['function'])){ |
|
147 | - global $beanFiles; |
|
148 | - if(empty($beanFiles)) { |
|
149 | - include('include/modules.php'); |
|
150 | - } |
|
151 | - $bean_name = get_singular_bean_name($field_def['module']); |
|
152 | - require_once($beanFiles[$bean_name]); |
|
153 | - $list = $field_def['function'](); |
|
154 | - $cell = $list[$value]; |
|
155 | - } |
|
156 | - if (is_array($cell)) { |
|
157 | - |
|
158 | - //#22632 |
|
159 | - $value = unencodeMultienum($value); |
|
160 | - $cell=array(); |
|
161 | - foreach($value as $val){ |
|
162 | - $returnVal = translate($field_def['options'],$field_def['module'],$val); |
|
163 | - if(!is_array($returnVal)){ |
|
164 | - array_push( $cell, translate($field_def['options'],$field_def['module'],$val)); |
|
165 | - } |
|
166 | - } |
|
167 | - $cell = implode(", ",$cell); |
|
168 | - } |
|
169 | - return $cell; |
|
170 | - } |
|
171 | - |
|
172 | - public function queryOrderBy($layout_def) { |
|
173 | - $field_def = $this->reporter->all_fields[$layout_def['column_key']]; |
|
174 | - if (!empty ($field_def['sort_on'])) { |
|
175 | - $order_by = $layout_def['table_alias'].".".$field_def['sort_on']; |
|
176 | - } else { |
|
177 | - $order_by = $this->_get_column_select($layout_def); |
|
178 | - } |
|
179 | - $list = array(); |
|
129 | + function & displayListPlain($layout_def) { |
|
130 | + if(!empty($layout_def['column_key'])){ |
|
131 | + $field_def = $this->reporter->all_fields[$layout_def['column_key']]; |
|
132 | + }else if(!empty($layout_def['fields'])){ |
|
133 | + $field_def = $layout_def['fields']; |
|
134 | + } |
|
135 | + |
|
136 | + if (!empty($layout_def['table_key'] ) &&( empty ($field_def['fields']) || empty ($field_def['fields'][0]) || empty ($field_def['fields'][1]))){ |
|
137 | + $value = $this->_get_list_value($layout_def); |
|
138 | + }else if(!empty($layout_def['name']) && !empty($layout_def['fields'])){ |
|
139 | + $key = strtoupper($layout_def['name']); |
|
140 | + $value = $layout_def['fields'][$key]; |
|
141 | + } |
|
142 | + $cell = ''; |
|
143 | + |
|
144 | + if(isset($field_def['options'])){ |
|
145 | + $cell = translate($field_def['options'], $field_def['module'], $value); |
|
146 | + }else if(isset($field_def['type']) && $field_def['type'] == 'enum' && isset($field_def['function'])){ |
|
147 | + global $beanFiles; |
|
148 | + if(empty($beanFiles)) { |
|
149 | + include('include/modules.php'); |
|
150 | + } |
|
151 | + $bean_name = get_singular_bean_name($field_def['module']); |
|
152 | + require_once($beanFiles[$bean_name]); |
|
153 | + $list = $field_def['function'](); |
|
154 | + $cell = $list[$value]; |
|
155 | + } |
|
156 | + if (is_array($cell)) { |
|
157 | + |
|
158 | + //#22632 |
|
159 | + $value = unencodeMultienum($value); |
|
160 | + $cell=array(); |
|
161 | + foreach($value as $val){ |
|
162 | + $returnVal = translate($field_def['options'],$field_def['module'],$val); |
|
163 | + if(!is_array($returnVal)){ |
|
164 | + array_push( $cell, translate($field_def['options'],$field_def['module'],$val)); |
|
165 | + } |
|
166 | + } |
|
167 | + $cell = implode(", ",$cell); |
|
168 | + } |
|
169 | + return $cell; |
|
170 | + } |
|
171 | + |
|
172 | + public function queryOrderBy($layout_def) { |
|
173 | + $field_def = $this->reporter->all_fields[$layout_def['column_key']]; |
|
174 | + if (!empty ($field_def['sort_on'])) { |
|
175 | + $order_by = $layout_def['table_alias'].".".$field_def['sort_on']; |
|
176 | + } else { |
|
177 | + $order_by = $this->_get_column_select($layout_def); |
|
178 | + } |
|
179 | + $list = array(); |
|
180 | 180 | if(isset($field_def['options'])) { |
181 | - $list = translate($field_def['options'], $field_def['module']); |
|
181 | + $list = translate($field_def['options'], $field_def['module']); |
|
182 | 182 | } elseif(isset($field_def['type']) && $field_def['type'] == 'enum' && isset($field_def['function'])) { |
183 | - global $beanFiles; |
|
184 | - if(empty($beanFiles)) { |
|
185 | - include('include/modules.php'); |
|
186 | - } |
|
187 | - $bean_name = get_singular_bean_name($field_def['module']); |
|
188 | - require_once($beanFiles[$bean_name]); |
|
183 | + global $beanFiles; |
|
184 | + if(empty($beanFiles)) { |
|
185 | + include('include/modules.php'); |
|
186 | + } |
|
187 | + $bean_name = get_singular_bean_name($field_def['module']); |
|
188 | + require_once($beanFiles[$bean_name]); |
|
189 | 189 | $list = $field_def['function'](); |
190 | 190 | } |
191 | - if (empty ($layout_def['sort_dir']) || $layout_def['sort_dir'] == 'a') { |
|
192 | - $order_dir = "ASC"; |
|
193 | - } else { |
|
194 | - $order_dir = "DESC"; |
|
195 | - } |
|
196 | - return $this->reporter->db->orderByEnum($order_by, $list, $order_dir); |
|
191 | + if (empty ($layout_def['sort_dir']) || $layout_def['sort_dir'] == 'a') { |
|
192 | + $order_dir = "ASC"; |
|
193 | + } else { |
|
194 | + $order_dir = "DESC"; |
|
195 | + } |
|
196 | + return $this->reporter->db->orderByEnum($order_by, $list, $order_dir); |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | public function displayInput($layout_def) { |
@@ -204,13 +204,13 @@ discard block |
||
204 | 204 | $ops = $layout_def['options']; |
205 | 205 | } |
206 | 206 | elseif (isset($layout_def['options']) && isset($app_list_strings[$layout_def['options']])){ |
207 | - $ops = $app_list_strings[$layout_def['options']]; |
|
207 | + $ops = $app_list_strings[$layout_def['options']]; |
|
208 | 208 | if(array_key_exists('', $app_list_strings[$layout_def['options']])) { |
209 | - unset($ops['']); |
|
210 | - } |
|
209 | + unset($ops['']); |
|
210 | + } |
|
211 | 211 | } |
212 | 212 | else{ |
213 | - $ops = array(); |
|
213 | + $ops = array(); |
|
214 | 214 | } |
215 | 215 | } |
216 | 216 | else { |
@@ -45,33 +45,33 @@ |
||
45 | 45 | |
46 | 46 | class SugarWidgetSubPanelEditRoleButton 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 | - global $app_strings; |
|
53 | + function displayList(&$layout_def) |
|
54 | + { |
|
55 | + global $app_strings; |
|
56 | 56 | global $subpanel_item_count; |
57 | 57 | $unique_id = $layout_def['subpanel_id']."_edit_".$subpanel_item_count; //bug 51512 |
58 | 58 | |
59 | - $href = 'index.php?module=' . $layout_def['module'] |
|
60 | - . '&action=' . 'ContactOpportunityRelationshipEdit' |
|
61 | - . '&record=' . $layout_def['fields']['OPPORTUNITY_ROLE_ID'] |
|
62 | - . '&return_module=' . $_REQUEST['module'] |
|
63 | - . '&return_action=' . 'DetailView' |
|
64 | - . '&return_id=' . $_REQUEST['record']; |
|
59 | + $href = 'index.php?module=' . $layout_def['module'] |
|
60 | + . '&action=' . 'ContactOpportunityRelationshipEdit' |
|
61 | + . '&record=' . $layout_def['fields']['OPPORTUNITY_ROLE_ID'] |
|
62 | + . '&return_module=' . $_REQUEST['module'] |
|
63 | + . '&return_action=' . 'DetailView' |
|
64 | + . '&return_id=' . $_REQUEST['record']; |
|
65 | 65 | |
66 | - //based on listview since that lets you select records |
|
67 | - if($layout_def['ListView']){ |
|
68 | - return '<a href="' . $href . '"' |
|
66 | + //based on listview since that lets you select records |
|
67 | + if($layout_def['ListView']){ |
|
68 | + return '<a href="' . $href . '"' |
|
69 | 69 | . "id=\"$unique_id\"" |
70 | - . 'class="listViewTdToolsS1">' . $app_strings['LNK_EDIT'] .'</a> '; |
|
71 | - }else{ |
|
72 | - return ''; |
|
73 | - } |
|
74 | - } |
|
70 | + . 'class="listViewTdToolsS1">' . $app_strings['LNK_EDIT'] .'</a> '; |
|
71 | + }else{ |
|
72 | + return ''; |
|
73 | + } |
|
74 | + } |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | ?> |
78 | 78 | \ No newline at end of file |
@@ -45,121 +45,121 @@ |
||
45 | 45 | |
46 | 46 | class SugarWidgetSubPanelTopCreateNoteButton 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="Notes"; |
|
54 | - $this->subpanelDiv = "history"; |
|
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="Notes"; |
|
54 | + $this->subpanelDiv = "history"; |
|
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 | - |
|
151 | - return $button; |
|
152 | - } |
|
153 | - |
|
154 | - |
|
155 | - function display($defines, $additionalFormFields = null, $nonbutton = false) |
|
156 | - { |
|
157 | - $focus = new Note; |
|
158 | - if ( !$focus->ACLAccess('EditView') ) { |
|
159 | - return ''; |
|
160 | - } |
|
161 | - |
|
162 | - return parent::display($defines, $additionalFormFields); |
|
163 | - } |
|
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 | + |
|
151 | + return $button; |
|
152 | + } |
|
153 | + |
|
154 | + |
|
155 | + function display($defines, $additionalFormFields = null, $nonbutton = false) |
|
156 | + { |
|
157 | + $focus = new Note; |
|
158 | + if ( !$focus->ACLAccess('EditView') ) { |
|
159 | + return ''; |
|
160 | + } |
|
161 | + |
|
162 | + return parent::display($defines, $additionalFormFields); |
|
163 | + } |
|
164 | 164 | } |
165 | 165 | ?> |
@@ -50,7 +50,7 @@ |
||
50 | 50 | function queryFilterEquals($layout_def) |
51 | 51 | { |
52 | 52 | return $this->reporter->db->convert($this->_get_column_select($layout_def), "text2char"). |
53 | - " = ".$this->reporter->db->quoted($layout_def['input_name0']); |
|
53 | + " = ".$this->reporter->db->quoted($layout_def['input_name0']); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | function queryFilterNot_Equals_Str($layout_def) |
@@ -44,21 +44,21 @@ |
||
44 | 44 | |
45 | 45 | |
46 | 46 | class SugarWidgetSubPanelTopSelectAccountButton extends SugarWidgetSubPanelTopSelectButton { |
47 | - function display($widget_data, $additionalFormFields = NULL, $nonbutton = false) |
|
48 | - { |
|
49 | - /* |
|
47 | + function display($widget_data, $additionalFormFields = NULL, $nonbutton = false) |
|
48 | + { |
|
49 | + /* |
|
50 | 50 | * i.dymovsky |
51 | 51 | * Because when user role can't edit Accounts, it also can't edit Membership Organizations. Select button leads to change MO list |
52 | 52 | * See bug 25633 |
53 | 53 | * Bug25633 code change start |
54 | 54 | */ |
55 | - if (!ACLController::checkAccess($widget_data["module"], "edit", true)) { |
|
56 | - return ; |
|
57 | - } |
|
58 | - /* |
|
55 | + if (!ACLController::checkAccess($widget_data["module"], "edit", true)) { |
|
56 | + return ; |
|
57 | + } |
|
58 | + /* |
|
59 | 59 | * Bug25633 code change end |
60 | 60 | */ |
61 | 61 | |
62 | - return parent::display($widget_data); |
|
63 | - } |
|
62 | + return parent::display($widget_data); |
|
63 | + } |
|
64 | 64 | } |
@@ -43,39 +43,39 @@ discard block |
||
43 | 43 | |
44 | 44 | class SugarWidgetFieldDateTime extends SugarWidgetReportField |
45 | 45 | { |
46 | - var $reporter; |
|
47 | - var $assigned_user=null; |
|
46 | + var $reporter; |
|
47 | + var $assigned_user=null; |
|
48 | 48 | |
49 | 49 | function SugarWidgetFieldDateTime($layout_manager) |
50 | 50 | { |
51 | 51 | parent::SugarWidgetReportField($layout_manager); |
52 | 52 | } |
53 | 53 | |
54 | - // get the reporter attribute |
|
54 | + // get the reporter attribute |
|
55 | 55 | // deprecated, now called in the constructor |
56 | 56 | /** |
57 | 57 | * @deprecated |
58 | 58 | */ |
59 | - function getReporter() { |
|
60 | - } |
|
59 | + function getReporter() { |
|
60 | + } |
|
61 | 61 | |
62 | - // get the assigned user of the report |
|
63 | - function getAssignedUser() |
|
64 | - { |
|
65 | - $json_obj = getJSONobj(); |
|
62 | + // get the assigned user of the report |
|
63 | + function getAssignedUser() |
|
64 | + { |
|
65 | + $json_obj = getJSONobj(); |
|
66 | 66 | |
67 | - $report_def_str = $json_obj->decode($this->reporter->report_def_str); |
|
67 | + $report_def_str = $json_obj->decode($this->reporter->report_def_str); |
|
68 | 68 | |
69 | - if(empty($report_def_str['assigned_user_id'])) return null; |
|
69 | + if(empty($report_def_str['assigned_user_id'])) return null; |
|
70 | 70 | |
71 | - $this->assigned_user = new User(); |
|
72 | - $this->assigned_user->retrieve($report_def_str['assigned_user_id']); |
|
73 | - return $this->assigned_user; |
|
74 | - } |
|
71 | + $this->assigned_user = new User(); |
|
72 | + $this->assigned_user->retrieve($report_def_str['assigned_user_id']); |
|
73 | + return $this->assigned_user; |
|
74 | + } |
|
75 | 75 | |
76 | - function queryFilterOn($layout_def) |
|
77 | - { |
|
78 | - global $timedate; |
|
76 | + function queryFilterOn($layout_def) |
|
77 | + { |
|
78 | + global $timedate; |
|
79 | 79 | $begin = $layout_def['input_name0']; |
80 | 80 | $hasTime = $this->hasTime($begin); |
81 | 81 | $date = $timedate->fromString($begin); |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | '=', |
94 | 94 | "datetime" |
95 | 95 | ); |
96 | - } |
|
96 | + } |
|
97 | 97 | |
98 | 98 | /** |
99 | 99 | * expandDate |
@@ -108,61 +108,61 @@ discard block |
||
108 | 108 | * @param bool $end Boolean value indicating whether or not this is for an end time period or not |
109 | 109 | * @return $date TimeDate object with time value applied |
110 | 110 | */ |
111 | - protected function expandDate($date, $end = false) |
|
112 | - { |
|
113 | - global $timedate; |
|
114 | - if($this->hasTime($date)) { |
|
115 | - return $date; |
|
116 | - } |
|
111 | + protected function expandDate($date, $end = false) |
|
112 | + { |
|
113 | + global $timedate; |
|
114 | + if($this->hasTime($date)) { |
|
115 | + return $date; |
|
116 | + } |
|
117 | 117 | |
118 | 118 | //C.L. Bug 48616 - If the $date is set to the Today macro, then adjust accordingly |
119 | 119 | if(strtolower($date) == 'today') |
120 | 120 | { |
121 | - $startEnd = $timedate->getDayStartEndGMT($timedate->getNow(true)); |
|
122 | - return $end ? $startEnd['end'] : $startEnd['start']; |
|
121 | + $startEnd = $timedate->getDayStartEndGMT($timedate->getNow(true)); |
|
122 | + return $end ? $startEnd['end'] : $startEnd['start']; |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | $parsed = $timedate->fromDbDate($date); |
126 | 126 | $date = $timedate->tzUser(new SugarDateTime()); |
127 | 127 | $date->setDate($parsed->year, $parsed->month, $parsed->day); |
128 | 128 | |
129 | - if($end) { |
|
130 | - return $date->setTime(23, 59, 59); |
|
131 | - } else { |
|
132 | - return $date->setTime(0, 0, 0); |
|
133 | - } |
|
134 | - } |
|
129 | + if($end) { |
|
130 | + return $date->setTime(23, 59, 59); |
|
131 | + } else { |
|
132 | + return $date->setTime(0, 0, 0); |
|
133 | + } |
|
134 | + } |
|
135 | 135 | |
136 | - function queryFilterBefore($layout_def) |
|
137 | - { |
|
136 | + function queryFilterBefore($layout_def) |
|
137 | + { |
|
138 | 138 | $begin = $this->expandDate($layout_def['input_name0']); |
139 | 139 | return $this->queryDateOp($this->_get_column_select($layout_def), $begin, '<', "datetime"); |
140 | - } |
|
140 | + } |
|
141 | 141 | |
142 | - function queryFilterAfter($layout_def) |
|
143 | - { |
|
142 | + function queryFilterAfter($layout_def) |
|
143 | + { |
|
144 | 144 | $begin = $this->expandDate($layout_def['input_name0'], true); |
145 | 145 | return $this->queryDateOp($this->_get_column_select($layout_def), $begin, '>', "datetime"); |
146 | - } |
|
146 | + } |
|
147 | 147 | |
148 | - function queryFilterBetween_Dates($layout_def) |
|
149 | - { |
|
148 | + function queryFilterBetween_Dates($layout_def) |
|
149 | + { |
|
150 | 150 | $begin = $this->expandDate($layout_def['input_name0']); |
151 | - $end = $this->expandDate($layout_def['input_name1'], true); |
|
151 | + $end = $this->expandDate($layout_def['input_name1'], true); |
|
152 | 152 | $column = $this->_get_column_select($layout_def); |
153 | - return "(".$this->queryDateOp($column, $begin, ">=", "datetime")." AND ". |
|
153 | + return "(".$this->queryDateOp($column, $begin, ">=", "datetime")." AND ". |
|
154 | 154 | $this->queryDateOp($column, $end, "<=", "datetime").")\n"; |
155 | - } |
|
155 | + } |
|
156 | 156 | |
157 | - function queryFilterNot_Equals_str($layout_def) |
|
158 | - { |
|
159 | - global $timedate; |
|
157 | + function queryFilterNot_Equals_str($layout_def) |
|
158 | + { |
|
159 | + global $timedate; |
|
160 | 160 | |
161 | 161 | $column = $this->_get_column_select($layout_def); |
162 | 162 | $begin = $layout_def['input_name0']; |
163 | 163 | $hasTime = $this->hasTime($begin); |
164 | 164 | if(!$hasTime){ |
165 | - $end = $this->expandDate($begin, true); |
|
165 | + $end = $this->expandDate($begin, true); |
|
166 | 166 | $begin = $this->expandDate($begin); |
167 | 167 | $cond = $this->queryDateOp($column, $begin, "<", "datetime")." OR ". |
168 | 168 | $this->queryDateOp($column, $end, ">", "datetime"); |
@@ -170,45 +170,45 @@ discard block |
||
170 | 170 | $cond = $this->queryDateOp($column, $begin, "!=", "datetime"); |
171 | 171 | } |
172 | 172 | return "($column IS NULL OR $cond)"; |
173 | - } |
|
173 | + } |
|
174 | 174 | |
175 | 175 | /** |
176 | 176 | * Get assigned or logged in user's current date and time value. |
177 | 177 | * @param boolean $timestamp Format of return value, if set to true, return unix like timestamp , else a formatted date. |
178 | 178 | */ |
179 | - function get_users_current_date_time($timestamp=false) |
|
180 | - { |
|
181 | - global $current_user; |
|
179 | + function get_users_current_date_time($timestamp=false) |
|
180 | + { |
|
181 | + global $current_user; |
|
182 | 182 | global $timedate; |
183 | 183 | |
184 | 184 | $begin = TimeDate::getInstance()->nowDb(); |
185 | 185 | //kbrill bug #13884 |
186 | - //$begin = $timedate->to_display_date_time($begin,true,true,$this->assigned_user); |
|
187 | - $begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), false, $this->assigned_user); |
|
186 | + //$begin = $timedate->to_display_date_time($begin,true,true,$this->assigned_user); |
|
187 | + $begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), false, $this->assigned_user); |
|
188 | 188 | |
189 | 189 | if (!$timestamp) { |
190 | - return $begin; |
|
190 | + return $begin; |
|
191 | 191 | } else { |
192 | - $begin_parts = explode(' ', $begin); |
|
193 | - $date_parts=explode('-', $begin_parts[0]); |
|
194 | - $time_parts=explode(':', $begin_parts[1]); |
|
195 | - $curr_timestamp=mktime($time_parts[0],$time_parts[1],0,$date_parts[1], $date_parts[2],$date_parts[0]); |
|
196 | - return $curr_timestamp; |
|
192 | + $begin_parts = explode(' ', $begin); |
|
193 | + $date_parts=explode('-', $begin_parts[0]); |
|
194 | + $time_parts=explode(':', $begin_parts[1]); |
|
195 | + $curr_timestamp=mktime($time_parts[0],$time_parts[1],0,$date_parts[1], $date_parts[2],$date_parts[0]); |
|
196 | + return $curr_timestamp; |
|
197 | 197 | } |
198 | 198 | |
199 | - } |
|
200 | - /** |
|
201 | - * Get specified date and time for a particalur day, in current user's timezone. |
|
202 | - * @param int $days Adjust date by this number of days, negative values are valid. |
|
203 | - * @param time string falg for desired time value, start: minimum time, end: maximum time, default: current time |
|
204 | - */ |
|
205 | - function get_db_date($days,$time) { |
|
199 | + } |
|
200 | + /** |
|
201 | + * Get specified date and time for a particalur day, in current user's timezone. |
|
202 | + * @param int $days Adjust date by this number of days, negative values are valid. |
|
203 | + * @param time string falg for desired time value, start: minimum time, end: maximum time, default: current time |
|
204 | + */ |
|
205 | + function get_db_date($days,$time) { |
|
206 | 206 | global $timedate; |
207 | 207 | |
208 | 208 | $begin = date($GLOBALS['timedate']->get_db_date_time_format(), time()+(86400 * $days)); //gmt date with day adjustment applied. |
209 | 209 | //kbrill bug #13884 |
210 | 210 | //$begin = $timedate->to_display_date_time($begin,true,true,$this->assigned_user); |
211 | - $begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), false, $this->assigned_user); |
|
211 | + $begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), false, $this->assigned_user); |
|
212 | 212 | |
213 | 213 | if ($time=='start') { |
214 | 214 | $begin_parts = explode(' ', $begin); |
@@ -225,38 +225,38 @@ discard block |
||
225 | 225 | $begin = $timedate->handle_offset($be, $timedate->get_db_date_time_format(), false, $this->assigned_user); |
226 | 226 | |
227 | 227 | return $begin; |
228 | - } |
|
229 | - |
|
230 | - /** |
|
231 | - * Get filter string for a date field. |
|
232 | - * @param array layout_def field def for field being filtered |
|
233 | - * @param string $begin start date value (in DB format) |
|
234 | - * @param string $end End date value (in DB format) |
|
235 | - */ |
|
236 | - function get_start_end_date_filter(& $layout_def, $begin,$end) |
|
237 | - { |
|
238 | - if (isset ($layout_def['rel_field'])) { |
|
239 | - $field_name = $this->reporter->db->convert( |
|
240 | - $this->reporter->db->convert($this->_get_column_select($layout_def), 'date_format', '%Y-%m-%d'), |
|
241 | - "CONCAT", |
|
242 | - array("' '", $this->reporter->db->convert($layout_def['rel_field'], 'time_format')) |
|
243 | - ); |
|
244 | - } else { |
|
245 | - $field_name = $this->_get_column_select($layout_def); |
|
246 | - } |
|
247 | - return $field_name.">=".$this->reporter->db->quoted($begin)." AND ".$field_name."<=".$this->reporter->db->quoted($end)."\n"; |
|
248 | - } |
|
249 | - |
|
250 | - /** |
|
251 | - * Create query for binary operation of field of certain type |
|
252 | - * Produces query like: |
|
253 | - * arg1 op to_date(arg2), e.g.: |
|
254 | - * date_closed < '2009-12-01' |
|
255 | - * @param string $arg1 1st arg - column name |
|
256 | - * @param string|DateTime $arg2 2nd arg - value to be converted |
|
257 | - * @param string $op |
|
258 | - * @param string $type |
|
259 | - */ |
|
228 | + } |
|
229 | + |
|
230 | + /** |
|
231 | + * Get filter string for a date field. |
|
232 | + * @param array layout_def field def for field being filtered |
|
233 | + * @param string $begin start date value (in DB format) |
|
234 | + * @param string $end End date value (in DB format) |
|
235 | + */ |
|
236 | + function get_start_end_date_filter(& $layout_def, $begin,$end) |
|
237 | + { |
|
238 | + if (isset ($layout_def['rel_field'])) { |
|
239 | + $field_name = $this->reporter->db->convert( |
|
240 | + $this->reporter->db->convert($this->_get_column_select($layout_def), 'date_format', '%Y-%m-%d'), |
|
241 | + "CONCAT", |
|
242 | + array("' '", $this->reporter->db->convert($layout_def['rel_field'], 'time_format')) |
|
243 | + ); |
|
244 | + } else { |
|
245 | + $field_name = $this->_get_column_select($layout_def); |
|
246 | + } |
|
247 | + return $field_name.">=".$this->reporter->db->quoted($begin)." AND ".$field_name."<=".$this->reporter->db->quoted($end)."\n"; |
|
248 | + } |
|
249 | + |
|
250 | + /** |
|
251 | + * Create query for binary operation of field of certain type |
|
252 | + * Produces query like: |
|
253 | + * arg1 op to_date(arg2), e.g.: |
|
254 | + * date_closed < '2009-12-01' |
|
255 | + * @param string $arg1 1st arg - column name |
|
256 | + * @param string|DateTime $arg2 2nd arg - value to be converted |
|
257 | + * @param string $op |
|
258 | + * @param string $type |
|
259 | + */ |
|
260 | 260 | protected function queryDateOp($arg1, $arg2, $op, $type) |
261 | 261 | { |
262 | 262 | global $timedate; |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | return $timedate->tzUser($timedate->getNow(), $this->getAssignedUser()); |
277 | 277 | } |
278 | 278 | |
279 | - /** |
|
279 | + /** |
|
280 | 280 | * Create query from the beginning to the end of certain day |
281 | 281 | * @param array $layout_def |
282 | 282 | * @param SugarDateTime $day |
@@ -288,43 +288,43 @@ discard block |
||
288 | 288 | return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb()); |
289 | 289 | } |
290 | 290 | |
291 | - function queryFilterTP_yesterday($layout_def) |
|
292 | - { |
|
293 | - global $timedate; |
|
294 | - return $this->queryDay($layout_def, $this->now()->get("-1 day")); |
|
295 | - } |
|
291 | + function queryFilterTP_yesterday($layout_def) |
|
292 | + { |
|
293 | + global $timedate; |
|
294 | + return $this->queryDay($layout_def, $this->now()->get("-1 day")); |
|
295 | + } |
|
296 | 296 | |
297 | - function queryFilterTP_today($layout_def) |
|
298 | - { |
|
299 | - global $timedate; |
|
300 | - return $this->queryDay($layout_def, $this->now()); |
|
301 | - } |
|
297 | + function queryFilterTP_today($layout_def) |
|
298 | + { |
|
299 | + global $timedate; |
|
300 | + return $this->queryDay($layout_def, $this->now()); |
|
301 | + } |
|
302 | 302 | |
303 | - function queryFilterTP_tomorrow(& $layout_def) |
|
304 | - { |
|
305 | - global $timedate; |
|
306 | - return $this->queryDay($layout_def, $this->now()->get("+1 day")); |
|
307 | - } |
|
303 | + function queryFilterTP_tomorrow(& $layout_def) |
|
304 | + { |
|
305 | + global $timedate; |
|
306 | + return $this->queryDay($layout_def, $this->now()->get("+1 day")); |
|
307 | + } |
|
308 | 308 | |
309 | - function queryFilterTP_last_7_days($layout_def) |
|
310 | - { |
|
311 | - global $timedate; |
|
309 | + function queryFilterTP_last_7_days($layout_def) |
|
310 | + { |
|
311 | + global $timedate; |
|
312 | 312 | |
313 | - $begin = $this->now()->get("-6 days")->get_day_begin(); |
|
314 | - $end = $this->now()->get_day_end(); |
|
313 | + $begin = $this->now()->get("-6 days")->get_day_begin(); |
|
314 | + $end = $this->now()->get_day_end(); |
|
315 | 315 | |
316 | - return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb()); |
|
317 | - } |
|
316 | + return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb()); |
|
317 | + } |
|
318 | 318 | |
319 | - function queryFilterTP_next_7_days($layout_def) |
|
320 | - { |
|
321 | - global $timedate; |
|
319 | + function queryFilterTP_next_7_days($layout_def) |
|
320 | + { |
|
321 | + global $timedate; |
|
322 | 322 | |
323 | - $begin = $this->now()->get_day_begin(); |
|
324 | - $end = $this->now()->get("+6 days")->get_day_end(); |
|
323 | + $begin = $this->now()->get_day_begin(); |
|
324 | + $end = $this->now()->get("+6 days")->get_day_end(); |
|
325 | 325 | |
326 | - return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb()); |
|
327 | - } |
|
326 | + return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb()); |
|
327 | + } |
|
328 | 328 | |
329 | 329 | /** |
330 | 330 | * Create query from the beginning to the end of certain month |
@@ -335,20 +335,20 @@ discard block |
||
335 | 335 | { |
336 | 336 | $begin = $month->setTime(0, 0, 0); |
337 | 337 | $end = clone($begin); |
338 | - $end->setDate($begin->year, $begin->month, $begin->days_in_month)->setTime(23, 59, 59); |
|
338 | + $end->setDate($begin->year, $begin->month, $begin->days_in_month)->setTime(23, 59, 59); |
|
339 | 339 | return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb()); |
340 | 340 | } |
341 | 341 | |
342 | 342 | function queryFilterTP_last_month($layout_def) |
343 | - { |
|
344 | - global $timedate; |
|
345 | - $month = $this->now(); |
|
346 | - return $this->queryMonth($layout_def, $month->setDate($month->year, $month->month-1, 1)); |
|
347 | - } |
|
343 | + { |
|
344 | + global $timedate; |
|
345 | + $month = $this->now(); |
|
346 | + return $this->queryMonth($layout_def, $month->setDate($month->year, $month->month-1, 1)); |
|
347 | + } |
|
348 | 348 | |
349 | - function queryFilterTP_this_month($layout_def) |
|
350 | - { |
|
351 | - global $timedate; |
|
349 | + function queryFilterTP_this_month($layout_def) |
|
350 | + { |
|
351 | + global $timedate; |
|
352 | 352 | |
353 | 353 | //Bug 62414 - take timezone into account when determining current month |
354 | 354 | $now = $this->now(); |
@@ -357,30 +357,30 @@ discard block |
||
357 | 357 | $now->modify($timezoneOffset); |
358 | 358 | |
359 | 359 | return $this->queryMonth($layout_def, $now->get_day_by_index_this_month(0)); |
360 | - } |
|
361 | - |
|
362 | - function queryFilterTP_next_month($layout_def) |
|
363 | - { |
|
364 | - global $timedate; |
|
365 | - $month = $this->now(); |
|
366 | - return $this->queryMonth($layout_def, $month->setDate($month->year, $month->month+1, 1)); |
|
367 | - } |
|
368 | - |
|
369 | - function queryFilterTP_last_30_days($layout_def) |
|
370 | - { |
|
371 | - global $timedate; |
|
372 | - $begin = $this->now()->get("-29 days")->get_day_begin(); |
|
373 | - $end = $this->now()->get_day_end(); |
|
374 | - return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb()); |
|
375 | - } |
|
376 | - |
|
377 | - function queryFilterTP_next_30_days($layout_def) |
|
378 | - { |
|
379 | - global $timedate; |
|
380 | - $begin = $this->now()->get_day_begin(); |
|
381 | - $end = $this->now()->get("+29 days")->get_day_end(); |
|
382 | - return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb()); |
|
383 | - } |
|
360 | + } |
|
361 | + |
|
362 | + function queryFilterTP_next_month($layout_def) |
|
363 | + { |
|
364 | + global $timedate; |
|
365 | + $month = $this->now(); |
|
366 | + return $this->queryMonth($layout_def, $month->setDate($month->year, $month->month+1, 1)); |
|
367 | + } |
|
368 | + |
|
369 | + function queryFilterTP_last_30_days($layout_def) |
|
370 | + { |
|
371 | + global $timedate; |
|
372 | + $begin = $this->now()->get("-29 days")->get_day_begin(); |
|
373 | + $end = $this->now()->get_day_end(); |
|
374 | + return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb()); |
|
375 | + } |
|
376 | + |
|
377 | + function queryFilterTP_next_30_days($layout_def) |
|
378 | + { |
|
379 | + global $timedate; |
|
380 | + $begin = $this->now()->get_day_begin(); |
|
381 | + $end = $this->now()->get("+29 days")->get_day_end(); |
|
382 | + return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb()); |
|
383 | + } |
|
384 | 384 | |
385 | 385 | /** |
386 | 386 | * Return the between WHERE query for Quarter filter |
@@ -453,59 +453,59 @@ discard block |
||
453 | 453 | return $this->getQuarterFilter($layout_def, '+3 month'); |
454 | 454 | } |
455 | 455 | |
456 | - function queryFilterTP_last_year($layout_def) |
|
457 | - { |
|
458 | - global $timedate; |
|
459 | - $begin = $this->now(); |
|
460 | - $begin->setDate($begin->year-1, 1, 1)->setTime(0, 0); |
|
461 | - $end = clone $begin; |
|
462 | - $end->setDate($end->year, 12, 31)->setTime(23, 59, 59); |
|
463 | - return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb()); |
|
464 | - } |
|
465 | - |
|
466 | - function queryFilterTP_this_year($layout_def) |
|
467 | - { |
|
468 | - global $timedate; |
|
469 | - $begin = $this->now(); |
|
470 | - $begin->setDate($begin->year, 1, 1)->setTime(0, 0); |
|
471 | - $end = clone $begin; |
|
472 | - $end->setDate($end->year, 12, 31)->setTime(23, 59, 59); |
|
473 | - return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb()); |
|
474 | - } |
|
475 | - |
|
476 | - function queryFilterTP_next_year(& $layout_def) |
|
477 | - { |
|
478 | - global $timedate; |
|
479 | - $begin = $this->now(); |
|
480 | - $begin->setDate($begin->year+1, 1, 1)->setTime(0, 0); |
|
481 | - $end = clone $begin; |
|
482 | - $end->setDate($end->year, 12, 31)->setTime(23, 59, 59); |
|
483 | - return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb()); |
|
484 | - } |
|
485 | - |
|
486 | - function queryGroupBy($layout_def) |
|
487 | - { |
|
488 | - // i guess qualifier and column_function are the same.. |
|
489 | - if (!empty ($layout_def['qualifier'])) { |
|
490 | - $func_name = 'queryGroupBy'.$layout_def['qualifier']; |
|
491 | - if (method_exists($this, $func_name)) { |
|
492 | - return $this-> $func_name ($layout_def)." \n"; |
|
493 | - } |
|
494 | - } |
|
495 | - return parent :: queryGroupBy($layout_def)." \n"; |
|
496 | - } |
|
497 | - |
|
498 | - function queryOrderBy($layout_def) |
|
499 | - { |
|
456 | + function queryFilterTP_last_year($layout_def) |
|
457 | + { |
|
458 | + global $timedate; |
|
459 | + $begin = $this->now(); |
|
460 | + $begin->setDate($begin->year-1, 1, 1)->setTime(0, 0); |
|
461 | + $end = clone $begin; |
|
462 | + $end->setDate($end->year, 12, 31)->setTime(23, 59, 59); |
|
463 | + return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb()); |
|
464 | + } |
|
465 | + |
|
466 | + function queryFilterTP_this_year($layout_def) |
|
467 | + { |
|
468 | + global $timedate; |
|
469 | + $begin = $this->now(); |
|
470 | + $begin->setDate($begin->year, 1, 1)->setTime(0, 0); |
|
471 | + $end = clone $begin; |
|
472 | + $end->setDate($end->year, 12, 31)->setTime(23, 59, 59); |
|
473 | + return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb()); |
|
474 | + } |
|
475 | + |
|
476 | + function queryFilterTP_next_year(& $layout_def) |
|
477 | + { |
|
478 | + global $timedate; |
|
479 | + $begin = $this->now(); |
|
480 | + $begin->setDate($begin->year+1, 1, 1)->setTime(0, 0); |
|
481 | + $end = clone $begin; |
|
482 | + $end->setDate($end->year, 12, 31)->setTime(23, 59, 59); |
|
483 | + return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb()); |
|
484 | + } |
|
485 | + |
|
486 | + function queryGroupBy($layout_def) |
|
487 | + { |
|
488 | + // i guess qualifier and column_function are the same.. |
|
500 | 489 | if (!empty ($layout_def['qualifier'])) { |
501 | - $func_name ='queryOrderBy'.$layout_def['qualifier']; |
|
502 | - if (method_exists($this, $func_name)) { |
|
503 | - return $this-> $func_name ($layout_def)."\n"; |
|
504 | - } |
|
505 | - } |
|
506 | - $order_by = parent :: queryOrderBy($layout_def)."\n"; |
|
507 | - return $order_by; |
|
508 | - } |
|
490 | + $func_name = 'queryGroupBy'.$layout_def['qualifier']; |
|
491 | + if (method_exists($this, $func_name)) { |
|
492 | + return $this-> $func_name ($layout_def)." \n"; |
|
493 | + } |
|
494 | + } |
|
495 | + return parent :: queryGroupBy($layout_def)." \n"; |
|
496 | + } |
|
497 | + |
|
498 | + function queryOrderBy($layout_def) |
|
499 | + { |
|
500 | + if (!empty ($layout_def['qualifier'])) { |
|
501 | + $func_name ='queryOrderBy'.$layout_def['qualifier']; |
|
502 | + if (method_exists($this, $func_name)) { |
|
503 | + return $this-> $func_name ($layout_def)."\n"; |
|
504 | + } |
|
505 | + } |
|
506 | + $order_by = parent :: queryOrderBy($layout_def)."\n"; |
|
507 | + return $order_by; |
|
508 | + } |
|
509 | 509 | |
510 | 510 | function displayListPlain($layout_def) { |
511 | 511 | global $timedate; |
@@ -551,39 +551,39 @@ discard block |
||
551 | 551 | return $timedate->to_display_date_time($content); |
552 | 552 | } |
553 | 553 | |
554 | - function querySelect(& $layout_def) { |
|
555 | - // i guess qualifier and column_function are the same.. |
|
556 | - if (!empty ($layout_def['column_function'])) { |
|
557 | - $func_name = 'querySelect'.$layout_def['column_function']; |
|
558 | - if (method_exists($this, $func_name)) { |
|
559 | - return $this-> $func_name ($layout_def)." \n"; |
|
560 | - } |
|
561 | - } |
|
562 | - return parent :: querySelect($layout_def)." \n"; |
|
563 | - } |
|
564 | - function & displayListday(& $layout_def) { |
|
554 | + function querySelect(& $layout_def) { |
|
555 | + // i guess qualifier and column_function are the same.. |
|
556 | + if (!empty ($layout_def['column_function'])) { |
|
557 | + $func_name = 'querySelect'.$layout_def['column_function']; |
|
558 | + if (method_exists($this, $func_name)) { |
|
559 | + return $this-> $func_name ($layout_def)." \n"; |
|
560 | + } |
|
561 | + } |
|
562 | + return parent :: querySelect($layout_def)." \n"; |
|
563 | + } |
|
564 | + function & displayListday(& $layout_def) { |
|
565 | 565 | $value = parent:: displayListPlain($layout_def); |
566 | 566 | return $value; |
567 | - } |
|
568 | - |
|
569 | - function & displayListyear(& $layout_def) { |
|
570 | - global $app_list_strings; |
|
571 | - $value = parent:: displayListPlain($layout_def); |
|
572 | - return $value; |
|
573 | - } |
|
574 | - |
|
575 | - function displayListmonth($layout_def) |
|
576 | - { |
|
577 | - global $app_list_strings; |
|
578 | - $display = ''; |
|
579 | - $match = array(); |
|
567 | + } |
|
568 | + |
|
569 | + function & displayListyear(& $layout_def) { |
|
570 | + global $app_list_strings; |
|
571 | + $value = parent:: displayListPlain($layout_def); |
|
572 | + return $value; |
|
573 | + } |
|
574 | + |
|
575 | + function displayListmonth($layout_def) |
|
576 | + { |
|
577 | + global $app_list_strings; |
|
578 | + $display = ''; |
|
579 | + $match = array(); |
|
580 | 580 | if (preg_match('/(\d{4})-(\d\d)/', $this->displayListPlain($layout_def), $match)) { |
581 | - $match[2] = preg_replace('/^0/', '', $match[2]); |
|
582 | - $display = $app_list_strings['dom_cal_month_long'][$match[2]]." {$match[1]}"; |
|
583 | - } |
|
584 | - return $display; |
|
581 | + $match[2] = preg_replace('/^0/', '', $match[2]); |
|
582 | + $display = $app_list_strings['dom_cal_month_long'][$match[2]]." {$match[1]}"; |
|
583 | + } |
|
584 | + return $display; |
|
585 | 585 | |
586 | - } |
|
586 | + } |
|
587 | 587 | |
588 | 588 | /** |
589 | 589 | * Returns part of query for select |
@@ -706,32 +706,32 @@ discard block |
||
706 | 706 | return $this->reporter->db->convert($return, "date_format", array('%Y')) . "\n"; |
707 | 707 | } |
708 | 708 | |
709 | - function querySelectquarter($layout_def) |
|
710 | - { |
|
711 | - $column = $this->_get_column_select($layout_def); |
|
712 | - return $this->reporter->db->convert($this->reporter->db->convert($column, "date_format", array('%Y')), |
|
713 | - 'CONCAT', |
|
714 | - array("'-'", $this->reporter->db->convert($column, "quarter"))) |
|
715 | - ." ".$this->_get_column_alias($layout_def)."\n"; |
|
716 | - } |
|
709 | + function querySelectquarter($layout_def) |
|
710 | + { |
|
711 | + $column = $this->_get_column_select($layout_def); |
|
712 | + return $this->reporter->db->convert($this->reporter->db->convert($column, "date_format", array('%Y')), |
|
713 | + 'CONCAT', |
|
714 | + array("'-'", $this->reporter->db->convert($column, "quarter"))) |
|
715 | + ." ".$this->_get_column_alias($layout_def)."\n"; |
|
716 | + } |
|
717 | 717 | |
718 | - function displayListquarter(& $layout_def) { |
|
719 | - $match = array(); |
|
718 | + function displayListquarter(& $layout_def) { |
|
719 | + $match = array(); |
|
720 | 720 | if (preg_match('/(\d{4})-(\d)/', $this->displayListPlain($layout_def), $match)) { |
721 | - return "Q".$match[2]." ".$match[1]; |
|
722 | - } |
|
723 | - return ''; |
|
721 | + return "Q".$match[2]." ".$match[1]; |
|
722 | + } |
|
723 | + return ''; |
|
724 | 724 | |
725 | - } |
|
725 | + } |
|
726 | 726 | |
727 | - function queryGroupByQuarter($layout_def) |
|
728 | - { |
|
729 | - $this->getReporter(); |
|
727 | + function queryGroupByQuarter($layout_def) |
|
728 | + { |
|
729 | + $this->getReporter(); |
|
730 | 730 | $column = $this->_get_column_select($layout_def); |
731 | - return $this->reporter->db->convert($this->reporter->db->convert($column, "date_format", array('%Y')), |
|
732 | - 'CONCAT', |
|
733 | - array("'-'", $this->reporter->db->convert($column, "quarter"))); |
|
734 | - } |
|
731 | + return $this->reporter->db->convert($this->reporter->db->convert($column, "date_format", array('%Y')), |
|
732 | + 'CONCAT', |
|
733 | + array("'-'", $this->reporter->db->convert($column, "quarter"))); |
|
734 | + } |
|
735 | 735 | |
736 | 736 | /** |
737 | 737 | * For oracle we have to return order by string like group by string instead of return field alias |
@@ -760,23 +760,23 @@ discard block |
||
760 | 760 | } |
761 | 761 | |
762 | 762 | function displayInput(&$layout_def) { |
763 | - global $timedate, $current_language, $app_strings; |
|
763 | + global $timedate, $current_language, $app_strings; |
|
764 | 764 | $home_mod_strings = return_module_language($current_language, 'Home'); |
765 | 765 | $filterTypes = array(' ' => $app_strings['LBL_NONE'], |
766 | - 'TP_today' => $home_mod_strings['LBL_TODAY'], |
|
767 | - 'TP_yesterday' => $home_mod_strings['LBL_YESTERDAY'], |
|
768 | - 'TP_tomorrow' => $home_mod_strings['LBL_TOMORROW'], |
|
769 | - 'TP_this_month' => $home_mod_strings['LBL_THIS_MONTH'], |
|
770 | - 'TP_this_year' => $home_mod_strings['LBL_THIS_YEAR'], |
|
771 | - 'TP_last_30_days' => $home_mod_strings['LBL_LAST_30_DAYS'], |
|
772 | - 'TP_last_7_days' => $home_mod_strings['LBL_LAST_7_DAYS'], |
|
773 | - 'TP_last_month' => $home_mod_strings['LBL_LAST_MONTH'], |
|
774 | - 'TP_last_year' => $home_mod_strings['LBL_LAST_YEAR'], |
|
775 | - 'TP_next_30_days' => $home_mod_strings['LBL_NEXT_30_DAYS'], |
|
776 | - 'TP_next_7_days' => $home_mod_strings['LBL_NEXT_7_DAYS'], |
|
777 | - 'TP_next_month' => $home_mod_strings['LBL_NEXT_MONTH'], |
|
778 | - 'TP_next_year' => $home_mod_strings['LBL_NEXT_YEAR'], |
|
779 | - ); |
|
766 | + 'TP_today' => $home_mod_strings['LBL_TODAY'], |
|
767 | + 'TP_yesterday' => $home_mod_strings['LBL_YESTERDAY'], |
|
768 | + 'TP_tomorrow' => $home_mod_strings['LBL_TOMORROW'], |
|
769 | + 'TP_this_month' => $home_mod_strings['LBL_THIS_MONTH'], |
|
770 | + 'TP_this_year' => $home_mod_strings['LBL_THIS_YEAR'], |
|
771 | + 'TP_last_30_days' => $home_mod_strings['LBL_LAST_30_DAYS'], |
|
772 | + 'TP_last_7_days' => $home_mod_strings['LBL_LAST_7_DAYS'], |
|
773 | + 'TP_last_month' => $home_mod_strings['LBL_LAST_MONTH'], |
|
774 | + 'TP_last_year' => $home_mod_strings['LBL_LAST_YEAR'], |
|
775 | + 'TP_next_30_days' => $home_mod_strings['LBL_NEXT_30_DAYS'], |
|
776 | + 'TP_next_7_days' => $home_mod_strings['LBL_NEXT_7_DAYS'], |
|
777 | + 'TP_next_month' => $home_mod_strings['LBL_NEXT_MONTH'], |
|
778 | + 'TP_next_year' => $home_mod_strings['LBL_NEXT_YEAR'], |
|
779 | + ); |
|
780 | 780 | |
781 | 781 | $cal_dateformat = $timedate->get_cal_date_format(); |
782 | 782 | $str = "<select name='type_{$layout_def['name']}'>"; |