Bugzilla – Attachment 100638 Details for
Bug 5103
Dates in MARC details not formatted correctly
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 5103: Refactor the code to avoid repetition
Bug-5103-Refactor-the-code-to-avoid-repetition.patch (text/plain), 4.62 KB, created by
Jonathan Druart
on 2020-03-12 14:09:34 UTC
(
hide
)
Description:
Bug 5103: Refactor the code to avoid repetition
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-03-12 14:09:34 UTC
Size:
4.62 KB
patch
obsolete
>From aa4665572338899fdf17731af179a92602d9ad98 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 12 Mar 2020 15:09:02 +0100 >Subject: [PATCH] Bug 5103: Refactor the code to avoid repetition > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > catalogue/MARCdetail.pl | 12 ++++-------- > cataloguing/additem.pl | 15 +++++++-------- > opac/opac-MARCdetail.pl | 13 +++++-------- > 3 files changed, 16 insertions(+), 24 deletions(-) > >diff --git a/catalogue/MARCdetail.pl b/catalogue/MARCdetail.pl >index 32b51e81f2..44bc8d0801 100755 >--- a/catalogue/MARCdetail.pl >+++ b/catalogue/MARCdetail.pl >@@ -297,14 +297,10 @@ foreach my $field (@fields) { > > $norequests = 0 if $tagslib->{ $field->tag() }->{ $subf[$i][0] }->{kohafield} eq 'items.notforloan' and $subf[$i][1] == 0; > >- if ( $tagslib->{ $field->tag() }->{ $subf[$i][0] }->{kohafield} eq 'items.dateaccessioned' || >- $tagslib->{ $field->tag() }->{ $subf[$i][0] }->{kohafield} eq 'items.onloan' || >- $tagslib->{ $field->tag() }->{ $subf[$i][0] }->{kohafield} eq 'items.datelastseen' || >- $tagslib->{ $field->tag() }->{ $subf[$i][0] }->{kohafield} eq 'items.datelastborrowed' || >- $tagslib->{ $field->tag() }->{ $subf[$i][0] }->{kohafield} eq 'items.replacementpricedate' >- ){ >- $item->{$subf[$i][0]} = output_pref({ dt => dt_from_string( $item->{$subf[$i][0]} ), dateonly => 1 }); >- } >+ my $kohafield = $tagslib->{ $field->tag() }->{ $subf[$i][0] }->{kohafield}; >+ $item->{ $subf[$i][0] } = output_pref( { str => $item->{ $subf[$i][0] }, dateonly => 1 } ) >+ if grep { $kohafield eq $_ } >+ qw( items.dateaccessioned items.onloan items.datelastseen items.datelastborrowed items.replacementpricedate ); > } > push @item_loop, $item if $item; > } >diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl >index 0a7fb2505d..0bfeae72f5 100755 >--- a/cataloguing/additem.pl >+++ b/cataloguing/additem.pl >@@ -865,14 +865,13 @@ for my $row ( @big_array ) { > $item_field->{field} = ''; > } > >- my ($tmpa, $dateaccessioned) = &GetMarcFromKohaField( "items.dateaccessioned" ); >- my ($tmpb, $onloan) = &GetMarcFromKohaField( "items.onloan" ); >- my ($tmpc, $datelastseen) = &GetMarcFromKohaField( "items.datelastseen" ); >- my ($tmpd, $datelastborrowed) = &GetMarcFromKohaField( "items.datelastborrowed" ); >- my ($tmpe, $replacementpricedate) = &GetMarcFromKohaField( "items.replacementpricedate" ); >- if ( $key eq $dateaccessioned || $key eq $onloan || $key eq $datelastseen || $key eq $datelastborrowed || $key eq $replacementpricedate ){ >- # date accessioned || on loan || date last seen || date last borrowed || replacement price date >- $item_field->{field} = output_pref({ dt => dt_from_string( $row->{$key} ), dateonly => 1 }); >+ for my $kohafield ( >+ qw( items.dateaccessioned items.onloan items.datelastseen items.datelastborrowed items.replacementpricedate ) >+ ) >+ { >+ my ( undef, $subfield ) = GetMarcFromKohaField($kohafield); >+ next unless $key eq $subfield; >+ $item_field->{field} = output_pref( { str => $row->{$key}, dateonly => 1 } ); > } > > push @item_fields, $item_field; >diff --git a/opac/opac-MARCdetail.pl b/opac/opac-MARCdetail.pl >index 0c4b2c7771..b835f1bdea 100755 >--- a/opac/opac-MARCdetail.pl >+++ b/opac/opac-MARCdetail.pl >@@ -313,14 +313,11 @@ foreach my $field (@fields) { > $subf[$i][1], '', $tagslib, '', 'opac' ); > } > >- if ( $tagslib->{ $field->tag() }->{ $subf[$i][0] }->{kohafield} eq 'items.dateaccessioned' || >- $tagslib->{ $field->tag() }->{ $subf[$i][0] }->{kohafield} eq 'items.onloan' || >- $tagslib->{ $field->tag() }->{ $subf[$i][0] }->{kohafield} eq 'items.datelastseen' || >- $tagslib->{ $field->tag() }->{ $subf[$i][0] }->{kohafield} eq 'items.datelastborrowed' || >- $tagslib->{ $field->tag() }->{ $subf[$i][0] }->{kohafield} eq 'items.replacementpricedate' >- ){ >- $item->{$subf[$i][0]} = output_pref({ dt => dt_from_string( $item->{$subf[$i][0]} ), dateonly => 1 });; >- } >+ my $kohafield = $tagslib->{ $field->tag() }->{ $subf[$i][0] }->{kohafield}; >+ $item->{ $subf[$i][0] } = output_pref( { str => $item->{ $subf[$i][0] }, dateonly => 1 } ) >+ if grep { $kohafield eq $_ } >+ qw( items.dateaccessioned items.onloan items.datelastseen items.datelastborrowed items.replacementpricedate ); >+ > } > push @item_loop, $item if $item; > } >-- >2.20.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 5103
:
2483
|
99627
|
99671
|
100501
|
100527
|
100528
|
100636
|
100637
| 100638