Revision d98b10d9
Von Moritz Bunkus vor etwa 8 Jahren hinzugefügt
SL/Controller/RequirementSpecType.pm | ||
---|---|---|
package SL::Controller::RequirementSpecType;
|
||
|
||
use strict;
|
||
|
||
use parent qw(SL::Controller::Base);
|
||
|
||
use SL::DB::RequirementSpecType;
|
||
use SL::Helper::Flash;
|
||
use SL::Locale::String;
|
||
|
||
use Rose::Object::MakeMethods::Generic
|
||
(
|
||
scalar => [ qw(requirement_spec_type) ],
|
||
);
|
||
|
||
__PACKAGE__->run_before('check_auth');
|
||
__PACKAGE__->run_before('load_requirement_spec_type', only => [ qw(edit update destroy) ]);
|
||
|
||
#
|
||
# actions
|
||
#
|
||
|
||
sub action_list {
|
||
my ($self) = @_;
|
||
|
||
$self->render('requirement_spec_type/list',
|
||
title => t8('Requirement Spec Types'),
|
||
REQUIREMENT_SPEC_TYPES => SL::DB::Manager::RequirementSpecType->get_all_sorted);
|
||
}
|
||
|
||
sub action_new {
|
||
my ($self) = @_;
|
||
|
||
$self->{requirement_spec_type} = SL::DB::RequirementSpecType->new(template_file_name => 'requirement_spec');
|
||
$self->render('requirement_spec_type/form', title => t8('Create a new requirement spec type'));
|
||
}
|
||
|
||
sub action_edit {
|
||
my ($self) = @_;
|
||
$self->render('requirement_spec_type/form', title => t8('Edit requirement spec type'));
|
||
}
|
||
|
||
sub action_create {
|
||
my ($self) = @_;
|
||
|
||
$self->{requirement_spec_type} = SL::DB::RequirementSpecType->new;
|
||
$self->create_or_update;
|
||
}
|
||
|
||
sub action_update {
|
||
my ($self) = @_;
|
||
$self->create_or_update;
|
||
}
|
||
|
||
sub action_destroy {
|
||
my ($self) = @_;
|
||
|
||
if (eval { $self->{requirement_spec_type}->delete; 1; }) {
|
||
flash_later('info', t8('The requirement spec type has been deleted.'));
|
||
} else {
|
||
flash_later('error', t8('The requirement spec type is in use and cannot be deleted.'));
|
||
}
|
||
|
||
$self->redirect_to(action => 'list');
|
||
}
|
||
|
||
sub action_reorder {
|
||
my ($self) = @_;
|
||
|
||
SL::DB::RequirementSpecType->reorder_list(@{ $::form->{requirement_spec_type_id} || [] });
|
||
|
||
$self->render(\'', { type => 'json' });
|
||
}
|
||
|
||
#
|
||
# filters
|
||
#
|
||
|
||
sub check_auth {
|
||
$::auth->assert('config');
|
||
}
|
||
|
||
#
|
||
# helpers
|
||
#
|
||
|
||
sub create_or_update {
|
||
my $self = shift;
|
||
my $is_new = !$self->{requirement_spec_type}->id;
|
||
my $params = delete($::form->{requirement_spec_type}) || { };
|
||
my $title = $is_new ? t8('Create a new requirement spec type') : t8('Edit requirement spec type');
|
||
|
||
$self->{requirement_spec_type}->assign_attributes(%{ $params });
|
||
|
||
my @errors = $self->{requirement_spec_type}->validate;
|
||
|
||
if (@errors) {
|
||
flash('error', @errors);
|
||
$self->render('requirement_spec_type/form', title => $title);
|
||
return;
|
||
}
|
||
|
||
$self->{requirement_spec_type}->save;
|
||
|
||
flash_later('info', $is_new ? t8('The requirement spec type has been created.') : t8('The requirement spec type has been saved.'));
|
||
$self->redirect_to(action => 'list');
|
||
}
|
||
|
||
sub load_requirement_spec_type {
|
||
my ($self) = @_;
|
||
$self->{requirement_spec_type} = SL::DB::RequirementSpecType->new(id => $::form->{id})->load;
|
||
}
|
||
|
||
1;
|
SL/Controller/SimpleSystemSetting.pm | ||
---|---|---|
],
|
||
},
|
||
|
||
requirement_spec_type => {
|
||
# Make locales.pl happy: $self->render("simple_system_setting/_requirement_spec_type_form")
|
||
class => 'RequirementSpecType',
|
||
titles => {
|
||
list => t8('Requirement Spec Types'),
|
||
add => t8('Add requirement spec type'),
|
||
edit => t8('Edit requirement spec type'),
|
||
},
|
||
list_attributes => [
|
||
{ method => 'description', title => t8('Description') },
|
||
{ method => 'section_number_format', title => t8('Section number format') },
|
||
{ method => 'function_block_number_format', title => t8('Function block number format') },
|
||
],
|
||
},
|
||
|
||
);
|
||
|
||
my @default_list_attributes = (
|
locale/de/all | ||
---|---|---|
'Add pricegroup' => 'Preisgruppe hinzufügen',
|
||
'Add project status' => 'Projektstatus hinzufügen',
|
||
'Add project type' => 'Projekttypen hinzufügen',
|
||
'Add requirement spec type' => 'Pflichtenhefttypen hinzufügen',
|
||
'Add section' => 'Abschnitt hinzufügen',
|
||
'Add sub function block' => 'Unterfunktionsblock hinzufügen',
|
||
'Add taxzone' => 'Steuerzone hinzufügen',
|
||
... | ... | |
'Create a new requirement spec' => 'Ein neues Pflichtenheft anlegen',
|
||
'Create a new requirement spec status' => 'Einen neuen Pflichtenheftstatus anlegen',
|
||
'Create a new requirement spec template' => 'Eine neue Pflichtenheftvorlage erfassen',
|
||
'Create a new requirement spec type' => 'Einen neuen Pflichtenhefttypen anlegen',
|
||
'Create a new risk level' => 'Einen neuen Risikograd anlegen',
|
||
'Create a new sales price rule' => 'Neue Verkaufspreisregel anlegen',
|
||
'Create a new user' => 'Einen neuen Benutzer anlegen',
|
||
... | ... | |
'No report with id #1' => 'Es gibt keinen Report mit der Id #1',
|
||
'No requirement spec statuses has been created yet.' => 'Es wurden noch keine Pflichtenheftstatus angelegt.',
|
||
'No requirement spec templates have been created yet.' => 'Es wurden noch keine Pflichtenheftvorlagen angelegt.',
|
||
'No requirement spec type has been created yet.' => 'Es wurden noch keine Pflichtenhefttypen angelegt.',
|
||
'No results.' => 'Keine Artikel',
|
||
'No revert available.' => 'Dieser Vorgang kann nicht rückgängig gemacht werden, ggf. falsch erstellte Buchungen müssen einzeln manuell korrigiert werden.',
|
||
'No risks level has been created yet.' => 'Es wurden noch keine Risikograde angelegt.',
|
||
... | ... | |
'The requirement spec status has been saved.' => 'Der Pflichtenheftstatus wurde gespeichert.',
|
||
'The requirement spec status is in use and cannot be deleted.' => 'Der Pflichtenheftstatus wird verwendet und kann nicht gelöscht werden.',
|
||
'The requirement spec template has been saved.' => 'Die Pflichtenheftvorlage wurde gespeichert.',
|
||
'The requirement spec type has been created.' => 'Der Pflichtenhefttyp wurde angelegt.',
|
||
'The requirement spec type has been deleted.' => 'Der Pflichtenhefttyp wurde gelöscht.',
|
||
'The requirement spec type has been saved.' => 'Der Pflichtenhefttyp wurde gespeichert.',
|
||
'The requirement spec type is in use and cannot be deleted.' => 'Der Pflichtenhefttyp wird verwendet und kann nicht gelöscht werden.',
|
||
'The risk level has been created.' => 'Der Risikograd wurde angelegt.',
|
||
'The risk level has been deleted.' => 'Der Risikograd wurde gelöscht.',
|
||
'The risk level has been saved.' => 'Der Risikograd wurde gespeichert.',
|
menus/user/00-erp.yaml | ||
---|---|---|
name: Requirement Spec Types
|
||
order: 200
|
||
params:
|
||
action: RequirementSpecType/list
|
||
action: SimpleSystemSetting/list
|
||
type: requirement_spec_type
|
||
- parent: system_requirement_specs
|
||
id: system_requirement_specs_requirement_spec_statuses
|
||
name: Requirement Spec Statuses
|
templates/webpages/requirement_spec_type/form.html | ||
---|---|---|
[% USE HTML %][% USE L %][% USE LxERP %]
|
||
<h1>[% FORM.title %]</h1>
|
||
|
||
<form method="post" action="controller.pl">
|
||
|
||
[%- INCLUDE 'common/flash.html' %]
|
||
|
||
<table>
|
||
<tr>
|
||
<td>[% LxERP.t8('Description') %]</td>
|
||
<td>[% L.input_tag("requirement_spec_type.description", SELF.requirement_spec_type.description) %]</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td>[% LxERP.t8('Print template base file name') %]<sup>(1)</sup></td>
|
||
<td>[% L.input_tag("requirement_spec_type.template_file_name", SELF.requirement_spec_type.template_file_name) %]</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td>[% LxERP.t8('Section number format') %]<sup>(2)</sup></td>
|
||
<td>[% L.input_tag("requirement_spec_type.section_number_format", SELF.requirement_spec_type.section_number_format, size="15") %]</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td>[% LxERP.t8('Function block number format') %]<sup>(2)</sup></td>
|
||
<td>[% L.input_tag("requirement_spec_type.function_block_number_format", SELF.requirement_spec_type.function_block_number_format, size="15") %]</td>
|
||
</tr>
|
||
</table>
|
||
|
||
<p>
|
||
[% L.hidden_tag("id", SELF.requirement_spec_type.id) %]
|
||
[% L.hidden_tag("action", "RequirementSpecType/dispatch") %]
|
||
[% L.submit_tag("action_" _ (SELF.requirement_spec_type.id ? "update" : "create"), LxERP.t8('Save')) %]
|
||
[%- IF SELF.requirement_spec_type.id %]
|
||
[% L.submit_tag("action_destroy", LxERP.t8('Delete'), confirm=LxERP.t8('Do you really want to delete this object?')) %]
|
||
[%- END %]
|
||
<a href="[% SELF.url_for(action => 'list') %]">[%- LxERP.t8('Abort') %]</a>
|
||
</p>
|
||
|
||
<p>
|
||
<sup>(1)</sup>: [% LxERP.t8("The base file name without a path or an extension to be used for printing for this type of requirement spec.") %]
|
||
<br>
|
||
<sup>(2)</sup>: [% LxERP.t8('The numbering will start at 1 with each requirement spec.') %]
|
||
</p>
|
||
</form>
|
templates/webpages/requirement_spec_type/list.html | ||
---|---|---|
[% USE HTML %][% USE L %][% USE LxERP %]
|
||
<h1>[% FORM.title %]</h1>
|
||
|
||
[%- INCLUDE 'common/flash.html' %]
|
||
|
||
<form method="post" action="controller.pl">
|
||
[% IF !REQUIREMENT_SPEC_TYPES.size %]
|
||
<p>
|
||
[%- LxERP.t8('No requirement spec type has been created yet.') %]
|
||
</p>
|
||
|
||
[%- ELSE %]
|
||
<table id="requirement_spec_type_list">
|
||
<thead>
|
||
<tr class="listheading">
|
||
<th align="center"><img src="image/updown.png" alt="[%- LxERP.t8('reorder item') %]"></th>
|
||
<th>[%- LxERP.t8('Description') %]</th>
|
||
<th>[%- LxERP.t8('Section number format') %]</th>
|
||
<th>[%- LxERP.t8('Function block number format') %]</th>
|
||
</tr>
|
||
</thead>
|
||
|
||
<tbody>
|
||
[%- FOREACH requirement_spec_type = REQUIREMENT_SPEC_TYPES %]
|
||
<tr class="listrow[% loop.count % 2 %]" id="requirement_spec_type_id_[% requirement_spec_type.id %]">
|
||
<td align="center" class="dragdrop"><img src="image/updown.png" alt="[%- LxERP.t8('reorder item') %]"></td>
|
||
<td>
|
||
<a href="[% SELF.url_for(action => 'edit', id => requirement_spec_type.id) %]">
|
||
[%- HTML.escape(requirement_spec_type.description) %]
|
||
</a>
|
||
</td>
|
||
|
||
<td>[% HTML.escape(requirement_spec_type.section_number_format) %]</td>
|
||
<td>[% HTML.escape(requirement_spec_type.function_block_number_format) %]</td>
|
||
</tr>
|
||
[%- END %]
|
||
</tbody>
|
||
</table>
|
||
[%- END %]
|
||
|
||
<p>
|
||
<a href="[% SELF.url_for(action => 'new') %]">[%- LxERP.t8('Create a new requirement spec type') %]</a>
|
||
</p>
|
||
</form>
|
||
|
||
[% L.sortable_element('#requirement_spec_type_list tbody', url => 'controller.pl?action=RequirementSpecType/reorder', with => 'requirement_spec_type_id') %]
|
templates/webpages/simple_system_setting/_requirement_spec_type_form.html | ||
---|---|---|
[% USE HTML %][% USE L %][% USE LxERP %]
|
||
<table>
|
||
<tr>
|
||
<th align="right">[% LxERP.t8("Description") %]</th>
|
||
<td>[% L.input_tag("object.description", SELF.object.description, "data-validate"="required", "data-title"=LxERP.t8("Description")) %]</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<th align="right">[% LxERP.t8("Print template base file name") %]<sup>(1)</sup></th>
|
||
<td>[% L.input_tag("object.template_file_name", SELF.object.template_file_name, "data-validate"="required", "data-title"=LxERP.t8("Print template base file name")) %]</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<th align="right">[% LxERP.t8("Section number format") %]<sup>(2)</sup></th>
|
||
<td>[% L.input_tag("object.section_number_format", SELF.object.section_number_format, size="15", "data-validate"="required", "data-title"=LxERP.t8("Section number format")) %]</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<th align="right">[% LxERP.t8("Function block number format") %]<sup>(2)</sup></th>
|
||
<td>[% L.input_tag("object.function_block_number_format", SELF.object.function_block_number_format, size="15", "data-validate"="required", "data-title"=LxERP.t8("Function block number format")) %]</td>
|
||
</tr>
|
||
</table>
|
||
|
||
<p>
|
||
<sup>(1)</sup>: [% LxERP.t8("The base file name without a path or an extension to be used for printing for this type of requirement spec.") %]
|
||
<br>
|
||
<sup>(2)</sup>: [% LxERP.t8("The numbering will start at 1 with each requirement spec.") %]
|
||
</p>
|
Auch abrufbar als: Unified diff
SimpleSystemSetting: Umstellung von »Pflichtenhefte« → »Pflichtenhefttypen«