Bug 32030: Display the list of packages on the 'show agreement' view
Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
a596acc28e
commit
3fdc503ca7
8 changed files with 95 additions and 43 deletions
|
@ -27,6 +27,7 @@ use Koha::ERM::Agreement::UserRoles;
|
||||||
use Koha::ERM::Agreement::Licenses;
|
use Koha::ERM::Agreement::Licenses;
|
||||||
use Koha::ERM::Agreement::Relationships;
|
use Koha::ERM::Agreement::Relationships;
|
||||||
use Koha::ERM::Agreement::Documents;
|
use Koha::ERM::Agreement::Documents;
|
||||||
|
use Koha::ERM::EHoldings::Package::Agreements;
|
||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
|
||||||
|
@ -200,6 +201,18 @@ sub documents {
|
||||||
return Koha::ERM::Agreement::Documents->_new_from_dbic($documents_rs);
|
return Koha::ERM::Agreement::Documents->_new_from_dbic($documents_rs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
=head3 agreement_packages
|
||||||
|
|
||||||
|
Return the local packages for this agreement (and the other ones that have an entry locally)
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub agreement_packages {
|
||||||
|
my ( $self ) = @_;
|
||||||
|
my $packages_agreements_rs = $self->_result->erm_eholdings_packages_agreements;
|
||||||
|
return Koha::ERM::EHoldings::Package::Agreements->_new_from_dbic($packages_agreements_rs);
|
||||||
|
}
|
||||||
|
|
||||||
=head2 Internal methods
|
=head2 Internal methods
|
||||||
|
|
||||||
=head3 _type
|
=head3 _type
|
||||||
|
|
|
@ -84,26 +84,6 @@ sub vendor {
|
||||||
return Koha::Acquisition::Bookseller->_new_from_dbic($rs);
|
return Koha::Acquisition::Bookseller->_new_from_dbic($rs);
|
||||||
}
|
}
|
||||||
|
|
||||||
=head3 to_api_mapping
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
sub to_api_mapping {
|
|
||||||
my ( $self ) = @_;
|
|
||||||
|
|
||||||
return {
|
|
||||||
external_id => undef,
|
|
||||||
( # Do we really need this?
|
|
||||||
$self->external_id
|
|
||||||
? (
|
|
||||||
package_id => $self->external_id,
|
|
||||||
koha_internal_id => $self->package_id
|
|
||||||
)
|
|
||||||
: ()
|
|
||||||
)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
=head2 Internal methods
|
=head2 Internal methods
|
||||||
|
|
||||||
=head3 _type
|
=head3 _type
|
||||||
|
|
|
@ -20,6 +20,7 @@ use Modern::Perl;
|
||||||
use Koha::Database;
|
use Koha::Database;
|
||||||
|
|
||||||
use Koha::ERM::Agreement;
|
use Koha::ERM::Agreement;
|
||||||
|
use Koha::ERM::EHoldings::Package;
|
||||||
|
|
||||||
use base qw(Koha::Object);
|
use base qw(Koha::Object);
|
||||||
|
|
||||||
|
@ -45,6 +46,18 @@ sub agreement {
|
||||||
return Koha::ERM::Agreement->_new_from_dbic($agreement_rs);
|
return Koha::ERM::Agreement->_new_from_dbic($agreement_rs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
=head3 package
|
||||||
|
|
||||||
|
Return the package linked to this package package
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub package {
|
||||||
|
my ( $self ) = @_;
|
||||||
|
my $package_rs = $self->_result->package;
|
||||||
|
return Koha::ERM::EHoldings::Package->_new_from_dbic($package_rs);
|
||||||
|
}
|
||||||
|
|
||||||
=head2 Internal methods
|
=head2 Internal methods
|
||||||
|
|
||||||
=head3 _type
|
=head3 _type
|
||||||
|
|
|
@ -197,6 +197,7 @@
|
||||||
- agreement_relationships.agreement
|
- agreement_relationships.agreement
|
||||||
- agreement_relationships.related_agreement
|
- agreement_relationships.related_agreement
|
||||||
- documents
|
- documents
|
||||||
|
- packages
|
||||||
put:
|
put:
|
||||||
x-mojo-to: ERM::Agreements#update
|
x-mojo-to: ERM::Agreements#update
|
||||||
operationId: updateErmAgreements
|
operationId: updateErmAgreements
|
||||||
|
|
|
@ -36,6 +36,7 @@ function get_agreement() {
|
||||||
user_roles: [],
|
user_roles: [],
|
||||||
agreement_licenses: [],
|
agreement_licenses: [],
|
||||||
agreement_relationships: [],
|
agreement_relationships: [],
|
||||||
|
agreement_packages: [],
|
||||||
documents: [],
|
documents: [],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -312,6 +312,8 @@ export default {
|
||||||
|
|
||||||
agreement.documents = agreement.documents.map(({ document_id, ...keepAttrs }) => keepAttrs)
|
agreement.documents = agreement.documents.map(({ document_id, ...keepAttrs }) => keepAttrs)
|
||||||
|
|
||||||
|
delete agreement.agreement_packages
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
method: method,
|
method: method,
|
||||||
body: JSON.stringify(agreement),
|
body: JSON.stringify(agreement),
|
||||||
|
|
|
@ -78,7 +78,7 @@
|
||||||
<span>{{ agreement.license_info }}</span>
|
<span>{{ agreement.license_info }}</span>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li>
|
<li v-if="agreement.periods.length">
|
||||||
<label>{{ $t("Periods") }}</label>
|
<label>{{ $t("Periods") }}</label>
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
|
@ -111,7 +111,7 @@
|
||||||
</table>
|
</table>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li>
|
<li v-if="agreement.user_roles.length">
|
||||||
<label>{{ $t("Users") }}</label>
|
<label>{{ $t("Users") }}</label>
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
|
@ -139,7 +139,7 @@
|
||||||
</table>
|
</table>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li>
|
<li v-if="agreement.agreement_licenses.length">
|
||||||
<label>{{ $t("Licenses") }}</label>
|
<label>{{ $t("Licenses") }}</label>
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
|
@ -186,27 +186,64 @@
|
||||||
</table>
|
</table>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li>
|
<li v-if="agreement.agreement_relationships.length">
|
||||||
<label>{{ $t("Related agreements") }}</label>
|
<label>{{ $t("Related agreements") }}</label>
|
||||||
<div
|
<div id="agreement_relationships">
|
||||||
v-for="relationship in agreement.agreement_relationships"
|
<div
|
||||||
v-bind:key="relationship.related_agreement_id"
|
v-for="relationship in agreement.agreement_relationships"
|
||||||
>
|
v-bind:key="relationship.related_agreement_id"
|
||||||
<span
|
|
||||||
><router-link
|
|
||||||
:to="`/cgi-bin/koha/erm/agreements/${relationship.related_agreement.agreement_id}`"
|
|
||||||
>{{
|
|
||||||
relationship.related_agreement.name
|
|
||||||
}}</router-link
|
|
||||||
></span
|
|
||||||
>
|
>
|
||||||
{{
|
<span
|
||||||
get_lib_from_av(
|
><router-link
|
||||||
"av_agreement_relationships",
|
:to="`/cgi-bin/koha/erm/agreements/${relationship.related_agreement.agreement_id}`"
|
||||||
relationship.relationship
|
>{{
|
||||||
)
|
relationship.related_agreement.name
|
||||||
}}
|
}}</router-link
|
||||||
{{ agreement.name }}
|
></span
|
||||||
|
>
|
||||||
|
{{
|
||||||
|
get_lib_from_av(
|
||||||
|
"av_agreement_relationships",
|
||||||
|
relationship.relationship
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
{{ agreement.name }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li v-if="agreement.agreement_packages.length">
|
||||||
|
<label>{{ $t("Packages") }}</label>
|
||||||
|
<div id="agreement_packages">
|
||||||
|
<div
|
||||||
|
v-for="agreement_package in agreement.agreement_packages"
|
||||||
|
v-bind:key="agreement_package.package_id"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
v-if="
|
||||||
|
agreement_package.package.external_id &&
|
||||||
|
agreement_package.package.provider ==
|
||||||
|
'ebsco'
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<router-link
|
||||||
|
:to="`/cgi-bin/koha/erm/eholdings/ebsco/packages/${agreement_package.package.external_id}`"
|
||||||
|
>{{
|
||||||
|
agreement_package.package.name
|
||||||
|
}}</router-link
|
||||||
|
>
|
||||||
|
(EBSCO)</span
|
||||||
|
>
|
||||||
|
<span v-else
|
||||||
|
><router-link
|
||||||
|
:to="`/cgi-bin/koha/erm/eholdings/local/packages/${agreement_package.package.package_id}`"
|
||||||
|
>{{
|
||||||
|
agreement_package.package.name
|
||||||
|
}}</router-link
|
||||||
|
>
|
||||||
|
(local)</span
|
||||||
|
>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
|
@ -262,6 +299,7 @@ export default {
|
||||||
license_info: '',
|
license_info: '',
|
||||||
periods: [],
|
periods: [],
|
||||||
user_roles: [],
|
user_roles: [],
|
||||||
|
agreement_packages: [],
|
||||||
},
|
},
|
||||||
initialized: false,
|
initialized: false,
|
||||||
}
|
}
|
||||||
|
@ -289,4 +327,8 @@ export default {
|
||||||
padding-left: 0.2em;
|
padding-left: 0.2em;
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
}
|
}
|
||||||
|
#agreement_relationships,
|
||||||
|
#agreement_packages {
|
||||||
|
padding-left: 10rem;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
|
@ -7,7 +7,7 @@ export const fetchAgreement = async function (agreement_id) {
|
||||||
await fetch(apiUrl, {
|
await fetch(apiUrl, {
|
||||||
headers: {
|
headers: {
|
||||||
"x-koha-embed":
|
"x-koha-embed":
|
||||||
"periods,user_roles,user_roles.patron,agreement_licenses,agreement_licenses.license,agreement_relationships,agreement_relationships.related_agreement,documents",
|
"periods,user_roles,user_roles.patron,agreement_licenses,agreement_licenses.license,agreement_relationships,agreement_relationships.related_agreement,documents,agreement_packages,agreement_packages.package",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then(checkError)
|
.then(checkError)
|
||||||
|
|
Loading…
Reference in a new issue