From 79dc6c16897945652994f9d2d354f1d6477d81a6 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 1 Feb 2017 15:00:14 +0100 Subject: [PATCH] =?utf8?q?SimpleSystemSetting:=20Umstellung=20von=20=C2=BB?= =?utf8?q?Kunden-/Lieferantentypen=C2=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Controller/Business.pm | 104 ------------------ SL/Controller/SimpleSystemSetting.pm | 15 +++ locale/de/all | 9 +- menus/user/00-erp.yaml | 3 +- templates/webpages/business/form.html | 41 ------- templates/webpages/business/list.html | 49 --------- .../simple_system_setting/_business_form.html | 25 +++++ 7 files changed, 43 insertions(+), 203 deletions(-) delete mode 100644 SL/Controller/Business.pm delete mode 100644 templates/webpages/business/form.html delete mode 100644 templates/webpages/business/list.html create mode 100644 templates/webpages/simple_system_setting/_business_form.html diff --git a/SL/Controller/Business.pm b/SL/Controller/Business.pm deleted file mode 100644 index dbd0f33bb..000000000 --- a/SL/Controller/Business.pm +++ /dev/null @@ -1,104 +0,0 @@ -package SL::Controller::Business; - -use strict; - -use parent qw(SL::Controller::Base); - -use SL::DB::Business; -use SL::Helper::Flash; - -use Rose::Object::MakeMethods::Generic -( - scalar => [ qw(business) ], -); - -__PACKAGE__->run_before('check_auth'); -__PACKAGE__->run_before('load_business', only => [ qw(edit update destroy) ]); - -# -# actions -# - -sub action_list { - my ($self) = @_; - - $self->render('business/list', - title => $::locale->text('Businesses'), - BUSINESSES => SL::DB::Manager::Business->get_all_sorted); -} - -sub action_new { - my ($self) = @_; - - $self->{business} = SL::DB::Business->new; - $self->render('business/form', title => $::locale->text('Create a new business')); -} - -sub action_edit { - my ($self) = @_; - $self->render('business/form', title => $::locale->text('Edit business')); -} - -sub action_create { - my ($self) = @_; - - $self->{business} = SL::DB::Business->new; - $self->create_or_update; -} - -sub action_update { - my ($self) = @_; - $self->create_or_update; -} - -sub action_destroy { - my ($self) = @_; - - if (eval { $self->{business}->delete; 1; }) { - flash_later('info', $::locale->text('The business has been deleted.')); - } else { - flash_later('error', $::locale->text('The business is in use and cannot be deleted.')); - } - - $self->redirect_to(action => 'list'); -} - -# -# filters -# - -sub check_auth { - $::auth->assert('config'); -} - -# -# helpers -# - -sub create_or_update { - my $self = shift; - my $is_new = !$self->{business}->id; - my $params = delete($::form->{business}) || { }; - - $self->{business}->assign_attributes(%{ $params }); - - my @errors = $self->{business}->validate; - - if (@errors) { - flash('error', @errors); - $self->render('business/form', title => $is_new ? $::locale->text('Create a new business') : $::locale->text('Edit business')); - return; - } - - $self->{business}->save; - - flash_later('info', $is_new ? $::locale->text('The business has been created.') : $::locale->text('The business has been saved.')); - $self->redirect_to(action => 'list'); -} - -sub load_business { - my ($self) = @_; - $self->{business} = SL::DB::Business->new(id => $::form->{id})->load; -} - -1; diff --git a/SL/Controller/SimpleSystemSetting.pm b/SL/Controller/SimpleSystemSetting.pm index 979de3269..fe499e2bb 100644 --- a/SL/Controller/SimpleSystemSetting.pm +++ b/SL/Controller/SimpleSystemSetting.pm @@ -40,6 +40,21 @@ my %supported_types = ( ], }, + business => { + # Make locales.pl happy: $self->render("simple_system_setting/_business_form") + class => 'Business', + titles => { + list => t8('Businesses'), + add => t8('Add business'), + edit => t8('Edit business'), + }, + list_attributes => [ + { method => 'description', title => t8('Description'), }, + { title => t8('Discount'), formatter => sub { $_[0]->discount_as_percent . ' %' }, align => 'right' }, + { method => 'customernumberinit', title => t8('Customernumberinit'), }, + ], + }, + department => { class => 'Department', titles => { diff --git a/locale/de/all b/locale/de/all index c1ef427bb..a8dbfadfa 100755 --- a/locale/de/all +++ b/locale/de/all @@ -190,6 +190,7 @@ $self->{texts} = { 'Add and edit units' => 'Einheiten erfassen und bearbeiten', 'Add bank account' => 'Bankkonto erfassen', 'Add booking group' => 'Buchungsgruppe erfassen', + 'Add business' => 'Kunden-/Lieferantentyp hinzufügen', 'Add custom variable' => 'Benutzerdefinierte Variable erfassen', 'Add department' => 'Abteilung hinzufügen', 'Add empty line (csv_import)' => 'Leere Zeile einfügen', @@ -291,7 +292,6 @@ $self->{texts} = { 'Are you sure you want to delete Invoice Number' => 'Soll die Rechnung mit folgender Nummer wirklich gelöscht werden:', 'Are you sure you want to delete Transaction' => 'Buchung wirklich löschen?', 'Are you sure you want to delete this background job?' => 'Sind Sie sicher, dass Sie diesen Hintergrund-Job löschen möchten?', - 'Are you sure you want to delete this business?' => 'Sind Sie sicher, dass Sie diesen Kunden-/Lieferantentyp löschen wollen?', 'Are you sure you want to delete this delivery term?' => 'Wollen Sie diese Lieferbedingungen wirklich löschen?', 'Are you sure you want to delete this letter?' => 'Sind Sie sicher, dass Sie diesen Brief löschen wollen?', 'Are you sure you want to delete this payment term?' => 'Wollen Sie diese Zahlungsbedingungen wirklich löschen?', @@ -661,7 +661,6 @@ $self->{texts} = { 'Create PDF' => 'PDF erzeugen', 'Create a new acceptance status' => 'Einen neuen Abnahmestatus anlegen', 'Create a new background job' => 'Einen neuen Hintergrund-Job anlegen', - 'Create a new business' => 'Einen neuen Kunden-/Lieferantentyp erfassen', 'Create a new client' => 'Einen neuen Mandanten anlegen', 'Create a new complexity' => 'Einen Komplexitätsgrad anlegen', 'Create a new delivery term' => 'Neue Lieferbedingungen anlegen', @@ -709,7 +708,6 @@ $self->{texts} = { 'Create invoices' => 'Rechnungen erzeugen', 'Create new' => 'Neu erfassen', 'Create new background job' => 'Neuen Hintergrund-Job anlegen', - 'Create new business' => 'Kunden-/Lieferantentyp erfassen', 'Create new client #1' => 'Neuen Mandanten #1 anlegen', 'Create new delivery term' => 'Neue Lieferbedingungen anlegen', 'Create new payment term' => 'Neue Zahlungsbedingung anlegen', @@ -1852,7 +1850,6 @@ $self->{texts} = { '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.', '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.', 'No bins have been added to this warehouse yet.' => 'Es wurden zu diesem Lager noch keine Lagerplätze angelegt.', - 'No business has been created yet.' => 'Es wurden noch kein Kunden-/Lieferantentyp erfasst.', 'No changes since previous version.' => 'Keine Änderungen seit der letzten Version.', 'No clients have been created yet.' => 'Es wurden noch keine Mandanten angelegt.', 'No complexities has been created yet.' => 'Es wurden noch keine Komplexitätsgrade angelegt.', @@ -2924,10 +2921,6 @@ $self->{texts} = { 'The booking group is in use and cannot be deleted.' => 'Die Buchungsgruppe wird benutzt und kann daher nicht gelöscht werden.', 'The booking group needs an inventory account.' => 'Die Buchungsgruppe braucht ein Warenbestandskonto.', 'The buchungsgruppe is missing.' => 'Die Buchungsgruppe fehlt.', - 'The business has been created.' => 'Der Kunden-/Lieferantentyp wurde erfasst.', - 'The business has been deleted.' => 'Der Kunden-/Lieferantentyp wurde gelöscht.', - 'The business has been saved.' => 'Der Kunden-/Lieferantentyp wurde gespeichert.', - 'The business is in use and cannot be deleted.' => 'Der Kunden-/Lieferantentyp wird benutzt und kann nicht gelöscht werden.', '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.', 'The chart is not valid.' => 'Das Konto ist nicht gültig.', 'The client could not be deleted.' => 'Der Mandant konnte nicht gelöscht werden.', diff --git a/menus/user/00-erp.yaml b/menus/user/00-erp.yaml index 7a37abe03..5cd935799 100644 --- a/menus/user/00-erp.yaml +++ b/menus/user/00-erp.yaml @@ -1115,7 +1115,8 @@ name: Types of Business order: 1400 params: - action: Business/list + action: SimpleSystemSetting/list + type: business - parent: system id: system_project_types name: Project Types diff --git a/templates/webpages/business/form.html b/templates/webpages/business/form.html deleted file mode 100644 index 6fa326b82..000000000 --- a/templates/webpages/business/form.html +++ /dev/null @@ -1,41 +0,0 @@ -[% USE HTML %][% USE L %][% USE LxERP %] -

[% FORM.title %]

- -
- -[%- INCLUDE 'common/flash.html' %] - - - - - - - - - - - - - - - - - - [%- IF LXCONFIG.features.vertreter %] - - - - - [%- END %] -
[%- LxERP.t8('Description') %][% L.input_tag("business.description", SELF.business.description, "size", 30) %]
[%- LxERP.t8('Discount') %][% L.input_tag("business.discount_as_percent", SELF.business.discount_as_percent, "size", 5) %]%
[%- LxERP.t8('Customernumberinit') %][% L.input_tag("business.customernumberinit", SELF.business.customernumberinit, "size", 10) %]
[%- LxERP.t8('Representative') %][% L.checkbox_tag("business.salesman", "value", 1, "checked", SELF.business.salesman) %]
- -

- [% L.hidden_tag("id", SELF.business.id) %] - [% L.hidden_tag("action", "Business/dispatch") %] - [% L.submit_tag("action_" _ (SELF.business.id ? "update" : "create"), LxERP.t8('Save')) %] - [%- IF SELF.business.id %] - [% L.submit_tag("action_destroy", LxERP.t8("Delete"), "confirm", LxERP.t8("Are you sure you want to delete this business?")) %] - [%- END %] - [%- LxERP.t8('Abort') %] -

-
diff --git a/templates/webpages/business/list.html b/templates/webpages/business/list.html deleted file mode 100644 index 1fe7aff69..000000000 --- a/templates/webpages/business/list.html +++ /dev/null @@ -1,49 +0,0 @@ -[% USE HTML %][% USE L %][% USE LxERP %] -

[% FORM.title %]

- -[%- INCLUDE 'common/flash.html' %] - -
- [% IF !BUSINESSES.size %] -

- [%- LxERP.t8('No business has been created yet.') %] -

- - [%- ELSE %] - - - - - - - [%- IF LXCONFIG.features.vertreter %] - - [%- END %] - - - - - [%- FOREACH business = BUSINESSES %] - - - - - [%- IF LXCONFIG.features.vertreter %] - - [%- END %] - - [%- END %] - -
[%- LxERP.t8('Description') %][%- LxERP.t8('Discount') %][%- LxERP.t8('Customernumberinit') %][%- LxERP.t8('Representative') %]
- - [%- HTML.escape(business.description) %] - - [% LxERP.format_amount(business.discount * 100) %] %[%- HTML.escape(business.customernumberinit) %][%- IF business.salesman %][%- LxERP.t8('Yes') %][%- ELSE %][%- LxERP.t8('No') %][%- END %]
- [%- END %] - -
- -

- [%- LxERP.t8('Create new business') %] -

-
diff --git a/templates/webpages/simple_system_setting/_business_form.html b/templates/webpages/simple_system_setting/_business_form.html new file mode 100644 index 000000000..85fe387e5 --- /dev/null +++ b/templates/webpages/simple_system_setting/_business_form.html @@ -0,0 +1,25 @@ +[%- USE LxERP -%][%- USE L -%] +[% SET style="width: 200px" %] + + + + + + + + + + + + + + + + + [%- IF LXCONFIG.features.vertreter %] + + + + + [%- END %] +
[%- LxERP.t8("Description") %][% L.input_tag("object.description", SELF.object.description, style=style, "data-validate"="required", "data-title"=LxERP.t8("Description")) %]
[%- LxERP.t8("Discount") %][% L.input_tag("object.discount_as_percent", SELF.object.discount_as_percent, style=style) %]%
[%- LxERP.t8("Customernumberinit") %][% L.input_tag("object.customernumberinit", SELF.object.customernumberinit, style=style) %]
[%- LxERP.t8("Representative") %][% L.checkbox_tag("object.salesman", "value", 1, "checked", SELF.object.salesman, for_submit=1) %]
-- 2.20.1