9 |
FIXME: faltan cosas (ver productDS) |
FIXME: faltan cosas (ver productDS) |
10 |
--> |
--> |
11 |
<datasource name="productResultDataSource" database="papo" |
<datasource name="productResultDataSource" database="papo" |
12 |
table="product, _product_data" |
table="product, _product_data, price, _price_data" |
13 |
historytable="_product_data"> |
historytable="_product_data, _price_data"> |
14 |
<condition> |
<condition> |
15 |
<and> |
<and> |
16 |
<!-- pega product con su _data --> |
<!-- pega product con su _data --> |
18 |
<cfield name="product.id"/> |
<cfield name="product.id"/> |
19 |
<cfield name="_product_data._table"/> |
<cfield name="_product_data._table"/> |
20 |
</eq> |
</eq> |
21 |
|
<!-- pega product con su price --> |
22 |
|
<eq> |
23 |
|
<cfield name="product.id"/> |
24 |
|
<cfield name="_price_data.product"/> |
25 |
|
</eq> |
26 |
|
<!-- pega price con su _data --> |
27 |
|
<eq> |
28 |
|
<cfield name="price.id"/> |
29 |
|
<cfield name="_price_data._table"/> |
30 |
|
</eq> |
31 |
|
<!-- solamente el price base (type 1) --> |
32 |
|
<eq> |
33 |
|
<cfield name="_price_data.price_type"/> |
34 |
|
<cconst value="1"/> |
35 |
|
</eq> |
36 |
<!-- descarta productos muertos --> |
<!-- descarta productos muertos --> |
37 |
<null> |
<null> |
38 |
<cfield name="_product_data._end_t"/> |
<cfield name="_product_data._end_t"/> |
62 |
</condition> |
</condition> |
63 |
</datasource> |
</datasource> |
64 |
|
|
65 |
|
<!-- datasources para dropdowns: con buscar los not null en _data estamos --> |
66 |
|
|
67 |
|
<datasource name="productClassificationDataSource" database="papo" |
68 |
|
table="_product_classification_data" |
69 |
|
historytable="_product_classification_data"> |
70 |
|
<condition> |
71 |
|
<and> |
72 |
|
<null> |
73 |
|
<cfield name="_end_t"/> |
74 |
|
</null> |
75 |
|
<notnull> |
76 |
|
<cfield name="is_product"/> |
77 |
|
</notnull> |
78 |
|
</and> |
79 |
|
</condition> |
80 |
|
</datasource> |
81 |
|
|
82 |
|
<datasource name="physicalStructureDataSource" database="papo" |
83 |
|
table="_physical_structure_data" |
84 |
|
historytable="_physical_structure_data"> |
85 |
|
<condition> |
86 |
|
<null> |
87 |
|
<cfield name="_end_t"/> |
88 |
|
</null> |
89 |
|
</condition> |
90 |
|
</datasource> |
91 |
|
|
92 |
|
<datasource name="countryDataSource" database="papo" |
93 |
|
table="_country_data" |
94 |
|
historytable="_country_data"> |
95 |
|
<condition> |
96 |
|
<null> |
97 |
|
<cfield name="_end_t"/> |
98 |
|
</null> |
99 |
|
</condition> |
100 |
|
</datasource> |
101 |
|
|
102 |
<trigger name="productCommitTrigger" type="NAMED"> |
<trigger name="productCommitTrigger" type="NAMED"> |
103 |
productBlock.commit() |
productBlock.commit() |
104 |
</trigger> |
</trigger> |
113 |
hack.rollback(productBlock) |
hack.rollback(productBlock) |
114 |
</trigger> |
</trigger> |
115 |
|
|
116 |
<trigger name="productAskForChangesTrigger" type="NAMED"> |
<trigger name="askForChangesTrigger" type="NAMED"> |
117 |
import hack |
import hack |
118 |
hack.confirmPageChanges(self, self.productCommitTrigger, productBlock) |
hack.confirmPageChanges(self, self.productCommitTrigger, productBlock) |
119 |
</trigger> |
</trigger> |
125 |
productResultBlock.productIdREntry) |
productResultBlock.productIdREntry) |
126 |
</trigger> |
</trigger> |
127 |
|
|
128 |
<page name="Products"> |
<page name="Productos"> |
129 |
<trigger type="Pre-Focusout"> |
<trigger type="Pre-Focusout"> |
130 |
productBlock.processRollback() |
if 0: |
131 |
if productResultBlock.getRecordCount() > 0 and not productResultBlock.getCurrentRecord().isEmpty(): |
def constrain(block_from, field_from, block_to, field_to): |
132 |
productBlock.initQuery() |
block_to.processRollback() |
133 |
productBlock.productIdEntry = ("%s" % productResultBlock.productIdREntry) |
if block_from.getRecordCount() > 0 and not block_from.getCurrentRecord().isEmpty(): |
134 |
productBlock.processQuery() |
block_to.initQuery() |
135 |
if None: |
field_to = ("%s" % field_from) |
136 |
import hack |
block_to.processQuery() |
137 |
hack.constrain(productResultBlock, productBlock, |
|
138 |
productResultBlock.productIdREntry, |
constrain(productResultBlock, productResultBlock.productIdREntry, |
139 |
productBlock.productIdEntry) |
productBlock, productBlock.productIdEntry ) |
140 |
|
|
141 |
|
else: |
142 |
|
productBlock.processRollback() |
143 |
|
if productResultBlock.getRecordCount() > 0 and not productResultBlock.getCurrentRecord().isEmpty(): |
144 |
|
productBlock.initQuery() |
145 |
|
productBlock.productIdEntry = ("%s" % productResultBlock.productIdREntry) |
146 |
|
productBlock.processQuery() |
147 |
</trigger> |
</trigger> |
148 |
<block name="productSearchBlock" datasource="searchDataSource" transparentBlock=""> |
<block name="productSearchBlock" datasource="searchDataSource" transparentBlock=""> |
149 |
<label text="Nombre canónico del producto a buscar" x="1" y="1"/> |
<label text="Nombre canónico del producto a buscar" x="1" y="1"/> |
159 |
<scrollbar page="12" x="42" y="4" width="1" height="12"/> |
<scrollbar page="12" x="42" y="4" width="1" height="12"/> |
160 |
</block> |
</block> |
161 |
</page> |
</page> |
162 |
<page name="Product"> |
<page name="Producto"> |
163 |
<trigger type="Pre-Focusout" src="productAskForChangesTrigger"/> |
<trigger type="Pre-Focusout" src="askForChangesTrigger"/> |
164 |
<box label="Datos" x="0" y="0" height="20" width="64"> |
<box label="Datos" x="0" y="0" height="20" width="64"> |
165 |
<block name="productBlock" datasource="productDataSource"> |
<block name="productBlock" datasource="productDataSource"> |
166 |
<entry name="productIdEntry" field="product.id" hidden="true" |
<entry name="productIdEntry" field="product.id" hidden="true" |
167 |
x="1" y="1" width="20"/> |
x="1" y="1" width="20"/> |
168 |
<label text="Nombre Canónico" x="1" y="1"/> |
<label text="Nombre Canónico:" x="1" y="1"/> |
169 |
<entry name="nameEntry" field="_product_data.canonical_name" |
<entry name="canonical_nameEntry" field="_product_data.canonical_name" |
170 |
x="1" y="2" width="40"/> |
x="1" y="2" width="40"/> |
171 |
|
<label text="Clasificación:" x="1" y="3"/> |
172 |
|
<entry x="1" y="4" width="30" name="product_classificationEntry" style="dropdown" |
173 |
|
field="_product_data.product_classification" |
174 |
|
foreign_key="productClassificationDataSource._table" |
175 |
|
foreign_key_description="description"/> |
176 |
|
<label text="Ubicación:" x="1" y="5"/> |
177 |
|
<entry x="1" y="6" width="30" name="physical_structureEntry" style="dropdown" |
178 |
|
field="_product_data.location" |
179 |
|
foreign_key="physicalStructureDataSource._table" |
180 |
|
foreign_key_description="name"/> |
181 |
|
<label text="País de Origen:" x="1" y="7"/> |
182 |
|
<entry x="1" y="8" width="30" name="countryEntry" style="dropdown" |
183 |
|
field="_product_data.country" |
184 |
|
foreign_key="countryDataSource._table" |
185 |
|
foreign_key_description="name"/> |
186 |
|
<label x="1" y="9" text="Precio unitario base"/> |
187 |
|
<entry x="1" y="10" name="priceEntry" field="_price_data.unit_price"/> |
188 |
<button x="1" y="17" trigger="productCommitTrigger" width="9" label="Aceptar" |
<button x="1" y="17" trigger="productCommitTrigger" width="9" label="Aceptar" |
189 |
name="productCommitBtn" height="1"/> |
name="productCommitBtn" height="1"/> |
190 |
<button x="11" y="17" trigger="productDeleteTrigger" width="9" label="Borrar" |
<button x="11" y="17" trigger="productDeleteTrigger" width="9" label="Borrar" |
194 |
</block> |
</block> |
195 |
</box> |
</box> |
196 |
</page> |
</page> |
197 |
|
<!-- |
198 |
|
<page name="Precios"> |
199 |
|
<trigger type="Pre-Focusout" src="askForChangesTrigger"/> |
200 |
|
<box label="Producto" x="0" y="0" height="5" width="64"> |
201 |
|
<block name="priceProductBlock" datasource="productDataSource"> |
202 |
|
<label text="Producto" x="1" y="1"/> |
203 |
|
<entry x="1" y="2" width="40" name="name" |
204 |
|
field="_product_data.canonical_name" readonly="please"/> |
205 |
|
</block> |
206 |
|
</box> |
207 |
|
<box label="P |
208 |
|
--> |
209 |
</form> |
</form> |