From: Sven Schöling Date: Tue, 17 Dec 2013 13:23:57 +0000 (+0100) Subject: Projekttypen verwaltbar gemacht X-Git-Tag: release-3.1.0beta1~22^2~80 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=9c7262bf1daa8ca9bb1c81a11be0e47cbcf1b533;p=kivitendo-erp.git Projekttypen verwaltbar gemacht --- diff --git a/SL/Controller/FinancialControllingReport.pm b/SL/Controller/FinancialControllingReport.pm index d4492c1d9..d44936d67 100644 --- a/SL/Controller/FinancialControllingReport.pm +++ b/SL/Controller/FinancialControllingReport.pm @@ -6,6 +6,7 @@ use parent qw(SL::Controller::Base); use List::Util qw(sum); use SL::DB::Order; +use SL::DB::ProjectType; use SL::Controller::Helper::GetModels; use SL::Controller::Helper::Paginated; use SL::Controller::Helper::Sorted; @@ -37,6 +38,7 @@ __PACKAGE__->make_sorted( customer => t8('Customer'), transaction_description => t8('Transaction description'), globalprojectnumber => t8('Project'), + globalproject_type => t8('Project Type'), netamount => t8('Order amount'), ); @@ -62,7 +64,7 @@ sub setup_db_args_for_list { my ($self) = @_; $self->{filter} = {}; - my %args = ( parse_filter($::form->{filter}, with_objects => [ 'customer', 'globalproject' ], launder_to => $self->{filter})); + my %args = ( parse_filter($::form->{filter}, with_objects => [ 'customer', 'globalproject', 'globalproject.project_type' ], launder_to => $self->{filter})); $args{query} = [ @{ $args{query} || [] }, SL::DB::Manager::Order->type_filter('sales_order'), @@ -77,9 +79,9 @@ sub prepare_report { my $report = SL::ReportGenerator->new(\%::myconfig, $::form); $self->{report} = $report; - my @columns = qw(customer globalprojectnumber project_type ordnumber netamount delivered_amount delivered_amount_p billed_amount billed_amount_p paid_amount paid_amount_p + my @columns = qw(customer globalprojectnumber globalproject_type ordnumber netamount delivered_amount delivered_amount_p billed_amount billed_amount_p paid_amount paid_amount_p billable_amount billable_amount_p other_amount); - my @sortable = qw(ordnumber transdate customer netamount globalprojectnumber); + my @sortable = qw(ordnumber transdate customer netamount globalprojectnumber globalproject_type); $self->{number_columns} = [ qw(netamount billed_amount billed_amount_p delivered_amount delivered_amount_p paid_amount paid_amount_p other_amount billable_amount billable_amount_p) ]; my %column_defs = ( @@ -97,8 +99,8 @@ sub prepare_report { customer => { sub => sub { $_[0]->customer->name }, obj_link => sub { $self->link_to($_[0]->customer) } }, globalprojectnumber => { sub => sub { $_[0]->globalproject_id ? $_[0]->globalproject->projectnumber : '' } }, - project_type => { text => $::locale->text('Project type'), - sub => sub { $_[0]->globalproject_id ? $_[0]->globalproject->type : '' } }, + globalproject_type => { text => $::locale->text('Project type'), + sub => sub { $_[0]->globalproject_id ? $_[0]->globalproject->project_type->description : '' } }, ); map { $column_defs{$_}->{text} ||= $::locale->text( $self->get_sort_spec->{$_}->{title} ) } keys %column_defs; diff --git a/SL/Controller/Project.pm b/SL/Controller/Project.pm index a5793b85a..23e5228ad 100644 --- a/SL/Controller/Project.pm +++ b/SL/Controller/Project.pm @@ -16,6 +16,7 @@ use SL::DB::Invoice; use SL::DB::Order; use SL::DB::Project; use SL::DB::PurchaseInvoice; +use SL::DB::ProjectType; use SL::Helper::Flash; use SL::Locale::String; @@ -26,7 +27,7 @@ use Rose::Object::MakeMethods::Generic ); __PACKAGE__->run_before('check_auth'); -__PACKAGE__->run_before('load_project', only => [ qw(edit update destroy) ]); +__PACKAGE__->run_before('load_project', only => [ qw(edit update destroy) ]); # # actions @@ -37,7 +38,8 @@ sub action_search { my %params; - $params{CUSTOM_VARIABLES} = CVar->get_configs(module => 'Projects'); + $params{ALL_PROJECT_TYPES} = SL::DB::Manager::ProjectType->get_all_sorted; + $params{CUSTOM_VARIABLES} = CVar->get_configs(module => 'Projects'); ($params{CUSTOM_VARIABLES_FILTER_CODE}, $params{CUSTOM_VARIABLES_INCLUSION_CODE}) = CVar->render_search_options(variables => $params{CUSTOM_VARIABLES}, include_prefix => 'l_', @@ -121,8 +123,9 @@ sub check_auth { sub display_form { my ($self, %params) = @_; - $params{ALL_CUSTOMERS} = SL::DB::Manager::Customer->get_all_sorted(where => [ or => [ obsolete => 0, obsolete => undef, id => $self->project->customer_id ]]); - $params{CUSTOM_VARIABLES} = CVar->get_custom_variables(module => 'Projects', trans_id => $self->project->id); + $params{ALL_CUSTOMERS} = SL::DB::Manager::Customer->get_all_sorted(where => [ or => [ obsolete => 0, obsolete => undef, id => $self->project->customer_id ]]); + $params{ALL_PROJECT_TYPES} = SL::DB::Manager::ProjectType->get_all_sorted; + $params{CUSTOM_VARIABLES} = CVar->get_custom_variables(module => 'Projects', trans_id => $self->project->id); CVar->render_inputs(variables => $params{CUSTOM_VARIABLES}) if @{ $params{CUSTOM_VARIABLES} }; $self->render('project/form', %params); @@ -171,7 +174,7 @@ sub setup_db_args_from_filter { $self->{filter} = {}; my %args = parse_filter( $self->_pre_parse_filter($::form->{filter}, $self->{filter}), - with_objects => [ 'customer' ], + with_objects => [ 'customer', 'project_type' ], launder_to => $self->{filter}, ); @@ -186,13 +189,13 @@ sub prepare_report { my $report = SL::ReportGenerator->new(\%::myconfig, $::form); $self->{report} = $report; - my @columns = qw(projectnumber description customer active valid type); - my @sortable = qw(projectnumber description customer type); + my @columns = qw(projectnumber description customer active valid project_type); + my @sortable = qw(projectnumber description customer project_type); my %column_defs = ( projectnumber => { obj_link => sub { $self->url_for(action => 'edit', id => $_[0]->id, callback => $callback) } }, description => { obj_link => sub { $self->url_for(action => 'edit', id => $_[0]->id, callback => $callback) } }, - type => { }, + project_type => { sub => sub { $_[0]->project_type->description } }, customer => { sub => sub { $_[0]->customer ? $_[0]->customer->name : '' } }, active => { sub => sub { $_[0]->active ? $::locale->text('Active') : $::locale->text('Inactive') }, text => $::locale->text('Active') }, @@ -235,7 +238,7 @@ sub init_models { customer => t8('Customer'), description => t8('Description'), projectnumber => t8('Project Number'), - type => t8('Type'), + project_type => t8('Project Type'), }, with_objects => [ 'customer' ], ); diff --git a/SL/Controller/ProjectType.pm b/SL/Controller/ProjectType.pm new file mode 100644 index 000000000..facf1a810 --- /dev/null +++ b/SL/Controller/ProjectType.pm @@ -0,0 +1,117 @@ +package SL::Controller::ProjectType; + +use strict; + +use parent qw(SL::Controller::Base); + +use SL::DB::ProjectType; +use SL::Helper::Flash; + +use Rose::Object::MakeMethods::Generic +( + scalar => [ qw(project_type) ], +); + +__PACKAGE__->run_before('check_auth'); +__PACKAGE__->run_before('load_project_type', only => [ qw(edit update destroy) ]); + +# +# actions +# + +sub action_list { + my ($self) = @_; + + $self->render('project_type/list', + title => $::locale->text('Project Types'), + PROJECT_TYPES => SL::DB::Manager::ProjectType->get_all_sorted); +} + +sub action_new { + my ($self) = @_; + + $self->{project_type} = SL::DB::ProjectType->new; + $self->render('project_type/form', title => $::locale->text('Create a new project type')); +} + +sub action_edit { + my ($self) = @_; + $self->render('project_type/form', title => $::locale->text('Edit project type')); +} + +sub action_create { + my ($self) = @_; + + $self->{project_type} = SL::DB::ProjectType->new; + $self->create_or_update; +} + +sub action_update { + my ($self) = @_; + $self->create_or_update; +} + +sub action_destroy { + my ($self) = @_; + + if (eval { $self->{project_type}->delete; 1; }) { + flash_later('info', $::locale->text('The project type has been deleted.')); + } else { + flash_later('error', $::locale->text('The project type is in use and cannot be deleted.')); + } + + $self->redirect_to(action => 'list'); +} + +sub action_reorder { + my ($self) = @_; + + my @ids = @{ $::form->{project_type_id} || [] }; + my $result = SL::DB::ProjectType->new->db->do_transaction(sub { + foreach my $idx (0 .. scalar(@ids) - 1) { + SL::DB::ProjectType->new(id => $ids[$idx])->load->update_attributes(position => $idx + 1); + } + }); + + $self->render('1;', { type => 'js', inline => 1 }); +} + +# +# filters +# + +sub check_auth { + $::auth->assert('config'); +} + +# +# helpers +# + +sub create_or_update { + my $self = shift; + my $is_new = !$self->{project_type}->id; + my $params = delete($::form->{project_type}) || { }; + + $self->{project_type}->assign_attributes(%{ $params }); + + my @errors = $self->{project_type}->validate; + + if (@errors) { + flash('error', @errors); + $self->render('project_type/form', title => $is_new ? $::locale->text('Create a new project type') : $::locale->text('Edit project type')); + return; + } + + $self->{project_type}->save; + + flash_later('info', $is_new ? $::locale->text('The project type has been created.') : $::locale->text('The project type has been saved.')); + $self->redirect_to(action => 'list'); +} + +sub load_project_type { + my ($self) = @_; + $self->{project_type} = SL::DB::ProjectType->new(id => $::form->{id})->load; +} + +1; diff --git a/SL/DB/Helper/ALL.pm b/SL/DB/Helper/ALL.pm index 446356775..498583f0a 100644 --- a/SL/DB/Helper/ALL.pm +++ b/SL/DB/Helper/ALL.pm @@ -70,6 +70,7 @@ use SL::DB::Pricegroup; use SL::DB::Price; use SL::DB::Printer; use SL::DB::Project; +use SL::DB::ProjectType; use SL::DB::PurchaseInvoice; use SL::DB::RecordLink; use SL::DB::SchemaInfo; diff --git a/SL/DB/Helper/Mappings.pm b/SL/DB/Helper/Mappings.pm index 35d601d60..633a06793 100644 --- a/SL/DB/Helper/Mappings.pm +++ b/SL/DB/Helper/Mappings.pm @@ -151,6 +151,7 @@ my %kivitendo_package_names = ( pricegroup => 'pricegroup', printers => 'printer', project => 'project', + project_types => 'ProjectType', record_links => 'record_link', sepa_export => 'sepa_export', sepa_export_items => 'sepa_export_item', diff --git a/SL/DB/Manager/Order.pm b/SL/DB/Manager/Order.pm index 69aa26679..e03386d04 100644 --- a/SL/DB/Manager/Order.pm +++ b/SL/DB/Manager/Order.pm @@ -38,6 +38,13 @@ sub _sort_spec { customer => 'customer.name', vendor => 'vendor.name', globalprojectnumber => 'lower(globalproject.projectnumber)', + + # Bug in Rose::DB::Object: the next should be + # "globalproject.project_type.description". This workaround will + # only work if no other table with "project_type" is visible in + # the current query + globalproject_type => 'lower(project_type.description)', + map { ( $_ => "lower(oe.$_)" ) } qw(ordnumber quonumber cusordnumber shippingpoint shipvia notes intnotes transaction_description), }); } diff --git a/SL/DB/Manager/Project.pm b/SL/DB/Manager/Project.pm index 6c5563fe7..f6ff1271b 100644 --- a/SL/DB/Manager/Project.pm +++ b/SL/DB/Manager/Project.pm @@ -43,10 +43,11 @@ our @tables_with_project_id_cols = qw(acc_trans ap ar delivery_order_items deliv sub _sort_spec { return ( - default => [ 'projectnumber', 1 ], - columns => { - SIMPLE => 'ALL', - customer => 'customer.name', + default => [ 'projectnumber', 1 ], + columns => { + SIMPLE => 'ALL', + customer => 'customer.name', + project_type => 'project_type.description', }); } diff --git a/SL/DB/Manager/ProjectType.pm b/SL/DB/Manager/ProjectType.pm new file mode 100644 index 000000000..3fa990f71 --- /dev/null +++ b/SL/DB/Manager/ProjectType.pm @@ -0,0 +1,51 @@ +package SL::DB::Manager::ProjectType; + +use strict; + +use parent qw(SL::DB::Helper::Manager); + +use SL::DB::Helper::Paginated; +use SL::DB::Helper::Sorted; + +sub object_class { 'SL::DB::ProjectType' } + +__PACKAGE__->make_manager_methods; + +sub _sort_spec { + return ( + default => [ 'position', 1 ], + columns => { + SIMPLE => 'ALL', + description => 'lower(project_types.description)', + }); +} + +1; +__END__ + +=pod + +=encoding utf8 + +=head1 NAME + +SL::DB::Manager::ProjectType - Manager for models for the 'project_types' table + +=head1 SYNOPSIS + +This is a standard Rose::DB::Manager based model manager and can be +used as such. + +=head1 FUNCTIONS + +None yet. + +=head1 BUGS + +Nothing here yet. + +=head1 AUTHOR + +Moritz Bunkus Em.bunkus@linet-services.deE + +=cut diff --git a/SL/DB/MetaSetup/Project.pm b/SL/DB/MetaSetup/Project.pm index 4805568ab..0524fb679 100644 --- a/SL/DB/MetaSetup/Project.pm +++ b/SL/DB/MetaSetup/Project.pm @@ -9,15 +9,16 @@ use base qw(SL::DB::Object); __PACKAGE__->meta->table('project'); __PACKAGE__->meta->columns( - active => { type => 'boolean', default => 'true' }, - customer_id => { type => 'integer' }, - description => { type => 'text' }, - id => { type => 'integer', not_null => 1, sequence => 'id' }, - itime => { type => 'timestamp', default => 'now()' }, - mtime => { type => 'timestamp' }, - projectnumber => { type => 'text' }, - type => { type => 'text' }, - valid => { type => 'boolean', default => 'true' }, + active => { type => 'boolean', default => 'true' }, + customer_id => { type => 'integer' }, + description => { type => 'text' }, + id => { type => 'integer', not_null => 1, sequence => 'id' }, + itime => { type => 'timestamp', default => 'now()' }, + mtime => { type => 'timestamp' }, + project_type_id => { type => 'integer', not_null => 1 }, + projectnumber => { type => 'text' }, + type => { type => 'text' }, + valid => { type => 'boolean', default => 'true' }, ); __PACKAGE__->meta->primary_key_columns([ 'id' ]); @@ -31,6 +32,11 @@ __PACKAGE__->meta->foreign_keys( class => 'SL::DB::Customer', key_columns => { customer_id => 'id' }, }, + + project_type => { + class => 'SL::DB::ProjectType', + key_columns => { project_type_id => 'id' }, + }, ); 1; diff --git a/SL/DB/MetaSetup/ProjectType.pm b/SL/DB/MetaSetup/ProjectType.pm new file mode 100644 index 000000000..5608f291f --- /dev/null +++ b/SL/DB/MetaSetup/ProjectType.pm @@ -0,0 +1,22 @@ +# This file has been auto-generated. Do not modify it; it will be overwritten +# by rose_auto_create_model.pl automatically. +package SL::DB::ProjectType; + +use strict; + +use base qw(SL::DB::Object); + +__PACKAGE__->meta->setup( + table => 'project_types', + + columns => [ + id => { type => 'serial', not_null => 1 }, + position => { type => 'integer', not_null => 1 }, + description => { type => 'text' }, + ], + + primary_key_columns => [ 'id' ], +); + +1; +; diff --git a/SL/DB/ProjectType.pm b/SL/DB/ProjectType.pm new file mode 100644 index 000000000..6fec14818 --- /dev/null +++ b/SL/DB/ProjectType.pm @@ -0,0 +1,29 @@ +package SL::DB::ProjectType; + +use strict; + +use SL::DB::MetaSetup::ProjectType; +use SL::DB::Manager::ProjectType; + +use SL::DB::Helper::ActsAsList; + +__PACKAGE__->meta->add_relationship( + projects => { + type => 'many to one', + class => 'SL::DB::Project', + column_map => { id => 'project_type_id' }, + }, +); + +__PACKAGE__->meta->initialize; + +sub validate { + my ($self) = @_; + + my @errors; + push @errors, $::locale->text('The description is missing.') if !$self->description; + + return @errors; +} + +1; diff --git a/locale/de/all b/locale/de/all index dff08c875..710a92bbf 100755 --- a/locale/de/all +++ b/locale/de/all @@ -516,8 +516,10 @@ $self->{texts} = { 'Create a new payment term' => 'Neue Zahlungsbedingungen anlegen', 'Create a new printer' => 'Einen neuen Drucker anlegen', 'Create a new project' => 'Neues Projekt anlegen', + 'Create a new project type' => 'Einen neuen Projekttypen anlegen', 'Create a new user' => 'Einen neuen Benutzer anlegen', 'Create a new user group' => 'Eine neue Benutzergruppe erfassen', + 'Create a standard group' => 'Eine Standard-Benutzergruppe anlegen', 'Create and edit RFQs' => 'Lieferantenanfragen erfassen und bearbeiten', 'Create and edit dunnings' => 'Mahnungen erfassen und bearbeiten', 'Create and edit invoices and credit notes' => 'Rechnungen und Gutschriften erfassen und bearbeiten', @@ -544,6 +546,7 @@ $self->{texts} = { 'Create new department' => 'Neue Abteilung erfassen', 'Create new payment term' => 'Neue Zahlungsbedingung anlegen', 'Create new templates from master templates' => 'Neue Druckvorlagen aus Vorlagensatz erstellen', + 'Create new project type' => 'Neuen Projekttypen anlegen', 'Create tables' => 'Tabellen anlegen', 'Created by' => 'Erstellt von', 'Created for' => 'Erstellt für', @@ -852,6 +855,7 @@ $self->{texts} = { '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)', 'Edit project' => 'Projekt bearbeiten', 'Edit project #1' => 'Projekt #1 bearbeiten', + 'Edit project type' => 'Projekttypen bearbeiten', 'Edit templates' => 'Vorlagen bearbeiten', 'Edit the Delivery Order' => 'Lieferschein bearbeiten', 'Edit the configuration for periodic invoices' => 'Konfiguration für wiederkehrende Rechnungen bearbeiten', @@ -1394,6 +1398,7 @@ $self->{texts} = { 'No print templates have been created for this client yet. Please do so in the client configuration.' => 'Für diesen Mandanten wurden noch keine Druckvorlagen angelegt. Bitte holen Sie dies in der Mandantenkonfiguration nach.', 'No printers have been created yet.' => 'Es wurden noch keine Drucker angelegt.', 'No problems were recognized.' => 'Es wurden keine Probleme gefunden.', + 'No project type has been created yet.' => 'Es wurden noch keine Projekttypen angelegt.', 'No report with id #1' => 'Es gibt keinen Report mit der Id #1', 'No shipto selected to delete' => 'Keine Lieferadresse zum Löschen ausgewählt', 'No summary account' => 'Kein Sammelkonto', @@ -1662,6 +1667,8 @@ $self->{texts} = { 'Project Number' => 'Projektnummer', 'Project Numbers' => 'Projektnummern', 'Project Transactions' => 'Projektbuchungen', + 'Project Type' => 'Projekttyp', + 'Project Types' => 'Projekttypen', 'Project type' => 'Projekttyp', 'Projects' => 'Projekte', 'Projecttransactions' => 'Projektbuchungen', @@ -2211,6 +2218,10 @@ $self->{texts} = { 'The project is in use and cannot be deleted.' => 'Das Projekt ist in Verwendung und kann nicht gelöscht werden.', 'The project number is already in use.' => 'Die Projektnummer wird bereits verwendet.', 'The project number is missing.' => 'Die Projektnummer fehlt.', + 'The project type has been created.' => 'Der Projekttyp wurde angelegt.', + 'The project type has been deleted.' => 'Der Projekttyp wurde gelöscht.', + 'The project type has been saved.' => 'Der Projekttyp wurde gespeichert.', + 'The project type is in use and cannot be deleted.' => 'Der Projekttyp wird verwendet und kann nicht gelöscht werden.', 'The second reason is that kivitendo allowed the user to enter the tax amount manually regardless of the taxkey used.' => 'Der zweite Grund war, dass kivitendo zuließ, dass die Benutzer beliebige, von den tatsächlichen Steuerschlüsseln unabhängige Steuerbeträge eintrugen.', 'The second way is to use Perl\'s CPAN module and let it download and install the module for you.' => 'Die zweite Variante besteht darin, Perls CPAN-Modul zu benutzen und es das Modul für Sie installieren zu lassen.', 'The selected bank account does not exist anymore.' => 'Das ausgewählte Bankkonto existiert nicht mehr.', diff --git a/menus/erp.ini b/menus/erp.ini index c3793e636..a096dc6ef 100644 --- a/menus/erp.ini +++ b/menus/erp.ini @@ -581,6 +581,10 @@ action=Business/list module=am.pl action=list_lead +[System--Project Types] +module=controller.pl +action=ProjectType/list + [System--Languages and translations] module=menu.pl action=acc_menu diff --git a/sql/Pg-upgrade2/project_types.sql b/sql/Pg-upgrade2/project_types.sql new file mode 100644 index 000000000..7d2c319ad --- /dev/null +++ b/sql/Pg-upgrade2/project_types.sql @@ -0,0 +1,25 @@ +-- @tag: project_types +-- @description: Tabelle für Projekttypen +-- @depends: release_3_0_0 +-- @charset: utf-8 +CREATE TABLE project_types ( + id SERIAL, + position INTEGER NOT NULL, + description TEXT, + + PRIMARY KEY (id) +); + +INSERT INTO project_types (position, description) VALUES (1, 'Standard'); +INSERT INTO project_types (position, description) VALUES (2, 'Festpreis'); +INSERT INTO project_types (position, description) VALUES (3, 'Support'); + +ALTER TABLE project ADD COLUMN project_type_id INTEGER; +ALTER TABLE project ADD FOREIGN KEY (project_type_id) REFERENCES project_types (id); + +UPDATE project SET project_type_id = (SELECT id FROM project_types WHERE description = 'Festpreis') WHERE type = 'Festpreis'; +UPDATE project SET project_type_id = (SELECT id FROM project_types WHERE description = 'Support') WHERE type = 'Support'; +UPDATE project SET project_type_id = (SELECT id FROM project_types WHERE description = 'Standard') WHERE project_type_id IS NULL; + +ALTER TABLE project ALTER COLUMN project_type_id SET NOT NULL; +ALTER TABLE project DROP COLUMN type; diff --git a/templates/webpages/project/form.html b/templates/webpages/project/form.html index d243afd5a..9ec39e06f 100644 --- a/templates/webpages/project/form.html +++ b/templates/webpages/project/form.html @@ -42,8 +42,8 @@ - [% 'Type' | $T8 %] - [% L.input_tag('project.type', SELF.project.type, size=60) %] + [% 'Project Type' | $T8 %] + [% L.select_tag('project.project_type_id', ALL_PROJECT_TYPES, default=SELF.project.project_type_id, title_key='description', style='width: 300px') %] diff --git a/templates/webpages/project/search.html b/templates/webpages/project/search.html index 44bf0d850..1f3e33b3d 100644 --- a/templates/webpages/project/search.html +++ b/templates/webpages/project/search.html @@ -27,8 +27,8 @@ - [% 'Type' | $T8 %] - [% L.input_tag('filter.type:substr::ilike', filter.type_substr__ilike, size=20) %] + [% 'Project Type' | $T8 %] + [% L.select_tag('filter.project_type_id', ALL_PROJECT_TYPES, default=filter.project_type_id, title_key='description', with_empty=1) %] [% CUSTOM_VARIABLES_FILTER_CODE %] diff --git a/templates/webpages/project_type/form.html b/templates/webpages/project_type/form.html new file mode 100755 index 000000000..692cb4a1a --- /dev/null +++ b/templates/webpages/project_type/form.html @@ -0,0 +1,25 @@ +[% USE HTML %][% USE L %][% USE LxERP %] + +
+
[% FORM.title %]
+ +[%- INCLUDE 'common/flash.html' %] + + + + + + +
[% LxERP.t8('Description') %][% L.input_tag("project_type.description" SELF.project_type.description) %]
+ +

+ [% L.hidden_tag("id", SELF.project_type.id) %] + [% L.hidden_tag("action", "ProjectType/dispatch") %] + [% L.submit_tag("action_" _ (SELF.project_type.id ? 'update' : 'create'), LxERP.t8('Save')) %] + [%- IF SELF.project_type.id %] + [% L.submit_tag("action_destroy", LxERP.t8('Delete'), confirm=LxERP.t8('Do you really want to delete this object?')) %] + [%- END %] + [% LxERP.t8('Abort') %] +

+ +
diff --git a/templates/webpages/project_type/list.html b/templates/webpages/project_type/list.html new file mode 100644 index 000000000..fc45c0d1e --- /dev/null +++ b/templates/webpages/project_type/list.html @@ -0,0 +1,42 @@ +[% USE HTML %][% USE T8 %][% USE L %][% USE LxERP %] + +
[% FORM.title %]
+ +[%- INCLUDE 'common/flash.html' %] + +
+ [% IF !PROJECT_TYPES.size %] +

+ [%- 'No project type has been created yet.' | $T8 %] +

+ + [%- ELSE %] + + + + + + + + + + [%- FOREACH project_type = PROJECT_TYPES %] + + + + + [%- END %] + +
[ LxERP.t8('reorder item') %][%- 'Description' | $T8 %]
[ LxERP.t8('reorder item') %] + + [%- HTML.escape(project_type.description) %] + +
+ [%- END %] + +

+ [%- 'Create new project type' | $T8 %] +

+
+ + [% L.sortable_element('#project_type_list tbody', url => 'controller.pl?action=ProjectType/reorder', with => 'project_type_id') %]