@@ -, +, @@ --- Koha/Subscription/Numberpatterns.pm | 20 +++++++++ .../prog/en/modules/serials/subscription-add.tt | 5 ++- serials/subscription-add.pl | 52 +++++++++------------- 3 files changed, 44 insertions(+), 33 deletions(-) --- a/Koha/Subscription/Numberpatterns.pm +++ a/Koha/Subscription/Numberpatterns.pm @@ -32,6 +32,26 @@ Koha::SubscriptionNumberpatterns - Koha SubscriptionNumberpattern object set cla =cut +=head3 uniqeLabel + +=cut + +sub uniqueLabel { + my ($self, $label) = @_; + + my $samelabel = Koha::Subscription::Numberpatterns->search({label => $label})->next(); + if ($samelabel) { + my $i = 2; + my $newlabel = $samelabel->label . " ($i)"; + while (my $othersamelabel = $self->search({label => $newlabel})->next()) { + $i++; + $newlabel = $samelabel->label . " ($i)"; + } + $label = $newlabel; + } + return $label; +} + =head3 type =cut --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt @@ -331,7 +331,7 @@ function testPredictionPattern() { url:"/cgi-bin/koha/serials/showpredictionpattern.pl", data: ajaxData, success: function(data) { - $("#displayexample").html(data); + $("#displayexample").html(data).show(); patternneedtobetested = 0; } }); @@ -511,6 +511,7 @@ function removeDisabledAttr() { $(document).ready(function() { + $("#displayexample").hide(); $("#mana_search_result").modal("hide"); $("#aqbooksellerid").on('keypress', function(e) { if (e.keyCode == 13) { @@ -1134,7 +1135,7 @@ $(document).ready(function() {