Revision d275698f
Von Werner Hahn vor etwa 7 Jahren hinzugefügt
SL/Controller/RecordLinks.pm | ||
---|---|---|
15 | 15 |
use SL::DB::RecordLink; |
16 | 16 |
use SL::DB::RequirementSpec; |
17 | 17 |
use SL::DBUtils qw(like); |
18 |
use SL::DB::ShopOrder; |
|
18 | 19 |
use SL::JSON; |
19 | 20 |
use SL::Locale::String; |
20 | 21 |
|
... | ... | |
36 | 37 |
); |
37 | 38 |
|
38 | 39 |
my @link_type_specifics = ( |
39 |
{ title => t8('Requirement spec'), type => 'requirement_spec', model => 'RequirementSpec', number => 'id', description => 'title', description_title => t8('Title'), date => undef, project => 'project', filter => 'working_copy_filter', }, |
|
40 |
{ title => t8('Requirement spec'), type => 'requirement_spec', model => 'RequirementSpec', number => 'id', project => 'project', description => 'title', date => undef, filter => 'working_copy_filter', }, |
|
41 |
{ title => t8('Shop Order'), type => 'shop_order', model => 'ShopOrder', number => 'shop_ordernumber', }, |
|
40 | 42 |
{ title => t8('Sales quotation'), type => 'sales_quotation', model => 'Order', number => 'quonumber', }, |
41 | 43 |
{ title => t8('Sales Order'), type => 'sales_order', model => 'Order', number => 'ordnumber', }, |
42 | 44 |
{ title => t8('Sales delivery order'), type => 'sales_delivery_order', model => 'DeliveryOrder', number => 'donumber', }, |
... | ... | |
60 | 62 |
eval { |
61 | 63 |
my $linked_records = $self->object->linked_records(direction => 'both', recursive => 1, save_path => 1); |
62 | 64 |
push @{ $linked_records }, $self->object->sepa_export_items if $self->object->can('sepa_export_items'); |
65 |
$main::lxdebug->dump(0, 'WH: RECORDS:', \$linked_records); |
|
66 |
|
|
63 | 67 |
my $output = SL::Presenter->get->grouped_record_list( |
64 | 68 |
$linked_records, |
65 | 69 |
with_columns => [ qw(record_link_direction) ], |
... | ... | |
119 | 123 |
my ($self) = @_; |
120 | 124 |
|
121 | 125 |
my $manager = 'SL::DB::Manager::' . $self->link_type_desc->{model}; |
122 |
my $vc = $self->link_type =~ m/sales_|^invoice|requirement_spec|letter/ ? 'customer' : 'vendor'; |
|
126 |
my $vc = $self->link_type =~ m/shop|sales_|^invoice|requirement_spec|letter/ ? 'customer' : 'vendor';
|
|
123 | 127 |
my $project = $self->link_type_desc->{project}; |
124 | 128 |
my $project_id = "${project}_id"; |
125 | 129 |
my $description = $self->link_type_desc->{description}; |
SL/Presenter.pm | ||
---|---|---|
22 | 22 |
use SL::Presenter::RequirementSpecItem; |
23 | 23 |
use SL::Presenter::RequirementSpecTextBlock; |
24 | 24 |
use SL::Presenter::SepaExport; |
25 |
use SL::Presenter::ShopOrder; |
|
25 | 26 |
use SL::Presenter::Text; |
26 | 27 |
use SL::Presenter::Tag; |
27 | 28 |
use SL::Presenter::BankAccount; |
SL/Presenter/Record.pm | ||
---|---|---|
43 | 43 |
my $output = ''; |
44 | 44 |
|
45 | 45 |
$output .= _requirement_spec_list( $self, $groups{requirement_specs}, %params) if $groups{requirement_specs}; |
46 |
$output .= _shop_order_list( $self, $groups{shop_orders}, %params) if $groups{shop_orders}; |
|
46 | 47 |
$output .= _sales_quotation_list( $self, $groups{sales_quotations}, %params) if $groups{sales_quotations}; |
47 | 48 |
$output .= _sales_order_list( $self, $groups{sales_orders}, %params) if $groups{sales_orders}; |
48 | 49 |
$output .= _sales_delivery_order_list( $self, $groups{sales_delivery_orders}, %params) if $groups{sales_delivery_orders}; |
... | ... | |
167 | 168 |
|
168 | 169 |
sub _group_records { |
169 | 170 |
my ($list) = @_; |
170 |
|
|
171 |
$main::lxdebug->dump(0, 'WH: GROUP_RECORDS: ',\@_); |
|
171 | 172 |
my %matchers = ( |
172 | 173 |
requirement_specs => sub { (ref($_[0]) eq 'SL::DB::RequirementSpec') }, |
174 |
shop_orders => sub { (ref($_[0]) eq 'SL::DB::ShopOrder') }, |
|
173 | 175 |
sales_quotations => sub { (ref($_[0]) eq 'SL::DB::Order') && $_[0]->is_type('sales_quotation') }, |
174 | 176 |
sales_orders => sub { (ref($_[0]) eq 'SL::DB::Order') && $_[0]->is_type('sales_order') }, |
175 | 177 |
sales_delivery_orders => sub { (ref($_[0]) eq 'SL::DB::DeliveryOrder') && $_[0]->is_sales }, |
... | ... | |
231 | 233 |
); |
232 | 234 |
} |
233 | 235 |
|
236 |
sub _shop_order_list { |
|
237 |
my ($self, $list, %params) = @_; |
|
238 |
$main::lxdebug->dump(0, 'WH: ORDER_LIST: ',\@_); |
|
239 |
return $self->record_list( |
|
240 |
$list, |
|
241 |
title => $::locale->text('Shop Orders'), |
|
242 |
type => 'shop_order', |
|
243 |
columns => [ |
|
244 |
[ $::locale->text('Shop Order Date'), 'order_date' ], |
|
245 |
[ $::locale->text('Shop Order Number'), sub { $self->shop_order($_[0], display => 'table-cell') } ], |
|
246 |
[ $::locale->text('Transfer Date'), 'transfer_date' ], |
|
247 |
# [ $::locale->text('Customer'), 'customer' ], |
|
248 |
[ $::locale->text('Net amount'), 'netamount' ], |
|
249 |
#[ $::locale->text('Transaction description'), 'transaction_description' ], |
|
250 |
#[ $::locale->text('Project'), 'globalproject', ], |
|
251 |
#[ $::locale->text('Closed'), 'closed' ], |
|
252 |
], |
|
253 |
%params, |
|
254 |
); |
|
255 |
} |
|
256 |
|
|
234 | 257 |
sub _sales_quotation_list { |
235 | 258 |
my ($self, $list, %params) = @_; |
236 | 259 |
|
SL/Presenter/ShopOrder.pm | ||
---|---|---|
1 |
package SL::Presenter::ShopOrder; |
|
2 |
|
|
3 |
use strict; |
|
4 |
|
|
5 |
use parent qw(Exporter); |
|
6 |
|
|
7 |
use Exporter qw(import); |
|
8 |
our @EXPORT = qw(shop_order); |
|
9 |
|
|
10 |
use Carp; |
|
11 |
|
|
12 |
sub shop_order { |
|
13 |
my ($self, $shop_order, $type, %params) = @_; |
|
14 |
|
|
15 |
$params{display} ||= 'inline'; |
|
16 |
|
|
17 |
croak "Unknown display type '$params{display}'" unless $params{display} =~ m/^(?:inline|table-cell)$/; |
|
18 |
|
|
19 |
my $text = join '', ( |
|
20 |
$params{no_link} ? '' : '<a href="controller.pl?action=ShopOrder/show&id='.$self->escape($shop_order->id).'">', |
|
21 |
$self->escape($shop_order->id), |
|
22 |
$params{no_link} ? '' : '</a>', |
|
23 |
); |
|
24 |
return $self->escaped_text($text); |
|
25 |
} |
|
26 |
1; |
templates/webpages/shop_order/show.html | ||
---|---|---|
111 | 111 |
</table> |
112 | 112 |
</td> |
113 | 113 |
<td style="padding-left: 20px; vertical-align: top;"> |
114 |
[% UNLESS IMPORT.tranferred %] |
|
114 |
[% UNLESS IMPORT.transferred %]
|
|
115 | 115 |
[% IF PROPOSALS %] |
116 | 116 |
<div style="height: 120px; overflow:auto;"> |
117 | 117 |
<table> |
... | ... | |
138 | 138 |
[% ELSE %] |
139 | 139 |
<div> |
140 | 140 |
Wurde schon übernommen |
141 |
<div id="recordlinks"></div> |
|
142 |
<script type="text/javascript"> |
|
143 |
var url = 'controller.pl?action=RecordLinks/ajax_list&object_model=ShopOrder&object_id=[% IMPORT.id %]'; |
|
144 |
$('#recordlinks').load(url); |
|
145 |
</script> |
|
141 | 146 |
</div> |
142 | 147 |
[% END %] |
143 | 148 |
</td> |
... | ... | |
177 | 182 |
$.post("controller.pl", { action: 'ShopOrder/list'}); |
178 | 183 |
} |
179 | 184 |
</script> |
180 |
[% L.dump(IMPORT) %] |
|
185 |
[% L.dump(IMPORT) %] |
Auch abrufbar als: Unified diff
Shopmodul: RecordsLinks auch für/bei ShopOrders anzeigen
Conflicts:
SL/Controller/RecordLinks.pm
record links fehlende Datei