]> wagnertech.de Git - mfinanz.git/commitdiff
Merge pull request #18 from robert-scheck/vatno
authorMoritz Bunkus <moritz@bunkus.org>
Wed, 4 Apr 2018 07:37:29 +0000 (09:37 +0200)
committerGitHub <noreply@github.com>
Wed, 4 Apr 2018 07:37:29 +0000 (09:37 +0200)
Use consistently shortening "USt-IdNr." according to German BZSt

.htaccess
SL/.htaccess
SL/Controller/Order.pm
SL/DB/Order.pm
bin/mozilla/.htaccess
config/.htaccess
locale/.htaccess
scripts/.htaccess
t/.htaccess
templates/.htaccess

index 66862278afaaa15da5adf6a7157197885ef8542a..977b220d9ce9316884f3e92e209b654c17f107b8 100644 (file)
--- a/.htaccess
+++ b/.htaccess
@@ -1,11 +1,19 @@
 ### Choose a character set (just in case you like to change it here)
-### uncommit the line you wish to activate
+### uncomment the line you wish to activate
 #AddDefaultCharset ISO-8859-15
 #AddDefaultCharset UTF-8
 
 ### simple access control by client ip
-### uncomment the lines starting with Order ..., Deny ... and Allow ...
-### examples: "Allow from 192.168" or "Allow from 192.168.1" or "Allow from 192.168.178" or "Allow from 217.84.201.2"
-#Order deny,allow
-#Deny from all
-#Allow from 192.168
+### uncomment the lines starting with <IfModule ...> until last </IfModule>
+### examples for Apache >= 2.4: "Require ip 192.168" or "Require ip 192.168.1" or "Require ip 192.168.178" or "Require ip 217.84.201.2"
+### examples for Apache <= 2.2: "Allow from 192.168" or "Allow from 192.168.1" or "Allow from 192.168.178" or "Allow from 217.84.201.2"
+#<IfModule mod_authz_core.c>
+#  # Apache 2.4
+#  Require ip 192.168
+#</IfModule>
+#<IfModule !mod_authz_core.c>
+#  # Apache 2.2
+#  Order deny,allow
+#  Deny from all
+#  Allow from 192.168
+#</IfModule>
index 0a9a0473a5b834c168eff9800e1521197ac9a752..cde5b443702095082d9aa138b7312e7cffffefa0 100644 (file)
@@ -1,2 +1,9 @@
-Order Allow,Deny
-Deny from all
+<IfModule mod_authz_core.c>
+  # Apache 2.4
+  Require all denied
+</IfModule>
+<IfModule !mod_authz_core.c>
+  # Apache 2.2
+  Order deny,allow
+  Deny from all
+</IfModule>
index b3477b2e3d2652d1575f6173c29205c9b2ebfd9f..36896ee11d4b997b3ae5ac58d423b1cb93ab1539 100644 (file)
@@ -137,32 +137,44 @@ sub action_save {
 sub action_save_as_new {
   my ($self) = @_;
 
-  if (!$self->order->id) {
+  my $order = $self->order;
+
+  if (!$order->id) {
     $self->js->flash('error', t8('This object has not been saved yet.'));
     return $self->js->render();
   }
 
-  delete $::form->{$_} for qw(closed delivered converted_from_oe_id converted_from_orderitems_ids);
-
-  my $src_order = SL::DB::Order->new(id => $self->order->id)->load;
+  # load order from db to check if values changed
+  my $saved_order = SL::DB::Order->new(id => $order->id)->load;
 
+  my %new_attrs;
   # Lets assign a new number if the user hasn't changed the previous one.
   # If it has been changed manually then use it as-is.
-  if (trim($self->order->number) eq $src_order->number) {
-    $self->order->number('');
-  }
+  $new_attrs{number}    = (trim($order->number) eq $saved_order->number)
+                        ? ''
+                        : trim($order->number);
 
-  # Clear reqdate and transdate unless changed
-  if ($self->order->transdate == $src_order->transdate) {
-    $self->order->transdate(DateTime->today_local)
-  }
-  if ($self->order->reqdate == $src_order->reqdate) {
+  # Clear transdate unless changed
+  $new_attrs{transdate} = ($order->transdate == $saved_order->transdate)
+                        ? DateTime->today_local
+                        : $order->transdate;
+
+  # Set new reqdate unless changed
+  if ($order->reqdate == $saved_order->reqdate) {
     my $extra_days = $self->type eq _sales_quotation_type() ? $::instance_conf->get_reqdate_interval : 1;
-    $self->order->reqdate(DateTime->today_local->next_workday(extra_days => $extra_days));
+    $new_attrs{reqdate} = DateTime->today_local->next_workday(extra_days => $extra_days);
+  } else {
+    $new_attrs{reqdate} = $order->reqdate;
   }
 
   # Update employee
-  $self->order->employee(SL::DB::Manager::Employee->current);
+  $new_attrs{employee}  = SL::DB::Manager::Employee->current;
+
+  # Create new record from current one
+  $self->order(SL::DB::Order->new_from($order, destination_type => $order->type, attributes => \%new_attrs));
+
+  # no linked records on save as new
+  delete $::form->{$_} for qw(converted_from_oe_id converted_from_orderitems_ids);
 
   # save
   $self->action_save();
index 31f6ad4a34a03e60d75902f8c05e640c45a68866..6baa0e20dc7905f0fa70e493dbb86115a23758ee 100644 (file)
@@ -205,8 +205,12 @@ sub new_from {
   croak("A destination type must be given parameter")            unless $params{destination_type};
 
   my $destination_type  = delete $params{destination_type};
-  my $src_dst_allowed   = ('sales_quotation'   eq $source->type && 'sales_order'    eq $destination_type)
-                       || ('request_quotation' eq $source->type && 'purchase_order' eq $destination_type);
+  my $src_dst_allowed   = ('sales_quotation'   eq $source->type && 'sales_order'       eq $destination_type)
+                       || ('request_quotation' eq $source->type && 'purchase_order'    eq $destination_type)
+                       || ('sales_quotation'   eq $source->type && 'sales_quotation'   eq $destination_type)
+                       || ('sales_order'       eq $source->type && 'sales_order'       eq $destination_type)
+                       || ('request_quotation' eq $source->type && 'request_quotation' eq $destination_type)
+                       || ('purchase_order'    eq $source->type && 'purchase_order'    eq $destination_type);
   croak("Cannot convert from '" . $source->type . "' to '" . $destination_type . "'") unless $src_dst_allowed;
 
   my ($item_parent_id_column, $item_parent_column);
@@ -221,7 +225,7 @@ sub new_from {
                                                 ordnumber payment_id quonumber reqdate salesman_id shippingpoint shipvia taxincluded taxzone_id
                                                 transaction_description vendor_id
                                              )),
-               quotation => 0,
+               quotation => !!($destination_type =~ m{quotation$}),
                closed    => 0,
                delivered => 0,
                transdate => DateTime->today_local,
@@ -229,7 +233,7 @@ sub new_from {
 
   # Custom shipto addresses (the ones specific to the sales/purchase
   # record and not to the customer/vendor) are only linked from
-  # shipto → delivery_orders. Meaning delivery_orders.shipto_id
+  # shipto → order. Meaning order.shipto_id
   # will not be filled in that case.
   if (!$source->shipto_id && $source->id) {
     $args{custom_shipto} = $source->custom_shipto->clone($class) if $source->can('custom_shipto') && $source->custom_shipto;
@@ -372,7 +376,8 @@ At the moment only sales quotations and sales orders can be converted.
 =head2 C<new_from $source, %params>
 
 Creates a new C<SL::DB::Order> instance and copies as much
-information from C<$source> as possible. At the moment only sales orders from
+information from C<$source> as possible. At the moment only records with the
+same destination type as the source type and sales orders from
 sales quotations and purchase orders from requests for quotations can be
 created.
 
@@ -391,8 +396,8 @@ C<%params> can include the following options
 =item C<destination_type>
 
 (mandatory)
-The type of the newly created object. Can be C<sales_order> or
-C<purchase_order> for now.
+The type of the newly created object. Can be C<sales_quotation>,
+C<sales_order>, C<purchase_quotation> or C<purchase_order> for now.
 
 =item C<items>
 
index 0a9a0473a5b834c168eff9800e1521197ac9a752..cde5b443702095082d9aa138b7312e7cffffefa0 100644 (file)
@@ -1,2 +1,9 @@
-Order Allow,Deny
-Deny from all
+<IfModule mod_authz_core.c>
+  # Apache 2.4
+  Require all denied
+</IfModule>
+<IfModule !mod_authz_core.c>
+  # Apache 2.2
+  Order deny,allow
+  Deny from all
+</IfModule>
index 0a9a0473a5b834c168eff9800e1521197ac9a752..cde5b443702095082d9aa138b7312e7cffffefa0 100644 (file)
@@ -1,2 +1,9 @@
-Order Allow,Deny
-Deny from all
+<IfModule mod_authz_core.c>
+  # Apache 2.4
+  Require all denied
+</IfModule>
+<IfModule !mod_authz_core.c>
+  # Apache 2.2
+  Order deny,allow
+  Deny from all
+</IfModule>
index 0a9a0473a5b834c168eff9800e1521197ac9a752..cde5b443702095082d9aa138b7312e7cffffefa0 100644 (file)
@@ -1,2 +1,9 @@
-Order Allow,Deny
-Deny from all
+<IfModule mod_authz_core.c>
+  # Apache 2.4
+  Require all denied
+</IfModule>
+<IfModule !mod_authz_core.c>
+  # Apache 2.2
+  Order deny,allow
+  Deny from all
+</IfModule>
index 0a9a0473a5b834c168eff9800e1521197ac9a752..cde5b443702095082d9aa138b7312e7cffffefa0 100644 (file)
@@ -1,2 +1,9 @@
-Order Allow,Deny
-Deny from all
+<IfModule mod_authz_core.c>
+  # Apache 2.4
+  Require all denied
+</IfModule>
+<IfModule !mod_authz_core.c>
+  # Apache 2.2
+  Order deny,allow
+  Deny from all
+</IfModule>
index 0a9a0473a5b834c168eff9800e1521197ac9a752..cde5b443702095082d9aa138b7312e7cffffefa0 100644 (file)
@@ -1,2 +1,9 @@
-Order Allow,Deny
-Deny from all
+<IfModule mod_authz_core.c>
+  # Apache 2.4
+  Require all denied
+</IfModule>
+<IfModule !mod_authz_core.c>
+  # Apache 2.2
+  Order deny,allow
+  Deny from all
+</IfModule>
index 0a9a0473a5b834c168eff9800e1521197ac9a752..cde5b443702095082d9aa138b7312e7cffffefa0 100644 (file)
@@ -1,2 +1,9 @@
-Order Allow,Deny
-Deny from all
+<IfModule mod_authz_core.c>
+  # Apache 2.4
+  Require all denied
+</IfModule>
+<IfModule !mod_authz_core.c>
+  # Apache 2.2
+  Order deny,allow
+  Deny from all
+</IfModule>