Revision ca4725ff
Von Sven Schöling vor fast 2 Jahren hinzugefügt
- ID ca4725ff910ba55afdf3381344fd3265745f60d2
- Vorgänger 7e470de2
SL/DB/Manager/PriceRuleItem.pm | ||
---|---|---|
34 | 34 |
{ type => 'qty', description => t8('Qty'), customer => 1, vendor => 1, data_type => 'num', data => sub { $_[1]->qty }, ops => 'num' }, |
35 | 35 |
); |
36 | 36 |
|
37 |
# text, textfield, htmlfield, bool are not supported |
|
38 |
our %price_rule_type_by_cvar_type = ( |
|
39 |
select => 'text', |
|
40 |
customer => 'int', |
|
41 |
vendor => 'int', |
|
42 |
part => 'int', |
|
43 |
number => 'num', |
|
44 |
date => 'date', |
|
45 |
text => undef, |
|
46 |
textfield => undef, |
|
47 |
htmlfield => undef, |
|
48 |
bool => undef, |
|
49 |
); |
|
50 |
|
|
51 |
|
|
37 | 52 |
# ITEM.part.cvar_by_name(var.config.name) |
38 | 53 |
|
39 | 54 |
sub not_matching_sql_and_values { |
... | ... | |
91 | 106 |
|
92 | 107 |
my @types; |
93 | 108 |
|
94 |
# text, textfield, bool are not supported |
|
95 |
my %price_rule_type_by_cvar_type = ( |
|
96 |
select => 'text', |
|
97 |
customer => 'int', |
|
98 |
vendor => 'int', |
|
99 |
part => 'int', |
|
100 |
number => 'num', |
|
101 |
date => 'date', |
|
102 |
text => undef, |
|
103 |
textfield => undef, |
|
104 |
bool => undef, |
|
105 |
htmlfield => undef, |
|
106 |
); |
|
107 |
|
|
108 | 109 |
my %ops_by_cvar_type = ( |
109 | 110 |
number => 'num', |
110 | 111 |
date => 'date', |
t/db/price_rule.t | ||
---|---|---|
10 | 10 |
use Support::TestSetup; |
11 | 11 |
use Test::Exception; |
12 | 12 |
|
13 |
use SL::Controller::CustomVariableConfig; |
|
14 |
|
|
13 | 15 |
use SL::Dev::ALL qw(:ALL); |
14 | 16 |
use SL::DB::PriceRule; |
15 | 17 |
use SL::DB::Project; |
... | ... | |
123 | 125 |
|
124 | 126 |
} |
125 | 127 |
|
126 |
|
|
128 |
# structural test: check whether the registered CVar types in SL::DB::Manager::PriceRuleItem have all the possible types of SL::Controller::CustomVariableConfigs |
|
129 |
for (@SL::Controller::CustomVariableConfig::types) { |
|
130 |
ok(exists $SL::DB::Manager::PriceRuleItem::price_rule_type_by_cvar_type{$_}, "PriceRuleItem has cvar config type $_ registered"); |
|
131 |
} |
|
127 | 132 |
|
128 | 133 |
# k, now for a more broad test: |
129 | 134 |
# |
Auch abrufbar als: Unified diff
PriceRules: test um unterstützte CVar Typen mit der vollen liste abzugleichen
Damit sollten wirre Fehler beim hinzufügen von Artikeln nicht mehr
passieren.