Bugzilla – Attachment 157331 Details for
Bug 35044
Additional fields: Allow for repeatable fields
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35044: Update: Serial subscriptions
Bug-35044-Update-Serial-subscriptions.patch (text/plain), 11.58 KB, created by
Pedro Amorim
on 2023-10-18 14:48:50 UTC
(
hide
)
Description:
Bug 35044: Update: Serial subscriptions
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2023-10-18 14:48:50 UTC
Size:
11.58 KB
patch
obsolete
>From 7e4a374de76f5feeb8d2fb49fc5427694d92cec2 Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Date: Mon, 16 Oct 2023 09:20:01 +0000 >Subject: [PATCH] Bug 35044: Update: Serial subscriptions > >Test plan, k-t-d: > >Preparation: Create additional fields for table 'subscription', visit: >/cgi-bin/koha/admin/additional-fields.pl?tablename=subscription > >2 text fields, one repeatable, one not-repeatable >2 AV fields, one repeatable, one not-repeatable >2 MARC fields, one 'get' and one 'set', both non-repeatable, MARC field 942$c >Attempt to create a repeatable MARC field (get or set). Notice you're unable to. > >1) Add a new serial subscription, visit: >/cgi-bin/koha/serials/subscription-add.pl >2) Set the mandatory "Record" input (e.g. '112'). Click the 'Next' and press 'Ok' on the alert box. >3) Fill in all required fields and press "Test prediction pattern" >4) At the bottom, fill in all additional fields, click the '+New' and 'Clear' links, hit 'Save' >5) Notice the fields are shown, repeated fields are comma separated >6) Click Edit -> Edit Subscription, repeat steps 4 and 5 >7) Go back to subscription additional fields, set all fields as searchable >8) Visit serials-home: >/cgi-bin/koha/serials/serials-home.pl >9) Click 'Search' >10) Notice the searchable fields now show in their columns, repeated fields separated by comma >11) Perform a search using a repeatable field, verify it all works as expected. > >-- Subscription Claims -- > >Preparation: >1) Define a new claim notice, visit: >/cgi-bin/koha/tools/letter.pl?op=add_form&module=claimissues >2) Input code, name, click "Email" set a "Message subject" and put something in the message body. Hit 'Save'. >3) Set a serial as late, visit our original subscription: >/cgi-bin/koha/serials/serials-collection.pl?subscriptionid=1 >4) Click "Edit serials" and status -> "Late". Hit "Save". >5) Link the original subscription to the existing vendor, visit: >/cgi-bin/koha/serials/subscription-add.pl?op=modify&subscriptionid=1 >6) Click "Search for a vendor". Hit "Ok". Hit "Choose". Save the subscription. > >Claims: >7) Visit claims: >/cgi-bin/koha/serials/claims.pl >8) Click "Ok" >9) Verify that searchable additional fields all have their respective column. Repeated fields are shown comma separated. >--- > C4/Serials.pm | 2 ++ > .../prog/en/includes/serials-advsearch.inc | 2 +- > .../prog/en/modules/serials/claims.tt | 8 +---- > .../prog/en/modules/serials/serials-search.tt | 8 +---- > .../en/modules/serials/subscription-add.tt | 1 + > serials/claims.pl | 3 ++ > serials/subscription-add.pl | 36 +++++++++---------- > serials/subscription-detail.pl | 2 +- > 8 files changed, 27 insertions(+), 35 deletions(-) > >diff --git a/C4/Serials.pm b/C4/Serials.pm >index 1eae56bc8d..30cf72bb10 100644 >--- a/C4/Serials.pm >+++ b/C4/Serials.pm >@@ -632,6 +632,8 @@ sub SearchSubscriptions { > $subscription->{additional_fields} = { map { $_->field->name => $_->value } > $subscription_object->additional_field_values->as_list }; > >+ #FIXME: The above $subscription->{additional_fields} may be redundant. Remove if so. >+ $subscription->{additional_field_values} = $subscription_object->get_additional_field_values_for_template; > } > > return @$results; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/serials-advsearch.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/serials-advsearch.inc >index ec34b6f073..5e651d6568 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/serials-advsearch.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/serials-advsearch.inc >@@ -50,7 +50,7 @@ > <label for="to">Expires before:</label> > <input type="text" id="to" name="expiration_date_filter" value="[% expiration_date_filter | html %]" size="10" maxlength="10" class="flatpickr" /> > </li> >- [% INCLUDE 'additional-fields-entry.inc' available=additional_fields_for_subscription values=additional_field_filters wrap_fieldset=0 %] >+ [% INCLUDE 'additional-fields-entry.inc' available=additional_fields_for_subscription values=additional_field_filters wrap_fieldset=0 search_form=1 %] > </ol> > <input type="hidden" name="searched" value="1" /> > [% IF ( mana ) %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/claims.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/claims.tt >index 613650f5ab..e453baf57a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/claims.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/claims.tt >@@ -165,13 +165,7 @@ > <td data-order="[% missingissue.claimdate | html %]"> > [% missingissue.claimdate | $KohaDates %] > </td> >- [% FOR field IN additional_fields_for_subscription %] >- [% IF field.authorised_value_category %] >- <td>[% AuthorisedValues.GetByCode( field.authorised_value_category, missingissue.additional_fields.${field.name} ) | html %]</td> >- [% ELSE %] >- <td>[% missingissue.additional_fields.${field.name} | html %]</td> >- [% END %] >- [% END %] >+ [% INCLUDE 'additional-fields-display.inc' available=additional_fields_for_subscription values=missingissue.additional_field_values value_only=1 is_table_cell=1 %] > </tr> > [% END # /FOREACH missingissue %] > </tbody> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt >index 39f712b930..ed7f6bc5da 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt >@@ -121,13 +121,7 @@ > </td> > [% END %] > >- [% FOR field IN additional_fields_for_subscription %] >- [% IF field.authorised_value_category %] >- <td>[% AuthorisedValues.GetByCode( field.authorised_value_category, subscription.additional_fields.${field.name} ) | html %]</td> >- [% ELSE %] >- <td>[% subscription.additional_fields.${field.name} | html %]</td> >- [% END %] >- [% END %] >+ [% INCLUDE 'additional-fields-display.inc' available=additional_fields_for_subscription values=subscription.additional_field_values value_only=1 is_table_cell=1 %] > > <td> > <div class="btn-group dropup"> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt >index 19d53a1c33..5af5066578 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt >@@ -594,6 +594,7 @@ fieldset.rows table { clear: none; margin: 0; } > </script> > [% Asset.js("js/subscription-add.js") | $raw %] > [% Asset.js("js/showpredictionpattern.js") | $raw %] >+ [% Asset.js("js/additional-fields-entry.js") | $raw %] > [% END %] > > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/serials/claims.pl b/serials/claims.pl >index 5b5479f749..363541fedf 100755 >--- a/serials/claims.pl >+++ b/serials/claims.pl >@@ -86,6 +86,9 @@ if ($supplierid) { > foreach my $issue (@missingissues) { > $issue->{cannot_claim} = 1 > unless C4::Serials::can_claim_subscription($issue); >+ >+ $issue->{additional_field_values} = >+ Koha::Subscriptions->find( $issue->{subscriptionid} )->get_additional_field_values_for_template; > } > $template->param( suppliername => $supplier->name ); > } >diff --git a/serials/subscription-add.pl b/serials/subscription-add.pl >index f8cbc572f2..699e1dfd67 100755 >--- a/serials/subscription-add.pl >+++ b/serials/subscription-add.pl >@@ -132,17 +132,11 @@ $template->param( > ); > > my @additional_fields = Koha::AdditionalFields->search({ tablename => 'subscription' })->as_list; >-my %additional_field_values; >-if ($subscriptionid) { >- my $subscription = Koha::Subscriptions->find($subscriptionid); >- foreach my $value ($subscription->additional_field_values->as_list) { >- $additional_field_values{$value->field_id} = $value->value; >- } >-} >+my @additional_field_values = Koha::Subscriptions->find($subscriptionid)->get_additional_field_values_for_template if $subscriptionid; > > $template->param( >- additional_fields => \@additional_fields, >- additional_field_values => \%additional_field_values, >+ additional_fields => \@additional_fields, >+ additional_field_values => @additional_field_values, > ); > > my $typeloop = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } }; >@@ -368,11 +362,13 @@ sub redirect_add_subscription { > my $biblio = Koha::Biblios->find($biblionumber); > my $subscription_fields = Koha::AdditionalFields->search({ tablename => 'subscription' }); > while ( my $field = $subscription_fields->next ) { >- my $value = $query->param('additional_field_' . $field->id); >- push @additional_fields, { >- id => $field->id, >- value => $value, >- }; >+ my @field_values = $query->param( 'additional_field_' . $field->id ); >+ foreach my $value (@field_values) { >+ push @additional_fields, { >+ id => $field->id, >+ value => $value, >+ } if $value; >+ } > } > Koha::Subscriptions->find($subscriptionid)->set_additional_fields(\@additional_fields); > >@@ -482,11 +478,13 @@ sub redirect_mod_subscription { > my $biblio = Koha::Biblios->find($biblionumber); > my $subscription_fields = Koha::AdditionalFields->search({ tablename => 'subscription' }); > while ( my $field = $subscription_fields->next ) { >- my $value = $query->param('additional_field_' . $field->id); >- push @additional_fields, { >- id => $field->id, >- value => $value, >- }; >+ my @field_values = $query->param( 'additional_field_' . $field->id ); >+ foreach my $value (@field_values) { >+ push @additional_fields, { >+ id => $field->id, >+ value => $value, >+ } if $value; >+ } > } > Koha::Subscriptions->find($subscriptionid)->set_additional_fields(\@additional_fields); > >diff --git a/serials/subscription-detail.pl b/serials/subscription-detail.pl >index 74a0ee8aab..9b913f5e2d 100755 >--- a/serials/subscription-detail.pl >+++ b/serials/subscription-detail.pl >@@ -127,7 +127,7 @@ my $numberpattern = C4::Serials::Numberpattern::GetSubscriptionNumberpattern($su > > $template->param( > available_additional_fields => Koha::AdditionalFields->search( { tablename => 'subscription' } ), >- additional_field_values => { map { $_->field->name => $_->value } $subscription->additional_field_values->as_list }, >+ additional_field_values => $subscription->get_additional_field_values_for_template, > ); > > # FIXME Do we want to hide canceled orders? >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 35044
:
157324
|
157325
|
157326
|
157327
|
157328
|
157329
|
157330
|
157331
|
157332
|
157333
|
157334
|
158113
|
158498
|
158499
|
158500
|
158501
|
158502
|
158503
|
158504
|
158505
|
158506
|
158507
|
158508
|
158857
|
158858
|
158859
|
158860
|
158861
|
158862
|
158863
|
158864
|
158865
|
158866
|
158867
|
158868
|
159268
|
160177
|
160178
|
160179
|
160180
|
160181
|
160182
|
160183
|
160184
|
160185
|
160186
|
160187
|
160188
|
160189
|
164162
|
164163
|
164164
|
164165
|
164166
|
164167
|
164168
|
164169
|
164170
|
164171
|
164172
|
164173
|
164174
|
167690
|
168537
|
168538
|
168539
|
168540
|
168541
|
168542
|
168543
|
168544
|
168545
|
168546
|
168547
|
168548
|
169545
|
169546
|
169547
|
169603
|
169604
|
169605
|
169606
|
169607
|
169643
|
169644
|
169645
|
169646
|
169647
|
169648
|
169649
|
169650
|
169651
|
169652
|
169653
|
169654
|
169655
|
169656
|
169657
|
169658
|
169659
|
169660
|
169661
|
169662
|
169663
|
169664
|
169665
|
169666
|
169667
|
169668
|
169669
|
169670
|
169671
|
169672
|
169673
|
169674
|
169675
|
169676
|
169677
|
169678
|
169679
|
169680
|
169681
|
169682
|
169683
|
169684
|
169697
|
170501