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

(-)a/admin/currency.pl (+4 lines)
Lines 59-64 if ( $op eq 'add_form' ) { Link Here
59
    my $active        = $input->param('active');
59
    my $active        = $input->param('active');
60
    my $p_sep_by_space = $input->param('p_sep_by_space');
60
    my $p_sep_by_space = $input->param('p_sep_by_space');
61
    my $is_a_modif    = $input->param('is_a_modif');
61
    my $is_a_modif    = $input->param('is_a_modif');
62
    my $step          = $input->param('step');
62
63
63
    if ($is_a_modif) {
64
    if ($is_a_modif) {
64
        my $currency = Koha::Acquisition::Currencies->find($currency_code);
65
        my $currency = Koha::Acquisition::Currencies->find($currency_code);
Lines 92-97 if ( $op eq 'add_form' ) { Link Here
92
    }
93
    }
93
    $searchfield = q||;
94
    $searchfield = q||;
94
    $op          = 'list';
95
    $op          = 'list';
96
    if ( $step ) {
97
        print $input->redirect("/cgi-bin/koha/installer/onboarding.pl");
98
    }
95
} elsif ( $op eq 'delete_confirm' ) {
99
} elsif ( $op eq 'delete_confirm' ) {
96
    my $currency = Koha::Acquisition::Currencies->find($currency_code);
100
    my $currency = Koha::Acquisition::Currencies->find($currency_code);
97
101
(-)a/installer/onboarding.pl (-4 / +40 lines)
Lines 253-260 if ( $step == 5 ) { Link Here
253
    $step++ if Koha::ItemTypes->count;
253
    $step++ if Koha::ItemTypes->count;
254
}
254
}
255
255
256
#Create currency if it doesn't exist
257
my $cur = Koha::Acquisition::Currencies->get_active;
258
if ( $step == 6 && !$cur ) {
259
    my $currency_code = $input->param('currency_code');
260
    my $symbol        = $input->param('symbol');
261
    my $isocode       = $input->param('isocode');
262
    my $rate          = $input->param('rate');
263
    my $active        = $input->param('active');
264
    my $p_sep_by_space = $input->param('p_sep_by_space');
265
    my $is_a_modif    = $input->param('is_a_modif');
266
267
    if ( $currency_code ) {
268
        my $currency = Koha::Acquisition::Currency->new(
269
        {   currency => $currency_code,
270
            symbol   => $symbol,
271
            isocode  => $isocode,
272
            rate     => $rate,
273
            active   => $active,
274
            p_sep_by_space => $p_sep_by_space,
275
        }
276
        );
277
        eval { $currency->store; };
278
        if ($@) {
279
            push @messages, { type => 'error', code => 'error_on_insert' };
280
        } else {
281
            push @messages, { type => 'message', code => 'success_on_insert' };
282
        }
283
    }
284
    $cur = Koha::Acquisition::Currencies->get_active;
285
    if ($cur) {
286
        $step++;
287
    }
288
} elsif ( $step == 6 && $cur ){
289
    $step++;
290
}
291
256
#Create circulation rule
292
#Create circulation rule
257
if ( $step == 6 ) {
293
if ( $step == 7 ) {
258
294
259
    if ( $op eq 'add_validate_circ_rule' ) {
295
    if ( $op eq 'add_validate_circ_rule' ) {
260
296
Lines 324-332 $template_params->{libraries} = $libraries; Link Here
324
my $minPasswordLength = C4::Context->preference('minPasswordLength');
360
my $minPasswordLength = C4::Context->preference('minPasswordLength');
325
$template_params->{minPasswordLength} = $minPasswordLength;
361
$template_params->{minPasswordLength} = $minPasswordLength;
326
362
327
if ( $step > 6 ) {
363
if ( $step > 7 ) {
328
    $template_params->{all_done} = 1;    # If step 5 is complete, we are done!
364
    $template_params->{all_done} = 1;    # If step 7 is complete, we are done!
329
    $step = 6;
365
    $step = 7;
330
}
366
}
331
367
332
#Getting the appropriate template to display to the user
368
#Getting the appropriate template to display to the user
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep6.tt (-118 / +47 lines)
Lines 1-11 Link Here
1
[% INCLUDE 'doc-head-open.inc' %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Web installer &rsaquo;
2
<title>Koha &rsaquo; Web installer &rsaquo; Define a currency</title>
3
    [% IF all_done %]
4
        Complete
5
    [% ELSE %]
6
        Create circulation rule
7
    [% END %]
8
</title>
9
[% INCLUDE 'installer-doc-head-close.inc' %]
3
[% INCLUDE 'installer-doc-head-close.inc' %]
10
</head>
4
</head>
11
5
Lines 14-132 Link Here
14
        <div class="row">
8
        <div class="row">
15
            <div id="onboarding-step6" class="installer-main col-sm-8 col-sm-offset-2 col-md-8 col-md-offset-2">
9
            <div id="onboarding-step6" class="installer-main col-sm-8 col-sm-offset-2 col-md-8 col-md-offset-2">
16
                <h1 id="logo"><a href="#">Koha</a></h1>
10
                <h1 id="logo"><a href="#">Koha</a></h1>
11
                <h2>Web installer &rsaquo; Define a currency </h2>
17
12
18
                [% IF all_done %]
13
                [% INCLUDE 'onboarding_messages.inc' %]
19
                    <h2>Web installer &rsaquo; Complete</h2>
20
                    [% INCLUDE 'onboarding_messages.inc' %]
21
                    <h3>Congratulations, you have finished and are ready to use Koha</h3>
22
                    <a class="btn btn-success" href="/cgi-bin/koha/mainpage.pl">Start using Koha</a>
23
                [% ELSE %]
24
25
                    <h2>Web installer &rsaquo; Create a new circulation rule </h2>
26
27
                    [% INCLUDE 'onboarding_messages.inc' %]
28
29
                    <form name="createcirculationrule" method="post" action="onboarding.pl">
30
                        <fieldset class="rows">
31
                            <input type="hidden" name="step" value="6"/>
32
                            <input type="hidden" name="op" value="add_validate_circ_rule" />
33
                            <ol>
34
                                <li>
35
                                    <label for="branchname" class="required"> Library branch</label>
36
                                    <select name="branch" id="branchname" required="required">
37
                                        <option value=""> Choose</option>
38
                                        <option value="*" selected="selected">All</option>
39
                                        [% FOREACH library IN libraries %]
40
                                            <option value="[% library.branchcode | html %]"> [% library.branchname | html %]</option>
41
                                        [% END %]
42
                                    </select>
43
                                    <span class="required">Required</span>
44
                                </li>
45
                                <li>
46
                                    <label for="categorycode" class="required">Patron category: </label>
47
                                    <select name="categorycode" id="categorycode" required="required">
48
                                        <option value=""> Choose</option>
49
                                        <option value="*" selected="selected">All</option>
50
                                        [% FOREACH category IN categories %]
51
                                            <option value = "[% category.categorycode | html %]"> [% category.description | html %]</option>
52
                                        [%END%]
53
                                    </select>
54
                                    <span class="required">Required</span>
55
                                </li>
56
57
                                <li>
58
                                    <label for="itemtype"> Item type: </label>
59
                                    <select id="itemtype" name="itemtype" required="required">
60
                                        <option value=""> Choose </option>
61
                                        <option value="*" selected="selected">All</option>
62
                                        [% FOREACH item IN itemtypes %]
63
                                            <option value = "[% item.itemtype | html %]"> [% item.itemtype | html %]
64
                                        [%END%]
65
                                    </select>
66
                                    <span class="required"> Required</span>
67
                                </li>
68
                                <li>
69
                                    <label for="maxissueqty" class="required">Current checkouts allowed: </label>
70
                                    <input type="number" min="0" name="maxissueqty" id="maxissueqty" size="10" value="50" class="required" required="required" />
71
                                    <span class="required">Required</span>
72
                                </li>
73
74
                                <li>
75
                                    <label for="issuelength" class="required">Loan period: </label>
76
                                    <input type="number" min="0" name="issuelength" id="issuelength" size="10" value="14" class="required" required="required" />
77
                                    <span class="required">Required</span>
78
                                </li>
79
                                <li>
80
                                    <label for="lengthunit">Units: </label>
81
                                    <select name="lengthunit" id="lengthunit" required="required">
82
                                        <option value=""> Choose </option>
83
                                        [% SET units = 'days' %]
84
                                        [% IF category %]
85
                                            [% SET default_privacy = category.default_privacy %]
86
                                        [% END %]
87
88
                                        [% SWITCH units %]
89
                                        [% CASE 'days' %]
90
                                            <option value="days" selected="selected">Days</option>
91
                                            <option value="hours">Hours</option>
92
                                        [% CASE 'hours' %]
93
                                            <option value="days">Days</option>
94
                                            <option value="hours" selected="selected">Hours</option>
95
                                        [% END %]
96
                                    </select>
97
                                </li>
98
                                <li>
99
                                    <label for="renewalsallowed" class="required">Renewals allowed: </label>
100
                                    <input type="number" min="0" name="renewalsallowed" id="renewalsallowed" size="10" max="10" value="10" class="required" required="required" />
101
                                    <span class="required">Required</span>
102
                                </li>
103
104
                                <li>
105
                                    <label for="renewalperiod" class="required">Renewals period: </label>
106
                                    <input type="number" min="0" name="renewalperiod" id="renewalperiod" size="10" value="14" class="required" required="required" />
107
                                    <span class="required">Required</span>
108
                                </li>
109
110
                                <li>
111
                                    <label for="onshelfholds">On shelf holds allowed: </label>
112
                                    <select name="onshelfholds" id="onshelfholds" required="required">
113
                                        <option value="">Choose</option>
114
                                        <option value="1" selected="selected">Yes</option>
115
                                        <option value="0">If any unavailable</option>
116
                                        <option value="2">If all unavailable</option>
117
                                    </select>
118
                                </li>
119
                            </ol>
120
                            <p>
121
                                To create circulation rule, go to:
122
                                <span class="breadcrumbs">Administration &rsaquo; Circulation and fine rules </span>
123
                            </p>
124
125
                        </fieldset>
126
14
15
                <form name="createcurrency" id="createcurrency" method="post" action="onboarding.pl">
16
                    <input type="hidden" name="step" value="6"/>
17
                    <input type="hidden" name="op" value="add_validate_currency" />
18
                    <fieldset class="rows">
19
                        <legend>
20
                            New currency
21
                        </legend>
22
                        <ol>
23
                            <li>
24
                                [% IF currency %]
25
                                    <span class="label">Currency: </span>
26
                                    <input type="hidden" name="is_a_modif" value="1" />
27
                                    <input type="hidden" name="currency_code" id="currency" value="[% currency.currency | html %]" />[% currency.currency | html %]
28
                                [% ELSE %]
29
                                    <label for="currency_code" class="required">Currency: </label>
30
                                    <input type="text" name="currency_code" id="currency_code" size="50" maxlength="50" required="required" class="required" /> <span class="required">Required</span>
31
                                [% END %]
32
                            </li>
33
                            <li>
34
                                <label for="rate" class="required">Rate: </label>
35
                                <input type="text" name="rate" id="rate" size="10" maxlength="10" value=1 readonly /> <span class="required">Required</span>
36
                            </li>
37
                            <li>
38
                                <label for="symbol" class="required">Symbol: </label>
39
                                <input type="text" name="symbol" id="symbol" size="5" maxlength="5" value="[% currency.symbol | html %]" required="required" class="required" /> <span class="required">Required</span>
40
                            </li>
41
                            <li>
42
                                <label for="isocode">ISO code: </label>
43
                                <input type="text" name="isocode" id="isocode" size="5" maxlength="5" value="[% currency.isocode | html %]" />
44
                            </li>
45
                            <li>
46
                                <label for="p_sep_by_space">Space separation between symbol and value: </label>
47
                                <input type="checkbox" name="p_sep_by_space" id="p_sep_by_space" size="5" maxlength="5" value="1" />
48
                            </li>
49
                            <input type="hidden" id="active" name="active" value="1"/>
50
                        </ol>
51
                    </fieldset>
52
                    <p>
53
                        To create another currency, go to:
54
                        <span class="breadcrumbs">Administration &rsaquo; Currencies and exchange rates </span>
55
                    </p>
56
                    <fieldset class="action">
127
                        <input type="submit" class="btn btn-primary" value="Submit" />
57
                        <input type="submit" class="btn btn-primary" value="Submit" />
128
                    </form>
58
                    </fieldset>
129
                [% END %]
59
                </form>
130
            </div> <!-- / #onboarding-step6 -->
60
            </div> <!-- / #onboarding-step6 -->
131
        </div> <!-- / .row -->
61
        </div> <!-- / .row -->
132
    </div><!-- / .container-fluid -->
62
    </div><!-- / .container-fluid -->
133
- 

Return to bug 18888