-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathREADME
192 lines (163 loc) · 5.51 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
## Dolibarr ExtDirect ##
Dolibarr Module to connect the Dolibarr ERP system to Sencha Touch, a high-performance HTML5 mobile application framework or Sencha Ext JS, a business-grade web application development framework.
Ext Direct allows for seamless communication between the client-side and server-side, uses raw HTTP posts with little overhead using low data bandwidth and improved performance.
The module provides a set of Ext Direct compatible php classes.
**CRUD methods you can seamless integrate in your client-side data stores:**
PHP class:
class ExtDirectProduct extends Product
{
public function __construct() {
...
}
public function readProduct(stdClass $param) {
...
}
public function createProduct($params) {
...
}
public function updateProduct($params) {
...
}
public function destroyProduct($params) {
...
}
}
Client CRUD calls:
Ext.ns("Ext.app.REMOTING_API");
Ext.app.REMOTING_API = {
"id":"dolibarr_connector",
"url":"http://localhost/dolibarr/htdocs/extdirect/router.php",
"type":"remoting",
"actions":{
"ExtDirectProduct":[
{"name":"readProduct","len":1},
{"name":"createProduct","len":1},
{"name":"updateProduct","len":1},
{"name":"destroyProduct","len":1},
{"name":"readProductList","len":1}
],
...
},
"total":2200
};
Ext.Direct.addProvider(Ext.app.REMOTING_API);
Ext.getStore('product').setProxy({
type: 'direct',
api: {
create: ExtDirectProduct.createProduct,
read: ExtDirectProduct.readProduct,
update: ExtDirectProduct.updateProduct,
destroy: ExtDirectProduct.destroyProduct
}
});
Ext.getStore('productlist').setProxy({
type: 'direct',
directFn: ExtDirectProduct.readProductList,
reader: {
rootProperty: 'data'
}
});
// enable total property in result output
Ext.getStore('productlist').on('beforeload', function(store, operation, eOpts) {
operation.setParams({
include_total: true
});
}, this);
Ext.getStore('productlist').load();
...
var products = Ext.getStore('product');
var productData = {
ref: 'CT0001',
label: 'product 1',
type: 0,
description: 'product description',
...
barcode: '1234567890005',
barcode_type: 2
};
var product = Ext.create('MyApp.model.Product',productData);
products.add(product);
products.sync();
products.clearFilter();
products.filter(Ext.create('Ext.util.Filter',{property:"ref",value:'CT0001'}));
products.load({
callback: function (records) {
Ext.Array.each(records,function (record) {
record.set('description','updated product');
});
products.sync();
}
});
...
products.removeAt(products.find('ref','CT0001'));
products.sync();
For client File uploads create an upload fieldset like below, set extTID field value with related object id. Submit your form to router.php.
{
xtype: 'fieldset',
itemId: 'filefieldset',
title: 'File',
items:[
{
xtype: 'hiddenfield',
name: 'extType',
value: "rpc"
},
{
xtype: 'hiddenfield',
itemId: 'exttid',
name: 'extTID'
},
{
xtype: 'hiddenfield',
name: 'extAction',
itemId: 'extaction',
value: "ExtDirectCommande"
},
{
xtype: 'hiddenfield',
name: 'extMethod',
value: "fileUpload"
},
{
xtype: 'hiddenfield',
name: 'extUpload',
value: "true"
},
{
xtype: "filefield",
label: "Select file",
capture: "environment",
name: 'file'
}
]
}
**Currently provided Classes:**
- Authentication
- Translation
- Products
- Customer orders
- Customer shipments
- Activity tracking
- Customers/Suppliers
- Contacts
- Categories
- Agenda
- Supplier orders
- Interventions
- https://github.com/fappels/dolibarr-shipmentpackage
- Manufacture orders
> New classes will be added.
**Authentication system:**
The module uses an authentication system different from the usual login/password authentication. Instead authentication is done by sending a key for each app installation to the server. In the module setup page the system administrator can assign a user to the installed application and the module will return a unique access key to the app. You can also enable auto user assignment in the module setup page, advised to only use this for testing or demo purposes.
**Activity tracking system:**
Can be used to track when client app is started, when the app started editing or doing an action on a certain object, Following items are tracked: user, user alias, app name, time, activity name, activity status, object id.
**Usage:**
For more details on how to use the Classes in your client side code, you can examine the provided jasmine unit tests in file extdirect/testing/test.js. You can run the test with URL "http://your.server.net/.../htdocs/extdirect/testing/", enable auto superAdmin assignment for this and set admin language to en_US.
At least three warehouses, 2 multiprice indexes, product extrafield called 'test' and one customer-supplier with rowid 1 must be available to succeed the test.
Enable barcode module with at least EAN13 activated.
Enable agenda module.
Enable customer and supplier order modules with stock increase/decrease enabled.
Demo data from dev/initdemo should work. Add two multiprice levels and a string extrafield 'test' labeled 'Test' with default value 'test' in product setup. Rename admin username to SuperAdmin.
**Supported Dolibarr Versions:**
- Min version: 4.0
- Max version: 17.0