@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | /** |
26 | 26 | * Exports records as defined in $_definition |
27 | 27 | * |
28 | - * @param egw_record $_definition |
|
28 | + * @param importexport_definition $_definition |
|
29 | 29 | */ |
30 | 30 | public function export( $_stream, importexport_definition $_definition) { |
31 | 31 | $options = $_definition->plugin_options; |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * return html for options. |
133 | 133 | * this way the plugin has all opportunities for options tab |
134 | 134 | * |
135 | - * @return string html |
|
135 | + * @return boolean html |
|
136 | 136 | */ |
137 | 137 | public function get_options_etpl() { |
138 | 138 | return false; |
@@ -125,8 +125,8 @@ |
||
125 | 125 | } |
126 | 126 | |
127 | 127 | public static function get_mimetype() { |
128 | - return 'text/csv'; |
|
129 | - } |
|
128 | + return 'text/csv'; |
|
129 | + } |
|
130 | 130 | |
131 | 131 | /** |
132 | 132 | * return html for options. |
@@ -27,51 +27,51 @@ discard block |
||
27 | 27 | * |
28 | 28 | * @param egw_record $_definition |
29 | 29 | */ |
30 | - public function export( $_stream, importexport_definition $_definition) { |
|
30 | + public function export($_stream, importexport_definition $_definition) { |
|
31 | 31 | $options = $_definition->plugin_options; |
32 | 32 | |
33 | 33 | $this->ui = new timesheet_ui(); |
34 | 34 | $selection = array(); |
35 | 35 | |
36 | - if($options['selection'] == 'search') { |
|
37 | - $query = $GLOBALS['egw']->session->appsession('index',TIMESHEET_APP); |
|
38 | - $query['num_rows'] = -1; // all records |
|
39 | - $query['csv_export'] = true; // so get_rows method _can_ produce different content or not store state in the session |
|
40 | - $this->ui->get_rows($query,$selection,$readonlys,true); // true = only return the id's |
|
41 | - } elseif($options['selection'] == 'all') { |
|
36 | + if ($options['selection'] == 'search') { |
|
37 | + $query = $GLOBALS['egw']->session->appsession('index', TIMESHEET_APP); |
|
38 | + $query['num_rows'] = -1; // all records |
|
39 | + $query['csv_export'] = true; // so get_rows method _can_ produce different content or not store state in the session |
|
40 | + $this->ui->get_rows($query, $selection, $readonlys, true); // true = only return the id's |
|
41 | + } elseif ($options['selection'] == 'all') { |
|
42 | 42 | $query = array( |
43 | 43 | 'num_rows' => -1, |
44 | - 'csv_export' => true, // so get_rows method _can_ produce different content or not store state in the session |
|
44 | + 'csv_export' => true, // so get_rows method _can_ produce different content or not store state in the session |
|
45 | 45 | ); |
46 | - $this->ui->get_rows($query,$selection,$readonlys,true); // true = only return the id's |
|
46 | + $this->ui->get_rows($query, $selection, $readonlys, true); // true = only return the id's |
|
47 | 47 | } |
48 | - else if($options['selection'] == 'filter') |
|
48 | + else if ($options['selection'] == 'filter') |
|
49 | 49 | { |
50 | 50 | $fields = importexport_helper_functions::get_filter_fields($_definition->application, $this); |
51 | 51 | $filter = $_definition->filter; |
52 | 52 | $query = array( |
53 | 53 | 'num_rows' => -1, |
54 | - 'csv_export' => true, // so get_rows method _can_ produce different content or not store state in the session |
|
54 | + 'csv_export' => true, // so get_rows method _can_ produce different content or not store state in the session |
|
55 | 55 | 'col_filter' => array() |
56 | 56 | ); |
57 | 57 | |
58 | 58 | // Handle ranges |
59 | - foreach($filter as $field => $value) |
|
59 | + foreach ($filter as $field => $value) |
|
60 | 60 | { |
61 | - if($field == 'cat_id') |
|
61 | + if ($field == 'cat_id') |
|
62 | 62 | { |
63 | 63 | $query['cat_id'] = $value; |
64 | 64 | continue; |
65 | 65 | } |
66 | 66 | $query['col_filter'][$field] = $value; |
67 | - if(!is_array($value) || (!$value['from'] && !$value['to'])) continue; |
|
67 | + if (!is_array($value) || (!$value['from'] && !$value['to'])) continue; |
|
68 | 68 | |
69 | 69 | // Ranges are inclusive, so should be provided that way (from 2 to 10 includes 2 and 10) |
70 | - if($value['from']) $query['col_filter'][] = "$field >= " . (int)$value['from']; |
|
71 | - if($value['to']) $query['col_filter'][] = "$field <= " . (int)$value['to']; |
|
70 | + if ($value['from']) $query['col_filter'][] = "$field >= ".(int)$value['from']; |
|
71 | + if ($value['to']) $query['col_filter'][] = "$field <= ".(int)$value['to']; |
|
72 | 72 | unset($query['col_filter'][$field]); |
73 | 73 | } |
74 | - $this->ui->get_rows($query,$selection,$readonlys,true); // true = only return the id's |
|
74 | + $this->ui->get_rows($query, $selection, $readonlys, true); // true = only return the id's |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | |
@@ -83,12 +83,12 @@ discard block |
||
83 | 83 | // support other selectors atm. |
84 | 84 | foreach ($selection as $identifier) { |
85 | 85 | $record = new timesheet_egw_record($identifier); |
86 | - if($options['convert']) { |
|
86 | + if ($options['convert']) { |
|
87 | 87 | importexport_export_csv::convert($record, timesheet_egw_record::$types, 'timesheet', $this->selects); |
88 | 88 | } else { |
89 | 89 | // Implode arrays, so they don't say 'Array' |
90 | - foreach($record->get_record_array() as $key => $value) { |
|
91 | - if(is_array($value)) $record->$key = implode(',', $value); |
|
90 | + foreach ($record->get_record_array() as $key => $value) { |
|
91 | + if (is_array($value)) $record->$key = implode(',', $value); |
|
92 | 92 | } |
93 | 93 | } |
94 | 94 | $export_object->export_record($record); |
@@ -151,10 +151,10 @@ discard block |
||
151 | 151 | public function get_selects() |
152 | 152 | { |
153 | 153 | $this->selects = array( |
154 | - 'ts_status' => $this->ui->status_labels+array(lang('No status')) |
|
154 | + 'ts_status' => $this->ui->status_labels + array(lang('No status')) |
|
155 | 155 | ); |
156 | - foreach($this->selects['ts_status'] as &$status) { |
|
157 | - $status = str_replace(' ','',$status); // Remove |
|
156 | + foreach ($this->selects['ts_status'] as &$status) { |
|
157 | + $status = str_replace(' ', '', $status); // Remove |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | } |
@@ -163,9 +163,9 @@ discard block |
||
163 | 163 | */ |
164 | 164 | public function get_filter_fields(Array &$filters) |
165 | 165 | { |
166 | - foreach($filters as $field_name => &$settings) |
|
166 | + foreach ($filters as $field_name => &$settings) |
|
167 | 167 | { |
168 | - if($this->selects[$field_name]) $settings['values'] = $this->selects[$field_name]; |
|
168 | + if ($this->selects[$field_name]) $settings['values'] = $this->selects[$field_name]; |
|
169 | 169 | } |
170 | 170 | } |
171 | 171 |
@@ -14,7 +14,8 @@ discard block |
||
14 | 14 | /** |
15 | 15 | * export plugin of addressbook |
16 | 16 | */ |
17 | -class timesheet_export_csv implements importexport_iface_export_plugin { |
|
17 | +class timesheet_export_csv implements importexport_iface_export_plugin |
|
18 | +{ |
|
18 | 19 | |
19 | 20 | public function __construct() |
20 | 21 | { |
@@ -27,18 +28,22 @@ discard block |
||
27 | 28 | * |
28 | 29 | * @param egw_record $_definition |
29 | 30 | */ |
30 | - public function export( $_stream, importexport_definition $_definition) { |
|
31 | + public function export( $_stream, importexport_definition $_definition) |
|
32 | + { |
|
31 | 33 | $options = $_definition->plugin_options; |
32 | 34 | |
33 | 35 | $this->ui = new timesheet_ui(); |
34 | 36 | $selection = array(); |
35 | 37 | |
36 | - if($options['selection'] == 'search') { |
|
38 | + if($options['selection'] == 'search') |
|
39 | + { |
|
37 | 40 | $query = $GLOBALS['egw']->session->appsession('index',TIMESHEET_APP); |
38 | 41 | $query['num_rows'] = -1; // all records |
39 | 42 | $query['csv_export'] = true; // so get_rows method _can_ produce different content or not store state in the session |
40 | 43 | $this->ui->get_rows($query,$selection,$readonlys,true); // true = only return the id's |
41 | - } elseif($options['selection'] == 'all') { |
|
44 | + } |
|
45 | + elseif($options['selection'] == 'all') |
|
46 | + { |
|
42 | 47 | $query = array( |
43 | 48 | 'num_rows' => -1, |
44 | 49 | 'csv_export' => true, // so get_rows method _can_ produce different content or not store state in the session |
@@ -64,11 +69,20 @@ discard block |
||
64 | 69 | continue; |
65 | 70 | } |
66 | 71 | $query['col_filter'][$field] = $value; |
67 | - if(!is_array($value) || (!$value['from'] && !$value['to'])) continue; |
|
72 | + if(!is_array($value) || (!$value['from'] && !$value['to'])) |
|
73 | + { |
|
74 | + continue; |
|
75 | + } |
|
68 | 76 | |
69 | 77 | // Ranges are inclusive, so should be provided that way (from 2 to 10 includes 2 and 10) |
70 | - if($value['from']) $query['col_filter'][] = "$field >= " . (int)$value['from']; |
|
71 | - if($value['to']) $query['col_filter'][] = "$field <= " . (int)$value['to']; |
|
78 | + if($value['from']) |
|
79 | + { |
|
80 | + $query['col_filter'][] = "$field >= " . (int)$value['from']; |
|
81 | + } |
|
82 | + if($value['to']) |
|
83 | + { |
|
84 | + $query['col_filter'][] = "$field <= " . (int)$value['to']; |
|
85 | + } |
|
72 | 86 | unset($query['col_filter'][$field]); |
73 | 87 | } |
74 | 88 | $this->ui->get_rows($query,$selection,$readonlys,true); // true = only return the id's |
@@ -81,14 +95,22 @@ discard block |
||
81 | 95 | |
82 | 96 | // $options['selection'] is array of identifiers as this plugin doesn't |
83 | 97 | // support other selectors atm. |
84 | - foreach ($selection as $identifier) { |
|
98 | + foreach ($selection as $identifier) |
|
99 | + { |
|
85 | 100 | $record = new timesheet_egw_record($identifier); |
86 | - if($options['convert']) { |
|
101 | + if($options['convert']) |
|
102 | + { |
|
87 | 103 | importexport_export_csv::convert($record, timesheet_egw_record::$types, 'timesheet', $this->selects); |
88 | - } else { |
|
104 | + } |
|
105 | + else |
|
106 | + { |
|
89 | 107 | // Implode arrays, so they don't say 'Array' |
90 | - foreach($record->get_record_array() as $key => $value) { |
|
91 | - if(is_array($value)) $record->$key = implode(',', $value); |
|
108 | + foreach($record->get_record_array() as $key => $value) |
|
109 | + { |
|
110 | + if(is_array($value)) |
|
111 | + { |
|
112 | + $record->$key = implode(',', $value); |
|
113 | + } |
|
92 | 114 | } |
93 | 115 | } |
94 | 116 | $export_object->export_record($record); |
@@ -102,7 +124,8 @@ discard block |
||
102 | 124 | * |
103 | 125 | * @return string name |
104 | 126 | */ |
105 | - public static function get_name() { |
|
127 | + public static function get_name() |
|
128 | + { |
|
106 | 129 | return lang('Timesheet CSV export'); |
107 | 130 | } |
108 | 131 | |
@@ -111,7 +134,8 @@ discard block |
||
111 | 134 | * |
112 | 135 | * @return string descriprion |
113 | 136 | */ |
114 | - public static function get_description() { |
|
137 | + public static function get_description() |
|
138 | + { |
|
115 | 139 | return lang("Exports entries from your Timesheet into a CSV File. "); |
116 | 140 | } |
117 | 141 | |
@@ -120,11 +144,13 @@ discard block |
||
120 | 144 | * |
121 | 145 | * @return string suffix |
122 | 146 | */ |
123 | - public static function get_filesuffix() { |
|
147 | + public static function get_filesuffix() |
|
148 | + { |
|
124 | 149 | return 'csv'; |
125 | 150 | } |
126 | 151 | |
127 | - public static function get_mimetype() { |
|
152 | + public static function get_mimetype() |
|
153 | + { |
|
128 | 154 | return 'text/csv'; |
129 | 155 | } |
130 | 156 | |
@@ -134,7 +160,8 @@ discard block |
||
134 | 160 | * |
135 | 161 | * @return string html |
136 | 162 | */ |
137 | - public function get_options_etpl() { |
|
163 | + public function get_options_etpl() |
|
164 | + { |
|
138 | 165 | return false; |
139 | 166 | } |
140 | 167 | |
@@ -142,7 +169,8 @@ discard block |
||
142 | 169 | * returns slectors of this plugin via xajax |
143 | 170 | * |
144 | 171 | */ |
145 | - public function get_selectors_etpl() { |
|
172 | + public function get_selectors_etpl() |
|
173 | + { |
|
146 | 174 | return array( |
147 | 175 | 'name' => 'importexport.export_csv_selectors', |
148 | 176 | ); |
@@ -153,7 +181,8 @@ discard block |
||
153 | 181 | $this->selects = array( |
154 | 182 | 'ts_status' => $this->ui->status_labels+array(lang('No status')) |
155 | 183 | ); |
156 | - foreach($this->selects['ts_status'] as &$status) { |
|
184 | + foreach($this->selects['ts_status'] as &$status) |
|
185 | + { |
|
157 | 186 | $status = str_replace(' ','',$status); // Remove |
158 | 187 | } |
159 | 188 | |
@@ -165,7 +194,10 @@ discard block |
||
165 | 194 | { |
166 | 195 | foreach($filters as $field_name => &$settings) |
167 | 196 | { |
168 | - if($this->selects[$field_name]) $settings['values'] = $this->selects[$field_name]; |
|
197 | + if($this->selects[$field_name]) |
|
198 | + { |
|
199 | + $settings['values'] = $this->selects[$field_name]; |
|
200 | + } |
|
169 | 201 | } |
170 | 202 | } |
171 | 203 |
@@ -247,7 +247,7 @@ |
||
247 | 247 | $this->selects['info_status'] = $this->bo->get_status(); |
248 | 248 | } |
249 | 249 | |
250 | - public function get_filter_fields(Array &$filters) |
|
250 | + public function get_filter_fields(array &$filters) |
|
251 | 251 | { |
252 | 252 | foreach($filters as $field_name => &$settings) |
253 | 253 | { |
@@ -104,8 +104,7 @@ |
||
104 | 104 | /** |
105 | 105 | * imports entries according to given definition object. |
106 | 106 | * @param resource $_stream |
107 | - * @param string $_charset |
|
108 | - * @param definition $_definition |
|
107 | + * @param importexport_definition $_definition |
|
109 | 108 | */ |
110 | 109 | public function import( $_stream, importexport_definition $_definition ) { |
111 | 110 | $import_csv = new importexport_import_csv( $_stream, array( |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | private $bo; |
73 | 73 | |
74 | 74 | /** |
75 | - * For figuring out if a record has changed |
|
76 | - */ |
|
75 | + * For figuring out if a record has changed |
|
76 | + */ |
|
77 | 77 | protected $tracking; |
78 | 78 | |
79 | 79 | /** |
@@ -97,9 +97,9 @@ discard block |
||
97 | 97 | protected $errors = array(); |
98 | 98 | |
99 | 99 | /** |
100 | - * List of actions, and how many times that action was taken |
|
101 | - */ |
|
102 | - protected $results = array(); |
|
100 | + * List of actions, and how many times that action was taken |
|
101 | + */ |
|
102 | + protected $results = array(); |
|
103 | 103 | |
104 | 104 | /** |
105 | 105 | * imports entries according to given definition object. |
@@ -458,40 +458,40 @@ discard block |
||
458 | 458 | } |
459 | 459 | |
460 | 460 | /** |
461 | - * Returns warnings that were encountered during importing |
|
462 | - * Maximum of one warning message per record, but you can append if you need to |
|
463 | - * |
|
464 | - * @return Array ( |
|
465 | - * record_# => warning message |
|
466 | - * ) |
|
467 | - */ |
|
468 | - public function get_warnings() { |
|
461 | + * Returns warnings that were encountered during importing |
|
462 | + * Maximum of one warning message per record, but you can append if you need to |
|
463 | + * |
|
464 | + * @return Array ( |
|
465 | + * record_# => warning message |
|
466 | + * ) |
|
467 | + */ |
|
468 | + public function get_warnings() { |
|
469 | 469 | return $this->warnings; |
470 | 470 | } |
471 | 471 | |
472 | 472 | /** |
473 | - * Returns errors that were encountered during importing |
|
474 | - * Maximum of one error message per record, but you can append if you need to |
|
475 | - * |
|
476 | - * @return Array ( |
|
477 | - * record_# => error message |
|
478 | - * ) |
|
479 | - */ |
|
480 | - public function get_errors() { |
|
473 | + * Returns errors that were encountered during importing |
|
474 | + * Maximum of one error message per record, but you can append if you need to |
|
475 | + * |
|
476 | + * @return Array ( |
|
477 | + * record_# => error message |
|
478 | + * ) |
|
479 | + */ |
|
480 | + public function get_errors() { |
|
481 | 481 | return $this->errors; |
482 | 482 | } |
483 | 483 | |
484 | 484 | /** |
485 | - * Returns a list of actions taken, and the number of records for that action. |
|
486 | - * Actions are things like 'insert', 'update', 'delete', and may be different for each plugin. |
|
487 | - * |
|
488 | - * @return Array ( |
|
489 | - * action => record count |
|
490 | - * ) |
|
491 | - */ |
|
492 | - public function get_results() { |
|
493 | - return $this->results; |
|
494 | - } |
|
485 | + * Returns a list of actions taken, and the number of records for that action. |
|
486 | + * Actions are things like 'insert', 'update', 'delete', and may be different for each plugin. |
|
487 | + * |
|
488 | + * @return Array ( |
|
489 | + * action => record count |
|
490 | + * ) |
|
491 | + */ |
|
492 | + public function get_results() { |
|
493 | + return $this->results; |
|
494 | + } |
|
495 | 495 | // end of iface_export_plugin |
496 | 496 | |
497 | 497 | // Extra conversion functions - must be static |
@@ -15,18 +15,18 @@ discard block |
||
15 | 15 | /** |
16 | 16 | * class import_csv for timesheet |
17 | 17 | */ |
18 | -class timesheet_import_csv implements importexport_iface_import_plugin { |
|
18 | +class timesheet_import_csv implements importexport_iface_import_plugin { |
|
19 | 19 | |
20 | 20 | private static $plugin_options = array( |
21 | - 'fieldsep', // char |
|
22 | - 'charset', // string |
|
23 | - 'update_cats', // string {override|add} overides record |
|
21 | + 'fieldsep', // char |
|
22 | + 'charset', // string |
|
23 | + 'update_cats', // string {override|add} overides record |
|
24 | 24 | // with cat(s) from csv OR add the cat from |
25 | 25 | // csv file to exeisting cat(s) of record |
26 | 26 | 'num_header_lines', // int number of header lines |
27 | 27 | 'field_conversion', // array( $csv_col_num => conversion) |
28 | - 'field_mapping', // array( $csv_col_num => adb_filed) |
|
29 | - 'conditions', /* => array containing condition arrays: |
|
28 | + 'field_mapping', // array( $csv_col_num => adb_filed) |
|
29 | + 'conditions', /* => array containing condition arrays: |
|
30 | 30 | 'type' => exists, // exists |
31 | 31 | 'string' => '#kundennummer', |
32 | 32 | 'true' => array( |
@@ -50,14 +50,14 @@ discard block |
||
50 | 50 | /** |
51 | 51 | * actions wich could be done to data entries |
52 | 52 | */ |
53 | - protected static $actions = array( 'none', 'update', 'insert', 'delete', ); |
|
53 | + protected static $actions = array('none', 'update', 'insert', 'delete',); |
|
54 | 54 | |
55 | 55 | /** |
56 | 56 | * conditions for actions |
57 | 57 | * |
58 | 58 | * @var array |
59 | 59 | */ |
60 | - protected static $conditions = array( 'exists' ); |
|
60 | + protected static $conditions = array('exists'); |
|
61 | 61 | |
62 | 62 | /** |
63 | 63 | * @var definition |
@@ -105,8 +105,8 @@ discard block |
||
105 | 105 | * @param string $_charset |
106 | 106 | * @param definition $_definition |
107 | 107 | */ |
108 | - public function import( $_stream, importexport_definition $_definition ) { |
|
109 | - $import_csv = new importexport_import_csv( $_stream, array( |
|
108 | + public function import($_stream, importexport_definition $_definition) { |
|
109 | + $import_csv = new importexport_import_csv($_stream, array( |
|
110 | 110 | 'fieldsep' => $_definition->plugin_options['fieldsep'], |
111 | 111 | 'charset' => $_definition->plugin_options['charset'], |
112 | 112 | )); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | $this->user = $GLOBALS['egw_info']['user']['account_id']; |
117 | 117 | |
118 | 118 | // dry run? |
119 | - $this->dry_run = isset( $_definition->plugin_options['dry_run'] ) ? $_definition->plugin_options['dry_run'] : false; |
|
119 | + $this->dry_run = isset($_definition->plugin_options['dry_run']) ? $_definition->plugin_options['dry_run'] : false; |
|
120 | 120 | |
121 | 121 | // fetch the bo |
122 | 122 | $this->bo = new timesheet_bo(); |
@@ -134,15 +134,15 @@ discard block |
||
134 | 134 | $import_csv->conversion_class = $this; |
135 | 135 | |
136 | 136 | //check if file has a header lines |
137 | - if ( isset( $_definition->plugin_options['num_header_lines'] ) && $_definition->plugin_options['num_header_lines'] > 0) { |
|
137 | + if (isset($_definition->plugin_options['num_header_lines']) && $_definition->plugin_options['num_header_lines'] > 0) { |
|
138 | 138 | $import_csv->skip_records($_definition->plugin_options['num_header_lines']); |
139 | - } elseif(isset($_definition->plugin_options['has_header_line']) && $_definition->plugin_options['has_header_line']) { |
|
139 | + } elseif (isset($_definition->plugin_options['has_header_line']) && $_definition->plugin_options['has_header_line']) { |
|
140 | 140 | // First method is preferred |
141 | 141 | $import_csv->skip_records(1); |
142 | 142 | } |
143 | 143 | |
144 | 144 | // set Owner |
145 | - $_definition->plugin_options['record_owner'] = isset( $_definition->plugin_options['record_owner'] ) ? |
|
145 | + $_definition->plugin_options['record_owner'] = isset($_definition->plugin_options['record_owner']) ? |
|
146 | 146 | $_definition->plugin_options['record_owner'] : $this->user; |
147 | 147 | |
148 | 148 | // Used to try to automatically match names to account IDs |
@@ -156,9 +156,9 @@ discard block |
||
156 | 156 | ); |
157 | 157 | |
158 | 158 | // Status need leading spaces removed |
159 | - foreach($lookups['ts_status'] as $id => &$label) { |
|
160 | - $label = str_replace(' ', '',trim($label)); |
|
161 | - if($label == '') unset($lookups['ts_status'][$id]); |
|
159 | + foreach ($lookups['ts_status'] as $id => &$label) { |
|
160 | + $label = str_replace(' ', '', trim($label)); |
|
161 | + if ($label == '') unset($lookups['ts_status'][$id]); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | // Start counting successes |
@@ -168,22 +168,22 @@ discard block |
||
168 | 168 | // Failures |
169 | 169 | $this->errors = array(); |
170 | 170 | |
171 | - while ( $record = $import_csv->get_record() ) { |
|
171 | + while ($record = $import_csv->get_record()) { |
|
172 | 172 | $success = false; |
173 | 173 | |
174 | 174 | // don't import empty records |
175 | - if( count( array_unique( $record ) ) < 2 ) continue; |
|
175 | + if (count(array_unique($record)) < 2) continue; |
|
176 | 176 | |
177 | 177 | $result = importexport_import_csv::convert($record, timesheet_egw_record::$types, 'timesheet', $lookups, $_definition->plugin_options['convert']); |
178 | - if($result) $this->warnings[$import_csv->get_current_position()] = $result; |
|
178 | + if ($result) $this->warnings[$import_csv->get_current_position()] = $result; |
|
179 | 179 | |
180 | 180 | // Automatically handle text categories without explicit translation |
181 | - foreach(array('ts_status','cat_id') as $field) { |
|
182 | - if(!is_numeric($record[$field])) { |
|
183 | - $translate_key = 'translate'.(substr($field,0,2) == 'ts' ? substr($field,2) : '_cat_id'); |
|
184 | - if($key = array_search($record[$field], $lookups[$field])) { |
|
181 | + foreach (array('ts_status', 'cat_id') as $field) { |
|
182 | + if (!is_numeric($record[$field])) { |
|
183 | + $translate_key = 'translate'.(substr($field, 0, 2) == 'ts' ? substr($field, 2) : '_cat_id'); |
|
184 | + if ($key = array_search($record[$field], $lookups[$field])) { |
|
185 | 185 | $record[$field] = $key; |
186 | - } elseif(array_key_exists($translate_key, $_definition->plugin_options)) { |
|
186 | + } elseif (array_key_exists($translate_key, $_definition->plugin_options)) { |
|
187 | 187 | $t_field = $_definition->plugin_options[$translate_key]; |
188 | 188 | switch ($t_field) { |
189 | 189 | case '': |
@@ -194,29 +194,29 @@ discard block |
||
194 | 194 | case '~skip~': |
195 | 195 | continue 2; |
196 | 196 | default: |
197 | - if(strpos($t_field, 'add') === 0) { |
|
197 | + if (strpos($t_field, 'add') === 0) { |
|
198 | 198 | // Check for a parent |
199 | - list($name, $parent_name) = explode('~',$t_field); |
|
200 | - if($parent_name) { |
|
199 | + list($name, $parent_name) = explode('~', $t_field); |
|
200 | + if ($parent_name) { |
|
201 | 201 | $parent = importexport_helper_functions::cat_name2id($parent_name); |
202 | 202 | } |
203 | 203 | |
204 | - if($field == 'cat_id') { |
|
204 | + if ($field == 'cat_id') { |
|
205 | 205 | $record[$field] = importexport_helper_functions::cat_name2id($record[$field], $parent); |
206 | 206 | } elseif ($field == 'ts_status') { |
207 | 207 | end($this->bo->status_labels); |
208 | - $id = key($this->bo->status_labels)+1; |
|
208 | + $id = key($this->bo->status_labels) + 1; |
|
209 | 209 | $this->bo->status_labels[$id] = $record[$field]; |
210 | 210 | $this->bo->status_labels_config[$id] = array( |
211 | 211 | 'name' => $record[$field], |
212 | 212 | 'parent' => $parent, |
213 | 213 | 'admin' => false |
214 | 214 | ); |
215 | - config::save_value('status_labels',$this->bo->status_labels_config,TIMESHEET_APP); |
|
215 | + config::save_value('status_labels', $this->bo->status_labels_config, TIMESHEET_APP); |
|
216 | 216 | $lookups[$field][$id] = $name; |
217 | 217 | $record[$field] = $id; |
218 | 218 | } |
219 | - } elseif($key = array_search($t_field, $lookups[$field])) { |
|
219 | + } elseif ($key = array_search($t_field, $lookups[$field])) { |
|
220 | 220 | $record[$field] = $key; |
221 | 221 | } else { |
222 | 222 | $record[$field] = $t_field; |
@@ -228,11 +228,11 @@ discard block |
||
228 | 228 | } |
229 | 229 | |
230 | 230 | // Set creator, unless it's supposed to come from CSV file |
231 | - if($_definition->plugin_options['owner_from_csv'] && $record['ts_owner']) { |
|
232 | - if(!is_numeric($record['ts_owner'])) { |
|
231 | + if ($_definition->plugin_options['owner_from_csv'] && $record['ts_owner']) { |
|
232 | + if (!is_numeric($record['ts_owner'])) { |
|
233 | 233 | // Automatically handle text owner without explicit translation |
234 | 234 | $new_owner = importexport_helper_functions::account_name2id($record['ts_owner']); |
235 | - if($new_owner == '') { |
|
235 | + if ($new_owner == '') { |
|
236 | 236 | $this->errors[$import_csv->get_current_position()] = lang( |
237 | 237 | 'Unable to convert "%1" to account ID. Using plugin setting (%2) for %3.', |
238 | 238 | $record['ts_owner'], |
@@ -249,11 +249,11 @@ discard block |
||
249 | 249 | } |
250 | 250 | |
251 | 251 | // Check account IDs |
252 | - foreach(array('ts_modifier') as $field) { |
|
253 | - if($record[$field] && !is_numeric($record[$field])) { |
|
252 | + foreach (array('ts_modifier') as $field) { |
|
253 | + if ($record[$field] && !is_numeric($record[$field])) { |
|
254 | 254 | // Try an automatic conversion |
255 | 255 | $account_id = importexport_helper_functions::account_name2id($record[$field]); |
256 | - if($account_id && strtoupper(common::grab_owner_name($account_id)) == strtoupper($record[$field])) { |
|
256 | + if ($account_id && strtoupper(common::grab_owner_name($account_id)) == strtoupper($record[$field])) { |
|
257 | 257 | $record[$field] = $account_id; |
258 | 258 | } else { |
259 | 259 | $this->errors[$import_csv->get_current_position()] = lang( |
@@ -269,35 +269,35 @@ discard block |
||
269 | 269 | // Special values |
270 | 270 | if ($record['addressbook'] && !is_numeric($record['addressbook'])) |
271 | 271 | { |
272 | - list($lastname,$firstname,$org_name) = explode(',',$record['addressbook']); |
|
273 | - $record['addressbook'] = self::addr_id($lastname,$firstname,$org_name); |
|
272 | + list($lastname, $firstname, $org_name) = explode(',', $record['addressbook']); |
|
273 | + $record['addressbook'] = self::addr_id($lastname, $firstname, $org_name); |
|
274 | 274 | } |
275 | 275 | |
276 | - if ( $_definition->plugin_options['conditions'] ) { |
|
277 | - foreach ( $_definition->plugin_options['conditions'] as $condition ) { |
|
276 | + if ($_definition->plugin_options['conditions']) { |
|
277 | + foreach ($_definition->plugin_options['conditions'] as $condition) { |
|
278 | 278 | $results = array(); |
279 | - switch ( $condition['type'] ) { |
|
279 | + switch ($condition['type']) { |
|
280 | 280 | // exists |
281 | 281 | case 'exists' : |
282 | - if($record[$condition['string']]) { |
|
282 | + if ($record[$condition['string']]) { |
|
283 | 283 | $results = $this->bo->search(array($condition['string'] => $record[$condition['string']])); |
284 | 284 | } |
285 | 285 | |
286 | - if ( is_array( $results ) && count( array_keys( $results )) >= 1 ) { |
|
286 | + if (is_array($results) && count(array_keys($results)) >= 1) { |
|
287 | 287 | // apply action to all records matching this exists condition |
288 | 288 | $action = $condition['true']; |
289 | - foreach ( (array)$results as $result ) { |
|
289 | + foreach ((array)$results as $result) { |
|
290 | 290 | $record['ts_id'] = $result['ts_id']; |
291 | - if ( $_definition->plugin_options['update_cats'] == 'add' ) { |
|
292 | - if ( !is_array( $result['cat_id'] ) ) $result['cat_id'] = explode( ',', $result['cat_id'] ); |
|
293 | - if ( !is_array( $record['cat_id'] ) ) $record['cat_id'] = explode( ',', $record['cat_id'] ); |
|
294 | - $record['cat_id'] = implode( ',', array_unique( array_merge( $record['cat_id'], $result['cat_id'] ) ) ); |
|
291 | + if ($_definition->plugin_options['update_cats'] == 'add') { |
|
292 | + if (!is_array($result['cat_id'])) $result['cat_id'] = explode(',', $result['cat_id']); |
|
293 | + if (!is_array($record['cat_id'])) $record['cat_id'] = explode(',', $record['cat_id']); |
|
294 | + $record['cat_id'] = implode(',', array_unique(array_merge($record['cat_id'], $result['cat_id']))); |
|
295 | 295 | } |
296 | - $success = $this->action( $action['action'], $record, $import_csv->get_current_position() ); |
|
296 | + $success = $this->action($action['action'], $record, $import_csv->get_current_position()); |
|
297 | 297 | } |
298 | 298 | } else { |
299 | 299 | $action = $condition['false']; |
300 | - $success = ($this->action( $action['action'], $record, $import_csv->get_current_position() )); |
|
300 | + $success = ($this->action($action['action'], $record, $import_csv->get_current_position())); |
|
301 | 301 | } |
302 | 302 | break; |
303 | 303 | |
@@ -310,9 +310,9 @@ discard block |
||
310 | 310 | } |
311 | 311 | } else { |
312 | 312 | // unconditional insert |
313 | - $success = $this->action( 'insert', $record, $import_csv->get_current_position() ); |
|
313 | + $success = $this->action('insert', $record, $import_csv->get_current_position()); |
|
314 | 314 | } |
315 | - if($success) $count++; |
|
315 | + if ($success) $count++; |
|
316 | 316 | } |
317 | 317 | return $count; |
318 | 318 | } |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | * @param array $_data tracker data for the action |
325 | 325 | * @return bool success or not |
326 | 326 | */ |
327 | - private function action ( $_action, $_data, $record_num = 0 ) { |
|
327 | + private function action($_action, $_data, $record_num = 0) { |
|
328 | 328 | $result = true; |
329 | 329 | switch ($_action) { |
330 | 330 | case 'none' : |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | $old_record = new timesheet_egw_record($_data['ts_id']); |
335 | 335 | $old = $old_record->get_record_array(); |
336 | 336 | |
337 | - if(!$this->definition->plugin_options['change_owner']) { |
|
337 | + if (!$this->definition->plugin_options['change_owner']) { |
|
338 | 338 | // Don't change creator of an existing ticket |
339 | 339 | unset($_data['ts_owner']); |
340 | 340 | } |
@@ -342,35 +342,35 @@ discard block |
||
342 | 342 | // Merge to deal with fields not in import record |
343 | 343 | $_data = array_merge($old, $_data); |
344 | 344 | $changed = $this->tracking->changed_fields($_data, $old); |
345 | - if(count($changed) == 0 && !$this->definition->plugin_options['update_timestamp']) { |
|
345 | + if (count($changed) == 0 && !$this->definition->plugin_options['update_timestamp']) { |
|
346 | 346 | break; |
347 | 347 | } |
348 | 348 | |
349 | 349 | // Clear old link, if different |
350 | 350 | if ($_data['ts_id'] && array_key_exists('pm_id', $_data) && $_data['pm_id'] != $old['pm_id']) { |
351 | - egw_link::unlink2(0,TIMESHEET_APP,$_data['ts_id'],0,'projectmanager',$old['pm_id']); |
|
351 | + egw_link::unlink2(0, TIMESHEET_APP, $_data['ts_id'], 0, 'projectmanager', $old['pm_id']); |
|
352 | 352 | } |
353 | 353 | |
354 | 354 | // Fall through |
355 | 355 | case 'insert' : |
356 | - if ( $this->dry_run ) { |
|
356 | + if ($this->dry_run) { |
|
357 | 357 | //print_r($_data); |
358 | 358 | $this->results[$_action]++; |
359 | 359 | break; |
360 | 360 | } else { |
361 | - $result = $this->bo->save( $_data); |
|
361 | + $result = $this->bo->save($_data); |
|
362 | 362 | $_data['ts_id'] = $this->bo->data['ts_id']; |
363 | 363 | |
364 | 364 | // Set projectmanager link |
365 | 365 | if ($_data['pm_id']) { |
366 | - egw_link::link(TIMESHEET_APP,$_data['ts_id'],'projectmanager',$_data['pm_id']); |
|
366 | + egw_link::link(TIMESHEET_APP, $_data['ts_id'], 'projectmanager', $_data['pm_id']); |
|
367 | 367 | } |
368 | 368 | |
369 | - if($result) { |
|
369 | + if ($result) { |
|
370 | 370 | $this->errors[$record_num] = lang('Permissions error - %1 could not %2', |
371 | 371 | $GLOBALS['egw']->accounts->id2name($_data['owner']), |
372 | 372 | lang($_action) |
373 | - ) . ' ' . $result; |
|
373 | + ).' '.$result; |
|
374 | 374 | } else { |
375 | 375 | $this->results[$_action]++; |
376 | 376 | $result = $this->bo->data['ts_id']; |
@@ -382,22 +382,22 @@ discard block |
||
382 | 382 | } |
383 | 383 | |
384 | 384 | // Process some additional fields |
385 | - if(!is_numeric($result)) { |
|
385 | + if (!is_numeric($result)) { |
|
386 | 386 | return $result; |
387 | 387 | } |
388 | 388 | $_link_id = false; |
389 | - foreach(self::$special_fields as $field => $desc) { |
|
390 | - if(!$_data[$field]) continue; |
|
389 | + foreach (self::$special_fields as $field => $desc) { |
|
390 | + if (!$_data[$field]) continue; |
|
391 | 391 | |
392 | 392 | // Links |
393 | - if(strpos('link', $field) === 0) { |
|
393 | + if (strpos('link', $field) === 0) { |
|
394 | 394 | list($app, $id) = explode(':', $_data[$field]); |
395 | 395 | } else { |
396 | 396 | $app = $field; |
397 | 397 | $id = $_data[$field]; |
398 | 398 | } |
399 | 399 | if ($app && $app_id) { |
400 | - $link_id = egw_link::link('timesheet',$id,$app,$app_id); |
|
400 | + $link_id = egw_link::link('timesheet', $id, $app, $app_id); |
|
401 | 401 | } |
402 | 402 | } |
403 | 403 | return $result; |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | // end of iface_export_plugin |
494 | 494 | |
495 | 495 | // Extra conversion functions - must be static |
496 | - public static function addr_id( $n_family,$n_given=null,$org_name=null ) { |
|
496 | + public static function addr_id($n_family, $n_given = null, $org_name = null) { |
|
497 | 497 | |
498 | 498 | // find in Addressbook, at least n_family AND (n_given OR org_name) have to match |
499 | 499 | static $contacts; |
@@ -503,18 +503,18 @@ discard block |
||
503 | 503 | list($n_family, $n_given, $org_name) = explode(',', $n_family); |
504 | 504 | } |
505 | 505 | $n_family = trim($n_family); |
506 | - if(!is_null($n_given)) $n_given = trim($n_given); |
|
506 | + if (!is_null($n_given)) $n_given = trim($n_given); |
|
507 | 507 | if (!is_object($contacts)) |
508 | 508 | { |
509 | - $contacts =& CreateObject('phpgwapi.contacts'); |
|
509 | + $contacts = & CreateObject('phpgwapi.contacts'); |
|
510 | 510 | } |
511 | 511 | if (!is_null($org_name)) // org_name given? |
512 | 512 | { |
513 | 513 | $org_name = trim($org_name); |
514 | - $addrs = $contacts->read( 0,0,array('id'),'',"n_family=$n_family,n_given=$n_given,org_name=$org_name" ); |
|
514 | + $addrs = $contacts->read(0, 0, array('id'), '', "n_family=$n_family,n_given=$n_given,org_name=$org_name"); |
|
515 | 515 | if (!count($addrs)) |
516 | 516 | { |
517 | - $addrs = $contacts->read( 0,0,array('id'),'',"n_family=$n_family,org_name=$org_name",'','n_family,org_name'); |
|
517 | + $addrs = $contacts->read(0, 0, array('id'), '', "n_family=$n_family,org_name=$org_name", '', 'n_family,org_name'); |
|
518 | 518 | } |
519 | 519 | } |
520 | 520 | if (!is_null($n_given) && (is_null($org_name) || !count($addrs))) // first name given and no result so far |
@@ -523,7 +523,7 @@ discard block |
||
523 | 523 | } |
524 | 524 | if (is_null($n_given) && is_null($org_name)) // just one name given, check against fn (= full name) |
525 | 525 | { |
526 | - $addrs = $contacts->read( 0,0,array('id'),'',"n_fn=$n_family",'','n_fn' ); |
|
526 | + $addrs = $contacts->read(0, 0, array('id'), '', "n_fn=$n_family", '', 'n_fn'); |
|
527 | 527 | } |
528 | 528 | if (count($addrs)) |
529 | 529 | { |
@@ -15,7 +15,8 @@ discard block |
||
15 | 15 | /** |
16 | 16 | * class import_csv for timesheet |
17 | 17 | */ |
18 | -class timesheet_import_csv implements importexport_iface_import_plugin { |
|
18 | +class timesheet_import_csv implements importexport_iface_import_plugin |
|
19 | +{ |
|
19 | 20 | |
20 | 21 | private static $plugin_options = array( |
21 | 22 | 'fieldsep', // char |
@@ -105,7 +106,8 @@ discard block |
||
105 | 106 | * @param string $_charset |
106 | 107 | * @param definition $_definition |
107 | 108 | */ |
108 | - public function import( $_stream, importexport_definition $_definition ) { |
|
109 | + public function import( $_stream, importexport_definition $_definition ) |
|
110 | + { |
|
109 | 111 | $import_csv = new importexport_import_csv( $_stream, array( |
110 | 112 | 'fieldsep' => $_definition->plugin_options['fieldsep'], |
111 | 113 | 'charset' => $_definition->plugin_options['charset'], |
@@ -134,9 +136,12 @@ discard block |
||
134 | 136 | $import_csv->conversion_class = $this; |
135 | 137 | |
136 | 138 | //check if file has a header lines |
137 | - if ( isset( $_definition->plugin_options['num_header_lines'] ) && $_definition->plugin_options['num_header_lines'] > 0) { |
|
139 | + if ( isset( $_definition->plugin_options['num_header_lines'] ) && $_definition->plugin_options['num_header_lines'] > 0) |
|
140 | + { |
|
138 | 141 | $import_csv->skip_records($_definition->plugin_options['num_header_lines']); |
139 | - } elseif(isset($_definition->plugin_options['has_header_line']) && $_definition->plugin_options['has_header_line']) { |
|
142 | + } |
|
143 | + elseif(isset($_definition->plugin_options['has_header_line']) && $_definition->plugin_options['has_header_line']) |
|
144 | + { |
|
140 | 145 | // First method is preferred |
141 | 146 | $import_csv->skip_records(1); |
142 | 147 | } |
@@ -156,9 +161,13 @@ discard block |
||
156 | 161 | ); |
157 | 162 | |
158 | 163 | // Status need leading spaces removed |
159 | - foreach($lookups['ts_status'] as $id => &$label) { |
|
164 | + foreach($lookups['ts_status'] as $id => &$label) |
|
165 | + { |
|
160 | 166 | $label = str_replace(' ', '',trim($label)); |
161 | - if($label == '') unset($lookups['ts_status'][$id]); |
|
167 | + if($label == '') |
|
168 | + { |
|
169 | + unset($lookups['ts_status'][$id]); |
|
170 | + } |
|
162 | 171 | } |
163 | 172 | |
164 | 173 | // Start counting successes |
@@ -168,24 +177,37 @@ discard block |
||
168 | 177 | // Failures |
169 | 178 | $this->errors = array(); |
170 | 179 | |
171 | - while ( $record = $import_csv->get_record() ) { |
|
180 | + while ( $record = $import_csv->get_record() ) |
|
181 | + { |
|
172 | 182 | $success = false; |
173 | 183 | |
174 | 184 | // don't import empty records |
175 | - if( count( array_unique( $record ) ) < 2 ) continue; |
|
185 | + if( count( array_unique( $record ) ) < 2 ) |
|
186 | + { |
|
187 | + continue; |
|
188 | + } |
|
176 | 189 | |
177 | 190 | $result = importexport_import_csv::convert($record, timesheet_egw_record::$types, 'timesheet', $lookups, $_definition->plugin_options['convert']); |
178 | - if($result) $this->warnings[$import_csv->get_current_position()] = $result; |
|
191 | + if($result) |
|
192 | + { |
|
193 | + $this->warnings[$import_csv->get_current_position()] = $result; |
|
194 | + } |
|
179 | 195 | |
180 | 196 | // Automatically handle text categories without explicit translation |
181 | - foreach(array('ts_status','cat_id') as $field) { |
|
182 | - if(!is_numeric($record[$field])) { |
|
197 | + foreach(array('ts_status','cat_id') as $field) |
|
198 | + { |
|
199 | + if(!is_numeric($record[$field])) |
|
200 | + { |
|
183 | 201 | $translate_key = 'translate'.(substr($field,0,2) == 'ts' ? substr($field,2) : '_cat_id'); |
184 | - if($key = array_search($record[$field], $lookups[$field])) { |
|
202 | + if($key = array_search($record[$field], $lookups[$field])) |
|
203 | + { |
|
185 | 204 | $record[$field] = $key; |
186 | - } elseif(array_key_exists($translate_key, $_definition->plugin_options)) { |
|
205 | + } |
|
206 | + elseif(array_key_exists($translate_key, $_definition->plugin_options)) |
|
207 | + { |
|
187 | 208 | $t_field = $_definition->plugin_options[$translate_key]; |
188 | - switch ($t_field) { |
|
209 | + switch ($t_field) |
|
210 | + { |
|
189 | 211 | case '': |
190 | 212 | case '0': |
191 | 213 | // Skip that field |
@@ -194,16 +216,21 @@ discard block |
||
194 | 216 | case '~skip~': |
195 | 217 | continue 2; |
196 | 218 | default: |
197 | - if(strpos($t_field, 'add') === 0) { |
|
219 | + if(strpos($t_field, 'add') === 0) |
|
220 | + { |
|
198 | 221 | // Check for a parent |
199 | 222 | list($name, $parent_name) = explode('~',$t_field); |
200 | - if($parent_name) { |
|
223 | + if($parent_name) |
|
224 | + { |
|
201 | 225 | $parent = importexport_helper_functions::cat_name2id($parent_name); |
202 | 226 | } |
203 | 227 | |
204 | - if($field == 'cat_id') { |
|
228 | + if($field == 'cat_id') |
|
229 | + { |
|
205 | 230 | $record[$field] = importexport_helper_functions::cat_name2id($record[$field], $parent); |
206 | - } elseif ($field == 'ts_status') { |
|
231 | + } |
|
232 | + elseif ($field == 'ts_status') |
|
233 | + { |
|
207 | 234 | end($this->bo->status_labels); |
208 | 235 | $id = key($this->bo->status_labels)+1; |
209 | 236 | $this->bo->status_labels[$id] = $record[$field]; |
@@ -216,9 +243,13 @@ discard block |
||
216 | 243 | $lookups[$field][$id] = $name; |
217 | 244 | $record[$field] = $id; |
218 | 245 | } |
219 | - } elseif($key = array_search($t_field, $lookups[$field])) { |
|
246 | + } |
|
247 | + elseif($key = array_search($t_field, $lookups[$field])) |
|
248 | + { |
|
220 | 249 | $record[$field] = $key; |
221 | - } else { |
|
250 | + } |
|
251 | + else |
|
252 | + { |
|
222 | 253 | $record[$field] = $t_field; |
223 | 254 | } |
224 | 255 | break; |
@@ -228,11 +259,14 @@ discard block |
||
228 | 259 | } |
229 | 260 | |
230 | 261 | // Set creator, unless it's supposed to come from CSV file |
231 | - if($_definition->plugin_options['owner_from_csv'] && $record['ts_owner']) { |
|
232 | - if(!is_numeric($record['ts_owner'])) { |
|
262 | + if($_definition->plugin_options['owner_from_csv'] && $record['ts_owner']) |
|
263 | + { |
|
264 | + if(!is_numeric($record['ts_owner'])) |
|
265 | + { |
|
233 | 266 | // Automatically handle text owner without explicit translation |
234 | 267 | $new_owner = importexport_helper_functions::account_name2id($record['ts_owner']); |
235 | - if($new_owner == '') { |
|
268 | + if($new_owner == '') |
|
269 | + { |
|
236 | 270 | $this->errors[$import_csv->get_current_position()] = lang( |
237 | 271 | 'Unable to convert "%1" to account ID. Using plugin setting (%2) for %3.', |
238 | 272 | $record['ts_owner'], |
@@ -240,22 +274,31 @@ discard block |
||
240 | 274 | lang($this->bo->field2label['ts_owner']) |
241 | 275 | ); |
242 | 276 | $record['ts_owner'] = $_definition->plugin_options['record_owner']; |
243 | - } else { |
|
277 | + } |
|
278 | + else |
|
279 | + { |
|
244 | 280 | $record['ts_owner'] = $new_owner; |
245 | 281 | } |
246 | 282 | } |
247 | - } elseif ($_definition->plugin_options['record_owner']) { |
|
283 | + } |
|
284 | + elseif ($_definition->plugin_options['record_owner']) |
|
285 | + { |
|
248 | 286 | $record['ts_owner'] = $_definition->plugin_options['record_owner']; |
249 | 287 | } |
250 | 288 | |
251 | 289 | // Check account IDs |
252 | - foreach(array('ts_modifier') as $field) { |
|
253 | - if($record[$field] && !is_numeric($record[$field])) { |
|
290 | + foreach(array('ts_modifier') as $field) |
|
291 | + { |
|
292 | + if($record[$field] && !is_numeric($record[$field])) |
|
293 | + { |
|
254 | 294 | // Try an automatic conversion |
255 | 295 | $account_id = importexport_helper_functions::account_name2id($record[$field]); |
256 | - if($account_id && strtoupper(common::grab_owner_name($account_id)) == strtoupper($record[$field])) { |
|
296 | + if($account_id && strtoupper(common::grab_owner_name($account_id)) == strtoupper($record[$field])) |
|
297 | + { |
|
257 | 298 | $record[$field] = $account_id; |
258 | - } else { |
|
299 | + } |
|
300 | + else |
|
301 | + { |
|
259 | 302 | $this->errors[$import_csv->get_current_position()] = lang( |
260 | 303 | 'Unable to convert "%1" to account ID. Using plugin setting (%2) for %3.', |
261 | 304 | $record[$field], |
@@ -273,29 +316,44 @@ discard block |
||
273 | 316 | $record['addressbook'] = self::addr_id($lastname,$firstname,$org_name); |
274 | 317 | } |
275 | 318 | |
276 | - if ( $_definition->plugin_options['conditions'] ) { |
|
277 | - foreach ( $_definition->plugin_options['conditions'] as $condition ) { |
|
319 | + if ( $_definition->plugin_options['conditions'] ) |
|
320 | + { |
|
321 | + foreach ( $_definition->plugin_options['conditions'] as $condition ) |
|
322 | + { |
|
278 | 323 | $results = array(); |
279 | - switch ( $condition['type'] ) { |
|
324 | + switch ( $condition['type'] ) |
|
325 | + { |
|
280 | 326 | // exists |
281 | 327 | case 'exists' : |
282 | - if($record[$condition['string']]) { |
|
328 | + if($record[$condition['string']]) |
|
329 | + { |
|
283 | 330 | $results = $this->bo->search(array($condition['string'] => $record[$condition['string']])); |
284 | 331 | } |
285 | 332 | |
286 | - if ( is_array( $results ) && count( array_keys( $results )) >= 1 ) { |
|
333 | + if ( is_array( $results ) && count( array_keys( $results )) >= 1 ) |
|
334 | + { |
|
287 | 335 | // apply action to all records matching this exists condition |
288 | 336 | $action = $condition['true']; |
289 | - foreach ( (array)$results as $result ) { |
|
337 | + foreach ( (array)$results as $result ) |
|
338 | + { |
|
290 | 339 | $record['ts_id'] = $result['ts_id']; |
291 | - if ( $_definition->plugin_options['update_cats'] == 'add' ) { |
|
292 | - if ( !is_array( $result['cat_id'] ) ) $result['cat_id'] = explode( ',', $result['cat_id'] ); |
|
293 | - if ( !is_array( $record['cat_id'] ) ) $record['cat_id'] = explode( ',', $record['cat_id'] ); |
|
340 | + if ( $_definition->plugin_options['update_cats'] == 'add' ) |
|
341 | + { |
|
342 | + if ( !is_array( $result['cat_id'] ) ) |
|
343 | + { |
|
344 | + $result['cat_id'] = explode( ',', $result['cat_id'] ); |
|
345 | + } |
|
346 | + if ( !is_array( $record['cat_id'] ) ) |
|
347 | + { |
|
348 | + $record['cat_id'] = explode( ',', $record['cat_id'] ); |
|
349 | + } |
|
294 | 350 | $record['cat_id'] = implode( ',', array_unique( array_merge( $record['cat_id'], $result['cat_id'] ) ) ); |
295 | 351 | } |
296 | 352 | $success = $this->action( $action['action'], $record, $import_csv->get_current_position() ); |
297 | 353 | } |
298 | - } else { |
|
354 | + } |
|
355 | + else |
|
356 | + { |
|
299 | 357 | $action = $condition['false']; |
300 | 358 | $success = ($this->action( $action['action'], $record, $import_csv->get_current_position() )); |
301 | 359 | } |
@@ -306,13 +364,21 @@ discard block |
||
306 | 364 | die('condition / action not supported!!!'); |
307 | 365 | break; |
308 | 366 | } |
309 | - if ($action['last']) break; |
|
367 | + if ($action['last']) |
|
368 | + { |
|
369 | + break; |
|
370 | + } |
|
310 | 371 | } |
311 | - } else { |
|
372 | + } |
|
373 | + else |
|
374 | + { |
|
312 | 375 | // unconditional insert |
313 | 376 | $success = $this->action( 'insert', $record, $import_csv->get_current_position() ); |
314 | 377 | } |
315 | - if($success) $count++; |
|
378 | + if($success) |
|
379 | + { |
|
380 | + $count++; |
|
381 | + } |
|
316 | 382 | } |
317 | 383 | return $count; |
318 | 384 | } |
@@ -324,9 +390,11 @@ discard block |
||
324 | 390 | * @param array $_data tracker data for the action |
325 | 391 | * @return bool success or not |
326 | 392 | */ |
327 | - private function action ( $_action, $_data, $record_num = 0 ) { |
|
393 | + private function action ( $_action, $_data, $record_num = 0 ) |
|
394 | + { |
|
328 | 395 | $result = true; |
329 | - switch ($_action) { |
|
396 | + switch ($_action) |
|
397 | + { |
|
330 | 398 | case 'none' : |
331 | 399 | return true; |
332 | 400 | case 'update' : |
@@ -334,7 +402,8 @@ discard block |
||
334 | 402 | $old_record = new timesheet_egw_record($_data['ts_id']); |
335 | 403 | $old = $old_record->get_record_array(); |
336 | 404 | |
337 | - if(!$this->definition->plugin_options['change_owner']) { |
|
405 | + if(!$this->definition->plugin_options['change_owner']) |
|
406 | + { |
|
338 | 407 | // Don't change creator of an existing ticket |
339 | 408 | unset($_data['ts_owner']); |
340 | 409 | } |
@@ -342,36 +411,45 @@ discard block |
||
342 | 411 | // Merge to deal with fields not in import record |
343 | 412 | $_data = array_merge($old, $_data); |
344 | 413 | $changed = $this->tracking->changed_fields($_data, $old); |
345 | - if(count($changed) == 0 && !$this->definition->plugin_options['update_timestamp']) { |
|
414 | + if(count($changed) == 0 && !$this->definition->plugin_options['update_timestamp']) |
|
415 | + { |
|
346 | 416 | break; |
347 | 417 | } |
348 | 418 | |
349 | 419 | // Clear old link, if different |
350 | - if ($_data['ts_id'] && array_key_exists('pm_id', $_data) && $_data['pm_id'] != $old['pm_id']) { |
|
420 | + if ($_data['ts_id'] && array_key_exists('pm_id', $_data) && $_data['pm_id'] != $old['pm_id']) |
|
421 | + { |
|
351 | 422 | egw_link::unlink2(0,TIMESHEET_APP,$_data['ts_id'],0,'projectmanager',$old['pm_id']); |
352 | 423 | } |
353 | 424 | |
354 | 425 | // Fall through |
355 | 426 | case 'insert' : |
356 | - if ( $this->dry_run ) { |
|
427 | + if ( $this->dry_run ) |
|
428 | + { |
|
357 | 429 | //print_r($_data); |
358 | 430 | $this->results[$_action]++; |
359 | 431 | break; |
360 | - } else { |
|
432 | + } |
|
433 | + else |
|
434 | + { |
|
361 | 435 | $result = $this->bo->save( $_data); |
362 | 436 | $_data['ts_id'] = $this->bo->data['ts_id']; |
363 | 437 | |
364 | 438 | // Set projectmanager link |
365 | - if ($_data['pm_id']) { |
|
439 | + if ($_data['pm_id']) |
|
440 | + { |
|
366 | 441 | egw_link::link(TIMESHEET_APP,$_data['ts_id'],'projectmanager',$_data['pm_id']); |
367 | 442 | } |
368 | 443 | |
369 | - if($result) { |
|
444 | + if($result) |
|
445 | + { |
|
370 | 446 | $this->errors[$record_num] = lang('Permissions error - %1 could not %2', |
371 | 447 | $GLOBALS['egw']->accounts->id2name($_data['owner']), |
372 | 448 | lang($_action) |
373 | 449 | ) . ' ' . $result; |
374 | - } else { |
|
450 | + } |
|
451 | + else |
|
452 | + { |
|
375 | 453 | $this->results[$_action]++; |
376 | 454 | $result = $this->bo->data['ts_id']; |
377 | 455 | } |
@@ -382,21 +460,30 @@ discard block |
||
382 | 460 | } |
383 | 461 | |
384 | 462 | // Process some additional fields |
385 | - if(!is_numeric($result)) { |
|
463 | + if(!is_numeric($result)) |
|
464 | + { |
|
386 | 465 | return $result; |
387 | 466 | } |
388 | 467 | $_link_id = false; |
389 | - foreach(self::$special_fields as $field => $desc) { |
|
390 | - if(!$_data[$field]) continue; |
|
468 | + foreach(self::$special_fields as $field => $desc) |
|
469 | + { |
|
470 | + if(!$_data[$field]) |
|
471 | + { |
|
472 | + continue; |
|
473 | + } |
|
391 | 474 | |
392 | 475 | // Links |
393 | - if(strpos('link', $field) === 0) { |
|
476 | + if(strpos('link', $field) === 0) |
|
477 | + { |
|
394 | 478 | list($app, $id) = explode(':', $_data[$field]); |
395 | - } else { |
|
479 | + } |
|
480 | + else |
|
481 | + { |
|
396 | 482 | $app = $field; |
397 | 483 | $id = $_data[$field]; |
398 | 484 | } |
399 | - if ($app && $app_id) { |
|
485 | + if ($app && $app_id) |
|
486 | + { |
|
400 | 487 | $link_id = egw_link::link('timesheet',$id,$app,$app_id); |
401 | 488 | } |
402 | 489 | } |
@@ -408,7 +495,8 @@ discard block |
||
408 | 495 | * |
409 | 496 | * @return string name |
410 | 497 | */ |
411 | - public static function get_name() { |
|
498 | + public static function get_name() |
|
499 | + { |
|
412 | 500 | return lang('Timesheet CSV import'); |
413 | 501 | } |
414 | 502 | |
@@ -417,7 +505,8 @@ discard block |
||
417 | 505 | * |
418 | 506 | * @return string descriprion |
419 | 507 | */ |
420 | - public static function get_description() { |
|
508 | + public static function get_description() |
|
509 | + { |
|
421 | 510 | return lang("Imports entries into the timesheet from a CSV File. "); |
422 | 511 | } |
423 | 512 | |
@@ -426,7 +515,8 @@ discard block |
||
426 | 515 | * |
427 | 516 | * @return string suffix (comma seperated) |
428 | 517 | */ |
429 | - public static function get_filesuffix() { |
|
518 | + public static function get_filesuffix() |
|
519 | + { |
|
430 | 520 | return 'csv'; |
431 | 521 | } |
432 | 522 | |
@@ -442,7 +532,8 @@ discard block |
||
442 | 532 | * preserv => array, |
443 | 533 | * ) |
444 | 534 | */ |
445 | - public function get_options_etpl() { |
|
535 | + public function get_options_etpl() |
|
536 | + { |
|
446 | 537 | // lets do it! |
447 | 538 | } |
448 | 539 | |
@@ -451,7 +542,8 @@ discard block |
||
451 | 542 | * |
452 | 543 | * @return string etemplate name |
453 | 544 | */ |
454 | - public function get_selectors_etpl() { |
|
545 | + public function get_selectors_etpl() |
|
546 | + { |
|
455 | 547 | // lets do it! |
456 | 548 | } |
457 | 549 | |
@@ -463,7 +555,8 @@ discard block |
||
463 | 555 | * record_# => warning message |
464 | 556 | * ) |
465 | 557 | */ |
466 | - public function get_warnings() { |
|
558 | + public function get_warnings() |
|
559 | + { |
|
467 | 560 | return $this->warnings; |
468 | 561 | } |
469 | 562 | |
@@ -475,7 +568,8 @@ discard block |
||
475 | 568 | * record_# => error message |
476 | 569 | * ) |
477 | 570 | */ |
478 | - public function get_errors() { |
|
571 | + public function get_errors() |
|
572 | + { |
|
479 | 573 | return $this->errors; |
480 | 574 | } |
481 | 575 | |
@@ -487,13 +581,15 @@ discard block |
||
487 | 581 | * action => record count |
488 | 582 | * ) |
489 | 583 | */ |
490 | - public function get_results() { |
|
584 | + public function get_results() |
|
585 | + { |
|
491 | 586 | return $this->results; |
492 | 587 | } |
493 | 588 | // end of iface_export_plugin |
494 | 589 | |
495 | 590 | // Extra conversion functions - must be static |
496 | - public static function addr_id( $n_family,$n_given=null,$org_name=null ) { |
|
591 | + public static function addr_id( $n_family,$n_given=null,$org_name=null ) |
|
592 | + { |
|
497 | 593 | |
498 | 594 | // find in Addressbook, at least n_family AND (n_given OR org_name) have to match |
499 | 595 | static $contacts; |
@@ -503,28 +599,40 @@ discard block |
||
503 | 599 | list($n_family, $n_given, $org_name) = explode(',', $n_family); |
504 | 600 | } |
505 | 601 | $n_family = trim($n_family); |
506 | - if(!is_null($n_given)) $n_given = trim($n_given); |
|
602 | + if(!is_null($n_given)) |
|
603 | + { |
|
604 | + $n_given = trim($n_given); |
|
605 | + } |
|
507 | 606 | if (!is_object($contacts)) |
508 | 607 | { |
509 | 608 | $contacts =& CreateObject('phpgwapi.contacts'); |
510 | 609 | } |
511 | - if (!is_null($org_name)) // org_name given? |
|
610 | + if (!is_null($org_name)) |
|
611 | + { |
|
612 | + // org_name given? |
|
512 | 613 | { |
513 | 614 | $org_name = trim($org_name); |
615 | + } |
|
514 | 616 | $addrs = $contacts->read( 0,0,array('id'),'',"n_family=$n_family,n_given=$n_given,org_name=$org_name" ); |
515 | 617 | if (!count($addrs)) |
516 | 618 | { |
517 | 619 | $addrs = $contacts->read( 0,0,array('id'),'',"n_family=$n_family,org_name=$org_name",'','n_family,org_name'); |
518 | 620 | } |
519 | 621 | } |
520 | - if (!is_null($n_given) && (is_null($org_name) || !count($addrs))) // first name given and no result so far |
|
622 | + if (!is_null($n_given) && (is_null($org_name) || !count($addrs))) |
|
623 | + { |
|
624 | + // first name given and no result so far |
|
521 | 625 | { |
522 | 626 | $addrs = $contacts->search(array('n_family' => $n_family, 'n_given' => $n_given)); |
523 | 627 | } |
524 | - if (is_null($n_given) && is_null($org_name)) // just one name given, check against fn (= full name) |
|
628 | + } |
|
629 | + if (is_null($n_given) && is_null($org_name)) |
|
630 | + { |
|
631 | + // just one name given, check against fn (= full name) |
|
525 | 632 | { |
526 | 633 | $addrs = $contacts->read( 0,0,array('id'),'',"n_fn=$n_family",'','n_fn' ); |
527 | 634 | } |
635 | + } |
|
528 | 636 | if (count($addrs)) |
529 | 637 | { |
530 | 638 | return $addrs[0]['id']; |
@@ -1053,7 +1053,7 @@ |
||
1053 | 1053 | * @param int &$success number of succeded actions |
1054 | 1054 | * @param int &$failed number of failed actions (not enought permissions) |
1055 | 1055 | * @param string &$action_msg translated verb for the actions, to be used in a message like %1 timesheets 'deleted' |
1056 | - * @param string/array $session_name 'index' or 'email', or array with session-data depending if we are in the main list or the popup |
|
1056 | + * @param string $session_name 'index' or 'email', or array with session-data depending if we are in the main list or the popup |
|
1057 | 1057 | * @return boolean true if all actions succeded, false otherwise |
1058 | 1058 | */ |
1059 | 1059 | function action($action,$checked,$use_all,&$success,&$failed,&$action_msg,$session_name,&$msg) |
@@ -942,7 +942,7 @@ |
||
942 | 942 | * |
943 | 943 | * @return array see nextmatch_widget::egw_actions() |
944 | 944 | */ |
945 | - public function get_actions(Array $query) |
|
945 | + public function get_actions(array $query) |
|
946 | 946 | { |
947 | 947 | $actions = array( |
948 | 948 | 'open' => array( // does edit if allowed, otherwise view |
@@ -49,10 +49,10 @@ discard block |
||
49 | 49 | |
50 | 50 | function view() |
51 | 51 | { |
52 | - $this->edit(null,true); |
|
52 | + $this->edit(null, true); |
|
53 | 53 | } |
54 | 54 | |
55 | - function edit($content = null,$view = false) |
|
55 | + function edit($content = null, $view = false) |
|
56 | 56 | { |
57 | 57 | $etpl = new etemplate_new('timesheet.edit'); |
58 | 58 | if (!is_array($content)) |
@@ -74,20 +74,19 @@ discard block |
||
74 | 74 | { |
75 | 75 | $this->data = array( |
76 | 76 | 'ts_start' => $this->today, |
77 | - 'start_time' => '', // force empty start-time |
|
78 | - 'end_time' => egw_time::to($this->now,'H:i'), |
|
77 | + 'start_time' => '', // force empty start-time |
|
78 | + 'end_time' => egw_time::to($this->now, 'H:i'), |
|
79 | 79 | 'ts_owner' => $GLOBALS['egw_info']['user']['account_id'], |
80 | - 'cat_id' => (int) $_REQUEST['cat_id'], |
|
80 | + 'cat_id' => (int)$_REQUEST['cat_id'], |
|
81 | 81 | 'ts_status'=> $GLOBALS['egw_info']['user']['preferences']['timesheet']['predefined_status'], |
82 | 82 | ); |
83 | 83 | } |
84 | 84 | $matches = null; |
85 | - $referer = preg_match('/menuaction=([^&]+)/',$_SERVER['HTTP_REFERER'],$matches) ? $matches[1] : |
|
86 | - (strpos($_SERVER['HTTP_REFERER'],'/infolog/index.php') !== false ? 'infolog.infolog_ui.index' : TIMESHEET_APP.'.timesheet_ui.index'); |
|
85 | + $referer = preg_match('/menuaction=([^&]+)/', $_SERVER['HTTP_REFERER'], $matches) ? $matches[1] : (strpos($_SERVER['HTTP_REFERER'], '/infolog/index.php') !== false ? 'infolog.infolog_ui.index' : TIMESHEET_APP.'.timesheet_ui.index'); |
|
87 | 86 | |
88 | 87 | if (!$this->check_statusForEditRights($this->data)) |
89 | 88 | { |
90 | - $view = true; //only admin can edit with this status |
|
89 | + $view = true; //only admin can edit with this status |
|
91 | 90 | $only_admin_edit = true; |
92 | 91 | $msg = lang('only Admin can edit this status'); |
93 | 92 | } |
@@ -100,7 +99,7 @@ discard block |
||
100 | 99 | { |
101 | 100 | if ($this->status_labels_config[$content['ts_status']]['admin']) |
102 | 101 | { |
103 | - $view = true; //only admin can edit with this status |
|
102 | + $view = true; //only admin can edit with this status |
|
104 | 103 | $only_admin_edit = true; |
105 | 104 | $msg = lang('only Admin can edit this status'); |
106 | 105 | } |
@@ -114,29 +113,29 @@ discard block |
||
114 | 113 | { |
115 | 114 | //$content['ts_start'] += $content['start_time']; |
116 | 115 | $start = new egw_time($content['ts_start']); |
117 | - $start_time = explode(':',$content['start_time']); |
|
118 | - $start->setTime($start_time[0],$start_time[1]); |
|
116 | + $start_time = explode(':', $content['start_time']); |
|
117 | + $start->setTime($start_time[0], $start_time[1]); |
|
119 | 118 | $content['ts_start'] = $start->format('ts'); |
120 | 119 | } |
121 | 120 | if (isset($content['end_time'])) // end-time specified |
122 | 121 | { |
123 | 122 | $end = new egw_time($content['ts_start']); |
124 | - $end_time = explode(':',$content['end_time']); |
|
125 | - $end->setTime($end_time[0],$end_time[1]); |
|
123 | + $end_time = explode(':', $content['end_time']); |
|
124 | + $end->setTime($end_time[0], $end_time[1]); |
|
126 | 125 | } |
127 | 126 | if ($end && $start) // start- & end-time --> calculate the duration |
128 | 127 | { |
129 | 128 | $content['ts_duration'] = ($end->format('ts') - $start->format('ts')) / 60; |
130 | 129 | // check if negative duration is caused by wrap over midnight |
131 | - if ($content['ts_duration'] < 0 && $content['ts_duration'] > -24*60) |
|
130 | + if ($content['ts_duration'] < 0 && $content['ts_duration'] > -24 * 60) |
|
132 | 131 | { |
133 | - $content['ts_duration'] += 24*60; |
|
132 | + $content['ts_duration'] += 24 * 60; |
|
134 | 133 | } |
135 | 134 | //echo "<p>end_time=$content[end_time], start_time=$content[start_time] --> duration=$content[ts_duration]</p>\n"; |
136 | 135 | } |
137 | 136 | elseif ($content['ts_duration'] && $end) // no start, calculate from end and duration |
138 | 137 | { |
139 | - $content['ts_start'] = $end->format('ts') - 60*$content['ts_duration']; |
|
138 | + $content['ts_start'] = $end->format('ts') - 60 * $content['ts_duration']; |
|
140 | 139 | //echo "<p>end_time=$content[end_time], duration=$content[ts_duration] --> ts_start=$content[ts_start]=".egw_time::to($content['ts_start'])."</p>\n"; |
141 | 140 | } |
142 | 141 | if ($content['ts_duration'] > 0) unset($content['end_time']); |
@@ -146,18 +145,18 @@ discard block |
||
146 | 145 | $referer = $content['referer']; |
147 | 146 | $content['ts_project_blur'] = $content['pm_id'] ? egw_link::title('projectmanager', $content['pm_id']) : ''; |
148 | 147 | $this->data = $content; |
149 | - foreach(array('button','view','referer','tabs','start_time') as $key) |
|
148 | + foreach (array('button', 'view', 'referer', 'tabs', 'start_time') as $key) |
|
150 | 149 | { |
151 | 150 | unset($this->data[$key]); |
152 | 151 | } |
153 | - switch($button) |
|
152 | + switch ($button) |
|
154 | 153 | { |
155 | 154 | case 'edit': |
156 | 155 | if ($this->check_acl(EGW_ACL_EDIT) && !$only_admin_edit) $view = false; |
157 | 156 | break; |
158 | 157 | |
159 | 158 | case 'undelete': |
160 | - if($content['ts_status'] == self::DELETED_STATUS) |
|
159 | + if ($content['ts_status'] == self::DELETED_STATUS) |
|
161 | 160 | { |
162 | 161 | unset($content['ts_status']); |
163 | 162 | $this->data['ts_status'] = ''; |
@@ -175,14 +174,14 @@ discard block |
||
175 | 174 | } |
176 | 175 | if (!$this->data['ts_quantity']) |
177 | 176 | { |
178 | - $etpl->set_validation_error('ts_quantity',lang('Field must not be empty !!!')); |
|
177 | + $etpl->set_validation_error('ts_quantity', lang('Field must not be empty !!!')); |
|
179 | 178 | } |
180 | 179 | if ($this->data['ts_duration'] < 0) |
181 | 180 | { |
182 | - $etpl->set_validation_error('start_time',lang('Starttime has to be before endtime !!!')); |
|
181 | + $etpl->set_validation_error('start_time', lang('Starttime has to be before endtime !!!')); |
|
183 | 182 | } |
184 | 183 | // set ts_title to ts_project if short viewtype (title is not editable) |
185 | - if($this->ts_viewtype == 'short') |
|
184 | + if ($this->ts_viewtype == 'short') |
|
186 | 185 | { |
187 | 186 | $this->data['ts_title'] = $this->data['ts_project']; |
188 | 187 | } |
@@ -193,9 +192,9 @@ discard block |
||
193 | 192 | |
194 | 193 | if (!$this->data['ts_title']) |
195 | 194 | { |
196 | - $etpl->set_validation_error('ts_title',lang('Field must not be empty !!!')); |
|
195 | + $etpl->set_validation_error('ts_title', lang('Field must not be empty !!!')); |
|
197 | 196 | } |
198 | - elseif($button != 'save_new') |
|
197 | + elseif ($button != 'save_new') |
|
199 | 198 | { |
200 | 199 | // remove title-blur for same behavior after apply, as for opening the saved entry again |
201 | 200 | unset($this->data['ts_title_blur']); |
@@ -204,26 +203,26 @@ discard block |
||
204 | 203 | unset($content['ts_project_blur']); |
205 | 204 | } |
206 | 205 | } |
207 | - if ($etpl->validation_errors()) break; // the user need to fix the error, before we can save the entry |
|
206 | + if ($etpl->validation_errors()) break; // the user need to fix the error, before we can save the entry |
|
208 | 207 | |
209 | 208 | // account for changed project --> remove old one from links and add new one |
210 | - if ((int) $this->data['pm_id'] != (int) $this->data['old_pm_id']) |
|
209 | + if ((int)$this->data['pm_id'] != (int)$this->data['old_pm_id']) |
|
211 | 210 | { |
212 | 211 | // update links accordingly |
213 | 212 | if ($this->data['pm_id']) |
214 | 213 | { |
215 | - egw_link::link(TIMESHEET_APP,$content['link_to']['to_id'],'projectmanager',$this->data['pm_id']); |
|
214 | + egw_link::link(TIMESHEET_APP, $content['link_to']['to_id'], 'projectmanager', $this->data['pm_id']); |
|
216 | 215 | } |
217 | 216 | if ($this->data['old_pm_id']) |
218 | 217 | { |
219 | - egw_link::unlink2(0,TIMESHEET_APP,$content['link_to']['to_id'],0,'projectmanager',$this->data['old_pm_id']); |
|
218 | + egw_link::unlink2(0, TIMESHEET_APP, $content['link_to']['to_id'], 0, 'projectmanager', $this->data['old_pm_id']); |
|
220 | 219 | unset($this->data['old_pm_id']); |
221 | 220 | } |
222 | 221 | } |
223 | 222 | // check if we are linked to a project, but that is NOT set as project |
224 | 223 | if (!$this->data['pm_id'] && is_array($content['link_to']['to_id'])) |
225 | 224 | { |
226 | - foreach($content['link_to']['to_id'] as $data) |
|
225 | + foreach ($content['link_to']['to_id'] as $data) |
|
227 | 226 | { |
228 | 227 | if ($data['app'] == 'projectmanager') |
229 | 228 | { |
@@ -244,26 +243,26 @@ discard block |
||
244 | 243 | $msg = lang('Entry saved'); |
245 | 244 | if (is_array($content['link_to']['to_id']) && count($content['link_to']['to_id'])) |
246 | 245 | { |
247 | - egw_link::link(TIMESHEET_APP,$this->data['ts_id'],$content['link_to']['to_id']); |
|
246 | + egw_link::link(TIMESHEET_APP, $this->data['ts_id'], $content['link_to']['to_id']); |
|
248 | 247 | } |
249 | 248 | } |
250 | 249 | egw_framework::refresh_opener($msg, 'timesheet', $this->data['ts_id'], $content['ts_id'] ? 'edit' : 'add'); |
251 | 250 | if ($button == 'apply') break; |
252 | 251 | if ($button == 'save_new') |
253 | 252 | { |
254 | - $msg .= ', '.lang('creating new entry'); // giving some feedback to the user |
|
253 | + $msg .= ', '.lang('creating new entry'); // giving some feedback to the user |
|
255 | 254 | |
256 | 255 | if (!is_array($content['link_to']['to_id'])) // set links again, so new entry gets the same links as the existing one |
257 | 256 | { |
258 | 257 | $content['link_to']['to_id'] = 0; |
259 | - foreach(egw_link::get_links(TIMESHEET_APP,$this->data['ts_id'],'!'.egw_link::VFS_APPNAME) as $link) |
|
258 | + foreach (egw_link::get_links(TIMESHEET_APP, $this->data['ts_id'], '!'.egw_link::VFS_APPNAME) as $link) |
|
260 | 259 | { |
261 | - egw_link::link(TIMESHEET_APP,$content['link_to']['to_id'],$link['app'],$link['id'],$link['remark']); |
|
260 | + egw_link::link(TIMESHEET_APP, $content['link_to']['to_id'], $link['app'], $link['id'], $link['remark']); |
|
262 | 261 | } |
263 | 262 | } |
264 | 263 | // create a new entry |
265 | 264 | $this->data['ts_start'] += 60 * $this->data['ts_duration']; |
266 | - foreach(array('ts_id','ts_title','ts_description','ts_duration','ts_quantity','ts_modified','ts_modifier') as $name) |
|
265 | + foreach (array('ts_id', 'ts_title', 'ts_description', 'ts_duration', 'ts_quantity', 'ts_modified', 'ts_modifier') as $name) |
|
267 | 266 | { |
268 | 267 | unset($this->data[$name]); |
269 | 268 | } |
@@ -283,7 +282,7 @@ discard block |
||
283 | 282 | else |
284 | 283 | { |
285 | 284 | $msg = lang('Error deleting the entry!!!'); |
286 | - break; // dont close window |
|
285 | + break; // dont close window |
|
287 | 286 | } |
288 | 287 | } |
289 | 288 | // fall-through for save |
@@ -296,7 +295,7 @@ discard block |
||
296 | 295 | 'referer' => $referer, |
297 | 296 | 'ts_title_blur' => $content['ts_title_blur'], |
298 | 297 | ); |
299 | - $content = array_merge($this->data,array( |
|
298 | + $content = array_merge($this->data, array( |
|
300 | 299 | 'msg' => $msg, |
301 | 300 | 'view' => $view, |
302 | 301 | 'tabs' => $content['tabs'], |
@@ -304,8 +303,8 @@ discard block |
||
304 | 303 | 'to_id' => $this->data['ts_id'] ? $this->data['ts_id'] : $content['link_to']['to_id'], |
305 | 304 | 'to_app' => TIMESHEET_APP, |
306 | 305 | ), |
307 | - 'ts_quantity_blur' => $this->data['ts_duration'] ? round($this->data['ts_duration'] / 60.0,3) : '', |
|
308 | - 'ts_quantity' => $this->data['ts_duration']/60.0 == $this->data['ts_quantity'] ? null : $this->data['ts_quantity'], |
|
306 | + 'ts_quantity_blur' => $this->data['ts_duration'] ? round($this->data['ts_duration'] / 60.0, 3) : '', |
|
307 | + 'ts_quantity' => $this->data['ts_duration'] / 60.0 == $this->data['ts_quantity'] ? null : $this->data['ts_quantity'], |
|
309 | 308 | 'start_time' => isset($this->data['start_time']) ? $this->data['start_time'] : $this->data['ts_start'], |
310 | 309 | 'pm_integration' => $this->pm_integration, |
311 | 310 | 'no_ts_status' => !$this->status_labels && ($this->data['ts_status'] != self::DELETED_STATUS), |
@@ -315,10 +314,10 @@ discard block |
||
315 | 314 | if (!$this->data['ts_id'] && isset($_REQUEST['link_app']) && isset($_REQUEST['link_id']) && !is_array($content['link_to']['to_id'])) |
316 | 315 | { |
317 | 316 | $link_ids = is_array($_REQUEST['link_id']) ? $_REQUEST['link_id'] : array($_REQUEST['link_id']); |
318 | - foreach(is_array($_REQUEST['link_app']) ? $_REQUEST['link_app'] : array($_REQUEST['link_app']) as $n => $link_app) |
|
317 | + foreach (is_array($_REQUEST['link_app']) ? $_REQUEST['link_app'] : array($_REQUEST['link_app']) as $n => $link_app) |
|
319 | 318 | { |
320 | 319 | $link_id = $link_ids[$n]; |
321 | - if (preg_match('/^[a-z_0-9-]+:[:a-z_0-9-]+$/i',$link_app.':'.$link_id)) // gard against XSS |
|
320 | + if (preg_match('/^[a-z_0-9-]+:[:a-z_0-9-]+$/i', $link_app.':'.$link_id)) // gard against XSS |
|
322 | 321 | { |
323 | 322 | switch ($link_app) |
324 | 323 | { |
@@ -326,33 +325,33 @@ discard block |
||
326 | 325 | $links[] = $link_id; |
327 | 326 | // fall-through; |
328 | 327 | default: |
329 | - if(!$n) |
|
328 | + if (!$n) |
|
330 | 329 | { |
331 | 330 | // get title from first linked app |
332 | - $preserv['ts_title_blur'] = egw_link::title($link_app,$link_id); |
|
331 | + $preserv['ts_title_blur'] = egw_link::title($link_app, $link_id); |
|
333 | 332 | // ask first linked app via "timesheet_set" hook, for further data to set, incl. links |
334 | - if (($set = $GLOBALS['egw']->hooks->single(array('location'=>'timesheet_set','id'=>$link_id),$link_app))) |
|
333 | + if (($set = $GLOBALS['egw']->hooks->single(array('location'=>'timesheet_set', 'id'=>$link_id), $link_app))) |
|
335 | 334 | { |
336 | - foreach((array)$set['link_app'] as $i => $l_app) |
|
335 | + foreach ((array)$set['link_app'] as $i => $l_app) |
|
337 | 336 | { |
338 | - if (($l_id=$set['link_id'][$i])) egw_link::link(TIMESHEET_APP,$content['link_to']['to_id'],$l_app,$l_id); |
|
337 | + if (($l_id = $set['link_id'][$i])) egw_link::link(TIMESHEET_APP, $content['link_to']['to_id'], $l_app, $l_id); |
|
339 | 338 | if ($l_app == 'projectmanager') $links[] = $l_id; |
340 | 339 | } |
341 | 340 | unset($set['link_app']); |
342 | 341 | unset($set['link_id']); |
343 | 342 | |
344 | - $content = array_merge($content,$set); |
|
343 | + $content = array_merge($content, $set); |
|
345 | 344 | } |
346 | 345 | } |
347 | 346 | break; |
348 | 347 | } |
349 | - egw_link::link(TIMESHEET_APP,$content['link_to']['to_id'],$link_app,$link_id); |
|
348 | + egw_link::link(TIMESHEET_APP, $content['link_to']['to_id'], $link_app, $link_id); |
|
350 | 349 | } |
351 | 350 | } |
352 | 351 | } |
353 | 352 | elseif ($this->data['ts_id']) |
354 | 353 | { |
355 | - $links = egw_link::get_links(TIMESHEET_APP,$this->data['ts_id'],'projectmanager'); |
|
354 | + $links = egw_link::get_links(TIMESHEET_APP, $this->data['ts_id'], 'projectmanager'); |
|
356 | 355 | } |
357 | 356 | // make all linked projects availible for the pm-pricelist widget, to be able to choose prices from all |
358 | 357 | $content['all_pm_ids'] = array_values($links); |
@@ -395,7 +394,7 @@ discard block |
||
395 | 394 | |
396 | 395 | if ($view) |
397 | 396 | { |
398 | - foreach(array_merge(array_keys($this->data),array('pm_id','pl_id','link_to')) as $key) |
|
397 | + foreach (array_merge(array_keys($this->data), array('pm_id', 'pl_id', 'link_to')) as $key) |
|
399 | 398 | { |
400 | 399 | $readonlys[$key] = true; |
401 | 400 | } |
@@ -411,9 +410,9 @@ discard block |
||
411 | 410 | { |
412 | 411 | $edit_grants[$content['ts_owner']] = common::grab_owner_name($content['ts_owner']); |
413 | 412 | } |
414 | - $sel_options['ts_owner'] = $edit_grants; |
|
415 | - $sel_options['ts_status'] = $this->status_labels; |
|
416 | - if($this->config_data['history'] && $content['ts_status'] == self::DELETED_STATUS) |
|
413 | + $sel_options['ts_owner'] = $edit_grants; |
|
414 | + $sel_options['ts_status'] = $this->status_labels; |
|
415 | + if ($this->config_data['history'] && $content['ts_status'] == self::DELETED_STATUS) |
|
417 | 416 | { |
418 | 417 | $sel_options['ts_status'][self::DELETED_STATUS] = 'Deleted'; |
419 | 418 | } |
@@ -423,19 +422,19 @@ discard block |
||
423 | 422 | // supress unknow widget 'projectmanager-*', if projectmanager is not installed or old |
424 | 423 | if (!@file_exists(EGW_INCLUDE_ROOT.'/projectmanager/inc/class.projectmanager_widget.inc.php')) |
425 | 424 | { |
426 | - $etpl->set_cell_attribute('pm_id','disabled',true); |
|
427 | - $etpl->set_cell_attribute('pl_id','disabled',true); |
|
425 | + $etpl->set_cell_attribute('pm_id', 'disabled', true); |
|
426 | + $etpl->set_cell_attribute('pl_id', 'disabled', true); |
|
428 | 427 | } |
429 | 428 | |
430 | - if($this->ts_viewtype == 'short') |
|
429 | + if ($this->ts_viewtype == 'short') |
|
431 | 430 | { |
432 | 431 | $content['ts_viewtype'] = $readonlys['tabs']['notes'] = true; |
433 | 432 | $content['ts_description_short'] = $content['ts_description']; |
434 | 433 | } |
435 | - if (!$this->customfields) $readonlys['tabs']['customfields'] = true; // suppress tab if there are not customfields |
|
436 | - if (!$this->data['ts_id']) $readonlys['tabs']['history'] = true; //suppress history for the first loading without ID |
|
434 | + if (!$this->customfields) $readonlys['tabs']['customfields'] = true; // suppress tab if there are not customfields |
|
435 | + if (!$this->data['ts_id']) $readonlys['tabs']['history'] = true; //suppress history for the first loading without ID |
|
437 | 436 | |
438 | - return $etpl->exec(TIMESHEET_APP.'.timesheet_ui.edit',$content,$sel_options,$readonlys,$preserv,2); |
|
437 | + return $etpl->exec(TIMESHEET_APP.'.timesheet_ui.edit', $content, $sel_options, $readonlys, $preserv, 2); |
|
439 | 438 | } |
440 | 439 | |
441 | 440 | /** |
@@ -448,7 +447,7 @@ discard block |
||
448 | 447 | { |
449 | 448 | if (!$datetime) return 0; |
450 | 449 | |
451 | - return $datetime - mktime(0,0,0,date('m',$datetime),date('d',$datetime),date('Y',$datetime)); |
|
450 | + return $datetime - mktime(0, 0, 0, date('m', $datetime), date('d', $datetime), date('Y', $datetime)); |
|
452 | 451 | } |
453 | 452 | |
454 | 453 | /** |
@@ -462,17 +461,17 @@ discard block |
||
462 | 461 | * @param boolean $id_only if true only return (via $rows) an array of contact-ids, dont save state to session |
463 | 462 | * @return int total number of contacts matching the selection |
464 | 463 | */ |
465 | - function get_rows(&$query_in,&$rows,&$readonlys,$id_only=false) |
|
464 | + function get_rows(&$query_in, &$rows, &$readonlys, $id_only = false) |
|
466 | 465 | { |
467 | 466 | $this->show_sums = false; |
468 | 467 | if ($query_in['filter']) |
469 | 468 | { |
470 | - $date_filter = $this->date_filter($query_in['filter'],$query_in['startdate'],$query_in['enddate']); |
|
469 | + $date_filter = $this->date_filter($query_in['filter'], $query_in['startdate'], $query_in['enddate']); |
|
471 | 470 | |
472 | 471 | if ($query_in['startdate']) |
473 | 472 | { |
474 | - $start = explode('-',date('Y-m-d',$query_in['startdate']+12*60*60)); |
|
475 | - $end = explode('-',date('Y-m-d',$query_in['enddate'] ? $query_in['enddate'] : $query_in['startdate']+7.5*24*60*60)); |
|
473 | + $start = explode('-', date('Y-m-d', $query_in['startdate'] + 12 * 60 * 60)); |
|
474 | + $end = explode('-', date('Y-m-d', $query_in['enddate'] ? $query_in['enddate'] : $query_in['startdate'] + 7.5 * 24 * 60 * 60)); |
|
476 | 475 | |
477 | 476 | // show year-sums, if we are year-aligned (show full years)? |
478 | 477 | if ((int)$start[2] == 1 && (int)$start[1] == 1 && (int)$end[2] == 31 && (int)$end[1] == 12) |
@@ -480,42 +479,42 @@ discard block |
||
480 | 479 | $this->show_sums[] = 'year'; |
481 | 480 | } |
482 | 481 | // show month-sums, if we are month-aligned (show full monthes)? |
483 | - if ((int)$start[2] == 1 && (int)$end[2] == (int)date('d',mktime(12,0,0,$end[1]+1,0,$end[0]))) |
|
482 | + if ((int)$start[2] == 1 && (int)$end[2] == (int)date('d', mktime(12, 0, 0, $end[1] + 1, 0, $end[0]))) |
|
484 | 483 | { |
485 | 484 | $this->show_sums[] = 'month'; |
486 | 485 | } |
487 | 486 | // show week-sums, if we are week-aligned (show full weeks)? |
488 | 487 | $week_start_day = $GLOBALS['egw_info']['user']['preferences']['calendar']['weekdaystarts']; |
489 | 488 | if (!$week_start_day) $week_start_day = 'Sunday'; |
490 | - switch($week_start_day) |
|
489 | + switch ($week_start_day) |
|
491 | 490 | { |
492 | 491 | case 'Sunday': $week_end_day = 'Saturday'; break; |
493 | 492 | case 'Monday': $week_end_day = 'Sunday'; break; |
494 | 493 | case 'Saturday': $week_end_day = 'Friday'; break; |
495 | 494 | } |
496 | - $filter_start_day = date('l',$query_in['startdate']+12*60*60); |
|
497 | - $filter_end_day = $query_in['enddate'] ? date('l',$query_in['enddate']+12*60*60) : false; |
|
495 | + $filter_start_day = date('l', $query_in['startdate'] + 12 * 60 * 60); |
|
496 | + $filter_end_day = $query_in['enddate'] ? date('l', $query_in['enddate'] + 12 * 60 * 60) : false; |
|
498 | 497 | //echo "<p align=right>prefs: $week_start_day - $week_end_day, filter: $filter_start_day - $filter_end_day</p>\n"; |
499 | 498 | if ($filter_start_day == $week_start_day && (!$filter_end_day || $filter_end_day == $week_end_day)) |
500 | 499 | { |
501 | 500 | $this->show_sums[] = 'week'; |
502 | 501 | } |
503 | 502 | // show day-sums, if range <= 5 weeks |
504 | - if (!$query_in['enddate'] || $query_in['enddate'] - $query_in['startdate'] < 36*24*60*60) |
|
503 | + if (!$query_in['enddate'] || $query_in['enddate'] - $query_in['startdate'] < 36 * 24 * 60 * 60) |
|
505 | 504 | { |
506 | 505 | $this->show_sums[] = 'day'; |
507 | 506 | } |
508 | 507 | } |
509 | 508 | } |
510 | 509 | //echo "<p align=right>show_sums=".print_r($this->show_sums,true)."</p>\n"; |
511 | - if (!$id_only && !$query_in['csv_export']) $GLOBALS['egw']->session->appsession('index',TIMESHEET_APP,$query_in); |
|
510 | + if (!$id_only && !$query_in['csv_export']) $GLOBALS['egw']->session->appsession('index', TIMESHEET_APP, $query_in); |
|
512 | 511 | |
513 | 512 | // Refresh actions (undelete needs this) |
514 | 513 | $query_in['actions'] = $this->get_actions($query_in); |
515 | 514 | |
516 | - $query = $query_in; // keep the original query |
|
515 | + $query = $query_in; // keep the original query |
|
517 | 516 | |
518 | - if($this->ts_viewtype == 'short') $query_in['options-selectcols'] = array('ts_quantity'=>false,'ts_unitprice'=>false,'ts_total'=>false); |
|
517 | + if ($this->ts_viewtype == 'short') $query_in['options-selectcols'] = array('ts_quantity'=>false, 'ts_unitprice'=>false, 'ts_total'=>false); |
|
519 | 518 | if ($query['no_status']) $query_in['options-selectcols']['ts_status'] = false; |
520 | 519 | |
521 | 520 | //_debug_array($query['col_filter']); |
@@ -542,10 +541,10 @@ discard block |
||
542 | 541 | // handle linked filter (show only entries linked to a certain other entry) |
543 | 542 | if ($query['col_filter']['linked']) |
544 | 543 | { |
545 | - list($app,$id) = explode(':',$query['col_filter']['linked']); |
|
546 | - if (!($links = egw_link::get_links($app,$id,'timesheet'))) |
|
544 | + list($app, $id) = explode(':', $query['col_filter']['linked']); |
|
545 | + if (!($links = egw_link::get_links($app, $id, 'timesheet'))) |
|
547 | 546 | { |
548 | - $rows = array(); // no infologs linked to project --> no rows to return |
|
547 | + $rows = array(); // no infologs linked to project --> no rows to return |
|
549 | 548 | return 0; |
550 | 549 | } |
551 | 550 | if (!$query['col_filter']['ts_id']) |
@@ -553,9 +552,9 @@ discard block |
||
553 | 552 | $query['col_filter']['ts_id'] = array_values(array_unique($links)); |
554 | 553 | } |
555 | 554 | // allow to combine with other filters using ts_id --> intersect ids |
556 | - elseif (!($query['col_filter']['ts_id'] = array_intersect((array)$query['col_filter']['ts_id'],array_values(array_unique($links))))) |
|
555 | + elseif (!($query['col_filter']['ts_id'] = array_intersect((array)$query['col_filter']['ts_id'], array_values(array_unique($links))))) |
|
557 | 556 | { |
558 | - $rows = array(); // no infologs linked to project --> no rows to return |
|
557 | + $rows = array(); // no infologs linked to project --> no rows to return |
|
559 | 558 | return 0; |
560 | 559 | } |
561 | 560 | } |
@@ -579,13 +578,13 @@ discard block |
||
579 | 578 | { |
580 | 579 | if (isset($this->status_labels_substatus['2level'][$status_id])) |
581 | 580 | { |
582 | - $query['col_filter']['ts_status'] = array_merge($query['col_filter']['ts_status'],$this->status_labels_substatus[$status_id]); |
|
581 | + $query['col_filter']['ts_status'] = array_merge($query['col_filter']['ts_status'], $this->status_labels_substatus[$status_id]); |
|
583 | 582 | } |
584 | 583 | } |
585 | 584 | } |
586 | 585 | if ((int)$query['filter2'] != (int)$GLOBALS['egw_info']['user']['preferences'][TIMESHEET_APP]['show_details']) |
587 | 586 | { |
588 | - $GLOBALS['egw']->preferences->add(TIMESHEET_APP,'show_details',(int)$query['filter2']); |
|
587 | + $GLOBALS['egw']->preferences->add(TIMESHEET_APP, 'show_details', (int)$query['filter2']); |
|
589 | 588 | $GLOBALS['egw']->preferences->save_repository(true); |
590 | 589 | } |
591 | 590 | // category filter: cat_id or ''=All cats or 0=No cat |
@@ -608,7 +607,7 @@ discard block |
||
608 | 607 | $GLOBALS['egw_info']['flags']['app_header'] .= ': '.common::grab_owner_name($query['col_filter']['ts_owner']); |
609 | 608 | #if ($GLOBALS['egw']->accounts->get_type($query['col_filter']['ts_owner']) == 'g') $GLOBALS['egw_info']['flags']['app_header'] .= ' '. lang("and its members"); |
610 | 609 | #_debug_array($GLOBALS['egw']->accounts->members($query['col_filter']['ts_owner'],true)); |
611 | - if ($query['col_filter']['ts_owner']<0) $query['col_filter']['ts_owner'] = array_merge(array($query['col_filter']['ts_owner']),$GLOBALS['egw']->accounts->members($query['col_filter']['ts_owner'],true)); |
|
610 | + if ($query['col_filter']['ts_owner'] < 0) $query['col_filter']['ts_owner'] = array_merge(array($query['col_filter']['ts_owner']), $GLOBALS['egw']->accounts->members($query['col_filter']['ts_owner'], true)); |
|
612 | 611 | } |
613 | 612 | else |
614 | 613 | { |
@@ -621,51 +620,51 @@ discard block |
||
621 | 620 | // generate a meaningful app-header / report title |
622 | 621 | if ($this->show_sums['month']) |
623 | 622 | { |
624 | - if ((int)$start[1] == 1 && (int) $end[1] == 12) // whole year(s) |
|
623 | + if ((int)$start[1] == 1 && (int)$end[1] == 12) // whole year(s) |
|
625 | 624 | { |
626 | - $GLOBALS['egw_info']['flags']['app_header'] .= ': ' . $start[0] . ($start[0] != $end[0] ? ' - '.$end[0] : ''); |
|
625 | + $GLOBALS['egw_info']['flags']['app_header'] .= ': '.$start[0].($start[0] != $end[0] ? ' - '.$end[0] : ''); |
|
627 | 626 | } |
628 | 627 | else |
629 | 628 | { |
630 | - $GLOBALS['egw_info']['flags']['app_header'] .= ': ' . lang(date('F',$query['startdate']+12*60*60)) . ' ' . $start[0]; |
|
629 | + $GLOBALS['egw_info']['flags']['app_header'] .= ': '.lang(date('F', $query['startdate'] + 12 * 60 * 60)).' '.$start[0]; |
|
631 | 630 | if ($start[0] != $end[0] || $start[1] != $end[1]) |
632 | 631 | { |
633 | - $GLOBALS['egw_info']['flags']['app_header'] .= ' - ' . lang(date('F',$query['enddate']+12*60*60)) . ' ' . $end[0]; |
|
632 | + $GLOBALS['egw_info']['flags']['app_header'] .= ' - '.lang(date('F', $query['enddate'] + 12 * 60 * 60)).' '.$end[0]; |
|
634 | 633 | } |
635 | 634 | } |
636 | 635 | } |
637 | 636 | elseif ($this->show_sums['week']) |
638 | 637 | { |
639 | - $GLOBALS['egw_info']['flags']['app_header'] .= ': ' . lang('week') . ' ' . date('W',$query['startdate']+36*60*60) . '/' . $start[0]; |
|
640 | - if ($query['enddate'] && $query['enddate'] - $query['startdate'] > 10*24*60*60) |
|
638 | + $GLOBALS['egw_info']['flags']['app_header'] .= ': '.lang('week').' '.date('W', $query['startdate'] + 36 * 60 * 60).'/'.$start[0]; |
|
639 | + if ($query['enddate'] && $query['enddate'] - $query['startdate'] > 10 * 24 * 60 * 60) |
|
641 | 640 | { |
642 | - $GLOBALS['egw_info']['flags']['app_header'] .= ' - ' . date('W',$query['enddate']-36*60*60) . '/' . $end[0]; |
|
641 | + $GLOBALS['egw_info']['flags']['app_header'] .= ' - '.date('W', $query['enddate'] - 36 * 60 * 60).'/'.$end[0]; |
|
643 | 642 | } |
644 | 643 | } |
645 | 644 | elseif ($query['startdate']) |
646 | 645 | { |
647 | 646 | $df = $GLOBALS['egw_info']['user']['preferences']['common']['dateformat']; |
648 | - $GLOBALS['egw_info']['flags']['app_header'] .= ': ' . common::show_date($query['startdate']+12*60*60,$df,false); |
|
647 | + $GLOBALS['egw_info']['flags']['app_header'] .= ': '.common::show_date($query['startdate'] + 12 * 60 * 60, $df, false); |
|
649 | 648 | if ($start != $end) |
650 | 649 | { |
651 | - $GLOBALS['egw_info']['flags']['app_header'] .= ' - '.common::show_date($query['enddate']+12*60*60,$df,false); |
|
650 | + $GLOBALS['egw_info']['flags']['app_header'] .= ' - '.common::show_date($query['enddate'] + 12 * 60 * 60, $df, false); |
|
652 | 651 | } |
653 | 652 | } |
654 | 653 | } |
655 | - $total = parent::get_rows($query,$rows,$readonlys); |
|
654 | + $total = parent::get_rows($query, $rows, $readonlys); |
|
656 | 655 | |
657 | 656 | $ids = array(); |
658 | - foreach($rows as &$row) |
|
657 | + foreach ($rows as &$row) |
|
659 | 658 | { |
660 | 659 | if ($row['ts_id'] > 0) $ids[] = $row['ts_id']; |
661 | 660 | } |
662 | 661 | if ($id_only) |
663 | 662 | { |
664 | 663 | $rows = $ids; |
665 | - return $this->total; // no need to set other fields or $readonlys |
|
664 | + return $this->total; // no need to set other fields or $readonlys |
|
666 | 665 | } |
667 | 666 | $links = array(); |
668 | - $links3 = egw_link::get_links_multiple(TIMESHEET_APP,$ids,true,'projectmanager'); // only check for pm links! |
|
667 | + $links3 = egw_link::get_links_multiple(TIMESHEET_APP, $ids, true, 'projectmanager'); // only check for pm links! |
|
669 | 668 | //as the full array is expected, we must supply the missing but needed (since expected further down) information |
670 | 669 | if (is_array($links3)) |
671 | 670 | { |
@@ -685,14 +684,14 @@ discard block |
||
685 | 684 | |
686 | 685 | $readonlys = array(); |
687 | 686 | $have_cats = false; |
688 | - foreach($rows as &$row) |
|
687 | + foreach ($rows as &$row) |
|
689 | 688 | { |
690 | 689 | if ($row['cat_id']) $have_cats = true; |
691 | 690 | |
692 | 691 | $row['class'] = 'row'; |
693 | 692 | if ($row['ts_id'] <= 0) // sums |
694 | 693 | { |
695 | - if ($query['sort'] == 'ASC') $row['ts_start'] -= 7200; // fix for DSL change |
|
694 | + if ($query['sort'] == 'ASC') $row['ts_start'] -= 7200; // fix for DSL change |
|
696 | 695 | |
697 | 696 | // Remove fake modified date, it breaks nextmatch checks |
698 | 697 | unset($row['ts_modified']); |
@@ -700,23 +699,23 @@ discard block |
||
700 | 699 | // Set flag to avoid actions on these rows |
701 | 700 | $row['no_actions'] = true; |
702 | 701 | |
703 | - switch($row['ts_id']) |
|
702 | + switch ($row['ts_id']) |
|
704 | 703 | { |
705 | 704 | case 0: // day-sum |
706 | - $row['ts_title'] = lang('Sum %1:',lang(date('l',$row['ts_start'])).' '.common::show_date($row['ts_start'], |
|
707 | - $GLOBALS['egw_info']['user']['preferences']['common']['dateformat'],false)); |
|
705 | + $row['ts_title'] = lang('Sum %1:', lang(date('l', $row['ts_start'])).' '.common::show_date($row['ts_start'], |
|
706 | + $GLOBALS['egw_info']['user']['preferences']['common']['dateformat'], false)); |
|
708 | 707 | $row['ts_id'] = 'sum-day-'.$row['ts_start']; |
709 | 708 | break; |
710 | 709 | case -1: // week-sum |
711 | - $row['ts_title'] = lang('Sum %1:',lang('week').' '.substr($row['ts_week'],4).'/'.substr($row['ts_week'],0,4)); |
|
710 | + $row['ts_title'] = lang('Sum %1:', lang('week').' '.substr($row['ts_week'], 4).'/'.substr($row['ts_week'], 0, 4)); |
|
712 | 711 | $row['ts_id'] = 'sum-week-'.$row['ts_week']; |
713 | 712 | break; |
714 | 713 | case -2: // month-sum |
715 | - $row['ts_title'] = lang('Sum %1:',lang(date('F',$row['ts_start'])).' '.substr($row['ts_month'],0,4)); |
|
714 | + $row['ts_title'] = lang('Sum %1:', lang(date('F', $row['ts_start'])).' '.substr($row['ts_month'], 0, 4)); |
|
716 | 715 | $row['ts_id'] = 'sum-month-'.$row['ts_month']; |
717 | 716 | break; |
718 | 717 | case -3: // year-sum |
719 | - $row['ts_title'] = lang('Sum %1:',$row['ts_year']); |
|
718 | + $row['ts_title'] = lang('Sum %1:', $row['ts_year']); |
|
720 | 719 | $row['ts_id'] = 'sum-year-'.$row['ts_year']; |
721 | 720 | break; |
722 | 721 | } |
@@ -726,11 +725,11 @@ discard block |
||
726 | 725 | $row['titleClass'] = 'timesheet_titleSum'; |
727 | 726 | continue; |
728 | 727 | } |
729 | - if($row['ts_quantity']) |
|
728 | + if ($row['ts_quantity']) |
|
730 | 729 | { |
731 | 730 | $row['ts_quantity'] = round($row['ts_quantity'], 2); |
732 | 731 | } |
733 | - if (!$this->check_acl(EGW_ACL_EDIT,$row)) |
|
732 | + if (!$this->check_acl(EGW_ACL_EDIT, $row)) |
|
734 | 733 | { |
735 | 734 | $row['class'] .= ' rowNoEdit '; |
736 | 735 | } |
@@ -738,21 +737,21 @@ discard block |
||
738 | 737 | { |
739 | 738 | $row['class'] .= ' rowNoEdit '; |
740 | 739 | } |
741 | - if (!$this->check_acl(EGW_ACL_DELETE,$row)) |
|
740 | + if (!$this->check_acl(EGW_ACL_DELETE, $row)) |
|
742 | 741 | { |
743 | 742 | $row['class'] .= ' rowNoDelete '; |
744 | 743 | } |
745 | - if($row['ts_status'] != self::DELETED_STATUS) |
|
744 | + if ($row['ts_status'] != self::DELETED_STATUS) |
|
746 | 745 | { |
747 | 746 | $row['class'] .= ' rowNoUndelete '; |
748 | 747 | } |
749 | 748 | if ($query['col_filter']['ts_project']) |
750 | 749 | { |
751 | - unset($row['ts_project']); // dont need or want to show it |
|
750 | + unset($row['ts_project']); // dont need or want to show it |
|
752 | 751 | } |
753 | 752 | elseif ($links[$row['ts_id']]) |
754 | 753 | { |
755 | - foreach($links[$row['ts_id']] as $link) |
|
754 | + foreach ($links[$row['ts_id']] as $link) |
|
756 | 755 | { |
757 | 756 | if ($link['app'] == 'projectmanager') |
758 | 757 | { |
@@ -763,26 +762,26 @@ discard block |
||
763 | 762 | } |
764 | 763 | } |
765 | 764 | |
766 | - if(!$row['titleClass']) $row['titleClass'] = 'timesheet_titleDetails'; |
|
765 | + if (!$row['titleClass']) $row['titleClass'] = 'timesheet_titleDetails'; |
|
767 | 766 | |
768 | 767 | } |
769 | 768 | if (!$have_cats || $query['cat_id']) $rows['no_cat_id'] = true; |
770 | 769 | if ($query['col_filter']['ts_owner']) $rows['ownerClass'] = 'noPrint'; |
771 | 770 | $rows['no_owner_col'] = $query['no_owner_col']; |
772 | - if (!$rows['no_owner_col'] && $query['selectcols'] && !strpos($query['selectcols'],'ts_owner')) $rows['no_owner_col'] = 1; |
|
771 | + if (!$rows['no_owner_col'] && $query['selectcols'] && !strpos($query['selectcols'], 'ts_owner')) $rows['no_owner_col'] = 1; |
|
773 | 772 | if ($query['filter']) |
774 | 773 | { |
775 | 774 | $rows += $this->summary; |
776 | 775 | } |
777 | 776 | $rows['pm_integration'] = $this->pm_integration; |
778 | - $rows['ts_viewtype'] = $rows['no_ts_quantity'] = $rows['no_ts_unitprice'] = $rows['no_ts_total'] = $this->ts_viewtype == 'short'; |
|
777 | + $rows['ts_viewtype'] = $rows['no_ts_quantity'] = $rows['no_ts_unitprice'] = $rows['no_ts_total'] = $this->ts_viewtype == 'short'; |
|
779 | 778 | if (!$rows['ts_viewtype']) |
780 | 779 | { |
781 | 780 | #_debug_array($query['selectcols']); |
782 | 781 | #ts_quantity,ts_unitprice,ts_total |
783 | - if ($query['selectcols'] && strpos($query['selectcols'],'ts_quantity')===false) $rows['no_ts_quantity'] = 1; |
|
784 | - if ($query['selectcols'] && strpos($query['selectcols'],'ts_unitprice')===false) $rows['no_ts_unitprice'] = 1; |
|
785 | - if ($query['selectcols'] && strpos($query['selectcols'],'ts_total')===false) $rows['no_ts_total'] = 1; |
|
782 | + if ($query['selectcols'] && strpos($query['selectcols'], 'ts_quantity') === false) $rows['no_ts_quantity'] = 1; |
|
783 | + if ($query['selectcols'] && strpos($query['selectcols'], 'ts_unitprice') === false) $rows['no_ts_unitprice'] = 1; |
|
784 | + if ($query['selectcols'] && strpos($query['selectcols'], 'ts_total') === false) $rows['no_ts_total'] = 1; |
|
786 | 785 | } |
787 | 786 | $rows['no_ts_status'] = strpos($query['selectcols'], 'ts_status') === false && !$this->config_data['history'] || |
788 | 787 | $query['no_status']; |
@@ -796,7 +795,7 @@ discard block |
||
796 | 795 | * @param array $content |
797 | 796 | * @param string $msg |
798 | 797 | */ |
799 | - function index($content = null,$msg='') |
|
798 | + function index($content = null, $msg = '') |
|
800 | 799 | { |
801 | 800 | $etpl = new etemplate_new('timesheet.index'); |
802 | 801 | |
@@ -833,26 +832,26 @@ discard block |
||
833 | 832 | else |
834 | 833 | { |
835 | 834 | $success = $failed = $action_msg = null; |
836 | - if ($this->action($content['nm']['action'],$content['nm']['selected'],$content['nm']['select_all'], |
|
837 | - $success,$failed,$action_msg,'index',$msg)) |
|
835 | + if ($this->action($content['nm']['action'], $content['nm']['selected'], $content['nm']['select_all'], |
|
836 | + $success, $failed, $action_msg, 'index', $msg)) |
|
838 | 837 | { |
839 | - $msg .= lang('%1 timesheets(s) %2',$success,$action_msg); |
|
838 | + $msg .= lang('%1 timesheets(s) %2', $success, $action_msg); |
|
840 | 839 | } |
841 | - elseif(empty($msg)) |
|
840 | + elseif (empty($msg)) |
|
842 | 841 | { |
843 | - $msg .= lang('%1 timesheets(s) %2, %3 failed because of insufficent rights !!!',$success,$action_msg,$failed); |
|
842 | + $msg .= lang('%1 timesheets(s) %2, %3 failed because of insufficent rights !!!', $success, $action_msg, $failed); |
|
844 | 843 | } |
845 | 844 | } |
846 | 845 | } |
847 | 846 | |
848 | 847 | $content = array( |
849 | - 'nm' => $GLOBALS['egw']->session->appsession('index',TIMESHEET_APP), |
|
848 | + 'nm' => $GLOBALS['egw']->session->appsession('index', TIMESHEET_APP), |
|
850 | 849 | 'msg' => $msg, |
851 | 850 | ); |
852 | 851 | if (!is_array($content['nm'])) |
853 | 852 | { |
854 | 853 | $date_filters = array('All'); |
855 | - foreach(array_keys($this->date_filters) as $name) |
|
854 | + foreach (array_keys($this->date_filters) as $name) |
|
856 | 855 | { |
857 | 856 | $date_filters[$name] = $name; |
858 | 857 | } |
@@ -861,9 +860,9 @@ discard block |
||
861 | 860 | $content['nm'] = array( |
862 | 861 | 'get_rows' => TIMESHEET_APP.'.timesheet_ui.get_rows', |
863 | 862 | 'options-filter' => $date_filters, |
864 | - 'options-filter2' => array('No details','Details'), |
|
865 | - 'order' => 'ts_start',// IO name of the column to sort after (optional for the sortheaders) |
|
866 | - 'sort' => 'DESC',// IO direction of the sort: 'ASC' or 'DESC' |
|
863 | + 'options-filter2' => array('No details', 'Details'), |
|
864 | + 'order' => 'ts_start', // IO name of the column to sort after (optional for the sortheaders) |
|
865 | + 'sort' => 'DESC', // IO direction of the sort: 'ASC' or 'DESC' |
|
867 | 866 | 'header_left' => 'timesheet.index.dates', |
868 | 867 | 'header_row' => 'timesheet.index.add', |
869 | 868 | 'filter_onchange' => "app.timesheet.filter_change();", |
@@ -872,13 +871,13 @@ discard block |
||
872 | 871 | 'row_id' => 'ts_id', |
873 | 872 | 'row_modified' => 'ts_modified', |
874 | 873 | //'actions' => $this->get_actions(), |
875 | - 'default_cols' => '!legacy_actions', // switch legacy actions column and row off by default |
|
874 | + 'default_cols' => '!legacy_actions', // switch legacy actions column and row off by default |
|
876 | 875 | 'pm_integration' => $this->pm_integration, |
877 | 876 | ); |
878 | 877 | } |
879 | 878 | $content['nm']['actions'] = $this->get_actions($content['nm']); |
880 | 879 | |
881 | - if($_GET['search']) |
|
880 | + if ($_GET['search']) |
|
882 | 881 | { |
883 | 882 | $content['nm']['search'] = $_GET['search']; |
884 | 883 | } |
@@ -889,25 +888,25 @@ discard block |
||
889 | 888 | 'ts_owner' => $read_grants, |
890 | 889 | 'pm_id' => array(lang('No project')), |
891 | 890 | 'cat_id' => array(array('value' => '', 'label' => lang('all')), array('value' => 0, 'label'=>lang('None'))), |
892 | - 'ts_status' => $this->status_labels+array(lang('No status')), |
|
891 | + 'ts_status' => $this->status_labels + array(lang('No status')), |
|
893 | 892 | ); |
894 | - if($this->config_data['history']) |
|
893 | + if ($this->config_data['history']) |
|
895 | 894 | { |
896 | 895 | $sel_options['ts_status'][self::DELETED_STATUS] = 'Deleted'; |
897 | 896 | } |
898 | - $content['nm']['no_status'] = count($sel_options['ts_status']) <= 1; // 1 because of 'No status' |
|
899 | - $content['nm']['favorites'] = true; //Enable favorite |
|
897 | + $content['nm']['no_status'] = count($sel_options['ts_status']) <= 1; // 1 because of 'No status' |
|
898 | + $content['nm']['favorites'] = true; //Enable favorite |
|
900 | 899 | |
901 | 900 | if ($this->pm_integration != 'full') |
902 | 901 | { |
903 | - $projects =& $this->query_list('ts_project'); |
|
902 | + $projects = & $this->query_list('ts_project'); |
|
904 | 903 | if (!is_array($projects)) $projects = array(); |
905 | 904 | $sel_options['ts_project'] = $projects + array(lang('No project')); |
906 | 905 | } |
907 | 906 | |
908 | 907 | // dont show [Export] button if app is not availible to the user or we are on php4 |
909 | - $readonlys['export'] = !$GLOBALS['egw_info']['user']['apps']['importexport'] || (int) phpversion() < 5; |
|
910 | - return $etpl->exec(TIMESHEET_APP.'.timesheet_ui.index',$content,$sel_options,$readonlys); |
|
908 | + $readonlys['export'] = !$GLOBALS['egw_info']['user']['apps']['importexport'] || (int)phpversion() < 5; |
|
909 | + return $etpl->exec(TIMESHEET_APP.'.timesheet_ui.index', $content, $sel_options, $readonlys); |
|
911 | 910 | } |
912 | 911 | |
913 | 912 | /** |
@@ -926,7 +925,7 @@ discard block |
||
926 | 925 | 'allowOnMultiple' => false, |
927 | 926 | 'url' => 'menuaction=timesheet.timesheet_ui.edit&ts_id=$id', |
928 | 927 | 'popup' => egw_link::get_registry('timesheet', 'add_popup'), |
929 | - 'group' => $group=1, |
|
928 | + 'group' => $group = 1, |
|
930 | 929 | 'disableClass' => 'th', |
931 | 930 | ), |
932 | 931 | /* |
@@ -954,7 +953,7 @@ discard block |
||
954 | 953 | 'group' => $group, |
955 | 954 | ), |
956 | 955 | 'cat' => etemplate_widget_nextmatch::category_action( |
957 | - 'timesheet',++$group,'Change category','cat_' |
|
956 | + 'timesheet', ++$group, 'Change category', 'cat_' |
|
958 | 957 | ), |
959 | 958 | 'status' => array( |
960 | 959 | 'icon' => 'apply', |
@@ -1006,7 +1005,7 @@ discard block |
||
1006 | 1005 | ); |
1007 | 1006 | } |
1008 | 1007 | // enable additonal edit check for following actions, if they are generally available |
1009 | - foreach(array('cat','status') as $action) |
|
1008 | + foreach (array('cat', 'status') as $action) |
|
1010 | 1009 | { |
1011 | 1010 | if ($actions[$action]['enabled']) |
1012 | 1011 | { |
@@ -1029,27 +1028,27 @@ discard block |
||
1029 | 1028 | * @param string/array $session_name 'index' or 'email', or array with session-data depending if we are in the main list or the popup |
1030 | 1029 | * @return boolean true if all actions succeded, false otherwise |
1031 | 1030 | */ |
1032 | - function action($action,$checked,$use_all,&$success,&$failed,&$action_msg,$session_name,&$msg) |
|
1031 | + function action($action, $checked, $use_all, &$success, &$failed, &$action_msg, $session_name, &$msg) |
|
1033 | 1032 | { |
1034 | 1033 | $success = $failed = 0; |
1035 | 1034 | if ($use_all) |
1036 | 1035 | { |
1037 | 1036 | // get the whole selection |
1038 | - $query = is_array($session_name) ? $session_name : $GLOBALS['egw']->session->appsession($session_name,'timesheet'); |
|
1037 | + $query = is_array($session_name) ? $session_name : $GLOBALS['egw']->session->appsession($session_name, 'timesheet'); |
|
1039 | 1038 | |
1040 | 1039 | if ($use_all) |
1041 | 1040 | { |
1042 | - @set_time_limit(0); // switch off the execution time limit, as it's for big selections to small |
|
1043 | - $query['num_rows'] = -1; // all |
|
1041 | + @set_time_limit(0); // switch off the execution time limit, as it's for big selections to small |
|
1042 | + $query['num_rows'] = -1; // all |
|
1044 | 1043 | $readonlys = null; |
1045 | - $this->get_rows($query,$checked,$readonlys,true); // true = only return the id's |
|
1044 | + $this->get_rows($query, $checked, $readonlys, true); // true = only return the id's |
|
1046 | 1045 | } |
1047 | 1046 | } |
1048 | 1047 | //error_log(__METHOD__."('$action', ".array2string($checked).', '.array2string($use_all).",,, '$session_name')"); |
1049 | 1048 | |
1050 | - if (substr($action,0,9) == 'to_status') |
|
1049 | + if (substr($action, 0, 9) == 'to_status') |
|
1051 | 1050 | { |
1052 | - $to_status = (int)substr($action,10); |
|
1051 | + $to_status = (int)substr($action, 10); |
|
1053 | 1052 | $action = 'to_status'; |
1054 | 1053 | } |
1055 | 1054 | else |
@@ -1058,11 +1057,11 @@ discard block |
||
1058 | 1057 | list($action, $settings) = explode('_', $action, 2); |
1059 | 1058 | } |
1060 | 1059 | |
1061 | - switch($action) |
|
1060 | + switch ($action) |
|
1062 | 1061 | { |
1063 | 1062 | case 'delete': |
1064 | 1063 | $action_msg = lang('deleted'); |
1065 | - foreach((array)$checked as $n => $id) |
|
1064 | + foreach ((array)$checked as $n => $id) |
|
1066 | 1065 | { |
1067 | 1066 | if ($this->delete($id)) |
1068 | 1067 | { |
@@ -1075,10 +1074,10 @@ discard block |
||
1075 | 1074 | } |
1076 | 1075 | break; |
1077 | 1076 | case 'undelete': |
1078 | - $action_msg =lang('recovered'); |
|
1079 | - foreach((array)$checked as $n => $id) |
|
1077 | + $action_msg = lang('recovered'); |
|
1078 | + foreach ((array)$checked as $n => $id) |
|
1080 | 1079 | { |
1081 | - if ($this->set_status($id,'')) |
|
1080 | + if ($this->set_status($id, '')) |
|
1082 | 1081 | { |
1083 | 1082 | $success++; |
1084 | 1083 | } |
@@ -1089,10 +1088,10 @@ discard block |
||
1089 | 1088 | } |
1090 | 1089 | break; |
1091 | 1090 | case 'to_status': |
1092 | - $action_msg =lang('changed status'); |
|
1093 | - foreach((array)$checked as $n => $id) |
|
1091 | + $action_msg = lang('changed status'); |
|
1092 | + foreach ((array)$checked as $n => $id) |
|
1094 | 1093 | { |
1095 | - if ($this->set_status($id,$to_status)) |
|
1094 | + if ($this->set_status($id, $to_status)) |
|
1096 | 1095 | { |
1097 | 1096 | $success++; |
1098 | 1097 | } |
@@ -1105,10 +1104,10 @@ discard block |
||
1105 | 1104 | case 'cat': |
1106 | 1105 | $cat_name = categories::id2name($settings); |
1107 | 1106 | $action_msg = lang('changed category to %1', $cat_name); |
1108 | - foreach((array)$checked as $n => $id) { |
|
1107 | + foreach ((array)$checked as $n => $id) { |
|
1109 | 1108 | $entry = $this->read($id); |
1110 | 1109 | $entry['cat_id'] = $settings; |
1111 | - if($this->save($entry) == 0) |
|
1110 | + if ($this->save($entry) == 0) |
|
1112 | 1111 | { |
1113 | 1112 | $success++; |
1114 | 1113 | } |
@@ -1136,7 +1135,7 @@ discard block |
||
1136 | 1135 | * @param conetnt |
1137 | 1136 | * @param view |
1138 | 1137 | */ |
1139 | - function editstatus($content = null,$msg='') |
|
1138 | + function editstatus($content = null, $msg = '') |
|
1140 | 1139 | { |
1141 | 1140 | // this function requires admin rights |
1142 | 1141 | $GLOBALS['egw_info']['flags']['admin_only'] = true; |
@@ -1147,13 +1146,13 @@ discard block |
||
1147 | 1146 | list($button) = @each($content['button']); |
1148 | 1147 | unset ($content['button']); |
1149 | 1148 | |
1150 | - switch($button) |
|
1149 | + switch ($button) |
|
1151 | 1150 | { |
1152 | 1151 | case 'delete': |
1153 | 1152 | break; |
1154 | 1153 | case 'apply': |
1155 | 1154 | case 'save': |
1156 | - foreach($content['statis'] as &$cat) |
|
1155 | + foreach ($content['statis'] as &$cat) |
|
1157 | 1156 | { |
1158 | 1157 | $id = $cat['id']; |
1159 | 1158 | if (($cat ['name'] !== $this->status_labels_config[$id]) && ($cat ['name'] !== '') || ($cat ['parent'] !== $this->status_labels_config[$id]['parent']) && ($cat ['parent'] !== '')) |
@@ -1167,7 +1166,7 @@ discard block |
||
1167 | 1166 | } |
1168 | 1167 | if ($need_update) |
1169 | 1168 | { |
1170 | - config::save_value('status_labels',$this->status_labels_config,TIMESHEET_APP); |
|
1169 | + config::save_value('status_labels', $this->status_labels_config, TIMESHEET_APP); |
|
1171 | 1170 | $this->config_data = config::read(TIMESHEET_APP); |
1172 | 1171 | $this->load_statuses(); |
1173 | 1172 | $msg .= lang('Status updated.'); |
@@ -1184,7 +1183,7 @@ discard block |
||
1184 | 1183 | if (isset($this->status_labels_config[$id])) |
1185 | 1184 | { |
1186 | 1185 | unset($this->status_labels_config[$id]); |
1187 | - config::save_value('status_labels',$this->status_labels_config,TIMESHEET_APP); |
|
1186 | + config::save_value('status_labels', $this->status_labels_config, TIMESHEET_APP); |
|
1188 | 1187 | unset($this->status_labels[$id]); |
1189 | 1188 | $msg .= lang('Status deleted.'); |
1190 | 1189 | } |
@@ -1193,12 +1192,12 @@ discard block |
||
1193 | 1192 | $i = 1; |
1194 | 1193 | $max_id = 0; |
1195 | 1194 | unset($content['statis']); |
1196 | - foreach($this->status_labels_config as $id => $label) |
|
1195 | + foreach ($this->status_labels_config as $id => $label) |
|
1197 | 1196 | { |
1198 | - $content['statis'][$i]['name']= $label['name']; |
|
1199 | - $content['statis'][$i]['id']= $id; |
|
1200 | - $content['statis'][$i]['parent']= $label['parent']; |
|
1201 | - $content['statis'][$i]['admin']= $label['admin']; |
|
1197 | + $content['statis'][$i]['name'] = $label['name']; |
|
1198 | + $content['statis'][$i]['id'] = $id; |
|
1199 | + $content['statis'][$i]['parent'] = $label['parent']; |
|
1200 | + $content['statis'][$i]['admin'] = $label['admin']; |
|
1202 | 1201 | $i++; |
1203 | 1202 | $max_id = max($id, $max_id); |
1204 | 1203 | } |
@@ -1210,6 +1209,6 @@ discard block |
||
1210 | 1209 | $preserv = $content; |
1211 | 1210 | $sel_options['parent'] = $this->status_labels; |
1212 | 1211 | $etpl = new etemplate_new('timesheet.editstatus'); |
1213 | - $etpl->exec('timesheet.timesheet_ui.editstatus',$content,$sel_options,array(),$preserv); |
|
1212 | + $etpl->exec('timesheet.timesheet_ui.editstatus', $content, $sel_options, array(), $preserv); |
|
1214 | 1213 | } |
1215 | 1214 | } |
@@ -57,7 +57,10 @@ discard block |
||
57 | 57 | $etpl = new etemplate_new('timesheet.edit'); |
58 | 58 | if (!is_array($content)) |
59 | 59 | { |
60 | - if ($_GET['msg']) $msg = strip_tags($_GET['msg']); |
|
60 | + if ($_GET['msg']) |
|
61 | + { |
|
62 | + $msg = strip_tags($_GET['msg']); |
|
63 | + } |
|
61 | 64 | |
62 | 65 | if ($view || (int)$_GET['ts_id']) |
63 | 66 | { |
@@ -110,23 +113,32 @@ discard block |
||
110 | 113 | $content['ts_description'] = $content['ts_description_short']; |
111 | 114 | } |
112 | 115 | // we only need 2 out of 3 values from start-, end-time or duration (the date in ts_start is always required!) |
113 | - if (isset($content['start_time'])) // start-time specified |
|
116 | + if (isset($content['start_time'])) |
|
117 | + { |
|
118 | + // start-time specified |
|
114 | 119 | { |
115 | 120 | //$content['ts_start'] += $content['start_time']; |
116 | 121 | $start = new egw_time($content['ts_start']); |
122 | + } |
|
117 | 123 | $start_time = explode(':',$content['start_time']); |
118 | 124 | $start->setTime($start_time[0],$start_time[1]); |
119 | 125 | $content['ts_start'] = $start->format('ts'); |
120 | 126 | } |
121 | - if (isset($content['end_time'])) // end-time specified |
|
127 | + if (isset($content['end_time'])) |
|
128 | + { |
|
129 | + // end-time specified |
|
122 | 130 | { |
123 | 131 | $end = new egw_time($content['ts_start']); |
132 | + } |
|
124 | 133 | $end_time = explode(':',$content['end_time']); |
125 | 134 | $end->setTime($end_time[0],$end_time[1]); |
126 | 135 | } |
127 | - if ($end && $start) // start- & end-time --> calculate the duration |
|
136 | + if ($end && $start) |
|
137 | + { |
|
138 | + // start- & end-time --> calculate the duration |
|
128 | 139 | { |
129 | 140 | $content['ts_duration'] = ($end->format('ts') - $start->format('ts')) / 60; |
141 | + } |
|
130 | 142 | // check if negative duration is caused by wrap over midnight |
131 | 143 | if ($content['ts_duration'] < 0 && $content['ts_duration'] > -24*60) |
132 | 144 | { |
@@ -134,12 +146,18 @@ discard block |
||
134 | 146 | } |
135 | 147 | //echo "<p>end_time=$content[end_time], start_time=$content[start_time] --> duration=$content[ts_duration]</p>\n"; |
136 | 148 | } |
137 | - elseif ($content['ts_duration'] && $end) // no start, calculate from end and duration |
|
149 | + elseif ($content['ts_duration'] && $end) |
|
150 | + { |
|
151 | + // no start, calculate from end and duration |
|
138 | 152 | { |
139 | 153 | $content['ts_start'] = $end->format('ts') - 60*$content['ts_duration']; |
154 | + } |
|
140 | 155 | //echo "<p>end_time=$content[end_time], duration=$content[ts_duration] --> ts_start=$content[ts_start]=".egw_time::to($content['ts_start'])."</p>\n"; |
141 | 156 | } |
142 | - if ($content['ts_duration'] > 0) unset($content['end_time']); |
|
157 | + if ($content['ts_duration'] > 0) |
|
158 | + { |
|
159 | + unset($content['end_time']); |
|
160 | + } |
|
143 | 161 | // now we only deal with start (date+time) and duration |
144 | 162 | list($button) = @each($content['button']); |
145 | 163 | $view = $content['view']; |
@@ -153,7 +171,10 @@ discard block |
||
153 | 171 | switch($button) |
154 | 172 | { |
155 | 173 | case 'edit': |
156 | - if ($this->check_acl(EGW_ACL_EDIT) && !$only_admin_edit) $view = false; |
|
174 | + if ($this->check_acl(EGW_ACL_EDIT) && !$only_admin_edit) |
|
175 | + { |
|
176 | + $view = false; |
|
177 | + } |
|
157 | 178 | break; |
158 | 179 | |
159 | 180 | case 'undelete': |
@@ -167,12 +188,15 @@ discard block |
||
167 | 188 | case 'save': |
168 | 189 | case 'save_new': |
169 | 190 | case 'apply': |
170 | - if ((!$this->data['ts_quantity'] || $this->ts_viewtype == 'short') && $this->data['ts_duration']) // set the quantity (in h) from the duration (in min) |
|
191 | + if ((!$this->data['ts_quantity'] || $this->ts_viewtype == 'short') && $this->data['ts_duration']) |
|
192 | + { |
|
193 | + // set the quantity (in h) from the duration (in min) |
|
171 | 194 | { |
172 | 195 | // We need to keep the actual value of ts_quantity when we are storing it, as it is used in price calculation |
173 | 196 | // and rounding it causes miscalculation on prices |
174 | 197 | $this->data['ts_quantity'] = $this->data['ts_duration'] / 60.0; |
175 | 198 | } |
199 | + } |
|
176 | 200 | if (!$this->data['ts_quantity']) |
177 | 201 | { |
178 | 202 | $etpl->set_validation_error('ts_quantity',lang('Field must not be empty !!!')); |
@@ -204,7 +228,11 @@ discard block |
||
204 | 228 | unset($content['ts_project_blur']); |
205 | 229 | } |
206 | 230 | } |
207 | - if ($etpl->validation_errors()) break; // the user need to fix the error, before we can save the entry |
|
231 | + if ($etpl->validation_errors()) |
|
232 | + { |
|
233 | + break; |
|
234 | + } |
|
235 | + // the user need to fix the error, before we can save the entry |
|
208 | 236 | |
209 | 237 | // account for changed project --> remove old one from links and add new one |
210 | 238 | if ((int) $this->data['pm_id'] != (int) $this->data['old_pm_id']) |
@@ -248,14 +276,20 @@ discard block |
||
248 | 276 | } |
249 | 277 | } |
250 | 278 | egw_framework::refresh_opener($msg, 'timesheet', $this->data['ts_id'], $content['ts_id'] ? 'edit' : 'add'); |
251 | - if ($button == 'apply') break; |
|
279 | + if ($button == 'apply') |
|
280 | + { |
|
281 | + break; |
|
282 | + } |
|
252 | 283 | if ($button == 'save_new') |
253 | 284 | { |
254 | 285 | $msg .= ', '.lang('creating new entry'); // giving some feedback to the user |
255 | 286 | |
256 | - if (!is_array($content['link_to']['to_id'])) // set links again, so new entry gets the same links as the existing one |
|
287 | + if (!is_array($content['link_to']['to_id'])) |
|
288 | + { |
|
289 | + // set links again, so new entry gets the same links as the existing one |
|
257 | 290 | { |
258 | 291 | $content['link_to']['to_id'] = 0; |
292 | + } |
|
259 | 293 | foreach(egw_link::get_links(TIMESHEET_APP,$this->data['ts_id'],'!'.egw_link::VFS_APPNAME) as $link) |
260 | 294 | { |
261 | 295 | egw_link::link(TIMESHEET_APP,$content['link_to']['to_id'],$link['app'],$link['id'],$link['remark']); |
@@ -318,12 +352,15 @@ discard block |
||
318 | 352 | foreach(is_array($_REQUEST['link_app']) ? $_REQUEST['link_app'] : array($_REQUEST['link_app']) as $n => $link_app) |
319 | 353 | { |
320 | 354 | $link_id = $link_ids[$n]; |
321 | - if (preg_match('/^[a-z_0-9-]+:[:a-z_0-9-]+$/i',$link_app.':'.$link_id)) // gard against XSS |
|
355 | + if (preg_match('/^[a-z_0-9-]+:[:a-z_0-9-]+$/i',$link_app.':'.$link_id)) |
|
356 | + { |
|
357 | + // gard against XSS |
|
322 | 358 | { |
323 | 359 | switch ($link_app) |
324 | 360 | { |
325 | 361 | case 'projectmanager': |
326 | 362 | $links[] = $link_id; |
363 | + } |
|
327 | 364 | // fall-through; |
328 | 365 | default: |
329 | 366 | if(!$n) |
@@ -335,8 +372,14 @@ discard block |
||
335 | 372 | { |
336 | 373 | foreach((array)$set['link_app'] as $i => $l_app) |
337 | 374 | { |
338 | - if (($l_id=$set['link_id'][$i])) egw_link::link(TIMESHEET_APP,$content['link_to']['to_id'],$l_app,$l_id); |
|
339 | - if ($l_app == 'projectmanager') $links[] = $l_id; |
|
375 | + if (($l_id=$set['link_id'][$i])) |
|
376 | + { |
|
377 | + egw_link::link(TIMESHEET_APP,$content['link_to']['to_id'],$l_app,$l_id); |
|
378 | + } |
|
379 | + if ($l_app == 'projectmanager') |
|
380 | + { |
|
381 | + $links[] = $l_id; |
|
382 | + } |
|
340 | 383 | } |
341 | 384 | unset($set['link_app']); |
342 | 385 | unset($set['link_id']); |
@@ -432,8 +475,16 @@ discard block |
||
432 | 475 | $content['ts_viewtype'] = $readonlys['tabs']['notes'] = true; |
433 | 476 | $content['ts_description_short'] = $content['ts_description']; |
434 | 477 | } |
435 | - if (!$this->customfields) $readonlys['tabs']['customfields'] = true; // suppress tab if there are not customfields |
|
436 | - if (!$this->data['ts_id']) $readonlys['tabs']['history'] = true; //suppress history for the first loading without ID |
|
478 | + if (!$this->customfields) |
|
479 | + { |
|
480 | + $readonlys['tabs']['customfields'] = true; |
|
481 | + } |
|
482 | + // suppress tab if there are not customfields |
|
483 | + if (!$this->data['ts_id']) |
|
484 | + { |
|
485 | + $readonlys['tabs']['history'] = true; |
|
486 | + } |
|
487 | + //suppress history for the first loading without ID |
|
437 | 488 | |
438 | 489 | return $etpl->exec(TIMESHEET_APP.'.timesheet_ui.edit',$content,$sel_options,$readonlys,$preserv,2); |
439 | 490 | } |
@@ -446,7 +497,10 @@ discard block |
||
446 | 497 | */ |
447 | 498 | function datetime2time($datetime) |
448 | 499 | { |
449 | - if (!$datetime) return 0; |
|
500 | + if (!$datetime) |
|
501 | + { |
|
502 | + return 0; |
|
503 | + } |
|
450 | 504 | |
451 | 505 | return $datetime - mktime(0,0,0,date('m',$datetime),date('d',$datetime),date('Y',$datetime)); |
452 | 506 | } |
@@ -486,7 +540,10 @@ discard block |
||
486 | 540 | } |
487 | 541 | // show week-sums, if we are week-aligned (show full weeks)? |
488 | 542 | $week_start_day = $GLOBALS['egw_info']['user']['preferences']['calendar']['weekdaystarts']; |
489 | - if (!$week_start_day) $week_start_day = 'Sunday'; |
|
543 | + if (!$week_start_day) |
|
544 | + { |
|
545 | + $week_start_day = 'Sunday'; |
|
546 | + } |
|
490 | 547 | switch($week_start_day) |
491 | 548 | { |
492 | 549 | case 'Sunday': $week_end_day = 'Saturday'; break; |
@@ -508,15 +565,24 @@ discard block |
||
508 | 565 | } |
509 | 566 | } |
510 | 567 | //echo "<p align=right>show_sums=".print_r($this->show_sums,true)."</p>\n"; |
511 | - if (!$id_only && !$query_in['csv_export']) $GLOBALS['egw']->session->appsession('index',TIMESHEET_APP,$query_in); |
|
568 | + if (!$id_only && !$query_in['csv_export']) |
|
569 | + { |
|
570 | + $GLOBALS['egw']->session->appsession('index',TIMESHEET_APP,$query_in); |
|
571 | + } |
|
512 | 572 | |
513 | 573 | // Refresh actions (undelete needs this) |
514 | 574 | $query_in['actions'] = $this->get_actions($query_in); |
515 | 575 | |
516 | 576 | $query = $query_in; // keep the original query |
517 | 577 | |
518 | - if($this->ts_viewtype == 'short') $query_in['options-selectcols'] = array('ts_quantity'=>false,'ts_unitprice'=>false,'ts_total'=>false); |
|
519 | - if ($query['no_status']) $query_in['options-selectcols']['ts_status'] = false; |
|
578 | + if($this->ts_viewtype == 'short') |
|
579 | + { |
|
580 | + $query_in['options-selectcols'] = array('ts_quantity'=>false,'ts_unitprice'=>false,'ts_total'=>false); |
|
581 | + } |
|
582 | + if ($query['no_status']) |
|
583 | + { |
|
584 | + $query_in['options-selectcols']['ts_status'] = false; |
|
585 | + } |
|
520 | 586 | |
521 | 587 | //_debug_array($query['col_filter']); |
522 | 588 | //echo "PM Integration:".$this->pm_integration.'<br>'; |
@@ -529,8 +595,14 @@ discard block |
||
529 | 595 | { |
530 | 596 | //$query['col_filter']['ts_id'] = egw_link::get_links('projectmanager',$query['col_filter']['pm_id'],'timesheet'); |
531 | 597 | $query['col_filter']['ts_id'] = $this->get_ts_links($query['col_filter']['pm_id']); |
532 | - if (empty($query['col_filter']['ts_id'])) $query['col_filter']['ts_id'] = -1; |
|
533 | - if (!$query['col_filter']['ts_id']) $query['col_filter']['ts_id'] = 0; |
|
598 | + if (empty($query['col_filter']['ts_id'])) |
|
599 | + { |
|
600 | + $query['col_filter']['ts_id'] = -1; |
|
601 | + } |
|
602 | + if (!$query['col_filter']['ts_id']) |
|
603 | + { |
|
604 | + $query['col_filter']['ts_id'] = 0; |
|
605 | + } |
|
534 | 606 | } |
535 | 607 | if ((string)$query['col_filter']['pm_id'] != '' && (string)$query['col_filter']['pm_id'] == '0') |
536 | 608 | { |
@@ -594,10 +666,13 @@ discard block |
||
594 | 666 | $cats = $GLOBALS['egw']->categories->return_all_children((int)$query['cat_id']); |
595 | 667 | $query['col_filter']['cat_id'] = count($cats) > 1 ? $cats : $query['cat_id']; |
596 | 668 | } |
597 | - elseif ((string)$query['cat_id'] == '0') // no category |
|
669 | + elseif ((string)$query['cat_id'] == '0') |
|
670 | + { |
|
671 | + // no category |
|
598 | 672 | { |
599 | 673 | $query['col_filter']['cat_id'] = null; |
600 | 674 | } |
675 | + } |
|
601 | 676 | else // all cats --> no filter |
602 | 677 | { |
603 | 678 | unset($query['col_filter']['cat_id']); |
@@ -608,7 +683,10 @@ discard block |
||
608 | 683 | $GLOBALS['egw_info']['flags']['app_header'] .= ': '.common::grab_owner_name($query['col_filter']['ts_owner']); |
609 | 684 | #if ($GLOBALS['egw']->accounts->get_type($query['col_filter']['ts_owner']) == 'g') $GLOBALS['egw_info']['flags']['app_header'] .= ' '. lang("and its members"); |
610 | 685 | #_debug_array($GLOBALS['egw']->accounts->members($query['col_filter']['ts_owner'],true)); |
611 | - if ($query['col_filter']['ts_owner']<0) $query['col_filter']['ts_owner'] = array_merge(array($query['col_filter']['ts_owner']),$GLOBALS['egw']->accounts->members($query['col_filter']['ts_owner'],true)); |
|
686 | + if ($query['col_filter']['ts_owner']<0) |
|
687 | + { |
|
688 | + $query['col_filter']['ts_owner'] = array_merge(array($query['col_filter']['ts_owner']),$GLOBALS['egw']->accounts->members($query['col_filter']['ts_owner'],true)); |
|
689 | + } |
|
612 | 690 | } |
613 | 691 | else |
614 | 692 | { |
@@ -621,10 +699,13 @@ discard block |
||
621 | 699 | // generate a meaningful app-header / report title |
622 | 700 | if ($this->show_sums['month']) |
623 | 701 | { |
624 | - if ((int)$start[1] == 1 && (int) $end[1] == 12) // whole year(s) |
|
702 | + if ((int)$start[1] == 1 && (int) $end[1] == 12) |
|
703 | + { |
|
704 | + // whole year(s) |
|
625 | 705 | { |
626 | 706 | $GLOBALS['egw_info']['flags']['app_header'] .= ': ' . $start[0] . ($start[0] != $end[0] ? ' - '.$end[0] : ''); |
627 | 707 | } |
708 | + } |
|
628 | 709 | else |
629 | 710 | { |
630 | 711 | $GLOBALS['egw_info']['flags']['app_header'] .= ': ' . lang(date('F',$query['startdate']+12*60*60)) . ' ' . $start[0]; |
@@ -657,7 +738,10 @@ discard block |
||
657 | 738 | $ids = array(); |
658 | 739 | foreach($rows as &$row) |
659 | 740 | { |
660 | - if ($row['ts_id'] > 0) $ids[] = $row['ts_id']; |
|
741 | + if ($row['ts_id'] > 0) |
|
742 | + { |
|
743 | + $ids[] = $row['ts_id']; |
|
744 | + } |
|
661 | 745 | } |
662 | 746 | if ($id_only) |
663 | 747 | { |
@@ -687,12 +771,19 @@ discard block |
||
687 | 771 | $have_cats = false; |
688 | 772 | foreach($rows as &$row) |
689 | 773 | { |
690 | - if ($row['cat_id']) $have_cats = true; |
|
774 | + if ($row['cat_id']) |
|
775 | + { |
|
776 | + $have_cats = true; |
|
777 | + } |
|
691 | 778 | |
692 | 779 | $row['class'] = 'row'; |
693 | - if ($row['ts_id'] <= 0) // sums |
|
780 | + if ($row['ts_id'] <= 0) |
|
781 | + { |
|
782 | + // sums |
|
694 | 783 | { |
695 | - if ($query['sort'] == 'ASC') $row['ts_start'] -= 7200; // fix for DSL change |
|
784 | + if ($query['sort'] == 'ASC') $row['ts_start'] -= 7200; |
|
785 | + } |
|
786 | + // fix for DSL change |
|
696 | 787 | |
697 | 788 | // Remove fake modified date, it breaks nextmatch checks |
698 | 789 | unset($row['ts_modified']); |
@@ -721,7 +812,10 @@ discard block |
||
721 | 812 | break; |
722 | 813 | } |
723 | 814 | $row['ts_start'] = $row['ts_unitprice'] = ''; |
724 | - if (!$this->quantity_sum) $row['ts_quantity'] = ''; |
|
815 | + if (!$this->quantity_sum) |
|
816 | + { |
|
817 | + $row['ts_quantity'] = ''; |
|
818 | + } |
|
725 | 819 | $row['class'] = 'th rowNoEdit rowNoDelete rowNoUndelete'; |
726 | 820 | $row['titleClass'] = 'timesheet_titleSum'; |
727 | 821 | continue; |
@@ -763,13 +857,25 @@ discard block |
||
763 | 857 | } |
764 | 858 | } |
765 | 859 | |
766 | - if(!$row['titleClass']) $row['titleClass'] = 'timesheet_titleDetails'; |
|
860 | + if(!$row['titleClass']) |
|
861 | + { |
|
862 | + $row['titleClass'] = 'timesheet_titleDetails'; |
|
863 | + } |
|
767 | 864 | |
768 | 865 | } |
769 | - if (!$have_cats || $query['cat_id']) $rows['no_cat_id'] = true; |
|
770 | - if ($query['col_filter']['ts_owner']) $rows['ownerClass'] = 'noPrint'; |
|
866 | + if (!$have_cats || $query['cat_id']) |
|
867 | + { |
|
868 | + $rows['no_cat_id'] = true; |
|
869 | + } |
|
870 | + if ($query['col_filter']['ts_owner']) |
|
871 | + { |
|
872 | + $rows['ownerClass'] = 'noPrint'; |
|
873 | + } |
|
771 | 874 | $rows['no_owner_col'] = $query['no_owner_col']; |
772 | - if (!$rows['no_owner_col'] && $query['selectcols'] && !strpos($query['selectcols'],'ts_owner')) $rows['no_owner_col'] = 1; |
|
875 | + if (!$rows['no_owner_col'] && $query['selectcols'] && !strpos($query['selectcols'],'ts_owner')) |
|
876 | + { |
|
877 | + $rows['no_owner_col'] = 1; |
|
878 | + } |
|
773 | 879 | if ($query['filter']) |
774 | 880 | { |
775 | 881 | $rows += $this->summary; |
@@ -780,9 +886,18 @@ discard block |
||
780 | 886 | { |
781 | 887 | #_debug_array($query['selectcols']); |
782 | 888 | #ts_quantity,ts_unitprice,ts_total |
783 | - if ($query['selectcols'] && strpos($query['selectcols'],'ts_quantity')===false) $rows['no_ts_quantity'] = 1; |
|
784 | - if ($query['selectcols'] && strpos($query['selectcols'],'ts_unitprice')===false) $rows['no_ts_unitprice'] = 1; |
|
785 | - if ($query['selectcols'] && strpos($query['selectcols'],'ts_total')===false) $rows['no_ts_total'] = 1; |
|
889 | + if ($query['selectcols'] && strpos($query['selectcols'],'ts_quantity')===false) |
|
890 | + { |
|
891 | + $rows['no_ts_quantity'] = 1; |
|
892 | + } |
|
893 | + if ($query['selectcols'] && strpos($query['selectcols'],'ts_unitprice')===false) |
|
894 | + { |
|
895 | + $rows['no_ts_unitprice'] = 1; |
|
896 | + } |
|
897 | + if ($query['selectcols'] && strpos($query['selectcols'],'ts_total')===false) |
|
898 | + { |
|
899 | + $rows['no_ts_total'] = 1; |
|
900 | + } |
|
786 | 901 | } |
787 | 902 | $rows['no_ts_status'] = strpos($query['selectcols'], 'ts_status') === false && !$this->config_data['history'] || |
788 | 903 | $query['no_status']; |
@@ -800,7 +915,10 @@ discard block |
||
800 | 915 | { |
801 | 916 | $etpl = new etemplate_new('timesheet.index'); |
802 | 917 | |
803 | - if ($_GET['msg']) $msg = $_GET['msg']; |
|
918 | + if ($_GET['msg']) |
|
919 | + { |
|
920 | + $msg = $_GET['msg']; |
|
921 | + } |
|
804 | 922 | if ($content['nm']['rows']['delete']) |
805 | 923 | { |
806 | 924 | list($ts_id) = each($content['nm']['rows']['delete']); |
@@ -813,9 +931,12 @@ discard block |
||
813 | 931 | $msg = lang('Error deleting the entry!!!'); |
814 | 932 | } |
815 | 933 | } |
816 | - if (is_array($content) && isset($content['nm']['rows']['document'])) // handle insert in default document button like an action |
|
934 | + if (is_array($content) && isset($content['nm']['rows']['document'])) |
|
935 | + { |
|
936 | + // handle insert in default document button like an action |
|
817 | 937 | { |
818 | 938 | list($id) = @each($content['nm']['rows']['document']); |
939 | + } |
|
819 | 940 | $content['nm']['action'] = 'document'; |
820 | 941 | $content['nm']['selected'] = array($id); |
821 | 942 | } |
@@ -884,7 +1005,10 @@ discard block |
||
884 | 1005 | } |
885 | 1006 | $read_grants = $this->grant_list(EGW_ACL_READ); |
886 | 1007 | $content['nm']['no_owner_col'] = count($read_grants) == 1; |
887 | - if ($GLOBALS['egw_info']['user']['preferences']['timesheet']['nextmatch-timesheet.index.rows']) $content['nm']['selectcols'] = $GLOBALS['egw_info']['user']['preferences']['timesheet']['nextmatch-timesheet.index.rows']; |
|
1008 | + if ($GLOBALS['egw_info']['user']['preferences']['timesheet']['nextmatch-timesheet.index.rows']) |
|
1009 | + { |
|
1010 | + $content['nm']['selectcols'] = $GLOBALS['egw_info']['user']['preferences']['timesheet']['nextmatch-timesheet.index.rows']; |
|
1011 | + } |
|
888 | 1012 | $sel_options = array( |
889 | 1013 | 'ts_owner' => $read_grants, |
890 | 1014 | 'pm_id' => array(lang('No project')), |
@@ -901,7 +1025,10 @@ discard block |
||
901 | 1025 | if ($this->pm_integration != 'full') |
902 | 1026 | { |
903 | 1027 | $projects =& $this->query_list('ts_project'); |
904 | - if (!is_array($projects)) $projects = array(); |
|
1028 | + if (!is_array($projects)) |
|
1029 | + { |
|
1030 | + $projects = array(); |
|
1031 | + } |
|
905 | 1032 | $sel_options['ts_project'] = $projects + array(lang('No project')); |
906 | 1033 | } |
907 | 1034 | |
@@ -1105,7 +1232,8 @@ discard block |
||
1105 | 1232 | case 'cat': |
1106 | 1233 | $cat_name = categories::id2name($settings); |
1107 | 1234 | $action_msg = lang('changed category to %1', $cat_name); |
1108 | - foreach((array)$checked as $n => $id) { |
|
1235 | + foreach((array)$checked as $n => $id) |
|
1236 | + { |
|
1109 | 1237 | $entry = $this->read($id); |
1110 | 1238 | $entry['cat_id'] = $settings; |
1111 | 1239 | if($this->save($entry) == 0) |
@@ -1120,7 +1248,10 @@ discard block |
||
1120 | 1248 | break; |
1121 | 1249 | |
1122 | 1250 | case 'document': |
1123 | - if (!$settings) $settings = $GLOBALS['egw_info']['user']['preferences']['timesheet']['default_document']; |
|
1251 | + if (!$settings) |
|
1252 | + { |
|
1253 | + $settings = $GLOBALS['egw_info']['user']['preferences']['timesheet']['default_document']; |
|
1254 | + } |
|
1124 | 1255 | $document_merge = new timesheet_merge(); |
1125 | 1256 | $msg = $document_merge->download($settings, $checked, '', $GLOBALS['egw_info']['user']['preferences']['timesheet']['document_dir']); |
1126 | 1257 | $failed = count($checked); |
@@ -1172,7 +1303,10 @@ discard block |
||
1172 | 1303 | $this->load_statuses(); |
1173 | 1304 | $msg .= lang('Status updated.'); |
1174 | 1305 | } |
1175 | - if ($button == 'apply') break; |
|
1306 | + if ($button == 'apply') |
|
1307 | + { |
|
1308 | + break; |
|
1309 | + } |
|
1176 | 1310 | // fall-through |
1177 | 1311 | case 'cancel': |
1178 | 1312 | $GLOBALS['egw']->redirect_link('/admin/index.php', null, 'admin'); |
@@ -31,7 +31,7 @@ |
||
31 | 31 | * Create a session or if the user has no account return authenticate header and 401 Unauthorized |
32 | 32 | * |
33 | 33 | * @param array &$account |
34 | - * @return int session-id |
|
34 | + * @return string session-id |
|
35 | 35 | */ |
36 | 36 | function check_access(&$account) |
37 | 37 | { |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | { |
35 | 35 | if (isset($_GET['auth'])) |
36 | 36 | { |
37 | - list($_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW']) = explode(':',base64_decode($_GET['auth']),2); |
|
37 | + list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(':', base64_decode($_GET['auth']), 2); |
|
38 | 38 | } |
39 | 39 | return egw_digest_auth::autocreate_session_callback($account); |
40 | 40 | } |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | 'noheader' => True, |
46 | 46 | 'currentapp' => preg_match('|/webdav.php/apps/([A-Za-z0-9_-]+)/|', $_SERVER['REQUEST_URI'], $matches) ? $matches[1] : 'filemanager', |
47 | 47 | 'autocreate_session_callback' => 'check_access', |
48 | - 'no_exception_handler' => 'basic_auth', // we use a basic auth exception handler (sends exception message as basic auth realm) |
|
49 | - 'auth_realm' => 'EGroupware WebDAV server', // cant use vfs_webdav_server::REALM as autoloading and include path not yet setup! |
|
48 | + 'no_exception_handler' => 'basic_auth', // we use a basic auth exception handler (sends exception message as basic auth realm) |
|
49 | + 'auth_realm' => 'EGroupware WebDAV server', // cant use vfs_webdav_server::REALM as autoloading and include path not yet setup! |
|
50 | 50 | ) |
51 | 51 | ); |
52 | 52 | require_once('phpgwapi/inc/class.egw_digest_auth.inc.php'); |
@@ -20,7 +20,7 @@ |
||
20 | 20 | 'name' => 'Ralf Becker', |
21 | 21 | 'email' => '[email protected]' |
22 | 22 | ); |
23 | -$setup_info['filemanager']['license'] = 'GPL'; |
|
23 | +$setup_info['filemanager']['license'] = 'GPL'; |
|
24 | 24 | |
25 | 25 | /* The hooks this app includes, needed for hooks registration */ |
26 | 26 | $setup_info['filemanager']['hooks']['settings'] = 'filemanager_hooks::settings'; |
@@ -123,7 +123,7 @@ |
||
123 | 123 | } |
124 | 124 | // Custom fields |
125 | 125 | if($content && strpos($content, '#') !== 0) |
126 | - { |
|
126 | + { |
|
127 | 127 | // Expand link-to custom fields |
128 | 128 | $this->cf_link_to_expand($file, $content, $info); |
129 | 129 |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | } |
124 | 124 | // Custom fields |
125 | 125 | if($content && strpos($content, '#') !== 0) |
126 | - { |
|
126 | + { |
|
127 | 127 | // Expand link-to custom fields |
128 | 128 | $this->cf_link_to_expand($file, $content, $info); |
129 | 129 | |
@@ -151,12 +151,14 @@ discard block |
||
151 | 151 | // Try this first - a normal path /apps/appname/id/file |
152 | 152 | list($app, $app_id) = explode('/', substr($file['path'], strpos($file['path'], 'apps/')+5)); |
153 | 153 | // Symlink? |
154 | - if(!$app || !(int)$app_id || !array_key_exists($app, $GLOBALS['egw_info']['user']['apps'])) { |
|
154 | + if(!$app || !(int)$app_id || !array_key_exists($app, $GLOBALS['egw_info']['user']['apps'])) |
|
155 | + { |
|
155 | 156 | // Try resolving just app + ID - /apps/App Name/Record Title/file |
156 | 157 | $resolved = Vfs::resolve_url_symlinks(implode('/',array_slice(explode('/',$file['dir']),0,4))); |
157 | 158 | list($app, $app_id) = explode('/', substr($resolved, strpos($resolved, 'apps/')+5)); |
158 | 159 | |
159 | - if(!$app || !(int)$app_id || !array_key_exists($app, $GLOBALS['egw_info']['user']['apps'])) { |
|
160 | + if(!$app || !(int)$app_id || !array_key_exists($app, $GLOBALS['egw_info']['user']['apps'])) |
|
161 | + { |
|
160 | 162 | // Get rid of any virtual folders (eg: All$) and symlinks |
161 | 163 | $resolved = Vfs::resolve_url_symlinks($file['path']); |
162 | 164 | list($app, $app_id) = explode('/', substr($resolved, strpos($resolved, 'apps/')+5)); |
@@ -190,7 +192,10 @@ discard block |
||
190 | 192 | if(is_array($link)) |
191 | 193 | { |
192 | 194 | // Directories have their internal protocol in path here |
193 | - if($link['path'] && strpos($link['path'], '://') !== false) $link['path'] = $file['path']; |
|
195 | + if($link['path'] && strpos($link['path'], '://') !== false) |
|
196 | + { |
|
197 | + $link['path'] = $file['path']; |
|
198 | + } |
|
194 | 199 | $link = Api\Session::link('/index.php', $link); |
195 | 200 | } |
196 | 201 | else |
@@ -211,7 +216,10 @@ discard block |
||
211 | 216 | // Add markers |
212 | 217 | foreach($file as $key => &$value) |
213 | 218 | { |
214 | - if(!$value) $value = ''; |
|
219 | + if(!$value) |
|
220 | + { |
|
221 | + $value = ''; |
|
222 | + } |
|
215 | 223 | $info['$$'.($prefix ? $prefix.'/':'').$key.'$$'] = $value; |
216 | 224 | } |
217 | 225 | if($app_placeholders) |
@@ -252,9 +260,15 @@ discard block |
||
252 | 260 | ); |
253 | 261 | foreach($fields as $name => $label) |
254 | 262 | { |
255 | - if (!($n&1)) echo '<tr>'; |
|
263 | + if (!($n&1)) |
|
264 | + { |
|
265 | + echo '<tr>'; |
|
266 | + } |
|
256 | 267 | echo '<td>{{'.$name.'}}</td><td>'.lang($label).'</td>'; |
257 | - if ($n&1) echo "</tr>\n"; |
|
268 | + if ($n&1) |
|
269 | + { |
|
270 | + echo "</tr>\n"; |
|
271 | + } |
|
258 | 272 | $n++; |
259 | 273 | } |
260 | 274 |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | { |
57 | 57 | parent::__construct(); |
58 | 58 | |
59 | - if($_dir) |
|
59 | + if ($_dir) |
|
60 | 60 | { |
61 | 61 | $this->dir = $_dir; |
62 | 62 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * @param string &$content=null content to create some replacements only if they are use |
73 | 73 | * @return array|boolean |
74 | 74 | */ |
75 | - protected function get_replacements($id,&$content=null) |
|
75 | + protected function get_replacements($id, &$content = null) |
|
76 | 76 | { |
77 | 77 | if (!($replacements = $this->filemanager_replacements($id, '', $content))) |
78 | 78 | { |
@@ -88,27 +88,27 @@ discard block |
||
88 | 88 | * @param string $prefix='' prefix like eg. 'erole' |
89 | 89 | * @return array|boolean |
90 | 90 | */ |
91 | - public function filemanager_replacements($id,$prefix='', &$content = null) |
|
91 | + public function filemanager_replacements($id, $prefix = '', &$content = null) |
|
92 | 92 | { |
93 | 93 | $info = array(); |
94 | - $file = egw_vfs::lstat($id,true); |
|
94 | + $file = egw_vfs::lstat($id, true); |
|
95 | 95 | |
96 | 96 | $file['mtime'] = egw_time::to($file['mtime']); |
97 | 97 | $file['ctime'] = egw_time::to($file['ctime']); |
98 | 98 | |
99 | 99 | $file['name'] = egw_vfs::basename($id); |
100 | 100 | $file['dir'] = egw_vfs::decodePath(egw_vfs::dirname($id)); |
101 | - $dirlist = explode('/',$file['dir']); |
|
101 | + $dirlist = explode('/', $file['dir']); |
|
102 | 102 | $file['folder'] = array_pop($dirlist); |
103 | - $file['folder_file'] = $file['folder'] . '/'.$file['name']; |
|
103 | + $file['folder_file'] = $file['folder'].'/'.$file['name']; |
|
104 | 104 | $file['path'] = $id; |
105 | 105 | $file['rel_path'] = str_replace($this->dir.'/', '', $id); |
106 | 106 | $file['hsize'] = egw_vfs::hsize($file['size']); |
107 | 107 | $file['mime'] = egw_vfs::mime_content_type($id); |
108 | - $file['gid'] *= -1; // our widgets use negative gid's |
|
108 | + $file['gid'] *= -1; // our widgets use negative gid's |
|
109 | 109 | if (($props = egw_vfs::propfind($id))) |
110 | 110 | { |
111 | - foreach($props as $prop) |
|
111 | + foreach ($props as $prop) |
|
112 | 112 | { |
113 | 113 | $file[$prop['name']] = $prop['val']; |
114 | 114 | } |
@@ -118,22 +118,22 @@ discard block |
||
118 | 118 | $file['symlink'] = egw_vfs::readlink($id); |
119 | 119 | } |
120 | 120 | // Custom fields |
121 | - if($content && strpos($content, '#') !== 0) |
|
121 | + if ($content && strpos($content, '#') !== 0) |
|
122 | 122 | { |
123 | 123 | // Expand link-to custom fields |
124 | 124 | $this->cf_link_to_expand($file, $content, $info); |
125 | 125 | |
126 | - foreach(config::get_customfields('filemanager') as $name => $field) |
|
126 | + foreach (config::get_customfields('filemanager') as $name => $field) |
|
127 | 127 | { |
128 | 128 | // Set any missing custom fields, or the marker will stay |
129 | - if(!$file['#'.$name]) |
|
129 | + if (!$file['#'.$name]) |
|
130 | 130 | { |
131 | 131 | $file['#'.$name] = ''; |
132 | 132 | continue; |
133 | 133 | } |
134 | 134 | |
135 | 135 | // Format date cfs per user preferences |
136 | - if($field['type'] == 'date' || $field['type'] == 'date-time') |
|
136 | + if ($field['type'] == 'date' || $field['type'] == 'date-time') |
|
137 | 137 | { |
138 | 138 | $this->date_fields[] = '#'.$name; |
139 | 139 | $file['#'.$name] = egw_time::to($file['#'.$name], $field['type'] == 'date' ? true : ''); |
@@ -142,51 +142,51 @@ discard block |
||
142 | 142 | } |
143 | 143 | |
144 | 144 | // If in apps folder, try for app-specific placeholders |
145 | - if($dirlist[1] == 'apps' && count($dirlist) > 1) |
|
145 | + if ($dirlist[1] == 'apps' && count($dirlist) > 1) |
|
146 | 146 | { |
147 | 147 | // Try this first - a normal path /apps/appname/id/file |
148 | - list($app, $app_id) = explode('/', substr($file['path'], strpos($file['path'], 'apps/')+5)); |
|
148 | + list($app, $app_id) = explode('/', substr($file['path'], strpos($file['path'], 'apps/') + 5)); |
|
149 | 149 | // Symlink? |
150 | - if(!$app || !(int)$app_id || !array_key_exists($app, $GLOBALS['egw_info']['user']['apps'])) { |
|
150 | + if (!$app || !(int)$app_id || !array_key_exists($app, $GLOBALS['egw_info']['user']['apps'])) { |
|
151 | 151 | // Try resolving just app + ID - /apps/App Name/Record Title/file |
152 | - $resolved = egw_vfs::resolve_url_symlinks(implode('/',array_slice(explode('/',$file['dir']),0,4))); |
|
153 | - list($app, $app_id) = explode('/', substr($resolved, strpos($resolved, 'apps/')+5)); |
|
152 | + $resolved = egw_vfs::resolve_url_symlinks(implode('/', array_slice(explode('/', $file['dir']), 0, 4))); |
|
153 | + list($app, $app_id) = explode('/', substr($resolved, strpos($resolved, 'apps/') + 5)); |
|
154 | 154 | |
155 | - if(!$app || !(int)$app_id || !array_key_exists($app, $GLOBALS['egw_info']['user']['apps'])) { |
|
155 | + if (!$app || !(int)$app_id || !array_key_exists($app, $GLOBALS['egw_info']['user']['apps'])) { |
|
156 | 156 | // Get rid of any virtual folders (eg: All$) and symlinks |
157 | 157 | $resolved = egw_vfs::resolve_url_symlinks($file['path']); |
158 | - list($app, $app_id) = explode('/', substr($resolved, strpos($resolved, 'apps/')+5)); |
|
158 | + list($app, $app_id) = explode('/', substr($resolved, strpos($resolved, 'apps/') + 5)); |
|
159 | 159 | } |
160 | 160 | } |
161 | - if($app && $app_id) |
|
161 | + if ($app && $app_id) |
|
162 | 162 | { |
163 | - if($app && $GLOBALS['egw_info']['user']['apps'][$app]) |
|
163 | + if ($app && $GLOBALS['egw_info']['user']['apps'][$app]) |
|
164 | 164 | { |
165 | 165 | $app_merge = null; |
166 | 166 | try |
167 | 167 | { |
168 | - $classname = $app .'_merge'; |
|
169 | - if(class_exists($classname)) |
|
168 | + $classname = $app.'_merge'; |
|
169 | + if (class_exists($classname)) |
|
170 | 170 | { |
171 | 171 | $app_merge = new $classname(); |
172 | - if($app_merge && method_exists($app_merge, 'get_replacements')) |
|
172 | + if ($app_merge && method_exists($app_merge, 'get_replacements')) |
|
173 | 173 | { |
174 | 174 | $app_placeholders = $app_merge->get_replacements($app_id, $content); |
175 | 175 | } |
176 | 176 | } |
177 | 177 | } |
178 | 178 | // Silently discard & continue |
179 | - catch(Exception $e) { |
|
180 | - unset($e); // not used |
|
179 | + catch (Exception $e) { |
|
180 | + unset($e); // not used |
|
181 | 181 | } |
182 | 182 | } |
183 | 183 | } |
184 | 184 | } |
185 | 185 | $link = egw_link::mime_open($file['url'], $file['mime']); |
186 | - if(is_array($link)) |
|
186 | + if (is_array($link)) |
|
187 | 187 | { |
188 | 188 | // Directories have their internal protocol in path here |
189 | - if($link['path'] && strpos($link['path'], '://') !== false) $link['path'] = $file['path']; |
|
189 | + if ($link['path'] && strpos($link['path'], '://') !== false) $link['path'] = $file['path']; |
|
190 | 190 | $link = egw_session::link('/index.php', $link); |
191 | 191 | } |
192 | 192 | else |
@@ -205,12 +205,12 @@ discard block |
||
205 | 205 | $file['url'] = $link; |
206 | 206 | |
207 | 207 | // Add markers |
208 | - foreach($file as $key => &$value) |
|
208 | + foreach ($file as $key => &$value) |
|
209 | 209 | { |
210 | - if(!$value) $value = ''; |
|
211 | - $info['$$'.($prefix ? $prefix.'/':'').$key.'$$'] = $value; |
|
210 | + if (!$value) $value = ''; |
|
211 | + $info['$$'.($prefix ? $prefix.'/' : '').$key.'$$'] = $value; |
|
212 | 212 | } |
213 | - if($app_placeholders) |
|
213 | + if ($app_placeholders) |
|
214 | 214 | { |
215 | 215 | $info = array_merge($app_placeholders, $info); |
216 | 216 | } |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | 'hsize' => 'Size', |
247 | 247 | 'size' => 'Size (in bytes)', |
248 | 248 | ); |
249 | - foreach($fields as $name => $label) |
|
249 | + foreach ($fields as $name => $label) |
|
250 | 250 | { |
251 | 251 | if (!($n&1)) echo '<tr>'; |
252 | 252 | echo '<td>{{'.$name.'}}</td><td>'.lang($label).'</td>'; |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | } |
256 | 256 | |
257 | 257 | echo '<tr><td colspan="4"><h3>'.lang('Custom fields').":</h3></td></tr>"; |
258 | - foreach(config::get_customfields('filemanager') as $name => $field) |
|
258 | + foreach (config::get_customfields('filemanager') as $name => $field) |
|
259 | 259 | { |
260 | 260 | echo '<tr><td>{{#'.$name.'}}</td><td colspan="3">'.$field['label']."</td></tr>\n"; |
261 | 261 | } |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | echo '<tr><td colspan="4">'.lang('For files linked to an application entry (inside /apps/appname/id/) the placeholders for that application are also available. See the specific application for a list of available placeholders.').'</td></tr>'; |
265 | 265 | |
266 | 266 | echo '<tr><td colspan="4"><h3>'.lang('General fields:')."</h3></td></tr>"; |
267 | - foreach(array( |
|
267 | + foreach (array( |
|
268 | 268 | 'date' => lang('Date'), |
269 | 269 | 'user/n_fn' => lang('Name of current user, all other contact fields are valid too'), |
270 | 270 | 'user/account_lid' => lang('Username'), |
@@ -27,12 +27,12 @@ |
||
27 | 27 | $this->description = lang('This module displays the current month'); |
28 | 28 | } |
29 | 29 | |
30 | - function get_content(&$arguments,$properties) |
|
30 | + function get_content(&$arguments, $properties) |
|
31 | 31 | { |
32 | - $date = (int) (strtotime(get_var('date',array('POST','GET')))); |
|
32 | + $date = (int)(strtotime(get_var('date', array('POST', 'GET')))); |
|
33 | 33 | $redirect = $arguments['redirect'] ? $arguments['redirect'] : '#'; |
34 | 34 | |
35 | 35 | return $GLOBALS['egw']->jscalendar->get_javascript(). |
36 | - $GLOBALS['egw']->jscalendar->flat($redirect,$date); |
|
36 | + $GLOBALS['egw']->jscalendar->flat($redirect, $date); |
|
37 | 37 | } |
38 | 38 | } |
@@ -12,9 +12,9 @@ |
||
12 | 12 | /** |
13 | 13 | * Calendar day selection for sitemgr |
14 | 14 | */ |
15 | -class module_calendar extends Module |
|
15 | +class module_calendar extends Module |
|
16 | 16 | { |
17 | - function module_calendar() |
|
17 | + function module_calendar() |
|
18 | 18 | { |
19 | 19 | $this->arguments = array( |
20 | 20 | 'redirect' => array( |
@@ -15,7 +15,7 @@ |
||
15 | 15 | $setup_info['calendar']['enable'] = 1; |
16 | 16 | $setup_info['calendar']['index'] = 'calendar.calendar_uiviews.index&ajax=true'; |
17 | 17 | |
18 | -$setup_info['calendar']['license'] = 'GPL'; |
|
18 | +$setup_info['calendar']['license'] = 'GPL'; |
|
19 | 19 | $setup_info['calendar']['description'] = |
20 | 20 | 'Powerful group calendar with meeting request system and ACL security.'; |
21 | 21 | $setup_info['calendar']['note'] = |
@@ -37,11 +37,11 @@ |
||
37 | 37 | /* Dependencies for this app to work */ |
38 | 38 | $setup_info['importexport']['depends'][] = array( |
39 | 39 | 'appname' => 'phpgwapi', |
40 | - 'versions' => Array('14.1') |
|
40 | + 'versions' => array('14.1') |
|
41 | 41 | ); |
42 | 42 | $setup_info['importexport']['depends'][] = array( |
43 | 43 | 'appname' => 'etemplate', |
44 | - 'versions' => Array('14.1') |
|
44 | + 'versions' => array('14.1') |
|
45 | 45 | ); |
46 | 46 | |
47 | 47 | // installation checks for importexport |
@@ -1909,7 +1909,7 @@ |
||
1909 | 1909 | WHERE cal_id='.(int)$row['cal_id'].' AND cal_start='.(int)$row['cal_start'],__LINE__,__FILE__); |
1910 | 1910 | } |
1911 | 1911 | |
1912 | - $GLOBALS['egw_setup']->db->query('UPDATE egw_cal_repeats SET recur_interval=1 |
|
1912 | + $GLOBALS['egw_setup']->db->query('UPDATE egw_cal_repeats SET recur_interval=1 |
|
1913 | 1913 | WHERE recur_interval=0',__LINE__,__FILE__); |
1914 | 1914 | |
1915 | 1915 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.007'; |
@@ -1429,13 +1429,18 @@ discard block |
||
1429 | 1429 | function calendar_upgrade1_0_1_008() |
1430 | 1430 | { |
1431 | 1431 | $config_data = Api\Config::read('calendar'); |
1432 | - if (isset($config_data['fields'])) // old custom fields |
|
1432 | + if (isset($config_data['fields'])) |
|
1433 | + { |
|
1434 | + // old custom fields |
|
1433 | 1435 | { |
1434 | 1436 | $customfields = array(); |
1437 | + } |
|
1435 | 1438 | $order = 0; |
1436 | 1439 | foreach($config_data['fields'] as $name => $data) |
1437 | 1440 | { |
1438 | - if ($name{0} == '#' && !$data['disabled']) // real not-disabled custom field |
|
1441 | + if ($name{0} == '#' && !$data['disabled']) |
|
1442 | + { |
|
1443 | + // real not-disabled custom field |
|
1439 | 1444 | { |
1440 | 1445 | $customfields[substr($name,1)] = array( |
1441 | 1446 | 'type' => 'text', |
@@ -1444,6 +1449,7 @@ discard block |
||
1444 | 1449 | 'order' => ($order += 10), |
1445 | 1450 | ); |
1446 | 1451 | } |
1452 | + } |
|
1447 | 1453 | } |
1448 | 1454 | if (count($customfields)) |
1449 | 1455 | { |
@@ -2589,9 +2595,12 @@ discard block |
||
2589 | 2595 | 'cal_recur_date' => $row['cal_recur_date'], |
2590 | 2596 | 'cal_user_type' => 'e', |
2591 | 2597 | $email.'='.$GLOBALS['egw_setup']->db->quote($row['email']), |
2592 | - ), __LINE__, __FILE__, false, 'ORDER BY cal_status', 'calendar') as $user) // order A, T, U, X |
|
2598 | + ), __LINE__, __FILE__, false, 'ORDER BY cal_status', 'calendar') as $user) |
|
2599 | + { |
|
2600 | + // order A, T, U, X |
|
2593 | 2601 | { |
2594 | 2602 | if (strpos($user['email'], '@') !== false && !$n++) continue; |
2603 | + } |
|
2595 | 2604 | $GLOBALS['egw_setup']->db->delete('egw_cal_user', array_intersect_key($user, array_flip(array('cal_id','cal_recur_date','cal_user_type','cal_user_id','cal_status')))); |
2596 | 2605 | } |
2597 | 2606 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | { |
33 | 33 | $GLOBALS['egw_setup']->oProc->query("SELECT account_id FROM $acctstbl WHERE account_lid='".$owner[$i]."'"); |
34 | 34 | $GLOBALS['egw_setup']->oProc->next_record(); |
35 | - $GLOBALS['egw_setup']->oProc->query("UPDATE $table SET $field=".$GLOBALS['egw_setup']->oProc->f('account_id')." WHERE $field='".$owner[$i]."'"); |
|
35 | + $GLOBALS['egw_setup']->oProc->query("update $table SET $field=".$GLOBALS['egw_setup']->oProc->f('account_id')." WHERE $field='".$owner[$i]."'"); |
|
36 | 36 | } |
37 | 37 | } |
38 | 38 | $GLOBALS['egw_setup']->oProc->AlterColumn($table, $field, array('type' => 'int', 'precision' => 4, 'nullable' => false, 'default' => 0)); |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | $db2 = clone($GLOBALS['egw_setup']->db); |
189 | 189 | |
190 | 190 | $GLOBALS['egw_setup']->oProc->CreateTable('calendar_entry', |
191 | - Array( |
|
191 | + array( |
|
192 | 192 | 'fd' => array( |
193 | 193 | 'cal_id' => array('type' => 'auto', 'nullable' => false), |
194 | 194 | 'cal_owner' => array('type' => 'int', 'precision' => 4, 'nullable' => false, 'default' => '0'), |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | $GLOBALS['egw_setup']->oProc->DropTable('webcal_entry'); |
239 | 239 | |
240 | 240 | $GLOBALS['egw_setup']->oProc->CreateTable('calendar_entry_user', |
241 | - Array( |
|
241 | + array( |
|
242 | 242 | 'fd' => array( |
243 | 243 | 'cal_id' => array('type' => 'int', 'precision' => 4, 'nullable' => false, 'default' => '0'), |
244 | 244 | 'cal_login' => array('type' => 'int', 'precision' => 4, 'nullable' => false, 'default' => '0'), |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | $GLOBALS['egw_setup']->oProc->DropTable('webcal_entry_user'); |
269 | 269 | |
270 | 270 | $GLOBALS['egw_setup']->oProc->CreateTable('calendar_entry_repeats', |
271 | - Array( |
|
271 | + array( |
|
272 | 272 | 'fd' => array( |
273 | 273 | 'cal_id' => array('type' => 'int', 'precision' => 4, 'default' => '0', 'nullable' => false), |
274 | 274 | 'cal_type' => array('type' => 'varchar', 'precision' => 20, 'default' => 'daily', 'nullable' => false), |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | } |
311 | 311 | |
312 | 312 | $GLOBALS['egw_setup']->oProc->DropTable('webcal_entry_repeats'); |
313 | - $GLOBALS['egw_setup']->oProc->query("UPDATE {$GLOBALS['egw_setup']->applications_table} SET app_tables='calendar_entry,calendar_entry_user,calendar_entry_repeats' WHERE app_name='calendar'",__LINE__,__FILE__); |
|
313 | + $GLOBALS['egw_setup']->oProc->query("update {$GLOBALS['egw_setup']->applications_table} SET app_tables='calendar_entry,calendar_entry_user,calendar_entry_repeats' WHERE app_name='calendar'",__LINE__,__FILE__); |
|
314 | 314 | |
315 | 315 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.7pre2'; |
316 | 316 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | |
603 | 603 | // calendar_entry => phpgw_cal |
604 | 604 | $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal', |
605 | - Array( |
|
605 | + array( |
|
606 | 606 | 'fd' => array( |
607 | 607 | 'cal_id' => array('type' => 'auto', 'nullable' => False), |
608 | 608 | 'owner' => array('type' => 'int', 'precision' => 8, 'nullable' => False), |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | |
659 | 659 | // calendar_entry_repeats => phpgw_cal_repeats |
660 | 660 | $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_repeats', |
661 | - Array( |
|
661 | + array( |
|
662 | 662 | 'fd' => array( |
663 | 663 | 'cal_id' => array('type' => 'int', 'precision' => 8,'nullable' => False), |
664 | 664 | 'recur_type' => array('type' => 'int', 'precision' => 8,'nullable' => False), |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | function calendar_upgrade0_9_11_003() |
732 | 732 | { |
733 | 733 | $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_holidays', |
734 | - Array( |
|
734 | + array( |
|
735 | 735 | 'fd' => array( |
736 | 736 | 'locale' => array('type' => 'char', 'precision' => 2,'nullable' => False), |
737 | 737 | 'name' => array('type' => 'varchar', 'precision' => 50,'nullable' => False), |
@@ -767,7 +767,7 @@ discard block |
||
767 | 767 | { |
768 | 768 | $GLOBALS['egw_setup']->oProc->DropTable('phpgw_cal_holidays'); |
769 | 769 | $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_holidays', |
770 | - Array( |
|
770 | + array( |
|
771 | 771 | 'fd' => array( |
772 | 772 | 'hol_id' => array('type' => 'auto','nullable' => False), |
773 | 773 | 'locale' => array('type' => 'char', 'precision' => 2,'nullable' => False), |
@@ -854,7 +854,7 @@ discard block |
||
854 | 854 | function calendar_upgrade0_9_13_003() |
855 | 855 | { |
856 | 856 | $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_alarm', |
857 | - Array( |
|
857 | + array( |
|
858 | 858 | 'fd' => array( |
859 | 859 | 'alarm_id' => array('type' => 'auto','nullable' => False), |
860 | 860 | 'cal_id' => array('type' => 'int', 'precision' => 8, 'nullable' => False), |
@@ -888,7 +888,7 @@ discard block |
||
888 | 888 | |
889 | 889 | function calendar_upgrade0_9_13_005() |
890 | 890 | { |
891 | - $calendar_data = Array(); |
|
891 | + $calendar_data = array(); |
|
892 | 892 | $GLOBALS['egw_setup']->oProc->query('SELECT cal_id, category FROM phpgw_cal',__LINE__,__FILE__); |
893 | 893 | while($GLOBALS['egw_setup']->oProc->next_record()) |
894 | 894 | { |
@@ -7,6 +7,8 @@ discard block |
||
7 | 7 | * @author Ralf Becker <RalfBecker-AT-outdoor-training.de> |
8 | 8 | * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License |
9 | 9 | * @version $Id$ |
10 | + * @param string $table |
|
11 | + * @param string $field |
|
10 | 12 | */ |
11 | 13 | |
12 | 14 | function calendar_v0_9_2to0_9_3update_owner($table, $field) |
@@ -2304,7 +2306,7 @@ discard block |
||
2304 | 2306 | * |
2305 | 2307 | * Also fix recurring events containing a reference to an other master, created when an exception is made a recurring event. |
2306 | 2308 | * |
2307 | - * @return type |
|
2309 | + * @return string |
|
2308 | 2310 | */ |
2309 | 2311 | function calendar_upgrade14_1() |
2310 | 2312 | { |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | { |
19 | 19 | $owner[count($owner)] = $GLOBALS['egw_setup']->oProc->f($field); |
20 | 20 | } |
21 | - if($GLOBALS['egw_setup']->alessthanb($GLOBALS['setup_info']['phpgwapi']['currentver'],'0.9.10pre4')) |
|
21 | + if ($GLOBALS['egw_setup']->alessthanb($GLOBALS['setup_info']['phpgwapi']['currentver'], '0.9.10pre4')) |
|
22 | 22 | { |
23 | 23 | $acctstbl = 'accounts'; |
24 | 24 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | { |
27 | 27 | $acctstbl = 'phpgw_accounts'; |
28 | 28 | } |
29 | - for($i=0;$i<count($owner);$i++) |
|
29 | + for ($i = 0; $i < count($owner); $i++) |
|
30 | 30 | { |
31 | 31 | $GLOBALS['egw_setup']->oProc->query("SELECT account_id FROM $acctstbl WHERE account_lid='".$owner[$i]."'"); |
32 | 32 | $GLOBALS['egw_setup']->oProc->next_record(); |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | |
40 | 40 | function calendar_upgrade0_9_3pre1() |
41 | 41 | { |
42 | - calendar_v0_9_2to0_9_3update_owner('webcal_entry','cal_create_by'); |
|
43 | - calendar_v0_9_2to0_9_3update_owner('webcal_entry_user','cal_login'); |
|
42 | + calendar_v0_9_2to0_9_3update_owner('webcal_entry', 'cal_create_by'); |
|
43 | + calendar_v0_9_2to0_9_3update_owner('webcal_entry_user', 'cal_login'); |
|
44 | 44 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.3pre2'; |
45 | 45 | return $GLOBALS['setup_info']['calendar']['currentver']; |
46 | 46 | } |
@@ -207,12 +207,12 @@ discard block |
||
207 | 207 | ) |
208 | 208 | ); |
209 | 209 | |
210 | - $GLOBALS['egw_setup']->oProc->query('SELECT count(*) FROM webcal_entry',__LINE__,__FILE__); |
|
210 | + $GLOBALS['egw_setup']->oProc->query('SELECT count(*) FROM webcal_entry', __LINE__, __FILE__); |
|
211 | 211 | $GLOBALS['egw_setup']->oProc->next_record(); |
212 | - if($GLOBALS['egw_setup']->oProc->f(0)) |
|
212 | + if ($GLOBALS['egw_setup']->oProc->f(0)) |
|
213 | 213 | { |
214 | - $GLOBALS['egw_setup']->oProc->query('SELECT cal_id,cal_owner,cal_duration,cal_priority,cal_type,cal_access,cal_name,cal_description,cal_id,cal_date,cal_time,cal_mod_date,cal_mod_time FROM webcal_entry ORDER BY cal_id',__LINE__,__FILE__); |
|
215 | - while($GLOBALS['egw_setup']->oProc->next_record()) |
|
214 | + $GLOBALS['egw_setup']->oProc->query('SELECT cal_id,cal_owner,cal_duration,cal_priority,cal_type,cal_access,cal_name,cal_description,cal_id,cal_date,cal_time,cal_mod_date,cal_mod_time FROM webcal_entry ORDER BY cal_id', __LINE__, __FILE__); |
|
215 | + while ($GLOBALS['egw_setup']->oProc->next_record()) |
|
216 | 216 | { |
217 | 217 | $cal_id = $GLOBALS['egw_setup']->oProc->f('cal_id'); |
218 | 218 | $cal_owner = $GLOBALS['egw_setup']->oProc->f('cal_owner'); |
@@ -222,13 +222,13 @@ discard block |
||
222 | 222 | $cal_access = $GLOBALS['egw_setup']->oProc->f('cal_access'); |
223 | 223 | $cal_name = $GLOBALS['egw_setup']->oProc->f('cal_name'); |
224 | 224 | $cal_description = $GLOBALS['egw_setup']->oProc->f('cal_description'); |
225 | - $datetime = mktime(intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_time')),4))),intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_time')),2,2))),intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_time')),0,2))),intval(substr($GLOBALS['egw_setup']->oProc->f('cal_date'),4,2)),intval(substr($GLOBALS['egw_setup']->oProc->f('cal_date'),6,2)),intval(substr($GLOBALS['egw_setup']->oProc->f('cal_date'),0,4))); |
|
226 | - $moddatetime = mktime(intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_mod_time')),4))),intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_mod_time')),2,2))),intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_mod_time')),0,2))),intval(substr($GLOBALS['egw_setup']->oProc->f('cal_mod_date'),4,2)),intval(substr($GLOBALS['egw_setup']->oProc->f('cal_mod_date'),6,2)),intval(substr($GLOBALS['egw_setup']->oProc->f('cal_mod_date'),0,4))); |
|
227 | - $db2->query('SELECT groups FROM webcal_entry_groups WHERE cal_id='.$cal_id,__LINE__,__FILE__); |
|
225 | + $datetime = mktime(intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_time')), 4))), intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_time')), 2, 2))), intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_time')), 0, 2))), intval(substr($GLOBALS['egw_setup']->oProc->f('cal_date'), 4, 2)), intval(substr($GLOBALS['egw_setup']->oProc->f('cal_date'), 6, 2)), intval(substr($GLOBALS['egw_setup']->oProc->f('cal_date'), 0, 4))); |
|
226 | + $moddatetime = mktime(intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_mod_time')), 4))), intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_mod_time')), 2, 2))), intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_mod_time')), 0, 2))), intval(substr($GLOBALS['egw_setup']->oProc->f('cal_mod_date'), 4, 2)), intval(substr($GLOBALS['egw_setup']->oProc->f('cal_mod_date'), 6, 2)), intval(substr($GLOBALS['egw_setup']->oProc->f('cal_mod_date'), 0, 4))); |
|
227 | + $db2->query('SELECT groups FROM webcal_entry_groups WHERE cal_id='.$cal_id, __LINE__, __FILE__); |
|
228 | 228 | $db2->next_record(); |
229 | 229 | $cal_group = $db2->f('groups'); |
230 | 230 | $db2->query('INSERT INTO calendar_entry(cal_id,cal_owner,cal_group,cal_datetime,cal_mdatetime,cal_duration,cal_priority,cal_type,cal_access,cal_name,cal_description) ' |
231 | - .'VALUES('.$cal_id.",'".$cal_owner."','".$cal_group."',".$datetime.",".$moddatetime.",".$cal_duration.",".$cal_priority.",'".$cal_type."','".$cal_access."','".$cal_name."','".$cal_description."')",__LINE__,__FILE__); |
|
231 | + .'VALUES('.$cal_id.",'".$cal_owner."','".$cal_group."',".$datetime.",".$moddatetime.",".$cal_duration.",".$cal_priority.",'".$cal_type."','".$cal_access."','".$cal_name."','".$cal_description."')", __LINE__, __FILE__); |
|
232 | 232 | } |
233 | 233 | } |
234 | 234 | |
@@ -249,17 +249,17 @@ discard block |
||
249 | 249 | ) |
250 | 250 | ); |
251 | 251 | |
252 | - $GLOBALS['egw_setup']->oProc->query('SELECT count(*) FROM webcal_entry_user',__LINE__,__FILE__); |
|
252 | + $GLOBALS['egw_setup']->oProc->query('SELECT count(*) FROM webcal_entry_user', __LINE__, __FILE__); |
|
253 | 253 | $GLOBALS['egw_setup']->oProc->next_record(); |
254 | - if($GLOBALS['egw_setup']->oProc->f(0)) |
|
254 | + if ($GLOBALS['egw_setup']->oProc->f(0)) |
|
255 | 255 | { |
256 | - $GLOBALS['egw_setup']->oProc->query('SELECT cal_id,cal_login,cal_status FROM webcal_entry_user ORDER BY cal_id',__LINE__,__FILE__); |
|
257 | - while($GLOBALS['egw_setup']->oProc->next_record()) |
|
256 | + $GLOBALS['egw_setup']->oProc->query('SELECT cal_id,cal_login,cal_status FROM webcal_entry_user ORDER BY cal_id', __LINE__, __FILE__); |
|
257 | + while ($GLOBALS['egw_setup']->oProc->next_record()) |
|
258 | 258 | { |
259 | 259 | $cal_id = $GLOBALS['egw_setup']->oProc->f('cal_id'); |
260 | 260 | $cal_login = $GLOBALS['egw_setup']->oProc->f('cal_login'); |
261 | 261 | $cal_status = $GLOBALS['egw_setup']->oProc->f('cal_status'); |
262 | - $db2->query('INSERT INTO calendar_entry_user(cal_id,cal_login,cal_status) VALUES('.$cal_id.','.$cal_login.",'".$cal_status."')",__LINE__,__FILE__); |
|
262 | + $db2->query('INSERT INTO calendar_entry_user(cal_id,cal_login,cal_status) VALUES('.$cal_id.','.$cal_login.",'".$cal_status."')", __LINE__, __FILE__); |
|
263 | 263 | } |
264 | 264 | } |
265 | 265 | |
@@ -282,18 +282,18 @@ discard block |
||
282 | 282 | ) |
283 | 283 | ); |
284 | 284 | |
285 | - $GLOBALS['egw_setup']->oProc->query('SELECT count(*) FROM webcal_entry_repeats',__LINE__,__FILE__); |
|
285 | + $GLOBALS['egw_setup']->oProc->query('SELECT count(*) FROM webcal_entry_repeats', __LINE__, __FILE__); |
|
286 | 286 | $GLOBALS['egw_setup']->oProc->next_record(); |
287 | - if($GLOBALS['egw_setup']->oProc->f(0)) |
|
287 | + if ($GLOBALS['egw_setup']->oProc->f(0)) |
|
288 | 288 | { |
289 | - $GLOBALS['egw_setup']->oProc->query('SELECT cal_id,cal_type,cal_end,cal_frequency,cal_days FROM webcal_entry_repeats ORDER BY cal_id',__LINE__,__FILE__); |
|
290 | - while($GLOBALS['egw_setup']->oProc->next_record()) |
|
289 | + $GLOBALS['egw_setup']->oProc->query('SELECT cal_id,cal_type,cal_end,cal_frequency,cal_days FROM webcal_entry_repeats ORDER BY cal_id', __LINE__, __FILE__); |
|
290 | + while ($GLOBALS['egw_setup']->oProc->next_record()) |
|
291 | 291 | { |
292 | 292 | $cal_id = $GLOBALS['egw_setup']->oProc->f('cal_id'); |
293 | 293 | $cal_type = $GLOBALS['egw_setup']->oProc->f('cal_type'); |
294 | - if(isset($GLOBALS['egw_setup']->oProc->Record['cal_end'])) |
|
294 | + if (isset($GLOBALS['egw_setup']->oProc->Record['cal_end'])) |
|
295 | 295 | { |
296 | - $enddate = mktime(0,0,0,intval(substr($GLOBALS['egw_setup']->oProc->f('cal_end'),4,2)),intval(substr($GLOBALS['egw_setup']->oProc->f('cal_end'),6,2)),intval(substr($GLOBALS['egw_setup']->oProc->f('cal_end'),0,4))); |
|
296 | + $enddate = mktime(0, 0, 0, intval(substr($GLOBALS['egw_setup']->oProc->f('cal_end'), 4, 2)), intval(substr($GLOBALS['egw_setup']->oProc->f('cal_end'), 6, 2)), intval(substr($GLOBALS['egw_setup']->oProc->f('cal_end'), 0, 4))); |
|
297 | 297 | $useend = 1; |
298 | 298 | } |
299 | 299 | else |
@@ -303,12 +303,12 @@ discard block |
||
303 | 303 | } |
304 | 304 | $cal_frequency = $GLOBALS['egw_setup']->oProc->f('cal_frequency'); |
305 | 305 | $cal_days = $GLOBALS['egw_setup']->oProc->f('cal_days'); |
306 | - $db2->query('INSERT INTO calendar_entry_repeats(cal_id,cal_type,cal_use_end,cal_end,cal_frequency,cal_days) VALUES('.$cal_id.",'".$cal_type."',".$useend.",".$enddate.",".$cal_frequency.",'".$cal_days."')",__LINE__,__FILE__); |
|
306 | + $db2->query('INSERT INTO calendar_entry_repeats(cal_id,cal_type,cal_use_end,cal_end,cal_frequency,cal_days) VALUES('.$cal_id.",'".$cal_type."',".$useend.",".$enddate.",".$cal_frequency.",'".$cal_days."')", __LINE__, __FILE__); |
|
307 | 307 | } |
308 | 308 | } |
309 | 309 | |
310 | 310 | $GLOBALS['egw_setup']->oProc->DropTable('webcal_entry_repeats'); |
311 | - $GLOBALS['egw_setup']->oProc->query("UPDATE {$GLOBALS['egw_setup']->applications_table} SET app_tables='calendar_entry,calendar_entry_user,calendar_entry_repeats' WHERE app_name='calendar'",__LINE__,__FILE__); |
|
311 | + $GLOBALS['egw_setup']->oProc->query("UPDATE {$GLOBALS['egw_setup']->applications_table} SET app_tables='calendar_entry,calendar_entry_user,calendar_entry_repeats' WHERE app_name='calendar'", __LINE__, __FILE__); |
|
312 | 312 | |
313 | 313 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.7pre2'; |
314 | 314 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -320,19 +320,19 @@ discard block |
||
320 | 320 | $db2 = $GLOBALS['egw_setup']->db; |
321 | 321 | |
322 | 322 | $GLOBALS['egw_setup']->oProc->RenameColumn('calendar_entry', 'cal_duration', 'cal_edatetime'); |
323 | - $GLOBALS['egw_setup']->oProc->query('SELECT cal_id,cal_datetime,cal_owner,cal_edatetime,cal_mdatetime FROM calendar_entry ORDER BY cal_id',__LINE__,__FILE__); |
|
324 | - if($GLOBALS['egw_setup']->oProc->num_rows()) |
|
323 | + $GLOBALS['egw_setup']->oProc->query('SELECT cal_id,cal_datetime,cal_owner,cal_edatetime,cal_mdatetime FROM calendar_entry ORDER BY cal_id', __LINE__, __FILE__); |
|
324 | + if ($GLOBALS['egw_setup']->oProc->num_rows()) |
|
325 | 325 | { |
326 | - while($GLOBALS['egw_setup']->oProc->next_record()) |
|
326 | + while ($GLOBALS['egw_setup']->oProc->next_record()) |
|
327 | 327 | { |
328 | - $db2->query("SELECT preference_value FROM preferences WHERE preference_name='tz_offset' AND preference_appname='common' AND preference_owner=".$GLOBALS['egw_setup']->db->f('cal_owner'),__LINE__,__FILE__); |
|
328 | + $db2->query("SELECT preference_value FROM preferences WHERE preference_name='tz_offset' AND preference_appname='common' AND preference_owner=".$GLOBALS['egw_setup']->db->f('cal_owner'), __LINE__, __FILE__); |
|
329 | 329 | $db2->next_record(); |
330 | 330 | $tz = $db2->f('preference_value'); |
331 | 331 | $cal_id = $GLOBALS['egw_setup']->oProc->f('cal_id'); |
332 | 332 | $datetime = $GLOBALS['egw_setup']->oProc->f('cal_datetime') - ((60 * 60) * $tz); |
333 | 333 | $mdatetime = $GLOBALS['egw_setup']->oProc->f('cal_mdatetime') - ((60 * 60) * $tz); |
334 | 334 | $edatetime = $datetime + (60 * $GLOBALS['egw_setup']->oProc->f('cal_edatetime')); |
335 | - $db2->query('UPDATE calendar_entry SET cal_datetime='.$datetime.', cal_edatetime='.$edatetime.', cal_mdatetime='.$mdatetime.' WHERE cal_id='.$cal_id,__LINE__,__FILE__); |
|
335 | + $db2->query('UPDATE calendar_entry SET cal_datetime='.$datetime.', cal_edatetime='.$edatetime.', cal_mdatetime='.$mdatetime.' WHERE cal_id='.$cal_id, __LINE__, __FILE__); |
|
336 | 336 | } |
337 | 337 | } |
338 | 338 | |
@@ -580,22 +580,22 @@ discard block |
||
580 | 580 | { |
581 | 581 | $db2 = $GLOBALS['egw_setup']->db; |
582 | 582 | |
583 | - if(extension_loaded('mcal') == False) |
|
583 | + if (extension_loaded('mcal') == False) |
|
584 | 584 | { |
585 | - define(RECUR_NONE,0); |
|
586 | - define(RECUR_DAILY,1); |
|
587 | - define(RECUR_WEEKLY,2); |
|
588 | - define(RECUR_MONTHLY_MDAY,3); |
|
589 | - define(RECUR_MONTHLY_WDAY,4); |
|
590 | - define(RECUR_YEARLY,5); |
|
591 | - |
|
592 | - define(M_SUNDAY,1); |
|
593 | - define(M_MONDAY,2); |
|
594 | - define(M_TUESDAY,4); |
|
595 | - define(M_WEDNESDAY,8); |
|
596 | - define(M_THURSDAY,16); |
|
597 | - define(M_FRIDAY,32); |
|
598 | - define(M_SATURDAY,64); |
|
585 | + define(RECUR_NONE, 0); |
|
586 | + define(RECUR_DAILY, 1); |
|
587 | + define(RECUR_WEEKLY, 2); |
|
588 | + define(RECUR_MONTHLY_MDAY, 3); |
|
589 | + define(RECUR_MONTHLY_WDAY, 4); |
|
590 | + define(RECUR_YEARLY, 5); |
|
591 | + |
|
592 | + define(M_SUNDAY, 1); |
|
593 | + define(M_MONDAY, 2); |
|
594 | + define(M_TUESDAY, 4); |
|
595 | + define(M_WEDNESDAY, 8); |
|
596 | + define(M_THURSDAY, 16); |
|
597 | + define(M_FRIDAY, 32); |
|
598 | + define(M_SATURDAY, 64); |
|
599 | 599 | } |
600 | 600 | |
601 | 601 | // calendar_entry => phpgw_cal |
@@ -622,13 +622,13 @@ discard block |
||
622 | 622 | ) |
623 | 623 | ); |
624 | 624 | |
625 | - $GLOBALS['egw_setup']->oProc->query('SELECT * FROM calendar_entry',__LINE__,__FILE__); |
|
626 | - while($GLOBALS['egw_setup']->oProc->next_record()) |
|
625 | + $GLOBALS['egw_setup']->oProc->query('SELECT * FROM calendar_entry', __LINE__, __FILE__); |
|
626 | + while ($GLOBALS['egw_setup']->oProc->next_record()) |
|
627 | 627 | { |
628 | 628 | $id = $GLOBALS['egw_setup']->oProc->f('cal_id'); |
629 | 629 | $owner = $GLOBALS['egw_setup']->oProc->f('cal_owner'); |
630 | 630 | $access = $GLOBALS['egw_setup']->oProc->f('cal_access'); |
631 | - switch($access) |
|
631 | + switch ($access) |
|
632 | 632 | { |
633 | 633 | case 'private': |
634 | 634 | $is_public = 0; |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | $description = $GLOBALS['egw_setup']->oProc->f('cal_description'); |
651 | 651 | |
652 | 652 | $db2->query("INSERT INTO phpgw_cal(cal_id,owner,groups,datetime,mdatetime,edatetime,priority,cal_type,is_public,title,description) " |
653 | - . "VALUES($id,$owner,'$groups',$datetime,$mdatetime,$edatetime,$priority,'$type',$is_public,'$title','$description')",__LINE__,__FILE__); |
|
653 | + . "VALUES($id,$owner,'$groups',$datetime,$mdatetime,$edatetime,$priority,'$type',$is_public,'$title','$description')", __LINE__, __FILE__); |
|
654 | 654 | } |
655 | 655 | $GLOBALS['egw_setup']->oProc->DropTable('calendar_entry'); |
656 | 656 | |
@@ -658,12 +658,12 @@ discard block |
||
658 | 658 | $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_repeats', |
659 | 659 | Array( |
660 | 660 | 'fd' => array( |
661 | - 'cal_id' => array('type' => 'int', 'precision' => 8,'nullable' => False), |
|
662 | - 'recur_type' => array('type' => 'int', 'precision' => 8,'nullable' => False), |
|
663 | - 'recur_use_end' => array('type' => 'int', 'precision' => 8,'nullable' => True), |
|
664 | - 'recur_enddate' => array('type' => 'int', 'precision' => 8,'nullable' => True), |
|
665 | - 'recur_interval' => array('type' => 'int', 'precision' => 8,'nullable' => True,'default' => '1'), |
|
666 | - 'recur_data' => array('type' => 'int', 'precision' => 8,'nullable' => True,'default' => '1') |
|
661 | + 'cal_id' => array('type' => 'int', 'precision' => 8, 'nullable' => False), |
|
662 | + 'recur_type' => array('type' => 'int', 'precision' => 8, 'nullable' => False), |
|
663 | + 'recur_use_end' => array('type' => 'int', 'precision' => 8, 'nullable' => True), |
|
664 | + 'recur_enddate' => array('type' => 'int', 'precision' => 8, 'nullable' => True), |
|
665 | + 'recur_interval' => array('type' => 'int', 'precision' => 8, 'nullable' => True, 'default' => '1'), |
|
666 | + 'recur_data' => array('type' => 'int', 'precision' => 8, 'nullable' => True, 'default' => '1') |
|
667 | 667 | ), |
668 | 668 | 'pk' => array(), |
669 | 669 | 'fk' => array(), |
@@ -671,12 +671,12 @@ discard block |
||
671 | 671 | 'uc' => array() |
672 | 672 | ) |
673 | 673 | ); |
674 | - $GLOBALS['egw_setup']->oProc->query('SELECT * FROM calendar_entry_repeats',__LINE__,__FILE__); |
|
675 | - while($GLOBALS['egw_setup']->oProc->next_record()) |
|
674 | + $GLOBALS['egw_setup']->oProc->query('SELECT * FROM calendar_entry_repeats', __LINE__, __FILE__); |
|
675 | + while ($GLOBALS['egw_setup']->oProc->next_record()) |
|
676 | 676 | { |
677 | 677 | $id = $GLOBALS['egw_setup']->oProc->f('cal_id'); |
678 | 678 | $recur_type = $GLOBALS['egw_setup']->oProc->f('cal_type'); |
679 | - switch($recur_type) |
|
679 | + switch ($recur_type) |
|
680 | 680 | { |
681 | 681 | case 'daily': |
682 | 682 | $recur_type_num = RECUR_DAILY; |
@@ -699,20 +699,20 @@ discard block |
||
699 | 699 | $recur_interval = $GLOBALS['egw_setup']->oProc->f('cal_frequency'); |
700 | 700 | $days = strtoupper($GLOBALS['egw_setup']->oProc->f('cal_days')); |
701 | 701 | $recur_data = 0; |
702 | - $recur_data += (substr($days,0,1)=='Y'?M_SUNDAY:0); |
|
703 | - $recur_data += (substr($days,1,1)=='Y'?M_MONDAY:0); |
|
704 | - $recur_data += (substr($days,2,1)=='Y'?M_TUESDAY:0); |
|
705 | - $recur_data += (substr($days,3,1)=='Y'?M_WEDNESDAY:0); |
|
706 | - $recur_data += (substr($days,4,1)=='Y'?M_THURSDAY:0); |
|
707 | - $recur_data += (substr($days,5,1)=='Y'?M_FRIDAY:0); |
|
708 | - $recur_data += (substr($days,6,1)=='Y'?M_SATURDAY:0); |
|
702 | + $recur_data += (substr($days, 0, 1) == 'Y' ? M_SUNDAY : 0); |
|
703 | + $recur_data += (substr($days, 1, 1) == 'Y' ? M_MONDAY : 0); |
|
704 | + $recur_data += (substr($days, 2, 1) == 'Y' ? M_TUESDAY : 0); |
|
705 | + $recur_data += (substr($days, 3, 1) == 'Y' ? M_WEDNESDAY : 0); |
|
706 | + $recur_data += (substr($days, 4, 1) == 'Y' ? M_THURSDAY : 0); |
|
707 | + $recur_data += (substr($days, 5, 1) == 'Y' ? M_FRIDAY : 0); |
|
708 | + $recur_data += (substr($days, 6, 1) == 'Y' ? M_SATURDAY : 0); |
|
709 | 709 | $db2->query("INSERT INTO phpgw_cal_repeats(cal_id,recur_type,recur_use_end,recur_enddate,recur_interval,recur_data) " |
710 | - . "VALUES($id,$recur_type_num,$recur_use_end,$recur_end,$recur_interval,$recur_data)",__LINE__,__FILE__); |
|
710 | + . "VALUES($id,$recur_type_num,$recur_use_end,$recur_end,$recur_interval,$recur_data)", __LINE__, __FILE__); |
|
711 | 711 | } |
712 | 712 | $GLOBALS['egw_setup']->oProc->DropTable('calendar_entry_repeats'); |
713 | 713 | |
714 | 714 | // calendar_entry_user => phpgw_cal_user |
715 | - $GLOBALS['egw_setup']->oProc->RenameTable('calendar_entry_user','phpgw_cal_user'); |
|
715 | + $GLOBALS['egw_setup']->oProc->RenameTable('calendar_entry_user', 'phpgw_cal_user'); |
|
716 | 716 | |
717 | 717 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.11.002'; |
718 | 718 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -731,11 +731,11 @@ discard block |
||
731 | 731 | $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_holidays', |
732 | 732 | Array( |
733 | 733 | 'fd' => array( |
734 | - 'locale' => array('type' => 'char', 'precision' => 2,'nullable' => False), |
|
735 | - 'name' => array('type' => 'varchar', 'precision' => 50,'nullable' => False), |
|
736 | - 'date_time' => array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0') |
|
734 | + 'locale' => array('type' => 'char', 'precision' => 2, 'nullable' => False), |
|
735 | + 'name' => array('type' => 'varchar', 'precision' => 50, 'nullable' => False), |
|
736 | + 'date_time' => array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0') |
|
737 | 737 | ), |
738 | - 'pk' => array('locale','name'), |
|
738 | + 'pk' => array('locale', 'name'), |
|
739 | 739 | 'fk' => array(), |
740 | 740 | 'ix' => array(), |
741 | 741 | 'uc' => array() |
@@ -767,10 +767,10 @@ discard block |
||
767 | 767 | $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_holidays', |
768 | 768 | Array( |
769 | 769 | 'fd' => array( |
770 | - 'hol_id' => array('type' => 'auto','nullable' => False), |
|
771 | - 'locale' => array('type' => 'char', 'precision' => 2,'nullable' => False), |
|
772 | - 'name' => array('type' => 'varchar', 'precision' => 50,'nullable' => False), |
|
773 | - 'date_time' => array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0') |
|
770 | + 'hol_id' => array('type' => 'auto', 'nullable' => False), |
|
771 | + 'locale' => array('type' => 'char', 'precision' => 2, 'nullable' => False), |
|
772 | + 'name' => array('type' => 'varchar', 'precision' => 50, 'nullable' => False), |
|
773 | + 'date_time' => array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0') |
|
774 | 774 | ), |
775 | 775 | 'pk' => array('hol_id'), |
776 | 776 | 'fk' => array(), |
@@ -787,10 +787,10 @@ discard block |
||
787 | 787 | function calendar_upgrade0_9_11_007() |
788 | 788 | { |
789 | 789 | $GLOBALS['egw_setup']->oProc->query('DELETE FROM phpgw_cal_holidays'); |
790 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays','mday',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); |
|
791 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays','month_num',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); |
|
792 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays','occurence',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); |
|
793 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays','dow',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); |
|
790 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays', 'mday', array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0')); |
|
791 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays', 'month_num', array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0')); |
|
792 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays', 'occurence', array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0')); |
|
793 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays', 'dow', array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0')); |
|
794 | 794 | |
795 | 795 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.11.008'; |
796 | 796 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -807,7 +807,7 @@ discard block |
||
807 | 807 | function calendar_upgrade0_9_11_009() |
808 | 808 | { |
809 | 809 | $GLOBALS['egw_setup']->oProc->query('DELETE FROM phpgw_cal_holidays'); |
810 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays','observance_rule',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); |
|
810 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays', 'observance_rule', array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0')); |
|
811 | 811 | |
812 | 812 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.11.010'; |
813 | 813 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -842,7 +842,7 @@ discard block |
||
842 | 842 | |
843 | 843 | function calendar_upgrade0_9_13_002() |
844 | 844 | { |
845 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal','reference',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); |
|
845 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal', 'reference', array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0')); |
|
846 | 846 | |
847 | 847 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.003'; |
848 | 848 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -854,7 +854,7 @@ discard block |
||
854 | 854 | $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_alarm', |
855 | 855 | Array( |
856 | 856 | 'fd' => array( |
857 | - 'alarm_id' => array('type' => 'auto','nullable' => False), |
|
857 | + 'alarm_id' => array('type' => 'auto', 'nullable' => False), |
|
858 | 858 | 'cal_id' => array('type' => 'int', 'precision' => 8, 'nullable' => False), |
859 | 859 | 'cal_owner' => array('type' => 'int', 'precision' => 8, 'nullable' => False), |
860 | 860 | 'cal_time' => array('type' => 'int', 'precision' => 8, 'nullable' => False), |
@@ -867,8 +867,8 @@ discard block |
||
867 | 867 | ) |
868 | 868 | ); |
869 | 869 | |
870 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal','uid',array('type' => 'varchar', 'precision' => 255,'nullable' => False)); |
|
871 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal','location',array('type' => 'varchar', 'precision' => 255,'nullable' => True)); |
|
870 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal', 'uid', array('type' => 'varchar', 'precision' => 255, 'nullable' => False)); |
|
871 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal', 'location', array('type' => 'varchar', 'precision' => 255, 'nullable' => True)); |
|
872 | 872 | |
873 | 873 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.004'; |
874 | 874 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -877,7 +877,7 @@ discard block |
||
877 | 877 | |
878 | 878 | function calendar_upgrade0_9_13_004() |
879 | 879 | { |
880 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_alarm','alarm_enabled',array('type' => 'int', 'precision' => 4,'nullable' => False, 'default' => '1')); |
|
880 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_alarm', 'alarm_enabled', array('type' => 'int', 'precision' => 4, 'nullable' => False, 'default' => '1')); |
|
881 | 881 | |
882 | 882 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.005'; |
883 | 883 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -887,18 +887,18 @@ discard block |
||
887 | 887 | function calendar_upgrade0_9_13_005() |
888 | 888 | { |
889 | 889 | $calendar_data = Array(); |
890 | - $GLOBALS['egw_setup']->oProc->query('SELECT cal_id, category FROM phpgw_cal',__LINE__,__FILE__); |
|
891 | - while($GLOBALS['egw_setup']->oProc->next_record()) |
|
890 | + $GLOBALS['egw_setup']->oProc->query('SELECT cal_id, category FROM phpgw_cal', __LINE__, __FILE__); |
|
891 | + while ($GLOBALS['egw_setup']->oProc->next_record()) |
|
892 | 892 | { |
893 | 893 | $calendar_data[$GLOBALS['egw_setup']->oProc->f('cal_id')] = $GLOBALS['egw_setup']->oProc->f('category'); |
894 | 894 | } |
895 | 895 | |
896 | - $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_cal','category',array('type' => 'varchar', 'precision' => 30,'nullable' => True)); |
|
896 | + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_cal', 'category', array('type' => 'varchar', 'precision' => 30, 'nullable' => True)); |
|
897 | 897 | |
898 | 898 | @reset($calendar_data); |
899 | - while($calendar_data && list($cal_id,$category) = each($calendar_data)) |
|
899 | + while ($calendar_data && list($cal_id, $category) = each($calendar_data)) |
|
900 | 900 | { |
901 | - $GLOBALS['egw_setup']->oProc->query("UPDATE phpgw_cal SET category='".$category."' WHERE cal_id=".$cal_id,__LINE__,__FILE__); |
|
901 | + $GLOBALS['egw_setup']->oProc->query("UPDATE phpgw_cal SET category='".$category."' WHERE cal_id=".$cal_id, __LINE__, __FILE__); |
|
902 | 902 | } |
903 | 903 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.006'; |
904 | 904 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -907,7 +907,7 @@ discard block |
||
907 | 907 | |
908 | 908 | function calendar_upgrade0_9_13_006() |
909 | 909 | { |
910 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_repeats','recur_exception',array('type' => 'varchar', 'precision' => 255, 'nullable' => True, 'default' => '')); |
|
910 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_repeats', 'recur_exception', array('type' => 'varchar', 'precision' => 255, 'nullable' => True, 'default' => '')); |
|
911 | 911 | |
912 | 912 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.007'; |
913 | 913 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -917,20 +917,20 @@ discard block |
||
917 | 917 | |
918 | 918 | function calendar_upgrade0_9_13_007() |
919 | 919 | { |
920 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_user','cal_type',array( |
|
920 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_user', 'cal_type', array( |
|
921 | 921 | 'type' => 'varchar', |
922 | 922 | 'precision' => '1', |
923 | 923 | 'nullable' => False, |
924 | 924 | 'default' => 'u' |
925 | 925 | )); |
926 | 926 | |
927 | - $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_extra',array( |
|
927 | + $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_extra', array( |
|
928 | 928 | 'fd' => array( |
929 | - 'cal_id' => array('type' => 'int','precision' => '4','nullable' => False), |
|
930 | - 'cal_extra_name' => array('type' => 'varchar','precision' => '40','nullable' => False), |
|
931 | - 'cal_extra_value' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '') |
|
929 | + 'cal_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
930 | + 'cal_extra_name' => array('type' => 'varchar', 'precision' => '40', 'nullable' => False), |
|
931 | + 'cal_extra_value' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '') |
|
932 | 932 | ), |
933 | - 'pk' => array('cal_id','cal_extra_name'), |
|
933 | + 'pk' => array('cal_id', 'cal_extra_name'), |
|
934 | 934 | 'fk' => array(), |
935 | 935 | 'ix' => array(), |
936 | 936 | 'uc' => array() |
@@ -947,7 +947,7 @@ discard block |
||
947 | 947 | function calendar_upgrade0_9_16_001() |
948 | 948 | { |
949 | 949 | // this is to set the default as schema_proc was not setting an empty default |
950 | - $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_cal_user','cal_type',array( |
|
950 | + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_cal_user', 'cal_type', array( |
|
951 | 951 | 'type' => 'varchar', |
952 | 952 | 'precision' => '1', |
953 | 953 | 'nullable' => False, |
@@ -964,15 +964,15 @@ discard block |
||
964 | 964 | |
965 | 965 | function calendar_upgrade0_9_16_002() |
966 | 966 | { |
967 | - $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_repeats',array( |
|
967 | + $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_repeats', array( |
|
968 | 968 | 'fd' => array( |
969 | - 'cal_id' => array('type' => 'int','precision' => '8','nullable' => False), |
|
970 | - 'recur_type' => array('type' => 'int','precision' => '8','nullable' => False), |
|
971 | - 'recur_use_end' => array('type' => 'int','precision' => '8','default' => '0'), |
|
972 | - 'recur_enddate' => array('type' => 'int','precision' => '8'), |
|
973 | - 'recur_interval' => array('type' => 'int','precision' => '8','default' => '1'), |
|
974 | - 'recur_data' => array('type' => 'int','precision' => '8','default' => '1'), |
|
975 | - 'recur_exception' => array('type' => 'varchar','precision' => '255','default' => '') |
|
969 | + 'cal_id' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
970 | + 'recur_type' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
971 | + 'recur_use_end' => array('type' => 'int', 'precision' => '8', 'default' => '0'), |
|
972 | + 'recur_enddate' => array('type' => 'int', 'precision' => '8'), |
|
973 | + 'recur_interval' => array('type' => 'int', 'precision' => '8', 'default' => '1'), |
|
974 | + 'recur_data' => array('type' => 'int', 'precision' => '8', 'default' => '1'), |
|
975 | + 'recur_exception' => array('type' => 'varchar', 'precision' => '255', 'default' => '') |
|
976 | 976 | ), |
977 | 977 | 'pk' => array(), |
978 | 978 | 'fk' => array(), |
@@ -988,14 +988,14 @@ discard block |
||
988 | 988 | |
989 | 989 | function calendar_upgrade0_9_16_003() |
990 | 990 | { |
991 | - $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_user',array( |
|
991 | + $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_user', array( |
|
992 | 992 | 'fd' => array( |
993 | - 'cal_id' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
994 | - 'cal_login' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
995 | - 'cal_status' => array('type' => 'char','precision' => '1','default' => 'A'), |
|
996 | - 'cal_type' => array('type' => 'varchar','precision' => '1','nullable' => False,'default' => 'u') |
|
993 | + 'cal_id' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
994 | + 'cal_login' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
995 | + 'cal_status' => array('type' => 'char', 'precision' => '1', 'default' => 'A'), |
|
996 | + 'cal_type' => array('type' => 'varchar', 'precision' => '1', 'nullable' => False, 'default' => 'u') |
|
997 | 997 | ), |
998 | - 'pk' => array('cal_id','cal_login','cal_type'), |
|
998 | + 'pk' => array('cal_id', 'cal_login', 'cal_type'), |
|
999 | 999 | 'fk' => array(), |
1000 | 1000 | 'ix' => array(), |
1001 | 1001 | 'uc' => array() |
@@ -1009,16 +1009,16 @@ discard block |
||
1009 | 1009 | |
1010 | 1010 | function calendar_upgrade0_9_16_004() |
1011 | 1011 | { |
1012 | - $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_holidays',array( |
|
1012 | + $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_holidays', array( |
|
1013 | 1013 | 'fd' => array( |
1014 | - 'hol_id' => array('type' => 'auto','nullable' => False), |
|
1015 | - 'locale' => array('type' => 'char','precision' => '2','nullable' => False), |
|
1016 | - 'name' => array('type' => 'varchar','precision' => '50','nullable' => False), |
|
1017 | - 'mday' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
1018 | - 'month_num' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
1019 | - 'occurence' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
1020 | - 'dow' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
1021 | - 'observance_rule' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0') |
|
1014 | + 'hol_id' => array('type' => 'auto', 'nullable' => False), |
|
1015 | + 'locale' => array('type' => 'char', 'precision' => '2', 'nullable' => False), |
|
1016 | + 'name' => array('type' => 'varchar', 'precision' => '50', 'nullable' => False), |
|
1017 | + 'mday' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
1018 | + 'month_num' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
1019 | + 'occurence' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
1020 | + 'dow' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
1021 | + 'observance_rule' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0') |
|
1022 | 1022 | ), |
1023 | 1023 | 'pk' => array('hol_id'), |
1024 | 1024 | 'fk' => array(), |
@@ -1036,13 +1036,13 @@ discard block |
||
1036 | 1036 | { |
1037 | 1037 | // creates uid's for all entries which do not have unique ones, they are '[email protected]' |
1038 | 1038 | // very old entries even have an empty uid, see 0.9.16.006 update |
1039 | - $GLOBALS['egw_setup']->oProc->query("SELECT config_name,config_value FROM {$GLOBALS['egw_setup']->config_table} WHERE config_name IN ('install_id','mail_suffix') AND config_app='phpgwapi'",__LINE__,__FILE__); |
|
1039 | + $GLOBALS['egw_setup']->oProc->query("SELECT config_name,config_value FROM {$GLOBALS['egw_setup']->config_table} WHERE config_name IN ('install_id','mail_suffix') AND config_app='phpgwapi'", __LINE__, __FILE__); |
|
1040 | 1040 | while ($GLOBALS['egw_setup']->oProc->next_record()) |
1041 | 1041 | { |
1042 | 1042 | $config[$GLOBALS['egw_setup']->oProc->f(0)] = $GLOBALS['egw_setup']->oProc->f(1); |
1043 | 1043 | } |
1044 | 1044 | $GLOBALS['egw_setup']->oProc->query('UPDATE phpgw_cal SET uid='. |
1045 | - $GLOBALS['egw_setup']->db->concat($GLOBALS['egw_setup']->db->quote('cal-'),'cal_id', |
|
1045 | + $GLOBALS['egw_setup']->db->concat($GLOBALS['egw_setup']->db->quote('cal-'), 'cal_id', |
|
1046 | 1046 | $GLOBALS['egw_setup']->db->quote('-'.$config['install_id'].'@'. |
1047 | 1047 | ($config['mail_suffix'] ? $config['mail_suffix'] : 'local'))). |
1048 | 1048 | " WHERE uid LIKE '-@%' OR uid=''"); |
@@ -1065,7 +1065,7 @@ discard block |
||
1065 | 1065 | function calendar_upgrade0_9_16_007() |
1066 | 1066 | { |
1067 | 1067 | // update the sequenzes for refreshed tables (postgres only) |
1068 | - $GLOBALS['egw_setup']->oProc->UpdateSequence('phpgw_cal_holidays','hol_id'); |
|
1068 | + $GLOBALS['egw_setup']->oProc->UpdateSequence('phpgw_cal_holidays', 'hol_id'); |
|
1069 | 1069 | |
1070 | 1070 | $GLOBALS['setup_info']['calendar']['currentver'] = '1.0.0'; |
1071 | 1071 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -1075,19 +1075,19 @@ discard block |
||
1075 | 1075 | |
1076 | 1076 | function calendar_upgrade1_0_0() |
1077 | 1077 | { |
1078 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','uid','cal_uid'); |
|
1079 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','owner','cal_owner'); |
|
1080 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','category','cal_category'); |
|
1081 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','groups','cal_groups'); |
|
1082 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','datetime','cal_starttime'); |
|
1083 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','mdatetime','cal_modified'); |
|
1084 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','edatetime','cal_endtime'); |
|
1085 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','priority','cal_priority'); |
|
1086 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','is_public','cal_public'); |
|
1087 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','title','cal_title'); |
|
1088 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','description','cal_description'); |
|
1089 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','location','cal_location'); |
|
1090 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','reference','cal_reference'); |
|
1078 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'uid', 'cal_uid'); |
|
1079 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'owner', 'cal_owner'); |
|
1080 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'category', 'cal_category'); |
|
1081 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'groups', 'cal_groups'); |
|
1082 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'datetime', 'cal_starttime'); |
|
1083 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'mdatetime', 'cal_modified'); |
|
1084 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'edatetime', 'cal_endtime'); |
|
1085 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'priority', 'cal_priority'); |
|
1086 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'is_public', 'cal_public'); |
|
1087 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'title', 'cal_title'); |
|
1088 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'description', 'cal_description'); |
|
1089 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'location', 'cal_location'); |
|
1090 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'reference', 'cal_reference'); |
|
1091 | 1091 | |
1092 | 1092 | $GLOBALS['setup_info']['calendar']['currentver'] = '1.0.0.001'; |
1093 | 1093 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -1097,13 +1097,13 @@ discard block |
||
1097 | 1097 | |
1098 | 1098 | function calendar_upgrade1_0_0_001() |
1099 | 1099 | { |
1100 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','locale','hol_locale'); |
|
1101 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','name','hol_name'); |
|
1102 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','mday','hol_mday'); |
|
1103 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','month_num','hol_month_num'); |
|
1104 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','occurence','hol_occurence'); |
|
1105 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','dow','hol_dow'); |
|
1106 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','observance_rule','hol_observance_rule'); |
|
1100 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'locale', 'hol_locale'); |
|
1101 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'name', 'hol_name'); |
|
1102 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'mday', 'hol_mday'); |
|
1103 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'month_num', 'hol_month_num'); |
|
1104 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'occurence', 'hol_occurence'); |
|
1105 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'dow', 'hol_dow'); |
|
1106 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'observance_rule', 'hol_observance_rule'); |
|
1107 | 1107 | |
1108 | 1108 | $GLOBALS['setup_info']['calendar']['currentver'] = '1.0.0.002'; |
1109 | 1109 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -1113,8 +1113,8 @@ discard block |
||
1113 | 1113 | |
1114 | 1114 | function calendar_upgrade1_0_0_002() |
1115 | 1115 | { |
1116 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_user','cal_login','cal_user_id'); |
|
1117 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_user','cal_type','cal_user_type'); |
|
1116 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_user', 'cal_login', 'cal_user_id'); |
|
1117 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_user', 'cal_type', 'cal_user_type'); |
|
1118 | 1118 | |
1119 | 1119 | $GLOBALS['setup_info']['calendar']['currentver'] = '1.0.0.003'; |
1120 | 1120 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -1124,7 +1124,7 @@ discard block |
||
1124 | 1124 | |
1125 | 1125 | function calendar_upgrade1_0_0_003() |
1126 | 1126 | { |
1127 | - $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_cal','cal_title',array( |
|
1127 | + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_cal', 'cal_title', array( |
|
1128 | 1128 | 'type' => 'varchar', |
1129 | 1129 | 'precision' => '255', |
1130 | 1130 | 'nullable' => False, |
@@ -1139,15 +1139,15 @@ discard block |
||
1139 | 1139 | |
1140 | 1140 | function calendar_upgrade1_0_0_004() |
1141 | 1141 | { |
1142 | - $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_repeats',array( |
|
1142 | + $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_repeats', array( |
|
1143 | 1143 | 'fd' => array( |
1144 | - 'cal_id' => array('type' => 'int','precision' => '8','nullable' => False), |
|
1145 | - 'recur_type' => array('type' => 'int','precision' => '8','nullable' => False), |
|
1146 | - 'recur_use_end' => array('type' => 'int','precision' => '8','default' => '0'), |
|
1147 | - 'recur_enddate' => array('type' => 'int','precision' => '8'), |
|
1148 | - 'recur_interval' => array('type' => 'int','precision' => '8','default' => '1'), |
|
1149 | - 'recur_data' => array('type' => 'int','precision' => '8','default' => '1'), |
|
1150 | - 'recur_exception' => array('type' => 'varchar','precision' => '255','default' => '') |
|
1144 | + 'cal_id' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
1145 | + 'recur_type' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
1146 | + 'recur_use_end' => array('type' => 'int', 'precision' => '8', 'default' => '0'), |
|
1147 | + 'recur_enddate' => array('type' => 'int', 'precision' => '8'), |
|
1148 | + 'recur_interval' => array('type' => 'int', 'precision' => '8', 'default' => '1'), |
|
1149 | + 'recur_data' => array('type' => 'int', 'precision' => '8', 'default' => '1'), |
|
1150 | + 'recur_exception' => array('type' => 'varchar', 'precision' => '255', 'default' => '') |
|
1151 | 1151 | ), |
1152 | 1152 | 'pk' => array('cal_id'), |
1153 | 1153 | 'fk' => array(), |
@@ -1164,19 +1164,19 @@ discard block |
||
1164 | 1164 | function calendar_upgrade1_0_0_005() |
1165 | 1165 | { |
1166 | 1166 | // change prefix of all calendar tables to egw_ |
1167 | - foreach(array('cal_user','cal_repeats','cal_extra','cal_holidays','cal') as $name) |
|
1167 | + foreach (array('cal_user', 'cal_repeats', 'cal_extra', 'cal_holidays', 'cal') as $name) |
|
1168 | 1168 | { |
1169 | - $GLOBALS['egw_setup']->oProc->RenameTable('phpgw_'.$name,'egw_'.$name); |
|
1169 | + $GLOBALS['egw_setup']->oProc->RenameTable('phpgw_'.$name, 'egw_'.$name); |
|
1170 | 1170 | } |
1171 | 1171 | |
1172 | 1172 | // create new dates table, with content from the egw_cal table |
1173 | - $GLOBALS['egw_setup']->oProc->CreateTable('egw_cal_dates',array( |
|
1173 | + $GLOBALS['egw_setup']->oProc->CreateTable('egw_cal_dates', array( |
|
1174 | 1174 | 'fd' => array( |
1175 | - 'cal_id' => array('type' => 'int','precision' => '4','nullable' => False), |
|
1176 | - 'cal_start' => array('type' => 'int','precision' => '8','nullable' => False), |
|
1177 | - 'cal_end' => array('type' => 'int','precision' => '8','nullable' => False) |
|
1175 | + 'cal_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
1176 | + 'cal_start' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
1177 | + 'cal_end' => array('type' => 'int', 'precision' => '8', 'nullable' => False) |
|
1178 | 1178 | ), |
1179 | - 'pk' => array('cal_id','cal_start'), |
|
1179 | + 'pk' => array('cal_id', 'cal_start'), |
|
1180 | 1180 | 'fk' => array(), |
1181 | 1181 | 'ix' => array(), |
1182 | 1182 | 'uc' => array() |
@@ -1184,49 +1184,49 @@ discard block |
||
1184 | 1184 | $GLOBALS['egw_setup']->oProc->query("INSERT INTO egw_cal_dates SELECT cal_id,cal_starttime,cal_endtime FROM egw_cal"); |
1185 | 1185 | |
1186 | 1186 | // drop the fields transfered to the dates table |
1187 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal',array( |
|
1187 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal', array( |
|
1188 | 1188 | 'fd' => array( |
1189 | - 'cal_id' => array('type' => 'auto','nullable' => False), |
|
1190 | - 'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False), |
|
1191 | - 'cal_owner' => array('type' => 'int','precision' => '8','nullable' => False), |
|
1192 | - 'cal_category' => array('type' => 'varchar','precision' => '30'), |
|
1193 | - 'cal_groups' => array('type' => 'varchar','precision' => '255'), |
|
1194 | - 'cal_modified' => array('type' => 'int','precision' => '8'), |
|
1195 | - 'cal_endtime' => array('type' => 'int','precision' => '8'), |
|
1196 | - 'cal_priority' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '2'), |
|
1197 | - 'cal_type' => array('type' => 'varchar','precision' => '10'), |
|
1198 | - 'cal_public' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '1'), |
|
1199 | - 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'), |
|
1189 | + 'cal_id' => array('type' => 'auto', 'nullable' => False), |
|
1190 | + 'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False), |
|
1191 | + 'cal_owner' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
1192 | + 'cal_category' => array('type' => 'varchar', 'precision' => '30'), |
|
1193 | + 'cal_groups' => array('type' => 'varchar', 'precision' => '255'), |
|
1194 | + 'cal_modified' => array('type' => 'int', 'precision' => '8'), |
|
1195 | + 'cal_endtime' => array('type' => 'int', 'precision' => '8'), |
|
1196 | + 'cal_priority' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '2'), |
|
1197 | + 'cal_type' => array('type' => 'varchar', 'precision' => '10'), |
|
1198 | + 'cal_public' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '1'), |
|
1199 | + 'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'), |
|
1200 | 1200 | 'cal_description' => array('type' => 'text'), |
1201 | - 'cal_location' => array('type' => 'varchar','precision' => '255'), |
|
1202 | - 'cal_reference' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0') |
|
1201 | + 'cal_location' => array('type' => 'varchar', 'precision' => '255'), |
|
1202 | + 'cal_reference' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0') |
|
1203 | 1203 | ), |
1204 | 1204 | 'pk' => array('cal_id'), |
1205 | 1205 | 'fk' => array(), |
1206 | 1206 | 'ix' => array(), |
1207 | 1207 | 'uc' => array() |
1208 | - ),'cal_starttime'); |
|
1209 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal',array( |
|
1208 | + ), 'cal_starttime'); |
|
1209 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal', array( |
|
1210 | 1210 | 'fd' => array( |
1211 | - 'cal_id' => array('type' => 'auto','nullable' => False), |
|
1212 | - 'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False), |
|
1213 | - 'cal_owner' => array('type' => 'int','precision' => '8','nullable' => False), |
|
1214 | - 'cal_category' => array('type' => 'varchar','precision' => '30'), |
|
1215 | - 'cal_groups' => array('type' => 'varchar','precision' => '255'), |
|
1216 | - 'cal_modified' => array('type' => 'int','precision' => '8'), |
|
1217 | - 'cal_priority' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '2'), |
|
1218 | - 'cal_type' => array('type' => 'varchar','precision' => '10'), |
|
1219 | - 'cal_public' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '1'), |
|
1220 | - 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'), |
|
1211 | + 'cal_id' => array('type' => 'auto', 'nullable' => False), |
|
1212 | + 'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False), |
|
1213 | + 'cal_owner' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
1214 | + 'cal_category' => array('type' => 'varchar', 'precision' => '30'), |
|
1215 | + 'cal_groups' => array('type' => 'varchar', 'precision' => '255'), |
|
1216 | + 'cal_modified' => array('type' => 'int', 'precision' => '8'), |
|
1217 | + 'cal_priority' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '2'), |
|
1218 | + 'cal_type' => array('type' => 'varchar', 'precision' => '10'), |
|
1219 | + 'cal_public' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '1'), |
|
1220 | + 'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'), |
|
1221 | 1221 | 'cal_description' => array('type' => 'text'), |
1222 | - 'cal_location' => array('type' => 'varchar','precision' => '255'), |
|
1223 | - 'cal_reference' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0') |
|
1222 | + 'cal_location' => array('type' => 'varchar', 'precision' => '255'), |
|
1223 | + 'cal_reference' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0') |
|
1224 | 1224 | ), |
1225 | 1225 | 'pk' => array('cal_id'), |
1226 | 1226 | 'fk' => array(), |
1227 | 1227 | 'ix' => array(), |
1228 | 1228 | 'uc' => array() |
1229 | - ),'cal_endtime'); |
|
1229 | + ), 'cal_endtime'); |
|
1230 | 1230 | |
1231 | 1231 | $GLOBALS['setup_info']['calendar']['currentver'] = '1.0.1.001'; |
1232 | 1232 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -1242,15 +1242,15 @@ discard block |
||
1242 | 1242 | 'precision' => '8', |
1243 | 1243 | 'default' => '0' |
1244 | 1244 | ));*/ |
1245 | - $GLOBALS['egw_setup']->oProc->RefreshTable('egw_cal_user',array( |
|
1245 | + $GLOBALS['egw_setup']->oProc->RefreshTable('egw_cal_user', array( |
|
1246 | 1246 | 'fd' => array( |
1247 | - 'cal_id' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
1248 | - 'cal_recur_date' => array('type' => 'int','precision' => '8','default' => '0'), |
|
1249 | - 'cal_user_type' => array('type' => 'varchar','precision' => '1','nullable' => False,'default' => 'u'), |
|
1250 | - 'cal_user_id' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
1251 | - 'cal_status' => array('type' => 'char','precision' => '1','default' => 'A') |
|
1247 | + 'cal_id' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
1248 | + 'cal_recur_date' => array('type' => 'int', 'precision' => '8', 'default' => '0'), |
|
1249 | + 'cal_user_type' => array('type' => 'varchar', 'precision' => '1', 'nullable' => False, 'default' => 'u'), |
|
1250 | + 'cal_user_id' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
1251 | + 'cal_status' => array('type' => 'char', 'precision' => '1', 'default' => 'A') |
|
1252 | 1252 | ), |
1253 | - 'pk' => array('cal_id','cal_recur_date','cal_user_type','cal_user_id'), |
|
1253 | + 'pk' => array('cal_id', 'cal_recur_date', 'cal_user_type', 'cal_user_id'), |
|
1254 | 1254 | 'fk' => array(), |
1255 | 1255 | 'ix' => array(), |
1256 | 1256 | 'uc' => array() |
@@ -1264,50 +1264,50 @@ discard block |
||
1264 | 1264 | |
1265 | 1265 | function calendar_upgrade1_0_1_002() |
1266 | 1266 | { |
1267 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal',array( |
|
1267 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal', array( |
|
1268 | 1268 | 'fd' => array( |
1269 | - 'cal_id' => array('type' => 'auto','nullable' => False), |
|
1270 | - 'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False), |
|
1271 | - 'cal_owner' => array('type' => 'int','precision' => '8','nullable' => False), |
|
1272 | - 'cal_category' => array('type' => 'varchar','precision' => '30'), |
|
1273 | - 'cal_groups' => array('type' => 'varchar','precision' => '255'), |
|
1274 | - 'cal_modified' => array('type' => 'int','precision' => '8'), |
|
1275 | - 'cal_priority' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '2'), |
|
1276 | - 'cal_public' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '1'), |
|
1277 | - 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'), |
|
1269 | + 'cal_id' => array('type' => 'auto', 'nullable' => False), |
|
1270 | + 'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False), |
|
1271 | + 'cal_owner' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
1272 | + 'cal_category' => array('type' => 'varchar', 'precision' => '30'), |
|
1273 | + 'cal_groups' => array('type' => 'varchar', 'precision' => '255'), |
|
1274 | + 'cal_modified' => array('type' => 'int', 'precision' => '8'), |
|
1275 | + 'cal_priority' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '2'), |
|
1276 | + 'cal_public' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '1'), |
|
1277 | + 'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'), |
|
1278 | 1278 | 'cal_description' => array('type' => 'text'), |
1279 | - 'cal_location' => array('type' => 'varchar','precision' => '255'), |
|
1280 | - 'cal_reference' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0') |
|
1279 | + 'cal_location' => array('type' => 'varchar', 'precision' => '255'), |
|
1280 | + 'cal_reference' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0') |
|
1281 | 1281 | ), |
1282 | 1282 | 'pk' => array('cal_id'), |
1283 | 1283 | 'fk' => array(), |
1284 | 1284 | 'ix' => array(), |
1285 | 1285 | 'uc' => array() |
1286 | - ),'cal_type'); |
|
1287 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_owner',array( |
|
1286 | + ), 'cal_type'); |
|
1287 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_owner', array( |
|
1288 | 1288 | 'type' => 'int', |
1289 | 1289 | 'precision' => '4', |
1290 | 1290 | 'nullable' => False |
1291 | 1291 | )); |
1292 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_priority',array( |
|
1292 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_priority', array( |
|
1293 | 1293 | 'type' => 'int', |
1294 | 1294 | 'precision' => '2', |
1295 | 1295 | 'nullable' => False, |
1296 | 1296 | 'default' => '2' |
1297 | 1297 | )); |
1298 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_public',array( |
|
1298 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_public', array( |
|
1299 | 1299 | 'type' => 'int', |
1300 | 1300 | 'precision' => '2', |
1301 | 1301 | 'nullable' => False, |
1302 | 1302 | 'default' => '1' |
1303 | 1303 | )); |
1304 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_reference',array( |
|
1304 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_reference', array( |
|
1305 | 1305 | 'type' => 'int', |
1306 | 1306 | 'precision' => '4', |
1307 | 1307 | 'nullable' => False, |
1308 | 1308 | 'default' => '0' |
1309 | 1309 | )); |
1310 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_modifier',array( |
|
1310 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_modifier', array( |
|
1311 | 1311 | 'type' => 'int', |
1312 | 1312 | 'precision' => '4' |
1313 | 1313 | )); |
@@ -1320,36 +1320,36 @@ discard block |
||
1320 | 1320 | |
1321 | 1321 | function calendar_upgrade1_0_1_003() |
1322 | 1322 | { |
1323 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal_repeats',array( |
|
1323 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal_repeats', array( |
|
1324 | 1324 | 'fd' => array( |
1325 | - 'cal_id' => array('type' => 'int','precision' => '8','nullable' => False), |
|
1326 | - 'recur_type' => array('type' => 'int','precision' => '8','nullable' => False), |
|
1327 | - 'recur_enddate' => array('type' => 'int','precision' => '8'), |
|
1328 | - 'recur_interval' => array('type' => 'int','precision' => '8','default' => '1'), |
|
1329 | - 'recur_data' => array('type' => 'int','precision' => '8','default' => '1'), |
|
1330 | - 'recur_exception' => array('type' => 'varchar','precision' => '255','default' => '') |
|
1325 | + 'cal_id' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
1326 | + 'recur_type' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
1327 | + 'recur_enddate' => array('type' => 'int', 'precision' => '8'), |
|
1328 | + 'recur_interval' => array('type' => 'int', 'precision' => '8', 'default' => '1'), |
|
1329 | + 'recur_data' => array('type' => 'int', 'precision' => '8', 'default' => '1'), |
|
1330 | + 'recur_exception' => array('type' => 'varchar', 'precision' => '255', 'default' => '') |
|
1331 | 1331 | ), |
1332 | 1332 | 'pk' => array('cal_id'), |
1333 | 1333 | 'fk' => array(), |
1334 | 1334 | 'ix' => array(), |
1335 | 1335 | 'uc' => array() |
1336 | - ),'recur_use_end'); |
|
1337 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats','cal_id',array( |
|
1336 | + ), 'recur_use_end'); |
|
1337 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats', 'cal_id', array( |
|
1338 | 1338 | 'type' => 'int', |
1339 | 1339 | 'precision' => '4', |
1340 | 1340 | 'nullable' => False |
1341 | 1341 | )); |
1342 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats','recur_type',array( |
|
1342 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats', 'recur_type', array( |
|
1343 | 1343 | 'type' => 'int', |
1344 | 1344 | 'precision' => '2', |
1345 | 1345 | 'nullable' => False |
1346 | 1346 | )); |
1347 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats','recur_interval',array( |
|
1347 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats', 'recur_interval', array( |
|
1348 | 1348 | 'type' => 'int', |
1349 | 1349 | 'precision' => '2', |
1350 | 1350 | 'default' => '1' |
1351 | 1351 | )); |
1352 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats','recur_data',array( |
|
1352 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats', 'recur_data', array( |
|
1353 | 1353 | 'type' => 'int', |
1354 | 1354 | 'precision' => '2', |
1355 | 1355 | 'default' => '1' |
@@ -1363,13 +1363,13 @@ discard block |
||
1363 | 1363 | |
1364 | 1364 | function calendar_upgrade1_0_1_004() |
1365 | 1365 | { |
1366 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_id',array( |
|
1366 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_id', array( |
|
1367 | 1367 | 'type' => 'int', |
1368 | 1368 | 'precision' => '4', |
1369 | 1369 | 'nullable' => False, |
1370 | 1370 | 'default' => '0' |
1371 | 1371 | )); |
1372 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_user_id',array( |
|
1372 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_user_id', array( |
|
1373 | 1373 | 'type' => 'int', |
1374 | 1374 | 'precision' => '4', |
1375 | 1375 | 'nullable' => False, |
@@ -1384,7 +1384,7 @@ discard block |
||
1384 | 1384 | |
1385 | 1385 | function calendar_upgrade1_0_1_005() |
1386 | 1386 | { |
1387 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user','cal_quantity',array( |
|
1387 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user', 'cal_quantity', array( |
|
1388 | 1388 | 'type' => 'int', |
1389 | 1389 | 'precision' => '4', |
1390 | 1390 | 'default' => '1' |
@@ -1398,7 +1398,7 @@ discard block |
||
1398 | 1398 | |
1399 | 1399 | function calendar_upgrade1_0_1_006() |
1400 | 1400 | { |
1401 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_non_blocking',array( |
|
1401 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_non_blocking', array( |
|
1402 | 1402 | 'type' => 'int', |
1403 | 1403 | 'precision' => '2', |
1404 | 1404 | 'default' => '0' |
@@ -1412,9 +1412,9 @@ discard block |
||
1412 | 1412 | |
1413 | 1413 | function calendar_upgrade1_0_1_007() |
1414 | 1414 | { |
1415 | - $GLOBALS['egw_setup']->db->update('egw_cal_repeats',array('recur_exception' => null),array('recur_exception' => ''),__LINE__,__FILE__,'calendar'); |
|
1415 | + $GLOBALS['egw_setup']->db->update('egw_cal_repeats', array('recur_exception' => null), array('recur_exception' => ''), __LINE__, __FILE__, 'calendar'); |
|
1416 | 1416 | |
1417 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats','recur_exception',array( |
|
1417 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats', 'recur_exception', array( |
|
1418 | 1418 | 'type' => 'text' |
1419 | 1419 | )); |
1420 | 1420 | |
@@ -1431,11 +1431,11 @@ discard block |
||
1431 | 1431 | { |
1432 | 1432 | $customfields = array(); |
1433 | 1433 | $order = 0; |
1434 | - foreach($config_data['fields'] as $name => $data) |
|
1434 | + foreach ($config_data['fields'] as $name => $data) |
|
1435 | 1435 | { |
1436 | 1436 | if ($name{0} == '#' && !$data['disabled']) // real not-disabled custom field |
1437 | 1437 | { |
1438 | - $customfields[substr($name,1)] = array( |
|
1438 | + $customfields[substr($name, 1)] = array( |
|
1439 | 1439 | 'type' => 'text', |
1440 | 1440 | 'len' => $data['length'].($data['shown'] ? ','.$data['shown'] : ''), |
1441 | 1441 | 'label' => $data['name'], |
@@ -1458,38 +1458,38 @@ discard block |
||
1458 | 1458 | function calendar_upgrade1_0_1_009() |
1459 | 1459 | { |
1460 | 1460 | $db2 = clone($GLOBALS['egw_setup']->db); |
1461 | - $GLOBALS['egw_setup']->db->select('egw_cal','DISTINCT egw_cal.cal_id,cal_groups,cal_recur_date',"cal_groups != ''",__LINE__,__FILE__, |
|
1462 | - False,'','calendar',0,',egw_cal_user WHERE egw_cal.cal_id=egw_cal_user.cal_id'); |
|
1463 | - while(($row = $GLOBALS['egw_setup']->db->row(true))) |
|
1461 | + $GLOBALS['egw_setup']->db->select('egw_cal', 'DISTINCT egw_cal.cal_id,cal_groups,cal_recur_date', "cal_groups != ''", __LINE__, __FILE__, |
|
1462 | + False, '', 'calendar', 0, ',egw_cal_user WHERE egw_cal.cal_id=egw_cal_user.cal_id'); |
|
1463 | + while (($row = $GLOBALS['egw_setup']->db->row(true))) |
|
1464 | 1464 | { |
1465 | 1465 | $row['cal_user_type'] = 'u'; |
1466 | - foreach(explode(',',$row['cal_groups']) as $group) |
|
1466 | + foreach (explode(',', $row['cal_groups']) as $group) |
|
1467 | 1467 | { |
1468 | 1468 | $row['cal_user_id'] = $group; |
1469 | - $db2->insert('egw_cal_user',array('cal_status' => 'U'),$row,__LINE__,__FILE__,'calendar'); |
|
1469 | + $db2->insert('egw_cal_user', array('cal_status' => 'U'), $row, __LINE__, __FILE__, 'calendar'); |
|
1470 | 1470 | } |
1471 | 1471 | } |
1472 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal',array( |
|
1472 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal', array( |
|
1473 | 1473 | 'fd' => array( |
1474 | - 'cal_id' => array('type' => 'auto','nullable' => False), |
|
1475 | - 'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False), |
|
1476 | - 'cal_owner' => array('type' => 'int','precision' => '4','nullable' => False), |
|
1477 | - 'cal_category' => array('type' => 'varchar','precision' => '30'), |
|
1478 | - 'cal_modified' => array('type' => 'int','precision' => '8'), |
|
1479 | - 'cal_priority' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '2'), |
|
1480 | - 'cal_public' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '1'), |
|
1481 | - 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'), |
|
1474 | + 'cal_id' => array('type' => 'auto', 'nullable' => False), |
|
1475 | + 'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False), |
|
1476 | + 'cal_owner' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
1477 | + 'cal_category' => array('type' => 'varchar', 'precision' => '30'), |
|
1478 | + 'cal_modified' => array('type' => 'int', 'precision' => '8'), |
|
1479 | + 'cal_priority' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '2'), |
|
1480 | + 'cal_public' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '1'), |
|
1481 | + 'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'), |
|
1482 | 1482 | 'cal_description' => array('type' => 'text'), |
1483 | - 'cal_location' => array('type' => 'varchar','precision' => '255'), |
|
1484 | - 'cal_reference' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), |
|
1485 | - 'cal_modifier' => array('type' => 'int','precision' => '4'), |
|
1486 | - 'cal_non_blocking' => array('type' => 'int','precision' => '2','default' => '0') |
|
1483 | + 'cal_location' => array('type' => 'varchar', 'precision' => '255'), |
|
1484 | + 'cal_reference' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'), |
|
1485 | + 'cal_modifier' => array('type' => 'int', 'precision' => '4'), |
|
1486 | + 'cal_non_blocking' => array('type' => 'int', 'precision' => '2', 'default' => '0') |
|
1487 | 1487 | ), |
1488 | 1488 | 'pk' => array('cal_id'), |
1489 | 1489 | 'fk' => array(), |
1490 | 1490 | 'ix' => array(), |
1491 | 1491 | 'uc' => array() |
1492 | - ),'cal_groups'); |
|
1492 | + ), 'cal_groups'); |
|
1493 | 1493 | |
1494 | 1494 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.2'; |
1495 | 1495 | } |
@@ -1499,7 +1499,7 @@ discard block |
||
1499 | 1499 | function calendar_upgrade1_2() |
1500 | 1500 | { |
1501 | 1501 | // get old alarms (saved before 1.2) working again |
1502 | - $GLOBALS['egw_setup']->db->query("UPDATE egw_async SET async_method ='calendar.bocalupdate.send_alarm' WHERE async_method ='calendar.bocalendar.send_alarm'",__LINE__,__FILE__); |
|
1502 | + $GLOBALS['egw_setup']->db->query("UPDATE egw_async SET async_method ='calendar.bocalupdate.send_alarm' WHERE async_method ='calendar.bocalendar.send_alarm'", __LINE__, __FILE__); |
|
1503 | 1503 | |
1504 | 1504 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.2.001'; |
1505 | 1505 | } |
@@ -1507,7 +1507,7 @@ discard block |
||
1507 | 1507 | |
1508 | 1508 | function calendar_upgrade1_2_001() |
1509 | 1509 | { |
1510 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_special',array( |
|
1510 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_special', array( |
|
1511 | 1511 | 'type' => 'int', |
1512 | 1512 | 'precision' => '2', |
1513 | 1513 | 'default' => '0' |
@@ -1525,7 +1525,7 @@ discard block |
||
1525 | 1525 | |
1526 | 1526 | function calendar_upgrade1_4() |
1527 | 1527 | { |
1528 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_etag',array( |
|
1528 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_etag', array( |
|
1529 | 1529 | 'type' => 'int', |
1530 | 1530 | 'precision' => '4', |
1531 | 1531 | 'default' => '0' |
@@ -1537,59 +1537,59 @@ discard block |
||
1537 | 1537 | |
1538 | 1538 | function calendar_upgrade1_5() |
1539 | 1539 | { |
1540 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal',array( |
|
1540 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal', array( |
|
1541 | 1541 | 'fd' => array( |
1542 | - 'cal_id' => array('type' => 'auto','nullable' => False), |
|
1543 | - 'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False), |
|
1544 | - 'cal_owner' => array('type' => 'int','precision' => '4','nullable' => False), |
|
1545 | - 'cal_category' => array('type' => 'varchar','precision' => '30'), |
|
1546 | - 'cal_modified' => array('type' => 'int','precision' => '8'), |
|
1547 | - 'cal_priority' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '2'), |
|
1548 | - 'cal_public' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '1'), |
|
1549 | - 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'), |
|
1542 | + 'cal_id' => array('type' => 'auto', 'nullable' => False), |
|
1543 | + 'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False), |
|
1544 | + 'cal_owner' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
1545 | + 'cal_category' => array('type' => 'varchar', 'precision' => '30'), |
|
1546 | + 'cal_modified' => array('type' => 'int', 'precision' => '8'), |
|
1547 | + 'cal_priority' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '2'), |
|
1548 | + 'cal_public' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '1'), |
|
1549 | + 'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'), |
|
1550 | 1550 | 'cal_description' => array('type' => 'text'), |
1551 | - 'cal_location' => array('type' => 'varchar','precision' => '255'), |
|
1552 | - 'cal_reference' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), |
|
1553 | - 'cal_modifier' => array('type' => 'int','precision' => '4'), |
|
1554 | - 'cal_non_blocking' => array('type' => 'int','precision' => '2','default' => '0'), |
|
1555 | - 'cal_special' => array('type' => 'int','precision' => '2','default' => '0'), |
|
1556 | - 'cal_etag' => array('type' => 'int','precision' => '4'), |
|
1557 | - 'cal_edit_time' => array('type' => 'int','precision' => '8') |
|
1551 | + 'cal_location' => array('type' => 'varchar', 'precision' => '255'), |
|
1552 | + 'cal_reference' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'), |
|
1553 | + 'cal_modifier' => array('type' => 'int', 'precision' => '4'), |
|
1554 | + 'cal_non_blocking' => array('type' => 'int', 'precision' => '2', 'default' => '0'), |
|
1555 | + 'cal_special' => array('type' => 'int', 'precision' => '2', 'default' => '0'), |
|
1556 | + 'cal_etag' => array('type' => 'int', 'precision' => '4'), |
|
1557 | + 'cal_edit_time' => array('type' => 'int', 'precision' => '8') |
|
1558 | 1558 | ), |
1559 | 1559 | 'pk' => array('cal_id'), |
1560 | 1560 | 'fk' => array(), |
1561 | 1561 | 'ix' => array(), |
1562 | 1562 | 'uc' => array() |
1563 | - ),'cal_edit_user'); |
|
1564 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal',array( |
|
1563 | + ), 'cal_edit_user'); |
|
1564 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal', array( |
|
1565 | 1565 | 'fd' => array( |
1566 | - 'cal_id' => array('type' => 'auto','nullable' => False), |
|
1567 | - 'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False), |
|
1568 | - 'cal_owner' => array('type' => 'int','precision' => '4','nullable' => False), |
|
1569 | - 'cal_category' => array('type' => 'varchar','precision' => '30'), |
|
1570 | - 'cal_modified' => array('type' => 'int','precision' => '8'), |
|
1571 | - 'cal_priority' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '2'), |
|
1572 | - 'cal_public' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '1'), |
|
1573 | - 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'), |
|
1566 | + 'cal_id' => array('type' => 'auto', 'nullable' => False), |
|
1567 | + 'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False), |
|
1568 | + 'cal_owner' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
1569 | + 'cal_category' => array('type' => 'varchar', 'precision' => '30'), |
|
1570 | + 'cal_modified' => array('type' => 'int', 'precision' => '8'), |
|
1571 | + 'cal_priority' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '2'), |
|
1572 | + 'cal_public' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '1'), |
|
1573 | + 'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'), |
|
1574 | 1574 | 'cal_description' => array('type' => 'text'), |
1575 | - 'cal_location' => array('type' => 'varchar','precision' => '255'), |
|
1576 | - 'cal_reference' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), |
|
1577 | - 'cal_modifier' => array('type' => 'int','precision' => '4'), |
|
1578 | - 'cal_non_blocking' => array('type' => 'int','precision' => '2','default' => '0'), |
|
1579 | - 'cal_special' => array('type' => 'int','precision' => '2','default' => '0'), |
|
1580 | - 'cal_etag' => array('type' => 'int','precision' => '4') |
|
1575 | + 'cal_location' => array('type' => 'varchar', 'precision' => '255'), |
|
1576 | + 'cal_reference' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'), |
|
1577 | + 'cal_modifier' => array('type' => 'int', 'precision' => '4'), |
|
1578 | + 'cal_non_blocking' => array('type' => 'int', 'precision' => '2', 'default' => '0'), |
|
1579 | + 'cal_special' => array('type' => 'int', 'precision' => '2', 'default' => '0'), |
|
1580 | + 'cal_etag' => array('type' => 'int', 'precision' => '4') |
|
1581 | 1581 | ), |
1582 | 1582 | 'pk' => array('cal_id'), |
1583 | 1583 | 'fk' => array(), |
1584 | 1584 | 'ix' => array(), |
1585 | 1585 | 'uc' => array() |
1586 | - ),'cal_edit_time'); |
|
1587 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_etag',array( |
|
1586 | + ), 'cal_edit_time'); |
|
1587 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_etag', array( |
|
1588 | 1588 | 'type' => 'int', |
1589 | 1589 | 'precision' => '4', |
1590 | 1590 | 'default' => '0' |
1591 | 1591 | )); |
1592 | - $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_etag=0 WHERE cal_etag IS NULL',__LINE__,__FILE__); |
|
1592 | + $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_etag=0 WHERE cal_etag IS NULL', __LINE__, __FILE__); |
|
1593 | 1593 | |
1594 | 1594 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.5.001'; |
1595 | 1595 | } |
@@ -1597,12 +1597,12 @@ discard block |
||
1597 | 1597 | |
1598 | 1598 | function calendar_upgrade1_5_001() |
1599 | 1599 | { |
1600 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_id',array( |
|
1600 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_id', array( |
|
1601 | 1601 | 'type' => 'int', |
1602 | 1602 | 'precision' => '4', |
1603 | 1603 | 'nullable' => False |
1604 | 1604 | )); |
1605 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_user_id',array( |
|
1605 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_user_id', array( |
|
1606 | 1606 | 'type' => 'varchar', |
1607 | 1607 | 'precision' => '128', |
1608 | 1608 | 'nullable' => False |
@@ -1616,12 +1616,12 @@ discard block |
||
1616 | 1616 | { |
1617 | 1617 | // update the alarm methods |
1618 | 1618 | $async = new asyncservice(); |
1619 | - foreach((array)$async->read('cal:%') as $job) |
|
1619 | + foreach ((array)$async->read('cal:%') as $job) |
|
1620 | 1620 | { |
1621 | 1621 | if ($job['method'] == 'calendar.bocalupdate.send_alarm') |
1622 | 1622 | { |
1623 | 1623 | $job['method'] = 'calendar.calendar_boupdate.send_alarm'; |
1624 | - $async->write($job,true); |
|
1624 | + $async->write($job, true); |
|
1625 | 1625 | } |
1626 | 1626 | } |
1627 | 1627 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.6'; |
@@ -1638,48 +1638,48 @@ discard block |
||
1638 | 1638 | { |
1639 | 1639 | // Set UID of series exception to UID of series master |
1640 | 1640 | // update cal_etag, cal_modified and cal_modifier to distribute changes on GroupDAV devices |
1641 | - foreach($GLOBALS['egw_setup']->db->query(' |
|
1641 | + foreach ($GLOBALS['egw_setup']->db->query(' |
|
1642 | 1642 | SELECT cal_ex.cal_id,cal_ex.cal_uid AS cal_uid_ex,cal_master.cal_uid AS cal_uid_master |
1643 | 1643 | FROM egw_cal cal_ex |
1644 | 1644 | JOIN egw_cal cal_master ON cal_ex.cal_reference=cal_master.cal_id |
1645 | - WHERE cal_ex.cal_reference != 0',__LINE__,__FILE__) as $row) |
|
1645 | + WHERE cal_ex.cal_reference != 0',__LINE__, __FILE__) as $row) |
|
1646 | 1646 | { |
1647 | 1647 | if (strlen($row['cal_uid_master']) > 0 && $row['cal_uid_ex'] != $row['cal_uid_master']) |
1648 | 1648 | { |
1649 | 1649 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_uid=\''.$row['cal_uid_master']. |
1650 | 1650 | '\',cal_etag=cal_etag+1,cal_modified='.time(). |
1651 | - ',cal_modifier=NULL WHERE cal_id='.(int)$row['cal_id'],__LINE__,__FILE__); |
|
1651 | + ',cal_modifier=NULL WHERE cal_id='.(int)$row['cal_id'], __LINE__, __FILE__); |
|
1652 | 1652 | } |
1653 | 1653 | } |
1654 | 1654 | |
1655 | 1655 | // Search series exception for nearest exception in series master and add that RECURRENCE-ID |
1656 | 1656 | // as cal_reference (for 1.6.003 and move it to new field cal_recurrence in 1.7.001) |
1657 | 1657 | $diff = null; |
1658 | - foreach($GLOBALS['egw_setup']->db->query('SELECT egw_cal.cal_id,cal_start,recur_exception FROM egw_cal |
|
1658 | + foreach ($GLOBALS['egw_setup']->db->query('SELECT egw_cal.cal_id,cal_start,recur_exception FROM egw_cal |
|
1659 | 1659 | JOIN egw_cal_dates ON egw_cal.cal_id=egw_cal_dates.cal_id |
1660 | 1660 | JOIN egw_cal_repeats ON cal_reference=egw_cal_repeats.cal_id |
1661 | - WHERE cal_reference != 0',__LINE__,__FILE__) as $row) |
|
1661 | + WHERE cal_reference != 0',__LINE__, __FILE__) as $row) |
|
1662 | 1662 | { |
1663 | 1663 | $recurrence = null; |
1664 | - foreach(explode(',',$row['recur_exception']) as $ts) |
|
1664 | + foreach (explode(',', $row['recur_exception']) as $ts) |
|
1665 | 1665 | { |
1666 | - if (is_null($recurrence) || abs($ts-$row['cal_start']) < $diff) |
|
1666 | + if (is_null($recurrence) || abs($ts - $row['cal_start']) < $diff) |
|
1667 | 1667 | { |
1668 | 1668 | $recurrence = $ts; |
1669 | - $diff = abs($ts-$row['cal_start']); |
|
1669 | + $diff = abs($ts - $row['cal_start']); |
|
1670 | 1670 | } |
1671 | 1671 | } |
1672 | 1672 | if ($recurrence) |
1673 | 1673 | { |
1674 | 1674 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_reference='.(int)$recurrence. |
1675 | - ' WHERE cal_id='.(int)$row['cal_id'],__LINE__,__FILE__); |
|
1675 | + ' WHERE cal_id='.(int)$row['cal_id'], __LINE__, __FILE__); |
|
1676 | 1676 | } |
1677 | 1677 | else |
1678 | 1678 | { |
1679 | 1679 | // if we cannot determine the RECURRENCE-ID use cal_start |
1680 | 1680 | // because RECURRENCE-ID must be present |
1681 | 1681 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_reference='.(int)$row['cal_start']. |
1682 | - ' WHERE cal_id='.(int)$row['cal_id'],__LINE__,__FILE__); |
|
1682 | + ' WHERE cal_id='.(int)$row['cal_id'], __LINE__, __FILE__); |
|
1683 | 1683 | } |
1684 | 1684 | } |
1685 | 1685 | |
@@ -1694,33 +1694,33 @@ discard block |
||
1694 | 1694 | */ |
1695 | 1695 | function calendar_upgrade1_6_003() |
1696 | 1696 | { |
1697 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_creator',array( |
|
1697 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_creator', array( |
|
1698 | 1698 | 'type' => 'int', |
1699 | 1699 | 'precision' => '4', |
1700 | 1700 | 'comment' => 'creating user' |
1701 | 1701 | )); |
1702 | - $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_creator=cal_owner',__LINE__,__FILE__); |
|
1703 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_creator',array( |
|
1702 | + $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_creator=cal_owner', __LINE__, __FILE__); |
|
1703 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_creator', array( |
|
1704 | 1704 | 'type' => 'int', |
1705 | 1705 | 'precision' => '4', |
1706 | 1706 | 'nullable' => False, |
1707 | 1707 | 'comment' => 'creating user' |
1708 | 1708 | )); |
1709 | 1709 | |
1710 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_created',array( |
|
1710 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_created', array( |
|
1711 | 1711 | 'type' => 'int', |
1712 | 1712 | 'precision' => '8', |
1713 | 1713 | 'comment' => 'creation time of event' |
1714 | 1714 | )); |
1715 | - $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_created=cal_modified',__LINE__,__FILE__); |
|
1716 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_created',array( |
|
1715 | + $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_created=cal_modified', __LINE__, __FILE__); |
|
1716 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_created', array( |
|
1717 | 1717 | 'type' => 'int', |
1718 | 1718 | 'precision' => '8', |
1719 | 1719 | 'nullable' => False, |
1720 | 1720 | 'comment' => 'creation time of event' |
1721 | 1721 | )); |
1722 | 1722 | |
1723 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_recurrence',array( |
|
1723 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_recurrence', array( |
|
1724 | 1724 | 'type' => 'int', |
1725 | 1725 | 'precision' => '8', |
1726 | 1726 | 'nullable' => False, |
@@ -1731,14 +1731,14 @@ discard block |
||
1731 | 1731 | // move RECURRENCE-ID from temporarily (1.6.003) |
1732 | 1732 | // used field cal_reference to new field cal_recurrence |
1733 | 1733 | // and restore cal_reference field of series exceptions with id of the series master |
1734 | - foreach($GLOBALS['egw_setup']->db->query(' |
|
1734 | + foreach ($GLOBALS['egw_setup']->db->query(' |
|
1735 | 1735 | SELECT cal_ex.cal_id AS cal_id_ex,cal_master.cal_id AS cal_id_master, |
1736 | 1736 | cal_ex.cal_reference AS cal_reference_ex,cal_ex.cal_uid AS cal_uid_ex, |
1737 | 1737 | cal_master.cal_uid AS cal_uid_master |
1738 | 1738 | FROM egw_cal cal_ex |
1739 | 1739 | JOIN egw_cal cal_master |
1740 | 1740 | ON cal_ex.cal_uid=cal_master.cal_uid AND cal_master.cal_reference = 0 AND cal_ex.cal_owner = cal_master.cal_owner |
1741 | - WHERE cal_ex.cal_reference !=0 AND cal_master.cal_id IS NOT NULL',__LINE__,__FILE__) as $row) |
|
1741 | + WHERE cal_ex.cal_reference !=0 AND cal_master.cal_id IS NOT NULL',__LINE__, __FILE__) as $row) |
|
1742 | 1742 | { |
1743 | 1743 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_recurrence='.(int)$row['cal_reference_ex']. |
1744 | 1744 | ', cal_reference='.(int)$row['cal_id_master']. |
@@ -1755,7 +1755,7 @@ discard block |
||
1755 | 1755 | */ |
1756 | 1756 | function calendar_upgrade1_7_001() |
1757 | 1757 | { |
1758 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user','cal_role',array( |
|
1758 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user', 'cal_role', array( |
|
1759 | 1759 | 'type' => 'varchar', |
1760 | 1760 | 'precision' => '64', |
1761 | 1761 | 'default' => 'REQ-PARTICIPANT' |
@@ -1771,14 +1771,14 @@ discard block |
||
1771 | 1771 | */ |
1772 | 1772 | function calendar_upgrade1_7_002() |
1773 | 1773 | { |
1774 | - $GLOBALS['egw_setup']->oProc->CreateTable('egw_cal_timezones',array( |
|
1774 | + $GLOBALS['egw_setup']->oProc->CreateTable('egw_cal_timezones', array( |
|
1775 | 1775 | 'fd' => array( |
1776 | - 'tz_id' => array('type' => 'auto','nullable' => False), |
|
1777 | - 'tz_tzid' => array('type' => 'varchar','precision' => '128','nullable' => False), |
|
1778 | - 'tz_alias' => array('type' => 'int','precision' => '4','comment' => 'tz_id for data'), |
|
1779 | - 'tz_latitude' => array('type' => 'int','precision' => '4'), |
|
1780 | - 'tz_longitude' => array('type' => 'int','precision' => '4'), |
|
1781 | - 'tz_component' => array('type' => 'text','comment' => 'iCal VTIMEZONE component') |
|
1776 | + 'tz_id' => array('type' => 'auto', 'nullable' => False), |
|
1777 | + 'tz_tzid' => array('type' => 'varchar', 'precision' => '128', 'nullable' => False), |
|
1778 | + 'tz_alias' => array('type' => 'int', 'precision' => '4', 'comment' => 'tz_id for data'), |
|
1779 | + 'tz_latitude' => array('type' => 'int', 'precision' => '4'), |
|
1780 | + 'tz_longitude' => array('type' => 'int', 'precision' => '4'), |
|
1781 | + 'tz_component' => array('type' => 'text', 'comment' => 'iCal VTIMEZONE component') |
|
1782 | 1782 | ), |
1783 | 1783 | 'pk' => array('tz_id'), |
1784 | 1784 | 'fk' => array(), |
@@ -1798,38 +1798,38 @@ discard block |
||
1798 | 1798 | */ |
1799 | 1799 | function calendar_upgrade1_7_003() |
1800 | 1800 | { |
1801 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_user_type',array( |
|
1801 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_user_type', array( |
|
1802 | 1802 | 'type' => 'varchar', |
1803 | 1803 | 'precision' => '1', |
1804 | 1804 | 'nullable' => False, |
1805 | 1805 | 'default' => 'u', |
1806 | 1806 | 'comment' => 'u=user, g=group, c=contact, r=resource, e=email' |
1807 | 1807 | )); |
1808 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_user_id',array( |
|
1808 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_user_id', array( |
|
1809 | 1809 | 'type' => 'varchar', |
1810 | 1810 | 'precision' => '128', |
1811 | 1811 | 'nullable' => False, |
1812 | 1812 | 'comment' => 'id or email-address for type=e' |
1813 | 1813 | )); |
1814 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_status',array( |
|
1814 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_status', array( |
|
1815 | 1815 | 'type' => 'char', |
1816 | 1816 | 'precision' => '1', |
1817 | 1817 | 'default' => 'A', |
1818 | 1818 | 'comment' => 'U=unknown, A=accepted, R=rejected, T=tentative' |
1819 | 1819 | )); |
1820 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_quantity',array( |
|
1820 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_quantity', array( |
|
1821 | 1821 | 'type' => 'int', |
1822 | 1822 | 'precision' => '4', |
1823 | 1823 | 'default' => '1', |
1824 | 1824 | 'comment' => 'only for certain types (eg. resources)' |
1825 | 1825 | )); |
1826 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_role',array( |
|
1826 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_role', array( |
|
1827 | 1827 | 'type' => 'varchar', |
1828 | 1828 | 'precision' => '64', |
1829 | 1829 | 'default' => 'REQ-PARTICIPANT', |
1830 | 1830 | 'comment' => 'CHAIR, REQ-PARTICIPANT, OPT-PARTICIPANT, NON-PARTICIPANT, X-CAT-$cat_id' |
1831 | 1831 | )); |
1832 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user','cal_user_modified',array( |
|
1832 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user', 'cal_user_modified', array( |
|
1833 | 1833 | 'type' => 'timestamp', |
1834 | 1834 | 'default' => 'current_timestamp', |
1835 | 1835 | 'comment' => 'automatic timestamp of last update' |
@@ -1845,19 +1845,19 @@ discard block |
||
1845 | 1845 | */ |
1846 | 1846 | function calendar_upgrade1_7_004() |
1847 | 1847 | { |
1848 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_dates','cal_start',array( |
|
1848 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_dates', 'cal_start', array( |
|
1849 | 1849 | 'type' => 'int', |
1850 | 1850 | 'precision' => '8', |
1851 | 1851 | 'nullable' => False, |
1852 | 1852 | 'comment' => 'starttime in server time' |
1853 | 1853 | )); |
1854 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_dates','cal_end',array( |
|
1854 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_dates', 'cal_end', array( |
|
1855 | 1855 | 'type' => 'int', |
1856 | 1856 | 'precision' => '8', |
1857 | 1857 | 'nullable' => False, |
1858 | 1858 | 'comment' => 'endtime in server time' |
1859 | 1859 | )); |
1860 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','tz_id',array( |
|
1860 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'tz_id', array( |
|
1861 | 1861 | 'type' => 'int', |
1862 | 1862 | 'precision' => '4', |
1863 | 1863 | 'comment' => 'key into egw_cal_timezones' |
@@ -1866,7 +1866,7 @@ discard block |
||
1866 | 1866 | // set id of server timezone for existing events, as that's the timezone their recurrences are using |
1867 | 1867 | if (($tzid = date_default_timezone_get()) && ($tz_id = calendar_timezones::tz2id($tzid))) |
1868 | 1868 | { |
1869 | - $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET tz_id='.(int)$tz_id,__LINE__,__FILE__); |
|
1869 | + $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET tz_id='.(int)$tz_id, __LINE__, __FILE__); |
|
1870 | 1870 | } |
1871 | 1871 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.005'; |
1872 | 1872 | } |
@@ -1893,22 +1893,22 @@ discard block |
||
1893 | 1893 | */ |
1894 | 1894 | function calendar_upgrade1_7_006() |
1895 | 1895 | { |
1896 | - foreach($GLOBALS['egw_setup']->db->query('SELECT * FROM egw_cal_dates |
|
1897 | - WHERE (cal_end-cal_start)%86400=86340',__LINE__,__FILE__) as $row) |
|
1896 | + foreach ($GLOBALS['egw_setup']->db->query('SELECT * FROM egw_cal_dates |
|
1897 | + WHERE (cal_end-cal_start)%86400=86340',__LINE__, __FILE__) as $row) |
|
1898 | 1898 | { |
1899 | 1899 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal_dates SET cal_end=cal_end+59 |
1900 | - WHERE cal_id='.(int)$row['cal_id'].' AND cal_start='.(int)$row['cal_start'],__LINE__,__FILE__); |
|
1900 | + WHERE cal_id='.(int)$row['cal_id'].' AND cal_start='.(int)$row['cal_start'], __LINE__, __FILE__); |
|
1901 | 1901 | } |
1902 | 1902 | |
1903 | - foreach($GLOBALS['egw_setup']->db->query('SELECT * FROM egw_cal_dates |
|
1904 | - WHERE cal_end-cal_start>0 AND (cal_end-cal_start)%86400=0',__LINE__,__FILE__) as $row) |
|
1903 | + foreach ($GLOBALS['egw_setup']->db->query('SELECT * FROM egw_cal_dates |
|
1904 | + WHERE cal_end-cal_start>0 AND (cal_end-cal_start)%86400=0',__LINE__, __FILE__) as $row) |
|
1905 | 1905 | { |
1906 | 1906 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal_dates SET cal_end=cal_end-1 |
1907 | - WHERE cal_id='.(int)$row['cal_id'].' AND cal_start='.(int)$row['cal_start'],__LINE__,__FILE__); |
|
1907 | + WHERE cal_id='.(int)$row['cal_id'].' AND cal_start='.(int)$row['cal_start'], __LINE__, __FILE__); |
|
1908 | 1908 | } |
1909 | 1909 | |
1910 | 1910 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal_repeats SET recur_interval=1 |
1911 | - WHERE recur_interval=0',__LINE__,__FILE__); |
|
1911 | + WHERE recur_interval=0',__LINE__, __FILE__); |
|
1912 | 1912 | |
1913 | 1913 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.007'; |
1914 | 1914 | } |
@@ -1924,17 +1924,17 @@ discard block |
||
1924 | 1924 | { |
1925 | 1925 | // Set UID of series exception to UID of series master |
1926 | 1926 | // update cal_etag,cal_modified and cal_modifier to distribute changes on GroupDAV devices |
1927 | - foreach($GLOBALS['egw_setup']->db->query(' |
|
1927 | + foreach ($GLOBALS['egw_setup']->db->query(' |
|
1928 | 1928 | SELECT cal_ex.cal_id,cal_ex.cal_uid AS cal_uid_ex,cal_master.cal_uid AS cal_uid_master |
1929 | 1929 | FROM egw_cal cal_ex |
1930 | 1930 | JOIN egw_cal cal_master ON cal_ex.cal_reference=cal_master.cal_id |
1931 | - WHERE cal_ex.cal_reference != 0',__LINE__,__FILE__) as $row) |
|
1931 | + WHERE cal_ex.cal_reference != 0',__LINE__, __FILE__) as $row) |
|
1932 | 1932 | { |
1933 | 1933 | if (strlen($row['cal_uid_master']) > 0 && $row['cal_uid_ex'] != $row['cal_uid_master']) |
1934 | 1934 | { |
1935 | 1935 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_uid=\''.$row['cal_uid_master']. |
1936 | 1936 | '\',cal_etag=cal_etag+1,cal_modified='.time(). |
1937 | - ',cal_modifier=NULL WHERE cal_id='.(int)$row['cal_id'],__LINE__,__FILE__); |
|
1937 | + ',cal_modifier=NULL WHERE cal_id='.(int)$row['cal_id'], __LINE__, __FILE__); |
|
1938 | 1938 | } |
1939 | 1939 | } |
1940 | 1940 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.008'; |
@@ -1947,7 +1947,7 @@ discard block |
||
1947 | 1947 | */ |
1948 | 1948 | function calendar_upgrade1_7_008() |
1949 | 1949 | { |
1950 | - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal_user',array('cal_user_type','cal_user_id')); |
|
1950 | + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal_user', array('cal_user_type', 'cal_user_id')); |
|
1951 | 1951 | |
1952 | 1952 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.009'; |
1953 | 1953 | } |
@@ -1959,22 +1959,22 @@ discard block |
||
1959 | 1959 | */ |
1960 | 1960 | function calendar_upgrade1_7_009() |
1961 | 1961 | { |
1962 | - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal','cal_uid'); |
|
1963 | - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal','cal_owner'); |
|
1962 | + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal', 'cal_uid'); |
|
1963 | + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal', 'cal_owner'); |
|
1964 | 1964 | |
1965 | 1965 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.010'; |
1966 | 1966 | } |
1967 | 1967 | |
1968 | 1968 | function calendar_upgrade1_7_010() |
1969 | 1969 | { |
1970 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_deleted',array( |
|
1970 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_deleted', array( |
|
1971 | 1971 | 'type' => 'bool', |
1972 | 1972 | 'nullable' => False, |
1973 | 1973 | 'default' => '0', |
1974 | 1974 | 'comment' => '1 if the event has been deleted, but you want to keep it around' |
1975 | 1975 | )); |
1976 | 1976 | |
1977 | - return $GLOBALS['setup_info']['calendar']['currentver'] = '1.9.001'; // was 1.7.011 |
|
1977 | + return $GLOBALS['setup_info']['calendar']['currentver'] = '1.9.001'; // was 1.7.011 |
|
1978 | 1978 | } |
1979 | 1979 | |
1980 | 1980 | function calendar_upgrade1_7_011() |
@@ -1999,7 +1999,7 @@ discard block |
||
1999 | 1999 | function calendar_upgrade1_9_001() |
2000 | 2000 | { |
2001 | 2001 | // delete in the past wrongly created entries for a single recurrence, which mess up the update, beside being wrong anyway |
2002 | - $GLOBALS['egw_setup']->db->delete('egw_api_content_history',array( |
|
2002 | + $GLOBALS['egw_setup']->db->delete('egw_api_content_history', array( |
|
2003 | 2003 | 'sync_appname' => 'calendar', |
2004 | 2004 | "sync_contentid LIKE '%:%'", |
2005 | 2005 | ), __LINE__, __FILE__); |
@@ -2010,36 +2010,36 @@ discard block |
||
2010 | 2010 | 'precision' => '8', |
2011 | 2011 | 'comment' => 'ts when event was deleted' |
2012 | 2012 | ));*/ |
2013 | - $GLOBALS['egw_setup']->oProc->RefreshTable('egw_cal',array( |
|
2013 | + $GLOBALS['egw_setup']->oProc->RefreshTable('egw_cal', array( |
|
2014 | 2014 | 'fd' => array( |
2015 | - 'cal_id' => array('type' => 'auto','nullable' => False), |
|
2016 | - 'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False,'comment' => 'unique id of event(-series)'), |
|
2017 | - 'cal_owner' => array('type' => 'int','precision' => '4','nullable' => False,'comment' => 'event owner / calendar'), |
|
2018 | - 'cal_category' => array('type' => 'varchar','precision' => '30','comment' => 'category id'), |
|
2019 | - 'cal_modified' => array('type' => 'int','precision' => '8','comment' => 'ts of last modification'), |
|
2020 | - 'cal_priority' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '2'), |
|
2021 | - 'cal_public' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '1','comment' => '1=public, 0=private event'), |
|
2022 | - 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'), |
|
2015 | + 'cal_id' => array('type' => 'auto', 'nullable' => False), |
|
2016 | + 'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'comment' => 'unique id of event(-series)'), |
|
2017 | + 'cal_owner' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'comment' => 'event owner / calendar'), |
|
2018 | + 'cal_category' => array('type' => 'varchar', 'precision' => '30', 'comment' => 'category id'), |
|
2019 | + 'cal_modified' => array('type' => 'int', 'precision' => '8', 'comment' => 'ts of last modification'), |
|
2020 | + 'cal_priority' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '2'), |
|
2021 | + 'cal_public' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '1', 'comment' => '1=public, 0=private event'), |
|
2022 | + 'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'), |
|
2023 | 2023 | 'cal_description' => array('type' => 'text'), |
2024 | - 'cal_location' => array('type' => 'varchar','precision' => '255'), |
|
2025 | - 'cal_reference' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0','comment' => 'cal_id of series for exception'), |
|
2026 | - 'cal_modifier' => array('type' => 'int','precision' => '4','comment' => 'user who last modified event'), |
|
2027 | - 'cal_non_blocking' => array('type' => 'int','precision' => '2','default' => '0','comment' => '1 for non-blocking events'), |
|
2028 | - 'cal_special' => array('type' => 'int','precision' => '2','default' => '0'), |
|
2029 | - 'cal_etag' => array('type' => 'int','precision' => '4','default' => '0','comment' => 'etag for optimistic locking'), |
|
2030 | - 'cal_creator' => array('type' => 'int','precision' => '4','nullable' => False,'comment' => 'creating user'), |
|
2031 | - 'cal_created' => array('type' => 'int','precision' => '8','nullable' => False,'comment' => 'creation time of event'), |
|
2032 | - 'cal_recurrence' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0','comment' => 'cal_start of original recurrence for exception'), |
|
2033 | - 'tz_id' => array('type' => 'int','precision' => '4','comment' => 'key into egw_cal_timezones'), |
|
2034 | - 'cal_deleted' => array('type' => 'int','precision' => '8','comment' => 'ts when event was deleted') |
|
2024 | + 'cal_location' => array('type' => 'varchar', 'precision' => '255'), |
|
2025 | + 'cal_reference' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0', 'comment' => 'cal_id of series for exception'), |
|
2026 | + 'cal_modifier' => array('type' => 'int', 'precision' => '4', 'comment' => 'user who last modified event'), |
|
2027 | + 'cal_non_blocking' => array('type' => 'int', 'precision' => '2', 'default' => '0', 'comment' => '1 for non-blocking events'), |
|
2028 | + 'cal_special' => array('type' => 'int', 'precision' => '2', 'default' => '0'), |
|
2029 | + 'cal_etag' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'comment' => 'etag for optimistic locking'), |
|
2030 | + 'cal_creator' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'comment' => 'creating user'), |
|
2031 | + 'cal_created' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'comment' => 'creation time of event'), |
|
2032 | + 'cal_recurrence' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0', 'comment' => 'cal_start of original recurrence for exception'), |
|
2033 | + 'tz_id' => array('type' => 'int', 'precision' => '4', 'comment' => 'key into egw_cal_timezones'), |
|
2034 | + 'cal_deleted' => array('type' => 'int', 'precision' => '8', 'comment' => 'ts when event was deleted') |
|
2035 | 2035 | ), |
2036 | 2036 | 'pk' => array('cal_id'), |
2037 | 2037 | 'fk' => array(), |
2038 | - 'ix' => array('cal_uid','cal_owner','cal_deleted'), |
|
2038 | + 'ix' => array('cal_uid', 'cal_owner', 'cal_deleted'), |
|
2039 | 2039 | 'uc' => array() |
2040 | - ),array( |
|
2040 | + ), array( |
|
2041 | 2041 | // for deleted rows use cal_modified as deleted date, NULL for not deleted ones |
2042 | - 'cal_deleted' => 'CASE cal_deleted WHEN '.$GLOBALS['egw_setup']->db->quote(true,'bool').' THEN cal_modified ELSE NULL END', |
|
2042 | + 'cal_deleted' => 'CASE cal_deleted WHEN '.$GLOBALS['egw_setup']->db->quote(true, 'bool').' THEN cal_modified ELSE NULL END', |
|
2043 | 2043 | )); |
2044 | 2044 | |
2045 | 2045 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.9.002'; |
@@ -2051,16 +2051,16 @@ discard block |
||
2051 | 2051 | */ |
2052 | 2052 | function calendar_upgrade1_9_002() |
2053 | 2053 | { |
2054 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','caldav_name',array( |
|
2054 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'caldav_name', array( |
|
2055 | 2055 | 'type' => 'varchar', |
2056 | 2056 | 'precision' => '64', |
2057 | 2057 | 'comment' => 'name part of CalDAV URL, if specified by client' |
2058 | 2058 | )); |
2059 | - $GLOBALS['egw_setup']->db->query($sql='UPDATE egw_cal SET caldav_name='. |
|
2059 | + $GLOBALS['egw_setup']->db->query($sql = 'UPDATE egw_cal SET caldav_name='. |
|
2060 | 2060 | $GLOBALS['egw_setup']->db->concat( |
2061 | - $GLOBALS['egw_setup']->db->to_varchar('cal_id'),"'.ics'"),__LINE__,__FILE__); |
|
2061 | + $GLOBALS['egw_setup']->db->to_varchar('cal_id'), "'.ics'"), __LINE__, __FILE__); |
|
2062 | 2062 | |
2063 | - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal','caldav_name'); |
|
2063 | + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal', 'caldav_name'); |
|
2064 | 2064 | |
2065 | 2065 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.9.003'; |
2066 | 2066 | } |
@@ -2071,8 +2071,8 @@ discard block |
||
2071 | 2071 | */ |
2072 | 2072 | function calendar_upgrade1_9_003() |
2073 | 2073 | { |
2074 | - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal','cal_modified'); |
|
2075 | - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal_user','cal_user_modified'); |
|
2074 | + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal', 'cal_modified'); |
|
2075 | + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal_user', 'cal_user_modified'); |
|
2076 | 2076 | |
2077 | 2077 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.9.004'; |
2078 | 2078 | } |
@@ -2084,7 +2084,7 @@ discard block |
||
2084 | 2084 | */ |
2085 | 2085 | function calendar_upgrade1_9_004() |
2086 | 2086 | { |
2087 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_dates','recur_exception',array( |
|
2087 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_dates', 'recur_exception', array( |
|
2088 | 2088 | 'type' => 'bool', |
2089 | 2089 | 'default' => '', |
2090 | 2090 | 'null' => false, |
@@ -2092,16 +2092,16 @@ discard block |
||
2092 | 2092 | )); |
2093 | 2093 | |
2094 | 2094 | // migrate existing exceptions to egw_cal_dates |
2095 | - foreach($GLOBALS['egw_setup']->db->select('egw_cal_repeats', |
|
2095 | + foreach ($GLOBALS['egw_setup']->db->select('egw_cal_repeats', |
|
2096 | 2096 | 'egw_cal_repeats.cal_id AS cal_id,egw_cal_repeats.recur_exception AS recur_exception,MIN(cal_start) AS cal_start,MIN(cal_end) AS cal_end', |
2097 | 2097 | 'egw_cal_repeats.recur_exception IS NOT NULL', __LINE__, __FILE__, false, |
2098 | 2098 | 'GROUP BY egw_cal_repeats.cal_id,egw_cal_repeats.recur_exception', 'calendar', '', |
2099 | 2099 | 'JOIN egw_cal_dates ON egw_cal_repeats.cal_id=egw_cal_dates.cal_id') as $row) |
2100 | 2100 | { |
2101 | - foreach($row['recur_exception'] ? array_unique(explode(',', $row['recur_exception'])) : array() as $recur_exception) |
|
2101 | + foreach ($row['recur_exception'] ? array_unique(explode(',', $row['recur_exception'])) : array() as $recur_exception) |
|
2102 | 2102 | { |
2103 | 2103 | $GLOBALS['egw_setup']->db->insert('egw_cal_dates', array( |
2104 | - 'cal_end' => $recur_exception+$row['cal_end']-$row['cal_start'], |
|
2104 | + 'cal_end' => $recur_exception + $row['cal_end'] - $row['cal_start'], |
|
2105 | 2105 | 'recur_exception' => true, |
2106 | 2106 | ), array( |
2107 | 2107 | 'cal_id' => $row['cal_id'], |
@@ -2113,11 +2113,11 @@ discard block |
||
2113 | 2113 | |
2114 | 2114 | $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal_repeats', array( |
2115 | 2115 | 'fd' => array( |
2116 | - 'cal_id' => array('type' => 'int','precision' => '4','nullable' => False), |
|
2117 | - 'recur_type' => array('type' => 'int','precision' => '2','nullable' => False), |
|
2118 | - 'recur_enddate' => array('type' => 'int','precision' => '8'), |
|
2119 | - 'recur_interval' => array('type' => 'int','precision' => '2','default' => '1'), |
|
2120 | - 'recur_data' => array('type' => 'int','precision' => '2','default' => '1'), |
|
2116 | + 'cal_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
2117 | + 'recur_type' => array('type' => 'int', 'precision' => '2', 'nullable' => False), |
|
2118 | + 'recur_enddate' => array('type' => 'int', 'precision' => '8'), |
|
2119 | + 'recur_interval' => array('type' => 'int', 'precision' => '2', 'default' => '1'), |
|
2120 | + 'recur_data' => array('type' => 'int', 'precision' => '2', 'default' => '1'), |
|
2121 | 2121 | ), |
2122 | 2122 | 'pk' => array('cal_id'), |
2123 | 2123 | 'fk' => array(), |
@@ -2138,19 +2138,19 @@ discard block |
||
2138 | 2138 | // returns NULL, if there are no rows! |
2139 | 2139 | if ((int)$max_description_length <= 16384 && $GLOBALS['egw_setup']->oProc->max_varchar_length >= 16384) |
2140 | 2140 | { |
2141 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_description',array( |
|
2141 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_description', array( |
|
2142 | 2142 | 'type' => 'varchar', |
2143 | 2143 | 'precision' => '16384' |
2144 | 2144 | )); |
2145 | 2145 | } |
2146 | 2146 | // allow more categories |
2147 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_category',array( |
|
2147 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_category', array( |
|
2148 | 2148 | 'type' => 'varchar', |
2149 | 2149 | 'precision' => '64', |
2150 | 2150 | 'comment' => 'category id(s)' |
2151 | 2151 | )); |
2152 | 2152 | // remove silly default of 1 |
2153 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_title',array( |
|
2153 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_title', array( |
|
2154 | 2154 | 'type' => 'varchar', |
2155 | 2155 | 'precision' => '255', |
2156 | 2156 | 'nullable' => False |
@@ -2165,14 +2165,14 @@ discard block |
||
2165 | 2165 | { |
2166 | 2166 | // PostgreSQL needs temporary a nullable column, to not stall on broken events without dates! |
2167 | 2167 | // We add that constrain in 1.9.007, after deleting all rows with range_start=0 OR range_start IS NULL |
2168 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','range_start',array( |
|
2168 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'range_start', array( |
|
2169 | 2169 | 'type' => 'int', |
2170 | 2170 | 'precision' => '8', |
2171 | 2171 | 'comment' => 'startdate (of range)' |
2172 | 2172 | )); |
2173 | 2173 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET range_start = (SELECT MIN(cal_start) FROM egw_cal_dates WHERE egw_cal_dates.cal_id=egw_cal.cal_id)', __LINE__, __FILE__); |
2174 | 2174 | |
2175 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','range_end',array( |
|
2175 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'range_end', array( |
|
2176 | 2176 | 'type' => 'int', |
2177 | 2177 | 'precision' => '8', |
2178 | 2178 | 'comment' => 'enddate (of range, UNTIL of RRULE)' |
@@ -2188,18 +2188,18 @@ discard block |
||
2188 | 2188 | { |
2189 | 2189 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET range_end=recur_enddate FROM egw_cal_repeats WHERE egw_cal.cal_id=egw_cal_repeats.cal_id', __LINE__, __FILE__); |
2190 | 2190 | } |
2191 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal_repeats',array( |
|
2191 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal_repeats', array( |
|
2192 | 2192 | 'fd' => array( |
2193 | - 'cal_id' => array('type' => 'int','precision' => '4','nullable' => False), |
|
2194 | - 'recur_type' => array('type' => 'int','precision' => '2','nullable' => False), |
|
2195 | - 'recur_interval' => array('type' => 'int','precision' => '2','default' => '1'), |
|
2196 | - 'recur_data' => array('type' => 'int','precision' => '2','default' => '1') |
|
2193 | + 'cal_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
2194 | + 'recur_type' => array('type' => 'int', 'precision' => '2', 'nullable' => False), |
|
2195 | + 'recur_interval' => array('type' => 'int', 'precision' => '2', 'default' => '1'), |
|
2196 | + 'recur_data' => array('type' => 'int', 'precision' => '2', 'default' => '1') |
|
2197 | 2197 | ), |
2198 | 2198 | 'pk' => array('cal_id'), |
2199 | 2199 | 'fk' => array(), |
2200 | 2200 | 'ix' => array(), |
2201 | 2201 | 'uc' => array() |
2202 | - ),'recur_enddate'); |
|
2202 | + ), 'recur_enddate'); |
|
2203 | 2203 | |
2204 | 2204 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.9.007'; |
2205 | 2205 | } |
@@ -2211,14 +2211,14 @@ discard block |
||
2211 | 2211 | */ |
2212 | 2212 | function calendar_upgrade1_9_007() |
2213 | 2213 | { |
2214 | - foreach(array('egw_cal_repeats','egw_cal_dates','egw_cal_user','egw_cal_extra') as $table) |
|
2214 | + foreach (array('egw_cal_repeats', 'egw_cal_dates', 'egw_cal_user', 'egw_cal_extra') as $table) |
|
2215 | 2215 | { |
2216 | 2216 | $GLOBALS['egw_setup']->db->query("DELETE FROM $table WHERE cal_id IN (SELECT cal_id FROM egw_cal WHERE range_start=0 OR range_start IS NULL)", __LINE__, __FILE__); |
2217 | 2217 | } |
2218 | 2218 | $GLOBALS['egw_setup']->db->query("DELETE FROM egw_cal WHERE range_start=0 OR range_start IS NULL", __LINE__, __FILE__); |
2219 | 2219 | |
2220 | 2220 | // now we can remove temporary default of 0 from range_start and set it NOT NULL |
2221 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','range_start',array( |
|
2221 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'range_start', array( |
|
2222 | 2222 | 'type' => 'int', |
2223 | 2223 | 'precision' => '8', |
2224 | 2224 | 'nullable' => False, |
@@ -2283,7 +2283,7 @@ discard block |
||
2283 | 2283 | |
2284 | 2284 | function calendar_upgrade1_9_010() |
2285 | 2285 | { |
2286 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','caldav_name',array( |
|
2286 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'caldav_name', array( |
|
2287 | 2287 | 'type' => 'varchar', |
2288 | 2288 | 'precision' => '200', |
2289 | 2289 | 'comment' => 'name part of CalDAV URL, if specified by client' |
@@ -2313,7 +2313,7 @@ discard block |
||
2313 | 2313 | SET cal_reference=0,cal_recurrence=0,cal_etag=cal_etag+1,cal_modifier=0,cal_modified=".time()." |
2314 | 2314 | WHERE cal_reference != 0 AND cal_id IN (SELECT cal_id FROM egw_cal_repeats)", __LINE__, __FILE__); |
2315 | 2315 | |
2316 | - foreach($GLOBALS['egw_setup']->db->query( |
|
2316 | + foreach ($GLOBALS['egw_setup']->db->query( |
|
2317 | 2317 | "SELECT DISTINCT master.cal_id,egw_cal_user.cal_user_type,egw_cal_user.cal_user_id,'E' AS cal_status |
2318 | 2318 | FROM egw_cal_user |
2319 | 2319 | JOIN egw_cal ON egw_cal_user.cal_id=egw_cal.cal_id |
@@ -2340,7 +2340,7 @@ discard block |
||
2340 | 2340 | */ |
2341 | 2341 | function calendar_upgrade14_1_001() |
2342 | 2342 | { |
2343 | - foreach($GLOBALS['egw_setup']->db->query( |
|
2343 | + foreach ($GLOBALS['egw_setup']->db->query( |
|
2344 | 2344 | "SELECT egw_cal.cal_id AS cal_id,cal_start,cal_end,range_start,range_end,egw_cal_repeats.*,tz_tzid AS tzid |
2345 | 2345 | FROM egw_cal |
2346 | 2346 | JOIN egw_cal_repeats ON egw_cal_repeats.cal_id=egw_cal.cal_id |
@@ -2362,7 +2362,7 @@ discard block |
||
2362 | 2362 | $enddate->modify(($event['end'] - $event['start']).' second'); |
2363 | 2363 | if (($range_end = $enddate->format('server')) != $event['range_end']) |
2364 | 2364 | { |
2365 | - $GLOBALS['egw_setup']->db->update('egw_cal',array( |
|
2365 | + $GLOBALS['egw_setup']->db->update('egw_cal', array( |
|
2366 | 2366 | 'range_end' => $range_end, |
2367 | 2367 | 'cal_etag=cal_etag+1', |
2368 | 2368 | 'cal_modified' => time(), |
@@ -2372,7 +2372,7 @@ discard block |
||
2372 | 2372 | //error_log(__FUNCTION__."() #$event[id], start=".date('Y-m-d H:i:s', $event['start']).', end='.date('Y-m-d H:i:s', $event['end']).', range_end='.date('Y-m-d H:i:s', $event['recur_enddate']).' --> '.date('Y-m-d H:i:s', $range_end)); |
2373 | 2373 | } |
2374 | 2374 | } |
2375 | - return $GLOBALS['setup_info']['calendar']['currentver'] = '14.2.002'; // skip 14.2.001 update, as query is fixed now |
|
2375 | + return $GLOBALS['setup_info']['calendar']['currentver'] = '14.2.002'; // skip 14.2.001 update, as query is fixed now |
|
2376 | 2376 | } |
2377 | 2377 | |
2378 | 2378 | /** |
@@ -2396,7 +2396,7 @@ discard block |
||
2396 | 2396 | // if maximum is bigger then 3 |
2397 | 2397 | if ($values[1] > 3) |
2398 | 2398 | { |
2399 | - switch($GLOBALS['egw_setup']->db->Type) |
|
2399 | + switch ($GLOBALS['egw_setup']->db->Type) |
|
2400 | 2400 | { |
2401 | 2401 | case 'mysql': |
2402 | 2402 | $sql = "UPDATE egw_cal |
@@ -2446,7 +2446,7 @@ discard block |
||
2446 | 2446 | |
2447 | 2447 | function calendar_upgrade14_2_003() |
2448 | 2448 | { |
2449 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_uid',array( |
|
2449 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_uid', array( |
|
2450 | 2450 | 'type' => 'ascii', |
2451 | 2451 | 'precision' => '128', |
2452 | 2452 | 'nullable' => False, |
@@ -2458,13 +2458,13 @@ discard block |
||
2458 | 2458 | { |
2459 | 2459 | $GLOBALS['egw_setup']->db->query("UPDATE egw_cal SET cal_category='' WHERE cal_category NOT REGEXP '^[0-9,]*$'", __LINE__, __FILE__); |
2460 | 2460 | } |
2461 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_category',array( |
|
2461 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_category', array( |
|
2462 | 2462 | 'type' => 'ascii', |
2463 | 2463 | 'meta' => 'category', |
2464 | 2464 | 'precision' => '64', |
2465 | 2465 | 'comment' => 'category id(s)' |
2466 | 2466 | )); |
2467 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','caldav_name',array( |
|
2467 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'caldav_name', array( |
|
2468 | 2468 | 'type' => 'ascii', |
2469 | 2469 | 'precision' => '128', |
2470 | 2470 | 'comment' => 'name part of CalDAV URL, if specified by client' |
@@ -2521,22 +2521,22 @@ discard block |
||
2521 | 2521 | 'type' => 'auto', |
2522 | 2522 | 'nullable' => False |
2523 | 2523 | ));*/ |
2524 | - $GLOBALS['egw_setup']->oProc->RefreshTable('egw_cal_user',array( |
|
2524 | + $GLOBALS['egw_setup']->oProc->RefreshTable('egw_cal_user', array( |
|
2525 | 2525 | 'fd' => array( |
2526 | - 'cal_id' => array('type' => 'int','precision' => '4','nullable' => False), |
|
2527 | - 'cal_recur_date' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False,'default' => '0'), |
|
2528 | - 'cal_user_type' => array('type' => 'ascii','precision' => '1','nullable' => False,'default' => 'u','comment' => 'u=user, g=group, c=contact, r=resource, e=email'), |
|
2529 | - 'cal_user_id' => array('type' => 'varchar','meta' => array("cal_user_type='u'" => 'account'),'precision' => '128','nullable' => False,'comment' => 'id or email-address for type=e'), |
|
2530 | - 'cal_status' => array('type' => 'ascii','precision' => '1','default' => 'A','comment' => 'U=unknown, A=accepted, R=rejected, T=tentative'), |
|
2531 | - 'cal_quantity' => array('type' => 'int','precision' => '4','default' => '1','comment' => 'only for certain types (eg. resources)'), |
|
2532 | - 'cal_role' => array('type' => 'ascii','precision' => '64','default' => 'REQ-PARTICIPANT','comment' => 'CHAIR, REQ-PARTICIPANT, OPT-PARTICIPANT, NON-PARTICIPANT, X-CAT-$cat_id'), |
|
2533 | - 'cal_user_modified' => array('type' => 'timestamp','default' => 'current_timestamp','comment' => 'automatic timestamp of last update'), |
|
2534 | - 'cal_user_auto' => array('type' => 'auto','nullable' => False) |
|
2526 | + 'cal_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
2527 | + 'cal_recur_date' => array('type' => 'int', 'meta' => 'timestamp', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
2528 | + 'cal_user_type' => array('type' => 'ascii', 'precision' => '1', 'nullable' => False, 'default' => 'u', 'comment' => 'u=user, g=group, c=contact, r=resource, e=email'), |
|
2529 | + 'cal_user_id' => array('type' => 'varchar', 'meta' => array("cal_user_type='u'" => 'account'), 'precision' => '128', 'nullable' => False, 'comment' => 'id or email-address for type=e'), |
|
2530 | + 'cal_status' => array('type' => 'ascii', 'precision' => '1', 'default' => 'A', 'comment' => 'U=unknown, A=accepted, R=rejected, T=tentative'), |
|
2531 | + 'cal_quantity' => array('type' => 'int', 'precision' => '4', 'default' => '1', 'comment' => 'only for certain types (eg. resources)'), |
|
2532 | + 'cal_role' => array('type' => 'ascii', 'precision' => '64', 'default' => 'REQ-PARTICIPANT', 'comment' => 'CHAIR, REQ-PARTICIPANT, OPT-PARTICIPANT, NON-PARTICIPANT, X-CAT-$cat_id'), |
|
2533 | + 'cal_user_modified' => array('type' => 'timestamp', 'default' => 'current_timestamp', 'comment' => 'automatic timestamp of last update'), |
|
2534 | + 'cal_user_auto' => array('type' => 'auto', 'nullable' => False) |
|
2535 | 2535 | ), |
2536 | 2536 | 'pk' => array('cal_user_auto'), |
2537 | 2537 | 'fk' => array(), |
2538 | - 'ix' => array('cal_user_modified',array('cal_user_type','cal_user_id')), |
|
2539 | - 'uc' => array(array('cal_id','cal_recur_date','cal_user_type','cal_user_id')) |
|
2538 | + 'ix' => array('cal_user_modified', array('cal_user_type', 'cal_user_id')), |
|
2539 | + 'uc' => array(array('cal_id', 'cal_recur_date', 'cal_user_type', 'cal_user_id')) |
|
2540 | 2540 | )); |
2541 | 2541 | |
2542 | 2542 | return $GLOBALS['setup_info']['calendar']['currentver'] = '14.2.005'; |
@@ -2545,12 +2545,12 @@ discard block |
||
2545 | 2545 | |
2546 | 2546 | function calendar_upgrade14_2_005() |
2547 | 2547 | { |
2548 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_timezones','tz_tzid',array( |
|
2548 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_timezones', 'tz_tzid', array( |
|
2549 | 2549 | 'type' => 'ascii', |
2550 | 2550 | 'precision' => '128', |
2551 | 2551 | 'nullable' => False |
2552 | 2552 | )); |
2553 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_timezones','tz_component',array( |
|
2553 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_timezones', 'tz_component', array( |
|
2554 | 2554 | 'type' => 'ascii', |
2555 | 2555 | 'precision' => '8192', |
2556 | 2556 | 'comment' => 'iCal VTIMEZONE component' |
@@ -2566,7 +2566,7 @@ discard block |
||
2566 | 2566 | */ |
2567 | 2567 | function calendar_upgrade14_3() |
2568 | 2568 | { |
2569 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user','cal_user_attendee',array( |
|
2569 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user', 'cal_user_attendee', array( |
|
2570 | 2570 | 'type' => 'varchar', |
2571 | 2571 | 'precision' => '255', |
2572 | 2572 | 'comment' => 'email or json object with attr. cn, url, ...' |
@@ -2577,12 +2577,12 @@ discard block |
||
2577 | 2577 | |
2578 | 2578 | // delete all but one row, which would give a doublicate key, after above normalising of email addresses |
2579 | 2579 | // by ordering by status we prever accepted over tentative over unknow over deleted |
2580 | - foreach($GLOBALS['egw_setup']->db->select('egw_cal_user', "cal_id,cal_recur_date,$email AS email", array( |
|
2580 | + foreach ($GLOBALS['egw_setup']->db->select('egw_cal_user', "cal_id,cal_recur_date,$email AS email", array( |
|
2581 | 2581 | 'cal_user_type' => 'e', |
2582 | 2582 | ), __LINE__, __FILE__, false, "GROUP BY cal_id,cal_recur_date,$email HAVING COUNT(*)>1", 'calendar') as $row) |
2583 | 2583 | { |
2584 | 2584 | $n = 0; |
2585 | - foreach($GLOBALS['egw_setup']->db->select('egw_cal_user', "*,$email AS email", array( |
|
2585 | + foreach ($GLOBALS['egw_setup']->db->select('egw_cal_user', "*,$email AS email", array( |
|
2586 | 2586 | 'cal_id' => $row['cal_id'], |
2587 | 2587 | 'cal_recur_date' => $row['cal_recur_date'], |
2588 | 2588 | 'cal_user_type' => 'e', |
@@ -2590,7 +2590,7 @@ discard block |
||
2590 | 2590 | ), __LINE__, __FILE__, false, 'ORDER BY cal_status', 'calendar') as $user) // order A, T, U, X |
2591 | 2591 | { |
2592 | 2592 | if (strpos($user['email'], '@') !== false && !$n++) continue; |
2593 | - $GLOBALS['egw_setup']->db->delete('egw_cal_user', array_intersect_key($user, array_flip(array('cal_id','cal_recur_date','cal_user_type','cal_user_id','cal_status')))); |
|
2593 | + $GLOBALS['egw_setup']->db->delete('egw_cal_user', array_intersect_key($user, array_flip(array('cal_id', 'cal_recur_date', 'cal_user_type', 'cal_user_id', 'cal_status')))); |
|
2594 | 2594 | } |
2595 | 2595 | } |
2596 | 2596 | |
@@ -2599,7 +2599,7 @@ discard block |
||
2599 | 2599 | "UPDATE egw_cal_user SET cal_user_attendee=cal_user_id,cal_user_id=MD5($email) WHERE cal_user_type='e'", |
2600 | 2600 | __LINE__, __FILE__); |
2601 | 2601 | |
2602 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_user_id',array( |
|
2602 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_user_id', array( |
|
2603 | 2603 | 'type' => 'ascii', |
2604 | 2604 | 'meta' => array( |
2605 | 2605 | "cal_user_type='u'" => 'account' |
@@ -2619,7 +2619,7 @@ discard block |
||
2619 | 2619 | */ |
2620 | 2620 | function calendar_upgrade14_3_001() |
2621 | 2621 | { |
2622 | - foreach($GLOBALS['egw_setup']->db->query("SELECT egw_cal_user.cal_id AS cal_id,egw_cal_user.cal_user_id AS cal_user_id,egw_cal_user.cal_user_attendee AS cal_user_attendee |
|
2622 | + foreach ($GLOBALS['egw_setup']->db->query("SELECT egw_cal_user.cal_id AS cal_id,egw_cal_user.cal_user_id AS cal_user_id,egw_cal_user.cal_user_attendee AS cal_user_attendee |
|
2623 | 2623 | FROM egw_cal_user |
2624 | 2624 | JOIN egw_cal_user euser ON euser.cal_id=egw_cal_user.cal_id AND euser.cal_user_type='e' AND euser.cal_user_id=egw_cal_user.cal_user_id AND euser.cal_user_attendee IS NULL |
2625 | 2625 | WHERE egw_cal_user.cal_user_type='e' AND egw_cal_user.cal_user_attendee IS NOT NULL |