mebil
[kivitendo-erp.git] / SL / PriceSource / ALL.pm
1 package SL::PriceSource::ALL;
2
3 use strict;
4 use SL::PriceSource::Pricegroup;
5 use SL::PriceSource::MasterData;
6 use SL::PriceSource::Makemodel;
7 use SL::PriceSource::Customer;
8 use SL::PriceSource::Vendor;
9 use SL::PriceSource::Business;
10 use SL::PriceSource::PriceRules;
11
12 my %price_sources_by_name = (
13   master_data       => 'SL::PriceSource::MasterData',
14   customer_discount => 'SL::PriceSource::Customer',
15   vendor_discount   => 'SL::PriceSource::Vendor',
16   pricegroup        => 'SL::PriceSource::Pricegroup',
17   makemodel         => 'SL::PriceSource::Makemodel',
18   business          => 'SL::PriceSource::Business',
19   price_rules       => 'SL::PriceSource::PriceRules',
20 );
21
22 my @price_sources_order = qw(
23   master_data
24   customer_discount
25   vendor_discount
26   pricegroup
27   makemodel
28   business
29   price_rules
30 );
31
32 sub all_enabled_price_sources {
33   my %disabled = map { $_ => 1 } @{ $::instance_conf->get_disabled_price_sources || [] };
34
35   map { $price_sources_by_name{$_} } grep { !$disabled{$_} } @price_sources_order;
36 }
37
38 sub all_price_sources {
39   map { $price_sources_by_name{$_} } @price_sources_order;
40 }
41
42 sub price_source_class_by_name {
43   $price_sources_by_name{$_[1]};
44 }
45
46 1;