Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 89ade8da

Von Moritz Bunkus vor mehr als 10 Jahren hinzugefügt

  • ID 89ade8da54d47af2cbf100fac07bf88ed9f23c43
  • Vorgänger 85ab58eb
  • Nachfolger 6341560f

Verknüpfte Belege: Unterstützung für Pflichtenhefte

Unterschiede anzeigen:

SL/Controller/RecordLinks.pm
12 12
use SL::DB::Invoice;
13 13
use SL::DB::PurchaseInvoice;
14 14
use SL::DB::RecordLink;
15
use SL::DB::RequirementSpec;
15 16
use SL::JSON;
16 17
use SL::Locale::String;
17 18

  
......
23 24
__PACKAGE__->run_before('check_object_params', only => [ qw(ajax_list ajax_delete ajax_add_select_type ajax_add_filter ajax_add_list ajax_add_do) ]);
24 25
__PACKAGE__->run_before('check_link_params',   only => [ qw(                                                           ajax_add_list ajax_add_do) ]);
25 26

  
26
my @link_types = (
27
my %link_type_defaults = (
28
  filter      => 'type_filter',
29
  project     => 'globalproject',
30
  description => 'transaction_description',
31
  date        => 'transdate',
32
);
33

  
34
my @link_type_specifics = (
35
  { title => t8('Requirement spec'),        type => 'requirement_spec',        model => 'RequirementSpec', number => 'id', project => 'project', description => 'title', date => undef, filter => undef, },
27 36
  { title => t8('Sales quotation'),         type => 'sales_quotation',         model => 'Order',           number => 'quonumber', },
28 37
  { title => t8('Sales Order'),             type => 'sales_order',             model => 'Order',           number => 'ordnumber', },
29 38
  { title => t8('Sales delivery order'),    type => 'sales_delivery_order',    model => 'DeliveryOrder',   number => 'donumber',  },
......
34 43
  { title => t8('Purchase Invoice'),        type => 'purchase_invoice',        model => 'PurchaseInvoice', number => 'invnumber', },
35 44
);
36 45

  
46
my @link_types = map { +{ %link_type_defaults, %{ $_ } } } @link_type_specifics;
37 47

  
38 48
#
39 49
# actions
......
103 113
sub action_ajax_add_list {
104 114
  my ($self) = @_;
105 115

  
106
  my $manager = 'SL::DB::Manager::' . $self->link_type_desc->{model};
107
  my $vc      = $self->link_type =~ m/sales_|^invoice$/ ? 'customer' : 'vendor';
116
  my $manager     = 'SL::DB::Manager::' . $self->link_type_desc->{model};
117
  my $vc          = $self->link_type =~ m/sales_|^invoice|requirement_spec$/ ? 'customer' : 'vendor';
118
  my $project     = $self->link_type_desc->{project};
119
  my $description = $self->link_type_desc->{description};
120
  my $filter      = $self->link_type_desc->{filter};
108 121

  
109
  my @where = $manager->type_filter($self->link_type);
122
  my @where = $filter ? $manager->$filter($self->link_type) : ();
110 123
  push @where, ("${vc}.${vc}number"     => { ilike => '%' . $::form->{vc_number} . '%' })               if $::form->{vc_number};
111 124
  push @where, ("${vc}.name"            => { ilike => '%' . $::form->{vc_name}   . '%' })               if $::form->{vc_name};
112
  push @where, (transaction_description => { ilike => '%' . $::form->{transaction_description} . '%' }) if $::form->{transaction_description};
113
  push @where, (globalproject_id        => $::form->{globalproject_id})                                 if $::form->{globalproject_id};
125
  push @where, ($description            => { ilike => '%' . $::form->{transaction_description} . '%' }) if $::form->{transaction_description};
126
  push @where, ("${project}_id"         => $::form->{globalproject_id})                                 if $::form->{globalproject_id};
114 127

  
115
  my $objects = $manager->get_all_sorted(where => \@where, with_objects => [ $vc, 'globalproject' ]);
128
  my $objects = $manager->get_all_sorted(where => \@where, with_objects => [ $vc, $project ]);
116 129
  my $output  = $self->render(
117 130
    'record_links/add_list',
118
    { output      => 0 },
119
    OBJECTS       => $objects,
120
    vc            => $vc,
121
    number_column => $self->link_type_desc->{number},
131
    { output => 0 },
132
    OBJECTS            => $objects,
133
    vc                 => $vc,
134
    number_column      => $self->link_type_desc->{number},
135
    description_column => $description,
136
    project_column     => $project,
137
    date_column        => $self->link_type_desc->{date},
122 138
  );
123 139

  
124 140
  my %result = ( count => scalar(@{ $objects }), html => $output );
SL/DB/Helper/LinkedRecords.pm
149 149
                  'SL::DB::DeliveryOrder'   => sub { $_[0]->donumber },
150 150
                  'SL::DB::Invoice'         => sub { $_[0]->invnumber },
151 151
                  'SL::DB::PurchaseInvoice' => sub { $_[0]->invnumber },
152
                  'SL::DB::RequirementSpec' => sub { $_[0]->id },
152 153
                  UNKNOWN                   => '9999999999999999',
153 154
                );
154 155
  my $number_xtor = sub {
......
165 166

  
166 167
  my %scores;
167 168
  %scores = ( 'SL::DB::SalesProcess'    =>  10,
169
              'SL::DB::RequirementSpec' =>  15,
168 170
              'SL::DB::Order'           =>  sub { $scores{ $_[0]->type } },
169 171
              sales_quotation           =>  20,
170 172
              sales_order               =>  30,
SL/DB/RequirementSpec.pm
302 302
  );
303 303
}
304 304

  
305
sub compare_to {
306
  my ($self, $other) = @_;
307

  
308
  return $self->id <=> $other->id;
309
}
310

  
305 311
1;
306 312
__END__
307 313

  
SL/Presenter.pm
15 15
use SL::Presenter::Part;
16 16
use SL::Presenter::Project;
17 17
use SL::Presenter::Record;
18
use SL::Presenter::RequirementSpec;
18 19
use SL::Presenter::RequirementSpecItem;
19 20
use SL::Presenter::RequirementSpecTextBlock;
20 21
use SL::Presenter::SepaExport;
SL/Presenter/Record.pm
27 27
  my %groups = _sort_grouped_lists(_group_records($list));
28 28
  my $output = '';
29 29

  
30
  $output .= _requirement_spec_list(       $self, $groups{requirement_specs},        %params) if $groups{requirement_specs};
30 31
  $output .= _sales_quotation_list(        $self, $groups{sales_quotations},         %params) if $groups{sales_quotations};
31 32
  $output .= _sales_order_list(            $self, $groups{sales_orders},             %params) if $groups{sales_orders};
32 33
  $output .= _sales_delivery_order_list(   $self, $groups{sales_delivery_orders},    %params) if $groups{sales_delivery_orders};
......
142 143
  my ($list) = @_;
143 144

  
144 145
  my %matchers = (
146
    requirement_specs        => sub { (ref($_[0]) eq 'SL::DB::RequirementSpec')                                         },
145 147
    sales_quotations         => sub { (ref($_[0]) eq 'SL::DB::Order')           &&  $_[0]->is_type('sales_quotation')   },
146 148
    sales_orders             => sub { (ref($_[0]) eq 'SL::DB::Order')           &&  $_[0]->is_type('sales_order')       },
147 149
    sales_delivery_orders    => sub { (ref($_[0]) eq 'SL::DB::DeliveryOrder')   &&  $_[0]->is_sales                     },
......
182 184
  return %groups;
183 185
}
184 186

  
187
sub _requirement_spec_list {
188
  my ($self, $list, %params) = @_;
189

  
190
  return $self->record_list(
191
    $list,
192
    title   => $::locale->text('Requirement specs'),
193
    type    => 'requirement_spec',
194
    columns => [
195
      [ $::locale->text('Requirement spec number'), sub { $self->requirement_spec($_[0], display => 'table-cell') } ],
196
      [ $::locale->text('Customer'),                'customer'                                                      ],
197
      [ $::locale->text('Title'),                   'title'                                                         ],
198
      [ $::locale->text('Project'),                 'project',                                                      ],
199
      [ $::locale->text('Status'),                  sub { $_[0]->status->description }                              ],
200
    ],
201
    %params,
202
  );
203
}
204

  
185 205
sub _sales_quotation_list {
186 206
  my ($self, $list, %params) = @_;
187 207

  
SL/Presenter/RequirementSpec.pm
1
package SL::Presenter::RequirementSpec;
2

  
3
use strict;
4

  
5
use parent qw(Exporter);
6

  
7
use Exporter qw(import);
8
our @EXPORT = qw(requirement_spec);
9

  
10
use Carp;
11

  
12
sub requirement_spec {
13
  my ($self, $requirement_spec, %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=RequirementSpec/show&amp;id=' . $self->escape($requirement_spec->id) . '">',
21
    $self->escape($requirement_spec->id),
22
    $params{no_link} ? '' : '</a>',
23
  );
24
  return $self->escaped_text($text);
25
}
26

  
27
1;
js/locale/de.js
57 57
"The selected database is still configured for client \"#1\". If you delete the database that client will stop working until you re-configure it. Do you still want to delete the database?":"Die auswählte Datenbank ist noch für Mandant \"#1\" konfiguriert. Wenn Sie die Datenbank löschen, wird der Mandanten nicht mehr funktionieren, bis er anders konfiguriert wurde. Wollen Sie die Datenbank trotzdem löschen?",
58 58
"There is one or more sections for which no part has been assigned yet; therefore creating the new record is not possible yet.":"Es gibt einen oder mehrere Abschnitte ohne Artikelzuweisung; daher kann der neue Beleg noch nicht erstellt werden.",
59 59
"Time/cost estimate actions":"Aktionen für Kosten-/Zeitabschätzung",
60
"Title":"Titel",
60 61
"Toggle marker":"Markierung umschalten",
62
"Transaction description":"Vorgangsbezeichnung",
61 63
"Update":"Erneuern",
62 64
"Update quotation/order":"Auftrag/Angebot aktualisieren",
63 65
"Version actions":"Aktionen für Versionen"
locale/de/all
1068 1068
  'Filter for customer variables' => 'Filter für benutzerdefinierte Kundenvariablen',
1069 1069
  'Filter for item variables'   => 'Filter für benutzerdefinierte Artikelvariablen',
1070 1070
  'Filter parts'                => 'Artikel filtern',
1071
  'Financial Controlling'       => 'Finanzcontrolling',
1072
  'Financial Controlling Report' => 'Finanzcontrollingbericht',
1073 1071
  'Financial Overview'          => 'Finanzübersicht',
1074
  'Financial controlling report for open sales orders' => 'Finanzcontrollingbericht für offene Aufträge',
1075 1072
  'Financial overview for #1'   => 'Finanzübersicht für #1',
1076 1073
  'Finish'                      => 'Abschlie&szlig;en',
1077 1074
  'First 20 Lines'              => 'Nur erste 20 Datensätze',
......
1920 1917
  'Requirement Spec Types'      => 'Pflichtenhefttypen',
1921 1918
  'Requirement Spec Version'    => 'Pflichtenheftversion',
1922 1919
  'Requirement Specs'           => 'Pflichtenhefte',
1920
  'Requirement spec'            => 'Pflichtenheft',
1923 1921
  'Requirement spec actions'    => 'Pflichtenheftaktionen',
1924 1922
  'Requirement spec function block #1 with #2 sub function blocks; description: "#3"' => 'Pflichtenheft-Funktionsblock #1 mit #2 Unterfunktionsblöcken; Beschreibung: "#3"',
1923
  'Requirement spec number'     => 'Pflichtenheftnummer',
1925 1924
  'Requirement spec picture "#1"' => 'Pflichtenheftbild "#1"',
1926 1925
  'Requirement spec section #1 "#2" with #3 function blocks and a total of #4 sub function blocks; preamble: "#5"' => 'Pflichtenheftabschnitt #1 "#2" mit #3 Funktionsblöcken und insgesamt #4 Unterfunktionsblöcken; Einleitung: "#5"',
1927 1926
  'Requirement spec sub function block #1; description: "#2"' => 'Pflichtenheft-Unterfunktionsblock #1; Beschreibung: "#2"',
templates/webpages/record_links/add_filter.html
10 10
 <table>
11 11
  <tr>
12 12
   <td>[%- LxERP.t8("Link to") %]:</td>
13
   <td>[% L.select_tag('link_type', LINK_TYPES, default=DEFAULT_LINK_TYPE, style=style) %]</td>
13
   <td>[% L.select_tag('link_type', LINK_TYPES, default=DEFAULT_LINK_TYPE, style=style, id='record_links_add_filter_link_type') %]</td>
14 14
  </tr>
15 15

  
16 16
  <tr>
......
37 37
  </tr>
38 38

  
39 39
  <tr>
40
   <td>[%- LxERP.t8("Transaction description") %]:</td>
40
   <td><span id="record_links_add_filter_title">[%- LxERP.t8("Transaction description") %]</span>:</td>
41 41
   <td>[% L.input_tag('transaction_description', '', style=style) %]</td>
42 42
  </tr>
43 43
 </table>
......
59 59
<!--
60 60
$(function() {
61 61
  $('#record_links_add input[name=vc_name]').focus();
62
  $('#record_links_add_filter_link_type').change(function() {
63
    var title = $('#record_links_add_filter_link_type').val() == 'requirement_spec' ? kivi.t8('Title') : kivi.t8('Transaction description');
64
    $('#record_links_add_filter_title').html(title);
65
  });
62 66
});
63 67

  
64 68
function record_links_reset_form() {
templates/webpages/record_links/add_list.html
7 7
  <th>[% L.checkbox_tag('record_links_check_all') %]</th>
8 8
  <th>[% IF vc == 'customer' %][%- LxERP.t8("Customer") %][%- ELSE %][%- LxERP.t8("Vendor") %][%- END %]</th>
9 9
  <th>[%- LxERP.t8("Number") %]</th>
10
  <th>[%- LxERP.t8("Date") %]</th>
11
  <th>[%- LxERP.t8("Transaction description") %]</th>
10
  [% IF date_column %]
11
   <th>[%- LxERP.t8("Date") %]</th>
12
  [% END %]
13
  <th>[% IF SELF.link_type == 'requirement_spec' %][%- LxERP.t8("Title") %][% ELSE %][%- LxERP.t8("Transaction description") %][% END %]</th>
12 14
  <th>[%- LxERP.t8("Project") %]</th>
13 15
 </tr>
14 16

  
......
17 19
  <td>[% L.checkbox_tag('link_id[]', value=object.id) %]</td>
18 20
  <td>[%- HTML.escape(object.$vc.name) %]</td>
19 21
  <td>[%- HTML.escape(object.$number_column) %]</td>
20
  <td>[%- HTML.escape(object.transdate.to_kivitendo) %]</td>
21
  <td>[%- HTML.escape(object.transaction_description) %]</td>
22
  <td>[%- P.project(object.globalproject, no_link=1) %]</td>
22
  [% IF date_column %]
23
   <td>[%- HTML.escape(object.$date_column.to_kivitendo) %]</td>
24
  [% END %]
25
  <td>[%- HTML.escape(object.$description_column) %]</td>
26
  <td>[%- P.project(object.$project_column, no_link=1) %]</td>
23 27
 </tr>
24 28
 [%- END %]
25 29
</table>

Auch abrufbar als: Unified diff