1 package SL::Dev::CustomerVendor;
5 our @EXPORT = qw(create_customer);
14 my ($taxzone, $currency);
16 if ( my $taxzone_id = delete $params{taxzone_id} ) {
17 $taxzone = SL::DB::Manager::TaxZone->find_by( id => $taxzone_id ) || die "Can't find taxzone_id";
19 $taxzone = SL::DB::Manager::TaxZone->find_by( description => 'Inland') || die "No taxzone 'Inland'";
22 if ( my $currency_id = delete $params{currency_id} ) {
23 $currency = SL::DB::Manager::Currency->find_by( id => $currency_id ) || die "Can't find currency_id";
25 $currency = SL::DB::Manager::Currency->find_by( id => $::instance_conf->get_currency_id );
28 my $customer = SL::DB::Customer->new( name => delete $params{name} || 'Testkunde',
29 currency_id => $currency->id,
30 taxzone_id => $taxzone->id,
32 $customer->assign_attributes( %params );
42 SL::Dev::CustomerVendor - create customer and vendor objects for testing, with minimal defaults
46 =head2 C<create_customer %PARAMS>
48 Creates a new customer.
50 Minimal usage, default values, without saving to database:
52 my $customer = SL::Dev::CustomerVendor::create_customer();
54 Complex usage, overwriting some defaults, and save to database:
56 SL::Dev::CustomerVendor::create_customer(name => 'Test customer',
68 G. Richardson E<lt>grichardson@kivitendo-premium.deE<gt>