View | Details | Raw Unified | Return to bug 40192
Collapse All | Expand All

(-)a/Koha/AdditionalField.pm (+1 lines)
Lines 64-69 sub to_api { Link Here
64
        'erm_packages'         => 'package',
64
        'erm_packages'         => 'package',
65
        'aqorders'             => 'order',
65
        'aqorders'             => 'order',
66
        'aqbooksellers:vendor' => 'vendor',
66
        'aqbooksellers:vendor' => 'vendor',
67
        'erm_titles'           => 'title'
67
    };
68
    };
68
69
69
    my $json = $self->SUPER::to_api($params);
70
    my $json = $self->SUPER::to_api($params);
(-)a/Koha/ERM/EHoldings/Title.pm (-1 / +1 lines)
Lines 22-28 use MIME::Base64 qw( decode_base64 ); Link Here
22
22
23
use Koha::Database;
23
use Koha::Database;
24
24
25
use base qw(Koha::Object);
25
use base qw(Koha::Object::Mixin::AdditionalFields Koha::Object);
26
26
27
use C4::Biblio qw( AddBiblio TransformKohaToMarc GetMarcFromKohaField );
27
use C4::Biblio qw( AddBiblio TransformKohaToMarc GetMarcFromKohaField );
28
28
(-)a/Koha/ERM/EHoldings/Titles.pm (-1 / +1 lines)
Lines 21-27 use Koha::Database; Link Here
21
21
22
use Koha::ERM::EHoldings::Title;
22
use Koha::ERM::EHoldings::Title;
23
23
24
use base qw(Koha::Objects);
24
use base qw(Koha::Objects::Mixin::AdditionalFields Koha::Objects);
25
25
26
=head1 NAME
26
=head1 NAME
27
27
(-)a/Koha/REST/V1/ERM/EHoldings/Titles/Local.pm (+9 lines)
Lines 90-101 sub add { Link Here
90
90
91
                my $resources            = delete $body->{resources}            // [];
91
                my $resources            = delete $body->{resources}            // [];
92
                my $create_linked_biblio = delete $body->{create_linked_biblio} // 0;
92
                my $create_linked_biblio = delete $body->{create_linked_biblio} // 0;
93
                my $extended_attributes  = delete $body->{extended_attributes}  // [];
93
94
94
                my $title = Koha::ERM::EHoldings::Title->new_from_api($body)
95
                my $title = Koha::ERM::EHoldings::Title->new_from_api($body)
95
                    ->store( { create_linked_biblio => $create_linked_biblio } );
96
                    ->store( { create_linked_biblio => $create_linked_biblio } );
96
97
97
                $title->resources($resources);
98
                $title->resources($resources);
98
99
100
                my @extended_attributes =
101
                    map { { 'id' => $_->{field_id}, 'value' => $_->{value} } } @{$extended_attributes};
102
                $title->extended_attributes( \@extended_attributes );
103
99
                $c->res->headers->location( $c->req->url->to_string . '/' . $title->title_id );
104
                $c->res->headers->location( $c->req->url->to_string . '/' . $title->title_id );
100
                return $c->render(
105
                return $c->render(
101
                    status  => 201,
106
                    status  => 201,
Lines 152-161 sub update { Link Here
152
157
153
                my $resources            = delete $body->{resources}            // [];
158
                my $resources            = delete $body->{resources}            // [];
154
                my $create_linked_biblio = delete $body->{create_linked_biblio} // 0;
159
                my $create_linked_biblio = delete $body->{create_linked_biblio} // 0;
160
                my $extended_attributes  = delete $body->{extended_attributes}  // [];
155
161
156
                $title->set_from_api($body)->store( { create_linked_biblio => $create_linked_biblio } );
162
                $title->set_from_api($body)->store( { create_linked_biblio => $create_linked_biblio } );
157
163
158
                $title->resources($resources);
164
                $title->resources($resources);
165
                my @extended_attributes =
166
                    map { { 'id' => $_->{field_id}, 'value' => $_->{value} } } @{$extended_attributes};
167
                $title->extended_attributes( \@extended_attributes );
159
168
160
                return $c->render(
169
                return $c->render(
161
                    status  => 200,
170
                    status  => 200,
(-)a/Koha/REST/V1/ExtendedAttributeTypes.pm (+1 lines)
Lines 55-60 sub list { Link Here
55
        package   => 'erm_packages',
55
        package   => 'erm_packages',
56
        order     => 'aqorders',
56
        order     => 'aqorders',
57
        vendor    => 'aqbooksellers:vendor',
57
        vendor    => 'aqbooksellers:vendor',
58
        title     => 'erm_titles'
58
    };
59
    };
59
60
60
    return try {
61
    return try {
(-)a/Koha/Schema/Result/ErmEholdingsTitle.pm (+32 lines)
Lines 297-302 __PACKAGE__->has_many( Link Here
297
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-09-13 11:06:45
297
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-09-13 11:06:45
298
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:SOFpN45kBTi/qvW5OBnYDA
298
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:SOFpN45kBTi/qvW5OBnYDA
299
299
300
__PACKAGE__->has_many(
301
    "additional_field_values",
302
    "Koha::Schema::Result::AdditionalFieldValue",
303
    sub {
304
        my ($args) = @_;
305
306
        return {
307
            "$args->{foreign_alias}.record_id" => { -ident => "$args->{self_alias}.title_id" },
308
309
            "$args->{foreign_alias}.field_id" =>
310
                { -in => \'(SELECT id FROM additional_fields WHERE tablename="erm_titles")' },
311
        };
312
    },
313
    { cascade_copy => 0, cascade_delete => 0 },
314
);
315
316
__PACKAGE__->has_many(
317
    "extended_attributes",
318
    "Koha::Schema::Result::AdditionalFieldValue",
319
    sub {
320
        my ($args) = @_;
321
322
        return {
323
            "$args->{foreign_alias}.record_id" => { -ident => "$args->{self_alias}.title_id" },
324
325
            "$args->{foreign_alias}.field_id" =>
326
                { -in => \'(SELECT id FROM additional_fields WHERE tablename="erm_titles")' },
327
        };
328
    },
329
    { cascade_copy => 0, cascade_delete => 0 },
330
);
331
300
=head2 koha_objects_class
332
=head2 koha_objects_class
301
333
302
Missing POD for koha_objects_class.
334
Missing POD for koha_objects_class.
(-)a/api/v1/swagger/definitions/erm_eholdings_title.yaml (+10 lines)
Lines 173-178 properties: Link Here
173
    type:
173
    type:
174
      - boolean
174
      - boolean
175
      - "null"
175
      - "null"
176
  extended_attributes:
177
    description: Related additional field values
178
    type:
179
      - array
180
    items:
181
      $ref: extended_attribute_value.yaml
182
  _strings:
183
    type:
184
      - object
185
      - "null"
176
186
177
additionalProperties: false
187
additionalProperties: false
178
required:
188
required:
(-)a/api/v1/swagger/paths/erm_eholdings_titles.yaml (+4 lines)
Lines 153-158 Link Here
153
          type: string
153
          type: string
154
          enum:
154
          enum:
155
            - resources.package
155
            - resources.package
156
            - extended_attributes
157
            - +strings
156
        collectionFormat: csv
158
        collectionFormat: csv
157
      - $ref: "../swagger.yaml#/parameters/match"
159
      - $ref: "../swagger.yaml#/parameters/match"
158
      - $ref: "../swagger.yaml#/parameters/order_by"
160
      - $ref: "../swagger.yaml#/parameters/order_by"
Lines 278-283 Link Here
278
          enum:
280
          enum:
279
            - resources
281
            - resources
280
            - resources.package
282
            - resources.package
283
            - extended_attributes
284
            - +strings
281
        collectionFormat: csv
285
        collectionFormat: csv
282
    responses:
286
    responses:
283
      200:
287
      200:
(-)a/api/v1/swagger/paths/extended_attribute_types.yaml (+1 lines)
Lines 24-29 Link Here
24
          - order
24
          - order
25
          - subscription
25
          - subscription
26
          - vendor
26
          - vendor
27
          - title
27
      - $ref: "../swagger.yaml#/parameters/match"
28
      - $ref: "../swagger.yaml#/parameters/match"
28
      - $ref: "../swagger.yaml#/parameters/order_by"
29
      - $ref: "../swagger.yaml#/parameters/order_by"
29
      - $ref: "../swagger.yaml#/parameters/page"
30
      - $ref: "../swagger.yaml#/parameters/page"
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/additional-fields.tt (-1 / +2 lines)
Lines 30-36 Link Here
30
</head>
30
</head>
31
31
32
[% marcfield_tables = ['subscription', 'aqorders'] %]
32
[% marcfield_tables = ['subscription', 'aqorders'] %]
33
[% searchable_tables = ['subscription', 'aqbasket', 'aqinvoices', 'erm_licenses', 'erm_agreements', 'erm_packages', 'aqbooksellers:vendor'] %]
33
[% searchable_tables = ['subscription', 'aqbasket', 'aqinvoices', 'erm_licenses', 'erm_agreements', 'erm_packages', 'aqbooksellers:vendor', 'erm_titles'] %]
34
[% show_marcfield = marcfield_tables.grep('^' _ tablename _ '$').size ? 1 : 0 %]
34
[% show_marcfield = marcfield_tables.grep('^' _ tablename _ '$').size ? 1 : 0 %]
35
[% show_searchable = searchable_tables.grep('^' _ tablename _ '$').size ? 1 : 0 %]
35
[% show_searchable = searchable_tables.grep('^' _ tablename _ '$').size ? 1 : 0 %]
36
36
Lines 146-151 Link Here
146
                        [% WRAPPER table_option value="erm_agreements" %]Agreements[% END %]
146
                        [% WRAPPER table_option value="erm_agreements" %]Agreements[% END %]
147
                        [% WRAPPER table_option value="erm_licenses" %]Licenses[% END %]
147
                        [% WRAPPER table_option value="erm_licenses" %]Licenses[% END %]
148
                        [% WRAPPER table_option value="erm_packages" %]Packages[% END %]
148
                        [% WRAPPER table_option value="erm_packages" %]Packages[% END %]
149
                        [% WRAPPER table_option value="erm_titles" %]Titles[% END %]
149
                    </ul>
150
                    </ul>
150
                [% END %]
151
                [% END %]
151
                [% IF CAN_user_updatecharges_remaining_permissions || CAN_user_parameters_manage_accounts %]
152
                [% IF CAN_user_updatecharges_remaining_permissions || CAN_user_parameters_manage_accounts %]
(-)a/koha-tmpl/intranet-tmpl/prog/js/fetch/erm-api-client.js (-1 / +2 lines)
Lines 155-161 export class ERMAPIClient { Link Here
155
                this.httpClient.get({
155
                this.httpClient.get({
156
                    endpoint: "eholdings/local/titles/" + id,
156
                    endpoint: "eholdings/local/titles/" + id,
157
                    headers: {
157
                    headers: {
158
                        "x-koha-embed": "resources,resources.package",
158
                        "x-koha-embed":
159
                            "resources,resources.package,extended_attributes,+strings",
159
                    },
160
                    },
160
                }),
161
                }),
161
            delete: id =>
162
            delete: id =>
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitleResource.vue (-4 / +5 lines)
Lines 68-73 export default { Link Here
68
            props,
68
            props,
69
            additionalToolbarButtons,
69
            additionalToolbarButtons,
70
            moduleStore: "ERMStore",
70
            moduleStore: "ERMStore",
71
            extendedAttributesResourceType: "title",
71
            resourceAttrs: [
72
            resourceAttrs: [
72
                {
73
                {
73
                    name: "publication_title",
74
                    name: "publication_title",
Lines 440-446 export default { Link Here
440
        const tableOptions = {
441
        const tableOptions = {
441
            url: baseResource.getResourceTableUrl(),
442
            url: baseResource.getResourceTableUrl(),
442
            options: {
443
            options: {
443
                embed: "resources.package",
444
                embed: "resources.package,extended_attributes,+strings",
444
                searchCols: [
445
                searchCols: [
445
                    { search: defaults.publication_title },
446
                    { search: defaults.publication_title },
446
                    null,
447
                    null,
Lines 488-493 export default { Link Here
488
            let title_id = title.title_id;
489
            let title_id = title.title_id;
489
            delete title.title_id;
490
            delete title.title_id;
490
            delete title.biblio_id;
491
            delete title.biblio_id;
492
            delete title._strings;
491
493
492
            // Cannot use the map/keepAttrs because of the reserved keyword 'package'
494
            // Cannot use the map/keepAttrs because of the reserved keyword 'package'
493
            title.resources.forEach(function (e) {
495
            title.resources.forEach(function (e) {
Lines 499-505 export default { Link Here
499
                return baseResource.apiClient.update(title, title_id).then(
501
                return baseResource.apiClient.update(title, title_id).then(
500
                    title => {
502
                    title => {
501
                        baseResource.setMessage($__("Title updated"));
503
                        baseResource.setMessage($__("Title updated"));
502
                        return title
504
                        return title;
503
                    },
505
                    },
504
                    error => {}
506
                    error => {}
505
                );
507
                );
Lines 507-513 export default { Link Here
507
                return baseResource.apiClient.create(title).then(
509
                return baseResource.apiClient.create(title).then(
508
                    title => {
510
                    title => {
509
                        baseResource.setMessage($__("Title created"));
511
                        baseResource.setMessage($__("Title created"));
510
                        return title
512
                        return title;
511
                    },
513
                    },
512
                    error => {}
514
                    error => {}
513
                );
515
                );
514
- 

Return to bug 40192