Completed
Push — 14.2 ( 5d5d3f...19b4ef )
by Nathan
74:47 queued 45:33
created
infolog/inc/class.infolog_export_csv.inc.php 1 patch
Braces   +56 added lines, -16 removed lines patch added patch discarded remove patch
@@ -18,7 +18,8 @@  discard block
 block discarded – undo
18 18
 {
19 19
 
20 20
 
21
-	public function __construct() {
21
+	public function __construct()
22
+	{
22 23
 		translation::add_app('infolog');
23 24
 		$this->bo = new infolog_bo();
24 25
 		$this->get_selects();
@@ -50,7 +51,8 @@  discard block
 block discarded – undo
50 51
 			case 'all':
51 52
 				// do we need to query the cf's
52 53
 				$query['custom_fields'] = false;
53
-				foreach($options['mapping'] + (array)$_definition->filter as $field => $map) {
54
+				foreach($options['mapping'] + (array)$_definition->filter as $field => $map)
55
+				{
54 56
 					if($field[0] == '#')
55 57
 					{
56 58
 						$query['custom_fields'] = true;
@@ -76,11 +78,20 @@  discard block
 block discarded – undo
76 78
 					// Handle ranges
77 79
 					foreach($query['col_filter'] as $field => $value)
78 80
 					{
79
-						if(!is_array($value) || (!$value['from'] && !$value['to'])) continue;
81
+						if(!is_array($value) || (!$value['from'] && !$value['to']))
82
+						{
83
+							continue;
84
+						}
80 85
 
81 86
 						// Ranges are inclusive, so should be provided that way (from 2 to 10 includes 2 and 10)
82
-						if($value['from']) $query['col_filter'][] = "$field >= " . (int)$value['from'];
83
-						if($value['to']) $query['col_filter'][] = "$field <= " . (int)$value['to'];
87
+						if($value['from'])
88
+						{
89
+							$query['col_filter'][] = "$field >= " . (int)$value['from'];
90
+						}
91
+						if($value['to'])
92
+						{
93
+							$query['col_filter'][] = "$field <= " . (int)$value['to'];
94
+						}
84 95
 						unset($query['col_filter'][$field]);
85 96
 					}
86 97
 				}
@@ -97,9 +108,13 @@  discard block
 block discarded – undo
97 108
 					{
98 109
 						foreach($selection as &$row)
99 110
 						{
100
-							if($row[$field]) $cf_preload[$app][] = $row[$field];
111
+							if($row[$field])
112
+							{
113
+								$cf_preload[$app][] = $row[$field];
114
+							}
101 115
 						}
102
-						if($cf_preload[$app]){
116
+						if($cf_preload[$app])
117
+						{
103 118
 							 $selects[$field] = egw_link::titles($app, $cf_preload[$app]);
104 119
 							//error_log('Preload ' . $field . '['.$app . ']: ' . implode(',',$cf_preload[$app]));
105 120
 						}
@@ -125,10 +140,17 @@  discard block
 block discarded – undo
125 140
 		if($ids && $options['mapping']['info_link_id'])
126 141
 		{
127 142
 			$links = egw_link::get_links_multiple('infolog', $ids, true, '!'.egw_link::VFS_APPNAME);
128
-			foreach($links as $id => $link) {
129
-				if(!is_array($selection[$id])) break;
143
+			foreach($links as $id => $link)
144
+			{
145
+				if(!is_array($selection[$id]))
146
+				{
147
+					break;
148
+				}
130 149
 				$selection[$id]['info_link_id'] = $link;
131
-				if($options['convert']) $selection[$id]['info_link_id'] = egw_link::title($link['app'], $link['id']);
150
+				if($options['convert'])
151
+				{
152
+					$selection[$id]['info_link_id'] = egw_link::title($link['app'], $link['id']);
153
+				}
132 154
 			}
133 155
 		}
134 156
 		// If exporting PM fields, pre-load them all at once
@@ -137,7 +159,10 @@  discard block
 block discarded – undo
137 159
 			$projects = egw_link::get_links_multiple('infolog', $ids, true, 'projectmanager');
138 160
 			foreach($projects as $id => $links)
139 161
 			{
140
-				if(!is_array($selection[$id])) break;
162
+				if(!is_array($selection[$id]))
163
+				{
164
+					break;
165
+				}
141 166
 				$selection[$id]['pm_id'] = current($links);
142 167
 				$selection[$id]['project'] = egw_link::title('projectmanager', $selection[$id]['pm_id']);
143 168
 				$this->selects['pl_id'] = ExecMethod('projectmanager.projectmanager_pricelist_bo.pricelist',$selection[$id]['pm_id']);
@@ -149,7 +174,10 @@  discard block
 block discarded – undo
149 174
 			if(!is_array($_identifier))
150 175
 			{
151 176
 				$record = new infolog_egw_record($_identifier);
152
-				if($link = $links[$record->info_id]) $record->info_link_id = $options['convert'] ? egw_link::title($link['app'], $link['id']) : $link;
177
+				if($link = $links[$record->info_id])
178
+				{
179
+					$record->info_link_id = $options['convert'] ? egw_link::title($link['app'], $link['id']) : $link;
180
+				}
153 181
 				if($project = $projects[$record->info_id])
154 182
 				{
155 183
 					$record->pm_id = current($project);
@@ -171,7 +199,10 @@  discard block
 block discarded – undo
171 199
 				// Force 0 times to ''
172 200
 				foreach(array('info_planned_time', 'info_used_time', 'info_replanned_time') as $field)
173 201
 				{
174
-					if($record->$field == 0) $record->$field = '';
202
+					if($record->$field == 0)
203
+					{
204
+						$record->$field = '';
205
+					}
175 206
 				}
176 207
 			}
177 208
 			else
@@ -179,7 +210,10 @@  discard block
 block discarded – undo
179 210
 				// Implode arrays, so they don't say 'Array'
180 211
 				foreach($record->get_record_array() as $key => $value)
181 212
 				{
182
-					if(is_array($value)) $record->$key = implode(',', $value);
213
+					if(is_array($value))
214
+					{
215
+						$record->$key = implode(',', $value);
216
+					}
183 217
 				}
184 218
 			}
185 219
 			$export_object->export_record($record);
@@ -268,10 +302,16 @@  discard block
 block discarded – undo
268 302
 	{
269 303
 		foreach($filters as $field_name => &$settings)
270 304
 		{
271
-			if($this->selects[$field_name]) $settings['values'] = $this->selects[$field_name];
305
+			if($this->selects[$field_name])
306
+			{
307
+				$settings['values'] = $this->selects[$field_name];
308
+			}
272 309
 			
273 310
 			// Infolog can't handle ranges in custom fields due to the way searching is done.
274
-			if(strpos($field_name, '#') === 0 && strpos($settings['type'],'date') === 0) unset($filters[$field_name]);
311
+			if(strpos($field_name, '#') === 0 && strpos($settings['type'],'date') === 0)
312
+			{
313
+				unset($filters[$field_name]);
314
+			}
275 315
 		}
276 316
 	}
277 317
 
Please login to merge, or discard this patch.