diff --git a/debian/changelog b/debian/changelog
index 4684b5cf..81be2466 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-hedera-web (1.406.21) stable; urgency=low
+hedera-web (1.406.22) stable; urgency=low
* Initial Release.
diff --git a/forms/ecomerce/checkout/checkout.js b/forms/ecomerce/checkout/checkout.js
index 9de6169b..61b368cf 100644
--- a/forms/ecomerce/checkout/checkout.js
+++ b/forms/ecomerce/checkout/checkout.js
@@ -25,11 +25,23 @@ Hedera.Checkout = new Class ({
} else
var i = defaultsForm;
- if (!date || date.getTime() <(new Date()).getTime()) {
+ if (!date || date.getTime() < (new Date()).getTime()) {
date = new Date();
+ var addDays = 0;
+
+ switch(date.getDay()) {
+ case 6: // Saturday
+ addDays += 2;
+ break;
+ case 0: // Sunday
+ addDays++;
+ break;
+ }
if (i.get('deliveryMethod') != 'PICKUP')
- date.setTime(date.getTime() + 86400000);
+ addDays++;
+
+ date.setTime(date.getTime() + addDays * 86400000);
}
this.$('date').value = date;
@@ -175,7 +187,26 @@ Hedera.Checkout = new Class ({
},
onAgenciesReady: function(model) {
- if (model.ready && model.numRows == 0)
+ if (!model.ready) return;
+
+ if (model.numRows > 0) {
+ var agency;
+ var defaults = [
+ this.$('order-form').get('agencyModeFk'),
+ this.$('defaults').get('agencyModeFk'),
+ this.$('defaults').get('defaultAgencyFk')
+ ];
+
+ for (var i = 0; i < defaults.length; i++) {
+ agency = defaults[i];
+ if (model.search('id', agency) !== -1)
+ break;
+ }
+
+ this.autoStepLocked = true;
+ this.$('agency').value = agency;
+ this.autoStepLocked = false;
+ } else
Htk.Toast.showError(_('NoAgeciesAvailableForDate'));
},
diff --git a/forms/ecomerce/checkout/ui.xml b/forms/ecomerce/checkout/ui.xml
index db9373fa..4512bc91 100644
--- a/forms/ecomerce/checkout/ui.xml
+++ b/forms/ecomerce/checkout/ui.xml
@@ -6,7 +6,7 @@
- SELECT deliveryMethod, agencyModeFk, addressFk
+ SELECT deliveryMethod, agencyModeFk, addressFk, defaultAgencyFk
FROM myBasketDefaults
diff --git a/package.json b/package.json
index c5216949..39947a3a 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "hedera-web",
- "version": "1.406.21",
+ "version": "1.406.22",
"description": "Verdnatura web page",
"license": "GPL-3.0",
"repository": {