diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a0eaf1..12a2357 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## 1.0.1 - 2019-03-06 + +### Changed +- Changed `league/csv` dependency to not crash with other plugins + +### Fixed +- Fixed error when creating new report + ## 1.0.0 - 2019-03-05 ### Added - Initial release diff --git a/README.md b/README.md index 313a2f4..e792fb5 100644 --- a/README.md +++ b/README.md @@ -107,6 +107,7 @@ Some things to do, and ideas for potential features: - [ ] Template helpers - [ ] Document helpers - [ ] Report sources (think Slack slash command or CraftQL) +- [ ] Screenshots - [x] Permissions (Create, View, Export, Run, Delete) Brought to you by [Superbig](https://superbig.co) diff --git a/composer.json b/composer.json index 0ae57a1..55fcbc3 100644 --- a/composer.json +++ b/composer.json @@ -2,13 +2,16 @@ "name": "superbig/craft-reports", "description": "Write reports with Twig.", "type": "craft-plugin", - "version": "1.0.0", + "version": "1.0.1", "keywords": [ "craft", "cms", "craftcms", "craft-plugin", - "reports" + "reports", + "reporting", + "report", + "commerce reporting" ], "support": { "docs": "https://github.com/superbigco/craft-reports/blob/master/README.md", @@ -23,7 +26,7 @@ ], "require": { "craftcms/cms": "^3.0.0", - "league/csv": "^8.1" + "league/csv": "^8.1|^9.0" }, "autoload": { "psr-4": { diff --git a/src/services/Export.php b/src/services/Export.php index 5affc67..792f1c8 100644 --- a/src/services/Export.php +++ b/src/services/Export.php @@ -45,8 +45,10 @@ public function csv(\superbig\reports\models\Report $report) $csv->insertAll($result->getContent()); } + // @todo Remove this once all plugins is using 9.0 + $content = method_exists($csv, 'getContent') ? $csv->getContent() : (string)$csv; $mimeType = 'text/csv'; - $path = $this->_write((string)$csv, $filename, $mimeType); + $path = $this->_write($content, $filename, $mimeType); return [ 'filename' => $filename, diff --git a/src/services/Report.php b/src/services/Report.php index 948ddca..3bcd111 100644 --- a/src/services/Report.php +++ b/src/services/Report.php @@ -163,6 +163,8 @@ public function saveReport(ReportModel $report): bool try { $record->save(false); $transaction->commit(); + + $report->id = $record->id; } catch (\Exception $e) { $transaction->rollBack();