Kreditorenbuchungen: Zahlungsbedingungen in Belegvorlagen
authorSven Schöling <s.schoeling@googlemail.com>
Thu, 3 Dec 2020 15:44:22 +0000 (16:44 +0100)
committerSven Schöling <s.schoeling@googlemail.com>
Thu, 3 Dec 2020 16:01:16 +0000 (17:01 +0100)
SL/DB/MetaSetup/RecordTemplate.pm
bin/mozilla/ap.pl
sql/Pg-upgrade2/record_template_payment_id.sql [new file with mode: 0644]

index a9f6f88..83850ff 100644 (file)
@@ -23,6 +23,7 @@ __PACKAGE__->meta->columns(
   notes          => { type => 'text' },
   ob_transaction => { type => 'boolean', default => 'false', not_null => 1 },
   ordnumber      => { type => 'text' },
+  payment_id     => { type => 'integer' },
   project_id     => { type => 'integer' },
   reference      => { type => 'text' },
   show_details   => { type => 'boolean', default => 'false', not_null => 1 },
@@ -62,6 +63,11 @@ __PACKAGE__->meta->foreign_keys(
     key_columns => { employee_id => 'id' },
   },
 
+  payment => {
+    class       => 'SL::DB::PaymentTerm',
+    key_columns => { payment_id => 'id' },
+  },
+
   project => {
     class       => 'SL::DB::Project',
     key_columns => { project_id => 'id' },
index 8e9e4ca..8f06776 100644 (file)
@@ -130,6 +130,7 @@ sub load_record_template {
   $::form->{currency}         = $template->currency->name;
   $::form->{direct_debit}     = $template->direct_debit;
   $::form->{globalproject_id} = $template->project_id;
+  $::form->{payment_id}       = $template->payment_id;
   $::form->{AP_chart_id}      = $template->ar_ap_chart_id;
   $::form->{transdate}        = $today->to_kivitendo;
   $::form->{duedate}          = $today->to_kivitendo;
@@ -213,6 +214,7 @@ sub save_record_template {
     vendor_id      => $::form->{vendor_id}        || undef,
     department_id  => $::form->{department_id}    || undef,
     project_id     => $::form->{globalproject_id} || undef,
+    payment_id     => $::form->{payment_id}       || undef,
     taxincluded    => $::form->{taxincluded}  ? 1 : 0,
     direct_debit   => $::form->{direct_debit} ? 1 : 0,
     ordnumber      => $::form->{ordnumber},
diff --git a/sql/Pg-upgrade2/record_template_payment_id.sql b/sql/Pg-upgrade2/record_template_payment_id.sql
new file mode 100644 (file)
index 0000000..e251e3d
--- /dev/null
@@ -0,0 +1,5 @@
+-- @tag: record_template_payment_id
+-- @description: Zahlungsbedingungen in Vorlagen in der Finanzbuchhaltung
+-- @depends: release_3_5_6_1
+
+ALTER TABLE record_templates ADD COLUMN payment_id INTEGER REFERENCES payment_terms(id);