Bugzilla – Attachment 4864 Details for
Bug 5725
Batch modifications for Biblios
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
proposed patch (comments 28 and 29 of Owen)
0002-Bug-5725-follow-up-Fixes-adresses-comments-28-and-29.patch (text/plain), 11.89 KB, created by
Paul Poulain
on 2011-08-05 13:38:07 UTC
(
hide
)
Description:
proposed patch (comments 28 and 29 of Owen)
Filename:
MIME Type:
Creator:
Paul Poulain
Created:
2011-08-05 13:38:07 UTC
Size:
11.89 KB
patch
obsolete
>From a0a3306d1edf5aff2a23c3067175001b1b069574 Mon Sep 17 00:00:00 2001 >From: Paul Poulain <paul.poulain@biblibre.com> >Date: Fri, 5 Aug 2011 15:36:48 +0200 >Subject: [PATCH 2/2] Bug 5725 follow-up Fixes adresses comments 28 and 29 (from Owen) > >* add a link to tools-home >* display the biblios before defining rules >* add some help/change some wording >* fixes result "Status" column (was a H:T:P => T:T glitch) and put the message on the top > >I also removed an unused variable >--- > .../prog/en/modules/tools/batchedit.tt | 123 +++++++++++--------- > .../prog/en/modules/tools/tools-home.tt | 5 + > tools/batchedit.pl | 15 +-- > 3 files changed, 80 insertions(+), 63 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchedit.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchedit.tt >index 981e995..8e0d80e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchedit.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchedit.tt >@@ -122,10 +122,14 @@ > <div class="yui-b"> > > <form method="post" enctype="multipart/form-data"> >-[% IF ( inputform ) %] >+[% IF ( moddone ) %] >+ <div class="dialog message">All operations processed</div> >+[% END %] >+ >+[% UNLESS ( bib_list ) %] > <h2>Batch records modification</h2> > <fieldset class="rows"> >- <legend>Use a file</legend> >+ <legend>Use a file of biblionumbers</legend> > <ol> > <li><label for="uploadfile">File: </label> <input type="file" id="uploadfile" name="uploadfile" /></li> > </ol> >@@ -134,10 +138,11 @@ > <legend>Or enter records one by one</legend> > <ol> > <li> >- <label for="recordslist">Records numbers list (one number per line): </label> >+ <label for="recordslist">One biblionumber per line: </label> > <textarea rows="10" cols="30" id="recordslist" name="recordslist"></textarea> > </li> > </ol> >+ <p><b>Reminder</b>: you can also add biblios to your cart and reach this page from the cart</p> > </fieldset> > [% ELSE %] > <h2>List of records:</h2> >@@ -152,15 +157,17 @@ > <td>[% biblioinfo.biblionumber %]</td> > <td>[% biblioinfo.title %]</td> > <td>[% biblioinfo.author %]</td> >- [% IF ( biblioinfo.moddone ) %] >+ [% IF ( moddone ) %] > [% IF ( biblioinfo.OK ) %] > <td> > [% ELSE %] > <td class="problem"> > [% END %] > [% IF ( biblioinfo.OK ) %]OK[% END %] >- [% IF ( No_Actions ) %]Nothing done[% END %] >- [% IF ( biblioinfo.Actions_Failed ) %]Some Actions failed. List Follow : <ul>[% FOREACH failed_action IN biblioinfo.failed_actions %]<li>[% failed_action.action %]</li>[% END %]</ul>[% END %] >+ [% IF ( biblioinfo.No_Actions ) %]Nothing done[% END %] >+ [% IF ( biblioinfo.Actions_Failed ) %] >+ Some actions failed. List follow : <ul>[% FOREACH failed_action IN biblioinfo.failed_actions %]<li>[% failed_action.action %]</li>[% END %]</ul> >+ [% END %] > </td> > [% END %] > </tr> >@@ -168,56 +175,62 @@ > </table> > [% END %] > >-[% IF ( moddone ) %] >- <div class="dialog alert">All operations processed</div> >-[% ELSE %] >- <fieldset class="rows"> >- <h2>Modification rules:</h2> >- <input type="submit" value="Submit" /> >- <input type="hidden" name="op" value="do" /> >- <input type="hidden" name="bib_list" value="[% bib_list %]" /> >- <table id="rulestable"> >- <thead> >- <tr> >- <th>Field</th><th>Subfield</th><th>Action</th><th>Condition Value</th><th>Value</th><th> </th> >- </tr> >- </thead> >- <tr> >- <td> >- <select name="fieldchoice" id="fieldchoice" onchange="fieldChanged();"> >- [% FOREACH marcfield IN marcfields %] >- <option value="[% marcfield.tag %]">[% marcfield.tag %]</option> >- [% END %] >- </select> >- </td> >- <td> >- <select name="subfieldchoice" id="subfieldchoice" onchange="subfieldChanged();"> >- >- </select> >- </td> >- <td> >- <select name="actionchoice" id="actionchoice"> >- <option value="mod">Modify subfield</option> >- <option value="add">Create subfield</option> >- <option value="addfield">Create field and subfield</option> >- <option value="del">Delete subfield</option> >- </select> >- </td> >- <td id="condvaltd"> >- <input type="text" name="condvalchoice" id="condvalchoice" /> >- <input type="checkbox" id="nocond" name="nocond" value="nocond" onClick="$('#condvalchoice').attr('disabled', ! $('#condvalchoice').attr('disabled') ) ">All</input> >- </td> >- <td id="repvaltd"> >- <input type="text" name="repvalchoice" id="repvalchoice" /> >- </td> >- <td><input type="button" value="Add" onclick="addRule();" /></td> >- </tr> >- </thead> >+[% UNLESS ( moddone ) %] >+ >+ [% IF ( bib_list ) %] >+ <fieldset class="rows"> >+ <h2>Modification rules:</h2> >+ <input type="submit" value="Submit" /> >+ <input type="hidden" name="op" value="do" /> >+ <input type="hidden" name="bib_list" value="[% bib_list %]" /> >+ <table id="rulestable"> >+ <thead> >+ <tr> >+ <th>Field</th><th>Subfield</th><th>Action</th><th>Condition Value</th><th>Value</th><th> </th> >+ </tr> >+ </thead> >+ <tr> >+ <td> >+ <select name="fieldchoice" id="fieldchoice" onchange="fieldChanged();"> >+ [% FOREACH marcfield IN marcfields %] >+ <option value="[% marcfield.tag %]">[% marcfield.tag %]</option> >+ [% END %] >+ </select> >+ </td> >+ <td> >+ <select name="subfieldchoice" id="subfieldchoice" onchange="subfieldChanged();"> > >- </table> >- <input type="submit" value="Submit" /> >- </fieldset> >- </form> >+ </select> >+ </td> >+ <td> >+ <select name="actionchoice" id="actionchoice"> >+ <option value="mod">Modify subfield</option> >+ <option value="add">Create subfield</option> >+ <option value="addfield">Create field and subfield</option> >+ <option value="del">Delete subfield</option> >+ </select> >+ </td> >+ <td id="condvaltd"> >+ <input type="text" name="condvalchoice" id="condvalchoice" /> >+ <input type="checkbox" id="nocond" name="nocond" value="nocond" onClick="$('#condvalchoice').attr('disabled', ! $('#condvalchoice').attr('disabled') ) ">All</input> >+ </td> >+ <td id="repvaltd"> >+ <input type="text" name="repvalchoice" id="repvalchoice" /> >+ </td> >+ <td><input type="button" value="Add" onclick="addRule();" /></td> >+ </tr> >+ </thead> >+ >+ </table> >+ <input type="hidden" name="bib_list" value="[% bib_list %]" /> >+ <input type="submit" value="Submit" /> (don't forget to click "Add" button on the right of the previous form before submitting) >+ </fieldset> >+ </form> >+ [% ELSE %] >+ <input type="submit" value="Submit" /> >+ </fieldset> >+ </form> >+ [% END %] > [% END %] > </div> > </div> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt >index 10f1d6d..f218202 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt >@@ -103,6 +103,11 @@ > <dd>Modify items in a batch</dd> > [% END %] > >+ [% IF ( CAN_user_tools_batchedit ) %] >+ <dt><a href="/cgi-bin/koha/tools/batchedit.pl">Batch biblio modification</a></dt> >+ <dd>Modify biblios in a batch</dd> >+ [% END %] >+ > [% IF ( CAN_user_tools_export_catalog ) %] > <dt><a href="/cgi-bin/koha/tools/export.pl">Export bibliographic and holdings</a></dt> > <dd>Export bibliographic and holdings data</dd> >diff --git a/tools/batchedit.pl b/tools/batchedit.pl >index 0f666b1..73609b9 100755 >--- a/tools/batchedit.pl >+++ b/tools/batchedit.pl >@@ -37,6 +37,7 @@ my $recordslist = $input->param('recordslist'); > my $bib_list = $input->param('bib_list'); > my @biblionumbers; > >+#retrieve the list of biblionumber, from a file, a list entered manually or the basket > if ($filefh) { > while ( my $biblionumber = <$filefh> ) { > $biblionumber =~ s/[\r\n]*$//g; >@@ -55,6 +56,7 @@ my $frameworkcode=""; > my $tagslib = &GetMarcStructure(1,$frameworkcode); > my %report_actions; > >+# if this script is called by ajax, buid an ajax/xml answer > if($input->param('field') and not defined $op){ > ($template, $loggedinuser, $cookie) > = get_template_and_user({template_name => "acqui/ajax.tmpl", >@@ -136,6 +138,7 @@ if($input->param('field') and not defined $op){ > output_html_with_http_headers $input, $cookie, $template->output; > exit; > }else{ >+# standard call (via web browser) > ($template, $loggedinuser, $cookie) > = get_template_and_user({template_name => "tools/batchedit.tmpl", > query => $input, >@@ -144,8 +147,8 @@ if($input->param('field') and not defined $op){ > flagsrequired => { tools => "batchedit" }, > }); > >- $template->param( inputform => 1, ) unless @biblionumbers; >- >+ $template->param( bib_list => join('/', @biblionumbers)); >+ # if no $op, just display the form > if(!defined $op) { > my @modifiablefields; > >@@ -161,9 +164,7 @@ if($input->param('field') and not defined $op){ > push @modifiablefields, \%subfield_data; > } > } >- >- $template->param( marcfields => \@modifiablefields, >- bib_list => $input->param('bib_list'), >+ $template->param(marcfields => \@modifiablefields, > ); > > }else{ >@@ -176,7 +177,6 @@ if($input->param('field') and not defined $op){ > foreach my $biblionumber ( @biblionumbers ){ > my $record = GetMarcBiblio($biblionumber); > my ($count, $biblio) = GetBiblio($biblionumber); >- my $report = 0; > my @failed_actions; > for(my $i = 0 ; $i < scalar(@fields) ; $i++ ){ > my $field = $fields[$i]; >@@ -185,7 +185,6 @@ if($input->param('field') and not defined $op){ > my $condval = $condvals[$i]; > my $nocond = $nocondvals[$i]; > my $repval = $repvals[$i]; >- > my ($result,$record) = BatchModField($record, $field, $subfield, $action, $condval, $nocond, $repval); > push @failed_actions, {action=>"$field $subfield $action ".($nocond eq "true"?"all":$condval)." $repval"} if ($result<=0); > } >@@ -199,7 +198,7 @@ if($input->param('field') and not defined $op){ > elsif (@failed_actions == 0){ > $report_actions{$biblionumber}->{status}="OK"; > } >- ModBiblio($record, $biblionumber, $biblio->{frameworkcode}) unless ($report); >+ ModBiblio($record, $biblionumber, $biblio->{frameworkcode}); > } > $template->param('moddone' => 1); > } >-- >1.7.4.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 5725
:
3105
|
3108
|
3191
|
3193
|
3234
|
3356
|
4734
|
4735
|
4736
|
4863
|
4864
|
4897
|
4898
|
4899
|
5404
|
5405
|
5684
|
5685
|
5697
|
5959
|
5960
|
5980
|
5981
|
5982
|
10610
|
10611
|
10612
|
11731
|
11732
|
11733