Ermöglichen, keinen Drucker als Standarddrucker auszuwählen
[kivitendo-erp.git] / bin / mozilla / am.pl
index 0030eb5..368a627 100644 (file)
@@ -46,8 +46,6 @@ use SL::Printer;
 use CGI::Ajax;
 use CGI;
 
-use Data::Dumper;
-
 require "bin/mozilla/common.pl";
 
 use strict;
@@ -822,251 +820,6 @@ sub delete_lead {
   $main::lxdebug->leave_sub();
 }
 
-sub add_business {
-  $main::lxdebug->enter_sub();
-
-  my $form     = $main::form;
-
-  $main::auth->assert('config');
-
-  $form->{title} = "Add";
-
-  $form->{callback} = "am.pl?action=add_business" unless $form->{callback};
-
-  &business_header;
-  &form_footer;
-
-  $main::lxdebug->leave_sub();
-}
-
-sub edit_business {
-  $main::lxdebug->enter_sub();
-
-  my $form     = $main::form;
-  my %myconfig = %main::myconfig;
-
-  $form->{title} = "Edit";
-
-  AM->get_business(\%myconfig, \%$form);
-
-  &business_header;
-
-  $form->{orphaned} = 1;
-  &form_footer;
-
-  $main::lxdebug->leave_sub();
-}
-
-sub list_business {
-  $main::lxdebug->enter_sub();
-
-  my $form     = $main::form;
-  my %myconfig = %main::myconfig;
-  my $locale   = $main::locale;
-
-  $main::auth->assert('config');
-
-  AM->business(\%myconfig, \%$form);
-
-  $form->{callback} = "am.pl?action=list_business";
-
-  my $callback = $form->escape($form->{callback});
-
-  $form->{title} = $locale->text('Type of Business');
-
-  my @column_index = qw(description discount customernumberinit);
-  push @column_index, 'salesman' if $::lx_office_conf{features}->{vertreter};
-  my %column_header;
-  $column_header{description} =
-      qq|<th class=listheading width=60%>|
-    . $locale->text('Description')
-    . qq|</th>|;
-  $column_header{discount} =
-      qq|<th class=listheading width=10%>|
-    . $locale->text('Discount')
-    . qq| %</th>|;
-  $column_header{customernumberinit} =
-      qq|<th class=listheading>|
-    . $locale->text('Customernumberinit')
-    . qq|</th>|;
-  $column_header{salesman} =
-      qq|<th class=listheading>|
-    . $locale->text('Representative')
-    . qq|</th>|;
-
-  $form->header;
-
-  print qq|
-<body>
-
-<table width=100%>
-  <tr>
-    <th class=listtop>$form->{title}</th>
-  </tr>
-  <tr height="5"></tr>
-  <tr>
-    <td>
-      <table width=100%>
-        <tr class=listheading>
-|;
-
-  map { print "$column_header{$_}\n" } @column_index;
-
-  print qq|
-        </tr>
-|;
-
-  my ($i, %column_data);
-  foreach my $ref (@{ $form->{ALL} }) {
-
-    $i++;
-    $i %= 2;
-
-    print qq|
-        <tr valign=top class=listrow$i>
-|;
-
-    my $discount    = $form->format_amount(\%myconfig, $ref->{discount} * 100);
-    my $description = $ref->{description};
-    $column_data{description} = qq|<td><a href="am.pl?action=edit_business&id=$ref->{id}&callback=$callback">$description</td>|;
-    $column_data{discount}           = qq|<td align=right>$discount</td>|;
-    $column_data{customernumberinit} =
-      qq|<td align=right>$ref->{customernumberinit}</td>|;
-    $column_data{salesman} = '<td>' . ($ref->{salesman} ? $::locale->text('Yes') : $::locale->text('No')) . '</td>';
-
-    map { print "$column_data{$_}\n" } @column_index;
-
-    print qq|
-        </tr>
-|;
-  }
-
-  print qq|
-      </table>
-    </td>
-  </tr>
-  <tr>
-  <td><hr size=3 noshade></td>
-  </tr>
-</table>
-
-<br>
-<form method=post action=am.pl>
-
-<input name=callback type=hidden value="$form->{callback}">
-
-<input type=hidden name=type value=business>
-
-<input class=submit type=submit name=action value="|
-    . $locale->text('Add') . qq|">
-
-  </form>
-
-  </body>
-  </html>
-|;
-
-  $main::lxdebug->leave_sub();
-}
-
-sub business_header {
-  $main::lxdebug->enter_sub();
-
-  my $form     = $main::form;
-  my %myconfig = %main::myconfig;
-  my $locale   = $main::locale;
-
-  $main::auth->assert('config');
-
-  $form->{title}    = $locale->text("$form->{title} Business");
-
-  # $locale->text('Add Business')
-  # $locale->text('Edit Business')
-
-  $form->{description} =~ s/\"/&quot;/g;
-  $form->{discount} =
-    $form->format_amount(\%myconfig, $form->{discount} * 100);
-
-  my $salesman_code;
-  if ($::lx_office_conf{features}->{vertreter}) {
-    $salesman_code = qq|
-  <tr>
-    <th align="right">| . $locale->text('Representative') . qq|</th>
-    <td>| . $::cgi->checkbox(-name => "salesman", -value => 1, -label => '', 'checked' => $form->{salesman} ? 1 : 0) . qq|</td>
-  </tr>
-|;
-  } else {
-    $salesman_code = $::cgi->hidden(-name => 'salesman', -value => $form->{salesman} ? 1 : 0);
-  }
-
-  $form->header;
-
-  print qq|
-<body>
-
-<form method=post action=am.pl>
-
-<input type=hidden name=id value=$form->{id}>
-<input type=hidden name=type value=business>
-
-<table width=100%>
-  <tr>
-    <th class=listtop colspan=2>$form->{title}</th>
-  </tr>
-  <tr height="5"></tr>
-  <tr>
-    <th align=right>| . $locale->text('Type of Business') . qq|</th>
-    <td><input name=description size=30 value="$form->{description}"></td>
-  <tr>
-  <tr>
-    <th align=right>| . $locale->text('Discount') . qq| %</th>
-    <td><input name=discount size=5 value=$form->{discount}></td>
-  </tr>
-  <tr>
-    <th align=right>| . $locale->text('Customernumberinit') . qq|</th>
-    <td><input name=customernumberinit size=10 value=$form->{customernumberinit}></td>
-  </tr>
-$salesman_code
-  <td colspan=2><hr size=3 noshade></td>
-  </tr>
-</table>
-|;
-
-  $main::lxdebug->leave_sub();
-}
-
-sub save_business {
-  $main::lxdebug->enter_sub();
-
-  my $form     = $main::form;
-  my %myconfig = %main::myconfig;
-  my $locale   = $main::locale;
-
-  $main::auth->assert('config');
-
-  $form->isblank("description", $locale->text('Description missing!'));
-  $form->{discount} = $form->parse_amount(\%myconfig, $form->{discount}) / 100;
-  AM->save_business(\%myconfig, \%$form);
-  $form->redirect($locale->text('Business saved!'));
-
-  $main::lxdebug->leave_sub();
-}
-
-sub delete_business {
-  $main::lxdebug->enter_sub();
-
-  my $form     = $main::form;
-  my %myconfig = %main::myconfig;
-  my $locale   = $main::locale;
-
-  $main::auth->assert('config');
-
-  AM->delete_business(\%myconfig, \%$form);
-  $form->redirect($locale->text('Business deleted!'));
-
-  $main::lxdebug->leave_sub();
-}
-
 sub add_language {
   $main::lxdebug->enter_sub();
 
@@ -1637,17 +1390,18 @@ sub buchungsgruppe_header {
   }
 
   my $linkaccounts;
-  if (!$::lx_office_conf{system}->{eur}) {
+  if ( $::instance_conf->get_inventory_system eq 'perpetual' ) { # was !$::lx_office_conf{system}->{eur}) {
     $linkaccounts = qq|
                <tr>
                 <th align=right>| . $locale->text('Inventory') . qq|</th>
                 <td><select name=inventory_accno_id>$form->{selectIC}</select></td>
                 <input name=selectIC type=hidden value="$form->{selectIC}">
               </tr>|;
-  } else {
+  } elsif ( $::instance_conf->get_inventory_system eq 'periodic' ) {
+    # don't allow choice of inventory accno and don't show that line
     $linkaccounts = qq|
                 <input type=hidden name=inventory_accno_id value=$form->{inventory_accno_id}>|;
-  }
+  };
 
 
   $linkaccounts .= qq|
@@ -1795,6 +1549,11 @@ sub edit_defaults {
 
   map { $form->{"defaults_${_}"} = $form->{defaults}->{$_} } keys %{ $form->{defaults} };
 
+  # default language
+  my $all_languages = SL::DB::Manager::Language->get_all;
+
+# EÜR = cash, Bilanzierung = accrual
+
   foreach my $key (keys %{ $form->{IC} }) {
     foreach my $accno (sort keys %{ $form->{IC}->{$key} }) {
       my $array = "ACCNOS_" . uc($key);
@@ -1812,7 +1571,8 @@ sub edit_defaults {
   $form->{title} = $locale->text('Ranges of numbers and default accounts');
 
   $form->header();
-  print $form->parse_html_template('am/edit_defaults');
+  print $form->parse_html_template('am/edit_defaults',
+                                   { ALL_LANGUAGES => $all_languages, });
 
   $main::lxdebug->leave_sub();
 }
@@ -1900,14 +1660,7 @@ sub config {
     { 'name' => $locale->text('Queue'),   'value' => 'queue',   'selected' => $selected{queue}, },
     ];
 
-  $form->{PRINTERS} = [];
-  foreach my $printer (SL::Printer->all_printers(%::myconfig)) {
-    push @{ $form->{PRINTERS} }, {
-      'name'     => $printer->{printer_description},
-      'value'    => $printer->{id},
-      'selected' => $printer->{id} == $myconfig{default_printer_id},
-    };
-  }
+  $form->{PRINTERS} = [ SL::Printer->all_printers(%::myconfig) ];
 
   my %countrycodes = User->country_codes;