Umstellung der HTML-Vorlagen aus templates/webpages/report_generator von HTML::Templa...
[kivitendo-erp.git] / bin / mozilla / ic.pl
index 28d41f3..4b563e6 100644 (file)
@@ -46,6 +46,7 @@ use SL::ReportGenerator;
 our ($form, $locale, %myconfig, $lxdebug);
 
 require "bin/mozilla/io.pl";
+require "bin/mozilla/invoice_io.pl";
 require "bin/mozilla/common.pl";
 require "bin/mozilla/reportgenerator.pl";
 
@@ -109,44 +110,33 @@ sub search {
      |;
 
     #write Trigger
-    $jsscript =
-      Form->write_trigger(\%myconfig, "2", "transdatefrom", "BL", "trigger1",
-                          "transdateto", "BL", "trigger2");
+    $jsscript = Form->write_trigger(\%myconfig, "2", "transdatefrom", "BL", "trigger1", "transdateto", "BL", "trigger2");
   } else {
 
     # without JavaScript Calendar
-    $button1 = qq|
-                              <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}"></td>|;
-    $button2 = qq|
-                              <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}"></td>|;
+    $button1 = qq| <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}"></td>|;
+    $button2 = qq| <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}"></td>|;
   }
 
   unless ($form->{searchitems} eq 'service') {
 
-    $onhand = qq|
-            <input name=itemstatus class=radio type=radio value=onhand>&nbsp;|
-      . $locale->text('On Hand') . qq|
-            <input name=itemstatus class=radio type=radio value=short>&nbsp;|
-      . $locale->text('Short') . qq|
+    $onhand = qq| <input name=itemstatus class=radio type=radio value=onhand>&nbsp;| . $locale->text('On Hand') . qq|
+                  <input name=itemstatus class=radio type=radio value=short>&nbsp;| . $locale->text('Short') . qq|
 |;
 
     $makemodel = qq|
         <tr>
-          <th align=right nowrap>| . $locale->text('Make') . qq|</th>
-          <td><input name=make size=20></td>
-          <th align=right nowrap>| . $locale->text('Model') . qq|</th>
-          <td><input name=model size=20></td>
+          <th align=right nowrap>| . $locale->text('Make') . qq|</th> <td><input name=make size=20></td>
+          <th align=right nowrap>| . $locale->text('Model') . qq|</th> <td><input name=model size=20></td>
         </tr>
 |;
 
     $serialnumber = qq|
-          <th align=right nowrap>| . $locale->text('Serial Number') . qq|</th>
-          <td><input name=serialnumber size=20></td>
+          <th align=right nowrap>| . $locale->text('Serial Number') . qq|</th> <td><input name=serialnumber size=20></td>
 |;
 
     $l_serialnumber = qq|
-        <td><input name=l_serialnumber class=checkbox type=checkbox value=Y>&nbsp;|
-      . $locale->text('Serial Number') . qq|</td>
+        <td><input name=l_serialnumber class=checkbox type=checkbox value=Y>&nbsp;| . $locale->text('Serial Number') . qq|</td>
 |;
 
   }
@@ -1910,7 +1900,7 @@ sub link_part {
 
       # if this is a tax field
       if ($key =~ /IC_tax/) {
-        if ($key =~ /$item/) {
+        if ($key =~ /\Q$item\E/) {
           $form->{taxaccounts} .= "$ref->{accno} ";
           $form->{"IC_tax_$ref->{accno}_description"} =
             "$ref->{accno}--$ref->{description}";
@@ -2395,16 +2385,14 @@ sub form_header {
         <tr valign=top>
           <td width=70%>
             <table width="100%" height="100%">
-              <tr class="listheading">
-                <th class="listheading" align="center" colspan=2>|
-    . $locale->text('') . qq|</th>
+              <tr>
+                <td colspan=2>
+                  <table>
+                    $buchungsgruppe
+                    $linkaccounts
+                  </table>
+                </td>
               </tr>
-              <td colspan=2>
-                <table>
-                  $buchungsgruppe
-                  $linkaccounts
-                </table>
-              </td>
               <tr>
                 <th align="left">| . $locale->text('Notes') . qq|</th>
                 <th align="left">$formula_label</th>
@@ -3085,10 +3073,19 @@ sub parts_language_selection {
 
   my $languages = IC->retrieve_languages(\%myconfig, $form);
 
+  if ($form->{language_values} ne "") {
+    foreach $item (split(/---\+\+\+---/, $form->{language_values})) {
+      my ($language_id, $translation, $longdescription) = split(/--\+\+--/, $item);
+
+      foreach my $language (@{ $languages }) {
+        next unless ($language->{id} == $language_id);
 
-  my $callback = "$form->{script}?action=parts_language_selection&";
-  map({ $callback .= "$_=" . $form->escape($form->{$_}) . "&" }
-      (qw(login password name input_name), grep({ /^[fl]_/ } keys %$form)));
+        $language->{translation}     = $translation;
+        $language->{longdescription} = $longdescription;
+        last;
+      }
+    }
+  }
 
   my @header_sort = qw(name longdescription);
   my %header_title = ( "name" => $locale->text("Name"),
@@ -3104,9 +3101,9 @@ sub parts_language_selection {
 
   $form->{"title"} = $locale->text("Language Values");
   $form->header();
-  print($form->parse_html_template("ic/parts_language_selection", { "HEADER" => \@header,
-                                                                   "LANGUAGES" => $languages,
-                                                                   "onload" => $onload }));
+  print $form->parse_html_template2("ic/parts_language_selection", { "HEADER"    => \@header,
+                                                                     "LANGUAGES" => $languages,
+                                                                     "onload"    => $onload });
 
   $lxdebug->leave_sub();
 }