Revision a000b4a2
Von Tamino Steinert vor mehr als 2 Jahren hinzugefügt
SL/Controller/Reclamation.pm | ||
---|---|---|
27 | 27 |
|
28 | 28 |
use SL::Helper::CreatePDF qw(:all); |
29 | 29 |
use SL::Helper::PrintOptions; |
30 |
use SL::Helper::ShippedQty; |
|
31 | 30 |
use SL::Helper::UserPreferences::PositionsScrollbar; |
32 | 31 |
use SL::Helper::UserPreferences::UpdatePositions; |
33 | 32 |
|
... | ... | |
900 | 899 |
reason => sub { $_[0]->reason eq undef ? "" : $_[0]->reason->name }, |
901 | 900 |
reason_description_ext => sub { $_[0]->reason_description_ext }, |
902 | 901 |
reason_description_int => sub { $_[0]->reason_description_int }, |
903 |
shipped_qty => sub { $_[0]->shipped_qty }, |
|
904 | 902 |
qty => sub { $_[0]->qty }, |
905 | 903 |
sellprice => sub { $_[0]->sellprice }, |
906 | 904 |
discount => sub { $_[0]->discount }, |
... | ... | |
909 | 907 |
|
910 | 908 |
$self->get_item_cvpartnumber($_) for @{$self->reclamation->items_sorted}; |
911 | 909 |
|
912 |
if ($::form->{order_by} eq 'shipped_qty') { |
|
913 |
# Calculate shipped qtys here to prevent calling calculate for every item |
|
914 |
# via the items method. Do not use write_to_objects to prevent |
|
915 |
# reclamation->delivered to be set, because this should be the value from |
|
916 |
# db, which can be set manually or is set when linked delivery orders are |
|
917 |
# saved. |
|
918 |
SL::Helper::ShippedQty->new->calculate($self->reclamation)->write_to(\@{$self->reclamation->items}); |
|
919 |
} |
|
920 |
|
|
921 | 910 |
my $method = $sort_keys{$::form->{order_by}}; |
922 | 911 |
my @to_sort = map { { old_pos => $_->position, order_by => $method->($_) } } @{ $self->reclamation->items_sorted }; |
923 | 912 |
if ($::form->{sort_dir}) { |
... | ... | |
1892 | 1881 |
$item->active_discount_source($price_source->discount_from_source($item->active_discount_source)); |
1893 | 1882 |
} |
1894 | 1883 |
|
1895 |
# Calculate shipped qtys here to prevent calling calculate for every item via |
|
1896 |
# the items method. Do not use write_to_objects to prevent |
|
1897 |
# reclamation->delivered to be set, because this should be the value from db, |
|
1898 |
# which can be set manually or is set when linked delivery orders are saved. |
|
1899 |
SL::Helper::ShippedQty->new->calculate($self->reclamation)->write_to(\@{$self->reclamation->items}); |
|
1900 |
|
|
1901 | 1884 |
if ($self->reclamation->record_number && $::instance_conf->get_webdav) { |
1902 | 1885 |
my $webdav = SL::Webdav->new( |
1903 | 1886 |
type => $self->type, |
... | ... | |
2631 | 2614 |
|
2632 | 2615 |
=item * |
2633 | 2616 |
|
2617 |
<<<<<<< HEAD |
|
2634 | 2618 |
Ordering item rows with drag and drop is possible. Sorting item rows is possible |
2635 | 2619 |
(by partnumber, description, reason, reason_description_int, |
2636 | 2620 |
reason_description_ext, qty, sellprice and discount for now). |
2621 |
======= |
|
2622 |
Ordering item rows with drag and drop is possible. Sorting item rows is |
|
2623 |
possible (by partnumber, description, reason, qty, sellprice |
|
2624 |
and discount for now). |
|
2625 |
>>>>>>> 66ac9fa6c7 (Reclamation: don't need shipped_qty) |
|
2637 | 2626 |
|
2638 | 2627 |
=item * |
2639 | 2628 |
|
SL/DB/ReclamationItem.pm | ||
---|---|---|
21 | 21 |
} |
22 | 22 |
}, |
23 | 23 |
); |
24 |
use SL::Helper::ShippedQty; |
|
25 | 24 |
|
26 | 25 |
__PACKAGE__->meta->initialize; |
27 | 26 |
|
28 | 27 |
__PACKAGE__->configure_acts_as_list(group_by => [qw(reclamation_id)]); |
29 | 28 |
|
30 |
sub shipped_qty { |
|
31 |
my ($self, %params) = @_; |
|
32 |
|
|
33 |
my $force = delete $params{force}; |
|
34 |
|
|
35 |
SL::Helper::ShippedQty->new(%params)->calculate($self)->write_to_objects if $force || !defined $self->{shipped_qty}; |
|
36 |
|
|
37 |
$self->{shipped_qty}; |
|
38 |
} |
|
39 |
|
|
40 | 29 |
sub is_linked_to_record { |
41 | 30 |
my ($self) = @_; |
42 | 31 |
|
... | ... | |
131 | 120 |
return $self->reclamation->customervendor; |
132 | 121 |
} |
133 | 122 |
|
134 |
sub delivered_qty { goto &shipped_qty } |
|
135 | 123 |
sub record { goto &reclamation } |
136 | 124 |
sub record_id { goto &reclamation_id } |
137 | 125 |
sub trans_id { goto &reclamation_id } |
... | ... | |
149 | 137 |
|
150 | 138 |
=head1 FUNCTIONS |
151 | 139 |
|
152 |
=over 4 |
|
153 |
|
|
154 |
=item C<shipped_qty PARAMS> |
|
155 |
|
|
156 |
Calculates the shipped qty for this reclamationitem (measured in the current unit) |
|
157 |
and returns it. |
|
158 |
|
|
159 |
Note that the shipped qty is expected not to change within the request and is |
|
160 |
cached in C<shipped_qty> once calculated. If C<< force => 1 >> is passed, the |
|
161 |
existibng cache is ignored. |
|
162 |
|
|
163 |
Given parameters will be passed to L<SL::Helper::ShippedQty>, so you can force |
|
164 |
the shipped/delivered distinction like this: |
|
165 |
|
|
166 |
$_->shipped_qty(require_stock_out => 0); |
|
167 |
|
|
168 |
Note however that calculating shipped_qty on individual Reclamationitems is generally |
|
169 |
a bad idea. See L<SL::Helper::ShippedQty> for way to compute these all at once. |
|
170 |
|
|
171 |
=item C<delivered_qty> |
|
172 |
|
|
173 |
Alias for L</shipped_qty>. |
|
174 |
|
|
175 |
=back |
|
176 |
|
|
177 | 140 |
=head1 AUTHORS |
178 | 141 |
|
179 | 142 |
G. Richardson E<lt>grichardson@kivitendo-premium.deE<gt> |
templates/webpages/reclamation/tabs/basic_data.html | ||
---|---|---|
226 | 226 |
<th id="reason_header_id" class="listheading" nowrap width="100"><a href='#' onClick='javascript:kivi.Reclamation.reorder_items("reason")'>[%- 'Reason' | $T8 %]</a></th> |
227 | 227 |
<th id="reason_description_ext_header_id" class="listheading" nowrap ><a href='#' onClick='javascript:kivi.Reclamation.reorder_items("reason_description_ext")'>[%- 'Reason Description Extern' | $T8 %]</a></th> |
228 | 228 |
<th id="reason_description_int_header_id" class="listheading" nowrap ><a href='#' onClick='javascript:kivi.Reclamation.reorder_items("reason_description_int")'>[%- 'Reason Description Intern' | $T8 %]</a></th> |
229 |
<th id="shipped_qty_header_id" class="listheading" nowrap width="5" ><a href='#' onClick='javascript:kivi.Reclamation.reorder_items("shipped_qty")'>[%- 'Delivered' | $T8 %]</a></th> |
|
230 | 229 |
<th id="qty_header_id" class="listheading" nowrap width="5" ><a href='#' onClick='javascript:kivi.Reclamation.reorder_items("qty")'> [%- 'Qty' | $T8 %]</a></th> |
231 | 230 |
<th class="listheading" nowrap width="5" >[%- 'Price Factor' | $T8 %] </th> |
232 | 231 |
<th class="listheading" nowrap width="5" >[%- 'Unit' | $T8 %] </th> |
templates/webpages/reclamation/tabs/basic_data/_row.html | ||
---|---|---|
83 | 83 |
size='40', |
84 | 84 |
style='width: 150px') %] |
85 | 85 |
</td> |
86 |
<td nowrap> |
|
87 |
[%- L.div_tag(LxERP.format_amount(ITEM.shipped_qty, 2, 0) _ ' ' _ ITEM.unit, name="shipped_qty", class="numeric") %] |
|
88 |
</td> |
|
89 | 86 |
<td nowrap> |
90 | 87 |
[%- L.input_tag("reclamation.reclamation_items[].qty_as_number", |
91 | 88 |
ITEM.qty_as_number, |
Auch abrufbar als: Unified diff
Reclamation: don't need shipped_qty