1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-17 06:52:27 +01:00

Merge branch 'dev' for release 4.5.9

This commit is contained in:
Sylvain 2020-09-29 12:15:39 +02:00
commit 257d2666af
22 changed files with 84 additions and 16 deletions

View File

@ -1,6 +1,14 @@
# Changelog Fab-manager
## v4.5.8 2020 Septembre 28
## v4.5.9 2020 September 29
- Ability to configure until when the events are shown on the home page
- Alert before cancelling a reservation that credits will be lost
- Improved documentation about upgrade process
- Fix a bug: managers cannot see passed events
- [TODO DEPLOY] `rails db:seed`
## v4.5.8 2020 September 28
- Fix a bug: unable to run the elastic-upgrade script
- Fix a security issue: updated rails to 5.2.4.4 to fix [CVE-2020-15169](https://nvd.nist.gov/vuln/detail/CVE-2020-15169)

View File

@ -464,7 +464,7 @@ Application.Directives.directive('cart', [ '$rootScope', '$uibModal', 'dialogs',
object () {
return {
title: _t('app.shared.cart.confirmation_required'),
msg: _t('app.shared.cart.do_you_really_want_to_cancel_this_reservation')
msg: _t('app.shared.cart.do_you_really_want_to_cancel_this_reservation_html')
};
}
}

View File

@ -1043,7 +1043,7 @@ angular.module('application.router', ['ui.router'])
'fablab_name', 'name_genre', 'reminder_enable', 'plans_module', 'confirmation_required', \
'reminder_delay', 'visibility_yearly', 'visibility_others', 'wallet_module', \
'display_name_enable', 'machines_sort_by', 'fab_analytics', 'statistics_module', \
'link_name', 'home_content', 'home_css', 'phone_required']` }).$promise;
'link_name', 'home_content', 'home_css', 'phone_required', 'upcoming_events_shown']` }).$promise;
}],
privacyDraftsPromise: ['Setting', function (Setting) { return Setting.get({ name: 'privacy_draft', history: true }).$promise; }],
cguFile: ['CustomAsset', function (CustomAsset) { return CustomAsset.get({ name: 'cgu-file' }).$promise; }],

View File

@ -27,6 +27,18 @@
</text-setting>
</div>
</div>
<div class="row m-t-lg">
<div class="col-md-6">
<select-setting name="upcoming_events_shown"
settings="allSettings"
required="true"
label="app.admin.settings.home.show_upcoming_events"
option-1="['until_start', 'app.admin.settings.home.upcoming_events.until_start']"
option-2="['2h_before_end', 'app.admin.settings.home.upcoming_events.2h_before_end']"
option-3="['until_end', 'app.admin.settings.home.upcoming_events.until_end']">
</select-setting>
</div>
</div>
<div class="row m-t-lg home-page-style">
<uib-accordion>
<uib-accordion-group is-open="advancedSettings.open">

View File

@ -14,7 +14,7 @@ class API::EventsController < API::ApiController
@events = @events.joins(:event_themes).where('event_themes.id = :theme', theme: params[:theme_id]) if params[:theme_id]
@events = @events.where('age_range_id = :age_range', age_range: params[:age_range_id]) if params[:age_range_id]
if current_user&.admin?
if current_user&.admin? || current_user&.manager?
@events = case params[:scope]
when 'future'
@events.where('availabilities.start_at >= ?', DateTime.current).order('availabilities.start_at DESC')
@ -36,9 +36,17 @@ class API::EventsController < API::ApiController
limit = params[:limit]
@events = Event.includes(:event_image, :event_files, :availability, :category)
.where('events.nb_total_places != -1 OR events.nb_total_places IS NULL')
.where('availabilities.start_at >= ?', DateTime.current)
.order('availabilities.start_at ASC').references(:availabilities)
.limit(limit)
@events = case Setting.get('upcoming_events_shown')
when 'until_start'
@events.where('availabilities.start_at >= ?', DateTime.current)
when '2h_before_end'
@events.where('availabilities.end_at >= ?', DateTime.current + 2.hours)
else
@events.where('availabilities.end_at >= ?', DateTime.current)
end
end
def show; end

View File

@ -105,7 +105,8 @@ class Setting < ApplicationRecord
invoice_prefix
confirmation_required
wallet_module
statistics_module] }
statistics_module
upcoming_events_shown] }
# WARNING: when adding a new key, you may also want to add it in app/policies/setting_policy.rb#public_whitelist
def value

View File

@ -8,4 +8,5 @@ class UsersCredit < ApplicationRecord
belongs_to :training_credit, -> { where('credits.creditable_type = ?', 'Training') }, foreign_key: 'credit_id', class_name: 'Credit'
belongs_to :machine_credit, -> { where('credits.creditable_type = ?', 'Machine') }, foreign_key: 'credit_id', class_name: 'Credit'
belongs_to :space_credit, -> { where('credits.creditable_type = ?', 'Space') }, foreign_key: 'credit_id', class_name: 'Credit'
end

View File

@ -5,7 +5,7 @@ class EventPolicy < ApplicationPolicy
# Defines the scope of the events index, depending on the role of the current user
class Scope < Scope
def resolve
if user.nil? || (user && !user.admin?)
if user.nil? || (user && !user.admin? && !user.manager?)
scope.includes(:event_image, :event_files, :availability, :category)
.where('availabilities.start_at >= ?', DateTime.current)
.order('availabilities.start_at ASC')

View File

@ -1112,6 +1112,7 @@ en:
confirmation_is_required: "Confirmation required"
wallet_module: "wallet module"
statistics_module: "statistics module"
upcoming_events_shown: "display limit for upcoming events"
general:
general: "General"
title: "Title"
@ -1151,6 +1152,12 @@ en:
statistics: "Statistics"
statistics_info_html: "<p>Enable or disable the statistics module.</p><p>If enabled, every nights, the data of the day just passed will be consolidated in the database of a powerful analysis engine. Then, every administrators will be able to browse statistical charts and tables in the corresponding section.</p>"
enable_statistics: "Enable statistics"
home:
show_upcoming_events: "Show upcoming events"
upcoming_events:
until_start: "Until they start"
2h_before_end: "Until 2 hours before they end"
until_end: "Until they end"
privacy:
title: "Privacy"
privacy_policy: "Privacy policy"

View File

@ -1112,6 +1112,7 @@ es:
confirmation_is_required: "Confirmation required"
wallet_module: "wallet module"
statistics_module: "statistics module"
upcoming_events_shown: "display limit for upcoming events"
general:
general: "General"
title: "Title"
@ -1151,6 +1152,12 @@ es:
statistics: "Statistics"
statistics_info_html: "<p>Enable or disable the statistics module.</p><p>If enabled, every nights, the data of the day just passed will be consolidated in the database of a powerful analysis engine. Then, every administrators will be able to browse statistical charts and tables in the corresponding section.</p>"
enable_statistics: "Enable statistics"
home:
show_upcoming_events: "Show upcoming events"
upcoming_events:
until_start: "Until they start"
2h_before_end: "Until 2 hours before they end"
until_end: "Until they end"
privacy:
title: "Privacidad"
privacy_policy: "Política de privacidad"

View File

@ -1112,6 +1112,7 @@ fr:
confirmation_is_required: "Confirmation requise"
wallet_module: "module porte-monnaie"
statistics_module: "module de statistiques"
upcoming_events_shown: "la limite d'affichage des événements à venir"
general:
general: "Général"
title: "Titre"
@ -1151,6 +1152,12 @@ fr:
statistics: "Statistiques"
statistics_info_html: "<p>Activer ou désactiver le module de statistiques.</p><p>Si activé, chaque nuit, les données de la journée qui vient de s'écouler seront consolidées dans la base de données d'un puissant moteur d'analyse. Ensuite, chaque administrateur pourra parcourir les tableaux et graphiques statistiques dans la section correspondante.</p>"
enable_statistics: "Activer les statistiques"
home:
show_upcoming_events: "Afficher les prochains événements"
upcoming_events:
until_start: "Jusqu'à ce qu'ils commencent"
2h_before_end: "Jusqu'à 2 heures avant la fin"
until_end: "Jusqu'à ce qu'ils finissent"
privacy:
title: "Confidentialité"
privacy_policy: "Politique de confidentialité"

View File

@ -1112,6 +1112,7 @@ pt:
confirmation_is_required: "Confirmation required"
wallet_module: "wallet module"
statistics_module: "statistics module"
upcoming_events_shown: "display limit for upcoming events"
general:
general: "General"
title: "Title"
@ -1151,6 +1152,12 @@ pt:
statistics: "Statistics"
statistics_info_html: "<p>Enable or disable the statistics module.</p><p>If enabled, every nights, the data of the day just passed will be consolidated in the database of a powerful analysis engine. Then, every administrators will be able to browse statistical charts and tables in the corresponding section.</p>"
enable_statistics: "Enable statistics"
home:
show_upcoming_events: "Show upcoming events"
upcoming_events:
until_start: "Until they start"
2h_before_end: "Until 2 hours before they end"
until_end: "Until they end"
privacy:
title: "Privacidade"
privacy_policy: "Política de privacidade"

View File

@ -1112,6 +1112,7 @@ zu:
confirmation_is_required: "crwdns20722:0crwdne20722:0"
wallet_module: "crwdns20724:0crwdne20724:0"
statistics_module: "crwdns20864:0crwdne20864:0"
upcoming_events_shown: "crwdns20898:0crwdne20898:0"
general:
general: "crwdns20726:0crwdne20726:0"
title: "crwdns20728:0crwdne20728:0"
@ -1151,6 +1152,12 @@ zu:
statistics: "crwdns20866:0crwdne20866:0"
statistics_info_html: "crwdns20868:0crwdne20868:0"
enable_statistics: "crwdns20870:0crwdne20870:0"
home:
show_upcoming_events: "crwdns20900:0crwdne20900:0"
upcoming_events:
until_start: "crwdns20902:0crwdne20902:0"
2h_before_end: "crwdns20904:0crwdne20904:0"
until_end: "crwdns20906:0crwdne20906:0"
privacy:
title: "crwdns20792:0crwdne20792:0"
privacy_policy: "crwdns20794:0crwdne20794:0"

View File

@ -411,7 +411,7 @@ en:
unable_to_select_plan_if_slots_in_the_past: "Unable to select a plan if any of the selected slots is in the past"
unable_to_change_the_reservation: "Unable to change the reservation"
confirmation_required: "Confirmation required"
do_you_really_want_to_cancel_this_reservation: "Do you really want to cancel this reservation?"
do_you_really_want_to_cancel_this_reservation_html: "<p>Do you really want to cancel this reservation?</p><p>Warning: if this reservation was made free of charge, as part of a subscription, the credits used will not be re-credited.</p>"
reservation_was_cancelled_successfully: "Reservation was cancelled successfully."
cancellation_failed: "Cancellation failed."
confirm_payment_of_html: "{ROLE, select, admin{Payment on site} other{Pay}}: {AMOUNT}" #eg. confirm my payment of $20.00

View File

@ -411,7 +411,7 @@ es:
unable_to_select_plan_if_slots_in_the_past: "No se puede seleccionar un plan si alguno de los espacios seleccionados está en el pasado"
unable_to_change_the_reservation: "Imposible cambiar reserva"
confirmation_required: "Confirmación requerida"
do_you_really_want_to_cancel_this_reservation: "¿Está seguro de querer cancelar la reserva?"
do_you_really_want_to_cancel_this_reservation_html: "<p>¿Está seguro de querer cancelar la reserva?</p><p>Advertencia: si esta reserva se realizó de forma gratuita, como parte de una suscripción, los créditos utilizados no serán reacreditados.</p>"
reservation_was_cancelled_successfully: "La reserva se ha cancelado con éxito."
cancellation_failed: "Cancelación fallida."
confirm_payment_of_html: "{ROLE, select, admin{Payment on site} other{Pay}}: {AMOUNT}" #eg. confirm my payment of $20.00

View File

@ -411,7 +411,7 @@ fr:
unable_to_select_plan_if_slots_in_the_past: "Impossible de sélectionner un abonnement si l'un des créneaux sélectionné est dans le passé"
unable_to_change_the_reservation: "Impossible de modifier la réservation"
confirmation_required: "Confirmation requise"
do_you_really_want_to_cancel_this_reservation: "Êtes-vous sur de vouloir annuler cette réservation ?"
do_you_really_want_to_cancel_this_reservation_html: "<p>Êtes-vous sur de vouloir annuler cette réservation ?</p><p>Attention : si cette réservation a été effectuée gratuitement, dans le cadre d'un abonnement, les crédits utilisés ne seront pas re-crédités.</p>"
reservation_was_cancelled_successfully: "La réservation a bien été annulée."
cancellation_failed: "L'annulation a échouée."
confirm_payment_of_html: "{ROLE, select, admin{Paiement sur place} other{Payer}} : {AMOUNT}" #eg. confirm my payment of $20.00

View File

@ -411,7 +411,7 @@ pt:
unable_to_select_plan_if_slots_in_the_past: "Não é possível selecionar um plano se algum dos slots selecionados estiver no passado"
unable_to_change_the_reservation: "Não permitido alterar esta reserva"
confirmation_required: "Confirmação é obrigatória"
do_you_really_want_to_cancel_this_reservation: "Você realmente quer cancelar essa reserva?"
do_you_really_want_to_cancel_this_reservation_html: "<p>Você realmente quer cancelar essa reserva?</p><p>Warning: if this reservation was made free of charge, as part of a subscription, the credits used will not be re-credited.</p>"
reservation_was_cancelled_successfully: "Reserva a foi cancelada com sucesso."
cancellation_failed: "Cancelamento falhou."
confirm_payment_of_html: "{ROLE, select, admin{Pagamento pelo site} other{Pagar}}: {AMOUNT}" #eg. confirm my payment of $20.00

View File

@ -411,7 +411,7 @@ zu:
unable_to_select_plan_if_slots_in_the_past: "crwdns20136:0crwdne20136:0"
unable_to_change_the_reservation: "crwdns10091:0crwdne10091:0"
confirmation_required: "crwdns10093:0crwdne10093:0"
do_you_really_want_to_cancel_this_reservation: "crwdns10095:0crwdne10095:0"
do_you_really_want_to_cancel_this_reservation_html: "crwdns20908:0crwdne20908:0"
reservation_was_cancelled_successfully: "crwdns10097:0crwdne10097:0"
cancellation_failed: "crwdns10099:0crwdne10099:0"
confirm_payment_of_html: "crwdns10101:0ROLE={ROLE}crwdnd10101:0AMOUNT={AMOUNT}crwdne10101:0" #eg. confirm my payment of $20.00

View File

@ -1,4 +1,3 @@
# frozen_string_literal: true
if StatisticIndex.count.zero?
StatisticIndex.create!([
@ -892,6 +891,8 @@ Setting.set('wallet_module', true) unless Setting.find_by(name: 'wallet_module')
Setting.set('statistics_module', true) unless Setting.find_by(name: 'statistics_module').try(:value)
Setting.set('upcoming_events_shown', 'until_start') unless Setting.find_by(name: 'upcoming_events_shown').try(:value)
if StatisticCustomAggregation.count.zero?
# available reservations hours for machines
machine_hours = StatisticType.find_by(key: 'hour', statistic_index_id: 2)

View File

@ -157,7 +157,9 @@ Then, you'll need to perform the upgrade with the following command:
*This procedure updates Fab-manager to the most recent version by default.*
> ⚠ If you are upgrading from a very outdated version, you must first upgrade to v2.8.3, then to v3.1.2 and finally to the last version
> ⚠ If you are upgrading from a very outdated version, you must first upgrade to v2.8.3, then to v3.1.2, then to 4.0.4 and finally to the last version
> ⚠ With versions < 4.3.3, you must replace `bundle exec rails` with `bundle exec rake` in all the commands above
<a name="steps"></a>
### Steps

View File

@ -3,7 +3,7 @@
Steps to follow:
- Dump database of v1
- Make a gzipped tarball of public/uploads
- Install Fab-manager v4.3.4+
- Install Fab-manager v4.3.4 or above
- Restore the DB dump in the new postgres instance
- Open a psql shell, then:
```sql

View File

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