Option für Datev-Check in Mandantenkonfiguration verschoben.
authorBernd Bleßmann <bernd@kivitendo-premium.de>
Fri, 2 Nov 2012 11:17:25 +0000 (12:17 +0100)
committerBernd Bleßmann <bernd@kivitendo-premium.de>
Fri, 2 Nov 2012 12:45:22 +0000 (13:45 +0100)
14 files changed:
SL/AP.pm
SL/AR.pm
SL/Controller/ClientConfig.pm
SL/DB/MetaSetup/Default.pm
SL/GL.pm
SL/IR.pm
SL/IS.pm
SL/InstanceConfiguration.pm
config/kivitendo.conf.default
locale/de/all
locale/de_DE/all
locale/en/all
sql/Pg-upgrade2/defaults_datev_check.pl [new file with mode: 0644]
templates/webpages/client_config/form.html

index 839d40b..95bde38 100644 (file)
--- a/SL/AP.pm
+++ b/SL/AP.pm
@@ -355,7 +355,7 @@ sub post_transaction {
   IO->set_datepaid(table => 'ap', id => $form->{id}, dbh => $dbh);
 
   # safety check datev export
-  if ($::lx_office_conf{datev_check}{check_on_ap_transaction}) {
+  if ($::instance_conf->get_datev_check_on_ap_transaction) {
     my $transdate = $::form->{transdate} ? DateTime->from_lxoffice($::form->{transdate}) : undef;
     $transdate  ||= DateTime->today;
 
index fcf898e..1f8a0c0 100644 (file)
--- a/SL/AR.pm
+++ b/SL/AR.pm
@@ -276,7 +276,7 @@ sub post_transaction {
   IO->set_datepaid(table => 'ar', id => $form->{id}, dbh => $dbh);
 
   # safety check datev export
-  if ($::lx_office_conf{datev_check}{check_on_ar_transaction}) {
+  if ($::instance_conf->get_datev_check_on_ar_transaction) {
     my $transdate = $::form->{transdate} ? DateTime->from_lxoffice($::form->{transdate}) : undef;
     $transdate  ||= DateTime->today;
 
index 97ff15a..e6e6878 100644 (file)
@@ -19,6 +19,12 @@ sub action_edit {
   $self->{payments_changeable} = SL::DB::Default->get->payments_changeable;
   $self->{show_bestbefore}     = SL::DB::Default->get->show_bestbefore;
 
+  map { $self->{$_} = SL::DB::Default->get->$_ } qw(datev_check_on_sales_invoice datev_check_on_purchase_invoice datev_check_on_ar_transaction datev_check_on_ap_transaction datev_check_on_gl_transaction);
+  # datev check: not implemented yet:
+  #check_on_cash_and_receipt = 0
+  #check_on_dunning = 0
+  #check_on_sepa_import = 0
+
   $self->render('client_config/form', title => $::locale->text('Client Configuration'));
 }
 
@@ -29,6 +35,8 @@ sub action_save {
   SL::DB::Default->get->update_attributes('payments_changeable' => $::form->{payments_changeable});
   SL::DB::Default->get->update_attributes('show_bestbefore'     => $::form->{show_bestbefore});
 
+  map { SL::DB::Default->get->update_attributes($_ => $::form->{$_}); } qw(datev_check_on_sales_invoice datev_check_on_purchase_invoice datev_check_on_ar_transaction datev_check_on_ap_transaction datev_check_on_gl_transaction);
+
   flash_later('info', $::locale->text('Client Configuration saved!'));
 
   $self->redirect_to(action => 'edit');
index 8920ef5..0822368 100644 (file)
@@ -10,45 +10,50 @@ __PACKAGE__->meta->setup(
   table   => 'defaults',
 
   columns => [
-    inventory_accno_id         => { type => 'integer' },
-    income_accno_id            => { type => 'integer' },
-    expense_accno_id           => { type => 'integer' },
-    fxgain_accno_id            => { type => 'integer' },
-    fxloss_accno_id            => { type => 'integer' },
-    invnumber                  => { type => 'text' },
-    sonumber                   => { type => 'text' },
-    weightunit                 => { type => 'varchar', length => 5 },
-    businessnumber             => { type => 'text' },
-    version                    => { type => 'varchar', length => 8 },
-    curr                       => { type => 'text' },
-    closedto                   => { type => 'date' },
-    revtrans                   => { type => 'boolean', default => 'false' },
-    ponumber                   => { type => 'text' },
-    sqnumber                   => { type => 'text' },
-    rfqnumber                  => { type => 'text' },
-    customernumber             => { type => 'text' },
-    vendornumber               => { type => 'text' },
-    audittrail                 => { type => 'boolean', default => 'false' },
-    articlenumber              => { type => 'text' },
-    servicenumber              => { type => 'text' },
-    coa                        => { type => 'text' },
-    itime                      => { type => 'timestamp', default => 'now()' },
-    mtime                      => { type => 'timestamp' },
-    rmanumber                  => { type => 'text' },
-    cnnumber                   => { type => 'text' },
-    dunning_ar_amount_fee      => { type => 'integer' },
-    dunning_ar_amount_interest => { type => 'integer' },
-    dunning_ar                 => { type => 'integer' },
-    pdonumber                  => { type => 'text' },
-    sdonumber                  => { type => 'text' },
-    ar_paid_accno_id           => { type => 'integer' },
-    id                         => { type => 'serial', not_null => 1 },
-    accounting_method          => { type => 'text' },
-    inventory_system           => { type => 'text' },
-    profit_determination       => { type => 'text' },
-    language_id                => { type => 'integer' },
-    payments_changeable        => { type => 'integer', default => '0', not_null => 1 },
-    show_bestbefore            => { type => 'boolean', default => 'false' },
+    inventory_accno_id              => { type => 'integer' },
+    income_accno_id                 => { type => 'integer' },
+    expense_accno_id                => { type => 'integer' },
+    fxgain_accno_id                 => { type => 'integer' },
+    fxloss_accno_id                 => { type => 'integer' },
+    invnumber                       => { type => 'text' },
+    sonumber                        => { type => 'text' },
+    weightunit                      => { type => 'varchar', length => 5 },
+    businessnumber                  => { type => 'text' },
+    version                         => { type => 'varchar', length => 8 },
+    curr                            => { type => 'text' },
+    closedto                        => { type => 'date' },
+    revtrans                        => { type => 'boolean', default => 'false' },
+    ponumber                        => { type => 'text' },
+    sqnumber                        => { type => 'text' },
+    rfqnumber                       => { type => 'text' },
+    customernumber                  => { type => 'text' },
+    vendornumber                    => { type => 'text' },
+    audittrail                      => { type => 'boolean', default => 'false' },
+    articlenumber                   => { type => 'text' },
+    servicenumber                   => { type => 'text' },
+    coa                             => { type => 'text' },
+    itime                           => { type => 'timestamp', default => 'now()' },
+    mtime                           => { type => 'timestamp' },
+    rmanumber                       => { type => 'text' },
+    cnnumber                        => { type => 'text' },
+    dunning_ar_amount_fee           => { type => 'integer' },
+    dunning_ar_amount_interest      => { type => 'integer' },
+    dunning_ar                      => { type => 'integer' },
+    pdonumber                       => { type => 'text' },
+    sdonumber                       => { type => 'text' },
+    ar_paid_accno_id                => { type => 'integer' },
+    id                              => { type => 'serial', not_null => 1 },
+    accounting_method               => { type => 'text' },
+    inventory_system                => { type => 'text' },
+    profit_determination            => { type => 'text' },
+    language_id                     => { type => 'integer' },
+    payments_changeable             => { type => 'integer', default => '0', not_null => 1 },
+    show_bestbefore                 => { type => 'boolean', default => 'false' },
+    datev_check_on_sales_invoice    => { type => 'boolean', default => 'true' },
+    datev_check_on_purchase_invoice => { type => 'boolean', default => 'true' },
+    datev_check_on_ar_transaction   => { type => 'boolean', default => 'true' },
+    datev_check_on_ap_transaction   => { type => 'boolean', default => 'true' },
+    datev_check_on_gl_transaction   => { type => 'boolean', default => 'true' },
   ],
 
   primary_key_columns => [ 'id' ],
index cdd9d40..c9fcd9c 100644 (file)
--- a/SL/GL.pm
+++ b/SL/GL.pm
@@ -186,7 +186,7 @@ sub post_transaction {
   }
 
   # safety check datev export
-  if ($::lx_office_conf{datev_check}{check_on_gl_transaction}) {
+  if ($::instance_conf->get_datev_check_on_gl_transaction) {
     my $transdate = $::form->{transdate} ? DateTime->from_lxoffice($::form->{transdate}) : undef;
     $transdate  ||= DateTime->today;
 
index 7be04ae..04e071e 100644 (file)
--- a/SL/IR.pm
+++ b/SL/IR.pm
@@ -686,7 +686,7 @@ sub post_invoice {
                                'table'   => 'ap',);
 
   # safety check datev export
-  if ($::lx_office_conf{datev_check}{check_on_purchase_invoice}) {
+  if ($::instance_conf->get_datev_check_on_purchase_invoice) {
     my $transdate = $::form->{invdate} ? DateTime->from_lxoffice($::form->{invdate}) : undef;
     $transdate  ||= DateTime->today;
 
index 8f00225..db18d5a 100644 (file)
--- a/SL/IS.pm
+++ b/SL/IS.pm
@@ -1077,7 +1077,7 @@ sub post_invoice {
                                'table'   => 'ar',);
 
   # safety check datev export
-  if ($::lx_office_conf{datev_check}{check_on_sales_invoice}) {
+  if ($::instance_conf->get_datev_check_on_sales_invoice) {
     my $transdate = $::form->{invdate} ? DateTime->from_lxoffice($::form->{invdate}) : undef;
     $transdate  ||= DateTime->today;
 
index 4629e94..58025ce 100644 (file)
@@ -49,6 +49,31 @@ sub get_profit_determination {
   return $self->{data}->{profit_determination};
 }
 
+sub get_datev_check_on_sales_invoice {
+  my ($self) = @_;
+  return $self->{data}->{datev_check_on_sales_invoice};
+}
+
+sub get_datev_check_on_purchase_invoice {
+  my ($self) = @_;
+  return $self->{data}->{datev_check_on_purchase_invoice};
+}
+
+sub get_datev_check_on_ar_transaction {
+  my ($self) = @_;
+  return $self->{data}->{datev_check_on_ar_transaction};
+}
+
+sub get_datev_check_on_ap_transaction {
+  my ($self) = @_;
+  return $self->{data}->{datev_check_on_ap_transaction};
+}
+
+sub get_datev_check_on_gl_transaction {
+  my ($self) = @_;
+  return $self->{data}->{datev_check_on_gl_transaction};
+}
+
 sub get_show_bestbefore {
   my ($self) = @_;
   return $self->{data}->{show_bestbefore};
@@ -106,6 +131,26 @@ Returns the default inventory system, perpetual or periodic
 
 Returns the default profit determination method, balance or income
 
+=item C<get_datev_check_on_sales_invoice>
+
+Returns true if datev check should be performed on sales invoices
+
+=item C<get_datev_check_on_purchase_invoice>
+
+Returns true if datev check should be performed on purchase invoices
+
+=item C<get_datev_check_on_ar_transaction>
+
+Returns true if datev check should be performed on ar transactions
+
+=item C<get_datev_check_on_ap_transaction>
+
+Returns true if datev check should be performed on ap transactions
+
+=item C<get_datev_check_on_gl_transaction>
+
+Returns true if datev check should be performed on gl transactions
+
 =item C<get_show_bestbefore>
 
 Returns the default behavior for showing best before date, true or false
index e3d5adb..96a7d42 100644 (file)
@@ -198,27 +198,6 @@ email_subject  = kivitendo self test report
 # template. currently txt and html templates are recognized and correctly mime send.
 email_template = templates/mail/self_test/status_mail.txt
 
-[datev_check]
-# it is possible to make a quick DATEV export everytime you post a record to ensure things
-# work nicely with their data requirements. This will result in a slight overhead though
-# you can enable this for each type of record independantly.
-
-# check when a sales invoice or a payment for a sales invoice is posted
-check_on_sales_invoice = 1
-# check when a purchase invoice or a payment for a purchase invoice is posted
-check_on_purchase_invoice = 1
-# check when an ar transaction is posted
-check_on_ar_transaction = 1
-# check when an ap transaction is posted
-check_on_ap_transaction = 1
-# check when a gl transaction is posted
-check_on_gl_transaction = 1
-
-# not implemented yet:
-#check_on_cash_and_receipt = 0
-#check_on_dunning = 0
-#check_on_sepa_import = 0
-
 [console]
 # autologin to use if none is given
 login =
index 1ee4ea3..63a677d 100644 (file)
@@ -399,6 +399,11 @@ $self->{texts} = {
   'Check'                       => 'Scheck',
   'Check Details'               => 'Bitte Angaben überprüfen',
   'Check for duplicates'        => 'Dublettencheck',
+  'Check on ap transaction'     => 'Prüfen bei Kreditorenbuchung',
+  'Check on ar transaction'     => 'Prüfen bei Debitorenbuchung',
+  'Check on gl transaction'     => 'Prüfen bei Dialogbuchung',
+  'Check on purchase invoice'   => 'Prüfen bei Einkaufsrechnung',
+  'Check on sales invoice'      => 'Prüfen bei Verkaufsrechnung',
   'Checks'                      => 'Schecks',
   'Choose Customer'             => 'Endkunde wählen:',
   'Choose Outputformat'         => 'Ausgabeformat auswählen...',
@@ -542,6 +547,7 @@ $self->{texts} = {
   'DATEV - Export Assistent'    => 'DATEV-Exportassistent',
   'DATEV Angaben'               => 'DATEV-Angaben',
   'DATEV Export'                => 'DATEV-Export',
+  'DATEV check configuration'   => 'Einstellungen für DATEV-Prüfung',
   'DATEV check returned errors:' => 'Die DATEV Prüfung dieser Buchung ergab Fehler:',
   'DATEX - Export Assistent'    => 'DATEV-Exportassistent',
   'DELETED'                     => 'Gelöscht',
@@ -1036,6 +1042,7 @@ $self->{texts} = {
   'It is possible that even after such a correction there is something wrong with this transaction (e.g. taxes that don\'t match the selected taxkey). Therefore you should re-run the general ledger analysis.' => 'Auch nach einer Korrektur kann es mit dieser Buchung noch weitere Probleme geben (z.B. nicht zum Steuerschlüssel passende Steuern), weshalb ein erneutes Ausführen der Hauptbuchanalyse empfohlen wird.',
   'It is possible to do this automatically for some Buchungsgruppen, but not for all.' => 'Es ist m&ouml;glich, dies f&uuml;r einige, aber nicht f&uuml;r alle Buchungsgruppen automatisch zu erledigen.',
   'It is possible to do this automatically for some units, but for others the user has to chose the new unit.' => 'Das ist f&uuml;r einige Einheiten automatisch m&ouml;glich, aber bei anderen muss der Benutzer die neue Einheit ausw&auml;hlen.',
+  'It is possible to make a quick DATEV export everytime you post a record to ensure things work nicely with their data requirements. This will result in a slight overhead though you can enable this for each type of record independantly.' => 'Es ist möglich, bei jeder Buchung einen schnellen DATEV-Export durchzuführen, um sicherzustellen, dass die Datensätze den DATEV-Anforderungen genügen. Da dies einen kleinen Overhead bedeutet, lässt sich dei Einstellung für jeden Buchungstyp getrennt einstellen.',
   'It may optionally be compressed with &quot;gzip&quot;.' => 'Sie darf optional mit &quot;gzip&quot; komprimiert sein.',
   'It will simply set the taxkey to 0 (meaning "no taxes") which is the correct value for such inventory transactions.' => 'Es wird einfach die Steuerschlüssel auf  0 setzen, was "keine Steuer" bedeutet und für solche Warenbestandsbuchungen der richtige Wert ist.',
   'Item deleted!'               => 'Artikel gelöscht!',
@@ -1375,6 +1382,11 @@ $self->{texts} = {
   'Payments'                    => 'Zahlungsausgänge',
   'Payments Changeable'         => 'Änderbarkeit von Zahlungen',
   'Per. Inv.'                   => 'Wied. Rech.',
+  'Perform check when a gl transaction is posted?' => 'Prüfung durchführen, wenn eine Dialogbuchung gebucht wird?',
+  'Perform check when a purchase invoice or a payment for a purchase invoice is posted?' => 'Prüfung durchführen, wenn eine Einkaufsrechnung oder ein Zahlungsausgang hierfür gebucht wird?',
+  'Perform check when a sales invoice or a payment for a sales invoice is posted?' => 'Prüfung durchführen, wenn eine Verkaufsrechnung oder ein Zahlungseingang hierfür gebucht wird?',
+  'Perform check when an ap transaction is posted?' => 'Prüfung durchführen, wenn Kreditorenbuchung gebucht wird?',
+  'Perform check when an ar transaction is posted?' => 'Prüfung durchführen, wenn Debiotorenbuchung gebucht wird?',
   'Period'                      => 'Zeitraum',
   'Period:'                     => 'Zeitraum:',
   'Periodic Invoices'           => 'Wiederkehrende Rechnungen',
@@ -2353,8 +2365,8 @@ $self->{texts} = {
   'not yet executed'            => 'Noch nicht ausgeführt',
   'number'                      => 'Nummer',
   'oe.pl::search called with unknown type' => 'oe.pl::search mit unbekanntem Typ aufgerufen',
-  'one-time execution'          => 'einmalige Ausführung',
   'on the same day'             => 'am selben Tag',
+  'one-time execution'          => 'einmalige Ausführung',
   'only OB Transactions'        => 'nur EB-Buchungen',
   'open'                        => 'Offen',
   'order'                       => 'Reihenfolge',
index f90ecaf..cd9ba90 100644 (file)
@@ -390,6 +390,11 @@ $self->{texts} = {
   'Check'                       => 'Scheck',
   'Check Details'               => 'Bitte Angaben überprüfen',
   'Check for duplicates'        => 'Dublettencheck',
+  'Check on ap transaction'     => 'Prüfen bei Kreditorenbuchung',
+  'Check on ar transaction'     => 'Prüfen bei Debitorenbuchung',
+  'Check on gl transaction'     => 'Prüfen bei Dialogbuchung',
+  'Check on purchase invoice'   => 'Prüfen bei Einkaufsrechnung',
+  'Check on sales invoice'      => 'Prüfen bei Verkaufsrechnung',
   'Checks'                      => 'Schecks',
   'Choose Customer'             => 'Endkunde wählen:',
   'Choose Outputformat'         => 'Ausgabeformat auswählen...',
@@ -520,6 +525,7 @@ $self->{texts} = {
   'Customers'                   => 'Kunden',
   'Customers and vendors'       => 'Kunden und Lieferanten',
   'Customized Report'           => 'Vorgewählte Zeiträume',
+  'DATEV check configuration'   => 'Einstellungen für DATEV-Prüfung',
   'DATEV - Export Assistent'    => 'DATEV-Exportassistent',
   'DATEV Angaben'               => 'DATEV-Angaben',
   'DATEV Export'                => 'DATEV-Export',
@@ -1004,6 +1010,7 @@ $self->{texts} = {
   'It is possible that even after such a correction there is something wrong with this transaction (e.g. taxes that don\'t match the selected taxkey). Therefore you should re-run the general ledger analysis.' => 'Auch nach einer Korrektur kann es mit dieser Buchung noch weitere Probleme geben (z.B. nicht zum Steuerschlüssel passende Steuern), weshalb ein erneutes Ausführen der Hauptbuchanalyse empfohlen wird.',
   'It is possible to do this automatically for some Buchungsgruppen, but not for all.' => 'Es ist m&ouml;glich, dies f&uuml;r einige, aber nicht f&uuml;r alle Buchungsgruppen automatisch zu erledigen.',
   'It is possible to do this automatically for some units, but for others the user has to chose the new unit.' => 'Das ist f&uuml;r einige Einheiten automatisch m&ouml;glich, aber bei anderen muss der Benutzer die neue Einheit ausw&auml;hlen.',
+  'It is possible to make a quick DATEV export everytime you post a record to ensure things work nicely with their data requirements. This will result in a slight overhead though you can enable this for each type of record independantly.' => 'Es ist möglich, bei jeder Buchung einen schnellen DATEV-Export durchzuführen, um sicherzustellen, dass die Datensätze den DATEV-Anforderungen genügen. Da dies einen kleinen Overhead bedeutet, lässt sich dei Einstellung für jeden Buchungstyp getrennt einstellen.',
   'It may optionally be compressed with &quot;gzip&quot;.' => 'Sie darf optional mit &quot;gzip&quot; komprimiert sein.',
   'It will simply set the taxkey to 0 (meaning "no taxes") which is the correct value for such inventory transactions.' => 'Es wird einfach die Steuerschlüssel auf  0 setzen, was "keine Steuer" bedeutet und für solche Warenbestandsbuchungen der richtige Wert ist.',
   'Item deleted!'               => 'Artikel gelöscht!',
@@ -1339,6 +1346,11 @@ $self->{texts} = {
   'Payments'                    => 'Zahlungsausgänge',
   'Payments Changeable'         => 'Änderbarkeit von Zahlungen',
   'Per. Inv.'                   => 'Wied. Rech.',
+  'Perform check when a gl transaction is posted?' => 'Prüfung durchführen, wenn eine Dialogbuchung gebucht wird?',
+  'Perform check when a purchase invoice or a payment for a purchase invoice is posted?' => 'Prüfung durchführen, wenn eine Einkaufsrechnung oder ein Zahlungsausgang hierfür gebucht wird?',
+  'Perform check when a sales invoice or a payment for a sales invoice is posted?' => 'Prüfung durchführen, wenn eine Verkaufsrechnung oder ein Zahlungseingang hierfür gebucht wird?',
+  'Perform check when an ap transaction is posted?' => 'Prüfung durchführen, wenn Kreditorenbuchung gebucht wird?',
+  'Perform check when an ar transaction is posted?' => 'Prüfung durchführen, wenn Debiotorenbuchung gebucht wird?',
   'Period'                      => 'Zeitraum',
   'Period:'                     => 'Zeitraum:',
   'Periodic Invoices'           => 'Wiederkehrende Rechnungen',
index e76c866..87ec317 100644 (file)
@@ -391,6 +391,11 @@ $self->{texts} = {
   'Check'                       => 'Cheque',
   'Check Details'               => '',
   'Check for duplicates'        => '',
+  'Check on ap transaction'     => '',
+  'Check on ar transaction'     => '',
+  'Check on gl transaction'     => '',
+  'Check on purchase invoice'   => '',
+  'Check on sales invoice'      => '',
   'Checks'                      => '',
   'Choose Customer'             => '',
   'Choose Outputformat'         => '',
@@ -531,6 +536,7 @@ $self->{texts} = {
   'DATEV - Export Assistent'    => '',
   'DATEV Angaben'               => '',
   'DATEV Export'                => '',
+  'DATEV check configuration'   => '',
   'DATEV check returned errors:' => '',
   'DATEX - Export Assistent'    => '',
   'DELETED'                     => '',
@@ -1020,6 +1026,7 @@ $self->{texts} = {
   'It is possible that even after such a correction there is something wrong with this transaction (e.g. taxes that don\'t match the selected taxkey). Therefore you should re-run the general ledger analysis.' => '',
   'It is possible to do this automatically for some Buchungsgruppen, but not for all.' => '',
   'It is possible to do this automatically for some units, but for others the user has to chose the new unit.' => '',
+  'It is possible to make a quick DATEV export everytime you post a record to ensure things work nicely with their data requirements. This will result in a slight overhead though you can enable this for each type of record independantly.' => '',
   'It may optionally be compressed with &quot;gzip&quot;.' => '',
   'It will simply set the taxkey to 0 (meaning "no taxes") which is the correct value for such inventory transactions.' => '',
   'Item deleted!'               => '',
@@ -1355,6 +1362,11 @@ $self->{texts} = {
   'Payments'                    => '',
   'Payments Changeable'         => '',
   'Per. Inv.'                   => '',
+  'Perform check when a gl transaction is posted?' => '',
+  'Perform check when a purchase invoice or a payment for a purchase invoice is posted?' => '',
+  'Perform check when a sales invoice or a payment for a sales invoice is posted?' => '',
+  'Perform check when an ap transaction is posted?' => '',
+  'Perform check when an ar transaction is posted?' => '',
   'Period'                      => '',
   'Period:'                     => '',
   'Periodic Invoices'           => '',
diff --git a/sql/Pg-upgrade2/defaults_datev_check.pl b/sql/Pg-upgrade2/defaults_datev_check.pl
new file mode 100644 (file)
index 0000000..5077281
--- /dev/null
@@ -0,0 +1,54 @@
+# @tag: defaults_datev_check
+# @description: Einstellung für DATEV-Überprüfungen (datev_check) vom Config-File in die DB verlagern.
+# @depends: release_2_7_0
+# @charset: utf-8
+
+use utf8;
+use strict;
+
+die("This script cannot be run from the command line.") unless ($main::form);
+
+sub mydberror {
+  my ($msg) = @_;
+  die($dbup_locale->text("Database update error:") .
+      "<br>$msg<br>" . $DBI::errstr);
+}
+
+sub do_query {
+  my ($query, $may_fail) = @_;
+
+  if (!$dbh->do($query)) {
+    mydberror($query) unless ($may_fail);
+    $dbh->rollback();
+    $dbh->begin_work();
+  }
+}
+
+sub do_update {
+
+  # this query will fail if column already exist (new database)
+  do_query(qq|ALTER TABLE defaults ADD COLUMN datev_check_on_sales_invoice boolean    DEFAULT true|, 1);
+  do_query(qq|ALTER TABLE defaults ADD COLUMN datev_check_on_purchase_invoice boolean DEFAULT true|, 1);
+  do_query(qq|ALTER TABLE defaults ADD COLUMN datev_check_on_ar_transaction boolean   DEFAULT true|, 1);
+  do_query(qq|ALTER TABLE defaults ADD COLUMN datev_check_on_ap_transaction boolean   DEFAULT true|, 1);
+  do_query(qq|ALTER TABLE defaults ADD COLUMN datev_check_on_gl_transaction boolean   DEFAULT true|, 1);
+
+  # check current configuration and set default variables accordingly, so that
+  # kivitendo's behaviour isn't changed by this update
+  # if checks are not set in config set it to true
+  foreach my $check (qw(check_on_sales_invoice check_on_purchase_invoice check_on_ar_transaction check_on_ap_transaction check_on_gl_transaction)) {
+    my $check_set = 1;
+    if (!$::lx_office_conf{datev_check}->{$check}) {
+      $check_set = 0;
+    }
+
+    my $update_column = "UPDATE defaults SET datev_$check = '$check_set';";
+    do_query($update_column);
+  }
+
+
+  return 1;
+}
+
+return do_update();
+
index 448c244..416d66d 100644 (file)
  <tr> </tr>
  <tr> </tr>
 
+ <tr class='listheading'>
+   <th colspan="3">[% 'DATEV check configuration' | $T8 %]</th>
+ </tr>
+ <tr>
+   <td colspan="3">[% 'It is possible to make a quick DATEV export everytime you post a record to ensure things work nicely with their data requirements. This will result in a slight overhead though you can enable this for each type of record independantly.' | $T8 %]</td>
+ </tr>
+ <tr>
+   <td align="right">[% 'Check on sales invoice' | $T8 %]</td>
+   <td>[% L.yes_no_tag('datev_check_on_sales_invoice', SELF.datev_check_on_sales_invoice) %]</td>
+   <td>[% 'Perform check when a sales invoice or a payment for a sales invoice is posted?' | $T8 %]</td>
+ </tr>
+ <tr>
+   <td align="right">[% 'Check on purchase invoice' | $T8 %]</td>
+   <td>[% L.yes_no_tag('datev_check_on_purchase_invoice', SELF.datev_check_on_purchase_invoice) %]</td>
+   <td>[% 'Perform check when a purchase invoice or a payment for a purchase invoice is posted?' | $T8 %]</td>
+ </tr>
+ <tr>
+   <td align="right">[% 'Check on ar transaction' | $T8 %]</td>
+   <td>[% L.yes_no_tag('datev_check_on_ar_transaction', SELF.datev_check_on_ar_transaction) %]</td>
+   <td>[% 'Perform check when an ar transaction is posted?' | $T8 %]</td>
+ </tr>
+ <tr>
+   <td align="right">[% 'Check on ap transaction' | $T8 %]</td>
+   <td>[% L.yes_no_tag('datev_check_on_ap_transaction', SELF.datev_check_on_ap_transaction) %]</td>
+   <td>[% 'Perform check when an ap transaction is posted?' | $T8 %]</td>
+ </tr>
+ <tr>
+   <td align="right">[% 'Check on gl transaction' | $T8 %]</td>
+   <td>[% L.yes_no_tag('datev_check_on_gl_transaction', SELF.datev_check_on_gl_transaction) %]</td>
+   <td>[% 'Perform check when a gl transaction is posted?' | $T8 %]</td>
+ </tr>
+
+ <tr> </tr>
+ <tr> </tr>
+
  <tr class='listheading'>
    <th colspan="3">[% 'Warehouse' | $T8 %]</th>
  </tr>