use Rose::Object::MakeMethods::Generic
(
- 'scalar --get_set_init' => [ qw(settings languages_by parts_by contacts_by departments_by projects_by ct_shiptos_by taxzones_by price_factors_by pricegroups_by) ],
+ 'scalar --get_set_init' => [ qw(settings languages_by parts_by contacts_by departments_by projects_by ct_shiptos_by price_factors_by pricegroups_by) ],
);
{ name => 'ordnumber', description => $::locale->text('Order Number') },
{ name => 'parts_id', description => $::locale->text('Part (database ID)') },
{ name => 'partnumber', description => $::locale->text('Part Number') },
+ { name => 'position', description => $::locale->text('position') },
{ name => 'project_id', description => $::locale->text('Project (database ID)') },
{ name => 'projectnumber', description => $::locale->text('Project (number)') },
{ name => 'project', description => $::locale->text('Project (description)') },
return $sby;
}
-sub init_taxzones_by {
- my ($self) = @_;
-
- my $all_taxzones = SL::DB::Manager::TaxZone->get_all;
- return { map { my $col = $_; ( $col => { map { ( $_->$col => $_ ) } @{ $all_taxzones } } ) } qw(id description) };
-}
-
sub init_price_factors_by {
my ($self) = @_;
my ($self, $entry) = @_;
my $object = $entry->{object};
- my $vc_obj = SL::DB::Customer->new(id => $object->customer_id)->load if $object->customer_id;
+ my $vc_obj;
+ $vc_obj = SL::DB::Customer->new(id => $object->customer_id)->load if $object->customer_id;
$vc_obj = SL::DB::Vendor->new(id => $object->vendor_id)->load if (!$vc_obj && $object->vendor_id);
# salesman from customer/vendor or login if not given
return 1;
}
-sub check_taxzone {
- my ($self, $entry) = @_;
-
- my $object = $entry->{object};
-
- # Check wether or not taxzone ID is valid.
- if ($object->taxzone_id && !$self->taxzones_by->{id}->{ $object->taxzone_id }) {
- push @{ $entry->{errors} }, $::locale->text('Error: Invalid tax zone');
- return 0;
- }
-
- # Map description to ID if given.
- if (!$object->taxzone_id && $entry->{raw_data}->{taxzone}) {
- my $taxzone = $self->taxzones_by->{description}->{ $entry->{raw_data}->{taxzone} };
- if (!$taxzone) {
- push @{ $entry->{errors} }, $::locale->text('Error: Invalid tax zone');
- return 0;
- }
-
- $object->taxzone_id($taxzone->id);
- }
-
- return 1;
-}
-
sub check_price_factor {
my ($self, $entry) = @_;