From be6b82fda1299bd86d0c3a90e29c9b4fc4e8aae7 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 27 Mar 2019 15:50:38 +0100 Subject: [PATCH] improved VAT history + updated changelog + added instruction on watermark localisation --- CHANGELOG.md | 8 ++- README.md | 4 ++ .../controllers/admin/invoices.js.erb | 25 ++++++-- app/assets/stylesheets/modules/invoice.scss | 60 ++++++++++--------- .../templates/admin/invoices/index.html.erb | 15 +++-- 5 files changed, 73 insertions(+), 39 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 81df1d98b..f09380ad8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ # Changelog Fab Manager - (France) Compliance with Article 88 of Law No. 2015-1785 and BOI-TVA-DECLA-30-10-30-20160803 : Certification of cash systems +- Ability for an admin to view and close accounting periods +- Secured archives for close accounting periods +- Securely chained invoices records with visual control of data integrity +- Notify an user if the available disk space reaches a configured threshold +- Invoices generated outside of production environment will be watermarked +- Keep track of currently logged user on each generated invoice - Fix a security issue: updated to devise 4.6.0 to fix [CVE-2019-5421](https://github.com/plataformatec/devise/issues/4981) - Fix a security issue: updated Rails to 4.2.11.1 to fix [CVE-2019-5418](https://groups.google.com/forum/#!topic/rubyonrails-security/pFRKI96Sm8Q) and [CVE-2019-5419](https://groups.google.com/forum/#!topic/rubyonrails-security/GN7w9fFAQeI) - Removed deprecated Capistrano deployment system @@ -8,7 +14,7 @@ - Refactored some pieces of Ruby code, according to style guide - Added asterisks on required fields in sign-up form - [TODO DEPLOY] (dev) if applicable, you must first downgrade bundler to v1 `gem uninstall bundler --version=2.0.1 && gem install bundler --version=1.7.3 && bundle install` -- [TODO DEPLOY] if applicable, add VAT history into database `rake fablab:setup:add_vat_rate[20,2017-01-01]` +- [TODO DEPLOY] if you have changed your VAT rate in the past, add its history into database. You can use a rate of "0" to disable VAT. Eg. `rake fablab:setup:add_vat_rate[20,2017-01-01]` - [TODO DEPLOY] `rake fablab:setup:set_environment_to_invoices` - [TODO DEPLOY] `rake fablab:setup:chain_invoices_items_records` - [TODO DEPLOY] `rake fablab:setup:chain_invoices_records` diff --git a/README.md b/README.md index 17669017e..18df6834c 100644 --- a/README.md +++ b/README.md @@ -445,6 +445,10 @@ In each cases, some inline comments are included in the localisation files. They can be recognized as they start with the sharp character (#). These comments are not required to be translated, they are intended to help the translator to have some context information about the sentence to translate. +You will also need to translate the invoice watermark, located in `app/pdfs/data/`. +You'll find there the [GIMP source of the image](app/pdfs/data/watermark.xcf), which is using [Rubik Mono One](https://fonts.google.com/specimen/Rubik+Mono+One) as font. +Use it to generate a similar localised PNG image which keep the default image size, as PDF are not responsive. + ### Configuration diff --git a/app/assets/javascripts/controllers/admin/invoices.js.erb b/app/assets/javascripts/controllers/admin/invoices.js.erb index d3a3d6da2..980153576 100644 --- a/app/assets/javascripts/controllers/admin/invoices.js.erb +++ b/app/assets/javascripts/controllers/admin/invoices.js.erb @@ -303,17 +303,34 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I active () { return $scope.invoice.VAT.active; }, - history () { + rateHistory () { return Setting.get({ name: 'invoice_VAT-rate', history: true }).$promise; + }, + activeHistory () { + return Setting.get({ name: 'invoice_VAT-active', history: true }).$promise; } }, - controller: ['$scope', '$uibModalInstance', 'rate', 'active', 'history', function ($scope, $uibModalInstance, rate, active, history) { + controller: ['$scope', '$uibModalInstance', 'rate', 'active', 'rateHistory', 'activeHistory', function ($scope, $uibModalInstance, rate, active, rateHistory, activeHistory) { $scope.rate = rate; $scope.isSelected = active; - $scope.history = history.setting.history; + $scope.history = []; $scope.ok = function () { $uibModalInstance.close({ rate: $scope.rate, active: $scope.isSelected }); }; - return $scope.cancel = function () { $uibModalInstance.dismiss('cancel'); }; + $scope.cancel = function () { $uibModalInstance.dismiss('cancel'); }; + + + const initialize = function() { + rateHistory.setting.history.forEach(function (rate) { + $scope.history.push({ date: rate.created_at, rate: rate.value, user: rate.user }) + }); + activeHistory.setting.history.forEach(function (v) { + if (v.value === 'false') { + $scope.history.push({ date: v.created_at, rate: 0, user: v.user }) + } + }); + } + + initialize(); }] }); diff --git a/app/assets/stylesheets/modules/invoice.scss b/app/assets/stylesheets/modules/invoice.scss index c76350dd9..9c36c3b1f 100644 --- a/app/assets/stylesheets/modules/invoice.scss +++ b/app/assets/stylesheets/modules/invoice.scss @@ -195,6 +195,38 @@ table.closings-table { + @extend table.scrollable-3-cols; + + tbody .actions { + padding-left: 2em; + + & > span { + margin-left: 2em; + cursor: pointer; + } + } + + tbody .show-more { + color: #00b3ee; + } + + tbody .download-archive { + width: 32px; + height: 32px; + } + + tbody .download-archive:hover { + i { + display: none; + } + &:after { + content: '\f019'; + font-family: 'fontawesome'; + } + } +} + +table.scrollable-3-cols { width: 100%; border-spacing: 0; @@ -230,34 +262,6 @@ table.closings-table { width: 32%; /* 32% is less than (100% / 3 cols) = 33.33% */ float: left; } - - tbody .actions { - padding-left: 2em; - - & > span { - margin-left: 2em; - cursor: pointer; - } - } - - tbody .show-more { - color: #00b3ee; - } - - tbody .download-archive { - width: 32px; - height: 32px; - } - - tbody .download-archive:hover { - i { - display: none; - } - &:after { - content: '\f019'; - font-family: 'fontawesome'; - } - } } diff --git a/app/assets/templates/admin/invoices/index.html.erb b/app/assets/templates/admin/invoices/index.html.erb index 354509230..2ff43d5ba 100644 --- a/app/assets/templates/admin/invoices/index.html.erb +++ b/app/assets/templates/admin/invoices/index.html.erb @@ -396,18 +396,21 @@

{{ 'invoices.VAT_history' }}

- - +
+ - + - - - + + +
{{ 'invoices.VAT_rate' }} {{ 'invoices.changed_at' }} {{ 'invoices.changed_by' }}
{{value.value}} %{{value.created_at | amDateFormat:'L LT'}}
+ {{'invoices.VAT_disabled'}} + {{value.rate}} + {{value.date | amDateFormat:'L LT'}} {{value.user.name}}{{ 'invoices.deleted_user' }}