View | Details | Raw Unified | Return to bug 12238
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/export.tt (-2 / +20 lines)
Lines 38-44 $(document).ready(function() { Link Here
38
    <b>Note : The items are exported by this tool unless specified.</b>
38
    <b>Note : The items are exported by this tool unless specified.</b>
39
</p>
39
</p>
40
40
41
<form method="post" action="/cgi-bin/koha/tools/export.pl">
41
<form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/tools/export.pl">
42
    <fieldset class="rows">
42
    <fieldset class="rows">
43
    <legend> Select records to export </legend>
43
    <legend> Select records to export </legend>
44
        <ol><li>
44
        <ol><li>
Lines 97-102 $(document).ready(function() { Link Here
97
</ul></li></ol>
97
</ul></li></ol>
98
    </fieldset>
98
    </fieldset>
99
    <fieldset class="rows">
99
    <fieldset class="rows">
100
    <legend>
101
        Use a file
102
    </legend>
103
        <ol>
104
        <li>File containing a biblionumber's list with one biblionumber per line. This list works as a filter: it's compatible with other parameters.</li>
105
        <li><label for="id_list_file">File : </label> <input type="file" id="id_list_file" name="id_list_file" /></li>
106
        </ol>
107
    </fieldset>
108
    <fieldset class="rows">
100
    <legend> Options</legend>
109
    <legend> Options</legend>
101
<ol>        <li>
110
<ol>        <li>
102
        <label for="dont_export_item">Don't export items</label>
111
        <label for="dont_export_item">Don't export items</label>
Lines 136-142 $(document).ready(function() { Link Here
136
</div>
145
</div>
137
146
138
<div id="auths">
147
<div id="auths">
139
<form method="post" action="/cgi-bin/koha/tools/export.pl">
148
<form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/tools/export.pl">
140
    <fieldset class="rows">
149
    <fieldset class="rows">
141
    <legend> Select records to export </legend>
150
    <legend> Select records to export </legend>
142
        <ol><li>
151
        <ol><li>
Lines 163-168 $(document).ready(function() { Link Here
163
        </ol>
172
        </ol>
164
    </fieldset>
173
    </fieldset>
165
    <fieldset class="rows">
174
    <fieldset class="rows">
175
    <legend>
176
        Use a file
177
    </legend>
178
        <ol>
179
        <li>File containing an authid's list with one authid per line. This list works as a filter: it's compatible with other parameters.</li>
180
        <li><label for="id_list_file">File : </label> <input type="file" id="id_list_file" name="id_list_file" /></li>
181
        </ol>
182
    </fieldset>
183
    <fieldset class="rows">
166
    <legend>Options</legend>
184
    <legend>Options</legend>
167
        <ol>
185
        <ol>
168
        <li>
186
        <li>
(-)a/tools/export.pl (-2 / +23 lines)
Lines 38-43 my $dont_export_items; Link Here
38
my $deleted_barcodes;
38
my $deleted_barcodes;
39
my $timestamp;
39
my $timestamp;
40
my $record_type;
40
my $record_type;
41
my $id_list_file;
41
my $help;
42
my $help;
42
my $op       = $query->param("op")       || '';
43
my $op       = $query->param("op")       || '';
43
my $filename = $query->param("filename") || 'koha.mrc';
44
my $filename = $query->param("filename") || 'koha.mrc';
Lines 60-71 if ( $commandline ) { Link Here
60
        'clean'             => \$clean,
61
        'clean'             => \$clean,
61
        'filename=s'        => \$filename,
62
        'filename=s'        => \$filename,
62
        'record-type=s'     => \$record_type,
63
        'record-type=s'     => \$record_type,
64
        'id_list_file=s'    => \$id_list_file,
63
        'help|?'            => \$help
65
        'help|?'            => \$help
64
    );
66
    );
65
67
66
    if ($help) {
68
    if ($help) {
67
        print <<_USAGE_;
69
        print <<_USAGE_;
68
export.pl [--format=format] [--date=date] [--record-type=TYPE] [--dont_export_items] [--deleted_barcodes] [--clean] --filename=outputfile
70
export.pl [--format=format] [--date=date] [--record-type=TYPE] [--dont_export_items] [--deleted_barcodes] [--clean] [--id_list_file=PATH] --filename=outputfile
69
71
70
72
71
 --format=FORMAT        FORMAT is either 'xml' or 'marc' (default)
73
 --format=FORMAT        FORMAT is either 'xml' or 'marc' (default)
Lines 82-87 export.pl [--format=format] [--date=date] [--record-type=TYPE] [--dont_export_it Link Here
82
                        specified). Used only if TYPE is 'bibs'
84
                        specified). Used only if TYPE is 'bibs'
83
85
84
 --clean                removes NSE/NSB
86
 --clean                removes NSE/NSB
87
88
 --id_list_file=PATH    PATH is an absolute path to a file containing a list of
89
                        IDs(biblionumber or authid) with only one ID per line.
90
                        This IDs list works as a filter: it's compatible with
91
                        other parameters
85
_USAGE_
92
_USAGE_
86
        exit;
93
        exit;
87
    }
94
    }
Lines 93-98 _USAGE_ Link Here
93
    $deleted_barcodes  ||= 0;
100
    $deleted_barcodes  ||= 0;
94
    $clean             ||= 0;
101
    $clean             ||= 0;
95
    $record_type       ||= "bibs";
102
    $record_type       ||= "bibs";
103
    $id_list_file       ||= 0;
96
104
97
    # Redirect stdout
105
    # Redirect stdout
98
    open STDOUT, '>', $filename if $filename;
106
    open STDOUT, '>', $filename if $filename;
Lines 196-201 if ( $op eq "export" ) { Link Here
196
        my $starting_authid = $query->param('starting_authid');
204
        my $starting_authid = $query->param('starting_authid');
197
        my $ending_authid   = $query->param('ending_authid');
205
        my $ending_authid   = $query->param('ending_authid');
198
        my $authtype        = $query->param('authtype');
206
        my $authtype        = $query->param('authtype');
207
        my $filefh;
208
        if ($commandline) {
209
            open $filefh,"<", $id_list_file or die "cannot open $id_list_file: $!";
210
        } else {
211
            $filefh = $query->upload("id_list_file");
212
        }
213
        my %id_filter;
214
        if ($filefh) {
215
            while (my $number=<$filefh>){
216
                $number=~s/[\r\n]*$//;
217
                $id_filter{$number}=1 if $number=~/^\d+$/;
218
            }
219
        }
199
220
200
        if ( $record_type eq 'bibs' and not @biblionumbers ) {
221
        if ( $record_type eq 'bibs' and not @biblionumbers ) {
201
            if ($timestamp) {
222
            if ($timestamp) {
Lines 308-313 if ( $op eq "export" ) { Link Here
308
            push @recordids, map {
329
            push @recordids, map {
309
                map { $$_[0] } $_
330
                map { $$_[0] } $_
310
            } @{ $sth->fetchall_arrayref };
331
            } @{ $sth->fetchall_arrayref };
332
            @recordids = grep { exists($id_filter{$_}) } @recordids if scalar(%id_filter);
311
        }
333
        }
312
334
313
        my $xml_header_written = 0;
335
        my $xml_header_written = 0;
314
- 

Return to bug 12238