@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | |
131 | 131 | // matches all valid variables (no quotes, no modifiers) |
132 | 132 | $this->_avar_regexp = '(?:' . $this->_dvar_regexp . '|' |
133 | - . $this->_cvar_regexp . '|' . $this->_svar_regexp . ')'; |
|
133 | + . $this->_cvar_regexp . '|' . $this->_svar_regexp . ')'; |
|
134 | 134 | |
135 | 135 | // matches valid variable syntax: |
136 | 136 | // $foo |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | // |foo|bar |
173 | 173 | // |foo:$foo->bar |
174 | 174 | $this->_mod_regexp = '(?:\|@?\w+(?::(?:\w+|' . $this->_num_const_regexp . '|' |
175 | - . $this->_obj_call_regexp . '|' . $this->_avar_regexp . '|' . $this->_qstr_regexp .'))*)'; |
|
175 | + . $this->_obj_call_regexp . '|' . $this->_avar_regexp . '|' . $this->_qstr_regexp .'))*)'; |
|
176 | 176 | |
177 | 177 | // matches valid function name: |
178 | 178 | // foo123 |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | // "text"|bar |
194 | 194 | // $foo->bar |
195 | 195 | $this->_param_regexp = '(?:\s*(?:' . $this->_obj_call_regexp . '|' |
196 | - . $this->_var_regexp . '|' . $this->_num_const_regexp . '|\w+)(?>' . $this->_mod_regexp . '*)\s*)'; |
|
196 | + . $this->_var_regexp . '|' . $this->_num_const_regexp . '|\w+)(?>' . $this->_mod_regexp . '*)\s*)'; |
|
197 | 197 | |
198 | 198 | // matches valid parenthesised function parameters: |
199 | 199 | // |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | // _foo_bar($foo,"bar") |
211 | 211 | // foo123($foo,$foo->bar(),"foo") |
212 | 212 | $this->_func_call_regexp = '(?:' . $this->_func_regexp . '\s*(?:' |
213 | - . $this->_parenth_param_regexp . '))'; |
|
213 | + . $this->_parenth_param_regexp . '))'; |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | /** |
@@ -263,11 +263,11 @@ discard block |
||
263 | 263 | |
264 | 264 | /* replace special blocks by "{php}" */ |
265 | 265 | $source_content = preg_replace_callback($search, create_function ('$matches', "return '" |
266 | - . $this->_quote_replace($this->left_delimiter) . 'php' |
|
267 | - . "' . str_repeat(\"\n\", substr_count('\$matches[1]', \"\n\")) .'" |
|
268 | - . $this->_quote_replace($this->right_delimiter) |
|
269 | - . "';") |
|
270 | - , $source_content); |
|
266 | + . $this->_quote_replace($this->left_delimiter) . 'php' |
|
267 | + . "' . str_repeat(\"\n\", substr_count('\$matches[1]', \"\n\")) .'" |
|
268 | + . $this->_quote_replace($this->right_delimiter) |
|
269 | + . "';") |
|
270 | + , $source_content); |
|
271 | 271 | |
272 | 272 | /* Gather all template tags. */ |
273 | 273 | preg_match_all("~{$ldq}\s*(.*?)\s*{$rdq}~s", $source_content, $_match); |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | if ($postfilter === false) continue; |
389 | 389 | if ($postfilter[3] || is_callable($postfilter[0])) { |
390 | 390 | $compiled_content = call_user_func_array($postfilter[0], |
391 | - array($compiled_content, &$this)); |
|
391 | + array($compiled_content, &$this)); |
|
392 | 392 | $this->_plugins['postfilter'][$filter_name][3] = true; |
393 | 393 | } else { |
394 | 394 | $this->_trigger_fatal_error("Smarty plugin error: postfilter '$filter_name' is not implemented"); |
@@ -649,8 +649,8 @@ discard block |
||
649 | 649 | $output = call_user_func_array($plugin_func, array($tag_args, &$this)); |
650 | 650 | if($output != '') { |
651 | 651 | $output = '<?php ' . $this->_push_cacheable_state('compiler', $tag_command) |
652 | - . $output |
|
653 | - . $this->_pop_cacheable_state('compiler', $tag_command) . ' ?>'; |
|
652 | + . $output |
|
653 | + . $this->_pop_cacheable_state('compiler', $tag_command) . ' ?>'; |
|
654 | 654 | } |
655 | 655 | } else { |
656 | 656 | $this->_syntax_error($message, E_USER_WARNING, __FILE__, __LINE__); |
@@ -1115,7 +1115,7 @@ discard block |
||
1115 | 1115 | $output .= "{$section_props}['max'] = {$section_props}['loop'];\n"; |
1116 | 1116 | else |
1117 | 1117 | $output .= "if ({$section_props}['max'] < 0)\n" . |
1118 | - " {$section_props}['max'] = {$section_props}['loop'];\n"; |
|
1118 | + " {$section_props}['max'] = {$section_props}['loop'];\n"; |
|
1119 | 1119 | |
1120 | 1120 | if (!isset($attrs['step'])) |
1121 | 1121 | $output .= "{$section_props}['step'] = 1;\n"; |
@@ -1124,9 +1124,9 @@ discard block |
||
1124 | 1124 | $output .= "{$section_props}['start'] = {$section_props}['step'] > 0 ? 0 : {$section_props}['loop']-1;\n"; |
1125 | 1125 | else { |
1126 | 1126 | $output .= "if ({$section_props}['start'] < 0)\n" . |
1127 | - " {$section_props}['start'] = max({$section_props}['step'] > 0 ? 0 : -1, {$section_props}['loop'] + {$section_props}['start']);\n" . |
|
1128 | - "else\n" . |
|
1129 | - " {$section_props}['start'] = min({$section_props}['start'], {$section_props}['step'] > 0 ? {$section_props}['loop'] : {$section_props}['loop']-1);\n"; |
|
1127 | + " {$section_props}['start'] = max({$section_props}['step'] > 0 ? 0 : -1, {$section_props}['loop'] + {$section_props}['start']);\n" . |
|
1128 | + "else\n" . |
|
1129 | + " {$section_props}['start'] = min({$section_props}['start'], {$section_props}['step'] > 0 ? {$section_props}['loop'] : {$section_props}['loop']-1);\n"; |
|
1130 | 1130 | } |
1131 | 1131 | |
1132 | 1132 | $output .= "if ({$section_props}['show']) {\n"; |
@@ -1136,9 +1136,9 @@ discard block |
||
1136 | 1136 | $output .= " {$section_props}['total'] = min(ceil(({$section_props}['step'] > 0 ? {$section_props}['loop'] - {$section_props}['start'] : {$section_props}['start']+1)/abs({$section_props}['step'])), {$section_props}['max']);\n"; |
1137 | 1137 | } |
1138 | 1138 | $output .= " if ({$section_props}['total'] == 0)\n" . |
1139 | - " {$section_props}['show'] = false;\n" . |
|
1140 | - "} else\n" . |
|
1141 | - " {$section_props}['total'] = 0;\n"; |
|
1139 | + " {$section_props}['show'] = false;\n" . |
|
1140 | + "} else\n" . |
|
1141 | + " {$section_props}['total'] = 0;\n"; |
|
1142 | 1142 | |
1143 | 1143 | $output .= "if ({$section_props}['show']):\n"; |
1144 | 1144 | $output .= " |
@@ -1987,8 +1987,8 @@ discard block |
||
1987 | 1987 | } |
1988 | 1988 | if (!isset($this->_plugin_info[$type][$name])) { |
1989 | 1989 | $this->_plugin_info[$type][$name] = array($this->_current_file, |
1990 | - $this->_current_line_no, |
|
1991 | - $delayed_loading); |
|
1990 | + $this->_current_line_no, |
|
1991 | + $delayed_loading); |
|
1992 | 1992 | } |
1993 | 1993 | } |
1994 | 1994 | |
@@ -2056,7 +2056,7 @@ discard block |
||
2056 | 2056 | case 'get': |
2057 | 2057 | if ($this->security && !$this->security_settings['ALLOW_SUPER_GLOBALS']) { |
2058 | 2058 | $this->_syntax_error("(secure mode) super global access not permitted", |
2059 | - E_USER_WARNING, __FILE__, __LINE__); |
|
2059 | + E_USER_WARNING, __FILE__, __LINE__); |
|
2060 | 2060 | return; |
2061 | 2061 | } |
2062 | 2062 | $compiled_ref = "\$_GET"; |
@@ -2065,7 +2065,7 @@ discard block |
||
2065 | 2065 | case 'post': |
2066 | 2066 | if ($this->security && !$this->security_settings['ALLOW_SUPER_GLOBALS']) { |
2067 | 2067 | $this->_syntax_error("(secure mode) super global access not permitted", |
2068 | - E_USER_WARNING, __FILE__, __LINE__); |
|
2068 | + E_USER_WARNING, __FILE__, __LINE__); |
|
2069 | 2069 | return; |
2070 | 2070 | } |
2071 | 2071 | $compiled_ref = "\$_POST"; |
@@ -2074,7 +2074,7 @@ discard block |
||
2074 | 2074 | case 'cookies': |
2075 | 2075 | if ($this->security && !$this->security_settings['ALLOW_SUPER_GLOBALS']) { |
2076 | 2076 | $this->_syntax_error("(secure mode) super global access not permitted", |
2077 | - E_USER_WARNING, __FILE__, __LINE__); |
|
2077 | + E_USER_WARNING, __FILE__, __LINE__); |
|
2078 | 2078 | return; |
2079 | 2079 | } |
2080 | 2080 | $compiled_ref = "\$_COOKIE"; |
@@ -2083,7 +2083,7 @@ discard block |
||
2083 | 2083 | case 'env': |
2084 | 2084 | if ($this->security && !$this->security_settings['ALLOW_SUPER_GLOBALS']) { |
2085 | 2085 | $this->_syntax_error("(secure mode) super global access not permitted", |
2086 | - E_USER_WARNING, __FILE__, __LINE__); |
|
2086 | + E_USER_WARNING, __FILE__, __LINE__); |
|
2087 | 2087 | return; |
2088 | 2088 | } |
2089 | 2089 | $compiled_ref = "\$_ENV"; |
@@ -2092,7 +2092,7 @@ discard block |
||
2092 | 2092 | case 'server': |
2093 | 2093 | if ($this->security && !$this->security_settings['ALLOW_SUPER_GLOBALS']) { |
2094 | 2094 | $this->_syntax_error("(secure mode) super global access not permitted", |
2095 | - E_USER_WARNING, __FILE__, __LINE__); |
|
2095 | + E_USER_WARNING, __FILE__, __LINE__); |
|
2096 | 2096 | return; |
2097 | 2097 | } |
2098 | 2098 | $compiled_ref = "\$_SERVER"; |
@@ -2101,7 +2101,7 @@ discard block |
||
2101 | 2101 | case 'session': |
2102 | 2102 | if ($this->security && !$this->security_settings['ALLOW_SUPER_GLOBALS']) { |
2103 | 2103 | $this->_syntax_error("(secure mode) super global access not permitted", |
2104 | - E_USER_WARNING, __FILE__, __LINE__); |
|
2104 | + E_USER_WARNING, __FILE__, __LINE__); |
|
2105 | 2105 | return; |
2106 | 2106 | } |
2107 | 2107 | $compiled_ref = "\$_SESSION"; |
@@ -2114,7 +2114,7 @@ discard block |
||
2114 | 2114 | case 'request': |
2115 | 2115 | if ($this->security && !$this->security_settings['ALLOW_SUPER_GLOBALS']) { |
2116 | 2116 | $this->_syntax_error("(secure mode) super global access not permitted", |
2117 | - E_USER_WARNING, __FILE__, __LINE__); |
|
2117 | + E_USER_WARNING, __FILE__, __LINE__); |
|
2118 | 2118 | return; |
2119 | 2119 | } |
2120 | 2120 | if ($this->request_use_auto_globals) { |
@@ -2141,7 +2141,7 @@ discard block |
||
2141 | 2141 | case 'const': |
2142 | 2142 | if ($this->security && !$this->security_settings['ALLOW_CONSTANTS']) { |
2143 | 2143 | $this->_syntax_error("(secure mode) constants not permitted", |
2144 | - E_USER_WARNING, __FILE__, __LINE__); |
|
2144 | + E_USER_WARNING, __FILE__, __LINE__); |
|
2145 | 2145 | return; |
2146 | 2146 | } |
2147 | 2147 | array_shift($indexes); |
@@ -2197,7 +2197,7 @@ discard block |
||
2197 | 2197 | return ((is_object($this->_plugins[$type][$name][0][0])) ? |
2198 | 2198 | "\$this->_plugins['$type']['$name'][0][0]->" /* method callback */ |
2199 | 2199 | : (string)($this->_plugins[$type][$name][0][0]).'::' /* class callback */ |
2200 | - ). $this->_plugins[$type][$name][0][1]; |
|
2200 | + ). $this->_plugins[$type][$name][0][1]; |
|
2201 | 2201 | |
2202 | 2202 | } else { |
2203 | 2203 | /* function callback */ |
@@ -2342,7 +2342,7 @@ discard block |
||
2342 | 2342 | $message = " expected {/$_open_tag} (opened line $_line_no)."; |
2343 | 2343 | } |
2344 | 2344 | $this->_syntax_error("mismatched tag {/$close_tag}.$message", |
2345 | - E_USER_ERROR, __FILE__, __LINE__); |
|
2345 | + E_USER_ERROR, __FILE__, __LINE__); |
|
2346 | 2346 | } |
2347 | 2347 | |
2348 | 2348 | } |
@@ -102,9 +102,9 @@ |
||
102 | 102 | |
103 | 103 | //join the related module's table |
104 | 104 | $join .= "$join_type $targetTableWithAlias ON $targetTable.$targetKey=$startingTable.$startingKey" |
105 | - . " AND $targetTable.deleted=$deleted\n" |
|
105 | + . " AND $targetTable.deleted=$deleted\n" |
|
106 | 106 | //Next add any role filters |
107 | - . $this->getRoleWhere(); |
|
107 | + . $this->getRoleWhere(); |
|
108 | 108 | |
109 | 109 | if($return_array){ |
110 | 110 | return array( |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | //First join the relationship table |
296 | 296 | $join .= "$join_type $targetTableWithAlias ON $startingTable.$startingKey=$targetTable.$targetKey AND $targetTable.deleted=0\n" |
297 | 297 | //Next add any role filters |
298 | - . $this->getRoleWhere(($linkIsLHS) ? $targetTable : $startingTable) . "\n"; |
|
298 | + . $this->getRoleWhere(($linkIsLHS) ? $targetTable : $startingTable) . "\n"; |
|
299 | 299 | |
300 | 300 | if($return_array){ |
301 | 301 | return array( |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | |
355 | 355 | $query .= "$join_type $targetTableWithAlias ON $startingTable.$startingKey=$targetTable.$targetKey AND $targetTable.deleted=0\n" |
356 | 356 | //Next add any role filters |
357 | - . $this->getRoleWhere($tableInRoleFilter) . "\n"; |
|
357 | + . $this->getRoleWhere($tableInRoleFilter) . "\n"; |
|
358 | 358 | |
359 | 359 | if (!empty($params['return_as_array'])) { |
360 | 360 | $return_array = true; |
@@ -131,28 +131,28 @@ discard block |
||
131 | 131 | $lhsLinkName = $this->lhsLink; |
132 | 132 | $rhsLinkName = $this->rhsLink; |
133 | 133 | |
134 | - /* BEGIN - SECURITY GROUPS */ |
|
135 | - //Need to hijack this as security groups will not contain a link on the module side |
|
136 | - //due to the way the module works. Plus it would remove the relative ease of adding custom module support |
|
134 | + /* BEGIN - SECURITY GROUPS */ |
|
135 | + //Need to hijack this as security groups will not contain a link on the module side |
|
136 | + //due to the way the module works. Plus it would remove the relative ease of adding custom module support |
|
137 | 137 | |
138 | - if(get_class($rhs) != 'User' && get_class($rhs) != 'ACLRole' && get_class($lhs) == 'SecurityGroup') { |
|
139 | - $rhs->$rhsLinkName->addBean($lhs); |
|
140 | - $this->callBeforeAdd($rhs, $lhs, $rhsLinkName); |
|
141 | - |
|
142 | - $dataToInsert = $this->getRowToInsert($lhs, $rhs, $additionalFields); |
|
143 | - $this->addRow($dataToInsert); |
|
144 | - $rhs->$rhsLinkName->addBean($lhs); |
|
145 | - $this->callAfterAdd($lhs, $rhs, $lhsLinkName); |
|
146 | - } else if(get_class($lhs) != 'User' && get_class($lhs) != 'ACLRole' && get_class($rhs) == 'SecurityGroup') { |
|
147 | - $lhs->$lhsLinkName->addBean($rhs); |
|
148 | - $this->callBeforeAdd($lhs, $rhs, $lhsLinkName); |
|
149 | - |
|
150 | - $dataToInsert = $this->getRowToInsert($lhs, $rhs, $additionalFields); |
|
151 | - $this->addRow($dataToInsert); |
|
152 | - $lhs->$lhsLinkName->addBean($rhs); |
|
153 | - $this->callAfterAdd($rhs, $lhs, $rhsLinkName); |
|
154 | - } else { |
|
155 | - /* END - SECURITY GROUPS */ |
|
138 | + if(get_class($rhs) != 'User' && get_class($rhs) != 'ACLRole' && get_class($lhs) == 'SecurityGroup') { |
|
139 | + $rhs->$rhsLinkName->addBean($lhs); |
|
140 | + $this->callBeforeAdd($rhs, $lhs, $rhsLinkName); |
|
141 | + |
|
142 | + $dataToInsert = $this->getRowToInsert($lhs, $rhs, $additionalFields); |
|
143 | + $this->addRow($dataToInsert); |
|
144 | + $rhs->$rhsLinkName->addBean($lhs); |
|
145 | + $this->callAfterAdd($lhs, $rhs, $lhsLinkName); |
|
146 | + } else if(get_class($lhs) != 'User' && get_class($lhs) != 'ACLRole' && get_class($rhs) == 'SecurityGroup') { |
|
147 | + $lhs->$lhsLinkName->addBean($rhs); |
|
148 | + $this->callBeforeAdd($lhs, $rhs, $lhsLinkName); |
|
149 | + |
|
150 | + $dataToInsert = $this->getRowToInsert($lhs, $rhs, $additionalFields); |
|
151 | + $this->addRow($dataToInsert); |
|
152 | + $lhs->$lhsLinkName->addBean($rhs); |
|
153 | + $this->callAfterAdd($rhs, $lhs, $rhsLinkName); |
|
154 | + } else { |
|
155 | + /* END - SECURITY GROUPS */ |
|
156 | 156 | |
157 | 157 | if (empty($lhs->$lhsLinkName) && !$lhs->load_relationship($lhsLinkName)) |
158 | 158 | { |
@@ -262,50 +262,50 @@ discard block |
||
262 | 262 | return false; |
263 | 263 | } |
264 | 264 | |
265 | - /* BEGIN - SECURITY GROUPS */ |
|
266 | - //Need to hijack this as security groups will not contain a link on the module side |
|
267 | - //due to the way the module works. Plus it would remove the relative ease of adding custom module support |
|
265 | + /* BEGIN - SECURITY GROUPS */ |
|
266 | + //Need to hijack this as security groups will not contain a link on the module side |
|
267 | + //due to the way the module works. Plus it would remove the relative ease of adding custom module support |
|
268 | 268 | |
269 | - if(get_class($lhs) == 'SecurityGroup' || get_class($rhs) == 'SecurityGroup') { |
|
270 | - $dataToRemove = array( |
|
271 | - $this->def['join_key_lhs'] => $lhs->id, |
|
272 | - $this->def['join_key_rhs'] => $rhs->id |
|
273 | - ); |
|
274 | - |
|
275 | - |
|
276 | - if (empty($_SESSION['disable_workflow']) || $_SESSION['disable_workflow'] != "Yes") |
|
277 | - { |
|
278 | - if (get_class($lhs) != 'SecurityGroup' && $lhs->$lhsLinkName instanceof Link2) |
|
279 | - { |
|
280 | - $lhs->$lhsLinkName->load(); |
|
281 | - $this->callBeforeDelete($lhs, $rhs, $lhsLinkName); |
|
282 | - } |
|
283 | - |
|
284 | - if (get_class($rhs) != 'SecurityGroup' && $rhs->$rhsLinkName instanceof Link2) |
|
285 | - { |
|
286 | - $rhs->$rhsLinkName->load(); |
|
287 | - $this->callBeforeDelete($rhs, $lhs, $rhsLinkName); |
|
288 | - } |
|
289 | - } |
|
290 | - |
|
291 | - $this->removeRow($dataToRemove); |
|
269 | + if(get_class($lhs) == 'SecurityGroup' || get_class($rhs) == 'SecurityGroup') { |
|
270 | + $dataToRemove = array( |
|
271 | + $this->def['join_key_lhs'] => $lhs->id, |
|
272 | + $this->def['join_key_rhs'] => $rhs->id |
|
273 | + ); |
|
274 | + |
|
275 | + |
|
276 | + if (empty($_SESSION['disable_workflow']) || $_SESSION['disable_workflow'] != "Yes") |
|
277 | + { |
|
278 | + if (get_class($lhs) != 'SecurityGroup' && $lhs->$lhsLinkName instanceof Link2) |
|
279 | + { |
|
280 | + $lhs->$lhsLinkName->load(); |
|
281 | + $this->callBeforeDelete($lhs, $rhs, $lhsLinkName); |
|
282 | + } |
|
283 | + |
|
284 | + if (get_class($rhs) != 'SecurityGroup' && $rhs->$rhsLinkName instanceof Link2) |
|
285 | + { |
|
286 | + $rhs->$rhsLinkName->load(); |
|
287 | + $this->callBeforeDelete($rhs, $lhs, $rhsLinkName); |
|
288 | + } |
|
289 | + } |
|
290 | + |
|
291 | + $this->removeRow($dataToRemove); |
|
292 | 292 | |
293 | - if (empty($_SESSION['disable_workflow']) || $_SESSION['disable_workflow'] != "Yes") |
|
294 | - { |
|
295 | - if (get_class($lhs) != 'SecurityGroup' && $lhs->$lhsLinkName instanceof Link2) |
|
296 | - { |
|
297 | - $lhs->$lhsLinkName->load(); |
|
298 | - $this->callAfterDelete($lhs, $rhs, $lhsLinkName); |
|
299 | - } |
|
300 | - |
|
301 | - if (get_class($rhs) != 'SecurityGroup' && $rhs->$rhsLinkName instanceof Link2) |
|
302 | - { |
|
303 | - $rhs->$rhsLinkName->load(); |
|
304 | - $this->callAfterDelete($rhs, $lhs, $rhsLinkName); |
|
305 | - } |
|
306 | - } |
|
307 | - } else { |
|
308 | - /* END - SECURITY GROUPS */ |
|
293 | + if (empty($_SESSION['disable_workflow']) || $_SESSION['disable_workflow'] != "Yes") |
|
294 | + { |
|
295 | + if (get_class($lhs) != 'SecurityGroup' && $lhs->$lhsLinkName instanceof Link2) |
|
296 | + { |
|
297 | + $lhs->$lhsLinkName->load(); |
|
298 | + $this->callAfterDelete($lhs, $rhs, $lhsLinkName); |
|
299 | + } |
|
300 | + |
|
301 | + if (get_class($rhs) != 'SecurityGroup' && $rhs->$rhsLinkName instanceof Link2) |
|
302 | + { |
|
303 | + $rhs->$rhsLinkName->load(); |
|
304 | + $this->callAfterDelete($rhs, $lhs, $rhsLinkName); |
|
305 | + } |
|
306 | + } |
|
307 | + } else { |
|
308 | + /* END - SECURITY GROUPS */ |
|
309 | 309 | if (empty($lhs->$lhsLinkName) && !$lhs->load_relationship($lhsLinkName)) |
310 | 310 | { |
311 | 311 | $GLOBALS['log']->fatal("could not load LHS $lhsLinkName"); |
@@ -512,9 +512,9 @@ discard block |
||
512 | 512 | //First join the relationship table |
513 | 513 | $join .= "$join_type $joinTableWithAlias ON $join1 AND $joinTable.deleted=0\n" |
514 | 514 | //Next add any role filters |
515 | - . $this->getRoleWhere($joinTable) . "\n" |
|
515 | + . $this->getRoleWhere($joinTable) . "\n" |
|
516 | 516 | //Then finally join the related module's table |
517 | - . "$join_type $targetTableWithAlias ON $join2 AND $targetTable.deleted=0\n"; |
|
517 | + . "$join_type $targetTableWithAlias ON $join2 AND $targetTable.deleted=0\n"; |
|
518 | 518 | |
519 | 519 | if($return_array){ |
520 | 520 | return array( |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | //First join the relationship table |
567 | 567 | $query .= "$join_type $joinTableWithAlias ON $where AND $joinTable.deleted=0\n" |
568 | 568 | //Next add any role filters |
569 | - . $this->getRoleWhere($joinTable, $ignoreRole) . "\n"; |
|
569 | + . $this->getRoleWhere($joinTable, $ignoreRole) . "\n"; |
|
570 | 570 | |
571 | 571 | if (!empty($params['return_as_array'])) { |
572 | 572 | $return_array = true; |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | ); |
101 | 101 | if (!isset($this->lhsLinkDef['name']) && isset($this->lhsLinkDef[0])) |
102 | 102 | { |
103 | - $this->lhsLinkDef = $this->lhsLinkDef[0]; |
|
103 | + $this->lhsLinkDef = $this->lhsLinkDef[0]; |
|
104 | 104 | } |
105 | 105 | if (!isset($this->rhsLinkDef['name']) && isset($this->rhsLinkDef[0])) { |
106 | 106 | $this->rhsLinkDef = $this->rhsLinkDef[0]; |
@@ -128,35 +128,35 @@ discard block |
||
128 | 128 | //If the current data matches the existing data, don't do anything |
129 | 129 | if (!$this->checkExisting($dataToInsert)) |
130 | 130 | { |
131 | - // Pre-load the RHS relationship, which is used later in the add() function and expects a Bean |
|
132 | - // and we also use it for clearing relationships in case of non self-referencing O2M relations |
|
133 | - // (should be preloaded because when using the relate_to field for updating/saving relationships, |
|
134 | - // only the bean id is loaded into $rhs->$rhsLinkName) |
|
135 | - $rhsLinkName = $this->rhsLink; |
|
136 | - $rhs->load_relationship($rhsLinkName); |
|
131 | + // Pre-load the RHS relationship, which is used later in the add() function and expects a Bean |
|
132 | + // and we also use it for clearing relationships in case of non self-referencing O2M relations |
|
133 | + // (should be preloaded because when using the relate_to field for updating/saving relationships, |
|
134 | + // only the bean id is loaded into $rhs->$rhsLinkName) |
|
135 | + $rhsLinkName = $this->rhsLink; |
|
136 | + $rhs->load_relationship($rhsLinkName); |
|
137 | 137 | |
138 | - // If it's a One2Many self-referencing relationship |
|
139 | - // the positions of the default One (LHS) and Many (RHS) are swaped |
|
140 | - // so we should clear the links from the many (left) side |
|
141 | - if ($this->selfReferencing) { |
|
142 | - // Load right hand side relationship name |
|
143 | - $linkName = $this->rhsLink; |
|
144 | - // Load the relationship into the left hand side bean |
|
145 | - $lhs->load_relationship($linkName); |
|
138 | + // If it's a One2Many self-referencing relationship |
|
139 | + // the positions of the default One (LHS) and Many (RHS) are swaped |
|
140 | + // so we should clear the links from the many (left) side |
|
141 | + if ($this->selfReferencing) { |
|
142 | + // Load right hand side relationship name |
|
143 | + $linkName = $this->rhsLink; |
|
144 | + // Load the relationship into the left hand side bean |
|
145 | + $lhs->load_relationship($linkName); |
|
146 | 146 | |
147 | - // Pick the loaded link |
|
148 | - $link = $lhs->$linkName; |
|
149 | - // Get many (LHS) side bean |
|
150 | - $focus = $link->getFocus(); |
|
151 | - // Get relations |
|
152 | - $related = $link->getBeans(); |
|
147 | + // Pick the loaded link |
|
148 | + $link = $lhs->$linkName; |
|
149 | + // Get many (LHS) side bean |
|
150 | + $focus = $link->getFocus(); |
|
151 | + // Get relations |
|
152 | + $related = $link->getBeans(); |
|
153 | 153 | |
154 | - // Clear the relations from many side bean |
|
155 | - foreach($related as $relBean) { |
|
156 | - $this->remove($focus, $relBean); |
|
157 | - } |
|
154 | + // Clear the relations from many side bean |
|
155 | + foreach($related as $relBean) { |
|
156 | + $this->remove($focus, $relBean); |
|
157 | + } |
|
158 | 158 | } else { // For non self-referencing, remove all the relationships from the many (RHS) side |
159 | - $this->removeAll($rhs->$rhsLinkName); |
|
159 | + $this->removeAll($rhs->$rhsLinkName); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | // Add relationship |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | - if(!defined('sugarEntry'))define('sugarEntry', true); |
|
2 | + if(!defined('sugarEntry'))define('sugarEntry', true); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | |
66 | 66 | //New API is in these files |
67 | 67 | if(!empty($administrator->settings['portal_on'])) { |
68 | - require_once('soap/SoapPortalUsers.php'); |
|
68 | + require_once('soap/SoapPortalUsers.php'); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | require_once('soap/SoapSugarUsers.php'); |
@@ -88,9 +88,9 @@ discard block |
||
88 | 88 | $observers = $resourceManager->getObservers(); |
89 | 89 | //Call set_soap_server for SoapResourceObserver instance(s) |
90 | 90 | foreach($observers as $observer) { |
91 | - if(method_exists($observer, 'set_soap_server')) { |
|
92 | - $observer->set_soap_server($server); |
|
93 | - } |
|
91 | + if(method_exists($observer, 'set_soap_server')) { |
|
92 | + $observer->set_soap_server($server); |
|
93 | + } |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''; |
@@ -40,26 +40,26 @@ discard block |
||
40 | 40 | |
41 | 41 | |
42 | 42 | $default_modules_sources = array ( |
43 | - 'Accounts' => |
|
44 | - array ( |
|
45 | - 'ext_rest_insideview' => 'ext_rest_insideview', |
|
46 | - ), |
|
47 | - 'Contacts' => |
|
48 | - array ( |
|
49 | - 'ext_rest_insideview' => 'ext_rest_insideview', |
|
50 | - ), |
|
51 | - 'Leads' => |
|
52 | - array ( |
|
53 | - 'ext_rest_insideview' => 'ext_rest_insideview', |
|
54 | - ), |
|
55 | - 'Prospects' => |
|
56 | - array ( |
|
43 | + 'Accounts' => |
|
44 | + array ( |
|
45 | + 'ext_rest_insideview' => 'ext_rest_insideview', |
|
46 | + ), |
|
47 | + 'Contacts' => |
|
48 | + array ( |
|
49 | + 'ext_rest_insideview' => 'ext_rest_insideview', |
|
50 | + ), |
|
51 | + 'Leads' => |
|
52 | + array ( |
|
53 | + 'ext_rest_insideview' => 'ext_rest_insideview', |
|
54 | + ), |
|
55 | + 'Prospects' => |
|
56 | + array ( |
|
57 | 57 | |
58 | - ), |
|
59 | - 'Opportunities' => |
|
60 | - array ( |
|
58 | + ), |
|
59 | + 'Opportunities' => |
|
60 | + array ( |
|
61 | 61 | 'ext_rest_insideview' => 'ext_rest_insideview', |
62 | - ), |
|
62 | + ), |
|
63 | 63 | ); |
64 | 64 | |
65 | 65 | $previous_connectors = array(); |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | } |
104 | 104 | |
105 | 105 | if(!file_exists('custom/modules/Connectors/metadata')) { |
106 | - mkdir_recursive('custom/modules/Connectors/metadata'); |
|
106 | + mkdir_recursive('custom/modules/Connectors/metadata'); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | if(!write_array_to_file('modules_sources', $default_modules_sources, 'custom/modules/Connectors/metadata/display_config.php')) { |
110 | - $GLOBALS['log']->fatal('Cannot write file custom/modules/Connectors/metadata/display_config.php'); |
|
110 | + $GLOBALS['log']->fatal('Cannot write file custom/modules/Connectors/metadata/display_config.php'); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | ?> |
@@ -49,95 +49,95 @@ discard block |
||
49 | 49 | class ProspectFormBase { |
50 | 50 | |
51 | 51 | function checkForDuplicates($prefix){ |
52 | - global $local_log; |
|
53 | - require_once('include/formbase.php'); |
|
52 | + global $local_log; |
|
53 | + require_once('include/formbase.php'); |
|
54 | 54 | |
55 | - $focus = new Prospect(); |
|
56 | - if(!checkRequired($prefix, array_keys($focus->required_fields))){ |
|
57 | - return null; |
|
58 | - } |
|
59 | - $query = ''; |
|
60 | - $baseQuery = 'select id,first_name, last_name, title, email1, email2 from prospects where deleted!=1 and ('; |
|
61 | - if(!empty($_POST[$prefix.'first_name']) && !empty($_POST[$prefix.'last_name'])){ |
|
62 | - $query = $baseQuery ." (first_name like '". $_POST[$prefix.'first_name'] . "%' and last_name = '". $_POST[$prefix.'last_name'] ."')"; |
|
63 | - }else{ |
|
64 | - $query = $baseQuery ." last_name = '". $_POST[$prefix.'last_name'] ."'"; |
|
65 | - } |
|
66 | - if(!empty($_POST[$prefix.'email1'])){ |
|
67 | - if(empty($query)){ |
|
68 | - $query = $baseQuery. " email1='". $_POST[$prefix.'email1'] . "' or email2 = '". $_POST[$prefix.'email1'] ."'"; |
|
69 | - }else { |
|
70 | - $query .= "or email1='". $_POST[$prefix.'email1'] . "' or email2 = '". $_POST[$prefix.'email1'] ."'"; |
|
71 | - } |
|
72 | - } |
|
73 | - if(!empty($_POST[$prefix.'email2'])){ |
|
74 | - if(empty($query)) { |
|
75 | - $query = $baseQuery. " email1='". $_POST[$prefix.'email2'] . "' or email2 = '". $_POST[$prefix.'email2'] ."'"; |
|
76 | - }else{ |
|
77 | - $query .= "or email1='". $_POST[$prefix.'email2'] . "' or email2 = '". $_POST[$prefix.'email2'] ."'"; |
|
78 | - } |
|
79 | - |
|
80 | - } |
|
81 | - |
|
82 | - if(!empty($query)){ |
|
83 | - $rows = array(); |
|
55 | + $focus = new Prospect(); |
|
56 | + if(!checkRequired($prefix, array_keys($focus->required_fields))){ |
|
57 | + return null; |
|
58 | + } |
|
59 | + $query = ''; |
|
60 | + $baseQuery = 'select id,first_name, last_name, title, email1, email2 from prospects where deleted!=1 and ('; |
|
61 | + if(!empty($_POST[$prefix.'first_name']) && !empty($_POST[$prefix.'last_name'])){ |
|
62 | + $query = $baseQuery ." (first_name like '". $_POST[$prefix.'first_name'] . "%' and last_name = '". $_POST[$prefix.'last_name'] ."')"; |
|
63 | + }else{ |
|
64 | + $query = $baseQuery ." last_name = '". $_POST[$prefix.'last_name'] ."'"; |
|
65 | + } |
|
66 | + if(!empty($_POST[$prefix.'email1'])){ |
|
67 | + if(empty($query)){ |
|
68 | + $query = $baseQuery. " email1='". $_POST[$prefix.'email1'] . "' or email2 = '". $_POST[$prefix.'email1'] ."'"; |
|
69 | + }else { |
|
70 | + $query .= "or email1='". $_POST[$prefix.'email1'] . "' or email2 = '". $_POST[$prefix.'email1'] ."'"; |
|
71 | + } |
|
72 | + } |
|
73 | + if(!empty($_POST[$prefix.'email2'])){ |
|
74 | + if(empty($query)) { |
|
75 | + $query = $baseQuery. " email1='". $_POST[$prefix.'email2'] . "' or email2 = '". $_POST[$prefix.'email2'] ."'"; |
|
76 | + }else{ |
|
77 | + $query .= "or email1='". $_POST[$prefix.'email2'] . "' or email2 = '". $_POST[$prefix.'email2'] ."'"; |
|
78 | + } |
|
79 | + |
|
80 | + } |
|
81 | + |
|
82 | + if(!empty($query)){ |
|
83 | + $rows = array(); |
|
84 | 84 | |
85 | - $db = DBManagerFactory::getInstance(); |
|
86 | - $result = $db->query($query.');'); |
|
85 | + $db = DBManagerFactory::getInstance(); |
|
86 | + $result = $db->query($query.');'); |
|
87 | 87 | while($row = $db->fetchByAssoc($result)) { |
88 | 88 | $rows[] = $row; |
89 | - } |
|
90 | - if(count($rows) > 0) return $rows; |
|
91 | - } |
|
92 | - return null; |
|
89 | + } |
|
90 | + if(count($rows) > 0) return $rows; |
|
91 | + } |
|
92 | + return null; |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | |
96 | 96 | function buildTableForm($rows, $mod=''){ |
97 | - global $action; |
|
98 | - if(!empty($mod)){ |
|
99 | - global $current_language; |
|
100 | - $mod_strings = return_module_language($current_language, $mod); |
|
101 | - }else global $mod_strings; |
|
102 | - global $app_strings; |
|
103 | - $cols = sizeof($rows[0]) * 2 + 1; |
|
104 | - if ($action != 'ShowDuplicates') |
|
105 | - { |
|
106 | - $form = '<table width="100%"><tr><td>'.$mod_strings['MSG_DUPLICATE']. '</td></tr><tr><td height="20"></td></tr></table>'; |
|
107 | - $form .= "<form action='index.php' method='post' name='dupProspects'><input type='hidden' name='selectedProspect' value=''>"; |
|
108 | - } |
|
109 | - else |
|
110 | - { |
|
111 | - $form = '<table width="100%"><tr><td>'.$mod_strings['MSG_SHOW_DUPLICATES']. '</td></tr><tr><td height="20"></td></tr></table>'; |
|
112 | - } |
|
113 | - $form .= get_form_header($mod_strings['LBL_DUPLICATE'],"", ''); |
|
114 | - $form .= "<table width='100%' cellpadding='0' cellspacing='0'> <tr > "; |
|
115 | - if ($action != 'ShowDuplicates') |
|
116 | - { |
|
117 | - $form .= "<td > </td>"; |
|
118 | - } |
|
119 | - |
|
120 | - require_once('include/formbase.php'); |
|
121 | - $form .= getPostToForm(); |
|
122 | - |
|
123 | - if(isset($rows[0])){ |
|
124 | - foreach ($rows[0] as $key=>$value){ |
|
125 | - if($key != 'id'){ |
|
126 | - $form .= "<td scope='col' >". $mod_strings[$mod_strings['db_'.$key]]. "</td>"; |
|
127 | - } |
|
128 | - } |
|
129 | - $form .= "</tr>"; |
|
130 | - } |
|
131 | - $rowColor = 'oddListRowS1'; |
|
132 | - foreach($rows as $row){ |
|
133 | - |
|
134 | - $form .= "<tr class='$rowColor'>"; |
|
135 | - if ($action != 'ShowDuplicates') |
|
136 | - $form .= "<td width='1%' nowrap='nowrap' ><a href='#' onClick=\"document.dupProspects.selectedProspect.value='${row['id']}';document.dupProspects.submit() \">[${app_strings['LBL_SELECT_BUTTON_LABEL']}]</a> </td>\n"; |
|
97 | + global $action; |
|
98 | + if(!empty($mod)){ |
|
99 | + global $current_language; |
|
100 | + $mod_strings = return_module_language($current_language, $mod); |
|
101 | + }else global $mod_strings; |
|
102 | + global $app_strings; |
|
103 | + $cols = sizeof($rows[0]) * 2 + 1; |
|
104 | + if ($action != 'ShowDuplicates') |
|
105 | + { |
|
106 | + $form = '<table width="100%"><tr><td>'.$mod_strings['MSG_DUPLICATE']. '</td></tr><tr><td height="20"></td></tr></table>'; |
|
107 | + $form .= "<form action='index.php' method='post' name='dupProspects'><input type='hidden' name='selectedProspect' value=''>"; |
|
108 | + } |
|
109 | + else |
|
110 | + { |
|
111 | + $form = '<table width="100%"><tr><td>'.$mod_strings['MSG_SHOW_DUPLICATES']. '</td></tr><tr><td height="20"></td></tr></table>'; |
|
112 | + } |
|
113 | + $form .= get_form_header($mod_strings['LBL_DUPLICATE'],"", ''); |
|
114 | + $form .= "<table width='100%' cellpadding='0' cellspacing='0'> <tr > "; |
|
115 | + if ($action != 'ShowDuplicates') |
|
116 | + { |
|
117 | + $form .= "<td > </td>"; |
|
118 | + } |
|
119 | + |
|
120 | + require_once('include/formbase.php'); |
|
121 | + $form .= getPostToForm(); |
|
122 | + |
|
123 | + if(isset($rows[0])){ |
|
124 | + foreach ($rows[0] as $key=>$value){ |
|
125 | + if($key != 'id'){ |
|
126 | + $form .= "<td scope='col' >". $mod_strings[$mod_strings['db_'.$key]]. "</td>"; |
|
127 | + } |
|
128 | + } |
|
129 | + $form .= "</tr>"; |
|
130 | + } |
|
131 | + $rowColor = 'oddListRowS1'; |
|
132 | + foreach($rows as $row){ |
|
133 | + |
|
134 | + $form .= "<tr class='$rowColor'>"; |
|
135 | + if ($action != 'ShowDuplicates') |
|
136 | + $form .= "<td width='1%' nowrap='nowrap' ><a href='#' onClick=\"document.dupProspects.selectedProspect.value='${row['id']}';document.dupProspects.submit() \">[${app_strings['LBL_SELECT_BUTTON_LABEL']}]</a> </td>\n"; |
|
137 | 137 | |
138 | - $wasSet = false; |
|
138 | + $wasSet = false; |
|
139 | 139 | |
140 | - foreach ($row as $key=>$value) { |
|
140 | + foreach ($row as $key=>$value) { |
|
141 | 141 | if($key != 'id') { |
142 | 142 | if(!$wasSet) { |
143 | 143 | $form .= "<td scope='row' ><a target='_blank' href='index.php?module=Prospects&action=DetailView&record=${row['id']}'>$value</a></td>\n"; |
@@ -147,25 +147,25 @@ discard block |
||
147 | 147 | $form .= "<td><a target='_blank' href='index.php?module=Prospects&action=DetailView&record=${row['id']}'>$value</a></td>\n"; |
148 | 148 | } |
149 | 149 | } |
150 | - } |
|
151 | - |
|
152 | - if($rowColor == 'evenListRowS1'){ |
|
153 | - $rowColor = 'oddListRowS1'; |
|
154 | - }else{ |
|
155 | - $rowColor = 'evenListRowS1'; |
|
156 | - } |
|
157 | - $form .= "</tr>"; |
|
158 | - } |
|
159 | - $form .= "<tr ><td colspan='$cols' class='blackline'></td></tr>"; |
|
160 | - if ($action == 'ShowDuplicates') |
|
161 | - { |
|
162 | - $form .= "</table><br><input title='${app_strings['LBL_SAVE_BUTTON_TITLE']}' accessKey='${app_strings['LBL_SAVE_BUTTON_KEY']}' class='button' onclick=\"this.form.action.value='Save';\" type='submit' name='button' value=' ${app_strings['LBL_SAVE_BUTTON_LABEL']} '> <input title='${app_strings['LBL_CANCEL_BUTTON_TITLE']}' accessKey='${app_strings['LBL_CANCEL_BUTTON_KEY']}' class='button' onclick=\"this.form.action.value='ListView'; this.form.module.value='Prospects';\" type='submit' name='button' value=' ${app_strings['LBL_CANCEL_BUTTON_LABEL']} '></form>"; |
|
163 | - } |
|
164 | - else |
|
165 | - { |
|
166 | - $form .= "</table><br><input type='submit' class='button' name='ContinueProspect' value='${mod_strings['LNK_NEW_PROSPECT']}'></form>"; |
|
167 | - } |
|
168 | - return $form; |
|
150 | + } |
|
151 | + |
|
152 | + if($rowColor == 'evenListRowS1'){ |
|
153 | + $rowColor = 'oddListRowS1'; |
|
154 | + }else{ |
|
155 | + $rowColor = 'evenListRowS1'; |
|
156 | + } |
|
157 | + $form .= "</tr>"; |
|
158 | + } |
|
159 | + $form .= "<tr ><td colspan='$cols' class='blackline'></td></tr>"; |
|
160 | + if ($action == 'ShowDuplicates') |
|
161 | + { |
|
162 | + $form .= "</table><br><input title='${app_strings['LBL_SAVE_BUTTON_TITLE']}' accessKey='${app_strings['LBL_SAVE_BUTTON_KEY']}' class='button' onclick=\"this.form.action.value='Save';\" type='submit' name='button' value=' ${app_strings['LBL_SAVE_BUTTON_LABEL']} '> <input title='${app_strings['LBL_CANCEL_BUTTON_TITLE']}' accessKey='${app_strings['LBL_CANCEL_BUTTON_KEY']}' class='button' onclick=\"this.form.action.value='ListView'; this.form.module.value='Prospects';\" type='submit' name='button' value=' ${app_strings['LBL_CANCEL_BUTTON_LABEL']} '></form>"; |
|
163 | + } |
|
164 | + else |
|
165 | + { |
|
166 | + $form .= "</table><br><input type='submit' class='button' name='ContinueProspect' value='${mod_strings['LNK_NEW_PROSPECT']}'></form>"; |
|
167 | + } |
|
168 | + return $form; |
|
169 | 169 | |
170 | 170 | |
171 | 171 | |
@@ -173,31 +173,31 @@ discard block |
||
173 | 173 | |
174 | 174 | } |
175 | 175 | function getWideFormBody($prefix, $mod='',$formname='', $prospect = ''){ |
176 | - if(!ACLController::checkAccess('Prospects', 'edit', true)){ |
|
177 | - return ''; |
|
178 | - } |
|
176 | + if(!ACLController::checkAccess('Prospects', 'edit', true)){ |
|
177 | + return ''; |
|
178 | + } |
|
179 | 179 | |
180 | - if(empty($prospect)){ |
|
181 | - $prospect = new Prospect(); |
|
182 | - } |
|
183 | - global $mod_strings; |
|
180 | + if(empty($prospect)){ |
|
181 | + $prospect = new Prospect(); |
|
182 | + } |
|
183 | + global $mod_strings; |
|
184 | 184 | $temp_strings = $mod_strings; |
185 | 185 | if(!empty($mod)){ |
186 | - global $current_language; |
|
187 | - $mod_strings = return_module_language($current_language, $mod); |
|
186 | + global $current_language; |
|
187 | + $mod_strings = return_module_language($current_language, $mod); |
|
188 | 188 | } |
189 | - global $app_strings; |
|
190 | - global $current_user; |
|
191 | - global $app_list_strings; |
|
192 | - $primary_address_country_options = get_select_options_with_id($app_list_strings['countries_dom'], $prospect->primary_address_country); |
|
193 | - $lbl_required_symbol = $app_strings['LBL_REQUIRED_SYMBOL']; |
|
194 | - $lbl_first_name = $mod_strings['LBL_FIRST_NAME']; |
|
195 | - $lbl_last_name = $mod_strings['LBL_LAST_NAME']; |
|
196 | - $lbl_phone = $mod_strings['LBL_OFFICE_PHONE']; |
|
197 | - $lbl_address = $mod_strings['LBL_PRIMARY_ADDRESS']; |
|
198 | - $user_id = $current_user->id; |
|
199 | - $lbl_email_address = $mod_strings['LBL_EMAIL_ADDRESS']; |
|
200 | - $form = <<<EOQ |
|
189 | + global $app_strings; |
|
190 | + global $current_user; |
|
191 | + global $app_list_strings; |
|
192 | + $primary_address_country_options = get_select_options_with_id($app_list_strings['countries_dom'], $prospect->primary_address_country); |
|
193 | + $lbl_required_symbol = $app_strings['LBL_REQUIRED_SYMBOL']; |
|
194 | + $lbl_first_name = $mod_strings['LBL_FIRST_NAME']; |
|
195 | + $lbl_last_name = $mod_strings['LBL_LAST_NAME']; |
|
196 | + $lbl_phone = $mod_strings['LBL_OFFICE_PHONE']; |
|
197 | + $lbl_address = $mod_strings['LBL_PRIMARY_ADDRESS']; |
|
198 | + $user_id = $current_user->id; |
|
199 | + $lbl_email_address = $mod_strings['LBL_EMAIL_ADDRESS']; |
|
200 | + $form = <<<EOQ |
|
201 | 201 | <input type="hidden" name="${prefix}record" value=""> |
202 | 202 | <input type="hidden" name="${prefix}assigned_user_id" value='${user_id}'> |
203 | 203 | <table border='0' celpadding="0" cellspacing="0" width='100%'> |
@@ -304,26 +304,26 @@ discard block |
||
304 | 304 | } |
305 | 305 | |
306 | 306 | function getFormBody($prefix, $mod='', $formname=''){ |
307 | - if(!ACLController::checkAccess('Prospects', 'edit', true)){ |
|
308 | - return ''; |
|
309 | - } |
|
307 | + if(!ACLController::checkAccess('Prospects', 'edit', true)){ |
|
308 | + return ''; |
|
309 | + } |
|
310 | 310 | global $mod_strings; |
311 | 311 | $temp_strings = $mod_strings; |
312 | 312 | if(!empty($mod)){ |
313 | - global $current_language; |
|
314 | - $mod_strings = return_module_language($current_language, $mod); |
|
313 | + global $current_language; |
|
314 | + $mod_strings = return_module_language($current_language, $mod); |
|
315 | 315 | } |
316 | - global $app_strings; |
|
317 | - global $current_user; |
|
318 | - $lbl_required_symbol = $app_strings['LBL_REQUIRED_SYMBOL']; |
|
319 | - $lbl_first_name = $mod_strings['LBL_FIRST_NAME']; |
|
320 | - $lbl_last_name = $mod_strings['LBL_LAST_NAME']; |
|
321 | - $lbl_phone = $mod_strings['LBL_PHONE']; |
|
322 | - $user_id = $current_user->id; |
|
323 | - $lbl_email_address = $mod_strings['LBL_EMAIL_ADDRESS']; |
|
316 | + global $app_strings; |
|
317 | + global $current_user; |
|
318 | + $lbl_required_symbol = $app_strings['LBL_REQUIRED_SYMBOL']; |
|
319 | + $lbl_first_name = $mod_strings['LBL_FIRST_NAME']; |
|
320 | + $lbl_last_name = $mod_strings['LBL_LAST_NAME']; |
|
321 | + $lbl_phone = $mod_strings['LBL_PHONE']; |
|
322 | + $user_id = $current_user->id; |
|
323 | + $lbl_email_address = $mod_strings['LBL_EMAIL_ADDRESS']; |
|
324 | 324 | if ($formname == 'EmailEditView') |
325 | 325 | { |
326 | - $form = <<<EOQ |
|
326 | + $form = <<<EOQ |
|
327 | 327 | <input type="hidden" name="${prefix}record" value=""> |
328 | 328 | <input type="hidden" name="${prefix}email2" value=""> |
329 | 329 | <input type="hidden" name="${prefix}phone_work" value=""> |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | } |
340 | 340 | else |
341 | 341 | { |
342 | - $form = <<<EOQ |
|
342 | + $form = <<<EOQ |
|
343 | 343 | <input type="hidden" name="${prefix}record" value=""> |
344 | 344 | <input type="hidden" name="${prefix}email2" value=""> |
345 | 345 | <input type="hidden" name="${prefix}assigned_user_id" value='${user_id}'> |
@@ -369,11 +369,11 @@ discard block |
||
369 | 369 | } |
370 | 370 | function getForm($prefix, $mod=''){ |
371 | 371 | if(!ACLController::checkAccess('Prospects', 'edit', true)){ |
372 | - return ''; |
|
373 | - } |
|
372 | + return ''; |
|
373 | + } |
|
374 | 374 | if(!empty($mod)){ |
375 | - global $current_language; |
|
376 | - $mod_strings = return_module_language($current_language, $mod); |
|
375 | + global $current_language; |
|
376 | + $mod_strings = return_module_language($current_language, $mod); |
|
377 | 377 | }else global $mod_strings; |
378 | 378 | global $app_strings; |
379 | 379 | |
@@ -405,31 +405,31 @@ discard block |
||
405 | 405 | |
406 | 406 | |
407 | 407 | function handleSave($prefix,$redirect=true, $useRequired=false){ |
408 | - global $theme; |
|
408 | + global $theme; |
|
409 | 409 | |
410 | 410 | |
411 | 411 | |
412 | 412 | |
413 | - require_once('include/formbase.php'); |
|
413 | + require_once('include/formbase.php'); |
|
414 | 414 | |
415 | - global $timedate; |
|
415 | + global $timedate; |
|
416 | 416 | |
417 | 417 | |
418 | - $focus = new Prospect(); |
|
419 | - if($useRequired && !checkRequired($prefix, array_keys($focus->required_fields))){ |
|
420 | - return null; |
|
421 | - } |
|
422 | - $focus = populateFromPost($prefix, $focus); |
|
423 | - if(!$focus->ACLAccess('Save')){ |
|
424 | - return null; |
|
425 | - } |
|
426 | - if (!isset($GLOBALS['check_notify'])) $GLOBALS['check_notify']=false; |
|
418 | + $focus = new Prospect(); |
|
419 | + if($useRequired && !checkRequired($prefix, array_keys($focus->required_fields))){ |
|
420 | + return null; |
|
421 | + } |
|
422 | + $focus = populateFromPost($prefix, $focus); |
|
423 | + if(!$focus->ACLAccess('Save')){ |
|
424 | + return null; |
|
425 | + } |
|
426 | + if (!isset($GLOBALS['check_notify'])) $GLOBALS['check_notify']=false; |
|
427 | 427 | |
428 | - if (!isset($_POST[$prefix.'email_opt_out'])) $focus->email_opt_out = 0; |
|
429 | - if (!isset($_POST[$prefix.'do_not_call'])) $focus->do_not_call = 0; |
|
428 | + if (!isset($_POST[$prefix.'email_opt_out'])) $focus->email_opt_out = 0; |
|
429 | + if (!isset($_POST[$prefix.'do_not_call'])) $focus->do_not_call = 0; |
|
430 | 430 | |
431 | - if (empty($_POST['record']) && empty($_POST['dup_checked'])) { |
|
432 | - /* |
|
431 | + if (empty($_POST['record']) && empty($_POST['dup_checked'])) { |
|
432 | + /* |
|
433 | 433 | // we don't check dupes on Prospects - this is the dirtiest data in the system |
434 | 434 | //$duplicateProspects = $this->checkForDuplicates($prefix); |
435 | 435 | if(isset($duplicateProspects)){ |
@@ -473,13 +473,13 @@ discard block |
||
473 | 473 | header("Location: index.php?$get"); |
474 | 474 | return null; |
475 | 475 | }*/ |
476 | - } |
|
477 | - global $current_user; |
|
476 | + } |
|
477 | + global $current_user; |
|
478 | 478 | |
479 | - $focus->save($GLOBALS['check_notify']); |
|
480 | - $return_id = $focus->id; |
|
479 | + $focus->save($GLOBALS['check_notify']); |
|
480 | + $return_id = $focus->id; |
|
481 | 481 | |
482 | - $GLOBALS['log']->debug("Saved record with id of ".$return_id); |
|
482 | + $GLOBALS['log']->debug("Saved record with id of ".$return_id); |
|
483 | 483 | if(isset($_POST['popup']) && $_POST['popup'] == 'true') { |
484 | 484 | $get = '&module='; |
485 | 485 | if(!empty($_POST['return_module'])) $get .= $_POST['return_module']; |
@@ -497,12 +497,12 @@ discard block |
||
497 | 497 | header("Location: index.php?$get"); |
498 | 498 | return; |
499 | 499 | } |
500 | - if($redirect){ |
|
501 | - require_once('include/formbase.php'); |
|
502 | - handleRedirect($return_id, 'Prospects'); |
|
503 | - }else{ |
|
504 | - return $focus; |
|
505 | - } |
|
500 | + if($redirect){ |
|
501 | + require_once('include/formbase.php'); |
|
502 | + handleRedirect($return_id, 'Prospects'); |
|
503 | + }else{ |
|
504 | + return $focus; |
|
505 | + } |
|
506 | 506 | } |
507 | 507 | |
508 | 508 | } |
@@ -40,58 +40,58 @@ |
||
40 | 40 | |
41 | 41 | |
42 | 42 | function additionalDetailsProspect($fields) { |
43 | - static $mod_strings; |
|
44 | - if(empty($mod_strings)) { |
|
45 | - global $current_language; |
|
46 | - $mod_strings = return_module_language($current_language, 'Prospects'); |
|
47 | - } |
|
43 | + static $mod_strings; |
|
44 | + if(empty($mod_strings)) { |
|
45 | + global $current_language; |
|
46 | + $mod_strings = return_module_language($current_language, 'Prospects'); |
|
47 | + } |
|
48 | 48 | |
49 | - $overlib_string = ''; |
|
49 | + $overlib_string = ''; |
|
50 | 50 | |
51 | - if(!empty($fields['ACCOUNT_NAME'])) $overlib_string .= '<b>'. $mod_strings['LBL_EDIT_ACCOUNT_NAME'] . '</b> ' . $fields['ACCOUNT_NAME'] . '<br>'; |
|
52 | - if(!empty($fields['PRIMARY_ADDRESS_STREET']) || !empty($fields['PRIMARY_ADDRESS_CITY']) || |
|
53 | - !empty($fields['PRIMARY_ADDRESS_STATE']) || !empty($fields['PRIMARY_ADDRESS_POSTALCODE']) || |
|
54 | - !empty($fields['PRIMARY_ADDRESS_COUNTRY'])) |
|
55 | - $overlib_string .= '<b>' . $mod_strings['LBL_PRIMARY_ADDRESS'] . '</b><br>'; |
|
56 | - if(!empty($fields['PRIMARY_ADDRESS_STREET'])) $overlib_string .= $fields['PRIMARY_ADDRESS_STREET'] . '<br>'; |
|
57 | - if(!empty($fields['PRIMARY_ADDRESS_STREET_2'])) $overlib_string .= $fields['PRIMARY_ADDRESS_STREET_2'] . '<br>'; |
|
58 | - if(!empty($fields['PRIMARY_ADDRESS_STREET_3'])) $overlib_string .= $fields['PRIMARY_ADDRESS_STREET_3'] . '<br>'; |
|
59 | - if(!empty($fields['PRIMARY_ADDRESS_CITY'])) $overlib_string .= $fields['PRIMARY_ADDRESS_CITY'] . ', '; |
|
60 | - if(!empty($fields['PRIMARY_ADDRESS_STATE'])) $overlib_string .= $fields['PRIMARY_ADDRESS_STATE'] . ' '; |
|
61 | - if(!empty($fields['PRIMARY_ADDRESS_POSTALCODE'])) $overlib_string .= $fields['PRIMARY_ADDRESS_POSTALCODE'] . ' '; |
|
62 | - if(!empty($fields['PRIMARY_ADDRESS_COUNTRY'])) $overlib_string .= $fields['PRIMARY_ADDRESS_COUNTRY'] . '<br>'; |
|
63 | - if(strlen($overlib_string) > 0 && !(strrpos($overlib_string, '<br>') == strlen($overlib_string) - 4)) |
|
64 | - $overlib_string .= '<br>'; |
|
65 | - if(!empty($fields['PHONE_MOBILE'])) $overlib_string .= '<b>'. $mod_strings['LBL_MOBILE_PHONE'] . '</b> <span class="phone">' . $fields['PHONE_MOBILE'] . '</span><br>'; |
|
66 | - if(!empty($fields['PHONE_HOME'])) $overlib_string .= '<b>'. $mod_strings['LBL_HOME_PHONE'] . '</b> <span class="phone">' . $fields['PHONE_HOME'] . '</span><br>'; |
|
67 | - if(!empty($fields['PHONE_OTHER'])) $overlib_string .= '<b>'. $mod_strings['LBL_OTHER_PHONE'] . '</b> <span class="phone">' . $fields['PHONE_OTHER'] . '</span><br>'; |
|
51 | + if(!empty($fields['ACCOUNT_NAME'])) $overlib_string .= '<b>'. $mod_strings['LBL_EDIT_ACCOUNT_NAME'] . '</b> ' . $fields['ACCOUNT_NAME'] . '<br>'; |
|
52 | + if(!empty($fields['PRIMARY_ADDRESS_STREET']) || !empty($fields['PRIMARY_ADDRESS_CITY']) || |
|
53 | + !empty($fields['PRIMARY_ADDRESS_STATE']) || !empty($fields['PRIMARY_ADDRESS_POSTALCODE']) || |
|
54 | + !empty($fields['PRIMARY_ADDRESS_COUNTRY'])) |
|
55 | + $overlib_string .= '<b>' . $mod_strings['LBL_PRIMARY_ADDRESS'] . '</b><br>'; |
|
56 | + if(!empty($fields['PRIMARY_ADDRESS_STREET'])) $overlib_string .= $fields['PRIMARY_ADDRESS_STREET'] . '<br>'; |
|
57 | + if(!empty($fields['PRIMARY_ADDRESS_STREET_2'])) $overlib_string .= $fields['PRIMARY_ADDRESS_STREET_2'] . '<br>'; |
|
58 | + if(!empty($fields['PRIMARY_ADDRESS_STREET_3'])) $overlib_string .= $fields['PRIMARY_ADDRESS_STREET_3'] . '<br>'; |
|
59 | + if(!empty($fields['PRIMARY_ADDRESS_CITY'])) $overlib_string .= $fields['PRIMARY_ADDRESS_CITY'] . ', '; |
|
60 | + if(!empty($fields['PRIMARY_ADDRESS_STATE'])) $overlib_string .= $fields['PRIMARY_ADDRESS_STATE'] . ' '; |
|
61 | + if(!empty($fields['PRIMARY_ADDRESS_POSTALCODE'])) $overlib_string .= $fields['PRIMARY_ADDRESS_POSTALCODE'] . ' '; |
|
62 | + if(!empty($fields['PRIMARY_ADDRESS_COUNTRY'])) $overlib_string .= $fields['PRIMARY_ADDRESS_COUNTRY'] . '<br>'; |
|
63 | + if(strlen($overlib_string) > 0 && !(strrpos($overlib_string, '<br>') == strlen($overlib_string) - 4)) |
|
64 | + $overlib_string .= '<br>'; |
|
65 | + if(!empty($fields['PHONE_MOBILE'])) $overlib_string .= '<b>'. $mod_strings['LBL_MOBILE_PHONE'] . '</b> <span class="phone">' . $fields['PHONE_MOBILE'] . '</span><br>'; |
|
66 | + if(!empty($fields['PHONE_HOME'])) $overlib_string .= '<b>'. $mod_strings['LBL_HOME_PHONE'] . '</b> <span class="phone">' . $fields['PHONE_HOME'] . '</span><br>'; |
|
67 | + if(!empty($fields['PHONE_OTHER'])) $overlib_string .= '<b>'. $mod_strings['LBL_OTHER_PHONE'] . '</b> <span class="phone">' . $fields['PHONE_OTHER'] . '</span><br>'; |
|
68 | 68 | |
69 | - if(!empty($fields['EMAIL1'])) |
|
70 | - $overlib_string .= '<b>'. $mod_strings['LBL_EMAIL_ADDRESS'] . '</b> ' . |
|
71 | - "<a href=index.php?module=Emails&action=Compose&contact_id={$fields['ID']}&" . |
|
72 | - "parent_type=Contacts&parent_id={$fields['ID']}&to_addrs_ids={$fields['ID']}&to_addrs_names" . |
|
73 | - "={$fields['FIRST_NAME']} {$fields['LAST_NAME']}&to_addrs_emails={$fields['EMAIL1']}&" . |
|
74 | - "to_email_addrs=" . urlencode("{$fields['FIRST_NAME']} {$fields['LAST_NAME']} <{$fields['EMAIL1']}>") . |
|
75 | - "&return_module=Contacts&return_action=ListView'>{$fields['EMAIL1']}</a><br>"; |
|
76 | - if(!empty($fields['EMAIL2'])) |
|
77 | - $overlib_string .= '<b>'. $mod_strings['LBL_OTHER_EMAIL_ADDRESS'] . '</b> ' . |
|
78 | - "<a href=index.php?module=Emails&action=Compose&contact_id={$fields['ID']}&" . |
|
79 | - "parent_type=Contacts&parent_id={$fields['ID']}&to_addrs_ids={$fields['ID']}&to_addrs_names" . |
|
80 | - "={$fields['FIRST_NAME']} {$fields['LAST_NAME']}&to_addrs_emails={$fields['EMAIL2']}&" . |
|
81 | - "to_email_addrs=" . urlencode("{$fields['FIRST_NAME']} {$fields['LAST_NAME']} <{$fields['EMAIL2']}>") . |
|
82 | - "&return_module=Contacts&return_action=ListView'>{$fields['EMAIL2']}</a><br>"; |
|
69 | + if(!empty($fields['EMAIL1'])) |
|
70 | + $overlib_string .= '<b>'. $mod_strings['LBL_EMAIL_ADDRESS'] . '</b> ' . |
|
71 | + "<a href=index.php?module=Emails&action=Compose&contact_id={$fields['ID']}&" . |
|
72 | + "parent_type=Contacts&parent_id={$fields['ID']}&to_addrs_ids={$fields['ID']}&to_addrs_names" . |
|
73 | + "={$fields['FIRST_NAME']} {$fields['LAST_NAME']}&to_addrs_emails={$fields['EMAIL1']}&" . |
|
74 | + "to_email_addrs=" . urlencode("{$fields['FIRST_NAME']} {$fields['LAST_NAME']} <{$fields['EMAIL1']}>") . |
|
75 | + "&return_module=Contacts&return_action=ListView'>{$fields['EMAIL1']}</a><br>"; |
|
76 | + if(!empty($fields['EMAIL2'])) |
|
77 | + $overlib_string .= '<b>'. $mod_strings['LBL_OTHER_EMAIL_ADDRESS'] . '</b> ' . |
|
78 | + "<a href=index.php?module=Emails&action=Compose&contact_id={$fields['ID']}&" . |
|
79 | + "parent_type=Contacts&parent_id={$fields['ID']}&to_addrs_ids={$fields['ID']}&to_addrs_names" . |
|
80 | + "={$fields['FIRST_NAME']} {$fields['LAST_NAME']}&to_addrs_emails={$fields['EMAIL2']}&" . |
|
81 | + "to_email_addrs=" . urlencode("{$fields['FIRST_NAME']} {$fields['LAST_NAME']} <{$fields['EMAIL2']}>") . |
|
82 | + "&return_module=Contacts&return_action=ListView'>{$fields['EMAIL2']}</a><br>"; |
|
83 | 83 | |
84 | - if(!empty($fields['DESCRIPTION'])) { |
|
85 | - $overlib_string .= '<b>'. $mod_strings['LBL_DESCRIPTION'] . '</b> ' . substr($fields['DESCRIPTION'], 0, 300); |
|
86 | - if(strlen($fields['DESCRIPTION']) > 300) $overlib_string .= '...'; |
|
87 | - } |
|
84 | + if(!empty($fields['DESCRIPTION'])) { |
|
85 | + $overlib_string .= '<b>'. $mod_strings['LBL_DESCRIPTION'] . '</b> ' . substr($fields['DESCRIPTION'], 0, 300); |
|
86 | + if(strlen($fields['DESCRIPTION']) > 300) $overlib_string .= '...'; |
|
87 | + } |
|
88 | 88 | |
89 | - return array('fieldToAddTo' => 'FULL_NAME', |
|
90 | - 'string' => $overlib_string, |
|
91 | - 'editLink' => "index.php?action=EditView&module=Prospects&return_module=Prospects&record={$fields['ID']}", |
|
92 | - 'viewLink' => "index.php?action=DetailView&module=Prospects&return_module=Prospects&record={$fields['ID']}"); |
|
89 | + return array('fieldToAddTo' => 'FULL_NAME', |
|
90 | + 'string' => $overlib_string, |
|
91 | + 'editLink' => "index.php?action=EditView&module=Prospects&return_module=Prospects&record={$fields['ID']}", |
|
92 | + 'viewLink' => "index.php?action=DetailView&module=Prospects&return_module=Prospects&record={$fields['ID']}"); |
|
93 | 93 | |
94 | 94 | } |
95 | 95 | |
96 | - ?> |
|
96 | + ?> |
|
97 | 97 |