merge branch minimum_balance into master (closes #133)

This commit is contained in:
wvengen 2013-07-10 22:02:36 +02:00
parent d397132f7b
commit 33d3b9c466
3 changed files with 11 additions and 1 deletions

View file

@ -10,6 +10,7 @@ var groupBalance = 0; // available group money
var currencySeparator = "."; // default decimal separator
var currencyPrecision = 2; // default digits behind comma
var currencyUnit = "€"; // default currency
var minimumBalance = 0; // minimum group balance for the order to be succesful
var toleranceIsCostly = true; // default tolerance behaviour
var isStockit = false; // Wheter the order is from stock oder normal supplier
@ -40,6 +41,10 @@ function setGroupBalance(amount) {
groupBalance = amount;
}
function setMinimumBalance(amount) {
minimumBalance = amount;
}
function addData(orderArticleId, itemPrice, itemUnit, itemSubtotal, itemQuantityOthers, itemToleranceOthers, allocated, available) {
var i = orderArticleId;
price[i] = itemPrice;
@ -159,7 +164,7 @@ function updateBalance() {
$('#total_balance').val(asMoney(balance));
// determine bgcolor and submit button state according to balance
var bgcolor = '';
if (balance < 0) {
if (balance < minimumBalance) {
bgcolor = '#FF0000';
$('#submit_button').attr('disabled', 'disabled')
} else {

View file

@ -4,6 +4,7 @@
#{data_to_js(@ordering_data)}
setGroupBalance(#{@ordering_data[:available_funds]});
setCurrencyFormat("#{t('number.currency.format.separator')}", #{t('number.currency.format.precision')}, "#{t('number.currency.format.unit')}");
setMinimumBalance(#{FoodsoftConfig[:minimum_balance] or 0});
setToleranceBehaviour(#{FoodsoftConfig[:tolerance_is_costly]});
setStockit(#{@order.stockit?});
});

View file

@ -48,6 +48,10 @@ default: &defaults
# Comment out this option to activate this restriction
# stop_ordering_under: 75
# ordergroups can only order when their balance is higher than or equal to this
# not fully enforced right now, since the check is only client-side
# minimum_balance: 0
# email address to be used as sender
email_sender: foodsoft@foodcoop.test