Completed
Push — 16.1 ( 7ccc73...046888 )
by Nathan
64:46 queued 51:15
created
resources/setup/tables_current.inc.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -14,26 +14,26 @@  discard block
 block discarded – undo
14 14
 $phpgw_baseline = array(
15 15
 	'egw_resources' => array(
16 16
 		'fd' => array(
17
-			'res_id' => array('type' => 'auto','nullable' => False),
18
-			'name' => array('type' => 'varchar','precision' => '100'),
19
-			'short_description' => array('type' => 'varchar','precision' => '100'),
20
-			'cat_id' => array('type' => 'int','meta' => 'category','precision' => '11','nullable' => False),
21
-			'quantity' => array('type' => 'int','precision' => '11','default' => '1'),
22
-			'useable' => array('type' => 'int','precision' => '11','default' => '1'),
23
-			'location' => array('type' => 'varchar','precision' => '100'),
24
-			'bookable' => array('type' => 'varchar','precision' => '1'),
25
-			'buyable' => array('type' => 'varchar','precision' => '1'),
26
-			'prize' => array('type' => 'varchar','precision' => '200'),
17
+			'res_id' => array('type' => 'auto', 'nullable' => False),
18
+			'name' => array('type' => 'varchar', 'precision' => '100'),
19
+			'short_description' => array('type' => 'varchar', 'precision' => '100'),
20
+			'cat_id' => array('type' => 'int', 'meta' => 'category', 'precision' => '11', 'nullable' => False),
21
+			'quantity' => array('type' => 'int', 'precision' => '11', 'default' => '1'),
22
+			'useable' => array('type' => 'int', 'precision' => '11', 'default' => '1'),
23
+			'location' => array('type' => 'varchar', 'precision' => '100'),
24
+			'bookable' => array('type' => 'varchar', 'precision' => '1'),
25
+			'buyable' => array('type' => 'varchar', 'precision' => '1'),
26
+			'prize' => array('type' => 'varchar', 'precision' => '200'),
27 27
 			'long_description' => array('type' => 'longtext'),
28
-			'picture_src' => array('type' => 'varchar','precision' => '20'),
29
-			'accessory_of' => array('type' => 'int','precision' => '11','default' => '-1'),
30
-			'storage_info' => array('type' => 'varchar','precision' => '200'),
31
-			'inventory_number' => array('type' => 'varchar','precision' => '20'),
32
-			'deleted' => array('type' => 'int','meta' => 'timestamp','precision' => '8'),
33
-			'res_creator' => array('type' => 'int','meta' => 'user','precision' => '11'),
34
-			'res_created' => array('type' => 'int','meta' => 'timestamp','precision' => '8'),
35
-			'res_modifier' => array('type' => 'int','meta' => 'user','precision' => '11'),
36
-			'res_modified' => array('type' => 'int','meta' => 'timestamp','precision' => '8')
28
+			'picture_src' => array('type' => 'varchar', 'precision' => '20'),
29
+			'accessory_of' => array('type' => 'int', 'precision' => '11', 'default' => '-1'),
30
+			'storage_info' => array('type' => 'varchar', 'precision' => '200'),
31
+			'inventory_number' => array('type' => 'varchar', 'precision' => '20'),
32
+			'deleted' => array('type' => 'int', 'meta' => 'timestamp', 'precision' => '8'),
33
+			'res_creator' => array('type' => 'int', 'meta' => 'user', 'precision' => '11'),
34
+			'res_created' => array('type' => 'int', 'meta' => 'timestamp', 'precision' => '8'),
35
+			'res_modifier' => array('type' => 'int', 'meta' => 'user', 'precision' => '11'),
36
+			'res_modified' => array('type' => 'int', 'meta' => 'timestamp', 'precision' => '8')
37 37
 		),
38 38
 		'pk' => array('res_id'),
39 39
 		'fk' => array(),
@@ -42,12 +42,12 @@  discard block
 block discarded – undo
42 42
 	),
43 43
 	'egw_resources_extra' => array(
44 44
 		'fd' => array(
45
-			'extra_id' => array('type' => 'int','precision' => '4','nullable' => False),
46
-			'extra_name' => array('type' => 'varchar','meta' => 'cfname','precision' => '40','nullable' => False),
47
-			'extra_owner' => array('type' => 'int','meta' => 'account','precision' => '4','nullable' => False,'default' => '-1'),
48
-			'extra_value' => array('type' => 'varchar','meta' => 'cfvalue','precision' => '255','nullable' => False,'default' => '')
45
+			'extra_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False),
46
+			'extra_name' => array('type' => 'varchar', 'meta' => 'cfname', 'precision' => '40', 'nullable' => False),
47
+			'extra_owner' => array('type' => 'int', 'meta' => 'account', 'precision' => '4', 'nullable' => False, 'default' => '-1'),
48
+			'extra_value' => array('type' => 'varchar', 'meta' => 'cfvalue', 'precision' => '255', 'nullable' => False, 'default' => '')
49 49
 		),
50
-		'pk' => array('extra_id','extra_name','extra_owner'),
50
+		'pk' => array('extra_id', 'extra_name', 'extra_owner'),
51 51
 		'fk' => array(),
52 52
 		'ix' => array(),
53 53
 		'uc' => array()
Please login to merge, or discard this patch.
resources/setup/tables_update.inc.php 2 patches
Spacing   +111 added lines, -111 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 
17 17
 function resources_upgrade0_0_1_008()
18 18
 {
19
-	$GLOBALS['phpgw_setup']->oProc->AddColumn('egw_resources','picture_src',array(
19
+	$GLOBALS['phpgw_setup']->oProc->AddColumn('egw_resources', 'picture_src', array(
20 20
 		'type' => 'varchar',
21 21
 		'precision' => '20'
22 22
 	));
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
 function resources_upgrade0_0_1_012()
30 30
 {
31
-	$GLOBALS['phpgw_setup']->oProc->AddColumn('egw_resources','picture_thumb',array(
31
+	$GLOBALS['phpgw_setup']->oProc->AddColumn('egw_resources', 'picture_thumb', array(
32 32
 		'type' => 'blob'
33 33
 	));
34 34
 
@@ -39,49 +39,49 @@  discard block
 block discarded – undo
39 39
 
40 40
 function resources_upgrade0_0_1_013()
41 41
 {
42
-	$GLOBALS['phpgw_setup']->oProc->DropColumn('egw_resources',array(
42
+	$GLOBALS['phpgw_setup']->oProc->DropColumn('egw_resources', array(
43 43
 		'fd' => array(
44 44
 			'id' => array('type' => 'auto'),
45
-			'name' => array('type' => 'varchar','precision' => '100'),
46
-			'short_description' => array('type' => 'varchar','precision' => '100'),
47
-			'cat_id' => array('type' => 'int','precision' => '11','nullable' => False),
48
-			'quantity' => array('type' => 'int','precision' => '11'),
49
-			'useable' => array('type' => 'int','precision' => '11'),
50
-			'location' => array('type' => 'varchar','precision' => '100'),
51
-			'bookable' => array('type' => 'varchar','precision' => '1'),
52
-			'buyable' => array('type' => 'varchar','precision' => '1'),
53
-			'prize' => array('type' => 'varchar','precision' => '200'),
45
+			'name' => array('type' => 'varchar', 'precision' => '100'),
46
+			'short_description' => array('type' => 'varchar', 'precision' => '100'),
47
+			'cat_id' => array('type' => 'int', 'precision' => '11', 'nullable' => False),
48
+			'quantity' => array('type' => 'int', 'precision' => '11'),
49
+			'useable' => array('type' => 'int', 'precision' => '11'),
50
+			'location' => array('type' => 'varchar', 'precision' => '100'),
51
+			'bookable' => array('type' => 'varchar', 'precision' => '1'),
52
+			'buyable' => array('type' => 'varchar', 'precision' => '1'),
53
+			'prize' => array('type' => 'varchar', 'precision' => '200'),
54 54
 			'long_description' => array('type' => 'longtext'),
55
-			'accessories' => array('type' => 'varchar','precision' => '50'),
56
-			'picture_src' => array('type' => 'varchar','precision' => '20'),
55
+			'accessories' => array('type' => 'varchar', 'precision' => '50'),
56
+			'picture_src' => array('type' => 'varchar', 'precision' => '20'),
57 57
 			'picture_thumb' => array('type' => 'blob')
58 58
 		),
59 59
 		'pk' => array('id'),
60 60
 		'fk' => array(),
61 61
 		'ix' => array(),
62 62
 		'uc' => array()
63
-	),'picture');
64
-	$GLOBALS['phpgw_setup']->oProc->DropColumn('egw_resources',array(
63
+	), 'picture');
64
+	$GLOBALS['phpgw_setup']->oProc->DropColumn('egw_resources', array(
65 65
 		'fd' => array(
66 66
 			'id' => array('type' => 'auto'),
67
-			'name' => array('type' => 'varchar','precision' => '100'),
68
-			'short_description' => array('type' => 'varchar','precision' => '100'),
69
-			'cat_id' => array('type' => 'int','precision' => '11','nullable' => False),
70
-			'quantity' => array('type' => 'int','precision' => '11'),
71
-			'useable' => array('type' => 'int','precision' => '11'),
72
-			'location' => array('type' => 'varchar','precision' => '100'),
73
-			'bookable' => array('type' => 'varchar','precision' => '1'),
74
-			'buyable' => array('type' => 'varchar','precision' => '1'),
75
-			'prize' => array('type' => 'varchar','precision' => '200'),
67
+			'name' => array('type' => 'varchar', 'precision' => '100'),
68
+			'short_description' => array('type' => 'varchar', 'precision' => '100'),
69
+			'cat_id' => array('type' => 'int', 'precision' => '11', 'nullable' => False),
70
+			'quantity' => array('type' => 'int', 'precision' => '11'),
71
+			'useable' => array('type' => 'int', 'precision' => '11'),
72
+			'location' => array('type' => 'varchar', 'precision' => '100'),
73
+			'bookable' => array('type' => 'varchar', 'precision' => '1'),
74
+			'buyable' => array('type' => 'varchar', 'precision' => '1'),
75
+			'prize' => array('type' => 'varchar', 'precision' => '200'),
76 76
 			'long_description' => array('type' => 'longtext'),
77
-			'accessories' => array('type' => 'varchar','precision' => '50'),
78
-			'picture_src' => array('type' => 'varchar','precision' => '20')
77
+			'accessories' => array('type' => 'varchar', 'precision' => '50'),
78
+			'picture_src' => array('type' => 'varchar', 'precision' => '20')
79 79
 		),
80 80
 		'pk' => array('id'),
81 81
 		'fk' => array(),
82 82
 		'ix' => array(),
83 83
 		'uc' => array()
84
-	),'picture_thumb');
84
+	), 'picture_thumb');
85 85
 
86 86
 	$GLOBALS['setup_info']['resources']['currentver'] = '0.0.1.014';
87 87
 	return $GLOBALS['setup_info']['resources']['currentver'];
@@ -90,12 +90,12 @@  discard block
 block discarded – undo
90 90
 
91 91
 function resources_upgrade0_0_1_014()
92 92
 {
93
-	$GLOBALS['phpgw_setup']->oProc->AlterColumn('egw_resources','quantity',array(
93
+	$GLOBALS['phpgw_setup']->oProc->AlterColumn('egw_resources', 'quantity', array(
94 94
 		'type' => 'int',
95 95
 		'precision' => '11',
96 96
 		'default' => '1'
97 97
 	));
98
-	$GLOBALS['phpgw_setup']->oProc->AlterColumn('egw_resources','useable',array(
98
+	$GLOBALS['phpgw_setup']->oProc->AlterColumn('egw_resources', 'useable', array(
99 99
 		'type' => 'int',
100 100
 		'precision' => '11',
101 101
 		'default' => '1'
@@ -108,16 +108,16 @@  discard block
 block discarded – undo
108 108
 
109 109
 function resources_upgrade0_0_1_015()
110 110
 {
111
-	$GLOBALS['phpgw_setup']->oProc->AlterColumn('egw_resources','accessories',array(
111
+	$GLOBALS['phpgw_setup']->oProc->AlterColumn('egw_resources', 'accessories', array(
112 112
 		'type' => 'varchar',
113 113
 		'precision' => '100'
114 114
 	));
115
-	$GLOBALS['phpgw_setup']->oProc->AddColumn('egw_resources','accessory_only',array(
115
+	$GLOBALS['phpgw_setup']->oProc->AddColumn('egw_resources', 'accessory_only', array(
116 116
 		'type' => 'varchar',
117 117
 		'precision' => '1',
118 118
 		'default' => '0'
119 119
 	));
120
-	$GLOBALS['phpgw_setup']->oProc->AddColumn('egw_resources','relatives',array(
120
+	$GLOBALS['phpgw_setup']->oProc->AddColumn('egw_resources', 'relatives', array(
121 121
 		'type' => 'varchar',
122 122
 		'precision' => '100'
123 123
 	));
@@ -129,70 +129,70 @@  discard block
 block discarded – undo
129 129
 
130 130
 function resources_upgrade0_0_1_016()
131 131
 {
132
-	$GLOBALS['phpgw_setup']->oProc->DropColumn('egw_resources',array(
132
+	$GLOBALS['phpgw_setup']->oProc->DropColumn('egw_resources', array(
133 133
 		'fd' => array(
134 134
 			'id' => array('type' => 'auto'),
135
-			'name' => array('type' => 'varchar','precision' => '100'),
136
-			'short_description' => array('type' => 'varchar','precision' => '100'),
137
-			'cat_id' => array('type' => 'int','precision' => '11','nullable' => False),
138
-			'quantity' => array('type' => 'int','precision' => '11','default' => '1'),
139
-			'useable' => array('type' => 'int','precision' => '11','default' => '1'),
140
-			'location' => array('type' => 'varchar','precision' => '100'),
141
-			'bookable' => array('type' => 'varchar','precision' => '1'),
142
-			'buyable' => array('type' => 'varchar','precision' => '1'),
143
-			'prize' => array('type' => 'varchar','precision' => '200'),
135
+			'name' => array('type' => 'varchar', 'precision' => '100'),
136
+			'short_description' => array('type' => 'varchar', 'precision' => '100'),
137
+			'cat_id' => array('type' => 'int', 'precision' => '11', 'nullable' => False),
138
+			'quantity' => array('type' => 'int', 'precision' => '11', 'default' => '1'),
139
+			'useable' => array('type' => 'int', 'precision' => '11', 'default' => '1'),
140
+			'location' => array('type' => 'varchar', 'precision' => '100'),
141
+			'bookable' => array('type' => 'varchar', 'precision' => '1'),
142
+			'buyable' => array('type' => 'varchar', 'precision' => '1'),
143
+			'prize' => array('type' => 'varchar', 'precision' => '200'),
144 144
 			'long_description' => array('type' => 'longtext'),
145
-			'accessories' => array('type' => 'varchar','precision' => '100'),
146
-			'picture_src' => array('type' => 'varchar','precision' => '20'),
147
-			'relatives' => array('type' => 'varchar','precision' => '100')
145
+			'accessories' => array('type' => 'varchar', 'precision' => '100'),
146
+			'picture_src' => array('type' => 'varchar', 'precision' => '20'),
147
+			'relatives' => array('type' => 'varchar', 'precision' => '100')
148 148
 		),
149 149
 		'pk' => array('id'),
150 150
 		'fk' => array(),
151 151
 		'ix' => array(),
152 152
 		'uc' => array()
153
-	),'accessory_only');
154
-	$GLOBALS['phpgw_setup']->oProc->DropColumn('egw_resources',array(
153
+	), 'accessory_only');
154
+	$GLOBALS['phpgw_setup']->oProc->DropColumn('egw_resources', array(
155 155
 		'fd' => array(
156 156
 			'id' => array('type' => 'auto'),
157
-			'name' => array('type' => 'varchar','precision' => '100'),
158
-			'short_description' => array('type' => 'varchar','precision' => '100'),
159
-			'cat_id' => array('type' => 'int','precision' => '11','nullable' => False),
160
-			'quantity' => array('type' => 'int','precision' => '11','default' => '1'),
161
-			'useable' => array('type' => 'int','precision' => '11','default' => '1'),
162
-			'location' => array('type' => 'varchar','precision' => '100'),
163
-			'bookable' => array('type' => 'varchar','precision' => '1'),
164
-			'buyable' => array('type' => 'varchar','precision' => '1'),
165
-			'prize' => array('type' => 'varchar','precision' => '200'),
157
+			'name' => array('type' => 'varchar', 'precision' => '100'),
158
+			'short_description' => array('type' => 'varchar', 'precision' => '100'),
159
+			'cat_id' => array('type' => 'int', 'precision' => '11', 'nullable' => False),
160
+			'quantity' => array('type' => 'int', 'precision' => '11', 'default' => '1'),
161
+			'useable' => array('type' => 'int', 'precision' => '11', 'default' => '1'),
162
+			'location' => array('type' => 'varchar', 'precision' => '100'),
163
+			'bookable' => array('type' => 'varchar', 'precision' => '1'),
164
+			'buyable' => array('type' => 'varchar', 'precision' => '1'),
165
+			'prize' => array('type' => 'varchar', 'precision' => '200'),
166 166
 			'long_description' => array('type' => 'longtext'),
167
-			'accessories' => array('type' => 'varchar','precision' => '100'),
168
-			'picture_src' => array('type' => 'varchar','precision' => '20')
167
+			'accessories' => array('type' => 'varchar', 'precision' => '100'),
168
+			'picture_src' => array('type' => 'varchar', 'precision' => '20')
169 169
 		),
170 170
 		'pk' => array('id'),
171 171
 		'fk' => array(),
172 172
 		'ix' => array(),
173 173
 		'uc' => array()
174
-	),'relatives');
175
-	$GLOBALS['phpgw_setup']->oProc->DropColumn('egw_resources',array(
174
+	), 'relatives');
175
+	$GLOBALS['phpgw_setup']->oProc->DropColumn('egw_resources', array(
176 176
 		'fd' => array(
177 177
 			'id' => array('type' => 'auto'),
178
-			'name' => array('type' => 'varchar','precision' => '100'),
179
-			'short_description' => array('type' => 'varchar','precision' => '100'),
180
-			'cat_id' => array('type' => 'int','precision' => '11','nullable' => False),
181
-			'quantity' => array('type' => 'int','precision' => '11','default' => '1'),
182
-			'useable' => array('type' => 'int','precision' => '11','default' => '1'),
183
-			'location' => array('type' => 'varchar','precision' => '100'),
184
-			'bookable' => array('type' => 'varchar','precision' => '1'),
185
-			'buyable' => array('type' => 'varchar','precision' => '1'),
186
-			'prize' => array('type' => 'varchar','precision' => '200'),
178
+			'name' => array('type' => 'varchar', 'precision' => '100'),
179
+			'short_description' => array('type' => 'varchar', 'precision' => '100'),
180
+			'cat_id' => array('type' => 'int', 'precision' => '11', 'nullable' => False),
181
+			'quantity' => array('type' => 'int', 'precision' => '11', 'default' => '1'),
182
+			'useable' => array('type' => 'int', 'precision' => '11', 'default' => '1'),
183
+			'location' => array('type' => 'varchar', 'precision' => '100'),
184
+			'bookable' => array('type' => 'varchar', 'precision' => '1'),
185
+			'buyable' => array('type' => 'varchar', 'precision' => '1'),
186
+			'prize' => array('type' => 'varchar', 'precision' => '200'),
187 187
 			'long_description' => array('type' => 'longtext'),
188
-			'picture_src' => array('type' => 'varchar','precision' => '20')
188
+			'picture_src' => array('type' => 'varchar', 'precision' => '20')
189 189
 		),
190 190
 		'pk' => array('id'),
191 191
 		'fk' => array(),
192 192
 		'ix' => array(),
193 193
 		'uc' => array()
194
-	),'accessories');
195
-	$GLOBALS['phpgw_setup']->oProc->AddColumn('egw_resources','accessory_of',array(
194
+	), 'accessories');
195
+	$GLOBALS['phpgw_setup']->oProc->AddColumn('egw_resources', 'accessory_of', array(
196 196
 		'type' => 'int',
197 197
 		'precision' => '11',
198 198
 		'default' => '-1'
@@ -204,22 +204,22 @@  discard block
 block discarded – undo
204 204
 
205 205
 function resources_upgrade0_0_1_017()
206 206
 {
207
-	$GLOBALS['phpgw_setup']->oProc->RenameColumn('egw_resources','id','res_id');
208
-	$GLOBALS['phpgw_setup']->oProc->RefreshTable('egw_resources',array(
207
+	$GLOBALS['phpgw_setup']->oProc->RenameColumn('egw_resources', 'id', 'res_id');
208
+	$GLOBALS['phpgw_setup']->oProc->RefreshTable('egw_resources', array(
209 209
 		'fd' => array(
210 210
 			'res_id' => array('type' => 'auto'),
211
-			'name' => array('type' => 'varchar','precision' => '100'),
212
-			'short_description' => array('type' => 'varchar','precision' => '100'),
213
-			'cat_id' => array('type' => 'int','precision' => '11','nullable' => False),
214
-			'quantity' => array('type' => 'int','precision' => '11','default' => '1'),
215
-			'useable' => array('type' => 'int','precision' => '11','default' => '1'),
216
-			'location' => array('type' => 'varchar','precision' => '100'),
217
-			'bookable' => array('type' => 'varchar','precision' => '1'),
218
-			'buyable' => array('type' => 'varchar','precision' => '1'),
219
-			'prize' => array('type' => 'varchar','precision' => '200'),
211
+			'name' => array('type' => 'varchar', 'precision' => '100'),
212
+			'short_description' => array('type' => 'varchar', 'precision' => '100'),
213
+			'cat_id' => array('type' => 'int', 'precision' => '11', 'nullable' => False),
214
+			'quantity' => array('type' => 'int', 'precision' => '11', 'default' => '1'),
215
+			'useable' => array('type' => 'int', 'precision' => '11', 'default' => '1'),
216
+			'location' => array('type' => 'varchar', 'precision' => '100'),
217
+			'bookable' => array('type' => 'varchar', 'precision' => '1'),
218
+			'buyable' => array('type' => 'varchar', 'precision' => '1'),
219
+			'prize' => array('type' => 'varchar', 'precision' => '200'),
220 220
 			'long_description' => array('type' => 'longtext'),
221
-			'picture_src' => array('type' => 'varchar','precision' => '20'),
222
-			'accessory_of' => array('type' => 'int','precision' => '11','default' => '-1')
221
+			'picture_src' => array('type' => 'varchar', 'precision' => '20'),
222
+			'accessory_of' => array('type' => 'int', 'precision' => '11', 'default' => '-1')
223 223
 		),
224 224
 		'pk' => array('res_id'),
225 225
 		'fk' => array(),
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 
235 235
 function resources_upgrade0_0_1_018()
236 236
 {
237
-	$GLOBALS['phpgw_setup']->oProc->AddColumn('egw_resources','storage_info',array(
237
+	$GLOBALS['phpgw_setup']->oProc->AddColumn('egw_resources', 'storage_info', array(
238 238
 		'type' => 'varchar',
239 239
 		'precision' => '200'
240 240
 	));
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 
247 247
 function resources_upgrade0_0_1_019()
248 248
 {
249
-	$GLOBALS['phpgw_setup']->oProc->AddColumn('egw_resources','inventory_number',array(
249
+	$GLOBALS['phpgw_setup']->oProc->AddColumn('egw_resources', 'inventory_number', array(
250 250
 		'type' => 'varchar',
251 251
 		'precision' => '20'
252 252
 	));
@@ -258,14 +258,14 @@  discard block
 block discarded – undo
258 258
 
259 259
 function resources_upgrade0_0_1_020()
260 260
 {
261
-	$GLOBALS['egw_setup']->oProc->CreateTable('egw_resources_extra',array(
261
+	$GLOBALS['egw_setup']->oProc->CreateTable('egw_resources_extra', array(
262 262
 		'fd' => array(
263
-			'extra_id' => array('type' => 'int','precision' => '4','nullable' => False),
264
-			'extra_name' => array('type' => 'varchar','precision' => '40','nullable' => False),
265
-			'extra_owner' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '-1'),
266
-			'extra_value' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '')
263
+			'extra_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False),
264
+			'extra_name' => array('type' => 'varchar', 'precision' => '40', 'nullable' => False),
265
+			'extra_owner' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '-1'),
266
+			'extra_value' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '')
267 267
 		),
268
-		'pk' => array('extra_id','extra_name','extra_owner'),
268
+		'pk' => array('extra_id', 'extra_name', 'extra_owner'),
269 269
 		'fk' => array(),
270 270
 		'ix' => array(),
271 271
 		'uc' => array()
@@ -298,20 +298,20 @@  discard block
 block discarded – undo
298 298
 	Vfs::load_wrapper('sqlfs');
299 299
 	if (Vfs::is_dir('/resources/pictures'))
300 300
 	{
301
-		Vfs::remove('/resources/pictures/thumbs');	// remove thumb dir incl. thumbnails
302
-		foreach(Vfs::find('sqlfs://default/resources/pictures',array('url' => true)) as $url)
301
+		Vfs::remove('/resources/pictures/thumbs'); // remove thumb dir incl. thumbnails
302
+		foreach (Vfs::find('sqlfs://default/resources/pictures', array('url' => true)) as $url)
303 303
 		{
304
-			if (is_numeric($id = basename($url,'.jpg')))
304
+			if (is_numeric($id = basename($url, '.jpg')))
305 305
 			{
306 306
 				if (!Vfs::is_dir($dir = "/apps/resources/$id"))
307 307
 				{
308
-					Vfs::mkdir($dir,0777,STREAM_MKDIR_RECURSIVE);
308
+					Vfs::mkdir($dir, 0777, STREAM_MKDIR_RECURSIVE);
309 309
 				}
310
-				rename($url,'sqlfs://default'.$dir.'/.picture.jpg');	// we need to rename on the same wrapper!
310
+				rename($url, 'sqlfs://default'.$dir.'/.picture.jpg'); // we need to rename on the same wrapper!
311 311
 			}
312 312
 		}
313
-		Vfs::rmdir('/resources/pictures',0);
314
-		Vfs::rmdir('/resources',0);
313
+		Vfs::rmdir('/resources/pictures', 0);
314
+		Vfs::rmdir('/resources', 0);
315 315
 	}
316 316
 	return $GLOBALS['setup_info']['resources']['currentver'] = '1.6';
317 317
 }
@@ -326,14 +326,14 @@  discard block
 block discarded – undo
326 326
 function resources_upgrade1_8()
327 327
 {
328 328
 	// add location category required for CalDAV to distinguish between locations and resources
329
-	$GLOBALS['egw_setup']->db->insert($GLOBALS['egw_setup']->cats_table,array('cat_parent' => 0, 'cat_owner' => Api\Categories::GLOBAL_ACCOUNT,'cat_access' => 'public','cat_appname' => 'resources','cat_name' => 'Locations','cat_description' => 'This category has been added by setup','last_mod' => time()),false,__LINE__,__FILE__);
330
-	$locations_cat_id = $GLOBALS['egw_setup']->db->get_last_insert_id($GLOBALS['egw_setup']->cats_table,'cat_id');
329
+	$GLOBALS['egw_setup']->db->insert($GLOBALS['egw_setup']->cats_table, array('cat_parent' => 0, 'cat_owner' => Api\Categories::GLOBAL_ACCOUNT, 'cat_access' => 'public', 'cat_appname' => 'resources', 'cat_name' => 'Locations', 'cat_description' => 'This category has been added by setup', 'last_mod' => time()), false, __LINE__, __FILE__);
330
+	$locations_cat_id = $GLOBALS['egw_setup']->db->get_last_insert_id($GLOBALS['egw_setup']->cats_table, 'cat_id');
331 331
 	Api\Config::save_value('location_cats', $locations_cat_id, 'resources');
332 332
 
333 333
 	// Give default group all rights to this general cat
334
-	$defaultgroup = $GLOBALS['egw_setup']->add_account('Default','Default','Group',False,False);
335
-	$GLOBALS['egw_setup']->add_acl('resources','run',$defaultgroup);
336
-	$GLOBALS['egw_setup']->add_acl('resources',"L$locations_cat_id",$defaultgroup,399);
334
+	$defaultgroup = $GLOBALS['egw_setup']->add_account('Default', 'Default', 'Group', False, False);
335
+	$GLOBALS['egw_setup']->add_acl('resources', 'run', $defaultgroup);
336
+	$GLOBALS['egw_setup']->add_acl('resources', "L$locations_cat_id", $defaultgroup, 399);
337 337
 
338 338
 	return $GLOBALS['setup_info']['resources']['currentver'] = '1.9.001';
339 339
 }
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 
342 342
 function resources_upgrade1_9_001()
343 343
 {
344
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_resources','deleted',array(
344
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_resources', 'deleted', array(
345 345
 		'type' => 'int',
346 346
 		'precision' => '8'
347 347
 	));
@@ -358,22 +358,22 @@  discard block
 block discarded – undo
358 358
 
359 359
 function resources_upgrade1_9_003()
360 360
 {
361
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_resources','res_creator',array(
361
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_resources', 'res_creator', array(
362 362
 		'type' => 'int',
363 363
 		'meta' => 'user',
364 364
 		'precision' => '11'
365 365
 	));
366
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_resources','res_created',array(
366
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_resources', 'res_created', array(
367 367
 		'type' => 'int',
368 368
 		'meta' => 'timestamp',
369 369
 		'precision' => '8'
370 370
 	));
371
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_resources','res_modifier',array(
371
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_resources', 'res_modifier', array(
372 372
 		'type' => 'int',
373 373
 		'meta' => 'user',
374 374
 		'precision' => '11'
375 375
 	));
376
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_resources','res_modified',array(
376
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_resources', 'res_modified', array(
377 377
 		'type' => 'int',
378 378
 		'meta' => 'timestamp',
379 379
 		'precision' => '8'
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -333,7 +333,7 @@
 block discarded – undo
333 333
 	// Give default group all rights to this general cat
334 334
 	$defaultgroup = $GLOBALS['egw_setup']->add_account('Default','Default','Group',False,False);
335 335
 	$GLOBALS['egw_setup']->add_acl('resources','run',$defaultgroup);
336
-	$GLOBALS['egw_setup']->add_acl('resources',"L$locations_cat_id",$defaultgroup,399);
336
+	$GLOBALS['egw_setup']->add_acl('resources',"l$locations_cat_id",$defaultgroup,399);
337 337
 
338 338
 	return $GLOBALS['setup_info']['resources']['currentver'] = '1.9.001';
339 339
 }
Please login to merge, or discard this patch.
resources/setup/default_records.inc.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -14,26 +14,26 @@  discard block
 block discarded – undo
14 14
 $resources_table_prefix = 'egw_resources';
15 15
 
16 16
 // Add a general category for resources
17
-$GLOBALS['egw_setup']->db->insert($GLOBALS['egw_setup']->cats_table,array('cat_parent' => 0, 'cat_owner' => Api\Categories::GLOBAL_ACCOUNT,'cat_access' => 'public','cat_appname' => 'resources','cat_name' => 'General resources','cat_description' => 'This category has been added by setup','last_mod' => time()),false,__LINE__,__FILE__);
18
-$cat_id = $GLOBALS['egw_setup']->db->get_last_insert_id($GLOBALS['egw_setup']->cats_table,'cat_id');
19
-$GLOBALS['egw_setup']->db->insert($GLOBALS['egw_setup']->cats_table,array('cat_parent' => 0, 'cat_owner' => Api\Categories::GLOBAL_ACCOUNT,'cat_access' => 'public','cat_appname' => 'resources','cat_name' => 'Locations','cat_description' => 'This category has been added by setup','last_mod' => time()),false,__LINE__,__FILE__);
20
-$locations_cat_id = $GLOBALS['egw_setup']->db->get_last_insert_id($GLOBALS['egw_setup']->cats_table,'cat_id');
17
+$GLOBALS['egw_setup']->db->insert($GLOBALS['egw_setup']->cats_table, array('cat_parent' => 0, 'cat_owner' => Api\Categories::GLOBAL_ACCOUNT, 'cat_access' => 'public', 'cat_appname' => 'resources', 'cat_name' => 'General resources', 'cat_description' => 'This category has been added by setup', 'last_mod' => time()), false, __LINE__, __FILE__);
18
+$cat_id = $GLOBALS['egw_setup']->db->get_last_insert_id($GLOBALS['egw_setup']->cats_table, 'cat_id');
19
+$GLOBALS['egw_setup']->db->insert($GLOBALS['egw_setup']->cats_table, array('cat_parent' => 0, 'cat_owner' => Api\Categories::GLOBAL_ACCOUNT, 'cat_access' => 'public', 'cat_appname' => 'resources', 'cat_name' => 'Locations', 'cat_description' => 'This category has been added by setup', 'last_mod' => time()), false, __LINE__, __FILE__);
20
+$locations_cat_id = $GLOBALS['egw_setup']->db->get_last_insert_id($GLOBALS['egw_setup']->cats_table, 'cat_id');
21 21
 Api\Config::save_value('location_cats', $locations_cat_id, 'resources');
22 22
 
23 23
 // Give default group all rights to this general cat
24
-$defaultgroup = $GLOBALS['egw_setup']->add_account('Default','Default','Group',False,False);
25
-$GLOBALS['egw_setup']->add_acl('resources','run',$defaultgroup);
26
-$GLOBALS['egw_setup']->add_acl('resources',"L$cat_id",$defaultgroup,399);
27
-$GLOBALS['egw_setup']->add_acl('resources',"L$locations_cat_id",$defaultgroup,399);
24
+$defaultgroup = $GLOBALS['egw_setup']->add_account('Default', 'Default', 'Group', False, False);
25
+$GLOBALS['egw_setup']->add_acl('resources', 'run', $defaultgroup);
26
+$GLOBALS['egw_setup']->add_acl('resources', "L$cat_id", $defaultgroup, 399);
27
+$GLOBALS['egw_setup']->add_acl('resources', "L$locations_cat_id", $defaultgroup, 399);
28 28
 
29 29
 // Add two rooms to give user an idea of what resources is...
30 30
 $oProc->query("INSERT INTO {$resources_table_prefix} (name,cat_id,bookable,picture_src,accessory_of) VALUES ( 'Meeting room 1',$locations_cat_id,1,'cat_src',-1)");
31 31
 $oProc->query("INSERT INTO {$resources_table_prefix} (name,cat_id,bookable,picture_src,accessory_of) VALUES ( 'Meeting room 2',$locations_cat_id,1,'cat_src',-1)");
32
-$res_id = $oProc->m_odb->get_last_insert_id($resources_table_prefix,'res_id');
32
+$res_id = $oProc->m_odb->get_last_insert_id($resources_table_prefix, 'res_id');
33 33
 $oProc->query("INSERT INTO {$resources_table_prefix} (name,cat_id,bookable,picture_src,accessory_of) VALUES ( 'Fixed Beamer',$cat_id,0,'cat_src',$res_id)");
34 34
 
35 35
 // Turn on history by default
36
-foreach(array(
36
+foreach (array(
37 37
 	'history'     => 'history',
38 38
 ) as $name => $value)
39 39
 {
@@ -43,10 +43,10 @@  discard block
 block discarded – undo
43 43
 			'config_app' => 'resources',
44 44
 			'config_name' => $name,
45 45
 			'config_value' => $value,
46
-		),array(
46
+		), array(
47 47
 			'config_app' => 'resources',
48 48
 			'config_name' => $name,
49
-		),__LINE__,__FILE__
49
+		), __LINE__, __FILE__
50 50
 	);
51 51
 }
52 52
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,8 +23,8 @@
 block discarded – undo
23 23
 // Give default group all rights to this general cat
24 24
 $defaultgroup = $GLOBALS['egw_setup']->add_account('Default','Default','Group',False,False);
25 25
 $GLOBALS['egw_setup']->add_acl('resources','run',$defaultgroup);
26
-$GLOBALS['egw_setup']->add_acl('resources',"L$cat_id",$defaultgroup,399);
27
-$GLOBALS['egw_setup']->add_acl('resources',"L$locations_cat_id",$defaultgroup,399);
26
+$GLOBALS['egw_setup']->add_acl('resources',"l$cat_id",$defaultgroup,399);
27
+$GLOBALS['egw_setup']->add_acl('resources',"l$locations_cat_id",$defaultgroup,399);
28 28
 
29 29
 // Add two rooms to give user an idea of what resources is...
30 30
 $oProc->query("INSERT INTO {$resources_table_prefix} (name,cat_id,bookable,picture_src,accessory_of) VALUES ( 'Meeting room 1',$locations_cat_id,1,'cat_src',-1)");
Please login to merge, or discard this patch.
resources/inc/class.resources_wizard_import_csv.inc.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
 			'long_description'      => lang('Long description'),
45 45
 			'inventory_number'      => lang('inventory number'),
46 46
 			'accessory_of'	=> lang('Accessory of')
47
-                );
47
+				);
48 48
 
49 49
 		$custom = Api\Storage\Customfields::get('resources', true);
50 50
 		foreach($custom as $name => $data) {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
                 );
48 48
 
49 49
 		$custom = Api\Storage\Customfields::get('resources', true);
50
-		foreach($custom as $name => $data) {
50
+		foreach ($custom as $name => $data) {
51 51
 			$this->mapping_fields['#'.$name] = $data['label'];
52 52
 		}
53 53
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,8 @@
 block discarded – undo
47 47
                 );
48 48
 
49 49
 		$custom = Api\Storage\Customfields::get('resources', true);
50
-		foreach($custom as $name => $data) {
50
+		foreach($custom as $name => $data)
51
+		{
51 52
 			$this->mapping_fields['#'.$name] = $data['label'];
52 53
 		}
53 54
 
Please login to merge, or discard this patch.
resources/inc/class.resources_export_csv.inc.php 5 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -170,9 +170,9 @@
 block discarded – undo
170 170
 	 * Get selectbox values
171 171
 	 */
172 172
 	protected function get_selects()
173
-        {
173
+		{
174 174
 		$this->selects = array();
175
-        }
175
+		}
176 176
 
177 177
 	/**
178 178
 	 * Customize automatically generated filter fields
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -31,54 +31,54 @@  discard block
 block discarded – undo
31 31
 	 *
32 32
 	 * @param egw_record $_definition
33 33
 	 */
34
-	public function export( $_stream, importexport_definition $_definition) {
34
+	public function export($_stream, importexport_definition $_definition) {
35 35
 		$options = $_definition->plugin_options;
36 36
 
37 37
 		$selection = array();
38 38
 		if ($options['selection'] == 'search') {
39 39
 			// ui selection with checkbox 'selected'
40 40
 			$query = Api\Cache::getSession('resources', 'get_rows');
41
-			$query['num_rows'] = -1;	// all
41
+			$query['num_rows'] = -1; // all
42 42
 			unset($query['store_state']);
43
-			$query['csv_export'] = true;	// so get_rows method _can_ produce different content or not store state in the session
44
-			$this->bo->get_rows($query,$selection,$readonlys);
43
+			$query['csv_export'] = true; // so get_rows method _can_ produce different content or not store state in the session
44
+			$this->bo->get_rows($query, $selection, $readonlys);
45 45
 		}
46
-		elseif ( $options['selection'] == 'all' || $options['selection'] == 'filter') {
46
+		elseif ($options['selection'] == 'all' || $options['selection'] == 'filter') {
47 47
 			$query = array(
48 48
 				'num_rows'	=> -1,
49
-				'filter2'	=> -3,  // Accessories & resources
50
-				'csv_export' => true,	// so get_rows method _can_ produce different content or not store state in the session
51
-			);	// all
49
+				'filter2'	=> -3, // Accessories & resources
50
+				'csv_export' => true, // so get_rows method _can_ produce different content or not store state in the session
51
+			); // all
52 52
 			
53
-			if($options['selection'] == 'filter')
53
+			if ($options['selection'] == 'filter')
54 54
 			{
55 55
 				$filter = $_definition->filter;
56 56
 				// Handle ranges
57
-				foreach($filter as $field => $value)
57
+				foreach ($filter as $field => $value)
58 58
 				{
59
-					if($field == 'cat_id')
59
+					if ($field == 'cat_id')
60 60
 					{
61 61
 						$query['filter'] = $value;
62 62
 						continue;
63 63
 					}
64
-					if($field == 'filter2')
64
+					if ($field == 'filter2')
65 65
 					{
66 66
 						$query['filter2'] = $value;
67 67
 						continue;
68 68
 					}
69 69
 					$query['col_filter'][$field] = $value;
70
-					if(!is_array($value) || (!$value['from'] && !$value['to'])) continue;
70
+					if (!is_array($value) || (!$value['from'] && !$value['to'])) continue;
71 71
 
72 72
 					// Ranges are inclusive, so should be provided that way (from 2 to 10 includes 2 and 10)
73
-					if($value['from']) $query['col_filter'][] = "$field >= " . (int)$value['from'];
74
-					if($value['to']) $query['col_filter'][] = "$field <= " . (int)$value['to'];
73
+					if ($value['from']) $query['col_filter'][] = "$field >= ".(int)$value['from'];
74
+					if ($value['to']) $query['col_filter'][] = "$field <= ".(int)$value['to'];
75 75
 					unset($query['col_filter'][$field]);
76 76
 				}
77 77
 			}
78 78
 			
79
-			$this->bo->get_rows($query,$selection,$readonlys);
79
+			$this->bo->get_rows($query, $selection, $readonlys);
80 80
 		} else {
81
-			$selection = explode(',',$options['selection']);
81
+			$selection = explode(',', $options['selection']);
82 82
 		}
83 83
 
84 84
 		$export_object = new importexport_export_csv($_stream, (array)$options);
@@ -86,28 +86,28 @@  discard block
 block discarded – undo
86 86
 
87 87
 		// Check if we need to load the custom fields
88 88
 		$need_custom = false;
89
-		foreach(Api\Storage\Customfields::get('resources') as $field => $settings) {
90
-			if($options['mapping']['#'.$field]) {
89
+		foreach (Api\Storage\Customfields::get('resources') as $field => $settings) {
90
+			if ($options['mapping']['#'.$field]) {
91 91
 				$need_custom = true;
92 92
 				break;
93 93
 			}
94 94
 		}
95 95
 
96 96
 		foreach ($selection as $record) {
97
-			if(!is_array($record) || !$record['res_id']) continue;
97
+			if (!is_array($record) || !$record['res_id']) continue;
98 98
 
99
-			if($need_custom) {
99
+			if ($need_custom) {
100 100
 				$record = $this->bo->read($record['res_id']);
101 101
 			}
102 102
 			$resource = new resources_egw_record();
103 103
 			$resource->set_record($record);
104 104
 			$resource->long_description = strip_tags($resource->long_description);
105
-			if($options['convert']) {
105
+			if ($options['convert']) {
106 106
 				importexport_export_csv::convert($resource, resources_egw_record::$types, 'resources', $this->selects);
107 107
 			} else {
108 108
 				// Implode arrays, so they don't say 'Array'
109
-				foreach($resource->get_record_array() as $key => $value) {
110
-					if(is_array($value)) $resource->$key = implode(',', $value);
109
+				foreach ($resource->get_record_array() as $key => $value) {
110
+					if (is_array($value)) $resource->$key = implode(',', $value);
111 111
 				}
112 112
  			}
113 113
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 		// In resources, not all categories are used
183 183
 		$filters['cat_id']['type'] = 'select';
184 184
 		$filters['cat_id']['name'] = 'filter';
185
-		$filters['cat_id']['values']= (array)$this->bo->acl->get_cats(Acl::READ);
185
+		$filters['cat_id']['values'] = (array)$this->bo->acl->get_cats(Acl::READ);
186 186
 
187 187
 		// Add in resources / accessories
188 188
 		$filters['filter2'] = array(
@@ -192,9 +192,9 @@  discard block
 block discarded – undo
192 192
 			'rows' => 5,
193 193
 			'values' => resources_bo::$filter_options
194 194
 		);
195
-		foreach($filters as $field_name => &$settings)
195
+		foreach ($filters as $field_name => &$settings)
196 196
 		{
197
-			if($this->selects[$field_name]) $settings['values'] = $this->selects[$field_name];
197
+			if ($this->selects[$field_name]) $settings['values'] = $this->selects[$field_name];
198 198
 		}
199 199
 	}
200 200
 
Please login to merge, or discard this patch.
Braces   +63 added lines, -25 removed lines patch added patch discarded remove patch
@@ -17,7 +17,8 @@  discard block
 block discarded – undo
17 17
 /**
18 18
  * export resources to CSV
19 19
  */
20
-class resources_export_csv implements importexport_iface_export_plugin {
20
+class resources_export_csv implements importexport_iface_export_plugin
21
+{
21 22
 
22 23
 	public function __construct()
23 24
 	{
@@ -31,11 +32,13 @@  discard block
 block discarded – undo
31 32
 	 *
32 33
 	 * @param egw_record $_definition
33 34
 	 */
34
-	public function export( $_stream, importexport_definition $_definition) {
35
+	public function export( $_stream, importexport_definition $_definition)
36
+	{
35 37
 		$options = $_definition->plugin_options;
36 38
 
37 39
 		$selection = array();
38
-		if ($options['selection'] == 'search') {
40
+		if ($options['selection'] == 'search')
41
+		{
39 42
 			// ui selection with checkbox 'selected'
40 43
 			$query = Api\Cache::getSession('resources', 'get_rows');
41 44
 			$query['num_rows'] = -1;	// all
@@ -43,7 +46,8 @@  discard block
 block discarded – undo
43 46
 			$query['csv_export'] = true;	// so get_rows method _can_ produce different content or not store state in the session
44 47
 			$this->bo->get_rows($query,$selection,$readonlys);
45 48
 		}
46
-		elseif ( $options['selection'] == 'all' || $options['selection'] == 'filter') {
49
+		elseif ( $options['selection'] == 'all' || $options['selection'] == 'filter')
50
+		{
47 51
 			$query = array(
48 52
 				'num_rows'	=> -1,
49 53
 				'filter2'	=> -3,  // Accessories & resources
@@ -67,17 +71,28 @@  discard block
 block discarded – undo
67 71
 						continue;
68 72
 					}
69 73
 					$query['col_filter'][$field] = $value;
70
-					if(!is_array($value) || (!$value['from'] && !$value['to'])) continue;
74
+					if(!is_array($value) || (!$value['from'] && !$value['to']))
75
+					{
76
+						continue;
77
+					}
71 78
 
72 79
 					// Ranges are inclusive, so should be provided that way (from 2 to 10 includes 2 and 10)
73
-					if($value['from']) $query['col_filter'][] = "$field >= " . (int)$value['from'];
74
-					if($value['to']) $query['col_filter'][] = "$field <= " . (int)$value['to'];
80
+					if($value['from'])
81
+					{
82
+						$query['col_filter'][] = "$field >= " . (int)$value['from'];
83
+					}
84
+					if($value['to'])
85
+					{
86
+						$query['col_filter'][] = "$field <= " . (int)$value['to'];
87
+					}
75 88
 					unset($query['col_filter'][$field]);
76 89
 				}
77 90
 			}
78 91
 			
79 92
 			$this->bo->get_rows($query,$selection,$readonlys);
80
-		} else {
93
+		}
94
+		else
95
+		{
81 96
 			$selection = explode(',',$options['selection']);
82 97
 		}
83 98
 
@@ -86,28 +101,42 @@  discard block
 block discarded – undo
86 101
 
87 102
 		// Check if we need to load the custom fields
88 103
 		$need_custom = false;
89
-		foreach(Api\Storage\Customfields::get('resources') as $field => $settings) {
90
-			if($options['mapping']['#'.$field]) {
104
+		foreach(Api\Storage\Customfields::get('resources') as $field => $settings)
105
+		{
106
+			if($options['mapping']['#'.$field])
107
+			{
91 108
 				$need_custom = true;
92 109
 				break;
93 110
 			}
94 111
 		}
95 112
 
96
-		foreach ($selection as $record) {
97
-			if(!is_array($record) || !$record['res_id']) continue;
113
+		foreach ($selection as $record)
114
+		{
115
+			if(!is_array($record) || !$record['res_id'])
116
+			{
117
+				continue;
118
+			}
98 119
 
99
-			if($need_custom) {
120
+			if($need_custom)
121
+			{
100 122
 				$record = $this->bo->read($record['res_id']);
101 123
 			}
102 124
 			$resource = new resources_egw_record();
103 125
 			$resource->set_record($record);
104 126
 			$resource->long_description = strip_tags($resource->long_description);
105
-			if($options['convert']) {
127
+			if($options['convert'])
128
+			{
106 129
 				importexport_export_csv::convert($resource, resources_egw_record::$types, 'resources', $this->selects);
107
-			} else {
130
+			}
131
+			else
132
+			{
108 133
 				// Implode arrays, so they don't say 'Array'
109
-				foreach($resource->get_record_array() as $key => $value) {
110
-					if(is_array($value)) $resource->$key = implode(',', $value);
134
+				foreach($resource->get_record_array() as $key => $value)
135
+				{
136
+					if(is_array($value))
137
+					{
138
+						$resource->$key = implode(',', $value);
139
+					}
111 140
 				}
112 141
  			}
113 142
 
@@ -122,7 +151,8 @@  discard block
 block discarded – undo
122 151
 	 *
123 152
 	 * @return string name
124 153
 	 */
125
-	public static function get_name() {
154
+	public static function get_name()
155
+	{
126 156
 		return lang('Resources CSV export');
127 157
 	}
128 158
 
@@ -131,7 +161,8 @@  discard block
 block discarded – undo
131 161
 	 *
132 162
 	 * @return string descriprion
133 163
 	 */
134
-	public static function get_description() {
164
+	public static function get_description()
165
+	{
135 166
 		return lang("Exports a list of resources to a CSV File.");
136 167
 	}
137 168
 
@@ -140,11 +171,13 @@  discard block
 block discarded – undo
140 171
 	 *
141 172
 	 * @return string suffix
142 173
 	 */
143
-	public static function get_filesuffix() {
174
+	public static function get_filesuffix()
175
+	{
144 176
 		return 'csv';
145 177
 	}
146 178
 
147
-	public static function get_mimetype() {
179
+	public static function get_mimetype()
180
+	{
148 181
 		return 'text/csv';
149 182
 	}
150 183
 
@@ -153,14 +186,16 @@  discard block
 block discarded – undo
153 186
 	 * this way the plugin has all opportunities for options tab
154 187
 	 *
155 188
 	 */
156
-	public function get_options_etpl() {
189
+	public function get_options_etpl()
190
+	{
157 191
 	}
158 192
 
159 193
 	/**
160 194
 	 * returns selectors information
161 195
 	 *
162 196
 	 */
163
-	public function get_selectors_etpl() {
197
+	public function get_selectors_etpl()
198
+	{
164 199
 		return array(
165 200
 			'name'	=> 'importexport.export_csv_selectors',
166 201
 		);
@@ -170,7 +205,7 @@  discard block
 block discarded – undo
170 205
 	 * Get selectbox values
171 206
 	 */
172 207
 	protected function get_selects()
173
-        {
208
+	{
174 209
 		$this->selects = array();
175 210
         }
176 211
 
@@ -194,7 +229,10 @@  discard block
 block discarded – undo
194 229
 		);
195 230
 		foreach($filters as $field_name => &$settings)
196 231
 		{
197
-			if($this->selects[$field_name]) $settings['values'] = $this->selects[$field_name];
232
+			if($this->selects[$field_name])
233
+			{
234
+				$settings['values'] = $this->selects[$field_name];
235
+			}
198 236
 		}
199 237
 	}
200 238
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -177,7 +177,7 @@
 block discarded – undo
177 177
 	/**
178 178
 	 * Customize automatically generated filter fields
179 179
 	 */
180
-	public function get_filter_fields(Array &$filters)
180
+	public function get_filter_fields(array &$filters)
181 181
 	{
182 182
 		// In resources, not all categories are used
183 183
 		$filters['cat_id']['type'] = 'select';
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
 	/**
28 28
 	 * Exports records as defined in $_definition
29 29
 	 *
30
-	 * @param egw_record $_definition
30
+	 * @param importexport_definition $_definition
31 31
 	 */
32 32
 	public function export( $_stream, importexport_definition $_definition) {
33 33
 		$options = $_definition->plugin_options;
Please login to merge, or discard this patch.
resources/inc/class.resources_reserve.inc.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@
 block discarded – undo
58 58
 			} else {
59 59
 				$data['msg']= '<div class="confirm">'.lang('Unable to process confirmation.').'</div>';
60 60
 			}
61
-                }
61
+				}
62 62
 
63 63
 		$this->tmpl->read('resources.sitemgr_book');
64 64
 
Please login to merge, or discard this patch.
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -26,17 +26,17 @@  discard block
 block discarded – undo
26 26
 	 */
27 27
 	public function book($content = array(), $arguments = array())
28 28
 	{
29
-		Framework::includeJS('jscalendar','calendar');
29
+		Framework::includeJS('jscalendar', 'calendar');
30 30
 		$data = array();
31 31
 		$readonlys = array();
32 32
 		$display_days = $_GET['planner_days'] ? $_GET['planner_days'] : 3;
33
-		$planner_date = $_GET['date'] ? $_GET['date'] : strtotime('yesterday',$content['date'] ? $content['date'] : time());
33
+		$planner_date = $_GET['date'] ? $_GET['date'] : strtotime('yesterday', $content['date'] ? $content['date'] : time());
34 34
 
35
-		if($_GET['confirm']) {
36
-			$register_code = ($_GET['confirm'] && preg_match('/^[0-9a-f]{32}$/',$_GET['confirm'])) ? $_GET['confirm'] : false;
37
-			if($register_code && $registration = registration_bo::confirm($register_code)) {
35
+		if ($_GET['confirm']) {
36
+			$register_code = ($_GET['confirm'] && preg_match('/^[0-9a-f]{32}$/', $_GET['confirm'])) ? $_GET['confirm'] : false;
37
+			if ($register_code && $registration = registration_bo::confirm($register_code)) {
38 38
 				// Get calendar through link
39
-				$links = Link::get_links('registration', $registration['reg_id'],'calendar');
39
+				$links = Link::get_links('registration', $registration['reg_id'], 'calendar');
40 40
 				$bo = new calendar_boupdate();
41 41
 				$data = $bo->read(current($links));
42 42
 
@@ -45,24 +45,24 @@  discard block
 block discarded – undo
45 45
 
46 46
 				// Show date of reservation, so they can see it blocked off
47 47
 				$display_days = 1;
48
-				$planner_date = mktime(0,0,0,date('m',$data['start']),date('d',$data['start']),date('Y',$data['start']));
48
+				$planner_date = mktime(0, 0, 0, date('m', $data['start']), date('d', $data['start']), date('Y', $data['start']));
49 49
 				$readonlys['__ALL__'] = true;
50 50
 				$content = array(
51 51
 					'resource' => key($data['participant_types']['r']),
52 52
 					'date' => $data['start'],
53
-					'time' => $data['start'] - mktime(0,0,0,date('m',$data['start']),date('d',$data['start']),date('Y',$data['start'])),
53
+					'time' => $data['start'] - mktime(0, 0, 0, date('m', $data['start']), date('d', $data['start']), date('Y', $data['start'])),
54 54
 					'quantity' => 0
55 55
 				);
56
-				calendar_so::split_status($data['participant_types']['r'][$content['resource']], $content['quantity'],$role);
57
-				$data['msg']= '<div class="confirm">'.lang('Registration confirmed %1', Api\DateTime::to($data['start'])) .'</div>';
56
+				calendar_so::split_status($data['participant_types']['r'][$content['resource']], $content['quantity'], $role);
57
+				$data['msg'] = '<div class="confirm">'.lang('Registration confirmed %1', Api\DateTime::to($data['start'])).'</div>';
58 58
 			} else {
59
-				$data['msg']= '<div class="confirm">'.lang('Unable to process confirmation.').'</div>';
59
+				$data['msg'] = '<div class="confirm">'.lang('Unable to process confirmation.').'</div>';
60 60
 			}
61 61
                 }
62 62
 
63 63
 		$this->tmpl->read('resources.sitemgr_book');
64 64
 
65
-		if(!$arguments['resource'] && !($arguments['resource'] = $content['resource'])) return false;
65
+		if (!$arguments['resource'] && !($arguments['resource'] = $content['resource'])) return false;
66 66
 		$data += $this->bo->read($arguments['resource']);
67 67
 
68 68
 		$data['quantity'] = $content['quantity'] ? $content['quantity'] : 2;
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
 		$preserve['include_group'] = $arguments['include_group'] ? $arguments['include_group'] : $content['include_group'];
82 82
 
83 83
 		// Check for valid time
84
-		if($data['date'] && $content['book'])
84
+		if ($data['date'] && $content['book'])
85 85
 		{
86
-			$start_time = $data['date'] + (is_array($data['time']) ? $data['time']['hour']*3600 + $data['time']['minute']*60 : $data['time']);
86
+			$start_time = $data['date'] + (is_array($data['time']) ? $data['time']['hour'] * 3600 + $data['time']['minute'] * 60 : $data['time']);
87 87
 			// Use sitemgr's default appointment length
88
-			if($GLOBALS['egw_info']['user']['account_lid'] != $GLOBALS['sitemgr_info']['anonymous_user'])
88
+			if ($GLOBALS['egw_info']['user']['account_lid'] != $GLOBALS['sitemgr_info']['anonymous_user'])
89 89
 			{
90 90
 				$preferences = new Api\Preferences($GLOBALS['egw']->accounts->name2id($GLOBALS['sitemgr_info']['anonymous_user']));
91 91
 				$preferences = $preferences->read_repository();
@@ -100,21 +100,21 @@  discard block
 block discarded – undo
100 100
 			$config = Api\Config::read('registration');
101 101
 
102 102
 			// Not a user, need contact
103
-			if($GLOBALS['egw_info']['user']['account_lid'] == $GLOBALS['sitemgr_info']['anonymous_user'] && !$content['contact_id'])
103
+			if ($GLOBALS['egw_info']['user']['account_lid'] == $GLOBALS['sitemgr_info']['anonymous_user'] && !$content['contact_id'])
104 104
 			{
105 105
 				if ($config['pending_addressbook'])   // save the contact in the addressbook
106 106
 				{
107 107
 					$content['owner'] = $config['pending_addressbook'];
108
-					$content['private'] = 0;        // in case default_private is set
108
+					$content['private'] = 0; // in case default_private is set
109 109
 				}
110 110
 
111 111
 				$addressbook = new Api\Contacts();
112 112
 				$contact_fields = $addressbook->contact_fields;
113 113
 				unset($contact_fields['email']); // Always present
114 114
 				unset($contact_fields['id']); // Address already there
115
-				if(array_intersect_key($contact_fields,$content)) {
115
+				if (array_intersect_key($contact_fields, $content)) {
116 116
 					$result = $addressbook->save($content);
117
-					if(!$result) {
117
+					if (!$result) {
118 118
 						throw new Api\Exception\NoPermission($addressbook->error);
119 119
 						return False;
120 120
 					}
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 				$contact_id = $GLOBALS['egw_info']['user']['person_id'];
131 131
 			}
132 132
 
133
-			if($contact) {
133
+			if ($contact) {
134 134
 				// Make event
135 135
 				$event = array(
136 136
 					'title' =>	Link::title('addressbook', $contact_id),
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 						$contact => calendar_so::combine_status('U', $data['quantity'], 'REQ-PARTICIPANT')
142 142
 					)
143 143
 				);
144
-				if($preserve['include_group'])
144
+				if ($preserve['include_group'])
145 145
 				{
146 146
 					$event['participants'][$preserve['include_group']] = calendar_so::combine_status('U', 1, 'REQ-PARTICIPANT');
147 147
 				}
@@ -150,21 +150,21 @@  discard block
 block discarded – undo
150 150
 
151 151
 				// Show date of reservation, so they can see it blocked off
152 152
 				$display_days = 1;
153
-				$planner_date = mktime(0,0,0,date('m',$event['start']),date('d',$event['start']),date('Y',$event['start']));
153
+				$planner_date = mktime(0, 0, 0, date('m', $event['start']), date('d', $event['start']), date('Y', $event['start']));
154 154
 
155 155
 				// Free time search
156
-				if(!is_numeric($result))
156
+				if (!is_numeric($result))
157 157
 				{
158 158
 					$form = new calendar_uiforms();
159 159
 					$freetime = $form->freetime('r'.$data['res_id'],
160
-						strtotime($GLOBALS['egw_info']['user']['preferences']['calendar']['workdaystarts'] . ':00',$start_time),
161
-						strtotime($GLOBALS['egw_info']['user']['preferences']['calendar']['workdayends'] . ':00 ',$end_time),
160
+						strtotime($GLOBALS['egw_info']['user']['preferences']['calendar']['workdaystarts'].':00', $start_time),
161
+						strtotime($GLOBALS['egw_info']['user']['preferences']['calendar']['workdayends'].':00 ', $end_time),
162 162
 						$duration
163 163
 					);
164 164
 					$data += $content;
165 165
 					$data['msg'] = lang('Please choose a different time:')."\n";
166
-					foreach($freetime as $slot) {
167
-						$data['msg'] .= Api\DateTime::to($slot['start']) . ' - ' . Api\DateTime::to($slot['end'])."<br />\n";
166
+					foreach ($freetime as $slot) {
167
+						$data['msg'] .= Api\DateTime::to($slot['start']).' - '.Api\DateTime::to($slot['end'])."<br />\n";
168 168
 					}
169 169
 				}
170 170
 				elseif ($preserve['confirmation'] && $contact_id && $result)
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 						'post_confirm_hook' => 'resources.resources_reserve.confirm',
177 177
 						'sitemgr_version' => $preserve['sitemgr_version']
178 178
 					), false);
179
-					if(is_numeric($reg_id))
179
+					if (is_numeric($reg_id))
180 180
 					{
181 181
 						// Link to event
182 182
 						Link::link('registration', $reg_id, 'calendar', $result);
@@ -185,10 +185,10 @@  discard block
 block discarded – undo
185 185
 						// Send email
186 186
 						$email_info = $config + array(
187 187
 							'title' => $data['name'],
188
-							'subject' => $data['name'] . ' ' . Api\DateTime::to($start_time),
188
+							'subject' => $data['name'].' '.Api\DateTime::to($start_time),
189 189
 							'link' => $preserve['link'],
190 190
 						);
191
-						if($preserve['email_message'])
191
+						if ($preserve['email_message'])
192 192
 						{
193 193
 							$email_info['message'] = lang($preserve['email_message'],
194 194
 								Api\DateTime::to($start_time),
@@ -205,23 +205,23 @@  discard block
 block discarded – undo
205 205
 		$data['picture'] = $this->bo->get_picture($data);
206 206
 
207 207
 		// Not a user, need contact
208
-		if($GLOBALS['egw_info']['user']['account_lid'] == $GLOBALS['sitemgr_info']['anonymous_user'] && !$content['contact_id'])
208
+		if ($GLOBALS['egw_info']['user']['account_lid'] == $GLOBALS['sitemgr_info']['anonymous_user'] && !$content['contact_id'])
209 209
 		{
210 210
 			$data['contact_form'] = $preserve['contact_form'];
211 211
 			$data['show_contact'] = !$preserve['contact_form'];
212 212
 		}
213 213
 
214 214
 		$cal_user = array('r'.$arguments['resource']);
215
-		foreach($this->bo->get_acc_list($data['res_id']) as $acc_id => $name)
215
+		foreach ($this->bo->get_acc_list($data['res_id']) as $acc_id => $name)
216 216
 		{
217 217
 			$cal_user[] = 'r'.$acc_id;
218 218
 		}
219 219
 
220
-		if(!$data['date']) $data['date'] = strtotime('tomorrow');
221
-		if(!$data['time']) $data['time']['hour'] = $GLOBALS['egw_info']['user']['preferences']['calendar']['workdaystarts'];
220
+		if (!$data['date']) $data['date'] = strtotime('tomorrow');
221
+		if (!$data['time']) $data['time']['hour'] = $GLOBALS['egw_info']['user']['preferences']['calendar']['workdaystarts'];
222 222
 
223 223
 		// Use sitemgr's default appointment length
224
-		if($GLOBALS['egw_info']['user']['account_lid'] != $GLOBALS['sitemgr_info']['anonymous_user'])
224
+		if ($GLOBALS['egw_info']['user']['account_lid'] != $GLOBALS['sitemgr_info']['anonymous_user'])
225 225
 		{
226 226
 			$preferences = new Api\Preferences($GLOBALS['egw']->accounts->name2id($GLOBALS['sitemgr_info']['anonymous_user']));
227 227
 			$preferences = $preferences->read_repository();
@@ -234,28 +234,28 @@  discard block
 block discarded – undo
234 234
 		// Leading 0
235 235
 		$data['duration'] = '0'.$data['duration'];
236 236
 
237
-		if(!$GLOBALS['egw_info']['user']['apps']['resources'] || !$this->bo->get_calendar_info($data['res_id']) || // Needed for booking
237
+		if (!$GLOBALS['egw_info']['user']['apps']['resources'] || !$this->bo->get_calendar_info($data['res_id']) || // Needed for booking
238 238
 			!$GLOBALS['egw_info']['user']['apps']['calendar'] // Needed for updating schedule
239 239
 		)
240 240
 		{
241
-			$data['planner'] = 'Permission error - site not configured properly.  Need ' . lang('resources') . ' & ' . lang('calendar');
241
+			$data['planner'] = 'Permission error - site not configured properly.  Need '.lang('resources').' & '.lang('calendar');
242 242
 		}
243 243
 		else
244 244
 		{
245 245
 			$data['planner'] = $this->get_planner(
246 246
 				$arguments['resource'],
247
-				$planner_date ? $planner_date : strtotime('yesterday',$date), // Show day before, too
247
+				$planner_date ? $planner_date : strtotime('yesterday', $date), // Show day before, too
248 248
 				$display_days,
249 249
 				$preserve['link']
250 250
 			);
251 251
 		}
252 252
 
253 253
 		// Restrict times to working hours
254
-		for($i = $GLOBALS['egw_info']['user']['preferences']['calendar']['workdaystarts']; $i < $GLOBALS['egw_info']['user']['preferences']['calendar']['workdayends']; $i++)
254
+		for ($i = $GLOBALS['egw_info']['user']['preferences']['calendar']['workdaystarts']; $i < $GLOBALS['egw_info']['user']['preferences']['calendar']['workdayends']; $i++)
255 255
 		{
256
-			if($GLOBALS['egw_info']['user']['preferences']['common']['timeformat'] == '12')
256
+			if ($GLOBALS['egw_info']['user']['preferences']['common']['timeformat'] == '12')
257 257
 			{
258
-				$sel_options['hour'][$i] = ($i < '12' ? $i .' am' : ($i > 12 ? $i -12 : $i).' pm');
258
+				$sel_options['hour'][$i] = ($i < '12' ? $i.' am' : ($i > 12 ? $i - 12 : $i).' pm');
259 259
 			}
260 260
 			else
261 261
 			{
@@ -263,14 +263,14 @@  discard block
 block discarded – undo
263 263
 			}
264 264
 		}
265 265
 
266
-		return $this->tmpl->exec('resources.resources_reserve.book',$data,$sel_options,$readonlys,$preserve);
266
+		return $this->tmpl->exec('resources.resources_reserve.book', $data, $sel_options, $readonlys, $preserve);
267 267
 	}
268 268
 
269 269
 	public function ajax_update_planner($resource_id, $date) {
270 270
 		$response = Api\Json\Response::get();
271
-		$response->assign('exec[planner_div]','innerHTML',$this->get_planner(
271
+		$response->assign('exec[planner_div]', 'innerHTML', $this->get_planner(
272 272
 			$resource_id,
273
-			strtotime('yesterday',$date),
273
+			strtotime('yesterday', $date),
274 274
 			3,
275 275
 			$_SERVER['HTTP_REFERER']
276 276
 		));
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 		// Need to add this in explicitly, or it may be lost if use clicks a day
297 297
 		$calendar->search_params['users'][] = 'r'.$resource_id;
298 298
 		$calendar->search_params['users'][] = $GLOBALS['egw_info']['user']['account_id'];
299
-		$calendar->allowEdit = false;    // switches off all edit popups
299
+		$calendar->allowEdit = false; // switches off all edit popups
300 300
 
301 301
 		$planner = '<style type="text/css">'."\n".
302 302
 			'@import url('.$GLOBALS['egw_info']['server']['webserver_url'].'/calendar/templates/default/app.css'.");\n".
@@ -318,10 +318,10 @@  discard block
 block discarded – undo
318 318
 	public function confirm($registration)
319 319
 	{
320 320
 		// Get calendar through link
321
-		$links = Link::get_links('registration', $registration['reg_id'],'calendar');
321
+		$links = Link::get_links('registration', $registration['reg_id'], 'calendar');
322 322
 		$bo = new calendar_boupdate();
323 323
 		$event = $bo->read(current($links));
324
-		if($registration['status'] == registration_bo::CONFIRMED)
324
+		if ($registration['status'] == registration_bo::CONFIRMED)
325 325
 		{
326 326
 			$bo->set_status(current($links), 'c'.$registration['contact_id'], 'A');
327 327
 		}
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 		{
330 330
 			$bo->delete(current($links));
331 331
 			// Remove contact ID, or registration will try to purge the account
332
-			if($registration['account_id'])
332
+			if ($registration['account_id'])
333 333
 			{
334 334
 				unset($registration['contact_id']);
335 335
 			}
Please login to merge, or discard this patch.
Braces   +38 added lines, -16 removed lines patch added patch discarded remove patch
@@ -14,9 +14,11 @@  discard block
 block discarded – undo
14 14
 use EGroupware\Api\Link;
15 15
 use EGroupware\Api\Framework;
16 16
 
17
-class resources_reserve {
17
+class resources_reserve
18
+{
18 19
 
19
-	public function __construct() {
20
+	public function __construct()
21
+	{
20 22
 		$this->tmpl = new etemplate();
21 23
 		$this->bo = new resources_bo();
22 24
 	}
@@ -32,9 +34,11 @@  discard block
 block discarded – undo
32 34
 		$display_days = $_GET['planner_days'] ? $_GET['planner_days'] : 3;
33 35
 		$planner_date = $_GET['date'] ? $_GET['date'] : strtotime('yesterday',$content['date'] ? $content['date'] : time());
34 36
 
35
-		if($_GET['confirm']) {
37
+		if($_GET['confirm'])
38
+		{
36 39
 			$register_code = ($_GET['confirm'] && preg_match('/^[0-9a-f]{32}$/',$_GET['confirm'])) ? $_GET['confirm'] : false;
37
-			if($register_code && $registration = registration_bo::confirm($register_code)) {
40
+			if($register_code && $registration = registration_bo::confirm($register_code))
41
+			{
38 42
 				// Get calendar through link
39 43
 				$links = Link::get_links('registration', $registration['reg_id'],'calendar');
40 44
 				$bo = new calendar_boupdate();
@@ -55,14 +59,19 @@  discard block
 block discarded – undo
55 59
 				);
56 60
 				calendar_so::split_status($data['participant_types']['r'][$content['resource']], $content['quantity'],$role);
57 61
 				$data['msg']= '<div class="confirm">'.lang('Registration confirmed %1', Api\DateTime::to($data['start'])) .'</div>';
58
-			} else {
62
+			}
63
+			else
64
+			{
59 65
 				$data['msg']= '<div class="confirm">'.lang('Unable to process confirmation.').'</div>';
60 66
 			}
61 67
                 }
62 68
 
63 69
 		$this->tmpl->read('resources.sitemgr_book');
64 70
 
65
-		if(!$arguments['resource'] && !($arguments['resource'] = $content['resource'])) return false;
71
+		if(!$arguments['resource'] && !($arguments['resource'] = $content['resource']))
72
+		{
73
+			return false;
74
+		}
66 75
 		$data += $this->bo->read($arguments['resource']);
67 76
 
68 77
 		$data['quantity'] = $content['quantity'] ? $content['quantity'] : 2;
@@ -102,9 +111,12 @@  discard block
 block discarded – undo
102 111
 			// Not a user, need contact
103 112
 			if($GLOBALS['egw_info']['user']['account_lid'] == $GLOBALS['sitemgr_info']['anonymous_user'] && !$content['contact_id'])
104 113
 			{
105
-				if ($config['pending_addressbook'])   // save the contact in the addressbook
114
+				if ($config['pending_addressbook'])
115
+				{
116
+					// save the contact in the addressbook
106 117
 				{
107 118
 					$content['owner'] = $config['pending_addressbook'];
119
+				}
108 120
 					$content['private'] = 0;        // in case default_private is set
109 121
 				}
110 122
 
@@ -112,9 +124,11 @@  discard block
 block discarded – undo
112 124
 				$contact_fields = $addressbook->contact_fields;
113 125
 				unset($contact_fields['email']); // Always present
114 126
 				unset($contact_fields['id']); // Address already there
115
-				if(array_intersect_key($contact_fields,$content)) {
127
+				if(array_intersect_key($contact_fields,$content))
128
+				{
116 129
 					$result = $addressbook->save($content);
117
-					if(!$result) {
130
+					if(!$result)
131
+					{
118 132
 						throw new Api\Exception\NoPermission($addressbook->error);
119 133
 						return False;
120 134
 					}
@@ -130,7 +144,8 @@  discard block
 block discarded – undo
130 144
 				$contact_id = $GLOBALS['egw_info']['user']['person_id'];
131 145
 			}
132 146
 
133
-			if($contact) {
147
+			if($contact)
148
+			{
134 149
 				// Make event
135 150
 				$event = array(
136 151
 					'title' =>	Link::title('addressbook', $contact_id),
@@ -163,7 +178,8 @@  discard block
 block discarded – undo
163 178
 					);
164 179
 					$data += $content;
165 180
 					$data['msg'] = lang('Please choose a different time:')."\n";
166
-					foreach($freetime as $slot) {
181
+					foreach($freetime as $slot)
182
+					{
167 183
 						$data['msg'] .= Api\DateTime::to($slot['start']) . ' - ' . Api\DateTime::to($slot['end'])."<br />\n";
168 184
 					}
169 185
 				}
@@ -217,8 +233,14 @@  discard block
 block discarded – undo
217 233
 			$cal_user[] = 'r'.$acc_id;
218 234
 		}
219 235
 
220
-		if(!$data['date']) $data['date'] = strtotime('tomorrow');
221
-		if(!$data['time']) $data['time']['hour'] = $GLOBALS['egw_info']['user']['preferences']['calendar']['workdaystarts'];
236
+		if(!$data['date'])
237
+		{
238
+			$data['date'] = strtotime('tomorrow');
239
+		}
240
+		if(!$data['time'])
241
+		{
242
+			$data['time']['hour'] = $GLOBALS['egw_info']['user']['preferences']['calendar']['workdaystarts'];
243
+		}
222 244
 
223 245
 		// Use sitemgr's default appointment length
224 246
 		if($GLOBALS['egw_info']['user']['account_lid'] != $GLOBALS['sitemgr_info']['anonymous_user'])
@@ -236,8 +258,7 @@  discard block
 block discarded – undo
236 258
 
237 259
 		if(!$GLOBALS['egw_info']['user']['apps']['resources'] || !$this->bo->get_calendar_info($data['res_id']) || // Needed for booking
238 260
 			!$GLOBALS['egw_info']['user']['apps']['calendar'] // Needed for updating schedule
239
-		)
240
-		{
261
+		) {
241 262
 			$data['planner'] = 'Permission error - site not configured properly.  Need ' . lang('resources') . ' & ' . lang('calendar');
242 263
 		}
243 264
 		else
@@ -266,7 +287,8 @@  discard block
 block discarded – undo
266 287
 		return $this->tmpl->exec('resources.resources_reserve.book',$data,$sel_options,$readonlys,$preserve);
267 288
 	}
268 289
 
269
-	public function ajax_update_planner($resource_id, $date) {
290
+	public function ajax_update_planner($resource_id, $date)
291
+	{
270 292
 		$response = Api\Json\Response::get();
271 293
 		$response->assign('exec[planner_div]','innerHTML',$this->get_planner(
272 294
 			$resource_id,
Please login to merge, or discard this patch.
resources/inc/class.resources_wizard_export_csv.inc.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -26,26 +26,26 @@  discard block
 block discarded – undo
26 26
 
27 27
 		// Custom fields
28 28
 		$custom = Api\Storage\Customfields::get('resources', true);
29
-		foreach($custom as $name => $data) {
29
+		foreach ($custom as $name => $data) {
30 30
 			$this->export_fields['#'.$name] = $data['label'];
31 31
 		}
32 32
 	}
33 33
 
34 34
 	public function wizard_step50(&$content, &$sel_options, &$readonlys, &$preserv) {
35
-		if($this->debug || true) error_log(get_class($this) . '::wizard_step50->$content '.print_r($content,true));
35
+		if ($this->debug || true) error_log(get_class($this).'::wizard_step50->$content '.print_r($content, true));
36 36
 		// return
37 37
 		if ($content['step'] == 'wizard_step50')
38 38
 		{
39 39
 			switch (array_search('pressed', $content['button']))
40 40
 			{
41 41
 				case 'next':
42
-					return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'],1);
42
+					return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'], 1);
43 43
 				case 'previous' :
44
-					return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'],-1);
44
+					return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'], -1);
45 45
 				case 'finish':
46 46
 					return 'wizard_finish';
47 47
 				default :
48
-					return $this->wizard_step50($content,$sel_options,$readonlys,$preserv);
48
+					return $this->wizard_step50($content, $sel_options, $readonlys, $preserv);
49 49
 			}
50 50
 		}
51 51
 		// init step
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 			unset ($preserv['button']);
58 58
 			$fields = array('pm_used_time', 'pm_planned_time', 'pm_replanned_time');
59 59
 			$sel_options = array_fill_keys($fields, array('h' => lang('hours'), 'd' => lang('days')));
60
-			foreach($fields as $field) {
60
+			foreach ($fields as $field) {
61 61
 				$content[$field] = $content[$field] ? $content[$field] : $content['plugin_options'][$field];
62 62
 			}
63 63
 		}
Please login to merge, or discard this patch.
Braces   +12 added lines, -5 removed lines patch added patch discarded remove patch
@@ -14,7 +14,8 @@  discard block
 block discarded – undo
14 14
 
15 15
 class resources_wizard_export_csv extends importexport_wizard_basic_export_csv
16 16
 {
17
-	public function __construct() {
17
+	public function __construct()
18
+	{
18 19
 		parent::__construct();
19 20
 
20 21
 		// Field mapping
@@ -26,13 +27,18 @@  discard block
 block discarded – undo
26 27
 
27 28
 		// Custom fields
28 29
 		$custom = Api\Storage\Customfields::get('resources', true);
29
-		foreach($custom as $name => $data) {
30
+		foreach($custom as $name => $data)
31
+		{
30 32
 			$this->export_fields['#'.$name] = $data['label'];
31 33
 		}
32 34
 	}
33 35
 
34
-	public function wizard_step50(&$content, &$sel_options, &$readonlys, &$preserv) {
35
-		if($this->debug || true) error_log(get_class($this) . '::wizard_step50->$content '.print_r($content,true));
36
+	public function wizard_step50(&$content, &$sel_options, &$readonlys, &$preserv)
37
+	{
38
+		if($this->debug || true)
39
+		{
40
+			error_log(get_class($this) . '::wizard_step50->$content '.print_r($content,true));
41
+		}
36 42
 		// return
37 43
 		if ($content['step'] == 'wizard_step50')
38 44
 		{
@@ -57,7 +63,8 @@  discard block
 block discarded – undo
57 63
 			unset ($preserv['button']);
58 64
 			$fields = array('pm_used_time', 'pm_planned_time', 'pm_replanned_time');
59 65
 			$sel_options = array_fill_keys($fields, array('h' => lang('hours'), 'd' => lang('days')));
60
-			foreach($fields as $field) {
66
+			foreach($fields as $field)
67
+			{
61 68
 				$content[$field] = $content[$field] ? $content[$field] : $content['plugin_options'][$field];
62 69
 			}
63 70
 		}
Please login to merge, or discard this patch.
resources/inc/class.resources_favorite_portlet.inc.php 3 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 		$context['appname'] = 'resources';
29 29
 
30 30
 		// Let parent handle the basic stuff
31
-		parent::__construct($context,$need_reload);
31
+		parent::__construct($context, $need_reload);
32 32
 
33 33
 		$this->context['template'] = 'resources.show.rows';
34 34
 		$this->nm_settings += array(
@@ -48,13 +48,13 @@  discard block
 block discarded – undo
48 48
 		);
49 49
 	}
50 50
 
51
-	public function exec($id = null, Etemplate &$etemplate = null)
51
+	public function exec($id = null, Etemplate&$etemplate = null)
52 52
 	{
53 53
 		$ui = new resources_ui();
54 54
 
55
-		$this->context['sel_options']['filter']= array(''=>lang('all categories'))+(array)$ui->bo->acl->get_cats(Acl::READ);
55
+		$this->context['sel_options']['filter'] = array(''=>lang('all categories')) + (array)$ui->bo->acl->get_cats(Acl::READ);
56 56
 		$this->context['sel_options']['filter2'] = resources_bo::$filter_options;
57
-		if(!$content['nm']['filter2'])
57
+		if (!$content['nm']['filter2'])
58 58
 		{
59 59
 			$content['nm']['filter2'] = key(resources_bo::$filter_options);
60 60
 		}
@@ -92,28 +92,28 @@  discard block
 block discarded – undo
92 92
 			if (!count($content['nm']['selected']) && !$content['nm']['select_all'])
93 93
 			{
94 94
 				$msg = lang('You need to select some entries first!');
95
-				Api\Json\Response::get()->apply('egw.message',array($msg,'error'));
95
+				Api\Json\Response::get()->apply('egw.message', array($msg, 'error'));
96 96
 			}
97 97
 			else
98 98
 			{
99 99
 				$success = $failed = $action_msg = null;
100
-				if ($ui->action($content['nm']['action'],$content['nm']['selected'],$content['nm']['select_all'],
101
-					$success,$failed,$action_msg,'index',$msg))
100
+				if ($ui->action($content['nm']['action'], $content['nm']['selected'], $content['nm']['select_all'],
101
+					$success, $failed, $action_msg, 'index', $msg))
102 102
 				{
103
-					$msg .= lang('%1 resource(s) %2',$success,$action_msg);
103
+					$msg .= lang('%1 resource(s) %2', $success, $action_msg);
104 104
 
105
-					Api\Json\Response::get()->apply('egw.message',array($msg,'success'));
106
-					foreach($content['nm']['selected'] as &$id)
105
+					Api\Json\Response::get()->apply('egw.message', array($msg, 'success'));
106
+					foreach ($content['nm']['selected'] as &$id)
107 107
 					{
108 108
 						$id = 'resources::'.$id;
109 109
 					}
110 110
 					// Directly request an update - this will get resources tab too
111
-					Api\Json\Response::get()->apply('egw.dataRefreshUIDs',array($content['nm']['selected']));
111
+					Api\Json\Response::get()->apply('egw.dataRefreshUIDs', array($content['nm']['selected']));
112 112
 				}
113
-				elseif(empty($msg))
113
+				elseif (empty($msg))
114 114
 				{
115
-					$msg .= lang('%1 resource(s) %2, %3 failed because of insufficent rights !!!',$success,$action_msg,$failed);
116
-					Api\Json\Response::get()->apply('egw.message',array($msg,'error'));
115
+					$msg .= lang('%1 resource(s) %2, %3 failed because of insufficent rights !!!', $success, $action_msg, $failed);
116
+					Api\Json\Response::get()->apply('egw.message', array($msg, 'error'));
117 117
 				}
118 118
 			}
119 119
 		}
Please login to merge, or discard this patch.
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -76,9 +76,12 @@
 block discarded – undo
76 76
 
77 77
 		// This is just copy+pasted from resources_ui line 816, but we don't want
78 78
 		// the etemplate exec to fire again.
79
-		if (is_array($content) && isset($content['nm']['rows']['document']))  // handle insert in default document button like an action
79
+		if (is_array($content) && isset($content['nm']['rows']['document']))
80
+		{
81
+			// handle insert in default document button like an action
80 82
 		{
81 83
 			list($id) = @each($content['nm']['rows']['document']);
84
+		}
82 85
 			$content['nm']['action'] = 'document';
83 86
 			$content['nm']['selected'] = array($id);
84 87
 		}
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
 	 * Construct the portlet
24 24
 	 *
25 25
 	 */
26
-	public function __construct(Array &$context = array(), &$need_reload = false)
26
+	public function __construct(array &$context = array(), &$need_reload = false)
27 27
 	{
28 28
 		$context['appname'] = 'resources';
29 29
 
Please login to merge, or discard this patch.
resources/inc/class.resources_tracking.inc.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -26,20 +26,20 @@
 block discarded – undo
26 26
 		$this->id_field = 'res_id';
27 27
 
28 28
 		$this->field2history = array(
29
-                        'res_id'        => 'res_id',
30
-                        'name'          => 'name',
31
-                        'short_description'     => 'short_description',
32
-                        'cat_id'        => 'cat_id',
33
-                        'quantity'      => 'quantity',
34
-                        'useable'       => 'useable',
35
-                        'location'      => 'location',
36
-                        'storage_info'  => 'storage_info',
37
-                        'bookable'      => 'bookable',
38
-                        'buyable'       => 'buyable',
39
-                        'prize'         => 'prize',
40
-                        'long_description'      => 'long_description',
41
-                        'inventory_number'      => 'inventory_number',
42
-                        'accessory_of'  => 'accessory_of'
29
+						'res_id'        => 'res_id',
30
+						'name'          => 'name',
31
+						'short_description'     => 'short_description',
32
+						'cat_id'        => 'cat_id',
33
+						'quantity'      => 'quantity',
34
+						'useable'       => 'useable',
35
+						'location'      => 'location',
36
+						'storage_info'  => 'storage_info',
37
+						'bookable'      => 'bookable',
38
+						'buyable'       => 'buyable',
39
+						'prize'         => 'prize',
40
+						'long_description'      => 'long_description',
41
+						'inventory_number'      => 'inventory_number',
42
+						'accessory_of'  => 'accessory_of'
43 43
 		);
44 44
 		parent::__construct($this->appname);
45 45
 	}
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,8 @@
 block discarded – undo
21 21
 {
22 22
 
23 23
 	
24
-	public function __construct() {
24
+	public function __construct()
25
+	{
25 26
 		$this->appname = 'resources';
26 27
 		$this->id_field = 'res_id';
27 28
 
Please login to merge, or discard this patch.