Bugzilla – Attachment 154190 Details for
Bug 30708
Creation of a new 'Preservation' module
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30708: Display AV descriptions instead of codes
Bug-30708-Display-AV-descriptions-instead-of-codes.patch (text/plain), 8.90 KB, created by
Jonathan Druart
on 2023-08-03 08:23:47 UTC
(
hide
)
Description:
Bug 30708: Display AV descriptions instead of codes
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-08-03 08:23:47 UTC
Size:
8.90 KB
patch
obsolete
>From 93a10a2432f84ffb87ac7a733a91728940061019 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 6 Jun 2023 15:14:36 +0200 >Subject: [PATCH] Bug 30708: Display AV descriptions instead of codes > >Sponsored-by: BULAC - http://www.bulac.fr/ >Signed-off-by: BULAC - http://www.bulac.fr/ >Signed-off-by: Heather Hernandez <heather_hernandez@nps.gov> >Signed-off-by: Laurence Rault <laurence.rault@biblibre.com> >--- > Koha/Preservation/Train/Item/Attribute.pm | 28 ++++++++++++++++- > api/v1/swagger/paths/preservation_trains.yaml | 1 + > .../components/Preservation/TrainsShow.vue | 12 ++++---- > .../js/vue/fetch/preservation-api-client.js | 30 ++++++++++--------- > 4 files changed, 50 insertions(+), 21 deletions(-) > >diff --git a/Koha/Preservation/Train/Item/Attribute.pm b/Koha/Preservation/Train/Item/Attribute.pm >index b99b84e6c8e..1618dc582e6 100644 >--- a/Koha/Preservation/Train/Item/Attribute.pm >+++ b/Koha/Preservation/Train/Item/Attribute.pm >@@ -20,7 +20,7 @@ use Modern::Perl; > use JSON qw( to_json ); > use Try::Tiny; > >-use Koha::Database; >+use Koha::AuthorisedValues; > > use base qw(Koha::Object); > >@@ -50,6 +50,32 @@ sub processing_attribute { > return Koha::Preservation::Processing::Attribute->_new_from_dbic($processing_attribute_rs) > } > >+=head3 strings_map >+ >+Returns a map of column name to string representations including the string. >+ >+=cut >+ >+sub strings_map { >+ my ($self) = @_; >+ my $str = $self->value; >+ if ( $self->processing_attribute->type eq 'authorised_value' ) { >+ my $av = Koha::AuthorisedValues->search( >+ { >+ category => $self->processing_attribute->option_source, >+ authorised_value => $self->value, >+ } >+ ); >+ if ( $av->count ) { >+ $str = $av->next->lib || $self->value; >+ } >+ } >+ >+ return { >+ value => { str => $str, type => 'authorised_value' }, >+ }; >+} >+ > =head2 Internal methods > > =head3 _type >diff --git a/api/v1/swagger/paths/preservation_trains.yaml b/api/v1/swagger/paths/preservation_trains.yaml >index dd4058e475a..a8563e8769d 100644 >--- a/api/v1/swagger/paths/preservation_trains.yaml >+++ b/api/v1/swagger/paths/preservation_trains.yaml >@@ -165,6 +165,7 @@ > enum: > - items > - items.attributes >+ - items.attributes+strings > - items.attributes.processing_attribute > - default_processing > - default_processing.attributes >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/TrainsShow.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/TrainsShow.vue >index 3126273b80f..43bd0d00ba5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/TrainsShow.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/TrainsShow.vue >@@ -173,9 +173,8 @@ > ) in item.attributes" > v-bind:key="counter_attribute" > > >- <!-- FIXME We need to display the description of the AV here --> > {{ attribute.processing_attribute.name }}={{ >- attribute.value >+ attribute._strings.value.str > }} > </span> > </div> >@@ -238,6 +237,7 @@ export default { > train_list: [], > train_id_selected_for_copy: null, > train_item_id_to_copy: null, >+ av_options: {}, > } > }, > beforeRouteEnter(to, from, next) { >@@ -252,12 +252,12 @@ export default { > await client.trains.get(train_id).then( > train => { > this.train = train >- let display = this.train.items.every( >+ let display_table = this.train.items.every( > item => > item.processing_id == > this.train.default_processing_id > ) >- if (display) { >+ if (display_table) { > this.item_table.data = [] > this.train.items.forEach(item => { > let item_row = {} >@@ -271,7 +271,7 @@ export default { > a.processing_attribute_id == > attribute.processing_attribute_id > ) >- .map(a => a.value) >+ .map(a => a._strings.value.str) > } > ) > item_row.item = item >@@ -305,7 +305,7 @@ export default { > }) > } > this.initialized = true >- this.item_table.display = display >+ this.item_table.display = display_table > }, > error => {} > ) >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/preservation-api-client.js b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/preservation-api-client.js >index 356adfac4b6..329a01455ce 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/preservation-api-client.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/preservation-api-client.js >@@ -9,27 +9,28 @@ export class PreservationAPIClient extends HttpClient { > > get trains() { > return { >- get: (id) => >+ get: id => > this.get({ > endpoint: "trains/" + id, > headers: { > "x-koha-embed": >- "default_processing,default_processing.attributes,items,items.attributes,items.attributes.processing_attribute", >+ "default_processing,default_processing.attributes,items,items.attributes,items.attributes+strings,items.attributes.processing_attribute", > }, > }), > getAll: (query = {}) => > this.get({ >- endpoint: "trains?" + >+ endpoint: >+ "trains?" + > new URLSearchParams({ > _per_page: -1, > ...(query && { q: JSON.stringify(query) }), > }), > }), >- delete: (id) => >+ delete: id => > this.delete({ > endpoint: "trains/" + id, > }), >- create: (train) => >+ create: train => > this.post({ > endpoint: "trains", > body: train, >@@ -54,27 +55,28 @@ export class PreservationAPIClient extends HttpClient { > > get processings() { > return { >- get: (id) => >+ get: id => > this.get({ > endpoint: "processings/" + id, > headers: { > "x-koha-embed": "attributes", > }, > }), >- getAll: (query) => >+ getAll: query => > this.get({ >- endpoint: "processings?" + >+ endpoint: >+ "processings?" + > new URLSearchParams({ > _per_page: -1, > ...(query && { q: JSON.stringify(query) }), > }), > }), > >- delete: (id) => >+ delete: id => > this.delete({ > endpoint: "processings/" + id, > }), >- create: (processing) => >+ create: processing => > this.post({ > endpoint: "processings", > body: processing, >@@ -148,7 +150,7 @@ export class PreservationAPIClient extends HttpClient { > > get waiting_list_items() { > return { >- get_from_barcode: (barcode) => { >+ get_from_barcode: barcode => { > const q = { > "me.barcode": barcode, > }; >@@ -164,15 +166,15 @@ export class PreservationAPIClient extends HttpClient { > headers: { > "x-koha-embed": "biblio", > }, >- }).then((response) => { >+ }).then(response => { > return response.length ? response[0] : undefined; > }); > }, >- delete: (id) => >+ delete: id => > this.delete({ > endpoint: "waiting-list/items/" + id, > }), >- createAll: (items) => >+ createAll: items => > this.post({ > endpoint: "waiting-list/items", > body: items, >-- >2.25.1
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 30708
:
134715
|
134716
|
134732
|
134733
|
134734
|
134736
|
134737
|
134738
|
134782
|
134783
|
134784
|
134785
|
152939
|
152940
|
152941
|
152942
|
152943
|
152944
|
152945
|
152946
|
152947
|
152948
|
152949
|
152950
|
152951
|
152952
|
152953
|
152954
|
152955
|
152956
|
152957
|
152958
|
152959
|
152960
|
152961
|
152962
|
152963
|
152964
|
152965
|
152966
|
152967
|
152968
|
152969
|
152970
|
153102
|
153576
|
154167
|
154168
|
154169
|
154170
|
154171
|
154172
|
154173
|
154174
|
154175
|
154176
|
154177
|
154178
|
154179
|
154180
|
154181
|
154182
|
154183
|
154184
|
154185
|
154186
|
154187
|
154188
|
154189
|
154190
|
154191
|
154192
|
154193
|
154194
|
154195
|
154196
|
154197
|
154198
|
154199
|
154200
|
154201
|
154202
|
154203
|
156592
|
156596
|
156597
|
156636
|
156637
|
156638
|
156639
|
156640
|
156641
|
156642
|
156643
|
156644
|
156645
|
156646
|
156647
|
156648
|
156649
|
156650
|
156651
|
156652
|
156653
|
156654
|
156655
|
156656
|
156657
|
156658
|
156659
|
156660
|
156661
|
156662
|
156663
|
156664
|
156665
|
156666
|
156667
|
156668
|
156669
|
156670
|
156671
|
156672
|
156673
|
156674
|
156675
|
157502
|
157503
|
157506
|
157508
|
157512
|
157514
|
157557