From c890a4a6d00ec5a909bd267e713744533aeb8674 Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 13 Sep 2021 23:18:44 +0200 Subject: [PATCH] only add button per name once --- InvenTree/templates/js/translated/modals.js | 25 +++++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/InvenTree/templates/js/translated/modals.js b/InvenTree/templates/js/translated/modals.js index 5195c67b46..2a90a54324 100644 --- a/InvenTree/templates/js/translated/modals.js +++ b/InvenTree/templates/js/translated/modals.js @@ -793,14 +793,25 @@ function attachSecondaries(modal, secondaries) { function insertActionButton(modal, options) { /* Insert a custom submission button */ - var html = ` - - - `; + var element = $(modal).find('#modal-footer-buttons'); - $(modal).find('#modal-footer-buttons').append(html); + // check if button already present + var already_present = false; + for(var child=element[0].firstElementChild; child; child=child.nextElementSibling){ + if (item.firstElementChild.name == options.name) { + already_present = true; + } + } + + if (already_present == false) { + var html = ` + + + `; + element.append(html); + } } function attachButtons(modal, buttons) {