Revision 98b64fe1
Von Kivitendo Admin vor etwa 8 Jahren hinzugefügt
SL/Common.pm | ||
---|---|---|
67 | 67 |
} |
68 | 68 |
|
69 | 69 |
if ($form->{no_assemblies}) { |
70 |
$filter .= qq| AND (NOT COALESCE(assembly, FALSE))|;
|
|
70 |
$filter .= qq| AND (NOT part_type = 'assembly')|;
|
|
71 | 71 |
} |
72 | 72 |
if ($form->{assemblies}) { |
73 |
$filter .= qq| AND assembly=TRUE|;
|
|
73 |
$filter .= qq| AND part_type = 'assembly'|;
|
|
74 | 74 |
} |
75 | 75 |
|
76 | 76 |
if ($form->{no_services}) { |
77 |
$filter .= qq| AND (inventory_accno_id is not NULL or assembly=TRUE)|;
|
|
77 |
$filter .= qq| AND NOT (part_type = 'service' OR part_type = 'assembly')|;
|
|
78 | 78 |
} |
79 | 79 |
|
80 | 80 |
substr($filter, 1, 3) = "WHERE" if ($filter); |
SL/Controller/CsvImport/Part.pm | ||
---|---|---|
97 | 97 |
sub init_parts_by { |
98 | 98 |
my ($self) = @_; |
99 | 99 |
|
100 |
# my $parts_by = { id => { map { ( $_->id => $_ ) } grep { !$_->assembly } @{ $self->existing_objects } },
|
|
100 |
# my $parts_by = { id => { map { ( $_->id => $_ ) } grep { !$_->part_type = 'assembly' } @{ $self->existing_objects } },
|
|
101 | 101 |
# partnumber => { part => { }, |
102 | 102 |
# service => { } } }; |
103 | 103 |
# |
104 | 104 |
# foreach my $part (@{ $self->existing_objects }) { |
105 |
# next if $part->assembly;
|
|
105 |
# next if $part->part_type eq 'assembly';
|
|
106 | 106 |
# $parts_by->{partnumber}->{ $part->type }->{ $part->partnumber } = $part; |
107 | 107 |
# } |
108 | 108 |
|
... | ... | |
675 | 675 |
my ($self) = @_; |
676 | 676 |
|
677 | 677 |
my $profile = $self->SUPER::init_profile; |
678 |
delete @{$profile}{qw(alternate assembly bom expense_accno_id income_accno_id inventory_accno_id makemodel priceupdate stockable type)};
|
|
678 |
delete @{$profile}{qw(bom expense_accno_id income_accno_id inventory_accno_id makemodel priceupdate stockable type)}; |
|
679 | 679 |
|
680 | 680 |
$profile->{"pricegroup_$_"} = '' for 1 .. scalar @{ $_[0]->all_pricegroups }; |
681 | 681 |
|
SL/DB/Helper/FlattenToForm.pm | ||
---|---|---|
82 | 82 |
|
83 | 83 |
$form->{"partsgroup_${idx}"} = $item->part->partsgroup->partsgroup if _has($item->part, 'partsgroup_id'); |
84 | 84 |
_copy($item, $form, "${items_name}_", "_${idx}", 0, qw(id)) if $items_name; |
85 |
_copy($item->part, $form, '', "_${idx}", 0, qw(id partnumber weight assembly)); |
|
85 |
# TODO: is part_type correct here? Do we need to set part_type as default? |
|
86 |
_copy($item->part, $form, '', "_${idx}", 0, qw(id partnumber weight part_type)); |
|
86 | 87 |
_copy($item->part, $form, '', "_${idx}", 0, qw(listprice)); |
87 | 88 |
_copy($item, $form, '', "_${idx}", 0, qw(description project_id ship serialnumber pricegroup_id ordnumber donumber cusordnumber unit |
88 | 89 |
subtotal longdescription price_factor_id marge_price_factor approved_sellprice reqdate transdate |
SL/DB/Manager/Part.pm | ||
---|---|---|
33 | 33 |
|
34 | 34 |
$prefix //= ''; |
35 | 35 |
|
36 |
# this is to make selection like type => { part => 1, service => 1 } work
|
|
36 |
# this is to make selections like part_type => { part => 1, service => 1 } work
|
|
37 | 37 |
if ('HASH' eq ref $type) { |
38 | 38 |
$type = [ grep { $type->{$_} } keys %$type ]; |
39 | 39 |
} |
... | ... | |
43 | 43 |
|
44 | 44 |
for my $type (@types) { |
45 | 45 |
if ($type =~ m/^part/) { |
46 |
push @filter, (and => [ or => [ $prefix . assembly => 0, $prefix . assembly => undef ], |
|
47 |
"!${prefix}inventory_accno_id" => 0, |
|
48 |
"!${prefix}inventory_accno_id" => undef, |
|
49 |
]); |
|
46 |
push @filter, ($prefix . part_type => 'part'); |
|
50 | 47 |
} elsif ($type =~ m/^service/) { |
51 |
push @filter, (and => [ or => [ $prefix . assembly => 0, $prefix . assembly => undef ], |
|
52 |
or => [ $prefix . inventory_accno_id => 0, $prefix . inventory_accno_id => undef ], |
|
53 |
]); |
|
54 |
} elsif ($type =~ m/^assembl/) { |
|
55 |
push @filter, ($prefix . assembly => 1); |
|
48 |
push @filter, ($prefix . part_type => 'service'); |
|
49 |
} elsif ($type =~ m/^assembly/) { |
|
50 |
push @filter, ($prefix . part_type => 'assembly'); |
|
56 | 51 |
} |
57 | 52 |
} |
58 | 53 |
|
SL/DB/Part.pm | ||
---|---|---|
61 | 61 |
return $self->type eq $type ? 1 : 0; |
62 | 62 |
} |
63 | 63 |
|
64 |
sub is_part { $_[0]->is_type('part') }
|
|
65 |
sub is_assembly { $_[0]->is_type('assembly') }
|
|
66 |
sub is_service { $_[0]->is_type('service') }
|
|
64 |
sub is_part { $_[0]->part_type eq 'part' }
|
|
65 |
sub is_assembly { $_[0]->part_type eq 'assembly' }
|
|
66 |
sub is_service { $_[0]->part_type eq 'service' }
|
|
67 | 67 |
|
68 | 68 |
sub type { |
69 |
my ($self, $type) = @_; |
|
70 |
if (@_ > 1) { |
|
71 |
die 'invalid type' unless $type =~ /^(?:part|service|assembly)$/; |
|
72 |
$self->assembly( $type eq 'assembly' ? 1 : 0); |
|
73 |
$self->inventory_accno_id($type eq 'part' ? 1 : undef); |
|
74 |
} |
|
75 |
|
|
76 |
return 'assembly' if $self->assembly; |
|
77 |
return 'part' if $self->inventory_accno_id; |
|
78 |
return 'service'; |
|
69 |
return $_[0]->part_type; |
|
70 |
# my ($self, $type) = @_; |
|
71 |
# if (@_ > 1) { |
|
72 |
# die 'invalid type' unless $type =~ /^(?:part|service|assembly)$/; |
|
73 |
# $self->assembly( $type eq 'assembly' ? 1 : 0); |
|
74 |
# $self->inventory_accno_id($type ne 'service' ? 1 : undef); |
|
75 |
# } |
|
76 |
|
|
77 |
# return 'assembly' if $self->assembly; |
|
78 |
# return 'part' if $self->inventory_accno_id; |
|
79 |
# return 'service'; |
|
79 | 80 |
} |
80 | 81 |
|
81 | 82 |
sub new_part { |
82 | 83 |
my ($class, %params) = @_; |
83 |
$class->new(%params, type => 'part'); |
|
84 |
$class->new(%params, part_type => 'part');
|
|
84 | 85 |
} |
85 | 86 |
|
86 | 87 |
sub new_assembly { |
87 | 88 |
my ($class, %params) = @_; |
88 |
$class->new(%params, type => 'assembly'); |
|
89 |
$class->new(%params, part_type => 'assembly');
|
|
89 | 90 |
} |
90 | 91 |
|
91 | 92 |
sub new_service { |
92 | 93 |
my ($class, %params) = @_; |
93 |
$class->new(%params, type => 'service'); |
|
94 |
$class->new(%params, part_type => 'service');
|
|
94 | 95 |
} |
95 | 96 |
|
96 | 97 |
sub orphaned { |
SL/DO.pm | ||
---|---|---|
779 | 779 |
# stuff different from the whole will not be overwritten, but saved with a suffix. |
780 | 780 |
$query = |
781 | 781 |
qq|SELECT doi.id AS delivery_order_items_id, |
782 |
p.partnumber, p.assembly, p.listprice, doi.description, doi.qty,
|
|
782 |
p.partnumber, p.part_type, p.listprice, doi.description, doi.qty,
|
|
783 | 783 |
doi.sellprice, doi.parts_id AS id, doi.unit, doi.discount, p.notes AS partnotes, |
784 | 784 |
doi.reqdate, doi.project_id, doi.serialnumber, doi.lastcost, |
785 | 785 |
doi.ordnumber, doi.transdate, doi.cusordnumber, doi.longdescription, |
SL/Form.pm | ||
---|---|---|
3180 | 3180 |
my @values; |
3181 | 3181 |
|
3182 | 3182 |
if ($p->{searchitems} eq 'part') { |
3183 |
$query .= qq|WHERE p.inventory_accno_id > 0|;
|
|
3183 |
$query .= qq|WHERE p.part_type = 'part'|;
|
|
3184 | 3184 |
} |
3185 | 3185 |
if ($p->{searchitems} eq 'service') { |
3186 |
$query .= qq|WHERE p.inventory_accno_id IS NULL|;
|
|
3186 |
$query .= qq|WHERE p.part_type = 'service'|;
|
|
3187 | 3187 |
} |
3188 | 3188 |
if ($p->{searchitems} eq 'assembly') { |
3189 |
$query .= qq|WHERE p.assembly = '1'|; |
|
3190 |
} |
|
3191 |
if ($p->{searchitems} eq 'labor') { |
|
3192 |
$query .= qq|WHERE (p.inventory_accno_id > 0) AND (p.income_accno_id IS NULL)|; |
|
3189 |
$query .= qq|WHERE p.part_type = 'assembly'|; |
|
3193 | 3190 |
} |
3194 | 3191 |
|
3195 | 3192 |
$query .= qq|ORDER BY partsgroup|; |
SL/IC.pm | ||
---|---|---|
78 | 78 |
$form->{lastmtime} = $form->{mtime}; |
79 | 79 |
$form->{onhand} *= 1; |
80 | 80 |
|
81 |
die "part needs a part_type" unless $form->{part_type}; # TODO from part_type enum conversion |
|
81 | 82 |
# part or service item |
82 |
$form->{item} = ($form->{inventory_accno}) ? 'part' : 'service'; |
|
83 |
if ($form->{assembly}) { |
|
84 |
$form->{item} = 'assembly'; |
|
83 |
$form->{item} = $form->{part_type}; |
|
84 |
if ($form->{item} eq 'assembly') { |
|
85 | 85 |
|
86 | 86 |
# retrieve assembly items |
87 | 87 |
$query = |
... | ... | |
256 | 256 |
|
257 | 257 |
my $makemodel = ($form->{make_1} || $form->{model_1} || ($form->{makemodel_rows} > 1)) ? 1 : 0; |
258 | 258 |
|
259 |
$form->{assembly} = ($form->{item} eq 'assembly') ? 1 : 0; |
|
260 | 259 |
|
261 | 260 |
my ($query, $sth); |
262 | 261 |
|
... | ... | |
300 | 299 |
$form->{partnumber} ||= $trans_number->create_unique; |
301 | 300 |
|
302 | 301 |
($form->{id}) = selectrow_query($form, $dbh, qq|SELECT nextval('id')|); |
303 |
do_query($form, $dbh, qq|INSERT INTO parts (id, partnumber, unit) VALUES (?, ?, ?)|, $form->{id}, $form->{partnumber}, $form->{unit});
|
|
302 |
do_query($form, $dbh, qq|INSERT INTO parts (id, partnumber, unit, part_type) VALUES (?, ?, ?, ?)|, $form->{id}, $form->{partnumber}, $form->{unit}, $form->{item});
|
|
304 | 303 |
|
305 | 304 |
$form->{orphaned} = 1; |
306 | 305 |
} |
... | ... | |
336 | 335 |
partnumber = ?, |
337 | 336 |
description = ?, |
338 | 337 |
makemodel = ?, |
339 |
assembly = ?, |
|
340 | 338 |
listprice = ?, |
341 | 339 |
sellprice = ?, |
342 | 340 |
lastcost = ?, |
... | ... | |
362 | 360 |
has_sernumber = ?, |
363 | 361 |
not_discountable = ?, |
364 | 362 |
microfiche = ?, |
363 |
part_type = ?, |
|
365 | 364 |
partsgroup_id = ?, |
366 | 365 |
price_factor_id = ? |
367 | 366 |
$priceupdate |
... | ... | |
369 | 368 |
@values = ($form->{partnumber}, |
370 | 369 |
$form->{description}, |
371 | 370 |
$makemodel ? 't' : 'f', |
372 |
$form->{assembly} ? 't' : 'f', |
|
373 | 371 |
$form->{listprice}, |
374 | 372 |
$form->{sellprice}, |
375 | 373 |
$form->{lastcost}, |
... | ... | |
393 | 391 |
$form->{has_sernumber} ? 't' : 'f', |
394 | 392 |
$form->{not_discountable} ? 't' : 'f', |
395 | 393 |
$form->{microfiche}, |
394 |
$form->{item}, |
|
396 | 395 |
conv_i($partsgroup_id), |
397 | 396 |
conv_i($form->{price_factor_id}), |
398 | 397 |
conv_i($form->{id}) |
... | ... | |
576 | 575 |
FROM parts p2, assembly a |
577 | 576 |
WHERE (p2.id = a.parts_id) AND (a.id = p.id)) AS inventory |
578 | 577 |
FROM parts p |
579 |
WHERE NOT p.obsolete AND p.assembly $where|;
|
|
578 |
WHERE NOT p.obsolete AND p.part_type = 'assembly' $where|;
|
|
580 | 579 |
|
581 | 580 |
$form->{assembly_items} = selectall_hashref_query($form, $dbh, $query, @values); |
582 | 581 |
|
... | ... | |
893 | 892 |
} |
894 | 893 |
|
895 | 894 |
for ($form->{searchitems}) { |
896 |
push @where_tokens, 'p.inventory_accno_id > 0' if /part/; |
|
897 |
push @where_tokens, 'p.inventory_accno_id IS NULL' if /service/; |
|
898 |
push @where_tokens, 'NOT p.assembly' if /service/; |
|
899 |
push @where_tokens, ' p.assembly' if /assembly/; |
|
895 |
push @where_tokens, "p.part_type = 'part'" if /part/; |
|
896 |
push @where_tokens, "p.part_type = 'service'" if /service/; |
|
897 |
push @where_tokens, "p.part_type = 'assembly'" if /assembly/; |
|
900 | 898 |
} |
901 | 899 |
|
902 | 900 |
for ($form->{itemstatus}) { |
SL/IR.pm | ||
---|---|---|
1218 | 1218 |
my $i = $form->{rowcount}; |
1219 | 1219 |
|
1220 | 1220 |
# don't include assemblies or obsolete parts |
1221 |
my $where = "NOT p.assembly = '1' AND NOT p.obsolete = '1'";
|
|
1221 |
my $where = "NOT p.part_type = 'assembly' AND NOT p.obsolete = '1'";
|
|
1222 | 1222 |
my @values; |
1223 | 1223 |
|
1224 | 1224 |
foreach my $table_column (qw(p.partnumber p.description pg.partsgroup)) { |
... | ... | |
1276 | 1276 |
my $query = |
1277 | 1277 |
qq|SELECT |
1278 | 1278 |
p.id, p.partnumber, p.description, p.lastcost AS sellprice, p.listprice, |
1279 |
p.unit, p.assembly, p.onhand, p.formel,
|
|
1279 |
p.unit, p.part_type, p.onhand, p.formel,
|
|
1280 | 1280 |
p.notes AS partnotes, p.notes AS longdescription, p.not_discountable, |
1281 | 1281 |
p.inventory_accno_id, p.price_factor_id, |
1282 | 1282 |
p.ean, |
SL/IS.pm | ||
---|---|---|
1656 | 1656 |
my ($dbh, $myconfig, $form, $position, $id, $totalqty) = @_; |
1657 | 1657 |
|
1658 | 1658 |
my $query = |
1659 |
qq|SELECT a.parts_id, a.qty, p.assembly, p.partnumber, p.description, p.unit,
|
|
1659 |
qq|SELECT a.parts_id, a.qty, p.part_type, p.partnumber, p.description, p.unit,
|
|
1660 | 1660 |
p.inventory_accno_id, p.income_accno_id, p.expense_accno_id |
1661 | 1661 |
FROM assembly a |
1662 | 1662 |
JOIN parts p ON (a.parts_id = p.id) |
... | ... | |
1797 | 1797 |
|
1798 | 1798 |
# reverse inventory items |
1799 | 1799 |
my $query = |
1800 |
qq|SELECT i.id, i.parts_id, i.qty, i.assemblyitem, p.assembly, p.inventory_accno_id
|
|
1800 |
qq|SELECT i.id, i.parts_id, i.qty, i.assemblyitem, p.part_type, p.inventory_accno_id
|
|
1801 | 1801 |
FROM invoice i |
1802 | 1802 |
JOIN parts p ON (i.parts_id = p.id) |
1803 | 1803 |
WHERE i.trans_id = ?|; |
... | ... | |
2003 | 2003 |
i.description, i.longdescription, i.qty, i.fxsellprice AS sellprice, i.discount, i.parts_id AS id, i.unit, i.deliverydate AS reqdate, |
2004 | 2004 |
i.project_id, i.serialnumber, i.pricegroup_id, i.ordnumber, i.donumber, i.transdate, i.cusordnumber, i.subtotal, i.lastcost, |
2005 | 2005 |
i.price_factor_id, i.price_factor, i.marge_price_factor, i.active_price_source, i.active_discount_source, |
2006 |
p.partnumber, p.assembly, p.notes AS partnotes, p.inventory_accno_id AS part_inventory_accno_id, p.formel, p.listprice,
|
|
2006 |
p.partnumber, p.part_type, p.notes AS partnotes, p.inventory_accno_id AS part_inventory_accno_id, p.formel, p.listprice,
|
|
2007 | 2007 |
pr.projectnumber, pg.partsgroup, prg.pricegroup |
2008 | 2008 |
|
2009 | 2009 |
FROM invoice i |
... | ... | |
2314 | 2314 |
c3.new_chart_id AS expense_new_chart, |
2315 | 2315 |
date($transdate) - c3.valid_from AS expense_valid, |
2316 | 2316 |
|
2317 |
p.unit, p.assembly, p.onhand,
|
|
2317 |
p.unit, p.part_type, p.onhand,
|
|
2318 | 2318 |
p.notes AS partnotes, p.notes AS longdescription, |
2319 | 2319 |
p.not_discountable, p.formel, p.payment_id AS part_payment_id, |
2320 | 2320 |
p.price_factor_id, p.weight, |
SL/OE.pm | ||
---|---|---|
1093 | 1093 |
c2.accno AS income_accno, c2.new_chart_id AS income_new_chart, date($transdate) - c2.valid_from as income_valid, |
1094 | 1094 |
c3.accno AS expense_accno, c3.new_chart_id AS expense_new_chart, date($transdate) - c3.valid_from as expense_valid, |
1095 | 1095 |
oe.ordnumber AS ordnumber_oe, oe.transdate AS transdate_oe, oe.cusordnumber AS cusordnumber_oe, |
1096 |
p.partnumber, p.assembly, p.listprice, o.description, o.qty,
|
|
1096 |
p.partnumber, p.part_type, p.listprice, o.description, o.qty,
|
|
1097 | 1097 |
o.sellprice, o.parts_id AS id, o.unit, o.discount, p.notes AS partnotes, p.inventory_accno_id AS part_inventory_accno_id, |
1098 | 1098 |
o.reqdate, o.project_id, o.serialnumber, o.ship, o.lastcost, |
1099 | 1099 |
o.ordnumber, o.transdate, o.cusordnumber, o.subtotal, o.longdescription, |
SL/WH.pm | ||
---|---|---|
191 | 191 |
|
192 | 192 |
my $query = qq|SELECT assembly.parts_id, assembly.qty, parts.warehouse_id |
193 | 193 |
FROM assembly INNER JOIN parts ON assembly.parts_id = parts.id |
194 |
WHERE assembly.id = ? AND (inventory_accno_id IS NOT NULL OR parts.assembly = TRUE)|;
|
|
194 |
WHERE assembly.id = ? AND parts.part_type != 'service'|;
|
|
195 | 195 |
|
196 | 196 |
my $sth_part_qty_assembly = prepare_execute_query($form, $dbh, $query, $params{assembly_id}); |
197 | 197 |
|
bin/mozilla/io.pl | ||
---|---|---|
604 | 604 |
|
605 | 605 |
my @new_fields = |
606 | 606 |
qw(id partnumber description sellprice listprice inventory_accno |
607 |
income_accno expense_accno bin unit weight assembly taxaccounts
|
|
607 |
income_accno expense_accno bin unit weight part_type taxaccounts
|
|
608 | 608 |
partsgroup formel longdescription not_discountable partnotes lastcost |
609 | 609 |
price_factor_id price_factor); |
610 | 610 |
|
sql/Pg-upgrade2/erzeugnisnummern.pl | ||
---|---|---|
79 | 79 |
} |
80 | 80 |
|
81 | 81 |
if ($::form->{filter_type} eq 'assembly') { |
82 |
$where .= ' AND assembly';
|
|
82 |
$where .= " AND part_type = 'assembly'";
|
|
83 | 83 |
} |
84 | 84 |
|
85 | 85 |
if ($::form->{filter_type} eq 'service') { |
86 |
$where .= ' AND inventory_accno_id IS NULL AND NOT assembly';
|
|
86 |
$where .= " AND part_type = 'service'";
|
|
87 | 87 |
} |
88 | 88 |
|
89 | 89 |
if ($::form->{filter_type} eq 'part') { |
90 |
$where .= ' AND inventory_accno_id IS NOT NULL'; |
|
91 |
$where .= ' AND NOT assembly'; |
|
90 |
$where .= " AND part_type = 'part'"; |
|
92 | 91 |
} |
93 | 92 |
|
94 | 93 |
if ($::form->{filter_obsolete} eq 'obsolete') { |
t/background_job/create_periodic_invoices.t | ||
---|---|---|
69 | 69 |
description => 'Fourty-two fifty-four', |
70 | 70 |
lastcost => 222.22, |
71 | 71 |
sellprice => 333.33, |
72 |
part_type => 'part', |
|
72 | 73 |
buchungsgruppen_id => $buchungsgruppe->id, |
73 | 74 |
unit => $unit->name, |
74 | 75 |
%{ $params{part} } |
t/controllers/financial_controlling/sales_order_with_periodic_invoices_config.t | ||
---|---|---|
66 | 66 |
description => 'Fourty-two fifty-four', |
67 | 67 |
lastcost => 222.22, |
68 | 68 |
sellprice => 333.33, |
69 |
part_type => 'part', |
|
69 | 70 |
buchungsgruppen_id => $buchungsgruppe->id, |
70 | 71 |
unit => $unit->name, |
71 | 72 |
%{ $params{part} } |
t/controllers/financial_overview/sales_orders.t | ||
---|---|---|
70 | 70 |
description => 'Fourty-two fifty-four', |
71 | 71 |
lastcost => 222.22, |
72 | 72 |
sellprice => 333.33, |
73 |
part_type => 'part', |
|
73 | 74 |
buchungsgruppen_id => $buchungsgruppe->id, |
74 | 75 |
unit => $unit->name, |
75 | 76 |
%{ $params{part} } |
t/controllers/helpers/parse_filter.t | ||
---|---|---|
243 | 243 |
}, 'object test simple', class => 'SL::DB::Manager::Part'; |
244 | 244 |
|
245 | 245 |
test { |
246 |
'type' => 'assembly', |
|
246 |
'part_type' => 'assembly',
|
|
247 | 247 |
}, { |
248 | 248 |
query => [ |
249 |
'assembly' => 1 |
|
250 |
], |
|
249 |
'part_type', |
|
250 |
'assembly' |
|
251 |
] , |
|
251 | 252 |
}, 'object test without prefix', class => 'SL::DB::Manager::Part'; |
252 | 253 |
|
253 | 254 |
test { |
254 |
'part.type' => 'assembly', |
|
255 |
'part.part_type' => 'assembly',
|
|
255 | 256 |
}, { |
256 | 257 |
query => [ |
257 |
'part.assembly' => 1 |
|
258 |
], |
|
258 |
'part.part_type', |
|
259 |
'assembly' |
|
260 |
] |
|
259 | 261 |
}, 'object test with prefix', class => 'SL::DB::Manager::OrderItem'; |
260 | 262 |
|
261 | 263 |
test { |
262 |
'type' => [ 'part', 'assembly' ], |
|
264 |
'part_type' => [ 'part', 'assembly' ],
|
|
263 | 265 |
}, { |
264 | 266 |
query => [ |
265 |
or => [
|
|
266 |
and => [ or => [ assembly => 0, assembly => undef ],
|
|
267 |
"!inventory_accno_id" => 0,
|
|
268 |
"!inventory_accno_id" => undef,
|
|
269 |
],
|
|
270 |
assembly => 1,
|
|
271 |
] |
|
272 |
],
|
|
267 |
'or',
|
|
268 |
[
|
|
269 |
'part_type',
|
|
270 |
'part',
|
|
271 |
'part_type',
|
|
272 |
'assembly'
|
|
273 |
]
|
|
274 |
]
|
|
273 | 275 |
}, 'object test without prefix but complex value', class => 'SL::DB::Manager::Part'; |
274 |
|
|
275 | 276 |
test { |
276 |
'part.type' => [ 'part', 'assembly' ], |
|
277 |
'part.part_type' => [ 'part', 'assembly' ],
|
|
277 | 278 |
}, { |
278 | 279 |
query => [ |
279 |
or => [
|
|
280 |
and => [ or => [ 'part.assembly' => 0, 'part.assembly' => undef ],
|
|
281 |
"!part.inventory_accno_id" => 0,
|
|
282 |
"!part.inventory_accno_id" => undef,
|
|
283 |
],
|
|
284 |
'part.assembly' => 1,
|
|
285 |
] |
|
286 |
],
|
|
280 |
'or',
|
|
281 |
[
|
|
282 |
'part.part_type',
|
|
283 |
'part',
|
|
284 |
'part.part_type',
|
|
285 |
'assembly'
|
|
286 |
]
|
|
287 |
]
|
|
287 | 288 |
}, 'object test with prefix but complex value', class => 'SL::DB::Manager::OrderItem'; |
288 | 289 |
|
289 | 290 |
test { |
t/db_helper/convert_invoice.t | ||
---|---|---|
93 | 93 |
'listprice' => '0.00000', |
94 | 94 |
'onhand' => '5.00000', |
95 | 95 |
'partnumber' => 'v-519160549', |
96 |
part_type => 'part', |
|
96 | 97 |
#'partsgroup_id' => 111645, |
97 | 98 |
'rop' => '0', |
98 | 99 |
'sellprice' => '242.20000', |
... | ... | |
113 | 114 |
'id' => 25505, |
114 | 115 |
'lastcost' => '153.00000', |
115 | 116 |
'listprice' => '0.00000', |
117 |
'part_type' => 'part', |
|
116 | 118 |
'onhand' => '9.00000', |
117 | 119 |
'partnumber' => 'v-120160086', |
118 | 120 |
# 'partsgroup_id' => 111639, |
t/db_helper/payment.t | ||
---|---|---|
147 | 147 |
description => 'Fourty-two fifty-four', |
148 | 148 |
lastcost => 1.93, |
149 | 149 |
sellprice => 2.34, |
150 |
part_type => 'part', |
|
150 | 151 |
buchungsgruppen_id => $buchungsgruppe->id, |
151 | 152 |
unit => $unit->name, |
152 | 153 |
%{ $params{part1} } |
... | ... | |
157 | 158 |
description => 'Zero EIGHT fifteeN @ 7%', |
158 | 159 |
lastcost => 5.473, |
159 | 160 |
sellprice => 9.714, |
161 |
part_type => 'part', |
|
160 | 162 |
buchungsgruppen_id => $buchungsgruppe7->id, |
161 | 163 |
unit => $unit->name, |
162 | 164 |
%{ $params{part2} } |
... | ... | |
166 | 168 |
description => 'Testware 19%', |
167 | 169 |
lastcost => 0, |
168 | 170 |
sellprice => 50, |
171 |
part_type => 'part', |
|
169 | 172 |
buchungsgruppen_id => $buchungsgruppe->id, |
170 | 173 |
unit => $unit->name, |
171 | 174 |
%{ $params{part3} } |
... | ... | |
175 | 178 |
description => 'Testware 7%', |
176 | 179 |
lastcost => 0, |
177 | 180 |
sellprice => 50, |
181 |
part_type => 'part', |
|
178 | 182 |
buchungsgruppen_id => $buchungsgruppe7->id, |
179 | 183 |
unit => $unit->name, |
180 | 184 |
%{ $params{part4} } |
t/db_helper/price_tax_calculator.t | ||
---|---|---|
62 | 62 |
description => 'Fourty-two fifty-four', |
63 | 63 |
lastcost => 1.93, |
64 | 64 |
sellprice => 2.34, |
65 |
part_type => 'part', |
|
65 | 66 |
buchungsgruppen_id => $buchungsgruppe->id, |
66 | 67 |
unit => $unit->name, |
67 | 68 |
%{ $params{part1} } |
... | ... | |
72 | 73 |
description => 'Zero EIGHT fifteeN @ 7%', |
73 | 74 |
lastcost => 5.473, |
74 | 75 |
sellprice => 9.714, |
76 |
part_type => 'part', |
|
75 | 77 |
buchungsgruppen_id => $buchungsgruppe7->id, |
76 | 78 |
unit => $unit->name, |
77 | 79 |
%{ $params{part2} } |
... | ... | |
82 | 84 |
description => 'Triple 8', |
83 | 85 |
lastcost => 0, |
84 | 86 |
sellprice => 0.6, |
87 |
part_type => 'part', |
|
85 | 88 |
buchungsgruppen_id => $buchungsgruppe->id, |
86 | 89 |
unit => $unit->name, |
87 | 90 |
%{ $params{part3} } |
t/part/assembly.t | ||
---|---|---|
20 | 20 |
|
21 | 21 |
is($assembly_part->inventory_accno_id, undef, "assembly doesn't have an inventory accno id"); |
22 | 22 |
|
23 |
is($assembly_part->type, 'assembly', 'assembly has correct type'); |
|
23 |
is($assembly_part->part_type, 'assembly', 'assembly has correct type');
|
|
24 | 24 |
is( scalar @{$assembly_part->assemblies}, 2, 'assembly consists of two parts' ); |
25 | 25 |
|
26 | 26 |
# fetch assembly item corresponding to partnumber 19000 |
... | ... | |
46 | 46 |
|
47 | 47 |
$part1 = SL::DB::Part->new_part(partnumber => '19000', |
48 | 48 |
unit => $unit->name, |
49 |
part_type => 'part', |
|
49 | 50 |
)->save; |
50 | 51 |
$part2 = $part1->clone_and_reset($part1); |
51 | 52 |
$part2->partnumber($part1->partnumber + 1); |
t/wh/transfer.t | ||
---|---|---|
26 | 26 |
SL::DB::Manager::Warehouse->delete_all(where => [ description => NAME() ]); |
27 | 27 |
|
28 | 28 |
# Create test data |
29 |
$part = SL::DB::Part->new(unit => 'mg', description => NAME(), partnumber => NAME()); |
|
29 |
$part = SL::DB::Part->new(unit => 'mg', description => NAME(), partnumber => NAME(), part_type => 'part');
|
|
30 | 30 |
$part->save(); |
31 | 31 |
|
32 | 32 |
is(ref($part), 'SL::DB::Part', 'loading a part to test with id ' . $part->id); |
Auch abrufbar als: Unified diff
Ware/Erzeugnis/Dienstleistung per parts.part_type unterscheiden 2
kivitendo Code angepasst.