View | Details | Raw Unified | Return to bug 18888
Collapse All | Expand All

(-)a/admin/currency.pl (+6 lines)
Lines 58-63 if ( $op eq 'add_form' ) { Link Here
58
    my $rate          = $input->param('rate');
58
    my $rate          = $input->param('rate');
59
    my $active        = $input->param('active');
59
    my $active        = $input->param('active');
60
    my $is_a_modif    = $input->param('is_a_modif');
60
    my $is_a_modif    = $input->param('is_a_modif');
61
    my $step = $input->param('step');
61
62
62
    if ($is_a_modif) {
63
    if ($is_a_modif) {
63
        my $currency = Koha::Acquisition::Currencies->find($currency_code);
64
        my $currency = Koha::Acquisition::Currencies->find($currency_code);
Lines 89-94 if ( $op eq 'add_form' ) { Link Here
89
    }
90
    }
90
    $searchfield = q||;
91
    $searchfield = q||;
91
    $op          = 'list';
92
    $op          = 'list';
93
94
    if ( $step ) {
95
        print $input->redirect("/cgi-bin/koha/installer/onboarding.pl");
96
    }
97
92
} elsif ( $op eq 'delete_confirm' ) {
98
} elsif ( $op eq 'delete_confirm' ) {
93
    my $currency = Koha::Acquisition::Currencies->find($currency_code);
99
    my $currency = Koha::Acquisition::Currencies->find($currency_code);
94
100
(-)a/installer/onboarding.pl (-2 / +31 lines)
Lines 284-292 $template_params->{group_types} = [ Link Here
284
    },
284
    },
285
];
285
];
286
286
287
if ( $step > 5 ) {
287
my $cur = Koha::Acquisition::Currencies->get_active;
288
    $template_params->{all_done} = 1;    # If step 5 is complete, we are done!
288
289
if ( $step > 5 && $cur ) {
290
    $template_params->{all_done} = 1;    # If step 5 is completei and currency exists, we are done!
289
    $step = 5;
291
    $step = 5;
292
} elsif ($step > 5 && !$cur) {
293
    $step =6;
294
    my $currency_code = $input->param('currency_code');
295
    my $symbol        = $input->param('symbol');
296
    my $isocode       = $input->param('isocode');
297
    my $rate          = $input->param('rate');
298
    my $active        = $input->param('active');
299
    my $is_a_modif    = $input->param('is_a_modif');
300
    my $currency = Koha::Acquisition::Currency->new(
301
        {   currency => $currency_code,
302
            symbol   => $symbol,
303
            isocode  => $isocode,
304
            rate     => $rate,
305
            active   => $active,
306
        }
307
    );
308
    eval { $currency->store; };
309
    if ($@) {
310
        push @messages, { type => 'error', code => 'error_on_insert' };
311
    } else {
312
        push @messages, { type => 'message', code => 'success_on_insert' };
313
    }
314
    $cur = Koha::Acquisition::Currencies->get_active;
315
    if ($cur) {
316
        $template_params->{all_done} = 1;    # If currency exists then we are done!
317
        $step = 5;
318
    }
290
}
319
}
291
320
292
#Getting the appropriate template to display to the user
321
#Getting the appropriate template to display to the user
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep6.tt (-1 / +79 lines)
Line 0 Link Here
0
- 
1
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Web installer &rsaquo;
3
    [% IF all_done %]
4
        Complete
5
    [% ELSE %]
6
        Define a currency
7
    [% END %]
8
</title>
9
[% INCLUDE 'installer-doc-head-close.inc' %]
10
[% INCLUDE 'validator-strings.inc' %]
11
[% INCLUDE 'installer-strings.inc' %]
12
<script type="text/javascript" src="[% interface %]/[% theme %]/js/onboarding.js"></script>
13
</head>
14
15
<body id="installer" class="installer">
16
    <div class="container-fluid">
17
        <div class="row">
18
            <div id="onboarding-step5" class="installer-main col-sm-8 col-sm-offset-2 col-md-8 col-md-offset-2">
19
                <h1 id="logo"><a href="#">Koha</a></h1>
20
21
                [% IF all_done %]
22
23
                    <h2>Web installer &rsaquo; Complete</h2>
24
                    [% INCLUDE 'onboarding_messages.inc' %]
25
                    <h3>Congratulations you have finished and are ready to use Koha</h3>
26
                    <a class="btn btn-success" href="/cgi-bin/koha/mainpage.pl">Start using Koha</a>
27
28
                [% ELSE %]
29
30
                    <h2>Web installer &rsaquo; Define a currency </h2>
31
32
                    [% INCLUDE 'onboarding_messages.inc' %]
33
34
                    <form name="createcurrency" id="createcurrency" method="post" action="onboarding.pl">
35
                        <input type="hidden" name="step" value="6"/>
36
                        <input type="hidden" name="op" value="add_validate_currency" />
37
                        <fieldset class="rows">
38
                            <legend>
39
                                  New currency
40
                            </legend>
41
                            <ol>
42
                                <li>
43
                                   [% IF currency %]
44
                                        <span class="label">Currency: </span>
45
                                        <input type="hidden" name="is_a_modif" value="1" />
46
                                        <input type="hidden" name="currency_code" id="currency" value="[% currency.currency %]" />[% currency.currency %]
47
                                    [% ELSE %]
48
                                        <label for="currency_code" class="required">Currency: </label>
49
                                        <input type="text" name="currency_code" id="currency_code" size="50" maxlength="50" required="required" class="requ    ired" /> <span class="required">Required</span>
50
                                    [% END %]
51
                                </li>
52
                                <li>
53
                                        <label for="rate" class="required">Rate: </label>
54
                                        <input type="text" name="rate" id="rate" size="10" maxlength="10" value=1 readonly /> <span class="required">Required</span>
55
                                </li>
56
                                <li>
57
                                        <label for="symbol" class="required">Symbol: </label>
58
                                        <input type="text" name="symbol" id="symbol" size="5" maxlength="5" value="[% currency.symbol %]" required="required" class="required" /> <span class="required">Required</span>
59
                                </li>
60
                                <li>
61
                                        <label for="isocode">ISO code: </label>
62
                                        <input type="text" name="isocode" id="isocode" size="5" maxlength="5" value="[% currency.isocode %]" />
63
                                </li>
64
                                        <input type="hidden" id="active" name="active" value="1"/>
65
                            </ol>
66
                         </fieldset>
67
                         <p>
68
                             To create another currency, go to:
69
                             <span class="breadcrumbs">Administration &rsaquo; Currencies and exchange rates </span>
70
                         </p>
71
                         <fieldset class="action">
72
                             <input type="submit" class="btn btn-primary" value="Submit" />
73
                         </fieldset>
74
                    </form>
75
                [% END %]
76
            </div> <!-- / #onboarding-step6 -->
77
        </div> <!-- / .row -->
78
79
[% INCLUDE 'intranet-bottom.inc' %]

Return to bug 18888