Revision df0d4d3f
Von Moritz Bunkus vor mehr als 13 Jahren hinzugefügt
SL/TransNumber.pm | ||
---|---|---|
13 | 13 |
scalar => [ qw(type id number save dbh dbh_provided business_id) ], |
14 | 14 |
); |
15 | 15 |
|
16 |
my @SUPPORTED_TYPES = qw(invoice credit_note customer vendor sales_delivery_order purchase_delivery_order sales_order purchase_order sales_quotation request_quotation); |
|
16 |
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);
|
|
17 | 17 |
|
18 | 18 |
sub new { |
19 | 19 |
my $class = shift; |
... | ... | |
58 | 58 |
$filters{where} = 'NOT COALESCE(quotation, FALSE)'; |
59 | 59 |
$filters{where} .= $type =~ /^sales/ ? ' AND (customer_id IS NOT NULL)' : ' AND (vendor_id IS NOT NULL)'; |
60 | 60 |
|
61 |
} else {
|
|
61 |
} elsif ($type =~ /_quotation$/) {
|
|
62 | 62 |
$filters{trans_number} = "quonumber"; |
63 | 63 |
$filters{numberfield} = $type eq 'sales_quotation' ? "sqnumber" : "rfqnumber"; |
64 | 64 |
$filters{table} = "oe"; |
65 | 65 |
$filters{where} = 'COALESCE(quotation, FALSE)'; |
66 | 66 |
$filters{where} .= $type =~ /^sales/ ? ' AND (customer_id IS NOT NULL)' : ' AND (vendor_id IS NOT NULL)'; |
67 |
|
|
68 |
} elsif ($type =~ /part|service|assembly/) { |
|
69 |
$filters{trans_number} = "partnumber"; |
|
70 |
$filters{numberfield} = $type eq 'service' ? 'servicenumber' : 'articlenumber'; |
|
71 |
$filters{table} = "parts"; |
|
72 |
$filters{where} = 'COALESCE(inventory_accno_id, 0) ' . ($type eq 'service' ? '=' : '<>') . ' 0'; |
|
67 | 73 |
} |
68 | 74 |
|
69 | 75 |
return %filters; |
... | ... | |
86 | 92 |
push @values, conv_i($self->id); |
87 | 93 |
} |
88 | 94 |
|
89 |
my $where_str = @where ? join(' AND ', map { "($_)" } @where) : ''; |
|
95 |
my $where_str = @where ? ' AND ' . join(' AND ', map { "($_)" } @where) : '';
|
|
90 | 96 |
my $query = <<SQL; |
91 | 97 |
SELECT $filters{trans_number} |
92 | 98 |
FROM $filters{table} |
Auch abrufbar als: Unified diff
Verhindern, dass Artikelnummern mehrfach vergeben werden
Fix für Bug 1667.