1 | <?php |
||||||
2 | /* |
||||||
3 | * SPDX-License-Identifier: AGPL-3.0-only |
||||||
4 | * SPDX-FileCopyrightText: Copyright 2005-2016 Zarafa Deutschland GmbH |
||||||
5 | * SPDX-FileCopyrightText: Copyright 2020-2024 grommunio GmbH |
||||||
6 | */ |
||||||
7 | |||||||
8 | /* |
||||||
9 | * In general |
||||||
10 | * |
||||||
11 | * This class never actually modifies a task item unless we receive a task request update. This means |
||||||
12 | * that setting all the properties to make the task item itself behave like a task request is up to the |
||||||
13 | * caller. |
||||||
14 | * |
||||||
15 | * The only exception to this is the generation of the TaskGlobalObjId, the unique identifier identifying |
||||||
16 | * this task request to both the organizer and the assignee. The globalobjectid is generated when the |
||||||
17 | * task request is sent via sendTaskRequest. |
||||||
18 | */ |
||||||
19 | |||||||
20 | /* The TaskMode value is only used for the IPM.TaskRequest items. |
||||||
21 | * It must 0 (tdmtNothing) on IPM.Task items. |
||||||
22 | * |
||||||
23 | * It is used to indicate the type of change that is being |
||||||
24 | * carried in the IPM.TaskRequest item (although this information seems |
||||||
25 | * redundant due to that information already being available in PR_MESSAGE_CLASS). |
||||||
26 | */ |
||||||
27 | define('tdmtNothing', 0); // Value in IPM.Task items |
||||||
28 | define('tdmtTaskReq', 1); // Assigner -> Assignee |
||||||
29 | define('tdmtTaskAcc', 2); // Assignee -> Assigner |
||||||
30 | define('tdmtTaskDec', 3); // Assignee -> Assigner |
||||||
31 | define('tdmtTaskUpd', 4); // Assignee -> Assigner |
||||||
32 | define('tdmtTaskSELF', 5); // Assigner -> Assigner (?) |
||||||
33 | |||||||
34 | /* The TaskHistory is used to show the last action on the task |
||||||
35 | * on both the assigner and the assignee's side. |
||||||
36 | * |
||||||
37 | * It is used in combination with 'task_assigned_time' and 'tasklastdelegate' |
||||||
38 | * or 'tasklastuser' to show the information at the top of the task request in |
||||||
39 | * the format 'Accepted by <user> on 01-01-2010 11:00'. |
||||||
40 | */ |
||||||
41 | define('thNone', 0); |
||||||
42 | define('thAccepted', 1); // Set by assignee |
||||||
43 | define('thDeclined', 2); // Set by assignee |
||||||
44 | define('thUpdated', 3); // Set by assignee |
||||||
45 | define('thDueDateChanged', 4); |
||||||
46 | define('thAssigned', 5); // Set by assigner |
||||||
47 | |||||||
48 | /* The TaskState value is used to differentiate the version of a task |
||||||
49 | * in the assigner's folder and the version in the |
||||||
50 | * assignee's folder. The buttons shown depend on this and |
||||||
51 | * the 'taskaccepted' boolean (for the assignee) |
||||||
52 | */ |
||||||
53 | define('tdsNOM', 0); // Got a response to a deleted task, and re-created the task for the assigner |
||||||
54 | define('tdsOWNNEW', 1); // Not assigned |
||||||
55 | define('tdsOWN', 2); // Assignee version |
||||||
56 | define('tdsACC', 3); // Assigner version |
||||||
57 | define('tdsDEC', 4); // Assigner version, but assignee declined |
||||||
58 | |||||||
59 | /* The TaskAcceptanceState is used for the assigner to indicate state */ |
||||||
60 | define('olTaskNotDelegated', 0); |
||||||
61 | define('olTaskDelegationUnknown', 1); // After sending req |
||||||
62 | define('olTaskDelegationAccepted', 2); // After receiving accept |
||||||
63 | define('olTaskDelegationDeclined', 3); // After receiving decline |
||||||
64 | |||||||
65 | /* The task ownership indicates the role of the current user relative to the task. */ |
||||||
66 | define('olNewTask', 0); |
||||||
67 | define('olDelegatedTask', 1); // Task has been assigned |
||||||
68 | define('olOwnTask', 2); // Task owned |
||||||
69 | |||||||
70 | /* taskmultrecips indicates whether the task request sent or received has multiple assignees or not. */ |
||||||
71 | define('tmrNone', 0); |
||||||
72 | define('tmrSent', 1); // Task has been sent to multiple assignee |
||||||
73 | define('tmrReceived', 2); // Task Request received has multiple assignee |
||||||
74 | |||||||
75 | // Task icon index. |
||||||
76 | define('ICON_TASK_ASSIGNEE', 0x00000502); |
||||||
77 | define('ICON_TASK_DECLINE', 0x00000506); |
||||||
78 | define('ICON_TASK_ASSIGNER', 0x00000503); |
||||||
79 | |||||||
80 | class TaskRequest { |
||||||
81 | private $props; |
||||||
82 | |||||||
83 | /** |
||||||
84 | * @var resource |
||||||
85 | */ |
||||||
86 | private $store; |
||||||
87 | |||||||
88 | /** |
||||||
89 | * @var resource |
||||||
90 | */ |
||||||
91 | private $message; |
||||||
92 | |||||||
93 | /** |
||||||
94 | * @var resource |
||||||
95 | */ |
||||||
96 | private $session; |
||||||
97 | |||||||
98 | /** |
||||||
99 | * @var string |
||||||
100 | */ |
||||||
101 | private $taskCommentsInfo; |
||||||
102 | |||||||
103 | // All recipient properties |
||||||
104 | public $recipProps = [ |
||||||
105 | PR_ENTRYID, |
||||||
106 | PR_DISPLAY_NAME, |
||||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||||
107 | PR_EMAIL_ADDRESS, |
||||||
0 ignored issues
–
show
|
|||||||
108 | PR_RECIPIENT_ENTRYID, |
||||||
0 ignored issues
–
show
|
|||||||
109 | PR_RECIPIENT_TYPE, |
||||||
0 ignored issues
–
show
|
|||||||
110 | PR_SEND_INTERNET_ENCODING, |
||||||
0 ignored issues
–
show
|
|||||||
111 | PR_SEND_RICH_INFO, |
||||||
0 ignored issues
–
show
|
|||||||
112 | PR_RECIPIENT_DISPLAY_NAME, |
||||||
0 ignored issues
–
show
|
|||||||
113 | PR_ADDRTYPE, |
||||||
0 ignored issues
–
show
|
|||||||
114 | PR_DISPLAY_TYPE, |
||||||
0 ignored issues
–
show
|
|||||||
115 | PR_RECIPIENT_TRACKSTATUS, |
||||||
0 ignored issues
–
show
|
|||||||
116 | PR_RECIPIENT_TRACKSTATUS_TIME, |
||||||
0 ignored issues
–
show
|
|||||||
117 | PR_RECIPIENT_FLAGS, |
||||||
0 ignored issues
–
show
|
|||||||
118 | PR_ROWID, |
||||||
0 ignored issues
–
show
|
|||||||
119 | PR_SEARCH_KEY, |
||||||
0 ignored issues
–
show
|
|||||||
120 | ]; |
||||||
121 | |||||||
122 | /** |
||||||
123 | * Constructor. |
||||||
124 | * |
||||||
125 | * Constructs a TaskRequest object for the specified message. This can be either the task request |
||||||
126 | * message itself (in the inbox) or the task in the tasks folder, depending on the action to be performed. |
||||||
127 | * |
||||||
128 | * As a general rule, the object message passed is the object 'in view' when the user performs one of the |
||||||
129 | * actions in this class. |
||||||
130 | * |
||||||
131 | * @param resource $store MAPI Store in which $message resides. This is also the store where the tasks folder is assumed to be in |
||||||
132 | * @param resource $message MAPI Message to which the task request refers (can be an email or a task) |
||||||
133 | * @param resource $session MAPI Session which is used to open tasks folders for delegated task requests or responses |
||||||
134 | */ |
||||||
135 | public function __construct($store, $message, $session) { |
||||||
136 | $this->store = $store; |
||||||
137 | $this->message = $message; |
||||||
138 | $this->session = $session; |
||||||
139 | $this->taskCommentsInfo = ''; |
||||||
140 | |||||||
141 | $properties = []; |
||||||
142 | $properties["owner"] = "PT_STRING8:PSETID_Task:0x811f"; |
||||||
143 | $properties["updatecount"] = "PT_LONG:PSETID_Task:0x8112"; |
||||||
144 | $properties["taskstate"] = "PT_LONG:PSETID_Task:0x8113"; |
||||||
145 | $properties["taskmultrecips"] = "PT_LONG:PSETID_Task:0x8120"; |
||||||
146 | $properties["taskupdates"] = "PT_BOOLEAN:PSETID_Task:0x811b"; |
||||||
147 | $properties["tasksoc"] = "PT_BOOLEAN:PSETID_Task:0x8119"; |
||||||
148 | $properties["taskhistory"] = "PT_LONG:PSETID_Task:0x811a"; |
||||||
149 | $properties["taskmode"] = "PT_LONG:PSETID_Common:0x8518"; |
||||||
150 | $properties["task_goid"] = "PT_BINARY:PSETID_Common:0x8519"; |
||||||
151 | $properties["complete"] = "PT_BOOLEAN:PSETID_Common:" . PidLidTaskComplete; |
||||||
0 ignored issues
–
show
|
|||||||
152 | $properties["task_assigned_time"] = "PT_SYSTIME:PSETID_Task:0x8115"; |
||||||
153 | $properties["taskfcreator"] = "PT_BOOLEAN:PSETID_Task:0x0x811e"; |
||||||
154 | $properties["tasklastuser"] = "PT_STRING8:PSETID_Task:0x8122"; |
||||||
155 | $properties["tasklastdelegate"] = "PT_STRING8:PSETID_Task:0x8125"; |
||||||
156 | $properties["taskaccepted"] = "PT_BOOLEAN:PSETID_Task:0x8108"; |
||||||
157 | $properties["task_acceptance_state"] = "PT_LONG:PSETID_Task:0x812a"; |
||||||
158 | $properties["ownership"] = "PT_LONG:PSETID_Task:0x8129"; |
||||||
159 | |||||||
160 | $properties["complete"] = "PT_BOOLEAN:PSETID_Task:" . PidLidTaskComplete; |
||||||
161 | $properties["datecompleted"] = "PT_SYSTIME:PSETID_Task:" . PidLidTaskDateCompleted; |
||||||
0 ignored issues
–
show
|
|||||||
162 | $properties["recurring"] = "PT_BOOLEAN:PSETID_Task:0x8126"; |
||||||
163 | $properties["startdate"] = "PT_SYSTIME:PSETID_Task:" . PidLidTaskStartDate; |
||||||
0 ignored issues
–
show
|
|||||||
164 | $properties["duedate"] = "PT_SYSTIME:PSETID_Task:" . PidLidTaskDueDate; |
||||||
0 ignored issues
–
show
|
|||||||
165 | $properties["status"] = "PT_LONG:PSETID_Task:" . PidLidTaskStatus; |
||||||
0 ignored issues
–
show
|
|||||||
166 | $properties["percent_complete"] = "PT_DOUBLE:PSETID_Task:" . PidLidPercentComplete; |
||||||
0 ignored issues
–
show
|
|||||||
167 | $properties["totalwork"] = "PT_LONG:PSETID_Task:0x8111"; |
||||||
168 | $properties["actualwork"] = "PT_LONG:PSETID_Task:0x8110"; |
||||||
169 | $properties["categories"] = "PT_MV_STRING8:PS_PUBLIC_STRINGS:Keywords"; |
||||||
170 | $properties["companies"] = "PT_MV_STRING8:PSETID_Common:0x8539"; |
||||||
171 | $properties["mileage"] = "PT_STRING8:PSETID_Common:0x8534"; |
||||||
172 | $properties["billinginformation"] = "PT_STRING8:PSETID_Common:0x8535"; |
||||||
173 | |||||||
174 | $this->props = getPropIdsFromStrings($store, $properties); |
||||||
175 | } |
||||||
176 | |||||||
177 | // General functions |
||||||
178 | |||||||
179 | /** |
||||||
180 | * Returns TRUE if the message pointed to is an incoming task request and should |
||||||
181 | * therefore be replied to with doAccept or doDecline(). |
||||||
182 | * |
||||||
183 | * @param mixed $messageClass message class to use for checking |
||||||
184 | * |
||||||
185 | * @return bool true if this is a task request else false |
||||||
186 | */ |
||||||
187 | public function isTaskRequest($messageClass = false) { |
||||||
188 | if ($messageClass === false) { |
||||||
189 | $props = mapi_getprops($this->message, [PR_MESSAGE_CLASS]); |
||||||
0 ignored issues
–
show
The function
mapi_getprops was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
190 | $messageClass = isset($props[PR_MESSAGE_CLASS]) ? $props[PR_MESSAGE_CLASS] : false; |
||||||
191 | } |
||||||
192 | |||||||
193 | if ($messageClass !== false && $messageClass === "IPM.TaskRequest") { |
||||||
194 | return true; |
||||||
195 | } |
||||||
196 | |||||||
197 | return false; |
||||||
198 | } |
||||||
199 | |||||||
200 | /** |
||||||
201 | * Returns TRUE if the message pointed to is a returning task request response. |
||||||
202 | * |
||||||
203 | * @param mixed $messageClass message class to use for checking |
||||||
204 | * |
||||||
205 | * @return bool true if this is a task request else false |
||||||
206 | */ |
||||||
207 | public function isTaskRequestResponse($messageClass = false) { |
||||||
208 | if ($messageClass === false) { |
||||||
209 | $props = mapi_getprops($this->message, [PR_MESSAGE_CLASS]); |
||||||
0 ignored issues
–
show
The function
mapi_getprops was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
210 | $messageClass = isset($props[PR_MESSAGE_CLASS]) ? $props[PR_MESSAGE_CLASS] : false; |
||||||
211 | } |
||||||
212 | |||||||
213 | if ($messageClass !== false && strpos($messageClass, "IPM.TaskRequest.") === 0) { |
||||||
214 | return true; |
||||||
215 | } |
||||||
216 | |||||||
217 | return false; |
||||||
218 | } |
||||||
219 | |||||||
220 | /** |
||||||
221 | * Returns TRUE if the message pointed to is an incoming task request/response. |
||||||
222 | * |
||||||
223 | * @param array $props The MAPI properties to check message is an incoming task request/response |
||||||
224 | * |
||||||
225 | * @return bool true if this is an incoming task request/response else false |
||||||
226 | */ |
||||||
227 | public function isReceivedItem($props) { |
||||||
228 | return isset($props[PR_MESSAGE_TO_ME]) ? $props[PR_MESSAGE_TO_ME] : false; |
||||||
0 ignored issues
–
show
|
|||||||
229 | } |
||||||
230 | |||||||
231 | /** |
||||||
232 | * Gets the task associated with an IPM.TaskRequest message. |
||||||
233 | * |
||||||
234 | * If the task does not exist yet, it is created, using the attachment object in the |
||||||
235 | * task request item. |
||||||
236 | * |
||||||
237 | * @param bool $create true - try create task in user's task folder if task does not exist |
||||||
238 | * false - find the associated task in user's task folder |
||||||
239 | * |
||||||
240 | * @return bool|resource associated task of task request else false |
||||||
241 | */ |
||||||
242 | public function getAssociatedTask($create) { |
||||||
243 | $props = mapi_getprops($this->message, [PR_MESSAGE_CLASS, $this->props['task_goid']]); |
||||||
0 ignored issues
–
show
The function
mapi_getprops was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
244 | |||||||
245 | if ($props[PR_MESSAGE_CLASS] == "IPM.Task") { |
||||||
246 | // Message itself is task, so return that |
||||||
247 | return $this->message; |
||||||
248 | } |
||||||
249 | |||||||
250 | $taskFolder = $this->getDefaultTasksFolder(); |
||||||
251 | $goid = $props[$this->props['task_goid']]; |
||||||
252 | |||||||
253 | // Find the task by looking for the task_goid |
||||||
254 | $restriction = [ |
||||||
255 | RES_PROPERTY, |
||||||
256 | [ |
||||||
257 | RELOP => RELOP_EQ, |
||||||
258 | ULPROPTAG => $this->props['task_goid'], |
||||||
259 | VALUE => $goid, |
||||||
260 | ], |
||||||
261 | ]; |
||||||
262 | |||||||
263 | $contents = mapi_folder_getcontentstable($taskFolder); |
||||||
0 ignored issues
–
show
The function
mapi_folder_getcontentstable was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
264 | |||||||
265 | $rows = mapi_table_queryallrows($contents, [PR_ENTRYID], $restriction); |
||||||
0 ignored issues
–
show
The function
mapi_table_queryallrows was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
266 | |||||||
267 | if (empty($rows)) { |
||||||
268 | // None found, create one if possible |
||||||
269 | if (!$create) { |
||||||
270 | return false; |
||||||
271 | } |
||||||
272 | |||||||
273 | $task = mapi_folder_createmessage($taskFolder); |
||||||
0 ignored issues
–
show
The function
mapi_folder_createmessage was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
274 | |||||||
275 | $sub = $this->getEmbeddedTask(); |
||||||
276 | mapi_copyto($sub, [], [$this->props['categories']], $task); |
||||||
0 ignored issues
–
show
The function
mapi_copyto was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
277 | |||||||
278 | $senderProps = [ |
||||||
279 | PR_SENT_REPRESENTING_NAME, |
||||||
0 ignored issues
–
show
|
|||||||
280 | PR_SENT_REPRESENTING_EMAIL_ADDRESS, |
||||||
0 ignored issues
–
show
|
|||||||
281 | PR_SENT_REPRESENTING_ENTRYID, |
||||||
0 ignored issues
–
show
|
|||||||
282 | PR_SENT_REPRESENTING_ADDRTYPE, |
||||||
0 ignored issues
–
show
|
|||||||
283 | PR_SENT_REPRESENTING_SEARCH_KEY, |
||||||
0 ignored issues
–
show
|
|||||||
284 | PR_SENDER_NAME, |
||||||
0 ignored issues
–
show
|
|||||||
285 | PR_SENDER_EMAIL_ADDRESS, |
||||||
0 ignored issues
–
show
|
|||||||
286 | PR_SENDER_ENTRYID, |
||||||
0 ignored issues
–
show
|
|||||||
287 | PR_SENDER_ADDRTYPE, |
||||||
0 ignored issues
–
show
|
|||||||
288 | PR_SENDER_SEARCH_KEY, ]; |
||||||
0 ignored issues
–
show
|
|||||||
289 | |||||||
290 | // Copy sender information from the e-mail |
||||||
291 | $props = mapi_getprops($this->message, $senderProps); |
||||||
292 | $props[PR_MESSAGE_CLASS] = 'IPM.Task'; |
||||||
293 | mapi_setprops($task, $props); |
||||||
0 ignored issues
–
show
The function
mapi_setprops was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
294 | } |
||||||
295 | else { |
||||||
296 | // If there are multiple, just use the first |
||||||
297 | $entryid = $rows[0][PR_ENTRYID]; |
||||||
298 | |||||||
299 | $store = $this->getTaskFolderStore(); |
||||||
300 | $task = mapi_msgstore_openentry($store, $entryid); |
||||||
0 ignored issues
–
show
The function
mapi_msgstore_openentry was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
301 | } |
||||||
302 | |||||||
303 | return $task; |
||||||
304 | } |
||||||
305 | |||||||
306 | /** |
||||||
307 | * Function which checks that if we have received a task request/response |
||||||
308 | * for an already updated task in task folder. |
||||||
309 | * |
||||||
310 | * @return bool true if task request is updated later |
||||||
311 | */ |
||||||
312 | public function isTaskRequestUpdated() { |
||||||
313 | $props = mapi_getprops($this->message, [PR_MESSAGE_CLASS, $this->props['task_goid'], $this->props['updatecount']]); |
||||||
0 ignored issues
–
show
The function
mapi_getprops was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
314 | $result = false; |
||||||
315 | $associatedTask = $this->getAssociatedTask(false); |
||||||
316 | if ($this->isTaskRequest($props[PR_MESSAGE_CLASS])) { |
||||||
317 | if ($associatedTask) { |
||||||
318 | return true; |
||||||
319 | } |
||||||
320 | $folder = $this->getDefaultTasksFolder(); |
||||||
321 | $goid = $props[$this->props['task_goid']]; |
||||||
322 | |||||||
323 | // Find the task by looking for the task_goid |
||||||
324 | $restriction = [ |
||||||
325 | RES_PROPERTY, |
||||||
326 | [ |
||||||
327 | RELOP => RELOP_EQ, |
||||||
328 | ULPROPTAG => $this->props['task_goid'], |
||||||
329 | VALUE => $goid, |
||||||
330 | ], |
||||||
331 | ]; |
||||||
332 | |||||||
333 | $table = mapi_folder_getcontentstable($folder, MAPI_DEFERRED_ERRORS | SHOW_SOFT_DELETES); |
||||||
0 ignored issues
–
show
The function
mapi_folder_getcontentstable was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
334 | $softDeletedItems = mapi_table_queryallrows($table, [PR_ENTRYID], $restriction); |
||||||
0 ignored issues
–
show
The function
mapi_table_queryallrows was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
335 | if (!empty($softDeletedItems)) { |
||||||
336 | return true; |
||||||
337 | } |
||||||
338 | } |
||||||
339 | |||||||
340 | if ($associatedTask !== false) { |
||||||
341 | $taskItemProps = mapi_getprops($associatedTask, [$this->props['updatecount']]); |
||||||
342 | /* |
||||||
343 | * if(message_counter < task_counter) task object is newer then task response (task is updated) |
||||||
344 | * if(message_counter >= task_counter) task is not updated, do normal processing |
||||||
345 | */ |
||||||
346 | if (isset($taskItemProps[$this->props['updatecount']], $props[$this->props['updatecount']])) { |
||||||
347 | if ($props[$this->props['updatecount']] < $taskItemProps[$this->props['updatecount']]) { |
||||||
348 | $result = true; |
||||||
349 | } |
||||||
350 | } |
||||||
351 | } |
||||||
352 | |||||||
353 | return $result; |
||||||
354 | } |
||||||
355 | |||||||
356 | // Organizer functions (called by the organizer) |
||||||
357 | |||||||
358 | /** |
||||||
359 | * Processes a task request response, which can be any of the following: |
||||||
360 | * - Task accept (task history is marked as accepted) |
||||||
361 | * - Task decline (task history is marked as declined) |
||||||
362 | * - Task update (updates completion %, etc). |
||||||
363 | * |
||||||
364 | * @return true |
||||||
365 | */ |
||||||
366 | public function processTaskResponse(): bool { |
||||||
367 | $messageProps = mapi_getprops($this->message, [PR_PROCESSED, $this->props["taskupdates"], PR_MESSAGE_TO_ME]); |
||||||
0 ignored issues
–
show
The function
mapi_getprops was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
368 | if (isset($messageProps[PR_PROCESSED]) && $messageProps[PR_PROCESSED]) { |
||||||
369 | return true; |
||||||
370 | } |
||||||
371 | mapi_setprops($this->message, [PR_PROCESSED => true]); |
||||||
0 ignored issues
–
show
The function
mapi_setprops was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
372 | mapi_savechanges($this->message); |
||||||
0 ignored issues
–
show
The function
mapi_savechanges was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
373 | |||||||
374 | // Get the embedded task information. |
||||||
375 | $sub = $this->getEmbeddedTask(); |
||||||
376 | // OL saves the task related properties in the embedded message |
||||||
377 | $subProps = mapi_getprops($sub, [$this->props["taskupdates"]]); |
||||||
378 | |||||||
379 | // If task is updated in task folder then we don't need to process |
||||||
380 | // old response |
||||||
381 | if ($this->isTaskRequestUpdated()) { |
||||||
382 | return true; |
||||||
383 | } |
||||||
384 | |||||||
385 | $isReceivedItem = $this->isReceivedItem($messageProps); |
||||||
386 | |||||||
387 | $isCreateAssociatedTask = false; |
||||||
388 | $isAllowUpdateAssociatedTask = $subProps[$this->props["taskupdates"]]; |
||||||
389 | $props = mapi_getprops($this->message, [PR_MESSAGE_CLASS]); |
||||||
0 ignored issues
–
show
|
|||||||
390 | |||||||
391 | // Set correct taskmode and taskhistory depending on response type |
||||||
392 | switch ($props[PR_MESSAGE_CLASS]) { |
||||||
393 | case 'IPM.TaskRequest.Accept': |
||||||
394 | $taskHistory = thAccepted; |
||||||
395 | $taskState = $isReceivedItem ? tdsACC : tdsOWN; |
||||||
396 | $taskOwner = $isReceivedItem ? olDelegatedTask : olOwnTask; |
||||||
397 | $taskAcceptanceState = $isReceivedItem ? olTaskDelegationAccepted : olTaskNotDelegated; |
||||||
398 | break; |
||||||
399 | |||||||
400 | case 'IPM.TaskRequest.Decline': |
||||||
401 | $isCreateAssociatedTask = $isReceivedItem; |
||||||
402 | $isAllowUpdateAssociatedTask = $isReceivedItem; |
||||||
403 | $taskHistory = thDeclined; |
||||||
404 | $taskState = $isReceivedItem ? tdsDEC : tdsACC; |
||||||
405 | $taskOwner = $isReceivedItem ? olOwnTask : olDelegatedTask; |
||||||
406 | $taskAcceptanceState = $isReceivedItem ? olTaskDelegationDeclined : olTaskDelegationUnknown; |
||||||
407 | break; |
||||||
408 | |||||||
409 | case 'IPM.TaskRequest.Update': |
||||||
410 | case 'IPM.TaskRequest.Complete': |
||||||
411 | $taskHistory = thUpdated; |
||||||
412 | $taskState = $isReceivedItem ? tdsACC : tdsOWN; |
||||||
413 | $taskAcceptanceState = olTaskNotDelegated; |
||||||
414 | $taskOwner = $isReceivedItem ? olDelegatedTask : olOwnTask; |
||||||
415 | break; |
||||||
416 | } |
||||||
417 | |||||||
418 | $props = [ |
||||||
419 | $this->props['taskhistory'] => $taskHistory, |
||||||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||||||
420 | $this->props['taskstate'] => $taskState, |
||||||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||||||
421 | $this->props['task_acceptance_state'] => $taskAcceptanceState, |
||||||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||||||
422 | $this->props['ownership'] => $taskOwner, |
||||||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||||||
423 | ]; |
||||||
424 | |||||||
425 | // Get the task for this response |
||||||
426 | $task = $this->getAssociatedTask($isCreateAssociatedTask); |
||||||
427 | if ($task && $isAllowUpdateAssociatedTask) { |
||||||
428 | // To avoid duplication of attachments in associated task. we simple remove the |
||||||
429 | // all attachments from associated task. |
||||||
430 | $taskAttachTable = mapi_message_getattachmenttable($task); |
||||||
0 ignored issues
–
show
The function
mapi_message_getattachmenttable was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
431 | $taskAttachments = mapi_table_queryallrows($taskAttachTable, [PR_ATTACH_NUM]); |
||||||
0 ignored issues
–
show
The function
mapi_table_queryallrows was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
432 | foreach ($taskAttachments as $taskAttach) { |
||||||
433 | mapi_message_deleteattach($task, $taskAttach[PR_ATTACH_NUM]); |
||||||
0 ignored issues
–
show
The function
mapi_message_deleteattach was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
434 | } |
||||||
435 | |||||||
436 | $ignoreProps = [ |
||||||
437 | $this->props['taskstate'], |
||||||
438 | $this->props['taskhistory'], |
||||||
439 | $this->props['taskmode'], |
||||||
440 | $this->props['taskfcreator'], |
||||||
441 | ]; |
||||||
442 | // Ignore PR_ICON_INDEX when task request response |
||||||
443 | // is not received item. |
||||||
444 | if ($isReceivedItem === false) { |
||||||
445 | $ignoreProps[] = PR_ICON_INDEX; |
||||||
0 ignored issues
–
show
|
|||||||
446 | } |
||||||
447 | |||||||
448 | // We copy all properties except taskstate, taskhistory, taskmode and taskfcreator properties |
||||||
449 | // from $sub message to $task even also we copy all attachments from $sub to $task message. |
||||||
450 | mapi_copyto($sub, [], $ignoreProps, $task); |
||||||
0 ignored issues
–
show
The function
mapi_copyto was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
451 | $senderProps = mapi_getprops($this->message, [ |
||||||
452 | PR_SENDER_NAME, |
||||||
0 ignored issues
–
show
|
|||||||
453 | PR_SENDER_EMAIL_ADDRESS, |
||||||
0 ignored issues
–
show
|
|||||||
454 | PR_SENDER_ENTRYID, |
||||||
0 ignored issues
–
show
|
|||||||
455 | PR_SENDER_ADDRTYPE, |
||||||
0 ignored issues
–
show
|
|||||||
456 | PR_SENDER_SEARCH_KEY, |
||||||
0 ignored issues
–
show
|
|||||||
457 | PR_MESSAGE_DELIVERY_TIME, |
||||||
0 ignored issues
–
show
|
|||||||
458 | PR_SENT_REPRESENTING_NAME, |
||||||
0 ignored issues
–
show
|
|||||||
459 | PR_SENT_REPRESENTING_EMAIL_ADDRESS, |
||||||
0 ignored issues
–
show
|
|||||||
460 | PR_SENT_REPRESENTING_ADDRTYPE, |
||||||
0 ignored issues
–
show
|
|||||||
461 | PR_SENT_REPRESENTING_ENTRYID, |
||||||
0 ignored issues
–
show
|
|||||||
462 | PR_SENT_REPRESENTING_SEARCH_KEY, ]); |
||||||
0 ignored issues
–
show
|
|||||||
463 | |||||||
464 | mapi_setprops($task, $senderProps); |
||||||
465 | |||||||
466 | // Update taskstate and task history (last action done by the assignee) |
||||||
467 | mapi_setprops($task, $props); |
||||||
468 | |||||||
469 | // Copy missing properties from embedded task |
||||||
470 | $subProperties = $this->getSubProperties(); |
||||||
471 | $subprops = mapi_getprops($sub, $subProperties); |
||||||
472 | mapi_setprops($task, $subprops); |
||||||
473 | |||||||
474 | mapi_savechanges($task); |
||||||
475 | } |
||||||
476 | |||||||
477 | mapi_setprops($this->message, $props); |
||||||
478 | mapi_savechanges($this->message); |
||||||
479 | |||||||
480 | if ($isReceivedItem) { |
||||||
481 | $this->updateSentTaskRequest(); |
||||||
482 | } |
||||||
483 | |||||||
484 | return true; |
||||||
485 | } |
||||||
486 | |||||||
487 | /** |
||||||
488 | * Update the sent task request in sent items folder. |
||||||
489 | * |
||||||
490 | * @return bool |
||||||
491 | */ |
||||||
492 | public function updateSentTaskRequest() { |
||||||
493 | $props = mapi_getprops($this->message, [ |
||||||
0 ignored issues
–
show
The function
mapi_getprops was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
494 | $this->props['taskhistory'], |
||||||
495 | $this->props["taskstate"], |
||||||
496 | $this->props["ownership"], |
||||||
497 | $this->props['task_goid'], |
||||||
498 | $this->props['task_acceptance_state'], |
||||||
499 | $this->props["tasklastuser"], |
||||||
500 | $this->props["tasklastdelegate"], ]); |
||||||
501 | |||||||
502 | $store = $this->getDefaultStore(); |
||||||
503 | $storeProps = mapi_getprops($store, [PR_IPM_SENTMAIL_ENTRYID]); |
||||||
0 ignored issues
–
show
|
|||||||
504 | |||||||
505 | $sentFolder = mapi_msgstore_openentry($store, $storeProps[PR_IPM_SENTMAIL_ENTRYID]); |
||||||
0 ignored issues
–
show
The function
mapi_msgstore_openentry was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
506 | if (!$sentFolder) { |
||||||
507 | return false; |
||||||
508 | } |
||||||
509 | |||||||
510 | // Find the task by looking for the task_goid |
||||||
511 | $restriction = [ |
||||||
512 | RES_PROPERTY, |
||||||
513 | [ |
||||||
514 | RELOP => RELOP_EQ, |
||||||
515 | ULPROPTAG => $this->props['task_goid'], |
||||||
516 | VALUE => $props[$this->props['task_goid']], |
||||||
517 | ], |
||||||
518 | ]; |
||||||
519 | |||||||
520 | $contentsTable = mapi_folder_getcontentstable($sentFolder); |
||||||
0 ignored issues
–
show
The function
mapi_folder_getcontentstable was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
521 | |||||||
522 | $rows = mapi_table_queryallrows($contentsTable, [PR_ENTRYID], $restriction); |
||||||
0 ignored issues
–
show
The function
mapi_table_queryallrows was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
523 | |||||||
524 | if (!empty($rows)) { |
||||||
525 | foreach ($rows as $row) { |
||||||
526 | $sentTaskRequest = mapi_msgstore_openentry($store, $row[PR_ENTRYID]); |
||||||
527 | mapi_setprops($sentTaskRequest, $props); |
||||||
0 ignored issues
–
show
The function
mapi_setprops was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
528 | mapi_setprops($sentTaskRequest, [PR_PROCESSED => true]); |
||||||
0 ignored issues
–
show
|
|||||||
529 | mapi_savechanges($sentTaskRequest); |
||||||
0 ignored issues
–
show
The function
mapi_savechanges was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
530 | } |
||||||
531 | } |
||||||
532 | |||||||
533 | return true; |
||||||
534 | } |
||||||
535 | |||||||
536 | /** |
||||||
537 | * Creates a new message in the current user's outbox and submits it. |
||||||
538 | * |
||||||
539 | * Takes the task passed in the constructor as the task to be sent; recipient should |
||||||
540 | * be pre-existing. The task request will be sent to all recipients. |
||||||
541 | * |
||||||
542 | * @param string $prefix |
||||||
543 | * |
||||||
544 | * @return true |
||||||
545 | */ |
||||||
546 | public function sendTaskRequest($prefix): bool { |
||||||
547 | // Generate a TaskGlobalObjectId |
||||||
548 | $taskid = $this->createTGOID(); |
||||||
549 | $messageprops = mapi_getprops($this->message, [PR_SUBJECT]); |
||||||
0 ignored issues
–
show
The function
mapi_getprops was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
550 | |||||||
551 | // Set properties on Task Request |
||||||
552 | mapi_setprops($this->message, [ |
||||||
0 ignored issues
–
show
The function
mapi_setprops was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
553 | $this->props['task_goid'] => $taskid, // our new task_goid |
||||||
554 | $this->props['taskstate'] => tdsACC, // state for our outgoing request |
||||||
555 | $this->props['taskmode'] => tdmtNothing, // we're not sending a change |
||||||
556 | $this->props['updatecount'] => 2, // version 2 (no idea) |
||||||
557 | $this->props['task_acceptance_state'] => olTaskDelegationUnknown, // no reply yet |
||||||
558 | $this->props['ownership'] => olDelegatedTask, // Task has been assigned |
||||||
559 | $this->props['taskhistory'] => thAssigned, // Task has been assigned |
||||||
560 | PR_CONVERSATION_TOPIC => $messageprops[PR_SUBJECT], |
||||||
0 ignored issues
–
show
|
|||||||
561 | PR_ICON_INDEX => ICON_TASK_ASSIGNER, |
||||||
0 ignored issues
–
show
|
|||||||
562 | ]); |
||||||
563 | $this->setLastUser(); |
||||||
564 | $this->setOwnerForAssignor(); |
||||||
565 | mapi_savechanges($this->message); |
||||||
0 ignored issues
–
show
The function
mapi_savechanges was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
566 | |||||||
567 | // Create outgoing task request message |
||||||
568 | $outgoing = $this->createOutgoingMessage(); |
||||||
569 | |||||||
570 | // No need to copy PR_ICON_INDEX and PR_SENT_* information in to outgoing message. |
||||||
571 | $ignoreProps = [PR_ICON_INDEX, PR_SENT_REPRESENTING_NAME, PR_SENT_REPRESENTING_EMAIL_ADDRESS, PR_SENT_REPRESENTING_ADDRTYPE, PR_SENT_REPRESENTING_ENTRYID, PR_SENT_REPRESENTING_SEARCH_KEY]; |
||||||
0 ignored issues
–
show
|
|||||||
572 | mapi_copyto($this->message, [], $ignoreProps, $outgoing); |
||||||
0 ignored issues
–
show
The function
mapi_copyto was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
573 | |||||||
574 | // Make it a task request, and put it in sent items after it is sent |
||||||
575 | mapi_setprops($outgoing, [ |
||||||
576 | PR_MESSAGE_CLASS => "IPM.TaskRequest", // class is task request |
||||||
0 ignored issues
–
show
|
|||||||
577 | $this->props['taskstate'] => tdsOWN, // for the recipient he is the task owner |
||||||
578 | $this->props['taskmode'] => tdmtTaskReq, // for the recipient it's a request |
||||||
579 | $this->props['updatecount'] => 1, // version 2 is in the attachment |
||||||
580 | PR_SUBJECT_PREFIX => $prefix, |
||||||
0 ignored issues
–
show
|
|||||||
581 | PR_SUBJECT => $prefix . $messageprops[PR_SUBJECT], |
||||||
582 | ]); |
||||||
583 | |||||||
584 | $attach = mapi_message_createattach($outgoing); |
||||||
0 ignored issues
–
show
The function
mapi_message_createattach was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
585 | mapi_setprops($attach, [ |
||||||
586 | PR_ATTACH_METHOD => ATTACH_EMBEDDED_MSG, |
||||||
0 ignored issues
–
show
|
|||||||
587 | PR_ATTACHMENT_HIDDEN => true, |
||||||
0 ignored issues
–
show
|
|||||||
588 | PR_DISPLAY_NAME => $messageprops[PR_SUBJECT], ]); |
||||||
0 ignored issues
–
show
|
|||||||
589 | |||||||
590 | $sub = mapi_attach_openproperty($attach, PR_ATTACH_DATA_OBJ, IID_IMessage, 0, MAPI_MODIFY | MAPI_CREATE); |
||||||
0 ignored issues
–
show
The function
mapi_attach_openproperty was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
591 | |||||||
592 | mapi_copyto($this->message, [], [], $sub); |
||||||
593 | mapi_setprops($sub, [PR_MESSAGE_CLASS => 'IPM.Task']); |
||||||
594 | |||||||
595 | mapi_savechanges($sub); |
||||||
596 | |||||||
597 | mapi_savechanges($attach); |
||||||
598 | |||||||
599 | mapi_savechanges($outgoing); |
||||||
600 | mapi_message_submitmessage($outgoing); |
||||||
0 ignored issues
–
show
The function
mapi_message_submitmessage was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
601 | |||||||
602 | return true; |
||||||
603 | } |
||||||
604 | |||||||
605 | // Assignee functions (called by the assignee) |
||||||
606 | |||||||
607 | /** |
||||||
608 | * Updates task version counter. |
||||||
609 | * |
||||||
610 | * Must be called before each update to increase counter. |
||||||
611 | */ |
||||||
612 | public function updateTaskRequest(): void { |
||||||
613 | $messageprops = mapi_getprops($this->message, [$this->props['updatecount']]); |
||||||
0 ignored issues
–
show
The function
mapi_getprops was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
614 | |||||||
615 | if (isset($messageprops)) { |
||||||
616 | ++$messageprops[$this->props['updatecount']]; |
||||||
617 | } |
||||||
618 | else { |
||||||
619 | $messageprops[$this->props['updatecount']] = 1; |
||||||
620 | } |
||||||
621 | |||||||
622 | mapi_setprops($this->message, $messageprops); |
||||||
0 ignored issues
–
show
The function
mapi_setprops was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
623 | } |
||||||
624 | |||||||
625 | /** |
||||||
626 | * Processes a task request. |
||||||
627 | * |
||||||
628 | * Message passed should be an IPM.TaskRequest message. The task request is then processed to create |
||||||
629 | * the task in the tasks folder if needed. |
||||||
630 | * |
||||||
631 | * @return bool |
||||||
632 | */ |
||||||
633 | public function processTaskRequest() { |
||||||
634 | if (!$this->isTaskRequest()) { |
||||||
635 | return false; |
||||||
636 | } |
||||||
637 | $messageProps = mapi_getprops($this->message, [PR_PROCESSED, $this->props["taskupdates"], PR_MESSAGE_TO_ME]); |
||||||
0 ignored issues
–
show
The function
mapi_getprops was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
638 | if (isset($messageProps[PR_PROCESSED]) && $messageProps[PR_PROCESSED]) { |
||||||
639 | return true; |
||||||
640 | } |
||||||
641 | |||||||
642 | // if task is updated in task folder then we don't need to process |
||||||
643 | // old request. |
||||||
644 | if ($this->isTaskRequestUpdated()) { |
||||||
645 | return true; |
||||||
646 | } |
||||||
647 | |||||||
648 | $isReceivedItem = $this->isReceivedItem($messageProps); |
||||||
649 | |||||||
650 | $props = []; |
||||||
651 | $props[PR_PROCESSED] = true; |
||||||
652 | $props[$this->props["taskstate"]] = $isReceivedItem ? tdsOWN : tdsACC; |
||||||
653 | $props[$this->props["ownership"]] = $isReceivedItem ? olOwnTask : olDelegatedTask; |
||||||
654 | |||||||
655 | mapi_setprops($this->message, $props); |
||||||
0 ignored issues
–
show
The function
mapi_setprops was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
656 | mapi_savechanges($this->message); |
||||||
0 ignored issues
–
show
The function
mapi_savechanges was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
657 | |||||||
658 | // Don't create associated task in task folder if "taskupdates" is not true. |
||||||
659 | if (!$isReceivedItem && !$messageProps[$this->props["taskupdates"]]) { |
||||||
660 | return true; |
||||||
661 | } |
||||||
662 | // create an associated task in task folder while |
||||||
663 | // reading/loading task request on client side. |
||||||
664 | $task = $this->getAssociatedTask(true); |
||||||
665 | |||||||
666 | $taskProps = mapi_getprops($task, [$this->props['taskmultrecips']]); |
||||||
667 | $taskProps[$this->props["taskstate"]] = $isReceivedItem ? tdsOWN : tdsACC; |
||||||
668 | $taskProps[$this->props["taskhistory"]] = thAssigned; |
||||||
669 | $taskProps[$this->props["taskmode"]] = tdmtNothing; |
||||||
670 | $taskProps[$this->props["taskaccepted"]] = false; |
||||||
671 | $taskProps[$this->props["taskfcreator"]] = false; |
||||||
672 | $taskProps[$this->props["ownership"]] = $isReceivedItem ? olOwnTask : olDelegatedTask; |
||||||
673 | $taskProps[$this->props["task_acceptance_state"]] = olTaskNotDelegated; |
||||||
674 | $taskProps[PR_ICON_INDEX] = ICON_TASK_ASSIGNEE; |
||||||
0 ignored issues
–
show
|
|||||||
675 | |||||||
676 | mapi_setprops($task, $taskProps); |
||||||
677 | $this->setAssignorInRecipients($task); |
||||||
678 | |||||||
679 | mapi_savechanges($task); |
||||||
680 | |||||||
681 | return true; |
||||||
682 | } |
||||||
683 | |||||||
684 | /** |
||||||
685 | * Accepts a task request and sends the response. |
||||||
686 | * |
||||||
687 | * Message passed should be an IPM.Task (eg the task from getAssociatedTask()) |
||||||
688 | * |
||||||
689 | * Copies the task to the user's task folder, sets it to accepted, and sends the acceptation |
||||||
690 | * message back to the organizer. The caller is responsible for removing the message. |
||||||
691 | * |
||||||
692 | * @return array|false PR_ENTRYID, PR_STORE_ENTRYID and PR_PARENT_ENTRYID of the task |
||||||
693 | */ |
||||||
694 | public function doAccept() { |
||||||
695 | $prefix = _("Task Accepted:") . " "; |
||||||
696 | $messageProps = mapi_getprops($this->message, [PR_MESSAGE_CLASS, $this->props['taskstate']]); |
||||||
0 ignored issues
–
show
The function
mapi_getprops was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
697 | |||||||
698 | if (!isset($messageProps[$this->props['taskstate']]) || $messageProps[$this->props['taskstate']] != tdsOWN) { |
||||||
699 | // Can only accept assignee task |
||||||
700 | return false; |
||||||
701 | } |
||||||
702 | |||||||
703 | $this->setLastUser(); |
||||||
704 | $this->updateTaskRequest(); |
||||||
705 | |||||||
706 | $props = [ |
||||||
707 | $this->props['taskhistory'] => thAccepted, |
||||||
708 | $this->props['task_assigned_time'] => time(), |
||||||
709 | $this->props['taskaccepted'] => true, |
||||||
710 | $this->props['task_acceptance_state'] => olTaskNotDelegated, ]; |
||||||
711 | |||||||
712 | // Message is TaskRequest then update the associated task as well. |
||||||
713 | if ($this->isTaskRequest($messageProps[PR_MESSAGE_CLASS])) { |
||||||
714 | $task = $this->getAssociatedTask(false); |
||||||
715 | if ($task) { |
||||||
716 | mapi_setprops($task, $props); |
||||||
0 ignored issues
–
show
The function
mapi_setprops was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
717 | mapi_savechanges($task); |
||||||
0 ignored issues
–
show
The function
mapi_savechanges was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
718 | } |
||||||
719 | } |
||||||
720 | |||||||
721 | // Set as accepted |
||||||
722 | mapi_setprops($this->message, $props); |
||||||
723 | |||||||
724 | // As we copy the all properties from received message we need to remove following |
||||||
725 | // properties from accept response. |
||||||
726 | mapi_deleteprops($this->message, [PR_MESSAGE_RECIP_ME, PR_MESSAGE_TO_ME, PR_MESSAGE_CC_ME, PR_PROCESSED]); |
||||||
0 ignored issues
–
show
The function
mapi_deleteprops was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
727 | |||||||
728 | mapi_savechanges($this->message); |
||||||
729 | |||||||
730 | $this->sendResponse(tdmtTaskAcc, $prefix); |
||||||
731 | |||||||
732 | return $this->deleteReceivedTR(); |
||||||
733 | } |
||||||
734 | |||||||
735 | /** |
||||||
736 | * Declines a task request and sends the response. |
||||||
737 | * |
||||||
738 | * Passed message must be a task request message, ie isTaskRequest() must return TRUE. |
||||||
739 | * |
||||||
740 | * Sends the decline message back to the organizer. The caller is responsible for removing the message. |
||||||
741 | * |
||||||
742 | * @return array|false TRUE on success, FALSE on failure |
||||||
743 | */ |
||||||
744 | public function doDecline() { |
||||||
745 | $prefix = _("Task Declined:") . " "; |
||||||
746 | $messageProps = mapi_getprops($this->message, [$this->props['taskstate']]); |
||||||
0 ignored issues
–
show
The function
mapi_getprops was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
747 | |||||||
748 | if (!isset($messageProps[$this->props['taskstate']]) || $messageProps[$this->props['taskstate']] != tdsOWN) { |
||||||
749 | return false; // Can only decline assignee task |
||||||
750 | } |
||||||
751 | |||||||
752 | $this->setLastUser(); |
||||||
753 | $this->updateTaskRequest(); |
||||||
754 | |||||||
755 | // Set as declined |
||||||
756 | mapi_setprops($this->message, [ |
||||||
0 ignored issues
–
show
The function
mapi_setprops was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
757 | $this->props['taskhistory'] => thDeclined, |
||||||
758 | $this->props['task_acceptance_state'] => olTaskDelegationDeclined, |
||||||
759 | ]); |
||||||
760 | mapi_deleteprops($this->message, [PR_MESSAGE_RECIP_ME, PR_MESSAGE_TO_ME, PR_MESSAGE_CC_ME, PR_PROCESSED]); |
||||||
0 ignored issues
–
show
The function
mapi_deleteprops was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
761 | mapi_savechanges($this->message); |
||||||
0 ignored issues
–
show
The function
mapi_savechanges was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
762 | |||||||
763 | $this->sendResponse(tdmtTaskDec, $prefix); |
||||||
764 | |||||||
765 | // Delete the associated task when task request is declined by the assignee. |
||||||
766 | $task = $this->getAssociatedTask(false); |
||||||
767 | if ($task) { |
||||||
768 | $taskFolder = $this->getDefaultTasksFolder(); |
||||||
769 | $props = mapi_getprops($task, [PR_ENTRYID]); |
||||||
770 | mapi_folder_deletemessages($taskFolder, [$props[PR_ENTRYID]]); |
||||||
0 ignored issues
–
show
The function
mapi_folder_deletemessages was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
771 | } |
||||||
772 | |||||||
773 | return $this->deleteReceivedTR(); |
||||||
774 | } |
||||||
775 | |||||||
776 | /** |
||||||
777 | * Sends an update of the task if requested, and sends the Status-On-Completion report if complete and requested. |
||||||
778 | * |
||||||
779 | * If no updates were requested from the organizer, this function does nothing. |
||||||
780 | * |
||||||
781 | * @return bool TRUE if the update succeeded, FALSE otherwise |
||||||
782 | */ |
||||||
783 | public function doUpdate() { |
||||||
784 | $messageProps = mapi_getprops($this->message, [$this->props['taskstate'], PR_SUBJECT]); |
||||||
0 ignored issues
–
show
The function
mapi_getprops was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
785 | |||||||
786 | if (!isset($messageProps[$this->props['taskstate']]) || $messageProps[$this->props['taskstate']] != tdsOWN) { |
||||||
787 | return false; // Can only update assignee task |
||||||
788 | } |
||||||
789 | |||||||
790 | $this->setLastUser(); |
||||||
791 | $this->updateTaskRequest(); |
||||||
792 | |||||||
793 | // Set as updated |
||||||
794 | mapi_setprops($this->message, [$this->props['taskhistory'] => thUpdated]); |
||||||
0 ignored issues
–
show
The function
mapi_setprops was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
795 | |||||||
796 | mapi_savechanges($this->message); |
||||||
0 ignored issues
–
show
The function
mapi_savechanges was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
797 | |||||||
798 | $props = mapi_getprops($this->message, [$this->props['taskupdates'], $this->props['tasksoc'], $this->props['recurring'], $this->props['complete']]); |
||||||
799 | if (!$props[$this->props['complete']] && $props[$this->props['taskupdates']] && !(isset($props[$this->props['recurring']]) && $props[$this->props['recurring']])) { |
||||||
800 | $this->sendResponse(tdmtTaskUpd, _("Task Updated:") . " "); |
||||||
801 | } |
||||||
802 | elseif ($props[$this->props['complete']]) { |
||||||
803 | $this->sendResponse(tdmtTaskUpd, _("Task Completed:") . " "); |
||||||
804 | } |
||||||
805 | |||||||
806 | return true; |
||||||
807 | } |
||||||
808 | |||||||
809 | /** |
||||||
810 | * Gets the store associated with the task. |
||||||
811 | * |
||||||
812 | * Normally this will just open the store that the processed message is in. However, if the message is opened |
||||||
813 | * by a delegate, this function opens the store that the message was delegated from. |
||||||
814 | */ |
||||||
815 | public function getTaskFolderStore() { |
||||||
816 | $ownerentryid = false; |
||||||
817 | |||||||
818 | $rcvdprops = mapi_getprops($this->message, [PR_RCVD_REPRESENTING_ENTRYID]); |
||||||
0 ignored issues
–
show
The function
mapi_getprops was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
819 | if (isset($rcvdprops[PR_RCVD_REPRESENTING_ENTRYID])) { |
||||||
820 | $ownerentryid = $rcvdprops[PR_RCVD_REPRESENTING_ENTRYID]; |
||||||
821 | } |
||||||
822 | |||||||
823 | if (!$ownerentryid) { |
||||||
824 | $store = $this->store; |
||||||
825 | } |
||||||
826 | else { |
||||||
827 | $ab = mapi_openaddressbook($this->session); |
||||||
0 ignored issues
–
show
The function
mapi_openaddressbook was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
828 | if (!$ab) { |
||||||
829 | return false; |
||||||
830 | } |
||||||
831 | |||||||
832 | $mailuser = mapi_ab_openentry($ab, $ownerentryid); |
||||||
0 ignored issues
–
show
The function
mapi_ab_openentry was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
833 | if (!$mailuser) { |
||||||
834 | return false; |
||||||
835 | } |
||||||
836 | |||||||
837 | $mailuserprops = mapi_getprops($mailuser, [PR_EMAIL_ADDRESS]); |
||||||
0 ignored issues
–
show
|
|||||||
838 | if (!isset($mailuserprops[PR_EMAIL_ADDRESS])) { |
||||||
839 | return false; |
||||||
840 | } |
||||||
841 | |||||||
842 | $storeid = mapi_msgstore_createentryid($this->store, $mailuserprops[PR_EMAIL_ADDRESS]); |
||||||
0 ignored issues
–
show
The function
mapi_msgstore_createentryid was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
843 | |||||||
844 | $store = mapi_openmsgstore($this->session, $storeid); |
||||||
0 ignored issues
–
show
The function
mapi_openmsgstore was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
845 | } |
||||||
846 | |||||||
847 | return $store; |
||||||
848 | } |
||||||
849 | |||||||
850 | /** |
||||||
851 | * Opens the default task folder for the current user, or the specified user if passed. |
||||||
852 | */ |
||||||
853 | public function getDefaultTasksFolder() { |
||||||
854 | $store = $this->getTaskFolderStore(); |
||||||
855 | |||||||
856 | $inbox = mapi_msgstore_getreceivefolder($store); |
||||||
0 ignored issues
–
show
The function
mapi_msgstore_getreceivefolder was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
857 | $inboxprops = mapi_getprops($inbox, [PR_IPM_TASK_ENTRYID]); |
||||||
0 ignored issues
–
show
The function
mapi_getprops was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
858 | if (!isset($inboxprops[PR_IPM_TASK_ENTRYID])) { |
||||||
859 | return false; |
||||||
860 | } |
||||||
861 | |||||||
862 | return mapi_msgstore_openentry($store, $inboxprops[PR_IPM_TASK_ENTRYID]); |
||||||
0 ignored issues
–
show
The function
mapi_msgstore_openentry was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
863 | } |
||||||
864 | |||||||
865 | /** |
||||||
866 | * Prepares the sent representing properties from given MAPI store. |
||||||
867 | * |
||||||
868 | * @param mixed $store MAPI store object |
||||||
869 | * |
||||||
870 | * @return array[][][][][]|false if store is not mail box owner entryid then return false else prepare the sent representing props and return it |
||||||
871 | * |
||||||
872 | * @psalm-return array<array<array<array<array<array<never, never>>>>>>|false |
||||||
873 | */ |
||||||
874 | public function getSentReprProps($store) { |
||||||
875 | $storeprops = mapi_getprops($store, [PR_MAILBOX_OWNER_ENTRYID]); |
||||||
0 ignored issues
–
show
The function
mapi_getprops was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
876 | if (!isset($storeprops[PR_MAILBOX_OWNER_ENTRYID])) { |
||||||
877 | return false; |
||||||
878 | } |
||||||
879 | |||||||
880 | $ab = mapi_openaddressbook($this->session); |
||||||
0 ignored issues
–
show
The function
mapi_openaddressbook was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
881 | $mailuser = mapi_ab_openentry($ab, $storeprops[PR_MAILBOX_OWNER_ENTRYID]); |
||||||
0 ignored issues
–
show
The function
mapi_ab_openentry was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
882 | $mailuserprops = mapi_getprops($mailuser, [PR_ADDRTYPE, PR_EMAIL_ADDRESS, PR_DISPLAY_NAME, PR_SEARCH_KEY, PR_ENTRYID]); |
||||||
0 ignored issues
–
show
|
|||||||
883 | |||||||
884 | $props = []; |
||||||
885 | $props[PR_SENT_REPRESENTING_ADDRTYPE] = $mailuserprops[PR_ADDRTYPE]; |
||||||
0 ignored issues
–
show
|
|||||||
886 | $props[PR_SENT_REPRESENTING_EMAIL_ADDRESS] = $mailuserprops[PR_EMAIL_ADDRESS]; |
||||||
0 ignored issues
–
show
|
|||||||
887 | $props[PR_SENT_REPRESENTING_NAME] = $mailuserprops[PR_DISPLAY_NAME]; |
||||||
0 ignored issues
–
show
|
|||||||
888 | $props[PR_SENT_REPRESENTING_SEARCH_KEY] = $mailuserprops[PR_SEARCH_KEY]; |
||||||
0 ignored issues
–
show
|
|||||||
889 | $props[PR_SENT_REPRESENTING_ENTRYID] = $mailuserprops[PR_ENTRYID]; |
||||||
0 ignored issues
–
show
|
|||||||
890 | |||||||
891 | return $props; |
||||||
892 | } |
||||||
893 | |||||||
894 | /** |
||||||
895 | * Creates an outgoing message based on the passed message - will set delegate information |
||||||
896 | * and sent mail folder. |
||||||
897 | */ |
||||||
898 | public function createOutgoingMessage() { |
||||||
899 | // Open our default store for this user (that's the only store we can submit in) |
||||||
900 | $store = $this->getDefaultStore(); |
||||||
901 | $storeprops = mapi_getprops($store, [PR_IPM_OUTBOX_ENTRYID, PR_IPM_SENTMAIL_ENTRYID]); |
||||||
0 ignored issues
–
show
The function
mapi_getprops was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
902 | |||||||
903 | $outbox = mapi_msgstore_openentry($store, $storeprops[PR_IPM_OUTBOX_ENTRYID]); |
||||||
0 ignored issues
–
show
The function
mapi_msgstore_openentry was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
904 | if (!$outbox) { |
||||||
905 | return false; |
||||||
906 | } |
||||||
907 | |||||||
908 | $outgoing = mapi_folder_createmessage($outbox); |
||||||
0 ignored issues
–
show
The function
mapi_folder_createmessage was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
909 | if (!$outgoing) { |
||||||
910 | return false; |
||||||
911 | } |
||||||
912 | |||||||
913 | // Set SENT_REPRESENTING in case we're sending as a delegate |
||||||
914 | $ownerstore = $this->getTaskFolderStore(); |
||||||
915 | $sentreprprops = $this->getSentReprProps($ownerstore); |
||||||
916 | mapi_setprops($outgoing, $sentreprprops); |
||||||
0 ignored issues
–
show
The function
mapi_setprops was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
917 | |||||||
918 | mapi_setprops($outgoing, [PR_SENTMAIL_ENTRYID => $storeprops[PR_IPM_SENTMAIL_ENTRYID]]); |
||||||
0 ignored issues
–
show
|
|||||||
919 | |||||||
920 | return $outgoing; |
||||||
921 | } |
||||||
922 | |||||||
923 | /** |
||||||
924 | * Sends a response message (from assignee back to organizer). |
||||||
925 | * |
||||||
926 | * @param int $type Type of response (tdmtTaskAcc, tdmtTaskDec, tdmtTaskUpd) |
||||||
927 | * @param mixed $prefix |
||||||
928 | * |
||||||
929 | * @return bool TRUE on success |
||||||
930 | */ |
||||||
931 | public function sendResponse($type, $prefix) { |
||||||
932 | // Create a message in our outbox |
||||||
933 | $outgoing = $this->createOutgoingMessage(); |
||||||
934 | $messageprops = mapi_getprops($this->message, [PR_CONVERSATION_TOPIC, PR_MESSAGE_CLASS, $this->props['complete']]); |
||||||
0 ignored issues
–
show
The function
mapi_getprops was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
935 | |||||||
936 | $attach = mapi_message_createattach($outgoing); |
||||||
0 ignored issues
–
show
The function
mapi_message_createattach was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
937 | mapi_setprops($attach, [PR_ATTACH_METHOD => ATTACH_EMBEDDED_MSG, PR_DISPLAY_NAME => $messageprops[PR_CONVERSATION_TOPIC], PR_ATTACHMENT_HIDDEN => true]); |
||||||
0 ignored issues
–
show
The function
mapi_setprops was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
938 | $sub = mapi_attach_openproperty($attach, PR_ATTACH_DATA_OBJ, IID_IMessage, 0, MAPI_CREATE | MAPI_MODIFY); |
||||||
0 ignored issues
–
show
The function
mapi_attach_openproperty was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
939 | |||||||
940 | $message = !$this->isTaskRequest() ? $this->message : $this->getAssociatedTask(false); |
||||||
941 | |||||||
942 | $ignoreProps = [PR_ICON_INDEX, $this->props["categories"], PR_SENT_REPRESENTING_NAME, PR_SENT_REPRESENTING_EMAIL_ADDRESS, PR_SENT_REPRESENTING_ADDRTYPE, PR_SENT_REPRESENTING_ENTRYID, PR_SENT_REPRESENTING_SEARCH_KEY]; |
||||||
0 ignored issues
–
show
|
|||||||
943 | |||||||
944 | mapi_copyto($message, [], $ignoreProps, $outgoing); |
||||||
0 ignored issues
–
show
The function
mapi_copyto was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
945 | mapi_copyto($message, [], [], $sub); |
||||||
946 | |||||||
947 | if (!$this->setRecipientsForResponse($outgoing, $type)) { |
||||||
948 | return false; |
||||||
949 | } |
||||||
950 | |||||||
951 | $props = []; |
||||||
952 | |||||||
953 | switch ($type) { |
||||||
954 | case tdmtTaskAcc: |
||||||
955 | $props[PR_MESSAGE_CLASS] = "IPM.TaskRequest.Accept"; |
||||||
956 | mapi_setprops($sub, [PR_ICON_INDEX => ICON_TASK_ASSIGNER]); |
||||||
957 | break; |
||||||
958 | |||||||
959 | case tdmtTaskDec: |
||||||
960 | $props[PR_MESSAGE_CLASS] = "IPM.TaskRequest.Decline"; |
||||||
961 | mapi_setprops($sub, [PR_ICON_INDEX => ICON_TASK_DECLINE]); |
||||||
962 | break; |
||||||
963 | |||||||
964 | case tdmtTaskUpd: |
||||||
965 | mapi_setprops($sub, [PR_ICON_INDEX => ICON_TASK_ASSIGNER]); |
||||||
966 | if ($messageprops[$this->props['complete']]) { |
||||||
967 | $props[PR_MESSAGE_CLASS] = "IPM.TaskRequest.Complete"; |
||||||
968 | } |
||||||
969 | else { |
||||||
970 | $props[PR_MESSAGE_CLASS] = "IPM.TaskRequest.Update"; |
||||||
971 | } |
||||||
972 | |||||||
973 | break; |
||||||
974 | } |
||||||
975 | |||||||
976 | mapi_savechanges($sub); |
||||||
0 ignored issues
–
show
The function
mapi_savechanges was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
977 | mapi_savechanges($attach); |
||||||
978 | |||||||
979 | $props[PR_SUBJECT] = $prefix . $messageprops[PR_CONVERSATION_TOPIC]; |
||||||
0 ignored issues
–
show
|
|||||||
980 | $props[$this->props['taskmode']] = $type; |
||||||
981 | $props[$this->props['task_assigned_time']] = time(); |
||||||
982 | |||||||
983 | mapi_setprops($outgoing, $props); |
||||||
984 | |||||||
985 | // taskCommentsInfo contains some comments which added by assignee while |
||||||
986 | // edit response before sending task response. |
||||||
987 | if ($this->taskCommentsInfo != '') { |
||||||
988 | $comments = $this->getTaskCommentsInfo(); |
||||||
989 | $stream = mapi_openproperty($outgoing, PR_BODY, IID_IStream, STGM_TRANSACTED, MAPI_CREATE | MAPI_MODIFY); |
||||||
0 ignored issues
–
show
The function
mapi_openproperty was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
990 | mapi_stream_setsize($stream, strlen($comments)); |
||||||
0 ignored issues
–
show
The function
mapi_stream_setsize was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
991 | mapi_stream_write($stream, $comments); |
||||||
0 ignored issues
–
show
The function
mapi_stream_write was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
992 | mapi_stream_commit($stream); |
||||||
0 ignored issues
–
show
The function
mapi_stream_commit was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
993 | } |
||||||
994 | |||||||
995 | mapi_savechanges($outgoing); |
||||||
996 | mapi_message_submitmessage($outgoing); |
||||||
0 ignored issues
–
show
The function
mapi_message_submitmessage was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
997 | |||||||
998 | return true; |
||||||
999 | } |
||||||
1000 | |||||||
1001 | public function getDefaultStore() { |
||||||
1002 | $table = mapi_getmsgstorestable($this->session); |
||||||
0 ignored issues
–
show
The function
mapi_getmsgstorestable was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
1003 | $rows = mapi_table_queryallrows($table, [PR_DEFAULT_STORE, PR_ENTRYID]); |
||||||
0 ignored issues
–
show
The function
mapi_table_queryallrows was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
1004 | |||||||
1005 | foreach ($rows as $row) { |
||||||
1006 | if ($row[PR_DEFAULT_STORE]) { |
||||||
1007 | return mapi_openmsgstore($this->session, $row[PR_ENTRYID]); |
||||||
0 ignored issues
–
show
The function
mapi_openmsgstore was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
1008 | } |
||||||
1009 | } |
||||||
1010 | |||||||
1011 | return false; |
||||||
1012 | } |
||||||
1013 | |||||||
1014 | /** |
||||||
1015 | * Creates a new TaskGlobalObjId. |
||||||
1016 | * |
||||||
1017 | * Just 16 bytes of random data |
||||||
1018 | */ |
||||||
1019 | public function createTGOID(): string { |
||||||
1020 | $goid = ""; |
||||||
1021 | for ($i = 0; $i < 16; ++$i) { |
||||||
1022 | $goid .= chr(rand(0, 255)); |
||||||
1023 | } |
||||||
1024 | |||||||
1025 | return $goid; |
||||||
1026 | } |
||||||
1027 | |||||||
1028 | /** |
||||||
1029 | * Gets the embedded task of task request. Further used to |
||||||
1030 | * create/update associated task of assigner/assignee. |
||||||
1031 | * |
||||||
1032 | * @return bool|resource embedded task if found else false |
||||||
1033 | */ |
||||||
1034 | public function getEmbeddedTask() { |
||||||
1035 | $task = false; |
||||||
1036 | $goid = mapi_getprops($this->message, [$this->props["task_goid"]]); |
||||||
0 ignored issues
–
show
The function
mapi_getprops was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
1037 | $attachmentTable = mapi_message_getattachmenttable($this->message); |
||||||
0 ignored issues
–
show
The function
mapi_message_getattachmenttable was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
1038 | $restriction = [RES_PROPERTY, |
||||||
1039 | [RELOP => RELOP_EQ, |
||||||
1040 | ULPROPTAG => PR_ATTACH_METHOD, |
||||||
0 ignored issues
–
show
|
|||||||
1041 | VALUE => ATTACH_EMBEDDED_MSG, ], |
||||||
1042 | ]; |
||||||
1043 | $rows = mapi_table_queryallrows($attachmentTable, [PR_ATTACH_NUM], $restriction); |
||||||
0 ignored issues
–
show
The function
mapi_table_queryallrows was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
1044 | |||||||
1045 | if (empty($rows)) { |
||||||
1046 | return $task; |
||||||
1047 | } |
||||||
1048 | |||||||
1049 | foreach ($rows as $row) { |
||||||
1050 | try { |
||||||
1051 | $attach = mapi_message_openattach($this->message, $row[PR_ATTACH_NUM]); |
||||||
0 ignored issues
–
show
The function
mapi_message_openattach was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
1052 | $task = mapi_attach_openobj($attach); |
||||||
0 ignored issues
–
show
The function
mapi_attach_openobj was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
1053 | } |
||||||
1054 | catch (MAPIException $e) { |
||||||
1055 | continue; |
||||||
1056 | } |
||||||
1057 | |||||||
1058 | $taskGoid = mapi_getprops($task, [$this->props["task_goid"]]); |
||||||
1059 | if ($goid[$this->props["task_goid"]] === $taskGoid[$this->props["task_goid"]]) { |
||||||
1060 | mapi_setprops($attach, [PR_ATTACHMENT_HIDDEN => true]); |
||||||
0 ignored issues
–
show
The function
mapi_setprops was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
1061 | mapi_savechanges($attach); |
||||||
0 ignored issues
–
show
The function
mapi_savechanges was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
1062 | mapi_savechanges($this->message); |
||||||
1063 | break; |
||||||
1064 | } |
||||||
1065 | } |
||||||
1066 | |||||||
1067 | return $task; |
||||||
1068 | } |
||||||
1069 | |||||||
1070 | /** |
||||||
1071 | * Sets the user name who has last used this task. Update the |
||||||
1072 | * tasklastdelegate and task_assigned_time. |
||||||
1073 | */ |
||||||
1074 | public function setLastUser(): void { |
||||||
1075 | $delegatestore = $this->getDefaultStore(); |
||||||
1076 | $taskstore = $this->getTaskFolderStore(); |
||||||
1077 | |||||||
1078 | $delegateprops = mapi_getprops($delegatestore, [PR_MAILBOX_OWNER_NAME]); |
||||||
0 ignored issues
–
show
The function
mapi_getprops was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
1079 | $taskprops = mapi_getprops($taskstore, [PR_MAILBOX_OWNER_NAME]); |
||||||
1080 | |||||||
1081 | // The owner of the task |
||||||
1082 | $username = $delegateprops[PR_MAILBOX_OWNER_NAME]; |
||||||
1083 | // This is me (the one calling the script) |
||||||
1084 | $delegate = $taskprops[PR_MAILBOX_OWNER_NAME]; |
||||||
1085 | |||||||
1086 | if ($this->isTaskRequest()) { |
||||||
1087 | $task = $this->getAssociatedTask(false); |
||||||
1088 | mapi_setprops($task, [ |
||||||
0 ignored issues
–
show
The function
mapi_setprops was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
1089 | $this->props["tasklastuser"] => $username, |
||||||
1090 | $this->props["tasklastdelegate"] => $delegate, |
||||||
1091 | $this->props['task_assigned_time'] => time(), |
||||||
1092 | ]); |
||||||
1093 | mapi_savechanges($task); |
||||||
0 ignored issues
–
show
The function
mapi_savechanges was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
1094 | } |
||||||
1095 | mapi_setprops($this->message, [ |
||||||
1096 | $this->props["tasklastuser"] => $username, |
||||||
1097 | $this->props["tasklastdelegate"] => $delegate, |
||||||
1098 | $this->props['task_assigned_time'] => time(), |
||||||
1099 | ]); |
||||||
1100 | } |
||||||
1101 | |||||||
1102 | /** |
||||||
1103 | * Sets assignee as owner in the assignor's copy of task. |
||||||
1104 | * Assignee becomes the owner when a user/assignor assigns any task to someone. |
||||||
1105 | * There can be more than one assignee. |
||||||
1106 | */ |
||||||
1107 | public function setOwnerForAssignor(): void { |
||||||
1108 | $recipTable = mapi_message_getrecipienttable($this->message); |
||||||
0 ignored issues
–
show
The function
mapi_message_getrecipienttable was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
1109 | $recips = mapi_table_queryallrows($recipTable, [PR_DISPLAY_NAME]); |
||||||
0 ignored issues
–
show
The function
mapi_table_queryallrows was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
1110 | |||||||
1111 | if (!empty($recips)) { |
||||||
1112 | $owner = []; |
||||||
1113 | foreach ($recips as $value) { |
||||||
1114 | $owner[] = $value[PR_DISPLAY_NAME]; |
||||||
1115 | } |
||||||
1116 | |||||||
1117 | $props = [$this->props['owner'] => implode("; ", $owner)]; |
||||||
1118 | mapi_setprops($this->message, $props); |
||||||
0 ignored issues
–
show
The function
mapi_setprops was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
1119 | } |
||||||
1120 | } |
||||||
1121 | |||||||
1122 | /** |
||||||
1123 | * Sets assignor as recipients in assignee's copy of task. |
||||||
1124 | * |
||||||
1125 | * If assignor has requested task updates then the assignor is added as recipient type MAPI_CC. |
||||||
1126 | * |
||||||
1127 | * Also if assignor has request SOC then the assignor is also add as recipient type MAPI_BCC |
||||||
1128 | * |
||||||
1129 | * @param mixed $task assignee's copy of task |
||||||
1130 | */ |
||||||
1131 | public function setAssignorInRecipients($task): void { |
||||||
1132 | $recipTable = mapi_message_getrecipienttable($task); |
||||||
0 ignored issues
–
show
The function
mapi_message_getrecipienttable was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
1133 | |||||||
1134 | // Delete all MAPI_TO recipients |
||||||
1135 | $recips = mapi_table_queryallrows($recipTable, [PR_ROWID], [ |
||||||
0 ignored issues
–
show
The function
mapi_table_queryallrows was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
1136 | RES_PROPERTY, |
||||||
1137 | [ |
||||||
1138 | RELOP => RELOP_EQ, |
||||||
1139 | ULPROPTAG => PR_RECIPIENT_TYPE, |
||||||
0 ignored issues
–
show
|
|||||||
1140 | VALUE => MAPI_TO, |
||||||
1141 | ], |
||||||
1142 | ]); |
||||||
1143 | foreach ($recips as $recip) { |
||||||
1144 | mapi_message_modifyrecipients($task, MODRECIP_REMOVE, [$recip]); |
||||||
0 ignored issues
–
show
The function
mapi_message_modifyrecipients was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
1145 | } |
||||||
1146 | |||||||
1147 | $recips = []; |
||||||
1148 | $taskReqProps = mapi_getprops($this->message, [ |
||||||
0 ignored issues
–
show
The function
mapi_getprops was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
1149 | PR_SENT_REPRESENTING_NAME, |
||||||
0 ignored issues
–
show
|
|||||||
1150 | PR_SENT_REPRESENTING_EMAIL_ADDRESS, |
||||||
0 ignored issues
–
show
|
|||||||
1151 | PR_SENT_REPRESENTING_ENTRYID, |
||||||
0 ignored issues
–
show
|
|||||||
1152 | PR_SENT_REPRESENTING_ADDRTYPE, |
||||||
0 ignored issues
–
show
|
|||||||
1153 | PR_SENT_REPRESENTING_SEARCH_KEY, |
||||||
0 ignored issues
–
show
|
|||||||
1154 | ]); |
||||||
1155 | $associatedTaskProps = mapi_getprops($task, [ |
||||||
1156 | $this->props['taskupdates'], |
||||||
1157 | $this->props['tasksoc'], |
||||||
1158 | $this->props['taskmultrecips'], |
||||||
1159 | ]); |
||||||
1160 | |||||||
1161 | // Build assignor info |
||||||
1162 | $assignor = [ |
||||||
1163 | PR_ENTRYID => $taskReqProps[PR_SENT_REPRESENTING_ENTRYID], |
||||||
1164 | PR_DISPLAY_NAME => $taskReqProps[PR_SENT_REPRESENTING_NAME], |
||||||
0 ignored issues
–
show
|
|||||||
1165 | PR_EMAIL_ADDRESS => $taskReqProps[PR_SENT_REPRESENTING_EMAIL_ADDRESS], |
||||||
0 ignored issues
–
show
|
|||||||
1166 | PR_RECIPIENT_DISPLAY_NAME => $taskReqProps[PR_SENT_REPRESENTING_NAME], |
||||||
0 ignored issues
–
show
|
|||||||
1167 | PR_ADDRTYPE => empty($taskReqProps[PR_SENT_REPRESENTING_ADDRTYPE]) ? 'SMTP' : $taskReqProps[PR_SENT_REPRESENTING_ADDRTYPE], |
||||||
0 ignored issues
–
show
|
|||||||
1168 | PR_RECIPIENT_FLAGS => recipSendable, |
||||||
0 ignored issues
–
show
|
|||||||
1169 | PR_SEARCH_KEY => $taskReqProps[PR_SENT_REPRESENTING_SEARCH_KEY], |
||||||
0 ignored issues
–
show
|
|||||||
1170 | ]; |
||||||
1171 | |||||||
1172 | // Assignor has requested task updates, so set him/her as MAPI_CC in recipienttable. |
||||||
1173 | if ((isset($associatedTaskProps[$this->props['taskupdates']]) && $associatedTaskProps[$this->props['taskupdates']]) && |
||||||
1174 | !(isset($associatedTaskProps[$this->props['taskmultrecips']]) && $associatedTaskProps[$this->props['taskmultrecips']] == tmrReceived)) { |
||||||
1175 | $assignor[PR_RECIPIENT_TYPE] = MAPI_CC; |
||||||
1176 | $recips[] = $assignor; |
||||||
1177 | } |
||||||
1178 | |||||||
1179 | // Assignor wants to receive an email report when task is mark as 'Complete', so in recipients as MAPI_BCC |
||||||
1180 | if ($associatedTaskProps[$this->props['tasksoc']]) { |
||||||
1181 | $assignor[PR_RECIPIENT_TYPE] = MAPI_BCC; |
||||||
1182 | $recips[] = $assignor; |
||||||
1183 | } |
||||||
1184 | |||||||
1185 | if (!empty($recips)) { |
||||||
1186 | mapi_message_modifyrecipients($task, MODRECIP_ADD, $recips); |
||||||
1187 | } |
||||||
1188 | } |
||||||
1189 | |||||||
1190 | /** |
||||||
1191 | * Deletes incoming task request from Inbox. |
||||||
1192 | * |
||||||
1193 | * @returns array|bool PR_ENTRYID, PR_STORE_ENTRYID and PR_PARENT_ENTRYID of the deleted task request |
||||||
1194 | * |
||||||
1195 | * @return array|false |
||||||
1196 | */ |
||||||
1197 | public function deleteReceivedTR() { |
||||||
1198 | $store = $this->getTaskFolderStore(); |
||||||
1199 | $storeType = mapi_getprops($store, [PR_MDB_PROVIDER]); |
||||||
0 ignored issues
–
show
The function
mapi_getprops was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
1200 | if ($storeType[PR_MDB_PROVIDER] === ZARAFA_STORE_PUBLIC_GUID) { |
||||||
1201 | $store = $this->getDefaultStore(); |
||||||
1202 | } |
||||||
1203 | $inbox = mapi_msgstore_getreceivefolder($store); |
||||||
0 ignored issues
–
show
The function
mapi_msgstore_getreceivefolder was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
1204 | |||||||
1205 | $storeProps = mapi_getprops($store, [PR_IPM_WASTEBASKET_ENTRYID]); |
||||||
0 ignored issues
–
show
|
|||||||
1206 | $props = mapi_getprops($this->message, [$this->props['task_goid']]); |
||||||
1207 | $goid = $props[$this->props['task_goid']]; |
||||||
1208 | |||||||
1209 | // Find the task by looking for the task_goid |
||||||
1210 | $restriction = [ |
||||||
1211 | RES_PROPERTY, |
||||||
1212 | [ |
||||||
1213 | RELOP => RELOP_EQ, |
||||||
1214 | ULPROPTAG => $this->props['task_goid'], |
||||||
1215 | VALUE => $goid, |
||||||
1216 | ], |
||||||
1217 | ]; |
||||||
1218 | |||||||
1219 | $contents = mapi_folder_getcontentstable($inbox); |
||||||
0 ignored issues
–
show
The function
mapi_folder_getcontentstable was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
1220 | |||||||
1221 | $rows = mapi_table_queryallrows($contents, [PR_ENTRYID, PR_PARENT_ENTRYID, PR_STORE_ENTRYID], $restriction); |
||||||
0 ignored issues
–
show
The function
mapi_table_queryallrows was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
1222 | |||||||
1223 | if (!empty($rows)) { |
||||||
1224 | // If there are multiple, just use the first |
||||||
1225 | $entryid = $rows[0][PR_ENTRYID]; |
||||||
1226 | $wastebasket = mapi_msgstore_openentry($store, $storeProps[PR_IPM_WASTEBASKET_ENTRYID]); |
||||||
0 ignored issues
–
show
The function
mapi_msgstore_openentry was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
1227 | mapi_folder_copymessages($inbox, [$entryid], $wastebasket, MESSAGE_MOVE); |
||||||
0 ignored issues
–
show
The function
mapi_folder_copymessages was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
1228 | |||||||
1229 | return [PR_ENTRYID => $entryid, PR_PARENT_ENTRYID => $rows[0][PR_PARENT_ENTRYID], PR_STORE_ENTRYID => $rows[0][PR_STORE_ENTRYID]]; |
||||||
1230 | } |
||||||
1231 | |||||||
1232 | return false; |
||||||
1233 | } |
||||||
1234 | |||||||
1235 | /** |
||||||
1236 | * Sets recipients for the outgoing message according to type of the response. |
||||||
1237 | * |
||||||
1238 | * If it is a task update, then only recipient type MAPI_CC are taken from the task message. |
||||||
1239 | * |
||||||
1240 | * If it is accept/decline response, then PR_SENT_REPRESENTATING_XXXX are taken as recipient. |
||||||
1241 | * |
||||||
1242 | * @param mixed $outgoing outgoing mapi message |
||||||
1243 | * @param int $responseType response type (tdmtTaskAcc, tdmtTaskDec, tdmtTaskUpd) |
||||||
1244 | */ |
||||||
1245 | public function setRecipientsForResponse($outgoing, $responseType): bool { |
||||||
1246 | // Clear recipients from outgoing msg |
||||||
1247 | $this->deleteAllRecipients($outgoing); |
||||||
1248 | |||||||
1249 | // If it is a task update then get MAPI_CC recipients which are assignors who has asked for task update. |
||||||
1250 | if ($responseType == tdmtTaskUpd) { |
||||||
1251 | $props = mapi_getprops($this->message, [$this->props['complete']]); |
||||||
0 ignored issues
–
show
The function
mapi_getprops was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
1252 | $isComplete = $props[$this->props['complete']]; |
||||||
1253 | |||||||
1254 | $recipTable = mapi_message_getrecipienttable($this->message); |
||||||
0 ignored issues
–
show
The function
mapi_message_getrecipienttable was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
1255 | $recips = mapi_table_queryallrows($recipTable, $this->recipProps, [ |
||||||
0 ignored issues
–
show
The function
mapi_table_queryallrows was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
1256 | RES_PROPERTY, |
||||||
1257 | [ |
||||||
1258 | RELOP => RELOP_EQ, |
||||||
1259 | ULPROPTAG => PR_RECIPIENT_TYPE, |
||||||
0 ignored issues
–
show
|
|||||||
1260 | VALUE => ($isComplete ? MAPI_BCC : MAPI_CC), |
||||||
1261 | ], |
||||||
1262 | ]); |
||||||
1263 | |||||||
1264 | // No recipients found, return error |
||||||
1265 | if (empty($recips)) { |
||||||
1266 | return false; |
||||||
1267 | } |
||||||
1268 | |||||||
1269 | foreach ($recips as $recip) { |
||||||
1270 | $recip[PR_RECIPIENT_TYPE] = MAPI_TO; // Change recipient type to MAPI_TO |
||||||
1271 | mapi_message_modifyrecipients($outgoing, MODRECIP_ADD, [$recip]); |
||||||
0 ignored issues
–
show
The function
mapi_message_modifyrecipients was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
1272 | } |
||||||
1273 | |||||||
1274 | return true; |
||||||
1275 | } |
||||||
1276 | |||||||
1277 | $orgprops = mapi_getprops($this->message, [ |
||||||
1278 | PR_SENT_REPRESENTING_NAME, |
||||||
0 ignored issues
–
show
|
|||||||
1279 | PR_SENT_REPRESENTING_EMAIL_ADDRESS, |
||||||
0 ignored issues
–
show
|
|||||||
1280 | PR_SENT_REPRESENTING_ADDRTYPE, |
||||||
0 ignored issues
–
show
|
|||||||
1281 | PR_SENT_REPRESENTING_ENTRYID, |
||||||
0 ignored issues
–
show
|
|||||||
1282 | PR_SUBJECT, |
||||||
0 ignored issues
–
show
|
|||||||
1283 | ]); |
||||||
1284 | |||||||
1285 | $recip = [ |
||||||
1286 | PR_DISPLAY_NAME => $orgprops[PR_SENT_REPRESENTING_NAME], |
||||||
0 ignored issues
–
show
|
|||||||
1287 | PR_EMAIL_ADDRESS => $orgprops[PR_SENT_REPRESENTING_EMAIL_ADDRESS], |
||||||
0 ignored issues
–
show
|
|||||||
1288 | PR_ADDRTYPE => $orgprops[PR_SENT_REPRESENTING_ADDRTYPE], |
||||||
0 ignored issues
–
show
|
|||||||
1289 | PR_ENTRYID => $orgprops[PR_SENT_REPRESENTING_ENTRYID], |
||||||
1290 | PR_RECIPIENT_TYPE => MAPI_TO, ]; |
||||||
1291 | |||||||
1292 | mapi_message_modifyrecipients($outgoing, MODRECIP_ADD, [$recip]); |
||||||
1293 | |||||||
1294 | return true; |
||||||
1295 | } |
||||||
1296 | |||||||
1297 | /** |
||||||
1298 | * Deletes all recipients from given message object. |
||||||
1299 | * |
||||||
1300 | * @param mixed $message MAPI message from which recipients are to be removed |
||||||
1301 | */ |
||||||
1302 | public function deleteAllRecipients($message): void { |
||||||
1303 | $recipTable = mapi_message_getrecipienttable($message); |
||||||
0 ignored issues
–
show
The function
mapi_message_getrecipienttable was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
1304 | $recipRows = mapi_table_queryallrows($recipTable, [PR_ROWID]); |
||||||
0 ignored issues
–
show
The function
mapi_table_queryallrows was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
1305 | |||||||
1306 | foreach ($recipRows as $recipient) { |
||||||
1307 | mapi_message_modifyrecipients($message, MODRECIP_REMOVE, [$recipient]); |
||||||
0 ignored issues
–
show
The function
mapi_message_modifyrecipients was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
1308 | } |
||||||
1309 | } |
||||||
1310 | |||||||
1311 | /** |
||||||
1312 | * Marks the record to complete and send complete update |
||||||
1313 | * notification to assigner. |
||||||
1314 | * |
||||||
1315 | * @return bool TRUE if the update succeeded, FALSE otherwise |
||||||
1316 | */ |
||||||
1317 | public function sendCompleteUpdate() { |
||||||
1318 | $messageprops = mapi_getprops($this->message, [$this->props['taskstate']]); |
||||||
0 ignored issues
–
show
The function
mapi_getprops was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
1319 | |||||||
1320 | if (!isset($messageprops[$this->props['taskstate']]) || $messageprops[$this->props['taskstate']] != tdsOWN) { |
||||||
1321 | return false; // Can only decline assignee task |
||||||
1322 | } |
||||||
1323 | |||||||
1324 | mapi_setprops($this->message, [ |
||||||
0 ignored issues
–
show
The function
mapi_setprops was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
1325 | $this->props['complete'] => true, |
||||||
1326 | $this->props['datecompleted'] => time(), |
||||||
1327 | $this->props['status'] => 2, |
||||||
1328 | $this->props['percent_complete'] => 1, |
||||||
1329 | ]); |
||||||
1330 | |||||||
1331 | return $this->doUpdate(); |
||||||
1332 | } |
||||||
1333 | |||||||
1334 | /** |
||||||
1335 | * Returns extra info about task request comments along with message body |
||||||
1336 | * which will be included in body while sending task request/response. |
||||||
1337 | * |
||||||
1338 | * @return string info about task request comments along with message body |
||||||
1339 | */ |
||||||
1340 | public function getTaskCommentsInfo() { |
||||||
1341 | return $this->taskCommentsInfo; |
||||||
1342 | } |
||||||
1343 | |||||||
1344 | /** |
||||||
1345 | * Sets an extra info about task request comments along with message body |
||||||
1346 | * which will be included in body while sending task request/response. |
||||||
1347 | * |
||||||
1348 | * @param string $taskCommentsInfo info about task request comments along with message body |
||||||
1349 | */ |
||||||
1350 | public function setTaskCommentsInfo($taskCommentsInfo): void { |
||||||
1351 | $this->taskCommentsInfo = $taskCommentsInfo; |
||||||
1352 | } |
||||||
1353 | |||||||
1354 | public function getSubProperties() { |
||||||
1355 | $subProperties = []; |
||||||
1356 | $subProperties["subject"] = PR_SUBJECT; |
||||||
0 ignored issues
–
show
|
|||||||
1357 | $subProperties["convtopic"] = PR_CONVERSATION_TOPIC; |
||||||
0 ignored issues
–
show
|
|||||||
1358 | $subProperties["complete"] = "PT_BOOLEAN:PSETID_Task:" . PidLidTaskComplete; |
||||||
0 ignored issues
–
show
|
|||||||
1359 | $subProperties["datecompleted"] = "PT_SYSTIME:PSETID_Task:" . PidLidTaskDateCompleted; |
||||||
0 ignored issues
–
show
|
|||||||
1360 | $subProperties["recurring"] = "PT_BOOLEAN:PSETID_Task:0x8126"; |
||||||
1361 | $subProperties["startdate"] = "PT_SYSTIME:PSETID_Task:" . PidLidTaskStartDate; |
||||||
0 ignored issues
–
show
|
|||||||
1362 | $subProperties["duedate"] = "PT_SYSTIME:PSETID_Task:" . PidLidTaskDueDate; |
||||||
0 ignored issues
–
show
|
|||||||
1363 | $subProperties["status"] = "PT_LONG:PSETID_Task:" . PidLidTaskStatus; |
||||||
0 ignored issues
–
show
|
|||||||
1364 | $subProperties["percent_complete"] = "PT_DOUBLE:PSETID_Task:" . PidLidPercentComplete; |
||||||
0 ignored issues
–
show
|
|||||||
1365 | $subProperties["totalwork"] = "PT_LONG:PSETID_Task:0x8111"; |
||||||
1366 | $subProperties["actualwork"] = "PT_LONG:PSETID_Task:0x8110"; |
||||||
1367 | $subProperties["categories"] = "PT_MV_STRING8:PS_PUBLIC_STRINGS:Keywords"; |
||||||
1368 | $subProperties["companies"] = "PT_MV_STRING8:PSETID_Common:0x8539"; |
||||||
1369 | $subProperties["mileage"] = "PT_STRING8:PSETID_Common:0x8534"; |
||||||
1370 | $subProperties["billinginformation"] = "PT_STRING8:PSETID_Common:0x8535"; |
||||||
1371 | |||||||
1372 | return getPropIdsFromStrings($this->store, $subProperties); |
||||||
1373 | } |
||||||
1374 | } |
||||||
1375 |