Attached Files | mobileCoreEnableProcurment.diff [^] (12,373 bytes) 2013-12-26 20:26 [Show Content] [Hide Content]diff -r 856dcd0e434b src/org/openbravo/mobile/core/MobileCoreComponentProvider.java
--- a/src/org/openbravo/mobile/core/MobileCoreComponentProvider.java Fri Dec 20 11:59:11 2013 +0000
+++ b/src/org/openbravo/mobile/core/MobileCoreComponentProvider.java Thu Dec 26 20:20:02 2013 +0100
@@ -76,7 +76,7 @@
"offline/ob-session", "offline/ob-user" };
final String[] jsRetailDependency = { "component/ob-retail-product-browser",
- "component/ob-retail-searchproductcharacteristic" };
+ "component/ob-retail-searchproducts", "component/ob-retail-searchproductcharacteristic" };
final String[] cssDependency = { "css/ob-login", "css/ob-standard" };
diff -r 856dcd0e434b web/org.openbravo.mobile.core/source/component/dialog/ob-profile.js
--- a/web/org.openbravo.mobile.core/source/component/dialog/ob-profile.js Fri Dec 20 11:59:11 2013 +0000
+++ b/web/org.openbravo.mobile.core/source/component/dialog/ob-profile.js Thu Dec 26 20:20:02 2013 +0100
@@ -441,7 +441,7 @@
}],
show: function () {
- this.$.profileButton.setShowing(OB.POS.modelterminal.hasPermission('OBMOBC_ChangeProfile'))
+ this.$.profileButton.setShowing(OB.MobileApp.model.hasPermission('OBMOBC_ChangeProfile'))
this.inherited(arguments);
},
diff -r 856dcd0e434b web/org.openbravo.mobile.core/source/component/ob-keyboard.js
--- a/web/org.openbravo.mobile.core/source/component/ob-keyboard.js Fri Dec 20 11:59:11 2013 +0000
+++ b/web/org.openbravo.mobile.core/source/component/ob-keyboard.js Thu Dec 26 20:20:02 2013 +0100
@@ -123,19 +123,21 @@
this.command = 'line:dto';
} else {
receipt.get('lines').on('add remove', function () {
- if (model.get('leftColumnViewManager').isMultiOrder()) {
+ if (model.get('leftColumnViewManager') && model.get('leftColumnViewManager').isMultiOrder()) {
this.waterfall('onDisableButton', {
disabled: true
});
}
- if (OB.UTIL.isDisableDiscount(receipt)) {
- this.waterfall('onDisableButton', {
- disabled: true
- });
- } else {
- this.waterfall('onDisableButton', {
- disabled: false
- });
+ if (OB.UTIL.isDisableDiscount) {
+ if (OB.UTIL.isDisableDiscount(receipt)) {
+ this.waterfall('onDisableButton', {
+ disabled: true
+ });
+ } else {
+ this.waterfall('onDisableButton', {
+ disabled: false
+ });
+ }
}
}, this);
this.command = 'screen:dto';
diff -r 856dcd0e434b web/org.openbravo.mobile.core/source/retail/component/ob-retail-product-browser.js
--- a/web/org.openbravo.mobile.core/source/retail/component/ob-retail-product-browser.js Fri Dec 20 11:59:11 2013 +0000
+++ b/web/org.openbravo.mobile.core/source/retail/component/ob-retail-product-browser.js Thu Dec 26 20:20:02 2013 +0100
@@ -84,6 +84,7 @@
enyo.kind({
name: 'OB.UI.ProductBrowser',
+ useCharacteristics: true,
classes: 'row-fluid',
components: [{
classes: 'span6',
@@ -99,6 +100,7 @@
}]
}],
init: function () {
+ this.$.browseProducts.useCharacteristics = this.useCharacteristics;
this.$.browseCategories.$.listCategories.categories.on('selected', function (category) {
this.$.browseProducts.$.listProducts.loadCategory(category);
}, this);
@@ -234,17 +236,23 @@
this.products = new OB.Collection.ProductList();
this.$.productTable.setCollection(this.products);
this.products.on('click', function (model) {
- if (!model.get('isGeneric')) {
+ if (this.useCharacteristics) {
+ if (!model.get('isGeneric')) {
+ me.doAddProduct({
+ product: model
+ });
+ } else {
+ me.doTabChange({
+ tabPanel: 'searchCharacteristic',
+ keyboard: false,
+ edit: false,
+ options: model
+ });
+ }
+ } else {
me.doAddProduct({
product: model
});
- } else {
- me.doTabChange({
- tabPanel: 'searchCharacteristic',
- keyboard: false,
- edit: false,
- options: model
- });
}
}, this);
},
@@ -269,14 +277,18 @@
if (category) {
if (category.get('id') === 'OBPOS_bestsellercategory') {
criteria = {
- 'bestseller': 'true',
- 'generic_product_id': null
+ 'bestseller': 'true'
};
+ if (this.useCharacteristics) {
+ criteria.generic_product_id = null;
+ }
} else {
criteria = {
- 'productCategory': category.get('id'),
- 'generic_product_id': null
+ 'productCategory': category.get('id')
};
+ if (this.useCharacteristics) {
+ criteria.generic_product_id = null;
+ }
}
criteria._orderByClause = 'upper(_identifier) asc';
OB.Dal.find(OB.Model.Product, criteria, successCallbackProducts, errorCallback);
diff -r 856dcd0e434b web/org.openbravo.mobile.core/source/retail/component/ob-retail-searchproducts.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/org.openbravo.mobile.core/source/retail/component/ob-retail-searchproducts.js Thu Dec 26 20:20:02 2013 +0100
@@ -0,0 +1,210 @@
+/*
+ ************************************************************************************
+ * Copyright (C) 2012-2013 Openbravo S.L.U.
+ * Licensed under the Openbravo Commercial License version 1.0
+ * You may obtain a copy of the License at http://www.openbravo.com/legal/obcl.html
+ * or in the legal folder of this module distribution.
+ ************************************************************************************
+ */
+
+/*global enyo */
+
+enyo.kind({
+ name: 'OB.UI.SearchProductHeader',
+ kind: 'OB.UI.ScrollableTableHeader',
+ events: {
+ onSearchAction: '',
+ onClearAction: ''
+ },
+ handlers: {
+ onFiltered: 'searchAction'
+ },
+ components: [{
+ style: 'padding: 10px 10px 5px 10px;',
+ components: [{
+ style: 'display: table;',
+ components: [{
+ style: 'display: table-cell; width: 100%;',
+ components: [{
+ kind: 'OB.UI.SearchInputAutoFilter',
+ name: 'productname',
+ style: 'width: 100%;',
+ minLengthToSearch: 2
+ }]
+ }, {
+ style: 'display: table-cell;',
+ components: [{
+ kind: 'OB.UI.SmallButton',
+ classes: 'btnlink-gray btn-icon-small btn-icon-clear',
+ style: 'width: 100px; margin: 0px 5px 8px 19px;',
+ ontap: 'clearAction'
+ }]
+ }, {
+ style: 'display: table-cell;',
+ components: [{
+ kind: 'OB.UI.SmallButton',
+ classes: 'btnlink-yellow btn-icon-small btn-icon-search',
+ style: 'width: 100px; margin: 0px 0px 8px 5px;',
+ ontap: 'searchAction'
+ }]
+ }]
+ }, {
+ style: 'margin: 5px 0px 0px 0px;',
+ components: [{
+ kind: 'OB.UI.List',
+ name: 'productcategory',
+ classes: 'combo',
+ style: 'width: 100%',
+ renderHeader: enyo.kind({
+ kind: 'enyo.Option',
+ initComponents: function () {
+ this.inherited(arguments);
+ this.setValue('__all__');
+ this.setContent(OB.I18N.getLabel('OBMOBC_SearchAllCategories'));
+ }
+ }),
+ renderLine: enyo.kind({
+ kind: 'enyo.Option',
+ initComponents: function () {
+ this.inherited(arguments);
+ this.setValue(this.model.get('id'));
+ this.setContent(this.model.get('_identifier'));
+ }
+ }),
+ renderEmpty: 'enyo.Control'
+ }]
+ }]
+ }],
+ setHeaderCollection: function (valueToSet) {
+ this.$.productcategory.setCollection(valueToSet);
+ },
+ searchAction: function () {
+ this.doSearchAction({
+ productCat: this.$.productcategory.getValue(),
+ productName: this.$.productname.getValue()
+ });
+ return true;
+ },
+ clearAction: function () {
+ this.$.productname.setValue('');
+ this.$.productcategory.setSelected(0);
+ this.doClearAction();
+ }
+});
+
+enyo.kind({
+ name: 'OB.UI.SearchProduct',
+ style: 'margin: 5px; background-color: #ffffff; color: black; padding: 5px',
+ published: {
+ receipt: null
+ },
+ handlers: {
+ onSearchAction: 'searchAction',
+ onClearAction: 'clearAction'
+ },
+ events: {
+ onAddProduct: ''
+ },
+ executeOnShow: function () {
+ var me = this;
+ setTimeout(function () {
+ me.$.products.$.theader.$.searchProductHeader.$.productname.focus();
+ }, 200);
+ },
+ components: [{
+ classes: 'row-fluid',
+ components: [{
+ classes: 'span12',
+ components: [{
+ classes: 'row-fluid',
+ style: 'border-bottom: 1px solid #cccccc;',
+ components: [{
+ classes: 'row-fluid',
+ components: [{
+ classes: 'span12',
+ components: [{
+ kind: 'OB.UI.ScrollableTable',
+ name: 'products',
+ scrollAreaMaxHeight: '482px',
+ renderHeader: 'OB.UI.SearchProductHeader',
+ renderEmpty: 'OB.UI.RenderEmpty',
+ renderLine: 'OB.UI.RenderProduct'
+ }]
+ }]
+ }]
+ }]
+ }]
+ }],
+ init: function () {
+ var me = this;
+ this.inherited(arguments);
+ this.categories = new OB.Collection.ProductCategoryList();
+ this.products = new OB.Collection.ProductList();
+
+ //first the main collection of the component
+ this.$.products.setCollection(this.products);
+ this.$.products.getHeader().setHeaderCollection(this.categories);
+
+ function errorCallback(tx, error) {
+ OB.UTIL.showError("OBDAL error: " + error);
+ }
+
+ function successCallbackCategories(dataCategories, me) {
+ if (dataCategories && dataCategories.length > 0) {
+ me.categories.reset(dataCategories.models);
+ } else {
+ me.categories.reset();
+ }
+ }
+
+ this.products.on('click', function (model) {
+ this.doAddProduct({
+ product: model
+ });
+ }, this);
+
+ OB.Dal.find(OB.Model.ProductCategory, null, successCallbackCategories, errorCallback, this);
+ },
+ receiptChanged: function () {
+ this.receipt.on('clear', function () {
+ this.$.products.$.theader.$.searchProductHeader.$.productname.setContent('');
+ this.$.products.$.theader.$.searchProductHeader.$.productcategory.setContent('');
+ //A filter should be set before show products. -> Big data!!
+ //this.products.exec({priceListVersion: OB.POS.modelterminal.get('pricelistversion').id, product: {}});
+ }, this);
+ },
+ clearAction: function (inSender, inEvent) {
+ this.products.reset();
+ },
+ searchAction: function (inSender, inEvent) {
+ var criteria = {},
+ me = this;
+
+ function errorCallback(tx, error) {
+ OB.UTIL.showError("OBDAL error: " + error);
+ }
+
+ // Initializing combo of categories without filtering
+
+ function successCallbackProducts(dataProducts) {
+ if (dataProducts && dataProducts.length > 0) {
+ me.products.reset(dataProducts.models);
+ me.products.trigger('reset');
+ } else {
+ OB.UTIL.showWarning("No products found");
+ me.products.reset();
+ }
+ }
+
+ if (inEvent.productName) {
+ criteria._filter = {
+ operator: OB.Dal.CONTAINS,
+ value: inEvent.productName
+ };
+ }
+ if (inEvent.productCat && inEvent.productCat !== '__all__') {
+ criteria.productCategory = inEvent.productCat;
+ }
+ OB.Dal.find(OB.Model.Product, criteria, successCallbackProducts, errorCallback);
+ }
+});
\ No newline at end of file
procurementEnableProcurement.diff [^] (694 bytes) 2013-12-26 20:44 [Show Content] [Hide Content]diff -r 60a8cb080153 web/org.openbravo.mobile.procurement/source/pointofpurchase/mpr-popurchase-tabkeyboardpanel-tabcontainer.js
--- a/web/org.openbravo.mobile.procurement/source/pointofpurchase/mpr-popurchase-tabkeyboardpanel-tabcontainer.js Fri Aug 30 12:30:36 2013 +0200
+++ b/web/org.openbravo.mobile.procurement/source/pointofpurchase/mpr-popurchase-tabkeyboardpanel-tabcontainer.js Thu Dec 26 20:08:29 2013 +0100
@@ -376,7 +376,8 @@
name: 'OBMPR.POPurchase.Panels.TabKeyboardPanel.Components.TabContainer.Components.TabBrowse',
kind: 'OB.UI.TabPane',
components: [{
- kind: 'OB.UI.ProductBrowser'
+ kind: 'OB.UI.ProductBrowser',
+ useCharacteristics: false
}]
});
|