Enhancement #1888456: Request: "if column is set/not set" for int columns

This commit is contained in:
Charles Haley 2020-07-22 10:04:02 +01:00
parent d572330733
commit f5838785d9
2 changed files with 7 additions and 1 deletions

View File

@ -61,7 +61,9 @@ class ConditionEditor(QWidget): # {{{
'int' : (
(_('is equal to'), 'eq'),
(_('is less than'), 'lt'),
(_('is greater than'), 'gt')
(_('is greater than'), 'gt'),
(_('is set'), 'is set'),
(_('is not set'), 'is not set')
),
'datetime' : (
(_('is equal to'), 'eq'),

View File

@ -129,6 +129,10 @@ class Rule(object): # {{{
return "check_yes_no('%s', %s)"%(col, test)
def number_condition(self, col, action, val):
if action == 'is set':
return "test(field('%s'), '1', '')"%col
if action == 'is not set':
return "test(field('%s'), '', '1')"%col
lt, eq, gt = {
'eq': ('', '1', ''),
'lt': ('1', '', ''),