Bug 38201: Fix PatronSearch
The event listener was being added infinitely. Meaning that when new realtionships were added, the previously added ones were still firing their previously registered events. Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
c434e3041f
commit
f517d6032e
|
|
@ -287,11 +287,6 @@ export default {
|
|||
type: "resource",
|
||||
value: null,
|
||||
},
|
||||
counter: {
|
||||
type: "string",
|
||||
value: "",
|
||||
indexRequired: true,
|
||||
},
|
||||
label: {
|
||||
type: "string",
|
||||
value: __("User"),
|
||||
|
|
|
|||
|
|
@ -188,11 +188,6 @@ export default {
|
|||
type: "resource",
|
||||
value: null,
|
||||
},
|
||||
counter: {
|
||||
type: "string",
|
||||
value: "",
|
||||
indexRequired: true,
|
||||
},
|
||||
label: {
|
||||
type: "string",
|
||||
value: __("User"),
|
||||
|
|
|
|||
|
|
@ -5,12 +5,17 @@
|
|||
|
||||
<a
|
||||
href="#patron_search_modal"
|
||||
@click="selectUser(counter)"
|
||||
@click="selectUser()"
|
||||
class="btn btn-default"
|
||||
data-bs-toggle="modal"
|
||||
><i class="fa fa-plus"></i> {{ $__("Select user") }}</a
|
||||
>
|
||||
<input type="hidden" name="selected_patron_id" id="selected_patron_id" />
|
||||
<input
|
||||
v-if="shouldRenderInput"
|
||||
type="hidden"
|
||||
name="selected_patron_id"
|
||||
id="selected_patron_id"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
|
@ -20,21 +25,31 @@ export default {
|
|||
props: {
|
||||
name: String,
|
||||
resource: Object,
|
||||
counter: String,
|
||||
label: String,
|
||||
required: Boolean,
|
||||
},
|
||||
beforeCreate() {
|
||||
this.resource.patron_str = $patron_to_html(this.resource.patron);
|
||||
},
|
||||
computed: {
|
||||
shouldRenderInput() {
|
||||
return !document.getElementById("selected_patron_id");
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
selectUser(counter) {
|
||||
// This is a bit dirty, the "select user" window should be rewritten and be a Vue component
|
||||
// but that's not for now...
|
||||
selectUser() {
|
||||
this.modalEventListener = () => {
|
||||
this.newUserSelected();
|
||||
$(document).off(
|
||||
"hidden.bs.modal",
|
||||
"#patron_search_modal",
|
||||
this.modalEventListener
|
||||
);
|
||||
};
|
||||
$(document).on(
|
||||
"hidden.bs.modal",
|
||||
"#patron_search_modal",
|
||||
this.newUserSelected
|
||||
this.modalEventListener
|
||||
);
|
||||
},
|
||||
newUserSelected(e) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue