From: Moritz Bunkus Date: Fri, 13 Jan 2017 13:00:42 +0000 (+0100) Subject: ActionBar: Verwendung bei Briefen X-Git-Tag: release-3.5.4~1320 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=6d9d1fbf6d9478ab95144ce5d95300bd2ae46be8;p=kivitendo-erp.git ActionBar: Verwendung bei Briefen --- diff --git a/SL/Controller/Letter.pm b/SL/Controller/Letter.pm index cfc1f6867..69e2bdf43 100644 --- a/SL/Controller/Letter.pm +++ b/SL/Controller/Letter.pm @@ -171,11 +171,12 @@ sub action_delete_letter_drafts { sub action_list { my ($self, %params) = @_; + $self->setup_list_action_bar; $self->make_filter_summary; $self->prepare_report; my $letters = $self->models->get; - $self->report_generator_list_objects(report => $self->{report}, objects => $letters); + $self->report_generator_list_objects(report => $self->{report}, objects => $letters, action_bar => 1); } @@ -323,12 +324,13 @@ sub action_edit_email { email => $letter->contact ? $letter->contact->cp_email : '', subject => $::form->generate_email_subject, a_filename => $::form->generate_attachment_filename, - action => 'Letter/send_email', HIDDEN => \@hiddens, SHOW_BCC => $::auth->assert('email_bcc', 'may fail'), ); - $self->render('generic/edit_email', %vars); + $::request->layout->use_javascript("kivi.SalesPurchase.js"); + $self->setup_edit_email_action_bar; + $self->render('letter/edit_email', %vars); } sub action_send_email { @@ -348,7 +350,7 @@ sub action_send_email { sub _display { my ($self, %params) = @_; - $::request->{layout}->use_javascript("${_}.js") for qw(ckeditor/ckeditor ckeditor/adapters/jquery); + $::request->{layout}->use_javascript("${_}.js") for qw(ckeditor/ckeditor ckeditor/adapters/jquery kivi.Letter); my $letter = $self->letter; @@ -364,6 +366,7 @@ sub _display { $::form->{languages} ||= SL::DB::Manager::Language->get_all_sorted; $::form->{printers} = SL::DB::Manager::Printer->get_all_sorted; + $self->setup_display_action_bar; $self->render('letter/edit', %params, TCF => [ map { key => $_, value => t8(ucfirst $_) }, TEXT_CREATED_FOR_VALUES() ], @@ -416,7 +419,6 @@ sub prepare_report { std_column_visibility => 1, controller_class => 'Letter', output_format => 'HTML', - top_info_text => t8('Letters'), title => t8('Letters'), allow_pdf_export => 1, allow_csv_export => 1, @@ -485,6 +487,7 @@ sub load_letter_draft { return unless @$letter_drafts; + $self->setup_load_letter_draft_action_bar; $self->render('letter/load_drafts', title => t8('Letter Draft'), LETTER_DRAFTS => $letter_drafts, @@ -634,6 +637,106 @@ sub check_auth_report { $::auth->assert('sales_letter_report'); } +sub setup_load_letter_draft_action_bar { + my ($self, %params) = @_; + + for my $bar ($::request->layout->get('actionbar')) { + $bar->add( + link => [ + t8('Skip'), + link => $self->url_for(action => 'skip_draft', is_sales => $self->is_sales), + accesskey => 'enter', + ], + action => [ + t8('Delete'), + submit => [ '#form', { action => 'delete_drafts' } ], + checks => [ [ 'kivi.check_if_entries_selected', '[name="ids[+]"]' ] ], + confirm => t8('Do you really want to delete this draft?'), + ], + ); + } +} + +sub setup_display_action_bar { + my ($self, %params) = @_; + + for my $bar ($::request->layout->get('actionbar')) { + $bar->add( + action => [ + t8('Update'), + submit => [ '#form', { action => 'Letter/update' } ], + accesskey => 'enter', + ], + + combobox => [ + action => [ + t8('Save'), + submit => [ '#form', { action => 'Letter/save' } ], + ], + action => [ + t8('Save Draft'), + submit => [ '#form', { action => 'Letter/save_letter_draft' } ], + ], + ], # end of combobox "Save" + + action => [ + t8('Delete'), + submit => [ '#form', { action => 'Letter/delete' } ], + confirm => t8('Are you sure you want to delete this letter?'), + disabled => !$self->letter->id ? t8('The object has not been saved yet.') : undef, + ], + + combobox => [ + action => [ t8('Export') ], + action => [ + t8('Print'), + submit => [ '#form', { action => 'Letter/print_letter' } ], + disabled => !$self->letter->id ? t8('The object has not been saved yet.') : undef, + ], + action => [ + t8('E-mail'), + submit => [ '#form', { action => 'Letter/edit_email' } ], + disabled => !$self->letter->id ? t8('The object has not been saved yet.') : undef, + ], + ], + ); + } +} + +sub setup_edit_email_action_bar { + my ($self, %params) = @_; + + for my $bar ($::request->layout->get('actionbar')) { + $bar->add( + action => [ + t8('Continue'), + submit => [ '#form', { action => 'Letter/send_email' } ], + checks => [ 'kivi.SalesPurchase.check_required_email_fields' ], + accesskey => 'enter', + ], + ); + } +} + +sub setup_list_action_bar { + my ($self, %params) = @_; + + for my $bar ($::request->layout->get('actionbar')) { + $bar->add( + action => [ + t8('Search'), + submit => [ '#form', { action => 'Letter/list' } ], + checks => [ 'kivi.SalesPurchase.check_required_email_fields' ], + accesskey => 'enter', + ], + action => [ + t8('Reset'), + call => [ 'kivi.call_jquery', '#form', 'resetForm' ], + ], + ); + } +} + 1; __END__ diff --git a/js/kivi.Letter.js b/js/kivi.Letter.js new file mode 100644 index 000000000..1f2865cd6 --- /dev/null +++ b/js/kivi.Letter.js @@ -0,0 +1,11 @@ +namespace('kivi.Letter', function(ns) { + "use strict"; + + $(function() { + $('#letter_customer_id,#letter_vendor_id').change(function(){ + var data = $('form').serializeArray(); + data.push({ name: 'action', value: 'Letter/update_contacts' }); + $.post('controller.pl', data, kivi.eval_json_result); + }); + }); +}); diff --git a/js/kivi.SalesPurchase.js b/js/kivi.SalesPurchase.js index 3eae14e94..5dc81f50c 100644 --- a/js/kivi.SalesPurchase.js +++ b/js/kivi.SalesPurchase.js @@ -224,17 +224,23 @@ namespace('kivi.SalesPurchase', function(ns) { }; // Sending records via email. - this.send_email = function() { + this.check_required_email_fields = function() { var unset = $('#email_form_to,#email_form_subject,#email_form_message').filter(function(idx, elt) { return $(elt).val() === ''; }); - if (unset.length > 0) { - alert(kivi.t8("The recipient, subject or body is missing.")); - $(unset[0]).focus(); + if (unset.length === 0) + return true; + + alert(kivi.t8("The recipient, subject or body is missing.")); + $(unset[0]).focus(); + + return false; + }; + this.send_email = function() { + if (!kivi.SalesPurchase.check_required_email_fields()) return false; - } $('#send_email_dialog').children().remove().appendTo('#email_inputs'); $('#send_email_dialog').dialog('close'); diff --git a/locale/de/all b/locale/de/all index 551a651b3..a078d2476 100755 --- a/locale/de/all +++ b/locale/de/all @@ -771,7 +771,6 @@ $self->{texts} = { 'Customer' => 'Kunde', 'Customer (database ID)' => 'Kunde (Datenbank-ID)', 'Customer (name)' => 'Kunde (Name)', - 'Customer Attachments' => 'Anhänge des Kunden', 'Customer Discount' => 'Kundenrabatt', 'Customer Master Data' => 'Kundenstammdaten', 'Customer Name' => 'Kundenname', @@ -901,7 +900,6 @@ $self->{texts} = { 'Delete Images' => 'Bilder löschen', 'Delete Shipto' => 'Lieferadresse löschen', 'Delete all' => 'Alle Löschen', - 'Delete drafts' => 'Entwürfe löschen', 'Delete links' => 'Verknüpfungen löschen', 'Delete picture' => 'Bild löschen', 'Delete printfiles' => 'Dokumente löschen', @@ -1728,7 +1726,6 @@ $self->{texts} = { 'Make (vendor\'s database ID, number or name; with X being a number)' => 'Lieferant (Datenbank-ID, Nummer oder Name des Lieferanten; X ist eine fortlaufende Zahl)', 'Make compatible for import' => 'Für den Import kompatibel machen', 'Make default profile' => 'Zu Standardprofil machen', - 'Make new document' => 'Erzeuge ein neue Datei', 'Makemodel Price' => 'Lieferantenpreis', 'Manage Custom Variables' => 'Benutzerdefinierte Variablen', 'Mandantennummer' => 'Mandantennummer', @@ -1858,7 +1855,6 @@ $self->{texts} = { 'No delievery orders selected, please set one checkbox!' => 'Kein Lieferschein selektiert, bitte eine Box anklicken!', 'No delivery orders have been selected.' => 'Es wurden keine Lieferscheine ausgewählt.', 'No delivery term has been created yet.' => 'Es wurden noch keine Lieferbedingungen angelegt', - 'No document' => 'Kein Datei mitschicken (ggf. Anhänge)', 'No dunnings have been selected for printing.' => 'Es wurden keine Mahnungen zum Drucken ausgewählt.', 'No end date given, setting to today' => 'Kein Enddatum gegeben, setze Enddatum auf heute', 'No entries have been imported yet.' => 'Es wurden noch keine Einträge importiert.', @@ -2052,7 +2048,6 @@ $self->{texts} = { 'Part "#1" has chargenumber or best before date set. So it cannot be transfered automatically.' => 'Bei Artikel "#1" ist eine Chargenummer oder ein Mindesthaltbarkeitsdatum vergeben. Deshalb kann dieser Artikel nicht automatisch ausgelagert werden.', 'Part (database ID)' => 'Artikel (Datenbank-ID)', 'Part (typeabbreviation)' => 'W', - 'Part Attachments' => 'Anhänge der Artikel', 'Part Classification' => 'Artikel-Klassifizierung', 'Part Description' => 'Artikelbeschreibung', 'Part Description missing!' => 'Artikelbezeichnung fehlt!', @@ -3761,7 +3756,6 @@ $self->{texts} = { 'only OB Transactions' => 'nur EB-Buchungen', 'open' => 'Offen', 'order' => 'Reihenfolge', - 'other Document Attachments' => 'Weitere Dateianhänge', 'our vendor number at customer' => 'Unsere Lieferanten-Nr. beim Kunden', 'parsing csv' => 'Parse CSV Daten', 'part' => 'Ware', @@ -3851,7 +3845,6 @@ $self->{texts} = { 'unnamed record template' => 'unbenannte Belegvorlage', 'until' => 'bis', 'uploaded' => 'Hochgeladen', - 'use actual document' => 'Verwende aktuelle Datei', 'use program settings' => 'benutze Programmeinstellungen', 'use user config' => 'Verwende Benutzereinstellung', 'used' => 'Verbraucht', diff --git a/templates/webpages/generic/edit_email.html b/templates/webpages/generic/edit_email.html deleted file mode 100644 index e3b03ac1e..000000000 --- a/templates/webpages/generic/edit_email.html +++ /dev/null @@ -1,172 +0,0 @@ -[%- USE T8 %] -[%- USE HTML %][%- USE LxERP -%][%- USE L -%] -

[% title %]

- -
- - - - -[%- IF INSTANCE_CONF.get_doc_storage %] - -[%- ELSE %] - -[%- END %] - - - - - - - - - - - - -
- - - - - - - - - - -[%- IF SHOW_BCC %] - - - - -[%- END %] - - - - - - - - -
[% 'To' | $T8 %][% L.input_tag('email', email, size=30, class=(email ? '' : 'initial_focus')) %]
[% 'Cc' | $T8 %]
[% 'Bcc' | $T8 %]
[% 'Subject' | $T8 %][% L.input_tag('subject', subject, size=30, class=(email ? 'initial_focus' : '')) %]
[% 'Attachment name' | $T8 %]
-
- -[%- USE ATT_it = Iterator(FILES) %] -[% FOREACH file = ATT_it %] -[% END %] -[%- IF ATT_it.size > 0 %] - - - - - - - - - - - [% FOREACH file = ATT_it %] - - - - [% END %] -[%- END %] -[%- USE ATT_it = Iterator(VC_FILES) %] -[% FOREACH file = ATT_it %] -[% END %] -[%- IF ATT_it.size > 0 %] - - - - - - - - - - - [% FOREACH file = ATT_it %] - - - - [% END %] -[%- END %] -[%- USE ATT_it = Iterator(PART_FILES) %] -[%- SET lastpartid = '' %] -[%- FOREACH file = ATT_it %] -[%- END %] -[%- IF ATT_it.size > 0 %] - - - - - - - - - - [% FOREACH file = ATT_it %] - [%- IF lastpartid != file.trans_id %] - [%- SET lastpartid = file.trans_id %][%- SET partname = file.partname %] - - [%- ELSE %][%- SET partname = '' %][% END %] - - - - - [% END %] -[%- END %] -
[% LxERP.t8('other Document Attachments') %]
[% LxERP.t8('Filename') %]

[% file.file_name %] - -

- - [% LxERP.t8('Customer Attachments') %] -
[% LxERP.t8('Filename') %]

[% file.file_name %] - -

- - [% LxERP.t8('Part Attachments') %] -
[% LxERP.t8('Part Number') %][% LxERP.t8('Filename') %]

[% partname %][% file.file_name %] - -
-
-
- - - - - - - - -
[% 'Message' | $T8 %]
-
- -[% print_options %] -[% FOREACH row = HIDDEN %] -[% END %] - -

- -[% L.hidden_tag('action', action) %] - -
-[% L.submit_tag('action_newfile', LxERP.t8('Make new document'), onclick="return check_prerequisites();") %] -[%- IF has_document %] -[% L.submit_tag('action_oldfile', LxERP.t8('use actual document'), onclick="return check_prerequisites();") %] -[%- END %] -[% L.submit_tag('action_nofile', LxERP.t8('No document'), onclick="return check_prerequisites();") %] -
- - diff --git a/templates/webpages/letter/edit.html b/templates/webpages/letter/edit.html index cbd331e1a..a31d3913e 100644 --- a/templates/webpages/letter/edit.html +++ b/templates/webpages/letter/edit.html @@ -6,7 +6,7 @@ [%- SET WEBDAV = SELF.webdav_objects %]

[% title | html %]

-
+ @@ -149,33 +149,4 @@ [%- LxERP.t8("Loading...") %] - - - - -[%- IF letter.letternumber %] - - -[% END %] - - -[% L.submit_tag('action_delete', LxERP.t8('Delete'), confirm=LxERP.t8('Are you sure you want to delete this letter?')) %] - -
- - - diff --git a/templates/webpages/letter/load_drafts.html b/templates/webpages/letter/load_drafts.html index 9b9d490f6..088defa36 100644 --- a/templates/webpages/letter/load_drafts.html +++ b/templates/webpages/letter/load_drafts.html @@ -2,7 +2,8 @@ [%- USE HTML %][%- USE L -%]

[% 'Load letter draft' | $T8 %]

-
+ + [% L.hidden_tag('is_sales', SELF.is_sales) %]

[% 'The following drafts have been saved and can be loaded.' | $T8 %]

@@ -36,13 +37,5 @@
- - - - [% L.hidden_tag('is_sales', SELF.is_sales) %] - - - -
diff --git a/templates/webpages/letter/report_top.html b/templates/webpages/letter/report_top.html index b5ad9a531..dbbeda3ed 100644 --- a/templates/webpages/letter/report_top.html +++ b/templates/webpages/letter/report_top.html @@ -1,4 +1,2 @@ [%- PROCESS 'letter/search.html' filter=SELF.models.filtered.laundered %]
- - diff --git a/templates/webpages/letter/search.html b/templates/webpages/letter/search.html index 0e8f0c87a..4ae49823e 100644 --- a/templates/webpages/letter/search.html +++ b/templates/webpages/letter/search.html @@ -2,7 +2,7 @@ [% USE T8 %] [% USE L %] [% USE LxERP %] -
+
[% 'Show Filter' | $T8 %] @@ -55,10 +55,6 @@ [% L.hidden_tag('sort_by', FORM.sort_by) %] [% L.hidden_tag('sort_dir', FORM.sort_dir) %] [% L.hidden_tag('page', FORM.page) %] - [% L.hidden_tag('action', 'Letter/dispatch') %] - [% L.submit_tag('action_list', LxERP.t8('Continue')) %] - -[% 'Reset' | $T8 %]