Bug 32030: Disable the module if the pref is not enabled

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:
Jonathan Druart 2022-07-05 10:06:41 +02:00 committed by Tomas Cohen Arazi
parent 111622efcc
commit 521171bef1
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
2 changed files with 106 additions and 88 deletions

View file

@ -52,6 +52,8 @@
const ERMProviders = "[% Koha.Preference('ERMProviders') | html %]";
const erm_providers = ERMProviders.split(',');
const ERMModule = [% IF Koha.Preference('ERMModule') %]true[% ELSE %]false[% END %];
</script>
[% Asset.js("js/vue/dist/main.js") | $raw %]

View file

@ -1,103 +1,118 @@
<template>
<Breadcrumb />
<div class="main container-fluid">
<div class="row">
<div class="col-sm-10 col-sm-push-2">
<main>
<Dialog />
<router-view />
</main>
</div>
<div class="col-sm-2 col-sm-pull-10">
<aside>
<div id="navmenu">
<div id="navmenulist">
<h5>{{ $t("E-Resource management") }}</h5>
<ul>
<li>
<router-link
to="/cgi-bin/koha/erm/agreements"
>
<i class="fa fa-upload"></i>
{{ $t("Agreements") }}</router-link
>
</li>
<li>
<router-link
to="/cgi-bin/koha/erm/licenses"
>
<i class="fa fa-file-text-o"></i>
{{ $t("Licenses") }}</router-link
>
</li>
<li>
<router-link
to="/cgi-bin/koha/erm/eholdings"
>
<i class="fa fa-file-text-o"></i>
{{ $t("eHoldings") }}</router-link
>
</li>
<div v-if="ERMModule">
<Breadcrumb />
<div class="main container-fluid">
<div class="row">
<div class="col-sm-10 col-sm-push-2">
<main>
<Dialog />
<router-view />
</main>
</div>
<div class="col-sm-2 col-sm-pull-10">
<aside>
<div id="navmenu">
<div id="navmenulist">
<h5>{{ $t("E-Resource management") }}</h5>
<ul>
<li
v-for="provider in erm_providers"
:key="provider"
>
<li>
<router-link
v-if="provider == 'local'"
:to="`/cgi-bin/koha/erm/eholdings/local`"
to="/cgi-bin/koha/erm/agreements"
>
<i class="fa fa-file-text-o"></i>
{{ $t("Local") }}</router-link
<i class="fa fa-upload"></i>
{{ $t("Agreements") }}</router-link
>
<router-link
v-else-if="provider == 'ebsco'"
:to="`/cgi-bin/koha/erm/eholdings/ebsco`"
>
<i class="fa fa-file-text-o"></i>
{{ $t("EBSCO") }}</router-link
>
<ul>
<li>
<router-link
:to="`/cgi-bin/koha/erm/eholdings/${provider}/packages`"
>
<i
class="
fa fa-file-text-o
"
></i>
{{
$t("Packages")
}}</router-link
>
</li>
<li>
<router-link
:to="`/cgi-bin/koha/erm/eholdings/${provider}/titles`"
>
<i
class="
fa fa-file-text-o
"
></i>
{{
$t("Titles")
}}</router-link
>
</li>
</ul>
</li>
<li>
<router-link
to="/cgi-bin/koha/erm/licenses"
>
<i class="fa fa-file-text-o"></i>
{{ $t("Licenses") }}</router-link
>
</li>
<li>
<router-link
to="/cgi-bin/koha/erm/eholdings"
>
<i class="fa fa-file-text-o"></i>
{{ $t("eHoldings") }}</router-link
>
</li>
<ul>
<li
v-for="provider in erm_providers"
:key="provider"
>
<router-link
v-if="provider == 'local'"
:to="`/cgi-bin/koha/erm/eholdings/local`"
>
<i
class="fa fa-file-text-o"
></i>
{{ $t("Local") }}</router-link
>
<router-link
v-else-if="provider == 'ebsco'"
:to="`/cgi-bin/koha/erm/eholdings/ebsco`"
>
<i
class="fa fa-file-text-o"
></i>
{{ $t("EBSCO") }}</router-link
>
<ul>
<li>
<router-link
:to="`/cgi-bin/koha/erm/eholdings/${provider}/packages`"
>
<i
class="
fa
fa-file-text-o
"
></i>
{{
$t("Packages")
}}</router-link
>
</li>
<li>
<router-link
:to="`/cgi-bin/koha/erm/eholdings/${provider}/titles`"
>
<i
class="
fa
fa-file-text-o
"
></i>
{{
$t("Titles")
}}</router-link
>
</li>
</ul>
</li>
</ul>
</ul>
</ul>
</div>
</div>
</div>
</aside>
</aside>
</div>
</div>
</div>
</div>
<div v-else>
{{
$t(
"The E-Resource management module is disabled. Turn on 'ERMModule' to use it."
)
}}
</div>
</template>
<script>
@ -126,6 +141,7 @@ export default {
return {
vendorStore,
erm_providers,
ERMModule,
}
},
data() {