commit 3751ebca54b109b6ef3cdb843edf4cdae5034aa5
Author: Tamino Steinert <tamino.steinert@tamino.st>
Date:   Wed Jun 28 12:07:19 2023 +0200

    PurchaseBasketItem: Datenbankscript und DB-Dateien
    
    Positionsebene für den Einkaufskorb

diff --git a/SL/DB/Helper/ALL.pm b/SL/DB/Helper/ALL.pm
index 33dd7cca2..4220d5185 100644
--- a/SL/DB/Helper/ALL.pm
+++ b/SL/DB/Helper/ALL.pm
@@ -109,6 +109,7 @@ use SL::DB::ProjectPhaseParticipant;
 use SL::DB::ProjectRole;
 use SL::DB::ProjectStatus;
 use SL::DB::ProjectType;
+use SL::DB::PurchaseBasketItem;
 use SL::DB::PurchaseInvoice;
 use SL::DB::Reclamation;
 use SL::DB::ReclamationItem;
diff --git a/SL/DB/Helper/Mappings.pm b/SL/DB/Helper/Mappings.pm
index b2deea602..74a60a15e 100644
--- a/SL/DB/Helper/Mappings.pm
+++ b/SL/DB/Helper/Mappings.pm
@@ -188,6 +188,7 @@ my %kivitendo_package_names = (
   project_roles                  => 'project_role',
   project_statuses               => 'project_status',
   project_types                  => 'project_type',
+  purchase_basket_items          => 'purchase_basket_item',
   reclamations                   => 'Reclamation',
   reclamation_items              => 'ReclamationItem',
   reclamation_reasons            => 'ReclamationReason',
diff --git a/SL/DB/Manager/PurchaseBasketItem.pm b/SL/DB/Manager/PurchaseBasketItem.pm
new file mode 100644
index 000000000..72e778a4b
--- /dev/null
+++ b/SL/DB/Manager/PurchaseBasketItem.pm
@@ -0,0 +1,14 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::Manager::PurchaseBasketItem;
+
+use strict;
+
+use parent qw(SL::DB::Helper::Manager);
+
+sub object_class { 'SL::DB::PurchaseBasketItem' }
+
+__PACKAGE__->make_manager_methods;
+
+1;
diff --git a/SL/DB/MetaSetup/PurchaseBasketItem.pm b/SL/DB/MetaSetup/PurchaseBasketItem.pm
new file mode 100644
index 000000000..107c0a3cf
--- /dev/null
+++ b/SL/DB/MetaSetup/PurchaseBasketItem.pm
@@ -0,0 +1,38 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::PurchaseBasketItem;
+
+use strict;
+
+use parent qw(SL::DB::Object);
+
+__PACKAGE__->meta->table('purchase_basket_items');
+
+__PACKAGE__->meta->columns(
+  cleared    => { type => 'boolean', default => 'false', not_null => 1 },
+  id         => { type => 'serial', not_null => 1 },
+  itime      => { type => 'timestamp', default => 'now()' },
+  mtime      => { type => 'timestamp' },
+  orderer_id => { type => 'integer' },
+  part_id    => { type => 'integer' },
+  qty        => { type => 'numeric', not_null => 1, precision => 15, scale => 5 },
+);
+
+__PACKAGE__->meta->primary_key_columns([ 'id' ]);
+
+__PACKAGE__->meta->allow_inline_column_values(1);
+
+__PACKAGE__->meta->foreign_keys(
+  orderer => {
+    class       => 'SL::DB::Employee',
+    key_columns => { orderer_id => 'id' },
+  },
+
+  part => {
+    class       => 'SL::DB::Part',
+    key_columns => { part_id => 'id' },
+  },
+);
+
+1;
+;
diff --git a/SL/DB/PurchaseBasketItem.pm b/SL/DB/PurchaseBasketItem.pm
new file mode 100644
index 000000000..af0d5cde1
--- /dev/null
+++ b/SL/DB/PurchaseBasketItem.pm
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::PurchaseBasketItem;
+
+use strict;
+
+use SL::DB::MetaSetup::PurchaseBasketItem;
+use SL::DB::Manager::PurchaseBasketItem;
+
+__PACKAGE__->meta->initialize;
+
+1;
diff --git a/sql/Pg-upgrade2/purchase_basket_items.sql b/sql/Pg-upgrade2/purchase_basket_items.sql
new file mode 100644
index 000000000..9b8d412a5
--- /dev/null
+++ b/sql/Pg-upgrade2/purchase_basket_items.sql
@@ -0,0 +1,17 @@
+-- @tag: purchase_basket_items
+-- @description: Tabelle für den Dispositionsmanager
+-- @depends: release_3_8_0
+-- @ignore: 0
+
+CREATE TABLE purchase_basket_items (
+  id SERIAL   PRIMARY KEY,
+  part_id     INTEGER REFERENCES parts(id),
+  orderer_id  INTEGER REFERENCES employee(id),
+  qty         NUMERIC(15,5) NOT NULL,
+  cleared     BOOLEAN NOT NULL            DEFAULT FALSE,
+  itime       TIMESTAMP without time zone DEFAULT now(),
+  mtime       TIMESTAMP without time zone
+);
+CREATE TRIGGER mtime_purchase_basket_items
+  BEFORE UPDATE ON purchase_basket_items
+  FOR EACH ROW EXECUTE PROCEDURE set_mtime();
