Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 5c03b316

Von Sven Schöling vor fast 3 Jahren hinzugefügt

  • ID 5c03b316c349b081a165f0c8b45348b70e712565
  • Vorgänger 94e5f462
  • Nachfolger c9847742

do: neue Nummerkreise für supplier und rma Lieferscheine

Unterschiede anzeigen:

SL/DB/DeliveryOrder/TypeData.pm
43 43
      is_customer    => 1,
44 44
      nr_key         => "donumber",
45 45
      transfer       => 'out',
46
      transnumber    => 'sdonumber',
46 47
    },
47 48
    part_classification_query => [ "used_for_sale" => 1 ],
48 49
    right => "sales_delivery_order_edit",
......
70 71
      is_customer    => 0,
71 72
      nr_key         => "donumber",
72 73
      transfer       => 'in',
74
      transnumber    => 'pdonumber',
73 75
    },
74 76
    part_classification_query => [ "used_for_purchase" => 1 ],
75 77
    right => "purchase_delivery_order_edit",
......
97 99
      is_customer    => 0,
98 100
      nr_key         => "donumber",
99 101
      transfer       => 'out',
102
      transnumber    => 'sudonumber',
100 103
    },
101 104
    part_classification_query => [ "used_for_purchase" => 1 ],
102 105
    right => "purchase_delivery_order_edit",
......
124 127
      is_customer    => 0,
125 128
      nr_key         => "donumber",
126 129
      transfer       => 'in',
130
      transnumber    => 'rdonumber',
127 131
    },
128 132
    part_classification_query => [ "used_for_sale" => 1 ],
129 133
    right => "sales_delivery_order_edit",
SL/DB/Helper/TransNumberGenerator.pm
30 30
              purchase_order          => { number_column => 'ordnumber',      number_range_column => 'ponumber',       scoping => \&oe_scoping,    },
31 31
              sales_delivery_order    => { number_column => 'donumber',       number_range_column => 'sdonumber',      scoping => \&do_scoping,    },
32 32
              purchase_delivery_order => { number_column => 'donumber',       number_range_column => 'pdonumber',      scoping => \&do_scoping,    },
33
              supplier_delivery_order => { number_column => 'donumber',       number_range_column => 'sudonumber',     scoping => \&do_scoping,    },
34
              rma_delivery_order      => { number_column => 'donumber',       number_range_column => 'rdonumber',      scoping => \&do_scoping,    },
33 35
              customer                => { number_column => 'customernumber', number_range_column => 'customernumber',                             },
34 36
              vendor                  => { number_column => 'vendornumber',   number_range_column => 'vendornumber',                               },
35 37
              part                    => { number_column => 'partnumber',     number_range_column => 'articlenumber',  scoping => \&parts_scoping, },
SL/DB/Manager/DeliveryOrder.pm
8 8
use SL::DB::Helper::Sorted;
9 9
use SL::DB::Helper::Filtered;
10 10

  
11
use SL::DB::DeliveryOrder::TypeData qw(validate_type);
12

  
11 13
sub object_class { 'SL::DB::DeliveryOrder' }
12 14

  
13 15
__PACKAGE__->make_manager_methods;
......
27 29
  my $class = shift;
28 30
  my $type  = lc(shift || '');
29 31

  
30
  return ('!customer_id' => undef) if $type eq 'sales_delivery_order';
31
  return ('!vendor_id'   => undef) if $type eq 'purchase_delivery_order';
32

  
33
  die "Unknown type $type";
32
  return type => validate_type($type);
34 33
}
35 34

  
36 35
sub _sort_spec {
SL/DB/MetaSetup/Default.pm
148 148
  purchase_delivery_order_show_delete       => { type => 'boolean', default => 'true' },
149 149
  purchase_order_show_delete                => { type => 'boolean', default => 'true' },
150 150
  quick_search_modules                      => { type => 'array' },
151
  rdonumber                                 => { type => 'text' },
151 152
  reqdate_interval                          => { type => 'integer', default => '0' },
152 153
  reqdate_on                                => { type => 'boolean', default => 'true' },
153 154
  require_transaction_description_ps        => { type => 'boolean', default => 'false', not_null => 1 },
......
182 183
  stocktaking_cutoff_date                   => { type => 'date' },
183 184
  stocktaking_qty_threshold                 => { type => 'numeric', default => '0', precision => 25, scale => 5 },
184 185
  stocktaking_warehouse_id                  => { type => 'integer' },
186
  sudonumber                                => { type => 'text' },
185 187
  taxnumber                                 => { type => 'text' },
186 188
  templates                                 => { type => 'text' },
187 189
  transfer_default                          => { type => 'boolean', default => 'true' },
SL/TransNumber.pm
9 9
use SL::DBUtils;
10 10
use SL::PrefixedNumber;
11 11
use SL::DB;
12
use SL::DB::DeliveryOrder::TypeData;
12 13

  
13 14
use Rose::Object::MakeMethods::Generic
14 15
(
15 16
 scalar => [ qw(type id number save dbh dbh_provided business_id) ],
16 17
);
17 18

  
18
my @SUPPORTED_TYPES = qw(invoice invoice_for_advance_payment final_invoice credit_note customer vendor sales_delivery_order purchase_delivery_order sales_order purchase_order sales_quotation request_quotation part service assembly assortment letter);
19
my @SUPPORTED_TYPES = qw(invoice invoice_for_advance_payment final_invoice credit_note customer vendor sales_delivery_order purchase_delivery_order sales_order purchase_order sales_quotation request_quotation part service assembly assortment letter),
20
  @{ SL::DB::DeliveryOrder::TypeData::valid_types() },
21
);
19 22

  
20 23
sub new {
21 24
  my $class = shift;
......
47 50
    $filters{numberfield}   = "${type}number";
48 51
    $filters{table}         = $type;
49 52

  
50
  } elsif ($type =~ /_delivery_order$/) {
51
    $filters{trans_number}  = "donumber";
52
    $filters{numberfield}   = $type eq 'sales_delivery_order' ? "sdonumber" : "pdonumber";
53
  } elsif ($type =~ /_delivery_order$/ && SL::DB::DeliveryOrder::TypeData::is_valid_type($type)) {
54
    $filters{trans_number}  = SL::DB::DeliveryOrder::TypeData::get3($type, 'properties', 'nr_key'),
55
    $filters{numberfield}   = SL::DB::DeliveryOrder::TypeData::get3($type, 'properties', 'transnumber'),
53 56
    $filters{table}         = "delivery_orders";
54
    $filters{where}         = $type =~ /^sales/ ? '(customer_id IS NOT NULL)' : '(vendor_id IS NOT NULL)';
57
    $filters{where}         = "order_type = ?";
58
    $filters{values}        = [ $::form->{type} ];
55 59

  
56 60
  } elsif ($type =~ /_order$/) {
57 61
    $filters{trans_number}  = "ordnumber";
......
96 100
  my @values = ($self->number);
97 101

  
98 102
  push @where, $filters{where} if $filters{where};
103
  push @values, @{ $filters{values} } if $filters{values};
99 104

  
100 105
  if ($self->id) {
101 106
    push @where,  qq|id <> ?|;
......
131 136
SQL
132 137

  
133 138
    do_query($form, $self->dbh, "LOCK TABLE " . $filters{table}) || die $self->dbh->errstr;
134
    my %numbers_in_use = selectall_as_map($form, $self->dbh, $query, $filters{trans_number}, 'in_use');
139
    my %numbers_in_use = selectall_as_map($form, $self->dbh, $query, $filters{trans_number}, 'in_use', @{ $filters{values} // [] });
135 140

  
136 141
    my $business_number;
137 142
    ($business_number) = selectfirst_array_query($form, $self->dbh, qq|SELECT customernumberinit FROM business WHERE id = ? FOR UPDATE|, $self->business_id) if $self->business_id;
sql/Pg-upgrade2/deliveryorder_transnumbers.sql
1
-- @tag: deliveryorder_transnumbers
2
-- @description: Nummernkreise für neue lieferscheintypen
3
-- @depends: release_3_5_8
4

  
5
ALTER TABLE defaults ADD COLUMN sudonumber TEXT;
6
ALTER TABLE defaults ADD COLUMN rdonumber TEXT;
7

  
8
UPDATE defaults SET
9
  sudonumber = '0',
10
  rdonumber = '0';
11

  

Auch abrufbar als: Unified diff