Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 7d7ab469

Von Tamino Steinert vor etwa 1 Jahr hinzugefügt

  • ID 7d7ab4697ecbbce599c8e57c21b4275a333f9ef6
  • Vorgänger 7f79abb4
  • Nachfolger 333daa0d

Reclamation: nutze Record-Type

Unterschiede anzeigen:

SL/Controller/Reclamation.pm
1465 1465
    $reclamation = SL::DB::Reclamation->new(id => $::form->{id})->load();
1466 1466
  } else {
1467 1467
    $reclamation = SL::DB::Reclamation->new(
1468
                     record_type        => $self->type,
1468 1469
                     reclamation_items  => [],
1469 1470
                     currency_id => $::instance_conf->get_currency_id(),
1470 1471
                   );
SL/DB/Reclamation.pm
108 108
sub record_items { goto &reclamation_items; }
109 109

  
110 110
sub type {
111
  my ($self) = @_;
112

  
113
  return SALES_RECLAMATION_TYPE()    if $self->customer_id;
114
  return PURCHASE_RECLAMATION_TYPE() if $self->vendor_id;
115

  
116
  return;
111
  my $self = shift;
112
  die "invalid type: " . $self->record_type if (!any { $self->record_type eq $_ } (
113
      SALES_RECLAMATION_TYPE(),
114
      PURCHASE_RECLAMATION_TYPE(),
115
    ));
116
  return $self->record_type;
117 117
}
118 118

  
119 119
sub is_type {
......
281 281

  
282 282
  my %record_args = (
283 283
    record_number => undef,
284
    record_type   => $destination_type,
284 285
    employee => SL::DB::Manager::Employee->current,
285 286
    closed    => 0,
286 287
    delivered => 0,
SL/Dev/Record.pm
36 36
use SL::DB::Order::TypeData qw(:types);
37 37
use SL::DB::DeliveryOrder;
38 38
use SL::DB::DeliveryOrder::TypeData qw(:types);
39
use SL::DB::Reclamation;
40
use SL::DB::Reclamation::TypeData qw(:types);
39 41
use SL::DB::Employee;
40 42
use SL::Dev::Part qw(new_part);
41 43
use SL::Dev::CustomerVendor qw(new_vendor new_customer);
......
245 247
sub create_sales_reclamation {
246 248
  my (%params) = @_;
247 249

  
248
  my $record_type = 'sales_reclamation';
250
  my $record_type = SALES_RECLAMATION_TYPE();
249 251
  my $reclamation_items = delete $params{reclamation_items} // _create_two_items($record_type);
250 252
  _check_items($reclamation_items, $record_type);
251 253

  
......
255 257
  die "'customer' is not of type SL::DB::Customer" unless ref($customer) eq 'SL::DB::Customer';
256 258

  
257 259
  my $reclamation = SL::DB::Reclamation->new(
260
    record_type  => $record_type,
258 261
    customer_id  => delete $params{customer_id} // $customer->id,
259 262
    taxzone_id   => delete $params{taxzone_id}  // $customer->taxzone->id,
260 263
    currency_id  => delete $params{currency_id} // $::instance_conf->get_currency_id,
......
274 277
sub create_purchase_reclamation {
275 278
  my (%params) = @_;
276 279

  
277
  my $record_type = 'sales_reclamation';
280
  my $record_type = PURCHASE_RECLAMATION_TYPE();
278 281
  my $reclamation_items = delete $params{reclamation_items} // _create_two_items($record_type);
279 282
  _check_items($reclamation_items, $record_type);
280 283

  
......
284 287
  die "'vendor' is not of type SL::DB::Vendor" unless ref($vendor) eq 'SL::DB::Vendor';
285 288

  
286 289
  my $reclamation = SL::DB::Reclamation->new(
290
    record_type  => $record_type,
287 291
    vendor_id    => delete $params{vendor_id}   // $vendor->id,
288 292
    taxzone_id   => delete $params{taxzone_id}  // $vendor->taxzone->id,
289 293
    currency_id  => delete $params{currency_id} // $::instance_conf->get_currency_id,

Auch abrufbar als: Unified diff