From 250e28f8c4dd67b2b2e640e29d0be0f39b12e20e Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Mon, 28 Aug 2017 15:59:49 +0000 Subject: [PATCH] Bug 14850 - Add Koha Objects --- Koha/Acquisition/Budget.pm | 24 ++++++++++++++++++++++++ Koha/Acquisition/BudgetPeriod.pm | 12 ++++++++++++ Koha/Acquisition/BudgetPeriods.pm | 19 +++++++++++++++++++ Koha/Acquisition/Budgets.pm | 19 +++++++++++++++++++ 4 files changed, 74 insertions(+) create mode 100644 Koha/Acquisition/Budget.pm create mode 100644 Koha/Acquisition/BudgetPeriod.pm create mode 100644 Koha/Acquisition/BudgetPeriods.pm create mode 100644 Koha/Acquisition/Budgets.pm diff --git a/Koha/Acquisition/Budget.pm b/Koha/Acquisition/Budget.pm new file mode 100644 index 0000000..f357046 --- /dev/null +++ b/Koha/Acquisition/Budget.pm @@ -0,0 +1,24 @@ +package Koha::Acquisition::Budget; + +use Modern::Perl; + +use Koha::Acquisition::BudgetPeriods; +use Koha::Acquisition::BudgetPeriod; +use Koha::Database; +use base qw( Koha::Object ); + +sub active { + my ($self) = @_; + + my $b_period = Koha::Acquisition::BudgetPeriods->find({ budget_period_id => $self->budget_period_id }); + return unless $b_period; + my $active = $b_period->budget_period_active; + return $active; + +} + +sub _type { + return 'Aqbudget'; +} + +1; diff --git a/Koha/Acquisition/BudgetPeriod.pm b/Koha/Acquisition/BudgetPeriod.pm new file mode 100644 index 0000000..55b3fa2 --- /dev/null +++ b/Koha/Acquisition/BudgetPeriod.pm @@ -0,0 +1,12 @@ +package Koha::Acquisition::BudgetPeriod; + +use Modern::Perl; + +use Koha::Database; +use base qw( Koha::Object ); + +sub _type { + return 'Aqbudgetperiod'; +} + +1; diff --git a/Koha/Acquisition/BudgetPeriods.pm b/Koha/Acquisition/BudgetPeriods.pm new file mode 100644 index 0000000..e1b5d75 --- /dev/null +++ b/Koha/Acquisition/BudgetPeriods.pm @@ -0,0 +1,19 @@ +package Koha::Acquisition::BudgetPeriods; + +use Modern::Perl; + +use Carp; + +use Koha::Database; + +use base qw( Koha::Objects ); + +sub _type { + return 'Aqbudgetperiod'; +} + +sub object_class { + return 'Koha::Acquisition::BudgetPeriod'; +} + +1; diff --git a/Koha/Acquisition/Budgets.pm b/Koha/Acquisition/Budgets.pm new file mode 100644 index 0000000..f18ac5e --- /dev/null +++ b/Koha/Acquisition/Budgets.pm @@ -0,0 +1,19 @@ +package Koha::Acquisition::Budgets; + +use Modern::Perl; + +use Carp; + +use Koha::Database; + +use base qw( Koha::Objects ); + +sub _type { + return 'Aqbudget'; +} + +sub object_class { + return 'Koha::Acquisition::Budget'; +} + +1; -- 2.1.4