Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision faea2c48

Von Jan Büren vor mehr als 9 Jahren hinzugefügt

  • ID faea2c48e131611c827519cd0939dac3e43aada6
  • Vorgänger fb902c0a
  • Nachfolger 978a03de

Changelog für 3.2.x Brieffunktion erweitert

Brief: Immer erst speichern, bevor man ausdruckt / mailt

Klare Benutzerführung. Ist notwendig, wenn man die WebDAV-Archivierung
konsistent haben will (da hier letternumber benötigt wird).

Erweiterung Common.pm um Briefarchivierung in WebDAV

Besseres Debbugging in copy_file_to_webdav und neuen
Dokumententyp in get_webdav_folder (welche hässlich ist)

Anpassungen für Brief in io.pl für E-Mail-Versand

... alles so gelassen wie es war, bloss nichts kaputt machen und mit
minimalen fußabdrücken wieder raus aus diesem teil der stadt ...

Erweiterung Brieffunktion um WebDAV-Archivierung

Unterschiede anzeigen:

SL/Common.pm
583 583
    ($path, $number) = ("einkaufslieferscheine", $form->{donumber});
584 584
  } elsif ($form->{type} eq "credit_note") {
585 585
    ($path, $number) = ("gutschriften", $form->{invnumber});
586
  } elsif ($form->{type} eq "letter") {
587
    ($path, $number) = ("briefe", $form->{letternumber} );
586 588
  } elsif ($form->{vc} eq "customer") {
587 589
    ($path, $number) = ("rechnungen", $form->{invnumber});
588 590
  } elsif ($form->{vc} eq "vendor") {
......
610 612
  # checks
611 613
  foreach my $item (qw(tmpdir tmpfile type)){
612 614
    next if $form->{$item};
613
    $::lxdebug->message(LXDebug::WARN(), 'Missing parameter');
615
    $::lxdebug->message(LXDebug::WARN(), 'Missing parameter:' . $item);
614 616
    $::form->error($::locale->text("Missing parameter for WebDAV file copy"));
615 617
  }
616 618

  
......
618 620

  
619 621
  if (! $webdav_folder){
620 622
    $::lxdebug->leave_sub();
623
    $::lxdebug->message(LXDebug::WARN(), 'Cannot check correct WebDAV folder');
621 624
    $::form->error($::locale->text("Cannot check correct WebDAV folder"));
622 625
    return undef;
623 626
  }
......
626 629

  
627 630
  # maybe the path does not exist (automatic printing), see #2446
628 631
  if (!-d $complete_path) {
629
    # we need a chdir and  restore old dir
632
    # we need a chdir and restore old dir
630 633
    my $current_dir = POSIX::getcwd();
631 634
    chdir("$form->{cwd}");
632 635
    mkdir_with_parents($webdav_folder);
bin/mozilla/io.pl
1352 1352
    $numberfld            = $form->{type} =~ /^sales/ ? 'sdonumber' : 'pdonumber';
1353 1353
    $form->{label}        = $form->{formname} eq 'pick_list' ? $locale->text('Pick List') : $locale->text('Delivery Order');
1354 1354
  }
1355
  if ($form->{type} =~ /letter/) {
1356
    undef $due;
1357
    undef $inv;
1358
    $form->{label}        = $locale->text('Letter');
1359
  }
1355 1360

  
1356 1361
  $form->{TEMPLATE_DRIVER_OPTIONS} = { };
1357 1362
  if (any { $form->{type} eq $_ } qw(sales_quotation sales_order sales_delivery_order invoice request_quotation purchase_order purchase_delivery_order)) {
......
1432 1437
    DO->order_details(\%myconfig, \%$form);
1433 1438
  } elsif ($order) {
1434 1439
    OE->order_details(\%myconfig, \%$form);
1440
  } elsif ($form->{type} eq 'letter') {
1441
    # right now, no details are needed
1442
    # but i do not want to break the bad default (invoice)
1435 1443
  } else {
1436 1444
    IS->invoice_details(\%myconfig, \%$form, $locale);
1437 1445
  }
bin/mozilla/letter.pl
21 21
use SL::DB::Default;
22 22
use SL::Helper::CreatePDF;
23 23
use SL::Helper::Flash;
24
use SL::Common;
25
use Cwd;
24 26
require "bin/mozilla/reportgenerator.pl";
25 27
require "bin/mozilla/io.pl";
26 28
require "bin/mozilla/arap.pl";
......
376 378
    die( t8('Please create/copy a template named letter.tex in your client template dir') ) unless (-e $tex_templates);
377 379

  
378 380
    $pdf_file_name = SL::Helper::CreatePDF->create_pdf(%create_params);
381

  
382
    # set some form defaults for printing webdav copy variables
383
    $form->{tmpfile} = $pdf_file_name;
384
    $form->{tmpdir} = 'users';
385
    $form->{type} = 'letter';
386
    $form->{cwd}        = getcwd();
379 387
    if ( $::form->{media} eq 'email') {
380 388
      my $mail             = Mailer->new;
381 389
      my $signature        = $::myconfig{signature};
......
387 395
      $mail->{message}    .=  "\n-- \n$signature";
388 396
      $mail->{message}     =~ s/\r//g;
389 397

  
398
      # copy_file_to_webdav was already done via io.pl -> edit_e_mail
390 399
      my $err = $mail->send;
391
# TODO
392
#       $self
393
#           ->js
394
#           ->flash($err?'error':'info',
395
#                   $err?t8('A mail error occurred: #1', $err):
396
#                        t8('The document have been sent to \'#1\'.', $mail->{to}))
397
#           ->render($self);
400
      # TODO
401
      #       $self
402
      #           ->js
403
      #           ->flash($err?'error':'info',
404
      #                   $err?t8('A mail error occurred: #1', $err):
405
      #                        t8('The document have been sent to \'#1\'.', $mail->{to}))
406
      #           ->render($self);
398 407
      return $err?0:1;
399 408
    }
400 409

  
......
412 421

  
413 422
      $::locale->with_raw_io(\*STDOUT, sub { print while <$file> });
414 423
      $file->close;
424
      Common::copy_file_to_webdav_folder($form) if $::instance_conf->get_webdav_documents;
415 425
      unlink $pdf_file_name;
416 426
      return 1;
417 427
    }
......
423 433
    binmode $out;
424 434
    print $out scalar(read_file($pdf_file_name));
425 435
    close $out;
436
    Common::copy_file_to_webdav_folder($form) if $::instance_conf->get_webdav_documents;
426 437

  
427 438
    flash_later('info', t8('The documents have been sent to the printer \'#1\'.', $printer->printer_description));
428 439
    my $callback = build_std_url('letter.pl', 'action=edit', 'id=' . $letter->{id}, 'printer_id');
......
495 506
  $letter->check_number;
496 507
  $letter->save;
497 508

  
509
  $form->{formname} = "letter";
498 510
  $letter->export_to($::form);
499 511

  
500 512
  $::form->{id} = $letter->{id};
doc/changelog
2 2
# Veränderungen von kivitendo #
3 3
###############################
4 4

  
5
2015-0x-xx - Release 3.2.2-unstable
6

  
7

  
8
Kleinere neue Features und Detailverbesserungen:
9

  
10
- Briefe werden auch im WebDAV archiviert. Ferner bessere Fehlerbehandlung und
11
  E-Mail-Funktion aktiviert.
12

  
13

  
5 14
2015-04-10 - Release 3.2.1
6 15

  
7 16
Dies ist ein Unstable Bugfix-Release für die 3.2. D.h. es wurden ein paar
templates/webpages/letter/edit.html
184 184

  
185 185
<input type="hidden" name="action" value="dispatcher">
186 186
<input class="submit" type="submit" name="action_update" id="update_button" value="[% 'Update' | $T8 %]">
187
<input class="submit" type="submit" name="action_print" value="[% 'Print' | $T8 %]">
188
<input class="submit" type="submit" name="action_e_mail" value="[% 'E-mail' | $T8 %]">
187

  
188
[%- IF letter.letternumber %]
189
  <input class="submit" type="submit" name="action_print" value="[% 'Print' | $T8 %]">
190
  <input class="submit" type="submit" name="action_e_mail" value="[% 'E-mail' | $T8 %]">
191
[% END %]
192

  
189 193
<input class="submit" type="submit" name="action_save" value="[% 'Save' | $T8 %]">
190 194
<input class="submit" type="submit" name="action_save_letter_draft" value="[% 'Save Draft' | $T8 %]">
191 195

  

Auch abrufbar als: Unified diff