@@ -, +, @@
---
Koha/ERM/EUsage/CounterLog.pm | 12 ++++++------
Koha/Schema/Result/ErmCounterLog.pm | 11 +++++++++++
api/v1/swagger/definitions/erm_counter_log.yaml | 10 +++++++---
api/v1/swagger/paths/erm_counter_logs.yaml | 2 +-
.../ERM/UsageStatisticsDataProvidersCounterLogs.vue | 8 ++++----
5 files changed, 29 insertions(+), 14 deletions(-)
--- a/Koha/ERM/EUsage/CounterLog.pm
+++ a/Koha/ERM/EUsage/CounterLog.pm
@@ -32,17 +32,17 @@ Koha::ERM::EUsage::CounterLog - Koha ErmCounterLog Object class
=cut
-=head3 borrowernumber
+=head3 patron
-Return the borrower for this counter_file
+Return the patron for this counter_file
=cut
-sub borrowernumber {
+sub patron {
my ($self) = @_;
- my $borrowers_rs = $self->_result->borrowernumber;
- return unless $borrowers_rs;
- return Koha::Patron->_new_from_dbic($borrowers_rs);
+ my $patrons_rs = $self->_result->patron;
+ return unless $patrons_rs;
+ return Koha::Patron->_new_from_dbic($patrons_rs);
}
--- a/Koha/Schema/Result/ErmCounterLog.pm
+++ a/Koha/Schema/Result/ErmCounterLog.pm
@@ -181,6 +181,17 @@ __PACKAGE__->belongs_to(
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-11-30 17:43:57
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:fEB6HZDsjTTJVWlnW+y/Ng
+__PACKAGE__->belongs_to(
+ "patron",
+ "Koha::Schema::Result::Borrower",
+ { borrowernumber => "borrowernumber" },
+ {
+ is_deferrable => 1,
+ join_type => "LEFT",
+ on_delete => "CASCADE",
+ on_update => "CASCADE",
+ },
+);
sub koha_object_class {
'Koha::ERM::EUsage::CounterLog';
--- a/api/v1/swagger/definitions/erm_counter_log.yaml
+++ a/api/v1/swagger/definitions/erm_counter_log.yaml
@@ -11,10 +11,9 @@ properties:
- integer
- "null"
borrowernumber:
- type: object
- description: patron object
+ description: borrowernumber of the counter log
type:
- - object
+ - integer
- "null"
importdate:
type: string
@@ -35,6 +34,11 @@ properties:
type:
- integer
- "null"
+ patron:
+ description: patron object for the importer
+ type:
+ - object
+ - "null"
additionalProperties: false
required:
--- a/api/v1/swagger/paths/erm_counter_logs.yaml
+++ a/api/v1/swagger/paths/erm_counter_logs.yaml
@@ -21,7 +21,7 @@
items:
type: string
enum:
- - borrowernumber
+ - patron
- $ref: "../swagger.yaml#/parameters/match"
- $ref: "../swagger.yaml#/parameters/order_by"
- $ref: "../swagger.yaml#/parameters/page"
--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/UsageStatisticsDataProvidersCounterLogs.vue
+++ a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/UsageStatisticsDataProvidersCounterLogs.vue
@@ -41,7 +41,7 @@ export default {
tableOptions: {
columns: this.getTableColumns(),
options: {
- embed: "borrowernumber",
+ embed: "patron",
},
url: () => this.table_url(),
table_settings: this.counter_log_table_settings,
@@ -139,9 +139,9 @@ export default {
{
title: __("Imported by"),
render: function (data, type, row, meta) {
- const borrower = row.borrowernumber
- const importer = borrower
- ? `${borrower.firstname} ${borrower.surname}`
+ const { patron } = row
+ const importer = patron
+ ? `${patron.firstname} ${patron.surname}`
: "Cronjob"
return importer
},
--