Commit f1974a22372a1c19d724a725b96fd37f09e52c17
1 parent
0b7628df
Updated the email function to cater for more than one document
Committed by: Tohir Solomons
Showing
1 changed file
with
18 additions
and
7 deletions
webservice/clienttools/services/0.9/kt.php
| @@ -1058,17 +1058,24 @@ Fatal error: Cannot unset string offsets in on line 981 | @@ -1058,17 +1058,24 @@ Fatal error: Cannot unset string offsets in on line 981 | ||
| 1058 | } | 1058 | } |
| 1059 | } | 1059 | } |
| 1060 | 1060 | ||
| 1061 | - $document = $kt->get_document_by_id ( $params ['document'] ); | 1061 | + |
| 1062 | if (count ( $recipientsList ) == 0) { | 1062 | if (count ( $recipientsList ) == 0) { |
| 1063 | $this->setResponse ( array ('status' => 'norecipients' ) ); | 1063 | $this->setResponse ( array ('status' => 'norecipients' ) ); |
| 1064 | return false; | 1064 | return false; |
| 1065 | } else { | 1065 | } else { |
| 1066 | - $result = $document->email ( $recipientsList, $message, TRUE ); // true to attach document | ||
| 1067 | - if (PEAR::isError ( $result )) { | ||
| 1068 | - $this->setResponse ( array ('status' => $result->getMessage () ) ); | ||
| 1069 | - ; | ||
| 1070 | - return false; | 1066 | + |
| 1067 | + foreach ($params ['documents'] as $documentId) | ||
| 1068 | + { | ||
| 1069 | + $document = $kt->get_document_by_id ( $documentId ); | ||
| 1070 | + | ||
| 1071 | + | ||
| 1072 | + $result = $document->email ( $recipientsList, $message, TRUE ); // true to attach document | ||
| 1073 | + if (PEAR::isError ( $result )) { | ||
| 1074 | + $this->setResponse ( array ('status' => $result->getMessage () ) ); | ||
| 1075 | + return false; | ||
| 1076 | + } | ||
| 1071 | } | 1077 | } |
| 1078 | + | ||
| 1072 | $this->setResponse ( array ('status' => 'documentemailed' ) ); | 1079 | $this->setResponse ( array ('status' => 'documentemailed' ) ); |
| 1073 | } | 1080 | } |
| 1074 | return true; | 1081 | return true; |
| @@ -1269,7 +1276,7 @@ Fatal error: Cannot unset string offsets in on line 981 | @@ -1269,7 +1276,7 @@ Fatal error: Cannot unset string offsets in on line 981 | ||
| 1269 | } | 1276 | } |
| 1270 | 1277 | ||
| 1271 | 1278 | ||
| 1272 | - function addFolderToList(&$listing, $path) | 1279 | + private function addFolderToList(&$listing, $path) |
| 1273 | { | 1280 | { |
| 1274 | if (!in_array($path, $this->listOfFoldersToBeCreated)) { | 1281 | if (!in_array($path, $this->listOfFoldersToBeCreated)) { |
| 1275 | $this->listOfFoldersToBeCreated[] = $path; | 1282 | $this->listOfFoldersToBeCreated[] = $path; |
| @@ -1334,6 +1341,10 @@ Fatal error: Cannot unset string offsets in on line 981 | @@ -1334,6 +1341,10 @@ Fatal error: Cannot unset string offsets in on line 981 | ||
| 1334 | $this->setResponse ( array ('status_code' => 0, 'maxsize' => $max_upload_size ) ); | 1341 | $this->setResponse ( array ('status_code' => 0, 'maxsize' => $max_upload_size ) ); |
| 1335 | return true; | 1342 | return true; |
| 1336 | } | 1343 | } |
| 1344 | + | ||
| 1345 | + | ||
| 1346 | + | ||
| 1347 | + | ||
| 1337 | } | 1348 | } |
| 1338 | 1349 | ||
| 1339 | 1350 |