X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/101b9705bda052abb1237c92d3920f6ddbf12d04..b8741ec3:/bin/mozilla/gl.pl diff --git a/bin/mozilla/gl.pl b/bin/mozilla/gl.pl index fc8a162e6..14a58b4a6 100644 --- a/bin/mozilla/gl.pl +++ b/bin/mozilla/gl.pl @@ -48,6 +48,7 @@ use SL::ReportGenerator; use SL::DBUtils qw(selectrow_query selectall_hashref_query); use SL::Webdav; use SL::Locale::String qw(t8); +use SL::Helper::GlAttachments qw(count_gl_attachments); require "bin/mozilla/common.pl"; require "bin/mozilla/reportgenerator.pl"; @@ -95,6 +96,7 @@ sub load_record_template { $template->substitute_variables; # Clean the current $::form before rebuilding it from the template. + my $form_defaults = delete $::form->{form_defaults}; delete @{ $::form }{ grep { !m{^(?:script|login)$}i } keys %{ $::form } }; my $dummy_form = {}; @@ -137,6 +139,8 @@ sub load_record_template { $::form->{"${_}_${row}"} = $item->$_ for qw(source memo project_id); } + $::form->{$_} = $form_defaults->{$_} for keys %{ $form_defaults // {} }; + flash('info', $::locale->text("The record template '#1' has been loaded.", $template->template_name)); update( @@ -411,7 +415,7 @@ sub generate_report { my @columns = qw( gldate transdate id reference description - notes source debit debit_accno + notes source doccnt debit debit_accno credit credit_accno debit_tax debit_tax_accno credit_tax credit_tax_accno projectnumbers balance employee ); @@ -451,6 +455,7 @@ sub generate_report { $form->{l_datesort} = 'Y'; $form->{l_debit_tax_accno} = 'Y'; $form->{l_balance} = $form->{accno} ? 'Y' : ''; + $form->{l_doccnt} = $form->{l_source} ? 'Y' : ''; my %column_defs = ( 'id' => { 'text' => $locale->text('ID'), }, @@ -458,6 +463,7 @@ sub generate_report { 'gldate' => { 'text' => $locale->text('Booking Date'), }, 'reference' => { 'text' => $locale->text('Reference'), }, 'source' => { 'text' => $locale->text('Source'), }, + 'doccnt' => { 'text' => $locale->text('Document Count'), }, 'description' => { 'text' => $locale->text('Description'), }, 'notes' => { 'text' => $locale->text('Notes'), }, 'debit' => { 'text' => $locale->text('Debit'), }, @@ -493,7 +499,8 @@ sub generate_report { $report->set_columns(%column_defs); $report->set_column_order(@columns); - $report->set_export_options('generate_report', @hidden_variables, qw(sort sortdir)); + $form->{l_attachments} = 'Y'; + $report->set_export_options('generate_report', @hidden_variables, qw(sort sortdir l_attachments)); $report->set_sort_indicator($form->{sort} eq 'accno' ? 'debit_accno' : $form->{sort}, $form->{sortdir}); @@ -542,6 +549,10 @@ sub generate_report { my $row = { }; map { $row->{$_} = { 'data' => '', 'align' => $column_alignment{$_} } } @columns; + if ( $form->{l_doccnt} ) { + $row->{doccnt}->{data} = SL::Helper::GlAttachments->count_gl_pdf_attachments($ref->{id},$ref->{type}); + } + my $sh = ""; if ($form->{balance} < 0) { $sh = " S";