1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-29 18:52:22 +01:00

Merge branch 'hotfix' into tests

This commit is contained in:
Sylvain 2016-04-06 17:47:10 +02:00
commit 6027fb5f38
5 changed files with 12 additions and 16 deletions

View File

@ -155,7 +155,7 @@ DNS name or IP address of the server hosting the elasticSearch database.
SECRET_KEY_BASE
Used by the authentication system to generate random tokens, eg. for resetting passwords.
Used by Rails to generate the integrity of signed cookies.
Used by Rails to verify the integrity of signed cookies.
You can generate such a random key by running `rake secret`.
STRIPE_API_KEY & STRIPE_PUBLISHABLE_KEY
@ -174,8 +174,8 @@ So set this setting carefully before starting the application for the first time
INVOICE_PREFIX
When payments are done on the platform, an invoice will be generate as a PDF file.
This value configure the prefix of the PDF file name.
When payments are done on the platform, an invoice will be generated as a PDF file.
The PDF file name will be of the form "(INVOICE_PREFIX) - (invoice ID) _ (invoice date) .pdf"
FABLAB_WITHOUT_PLANS
@ -203,7 +203,7 @@ Identifier of your Google Analytics account.
DISQUS_SHORTNAME
Unique identifier of your [Disqus](http://www.disqus.com) forum.
Disquq forums are used to allow visitors to comment on projects.
Disqus forums are used to allow visitors to comment on projects.
See https://help.disqus.com/customer/portal/articles/466208-what-s-a-shortname- for more informations.
TWITTER_NAME
@ -213,6 +213,7 @@ Identifier of the Twitter account, for witch the last tweet will be displayed on
TWITTER_CONSUMER_KEY, TWITTER_CONSUMER_SECRET, TWITTER_ACCESS_TOKEN & TWITTER_ACCESS_TOKEN_SECRET
Keys and secrets to access the twitter API.
Retrieve them from https://apps.twitter.com
Settings related to i18n
@ -443,7 +444,9 @@ If you are in a development environment, your can keep the default values, other
#### Settings
RAILS_LOCALE
Be sure that `config/locales/rails.XX.yml` exists, where `XX` match your configured rails_locale.
Configure Ruby on Rails for l10n.
Be sure that `config/locales/rails.XX.yml` exists, where `XX` match your configured RAILS_LOCALE.
You can find templates of these files at https://github.com/svenfuchs/rails-i18n/tree/rails-4-x/rails/locale.
Be aware that **this file MUST contain the CURRENCY symbol used to generate invoices** (among other things).

View File

@ -154,11 +154,11 @@
<tr class="invoice-vat invoice-editable vat-line italic" ng-click="openEditVAT()" ng-show="invoice.VAT.active">
<td>{{ 'including_VAT' | translate }} {{invoice.VAT.rate}} %</td>
<td>{{30*invoice.VAT.rate/100 | currency}}</td>
<td>{{30/(invoice.VAT.rate/100+1) | currency}}</td>
</tr>
<tr class="invoice-ht vat-line italic" ng-show="invoice.VAT.active">
<td translate>{{ 'including_total_excluding_taxes' }}</td>
<td>{{30-(30*invoice.VAT.rate/100) | currency}}</td>
<td>{{30-(30/(invoice.VAT.rate/100+1)) | currency}}</td>
</tr>
<tr class="invoice-payed vat-line bold" ng-show="invoice.VAT.active">
<td translate>{{ 'including_amount_payed_on_ordering' }}</td>

View File

@ -117,7 +117,7 @@ class Invoice < ActiveRecord::Base
reference
end
# only for debug
# for debug & used by rake task "fablab:regenerate_invoices"
def regenerate_invoice_pdf
pdf = ::PDF::Invoice.new(self).render
File.binwrite(file, pdf)

View File

@ -138,7 +138,7 @@ module PDF
data += [ [I18n.t('invoices.total_including_all_taxes'), number_to_currency(total)] ]
vat_rate = Setting.find_by({name: 'invoice_VAT-rate'}).value.to_f
vat = total * vat_rate / 100
vat = total / (vat_rate / 100 + 1)
data += [ [I18n.t('invoices.including_VAT_RATE', RATE: vat_rate), number_to_currency(vat)] ]
data += [ [I18n.t('invoices.including_total_excluding_taxes'), number_to_currency(total-vat)] ]
data += [ [I18n.t('invoices.including_amount_payed_on_ordering'), number_to_currency(total)] ]

View File

@ -26,14 +26,7 @@ namespace :fablab do
start_date = Time.new(year.to_i, month.to_i, 1)
end_date = start_date.next_month
puts "-> Start regenerate the invoices between #{I18n.l start_date, format: :long} in #{I18n.l end_date-1.minute, format: :long}"
index = '000'
invoices = Invoice.only_invoice.where("created_at >= :start_date AND created_at < :end_date", {start_date: start_date, end_date: end_date}).order(created_at: :asc)
invoices.each do |i|
i.update_columns(reference: "#{year.to_s[2..3]}#{'%02d' % month}#{index.next!}#{i.stp_invoice_id ? '/VL' : ''}")
if i.avoir
i.avoir.update_columns(reference: "#{year.to_s[2..3]}#{'%02d' % month}#{index.next!}/A")
end
end
invoices.each(&:regenerate_invoice_pdf)
puts "-> Done"
end