1 package SL::Dev::CustomerVendor;
 
   4 @EXPORT = qw(create_customer);
 
  13   my ($taxzone, $currency);
 
  15   if ( my $taxzone_id = delete $params{taxzone_id} ) {
 
  16     $taxzone = SL::DB::Manager::TaxZone->find_by( id => $taxzone_id ) || die "Can't find taxzone_id";
 
  18     $taxzone = SL::DB::Manager::TaxZone->find_by( description => 'Inland') || die "No taxzone 'Inland'";
 
  21   if ( my $currency_id = delete $params{currency_id} ) {
 
  22     $currency = SL::DB::Manager::Currency->find_by( id => $currency_id ) || die "Can't find currency_id";
 
  24     $currency = SL::DB::Manager::Currency->find_by( id => $::instance_conf->get_currency_id );
 
  27   my $customer = SL::DB::Customer->new( name        => delete $params{name} || 'Testkunde',
 
  28                                         currency_id => $currency->id,
 
  29                                         taxzone_id  => $taxzone->id,
 
  31   $customer->assign_attributes( %params );
 
  41 SL::Dev::CustomerVendor - create customer and vendor objects for testing, with minimal defaults
 
  45 =head2 C<create_customer %PARAMS>
 
  47 Creates a new customer.
 
  49 Minimal usage, default values, without saving to database:
 
  51   my $customer = SL::Dev::CustomerVendor::create_customer();
 
  53 Complex usage, overwriting some defaults, and save to database:
 
  54   SL::Dev::CustomerVendor::create_customer(name        => 'Test customer',
 
  66 G. Richardson E<lt>grichardson@kivitendo-premium.deE<gt>