Bugzilla – Attachment 43069 Details for
Bug 14922
Remove C4::Dates from cataloguing/additem.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14922 - Remove C4::Dates from cataloguing/additem.pl
Bug-14922---Remove-C4Dates-from-cataloguingadditem.patch (text/plain), 4.74 KB, created by
Marc Véron
on 2015-10-02 14:28:19 UTC
(
hide
)
Description:
Bug 14922 - Remove C4::Dates from cataloguing/additem.pl
Filename:
MIME Type:
Creator:
Marc Véron
Created:
2015-10-02 14:28:19 UTC
Size:
4.74 KB
patch
obsolete
>From 67deab7d40d7af2961eabea0fb883ac39eaaba78 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Marc=20V=C3=A9ron?= <veron@veron.ch> >Date: Wed, 30 Sep 2015 14:58:40 +0200 >Subject: [PATCH] Bug 14922 - Remove C4::Dates from cataloguing/additem.pl > >This patch removes C4::Dates from cataloguing/additem.pl > >To test: > >- In MARC bibliographic framework, define a default value > for one of the in Tag 952 Subfield struture, e.g. for > subfield x Non-public note. You can define it under > 'Advancde constraints'. Define the value similar to the following: > Year:YYYY Month:MM Day:DD >- Create a new item for a biblio and verify that YYYY, MM and DD are > replaced with today's values. >- Apply patch and repeat that previous step behaves as before. >- Verify that the overall functionality of the form is the same > as before applying the patch. > >Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com> >Works as advertised. With the last script not accept more than YYYYMMDD >If you enter something else, the script sends to the end of line. >This patch follow up the pattern in constraint default value > >Patch amended following comment #6 / mv >--- > cataloguing/additem.pl | 17 ++++++++--------- > 1 file changed, 8 insertions(+), 9 deletions(-) > >diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl >index 696f3cd..4be75f7 100755 >--- a/cataloguing/additem.pl >+++ b/cataloguing/additem.pl >@@ -31,7 +31,7 @@ use C4::Circulation; > use C4::Koha; # XXX subfield_is_koha_internal_p > use C4::Branch; # XXX subfield_is_koha_internal_p > use C4::ClassSource; >-use C4::Dates; >+use Koha::DateUtils; > use List::MoreUtils qw/any/; > use C4::Search; > use Storable qw(thaw freeze); >@@ -104,7 +104,7 @@ sub _increment_barcode { > > > sub generate_subfield_form { >- my ($tag, $subfieldtag, $value, $tagslib,$subfieldlib, $branches, $today_iso, $biblionumber, $temp, $loop_data, $i, $restrictededition) = @_; >+ my ($tag, $subfieldtag, $value, $tagslib,$subfieldlib, $branches, $biblionumber, $temp, $loop_data, $i, $restrictededition) = @_; > > my $frameworkcode = &GetFrameworkCode($biblionumber); > >@@ -129,10 +129,10 @@ sub generate_subfield_form { > if ( ! defined( $value ) || $value eq '') { > $value = $subfieldlib->{defaultvalue}; > # get today date & replace YYYY, MM, DD if provided in the default value >- my ( $year, $month, $day ) = split ',', $today_iso; # FIXME: iso dates don't have commas! >- $value =~ s/YYYY/$year/g; >- $value =~ s/MM/$month/g; >- $value =~ s/DD/$day/g; >+ my $today = dt_from_string; >+ $value =~ s/YYYY/$today->year/g; >+ $value =~ s/MM/$today->month/g; >+ $value =~ s/DD/$today->day/g; > } > > $subfield_data{visibility} = "display:none;" if (($subfieldlib->{hidden} > 4) || ($subfieldlib->{hidden} <= -4)); >@@ -402,7 +402,6 @@ $restrictededition = 0 if ($restrictededition != 0 && C4::Context->IsSuperLibra > # In case user has fast cataloging permission (and we're in fast cataloging), editing is not restricted > $restrictededition = 0 if ($restrictededition != 0 && $frameworkcode eq 'FA' && haspermission($uid, {'editcatalogue' => 'fast_cataloging'})); > >-my $today_iso = C4::Dates->today('iso'); > my $tagslib = &GetMarcStructure(1,$frameworkcode); > my $record = GetMarcBiblio($biblionumber); > my $oldrecord = TransformMarcToKoha($dbh,$record); >@@ -841,7 +840,7 @@ if($itemrecord){ > next if subfield_is_koha_internal_p($subfieldtag); > next if ($tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10"); > >- my $subfield_data = generate_subfield_form($tag, $subfieldtag, $value, $tagslib, $subfieldlib, $branches, $today_iso, $biblionumber, $temp, \@loop_data, $i, $restrictededition); >+ my $subfield_data = generate_subfield_form($tag, $subfieldtag, $value, $tagslib, $subfieldlib, $branches, $biblionumber, $temp, \@loop_data, $i, $restrictededition); > push @fields, "$tag$subfieldtag"; > push (@loop_data, $subfield_data); > $i++; >@@ -865,7 +864,7 @@ foreach my $tag ( keys %{$tagslib}){ > my @values = (undef); > @values = $itemrecord->field($tag)->subfield($subtag) if ($itemrecord && defined($itemrecord->field($tag)) && defined($itemrecord->field($tag)->subfield($subtag))); > for my $value (@values){ >- my $subfield_data = generate_subfield_form($tag, $subtag, $value, $tagslib, $tagslib->{$tag}->{$subtag}, $branches, $today_iso, $biblionumber, $temp, \@loop_data, $i, $restrictededition); >+ my $subfield_data = generate_subfield_form($tag, $subtag, $value, $tagslib, $tagslib->{$tag}->{$subtag}, $branches, $biblionumber, $temp, \@loop_data, $i, $restrictededition); > push (@loop_data, $subfield_data); > $i++; > } >-- >1.7.10.4
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 14922
:
42951
|
42973
|
42987
|
43069
|
43203
|
43215
|
43216
|
43435
|
43436