+++ /dev/null
-package Koha::ERM::EHolding;
-
-# 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 Koha::Database;
-
-use base qw(Koha::Object);
-
-use Koha::ERM::EHolding::Packages;
-
-=head1 NAME
-
-Koha::ERM::EHolding - Koha ERM EHolding Object class
-
-=head1 API
-
-=head2 Class Methods
-
-=head3 eholding_packages
-
-Returns the eholding_packages link for this eHolding
-
-=cut
-
-sub eholding_packages {
- my ( $self, $eholding_packages ) = @_;
-
- if ( $eholding_packages ) {
- my $schema = $self->_result->result_source->schema;
- $schema->txn_do(
- sub {
- $self->eholding_packages->delete;
-
- for my $eholding_package (@$eholding_packages) {
- $self->_result->add_to_erm_eholdings_packages($eholding_package);
- }
- }
- );
- }
- my $eholding_packages_rs = $self->_result->erm_eholdings_packages;
- return Koha::ERM::EHolding::Packages->_new_from_dbic($eholding_packages_rs);
-}
-
-=head2 Internal methods
-
-=head3 _type
-
-=cut
-
-sub _type {
- return 'ErmEholding';
-}
-
-1;
+++ /dev/null
-package Koha::ERM::EHolding::Package;
-
-# 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 Koha::Database;
-
-use Koha::ERM::Package;
-
-use base qw(Koha::Object);
-
-=head1 NAME
-
-Koha::ERM::EHolding::Package - Koha EHolding Package Object class
-
-=head1 API
-
-=head2 Class Methods
-
-=cut
-
-=head3 package
-
-Return the package for this link
-
-=cut
-
-sub package {
- my ( $self ) = @_;
- my $package_rs = $self->_result->package;
- return Koha::ERM::Package->_new_from_dbic($package_rs);
-}
-
-=head2 Internal methods
-
-=head3 _type
-
-=cut
-
-sub _type {
- return 'ErmEholdingsPackage';
-}
-
-1;
+++ /dev/null
-package Koha::ERM::EHolding::Packages;
-
-# 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 Koha::Database;
-
-use Koha::ERM::EHolding::Package;
-
-use base qw(Koha::Objects);
-
-=head1 NAME
-
-Koha::ERM::EHolding::Packages- Koha EHolding EHolding Object set class
-
-=head1 API
-
-=head2 Class Methods
-
-=cut
-
-=head3 type
-
-=cut
-
-sub _type {
- return 'ErmEholdingsPackage';
-}
-
-sub object_class {
- return 'Koha::ERM::EHolding::Package';
-}
-
-1;
+++ /dev/null
-package Koha::ERM::EHoldings;
-
-# 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 Koha::Database;
-
-use Koha::ERM::EHolding;
-
-use base qw(Koha::Objects);
-
-=head1 NAME
-
-Koha::ERM::EHoldings - Koha ERM EHolding Object set class
-
-=head1 API
-
-=head2 Class Methods
-
-=cut
-
-=head3 type
-
-=cut
-
-sub _type {
- return 'ErmEholding';
-}
-
-sub object_class {
- return 'Koha::ERM::EHolding';
-}
-
-1;
--- /dev/null
+package Koha::ERM::EHoldings::Package;
+
+# 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 Koha::Database;
+
+use base qw(Koha::Object);
+
+use Koha::ERM::EHoldings::Package::Agreements;
+
+=head1 NAME
+
+Koha::ERM::EHoldings::Package - Koha ERM Package Object class
+
+=head1 API
+
+=head2 Class Methods
+
+=head3 package_agreements
+
+Returns the package agreements link for this package
+
+=cut
+
+sub package_agreements {
+ my ( $self, $package_agreements ) = @_;
+
+ if ( $package_agreements ) {
+ my $schema = $self->_result->result_source->schema;
+ $schema->txn_do(
+ sub {
+ $self->package_agreements->delete;
+
+ for my $package_agreement (@$package_agreements) {
+ $self->_result->add_to_erm_eholdings_packages_agreements($package_agreement);
+ }
+ }
+ );
+ }
+
+ my $agreements_rs = $self->_result->erm_eholdings_packages_agreements;
+ return Koha::ERM::EHoldings::Package::Agreements->_new_from_dbic($agreements_rs);
+}
+
+=head2 Internal methods
+
+=head3 _type
+
+=cut
+
+sub _type {
+ return 'ErmEholdingsPackage';
+}
+
+1;
--- /dev/null
+package Koha::ERM::EHoldings::Package::Agreement;
+
+# 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 Koha::Database;
+
+use Koha::ERM::Agreement;
+
+use base qw(Koha::Object);
+
+=head1 NAME
+
+Koha::ERM::EHoldings::Package::Agreement - Koha Package-Agreement Object class
+
+=head1 API
+
+=head2 Class Methods
+
+=cut
+
+=head3 agreement
+
+Return the agreement linked to this package agreement
+
+=cut
+
+sub agreement {
+ my ( $self ) = @_;
+ my $agreement_rs = $self->_result->agreement;
+ return Koha::ERM::Agreement->_new_from_dbic($agreement_rs);
+}
+
+=head2 Internal methods
+
+=head3 _type
+
+=cut
+
+sub _type {
+ return 'ErmEholdingsPackagesAgreement';
+}
+
+1;
--- /dev/null
+package Koha::ERM::EHoldings::Package::Agreements;
+
+# 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 Koha::Database;
+
+use Koha::ERM::EHoldings::Package::Agreement;
+
+use base qw(Koha::Objects);
+
+=head1 NAME
+
+Koha::ERM::EHoldings::Package::Agreements - Koha Package-Agreement Object set class
+
+=head1 API
+
+=head2 Class Methods
+
+=cut
+
+=head3 type
+
+=cut
+
+sub _type {
+ return 'ErmEholdingsPackagesAgreement';
+}
+
+sub object_class {
+ return 'Koha::ERM::EHoldings::Package::Agreement';
+}
+
+1;
--- /dev/null
+package Koha::ERM::EHoldings::Packages;
+
+# 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 Koha::Database;
+
+use Koha::ERM::EHoldings::Package;
+
+use base qw(Koha::Objects);
+
+=head1 NAME
+
+Koha::ERM::EHoldings::Packages - Koha ERM Package Object set class
+
+=head1 API
+
+=head2 Class Methods
+
+=cut
+
+=head3 type
+
+=cut
+
+sub _type {
+ return 'ErmEholdingsPackage';
+}
+
+sub object_class {
+ return 'Koha::ERM::EHoldings::Package';
+}
+
+1;
--- /dev/null
+package Koha::ERM::EHoldings::Resource;
+
+# 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 Koha::Database;
+
+use Koha::ERM::EHoldings::Title;
+use Koha::ERM::EHoldings::Package;
+
+use base qw(Koha::Object);
+
+=head1 NAME
+
+Koha::ERM::EHoldings::Resource - Koha EHolding resource Object class
+
+=head1 API
+
+=head2 Class Methods
+
+=cut
+
+=head3 package
+
+Return the package for this resource
+
+=cut
+
+sub package {
+ my ( $self ) = @_;
+ my $package_rs = $self->_result->package;
+ return Koha::ERM::EHoldings::Package->_new_from_dbic($package_rs);
+}
+
+=head3 title
+
+Return the title for this resource
+
+=cut
+
+sub title {
+ my ( $self ) = @_;
+ my $title_rs = $self->_result->title;
+ return Koha::ERM::EHoldings::Title->_new_from_dbic($title_rs);
+}
+
+=head2 Internal methods
+
+=head3 _type
+
+=cut
+
+sub _type {
+ return 'ErmEholdingsResource';
+}
+
+1;
--- /dev/null
+package Koha::ERM::EHoldings::Resources;
+
+# 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 Koha::Database;
+
+use Koha::ERM::EHoldings::Resource;
+
+use base qw(Koha::Objects);
+
+=head1 NAME
+
+Koha::ERM::EHoldings::Resources- Koha EHolding Resource Object set class
+
+=head1 API
+
+=head2 Class Methods
+
+=cut
+
+=head3 type
+
+=cut
+
+sub _type {
+ return 'ErmEholdingsResource';
+}
+
+sub object_class {
+ return 'Koha::ERM::EHoldings::Resource';
+}
+
+1;
--- /dev/null
+package Koha::ERM::EHoldings::Title;
+
+# 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 Koha::Database;
+
+use base qw(Koha::Object);
+
+use Koha::ERM::EHoldings::Resources;
+
+=head1 NAME
+
+Koha::ERM::EHoldings::Title - Koha ERM Title Object class
+
+=head1 API
+
+=head2 Class Methods
+
+=head3 resources
+
+Returns the resources linked to this title
+
+=cut
+
+sub resources {
+ my ( $self, $resources ) = @_;
+
+ if ( $resources ) {
+ my $schema = $self->_result->result_source->schema;
+ $schema->txn_do(
+ sub {
+ $self->resources->delete;
+
+ for my $resources (@$resources) {
+ $self->_result->add_to_erm_eholdings_resources($resources);
+ }
+ }
+ );
+ }
+ my $resources_rs = $self->_result->erm_eholdings_resources;
+ return Koha::ERM::EHoldings::Resources->_new_from_dbic($resources_rs);
+}
+
+=head2 Internal methods
+
+=head3 _type
+
+=cut
+
+sub _type {
+ return 'ErmEholdingsTitle';
+}
+
+1;
--- /dev/null
+package Koha::ERM::EHoldings::Titles;
+
+# 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 Koha::Database;
+
+use Koha::ERM::EHoldings::Title;
+
+use base qw(Koha::Objects);
+
+=head1 NAME
+
+Koha::ERM::EHoldings::Title - Koha ERM Title Object set class
+
+=head1 API
+
+=head2 Class Methods
+
+=cut
+
+=head3 type
+
+=cut
+
+sub _type {
+ return 'ErmEholdingsTitle';
+}
+
+sub object_class {
+ return 'Koha::ERM::EHoldings::Title';
+}
+
+1;
+++ /dev/null
-package Koha::ERM::Package;
-
-# 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 Koha::Database;
-
-use base qw(Koha::Object);
-
-use Koha::ERM::Package::Agreements;
-
-=head1 NAME
-
-Koha::ERM::Package - Koha ERM Package Object class
-
-=head1 API
-
-=head2 Class Methods
-
-=head3 package_agreements
-
-Returns the package agreements link for this package
-
-=cut
-
-sub package_agreements {
- my ( $self, $package_agreements ) = @_;
-
- if ( $package_agreements ) {
- my $schema = $self->_result->result_source->schema;
- $schema->txn_do(
- sub {
- $self->package_agreements->delete;
-
- for my $package_agreement (@$package_agreements) {
- $self->_result->add_to_erm_packages_agreements($package_agreement);
- }
- }
- );
- }
-
- my $agreements_rs = $self->_result->erm_packages_agreements;
- return Koha::ERM::Package::Agreements->_new_from_dbic($agreements_rs);
-}
-
-=head2 Internal methods
-
-=head3 _type
-
-=cut
-
-sub _type {
- return 'ErmPackage';
-}
-
-1;
+++ /dev/null
-package Koha::ERM::Package::Agreement;
-
-# 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 Koha::Database;
-
-use Koha::ERM::Agreement;
-
-use base qw(Koha::Object);
-
-=head1 NAME
-
-Koha::ERM::Package::Agreement - Koha Package Agreement Object class
-
-=head1 API
-
-=head2 Class Methods
-
-=cut
-
-=head3 agreement
-
-Return the agreement linked to this package agreement
-
-=cut
-
-sub agreement {
- my ( $self ) = @_;
- my $agreement_rs = $self->_result->agreement;
- return Koha::ERM::Agreement->_new_from_dbic($agreement_rs);
-}
-
-=head2 Internal methods
-
-=head3 _type
-
-=cut
-
-sub _type {
- return 'ErmPackagesAgreement';
-}
-
-1;
+++ /dev/null
-package Koha::ERM::Package::Agreements;
-
-# 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 Koha::Database;
-
-use Koha::ERM::Package::Agreement;
-
-use base qw(Koha::Objects);
-
-=head1 NAME
-
-Koha::ERM::Package::Agreements - Koha Package Agreement Object set class
-
-=head1 API
-
-=head2 Class Methods
-
-=cut
-
-=head3 type
-
-=cut
-
-sub _type {
- return 'ErmPackageAgreement';
-}
-
-sub object_class {
- return 'Koha::ERM::Package::Agreement';
-}
-
-1;
+++ /dev/null
-package Koha::ERM::Packages;
-
-# 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 Koha::Database;
-
-use Koha::ERM::Package;
-
-use base qw(Koha::Objects);
-
-=head1 NAME
-
-Koha::ERM::Packages - Koha ERM Package Object set class
-
-=head1 API
-
-=head2 Class Methods
-
-=cut
-
-=head3 type
-
-=cut
-
-sub _type {
- return 'ErmPackage';
-}
-
-sub object_class {
- return 'Koha::ERM::Package';
-}
-
-1;
+++ /dev/null
-package Koha::REST::V1::ERM::EHoldings;
-
-# 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 Mojo::Base 'Mojolicious::Controller';
-
-use Koha::ERM::EHoldings;
-
-use Scalar::Util qw( blessed );
-use Try::Tiny qw( catch try );
-
-=head1 API
-
-=head2 Methods
-
-=head3 list
-
-=cut
-
-sub list {
- my $c = shift->openapi->valid_input or return;
-
- return try {
- my $eholdings_set = Koha::ERM::EHoldings->new;
- my $eholdings = $c->objects->search( $eholdings_set );
- return $c->render( status => 200, openapi => $eholdings );
- }
- catch {
- $c->unhandled_exception($_);
- };
-
-}
-
-=head3 get
-
-Controller function that handles retrieving a single Koha::ERM::EHolding object
-
-=cut
-
-sub get {
- my $c = shift->openapi->valid_input or return;
-
- return try {
- my $eholding_id = $c->validation->param('eholding_id');
- my $eholding = $c->objects->find( Koha::ERM::EHoldings->search, $eholding_id );
-
- unless ($eholding) {
- return $c->render(
- status => 404,
- openapi => { error => "eHolding not found" }
- );
- }
-
- return $c->render(
- status => 200,
- openapi => $eholding
- );
- }
- catch {
- $c->unhandled_exception($_);
- };
-}
-
-=head3 add
-
-Controller function that handles adding a new Koha::ERM::EHolding object
-
-=cut
-
-sub add {
- my $c = shift->openapi->valid_input or return;
-
- return try {
- Koha::Database->new->schema->txn_do(
- sub {
-
- my $body = $c->validation->param('body');
-
- my $eholding_packages = delete $body->{eholding_packages} // [];
-
- my $eholding = Koha::ERM::EHolding->new_from_api($body)->store;
-
- $eholding->eholding_packages($eholding_packages);
-
- $c->res->headers->location($c->req->url->to_string . '/' . $eholding->eholding_id);
- return $c->render(
- status => 201,
- openapi => $eholding->to_api
- );
- }
- );
- }
- catch {
-
- my $to_api_mapping = Koha::ERM::EHolding->new->to_api_mapping;
-
- if ( blessed $_ ) {
- if ( $_->isa('Koha::Exceptions::Object::DuplicateID') ) {
- return $c->render(
- status => 409,
- openapi => { error => $_->error, conflict => $_->duplicate_id }
- );
- }
- elsif ( $_->isa('Koha::Exceptions::Object::FKConstraint') ) {
- return $c->render(
- status => 400,
- openapi => {
- error => "Given "
- . $to_api_mapping->{ $_->broken_fk }
- . " does not exist"
- }
- );
- }
- elsif ( $_->isa('Koha::Exceptions::BadParameter') ) {
- return $c->render(
- status => 400,
- openapi => {
- error => "Given "
- . $to_api_mapping->{ $_->parameter }
- . " does not exist"
- }
- );
- }
- }
-
- $c->unhandled_exception($_);
- };
-}
-
-=head3 update
-
-Controller function that handles updating a Koha::ERM::EHolding object
-
-=cut
-
-sub update {
- my $c = shift->openapi->valid_input or return;
-
- my $eholding_id = $c->validation->param('eholding_id');
- my $eholding = Koha::ERM::EHoldings->find( $eholding_id );
-
- unless ($eholding) {
- return $c->render(
- status => 404,
- openapi => { error => "eHolding not found" }
- );
- }
-
- return try {
- Koha::Database->new->schema->txn_do(
- sub {
-
- my $body = $c->validation->param('body');
-
- my $eholding_packages = delete $body->{eholding_packages} // [];
-
- $eholding->set_from_api($body)->store;
-
- $eholding->eholding_packages($eholding_packages);
-
- $c->res->headers->location($c->req->url->to_string . '/' . $eholding->eholding_id);
- return $c->render(
- status => 200,
- openapi => $eholding->to_api
- );
- }
- );
- }
- catch {
- my $to_api_mapping = Koha::ERM::EHolding->new->to_api_mapping;
-
- if ( blessed $_ ) {
- if ( $_->isa('Koha::Exceptions::Object::FKConstraint') ) {
- return $c->render(
- status => 400,
- openapi => {
- error => "Given "
- . $to_api_mapping->{ $_->broken_fk }
- . " does not exist"
- }
- );
- }
- elsif ( $_->isa('Koha::Exceptions::BadParameter') ) {
- return $c->render(
- status => 400,
- openapi => {
- error => "Given "
- . $to_api_mapping->{ $_->parameter }
- . " does not exist"
- }
- );
- }
- }
-
- $c->unhandled_exception($_);
- };
-};
-
-=head3 delete
-
-=cut
-
-sub delete {
- my $c = shift->openapi->valid_input or return;
-
- my $eholding = Koha::ERM::EHoldings->find( $c->validation->param('eholding_id') );
- unless ($eholding) {
- return $c->render(
- status => 404,
- openapi => { error => "eHolding not found" }
- );
- }
-
- return try {
- $eholding->delete;
- return $c->render(
- status => 204,
- openapi => q{}
- );
- }
- catch {
- $c->unhandled_exception($_);
- };
-}
-
-1;
--- /dev/null
+package Koha::REST::V1::ERM::EHoldings::Packages;
+
+# 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 Mojo::Base 'Mojolicious::Controller';
+
+use Koha::ERM::EHoldings::Packages;
+
+use Scalar::Util qw( blessed );
+use Try::Tiny qw( catch try );
+
+=head1 API
+
+=head2 Methods
+
+=head3 list
+
+=cut
+
+sub list {
+ my $c = shift->openapi->valid_input or return;
+
+ return try {
+ my $packages_set = Koha::ERM::EHoldings::Packages->new;
+ my $packages = $c->objects->search( $packages_set );
+ return $c->render( status => 200, openapi => $packages );
+ }
+ catch {
+ $c->unhandled_exception($_);
+ };
+
+}
+
+=head3 get
+
+Controller function that handles retrieving a single Koha::ERM::EHoldings::Package object
+
+=cut
+
+sub get {
+ my $c = shift->openapi->valid_input or return;
+
+ return try {
+ my $package_id = $c->validation->param('package_id');
+ my $package = $c->objects->find( Koha::ERM::EHoldings::Packages->search, $package_id );
+
+ unless ($package) {
+ return $c->render(
+ status => 404,
+ openapi => { error => "Package not found" }
+ );
+ }
+
+ return $c->render(
+ status => 200,
+ openapi => $package
+ );
+ }
+ catch {
+ $c->unhandled_exception($_);
+ };
+}
+
+=head3 add
+
+Controller function that handles adding a new Koha::ERM::EHoldings::Package object
+
+=cut
+
+sub add {
+ my $c = shift->openapi->valid_input or return;
+
+ return try {
+ Koha::Database->new->schema->txn_do(
+ sub {
+
+ my $body = $c->validation->param('body');
+
+ my $package_agreements = delete $body->{package_agreements} // [];
+
+ my $package = Koha::ERM::EHoldings::Package->new_from_api($body)->store;
+ $package->package_agreements($package_agreements);
+
+ $c->res->headers->location($c->req->url->to_string . '/' . $package->package_id);
+ return $c->render(
+ status => 201,
+ openapi => $package->to_api
+ );
+ }
+ );
+ }
+ catch {
+
+ my $to_api_mapping = Koha::ERM::EHoldings::Package->new->to_api_mapping;
+
+ if ( blessed $_ ) {
+ if ( $_->isa('Koha::Exceptions::Object::DuplicateID') ) {
+ return $c->render(
+ status => 409,
+ openapi => { error => $_->error, conflict => $_->duplicate_id }
+ );
+ }
+ elsif ( $_->isa('Koha::Exceptions::Object::FKConstraint') ) {
+ return $c->render(
+ status => 400,
+ openapi => {
+ error => "Given "
+ . $to_api_mapping->{ $_->broken_fk }
+ . " does not exist"
+ }
+ );
+ }
+ elsif ( $_->isa('Koha::Exceptions::BadParameter') ) {
+ return $c->render(
+ status => 400,
+ openapi => {
+ error => "Given "
+ . $to_api_mapping->{ $_->parameter }
+ . " does not exist"
+ }
+ );
+ }
+ }
+
+ $c->unhandled_exception($_);
+ };
+}
+
+=head3 update
+
+Controller function that handles updating a Koha::ERM::EHoldings::Package object
+
+=cut
+
+sub update {
+ my $c = shift->openapi->valid_input or return;
+
+ my $package_id = $c->validation->param('package_id');
+ my $package = Koha::ERM::EHoldings::Packages->find( $package_id );
+
+ unless ($package) {
+ return $c->render(
+ status => 404,
+ openapi => { error => "Package not found" }
+ );
+ }
+
+ return try {
+ Koha::Database->new->schema->txn_do(
+ sub {
+
+ my $body = $c->validation->param('body');
+
+ my $package_agreements = delete $body->{package_agreements} // [];
+
+ $package->set_from_api($body)->store;
+ $package->package_agreements($package_agreements);
+
+ $c->res->headers->location($c->req->url->to_string . '/' . $package->package_id);
+ return $c->render(
+ status => 200,
+ openapi => $package->to_api
+ );
+ }
+ );
+ }
+ catch {
+ my $to_api_mapping = Koha::ERM::EHoldings::Package->new->to_api_mapping;
+
+ if ( blessed $_ ) {
+ if ( $_->isa('Koha::Exceptions::Object::FKConstraint') ) {
+ return $c->render(
+ status => 400,
+ openapi => {
+ error => "Given "
+ . $to_api_mapping->{ $_->broken_fk }
+ . " does not exist"
+ }
+ );
+ }
+ elsif ( $_->isa('Koha::Exceptions::BadParameter') ) {
+ return $c->render(
+ status => 400,
+ openapi => {
+ error => "Given "
+ . $to_api_mapping->{ $_->parameter }
+ . " does not exist"
+ }
+ );
+ }
+ }
+
+ $c->unhandled_exception($_);
+ };
+};
+
+=head3 delete
+
+=cut
+
+sub delete {
+ my $c = shift->openapi->valid_input or return;
+
+ my $package = Koha::ERM::EHoldings::Packages->find( $c->validation->param('package_id') );
+ unless ($package) {
+ return $c->render(
+ status => 404,
+ openapi => { error => "Package not found" }
+ );
+ }
+
+ return try {
+ $package->delete;
+ return $c->render(
+ status => 204,
+ openapi => q{}
+ );
+ }
+ catch {
+ $c->unhandled_exception($_);
+ };
+}
+
+1;
--- /dev/null
+package Koha::REST::V1::ERM::EHoldings::Titles;
+
+# 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 Mojo::Base 'Mojolicious::Controller';
+
+use Koha::ERM::EHoldings::Titles;
+
+use Scalar::Util qw( blessed );
+use Try::Tiny qw( catch try );
+
+=head1 API
+
+=head2 Methods
+
+=head3 list
+
+=cut
+
+sub list {
+ my $c = shift->openapi->valid_input or return;
+
+ return try {
+ my $titles_set = Koha::ERM::EHoldings::Titles->new;
+ my $titles = $c->objects->search( $titles_set );
+ return $c->render( status => 200, openapi => $titles );
+ }
+ catch {
+ $c->unhandled_exception($_);
+ };
+
+}
+
+=head3 get
+
+Controller function that handles retrieving a single Koha::ERM::EHoldings::Title object
+
+=cut
+
+sub get {
+ my $c = shift->openapi->valid_input or return;
+
+ return try {
+ my $title_id = $c->validation->param('title_id');
+ my $title = $c->objects->find( Koha::ERM::EHoldings::Titles->search, $title_id );
+
+ unless ($title ) {
+ return $c->render(
+ status => 404,
+ openapi => { error => "eHolding title not found" }
+ );
+ }
+
+ return $c->render(
+ status => 200,
+ openapi => $title,
+ );
+ }
+ catch {
+ $c->unhandled_exception($_);
+ };
+}
+
+=head3 add
+
+Controller function that handles adding a new Koha::ERM::EHoldings::Title object
+
+=cut
+
+sub add {
+ my $c = shift->openapi->valid_input or return;
+
+ return try {
+ Koha::Database->new->schema->txn_do(
+ sub {
+
+ my $body = $c->validation->param('body');
+
+ my $resources = delete $body->{resources} // [];
+
+ my $title = Koha::ERM::EHoldings::Title->new_from_api($body)->store;
+
+ $title->resources($resources);
+
+ $c->res->headers->location($c->req->url->to_string . '/' . $title->title_id);
+ return $c->render(
+ status => 201,
+ openapi => $title->to_api
+ );
+ }
+ );
+ }
+ catch {
+
+ my $to_api_mapping = Koha::ERM::EHoldings::Title->new->to_api_mapping;
+
+ if ( blessed $_ ) {
+ if ( $_->isa('Koha::Exceptions::Object::DuplicateID') ) {
+ return $c->render(
+ status => 409,
+ openapi => { error => $_->error, conflict => $_->duplicate_id }
+ );
+ }
+ elsif ( $_->isa('Koha::Exceptions::Object::FKConstraint') ) {
+ return $c->render(
+ status => 400,
+ openapi => {
+ error => "Given "
+ . $to_api_mapping->{ $_->broken_fk }
+ . " does not exist"
+ }
+ );
+ }
+ elsif ( $_->isa('Koha::Exceptions::BadParameter') ) {
+ return $c->render(
+ status => 400,
+ openapi => {
+ error => "Given "
+ . $to_api_mapping->{ $_->parameter }
+ . " does not exist"
+ }
+ );
+ }
+ }
+
+ $c->unhandled_exception($_);
+ };
+}
+
+=head3 update
+
+Controller function that handles updating a Koha::ERM::EHoldings::Title object
+
+=cut
+
+sub update {
+ my $c = shift->openapi->valid_input or return;
+
+ my $title_id = $c->validation->param('title_id');
+ my $title = Koha::ERM::EHoldings::Titles->find( $title_id );
+
+ unless ($title) {
+ return $c->render(
+ status => 404,
+ openapi => { error => "eHolding title not found" }
+ );
+ }
+
+ return try {
+ Koha::Database->new->schema->txn_do(
+ sub {
+
+ my $body = $c->validation->param('body');
+
+ my $resources = delete $body->{resources} // [];
+
+ $title->set_from_api($body)->store;
+
+ $title->resources($resources);
+
+ $c->res->headers->location($c->req->url->to_string . '/' . $title->title_id);
+ return $c->render(
+ status => 200,
+ openapi => $title->to_api
+ );
+ }
+ );
+ }
+ catch {
+ my $to_api_mapping = Koha::ERM::EHoldings::Title->new->to_api_mapping;
+
+ if ( blessed $_ ) {
+ if ( $_->isa('Koha::Exceptions::Object::FKConstraint') ) {
+ return $c->render(
+ status => 400,
+ openapi => {
+ error => "Given "
+ . $to_api_mapping->{ $_->broken_fk }
+ . " does not exist"
+ }
+ );
+ }
+ elsif ( $_->isa('Koha::Exceptions::BadParameter') ) {
+ return $c->render(
+ status => 400,
+ openapi => {
+ error => "Given "
+ . $to_api_mapping->{ $_->parameter }
+ . " does not exist"
+ }
+ );
+ }
+ }
+
+ $c->unhandled_exception($_);
+ };
+};
+
+=head3 delete
+
+=cut
+
+sub delete {
+ my $c = shift->openapi->valid_input or return;
+
+ my $title = Koha::ERM::EHoldings::Titles->find( $c->validation->param('title_id') );
+ unless ($title) {
+ return $c->render(
+ status => 404,
+ openapi => { error => "eHolding title not found" }
+ );
+ }
+
+ return try {
+ $title->delete;
+ return $c->render(
+ status => 204,
+ openapi => q{}
+ );
+ }
+ catch {
+ $c->unhandled_exception($_);
+ };
+}
+
+1;
+++ /dev/null
-package Koha::REST::V1::ERM::Packages;
-
-# 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 Mojo::Base 'Mojolicious::Controller';
-
-use Koha::ERM::Packages;
-
-use Scalar::Util qw( blessed );
-use Try::Tiny qw( catch try );
-
-=head1 API
-
-=head2 Methods
-
-=head3 list
-
-=cut
-
-sub list {
- my $c = shift->openapi->valid_input or return;
-
- return try {
- my $packages_set = Koha::ERM::Packages->new;
- my $packages = $c->objects->search( $packages_set );
- return $c->render( status => 200, openapi => $packages );
- }
- catch {
- $c->unhandled_exception($_);
- };
-
-}
-
-=head3 get
-
-Controller function that handles retrieving a single Koha::ERM::Package object
-
-=cut
-
-sub get {
- my $c = shift->openapi->valid_input or return;
-
- return try {
- my $package_id = $c->validation->param('package_id');
- my $package = $c->objects->find( Koha::ERM::Packages->search, $package_id );
-
- unless ($package) {
- return $c->render(
- status => 404,
- openapi => { error => "Package not found" }
- );
- }
-
- return $c->render(
- status => 200,
- openapi => $package
- );
- }
- catch {
- $c->unhandled_exception($_);
- };
-}
-
-=head3 add
-
-Controller function that handles adding a new Koha::ERM::Package object
-
-=cut
-
-sub add {
- my $c = shift->openapi->valid_input or return;
-
- return try {
- Koha::Database->new->schema->txn_do(
- sub {
-
- my $body = $c->validation->param('body');
-
- my $package_agreements = delete $body->{package_agreements} // [];
-
- my $package = Koha::ERM::Package->new_from_api($body)->store;
- $package->package_agreements($package_agreements);
-
- $c->res->headers->location($c->req->url->to_string . '/' . $package->package_id);
- return $c->render(
- status => 201,
- openapi => $package->to_api
- );
- }
- );
- }
- catch {
-
- my $to_api_mapping = Koha::ERM::Package->new->to_api_mapping;
-
- if ( blessed $_ ) {
- if ( $_->isa('Koha::Exceptions::Object::DuplicateID') ) {
- return $c->render(
- status => 409,
- openapi => { error => $_->error, conflict => $_->duplicate_id }
- );
- }
- elsif ( $_->isa('Koha::Exceptions::Object::FKConstraint') ) {
- return $c->render(
- status => 400,
- openapi => {
- error => "Given "
- . $to_api_mapping->{ $_->broken_fk }
- . " does not exist"
- }
- );
- }
- elsif ( $_->isa('Koha::Exceptions::BadParameter') ) {
- return $c->render(
- status => 400,
- openapi => {
- error => "Given "
- . $to_api_mapping->{ $_->parameter }
- . " does not exist"
- }
- );
- }
- }
-
- $c->unhandled_exception($_);
- };
-}
-
-=head3 update
-
-Controller function that handles updating a Koha::ERM::Package object
-
-=cut
-
-sub update {
- my $c = shift->openapi->valid_input or return;
-
- my $package_id = $c->validation->param('package_id');
- my $package = Koha::ERM::Packages->find( $package_id );
-
- unless ($package) {
- return $c->render(
- status => 404,
- openapi => { error => "Package not found" }
- );
- }
-
- return try {
- Koha::Database->new->schema->txn_do(
- sub {
-
- my $body = $c->validation->param('body');
-
- my $package_agreements = delete $body->{package_agreements} // [];
-
- $package->set_from_api($body)->store;
- $package->package_agreements($package_agreements);
-
- $c->res->headers->location($c->req->url->to_string . '/' . $package->package_id);
- return $c->render(
- status => 200,
- openapi => $package->to_api
- );
- }
- );
- }
- catch {
- my $to_api_mapping = Koha::ERM::Package->new->to_api_mapping;
-
- if ( blessed $_ ) {
- if ( $_->isa('Koha::Exceptions::Object::FKConstraint') ) {
- return $c->render(
- status => 400,
- openapi => {
- error => "Given "
- . $to_api_mapping->{ $_->broken_fk }
- . " does not exist"
- }
- );
- }
- elsif ( $_->isa('Koha::Exceptions::BadParameter') ) {
- return $c->render(
- status => 400,
- openapi => {
- error => "Given "
- . $to_api_mapping->{ $_->parameter }
- . " does not exist"
- }
- );
- }
- }
-
- $c->unhandled_exception($_);
- };
-};
-
-=head3 delete
-
-=cut
-
-sub delete {
- my $c = shift->openapi->valid_input or return;
-
- my $package = Koha::ERM::Packages->find( $c->validation->param('package_id') );
- unless ($package) {
- return $c->render(
- status => 404,
- openapi => { error => "Package not found" }
- );
- }
-
- return try {
- $package->delete;
- return $c->render(
- status => 204,
- openapi => q{}
- );
- }
- catch {
- $c->unhandled_exception($_);
- };
-}
-
-1;
+++ /dev/null
----
-type: object
-properties:
- eholding_id:
- type: integer
- description: internally assigned identifier
- readOnly: true
- vendor_id:
- description: foreign key to aqbooksellers
- type:
- - integer
- - "null"
- publication_title:
- description: publication_title of the eHolding
- type: string
- print_identifier:
- description: print_identifier of the eHolding
- type:
- - string
- - "null"
- online_identifier:
- description: online_identifier of the eHolding
- type:
- - string
- - "null"
- date_first_issue_online:
- description: date_first_issue_online of the eHolding
- type:
- - string
- - "null"
- num_first_vol_online:
- description: num_first_vol_online of the eHolding
- type:
- - string
- - "null"
- num_first_issue_online:
- description: num_first_issue_online of the eHolding
- type:
- - string
- - "null"
- date_last_issue_online:
- description: date_last_issue_online of the eHolding
- type:
- - string
- - "null"
- num_last_vol_online:
- description: num_last_vol_online of the eHolding
- type:
- - string
- - "null"
- num_last_issue_online:
- description: num_last_issue_online of the eHolding
- type:
- - string
- - "null"
- title_url:
- description: title_url of the eHolding
- type:
- - string
- - "null"
- first_author:
- description: first_author of the eHolding
- type:
- - string
- - "null"
- title_id:
- description: title_id of the eHolding
- type:
- - string
- - "null"
- embargo_info:
- description: embargo_info of the eHolding
- type:
- - string
- - "null"
- coverage_depth:
- description: coverage_depth of the eHolding
- type:
- - string
- - "null"
- notes:
- description: notes of the eHolding
- type:
- - string
- - "null"
- publisher_name:
- description: publisher_name of the eHolding
- type:
- - string
- - "null"
- publication_type:
- description: publication_type of the eHolding
- type:
- - string
- - "null"
- date_monograph_published_print:
- description: date_monograph_published_print of the eHolding
- type:
- - string
- - "null"
- date_monograph_published_online:
- description: date_monograph_published_online of the eHolding
- type:
- - string
- - "null"
- monograph_volume:
- description: monograph_volume of the eHolding
- type:
- - string
- - "null"
- monograph_edition:
- description: monograph_edition of the eHolding
- type:
- - string
- - "null"
- first_editor:
- description: first_editor of the eHolding
- type:
- - string
- - "null"
- parent_publication_title_id:
- description: parent_publication_title_id of the eHolding
- type:
- - string
- - "null"
- preceeding_publication_title_id:
- description: preceeding_publication_title_id of the eHolding
- type:
- - string
- - "null"
- access_type:
- description: access_type of the eHolding
- type:
- - string
- - "null"
- eholding_packages:
- type: array
- description: packages containing this title
- items:
- $ref: erm_eholding_package.yaml
-
-additionalProperties: false
-required:
- - publication_title
+++ /dev/null
----
-type: object
-properties:
- eholding_id:
- type: integer
- description: Internal related eHolding identifier
- package_id:
- type: integer
- description: Internal package identifier
- started_on:
- description: Start date
- type:
- - string
- - "null"
- ended_on:
- description: End date
- type:
- - string
- - "null"
- proxy:
- description: Proxy
- type:
- - string
- - "null"
-additionalProperties: false
-required:
- - package_id
--- /dev/null
+---
+type: object
+properties:
+ package_id:
+ type: integer
+ description: internally assigned package identifier
+ readOnly: true
+ vendor_id:
+ description: foreign key to aqbooksellers
+ type:
+ - integer
+ - "null"
+ name:
+ description: name of the package
+ type: string
+ external_package_id:
+ description: external id of the package
+ type:
+ - string
+ - "null"
+ package_type:
+ description: type of the package
+ type:
+ - string
+ - "null"
+ content_type:
+ description: content type of the package
+ type:
+ - string
+ - "null"
+ created_on:
+ description: date of creation
+ type:
+ - string
+ - "null"
+ package_agreements:
+ type: array
+ description: agreements
+ items:
+ $ref: erm_eholdings_package_agreement.yaml
+
+additionalProperties: false
+required:
+ - name
--- /dev/null
+---
+type: object
+properties:
+ package_id:
+ type: integer
+ description: foreign key to package
+ readOnly: true
+ agreement_id:
+ description: foreign key to agreement
+ type: integer
+
+additionalProperties: false
+required:
+ - agreement_id
--- /dev/null
+---
+type: object
+properties:
+ resource_id:
+ type: integer
+ description: Internal resource identifier
+ title_id:
+ type: integer
+ description: Internal title identifier
+ package_id:
+ type: integer
+ description: Internal package identifier
+ started_on:
+ description: Start date
+ type:
+ - string
+ - "null"
+ ended_on:
+ description: End date
+ type:
+ - string
+ - "null"
+ proxy:
+ description: Proxy to access this resource
+ type:
+ - string
+ - "null"
+additionalProperties: false
+required:
+ - package_id
--- /dev/null
+---
+type: object
+properties:
+ title_id:
+ type: integer
+ description: internally assigned identifier
+ readOnly: true
+ vendor_id:
+ description: foreign key to aqbooksellers
+ type:
+ - integer
+ - "null"
+ publication_title:
+ description: publication_title of the title
+ type: string
+ print_identifier:
+ description: print_identifier of the title
+ type:
+ - string
+ - "null"
+ online_identifier:
+ description: online_identifier of the title
+ type:
+ - string
+ - "null"
+ date_first_issue_online:
+ description: date_first_issue_online of the title
+ type:
+ - string
+ - "null"
+ num_first_vol_online:
+ description: num_first_vol_online of the title
+ type:
+ - string
+ - "null"
+ num_first_issue_online:
+ description: num_first_issue_online of the title
+ type:
+ - string
+ - "null"
+ date_last_issue_online:
+ description: date_last_issue_online of the title
+ type:
+ - string
+ - "null"
+ num_last_vol_online:
+ description: num_last_vol_online of the title
+ type:
+ - string
+ - "null"
+ num_last_issue_online:
+ description: num_last_issue_online of the title
+ type:
+ - string
+ - "null"
+ title_url:
+ description: title_url of the title
+ type:
+ - string
+ - "null"
+ first_author:
+ description: first_author of the title
+ type:
+ - string
+ - "null"
+ embargo_info:
+ description: embargo_info of the title
+ type:
+ - string
+ - "null"
+ coverage_depth:
+ description: coverage_depth of the title
+ type:
+ - string
+ - "null"
+ notes:
+ description: notes of the title
+ type:
+ - string
+ - "null"
+ publisher_name:
+ description: publisher_name of the title
+ type:
+ - string
+ - "null"
+ publication_type:
+ description: publication_type of the title
+ type:
+ - string
+ - "null"
+ date_monograph_published_print:
+ description: date_monograph_published_print of the title
+ type:
+ - string
+ - "null"
+ date_monograph_published_online:
+ description: date_monograph_published_online of the title
+ type:
+ - string
+ - "null"
+ monograph_volume:
+ description: monograph_volume of the title
+ type:
+ - string
+ - "null"
+ monograph_edition:
+ description: monograph_edition of the title
+ type:
+ - string
+ - "null"
+ first_editor:
+ description: first_editor of the title
+ type:
+ - string
+ - "null"
+ parent_publication_title_id:
+ description: parent_publication_title_id of the title
+ type:
+ - string
+ - "null"
+ preceeding_publication_title_id:
+ description: preceeding_publication_title_id of the title
+ type:
+ - string
+ - "null"
+ access_type:
+ description: access_type of the title
+ type:
+ - string
+ - "null"
+ resources:
+ type: array
+ description: Resource containing this title
+ items:
+ $ref: erm_eholdings_resource.yaml
+
+additionalProperties: false
+required:
+ - publication_title
+++ /dev/null
----
-type: object
-properties:
- package_id:
- type: integer
- description: internally assigned package identifier
- readOnly: true
- vendor_id:
- description: foreign key to aqbooksellers
- type:
- - integer
- - "null"
- name:
- description: name of the package
- type: string
- external_package_id:
- description: external id of the package
- type:
- - string
- - "null"
- package_type:
- description: type of the package
- type:
- - string
- - "null"
- content_type:
- description: content type of the package
- type:
- - string
- - "null"
- created_on:
- description: date of creation
- type:
- - string
- - "null"
- package_agreements:
- type: array
- description: agreements
- items:
- $ref: erm_package_agreement.yaml
-
-additionalProperties: false
-required:
- - name
+++ /dev/null
----
-type: object
-properties:
- package_id:
- type: integer
- description: foreign key to package
- readOnly: true
- agreement_id:
- description: foreign key to agreement
- type: integer
-
-additionalProperties: false
-required:
- - agreement_id
+++ /dev/null
----
-/erm/eholdings:
- get:
- x-mojo-to: ERM::EHoldings#list
- operationId: listErmEHoldings
- tags:
- - eholding
- summary: List eholdings
- produces:
- - application/json
- parameters:
- - description: Case insensitive search on eholding eholding_id
- in: query
- name: eholding_id
- required: false
- type: integer
- - description: Case insensitive search on eholding vendor_id
- in: query
- name: vendor_id
- required: false
- type: integer
- - description: Case insensitive search on eholding publication_title
- in: query
- name: publication_title
- required: false
- type: string
- - description: Case insensitive search on eholding print_identifier
- in: query
- name: print_identifier
- required: false
- type: string
- - description: Case insensitive search on eholding online_identifier
- in: query
- name: online_identifier
- required: false
- type: string
- - description: Case insensitive search on eholding date_first_issue_online
- in: query
- name: date_first_issue_online
- required: false
- type: string
- - description: Case insensitive search on eholding num_first_vol_online
- in: query
- name: num_first_vol_online
- required: false
- type: string
- - description: Case insensitive search on eholding num_first_issue_online
- in: query
- name: num_first_issue_online
- required: false
- type: string
- - description: Case insensitive search on eholding date_last_issue_online
- in: query
- name: date_last_issue_online
- required: false
- type: string
- - description: Case insensitive search on eholding num_last_vol_online
- in: query
- name: num_last_vol_online
- required: false
- type: string
- - description: Case insensitive search on eholding num_last_issue_online
- in: query
- name: num_last_issue_online
- required: false
- type: string
- - description: Case insensitive search on eholding title_url
- in: query
- name: title_url
- required: false
- type: string
- - description: Case insensitive search on eholding first_author
- in: query
- name: first_author
- required: false
- type: string
- - description: Case insensitive search on eholding title_id
- in: query
- name: title_id
- required: false
- type: string
- - description: Case insensitive search on eholding embargo_info
- in: query
- name: embargo_info
- required: false
- type: string
- - description: Case insensitive search on eholding coverage_depth
- in: query
- name: coverage_depth
- required: false
- type: string
- - description: Case insensitive search on eholding notes
- in: query
- name: notes
- required: false
- type: string
- - description: Case insensitive search on eholding publisher_name
- in: query
- name: publisher_name
- required: false
- type: string
- - description: Case insensitive search on eholding publication_type
- in: query
- name: publication_type
- required: false
- type: string
- - description: Case insensitive search on eholding date_monograph_published_print
- in: query
- name: date_monograph_published_print
- required: false
- type: string
- - description: Case insensitive search on eholding date_monograph_published_online
- in: query
- name: date_monograph_published_online
- required: false
- type: string
- - description: Case insensitive search on eholding monograph_volume
- in: query
- name: monograph_volume
- required: false
- type: string
- - description: Case insensitive search on eholding monograph_edition
- in: query
- name: monograph_edition
- required: false
- type: string
- - description: Case insensitive search on eholding first_editor
- in: query
- name: first_editor
- required: false
- type: string
- - description: Case insensitive search on eholding parent_publication_title_id
- in: query
- name: parent_publication_title_id
- required: false
- type: string
- - description: Case insensitive search on eholding preceeding_publication_title_id
- in: query
- name: preceeding_publication_title_id
- required: false
- type: string
- - description: Case insensitive search on eholding access_type
- in: query
- name: access_type
- required: false
- type: string
- - $ref: "../swagger.yaml#/parameters/match"
- - $ref: "../swagger.yaml#/parameters/order_by"
- - $ref: "../swagger.yaml#/parameters/page"
- - $ref: "../swagger.yaml#/parameters/per_page"
- - $ref: "../swagger.yaml#/parameters/q_param"
- - $ref: "../swagger.yaml#/parameters/q_body"
- - $ref: "../swagger.yaml#/parameters/q_header"
- responses:
- 200:
- description: A list of eholding
- schema:
- items:
- $ref: "../swagger.yaml#/definitions/erm_eholding"
- type: array
- 403:
- description: Access forbidden
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- 500:
- description: |-
- Internal server error. Possible `error_code` attribute values:
- * `internal_server_error`
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- 503:
- description: Under maintenance
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- x-koha-authorization:
- permissions:
- erm: 1
- post:
- x-mojo-to: ERM::EHoldings#add
- operationId: addErmEHoldings
- tags:
- - eholding
- summary: Add eholding
- consumes:
- - application/json
- produces:
- - application/json
- parameters:
- - description: A JSON object containing information about the new eholding
- in: body
- name: body
- required: true
- schema:
- $ref: "../swagger.yaml#/definitions/erm_eholding"
- responses:
- 201:
- description: A successfully created eholding
- schema:
- items:
- $ref: "../swagger.yaml#/definitions/erm_eholding"
- 400:
- description: Bad parameter
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- 401:
- description: Authentication required
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- 403:
- description: Access forbidden
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- 404:
- description: Ressource not found
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- 409:
- description: Conflict in creating resource
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- 500:
- description: |-
- Internal server error. Possible `error_code` attribute values:
- * `internal_server_error`
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- 503:
- description: Under maintenance
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- x-koha-authorization:
- permissions:
- erm: 1
-"/erm/eholdings/{eholding_id}":
- get:
- x-mojo-to: ERM::EHoldings#get
- operationId: getErmEHoldings
- tags:
- - eholding
- summary: Get eholding
- produces:
- - application/json
- parameters:
- - $ref: "../swagger.yaml#/parameters/eholding_id_pp"
- responses:
- 200:
- description: Aneholding
- schema:
- items:
- $ref: "../swagger.yaml#/definitions/erm_eholding"
- 401:
- description: Authentication required
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- 403:
- description: Access forbidden
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- 404:
- description: Ressource not found
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- 500:
- description: |-
- Internal server error. Possible `error_code` attribute values:
- * `internal_server_error`
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- 503:
- description: Under maintenance
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- x-koha-authorization:
- permissions:
- erm: 1
- x-koha-embed:
- - eholding_packages
- - eholding_packages.package
- put:
- x-mojo-to: ERM::EHoldings#update
- operationId: updateErmEHoldings
- tags:
- - eholding
- summary: Update eholding
- consumes:
- - application/json
- produces:
- - application/json
- parameters:
- - $ref: "../swagger.yaml#/parameters/eholding_id_pp"
- - name: body
- in: body
- description: A JSON object containing new information about existing eholding
- required: true
- schema:
- $ref: "../swagger.yaml#/definitions/erm_eholding"
- responses:
- 200:
- description: A successfully updated eholding
- schema:
- items:
- $ref: "../swagger.yaml#/definitions/erm_eholding"
- 400:
- description: Bad parameter
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- 403:
- description: Access forbidden
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- 404:
- description: Ressource not found
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- 409:
- description: Conflict in updating resource
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- 500:
- description: |-
- Internal server error. Possible `error_code` attribute values:
- * `internal_server_error`
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- 503:
- description: Under maintenance
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- x-koha-authorization:
- permissions:
- erm: 1
- x-koha-embed:
- - eholding_packages
- - eholding_packages.package
- delete:
- x-mojo-to: ERM::EHoldings#delete
- operationId: deleteErmEHoldings
- tags:
- - eholding
- summary: Delete eholding
- produces:
- - application/json
- parameters:
- - $ref: "../swagger.yaml#/parameters/eholding_id_pp"
- responses:
- 204:
- description: eholding deleted
- 400:
- description: eholding deletion failed
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- 401:
- description: Authentication required
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- 403:
- description: Access forbidden
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- 404:
- description: Ressource not found
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- 409:
- description: Conflict in deleting resource
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- 500:
- description: |-
- Internal server error. Possible `error_code` attribute values:
- * `internal_server_error`
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- 503:
- description: Under maintenance
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- x-koha-authorization:
- permissions:
- erm: 1
--- /dev/null
+---
+/erm/eholdings/packages:
+ get:
+ x-mojo-to: ERM::EHoldings::Packages#list
+ operationId: listErmEHoldingsPackages
+ tags:
+ - eHoldings package
+ summary: List packages
+ produces:
+ - application/json
+ parameters:
+ - description: Case insensitive search on package package_id
+ in: query
+ name: package_id
+ required: false
+ type: integer
+ - description: Case insensitive search on package vendor_id
+ in: query
+ name: vendor_id
+ required: false
+ type: integer
+ - description: Case insensitive search on package name
+ in: query
+ name: name
+ required: false
+ type: string
+ - description: Case insensitive search on package external_package_id
+ in: query
+ name: external_package_id
+ required: false
+ type: integer
+ - description: Case insensitive search on package type
+ in: query
+ name: package_type
+ required: false
+ type: string
+ - description: Case insensitive search on package content_type
+ in: query
+ name: content_type
+ required: false
+ type: string
+ - description: Case insensitive search on package creation date
+ in: query
+ name: created_on
+ required: false
+ type: string
+ - $ref: "../swagger.yaml#/parameters/match"
+ - $ref: "../swagger.yaml#/parameters/order_by"
+ - $ref: "../swagger.yaml#/parameters/page"
+ - $ref: "../swagger.yaml#/parameters/per_page"
+ - $ref: "../swagger.yaml#/parameters/q_param"
+ - $ref: "../swagger.yaml#/parameters/q_body"
+ - $ref: "../swagger.yaml#/parameters/q_header"
+ responses:
+ 200:
+ description: A list of package
+ schema:
+ items:
+ $ref: "../swagger.yaml#/definitions/erm_eholdings_package"
+ type: array
+ 403:
+ description: Access forbidden
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ 500:
+ description: |-
+ Internal server error. Possible `error_code` attribute values:
+ * `internal_server_error`
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ 503:
+ description: Under maintenance
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ x-koha-authorization:
+ permissions:
+ erm: 1
+ post:
+ x-mojo-to: ERM::EHoldings::Packages#add
+ operationId: addErmEHoldingsPackages
+ tags:
+ - eHoldings package
+ summary: Add package
+ consumes:
+ - application/json
+ produces:
+ - application/json
+ parameters:
+ - description: A JSON object containing information about the new package
+ in: body
+ name: body
+ required: true
+ schema:
+ $ref: "../swagger.yaml#/definitions/erm_eholdings_package"
+ responses:
+ 201:
+ description: A successfully created package
+ schema:
+ items:
+ $ref: "../swagger.yaml#/definitions/erm_eholdings_package"
+ 400:
+ description: Bad parameter
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ 401:
+ description: Authentication required
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ 403:
+ description: Access forbidden
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ 404:
+ description: Ressource not found
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ 409:
+ description: Conflict in creating resource
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ 500:
+ description: |-
+ Internal server error. Possible `error_code` attribute values:
+ * `internal_server_error`
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ 503:
+ description: Under maintenance
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ x-koha-authorization:
+ permissions:
+ erm: 1
+"/erm/eholdings/packages/{package_id}":
+ get:
+ x-mojo-to: ERM::EHoldings::Packages#get
+ operationId: getErmEHoldingsPackages
+ tags:
+ - package
+ summary: Get eHoldings package
+ produces:
+ - application/json
+ parameters:
+ - $ref: "../swagger.yaml#/parameters/eholdings_package_id_pp"
+ responses:
+ 200:
+ description: A package
+ schema:
+ items:
+ $ref: "../swagger.yaml#/definitions/erm_eholdings_package"
+ 401:
+ description: Authentication required
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ 403:
+ description: Access forbidden
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ 404:
+ description: Ressource not found
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ 500:
+ description: |-
+ Internal server error. Possible `error_code` attribute values:
+ * `internal_server_error`
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ 503:
+ description: Under maintenance
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ x-koha-authorization:
+ permissions:
+ erm: 1
+ x-koha-embed:
+ - agreements
+ put:
+ x-mojo-to: ERM::EHoldings::Packages#update
+ operationId: updateErmEHoldingsPackages
+ tags:
+ - package
+ summary: Update eHoldings package
+ consumes:
+ - application/json
+ produces:
+ - application/json
+ parameters:
+ - $ref: "../swagger.yaml#/parameters/eholdings_package_id_pp"
+ - name: body
+ in: body
+ description: A JSON object containing new information about existing package
+ required: true
+ schema:
+ $ref: "../swagger.yaml#/definitions/erm_eholdings_package"
+ responses:
+ 200:
+ description: A successfully updated package
+ schema:
+ items:
+ $ref: "../swagger.yaml#/definitions/erm_eholdings_package"
+ 400:
+ description: Bad parameter
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ 403:
+ description: Access forbidden
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ 404:
+ description: Ressource not found
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ 409:
+ description: Conflict in updating resource
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ 500:
+ description: |-
+ Internal server error. Possible `error_code` attribute values:
+ * `internal_server_error`
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ 503:
+ description: Under maintenance
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ x-koha-authorization:
+ permissions:
+ erm: 1
+ x-koha-embed:
+ - agreements
+ delete:
+ x-mojo-to: ERM::EHoldings::Packages#delete
+ operationId: deleteErmEHoldingsPackages
+ tags:
+ - package
+ summary: Delete eHoldings package
+ produces:
+ - application/json
+ parameters:
+ - $ref: "../swagger.yaml#/parameters/eholdings_package_id_pp"
+ responses:
+ 204:
+ description: package deleted
+ 400:
+ description: package deletion failed
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ 401:
+ description: Authentication required
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ 403:
+ description: Access forbidden
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ 404:
+ description: Ressource not found
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ 409:
+ description: Conflict in deleting resource
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ 500:
+ description: |-
+ Internal server error. Possible `error_code` attribute values:
+ * `internal_server_error`
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ 503:
+ description: Under maintenance
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ x-koha-authorization:
+ permissions:
+ erm: 1
--- /dev/null
+---
+/erm/eholdings/titles:
+ get:
+ x-mojo-to: ERM::EHoldings::Titles#list
+ operationId: listErmEHoldingsTitles
+ tags:
+ - eholdings
+ summary: List eholdings titles
+ produces:
+ - application/json
+ parameters:
+ - description: Case insensitive search on title title_id
+ in: query
+ name: title_id
+ required: false
+ type: integer
+ - description: Case insensitive search on title vendor_id
+ in: query
+ name: vendor_id
+ required: false
+ type: integer
+ - description: Case insensitive search on title publication_title
+ in: query
+ name: publication_title
+ required: false
+ type: string
+ - description: Case insensitive search on title print_identifier
+ in: query
+ name: print_identifier
+ required: false
+ type: string
+ - description: Case insensitive search on title online_identifier
+ in: query
+ name: online_identifier
+ required: false
+ type: string
+ - description: Case insensitive search on title date_first_issue_online
+ in: query
+ name: date_first_issue_online
+ required: false
+ type: string
+ - description: Case insensitive search on title num_first_vol_online
+ in: query
+ name: num_first_vol_online
+ required: false
+ type: string
+ - description: Case insensitive search on title num_first_issue_online
+ in: query
+ name: num_first_issue_online
+ required: false
+ type: string
+ - description: Case insensitive search on title date_last_issue_online
+ in: query
+ name: date_last_issue_online
+ required: false
+ type: string
+ - description: Case insensitive search on title num_last_vol_online
+ in: query
+ name: num_last_vol_online
+ required: false
+ type: string
+ - description: Case insensitive search on title num_last_issue_online
+ in: query
+ name: num_last_issue_online
+ required: false
+ type: string
+ - description: Case insensitive search on title title_url
+ in: query
+ name: title_url
+ required: false
+ type: string
+ - description: Case insensitive search on title first_author
+ in: query
+ name: first_author
+ required: false
+ type: string
+ - description: Case insensitive search on title embargo_info
+ in: query
+ name: embargo_info
+ required: false
+ type: string
+ - description: Case insensitive search on title coverage_depth
+ in: query
+ name: coverage_depth
+ required: false
+ type: string
+ - description: Case insensitive search on title notes
+ in: query
+ name: notes
+ required: false
+ type: string
+ - description: Case insensitive search on title publisher_name
+ in: query
+ name: publisher_name
+ required: false
+ type: string
+ - description: Case insensitive search on title publication_type
+ in: query
+ name: publication_type
+ required: false
+ type: string
+ - description: Case insensitive search on title date_monograph_published_print
+ in: query
+ name: date_monograph_published_print
+ required: false
+ type: string
+ - description: Case insensitive search on title date_monograph_published_online
+ in: query
+ name: date_monograph_published_online
+ required: false
+ type: string
+ - description: Case insensitive search on title monograph_volume
+ in: query
+ name: monograph_volume
+ required: false
+ type: string
+ - description: Case insensitive search on title monograph_edition
+ in: query
+ name: monograph_edition
+ required: false
+ type: string
+ - description: Case insensitive search on title first_editor
+ in: query
+ name: first_editor
+ required: false
+ type: string
+ - description: Case insensitive search on title parent_publication_title_id
+ in: query
+ name: parent_publication_title_id
+ required: false
+ type: string
+ - description: Case insensitive search on title preceeding_publication_title_id
+ in: query
+ name: preceeding_publication_title_id
+ required: false
+ type: string
+ - description: Case insensitive search on title access_type
+ in: query
+ name: access_type
+ required: false
+ type: string
+ - $ref: "../swagger.yaml#/parameters/match"
+ - $ref: "../swagger.yaml#/parameters/order_by"
+ - $ref: "../swagger.yaml#/parameters/page"
+ - $ref: "../swagger.yaml#/parameters/per_page"
+ - $ref: "../swagger.yaml#/parameters/q_param"
+ - $ref: "../swagger.yaml#/parameters/q_body"
+ - $ref: "../swagger.yaml#/parameters/q_header"
+ responses:
+ 200:
+ description: A list of eHoldings titles
+ schema:
+ items:
+ $ref: "../swagger.yaml#/definitions/erm_eholdings_title"
+ type: array
+ 403:
+ description: Access forbidden
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ 500:
+ description: |-
+ Internal server error. Possible `error_code` attribute values:
+ * `internal_server_error`
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ 503:
+ description: Under maintenance
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ x-koha-authorization:
+ permissions:
+ erm: 1
+ post:
+ x-mojo-to: ERM::EHoldings::Titles#add
+ operationId: addErmEHoldingsTitles
+ tags:
+ - eholdings
+ summary: Add eholding
+ consumes:
+ - application/json
+ produces:
+ - application/json
+ parameters:
+ - description: A JSON object containing information about the new title
+ in: body
+ name: body
+ required: true
+ schema:
+ $ref: "../swagger.yaml#/definitions/erm_eholdings_title"
+ responses:
+ 201:
+ description: A successfully created title
+ schema:
+ items:
+ $ref: "../swagger.yaml#/definitions/erm_eholdings_title"
+ 400:
+ description: Bad parameter
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ 401:
+ description: Authentication required
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ 403:
+ description: Access forbidden
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ 404:
+ description: Ressource not found
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ 409:
+ description: Conflict in creating resource
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ 500:
+ description: |-
+ Internal server error. Possible `error_code` attribute values:
+ * `internal_server_error`
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ 503:
+ description: Under maintenance
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ x-koha-authorization:
+ permissions:
+ erm: 1
+"/erm/eholdings/titles/{title_id}":
+ get:
+ x-mojo-to: ERM::EHoldings::Titles#get
+ operationId: getErmEHoldingsTitles
+ tags:
+ - eholdings
+ summary: Get titles
+ produces:
+ - application/json
+ parameters:
+ - $ref: "../swagger.yaml#/parameters/eholdings_title_id_pp"
+ responses:
+ 200:
+ description: An eHolding title
+ schema:
+ items:
+ $ref: "../swagger.yaml#/definitions/erm_eholdings_title"
+ 401:
+ description: Authentication required
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ 403:
+ description: Access forbidden
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ 404:
+ description: Ressource not found
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ 500:
+ description: |-
+ Internal server error. Possible `error_code` attribute values:
+ * `internal_server_error`
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ 503:
+ description: Under maintenance
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ x-koha-authorization:
+ permissions:
+ erm: 1
+ x-koha-embed:
+ - resources
+ - resources.package
+ put:
+ x-mojo-to: ERM::EHoldings::Titles#update
+ operationId: updateErmEHoldingsTitles
+ tags:
+ - eholdings
+ summary: Update titles
+ consumes:
+ - application/json
+ produces:
+ - application/json
+ parameters:
+ - $ref: "../swagger.yaml#/parameters/eholdings_title_id_pp"
+ - name: body
+ in: body
+ description: A JSON object containing new information about existing title
+ required: true
+ schema:
+ $ref: "../swagger.yaml#/definitions/erm_eholdings_title"
+ responses:
+ 200:
+ description: A successfully updated title
+ schema:
+ items:
+ $ref: "../swagger.yaml#/definitions/erm_eholdings_title"
+ 400:
+ description: Bad parameter
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ 403:
+ description: Access forbidden
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ 404:
+ description: Ressource not found
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ 409:
+ description: Conflict in updating resource
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ 500:
+ description: |-
+ Internal server error. Possible `error_code` attribute values:
+ * `internal_server_error`
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ 503:
+ description: Under maintenance
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ x-koha-authorization:
+ permissions:
+ erm: 1
+ x-koha-embed:
+ - resources
+ - resources.package
+ delete:
+ x-mojo-to: ERM::EHoldings::Titles#delete
+ operationId: deleteErmEHoldingsTitles
+ tags:
+ - eholdings
+ summary: Delete eHolding title
+ produces:
+ - application/json
+ parameters:
+ - $ref: "../swagger.yaml#/parameters/eholdings_title_id_pp"
+ responses:
+ 204:
+ description: title deleted
+ 400:
+ description: title deletion failed
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ 401:
+ description: Authentication required
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ 403:
+ description: Access forbidden
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ 404:
+ description: Ressource not found
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ 409:
+ description: Conflict in deleting resource
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ 500:
+ description: |-
+ Internal server error. Possible `error_code` attribute values:
+ * `internal_server_error`
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ 503:
+ description: Under maintenance
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
+ x-koha-authorization:
+ permissions:
+ erm: 1
+++ /dev/null
----
-/erm/packages:
- get:
- x-mojo-to: ERM::Packages#list
- operationId: listErmPackages
- tags:
- - package
- summary: List packages
- produces:
- - application/json
- parameters:
- - description: Case insensitive search on package package_id
- in: query
- name: package_id
- required: false
- type: integer
- - description: Case insensitive search on package vendor_id
- in: query
- name: vendor_id
- required: false
- type: integer
- - description: Case insensitive search on package name
- in: query
- name: name
- required: false
- type: string
- - description: Case insensitive search on package external_package_id
- in: query
- name: external_package_id
- required: false
- type: integer
- - description: Case insensitive search on package type
- in: query
- name: package_type
- required: false
- type: string
- - description: Case insensitive search on package content_type
- in: query
- name: content_type
- required: false
- type: string
- - description: Case insensitive search on package creation date
- in: query
- name: created_on
- required: false
- type: string
- - $ref: "../swagger.yaml#/parameters/match"
- - $ref: "../swagger.yaml#/parameters/order_by"
- - $ref: "../swagger.yaml#/parameters/page"
- - $ref: "../swagger.yaml#/parameters/per_page"
- - $ref: "../swagger.yaml#/parameters/q_param"
- - $ref: "../swagger.yaml#/parameters/q_body"
- - $ref: "../swagger.yaml#/parameters/q_header"
- responses:
- 200:
- description: A list of package
- schema:
- items:
- $ref: "../swagger.yaml#/definitions/erm_package"
- type: array
- 403:
- description: Access forbidden
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- 500:
- description: |-
- Internal server error. Possible `error_code` attribute values:
- * `internal_server_error`
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- 503:
- description: Under maintenance
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- x-koha-authorization:
- permissions:
- erm: 1
- post:
- x-mojo-to: ERM::Packages#add
- operationId: addErmPackages
- tags:
- - package
- summary: Add package
- consumes:
- - application/json
- produces:
- - application/json
- parameters:
- - description: A JSON object containing information about the new package
- in: body
- name: body
- required: true
- schema:
- $ref: "../swagger.yaml#/definitions/erm_package"
- responses:
- 201:
- description: A successfully created package
- schema:
- items:
- $ref: "../swagger.yaml#/definitions/erm_package"
- 400:
- description: Bad parameter
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- 401:
- description: Authentication required
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- 403:
- description: Access forbidden
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- 404:
- description: Ressource not found
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- 409:
- description: Conflict in creating resource
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- 500:
- description: |-
- Internal server error. Possible `error_code` attribute values:
- * `internal_server_error`
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- 503:
- description: Under maintenance
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- x-koha-authorization:
- permissions:
- erm: 1
-"/erm/packages/{package_id}":
- get:
- x-mojo-to: ERM::Packages#get
- operationId: getErmPackages
- tags:
- - package
- summary: Get package
- produces:
- - application/json
- parameters:
- - $ref: "../swagger.yaml#/parameters/package_id_pp"
- responses:
- 200:
- description: Anpackage
- schema:
- items:
- $ref: "../swagger.yaml#/definitions/erm_package"
- 401:
- description: Authentication required
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- 403:
- description: Access forbidden
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- 404:
- description: Ressource not found
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- 500:
- description: |-
- Internal server error. Possible `error_code` attribute values:
- * `internal_server_error`
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- 503:
- description: Under maintenance
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- x-koha-authorization:
- permissions:
- erm: 1
- x-koha-embed:
- - agreements
- put:
- x-mojo-to: ERM::Packages#update
- operationId: updateErmPackages
- tags:
- - package
- summary: Update package
- consumes:
- - application/json
- produces:
- - application/json
- parameters:
- - $ref: "../swagger.yaml#/parameters/package_id_pp"
- - name: body
- in: body
- description: A JSON object containing new information about existing package
- required: true
- schema:
- $ref: "../swagger.yaml#/definitions/erm_package"
- responses:
- 200:
- description: A successfully updated package
- schema:
- items:
- $ref: "../swagger.yaml#/definitions/erm_package"
- 400:
- description: Bad parameter
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- 403:
- description: Access forbidden
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- 404:
- description: Ressource not found
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- 409:
- description: Conflict in updating resource
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- 500:
- description: |-
- Internal server error. Possible `error_code` attribute values:
- * `internal_server_error`
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- 503:
- description: Under maintenance
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- x-koha-authorization:
- permissions:
- erm: 1
- x-koha-embed:
- - agreements
- delete:
- x-mojo-to: ERM::Packages#delete
- operationId: deleteErmPackages
- tags:
- - package
- summary: Delete package
- produces:
- - application/json
- parameters:
- - $ref: "../swagger.yaml#/parameters/package_id_pp"
- responses:
- 204:
- description: package deleted
- 400:
- description: package deletion failed
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- 401:
- description: Authentication required
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- 403:
- description: Access forbidden
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- 404:
- description: Ressource not found
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- 409:
- description: Conflict in deleting resource
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- 500:
- description: |-
- Internal server error. Possible `error_code` attribute values:
- * `internal_server_error`
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- 503:
- description: Under maintenance
- schema:
- $ref: "../swagger.yaml#/definitions/error"
- x-koha-authorization:
- permissions:
- erm: 1
$ref: ./definitions/city.yaml
erm_agreement:
$ref: ./definitions/erm_agreement.yaml
- erm_eholding:
- $ref: ./definitions/erm_eholding.yaml
+ erm_eholdings_title:
+ $ref: ./definitions/erm_eholdings_title.yaml
erm_license:
$ref: ./definitions/erm_license.yaml
- erm_package:
- $ref: ./definitions/erm_package.yaml
+ erm_eholdings_package:
+ $ref: ./definitions/erm_eholdings_package.yaml
error:
$ref: ./definitions/error.yaml
fund:
$ref: ./paths/erm_agreements.yaml#/~1erm~1agreements
"/erm/agreements/{agreement_id}":
$ref: "./paths/erm_agreements.yaml#/~1erm~1agreements~1{agreement_id}"
- /erm/eholdings:
- $ref: ./paths/erm_eholdings.yaml#/~1erm~1eholdings
- "/erm/eholdings/{eholding_id}":
- $ref: "./paths/erm_eholdings.yaml#/~1erm~1eholdings~1{eholding_id}"
+ /erm/eholdings/titles:
+ $ref: ./paths/erm_eholdings_titles.yaml#/~1erm~1eholdings~1titles
+ "/erm/eholdings/titles/{title_id}":
+ $ref: "./paths/erm_eholdings_titles.yaml#/~1erm~1eholdings~1titles~1{title_id}"
+ /erm/eholdings/packages:
+ $ref: ./paths/erm_eholdings_packages.yaml#/~1erm~1eholdings~1packages
+ "/erm/eholdings/packages/{package_id}":
+ $ref: "./paths/erm_eholdings_packages.yaml#/~1erm~1eholdings~1packages~1{package_id}"
/erm/licenses:
$ref: ./paths/erm_licenses.yaml#/~1erm~1licenses
"/erm/licenses/{license_id}":
$ref: "./paths/erm_licenses.yaml#/~1erm~1licenses~1{license_id}"
- /erm/packages:
- $ref: ./paths/erm_packages.yaml#/~1erm~1packages
- "/erm/packages/{package_id}":
- $ref: "./paths/erm_packages.yaml#/~1erm~1packages~1{package_id}"
/erm/users:
$ref: ./paths/erm_users.yaml#/~1erm~1users
/holds:
name: club_id
required: true
type: integer
- eholding_id_pp:
- description: eHoldings internal identifier
+ eholdings_title_id_pp:
+ description: title internal identifier
in: path
- name: eholding_id
+ name: title_id
+ required: true
+ type: integer
+ eholdings_package_id_pp:
+ description: Package internal identifier
+ in: path
+ name: package_id
required: true
type: integer
fund_id_pp:
name: order_id
required: true
type: integer
- package_id_pp:
- description: Package internal identifier
- in: path
- name: package_id
- required: true
- type: integer
page:
description: "Page number, for paginated object listing"
in: query
it("List package", () => {
// GET package returns 500
- cy.intercept("GET", "/api/v1/erm/packages", {
+ cy.intercept("GET", "/api/v1/erm/eholdings/packages", {
statusCode: 500,
error: "Something went wrong",
});
);
// GET packages returns empty list
- cy.intercept("GET", "/api/v1/erm/packages*", []);
- cy.visit("/cgi-bin/koha/erm/packages");
+ cy.intercept("GET", "/api/v1/erm/eholdings/packages*", []);
+ cy.visit("/cgi-bin/koha/erm/eholdings/packages");
cy.get("#packages_list").contains("There are no packages defined.");
// GET packages returns something
let erm_package = get_package();
let packages = [erm_package];
- cy.intercept("GET", "/api/v1/erm/packages*", {
+ cy.intercept("GET", "/api/v1/erm/eholdings/packages*", {
statusCode: 200,
body: packages,
headers: {
"X-Total-Count": "1",
},
});
- cy.intercept("GET", "/api/v1/erm/packages/*", erm_package);
- cy.visit("/cgi-bin/koha/erm/packages");
+ cy.intercept("GET", "/api/v1/erm/eholdings/packages/*", erm_package);
+ cy.visit("/cgi-bin/koha/erm/eholdings/packages");
cy.get("#packages_list").contains("Showing 1 to 1 of 1 entries");
});
it("Add package", () => {
// Click the button in the toolbar
- cy.visit("/cgi-bin/koha/erm/packages");
+ cy.visit("/cgi-bin/koha/erm/eholdings/packages");
cy.contains("New package").click();
cy.get("#packages_add h2").contains("New package");
cy.get("#package_content_type").select(erm_package.content_type);
// Submit the form, get 500
- cy.intercept("POST", "/api/v1/erm/packages", {
+ cy.intercept("POST", "/api/v1/erm/eholdings/packages", {
statusCode: 500,
error: "Something went wrong",
});
);
// Submit the form, success!
- cy.intercept("POST", "/api/v1/erm/packages", {
+ cy.intercept("POST", "/api/v1/erm/eholdings/packages", {
statusCode: 201,
body: erm_package,
});
let erm_package = get_package();
let packages = [erm_package];
// Click the 'Edit' button from the list
- cy.intercept("GET", "/api/v1/erm/packages*", {
+ cy.intercept("GET", "/api/v1/erm/eholdings/packages*", {
statusCode: 200,
body: packages,
headers: {
"X-Total-Count": "1",
},
});
- cy.intercept("GET", "/api/v1/erm/packages/*", erm_package).as(
+ cy.intercept("GET", "/api/v1/erm/eholdings/packages/*", erm_package).as(
"get-package"
);
- cy.visit("/cgi-bin/koha/erm/packages");
+ cy.visit("/cgi-bin/koha/erm/eholdings/packages");
cy.get("#packages_list table tbody tr:first")
.contains("Edit")
.click();
cy.get("#package_content_type").should("have.value", erm_package.content_type);
// Submit the form, get 500
- cy.intercept("PUT", "/api/v1/erm/packages/*", {
+ cy.intercept("PUT", "/api/v1/erm/eholdings/packages/*", {
statusCode: 500,
error: "Something went wrong",
});
);
// Submit the form, success!
- cy.intercept("PUT", "/api/v1/erm/packages/*", {
+ cy.intercept("PUT", "/api/v1/erm/eholdings/packages/*", {
statusCode: 200,
body: erm_package,
});
let erm_package = get_package();
let packages = [erm_package];
// Click the "name" link from the list
- cy.intercept("GET", "/api/v1/erm/packages*", {
+ cy.intercept("GET", "/api/v1/erm/eholdings/packages*", {
statusCode: 200,
body: packages,
headers: {
"X-Total-Count": "1",
},
});
- cy.intercept("GET", "/api/v1/erm/packages/*", erm_package).as(
+ cy.intercept("GET", "/api/v1/erm/eholdings/packages/*", erm_package).as(
"get-package"
);
- cy.visit("/cgi-bin/koha/erm/packages");
+ cy.visit("/cgi-bin/koha/erm/eholdings/packages");
let name_link = cy.get(
"#packages_list table tbody tr:first td:first a"
);
let packages = [erm_package];
// Click the 'Delete' button from the list
- cy.intercept("GET", "/api/v1/erm/packages*", {
+ cy.intercept("GET", "/api/v1/erm/eholdings/packages*", {
statusCode: 200,
body: packages,
headers: {
"X-Total-Count": "1",
},
});
- cy.intercept("GET", "/api/v1/erm/packages/*", erm_package);
- cy.visit("/cgi-bin/koha/erm/packages");
+ cy.intercept("GET", "/api/v1/erm/eholdings/packages/*", erm_package);
+ cy.visit("/cgi-bin/koha/erm/eholdings/packages");
cy.get("#packages_list table tbody tr:first")
.contains("Delete")
cy.contains("Package name: " + erm_package.name);
// Submit the form, get 500
- cy.intercept("DELETE", "/api/v1/erm/packages/*", {
+ cy.intercept("DELETE", "/api/v1/erm/eholdings/packages/*", {
statusCode: 500,
error: "Something went wrong",
});
);
// Submit the form, success!
- cy.intercept("DELETE", "/api/v1/erm/packages/*", {
+ cy.intercept("DELETE", "/api/v1/erm/eholdings/packages/*", {
statusCode: 204,
body: null,
});
});
}
- unless ( TableExists('erm_packages') ) {
+ unless ( TableExists('erm_eholdings_packages') ) {
$dbh->do(q{
- CREATE TABLE `erm_packages` (
+ CREATE TABLE `erm_eholdings_packages` (
`package_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
`vendor_id` INT(11) DEFAULT NULL COMMENT 'foreign key to aqbooksellers',
`name` VARCHAR(255) NOT NULL COMMENT 'name of the package',
});
}
- unless ( TableExists('erm_packages_agreements') ) {
+ unless ( TableExists('erm_eholdings_packages_agreements') ) {
$dbh->do(q{
- CREATE TABLE `erm_packages_agreements` (
+ CREATE TABLE `erm_eholdings_packages_agreements` (
`package_id` INT(11) NOT NULL COMMENT 'link to the package',
`agreement_id` INT(11) NOT NULL COMMENT 'link to the agreement',
- CONSTRAINT `erm_packages_agreements_ibfk_1` FOREIGN KEY (`package_id`) REFERENCES `erm_packages` (`package_id`) ON DELETE CASCADE ON UPDATE CASCADE,
- CONSTRAINT `erm_packages_agreements_ibfk_2` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE
+ CONSTRAINT `erm_eholdings_packages_agreements_ibfk_1` FOREIGN KEY (`package_id`) REFERENCES `erm_eholdings_packages` (`package_id`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `erm_eholdings_packages_agreements_ibfk_2` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
});
}
- unless ( TableExists('erm_eholdings') ) {
+ unless ( TableExists('erm_eholdings_titles') ) {
$dbh->do(q{
- CREATE TABLE `erm_eholdings` (
- `eholding_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
+ CREATE TABLE `erm_eholdings_titles` (
+ `title_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
`vendor_id` INT(11) DEFAULT NULL,
`publication_title` VARCHAR(255) DEFAULT NULL,
`print_identifier` VARCHAR(255) DEFAULT NULL,
`num_last_issue_online` VARCHAR(255) DEFAULT NULL,
`title_url` VARCHAR(255) DEFAULT NULL,
`first_author` VARCHAR(255) DEFAULT NULL,
- `title_id` VARCHAR(255) DEFAULT NULL,
`embargo_info` VARCHAR(255) DEFAULT NULL,
`coverage_depth` VARCHAR(255) DEFAULT NULL,
`notes` VARCHAR(255) DEFAULT NULL,
`parent_publication_title_id` VARCHAR(255) DEFAULT NULL,
`preceeding_publication_title_id` VARCHAR(255) DEFAULT NULL,
`access_type` VARCHAR(255) DEFAULT NULL,
- CONSTRAINT `erm_eholdings_ibfk_1` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
- PRIMARY KEY(`eholding_id`)
+ CONSTRAINT `erm_eholdings_titles_ibfk_1` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
+ PRIMARY KEY(`title_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
});
}
- unless ( TableExists('erm_eholdings_packages') ) {
+ unless ( TableExists('erm_eholdings_resources') ) {
$dbh->do(q{
- CREATE TABLE `erm_eholdings_packages` (
- `eholding_id` INT(11) NOT NULL,
+ CREATE TABLE `erm_eholdings_resources` (
+ `resource_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
+ `title_id` INT(11) NOT NULL,
`package_id` INT(11) NOT NULL,
`started_on` DATE,
`ended_on` DATE,
`proxy` VARCHAR(80) DEFAULT NULL,
- CONSTRAINT `erm_eholdings_packages_ibfk_1` FOREIGN KEY (`eholding_id`) REFERENCES `erm_eholdings` (`eholding_id`) ON DELETE CASCADE ON UPDATE CASCADE,
- CONSTRAINT `erm_eholdings_packages_ibfk_2` FOREIGN KEY (`package_id`) REFERENCES `erm_packages` (`package_id`) ON DELETE CASCADE ON UPDATE CASCADE
+ CONSTRAINT `erm_eholdings_resources_ibfk_1` FOREIGN KEY (`title_id`) REFERENCES `erm_eholdings_titles` (`title_id`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `erm_eholdings_resources_ibfk_2` FOREIGN KEY (`package_id`) REFERENCES `erm_eholdings_packages` (`package_id`) ON DELETE CASCADE ON UPDATE CASCADE,
+ PRIMARY KEY(`resource_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
});
}
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
--- Table structure for table `erm_packages`
+-- Table structure for table `erm_eholdings_packages`
--
-DROP TABLE IF EXISTS `erm_packages`;
-CREATE TABLE `erm_packages` (
+DROP TABLE IF EXISTS `erm_eholdings_packages`;
+CREATE TABLE `erm_eholdings_packages` (
`package_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
`vendor_id` INT(11) DEFAULT NULL COMMENT 'foreign key to aqbooksellers',
`name` VARCHAR(255) NOT NULL COMMENT 'name of the package',
`package_type` VARCHAR(80) DEFAULT NULL COMMENT 'type of the package',
`content_type` VARCHAR(80) DEFAULT NULL COMMENT 'type of the package',
`created_on` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'date of creation of the package',
- CONSTRAINT `erm_packages_ibfk_1` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
+ CONSTRAINT `erm_eholdings_packages_ibfk_1` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
PRIMARY KEY(`package_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
--- Table structure for table `erm_packages_agreements`
+-- Table structure for table `erm_eholdings_packages_agreements`
--
-DROP TABLE IF EXISTS `erm_packages_agreements`;
-CREATE TABLE `erm_packages_agreements` (
+DROP TABLE IF EXISTS `erm_eholdings_packages_agreements`;
+CREATE TABLE `erm_eholdings_packages_agreements` (
`package_id` INT(11) NOT NULL COMMENT 'link to the package',
`agreement_id` INT(11) NOT NULL COMMENT 'link to the agreement',
- CONSTRAINT `erm_packages_agreements_ibfk_1` FOREIGN KEY (`package_id`) REFERENCES `erm_packages` (`package_id`) ON DELETE CASCADE ON UPDATE CASCADE,
- CONSTRAINT `erm_packages_agreements_ibfk_2` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE
+ CONSTRAINT `erm_eholdings_packages_agreements_ibfk_1` FOREIGN KEY (`package_id`) REFERENCES `erm_eholdings_packages` (`package_id`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `erm_eholdings_packages_agreements_ibfk_2` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
--- Table structure for table `erm_eholdings`
+-- Table structure for table `erm_eholdings_titles`
--
-DROP TABLE IF EXISTS `erm_eholdings`;
-CREATE TABLE `erm_eholdings` (
- `eholding_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
+DROP TABLE IF EXISTS `erm_eholdings_titles`;
+CREATE TABLE `erm_eholdings_titles` (
+ `title_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
`vendor_id` INT(11) DEFAULT NULL,
`publication_title` VARCHAR(255) DEFAULT NULL,
`print_identifier` VARCHAR(255) DEFAULT NULL,
`num_last_issue_online` VARCHAR(255) DEFAULT NULL,
`title_url` VARCHAR(255) DEFAULT NULL,
`first_author` VARCHAR(255) DEFAULT NULL,
- `title_id` VARCHAR(255) DEFAULT NULL,
`embargo_info` VARCHAR(255) DEFAULT NULL,
`coverage_depth` VARCHAR(255) DEFAULT NULL,
`notes` VARCHAR(255) DEFAULT NULL,
`parent_publication_title_id` VARCHAR(255) DEFAULT NULL,
`preceeding_publication_title_id` VARCHAR(255) DEFAULT NULL,
`access_type` VARCHAR(255) DEFAULT NULL,
- CONSTRAINT `erm_eholdings_ibfk_1` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
- PRIMARY KEY(`eholding_id`)
+ CONSTRAINT `erm_eholdings_titles_ibfk_1` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
+ PRIMARY KEY(`title_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
--- Table structure for table `erm_eholdings_packages`
+-- Table structure for table `erm_eholdings_resources`
--
-DROP TABLE IF EXISTS `erm_eholdings_packages`;
-CREATE TABLE `erm_eholdings_packages` (
- `eholding_id` INT(11) NOT NULL,
+DROP TABLE IF EXISTS `erm_eholdings_resources`;
+CREATE TABLE `erm_eholdings_resources` (
+ `resource_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
+ `title_id` INT(11) NOT NULL,
`package_id` INT(11) NOT NULL,
`started_on` DATE,
`ended_on` DATE,
`proxy` VARCHAR(80) DEFAULT NULL,
- CONSTRAINT `erm_eholdings_packages_ibfk_1` FOREIGN KEY (`eholding_id`) REFERENCES `erm_eholdings` (`eholding_id`) ON DELETE CASCADE ON UPDATE CASCADE,
- CONSTRAINT `erm_eholdings_packages_ibfk_2` FOREIGN KEY (`package_id`) REFERENCES `erm_packages` (`package_id`) ON DELETE CASCADE ON UPDATE CASCADE
+ CONSTRAINT `erm_eholdings_resources_ibfk_1` FOREIGN KEY (`title_id`) REFERENCES `erm_eholdings_titles` (`title_id`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `erm_eholdings_resources_ibfk_2` FOREIGN KEY (`package_id`) REFERENCES `erm_eholdings_packages` (`package_id`) ON DELETE CASCADE ON UPDATE CASCADE,
+ PRIMARY KEY(`resource_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
const package_types = [% To.json(AuthorisedValues.Get('ERM_PACKAGE_TYPE')) | $raw %];
const package_content_types = [% To.json(AuthorisedValues.Get('ERM_PACKAGE_CONTENT_TYPE')) | $raw %];
- var package_table_settings = [% TablesSettings.GetTableSettings( 'erm', 'packages', 'packages', 'json' ) | $raw %];
+ var eholdings_packages_table_settings = [% TablesSettings.GetTableSettings( 'erm', 'eholdings', 'packages', 'json' ) | $raw %];
- var packages_table_url = '/api/v1/erm/packages?';
- [% IF package_name_filter %]
- var package_name_filter = {
+ var eholdings_packages_table_url = '/api/v1/erm/eholdings/packages?';
+ [% IF eholdings_package_name_filter %]
+ var eholdings_package_name_filter = {
'name': {
- "like": '%[%- package_name_filter | html -%]%'
+ "like": '%[%- eholdings_package_name_filter | html -%]%'
}
};
- packages_table_url += 'q='+ encodeURIComponent(JSON.stringify(package_name_filter));
+ eholdings_packages_table_url += 'q='+ encodeURIComponent(JSON.stringify(eholdings_package_name_filter));
[% END %]
- var eholding_table_settings = [% TablesSettings.GetTableSettings( 'erm', 'eholdings', 'eholdings', 'json' ) | $raw %];
+ var eholdings_titles_table_settings = [% TablesSettings.GetTableSettings( 'erm', 'eholdings', 'titles', 'json' ) | $raw %];
- var eholdings_table_url = '/api/v1/erm/eholdings?';
- [% IF eholding_name_filter %]
- var eholding_name_filter = {
+ var eholdings_titles_table_url = '/api/v1/erm/eholdings/titles?';
+ [% IF eholdings_title_name_filter %]
+ var eholdings_title_name_filter = {
'name': {
- "like": '%[%- eholding_name_filter | html -%]%'
+ "like": '%[%- eholdings_title_name_filter | html -%]%'
}
};
- eholdings_table_url += 'q='+ encodeURIComponent(JSON.stringify(eholding_name_filter));
+ eholdings_titles_table_url += 'q='+ encodeURIComponent(JSON.stringify(eholding_title_name_filter));
[% END %]
</script>
+++ /dev/null
-<template>
- <fieldset class="rows" id="eholding_packages">
- <legend>{{ $t("Packages") }}</legend>
- <fieldset
- class="rows"
- v-for="(eholding_package, counter) in eholding_packages"
- v-bind:key="counter"
- >
- <legend>
- {{ $t("Package.counter", { counter: counter + 1 }) }}
- <a href="#" @click.prevent="deletePackage(counter)"
- ><i class="fa fa-trash"></i>
- {{ $t("Remove from this package") }}</a
- >
- </legend>
- <ol>
- <li>
- <label
- :for="`eholding_package_id_${counter}`"
- class="required"
- >{{ $t("Package") }}:
- </label>
- <select
- v-model="eholding_package.package_id"
- :id="`eholding_package_id_${counter}`"
- required
- >
- <option value=""></option>
- <option
- v-for="p in packages"
- :key="p.package_id"
- :value="p.package_id"
- :selected="
- p.package_id == eholding_package.package_id
- ? true
- : false
- "
- >
- {{ p.name }}
- </option>
- </select>
- <span class="required">{{ $t("Required") }}</span>
- </li>
- <li>
- <label :for="`started_on_${counter}`"
- >{{ $t("Start date") }}:
- </label>
- <flat-pickr
- :id="`started_on_${counter}`"
- v-model="eholding_package.started_on"
- :config="fp_config"
- :data-date_to="`ended_on_${counter}`"
- />
- </li>
- <li>
- <label :for="`ended_on_${counter}`"
- >{{ $t("End date") }}:</label
- >
- <flat-pickr
- :id="`ended_on_${counter}`"
- v-model="eholding_package.ended_on"
- :config="fp_config"
- />
- </li>
- <li>
- <label :for="`${counter}`">{{ $t("Proxy") }}:</label>
- <input
- :id="`proxy_${counter}`"
- v-model="eholding_package.proxy"
- :placeholder="$t('Proxy')"
- />
- </li>
- </ol>
- </fieldset>
- <a v-if="packages.length" class="btn btn-default" @click="addPackage"
- ><font-awesome-icon icon="plus" />
- {{ $t("Add to another package") }}</a
- >
- <span v-else>{{ $t("There are no packages created yet") }}</span>
- </fieldset>
-</template>
-
-<script>
-import flatPickr from 'vue-flatpickr-component'
-import { fetchPackages } from "../../fetch"
-
-export default {
- data() {
- return {
- packages: [],
- fp_config: flatpickr_defaults,
- dates_fixed: 0,
- }
- },
- beforeCreate() {
- fetchPackages().then((packages) => this.packages = packages)
- },
- methods: {
- addPackage() {
- this.eholding_packages.push({
- package_id: null,
- started_on: null,
- ended_on: null,
- proxy: '',
- })
- },
- deletePackage(counter) {
- this.eholding_packages.splice(counter, 1)
- },
- },
- props: {
- eholding_packages: Array,
- },
- components: { flatPickr },
- name: 'EHoldingPackages',
-}
-</script>
+++ /dev/null
-<template>
- <div v-if="!initialized">{{ $t("Loading") }}</div>
- <div v-else id="eholdings_add">
- <h2 v-if="eholding.eholding_id">
- {{ $t("Edit eHolding.id", { id: eholding.eholding_id }) }}
- </h2>
- <h2 v-else>{{ $t("New eHolding") }}</h2>
- <div>
- <form @submit="onSubmit($event)">
- <fieldset class="rows">
- <ol>
- <li>
- <label class="required" for="eholding_name"
- >{{ $t("Publication title") }}:</label
- >
- <input
- id="eholding_publication_title"
- v-model="eholding.publication_title"
- :placeholder="$t('Publication title')"
- required
- />
- <span class="required">{{ $t("Required") }}</span>
- </li>
-
- <li>
- <label for="eholding_vendor_id"
- >{{ $t("Vendor") }}:</label
- >
- <select
- id="eholding_vendor_id"
- v-model="eholding.vendor_id"
- >
- <option value=""></option>
- <option
- v-for="vendor in vendors"
- :key="vendor.vendor_id"
- :value="vendor.id"
- :selected="
- vendor.id == eholding.vendor_id
- ? true
- : false
- "
- >
- {{ vendor.name }}
- </option>
- </select>
- </li>
-
- <li>
- <label for="eholding_print_identifier"
- >{{ $t("Print-format identifier") }}:</label
- >
- <input
- id="eholding_print_identifier"
- v-model="eholding.print_identifier"
- :placeholder="$t('Print-format identifier')"
- />
- </li>
-
- <li>
- <label for="eholding_online_identifier"
- >{{ $t("Online-format identifier") }}:</label
- >
- <input
- id="eholding_online_identifier"
- v-model="eholding.online_identifier"
- :placeholder="$t('Online-format identifier')"
- />
- </li>
-
- <li>
- <label for="eholding_date_first_issue_online"
- >{{
- $t(
- "Date of first serial issue available online"
- )
- }}:</label
- >
- <input
- id="eholding_date_first_issue_online"
- v-model="eholding.date_first_issue_online"
- :placeholder="
- $t(
- 'Date of first serial issue available online'
- )
- "
- />
- </li>
-
- <li>
- <label for="eholding_num_first_vol_online"
- >{{
- $t(
- "Number of first volume available online"
- )
- }}:</label
- >
- <input
- id="eholding_num_first_vol_online"
- v-model="eholding.num_first_vol_online"
- :placeholder="
- $t(
- 'Number of first volume available online'
- )
- "
- />
- </li>
-
- <li>
- <label for="eholding_num_first_issue_online"
- >{{
- $t(
- "Number of first issue available online"
- )
- }}:</label
- >
- <input
- id="eholding_num_first_issue_online"
- v-model="eholding.num_first_issue_online"
- :placeholder="
- $t('Number of first issue available online')
- "
- />
- </li>
-
- <li>
- <label for="eholding_date_last_issue_online"
- >{{
- $t("Date of last issue available online")
- }}:</label
- >
- <input
- id="eholding_date_last_issue_online"
- v-model="eholding.date_last_issue_online"
- :placeholder="
- $t('Date of last issue available online')
- "
- />
- </li>
-
- <li>
- <label for="eholding_num_last_vol_online"
- >{{
- $t(
- "Number of last volume available online"
- )
- }}:</label
- >
- <input
- id="eholding_num_last_vol_online"
- v-model="eholding.num_last_vol_online"
- :placeholder="
- $t('Number of last volume available online')
- "
- />
- </li>
-
- <li>
- <label for="eholding_num_last_issue_online"
- >{{
- $t("Number of last issue available online")
- }}:</label
- >
- <input
- id="eholding_num_last_issue_online"
- v-model="eholding.num_last_issue_online"
- :placeholder="
- $t('Number of last issue available online')
- "
- />
- </li>
-
- <li>
- <label for="eholding_title_url"
- >{{ $t("Title-level URL") }}:</label
- >
- <input
- id="eholding_title_url"
- v-model="eholding.title_url"
- :placeholder="$t('Title-level URL')"
- />
- </li>
-
- <li>
- <label for="eholding_first_author"
- >{{ $t("First author") }}:</label
- >
- <input
- id="eholding_first_author"
- v-model="eholding.first_author"
- :placeholder="$t('First author')"
- />
- </li>
-
- <li>
- <label for="eholding_title_id"
- >{{ $t("Title identifier") }}:</label
- >
- <input
- id="eholding_title_id"
- v-model="eholding.title_id"
- :placeholder="$t('Title identifier')"
- />
- </li>
-
- <li>
- <label for="eholding_embargo_info"
- >{{ $t("Embargo information") }}:</label
- >
- <input
- id="eholding_embargo_info"
- v-model="eholding.embargo_info"
- :placeholder="$t('Embargo information')"
- />
- </li>
-
- <li>
- <label for="eholding_coverage_depth"
- >{{ $t("Coverage depth") }}:</label
- >
- <input
- id="eholding_coverage_depth"
- v-model="eholding.coverage_depth"
- :placeholder="$t('Coverage depth')"
- />
- </li>
-
- <li>
- <label for="eholding_notes"
- >{{ $t("Notes") }}:</label
- >
- <input
- id="eholding_notes"
- v-model="eholding.notes"
- :placeholder="$t('Notes')"
- />
- </li>
-
- <li>
- <label for="eholding_publisher_name"
- >{{ $t("Publisher name") }}:</label
- >
- <input
- id="eholding_publisher_name"
- v-model="eholding.publisher_name"
- :placeholder="$t('Publisher name')"
- />
- </li>
-
- <li>
- <label for="eholding_publication_type"
- >{{ $t("Publication type") }}:</label
- >
- <input
- id="eholding_publication_type"
- v-model="eholding.publication_type"
- :placeholder="$t('Publication type')"
- />
- </li>
-
- <li>
- <label for="eholding_date_monograph_published_print"
- >{{
- $t(
- "Date the monograph is first published in print"
- )
- }}:</label
- >
- <input
- id="eholding_date_monograph_published_print"
- v-model="
- eholding.date_monograph_published_print
- "
- :placeholder="
- $t(
- 'Date the monograph is first published in print'
- )
- "
- />
- </li>
-
- <li>
- <label
- for="eholding_date_monograph_published_online"
- >{{
- $t(
- "Date the monograph is first published online"
- )
- }}:</label
- >
- <input
- id="eholding_date_monograph_published_online"
- v-model="
- eholding.date_monograph_published_online
- "
- :placeholder="
- $t(
- 'Date the monograph is first published online'
- )
- "
- />
- </li>
-
- <li>
- <label for="eholding_monograph_volume"
- >{{
- $t("Number of volume for monograph")
- }}:</label
- >
- <input
- id="eholding_monograph_volume"
- v-model="eholding.monograph_volume"
- :placeholder="
- $t('Number of volume for monograph')
- "
- />
- </li>
-
- <li>
- <label for="eholding_monograph_edition"
- >{{ $t("Edition of the monograph") }}:</label
- >
- <input
- id="eholding_monograph_edition"
- v-model="eholding.monograph_edition"
- :placeholder="$t('Edition of the monograph')"
- />
- </li>
-
- <li>
- <label for="eholding_first_editor"
- >{{ $t("First editor") }}:</label
- >
- <input
- id="eholding_first_editor"
- v-model="eholding.first_editor"
- :placeholder="$t('First editor')"
- />
- </li>
-
- <li>
- <label for="eholding_parent_publication_title_id"
- >{{
- $t(
- "Title identifier of the parent publication"
- )
- }}:</label
- >
- <input
- id="eholding_parent_publication_title_id"
- v-model="eholding.parent_publication_title_id"
- :placeholder="
- $t(
- 'Title identifier of the parent publication'
- )
- "
- />
- </li>
-
- <li>
- <label
- for="eholding_preceeding_publication_title_id"
- >{{
- $t(
- "Title identifier of any preceding publication title"
- )
- }}:</label
- >
- <input
- id="eholding_preceeding_publication_title_id"
- v-model="
- eholding.preceeding_publication_title_id
- "
- :placeholder="
- $t(
- 'Title identifier of any preceding publication title'
- )
- "
- />
- </li>
-
- <li>
- <label for="eholding_access_type"
- >{{
- // FIXME May be fee-based (P) or Open Access (F).
- $t("Access type")
- }}:</label
- >
- <input
- id="eholding_access_type"
- v-model="eholding.access_type"
- :placeholder="$t('Access type')"
- />
- </li>
-
- <EHoldingPackages
- :eholding_packages="eholding.eholding_packages"
- />
- </ol>
- </fieldset>
- <fieldset class="action">
- <input type="submit" value="Submit" />
- <router-link
- to="/cgi-bin/koha/erm/eholdings"
- role="button"
- class="cancel"
- >{{ $t("Cancel") }}</router-link
- >
- </fieldset>
- </form>
- </div>
- </div>
-</template>
-
-<script>
-import { useVendorStore } from "../../stores/vendors"
-import EHoldingPackages from "./EHoldingPackages.vue"
-import { setMessage, setError } from "../../messages"
-import { fetchEHolding } from '../../fetch'
-import { storeToRefs } from "pinia"
-
-export default {
- setup() {
- const vendorStore = useVendorStore()
- const { vendors } = storeToRefs(vendorStore)
-
- return {
- vendors,
- }
- },
- data() {
- return {
- eholding: {
- eholding_id: null,
- vendor_id: null,
- publication_title: '',
- print_identifier: '',
- online_identifier: '',
- date_first_issue_online: '',
- num_first_vol_online: '',
- num_first_issue_online: '',
- date_last_issue_online: '',
- num_last_vol_online: '',
- num_last_issue_online: '',
- title_url: '',
- first_author: '',
- title_id: '',
- embargo_info: '',
- coverage_depth: '',
- notes: '',
- publisher_name: '',
- publication_type: '',
- date_monograph_published_print: '',
- date_monograph_published_online: '',
- monograph_volume: '',
- monograph_edition: '',
- first_editor: '',
- parent_publication_title_id: '',
- preceeding_publication_title_id: '',
- access_type: '',
- eholding_packages: [],
- },
- initialized: false,
- }
- },
- beforeRouteEnter(to, from, next) {
- next(vm => {
- if (to.params.eholding_id) {
- vm.eholding = vm.getEHolding(to.params.eholding_id)
- } else {
- vm.initialized = true
- }
- })
- },
- methods: {
- async getEHolding(eholding_id) {
- const eholding = await fetchEHolding(eholding_id)
- this.eholding = eholding
- this.initialized = true
- },
- onSubmit(e) {
- e.preventDefault()
-
- let eholding = JSON.parse(JSON.stringify(this.eholding)) // copy
- let apiUrl = '/api/v1/erm/eholdings'
-
- let method = 'POST'
- if (eholding.eholding_id) {
- method = 'PUT'
- apiUrl += '/' + eholding.eholding_id
- }
- delete eholding.eholding_id
-
- // Cannot use the map/keepAttrs because of the reserved keywork 'package'
- eholding.eholding_packages.forEach(function (e) { delete e.package })
-
- const options = {
- method: method,
- body: JSON.stringify(eholding),
- headers: {
- 'Content-Type': 'application/json;charset=utf-8'
- },
- }
-
- fetch(apiUrl, options)
- .then(response => {
- if (response.status == 200) {
- this.$router.push("/cgi-bin/koha/erm/eholdings")
- setMessage(this.$t("EHolding updated"))
- } else if (response.status == 201) {
- this.$router.push("/cgi-bin/koha/erm/eholdings")
- setMessage(this.$t("EHolding created"))
- } else {
- setError(response.message || response.statusText)
- }
- }, (error) => {
- setError(error)
- }).catch(e => { console.log(e) })
- },
- },
- components: { EHoldingPackages },
- name: "EHoldingsFormAdd",
-}
-</script>
-<style scoped>
-fieldset.rows label {
- width: 25rem;
-}
-</style>
\ No newline at end of file
+++ /dev/null
-<template>
- <div v-if="!initialized">{{ $t("Loading") }}</div>
- <div v-else id="eholdings_confirm_delete">
- <h2>{{ $t("Delete eHolding") }}</h2>
- <div>
- <form @submit="onSubmit($event)">
- <fieldset class="rows">
- <ol>
- <li>
- {{ $t("eHolding title") }}:
- {{ eholding.publication_title }}
- </li>
- </ol>
- </fieldset>
- <fieldset class="action">
- <input
- type="submit"
- variant="primary"
- :value="$t('Yes, delete')"
- />
- <router-link
- to="/cgi-bin/koha/erm/eholdings"
- role="button"
- class="cancel"
- >{{ $t("No, do not delete") }}</router-link
- >
- </fieldset>
- </form>
- </div>
- </div>
-</template>
-
-<script>
-import { fetchEHolding } from "../../fetch"
-import { setMessage, setError } from "../../messages"
-
-export default {
- data() {
- return {
- eholding: {},
- initialized: false,
- }
- },
- beforeRouteEnter(to, from, next) {
- next(vm => {
- vm.getEHolding(to.params.eholding_id)
- })
- },
- methods: {
- async getEHolding(eholding_id) {
- const eholding = await fetchEHolding(eholding_id)
- this.eholding = eholding
- this.initialized = true
- },
- onSubmit(e) {
- e.preventDefault()
-
- let apiUrl = '/api/v1/erm/eholdings/' + this.eholding.eholding_id
-
- const options = {
- method: 'DELETE',
- headers: {
- 'Content-Type': 'application/json;charset=utf-8'
- },
- }
-
- fetch(apiUrl, options)
- .then(
- (response) => {
- if (response.status == 204) {
- setMessage(this.$t("eHolding deleted"))
- this.$router.push("/cgi-bin/koha/erm/eholdings")
- } else {
- setError(response.message || response.statusText)
- }
- }
- ).catch(
- (error) => {
- setError(error)
- }
- )
- }
- },
- name: "EHoldingsFormConfirmDelete",
-}
-</script>
+++ /dev/null
-<template>
- <div v-if="!this.initialized">{{ $t("Loading") }}</div>
- <div v-else-if="this.eholdings" id="eholdings_list">
- <Toolbar />
- <table v-if="this.eholdings.length" id="eholding_list"></table>
- <div v-else-if="this.initialized" class="dialog message">
- {{ $t("There are no eHoldings defined") }}
- </div>
- </div>
-</template>
-
-<script>
-import Toolbar from "./EHoldingsToolbar.vue"
-import { createVNode, render } from 'vue'
-import { useVendorStore } from "../../stores/vendors"
-import { storeToRefs } from "pinia"
-import { fetchEHoldings } from "../../fetch"
-
-export default {
- setup() {
- const vendorStore = useVendorStore()
- const { vendors } = storeToRefs(vendorStore)
-
- return {
- vendors,
- }
- },
- data: function () {
- return {
- eholdings: [],
- initialized: false,
- }
- },
- beforeRouteEnter(to, from, next) {
- next(vm => {
- vm.getEHoldings()
- })
- },
- methods: {
- async getEHoldings() {
- const eholdings = await fetchEHoldings()
- this.eholdings = eholdings
- console.log(this.eholdings)
- this.initialized = true
- },
- show_eholding: function (eholding_id) {
- this.$router.push("/cgi-bin/koha/erm/eholdings/" + eholding_id)
- },
- edit_eholding: function (eholding_id) {
- this.$router.push("/cgi-bin/koha/erm/eholdings/edit/" + eholding_id)
- },
- delete_eholding: function (eholding_id) {
- this.$router.push("/cgi-bin/koha/erm/eholdings/delete/" + eholding_id)
- },
- },
- updated() {
- let show_eholding = this.show_eholding
- let edit_eholding = this.edit_eholding
- let delete_eholding = this.delete_eholding
-
- window['vendors'] = this.vendors.map(e => {
- e['_id'] = e['id']
- e['_str'] = e['name']
- return e
- })
- let vendors_map = this.vendors.reduce((map, e) => {
- map[e.id] = e
- return map
- }, {})
-
- $('#eholding_list').kohaTable({
- "ajax": {
- "url": eholdings_table_url,
- },
- "order": [[0, "asc"]],
- "columnDefs": [{
- "targets": [1],
- "render": function (data, type, row, meta) {
- if (type == 'display') {
- return escape_str(data)
- }
- return data
- }
- }],
- "columns": [
- {
- "title": __("Title"),
- "data": ["me.eholding_id", "me.publication_title"],
- "searchable": true,
- "orderable": true,
- // Rendering done in drawCallback
- },
- {
- "title": __("Vendor"),
- "data": "vendor_id",
- "searchable": true,
- "orderable": true,
- "render": function (data, type, row, meta) {
- return row.vendor_id != undefined ? escape_str(vendors_map[row.vendor_id].name) : ""
- }
- },
- {
- "title": __("Publication type"),
- "data": "publication_type",
- "searchable": true,
- "orderable": true,
- },
- {
- "title": __("Identifier"),
- "data": ["print_identifier", "online_identifier"],
- "searchable": true,
- "orderable": true,
- "render": function (data, type, row, meta) {
- let print_identifier = row.print_identifier
- let online_identifier = row.online_identifier
- return (print_identifier ? escape_str(_("ISBN (Print): %s").format(print_identifier)) : "") +
- (online_identifier ? escape_str(_("ISBN (Online): %s").format(online_identifier)) : "")
- }
- },
- {
- "title": __("Actions"),
- "data": function (row, type, val, meta) {
- return '<div class="actions"></div>'
- },
- "className": "actions noExport",
- "searchable": false,
- "orderable": false
- }
- ],
- drawCallback: function (settings) {
-
- var api = new $.fn.dataTable.Api(settings)
-
- $.each($(this).find("td .actions"), function (index, e) {
- let eholding_id = api.row(index).data().eholding_id
- let editButton = createVNode("a", {
- class: "btn btn-default btn-xs", role: "button", onClick: () => {
- edit_eholding(eholding_id)
- }
- },
- [createVNode("i", { class: "fa fa-pencil", 'aria-hidden': "true" }), __("Edit")])
-
- let deleteButton = createVNode("a", {
- class: "btn btn-default btn-xs", role: "button", onClick: () => {
- delete_eholding(eholding_id)
- }
- },
- [createVNode("i", { class: "fa fa-trash", 'aria-hidden': "true" }), __("Delete")])
-
- let n = createVNode('span', {}, [editButton, " ", deleteButton])
- render(n, e)
- })
-
- $.each($(this).find("tbody tr td:first-child"), function (index, e) {
- let row = api.row(index).data()
- if (!row) return // Happen if the table is empty
- let n = createVNode("a", {
- role: "button",
- onClick: () => {
- show_eholding(row.eholding_id)
- }
- },
- `${row.publication_title} (#${row.eholding_id})`
- )
- render(n, e)
- })
- },
- preDrawCallback: function (settings) {
- var table_id = settings.nTable.id
- $("#" + table_id).find("thead th").eq(1).attr('data-filter', 'vendors')
- }
- }, eholding_table_settings, 1)
- },
- beforeUnmount() {
- $('#eholding_list')
- .DataTable()
- .destroy(true)
- },
- components: { Toolbar },
- name: "EHoldingsList",
-}
-</script>
--- /dev/null
+<template>
+ <fieldset class="rows" id="package_agreements">
+ <legend>{{ $t("Agreements") }}</legend>
+ <fieldset
+ class="rows"
+ v-for="(package_agreement, counter) in package_agreements"
+ v-bind:key="counter"
+ >
+ <legend>
+ {{ $t("Agreement.counter", { counter: counter + 1 }) }}
+ <a href="#" @click.prevent="deleteAgreement(counter)"
+ ><i class="fa fa-trash"></i>
+ {{ $t("Remove this agreement") }}</a
+ >
+ </legend>
+ <ol>
+ <li>
+ <label :for="`agreement_id_${counter}`"
+ >{{ $t("Agreement") }}:
+ </label>
+ <select
+ v-model="package_agreement.agreement_id"
+ :id="`agreement_id_${counter}`"
+ required
+ >
+ <option value=""></option>
+ <option
+ v-for="agreement in agreements"
+ :key="agreement.agreement_id"
+ :value="agreement.agreement_id"
+ :selected="
+ agreement.agreement_id ==
+ package_agreement.agreement_id
+ ? true
+ : false
+ "
+ >
+ {{ agreement.name }}
+ </option>
+ </select>
+ <span class="required">{{ $t("Required") }}</span>
+ </li>
+ </ol>
+ </fieldset>
+ <a
+ v-if="agreements.length"
+ class="btn btn-default"
+ @click="addAgreement"
+ ><font-awesome-icon icon="plus" /> {{ $t("Add new agreement") }}</a
+ >
+ <span v-else>{{ $t("There are no agreements created yet") }}</span>
+ </fieldset>
+</template>
+
+<script>
+import { fetchAgreements } from "../../fetch"
+
+export default {
+ data() {
+ return {
+ agreements: [],
+ }
+ },
+ beforeCreate() {
+ fetchAgreements().then((agreements) => {
+ this.agreements = agreements
+ })
+ },
+ methods: {
+ addAgreement() {
+ this.package_agreements.push({
+ agreement_id: null,
+ })
+ },
+ deleteAgreement(counter) {
+ this.package_agreements.splice(counter, 1)
+ },
+ },
+ props: {
+ package_agreements: Array,
+ },
+ name: 'EHoldingsPackageAgreements',
+}
+</script>
\ No newline at end of file
--- /dev/null
+<template>
+ <div v-if="!this.initialized">{{ $t("Loading") }}</div>
+ <div v-else id="packages_add">
+ <h2 v-if="erm_package.package_id">
+ {{ $t("Edit package.id", { id: erm_package.package_id }) }}
+ </h2>
+ <h2 v-else>{{ $t("New package") }}</h2>
+ <div>
+ <form @submit="onSubmit($event)">
+ <fieldset class="rows">
+ <ol>
+ <li>
+ <label class="required" for="package_name"
+ >{{ $t("Package name") }}:</label
+ >
+ <input
+ id="package_name"
+ v-model="erm_package.name"
+ :placeholder="$t('Package name')"
+ required
+ />
+ <span class="required">{{ $t("Required") }}</span>
+ </li>
+ <li>
+ <label for="package_vendor_id"
+ >{{ $t("Vendor") }}:</label
+ >
+ <select
+ id="package_vendor_id"
+ v-model="erm_package.vendor_id"
+ >
+ <option value=""></option>
+ <option
+ v-for="vendor in vendors"
+ :key="vendor.vendor_id"
+ :value="vendor.id"
+ :selected="
+ vendor.id == erm_package.vendor_id
+ ? true
+ : false
+ "
+ >
+ {{ vendor.name }}
+ </option>
+ </select>
+ </li>
+ <li>
+ <label for="package_type">{{ $t("Type") }}:</label>
+ <select
+ id="package_type"
+ v-model="erm_package.package_type"
+ >
+ <option value=""></option>
+ <option
+ v-for="type in av_package_types"
+ :key="type.authorised_values"
+ :value="type.authorised_value"
+ :selected="
+ type.authorised_value ==
+ erm_package.package_type
+ ? true
+ : false
+ "
+ >
+ {{ type.lib }}
+ </option>
+ </select>
+ </li>
+ <li>
+ <label for="package_content_type">{{
+ $t("Content type: ")
+ }}</label>
+ <select
+ id="package_content_type"
+ v-model="erm_package.content_type"
+ >
+ <option value=""></option>
+ <option
+ v-for="type in av_package_content_types"
+ :key="type.authorised_values"
+ :value="type.authorised_value"
+ :selected="
+ type.authorised_value ==
+ erm_package.content_type
+ ? true
+ : false
+ "
+ >
+ {{ type.lib }}
+ </option>
+ </select>
+ </li>
+
+ <EHoldingsPackageAgreements
+ :package_agreements="erm_package.package_agreements"
+ />
+ </ol>
+ </fieldset>
+ <fieldset class="action">
+ <input type="submit" value="Submit" />
+ <router-link
+ to="/cgi-bin/koha/erm/eholdings/packages"
+ role="button"
+ class="cancel"
+ >{{ $t("Cancel") }}</router-link
+ >
+ </fieldset>
+ </form>
+ </div>
+ </div>
+</template>
+
+<script>
+import EHoldingsPackageAgreements from "./EHoldingsPackageAgreements.vue"
+import { useVendorStore } from "../../stores/vendors"
+import { useAVStore } from "../../stores/authorised_values"
+import { setMessage, setError } from "../../messages"
+import { fetchPackage } from '../../fetch'
+import { storeToRefs } from "pinia"
+
+export default {
+ setup() {
+ const vendorStore = useVendorStore()
+ const { vendors } = storeToRefs(vendorStore)
+ const AVStore = useAVStore()
+ const {
+ av_package_types,
+ av_package_content_types,
+ } = storeToRefs(AVStore)
+
+ return {
+ vendors,
+ av_package_types,
+ av_package_content_types,
+ }
+ },
+ data() {
+ return {
+ erm_package: {
+ package_id: null,
+ name: '',
+ external_package_id: null,
+ package_type: '',
+ content_type: '',
+ package_agreements: [],
+ },
+ initialized: false,
+ }
+ },
+ beforeRouteEnter(to, from, next) {
+ next(vm => {
+ if (to.params.package_id) {
+ vm.erm_package = vm.getPackage(to.params.package_id)
+ } else {
+ vm.initialized = true
+ }
+ })
+ },
+ methods: {
+ async getPackage(package_id) {
+ const erm_package = await fetchPackage(package_id)
+ this.erm_package = erm_package
+ this.initialized = true
+ },
+ onSubmit(e) {
+ e.preventDefault()
+
+ let erm_package = JSON.parse(JSON.stringify(this.erm_package)) // copy
+ let apiUrl = '/api/v1/erm/eholdings/packages'
+
+ let method = 'POST'
+ if (erm_package.package_id) {
+ method = 'PUT'
+ apiUrl += '/' + erm_package.package_id
+ }
+ delete erm_package.package_id
+ delete erm_package.resources
+ delete erm_package.vendor
+
+ erm_package.package_agreements = erm_package.package_agreements.map(({ package_id, agreement, ...keepAttrs }) => keepAttrs)
+
+ const options = {
+ method: method,
+ body: JSON.stringify(erm_package),
+ headers: {
+ 'Content-Type': 'application/json;charset=utf-8'
+ },
+ }
+
+ fetch(apiUrl, options)
+ .then(response => {
+ if (response.status == 200) {
+ this.$router.push("/cgi-bin/koha/erm/eholdings/packages")
+ setMessage(this.$t("Package updated"))
+ } else if (response.status == 201) {
+ this.$router.push("/cgi-bin/koha/erm/eholdings/packages")
+ setMessage(this.$t("Package created"))
+ } else {
+ setError(response.message || response.statusText)
+ }
+ }, (error) => {
+ setError(error)
+ }).catch(e => { console.log(e) })
+ },
+ },
+ components: {
+ EHoldingsPackageAgreements,
+ },
+ name: "EHoldingsPackagesFormAdd",
+}
+</script>
\ No newline at end of file
--- /dev/null
+<template>
+ <div v-if="!this.initialized">{{ $t("Loading") }}</div>
+ <div v-else id="packages_confirm_delete">
+ <h2>{{ $t("Delete package") }}</h2>
+ <div>
+ <form @submit="onSubmit($event)">
+ <fieldset class="rows">
+ <ol>
+ <li>
+ {{ $t("Package name") }}:
+ {{ erm_package.name }}
+ </li>
+ </ol>
+ </fieldset>
+ <fieldset class="action">
+ <input
+ type="submit"
+ variant="primary"
+ :value="$t('Yes, delete')"
+ />
+ <router-link
+ to="/cgi-bin/koha/erm/eholdings/packages"
+ role="button"
+ class="cancel"
+ >{{ $t("No, do not delete") }}</router-link
+ >
+ </fieldset>
+ </form>
+ </div>
+ </div>
+</template>
+
+<script>
+import { fetchPackage } from "../../fetch"
+import { setMessage, setError } from "../../messages"
+
+export default {
+ data() {
+ return {
+ erm_package: {},
+ initialized: false,
+ }
+ },
+ beforeRouteEnter(to, from, next) {
+ next(vm => {
+ vm.getPackage(to.params.package_id)
+ })
+ },
+ methods: {
+ async getPackage(package_id) {
+ const erm_package = await fetchPackage(package_id)
+ this.erm_package = erm_package
+ this.initialized = true
+ },
+ onSubmit(e) {
+ e.preventDefault()
+
+ let apiUrl = '/api/v1/erm/eholdings/packages/' + this.erm_package.package_id
+
+ const options = {
+ method: 'DELETE',
+ headers: {
+ 'Content-Type': 'application/json;charset=utf-8'
+ },
+ }
+
+ fetch(apiUrl, options)
+ .then(
+ (response) => {
+ if (response.status == 204) {
+ setMessage(this.$t("Package deleted"))
+ this.$router.push("/cgi-bin/koha/erm/eholdings/packages")
+ } else {
+ setError(response.message || response.statusText)
+ }
+ }
+ ).catch(
+ (error) => {
+ setError(error)
+ }
+ )
+ }
+ },
+ name: "EHoldingsPackagesFormConfirmDelete",
+}
+</script>
--- /dev/null
+<template>
+ <div v-if="!this.initialized">{{ $t("Loading") }}</div>
+ <div v-else-if="this.packages" id="packages_list">
+ <Toolbar />
+ <table v-if="this.packages.length" id="package_list"></table>
+ <div v-else-if="this.initialized" class="dialog message">
+ {{ $t("There are no packages defined") }}
+ </div>
+ </div>
+</template>
+
+<script>
+import Toolbar from "./EHoldingsPackagesToolbar.vue"
+import { createVNode, render } from 'vue'
+import { useVendorStore } from "../../stores/vendors"
+import { useAVStore } from "../../stores/authorised_values"
+import { storeToRefs } from "pinia"
+import { fetchPackages } from "../../fetch"
+
+export default {
+ setup() {
+ const vendorStore = useVendorStore()
+ const { vendors } = storeToRefs(vendorStore)
+
+ const AVStore = useAVStore()
+ const { av_package_types, av_package_content_types } = storeToRefs(AVStore)
+
+ return {
+ vendors,
+ av_package_types,
+ av_package_content_types,
+ }
+ },
+ data: function () {
+ return {
+ packages: [],
+ initialized: false,
+ }
+ },
+ beforeRouteEnter(to, from, next) {
+ next(vm => {
+ vm.getPackages()
+ })
+ },
+ methods: {
+ async getPackages() {
+ const packages = await fetchPackages()
+ this.packages = packages
+ this.initialized = true
+ },
+ show_package: function (package_id) {
+ this.$router.push("/cgi-bin/koha/erm/eholdings/packages/" + package_id)
+ },
+ edit_package: function (package_id) {
+ this.$router.push("/cgi-bin/koha/erm/eholdings/packages/edit/" + package_id)
+ },
+ delete_package: function (package_id) {
+ this.$router.push("/cgi-bin/koha/erm/eholdings/packages/delete/" + package_id)
+ },
+ },
+ updated() {
+ let show_package = this.show_package
+ let edit_package = this.edit_package
+ let delete_package = this.delete_package
+ window['vendors'] = this.vendors.map(e => {
+ e['_id'] = e['id']
+ e['_str'] = e['name']
+ return e
+ })
+ let vendors_map = this.vendors.reduce((map, e) => {
+ map[e.id] = e
+ return map
+ }, {})
+ window['av_package_types'] = this.av_package_types.map(e => {
+ e['_id'] = e['authorised_value']
+ e['_str'] = e['lib']
+ return e
+ })
+ let av_package_types_map = this.av_package_types.reduce((map, e) => {
+ map[e.authorised_value] = e
+ return map
+ }, {})
+ window['av_package_content_types'] = this.av_package_content_types.map(e => {
+ e['_id'] = e['authorised_value']
+ e['_str'] = e['lib']
+ return e
+ })
+ let av_package_content_types_map = this.av_package_content_types.reduce((map, e) => {
+ map[e.authorised_value] = e
+ return map
+ }, {})
+
+ $('#package_list').kohaTable({
+ "ajax": {
+ "url": eholdings_packages_table_url,
+ },
+ "order": [[0, "asc"]],
+ "columnDefs": [{
+ "targets": [0],
+ "render": function (data, type, row, meta) {
+ if (type == 'display') {
+ return escape_str(data)
+ }
+ return data
+ }
+ }],
+ "columns": [
+ {
+ "title": __("Name"),
+ "data": ["me.package_id", "me.name"],
+ "searchable": true,
+ "orderable": true,
+ // Rendering done in drawCallback
+ },
+ {
+ "title": __("Vendor"),
+ "data": "vendor_id",
+ "searchable": true,
+ "orderable": true,
+ "render": function (data, type, row, meta) {
+ return row.vendor_id != undefined ? escape_str(vendors_map[row.vendor_id].name) : ""
+ }
+ },
+ {
+ "title": __("Type"),
+ "data": "package_type",
+ "searchable": true,
+ "orderable": true,
+ "render": function (data, type, row, meta) {
+ return row.package_type != undefined && row.package_type != "" ? escape_str(av_package_types_map[row.package_type].lib) : ""
+ }
+ },
+ {
+ "title": __("Content type"),
+ "data": "package_type",
+ "searchable": true,
+ "orderable": true,
+ "render": function (data, type, row, meta) {
+ return row.content_type != undefined && row.content_type != "" ? escape_str(av_package_content_types_map[row.content_type].lib) : ""
+ }
+ },
+ {
+ "title": __("Created on"),
+ "data": "created_on",
+ "searchable": true,
+ "orderable": true,
+ "render": function (data, type, row, meta) {
+ return $date(row.created_on)
+ }
+ },
+ {
+ "title": __("Actions"),
+ "data": function (row, type, val, meta) {
+ return '<div class="actions"></div>'
+ },
+ "className": "actions noExport",
+ "searchable": false,
+ "orderable": false
+ }
+ ],
+ drawCallback: function (settings) {
+
+ var api = new $.fn.dataTable.Api(settings)
+
+ $.each($(this).find("td .actions"), function (index, e) {
+ let package_id = api.row(index).data().package_id
+ let editButton = createVNode("a", {
+ class: "btn btn-default btn-xs", role: "button", onClick: () => {
+ edit_package(package_id)
+ }
+ },
+ [createVNode("i", { class: "fa fa-pencil", 'aria-hidden': "true" }), __("Edit")])
+
+ let deleteButton = createVNode("a", {
+ class: "btn btn-default btn-xs", role: "button", onClick: () => {
+ delete_package(package_id)
+ }
+ },
+ [createVNode("i", { class: "fa fa-trash", 'aria-hidden': "true" }), __("Delete")])
+
+ let n = createVNode('span', {}, [editButton, " ", deleteButton])
+ render(n, e)
+ })
+
+ $.each($(this).find("tbody tr td:first-child"), function (index, e) {
+ let row = api.row(index).data()
+ if (!row) return // Happen if the table is empty
+ let n = createVNode("a", {
+ role: "button",
+ onClick: () => {
+ show_package(row.package_id)
+ }
+ },
+ `${row.name} (#${row.package_id})`
+ )
+ render(n, e)
+ })
+ },
+ preDrawCallback: function (settings) {
+ var table_id = settings.nTable.id
+ $("#" + table_id).find("thead th").eq(1).attr('data-filter', 'vendors')
+ $("#" + table_id).find("thead th").eq(2).attr('data-filter', 'av_package_types')
+ $("#" + table_id).find("thead th").eq(3).attr('data-filter', 'av_package_content_types')
+ }
+
+ }, eholdings_packages_table_settings, 1)
+ },
+ beforeUnmount() {
+ $('#package_list')
+ .DataTable()
+ .destroy(true)
+ },
+ components: { Toolbar },
+ name: "EHoldingsPackagesList",
+}
+</script>
--- /dev/null
+<template>
+ <div v-if="!this.initialized">{{ $t("Loading") }}</div>
+ <div v-else id="packages_show">
+ <h2>
+ {{ $t("Package.id", { id: erm_package.package_id }) }}
+ <span class="action_links">
+ <router-link
+ :to="`/cgi-bin/koha/erm/eholdings/packages/edit/${erm_package.package_id}`"
+ :title="$t('Edit')"
+ ><i class="fa fa-pencil"></i
+ ></router-link>
+
+ <router-link
+ :to="`/cgi-bin/koha/erm/eholdings/packages/delete/${erm_package.package_id}`"
+ :title="$t('Delete')"
+ ><i class="fa fa-trash"></i
+ ></router-link>
+ </span>
+ </h2>
+ <div>
+ <fieldset class="rows">
+ <ol>
+ <li>
+ <label>{{ $t("Package name") }}:</label>
+ <span>
+ {{ erm_package.name }}
+ </span>
+ </li>
+ <li>
+ <label>{{ $t("Vendor") }}:</label>
+ <span v-if="erm_package.vendor_id">
+ {{
+ vendors.find(
+ (e) => e.id == erm_package.vendor_id
+ ).name
+ }}
+ </span>
+ </li>
+ <li v-if="erm_package.external_package_id">
+ <label>{{ $t("External ID") }}:</label>
+ <span>
+ {{ erm_package.external_package_id }}
+ </span>
+ </li>
+ <li>
+ <label>{{ $t("Package type") }}:</label>
+ <span>{{
+ get_lib_from_av(
+ "av_package_types",
+ erm_package.package_type
+ )
+ }}</span>
+ </li>
+ <li>
+ <label>{{ $t("Content type") }}:</label>
+ <span>{{
+ get_lib_from_av(
+ "av_package_content_types",
+ erm_package.content_type
+ )
+ }}</span>
+ </li>
+ <li>
+ <label>{{ $t("Created on") }}:</label>
+ <span>{{ format_date(erm_package.created_on) }}</span>
+ </li>
+ </ol>
+ </fieldset>
+ <fieldset class="action">
+ <router-link
+ to="/cgi-bin/koha/erm/eholdings/packages"
+ role="button"
+ class="cancel"
+ >{{ $t("Close") }}</router-link
+ >
+ </fieldset>
+ </div>
+ </div>
+</template>
+
+<script>
+import { useVendorStore } from "../../stores/vendors"
+import { useAVStore } from "../../stores/authorised_values"
+import { fetchPackage } from "../../fetch"
+import { storeToRefs } from "pinia"
+
+export default {
+ setup() {
+ const format_date = $date
+
+ const vendorStore = useVendorStore()
+ const { vendors } = storeToRefs(vendorStore)
+
+ const AVStore = useAVStore()
+ const { get_lib_from_av } = AVStore
+
+ return {
+ format_date,
+ get_lib_from_av,
+ vendors,
+ }
+ },
+ data() {
+ return {
+ erm_package: {
+ package_id: null,
+ vendor_id: null,
+ name: '',
+ external_package_id: '',
+ package_type: '',
+ content_type: '',
+ created_on: null,
+ },
+ initialized: false,
+ }
+ },
+ beforeRouteEnter(to, from, next) {
+ next(vm => {
+ vm.getPackage(to.params.package_id)
+ })
+ },
+ beforeRouteUpdate(to, from) {
+ this.erm_package = this.getPackage(to.params.package_id)
+ },
+ methods: {
+ async getPackage(package_id) {
+ const erm_package = await fetchPackage(package_id)
+ this.erm_package = erm_package
+ this.initialized = true
+ },
+ },
+ name: "EHoldingsPackagesShow",
+}
+</script>
+<style scoped>
+.action_links a {
+ padding-left: 0.2em;
+ font-size: 11px;
+}
+</style>
\ No newline at end of file
--- /dev/null
+<template>
+ <router-link to="/cgi-bin/koha/erm/eholdings/packages/add" class="btn btn-default"
+ ><font-awesome-icon icon="plus" />
+ {{ $t("New package") }}</router-link
+ >
+</template>
+
+<script>
+export default {
+ name: "EHoldingsPackagesToolbar",
+}
+</script>
--- /dev/null
+<template>
+ <fieldset class="rows" id="resources">
+ <legend>{{ $t("Packages") }}</legend>
+ <fieldset
+ class="rows"
+ v-for="(resource, counter) in resources"
+ v-bind:key="counter"
+ >
+ <legend>
+ {{ $t("Package.counter", { counter: counter + 1 }) }}
+ <a href="#" @click.prevent="deletePackage(counter)"
+ ><i class="fa fa-trash"></i>
+ {{ $t("Remove from this package") }}</a
+ >
+ </legend>
+ <ol>
+ <li>
+ <label :for="`resource_id_${counter}`" class="required"
+ >{{ $t("Package") }}:
+ </label>
+ <select
+ v-model="resource.package_id"
+ :id="`resource_id_${counter}`"
+ required
+ >
+ <option value=""></option>
+ <option
+ v-for="p in packages"
+ :key="p.package_id"
+ :value="p.package_id"
+ :selected="
+ p.package_id == resource.package_id
+ ? true
+ : false
+ "
+ >
+ {{ p.name }}
+ </option>
+ </select>
+ <span class="required">{{ $t("Required") }}</span>
+ </li>
+ <li>
+ <label :for="`started_on_${counter}`"
+ >{{ $t("Start date") }}:
+ </label>
+ <flat-pickr
+ :id="`started_on_${counter}`"
+ v-model="resource.started_on"
+ :config="fp_config"
+ :data-date_to="`ended_on_${counter}`"
+ />
+ </li>
+ <li>
+ <label :for="`ended_on_${counter}`"
+ >{{ $t("End date") }}:</label
+ >
+ <flat-pickr
+ :id="`ended_on_${counter}`"
+ v-model="resource.ended_on"
+ :config="fp_config"
+ />
+ </li>
+ <li>
+ <label :for="`${counter}`">{{ $t("Proxy") }}:</label>
+ <input
+ :id="`proxy_${counter}`"
+ v-model="resource.proxy"
+ :placeholder="$t('Proxy')"
+ />
+ </li>
+ </ol>
+ </fieldset>
+ <a v-if="packages.length" class="btn btn-default" @click="addPackage"
+ ><font-awesome-icon icon="plus" />
+ {{ $t("Add to another package") }}</a
+ >
+ <span v-else>{{ $t("There are no packages created yet") }}</span>
+ </fieldset>
+</template>
+
+<script>
+import flatPickr from 'vue-flatpickr-component'
+import { fetchPackages } from "../../fetch"
+
+export default {
+ data() {
+ return {
+ packages: [],
+ fp_config: flatpickr_defaults,
+ dates_fixed: 0,
+ }
+ },
+ beforeCreate() {
+ fetchPackages().then((packages) => this.packages = packages)
+ if (!this.dates_fixed) {
+ this.resources.forEach(r => {
+ r.started_on = $date(r.started_on)
+ r.ended_on = $date(r.ended_on)
+ })
+ this.dates_fixed = 1
+ }
+ },
+ methods: {
+ addPackage() {
+ this.resources.push({
+ package_id: null,
+ started_on: null,
+ ended_on: null,
+ proxy: '',
+ })
+ },
+ deletePackage(counter) {
+ this.resources.splice(counter, 1)
+ },
+ },
+ props: {
+ resources: Array,
+ },
+ components: { flatPickr },
+ name: 'EHoldingsResources',
+}
+</script>
+++ /dev/null
-<template>
- <div v-if="!initialized">{{ $t("Loading") }}</div>
- <div v-else id="eholdings_show">
- <h2>
- {{ $t("EHolding.id", { id: eholding.eholding_id }) }}
- <span class="action_links">
- <router-link
- :to="`/cgi-bin/koha/erm/eholdings/edit/${eholding.eholding_id}`"
- :title="$t('Edit')"
- ><i class="fa fa-pencil"></i
- ></router-link>
-
- <router-link
- :to="`/cgi-bin/koha/erm/eholdings/delete/${eholding.eholding_id}`"
- :title="$t('Delete')"
- ><i class="fa fa-trash"></i
- ></router-link>
- </span>
- </h2>
- <div>
- <fieldset class="rows">
- <ol>
- <li>
- <label>{{ $t("Publication title") }}:</label>
- <span>
- {{ eholding.publication_title }}
- </span>
- </li>
- <li>
- <label>{{ $t("Vendor") }}:</label>
- <span v-if="eholding.vendor_id">
- {{
- vendors.find((e) => e.id == eholding.vendor_id)
- .name
- }}
- </span>
- </li>
- <li>
- <label>{{ $t("Print-format identifier") }}:</label>
- <span>
- {{ eholding.print_identifier }}
- </span>
- </li>
- <li>
- <label>{{ $t("Online-format identifier") }}:</label>
- <span>
- {{ eholding.online_identifier }}
- </span>
- </li>
- <li>
- <label
- >{{
- $t(
- "Date of first serial issue available online"
- )
- }}:</label
- >
- <span>
- {{ eholding.date_first_issue_online }}
- </span>
- </li>
- <li>
- <label
- >{{
- $t("Number of first volume available online")
- }}:</label
- >
- <span>
- {{ eholding.num_first_vol_online }}
- </span>
- </li>
- <li>
- <label
- >{{
- $t("Number of first issue available online")
- }}:</label
- >
- <span>
- {{ eholding.num_first_issue_online }}
- </span>
- </li>
- <li>
- <label
- >{{
- $t("Date of last issue available online")
- }}:</label
- >
- <span>
- {{ eholding.date_last_issue_online }}
- </span>
- </li>
- <li>
- <label
- >{{
- $t("Number of last volume available online")
- }}:</label
- >
- <span>
- {{ eholding.num_last_vol_online }}
- </span>
- </li>
- <li>
- <label
- >{{
- $t("Number of last issue available online")
- }}:</label
- >
- <span>
- {{ eholding.num_last_issue_online }}
- </span>
- </li>
- <li>
- <label>{{ $t("Title-level URL") }}:</label>
- <span>
- {{ eholding.title_url }}
- </span>
- </li>
- <li>
- <label>{{ $t("First author") }}:</label>
- <span>
- {{ eholding.first_author }}
- </span>
- </li>
- <li>
- <label>{{ $t("Title identifier") }}:</label>
- <span>
- {{ eholding.title_id }}
- </span>
- </li>
- <li>
- <label>{{ $t("Embargo information") }}:</label>
- <span>
- {{ eholding.embargo_info }}
- </span>
- </li>
- <li>
- <label>{{ $t("Coverage depth") }}:</label>
- <span>
- {{ eholding.coverage_depth }}
- </span>
- </li>
- <li>
- <label>{{ $t("Notes") }}:</label>
- <span>
- {{ eholding.notes }}
- </span>
- </li>
- <li>
- <label>{{ $t("Publisher name") }}:</label>
- <span>
- {{ eholding.publisher_name }}
- </span>
- </li>
- <li>
- <label>{{ $t("Publication type") }}:</label>
- <span>
- {{ eholding.publication_type }}
- </span>
- </li>
- <li>
- <label
- >{{
- $t(
- "Date the monograph is first published in print"
- )
- }}:</label
- >
- <span>
- {{ eholding.date_monograph_published_print }}
- </span>
- </li>
- <li>
- <label
- >{{
- $t(
- "Date the monograph is first published online"
- )
- }}:</label
- >
- <span>
- {{ eholding.date_monograph_published_online }}
- </span>
- </li>
- <li>
- <label
- >{{ $t("Number of volume for monograph") }}:</label
- >
- <span>
- {{ eholding.monograph_volume }}
- </span>
- </li>
- <li>
- <label>{{ $t("Edition of the monograph") }}:</label>
- <span>
- {{ eholding.monograph_edition }}
- </span>
- </li>
- <li>
- <label>{{ $t("First editor") }}:</label>
- <span>
- {{ eholding.first_editor }}
- </span>
- </li>
- <li>
- <label
- >{{
- $t(
- "Title identifier of the parent publication"
- )
- }}:</label
- >
- <span>
- {{ eholding.parent_publication_title_id }}
- </span>
- </li>
- <li>
- <label
- >{{
- $t(
- "Title identifier of any preceding publication title"
- )
- }}:</label
- >
- <span>
- {{ eholding.preceeding_publication_title_id }}
- </span>
- </li>
- <li>
- <label>{{ $t("Acces type") }}:</label>
- <span>
- {{ eholding.access_type }}
- </span>
- </li>
-
- <li v-if="eholding.eholding_packages.length">
- <label>{{ $t("Packages") }}</label>
- <table>
- <thead>
- <tr>
- <th>Name</th>
- </tr>
- </thead>
- <tbody>
- <tr
- v-for="(
- p, counter
- ) in eholding.eholding_packages"
- v-bind:key="counter"
- >
- <td>
- <router-link
- :to="`/cgi-bin/koha/erm/packages/${p.package_id}`"
- :title="$t('Show package')"
- >
- {{ p.package.name }}
- </router-link>
- </td>
- </tr>
- </tbody>
- </table>
- </li>
- </ol>
- </fieldset>
- <fieldset class="action">
- <router-link
- to="/cgi-bin/koha/erm/eholdings"
- role="button"
- class="cancel"
- >{{ $t("Close") }}</router-link
- >
- </fieldset>
- </div>
- </div>
-</template>
-
-<script>
-import { fetchEHolding } from "../../fetch"
-import { useVendorStore } from "../../stores/vendors"
-import { storeToRefs } from "pinia"
-export default {
- setup() {
- const vendorStore = useVendorStore()
- const { vendors } = storeToRefs(vendorStore)
-
- return {
- vendors,
- }
- },
- data() {
- return {
- eholding: {
- eholding_id: null,
- vendor_id: null,
- publication_title: '',
- print_identifier: '',
- online_identifier: '',
- date_first_issue_online: '',
- num_first_vol_online: '',
- num_first_issue_online: '',
- date_last_issue_online: '',
- num_last_vol_online: '',
- num_last_issue_online: '',
- title_url: '',
- first_author: '',
- title_id: '',
- embargo_info: '',
- coverage_depth: '',
- notes: '',
- publisher_name: '',
- publication_type: '',
- date_monograph_published_print: '',
- date_monograph_published_online: '',
- monograph_volume: '',
- monograph_edition: '',
- first_editor: '',
- parent_publication_title_id: '',
- preceeding_publication_title_id: '',
- access_type: '',
- eholding_packages: [],
- },
- initialized: false,
- }
- },
-
- beforeRouteEnter(to, from, next) {
- next(vm => {
- vm.getEHolding(to.params.eholding_id)
- vm.initialized = true
- })
- },
- beforeRouteUpdate(to, from) {
- this.eholding = this.getEHolding(to.params.eholding_id)
- },
- methods: {
- async getEHolding(eholding_id) {
- const eholding = await fetchEHolding(eholding_id)
- this.eholding = eholding
- },
- },
- name: "EHoldingsShow",
-}
-</script>
-<style scoped>
-.action_links a {
- padding-left: 0.2em;
- font-size: 11px;
-}
-fieldset.rows label {
- width: 25rem;
-}
-</style>
\ No newline at end of file
--- /dev/null
+<template>
+ <div v-if="!initialized">{{ $t("Loading") }}</div>
+ <div v-else id="titles_add">
+ <h2 v-if="title.title_id">
+ {{ $t("Edit title.id", { id: title.title_id }) }}
+ </h2>
+ <h2 v-else>{{ $t("New title") }}</h2>
+ <div>
+ <form @submit="onSubmit($event)">
+ <fieldset class="rows">
+ <ol>
+ <li v-if="title.title_id">
+ <label for="title_title_id"
+ >{{ $t("Title identifier") }}:</label
+ >
+ <input
+ id="title_title_id"
+ v-model="title.title_id"
+ :placeholder="$t('Title identifier')"
+ />
+ </li>
+
+ <li>
+ <label class="required" for="title_name"
+ >{{ $t("Publication title") }}:</label
+ >
+ <input
+ id="title_publication_title"
+ v-model="title.publication_title"
+ :placeholder="$t('Publication title')"
+ required
+ />
+ <span class="required">{{ $t("Required") }}</span>
+ </li>
+
+ <li>
+ <label for="title_vendor_id"
+ >{{ $t("Vendor") }}:</label
+ >
+ <select
+ id="title_vendor_id"
+ v-model="title.vendor_id"
+ >
+ <option value=""></option>
+ <option
+ v-for="vendor in vendors"
+ :key="vendor.vendor_id"
+ :value="vendor.id"
+ :selected="
+ vendor.id == title.vendor_id
+ ? true
+ : false
+ "
+ >
+ {{ vendor.name }}
+ </option>
+ </select>
+ </li>
+
+ <li>
+ <label for="title_print_identifier"
+ >{{ $t("Print-format identifier") }}:</label
+ >
+ <input
+ id="title_print_identifier"
+ v-model="title.print_identifier"
+ :placeholder="$t('Print-format identifier')"
+ />
+ </li>
+
+ <li>
+ <label for="title_online_identifier"
+ >{{ $t("Online-format identifier") }}:</label
+ >
+ <input
+ id="title_online_identifier"
+ v-model="title.online_identifier"
+ :placeholder="$t('Online-format identifier')"
+ />
+ </li>
+
+ <li>
+ <label for="title_date_first_issue_online"
+ >{{
+ $t(
+ "Date of first serial issue available online"
+ )
+ }}:</label
+ >
+ <input
+ id="title_date_first_issue_online"
+ v-model="title.date_first_issue_online"
+ :placeholder="
+ $t(
+ 'Date of first serial issue available online'
+ )
+ "
+ />
+ </li>
+
+ <li>
+ <label for="title_num_first_vol_online"
+ >{{
+ $t(
+ "Number of first volume available online"
+ )
+ }}:</label
+ >
+ <input
+ id="title_num_first_vol_online"
+ v-model="title.num_first_vol_online"
+ :placeholder="
+ $t(
+ 'Number of first volume available online'
+ )
+ "
+ />
+ </li>
+
+ <li>
+ <label for="title_num_first_issue_online"
+ >{{
+ $t(
+ "Number of first issue available online"
+ )
+ }}:</label
+ >
+ <input
+ id="title_num_first_issue_online"
+ v-model="title.num_first_issue_online"
+ :placeholder="
+ $t('Number of first issue available online')
+ "
+ />
+ </li>
+
+ <li>
+ <label for="title_date_last_issue_online"
+ >{{
+ $t("Date of last issue available online")
+ }}:</label
+ >
+ <input
+ id="title_date_last_issue_online"
+ v-model="title.date_last_issue_online"
+ :placeholder="
+ $t('Date of last issue available online')
+ "
+ />
+ </li>
+
+ <li>
+ <label for="title_num_last_vol_online"
+ >{{
+ $t(
+ "Number of last volume available online"
+ )
+ }}:</label
+ >
+ <input
+ id="title_num_last_vol_online"
+ v-model="title.num_last_vol_online"
+ :placeholder="
+ $t('Number of last volume available online')
+ "
+ />
+ </li>
+
+ <li>
+ <label for="title_num_last_issue_online"
+ >{{
+ $t("Number of last issue available online")
+ }}:</label
+ >
+ <input
+ id="title_num_last_issue_online"
+ v-model="title.num_last_issue_online"
+ :placeholder="
+ $t('Number of last issue available online')
+ "
+ />
+ </li>
+
+ <li>
+ <label for="title_title_url"
+ >{{ $t("Title-level URL") }}:</label
+ >
+ <input
+ id="title_title_url"
+ v-model="title.title_url"
+ :placeholder="$t('Title-level URL')"
+ />
+ </li>
+
+ <li>
+ <label for="title_first_author"
+ >{{ $t("First author") }}:</label
+ >
+ <input
+ id="title_first_author"
+ v-model="title.first_author"
+ :placeholder="$t('First author')"
+ />
+ </li>
+
+ <li>
+ <label for="title_embargo_info"
+ >{{ $t("Embargo information") }}:</label
+ >
+ <input
+ id="title_embargo_info"
+ v-model="title.embargo_info"
+ :placeholder="$t('Embargo information')"
+ />
+ </li>
+
+ <li>
+ <label for="title_coverage_depth"
+ >{{ $t("Coverage depth") }}:</label
+ >
+ <input
+ id="title_coverage_depth"
+ v-model="title.coverage_depth"
+ :placeholder="$t('Coverage depth')"
+ />
+ </li>
+
+ <li>
+ <label for="title_notes">{{ $t("Notes") }}:</label>
+ <input
+ id="title_notes"
+ v-model="title.notes"
+ :placeholder="$t('Notes')"
+ />
+ </li>
+
+ <li>
+ <label for="title_publisher_name"
+ >{{ $t("Publisher name") }}:</label
+ >
+ <input
+ id="title_publisher_name"
+ v-model="title.publisher_name"
+ :placeholder="$t('Publisher name')"
+ />
+ </li>
+
+ <li>
+ <label for="title_publication_type"
+ >{{ $t("Publication type") }}:</label
+ >
+ <input
+ id="title_publication_type"
+ v-model="title.publication_type"
+ :placeholder="$t('Publication type')"
+ />
+ </li>
+
+ <li>
+ <label for="title_date_monograph_published_print"
+ >{{
+ $t(
+ "Date the monograph is first published in print"
+ )
+ }}:</label
+ >
+ <input
+ id="title_date_monograph_published_print"
+ v-model="title.date_monograph_published_print"
+ :placeholder="
+ $t(
+ 'Date the monograph is first published in print'
+ )
+ "
+ />
+ </li>
+
+ <li>
+ <label for="title_date_monograph_published_online"
+ >{{
+ $t(
+ "Date the monograph is first published online"
+ )
+ }}:</label
+ >
+ <input
+ id="title_date_monograph_published_online"
+ v-model="title.date_monograph_published_online"
+ :placeholder="
+ $t(
+ 'Date the monograph is first published online'
+ )
+ "
+ />
+ </li>
+
+ <li>
+ <label for="title_monograph_volume"
+ >{{
+ $t("Number of volume for monograph")
+ }}:</label
+ >
+ <input
+ id="title_monograph_volume"
+ v-model="title.monograph_volume"
+ :placeholder="
+ $t('Number of volume for monograph')
+ "
+ />
+ </li>
+
+ <li>
+ <label for="title_monograph_edition"
+ >{{ $t("Edition of the monograph") }}:</label
+ >
+ <input
+ id="title_monograph_edition"
+ v-model="title.monograph_edition"
+ :placeholder="$t('Edition of the monograph')"
+ />
+ </li>
+
+ <li>
+ <label for="title_first_editor"
+ >{{ $t("First editor") }}:</label
+ >
+ <input
+ id="title_first_editor"
+ v-model="title.first_editor"
+ :placeholder="$t('First editor')"
+ />
+ </li>
+
+ <li>
+ <label for="title_parent_publication_title_id"
+ >{{
+ $t(
+ "Title identifier of the parent publication"
+ )
+ }}:</label
+ >
+ <input
+ id="title_parent_publication_title_id"
+ v-model="title.parent_publication_title_id"
+ :placeholder="
+ $t(
+ 'Title identifier of the parent publication'
+ )
+ "
+ />
+ </li>
+
+ <li>
+ <label for="title_preceeding_publication_title_id"
+ >{{
+ $t(
+ "Title identifier of any preceding publication title"
+ )
+ }}:</label
+ >
+ <input
+ id="title_preceeding_publication_title_id"
+ v-model="title.preceeding_publication_title_id"
+ :placeholder="
+ $t(
+ 'Title identifier of any preceding publication title'
+ )
+ "
+ />
+ </li>
+
+ <li>
+ <label for="title_access_type"
+ >{{
+ // FIXME May be fee-based (P) or Open Access (F).
+ $t("Access type")
+ }}:</label
+ >
+ <input
+ id="title_access_type"
+ v-model="title.access_type"
+ :placeholder="$t('Access type')"
+ />
+ </li>
+
+ <EHoldingsResources
+ :resources="title.resources"
+ />
+ </ol>
+ </fieldset>
+ <fieldset class="action">
+ <input type="submit" value="Submit" />
+ <router-link
+ to="/cgi-bin/koha/erm/eholdings/titles"
+ role="button"
+ class="cancel"
+ >{{ $t("Cancel") }}</router-link
+ >
+ </fieldset>
+ </form>
+ </div>
+ </div>
+</template>
+
+<script>
+import { useVendorStore } from "../../stores/vendors"
+import EHoldingsResources from "./EHoldingsResources.vue"
+import { setMessage, setError } from "../../messages"
+import { fetchTitle } from '../../fetch'
+import { storeToRefs } from "pinia"
+
+export default {
+ setup() {
+ const vendorStore = useVendorStore()
+ const { vendors } = storeToRefs(vendorStore)
+
+ return {
+ vendors,
+ }
+ },
+ data() {
+ return {
+ title: {
+ title_id: null,
+ vendor_id: null,
+ publication_title: '',
+ print_identifier: '',
+ online_identifier: '',
+ date_first_issue_online: '',
+ num_first_vol_online: '',
+ num_first_issue_online: '',
+ date_last_issue_online: '',
+ num_last_vol_online: '',
+ num_last_issue_online: '',
+ title_url: '',
+ first_author: '',
+ embargo_info: '',
+ coverage_depth: '',
+ notes: '',
+ publisher_name: '',
+ publication_type: '',
+ date_monograph_published_print: '',
+ date_monograph_published_online: '',
+ monograph_volume: '',
+ monograph_edition: '',
+ first_editor: '',
+ parent_publication_title_id: '',
+ preceeding_publication_title_id: '',
+ access_type: '',
+ resources: [],
+ },
+ initialized: false,
+ }
+ },
+ beforeRouteEnter(to, from, next) {
+ next(vm => {
+ if (to.params.title_id) {
+ vm.title = vm.getTitle(to.params.title_id)
+ } else {
+ vm.initialized = true
+ }
+ })
+ },
+ methods: {
+ async getTitle(title_id) {
+ const title = await fetchTitle(title_id)
+ this.title = title
+ this.initialized = true
+ },
+ onSubmit(e) {
+ e.preventDefault()
+
+ let title = JSON.parse(JSON.stringify(this.title)) // copy
+ let apiUrl = '/api/v1/erm/eholdings/titles'
+
+ let method = 'POST'
+ if (title.title_id) {
+ method = 'PUT'
+ apiUrl += '/' + title.title_id
+ }
+ delete title.title_id
+
+ title.resources.forEach(r => {
+ r.started_on = r.started_on ? $date_to_rfc3339(r.started_on) : null
+ r.ended_on = r.ended_on ? $date_to_rfc3339(r.ended_on) : null
+ })
+
+ // Cannot use the map/keepAttrs because of the reserved keywork 'package'
+ title.resources.forEach(function (e) { delete e.package; delete e.resource_id })
+
+ const options = {
+ method: method,
+ body: JSON.stringify(title),
+ headers: {
+ 'Content-Type': 'application/json;charset=utf-8'
+ },
+ }
+
+ fetch(apiUrl, options)
+ .then(response => {
+ if (response.status == 200) {
+ this.$router.push("/cgi-bin/koha/erm/eholdings/titles")
+ setMessage(this.$t("Title updated"))
+ } else if (response.status == 201) {
+ this.$router.push("/cgi-bin/koha/erm/eholdings/titles")
+ setMessage(this.$t("Title created"))
+ } else {
+ setError(response.message || response.statusText)
+ }
+ }, (error) => {
+ setError(error)
+ }).catch(e => { console.log(e) })
+ },
+ },
+ components: { EHoldingsResources },
+ name: "EHoldingsTitlesFormAdd",
+}
+</script>
+<style scoped>
+fieldset.rows label {
+ width: 25rem;
+}
+</style>
--- /dev/null
+<template>
+ <div v-if="!initialized">{{ $t("Loading") }}</div>
+ <div v-else id="eholdings_confirm_delete">
+ <h2>{{ $t("Delete title") }}</h2>
+ <div>
+ <form @submit="onSubmit($event)">
+ <fieldset class="rows">
+ <ol>
+ <li>
+ {{ $t("Title") }}:
+ {{ eholding.publication_title }}
+ </li>
+ </ol>
+ </fieldset>
+ <fieldset class="action">
+ <input
+ type="submit"
+ variant="primary"
+ :value="$t('Yes, delete')"
+ />
+ <router-link
+ to="/cgi-bin/koha/erm/eholdings/titles"
+ role="button"
+ class="cancel"
+ >{{ $t("No, do not delete") }}</router-link
+ >
+ </fieldset>
+ </form>
+ </div>
+ </div>
+</template>
+
+<script>
+import { fetchTitle } from "../../fetch"
+import { setMessage, setError } from "../../messages"
+
+export default {
+ data() {
+ return {
+ eholding: {},
+ initialized: false,
+ }
+ },
+ beforeRouteEnter(to, from, next) {
+ next(vm => {
+ vm.getEHolding(to.params.title_id)
+ })
+ },
+ methods: {
+ async getEHolding(title_id) {
+ const eholding = await fetchTitle(title_id)
+ this.eholding = eholding
+ this.initialized = true
+ },
+ onSubmit(e) {
+ e.preventDefault()
+
+ let apiUrl = '/api/v1/erm/eholdings/titles' + this.title_id
+
+ const options = {
+ method: 'DELETE',
+ headers: {
+ 'Content-Type': 'application/json;charset=utf-8'
+ },
+ }
+
+ fetch(apiUrl, options)
+ .then(
+ (response) => {
+ if (response.status == 204) {
+ setMessage(this.$t("Title deleted"))
+ this.$router.push("/cgi-bin/koha/erm/eholdings/titles")
+ } else {
+ setError(response.message || response.statusText)
+ }
+ }
+ ).catch(
+ (error) => {
+ setError(error)
+ }
+ )
+ }
+ },
+ name: "EHoldingsTitlesFormConfirmDelete",
+}
+</script>
--- /dev/null
+<template>
+ <div v-if="!this.initialized">{{ $t("Loading") }}</div>
+ <div v-else-if="this.titles" id="titles_list">
+ <Toolbar />
+ <table v-if="this.titles.length" id="title_list"></table>
+ <div v-else-if="this.initialized" class="dialog message">
+ {{ $t("There are no titles defined") }}
+ </div>
+ </div>
+</template>
+
+<script>
+import Toolbar from "./EHoldingsTitlesToolbar.vue"
+import { createVNode, render } from 'vue'
+import { useVendorStore } from "../../stores/vendors"
+import { storeToRefs } from "pinia"
+import { fetchTitles } from "../../fetch"
+
+export default {
+ setup() {
+ const vendorStore = useVendorStore()
+ const { vendors } = storeToRefs(vendorStore)
+
+ return {
+ vendors,
+ }
+ },
+ data: function () {
+ return {
+ titles: [],
+ initialized: false,
+ }
+ },
+ beforeRouteEnter(to, from, next) {
+ next(vm => {
+ vm.getTitles()
+ })
+ },
+ methods: {
+ async getTitles() {
+ const titles = await fetchTitles()
+ this.titles = titles
+ this.initialized = true
+ },
+ show_title: function (title_id) {
+ this.$router.push("/cgi-bin/koha/erm/eholdings/titles/" + title_id)
+ },
+ edit_title: function (title_id) {
+ this.$router.push("/cgi-bin/koha/erm/eholdings/titles/edit/" + title_id)
+ },
+ delete_title: function (title_id) {
+ this.$router.push("/cgi-bin/koha/erm/eholdings/titles/delete/" + title_id)
+ },
+ },
+ updated() {
+ let show_title= this.show_title
+ let edit_title= this.edit_title
+ let delete_title= this.delete_title
+
+ window['vendors'] = this.vendors.map(e => {
+ e['_id'] = e['id']
+ e['_str'] = e['name']
+ return e
+ })
+ let vendors_map = this.vendors.reduce((map, e) => {
+ map[e.id] = e
+ return map
+ }, {})
+
+ $('#title_list').kohaTable({
+ "ajax": {
+ "url": eholdings_titles_table_url,
+ },
+ "order": [[0, "asc"]],
+ "columnDefs": [{
+ "targets": [1],
+ "render": function (data, type, row, meta) {
+ if (type == 'display') {
+ return escape_str(data)
+ }
+ return data
+ }
+ }],
+ "columns": [
+ {
+ "title": __("Title"),
+ "data": ["me.title_id", "me.publication_title"],
+ "searchable": true,
+ "orderable": true,
+ // Rendering done in drawCallback
+ },
+ {
+ "title": __("Vendor"),
+ "data": "vendor_id",
+ "searchable": true,
+ "orderable": true,
+ "render": function (data, type, row, meta) {
+ return row.vendor_id != undefined ? escape_str(vendors_map[row.vendor_id].name) : ""
+ }
+ },
+ {
+ "title": __("Publication type"),
+ "data": "publication_type",
+ "searchable": true,
+ "orderable": true,
+ },
+ {
+ "title": __("Identifier"),
+ "data": ["print_identifier", "online_identifier"],
+ "searchable": true,
+ "orderable": true,
+ "render": function (data, type, row, meta) {
+ let print_identifier = row.print_identifier
+ let online_identifier = row.online_identifier
+ return (print_identifier ? escape_str(_("ISBN (Print): %s").format(print_identifier)) : "") +
+ (online_identifier ? escape_str(_("ISBN (Online): %s").format(online_identifier)) : "")
+ }
+ },
+ {
+ "title": __("Actions"),
+ "data": function (row, type, val, meta) {
+ return '<div class="actions"></div>'
+ },
+ "className": "actions noExport",
+ "searchable": false,
+ "orderable": false
+ }
+ ],
+ drawCallback: function (settings) {
+
+ var api = new $.fn.dataTable.Api(settings)
+
+ $.each($(this).find("td .actions"), function (index, e) {
+ let title_id = api.row(index).data().title_id
+ let editButton = createVNode("a", {
+ class: "btn btn-default btn-xs", role: "button", onClick: () => {
+ edit_title(title_id)
+ }
+ },
+ [createVNode("i", { class: "fa fa-pencil", 'aria-hidden': "true" }), __("Edit")])
+
+ let deleteButton = createVNode("a", {
+ class: "btn btn-default btn-xs", role: "button", onClick: () => {
+ delete_title(title_id)
+ }
+ },
+ [createVNode("i", { class: "fa fa-trash", 'aria-hidden': "true" }), __("Delete")])
+
+ let n = createVNode('span', {}, [editButton, " ", deleteButton])
+ render(n, e)
+ })
+
+ $.each($(this).find("tbody tr td:first-child"), function (index, e) {
+ let row = api.row(index).data()
+ if (!row) return // Happen if the table is empty
+ let n = createVNode("a", {
+ role: "button",
+ onClick: () => {
+ show_title(row.title_id)
+ }
+ },
+ `${row.publication_title} (#${row.title_id})`
+ )
+ render(n, e)
+ })
+ },
+ preDrawCallback: function (settings) {
+ var table_id = settings.nTable.id
+ $("#" + table_id).find("thead th").eq(1).attr('data-filter', 'vendors')
+ }
+ }, eholdings_titles_table_settings, 1)
+ },
+ beforeUnmount() {
+ $('#title_list')
+ .DataTable()
+ .destroy(true)
+ },
+ components: { Toolbar },
+ name: "EHoldingsTitlesList",
+}
+</script>
--- /dev/null
+<template>
+ <div v-if="!initialized">{{ $t("Loading") }}</div>
+ <div v-else id="eholdings_title_show">
+ <h2>
+ {{ $t("Title.id", { id: title.title_id }) }}
+ <span class="action_links">
+ <router-link
+ :to="`/cgi-bin/koha/erm/eholdings/titles/edit/${title.title_id}`"
+ :title="$t('Edit')"
+ ><i class="fa fa-pencil"></i
+ ></router-link>
+
+ <router-link
+ :to="`/cgi-bin/koha/erm/eholdings/titles/delete/${title.title_id}`"
+ :title="$t('Delete')"
+ ><i class="fa fa-trash"></i
+ ></router-link>
+ </span>
+ </h2>
+ <div>
+ <fieldset class="rows">
+ <ol>
+ <li v-if="title.title_id">
+ <label
+ >{{ $t("Title identifier") }}:</label
+ >
+ <span>
+ {{ title.title_id}}
+ </span>
+ </li>
+ <li>
+ <label>{{ $t("Publication title") }}:</label>
+ <span>
+ {{ title.publication_title }}
+ </span>
+ </li>
+ <li>
+ <label>{{ $t("Vendor") }}:</label>
+ <span v-if="title.vendor_id">
+ {{
+ vendors.find((e) => e.id == title.vendor_id)
+ .name
+ }}
+ </span>
+ </li>
+ <li>
+ <label>{{ $t("Print-format identifier") }}:</label>
+ <span>
+ {{ title.print_identifier }}
+ </span>
+ </li>
+ <li>
+ <label>{{ $t("Online-format identifier") }}:</label>
+ <span>
+ {{ title.online_identifier }}
+ </span>
+ </li>
+ <li>
+ <label
+ >{{
+ $t(
+ "Date of first serial issue available online"
+ )
+ }}:</label
+ >
+ <span>
+ {{ title.date_first_issue_online }}
+ </span>
+ </li>
+ <li>
+ <label
+ >{{
+ $t("Number of first volume available online")
+ }}:</label
+ >
+ <span>
+ {{ title.num_first_vol_online }}
+ </span>
+ </li>
+ <li>
+ <label
+ >{{
+ $t("Number of first issue available online")
+ }}:</label
+ >
+ <span>
+ {{ title.num_first_issue_online }}
+ </span>
+ </li>
+ <li>
+ <label
+ >{{
+ $t("Date of last issue available online")
+ }}:</label
+ >
+ <span>
+ {{ title.date_last_issue_online }}
+ </span>
+ </li>
+ <li>
+ <label
+ >{{
+ $t("Number of last volume available online")
+ }}:</label
+ >
+ <span>
+ {{ title.num_last_vol_online }}
+ </span>
+ </li>
+ <li>
+ <label
+ >{{
+ $t("Number of last issue available online")
+ }}:</label
+ >
+ <span>
+ {{ title.num_last_issue_online }}
+ </span>
+ </li>
+ <li>
+ <label>{{ $t("Title-level URL") }}:</label>
+ <span>
+ {{ title.title_url }}
+ </span>
+ </li>
+ <li>
+ <label>{{ $t("First author") }}:</label>
+ <span>
+ {{ title.first_author }}
+ </span>
+ </li>
+ <li>
+ <label>{{ $t("Embargo information") }}:</label>
+ <span>
+ {{ title.embargo_info }}
+ </span>
+ </li>
+ <li>
+ <label>{{ $t("Coverage depth") }}:</label>
+ <span>
+ {{ title.coverage_depth }}
+ </span>
+ </li>
+ <li>
+ <label>{{ $t("Notes") }}:</label>
+ <span>
+ {{ title.notes }}
+ </span>
+ </li>
+ <li>
+ <label>{{ $t("Publisher name") }}:</label>
+ <span>
+ {{ title.publisher_name }}
+ </span>
+ </li>
+ <li>
+ <label>{{ $t("Publication type") }}:</label>
+ <span>
+ {{ title.publication_type }}
+ </span>
+ </li>
+ <li>
+ <label
+ >{{
+ $t(
+ "Date the monograph is first published in print"
+ )
+ }}:</label
+ >
+ <span>
+ {{ title.date_monograph_published_print }}
+ </span>
+ </li>
+ <li>
+ <label
+ >{{
+ $t(
+ "Date the monograph is first published online"
+ )
+ }}:</label
+ >
+ <span>
+ {{ title.date_monograph_published_online }}
+ </span>
+ </li>
+ <li>
+ <label
+ >{{ $t("Number of volume for monograph") }}:</label
+ >
+ <span>
+ {{ title.monograph_volume }}
+ </span>
+ </li>
+ <li>
+ <label>{{ $t("Edition of the monograph") }}:</label>
+ <span>
+ {{ title.monograph_edition }}
+ </span>
+ </li>
+ <li>
+ <label>{{ $t("First editor") }}:</label>
+ <span>
+ {{ title.first_editor }}
+ </span>
+ </li>
+ <li>
+ <label
+ >{{
+ $t(
+ "Title identifier of the parent publication"
+ )
+ }}:</label
+ >
+ <span>
+ {{ title.parent_publication_title_id }}
+ </span>
+ </li>
+ <li>
+ <label
+ >{{
+ $t(
+ "Title identifier of any preceding publication title"
+ )
+ }}:</label
+ >
+ <span>
+ {{ title.preceeding_publication_title_id }}
+ </span>
+ </li>
+ <li>
+ <label>{{ $t("Acces type") }}:</label>
+ <span>
+ {{ title.access_type }}
+ </span>
+ </li>
+
+ <li v-if="title.resources.length">
+ <label>{{ $t("Packages") }}</label>
+ <table>
+ <thead>
+ <tr>
+ <th>Name</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr
+ v-for="(
+ r, counter
+ ) in title.resources"
+ v-bind:key="counter"
+ >
+ <td>
+ <router-link
+ :to="`/cgi-bin/koha/erm/eholdings/packages/${r.package_id}`"
+ :title="$t('Show package')"
+ >
+ {{ r.package.name }}
+ </router-link>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </li>
+ </ol>
+ </fieldset>
+ <fieldset class="action">
+ <router-link
+ to="/cgi-bin/koha/erm/eholdings/titles"
+ role="button"
+ class="cancel"
+ >{{ $t("Close") }}</router-link
+ >
+ </fieldset>
+ </div>
+ </div>
+</template>
+
+<script>
+import { fetchTitle } from "../../fetch"
+import { useVendorStore } from "../../stores/vendors"
+import { storeToRefs } from "pinia"
+export default {
+ setup() {
+ const vendorStore = useVendorStore()
+ const { vendors } = storeToRefs(vendorStore)
+
+ return {
+ vendors,
+ }
+ },
+ data() {
+ return {
+ title: {
+ title_id: null,
+ vendor_id: null,
+ publication_title: '',
+ print_identifier: '',
+ online_identifier: '',
+ date_first_issue_online: '',
+ num_first_vol_online: '',
+ num_first_issue_online: '',
+ date_last_issue_online: '',
+ num_last_vol_online: '',
+ num_last_issue_online: '',
+ title_url: '',
+ first_author: '',
+ embargo_info: '',
+ coverage_depth: '',
+ notes: '',
+ publisher_name: '',
+ publication_type: '',
+ date_monograph_published_print: '',
+ date_monograph_published_online: '',
+ monograph_volume: '',
+ monograph_edition: '',
+ first_editor: '',
+ parent_publication_title_id: '',
+ preceeding_publication_title_id: '',
+ access_type: '',
+ resources: [],
+ },
+ initialized: false,
+ }
+ },
+
+ beforeRouteEnter(to, from, next) {
+ next(vm => {
+ vm.getTitle(to.params.title_id)
+ })
+ },
+ beforeRouteUpdate(to, from) {
+ this.title = this.getTitle(to.params.title_id)
+ },
+ methods: {
+ async getTitle(title_id) {
+ const title= await fetchTitle(title_id)
+ this.title = title
+ this.initialized = true
+ },
+ },
+ name: "EHoldingsTitlesShow",
+}
+</script>
+<style scoped>
+.action_links a {
+ padding-left: 0.2em;
+ font-size: 11px;
+}
+fieldset.rows label {
+ width: 25rem;
+}
+</style>
--- /dev/null
+<template>
+ <router-link to="/cgi-bin/koha/erm/eholdings/titles/add" class="btn btn-default"
+ ><font-awesome-icon icon="plus" />
+ {{ $t("New title") }}</router-link
+ >
+</template>
+
+<script>
+export default {
+ name: "EHoldingsTitleToolbar",
+}
+</script>
+++ /dev/null
-<template>
- <router-link to="/cgi-bin/koha/erm/eholdings/add" class="btn btn-default"
- ><font-awesome-icon icon="plus" />
- {{ $t("New eHolding") }}</router-link
- >
-</template>
-
-<script>
-export default {
- name: "EHoldingsToolbar",
-}
-</script>
</li>
<li>
<router-link
- to="/cgi-bin/koha/erm/packages"
+ to="/cgi-bin/koha/erm/eholdings/packages"
>
<i class="fa fa-file-text-o"></i>
{{ $t("Packages") }}</router-link
</li>
<li>
<router-link
- to="/cgi-bin/koha/erm/eholdings"
+ to="/cgi-bin/koha/erm/eholdings/titles"
>
<i class="fa fa-file-text-o"></i>
- {{ $t("eHoldings") }}</router-link
+ {{ $t("Titles") }}</router-link
>
</li>
<li>
beforeRouteEnter(to, from, next) {
next(vm => {
vm.license = vm.getLicense(to.params.license_id)
- vm.initialized = true
})
},
methods: {
+++ /dev/null
-<template>
- <fieldset class="rows" id="package_agreements">
- <legend>{{ $t("Agreements") }}</legend>
- <fieldset
- class="rows"
- v-for="(package_agreement, counter) in package_agreements"
- v-bind:key="counter"
- >
- <legend>
- {{ $t("Agreement.counter", { counter: counter + 1 }) }}
- <a href="#" @click.prevent="deleteAgreement(counter)"
- ><i class="fa fa-trash"></i>
- {{ $t("Remove this agreement") }}</a
- >
- </legend>
- <ol>
- <li>
- <label :for="`agreement_id_${counter}`"
- >{{ $t("Agreement") }}:
- </label>
- <select
- v-model="package_agreement.agreement_id"
- :id="`agreement_id_${counter}`"
- required
- >
- <option value=""></option>
- <option
- v-for="agreement in agreements"
- :key="agreement.agreement_id"
- :value="agreement.agreement_id"
- :selected="
- agreement.agreement_id ==
- package_agreement.agreement_id
- ? true
- : false
- "
- >
- {{ agreement.name }}
- </option>
- </select>
- <span class="required">{{ $t("Required") }}</span>
- </li>
- </ol>
- </fieldset>
- <a
- v-if="agreements.length"
- class="btn btn-default"
- @click="addAgreement"
- ><font-awesome-icon icon="plus" /> {{ $t("Add new agreement") }}</a
- >
- <span v-else>{{ $t("There are no agreements created yet") }}</span>
- </fieldset>
-</template>
-
-<script>
-import { fetchAgreements } from "../../fetch"
-
-export default {
- data() {
- return {
- agreements: [],
- }
- },
- beforeCreate() {
- fetchAgreements().then((agreements) => {
- this.agreements = agreements
- })
- },
- methods: {
- addAgreement() {
- this.package_agreements.push({
- agreement_id: null,
- })
- },
- deleteAgreement(counter) {
- this.package_agreements.splice(counter, 1)
- },
- },
- props: {
- package_agreements: Array,
- },
- name: 'PackageAgreements',
-}
-</script>
\ No newline at end of file
+++ /dev/null
-<template>
- <div v-if="!this.initialized">{{ $t("Loading") }}</div>
- <div v-else id="packages_add">
- <h2 v-if="erm_package.package_id">
- {{ $t("Edit package.id", { id: erm_package.package_id }) }}
- </h2>
- <h2 v-else>{{ $t("New package") }}</h2>
- <div>
- <form @submit="onSubmit($event)">
- <fieldset class="rows">
- <ol>
- <li>
- <label class="required" for="package_name"
- >{{ $t("Package name") }}:</label
- >
- <input
- id="package_name"
- v-model="erm_package.name"
- :placeholder="$t('Package name')"
- required
- />
- <span class="required">{{ $t("Required") }}</span>
- </li>
- <li>
- <label for="package_vendor_id"
- >{{ $t("Vendor") }}:</label
- >
- <select
- id="package_vendor_id"
- v-model="erm_package.vendor_id"
- >
- <option value=""></option>
- <option
- v-for="vendor in vendors"
- :key="vendor.vendor_id"
- :value="vendor.id"
- :selected="
- vendor.id == erm_package.vendor_id
- ? true
- : false
- "
- >
- {{ vendor.name }}
- </option>
- </select>
- </li>
- <li>
- <label for="package_type">{{ $t("Type") }}:</label>
- <select
- id="package_type"
- v-model="erm_package.package_type"
- >
- <option value=""></option>
- <option
- v-for="type in av_package_types"
- :key="type.authorised_values"
- :value="type.authorised_value"
- :selected="
- type.authorised_value ==
- erm_package.package_type
- ? true
- : false
- "
- >
- {{ type.lib }}
- </option>
- </select>
- </li>
- <li>
- <label for="package_content_type">{{
- $t("Content type: ")
- }}</label>
- <select
- id="package_content_type"
- v-model="erm_package.content_type"
- >
- <option value=""></option>
- <option
- v-for="type in av_package_content_types"
- :key="type.authorised_values"
- :value="type.authorised_value"
- :selected="
- type.authorised_value ==
- erm_package.content_type
- ? true
- : false
- "
- >
- {{ type.lib }}
- </option>
- </select>
- </li>
-
- <PackageAgreements
- :package_agreements="erm_package.package_agreements"
- />
- </ol>
- </fieldset>
- <fieldset class="action">
- <input type="submit" value="Submit" />
- <router-link
- to="/cgi-bin/koha/erm/packages"
- role="button"
- class="cancel"
- >{{ $t("Cancel") }}</router-link
- >
- </fieldset>
- </form>
- </div>
- </div>
-</template>
-
-<script>
-import PackageAgreements from "./PackageAgreements.vue"
-import { useVendorStore } from "../../stores/vendors"
-import { useAVStore } from "../../stores/authorised_values"
-import { setMessage, setError } from "../../messages"
-import { fetchPackage } from '../../fetch'
-import { storeToRefs } from "pinia"
-
-export default {
- setup() {
- const vendorStore = useVendorStore()
- const { vendors } = storeToRefs(vendorStore)
- const AVStore = useAVStore()
- const {
- av_package_types,
- av_package_content_types,
- } = storeToRefs(AVStore)
-
- return {
- vendors,
- av_package_types,
- av_package_content_types,
- }
- },
- data() {
- return {
- erm_package: {
- package_id: null,
- name: '',
- external_package_id: null,
- package_type: '',
- content_type: '',
- package_agreements: [],
- },
- initialized: false,
- }
- },
- beforeRouteEnter(to, from, next) {
- next(vm => {
- if (to.params.package_id) {
- vm.erm_package = vm.getPackage(to.params.package_id)
- } else {
- vm.initialized = true
- }
- })
- },
- methods: {
- async getPackage(package_id) {
- const erm_package = await fetchPackage(package_id)
- this.erm_package = erm_package
- this.initialized = true
- },
- onSubmit(e) {
- e.preventDefault()
-
- let erm_package = JSON.parse(JSON.stringify(this.erm_package)) // copy
- let apiUrl = '/api/v1/erm/packages'
-
- let method = 'POST'
- if (erm_package.package_id) {
- method = 'PUT'
- apiUrl += '/' + erm_package.package_id
- }
- delete erm_package.package_id
-
- erm_package.package_agreements = erm_package.package_agreements.map(({ package_id, agreement, ...keepAttrs }) => keepAttrs)
-
- const options = {
- method: method,
- body: JSON.stringify(erm_package),
- headers: {
- 'Content-Type': 'application/json;charset=utf-8'
- },
- }
-
- fetch(apiUrl, options)
- .then(response => {
- if (response.status == 200) {
- this.$router.push("/cgi-bin/koha/erm/packages")
- setMessage(this.$t("Package updated"))
- } else if (response.status == 201) {
- this.$router.push("/cgi-bin/koha/erm/packages")
- setMessage(this.$t("Package created"))
- } else {
- setError(response.message || response.statusText)
- }
- }, (error) => {
- setError(error)
- }).catch(e => { console.log(e) })
- },
- },
- components: {
- PackageAgreements,
- },
- name: "PackagesFormAdd",
-}
-</script>
\ No newline at end of file
+++ /dev/null
-<template>
- <div v-if="!this.initialized">{{ $t("Loading") }}</div>
- <div v-else id="packages_confirm_delete">
- <h2>{{ $t("Delete package") }}</h2>
- <div>
- <form @submit="onSubmit($event)">
- <fieldset class="rows">
- <ol>
- <li>
- {{ $t("Package name") }}:
- {{ erm_package.name }}
- </li>
- </ol>
- </fieldset>
- <fieldset class="action">
- <input
- type="submit"
- variant="primary"
- :value="$t('Yes, delete')"
- />
- <router-link
- to="/cgi-bin/koha/erm/packages"
- role="button"
- class="cancel"
- >{{ $t("No, do not delete") }}</router-link
- >
- </fieldset>
- </form>
- </div>
- </div>
-</template>
-
-<script>
-import { fetchPackage } from "../../fetch"
-import { setMessage, setError } from "../../messages"
-
-export default {
- data() {
- return {
- erm_package: {},
- initialized: false,
- }
- },
- beforeRouteEnter(to, from, next) {
- next(vm => {
- vm.getPackage(to.params.package_id)
- })
- },
- methods: {
- async getPackage(package_id) {
- const erm_package = await fetchPackage(package_id)
- this.erm_package = erm_package
- this.initialized = true
- },
- onSubmit(e) {
- e.preventDefault()
-
- let apiUrl = '/api/v1/erm/packages/' + this.erm_package.package_id
-
- const options = {
- method: 'DELETE',
- headers: {
- 'Content-Type': 'application/json;charset=utf-8'
- },
- }
-
- fetch(apiUrl, options)
- .then(
- (response) => {
- if (response.status == 204) {
- setMessage(this.$t("Package deleted"))
- this.$router.push("/cgi-bin/koha/erm/packages")
- } else {
- setError(response.message || response.statusText)
- }
- }
- ).catch(
- (error) => {
- setError(error)
- }
- )
- }
- },
- name: "PackagesFormConfirmDelete",
-}
-</script>
+++ /dev/null
-<template>
- <div v-if="!this.initialized">{{ $t("Loading") }}</div>
- <div v-else-if="this.packages" id="packages_list">
- <Toolbar />
- <table v-if="this.packages.length" id="package_list"></table>
- <div v-else-if="this.initialized" class="dialog message">
- {{ $t("There are no packages defined") }}
- </div>
- </div>
-</template>
-
-<script>
-import Toolbar from "./PackagesToolbar.vue"
-import { createVNode, render } from 'vue'
-import { useVendorStore } from "../../stores/vendors"
-import { useAVStore } from "../../stores/authorised_values"
-import { storeToRefs } from "pinia"
-import { fetchPackages } from "../../fetch"
-
-export default {
- setup() {
- const vendorStore = useVendorStore()
- const { vendors } = storeToRefs(vendorStore)
-
- const AVStore = useAVStore()
- const { av_package_types, av_package_content_types } = storeToRefs(AVStore)
-
- return {
- vendors,
- av_package_types,
- av_package_content_types,
- }
- },
- data: function () {
- return {
- packages: [],
- initialized: false,
- }
- },
- beforeRouteEnter(to, from, next) {
- next(vm => {
- vm.getPackages()
- })
- },
- methods: {
- async getPackages() {
- const packages = await fetchPackages()
- this.packages = packages
- this.initialized = true
- },
- show_package: function (package_id) {
- this.$router.push("/cgi-bin/koha/erm/packages/" + package_id)
- },
- edit_package: function (package_id) {
- this.$router.push("/cgi-bin/koha/erm/packages/edit/" + package_id)
- },
- delete_package: function (package_id) {
- this.$router.push("/cgi-bin/koha/erm/packages/delete/" + package_id)
- },
- },
- updated() {
- let show_package = this.show_package
- let edit_package = this.edit_package
- let delete_package = this.delete_package
- window['vendors'] = this.vendors.map(e => {
- e['_id'] = e['id']
- e['_str'] = e['name']
- return e
- })
- let vendors_map = this.vendors.reduce((map, e) => {
- map[e.id] = e
- return map
- }, {})
- window['av_package_types'] = this.av_package_types.map(e => {
- e['_id'] = e['authorised_value']
- e['_str'] = e['lib']
- return e
- })
- let av_package_types_map = this.av_package_types.reduce((map, e) => {
- map[e.authorised_value] = e
- return map
- }, {})
- window['av_package_content_types'] = this.av_package_content_types.map(e => {
- e['_id'] = e['authorised_value']
- e['_str'] = e['lib']
- return e
- })
- let av_package_content_types_map = this.av_package_content_types.reduce((map, e) => {
- map[e.authorised_value] = e
- return map
- }, {})
-
- $('#package_list').kohaTable({
- "ajax": {
- "url": packages_table_url,
- },
- "order": [[0, "asc"]],
- "columnDefs": [{
- "targets": [0],
- "render": function (data, type, row, meta) {
- if (type == 'display') {
- return escape_str(data)
- }
- return data
- }
- }],
- "columns": [
- {
- "title": __("Name"),
- "data": ["me.package_id", "me.name"],
- "searchable": true,
- "orderable": true,
- // Rendering done in drawCallback
- },
- {
- "title": __("Vendor"),
- "data": "vendor_id",
- "searchable": true,
- "orderable": true,
- "render": function (data, type, row, meta) {
- return row.vendor_id != undefined ? escape_str(vendors_map[row.vendor_id].name) : ""
- }
- },
- {
- "title": __("Type"),
- "data": "package_type",
- "searchable": true,
- "orderable": true,
- "render": function (data, type, row, meta) {
- return row.package_type != undefined && row.package_type != "" ? escape_str(av_package_types_map[row.package_type].lib) : ""
- }
- },
- {
- "title": __("Content type"),
- "data": "package_type",
- "searchable": true,
- "orderable": true,
- "render": function (data, type, row, meta) {
- return row.content_type != undefined && row.content_type != "" ? escape_str(av_package_content_types_map[row.content_type].lib) : ""
- }
- },
- {
- "title": __("Created on"),
- "data": "created_on",
- "searchable": true,
- "orderable": true,
- "render": function (data, type, row, meta) {
- return $date(row.created_on)
- }
- },
- {
- "title": __("Actions"),
- "data": function (row, type, val, meta) {
- return '<div class="actions"></div>'
- },
- "className": "actions noExport",
- "searchable": false,
- "orderable": false
- }
- ],
- drawCallback: function (settings) {
-
- var api = new $.fn.dataTable.Api(settings)
-
- $.each($(this).find("td .actions"), function (index, e) {
- let package_id = api.row(index).data().package_id
- let editButton = createVNode("a", {
- class: "btn btn-default btn-xs", role: "button", onClick: () => {
- edit_package(package_id)
- }
- },
- [createVNode("i", { class: "fa fa-pencil", 'aria-hidden': "true" }), __("Edit")])
-
- let deleteButton = createVNode("a", {
- class: "btn btn-default btn-xs", role: "button", onClick: () => {
- delete_package(package_id)
- }
- },
- [createVNode("i", { class: "fa fa-trash", 'aria-hidden': "true" }), __("Delete")])
-
- let n = createVNode('span', {}, [editButton, " ", deleteButton])
- render(n, e)
- })
-
- $.each($(this).find("tbody tr td:first-child"), function (index, e) {
- let row = api.row(index).data()
- if (!row) return // Happen if the table is empty
- let n = createVNode("a", {
- role: "button",
- onClick: () => {
- show_package(row.package_id)
- }
- },
- `${row.name} (#${row.package_id})`
- )
- render(n, e)
- })
- },
- preDrawCallback: function (settings) {
- var table_id = settings.nTable.id
- $("#" + table_id).find("thead th").eq(1).attr('data-filter', 'vendors')
- $("#" + table_id).find("thead th").eq(2).attr('data-filter', 'av_package_types')
- $("#" + table_id).find("thead th").eq(3).attr('data-filter', 'av_package_content_types')
- }
-
- }, package_table_settings, 1)
- },
- beforeUnmount() {
- $('#package_list')
- .DataTable()
- .destroy(true)
- },
- components: { Toolbar },
- name: "packagesList",
-}
-</script>
+++ /dev/null
-<template>
- <div v-if="!this.initialized">{{ $t("Loading") }}</div>
- <div v-else id="packages_show">
- <h2>
- {{ $t("Package.id", { id: erm_package.package_id }) }}
- <span class="action_links">
- <router-link
- :to="`/cgi-bin/koha/erm/packages/edit/${erm_package.package_id}`"
- :title="$t('Edit')"
- ><i class="fa fa-pencil"></i
- ></router-link>
-
- <router-link
- :to="`/cgi-bin/koha/erm/packages/delete/${erm_package.package_id}`"
- :title="$t('Delete')"
- ><i class="fa fa-trash"></i
- ></router-link>
- </span>
- </h2>
- <div>
- <fieldset class="rows">
- <ol>
- <li>
- <label>{{ $t("Package name") }}:</label>
- <span>
- {{ erm_package.name }}
- </span>
- </li>
- <li>
- <label>{{ $t("Vendor") }}:</label>
- <span v-if="erm_package.vendor_id">
- {{
- vendors.find(
- (e) => e.id == erm_package.vendor_id
- ).name
- }}
- </span>
- </li>
- <li v-if="erm_package.external_package_id">
- <label>{{ $t("External ID") }}:</label>
- <span>
- {{ erm_package.external_package_id }}
- </span>
- </li>
- <li>
- <label>{{ $t("Package type") }}:</label>
- <span>{{
- get_lib_from_av(
- "av_package_types",
- erm_package.package_type
- )
- }}</span>
- </li>
- <li>
- <label>{{ $t("Content type") }}:</label>
- <span>{{
- get_lib_from_av(
- "av_package_content_types",
- erm_package.content_type
- )
- }}</span>
- </li>
- <li>
- <label>{{ $t("Created on") }}:</label>
- <span>{{ format_date(erm_package.created_on) }}</span>
- </li>
- </ol>
- </fieldset>
- <fieldset class="action">
- <router-link
- to="/cgi-bin/koha/erm/packages"
- role="button"
- class="cancel"
- >{{ $t("Close") }}</router-link
- >
- </fieldset>
- </div>
- </div>
-</template>
-
-<script>
-import { useVendorStore } from "../../stores/vendors"
-import { useAVStore } from "../../stores/authorised_values"
-import { fetchPackage } from "../../fetch"
-import { storeToRefs } from "pinia"
-
-export default {
- setup() {
- const format_date = $date
-
- const vendorStore = useVendorStore()
- const { vendors } = storeToRefs(vendorStore)
-
- const AVStore = useAVStore()
- const { get_lib_from_av } = AVStore
-
- return {
- format_date,
- get_lib_from_av,
- vendors,
- }
- },
- data() {
- return {
- erm_package: {
- package_id: null,
- vendor_id: null,
- name: '',
- external_package_id: '',
- package_type: '',
- content_type: '',
- created_on: null,
- },
- initialized: false,
- }
- },
- beforeRouteEnter(to, from, next) {
- next(vm => {
- vm.getPackage(to.params.package_id)
- })
- },
- beforeRouteUpdate(to, from) {
- this.erm_package = this.getPackage(to.params.package_id)
- },
- methods: {
- async getPackage(package_id) {
- const erm_package = await fetchPackage(package_id)
- this.erm_package = erm_package
- this.initialized = true
- },
- },
- name: "PackagesShow",
-}
-</script>
-<style scoped>
-.action_links a {
- padding-left: 0.2em;
- font-size: 11px;
-}
-</style>
\ No newline at end of file
+++ /dev/null
-<template>
- <router-link to="/cgi-bin/koha/erm/packages/add" class="btn btn-default"
- ><font-awesome-icon icon="plus" />
- {{ $t("New package") }}</router-link
- >
-</template>
-
-<script>
-export default {
- name: "PackagesToolbar",
-}
-</script>
export const fetchPackage = async function (package_id) {
if (!package_id) return;
- const apiUrl = "/api/v1/erm/packages/" + package_id;
+ const apiUrl = "/api/v1/erm/eholdings/packages/" + package_id;
let erm_package;
await fetch(apiUrl, {
headers: {
};
export const fetchPackages = async function () {
- const apiUrl = "/api/v1/erm/packages";
+ const apiUrl = "/api/v1/erm/eholdings/packages";
let packages;
await fetch(apiUrl)
.then(checkError)
return packages;
};
-export const fetchEHolding = async function (eholding_id) {
- if (!eholding_id) return;
- const apiUrl = "/api/v1/erm/eholdings/" + eholding_id;
- let erm_eholding;
+export const fetchTitle = async function (title_id) {
+ if (!title_id) return;
+ const apiUrl = "/api/v1/erm/eholdings/titles/" + title_id;
+ let title;
await fetch(apiUrl, {
headers: {
- "x-koha-embed": "eholding_packages,eholding_packages.package",
+ "x-koha-embed": "resources,resources.package",
},
})
.then(checkError)
.then(
(result) => {
- erm_eholding = result;
+ title = result;
},
(error) => {
setError(error);
}
);
- return erm_eholding;
+ return title;
};
-export const fetchEHoldings = async function () {
- const apiUrl = "/api/v1/erm/eholdings";
- let eholdings;
+export const fetchTitles = async function () {
+ const apiUrl = "/api/v1/erm/eholdings/titles";
+ let titles;
await fetch(apiUrl)
.then(checkError)
.then(
(result) => {
- eholdings = result;
+ titles = result;
},
(error) => {
setError(error);
}
);
- return eholdings;
+ return titles;
};
function checkError(response) {
import AgreementsShow from "./components/ERM/AgreementsShow.vue";
import AgreementsFormAdd from "./components/ERM/AgreementsFormAdd.vue";
import AgreementsFormConfirmDelete from "./components/ERM/AgreementsFormConfirmDelete.vue";
-import PackagesList from "./components/ERM/PackagesList.vue";
-import PackagesShow from "./components/ERM/PackagesShow.vue";
-import PackagesFormAdd from "./components/ERM/PackagesFormAdd.vue";
-import PackagesFormConfirmDelete from "./components/ERM/PackagesFormConfirmDelete.vue";
-import EHoldingsList from "./components/ERM/EHoldingsList.vue";
-import EHoldingsShow from "./components/ERM/EHoldingsShow.vue";
-import EHoldingsFormAdd from "./components/ERM/EHoldingsFormAdd.vue";
-import EHoldingsFormConfirmDelete from "./components/ERM/EHoldingsFormConfirmDelete.vue";
+import EHoldingsPackagesList from "./components/ERM/EHoldingsPackagesList.vue";
+import EHoldingsPackagesShow from "./components/ERM/EHoldingsPackagesShow.vue";
+import EHoldingsPackagesFormAdd from "./components/ERM/EHoldingsPackagesFormAdd.vue";
+import EHoldingsPackagesFormConfirmDelete from "./components/ERM/EHoldingsPackagesFormConfirmDelete.vue";
+import EHoldingsTitlesList from "./components/ERM/EHoldingsTitlesList.vue";
+import EHoldingsTitlesShow from "./components/ERM/EHoldingsTitlesShow.vue";
+import EHoldingsTitlesFormAdd from "./components/ERM/EHoldingsTitlesFormAdd.vue";
+import EHoldingsTitlesFormConfirmDelete from "./components/ERM/EHoldingsTitlesFormConfirmDelete.vue";
import LicensesList from "./components/ERM/LicensesList.vue";
import LicensesShow from "./components/ERM/LicensesShow.vue";
import LicensesFormAdd from "./components/ERM/LicensesFormAdd.vue";
path: "/cgi-bin/koha/erm/erm.pl",
},
agreements: { text: "Agreements", path: "/cgi-bin/koha/erm/agreements" },
- packages: { text: "Packages", path: "/cgi-bin/koha/erm/packages" },
- eholdings: { text: "eHoldings", path: "/cgi-bin/koha/erm/eholdings" },
+ eholdings: {
+ titles: { text: "eHoldings", path: "/cgi-bin/koha/erm/eholdings" },
+ packages: {
+ text: "Packages",
+ path: "/cgi-bin/koha/erm/eholdings/packages",
+ },
+ },
licenses: { text: "Licenses", path: "/cgi-bin/koha/erm/licenses" },
};
export const routes = [
},
},
{
- path: "/cgi-bin/koha/erm/packages",
- component: PackagesList,
+ path: "/cgi-bin/koha/erm/eholdings/packages",
+ component: EHoldingsPackagesList,
meta: {
breadcrumb: [
breadcrumbs.home,
breadcrumbs.erm_home,
- breadcrumbs.packages,
+ breadcrumbs.eholdings.packages,
],
view: "list",
},
},
{
- path: "/cgi-bin/koha/erm/packages/:package_id",
- component: PackagesShow,
+ path: "/cgi-bin/koha/erm/eholdings/packages/:package_id",
+ component: EHoldingsPackagesShow,
meta: {
breadcrumb: [
breadcrumbs.home,
breadcrumbs.erm_home,
- breadcrumbs.packages,
+ breadcrumbs.eholdings.packages,
],
view: "show",
},
},
{
- path: "/cgi-bin/koha/erm/packages/delete/:package_id",
- component: PackagesFormConfirmDelete,
+ path: "/cgi-bin/koha/erm/eholdings/packages/delete/:package_id",
+ component: EHoldingsPackagesFormConfirmDelete,
meta: {
breadcrumb: [
breadcrumbs.home,
breadcrumbs.erm_home,
- breadcrumbs.packages,
+ breadcrumbs.eholdings.packages,
],
view: "confirm-delete-form",
},
},
{
- path: "/cgi-bin/koha/erm/packages/add",
- component: PackagesFormAdd,
+ path: "/cgi-bin/koha/erm/eholdings/packages/add",
+ component: EHoldingsPackagesFormAdd,
meta: {
breadcrumb: [
breadcrumbs.home,
breadcrumbs.erm_home,
- breadcrumbs.packages,
+ breadcrumbs.eholdings.packages,
],
view: "add",
},
},
{
- path: "/cgi-bin/koha/erm/packages/edit/:package_id",
- component: PackagesFormAdd,
+ path: "/cgi-bin/koha/erm/eholdings/packages/edit/:package_id",
+ component: EHoldingsPackagesFormAdd,
meta: {
breadcrumb: [
breadcrumbs.home,
breadcrumbs.erm_home,
- breadcrumbs.packages,
+ breadcrumbs.eholdings.packages,
],
view: "edit",
},
},
{
- path: "/cgi-bin/koha/erm/eholdings",
- component: EHoldingsList,
+ path: "/cgi-bin/koha/erm/eholdings/titles",
+ component: EHoldingsTitlesList,
meta: {
breadcrumb: [
breadcrumbs.home,
breadcrumbs.erm_home,
- breadcrumbs.eholdings,
+ breadcrumbs.eholdings.titles,
],
view: "list",
},
},
{
- path: "/cgi-bin/koha/erm/eholdings/:eholding_id",
- component: EHoldingsShow,
+ path: "/cgi-bin/koha/erm/eholdings/titles/:title_id",
+ component: EHoldingsTitlesShow,
meta: {
breadcrumb: [
breadcrumbs.home,
breadcrumbs.erm_home,
- breadcrumbs.eholdings,
+ breadcrumbs.eholdings.titles,
],
view: "show",
},
},
{
- path: "/cgi-bin/koha/erm/eholdings/delete/:eholding_id",
- component: EHoldingsFormConfirmDelete,
+ path: "/cgi-bin/koha/erm/eholdings/titles/delete/:title_id",
+ component: EHoldingsTitlesFormConfirmDelete,
meta: {
breadcrumb: [
breadcrumbs.home,
breadcrumbs.erm_home,
- breadcrumbs.eholdings,
+ breadcrumbs.eholdings.titles,
],
view: "confirm-delete-form",
},
},
{
- path: "/cgi-bin/koha/erm/eholdings/add",
- component: EHoldingsFormAdd,
+ path: "/cgi-bin/koha/erm/eholdings/titles/add",
+ component: EHoldingsTitlesFormAdd,
meta: {
breadcrumb: [
breadcrumbs.home,
breadcrumbs.erm_home,
- breadcrumbs.eholdings,
+ breadcrumbs.eholdings.titles,
],
view: "add",
},
},
{
- path: "/cgi-bin/koha/erm/eholdings/edit/:eholding_id",
- component: EHoldingsFormAdd,
+ path: "/cgi-bin/koha/erm/eholdings/titles/edit/:title_id",
+ component: EHoldingsTitlesFormAdd,
meta: {
breadcrumb: [
breadcrumbs.home,
breadcrumbs.erm_home,
- breadcrumbs.eholdings,
+ breadcrumbs.eholdings.titles,
],
view: "edit",
},