Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 4e8df532

Von Tamino Steinert vor mehr als 1 Jahr hinzugefügt

  • ID 4e8df532477292b1d1a3a990b86ff9ec72b3cd11
  • Vorgänger f4d75dd4
  • Nachfolger 7828896b

Reclamation: nutze Record-Type

Unterschiede anzeigen:

SL/Controller/Reclamation.pm
$reclamation = SL::DB::Reclamation->new(id => $::form->{id})->load();
} else {
$reclamation = SL::DB::Reclamation->new(
record_type => $self->type,
reclamation_items => [],
currency_id => $::instance_conf->get_currency_id(),
);
SL/DB/Reclamation.pm
sub record_items { goto &reclamation_items; }
sub type {
my ($self) = @_;
return SALES_RECLAMATION_TYPE() if $self->customer_id;
return PURCHASE_RECLAMATION_TYPE() if $self->vendor_id;
return;
my $self = shift;
die "invalid type: " . $self->record_type if (!any { $self->record_type eq $_ } (
SALES_RECLAMATION_TYPE(),
PURCHASE_RECLAMATION_TYPE(),
));
return $self->record_type;
}
sub is_type {
......
my %record_args = (
record_number => undef,
record_type => $destination_type,
employee => SL::DB::Manager::Employee->current,
closed => 0,
delivered => 0,
SL/Dev/Record.pm
use SL::DB::Order::TypeData qw(:types);
use SL::DB::DeliveryOrder;
use SL::DB::DeliveryOrder::TypeData qw(:types);
use SL::DB::Reclamation;
use SL::DB::Reclamation::TypeData qw(:types);
use SL::DB::Employee;
use SL::Dev::Part qw(new_part);
use SL::Dev::CustomerVendor qw(new_vendor new_customer);
......
sub create_sales_reclamation {
my (%params) = @_;
my $record_type = 'sales_reclamation';
my $record_type = SALES_RECLAMATION_TYPE();
my $reclamation_items = delete $params{reclamation_items} // _create_two_items($record_type);
_check_items($reclamation_items, $record_type);
......
die "'customer' is not of type SL::DB::Customer" unless ref($customer) eq 'SL::DB::Customer';
my $reclamation = SL::DB::Reclamation->new(
record_type => $record_type,
customer_id => delete $params{customer_id} // $customer->id,
taxzone_id => delete $params{taxzone_id} // $customer->taxzone->id,
currency_id => delete $params{currency_id} // $::instance_conf->get_currency_id,
......
sub create_purchase_reclamation {
my (%params) = @_;
my $record_type = 'sales_reclamation';
my $record_type = PURCHASE_RECLAMATION_TYPE();
my $reclamation_items = delete $params{reclamation_items} // _create_two_items($record_type);
_check_items($reclamation_items, $record_type);
......
die "'vendor' is not of type SL::DB::Vendor" unless ref($vendor) eq 'SL::DB::Vendor';
my $reclamation = SL::DB::Reclamation->new(
record_type => $record_type,
vendor_id => delete $params{vendor_id} // $vendor->id,
taxzone_id => delete $params{taxzone_id} // $vendor->taxzone->id,
currency_id => delete $params{currency_id} // $::instance_conf->get_currency_id,

Auch abrufbar als: Unified diff