--- /dev/null
+package SL::Controller::RequirementSpecPredefinedText;
+
+use strict;
+
+use parent qw(SL::Controller::Base);
+
+use SL::DB::RequirementSpecPredefinedText;
+use SL::DB::Language;
+use SL::Helper::Flash;
+use SL::Locale::String;
+
+use Rose::Object::MakeMethods::Generic
+(
+ scalar => [ qw(requirement_spec_predefined_text) ],
+);
+
+__PACKAGE__->run_before('check_auth');
+__PACKAGE__->run_before('load_requirement_spec_predefined_text', only => [ qw(edit update destroy) ]);
+
+#
+# actions
+#
+
+sub action_list {
+ my ($self) = @_;
+
+ $self->render('requirement_spec_predefined_text/list',
+ title => t8('Predefined Texts'),
+ REQUIREMENT_SPEC_PREDEFINED_TEXTS => SL::DB::Manager::RequirementSpecPredefinedText->get_all_sorted);
+}
+
+sub action_new {
+ my ($self) = @_;
+
+ $self->{requirement_spec_predefined_text} = SL::DB::RequirementSpecPredefinedText->new;
+ $self->render('requirement_spec_predefined_text/form', title => t8('Create a new predefined text'));
+}
+
+sub action_edit {
+ my ($self) = @_;
+ $self->render('requirement_spec_predefined_text/form', title => t8('Edit predefined text'));
+}
+
+sub action_create {
+ my ($self) = @_;
+
+ $self->{requirement_spec_predefined_text} = SL::DB::RequirementSpecPredefinedText->new;
+ $self->create_or_update;
+}
+
+sub action_update {
+ my ($self) = @_;
+ $self->create_or_update;
+}
+
+sub action_destroy {
+ my ($self) = @_;
+
+ if (eval { $self->{requirement_spec_predefined_text}->delete; 1; }) {
+ flash_later('info', t8('The predefined text has been deleted.'));
+ } else {
+ flash_later('error', t8('The predefined text is in use and cannot be deleted.'));
+ }
+
+ $self->redirect_to(action => 'list');
+}
+
+sub action_reorder {
+ my ($self) = @_;
+
+ SL::DB::RequirementSpecPredefinedText->reorder_list(@{ $::form->{requirement_spec_predefined_text_id} || [] });
+
+ $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->{requirement_spec_predefined_text}->id;
+ my $params = delete($::form->{requirement_spec_predefined_text}) || { };
+ my $title = $is_new ? t8('Create a new predefined text') : t8('Edit predefined text');
+
+ $self->{requirement_spec_predefined_text}->assign_attributes(%{ $params });
+
+ my @errors = $self->{requirement_spec_predefined_text}->validate;
+
+ if (@errors) {
+ flash('error', @errors);
+ $self->render('requirement_spec_predefined_text/form', title => $title);
+ return;
+ }
+
+ $self->{requirement_spec_predefined_text}->save;
+
+ flash_later('info', $is_new ? t8('The predefined text has been created.') : t8('The predefined text has been saved.'));
+ $self->redirect_to(action => 'list');
+}
+
+sub load_requirement_spec_predefined_text {
+ my ($self) = @_;
+ $self->{requirement_spec_predefined_text} = SL::DB::RequirementSpecPredefinedText->new(id => $::form->{id})->load;
+}
+
+1;
my ($self) = @_;
my @errors;
- push @errors, t8('The title is missing.') if !$self->title;
- push @errors, t8('The description is missing.') if !$self->description;
+ push @errors, t8('The description is missing.') if !$self->description;
+ push @errors, t8('The description is not unique.') if $self->get_first_conflicting('description');
+ push @errors, t8('The title is missing.') if !$self->title;
return @errors;
}
'Contact person (surname)' => 'Ansprechperson (Nachname)',
'Contact persons' => 'Ansprechpersonen',
'Contacts' => 'Ansprechpersonen',
+ 'Content' => 'Inhalt',
'Continue' => 'Weiter',
'Contra' => 'gegen',
'Conversion of "birthday" contact person attribute' => 'Umstellung des Kontaktpersonenfeldes "Geburtstag"',
'Create a new group' => 'Neue Benutzergruppe erfassen',
'Create a new payment term' => 'Neue Zahlungsbedingungen anlegen',
'Create a new printer' => 'Einen neuen Drucker anlegen',
+ 'Create a new predefined text' => 'Einen neuen vordefinierten Textblock anlegen',
'Create a new project' => 'Neues Projekt anlegen',
'Create a new project type' => 'Einen neuen Projekttypen anlegen',
'Create a new requirement spec status' => 'Einen neuen Pflichtenheftstatus anlegen',
'Edit greetings' => 'Anreden bearbeiten',
'Edit note' => 'Notiz bearbeiten',
'Edit payment term' => 'Zahlungsbedingungen bearbeiten',
+ 'Edit predefined text' => 'Vordefinierten Textblock bearbeiten',
'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',
'No or an unknown authenticantion module specified in "config/kivitendo.conf".' => 'Es wurde kein oder ein unbekanntes Authentifizierungsmodul in "config/kivitendo.conf" angegeben.',
'No part was found matching the search parameters.' => 'Es wurde kein Artikel gefunden, auf den die Suchparameter zutreffen.',
'No payment term has been created yet.' => 'Es wurden noch keine Zahlungsbedingungen angelegt.',
+ 'No predefined texts has been created yet.' => 'Es wurden noch keine vordefinierten Textblöcken angelegt.',
'No prices will be updated because no prices have been entered.' => 'Es werden keine Preise aktualisiert, weil keine gültigen Preisänderungen eingegeben wurden.',
'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.',
'Postscript' => 'Postscript',
'Posustva_coa' => 'USTVA Kennz.',
'Pre-defined Texts' => 'Vordefinierte Textblöcke',
+ 'Predefined Texts' => 'Vordefinierte Textblöcke',
'Preferences' => 'Einstellungen',
'Preferences saved!' => 'Einstellungen gespeichert!',
'Prefix for the new bins\' names' => 'Namenspräfix für die neuen Lagerplätze',
'The payment term has been saved.' => 'Die Zahlungsbedingungen wurden gespeichert.',
'The payment term is in use and cannot be deleted.' => 'Die Zahlungsbedingungen werden bereits benutzt und können nicht gelöscht werden.',
'The payments have been posted.' => 'Die Zahlungen wurden gebucht.',
+ 'The predefined text has been created.' => 'Der vordefinierte Textblock wurde angelegt.',
+ 'The predefined text has been deleted.' => 'Der vordefinierte Textblock wurde gelöscht.',
+ 'The predefined text has been saved.' => 'Der vordefinierte Textblock wurde gespeichert.',
+ 'The predefined text is in use and cannot be deleted.' => 'Der vordefinierte Textblock wird verwendet und kann nicht gelöscht werden.',
'The preferred one is to install packages provided by your operating system distribution (e.g. Debian or RPM packages).' => 'Die bevorzugte Art, ein Perl-Modul zu installieren, ist durch Installation eines von Ihrem Betriebssystem zur Verfügung gestellten Paketes (z.B. Debian-Pakete oder RPM).',
'The printer could not be deleted.' => 'Der Drucker konnte nicht gelöscht werden.',
'The printer has been created.' => 'Der Drucker wurde angelegt.',
--- /dev/null
+[% USE HTML %][% USE L %][% USE LxERP %]
+
+ <form method="post" action="controller.pl">
+ <div class="listtop">[% FORM.title %]</div>
+
+[%- INCLUDE 'common/flash.html' %]
+
+ <table>
+ <tr>
+ <td>[% LxERP.t8("Description") %]</sup></td>
+ <td>[% L.input_tag("requirement_spec_predefined_text.description", SELF.requirement_spec_predefined_text.description, size=60) %]</td>
+ </tr>
+
+ <tr>
+ <td>[% LxERP.t8("Title") %]</sup></td>
+ <td>[% L.input_tag("requirement_spec_predefined_text.title", SELF.requirement_spec_predefined_text.title, size=60) %]</td>
+ </tr>
+
+ <tr>
+ <td>[% LxERP.t8("Content") %]</td>
+ <td>[% L.textarea_tag("requirement_spec_predefined_text.text", SELF.requirement_spec_predefined_text.text, rows=10, cols=80) %]</td>
+ </tr>
+ </table>
+
+ <p>
+ [% L.hidden_tag("id", SELF.requirement_spec_predefined_text.id) %]
+ [% L.hidden_tag("action", "RequirementSpecPredefinedText/dispatch") %]
+ [% L.submit_tag("action_" _ (SELF.requirement_spec_predefined_text.id ? "update" : "create"), LxERP.t8('Save')) %]
+ [%- IF SELF.requirement_spec_predefined_text.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>
+ </form>
--- /dev/null
+[% USE HTML %][% USE L %][% USE LxERP %]
+
+ <div class="listtop">[% FORM.title %]</div>
+
+[%- INCLUDE 'common/flash.html' %]
+
+ <form method="post" action="controller.pl">
+ [% IF !REQUIREMENT_SPEC_PREDEFINED_TEXTS.size %]
+ <p>
+ [%- LxERP.t8('No predefined texts has been created yet.') %]
+ </p>
+
+ [%- ELSE %]
+ <table id="requirement_spec_predefined_text_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("Title") %]</th>
+ <th>[% LxERP.t8("Content") %]</th>
+ </tr>
+ </thead>
+
+ <tbody>
+ [%- FOREACH requirement_spec_predefined_text = REQUIREMENT_SPEC_PREDEFINED_TEXTS %]
+ <tr class="listrow[% loop.count % 2 %]" id="requirement_spec_predefined_text_id_[% requirement_spec_predefined_text.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_predefined_text.id) %]">
+ [%- HTML.escape(requirement_spec_predefined_text.description) -%]
+ </a>
+ </td>
+
+ <td>[% HTML.escape(requirement_spec_predefined_text.title) %]</td>
+ <td>[% HTML.escape(L.truncate(requirement_spec_predefined_text.text)) %]</td>
+ </tr>
+ [%- END %]
+ </tbody>
+ </table>
+ [%- END %]
+
+ <p>
+ <a href="[% SELF.url_for(action => 'new') %]">[%- LxERP.t8("Create a new predefined text") %]</a>
+ </p>
+ </form>
+
+ [% L.sortable_element('#requirement_spec_predefined_text_list tbody', url => 'controller.pl?action=RequirementSpecPredefinedText/reorder', with => 'requirement_spec_predefined_text_id') %]