Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 5d33d048

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

  • ID 5d33d048fe4c2ea91bd31e152e28fc8d90f5bcd7
  • Vorgänger 9fec08f7
  • Nachfolger 1d2c5fc3

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
144 144
  purchase_delivery_order_show_delete       => { type => 'boolean', default => 'true' },
145 145
  purchase_order_show_delete                => { type => 'boolean', default => 'true' },
146 146
  quick_search_modules                      => { type => 'array' },
147
  rdonumber                                 => { type => 'text' },
147 148
  reqdate_interval                          => { type => 'integer', default => '0' },
148 149
  reqdate_on                                => { type => 'boolean', default => 'true' },
149 150
  require_transaction_description_ps        => { type => 'boolean', default => 'false', not_null => 1 },
......
178 179
  stocktaking_cutoff_date                   => { type => 'date' },
179 180
  stocktaking_qty_threshold                 => { type => 'numeric', default => '0', precision => 25, scale => 5 },
180 181
  stocktaking_warehouse_id                  => { type => 'integer' },
182
  sudonumber                                => { type => 'text' },
181 183
  taxnumber                                 => { type => 'text' },
182 184
  templates                                 => { type => 'text' },
183 185
  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 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 = (
20
  qw(invoice credit_note customer vendor sales_order purchase_order sales_quotation request_quotation part service assembly assortment letter),
21
  @{ SL::DB::DeliveryOrder::TypeData::valid_types() },
22
);
19 23

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

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

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

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

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

  
133 139
    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');
140
    my %numbers_in_use = selectall_as_map($form, $self->dbh, $query, $filters{trans_number}, 'in_use', @{ $filters{values} // [] });
135 141

  
136 142
    my $business_number;
137 143
    ($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