From: Jan Büren Date: Tue, 21 Apr 2015 10:32:24 +0000 (+0200) Subject: Changelog für 3.2.x Brieffunktion erweitert X-Git-Tag: release-3.3.0beta~142 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=faea2c48e131611c827519cd0939dac3e43aada6;p=kivitendo-erp.git 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 --- diff --git a/SL/Common.pm b/SL/Common.pm index 33d4d41cf..bcaeb62c1 100644 --- a/SL/Common.pm +++ b/SL/Common.pm @@ -583,6 +583,8 @@ sub get_webdav_folder { ($path, $number) = ("einkaufslieferscheine", $form->{donumber}); } elsif ($form->{type} eq "credit_note") { ($path, $number) = ("gutschriften", $form->{invnumber}); + } elsif ($form->{type} eq "letter") { + ($path, $number) = ("briefe", $form->{letternumber} ); } elsif ($form->{vc} eq "customer") { ($path, $number) = ("rechnungen", $form->{invnumber}); } elsif ($form->{vc} eq "vendor") { @@ -610,7 +612,7 @@ sub copy_file_to_webdav_folder { # checks foreach my $item (qw(tmpdir tmpfile type)){ next if $form->{$item}; - $::lxdebug->message(LXDebug::WARN(), 'Missing parameter'); + $::lxdebug->message(LXDebug::WARN(), 'Missing parameter:' . $item); $::form->error($::locale->text("Missing parameter for WebDAV file copy")); } @@ -618,6 +620,7 @@ sub copy_file_to_webdav_folder { if (! $webdav_folder){ $::lxdebug->leave_sub(); + $::lxdebug->message(LXDebug::WARN(), 'Cannot check correct WebDAV folder'); $::form->error($::locale->text("Cannot check correct WebDAV folder")); return undef; } @@ -626,7 +629,7 @@ sub copy_file_to_webdav_folder { # maybe the path does not exist (automatic printing), see #2446 if (!-d $complete_path) { - # we need a chdir and restore old dir + # we need a chdir and restore old dir my $current_dir = POSIX::getcwd(); chdir("$form->{cwd}"); mkdir_with_parents($webdav_folder); diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl index e58457583..40d312362 100644 --- a/bin/mozilla/io.pl +++ b/bin/mozilla/io.pl @@ -1352,6 +1352,11 @@ sub print_form { $numberfld = $form->{type} =~ /^sales/ ? 'sdonumber' : 'pdonumber'; $form->{label} = $form->{formname} eq 'pick_list' ? $locale->text('Pick List') : $locale->text('Delivery Order'); } + if ($form->{type} =~ /letter/) { + undef $due; + undef $inv; + $form->{label} = $locale->text('Letter'); + } $form->{TEMPLATE_DRIVER_OPTIONS} = { }; if (any { $form->{type} eq $_ } qw(sales_quotation sales_order sales_delivery_order invoice request_quotation purchase_order purchase_delivery_order)) { @@ -1432,6 +1437,9 @@ sub print_form { DO->order_details(\%myconfig, \%$form); } elsif ($order) { OE->order_details(\%myconfig, \%$form); + } elsif ($form->{type} eq 'letter') { + # right now, no details are needed + # but i do not want to break the bad default (invoice) } else { IS->invoice_details(\%myconfig, \%$form, $locale); } diff --git a/bin/mozilla/letter.pl b/bin/mozilla/letter.pl index 172ea1b8a..d9a07423a 100755 --- a/bin/mozilla/letter.pl +++ b/bin/mozilla/letter.pl @@ -21,6 +21,8 @@ use SL::DB::Contact; use SL::DB::Default; use SL::Helper::CreatePDF; use SL::Helper::Flash; +use SL::Common; +use Cwd; require "bin/mozilla/reportgenerator.pl"; require "bin/mozilla/io.pl"; require "bin/mozilla/arap.pl"; @@ -376,6 +378,12 @@ sub print_letter { die( t8('Please create/copy a template named letter.tex in your client template dir') ) unless (-e $tex_templates); $pdf_file_name = SL::Helper::CreatePDF->create_pdf(%create_params); + + # set some form defaults for printing webdav copy variables + $form->{tmpfile} = $pdf_file_name; + $form->{tmpdir} = 'users'; + $form->{type} = 'letter'; + $form->{cwd} = getcwd(); if ( $::form->{media} eq 'email') { my $mail = Mailer->new; my $signature = $::myconfig{signature}; @@ -387,14 +395,15 @@ sub print_letter { $mail->{message} .= "\n-- \n$signature"; $mail->{message} =~ s/\r//g; + # copy_file_to_webdav was already done via io.pl -> edit_e_mail my $err = $mail->send; -# TODO -# $self -# ->js -# ->flash($err?'error':'info', -# $err?t8('A mail error occurred: #1', $err): -# t8('The document have been sent to \'#1\'.', $mail->{to})) -# ->render($self); + # TODO + # $self + # ->js + # ->flash($err?'error':'info', + # $err?t8('A mail error occurred: #1', $err): + # t8('The document have been sent to \'#1\'.', $mail->{to})) + # ->render($self); return $err?0:1; } @@ -412,6 +421,7 @@ sub print_letter { $::locale->with_raw_io(\*STDOUT, sub { print while <$file> }); $file->close; + Common::copy_file_to_webdav_folder($form) if $::instance_conf->get_webdav_documents; unlink $pdf_file_name; return 1; } @@ -423,6 +433,7 @@ sub print_letter { binmode $out; print $out scalar(read_file($pdf_file_name)); close $out; + Common::copy_file_to_webdav_folder($form) if $::instance_conf->get_webdav_documents; flash_later('info', t8('The documents have been sent to the printer \'#1\'.', $printer->printer_description)); my $callback = build_std_url('letter.pl', 'action=edit', 'id=' . $letter->{id}, 'printer_id'); @@ -495,6 +506,7 @@ sub e_mail { $letter->check_number; $letter->save; + $form->{formname} = "letter"; $letter->export_to($::form); $::form->{id} = $letter->{id}; diff --git a/doc/changelog b/doc/changelog index 6e6789e04..19290121a 100644 --- a/doc/changelog +++ b/doc/changelog @@ -2,6 +2,15 @@ # Veränderungen von kivitendo # ############################### +2015-0x-xx - Release 3.2.2-unstable + + +Kleinere neue Features und Detailverbesserungen: + +- Briefe werden auch im WebDAV archiviert. Ferner bessere Fehlerbehandlung und + E-Mail-Funktion aktiviert. + + 2015-04-10 - Release 3.2.1 Dies ist ein Unstable Bugfix-Release für die 3.2. D.h. es wurden ein paar diff --git a/templates/webpages/letter/edit.html b/templates/webpages/letter/edit.html index 39aa7373f..bf91648d6 100644 --- a/templates/webpages/letter/edit.html +++ b/templates/webpages/letter/edit.html @@ -184,8 +184,12 @@ - - + +[%- IF letter.letternumber %] + + +[% END %] +