diff --git a/doc/lms.mysql b/doc/lms.mysql index 118ed729c6..1a3ae3dbf7 100644 --- a/doc/lms.mysql +++ b/doc/lms.mysql @@ -2509,6 +2509,7 @@ INSERT INTO uiconfig (section, var, value, description, disabled) VALUES ('phpui', 'default_teryt_city', 'false', '', 0), ('phpui', 'passwordhistory', 6, '', 0), ('phpui', 'event_usergroup_selection_type', 'update', '', 0), +('phpui', 'show_old_events', '1', '', 0), ('payments', 'date_format', '%Y/%m/%d', '', 0), ('payments', 'default_unit_name', 'pcs.', '', 0), ('voip', 'default_cost_limit', '200','', 2), diff --git a/doc/lms.pgsql b/doc/lms.pgsql index 8053b2b787..50dd7a8915 100644 --- a/doc/lms.pgsql +++ b/doc/lms.pgsql @@ -2573,6 +2573,7 @@ INSERT INTO uiconfig (section, var, value, description, disabled) VALUES ('phpui', 'default_teryt_city', 'false', '', 0), ('phpui', 'passwordhistory', 6, '', 0), ('phpui', 'event_usergroup_selection_type', 'update', '', 0), +('phpui', 'show_old_events', '1', '', 0), ('payments', 'date_format', '%Y/%m/%d', '', 0), ('payments', 'default_unit_name', 'pcs.', '', 0), ('voip', 'default_cost_limit', '200', '', 2), diff --git a/lib/locale/pl/strings.php b/lib/locale/pl/strings.php index 74267d0fbd..cb485e15c2 100644 --- a/lib/locale/pl/strings.php +++ b/lib/locale/pl/strings.php @@ -3632,6 +3632,7 @@ $_LANG['vacation'] = 'urlop'; $_LANG['duty'] = 'dyżur'; +$_LANG['Show outdated events in events tab. Default true'] = 'Pokaż przeterminowane wydarzenia w karcie terminarza. Domyślnie włączone.'; $_LANG['If set to "true" then logout confirmation is required. Default "false"'] = 'Ustawienie opcji na "true" wymusza potwierdzenie wylogowania. Domyślnie wyłączone'; diff --git a/modules/configlist.php b/modules/configlist.php index aa9d237d87..ef99808b9d 100644 --- a/modules/configlist.php +++ b/modules/configlist.php @@ -299,12 +299,14 @@ function GetConfigList() { $config[$idx]['description'] = trans('Default ping type. You can use "1" for ping or "2" for arping. Default: 1.'); break; - case 'default_teryt_city': + case 'default_teryt_city': $config[$idx]['description'] = trans('Default City in TERYT. Set city id in TERYT.'); break; case 'logout_confirmation': $config[$idx]['description'] = trans('If set to "true" then logout confirmation is required. Default "false"'); + case 'show_old_events': + $config[$idx]['description'] = trans('Show outdated events in events tab. Default true'); break; default: diff --git a/modules/eventlist.php b/modules/eventlist.php index 0afed58243..bfb8d6e3ed 100644 --- a/modules/eventlist.php +++ b/modules/eventlist.php @@ -24,7 +24,7 @@ * $Id$ */ -function GetEventList($year=NULL, $month=NULL, $day=NULL, $forward=0, $customerid=0, $userid=0, $type = 0, $privacy = 0, $closed = '') { +function GetEventList($year=NULL, $month=NULL, $day=NULL, $forward=0, $customerid=0, $userid=0, $type = 0, $privacy = 0, $closed = '', $outDate = 0) { global $AUTH; $DB = LMSDB::getInstance(); @@ -50,7 +50,8 @@ function GetEventList($year=NULL, $month=NULL, $day=NULL, $forward=0, $customeri } $startdate = mktime(0,0,0, $month, $day, $year); - $enddate = mktime(0,0,0, $month, $day+$forward, $year); + !$outDate ? $enddate = mktime(0,0,0, $month, $day+$forward, $year) : ''; + $outDate ? $closed = '0' : $closed = $closed; $list = $DB->GetAll( 'SELECT events.id AS id, title, note, description, date, begintime, enddate, endtime, customerid, closed, events.type, ' @@ -60,8 +61,9 @@ function GetEventList($year=NULL, $month=NULL, $day=NULL, $forward=0, $customeri FROM events LEFT JOIN vnodes as vn ON (nodeid = vn.id) LEFT JOIN customerview c ON (customerid = c.id) - LEFT JOIN vusers ON (userid = vusers.id) - WHERE ((date >= ? AND date < ?) OR (enddate <> 0 AND date < ? AND enddate >= ?)) AND ' . $privacy_condition + LEFT JOIN vusers ON (userid = vusers.id)' + .($outDate ? 'WHERE date < ? AND ' : 'WHERE ((date >= ? AND date < ?) OR (enddate <> 0 AND date < ? AND enddate >= ?)) AND ') + . $privacy_condition .($customerid ? ' AND customerid = '.intval($customerid) : '') .($userid ? ' AND EXISTS ( SELECT 1 FROM eventassignments @@ -180,6 +182,9 @@ function GetEventList($year=NULL, $month=NULL, $day=NULL, $forward=0, $customeri $layout['pagetitle'] = trans('Timetable'); $eventlist = GetEventList($year, $month, $day, ConfigHelper::getConfig('phpui.timetable_days_forward'), $u, $a, $type, $privacy, $closed); +//show Outdated events at begining of events list +ConfigHelper::getConfig('phpui.show_old_events') ? $OldEventlist = $OldEventlist = GetEventList($year, $month, $day, 0, $u, $a, $type, $privacy, 1, 1) : $OldEventlist = array(); + $SESSION->restore('elu', $listdata['customerid']); $SESSION->restore('ela', $listdata['userid']); $SESSION->restore('elt', $listdata['type']); @@ -209,6 +214,7 @@ function GetEventList($year=NULL, $month=NULL, $day=NULL, $forward=0, $customeri $SMARTY->assign('period', $DB->GetRow('SELECT MIN(date) AS fromdate, MAX(date) AS todate FROM events')); $SMARTY->assign('eventlist',$eventlist); +$SMARTY->assign('oldEventlist',$OldEventlist); $SMARTY->assign('listdata',$listdata); $SMARTY->assign('days',$days); $SMARTY->assign('day',$day); diff --git a/templates/default/event/eventlist.html b/templates/default/event/eventlist.html index ff408837ac..0de3330e23 100644 --- a/templates/default/event/eventlist.html +++ b/templates/default/event/eventlist.html @@ -93,6 +93,52 @@

{$layout.pagetitle}

{cycle values="light,lucid" print=false} + {section name=oldEventlist loop=$oldEventlist} + + + {$_EVENTTYPES[$oldEventlist[oldEventlist].type]} + + + {$oldEventlist[oldEventlist].date|date_format:"%Y-%m-%d"}
+ {foreach $oldEventlist[oldEventlist].userlist as $user} + {$user.name|truncate:"25":"...":true}
+ {/foreach} + + + {$oldEventlist[oldEventlist].title}
+ {if $oldEventlist[oldEventlist].description != ''} {$oldEventlist[oldEventlist].description}{/if}
+ {if $oldEventlist[oldEventlist].note != ''} {$oldEventlist[oldEventlist].note}{/if} + + + {if $oldEventlist[oldEventlist].customername} + {$oldEventlist[oldEventlist].customername|truncate:"30":"...":true}
+ {if isset($oldEventlist[oldEventlist].location)} + {$oldEventlist[oldEventlist].location} + {else} + {$oldEventlist[oldEventlist].customerlocation} + {/if} + {/if} + + +
+ {if ConfigHelper::checkPrivilege('timetable_management')} + {if $oldEventlist[oldEventlist].closed} + [ {trans( + {else} + [ {trans( + {/if} + [ {trans(  + [ {trans( + {/if} + {if $oldEventlist[oldEventlist].note == ''} + {foreach item=user from=$oldEventlist[oldEventlist].userlist} + {if $layout.logid == $user.id}[ {trans({/if} + {/foreach} + {/if} +
+ + + {/section} {section name=daylist loop=$daylist}