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

(merge) merge branch dev

This commit is contained in:
Du Peng 2023-07-12 09:33:04 +02:00
commit 4fc181480b
22 changed files with 49 additions and 24 deletions

View File

@ -1,6 +1,17 @@
# Changelog Fab-manager # Changelog Fab-manager
- Fix a bug: unable to confirm payment of store for admin
- Fix a bug: unable to update payment schedule item
## v6.0.9 2023 July 07
- Fix a bug: unable to show project step image in markdown file - Fix a bug: unable to show project step image in markdown file
- Fix a bug: unable to update Store Order sub type in statistics
- Fix a bug: unable to create plan with plan limitation
- Ability to show all availabilities in calender for admin
- Improved performance when marking all notifications as read
- [TODO DEPLOY] `rails fablab:maintenance:regenerate_statistics[2014,1]`
## v6.0.8 2023 July 03 ## v6.0.8 2023 July 03

View File

@ -529,6 +529,7 @@ GEM
PLATFORMS PLATFORMS
x86_64-darwin-20 x86_64-darwin-20
x86_64-darwin-21
x86_64-linux x86_64-linux
DEPENDENCIES DEPENDENCIES

View File

@ -31,7 +31,7 @@ class API::CheckoutController < API::APIController
def confirm_payment def confirm_payment
authorize @current_order, policy_class: CheckoutPolicy authorize @current_order, policy_class: CheckoutPolicy
res = Checkout::PaymentService.new.confirm_payment(@current_order, current_user, params[:coupon_code], params[:payment_id]) res = Checkout::PaymentService.new.confirm_payment(@current_order, params[:coupon_code], params[:payment_id])
render json: res render json: res
rescue StandardError => e rescue StandardError => e
render json: e, status: :unprocessable_entity render json: e, status: :unprocessable_entity

View File

@ -65,7 +65,8 @@ class API::NotificationsController < API::APIController
end end
def update_all def update_all
current_user.notifications.where(is_read: false).find_each(&:mark_as_read) current_user.notifications.where(is_read: false)
.update_all(is_read: true, updated_at: Time.current) # rubocop:disable Rails/SkipsModelValidations
head :no_content head :no_content
end end

View File

@ -8,7 +8,7 @@ class PlanLimitation < ApplicationRecord
belongs_to :machine, foreign_key: 'limitable_id', inverse_of: :plan_limitations belongs_to :machine, foreign_key: 'limitable_id', inverse_of: :plan_limitations
belongs_to :machine_category, foreign_key: 'limitable_id', inverse_of: :plan_limitations belongs_to :machine_category, foreign_key: 'limitable_id', inverse_of: :plan_limitations
validates :limitable_id, :limitable_type, :limit, :plan_id, presence: true validates :limitable_id, :limitable_type, :limit, presence: true
validates :limitable_id, uniqueness: { scope: %i[limitable_type plan_id] } validates :limitable_id, uniqueness: { scope: %i[limitable_type plan_id] }
# @return [Array<Machine,Event,Space,Training>] # @return [Array<Machine,Event,Space,Training>]

View File

@ -22,7 +22,7 @@ class Availabilities::VisibilityService
# @return [Array<ActiveSupport::TimeWithZone,Date,Time>] as: [start,end] # @return [Array<ActiveSupport::TimeWithZone,Date,Time>] as: [start,end]
def visibility(user, available_type, range_start, range_end) def visibility(user, available_type, range_start, range_end)
if user&.privileged? if user&.privileged?
window_start = [range_start, 1.month.ago].max window_start = range_start
window_end = range_end window_end = range_end
else else
end_at = @maximum_visibility[:other] end_at = @maximum_visibility[:other]

View File

@ -29,9 +29,7 @@ class Checkout::PaymentService
end end
end end
def confirm_payment(order, operator, coupon_code, payment_id = '') def confirm_payment(order, coupon_code, payment_id = '')
return unless operator.member?
if Stripe::Helper.enabled? if Stripe::Helper.enabled?
Payments::StripeService.new.confirm_payment(order, coupon_code, payment_id) Payments::StripeService.new.confirm_payment(order, coupon_code, payment_id)
elsif PayZen::Helper.enabled? elsif PayZen::Helper.enabled?

View File

@ -45,7 +45,13 @@ class Orders::OrderService
# update in elasticsearch (statistics) # update in elasticsearch (statistics)
stat_order = Stats::Order.search(query: { term: { orderId: order.id } }) stat_order = Stats::Order.search(query: { term: { orderId: order.id } })
stat_order.map { |s| s.update(state: state) } sub_type = if state.in?(%w[paid in_progress ready delivered])
'paid-processed'
elsif state.in?(%w[payment_failed refunded canceled])
'aborted'
end
stat_order.map { |s| s.update(subType: sub_type, state: state) } if sub_type.present?
order order
end end

View File

@ -455,8 +455,8 @@ fr:
open_lab_app_secret: "Secret" open_lab_app_secret: "Secret"
openlab_default_info_html: "Dans la galerie de projets, les visiteurs peuvent choisir entre deux vues : tous les projets de l'ensemble du réseau OpenLab, ou uniquement les projets documentés dans votre Fab Lab.<br/>Ici, vous pouvez choisir quelle vue est affichée par défaut." openlab_default_info_html: "Dans la galerie de projets, les visiteurs peuvent choisir entre deux vues : tous les projets de l'ensemble du réseau OpenLab, ou uniquement les projets documentés dans votre Fab Lab.<br/>Ici, vous pouvez choisir quelle vue est affichée par défaut."
default_to_openlab: "Afficher OpenLab par défaut" default_to_openlab: "Afficher OpenLab par défaut"
filters: Filtres de la liste des projets filters: Affichage des filtres
project_categories: Catégories project_categories: Personnalisation du filtre Catégories
project_categories: project_categories:
name: "Nom" name: "Nom"
projects_setting: projects_setting:
@ -1821,10 +1821,10 @@ fr:
extended_prices_in_same_day: "Prix étendus le même jour" extended_prices_in_same_day: "Prix étendus le même jour"
public_registrations: "Inscriptions publiques" public_registrations: "Inscriptions publiques"
show_username_in_admin_list: "Afficher le nom d'utilisateur dans la liste" show_username_in_admin_list: "Afficher le nom d'utilisateur dans la liste"
projects_list_member_filter_presence: "Présence de filtre des membres dans la liste des projets" projects_list_member_filter_presence: "Permettre la recherche de projets par membre"
projects_list_date_filters_presence: "Filtres de date présents dans la liste des projets" projects_list_date_filters_presence: "Permettre la recherche de projets par dates"
project_categories_filter_placeholder: "Placeholder pour le filtre des catégories dans la galerie de projet" project_categories_filter_placeholder: "Dans la galerie de projets, renommer le filtre \"Toutes les catégories\""
project_categories_wording: "Mots utilisés pour remplacer les \"catégories\" sur les pages publiques" project_categories_wording: "Dans la fiche projet, renommer l'intitulé de l'encart Catégories"
family_account: "Compte famille" family_account: "Compte famille"
family_account_info_html: "Le compte Famille permet à vos membres d'ajouter leurs enfants de moins de 18 ans sur leur propre compte et de les inscrire directement aux évènements de type Famille. Vous pouvez aussi demander des justificatifs pour chaque enfant et valider leur compte." family_account_info_html: "Le compte Famille permet à vos membres d'ajouter leurs enfants de moins de 18 ans sur leur propre compte et de les inscrire directement aux évènements de type Famille. Vous pouvez aussi demander des justificatifs pour chaque enfant et valider leur compte."
enable_family_account: "Activer l'option Compte Famille" enable_family_account: "Activer l'option Compte Famille"

View File

@ -186,8 +186,8 @@ fr:
load_next_projects: "Charger les projets suivants" load_next_projects: "Charger les projets suivants"
rough_draft: "Brouillon" rough_draft: "Brouillon"
filter_by_member: "Filtrer par membre" filter_by_member: "Filtrer par membre"
created_from: Créé depuis created_from: Créés depuis le
created_to: Créés le created_to: Créés jusqu'au
download_archive: Télécharger download_archive: Télécharger
status_filter: status_filter:
all_statuses: "Tous les statuts" all_statuses: "Tous les statuts"

View File

@ -403,6 +403,7 @@ de:
state_new: "Not yet due" state_new: "Not yet due"
state_pending_check: "Waiting for the cashing of the check" state_pending_check: "Waiting for the cashing of the check"
state_pending_transfer: "Waiting for the tranfer confirmation" state_pending_transfer: "Waiting for the tranfer confirmation"
state_pending_card: "Waiting for the card payment"
state_requires_payment_method: "The credit card must be updated" state_requires_payment_method: "The credit card must be updated"
state_requires_action: "Action required" state_requires_action: "Action required"
state_paid: "Paid" state_paid: "Paid"

View File

@ -406,6 +406,7 @@ en:
state_new: "Not yet due" state_new: "Not yet due"
state_pending_check: "Waiting for the cashing of the check" state_pending_check: "Waiting for the cashing of the check"
state_pending_transfer: "Waiting for the tranfer confirmation" state_pending_transfer: "Waiting for the tranfer confirmation"
state_pending_card: "Waiting for the card payment"
state_requires_payment_method: "The credit card must be updated" state_requires_payment_method: "The credit card must be updated"
state_requires_action: "Action required" state_requires_action: "Action required"
state_paid: "Paid" state_paid: "Paid"

View File

@ -403,6 +403,7 @@ es:
state_new: "Not yet due" state_new: "Not yet due"
state_pending_check: "Waiting for the cashing of the check" state_pending_check: "Waiting for the cashing of the check"
state_pending_transfer: "Waiting for the tranfer confirmation" state_pending_transfer: "Waiting for the tranfer confirmation"
state_pending_card: "Waiting for the card payment"
state_requires_payment_method: "The credit card must be updated" state_requires_payment_method: "The credit card must be updated"
state_requires_action: "Action required" state_requires_action: "Action required"
state_paid: "Paid" state_paid: "Paid"

View File

@ -406,6 +406,7 @@ fr:
state_new: "Pas encore à l'échéance" state_new: "Pas encore à l'échéance"
state_pending_check: "En attente de l'encaissement du chèque" state_pending_check: "En attente de l'encaissement du chèque"
state_pending_transfer: "En attente de la confirmation du prélèvement" state_pending_transfer: "En attente de la confirmation du prélèvement"
state_pending_card: "En attente du paiement par carte"
state_requires_payment_method: "La carte bancaire doit être mise à jour" state_requires_payment_method: "La carte bancaire doit être mise à jour"
state_requires_action: "Action requise" state_requires_action: "Action requise"
state_paid: "Payée" state_paid: "Payée"

View File

@ -403,6 +403,7 @@ it:
state_new: "Non ancora scaduto" state_new: "Non ancora scaduto"
state_pending_check: "In attesa di incasso dell'assegno" state_pending_check: "In attesa di incasso dell'assegno"
state_pending_transfer: "In attesa conferma del bonifico bancario" state_pending_transfer: "In attesa conferma del bonifico bancario"
state_pending_card: "Waiting for the card payment"
state_requires_payment_method: "La carta di credito deve essere aggiornata" state_requires_payment_method: "La carta di credito deve essere aggiornata"
state_requires_action: "Azione richiesta" state_requires_action: "Azione richiesta"
state_paid: "Pagato" state_paid: "Pagato"

View File

@ -403,6 +403,7 @@
state_new: "Not yet due" state_new: "Not yet due"
state_pending_check: "Waiting for the cashing of the check" state_pending_check: "Waiting for the cashing of the check"
state_pending_transfer: "Waiting for the tranfer confirmation" state_pending_transfer: "Waiting for the tranfer confirmation"
state_pending_card: "Waiting for the card payment"
state_requires_payment_method: "The credit card must be updated" state_requires_payment_method: "The credit card must be updated"
state_requires_action: "Action required" state_requires_action: "Action required"
state_paid: "Paid" state_paid: "Paid"

View File

@ -403,6 +403,7 @@ pt:
state_new: "Ainda não vencido" state_new: "Ainda não vencido"
state_pending_check: "Esperando a validação manual" state_pending_check: "Esperando a validação manual"
state_pending_transfer: "Aguardando a confirmação da transferência" state_pending_transfer: "Aguardando a confirmação da transferência"
state_pending_card: "Waiting for the card payment"
state_requires_payment_method: "O cartão de crédito deve ser atualizado" state_requires_payment_method: "O cartão de crédito deve ser atualizado"
state_requires_action: "Ação necessária" state_requires_action: "Ação necessária"
state_paid: "Pago" state_paid: "Pago"

View File

@ -403,6 +403,7 @@ zu:
state_new: "crwdns29422:0crwdne29422:0" state_new: "crwdns29422:0crwdne29422:0"
state_pending_check: "crwdns29424:0crwdne29424:0" state_pending_check: "crwdns29424:0crwdne29424:0"
state_pending_transfer: "crwdns29426:0crwdne29426:0" state_pending_transfer: "crwdns29426:0crwdne29426:0"
state_pending_card: "crwdns37663:0crwdne37663:0"
state_requires_payment_method: "crwdns29428:0crwdne29428:0" state_requires_payment_method: "crwdns29428:0crwdne29428:0"
state_requires_action: "crwdns29430:0crwdne29430:0" state_requires_action: "crwdns29430:0crwdne29430:0"
state_paid: "crwdns29432:0crwdne29432:0" state_paid: "crwdns29432:0crwdne29432:0"

View File

@ -720,10 +720,10 @@ fr:
trainings_authorization_validity_duration: "Durée de la période de validité des formations" trainings_authorization_validity_duration: "Durée de la période de validité des formations"
trainings_invalidation_rule: "Invalidation automatique des formations" trainings_invalidation_rule: "Invalidation automatique des formations"
trainings_invalidation_rule_period: "Période de grâce avant d'invalider une formation" trainings_invalidation_rule_period: "Période de grâce avant d'invalider une formation"
projects_list_member_filter_presence: "Présence de filtre des membres dans la liste des projets" projects_list_member_filter_presence: "Permettre la recherche de projets par membre"
projects_list_date_filters_presence: "Filtre de présence de dates sur la liste des projets" projects_list_date_filters_presence: "Filtre de présence de dates sur la liste des projets"
project_categories_filter_placeholder: "Placeholder pour le filtre des catégories dans la galerie de projet" project_categories_filter_placeholder: "Dans la galerie de projets, renommer le filtre \"Toutes les catégories\""
project_categories_wording: "Mots utilisés pour remplacer les \"catégories\" sur les pages publiques" project_categories_wording: "Dans la fiche projet, renommer l'intitulé de l'encart Catégories"
#statuses of projects #statuses of projects
statuses: statuses:
new: "Nouveau" new: "Nouveau"

View File

@ -24,7 +24,7 @@ class PayZen::Service < Payment::Service
rrule: rrule(payment_schedule), rrule: rrule(payment_schedule),
order_id: order_id order_id: order_id
} }
unless first_item.details['adjustment']&.zero? && first_item.details['other_items']&.zero? if first_item.details['adjustment']&.zero? && first_item.details['other_items']&.zero?
initial_amount = first_item.amount initial_amount = first_item.amount
initial_amount -= payment_schedule.wallet_amount if payment_schedule.wallet_amount initial_amount -= payment_schedule.wallet_amount if payment_schedule.wallet_amount
if initial_amount.zero? if initial_amount.zero?
@ -140,7 +140,7 @@ class PayZen::Service < Payment::Service
transaction_date = Time.zone.parse(transaction['creationDate']).to_date transaction_date = Time.zone.parse(transaction['creationDate']).to_date
amount = payment_schedule_item.amount amount = payment_schedule_item.amount
if !payment_schedule_item.details['adjustment']&.zero? && payment_schedule_item.payment_schedule.wallet_amount if payment_schedule_item.details['adjustment']&.zero? && payment_schedule_item.payment_schedule.wallet_amount
amount -= payment_schedule_item.payment_schedule.wallet_amount amount -= payment_schedule_item.payment_schedule.wallet_amount
end end

View File

@ -1,6 +1,6 @@
{ {
"name": "fab-manager", "name": "fab-manager",
"version": "6.0.8", "version": "6.0.9",
"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.", "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": [ "keywords": [
"fablab", "fablab",

View File

@ -35,12 +35,12 @@ class Availabilities::AvailabilitiesServiceTest < ActiveSupport::TestCase
assert_empty slots assert_empty slots
end end
test 'admin cannot see past availabilities further than 1 month' do test 'admin can see past availabilities further than 1 month' do
service = Availabilities::AvailabilitiesService.new(@admin) service = Availabilities::AvailabilitiesService.new(@admin)
slots = service.machines([Machine.find(2)], @no_subscription, slots = service.machines([Machine.find(2)], @no_subscription,
{ start: Time.zone.parse('2015-06-15').beginning_of_day, end: Time.zone.parse('2015-06-15').end_of_day }) { start: Time.zone.parse('2015-06-15').beginning_of_day, end: Time.zone.parse('2015-06-15').end_of_day })
assert_empty slots assert_not_empty slots
end end
test 'admin can see past availabilities in 1 month ago' do test 'admin can see past availabilities in 1 month ago' do