Bugzilla – Attachment 172740 Details for
Bug 35570
Add a generic master form in ILL
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35570: Put 'FreeForm' backend into core as 'Standard'
Bug-35570-Put-FreeForm-backend-into-core-as-Standa.patch (text/plain), 81.77 KB, created by
Tomás Cohen Arazi (tcohen)
on 2024-10-14 18:01:10 UTC
(
hide
)
Description:
Bug 35570: Put 'FreeForm' backend into core as 'Standard'
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2024-10-14 18:01:10 UTC
Size:
81.77 KB
patch
obsolete
>From 25c9ef6403da93d4f2195c244d178b74121a6fbe Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Date: Fri, 15 Dec 2023 12:51:43 +0000 >Subject: [PATCH] Bug 35570: Put 'FreeForm' backend into core as 'Standard' > >FreeForm copied as is from HEAD 369dffb159f1e70162b685b473dcf26c76f7e7e7 >At https://github.com/PTFS-Europe/koha-ill-freeform/commits/reorganize_ILL/ > >Only edits made were 'freeform' -> 'standard' in the markup of the .inc files >and some occurrences of FreeForm in Standard.pm (previous Base.pm) file. > >Signed-off-by: David Nind <david@davidnind.com> >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/ILL/Backend/Standard.pm | 1215 +++++++++++++++++ > Koha/ILL/Backend/intra-includes/cancel.inc | 17 + > Koha/ILL/Backend/intra-includes/confirm.inc | 19 + > Koha/ILL/Backend/intra-includes/create.inc | 203 +++ > Koha/ILL/Backend/intra-includes/edititem.inc | 88 ++ > Koha/ILL/Backend/intra-includes/illview.inc | 0 > Koha/ILL/Backend/intra-includes/migrate.inc | 119 ++ > Koha/ILL/Backend/opac-includes/create.inc | 122 ++ > .../Backend/shared-includes/custom_fields.inc | 22 + > .../Backend/shared-includes/forms/article.inc | 50 + > .../Backend/shared-includes/forms/book.inc | 45 + > .../Backend/shared-includes/forms/chapter.inc | 62 + > .../shared-includes/forms/conference.inc | 49 + > .../Backend/shared-includes/forms/journal.inc | 29 + > .../Backend/shared-includes/forms/other.inc | 0 > .../shared-includes/forms/resource.inc | 53 + > .../Backend/shared-includes/forms/thesis.inc | 25 + > Koha/ILL/Backend/shared-includes/shared.js | 38 + > 18 files changed, 2156 insertions(+) > create mode 100644 Koha/ILL/Backend/Standard.pm > create mode 100644 Koha/ILL/Backend/intra-includes/cancel.inc > create mode 100644 Koha/ILL/Backend/intra-includes/confirm.inc > create mode 100644 Koha/ILL/Backend/intra-includes/create.inc > create mode 100644 Koha/ILL/Backend/intra-includes/edititem.inc > create mode 100644 Koha/ILL/Backend/intra-includes/illview.inc > create mode 100644 Koha/ILL/Backend/intra-includes/migrate.inc > create mode 100644 Koha/ILL/Backend/opac-includes/create.inc > create mode 100644 Koha/ILL/Backend/shared-includes/custom_fields.inc > create mode 100644 Koha/ILL/Backend/shared-includes/forms/article.inc > create mode 100644 Koha/ILL/Backend/shared-includes/forms/book.inc > create mode 100644 Koha/ILL/Backend/shared-includes/forms/chapter.inc > create mode 100644 Koha/ILL/Backend/shared-includes/forms/conference.inc > create mode 100644 Koha/ILL/Backend/shared-includes/forms/journal.inc > create mode 100644 Koha/ILL/Backend/shared-includes/forms/other.inc > create mode 100644 Koha/ILL/Backend/shared-includes/forms/resource.inc > create mode 100644 Koha/ILL/Backend/shared-includes/forms/thesis.inc > create mode 100644 Koha/ILL/Backend/shared-includes/shared.js > >diff --git a/Koha/ILL/Backend/Standard.pm b/Koha/ILL/Backend/Standard.pm >new file mode 100644 >index 00000000000..748680ad1a6 >--- /dev/null >+++ b/Koha/ILL/Backend/Standard.pm >@@ -0,0 +1,1215 @@ >+package Koha::ILL::Backend::Standard; >+ >+# Copyright PTFS Europe 2023 >+# >+# 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, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+use DateTime; >+use File::Basename qw( dirname ); >+use C4::Installer; >+ >+use Koha::ILL::Requests; >+use Koha::ILL::Request::Attribute; >+use C4::Biblio qw( AddBiblio ); >+use C4::Charset qw( MarcToUTF8Record ); >+ >+=head1 NAME >+ >+Koha::ILL::Backend::Standard - Koha ILL Backend: Standard >+ >+=head1 SYNOPSIS >+ >+Koha ILL implementation for the "Standard" backend . >+ >+=head1 DESCRIPTION >+ >+=head2 Overview >+ >+We will be providing the Abstract interface which requires we implement the >+following methods: >+- create -> initial placement of the request for an ILL order >+- confirm -> confirm placement of the ILL order (No-op in Standard) >+- cancel -> request an already 'confirm'ed ILL order be cancelled >+- status_graph -> return a hashref of additional statuses >+- name -> return the name of this backend >+- metadata -> return mapping of fields from requestattributes >+ >+=head2 On the Standard backend >+ >+The Standard backend is a simple backend that is supposed to act as a >+fallback. It provides the end user with some mandatory fields in a form as >+well as the option to enter additional fields with arbitrary names & values. >+ >+=head1 API >+ >+=head2 Class Methods >+ >+=cut >+ >+=head3 new >+ >+my $backend = Koha::ILL::Backend::Standard->new; >+ >+=cut >+ >+sub new { >+ >+ # -> instantiate the backend >+ my ( $class, $other ) = @_; >+ my $framework = >+ defined $other->{config}->{configuration}->{raw_config}->{framework} >+ ? $other->{config}->{configuration}->{raw_config}->{framework} >+ : 'FA'; >+ my $self = { framework => $framework }; >+ bless( $self, $class ); >+ return $self; >+} >+ >+=head3 name >+ >+Return the name of this backend. >+ >+=cut >+ >+sub name { >+ return "Standard"; >+} >+ >+=head3 capabilities >+ >+ $capability = $backend->capabilities($name); >+ >+Return the sub implementing a capability selected by NAME, or 0 if that >+capability is not implemented. >+ >+=cut >+ >+sub capabilities { >+ my ( $self, $name ) = @_; >+ my ($query) = @_; >+ my $capabilities = { >+ >+ # Get the requested partner email address(es) >+ get_requested_partners => sub { _get_requested_partners(@_); }, >+ >+ # Set the requested partner email address(es) >+ set_requested_partners => sub { _set_requested_partners(@_); }, >+ >+ # Migrate >+ migrate => sub { $self->migrate(@_); }, >+ >+ # Return whether we can create the request >+ # i.e. the create form has been submitted >+ can_create_request => sub { _can_create_request(@_) }, >+ >+ # This is required for compatibility >+ # with Koha versions prior to bug 33716 >+ should_display_availability => sub { _can_create_request(@_) }, >+ >+ # View and manage a request >+ illview => sub { illview(@_); }, >+ >+ provides_batch_requests => sub { return 1; }, >+ >+ # We can create ILL requests with data passed from the API >+ create_api => sub { $self->create_api(@_) } >+ }; >+ return $capabilities->{$name}; >+} >+ >+=head3 metadata >+ >+Return a hashref containing canonical values from the key/value >+illrequestattributes store. We may want to ignore certain values >+that we do not consider to be metadata >+ >+=cut >+ >+sub metadata { >+ my ( $self, $request ) = @_; >+ my $attrs = $request->illrequestattributes; >+ my $metadata = {}; >+ my @ignore = ( 'requested_partners', 'type', 'type_disclaimer_value', 'type_disclaimer_date' ); >+ my $core_fields = _get_core_fields(); >+ while ( my $attr = $attrs->next ) { >+ my $type = $attr->type; >+ if ( !grep { $_ eq $type } @ignore ) { >+ my $name; >+ $name = $core_fields->{$type} || ucfirst($type); >+ $metadata->{$name} = $attr->value; >+ } >+ } >+ return $metadata; >+} >+ >+=head3 status_graph >+ >+This backend provides no additional actions on top of the core_status_graph. >+ >+=cut >+ >+sub status_graph { >+ return { >+ MIG => { >+ prev_actions => [ 'NEW', 'REQ', 'GENREQ', 'REQREV', 'QUEUED', 'CANCREQ', ], >+ id => 'MIG', >+ name => 'Switched provider', >+ ui_method_name => 'Switch provider', >+ method => 'migrate', >+ next_actions => [], >+ ui_method_icon => 'fa-search', >+ }, >+ EDITITEM => { >+ prev_actions => ['NEW'], >+ id => 'EDITITEM', >+ name => 'Edited item metadata', >+ ui_method_name => 'Edit item metadata', >+ method => 'edititem', >+ next_actions => [], >+ ui_method_icon => 'fa-edit', >+ }, >+ >+ }; >+} >+ >+=head3 create >+ >+ my $response = $backend->create({ params => $params }); >+ >+We just want to generate a form that allows the end-user to associate key >+value pairs in the database. >+ >+=cut >+ >+sub create { >+ my ( $self, $params ) = @_; >+ my $other = $params->{other}; >+ my $stage = $other->{stage}; >+ my $core_fields = _get_core_string(); >+ if ( !$stage || $stage eq 'init' ) { >+ >+ # First thing we want to do, is check if we're receiving >+ # an OpenURL and transform it into something we can >+ # understand >+ if ( $other->{openurl} ) { >+ >+ # We only want to transform once >+ delete $other->{openurl}; >+ $params = _openurl_to_ill($params); >+ } >+ >+ # We simply need our template .INC to produce a form. >+ return { >+ cwd => dirname(__FILE__), >+ error => 0, >+ status => '', >+ message => '', >+ method => 'create', >+ stage => 'form', >+ value => $params, >+ core => $core_fields >+ }; >+ } elsif ( $stage eq 'form' ) { >+ >+ # We may be recieving a submitted form due to an additional >+ # custom field being added or deleted, or the material type >+ # having been changed, so check for these things >+ if ( !_can_create_request($other) ) { >+ if ( defined $other->{'add_new_custom'} ) { >+ my ( $custom_keys, $custom_vals ) = >+ _get_custom( $other->{'custom_key'}, $other->{'custom_value'} ); >+ push @{$custom_keys}, '---'; >+ push @{$custom_vals}, '---'; >+ $other->{'custom_key'} = join "\0", @{$custom_keys}; >+ $other->{'custom_value'} = join "\0", @{$custom_vals}; >+ } elsif ( defined $other->{'custom_delete'} ) { >+ my $delete_idx = $other->{'custom_delete'}; >+ my ( $custom_keys, $custom_vals ) = >+ _get_custom( $other->{'custom_key'}, $other->{'custom_value'} ); >+ splice @{$custom_keys}, $delete_idx, 1; >+ splice @{$custom_vals}, $delete_idx, 1; >+ $other->{'custom_key'} = join "\0", @{$custom_keys}; >+ $other->{'custom_value'} = join "\0", @{$custom_vals}; >+ } elsif ( defined $other->{'change_type'} ) { >+ >+ # We may be receiving a submitted form due to the user having >+ # changed request material type, so we just need to go straight >+ # back to the form, the type has been changed in the params >+ delete $other->{'change_type'}; >+ } >+ return { >+ cwd => dirname(__FILE__), >+ status => "", >+ message => "", >+ error => 0, >+ value => $params, >+ method => "create", >+ stage => "form", >+ core => $core_fields >+ }; >+ } >+ >+ # Received completed details of form. Validate and create request. >+ ## Validate >+ my ( $brw_count, $brw ) = >+ _validate_borrower( $other->{'cardnumber'} ); >+ my $result = { >+ cwd => dirname(__FILE__), >+ status => "", >+ message => "", >+ error => 1, >+ value => {}, >+ method => "create", >+ stage => "form", >+ core => $core_fields >+ }; >+ my $failed = 0; >+ if ( !$other->{'type'} ) { >+ $result->{status} = "missing_type"; >+ $result->{value} = $params; >+ $failed = 1; >+ } elsif ( !$other->{'branchcode'} ) { >+ $result->{status} = "missing_branch"; >+ $result->{value} = $params; >+ $failed = 1; >+ } elsif ( !Koha::Libraries->find( $other->{'branchcode'} ) ) { >+ $result->{status} = "invalid_branch"; >+ $result->{value} = $params; >+ $failed = 1; >+ } elsif ( $brw_count == 0 ) { >+ $result->{status} = "invalid_borrower"; >+ $result->{value} = $params; >+ $failed = 1; >+ } elsif ( $brw_count > 1 ) { >+ >+ # We must select a specific borrower out of our options. >+ $params->{brw} = $brw; >+ $result->{value} = $params; >+ $result->{stage} = "borrowers"; >+ $result->{error} = 0; >+ $failed = 1; >+ } >+ return $result if $failed; >+ >+ $self->add_request( { request => $params->{request}, other => $other } ); >+ >+ my $request_details = _get_request_details( $params, $other ); >+ >+ ## -> create response. >+ return { >+ cwd => dirname(__FILE__), >+ error => 0, >+ status => '', >+ message => '', >+ method => 'create', >+ stage => 'commit', >+ next => 'illview', >+ value => $request_details, >+ core => $core_fields >+ }; >+ } else { >+ >+ # Invalid stage, return error. >+ return { >+ cwd => dirname(__FILE__), >+ error => 1, >+ status => 'unknown_stage', >+ message => '', >+ method => 'create', >+ stage => $params->{stage}, >+ value => {}, >+ }; >+ } >+} >+ >+=head3 edititem >+ >+=cut >+ >+sub edititem { >+ my ( $self, $params ) = @_; >+ >+ my $core = _get_core_fields(); >+ my $core_fields = _get_core_string(); >+ >+ # Don't allow editing of submitted requests >+ return { method => 'illlist' } if $params->{request}->status ne 'NEW'; >+ >+ my $other = $params->{other}; >+ my $stage = $other->{stage}; >+ if ( !$stage || $stage eq 'init' ) { >+ >+ my $attrs = $params->{request}->illrequestattributes->unblessed; >+ >+ # We need to identify which parameters are custom, and pass them >+ # to the template in a predefined form >+ my $custom_keys = []; >+ my $custom_vals = []; >+ foreach my $attr ( @{$attrs} ) { >+ if ( !$core->{ $attr->{type} } ) { >+ push @{$custom_keys}, $attr->{type}; >+ push @{$custom_vals}, $attr->{value}; >+ } else { >+ $other->{ $attr->{type} } = $attr->{value}; >+ } >+ } >+ $other->{'custom_key'} = join "\0", @{$custom_keys}; >+ $other->{'custom_value'} = join "\0", @{$custom_vals}; >+ >+ # Pass everything back to the template >+ return { >+ cwd => dirname(__FILE__), >+ error => 0, >+ status => '', >+ message => '', >+ method => 'edititem', >+ stage => 'form', >+ value => $params, >+ core => $core_fields >+ }; >+ } elsif ( $stage eq 'form' ) { >+ >+ # We may be recieving a submitted form due to an additional >+ # custom field being added or deleted, or the material type >+ # having been changed, so check for these things >+ if ( defined $other->{'add_new_custom'} >+ || defined $other->{'custom_delete'} >+ || defined $other->{'change_type'} ) >+ { >+ if ( defined $other->{'add_new_custom'} ) { >+ my ( $custom_keys, $custom_vals ) = >+ _get_custom( $other->{'custom_key'}, $other->{'custom_value'} ); >+ push @{$custom_keys}, '---'; >+ push @{$custom_vals}, '---'; >+ $other->{'custom_key'} = join "\0", @{$custom_keys}; >+ $other->{'custom_value'} = join "\0", @{$custom_vals}; >+ } elsif ( defined $other->{'custom_delete'} ) { >+ my $delete_idx = $other->{'custom_delete'}; >+ my ( $custom_keys, $custom_vals ) = >+ _get_custom( $other->{'custom_key'}, $other->{'custom_value'} ); >+ splice @{$custom_keys}, $delete_idx, 1; >+ splice @{$custom_vals}, $delete_idx, 1; >+ $other->{'custom_key'} = join "\0", @{$custom_keys}; >+ $other->{'custom_value'} = join "\0", @{$custom_vals}; >+ } elsif ( defined $other->{'change_type'} ) { >+ >+ # We may be receiving a submitted form due to the user having >+ # changed request material type, so we just need to go straight >+ # back to the form, the type has been changed in the params >+ delete $other->{'change_type'}; >+ } >+ return { >+ cwd => dirname(__FILE__), >+ status => "", >+ message => "", >+ error => 0, >+ value => $params, >+ method => "edititem", >+ stage => "form", >+ core => $core_fields >+ }; >+ } >+ >+ # We don't want the request ID param getting any further >+ delete $other->{illrequest_id}; >+ >+ my $result = { >+ cwd => dirname(__FILE__), >+ status => "", >+ message => "", >+ error => 1, >+ value => {}, >+ method => "edititem", >+ stage => "form", >+ core => $core_fields >+ }; >+ >+ # Received completed details of form. Validate and create request. >+ ## Validate >+ my $failed = 0; >+ if ( !$other->{'type'} ) { >+ $result->{status} = "missing_type"; >+ $result->{value} = $params; >+ $failed = 1; >+ } >+ return $result if $failed; >+ >+ ## Update request >+ >+ # ...Update Illrequest >+ my $request = $params->{request}; >+ $request->updated( DateTime->now ); >+ $request->store; >+ >+ # ...Populate Illrequestattributes >+ # generate $request_details >+ my $request_details = _get_request_details( $params, $other ); >+ >+ # We do this with a 'dump all and repopulate approach' inside >+ # a transaction, easier than catering for create, update & delete >+ my $dbh = C4::Context->dbh; >+ my $schema = Koha::Database->new->schema; >+ $schema->txn_do( >+ sub { >+ # Delete all existing attributes for this request >+ $dbh->do( >+ q| >+ DELETE FROM illrequestattributes WHERE illrequest_id=? >+ |, undef, $request->id >+ ); >+ >+ # Insert all current attributes for this request >+ foreach my $attr ( keys %{$request_details} ) { >+ my $value = $request_details->{$attr}; >+ if ( $value && length $value > 0 ) { >+ if ( column_exists( 'illrequestattributes', 'backend' ) ) { >+ my @bind = ( $request->id, 'Standard', $attr, $value, 0 ); >+ $dbh->do( >+ q| >+ INSERT INTO illrequestattributes >+ (illrequest_id, backend, type, value, readonly) VALUES >+ (?, ?, ?, ?, ?) >+ |, undef, @bind >+ ); >+ } else { >+ my @bind = ( $request->id, $attr, $value, 0 ); >+ $dbh->do( >+ q| >+ INSERT INTO illrequestattributes >+ (illrequest_id, type, value, readonly) VALUES >+ (?, ?, ?, ?) >+ |, undef, @bind >+ ); >+ } >+ } >+ } >+ } >+ ); >+ >+ ## -> create response. >+ return { >+ error => 0, >+ status => '', >+ message => '', >+ method => 'create', >+ stage => 'commit', >+ next => 'illview', >+ value => $request_details, >+ core => $core_fields >+ }; >+ } else { >+ >+ # Invalid stage, return error. >+ return { >+ error => 1, >+ status => 'unknown_stage', >+ message => '', >+ method => 'create', >+ stage => $params->{stage}, >+ value => {}, >+ }; >+ } >+} >+ >+=head3 confirm >+ >+ my $response = $backend->confirm({ params => $params }); >+ >+Confirm the placement of the previously "selected" request (by using the >+'create' method). >+ >+In the Standard backend we only want to display a bit of text to let staff >+confirm that they have taken the steps they need to take to "confirm" the >+request. >+ >+=cut >+ >+sub confirm { >+ my ( $self, $params ) = @_; >+ my $stage = $params->{other}->{stage}; >+ if ( !$stage || $stage eq 'init' ) { >+ >+ # We simply need our template .INC to produce a text block. >+ return { >+ method => 'confirm', >+ stage => 'confirm', >+ value => $params, >+ }; >+ } elsif ( $stage eq 'confirm' ) { >+ my $request = $params->{request}; >+ $request->orderid( $request->illrequest_id ); >+ $request->status("REQ"); >+ $request->store; >+ >+ # ...then return our result: >+ return { >+ method => 'confirm', >+ stage => 'commit', >+ next => 'illview', >+ value => {}, >+ }; >+ } else { >+ >+ # Invalid stage, return error. >+ return { >+ error => 1, >+ status => 'unknown_stage', >+ message => '', >+ method => 'confirm', >+ stage => $params->{stage}, >+ value => {}, >+ }; >+ } >+} >+ >+=head3 cancel >+ >+ my $response = $backend->cancel({ params => $params }); >+ >+We will attempt to cancel a request that was confirmed. >+ >+In the Standard backend this simply means displaying text to the librarian >+asking them to confirm they have taken all steps needed to cancel a confirmed >+request. >+ >+=cut >+ >+sub cancel { >+ my ( $self, $params ) = @_; >+ my $stage = $params->{other}->{stage}; >+ if ( !$stage || $stage eq 'init' ) { >+ >+ # We simply need our template .INC to produce a text block. >+ return { >+ method => 'cancel', >+ stage => 'confirm', >+ value => $params, >+ }; >+ } elsif ( $stage eq 'confirm' ) { >+ $params->{request}->status("REQREV"); >+ $params->{request}->orderid(undef); >+ $params->{request}->store; >+ return { >+ method => 'cancel', >+ stage => 'commit', >+ next => 'illview', >+ value => $params, >+ }; >+ } else { >+ >+ # Invalid stage, return error. >+ return { >+ error => 1, >+ status => 'unknown_stage', >+ message => '', >+ method => 'cancel', >+ stage => $params->{stage}, >+ value => {}, >+ }; >+ } >+} >+ >+=head3 migrate >+ >+Migrate a request into or out of this backend. >+ >+=cut >+ >+sub migrate { >+ my ( $self, $params ) = @_; >+ my $other = $params->{other}; >+ >+ my $stage = $other->{stage}; >+ my $step = $other->{step}; >+ >+ my $core_fields = _get_core_string(); >+ >+ # We may be recieving a submitted form due to an additional >+ # custom field being added or deleted, or the material type >+ # having been changed, so check for these things >+ if ( defined $other->{'add_new_custom'} >+ || defined $other->{'custom_delete'} >+ || defined $other->{'change_type'} ) >+ { >+ if ( defined $other->{'add_new_custom'} ) { >+ my ( $custom_keys, $custom_vals ) = >+ _get_custom( $other->{'custom_key'}, $other->{'custom_value'} ); >+ push @{$custom_keys}, '---'; >+ push @{$custom_vals}, '---'; >+ $other->{'custom_key'} = join "\0", @{$custom_keys}; >+ $other->{'custom_value'} = join "\0", @{$custom_vals}; >+ } elsif ( defined $other->{'custom_delete'} ) { >+ my $delete_idx = $other->{'custom_delete'}; >+ my ( $custom_keys, $custom_vals ) = >+ _get_custom( $other->{'custom_key'}, $other->{'custom_value'} ); >+ splice @{$custom_keys}, $delete_idx, 1; >+ splice @{$custom_vals}, $delete_idx, 1; >+ $other->{'custom_key'} = join "\0", @{$custom_keys}; >+ $other->{'custom_value'} = join "\0", @{$custom_vals}; >+ } elsif ( defined $other->{'change_type'} ) { >+ >+ # We may be receiving a submitted form due to the user having >+ # changed request material type, so we just need to go straight >+ # back to the form, the type has been changed in the params >+ delete $other->{'change_type'}; >+ } >+ return { >+ cwd => dirname(__FILE__), >+ status => "", >+ message => "", >+ error => 0, >+ value => $params, >+ method => "create", >+ stage => "form", >+ core => $core_fields >+ }; >+ } >+ >+ # Recieve a new request from another backend and suppliment it with >+ # anything we require specifically for this backend. >+ if ( !$stage || $stage eq 'immigrate' ) { >+ my $original_request = Koha::ILL::Requests->find( $other->{illrequest_id} ); >+ my $new_request = $params->{request}; >+ $new_request->borrowernumber( $original_request->borrowernumber ); >+ $new_request->branchcode( $original_request->branchcode ); >+ $new_request->status('NEW'); >+ $new_request->backend( $self->name ); >+ $new_request->placed( DateTime->now ); >+ $new_request->updated( DateTime->now ); >+ $new_request->store; >+ >+ my @default_attributes = (qw/title type author year volume isbn issn article_title article_author pages/); >+ my $original_attributes = >+ $original_request->illrequestattributes->search( { type => { '-in' => \@default_attributes } } ); >+ >+ my $request_details = >+ { map { $_->type => $_->value } ( $original_attributes->as_list ) }; >+ $request_details->{migrated_from} = $original_request->illrequest_id; >+ while ( my ( $type, $value ) = each %{$request_details} ) { >+ Koha::ILL::Request::Attribute->new( >+ { >+ illrequest_id => $new_request->illrequest_id, >+ column_exists( 'illrequestattributes', 'backend' ) ? ( backend => "Standard" ) : (), >+ type => $type, >+ value => $value, >+ } >+ )->store; >+ } >+ >+ return { >+ error => 0, >+ status => '', >+ message => '', >+ method => 'migrate', >+ stage => 'commit', >+ next => 'emigrate', >+ value => $params, >+ core => $core_fields >+ }; >+ } >+ >+ # Cleanup any outstanding work, close the request. >+ elsif ( $stage eq 'emigrate' ) { >+ my $new_request = $params->{request}; >+ my $from_id = $new_request->illrequestattributes->find( { type => 'migrated_from' } )->value; >+ my $request = Koha::ILL::Requests->find($from_id); >+ >+ # Just cancel the original request now it's been migrated away >+ $request->status("REQREV"); >+ $request->orderid(undef); >+ $request->store; >+ >+ return { >+ error => 0, >+ status => '', >+ message => '', >+ method => 'migrate', >+ stage => 'commit', >+ next => 'illview', >+ value => $params, >+ core => $core_fields >+ }; >+ } >+} >+ >+=head3 illview >+ >+ View and manage an ILL request >+ >+=cut >+ >+sub illview { >+ my ( $self, $params ) = @_; >+ >+ return { method => "illview" }; >+} >+ >+## Helpers >+ >+=head3 _get_requested_partners >+ >+=cut >+ >+sub _get_requested_partners { >+ >+ # Take a request and retrieve an Illrequestattribute with >+ # the type 'requested_partners'. >+ my ($args) = @_; >+ my $where = { >+ illrequest_id => $args->{request}->id, >+ type => 'requested_partners' >+ }; >+ my $res = Koha::ILL::Request::Attributes->find($where); >+ return ($res) ? $res->value : undef; >+} >+ >+=head3 _set_requested_partners >+ >+=cut >+ >+sub _set_requested_partners { >+ >+ # Take a request and set an Illrequestattribute on it >+ # detailing the email address(es) of the requested >+ # partner(s). We replace any existing value since, by >+ # the time we get to this stage, any previous request >+ # from partners would have had to be cancelled >+ my ($args) = @_; >+ my $where = { >+ illrequest_id => $args->{request}->id, >+ type => 'requested_partners' >+ }; >+ Koha::ILL::Request::Attributes->search($where)->delete(); >+ Koha::ILL::Request::Attributes->new( >+ { >+ illrequest_id => $args->{request}->id, >+ column_exists( 'illrequestattributes', 'backend' ) ? ( backend => "Standard" ) : (), >+ type => 'requested_partners', >+ value => $args->{to} >+ } >+ )->store; >+} >+ >+=head3 _validate_borrower >+ >+=cut >+ >+sub _validate_borrower { >+ >+ # Perform cardnumber search. If no results, perform surname search. >+ # Return ( 0, undef ), ( 1, $brw ) or ( n, $brws ) >+ my ($input) = @_; >+ my $patrons = Koha::Patrons->new; >+ my ( $count, $brw ); >+ my $query = { cardnumber => $input }; >+ >+ my $brws = $patrons->search($query); >+ $count = $brws->count; >+ my @criteria = qw/ surname userid firstname end /; >+ while ( $count == 0 ) { >+ my $criterium = shift @criteria; >+ return ( 0, undef ) if ( "end" eq $criterium ); >+ $brws = $patrons->search( { $criterium => $input } ); >+ $count = $brws->count; >+ } >+ if ( $count == 1 ) { >+ $brw = $brws->next; >+ } else { >+ $brw = $brws; # found multiple results >+ } >+ return ( $count, $brw ); >+} >+ >+=head3 _get_custom >+ >+=cut >+ >+sub _get_custom { >+ >+ # Take an string of custom keys and an string >+ # of custom values, both delimited by \0 (by CGI) >+ # and return an arrayref of each >+ my ( $keys, $values ) = @_; >+ my @k = defined $keys ? split( "\0", $keys ) : (); >+ my @v = defined $values ? split( "\0", $values ) : (); >+ return ( \@k, \@v ); >+} >+ >+=head3 _prepare_custom >+ >+=cut >+ >+sub _prepare_custom { >+ >+ # Take an arrayref of custom keys and an arrayref >+ # of custom values, return a hashref of them >+ my ( $keys, $values ) = @_; >+ my %out = (); >+ if ($keys) { >+ my @k = split( "\0", $keys ); >+ my @v = split( "\0", $values ); >+ %out = map { $k[$_] => $v[$_] } 0 .. $#k; >+ } >+ return \%out; >+} >+ >+=head3 _get_request_details >+ >+ my $request_details = _get_request_details($params, $other); >+ >+Return the illrequestattributes for a given request >+ >+=cut >+ >+sub _get_request_details { >+ my ( $params, $other ) = @_; >+ >+ # Get custom key / values we've been passed >+ # Prepare them for addition into the Illrequestattribute object >+ my $custom = >+ _prepare_custom( $other->{'custom_key'}, $other->{'custom_value'} ); >+ >+ my $return = {%$custom}; >+ my $core = _get_core_fields(); >+ foreach my $key ( keys %{$core} ) { >+ $return->{$key} = $params->{other}->{$key}; >+ } >+ >+ return $return; >+} >+ >+=head3 _get_core_string >+ >+Return a comma delimited, quoted, string of core field keys >+ >+=cut >+ >+sub _get_core_string { >+ my $core = _get_core_fields(); >+ return join( ",", map { '"' . $_ . '"' } keys %{$core} ); >+} >+ >+=head3 _get_core_fields >+ >+Return a hashref of core fields >+ >+=cut >+ >+sub _get_core_fields { >+ return { >+ article_author => 'Article author', >+ article_title => 'Article title', >+ associated_id => 'Associated ID', >+ author => 'Author', >+ chapter_author => 'Chapter author', >+ chapter => 'Chapter', >+ conference_date => 'Conference date', >+ doi => 'DOI', >+ editor => 'Editor', >+ institution => 'Institution', >+ isbn => 'ISBN', >+ issn => 'ISSN', >+ issue => 'Issue', >+ item_date => 'Date', >+ pages => 'Pages', >+ pagination => 'Pagination', >+ paper_author => 'Paper author', >+ paper_title => 'Paper title', >+ part_edition => 'Part / Edition', >+ publication => 'Publication', >+ published_date => 'Publication date', >+ published_place => 'Place of publication', >+ publisher => 'Publisher', >+ sponsor => 'Sponsor', >+ title => 'Title', >+ type => 'Type', >+ venue => 'Venue', >+ volume => 'Volume', >+ year => 'Year' >+ }; >+} >+ >+=head3 add_request >+ >+Add an ILL request >+ >+=cut >+ >+sub add_request { >+ >+ my ( $self, $params ) = @_; >+ >+ # ...Populate Illrequestattributes >+ # generate $request_details >+ my $request_details = _get_request_details( $params, $params->{other} ); >+ >+ my ( $brw_count, $brw ) = >+ _validate_borrower( $params->{other}->{'cardnumber'} ); >+ >+ ## Create request >+ >+ # Create bib record >+ my $biblionumber = $self->_standard_request2biblio($request_details); >+ >+ # ...Populate Illrequest >+ my $request = $params->{request}; >+ $request->biblio_id($biblionumber) unless $biblionumber == 0; >+ $request->borrowernumber( $brw->borrowernumber ); >+ $request->branchcode( $params->{other}->{branchcode} ); >+ $request->status('NEW'); >+ $request->backend( $params->{other}->{backend} ); >+ $request->placed( DateTime->now ); >+ $request->updated( DateTime->now ); >+ $request->batch_id( >+ $params->{other}->{ill_batch_id} ? $params->{other}->{ill_batch_id} : $params->{other}->{batch_id} ) >+ if column_exists( 'illrequests', 'batch_id' ); >+ $request->store; >+ >+ while ( my ( $type, $value ) = each %{$request_details} ) { >+ if ( $value && length $value > 0 ) { >+ Koha::ILL::Request::Attribute->new( >+ { >+ illrequest_id => $request->illrequest_id, >+ column_exists( 'illrequestattributes', 'backend' ) ? ( backend => "Standard" ) : (), >+ type => $type, >+ value => $value, >+ readonly => 0 >+ } >+ )->store; >+ } >+ } >+ >+ return $request; >+} >+ >+=head3 _openurl_to_ill >+ >+Take a hashref of OpenURL parameters and return >+those same parameters but transformed to the ILL >+schema >+ >+=cut >+ >+sub _openurl_to_ill { >+ my ($params) = @_; >+ >+ # Parameters to not place in our custom >+ # parameters arrays >+ my $ignore = { >+ openurl => 1, >+ backend => 1, >+ method => 1, >+ opac => 1, >+ cardnumber => 1, >+ branchcode => 1, >+ userid => 1, >+ password => 1, >+ koha_login_context => 1, >+ stage => 1 >+ }; >+ >+ my $transform_metadata = { >+ genre => 'type', >+ content => 'type', >+ format => 'type', >+ atitle => 'article_title', >+ aulast => 'author', >+ author => 'author', >+ date => 'year', >+ issue => 'issue', >+ volume => 'volume', >+ isbn => 'isbn', >+ issn => 'issn', >+ rft_id => 'doi', >+ year => 'year', >+ title => 'title', >+ author => 'author', >+ aulast => 'article_author', >+ pages => 'pages', >+ ctitle => 'chapter', >+ clast => 'chapter_author' >+ }; >+ >+ my $transform_value = { >+ type => { >+ fulltext => 'article', >+ selectedft => 'article', >+ print => 'book', >+ ebook => 'book', >+ journal => 'journal' >+ } >+ }; >+ >+ my $return = {}; >+ my $custom_key = []; >+ my $custom_value = []; >+ >+ # First make sure our keys are correct >+ foreach my $meta_key ( keys %{ $params->{other} } ) { >+ >+ # If we are transforming this property... >+ if ( exists $transform_metadata->{$meta_key} ) { >+ >+ # ...do it >+ $return->{ $transform_metadata->{$meta_key} } = $params->{other}->{$meta_key}; >+ } else { >+ >+ # Otherwise, pass it through untransformed and maybe move it >+ # to our custom parameters array >+ if ( !exists $ignore->{$meta_key} ) { >+ push @{$custom_key}, $meta_key; >+ push @{$custom_value}, $params->{other}->{$meta_key}; >+ } else { >+ $return->{$meta_key} = $params->{other}->{$meta_key}; >+ } >+ } >+ } >+ >+ # Now check our values are correct >+ foreach my $val_key ( keys %{$return} ) { >+ my $value = $return->{$val_key}; >+ if ( exists $transform_value->{$val_key} && exists $transform_value->{$val_key}->{$value} ) { >+ $return->{$val_key} = $transform_value->{$val_key}->{$value}; >+ } >+ } >+ if ( scalar @{$custom_key} > 0 ) { >+ $return->{custom_key} = join( "\0", @{$custom_key} ); >+ $return->{custom_value} = join( "\0", @{$custom_value} ); >+ } >+ $params->{other} = $return; >+ $params->{custom_keys} = $custom_key; >+ $params->{custom_values} = $custom_value; >+ return $params; >+ >+} >+ >+=head3 create_api >+ >+Create a local submission from data supplied via an >+API call >+ >+=cut >+ >+sub create_api { >+ my ( $self, $body, $request ) = @_; >+ >+ my $patron = Koha::Patrons->find( $body->{borrowernumber} ); >+ >+ $body->{cardnumber} = $patron->cardnumber; >+ >+ foreach my $attr ( @{ $body->{extended_attributes} } ) { >+ $body->{ $attr->{type} } = $attr->{value}; >+ } >+ >+ $body->{type} = $body->{'isbn'} ? 'book' : 'article'; >+ >+ my $submission = $self->add_request( { request => $request, other => $body } ); >+ >+ return $submission; >+} >+ >+=head3 _can_create_request >+ >+Given the parameters we've been passed, should we create the request >+ >+=cut >+ >+sub _can_create_request { >+ my ($params) = @_; >+ return ( defined $params->{'stage'} >+ && $params->{'stage'} eq 'form' >+ && !defined $params->{'add_new_custom'} >+ && !defined $params->{'custom_delete'} >+ && !defined $params->{'change_type'} ) ? 1 : 0; >+} >+ >+=head3 _standard_request2biblio >+ >+Given supplied metadata from a Standard request, create a basic biblio >+record and return its ID >+ >+=cut >+ >+sub _standard_request2biblio { >+ my ( $self, $metadata ) = @_; >+ >+ # We only want to create biblios for books >+ return 0 unless $metadata->{type} eq 'book'; >+ >+ # We're going to try and populate author, title & ISBN >+ my $author = $metadata->{author} if $metadata->{author}; >+ my $title = $metadata->{title} if $metadata->{title}; >+ my $isbn = $metadata->{isbn} if $metadata->{isbn}; >+ >+ # Create the MARC::Record object and populate >+ my $record = MARC::Record->new(); >+ >+ # Fix character set where appropriate >+ my $marcflavour = C4::Context->preference('marcflavour') || 'MARC21'; >+ if ( $record->encoding() eq 'MARC-8' ) { >+ ($record) = MarcToUTF8Record( $record, $marcflavour ); >+ } >+ >+ if ($isbn) { >+ my $marc_isbn = MARC::Field->new( '020', '', '', a => $isbn ); >+ $record->append_fields($marc_isbn); >+ } >+ if ($author) { >+ my $marc_author = MARC::Field->new( '100', '1', '', a => $author ); >+ $record->append_fields($marc_author); >+ } >+ if ($title) { >+ my $marc_title = MARC::Field->new( '245', '0', '0', a => $title ); >+ $record->append_fields($marc_title); >+ } >+ >+ # Suppress the record >+ _set_suppression($record); >+ >+ # Create a biblio record >+ my ( $biblionumber, $biblioitemnumber ) = >+ AddBiblio( $record, $self->{framework} ); >+ >+ return $biblionumber; >+} >+ >+=head3 _set_suppression >+ >+ _set_suppression($record); >+ >+Take a MARC::Record object and set it to be suppressed >+ >+=cut >+ >+sub _set_suppression { >+ my ($record) = @_; >+ >+ my $new942 = MARC::Field->new( '942', '', '', n => '1' ); >+ $record->append_fields($new942); >+ >+ return 1; >+} >+ >+=head1 AUTHORS >+ >+Alex Sassmannshausen <alex.sassmannshausen@ptfs-europe.com> >+Martin Renvoize <martin.renvoize@ptfs-europe.com> >+Andrew Isherwood <andrew.isherwood@ptfs-europe.com> >+ >+=cut >+ >+1; >diff --git a/Koha/ILL/Backend/intra-includes/cancel.inc b/Koha/ILL/Backend/intra-includes/cancel.inc >new file mode 100644 >index 00000000000..6c107abb304 >--- /dev/null >+++ b/Koha/ILL/Backend/intra-includes/cancel.inc >@@ -0,0 +1,17 @@ >+[% IF whole.error %] >+<p>Unhandled error</p> >+[% END %] >+ >+[% IF whole.stage == "confirm" %] >+<h2>Cancel manual request</h2> >+<p>Proceeding with this action will set this request to 'Cancelled'.</p> >+<p>This means that actions have been taken to cancel this request at the source with whom the request was placed.</p> >+<p>If you can confirm this has been done, please proceed.</p> >+<p> >+ [% base_url = "/cgi-bin/koha/ill/ill-requests.pl" %] >+ [% proceed_url = base_url _ "?method=cancel&stage=confirm" _ >+ "&illrequest_id=" _ request.illrequest_id %] >+ <a class="btn btn-sm btn-default" href="[% proceed_url %]">Revert request</a> >+ <a class="btn btn-sm btn-default cancel" href="[% base_url %]">Cancel</a> >+</p> >+[% END %] >diff --git a/Koha/ILL/Backend/intra-includes/confirm.inc b/Koha/ILL/Backend/intra-includes/confirm.inc >new file mode 100644 >index 00000000000..dcd003752e3 >--- /dev/null >+++ b/Koha/ILL/Backend/intra-includes/confirm.inc >@@ -0,0 +1,19 @@ >+[% IF whole.error %] >+<p>Unhandled error</p> >+[% END %] >+ >+[% IF whole.stage == "confirm" %] >+<h2>Confirm manual request</h2> >+<p>Proceeding with this action will set this request to 'Requested'.</p> >+<p>This means that actions have been taken to request this request from a source.</p> >+<p>If you can confirm this has been done, please proceed.</p> >+<p> >+ [% base_url = "/cgi-bin/koha/ill/ill-requests.pl" %] >+ [% proceed_url = base_url _ "?method=confirm&stage=confirm" _ >+ "&illrequest_id=" _ request.illrequest_id %] >+ <a class="btn btn-sm btn-default" href="[% proceed_url %]">Confirm request</a> >+ <a class="btn btn-sm btn-default cancel" href="[% base_url %]">Cancel</a> >+</p> >+[% ELSE %] >+<p>Unknown stage. This should not have happened. >+[% END %] >diff --git a/Koha/ILL/Backend/intra-includes/create.inc b/Koha/ILL/Backend/intra-includes/create.inc >new file mode 100644 >index 00000000000..162d88749f9 >--- /dev/null >+++ b/Koha/ILL/Backend/intra-includes/create.inc >@@ -0,0 +1,203 @@ >+[% SET koha_version = Koha.Version %] >+[% IF whole.error %] >+[% IF whole.status == 'missing_identifier' %] >+<p><em>Please Note:</em> Mandatory field Identifier is missing.</p> >+[% ELSIF whole.status == 'missing_branch' %] >+<p><em>Please Note:</em> Branch is a mandatory field.</p> >+[% ELSIF whole.status == 'invalid_borrower' %] >+<p><em>Please Note:</em> The borrower details you entered are invalid.</p> >+[% ELSIF whole.status == 'invalid_branch' %] >+<p><em>Please Note:</em> The branch you chose is invalid.</p> >+[% ELSE %] >+<p>Unhandled error</p> >+[% END %] >+[% END %] >+ >+[% IF whole.stage == "form" %] >+<h2>Create a manual ILL request</h2> >+<form id="create_form" method="POST" action=[% here %]> >+ <fieldset class="rows"> >+ <legend>General details</legend> >+ <ol id="general-standard-fields"> >+ <li> >+ <label class="required" for="type">Type:</label> >+ <select name="type" id="type"> >+ <option value=""/> >+ [% IF whole.value.other.type.lower == "book" %] >+ <option value="book" selected="selected">Book</option> >+ [% ELSE %] >+ <option value="book">Book</option> >+ [% END %] >+ [% IF whole.value.other.type.lower == "chapter" %] >+ <option value="chapter" selected="selected">Chapter</option> >+ [% ELSE %] >+ <option value="chapter">Chapter</option> >+ [% END %] >+ [% IF whole.value.other.type.lower == "journal" %] >+ <option value="journal" selected="selected">Journal</option> >+ [% ELSE %] >+ <option value="journal">Journal</option> >+ [% END %] >+ [% IF whole.value.other.type.lower == "article" %] >+ <option value="article" selected="selected">Journal article</option> >+ [% ELSE %] >+ <option value="article">Journal article</option> >+ [% END %] >+ [% IF whole.value.other.type.lower == "thesis" %] >+ <option value="thesis" selected="selected">Thesis</option> >+ [% ELSE %] >+ <option value="thesis">Thesis</option> >+ [% END %] >+ [% IF whole.value.other.type.lower == "conference" %] >+ <option value="conference" selected="selected">Conference</option> >+ [% ELSE %] >+ <option value="conference">Conference</option> >+ [% END %] >+ [% IF whole.value.other.type.lower == "dvd" %] >+ <option value="dvd" selected="selected">DVD</option> >+ [% ELSE %] >+ <option value="dvd">DVD</option> >+ [% END %] >+ [% IF whole.value.other.type.lower == "other" %] >+ <option value="other" selected="selected">Other</option> >+ [% ELSE %] >+ <option value="other">Other</option> >+ [% END %] >+ [% IF whole.value.other.type.lower == "resource" %] >+ <option value="resource" selected="selected">Generic resource</option> >+ [% ELSE %] >+ <option value="resource">Generic resource</option> >+ [% END %] >+ </select> >+ </li> >+ </ol> >+ </fieldset> >+ [% cwd = whole.cwd %] >+ [% type = whole.value.other.type %] >+ [% IF type %] >+ [% INCLUDE "${cwd}/shared-includes/forms/${type}.inc" %] >+ [% END %] >+ [% INCLUDE "${cwd}/shared-includes/custom_fields.inc" %] >+ <fieldset class="rows"> >+ <legend>Patron options</legend> >+ <ol> >+ <li> >+ <label class="required" for="cardnumber"> >+ Card number, username or surname: >+ </label> >+ <input type="text" name="cardnumber" id="cardnumber" autocomplete="off" >+ type="text" value="" /> >+ </li> >+ <li> >+ <label class="required" for="branchcode">Destination library:</label> >+ <select id="branchcode" name="branchcode"> >+ <option value="" /> >+ [% FOREACH branch IN branches %] >+ <option value="[% branch.branchcode %]"> >+ [% branch.branchname %] >+ </option> >+ [% END %] >+ </select> >+ </li> >+ </ol> >+ </fieldset> >+ <fieldset class="action"> >+ <input id="ill-submit" type="submit" value="Create" disabled /> >+ <a class="cancel" href="/cgi-bin/koha/ill/ill-requests.pl">Cancel</a> >+ </fieldset> >+ <input type="hidden" name="method" value="create" /> >+ <input type="hidden" name="stage" value="form" /> >+ <input type="hidden" name="backend" value="Standard" /> >+</form> >+[% BLOCK backend_jsinclude %] >+<script type="text/javascript"> >+ // <![CDATA[] >+ [% INCLUDE "${cwd}/shared-includes/shared.js" %] >+ // Require a username and branch selection >+ document.addEventListener('DOMContentLoaded', function(){ >+ $('#create_form #cardnumber, #create_form #branchcode').change(function() { >+ var comp = ['#cardnumber','#branchcode'].filter(function(id) { >+ return $(id).val().length > 0; >+ }); >+ $('#ill-submit').attr('disabled', comp.length < 2); >+ }); >+ /* Maintain patron autocomplete compatibility across versions */ >+ [% IF koha_version.major <= 22 && koha_version.minor < 11 %] >+ $('#create_form #cardnumber').autocomplete({ >+ source: "/cgi-bin/koha/circ/ysearch.pl", >+ minLength: 3, >+ select: function( event, ui ) { >+ var field = ui.item.cardnumber; >+ $('#create_form #cardnumber').val(field) >+ return false; >+ } >+ }) >+ .data( "ui-autocomplete" )._renderItem = function( ul, item ) { >+ return $( "<li></li>" ) >+ .data( "ui-autocomplete-item", item ) >+ .append( "<a>" + item.surname + ", " + item.firstname + " (" + item.cardnumber + ") <small>" + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "</small></a>" ) >+ .appendTo( ul ); >+ }; >+ [% ELSE %] >+ patron_autocomplete( >+ $('#create_form #cardnumber'), >+ { >+ 'on-select-callback': function( event, ui ) { >+ $("#create_form #cardnumber").val( ui.item.cardnumber ); >+ return false; >+ } >+ } >+ ); >+ [% END %] >+ }); >+ // ]]> >+</script> >+[% END %] >+ >+[% ELSIF whole.stage == "borrowers" %] >+<!-- We need to clarify the borrower that has been requested. --> >+<h2>Borrower selection</h2> >+<form method="POST" action=[% here %]> >+ [% FOREACH prop IN whole.value.other.keys %] >+ [% IF prop != 'custom_key' && prop != 'custom_value' && prop != 'cardnumber' %] >+ <input type="hidden" name="[% prop %]" value="[% whole.value.other.$prop %]"> >+ [% END %] >+ [% END %] >+ [% keys = whole.value.other.custom_key.split('\0') %] >+ [% values = whole.value.other.custom_value.split('\0') %] >+ [% i = 0 %] >+ [% FOREACH key IN keys %] >+ <input type="hidden" name="custom_key" value="[% key %]"> >+ <input type="hidden" name="custom_value" value="[% values.$i %]"> >+ [% i = i + 1 %] >+ [% END %] >+ <fieldset class="rows"> >+ <legend>Available borrowers for surname [% surname %]</legend> >+ [% FOREACH opt IN whole.value %] >+ [% IF opt.key == "brw" %] >+ <ol> >+ <li> >+ <label class="required" for="brw">Borrower</label> >+ <select name="cardnumber" id="cardnumber"> >+ <option value=""></option> >+ [% FOREACH brw IN opt.value %] >+ <option value="[% brw.cardnumber %]"> >+ [% brw.firstname %] [% brw.surname %] ([% brw.cardnumber %]) >+ </option> >+ [% END %] >+ </select> >+ </li> >+ </ol> >+ [% END %] >+ [% END %] >+ </fieldset> >+ <fieldset class="action"> >+ <input type="submit" value="Select"/> >+ <a class="cancel" href=[% parent %]>Cancel</a> >+ </fieldset> >+</form> >+ >+[% ELSE %] >+<p>Unknown stage. This should not have happened. >+ >+[% END %] >diff --git a/Koha/ILL/Backend/intra-includes/edititem.inc b/Koha/ILL/Backend/intra-includes/edititem.inc >new file mode 100644 >index 00000000000..bb34ce293af >--- /dev/null >+++ b/Koha/ILL/Backend/intra-includes/edititem.inc >@@ -0,0 +1,88 @@ >+[% IF whole.error %] >+[% IF whole.status == 'missing_type' %] >+<p><em>Please Note:</em> Mandatory field Type is missing.</p> >+[% ELSE %] >+<p>Unhandled error</p> >+[% END %] >+[% END %] >+ >+<h2>Edit a manual ILL request</h2> >+<form id="standard_edit_form" method="POST" action=[% here %]> >+ <fieldset class="rows"> >+ <legend>General details</legend> >+ <ol id="general-standard-fields"> >+ <li> >+ <label class="required" for="type">Type:</label> >+ <select name="type" id="type"> >+ <option value=""/> >+ [% IF whole.value.other.type.lower == "book" %] >+ <option value="book" selected="selected">Book</option> >+ [% ELSE %] >+ <option value="book">Book</option> >+ [% END %] >+ [% IF whole.value.other.type.lower == "chapter" %] >+ <option value="chapter" selected="selected">Chapter</option> >+ [% ELSE %] >+ <option value="chapter">Chapter</option> >+ [% END %] >+ [% IF whole.value.other.type.lower == "journal" %] >+ <option value="journal" selected="selected">Journal</option> >+ [% ELSE %] >+ <option value="journal">Journal</option> >+ [% END %] >+ [% IF whole.value.other.type.lower == "article" %] >+ <option value="article" selected="selected">Journal article</option> >+ [% ELSE %] >+ <option value="article">Journal article</option> >+ [% END %] >+ [% IF whole.value.other.type.lower == "thesis" %] >+ <option value="thesis" selected="selected">Thesis</option> >+ [% ELSE %] >+ <option value="thesis">Thesis</option> >+ [% END %] >+ [% IF whole.value.other.type.lower == "conference" %] >+ <option value="conference" selected="selected">Conference</option> >+ [% ELSE %] >+ <option value="conference">Conference</option> >+ [% END %] >+ [% IF whole.value.other.type.lower == "dvd" %] >+ <option value="dvd" selected="selected">DVD</option> >+ [% ELSE %] >+ <option value="dvd">DVD</option> >+ [% END %] >+ [% IF whole.value.other.type.lower == "other" %] >+ <option value="other" selected="selected">Other</option> >+ [% ELSE %] >+ <option value="other">Other</option> >+ [% END %] >+ [% IF whole.value.other.type.lower == "resource" %] >+ <option value="resource" selected="selected">Generic resource</option> >+ [% ELSE %] >+ <option value="resource">Generic resource</option> >+ [% END %] >+ </select> >+ </li> >+ </ol> >+ </fieldset> >+ [% cwd = whole.cwd %] >+ [% type = whole.value.other.type %] >+ [% IF type %] >+ [% INCLUDE "${cwd}/shared-includes/forms/${type}.inc" %] >+ [% END %] >+ [% INCLUDE "${cwd}/shared-includes/custom_fields.inc" %] >+ <fieldset class="action"> >+ <input id="ill-submit" type="submit" value="Update"/> >+ <a class="cancel" href="/cgi-bin/koha/ill/ill-requests.pl">Cancel</a> >+ </fieldset> >+ <input type="hidden" name="illrequest_id" value="[% whole.value.other.illrequest_id %]" /> >+ <input type="hidden" name="method" value="edititem" /> >+ <input type="hidden" name="stage" value="form" /> >+ <input type="hidden" name="backend" value="Standard" /> >+</form> >+[% BLOCK backend_jsinclude %] >+<script type="text/javascript"> >+ // <![CDATA[] >+ [% INCLUDE "${cwd}/shared-includes/shared.js" %] >+ // ]]> >+</script> >+[% END %] >diff --git a/Koha/ILL/Backend/intra-includes/illview.inc b/Koha/ILL/Backend/intra-includes/illview.inc >new file mode 100644 >index 00000000000..e69de29bb2d >diff --git a/Koha/ILL/Backend/intra-includes/migrate.inc b/Koha/ILL/Backend/intra-includes/migrate.inc >new file mode 100644 >index 00000000000..dfef8bd390c >--- /dev/null >+++ b/Koha/ILL/Backend/intra-includes/migrate.inc >@@ -0,0 +1,119 @@ >+[% IF whole.error %] >+[% IF whole.status == 'missing_identifier' %] >+<p><em>Please Note:</em> Mandatory field Identifier is missing.</p> >+[% ELSIF whole.status == 'missing_branch' %] >+<p><em>Please Note:</em> Branch is a mandatory field.</p> >+[% ELSIF whole.status == 'invalid_borrower' %] >+<p><em>Please Note:</em> The borrower details you entered are invalid.</p> >+[% ELSIF whole.status == 'invalid_branch' %] >+<p><em>Please Note:</em> The branch you chose is invalid.</p> >+[% ELSE %] >+<p>Unhandled error</p> >+[% END %] >+[% END %] >+ >+[% IF whole.stage == "form" %] >+<h2>Migrating an ILL request</h2> >+<form id="standard_migrate_form" method="POST" action=[% here %]> >+ <fieldset class="rows"> >+ <legend>General details</legend> >+ <ol id="general-standard-fields"> >+ <li> >+ <label class="required" for="type">Type:</label> >+ <select name="type" id="type"> >+ <option value=""/> >+ [% IF whole.value.other.type.lower == "book" %] >+ <option value="book" selected="selected">Book</option> >+ [% ELSE %] >+ <option value="book">Book</option> >+ [% END %] >+ [% IF whole.value.other.type.lower == "chapter" %] >+ <option value="chapter" selected="selected">Chapter</option> >+ [% ELSE %] >+ <option value="chapter">Chapter</option> >+ [% END %] >+ [% IF whole.value.other.type.lower == "journal" %] >+ <option value="journal" selected="selected">Journal</option> >+ [% ELSE %] >+ <option value="journal">Journal</option> >+ [% END %] >+ [% IF whole.value.other.type.lower == "article" %] >+ <option value="article" selected="selected">Journal article</option> >+ [% ELSE %] >+ <option value="article">Journal article</option> >+ [% END %] >+ [% IF whole.value.other.type.lower == "thesis" %] >+ <option value="thesis" selected="selected">Thesis</option> >+ [% ELSE %] >+ <option value="thesis">Thesis</option> >+ [% END %] >+ [% IF whole.value.other.type.lower == "conference" %] >+ <option value="conference" selected="selected">Conference</option> >+ [% ELSE %] >+ <option value="conference">Conference</option> >+ [% END %] >+ [% IF whole.value.other.type.lower == "dvd" %] >+ <option value="dvd" selected="selected">DVD/option> >+ [% ELSE %] >+ <option value="dvd">DVD</option> >+ [% END %] >+ [% IF whole.value.other.type.lower == "other" %] >+ <option value="other" selected="selected">Other</option> >+ [% ELSE %] >+ <option value="other">Other</option> >+ [% END %] >+ [% IF whole.value.other.type.lower == "resource" %] >+ <option value="resource" selected="selected">Generic resource</option> >+ [% ELSE %] >+ <option value="resource">Generic resource</option> >+ [% END %] >+ </select> >+ </li> >+ </ol> >+ </fieldset> >+ [% cwd = whole.cwd %] >+ [% type = whole.value.other.type %] >+ [% IF type %] >+ [% INCLUDE "${cwd}/shared-includes/forms/${type}.inc" %] >+ [% END %] >+ [% INCLUDE "${cwd}/shared-includes/custom_fields.inc" %] >+ <fieldset class="rows"> >+ <legend>Patron options</legend> >+ <ol> >+ <li> >+ <label class="required" for="cardnumber"> >+ Card number or surname: >+ </label> >+ <input type="text" name="cardnumber" id="cardnumber" >+ type="text" value="" /> >+ </li> >+ <li> >+ <label class="required" for="branchcode">Destination library:</label> >+ <select id="branchcode" name="branchcode"> >+ <option value="" /> >+ [% FOREACH branch IN branches %] >+ <option value="[% branch.branchcode %]"> >+ [% branch.branchname %] >+ </option> >+ [% END %] >+ </select> >+ </li> >+ </ol> >+ </fieldset> >+ <fieldset class="action"> >+ <input id="ill-submit" type="submit" value="Migrate"/> >+ <a class="cancel" href="/cgi-bin/koha/ill/ill-requests.pl">Cancel</a> >+ </fieldset> >+</form> >+[% BLOCK backend_jsinclude %] >+<script type="text/javascript"> >+ // <![CDATA[] >+ [% INCLUDE "${cwd}/shared-includes/shared.js" %] >+ // ]]> >+</script> >+[% END %] >+ >+[% ELSE %] >+<p>Unknown stage. This should not have happened. >+ >+[% END %] >diff --git a/Koha/ILL/Backend/opac-includes/create.inc b/Koha/ILL/Backend/opac-includes/create.inc >new file mode 100644 >index 00000000000..9affaf30868 >--- /dev/null >+++ b/Koha/ILL/Backend/opac-includes/create.inc >@@ -0,0 +1,122 @@ >+[% IF whole.error %] >+[% IF whole.status == 'missing_identifier' %] >+<p><em>Please Note:</em> Mandatory field Identifier is missing.</p> >+[% ELSIF whole.status == 'missing_branch' %] >+<p><em>Please Note:</em> Branch is a mandatory field.</p> >+[% ELSIF whole.status == 'invalid_borrower' %] >+<p><em>Please Note:</em> The borrower details you entered are invalid.</p> >+[% ELSIF whole.status == 'invalid_branch' %] >+<p><em>Please Note:</em> The branch you chose is invalid.</p> >+[% ELSE %] >+<p>Unhandled error</p> >+[% END %] >+[% END %] >+ >+[% IF whole.stage == "form" %] >+<h2>Create a manual ILL request</h2> >+<form id="create_form" method="POST" action=[% here %]> >+ <fieldset class="rows"> >+ <legend>General details</legend> >+ <ol id="general-standard-fields"> >+ <li> >+ <label class="required" for="type">Type:</label> >+ <select name="type" id="type"> >+ <option value=""/> >+ [% IF whole.value.other.type.lower == "book" %] >+ <option value="book" selected="selected">Book</option> >+ [% ELSE %] >+ <option value="book">Book</option> >+ [% END %] >+ [% IF whole.value.other.type.lower == "chapter" %] >+ <option value="chapter" selected="selected">Chapter</option> >+ [% ELSE %] >+ <option value="chapter">Chapter</option> >+ [% END %] >+ [% IF whole.value.other.type.lower == "journal" %] >+ <option value="journal" selected="selected">Journal</option> >+ [% ELSE %] >+ <option value="journal">Journal</option> >+ [% END %] >+ [% IF whole.value.other.type.lower == "article" %] >+ <option value="article" selected="selected">Journal article</option> >+ [% ELSE %] >+ <option value="article">Journal article</option> >+ [% END %] >+ [% IF whole.value.other.type.lower == "thesis" %] >+ <option value="thesis" selected="selected">Thesis</option> >+ [% ELSE %] >+ <option value="thesis">Thesis</option> >+ [% END %] >+ [% IF whole.value.other.type.lower == "conference" %] >+ <option value="conference" selected="selected">Conference</option> >+ [% ELSE %] >+ <option value="conference">Conference</option> >+ [% END %] >+ [% IF whole.value.other.type.lower == "dvd" %] >+ <option value="dvd" selected="selected">DVD</option> >+ [% ELSE %] >+ <option value="dvd">DVD</option> >+ [% END %] >+ [% IF whole.value.other.type.lower == "other" %] >+ <option value="other" selected="selected">Other</option> >+ [% ELSE %] >+ <option value="other">Other</option> >+ [% END %] >+ [% IF whole.value.other.type.lower == "resource" %] >+ <option value="resource" selected="selected">Generic resource</option> >+ [% ELSE %] >+ <option value="resource">Generic resource</option> >+ [% END %] >+ </select> >+ </li> >+ </ol> >+ </fieldset> >+ [% cwd = whole.cwd %] >+ [% type = whole.value.other.type %] >+ [% IF type %] >+ [% INCLUDE "${cwd}/shared-includes/forms/${type}.inc" %] >+ [% END %] >+ [% INCLUDE "${cwd}/shared-includes/custom_fields.inc" %] >+ <fieldset class="rows"> >+ <legend>Patron options</legend> >+ <ol> >+ <li> >+ <label class="required" for="branchcode">Destination library:</label> >+ <select id="branchcode" name="branchcode"> >+ <option value="" /> >+ [% FOREACH branch IN branches %] >+ [% IF whole.value.other.branchcode && branch.branchcode == whole.value.other.branchcode %] >+ <option value="[% branch.branchcode %]" selected> >+ [% branch.branchname %] >+ </option> >+ [% ELSE %] >+ <option value="[% branch.branchcode %]"> >+ [% branch.branchname %] >+ </option> >+ [% END %] >+ [% END %] >+ </select> >+ </li> >+ </ol> >+ </fieldset> >+ >+ <fieldset class="action"> >+ <input id="ill-submit" class="btn btn-default" type="submit" value="Create"/> >+ <a class="cancel" href="/cgi-bin/koha/opac-illrequests.pl">Cancel</a> >+ </fieldset> >+ <input type="hidden" name="method" value="create" /> >+ <input type="hidden" name="stage" value="form" /> >+ <input type="hidden" name="backend" value="Standard" /> >+</form> >+ >+[% ELSE %] >+<p>Unknown stage. This should not have happened. >+ >+[% END %] >+[% BLOCK backend_jsinclude %] >+<script type="text/javascript"> >+ // <![CDATA[] >+ [% INCLUDE "${cwd}/shared-includes/shared.js" %] >+ // ]]> >+</script> >+[% END %] >diff --git a/Koha/ILL/Backend/shared-includes/custom_fields.inc b/Koha/ILL/Backend/shared-includes/custom_fields.inc >new file mode 100644 >index 00000000000..e91b694a321 >--- /dev/null >+++ b/Koha/ILL/Backend/shared-includes/custom_fields.inc >@@ -0,0 +1,22 @@ >+<fieldset class="rows"> >+ <legend>Custom fields</legend> >+ <ol id="standard-fields"> >+ [% keys = whole.value.other.custom_key.split('\0') %] >+ [% values = whole.value.other.custom_value.split('\0') %] >+ [% i = 0 %] >+ [% FOREACH key IN keys %] >+ <li class="form-horizontal"> >+ <input type="text" class="custom-name" name="custom_key" value="[% key %]"><input type="text" name="custom_value" id="custom-value" value="[% values.$i %]"> >+ <button value="[% i %]" name="custom_delete" type="submit" class="btn btn-danger btn-sm delete-new-field"> >+ <span class="fa fa-delete"></span>Delete >+ </button></li> >+ </li> >+ [% i = i + 1 %] >+ [% END %] >+ </ol> >+ <div id="custom-warning" style="display:none;margin:1em;" class="error required"></div> >+ <button type="button" id="add-new-fields" class="btn btn-default"> >+ <span class="fa fa-plus"></span> >+ Add new field >+ </button> >+</fieldset> >diff --git a/Koha/ILL/Backend/shared-includes/forms/article.inc b/Koha/ILL/Backend/shared-includes/forms/article.inc >new file mode 100644 >index 00000000000..598b1191f51 >--- /dev/null >+++ b/Koha/ILL/Backend/shared-includes/forms/article.inc >@@ -0,0 +1,50 @@ >+<fieldset id="journal-standard-fieldset" class="rows"> >+ <legend>Journal details</legend> >+ <ol id="journal-standard-fields"> >+ <li> >+ <label for="title">Title:</label> >+ <input type="text" name="title" id="title" value="[% whole.value.other.title %]" /> >+ </li> >+ <li> >+ <label for="volume">Volume:</label> >+ <input type="text" name="volume" id="volume" value="[% whole.value.other.volume %]" /> >+ </li> >+ <li> >+ <label for="issue">Issue number:</label> >+ <input type="text" name="issue" id="issue" value="[% whole.value.other.issue %]" /> >+ </li> >+ <li> >+ <label for="year">Year:</label> >+ <input type="text" name="year" id="year" value="[% whole.value.other.year %]" /> >+ </li> >+ <li> >+ <label for="issn">ISSN:</label> >+ <input type="text" name="issn" id="issn" value="[% whole.value.other.issn %]" /> >+ </li> >+ </ol> >+</fieldset> >+<fieldset id="article-standard-fieldset" class="rows"> >+ <legend>Article details</legend> >+ <ol id="article-standard-fields"> >+ <li> >+ <label for="article_title">Article title:</label> >+ <input type="text" name="article_title" id="article_title" value="[% whole.value.other.article_title %]" /> >+ </li> >+ <li> >+ <label for="article_author">Article author:</label> >+ <input type="text" name="article_author" id="article_author" value="[% whole.value.other.article_author %]" /> >+ </li> >+ <li> >+ <label for="published_date">Publication date:</label> >+ <input type="text" name="published_date" id="published_date" value="[% whole.value.other.published_date %]" /> >+ </li> >+ <li> >+ <label for="pages">Pages:</label> >+ <input type="text" name="pages" id="pages" value="[% whole.value.other.pages %]" /> >+ </li> >+ <li> >+ <label for="doi">DOI:</label> >+ <input type="text" name="doi" id="doi" value="[% whole.value.other.doi %]" /> >+ </li> >+ </ol> >+</fieldset> >diff --git a/Koha/ILL/Backend/shared-includes/forms/book.inc b/Koha/ILL/Backend/shared-includes/forms/book.inc >new file mode 100644 >index 00000000000..3ce9613ae2c >--- /dev/null >+++ b/Koha/ILL/Backend/shared-includes/forms/book.inc >@@ -0,0 +1,45 @@ >+<fieldset id="book-standard-fieldset" class="rows"> >+ <legend>Book details</legend> >+ <ol id="publication-standard-fields"> >+ <li> >+ <label for="title">Title:</label> >+ <input type="text" name="title" id="title" value="[% whole.value.other.title %]" /> >+ </li> >+ <li> >+ <label for="author">Author:</label> >+ <input type="text" name="author" id="author" value="[% whole.value.other.author %]" /> >+ </li> >+ <li> >+ <label for="editor">Editor:</label> >+ <input type="text" name="editor" id="editor" value="[% whole.value.other.editor %]" /> >+ </li> >+ <li> >+ <label for="publisher">Publisher:</label> >+ <input type="text" name="publisher" id="publisher" value="[% whole.value.other.publisher %]" /> >+ </li> >+ <li> >+ <label for="published_place">Place of publication:</label> >+ <input type="text" name="published_place" id="published_place" value="[% whole.value.other.published_place %]" /> >+ </li> >+ <li> >+ <label for="year">Year:</label> >+ <input type="text" name="year" id="year" value="[% whole.value.other.year %]" /> >+ </li> >+ <li> >+ <label for="part_edition">Part / Edition:</label> >+ <input type="text" name="part_edition" id="part_edition" value="[% whole.value.other.part_edition %]" /> >+ </li> >+ <li> >+ <label for="volume">Volume:</label> >+ <input type="text" name="volume" id="volume" value="[% whole.value.other.volume %]" /> >+ </li> >+ <li> >+ <label for="isbn">ISBN:</label> >+ <input type="text" name="isbn" id="isbn" value="[% whole.value.other.isbn %]" /> >+ </li> >+ <li> >+ <label for="doi">DOI:</label> >+ <input type="text" name="doi" id="doi" value="[% whole.value.other.doi %]" /> >+ </li> >+ </ol> >+</fieldset> >diff --git a/Koha/ILL/Backend/shared-includes/forms/chapter.inc b/Koha/ILL/Backend/shared-includes/forms/chapter.inc >new file mode 100644 >index 00000000000..8bf9ce003b2 >--- /dev/null >+++ b/Koha/ILL/Backend/shared-includes/forms/chapter.inc >@@ -0,0 +1,62 @@ >+<fieldset id="book-standard-fieldset" class="rows"> >+ <legend>Book details</legend> >+ <ol id="publication-standard-fields"> >+ <li> >+ <label for="title">Title:</label> >+ <input type="text" name="title" id="title" value="[% whole.value.other.title %]" /> >+ </li> >+ <li> >+ <label for="author">Author:</label> >+ <input type="text" name="author" id="author" value="[% whole.value.other.author %]" /> >+ </li> >+ <li> >+ <label for="editor">Editor:</label> >+ <input type="text" name="editor" id="editor" value="[% whole.value.other.editor %]" /> >+ </li> >+ <li> >+ <label for="publisher">Publisher:</label> >+ <input type="text" name="publisher" id="publisher" value="[% whole.value.other.publisher %]" /> >+ </li> >+ <li> >+ <label for="published_place">Place of publication:</label> >+ <input type="text" name="published_place" id="published_place" value="[% whole.value.other.published_place %]" /> >+ </li> >+ <li> >+ <label for="year">Year:</label> >+ <input type="text" name="year" id="year" value="[% whole.value.other.year %]" /> >+ </li> >+ <li> >+ <label for="part_edition">Part / Edition:</label> >+ <input type="text" name="part_edition" id="part_edition" value="[% whole.value.other.part_edition %]" /> >+ </li> >+ <li> >+ <label for="volume">Volume:</label> >+ <input type="text" name="volume" id="volume" value="[% whole.value.other.volume %]" /> >+ </li> >+ <li> >+ <label for="isbn">ISBN:</label> >+ <input type="text" name="isbn" id="isbn" value="[% whole.value.other.isbn %]" /> >+ </li> >+ <li> >+ <label for="doi">DOI:</label> >+ <input type="text" name="doi" id="doi" value="[% whole.value.other.doi %]" /> >+ </li> >+ </ol> >+</fieldset> >+<fieldset id="chapter-standard-fieldset" class="rows"> >+ <legend>Chapter details</legend> >+ <ol id="chapter-standard-fields"> >+ <li> >+ <label for="chapter_author">Author:</label> >+ <input type="text" name="chapter_author" id="chapter_author" value="[% whole.value.other.chapter_author %]" /> >+ </li> >+ <li> >+ <label for="chapter">Chapter:</label> >+ <input type="text" name="chapter" id="chapter" value="[% whole.value.other.chapter %]" /> >+ </li> >+ <li> >+ <label for="pages">Pages:</label> >+ <input type="text" name="pages" id="pages" value="[% whole.value.other.pages %]" /> >+ </li> >+ </ol> >+</fieldset> >diff --git a/Koha/ILL/Backend/shared-includes/forms/conference.inc b/Koha/ILL/Backend/shared-includes/forms/conference.inc >new file mode 100644 >index 00000000000..facda38ee45 >--- /dev/null >+++ b/Koha/ILL/Backend/shared-includes/forms/conference.inc >@@ -0,0 +1,49 @@ >+<fieldset id="conference-standard-fieldset" class="rows"> >+ <legend>Conference details</legend> >+ <ol id="conference-standard-fields"> >+ <li> >+ <label for="title">Conference title:</label> >+ <input type="text" name="title" id="title" value="[% whole.value.other.title %]" /> >+ </li> >+ <li> >+ <label for="publication">Publication:</label> >+ <input type="text" name="publication" id="publication" value="[% whole.value.other.publication %]" /> >+ </li> >+ <li> >+ <label for="conference_date">Conference date:</label> >+ <input type="text" name="conference_date" id="conference_date" value="[% whole.value.other.conference_date %]" /> >+ </li> >+ <li> >+ <label for="venue">Venue:</label> >+ <input type="text" name="venue" id="venue" value="[% whole.value.other.venue %]" /> >+ </li> >+ <li> >+ <label for="sponsor">Sponsor:</label> >+ <input type="text" name="sponsor" id="sponsor" value="[% whole.value.other.sponsor %]" /> >+ </li> >+ <li> >+ <label for="volume">Volume:</label> >+ <input type="text" name="volume" id="volume" value="[% whole.value.other.volume %]" /> >+ </li> >+ <li> >+ <label for="isbn">ISBN:</label> >+ <input type="text" name="isbn" id="isbn" value="[% whole.value.other.isbn %]" /> >+ </li> >+ <li> >+ <label for="issn">ISSN:</label> >+ <input type="text" name="issn" id="issn" value="[% whole.value.other.issn %]" /> >+ </li> >+ <li> >+ <label for="part_edition">Part:</label> >+ <input type="text" name="part_edition" id="part_edition" value="[% whole.value.other.part_edition %]" /> >+ </li> >+ <li> >+ <label for="paper_title">Paper title:</label> >+ <input type="text" name="paper_title" id="paper_title" value="[% whole.value.other.paper_title %]" /> >+ </li> >+ <li> >+ <label for="paper_author">Paper author:</label> >+ <input type="text" name="paper_author" id="paper_author" value="[% whole.value.other.paper_author %]" /> >+ </li> >+ </ol> >+</fieldset> >diff --git a/Koha/ILL/Backend/shared-includes/forms/journal.inc b/Koha/ILL/Backend/shared-includes/forms/journal.inc >new file mode 100644 >index 00000000000..3f92e91382c >--- /dev/null >+++ b/Koha/ILL/Backend/shared-includes/forms/journal.inc >@@ -0,0 +1,29 @@ >+<fieldset id="journal-standard-fieldset" class="rows"> >+ <legend>Journal details</legend> >+ <ol id="journal-standard-fields"> >+ <li> >+ <label for="title">Title:</label> >+ <input type="text" name="title" id="title" value="[% whole.value.other.title %]" /> >+ </li> >+ <li> >+ <label for="volume">Volume:</label> >+ <input type="text" name="volume" id="volume" value="[% whole.value.other.volume %]" /> >+ </li> >+ <li> >+ <label for="issue">Issue number:</label> >+ <input type="text" name="issue" id="issue" value="[% whole.value.other.issue %]" /> >+ </li> >+ <li> >+ <label for="year">Year:</label> >+ <input type="text" name="year" id="year" value="[% whole.value.other.year %]" /> >+ </li> >+ <li> >+ <label for="issn">ISSN:</label> >+ <input type="text" name="issn" id="issn" value="[% whole.value.other.issn %]" /> >+ </li> >+ <li> >+ <label for="doi">DOI:</label> >+ <input type="text" name="doi" id="doi" value="[% whole.value.other.doi %]" /> >+ </li> >+ </ol> >+</fieldset> >diff --git a/Koha/ILL/Backend/shared-includes/forms/other.inc b/Koha/ILL/Backend/shared-includes/forms/other.inc >new file mode 100644 >index 00000000000..e69de29bb2d >diff --git a/Koha/ILL/Backend/shared-includes/forms/resource.inc b/Koha/ILL/Backend/shared-includes/forms/resource.inc >new file mode 100644 >index 00000000000..a8f9b8419f4 >--- /dev/null >+++ b/Koha/ILL/Backend/shared-includes/forms/resource.inc >@@ -0,0 +1,53 @@ >+<fieldset id="resource-standard-fieldset" class="rows"> >+ <legend>Generic resource details</legend> >+ <ol id="resource-standard-fields"> >+ <li> >+ <label for="title">Title:</label> >+ <input type="text" name="title" value="[% whole.value.other.title %]" /> >+ </li> >+ <li> >+ <label for="author">Author:</label> >+ <input type="text" name="author" id="author" value="[% whole.value.other.author %]" /> >+ </li> >+ <li> >+ <label for="editor">Editor:</label> >+ <input type="text" name="editor" id="editor" value="[% whole.value.other.editor %]" /> >+ </li> >+ <li> >+ <label for="publisher">Publisher:</label> >+ <input type="text" name="publisher" id="publisher" value="[% whole.value.other.publisher %]" /> >+ </li> >+ <li> >+ <label for="published_place">Place of publication:</label> >+ <input type="text" name="published_place" id="published_place" value="[% whole.value.other.published_place %]" /> >+ </li> >+ <li> >+ <label for="year">Year:</label> >+ <input type="text" name="year" id="year" value="[% whole.value.other.year %]" /> >+ </li> >+ <li> >+ <label for="part_edition">Part / Edition:</label> >+ <input type="text" name="part_edition" id="part_edition" value="[% whole.value.other.part_edition %]" /> >+ </li> >+ <li> >+ <label for="volume">Volume:</label> >+ <input type="text" name="volume" id="volume" value="[% whole.value.other.volume %]" /> >+ </li> >+ <li> >+ <label for="pages">Pages:</label> >+ <input type="text" name="pages" id="pages" value="[% whole.value.other.pages %]" /> >+ </li> >+ <li> >+ <label for="isbn">ISBN:</label> >+ <input type="text" name="isbn" id="isbn" value="[% whole.value.other.isbn %]" /> >+ </li> >+ <li> >+ <label for "issn">ISSN:</label> >+ <input type="text" name="issn" id="issn" value="[% whole.value.other.issn %]" /> >+ </li> >+ <li> >+ <label for="doi">DOI:</label> >+ <input type="text" name="doi" id="doi" value="[% whole.value.other.doi %]" /> >+ </li> >+ </ol> >+</fieldset> >diff --git a/Koha/ILL/Backend/shared-includes/forms/thesis.inc b/Koha/ILL/Backend/shared-includes/forms/thesis.inc >new file mode 100644 >index 00000000000..142cdcdc1e1 >--- /dev/null >+++ b/Koha/ILL/Backend/shared-includes/forms/thesis.inc >@@ -0,0 +1,25 @@ >+<fieldset id="thesis-standard-fieldset" class="rows"> >+ <legend>Thesis details</legend> >+ <ol id="thesis-standard-fields"> >+ <li> >+ <label for="title">Title:</label> >+ <input type="text" name="title" id="title" value="[% whole.value.other.title %]" /> >+ </li> >+ <li> >+ <label for="author">Author:</label> >+ <input type="text" name="author" id="author" value="[% whole.value.other.author %]" /> >+ </li> >+ <li> >+ <label for="institution">Institution:</label> >+ <input type="text" name="institution" id="institution" value="[% whole.value.other.institution %]" /> >+ </li> >+ <li> >+ <label for="published_date">Publication date:</label> >+ <input type="text" name="published_date" id="published_date" value="[% whole.value.other.published_date %]" /> >+ </li> >+ <li> >+ <label for="doi">DOI:</label> >+ <input type="text" name="doi" id="doi" value="[% whole.value.other.doi %]" /> >+ </li> >+ </ol> >+</fieldset> >diff --git a/Koha/ILL/Backend/shared-includes/shared.js b/Koha/ILL/Backend/shared-includes/shared.js >new file mode 100644 >index 00000000000..ab6e885b2c6 >--- /dev/null >+++ b/Koha/ILL/Backend/shared-includes/shared.js >@@ -0,0 +1,38 @@ >+var core = [ [% whole.core %] ]; >+document.addEventListener('DOMContentLoaded', function() { >+ $('#add-new-fields').click(function(e) { >+ e.preventDefault(); >+ var row = '<li class="form-horizontal">' + >+ '<input type="text" class="custom-name" name="custom_key">' + >+ '<input type="text" id="custom-value" name="custom_value"> '+ >+ '<button type="button" class="btn btn-danger btn-sm ' + >+ 'delete-new-field">' + >+ '<span class="fa fa-delete">' + >+ '</span>Delete</button></li>'; >+ $('#standard-fields').append(row); >+ }); >+ $('#standard-fields').on('click', '.delete-new-field', >+ function(event) { >+ event.preventDefault(); >+ $(event.target).parent().remove(); >+ } >+ ); >+ $('#type').change(function() { >+ $('#create_form').prepend( >+ '<input type="hidden" name="change_type" value="1" />' >+ ); >+ $('#create_form').submit(); >+ }); >+ $('#standard-fields').on('keyup', '.custom-name', function() { >+ var val = $(this).val(); >+ if (core.indexOf(val.toLowerCase()) > -1) { >+ $('#custom-warning').text(_('The name "' + val + '" is not permitted')).show(); >+ $('#ill-submit').attr('disabled', true); >+ $('#add-new-fields').attr('disabled', true); >+ } else { >+ $('#custom-warning').hide(); >+ $('#ill-submit').attr('disabled', false); >+ $('#add-new-fields').attr('disabled', false); >+ } >+ }); >+}); >-- >2.47.0
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 35570
:
159942
|
159943
|
159944
|
159946
|
159947
|
160452
|
160457
|
160654
|
160655
|
160656
|
160657
|
160658
|
160659
|
160660
|
160686
|
161519
|
161520
|
161521
|
161522
|
161523
|
161524
|
162894
|
162897
|
162898
|
162899
|
162900
|
162901
|
162902
|
162903
|
162904
|
162905
|
164277
|
164278
|
164279
|
164280
|
164281
|
164282
|
164283
|
164284
|
165204
|
165205
|
165206
|
165207
|
165208
|
165209
|
165210
|
165211
|
165286
|
165287
|
165288
|
165289
|
165290
|
165291
|
165292
|
165293
|
167050
|
167051
|
171312
|
171313
|
171314
|
171315
|
171316
|
171317
|
171318
|
171319
|
171320
|
171321
|
171322
|
171323
|
172218
|
172219
|
172722
|
172723
|
172724
|
172725
|
172726
|
172727
|
172728
|
172729
|
172730
|
172731
|
172732
|
172733
|
172734
|
172735
| 172740 |
172741
|
172742
|
172743
|
172744
|
172745
|
172746
|
172747
|
172748
|
172749
|
172750
|
172751
|
172752
|
172753
|
172780
|
172809
|
172811
|
173916
|
173917
|
173918