Bugzilla – Attachment 43106 Details for
Bug 14950
A date is not correctly filled in default values from batch mod [was Remove C4::Dates from tools/batchMod.pl]
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14950 - Remove C4::Dates from tools/batchMod.pl
Bug-14950---Remove-C4Dates-from-toolsbatchModpl.patch (text/plain), 2.99 KB, created by
Joonas Kylmälä
on 2015-10-05 08:04:12 UTC
(
hide
)
Description:
Bug 14950 - Remove C4::Dates from tools/batchMod.pl
Filename:
MIME Type:
Creator:
Joonas Kylmälä
Created:
2015-10-05 08:04:12 UTC
Size:
2.99 KB
patch
obsolete
>From 2db9983b90e1deca8820503e145533817adf378a Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Marc=20V=C3=A9ron?= <veron@veron.ch> >Date: Sun, 4 Oct 2015 20:11:26 +0200 >Subject: [PATCH] Bug 14950 - Remove C4::Dates from tools/batchMod.pl >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >This patch removes C4::Dates from tools/batchMod.pl > >To test: > >- In MARC bibliographic Default 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 >- Got to Home > Tools > Batch item modification >- Enter one ore more barcodes you want to modify >- Check checkbox 'Populate fields with defautl values from defautl framework >- Click 'Continue' >- Verify on the follwing screen that the field in Edit form is populated > as appropriate (in our example 'x - Non public note') >- Clcik 'Save' >- Verify that the items are updated as appropriate > >Signed-off-by: Joonas Kylmälä <j.kylmala@gmail.com> >--- > tools/batchMod.pl | 15 +++++++++------ > 1 file changed, 9 insertions(+), 6 deletions(-) > >diff --git a/tools/batchMod.pl b/tools/batchMod.pl >index 5108419..a7c8d70 100755 >--- a/tools/batchMod.pl >+++ b/tools/batchMod.pl >@@ -31,11 +31,11 @@ use C4::Koha; # XXX subfield_is_koha_internal_p > use C4::Branch; # XXX subfield_is_koha_internal_p > use C4::BackgroundJob; > use C4::ClassSource; >-use C4::Dates; > use C4::Debug; > use C4::Members; > use MARC::File::XML; > use List::MoreUtils qw/uniq/; >+use Koha::DateUtils; > > my $input = new CGI; > my $dbh = C4::Context->dbh; >@@ -76,7 +76,7 @@ my $restrictededition = $uid ? haspermission($uid, {'tools' => 'items_batchmod_ > # In case user is a superlibrarian, edition is not restricted > $restrictededition = 0 if ($restrictededition != 0 && C4::Context->IsSuperLibrarian()); > >-my $today_iso = C4::Dates->today('iso'); >+my $today_iso = output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }); > $template->param(today_iso => $today_iso); > $template->param(del => $del); > >@@ -334,10 +334,13 @@ foreach my $tag (sort keys %{$tagslib}) { > if ( !$value && $use_default_values) { > $value = $tagslib->{$tag}->{$subfield}->{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; >+ my $year = $today->year; >+ my $month = $today->month; >+ my $day = $today->day; >+ $value =~ s/YYYY/$year/g; >+ $value =~ s/MM/$month/g; >+ $value =~ s/DD/$day/g; > } > $subfield_data{visibility} = "display:none;" if (($tagslib->{$tag}->{$subfield}->{hidden} > 4) || ($tagslib->{$tag}->{$subfield}->{hidden} < -4)); > # testing branch value if IndependentBranches. >-- >1.9.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 14950
:
43095
|
43106
|
43155
|
43156
|
43434