@@ -224,7 +224,7 @@ |
||
| 224 | 224 | |
| 225 | 225 | if ($show_links != 'none' && $show_links != 'no_describtion' && |
| 226 | 226 | $link['link_id'] != $info['info_link_id'] && |
| 227 | - ($link['app'] != $action || $link['id'] != $action_id) && |
|
| 227 | + ($link['app'] != $action || $link['id'] != $action_id) && |
|
| 228 | 228 | ($show_links == 'all' || ($show_links == 'links') === ($link['app'] != egw_link::VFS_APPNAME))) |
| 229 | 229 | { |
| 230 | 230 | $info['filelinks'][] = $link; |
@@ -48,32 +48,32 @@ discard block |
||
| 48 | 48 | * |
| 49 | 49 | * @var string |
| 50 | 50 | */ |
| 51 | - var $duration_format = ','; // comma is necessary! |
|
| 51 | + var $duration_format = ','; // comma is necessary! |
|
| 52 | 52 | |
| 53 | 53 | var $icons = array( |
| 54 | 54 | 'type' => array( |
| 55 | - 'task' => 'task.gif', 'task_alt' => 'Task', |
|
| 56 | - 'phone' => 'phone.gif', 'phone_alt' => 'Phonecall', |
|
| 57 | - 'note' => 'note.gif', 'note_alt' => 'Note', |
|
| 58 | - 'confirm' => 'confirm.gif', 'confirm_alt' => 'Confirmation', |
|
| 59 | - 'reject' => 'reject.gif', 'reject_alt' => 'Reject', |
|
| 60 | - 'email' => 'email.gif', 'email_alt' => 'Email' ), |
|
| 55 | + 'task' => 'task.gif', 'task_alt' => 'Task', |
|
| 56 | + 'phone' => 'phone.gif', 'phone_alt' => 'Phonecall', |
|
| 57 | + 'note' => 'note.gif', 'note_alt' => 'Note', |
|
| 58 | + 'confirm' => 'confirm.gif', 'confirm_alt' => 'Confirmation', |
|
| 59 | + 'reject' => 'reject.gif', 'reject_alt' => 'Reject', |
|
| 60 | + 'email' => 'email.gif', 'email_alt' => 'Email' ), |
|
| 61 | 61 | 'action' => array( |
| 62 | - 'new' => 'new.gif', 'new_alt' => 'Add Sub', |
|
| 63 | - 'view' => 'view.gif', 'view_alt' => 'View Subs', |
|
| 64 | - 'parent' => 'parent.gif', 'parent_alt' => 'View other Subs', |
|
| 65 | - 'edit' => 'edit.gif', 'edit_alt' => 'Edit', |
|
| 66 | - 'addfile' => 'addfile.gif', 'addfile_alt' => 'Add a file', |
|
| 67 | - 'delete' => 'delete.gif', 'delete_alt' => 'Delete', |
|
| 68 | - 'close' => 'done.gif', 'close_alt' => 'Close' , |
|
| 69 | - 'close_all' => 'done_all.gif', 'close_all_alt' => 'Close' ), |
|
| 62 | + 'new' => 'new.gif', 'new_alt' => 'Add Sub', |
|
| 63 | + 'view' => 'view.gif', 'view_alt' => 'View Subs', |
|
| 64 | + 'parent' => 'parent.gif', 'parent_alt' => 'View other Subs', |
|
| 65 | + 'edit' => 'edit.gif', 'edit_alt' => 'Edit', |
|
| 66 | + 'addfile' => 'addfile.gif', 'addfile_alt' => 'Add a file', |
|
| 67 | + 'delete' => 'delete.gif', 'delete_alt' => 'Delete', |
|
| 68 | + 'close' => 'done.gif', 'close_alt' => 'Close', |
|
| 69 | + 'close_all' => 'done_all.gif', 'close_all_alt' => 'Close' ), |
|
| 70 | 70 | 'status' => array( |
| 71 | - 'billed' => 'billed.gif', 'billed_alt' => 'billed', |
|
| 72 | - 'done' => 'done.gif', 'done_alt' => 'done', |
|
| 71 | + 'billed' => 'billed.gif', 'billed_alt' => 'billed', |
|
| 72 | + 'done' => 'done.gif', 'done_alt' => 'done', |
|
| 73 | 73 | 'will-call' => 'will-call.gif', 'will-call_alt' => 'will-call', |
| 74 | - 'call' => 'call.gif', 'call_alt' => 'call', |
|
| 75 | - 'ongoing' => 'ongoing.gif', 'ongoing_alt' => 'ongoing', |
|
| 76 | - 'offer' => 'offer.gif', 'offer_alt' => 'offer' ) |
|
| 74 | + 'call' => 'call.gif', 'call_alt' => 'call', |
|
| 75 | + 'ongoing' => 'ongoing.gif', 'ongoing_alt' => 'ongoing', |
|
| 76 | + 'offer' => 'offer.gif', 'offer_alt' => 'offer' ) |
|
| 77 | 77 | ); |
| 78 | 78 | var $filters; |
| 79 | 79 | var $messages = array( |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | if ($GLOBALS['egw_info']['flags']['currentapp'] != 'infolog') translation::add_app('infolog'); |
| 94 | 94 | |
| 95 | 95 | // Make sure Global category is infolog - on first load, it may not be |
| 96 | - if($GLOBALS['egw_info']['flags']['currentapp'] == 'infolog' && !$GLOBALS['egw']->categories->app_name) |
|
| 96 | + if ($GLOBALS['egw_info']['flags']['currentapp'] == 'infolog' && !$GLOBALS['egw']->categories->app_name) |
|
| 97 | 97 | { |
| 98 | 98 | $GLOBALS['egw']->categories = new categories(); |
| 99 | 99 | } |
@@ -104,18 +104,18 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | $this->user = $GLOBALS['egw_info']['user']['account_id']; |
| 106 | 106 | |
| 107 | - $this->prefs =& $GLOBALS['egw_info']['user']['preferences']['infolog']; |
|
| 107 | + $this->prefs = & $GLOBALS['egw_info']['user']['preferences']['infolog']; |
|
| 108 | 108 | |
| 109 | 109 | // read the duration format from project-manager |
| 110 | 110 | if ($GLOBALS['egw_info']['apps']['projectmanager']) |
| 111 | 111 | { |
| 112 | 112 | $pm_config = config::read('projectmanager'); |
| 113 | - $this->duration_format = str_replace(',','',implode('', (array)$pm_config['duration_units'])); |
|
| 113 | + $this->duration_format = str_replace(',', '', implode('', (array)$pm_config['duration_units'])); |
|
| 114 | 114 | //error_log(__METHOD__."() ".__LINE__." duration_format=$this->duration_format, duration_unit=".array2string($pm_config['duration_units'])); |
| 115 | 115 | $this->hours_per_workday = $pm_config['hours_per_workday']; |
| 116 | 116 | unset($pm_config); |
| 117 | 117 | } |
| 118 | - $this->filters =& $this->bo->filters; |
|
| 118 | + $this->filters = & $this->bo->filters; |
|
| 119 | 119 | /* these are just for testing of the notifications |
| 120 | 120 | for($i = -1; $i <= 3; ++$i) |
| 121 | 121 | { |
@@ -134,12 +134,12 @@ discard block |
||
| 134 | 134 | $this->filters['responsible-open-date'.date('Y-m-d',time()+$i*24*60*60)] = "responsible starting in $i day(s)"; |
| 135 | 135 | } |
| 136 | 136 | */ |
| 137 | - $GLOBALS['infolog_ui'] =& $this; // make ourself availible for ExecMethod of get_rows function |
|
| 137 | + $GLOBALS['infolog_ui'] = & $this; // make ourself availible for ExecMethod of get_rows function |
|
| 138 | 138 | |
| 139 | 139 | // can be removed for next release / infolog update |
| 140 | - if (!$GLOBALS['egw']->hooks->hook_exists('calendar_set','infolog')) |
|
| 140 | + if (!$GLOBALS['egw']->hooks->hook_exists('calendar_set', 'infolog')) |
|
| 141 | 141 | { |
| 142 | - $GLOBALS['egw']->hooks->register_single_app_hook('infolog','calendar_set'); |
|
| 142 | + $GLOBALS['egw']->hooks->register_single_app_hook('infolog', 'calendar_set'); |
|
| 143 | 143 | } |
| 144 | 144 | } |
| 145 | 145 | |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | * @param int $details |
| 155 | 155 | * @return array |
| 156 | 156 | */ |
| 157 | - function get_info($info,&$readonlys,$action='',$action_id='',$show_links=false,$details = 1) |
|
| 157 | + function get_info($info, &$readonlys, $action = '', $action_id = '', $show_links = false, $details = 1) |
|
| 158 | 158 | { |
| 159 | 159 | if (!is_array($info)) |
| 160 | 160 | { |
@@ -164,19 +164,19 @@ discard block |
||
| 164 | 164 | $done = $info['info_status'] == 'done' || $info['info_status'] == 'billed' || $info['info_status'] == 'cancelled'; //cancelled is regarded as a completed status as well in bo |
| 165 | 165 | // regard an infolog as done/billed/cancelled if its percentage is 100% when there is to status like the above for that type |
| 166 | 166 | if (!$done && !isset($this->bo->status[$info['info_type']]['done']) && !isset($this->bo->status[$info['info_type']]['billed']) && |
| 167 | - !isset($this->bo->status[$info['info_type']]['cancelled']) && (int)$info['info_percent']==100) $done = true ; |
|
| 168 | - $info['sub_class'] = $this->bo->enums['priority'][$info['info_priority']] . ($done ? '_done' : ''); |
|
| 167 | + !isset($this->bo->status[$info['info_type']]['cancelled']) && (int)$info['info_percent'] == 100) $done = true; |
|
| 168 | + $info['sub_class'] = $this->bo->enums['priority'][$info['info_priority']].($done ? '_done' : ''); |
|
| 169 | 169 | if (!$done && $info['info_enddate'] < $this->bo->user_time_now) |
| 170 | 170 | { |
| 171 | 171 | $info['end_class'] = 'infolog_overdue'; |
| 172 | 172 | } |
| 173 | 173 | if (!isset($info['info_anz_subs'])) $info['info_anz_subs'] = $this->bo->anzSubs($id); |
| 174 | - $this->bo->link_id2from($info,$action,$action_id); // unset from for $action:$action_id |
|
| 175 | - $info['info_percent'] = (int) $info['info_percent'].'%'; |
|
| 176 | - $editrights = $this->bo->check_access($info,EGW_ACL_EDIT); |
|
| 174 | + $this->bo->link_id2from($info, $action, $action_id); // unset from for $action:$action_id |
|
| 175 | + $info['info_percent'] = (int)$info['info_percent'].'%'; |
|
| 176 | + $editrights = $this->bo->check_access($info, EGW_ACL_EDIT); |
|
| 177 | 177 | $isresposible = $this->bo->is_responsible($info); |
| 178 | 178 | if ((!($editrights || // edit rights or more then standard responsible rights |
| 179 | - $isresposible && array_diff($this->bo->responsible_edit,array('info_status','info_percent','info_datecompleted'))))) |
|
| 179 | + $isresposible && array_diff($this->bo->responsible_edit, array('info_status', 'info_percent', 'info_datecompleted'))))) |
|
| 180 | 180 | { |
| 181 | 181 | $info['class'] .= 'rowNoEdit '; |
| 182 | 182 | } |
@@ -195,11 +195,11 @@ discard block |
||
| 195 | 195 | { |
| 196 | 196 | $info['class'] .= 'rowNoCloseAll '; |
| 197 | 197 | } |
| 198 | - if (!$this->bo->check_access($info,EGW_ACL_DELETE)) |
|
| 198 | + if (!$this->bo->check_access($info, EGW_ACL_DELETE)) |
|
| 199 | 199 | { |
| 200 | 200 | $info['class'] .= 'rowNoDelete '; |
| 201 | 201 | } |
| 202 | - if (!$this->bo->check_access($info,EGW_ACL_ADD)) |
|
| 202 | + if (!$this->bo->check_access($info, EGW_ACL_ADD)) |
|
| 203 | 203 | { |
| 204 | 204 | $info['class'] .= 'rowNoSubs '; |
| 205 | 205 | } |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | if (!$show_links) $show_links = $this->prefs['show_links']; |
| 212 | 212 | if (($show_links != 'none' && $show_links != 'no_describtion' || |
| 213 | 213 | $this->prefs['show_times'] || isset($GLOBALS['egw_info']['user']['apps']['timesheet'])) && |
| 214 | - (isset($info['links']) || ($info['links'] = egw_link::get_links('infolog',$info['info_id'],'','link_lastmod DESC',true,true)))) |
|
| 214 | + (isset($info['links']) || ($info['links'] = egw_link::get_links('infolog', $info['info_id'], '', 'link_lastmod DESC', true, true)))) |
|
| 215 | 215 | { |
| 216 | 216 | $timesheets = array(); |
| 217 | 217 | foreach ($info['links'] as $link) |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | $link_mod = egw_time::server2user($link['lastmod']); |
| 221 | 221 | if ($info['row_mod'] < $link_mod) $info['row_mod'] = $link_mod; |
| 222 | 222 | |
| 223 | - if ($link['deleted']) continue; // skip deleted links, but incl. them in row_mod! |
|
| 223 | + if ($link['deleted']) continue; // skip deleted links, but incl. them in row_mod! |
|
| 224 | 224 | |
| 225 | 225 | if ($show_links != 'none' && $show_links != 'no_describtion' && |
| 226 | 226 | $link['link_id'] != $info['info_link_id'] && |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | } |
| 238 | 238 | if ($this->prefs['show_times'] && isset($GLOBALS['egw_info']['user']['apps']['timesheet']) && $timesheets) |
| 239 | 239 | { |
| 240 | - $sum = ExecMethod('timesheet.timesheet_bo.sum',$timesheets); |
|
| 240 | + $sum = ExecMethod('timesheet.timesheet_bo.sum', $timesheets); |
|
| 241 | 241 | $info['info_sum_timesheets'] = $sum['duration']; |
| 242 | 242 | // incl. max timesheet modification in row_mod |
| 243 | 243 | if ($info['row_mod'] < $sum['max_modified']) $info['row_mod'] = $sum['max_modified']; |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | } |
| 256 | 256 | $readonlys["edit_percent[$id]"] = true; |
| 257 | 257 | } |
| 258 | - elseif($readonlys["edit_percent[$id]"]) // show percent, but button is switched off |
|
| 258 | + elseif ($readonlys["edit_percent[$id]"]) // show percent, but button is switched off |
|
| 259 | 259 | { |
| 260 | 260 | $info['info_percent2'] = $info['info_percent']; |
| 261 | 261 | } |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | protected static function filter(array $query) |
| 277 | 277 | { |
| 278 | 278 | $filter = $query['filter'] ? 'filter' : ($query['cat_id'] ? 'cat_id' : null); |
| 279 | - foreach((array)$query['col_filter'] as $name => $value) |
|
| 279 | + foreach ((array)$query['col_filter'] as $name => $value) |
|
| 280 | 280 | { |
| 281 | 281 | if ((string)$value !== '') |
| 282 | 282 | { |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | * @param array &$readonlys |
| 297 | 297 | * @return int |
| 298 | 298 | */ |
| 299 | - function get_rows(&$query,&$rows,&$readonlys) |
|
| 299 | + function get_rows(&$query, &$rows, &$readonlys) |
|
| 300 | 300 | { |
| 301 | 301 | //error_log(__METHOD__."() query[csv_export]=".array2string($query['csv_export']).", query[filter]=".array2string($query['filter']).", query[col_filter]=".array2string(array_diff($query['col_filter'],array('',0))).' '.function_backtrace()); |
| 302 | 302 | if (!$query['csv_export']) |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | } |
| 314 | 314 | //error_log(__METHOD__."() prefs[listNoSubs]=".array2string($this->prefs['listNoSubs'])." --> parent_id=$parent_id"); |
| 315 | 315 | unset($query['col_filter']['parent_id']); |
| 316 | - if(!$query['action']) |
|
| 316 | + if (!$query['action']) |
|
| 317 | 317 | { |
| 318 | 318 | unset($query['rows']); |
| 319 | 319 | egw_cache::setSession('infolog', $query['session_for'].'session_data', $query); |
@@ -323,10 +323,10 @@ discard block |
||
| 323 | 323 | $query['row_modified'] = 'row_mod'; |
| 324 | 324 | $query['parent_id'] = 'info_id_parent'; |
| 325 | 325 | $query['is_parent'] = 'info_anz_subs'; |
| 326 | - $query['action_var'] = 'multi_action'; // as 'action' is already used in infolog |
|
| 326 | + $query['action_var'] = 'multi_action'; // as 'action' is already used in infolog |
|
| 327 | 327 | } |
| 328 | 328 | // nextmatch opened an infolog containing children --> do not filter them, always show all children |
| 329 | - elseif($query['csv_export'] === 'children') |
|
| 329 | + elseif ($query['csv_export'] === 'children') |
|
| 330 | 330 | { |
| 331 | 331 | $query['filter'] = $query['search'] = $query['cat_id'] = ''; |
| 332 | 332 | $query['col_filter'] = array('info_id_parent' => $query['col_filter']['info_id_parent']); |
@@ -346,17 +346,17 @@ discard block |
||
| 346 | 346 | $links['linked'] = array(); |
| 347 | 347 | unset($query['col_filter']['linked']); |
| 348 | 348 | } |
| 349 | - if($query['action'] && in_array($query['action'], array_keys($GLOBALS['egw_info']['apps'])) && $query['action_id']) |
|
| 349 | + if ($query['action'] && in_array($query['action'], array_keys($GLOBALS['egw_info']['apps'])) && $query['action_id']) |
|
| 350 | 350 | { |
| 351 | 351 | $link_filters['action'] = array('app'=>$query['action'], 'id' => $query['action_id']); |
| 352 | 352 | $links['action'] = array(); |
| 353 | 353 | } |
| 354 | - foreach($link_filters as $key => $link) |
|
| 354 | + foreach ($link_filters as $key => $link) |
|
| 355 | 355 | { |
| 356 | - if(!is_array($link)) |
|
| 356 | + if (!is_array($link)) |
|
| 357 | 357 | { |
| 358 | 358 | // Legacy string style |
| 359 | - list($app,$id) = explode(':',$link); |
|
| 359 | + list($app, $id) = explode(':', $link); |
|
| 360 | 360 | } |
| 361 | 361 | else |
| 362 | 362 | { |
@@ -364,25 +364,25 @@ discard block |
||
| 364 | 364 | $app = $link['app']; |
| 365 | 365 | $id = $link['id']; |
| 366 | 366 | } |
| 367 | - if(!is_array($id)) $id = explode(',',$id); |
|
| 368 | - if (!($linked = egw_link::get_links_multiple($app,$id,true,'infolog','',$query['col_filter']['info_status'] == 'deleted'))) |
|
| 367 | + if (!is_array($id)) $id = explode(',', $id); |
|
| 368 | + if (!($linked = egw_link::get_links_multiple($app, $id, true, 'infolog', '', $query['col_filter']['info_status'] == 'deleted'))) |
|
| 369 | 369 | { |
| 370 | - $rows = array(); // no infologs linked to selected link --> no rows to return |
|
| 370 | + $rows = array(); // no infologs linked to selected link --> no rows to return |
|
| 371 | 371 | return 0; |
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | |
| 375 | - foreach($linked as $infos) |
|
| 375 | + foreach ($linked as $infos) |
|
| 376 | 376 | { |
| 377 | - $links[$key] = array_merge($links[$key],$infos); |
|
| 377 | + $links[$key] = array_merge($links[$key], $infos); |
|
| 378 | 378 | } |
| 379 | 379 | $links[$key] = array_unique($links[$key]); |
| 380 | - if($key == 'linked') |
|
| 380 | + if ($key == 'linked') |
|
| 381 | 381 | { |
| 382 | 382 | $linked = array('app' => $app, 'id' => $id, 'title' => (count($id) == 1 ? egw_link::title($app, $id) : lang('multiple'))); |
| 383 | 383 | } |
| 384 | 384 | } |
| 385 | - if(count($links)) |
|
| 385 | + if (count($links)) |
|
| 386 | 386 | { |
| 387 | 387 | $query['col_filter']['info_id'] = count($links) > 1 ? call_user_func_array('array_intersect', $links) : $links[$key]; |
| 388 | 388 | } |
@@ -391,7 +391,7 @@ discard block |
||
| 391 | 391 | $old_template = $query['template']; |
| 392 | 392 | |
| 393 | 393 | // Reset custom, type-specific template if type was cleared (without changing it for home) |
| 394 | - if(!$query['template'] || stripos($query['template'], 'infolog.index.rows') === 0) |
|
| 394 | + if (!$query['template'] || stripos($query['template'], 'infolog.index.rows') === 0) |
|
| 395 | 395 | { |
| 396 | 396 | $query['template'] = 'infolog.index.rows'; |
| 397 | 397 | } |
@@ -402,10 +402,10 @@ discard block |
||
| 402 | 402 | if ($tpl->read('infolog.index.rows.'.$query['col_filter']['info_type'])) |
| 403 | 403 | { |
| 404 | 404 | $query['template'] = $tpl->name; |
| 405 | - $query['custom_fields'] = true; // read the custom fields too |
|
| 405 | + $query['custom_fields'] = true; // read the custom fields too |
|
| 406 | 406 | } |
| 407 | 407 | // If status is not valid for selected type, clear status filter |
| 408 | - if($query['col_filter']['info_status'] && $query['col_filter']['info_status'] != 'deleted' && |
|
| 408 | + if ($query['col_filter']['info_status'] && $query['col_filter']['info_status'] != 'deleted' && |
|
| 409 | 409 | !in_array($query['col_filter']['info_status'], array_keys($this->bo->status[$query['col_filter']['info_type']]))) |
| 410 | 410 | { |
| 411 | 411 | $query['col_filter']['info_status'] = ''; |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | } |
| 414 | 414 | } |
| 415 | 415 | // Template change forces the UI to do a full update first, no point in getting rows right now |
| 416 | - if($old_template && $old_template != $query['template']) return 0; |
|
| 416 | + if ($old_template && $old_template != $query['template']) return 0; |
|
| 417 | 417 | |
| 418 | 418 | // do we need to read the custom fields, depends on the column is enabled and customfields exist, prefs are filter specific |
| 419 | 419 | // so we have to check that as well |
@@ -426,14 +426,14 @@ discard block |
||
| 426 | 426 | |
| 427 | 427 | if (!$query['selectcols'] && $columselection) |
| 428 | 428 | { |
| 429 | - $columselection = is_array($columselection) ? $columselection : explode(',',$columselection); |
|
| 429 | + $columselection = is_array($columselection) ? $columselection : explode(',', $columselection); |
|
| 430 | 430 | } |
| 431 | 431 | else |
| 432 | 432 | { |
| 433 | - $columselection = $query['selectcols'] ? (is_array($query['selectcols']) ? $query['selectcols'] : explode(',',$query['selectcols'])) : array(); |
|
| 433 | + $columselection = $query['selectcols'] ? (is_array($query['selectcols']) ? $query['selectcols'] : explode(',', $query['selectcols'])) : array(); |
|
| 434 | 434 | } |
| 435 | 435 | // do we need to query the cf's |
| 436 | - $query['custom_fields'] = $this->bo->customfields && (!$columselection || in_array('customfields',$columselection)); |
|
| 436 | + $query['custom_fields'] = $this->bo->customfields && (!$columselection || in_array('customfields', $columselection)); |
|
| 437 | 437 | |
| 438 | 438 | $infos = $this->bo->search($query); |
| 439 | 439 | $query['col_filter'] = $orginal_colfilter; |
@@ -451,12 +451,12 @@ discard block |
||
| 451 | 451 | $query['default_cols'] = '!cat_id,info_datemodified,info_used_time_info_planned_time,info_used_time_info_planned_time_info_replanned_time,info_id'; |
| 452 | 452 | } |
| 453 | 453 | // set old show_times pref, that get_info calculates the cumulated time of the timesheets (we only check used&planned to work for both time cols) |
| 454 | - $this->prefs['show_times'] = strpos($this->prefs[$query['columnselection_pref']],'info_used_time_info_planned_time') !== false; |
|
| 454 | + $this->prefs['show_times'] = strpos($this->prefs[$query['columnselection_pref']], 'info_used_time_info_planned_time') !== false; |
|
| 455 | 455 | |
| 456 | 456 | // query all links and sub counts in one go |
| 457 | 457 | if ($infos && (!$query['csv_export'] || !is_array($query['csv_export']))) |
| 458 | 458 | { |
| 459 | - $links = egw_link::get_links_multiple('infolog',array_keys($infos),true,'','link_lastmod DESC',true); // true=incl. deleted |
|
| 459 | + $links = egw_link::get_links_multiple('infolog', array_keys($infos), true, '', 'link_lastmod DESC', true); // true=incl. deleted |
|
| 460 | 460 | $anzSubs = $this->bo->anzSubs(array_keys($infos)); |
| 461 | 461 | } |
| 462 | 462 | $rows = array(); |
@@ -467,27 +467,27 @@ discard block |
||
| 467 | 467 | $parents = $query['action'] == 'sp' && $query['action_id'] ? (array)$query['action_id'] : array(); |
| 468 | 468 | if (count($parents) == 1 && is_array($query['action_id'])) |
| 469 | 469 | { |
| 470 | - $query['action_id'] = array_shift($query['action_id']); // display single parent as app_header |
|
| 470 | + $query['action_id'] = array_shift($query['action_id']); // display single parent as app_header |
|
| 471 | 471 | } |
| 472 | 472 | } |
| 473 | 473 | |
| 474 | 474 | $parent_first = count($parents) == 1; |
| 475 | 475 | $parent_index = 0; |
| 476 | 476 | // et2 nextmatch listens to total, and only displays that many rows, so add parent in or we'll lose the last row |
| 477 | - if($parent_first || $query['action'] == 'sp' && is_array($query['action_id'])) $query['total']++; |
|
| 477 | + if ($parent_first || $query['action'] == 'sp' && is_array($query['action_id'])) $query['total']++; |
|
| 478 | 478 | |
| 479 | 479 | // Check to see if we need to remove description |
| 480 | - foreach($infos as $id => $info) |
|
| 480 | + foreach ($infos as $id => $info) |
|
| 481 | 481 | { |
| 482 | - if (!(strpos($info['info_addr'],',')===false) && strpos($info['info_addr'],', ')===false) $info['info_addr'] = str_replace(',',', ',$info['info_addr']); |
|
| 482 | + if (!(strpos($info['info_addr'], ',') === false) && strpos($info['info_addr'], ', ') === false) $info['info_addr'] = str_replace(',', ', ', $info['info_addr']); |
|
| 483 | 483 | if (!$query['csv_export'] || !is_array($query['csv_export'])) |
| 484 | 484 | { |
| 485 | - $info['links'] =& $links[$id]; |
|
| 485 | + $info['links'] = & $links[$id]; |
|
| 486 | 486 | $info['info_anz_subs'] = (int)$anzSubs[$id]; |
| 487 | - $info = $this->get_info($info,$readonlys,null,null,false,$details); |
|
| 487 | + $info = $this->get_info($info, $readonlys, null, null, false, $details); |
|
| 488 | 488 | } |
| 489 | 489 | // for subs view ('sp') add parent(s) in front of subs once(!) |
| 490 | - if ( $parent_first && ($main = $this->bo->read($query['action_id'])) || |
|
| 490 | + if ($parent_first && ($main = $this->bo->read($query['action_id'])) || |
|
| 491 | 491 | $parents && ($parent_index = array_search($info['info_id_parent'], $parents)) !== false && |
| 492 | 492 | ($main = $this->bo->read($info['info_id_parent']))) |
| 493 | 493 | { |
@@ -497,11 +497,11 @@ discard block |
||
| 497 | 497 | // as read() always read them all, while search() only reads the selected ones |
| 498 | 498 | if ($query['custom_fields']) |
| 499 | 499 | { |
| 500 | - foreach($columselection as $col) |
|
| 500 | + foreach ($columselection as $col) |
|
| 501 | 501 | { |
| 502 | 502 | if ($col[0] == '#') |
| 503 | 503 | { |
| 504 | - foreach(array_keys($main) as $n) |
|
| 504 | + foreach (array_keys($main) as $n) |
|
| 505 | 505 | { |
| 506 | 506 | if ($n[0] == '#' && !in_array($n, $columselection)) unset($main[$n]); |
| 507 | 507 | } |
@@ -510,7 +510,7 @@ discard block |
||
| 510 | 510 | } |
| 511 | 511 | } |
| 512 | 512 | $parent_first = false; |
| 513 | - if($query['start'] == 0) |
|
| 513 | + if ($query['start'] == 0) |
|
| 514 | 514 | { |
| 515 | 515 | array_splice($rows, $id, 0, array($main)); |
| 516 | 516 | unset($parents[$parent_index]); |
@@ -523,7 +523,7 @@ discard block |
||
| 523 | 523 | if ($query['cat_id']) $rows['no_cat_id'] = true; |
| 524 | 524 | if ($query['no_actions']) $rows['no_actions'] = true; |
| 525 | 525 | $rows['no_timesheet'] = !isset($GLOBALS['egw_info']['user']['apps']['timesheet']); |
| 526 | - if($clear_status_filter) |
|
| 526 | + if ($clear_status_filter) |
|
| 527 | 527 | { |
| 528 | 528 | $rows['info_status'] = ''; |
| 529 | 529 | } |
@@ -555,13 +555,13 @@ discard block |
||
| 555 | 555 | $GLOBALS['egw_info']['flags']['app_header'] .= ' - '.lang($this->filters[$query['filter']]); |
| 556 | 556 | } |
| 557 | 557 | if ($query['action'] && ($title = $query['action_title'] || is_array($query['action_id']) ? |
| 558 | - $query['action_title'] : egw_link::title($query['action']=='sp'?'infolog':$query['action'],$query['action_id']))) |
|
| 558 | + $query['action_title'] : egw_link::title($query['action'] == 'sp' ? 'infolog' : $query['action'], $query['action_id']))) |
|
| 559 | 559 | { |
| 560 | 560 | $GLOBALS['egw_info']['flags']['app_header'] .= ': '.$title; |
| 561 | 561 | } |
| 562 | 562 | } |
| 563 | 563 | |
| 564 | - if (isset($linked)) $query['col_filter']['linked'] = $linked; // add linked back to the colfilter |
|
| 564 | + if (isset($linked)) $query['col_filter']['linked'] = $linked; // add linked back to the colfilter |
|
| 565 | 565 | |
| 566 | 566 | return $query['total']; |
| 567 | 567 | } |
@@ -580,7 +580,7 @@ discard block |
||
| 580 | 580 | { |
| 581 | 581 | if ($info['info_cat']) $set['cat_id'] = $info['info_cat']; |
| 582 | 582 | |
| 583 | - foreach(egw_link::get_links('infolog',$info['info_id'],'','link_lastmod DESC',true) as $link) |
|
| 583 | + foreach (egw_link::get_links('infolog', $info['info_id'], '', 'link_lastmod DESC', true) as $link) |
|
| 584 | 584 | { |
| 585 | 585 | if ($link['app'] != 'timesheet' && $link['app'] != egw_link::VFS_APPNAME) |
| 586 | 586 | { |
@@ -605,7 +605,7 @@ discard block |
||
| 605 | 605 | { |
| 606 | 606 | return $data; |
| 607 | 607 | } |
| 608 | - $event = array_merge($data,array( |
|
| 608 | + $event = array_merge($data, array( |
|
| 609 | 609 | 'category' => $GLOBALS['egw']->categories->check_list(EGW_ACL_READ, $infolog['info_cat']), |
| 610 | 610 | 'priority' => $infolog['info_priority'] + 1, |
| 611 | 611 | 'public' => $infolog['info_access'] != 'private', |
@@ -616,7 +616,7 @@ discard block |
||
| 616 | 616 | 'end' => $infolog['info_enddate'] ? $infolog['info_enddate'] : $infolog['info_datecompleted'] |
| 617 | 617 | )); |
| 618 | 618 | unset($event['entry_id']); |
| 619 | - if (!$event['end']) $event['end'] = $event['start'] + (int) $GLOBALS['egw_info']['user']['preferences']['calendar']['defaultlength']*60; |
|
| 619 | + if (!$event['end']) $event['end'] = $event['start'] + (int)$GLOBALS['egw_info']['user']['preferences']['calendar']['defaultlength'] * 60; |
|
| 620 | 620 | |
| 621 | 621 | // Match categories by name |
| 622 | 622 | $event['category'] = $GLOBALS['egw']->categories->name2id(categories::id2name($infolog['info_cat'])); |
@@ -625,38 +625,38 @@ discard block |
||
| 625 | 625 | $event['owner'] = $user = $GLOBALS['egw_info']['user']['account_id']; |
| 626 | 626 | |
| 627 | 627 | // add/modify participants according to prefs |
| 628 | - $prefs = explode(',',$this->prefs['calendar_set'] ? $this->prefs['calendar_set'] : 'responsible,contact,user'); |
|
| 628 | + $prefs = explode(',', $this->prefs['calendar_set'] ? $this->prefs['calendar_set'] : 'responsible,contact,user'); |
|
| 629 | 629 | |
| 630 | 630 | // if no default participants (selected calendars) --> remove all |
| 631 | - if (!in_array('selected',$prefs)) |
|
| 631 | + if (!in_array('selected', $prefs)) |
|
| 632 | 632 | { |
| 633 | 633 | $event['participants'] = $event['participant_types'] = array(); |
| 634 | 634 | } |
| 635 | 635 | // Add responsible as participant |
| 636 | - if (in_array('responsible',$prefs)) |
|
| 636 | + if (in_array('responsible', $prefs)) |
|
| 637 | 637 | { |
| 638 | - foreach($infolog['info_responsible'] as $responsible) |
|
| 638 | + foreach ($infolog['info_responsible'] as $responsible) |
|
| 639 | 639 | { |
| 640 | 640 | $event['participants'][$responsible] = $event['participant_types']['u'][$responsible] = |
| 641 | - calendar_so::combine_status($user==$responsible?'A':'U'); |
|
| 641 | + calendar_so::combine_status($user == $responsible ? 'A' : 'U'); |
|
| 642 | 642 | } |
| 643 | 643 | } |
| 644 | 644 | // Add linked contact as participant |
| 645 | - if (in_array('contact',$prefs) && $infolog['info_link']['app'] == 'addressbook') |
|
| 645 | + if (in_array('contact', $prefs) && $infolog['info_link']['app'] == 'addressbook') |
|
| 646 | 646 | { |
| 647 | - $event['participants'][calendar_so::combine_user('c',$infolog['info_link']['id'])] = |
|
| 647 | + $event['participants'][calendar_so::combine_user('c', $infolog['info_link']['id'])] = |
|
| 648 | 648 | $event['participant_types']['c'][$infolog['info_link']['id']] = calendar_so::combine_status('U'); |
| 649 | 649 | } |
| 650 | - if (in_array('owner',$prefs)) |
|
| 650 | + if (in_array('owner', $prefs)) |
|
| 651 | 651 | { |
| 652 | 652 | $event['participants'][$infolog['info_owner']] = $event['participant_types']['u'][$infolog['info_owner']] = |
| 653 | - calendar_so::combine_status('A',1,'CHAIR'); |
|
| 653 | + calendar_so::combine_status('A', 1, 'CHAIR'); |
|
| 654 | 654 | } |
| 655 | 655 | // Add current user, if set or no other participants, which is not allowed |
| 656 | - if (in_array('user',$prefs)) |
|
| 656 | + if (in_array('user', $prefs)) |
|
| 657 | 657 | { |
| 658 | 658 | $event['participants'][$user] = $event['participant_types']['u'][$user] = |
| 659 | - calendar_so::combine_status('A',1,'CHAIR'); |
|
| 659 | + calendar_so::combine_status('A', 1, 'CHAIR'); |
|
| 660 | 660 | } |
| 661 | 661 | |
| 662 | 662 | // Add infolog link to calendar entry |
@@ -664,7 +664,7 @@ discard block |
||
| 664 | 664 | $event['link_id'][] = $infolog['info_link']['id']; |
| 665 | 665 | |
| 666 | 666 | // Copy infolog's links |
| 667 | - foreach(egw_link::get_links('infolog',$infolog['info_id'],'','link_lastmod DESC',true) as $link) |
|
| 667 | + foreach (egw_link::get_links('infolog', $infolog['info_id'], '', 'link_lastmod DESC', true) as $link) |
|
| 668 | 668 | { |
| 669 | 669 | if ($link['app'] != egw_link::VFS_APPNAME) |
| 670 | 670 | { |
@@ -673,7 +673,7 @@ discard block |
||
| 673 | 673 | } |
| 674 | 674 | } |
| 675 | 675 | // Copy same custom fields |
| 676 | - foreach(array_keys(config::get_customfields('calendar')) as $name) |
|
| 676 | + foreach (array_keys(config::get_customfields('calendar')) as $name) |
|
| 677 | 677 | { |
| 678 | 678 | if ($this->bo->customfields[$name]) $event['#'.$name] = $infolog['#'.$name]; |
| 679 | 679 | } |
@@ -692,9 +692,9 @@ discard block |
||
| 692 | 692 | * @param string $own_referer='' this is our own referer |
| 693 | 693 | * @param string $action_title='' app_header for the action, if '' we try the link-title |
| 694 | 694 | */ |
| 695 | - function index($values = null,$action='',$action_id='',$called_as=0,$extra_app_header=False,$return_html=False,$own_referer='',$action_title='') |
|
| 695 | + function index($values = null, $action = '', $action_id = '', $called_as = 0, $extra_app_header = False, $return_html = False, $own_referer = '', $action_title = '') |
|
| 696 | 696 | { |
| 697 | - unset($extra_app_header); // not used, but dont want to change signature |
|
| 697 | + unset($extra_app_header); // not used, but dont want to change signature |
|
| 698 | 698 | if (is_array($values)) |
| 699 | 699 | { |
| 700 | 700 | $called_as = $values['called_as']; |
@@ -703,22 +703,22 @@ discard block |
||
| 703 | 703 | elseif ($own_referer === '') |
| 704 | 704 | { |
| 705 | 705 | $own_referer = common::get_referer(); |
| 706 | - if (strpos($own_referer,'menuaction=infolog.infolog_ui.edit') !== false) |
|
| 706 | + if (strpos($own_referer, 'menuaction=infolog.infolog_ui.edit') !== false) |
|
| 707 | 707 | { |
| 708 | - $own_referer = $GLOBALS['egw']->session->appsession('own_session','infolog'); |
|
| 708 | + $own_referer = $GLOBALS['egw']->session->appsession('own_session', 'infolog'); |
|
| 709 | 709 | } |
| 710 | 710 | else |
| 711 | 711 | { |
| 712 | - $GLOBALS['egw']->session->appsession('own_session','infolog',$own_referer); |
|
| 712 | + $GLOBALS['egw']->session->appsession('own_session', 'infolog', $own_referer); |
|
| 713 | 713 | } |
| 714 | 714 | } |
| 715 | 715 | |
| 716 | 716 | // Handle legacy buttons like actions |
| 717 | - if(is_array($values)) |
|
| 717 | + if (is_array($values)) |
|
| 718 | 718 | { |
| 719 | - foreach(array('document', 'view', 'delete') as $button) |
|
| 719 | + foreach (array('document', 'view', 'delete') as $button) |
|
| 720 | 720 | { |
| 721 | - if(isset($values['nm']['rows'][$button])) |
|
| 721 | + if (isset($values['nm']['rows'][$button])) |
|
| 722 | 722 | { |
| 723 | 723 | list($id) = @each($values['nm']['rows'][$button]); |
| 724 | 724 | $values['nm']['multi_action'] = $button; |
@@ -738,27 +738,27 @@ discard block |
||
| 738 | 738 | // Some processing to add values in for links and cats |
| 739 | 739 | $multi_action = $values['nm']['multi_action']; |
| 740 | 740 | // Action has an additional action - add / delete, etc. Buttons named <multi-action>_action[action_name] |
| 741 | - if(in_array($multi_action, array('link', 'responsible'))) |
|
| 741 | + if (in_array($multi_action, array('link', 'responsible'))) |
|
| 742 | 742 | { |
| 743 | 743 | // eTemplate ignores the _popup namespace, but et2 doesn't |
| 744 | - if($values[$multi_action.'_popup']) |
|
| 744 | + if ($values[$multi_action.'_popup']) |
|
| 745 | 745 | { |
| 746 | - $popup =& $values[$multi_action.'_popup']; |
|
| 746 | + $popup = & $values[$multi_action.'_popup']; |
|
| 747 | 747 | } |
| 748 | 748 | else |
| 749 | 749 | { |
| 750 | - $popup =& $values; |
|
| 750 | + $popup = & $values; |
|
| 751 | 751 | } |
| 752 | - $values['nm']['multi_action'] .= '_' . key($popup[$multi_action . '_action']); |
|
| 753 | - if($multi_action == 'link') |
|
| 752 | + $values['nm']['multi_action'] .= '_'.key($popup[$multi_action.'_action']); |
|
| 753 | + if ($multi_action == 'link') |
|
| 754 | 754 | { |
| 755 | - $popup[$multi_action] = $popup['link']['app'] . ':'.$popup['link']['id']; |
|
| 755 | + $popup[$multi_action] = $popup['link']['app'].':'.$popup['link']['id']; |
|
| 756 | 756 | } |
| 757 | - else if(is_array($popup[$multi_action])) |
|
| 757 | + else if (is_array($popup[$multi_action])) |
|
| 758 | 758 | { |
| 759 | - $popup[$multi_action] = implode(',',$popup[$multi_action]); |
|
| 759 | + $popup[$multi_action] = implode(',', $popup[$multi_action]); |
|
| 760 | 760 | } |
| 761 | - $values['nm']['multi_action'] .= '_' . $popup[$multi_action]; |
|
| 761 | + $values['nm']['multi_action'] .= '_'.$popup[$multi_action]; |
|
| 762 | 762 | unset($values[$multi_action.'_popup']); |
| 763 | 763 | unset($values[$multi_action]); |
| 764 | 764 | } |
@@ -766,18 +766,18 @@ discard block |
||
| 766 | 766 | if ($this->action($values['nm']['multi_action'], $values['nm']['selected'], $values['nm']['select_all'], |
| 767 | 767 | $success, $failed, $action_msg, $values['nm'], $msg, $values['nm']['checkboxes']['no_notifications'])) |
| 768 | 768 | { |
| 769 | - $msg .= lang('%1 entries %2',$success,$action_msg); |
|
| 769 | + $msg .= lang('%1 entries %2', $success, $action_msg); |
|
| 770 | 770 | egw_framework::message($msg); |
| 771 | 771 | } |
| 772 | - elseif(is_null($msg)) |
|
| 772 | + elseif (is_null($msg)) |
|
| 773 | 773 | { |
| 774 | - $msg .= lang('%1 entries %2, %3 failed because of insufficent rights !!!',$success,$action_msg,$failed); |
|
| 775 | - egw_framework::message($msg,'error'); |
|
| 774 | + $msg .= lang('%1 entries %2, %3 failed because of insufficent rights !!!', $success, $action_msg, $failed); |
|
| 775 | + egw_framework::message($msg, 'error'); |
|
| 776 | 776 | } |
| 777 | - elseif($msg) |
|
| 777 | + elseif ($msg) |
|
| 778 | 778 | { |
| 779 | - $msg .= "\n".lang('%1 entries %2, %3 failed.',$success,$action_msg,$failed); |
|
| 780 | - egw_framework::message($msg,'error'); |
|
| 779 | + $msg .= "\n".lang('%1 entries %2, %3 failed.', $success, $action_msg, $failed); |
|
| 780 | + egw_framework::message($msg, 'error'); |
|
| 781 | 781 | } |
| 782 | 782 | unset($values['nm']['multi_action']); |
| 783 | 783 | unset($values['nm']['select_all']); |
@@ -785,9 +785,9 @@ discard block |
||
| 785 | 785 | } |
| 786 | 786 | if (!$action) |
| 787 | 787 | { |
| 788 | - $action = is_array($values) && $values['action'] ? $values['action'] : get_var('action',array('POST','GET')); |
|
| 789 | - $action_id = is_array($values) && $values['action_id'] ? $values['action_id'] : get_var('action_id',array('POST','GET')); |
|
| 790 | - $action_title = is_array($values) && $values['action_title'] ? $values['action_title'] : get_var('action_title',array('POST','GET')); |
|
| 788 | + $action = is_array($values) && $values['action'] ? $values['action'] : get_var('action', array('POST', 'GET')); |
|
| 789 | + $action_id = is_array($values) && $values['action_id'] ? $values['action_id'] : get_var('action_id', array('POST', 'GET')); |
|
| 790 | + $action_title = is_array($values) && $values['action_title'] ? $values['action_title'] : get_var('action_title', array('POST', 'GET')); |
|
| 791 | 791 | } |
| 792 | 792 | //echo "<p>".__METHOD__."(action='$action/$action_id',called_as='$called_as/$values[referer]',own_referer='$own_referer') values=\n"; _debug_array($values); |
| 793 | 793 | if (!is_array($values)) |
@@ -800,7 +800,7 @@ discard block |
||
| 800 | 800 | $action_id = 0; |
| 801 | 801 | $action_title = ''; |
| 802 | 802 | } |
| 803 | - if($_GET['ajax'] === 'true') |
|
| 803 | + if ($_GET['ajax'] === 'true') |
|
| 804 | 804 | { |
| 805 | 805 | $nm['action'] = ''; |
| 806 | 806 | $nm['action_id'] = 0; |
@@ -816,8 +816,7 @@ discard block |
||
| 816 | 816 | |
| 817 | 817 | if (isset($_GET['filter']) && $_GET['filter'] != 'default' || !isset($values['nm']['filter']) && !$this->called_by) |
| 818 | 818 | { |
| 819 | - $values['nm']['filter'] = $_GET['filter'] && $_GET['filter'] != 'default' ? $_GET['filter'] : |
|
| 820 | - $this->prefs['defaultFilter']; |
|
| 819 | + $values['nm']['filter'] = $_GET['filter'] && $_GET['filter'] != 'default' ? $_GET['filter'] : $this->prefs['defaultFilter']; |
|
| 821 | 820 | } |
| 822 | 821 | if (!isset($values['nm']['order']) || !$values['nm']['order']) |
| 823 | 822 | { |
@@ -831,21 +830,21 @@ discard block |
||
| 831 | 830 | $action_title = $values['action_title'] = $action ? $action_title : $nm['action_title']; |
| 832 | 831 | $action = $values['action'] = $action ? $action : $nm['action']; |
| 833 | 832 | } |
| 834 | - if($_GET['search']) $values['nm']['search'] = $_GET['search']; |
|
| 833 | + if ($_GET['search']) $values['nm']['search'] = $_GET['search']; |
|
| 835 | 834 | |
| 836 | 835 | if ($values['nm']['add']) |
| 837 | 836 | { |
| 838 | 837 | $values['add'] = $values['nm']['add']; |
| 839 | 838 | unset($values['nm']['add']); |
| 840 | 839 | } |
| 841 | - unset($values['nm']['rows']['checked']); // not longer used, but hides button actions |
|
| 840 | + unset($values['nm']['rows']['checked']); // not longer used, but hides button actions |
|
| 842 | 841 | |
| 843 | 842 | if ($values['add'] || $values['cancel'] || isset($values['main'])) |
| 844 | 843 | { |
| 845 | 844 | if ($values['add']) |
| 846 | 845 | { |
| 847 | 846 | list($type) = each($values['add']); |
| 848 | - return $this->edit(0,$action,$action_id,$type,$called_as); |
|
| 847 | + return $this->edit(0, $action, $action_id, $type, $called_as); |
|
| 849 | 848 | } |
| 850 | 849 | elseif ($values['cancel'] && $own_referer) |
| 851 | 850 | { |
@@ -857,14 +856,14 @@ discard block |
||
| 857 | 856 | } |
| 858 | 857 | else |
| 859 | 858 | { |
| 860 | - list($do,$do2) = each($values['main']); |
|
| 859 | + list($do, $do2) = each($values['main']); |
|
| 861 | 860 | list($do_id) = @each($do2); |
| 862 | - switch((string)$do) |
|
| 861 | + switch ((string)$do) |
|
| 863 | 862 | { |
| 864 | 863 | case 'close': |
| 865 | - $closesingle=true; |
|
| 864 | + $closesingle = true; |
|
| 866 | 865 | case 'close_all': |
| 867 | - $this->close($do_id,$called_as,$closesingle); |
|
| 866 | + $this->close($do_id, $called_as, $closesingle); |
|
| 868 | 867 | break; |
| 869 | 868 | case 'view': |
| 870 | 869 | $value = array(); |
@@ -902,7 +901,7 @@ discard block |
||
| 902 | 901 | $this->tmpl->read('infolog.index'); |
| 903 | 902 | $values['nm']['options-filter'] = $this->filters; |
| 904 | 903 | $values['nm']['get_rows'] = 'infolog.infolog_ui.get_rows'; |
| 905 | - $values['nm']['options-filter2'] = (in_array($this->prefs['show_links'],array('all','no_describtion')) ? array() : array( |
|
| 904 | + $values['nm']['options-filter2'] = (in_array($this->prefs['show_links'], array('all', 'no_describtion')) ? array() : array( |
|
| 906 | 905 | '' => 'default', |
| 907 | 906 | )) + array( |
| 908 | 907 | 'no_describtion' => 'no details', |
@@ -923,35 +922,35 @@ discard block |
||
| 923 | 922 | else |
| 924 | 923 | { |
| 925 | 924 | // Allow saving parent ID into favorites |
| 926 | - $values['nm']['favorites'] = array('action','action_id'); |
|
| 925 | + $values['nm']['favorites'] = array('action', 'action_id'); |
|
| 927 | 926 | } |
| 928 | 927 | |
| 929 | 928 | // Allow add actions even when there's no rows |
| 930 | 929 | $values['nm']['placeholder_actions'] = array('new'); |
| 931 | 930 | |
| 932 | - if(!isset($values['nm']['filter2'])) $values['nm']['filter2'] = $this->prefs['nextmatch-'.($action ? 'infolog.'.$action : 'infolog.index.rows').'-details-pref']; |
|
| 931 | + if (!isset($values['nm']['filter2'])) $values['nm']['filter2'] = $this->prefs['nextmatch-'.($action ? 'infolog.'.$action : 'infolog.index.rows').'-details-pref']; |
|
| 933 | 932 | |
| 934 | 933 | // disable columns for main entry as set in the pref for details or no details |
| 935 | 934 | $values['nm']['columnselection_pref'] = 'nextmatch-'.($action ? 'infolog.'.$action : 'infolog.index.rows') |
| 936 | - .($values['nm']['filter2']=='all' ? '-details' : ''); |
|
| 935 | + .($values['nm']['filter2'] == 'all' ? '-details' : ''); |
|
| 937 | 936 | if ($action == 'sp') |
| 938 | 937 | { |
| 939 | 938 | $pref = $values['nm']['columnselection_pref']; |
| 940 | - foreach(array('info_used_time_info_planned_time_info_replanned_time','info_datemodified','info_owner_info_responsible','customfields') as $name) |
|
| 939 | + foreach (array('info_used_time_info_planned_time_info_replanned_time', 'info_datemodified', 'info_owner_info_responsible', 'customfields') as $name) |
|
| 941 | 940 | { |
| 942 | - $values['main']['no_'.$name] = strpos($this->prefs[$pref],$name) === false; |
|
| 941 | + $values['main']['no_'.$name] = strpos($this->prefs[$pref], $name) === false; |
|
| 943 | 942 | } |
| 944 | 943 | if (!$values['main']['no_customfields']) |
| 945 | 944 | { |
| 946 | 945 | // set the column-header of the main table for the customfields. |
| 947 | - foreach(array_keys($this->bo->customfields) as $lname) |
|
| 946 | + foreach (array_keys($this->bo->customfields) as $lname) |
|
| 948 | 947 | { |
| 949 | - $values['main']['customfields'].=$lname."\n"; |
|
| 948 | + $values['main']['customfields'] .= $lname."\n"; |
|
| 950 | 949 | } |
| 951 | 950 | } |
| 952 | 951 | } |
| 953 | 952 | $values['nm']['header_row'] = 'infolog.index.header_right'; |
| 954 | - if ($values['nm']['filter']=='bydate') |
|
| 953 | + if ($values['nm']['filter'] == 'bydate') |
|
| 955 | 954 | { |
| 956 | 955 | foreach (array_keys($values['nm']['col_filter']) as $colfk) |
| 957 | 956 | { |
@@ -984,7 +983,7 @@ discard block |
||
| 984 | 983 | { |
| 985 | 984 | $values['css'] .= '<style type="text/css">@media screen { .infoDes { '. |
| 986 | 985 | ' max-height: '. |
| 987 | - (($this->prefs['limit_des_lines'] ? $this->prefs['limit_des_lines'] : 5) * 1.35). // dono why em is not real lines |
|
| 986 | + (($this->prefs['limit_des_lines'] ? $this->prefs['limit_des_lines'] : 5) * 1.35).// dono why em is not real lines |
|
| 988 | 987 | 'em; overflow: auto; }}</style>'; |
| 989 | 988 | } |
| 990 | 989 | |
@@ -996,13 +995,13 @@ discard block |
||
| 996 | 995 | |
| 997 | 996 | // remove group-types user has not any rights to as filter |
| 998 | 997 | // does not take implicit rights as delegated into account, so they will not be available as filters |
| 999 | - foreach($this->bo->group_owners as $type => $group) |
|
| 998 | + foreach ($this->bo->group_owners as $type => $group) |
|
| 1000 | 999 | { |
| 1001 | 1000 | if (!isset($this->bo->grants[$group])) unset($sel_options['info_type'][$type]); |
| 1002 | 1001 | } |
| 1003 | 1002 | |
| 1004 | 1003 | |
| 1005 | - return $this->tmpl->exec('infolog.infolog_ui.index',$values,$sel_options,$readonlys,$persist,$return_html ? -1 : 0); |
|
| 1004 | + return $this->tmpl->exec('infolog.infolog_ui.index', $values, $sel_options, $readonlys, $persist, $return_html ? -1 : 0); |
|
| 1006 | 1005 | } |
| 1007 | 1006 | |
| 1008 | 1007 | /** |
@@ -1017,9 +1016,9 @@ discard block |
||
| 1017 | 1016 | if ($this->bo->group_owners) |
| 1018 | 1017 | { |
| 1019 | 1018 | // remove types owned by groups the user has no edit grant |
| 1020 | - foreach($this->bo->group_owners as $type => $group) |
|
| 1019 | + foreach ($this->bo->group_owners as $type => $group) |
|
| 1021 | 1020 | { |
| 1022 | - if (!($this->bo->grants[$group] & EGW_ACL_EDIT)) |
|
| 1021 | + if (!($this->bo->grants[$group]&EGW_ACL_EDIT)) |
|
| 1023 | 1022 | { |
| 1024 | 1023 | unset($types[$type]); |
| 1025 | 1024 | } |
@@ -1036,7 +1035,7 @@ discard block |
||
| 1036 | 1035 | */ |
| 1037 | 1036 | private function get_actions(array $query) |
| 1038 | 1037 | { |
| 1039 | - for($i = 0; $i <= 100; $i += 10) |
|
| 1038 | + for ($i = 0; $i <= 100; $i += 10) |
|
| 1040 | 1039 | { |
| 1041 | 1040 | $percent[$i] = $i.'%'; |
| 1042 | 1041 | } |
@@ -1045,9 +1044,9 @@ discard block |
||
| 1045 | 1044 | $types_add = array(); |
| 1046 | 1045 | // Do not add deleted type to add or change menus |
| 1047 | 1046 | unset($types['delete']); |
| 1048 | - foreach($types as $type => &$data) |
|
| 1047 | + foreach ($types as $type => &$data) |
|
| 1049 | 1048 | { |
| 1050 | - if ($type=='email') continue;//requirement by sales that it should not be shown in right - click - action dialog |
|
| 1049 | + if ($type == 'email') continue; //requirement by sales that it should not be shown in right - click - action dialog |
|
| 1051 | 1050 | $data = array( |
| 1052 | 1051 | 'caption' => $data, |
| 1053 | 1052 | 'icon' => $type, |
@@ -1059,7 +1058,7 @@ discard block |
||
| 1059 | 1058 | |
| 1060 | 1059 | $icons = null; |
| 1061 | 1060 | $statis = $this->bo->get_status($query['col_filter']['info_type'], $icons); |
| 1062 | - foreach($statis as $type => &$data) |
|
| 1061 | + foreach ($statis as $type => &$data) |
|
| 1063 | 1062 | { |
| 1064 | 1063 | $data = array( |
| 1065 | 1064 | 'caption' => $data, |
@@ -1074,7 +1073,7 @@ discard block |
||
| 1074 | 1073 | 'allowOnMultiple' => false, |
| 1075 | 1074 | 'url' => 'menuaction=infolog.infolog_ui.edit&info_id=$id', |
| 1076 | 1075 | 'popup' => egw_link::get_registry('infolog', 'add_popup'), |
| 1077 | - 'group' => $group=1, |
|
| 1076 | + 'group' => $group = 1, |
|
| 1078 | 1077 | ), |
| 1079 | 1078 | 'parent' => array( |
| 1080 | 1079 | 'caption' => 'View parent with children', |
@@ -1145,7 +1144,7 @@ discard block |
||
| 1145 | 1144 | 'icon' => 'completed', |
| 1146 | 1145 | ), |
| 1147 | 1146 | 'cat' => nextmatch_widget::category_action( |
| 1148 | - 'infolog',$group,'Change category','cat_' |
|
| 1147 | + 'infolog', $group, 'Change category', 'cat_' |
|
| 1149 | 1148 | ), |
| 1150 | 1149 | 'responsible' => array( |
| 1151 | 1150 | 'caption' => 'Delegation', |
@@ -1181,7 +1180,7 @@ discard block |
||
| 1181 | 1180 | 'onExecute' => 'javaScript:app.infolog.infolog_menu_print' |
| 1182 | 1181 | ) |
| 1183 | 1182 | ); |
| 1184 | - ++$group; // integration with other apps |
|
| 1183 | + ++$group; // integration with other apps |
|
| 1185 | 1184 | if ($GLOBALS['egw_info']['user']['apps']['filemanager']) |
| 1186 | 1185 | { |
| 1187 | 1186 | $actions['filemanager'] = array( |
@@ -1199,7 +1198,7 @@ discard block |
||
| 1199 | 1198 | 'caption' => 'Schedule appointment', |
| 1200 | 1199 | 'group' => $group, |
| 1201 | 1200 | 'url' => 'menuaction=calendar.calendar_uiforms.edit&'. |
| 1202 | - egw_link::get_registry('calendar', 'add_app') . '[]=infolog&'.egw_link::get_registry('calendar','add_id').'[]=$id', |
|
| 1201 | + egw_link::get_registry('calendar', 'add_app').'[]=infolog&'.egw_link::get_registry('calendar', 'add_id').'[]=$id', |
|
| 1203 | 1202 | 'allowOnMultiple' => false, |
| 1204 | 1203 | 'popup' => egw_link::get_registry('calendar', 'add_popup'), |
| 1205 | 1204 | ); |
@@ -1223,7 +1222,7 @@ discard block |
||
| 1223 | 1222 | 'hint' => 'Convert to a ticket', |
| 1224 | 1223 | 'group' => $group, |
| 1225 | 1224 | 'url' => 'menuaction=tracker.tracker_ui.edit&'. |
| 1226 | - egw_link::get_registry('tracker', 'add_app') . '[]=infolog&'.egw_link::get_registry('tracker','add_id').'[]=$id', |
|
| 1225 | + egw_link::get_registry('tracker', 'add_app').'[]=infolog&'.egw_link::get_registry('tracker', 'add_id').'[]=$id', |
|
| 1227 | 1226 | 'allowOnMultiple' => false, |
| 1228 | 1227 | 'popup' => egw_link::get_registry('tracker', 'add_popup'), |
| 1229 | 1228 | ); |
@@ -1236,7 +1235,7 @@ discard block |
||
| 1236 | 1235 | $actions['ical'] = array( |
| 1237 | 1236 | 'icon' => 'ical', |
| 1238 | 1237 | 'caption' => 'Export iCal', |
| 1239 | - 'postSubmit' => true, // download needs post submit to work |
|
| 1238 | + 'postSubmit' => true, // download needs post submit to work |
|
| 1240 | 1239 | 'group' => $group, |
| 1241 | 1240 | 'allowOnMultiple' => true, |
| 1242 | 1241 | ); |
@@ -1288,14 +1287,14 @@ discard block |
||
| 1288 | 1287 | $success = $failed = 0; |
| 1289 | 1288 | if ($use_all) |
| 1290 | 1289 | { |
| 1291 | - @set_time_limit(0); // switch off the execution time limit, as it's for big selections to small |
|
| 1292 | - $query['num_rows'] = -1; // all |
|
| 1290 | + @set_time_limit(0); // switch off the execution time limit, as it's for big selections to small |
|
| 1291 | + $query['num_rows'] = -1; // all |
|
| 1293 | 1292 | $result = $readonlys = null; |
| 1294 | - $this->get_rows($query,$result,$readonlys); |
|
| 1293 | + $this->get_rows($query, $result, $readonlys); |
|
| 1295 | 1294 | $checked = array(); |
| 1296 | - foreach($result as $key => $info) |
|
| 1295 | + foreach ($result as $key => $info) |
|
| 1297 | 1296 | { |
| 1298 | - if(is_numeric($key)) |
|
| 1297 | + if (is_numeric($key)) |
|
| 1299 | 1298 | { |
| 1300 | 1299 | $checked[] = $info['info_id']; |
| 1301 | 1300 | } |
@@ -1306,29 +1305,29 @@ discard block |
||
| 1306 | 1305 | list($action, $settings) = explode('_', $_action, 2); |
| 1307 | 1306 | |
| 1308 | 1307 | // Actions that can handle a list of IDs |
| 1309 | - switch($action) |
|
| 1308 | + switch ($action) |
|
| 1310 | 1309 | { |
| 1311 | 1310 | case 'link': |
| 1312 | 1311 | list($add_remove, $link) = explode('_', $settings, 2); |
| 1313 | - list($app, $link_id) = explode(strpos($link,':') !== false ? ':' : ',', $link); |
|
| 1314 | - if(!$link_id) |
|
| 1312 | + list($app, $link_id) = explode(strpos($link, ':') !== false ? ':' : ',', $link); |
|
| 1313 | + if (!$link_id) |
|
| 1315 | 1314 | { |
| 1316 | 1315 | $action_msg = 'linked'; |
| 1317 | 1316 | $msg = lang('You need to select an entry for linking.'); |
| 1318 | 1317 | break; |
| 1319 | 1318 | } |
| 1320 | 1319 | $title = egw_link::title($app, $link_id); |
| 1321 | - foreach($checked as $id) |
|
| 1320 | + foreach ($checked as $id) |
|
| 1322 | 1321 | { |
| 1323 | - if(!$this->bo->check_access($id, EGW_ACL_EDIT)) |
|
| 1322 | + if (!$this->bo->check_access($id, EGW_ACL_EDIT)) |
|
| 1324 | 1323 | { |
| 1325 | 1324 | $failed++; |
| 1326 | 1325 | continue; |
| 1327 | 1326 | } |
| 1328 | - if($add_remove == 'add') |
|
| 1327 | + if ($add_remove == 'add') |
|
| 1329 | 1328 | { |
| 1330 | 1329 | $action_msg = lang('linked to %1', $title); |
| 1331 | - if(egw_link::link('infolog', $id, $app, $link_id)) |
|
| 1330 | + if (egw_link::link('infolog', $id, $app, $link_id)) |
|
| 1332 | 1331 | { |
| 1333 | 1332 | $success++; |
| 1334 | 1333 | } |
@@ -1355,20 +1354,20 @@ discard block |
||
| 1355 | 1354 | case 'ical': |
| 1356 | 1355 | // infolog_ical lets horde be auto-loaded, so it must go first |
| 1357 | 1356 | $boical = new infolog_ical(); |
| 1358 | - html::content_header('todo.ics','text/calendar'); |
|
| 1357 | + html::content_header('todo.ics', 'text/calendar'); |
|
| 1359 | 1358 | echo $boical->exportvCalendar($checked); |
| 1360 | 1359 | common::egw_exit(); |
| 1361 | 1360 | |
| 1362 | 1361 | } |
| 1363 | 1362 | |
| 1364 | 1363 | // Actions that need to loop |
| 1365 | - foreach($checked as $id) |
|
| 1364 | + foreach ($checked as $id) |
|
| 1366 | 1365 | { |
| 1367 | - if(!$entry = $this->bo->read($id)) |
|
| 1366 | + if (!$entry = $this->bo->read($id)) |
|
| 1368 | 1367 | { |
| 1369 | 1368 | continue; |
| 1370 | 1369 | } |
| 1371 | - switch($action) |
|
| 1370 | + switch ($action) |
|
| 1372 | 1371 | { |
| 1373 | 1372 | case 'close': |
| 1374 | 1373 | $action_msg = lang('closed'); |
@@ -1378,8 +1377,8 @@ discard block |
||
| 1378 | 1377 | |
| 1379 | 1378 | case 'delete': |
| 1380 | 1379 | $action_msg = $settings == 'sub' ? lang(' (and children) deleted') : lang('deleted'); |
| 1381 | - $result = $this->bo->delete($id, $settings=='sub', false, $skip_notifications); |
|
| 1382 | - if($result == true) |
|
| 1380 | + $result = $this->bo->delete($id, $settings == 'sub', false, $skip_notifications); |
|
| 1381 | + if ($result == true) |
|
| 1383 | 1382 | { |
| 1384 | 1383 | $success++; |
| 1385 | 1384 | } |
@@ -1392,14 +1391,14 @@ discard block |
||
| 1392 | 1391 | case 'type': |
| 1393 | 1392 | $action_msg = lang('changed type'); |
| 1394 | 1393 | // Dont allow to change the type, if user has no delete rights from the group-owner |
| 1395 | - if ($id && !($this->bo->grants[$entry['info_owner']] & EGW_ACL_DELETE)) |
|
| 1394 | + if ($id && !($this->bo->grants[$entry['info_owner']]&EGW_ACL_DELETE)) |
|
| 1396 | 1395 | { |
| 1397 | 1396 | $failed++; |
| 1398 | 1397 | break; |
| 1399 | 1398 | } |
| 1400 | 1399 | $entry['info_type'] = $settings; |
| 1401 | 1400 | try { |
| 1402 | - $this->bo->write($entry, true,true,true,$skip_notifications,true); // Throw exceptions |
|
| 1401 | + $this->bo->write($entry, true, true, true, $skip_notifications, true); // Throw exceptions |
|
| 1403 | 1402 | } |
| 1404 | 1403 | catch (egw_exception_wrong_userinput $e) |
| 1405 | 1404 | { |
@@ -1414,11 +1413,11 @@ discard block |
||
| 1414 | 1413 | $action_msg = lang('changed completion to %1%', $settings); |
| 1415 | 1414 | $entry['info_percent'] = $settings; |
| 1416 | 1415 | // Done and not-started entries will get changed right back if we don't change the status too |
| 1417 | - if(in_array($entry['info_status'],array('not-started','done','billed','cancelled','archive'))) |
|
| 1416 | + if (in_array($entry['info_status'], array('not-started', 'done', 'billed', 'cancelled', 'archive'))) |
|
| 1418 | 1417 | { |
| 1419 | 1418 | $entry['info_status'] = 'ongoing'; |
| 1420 | 1419 | } |
| 1421 | - if($entry['info_percent'] == 0) |
|
| 1420 | + if ($entry['info_percent'] == 0) |
|
| 1422 | 1421 | { |
| 1423 | 1422 | $entry['info_status'] = 'not-started'; |
| 1424 | 1423 | } |
@@ -1426,7 +1425,7 @@ discard block |
||
| 1426 | 1425 | { |
| 1427 | 1426 | $entry['info_status'] = 'done'; |
| 1428 | 1427 | } |
| 1429 | - if($this->bo->write($entry, true,true,true,$skip_notifications)) |
|
| 1428 | + if ($this->bo->write($entry, true, true, true, $skip_notifications)) |
|
| 1430 | 1429 | { |
| 1431 | 1430 | $success++; |
| 1432 | 1431 | } |
@@ -1438,24 +1437,23 @@ discard block |
||
| 1438 | 1437 | |
| 1439 | 1438 | case 'undelete': // set it to valid status != 'deleted' for that type |
| 1440 | 1439 | $settings = isset($this->bo->status[$entry['info_type']]['done']) ? |
| 1441 | - $this->bo->status[$entry['info_type']]['done'] : |
|
| 1442 | - $this->bo->status['defaults'][$entry['info_type']]; |
|
| 1440 | + $this->bo->status[$entry['info_type']]['done'] : $this->bo->status['defaults'][$entry['info_type']]; |
|
| 1443 | 1441 | // fall-through |
| 1444 | 1442 | case 'status': |
| 1445 | - if(isset($this->bo->status[$entry['info_type']][$settings])) |
|
| 1443 | + if (isset($this->bo->status[$entry['info_type']][$settings])) |
|
| 1446 | 1444 | { |
| 1447 | 1445 | $action_msg = lang('changed status to %1', lang($this->bo->status[$entry['info_type']][$settings])); |
| 1448 | - if(!in_array($settings,array('done','billed','cancelled','archive')) && $entry['info_percent'] == 100) |
|
| 1446 | + if (!in_array($settings, array('done', 'billed', 'cancelled', 'archive')) && $entry['info_percent'] == 100) |
|
| 1449 | 1447 | { |
| 1450 | 1448 | // Done entries will get changed right back if we don't change the completion too |
| 1451 | 1449 | $entry['info_percent'] = 10; |
| 1452 | 1450 | } |
| 1453 | - if(in_array($settings, array('not-started')) && $entry['info_percent'] > 0) |
|
| 1451 | + if (in_array($settings, array('not-started')) && $entry['info_percent'] > 0) |
|
| 1454 | 1452 | { |
| 1455 | 1453 | $entry['info_percent'] = 0; |
| 1456 | 1454 | } |
| 1457 | 1455 | $entry['info_status'] = $settings; |
| 1458 | - if($this->bo->write($entry, true,true,true,$skip_notifications)) |
|
| 1456 | + if ($this->bo->write($entry, true, true, true, $skip_notifications)) |
|
| 1459 | 1457 | { |
| 1460 | 1458 | $success++; |
| 1461 | 1459 | } |
@@ -1468,7 +1466,7 @@ discard block |
||
| 1468 | 1466 | break; |
| 1469 | 1467 | |
| 1470 | 1468 | case 'cat': |
| 1471 | - if($settings) |
|
| 1469 | + if ($settings) |
|
| 1472 | 1470 | { |
| 1473 | 1471 | $cat_name = categories::id2name($settings); |
| 1474 | 1472 | $action_msg = lang('changed category to %1', $cat_name); |
@@ -1478,7 +1476,7 @@ discard block |
||
| 1478 | 1476 | $action_msg = lang('removed category'); |
| 1479 | 1477 | } |
| 1480 | 1478 | $entry['info_cat'] = $settings; |
| 1481 | - if($this->bo->write($entry, true,true,true,$skip_notifications)) |
|
| 1479 | + if ($this->bo->write($entry, true, true, true, $skip_notifications)) |
|
| 1482 | 1480 | { |
| 1483 | 1481 | $success++; |
| 1484 | 1482 | } |
@@ -1490,17 +1488,17 @@ discard block |
||
| 1490 | 1488 | |
| 1491 | 1489 | case 'responsible': |
| 1492 | 1490 | list($add_remove, $user_str) = explode('_', $settings, 2); |
| 1493 | - $action_msg = ($add_remove == 'add' ? lang('added') : lang('removed')) . ' '; |
|
| 1491 | + $action_msg = ($add_remove == 'add' ? lang('added') : lang('removed')).' '; |
|
| 1494 | 1492 | $names = array(); |
| 1495 | 1493 | $users = explode(',', $user_str); |
| 1496 | - foreach($users as $account_id) |
|
| 1494 | + foreach ($users as $account_id) |
|
| 1497 | 1495 | { |
| 1498 | 1496 | $names[] = common::grab_owner_name($account_id); |
| 1499 | 1497 | } |
| 1500 | 1498 | $action_msg .= implode(', ', $names); |
| 1501 | 1499 | $function = $add_remove == 'add' ? 'array_merge' : 'array_diff'; |
| 1502 | 1500 | $entry['info_responsible'] = array_unique($function($entry['info_responsible'], (array)$users)); |
| 1503 | - if($this->bo->write($entry, true,true,true,$skip_notifications)) |
|
| 1501 | + if ($this->bo->write($entry, true, true, true, $skip_notifications)) |
|
| 1504 | 1502 | { |
| 1505 | 1503 | $success++; |
| 1506 | 1504 | } |
@@ -1521,10 +1519,10 @@ discard block |
||
| 1521 | 1519 | * @param string $_referer='' |
| 1522 | 1520 | * @param boolean $closesingle=false |
| 1523 | 1521 | */ |
| 1524 | - function close($values=0,$_referer='',$closesingle=false,$skip_notification = false) |
|
| 1522 | + function close($values = 0, $_referer = '', $closesingle = false, $skip_notification = false) |
|
| 1525 | 1523 | { |
| 1526 | 1524 | //echo "<p>".__METHOD__."($values,$referer,$closeall)</p>\n"; |
| 1527 | - $info_id = (int) (is_array($values) ? $values['info_id'] : ($values ? $values : $_GET['info_id'])); |
|
| 1525 | + $info_id = (int)(is_array($values) ? $values['info_id'] : ($values ? $values : $_GET['info_id'])); |
|
| 1528 | 1526 | $referer = is_array($values) ? $values['referer'] : $_referer; |
| 1529 | 1527 | |
| 1530 | 1528 | if ($info_id) |
@@ -1534,11 +1532,11 @@ discard block |
||
| 1534 | 1532 | $status = $info['info_status']; |
| 1535 | 1533 | // closed stati assumed array('done','billed','cancelled') |
| 1536 | 1534 | if (isset($this->bo->status[$info['info_type']]['done'])) { |
| 1537 | - $status ='done'; |
|
| 1535 | + $status = 'done'; |
|
| 1538 | 1536 | } elseif (isset($this->bo->status[$info['info_type']]['billed'])) { |
| 1539 | - $status ='billed'; |
|
| 1537 | + $status = 'billed'; |
|
| 1540 | 1538 | } elseif (isset($this->bo->status[$info['info_type']]['cancelled'])) { |
| 1541 | - $status ='cancelled'; |
|
| 1539 | + $status = 'cancelled'; |
|
| 1542 | 1540 | } |
| 1543 | 1541 | #_debug_array($status); |
| 1544 | 1542 | $values = array( |
@@ -1548,15 +1546,15 @@ discard block |
||
| 1548 | 1546 | 'info_percent'=> 100, |
| 1549 | 1547 | 'info_datecompleted' => $this->bo->now_su, |
| 1550 | 1548 | ); |
| 1551 | - $this->bo->write($values, true,true,true,$skip_notification); |
|
| 1549 | + $this->bo->write($values, true, true, true, $skip_notification); |
|
| 1552 | 1550 | |
| 1553 | - $query = array('action'=>'sp','action_id'=>$info_id); |
|
| 1551 | + $query = array('action'=>'sp', 'action_id'=>$info_id); |
|
| 1554 | 1552 | if (!$closesingle) { |
| 1555 | - foreach((array)$this->bo->search($query) as $info) |
|
| 1553 | + foreach ((array)$this->bo->search($query) as $info) |
|
| 1556 | 1554 | { |
| 1557 | 1555 | if ($info['info_id_parent'] == $info_id) // search also returns linked entries! |
| 1558 | 1556 | { |
| 1559 | - $this->close($info['info_id'],$referer,$closesingle,$skip_notification); // we call ourselfs recursive to process subs from subs too |
|
| 1557 | + $this->close($info['info_id'], $referer, $closesingle, $skip_notification); // we call ourselfs recursive to process subs from subs too |
|
| 1560 | 1558 | } |
| 1561 | 1559 | } |
| 1562 | 1560 | } |
@@ -1572,9 +1570,9 @@ discard block |
||
| 1572 | 1570 | * @param string $called_by |
| 1573 | 1571 | * @param boolean $skip_notification Do not send notification of deletion |
| 1574 | 1572 | */ |
| 1575 | - function delete($values=0,$_referer='',$called_by='',$skip_notification=False) |
|
| 1573 | + function delete($values = 0, $_referer = '', $called_by = '', $skip_notification = False) |
|
| 1576 | 1574 | { |
| 1577 | - $info_id = (int) (is_array($values) ? $values['info_id'] : ($values ? $values : $_GET['info_id'])); |
|
| 1575 | + $info_id = (int)(is_array($values) ? $values['info_id'] : ($values ? $values : $_GET['info_id'])); |
|
| 1578 | 1576 | $referer = is_array($values) ? $values['referer'] : $_referer; |
| 1579 | 1577 | |
| 1580 | 1578 | if (!is_array($values) && $info_id > 0 && !$this->bo->anzSubs($info_id)) // entries without subs get confirmed by javascript |
@@ -1585,9 +1583,9 @@ discard block |
||
| 1585 | 1583 | |
| 1586 | 1584 | if (is_array($values) || $info_id <= 0) |
| 1587 | 1585 | { |
| 1588 | - if (($values['delete'] || $values['delete_subs']) && $info_id > 0 && $this->bo->check_access($info_id,EGW_ACL_DELETE)) |
|
| 1586 | + if (($values['delete'] || $values['delete_subs']) && $info_id > 0 && $this->bo->check_access($info_id, EGW_ACL_DELETE)) |
|
| 1589 | 1587 | { |
| 1590 | - $deleted = $this->bo->delete($info_id,$values['delete_subs'],$values['info_id_parent'], $skip_notification); |
|
| 1588 | + $deleted = $this->bo->delete($info_id, $values['delete_subs'], $values['info_id_parent'], $skip_notification); |
|
| 1591 | 1589 | } |
| 1592 | 1590 | if ($called_by) // direct call from the same request |
| 1593 | 1591 | { |
@@ -1597,7 +1595,7 @@ discard block |
||
| 1597 | 1595 | { |
| 1598 | 1596 | $this->edit(array( |
| 1599 | 1597 | 'info_id' => $info_id, |
| 1600 | - 'button' => array('deleted' => true), // not delete! |
|
| 1598 | + 'button' => array('deleted' => true), // not delete! |
|
| 1601 | 1599 | 'referer' => $referer, |
| 1602 | 1600 | 'msg' => $deleted ? lang('Infolog entry deleted') : '', |
| 1603 | 1601 | )); |
@@ -1605,7 +1603,7 @@ discard block |
||
| 1605 | 1603 | return $referer ? $this->tmpl->location($referer) : $this->index(); |
| 1606 | 1604 | } |
| 1607 | 1605 | $readonlys = $values = array(); |
| 1608 | - $values['main'][1] = $this->get_info($info_id,$readonlys['main']); |
|
| 1606 | + $values['main'][1] = $this->get_info($info_id, $readonlys['main']); |
|
| 1609 | 1607 | |
| 1610 | 1608 | $this->tmpl->read('infolog.delete'); |
| 1611 | 1609 | |
@@ -1626,7 +1624,7 @@ discard block |
||
| 1626 | 1624 | $GLOBALS['egw_info']['flags']['app_header'] = lang('InfoLog').' - '.lang('Delete'); |
| 1627 | 1625 | $GLOBALS['egw_info']['flags']['params']['manual'] = array('page' => 'ManualInfologDelete'); |
| 1628 | 1626 | |
| 1629 | - $this->tmpl->exec('infolog.infolog_ui.delete',$values,array(),$readonlys,$persist,$called_by == 'edit' ? 2 : 0); |
|
| 1627 | + $this->tmpl->exec('infolog.infolog_ui.delete', $values, array(), $readonlys, $persist, $called_by == 'edit' ? 2 : 0); |
|
| 1630 | 1628 | } |
| 1631 | 1629 | |
| 1632 | 1630 | /** |
@@ -1638,77 +1636,77 @@ discard block |
||
| 1638 | 1636 | * @param string $type Type of log-entry: note,todo,task |
| 1639 | 1637 | * @param string $referer array with param/get-vars of the refering page |
| 1640 | 1638 | */ |
| 1641 | - function edit($content = null,$action = '',$action_id=0,$type='',$referer='') |
|
| 1639 | + function edit($content = null, $action = '', $action_id = 0, $type = '', $referer = '') |
|
| 1642 | 1640 | { |
| 1643 | 1641 | if (($submit = is_array($content))) |
| 1644 | 1642 | { |
| 1645 | 1643 | //echo "infolog_ui::edit: content="; _debug_array($content); |
| 1646 | 1644 | $info_id = $content['info_id']; |
| 1647 | - $action = $content['action']; unset($content['action']); |
|
| 1645 | + $action = $content['action']; unset($content['action']); |
|
| 1648 | 1646 | $action_id = $content['action_id']; unset($content['action_id']); |
| 1649 | - $referer = $content['referer']; unset($content['referer']); |
|
| 1650 | - $no_popup = $content['no_popup']; unset($content['no_popup']); |
|
| 1647 | + $referer = $content['referer']; unset($content['referer']); |
|
| 1648 | + $no_popup = $content['no_popup']; unset($content['no_popup']); |
|
| 1651 | 1649 | |
| 1652 | 1650 | list($button) = @each($content['button']); |
| 1653 | - if (!$button && $action) $button = $action; // action selectbox |
|
| 1651 | + if (!$button && $action) $button = $action; // action selectbox |
|
| 1654 | 1652 | //info_cc expects an comma separated string |
| 1655 | 1653 | //error_log(__METHOD__.__LINE__.array2string($content)); |
| 1656 | 1654 | if (empty($content['info_cc'])) $content['info_cc'] = ""; |
| 1657 | 1655 | if (is_array($content['info_cc'])) |
| 1658 | 1656 | { |
| 1659 | - foreach($content['info_cc'] as $i => $value) |
|
| 1657 | + foreach ($content['info_cc'] as $i => $value) |
|
| 1660 | 1658 | { |
| 1661 | 1659 | //imap_rfc822 should not be used, but it works reliable here, until we have some regex solution or use horde stuff |
| 1662 | 1660 | $addresses = imap_rfc822_parse_adrlist($value, ''); |
| 1663 | 1661 | //error_log(__METHOD__.__LINE__.$value.'->'.array2string($addresses[0])); |
| 1664 | - $content['info_cc'][$i]=$addresses[0]->host ? $addresses[0]->mailbox.'@'.$addresses[0]->host : $addresses[0]->mailbox; |
|
| 1662 | + $content['info_cc'][$i] = $addresses[0]->host ? $addresses[0]->mailbox.'@'.$addresses[0]->host : $addresses[0]->mailbox; |
|
| 1665 | 1663 | } |
| 1666 | - if (!empty($content['info_cc'])) $content['info_cc'] = implode(',',$content['info_cc']); |
|
| 1664 | + if (!empty($content['info_cc'])) $content['info_cc'] = implode(',', $content['info_cc']); |
|
| 1667 | 1665 | } |
| 1668 | 1666 | unset($content['button']); |
| 1669 | 1667 | if ($button) |
| 1670 | 1668 | { |
| 1671 | 1669 | // Copy or schedule Infolog |
| 1672 | - if (in_array($button,array('copy','schedule','ical','tracker'))) |
|
| 1670 | + if (in_array($button, array('copy', 'schedule', 'ical', 'tracker'))) |
|
| 1673 | 1671 | { |
| 1674 | 1672 | $action = $button; |
| 1675 | - if (!$info_id || $this->bo->check_access($info_id,EGW_ACL_EDIT)) |
|
| 1673 | + if (!$info_id || $this->bo->check_access($info_id, EGW_ACL_EDIT)) |
|
| 1676 | 1674 | { |
| 1677 | - $button = 'apply'; // need to store infolog first |
|
| 1675 | + $button = 'apply'; // need to store infolog first |
|
| 1678 | 1676 | } |
| 1679 | 1677 | } |
| 1680 | 1678 | //Validate the enddate must be grather than startdate |
| 1681 | 1679 | if (!empty($content['info_enddate']) && !empty($content['info_startdate'])) |
| 1682 | 1680 | { |
| 1683 | - $duration_date = $content['info_enddate']-$content['info_startdate']; |
|
| 1681 | + $duration_date = $content['info_enddate'] - $content['info_startdate']; |
|
| 1684 | 1682 | if ($duration_date < 0) |
| 1685 | 1683 | { |
| 1686 | 1684 | $this->tmpl->set_validation_error('info_startdate', lang('Startdate must be before Enddate!!!')); |
| 1687 | - $button = $action = ''; // stop save or apply |
|
| 1685 | + $button = $action = ''; // stop save or apply |
|
| 1688 | 1686 | } |
| 1689 | 1687 | } |
| 1690 | 1688 | //echo "<p>infolog_ui::edit(info_id=$info_id) '$button' button pressed, content="; _debug_array($content); |
| 1691 | 1689 | if (($button == 'save' || $button == 'apply') && isset($content['info_subject']) && empty($content['info_subject'])) |
| 1692 | 1690 | { |
| 1693 | - $this->tmpl->set_validation_error('info_subject',lang('Field must not be empty !!!')); |
|
| 1694 | - $button = $action = ''; // stop save or apply |
|
| 1691 | + $this->tmpl->set_validation_error('info_subject', lang('Field must not be empty !!!')); |
|
| 1692 | + $button = $action = ''; // stop save or apply |
|
| 1695 | 1693 | } |
| 1696 | 1694 | if (($button == 'save' || $button == 'apply') && $info_id) |
| 1697 | 1695 | { |
| 1698 | 1696 | $old = $this->bo->read($info_id); |
| 1699 | - if (!($edit_acl = $this->bo->check_access($info_id,EGW_ACL_EDIT))) |
|
| 1697 | + if (!($edit_acl = $this->bo->check_access($info_id, EGW_ACL_EDIT))) |
|
| 1700 | 1698 | { |
| 1701 | 1699 | $status_only = $this->bo->is_responsible($old); |
| 1702 | - $undelete = $this->bo->check_access($old,EGW_ACL_UNDELETE); |
|
| 1700 | + $undelete = $this->bo->check_access($old, EGW_ACL_UNDELETE); |
|
| 1703 | 1701 | } |
| 1704 | 1702 | } |
| 1705 | 1703 | if (($button == 'save' || $button == 'apply') && (!$info_id || $edit_acl || $status_only || $undelete)) |
| 1706 | 1704 | { |
| 1707 | - $operation = $info_id ? 'edit' : 'add'; |
|
| 1705 | + $operation = $info_id ? 'edit' : 'add'; |
|
| 1708 | 1706 | if ($content['info_contact']) |
| 1709 | 1707 | { |
| 1710 | 1708 | $old_link_id = (int)$content['info_link_id']; |
| 1711 | - if(is_array($content['info_contact'])) |
|
| 1709 | + if (is_array($content['info_contact'])) |
|
| 1712 | 1710 | { |
| 1713 | 1711 | // eTemplate2 returns the array all ready |
| 1714 | 1712 | $app = $content['info_contact']['app']; |
@@ -1721,11 +1719,11 @@ discard block |
||
| 1721 | 1719 | } |
| 1722 | 1720 | elseif ($app && $id) |
| 1723 | 1721 | { |
| 1724 | - if(!is_array($content['link_to'])) |
|
| 1722 | + if (!is_array($content['link_to'])) |
|
| 1725 | 1723 | { |
| 1726 | 1724 | $content['link_to'] = array(); |
| 1727 | 1725 | } |
| 1728 | - $content['info_link_id'] = (int)($info_link_id = egw_link::link('infolog',$content['link_to']['to_id'],$app,$id)); |
|
| 1726 | + $content['info_link_id'] = (int)($info_link_id = egw_link::link('infolog', $content['link_to']['to_id'], $app, $id)); |
|
| 1729 | 1727 | } |
| 1730 | 1728 | else |
| 1731 | 1729 | { |
@@ -1735,7 +1733,7 @@ discard block |
||
| 1735 | 1733 | { |
| 1736 | 1734 | $link = egw_link::get_link($old_link_id); |
| 1737 | 1735 | // remove selected project, if removed link is that project |
| 1738 | - if($link['link_app2'] == 'projectmanager' && $link['link_id2'] == $content['old_pm_id']) |
|
| 1736 | + if ($link['link_app2'] == 'projectmanager' && $link['link_id2'] == $content['old_pm_id']) |
|
| 1739 | 1737 | { |
| 1740 | 1738 | unset($content['pm_id'], $content['old_pm_id']); |
| 1741 | 1739 | } |
@@ -1749,39 +1747,38 @@ discard block |
||
| 1749 | 1747 | } |
| 1750 | 1748 | if (is_array($content['link_to']['to_id']) && count($content['link_to']['to_id'])) |
| 1751 | 1749 | { |
| 1752 | - $content['info_link_id'] = 0; // as field has to be int |
|
| 1750 | + $content['info_link_id'] = 0; // as field has to be int |
|
| 1753 | 1751 | } |
| 1754 | 1752 | $active_tab = $content['tabs']; |
| 1755 | 1753 | if (!($info_id = $this->bo->write($content, true, true, true, $content['no_notifications']))) |
| 1756 | 1754 | { |
| 1757 | - $content['msg'] = $info_id !== 0 || !$content['info_id'] ? lang('Error: saving the entry') : |
|
| 1758 | - lang('Error: the entry has been updated since you opened it for editing!').'<br />'. |
|
| 1759 | - lang('Copy your changes to the clipboard, %1reload the entry%2 and merge them.','<a href="'. |
|
| 1760 | - htmlspecialchars(egw::link('/index.php',array( |
|
| 1755 | + $content['msg'] = $info_id !== 0 || !$content['info_id'] ? lang('Error: saving the entry') : lang('Error: the entry has been updated since you opened it for editing!').'<br />'. |
|
| 1756 | + lang('Copy your changes to the clipboard, %1reload the entry%2 and merge them.', '<a href="'. |
|
| 1757 | + htmlspecialchars(egw::link('/index.php', array( |
|
| 1761 | 1758 | 'menuaction' => 'infolog.infolog_ui.edit', |
| 1762 | 1759 | 'info_id' => $content['info_id'], |
| 1763 | 1760 | 'no_popup' => $no_popup, |
| 1764 | 1761 | 'referer' => $referer, |
| 1765 | - ))).'">','</a>'); |
|
| 1766 | - $button = $action = ''; // not exiting edit |
|
| 1762 | + ))).'">', '</a>'); |
|
| 1763 | + $button = $action = ''; // not exiting edit |
|
| 1767 | 1764 | $info_id = $content['info_id']; |
| 1768 | 1765 | } |
| 1769 | 1766 | else |
| 1770 | 1767 | { |
| 1771 | - $GLOBALS['egw']->preferences->add('infolog','preferred_type',$content['info_type']); |
|
| 1772 | - $GLOBALS['egw']->preferences->save_repository(false,'user',false); |
|
| 1768 | + $GLOBALS['egw']->preferences->add('infolog', 'preferred_type', $content['info_type']); |
|
| 1769 | + $GLOBALS['egw']->preferences->save_repository(false, 'user', false); |
|
| 1773 | 1770 | $content['msg'] = lang('InfoLog entry saved'); |
| 1774 | - egw_framework::refresh_opener($content['msg'],'infolog',$info_id,$operation); |
|
| 1771 | + egw_framework::refresh_opener($content['msg'], 'infolog', $info_id, $operation); |
|
| 1775 | 1772 | } |
| 1776 | 1773 | $content['tabs'] = $active_tab; |
| 1777 | - if ((int) $content['pm_id'] != (int) $content['old_pm_id']) |
|
| 1774 | + if ((int)$content['pm_id'] != (int)$content['old_pm_id']) |
|
| 1778 | 1775 | { |
| 1779 | 1776 | //echo "<p>pm_id changed: $content[old_pm_id] -> $content[pm_id]</p>\n"; |
| 1780 | 1777 | // update links accordingly, if selected project changed |
| 1781 | 1778 | if ($content['pm_id']) |
| 1782 | 1779 | { |
| 1783 | 1780 | //echo "<p>this->link->link('infolog',{$content['link_to']['to_id']},'projectmanager',{$content['pm_id']});</p>"; |
| 1784 | - egw_link::link('infolog',$content['link_to']['to_id'],'projectmanager',$content['pm_id']); |
|
| 1781 | + egw_link::link('infolog', $content['link_to']['to_id'], 'projectmanager', $content['pm_id']); |
|
| 1785 | 1782 | // making the project the selected link, if no other link selected |
| 1786 | 1783 | if (!$info_link_id || $info_link_id == 'projectmanager:'.$content['old_pm_id']) |
| 1787 | 1784 | { |
@@ -1791,7 +1788,7 @@ discard block |
||
| 1791 | 1788 | if ($content['old_pm_id']) |
| 1792 | 1789 | { |
| 1793 | 1790 | //echo "<p>this->link->unlink2(0,infolog,{$content['link_to']['to_id']},0,'projectmanager',{$content['old_pm_id']});</p>\n"; |
| 1794 | - egw_link::unlink2(0,infolog,$content['link_to']['to_id'],0,'projectmanager',$content['old_pm_id']); |
|
| 1791 | + egw_link::unlink2(0, infolog, $content['link_to']['to_id'], 0, 'projectmanager', $content['old_pm_id']); |
|
| 1795 | 1792 | } |
| 1796 | 1793 | $content['old_pm_id'] = $content['pm_id']; |
| 1797 | 1794 | } |
@@ -1799,14 +1796,14 @@ discard block |
||
| 1799 | 1796 | if ($info_id && is_array($content['link_to']['to_id']) && count($content['link_to']['to_id'])) |
| 1800 | 1797 | { |
| 1801 | 1798 | //echo "<p>writing links for new entry $info_id</p>\n"; _debug_array($content['link_to']['to_id']); |
| 1802 | - egw_link::link('infolog',$info_id,$content['link_to']['to_id']); |
|
| 1799 | + egw_link::link('infolog', $info_id, $content['link_to']['to_id']); |
|
| 1803 | 1800 | $content['link_to']['to_id'] = $info_id; |
| 1804 | 1801 | } |
| 1805 | - if ($info_link_id && strpos($info_link_id,':') !== false) // updating info_link_id if necessary |
|
| 1802 | + if ($info_link_id && strpos($info_link_id, ':') !== false) // updating info_link_id if necessary |
|
| 1806 | 1803 | { |
| 1807 | - list($app,$id) = explode(':',$info_link_id); |
|
| 1808 | - $link = egw_link::get_link('infolog',$info_id,$app,$id); |
|
| 1809 | - if ((int) $content['info_link_id'] != (int) $link['link_id']) |
|
| 1804 | + list($app, $id) = explode(':', $info_link_id); |
|
| 1805 | + $link = egw_link::get_link('infolog', $info_id, $app, $id); |
|
| 1806 | + if ((int)$content['info_link_id'] != (int)$link['link_id']) |
|
| 1810 | 1807 | { |
| 1811 | 1808 | $content['info_link_id'] = $link['link_id']; |
| 1812 | 1809 | |
@@ -1818,9 +1815,9 @@ discard block |
||
| 1818 | 1815 | 'info_owner' => $content['info_owner'], |
| 1819 | 1816 | ); |
| 1820 | 1817 | //echo "<p>updating info_link_id: ".print_r($to_write,true)."</p>\n"; |
| 1821 | - $this->bo->write($to_write,False,true,true,true); // last true = no notifications, as no real change |
|
| 1818 | + $this->bo->write($to_write, False, true, true, true); // last true = no notifications, as no real change |
|
| 1822 | 1819 | // we need eg. the new modification date, for further updates |
| 1823 | - $content = array_merge($content,$to_write); |
|
| 1820 | + $content = array_merge($content, $to_write); |
|
| 1824 | 1821 | } |
| 1825 | 1822 | } |
| 1826 | 1823 | } |
@@ -1831,33 +1828,33 @@ discard block |
||
| 1831 | 1828 | 'action' => $action, |
| 1832 | 1829 | 'action_id' => $action_id |
| 1833 | 1830 | ); |
| 1834 | - if (!($content['msg'] = $this->delete($info_id,$referer,'edit'))) return; // checks ACL first |
|
| 1831 | + if (!($content['msg'] = $this->delete($info_id, $referer, 'edit'))) return; // checks ACL first |
|
| 1835 | 1832 | |
| 1836 | - egw_framework::refresh_opener($content['msg'],'infolog',$info_id,'delete'); |
|
| 1833 | + egw_framework::refresh_opener($content['msg'], 'infolog', $info_id, 'delete'); |
|
| 1837 | 1834 | } |
| 1838 | 1835 | // called again after delete confirmation dialog |
| 1839 | - elseif ($button == 'deleted' && $content['msg']) |
|
| 1836 | + elseif ($button == 'deleted' && $content['msg']) |
|
| 1840 | 1837 | { |
| 1841 | - egw_framework::refresh_opener($content['msg'],'infolog',$info_id,'delete'); |
|
| 1838 | + egw_framework::refresh_opener($content['msg'], 'infolog', $info_id, 'delete'); |
|
| 1842 | 1839 | } |
| 1843 | 1840 | if ($button == 'save' || $button == 'cancel' || $button == 'delete' || $button == 'deleted') |
| 1844 | 1841 | { |
| 1845 | 1842 | if ($no_popup) |
| 1846 | 1843 | { |
| 1847 | - egw::redirect_link($referer,array('msg' => $content['msg'])); |
|
| 1844 | + egw::redirect_link($referer, array('msg' => $content['msg'])); |
|
| 1848 | 1845 | } |
| 1849 | 1846 | egw_framework::window_close(); |
| 1850 | 1847 | } |
| 1851 | 1848 | } |
| 1852 | 1849 | // on a type-change, set the status to the default status of that type, if the actual status is not supported by the new type |
| 1853 | - if (!array_key_exists($content['info_status'],$this->bo->status[$content['info_type']])) |
|
| 1850 | + if (!array_key_exists($content['info_status'], $this->bo->status[$content['info_type']])) |
|
| 1854 | 1851 | { |
| 1855 | 1852 | $content['info_status'] = $this->bo->status['defaults'][$content['info_type']]; |
| 1856 | 1853 | // Make sure we don't end up with invalid status / percent combinations |
| 1857 | 1854 | if ($content['info_status'] != 'done') |
| 1858 | 1855 | { |
| 1859 | 1856 | $content['info_datecompleted'] = ''; |
| 1860 | - if((int)$content['info_percent'] === 100) |
|
| 1857 | + if ((int)$content['info_percent'] === 100) |
|
| 1861 | 1858 | { |
| 1862 | 1859 | $content['info_percent'] = 10; |
| 1863 | 1860 | } |
@@ -1866,7 +1863,7 @@ discard block |
||
| 1866 | 1863 | { |
| 1867 | 1864 | $content['info_percent'] = 100; |
| 1868 | 1865 | } |
| 1869 | - if($content['info_status'] != 'not-started' && (int)$content['info_percent'] == 0) |
|
| 1866 | + if ($content['info_status'] != 'not-started' && (int)$content['info_percent'] == 0) |
|
| 1870 | 1867 | { |
| 1871 | 1868 | $content['info_percent'] = 10; |
| 1872 | 1869 | } |
@@ -1875,25 +1872,24 @@ discard block |
||
| 1875 | 1872 | else // new call via GET |
| 1876 | 1873 | { |
| 1877 | 1874 | //echo "<p>infolog_ui::edit: info_id=$info_id, action='$action', action_id='$action_id', type='$type', referer='$referer'</p>\n"; |
| 1878 | - $action = $action ? $action : get_var('action', array('POST','GET')); |
|
| 1879 | - $action_id = $action_id ? $action_id : get_var('action_id',array('POST','GET')); |
|
| 1880 | - $info_id = $content ? $content : get_var('info_id', array('POST','GET')); |
|
| 1881 | - $type = $type ? $type : get_var('type', array('POST','GET')); |
|
| 1882 | - $referer = $referer !== '' ? $referer : ($_GET['referer'] ? $_GET['referer'] : |
|
| 1883 | - common::get_referer('/index.php?menuaction=infolog.infolog_ui.index')); |
|
| 1884 | - if (strpos($referer, 'msg=') !== false) $referer = preg_replace('/([&?]{1})msg=[^&]+&?/','\\1',$referer); // remove previou/old msg from referer |
|
| 1875 | + $action = $action ? $action : get_var('action', array('POST', 'GET')); |
|
| 1876 | + $action_id = $action_id ? $action_id : get_var('action_id', array('POST', 'GET')); |
|
| 1877 | + $info_id = $content ? $content : get_var('info_id', array('POST', 'GET')); |
|
| 1878 | + $type = $type ? $type : get_var('type', array('POST', 'GET')); |
|
| 1879 | + $referer = $referer !== '' ? $referer : ($_GET['referer'] ? $_GET['referer'] : common::get_referer('/index.php?menuaction=infolog.infolog_ui.index')); |
|
| 1880 | + if (strpos($referer, 'msg=') !== false) $referer = preg_replace('/([&?]{1})msg=[^&]+&?/', '\\1', $referer); // remove previou/old msg from referer |
|
| 1885 | 1881 | $no_popup = $_GET['no_popup']; |
| 1886 | - $print = (int) $_REQUEST['print']; |
|
| 1882 | + $print = (int)$_REQUEST['print']; |
|
| 1887 | 1883 | //echo "<p>infolog_ui::edit: info_id=$info_id, action='$action', action_id='$action_id', type='$type', referer='$referer'</p>\n"; |
| 1888 | 1884 | |
| 1889 | - if (($content = $this->bo->read( $info_id || $action != 'sp' ? $info_id : $action_id )) === false) |
|
| 1885 | + if (($content = $this->bo->read($info_id || $action != 'sp' ? $info_id : $action_id)) === false) |
|
| 1890 | 1886 | { |
| 1891 | 1887 | egw_framework::window_close(lang('Permission denied!')); |
| 1892 | 1888 | } |
| 1893 | - if (!(strpos($content['info_addr'],',')===false) && strpos($content['info_addr'],', ')===false) $content['info_addr'] = str_replace(',',', ',$content['info_addr']); |
|
| 1894 | - foreach(array('info_subject', 'info_des') as $key) |
|
| 1889 | + if (!(strpos($content['info_addr'], ',') === false) && strpos($content['info_addr'], ', ') === false) $content['info_addr'] = str_replace(',', ', ', $content['info_addr']); |
|
| 1890 | + foreach (array('info_subject', 'info_des') as $key) |
|
| 1895 | 1891 | { |
| 1896 | - if(!isset($content[$key]) || strlen($content[$key]) < 75) |
|
| 1892 | + if (!isset($content[$key]) || strlen($content[$key]) < 75) |
|
| 1897 | 1893 | { |
| 1898 | 1894 | continue; |
| 1899 | 1895 | } |
@@ -1901,66 +1897,66 @@ discard block |
||
| 1901 | 1897 | $clarray = array(); |
| 1902 | 1898 | foreach ($contlines as &$line) |
| 1903 | 1899 | { |
| 1904 | - if(strlen($line) < 75) |
|
| 1900 | + if (strlen($line) < 75) |
|
| 1905 | 1901 | { |
| 1906 | 1902 | $clarray[] = $line; |
| 1907 | 1903 | continue; |
| 1908 | 1904 | } |
| 1909 | 1905 | $cont = explode(' ', $line); |
| 1910 | 1906 | $ckarray = array(); |
| 1911 | - foreach($cont as &$word) |
|
| 1907 | + foreach ($cont as &$word) |
|
| 1912 | 1908 | { |
| 1913 | 1909 | // set blank behind all , and . if words are too long, apply wordwrap afterwards to make sure we get |
| 1914 | - if (strlen($word)>75) |
|
| 1910 | + if (strlen($word) > 75) |
|
| 1915 | 1911 | { |
| 1916 | 1912 | $buff = html::activate_links($word); |
| 1917 | 1913 | if (strlen($buff) == strlen($word)) // no links -> try to break overlong words |
| 1918 | 1914 | { |
| 1919 | - if (!(strpos($word,',')===false) && strpos($word,', ')===false) $word = str_replace(',',', ',$word); |
|
| 1920 | - if (!(strpos($word,'.')===false) && strpos($word,'. ')===false) $word = str_replace('.','. ',$word); |
|
| 1915 | + if (!(strpos($word, ',') === false) && strpos($word, ', ') === false) $word = str_replace(',', ', ', $word); |
|
| 1916 | + if (!(strpos($word, '.') === false) && strpos($word, '. ') === false) $word = str_replace('.', '. ', $word); |
|
| 1921 | 1917 | $word = wordwrap($word, 75, ' ', true); |
| 1922 | 1918 | } |
| 1923 | 1919 | } |
| 1924 | - $ckarray[] =$word; |
|
| 1920 | + $ckarray[] = $word; |
|
| 1925 | 1921 | } |
| 1926 | - $line = join(' ',$ckarray); |
|
| 1922 | + $line = join(' ', $ckarray); |
|
| 1927 | 1923 | unset($ckarray); |
| 1928 | 1924 | $clarray[] = $line; |
| 1929 | 1925 | } |
| 1930 | - $content[$key] = join("\n",$clarray); |
|
| 1926 | + $content[$key] = join("\n", $clarray); |
|
| 1931 | 1927 | unset($clarray); |
| 1932 | 1928 | } |
| 1933 | 1929 | if (is_numeric($_REQUEST['cat_id'])) |
| 1934 | 1930 | { |
| 1935 | - $content['info_cat'] = (int) $_REQUEST['cat_id']; |
|
| 1931 | + $content['info_cat'] = (int)$_REQUEST['cat_id']; |
|
| 1936 | 1932 | } |
| 1937 | 1933 | if (!$content) |
| 1938 | 1934 | { |
| 1939 | 1935 | $content['info_cat'] = $this->prefs['cat_add_default']; |
| 1940 | 1936 | } |
| 1941 | - if ($_GET['msg']) $content['msg'] = strip_tags($_GET['msg']); // dont allow HTML! |
|
| 1937 | + if ($_GET['msg']) $content['msg'] = strip_tags($_GET['msg']); // dont allow HTML! |
|
| 1942 | 1938 | |
| 1943 | - switch($this->prefs['set_start']) |
|
| 1939 | + switch ($this->prefs['set_start']) |
|
| 1944 | 1940 | { |
| 1945 | - case 'date': default: $set_startdate = mktime(0,0,0,date('m',$this->bo->user_time_now),date('d',$this->bo->user_time_now),date('Y',$this->bo->user_time_now)); break; |
|
| 1941 | + case 'date': default: $set_startdate = mktime(0, 0, 0, date('m', $this->bo->user_time_now), date('d', $this->bo->user_time_now), date('Y', $this->bo->user_time_now)); break; |
|
| 1946 | 1942 | case 'datetime': $set_startdate = $this->bo->user_time_now; break; |
| 1947 | 1943 | case 'empty': $set_startdate = 0; break; |
| 1948 | 1944 | } |
| 1949 | 1945 | if ((int)$content['info_link_id'] > 0 && !egw_link::get_link($content['info_link_id'])) |
| 1950 | 1946 | { |
| 1951 | - $content['info_link_id'] = 0; // link has been deleted |
|
| 1947 | + $content['info_link_id'] = 0; // link has been deleted |
|
| 1952 | 1948 | if (!$content['info_custom_link']) $content['info_from'] = ''; |
| 1953 | 1949 | } |
| 1954 | 1950 | if (!$info_id && $action_id && $action == 'sp') // new SubProject |
| 1955 | 1951 | { |
| 1956 | - if (!$this->bo->check_access($action_id,EGW_ACL_ADD)) |
|
| 1952 | + if (!$this->bo->check_access($action_id, EGW_ACL_ADD)) |
|
| 1957 | 1953 | { |
| 1958 | - return $referer ? $this->tmpl->location($referer) : $this->index(0,$action,$action_id); |
|
| 1954 | + return $referer ? $this->tmpl->location($referer) : $this->index(0, $action, $action_id); |
|
| 1959 | 1955 | } |
| 1960 | 1956 | } |
| 1961 | 1957 | else |
| 1962 | 1958 | { |
| 1963 | - $undelete = $this->bo->check_access($info_id,EGW_ACL_UNDELETE); |
|
| 1959 | + $undelete = $this->bo->check_access($info_id, EGW_ACL_UNDELETE); |
|
| 1964 | 1960 | } |
| 1965 | 1961 | $content['links'] = $content['link_to'] = array( |
| 1966 | 1962 | 'to_id' => $info_id, |
@@ -1968,12 +1964,12 @@ discard block |
||
| 1968 | 1964 | ); |
| 1969 | 1965 | } |
| 1970 | 1966 | // new call via GET or some actions handled here, as they can happen both ways ($_GET[action] or button/action in GUI) |
| 1971 | - if (!$submit || in_array($action,array('sp','copy','schedule','ical','to_tracker'))) |
|
| 1967 | + if (!$submit || in_array($action, array('sp', 'copy', 'schedule', 'ical', 'to_tracker'))) |
|
| 1972 | 1968 | { |
| 1973 | 1969 | switch ($action) |
| 1974 | 1970 | { |
| 1975 | 1971 | case 'schedule': |
| 1976 | - egw::redirect_link('/index.php',array( |
|
| 1972 | + egw::redirect_link('/index.php', array( |
|
| 1977 | 1973 | 'menuaction' => 'calendar.calendar_uiforms.edit', |
| 1978 | 1974 | 'link_app' => 'infolog', |
| 1979 | 1975 | 'link_id' => $info_id, |
@@ -1981,7 +1977,7 @@ discard block |
||
| 1981 | 1977 | break; |
| 1982 | 1978 | case 'ical': |
| 1983 | 1979 | $boical = new infolog_ical(); |
| 1984 | - $result = $boical->exportVTODO($content,'2.0','PUBLISH',false); |
|
| 1980 | + $result = $boical->exportVTODO($content, '2.0', 'PUBLISH', false); |
|
| 1985 | 1981 | html::content_header('todo.ics', 'text/calendar'); |
| 1986 | 1982 | echo $result; |
| 1987 | 1983 | common::egw_exit(); |
@@ -1992,23 +1988,23 @@ discard block |
||
| 1992 | 1988 | if ($action == 'sp') // for sub-entries use type or category, like for new entries |
| 1993 | 1989 | { |
| 1994 | 1990 | if ($type) $content['info_type'] = $type; |
| 1995 | - if (is_numeric($_REQUEST['cat_id'])) $content['info_cat'] = (int) $_REQUEST['cat_id']; |
|
| 1991 | + if (is_numeric($_REQUEST['cat_id'])) $content['info_cat'] = (int)$_REQUEST['cat_id']; |
|
| 1996 | 1992 | } |
| 1997 | - unset($action); // it get stored in $content and will cause an other copy after [apply] |
|
| 1993 | + unset($action); // it get stored in $content and will cause an other copy after [apply] |
|
| 1998 | 1994 | break; |
| 1999 | 1995 | case 'to_tracker': |
| 2000 | - egw::redirect_link('/index.php',array( |
|
| 1996 | + egw::redirect_link('/index.php', array( |
|
| 2001 | 1997 | 'menuaction' => 'tracker.tracker_ui.edit', |
| 2002 | 1998 | egw_link::get_registry('tracker', 'add_app').'[]' => 'infolog', |
| 2003 | - egw_link::get_registry('tracker','add_id').'[]' => $info_id, |
|
| 1999 | + egw_link::get_registry('tracker', 'add_id').'[]' => $info_id, |
|
| 2004 | 2000 | )); |
| 2005 | 2001 | break; |
| 2006 | 2002 | case 'projectmanager': |
| 2007 | 2003 | $pm_links = array($action_id); |
| 2008 | 2004 | default: // to allow other apps to participate |
| 2009 | 2005 | $content['info_subject'] = egw_link::title($action, $id); |
| 2010 | - $action_ids = explode(',',$action_id); |
|
| 2011 | - if(count($action_ids) == 1) |
|
| 2006 | + $action_ids = explode(',', $action_id); |
|
| 2007 | + if (count($action_ids) == 1) |
|
| 2012 | 2008 | { |
| 2013 | 2009 | $content['info_contact'] = $action.':'.$action_id; |
| 2014 | 2010 | } |
@@ -2017,11 +2013,11 @@ discard block |
||
| 2017 | 2013 | egw_link::link('infolog', $content['link_to']['to_id'], $action, $id); |
| 2018 | 2014 | |
| 2019 | 2015 | // calling "infolog_set" hook for first, in case app wants to set some more values |
| 2020 | - if (!$n && ($set = $GLOBALS['egw']->hooks->single(array('location'=>'infolog_set','id'=>$action_id),$action))) |
|
| 2016 | + if (!$n && ($set = $GLOBALS['egw']->hooks->single(array('location'=>'infolog_set', 'id'=>$action_id), $action))) |
|
| 2021 | 2017 | { |
| 2022 | - foreach((array)$set['link_app'] as $i => $l_app) |
|
| 2018 | + foreach ((array)$set['link_app'] as $i => $l_app) |
|
| 2023 | 2019 | { |
| 2024 | - if (($l_id=$set['link_id'][$i])) egw_link::link('infolog',$content['link_to']['to_id'],$l_app,$l_id); |
|
| 2020 | + if (($l_id = $set['link_id'][$i])) egw_link::link('infolog', $content['link_to']['to_id'], $l_app, $l_id); |
|
| 2025 | 2021 | } |
| 2026 | 2022 | unset($set['link_app']); |
| 2027 | 2023 | unset($set['link_id']); |
@@ -2035,12 +2031,12 @@ discard block |
||
| 2035 | 2031 | { |
| 2036 | 2032 | if (!isset($pm_links)) |
| 2037 | 2033 | { |
| 2038 | - $pm_links = egw_link::get_links('infolog',$info_id,'projectmanager'); |
|
| 2034 | + $pm_links = egw_link::get_links('infolog', $info_id, 'projectmanager'); |
|
| 2039 | 2035 | } |
| 2040 | - break; // normal edit |
|
| 2036 | + break; // normal edit |
|
| 2041 | 2037 | } |
| 2042 | 2038 | case 'new': // new entry, set some defaults, if not set by infolog_set hook |
| 2043 | - if (empty($content['info_startdate'])) $content['info_startdate'] = (int) $_GET['startdate'] ? (int) $_GET['startdate'] : $set_startdate; |
|
| 2039 | + if (empty($content['info_startdate'])) $content['info_startdate'] = (int)$_GET['startdate'] ? (int)$_GET['startdate'] : $set_startdate; |
|
| 2044 | 2040 | if (empty($content['info_priority'])) $content['info_priority'] = 1; // normal |
| 2045 | 2041 | $content['info_owner'] = $this->user; |
| 2046 | 2042 | if ($type != '' && empty($content['info_type'])) |
@@ -2065,9 +2061,9 @@ discard block |
||
| 2065 | 2061 | if ($this->bo->group_owners) |
| 2066 | 2062 | { |
| 2067 | 2063 | // remove types owned by groups the user has no edit grant (current type is made readonly) |
| 2068 | - foreach($this->bo->group_owners as $type => $group) |
|
| 2064 | + foreach ($this->bo->group_owners as $type => $group) |
|
| 2069 | 2065 | { |
| 2070 | - if (!($this->bo->grants[$group] & EGW_ACL_EDIT)) |
|
| 2066 | + if (!($this->bo->grants[$group]&EGW_ACL_EDIT)) |
|
| 2071 | 2067 | { |
| 2072 | 2068 | if ($type == $content['info_type']) |
| 2073 | 2069 | { |
@@ -2085,7 +2081,7 @@ discard block |
||
| 2085 | 2081 | { |
| 2086 | 2082 | $content['info_owner'] = $this->bo->group_owners[$content['info_type']]; |
| 2087 | 2083 | // Dont allow to change the type, if user has no delete rights from the group-owner |
| 2088 | - if ($info_id && !($this->bo->grants[$content['info_owner']] & EGW_ACL_DELETE)) |
|
| 2084 | + if ($info_id && !($this->bo->grants[$content['info_owner']]&EGW_ACL_DELETE)) |
|
| 2089 | 2085 | { |
| 2090 | 2086 | //echo "<p>setting type to r/o as user has no delete rights from group #$group</p>\n"; |
| 2091 | 2087 | $readonlys['info_type'] = true; |
@@ -2093,7 +2089,7 @@ discard block |
||
| 2093 | 2089 | // disable info_access for group-owners |
| 2094 | 2090 | $readonlys['info_access'] = true; |
| 2095 | 2091 | } |
| 2096 | - elseif($GLOBALS['egw']->accounts->get_type($content['info_owner']) == 'g') |
|
| 2092 | + elseif ($GLOBALS['egw']->accounts->get_type($content['info_owner']) == 'g') |
|
| 2097 | 2093 | { |
| 2098 | 2094 | $content['info_owner'] = $this->user; |
| 2099 | 2095 | } |
@@ -2105,18 +2101,18 @@ discard block |
||
| 2105 | 2101 | unset($preserv['links']); unset($preserv['link_to']); |
| 2106 | 2102 | |
| 2107 | 2103 | // for no edit rights or implizit edit of responsible user make all fields readonly, but status and percent |
| 2108 | - if ($info_id && !$this->bo->check_access($info_id,EGW_ACL_EDIT) && !$undelete) |
|
| 2104 | + if ($info_id && !$this->bo->check_access($info_id, EGW_ACL_EDIT) && !$undelete) |
|
| 2109 | 2105 | { |
| 2110 | - $readonlys['__ALL__'] = true; // make all fields not explicitly set readonly |
|
| 2106 | + $readonlys['__ALL__'] = true; // make all fields not explicitly set readonly |
|
| 2111 | 2107 | if ($this->bo->is_responsible($content)) |
| 2112 | 2108 | { |
| 2113 | - foreach($this->bo->responsible_edit as $name) |
|
| 2109 | + foreach ($this->bo->responsible_edit as $name) |
|
| 2114 | 2110 | { |
| 2115 | 2111 | $readonlys[$name] = false; |
| 2116 | 2112 | } |
| 2117 | 2113 | $readonlys['button[edit]'] = $readonlys['button[save]'] = $readonlys['button[apply]'] = $readonlys['no_notifications'] = false; |
| 2118 | 2114 | } |
| 2119 | - $readonlys['action'] = $readonlys['button[cancel]'] = false; // always allowed |
|
| 2115 | + $readonlys['action'] = $readonlys['button[cancel]'] = false; // always allowed |
|
| 2120 | 2116 | } |
| 2121 | 2117 | elseif (!$info_id) |
| 2122 | 2118 | { |
@@ -2129,16 +2125,16 @@ discard block |
||
| 2129 | 2125 | $this->tmpl->setElementAttribute('button[save]', 'label', 'Un-Delete'); |
| 2130 | 2126 | } |
| 2131 | 2127 | |
| 2132 | - if (!($readonlys['button[delete]'] = !$info_id || !$this->bo->check_access($info_id,EGW_ACL_DELETE))) |
|
| 2128 | + if (!($readonlys['button[delete]'] = !$info_id || !$this->bo->check_access($info_id, EGW_ACL_DELETE))) |
|
| 2133 | 2129 | { |
| 2134 | - $content['info_anz_subs'] = $this->bo->anzSubs($info_id); // to determine js confirmation of delete or not |
|
| 2130 | + $content['info_anz_subs'] = $this->bo->anzSubs($info_id); // to determine js confirmation of delete or not |
|
| 2135 | 2131 | } |
| 2136 | 2132 | $GLOBALS['egw_info']['flags']['app_header'] = lang($this->messages[$info_id ? 'edit' : ($action == 'sp' ? 'add_sub' : 'add')]); |
| 2137 | 2133 | |
| 2138 | 2134 | // use a typ-specific template (infolog.edit.xyz), if one exists, otherwise fall back to the generic one |
| 2139 | 2135 | if (!$this->tmpl->read('infolog.edit.'.$content['info_type'])) |
| 2140 | 2136 | { |
| 2141 | - $this->tmpl->read($print ? 'infolog.edit.print':'infolog.edit'); |
|
| 2137 | + $this->tmpl->read($print ? 'infolog.edit.print' : 'infolog.edit'); |
|
| 2142 | 2138 | } |
| 2143 | 2139 | if ($this->bo->has_customfields($content['info_type'])) |
| 2144 | 2140 | { |
@@ -2150,14 +2146,14 @@ discard block |
||
| 2150 | 2146 | } |
| 2151 | 2147 | if (!isset($GLOBALS['egw_info']['user']['apps']['projectmanager'])) |
| 2152 | 2148 | { |
| 2153 | - $readonlys['tabs']['project'] = true; // disable the project tab |
|
| 2149 | + $readonlys['tabs']['project'] = true; // disable the project tab |
|
| 2154 | 2150 | } |
| 2155 | 2151 | |
| 2156 | 2152 | $content['duration_format'] = $this->duration_format; |
| 2157 | 2153 | $content['hours_per_workday'] = $this->hours_per_workday; |
| 2158 | 2154 | if ($this->prefs['show_id']) $content['info_number'] = $info_id; |
| 2159 | 2155 | |
| 2160 | - $content['info_anz_subs'] = (int)$content['info_anz_subs']; // gives javascript error if empty! |
|
| 2156 | + $content['info_anz_subs'] = (int)$content['info_anz_subs']; // gives javascript error if empty! |
|
| 2161 | 2157 | |
| 2162 | 2158 | $old_pm_id = is_array($pm_links) ? array_shift($pm_links) : $content['old_pm_id']; |
| 2163 | 2159 | if (!isset($content['pm_id']) && $old_pm_id) $content['pm_id'] = $old_pm_id; |
@@ -2175,7 +2171,7 @@ discard block |
||
| 2175 | 2171 | 'Pr' => $this->bo->enums['priority'], |
| 2176 | 2172 | 'Ow' => 'select-account', |
| 2177 | 2173 | //'Ac', // info_access: private||public |
| 2178 | - 'St' => $this->bo->status[$content['info_type']]+array('deleted' => 'deleted'), |
|
| 2174 | + 'St' => $this->bo->status[$content['info_type']] + array('deleted' => 'deleted'), |
|
| 2179 | 2175 | 'Pe' => 'select-percent', |
| 2180 | 2176 | 'Co' => 'date-time', |
| 2181 | 2177 | 'st' => 'date-time', |
@@ -2192,7 +2188,7 @@ discard block |
||
| 2192 | 2188 | ); |
| 2193 | 2189 | $history_stati = array(); |
| 2194 | 2190 | $tracking = new infolog_tracking($this); |
| 2195 | - foreach($tracking->field2history as $field => $history) |
|
| 2191 | + foreach ($tracking->field2history as $field => $history) |
|
| 2196 | 2192 | { |
| 2197 | 2193 | $history_stati[$history] = $tracking->field2label[$field]; |
| 2198 | 2194 | } |
@@ -2222,7 +2218,7 @@ discard block |
||
| 2222 | 2218 | { |
| 2223 | 2219 | $sel_options['action']['schedule'] = array('label' => 'Schedule', 'title' => 'Schedule appointment'); |
| 2224 | 2220 | } |
| 2225 | - egw_framework::validate_file('.','edit','infolog'); |
|
| 2221 | + egw_framework::validate_file('.', 'edit', 'infolog'); |
|
| 2226 | 2222 | $GLOBALS['egw_info']['flags']['app_header'] = lang('InfoLog').' - '. |
| 2227 | 2223 | ($content['status_only'] ? lang('Edit Status') : lang('Edit')); |
| 2228 | 2224 | $GLOBALS['egw_info']['flags']['params']['manual'] = array('page' => ($info_id ? 'ManualInfologEdit' : 'ManualInfologAdd')); |
@@ -2230,15 +2226,15 @@ discard block |
||
| 2230 | 2226 | //$content['info_des'] = substr($content['info_des'],0,1793); |
| 2231 | 2227 | //echo "<p>infolog_ui.edit(info_id='$info_id',action='$action',action_id='$action_id') readonlys="; print_r($readonlys); echo ", content = "; _debug_array($content); |
| 2232 | 2228 | //$content['info_cc'] is expected (by the widget) to be an array of emailaddresses, but is stored as comma separated string |
| 2233 | - if (!empty($content['info_cc'])&&!is_array($content['info_cc']))$content['info_cc'] = explode(',',$content['info_cc']); |
|
| 2234 | - $this->tmpl->exec('infolog.infolog_ui.edit',$content,$sel_options,$readonlys,$preserv+array( // preserved values |
|
| 2229 | + if (!empty($content['info_cc']) && !is_array($content['info_cc']))$content['info_cc'] = explode(',', $content['info_cc']); |
|
| 2230 | + $this->tmpl->exec('infolog.infolog_ui.edit', $content, $sel_options, $readonlys, $preserv + array( // preserved values |
|
| 2235 | 2231 | 'info_id' => $info_id, |
| 2236 | 2232 | 'action' => $action, |
| 2237 | 2233 | 'action_id' => $action_id, |
| 2238 | 2234 | 'referer' => $referer, |
| 2239 | 2235 | 'no_popup' => $no_popup, |
| 2240 | 2236 | 'old_pm_id' => $old_pm_id, |
| 2241 | - ),$no_popup ? 0 : 2); |
|
| 2237 | + ), $no_popup ? 0 : 2); |
|
| 2242 | 2238 | } |
| 2243 | 2239 | |
| 2244 | 2240 | /** |
@@ -2249,16 +2245,16 @@ discard block |
||
| 2249 | 2245 | * @param array &$content |
| 2250 | 2246 | * @param boolean $create_sub true: create a sub-entry instead of a copy, default false to create a copy |
| 2251 | 2247 | */ |
| 2252 | - private function create_copy(array &$content, $create_sub=false) |
|
| 2248 | + private function create_copy(array &$content, $create_sub = false) |
|
| 2253 | 2249 | { |
| 2254 | - $info_id = $content['info_id']; // it will be unset by exclude-fields |
|
| 2250 | + $info_id = $content['info_id']; // it will be unset by exclude-fields |
|
| 2255 | 2251 | |
| 2256 | 2252 | // empty fields configured to be excluded (also contains id, uid, ...) |
| 2257 | 2253 | $exclude_fields = $create_sub ? $this->bo->sub_excludefields : $this->bo->copy_excludefields; |
| 2258 | 2254 | foreach ($exclude_fields as $field) |
| 2259 | 2255 | { |
| 2260 | 2256 | unset($content[$field]); |
| 2261 | - if ($field == 'info_from') unset($content['info_link_id']); // both together is called contact in UI |
|
| 2257 | + if ($field == 'info_from') unset($content['info_link_id']); // both together is called contact in UI |
|
| 2262 | 2258 | } |
| 2263 | 2259 | if ($create_sub) |
| 2264 | 2260 | { |
@@ -2267,9 +2263,9 @@ discard block |
||
| 2267 | 2263 | // no startdate or startdate in the past --> set startdate from pref |
| 2268 | 2264 | if (!isset($content['info_startdate']) || $content['info_startdate'] < $this->bo->user_time_now) |
| 2269 | 2265 | { |
| 2270 | - switch($this->prefs['set_start']) |
|
| 2266 | + switch ($this->prefs['set_start']) |
|
| 2271 | 2267 | { |
| 2272 | - case 'date': default: $set_startdate = mktime(0,0,0,date('m',$this->bo->user_time_now),date('d',$this->bo->user_time_now),date('Y',$this->bo->user_time_now)); break; |
|
| 2268 | + case 'date': default: $set_startdate = mktime(0, 0, 0, date('m', $this->bo->user_time_now), date('d', $this->bo->user_time_now), date('Y', $this->bo->user_time_now)); break; |
|
| 2273 | 2269 | case 'datetime': $set_startdate = $this->bo->user_time_now; break; |
| 2274 | 2270 | case 'empty': $set_startdate = 0; break; |
| 2275 | 2271 | } |
@@ -2288,17 +2284,17 @@ discard block |
||
| 2288 | 2284 | // get a consistent status, percent and date-completed |
| 2289 | 2285 | if (!isset($content['info_status'])) $content['info_status'] = $this->bo->status['defaults'][$content['info_type']]; |
| 2290 | 2286 | if (!isset($content['info_percent'])) $content['info_percent'] = $content['info_status'] == 'done' ? '100%' : '0%'; |
| 2291 | - $content['info_datecompleted'] =$content['info_status'] == 'done' ? $this->bo->user_time_now : 0; |
|
| 2287 | + $content['info_datecompleted'] = $content['info_status'] == 'done' ? $this->bo->user_time_now : 0; |
|
| 2292 | 2288 | |
| 2293 | 2289 | if (!isset($content['info_cat'])) $content['info_cat'] = $this->prefs['cat_add_default']; |
| 2294 | 2290 | |
| 2295 | - if(!is_array($content['link_to'])) $content['link_to'] = array(); |
|
| 2291 | + if (!is_array($content['link_to'])) $content['link_to'] = array(); |
|
| 2296 | 2292 | $content['link_to']['to_app'] = 'infolog'; |
| 2297 | 2293 | $content['link_to']['to_id'] = 0; |
| 2298 | 2294 | // Get links to be copied, if not excluded |
| 2299 | - if (!in_array('link_to',$exclude_fields) || !in_array('attachments',$exclude_fields)) |
|
| 2295 | + if (!in_array('link_to', $exclude_fields) || !in_array('attachments', $exclude_fields)) |
|
| 2300 | 2296 | { |
| 2301 | - foreach(egw_link::get_links($content['link_to']['to_app'], $info_id) as $link) |
|
| 2297 | + foreach (egw_link::get_links($content['link_to']['to_app'], $info_id) as $link) |
|
| 2302 | 2298 | { |
| 2303 | 2299 | if ($link['app'] != egw_link::VFS_APPNAME && !in_array('link_to', $exclude_fields)) |
| 2304 | 2300 | { |
@@ -2322,19 +2318,19 @@ discard block |
||
| 2322 | 2318 | if (!isset($content['info_contact']) || empty($content['info_contact']) || $content['info_contact'] === 'copy:') |
| 2323 | 2319 | { |
| 2324 | 2320 | $linkinfos = egw_link::get_link($info_link_id); |
| 2325 | - $content['info_contact'] = $linkinfos['link_app1']=='infolog'? $linkinfos['link_app2'].':'.$linkinfos['link_id2']:$linkinfos['link_app1'].':'.$linkinfos['link_id1']; |
|
| 2326 | - if (stripos($content['info_contact'],'projectmanager')!==false) $content['pm_id'] = $linkinfos['link_app1']=='projectmanager'? $linkinfos['link_id1']:$linkinfos['link_id2']; |
|
| 2321 | + $content['info_contact'] = $linkinfos['link_app1'] == 'infolog' ? $linkinfos['link_app2'].':'.$linkinfos['link_id2'] : $linkinfos['link_app1'].':'.$linkinfos['link_id1']; |
|
| 2322 | + if (stripos($content['info_contact'], 'projectmanager') !== false) $content['pm_id'] = $linkinfos['link_app1'] == 'projectmanager' ? $linkinfos['link_id1'] : $linkinfos['link_id2']; |
|
| 2327 | 2323 | } |
| 2328 | 2324 | unset($content['info_link_id']); |
| 2329 | 2325 | } |
| 2330 | - $content['info_owner'] = !(int)$this->owner || !$this->bo->check_perms(EGW_ACL_ADD,0,$this->owner) ? $this->user : $this->owner; |
|
| 2326 | + $content['info_owner'] = !(int)$this->owner || !$this->bo->check_perms(EGW_ACL_ADD, 0, $this->owner) ? $this->user : $this->owner; |
|
| 2331 | 2327 | |
| 2332 | 2328 | if (!empty($content['info_subject'])) |
| 2333 | 2329 | { |
| 2334 | 2330 | if ($create_sub) |
| 2335 | 2331 | { |
| 2336 | 2332 | $config = config::read('infolog'); |
| 2337 | - $prefix = lang(empty($config['sub_prefix']) ? 'Re:': $config['sub_prefix']); |
|
| 2333 | + $prefix = lang(empty($config['sub_prefix']) ? 'Re:' : $config['sub_prefix']); |
|
| 2338 | 2334 | } |
| 2339 | 2335 | else |
| 2340 | 2336 | { |
@@ -2344,17 +2340,17 @@ discard block |
||
| 2344 | 2340 | } |
| 2345 | 2341 | if (!$create_sub) |
| 2346 | 2342 | { |
| 2347 | - $content['msg'] .= ($content['msg']?"\n":'').lang('Infolog copied - the copy can now be edited'); |
|
| 2343 | + $content['msg'] .= ($content['msg'] ? "\n" : '').lang('Infolog copied - the copy can now be edited'); |
|
| 2348 | 2344 | } |
| 2349 | 2345 | } |
| 2350 | 2346 | |
| 2351 | - function icon($cat,$id,$status='') |
|
| 2347 | + function icon($cat, $id, $status = '') |
|
| 2352 | 2348 | { |
| 2353 | 2349 | if (!$status || !($icon = $this->icons[$cat][$id.'_'.$status])) |
| 2354 | 2350 | { |
| 2355 | 2351 | $icon = $this->icons[$cat][$id]; |
| 2356 | 2352 | } |
| 2357 | - if ($icon && !is_readable(common::get_image_dir() . '/' . $icon)) |
|
| 2353 | + if ($icon && !is_readable(common::get_image_dir().'/'.$icon)) |
|
| 2358 | 2354 | { |
| 2359 | 2355 | $icon = False; |
| 2360 | 2356 | } |
@@ -2365,7 +2361,7 @@ discard block |
||
| 2365 | 2361 | $alt = $id; |
| 2366 | 2362 | } |
| 2367 | 2363 | } |
| 2368 | - return $icon ? html::image('infolog',$icon,lang($alt),'border=0') : lang($alt); |
|
| 2364 | + return $icon ? html::image('infolog', $icon, lang($alt), 'border=0') : lang($alt); |
|
| 2369 | 2365 | } |
| 2370 | 2366 | |
| 2371 | 2367 | /** |
@@ -2377,7 +2373,7 @@ discard block |
||
| 2377 | 2373 | */ |
| 2378 | 2374 | function array_stripslashes($arr) |
| 2379 | 2375 | { |
| 2380 | - foreach($arr as $key => $val) |
|
| 2376 | + foreach ($arr as $key => $val) |
|
| 2381 | 2377 | { |
| 2382 | 2378 | if (is_array($val)) |
| 2383 | 2379 | { |
@@ -2438,27 +2434,27 @@ discard block |
||
| 2438 | 2434 | 'info_cc' => 'CC', |
| 2439 | 2435 | ); |
| 2440 | 2436 | // add customfields to field list |
| 2441 | - foreach(config::get_customfields('infolog') as $name => $data) |
|
| 2437 | + foreach (config::get_customfields('infolog') as $name => $data) |
|
| 2442 | 2438 | { |
| 2443 | 2439 | $excludefields['#'.$name] = $data['label']; |
| 2444 | 2440 | } |
| 2445 | 2441 | $sub_excludefields = $excludefields; |
| 2446 | - unset($sub_excludefields['info_id_parent']); // always set to parent! |
|
| 2442 | + unset($sub_excludefields['info_id_parent']); // always set to parent! |
|
| 2447 | 2443 | |
| 2448 | 2444 | $config = config::read('infolog'); |
| 2449 | 2445 | |
| 2450 | - if($content) |
|
| 2446 | + if ($content) |
|
| 2451 | 2447 | { |
| 2452 | 2448 | // Save |
| 2453 | 2449 | $button = key($content['button']); |
| 2454 | - if($button == 'save' || $button == 'apply') |
|
| 2450 | + if ($button == 'save' || $button == 'apply') |
|
| 2455 | 2451 | { |
| 2456 | - $this->bo->responsible_edit = array('info_status','info_percent','info_datecompleted'); |
|
| 2452 | + $this->bo->responsible_edit = array('info_status', 'info_percent', 'info_datecompleted'); |
|
| 2457 | 2453 | |
| 2458 | 2454 | if ($content['responsible_edit']) |
| 2459 | 2455 | { |
| 2460 | - $extra = array_intersect($content['responsible_edit'],array_keys($fields)); |
|
| 2461 | - $this->bo->responsible_edit = array_unique(array_merge($this->bo->responsible_edit,$extra)); |
|
| 2456 | + $extra = array_intersect($content['responsible_edit'], array_keys($fields)); |
|
| 2457 | + $this->bo->responsible_edit = array_unique(array_merge($this->bo->responsible_edit, $extra)); |
|
| 2462 | 2458 | } |
| 2463 | 2459 | config::save_value('copy_excludefields', $content['copy_excludefields'] ? $content['copy_excludefields'] : null, 'infolog'); |
| 2464 | 2460 | config::save_value('sub_excludefields', $content['sub_excludefields'] ? $content['sub_excludefields'] : array('*NONE*'), 'infolog'); |
@@ -2469,12 +2465,12 @@ discard block |
||
| 2469 | 2465 | config::save_value('sub_prefix', $content['sub_prefix'], 'infolog'); |
| 2470 | 2466 | |
| 2471 | 2467 | // Notifications |
| 2472 | - $notifications =& $config[infolog_tracking::CUSTOM_NOTIFICATION]; |
|
| 2468 | + $notifications = & $config[infolog_tracking::CUSTOM_NOTIFICATION]; |
|
| 2473 | 2469 | $notifications[$content['notification_type']] = $content['notification']; |
| 2474 | - config::save_value(infolog_tracking::CUSTOM_NOTIFICATION, $notifications,'infolog'); |
|
| 2470 | + config::save_value(infolog_tracking::CUSTOM_NOTIFICATION, $notifications, 'infolog'); |
|
| 2475 | 2471 | } |
| 2476 | 2472 | |
| 2477 | - if($button == 'save' || $button == 'cancel') |
|
| 2473 | + if ($button == 'save' || $button == 'cancel') |
|
| 2478 | 2474 | { |
| 2479 | 2475 | egw::redirect_link('/index.php', array( |
| 2480 | 2476 | 'menuaction' => 'admin.admin_ui.index', |
@@ -2497,7 +2493,7 @@ discard block |
||
| 2497 | 2493 | $GLOBALS['egw_info']['flags']['app_header'] = lang('InfoLog').' - '.lang('Site configuration'); |
| 2498 | 2494 | |
| 2499 | 2495 | // Load selected custom notification |
| 2500 | - if(!$content['notification_type']) |
|
| 2496 | + if (!$content['notification_type']) |
|
| 2501 | 2497 | { |
| 2502 | 2498 | $content['notification_type'] = '~global~'; |
| 2503 | 2499 | } |
@@ -2521,7 +2517,7 @@ discard block |
||
| 2521 | 2517 | ); |
| 2522 | 2518 | $preserve['notification_old_type'] = $content['notification_type']; |
| 2523 | 2519 | $this->tmpl->read('infolog.config'); |
| 2524 | - $this->tmpl->exec('infolog.infolog_ui.admin',$content,$sel_options,array(),$preserve); |
|
| 2520 | + $this->tmpl->exec('infolog.infolog_ui.admin', $content, $sel_options, array(), $preserve); |
|
| 2525 | 2521 | } |
| 2526 | 2522 | |
| 2527 | 2523 | /** |
@@ -2530,13 +2526,13 @@ discard block |
||
| 2530 | 2526 | * @param array $mailContent = null content of mail |
| 2531 | 2527 | * @return array |
| 2532 | 2528 | */ |
| 2533 | - function mail_import(array $mailContent=null) |
|
| 2529 | + function mail_import(array $mailContent = null) |
|
| 2534 | 2530 | { |
| 2535 | 2531 | // It would get called from compose as a popup with egw_data |
| 2536 | 2532 | if (!is_array($mailContent) && ($_GET['egw_data'])) |
| 2537 | 2533 | { |
| 2538 | 2534 | // get the mail raw data |
| 2539 | - egw_link::get_data ($_GET['egw_data']); |
|
| 2535 | + egw_link::get_data($_GET['egw_data']); |
|
| 2540 | 2536 | return false; |
| 2541 | 2537 | } |
| 2542 | 2538 | |
@@ -2567,7 +2563,7 @@ discard block |
||
| 2567 | 2563 | function hook_view($args) |
| 2568 | 2564 | { |
| 2569 | 2565 | // Load JS for infolog actions |
| 2570 | - egw_framework::validate_file('.','app','infolog'); |
|
| 2566 | + egw_framework::validate_file('.', 'app', 'infolog'); |
|
| 2571 | 2567 | |
| 2572 | 2568 | switch ($args['location']) |
| 2573 | 2569 | { |
@@ -2595,7 +2591,7 @@ discard block |
||
| 2595 | 2591 | { |
| 2596 | 2592 | return False; |
| 2597 | 2593 | } |
| 2598 | - $this->called_by = $app; // for read/save_sessiondata, to have different sessions for the hooks |
|
| 2594 | + $this->called_by = $app; // for read/save_sessiondata, to have different sessions for the hooks |
|
| 2599 | 2595 | |
| 2600 | 2596 | // Set to calling app, so actions wind up in the correct place client side |
| 2601 | 2597 | $GLOBALS['egw_info']['flags']['currentapp'] = $app; |
@@ -2603,11 +2599,11 @@ discard block |
||
| 2603 | 2599 | translation::add_app('infolog'); |
| 2604 | 2600 | |
| 2605 | 2601 | // Still want infolog categories though |
| 2606 | - $GLOBALS['egw']->categories = new categories('','infolog'); |
|
| 2607 | - $this->index(null,$app,$args[$view_id],array( |
|
| 2602 | + $GLOBALS['egw']->categories = new categories('', 'infolog'); |
|
| 2603 | + $this->index(null, $app, $args[$view_id], array( |
|
| 2608 | 2604 | 'menuaction' => $view, |
| 2609 | 2605 | isset($view_id2) ? $view_id2 : $view_id => $args[$view_id] |
| 2610 | - ),True); |
|
| 2606 | + ), True); |
|
| 2611 | 2607 | } |
| 2612 | 2608 | |
| 2613 | 2609 | /** |
@@ -2616,26 +2612,26 @@ discard block |
||
| 2616 | 2612 | * @param string $type infolog type to include only the matching custom fields if set |
| 2617 | 2613 | * @return array |
| 2618 | 2614 | */ |
| 2619 | - function csv_export_fields($type=null) |
|
| 2615 | + function csv_export_fields($type = null) |
|
| 2620 | 2616 | { |
| 2621 | 2617 | $fields = array( |
| 2622 | 2618 | 'info_type' => lang('Type'), |
| 2623 | 2619 | 'info_from' => lang('Contact'), |
| 2624 | 2620 | 'info_addr' => lang('Phone/Email'), |
| 2625 | 2621 | // 'info_link_id' => lang('primary link'), |
| 2626 | - 'info_cat' => array('label' => lang('Category'),'type' => 'select-cat'), |
|
| 2622 | + 'info_cat' => array('label' => lang('Category'), 'type' => 'select-cat'), |
|
| 2627 | 2623 | 'info_priority' => lang('Priority'), |
| 2628 | - 'info_owner' => array('label' => lang('Owner'),'type' => 'select-account'), |
|
| 2624 | + 'info_owner' => array('label' => lang('Owner'), 'type' => 'select-account'), |
|
| 2629 | 2625 | 'info_access' => lang('Access'), |
| 2630 | 2626 | 'info_status' => lang('Status'), |
| 2631 | 2627 | 'info_percent' => lang('Completed'), |
| 2632 | 2628 | 'info_datecompleted' => lang('Date completed'), |
| 2633 | 2629 | 'info_datemodified' => lang('Last modified'), |
| 2634 | - 'info_modifier' => array('label' => lang('Modifier'),'type' => 'select-account'), |
|
| 2630 | + 'info_modifier' => array('label' => lang('Modifier'), 'type' => 'select-account'), |
|
| 2635 | 2631 | 'info_location' => lang('Location'), |
| 2636 | 2632 | 'info_startdate' => lang('Startdate'), |
| 2637 | 2633 | 'info_enddate' => lang('Enddate'), |
| 2638 | - 'info_responsible' => array('label' => lang('Responsible'),'type' => 'select-account'), |
|
| 2634 | + 'info_responsible' => array('label' => lang('Responsible'), 'type' => 'select-account'), |
|
| 2639 | 2635 | 'info_subject' => lang('Subject'), |
| 2640 | 2636 | 'info_des' => lang('Description'), |
| 2641 | 2637 | 'info_id' => lang('Id'), |
@@ -2645,13 +2641,13 @@ discard block |
||
| 2645 | 2641 | 'pl_id' => lang('pricelist'), |
| 2646 | 2642 | 'info_price' => lang('price'), |
| 2647 | 2643 | ); |
| 2648 | - foreach($this->bo->timestamps as $name) |
|
| 2644 | + foreach ($this->bo->timestamps as $name) |
|
| 2649 | 2645 | { |
| 2650 | - $fields[$name] = array('label' => $fields[$name],'type' => 'date-time'); |
|
| 2646 | + $fields[$name] = array('label' => $fields[$name], 'type' => 'date-time'); |
|
| 2651 | 2647 | } |
| 2652 | - foreach($this->bo->customfields as $name => $data) |
|
| 2648 | + foreach ($this->bo->customfields as $name => $data) |
|
| 2653 | 2649 | { |
| 2654 | - if ($data['type2'] && $type && !in_array($type,explode(',',$data['type2']))) continue; |
|
| 2650 | + if ($data['type2'] && $type && !in_array($type, explode(',', $data['type2']))) continue; |
|
| 2655 | 2651 | |
| 2656 | 2652 | $fields['#'.$name] = array( |
| 2657 | 2653 | 'label' => $data['label'], |
@@ -90,7 +90,10 @@ discard block |
||
| 90 | 90 | */ |
| 91 | 91 | function __construct() |
| 92 | 92 | { |
| 93 | - if ($GLOBALS['egw_info']['flags']['currentapp'] != 'infolog') translation::add_app('infolog'); |
|
| 93 | + if ($GLOBALS['egw_info']['flags']['currentapp'] != 'infolog') |
|
| 94 | + { |
|
| 95 | + translation::add_app('infolog'); |
|
| 96 | + } |
|
| 94 | 97 | |
| 95 | 98 | // Make sure Global category is infolog - on first load, it may not be |
| 96 | 99 | if($GLOBALS['egw_info']['flags']['currentapp'] == 'infolog' && !$GLOBALS['egw']->categories->app_name) |
@@ -164,13 +167,19 @@ discard block |
||
| 164 | 167 | $done = $info['info_status'] == 'done' || $info['info_status'] == 'billed' || $info['info_status'] == 'cancelled'; //cancelled is regarded as a completed status as well in bo |
| 165 | 168 | // regard an infolog as done/billed/cancelled if its percentage is 100% when there is to status like the above for that type |
| 166 | 169 | if (!$done && !isset($this->bo->status[$info['info_type']]['done']) && !isset($this->bo->status[$info['info_type']]['billed']) && |
| 167 | - !isset($this->bo->status[$info['info_type']]['cancelled']) && (int)$info['info_percent']==100) $done = true ; |
|
| 170 | + !isset($this->bo->status[$info['info_type']]['cancelled']) && (int)$info['info_percent']==100) |
|
| 171 | + { |
|
| 172 | + $done = true ; |
|
| 173 | + } |
|
| 168 | 174 | $info['sub_class'] = $this->bo->enums['priority'][$info['info_priority']] . ($done ? '_done' : ''); |
| 169 | 175 | if (!$done && $info['info_enddate'] < $this->bo->user_time_now) |
| 170 | 176 | { |
| 171 | 177 | $info['end_class'] = 'infolog_overdue'; |
| 172 | 178 | } |
| 173 | - if (!isset($info['info_anz_subs'])) $info['info_anz_subs'] = $this->bo->anzSubs($id); |
|
| 179 | + if (!isset($info['info_anz_subs'])) |
|
| 180 | + { |
|
| 181 | + $info['info_anz_subs'] = $this->bo->anzSubs($id); |
|
| 182 | + } |
|
| 174 | 183 | $this->bo->link_id2from($info,$action,$action_id); // unset from for $action:$action_id |
| 175 | 184 | $info['info_percent'] = (int) $info['info_percent'].'%'; |
| 176 | 185 | $editrights = $this->bo->check_access($info,EGW_ACL_EDIT); |
@@ -203,12 +212,21 @@ discard block |
||
| 203 | 212 | { |
| 204 | 213 | $info['class'] .= 'rowNoSubs '; |
| 205 | 214 | } |
| 206 | - if ($info['info_id_parent']) $info['class'] .= 'infolog_rowHasParent '; |
|
| 207 | - if ($info['info_anz_subs'] > 0) $info['class'] .= 'infolog_rowHasSubs '; |
|
| 215 | + if ($info['info_id_parent']) |
|
| 216 | + { |
|
| 217 | + $info['class'] .= 'infolog_rowHasParent '; |
|
| 218 | + } |
|
| 219 | + if ($info['info_anz_subs'] > 0) |
|
| 220 | + { |
|
| 221 | + $info['class'] .= 'infolog_rowHasSubs '; |
|
| 222 | + } |
|
| 208 | 223 | |
| 209 | 224 | $info['row_mod'] = $info['info_datemodified']; |
| 210 | 225 | |
| 211 | - if (!$show_links) $show_links = $this->prefs['show_links']; |
|
| 226 | + if (!$show_links) |
|
| 227 | + { |
|
| 228 | + $show_links = $this->prefs['show_links']; |
|
| 229 | + } |
|
| 212 | 230 | if (($show_links != 'none' && $show_links != 'no_describtion' || |
| 213 | 231 | $this->prefs['show_times'] || isset($GLOBALS['egw_info']['user']['apps']['timesheet'])) && |
| 214 | 232 | (isset($info['links']) || ($info['links'] = egw_link::get_links('infolog',$info['info_id'],'','link_lastmod DESC',true,true)))) |
@@ -218,9 +236,16 @@ discard block |
||
| 218 | 236 | { |
| 219 | 237 | // incl. link modification time into row_mod (link's lastmod is always in server-time!) |
| 220 | 238 | $link_mod = egw_time::server2user($link['lastmod']); |
| 221 | - if ($info['row_mod'] < $link_mod) $info['row_mod'] = $link_mod; |
|
| 239 | + if ($info['row_mod'] < $link_mod) |
|
| 240 | + { |
|
| 241 | + $info['row_mod'] = $link_mod; |
|
| 242 | + } |
|
| 222 | 243 | |
| 223 | - if ($link['deleted']) continue; // skip deleted links, but incl. them in row_mod! |
|
| 244 | + if ($link['deleted']) |
|
| 245 | + { |
|
| 246 | + continue; |
|
| 247 | + } |
|
| 248 | + // skip deleted links, but incl. them in row_mod! |
|
| 224 | 249 | |
| 225 | 250 | if ($show_links != 'none' && $show_links != 'no_describtion' && |
| 226 | 251 | $link['link_id'] != $info['info_link_id'] && |
@@ -233,14 +258,20 @@ discard block |
||
| 233 | 258 | { |
| 234 | 259 | $info['pm_id'] = $link['id']; |
| 235 | 260 | } |
| 236 | - if ($link['app'] == 'timesheet') $timesheets[] = $link['id']; |
|
| 261 | + if ($link['app'] == 'timesheet') |
|
| 262 | + { |
|
| 263 | + $timesheets[] = $link['id']; |
|
| 264 | + } |
|
| 237 | 265 | } |
| 238 | 266 | if ($this->prefs['show_times'] && isset($GLOBALS['egw_info']['user']['apps']['timesheet']) && $timesheets) |
| 239 | 267 | { |
| 240 | 268 | $sum = ExecMethod('timesheet.timesheet_bo.sum',$timesheets); |
| 241 | 269 | $info['info_sum_timesheets'] = $sum['duration']; |
| 242 | 270 | // incl. max timesheet modification in row_mod |
| 243 | - if ($info['row_mod'] < $sum['max_modified']) $info['row_mod'] = $sum['max_modified']; |
|
| 271 | + if ($info['row_mod'] < $sum['max_modified']) |
|
| 272 | + { |
|
| 273 | + $info['row_mod'] = $sum['max_modified']; |
|
| 274 | + } |
|
| 244 | 275 | } |
| 245 | 276 | } |
| 246 | 277 | $info['info_type_label'] = $this->bo->enums['type'][$info['info_type']]; |
@@ -255,10 +286,13 @@ discard block |
||
| 255 | 286 | } |
| 256 | 287 | $readonlys["edit_percent[$id]"] = true; |
| 257 | 288 | } |
| 258 | - elseif($readonlys["edit_percent[$id]"]) // show percent, but button is switched off |
|
| 289 | + elseif($readonlys["edit_percent[$id]"]) |
|
| 290 | + { |
|
| 291 | + // show percent, but button is switched off |
|
| 259 | 292 | { |
| 260 | 293 | $info['info_percent2'] = $info['info_percent']; |
| 261 | 294 | } |
| 295 | + } |
|
| 262 | 296 | if ($this->prefs['show_id'] == 1 || $this->prefs['show_id'] == 2 && $details) |
| 263 | 297 | { |
| 264 | 298 | $info['info_number'] = $info['info_id']; |
@@ -332,10 +366,16 @@ discard block |
||
| 332 | 366 | $query['col_filter'] = array('info_id_parent' => $query['col_filter']['info_id_parent']); |
| 333 | 367 | } |
| 334 | 368 | $orginal_colfilter = $query['col_filter']; |
| 335 | - if (isset($parent_id)) $query['col_filter']['info_id_parent'] = (string)$parent_id; |
|
| 369 | + if (isset($parent_id)) |
|
| 370 | + { |
|
| 371 | + $query['col_filter']['info_id_parent'] = (string)$parent_id; |
|
| 372 | + } |
|
| 336 | 373 | |
| 337 | 374 | //echo "<p>infolog_ui.get_rows(start=$query[start],search='$query[search]',filter='$query[filter]',cat_id=$query[cat_id],action='$query[action]/$query[action_id]',col_filter=".print_r($query['col_filter'],True).",sort=$query[sort],order=$query[order])</p>\n"; |
| 338 | - if (!isset($query['start'])) $query['start'] = 0; |
|
| 375 | + if (!isset($query['start'])) |
|
| 376 | + { |
|
| 377 | + $query['start'] = 0; |
|
| 378 | + } |
|
| 339 | 379 | |
| 340 | 380 | // handle action and linked filter (show only entries linked to a certain other entry) |
| 341 | 381 | $link_filters = array(); |
@@ -364,7 +404,10 @@ discard block |
||
| 364 | 404 | $app = $link['app']; |
| 365 | 405 | $id = $link['id']; |
| 366 | 406 | } |
| 367 | - if(!is_array($id)) $id = explode(',',$id); |
|
| 407 | + if(!is_array($id)) |
|
| 408 | + { |
|
| 409 | + $id = explode(',',$id); |
|
| 410 | + } |
|
| 368 | 411 | if (!($linked = egw_link::get_links_multiple($app,$id,true,'infolog','',$query['col_filter']['info_status'] == 'deleted'))) |
| 369 | 412 | { |
| 370 | 413 | $rows = array(); // no infologs linked to selected link --> no rows to return |
@@ -413,7 +456,10 @@ discard block |
||
| 413 | 456 | } |
| 414 | 457 | } |
| 415 | 458 | // Template change forces the UI to do a full update first, no point in getting rows right now |
| 416 | - if($old_template && $old_template != $query['template']) return 0; |
|
| 459 | + if($old_template && $old_template != $query['template']) |
|
| 460 | + { |
|
| 461 | + return 0; |
|
| 462 | + } |
|
| 417 | 463 | |
| 418 | 464 | // do we need to read the custom fields, depends on the column is enabled and customfields exist, prefs are filter specific |
| 419 | 465 | // so we have to check that as well |
@@ -474,12 +520,18 @@ discard block |
||
| 474 | 520 | $parent_first = count($parents) == 1; |
| 475 | 521 | $parent_index = 0; |
| 476 | 522 | // et2 nextmatch listens to total, and only displays that many rows, so add parent in or we'll lose the last row |
| 477 | - if($parent_first || $query['action'] == 'sp' && is_array($query['action_id'])) $query['total']++; |
|
| 523 | + if($parent_first || $query['action'] == 'sp' && is_array($query['action_id'])) |
|
| 524 | + { |
|
| 525 | + $query['total']++; |
|
| 526 | + } |
|
| 478 | 527 | |
| 479 | 528 | // Check to see if we need to remove description |
| 480 | 529 | foreach($infos as $id => $info) |
| 481 | 530 | { |
| 482 | - if (!(strpos($info['info_addr'],',')===false) && strpos($info['info_addr'],', ')===false) $info['info_addr'] = str_replace(',',', ',$info['info_addr']); |
|
| 531 | + if (!(strpos($info['info_addr'],',')===false) && strpos($info['info_addr'],', ')===false) |
|
| 532 | + { |
|
| 533 | + $info['info_addr'] = str_replace(',',', ',$info['info_addr']); |
|
| 534 | + } |
|
| 483 | 535 | if (!$query['csv_export'] || !is_array($query['csv_export'])) |
| 484 | 536 | { |
| 485 | 537 | $info['links'] =& $links[$id]; |
@@ -503,7 +555,10 @@ discard block |
||
| 503 | 555 | { |
| 504 | 556 | foreach(array_keys($main) as $n) |
| 505 | 557 | { |
| 506 | - if ($n[0] == '#' && !in_array($n, $columselection)) unset($main[$n]); |
|
| 558 | + if ($n[0] == '#' && !in_array($n, $columselection)) |
|
| 559 | + { |
|
| 560 | + unset($main[$n]); |
|
| 561 | + } |
|
| 507 | 562 | } |
| 508 | 563 | break; |
| 509 | 564 | } |
@@ -520,8 +575,14 @@ discard block |
||
| 520 | 575 | } |
| 521 | 576 | unset($links); |
| 522 | 577 | |
| 523 | - if ($query['cat_id']) $rows['no_cat_id'] = true; |
|
| 524 | - if ($query['no_actions']) $rows['no_actions'] = true; |
|
| 578 | + if ($query['cat_id']) |
|
| 579 | + { |
|
| 580 | + $rows['no_cat_id'] = true; |
|
| 581 | + } |
|
| 582 | + if ($query['no_actions']) |
|
| 583 | + { |
|
| 584 | + $rows['no_actions'] = true; |
|
| 585 | + } |
|
| 525 | 586 | $rows['no_timesheet'] = !isset($GLOBALS['egw_info']['user']['apps']['timesheet']); |
| 526 | 587 | if($clear_status_filter) |
| 527 | 588 | { |
@@ -529,7 +590,10 @@ discard block |
||
| 529 | 590 | } |
| 530 | 591 | |
| 531 | 592 | // switch cf column off, if we have no cf's |
| 532 | - if (!$query['custom_fields']) $rows['no_customfields'] = true; |
|
| 593 | + if (!$query['custom_fields']) |
|
| 594 | + { |
|
| 595 | + $rows['no_customfields'] = true; |
|
| 596 | + } |
|
| 533 | 597 | |
| 534 | 598 | if ($GLOBALS['egw_info']['user']['preferences']['common']['account_selection'] == 'none' && |
| 535 | 599 | !isset($GLOBALS['egw_info']['user']['apps']['admin'])) |
@@ -561,7 +625,11 @@ discard block |
||
| 561 | 625 | } |
| 562 | 626 | } |
| 563 | 627 | |
| 564 | - if (isset($linked)) $query['col_filter']['linked'] = $linked; // add linked back to the colfilter |
|
| 628 | + if (isset($linked)) |
|
| 629 | + { |
|
| 630 | + $query['col_filter']['linked'] = $linked; |
|
| 631 | + } |
|
| 632 | + // add linked back to the colfilter |
|
| 565 | 633 | |
| 566 | 634 | return $query['total']; |
| 567 | 635 | } |
@@ -578,7 +646,10 @@ discard block |
||
| 578 | 646 | $set = array(); |
| 579 | 647 | if ((int)$data['id'] && ($info = $this->bo->read($data['id']))) |
| 580 | 648 | { |
| 581 | - if ($info['info_cat']) $set['cat_id'] = $info['info_cat']; |
|
| 649 | + if ($info['info_cat']) |
|
| 650 | + { |
|
| 651 | + $set['cat_id'] = $info['info_cat']; |
|
| 652 | + } |
|
| 582 | 653 | |
| 583 | 654 | foreach(egw_link::get_links('infolog',$info['info_id'],'','link_lastmod DESC',true) as $link) |
| 584 | 655 | { |
@@ -616,7 +687,10 @@ discard block |
||
| 616 | 687 | 'end' => $infolog['info_enddate'] ? $infolog['info_enddate'] : $infolog['info_datecompleted'] |
| 617 | 688 | )); |
| 618 | 689 | unset($event['entry_id']); |
| 619 | - if (!$event['end']) $event['end'] = $event['start'] + (int) $GLOBALS['egw_info']['user']['preferences']['calendar']['defaultlength']*60; |
|
| 690 | + if (!$event['end']) |
|
| 691 | + { |
|
| 692 | + $event['end'] = $event['start'] + (int) $GLOBALS['egw_info']['user']['preferences']['calendar']['defaultlength']*60; |
|
| 693 | + } |
|
| 620 | 694 | |
| 621 | 695 | // Match categories by name |
| 622 | 696 | $event['category'] = $GLOBALS['egw']->categories->name2id(categories::id2name($infolog['info_cat'])); |
@@ -675,7 +749,10 @@ discard block |
||
| 675 | 749 | // Copy same custom fields |
| 676 | 750 | foreach(array_keys(config::get_customfields('calendar')) as $name) |
| 677 | 751 | { |
| 678 | - if ($this->bo->customfields[$name]) $event['#'.$name] = $infolog['#'.$name]; |
|
| 752 | + if ($this->bo->customfields[$name]) |
|
| 753 | + { |
|
| 754 | + $event['#'.$name] = $infolog['#'.$name]; |
|
| 755 | + } |
|
| 679 | 756 | } |
| 680 | 757 | //error_log(__METHOD__.'('.array2string($data).') infolog='.array2string($infolog).' returning '.array2string($event)); |
| 681 | 758 | return $event; |
@@ -825,13 +902,19 @@ discard block |
||
| 825 | 902 | $values['nm']['sort'] = 'DESC'; |
| 826 | 903 | } |
| 827 | 904 | |
| 828 | - if (!$values['nm']['session_for'] && $this->called_by) $values['nm']['session_for'] = $this->called_by; |
|
| 905 | + if (!$values['nm']['session_for'] && $this->called_by) |
|
| 906 | + { |
|
| 907 | + $values['nm']['session_for'] = $this->called_by; |
|
| 908 | + } |
|
| 829 | 909 | |
| 830 | 910 | $action_id = $values['action_id'] = $action ? $action_id : $nm['action_id']; |
| 831 | 911 | $action_title = $values['action_title'] = $action ? $action_title : $nm['action_title']; |
| 832 | 912 | $action = $values['action'] = $action ? $action : $nm['action']; |
| 833 | 913 | } |
| 834 | - if($_GET['search']) $values['nm']['search'] = $_GET['search']; |
|
| 914 | + if($_GET['search']) |
|
| 915 | + { |
|
| 916 | + $values['nm']['search'] = $_GET['search']; |
|
| 917 | + } |
|
| 835 | 918 | |
| 836 | 919 | if ($values['nm']['add']) |
| 837 | 920 | { |
@@ -882,7 +965,10 @@ discard block |
||
| 882 | 965 | switch ($action) |
| 883 | 966 | { |
| 884 | 967 | case 'sp': |
| 885 | - if (!is_array($action_id) && strpos($action_id, 'infolog:') === 0) $action_id = (int)substr($action_id, 8); |
|
| 968 | + if (!is_array($action_id) && strpos($action_id, 'infolog:') === 0) |
|
| 969 | + { |
|
| 970 | + $action_id = (int)substr($action_id, 8); |
|
| 971 | + } |
|
| 886 | 972 | if ((is_array($action_id) && !$this->bo->read(current($action_id))) || !$this->bo->read($action_id)) |
| 887 | 973 | { |
| 888 | 974 | $action = ''; |
@@ -929,7 +1015,10 @@ discard block |
||
| 929 | 1015 | // Allow add actions even when there's no rows |
| 930 | 1016 | $values['nm']['placeholder_actions'] = array('new'); |
| 931 | 1017 | |
| 932 | - if(!isset($values['nm']['filter2'])) $values['nm']['filter2'] = $this->prefs['nextmatch-'.($action ? 'infolog.'.$action : 'infolog.index.rows').'-details-pref']; |
|
| 1018 | + if(!isset($values['nm']['filter2'])) |
|
| 1019 | + { |
|
| 1020 | + $values['nm']['filter2'] = $this->prefs['nextmatch-'.($action ? 'infolog.'.$action : 'infolog.index.rows').'-details-pref']; |
|
| 1021 | + } |
|
| 933 | 1022 | |
| 934 | 1023 | // disable columns for main entry as set in the pref for details or no details |
| 935 | 1024 | $values['nm']['columnselection_pref'] = 'nextmatch-'.($action ? 'infolog.'.$action : 'infolog.index.rows') |
@@ -955,7 +1044,10 @@ discard block |
||
| 955 | 1044 | { |
| 956 | 1045 | foreach (array_keys($values['nm']['col_filter']) as $colfk) |
| 957 | 1046 | { |
| 958 | - if (is_int($colfk)) unset($values['nm']['col_filter']); |
|
| 1047 | + if (is_int($colfk)) |
|
| 1048 | + { |
|
| 1049 | + unset($values['nm']['col_filter']); |
|
| 1050 | + } |
|
| 959 | 1051 | } |
| 960 | 1052 | } |
| 961 | 1053 | $values['action'] = $persist['action'] = $values['nm']['action'] = $action; |
@@ -998,7 +1090,10 @@ discard block |
||
| 998 | 1090 | // does not take implicit rights as delegated into account, so they will not be available as filters |
| 999 | 1091 | foreach($this->bo->group_owners as $type => $group) |
| 1000 | 1092 | { |
| 1001 | - if (!isset($this->bo->grants[$group])) unset($sel_options['info_type'][$type]); |
|
| 1093 | + if (!isset($this->bo->grants[$group])) |
|
| 1094 | + { |
|
| 1095 | + unset($sel_options['info_type'][$type]); |
|
| 1096 | + } |
|
| 1002 | 1097 | } |
| 1003 | 1098 | |
| 1004 | 1099 | |
@@ -1047,7 +1142,11 @@ discard block |
||
| 1047 | 1142 | unset($types['delete']); |
| 1048 | 1143 | foreach($types as $type => &$data) |
| 1049 | 1144 | { |
| 1050 | - if ($type=='email') continue;//requirement by sales that it should not be shown in right - click - action dialog |
|
| 1145 | + if ($type=='email') |
|
| 1146 | + { |
|
| 1147 | + continue; |
|
| 1148 | + } |
|
| 1149 | + //requirement by sales that it should not be shown in right - click - action dialog |
|
| 1051 | 1150 | $data = array( |
| 1052 | 1151 | 'caption' => $data, |
| 1053 | 1152 | 'icon' => $type, |
@@ -1347,7 +1446,10 @@ discard block |
||
| 1347 | 1446 | return $failed == 0; |
| 1348 | 1447 | |
| 1349 | 1448 | case 'document': |
| 1350 | - if (!$settings) $settings = $this->prefs['default_document']; |
|
| 1449 | + if (!$settings) |
|
| 1450 | + { |
|
| 1451 | + $settings = $this->prefs['default_document']; |
|
| 1452 | + } |
|
| 1351 | 1453 | $document_merge = new infolog_merge(); |
| 1352 | 1454 | $msg = $document_merge->download($settings, $checked, '', $this->prefs['document_dir']); |
| 1353 | 1455 | $failed = count($checked); |
@@ -1533,11 +1635,16 @@ discard block |
||
| 1533 | 1635 | #_debug_array($info); |
| 1534 | 1636 | $status = $info['info_status']; |
| 1535 | 1637 | // closed stati assumed array('done','billed','cancelled') |
| 1536 | - if (isset($this->bo->status[$info['info_type']]['done'])) { |
|
| 1638 | + if (isset($this->bo->status[$info['info_type']]['done'])) |
|
| 1639 | + { |
|
| 1537 | 1640 | $status ='done'; |
| 1538 | - } elseif (isset($this->bo->status[$info['info_type']]['billed'])) { |
|
| 1641 | + } |
|
| 1642 | + elseif (isset($this->bo->status[$info['info_type']]['billed'])) |
|
| 1643 | + { |
|
| 1539 | 1644 | $status ='billed'; |
| 1540 | - } elseif (isset($this->bo->status[$info['info_type']]['cancelled'])) { |
|
| 1645 | + } |
|
| 1646 | + elseif (isset($this->bo->status[$info['info_type']]['cancelled'])) |
|
| 1647 | + { |
|
| 1541 | 1648 | $status ='cancelled'; |
| 1542 | 1649 | } |
| 1543 | 1650 | #_debug_array($status); |
@@ -1551,17 +1658,25 @@ discard block |
||
| 1551 | 1658 | $this->bo->write($values, true,true,true,$skip_notification); |
| 1552 | 1659 | |
| 1553 | 1660 | $query = array('action'=>'sp','action_id'=>$info_id); |
| 1554 | - if (!$closesingle) { |
|
| 1661 | + if (!$closesingle) |
|
| 1662 | + { |
|
| 1555 | 1663 | foreach((array)$this->bo->search($query) as $info) |
| 1556 | 1664 | { |
| 1557 | - if ($info['info_id_parent'] == $info_id) // search also returns linked entries! |
|
| 1665 | + if ($info['info_id_parent'] == $info_id) |
|
| 1666 | + { |
|
| 1667 | + // search also returns linked entries! |
|
| 1558 | 1668 | { |
| 1559 | - $this->close($info['info_id'],$referer,$closesingle,$skip_notification); // we call ourselfs recursive to process subs from subs too |
|
| 1669 | + $this->close($info['info_id'],$referer,$closesingle,$skip_notification); |
|
| 1670 | + } |
|
| 1671 | + // we call ourselfs recursive to process subs from subs too |
|
| 1560 | 1672 | } |
| 1561 | 1673 | } |
| 1562 | 1674 | } |
| 1563 | 1675 | } |
| 1564 | - if ($referer) $this->tmpl->location($referer); |
|
| 1676 | + if ($referer) |
|
| 1677 | + { |
|
| 1678 | + $this->tmpl->location($referer); |
|
| 1679 | + } |
|
| 1565 | 1680 | } |
| 1566 | 1681 | |
| 1567 | 1682 | /** |
@@ -1577,10 +1692,13 @@ discard block |
||
| 1577 | 1692 | $info_id = (int) (is_array($values) ? $values['info_id'] : ($values ? $values : $_GET['info_id'])); |
| 1578 | 1693 | $referer = is_array($values) ? $values['referer'] : $_referer; |
| 1579 | 1694 | |
| 1580 | - if (!is_array($values) && $info_id > 0 && !$this->bo->anzSubs($info_id)) // entries without subs get confirmed by javascript |
|
| 1695 | + if (!is_array($values) && $info_id > 0 && !$this->bo->anzSubs($info_id)) |
|
| 1696 | + { |
|
| 1697 | + // entries without subs get confirmed by javascript |
|
| 1581 | 1698 | { |
| 1582 | 1699 | $values = array('delete' => true); |
| 1583 | 1700 | } |
| 1701 | + } |
|
| 1584 | 1702 | //echo "<p>infolog_ui::delete(".print_r($values,true).",'$referer','$called_by') info_id=$info_id</p>\n"; |
| 1585 | 1703 | |
| 1586 | 1704 | if (is_array($values) || $info_id <= 0) |
@@ -1589,11 +1707,16 @@ discard block |
||
| 1589 | 1707 | { |
| 1590 | 1708 | $deleted = $this->bo->delete($info_id,$values['delete_subs'],$values['info_id_parent'], $skip_notification); |
| 1591 | 1709 | } |
| 1592 | - if ($called_by) // direct call from the same request |
|
| 1710 | + if ($called_by) |
|
| 1711 | + { |
|
| 1712 | + // direct call from the same request |
|
| 1593 | 1713 | { |
| 1594 | 1714 | return $deleted ? lang('InfoLog entry deleted') : ''; |
| 1595 | 1715 | } |
| 1596 | - if ($values['called_by'] == 'edit') // we run in the edit popup => give control back to edit |
|
| 1716 | + } |
|
| 1717 | + if ($values['called_by'] == 'edit') |
|
| 1718 | + { |
|
| 1719 | + // we run in the edit popup => give control back to edit |
|
| 1597 | 1720 | { |
| 1598 | 1721 | $this->edit(array( |
| 1599 | 1722 | 'info_id' => $info_id, |
@@ -1602,6 +1725,7 @@ discard block |
||
| 1602 | 1725 | 'msg' => $deleted ? lang('Infolog entry deleted') : '', |
| 1603 | 1726 | )); |
| 1604 | 1727 | } |
| 1728 | + } |
|
| 1605 | 1729 | return $referer ? $this->tmpl->location($referer) : $this->index(); |
| 1606 | 1730 | } |
| 1607 | 1731 | $readonlys = $values = array(); |
@@ -1650,10 +1774,17 @@ discard block |
||
| 1650 | 1774 | $no_popup = $content['no_popup']; unset($content['no_popup']); |
| 1651 | 1775 | |
| 1652 | 1776 | list($button) = @each($content['button']); |
| 1653 | - if (!$button && $action) $button = $action; // action selectbox |
|
| 1777 | + if (!$button && $action) |
|
| 1778 | + { |
|
| 1779 | + $button = $action; |
|
| 1780 | + } |
|
| 1781 | + // action selectbox |
|
| 1654 | 1782 | //info_cc expects an comma separated string |
| 1655 | 1783 | //error_log(__METHOD__.__LINE__.array2string($content)); |
| 1656 | - if (empty($content['info_cc'])) $content['info_cc'] = ""; |
|
| 1784 | + if (empty($content['info_cc'])) |
|
| 1785 | + { |
|
| 1786 | + $content['info_cc'] = ""; |
|
| 1787 | + } |
|
| 1657 | 1788 | if (is_array($content['info_cc'])) |
| 1658 | 1789 | { |
| 1659 | 1790 | foreach($content['info_cc'] as $i => $value) |
@@ -1663,7 +1794,10 @@ discard block |
||
| 1663 | 1794 | //error_log(__METHOD__.__LINE__.$value.'->'.array2string($addresses[0])); |
| 1664 | 1795 | $content['info_cc'][$i]=$addresses[0]->host ? $addresses[0]->mailbox.'@'.$addresses[0]->host : $addresses[0]->mailbox; |
| 1665 | 1796 | } |
| 1666 | - if (!empty($content['info_cc'])) $content['info_cc'] = implode(',',$content['info_cc']); |
|
| 1797 | + if (!empty($content['info_cc'])) |
|
| 1798 | + { |
|
| 1799 | + $content['info_cc'] = implode(',',$content['info_cc']); |
|
| 1800 | + } |
|
| 1667 | 1801 | } |
| 1668 | 1802 | unset($content['button']); |
| 1669 | 1803 | if ($button) |
@@ -1802,9 +1936,12 @@ discard block |
||
| 1802 | 1936 | egw_link::link('infolog',$info_id,$content['link_to']['to_id']); |
| 1803 | 1937 | $content['link_to']['to_id'] = $info_id; |
| 1804 | 1938 | } |
| 1805 | - if ($info_link_id && strpos($info_link_id,':') !== false) // updating info_link_id if necessary |
|
| 1939 | + if ($info_link_id && strpos($info_link_id,':') !== false) |
|
| 1940 | + { |
|
| 1941 | + // updating info_link_id if necessary |
|
| 1806 | 1942 | { |
| 1807 | 1943 | list($app,$id) = explode(':',$info_link_id); |
| 1944 | + } |
|
| 1808 | 1945 | $link = egw_link::get_link('infolog',$info_id,$app,$id); |
| 1809 | 1946 | if ((int) $content['info_link_id'] != (int) $link['link_id']) |
| 1810 | 1947 | { |
@@ -1826,12 +1963,19 @@ discard block |
||
| 1826 | 1963 | } |
| 1827 | 1964 | elseif ($button == 'delete' && $info_id > 0) |
| 1828 | 1965 | { |
| 1829 | - if (!$referer && $action) $referer = array( |
|
| 1966 | + if (!$referer && $action) |
|
| 1967 | + { |
|
| 1968 | + $referer = array( |
|
| 1830 | 1969 | 'menuaction' => 'infolog.infolog_ui.index', |
| 1831 | 1970 | 'action' => $action, |
| 1832 | 1971 | 'action_id' => $action_id |
| 1833 | 1972 | ); |
| 1834 | - if (!($content['msg'] = $this->delete($info_id,$referer,'edit'))) return; // checks ACL first |
|
| 1973 | + } |
|
| 1974 | + if (!($content['msg'] = $this->delete($info_id,$referer,'edit'))) |
|
| 1975 | + { |
|
| 1976 | + return; |
|
| 1977 | + } |
|
| 1978 | + // checks ACL first |
|
| 1835 | 1979 | |
| 1836 | 1980 | egw_framework::refresh_opener($content['msg'],'infolog',$info_id,'delete'); |
| 1837 | 1981 | } |
@@ -1881,7 +2025,11 @@ discard block |
||
| 1881 | 2025 | $type = $type ? $type : get_var('type', array('POST','GET')); |
| 1882 | 2026 | $referer = $referer !== '' ? $referer : ($_GET['referer'] ? $_GET['referer'] : |
| 1883 | 2027 | common::get_referer('/index.php?menuaction=infolog.infolog_ui.index')); |
| 1884 | - if (strpos($referer, 'msg=') !== false) $referer = preg_replace('/([&?]{1})msg=[^&]+&?/','\\1',$referer); // remove previou/old msg from referer |
|
| 2028 | + if (strpos($referer, 'msg=') !== false) |
|
| 2029 | + { |
|
| 2030 | + $referer = preg_replace('/([&?]{1})msg=[^&]+&?/','\\1',$referer); |
|
| 2031 | + } |
|
| 2032 | + // remove previou/old msg from referer |
|
| 1885 | 2033 | $no_popup = $_GET['no_popup']; |
| 1886 | 2034 | $print = (int) $_REQUEST['print']; |
| 1887 | 2035 | //echo "<p>infolog_ui::edit: info_id=$info_id, action='$action', action_id='$action_id', type='$type', referer='$referer'</p>\n"; |
@@ -1890,7 +2038,10 @@ discard block |
||
| 1890 | 2038 | { |
| 1891 | 2039 | egw_framework::window_close(lang('Permission denied!')); |
| 1892 | 2040 | } |
| 1893 | - if (!(strpos($content['info_addr'],',')===false) && strpos($content['info_addr'],', ')===false) $content['info_addr'] = str_replace(',',', ',$content['info_addr']); |
|
| 2041 | + if (!(strpos($content['info_addr'],',')===false) && strpos($content['info_addr'],', ')===false) |
|
| 2042 | + { |
|
| 2043 | + $content['info_addr'] = str_replace(',',', ',$content['info_addr']); |
|
| 2044 | + } |
|
| 1894 | 2045 | foreach(array('info_subject', 'info_des') as $key) |
| 1895 | 2046 | { |
| 1896 | 2047 | if(!isset($content[$key]) || strlen($content[$key]) < 75) |
@@ -1914,10 +2065,16 @@ discard block |
||
| 1914 | 2065 | if (strlen($word)>75) |
| 1915 | 2066 | { |
| 1916 | 2067 | $buff = html::activate_links($word); |
| 1917 | - if (strlen($buff) == strlen($word)) // no links -> try to break overlong words |
|
| 2068 | + if (strlen($buff) == strlen($word)) |
|
| 2069 | + { |
|
| 2070 | + // no links -> try to break overlong words |
|
| 1918 | 2071 | { |
| 1919 | 2072 | if (!(strpos($word,',')===false) && strpos($word,', ')===false) $word = str_replace(',',', ',$word); |
| 1920 | - if (!(strpos($word,'.')===false) && strpos($word,'. ')===false) $word = str_replace('.','. ',$word); |
|
| 2073 | + } |
|
| 2074 | + if (!(strpos($word,'.')===false) && strpos($word,'. ')===false) |
|
| 2075 | + { |
|
| 2076 | + $word = str_replace('.','. ',$word); |
|
| 2077 | + } |
|
| 1921 | 2078 | $word = wordwrap($word, 75, ' ', true); |
| 1922 | 2079 | } |
| 1923 | 2080 | } |
@@ -1938,7 +2095,11 @@ discard block |
||
| 1938 | 2095 | { |
| 1939 | 2096 | $content['info_cat'] = $this->prefs['cat_add_default']; |
| 1940 | 2097 | } |
| 1941 | - if ($_GET['msg']) $content['msg'] = strip_tags($_GET['msg']); // dont allow HTML! |
|
| 2098 | + if ($_GET['msg']) |
|
| 2099 | + { |
|
| 2100 | + $content['msg'] = strip_tags($_GET['msg']); |
|
| 2101 | + } |
|
| 2102 | + // dont allow HTML! |
|
| 1942 | 2103 | |
| 1943 | 2104 | switch($this->prefs['set_start']) |
| 1944 | 2105 | { |
@@ -1949,13 +2110,19 @@ discard block |
||
| 1949 | 2110 | if ((int)$content['info_link_id'] > 0 && !egw_link::get_link($content['info_link_id'])) |
| 1950 | 2111 | { |
| 1951 | 2112 | $content['info_link_id'] = 0; // link has been deleted |
| 1952 | - if (!$content['info_custom_link']) $content['info_from'] = ''; |
|
| 2113 | + if (!$content['info_custom_link']) |
|
| 2114 | + { |
|
| 2115 | + $content['info_from'] = ''; |
|
| 2116 | + } |
|
| 1953 | 2117 | } |
| 1954 | - if (!$info_id && $action_id && $action == 'sp') // new SubProject |
|
| 2118 | + if (!$info_id && $action_id && $action == 'sp') |
|
| 2119 | + { |
|
| 2120 | + // new SubProject |
|
| 1955 | 2121 | { |
| 1956 | 2122 | if (!$this->bo->check_access($action_id,EGW_ACL_ADD)) |
| 1957 | 2123 | { |
| 1958 | 2124 | return $referer ? $this->tmpl->location($referer) : $this->index(0,$action,$action_id); |
| 2125 | + } |
|
| 1959 | 2126 | } |
| 1960 | 2127 | } |
| 1961 | 2128 | else |
@@ -1989,10 +2156,16 @@ discard block |
||
| 1989 | 2156 | case 'copy': |
| 1990 | 2157 | $info_id = 0; |
| 1991 | 2158 | $this->create_copy($content, $action == 'sp'); |
| 1992 | - if ($action == 'sp') // for sub-entries use type or category, like for new entries |
|
| 2159 | + if ($action == 'sp') |
|
| 2160 | + { |
|
| 2161 | + // for sub-entries use type or category, like for new entries |
|
| 1993 | 2162 | { |
| 1994 | 2163 | if ($type) $content['info_type'] = $type; |
| 1995 | - if (is_numeric($_REQUEST['cat_id'])) $content['info_cat'] = (int) $_REQUEST['cat_id']; |
|
| 2164 | + } |
|
| 2165 | + if (is_numeric($_REQUEST['cat_id'])) |
|
| 2166 | + { |
|
| 2167 | + $content['info_cat'] = (int) $_REQUEST['cat_id']; |
|
| 2168 | + } |
|
| 1996 | 2169 | } |
| 1997 | 2170 | unset($action); // it get stored in $content and will cause an other copy after [apply] |
| 1998 | 2171 | break; |
@@ -2021,7 +2194,10 @@ discard block |
||
| 2021 | 2194 | { |
| 2022 | 2195 | foreach((array)$set['link_app'] as $i => $l_app) |
| 2023 | 2196 | { |
| 2024 | - if (($l_id=$set['link_id'][$i])) egw_link::link('infolog',$content['link_to']['to_id'],$l_app,$l_id); |
|
| 2197 | + if (($l_id=$set['link_id'][$i])) |
|
| 2198 | + { |
|
| 2199 | + egw_link::link('infolog',$content['link_to']['to_id'],$l_app,$l_id); |
|
| 2200 | + } |
|
| 2025 | 2201 | } |
| 2026 | 2202 | unset($set['link_app']); |
| 2027 | 2203 | unset($set['link_id']); |
@@ -2040,8 +2216,15 @@ discard block |
||
| 2040 | 2216 | break; // normal edit |
| 2041 | 2217 | } |
| 2042 | 2218 | case 'new': // new entry, set some defaults, if not set by infolog_set hook |
| 2043 | - if (empty($content['info_startdate'])) $content['info_startdate'] = (int) $_GET['startdate'] ? (int) $_GET['startdate'] : $set_startdate; |
|
| 2044 | - if (empty($content['info_priority'])) $content['info_priority'] = 1; // normal |
|
| 2219 | + if (empty($content['info_startdate'])) |
|
| 2220 | + { |
|
| 2221 | + $content['info_startdate'] = (int) $_GET['startdate'] ? (int) $_GET['startdate'] : $set_startdate; |
|
| 2222 | + } |
|
| 2223 | + if (empty($content['info_priority'])) |
|
| 2224 | + { |
|
| 2225 | + $content['info_priority'] = 1; |
|
| 2226 | + } |
|
| 2227 | + // normal |
|
| 2045 | 2228 | $content['info_owner'] = $this->user; |
| 2046 | 2229 | if ($type != '' && empty($content['info_type'])) |
| 2047 | 2230 | { |
@@ -2051,8 +2234,14 @@ discard block |
||
| 2051 | 2234 | { |
| 2052 | 2235 | $content['info_type'] = $GLOBALS['egw_info']['user']['preferences']['infolog']['preferred_type']; |
| 2053 | 2236 | } |
| 2054 | - if (empty($content['info_status'])) $content['info_status'] = $this->bo->status['defaults'][$content['info_type']]; |
|
| 2055 | - if (empty($content['info_percent'])) $content['info_percent'] = $content['info_status'] == 'done' ? '100%' : '0%'; |
|
| 2237 | + if (empty($content['info_status'])) |
|
| 2238 | + { |
|
| 2239 | + $content['info_status'] = $this->bo->status['defaults'][$content['info_type']]; |
|
| 2240 | + } |
|
| 2241 | + if (empty($content['info_percent'])) |
|
| 2242 | + { |
|
| 2243 | + $content['info_percent'] = $content['info_status'] == 'done' ? '100%' : '0%'; |
|
| 2244 | + } |
|
| 2056 | 2245 | break; |
| 2057 | 2246 | } |
| 2058 | 2247 | if (!isset($this->bo->enums['type'][$content['info_type']])) |
@@ -2155,12 +2344,18 @@ discard block |
||
| 2155 | 2344 | |
| 2156 | 2345 | $content['duration_format'] = $this->duration_format; |
| 2157 | 2346 | $content['hours_per_workday'] = $this->hours_per_workday; |
| 2158 | - if ($this->prefs['show_id']) $content['info_number'] = $info_id; |
|
| 2347 | + if ($this->prefs['show_id']) |
|
| 2348 | + { |
|
| 2349 | + $content['info_number'] = $info_id; |
|
| 2350 | + } |
|
| 2159 | 2351 | |
| 2160 | 2352 | $content['info_anz_subs'] = (int)$content['info_anz_subs']; // gives javascript error if empty! |
| 2161 | 2353 | |
| 2162 | 2354 | $old_pm_id = is_array($pm_links) ? array_shift($pm_links) : $content['old_pm_id']; |
| 2163 | - if (!isset($content['pm_id']) && $old_pm_id) $content['pm_id'] = $old_pm_id; |
|
| 2355 | + if (!isset($content['pm_id']) && $old_pm_id) |
|
| 2356 | + { |
|
| 2357 | + $content['pm_id'] = $old_pm_id; |
|
| 2358 | + } |
|
| 2164 | 2359 | |
| 2165 | 2360 | if ($info_id && $this->bo->history) |
| 2166 | 2361 | { |
@@ -2230,7 +2425,10 @@ discard block |
||
| 2230 | 2425 | //$content['info_des'] = substr($content['info_des'],0,1793); |
| 2231 | 2426 | //echo "<p>infolog_ui.edit(info_id='$info_id',action='$action',action_id='$action_id') readonlys="; print_r($readonlys); echo ", content = "; _debug_array($content); |
| 2232 | 2427 | //$content['info_cc'] is expected (by the widget) to be an array of emailaddresses, but is stored as comma separated string |
| 2233 | - if (!empty($content['info_cc'])&&!is_array($content['info_cc']))$content['info_cc'] = explode(',',$content['info_cc']); |
|
| 2428 | + if (!empty($content['info_cc'])&&!is_array($content['info_cc'])) |
|
| 2429 | + { |
|
| 2430 | + $content['info_cc'] = explode(',',$content['info_cc']); |
|
| 2431 | + } |
|
| 2234 | 2432 | $this->tmpl->exec('infolog.infolog_ui.edit',$content,$sel_options,$readonlys,$preserv+array( // preserved values |
| 2235 | 2433 | 'info_id' => $info_id, |
| 2236 | 2434 | 'action' => $action, |
@@ -2258,7 +2456,11 @@ discard block |
||
| 2258 | 2456 | foreach ($exclude_fields as $field) |
| 2259 | 2457 | { |
| 2260 | 2458 | unset($content[$field]); |
| 2261 | - if ($field == 'info_from') unset($content['info_link_id']); // both together is called contact in UI |
|
| 2459 | + if ($field == 'info_from') |
|
| 2460 | + { |
|
| 2461 | + unset($content['info_link_id']); |
|
| 2462 | + } |
|
| 2463 | + // both together is called contact in UI |
|
| 2262 | 2464 | } |
| 2263 | 2465 | if ($create_sub) |
| 2264 | 2466 | { |
@@ -2286,13 +2488,25 @@ discard block |
||
| 2286 | 2488 | $content['info_type'] = $types[0]; |
| 2287 | 2489 | } |
| 2288 | 2490 | // get a consistent status, percent and date-completed |
| 2289 | - if (!isset($content['info_status'])) $content['info_status'] = $this->bo->status['defaults'][$content['info_type']]; |
|
| 2290 | - if (!isset($content['info_percent'])) $content['info_percent'] = $content['info_status'] == 'done' ? '100%' : '0%'; |
|
| 2491 | + if (!isset($content['info_status'])) |
|
| 2492 | + { |
|
| 2493 | + $content['info_status'] = $this->bo->status['defaults'][$content['info_type']]; |
|
| 2494 | + } |
|
| 2495 | + if (!isset($content['info_percent'])) |
|
| 2496 | + { |
|
| 2497 | + $content['info_percent'] = $content['info_status'] == 'done' ? '100%' : '0%'; |
|
| 2498 | + } |
|
| 2291 | 2499 | $content['info_datecompleted'] =$content['info_status'] == 'done' ? $this->bo->user_time_now : 0; |
| 2292 | 2500 | |
| 2293 | - if (!isset($content['info_cat'])) $content['info_cat'] = $this->prefs['cat_add_default']; |
|
| 2501 | + if (!isset($content['info_cat'])) |
|
| 2502 | + { |
|
| 2503 | + $content['info_cat'] = $this->prefs['cat_add_default']; |
|
| 2504 | + } |
|
| 2294 | 2505 | |
| 2295 | - if(!is_array($content['link_to'])) $content['link_to'] = array(); |
|
| 2506 | + if(!is_array($content['link_to'])) |
|
| 2507 | + { |
|
| 2508 | + $content['link_to'] = array(); |
|
| 2509 | + } |
|
| 2296 | 2510 | $content['link_to']['to_app'] = 'infolog'; |
| 2297 | 2511 | $content['link_to']['to_id'] = 0; |
| 2298 | 2512 | // Get links to be copied, if not excluded |
@@ -2323,7 +2537,10 @@ discard block |
||
| 2323 | 2537 | { |
| 2324 | 2538 | $linkinfos = egw_link::get_link($info_link_id); |
| 2325 | 2539 | $content['info_contact'] = $linkinfos['link_app1']=='infolog'? $linkinfos['link_app2'].':'.$linkinfos['link_id2']:$linkinfos['link_app1'].':'.$linkinfos['link_id1']; |
| 2326 | - if (stripos($content['info_contact'],'projectmanager')!==false) $content['pm_id'] = $linkinfos['link_app1']=='projectmanager'? $linkinfos['link_id1']:$linkinfos['link_id2']; |
|
| 2540 | + if (stripos($content['info_contact'],'projectmanager')!==false) |
|
| 2541 | + { |
|
| 2542 | + $content['pm_id'] = $linkinfos['link_app1']=='projectmanager'? $linkinfos['link_id1']:$linkinfos['link_id2']; |
|
| 2543 | + } |
|
| 2327 | 2544 | } |
| 2328 | 2545 | unset($content['info_link_id']); |
| 2329 | 2546 | } |
@@ -2651,7 +2868,10 @@ discard block |
||
| 2651 | 2868 | } |
| 2652 | 2869 | foreach($this->bo->customfields as $name => $data) |
| 2653 | 2870 | { |
| 2654 | - if ($data['type2'] && $type && !in_array($type,explode(',',$data['type2']))) continue; |
|
| 2871 | + if ($data['type2'] && $type && !in_array($type,explode(',',$data['type2']))) |
|
| 2872 | + { |
|
| 2873 | + continue; |
|
| 2874 | + } |
|
| 2655 | 2875 | |
| 2656 | 2876 | $fields['#'.$name] = array( |
| 2657 | 2877 | 'label' => $data['label'], |