Bug 36627: Rename embed method to patron

This patch renames the embed method from borrowernumber to patron to fit with the use of 'patron' in the API

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Matt Blenkinsop 2024-04-18 09:22:31 +00:00 committed by Katrin Fischer
parent da475321a5
commit 7b75586ead
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
5 changed files with 29 additions and 14 deletions

View File

@ -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);
}

View File

@ -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';

View File

@ -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:

View File

@ -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"

View File

@ -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
? `<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=${borrower.patron_id}">${borrower.firstname} ${borrower.surname}</a>`
const { patron } = row
const importer = patron
? `<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=${patron.patron_id}">${patron.firstname} ${patron.surname}</a>`
: this.$__("Cronjob")
return importer
},