Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 79dc6c16

Von Moritz Bunkus vor fast 8 Jahren hinzugefügt

  • ID 79dc6c16897945652994f9d2d354f1d6477d81a6
  • Vorgänger 9380035c
  • Nachfolger 5e55cce6

SimpleSystemSetting: Umstellung von »Kunden-/Lieferantentypen«

Unterschiede anzeigen:

SL/Controller/Business.pm
1
package SL::Controller::Business;
2

  
3
use strict;
4

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

  
7
use SL::DB::Business;
8
use SL::Helper::Flash;
9

  
10
use Rose::Object::MakeMethods::Generic
11
(
12
 scalar => [ qw(business) ],
13
);
14

  
15
__PACKAGE__->run_before('check_auth');
16
__PACKAGE__->run_before('load_business', only => [ qw(edit update destroy) ]);
17

  
18
#
19
# actions
20
#
21

  
22
sub action_list {
23
  my ($self) = @_;
24

  
25
  $self->render('business/list',
26
                title      => $::locale->text('Businesses'),
27
                BUSINESSES => SL::DB::Manager::Business->get_all_sorted);
28
}
29

  
30
sub action_new {
31
  my ($self) = @_;
32

  
33
  $self->{business} = SL::DB::Business->new;
34
  $self->render('business/form', title => $::locale->text('Create a new business'));
35
}
36

  
37
sub action_edit {
38
  my ($self) = @_;
39
  $self->render('business/form', title => $::locale->text('Edit business'));
40
}
41

  
42
sub action_create {
43
  my ($self) = @_;
44

  
45
  $self->{business} = SL::DB::Business->new;
46
  $self->create_or_update;
47
}
48

  
49
sub action_update {
50
  my ($self) = @_;
51
  $self->create_or_update;
52
}
53

  
54
sub action_destroy {
55
  my ($self) = @_;
56

  
57
  if (eval { $self->{business}->delete; 1; }) {
58
    flash_later('info',  $::locale->text('The business has been deleted.'));
59
  } else {
60
    flash_later('error', $::locale->text('The business is in use and cannot be deleted.'));
61
  }
62

  
63
  $self->redirect_to(action => 'list');
64
}
65

  
66
#
67
# filters
68
#
69

  
70
sub check_auth {
71
  $::auth->assert('config');
72
}
73

  
74
#
75
# helpers
76
#
77

  
78
sub create_or_update {
79
  my $self   = shift;
80
  my $is_new = !$self->{business}->id;
81
  my $params = delete($::form->{business}) || { };
82

  
83
  $self->{business}->assign_attributes(%{ $params });
84

  
85
  my @errors = $self->{business}->validate;
86

  
87
  if (@errors) {
88
    flash('error', @errors);
89
    $self->render('business/form', title => $is_new ? $::locale->text('Create a new business') : $::locale->text('Edit business'));
90
    return;
91
  }
92

  
93
  $self->{business}->save;
94

  
95
  flash_later('info', $is_new ? $::locale->text('The business has been created.') : $::locale->text('The business has been saved.'));
96
  $self->redirect_to(action => 'list');
97
}
98

  
99
sub load_business {
100
  my ($self) = @_;
101
  $self->{business} = SL::DB::Business->new(id => $::form->{id})->load;
102
}
103

  
104
1;
SL/Controller/SimpleSystemSetting.pm
40 40
    ],
41 41
  },
42 42

  
43
  business => {
44
    # Make locales.pl happy: $self->render("simple_system_setting/_business_form")
45
    class  => 'Business',
46
    titles => {
47
      list => t8('Businesses'),
48
      add  => t8('Add business'),
49
      edit => t8('Edit business'),
50
    },
51
    list_attributes => [
52
      { method => 'description',         title => t8('Description'), },
53
      {                                  title => t8('Discount'), formatter => sub { $_[0]->discount_as_percent . ' %' }, align => 'right' },
54
      { method => 'customernumberinit',  title => t8('Customernumberinit'), },
55
    ],
56
  },
57

  
43 58
  department => {
44 59
    class  => 'Department',
45 60
    titles => {
locale/de/all
190 190
  'Add and edit units'          => 'Einheiten erfassen und bearbeiten',
191 191
  'Add bank account'            => 'Bankkonto erfassen',
192 192
  'Add booking group'           => 'Buchungsgruppe erfassen',
193
  'Add business'                => 'Kunden-/Lieferantentyp hinzufügen',
193 194
  'Add custom variable'         => 'Benutzerdefinierte Variable erfassen',
194 195
  'Add department'              => 'Abteilung hinzufügen',
195 196
  'Add empty line (csv_import)' => 'Leere Zeile einfügen',
......
291 292
  'Are you sure you want to delete Invoice Number' => 'Soll die Rechnung mit folgender Nummer wirklich gelöscht werden:',
292 293
  'Are you sure you want to delete Transaction' => 'Buchung wirklich löschen?',
293 294
  'Are you sure you want to delete this background job?' => 'Sind Sie sicher, dass Sie diesen Hintergrund-Job löschen möchten?',
294
  'Are you sure you want to delete this business?' => 'Sind Sie sicher, dass Sie diesen Kunden-/Lieferantentyp löschen wollen?',
295 295
  'Are you sure you want to delete this delivery term?' => 'Wollen Sie diese Lieferbedingungen wirklich löschen?',
296 296
  'Are you sure you want to delete this letter?' => 'Sind Sie sicher, dass Sie diesen Brief löschen wollen?',
297 297
  'Are you sure you want to delete this payment term?' => 'Wollen Sie diese Zahlungsbedingungen wirklich löschen?',
......
661 661
  'Create PDF'                  => 'PDF erzeugen',
662 662
  'Create a new acceptance status' => 'Einen neuen Abnahmestatus anlegen',
663 663
  'Create a new background job' => 'Einen neuen Hintergrund-Job anlegen',
664
  'Create a new business'       => 'Einen neuen Kunden-/Lieferantentyp erfassen',
665 664
  'Create a new client'         => 'Einen neuen Mandanten anlegen',
666 665
  'Create a new complexity'     => 'Einen Komplexitätsgrad anlegen',
667 666
  'Create a new delivery term'  => 'Neue Lieferbedingungen anlegen',
......
709 708
  'Create invoices'             => 'Rechnungen erzeugen',
710 709
  'Create new'                  => 'Neu erfassen',
711 710
  'Create new background job'   => 'Neuen Hintergrund-Job anlegen',
712
  'Create new business'         => 'Kunden-/Lieferantentyp erfassen',
713 711
  'Create new client #1'        => 'Neuen Mandanten #1 anlegen',
714 712
  'Create new delivery term'    => 'Neue Lieferbedingungen anlegen',
715 713
  'Create new payment term'     => 'Neue Zahlungsbedingung anlegen',
......
1852 1850
  'No bank information has been entered in this customer\'s master data entry. You cannot create bank collections unless you enter bank information.' => 'Für diesen Kunden wurden in seinen Stammdaten keine Kontodaten hinterlegt. Solange dies nicht geschehen ist, können Sie keine Überweisungen für den Lieferanten anlegen.',
1853 1851
  'No bank information has been entered in this vendor\'s master data entry. You cannot create bank transfers unless you enter bank information.' => 'Für diesen Lieferanten wurden in seinen Stammdaten keine Kontodaten hinterlegt. Solange dies nicht geschehen ist, können Sie keine Überweisungen für den Lieferanten anlegen.',
1854 1852
  'No bins have been added to this warehouse yet.' => 'Es wurden zu diesem Lager noch keine Lagerplätze angelegt.',
1855
  'No business has been created yet.' => 'Es wurden noch kein Kunden-/Lieferantentyp erfasst.',
1856 1853
  'No changes since previous version.' => 'Keine Änderungen seit der letzten Version.',
1857 1854
  'No clients have been created yet.' => 'Es wurden noch keine Mandanten angelegt.',
1858 1855
  'No complexities has been created yet.' => 'Es wurden noch keine Komplexitätsgrade angelegt.',
......
2924 2921
  'The booking group is in use and cannot be deleted.' => 'Die Buchungsgruppe wird benutzt und kann daher nicht gelöscht werden.',
2925 2922
  'The booking group needs an inventory account.' => 'Die Buchungsgruppe braucht ein Warenbestandskonto.',
2926 2923
  'The buchungsgruppe is missing.' => 'Die Buchungsgruppe fehlt.',
2927
  'The business has been created.' => 'Der Kunden-/Lieferantentyp wurde erfasst.',
2928
  'The business has been deleted.' => 'Der Kunden-/Lieferantentyp wurde gelöscht.',
2929
  'The business has been saved.' => 'Der Kunden-/Lieferantentyp wurde gespeichert.',
2930
  'The business is in use and cannot be deleted.' => 'Der Kunden-/Lieferantentyp wird benutzt und kann nicht gelöscht werden.',
2931 2924
  'The changing of tax-o-matic account is NOT recommended, but if you do so please also (re)configure booking groups and reconfigure ALL charts which point to this tax-o-matic account. ' => 'Es wird nicht empfohlen Steuerkonten (Umsatzsteuer oder Vorsteuer) "umzuhängen", aber falls es gemacht wird, bitte auch entsprechend konsequent die Buchungsgruppen und die Konten die mit dieser Steuer verknüpft sind umkonfigurieren.',
2932 2925
  'The chart is not valid.'     => 'Das Konto ist nicht gültig.',
2933 2926
  'The client could not be deleted.' => 'Der Mandant konnte nicht gelöscht werden.',
menus/user/00-erp.yaml
1115 1115
  name: Types of Business
1116 1116
  order: 1400
1117 1117
  params:
1118
    action: Business/list
1118
    action: SimpleSystemSetting/list
1119
    type: business
1119 1120
- parent: system
1120 1121
  id: system_project_types
1121 1122
  name: Project Types
templates/webpages/business/form.html
1
[% USE HTML %][% USE L %][% USE LxERP %]
2
<h1>[% FORM.title %]</h1>
3

  
4
 <form method="post" action="controller.pl">
5

  
6
[%- INCLUDE 'common/flash.html' %]
7

  
8
  <table>
9
   <tr>
10
    <td>[%- LxERP.t8('Description') %]</td>
11
    <td>[% L.input_tag("business.description", SELF.business.description, "size", 30) %]</td>
12
   </tr>
13

  
14
   <tr>
15
    <td>[%- LxERP.t8('Discount') %]</td>
16
    <td>[% L.input_tag("business.discount_as_percent", SELF.business.discount_as_percent, "size", 5) %]%</td>
17
   </tr>
18

  
19
   <tr>
20
    <td>[%- LxERP.t8('Customernumberinit') %]</td>
21
    <td>[% L.input_tag("business.customernumberinit", SELF.business.customernumberinit, "size", 10) %]</td>
22
   </tr>
23

  
24
   [%- IF LXCONFIG.features.vertreter %]
25
    <tr>
26
     <td>[%- LxERP.t8('Representative') %]</td>
27
     <td>[% L.checkbox_tag("business.salesman", "value", 1, "checked", SELF.business.salesman) %]</td>
28
    </tr>
29
   [%- END %]
30
  </table>
31

  
32
  <p>
33
   [% L.hidden_tag("id", SELF.business.id) %]
34
   [% L.hidden_tag("action", "Business/dispatch") %]
35
   [% L.submit_tag("action_" _  (SELF.business.id ? "update" : "create"), LxERP.t8('Save')) %]
36
   [%- IF SELF.business.id %]
37
    [% L.submit_tag("action_destroy", LxERP.t8("Delete"), "confirm", LxERP.t8("Are you sure you want to delete this business?")) %]
38
   [%- END %]
39
   <a href="[% SELF.url_for(action => 'list') %]">[%- LxERP.t8('Abort') %]</a>
40
  </p>
41
 </form>
templates/webpages/business/list.html
1
[% USE HTML %][% USE L %][% USE LxERP %]
2
<h1>[% FORM.title %]</h1>
3

  
4
[%- INCLUDE 'common/flash.html' %]
5

  
6
 <form method="post" action="controller.pl">
7
  [% IF !BUSINESSES.size %]
8
   <p>
9
    [%- LxERP.t8('No business has been created yet.') %]
10
   </p>
11

  
12
  [%- ELSE %]
13
   <table id="business_list" width="100%">
14
    <thead>
15
    <tr class="listheading">
16
     <th width="80%">[%- LxERP.t8('Description') %]</th>
17
     <th>[%- LxERP.t8('Discount') %]</th>
18
     <th>[%- LxERP.t8('Customernumberinit') %]</th>
19
     [%- IF LXCONFIG.features.vertreter %]
20
      <th>[%- LxERP.t8('Representative') %]</th>
21
     [%- END %]
22
    </tr>
23
    </thead>
24

  
25
    <tbody>
26
    [%- FOREACH business = BUSINESSES %]
27
    <tr class="listrow[% loop.count % 2 %]" id="business_id_[% business.id %]">
28
     <td>
29
      <a href="[% SELF.url_for(action => 'edit', id => business.id) %]">
30
       [%- HTML.escape(business.description) %]
31
      </a>
32
     </td>
33
     <td align="right">[% LxERP.format_amount(business.discount * 100) %] %</td>
34
     <td align="right">[%- HTML.escape(business.customernumberinit) %]</td>
35
     [%- IF LXCONFIG.features.vertreter %]
36
      <td>[%- IF business.salesman %][%- LxERP.t8('Yes') %][%- ELSE %][%- LxERP.t8('No') %][%- END %]</td>
37
     [%- END %]
38
    </tr>
39
    [%- END %]
40
    </tbody>
41
   </table>
42
  [%- END %]
43

  
44
  <hr size="3" noshade>
45

  
46
  <p>
47
   <a href="[% SELF.url_for(action => 'new') %]">[%- LxERP.t8('Create new business') %]</a>
48
  </p>
49
 </form>
templates/webpages/simple_system_setting/_business_form.html
1
[%- USE LxERP -%][%- USE L -%]
2
[% SET style="width: 200px" %]
3
<table>
4
 <tr>
5
  <td>[%- LxERP.t8("Description") %]</td>
6
  <td>[% L.input_tag("object.description", SELF.object.description, style=style, "data-validate"="required", "data-title"=LxERP.t8("Description")) %]</td>
7
 </tr>
8

  
9
 <tr>
10
  <td>[%- LxERP.t8("Discount") %]</td>
11
  <td>[% L.input_tag("object.discount_as_percent", SELF.object.discount_as_percent, style=style) %]%</td>
12
 </tr>
13

  
14
 <tr>
15
  <td>[%- LxERP.t8("Customernumberinit") %]</td>
16
  <td>[% L.input_tag("object.customernumberinit", SELF.object.customernumberinit, style=style) %]</td>
17
 </tr>
18

  
19
 [%- IF LXCONFIG.features.vertreter %]
20
 <tr>
21
  <td>[%- LxERP.t8("Representative") %]</td>
22
  <td>[% L.checkbox_tag("object.salesman", "value", 1, "checked", SELF.object.salesman, for_submit=1) %]</td>
23
 </tr>
24
 [%- END %]
25
</table>

Auch abrufbar als: Unified diff