Historien Suchmaschine: Stacküberlauf vermeiden
[kivitendo-erp.git] / bin / mozilla / is.pl
index c72f3e1..5db9b9c 100644 (file)
@@ -34,7 +34,6 @@
 
 use SL::FU;
 use SL::IS;
-use SL::PE;
 use SL::OE;
 use SL::MoreCommon qw(restore_form save_form);
 use Data::Dumper;
@@ -46,6 +45,7 @@ use English qw(-no_match_vars);
 
 use SL::DB::Default;
 use SL::DB::Customer;
+use SL::DB::Invoice;
 use SL::DB::PaymentTerm;
 
 require "bin/mozilla/io.pl";
@@ -303,9 +303,10 @@ sub form_header {
   $form->get_lists("taxzones"      => ($form->{id} ? "ALL_TAXZONES" : "ALL_ACTIVE_TAXZONES"),
                    "currencies"    => "ALL_CURRENCIES",
                    "customers"     => "ALL_CUSTOMERS",
-                   "departments"   => "all_departments",
                    "price_factors" => "ALL_PRICE_FACTORS");
 
+  $form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all;
+
   # Projects
   my @old_project_ids = uniq grep { $_ } map { $_ * 1 } ($form->{"globalproject_id"}, map { $form->{"project_id_$_"} } 1..$form->{"rowcount"});
   my @old_ids_cond    = @old_project_ids ? (id => \@old_project_ids) : ();
@@ -535,16 +536,15 @@ sub form_footer {
 }
 
 sub mark_as_paid {
-  $main::lxdebug->enter_sub();
-
-  my $form     = $main::form;
-  my %myconfig = %main::myconfig;
+  $::auth->assert('invoice_edit');
 
-  $main::auth->assert('invoice_edit');
+  SL::DB::Invoice->new(id => $::form->{id})->load->mark_as_paid;
 
-  &mark_as_paid_common(\%myconfig,"ar");
+  $::form->redirect($::locale->text("Marked as paid"));
+}
 
-  $main::lxdebug->leave_sub();
+sub show_draft {
+  update();
 }
 
 sub update {