Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $issues = [];
- if (($handle = fopen("tickets.csv", "r")) !== FALSE) {
- $header = fgetcsv($handle);
- while (($data = fgetcsv($handle)) !== FALSE) {
- $row = array_combine($header, $data);
- $content = $row['description'];
- if ($row['echanges']) {
- $content .= "\n\n échanges:\n".$row['echanges'];
- }
- $created_on = str_replace(' ', 'T', $row['dateticket']);
- $issues[] = [
- "status" => 2 === (int) $row['Evaluation'] ? "new" : "open",
- "priority" => "major",
- "kind" => "bug",
- "content_updated_on" => null,
- "voters" => [],
- "title" => $row['titre'],
- "reporter" => [
- "display_name" => "Paul de Rosanbo",
- "account_id" => "557058:c53221b1-312c-4b51-b2db-a43a0385fb04"
- ],
- "component" => null,
- "watchers" => [
- [
- "display_name" => "Paul de Rosanbo",
- "account_id" => "557058:c53221b1-312c-4b51-b2db-a43a0385fb04"
- ]
- ],
- "content" => $content,
- "assignee" => [
- "display_name" => "Paul de Rosanbo",
- "account_id" => "557058:c53221b1-312c-4b51-b2db-a43a0385fb04"
- ],
- "created_on" => $created_on.".000000+00:00",
- "version" => null,
- "edited_on" => null,
- "milestone" => null,
- "updated_on" => "2019-04-15T12:21:17.636133+00:00",
- "id" => (int) substr($row['reference'], 1)
- ];
- }
- fclose($handle);
- }
- echo json_encode([
- "milestones" => [],
- "attachments" => [],
- "versions" => [],
- "comments" => [],
- "meta" => [
- "default_milestone" => null,
- "default_assignee" => null,
- "default_kind" => "bug",
- "default_component" => null,
- "default_version" => null
- ],
- "components" => [],
- "issues" => $issues,
- "logs" => []
- ], JSON_PRETTY_PRINT);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement