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

(-)a/misc/export_records.pl (-16 / +16 lines)
Lines 124-135 if ( $deleted_barcodes and $record_type ne 'bibs' ) { Link Here
124
    pod2usage(q|--deleted_barcodes can only be used with biblios|);
124
    pod2usage(q|--deleted_barcodes can only be used with biblios|);
125
}
125
}
126
126
127
my $sftp_server;
127
my $file_transport;
128
if ($destination_server_id) {
128
if ($destination_server_id) {
129
    $sftp_server = Koha::File::Transports->find($destination_server_id);
129
    $file_transport = Koha::File::Transports->find($destination_server_id);
130
130
131
    pod2usage( sprintf( "No FTP/SFTP Server (%s) found", $destination_server_id ) )
131
    pod2usage( sprintf( "No file transport server (%s) found", $destination_server_id ) )
132
        unless $sftp_server;
132
        unless $file_transport;
133
}
133
}
134
134
135
if ($report_id) {
135
if ($report_id) {
Lines 137-143 if ($report_id) { Link Here
137
    # Check report exists
137
    # Check report exists
138
    $report = Koha::Reports->find($report_id);
138
    $report = Koha::Reports->find($report_id);
139
    unless ($report) {
139
    unless ($report) {
140
        pod2usage( sprintf( "No FTP/SFTP Server (%s) found", $report_id ) );
140
        pod2usage( sprintf( "No saved report (%s) found", $report_id ) );
141
    }
141
    }
142
    $sql = $report->savedsql;
142
    $sql = $report->savedsql;
143
143
Lines 354-370 if ($deleted_barcodes) { Link Here
354
    );
354
    );
355
}
355
}
356
356
357
if ($sftp_server) {
357
if ($file_transport) {
358
    $sftp_server->connect
358
    $file_transport->connect
359
        or die pod2usage( sprintf( "Unable to connect server (%s)", $destination_server_id ) );
359
        or die pod2usage( sprintf( "Unable to connect server (%s)", $destination_server_id ) );
360
360
361
    my $upload_dir = $sftp_server->upload_directory;
361
    my $upload_dir = $file_transport->upload_directory;
362
    if ($upload_dir) {
362
    if ($upload_dir) {
363
        $sftp_server->change_directory( $upload_dir )
363
        $file_transport->change_directory($upload_dir)
364
            or die pod2usage( sprintf( "Unable to change directory on server (%s) to path (%s)", $destination_server_id, $upload_dir ) );
364
            or die pod2usage(
365
            sprintf( "Unable to change directory on server (%s) to path (%s)", $destination_server_id, $upload_dir ) );
365
    }
366
    }
366
367
367
    $sftp_server->upload_file ( $filename, $filename )
368
    $file_transport->upload_file( $filename, $filename )
368
        or die pod2usage( sprintf( "Unable to upload file (%s) to server (%s)", $filename, $destination_server_id ) );
369
        or die pod2usage( sprintf( "Unable to upload file (%s) to server (%s)", $filename, $destination_server_id ) );
369
}
370
}
370
371
Lines 519-533 Print a brief help message. Link Here
519
=item B<--destination_server_id>
520
=item B<--destination_server_id>
520
521
521
--destination_server_id=ID      Provide this option, along with the destination server ID, to
522
--destination_server_id=ID      Provide this option, along with the destination server ID, to
522
                                upload the resultant mrc file to the selected FTP/SFTP Server.
523
                                upload the resultant mrc file to the selected file transport server.
523
                                You can create FTP/SFTP Servers via the Koha Staff client, under
524
                                You can create file transport servers via the Koha Staff client, under
524
                                Koha Administration.
525
                                Koha Administration.
525
526
526
=item B<--delete_local_after_run>
527
=item B<--delete_local_after_run>
527
528
528
--delete_local_after_run       Deletes the local file at the end of the script run. Can be
529
--delete_local_after_run       Deletes the local file at the end of the script run. Can be
529
                                useful if, for example, you are uploading the file to an
530
                                useful if, for example, you are uploading the file to a
530
                                FTP/SFTP server.
531
                                file transport server.
531
532
532
=back
533
=back
533
534
534
- 

Return to bug 38115