$csv = SL::Helper::Csv->new(
file => \"Kaffee\n",
header => [ 'description' ],
+ class => 'SL::DB::Part',
);
isa_ok $csv->_csv, 'Text::CSV_XS';
isa_ok $csv->parse, 'SL::Helper::Csv', 'parsing returns self';
is_deeply $csv->get_data, [ { description => 'Kaffee' } ], 'simple case works';
-$csv->class('SL::DB::Part');
is $csv->get_objects->[0]->description, 'Kaffee', 'get_object works';
####
-SL::Dispatcher::pre_startup_setup();
+{
+no warnings 'once';
+$::dispatcher = SL::Dispatcher->new;
+$::dispatcher->pre_startup_setup();
+}
$::form = Form->new;
$::myconfig{numberformat} = '1.000,00';
$csv = SL::Helper::Csv->new(
file => \"Kaffee;0.12;12,2;1,5234\n",
header => [ 'description', 'sellprice', 'lastcost_as_number', 'listprice' ],
- dispatch => { listprice => 'listprice_as_number' },
+ profile => { listprice => 'listprice_as_number' },
class => 'SL::DB::Part',
);
$csv->parse;
EOL
sep_char => ',',
quote_char => "'",
- dispatch => { listprice => 'listprice_as_number' },
+ profile => { listprice => 'listprice_as_number' },
class => 'SL::DB::Part',
);
$csv->parse;
print Dumper($csv->errors);
-my @mm = $csv->get_objects->[0]->makemodel;
+@mm = $csv->get_objects->[0]->makemodel;
is scalar @mm, 1, 'multiple one-to-many dispatch';
is $csv->get_objects->[0]->makemodels->[0]->model, 'Chair 0815', '...check 1';
is $csv->get_objects->[0]->makemodels->[0]->make, '213', '...check 2';