@@ -40,23 +40,23 @@ |
||
40 | 40 | |
41 | 41 | |
42 | 42 | $fields_array['Schedulers_jobs'] = array ( |
43 | - 'column_fields' => array ( |
|
44 | - 'id', |
|
45 | - 'deleted', |
|
46 | - 'date_entered', |
|
47 | - 'date_modified', |
|
48 | - 'job_id', |
|
49 | - 'execute_time', |
|
50 | - 'status', |
|
51 | - ), |
|
52 | - 'list_fields' => array ( |
|
53 | - 'id', |
|
54 | - 'job_id', |
|
55 | - 'execute_time' |
|
56 | - ), |
|
57 | - 'required_fields' => array ( |
|
58 | - 'job_id' => 1, |
|
59 | - 'execute_time' => 1 |
|
60 | - ) |
|
43 | + 'column_fields' => array ( |
|
44 | + 'id', |
|
45 | + 'deleted', |
|
46 | + 'date_entered', |
|
47 | + 'date_modified', |
|
48 | + 'job_id', |
|
49 | + 'execute_time', |
|
50 | + 'status', |
|
51 | + ), |
|
52 | + 'list_fields' => array ( |
|
53 | + 'id', |
|
54 | + 'job_id', |
|
55 | + 'execute_time' |
|
56 | + ), |
|
57 | + 'required_fields' => array ( |
|
58 | + 'job_id' => 1, |
|
59 | + 'execute_time' => 1 |
|
60 | + ) |
|
61 | 61 | ); |
62 | 62 | ?> |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
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. |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | ********************************************************************************/ |
40 | 40 | |
41 | 41 | |
42 | -$fields_array['Schedulers_jobs'] = array ( |
|
43 | - 'column_fields' => array ( |
|
42 | +$fields_array['Schedulers_jobs'] = array( |
|
43 | + 'column_fields' => array( |
|
44 | 44 | 'id', |
45 | 45 | 'deleted', |
46 | 46 | 'date_entered', |
@@ -49,12 +49,12 @@ discard block |
||
49 | 49 | 'execute_time', |
50 | 50 | 'status', |
51 | 51 | ), |
52 | - 'list_fields' => array ( |
|
52 | + 'list_fields' => array( |
|
53 | 53 | 'id', |
54 | 54 | 'job_id', |
55 | 55 | 'execute_time' |
56 | 56 | ), |
57 | - 'required_fields' => array ( |
|
57 | + 'required_fields' => array( |
|
58 | 58 | 'job_id' => 1, |
59 | 59 | 'execute_time' => 1 |
60 | 60 | ) |
@@ -1,5 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
3 | + die('Not A Valid Entry Point'); |
|
4 | +} |
|
3 | 5 | /********************************************************************************* |
4 | 6 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 7 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -55,17 +55,17 @@ discard block |
||
55 | 55 | const JOB_FAILURE = 'failure'; |
56 | 56 | |
57 | 57 | // schema attributes |
58 | - public $id; |
|
59 | - public $name; |
|
60 | - public $deleted; |
|
61 | - public $date_entered; |
|
62 | - public $date_modified; |
|
63 | - public $scheduler_id; |
|
64 | - public $execute_time; // when to execute |
|
58 | + public $id; |
|
59 | + public $name; |
|
60 | + public $deleted; |
|
61 | + public $date_entered; |
|
62 | + public $date_modified; |
|
63 | + public $scheduler_id; |
|
64 | + public $execute_time; // when to execute |
|
65 | 65 | public $status; |
66 | 66 | public $resolution; |
67 | 67 | public $message; |
68 | - public $target; // URL or function name |
|
68 | + public $target; // URL or function name |
|
69 | 69 | public $data; // Data set |
70 | 70 | public $requeue; // Requeue on failure? |
71 | 71 | public $retry_count; |
@@ -76,61 +76,61 @@ discard block |
||
76 | 76 | public $execute_time_db; |
77 | 77 | public $percent_complete; // how much of the job is done |
78 | 78 | |
79 | - // standard SugarBean child attrs |
|
80 | - var $table_name = "job_queue"; |
|
81 | - var $object_name = "SchedulersJob"; |
|
82 | - var $module_dir = "SchedulersJobs"; |
|
83 | - var $new_schema = true; |
|
84 | - var $process_save_dates = true; |
|
85 | - // related fields |
|
86 | - var $job_name; // the Scheduler's 'name' field |
|
87 | - var $job; // the Scheduler's 'job' field |
|
88 | - // object specific attributes |
|
89 | - public $user; // User object |
|
90 | - var $scheduler; // Scheduler parent |
|
91 | - public $min_interval = 30; // minimal interval for job reruns |
|
92 | - protected $job_done = true; |
|
79 | + // standard SugarBean child attrs |
|
80 | + var $table_name = "job_queue"; |
|
81 | + var $object_name = "SchedulersJob"; |
|
82 | + var $module_dir = "SchedulersJobs"; |
|
83 | + var $new_schema = true; |
|
84 | + var $process_save_dates = true; |
|
85 | + // related fields |
|
86 | + var $job_name; // the Scheduler's 'name' field |
|
87 | + var $job; // the Scheduler's 'job' field |
|
88 | + // object specific attributes |
|
89 | + public $user; // User object |
|
90 | + var $scheduler; // Scheduler parent |
|
91 | + public $min_interval = 30; // minimal interval for job reruns |
|
92 | + protected $job_done = true; |
|
93 | 93 | protected $old_user; |
94 | 94 | |
95 | - /** |
|
96 | - * Job constructor. |
|
97 | - */ |
|
98 | - function SchedulersJob() |
|
99 | - { |
|
95 | + /** |
|
96 | + * Job constructor. |
|
97 | + */ |
|
98 | + function SchedulersJob() |
|
99 | + { |
|
100 | 100 | parent::Basic(); |
101 | 101 | if(!empty($GLOBALS['sugar_config']['jobs']['min_retry_interval'])) { |
102 | 102 | $this->min_interval = $GLOBALS['sugar_config']['jobs']['min_retry_interval']; |
103 | 103 | } |
104 | - } |
|
104 | + } |
|
105 | 105 | |
106 | - public function check_date_relationships_load() |
|
107 | - { |
|
106 | + public function check_date_relationships_load() |
|
107 | + { |
|
108 | 108 | // Hack to work around the mess with dates being auto-converted to user format on retrieve |
109 | - $this->execute_time_db = $this->db->fromConvert($this->execute_time, 'datetime'); |
|
110 | - parent::check_date_relationships_load(); |
|
109 | + $this->execute_time_db = $this->db->fromConvert($this->execute_time, 'datetime'); |
|
110 | + parent::check_date_relationships_load(); |
|
111 | 111 | } |
112 | - /** |
|
112 | + /** |
|
113 | 113 | * handleDateFormat |
114 | 114 | * |
115 | - * This function handles returning a datetime value. It allows a user instance to be passed in, but will default to the |
|
115 | + * This function handles returning a datetime value. It allows a user instance to be passed in, but will default to the |
|
116 | 116 | * user member variable instance if none is found. |
117 | 117 | * |
118 | - * @param string $date String value of the date to calculate, defaults to 'now' |
|
119 | - * @param object $user The User instance to use in calculating the time value, if empty, it will default to user member variable |
|
120 | - * @param boolean $user_format Boolean indicating whether or not to convert to user's time format, defaults to false |
|
118 | + * @param string $date String value of the date to calculate, defaults to 'now' |
|
119 | + * @param object $user The User instance to use in calculating the time value, if empty, it will default to user member variable |
|
120 | + * @param boolean $user_format Boolean indicating whether or not to convert to user's time format, defaults to false |
|
121 | 121 | * |
122 | - * @return string Formatted datetime value |
|
123 | - */ |
|
124 | - function handleDateFormat($date='now', $user=null, $user_format=false) { |
|
125 | - global $timedate; |
|
122 | + * @return string Formatted datetime value |
|
123 | + */ |
|
124 | + function handleDateFormat($date='now', $user=null, $user_format=false) { |
|
125 | + global $timedate; |
|
126 | 126 | |
127 | - if(!isset($timedate) || empty($timedate)) |
|
127 | + if(!isset($timedate) || empty($timedate)) |
|
128 | 128 | { |
129 | - $timedate = new TimeDate(); |
|
130 | - } |
|
129 | + $timedate = new TimeDate(); |
|
130 | + } |
|
131 | 131 | |
132 | - // get user for calculation |
|
133 | - $user = (empty($user)) ? $this->user : $user; |
|
132 | + // get user for calculation |
|
133 | + $user = (empty($user)) ? $this->user : $user; |
|
134 | 134 | |
135 | 135 | if($date == 'now') |
136 | 136 | { |
@@ -141,109 +141,109 @@ discard block |
||
141 | 141 | |
142 | 142 | // if $user_format is set to true then just return as th user's time format, otherwise, return as database format |
143 | 143 | return $user_format ? $dbTime : $timedate->fromUser($dbTime, $user)->asDb(); |
144 | - } |
|
145 | - |
|
146 | - |
|
147 | - /////////////////////////////////////////////////////////////////////////// |
|
148 | - //// SCHEDULERSJOB HELPER FUNCTIONS |
|
149 | - |
|
150 | - /** |
|
151 | - * This function takes a passed URL and cURLs it to fake multi-threading with another httpd instance |
|
152 | - * @param $job String in URI-clean format |
|
153 | - * @param $timeout Int value in secs for cURL to timeout. 30 default. |
|
154 | - */ |
|
155 | - public function fireUrl($job, $timeout=30) |
|
156 | - { |
|
157 | - // TODO: figure out what error is thrown when no more apache instances can be spun off |
|
158 | - // cURL inits |
|
159 | - $ch = curl_init(); |
|
160 | - curl_setopt($ch, CURLOPT_URL, $job); // set url |
|
161 | - curl_setopt($ch, CURLOPT_FAILONERROR, true); // silent failure (code >300); |
|
162 | - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // do not follow location(); inits - we always use the current |
|
163 | - curl_setopt($ch, CURLOPT_FORBID_REUSE, 1); |
|
164 | - curl_setopt($ch, CURLOPT_DNS_USE_GLOBAL_CACHE, false); // not thread-safe |
|
165 | - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // return into a variable to continue program execution |
|
166 | - curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); // never times out - bad idea? |
|
167 | - curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); // 5 secs for connect timeout |
|
168 | - curl_setopt($ch, CURLOPT_FRESH_CONNECT, true); // open brand new conn |
|
169 | - curl_setopt($ch, CURLOPT_HEADER, true); // do not return header info with result |
|
170 | - curl_setopt($ch, CURLOPT_NOPROGRESS, true); // do not have progress bar |
|
171 | - $urlparts = parse_url($job); |
|
172 | - if(empty($urlparts['port'])) { |
|
173 | - if($urlparts['scheme'] == 'https'){ |
|
174 | - $urlparts['port'] = 443; |
|
175 | - } else { |
|
176 | - $urlparts['port'] = 80; |
|
177 | - } |
|
178 | - } |
|
179 | - curl_setopt($ch, CURLOPT_PORT, $urlparts['port']); // set port as reported by Server |
|
180 | - //TODO make the below configurable |
|
181 | - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); // most customers will not have Certificate Authority account |
|
182 | - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // most customers will not have Certificate Authority account |
|
183 | - |
|
184 | - curl_setopt($ch, CURLOPT_NOSIGNAL, true); // ignore any cURL signals to PHP (for multi-threading) |
|
185 | - $result = curl_exec($ch); |
|
186 | - $cInfo = curl_getinfo($ch); //url,content_type,header_size,request_size,filetime,http_code |
|
187 | - //ssl_verify_result,total_time,namelookup_time,connect_time |
|
188 | - //pretransfer_time,size_upload,size_download,speed_download, |
|
189 | - //speed_upload,download_content_length,upload_content_length |
|
190 | - //starttransfer_time,redirect_time |
|
191 | - if(curl_errno($ch)) { |
|
192 | - $this->errors .= curl_errno($ch)."\n"; |
|
193 | - } |
|
194 | - curl_close($ch); |
|
195 | - |
|
196 | - if($result !== FALSE && $cInfo['http_code'] < 400) { |
|
197 | - $GLOBALS['log']->debug("----->Firing was successful: $job"); |
|
198 | - $GLOBALS['log']->debug('----->WTIH RESULT: '.strip_tags($result).' AND '.strip_tags(print_r($cInfo, true))); |
|
199 | - return true; |
|
200 | - } else { |
|
201 | - $GLOBALS['log']->fatal("Job failed: $job"); |
|
202 | - return false; |
|
203 | - } |
|
204 | - } |
|
205 | - //// END SCHEDULERSJOB HELPER FUNCTIONS |
|
206 | - /////////////////////////////////////////////////////////////////////////// |
|
207 | - |
|
208 | - |
|
209 | - /////////////////////////////////////////////////////////////////////////// |
|
210 | - //// STANDARD SUGARBEAN OVERRIDES |
|
211 | - /** |
|
212 | - * This function gets DB data and preps it for ListViews |
|
213 | - */ |
|
214 | - function get_list_view_data() |
|
215 | - { |
|
216 | - global $mod_strings; |
|
217 | - |
|
218 | - $temp_array = $this->get_list_view_array(); |
|
219 | - $temp_array['JOB_NAME'] = $this->job_name; |
|
220 | - $temp_array['JOB'] = $this->job; |
|
221 | - |
|
222 | - return $temp_array; |
|
223 | - } |
|
224 | - |
|
225 | - /** method stub for future customization |
|
226 | - * |
|
227 | - */ |
|
228 | - function fill_in_additional_list_fields() |
|
229 | - { |
|
230 | - $this->fill_in_additional_detail_fields(); |
|
231 | - } |
|
232 | - |
|
233 | - |
|
234 | - /** |
|
235 | - * Mark this job as failed |
|
236 | - * @param string $message |
|
237 | - */ |
|
144 | + } |
|
145 | + |
|
146 | + |
|
147 | + /////////////////////////////////////////////////////////////////////////// |
|
148 | + //// SCHEDULERSJOB HELPER FUNCTIONS |
|
149 | + |
|
150 | + /** |
|
151 | + * This function takes a passed URL and cURLs it to fake multi-threading with another httpd instance |
|
152 | + * @param $job String in URI-clean format |
|
153 | + * @param $timeout Int value in secs for cURL to timeout. 30 default. |
|
154 | + */ |
|
155 | + public function fireUrl($job, $timeout=30) |
|
156 | + { |
|
157 | + // TODO: figure out what error is thrown when no more apache instances can be spun off |
|
158 | + // cURL inits |
|
159 | + $ch = curl_init(); |
|
160 | + curl_setopt($ch, CURLOPT_URL, $job); // set url |
|
161 | + curl_setopt($ch, CURLOPT_FAILONERROR, true); // silent failure (code >300); |
|
162 | + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // do not follow location(); inits - we always use the current |
|
163 | + curl_setopt($ch, CURLOPT_FORBID_REUSE, 1); |
|
164 | + curl_setopt($ch, CURLOPT_DNS_USE_GLOBAL_CACHE, false); // not thread-safe |
|
165 | + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // return into a variable to continue program execution |
|
166 | + curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); // never times out - bad idea? |
|
167 | + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); // 5 secs for connect timeout |
|
168 | + curl_setopt($ch, CURLOPT_FRESH_CONNECT, true); // open brand new conn |
|
169 | + curl_setopt($ch, CURLOPT_HEADER, true); // do not return header info with result |
|
170 | + curl_setopt($ch, CURLOPT_NOPROGRESS, true); // do not have progress bar |
|
171 | + $urlparts = parse_url($job); |
|
172 | + if(empty($urlparts['port'])) { |
|
173 | + if($urlparts['scheme'] == 'https'){ |
|
174 | + $urlparts['port'] = 443; |
|
175 | + } else { |
|
176 | + $urlparts['port'] = 80; |
|
177 | + } |
|
178 | + } |
|
179 | + curl_setopt($ch, CURLOPT_PORT, $urlparts['port']); // set port as reported by Server |
|
180 | + //TODO make the below configurable |
|
181 | + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); // most customers will not have Certificate Authority account |
|
182 | + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // most customers will not have Certificate Authority account |
|
183 | + |
|
184 | + curl_setopt($ch, CURLOPT_NOSIGNAL, true); // ignore any cURL signals to PHP (for multi-threading) |
|
185 | + $result = curl_exec($ch); |
|
186 | + $cInfo = curl_getinfo($ch); //url,content_type,header_size,request_size,filetime,http_code |
|
187 | + //ssl_verify_result,total_time,namelookup_time,connect_time |
|
188 | + //pretransfer_time,size_upload,size_download,speed_download, |
|
189 | + //speed_upload,download_content_length,upload_content_length |
|
190 | + //starttransfer_time,redirect_time |
|
191 | + if(curl_errno($ch)) { |
|
192 | + $this->errors .= curl_errno($ch)."\n"; |
|
193 | + } |
|
194 | + curl_close($ch); |
|
195 | + |
|
196 | + if($result !== FALSE && $cInfo['http_code'] < 400) { |
|
197 | + $GLOBALS['log']->debug("----->Firing was successful: $job"); |
|
198 | + $GLOBALS['log']->debug('----->WTIH RESULT: '.strip_tags($result).' AND '.strip_tags(print_r($cInfo, true))); |
|
199 | + return true; |
|
200 | + } else { |
|
201 | + $GLOBALS['log']->fatal("Job failed: $job"); |
|
202 | + return false; |
|
203 | + } |
|
204 | + } |
|
205 | + //// END SCHEDULERSJOB HELPER FUNCTIONS |
|
206 | + /////////////////////////////////////////////////////////////////////////// |
|
207 | + |
|
208 | + |
|
209 | + /////////////////////////////////////////////////////////////////////////// |
|
210 | + //// STANDARD SUGARBEAN OVERRIDES |
|
211 | + /** |
|
212 | + * This function gets DB data and preps it for ListViews |
|
213 | + */ |
|
214 | + function get_list_view_data() |
|
215 | + { |
|
216 | + global $mod_strings; |
|
217 | + |
|
218 | + $temp_array = $this->get_list_view_array(); |
|
219 | + $temp_array['JOB_NAME'] = $this->job_name; |
|
220 | + $temp_array['JOB'] = $this->job; |
|
221 | + |
|
222 | + return $temp_array; |
|
223 | + } |
|
224 | + |
|
225 | + /** method stub for future customization |
|
226 | + * |
|
227 | + */ |
|
228 | + function fill_in_additional_list_fields() |
|
229 | + { |
|
230 | + $this->fill_in_additional_detail_fields(); |
|
231 | + } |
|
232 | + |
|
233 | + |
|
234 | + /** |
|
235 | + * Mark this job as failed |
|
236 | + * @param string $message |
|
237 | + */ |
|
238 | 238 | public function failJob($message = null) |
239 | 239 | { |
240 | 240 | return $this->resolveJob(self::JOB_FAILURE, $message); |
241 | 241 | } |
242 | 242 | |
243 | - /** |
|
244 | - * Mark this job as success |
|
245 | - * @param string $message |
|
246 | - */ |
|
243 | + /** |
|
244 | + * Mark this job as success |
|
245 | + * @param string $message |
|
246 | + */ |
|
247 | 247 | public function succeedJob($message = null) |
248 | 248 | { |
249 | 249 | return $this->resolveJob(self::JOB_SUCCESS, $message); |
@@ -413,28 +413,28 @@ discard block |
||
413 | 413 | { |
414 | 414 | switch($errno) |
415 | 415 | { |
416 | - case E_USER_WARNING: |
|
417 | - case E_COMPILE_WARNING: |
|
418 | - case E_CORE_WARNING: |
|
419 | - case E_WARNING: |
|
420 | - $type = "Warning"; |
|
421 | - break; |
|
422 | - case E_USER_ERROR: |
|
423 | - case E_COMPILE_ERROR: |
|
424 | - case E_CORE_ERROR: |
|
425 | - case E_ERROR: |
|
426 | - $type = "Fatal Error"; |
|
427 | - break; |
|
428 | - case E_PARSE: |
|
429 | - $type = "Parse Error"; |
|
430 | - break; |
|
431 | - case E_RECOVERABLE_ERROR: |
|
432 | - $type = "Recoverable Error"; |
|
433 | - break; |
|
434 | - default: |
|
435 | - // Ignore errors we don't know about |
|
436 | - return; |
|
437 | - } |
|
416 | + case E_USER_WARNING: |
|
417 | + case E_COMPILE_WARNING: |
|
418 | + case E_CORE_WARNING: |
|
419 | + case E_WARNING: |
|
420 | + $type = "Warning"; |
|
421 | + break; |
|
422 | + case E_USER_ERROR: |
|
423 | + case E_COMPILE_ERROR: |
|
424 | + case E_CORE_ERROR: |
|
425 | + case E_ERROR: |
|
426 | + $type = "Fatal Error"; |
|
427 | + break; |
|
428 | + case E_PARSE: |
|
429 | + $type = "Parse Error"; |
|
430 | + break; |
|
431 | + case E_RECOVERABLE_ERROR: |
|
432 | + $type = "Recoverable Error"; |
|
433 | + break; |
|
434 | + default: |
|
435 | + // Ignore errors we don't know about |
|
436 | + return; |
|
437 | + } |
|
438 | 438 | $errstr = strip_tags($errstr); |
439 | 439 | $this->errors .= sprintf(translate('ERR_PHP', 'SchedulersJobs'), $type, $errno, $errstr, $errfile, $errline)."\n"; |
440 | 440 | } |
@@ -451,13 +451,13 @@ discard block |
||
451 | 451 | session_destroy(); |
452 | 452 | } |
453 | 453 | if(!headers_sent()) { |
454 | - session_start(); |
|
454 | + session_start(); |
|
455 | 455 | session_regenerate_id(); |
456 | 456 | } |
457 | 457 | $_SESSION['is_valid_session']= true; |
458 | - $_SESSION['user_id'] = $user->id; |
|
459 | - $_SESSION['type'] = 'user'; |
|
460 | - $_SESSION['authenticated_user_id'] = $user->id; |
|
458 | + $_SESSION['user_id'] = $user->id; |
|
459 | + $_SESSION['type'] = 'user'; |
|
460 | + $_SESSION['authenticated_user_id'] = $user->id; |
|
461 | 461 | } |
462 | 462 | |
463 | 463 | /** |
@@ -509,48 +509,48 @@ discard block |
||
509 | 509 | if(!$this->setJobUser()) { |
510 | 510 | return false; |
511 | 511 | } |
512 | - $func = $exJob[1]; |
|
513 | - $GLOBALS['log']->debug("----->SchedulersJob calling function: $func"); |
|
512 | + $func = $exJob[1]; |
|
513 | + $GLOBALS['log']->debug("----->SchedulersJob calling function: $func"); |
|
514 | 514 | set_error_handler(array($this, "errorHandler"), E_ALL & ~E_NOTICE & ~E_STRICT); |
515 | - if(!is_callable($func)) { |
|
516 | - $this->resolveJob(self::JOB_FAILURE, sprintf(translate('ERR_CALL', 'SchedulersJobs'), $func)); |
|
517 | - } |
|
518 | - $data = array($this); |
|
519 | - if(!empty($this->data)) { |
|
520 | - $data[] = $this->data; |
|
521 | - } |
|
515 | + if(!is_callable($func)) { |
|
516 | + $this->resolveJob(self::JOB_FAILURE, sprintf(translate('ERR_CALL', 'SchedulersJobs'), $func)); |
|
517 | + } |
|
518 | + $data = array($this); |
|
519 | + if(!empty($this->data)) { |
|
520 | + $data[] = $this->data; |
|
521 | + } |
|
522 | 522 | $res = call_user_func_array($func, $data); |
523 | 523 | restore_error_handler(); |
524 | 524 | $this->restoreJobUser(); |
525 | - if($this->status == self::JOB_STATUS_RUNNING) { |
|
526 | - // nobody updated the status yet - job function could do that |
|
527 | - if($res) { |
|
528 | - $this->resolveJob(self::JOB_SUCCESS); |
|
529 | - return true; |
|
530 | - } else { |
|
531 | - $this->resolveJob(self::JOB_FAILURE); |
|
532 | - return false; |
|
533 | - } |
|
534 | - } else { |
|
535 | - return $this->resolution != self::JOB_FAILURE; |
|
536 | - } |
|
537 | - } elseif($exJob[0] == 'url') { |
|
538 | - if(function_exists('curl_init')) { |
|
539 | - $GLOBALS['log']->debug('----->SchedulersJob firing URL job: '.$exJob[1]); |
|
525 | + if($this->status == self::JOB_STATUS_RUNNING) { |
|
526 | + // nobody updated the status yet - job function could do that |
|
527 | + if($res) { |
|
528 | + $this->resolveJob(self::JOB_SUCCESS); |
|
529 | + return true; |
|
530 | + } else { |
|
531 | + $this->resolveJob(self::JOB_FAILURE); |
|
532 | + return false; |
|
533 | + } |
|
534 | + } else { |
|
535 | + return $this->resolution != self::JOB_FAILURE; |
|
536 | + } |
|
537 | + } elseif($exJob[0] == 'url') { |
|
538 | + if(function_exists('curl_init')) { |
|
539 | + $GLOBALS['log']->debug('----->SchedulersJob firing URL job: '.$exJob[1]); |
|
540 | 540 | set_error_handler(array($this, "errorHandler"), E_ALL & ~E_NOTICE & ~E_STRICT); |
541 | - if($this->fireUrl($exJob[1])) { |
|
541 | + if($this->fireUrl($exJob[1])) { |
|
542 | 542 | restore_error_handler(); |
543 | 543 | $this->resolveJob(self::JOB_SUCCESS); |
544 | - return true; |
|
545 | - } else { |
|
544 | + return true; |
|
545 | + } else { |
|
546 | 546 | restore_error_handler(); |
547 | - $this->resolveJob(self::JOB_FAILURE); |
|
548 | - return false; |
|
549 | - } |
|
550 | - } else { |
|
551 | - $this->resolveJob(self::JOB_FAILURE, translate('ERR_CURL', 'SchedulersJobs')); |
|
552 | - } |
|
553 | - } elseif ($exJob[0] == 'class') { |
|
547 | + $this->resolveJob(self::JOB_FAILURE); |
|
548 | + return false; |
|
549 | + } |
|
550 | + } else { |
|
551 | + $this->resolveJob(self::JOB_FAILURE, translate('ERR_CURL', 'SchedulersJobs')); |
|
552 | + } |
|
553 | + } elseif ($exJob[0] == 'class') { |
|
554 | 554 | $tmpJob = new $exJob[1](); |
555 | 555 | if($tmpJob instanceof RunnableSchedulerJob) |
556 | 556 | { |
@@ -579,9 +579,9 @@ discard block |
||
579 | 579 | } |
580 | 580 | } |
581 | 581 | else { |
582 | - $this->resolveJob(self::JOB_FAILURE, sprintf(translate('ERR_JOBTYPE', 'SchedulersJobs'), strip_tags($this->target))); |
|
583 | - } |
|
584 | - return false; |
|
582 | + $this->resolveJob(self::JOB_FAILURE, sprintf(translate('ERR_JOBTYPE', 'SchedulersJobs'), strip_tags($this->target))); |
|
583 | + } |
|
584 | + return false; |
|
585 | 585 | } |
586 | 586 | |
587 | 587 | } // end class Job |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
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. |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | public $requeue; // Requeue on failure? |
71 | 71 | public $retry_count; |
72 | 72 | public $failure_count; |
73 | - public $job_delay=0; // Frequency to run it |
|
73 | + public $job_delay = 0; // Frequency to run it |
|
74 | 74 | public $assigned_user_id; // User under which the task is running |
75 | 75 | public $client; // Client ID that owns this job |
76 | 76 | public $execute_time_db; |
@@ -78,13 +78,13 @@ discard block |
||
78 | 78 | |
79 | 79 | // standard SugarBean child attrs |
80 | 80 | var $table_name = "job_queue"; |
81 | - var $object_name = "SchedulersJob"; |
|
81 | + var $object_name = "SchedulersJob"; |
|
82 | 82 | var $module_dir = "SchedulersJobs"; |
83 | 83 | var $new_schema = true; |
84 | 84 | var $process_save_dates = true; |
85 | 85 | // related fields |
86 | - var $job_name; // the Scheduler's 'name' field |
|
87 | - var $job; // the Scheduler's 'job' field |
|
86 | + var $job_name; // the Scheduler's 'name' field |
|
87 | + var $job; // the Scheduler's 'job' field |
|
88 | 88 | // object specific attributes |
89 | 89 | public $user; // User object |
90 | 90 | var $scheduler; // Scheduler parent |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | function SchedulersJob() |
99 | 99 | { |
100 | 100 | parent::Basic(); |
101 | - if(!empty($GLOBALS['sugar_config']['jobs']['min_retry_interval'])) { |
|
101 | + if (!empty($GLOBALS['sugar_config']['jobs']['min_retry_interval'])) { |
|
102 | 102 | $this->min_interval = $GLOBALS['sugar_config']['jobs']['min_retry_interval']; |
103 | 103 | } |
104 | 104 | } |
@@ -121,10 +121,10 @@ discard block |
||
121 | 121 | * |
122 | 122 | * @return string Formatted datetime value |
123 | 123 | */ |
124 | - function handleDateFormat($date='now', $user=null, $user_format=false) { |
|
124 | + function handleDateFormat($date = 'now', $user = null, $user_format = false) { |
|
125 | 125 | global $timedate; |
126 | 126 | |
127 | - if(!isset($timedate) || empty($timedate)) |
|
127 | + if (!isset($timedate) || empty($timedate)) |
|
128 | 128 | { |
129 | 129 | $timedate = new TimeDate(); |
130 | 130 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | // get user for calculation |
133 | 133 | $user = (empty($user)) ? $this->user : $user; |
134 | 134 | |
135 | - if($date == 'now') |
|
135 | + if ($date == 'now') |
|
136 | 136 | { |
137 | 137 | $dbTime = $timedate->asUser($timedate->getNow(), $user); |
138 | 138 | } else { |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | * @param $job String in URI-clean format |
153 | 153 | * @param $timeout Int value in secs for cURL to timeout. 30 default. |
154 | 154 | */ |
155 | - public function fireUrl($job, $timeout=30) |
|
155 | + public function fireUrl($job, $timeout = 30) |
|
156 | 156 | { |
157 | 157 | // TODO: figure out what error is thrown when no more apache instances can be spun off |
158 | 158 | // cURL inits |
@@ -161,16 +161,16 @@ discard block |
||
161 | 161 | curl_setopt($ch, CURLOPT_FAILONERROR, true); // silent failure (code >300); |
162 | 162 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // do not follow location(); inits - we always use the current |
163 | 163 | curl_setopt($ch, CURLOPT_FORBID_REUSE, 1); |
164 | - curl_setopt($ch, CURLOPT_DNS_USE_GLOBAL_CACHE, false); // not thread-safe |
|
164 | + curl_setopt($ch, CURLOPT_DNS_USE_GLOBAL_CACHE, false); // not thread-safe |
|
165 | 165 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // return into a variable to continue program execution |
166 | 166 | curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); // never times out - bad idea? |
167 | 167 | curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); // 5 secs for connect timeout |
168 | - curl_setopt($ch, CURLOPT_FRESH_CONNECT, true); // open brand new conn |
|
168 | + curl_setopt($ch, CURLOPT_FRESH_CONNECT, true); // open brand new conn |
|
169 | 169 | curl_setopt($ch, CURLOPT_HEADER, true); // do not return header info with result |
170 | 170 | curl_setopt($ch, CURLOPT_NOPROGRESS, true); // do not have progress bar |
171 | 171 | $urlparts = parse_url($job); |
172 | - if(empty($urlparts['port'])) { |
|
173 | - if($urlparts['scheme'] == 'https'){ |
|
172 | + if (empty($urlparts['port'])) { |
|
173 | + if ($urlparts['scheme'] == 'https') { |
|
174 | 174 | $urlparts['port'] = 443; |
175 | 175 | } else { |
176 | 176 | $urlparts['port'] = 80; |
@@ -183,17 +183,17 @@ discard block |
||
183 | 183 | |
184 | 184 | curl_setopt($ch, CURLOPT_NOSIGNAL, true); // ignore any cURL signals to PHP (for multi-threading) |
185 | 185 | $result = curl_exec($ch); |
186 | - $cInfo = curl_getinfo($ch); //url,content_type,header_size,request_size,filetime,http_code |
|
186 | + $cInfo = curl_getinfo($ch); //url,content_type,header_size,request_size,filetime,http_code |
|
187 | 187 | //ssl_verify_result,total_time,namelookup_time,connect_time |
188 | 188 | //pretransfer_time,size_upload,size_download,speed_download, |
189 | 189 | //speed_upload,download_content_length,upload_content_length |
190 | 190 | //starttransfer_time,redirect_time |
191 | - if(curl_errno($ch)) { |
|
191 | + if (curl_errno($ch)) { |
|
192 | 192 | $this->errors .= curl_errno($ch)."\n"; |
193 | 193 | } |
194 | 194 | curl_close($ch); |
195 | 195 | |
196 | - if($result !== FALSE && $cInfo['http_code'] < 400) { |
|
196 | + if ($result !== FALSE && $cInfo['http_code'] < 400) { |
|
197 | 197 | $GLOBALS['log']->debug("----->Firing was successful: $job"); |
198 | 198 | $GLOBALS['log']->debug('----->WTIH RESULT: '.strip_tags($result).' AND '.strip_tags(print_r($cInfo, true))); |
199 | 199 | return true; |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | |
218 | 218 | $temp_array = $this->get_list_view_array(); |
219 | 219 | $temp_array['JOB_NAME'] = $this->job_name; |
220 | - $temp_array['JOB'] = $this->job; |
|
220 | + $temp_array['JOB'] = $this->job; |
|
221 | 221 | |
222 | 222 | return $temp_array; |
223 | 223 | } |
@@ -276,12 +276,12 @@ discard block |
||
276 | 276 | public function resolveJob($resolution, $message = null) |
277 | 277 | { |
278 | 278 | $GLOBALS['log']->info("Resolving job {$this->id} as $resolution: $message"); |
279 | - if($resolution == self::JOB_FAILURE) { |
|
279 | + if ($resolution == self::JOB_FAILURE) { |
|
280 | 280 | $this->failure_count++; |
281 | - if($this->requeue && $this->retry_count > 0) { |
|
281 | + if ($this->requeue && $this->retry_count > 0) { |
|
282 | 282 | // retry failed job |
283 | 283 | $this->status = self::JOB_STATUS_QUEUED; |
284 | - if($this->job_delay < $this->min_interval) { |
|
284 | + if ($this->job_delay < $this->min_interval) { |
|
285 | 285 | $this->job_delay = $this->min_interval; |
286 | 286 | } |
287 | 287 | $this->execute_time = $GLOBALS['timedate']->getNow()->modify("+{$this->job_delay} seconds")->asDb(); |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | $this->addMessages($message); |
300 | 300 | $this->resolution = $resolution; |
301 | 301 | $this->save(); |
302 | - if($this->status == self::JOB_STATUS_DONE && $this->resolution == self::JOB_SUCCESS) { |
|
302 | + if ($this->status == self::JOB_STATUS_DONE && $this->resolution == self::JOB_SUCCESS) { |
|
303 | 303 | $this->updateSchedulerSuccess(); |
304 | 304 | } |
305 | 305 | return true; |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | */ |
311 | 311 | protected function updateSchedulerSuccess() |
312 | 312 | { |
313 | - if(empty($this->scheduler_id)) { |
|
313 | + if (empty($this->scheduler_id)) { |
|
314 | 314 | return; |
315 | 315 | } |
316 | 316 | $this->db->query("UPDATE schedulers SET last_run={$this->db->now()} WHERE id=".$this->db->quoted($this->scheduler_id)); |
@@ -323,11 +323,11 @@ discard block |
||
323 | 323 | */ |
324 | 324 | protected function addMessages($message) |
325 | 325 | { |
326 | - if(!empty($this->errors)) { |
|
326 | + if (!empty($this->errors)) { |
|
327 | 327 | $this->message .= $this->errors; |
328 | 328 | $this->errors = ''; |
329 | 329 | } |
330 | - if(!empty($message)) { |
|
330 | + if (!empty($message)) { |
|
331 | 331 | $this->message .= "$message\n"; |
332 | 332 | } |
333 | 333 | } |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | $this->status = self::JOB_STATUS_QUEUED; |
344 | 344 | $this->addMessages($message); |
345 | 345 | $this->resolution = self::JOB_PARTIAL; |
346 | - if(empty($delay)) { |
|
346 | + if (empty($delay)) { |
|
347 | 347 | $delay = intval($this->job_delay); |
348 | 348 | } |
349 | 349 | $this->execute_time = $GLOBALS['timedate']->getNow()->modify("+$delay seconds")->asDb(); |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | */ |
368 | 368 | public function unexpectedExit() |
369 | 369 | { |
370 | - if(!$this->job_done) { |
|
370 | + if (!$this->job_done) { |
|
371 | 371 | // Job wasn't properly finished, fail it |
372 | 372 | $this->resolveJob(self::JOB_FAILURE, translate('ERR_FAILED', 'SchedulersJobs')); |
373 | 373 | } |
@@ -383,15 +383,15 @@ discard block |
||
383 | 383 | { |
384 | 384 | $job = new self(); |
385 | 385 | $job->retrieve($id); |
386 | - if(empty($job->id)) { |
|
386 | + if (empty($job->id)) { |
|
387 | 387 | $GLOBALS['log']->fatal("Job $id not found."); |
388 | 388 | return "Job $id not found."; |
389 | 389 | } |
390 | - if($job->status != self::JOB_STATUS_RUNNING) { |
|
390 | + if ($job->status != self::JOB_STATUS_RUNNING) { |
|
391 | 391 | $GLOBALS['log']->fatal("Job $id is not marked as running."); |
392 | 392 | return "Job $id is not marked as running."; |
393 | 393 | } |
394 | - if($job->client != $client) { |
|
394 | + if ($job->client != $client) { |
|
395 | 395 | $GLOBALS['log']->fatal("Job $id belongs to client {$job->client}, can not run as $client."); |
396 | 396 | return "Job $id belongs to another client, can not run as $client."; |
397 | 397 | } |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | */ |
412 | 412 | public function errorHandler($errno, $errstr, $errfile, $errline) |
413 | 413 | { |
414 | - switch($errno) |
|
414 | + switch ($errno) |
|
415 | 415 | { |
416 | 416 | case E_USER_WARNING: |
417 | 417 | case E_COMPILE_WARNING: |
@@ -447,14 +447,14 @@ discard block |
||
447 | 447 | { |
448 | 448 | $GLOBALS['current_user'] = $user; |
449 | 449 | // Reset the session |
450 | - if(session_id()) { |
|
450 | + if (session_id()) { |
|
451 | 451 | session_destroy(); |
452 | 452 | } |
453 | - if(!headers_sent()) { |
|
453 | + if (!headers_sent()) { |
|
454 | 454 | session_start(); |
455 | 455 | session_regenerate_id(); |
456 | 456 | } |
457 | - $_SESSION['is_valid_session']= true; |
|
457 | + $_SESSION['is_valid_session'] = true; |
|
458 | 458 | $_SESSION['user_id'] = $user->id; |
459 | 459 | $_SESSION['type'] = 'user'; |
460 | 460 | $_SESSION['authenticated_user_id'] = $user->id; |
@@ -467,11 +467,11 @@ discard block |
||
467 | 467 | protected function setJobUser() |
468 | 468 | { |
469 | 469 | // set up the current user and drop session |
470 | - if(!empty($this->assigned_user_id)) { |
|
470 | + if (!empty($this->assigned_user_id)) { |
|
471 | 471 | $this->old_user = $GLOBALS['current_user']; |
472 | - if(empty($this->user->id) || $this->assigned_user_id != $this->user->id) { |
|
472 | + if (empty($this->user->id) || $this->assigned_user_id != $this->user->id) { |
|
473 | 473 | $this->user = BeanFactory::getBean('Users', $this->assigned_user_id); |
474 | - if(empty($this->user->id)) { |
|
474 | + if (empty($this->user->id)) { |
|
475 | 475 | $this->resolveJob(self::JOB_FAILURE, sprintf(translate('ERR_NOSUCHUSER', 'SchedulersJobs'), $this->assigned_user_id)); |
476 | 476 | return false; |
477 | 477 | } |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | */ |
490 | 490 | protected function restoreJobUser() |
491 | 491 | { |
492 | - if(!empty($this->old_user->id) && $this->old_user->id != $this->user->id) { |
|
492 | + if (!empty($this->old_user->id) && $this->old_user->id != $this->user->id) { |
|
493 | 493 | $this->sudo($this->old_user); |
494 | 494 | } |
495 | 495 | } |
@@ -504,27 +504,27 @@ discard block |
||
504 | 504 | |
505 | 505 | $this->errors = ""; |
506 | 506 | $exJob = explode('::', $this->target, 2); |
507 | - if($exJob[0] == 'function') { |
|
507 | + if ($exJob[0] == 'function') { |
|
508 | 508 | // set up the current user and drop session |
509 | - if(!$this->setJobUser()) { |
|
509 | + if (!$this->setJobUser()) { |
|
510 | 510 | return false; |
511 | 511 | } |
512 | 512 | $func = $exJob[1]; |
513 | 513 | $GLOBALS['log']->debug("----->SchedulersJob calling function: $func"); |
514 | 514 | set_error_handler(array($this, "errorHandler"), E_ALL & ~E_NOTICE & ~E_STRICT); |
515 | - if(!is_callable($func)) { |
|
515 | + if (!is_callable($func)) { |
|
516 | 516 | $this->resolveJob(self::JOB_FAILURE, sprintf(translate('ERR_CALL', 'SchedulersJobs'), $func)); |
517 | 517 | } |
518 | 518 | $data = array($this); |
519 | - if(!empty($this->data)) { |
|
519 | + if (!empty($this->data)) { |
|
520 | 520 | $data[] = $this->data; |
521 | 521 | } |
522 | 522 | $res = call_user_func_array($func, $data); |
523 | 523 | restore_error_handler(); |
524 | 524 | $this->restoreJobUser(); |
525 | - if($this->status == self::JOB_STATUS_RUNNING) { |
|
525 | + if ($this->status == self::JOB_STATUS_RUNNING) { |
|
526 | 526 | // nobody updated the status yet - job function could do that |
527 | - if($res) { |
|
527 | + if ($res) { |
|
528 | 528 | $this->resolveJob(self::JOB_SUCCESS); |
529 | 529 | return true; |
530 | 530 | } else { |
@@ -534,11 +534,11 @@ discard block |
||
534 | 534 | } else { |
535 | 535 | return $this->resolution != self::JOB_FAILURE; |
536 | 536 | } |
537 | - } elseif($exJob[0] == 'url') { |
|
538 | - if(function_exists('curl_init')) { |
|
537 | + } elseif ($exJob[0] == 'url') { |
|
538 | + if (function_exists('curl_init')) { |
|
539 | 539 | $GLOBALS['log']->debug('----->SchedulersJob firing URL job: '.$exJob[1]); |
540 | 540 | set_error_handler(array($this, "errorHandler"), E_ALL & ~E_NOTICE & ~E_STRICT); |
541 | - if($this->fireUrl($exJob[1])) { |
|
541 | + if ($this->fireUrl($exJob[1])) { |
|
542 | 542 | restore_error_handler(); |
543 | 543 | $this->resolveJob(self::JOB_SUCCESS); |
544 | 544 | return true; |
@@ -552,10 +552,10 @@ discard block |
||
552 | 552 | } |
553 | 553 | } elseif ($exJob[0] == 'class') { |
554 | 554 | $tmpJob = new $exJob[1](); |
555 | - if($tmpJob instanceof RunnableSchedulerJob) |
|
555 | + if ($tmpJob instanceof RunnableSchedulerJob) |
|
556 | 556 | { |
557 | 557 | // set up the current user and drop session |
558 | - if(!$this->setJobUser()) { |
|
558 | + if (!$this->setJobUser()) { |
|
559 | 559 | return false; |
560 | 560 | } |
561 | 561 | $tmpJob->setJob($this); |
@@ -1,5 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
3 | + die('Not A Valid Entry Point'); |
|
4 | +} |
|
3 | 5 | /********************************************************************************* |
4 | 6 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 7 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -573,12 +575,10 @@ discard block |
||
573 | 575 | } else { |
574 | 576 | return $this->resolution != self::JOB_FAILURE; |
575 | 577 | } |
576 | - } |
|
577 | - else { |
|
578 | + } else { |
|
578 | 579 | $this->resolveJob(self::JOB_FAILURE, sprintf(translate('ERR_JOBTYPE', 'SchedulersJobs'), strip_tags($this->target))); |
579 | 580 | } |
580 | - } |
|
581 | - else { |
|
581 | + } else { |
|
582 | 582 | $this->resolveJob(self::JOB_FAILURE, sprintf(translate('ERR_JOBTYPE', 'SchedulersJobs'), strip_tags($this->target))); |
583 | 583 | } |
584 | 584 | return false; |
@@ -356,6 +356,7 @@ discard block |
||
356 | 356 | /** |
357 | 357 | * Delete a job |
358 | 358 | * @see SugarBean::mark_deleted($id) |
359 | + * @param string $id |
|
359 | 360 | */ |
360 | 361 | public function mark_deleted($id) |
361 | 362 | { |
@@ -595,12 +596,14 @@ discard block |
||
595 | 596 | /** |
596 | 597 | * @abstract |
597 | 598 | * @param SchedulersJob $job |
599 | + * @return void |
|
598 | 600 | */ |
599 | 601 | public function setJob(SchedulersJob $job); |
600 | 602 | |
601 | 603 | /** |
602 | 604 | * @abstract |
603 | 605 | * |
606 | + * @return boolean |
|
604 | 607 | */ |
605 | 608 | public function run($data); |
606 | 609 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | |
4 | 4 | /********************************************************************************* |
5 | 5 | * SugarCRM Community Edition is a customer relationship management program developed by |
@@ -87,24 +87,24 @@ discard block |
||
87 | 87 | { |
88 | 88 | static $sfh; |
89 | 89 | |
90 | - if(!isset($sfh)) { |
|
90 | + if (!isset($sfh)) { |
|
91 | 91 | require_once('include/SugarFields/SugarFieldHandler.php'); |
92 | 92 | $sfh = new SugarFieldHandler(); |
93 | 93 | } |
94 | 94 | $value = $params[0]; |
95 | 95 | $vardef = $params[1]; |
96 | - if ( isset($params[2]) ) |
|
96 | + if (isset($params[2])) |
|
97 | 97 | $focus = $params[2]; |
98 | 98 | else |
99 | 99 | $focus = null; |
100 | - if ( $name == 'relate' && !empty($params[3]) ) |
|
100 | + if ($name == 'relate' && !empty($params[3])) |
|
101 | 101 | $this->addRelatedBean = true; |
102 | 102 | else |
103 | 103 | $this->addRelatedBean = false; |
104 | 104 | |
105 | 105 | $field = $sfh->getSugarField(ucfirst($name)); |
106 | - if ( $field instanceOf SugarFieldBase ) { |
|
107 | - $value = $field->importSanitize($value,$vardef,$focus,$this); |
|
106 | + if ($field instanceOf SugarFieldBase) { |
|
107 | + $value = $field->importSanitize($value, $vardef, $focus, $this); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | return $value; |
@@ -128,10 +128,10 @@ discard block |
||
128 | 128 | |
129 | 129 | $format = $this->dateformat; |
130 | 130 | |
131 | - if ( !$timedate->check_matching_format($value, $format) ) |
|
131 | + if (!$timedate->check_matching_format($value, $format)) |
|
132 | 132 | return false; |
133 | 133 | |
134 | - if ( !$this->isValidTimeDate($value, $format) ) |
|
134 | + if (!$this->isValidTimeDate($value, $format)) |
|
135 | 135 | return false; |
136 | 136 | |
137 | 137 | $value = $timedate->swap_formats( |
@@ -156,11 +156,11 @@ discard block |
||
156 | 156 | // cache $sea instance |
157 | 157 | static $sea; |
158 | 158 | |
159 | - if ( !($sea instanceof SugarEmailAddress) ) { |
|
159 | + if (!($sea instanceof SugarEmailAddress)) { |
|
160 | 160 | $sea = new SugarEmailAddress; |
161 | 161 | } |
162 | 162 | |
163 | - if ( !empty($value) && !preg_match($sea->regex,$value) ) { |
|
163 | + if (!empty($value) && !preg_match($sea->regex, $value)) { |
|
164 | 164 | return false; |
165 | 165 | } |
166 | 166 | |
@@ -184,18 +184,18 @@ discard block |
||
184 | 184 | static $focus_user; |
185 | 185 | |
186 | 186 | // cache this object since we'll be reusing it a bunch |
187 | - if ( !($focus_user instanceof User) ) { |
|
187 | + if (!($focus_user instanceof User)) { |
|
188 | 188 | |
189 | 189 | $focus_user = new User(); |
190 | 190 | } |
191 | 191 | |
192 | 192 | |
193 | - if ( !empty($value) && strtolower($value) != "all" ) { |
|
194 | - $theList = explode(",",$value); |
|
193 | + if (!empty($value) && strtolower($value) != "all") { |
|
194 | + $theList = explode(",", $value); |
|
195 | 195 | $isValid = true; |
196 | 196 | $bad_names = array(); |
197 | 197 | foreach ($theList as $eachItem) { |
198 | - if ( $focus_user->retrieve_user_id($eachItem) |
|
198 | + if ($focus_user->retrieve_user_id($eachItem) |
|
199 | 199 | || $focus_user->retrieve($eachItem) |
200 | 200 | ) { |
201 | 201 | // all good |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | continue; |
207 | 207 | } |
208 | 208 | } |
209 | - if(!$isValid) { |
|
209 | + if (!$isValid) { |
|
210 | 210 | return false; |
211 | 211 | } |
212 | 212 | } |
@@ -232,10 +232,10 @@ discard block |
||
232 | 232 | |
233 | 233 | $format = $this->timeformat; |
234 | 234 | |
235 | - if ( !$timedate->check_matching_format($value, $format) ) |
|
235 | + if (!$timedate->check_matching_format($value, $format)) |
|
236 | 236 | return false; |
237 | 237 | |
238 | - if ( !$this->isValidTimeDate($value, $format) ) |
|
238 | + if (!$this->isValidTimeDate($value, $format)) |
|
239 | 239 | return false; |
240 | 240 | |
241 | 241 | $value = $timedate->swap_formats( |
@@ -266,46 +266,46 @@ discard block |
||
266 | 266 | $reg = $timedate->get_regular_expression($format); |
267 | 267 | preg_match('@'.$reg['format'].'@', $value, $dateparts); |
268 | 268 | |
269 | - if ( empty($dateparts) ) |
|
269 | + if (empty($dateparts)) |
|
270 | 270 | return false; |
271 | - if ( isset($reg['positions']['a']) |
|
272 | - && !in_array($dateparts[$reg['positions']['a']], array('am','pm')) ) |
|
271 | + if (isset($reg['positions']['a']) |
|
272 | + && !in_array($dateparts[$reg['positions']['a']], array('am', 'pm'))) |
|
273 | 273 | return false; |
274 | - if ( isset($reg['positions']['A']) |
|
275 | - && !in_array($dateparts[$reg['positions']['A']], array('AM','PM')) ) |
|
274 | + if (isset($reg['positions']['A']) |
|
275 | + && !in_array($dateparts[$reg['positions']['A']], array('AM', 'PM'))) |
|
276 | 276 | return false; |
277 | - if ( isset($reg['positions']['h']) && ( |
|
277 | + if (isset($reg['positions']['h']) && ( |
|
278 | 278 | !is_numeric($dateparts[$reg['positions']['h']]) |
279 | 279 | || $dateparts[$reg['positions']['h']] < 1 |
280 | - || $dateparts[$reg['positions']['h']] > 12 ) ) |
|
280 | + || $dateparts[$reg['positions']['h']] > 12 )) |
|
281 | 281 | return false; |
282 | - if ( isset($reg['positions']['H']) && ( |
|
282 | + if (isset($reg['positions']['H']) && ( |
|
283 | 283 | !is_numeric($dateparts[$reg['positions']['H']]) |
284 | 284 | || $dateparts[$reg['positions']['H']] < 0 |
285 | - || $dateparts[$reg['positions']['H']] > 23 ) ) |
|
285 | + || $dateparts[$reg['positions']['H']] > 23 )) |
|
286 | 286 | return false; |
287 | - if ( isset($reg['positions']['i']) && ( |
|
287 | + if (isset($reg['positions']['i']) && ( |
|
288 | 288 | !is_numeric($dateparts[$reg['positions']['i']]) |
289 | 289 | || $dateparts[$reg['positions']['i']] < 0 |
290 | - || $dateparts[$reg['positions']['i']] > 59 ) ) |
|
290 | + || $dateparts[$reg['positions']['i']] > 59 )) |
|
291 | 291 | return false; |
292 | - if ( isset($reg['positions']['s']) && ( |
|
292 | + if (isset($reg['positions']['s']) && ( |
|
293 | 293 | !is_numeric($dateparts[$reg['positions']['s']]) |
294 | 294 | || $dateparts[$reg['positions']['s']] < 0 |
295 | - || $dateparts[$reg['positions']['s']] > 59 ) ) |
|
295 | + || $dateparts[$reg['positions']['s']] > 59 )) |
|
296 | 296 | return false; |
297 | - if ( isset($reg['positions']['d']) && ( |
|
297 | + if (isset($reg['positions']['d']) && ( |
|
298 | 298 | !is_numeric($dateparts[$reg['positions']['d']]) |
299 | 299 | || $dateparts[$reg['positions']['d']] < 1 |
300 | - || $dateparts[$reg['positions']['d']] > 31 ) ) |
|
300 | + || $dateparts[$reg['positions']['d']] > 31 )) |
|
301 | 301 | return false; |
302 | - if ( isset($reg['positions']['m']) && ( |
|
302 | + if (isset($reg['positions']['m']) && ( |
|
303 | 303 | !is_numeric($dateparts[$reg['positions']['m']]) |
304 | 304 | || $dateparts[$reg['positions']['m']] < 1 |
305 | - || $dateparts[$reg['positions']['m']] > 12 ) ) |
|
305 | + || $dateparts[$reg['positions']['m']] > 12 )) |
|
306 | 306 | return false; |
307 | - if ( isset($reg['positions']['Y']) && |
|
308 | - !is_numeric($dateparts[$reg['positions']['Y']]) ) |
|
307 | + if (isset($reg['positions']['Y']) && |
|
308 | + !is_numeric($dateparts[$reg['positions']['Y']])) |
|
309 | 309 | return false; |
310 | 310 | |
311 | 311 | return true; |
@@ -1,5 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
3 | + die('Not A Valid Entry Point'); |
|
4 | +} |
|
3 | 5 | |
4 | 6 | /********************************************************************************* |
5 | 7 | * SugarCRM Community Edition is a customer relationship management program developed by |
@@ -93,14 +95,16 @@ discard block |
||
93 | 95 | } |
94 | 96 | $value = $params[0]; |
95 | 97 | $vardef = $params[1]; |
96 | - if ( isset($params[2]) ) |
|
97 | - $focus = $params[2]; |
|
98 | - else |
|
99 | - $focus = null; |
|
100 | - if ( $name == 'relate' && !empty($params[3]) ) |
|
101 | - $this->addRelatedBean = true; |
|
102 | - else |
|
103 | - $this->addRelatedBean = false; |
|
98 | + if ( isset($params[2]) ) { |
|
99 | + $focus = $params[2]; |
|
100 | + } else { |
|
101 | + $focus = null; |
|
102 | + } |
|
103 | + if ( $name == 'relate' && !empty($params[3]) ) { |
|
104 | + $this->addRelatedBean = true; |
|
105 | + } else { |
|
106 | + $this->addRelatedBean = false; |
|
107 | + } |
|
104 | 108 | |
105 | 109 | $field = $sfh->getSugarField(ucfirst($name)); |
106 | 110 | if ( $field instanceOf SugarFieldBase ) { |
@@ -128,11 +132,13 @@ discard block |
||
128 | 132 | |
129 | 133 | $format = $this->dateformat; |
130 | 134 | |
131 | - if ( !$timedate->check_matching_format($value, $format) ) |
|
132 | - return false; |
|
135 | + if ( !$timedate->check_matching_format($value, $format) ) { |
|
136 | + return false; |
|
137 | + } |
|
133 | 138 | |
134 | - if ( !$this->isValidTimeDate($value, $format) ) |
|
135 | - return false; |
|
139 | + if ( !$this->isValidTimeDate($value, $format) ) { |
|
140 | + return false; |
|
141 | + } |
|
136 | 142 | |
137 | 143 | $value = $timedate->swap_formats( |
138 | 144 | $value, $format, $timedate->get_date_format()); |
@@ -199,8 +205,7 @@ discard block |
||
199 | 205 | || $focus_user->retrieve($eachItem) |
200 | 206 | ) { |
201 | 207 | // all good |
202 | - } |
|
203 | - else { |
|
208 | + } else { |
|
204 | 209 | $isValid = false; |
205 | 210 | $bad_names[] = $eachItem; |
206 | 211 | continue; |
@@ -232,11 +237,13 @@ discard block |
||
232 | 237 | |
233 | 238 | $format = $this->timeformat; |
234 | 239 | |
235 | - if ( !$timedate->check_matching_format($value, $format) ) |
|
236 | - return false; |
|
240 | + if ( !$timedate->check_matching_format($value, $format) ) { |
|
241 | + return false; |
|
242 | + } |
|
237 | 243 | |
238 | - if ( !$this->isValidTimeDate($value, $format) ) |
|
239 | - return false; |
|
244 | + if ( !$this->isValidTimeDate($value, $format) ) { |
|
245 | + return false; |
|
246 | + } |
|
240 | 247 | |
241 | 248 | $value = $timedate->swap_formats( |
242 | 249 | $value, $format, $timedate->get_time_format()); |
@@ -266,47 +273,57 @@ discard block |
||
266 | 273 | $reg = $timedate->get_regular_expression($format); |
267 | 274 | preg_match('@'.$reg['format'].'@', $value, $dateparts); |
268 | 275 | |
269 | - if ( empty($dateparts) ) |
|
270 | - return false; |
|
276 | + if ( empty($dateparts) ) { |
|
277 | + return false; |
|
278 | + } |
|
271 | 279 | if ( isset($reg['positions']['a']) |
272 | - && !in_array($dateparts[$reg['positions']['a']], array('am','pm')) ) |
|
273 | - return false; |
|
280 | + && !in_array($dateparts[$reg['positions']['a']], array('am','pm')) ) { |
|
281 | + return false; |
|
282 | + } |
|
274 | 283 | if ( isset($reg['positions']['A']) |
275 | - && !in_array($dateparts[$reg['positions']['A']], array('AM','PM')) ) |
|
276 | - return false; |
|
284 | + && !in_array($dateparts[$reg['positions']['A']], array('AM','PM')) ) { |
|
285 | + return false; |
|
286 | + } |
|
277 | 287 | if ( isset($reg['positions']['h']) && ( |
278 | 288 | !is_numeric($dateparts[$reg['positions']['h']]) |
279 | 289 | || $dateparts[$reg['positions']['h']] < 1 |
280 | - || $dateparts[$reg['positions']['h']] > 12 ) ) |
|
281 | - return false; |
|
290 | + || $dateparts[$reg['positions']['h']] > 12 ) ) { |
|
291 | + return false; |
|
292 | + } |
|
282 | 293 | if ( isset($reg['positions']['H']) && ( |
283 | 294 | !is_numeric($dateparts[$reg['positions']['H']]) |
284 | 295 | || $dateparts[$reg['positions']['H']] < 0 |
285 | - || $dateparts[$reg['positions']['H']] > 23 ) ) |
|
286 | - return false; |
|
296 | + || $dateparts[$reg['positions']['H']] > 23 ) ) { |
|
297 | + return false; |
|
298 | + } |
|
287 | 299 | if ( isset($reg['positions']['i']) && ( |
288 | 300 | !is_numeric($dateparts[$reg['positions']['i']]) |
289 | 301 | || $dateparts[$reg['positions']['i']] < 0 |
290 | - || $dateparts[$reg['positions']['i']] > 59 ) ) |
|
291 | - return false; |
|
302 | + || $dateparts[$reg['positions']['i']] > 59 ) ) { |
|
303 | + return false; |
|
304 | + } |
|
292 | 305 | if ( isset($reg['positions']['s']) && ( |
293 | 306 | !is_numeric($dateparts[$reg['positions']['s']]) |
294 | 307 | || $dateparts[$reg['positions']['s']] < 0 |
295 | - || $dateparts[$reg['positions']['s']] > 59 ) ) |
|
296 | - return false; |
|
308 | + || $dateparts[$reg['positions']['s']] > 59 ) ) { |
|
309 | + return false; |
|
310 | + } |
|
297 | 311 | if ( isset($reg['positions']['d']) && ( |
298 | 312 | !is_numeric($dateparts[$reg['positions']['d']]) |
299 | 313 | || $dateparts[$reg['positions']['d']] < 1 |
300 | - || $dateparts[$reg['positions']['d']] > 31 ) ) |
|
301 | - return false; |
|
314 | + || $dateparts[$reg['positions']['d']] > 31 ) ) { |
|
315 | + return false; |
|
316 | + } |
|
302 | 317 | if ( isset($reg['positions']['m']) && ( |
303 | 318 | !is_numeric($dateparts[$reg['positions']['m']]) |
304 | 319 | || $dateparts[$reg['positions']['m']] < 1 |
305 | - || $dateparts[$reg['positions']['m']] > 12 ) ) |
|
306 | - return false; |
|
320 | + || $dateparts[$reg['positions']['m']] > 12 ) ) { |
|
321 | + return false; |
|
322 | + } |
|
307 | 323 | if ( isset($reg['positions']['Y']) && |
308 | - !is_numeric($dateparts[$reg['positions']['Y']]) ) |
|
309 | - return false; |
|
324 | + !is_numeric($dateparts[$reg['positions']['Y']]) ) { |
|
325 | + return false; |
|
326 | + } |
|
310 | 327 | |
311 | 328 | return true; |
312 | 329 | } |
@@ -253,7 +253,7 @@ |
||
253 | 253 | * |
254 | 254 | * @param $value string |
255 | 255 | * @param $format string |
256 | - * @return string sanitized and validated value on success, bool false on failure |
|
256 | + * @return boolean sanitized and validated value on success, bool false on failure |
|
257 | 257 | */ |
258 | 258 | public function isValidTimeDate( |
259 | 259 | $value, |
@@ -49,11 +49,11 @@ discard block |
||
49 | 49 | |
50 | 50 | class ImportMapOutlook extends ImportMapOther |
51 | 51 | { |
52 | - /** |
|
52 | + /** |
|
53 | 53 | * String identifier for this import |
54 | 54 | */ |
55 | 55 | public $name = 'outlook'; |
56 | - /** |
|
56 | + /** |
|
57 | 57 | * Field delimiter |
58 | 58 | */ |
59 | 59 | public $delimiter = ','; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * Field enclosure |
62 | 62 | */ |
63 | 63 | public $enclosure = '"'; |
64 | - /** |
|
64 | + /** |
|
65 | 65 | * Do we have a header? |
66 | 66 | */ |
67 | 67 | public $has_header = true; |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * @param string $module |
73 | 73 | * @return array field mappings |
74 | 74 | */ |
75 | - public function getMapping( |
|
75 | + public function getMapping( |
|
76 | 76 | $module |
77 | 77 | ) |
78 | 78 | { |
@@ -78,19 +78,19 @@ |
||
78 | 78 | { |
79 | 79 | $return_array = parent::getMapping($module); |
80 | 80 | switch ($module) { |
81 | - case 'Contacts': |
|
82 | - case 'Leads': |
|
83 | - return $return_array + array( |
|
84 | - "Job Title"=>"title", |
|
85 | - "Home Country"=>"alt_address_country", |
|
86 | - "E-mail 2 Address"=>"email2", |
|
87 | - ); |
|
88 | - break; |
|
89 | - case 'Accounts': |
|
90 | - return $return_array; |
|
91 | - break; |
|
92 | - default: |
|
93 | - return $return_array; |
|
81 | + case 'Contacts': |
|
82 | + case 'Leads': |
|
83 | + return $return_array + array( |
|
84 | + "Job Title"=>"title", |
|
85 | + "Home Country"=>"alt_address_country", |
|
86 | + "E-mail 2 Address"=>"email2", |
|
87 | + ); |
|
88 | + break; |
|
89 | + case 'Accounts': |
|
90 | + return $return_array; |
|
91 | + break; |
|
92 | + default: |
|
93 | + return $return_array; |
|
94 | 94 | } |
95 | 95 | } |
96 | 96 | } |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
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. |
@@ -1,5 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
3 | + die('Not A Valid Entry Point'); |
|
4 | +} |
|
3 | 5 | /********************************************************************************* |
4 | 6 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 7 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | |
45 | 45 | class ImportMapGoogle extends ImportMapOther |
46 | 46 | { |
47 | - /** |
|
47 | + /** |
|
48 | 48 | * String identifier for this import |
49 | 49 | */ |
50 | 50 | public $name = 'google'; |
@@ -55,38 +55,38 @@ discard block |
||
55 | 55 | * @param string $module |
56 | 56 | * @return array field mappings |
57 | 57 | */ |
58 | - public function getMapping($module) |
|
58 | + public function getMapping($module) |
|
59 | 59 | { |
60 | - $return_array = array( |
|
61 | - 'first_name' => array('sugar_key' => 'first_name', 'sugar_label' => '', 'default_label' => 'Given Name'), |
|
62 | - 'last_name' => array('sugar_key' => 'last_name', 'sugar_label' => '', 'default_label' => 'Family Name'), |
|
63 | - 'birthday' => array('sugar_key' => 'birthdate', 'sugar_label' => '', 'default_label' => 'Birthday'), |
|
64 | - 'title' => array('sugar_key' => 'title', 'sugar_label' => '', 'default_label' => 'Title'), |
|
65 | - 'notes' => array('sugar_key' => 'description', 'sugar_label' => '', 'default_label' => 'Notes'), |
|
60 | + $return_array = array( |
|
61 | + 'first_name' => array('sugar_key' => 'first_name', 'sugar_label' => '', 'default_label' => 'Given Name'), |
|
62 | + 'last_name' => array('sugar_key' => 'last_name', 'sugar_label' => '', 'default_label' => 'Family Name'), |
|
63 | + 'birthday' => array('sugar_key' => 'birthdate', 'sugar_label' => '', 'default_label' => 'Birthday'), |
|
64 | + 'title' => array('sugar_key' => 'title', 'sugar_label' => '', 'default_label' => 'Title'), |
|
65 | + 'notes' => array('sugar_key' => 'description', 'sugar_label' => '', 'default_label' => 'Notes'), |
|
66 | 66 | |
67 | - 'alt_address_street' => array('sugar_key' => 'alt_address_street', 'sugar_label' => '', 'default_label' => 'Home Street'), |
|
68 | - 'alt_address_postcode' => array('sugar_key' => 'alt_address_postalcode', 'sugar_label' => '', 'default_label' => 'Home Postcode'), |
|
69 | - 'alt_address_city' => array('sugar_key' => 'alt_address_city', 'sugar_label' => '', 'default_label' => 'Home City'), |
|
70 | - 'alt_address_state' => array('sugar_key' => 'alt_address_state', 'sugar_label' => '', 'default_label' => 'Home State'), |
|
71 | - 'alt_address_country' => array('sugar_key' => 'alt_address_country', 'sugar_label' => '', 'default_label' => 'Home Country'), |
|
67 | + 'alt_address_street' => array('sugar_key' => 'alt_address_street', 'sugar_label' => '', 'default_label' => 'Home Street'), |
|
68 | + 'alt_address_postcode' => array('sugar_key' => 'alt_address_postalcode', 'sugar_label' => '', 'default_label' => 'Home Postcode'), |
|
69 | + 'alt_address_city' => array('sugar_key' => 'alt_address_city', 'sugar_label' => '', 'default_label' => 'Home City'), |
|
70 | + 'alt_address_state' => array('sugar_key' => 'alt_address_state', 'sugar_label' => '', 'default_label' => 'Home State'), |
|
71 | + 'alt_address_country' => array('sugar_key' => 'alt_address_country', 'sugar_label' => '', 'default_label' => 'Home Country'), |
|
72 | 72 | |
73 | - 'primary_address_street' => array('sugar_key' => 'primary_address_street', 'sugar_label' => '', 'default_label' => 'Work Street'), |
|
74 | - 'primary_address_postcode' => array('sugar_key' => 'primary_address_postalcode', 'sugar_label' => '', 'default_label' => 'Work Postcode'), |
|
75 | - 'primary_address_city' => array('sugar_key' => 'primary_address_city', 'sugar_label' => '', 'default_label' => 'Work City'), |
|
76 | - 'primary_address_state' => array('sugar_key' => 'primary_address_state', 'sugar_label' => '', 'default_label' => 'Work State'), |
|
77 | - 'primary_address_country' => array('sugar_key' => 'primary_address_country', 'sugar_label' => '', 'default_label' => 'Work Country'), |
|
73 | + 'primary_address_street' => array('sugar_key' => 'primary_address_street', 'sugar_label' => '', 'default_label' => 'Work Street'), |
|
74 | + 'primary_address_postcode' => array('sugar_key' => 'primary_address_postalcode', 'sugar_label' => '', 'default_label' => 'Work Postcode'), |
|
75 | + 'primary_address_city' => array('sugar_key' => 'primary_address_city', 'sugar_label' => '', 'default_label' => 'Work City'), |
|
76 | + 'primary_address_state' => array('sugar_key' => 'primary_address_state', 'sugar_label' => '', 'default_label' => 'Work State'), |
|
77 | + 'primary_address_country' => array('sugar_key' => 'primary_address_country', 'sugar_label' => '', 'default_label' => 'Work Country'), |
|
78 | 78 | |
79 | - 'phone_main' => array('sugar_key' => 'phone_other', 'sugar_label' => '', 'default_label' => 'Main Phone'), |
|
80 | - 'phone_mobile' => array('sugar_key' => 'phone_mobile', 'sugar_label' => '', 'default_label' => 'Mobile Phone'), |
|
81 | - 'phone_home' => array('sugar_key' => 'phone_home', 'sugar_label' => '', 'default_label' => 'Home phone'), |
|
82 | - 'phone_work' => array('sugar_key' => 'phone_work', 'sugar_label' => '', 'default_label' => 'Work phone'), |
|
83 | - 'phone_fax' => array('sugar_key' => 'phone_fax', 'sugar_label' => '', 'default_label' => 'Fax phone'), |
|
79 | + 'phone_main' => array('sugar_key' => 'phone_other', 'sugar_label' => '', 'default_label' => 'Main Phone'), |
|
80 | + 'phone_mobile' => array('sugar_key' => 'phone_mobile', 'sugar_label' => '', 'default_label' => 'Mobile Phone'), |
|
81 | + 'phone_home' => array('sugar_key' => 'phone_home', 'sugar_label' => '', 'default_label' => 'Home phone'), |
|
82 | + 'phone_work' => array('sugar_key' => 'phone_work', 'sugar_label' => '', 'default_label' => 'Work phone'), |
|
83 | + 'phone_fax' => array('sugar_key' => 'phone_fax', 'sugar_label' => '', 'default_label' => 'Fax phone'), |
|
84 | 84 | |
85 | - 'email1' => array('sugar_key' => 'email1', 'sugar_label' => 'LBL_EMAIL_ADDRESS', 'default_label' => 'Email Address'), |
|
86 | - 'email2' => array('sugar_key' => 'email2', 'sugar_label' => 'LBL_OTHER_EMAIL_ADDRESS', 'default_label' => 'Other Email'), |
|
85 | + 'email1' => array('sugar_key' => 'email1', 'sugar_label' => 'LBL_EMAIL_ADDRESS', 'default_label' => 'Email Address'), |
|
86 | + 'email2' => array('sugar_key' => 'email2', 'sugar_label' => 'LBL_OTHER_EMAIL_ADDRESS', 'default_label' => 'Other Email'), |
|
87 | 87 | |
88 | - 'assigned_user_name' => array('sugar_key' => 'assigned_user_name', 'sugar_help_key' => 'LBL_EXTERNAL_ASSIGNED_TOOLTIP', 'sugar_label' => 'LBL_ASSIGNED_TO_NAME', 'default_label' => 'Assigned To'), |
|
89 | - 'team_name' => array('sugar_key' => 'team_name', 'sugar_help_key' => 'LBL_EXTERNAL_TEAM_TOOLTIP','sugar_label' => 'LBL_TEAMS', 'default_label' => 'Teams'), |
|
88 | + 'assigned_user_name' => array('sugar_key' => 'assigned_user_name', 'sugar_help_key' => 'LBL_EXTERNAL_ASSIGNED_TOOLTIP', 'sugar_label' => 'LBL_ASSIGNED_TO_NAME', 'default_label' => 'Assigned To'), |
|
89 | + 'team_name' => array('sugar_key' => 'team_name', 'sugar_help_key' => 'LBL_EXTERNAL_TEAM_TOOLTIP','sugar_label' => 'LBL_TEAMS', 'default_label' => 'Teams'), |
|
90 | 90 | ); |
91 | 91 | |
92 | 92 | if($module == 'Users') |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
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. |
@@ -86,13 +86,13 @@ discard block |
||
86 | 86 | 'email2' => array('sugar_key' => 'email2', 'sugar_label' => 'LBL_OTHER_EMAIL_ADDRESS', 'default_label' => 'Other Email'), |
87 | 87 | |
88 | 88 | 'assigned_user_name' => array('sugar_key' => 'assigned_user_name', 'sugar_help_key' => 'LBL_EXTERNAL_ASSIGNED_TOOLTIP', 'sugar_label' => 'LBL_ASSIGNED_TO_NAME', 'default_label' => 'Assigned To'), |
89 | - 'team_name' => array('sugar_key' => 'team_name', 'sugar_help_key' => 'LBL_EXTERNAL_TEAM_TOOLTIP','sugar_label' => 'LBL_TEAMS', 'default_label' => 'Teams'), |
|
89 | + 'team_name' => array('sugar_key' => 'team_name', 'sugar_help_key' => 'LBL_EXTERNAL_TEAM_TOOLTIP', 'sugar_label' => 'LBL_TEAMS', 'default_label' => 'Teams'), |
|
90 | 90 | ); |
91 | 91 | |
92 | - if($module == 'Users') |
|
92 | + if ($module == 'Users') |
|
93 | 93 | { |
94 | - $return_array['status'] = array('sugar_key' => 'status', 'sugar_label' => '', 'default_label' => 'Status'); |
|
95 | - $return_array['full_name'] = array('sugar_key' => 'user_name', 'sugar_label' => '', 'default_label' => 'Full Name'); |
|
94 | + $return_array['status'] = array('sugar_key' => 'status', 'sugar_label' => '', 'default_label' => 'Status'); |
|
95 | + $return_array['full_name'] = array('sugar_key' => 'user_name', 'sugar_label' => '', 'default_label' => 'Full Name'); |
|
96 | 96 | } |
97 | 97 | return $return_array; |
98 | 98 | } |
@@ -1,5 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
3 | + die('Not A Valid Entry Point'); |
|
4 | +} |
|
3 | 5 | /********************************************************************************* |
4 | 6 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 7 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -49,11 +49,11 @@ discard block |
||
49 | 49 | |
50 | 50 | class ImportMapSalesforce extends ImportMapOther |
51 | 51 | { |
52 | - /** |
|
52 | + /** |
|
53 | 53 | * String identifier for this import |
54 | 54 | */ |
55 | 55 | public $name = 'salesforce'; |
56 | - /** |
|
56 | + /** |
|
57 | 57 | * Field delimiter |
58 | 58 | */ |
59 | 59 | public $delimiter = ','; |
@@ -61,18 +61,18 @@ discard block |
||
61 | 61 | * Field enclosure |
62 | 62 | */ |
63 | 63 | public $enclosure = '"'; |
64 | - /** |
|
64 | + /** |
|
65 | 65 | * Do we have a header? |
66 | 66 | */ |
67 | 67 | public $has_header = true; |
68 | 68 | |
69 | - /** |
|
69 | + /** |
|
70 | 70 | * Gets the default mapping for a module |
71 | 71 | * |
72 | 72 | * @param string $module |
73 | 73 | * @return array field mappings |
74 | 74 | */ |
75 | - public function getMapping( |
|
75 | + public function getMapping( |
|
76 | 76 | $module |
77 | 77 | ) |
78 | 78 | { |
@@ -151,15 +151,15 @@ discard block |
||
151 | 151 | } |
152 | 152 | } |
153 | 153 | |
154 | - /** |
|
155 | - * @see ImportMapOther::getIgnoredFields() |
|
154 | + /** |
|
155 | + * @see ImportMapOther::getIgnoredFields() |
|
156 | 156 | */ |
157 | - public function getIgnoredFields( |
|
158 | - $module |
|
159 | - ) |
|
160 | - { |
|
161 | - return array_merge(parent::getIgnoredFields($module),array('id')); |
|
162 | - } |
|
157 | + public function getIgnoredFields( |
|
158 | + $module |
|
159 | + ) |
|
160 | + { |
|
161 | + return array_merge(parent::getIgnoredFields($module),array('id')); |
|
162 | + } |
|
163 | 163 | } |
164 | 164 | |
165 | 165 |
@@ -78,76 +78,76 @@ |
||
78 | 78 | { |
79 | 79 | $return_array = parent::getMapping($module); |
80 | 80 | switch ($module) { |
81 | - case 'Contacts': |
|
82 | - case 'Leads': |
|
83 | - return $return_array + array( |
|
84 | - "Description"=>"description", |
|
85 | - "Birthdate"=>"birthdate", |
|
86 | - "Lead Source"=>"lead_source", |
|
87 | - "Assistant"=>"assistant", |
|
88 | - "Asst. Phone"=>"assistant_phone", |
|
89 | - "Mailing Street"=>"primary_address_street", |
|
90 | - "Mailing Address Line1"=>"primary_address_street_2", |
|
91 | - "Mailing Address Line2"=>"primary_address_street_3", |
|
92 | - "Mailing Address Line3"=>"primary_address_street_4", |
|
93 | - "Mailing City"=>"primary_address_city", |
|
94 | - "Mailing State"=>"primary_address_state", |
|
95 | - "Mailing Zip/Postal Code"=>"primary_address_postalcode", |
|
96 | - "Mailing Country"=>"primary_address_country", |
|
97 | - "Other Street"=>"alt_address_street", |
|
98 | - "Other Address Line 1"=>"alt_address_street_2", |
|
99 | - "Other Address Line 2"=>"alt_address_street_3", |
|
100 | - "Other Address Line 3"=>"alt_address_street_4", |
|
101 | - "Other City"=>"alt_address_city", |
|
102 | - "Other State"=>"alt_address_state", |
|
103 | - "Other Zip/Postal Code"=>"alt_address_postalcode", |
|
104 | - "Other Country"=>"alt_address_country", |
|
105 | - "Phone"=>"phone_work", |
|
106 | - "Mobile"=>"phone_mobile", |
|
107 | - "Home Phone"=>"phone_home", |
|
108 | - "Other Phone"=>"phone_other", |
|
109 | - "Fax"=>"phone_fax", |
|
110 | - "Email"=>"email1", |
|
111 | - "Email Opt Out"=>"email_opt_out", |
|
112 | - "Do Not Call"=>"do_not_call", |
|
113 | - "Account Name"=>"account_name", |
|
114 | - ); |
|
115 | - break; |
|
116 | - case 'Accounts': |
|
117 | - return array( |
|
118 | - "Account Name"=>"name", |
|
119 | - "Annual Revenue"=>"annual_revenue", |
|
120 | - "Type"=>"account_type", |
|
121 | - "Ticker Symbol"=>"ticker_symbol", |
|
122 | - "Rating"=>"rating", |
|
123 | - "Industry"=>"industry", |
|
124 | - "SIC Code"=>"sic_code", |
|
125 | - "Ownership"=>"ownership", |
|
126 | - "Employees"=>"employees", |
|
127 | - "Description"=>"description", |
|
128 | - "Billing Street"=>"billing_address_street", |
|
129 | - "Billing Address Line1"=>"billing_address_street_2", |
|
130 | - "Billing Address Line2"=>"billing_address_street_3", |
|
131 | - "Billing City"=>"billing_address_city", |
|
132 | - "Billing State"=>"billing_address_state", |
|
133 | - "Billing State/Province"=>"billing_address_state", |
|
134 | - "Billing Zip/Postal Code"=>"billing_address_postalcode", |
|
135 | - "Billing Country"=>"billing_address_country", |
|
136 | - "Shipping Street"=>"shipping_address_street", |
|
137 | - "Shipping Address Line1"=>"shipping_address_street_2", |
|
138 | - "Shipping Address Line2"=>"shipping_address_street_3", |
|
139 | - "Shipping City"=>"shipping_address_city", |
|
140 | - "Shipping State"=>"shipping_address_state", |
|
141 | - "Shipping Zip/Postal Code"=>"shipping_address_postalcode", |
|
142 | - "Shipping Country"=>"shipping_address_country", |
|
143 | - "Phone"=>"phone_office", |
|
144 | - "Fax"=>"phone_fax", |
|
145 | - "Website"=>"website", |
|
146 | - "Created Date"=>"date_entered", |
|
147 | - ); |
|
148 | - break; |
|
149 | - default: |
|
150 | - return $return_array; |
|
81 | + case 'Contacts': |
|
82 | + case 'Leads': |
|
83 | + return $return_array + array( |
|
84 | + "Description"=>"description", |
|
85 | + "Birthdate"=>"birthdate", |
|
86 | + "Lead Source"=>"lead_source", |
|
87 | + "Assistant"=>"assistant", |
|
88 | + "Asst. Phone"=>"assistant_phone", |
|
89 | + "Mailing Street"=>"primary_address_street", |
|
90 | + "Mailing Address Line1"=>"primary_address_street_2", |
|
91 | + "Mailing Address Line2"=>"primary_address_street_3", |
|
92 | + "Mailing Address Line3"=>"primary_address_street_4", |
|
93 | + "Mailing City"=>"primary_address_city", |
|
94 | + "Mailing State"=>"primary_address_state", |
|
95 | + "Mailing Zip/Postal Code"=>"primary_address_postalcode", |
|
96 | + "Mailing Country"=>"primary_address_country", |
|
97 | + "Other Street"=>"alt_address_street", |
|
98 | + "Other Address Line 1"=>"alt_address_street_2", |
|
99 | + "Other Address Line 2"=>"alt_address_street_3", |
|
100 | + "Other Address Line 3"=>"alt_address_street_4", |
|
101 | + "Other City"=>"alt_address_city", |
|
102 | + "Other State"=>"alt_address_state", |
|
103 | + "Other Zip/Postal Code"=>"alt_address_postalcode", |
|
104 | + "Other Country"=>"alt_address_country", |
|
105 | + "Phone"=>"phone_work", |
|
106 | + "Mobile"=>"phone_mobile", |
|
107 | + "Home Phone"=>"phone_home", |
|
108 | + "Other Phone"=>"phone_other", |
|
109 | + "Fax"=>"phone_fax", |
|
110 | + "Email"=>"email1", |
|
111 | + "Email Opt Out"=>"email_opt_out", |
|
112 | + "Do Not Call"=>"do_not_call", |
|
113 | + "Account Name"=>"account_name", |
|
114 | + ); |
|
115 | + break; |
|
116 | + case 'Accounts': |
|
117 | + return array( |
|
118 | + "Account Name"=>"name", |
|
119 | + "Annual Revenue"=>"annual_revenue", |
|
120 | + "Type"=>"account_type", |
|
121 | + "Ticker Symbol"=>"ticker_symbol", |
|
122 | + "Rating"=>"rating", |
|
123 | + "Industry"=>"industry", |
|
124 | + "SIC Code"=>"sic_code", |
|
125 | + "Ownership"=>"ownership", |
|
126 | + "Employees"=>"employees", |
|
127 | + "Description"=>"description", |
|
128 | + "Billing Street"=>"billing_address_street", |
|
129 | + "Billing Address Line1"=>"billing_address_street_2", |
|
130 | + "Billing Address Line2"=>"billing_address_street_3", |
|
131 | + "Billing City"=>"billing_address_city", |
|
132 | + "Billing State"=>"billing_address_state", |
|
133 | + "Billing State/Province"=>"billing_address_state", |
|
134 | + "Billing Zip/Postal Code"=>"billing_address_postalcode", |
|
135 | + "Billing Country"=>"billing_address_country", |
|
136 | + "Shipping Street"=>"shipping_address_street", |
|
137 | + "Shipping Address Line1"=>"shipping_address_street_2", |
|
138 | + "Shipping Address Line2"=>"shipping_address_street_3", |
|
139 | + "Shipping City"=>"shipping_address_city", |
|
140 | + "Shipping State"=>"shipping_address_state", |
|
141 | + "Shipping Zip/Postal Code"=>"shipping_address_postalcode", |
|
142 | + "Shipping Country"=>"shipping_address_country", |
|
143 | + "Phone"=>"phone_office", |
|
144 | + "Fax"=>"phone_fax", |
|
145 | + "Website"=>"website", |
|
146 | + "Created Date"=>"date_entered", |
|
147 | + ); |
|
148 | + break; |
|
149 | + default: |
|
150 | + return $return_array; |
|
151 | 151 | } |
152 | 152 | } |
153 | 153 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
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. |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | $module |
159 | 159 | ) |
160 | 160 | { |
161 | - return array_merge(parent::getIgnoredFields($module),array('id')); |
|
161 | + return array_merge(parent::getIgnoredFields($module), array('id')); |
|
162 | 162 | } |
163 | 163 | } |
164 | 164 |
@@ -1,5 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
3 | + die('Not A Valid Entry Point'); |
|
4 | +} |
|
3 | 5 | /********************************************************************************* |
4 | 6 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 7 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -47,11 +47,11 @@ discard block |
||
47 | 47 | |
48 | 48 | class ImportMapOther |
49 | 49 | { |
50 | - /** |
|
50 | + /** |
|
51 | 51 | * String identifier for this import |
52 | 52 | */ |
53 | 53 | public $name = 'other'; |
54 | - /** |
|
54 | + /** |
|
55 | 55 | * Field delimiter |
56 | 56 | */ |
57 | 57 | public $delimiter; |
@@ -59,18 +59,18 @@ discard block |
||
59 | 59 | * Field enclosure |
60 | 60 | */ |
61 | 61 | public $enclosure; |
62 | - /** |
|
62 | + /** |
|
63 | 63 | * Do we have a header? |
64 | 64 | */ |
65 | 65 | public $has_header = true; |
66 | 66 | |
67 | - /** |
|
67 | + /** |
|
68 | 68 | * Gets the default mapping for a module |
69 | 69 | * |
70 | 70 | * @param string $module |
71 | 71 | * @return array field mappings |
72 | 72 | */ |
73 | - public function getMapping( |
|
73 | + public function getMapping( |
|
74 | 74 | $module |
75 | 75 | ) |
76 | 76 | { |
@@ -142,18 +142,18 @@ discard block |
||
142 | 142 | } |
143 | 143 | } |
144 | 144 | |
145 | - /** |
|
145 | + /** |
|
146 | 146 | * Returns a list of fields that should be ignorred for the module during import |
147 | 147 | * |
148 | 148 | * @param string $module |
149 | 149 | * @return array of fields to ignor |
150 | 150 | */ |
151 | - public function getIgnoredFields( |
|
152 | - $module |
|
153 | - ) |
|
154 | - { |
|
155 | - return array(); |
|
156 | - } |
|
151 | + public function getIgnoredFields( |
|
152 | + $module |
|
153 | + ) |
|
154 | + { |
|
155 | + return array(); |
|
156 | + } |
|
157 | 157 | } |
158 | 158 | |
159 | 159 |
@@ -75,70 +75,70 @@ |
||
75 | 75 | ) |
76 | 76 | { |
77 | 77 | switch ($module) { |
78 | - case 'Contacts': |
|
79 | - case 'Leads': |
|
80 | - return array( |
|
81 | - "Salutation"=>"salutation", |
|
82 | - "Full Name"=>"full_name", |
|
83 | - "Company"=>"company", |
|
84 | - "First Name"=>"first_name", |
|
85 | - "Last Name"=>"last_name", |
|
86 | - "Title"=>"title", |
|
87 | - "Department"=>"department", |
|
88 | - "Birthday"=>"birthdate", |
|
89 | - "Home Phone"=>"phone_home", |
|
90 | - "Mobile Phone"=>"phone_mobile", |
|
91 | - "Business Phone"=>"phone_work", |
|
92 | - "Other Phone"=>"phone_other", |
|
93 | - "Business Fax"=>"phone_fax", |
|
94 | - "E-mail Address"=>"email1", |
|
95 | - "E-mail 2"=>"email2", |
|
96 | - "Assistant's Name"=>"assistant", |
|
97 | - "Assistant's Phone"=>"assistant_phone", |
|
98 | - "Business Street"=>"primary_address_street", |
|
99 | - "Business Street 2"=>"primary_address_street_2", |
|
100 | - "Business Street 3"=>"primary_address_street_3", |
|
101 | - "Business City"=>"primary_address_city", |
|
102 | - "Business State"=>"primary_address_state", |
|
103 | - "Business Postal Code"=>"primary_address_postalcode", |
|
104 | - "Business Country/Region"=>"primary_address_country", |
|
105 | - "Home Street"=>"alt_address_street", |
|
106 | - "Home Street 2"=>"alt_address_street_2", |
|
107 | - "Home Street 3"=>"alt_address_street_3", |
|
108 | - "Home City"=>"alt_address_city", |
|
109 | - "Home State"=>"alt_address_state", |
|
110 | - "Home Postal Code"=>"alt_address_postalcode", |
|
111 | - "Home Country/Region"=>"alt_address_country", |
|
112 | - ); |
|
113 | - break; |
|
114 | - case 'Accounts': |
|
115 | - return array( |
|
116 | - "Company"=>"name", |
|
117 | - "Business Street"=>"billing_address_street", |
|
118 | - "Business City"=>"billing_address_city", |
|
119 | - "Business State"=>"billing_address_state", |
|
120 | - "Business Country"=>"billing_address_country", |
|
121 | - "Business Postal Code"=>"billing_address_postalcode", |
|
122 | - "Business Fax"=>"phone_fax", |
|
123 | - "Company Main Phone"=>"phone_office", |
|
124 | - "Web Page"=>"website", |
|
125 | - ); |
|
126 | - break; |
|
127 | - case 'Opportunities': |
|
128 | - return array( |
|
129 | - "Opportunity Name"=>"name" , |
|
130 | - "Type"=>"opportunity_type", |
|
131 | - "Lead Source"=>"lead_source", |
|
132 | - "Amount"=>"amount", |
|
133 | - "Created Date"=>"date_entered", |
|
134 | - "Close Date"=>"date_closed", |
|
135 | - "Next Step"=>"next_step", |
|
136 | - "Stage"=>"sales_stage", |
|
137 | - "Probability (%)"=>"probability", |
|
138 | - "Account Name"=>"account_name"); |
|
139 | - break; |
|
140 | - default: |
|
141 | - return array(); |
|
78 | + case 'Contacts': |
|
79 | + case 'Leads': |
|
80 | + return array( |
|
81 | + "Salutation"=>"salutation", |
|
82 | + "Full Name"=>"full_name", |
|
83 | + "Company"=>"company", |
|
84 | + "First Name"=>"first_name", |
|
85 | + "Last Name"=>"last_name", |
|
86 | + "Title"=>"title", |
|
87 | + "Department"=>"department", |
|
88 | + "Birthday"=>"birthdate", |
|
89 | + "Home Phone"=>"phone_home", |
|
90 | + "Mobile Phone"=>"phone_mobile", |
|
91 | + "Business Phone"=>"phone_work", |
|
92 | + "Other Phone"=>"phone_other", |
|
93 | + "Business Fax"=>"phone_fax", |
|
94 | + "E-mail Address"=>"email1", |
|
95 | + "E-mail 2"=>"email2", |
|
96 | + "Assistant's Name"=>"assistant", |
|
97 | + "Assistant's Phone"=>"assistant_phone", |
|
98 | + "Business Street"=>"primary_address_street", |
|
99 | + "Business Street 2"=>"primary_address_street_2", |
|
100 | + "Business Street 3"=>"primary_address_street_3", |
|
101 | + "Business City"=>"primary_address_city", |
|
102 | + "Business State"=>"primary_address_state", |
|
103 | + "Business Postal Code"=>"primary_address_postalcode", |
|
104 | + "Business Country/Region"=>"primary_address_country", |
|
105 | + "Home Street"=>"alt_address_street", |
|
106 | + "Home Street 2"=>"alt_address_street_2", |
|
107 | + "Home Street 3"=>"alt_address_street_3", |
|
108 | + "Home City"=>"alt_address_city", |
|
109 | + "Home State"=>"alt_address_state", |
|
110 | + "Home Postal Code"=>"alt_address_postalcode", |
|
111 | + "Home Country/Region"=>"alt_address_country", |
|
112 | + ); |
|
113 | + break; |
|
114 | + case 'Accounts': |
|
115 | + return array( |
|
116 | + "Company"=>"name", |
|
117 | + "Business Street"=>"billing_address_street", |
|
118 | + "Business City"=>"billing_address_city", |
|
119 | + "Business State"=>"billing_address_state", |
|
120 | + "Business Country"=>"billing_address_country", |
|
121 | + "Business Postal Code"=>"billing_address_postalcode", |
|
122 | + "Business Fax"=>"phone_fax", |
|
123 | + "Company Main Phone"=>"phone_office", |
|
124 | + "Web Page"=>"website", |
|
125 | + ); |
|
126 | + break; |
|
127 | + case 'Opportunities': |
|
128 | + return array( |
|
129 | + "Opportunity Name"=>"name" , |
|
130 | + "Type"=>"opportunity_type", |
|
131 | + "Lead Source"=>"lead_source", |
|
132 | + "Amount"=>"amount", |
|
133 | + "Created Date"=>"date_entered", |
|
134 | + "Close Date"=>"date_closed", |
|
135 | + "Next Step"=>"next_step", |
|
136 | + "Stage"=>"sales_stage", |
|
137 | + "Probability (%)"=>"probability", |
|
138 | + "Account Name"=>"account_name"); |
|
139 | + break; |
|
140 | + default: |
|
141 | + return array(); |
|
142 | 142 | } |
143 | 143 | } |
144 | 144 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
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. |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | break; |
127 | 127 | case 'Opportunities': |
128 | 128 | return array( |
129 | - "Opportunity Name"=>"name" , |
|
129 | + "Opportunity Name"=>"name", |
|
130 | 130 | "Type"=>"opportunity_type", |
131 | 131 | "Lead Source"=>"lead_source", |
132 | 132 | "Amount"=>"amount", |
@@ -1,5 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
3 | + die('Not A Valid Entry Point'); |
|
4 | +} |
|
3 | 5 | /********************************************************************************* |
4 | 6 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 7 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -175,19 +175,19 @@ discard block |
||
175 | 175 | * @see SugarBean::retrieve() |
176 | 176 | */ |
177 | 177 | public function retrieve($id = -1, $encode=true,$deleted=true) |
178 | - { |
|
179 | - $returnVal = parent::retrieve($id,$encode,$deleted); |
|
178 | + { |
|
179 | + $returnVal = parent::retrieve($id,$encode,$deleted); |
|
180 | 180 | |
181 | - if ( !($returnVal instanceOf $this) ) { |
|
182 | - return $returnVal; |
|
183 | - } |
|
181 | + if ( !($returnVal instanceOf $this) ) { |
|
182 | + return $returnVal; |
|
183 | + } |
|
184 | 184 | |
185 | - if ( $this->source == 'tab' && $this->delimiter == '' ) { |
|
186 | - $this->delimiter = "\t"; |
|
187 | - } |
|
185 | + if ( $this->source == 'tab' && $this->delimiter == '' ) { |
|
186 | + $this->delimiter = "\t"; |
|
187 | + } |
|
188 | 188 | |
189 | - return $this; |
|
190 | - } |
|
189 | + return $this; |
|
190 | + } |
|
191 | 191 | |
192 | 192 | /** |
193 | 193 | * Save |
@@ -372,10 +372,10 @@ discard block |
||
372 | 372 | //list of field values we track during import wizard |
373 | 373 | $import_step_fields = array( |
374 | 374 | //step1 |
375 | - // 'import_module', 'source', 'custom_enclosure', 'custom_enclosure_other', 'custom_delimiter', 'type', |
|
375 | + // 'import_module', 'source', 'custom_enclosure', 'custom_enclosure_other', 'custom_delimiter', 'type', |
|
376 | 376 | //step2 |
377 | - // 'custom_delimiter', 'custom_enclosure', 'type', 'source', 'source_id', 'import_module', 'has_header', |
|
378 | - //step3 |
|
377 | + // 'custom_delimiter', 'custom_enclosure', 'type', 'source', 'source_id', 'import_module', 'has_header', |
|
378 | + //step3 |
|
379 | 379 | 'display_tabs_def','custom_delimiter', 'custom_enclosure', 'import_type', 'source', 'source_id', 'import_module', 'has_header', 'importlocale_charset', |
380 | 380 | 'importlocale_dateformat', 'importlocale_timeformat', 'importlocale_timezone', 'importlocale_currency', |
381 | 381 | 'importlocale_default_currency_significant_digits', 'importlocale_num_grp_sep', 'importlocale_dec_sep', |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
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. |
@@ -107,11 +107,11 @@ discard block |
||
107 | 107 | public function getMapping() |
108 | 108 | { |
109 | 109 | $mapping_arr = array(); |
110 | - if ( !empty($this->content) ) |
|
110 | + if (!empty($this->content)) |
|
111 | 111 | { |
112 | - $pairs = explode("&",$this->content); |
|
113 | - foreach ($pairs as $pair){ |
|
114 | - list($name,$value) = explode("=",$pair); |
|
112 | + $pairs = explode("&", $this->content); |
|
113 | + foreach ($pairs as $pair) { |
|
114 | + list($name, $value) = explode("=", $pair); |
|
115 | 115 | $mapping_arr[trim($name)] = $value; |
116 | 116 | } |
117 | 117 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $mapping_arr |
129 | 129 | ) |
130 | 130 | { |
131 | - $output = array (); |
|
131 | + $output = array(); |
|
132 | 132 | foreach ($mapping_arr as $key => $item) { |
133 | 133 | $output[] = "$key=$item"; |
134 | 134 | } |
@@ -143,11 +143,11 @@ discard block |
||
143 | 143 | public function getDefaultValues() |
144 | 144 | { |
145 | 145 | $defa_arr = array(); |
146 | - if ( !empty($this->default_values) ) |
|
146 | + if (!empty($this->default_values)) |
|
147 | 147 | { |
148 | - $pairs = explode("&",$this->default_values); |
|
149 | - foreach ($pairs as $pair){ |
|
150 | - list($name,$value) = explode("=",$pair); |
|
148 | + $pairs = explode("&", $this->default_values); |
|
149 | + foreach ($pairs as $pair) { |
|
150 | + list($name, $value) = explode("=", $pair); |
|
151 | 151 | $defa_arr[trim($name)] = $value; |
152 | 152 | } |
153 | 153 | } |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | $defa_arr |
165 | 165 | ) |
166 | 166 | { |
167 | - $output = array (); |
|
167 | + $output = array(); |
|
168 | 168 | foreach ($defa_arr as $key => $item) { |
169 | 169 | $output[] = "$key=$item"; |
170 | 170 | } |
@@ -174,15 +174,15 @@ discard block |
||
174 | 174 | /** |
175 | 175 | * @see SugarBean::retrieve() |
176 | 176 | */ |
177 | - public function retrieve($id = -1, $encode=true,$deleted=true) |
|
177 | + public function retrieve($id = -1, $encode = true, $deleted = true) |
|
178 | 178 | { |
179 | - $returnVal = parent::retrieve($id,$encode,$deleted); |
|
179 | + $returnVal = parent::retrieve($id, $encode, $deleted); |
|
180 | 180 | |
181 | - if ( !($returnVal instanceOf $this) ) { |
|
181 | + if (!($returnVal instanceOf $this)) { |
|
182 | 182 | return $returnVal; |
183 | 183 | } |
184 | 184 | |
185 | - if ( $this->source == 'tab' && $this->delimiter == '' ) { |
|
185 | + if ($this->source == 'tab' && $this->delimiter == '') { |
|
186 | 186 | $this->delimiter = "\t"; |
187 | 187 | } |
188 | 188 | |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | |
228 | 228 | // Bug 23354 - Make sure enclosure gets saved as an empty string if |
229 | 229 | // it is an empty string, instead of as a null |
230 | - if ( strlen($enclosure) <= 0 ) $enclosure = ' '; |
|
230 | + if (strlen($enclosure) <= 0) $enclosure = ' '; |
|
231 | 231 | |
232 | 232 | $this->assigned_user_id = $owner_id; |
233 | 233 | $this->name = $name; |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | parent::save(); |
243 | 243 | |
244 | 244 | // Bug 29365 - The enclosure character isn't saved correctly if it's a tab using MssqlManager, so resave it |
245 | - if ( $enclosure == '\\t' && $this->db instanceOf MssqlManager ) { |
|
245 | + if ($enclosure == '\\t' && $this->db instanceOf MssqlManager) { |
|
246 | 246 | $this->enclosure = $enclosure; |
247 | 247 | parent::save(); |
248 | 248 | } |
@@ -262,11 +262,11 @@ discard block |
||
262 | 262 | { |
263 | 263 | global $current_user; |
264 | 264 | |
265 | - if ( !is_admin($current_user) ) { |
|
265 | + if (!is_admin($current_user)) { |
|
266 | 266 | $other_map = new ImportMap(); |
267 | 267 | $other_map->retrieve_by_string_fields(array('id'=> $id), false); |
268 | 268 | |
269 | - if ( $other_map->assigned_user_id != $current_user->id ) |
|
269 | + if ($other_map->assigned_user_id != $current_user->id) |
|
270 | 270 | return false; |
271 | 271 | } |
272 | 272 | |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | { |
288 | 288 | global $current_user; |
289 | 289 | |
290 | - if ( !is_admin($current_user) ) |
|
290 | + if (!is_admin($current_user)) |
|
291 | 291 | return false; |
292 | 292 | |
293 | 293 | // check for problems |
@@ -313,16 +313,16 @@ discard block |
||
313 | 313 | $other_map->retrieve_by_string_fields($query_arr, false); |
314 | 314 | |
315 | 315 | // if we find this other map, quit |
316 | - if ( isset($other_map->id) ) |
|
316 | + if (isset($other_map->id)) |
|
317 | 317 | return false; |
318 | 318 | |
319 | 319 | // otherwise update the is_published flag |
320 | 320 | $query = "UPDATE $this->table_name |
321 | - SET is_published = '". ($flag?'yes':'no') . "', |
|
321 | + SET is_published = '".($flag ? 'yes' : 'no')."', |
|
322 | 322 | assigned_user_id = '$user_id' |
323 | 323 | WHERE id = '{$this->id}'"; |
324 | 324 | |
325 | - $this->db->query($query,true,"Error marking import map published: "); |
|
325 | + $this->db->query($query, true, "Error marking import map published: "); |
|
326 | 326 | |
327 | 327 | return true; |
328 | 328 | } |
@@ -339,21 +339,21 @@ discard block |
||
339 | 339 | { |
340 | 340 | $query = "SELECT * |
341 | 341 | FROM {$this->table_name} |
342 | - " . $this->get_where($fields_array); |
|
342 | + ".$this->get_where($fields_array); |
|
343 | 343 | |
344 | - $result = $this->db->query($query,true," Error: "); |
|
344 | + $result = $this->db->query($query, true, " Error: "); |
|
345 | 345 | $obj_arr = array(); |
346 | 346 | |
347 | - while ($row = $this->db->fetchByAssoc($result,FALSE) ) { |
|
347 | + while ($row = $this->db->fetchByAssoc($result, FALSE)) { |
|
348 | 348 | $focus = new ImportMap(); |
349 | 349 | |
350 | - foreach($this->column_fields as $field) { |
|
351 | - if(isset($row[$field])) { |
|
350 | + foreach ($this->column_fields as $field) { |
|
351 | + if (isset($row[$field])) { |
|
352 | 352 | $focus->$field = $row[$field]; |
353 | 353 | } |
354 | 354 | } |
355 | 355 | $focus->fill_in_additional_detail_fields(); |
356 | - $obj_arr[]=$focus; |
|
356 | + $obj_arr[] = $focus; |
|
357 | 357 | } |
358 | 358 | |
359 | 359 | return $obj_arr; |
@@ -376,37 +376,37 @@ discard block |
||
376 | 376 | //step2 |
377 | 377 | // 'custom_delimiter', 'custom_enclosure', 'type', 'source', 'source_id', 'import_module', 'has_header', |
378 | 378 | //step3 |
379 | - 'display_tabs_def','custom_delimiter', 'custom_enclosure', 'import_type', 'source', 'source_id', 'import_module', 'has_header', 'importlocale_charset', |
|
379 | + 'display_tabs_def', 'custom_delimiter', 'custom_enclosure', 'import_type', 'source', 'source_id', 'import_module', 'has_header', 'importlocale_charset', |
|
380 | 380 | 'importlocale_dateformat', 'importlocale_timeformat', 'importlocale_timezone', 'importlocale_currency', |
381 | 381 | 'importlocale_default_currency_significant_digits', 'importlocale_num_grp_sep', 'importlocale_dec_sep', |
382 | 382 | ' importlocale_default_locale_name_format'); |
383 | 383 | |
384 | 384 | //retrieve user preferences and populate preference array |
385 | 385 | $preference_values_str = $current_user->getPreference('field_values', 'import'); |
386 | - $preference_values = json_decode($preference_values_str,true); |
|
386 | + $preference_values = json_decode($preference_values_str, true); |
|
387 | 387 | |
388 | - foreach ($import_step_fields as $val){ |
|
388 | + foreach ($import_step_fields as $val) { |
|
389 | 389 | //overwrite preference array with new values from request if the value is different or new |
390 | - if((isset($_REQUEST[$val]) && !isset($preference_values[$val])) || (isset($_REQUEST[$val]) && $preference_values[$val] != $_REQUEST[$val])){ |
|
390 | + if ((isset($_REQUEST[$val]) && !isset($preference_values[$val])) || (isset($_REQUEST[$val]) && $preference_values[$val] != $_REQUEST[$val])) { |
|
391 | 391 | $preference_values[$val] = $_REQUEST[$val]; |
392 | 392 | $set = true; |
393 | 393 | } |
394 | 394 | } |
395 | 395 | |
396 | 396 | //force the values to passed in array if array is set |
397 | - if(!empty($ForceValsArr) && is_array($ForceValsArr)){ |
|
398 | - foreach ($ForceValsArr as $forceKey=>$forceVal){ |
|
397 | + if (!empty($ForceValsArr) && is_array($ForceValsArr)) { |
|
398 | + foreach ($ForceValsArr as $forceKey=>$forceVal) { |
|
399 | 399 | $preference_values[$forceKey] = $forceVal; |
400 | 400 | $set = true; |
401 | 401 | } |
402 | 402 | } |
403 | 403 | |
404 | 404 | //set preferences if any changes were made and return the new array |
405 | - if($set){ |
|
406 | - $preference_values_str = json_encode($preference_values); |
|
405 | + if ($set) { |
|
406 | + $preference_values_str = json_encode($preference_values); |
|
407 | 407 | $current_user->setPreference('field_values', $preference_values_str, 0, 'import'); |
408 | 408 | } |
409 | - if(empty($preference_values)){ |
|
409 | + if (empty($preference_values)) { |
|
410 | 410 | return array(); |
411 | 411 | } |
412 | 412 |
@@ -1,5 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
3 | + die('Not A Valid Entry Point'); |
|
4 | +} |
|
3 | 5 | /********************************************************************************* |
4 | 6 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 7 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -227,7 +229,9 @@ discard block |
||
227 | 229 | |
228 | 230 | // Bug 23354 - Make sure enclosure gets saved as an empty string if |
229 | 231 | // it is an empty string, instead of as a null |
230 | - if ( strlen($enclosure) <= 0 ) $enclosure = ' '; |
|
232 | + if ( strlen($enclosure) <= 0 ) { |
|
233 | + $enclosure = ' '; |
|
234 | + } |
|
231 | 235 | |
232 | 236 | $this->assigned_user_id = $owner_id; |
233 | 237 | $this->name = $name; |
@@ -266,8 +270,9 @@ discard block |
||
266 | 270 | $other_map = new ImportMap(); |
267 | 271 | $other_map->retrieve_by_string_fields(array('id'=> $id), false); |
268 | 272 | |
269 | - if ( $other_map->assigned_user_id != $current_user->id ) |
|
270 | - return false; |
|
273 | + if ( $other_map->assigned_user_id != $current_user->id ) { |
|
274 | + return false; |
|
275 | + } |
|
271 | 276 | } |
272 | 277 | |
273 | 278 | return parent::mark_deleted($id); |
@@ -287,8 +292,9 @@ discard block |
||
287 | 292 | { |
288 | 293 | global $current_user; |
289 | 294 | |
290 | - if ( !is_admin($current_user) ) |
|
291 | - return false; |
|
295 | + if ( !is_admin($current_user) ) { |
|
296 | + return false; |
|
297 | + } |
|
292 | 298 | |
293 | 299 | // check for problems |
294 | 300 | if ($flag) { |
@@ -299,8 +305,7 @@ discard block |
||
299 | 305 | 'name' =>$this->name, |
300 | 306 | 'is_published' =>'yes' |
301 | 307 | ); |
302 | - } |
|
303 | - else { |
|
308 | + } else { |
|
304 | 309 | // if you are trying to unpublish a map |
305 | 310 | // but you own an unpublished map by the same name |
306 | 311 | $query_arr = array( |
@@ -313,8 +318,9 @@ discard block |
||
313 | 318 | $other_map->retrieve_by_string_fields($query_arr, false); |
314 | 319 | |
315 | 320 | // if we find this other map, quit |
316 | - if ( isset($other_map->id) ) |
|
317 | - return false; |
|
321 | + if ( isset($other_map->id) ) { |
|
322 | + return false; |
|
323 | + } |
|
318 | 324 | |
319 | 325 | // otherwise update the is_published flag |
320 | 326 | $query = "UPDATE $this->table_name |
@@ -192,13 +192,6 @@ discard block |
||
192 | 192 | /** |
193 | 193 | * Save |
194 | 194 | * |
195 | - * @param string $owner_id |
|
196 | - * @param string $name |
|
197 | - * @param string $module |
|
198 | - * @param string $source |
|
199 | - * @param string $has_header |
|
200 | - * @param string $delimiter |
|
201 | - * @param string $enclosure |
|
202 | 195 | * @return bool |
203 | 196 | */ |
204 | 197 | public function save($check_notify = FALSE) { |
@@ -362,7 +355,6 @@ discard block |
||
362 | 355 | /** |
363 | 356 | * set and get field elements in request field to and from user preferences |
364 | 357 | * |
365 | - * @param array $fields_array |
|
366 | 358 | * @return array $obj_arr |
367 | 359 | */ |
368 | 360 | public function set_get_import_wizard_fields($ForceValsArr = '') |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | |
4 | 4 | /********************************************************************************* |
5 | 5 | * SugarCRM Community Edition is a customer relationship management program developed by |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | /* |
57 | 57 | * holds current field when a duplicate has been found |
58 | 58 | */ |
59 | - public $_dupedFields =array(); |
|
59 | + public $_dupedFields = array(); |
|
60 | 60 | |
61 | 61 | /** |
62 | 62 | * Constructor |
@@ -78,18 +78,18 @@ discard block |
||
78 | 78 | $indexes = $this->_focus->getIndices(); |
79 | 79 | |
80 | 80 | //grab any custom indexes if they exist |
81 | - if($this->_focus->hasCustomFields()){ |
|
81 | + if ($this->_focus->hasCustomFields()) { |
|
82 | 82 | $custmIndexes = $this->_focus->db->helper->get_indices($this->_focus->table_name.'_cstm'); |
83 | - $indexes = array_merge($custmIndexes,$indexes); |
|
83 | + $indexes = array_merge($custmIndexes, $indexes); |
|
84 | 84 | } |
85 | 85 | |
86 | - if ( $this->_focus->getFieldDefinition('email1') ) |
|
86 | + if ($this->_focus->getFieldDefinition('email1')) |
|
87 | 87 | $indexes[] = array( |
88 | 88 | 'name' => 'special_idx_email1', |
89 | 89 | 'type' => 'index', |
90 | 90 | 'fields' => array('email1') |
91 | 91 | ); |
92 | - if ( $this->_focus->getFieldDefinition('email2') ) |
|
92 | + if ($this->_focus->getFieldDefinition('email2')) |
|
93 | 93 | $indexes[] = array( |
94 | 94 | 'name' => 'special_idx_email2', |
95 | 95 | 'type' => 'index', |
@@ -112,18 +112,18 @@ discard block |
||
112 | 112 | ); |
113 | 113 | |
114 | 114 | $index_array = array(); |
115 | - foreach ($this->_getIndexVardefs() as $index){ |
|
116 | - if ($index['type'] == "index"){ |
|
115 | + foreach ($this->_getIndexVardefs() as $index) { |
|
116 | + if ($index['type'] == "index") { |
|
117 | 117 | $labelsArray = array(); |
118 | - foreach ($index['fields'] as $field){ |
|
118 | + foreach ($index['fields'] as $field) { |
|
119 | 119 | if ($field == 'deleted') continue; |
120 | 120 | $fieldDef = $this->_focus->getFieldDefinition($field); |
121 | - if ( isset($fieldDef['vname']) && isset($super_language_pack[$fieldDef['vname']]) ) |
|
121 | + if (isset($fieldDef['vname']) && isset($super_language_pack[$fieldDef['vname']])) |
|
122 | 122 | $labelsArray[$fieldDef['name']] = $super_language_pack[$fieldDef['vname']]; |
123 | 123 | else |
124 | 124 | $labelsArray[$fieldDef['name']] = $fieldDef['name']; |
125 | 125 | } |
126 | - $index_array[$index['name']] = str_replace(":", "",implode(", ",$labelsArray)); |
|
126 | + $index_array[$index['name']] = str_replace(":", "", implode(", ", $labelsArray)); |
|
127 | 127 | } |
128 | 128 | } |
129 | 129 | |
@@ -138,21 +138,21 @@ discard block |
||
138 | 138 | */ |
139 | 139 | public function isADuplicateRecordByFields($fieldList) |
140 | 140 | { |
141 | - foreach($fieldList as $field) |
|
141 | + foreach ($fieldList as $field) |
|
142 | 142 | { |
143 | - if ( $field == 'email1' || $field == 'email2' ) |
|
143 | + if ($field == 'email1' || $field == 'email2') |
|
144 | 144 | { |
145 | 145 | $emailAddress = new SugarEmailAddress(); |
146 | 146 | $email = $field; |
147 | - if ( $emailAddress->getCountEmailAddressByBean($this->_focus->$email,$this->_focus,($field == 'email1')) > 0 ) |
|
147 | + if ($emailAddress->getCountEmailAddressByBean($this->_focus->$email, $this->_focus, ($field == 'email1')) > 0) |
|
148 | 148 | return true; |
149 | 149 | } |
150 | 150 | else |
151 | 151 | { |
152 | 152 | $index_fields = array('deleted' => '0'); |
153 | - if( is_array($field) ) |
|
153 | + if (is_array($field)) |
|
154 | 154 | { |
155 | - foreach($field as $tmpField) |
|
155 | + foreach ($field as $tmpField) |
|
156 | 156 | { |
157 | 157 | if ($tmpField == 'deleted') |
158 | 158 | continue; |
@@ -160,16 +160,16 @@ discard block |
||
160 | 160 | $index_fields[$tmpField] = $this->_focus->$tmpField; |
161 | 161 | } |
162 | 162 | } |
163 | - elseif($field != 'deleted' && strlen($this->_focus->$field) > 0) |
|
163 | + elseif ($field != 'deleted' && strlen($this->_focus->$field) > 0) |
|
164 | 164 | $index_fields[$field] = $this->_focus->$field; |
165 | 165 | |
166 | - if ( count($index_fields) <= 1 ) |
|
166 | + if (count($index_fields) <= 1) |
|
167 | 167 | continue; |
168 | 168 | |
169 | 169 | $newfocus = loadBean($this->_focus->module_dir); |
170 | - $result = $newfocus->retrieve_by_string_fields($index_fields,true); |
|
170 | + $result = $newfocus->retrieve_by_string_fields($index_fields, true); |
|
171 | 171 | |
172 | - if ( !is_null($result) ) |
|
172 | + if (!is_null($result)) |
|
173 | 173 | return true; |
174 | 174 | } |
175 | 175 | } |
@@ -183,15 +183,15 @@ discard block |
||
183 | 183 | * @param array $indexlist |
184 | 184 | * @return bool true if this bean is a duplicate or false if it isn't |
185 | 185 | */ |
186 | - public function isADuplicateRecord( $indexlist ) |
|
186 | + public function isADuplicateRecord($indexlist) |
|
187 | 187 | { |
188 | 188 | // Bug #51264 : Importing updates to rows prevented by duplicates check |
189 | - if ( !empty($this->_focus) && ($this->_focus instanceof SugarBean) && !empty($this->_focus->id) ) |
|
189 | + if (!empty($this->_focus) && ($this->_focus instanceof SugarBean) && !empty($this->_focus->id)) |
|
190 | 190 | { |
191 | 191 | $_focus = clone $this->_focus; |
192 | 192 | $_focus->id = null; |
193 | 193 | $_focus->retrieve($this->_focus->id); |
194 | - if ( !empty($_focus->id) ) |
|
194 | + if (!empty($_focus->id)) |
|
195 | 195 | { |
196 | 196 | return false; |
197 | 197 | } |
@@ -200,20 +200,20 @@ discard block |
||
200 | 200 | |
201 | 201 | //lets strip the indexes of the name field in the value and leave only the index name |
202 | 202 | $origIndexList = $indexlist; |
203 | - $indexlist=array(); |
|
204 | - $fieldlist=array(); |
|
205 | - $customIndexlist=array(); |
|
206 | - foreach($origIndexList as $iv){ |
|
207 | - if(empty($iv)) continue; |
|
208 | - $field_index_array = explode('::',$iv); |
|
209 | - if($field_index_array[0] == 'customfield'){ |
|
203 | + $indexlist = array(); |
|
204 | + $fieldlist = array(); |
|
205 | + $customIndexlist = array(); |
|
206 | + foreach ($origIndexList as $iv) { |
|
207 | + if (empty($iv)) continue; |
|
208 | + $field_index_array = explode('::', $iv); |
|
209 | + if ($field_index_array[0] == 'customfield') { |
|
210 | 210 | //this is a custom field, so place in custom array |
211 | 211 | $customIndexlist[] = $field_index_array[1]; |
212 | 212 | |
213 | - }else{ |
|
213 | + } else { |
|
214 | 214 | //this is not a custom field, so place in index list |
215 | 215 | $indexlist[] = $field_index_array[0]; |
216 | - if(isset($field_index_array[1])) { |
|
216 | + if (isset($field_index_array[1])) { |
|
217 | 217 | $fieldlist[] = $field_index_array[1]; |
218 | 218 | } |
219 | 219 | } |
@@ -221,11 +221,11 @@ discard block |
||
221 | 221 | |
222 | 222 | //if full_name is set, then manually search on the first and last name fields before iterating through rest of fields |
223 | 223 | //this is a special handling of the name fields on people objects, the rest of the fields are checked individually |
224 | - if(in_array('full_name',$indexlist)){ |
|
224 | + if (in_array('full_name', $indexlist)) { |
|
225 | 225 | $newfocus = loadBean($this->_focus->module_dir); |
226 | - $result = $newfocus->retrieve_by_string_fields(array('deleted' =>'0', 'first_name'=>$this->_focus->first_name, 'last_name'=>$this->_focus->last_name),true); |
|
226 | + $result = $newfocus->retrieve_by_string_fields(array('deleted' =>'0', 'first_name'=>$this->_focus->first_name, 'last_name'=>$this->_focus->last_name), true); |
|
227 | 227 | |
228 | - if ( !is_null($result) ){ |
|
228 | + if (!is_null($result)) { |
|
229 | 229 | //set dupe field to full_name and name fields |
230 | 230 | $this->_dupedFields[] = 'full_name'; |
231 | 231 | $this->_dupedFields[] = 'first_name'; |
@@ -235,61 +235,61 @@ discard block |
||
235 | 235 | } |
236 | 236 | |
237 | 237 | // loop through var def indexes and compare with selected indexes |
238 | - foreach ($this->_getIndexVardefs() as $index){ |
|
238 | + foreach ($this->_getIndexVardefs() as $index) { |
|
239 | 239 | // if we get an index not in the indexlist, loop |
240 | - if ( !in_array($index['name'],$indexlist) ) |
|
240 | + if (!in_array($index['name'], $indexlist)) |
|
241 | 241 | continue; |
242 | 242 | |
243 | 243 | // This handles the special case of duplicate email checking |
244 | - if ( $index['name'] == 'special_idx_email1' || $index['name'] == 'special_idx_email2' ) { |
|
244 | + if ($index['name'] == 'special_idx_email1' || $index['name'] == 'special_idx_email2') { |
|
245 | 245 | $emailAddress = new SugarEmailAddress(); |
246 | 246 | $email = $index['fields'][0]; |
247 | - if ( $emailAddress->getCountEmailAddressByBean( |
|
247 | + if ($emailAddress->getCountEmailAddressByBean( |
|
248 | 248 | $this->_focus->$email, |
249 | 249 | $this->_focus, |
250 | 250 | ($index['name'] == 'special_idx_email1') |
251 | - ) > 0 ){ foreach($index['fields'] as $field){ |
|
252 | - if($field !='deleted') |
|
251 | + ) > 0) { foreach ($index['fields'] as $field) { |
|
252 | + if ($field != 'deleted') |
|
253 | 253 | $this->_dupedFields[] = $field; |
254 | 254 | } |
255 | 255 | } |
256 | 256 | } |
257 | 257 | // Adds a hook so you can define a method in the bean to handle dupe checking |
258 | - elseif ( isset($index['dupeCheckFunction']) ) { |
|
259 | - $functionName = substr_replace($index['dupeCheckFunction'],'',0,9); |
|
260 | - if ( method_exists($this->_focus,$functionName) && $this->_focus->$functionName($index) === true) |
|
258 | + elseif (isset($index['dupeCheckFunction'])) { |
|
259 | + $functionName = substr_replace($index['dupeCheckFunction'], '', 0, 9); |
|
260 | + if (method_exists($this->_focus, $functionName) && $this->_focus->$functionName($index) === true) |
|
261 | 261 | return $this->_focus->$functionName($index); |
262 | 262 | } |
263 | 263 | else { |
264 | 264 | $index_fields = array('deleted' => '0'); |
265 | 265 | //search only for the field we have selected |
266 | - foreach($index['fields'] as $field){ |
|
267 | - if ($field == 'deleted' || !in_array($field,$fieldlist)) |
|
266 | + foreach ($index['fields'] as $field) { |
|
267 | + if ($field == 'deleted' || !in_array($field, $fieldlist)) |
|
268 | 268 | continue; |
269 | - if (!in_array($field,$index_fields)) |
|
269 | + if (!in_array($field, $index_fields)) |
|
270 | 270 | if (isset($this->_focus->$field) && strlen($this->_focus->$field) > 0) |
271 | 271 | $index_fields[$field] = $this->_focus->$field; |
272 | 272 | } |
273 | 273 | |
274 | 274 | // if there are no valid fields in the index field list, loop |
275 | - if ( count($index_fields) <= 1 ) |
|
275 | + if (count($index_fields) <= 1) |
|
276 | 276 | continue; |
277 | 277 | |
278 | 278 | $newfocus = loadBean($this->_focus->module_dir); |
279 | - $result = $newfocus->retrieve_by_string_fields($index_fields,true); |
|
279 | + $result = $newfocus->retrieve_by_string_fields($index_fields, true); |
|
280 | 280 | |
281 | - if ( !is_null($result) ){ |
|
281 | + if (!is_null($result)) { |
|
282 | 282 | //remove deleted as a duped field |
283 | 283 | unset($index_fields['deleted']); |
284 | 284 | |
285 | 285 | //create string based on array of dupe fields |
286 | - $this->_dupedFields = array_merge(array_keys($index_fields),$this->_dupedFields); |
|
286 | + $this->_dupedFields = array_merge(array_keys($index_fields), $this->_dupedFields); |
|
287 | 287 | } |
288 | 288 | } |
289 | 289 | } |
290 | 290 | |
291 | 291 | //return true if any dupes were found |
292 | - if(!empty($this->_dupedFields)){ |
|
292 | + if (!empty($this->_dupedFields)) { |
|
293 | 293 | return true; |
294 | 294 | } |
295 | 295 | |
@@ -301,33 +301,33 @@ discard block |
||
301 | 301 | { |
302 | 302 | require_once('include/export_utils.php'); |
303 | 303 | $import_fields = $this->_focus->get_importable_fields(); |
304 | - $importable_keys = array_keys($import_fields);// |
|
304 | + $importable_keys = array_keys($import_fields); // |
|
305 | 305 | |
306 | 306 | $index_array = array(); |
307 | 307 | $fields_used = array(); |
308 | - $mstr_exclude_array = array('all'=>array('team_set_id','id','deleted'),'contacts'=>array('email2'), array('leads'=>'reports_to_id'), array('prospects'=>'tracker_key')); |
|
308 | + $mstr_exclude_array = array('all'=>array('team_set_id', 'id', 'deleted'), 'contacts'=>array('email2'), array('leads'=>'reports_to_id'), array('prospects'=>'tracker_key')); |
|
309 | 309 | |
310 | 310 | //create exclude array from subset of applicable mstr_exclude_array elements |
311 | - $exclude_array = isset($mstr_exclude_array[strtolower($this->_focus->module_dir)])?array_merge($mstr_exclude_array[strtolower($this->_focus->module_dir)], $mstr_exclude_array['all']) : $mstr_exclude_array['all']; |
|
311 | + $exclude_array = isset($mstr_exclude_array[strtolower($this->_focus->module_dir)]) ? array_merge($mstr_exclude_array[strtolower($this->_focus->module_dir)], $mstr_exclude_array['all']) : $mstr_exclude_array['all']; |
|
312 | 312 | |
313 | 313 | |
314 | 314 | |
315 | 315 | //process all fields belonging to indexes |
316 | - foreach ($this->_getIndexVardefs() as $index){ |
|
317 | - if ($index['type'] == "index"){ |
|
316 | + foreach ($this->_getIndexVardefs() as $index) { |
|
317 | + if ($index['type'] == "index") { |
|
318 | 318 | |
319 | - foreach ($index['fields'] as $field){ |
|
320 | - $fieldName=''; |
|
319 | + foreach ($index['fields'] as $field) { |
|
320 | + $fieldName = ''; |
|
321 | 321 | |
322 | 322 | //skip this field if it is the deleted field, not in the importable keys array, or a field in the exclude array |
323 | 323 | if (!in_array($field, $importable_keys) || in_array($field, $exclude_array)) continue; |
324 | 324 | $fieldDef = $this->_focus->getFieldDefinition($field); |
325 | 325 | |
326 | 326 | //skip if this field is already defined (from another index) |
327 | - if (in_array($fieldDef['name'],$fields_used)) continue; |
|
327 | + if (in_array($fieldDef['name'], $fields_used)) continue; |
|
328 | 328 | |
329 | 329 | //get the proper export label |
330 | - $fieldName = translateForExport($fieldDef['name'],$this->_focus); |
|
330 | + $fieldName = translateForExport($fieldDef['name'], $this->_focus); |
|
331 | 331 | |
332 | 332 | |
333 | 333 | $index_array[$index['name'].'::'.$fieldDef['name']] = $fieldName; |
@@ -338,9 +338,9 @@ discard block |
||
338 | 338 | } |
339 | 339 | |
340 | 340 | //special handling for beans with first_name and last_name |
341 | - if(in_array('first_name', $fields_used) && in_array('last_name', $fields_used)){ |
|
341 | + if (in_array('first_name', $fields_used) && in_array('last_name', $fields_used)) { |
|
342 | 342 | //since both full name and last name fields have been mapped, add full name index |
343 | - $index_array['full_name::full_name'] = translateForExport('full_name',$this->_focus); |
|
343 | + $index_array['full_name::full_name'] = translateForExport('full_name', $this->_focus); |
|
344 | 344 | $fields_used[] = 'full_name'; |
345 | 345 | } |
346 | 346 |
@@ -1,5 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
3 | + die('Not A Valid Entry Point'); |
|
4 | +} |
|
3 | 5 | |
4 | 6 | /********************************************************************************* |
5 | 7 | * SugarCRM Community Edition is a customer relationship management program developed by |
@@ -83,18 +85,20 @@ discard block |
||
83 | 85 | $indexes = array_merge($custmIndexes,$indexes); |
84 | 86 | } |
85 | 87 | |
86 | - if ( $this->_focus->getFieldDefinition('email1') ) |
|
87 | - $indexes[] = array( |
|
88 | + if ( $this->_focus->getFieldDefinition('email1') ) { |
|
89 | + $indexes[] = array( |
|
88 | 90 | 'name' => 'special_idx_email1', |
89 | 91 | 'type' => 'index', |
90 | 92 | 'fields' => array('email1') |
91 | 93 | ); |
92 | - if ( $this->_focus->getFieldDefinition('email2') ) |
|
93 | - $indexes[] = array( |
|
94 | + } |
|
95 | + if ( $this->_focus->getFieldDefinition('email2') ) { |
|
96 | + $indexes[] = array( |
|
94 | 97 | 'name' => 'special_idx_email2', |
95 | 98 | 'type' => 'index', |
96 | 99 | 'fields' => array('email2') |
97 | 100 | ); |
101 | + } |
|
98 | 102 | |
99 | 103 | return $indexes; |
100 | 104 | } |
@@ -116,12 +120,15 @@ discard block |
||
116 | 120 | if ($index['type'] == "index"){ |
117 | 121 | $labelsArray = array(); |
118 | 122 | foreach ($index['fields'] as $field){ |
119 | - if ($field == 'deleted') continue; |
|
123 | + if ($field == 'deleted') { |
|
124 | + continue; |
|
125 | + } |
|
120 | 126 | $fieldDef = $this->_focus->getFieldDefinition($field); |
121 | - if ( isset($fieldDef['vname']) && isset($super_language_pack[$fieldDef['vname']]) ) |
|
122 | - $labelsArray[$fieldDef['name']] = $super_language_pack[$fieldDef['vname']]; |
|
123 | - else |
|
124 | - $labelsArray[$fieldDef['name']] = $fieldDef['name']; |
|
127 | + if ( isset($fieldDef['vname']) && isset($super_language_pack[$fieldDef['vname']]) ) { |
|
128 | + $labelsArray[$fieldDef['name']] = $super_language_pack[$fieldDef['vname']]; |
|
129 | + } else { |
|
130 | + $labelsArray[$fieldDef['name']] = $fieldDef['name']; |
|
131 | + } |
|
125 | 132 | } |
126 | 133 | $index_array[$index['name']] = str_replace(":", "",implode(", ",$labelsArray)); |
127 | 134 | } |
@@ -144,33 +151,37 @@ discard block |
||
144 | 151 | { |
145 | 152 | $emailAddress = new SugarEmailAddress(); |
146 | 153 | $email = $field; |
147 | - if ( $emailAddress->getCountEmailAddressByBean($this->_focus->$email,$this->_focus,($field == 'email1')) > 0 ) |
|
148 | - return true; |
|
149 | - } |
|
150 | - else |
|
154 | + if ( $emailAddress->getCountEmailAddressByBean($this->_focus->$email,$this->_focus,($field == 'email1')) > 0 ) { |
|
155 | + return true; |
|
156 | + } |
|
157 | + } else |
|
151 | 158 | { |
152 | 159 | $index_fields = array('deleted' => '0'); |
153 | 160 | if( is_array($field) ) |
154 | 161 | { |
155 | 162 | foreach($field as $tmpField) |
156 | 163 | { |
157 | - if ($tmpField == 'deleted') |
|
158 | - continue; |
|
159 | - if (strlen($this->_focus->$tmpField) > 0) |
|
160 | - $index_fields[$tmpField] = $this->_focus->$tmpField; |
|
164 | + if ($tmpField == 'deleted') { |
|
165 | + continue; |
|
166 | + } |
|
167 | + if (strlen($this->_focus->$tmpField) > 0) { |
|
168 | + $index_fields[$tmpField] = $this->_focus->$tmpField; |
|
169 | + } |
|
161 | 170 | } |
171 | + } elseif($field != 'deleted' && strlen($this->_focus->$field) > 0) { |
|
172 | + $index_fields[$field] = $this->_focus->$field; |
|
162 | 173 | } |
163 | - elseif($field != 'deleted' && strlen($this->_focus->$field) > 0) |
|
164 | - $index_fields[$field] = $this->_focus->$field; |
|
165 | 174 | |
166 | - if ( count($index_fields) <= 1 ) |
|
167 | - continue; |
|
175 | + if ( count($index_fields) <= 1 ) { |
|
176 | + continue; |
|
177 | + } |
|
168 | 178 | |
169 | 179 | $newfocus = loadBean($this->_focus->module_dir); |
170 | 180 | $result = $newfocus->retrieve_by_string_fields($index_fields,true); |
171 | 181 | |
172 | - if ( !is_null($result) ) |
|
173 | - return true; |
|
182 | + if ( !is_null($result) ) { |
|
183 | + return true; |
|
184 | + } |
|
174 | 185 | } |
175 | 186 | } |
176 | 187 | |
@@ -204,13 +215,15 @@ discard block |
||
204 | 215 | $fieldlist=array(); |
205 | 216 | $customIndexlist=array(); |
206 | 217 | foreach($origIndexList as $iv){ |
207 | - if(empty($iv)) continue; |
|
218 | + if(empty($iv)) { |
|
219 | + continue; |
|
220 | + } |
|
208 | 221 | $field_index_array = explode('::',$iv); |
209 | 222 | if($field_index_array[0] == 'customfield'){ |
210 | 223 | //this is a custom field, so place in custom array |
211 | 224 | $customIndexlist[] = $field_index_array[1]; |
212 | 225 | |
213 | - }else{ |
|
226 | + } else{ |
|
214 | 227 | //this is not a custom field, so place in index list |
215 | 228 | $indexlist[] = $field_index_array[0]; |
216 | 229 | if(isset($field_index_array[1])) { |
@@ -237,8 +250,9 @@ discard block |
||
237 | 250 | // loop through var def indexes and compare with selected indexes |
238 | 251 | foreach ($this->_getIndexVardefs() as $index){ |
239 | 252 | // if we get an index not in the indexlist, loop |
240 | - if ( !in_array($index['name'],$indexlist) ) |
|
241 | - continue; |
|
253 | + if ( !in_array($index['name'],$indexlist) ) { |
|
254 | + continue; |
|
255 | + } |
|
242 | 256 | |
243 | 257 | // This handles the special case of duplicate email checking |
244 | 258 | if ( $index['name'] == 'special_idx_email1' || $index['name'] == 'special_idx_email2' ) { |
@@ -249,31 +263,35 @@ discard block |
||
249 | 263 | $this->_focus, |
250 | 264 | ($index['name'] == 'special_idx_email1') |
251 | 265 | ) > 0 ){ foreach($index['fields'] as $field){ |
252 | - if($field !='deleted') |
|
253 | - $this->_dupedFields[] = $field; |
|
266 | + if($field !='deleted') { |
|
267 | + $this->_dupedFields[] = $field; |
|
268 | + } |
|
254 | 269 | } |
255 | 270 | } |
256 | 271 | } |
257 | 272 | // Adds a hook so you can define a method in the bean to handle dupe checking |
258 | 273 | elseif ( isset($index['dupeCheckFunction']) ) { |
259 | 274 | $functionName = substr_replace($index['dupeCheckFunction'],'',0,9); |
260 | - if ( method_exists($this->_focus,$functionName) && $this->_focus->$functionName($index) === true) |
|
261 | - return $this->_focus->$functionName($index); |
|
262 | - } |
|
263 | - else { |
|
275 | + if ( method_exists($this->_focus,$functionName) && $this->_focus->$functionName($index) === true) { |
|
276 | + return $this->_focus->$functionName($index); |
|
277 | + } |
|
278 | + } else { |
|
264 | 279 | $index_fields = array('deleted' => '0'); |
265 | 280 | //search only for the field we have selected |
266 | 281 | foreach($index['fields'] as $field){ |
267 | - if ($field == 'deleted' || !in_array($field,$fieldlist)) |
|
268 | - continue; |
|
269 | - if (!in_array($field,$index_fields)) |
|
270 | - if (isset($this->_focus->$field) && strlen($this->_focus->$field) > 0) |
|
282 | + if ($field == 'deleted' || !in_array($field,$fieldlist)) { |
|
283 | + continue; |
|
284 | + } |
|
285 | + if (!in_array($field,$index_fields)) { |
|
286 | + if (isset($this->_focus->$field) && strlen($this->_focus->$field) > 0) |
|
271 | 287 | $index_fields[$field] = $this->_focus->$field; |
288 | + } |
|
272 | 289 | } |
273 | 290 | |
274 | 291 | // if there are no valid fields in the index field list, loop |
275 | - if ( count($index_fields) <= 1 ) |
|
276 | - continue; |
|
292 | + if ( count($index_fields) <= 1 ) { |
|
293 | + continue; |
|
294 | + } |
|
277 | 295 | |
278 | 296 | $newfocus = loadBean($this->_focus->module_dir); |
279 | 297 | $result = $newfocus->retrieve_by_string_fields($index_fields,true); |
@@ -320,11 +338,15 @@ discard block |
||
320 | 338 | $fieldName=''; |
321 | 339 | |
322 | 340 | //skip this field if it is the deleted field, not in the importable keys array, or a field in the exclude array |
323 | - if (!in_array($field, $importable_keys) || in_array($field, $exclude_array)) continue; |
|
341 | + if (!in_array($field, $importable_keys) || in_array($field, $exclude_array)) { |
|
342 | + continue; |
|
343 | + } |
|
324 | 344 | $fieldDef = $this->_focus->getFieldDefinition($field); |
325 | 345 | |
326 | 346 | //skip if this field is already defined (from another index) |
327 | - if (in_array($fieldDef['name'],$fields_used)) continue; |
|
347 | + if (in_array($fieldDef['name'],$fields_used)) { |
|
348 | + continue; |
|
349 | + } |
|
328 | 350 | |
329 | 351 | //get the proper export label |
330 | 352 | $fieldName = translateForExport($fieldDef['name'],$this->_focus); |
@@ -133,7 +133,6 @@ |
||
133 | 133 | /** |
134 | 134 | * Checks to see if the given bean is a duplicate based off the given fields |
135 | 135 | * |
136 | - * @param array $indexlist |
|
137 | 136 | * @return bool true if this bean is a duplicate or false if it isn't |
138 | 137 | */ |
139 | 138 | public function isADuplicateRecordByFields($fieldList) |