Umstellung der Benutzerverwaltung von Dateien im Verzeichnis "users" auf die Verwendu...
[kivitendo-erp.git] / bin / mozilla / dn.pl
index b15d029..338d86a 100644 (file)
@@ -41,13 +41,14 @@ use SL::ReportGenerator;
 require "bin/mozilla/common.pl";
 require "bin/mozilla/reportgenerator.pl";
 require "bin/mozilla/io.pl";
-require "bin/mozilla/arap.pl";
 
 1;
 
 sub edit_config {
   $lxdebug->enter_sub();
 
+  $auth->assert('config');
+
   DN->get_config(\%myconfig, \%$form);
   $form->get_lists('charts' => { 'key'       => 'ALL_CHARTS',
                                  'transdate' => 'current_date' });
@@ -74,7 +75,7 @@ sub edit_config {
   $form->{callback} ||= build_std_url("action=edit_config");
 
   $form->header();
-  print $form->parse_html_template2("dunning/edit_config");
+  print $form->parse_html_template("dunning/edit_config");
 
   $lxdebug->leave_sub();
 }
@@ -82,6 +83,8 @@ sub edit_config {
 sub add {
   $lxdebug->enter_sub();
 
+  $auth->assert('dunning_edit');
+
   # setup customer selection
   $form->all_vc(\%myconfig, "customer", "AR");
 
@@ -96,7 +99,7 @@ sub add {
   $form->{fokus}    = "search.customer";
   $form->header();
 
-  print $form->parse_html_template2("dunning/add");
+  print $form->parse_html_template("dunning/add");
 
   $lxdebug->leave_sub();
 }
@@ -104,6 +107,8 @@ sub add {
 sub show_invoices {
   $lxdebug->enter_sub();
 
+  $auth->assert('dunning_edit');
+
   DN->get_invoices(\%myconfig, \%$form);
   $form->{title} = $locale->text('Start Dunning Process');
 
@@ -122,7 +127,7 @@ sub show_invoices {
   $form->{type}           = 'dunning';
   $form->{rowcount}       = scalar @{ $form->{DUNNINGS} };
   $form->{jsscript}       = 1;
-  $form->{callback}     ||= build_std_url("action=show_invoices", qw(login password customer invnumber ordnumber groupinvoices minamount dunning_level notes));
+  $form->{callback}     ||= build_std_url("action=show_invoices", qw(customer invnumber ordnumber groupinvoices minamount dunning_level notes));
 
   $form->{PRINT_OPTIONS}  = print_options('inline'          => 1,
                                           'no_queue'        => 1,
@@ -131,7 +136,7 @@ sub show_invoices {
                                           'no_opendocument' => 1,);
 
   $form->header();
-  print $form->parse_html_template2("dunning/show_invoices");
+  print $form->parse_html_template("dunning/show_invoices");
 
   $lxdebug->leave_sub();
 }
@@ -139,6 +144,8 @@ sub show_invoices {
 sub save {
   $lxdebug->enter_sub();
 
+  $auth->assert('config');
+
   for my $i (1 .. $form->{rowcount}) {
     if ($form->{"dunning_description_$i"} ne "") {
       $form->isblank("dunning_level_$i", $locale->text('Dunning Level missing in row '). $i);
@@ -164,6 +171,8 @@ sub save {
 sub save_dunning {
   $lxdebug->enter_sub();
 
+  $auth->assert('dunning_edit');
+
   my $active=1;
   my @rows = ();
   undef($form->{DUNNING_PDFS});
@@ -191,7 +200,7 @@ sub save_dunning {
       foreach my $level (values %{ $levels }) {
         next unless scalar @{ $level };
 
-        DN->save_dunning(\%myconfig, $form, $level, $userspath, $spool, $sendmail);
+        DN->save_dunning(\%myconfig, $form, $level, $userspath, $spool);
       }
     }
 
@@ -204,7 +213,7 @@ sub save_dunning {
                       "customer_id"            => $form->{"customer_id_$i"},
                       "next_dunning_config_id" => $form->{"next_dunning_config_id_$i"},
                       "email"                  => $form->{"email_$i"}, } ];
-      DN->save_dunning(\%myconfig, $form, $level, $userspath, $spool, $sendmail);
+      DN->save_dunning(\%myconfig, $form, $level, $userspath, $spool);
     }
   }
 
@@ -231,9 +240,11 @@ sub save_dunning {
 sub set_email {
   $lxdebug->enter_sub();
 
+  $auth->assert('dunning_edit');
+
   $form->{"title"} = $locale->text("Set eMail text");
   $form->header();
-  print($form->parse_html_template2("dunning/set_email"));
+  print($form->parse_html_template("dunning/set_email"));
 
   $lxdebug->leave_sub();
 }
@@ -241,6 +252,8 @@ sub set_email {
 sub search {
   $lxdebug->enter_sub();
 
+  $auth->assert('dunning_edit');
+
   $form->get_lists("customers"   => "ALL_CUSTOMERS",
                    "departments" => "ALL_DEPARTMENTS");
 
@@ -260,7 +273,7 @@ sub search {
     . qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|
     . qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|;
 
-  print $form->parse_html_template2("dunning/search");
+  print $form->parse_html_template("dunning/search");
 
   $lxdebug->leave_sub();
 
@@ -269,6 +282,8 @@ sub search {
 sub show_dunning {
   $lxdebug->enter_sub();
 
+  $auth->assert('dunning_edit');
+
   my @filter_field_list = qw(customer_id customer dunning_level department_id invnumber ordnumber
                              transdatefrom transdateto dunningfrom dunningto notes showold);
 
@@ -361,8 +376,8 @@ sub show_dunning {
 
   $report->add_data($current_dunning_rows) if (scalar @{ $current_dunning_rows });
 
-  $report->set_options('raw_top_info_text'    => $form->parse_html_template2('dunning/show_dunning_top'),
-                       'raw_bottom_info_text' => $form->parse_html_template2('dunning/show_dunning_bottom'),
+  $report->set_options('raw_top_info_text'    => $form->parse_html_template('dunning/show_dunning_top'),
+                       'raw_bottom_info_text' => $form->parse_html_template('dunning/show_dunning_bottom'),
                        'output_format'        => 'HTML',
                        'attachment_basename'  => $locale->text('dunning_list') . strftime('_%Y%m%d', localtime time),
     );
@@ -378,6 +393,8 @@ sub show_dunning {
 sub print_dunning {
   $lxdebug->enter_sub();
 
+  $auth->assert('dunning_edit');
+
   $form->{rowcount}     = 1;
   $form->{selected_1}   = 1;
   $form->{dunning_id_1} = $form->{dunning_id};
@@ -390,6 +407,8 @@ sub print_dunning {
 sub print_multiple {
   $lxdebug->enter_sub();
 
+  $auth->assert('dunning_edit');
+
   $form->{title} = $locale->text('Print dunnings');
 
   my @dunning_ids = map { $form->{"dunning_id_$_"} } grep { $form->{"selected_$_"} } (1..$form->{rowcount});
@@ -421,4 +440,8 @@ sub print_multiple {
   $lxdebug->leave_sub();
 }
 
+sub continue {
+  call_sub($form->{nextsub});
+}
+
 # end of main