Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sjelfull committed Mar 6, 2019
1 parent 84940db commit 0a2c9d7
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 4 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
9 changes: 6 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -23,7 +26,7 @@
],
"require": {
"craftcms/cms": "^3.0.0",
"league/csv": "^8.1"
"league/csv": "^8.1|^9.0"
},
"autoload": {
"psr-4": {
Expand Down
4 changes: 3 additions & 1 deletion src/services/Export.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions src/services/Report.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit 0a2c9d7

Please sign in to comment.