From 92fd5e4c3044e53eb569a2a8189e68e28839d020 Mon Sep 17 00:00:00 2001
From: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Date: Thu, 9 Jan 2020 13:50:03 +0000
Subject: [PATCH] Bug 23355: [DO NOT PUSH] DBIC Classes

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
---
 Koha/Schema/Result/Borrower.pm           |  24 +++-
 Koha/Schema/Result/CashRegister.pm       |  19 +++-
 Koha/Schema/Result/CashRegisterAction.pm | 135 +++++++++++++++++++++++
 3 files changed, 174 insertions(+), 4 deletions(-)
 create mode 100644 Koha/Schema/Result/CashRegisterAction.pm

diff --git a/Koha/Schema/Result/Borrower.pm b/Koha/Schema/Result/Borrower.pm
index f7224cc299..1f542d978d 100644
--- a/Koha/Schema/Result/Borrower.pm
+++ b/Koha/Schema/Result/Borrower.pm
@@ -929,6 +929,21 @@ __PACKAGE__->belongs_to(
   { is_deferrable => 1, on_delete => "RESTRICT", on_update => "RESTRICT" },
 );
 
+=head2 cash_register_actions
+
+Type: has_many
+
+Related object: L<Koha::Schema::Result::CashRegisterAction>
+
+=cut
+
+__PACKAGE__->has_many(
+  "cash_register_actions",
+  "Koha::Schema::Result::CashRegisterAction",
+  { "foreign.manager_id" => "self.borrowernumber" },
+  { cascade_copy => 0, cascade_delete => 0 },
+);
+
 =head2 categorycode
 
 Type: belongs_to
@@ -1634,9 +1649,14 @@ Composing rels: L</aqorder_users> -> ordernumber
 
 __PACKAGE__->many_to_many("ordernumbers", "aqorder_users", "ordernumber");
 
+# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-07-23 13:21:02
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:f25Xar862YgzWuWq5/LIRA
 
-# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-10-10 14:31:00
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:GjJLIOViIFRm185Yjl9vYA
+__PACKAGE__->belongs_to(
+    "guarantor",
+    "Koha::Schema::Result::Borrower",
+    { borrowernumber => "guarantorid" },
+);
 
 __PACKAGE__->add_columns(
     '+anonymized'    => { is_boolean => 1 },
diff --git a/Koha/Schema/Result/CashRegister.pm b/Koha/Schema/Result/CashRegister.pm
index 90ba81d00d..6cb01e7848 100644
--- a/Koha/Schema/Result/CashRegister.pm
+++ b/Koha/Schema/Result/CashRegister.pm
@@ -144,9 +144,24 @@ __PACKAGE__->belongs_to(
   { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
 );
 
+=head2 cash_register_actions
 
-# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-07-23 13:14:31
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:TfGf0U/vWS7IviRlvDdE1w
+Type: has_many
+
+Related object: L<Koha::Schema::Result::CashRegisterAction>
+
+=cut
+
+__PACKAGE__->has_many(
+  "cash_register_actions",
+  "Koha::Schema::Result::CashRegisterAction",
+  { "foreign.register_id" => "self.id" },
+  { cascade_copy => 0, cascade_delete => 0 },
+);
+
+
+# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-07-23 13:21:03
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:zP8my0Zp5bSARTBfws4n1A
 
 __PACKAGE__->add_columns(
     '+archived'       => { is_boolean => 1 },
diff --git a/Koha/Schema/Result/CashRegisterAction.pm b/Koha/Schema/Result/CashRegisterAction.pm
new file mode 100644
index 0000000000..875d9f0914
--- /dev/null
+++ b/Koha/Schema/Result/CashRegisterAction.pm
@@ -0,0 +1,135 @@
+use utf8;
+package Koha::Schema::Result::CashRegisterAction;
+
+# Created by DBIx::Class::Schema::Loader
+# DO NOT MODIFY THE FIRST PART OF THIS FILE
+
+=head1 NAME
+
+Koha::Schema::Result::CashRegisterAction
+
+=cut
+
+use strict;
+use warnings;
+
+use base 'DBIx::Class::Core';
+
+=head1 TABLE: C<cash_register_actions>
+
+=cut
+
+__PACKAGE__->table("cash_register_actions");
+
+=head1 ACCESSORS
+
+=head2 id
+
+  data_type: 'integer'
+  is_auto_increment: 1
+  is_nullable: 0
+
+=head2 code
+
+  data_type: 'varchar'
+  is_nullable: 0
+  size: 24
+
+=head2 register_id
+
+  data_type: 'integer'
+  is_foreign_key: 1
+  is_nullable: 0
+
+=head2 manager_id
+
+  data_type: 'integer'
+  is_foreign_key: 1
+  is_nullable: 0
+
+=head2 amount
+
+  data_type: 'decimal'
+  is_nullable: 1
+  size: [28,6]
+
+=head2 timestamp
+
+  data_type: 'timestamp'
+  datetime_undef_if_invalid: 1
+  default_value: current_timestamp
+  is_nullable: 0
+
+=cut
+
+__PACKAGE__->add_columns(
+  "id",
+  { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
+  "code",
+  { data_type => "varchar", is_nullable => 0, size => 24 },
+  "register_id",
+  { data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
+  "manager_id",
+  { data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
+  "amount",
+  { data_type => "decimal", is_nullable => 1, size => [28, 6] },
+  "timestamp",
+  {
+    data_type => "timestamp",
+    datetime_undef_if_invalid => 1,
+    default_value => \"current_timestamp",
+    is_nullable => 0,
+  },
+);
+
+=head1 PRIMARY KEY
+
+=over 4
+
+=item * L</id>
+
+=back
+
+=cut
+
+__PACKAGE__->set_primary_key("id");
+
+=head1 RELATIONS
+
+=head2 manager
+
+Type: belongs_to
+
+Related object: L<Koha::Schema::Result::Borrower>
+
+=cut
+
+__PACKAGE__->belongs_to(
+  "manager",
+  "Koha::Schema::Result::Borrower",
+  { borrowernumber => "manager_id" },
+  { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
+);
+
+=head2 register
+
+Type: belongs_to
+
+Related object: L<Koha::Schema::Result::CashRegister>
+
+=cut
+
+__PACKAGE__->belongs_to(
+  "register",
+  "Koha::Schema::Result::CashRegister",
+  { id => "register_id" },
+  { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
+);
+
+
+# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-07-23 13:21:03
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Oaee+hS82IEJHHBGuOXDtw
+
+
+# You can replace this text with custom code or comments, and it will be preserved on regeneration
+1;
-- 
2.20.1