Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 66b6d647

Von Werner Hahn vor mehr als 8 Jahren hinzugefügt

  • ID 66b6d6473abe4206549ae9cbea8a2583541a325a
  • Vorgänger 211de7dc
  • Nachfolger e8e03e2c

RecordsLinks auch für/bei ShopOrders anzeigen

Conflicts:
SL/Controller/RecordLinks.pm

Unterschiede anzeigen:

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

  
......
35 36
);
36 37

  
37 38
my @link_type_specifics = (
38
  { 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', },
39
  { title => t8('Requirement spec'),        type => 'requirement_spec',        model => 'RequirementSpec', number => 'id', project => 'project', description => 'title', date => undef, filter => 'working_copy_filter', },
40
  { title => t8('Shop Order'),              type => 'shop_order',              model => 'ShopOrder',       number => 'shop_ordernumber', },
39 41
  { title => t8('Sales quotation'),         type => 'sales_quotation',         model => 'Order',           number => 'quonumber', },
40 42
  { title => t8('Sales Order'),             type => 'sales_order',             model => 'Order',           number => 'ordnumber', },
41 43
  { title => t8('Sales delivery order'),    type => 'sales_delivery_order',    model => 'DeliveryOrder',   number => 'donumber',  },
......
59 61
  eval {
60 62
    my $linked_records = $self->object->linked_records(direction => 'both', recursive => 1, save_path => 1);
61 63
    push @{ $linked_records }, $self->object->sepa_export_items if $self->object->can('sepa_export_items');
64
    $main::lxdebug->dump(0, 'WH: RECORDS:', \$linked_records);
65

  
62 66
    my $output         = SL::Presenter->get->grouped_record_list(
63 67
      $linked_records,
64 68
      with_columns      => [ qw(record_link_direction) ],
......
118 122
  my ($self) = @_;
119 123

  
120 124
  my $manager     = 'SL::DB::Manager::' . $self->link_type_desc->{model};
121
  my $vc          = $self->link_type =~ m/sales_|^invoice|requirement_spec|letter/ ? 'customer' : 'vendor';
125
  my $vc          = $self->link_type =~ m/shop|sales_|^invoice|requirement_spec|letter/ ? 'customer' : 'vendor';
122 126
  my $project     = $self->link_type_desc->{project};
123 127
  my $project_id  = "${project}_id";
124 128
  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};
......
165 166

  
166 167
sub _group_records {
167 168
  my ($list) = @_;
168

  
169
$main::lxdebug->dump(0, 'WH: GROUP_RECORDS: ',\@_);
169 170
  my %matchers = (
170 171
    requirement_specs        => sub { (ref($_[0]) eq 'SL::DB::RequirementSpec')                                         },
172
    shop_orders              => sub { (ref($_[0]) eq 'SL::DB::ShopOrder')                                               },
171 173
    sales_quotations         => sub { (ref($_[0]) eq 'SL::DB::Order')           &&  $_[0]->is_type('sales_quotation')   },
172 174
    sales_orders             => sub { (ref($_[0]) eq 'SL::DB::Order')           &&  $_[0]->is_type('sales_order')       },
173 175
    sales_delivery_orders    => sub { (ref($_[0]) eq 'SL::DB::DeliveryOrder')   &&  $_[0]->is_sales                     },
......
229 231
  );
230 232
}
231 233

  
234
sub _shop_order_list {
235
  my ($self, $list, %params) = @_;
236
$main::lxdebug->dump(0, 'WH: ORDER_LIST: ',\@_);
237
  return $self->record_list(
238
    $list,
239
    title   => $::locale->text('Shop Orders'),
240
    type    => 'shop_order',
241
    columns => [
242
      [ $::locale->text('Shop Order Date'),         'order_date'                                                              ],
243
      [ $::locale->text('Shop Order Number'),        sub { $self->shop_order($_[0], display => 'table-cell') }                 ],
244
      [ $::locale->text('Transfer Date'),           'transfer_date'                                                            ],
245
      #     [ $::locale->text('Customer'),                'customer'                                                                 ],
246
      [ $::locale->text('Net amount'),              'netamount'                                                                ],
247
      #[ $::locale->text('Transaction description'), 'transaction_description'                                                  ],
248
      #[ $::locale->text('Project'),                 'globalproject', ],
249
      #[ $::locale->text('Closed'),                  'closed'                                                                   ],
250
    ],
251
    %params,
252
  );
253
}
254

  
232 255
sub _sales_quotation_list {
233 256
  my ($self, $list, %params) = @_;
234 257

  
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