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

(-)a/installer/onboarding.pl (-603 lines)
Lines 1-603 Link Here
1
#!/usr/bin/perl
2
3
# This file is part of Koha.
4
#
5
# Copyright (C) 2017 Catalyst IT
6
#
7
# Koha is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# Koha is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
20
#Recommended pragmas
21
use Modern::Perl;
22
use diagnostics;
23
use C4::InstallAuth;
24
use CGI qw ( -utf8 );
25
use C4::Output;
26
use C4::Members;
27
use Koha::Patrons;
28
use Koha::Libraries;
29
use Koha::Database;
30
use Koha::DateUtils;
31
use Koha::Patron::Categories;
32
use Koha::Patron::Category;
33
use Koha::ItemTypes;
34
use Koha::IssuingRule;
35
use Koha::IssuingRules;
36
37
#Setting variables
38
my $input = new CGI;
39
my $step  = $input->param('step');
40
41
#Getting the appropriate template to display to the user
42
my ( $template, $loggedinuser, $cookie ) =
43
  C4::InstallAuth::get_template_and_user(
44
    {
45
        template_name => "/onboarding/onboardingstep"
46
          . ( $step ? $step : 1 ) . ".tt",
47
        query           => $input,
48
        type            => "intranet",
49
        authnotrequired => 0,
50
        debug           => 1,
51
    }
52
  );
53
54
#Check database connection
55
my %info;
56
$info{'dbname'} = C4::Context->config("database");
57
$info{'dbms'}   = (
58
      C4::Context->config("db_scheme")
59
    ? C4::Context->config("db_scheme")
60
    : "mysql"
61
);
62
63
$info{'hostname'} = C4::Context->config("hostname");
64
$info{'port'}     = C4::Context->config("port");
65
$info{'user'}     = C4::Context->config("user");
66
$info{'password'} = C4::Context->config("pass");
67
my $dbh = DBI->connect(
68
    "DBI:$info{dbms}:dbname=$info{dbname};host=$info{hostname}"
69
      . ( $info{port} ? ";port=$info{port}" : "" ),
70
    $info{'user'}, $info{'password'}
71
);
72
73
#Store the value of the template input name='op' in the variable $op so we can check if the user has pressed the button with the name="op" and value="finish" meaning the user has finished the onboarding tool.
74
my $op = $input->param('op') || '';
75
$template->param( 'op' => $op );
76
77
my $schema = Koha::Database->new()->schema();
78
79
if ( $op && $op eq 'finish' )
80
{ #If the value of $op equals 'finish' then redirect user to /cgi-bin/koha/mainpage.pl
81
    print $input->redirect("/cgi-bin/koha/mainpage.pl");
82
    exit;
83
}
84
85
my $libraries = Koha::Libraries->search( {}, { order_by => ['branchcode'] }, );
86
$template->param(
87
     libraries   => $libraries,
88
     group_types => [
89
     {
90
            categorytype => 'searchdomain',
91
            categories   => [
92
               Koha::LibraryCategories->search(
93
                   { categorytype => 'searchdomain' }
94
               )
95
            ],
96
     },
97
     {
98
            categorytype => 'properties',
99
            categories   => [
100
               Koha::LibraryCategories->search(
101
                   { categorytype => 'properties' }
102
               )
103
            ],
104
     },
105
     ]
106
);
107
108
109
#Select all the patron category records in the categories database table and give them to the template
110
    my $categories = Koha::Patron::Categories->search();
111
    $template->param( 'categories' => $categories, );
112
113
#Check if the $step variable equals 1 i.e. the user has clicked to create a library in the create library screen 1
114
    my $itemtypes = Koha::ItemTypes->search();
115
    $template->param( 'itemtypes' => $itemtypes, );
116
117
if ( $step && $step == 1 ) {
118
    #store inputted parameters in variables
119
    my $branchcode = $input->param('branchcode');
120
    $branchcode = uc($branchcode);
121
    my $categorycode = $input->param('categorycode');
122
    my $op = $input->param('op') || 'list';
123
    my $message;
124
    my $library;
125
126
    #Take the text 'branchname' and store it in the @fields array
127
    my @fields = qw(
128
      branchname
129
    );
130
131
    $template->param( 'branchcode' => $branchcode );
132
    $branchcode =~ s|\s||g
133
      ; # Use a regular expression to check the value of the inputted branchcode
134
135
#Create a new library object and store the branchcode and @fields array values in this new library object
136
    $library = Koha::Library->new(
137
        {
138
            branchcode => $branchcode,
139
            ( map { $_ => scalar $input->param($_) || undef } @fields )
140
        }
141
    );
142
143
    eval { $library->store; }; #Use the eval{} function to store the library object
144
    if ($library) {
145
        $message = 'success_on_insert';
146
    }
147
    else {
148
        $message = 'error_on_insert';
149
    }
150
    $template->param( 'message' => $message );
151
152
#Check if the $step variable equals 2 i.e. the user has clicked to create a patron category in the create patron category screen 1
153
}
154
elsif ( $step && $step == 2 ) {
155
    if ($op eq "add_validate_category"){
156
        #Initialising values
157
        my $searchfield  = $input->param('description') // q||;
158
        my $categorycode = $input->param('categorycode');
159
        my $op           = $input->param('op') // 'list';
160
        my $message;
161
        my $category;
162
        $template->param( 'categorycode' => $categorycode );
163
164
        my ( $template, $loggedinuser, $cookie ) =
165
            C4::InstallAuth::get_template_and_user(
166
            {
167
                template_name   => "/onboarding/onboardingstep2.tt",
168
                query           => $input,
169
                type            => "intranet",
170
                authnotrequired => 0,
171
                flagsrequired =>
172
                { parameters => 'parameters_remaining_permissions' },
173
                debug => 1,
174
            }
175
            );
176
177
        #Once the user submits the page, this code validates the input and adds it
178
        #to the database as a new patron category
179
        $categorycode = $input->param('categorycode');
180
        my $description           = $input->param('description');
181
        my $overduenoticerequired = $input->param('overduenoticerequired');
182
        my $category_type         = $input->param('category_type');
183
        my $default_privacy       = $input->param('default_privacy');
184
        my $enrolmentperiod       = $input->param('enrolmentperiod');
185
        my $enrolmentperioddate   = $input->param('enrolmentperioddate') || undef;
186
187
        #Converts the string into a date format
188
        if ($enrolmentperioddate) {
189
            $enrolmentperioddate = output_pref(
190
                {
191
                    dt         => dt_from_string($enrolmentperioddate),
192
                    dateformat => 'iso',
193
                    dateonly   => 1,
194
                }
195
            );
196
        }
197
198
        #Adds a new patron category to the database
199
        $category = Koha::Patron::Category->new(
200
            {
201
                categorycode          => $categorycode,
202
                description           => $description,
203
                overduenoticerequired => $overduenoticerequired,
204
                category_type         => $category_type,
205
                default_privacy       => $default_privacy,
206
                enrolmentperiod       => $enrolmentperiod,
207
                enrolmentperioddate   => $enrolmentperioddate,
208
            }
209
        );
210
211
        eval { $category->store; };
212
213
        #Error messages
214
        if ($category) {
215
            $message = 'success_on_insert';
216
        }
217
        else {
218
            $message = 'error_on_insert';
219
        }
220
221
        $template->param( 'message' => $message );
222
    }
223
    #Create a patron
224
}
225
elsif ( $step && $step == 3 ) {
226
    my $firstpassword  = $input->param('password') || '';
227
    my $secondpassword = $input->param('password2') || '';
228
229
230
    #Find all patron records in the database and hand them to the template
231
    my %currentpatrons = Koha::Patrons->search();
232
    my $currentpatrons = values %currentpatrons;
233
    $template->param( 'patrons' =>$currentpatrons);
234
235
236
#Find all library records in the database and hand them to the template to display in the library dropdown box
237
    my $libraries =
238
      Koha::Libraries->search( {}, { order_by => ['branchcode'] }, );
239
    $template->param(
240
        libraries   => $libraries,
241
        group_types => [
242
            {
243
                categorytype => 'searchdomain',
244
                categories   => [
245
                    Koha::LibraryCategories->search(
246
                        { categorytype => 'searchdomain' }
247
                    )
248
                ],
249
            },
250
            {
251
                categorytype => 'properties',
252
                categories   => [
253
                    Koha::LibraryCategories->search(
254
                        { categorytype => 'properties' }
255
                    )
256
                ],
257
            },
258
        ]
259
    );
260
261
#Find all patron categories in the database and hand them to the template to display in the patron category dropdown box
262
    my $categories = Koha::Patron::Categories->search();
263
    $template->param( 'categories' => $categories, );
264
265
#Incrementing the highest existing patron cardnumber to prevent duplicate cardnumber entry
266
267
    my $existing_cardnumber = $schema->resultset('Borrower')->get_column('cardnumber')->max() // 0;
268
269
    my $new_cardnumber = $existing_cardnumber + 1;
270
    $template->param( "newcardnumber" => $new_cardnumber );
271
272
    my $op = $input->param('op') // 'list';
273
    my $minpw = C4::Context->preference("minPasswordLength");
274
    $template->param( "minPasswordLength" => $minpw );
275
    my @messages;
276
    my @errors;
277
    my $nok            = $input->param('nok');
278
    my $cardnumber     = $input->param('cardnumber');
279
    my $borrowernumber = $input->param('borrowernumber');
280
    my $userid         = $input->param('userid');
281
282
    # function to designate mandatory fields (visually with css)
283
    my $check_BorrowerMandatoryField =
284
      C4::Context->preference("BorrowerMandatoryField");
285
    my @field_check = split( /\|/, $check_BorrowerMandatoryField );
286
    foreach (@field_check) {
287
        $template->param( "mandatory$_" => 1 );
288
        $template->param(
289
            BorrowerMandatoryField =>
290
              C4::Context->preference("BorrowerMandatoryField")
291
            ,    #field to test with javascript
292
        );
293
    }
294
295
 #If the entered cardnumber causes an error hand this error to the @errors array
296
    if ( my $error_code = checkcardnumber( $cardnumber, $borrowernumber ) ) {
297
        push @errors,
298
            $error_code == 1 ? 'ERROR_cardnumber_already_exists'
299
          : $error_code == 2 ? 'ERROR_cardnumber_length'
300
          :                    ();
301
    }
302
303
   #If the entered password causes an error hand this error to the @errors array
304
    push @errors, "ERROR_password_mismatch"
305
      if $firstpassword ne $secondpassword;
306
    push @errors, "ERROR_short_password"
307
      if ( $firstpassword
308
        && $minpw
309
        && $firstpassword ne '****'
310
        && ( length($firstpassword) < $minpw ) );
311
312
    #Passing errors to template
313
    $nok = $nok || scalar(@errors);
314
315
#If errors have been generated from the users inputted cardnumber or password then display the error and do not insert the patron into the borrowers table
316
    if ($nok) {
317
        foreach my $error (@errors) {
318
            if ( $error eq 'ERROR_password_mismatch' ) {
319
                $template->param( errorpasswordmismatch => 1 );
320
            }
321
            if ( $error eq 'ERROR_login_exist' ) {
322
                $template->param( errorloginexists => 1 );
323
            }
324
            if ( $error eq 'ERROR_cardnumber_already_exists' ) {
325
                $template->param( errorcardnumberexists => 1 );
326
            }
327
            if ( $error eq 'ERROR_cardnumber_length' ) {
328
                $template->param( errorcardnumberlength => 1 );
329
            }
330
            if ( $error eq 'ERROR_short_password' ) {
331
                $template->param( errorshortpassword => 1 );
332
            }
333
        }
334
        $template->param( 'nok' => 1 );
335
336
#Else if no errors have been caused by the users inputted card number or password then insert the patron into the borrowers table
337
    }
338
    else {
339
        my ( $template, $loggedinuser, $cookie ) =
340
          C4::InstallAuth::get_template_and_user(
341
            {
342
                template_name   => "/onboarding/onboardingstep3.tt",
343
                query           => $input,
344
                type            => "intranet",
345
                authnotrequired => 0,
346
                flagsrequired   => { borrowers => 1 },
347
                debug           => 1,
348
            }
349
          );
350
351
        if ( $op eq 'add_validate' ) {
352
            my %newdata;
353
354
            #Store the template form values in the newdata hash
355
            $newdata{borrowernumber} = $input->param('borrowernumber');
356
            $newdata{surname}        = $input->param('surname');
357
            $newdata{firstname}      = $input->param('firstname');
358
            $newdata{cardnumber}     = $input->param('cardnumber');
359
            $newdata{branchcode}     = $input->param('libraries');
360
            $newdata{categorycode}   = $input->param('categorycode_entry');
361
            $newdata{userid}         = $input->param('userid');
362
            $newdata{password}       = $input->param('password');
363
            $newdata{password2}      = $input->param('password2');
364
            $newdata{privacy}        = "default";
365
            $newdata{address}        = "";
366
            $newdata{city}           = "";
367
368
#Hand tne the dateexpiry of the patron based on the patron category it is created from
369
            my $patron_category = Koha::Patron::Categories->find( $newdata{categorycode} );
370
            $newdata{dateexpiry} = $patron_category->get_expiry_date( $newdata{dateenrolled} );
371
372
#Hand the newdata hash to the AddMember subroutine in the C4::Members module and it creates a patron and hands back a borrowernumber which is being stored
373
            my $borrowernumber = &AddMember(%newdata);
374
375
#Create a hash named member2 and fill it with the borrowernumber of the borrower that has just been created
376
            my %member2;
377
            $member2{'borrowernumber'} = $borrowernumber;
378
379
#Perform data validation on the flag that has been handed to onboarding.pl by the template
380
            my $flag = $input->param('flag');
381
            if ( $input->param('newflags') ) {
382
                my $dbh              = C4::Context->dbh();
383
                my @perms            = $input->multi_param('flag');
384
                my %all_module_perms = ();
385
                my %sub_perms        = ();
386
                foreach my $perm (@perms) {
387
                    if ( $perm !~ /:/ ) {
388
                        $all_module_perms{$perm} = 1;
389
                    }
390
                    else {
391
                        my ( $module, $sub_perm ) = split /:/, $perm, 2;
392
                        push @{ $sub_perms{$module} }, $sub_perm;
393
                    }
394
                }
395
396
                # construct flags
397
                my @userflags = $schema->resultset('Userflag')->search({},{
398
                        order_by => { -asc =>'bit'},
399
                        }
400
                );
401
402
#Setting superlibrarian permissions for new patron
403
                my $flags = Koha::Patrons->find($borrowernumber)->set({flags=>1})->store;
404
405
                #Error handling checking if the patron was created successfully
406
                if ( !$borrowernumber ) {
407
                    push @messages,
408
                      { type => 'error', code => 'error_on_insert' };
409
                }
410
                else {
411
                    push @messages,
412
                      { type => 'message', code => 'success_on_insert' };
413
                }
414
            }
415
        }
416
    }
417
}
418
elsif ( $step && $step == 4 ) {
419
    my ( $template, $borrowernumber, $cookie ) =
420
      C4::InstallAuth::get_template_and_user(
421
        {
422
            template_name   => "/onboarding/onboardingstep4.tt",
423
            query           => $input,
424
            type            => "intranet",
425
            authnotrequired => 0,
426
            flagsrequired =>
427
              { parameters => 'parameters_remaining_permissions' },
428
            debug => 1,
429
        }
430
    );
431
  if ($op eq "add_validate"){
432
        my $description   = $input->param('description');
433
        my $itemtype_code = $input->param('itemtype');
434
        $itemtype_code = uc($itemtype_code);
435
436
  #Create a new itemtype object using the user inputted itemtype and description
437
        my $itemtype = Koha::ItemType->new(
438
            {
439
                itemtype    => $itemtype_code,
440
                description => $description,
441
            }
442
        );
443
        eval { $itemtype->store; };
444
        my $message;
445
446
#Fill the $message variable with an error if the item type object was not successfully created and inserted into the itemtypes table
447
        if ($itemtype) {
448
            $message = 'success_on_insert';
449
        }
450
        else {
451
            $message = 'error_on_insert';
452
        }
453
        $template->param( 'message' => $message );
454
    }
455
}
456
elsif ( $step && $step == 5 ) {
457
458
  #Find all the existing categories to display in a dropdown box in the template
459
    my $categories;
460
    $categories = Koha::Patron::Categories->search();
461
    $template->param( categories => $categories, );
462
463
 #Find all the exisiting item types to display in a dropdown box in the template
464
    my $itemtypes;
465
    $itemtypes = Koha::ItemTypes->search();
466
    $template->param( itemtypes => $itemtypes, );
467
468
  #Find all the exisiting libraries to display in a dropdown box in the template
469
    my $libraries =
470
      Koha::Libraries->search( {}, { order_by => ['branchcode'] }, );
471
    $template->param(
472
        libraries   => $libraries,
473
        group_types => [
474
            {
475
                categorytype => 'searchdomain',
476
                categories   => [
477
                    Koha::LibraryCategories->search(
478
                        { categorytype => 'searchdomain' }
479
                    )
480
                ],
481
            },
482
            {
483
                categorytype => 'properties',
484
                categories   => [
485
                    Koha::LibraryCategories->search(
486
                        { categorytype => 'properties' }
487
                    )
488
                ],
489
            },
490
        ]
491
    );
492
493
    my $input = CGI->new;
494
    my $dbh   = C4::Context->dbh;
495
496
    my ( $template, $loggedinuser, $cookie ) =
497
      C4::InstallAuth::get_template_and_user(
498
        {
499
            template_name   => "/onboarding/onboardingstep5.tt",
500
            query           => $input,
501
            type            => "intranet",
502
            authnotrequired => 0,
503
            flagsrequired   => { parameters => 'manage_circ_rules' },
504
            debug           => 1,
505
        }
506
      );
507
508
    #If no libraries exist then set the $branch value to *
509
    my $branch = $input->param('branch');
510
    unless ($branch) {
511
        if ( C4::Context->preference('DefaultToLoggedInLibraryCircRules') ) {
512
            $branch =
513
              Koha::Libraries->search->count() == 1
514
              ? undef
515
              : C4::Context::mybranch();
516
        }
517
        else {
518
            $branch =
519
              C4::Context::only_my_library()
520
              ? ( C4::Context::mybranch() || '*' )
521
              : '*';
522
        }
523
    }
524
    $branch = '*' if $branch eq 'NO_LIBRARY_SET';
525
    my $op = $input->param('op') || q{};
526
527
    if ( $op eq 'add_validate' ) {
528
        my $type            = $input->param('type');
529
        my $br              = $input->param('branch');
530
        my $bor             = $input->param('categorycode');
531
        my $itemtype        = $input->param('itemtype');
532
        my $maxissueqty     = $input->param('maxissueqty');
533
        my $issuelength     = $input->param('issuelength');
534
        my $lengthunit      = $input->param('lengthunit');
535
        my $renewalsallowed = $input->param('renewalsallowed');
536
        my $renewalperiod   = $input->param('renewalperiod');
537
        my $onshelfholds    = $input->param('onshelfholds') || 0;
538
        $maxissueqty =~ s/\s//g;
539
        $maxissueqty = undef if $maxissueqty !~ /^\d+/;
540
        $issuelength = $issuelength eq q{} ? undef : $issuelength;
541
542
        my $params = {
543
            branchcode      => $br,
544
            categorycode    => $bor,
545
            itemtype        => $itemtype,
546
            maxissueqty     => $maxissueqty,
547
            renewalsallowed => $renewalsallowed,
548
            renewalperiod   => $renewalperiod,
549
            issuelength     => $issuelength,
550
            lengthunit      => $lengthunit,
551
            onshelfholds    => $onshelfholds,
552
        };
553
554
        my @messages;
555
556
#Allows for the 'All' option to work when selecting all libraries for a circulation rule to apply to.
557
        if ( $branch eq "*" ) {
558
            my $search_default_rules = $schema->resultset('DefaultCircRule')->count();
559
            my $insert_default_rules = $schema->resultset('Issuingrule')->new(
560
                    { maxissueqty => $maxissueqty, onshelfholds => $onshelfholds }
561
                );
562
        }
563
#Allows for the 'All' option to work when selecting all patron categories for a circulation rule to apply to.
564
        elsif ( $bor eq "*" ) {
565
566
            my $search_default_rules = $schema->resultset('DefaultCircRule')->count();
567
            my $insert_default_rules = $schema->resultset('Issuingrule')->new(
568
                        { maxissueqty => $maxissueqty}
569
            );
570
        }
571
572
#Allows for the 'All' option to work when selecting all itemtypes for a circulation rule to apply to
573
        elsif ( $itemtype eq "*" ) {
574
            my $search_default_rules = $schema->resultset('DefaultCircRule')->search({},{
575
                    branchcode => $branch
576
                    }
577
578
            );
579
580
            my $insert_default_rules = $schema->resultset('Issuingrule')->new(
581
                           { branchcode => $branch, onshelfholds => $onshelfholds }
582
            );
583
        }
584
585
        my $issuingrule = Koha::IssuingRules->find(
586
            { categorycode => $bor, itemtype => $itemtype, branchcode => $br }
587
        );
588
        if ($issuingrule) {
589
            $issuingrule->set($params)->store();
590
            push @messages,
591
              {
592
                type => 'error',
593
                code => 'error_on_insert'
594
              }; #Stops crash of the onboarding tool if someone makes a circulation rule with the same item type, library and patron categroy as an exisiting circulation rule.
595
596
        }
597
        else {
598
            Koha::IssuingRule->new()->set($params)->store();
599
        }
600
    }
601
}
602
603
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step3.tt (-3 / +3 lines)
Lines 1-5 Link Here
1
[% INCLUDE 'doc-head-open.inc' %]<title>Koha &rsaquo; Web installer &rsaquo; Step 3</title>
1
[% INCLUDE 'doc-head-open.inc' %]<title>Koha &rsaquo; Web installer &rsaquo; Step 3</title>
2
[% IF ( finish ) %]<meta http-equiv="refresh" content="10; url=/cgi-bin/koha/installer/onboarding.pl">[% END %]
2
[% IF ( finish ) %]<meta http-equiv="refresh" content="10; url=/cgi-bin/koha/mainpage.pl">[% END %]
3
[% INCLUDE 'installer-doc-head-close.inc' %]
3
[% INCLUDE 'installer-doc-head-close.inc' %]
4
<div>
4
<div>
5
<h1 id="logo"><img alt="Koha" src="[% interface %]/[% theme %]/img/koha.org-logo.gif" /> Koha web  installer &rsaquo; Step 3</h1>
5
<h1 id="logo"><img alt="Koha" src="[% interface %]/[% theme %]/img/koha.org-logo.gif" /> Koha web  installer &rsaquo; Step 3</h1>
Lines 66-72 function Hide(link) Link Here
66
66
67
[% IF ( finish ) %]
67
[% IF ( finish ) %]
68
    <h1>Congratulations, installation complete</h1>
68
    <h1>Congratulations, installation complete</h1>
69
    <p>If this page does not redirect in 10 seconds, click <a href="/cgi-bin/koha/installer/onboarding.pl">Start onboarding process</a>.</p>
69
    <p>If this page does not redirect in 10 seconds, click <a href="/">here</a>.</p>
70
[% END %]
70
[% END %]
71
71
72
72
Lines 231-237 function Hide(link) Link Here
231
            You can help the Koha community by sharing your statistics with us.
231
            You can help the Koha community by sharing your statistics with us.
232
            <br>If you wish to share some of your data, please enable the functionality in the "Share your usage statistics" section of the admin module.
232
            <br>If you wish to share some of your data, please enable the functionality in the "Share your usage statistics" section of the admin module.
233
        </p>
233
        </p>
234
        <p>Click on 'Set up Koha with the onboarding tool' to complete and load the Koha onboarding tool.
234
        <p>Click on 'Finish' to complete and load the Koha Staff Interface.
235
        <form name="finish">
235
        <form name="finish">
236
        <input type="hidden" name="step" value="3" />
236
        <input type="hidden" name="step" value="3" />
237
        <input type="hidden" name="op" value="finish" />
237
        <input type="hidden" name="op" value="finish" />
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep1.tt (-81 lines)
Lines 1-81 Link Here
1
<!--Includes for creating library-->
2
[% INCLUDE 'doc-head-open.inc' %]
3
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
4
[% INCLUDE 'installer-doc-head-close.inc' %]
5
[% INCLUDE 'datatables.inc' %]
6
7
[% IF (libraries && libraries.count > 1) %]
8
    <meta http-equiv="refresh" content="0; url=/cgi-bin/koha/installer/onboarding.pl?step=2">
9
10
[% ELSIF (op == "add_validate_library") %]
11
    <head>
12
        <title>Welcome &rsaquo; to  &rsaquo; Koha</title>
13
    </head>
14
15
    <!--Header for the koha onboarding tool-->
16
    <div>
17
        <h1 id="logo"><img alt="Koha" src="[% interface %]/[% theme %]/img/koha.org-logo.gif"/> Welcome to Koha</h1>
18
    </div>
19
20
<!--New Library created-->
21
       [% IF message == "success_on_insert" %]
22
            <form name="createlibrary" method="post" action="onboarding.pl" >
23
                <input type="hidden" name="step" value="2"/>
24
                <h1 align="left"> New library</h1>
25
                <div>
26
                    <p> Success: library created!
27
                    </p>
28
                    <p> To add another library and for more settings, <br>
29
                    go to:<br>
30
                    More -> Administration -> Libraries and groups<br>
31
                    </p>
32
                </div>
33
                Next up:
34
                <input type="submit" name="start" value="Minimal patron category setup"/>
35
            </form>
36
37
        [%ELSE %]
38
            <form name="retrylibrary" method="post" action="onboarding.pl">
39
                <input type="hidden" name="step" value="1"/>
40
                <h1 align="left">Failed </h1>
41
                <div>
42
                    <p> Library was not successfully created</br>
43
                    Please try again or contact your system administrator. </p>
44
                </div>
45
                <input type="submit" value="Try again"/>
46
            </form>
47
        [%END%]
48
49
[% ELSE %]
50
    <head>
51
        <title>Welcome &rsaquo; to  &rsaquo; Koha</title>
52
    </head>
53
54
    <!--Header for the koha onboarding tool-->
55
    <div>
56
        <h1 id="logo"><img alt="Koha" src="[% interface %]/[% theme %]/img/koha.org-logo.gif"/> Welcome to Koha</h1>
57
    </div>
58
59
<!--Create a library screen 1-->
60
        <form name="LibraryCreation" method="post" action="onboarding.pl">
61
            <fieldset class="rows" >
62
                 <h2>Create a library</h2>
63
                 <input type="hidden" name="step" value="1"/>
64
                 <input type="hidden" name="op" value="add_validate_library"/>
65
                 <ol>
66
                     <li>
67
                        <label for="branchcode" class="required">Library code: </label>
68
                        <input type="text"  pattern="[0-9A-Za-z]{1,10}" title="Please enter up to 10 letters and/or numbers" name="branchcode" id="branchcode" size="10" maxlength="10" value="[% library.branchcode |html %]" class="required" required="required" />
69
                        <span class="required">Required</span>
70
                    </li>
71
                    <li>
72
                        <label for="branchname" class="required">Name: </label>
73
                        <input type="text" name="branchname" id="branchname" title="Please enter the name of your institution" size="42" value="[% library.branchname |html %]" class="    required" required="required" style="width:200px;">
74
                        <span class="required">Required</span>
75
                    </li>
76
                 </ol>
77
             <br>
78
             <input type="submit" class="action" value="Submit"/>
79
            </fieldset>
80
     </form>
81
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep2.tt (-164 lines)
Lines 1-164 Link Here
1
[% USE Koha %]
2
[% USE KohaDates %]
3
[% USE Price %]
4
[% INCLUDE 'doc-head-open.inc' %]
5
<title> Add a patron category</title>
6
[% INCLUDE 'installer-doc-head-close.inc' %]
7
[% INCLUDE 'calendar.inc' %]
8
[% INCLUDE 'js_includes.inc' %]
9
[% INCLUDE 'datatables.inc' %]
10
<script type="text/javascript">
11
    var MSG_CATEGORYCODE_CHARS=(_("Please only enter letters into this field."));
12
    var MSG_ONE_ENROLLMENTPERIOD =(_("Please choose an enrollment period in months OR by date."));
13
    var MSG_ONLY_ONE_ENROLLMENTPERIOD=(_("Please only choose one enrolment period."));
14
15
jQuery.validator.addMethod( "enrollment_period", function(){
16
      enrolmentperiod = $("#enrolmentperiod").val();
17
      enrolmentperioddate = $("#enrolmentperioddate").val();
18
      if (( $("#enrolmentperiod").val() == "" && $("#enrolmentperioddate").val() == "") || ($("#enrolmentperiod").val() !== "" && $("#enrolmentperioddate").val() !== "")) {
19
             return false;
20
      } else {
21
             return true;
22
      }
23
    }, MSG_ONE_ENROLLMENTPERIOD
24
);
25
</script>
26
<script type="text/javascript" src="[% themelang %]/js/categories.js"></script>
27
</head>
28
29
[% IF (categories && categories.count > 1 ) %] <!--This if statement checks if the categories variable handed to this template by onboarding.pl has data in it. If the categories variable does have data in it this means that the user has previously imported sample patron category data and so we do not need to show them the create patron category screen 1, instead we can display a screen with ubtton redirecting the user to step 3-->
30
31
32
     <meta http-equiv="refresh" content="0; url=/cgi-bin/koha/installer/onboarding.pl?step=3">
33
34
[% ELSIF (op == "add_validate_category") %]
35
<!--else if the user has not previously imported sample patron categories check if the user has pressed the button name="add_validate" in the create patron category screen 1, and if they have pressed that button then display the below screen with a button to redirect the user to step 3-->
36
37
    <div> <!-- Header that appears at the top of every screen in the koha onboarding tool-->
38
        <h1 id="logo"><img alt="Koha" src="[% interface %]/[% theme %]/img/koha.org-logo.gif"/> Welcome to Koha</h1>
39
    </div>
40
41
    [% IF message != "error_on_insert" %]
42
     <form name="createcat" method="post" action="onboarding.pl">
43
            <input type="hidden" name="step" value="3"/>
44
             <h1 align="left">  New patron category</h1>
45
             <div>
46
                 <p> Success: patron category created! </p>
47
                 <p> To add another patron category and for more settings<br>
48
                 go to:<br>
49
                 More -> Administration -> Patron categories<br>
50
             </div>
51
             Next up:<br>
52
             <input type="submit" name="start" value="Add a patron"><!-- When the user clicks on this button then redirect them to step 3 of the onboarding tool-->
53
     </form>
54
     [% ELSE %]
55
        <form name="retrypatcat" method="post" action="onboarding.pl">
56
        Message is [% message %]
57
        <input type="hidden" name="step" value="2"/>
58
            <h1 align="left">Failed</h1>
59
            <div>Patron category was not successfully created.</br>
60
            Please try again or contact your system administrator.</p>
61
            </div>
62
            <input type="submit" value="Try again"/>
63
        </form>
64
    [% END %]
65
66
67
[% ELSE %] <!--Else display create patron category screen 1 where the user can input values to create their first patron category-->
68
    <div> <!-- Header that appears at the top of every screen in the koha onboarding tool-->
69
        <h1 id="logo"><img alt="Koha" src="[% interface %]/[% theme %]/img/koha.org-logo.gif"/> Welcome to Koha</h1>
70
    </div>
71
72
    <h1 align="left"> Create a new patron category</h1>
73
    <p> The patron category you create in this form is going to be the one which the new administrator patron account will have.</p>
74
       <form id="category_form" method="post" action="onboarding.pl">
75
       <fieldset class="rows">
76
            <input type="hidden" name="step" value="2"/>
77
            <input type="hidden" name="op" value="add_validate_category" />
78
                <ol>
79
                    <li>
80
                        <label for="categorycode" class="required">Category code: </label>
81
                        <input type="text" pattern="[0-9A-Za-z]{1,10}" title="Please enter up to 10 letters and/or numbers" id="categorycode" name="categorycode" value="[% category.categorycode |html %]" size="10" maxlength="10" class="required" required="required" />
82
                        <span class="required">Required</span>
83
                    </li>
84
85
                    <li>
86
                        <label for="description" class="required">Description: </label>
87
                        <input type="text" name="description" title="Please enter a description of the category" size="40" maxlength="80" class="required" required="required" value="[% category.description |html%]" />
88
                        <span class="required">Required</span>
89
                    </li>
90
91
                    <li>
92
                        <label for="overduenoticerequired">Overdue notice required: </label>
93
                        <select name="overduenoticerequired" value="overduenoticerequired">
94
                            [% IF category.overduenoticerequired %]
95
                                <option value="0">No</option>
96
                                <option value="1" selected="selected">Yes</option>
97
                            [% ELSE %]
98
                                <option value="0" selected="selected">No</option>
99
                                <option value="1">Yes</option>
100
                            [% END %]
101
                        </select>
102
                    </li>
103
104
                    <li>
105
                        <label for="category_type" class="required">Category type: </label>
106
                        <select name="category_type" value="category_type" class='required' required='required'>
107
                            [% IF category and category.category_type == 'S' %]
108
                                <option value="S" selected="selected">Staff</option>
109
                            [% ELSE %]
110
                                <option value="S">Staff</option>
111
                            [% END %]
112
                        </select>
113
                        <span class="required">Required</span>
114
                    </li>
115
116
                    <li>
117
                        <label for="default_privacy">Default privacy: </label>
118
                        <select value="default_privacy" name="default_privacy" required="required">
119
                            [% SET default_privacy = 'default' %]
120
121
                            [% IF category %]
122
                               [% SET default_privacy = category.default_privacy %]
123
                            [% END %]
124
125
                            [% SWITCH default_privacy %]
126
                            [% CASE 'forever' %]
127
                                <option value="default">Default</option>
128
                                <option value="never">Never</option>
129
                                <option value="forever" selected="selected">Forever</option>
130
                            [% CASE 'never' %]
131
                                <option value="default">Default</option>
132
                                <option value="never" selected="selected">Never</option>
133
                                <option value="forever">Forever</option>
134
                            [% CASE %]
135
                                <option value="default" selected="selected">Default</option>
136
                                <option value="never">Never</option>
137
                                <option value="forever">Forever</option>
138
                            [% END %]
139
                        </select>
140
                        <p>Controls how long a patrons checkout history is kept for new patrons of this category. "Never"     anonymizes checkouts on return, and "Forever" keeps a patron's checkout history indefinitely. When set to "Default", the amount of history kept is controlled by the cronjob <i>batch_anonymise.pl</i> which should be set up by your system administrator.</p>
141
                    </li>
142
            </ol>
143
            <span class="label">Enrolment period: </span>
144
            </br>
145
                    <fieldset>
146
                    <legend>Choose one</legend>
147
                            <ol>
148
                                <li>
149
                                    <label for="enrolmentperiod" style="width:6em;">In months: </label>
150
                                    <input type="number" class="enrolmentperiod" name="enrolmentperiod" id="enrolmentperiod" size="3" maxlength="3" value="[% IF category.enrolmentperiod %][% category.enrolmentperiod %][% END %]" /> months
151
                                </li>
152
                                <li>
153
                                    <label for="enrolmentperioddate" style="width:6em;">Until date: </label>
154
                                    <input type="text" class="enrolmentperioddate datepicker" name="enrolmentperioddate" id="enrolmentperioddate" value="[% category.enrolmentperioddate | $KohaDates %]" />
155
                                </li>
156
                            </ol>
157
                     </fieldset>
158
                    <br>
159
                    <input type="submit" class="action" value="Submit" />
160
    </fieldset>
161
    </form>
162
[% END %]
163
164
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep3.tt (-196 lines)
Lines 1-196 Link Here
1
<!--Includes for creating patron-->
2
[% USE Koha %]
3
[% USE KohaDates %]
4
[% USE Price %]
5
[% INCLUDE 'doc-head-open.inc' %]
6
[% IF ( finish ) %]<meta http-equiv="refresh" content="10; url=/cgi-bin/koha/mainpage.pl">[% END%]
7
[% INCLUDE 'installer-doc-head-close.inc' %]
8
[% INCLUDE 'calendar.inc' %]
9
[% INCLUDE 'datatables.inc' %]
10
[% INCLUDE 'js_includes.inc' %]
11
12
<head>
13
<title>Create Koha administrator patron</title>
14
<!--jQuery scripts for creating patron-->
15
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.fixFloat.js"></script>
16
<script type="text/javascript">
17
     var MSG_PASSWORD_MISMATCH=(_("The entered passwords do not match, please rewrite them"));
18
     jQuery.validator.addMethod( "password_match", function(value,element){
19
        var password = document.getElementById('password').value
20
        var confirmpassword = document.getElementById('password2').value
21
        if ( password != confirmpassword ){
22
                return false;
23
        }
24
        else{
25
                return true
26
        }
27
     },  MSG_PASSWORD_MISMATCH
28
);
29
30
$(document).ready(function(){
31
   $("#Submit").click(function(){
32
      $("#createpatron").validate({
33
        rules: {
34
            surname: {
35
                required: true,
36
            },
37
            firstname: {
38
                required: true,
39
            },
40
            cardnumber: {
41
                required: true,
42
            },
43
            password: {
44
                 password_match:true
45
            }
46
        },
47
        messages: {
48
           password: {
49
                 required: MSG_PASSWORD_MISMATCH
50
           },
51
        }
52
      });
53
   });
54
});
55
</script>
56
</head>
57
58
<div>
59
    <h1 id="logo"><img alt="Koha" src="[% interface %]/[% theme %]/img/koha.org-logo.gif"/> Welcome to Koha</h1>
60
</div>
61
62
63
[%  IF (nok) %]
64
        <form name="errors" method="post" action="onboarding.pl">
65
            <input type="hidden" name="step" value="3"/>
66
            <h1 align="left">There was an error</h1>
67
            <p>Try again </p>
68
            <div>
69
            <ul>
70
            [% IF errorloginexists %]
71
                <li id="ERROR_login_exist">Username/password already exists.</li>
72
            [% END %]
73
            [% IF errorcardnumberexists %]
74
                <li id="ERROR_cardnumber">Cardnumber already in use.</li>
75
            [% END %]
76
            [% IF errorcardnumberlength %]
77
                <li id="ERROR_cardnumber">Cardnumber length is incorrect</li>
78
            [% END %]
79
            [% IF errorshortpassword %]
80
                <li id="ERROR_short_password">Password length is incorrect, must be at least [% minPasswordLength %] characters long.</li>
81
            [% END %]
82
            [% IF errorpasswordmismatch %]
83
                <li id="ERROR_password_mismatch">Passwords do not match.</li>
84
            [% END %]
85
            </ul>
86
87
            </div>
88
            <input type="submit" name="step" value="Try again"/>
89
        </form>
90
91
92
<!--Create a patron screen 2-->
93
[% ELSIF op == 'add_validate' %]
94
          <!--New patron created-->
95
        <form name="patrondone" method="post" action="onboarding.pl">
96
            <input type="hidden" name="step" value="4"/>
97
            <h1 align="left"> Koha administrator patron </h1>
98
            <div>
99
                 <p> Success: administrator patron created!</p>
100
                 <p> To create another patron, go to Patrons -> New Patron. <br>
101
                More -> Set Permissions in a user page to gain superlibrarian permissions.
102
            </div>
103
            Next up:
104
            <input type="submit" name="start" value="Minimal item type setup"/>
105
        </form>
106
[% ELSE %]
107
<!--Create a patron screen 1-->
108
       <h1 align="left"> Create koha administrator patron</h1>
109
        <p>
110
        Now we will create a patron with superlibrarian permissions. Login with this to access Koha as a staff member will all permissions.
111
        </p>
112
        <form name="createpatron" id="createpatron" method="post" action="onboarding.pl">
113
            <fieldset class="rows">
114
                 <input type="hidden" name="step" value="3"/>
115
                 <input type="hidden" name="op" value="add_validate" />
116
                    <legend id="library_management_lgd">Library management</legend>
117
                    <ol>
118
                    <h3>Patron identity</h3>
119
                        <li>
120
                            <label for="surname" class="required">Surname: </label>
121
                            <input type="text" id="surname" name="surname" title="Please only enter letters in the surname field" value="[% surname |html %]" class="required" required="required" />
122
                            <span class="required">Required</span>
123
                        </li>
124
                        <li>
125
                            <label for="firstname" class="required">First name: </label>
126
                            <input  type="text" name="firstname" title="Please only enter letters in the first name field" id="firstname" size="20" value="[% firstname |html %]" class="required" required="required">
127
                            <span class="required">Required</span>
128
                        </li>
129
                    </ol>
130
131
                    <ol>
132
                        <li>
133
                            <label for="cardnumber" class="required">Card number: </label>
134
                            [% IF patrons && patrons > 1 %]
135
                                <input type="text" id="cardnumber" title="Please enter a cardnumber" class="noEnterSubmit valid" name="cardnumber" value="[% newcardnumber | html %]" class="required" required="required">
136
                            [% ELSE %]
137
                                <input type="text" id="cardnumber" title="Please enter a cardnumber" name="cardnumber" value="[% cardnumber | html %]" class="required" required="required">
138
                            [% END %]
139
                            <span class="required">Required</span>
140
                        </li>
141
                        <li>
142
143
                        <!--require a foreach loop to get all the values for the library that the user has either imported (in web installer) or created in the first step of this onboarding tool-->
144
                            <label for="libraries" class="required"> Library: </label>
145
                            <select name="libraries" size="1" id="libraries">
146
147
                             [% FOREACH library IN libraries %]
148
                                  <option name="libraries" value="[% library.branchcode %]"> [% library.branchname %]
149
                             [% END %]
150
151
                                </select>
152
                            <span class="required"> Required</span>
153
                        </li>
154
                        <li>
155
                            <label for="categorycode_entry" class="required"> Patron category</label>
156
                            <select id="categorycode_entry" name="categorycode_entry" onchange="update_category_code(this);">
157
                            [% FOREACH category IN categories %]
158
                                <option name="categorycode_entry" value = "[% category.categorycode %]">[%category.description %]</option>
159
                            [% END %]
160
                            </select>
161
                            <span class="required">Required</span><br><br>
162
                            <b>Note:</b> If you installed sample patron categories please select the "Staff" option in the patron categories dropdown box.
163
                        </li>
164
                    </ol>
165
166
                    <ol>
167
                            <h3> Koha administrator patron permissions</h3>
168
                            <input type="hidden" name="newflags" value="1"/>
169
                            <li>
170
                                <input type="hidden" class="flag parent" id="flag-0" name="flag" value="superlibrarian"/>
171
                                <label name="permissioncode" for="flag-0"> superlibrarian</label>
172
                            </li>
173
                    </ol>
174
                    <ol>
175
                    <h3>OPAC/Staff Login</h3>
176
                        <li>
177
                            <input type="hidden" name="BorrowerMandatoryField" value = "[% BorrowerMandatoryField %]" />
178
                            <label for="userid" class="required">Username: </label>
179
                            <input type="text" name="userid" id ="userid" size="20" title="Please only enter a username of letters and numbers" value="[% userid |html %]" class="required" required="required" />
180
                            <span class="required">Required</span>
181
                        </li>
182
                        <li>
183
                            <label for="passwordlabel" class="required">Password: </label>
184
                            <input type="password" name="password" id="password" size="20" value="[% member.password |html %]" class="required" required="required">
185
                            <span class="required">Required</span>
186
                        </li>
187
                        <li>
188
                            <label for="password2" class="required">Confirm password: </label>
189
                            <input type="password" id="password2" name="password2" size="20" value="" class="required" required="required">
190
                            <span class="required">Required</span>
191
                        </li>
192
                    </ol>
193
             </fieldset><br>
194
                <input type="submit" id="Submit" class="action" value="Submit"/>
195
     </form>
196
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep4.tt (-67 lines)
Lines 1-67 Link Here
1
<!-- includes for creating item type-->
2
[% INCLUDE 'doc-head-open.inc' %]
3
[% IF ( finish ) %]<meta http-equiv="refresh" content="10; url=/cgi-bin/koha/mainpage.pl">[% END%]
4
[% INCLUDE 'installer-doc-head-close.inc' %]
5
<head>
6
    <title>Create item type</title>
7
</head>
8
<div>
9
    <h1 id="logo"><img alt="Koha" src="[% interface %]/[% theme %]/img/koha.org-logo.gif"/> Welcome to Koha</h1>
10
</div>
11
12
[% IF (itemtypes && itemtypes.count >1) %]
13
14
     <meta http-equiv="refresh" content="0; url=/cgi-bin/koha/installer/onboarding.pl?step=5">
15
16
[% ELSIF op == "add_validate" %]
17
        [% IF message != "error_on_insert" %]
18
            <form name="createitemtype" method="post" action="onboarding.pl">
19
                <input type="hidden" name="step" value="5"/>
20
                <h1 align="left"> New Item type </h1>
21
                <div>
22
                    <p> Success: New item type created!</p>
23
                    <p> To create another item type later and for more settings <br>
24
                    go to: <br>
25
                    More -> Administration -> Item types <br>
26
                </div>
27
                Next up:
28
                <input type="submit" value="Add a circulation rule"/>
29
            </form>
30
        [% ELSE %]
31
        <form name="retryitem" method="post" action="onboarding.pl">
32
            <input type="hidden" name="step" value="4"/>
33
            <h1 align="left">Failed </h1>
34
            <div>
35
                <p>Item type was not successfully created. </br>
36
                Please try again or contact your system administrator.
37
                </p>
38
            </div>
39
        </form>
40
        <!--Implement a if statement to check if the item type was successfully created or not -->
41
        [% END %]
42
[% ELSE %]
43
    <!--Create a item type screen 1-->
44
        <h1 align="center"> Create a new Item type </h1>
45
        <p> Item types are used to group related items. Examples of item types are books, cds, and DVDs. <br><br> When adding to your institutions catalogue you will create an item of a particular item type. <br><br> Importantly item types are what you apply     circulation rules to. Circulation rules govern how your institution will lend its items, for example a circulation rule applied to the DVD item type may enforce a payment of $1.00 for borrowing any DVD.</p>
46
        <form name="createitemform" method="post" action="onboarding.pl">
47
            <fieldset class="rows">
48
                <input type="hidden" name="step" value="4"/>
49
                <input type="hidden" name="op" value="add_validate" />
50
                <ol>
51
                    <li>
52
                        <label for="itemtype" class="required">Item type code: </label>
53
                        <input type="text" name="itemtype" pattern="[0-9A-Za-z]{1,10}" title="Please enter up to 10 letters and/or numbers" id="itemtype" size="10" maxlength="10"  class="required" required="required" value="[% itemtype.itemtype |html %]" />
54
                        <span class="required">Required</span>
55
                    </li>
56
57
                    <li>
58
                        <label for="description" class="required">Description: </label>
59
                        <input type="text" name="description" id="description" title="Please only enter letters and/or numbers into this item type description" size="42" value="[% itemtype.description |html %]" class="required" required="required">
60
                        <span class="required">Required</span>
61
                    </li>
62
                </ol>
63
            <br>
64
            <input type="submit" class="action" value="Submit"/>
65
        </fieldset>
66
        </form>
67
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep5.tt (-128 lines)
Lines 1-127 Link Here
1
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Create Circulation rule</title>
3
[% IF ( finish ) %]<meta http-equiv="refresh" content="10; url=/cgi-bin/koha/mainpage.pl">[% END %]
4
[% INCLUDE 'installer-doc-head-close.inc' %]
5
6
<div>
7
    <h1 id="logo"><img alt="Koha" src="[% interface %]/[% theme %]/img/koha.org-logo.gif"/> Welcome to Koha</h1>
8
</div>
9
10
[% IF (finish) %]
11
<h1>Congratulations you have finished and ready to use Koha</h1>
12
<a href="/cgi-bin/koha/mainpage.pl">Start using Koha</a>
13
14
[% END %]
15
16
<!--Create a circulation rule screen 2-->
17
[% IF op == "add_validate" %]
18
        <!--New circulation rule created-->
19
        <form name="finish" method="post" action="onboarding.pl">
20
            <input type="hidden" name="op" value="finish" />
21
            <h1 align="left"> New circulation rule </h1>
22
            <div>
23
                 <p> Success: circulation rule created!</p>
24
                 <p> To create circulation rule, go to <br>
25
                 More -> Administration -> Circulation and Fine Rules
26
            </div>
27
                 Next up:
28
                 <input type="submit" name="op" value="Finish"/>
29
        </form>
30
[% ELSE %]
31
<!--Create a circulation rule screen 1-->
32
       <h1 align="left"> Create a new circulation rule </h1>
33
       <form name="createcirculationrule" method="post" action="onboarding.pl">
34
            <fieldset class="rows">
35
                 <input type="hidden" name="step" value="5"/>
36
                 <input type="hidden" name="op" value="add_validate" />
37
                    <ol>
38
                    <li>
39
                        <label for="branch" class="required"> Library branch</label>
40
                        <select name="branch" id="branchname" required="required">
41
                        <option value""> Choose</option>
42
                        <option value="*" selected="selected">All</option>
43
                        [% FOREACH library IN libraries %]
44
                            <option id="branch" value="[% library.branchcode %]"> [% library.branchname %]</option>
45
                        [% END %]
46
                        </select>
47
                        <span class="required">Required</span>
48
                    </li>
49
                    <li>
50
                        <label for="categorycode" class="required">Patron category: </label>
51
                        <select name="categorycode" id="categorycodeselection" required="required" onchange = "update_categorycode(this);">
52
                            <option value=""> Choose</option>
53
                            <option value="*" selected="selected">All</option>
54
                            [% FOREACH category IN categories %]
55
                                <option id="categorycode" value = "[% category.categorycode %]"> [%category.description %]</option>
56
                            [%END%]
57
                        </select>
58
                        <span class="required">Required</span>
59
                    </li>
60
61
                    <li>
62
                        <label for="itemtype"> Item type: </label>
63
                        <select id="itemtype" name="itemtype" required="required">
64
                        <option value""> Choose </option>
65
                        <option value="*" selected="selected">All</option>
66
                            [% FOREACH item IN itemtypes %]
67
                                <option name="itemtype" value = "[% item.itemtype %]"> [% item.itemtype %]
68
                            [%END%]
69
                        </select>
70
                        <span class="required"> Required</span>
71
                    </li>
72
                    <li>
73
                        <label for="maxissueqty" class="required">Current checkouts allowed: </label>
74
                        <input type="number" min="0" name="maxissueqty" title="Please only enter numbers" id="maxissueqty" size="10" max="10" value="" class="required" required="required" />
75
                        <span class="required">Required</span>
76
                    </li>
77
78
                    <li>
79
                        <label for="issuelength" class="required">Loan period: </label>
80
                        <input type="number" min="0" name="issuelength" title="Please only enter numbers" id="issuelength" size="10" max="10" value="" class="required" required="required" />
81
                        <span class="required">Required</span>
82
                   </li>
83
                   <li>
84
                        <label for="lengthunit">Units: </label>
85
                        <select name="lengthunit" id="lengthunit" required="required">
86
                        <option value=""> Choose </option>
87
                        [% SET units = 'days' %]
88
                        [% IF category %]
89
                            [% SET default_privacy = category.default_privacy %]
90
                        [% END %]
91
92
                        [% SWITCH units %]
93
                             [% CASE 'days' %]
94
                                   <option value="days" selected="selected">Days</option>
95
                                   <option value="hours">Hours</option>
96
                             [% CASE 'hours' %]
97
                                   <option value="days">Days</option>
98
                                   <option value="hours" selected="selected">Hours</option>
99
                        [% END %]
100
                        </select>
101
                     </li>
102
                     <li>
103
                        <label for="renewalsallowed" class="required">Renewals allowed: </label>
104
                        <input type="number" min="0" name="renewalsallowed" title="Please only enter numbers" id="renewalsallowed" size="10" max="10" value="" class="required" required="required" />
105
                        <span class="required">Required</span>
106
                     </li>
107
108
                     <li>
109
                        <label for="renewalperiod" class="required">Renewals period: </label>
110
                        <input type="number" min="0" name="renewalperiod" title="Please only enter numbers" id="renewalperiod" size="10" max="10" value="" class="required" required="required" />
111
                        <span class="required">Required</span>
112
                     </li>
113
114
                     <li>
115
                        <label for="onshelfholds">On shelf holds allowed: </label>
116
                        <select name="onshelfholds" id="onshelfholds" required="required">
117
                              <option value="">Choose</option>
118
                              <option value="1" selected="selected">Yes</option>
119
                              <option value="0">If any unavailable</option>
120
                              <option value="2">If all unavailable</option>
121
                        </select>
122
                     </li>
123
                  </ol>
124
            </fieldset><br>
125
                <input type="submit" class="action" value="Submit"/>
126
     </form>
127
[% END %]
128
- 

Return to bug 18346