@@ -138,7 +138,7 @@ public function GetQueueContents(array $params)
138138 {
139139 $ userid = Auth::GetCurrentUser ();
140140 extract ($ params );
141- foreach (array ('ids ' , 'state ' , 'priority ' , 'source ' , 'owner ' , 'catids ' , 'removed ' , 'netdevids ' , 'netnodeids ' , 'deadline ' ,
141+ foreach (array ('ids ' , 'state ' , 'priority ' , 'periodicity ' , ' source ' , 'owner ' , 'catids ' , 'removed ' , 'netdevids ' , 'netnodeids ' , 'deadline ' ,
142142 'serviceids ' , 'typeids ' , 'unread ' , 'parentids ' , 'verifierids ' , 'rights ' , 'projectids ' , 'cid ' , 'subject ' , 'fromdate ' , 'todate ' , 'short ' , 'watching ' ) as $ var ) {
143143 if (!isset ($ {$ var })) {
144144 $ {$ var } = null ;
@@ -185,6 +185,9 @@ public function GetQueueContents(array $params)
185185 case 'priority ' :
186186 $ sqlord = ' ORDER BY t.priority ' ;
187187 break ;
188+ case 'periodicity ' :
189+ $ sqlord = ' ORDER BY t.periodicity ' ;
190+ break ;
188191 case 'deadline ' :
189192 $ sqlord = ' ORDER BY t.deadline ' ;
190193 break ;
@@ -223,6 +226,16 @@ public function GetQueueContents(array $params)
223226 $ priorityfilter = ' AND t.priority = ' .$ priority ;
224227 }
225228
229+ if (empty ($ periodicity )) {
230+ $ periodicityfilter = '' ;
231+ } elseif (is_array ($ periodicity )) {
232+ $ periodicityfilter = ' AND t.periodicity IN ( ' . implode (', ' , $ periodicity ) . ') ' ;
233+ } elseif ($ periodicity == -1 ) {
234+ $ periodicityfilter = ' AND t.periodicity IS NOT NULL ' ;
235+ } else {
236+ $ periodicityfilter = ' AND t.periodicity = ' . $ periodicity ;
237+ }
238+
226239 if (empty ($ source ) || intval ($ source ) == -1 ) {
227240 $ sourcefilter = '' ;
228241 } else {
@@ -485,6 +498,7 @@ public function GetQueueContents(array $params)
485498 . $ parentfilter
486499 . $ statefilter
487500 . $ priorityfilter
501+ . $ periodicityfilter
488502 . $ sourcefilter
489503 . $ ownerfilter
490504 . $ removedfilter
@@ -504,7 +518,7 @@ public function GetQueueContents(array $params)
504518
505519 if ($ result = $ this ->db ->GetAll (
506520 'SELECT DISTINCT t.id, t.customerid, t.address_id, va.name AS vaname, va.city AS vacity, va.street, va.house, va.flat, c.address, c.city, vusers.name AS ownername,
507- t.subject, t.state, owner AS ownerid, t.requestor AS req, t.source, t.priority, rtqueues.name, '
521+ t.subject, t.state, owner AS ownerid, t.requestor AS req, t.source, t.priority, t.periodicity, rtqueues.name, '
508522 . $ this ->db ->Concat ('c.lastname ' , "' ' " , 'c.name ' ) . ' AS customername,
509523 t.requestor_phone, t.requestor_mail, t.deadline, t.requestor_userid, rq.name AS requestor_name,
510524 t.createtime AS createtime, u.name AS creatorname, t.deleted, t.deltime, t.deluserid,
@@ -594,6 +608,7 @@ public function GetQueueContents(array $params)
594608 . $ parentfilter
595609 . $ statefilter
596610 . $ priorityfilter
611+ . $ periodicityfilter
597612 . $ sourcefilter
598613 . $ ownerfilter
599614 . $ removedfilter
@@ -651,6 +666,7 @@ public function GetQueueContents(array $params)
651666 $ result ['owner ' ] = $ owner ;
652667 $ result ['removed ' ] = $ removed ;
653668 $ result ['priority ' ] = $ priority ;
669+ $ result ['periodicity ' ] = $ periodicity ;
654670 $ result ['source ' ] = $ source ;
655671 $ result ['deadline ' ] = $ deadline ;
656672 $ result ['service ' ] = $ serviceids ;
@@ -1150,9 +1166,9 @@ public function TicketAdd($ticket, $files = null)
11501166
11511167 $ this ->db ->Execute (
11521168 'INSERT INTO rttickets (queueid, customerid, requestor, requestor_mail, requestor_phone,
1153- requestor_userid, subject, state, owner, createtime, modtime, cause, creatorid, source, priority, address_id, nodeid,
1169+ requestor_userid, subject, state, owner, createtime, modtime, cause, creatorid, source, priority, periodicity, address_id, nodeid,
11541170 netnodeid, netdevid, verifierid, deadline, service, type, invprojectid, parentid, customcreatetime, customresolvetime)
1155- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ' ,
1171+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ) ' ,
11561172 array (
11571173 $ ticket ['queue ' ],
11581174 empty ($ ticket ['customerid ' ]) ? null : $ ticket ['customerid ' ],
@@ -1169,6 +1185,7 @@ public function TicketAdd($ticket, $files = null)
11691185 $ ticket ['userid ' ] ?? Auth::GetCurrentUser (),
11701186 $ ticket ['source ' ] ?? 0 ,
11711187 isset ($ ticket ['priority ' ]) && strlen ($ ticket ['priority ' ]) ? $ ticket ['priority ' ] : null ,
1188+ empty ($ ticket ['periodicity ' ]) ? null : $ ticket ['periodicity ' ],
11721189 !empty ($ ticket ['address_id ' ]) ? $ ticket ['address_id ' ] : null ,
11731190 !empty ($ ticket ['nodeid ' ]) ? $ ticket ['nodeid ' ] : null ,
11741191 !empty ($ ticket ['netnodeid ' ]) ? $ ticket ['netnodeid ' ] : null ,
@@ -1296,7 +1313,7 @@ public function GetTicketContents($id, $short = false)
12961313
12971314 $ ticket = $ this ->db ->GetRow ('SELECT t.id AS ticketid, t.queueid, rtqueues.name AS queuename, t.requestor, t.requestor_phone, t.requestor_mail,
12981315 t.requestor_userid, d.name AS requestor_username, t.state, t.owner, t.customerid, t.cause, t.creatorid, c.name AS creator,
1299- t.source, t.priority, i.id AS invprojectid, i.name AS invproject_name, t.verifier_rtime, '
1316+ t.source, t.priority, t.periodicity, i.id AS invprojectid, i.name AS invproject_name, t.verifier_rtime, '
13001317 . $ this ->db ->Concat ('customers.lastname ' , "' ' " , 'customers.name ' ) . ' AS customername,
13011318 o.name AS ownername, t.createtime, t.resolvetime,
13021319 t.customcreatetime,
@@ -1554,7 +1571,7 @@ protected function updateTicketParentID($ticketid, $parentid = null)
15541571
15551572 public function TicketChange ($ ticketid , array $ props )
15561573 {
1557- global $ LMS , $ RT_STATES , $ RT_CAUSE , $ RT_SOURCES , $ RT_PRIORITIES , $ SERVICETYPES , $ RT_TYPES ;
1574+ global $ LMS , $ RT_STATES , $ RT_CAUSE , $ RT_SOURCES , $ RT_PRIORITIES , $ SERVICETYPES , $ RT_TYPES , $ EVENT_PERIODICITY ;
15581575
15591576 $ allow_empty_categories = ConfigHelper::checkConfig ('rt.allow_empty_categories ' , ConfigHelper::checkConfig ('phpui.helpdesk_allow_empty_categories ' ));
15601577
@@ -1612,6 +1629,15 @@ public function TicketChange($ticketid, array $props)
16121629 $ props ['priority ' ] = $ ticket ['priority ' ];
16131630 }
16141631
1632+ if (array_key_exists ('periodicity ' , $ props ) && $ ticket ['periodicity ' ] != $ props ['periodicity ' ]) {
1633+ $ a = isset ($ ticket ['periodicity ' ]) ? $ EVENT_PERIODICITY [$ ticket ['periodicity ' ]]['label ' ] : trans ('none ' );
1634+ $ b = isset ($ props ['periodicity ' ]) ? $ EVENT_PERIODICITY [$ props ['periodicity ' ]]['label ' ] : trans ('none ' );
1635+ $ notes [] = trans ('Ticket \'s scheduling periodicity has been changed from $a to $b. ' , $ a , $ b );
1636+ $ type = $ type | RTMESSAGE_PERIODICITY_CHANGE ;
1637+ } else {
1638+ $ props ['periodicity ' ] = $ ticket ['periodicity ' ];
1639+ }
1640+
16151641 if (isset ($ props ['state ' ]) && $ ticket ['state ' ] != $ props ['state ' ]) {
16161642 $ notes [] = trans ('Ticket \'s state has been changed from $a to $b. ' , $ RT_STATES [$ ticket ['state ' ]]['label ' ], $ RT_STATES [$ props ['state ' ]]['label ' ]);
16171643 $ type = $ type | RTMESSAGE_STATE_CHANGE ;
@@ -1992,7 +2018,7 @@ public function TicketChange($ticketid, array $props)
19922018 $ userid : $ props ['owner ' ];
19932019 $ this ->db ->Execute (
19942020 'UPDATE rttickets SET queueid = ?, owner = ?, cause = ?, state = ?, modtime = ?, resolvetime=?, subject = ?,
1995- customerid = ?, source = ?, priority = ?, address_id = ?, nodeid = ?, netnodeid = ?, netdevid = ?,
2021+ customerid = ?, source = ?, priority = ?, periodicity = ?, address_id = ?, nodeid = ?, netnodeid = ?, netdevid = ?,
19962022 verifierid = ?, verifier_rtime = ?, deadline = ?, service = ?, type = ?, invprojectid = ?,
19972023 requestor_userid = ?, requestor = ?, requestor_mail = ?, requestor_phone = ?, parentid = ?,
19982024 customcreatetime = ?, customresolvetime = ?
@@ -2008,6 +2034,7 @@ public function TicketChange($ticketid, array $props)
20082034 $ props ['customerid ' ],
20092035 $ props ['source ' ],
20102036 $ props ['priority ' ],
2037+ $ props ['periodicity ' ],
20112038 $ props ['address_id ' ],
20122039 $ props ['nodeid ' ],
20132040 $ props ['netnodeid ' ],
0 commit comments