View | Details | Raw Unified | Return to bug 30708
Collapse All | Expand All

(-)a/Koha/REST/V1/Preservation.pm (+4 lines)
Lines 39-44 Return the configuration options needed for the Preservation Vue app Link Here
39
39
40
sub config {
40
sub config {
41
    my $c = shift->openapi->valid_input or return;
41
    my $c = shift->openapi->valid_input or return;
42
    my $patron = $c->stash('koha.user');
42
    return $c->render(
43
    return $c->render(
43
        status  => 200,
44
        status  => 200,
44
        openapi => {
45
        openapi => {
Lines 47-52 sub config { Link Here
47
                not_for_loan_waiting_list_in  => C4::Context->preference('PreservationNotForLoanWaitingListIn'),
48
                not_for_loan_waiting_list_in  => C4::Context->preference('PreservationNotForLoanWaitingListIn'),
48
                not_for_loan_default_train_in => C4::Context->preference('PreservationNotForLoanDefaultTrainIn'),
49
                not_for_loan_default_train_in => C4::Context->preference('PreservationNotForLoanDefaultTrainIn'),
49
            },
50
            },
51
            permissions => {
52
                'manage_sysprefs' => $patron->has_permission( { parameters => 'manage_sysprefs' } ) ? 1 : 0,
53
            },
50
        },
54
        },
51
    );
55
    );
52
}
56
}
(-)a/api/v1/swagger/definitions/preservation_config.yaml (+3 lines)
Lines 4-7 properties: Link Here
4
  settings:
4
  settings:
5
    type: object
5
    type: object
6
    description: List of sysprefs used for the Preservation module
6
    description: List of sysprefs used for the Preservation module
7
  permissions:
8
    type: object
9
    description: List of permissions of the logged in user used for the Preservation module
7
additionalProperties: false
10
additionalProperties: false
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/Settings.vue (-3 / +44 lines)
Lines 5-11 Link Here
5
            {{ $__("Edit preservation settings") }}
5
            {{ $__("Edit preservation settings") }}
6
        </h2>
6
        </h2>
7
        <div>
7
        <div>
8
            <form @submit="onSubmit($event)">
8
            <form
9
                v-if="config.permissions.manage_sysprefs"
10
                @submit="onSubmit($event)"
11
            >
9
                <fieldset class="rows">
12
                <fieldset class="rows">
10
                    <legend>{{ $__("General settings") }}</legend>
13
                    <legend>{{ $__("General settings") }}</legend>
11
                    <ol>
14
                    <ol>
Lines 72-77 Link Here
72
                    >
75
                    >
73
                </fieldset>
76
                </fieldset>
74
            </form>
77
            </form>
78
            <fieldset v-else class="rows">
79
                <legend>{{ $__("General settings") }}</legend>
80
                <ol>
81
                    <li>
82
                        <label for="not_for_loan_waiting_list_in"
83
                            >{{
84
                                $__("Status for item added to waiting list")
85
                            }}:</label
86
                        >
87
                        <span>{{
88
                            get_lib_from_av(
89
                                "av_notforloan",
90
                                config.settings.not_for_loan_waiting_list_in
91
                            )
92
                        }}</span>
93
                    </li>
94
                    <li>
95
                        <label for="not_for_loan_default_train_in"
96
                            >{{
97
                                $__("Default status for item added to train")
98
                            }}:</label
99
                        >
100
                        <span>{{
101
                            get_lib_from_av(
102
                                "av_notforloan",
103
                                config.settings.not_for_loan_default_train_in
104
                            )
105
                        }}</span>
106
                    </li>
107
                </ol>
108
            </fieldset>
109
75
            <SettingsProcessings />
110
            <SettingsProcessings />
76
        </div>
111
        </div>
77
    </div>
112
    </div>
Lines 87-98 export default { Link Here
87
    setup() {
122
    setup() {
88
        const AVStore = inject("AVStore")
123
        const AVStore = inject("AVStore")
89
        const { av_notforloan } = storeToRefs(AVStore)
124
        const { av_notforloan } = storeToRefs(AVStore)
125
        const { get_lib_from_av } = AVStore
90
126
91
        const { setMessage, setWarning } = inject("mainStore")
127
        const { setMessage, setWarning } = inject("mainStore")
92
        const PreservationStore = inject("PreservationStore")
128
        const PreservationStore = inject("PreservationStore")
93
        const { config } = PreservationStore
129
        const { config } = PreservationStore
94
130
95
        return { av_notforloan, setMessage, setWarning, config }
131
        return {
132
            av_notforloan,
133
            get_lib_from_av,
134
            setMessage,
135
            setWarning,
136
            config,
137
        }
96
    },
138
    },
97
    data() {
139
    data() {
98
        return {
140
        return {
99
- 

Return to bug 30708