Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 7e8a3b38

Von Tamino Steinert vor etwa 1 Jahr hinzugefügt

  • ID 7e8a3b385c1f43fff84f1b29bb89783fefb83685
  • Vorgänger e541480f
  • Nachfolger abed526f

DB::Order: Funktionen angepasst (kein Angebotsflag/Intakeflag)

Unterschiede anzeigen:

SL/DB/Manager/Order.pm
4 4

  
5 5
use parent qw(SL::DB::Helper::Manager);
6 6

  
7
use SL::DB::Order::TypeData qw(:types);
7 8
use SL::DB::Helper::Paginated;
8 9
use SL::DB::Helper::Sorted;
9 10
use SL::DB::Helper::Filtered;
10 11

  
12
use List::MoreUtils qw(any);
13

  
11 14
sub object_class { 'SL::DB::Order' }
12 15

  
13 16
__PACKAGE__->make_manager_methods;
......
28 31
  my $type   = lc(shift || '');
29 32
  my $prefix = shift || '';
30 33

  
31
  return (and => [ "!${prefix}customer_id" => undef,         "${prefix}quotation" => 1                                                          ]) if $type eq 'sales_quotation';
32
  return (and => [ "!${prefix}vendor_id"   => undef,         "${prefix}quotation" => 1, "${prefix}intake"    => 0                               ]) if $type eq 'request_quotation';
33
  return (and => [ "!${prefix}customer_id" => undef,         "${prefix}intake"    => 1                                                          ]) if $type eq 'sales_order_intake';
34
  return (and => [ "!${prefix}vendor_id"   => undef,         "${prefix}intake"    => 1, "${prefix}quotation" => 1                               ]) if $type eq 'purchase_quotation_intake';
35
  return (and => [ "!${prefix}customer_id" => undef, or => [ "${prefix}quotation" => 0, "${prefix}quotation" => undef ], "${prefix}intake" => 0 ]) if $type eq 'sales_order';
36
  return (and => [ "!${prefix}vendor_id"   => undef, or => [ "${prefix}quotation" => 0, "${prefix}quotation" => undef ]                         ]) if $type eq 'purchase_order';
34
  return ("${prefix}record_type" => $type) if( any {$type eq $_} (
35
      SALES_ORDER_INTAKE_TYPE(),
36
      SALES_ORDER_TYPE(),
37
      SALES_QUOTATION_TYPE(),
38
      PURCHASE_ORDER_TYPE(),
39
      REQUEST_QUOTATION_TYPE(),
40
      PURCHASE_QUOTATION_INTAKE_TYPE(),
41
    ));
37 42

  
38 43
  die "Unknown type $type";
39 44
}
SL/DB/Order.pm
93 93
  # least an empty string, even if we're saving a quotation.
94 94
  $self->ordnumber('') if !$self->ordnumber;
95 95

  
96
  my $field = $self->quotation ? 'quonumber' : 'ordnumber';
97
  $self->create_trans_number if !$self->$field;
96
  $self->create_trans_number if !$self->record_number;
98 97

  
99 98
  return 1;
100 99
}
......
177 176
  return shift->type eq shift;
178 177
}
179 178

  
179
sub quotation {
180
  my $type = shift->type();
181
  if (any { $type eq $_ } (
182
      SALES_ORDER_INTAKE_TYPE(),
183
      SALES_QUOTATION_TYPE(),
184
      REQUEST_QUOTATION_TYPE(),
185
      PURCHASE_QUOTATION_INTAKE_TYPE(),
186
    )) {
187
    return 1;
188
  };
189
  return 0;
190
}
191

  
192
sub intake {
193
  my $type = shift->type();
194
  if (any { $type eq $_ } (
195
      SALES_ORDER_INTAKE_TYPE(),
196
      PURCHASE_QUOTATION_INTAKE_TYPE(),
197
    )) {
198
    return 1;
199
  };
200
  return 0;
201
}
202

  
180 203
sub deliverydate {
181 204
  # oe doesn't have deliverydate, but it does have reqdate.
182 205
  # But this has a different meaning for sales quotations.
......
391 414
                                               ordnumber payment_id quonumber reqdate salesman_id shippingpoint shipvia taxincluded tax_point taxzone_id
392 415
                                               transaction_description vendor_id billing_address_id
393 416
                                            )),
394
                 quotation => !!(($destination_type =~ m{quotation$}) || ($destination_type eq 'purchase_quotation_intake')),
395
                 intake    => !!($destination_type =~ m{intake$}),
396 417
                 closed    => 0,
397 418
                 delivered => 0,
398 419
                 transdate => DateTime->today_local,

Auch abrufbar als: Unified diff