Typos beim entfernen von setupPoints/setupDateFormat
[kivitendo-erp.git] / bin / mozilla / gl.pl
index b422829..d54dc70 100644 (file)
@@ -217,12 +217,10 @@ sub search {
   $::form->all_departments(\%::myconfig);
   $::form->get_lists(
     projects  => { key => "ALL_PROJECTS", all => 1 },
-    employees => "ALL_EMPLOYEES",
   );
+  $::form->{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all(query => [ deleted => 0 ]);
 
-  my $onload = "focus()"
-             . qq|;setupDateFormat('|. $::myconfig{dateformat} . qq|', '| . $::locale->text("Falsches Datumsformat!") . qq|')|
-             . qq|;setupPoints('|. $::myconfig{numberformat} .   qq|', '| . $::locale->text("wrongformat") . qq|')|;
+  my $onload = "focus()";
 
   $::form->header;
   print $::form->parse_html_template('gl/search', {
@@ -466,7 +464,7 @@ sub generate_report {
 
     my $row_set = [ $row ];
 
-    if (($form->{l_subtotal} eq 'Y')
+    if ( ($form->{l_subtotal} eq 'Y' && !$form->{report_generator_csv_options_for_import} )
         && (($idx == (scalar @{ $form->{GL} } - 1))
             || ($ref->{ $form->{sort} } ne $form->{GL}->[$idx + 1]->{ $form->{sort} }))) {
       push @{ $row_set }, create_subtotal_row(\%subtotals, \@columns, \%column_alignment, [ qw(debit credit) ], 'listsubtotal');
@@ -477,8 +475,6 @@ sub generate_report {
     $idx++;
   }
 
-  $report->add_separator();
-
   # = 0 for balanced ledger
   my $balanced_ledger = $totals{debit} + $totals{debit_tax} - $totals{credit} - $totals{credit_tax};
 
@@ -497,7 +493,10 @@ sub generate_report {
 
   $row->{balance}->{data}        = $data;
 
-  $report->add_data($row);
+  if ( !$form->{report_generator_csv_options_for_import} ) {
+    $report->add_separator();
+    $report->add_data($row);
+  }
 
   my $raw_bottom_info_text;
 
@@ -897,99 +896,25 @@ sub form_header {
 }
 
 sub form_footer {
-  $main::lxdebug->enter_sub();
-
-  $main::auth->assert('general_ledger');
-
-  my $form     = $main::form;
-  my %myconfig = %main::myconfig;
-  my $locale   = $main::locale;
-  my $cgi      = $::request->{cgi};
-
-  my $follow_ups_block;
-  if ($form->{id}) {
-    my $follow_ups = FU->follow_ups('trans_id' => $form->{id});
-
-    if (@{ $follow_ups} ) {
-      my $num_due       = sum map { $_->{due} * 1 } @{ $follow_ups };
-      $follow_ups_block = qq|<p>| . $locale->text("There are #1 unfinished follow-ups of which #2 are due.", scalar @{ $follow_ups }, $num_due) . qq|</p>|;
-    }
-  }
-
-  my ($dec) = ($form->{totaldebit} =~ /\.(\d+)/);
-  $dec = length $dec;
-  my $decimalplaces = ($dec > 2) ? $dec : 2;
-  my $radieren = ($form->current_date(\%myconfig) eq $form->{gldate}) ? 1 : 0;
-
-  map {
-    $form->{$_} = $form->format_amount(\%myconfig, $form->{$_}, 2, "&nbsp;")
-  } qw(totaldebit totalcredit);
-
-  print qq|
-    <tr class=listtotal>
-    <th colspan="3" align=right class=listtotal> $form->{totaldebit}</th>
-    <th align=right class=listtotal> $form->{totalcredit}</th>
-    <td colspan=6></td>
-    </tr>
-  </table>
-  </td>
-  </tr>
-</table>
-
-<input name=callback type=hidden value="$form->{callback}">
-
-$follow_ups_block
-
-<br>
-|;
-
-  my $transdate = $form->datetonum($form->{transdate}, \%myconfig);
-  my $closedto  = $form->datetonum($form->{closedto},  \%myconfig);
-
-  if ($form->{id}) {
-
-    if (!$form->{storno}) {
-      print qq|<input class=submit type=submit name=action value="| . $locale->text('Storno') . qq|">|;
-    }
-
-    # Löschen und Ändern von Buchungen nicht mehr möglich (GoB) nur am selben Tag möglich
-    if (!$form->{locked} && $radieren) {
-      print qq|
-        <input class=submit type=submit name=action value="| . $locale->text('Post') . qq|" accesskey="b">
-        <input class=submit type=submit name=action value="| . $locale->text('Delete') . qq|">|;
-    }
-
-    print qq|
-        <input class=submit type=submit name=action id=update_button value="| . $locale->text('Update') . qq|">
-        <input type="button" class="submit" onclick="follow_up_window()" value="|
-      . $locale->text('Follow-Up')
-      . qq|"> |;
+  $::lxdebug->enter_sub;
+  $::auth->assert('general_ledger');
 
-  } else {
-    if ($form->{draft_id}) {
-      my $remove_draft_checked = $form->{remove_draft} ? 'checked' : '';
-      print qq|<p>\n|
-        . qq|  <input name="remove_draft" id="remove_draft" type="checkbox" class="checkbox" ${remove_draft_checked}>|
-        . qq|  <label for="remove_draft">| . $locale->text('Remove Draft') . qq|</label>\n|
-        . qq|</p>\n|;
-    }
+  my ($follow_ups, $follow_ups_due);
 
-    print qq|
-        <input class=submit type=submit name=action id=update_button value="| . $locale->text('Update') . qq|">
-        <input class=submit type=submit name=action value="| . $locale->text('Post') . qq|"> |
-        . NTI($cgi->submit('-name' => 'action', '-value' => $locale->text('Save draft'), '-class' => 'submit'))
-        . $cgi->hidden('-name' => 'draft_id',          '-default' => [$form->{draft_id}])
-        . $cgi->hidden('-name' => 'draft_description', '-default' => [$form->{draft_description}]);
+  if ($::form->{id}) {
+    $follow_ups     = FU->follow_ups('trans_id' => $::form->{id});
+    $follow_ups_due = sum map { $_->{due} * 1 } @{ $follow_ups || [] };
   }
 
-  print "
-  </form>
+  my $radieren = $::form->current_date(\%::myconfig) eq $::form->{gldate};
 
-</body>
-</html>
-";
-  $main::lxdebug->leave_sub();
+  print $::form->parse_html_template('gl/form_footer', {
+    radieren       => $radieren,
+    follow_ups     => $follow_ups,
+    follow_ups_due => $follow_ups_due,
+  });
 
+  $::lxdebug->leave_sub;
 }
 
 sub delete {
@@ -1001,8 +926,6 @@ sub delete {
   $form->header;
 
   print qq|
-<body>
-
 <form method=post action=gl.pl>
 |;