Merge latest changes in master of http://github.com/foodcoops/foodsoft
This commit is contained in:
commit
d0ccf07bc5
20 changed files with 139 additions and 125 deletions
|
@ -11,6 +11,19 @@
|
||||||
//= require_self
|
//= require_self
|
||||||
//= require ordering
|
//= require ordering
|
||||||
|
|
||||||
|
// allow touch devices to work on click events
|
||||||
|
// http://stackoverflow.com/a/16221066
|
||||||
|
$.fn.extend({ _on: (function(){ return $.fn.on; })() });
|
||||||
|
$.fn.extend({
|
||||||
|
on: (function(){
|
||||||
|
var isTouchSupported = 'ontouchstart' in window || window.DocumentTouch && document instanceof DocumentTouch;
|
||||||
|
return function( types, selector, data, fn, one ) {
|
||||||
|
if (typeof types == 'string' && isTouchSupported && !(types.match(/touch/gi))) types = types.replace(/click/gi, 'touchstart');
|
||||||
|
return this._on( types, selector, data, fn, one );
|
||||||
|
};
|
||||||
|
}()),
|
||||||
|
});
|
||||||
|
|
||||||
// function for sorting DOM elements
|
// function for sorting DOM elements
|
||||||
$.fn.sorter = (function(){
|
$.fn.sorter = (function(){
|
||||||
// Thanks to James Padolsey and Avi Deitcher
|
// Thanks to James Padolsey and Avi Deitcher
|
||||||
|
|
|
@ -7,7 +7,9 @@
|
||||||
|
|
||||||
var modified = false // indicates if anything has been clicked on this page
|
var modified = false // indicates if anything has been clicked on this page
|
||||||
var groupBalance = 0; // available group money
|
var groupBalance = 0; // available group money
|
||||||
var decimalSeparator = "."; // default decimal separator
|
var currencySeparator = "."; // default decimal separator
|
||||||
|
var currencyPrecision = 2; // default digits behind comma
|
||||||
|
var currencyUnit = "€"; // default currency
|
||||||
var toleranceIsCostly = true; // default tolerance behaviour
|
var toleranceIsCostly = true; // default tolerance behaviour
|
||||||
var isStockit = false; // Wheter the order is from stock oder normal supplier
|
var isStockit = false; // Wheter the order is from stock oder normal supplier
|
||||||
|
|
||||||
|
@ -20,8 +22,10 @@ var toleranceOthers = new Array();
|
||||||
var itemsAllocated = new Array(); // how many items the group has been allocated and should definitely get
|
var itemsAllocated = new Array(); // how many items the group has been allocated and should definitely get
|
||||||
var quantityAvailable = new Array(); // stock_order. how many items are currently in stock
|
var quantityAvailable = new Array(); // stock_order. how many items are currently in stock
|
||||||
|
|
||||||
function setDecimalSeparator(character) {
|
function setCurrencyFormat(separator, precision, unit) {
|
||||||
decimalSeparator = character;
|
currencySeparator = separator;
|
||||||
|
currencyPrecision = precision;
|
||||||
|
currencyUnit = unit;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setToleranceBehaviour(value) {
|
function setToleranceBehaviour(value) {
|
||||||
|
@ -129,7 +133,7 @@ function update(item, quantity, tolerance) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function asMoney(amount) {
|
function asMoney(amount) {
|
||||||
return String(amount.toFixed(2)).replace(/\./, ",");
|
return String(amount.toFixed(currencyPrecision)).replace(/\./, currencySeparator) + ' ' + currencyUnit;
|
||||||
}
|
}
|
||||||
|
|
||||||
function calcUnits(unitSize, quantity, tolerance) {
|
function calcUnits(unitSize, quantity, tolerance) {
|
||||||
|
|
|
@ -11,7 +11,15 @@ class Finance::OrderArticlesController < ApplicationController
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@order = Order.find(params[:order_id])
|
@order = Order.find(params[:order_id])
|
||||||
@order_article = @order.order_articles.build(params[:order_article])
|
# The article may with zero units ordered - in that case find and set amount to nonzero.
|
||||||
|
# If order_article is ordered and a new order_article is created, an error message will be
|
||||||
|
# given mentioning that the article already exists, which is desired.
|
||||||
|
@order_article = @order.order_articles.where(:article_id => params[:order_article][:article_id]).first
|
||||||
|
if @order_article and @order_article.units_to_order == 0
|
||||||
|
@order_article.units_to_order = 1
|
||||||
|
else
|
||||||
|
@order_article = @order.order_articles.build(params[:order_article])
|
||||||
|
end
|
||||||
unless @order_article.save
|
unless @order_article.save
|
||||||
render action: :new
|
render action: :new
|
||||||
end
|
end
|
||||||
|
|
|
@ -37,8 +37,8 @@ class GroupOrder < ActiveRecord::Base
|
||||||
:quantity => (goa ? goa.quantity : 0),
|
:quantity => (goa ? goa.quantity : 0),
|
||||||
:others_quantity => order_article.quantity - (goa ? goa.quantity : 0),
|
:others_quantity => order_article.quantity - (goa ? goa.quantity : 0),
|
||||||
:used_quantity => (goa ? goa.result(:quantity) : 0),
|
:used_quantity => (goa ? goa.result(:quantity) : 0),
|
||||||
:tolerance => (goa ? goa.result(:tolerance) : 0),
|
:tolerance => (goa ? goa.tolerance : 0),
|
||||||
:others_tolerance => order_article.tolerance - (goa ? goa.result(:tolerance) : 0),
|
:others_tolerance => order_article.tolerance - (goa ? goa.tolerance : 0),
|
||||||
:used_tolerance => (goa ? goa.result(:tolerance) : 0),
|
:used_tolerance => (goa ? goa.result(:tolerance) : 0),
|
||||||
:total_price => (goa ? goa.total_price : 0),
|
:total_price => (goa ? goa.total_price : 0),
|
||||||
:missing_units => order_article.missing_units,
|
:missing_units => order_article.missing_units,
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
= f.input :contact_person
|
= f.input :contact_person
|
||||||
= f.input :contact_phone
|
= f.input :contact_phone
|
||||||
= f.input :contact_address
|
= f.input :contact_address
|
||||||
= f.input :ignore_apple_restriction
|
= f.input :ignore_apple_restriction, :label => false, :inline_label => true
|
||||||
.form-actions
|
.form-actions
|
||||||
= f.button :submit
|
= f.button :submit
|
||||||
= link_to t('ui.or_cancel'), :back
|
= link_to t('ui.or_cancel'), :back
|
||||||
|
|
|
@ -22,20 +22,20 @@
|
||||||
= link_to "-", update_result_finance_group_order_article_path(group_order_article, modifier: '-'),
|
= link_to "-", update_result_finance_group_order_article_path(group_order_article, modifier: '-'),
|
||||||
method: :put, remote: true, class: 'btn btn-mini'
|
method: :put, remote: true, class: 'btn btn-mini'
|
||||||
%td.numeric
|
%td.numeric
|
||||||
= number_to_currency(group_order_article.order_article.price.fc_price * group_order_article.result, :unit => "")
|
= number_to_currency(group_order_article.order_article.price.fc_price * group_order_article.result)
|
||||||
%td.actions{:style=>"width:1em"}
|
%td.actions{:style=>"width:1em"}
|
||||||
= link_to "Bearbeiten", edit_finance_group_order_article_path(group_order_article), remote: true,
|
= link_to t('ui.edit'), edit_finance_group_order_article_path(group_order_article), remote: true,
|
||||||
class: 'btn btn-mini'
|
class: 'btn btn-mini'
|
||||||
%td.actions{:style=>"width:1em"}
|
%td.actions{:style=>"width:1em"}
|
||||||
= link_to "Löschen", finance_group_order_article_path(group_order_article), method: :delete,
|
= link_to t('ui.delete'), finance_group_order_article_path(group_order_article), method: :delete,
|
||||||
remote: true, class: 'btn btn-mini btn-danger'
|
remote: true, class: 'btn btn-mini btn-danger'
|
||||||
%td
|
%td
|
||||||
%tfoot
|
%tfoot
|
||||||
%tr
|
%tr
|
||||||
%td
|
%td
|
||||||
%td{:style => "width:8em"}= t('total_fc')
|
%td{:style => "width:8em"}= t('.total_fc')
|
||||||
%td{:id => "group_orders_sum_quantity_#{order_article.id}"}
|
%td{:id => "group_orders_sum_quantity_#{order_article.id}"}
|
||||||
= order_article.group_orders_sum[:quantity]
|
= order_article.group_orders_sum[:quantity]
|
||||||
%td.numeric{:id => "group_orders_sum_price_#{order_article.id}"}
|
%td.numeric{:id => "group_orders_sum_price_#{order_article.id}"}
|
||||||
= number_to_currency(order_article.group_orders_sum[:price], :unit => "")
|
= number_to_currency(order_article.group_orders_sum[:price])
|
||||||
%td{:colspan => "3"}
|
%td{:colspan => "3"}
|
||||||
|
|
|
@ -7,4 +7,4 @@
|
||||||
%td.numeric= number_to_currency(group_order.price)
|
%td.numeric= number_to_currency(group_order.price)
|
||||||
.form-actions
|
.form-actions
|
||||||
= link_to t('.clear'), close_finance_order_path(@order), method: :put, class: 'btn btn-primary'
|
= link_to t('.clear'), close_finance_order_path(@order), method: :put, class: 'btn btn-primary'
|
||||||
= link_to t('.or_cancle'), new_finance_order_path(order_id: @order.id)
|
= link_to t('.or_cancel'), new_finance_order_path(order_id: @order.id)
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
= f.hidden_field :order_id
|
= f.hidden_field :order_id
|
||||||
|
|
||||||
- if @invoice.delivery
|
- if @invoice.delivery
|
||||||
%p= t('.linked', what_link: link_to(t('.delivery'), [@invoice.supplier,@invoice.delivery])).html_safe
|
%p= t('finance.invoices.linked', what_link: link_to(t('finance.invoices.linked_delivery'), [@invoice.supplier,@invoice.delivery])).html_safe
|
||||||
- if @invoice.order
|
- if @invoice.order
|
||||||
%p= t('.linked', what_link: link_to(t('.order'), @invoice.order)).html_safe
|
%p= t('finance.invoices.linked', what_link: link_to(t('finance.invoices.linked_order'), @invoice.order)).html_safe
|
||||||
|
|
||||||
= f.association :supplier, hint: false
|
= f.association :supplier, hint: false
|
||||||
= f.input :number
|
= f.input :number
|
||||||
|
|
|
@ -1,12 +1,18 @@
|
||||||
- title t('.title', number: @invoice.number)
|
- title t('.title', number: @invoice.number)
|
||||||
|
|
||||||
%p
|
%p
|
||||||
%b= t 'simple_form.labels.invoice.supplier'
|
%b= t('simple_form.labels.invoice.supplier') + ':'
|
||||||
= @invoice.supplier.name
|
= @invoice.supplier.name
|
||||||
|
|
||||||
- if @invoice.delivery
|
- if @invoice.delivery
|
||||||
%p
|
%p
|
||||||
%b= t('simple_form.labels.invoice.delivery') + ':'
|
%b= t('simple_form.labels.invoice.delivery') + ':'
|
||||||
= t('.linked', what_link: link_to(t('.delivery'), [@invoice.supplier,@invoice.delivery])).html_safe
|
= t('finance.invoices.linked', what_link: link_to(t('finance.invoices.linked_delivery'), [@invoice.supplier,@invoice.delivery])).html_safe
|
||||||
|
- if @invoice.order
|
||||||
|
%p
|
||||||
|
%b= t('simple_form.labels.invoice.order') + ':'
|
||||||
|
= t('finance.invoices.linked', what_link: link_to(t('finance.invoices.linked_order'), @invoice.order)).html_safe
|
||||||
|
|
||||||
%p
|
%p
|
||||||
%b= t('simple_form.labels.invoice.number') + ':'
|
%b= t('simple_form.labels.invoice.number') + ':'
|
||||||
= @invoice.number
|
= @invoice.number
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
$(function() {
|
$(function() {
|
||||||
#{data_to_js(@ordering_data)}
|
#{data_to_js(@ordering_data)}
|
||||||
setGroupBalance(#{@ordering_data[:available_funds]});
|
setGroupBalance(#{@ordering_data[:available_funds]});
|
||||||
setDecimalSeparator(",");
|
setCurrencyFormat("#{t('number.currency.format.separator')}", #{t('number.currency.format.precision')}, "#{t('number.currency.format.unit')}");
|
||||||
setToleranceBehaviour(#{FoodsoftConfig[:tolerance_is_costly]});
|
setToleranceBehaviour(#{FoodsoftConfig[:tolerance_is_costly]});
|
||||||
setStockit(#{@order.stockit?});
|
setStockit(#{@order.stockit?});
|
||||||
});
|
});
|
||||||
|
@ -97,8 +97,7 @@
|
||||||
%input{type: 'button', value: '-', 'data-decrease_tolerance' => order_article.id}
|
%input{type: 'button', value: '-', 'data-decrease_tolerance' => order_article.id}
|
||||||
|
|
||||||
%td{id: "td_price_#{order_article.id}", style: "text-align:right; padding-right:10px; width:4em"}
|
%td{id: "td_price_#{order_article.id}", style: "text-align:right; padding-right:10px; width:4em"}
|
||||||
%span{id: "price_#{order_article.id}_display"}= number_to_currency(@ordering_data[:order_articles][order_article.id][:total_price], unit: "")
|
%span{id: "price_#{order_article.id}_display"}= number_to_currency(@ordering_data[:order_articles][order_article.id][:total_price])
|
||||||
€
|
|
||||||
.article-info
|
.article-info
|
||||||
.article-name= order_article.article.name
|
.article-name= order_article.article.name
|
||||||
.pull-right
|
.pull-right
|
||||||
|
@ -125,8 +124,7 @@
|
||||||
%tr
|
%tr
|
||||||
%td= t('.total_sum_amount') + ':'
|
%td= t('.total_sum_amount') + ':'
|
||||||
%td.currency
|
%td.currency
|
||||||
%span#total_price= @group_order.price
|
%span#total_price= number_to_currency(@group_order.price)
|
||||||
€
|
|
||||||
%tr
|
%tr
|
||||||
%td= t('.available_funds') + ':'
|
%td= t('.available_funds') + ':'
|
||||||
%td.currency= number_to_currency(@ordering_data[:available_funds])
|
%td.currency= number_to_currency(@ordering_data[:available_funds])
|
||||||
|
@ -134,8 +132,7 @@
|
||||||
%td= t('.new_funds') + ':'
|
%td= t('.new_funds') + ':'
|
||||||
%td.currency
|
%td.currency
|
||||||
%strong
|
%strong
|
||||||
%span#new_balance= @ordering_data[:available_funds] - @group_order.price
|
%span#new_balance= number_to_currency(@ordering_data[:available_funds] - @group_order.price)
|
||||||
€
|
|
||||||
#order-button
|
#order-button
|
||||||
= submit_tag( t('.action_save'), id: 'submit_button', class: 'btn btn-primary' )
|
= submit_tag( t('.action_save'), id: 'submit_button', class: 'btn btn-primary' )
|
||||||
#{link_to t('ui.or_cancel'), group_orders_path}
|
#{link_to t('ui.or_cancel'), group_orders_path}
|
||||||
|
|
|
@ -14,12 +14,12 @@
|
||||||
.control-group
|
.control-group
|
||||||
%label(for='nick' class='control-label')= t '.user'
|
%label(for='nick' class='control-label')= t '.user'
|
||||||
.controls
|
.controls
|
||||||
= text_field_tag 'nick'
|
= text_field_tag 'nick', nil, autocapitalize: 'off', autocorrect: 'off'
|
||||||
|
|
||||||
.control-group
|
.control-group
|
||||||
%label(for='password' class='control-label')= t '.password'
|
%label(for='password' class='control-label')= t '.password'
|
||||||
.controls
|
.controls
|
||||||
= password_field_tag 'password'
|
= password_field_tag 'password', nil, autocapitalize: 'off', autocorrect: 'off'
|
||||||
|
|
||||||
.control-group
|
.control-group
|
||||||
.controls
|
.controls
|
||||||
|
|
|
@ -559,8 +559,8 @@ de:
|
||||||
confirm:
|
confirm:
|
||||||
clear: Abschließen
|
clear: Abschließen
|
||||||
first_paragraph: ! 'Wenn die Bestellung abgeschlossen wird, werden ebenfalls alle Gruppenkonten aktualisiert.<br />Die Konten werden wie folgt belastet:'
|
first_paragraph: ! 'Wenn die Bestellung abgeschlossen wird, werden ebenfalls alle Gruppenkonten aktualisiert.<br />Die Konten werden wie folgt belastet:'
|
||||||
or_cancle: oder zurück zur Abrechnung
|
or_cancel: oder zurück zur Abrechnung
|
||||||
title: Bestellung abschließen
|
title: Bestellung abrechnen
|
||||||
edit_results_by_articles:
|
edit_results_by_articles:
|
||||||
add_article: Artikel hinzufügen
|
add_article: Artikel hinzufügen
|
||||||
amount: Menge
|
amount: Menge
|
||||||
|
@ -585,7 +585,7 @@ de:
|
||||||
invoice_date: ! 'Rechnungsdatum:'
|
invoice_date: ! 'Rechnungsdatum:'
|
||||||
invoice_number: ! 'Rechnungsnummer:'
|
invoice_number: ! 'Rechnungsnummer:'
|
||||||
minus_refund_calculated: ! '- Pfand berechnet:'
|
minus_refund_calculated: ! '- Pfand berechnet:'
|
||||||
new: Neue Rechnung erstellen
|
new: neue Rechnung erstellen
|
||||||
new_body: ! 'Eine Rechnung für diese Bestellung anlegen:'
|
new_body: ! 'Eine Rechnung für diese Bestellung anlegen:'
|
||||||
plus_refund_credited: ! '+ Pfand gutgeschrieben:'
|
plus_refund_credited: ! '+ Pfand gutgeschrieben:'
|
||||||
refund_adjusted_amount: ! 'pfandbereinigter Betrag:'
|
refund_adjusted_amount: ! 'pfandbereinigter Betrag:'
|
||||||
|
@ -682,23 +682,20 @@ de:
|
||||||
invoices:
|
invoices:
|
||||||
edit:
|
edit:
|
||||||
title: Rechnung bearbeiten
|
title: Rechnung bearbeiten
|
||||||
form:
|
|
||||||
delivery: Lieferung
|
|
||||||
linked: Diese Rechnung ist mit einer %{what_link} verknüpft.
|
|
||||||
order: Bestellung
|
|
||||||
index:
|
index:
|
||||||
action_new: Neue Rechnung anlegen
|
action_new: Neue Rechnung anlegen
|
||||||
title: Rechnungen
|
title: Rechnungen
|
||||||
invoices:
|
invoices:
|
||||||
confirm_delete: Bist Du sicher?
|
confirm_delete: Bist Du sicher?
|
||||||
delivery: Lieferung
|
delivery: Lieferung
|
||||||
|
linked: Diese Rechnung ist mit %{what_link} verknüpft.
|
||||||
|
linked_delivery: einer Lieferung
|
||||||
|
linked_order: einer Bestellung
|
||||||
new:
|
new:
|
||||||
back: Züruck
|
back: Züruck
|
||||||
title: Neue Rechnung anlegen
|
title: Neue Rechnung anlegen
|
||||||
show:
|
show:
|
||||||
back: Züruck
|
back: Züruck
|
||||||
delivery: Lieferung
|
|
||||||
linked: Diese Rechnung ist mit einer %{what_link} verknüpft.
|
|
||||||
title: Rechnung %{number}
|
title: Rechnung %{number}
|
||||||
order_articles:
|
order_articles:
|
||||||
edit:
|
edit:
|
||||||
|
@ -799,7 +796,7 @@ de:
|
||||||
account_balance: Kontostand
|
account_balance: Kontostand
|
||||||
available_funds: verfügbares Guthaben
|
available_funds: verfügbares Guthaben
|
||||||
finished_orders: nicht abgerechnete Bestellungen
|
finished_orders: nicht abgerechnete Bestellungen
|
||||||
open_orders: laufende Bestellungen
|
open_orders: Laufende Bestellungen
|
||||||
title: Guthaben
|
title: Guthaben
|
||||||
title: Bestellüberblick
|
title: Bestellüberblick
|
||||||
messages:
|
messages:
|
||||||
|
|
|
@ -557,12 +557,12 @@ en:
|
||||||
notice: Order was accounted succesfully, the balance of the account was updated.
|
notice: Order was accounted succesfully, the balance of the account was updated.
|
||||||
close_direct:
|
close_direct:
|
||||||
alert: ! 'Order can not be closed: %{message}'
|
alert: ! 'Order can not be closed: %{message}'
|
||||||
notice: Order was closed
|
notice: Order was closed.
|
||||||
confirm:
|
confirm:
|
||||||
clear: Close
|
clear: Close
|
||||||
first_paragraph: ! 'When the order is closed, all group accounts will be updated.<br />The accounts will be charged as follows:'
|
first_paragraph: ! 'When the order is closed, all group accounts will be updated.<br />The accounts will be charged as follows:'
|
||||||
or_cancle: or back to accounting
|
or_cancel: or back to accounting
|
||||||
title: Close order
|
title: Settle order
|
||||||
edit_results_by_articles:
|
edit_results_by_articles:
|
||||||
add_article: Add article
|
add_article: Add article
|
||||||
amount: Amount
|
amount: Amount
|
||||||
|
@ -577,7 +577,7 @@ en:
|
||||||
add_group: Add group
|
add_group: Add group
|
||||||
group: Group
|
group: Group
|
||||||
total: Total costs
|
total: Total costs
|
||||||
total_fc: Sum (FC-Price)
|
total_fc: Sum (FC-price)
|
||||||
units: Units
|
units: Units
|
||||||
index:
|
index:
|
||||||
title: Closed orders
|
title: Closed orders
|
||||||
|
@ -587,7 +587,7 @@ en:
|
||||||
invoice_date: ! 'Invoice date:'
|
invoice_date: ! 'Invoice date:'
|
||||||
invoice_number: ! 'Invoice number:'
|
invoice_number: ! 'Invoice number:'
|
||||||
minus_refund_calculated: ! '- deposit charged:'
|
minus_refund_calculated: ! '- deposit charged:'
|
||||||
new: Create new invoice
|
new: create new invoice
|
||||||
new_body: ! 'Create an invoice for this order:'
|
new_body: ! 'Create an invoice for this order:'
|
||||||
plus_refund_credited: ! '+ deposit returned:'
|
plus_refund_credited: ! '+ deposit returned:'
|
||||||
refund_adjusted_amount: ! 'amount adjusted for refund:'
|
refund_adjusted_amount: ! 'amount adjusted for refund:'
|
||||||
|
@ -617,7 +617,7 @@ en:
|
||||||
ended: ended
|
ended: ended
|
||||||
last_edited_by: Last edited by
|
last_edited_by: Last edited by
|
||||||
name: Supplier
|
name: Supplier
|
||||||
no_closed_orders: At the moment there are no ended orders.
|
no_closed_orders: At the moment there are no closed orders.
|
||||||
state: State
|
state: State
|
||||||
summary:
|
summary:
|
||||||
changed: Data was changed!
|
changed: Data was changed!
|
||||||
|
@ -676,7 +676,7 @@ en:
|
||||||
group: Group
|
group: Group
|
||||||
last_transactions: Last transactions
|
last_transactions: Last transactions
|
||||||
note: Note
|
note: Note
|
||||||
open_transactions: not yet accounted
|
open_transactions: not yet settled
|
||||||
show_all: show all
|
show_all: show all
|
||||||
supplier: supplier
|
supplier: supplier
|
||||||
title: Finances
|
title: Finances
|
||||||
|
@ -684,23 +684,20 @@ en:
|
||||||
invoices:
|
invoices:
|
||||||
edit:
|
edit:
|
||||||
title: Edit invoice
|
title: Edit invoice
|
||||||
form:
|
|
||||||
delivery: delivery
|
|
||||||
linked: This invoice is linked to a %{what_link}.
|
|
||||||
order: order
|
|
||||||
index:
|
index:
|
||||||
action_new: Create new invoice
|
action_new: Create new invoice
|
||||||
title: Invoices
|
title: Invoices
|
||||||
invoices:
|
invoices:
|
||||||
confirm_delete: Are you sure?
|
confirm_delete: Are you sure?
|
||||||
delivery: Delivery
|
delivery: Delivery
|
||||||
|
linked: This invoice is linked to %{what_link}.
|
||||||
|
linked_delivery: a delivery
|
||||||
|
linked_order: an order
|
||||||
new:
|
new:
|
||||||
back: Back
|
back: Back
|
||||||
title: Create new invoice
|
title: Create new invoice
|
||||||
show:
|
show:
|
||||||
back: Back
|
back: Back
|
||||||
delivery: delivery
|
|
||||||
linked: This invoice is linked to a %{what_link}.
|
|
||||||
title: Invoice %{number}
|
title: Invoice %{number}
|
||||||
order_articles:
|
order_articles:
|
||||||
edit:
|
edit:
|
||||||
|
@ -753,8 +750,8 @@ en:
|
||||||
desc: View all %{link} here.
|
desc: View all %{link} here.
|
||||||
open_orders: current orders
|
open_orders: current orders
|
||||||
title: Orders of %{group}
|
title: Orders of %{group}
|
||||||
title_closed: Accounted
|
title_closed: settled
|
||||||
title_open: Completed/not accounted
|
title_open: closed/not settled
|
||||||
create:
|
create:
|
||||||
error_general: The order couldn’t be updated due to a bug.
|
error_general: The order couldn’t be updated due to a bug.
|
||||||
error_stale: Someone else has ordered in the meantime, couldn't update the order.
|
error_stale: Someone else has ordered in the meantime, couldn't update the order.
|
||||||
|
@ -793,14 +790,14 @@ en:
|
||||||
index:
|
index:
|
||||||
closed_orders:
|
closed_orders:
|
||||||
more: more...
|
more: more...
|
||||||
title: Closed orders
|
title: Settled orders
|
||||||
finished_orders:
|
finished_orders:
|
||||||
title: Unaccounted orders
|
title: Unsettled orders
|
||||||
total_sum: Total sum
|
total_sum: Total sum
|
||||||
funds:
|
funds:
|
||||||
account_balance: Account balance
|
account_balance: Account balance
|
||||||
available_funds: Available credit
|
available_funds: Available credit
|
||||||
finished_orders: Unaccounted orders
|
finished_orders: unsettled orders
|
||||||
open_orders: Current orders
|
open_orders: Current orders
|
||||||
title: Credit
|
title: Credit
|
||||||
title: Orders overview
|
title: Orders overview
|
||||||
|
@ -830,7 +827,7 @@ en:
|
||||||
total_price: Total price
|
total_price: Total price
|
||||||
unit_price: Unit price
|
unit_price: Unit price
|
||||||
units: Units
|
units: Units
|
||||||
closed_by: Accounted by %{user}
|
closed_by: Settled by %{user}
|
||||||
comment: Comment
|
comment: Comment
|
||||||
comments:
|
comments:
|
||||||
title: Comments
|
title: Comments
|
||||||
|
@ -1319,13 +1316,13 @@ en:
|
||||||
ended_orders: Closed orders
|
ended_orders: Closed orders
|
||||||
ending: End
|
ending: End
|
||||||
new_order: Create new order
|
new_order: Create new order
|
||||||
no_open_orders: There are no current orders.
|
no_open_orders: There are currently no open orders.
|
||||||
note: Note
|
note: Note
|
||||||
open_orders: Current orders
|
open_orders: Current orders
|
||||||
supplier: Supplier
|
supplier: Supplier
|
||||||
title: Manage orders
|
title: Manage orders
|
||||||
model:
|
model:
|
||||||
error_closed: Order was already accounted for
|
error_closed: Order was already settled
|
||||||
error_nosel: At least one article must be selected
|
error_nosel: At least one article must be selected
|
||||||
error_starts_before_ends: must be after the start date (or remain empty)
|
error_starts_before_ends: must be after the start date (or remain empty)
|
||||||
notice_close: ! 'Order: %{name}, until %{ends}'
|
notice_close: ! 'Order: %{name}, until %{ends}'
|
||||||
|
@ -1366,10 +1363,10 @@ en:
|
||||||
sort_group: Sorted in groups
|
sort_group: Sorted in groups
|
||||||
supplier: ! 'Supplier:'
|
supplier: ! 'Supplier:'
|
||||||
title: ! 'Order: %{name}'
|
title: ! 'Order: %{name}'
|
||||||
warn_not_closed: Warning, order is not accounted yet.
|
warn_not_closed: Warning, order is not yet settled.
|
||||||
state:
|
state:
|
||||||
closed: closed
|
closed: settled
|
||||||
finished: finished
|
finished: closed
|
||||||
open: open
|
open: open
|
||||||
update:
|
update:
|
||||||
notice: The order was updated.
|
notice: The order was updated.
|
||||||
|
|
|
@ -523,8 +523,8 @@ nl:
|
||||||
confirm:
|
confirm:
|
||||||
clear: Sluiten
|
clear: Sluiten
|
||||||
first_paragraph: ! 'Wanneer de bestelling gesloten wordt, worden alle tegoeden van huishoudens bijgewerkt.<br />De tegoeden worden als volgt belast:'
|
first_paragraph: ! 'Wanneer de bestelling gesloten wordt, worden alle tegoeden van huishoudens bijgewerkt.<br />De tegoeden worden als volgt belast:'
|
||||||
or_cancle: of terug naar afrekenen
|
or_cancel: of terug naar afrekenen
|
||||||
title: Order sluiten
|
title: Order afrekenen
|
||||||
edit_results_by_articles:
|
edit_results_by_articles:
|
||||||
add_article: Artikel toevoegen
|
add_article: Artikel toevoegen
|
||||||
amount: Aantal
|
amount: Aantal
|
||||||
|
@ -549,7 +549,7 @@ nl:
|
||||||
invoice_date: ! 'Factuurdatum:'
|
invoice_date: ! 'Factuurdatum:'
|
||||||
invoice_number: ! 'Factuurnummer:'
|
invoice_number: ! 'Factuurnummer:'
|
||||||
minus_refund_calculated: ! '- statiegeld berekend:'
|
minus_refund_calculated: ! '- statiegeld berekend:'
|
||||||
new: Factuur toevoegen
|
new: factuur toevoegen
|
||||||
new_body: ! 'Een factuur aan deze rekening toevoegen:'
|
new_body: ! 'Een factuur aan deze rekening toevoegen:'
|
||||||
plus_refund_credited: ! '+ statiegeld teruggekregen:'
|
plus_refund_credited: ! '+ statiegeld teruggekregen:'
|
||||||
refund_adjusted_amount: ! 'bedrag gecorrigeerd voor statiegeld:'
|
refund_adjusted_amount: ! 'bedrag gecorrigeerd voor statiegeld:'
|
||||||
|
@ -579,7 +579,7 @@ nl:
|
||||||
ended: beëindigd
|
ended: beëindigd
|
||||||
last_edited_by: Laatst aangepast door
|
last_edited_by: Laatst aangepast door
|
||||||
name: Leverancier
|
name: Leverancier
|
||||||
no_closed_orders: Momenteel zijn er geen beëindigde bestellingen.
|
no_closed_orders: Momenteel zijn er geen gesloten bestellingen.
|
||||||
state: Status
|
state: Status
|
||||||
summary:
|
summary:
|
||||||
changed:
|
changed:
|
||||||
|
@ -646,23 +646,20 @@ nl:
|
||||||
invoices:
|
invoices:
|
||||||
edit:
|
edit:
|
||||||
title: Factuur bewerken
|
title: Factuur bewerken
|
||||||
form:
|
|
||||||
delivery: levering
|
|
||||||
linked: Deze factuur is met aan %{what_link} gekoppeld.
|
|
||||||
order: bestelling
|
|
||||||
index:
|
index:
|
||||||
action_new: Nieuwe factuur toevoegen
|
action_new: Nieuwe factuur toevoegen
|
||||||
title: Facturen
|
title: Facturen
|
||||||
invoices:
|
invoices:
|
||||||
confirm_delete: Weet je het zeker?
|
confirm_delete: Weet je het zeker?
|
||||||
delivery: Levering
|
delivery: Levering
|
||||||
|
linked: Deze factuur is aan %{what_link} gekoppeld.
|
||||||
|
linked_delivery: een levering
|
||||||
|
linked_order: een bestelling
|
||||||
new:
|
new:
|
||||||
back: Terug
|
back: Terug
|
||||||
title: Nieuwe factuur toevoegen
|
title: Nieuwe factuur toevoegen
|
||||||
show:
|
show:
|
||||||
back: Terug
|
back: Terug
|
||||||
delivery: levering
|
|
||||||
linked: Deze factuur is aan een %{what_link} gekoppeld.
|
|
||||||
title: Factuur %{number}
|
title: Factuur %{number}
|
||||||
order_articles:
|
order_articles:
|
||||||
edit:
|
edit:
|
||||||
|
@ -715,7 +712,7 @@ nl:
|
||||||
desc: Bekijk hier alle %{link}.
|
desc: Bekijk hier alle %{link}.
|
||||||
open_orders: lopende bestellingen
|
open_orders: lopende bestellingen
|
||||||
title: Bestellingen van %{group}
|
title: Bestellingen van %{group}
|
||||||
title_closed: Afgerekend
|
title_closed: afgerekend
|
||||||
title_open: gesloten/niet afgerekend
|
title_open: gesloten/niet afgerekend
|
||||||
create:
|
create:
|
||||||
error_general: De bestelling kon niet bijgewerkt worden vanwege een fout.
|
error_general: De bestelling kon niet bijgewerkt worden vanwege een fout.
|
||||||
|
@ -757,12 +754,12 @@ nl:
|
||||||
more: meer...
|
more: meer...
|
||||||
title: Afgerekende bestellingen
|
title: Afgerekende bestellingen
|
||||||
finished_orders:
|
finished_orders:
|
||||||
title:
|
title: Niet afgerekende bestellingen
|
||||||
total_sum:
|
total_sum:
|
||||||
funds:
|
funds:
|
||||||
account_balance:
|
account_balance:
|
||||||
available_funds:
|
available_funds:
|
||||||
finished_orders:
|
finished_orders: niet afgerekende bestellingen
|
||||||
open_orders: Lopende bestellingen
|
open_orders: Lopende bestellingen
|
||||||
title: Credit
|
title: Credit
|
||||||
title: Besteloverzicht
|
title: Besteloverzicht
|
||||||
|
@ -1040,7 +1037,7 @@ nl:
|
||||||
email_is_public:
|
email_is_public:
|
||||||
name_is_public:
|
name_is_public:
|
||||||
negative_balance:
|
negative_balance:
|
||||||
order_finished:
|
order_finished: Informeer me over mijn bestelresultaat (wanneer de bestelling gesloten wordt).
|
||||||
phone_is_public:
|
phone_is_public:
|
||||||
send_as_email:
|
send_as_email:
|
||||||
upcoming_tasks:
|
upcoming_tasks:
|
||||||
|
@ -1175,16 +1172,16 @@ nl:
|
||||||
action_end:
|
action_end:
|
||||||
confirm_delete:
|
confirm_delete:
|
||||||
confirm_end:
|
confirm_end:
|
||||||
ended_orders:
|
ended_orders: Gesloten bestellingen
|
||||||
ending:
|
ending:
|
||||||
new_order:
|
new_order:
|
||||||
no_open_orders:
|
no_open_orders: Er zijn momenteel geen lopende bestellingen.
|
||||||
note:
|
note:
|
||||||
open_orders:
|
open_orders: Lopende bestellingen
|
||||||
supplier:
|
supplier:
|
||||||
title:
|
title:
|
||||||
model:
|
model:
|
||||||
error_closed:
|
error_closed: Bestelling was al afgerekend
|
||||||
error_nosel:
|
error_nosel:
|
||||||
error_starts_before_ends:
|
error_starts_before_ends:
|
||||||
notice_close:
|
notice_close:
|
||||||
|
@ -1223,11 +1220,11 @@ nl:
|
||||||
sort_group:
|
sort_group:
|
||||||
supplier:
|
supplier:
|
||||||
title:
|
title:
|
||||||
warn_not_closed:
|
warn_not_closed: Opgelet, bestelling is nog niet afgerekend.
|
||||||
state:
|
state:
|
||||||
closed:
|
closed: afgerekend
|
||||||
finished:
|
finished: gesloten
|
||||||
open:
|
open: lopend
|
||||||
update:
|
update:
|
||||||
notice:
|
notice:
|
||||||
pages:
|
pages:
|
||||||
|
|
4
test/fixtures/articles.yml
vendored
4
test/fixtures/articles.yml
vendored
|
@ -1,8 +1,4 @@
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
<<<<<<< HEAD:test/fixtures/articles.yml
|
|
||||||
=======
|
|
||||||
# Schema version: 20090325175756
|
|
||||||
>>>>>>> wiki:test/fixtures/articles.yml
|
|
||||||
#
|
#
|
||||||
# Table name: articles
|
# Table name: articles
|
||||||
#
|
#
|
||||||
|
|
7
test/fixtures/groups.yml
vendored
7
test/fixtures/groups.yml
vendored
|
@ -3,6 +3,7 @@ admins:
|
||||||
type: Workgroup
|
type: Workgroup
|
||||||
name: Administrators
|
name: Administrators
|
||||||
description: System administrators.
|
description: System administrators.
|
||||||
|
created_on: <%= 5.weeks.ago.to_s(:db) %>
|
||||||
role_admin: true
|
role_admin: true
|
||||||
role_suppliers: true
|
role_suppliers: true
|
||||||
role_article_meta: true
|
role_article_meta: true
|
||||||
|
@ -11,12 +12,8 @@ admins:
|
||||||
bananas:
|
bananas:
|
||||||
type: Ordergroup
|
type: Ordergroup
|
||||||
name: Banangroup
|
name: Banangroup
|
||||||
|
created_on: <%= 4.weeks.ago.to_s(:db) %>
|
||||||
account_balance: 100.00
|
account_balance: 100.00
|
||||||
account_updated: <%= 1.weeks.ago.to_s(:db) %>
|
|
||||||
contact_person: Tim
|
contact_person: Tim
|
||||||
contact_phone: 030 123132456
|
contact_phone: 030 123132456
|
||||||
contact_address: Waldermarstrasse 43, 10988 Berlin
|
contact_address: Waldermarstrasse 43, 10988 Berlin
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
13
test/fixtures/suppliers.yml
vendored
13
test/fixtures/suppliers.yml
vendored
|
@ -1,8 +1,4 @@
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
<<<<<<< HEAD:test/fixtures/suppliers.yml
|
|
||||||
=======
|
|
||||||
# Schema version: 20090325175756
|
|
||||||
>>>>>>> wiki:test/fixtures/suppliers.yml
|
|
||||||
#
|
#
|
||||||
# Table name: suppliers
|
# Table name: suppliers
|
||||||
#
|
#
|
||||||
|
@ -38,12 +34,3 @@ terra:
|
||||||
Terra possibly delivers also on other days than tuesday. Don't
|
Terra possibly delivers also on other days than tuesday. Don't
|
||||||
hesitate to ask for it.
|
hesitate to ask for it.
|
||||||
min_order_quantity: 80,-€ (gross)
|
min_order_quantity: 80,-€ (gross)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -9,5 +9,15 @@ class ActiveSupport::TestCase
|
||||||
# -- they do not yet inherit this setting
|
# -- they do not yet inherit this setting
|
||||||
fixtures :all
|
fixtures :all
|
||||||
|
|
||||||
# Add more helper methods to be used by all tests here...
|
def login(nick='admin', pass='secret')
|
||||||
|
open_session do |session|
|
||||||
|
session.post '/f/login', nick: nick, password: pass
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def logout
|
||||||
|
open_session do |session|
|
||||||
|
session.post '/f/logout'
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
require File.dirname(__FILE__) + '/../test_helper'
|
require File.dirname(__FILE__) + '/../test_helper'
|
||||||
|
|
||||||
class SupplierTest < Test::Unit::TestCase
|
class SupplierTest < ActiveSupport::TestCase
|
||||||
fixtures :suppliers
|
fixtures :suppliers
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@supplier = Supplier.find_by_name("Terra")
|
@supplier = Supplier.find_by_name("Terra")
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_read
|
test 'read' do
|
||||||
assert_equal "Terra", @supplier.name
|
assert_equal "Terra", @supplier.name
|
||||||
assert_equal "www.terra-natur.de", @supplier.url
|
assert_equal "www.terra-natur.de", @supplier.url
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_update
|
test 'update' do
|
||||||
assert_equal "tuesday", @supplier.delivery_days
|
assert_equal "tuesday", @supplier.delivery_days
|
||||||
@supplier.delivery_days = 'wednesday'
|
@supplier.delivery_days = 'wednesday'
|
||||||
assert @supplier.save, @supplier.errors.full_messages.join("; ")
|
assert @supplier.save, @supplier.errors.full_messages.join("; ")
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
require File.dirname(__FILE__) + '/../test_helper'
|
require File.dirname(__FILE__) + '/../test_helper'
|
||||||
|
|
||||||
class UserTest < Test::Unit::TestCase
|
class UserTest < ActiveSupport::TestCase
|
||||||
fixtures :users
|
fixtures :users
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@admin = users(:admin)
|
@admin = users(:admin)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_read_user
|
test 'read_user' do
|
||||||
assert_kind_of User, @admin
|
assert_kind_of User, @admin
|
||||||
assert_equal "Anton", @admin.first_name
|
assert_equal "Anton", @admin.first_name
|
||||||
assert_equal "Admininistrator", @admin.last_name
|
assert_equal "Admininistrator", @admin.last_name
|
||||||
|
@ -15,20 +15,25 @@ class UserTest < Test::Unit::TestCase
|
||||||
assert @admin.role_admin?
|
assert @admin.role_admin?
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_create_and_read_password
|
test 'create_and_read_password' do
|
||||||
@admin.set_password({:required => true}, "secret", "secret")
|
@admin.password = "some_secret"
|
||||||
|
@admin.password_confirmation = @admin.password
|
||||||
|
assert @admin.valid?
|
||||||
|
assert @admin.has_password("some_secret")
|
||||||
|
end
|
||||||
|
|
||||||
|
test 'invalid_password' do
|
||||||
|
@admin.password = "foo"
|
||||||
|
@admin.password_confirmation = @admin.password
|
||||||
|
assert @admin.invalid?
|
||||||
|
assert_equal [I18n.t('activemodel.errors.messages.too_short', count: 5)], @admin.errors[:password]
|
||||||
|
end
|
||||||
|
|
||||||
|
test 'password_not_match' do
|
||||||
|
@admin.password = "foobar"
|
||||||
|
@admin.password_confirmation = "foobor"
|
||||||
@admin.save
|
@admin.save
|
||||||
assert @admin.has_password("secret")
|
assert_equal [I18n.t('activemodel.errors.messages.confirmation')], @admin.errors[:password]
|
||||||
end
|
|
||||||
|
|
||||||
def test_invalid_password
|
|
||||||
@admin.set_password({:required => true}, "foo", "foo")
|
|
||||||
assert_equal 'Passwort muss zwischen 6 u. 25 Zeichen haben', @admin.errors.on_base
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_password_not_match
|
|
||||||
@admin.set_password({:required => true}, "foobar", "foobor")
|
|
||||||
assert_equal 'Passworteingaben stimmen nicht überein', @admin.errors.on_base
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue