Bug 38208: Provide a link from vendors to ERM

This patch provides a link in the left hand menu so that from a vendor record you can access ERM agreements and licenses relevant to that vendor

Test plan:
1) Apply patch and reset_all
2) Navigate to ERM and create some agreements and licenses that link to a vendor and some that don't
3) Navigate to a vendor record
4) There should be links in the left hand menu for agreements and licenses
5) Click on these and you should be taken to ERM and see a filtered table based on that vendor

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Matt Blenkinsop 2024-10-18 14:18:23 +00:00 committed by Lucas Gass
parent e5575d6c0c
commit 17cea3929c
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
6 changed files with 44 additions and 2 deletions

View File

@ -216,6 +216,7 @@ sub config {
gst_values => \@gst_values,
edifact => C4::Context->preference('EDIFACT'),
marc_orders => C4::Context->preference('MarcOrderingAutomation'),
erm_module => C4::Context->preference('ERMModule'),
},
);
}

View File

@ -16,4 +16,7 @@ properties:
marc_orders:
type: boolean
description: MarcOrderingAutomation system preference value
erm_module:
type: boolean
description: ERMModule system preference value
additionalProperties: false

View File

@ -831,6 +831,12 @@ export default {
let url = baseResource.getResourceTableUrl();
if (filters?.by_expired)
url += "?max_expiration_date=" + filters.max_expiration_date;
const vendorId = baseResource.route.query.vendor_id;
if (vendorId) {
url = filters?.by_expired
? url + "&vendor_id=" + vendorId
: url + "?vendor_id=" + vendorId;
}
return url;
};
const filterTable = async (filters, table, embedded = false) => {

View File

@ -288,9 +288,18 @@ export default {
},
],
});
const tableURL = () => {
let url = baseResource.getResourceTableUrl();
const vendorId = baseResource.route.query.vendor_id;
if (vendorId) {
url += "?vendor_id=" + vendorId;
}
return url;
};
const tableOptions = {
url: baseResource.getResourceTableUrl(),
url: tableURL(),
options: { embed: "vendor,extended_attributes,+strings" },
table_settings: license_table_settings,
add_filters: true,

View File

@ -75,6 +75,17 @@
>{{ $__("Uncertain prices") }}</a
>
</li>
<li v-if="ermModule && (erm || isUserPermitted('CAN_user_erm'))">
<a
:href="`/cgi-bin/koha/erm/agreements?vendor_id=${vendorId}`"
>{{ $__("ERM agreements") }}</a
>
</li>
<li v-if="ermModule && (erm || isUserPermitted('CAN_user_erm'))">
<a :href="`/cgi-bin/koha/erm/licenses?vendor_id=${vendorId}`">{{
$__("ERM licenses")
}}</a>
</li>
</ul>
</div>
</template>
@ -103,14 +114,23 @@ export default {
issuemanage: {
type: String,
},
ermmodule: {
type: String,
},
erm: {
type: String,
},
},
setup(props) {
const vendorStore = inject("vendorStore");
const { isUserPermitted } = vendorStore;
const { isUserPermitted, config } = vendorStore;
const navigationStore = inject("navigationStore");
const { params } = storeToRefs(navigationStore);
const vendorId = ref(props.vendorid || params.value.id);
const ermModule = props.ermmodule
? props.ermmodule
: config.settings.ermModule;
const templateRefs = ref([]);
onMounted(() => {
@ -123,6 +143,8 @@ export default {
return {
isUserPermitted,
params,
config,
ermModule,
vendorId,
templateRefs,
};

View File

@ -55,6 +55,7 @@ export default {
client.config.get("vendors").then(result => {
userPermissions.value = result.permissions;
config.value.settings.edifact = result.edifact;
config.value.settings.ermModule = result.erm_module;
config.value.settings.marcOrderAutomation =
result.marcOrderAutomation;
vendorStore.currencies = result.currencies;