Bug 12525: Prevent adding several patron lists with the same name

If you add patron to a patron list, from the patron search result, a
list is created when you click on "Save".
The list is considered as new each time.

To reproduce:
1/ Launch a patron search
2/ Select 1 patron, and create a new list 'aaa'
3/ Select another patron and click Save again
2 lists are created

Test plan:
1/ Launch a patron search
2/ Select 1 patron, and create a new list 'aaa'
The dropdown list should be populated with this new list, and should be
selected
3/ Select another patron and click Save again
Only 1 list should be created

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Jonathan Druart 2015-07-15 11:50:18 +01:00 committed by Tomas Cohen Arazi
parent e2e50e0b06
commit 7f65aaac74

View file

@ -76,6 +76,16 @@ $(document).ready(function() {
$("#patron_list_dialog > span.patrons-length").html(data.patrons_added_to_list);
$("#patron_list_dialog > a").attr("href", "/cgi-bin/koha/patron_lists/list.pl?patron_list_id=" + data.patron_list.patron_list_id);
$("#patron_list_dialog > a").html(data.patron_list.name);
if ( $('#add_to_patron_list').val() == 'new' ) {
var new_patron_list_added = $("<option>", {
value: data.patron_list.patron_list_id,
text: data.patron_list.name
});
$("#add_to_patron_list optgroup").append(new_patron_list_added);
$("#add_to_patron_list").val(data.patron_list.patron_list_id);
$("#new_patron_list").val('');
$('#add_to_patron_list').change();
}
},
error: function() {
alert("an error occurred");