Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 081a4f97

Von Moritz Bunkus vor mehr als 18 Jahren hinzugefügt

  • ID 081a4f9736f3bc345872be8f61632cbed4a8d9b3
  • Vorgänger c5b4fdf4
  • Nachfolger 72539cb3

Kosmetik: Perltidy-Lauf nach den Einstellungen in doc/programmierrichtlinien.txt ueber alle .pl und .pm.

Unterschiede anzeigen:

bin/mozilla/oe.pl
79 79

  
80 80
  # editing without stuff to edit? try adding it first
81 81
  if ($form->{rowcount}) {
82
    map {$id++ if $form->{"id_$_"}} (1 .. $form->{rowcount});
82
    map { $id++ if $form->{"id_$_"} } (1 .. $form->{rowcount});
83 83
    if (!$id) {
84

  
84 85
      # reset rowcount
85 86
      undef $form->{rowcount};
86 87
      &add;
......
131 132
  # retrieve order/quotation
132 133
  $form->{webdav} = $webdav;
133 134

  
134

  
135 135
  # set jscalendar
136 136
  $form->{jscalendar} = $jscalendar;
137 137

  
138 138
  OE->retrieve(\%myconfig, \%$form);
139 139

  
140 140
  # if multiple rowcounts (== collective order) then check if the
141
  # there were more than one customer (in that case OE::retrieve removes 
141
  # there were more than one customer (in that case OE::retrieve removes
142 142
  # the content from the field)
143
  if ($form->{rowcount} && $form->{type} eq 'sales_order' && defined $form->{customer} && $form->{customer} eq '') {
144
#    $main::lxdebug->message(0, "Detected Edit order with concurrent customers");
145
    $form->error($locale->text('Collective Orders only work for orders from one customer!'));
143
  if (   $form->{rowcount}
144
      && $form->{type} eq 'sales_order'
145
      && defined $form->{customer}
146
      && $form->{customer} eq '') {
147

  
148
    #    $main::lxdebug->message(0, "Detected Edit order with concurrent customers");
149
    $form->error(
150
                 $locale->text(
151
                   'Collective Orders only work for orders from one customer!')
152
    );
146 153
  }
147 154

  
148 155
  $taxincluded = $form->{taxincluded};
......
221 228
  $form->{media}    = "screen";
222 229
  $form->{formname} = $form->{type};
223 230

  
224
    map { $form->{$_} =~ s/\"/"/g }
225
      qw(ordnumber quonumber shippingpoint shipvia notes intnotes shiptoname shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact);
231
  map { $form->{$_} =~ s/\"/"/g }
232
    qw(ordnumber quonumber shippingpoint shipvia notes intnotes shiptoname shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact);
226 233

  
227
    foreach $ref (@{ $form->{form_details} }) {
228
      $form->{rowcount} = ++$i;
234
  foreach $ref (@{ $form->{form_details} }) {
235
    $form->{rowcount} = ++$i;
229 236

  
230
      map { $form->{"${_}_$i"} = $ref->{$_} } keys %{$ref};
231
    }
232
    for my $i (1 .. $form->{rowcount}) {
233
      if ($form->{id}) {
234
        $form->{"discount_$i"} =
235
          $form->format_amount(\%myconfig, $form->{"discount_$i"} * 100);
236
      } else {
237
        $form->{"discount_$i"} =
238
          $form->format_amount(\%myconfig, $form->{"discount_$i"});
239
      }
240
      ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);    
241
      $dec           = length $dec;
242
      $decimalplaces = ($dec > 2) ? $dec : 2;
243

  
244
      # copy reqdate from deliverydate for invoice -> order conversion
245
      $form->{"reqdate_$i"} = $form->{"deliverydate_$i"} unless $form->{"reqdate_$i"};
246

  
247
      $form->{"sellprice_$i"} =
248
        $form->format_amount(\%myconfig, $form->{"sellprice_$i"},
249
                            $decimalplaces);
250
      
251
      (my $dec_qty) = ($form->{"qty_$i"} =~ /\.(\d+)/);
252
      $dec_qty      = length $dec_qty;
253
      $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty);
254

  
255
      map { $form->{"${_}_$i"} =~ s/\"/"/g }
256
        qw(partnumber description unit);
237
    map { $form->{"${_}_$i"} = $ref->{$_} } keys %{$ref};
238
  }
239
  for my $i (1 .. $form->{rowcount}) {
240
    if ($form->{id}) {
241
      $form->{"discount_$i"} =
242
        $form->format_amount(\%myconfig, $form->{"discount_$i"} * 100);
243
    } else {
244
      $form->{"discount_$i"} =
245
        $form->format_amount(\%myconfig, $form->{"discount_$i"});
257 246
    }
247
    ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
248
    $dec           = length $dec;
249
    $decimalplaces = ($dec > 2) ? $dec : 2;
250

  
251
    # copy reqdate from deliverydate for invoice -> order conversion
252
    $form->{"reqdate_$i"} = $form->{"deliverydate_$i"}
253
      unless $form->{"reqdate_$i"};
254

  
255
    $form->{"sellprice_$i"} =
256
      $form->format_amount(\%myconfig, $form->{"sellprice_$i"},
257
                           $decimalplaces);
258

  
259
    (my $dec_qty) = ($form->{"qty_$i"} =~ /\.(\d+)/);
260
    $dec_qty = length $dec_qty;
261
    $form->{"qty_$i"} =
262
      $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty);
263

  
264
    map { $form->{"${_}_$i"} =~ s/\"/"/g }
265
      qw(partnumber description unit);
266
  }
258 267

  
259 268
  $lxdebug->leave_sub();
260 269
}
......
883 892
      . $locale->text('Invoice') . qq|">
884 893
|;
885 894
  }
886
  
887 895

  
888 896
  if ($form->{menubar}) {
889 897
    require "$form->{path}/menu.pl";
......
983 991
        } else {
984 992

  
985 993
          $form->{"sellprice_$i"} *= (1 - $form->{tradediscount});
994

  
986 995
          # if there is an exchange rate adjust sellprice
987 996
          $form->{"sellprice_$i"} /= $exchangerate;
988 997
        }
......
1036 1045
    }
1037 1046
  }
1038 1047

  
1039

  
1040 1048
  $lxdebug->leave_sub();
1041 1049
}
1042 1050

  
......
1515 1523
    $subtotalnetamount += $oe->{netamount};
1516 1524
    $subtotalamount    += $oe->{amount};
1517 1525

  
1518
    $column_data{ids}    = qq|<td><input name="id_$j" class=checkbox type=checkbox><input type="hidden" name="trans_id_$j" value="$oe->{id}"></td>|;
1526
    $column_data{ids} =
1527
      qq|<td><input name="id_$j" class=checkbox type=checkbox><input type="hidden" name="trans_id_$j" value="$oe->{id}"></td>|;
1519 1528
    $column_data{id}        = "<td>$oe->{id}</td>";
1520 1529
    $column_data{transdate} = "<td>$oe->{transdate}&nbsp;</td>";
1521 1530
    $column_data{reqdate}   = "<td>$oe->{reqdate}&nbsp;</td>";
......
1581 1590
  </tr>
1582 1591
</table>|;
1583 1592

  
1584
# multiple invoice edit button only if gotten there via sales_order form.
1593
  # multiple invoice edit button only if gotten there via sales_order form.
1585 1594

  
1586
if ($form->{type} =~ /sales_order/) {
1587
print qq|
1595
  if ($form->{type} =~ /sales_order/) {
1596
    print qq|
1588 1597
  <input type="hidden" name="path" value="$form->{path}">
1589 1598
  <input class"submit" type="submit" name="action" value="|
1590
. $locale->text('Continue') .qq|">
1599
      . $locale->text('Continue') . qq|">
1591 1600
  <input type="hidden" name="nextsub" value="edit">
1592 1601
  <input type="hidden" name="type" value="$form->{type}">
1593 1602
  <input type="hidden" name="warehouse" value="$warehouse">
......
1596 1605
  <input type="hidden" name="password" value="$form->{password}">
1597 1606
  <input type="hidden" name="callback" value="$callback">
1598 1607
  <input type="hidden" name="rowcount" value="$form->{rowcount}">|;
1599
}
1608
  }
1600 1609

  
1601
print qq|
1610
  print qq|
1602 1611
</form>
1603 1612

  
1604 1613
<br>
......
1804 1813
  $lxdebug->enter_sub();
1805 1814

  
1806 1815
  if ($form->{type} =~ /_order$/) {
1816

  
1807 1817
    # these checks only apply if the items don't bring their own ordnumbers/transdates.
1808 1818
    # The if clause ensures that by searching for empty ordnumber_#/transdate_# fields.
1809
    $form->isblank("ordnumber", $locale->text('Order Number missing!')) if ( +{ map { $form->{"ordnumber_$_"}, 1 } ( 1 .. $form->{rowcount}-1 ) }->{''} );
1810
    $form->isblank("transdate", $locale->text('Order Date missing!'))   if ( +{ map { $form->{"transdate_$_"}, 1 } ( 1 .. $form->{rowcount}-1 ) }->{''} );
1819
    $form->isblank("ordnumber", $locale->text('Order Number missing!'))
1820
      if (+{ map { $form->{"ordnumber_$_"}, 1 } (1 .. $form->{rowcount} - 1) }
1821
          ->{''});
1822
    $form->isblank("transdate", $locale->text('Order Date missing!'))
1823
      if (+{ map { $form->{"transdate_$_"}, 1 } (1 .. $form->{rowcount} - 1) }
1824
          ->{''});
1811 1825

  
1812 1826
    # also copy deliverydate from the order
1813 1827
    $form->{deliverydate} = $form->{reqdate} if $form->{reqdate};
......
1846 1860
  # close orders/quotations
1847 1861
  $form->{closed} = 1;
1848 1862

  
1849
  # save order if one ordnumber has been given 
1863
  # save order if one ordnumber has been given
1850 1864
  # if not it's most likely a collective order, which can't be saved back
1851 1865
  # so they just have to be closed
1852 1866
  if (($form->{ordnumber} ne '') || ($form->{quonumber} ne '')) {
......
1927 1941
    $decimalplaces = ($dec > 2) ? $dec : 2;
1928 1942

  
1929 1943
    # copy delivery date from reqdate for order -> invoice conversion
1930
    $form->{"deliverydate_$i"} = $form->{"reqdate_$i"} unless $form->{"deliverydate_$i"};
1944
    $form->{"deliverydate_$i"} = $form->{"reqdate_$i"}
1945
      unless $form->{"deliverydate_$i"};
1931 1946

  
1932 1947
    $form->{"sellprice_$i"} =
1933 1948
      $form->format_amount(\%myconfig, $form->{"sellprice_$i"},
1934 1949
                           $decimalplaces);
1935
    
1950

  
1936 1951
    (my $dec_qty) = ($form->{"qty_$i"} =~ /\.(\d+)/);
1937
      $dec_qty      = length $dec_qty;
1938
    $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty);
1952
    $dec_qty = length $dec_qty;
1953
    $form->{"qty_$i"} =
1954
      $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty);
1939 1955

  
1940 1956
    map { $form->{"${_}_$i"} =~ s/\"/&quot;/g }
1941 1957
      qw(partnumber description unit);

Auch abrufbar als: Unified diff