From 91337ce1c89cd88950b9122889e3248d1b9c3e5a Mon Sep 17 00:00:00 2001
From: Mikhail Grebenkin <mix@m14xa.ru>
Date: Fri, 21 Aug 2020 13:55:46 +0300
Subject: [PATCH] updated some

---
 redmine.php |  2 +-
 tester.php  | 30 ++++++++++++++++++------------
 2 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/redmine.php b/redmine.php
index db0d46e..164cec7 100644
--- a/redmine.php
+++ b/redmine.php
@@ -243,7 +243,7 @@ class class_redmine {
     * create_ticket creates issue with connected contact. Needs contact email.
     *
     * @param string $issue_id digits only issue id
-    * @param string $contact_id digits only contact id
+    * @param string $contact_email contact email
     * @return mixed array 0 => http response, 1 => $issue - new data
     */
     function create_ticket(string $contact_email, string $subject, string $description) {
diff --git a/tester.php b/tester.php
index ef98c60..ac41e5f 100644
--- a/tester.php
+++ b/tester.php
@@ -196,7 +196,7 @@ $res = $obj_redmine->get_contact_id("3373", true);
           ["name"]=> string(45) "Пользовательские тикеты"
         }
       }
-      ["issues"]=> array(1) {
+      ["issues"]=> array(1) { // список задач, привязанных к контакту
         [0]=>  object(stdClass)#30 (6) {
           ["id"]=> int(10442)
           ["subject"]=> string(21) "testing testing again"
@@ -215,8 +215,8 @@ $res = $obj_redmine->get_contact_id("3373", true);
 */
 
 
-// для создания тикета можно воспользоваться:
-// поиск контакта - только по e-mail
+// для создания тикета create_ticket()
+// поиск контакта - только по e-mail клиента (текущего контакта)
 $res = $obj_redmine->create_ticket("besco@yabesco.ru", "One more test", "test test one more");
 // var_dump($res);
 /*
@@ -226,26 +226,32 @@ $res = $obj_redmine->create_ticket("besco@yabesco.ru", "One more test", "test te
 }
 */
 
-// работа с файлами
-//$filecontent = file_get_contents("screenshot.png");
-//$token = $obj_redmine->get_upload_token($filecontent);
+// работа с вложениями
+
+// закачать вложение, получив обратно токен
+// $filecontent = file_get_contents("screenshot.png");
+// $token = $obj_redmine->get_upload_token($filecontent);
 
 //$token = $token->upload->token;
 
 //var_dump($token);
 
+// закачать вложение, сразу прикрепить к issue (тикет)
 //$filecontent = file_get_contents("screenshot.png");
+// $res = $obj_redmine->upload_attachment('10314', 'screenshot.png', 'image/png', $filecontent);
+// var_dump($res);
 
-// echo($obj_redmine->upload_attachment('10314', 'screenshot.png', 'image/png', $filecontent));
-
-//$inc = array( 0 => "journals",
-//              1 => "attachments"
-//            );
+// получить issue с журналом и вложениями
+// $inc = array( 0 => "journals",
+//               1 => "attachments"
+//             );
 
 //$res = $obj_redmine->get_issue('10314', '', $inc);
 //var_dump($res);
 
-//$res = $obj_redmine->download_attachment('5152', true);
+// получить прикрепленное вложение
+//  $thumbnail - если true, то выкачается эскиз.
+// $res = $obj_redmine->download_attachment('5152', true);
 //file_put_contents('screenshot_eskiz.png', $res);
 
 ?>
\ No newline at end of file