Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision e5f53eb5

Von Moritz Bunkus vor etwa 4 Jahren hinzugefügt

  • ID e5f53eb5c67c19d6a356fcde22ca46169cdca5dc
  • Vorgänger cf0455f5
  • Nachfolger 333003d3

ZUGFeRD: allgemeine Notizen für alle Rechnungen in Übersetzungen anlegen können

Unterschiede anzeigen:

SL/DB/Helper/ZUGFeRD.pm
6 6
use parent qw(Exporter);
7 7
our @EXPORT = qw(create_zugferd_data create_zugferd_xmp_data);
8 8

  
9
use SL::DB::GenericTranslation;
9 10
use SL::DB::Tax;
10 11
use SL::DB::TaxKey;
11 12
use SL::Helper::ISO3166;
......
15 16
use Carp;
16 17
use Encode qw(encode);
17 18
use List::MoreUtils qw(pairwise);
18
use List::Util qw(sum);
19
use List::Util qw(first sum);
19 20
use Template;
20 21
use XML::Writer;
21 22

  
......
308 309
  #   </rsm:ExchangedDocumentContext>
309 310
}
310 311

  
312
sub _included_note {
313
  my ($self, %params) = @_;
314

  
315
  $params{xml}->startTag("ram:IncludedNote");
316
  $params{xml}->dataElement("ram:Content", _u8($params{note}));
317
  $params{xml}->endTag;
318
}
319

  
311 320
sub _exchanged_document {
312 321
  my ($self, %params) = @_;
313 322

  
......
328 337
    $params{xml}->dataElement("ram:LanguageID", uc($1));
329 338
  }
330 339

  
331
  if ($self->transaction_description) {
332
    $params{xml}->startTag("ram:IncludedNote");
333
    $params{xml}->dataElement("ram:Content", _u8($self->transaction_description));
334
    $params{xml}->endTag;
335
  }
340
  my $std_notes = SL::DB::Manager::GenericTranslation->get_all(
341
    where => [
342
      translation_type => 'ZUGFeRD/notes',
343
      or               => [
344
        language_id    => undef,
345
        language_id    => $self->language_id,
346
      ],
347
      '!translation'   => undef,
348
      '!translation'   => '',
349
    ],
350
  );
351

  
352
  my $std_note = first { $_->language_id == $self->language_id } @{ $std_notes };
353
  $std_note  //= first { !defined $_->language_id }              @{ $std_notes };
336 354

  
337 355
  my $notes = $self->notes_as_stripped_html;
338
  if ($notes) {
339
    $params{xml}->startTag("ram:IncludedNote");
340
    $params{xml}->dataElement("ram:Content", _u8($notes));
341
    $params{xml}->endTag;
342
  }
356

  
357
  _included_note($self, %params, note => $self->transaction_description) if $self->transaction_description;
358
  _included_note($self, %params, note => $notes)                         if $notes;
359
  _included_note($self, %params, note => $std_note->translation)         if $std_note;
343 360

  
344 361
  $params{xml}->endTag;
345 362
  #   </rsm:ExchangedDocument>
bin/mozilla/generictranslations.pl
210 210
  $main::lxdebug->leave_sub();
211 211
}
212 212

  
213
sub edit_zugferd_notes {
214
  $::auth->assert('config');
215

  
216
  $::form->get_lists('languages' => 'LANGUAGES');
217

  
218
  my $translation_list = GenericTranslations->list(translation_type => 'ZUGFeRD/notes');
219
  my %translations     = map { ( ($_->{language_id} || 'default') => $_->{translation} ) } @{ $translation_list };
220

  
221
  unshift @{ $::form->{LANGUAGES} }, { 'id' => 'default', };
222

  
223
  foreach my $language (@{ $::form->{LANGUAGES} }) {
224
    $language->{translation} = $translations{$language->{id}};
225
  }
226

  
227
  setup_generictranslations_edit_zugferd_notes_action_bar();
228

  
229
  $::form->{title} = $::locale->text('Edit ZUGFeRD notes');
230
  $::form->header;
231
  print $::form->parse_html_template('generictranslations/edit_zugferd_notes');
232
}
233

  
234
sub save_zugferd_notes {
235
  $::auth->assert('config');
236

  
237
  $::form->get_lists('languages' => 'LANGUAGES');
238

  
239
  unshift @{ $::form->{LANGUAGES} }, { };
240

  
241
  foreach my $language (@{ $::form->{LANGUAGES} }) {
242
    GenericTranslations->save(
243
      translation_type => 'ZUGFeRD/notes',
244
      translation_id   => undef,
245
      language_id      => $language->{id},
246
      translation      => $::form->{"translation__" . ($language->{id} || 'default')},
247
    );
248
  }
249

  
250
  $::form->{message} = $::locale->text('The ZUGFeRD notes have been saved.');
251

  
252
  edit_zugferd_notes();
253
}
254

  
213 255
sub setup_generictranslations_edit_greetings_action_bar {
214 256
  my %params = @_;
215 257

  
......
237 279
    );
238 280
  }
239 281
}
282

  
240 283
sub setup_generictranslations_edit_email_strings_action_bar {
241 284
  my %params = @_;
242 285

  
......
251 294
  }
252 295
}
253 296

  
297
sub setup_generictranslations_edit_zugferd_notes_action_bar {
298
  my %params = @_;
299

  
300
  for my $bar ($::request->layout->get('actionbar')) {
301
    $bar->add(
302
      action => [
303
        t8('Save'),
304
        submit    => [ '#form', { action => "save_zugferd_notes" } ],
305
        accesskey => 'enter',
306
      ],
307
    );
308
  }
309
}
310

  
254 311
1;
locale/de/all
1177 1177
  'Edit Vendor'                 => 'Lieferant editieren',
1178 1178
  'Edit Vendor Invoice'         => 'Einkaufsrechnung bearbeiten',
1179 1179
  'Edit Warehouse'              => 'Lager bearbeiten',
1180
  'Edit ZUGFeRD notes'          => 'ZUGFeRD-Notizen bearbeiten',
1180 1181
  'Edit acceptance status'      => 'Abnahmestatus bearbeiten',
1181 1182
  'Edit additional articles'    => 'Zusätzliche Artikel bearbeiten',
1182 1183
  'Edit all drafts'             => 'Entwürfe von allen Benutzern bearbeiten',
......
3183 3184
  'The SQL query does not contain any parameter that need to be configured.' => 'Die SQL-Abfrage enthält keine Parameter, die angegeben werden müssten.',
3184 3185
  'The URL is missing.'         => 'URL fehlt',
3185 3186
  'The WebDAV feature has been used.' => 'Das WebDAV-Feature wurde benutzt.',
3187
  'The ZUGFeRD notes have been saved.' => 'Die ZUGFeRD-Notizen wurden gespeichert.',
3186 3188
  'The abbreviation is missing.' => 'Abkürzung fehlt',
3187 3189
  'The access rights a user has within a client instance is still governed by his group membership.' => 'Welche Zugriffsrechte ein Benutzer innerhalb eines Mandanten hat, wird weiterhin über Gruppenmitgliedschaften geregelt.',
3188 3190
  'The access rights have been saved.' => 'Die Zugriffsrechte wurden gespeichert.',
......
3979 3981
  'Your import is being processed.' => 'Ihr Import wird verarbeitet',
3980 3982
  'Your target quantity will be added to the stocked quantity.' => 'Ihre gezählte Zielmenge wird zum Lagerbestand hinzugezählt.',
3981 3983
  'ZUGFeRD invoice'             => 'ZUGFeRD-Rechnung',
3984
  'ZUGFeRD notes for each invoice' => 'ZUGFeRD-Notizen für jede Rechnung',
3982 3985
  'Zeitraum'                    => 'Zeitraum',
3983 3986
  'Zero amount posting!'        => 'Buchung ohne Wert',
3984 3987
  'Zip'                         => 'PLZ',
menus/user/00-erp.yaml
1252 1252
  module: generictranslations.pl
1253 1253
  params:
1254 1254
    action: edit_sepa_strings
1255
- parent: system_languages_and_translations
1256
  id: system_languages_and_translations_zugferd_notes
1257
  name: ZUGFeRD notes for each invoice
1258
  order: 450
1259
  module: generictranslations.pl
1260
  params:
1261
    action: edit_zugferd_notes
1255 1262
- parent: system_languages_and_translations
1256 1263
  id: system_languages_and_translations_email_strings
1257 1264
  name: Preset email strings
templates/webpages/generictranslations/edit_zugferd_notes.html
1
[%- USE T8 %]
2
[%- USE HTML %]
3
<h1>[% HTML.escape(title) %]</h1>
4

  
5
 [%- IF message %]
6
 <p>
7
  [% HTML.escape(message) %]
8
 </p>
9
 [%- END %]
10

  
11
 <form method="post" action="generictranslations.pl" id="form">
12

  
13
  <table>
14

  
15
   <tr>
16
    <th class="listheading">&nbsp;</th>
17
    <th class="listheading">[% 'ZUGFeRD notes for each invoice' | $T8 %]</th>
18
   </tr>
19

  
20
   [%- FOREACH language = LANGUAGES %]
21
   <tr>
22
    <td>
23
     [%- IF language.id == 'default' %]
24
     [% 'Default (no language selected)' | $T8 %]
25
     [%- ELSE %]
26
     [%- HTML.escape(language.description) %]
27
     [%- END %]
28
    </td>
29
    <td><input name="translation__[% language.id %]" size="40" value="[% HTML.escape(language.translation) %]"></td>
30
   </tr>
31
   [%- END %]
32
  </table>
33
 </form>

Auch abrufbar als: Unified diff