Bug 32030: Add links to vendors
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
98e3f85788
commit
35ba0baa9c
4 changed files with 27 additions and 14 deletions
|
@ -21,6 +21,7 @@ use Koha::Database;
|
|||
|
||||
use base qw(Koha::Object);
|
||||
|
||||
use Koha::Acquisition::Booksellers;
|
||||
use Koha::ERM::EHoldings::Package::Agreements;
|
||||
use Koha::ERM::EHoldings::Resources;
|
||||
|
||||
|
@ -70,6 +71,19 @@ sub resources {
|
|||
return Koha::ERM::EHoldings::Resources->_new_from_dbic($rs);
|
||||
}
|
||||
|
||||
=head3 vendor
|
||||
|
||||
Returns the vendor
|
||||
|
||||
=cut
|
||||
|
||||
sub vendor {
|
||||
my ( $self ) = @_;
|
||||
my $rs = $self->_result->vendor;
|
||||
return unless $rs;
|
||||
return Koha::Acquisition::Bookseller->_new_from_dbic($rs);
|
||||
}
|
||||
|
||||
=head2 Internal methods
|
||||
|
||||
=head3 _type
|
||||
|
|
|
@ -43,6 +43,10 @@ properties:
|
|||
description: resources
|
||||
items:
|
||||
$ref: erm_eholdings_resource.yaml
|
||||
vendor:
|
||||
type:
|
||||
- object
|
||||
- "null"
|
||||
|
||||
additionalProperties: false
|
||||
required:
|
||||
|
|
|
@ -28,18 +28,19 @@
|
|||
</li>
|
||||
<li>
|
||||
<label>{{ $t("Vendor") }}:</label>
|
||||
<span v-if="erm_package.vendor_id">
|
||||
{{
|
||||
vendors.find(
|
||||
(e) => e.id == erm_package.vendor_id
|
||||
).name
|
||||
}}
|
||||
<span v-if="erm_package.vendor"
|
||||
><a :href="`/cgi-bin/koha/acqui/booksellers.pl?booksellerid=${erm_package.vendor_id}`">{{ erm_package.vendor.name }}</a>
|
||||
</span>
|
||||
</li>
|
||||
<li v-if="erm_package.external_id">
|
||||
<label>{{ $t("External ID") }}:</label>
|
||||
<span>
|
||||
<!-- FIXME Create a syspref to store the URL -->
|
||||
<a
|
||||
:href="`https://ptfs-europe-demo.folio.ebsco.com/eholdings/packages/${erm_package.vendor.external_id}-${erm_package.external_id}`"
|
||||
>
|
||||
{{ erm_package.external_id }}
|
||||
</a>
|
||||
</span>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -107,25 +108,19 @@
|
|||
</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() {
|
||||
|
|
|
@ -110,7 +110,7 @@ export const fetchPackage = async function (package_id) {
|
|||
let erm_package;
|
||||
await fetch(apiUrl, {
|
||||
headers: {
|
||||
"x-koha-embed": "package_agreements,package_agreements.agreement,resources,resources.title",
|
||||
"x-koha-embed": "package_agreements,package_agreements.agreement,resources,resources.title,vendor",
|
||||
},
|
||||
})
|
||||
.then(checkError)
|
||||
|
|
Loading…
Reference in a new issue