$form->{snumber} durch $form->{snumbers} ersetzt, da dies eigentlich so vorgesehen...
[kivitendo-erp.git] / bin / mozilla / bp.pl
index 653577f..6e7d927 100644 (file)
 #======================================================================
 
 use SL::BP;
+use Data::Dumper;
 
 1;
 
+require "bin/mozilla/common.pl";
+
 # end of main
 
 sub search {
@@ -158,12 +161,12 @@ sub search {
 
     # with JavaScript Calendar
     $button1 = qq|
-       <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}">
+       <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">
        <input type=button name=transdatefrom id="trigger1" value=|
       . $locale->text('button') . qq|></td>
       |;
     $button2 = qq|
-       <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}">
+       <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">
        <input type=button name=transdateto name=transdateto id="trigger2" value=|
       . $locale->text('button') . qq|></td>
      |;
@@ -176,15 +179,16 @@ sub search {
 
     # without JavaScript Calendar
     $button1 = qq|
-                              <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}"></td>|;
+                              <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\"></td>|;
     $button2 = qq|
-                              <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}"></td>|;
+                              <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\"></td>|;
   }
-
+  $form->{javascript} .= qq|<script type="text/javascript" src="js/common.js"></script>|;
   $form->header;
-
+  $onload = qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|;
+  $onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|;
   print qq|
-<body>
+<body onLoad="$onload">
 
 <form method=post action=$form->{script}>
 
@@ -310,6 +314,10 @@ sub yes {
 sub print {
   $lxdebug->enter_sub();
 
+  $form->get_lists(printers => 'ALL_PRINTERS');
+  # use the command stored in the databse or fall back to $myconfig{printer}
+  my $selected_printer = (grep { $_->{id} eq $form->{printer} } @{ $form->{ALL_PRINTERS} })[0]->{'printer_command'} || $myconfig{printer};
+
   if ($form->{callback}) {
     map { $form->{callback} .= "&checked_$_=1" if $form->{"checked_$_"} }
       (1 .. $form->{rowcount});
@@ -318,7 +326,7 @@ sub print {
 
   for $i (1 .. $form->{rowcount}) {
     if ($form->{"checked_$i"}) {
-      $form->{OUT} = "| $myconfig{printer}";
+      $form->{OUT} = "| $selected_printer";
       $form->info($locale->text('Printing ... '));
 
       if (BP->print_spool(\%myconfig, \%$form, $spool)) {
@@ -553,7 +561,7 @@ sub list_spool {
 <input type=hidden name=password value=$form->{password}>
 |;
 
-  if ($myconfig{printer}) {
+#  if ($myconfig{printer}) {
     print qq|
 <input type=hidden name=transdateto value=$form->{transdateto}>
 <input type=hidden name=transdatefrom value=$form->{transdatefrom}>
@@ -564,17 +572,18 @@ sub list_spool {
 <input type=hidden name=vendor value=$form->{vendor}>
 <input class=submit type=submit name=action value="|
       . $locale->text('Select all') . qq|">
-<input class=submit type=submit name=action value="|
-      . $locale->text('Print') . qq|">
 <input class=submit type=submit name=action value="|
       . $locale->text('Remove') . qq|">
+<input class=submit type=submit name=action value="|
+      . $locale->text('Print') . qq|">
 |;
-  }
 
-  if ($form->{menubar}) {
-    require "$form->{path}/menu.pl";
-    &menubar;
-  }
+$form->get_lists(printers=>"ALL_PRINTERS");
+print qq|<select name="printer">|;
+print map(qq|<option value="$_->{id}">| . $form->quote_html($_->{printer_description}) . qq|</option>|, @{ $form->{ALL_PRINTERS} });
+print qq|</select>|;
+
+#  }
 
   print qq|
 </form>
@@ -583,7 +592,7 @@ sub list_spool {
 </html>
 |;
 
-  $lxdebug->leave_sub();
+  $main::lxdebug->leave_sub();
 }
 
 sub select_all {
@@ -595,5 +604,5 @@ sub select_all {
   $lxdebug->leave_sub();
 }
 
-sub continue { &{ $form->{nextsub} } }
+sub continue { call_sub($form->{"nextsub"}); }