Advertisement
Guest User

Untitled

a guest
Apr 25th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.99 KB | None | 0 0
  1. <?php
  2.  
  3. $issues = [];
  4.  
  5. if (($handle = fopen("tickets.csv", "r")) !== FALSE) {
  6. $header = fgetcsv($handle);
  7. while (($data = fgetcsv($handle)) !== FALSE) {
  8. $row = array_combine($header, $data);
  9.  
  10. $content = $row['description'];
  11. if ($row['echanges']) {
  12. $content .= "\n\n échanges:\n".$row['echanges'];
  13. }
  14.  
  15. $created_on = str_replace(' ', 'T', $row['dateticket']);
  16.  
  17. $issues[] = [
  18. "status" => 2 === (int) $row['Evaluation'] ? "new" : "open",
  19. "priority" => "major",
  20. "kind" => "bug",
  21. "content_updated_on" => null,
  22. "voters" => [],
  23. "title" => $row['titre'],
  24. "reporter" => [
  25. "display_name" => "Paul de Rosanbo",
  26. "account_id" => "557058:c53221b1-312c-4b51-b2db-a43a0385fb04"
  27. ],
  28. "component" => null,
  29. "watchers" => [
  30. [
  31. "display_name" => "Paul de Rosanbo",
  32. "account_id" => "557058:c53221b1-312c-4b51-b2db-a43a0385fb04"
  33. ]
  34. ],
  35. "content" => $content,
  36. "assignee" => [
  37. "display_name" => "Paul de Rosanbo",
  38. "account_id" => "557058:c53221b1-312c-4b51-b2db-a43a0385fb04"
  39. ],
  40. "created_on" => $created_on.".000000+00:00",
  41. "version" => null,
  42. "edited_on" => null,
  43. "milestone" => null,
  44. "updated_on" => "2019-04-15T12:21:17.636133+00:00",
  45. "id" => (int) substr($row['reference'], 1)
  46. ];
  47. }
  48. fclose($handle);
  49. }
  50.  
  51. echo json_encode([
  52. "milestones" => [],
  53. "attachments" => [],
  54. "versions" => [],
  55. "comments" => [],
  56. "meta" => [
  57. "default_milestone" => null,
  58. "default_assignee" => null,
  59. "default_kind" => "bug",
  60. "default_component" => null,
  61. "default_version" => null
  62. ],
  63. "components" => [],
  64. "issues" => $issues,
  65. "logs" => []
  66. ], JSON_PRETTY_PRINT);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement