Skip to content

Commit

Permalink
Merge branch 'master' into docker/use_alpine_image
Browse files Browse the repository at this point in the history
  • Loading branch information
macanudo527 authored Oct 22, 2024
2 parents 3640057 + 1c58b06 commit fe7d5e3
Show file tree
Hide file tree
Showing 68 changed files with 583 additions and 1,213 deletions.
5 changes: 5 additions & 0 deletions app/helpers/reports_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,9 @@ def enterprise_fee_ids(orders)
.where(order_id: orders.map(&:id))
.pluck(:originator_id)
end

def datepicker_time(datetime)
datetime = Time.zone.parse(datetime) if datetime.is_a? String
datetime.strftime('%Y-%m-%d %H:%M')
end
end
2 changes: 2 additions & 0 deletions app/jobs/backorder_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ def place_backorder(order)
user = order.distributor.owner
items = backorderable_items(order)

return if items.empty?

# We are assuming that all variants are linked to the same wholesale
# shop and its catalog:
reference_link = items[0].variant.semantic_links[0].semantic_id
Expand Down
1 change: 0 additions & 1 deletion app/models/spree/payment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ def ensure_correct_adjustment
if adjustment
adjustment.originator = payment_method
adjustment.label = adjustment_label
adjustment.amount = payment_method.compute_amount(self)
adjustment.save
elsif !processing_refund? && payment_method.present?
payment_method.create_adjustment(adjustment_label, self, true)
Expand Down
13 changes: 8 additions & 5 deletions app/views/admin/reports/_date_range_form.html.haml
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
-# Field used for ransack search. This date range is mostly used for Spree::Order
-# so default field is 'completed_at'
- field ||= 'completed_at'
- start_date ||= params[:q].try(:[], :completed_at_gt)
- end_date ||= params[:q].try(:[], :completed_at_lt)
- start_field = "#{field}_gt"
- end_field = "#{field}_lt"
- query = params[:q].to_h
- start_date = datepicker_time(query[start_field].presence || 3.months.ago.beginning_of_day)
- end_date = datepicker_time(query[end_field].presence || Time.zone.tomorrow.beginning_of_day)

.row.date-range-filter
.alpha.two.columns= label_tag nil, t(:date_range)
.omega.fourteen.columns
.field-block.omega.four.columns
.date-range-fields{ data: { controller: "flatpickr", "flatpickr-mode-value": "range", "flatpickr-enable-time-value": true , "flatpickr-default-hour": 0 } }
.date-range-fields{ data: { controller: "flatpickr", "flatpickr-mode-value": "range", "flatpickr-enable-time-value": true , "flatpickr-default-hour": 0, "flatpickr-default-date": [start_date, end_date] } }
= text_field_tag nil, nil, class: "datepicker fullwidth", data: { "flatpickr-target": "instance", action: "flatpickr_clear@window->flatpickr#clear" }
= text_field_tag "q[#{field}_gt]", nil, data: { "flatpickr-target": "start" }, style: "display: none", value: start_date
= text_field_tag "q[#{field}_lt]", nil, data: { "flatpickr-target": "end" }, style: "display: none", value: end_date
= text_field_tag "q[#{start_field}]", nil, data: { "flatpickr-target": "start" }, style: "display: none", value: start_date
= text_field_tag "q[#{end_field}]", nil, data: { "flatpickr-target": "end" }, style: "display: none", value: end_date
4 changes: 2 additions & 2 deletions app/views/admin/reports/filters/_packing.html.haml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
= render partial: 'admin/reports/date_range_form',
locals: { f: f, field: 'order_completed_at', start_date: params[:q].try(:[], :order_completed_at_gt), end_date: params[:q].try(:[], :order_completed_at_lt) }
locals: { f: f, field: 'order_completed_at' }

.row
.alpha.two.columns= label_tag nil, t(:report_hubs)
Expand All @@ -14,4 +14,4 @@
.row
.alpha.two.columns= label_tag nil, t(:report_customers_cycle)
.omega.fourteen.columns
= select_tag("q[order_cycle_id_in]", options_for_select(report_order_cycle_options(@data.order_cycles), params.dig(:q, :order_cycle_id_in)), {class: "select2 fullwidth", multiple: true})
= select_tag("q[order_cycle_id_in]", options_for_select(report_order_cycle_options(@data.order_cycles), params.dig(:q, :order_cycle_id_in)), {class: "select2 fullwidth", multiple: true})
2 changes: 1 addition & 1 deletion config/initializers/devise.rb
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
config.omniauth :openid_connect, {
name: :openid_connect,
issuer: "https://login.lescommuns.org/auth/realms/data-food-consortium",
scope: [:openid, :profile, :email],
scope: [:openid, :profile, :email, :offline_access],
response_type: :code,
uid_field: "email",
discovery: true,
Expand Down
11 changes: 8 additions & 3 deletions config/locales/ar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ ar:
price: "السعر"
primary_taxon_id: "نوع المنتج "
shipping_category_id: "نوع الشحن"
variant_unit_name: "اسم وحدة النوع"
unit_value: "قيمةالوحدة"
spree/variant:
primary_taxon: "نوع المنتج "
shipping_category_id: "نوع الشحن"
supplier: "المورد"
variant_unit_name: "اسم وحدة النوع"
unit_value: "قيمةالوحدة"
spree/credit_card:
base: "بطاقة ائتمان"
number: "رقم "
Expand Down Expand Up @@ -1146,6 +1146,8 @@ ar:
<a href="https://regenerative.org.au/" target="_blank"><b>Visit Discover Regenerative</b>
<i class="icon-external-link"></i></a>
</p>
vine:
enable: "الاتصال"
actions:
edit_profile: الإعدادات
properties: الخصائص
Expand Down Expand Up @@ -4190,12 +4192,15 @@ ar:
new_variant: "نوع جديد"
form:
sku: "SKU"
price: "السعر"
unit_price: "سعر الوحدة"
display_as: "عرض ب"
display_name: "اسم العرض"
display_as_placeholder: 'على سبيل المثال 2 كجم'
display_name_placeholder: 'على سبيل المثال طماطم'
unit: وحدة
price: السعر
unit_value: قيمةالوحدة
variant_category: الفئة
autocomplete:
out_of_stock: "غير متوفر"
producer_name: "المنتج"
Expand Down
11 changes: 8 additions & 3 deletions config/locales/ca.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ ca:
price: "Preu"
primary_taxon_id: "Categoria del producte"
shipping_category_id: "Categoria d'enviament"
variant_unit_name: "Nom de la unitat de la variant"
unit_value: "Valor de la unitat"
spree/variant:
primary_taxon: "Categoria del producte"
shipping_category_id: "Categoria d'enviament"
supplier: "Proveïdora"
variant_unit_name: "Nom de la unitat de la variant"
unit_value: "Valor de la unitat"
spree/credit_card:
base: "Targeta de crèdit"
number: "Número"
Expand Down Expand Up @@ -1200,6 +1200,8 @@ ca:
loading: "S'està carregant"
discover_regen:
loading: "S'està carregant"
vine:
enable: "Connecta"
actions:
edit_profile: Configuració
properties: Propietats
Expand Down Expand Up @@ -4068,12 +4070,15 @@ ca:
new_variant: "Nova variant"
form:
sku: "Número de referència (SKU)"
price: "Preu"
unit_price: "Preu unitari"
display_as: "Mostra com"
display_name: "Nom de visualització"
display_as_placeholder: 'per exemple. 2 kg'
display_name_placeholder: 'per exemple. Tomàquets'
unit: Unitat
price: Preu
unit_value: Valor de la unitat
variant_category: Categoria
autocomplete:
out_of_stock: "Fora d'existència"
producer_name: "Productor"
Expand Down
11 changes: 8 additions & 3 deletions config/locales/cy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ cy:
price: "Pris"
primary_taxon_id: "Categori Cynnyrch"
shipping_category_id: "Categori dosbarthu."
variant_unit_name: "Enw Uned Amrywiol"
unit_value: "Gwerth yr uned"
spree/variant:
primary_taxon: "Categori Cynnyrch"
shipping_category_id: "Categori Anfon"
supplier: "Cyflenwr"
variant_unit_name: "Enw Uned Amrywiolyn"
unit_value: "Gwerth yr uned"
spree/credit_card:
base: "Cerdyn credyd"
number: "Rhif"
Expand Down Expand Up @@ -1260,6 +1260,8 @@ cy:
disable: "Rhoi’r gorau i rannu"
loading: "Yn llwytho"
link_label: "Rheoli’r rhestru"
vine:
enable: "Adnoddau"
actions:
edit_profile: Gosodiadau
properties: Manylion
Expand Down Expand Up @@ -4320,12 +4322,15 @@ cy:
new_variant: "Amrywiolyn newydd"
form:
sku: "Cod y Cynnyrch"
price: "Pris"
unit_price: "Pris Uned"
display_as: "Arddangos fel"
display_name: "Enw Arddangos"
display_as_placeholder: 'e.e. 2 kg'
display_name_placeholder: 'e.e. Tomatos'
unit: Uned
price: Pris
unit_value: Gwerth yr uned
variant_category: Categori
autocomplete:
out_of_stock: "Allan o stoc"
producer_name: "Cynhyrchydd"
Expand Down
8 changes: 6 additions & 2 deletions config/locales/de_CH.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ de_CH:
price: "Preis"
primary_taxon_id: "Produktkategorie"
shipping_category_id: "Lieferkategorie"
variant_unit_name: "Name der Varianteneinheit"
spree/variant:
primary_taxon: "Produktkategorie"
shipping_category_id: "Lieferkategorie"
supplier: "Lieferant"
variant_unit_name: "Name der Varianteneinheit"
spree/credit_card:
base: "Kreditkarte"
number: "Kreditkartennummer"
Expand Down Expand Up @@ -1112,6 +1112,8 @@ de_CH:
loading: "Wird geladen ..."
discover_regen:
loading: "Wird geladen ..."
vine:
enable: "Über OFN"
actions:
edit_profile: Einstellungen
properties: Eigenschaften
Expand Down Expand Up @@ -3974,12 +3976,14 @@ de_CH:
new_variant: "Neue Produktvariante"
form:
sku: "Artikelnummer"
price: "Preis"
unit_price: "Grundpreis"
display_as: "Anzeigen als"
display_name: "Variantenname"
display_as_placeholder: 'z. B. 2 kg'
display_name_placeholder: 'z. B. Tomaten'
unit: Einheit
price: Preis
variant_category: Kategorie
autocomplete:
out_of_stock: "nicht vorrätig"
producer_name: "Produzent"
Expand Down
11 changes: 8 additions & 3 deletions config/locales/de_DE.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ de_DE:
price: "Preis"
primary_taxon_id: "Produktkategorie"
shipping_category_id: "Lieferkategorie"
variant_unit_name: "Name der Varianteneinheit"
unit_value: "Menge"
spree/variant:
primary_taxon: "Produktkategorie"
shipping_category_id: "Lieferkategorie"
supplier: "Lieferant"
variant_unit_name: "Name der Varianteneinheit"
unit_value: "Menge"
spree/credit_card:
base: "Kreditkarte"
number: "Kreditkartennummer"
Expand Down Expand Up @@ -1240,6 +1240,8 @@ de_DE:
loading: "Wird geladen ..."
discover_regen:
loading: "Wird geladen ..."
vine:
enable: "Über OFN"
actions:
edit_profile: Einstellungen
properties: Eigenschaften
Expand Down Expand Up @@ -4250,12 +4252,15 @@ de_DE:
new_variant: "Neue Produktvariante"
form:
sku: "Artikelnummer"
price: "Preis"
unit_price: "Grundpreis"
display_as: "Anzeigen als"
display_name: "Variantenname"
display_as_placeholder: 'z. B. 2 kg'
display_name_placeholder: 'z. B. Tomaten'
unit: Einheit
price: Preis
unit_value: Menge
variant_category: Kategorie
autocomplete:
out_of_stock: "nicht vorrätig"
producer_name: "Produzent"
Expand Down
14 changes: 11 additions & 3 deletions config/locales/el.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ el:
price: "Τιμή"
primary_taxon_id: "Κατηγορία προϊόντος"
shipping_category_id: "Κατηγορία μεταφορικών"
variant_unit_name: "Όνομα μεταβλητής"
unit_value: "Τιμή μεταβλητής"
spree/variant:
primary_taxon: "Κατηγορία προϊόντος"
shipping_category_id: "Κατηγορία μεταφοράς"
supplier: "Προμηθευτής"
variant_unit_name: "Όνομα μεταβλητής"
unit_value: "Τιμή μεταβλητής"
spree/credit_card:
base: "Κάρτα πιστωτική/χρεωστική"
number: "Αριθμός"
Expand Down Expand Up @@ -1314,6 +1314,10 @@ el:
target="_blank"><b>Μάθετε περισσότερα για το Discover Regenerative</b>
<i class="icon-external-link"></i></a>
</p>
vine:
enable: "Σύνδεση"
disable: "Αποσύνδεση."
need_to_be_manager: "Μόνο οι διαχειριστές μπορούν να συνδέουν εφαρμογές."
actions:
edit_profile: Ρυθμήσεις
properties: Ιδιότητες
Expand Down Expand Up @@ -4326,12 +4330,16 @@ el:
new_variant: "Νέα παραλλαγή"
form:
sku: "SKU"
price: "Τιμή"
unit_price: "Τιμή Μονάδας"
display_as: "Εμφάνιση Ως"
display_name: "Εμφανιζόμενο όνομα"
display_as_placeholder: 'π.χ. 2 κιλά'
display_name_placeholder: 'π.χ. Ντομάτες'
unit_scale: "Κλίμακα μονάδας"
unit: Μονάδα
price: Τιμή
unit_value: Τιμή μεταβλητής
variant_category: Κατηγορία
autocomplete:
out_of_stock: "Εκτός αποθέματος"
producer_name: "Παραγωγός"
Expand Down
8 changes: 6 additions & 2 deletions config/locales/en_AU.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ en_AU:
price: "Price"
primary_taxon_id: "Product Category"
shipping_category_id: "Shipping Category"
variant_unit_name: "Variant Unit Name"
spree/variant:
primary_taxon: "Product Category"
shipping_category_id: "Shipping Category"
supplier: "Supplier"
variant_unit_name: "Variant Unit Name"
spree/credit_card:
base: "Credit Card"
number: "Number"
Expand Down Expand Up @@ -955,6 +955,8 @@ en_AU:
<a href="https://regenerative.org.au/" target="_blank"><b>Visit Discover Regenerative</b>
<i class="icon-external-link"></i></a>
</p>
vine:
enable: "Open Road"
actions:
edit_profile: Settings
properties: Properties
Expand Down Expand Up @@ -3630,12 +3632,14 @@ en_AU:
new_variant: "New Variant"
form:
sku: "SKU"
price: "Price"
unit_price: "Unit Price"
display_as: "Display As"
display_name: "Display Name"
display_as_placeholder: 'eg. 2 kg'
display_name_placeholder: 'eg. Tomatoes'
unit: Unit
price: Price
variant_category: Category
autocomplete:
out_of_stock: "Out of Stock"
producer_name: "Producer"
Expand Down
8 changes: 6 additions & 2 deletions config/locales/en_BE.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ en_BE:
price: "Price"
primary_taxon_id: "Product Category"
shipping_category_id: "Shipping Category"
variant_unit_name: "Variant Unit Name"
spree/variant:
primary_taxon: "Product Category"
shipping_category_id: "Shipping Category"
supplier: "Supplier"
variant_unit_name: "Variant Unit Name"
spree/credit_card:
base: "Credit Card"
number: "Number"
Expand Down Expand Up @@ -885,6 +885,8 @@ en_BE:
loading: "Loading"
discover_regen:
loading: "Loading"
vine:
enable: "Connect"
actions:
edit_profile: Settings
properties: Properties
Expand Down Expand Up @@ -3288,9 +3290,11 @@ en_BE:
option_types: "Option Types"
form:
sku: "SKU"
price: "Price"
unit_price: "Unit Price"
display_as: "Display As"
unit: Unit
price: Price
variant_category: Category
autocomplete:
out_of_stock: "Out of Stock"
producer_name: "Producer"
Expand Down
Loading

0 comments on commit fe7d5e3

Please sign in to comment.