1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-30 19:52:20 +01:00

Merge branch 'dev' for release 4.7.11

This commit is contained in:
Sylvain 2021-05-26 13:42:17 +02:00
commit 2b6bbbd7b8
10 changed files with 83 additions and 21 deletions

View File

@ -1,14 +0,0 @@
This issue tracker is **reserved** for bug reports.
The place to ask a question or call for help is at [Fab-manager forums](https://forum.fab-manager.com)
The place to request or vote for new feature is on the [feedback website](https://feedback.fab-manager.com)
To report a bug, please describe:
- Expected behavior and actual behavior.
- Steps to reproduce the problem.
- Specifications like the version of the project, operating system, or hardware.
The following elements may help to quickly resolve your issue:
- Server logs `tail -f /apps/fabmanager/log/app-stdout.log` on the server
- Client logs `Ctrl`+`Maj`+`i` > `Console` in the browser

36
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@ -0,0 +1,36 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Server (please complete the following information):**
- OS: [report here the result of `lsb_release -a`]
- Kernel: [report here the result of `uname -a`]
- Fab-manager version [report here the result of `\curl -sSL run.fab.mn | bash -s "fablab:maintenance:version"`]
**Browser (please complete the following information):**
- Name: [e.g. Firefox]
- Version: [e.g. 88.0.1, please refer to the About menu of your browser]
**Additional context**
Add any other context about the problem here.

View File

@ -0,0 +1,10 @@
---
name: Feature request
about: Suggest an idea for Fab-manager
title: ''
labels: ''
assignees: ''
---
Please visit [feedback.fab-manager.com](https://feedback.fab-manager.com/) and vote for existing feature requests or propose a new one.

10
.github/ISSUE_TEMPLATE/support.md vendored Normal file
View File

@ -0,0 +1,10 @@
---
name: Support
about: Call for help while using Fab-manager
title: ''
labels: ''
assignees: ''
---
Please visit [the forum](https://forum.fab-manager.com/) to get assistance from the community. If you subscribed to paid assistance, please contact us by email for a faster reply.

View File

@ -1,5 +1,12 @@
# Changelog Fab-manager
## v4.7.11 2021 May 26
- Updated ffi to 1.15.1
- Updated GitHub issue templates
- Fix a bug: zero-decimal currencies were charged multiplied by 100
- Fix a bug: fablab:fix_invoices task fails to recreate the data if the date is in english
## v4.7.10 2021 May 25
- CAD lists of types and extensions are now ordered alphabetically

View File

@ -140,7 +140,7 @@ GEM
i18n (>= 1.6, < 2)
faraday (0.17.3)
multipart-post (>= 1.2, < 3)
ffi (1.14.2)
ffi (1.15.1)
foreman (0.87.0)
forgery (0.7.0)
friendly_id (5.1.0)

View File

@ -26,7 +26,7 @@ class API::PaymentsController < API::ApiController
intent = Stripe::PaymentIntent.create(
{
payment_method: params[:payment_method_id],
amount: amount[:amount],
amount: StripeService.stripe_amount(amount[:amount]),
currency: Setting.get('stripe_currency'),
confirmation_method: 'manual',
confirm: true,

View File

@ -50,7 +50,7 @@ class StripeService
if coupon.type == 'percent_off'
stp_coupon[:percent_off] = coupon.percent_off
elsif coupon.type == 'amount_off'
stp_coupon[:amount_off] = coupon.amount_off
stp_coupon[:amount_off] = stripe_amount(coupon.amount_off)
stp_coupon[:currency] = Setting.get('stripe_currency')
end
@ -61,6 +61,13 @@ class StripeService
Stripe::Coupon.create(stp_coupon, api_key: Setting.get('stripe_secret_key'))
end
def stripe_amount(amount)
currency = Setting.get('stripe_currency')
return amount / 100 if zero_decimal_currencies.any? { |s| s.casecmp(currency).zero? }
amount
end
private
def subscription_invoice_items(payment_schedule, subscription, first_item, reservable_stp_id)
@ -91,7 +98,7 @@ class StripeService
def create_price(amount, stp_product_id, name, monthly: false)
params = {
unit_amount: amount,
unit_amount: stripe_amount(amount),
currency: Setting.get('stripe_currency'),
product: stp_product_id,
nickname: name
@ -107,5 +114,10 @@ class StripeService
customer_id = payment_schedule.invoicing_profile.user.stp_customer_id
Stripe::Customer.update(customer_id, { balance: -payment_schedule.wallet_amount }, { api_key: Setting.get('stripe_secret_key') })
end
# @see https://stripe.com/docs/currencies#zero-decimal
def zero_decimal_currencies
%w[BIF CLP DJF GNF JPY KMF KRW MGA PYG RWF UGX VND VUV XAF XOF XPF]
end
end
end

View File

@ -98,8 +98,9 @@ namespace :fablab do
description = ii.description
# DateTime.parse only works with english dates, so translate the month name
month_idx = I18n.t('date.month_names').find_index { |month| month && description.include?(month) }
description.gsub!(/#{I18n.t('date.month_names')[month_idx]}/, I18n.t('date.month_names', locale: :en)[month_idx])
unless month_idx.nil?
description.gsub!(/#{I18n.t('date.month_names')[month_idx]}/, I18n.t('date.month_names', locale: :en)[month_idx])
end
start = DateTime.parse(description)
end_time = DateTime.parse(/- (.+)$/.match(description)[1])
[start, DateTime.new(start.year, start.month, start.day, end_time.hour, end_time.min, end_time.sec, DateTime.current.zone)]

View File

@ -1,6 +1,6 @@
{
"name": "fab-manager",
"version": "4.7.10",
"version": "4.7.11",
"description": "Fab-manager is the FabLab management solution. It provides a comprehensive, web-based, open-source tool to simplify your administrative tasks and your marker's projects.",
"keywords": [
"fablab",