diff --git a/client/src/js/components/bhDateEditor.js b/client/src/js/components/bhDateEditor.js
index a3820d6799..de507c0437 100644
--- a/client/src/js/components/bhDateEditor.js
+++ b/client/src/js/components/bhDateEditor.js
@@ -6,6 +6,7 @@ angular.module('bhima.components')
dateValue : '<', // one-way binding
onChange : '&',
minDate : '',
+ // required : '', // FIXME(@jniles) - finish this
maxDate : '',
allowFutureDate : '',
disabled : '',
diff --git a/client/src/modules/offdays/modals/offday.modal.html b/client/src/modules/offdays/modals/offday.modal.html
index 8fc078c5ea..40a4101d17 100644
--- a/client/src/modules/offdays/modals/offday.modal.html
+++ b/client/src/modules/offdays/modals/offday.modal.html
@@ -22,11 +22,12 @@
-
-
+
+
(%)
diff --git a/client/src/modules/offdays/modals/offday.modal.js b/client/src/modules/offdays/modals/offday.modal.js
index 3a06d623eb..5e71afd5ca 100644
--- a/client/src/modules/offdays/modals/offday.modal.js
+++ b/client/src/modules/offdays/modals/offday.modal.js
@@ -5,6 +5,12 @@ OffdayModalController.$inject = [
'$state', 'OffdayService', 'NotifyService', 'appcache', 'moment', 'params',
];
+/**
+ * @function OffdayModalController
+ *
+ * @description
+ * This modal sets the offdays for the payroll module.
+ */
function OffdayModalController($state, Offdays, Notify, AppCache, moment, params) {
const vm = this;
vm.offday = {};
@@ -13,11 +19,9 @@ function OffdayModalController($state, Offdays, Notify, AppCache, moment, params
if (params.isCreateState || params.id) {
cache.stateParams = params;
- vm.stateParams = cache.stateParams;
- } else {
- vm.stateParams = cache.stateParams;
}
+ vm.stateParams = cache.stateParams;
vm.isCreateState = vm.stateParams.isCreateState;
// update the date
@@ -41,11 +45,13 @@ function OffdayModalController($state, Offdays, Notify, AppCache, moment, params
function submit(offdayForm) {
if (offdayForm.$invalid) { return 0; }
- vm.offday.date = moment(vm.offday.date).format('YYYY-MM-DD');
+ const data = { ...vm.offday };
+
+ data.date = moment(data.date).format('YYYY-MM-DD');
const promise = (vm.isCreateState)
- ? Offdays.create(vm.offday)
- : Offdays.update(vm.offday.id, vm.offday);
+ ? Offdays.create(data)
+ : Offdays.update(vm.offday.id, data);
return promise
.then(() => {
diff --git a/test/data.sql b/test/data.sql
index 2720d03b04..b54e05a336 100644
--- a/test/data.sql
+++ b/test/data.sql
@@ -9,8 +9,9 @@ SET NAMES 'utf8';
INSERT INTO `enterprise` VALUES
(1, 'Test Enterprise', 'TE', '243 81 504 0540', 'enterprise@test.org', NULL, HUID('1f162a10-9f67-4788-9eff-c1fea42fcc9b'), NULL, 2, 103, NULL, NULL);
-INSERT INTO `enterprise_setting` (enterprise_id, enable_price_lock, enable_password_validation, enable_delete_records, enable_auto_email_report, enable_auto_stock_accounting, enable_auto_purchase_order_confirmation) VALUES
- (1, 0, 1, 1, 1, 0, 0);
+INSERT INTO `enterprise_setting`
+ (enterprise_id, enable_price_lock, enable_password_validation, enable_delete_records, enable_auto_email_report, enable_auto_stock_accounting, enable_auto_purchase_order_confirmation, month_average_consumption)
+ VALUES (1, 0, 1, 1, 1, 0, 0, 12);
-- Project
INSERT INTO `project` VALUES
@@ -3050,6 +3051,7 @@ VALUES
(22, 'taux_de_paie', 'TauxPaie', 0, 0, 0, 0, 0, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 10, 1, 'is_pay_rate', NULL, 0),
(23, 'Salire_brute', 'Salaire brute', 0, 0, 0, 0, 0, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 11, 1, 'is_gross_salary', NULL, 0),
(24, 'Nombre_deJours', 'Nbr_jrs', 0, 0, 0, 0, 0, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 12, 1, 'is_number_of_days', NULL, 0);
+
-- Configuration of Rubrinc
INSERT INTO `config_rubric` (`id`, `label`)
VALUES (1, 'Configuration des rubriques'),
diff --git a/test/end-to-end/offdays/offdays.page.js b/test/end-to-end/offdays/offdays.page.js
index 38968f75cf..d489e4cee3 100644
--- a/test/end-to-end/offdays/offdays.page.js
+++ b/test/end-to-end/offdays/offdays.page.js
@@ -17,7 +17,7 @@ class OffdayPage {
await FU.buttons.create();
await FU.input('OffdayModalCtrl.offday.label', offday.label);
- components.dateEditor.set(new Date(offday.date), null, '[uib-modal] .title');
+ await components.dateEditor.set(offday.date, 'offday-date-editor', '.modal li.title');
await FU.input('OffdayModalCtrl.offday.percent_pay', offday.percent_pay);
@@ -50,7 +50,7 @@ class OffdayPage {
await FU.input('OffdayModalCtrl.offday.label', updateOffday.label);
- components.dateEditor.set(new Date(updateOffday.date), null, '[uib-modal] .title');
+ await components.dateEditor.set(updateOffday.date, 'offday-date-editor', '.modal li.title');
await FU.input('OffdayModalCtrl.offday.percent_pay', updateOffday.percent_pay);
diff --git a/test/end-to-end/offdays/offdays.spec.js b/test/end-to-end/offdays/offdays.spec.js
index 47cdb93a7d..862cedb481 100644
--- a/test/end-to-end/offdays/offdays.spec.js
+++ b/test/end-to-end/offdays/offdays.spec.js
@@ -8,13 +8,13 @@ describe('Offdays Management', () => {
const offday = {
label : 'Fete de Parent',
- date : '2017-08-01',
+ date : new Date('2017-08-01'),
percent_pay : 100,
};
const updateOffday = {
label : 'Vingt',
- date : '2017-11-24',
+ date : new Date('2017-11-24'),
percent_pay : 100,
};
diff --git a/test/end-to-end/stock/stock.inventories.js b/test/end-to-end/stock/stock.inventories.js
index 85c781e0f0..0100fa8b7a 100644
--- a/test/end-to-end/stock/stock.inventories.js
+++ b/test/end-to-end/stock/stock.inventories.js
@@ -60,16 +60,16 @@ function StockInventoriesRegistryTests() {
it('find 3 inventory by state (security reached)', async () => {
await FU.radio('$ctrl.searchQueries.status', 2);
await FU.modal.submit();
- await GU.expectRowCount(gridId, 3);
+ await GU.expectRowCount(gridId, 2);
await filters.resetFilters();
});
- it('find 0 inventories by state plus one line for grouping (minimum reached)', async () => {
+ it('find 1 inventories by state plus one line for grouping (minimum reached)', async () => {
await FU.radio('$ctrl.searchQueries.status', 3);
await FU.modal.submit();
- await GU.expectRowCount(gridId, 0);
+ await GU.expectRowCount(gridId, 2);
await filters.resetFilters();
});
diff --git a/test/integration/enterprises.js b/test/integration/enterprises.js
index 1d07dc79ca..2e701913ff 100644
--- a/test/integration/enterprises.js
+++ b/test/integration/enterprises.js
@@ -11,7 +11,7 @@ const fixtures = path.resolve(__dirname, '../fixtures');
*/
describe('(/enterprises) Enterprises API', () => {
const defaultEnterpriseId = 1;
- const defaultValuemonthAverageConsumption = 6;
+ const defaultValuemonthAverageConsumption = 12;
const enterprise = {
name : 'enterprises',
diff --git a/test/integration/stock/stock.js b/test/integration/stock/stock.js
index 3568dd745c..449f9112af 100644
--- a/test/integration/stock/stock.js
+++ b/test/integration/stock/stock.js
@@ -76,8 +76,7 @@ describe('(/stock/) The Stock HTTP API', () => {
// (report) render all stock exit
it(
- `GET /reports/stock/lots?renderer=json
- returns exits for all depots`,
+ `GET /reports/stock/lots?renderer=json returns exits for all depots`,
async () => {
const res = await agent.get(`/reports/stock/lots?renderer=json`);
expect(res.body.rows.length).to.equal(23);
@@ -171,11 +170,12 @@ describe('(/stock/) The Stock HTTP API', () => {
helpers.api.listed(res, 4);
expect(res.body[1].quantity).to.equal(140);
- expect(res.body[1].avg_consumption).to.equal(15);
- expect(res.body[1].S_SEC).to.equal(15);
- expect(res.body[1].S_MIN).to.equal(30);
- expect(res.body[1].S_MAX).to.equal(30);
- expect(res.body[1].S_MONTH).to.equal(9);
+ expect(res.body[1].avg_consumption).to.equal(8);
+
+ expect(res.body[1].S_SEC).to.equal(8);
+ expect(res.body[1].S_MIN).to.equal(16);
+ expect(res.body[1].S_MAX).to.equal(16);
+ expect(res.body[1].S_MONTH).to.equal(17);
expect(res.body[2].quantity).to.equal(180300);
expect(res.body[2].avg_consumption).to.equal(49916.67);