]> wagnertech.de Git - kivitendo-erp.git/commitdiff
Unnötige Hiddens entfernen
authorNiclas Zimmermann <niclas@kivitendo-premium.de>
Mon, 27 May 2013 15:17:15 +0000 (17:17 +0200)
committerNiclas Zimmermann <niclas@kivitendo-premium.de>
Mon, 27 May 2013 15:17:15 +0000 (17:17 +0200)
Anzeigekonfiguration von Gewichten
Gewichte in Druckvorlagen

Durch diesen Commit werden
1. unnötige Hidden-Variablen aus html-templates entfernt, die mit
Gewichten zu tun haben.
2. die Anzeige von Gewichten konfigurierbar gemacht.
3. Gewichte in Druckvorlagen zur Verfügung gestellt. Es stehen ein
Zeilengewicht (lineweight), Einzelgewicht des Artikels (weight) und
Gesamtgewicht (totalweight) zur Verfügung, die letzten beiden auch
als unformatierte Variablen (weight_nofmt und totalweight_nofmt).

12 files changed:
SL/Controller/ClientConfig.pm
SL/DB/MetaSetup/Default.pm
SL/DO.pm
SL/IS.pm
SL/OE.pm
bin/mozilla/io.pl
locale/de/all
templates/webpages/client_config/form.html
templates/webpages/do/form_footer.html
templates/webpages/ir/form_footer.html
templates/webpages/is/form_footer.html
templates/webpages/oe/form_footer.html

index 41c19ee80f53b01cc6db147fa6765ece45ec785d..74bc8b597054c810f2c0ad6e52567d0f28e5b470 100644 (file)
@@ -43,6 +43,8 @@ sub action_edit {
 
   map { $self->{$_} = SL::DB::Default->get->$_ } qw(sales_order_show_delete purchase_order_show_delete sales_delivery_order_show_delete purchase_delivery_order_show_delete);
 
+  $self->{show_weight} = SL::DB::Default->get->show_weight;
+
   $self->render('client_config/form', title => $::locale->text('Client Configuration'));
 }
 
@@ -64,6 +66,8 @@ sub action_save {
 
   map { SL::DB::Default->get->update_attributes($_ => $::form->{$_}); } qw(sales_order_show_delete purchase_order_show_delete sales_delivery_order_show_delete purchase_delivery_order_show_delete);
 
+  SL::DB::Default->get->update_attributes('show_weight'     => $::form->{show_weight});
+
   flash_later('info', $::locale->text('Client Configuration saved!'));
 
   $self->redirect_to(action => 'edit');
index bb174ebaa4700d7887491ff2454c6aa4214b6829..d45a7cfb4bff85fafbfcd724ca94bac943e2bce8 100644 (file)
@@ -68,6 +68,7 @@ __PACKAGE__->meta->setup(
     ar_show_mark_as_paid                => { type => 'boolean', default => 'true' },
     ap_show_mark_as_paid                => { type => 'boolean', default => 'true' },
     assemblynumber                      => { type => 'text' },
+    show_weight                         => { type => 'boolean', default => 'false', not_null => 1 },
   ],
 
   primary_key_columns => [ 'id' ],
index 76a0ec075e0016235970d2518e00c98e31a83b05..e47b5d11695dfecd3f1d0185ba0aadcb9f7f3bb4 100644 (file)
--- a/SL/DO.pm
+++ b/SL/DO.pm
@@ -920,6 +920,8 @@ sub order_details {
 
   $form->{totalweight}       = $form->format_amount($myconfig, $totalweight, 3);
   $form->{totalweight_nofmt} = $totalweight;
+  my $defaults = AM->get_defaults();
+  $form->{weightunit}        = $defaults->{weightunit};
 
   $h_pg->finish();
   $h_bin_wh->finish();
index 8a94ec6b47f4ee9313cdc4cbf4c51351d52336da..2db51a5aed381d98fcc8d1da34f2ca1fca2d4188 100644 (file)
--- a/SL/IS.pm
+++ b/SL/IS.pm
@@ -376,6 +376,8 @@ sub invoice_details {
 
   $form->{totalweight}       = $form->format_amount($myconfig, $totalweight, 3);
   $form->{totalweight_nofmt} = $totalweight;
+  my $defaults = AM->get_defaults();
+  $form->{weightunit}        = $defaults->{weightunit};
 
   foreach my $item (sort keys %taxaccounts) {
     $tax += $taxamount = $form->round_amount($taxaccounts{$item}, 2);
index 04f93858f2cab151a9484e84dd0da1eb9bd5e1e1..3d6b32837faa3460f674eb69651828a4550ee5d1 100644 (file)
--- a/SL/OE.pm
+++ b/SL/OE.pm
@@ -1318,6 +1318,8 @@ sub order_details {
 
   $form->{totalweight}       = $form->format_amount($myconfig, $totalweight, 3);
   $form->{totalweight_nofmt} = $totalweight;
+  my $defaults = AM->get_defaults();
+  $form->{weightunit}        = $defaults->{weightunit};
 
   my $tax = 0;
   foreach $item (sort keys %taxaccounts) {
index a024cd85dada1f0774f0e4fd8ad16909cf68cb22..99b61f31e72eaf37c4abb5dc80018fe86c92e08c 100644 (file)
@@ -123,6 +123,10 @@ sub display_row {
 
   my ($stock_in_out, $stock_in_out_title);
 
+  my $defaults = AM->get_defaults();
+  $form->{show_weight} = $defaults->{show_weight};
+  $form->{weightunit} = $defaults->{weightunit};
+
   my $is_purchase        = (first { $_ eq $form->{type} } qw(request_quotation purchase_order purchase_delivery_order)) || ($form->{script} eq 'ir.pl');
   my $show_min_order_qty =  first { $_ eq $form->{type} } qw(request_quotation purchase_order);
   my $is_delivery_order  = $form->{type} =~ /_delivery_order$/;
@@ -150,7 +154,7 @@ sub display_row {
     {  id => 'qty',           width => 5,     value => $locale->text('Qty'),                  display => 1, },
     {  id => 'price_factor',  width => 5,     value => $locale->text('Price Factor'),         display => !$is_delivery_order, },
     {  id => 'unit',          width => 5,     value => $locale->text('Unit'),                 display => 1, },
-    {  id => 'weight',        width => 5,     value => $locale->text('Weight'),               display => 1, },
+    {  id => 'weight',        width => 5,     value => $locale->text('Weight'),               display => $defaults->{show_weight}, },
     {  id => 'serialnr',      width => 10,    value => $locale->text('Serial No.'),           display => 0, },
     {  id => 'projectnr',     width => 10,    value => $locale->text('Project'),              display => 0, },
     {  id => 'sellprice',     width => 15,    value => $locale->text('Price'),                display => !$is_delivery_order, },
@@ -208,9 +212,7 @@ sub display_row {
   _update_custom_variables();
 
   my $totalweight = 0;
-  my $defaults = AM->get_defaults();
 
-  $form->{weightunit} = $defaults->{weightunit};
   # rows
 
   my @ROWS;
@@ -332,9 +334,7 @@ sub display_row {
     $column_data{linetotal}   = $form->format_amount(\%myconfig, $linetotal, 2);
     $column_data{bin}         = $form->{"bin_$i"};
 
-    $column_data{weight}      = $form->format_amount(\%myconfig, $form->{"qty_$i"} * $form->{"weight_$i"}, 3) . ' ' . $defaults->{weightunit};
-    #To add the hidden variable lineweight:
-    $form->{"lineweight_$i"}       = $column_data{weight};
+    $column_data{weight}      = $form->format_amount(\%myconfig, $form->{"qty_$i"} * $form->{"weight_$i"}, 3) . ' ' . $defaults->{weightunit} if $defaults->{show_weight};
 
     if ($is_delivery_order) {
       $column_data{stock_in_out} =  calculate_stock_in_out($i);
@@ -430,7 +430,7 @@ sub display_row {
           map { ($cgi->hidden("-name" => $_, "-value" => $form->{$_})); } map { $_."_$i" }
             (qw(orderitems_id bo pricegroup_old price_old id inventory_accno bin partsgroup partnotes
                 income_accno expense_accno listprice assembly taxaccounts ordnumber transdate cusordnumber
-                longdescription basefactor marge_absolut marge_percent marge_price_factor weight lineweight), @hidden_vars)
+                longdescription basefactor marge_absolut marge_percent marge_price_factor weight), @hidden_vars)
     );
 
     map { $form->{"${_}_base"} += $linetotal } (split(/ /, $form->{"taxaccounts_$i"}));
index ce0bf65ca8abc977ca8145330332838d1882567f..716a690a83d0906fc0f605869497e62b1855a968 100755 (executable)
@@ -1797,6 +1797,8 @@ $self->{texts} = {
   'Show old dunnings'           => 'Alte Mahnungen anzeigen',
   'Show overdue sales quotations and requests for quotations...' => 'Überfällige Angebote und Preisanfragen anzeigen...',
   'Show settings'               => 'Einstellungen anzeigen',
+  'Show the weights of articles and the total weight in orders, invoices and delivery notes?' => 'Sollen Warengewichte und Gesamtgewicht in Aufträgen, Rechnungen und Lieferscheinen angezeigt werden?',
+  'Show weights'                => 'Gewichte anzeigen',
   'Show your TODO list after loggin in' => 'Aufgabenliste nach dem Anmelden anzeigen',
   'Signature'                   => 'Unterschrift',
   'Since bin is not enforced in the parts data, please specify a bin where goods without a specified bin will be put.' => 'Da Lagerpl&auml;tze kein Pflichtfeld sind, geben Sie bitte einen Lagerplatz an, in dem Waren ohne spezifizierten Lagerplatz eingelagert werden sollen.',
index 5fc0c04ac5d1417bef29f3c2c32a2b7e6810715c..6a3c0f5826393a5dee506a600c012f2937cd173a 100644 (file)
    </td>
  </tr>
 
+ <tr class='listheading'>
+   <th colspan="3">[% 'Weight' | $T8 %]</th>
+ </tr>
+ <tr>
+   <td align="right">[% 'Show weights' | $T8 %]</td>
+   <td>
+     [% L.yes_no_tag('show_weight', SELF.show_weight) %]
+   </td>
+   <td>
+     [% 'Show the weights of articles and the total weight in orders, invoices and delivery notes?' | $T8 %]<br>
+   </td>
+ </tr>
 </table>
 
 <br>
index 6be226888acc5f0500d80176d46f60062f509e25..d87b156ca052a5b1692329533b7cde8698883b8a 100644 (file)
@@ -20,6 +20,7 @@
 
      </td>
     </tr>
+[%- IF show_weight %]
   <tr>
     <td>
       <table width="100%">
@@ -30,7 +31,6 @@
               <th  align="left">[% 'Total weight' | $T8 %]</th>
               <td align="right">
                 [% LxERP.format_amount(totalweight, 3) %] [% HTML.escape(weightunit) %]
-                <input type="hidden" name="totalweight" value="[% HTML.escape(totalweight) %]">
               </td>
             </tr>
             </table>
@@ -38,6 +38,8 @@
         </tr>
       </table>
     </td>
+  </tr>
+[%- END %]
    </table>
   </p>
 
index 83ab34abbbddf361de14862f580e44dd599443e2..66758003dfba579e3bff58b95670f61911e81637 100644 (file)
 [%- END %]
        </table>
       </td>
+[%- IF show_weight %]
       <td>
        <table>
         <tr>
          <th  align=left>[% 'Total weight' | $T8 %]</th>
          <td>
           [% LxERP.format_amount(totalweight) %] [% HTML.escape(weightunit) %]
-          <input type=hidden name="totalweight" value="[% totalweight %]">
-          <input type=hidden name="weightunit" value="[% HTML.escape(weightunit) %]">
          </td>
         </tr>
        </table>
       </td>
+[%- END %]
       <td align="right">
   [%- IF taxaccounts %]
        <input name="taxincluded" class="checkbox" type="checkbox" [% IF taxincluded %]checked[% END %]>
index f389e842a06f5d66393ee3d3ab8d109667c6f00c..28fafaa09d1ef1049759b4a67f81d5412ce69924 100644 (file)
 [%- END %]
        </table>
       </td>
+[%- IF show_weight %]
       <td>
        <table>
         <tr>
          <th  align=left>[% 'Total weight' | $T8 %]</th>
          <td>
           [% LxERP.format_amount(totalweight) %] [% HTML.escape(weightunit) %]
-          <input type=hidden name="totalweight" value="[% totalweight %]">
-          <input type=hidden name="weightunit" value="[% HTML.escape(weightunit) %]">
          </td>
         </tr>
        </table>
       </td>
+[%- END %]
       <td>
        <table>
         <tr>
index 24e9f255d403ce0fe2d4a5faee21bcee315b5dd2..87c1993a71429ae057bde9ee6e8ea90b1a56b44a 100644 (file)
       [%- END %]
       </table>
           </td>
+      [%- IF show_weight %]
           <td>
             <table>
             <tr>
               <th  align="left">[% 'Total weight' | $T8 %]</th>
               <td align="right">
                 [% LxERP.format_amount(totalweight, 3) %] [% HTML.escape(weightunit) %]
-                <input type=hidden name="totalweight" value="[% totalweight %]">
-                <input type="hidden" name="weightunit" value="[% HTML.escape(weightunit) %]">
               </td>
             </tr>
             </table>
           </td>
+      [%- END %]
 [%- IF is_sales %]
           <td>
             <table>