Bug 7046: Preselect dropdown option and prefill input

With previous renew values

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Jonathan Druart 2020-04-08 10:42:41 +02:00 committed by Martin Renvoize
parent d132c10bfc
commit c88c8e5322
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
3 changed files with 13 additions and 27 deletions

View File

@ -38,35 +38,23 @@
<li>
<label>Subscription length:</label>
<select name="subtype" id="subtype">
[% FOREACH st IN subtypes %]
[% SWITCH st %]
[% CASE 'numberlength'%]
[% IF st == subtype %]
<option value="issues" selected="selected">
[% ELSE %]
<option value="issues">
[% END %]
issues
[% CASE 'weeklength' %]
[% IF st == subtype %]
<option value="weeks" selected="selected">
[% ELSE %]
<option value="weeks">
[% END %]
weeks
[% CASE 'monthlength' %]
[% IF st == subtype %]
<option value="months" selected="selected">
[% ELSE %]
<option value="months">
[% END %]
months
[% CASE %][% st | html %]
[% FOREACH st IN [['numberlength', 'issues'], ['weeklength', 'weeks'], ['monthlength', 'months']] %]
[% SET subtype = st.0 %]
[% SET value = st.1 %]
[% IF subscription.$subtype %]
<option value="[% value %]" selected="selected">
[% ELSE %]
<option value="[% value %]">
[% END %]
[% SWITCH subtype %]
[% CASE 'numberlength'%]issues
[% CASE 'weeklength' %]weeks
[% CASE 'monthlength' %]months
[% END %]
</option>
[% END %]
</select>
<input type="text" name="sublength" id="sublength" size="3" />(enter amount in numerals)
<input type="text" name="sublength" id="sublength" size="3" value="[% subscription.numberlength || subscription.weeklength || subscription.monthlength %]" />(enter amount in numerals)
<input type="hidden" name="issuelengthcount">
</li>

View File

@ -434,7 +434,6 @@ sub redirect_mod_subscription {
my $subtype = $query->param('subtype');
my $sublength = $query->param('sublength');
my ($numberlength, $weeklength, $monthlength) = GetSubscriptionLength( $subtype, $sublength );
my $numberpattern = $query->param('numbering_pattern');
my $locale = $query->param('locale');
my $lastvalue1 = $query->param('lastvalue1');
my $innerloop1 = $query->param('innerloop1');

View File

@ -135,7 +135,6 @@ my $libraries = Koha::Libraries->search( {}, { order_by => ['branchcode'] }, );
$template->param(
op => $op,
libraries => $libraries,
subtypes => [ qw( numberlength weeklength monthlength ) ],
);
output_html_with_http_headers $query, $cookie, $template->output;