[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnue-contrib] r241 - address
From: |
johannes |
Subject: |
[gnue-contrib] r241 - address |
Date: |
Mon, 20 Mar 2006 08:11:56 -0600 (CST) |
Author: johannes
Date: 2006-03-20 08:11:56 -0600 (Mon, 20 Mar 2006)
New Revision: 241
Modified:
address/address.gfd
Log:
Added workaround for misbehaving lower/upper of the backend
Modified: address/address.gfd
===================================================================
--- address/address.gfd 2006-03-15 16:48:57 UTC (rev 240)
+++ address/address.gfd 2006-03-20 14:11:56 UTC (rev 241)
@@ -7,7 +7,12 @@
<description>Simple address management</description>
</options>
- <datasource name="dtsCompany" connection="address" table="company" />
+ <datasource name="dtsCompany" connection="address" table="company">
+ <sortorder>
+ <sortfield name="name1" descending="False" ignorecase="True" />
+ </sortorder>
+ </datasource>
+
<datasource name="dtsContact" connection="address" table="contact"
master="dtsCompany" masterlink="id" detaillink="company" />
<datasource name="dtsCategory" connection="address" table="category"
@@ -88,22 +93,51 @@
<button c:x="39" c:y="0" c:width="10" label="Suche">
<trigger type="ON-ACTION"><![CDATA[
- val = blkCompany.search.get ().lower ()
+ def u (v):
+ return unicode (v, 'utf-8')
+
+ def build (aval, last = 0):
+ cmap = {u('ö'): u('Ö'), u('Ö'): u('ö'),
+ u('ä'): u('Ä'), u('Ä'): u('ä'),
+ u('ü'): u('Ü'), u('Ü'): u('ü')}
+
+ result = []
+
+ for ix in range (last, len (aval)):
+ if aval [ix] in cmap:
+ cc = aval [ix]
+ newval = aval [0:ix] + cmap [cc] + aval [ix + 1:]
+
+ xres = build (newval, ix + 1)
+ result.extend (xres)
+
+ result.append (aval)
+ return result
+
+ def buildPattern (pattern):
+ result = []
+
+ for item in build (pattern):
+ result.extend ([ \
+ ['like', ['upper', ['field', 'matchcode']], ['const', item]], \
+ ['like', ['upper', ['field', 'name1']], ['const', item]], \
+ ['like', ['upper', ['field', 'name2']], ['const', item]], \
+ ['exist', 'contact', 'id', 'company', \
+ ['or',
+ ['like', ['upper', ['field', 'firstname']],
+ ['const', item]],
+ ['like', ['upper', ['field', 'surname']],
+ ['const', item]]]]])
+
+ result.insert (0, 'or')
+ return result
+
+ val = blkCompany.search.get ()
pattern = "%%%s%%" % val
- cond = ['or',
- ['like', ['lower', ['field', 'matchcode']], ['const', pattern]], \
- ['like', ['lower', ['field', 'name1']], ['const', pattern]], \
- ['like', ['lower', ['field', 'name2']], ['const', pattern]], \
- ['exist', 'contact', 'id', 'company', \
- ['or',
- ['like', ['lower', ['field', 'firstname']],
- ['const', pattern]],
- ['like', ['lower', ['field', 'surname']],
- ['const', pattern]]]]]
+ cond = buildPattern (pattern)
r = dtsCompany.createResultSet (cond, query = True)
-
]]>
</trigger>
</button>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnue-contrib] r241 - address,
johannes <=