Merge branch 'master' of lx-office.linet-services.de:lx-office-erp
authorSven Schöling <s.schoeling@linet-services.de>
Fri, 20 May 2011 11:08:50 +0000 (13:08 +0200)
committerSven Schöling <s.schoeling@linet-services.de>
Fri, 20 May 2011 11:08:50 +0000 (13:08 +0200)
SL/LxOfficeConf.pm
SL/VK.pm
bin/mozilla/ar.pl
bin/mozilla/do.pl
bin/mozilla/vk.pl
doc/changelog
scripts/task_server.pl
templates/webpages/vk/search_invoice.html

index 8f44016..7690eeb 100644 (file)
@@ -6,11 +6,15 @@ use Config::Std;
 use Encode;
 
 sub read {
+  my ($class, $file_name) = @_;
+
   read_config 'config/lx_office.conf.default' => %::lx_office_conf;
   _decode_recursively(\%::lx_office_conf);
 
-  if (-f 'config/lx_office.conf') {
-    read_config 'config/lx_office.conf' => my %local_conf;
+  $file_name ||= 'config/lx_office.conf';
+
+  if (-f $file_name) {
+    read_config $file_name => my %local_conf;
     _decode_recursively(\%local_conf);
     _flat_merge(\%::lx_office_conf, \%local_conf);
   }
index 458c351..13c7d7f 100644 (file)
--- a/SL/VK.pm
+++ b/SL/VK.pm
@@ -51,7 +51,7 @@ sub invoice_transactions {
   my @values;
 
   my $query =
-    qq|SELECT cus.name,ar.invnumber,ar.id,ar.transdate,p.partnumber,i.parts_id,i.qty,i.price_factor,i.discount,i.description,i.lastcost,i.sellprice,i.marge_total,i.marge_percent,i.unit | .
+    qq|SELECT cus.name,cus.customernumber,ar.invnumber,ar.id,ar.transdate,p.partnumber,i.parts_id,i.qty,i.price_factor,i.discount,i.description,i.lastcost,i.sellprice,i.marge_total,i.marge_percent,i.unit | .
     qq|FROM invoice i | .  
     qq|join ar on (i.trans_id = ar.id) | .
     qq|join parts p on (i.parts_id = p.id) | .
@@ -71,6 +71,10 @@ sub invoice_transactions {
     $where .= " AND ar.customer_id = ?";
     push(@values, $form->{customer_id});
   };
+  if ($form->{customernumber}) {
+    $where .= qq| AND cus.customernumber = ? |;
+    push(@values, $form->{customernumber});
+  }
   if ($form->{partnumber}) {
     $where .= qq| AND (p.partnumber ILIKE ?)|;
     push(@values, '%' . $form->{partnumber} . '%');
index 9a44f0e..fc318ec 100644 (file)
@@ -1340,7 +1340,7 @@ sub ar_transactions {
        marge_total marge_percent globalprojectnumber customernumber country ustid taxzone payment_terms charts customertype);
 
   my @hidden_variables = map { "l_${_}" } @columns;
-  push @hidden_variables, "l_subtotal", qw(open closed customer invnumber ordnumber transaction_description notes project_id transdatefrom transdateto employee_id salesman_id);
+  push @hidden_variables, "l_subtotal", qw(open closed customer invnumber ordnumber transaction_description notes project_id transdatefrom transdateto employee_id salesman_id business_id);
 
   $href = build_std_url('action=ar_transactions', grep { $form->{$_} } @hidden_variables);
 
index 99a2cc7..10deb0c 100644 (file)
@@ -34,6 +34,7 @@ use List::Util qw(max sum);
 use POSIX qw(strftime);
 use YAML;
 
+use SL::DB::DeliveryOrder;
 use SL::DO;
 use SL::IR;
 use SL::IS;
@@ -606,6 +607,8 @@ sub orders {
 sub save {
   $main::lxdebug->enter_sub();
 
+  my (%params) = @_;
+
   check_do_access();
 
   my $form     = $main::form;
@@ -656,7 +659,7 @@ sub save {
   # /saving the history
 
   $form->{simple_save} = 1;
-  if(!$form->{print_and_save}) {
+  if (!$params{no_redirect} && !$form->{print_and_save}) {
     set_headings("edit");
     update();
     ::end_of_request();
@@ -1245,6 +1248,8 @@ sub set_stock_out {
 sub transfer_in {
   $main::lxdebug->enter_sub();
 
+  save(no_redirect => 1);
+
   my $form     = $main::form;
   my %myconfig = %main::myconfig;
   my $locale   = $main::locale;
@@ -1289,6 +1294,7 @@ sub transfer_in {
     if (@{ $form->{ERRORS} }) {
       push @{ $form->{ERRORS} }, $locale->text('The delivery order has not been marked as delivered. The warehouse contents have not changed.');
 
+      set_headings('edit');
       update();
       $main::lxdebug->leave_sub();
 
@@ -1299,9 +1305,10 @@ sub transfer_in {
   DO->transfer_in_out('direction' => 'in',
                       'requests'  => \@all_requests);
 
-  $form->{delivered} = 1;
+  SL::DB::DeliveryOrder->new(id => $form->{id})->load->update_attributes(delivered => 1);
 
-  save();
+  $form->{callback} = 'do.pl?action=edit&type=purchase_delivery_order&id=' . $form->escape($form->{id});
+  $form->redirect;
 
   $main::lxdebug->leave_sub();
 }
@@ -1309,6 +1316,8 @@ sub transfer_in {
 sub transfer_out {
   $main::lxdebug->enter_sub();
 
+  save(no_redirect => 1);
+
   my $form     = $main::form;
   my %myconfig = %main::myconfig;
   my $locale   = $main::locale;
@@ -1350,7 +1359,7 @@ sub transfer_out {
 
       next if (0 == $row_sum_base_qty);
 
-      my $do_base_qty = $form->parse_amount(\%myconfig, $form->{"qty_$i"}) * $units->{$form->{"unit_$i"}}->{factor} / $base_unit_factor;
+      my $do_base_qty = $form->{"qty_$i"} * $units->{$form->{"unit_$i"}}->{factor} / $base_unit_factor;
 
 #      if ($do_base_qty != $row_sum_base_qty) {
 #        push @{ $form->{ERRORS} }, $locale->text('Error in position #1: You must either assign no transfer at all or the full quantity of #2 #3.',
@@ -1404,6 +1413,7 @@ sub transfer_out {
     if (@{ $form->{ERRORS} }) {
       push @{ $form->{ERRORS} }, $locale->text('The delivery order has not been marked as delivered. The warehouse contents have not changed.');
 
+      set_headings('edit');
       update();
       $main::lxdebug->leave_sub();
 
@@ -1413,9 +1423,10 @@ sub transfer_out {
   DO->transfer_in_out('direction' => 'out',
                       'requests'  => \@all_requests);
 
-  $form->{delivered} = 1;
+  SL::DB::DeliveryOrder->new(id => $form->{id})->load->update_attributes(delivered => 1);
 
-  save();
+  $form->{callback} = 'do.pl?action=edit&type=sales_delivery_order&id=' . $form->escape($form->{id});
+  $form->redirect;
 
   $main::lxdebug->leave_sub();
 }
index 5dba978..f7335a3 100644 (file)
@@ -90,8 +90,8 @@ sub invoice_transactions {
   if ( $form->{customer} =~ /--/ ) {
     # Felddaten kommen aus Dropdownbox
     ($form->{customername}, $form->{customer_id}) = split(/--/, $form->{customer});
-  } else {
-    # Felddaten kommen aus Freitextfeld
+  } elsif ($form->{customer}) {
+    # es wurde ein Wert im Freitextfeld übergeben, auf Eindeutigkeit überprüfen
 
     # check_name wird mit no_select => 1 ausgeführt, ist die Abfrage nicht eindeutig kommt ein Fehler
     # und die Abfrage muß erneut ausgeführt werden
@@ -100,10 +100,11 @@ sub invoice_transactions {
     # Nichts führt, daher diese Zwischenlösung
 
     &check_name('customer', no_select => 1);
-
+  
     # $form->{customer_id} wurde schon von check_name gesetzt
     $form->{customername} = $form->{customer};
   };
+  # ist $form->{customer} leer passiert hier nichts weiter
 
   # decimalplaces überprüfen oder auf Default 2 setzen
   $form->{decimalplaces} = 2 unless $form->{decimalplaces} > 0 && $form->{decimalplaces} < 6;
@@ -124,12 +125,12 @@ sub invoice_transactions {
   $form->{title} = $locale->text('Sales Report');
 
   @columns =
-    qw(description invnumber partnumber parts_id transdate qty unit sellprice sellprice_total discount lastcost lastcost_total marge_total marge_percent);
+    qw(description invnumber transdate customernumber partnumber transdate qty unit sellprice sellprice_total discount lastcost lastcost_total marge_total marge_percent);
 
   # hidden variables für pdf/csv export übergeben
   # einmal mit l_ um zu bestimmen welche Spalten ausgegeben werden sollen
   # einmal optionen für die Überschrift (z.B. transdatefrom, partnumber, ...)
-  my @hidden_variables  = (qw(l_headers l_subtotal l_total transdatefrom transdateto decimalplaces customer customername customer_id department partnumber description project_id), "$form->{db}number", map { "l_$_" } @columns);
+  my @hidden_variables  = (qw(l_headers l_subtotal l_total l_customernumber transdatefrom transdateto decimalplaces customer customername customer_id department partnumber description project_id customernumber), "$form->{db}number", map { "l_$_" } @columns);
   my @hidden_nondefault = grep({ $form->{$_} } @hidden_variables);
   # Variablen werden dann als Hidden Variable mitgegeben, z.B.
   # <input type="hidden" name="report_generator_hidden_transdateto" value="21.05.2010">
@@ -151,6 +152,7 @@ sub invoice_transactions {
     'lastcost'                => { 'text' => $locale->text('Purchase price'), },
     'marge_total'             => { 'text' => $locale->text('Sales margin'), },
     'marge_percent'           => { 'text' => $locale->text('Sales margin %'), },
+    'customernumber'          => { 'text' => $locale->text('Customer Number'), },
   );
 
   my %column_alignment = map { $_ => 'right' } qw(lastcost sellprice sellprice_total lastcost_total unit discount marge_total marge_percent qty);
@@ -166,6 +168,9 @@ sub invoice_transactions {
   if ($form->{customer}) {
     push @options, $locale->text('Customer') . " : $form->{customername}";
   }
+  if ($form->{customernumber}) {
+    push @options, $locale->text('Customer Number') . " : $form->{customernumber}";
+  }
   if ($form->{department}) {
     my ($department) = split /--/, $form->{department};
     push @options, $locale->text('Department') . " : $department";
@@ -334,7 +339,7 @@ sub invoice_transactions {
         $name = 'name';
       };
 
-      if ($form->{l_subtotal} eq 'Y' ) {
+      if ($form->{l_subtotal} eq 'Y') {
         push @{ $row_set }, create_subtotal_row_invoice(\%subtotals2, \@columns, \%column_alignment, \@subtotal_columns, 'listsubsortsubtotal', $ar->{$name}) ;
         push @{ $row_set }, insert_empty_row();
       };
index 03a8f54..df1ca3c 100644 (file)
   - Dokumentensystem -> viele Zahlenwerte sind nun auch in nicht fromatierter Form (alos ungerundet und mit . als Dezimaltrennzeichen) in den Dokumenten verfügbar.
                         Variabelenerweiterung: _nofmt, siehe doc/dokumentenvorlagen-und-variablen.html
 
+  - Bedienung -> Eingabe beliebiger mathematischer Funktionen bestehend aus +-*/() in alle Zahlenfelder
+                 das ermoeglicht z.B. die nettopreisangabe "100/1,19", was dann als "84,033613" gespeichert wird.
+                 Berücksichtigt das beim Benutzer eingestellte Zahlenformat.
+
+
   Liste gefixter Bugs aus dem Bugtracker:
 
-  - Bugfix 1613: Status teilweise
+  - Bugfix 1613: Abteilung wird bei Verkaufsrechnungen nicht gespeichert
   - Bugfix 1642: Lieferantenrabatt wird korrekt gespeichert, aber nicht mehr angezeigt
   - Bugfix 1626: Beim Festlegen der Standardkonten kann beim Warenbestand eine Überschrift ausgewählt werden.
   - Bugfix 1584: Summen und Saldenliste: Export to PDF/CSV in EÜR Modus falsch
index c2061b7..1931b6a 100755 (executable)
@@ -33,10 +33,6 @@ use SL::Locale;
 
 our %lx_office_conf;
 
-# this is a cleaned up version of am.pl
-# it lacks redirection, some html setup and most of the authentication process.
-# it is assumed that anyone with physical access and execution rights on this script
-# won't be hindered by authentication anyway.
 sub lxinit {
   my $login = $lx_office_conf{task_server}->{login};
 
@@ -89,7 +85,7 @@ sub drop_privileges {
 sub gd_preconfig {
   my $self = shift;
 
-  SL::LxOfficeConf->read;
+  SL::LxOfficeConf->read($self->{configfile});
 
   die "Missing section [task_server] in config file"                unless $lx_office_conf{task_server};
   die "Missing key 'login' in section [task_server] in config file" unless $lx_office_conf{task_server}->{login};
index 70815b5..098cd40 100644 (file)
                  -%]
       </td>
      </tr>
+      <tr>
+       <th align="right" nowrap>[% 'Customer Number' | $T8 %]</th>
+       <td><input name="customernumber" size="20"></td>
+      </tr>
      <tr>
       <th align=right nowrap>[% 'Department' | $T8 %]</th>
       <td>
            <td align=right><input name="l_headers" class=checkbox type=checkbox value="Y" checked></td>
            <td nowrap>[% 'Headings' | $T8 %]</td>
           </tr>
+          <tr>
+           <td align=right><input name="l_customernumber" class=checkbox type=checkbox value=Y checked></td>
+           <td nowrap>[% 'Customer Number' | $T8 %]</td>
+          </tr>
           <tr>
             <th align="right" nowrap>[% 'Decimalplaces' | $T8 %]</th>
             <td colspan="4"><input name="decimalplaces" size="2" value="2"></td>