Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision e48eb4dc

Von Kivitendo Admin vor mehr als 8 Jahren hinzugefügt

  • ID e48eb4dc7e721dbdf15417167e9320fd12decf69
  • Vorgänger 6d7433f9
  • Nachfolger d9e0bbb5

Preisgruppen - Umstellung auf Controller, sortkey, obsolete

Neuer CRUD-Controller nur für Preisgruppen.

Die Reihenfolge der Preisgruppen kann nun eingestellt werden, und man
kann Preisgruppen auf ungültig setzen, sofern sie nicht mehr aktiv bei
Kunden in Verwendung sind, so daß sie bei Kunden oder neuen Belegen
nicht mehr ausgewählt werden können.

Unterschiede anzeigen:

SL/Controller/CsvImport/Part.pm
118 118
sub init_all_pricegroups {
119 119
  my ($self) = @_;
120 120

  
121
  return SL::DB::Manager::Pricegroup->get_all(sort => 'id');
121
  return SL::DB::Manager::Pricegroup->get_all_sorted;
122 122
}
123 123

  
124 124
sub init_settings {
SL/Controller/CustomerVendor.pm
905 905

  
906 906
  $self->{all_delivery_terms} = SL::DB::Manager::DeliveryTerm->get_all();
907 907

  
908
  $self->{all_pricegroups} = SL::DB::Manager::Pricegroup->get_all();
908
  $self->{all_pricegroups} = SL::DB::Manager::Pricegroup->get_all_sorted(query => [ or => [ id => $self->{cv}->pricegroup_id, obsolete => 0 ] ]);
909 909

  
910 910
  $query =
911 911
    'SELECT DISTINCT(cp_abteilung) AS department
SL/Controller/PriceRule.pm
271 271
}
272 272

  
273 273
sub init_pricegroups {
274
  SL::DB::Manager::Pricegroup->get_all;
274
  SL::DB::Manager::Pricegroup->get_all_sorted;
275 275
}
276 276

  
277 277
sub init_partsgroups {
SL/Controller/Pricegroup.pm
1
package SL::Controller::Pricegroup;
2

  
3
use strict;
4

  
5
use parent qw(SL::Controller::Base);
6

  
7
use SL::Helper::Flash;
8
use SL::Locale::String;
9
use SL::DB::Default;
10
use SL::DB::Manager::Pricegroup;
11

  
12
use Rose::Object::MakeMethods::Generic (
13
  scalar                  => [ qw(pricegroup) ],
14
  'scalar --get_set_init' => [ qw(all_pricegroups) ],
15
);
16

  
17
__PACKAGE__->run_before('check_auth');
18
__PACKAGE__->run_before('load_pricegroup', only => [ qw(edit update delete) ]);
19

  
20
#
21
# actions
22
#
23

  
24
sub action_list {
25
  my ($self) = @_;
26

  
27
  $self->render('pricegroup/list',
28
                title   => t8('Pricegroups'),
29
               );
30
}
31

  
32
sub action_new {
33
  my ($self) = @_;
34

  
35
  $self->pricegroup( SL::DB::Pricegroup->new );
36
  $self->render('pricegroup/form',
37
                 title => t8('Add pricegroup'),
38
               );
39
}
40

  
41
sub action_edit {
42
  my ($self) = @_;
43

  
44
  $self->render('pricegroup/form',
45
                 title   => t8('Edit pricegroup'),
46
                );
47
}
48

  
49
sub action_create {
50
  my ($self) = @_;
51

  
52
  $self->pricegroup( SL::DB::Pricegroup->new );
53
  $self->create_or_update;
54
}
55

  
56
sub action_update {
57
  my ($self) = @_;
58
  $self->create_or_update;
59
}
60

  
61
sub action_delete {
62
  my ($self) = @_;
63

  
64
  if ( !$self->pricegroup->orphaned ) {
65
    flash_later('error', $::locale->text('The pricegroup has been used and cannot be deleted.'));
66
  } elsif ( eval { $self->pricegroup->delete; 1; } ) {
67
    flash_later('info',  $::locale->text('The pricegroup has been deleted.'));
68
  } else {
69
    flash_later('error', $::locale->text('The pricegroup has been used and cannot be deleted.'));
70
  };
71
  $self->redirect_to(action => 'list');
72
}
73

  
74
sub action_reorder {
75
  my ($self) = @_;
76

  
77
  SL::DB::Pricegroup->reorder_list(@{ $::form->{pricegroup_id} || [] });
78
  $self->render(\'', { type => 'json' });
79
}
80

  
81
#
82
# filters
83
#
84

  
85
sub check_auth {
86
  $::auth->assert('config');
87
}
88

  
89
sub load_pricegroup {
90
  my ($self) = @_;
91

  
92
  $self->pricegroup( SL::DB::Pricegroup->new(id => $::form->{id})->load );
93
}
94

  
95
sub init_all_pricegroups { SL::DB::Manager::Pricegroup->get_all_sorted }
96

  
97
#
98
# helpers
99
#
100

  
101
sub create_or_update {
102
  my ($self) = @_;
103
  my $is_new = !$self->pricegroup->id;
104

  
105
  my $params = delete($::form->{pricegroup}) || { };
106

  
107
  $self->pricegroup->assign_attributes(%{ $params });
108

  
109
  my @errors = $self->pricegroup->validate;
110

  
111
  if (@errors) {
112
    flash('error', @errors);
113
    $self->render('pricegroup/form',
114
                   title => $is_new ? t8('Add pricegroup') : t8('Edit pricegroup'),
115
                 );
116
    return;
117
  }
118

  
119
  $self->pricegroup->save;
120

  
121
  flash_later('info', $is_new ? t8('The pricegroup has been created.') : t8('The pricegroup has been saved.'));
122
  $self->redirect_to(action => 'list');
123
}
124

  
125
1;
126

  
127
__END__
128

  
129
=encoding utf-8
130

  
131
=head1 NAME
132

  
133
SL::Controller::Pricegroup - CRUD controller for pricegroups
134

  
135
=head1 SYNOPSIS
136

  
137
A new controller to create / edit / delete pricegroups.
138

  
139
Pricegroups can only be deleted if they haven't been used anywhere.
140

  
141
=head1 OBSOLETE PRICEGROUPS
142

  
143
Pricegroups can't be obsoleted while any of the customers still use that
144
pricegroup as their default pricegroup. Obsoleting a pricegroup means it can't
145
be selected when editing customers and it can't be selected as a price source
146
for new records.
147

  
148
=head1 AUTHOR
149

  
150
G. Richardson E<lt>grichardson@kivitendo-premium.deE<gt>
151

  
152
=cut
SL/DB/Manager/Pricegroup.pm
12 12
__PACKAGE__->make_manager_methods;
13 13

  
14 14
sub _sort_spec {
15
  return ( default => [ 'pricegroup', 1 ],
16
           columns => { SIMPLE => 'ALL',
17
                        map { ( $_ => "lower(pricegroup.${_})" ) } qw(pricegroup),
18
                      });
15
  return ( default => [ 'sortkey', 1 ],
16
           columns => { SIMPLE => 'ALL' });
19 17
}
20 18

  
21 19
1;
SL/DB/MetaSetup/Pricegroup.pm
10 10

  
11 11
__PACKAGE__->meta->columns(
12 12
  id         => { type => 'integer', not_null => 1, sequence => 'id' },
13
  obsolete   => { type => 'boolean', default => 'false' },
13 14
  pricegroup => { type => 'text', not_null => 1 },
15
  sortkey    => { type => 'integer', not_null => 1 },
14 16
);
15 17

  
16 18
__PACKAGE__->meta->primary_key_columns([ 'id' ]);
SL/DB/Pricegroup.pm
4 4

  
5 5
use SL::DB::MetaSetup::Pricegroup;
6 6
use SL::DB::Manager::Pricegroup;
7
use SL::DB::Helper::ActsAsList;
8
use SL::DB::Customer;
7 9

  
8 10
__PACKAGE__->meta->initialize;
9 11

  
......
13 15
  return join ' ', grep $_, $self->id, $self->pricegroup;
14 16
}
15 17

  
18
sub validate {
19
  my ($self) = @_;
20

  
21
  my @errors;
22

  
23
  if ( $self->obsolete && SL::DB::Manager::Customer->get_all_count(query => [ pricegroup_id => $self->id ]) ) {
24
    push @errors, $::locale->text('The pricegroup is being used by customers.');
25
  }
26

  
27
  return @errors;
28
}
29

  
30
sub orphaned {
31
  my ($self) = @_;
32
  die 'not an accessor' if @_ > 1;
33

  
34
  return 1 unless $self->id;
35

  
36
  my @relations = qw(
37
    SL::DB::Customer
38
    SL::DB::Price
39
  );
40

  
41
  # check if pricegroup is the default pricegroup for any customers and has any
42
  # prices assigned.
43

  
44
  for my $class (@relations) {
45
    eval "require $class";
46
    return 0 if $class->_get_manager_class->get_all_count(query => [ pricegroup_id => $self->id ]);
47
  }
48

  
49
  # check if pricegroup was used in any pricesource
50
  my @item_relations = qw(
51
    SL::DB::OrderItem
52
    SL::DB::DeliveryOrderItem
53
    SL::DB::InvoiceItem
54
  );
55

  
56
  for my $class (@item_relations) {
57
    eval "require $class";
58
    return 0 if $class->_get_manager_class->get_all_count(query => [ active_price_source => 'pricegroup/' . $self->id ]);
59
  }
60

  
61
  return 1;
62
}
16 63

  
17 64
1;
SL/PriceSource/Pricegroup.pm
20 20

  
21 21
  my $item = $self->record_item;
22 22

  
23
  my $query = [ parts_id => $item->parts_id, price => { gt => 0 } ];
24

  
25
  # add a pricegroup_filter for obsolete pricegroups, unless part of an
26
  # existing pricegroup where that pricegroup was actually used.
27
  if ( $self->record->id and $item->active_price_source =~ m/^pricegroup/ ) {
28
    my ($pricegroup_id) = $item->active_price_source =~ m/^pricegroup\/(\d+)$/;
29
    push(@{$query}, or => [ 'pricegroup.obsolete' => 0, 'pricegroup_id' => $pricegroup_id ]);
30
  } else {
31
    push(@{$query}, 'pricegroup.obsolete' => 0);
32
  }
33

  
23 34
  my $prices = SL::DB::Manager::Price->get_all(
24
    query        => [ parts_id => $item->parts_id, price => { gt => 0 } ],
35
    query        => $query,
25 36
    with_objects => 'pricegroup',
26
    sort_by     => 'pricegroup.id',
37
    sort_by      => 'pricegroup.sortkey',
27 38
  );
28 39

  
29 40
  return () unless @$prices;
bin/mozilla/ic.pl
478 478
    insertdate shop
479 479
  );
480 480

  
481
  my $pricegroups = SL::DB::Manager::Pricegroup->get_all(sort => 'id');
481
  my $pricegroups = SL::DB::Manager::Pricegroup->get_all_sorted;
482 482
  my @pricegroup_columns;
483 483
  my %column_defs_pricegroups;
484 484
  if ($form->{l_pricegroups}) {
bin/mozilla/pe.pl
27 27
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 28
#======================================================================
29 29
#
30
# partsgroup, pricegroup administration
30
# partsgroup administration
31 31
#
32 32
#======================================================================
33 33

  
......
62 62
  if ($::form->{type} eq 'partsgroup') {
63 63
    PE->get_partsgroup(\%::myconfig, $::form);
64 64
  }
65
  if ($::form->{type} eq 'pricegroup') {
66
    PE->get_pricegroup(\%::myconfig, $::form);
67
  }
68 65
  call_sub("form_$::form->{type}");
69 66

  
70 67
  $::lxdebug->leave_sub;
......
92 89
    $::form->redirect($::locale->text('Group saved!'));
93 90
  }
94 91

  
95
  # choice pricegroup and save
96
  if ($::form->{type} eq 'pricegroup') {
97
    $::form->isblank("pricegroup", $::locale->text('Pricegroup missing!'));
98
    PE->save_pricegroup(\%::myconfig, $::form);
99
    $::form->redirect($::locale->text('Pricegroup saved!'));
100
  }
101 92
  # saving the history
102 93
  if(!exists $::form->{addition} && $::form->{id} ne "") {
103 94
    $::form->{snumbers} = qq|projectnumber_| . $::form->{projectnumber};
......
118 109
  if ($::form->{type} eq 'partsgroup') {
119 110
    $::form->redirect($::locale->text('Group deleted!'));
120 111
  }
121
  if ($::form->{type} eq 'pricegroup') {
122
    $::form->redirect($::locale->text('Pricegroup deleted!'));
123
  }
124
  # saving the history
125
  if(!exists $::form->{addition}) {
126
    $::form->{snumbers} = qq|projectnumber_| . $::form->{projectnumber};
127
    $::form->{addition} = "DELETED";
128
    $::form->save_history;
129
  }
130
  # /saving the history
131 112
  $::lxdebug->leave_sub;
132 113
}
133 114

  
......
177 158

  
178 159
  $::lxdebug->leave_sub;
179 160
}
180

  
181
sub pricegroup_report {
182
  $::lxdebug->enter_sub;
183
  $::auth->assert('config');
184

  
185
  $::form->{$_} = $::form->unescape($::form->{$_}) for qw(pricegroup);
186
  PE->pricegroups(\%::myconfig, $::form);
187

  
188
  my $callback = build_std_url('action=pricegroup_report', qw(type status));
189

  
190
  my $option = '';
191
  $option .= $::locale->text('All')      if $::form->{status} eq 'all';
192
  $option .= $::locale->text('Orphaned') if $::form->{status} eq 'orphaned';
193

  
194
  if ($::form->{pricegroup}) {
195
    $callback .= "&pricegroup=$::form->{pricegroup}";
196
    $option   .= ", " . $::locale->text('Pricegroup') . " : $::form->{pricegroup}";
197
  }
198

  
199
  # escape callback
200
  $::form->{callback} = $callback;
201

  
202
  $::form->header;
203
  print $::form->parse_html_template('pe/pricegroup_report', {
204
    option   => $option,
205
    callback => $callback,
206
    editlink => build_std_url('action=edit', qw(type status callback)),
207
  });
208

  
209
  $::lxdebug->leave_sub;
210
}
211

  
212
sub form_pricegroup {
213
  $::lxdebug->enter_sub;
214
  $::auth->assert('config');
215

  
216
  # $locale->text('Add Pricegroup')
217
  # $locale->text('Edit Pricegroup')
218
  $::form->{title} = $::locale->text("$::form->{title} Pricegroup");
219

  
220
  $::form->header;
221
  print $::form->parse_html_template('pe/pricegroup_form');
222

  
223
  $::lxdebug->leave_sub;
224
}
doc/changelog
38 38
  - Briefe sind jetzt auch für Lieferanten verfügbar. Die neuen Rechte dafür
39 39
    sind für Gruppen vergeben, die auch Einkaufsbelege bearbeiten dürfen.
40 40

  
41
  - Neuer Controller für Preisgruppen, die nun sortiert und ungültig gesetzt
42
    werden können.
43

  
41 44
Administrative Änderungen
42 45

  
43 46
  - Diverse Textsuchen werden jetzt durch eine neue Klasse Indizes
locale/de/all
160 160
  'Add Letter'                  => 'Brief hinzufügen',
161 161
  'Add Part'                    => 'Ware erfassen',
162 162
  'Add Price Factor'            => 'Preisfaktor erfassen',
163
  'Add Pricegroup'              => 'Preisgruppe erfassen',
164 163
  'Add Printer'                 => 'Drucker hinzufügen',
165 164
  'Add Project'                 => 'Projekt erfassen',
166 165
  'Add Purchase Delivery Order' => 'Lieferschein (Einkauf) erfassen',
......
202 201
  'Add part'                    => 'Artikel hinzufügen',
203 202
  'Add picture'                 => 'Bild hinzufügen',
204 203
  'Add picture to text block'   => 'Bild dem Textblock hinzufügen',
204
  'Add pricegroup'              => 'Preisgruppe hinzufügen',
205 205
  'Add section'                 => 'Abschnitt hinzufügen',
206 206
  'Add sub function block'      => 'Unterfunktionsblock hinzufügen',
207 207
  'Add taxzone'                 => 'Steuerzone hinzufügen',
......
1055 1055
  'Edit Part'                   => 'Ware bearbeiten',
1056 1056
  'Edit Preferences for #1'     => 'Einstellungen von #1 bearbeiten',
1057 1057
  'Edit Price Factor'           => 'Preisfaktor bearbeiten',
1058
  'Edit Pricegroup'             => 'Preisgruppe bearbeiten',
1059 1058
  'Edit Printer'                => 'Drucker bearbeiten',
1060 1059
  'Edit Purchase Delivery Order' => 'Lieferschein (Einkauf) bearbeiten',
1061 1060
  'Edit Purchase Order'         => 'Lieferantenauftrag bearbeiten',
......
1093 1092
  'Edit picture'                => 'Bild bearbeiten',
1094 1093
  'Edit predefined text'        => 'Vordefinierten Textblock bearbeiten',
1095 1094
  'Edit price rule'             => 'Preisregel bearbeiten',
1095
  'Edit pricegroup'             => 'Preisgruppe bearbeiten',
1096 1096
  'Edit prices and discount (if not used, textfield is ONLY set readonly)' => 'Preise und Rabatt in Formularen frei anpassen (falls deaktiviert, wird allerdings NUR das textfield auf READONLY gesetzt / kann je nach Browserversion und technischen Fähigkeiten des Anwenders noch umgangen werden)',
1097 1097
  'Edit project'                => 'Projekt bearbeiten',
1098 1098
  'Edit project #1'             => 'Projekt #1 bearbeiten',
......
2139 2139
  'Price sources deactivated in this client' => 'Preisquellen die in diesem Mandanten deaktiviert sind',
2140 2140
  'Price type explanation'      => 'Preistyp Erklärung',
2141 2141
  'Pricegroup'                  => 'Preisgruppe',
2142
  'Pricegroup deleted!'         => 'Preisgruppe gelöscht!',
2143
  'Pricegroup missing!'         => 'Preisgruppe fehlt!',
2144
  'Pricegroup saved!'           => 'Preisgruppe gespeichert!',
2145 2142
  'Pricegroups'                 => 'Preisgruppen',
2146 2143
  'Prices'                      => 'Preise',
2147 2144
  'Print'                       => 'Drucken',
......
2957 2954
  'The price rule has been saved.' => 'Die Preisregel wurde gespeichert.',
2958 2955
  'The price rule is not a rule for discounts' => 'Die Preisregel ist keine Regel für Rabatte',
2959 2956
  'The price rule is not a rule for prices' => 'Die Preisregel ist keine Regel für Preise',
2957
  'The pricegroup has been created.' => 'Die Preisgruppe wurde erstellt.',
2958
  'The pricegroup has been deleted.' => 'Die Preisgruppe wurde gelöscht.',
2959
  'The pricegroup has been saved.' => 'Die Preisgruppe wurde gespeichert.',
2960
  'The pricegroup has been used and cannot be deleted.' => 'Die Preisgruppe wurde bereits verwendet und kann nicht gelöscht werden.',
2961
  'The pricegroup is being used by customers.' => 'Die Preisgruppe wird von Kunden verwendet.',
2960 2962
  'The printer could not be deleted.' => 'Der Drucker konnte nicht gelöscht werden.',
2961 2963
  'The printer has been created.' => 'Der Drucker wurde angelegt.',
2962 2964
  'The printer has been deleted.' => 'Der Drucker wurde entfernt.',
menus/user/00-erp.yaml
1065 1065
  id: system_pricegroups
1066 1066
  name: Pricegroups
1067 1067
  order: 1000
1068
  module: pe.pl
1069 1068
  params:
1070
    action: search
1071
    type: pricegroup
1069
    action: Pricegroup/list
1072 1070
- parent: system
1073 1071
  id: system_edit_units
1074 1072
  name: Edit units
sql/Pg-upgrade2/pricegroup_sortkey_obsolete.sql
1
-- @tag: pricegroup_sortkey_obsolete
2
-- @description: Sortierreihenfolge und ungültig für Preisgruppen
3
-- @charset: UTF-8
4
-- @depends: release_3_4_1
5
-- @ignore: 0
6

  
7
ALTER TABLE pricegroup ADD COLUMN obsolete BOOLEAN DEFAULT FALSE;
8
ALTER TABLE pricegroup ADD COLUMN sortkey INTEGER;
9

  
10
CREATE SEQUENCE tmp_counter;
11
UPDATE pricegroup SET sortkey = nextval('tmp_counter');
12
DROP SEQUENCE tmp_counter;
13
ALTER TABLE pricegroup ALTER COLUMN sortkey SET NOT NULL;
templates/webpages/pe/pricegroup_form.html
1
[%- USE L %]
2
[%- USE T8 %]
3
[%- USE HTML %]
4
<h1>[% title %]</h1>
5
[% L.javascript_tag('show_history.js') %]
6

  
7
<form method=post action="[% script %]">
8

  
9
<input type=hidden name=id value="[% id %]">
10
<input type=hidden name=type value="[% type %]">
11

  
12
<table width=100%>
13
  <tr>
14
    <td>
15
      <table width=100%>
16
        <tr>
17
          <th align=right>[% 'Pricegroup' | $T8 %]</th>
18
          <td><input name=pricegroup size=30 value="[% pricegroup | html %]"></td>
19
        </tr>
20
      </table>
21
    </td>
22
  </tr>
23
  <tr>
24
    <td colspan=2><hr size=3 noshade></td>
25
  </tr>
26
</table>
27

  
28
<br>
29

  
30
<input name=callback type=hidden value="[% callback | html %]">
31
<input type=submit class=submit name=action value="[% 'Save' | $T8 %]">
32
[%- IF id && orphaned %]
33
<input type=submit class=submit name=action value="[% 'Delete' | $T8 %]">
34
[%- END %]
35

  
36
[%- IF ( id ) %]
37
  <input type=button onclick="set_history_window([% id %], 'id');" name=history id=history value="[% 'history' | $T8 %]">
38
[%- END %]
39

  
40
</form>
41

  
templates/webpages/pe/pricegroup_report.html
1
[%- USE HTML %]
2
[%- USE T8 %]
3
<h1>[% 'Pricegroup' | $T8 %]</h1>
4

  
5
<table width=100%>
6
  <tr>
7
    <td>[% option %]</td>
8
  </tr>
9
  <tr>
10
    <td>
11
      <table width=100%>
12
        <tr class=listheading>
13
          <th class=listheading width=90%>[% 'Pricegroup' | $T8 %]</th>
14
        </tr>
15
[%- FOREACH row = item_list %]
16
        <tr valign=top class="listrow[% loop.count % 2 %]">
17
          <td><a href="[% editlink %]&id=[% row.id %]">[% row.pricegroup %]</a></td>
18
        </tr>
19
[%- END %]
20
      </table>
21
    </td>
22
  </tr>
23
  <tr>
24
    <td><hr size=3 noshade></td>
25
  </tr>
26
</table>
27

  
28
<br>
29
<form method=post action="[% script %]">
30
  <input name=callback type=hidden value="[% callback | html %]">
31
  <input type=hidden name=type value="[% type %]">
32
  <input class=submit type=submit name=action value="[% 'Add' | $T8 %]">
33
</form>
34

  
35

  
templates/webpages/pricegroup/form.html
1
[%- USE HTML -%][%- USE LxERP -%][%- USE L -%][%- USE T8 -%]
2

  
3
[% SET style="width: 400px" %]
4
[% SET size=15 %]
5

  
6
<h1>[% HTML.escape(title) %]</h1>
7

  
8
<form action="controller.pl" method="post">
9

  
10
[%- INCLUDE 'common/flash.html' %]
11

  
12
[%- L.hidden_tag("id", SELF.pricegroup.id) %]
13

  
14
<table>
15
  <tr>
16
    <th align="right">[% 'Description' | $T8 %]</th>
17
    <td>
18
       [%- L.input_tag("pricegroup.pricegroup", SELF.pricegroup.pricegroup) %]
19
   </td>
20
  [% IF SELF.pricegroup.id %]
21
  <tr>
22
    <th align="right">[% 'Obsolete' | $T8 %]</th>
23
    <td>[% L.checkbox_tag('pricegroup.obsolete', checked = SELF.pricegroup.obsolete, for_submit=1) %]</td>
24
  </tr>
25
  </tr>
26
  [% END %]
27
</table>
28

  
29
 <p>
30
  [% L.hidden_tag("action", "Pricegroup/dispatch") %]
31
  [% L.submit_tag("action_" _  (SELF.pricegroup.id ? "update" : "create"), LxERP.t8('Save'), onclick="return check_prerequisites();") %]
32
  [%- IF SELF.pricegroup.id AND SELF.pricegroup.orphaned -%]
33
    [% L.submit_tag("action_delete", LxERP.t8('Delete')) %]
34
  [%- END %]
35
  <a href="[% SELF.url_for(action='list') %]">[%- LxERP.t8("Cancel") %]</a>
36
 </p>
37

  
38
 <hr>
39

  
40
<script type="text/javascript">
41
<!--
42
function check_prerequisites() {
43
  if ($('#pricegroup_pricegroup').val() === "") {
44
    alert(kivi.t8('The description is missing.'));
45
    return false;
46
  }
47
  return true;
48
}
49
-->
50
</script>
templates/webpages/pricegroup/list.html
1
[%- USE HTML -%][%- USE LxERP -%][%- USE L -%][%- USE T8 -%][%- INCLUDE 'common/flash.html' %]
2

  
3
<h1>[% title %]</h1>
4

  
5
<p>
6
 <table width="100%" id="pricegroup_list">
7
  <thead>
8
   <tr class="listheading">
9
    <th align="center" width="1%"><img src="image/updown.png" alt="[ LxERP.t8('reorder item') %]"></th>
10
    <th>[% 'Description' | $T8 %]</th>
11
    <th>[% 'Obsolete'    | $T8 %]</th>
12
   </tr>
13
  </thead>
14

  
15
  <tbody>
16
   [%- FOREACH pricegroup = SELF.all_pricegroups %]
17
    <tr class="listrow" id="pricegroup_id_[% pricegroup.id %]">
18
     <td align="center" class="dragdrop"><img src="image/updown.png" alt="[ LxERP.t8('reorder item') %]"></td>
19
     <td><a href="[% SELF.url_for(action='edit', id=pricegroup.id) %]">[% HTML.escape(pricegroup.pricegroup) %]</a></td>
20
     <td>[% HTML.escape(pricegroup.obsolete) %]</a></td>
21
    </tr>
22
   [%- END %]
23
  </tbody>
24
 </table>
25
</p>
26

  
27
<hr height="3">
28

  
29
[% L.sortable_element('#pricegroup_list tbody', url=SELF.url_for(action='reorder'), with='pricegroup_id') %]
30

  
31
<p>
32
 <a href="[% SELF.url_for(action='new') %]">[%- 'Add' | $T8 %]</a>
33
</p>

Auch abrufbar als: Unified diff