Bugzilla – Attachment 74083 Details for
Bug 20570
Add script to complete scanned article requests
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20570: Add script to complete scanned article requests
Bug-20570-Add-script-to-complete-scanned-article-r.patch (text/plain), 5.26 KB, created by
Marcel de Rooy
on 2018-04-12 12:36:02 UTC
(
hide
)
Description:
Bug 20570: Add script to complete scanned article requests
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2018-04-12 12:36:02 UTC
Size:
5.26 KB
patch
obsolete
>From 9d927029726806a7ad1963a5a6274e1c4fdd4e1d Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Thu, 12 Apr 2018 14:32:14 +0200 >Subject: [PATCH] Bug 20570: Add script to complete scanned article requests >Content-Type: text/plain; charset=utf-8 > >Just a preview of the direction I am thinking of. >The essential method complete_scans is not included here. >Details about the webservice class interface should follow too. >--- > Koha/ArticleRequests.pm | 9 ++ > misc/migration_tools/complete_article_requests.pl | 121 ++++++++++++++++++++++ > 2 files changed, 130 insertions(+) > create mode 100755 misc/migration_tools/complete_article_requests.pl > >diff --git a/Koha/ArticleRequests.pm b/Koha/ArticleRequests.pm >index bc47789..24fb9ed 100644 >--- a/Koha/ArticleRequests.pm >+++ b/Koha/ArticleRequests.pm >@@ -82,6 +82,15 @@ sub canceled { > return Koha::ArticleRequests->search( $params ); > } > >+=head3 complete_scans >+ >+=cut >+ >+sub complete_scans { >+ my ( $self, $params ) = @_; >+ print "Marvellous code should come here :)\n"; >+} >+ > =head3 _type > > =cut >diff --git a/misc/migration_tools/complete_article_requests.pl b/misc/migration_tools/complete_article_requests.pl >new file mode 100755 >index 0000000..c8851a9 >--- /dev/null >+++ b/misc/migration_tools/complete_article_requests.pl >@@ -0,0 +1,121 @@ >+#!/usr/bin/perl >+ >+use Modern::Perl; >+use Getopt::Long; >+use Pod::Usage; >+use C4::Context; >+use Koha::ArticleRequests; >+ >+my $params = {}; >+GetOptions( >+ 'folder:s' => \$params->{folder}, >+ 'uploadcategory:s' => \$params->{uploadcategory}, >+ 'webservice:s' => \$params->{webservice}, >+ 'commit' => \$params->{commit}, >+ 'help' => \$params->{help}, >+ 'manual' => \$params->{manual}, >+); >+ >+if( $params->{help} ) { >+ pod2usage(); >+} elsif( $params->{manual} ) { >+ pod2usage({ -verbose => 2 }); >+} elsif( !C4::Context->preference('ArticleRequests') || >+ C4::Context->preference('ArticleRequestsSupportedFormats') !~ /SCAN/ ) { >+ print "First enable ArticleRequests and add SCAN as supported format.\n"; >+} elsif( !$params->{folder} && !$params->{uploadcategory} || >+ $params->{folder} && $params->{uploadcategory} ) { >+ print "Specify a folder or an uploadcategory but not both.\n"; >+ pod2usage(); >+} elsif( !$params->{commit} ) { >+ print "You need to specify the commit parameter.\n"; >+ pod2usage(); >+} else { >+ Koha::ArticleRequests->complete_scans({ %$params{'folder', 'uploadcategory', 'webservice'} }); # perl 5.20 construct >+} >+ >+=head1 NAME >+ >+complete_article_requests.pl >+ >+=head1 COPYRIGHT >+ >+Copyright 2018 Rijksmuseum >+ >+=head1 LICENSE >+ >+This file is part of Koha. >+ >+Koha is free software; you can redistribute it and/or modify it under the >+terms of the GNU General Public License as published by the Free Software >+Foundation; either version 3 of the License, or (at your option) any later >+version. >+ >+Koha is distributed in the hope that it will be useful, but WITHOUT ANY >+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR >+A PARTICULAR PURPOSE. See the GNU General Public License for more details. >+ >+You should have received a copy of the GNU General Public License along >+with Koha; if not, write to the Free Software Foundation, Inc., >+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+ >+ >+=head1 SYNOPSIS >+ >+ complete_article_requests.pl -help >+ complete_article_requests.pl -manual >+ complete_article_requests.pl -folder /my/scans -webservice My::Hdlr -commit >+ complete_article_requests.pl -uploadcategory SCANS -commit >+ >+=head1 DESCRIPTION >+ >+This script serves to complete scanned article requests by offering a file path >+or an uploadcategory. If you specify a file path, you need to specify a handler >+class that returns a URL for each file. >+ >+How does it work? The script is based on the following two assumptions: >+ [1] If the file name contains the article request id, the script links it >+ to that request. This is mandatory for multiple files per request. >+ [2] The order of the remaining scanned files should match the list of >+ requests in processing status sorted by timestamp. (The timestamp >+ should tell here when the request status was set.) >+ >+In the process of linking files to requests, the urls field is filled and the >+request is marked completed (triggering a mail to the requestor). >+ >+=head1 OPTIONS >+ >+=head2 help >+ >+Print usage statement >+ >+=head2 manual >+ >+Print complete POD documentation >+ >+=head2 folder >+ >+File path to scanned materials for article requests >+ >+=head2 webservice >+ >+Name of the class you are using to generate a URL for each scanned file. This >+parameter is mandatory in combination with the folder option. In its simplest >+form the class can return a URL to access the scanned file on the local server. >+But other implementations may upload the file to some third party webservice >+and return the corresponding URL. >+ >+=head2 uploadcategory >+ >+Code of the Koha upload category that you are using for scanned article >+request materials. >+ >+It may be combined with the webservice parameter in order to change the >+URL. But since the file can be made available via the local server, its use >+here may be limited. >+ >+=head1 AUTHOR >+ >+Marcel de Rooy, Rijksmuseum Amsterdam, The Netherlands >+ >+=cut >-- >2.1.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 20570
:
74083
|
75012