mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-18 12:54:27 +01:00
Merge branch 'dev' for release 2.5.8
This commit is contained in:
commit
1806fca2eb
@ -1 +1 @@
|
||||
2.5.7
|
||||
2.5.8
|
||||
|
@ -1,5 +1,13 @@
|
||||
# Changelog Fab Manager
|
||||
|
||||
## v2.5.8 2017 July 12
|
||||
|
||||
- Fix a bug: when upgrading from version < 2.5.0, `db:seed` will throw an error if ADMIN_EMAIL does not match any admin in database
|
||||
- Fix a bug: hide spaces in public calendar when module is disabled
|
||||
- Fix a bug: confirmation message not shown after admin creation
|
||||
- Fix a bug: invoices generation failed for subscription days offered
|
||||
- add task `rake fablab:get_incoherent_invoice` allow find the invoices incoherent
|
||||
|
||||
## v2.5.7 2017 June 8
|
||||
|
||||
- Portuguese and Brazilian support
|
||||
|
@ -563,4 +563,4 @@ DEPENDENCIES
|
||||
webmock
|
||||
|
||||
BUNDLED WITH
|
||||
1.13.1
|
||||
1.13.6
|
||||
|
@ -555,7 +555,7 @@ Application.Controllers.controller "NewMemberController", ["$scope", "$state", "
|
||||
##
|
||||
# Controller used in the admin's creation page (admin view)
|
||||
##
|
||||
Application.Controllers.controller 'NewAdminController', ['$state', '$scope', 'Admin', 'growl', ($state, $scope, Admin, growl)->
|
||||
Application.Controllers.controller 'NewAdminController', ['$state', '$scope', 'Admin', 'growl', '_t', ($state, $scope, Admin, growl, _t)->
|
||||
|
||||
## default admin profile
|
||||
$scope.admin =
|
||||
|
@ -18,7 +18,7 @@
|
||||
<input class="col-md-1 col-sm-1 col-xs-1" type="checkbox" ng-model="m.checked" ng-change="filterAvailabilities(filter)">
|
||||
</div>
|
||||
</div>
|
||||
<div class="m-t">
|
||||
<div class="m-t" ng-hide="fablabWithoutSpaces">
|
||||
<div class="row">
|
||||
<h3 class="col-md-11 col-sm-11 col-xs-11 text-cyan" translate>{{ 'calendar.spaces' }}</h3>
|
||||
<input class="col-md-1 col-sm-1 col-xs-1" type="checkbox" ng-model="filter.spaces" ng-change="toggleFilter('spaces', filter)">
|
||||
|
@ -202,6 +202,11 @@ class Invoice < ActiveRecord::Base
|
||||
end
|
||||
end
|
||||
|
||||
# get amount total paid
|
||||
def amount_paid
|
||||
total - (wallet_amount ? wallet_amount : 0)
|
||||
end
|
||||
|
||||
private
|
||||
def generate_and_send_invoice
|
||||
unless Rails.env.test?
|
||||
|
@ -81,7 +81,7 @@ module PDF
|
||||
else
|
||||
case invoice.invoiced_type
|
||||
when 'Reservation'
|
||||
object = I18n.t('invoices.reservation_of_USER_on_DATE_at_TIME', USER:name, DATE:I18n.l(invoice.invoiced.slots[0].start_at.to_date), TIME:I18n.l(invoice.invoiced.slots[0].start_at, format: :hour_minute))
|
||||
object = I18n.t('invoices.reservation_of_USER_on_DATE_at_TIME', USER: name, DATE: I18n.l(invoice.invoiced.slots[0].start_at.to_date), TIME: I18n.l(invoice.invoiced.slots[0].start_at, format: :hour_minute))
|
||||
invoice.invoice_items.each do |item|
|
||||
if item.subscription_id
|
||||
subscription = Subscription.find item.subscription_id
|
||||
@ -324,14 +324,14 @@ module PDF
|
||||
end
|
||||
end
|
||||
|
||||
def subscription_verbose(subscription, user)
|
||||
def subscription_verbose(subscription, username)
|
||||
subscription_start_at = subscription.expired_at - subscription.plan.duration
|
||||
duration_verbose = I18n.t("duration.#{subscription.plan.interval}", count: subscription.plan.interval_count)
|
||||
I18n.t('invoices.subscription_of_NAME_for_DURATION_starting_from_DATE', NAME: user, DURATION: duration_verbose, DATE: I18n.l(subscription_start_at.to_date))
|
||||
I18n.t('invoices.subscription_of_NAME_for_DURATION_starting_from_DATE', NAME: username, DURATION: duration_verbose, DATE: I18n.l(subscription_start_at.to_date))
|
||||
end
|
||||
|
||||
def offer_day_verbose(offer_day, user)
|
||||
I18n.t('invoices.subscription_of_NAME_extended_starting_from_STARTDATE_until_ENDDATE', NAME: user.profile.full_name, STARTDATE: I18n.l(offer_day.start_at.to_date), ENDDATE: I18n.l(offer_day.end_at.to_date))
|
||||
def offer_day_verbose(offer_day, username)
|
||||
I18n.t('invoices.subscription_of_NAME_extended_starting_from_STARTDATE_until_ENDDATE', NAME: username, STARTDATE: I18n.l(offer_day.start_at.to_date), ENDDATE: I18n.l(offer_day.end_at.to_date))
|
||||
end
|
||||
|
||||
|
||||
|
@ -82,8 +82,8 @@ if Group.count == 0
|
||||
])
|
||||
end
|
||||
|
||||
# Create the admin if it does not exist yet
|
||||
if User.find_by(email: Rails.application.secrets.admin_email).nil?
|
||||
# Create the default admin if none exists yet
|
||||
if Role.find_by(name: 'admin').users.count === 0
|
||||
admin = User.new(username: 'admin', email: Rails.application.secrets.admin_email, password: Rails.application.secrets.admin_password, password_confirmation: Rails.application.secrets.admin_password, group_id: Group.first.id, profile_attributes: {first_name: 'admin', last_name: 'admin', gender: true, phone: '0123456789', birthday: Time.now})
|
||||
admin.add_role 'admin'
|
||||
admin.save!
|
||||
|
@ -304,4 +304,22 @@ namespace :fablab do
|
||||
p.save
|
||||
end
|
||||
end
|
||||
|
||||
desc 'get incoherent invoice'
|
||||
task :get_incoherent_invoice, [:start_date] => :environment do |task, args|
|
||||
date = Date.parse('2017-05-01')
|
||||
if args.start_date
|
||||
begin
|
||||
date = Date.parse(args.start_date)
|
||||
rescue => e
|
||||
fail e
|
||||
end
|
||||
end
|
||||
Invoice.where('created_at > ? AND stp_invoice_id IS NOT NULL', date).each do |invoice|
|
||||
stp_invoice = Stripe::Invoice.retrieve(invoice.stp_invoice_id)
|
||||
if invoice.amount_paid != stp_invoice.total
|
||||
puts "Id: #{invoice.id}, reference: #{invoice.reference}, stripe id: #{stp_invoice.id}, invoice total: #{invoice.amount_paid / 100.0}, stripe invoice total: #{stp_invoice.total / 100.0}, date: #{invoice.created_at}"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user