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

(-)a/installer/install.pl (+23 lines)
Lines 1-5 Link Here
1
#!/usr/bin/perl
1
#!/usr/bin/perl
2
2
3
# This file is part of Koha.
4
# #
5
# # Copyright (C) YEAR  YOURNAME-OR-YOUREMPLOYER
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
3
use strict;
20
use strict;
4
use warnings;
21
use warnings;
5
use diagnostics;
22
use diagnostics;
Lines 199-204 elsif ( $step && $step == 3 ) { Link Here
199
        # The installer will have to relogin since we do not pass cookie to redirection.
216
        # The installer will have to relogin since we do not pass cookie to redirection.
200
        $template->param( "$op" => 1 );
217
        $template->param( "$op" => 1 );
201
    }
218
    }
219
202
    elsif ( $op && $op eq 'addframeworks' ) {
220
    elsif ( $op && $op eq 'addframeworks' ) {
203
    #
221
    #
204
    # 1ST install, 3rd sub-step : insert the SQL files the user has selected
222
    # 1ST install, 3rd sub-step : insert the SQL files the user has selected
Lines 250-255 elsif ( $step && $step == 3 ) { Link Here
250
        $template->param( "en_sample_data" => $sample_defaulted_to_en);
268
        $template->param( "en_sample_data" => $sample_defaulted_to_en);
251
        $template->param( "levelloop" => $levellist );
269
        $template->param( "levelloop" => $levellist );
252
        $template->param( "$op"       => 1 );
270
        $template->param( "$op"       => 1 );
271
272
        my $setup = $query->param('setup');
273
        $template->param( "setup"=> $setup );
274
253
    }
275
    }
254
    elsif ( $op && $op eq 'choosemarc' ) {
276
    elsif ( $op && $op eq 'choosemarc' ) {
255
        #
277
        #
Lines 270-275 elsif ( $step && $step == 3 ) { Link Here
270
        # But could also be useful to have some Authorised values data set prepared here.
292
        # But could also be useful to have some Authorised values data set prepared here.
271
        # Marcflavour Selection is achieved through radiobuttons.
293
        # Marcflavour Selection is achieved through radiobuttons.
272
        my $langchoice = $query->param('fwklanguage');
294
        my $langchoice = $query->param('fwklanguage');
295
273
        $langchoice = $query->cookie('KohaOpacLanguage') unless ($langchoice);
296
        $langchoice = $query->cookie('KohaOpacLanguage') unless ($langchoice);
274
	$langchoice =~ s/[^a-zA-Z_-]*//g;
297
	$langchoice =~ s/[^a-zA-Z_-]*//g;
275
        my $dir =
298
        my $dir =
(-)a/installer/onboarding.pl (+594 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
#Recommended pragmas
3
4
# This file is part of Koha.
5
# #
6
# # Copyright (C) YEAR  YOURNAME-OR-YOUREMPLOYER
7
# #
8
# # Koha is free software; you can redistribute it and/or modify it
9
# # under the terms of the GNU General Public License as published by
10
# # the Free Software Foundation; either version 3 of the License, or
11
# # (at your option) any later version.
12
# #
13
# # Koha is distributed in the hope that it will be useful, but
14
# # WITHOUT ANY WARRANTY; without even the implied warranty of
15
# # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
# # GNU General Public License for more details.
17
# #
18
# # You should have received a copy of the GNU General Public License
19
# # along with Koha; if not, see <http://www.gnu.org/licenses>.
20
21
use strict;
22
use warnings;
23
use diagnostics;
24
25
use Modern::Perl;
26
use C4::InstallAuth;
27
use CGI qw ( -utf8 );
28
use List::MoreUtils qw/uniq/;
29
use Digest::MD5 qw(md5_base64);
30
use Encode qw( encode );
31
use C4::Koha;
32
use C4::Auth;
33
use C4::Context;
34
use C4::Output;
35
use C4::Form::MessagingPreferences;
36
use C4::Members;
37
use C4::Members::Attributes;
38
use C4::Members::AttributeTypes;
39
use C4::Log;
40
use C4::Letters;
41
use C4::Form::MessagingPreferences; 
42
use Koha::AuthorisedValues;
43
use Koha::Patron::Debarments;
44
use Koha::Cities;
45
use Koha::Patrons;
46
use Koha::Items;
47
use Koha::Libraries;
48
use Koha::LibraryCategories;
49
use Koha::Database;
50
use Koha::DateUtils;
51
use Koha::Patron::Categories;
52
use Koha::Patron::HouseboundRole;
53
use Koha::Patron::HouseboundRoles;
54
use Koha::Token;
55
use Email::Valid;
56
use Module::Load;
57
use Koha::ItemTypes;
58
use Koha::IssuingRule;
59
use Koha::IssuingRules;
60
61
#Setting variables
62
my $input    = new CGI;
63
my $query    = new CGI;
64
my $step     = $query->param('step');
65
66
#Getting the appropriate template to display to the user
67
my ( $template, $loggedinuser, $cookie) = C4::InstallAuth::get_template_and_user(
68
     {
69
        template_name => "/onboarding/onboardingstep" . ( $step ? $step : 0 ) . ".tt",
70
        query         => $query,
71
        type          => "intranet",
72
        authnotrequired => 0,
73
        debug           => 1,
74
    }
75
);
76
77
#Check database connection
78
my %info;
79
$info{'dbname'} = C4::Context->config("database");
80
$info{'dbms'} =
81
(   C4::Context->config("db_scheme")
82
    ? C4::Context->config("db_scheme")
83
     : "mysql" );
84
85
$info{'hostname'} = C4::Context->config("hostname");
86
$info{'port'}     = C4::Context->config("port");
87
$info{'user'}     = C4::Context->config("user");
88
$info{'password'} = C4::Context->config("pass");
89
my $dbh = DBI->connect(
90
         "DBI:$info{dbms}:dbname=$info{dbname};host=$info{hostname}"
91
          . ( $info{port} ? ";port=$info{port}" : "" ),
92
           $info{'user'}, $info{'password'}
93
);
94
95
96
#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.
97
my $op = $query->param('op');
98
$template->param('op'=>$op);
99
if ( $op && $op eq 'finish' ) { #If the value of $op equals 'finish' then redirect user to /cgi-bin/koha/mainpage.pl
100
    print $query->redirect("/cgi-bin/koha/mainpage.pl");
101
    exit;
102
}
103
104
105
#Store the value of the template input name='start' in the variable $start so we can check if the user has pressed this button and started the onboarding tool process
106
my $start = $query->param('start');
107
$template->param('start'=>$start);
108
109
if ( $start && $start eq 'Start setting up my Koha' ){
110
    my $libraries = Koha::Libraries->search( {}, { order_by => ['branchcode'] }, );
111
    $template->param(libraries   => $libraries,
112
              group_types => [
113
                {   categorytype => 'searchdomain',
114
                    categories   => [ Koha::LibraryCategories->search( { categorytype => 'searchdomain' } ) ],
115
                },
116
                {   categorytype => 'properties',
117
                         categories   => [ Koha::LibraryCategories->search( { categorytype => 'properties' } ) ],
118
                },
119
              ]
120
    );
121
122
123
}elsif ( $start && $start eq 'Add a patron category' ){
124
#Select all the patron category records in the categories database table and give them to the template
125
    my $categories = Koha::Patron::Categories->search();
126
    $template->param(
127
        categories => $categories,
128
    );
129
130
131
#Check if the $step variable equals 1 i.e. the user has clicked to create a library in the create library screen 1 
132
}elsif ( $step && $step == 1 ) {
133
    my $createlibrary = $query->param('createlibrary'); #Store the inputted library branch code and name in $createlibrary variable
134
    $template->param('createlibrary'=>$createlibrary); # Hand the library values back to the template in the createlibrary variable
135
136
    #store inputted parameters in variables
137
    my $branchcode       = $input->param('branchcode');
138
    $branchcode = uc($branchcode);
139
    my $categorycode     = $input->param('categorycode');
140
    my $op               = $input->param('op') || 'list';
141
    my $message;
142
    my $library;
143
144
    #Take the text 'branchname' and store it in the @fields array
145
    my @fields = qw(
146
        branchname
147
    );
148
149
    $template->param('branchcode'=>$branchcode); 
150
    $branchcode =~ s|\s||g; # Use a regular expression to check the value of the inputted branchcode 
151
152
    #Create a new library object and store the branchcode and @fields array values in this new library object
153
    my $library = Koha::Library->new(
154
        {   branchcode => $branchcode,
155
            ( map { $_ => scalar $input->param($_) || undef } @fields )
156
        }
157
    );
158
159
    eval { $library->store; }; #Use the eval{} function to store the library object
160
    if($library){
161
       $message = 'success_on_insert';
162
    }else{
163
       $message = 'error_on_insert';
164
    }
165
166
    $template->param('message' => $message);
167
168
169
#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
170
}elsif ( $step && $step == 2 ){
171
      my $createcat = $query->param('createcat'); #Store the inputted category code and name in $createcat
172
      $template->param('createcat'=>$createcat);
173
174
     #Initialising values
175
     my $searchfield   = $input->param('description') // q||;
176
     my $categorycode  = $input->param('categorycode');
177
     my $op            = $input->param('op') // 'list';
178
     my $message;
179
     my $category;
180
     $template->param('categorycode' =>$categorycode);
181
182
     my ( $template, $loggedinuser, $cookie ) =  C4::InstallAuth::get_template_and_user(
183
     {
184
        template_name   => "/onboarding/onboardingstep2.tt",
185
        query           => $input,
186
        type            => "intranet",
187
        authnotrequired => 0,
188
        flagsrequired   => { parameters => 'parameters_remaining_permissions' },
189
        debug           => 1,
190
        }
191
    );
192
    
193
    #Once the user submits the page, this code validates the input and adds it
194
    #to the database as a new patron category 
195
    $categorycode = $input->param('categorycode');
196
    my $description = $input->param('description');
197
    my $overduenoticerequired = $input->param('overduenoticerequired');
198
    my $category_type = $input->param('category_type');
199
    my $default_privacy = $input->param('default_privacy');
200
    my $enrolmentperiod = $input->param('enrolmentperiod');
201
    my $enrolmentperioddate = $input->param('enrolmentperioddate') || undef;
202
203
    #Converts the string into a date format
204
    if ( $enrolmentperioddate) {
205
         $enrolmentperioddate = output_pref(
206
                    {
207
                    dt         => dt_from_string($enrolmentperioddate),
208
                    dateformat => 'iso',
209
                    dateonly   => 1,
210
                    }
211
            );
212
        }
213
214
#Adds a new patron category to the database
215
        $category = Koha::Patron::Category->new({
216
                categorycode=> $categorycode,
217
                description => $description,
218
                overduenoticerequired => $overduenoticerequired,
219
                category_type=> $category_type,
220
                default_privacy => $default_privacy,
221
                enrolmentperiod => $enrolmentperiod,
222
                enrolmentperioddate => $enrolmentperioddate,
223
        });
224
225
        eval {
226
            $category->store;
227
        };
228
229
#Error messages
230
        if($category){
231
            $message = 'success_on_insert';
232
        }else{
233
            $message = 'error_on_insert';
234
        }
235
236
        $template->param('message' => $message);
237
238
#Create a patron
239
}elsif ( $step && $step == 3 ){
240
    my $firstpassword = $input->param('password');
241
    my $secondpassword = $input->param('password2');
242
243
#Find all library records in the database and hand them to the template to display in the library dropdown box
244
    my $libraries = Koha::Libraries->search( {}, { order_by => ['branchcode'] }, );
245
    $template->param(libraries   => $libraries,
246
              group_types => [
247
                {   categorytype => 'searchdomain',
248
                    categories   => [ Koha::LibraryCategories->search( { categorytype => 'searchdomain' } ) ],
249
                },
250
                {   categorytype => 'properties',
251
                         categories   => [ Koha::LibraryCategories->search( { categorytype => 'properties' } ) ],
252
                },
253
              ]
254
    );
255
256
#Find all patron categories in the database and hand them to the template to display in the patron category dropdown box
257
    my $categories= Koha::Patron::Categories->search();
258
    $template->param(
259
            categories => $categories,
260
    );
261
262
#Incrementing the highest existing patron cardnumber to prevent duplicate cardnumber entry
263
    my $exisiting_cardnumber = my $sth_search = $dbh->prepare("SELECT MAX(cardnumber) FROM borrowers");
264
    my $new_cardnumber = $exisiting_cardnumber + 1;
265
    warn $new_cardnumber;
266
    $template->param("newcardnumber" => $new_cardnumber);
267
268
269
270
    my $op = $input->param('op') // 'list';
271
    my $minpw = C4::Context->preference("minPasswordLength");
272
    $template->param("minPasswordLength" => $minpw);
273
274
    my @messages;
275
    my @errors;
276
    my $nok = $input->param('nok');
277
    my $firstpassword = $input->param('password');
278
    my $secondpassword = $input->param('password2');
279
    my $cardnumber= $input->param('cardnumber');
280
    my $borrowernumber= $input->param('borrowernumber');
281
    my $userid=$input->param('userid');
282
283
#If the entered cardnumber causes an error hand this error to the @errors array
284
    if(my $error_code = checkcardnumber($cardnumber, $borrowernumber)){
285
            push @errors, $error_code == 1
286
                ? 'ERROR_cardnumber_already_exists'
287
                :$error_code == 2
288
                    ? 'ERROR_cardnumber_length'
289
                    :()
290
    }
291
292
#If the entered password causes an error hand this error to the @errors array
293
  push @errors, "ERROR_password_mismatch" if $firstpassword ne $secondpassword;
294
  push @errors, "ERROR_short_password" if ($firstpassword && $minpw && $firstpassword ne '****' && (length($firstpassword) < $minpw));
295
296
297
#Passing errors to template
298
   $nok = $nok || scalar(@errors);
299
300
#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
301
   if($nok){
302
      foreach my $error (@errors){
303
          if ($error eq 'ERROR_password_mismatch'){
304
              $template->param(errorpasswordmismatch => 1);
305
           }
306
           if ($error eq 'ERROR_login_exist'){
307
                $template->param(errorloginexists =>1);
308
           }
309
           if ($error eq 'ERROR_cardnumber_already_exists'){
310
                $template->param(errorcardnumberexists => 1);
311
           }
312
           if ($error eq 'ERROR_cardnumber_length'){
313
                $template->param(errorcardnumberlength => 1);
314
           }
315
           if ($error eq 'ERROR_short_password'){
316
                $template->param(errorshortpassword => 1);
317
           }
318
       }
319
        $template->param('nok' => 1);
320
321
#Else if no errors have been caused by the users inputted card number or password then insert the patron into the borrowers table
322
   }else{
323
    my ($template, $loggedinuser, $cookie)= C4::InstallAuth::get_template_and_user({
324
                template_name => "/onboarding/onboardingstep3.tt",
325
                query => $input,
326
                type => "intranet",
327
                authnotrequired => 0,
328
                flagsrequired => {borrowers => 1},
329
                debug => 1,
330
    });
331
332
    if($op eq 'add_validate'){
333
         my %newdata;
334
335
#Store the template form values in the newdata hash      
336
         $newdata{borrowernumber} = $input->param('borrowernumber');       
337
         $newdata{surname}  = $input->param('surname');
338
         $newdata{firstname}  = $input->param('firstname');
339
         $newdata{cardnumber} = $input->param('cardnumber');
340
         $newdata{branchcode} = $input->param('libraries');
341
         $newdata{categorycode} = $input->param('categorycode_entry');
342
         $newdata{userid} = $input->param('userid');
343
         $newdata{password} = $input->param('password');
344
         $newdata{password2} = $input->param('password2');
345
         $newdata{dateexpiry} = '12/10/2016';
346
         $newdata{privacy} = "default";
347
348
349
#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
350
        my $borrowernumber = &AddMember(%newdata);
351
352
#Create a hash named member2 and fill it with the borrowernumber of the borrower that has just been created
353
        my %member2;
354
        $member2{'borrowernumber'}=$borrowernumber;
355
356
#Perform data validation on the flag that has been handed to onboarding.pl by the template
357
        my $flag = $input->param('flag');
358
        if ($input->param('newflags')) {
359
             my $dbh=C4::Context->dbh();
360
             my @perms = $input->multi_param('flag');
361
             my %all_module_perms = ();
362
             my %sub_perms = ();
363
             foreach my $perm (@perms) {
364
                  if ($perm !~ /:/) {
365
                       $all_module_perms{$perm} = 1;
366
                   } else {
367
                        my ($module, $sub_perm) = split /:/, $perm, 2;
368
                        push @{ $sub_perms{$module} }, $sub_perm;
369
                   }
370
             }
371
372
             # construct flags
373
             my $module_flags = 0;
374
             my $sth=$dbh->prepare("SELECT bit,flag FROM userflags ORDER BY bit");
375
             $sth->execute();
376
             while (my ($bit, $flag) = $sth->fetchrow_array) {
377
                  if (exists $all_module_perms{$flag}) {
378
                     $module_flags += 2**$bit;
379
                  }
380
             }
381
382
#Set the superlibrarian permission of the newly created patron to superlibrarian
383
             $sth = $dbh->prepare("UPDATE borrowers SET flags=? WHERE borrowernumber=?");
384
             $sth->execute($module_flags, $borrowernumber);
385
386
387
             #Error handling checking if the patron was created successfully
388
             if(!$borrowernumber){
389
                  push @messages, {type=> 'error', code => 'error_on_insert'};
390
             }else{
391
                  push @messages, {type=> 'message', code => 'success_on_insert'};
392
             }
393
          }
394
        }
395
    }
396
397
 }elsif ( $step && $step == 4){
398
    my $createitemtype = $input->param('createitemtype');
399
    $template->param('createitemtype'=> $createitemtype );
400
401
402
    my( $template, $borrowernumber, $cookie) = C4::InstallAuth::get_template_and_user(
403
            {   template_name   => "/onboarding/onboardingstep4.tt",
404
                query           => $input,
405
                type            => "intranet",
406
                authnotrequired => 0,
407
                flagsrequired   => { parameters => 'parameters_remaining_permissions'},
408
                debug           => 1,
409
            }
410
    );
411
412
    if($op eq 'add_validate'){
413
        my $description = $input->param('description');
414
        my $itemtype_code = $input->param('itemtype');
415
        $itemtype_code = uc($itemtype_code);
416
        #Create a new itemtype object using the user inputted itemtype and description
417
        my $itemtype= Koha::ItemType->new(
418
            { itemtype    => $itemtype_code,
419
              description => $description,
420
            }
421
        );
422
423
        eval{ $itemtype->store; };
424
425
        my $message;
426
427
#Fill the $message variable with an error if the item type object was not successfully created and inserted into the itemtypes table
428
        if($itemtype){
429
            $message = 'success_on_insert';
430
        }else{
431
            $message = 'error_on_insert';
432
        }
433
434
        $template->param('message' => $message);
435
    }
436
}elsif ( $step && $step == 5){
437
438
    #Find all the existing categories to display in a dropdown box in the template
439
    my $categories;
440
    $categories= Koha::Patron::Categories->search();
441
    $template->param(
442
        categories => $categories,
443
    );
444
445
    #Find all the exisiting item types to display in a dropdown box in the template
446
    my $itemtypes;
447
    $itemtypes= Koha::ItemTypes->search();
448
    $template->param(
449
        itemtypes => $itemtypes,
450
    );
451
452
    #Find all the exisiting libraries to display in a dropdown box in the template
453
    my $libraries = Koha::Libraries->search( {}, { order_by => ['branchcode'] }, );
454
    $template->param(libraries   => $libraries,
455
                     group_types => [
456
                {   categorytype => 'searchdomain',
457
                    categories   => [ Koha::LibraryCategories->search( { categorytype => 'searchdomain' } ) ],
458
                },
459
                {   categorytype => 'properties',
460
                    categories   => [ Koha::LibraryCategories->search( { categorytype => 'properties' } ) ],
461
                },
462
                ]
463
    );
464
465
    my $input = CGI->new;
466
    my $dbh = C4::Context->dbh;
467
468
    my ($template, $loggedinuser, $cookie) = C4::InstallAuth::get_template_and_user({template_name => "/onboarding/onboardingstep5.tt",
469
                query => $input,
470
                type => "intranet",
471
                authnotrequired => 0,
472
                flagsrequired => {parameters => 'manage_circ_rules'},
473
                debug => 1,
474
    });
475
476
#If no libraries exist then set the $branch value to *
477
    my $branch = $input->param('branch');
478
    unless ( $branch ) {
479
          if ( C4::Context->preference('DefaultToLoggedInLibraryCircRules') ) {
480
                $branch = Koha::Libraries->search->count() == 1 ? undef : C4::Context::mybranch();
481
           }
482
           else {
483
                $branch = C4::Context::only_my_library() ? ( C4::Context::mybranch() || '*' ) : '*';
484
           }
485
    }
486
    $branch = '*' if $branch eq 'NO_LIBRARY_SET';
487
    my $op = $input->param('op') || q{};
488
489
    if($op eq 'add_validate'){
490
        my $type = $input->param('type');
491
        my $br = $input->param('branch');
492
        my $bor = $input->param('categorycode');
493
        my $itemtype = $input->param('itemtype');
494
        my $maxissueqty = $input->param('maxissueqty');
495
        my $issuelength = $input->param('issuelength');
496
        my $lengthunit = $input->param('lengthunit');
497
        my $renewalsallowed = $input->param('renewalsallowed');
498
        my $renewalperiod = $input->param('renewalperiod');
499
        my $onshelfholds = $input->param('onshelfholds') || 0;
500
        $maxissueqty =~ s/\s//g;
501
        $maxissueqty = undef if $maxissueqty !~ /^\d+/;
502
        $issuelength = $issuelength eq q{} ? undef : $issuelength;
503
504
        my $params ={
505
            branchcode      => $br,
506
            categorycode    => $bor,
507
            itemtype        => $itemtype,
508
            maxissueqty     => $maxissueqty,
509
            renewalsallowed => $renewalsallowed,
510
            renewalperiod   => $renewalperiod,
511
            issuelength     => $issuelength,
512
            lengthunit      => $lengthunit,
513
            onshelfholds    => $onshelfholds,
514
        };
515
516
         my @messages;
517
518
#New code from smart-rules.tt starts here. Needs to be added to library
519
#Allows for the 'All' option to work when selecting all libraries for a circulation rule to apply to.
520
 if ($branch eq "*") {
521
        my $sth_search = $dbh->prepare("SELECT count(*) AS total
522
                                        FROM default_circ_rules");
523
        my $sth_insert = $dbh->prepare("INSERT INTO default_circ_rules
524
                                        (maxissueqty, onshelfholds)
525
                                        VALUES (?, ?)");
526
        my $sth_update = $dbh->prepare("UPDATE default_circ_rules
527
                                        SET maxissueqty = ?, onshelfholds = ?");
528
529
        $sth_search->execute();
530
        my $res = $sth_search->fetchrow_hashref();
531
        if ($res->{total}) {
532
            $sth_update->execute($maxissueqty, $onshelfholds);
533
        } else {
534
            $sth_insert->execute($maxissueqty, $onshelfholds);
535
        }
536
    }
537
538
539
#Allows for the 'All' option to work when selecting all patron categories for a circulation rule to apply to.
540
        if ($bor eq "*") {
541
            my $sth_search = $dbh->prepare("SELECT count(*) AS total
542
                                            FROM default_circ_rules");
543
            my $sth_insert = $dbh->prepare(q|
544
                INSERT INTO default_circ_rules
545
                    (maxissueqty)
546
                    VALUES (?)
547
            |);
548
            my $sth_update = $dbh->prepare(q|
549
                UPDATE default_circ_rules
550
                SET maxissueqty = ?
551
            |);
552
553
            $sth_search->execute();
554
            my $res = $sth_search->fetchrow_hashref();
555
            if ($res->{total}) {
556
                $sth_update->execute($maxissueqty);
557
            } else {
558
                $sth_insert->execute($maxissueqty);
559
            }
560
        }
561
#Allows for the 'All' option to work when selecting all itemtypes for a circulation rule to apply to
562
        if ($itemtype eq "*") {
563
            my $sth_search = $dbh->prepare("SELECT count(*) AS total
564
                                        FROM default_branch_circ_rules
565
                                        WHERE branchcode = ?");
566
            my $sth_insert = $dbh->prepare("INSERT INTO default_branch_circ_rules
567
                                        (branchcode, onshelfholds)
568
                                        VALUES (?, ?)");
569
            my $sth_update = $dbh->prepare("UPDATE default_branch_circ_rules
570
                                        SET onshelfholds = ?
571
                                        WHERE branchcode = ?");
572
            $sth_search->execute($branch);
573
            my $res = $sth_search->fetchrow_hashref();
574
            if ($res->{total}) {
575
                $sth_update->execute($onshelfholds, $branch);
576
            } else {
577
            $sth_insert->execute($branch, $onshelfholds);
578
            }
579
        }
580
#End new code
581
582
       my $issuingrule = Koha::IssuingRules->find({categorycode => $bor, itemtype => $itemtype, branchcode => $br });
583
       if($issuingrule){
584
           $issuingrule->set($params)->store();
585
           push @messages, {type=> 'error', code => 'error_on_insert'};#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.
586
587
       }else{
588
           Koha::IssuingRule->new()->set($params)->store();
589
       }
590
    }
591
}
592
593
output_html_with_http_headers $input, $cookie, $template->output;
594
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc (-1 / +1 lines)
Lines 6-12 var debug = "[% debug %]"; Link Here
6
var dformat  = "[% dateformat %]";
6
var dformat  = "[% dateformat %]";
7
var sentmsg = 0;
7
var sentmsg = 0;
8
if (debug > 1) {alert("dateformat: " + dformat + "\ndebug is on (level " + debug + ")");}
8
if (debug > 1) {alert("dateformat: " + dformat + "\ndebug is on (level " + debug + ")");}
9
var MSG_PLEASE_ENTER_A_VALID_DATE = _("Please enter a valid date (should match %s).");
9
var MSG_PLEASE_ENTER_A_VALID_DATE = (_("Please enter a valid date (should match %s)."));
10
10
11
function is_valid_date(date) {
11
function is_valid_date(date) {
12
    // An empty string is considered as a valid date for convenient reasons.
12
    // An empty string is considered as a valid date for convenient reasons.
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc (+2 lines)
Lines 42-47 Link Here
42
                    <li><a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a></li>
42
                    <li><a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a></li>
43
                    [% END %]
43
                    [% END %]
44
                    <li><a href="/cgi-bin/koha/about.pl">About Koha</a></li>
44
                    <li><a href="/cgi-bin/koha/about.pl">About Koha</a></li>
45
                    <li><a href="/cgi-bin/koha/summary.pl">Summary</a></li>
46
45
                </ul>
47
                </ul>
46
            </li>
48
            </li>
47
        </ul>
49
        </ul>
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/installer-doc-head-close.inc (+15 lines)
Lines 1-5 Link Here
1
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
1
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
2
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
2
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
3
<link rel="stylesheet" type="text/css" href="[% interface %]/lib/jquery/jquery-ui-1.11.4.min.css" />
4
<link rel="stylesheet" type="text/css" href="[% interface %]/lib/bootstrap/bootstrap.min.css" />
5
<link rel="stylesheet" type="text/css" href="[% interface %]/lib/font-awesome/css/font-awesome.min.css" />
6
<link rel="stylesheet" type="text/css" media="print" href="[% interface %]/[% theme %]/css/print.css" />
3
<style type="text/css" media="screen">
7
<style type="text/css" media="screen">
4
8
5
[% IF ( login ) %]
9
[% IF ( login ) %]
Lines 69-74 td input { font-size: 1.5em; } Link Here
69
73
70
</style>
74
</style>
71
75
76
<script type="text/javascript" src="[% interface %]/lib/jquery/jquery-2.2.3.min.js"></script>
77
<script type="text/javascript" src="[% interface %]/lib/jquery/jquery-migrate-1.3.0.min.js"></script>
78
<script type="text/javascript" src="[% interface %]/lib/jquery/jquery-ui-1.11.4.min.js"></script>
79
<script type="text/javascript" src="[% interface %]/lib/shortcut/shortcut.js"></script>
80
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.cookie.min.js"></script>
81
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.highlight-3.js"></script>
82
<script type="text/javascript" src="[% interface %]/lib/bootstrap/bootstrap.min.js"></script>
83
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.validate.min.js"></script>
84
<!-- koha core js -->
85
<script type="text/javascript" src="[% interface %]/[% theme %]/js/staff-global.js"></script>
86
72
<script type="text/javascript">
87
<script type="text/javascript">
73
    //<![CDATA[
88
    //<![CDATA[
74
        function _(s) { return s } // dummy function for gettext
89
        function _(s) { return s } // dummy function for gettext
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt (-1 / +1 lines)
Lines 93-99 Link Here
93
                            </li>
93
                            </li>
94
                            <li>
94
                            <li>
95
                                <label for="enrolmentperioddate" style="width:6em;">Until date: </label>
95
                                <label for="enrolmentperioddate" style="width:6em;">Until date: </label>
96
                                <input type="text" class="enrollmentperiod" name="enrolmentperioddate" id="enrolmentperioddate" value="[% category.enrolmentperioddate | $KohaDates %]" />
96
                                <input type="text" class="enrollmentperiod datepicker" name="enrolmentperioddate" id="enrolmentperioddate" value="[% category.enrolmentperioddate | $KohaDates %]" />
97
                            </li>
97
                            </li>
98
                        </ol>
98
                        </ol>
99
                    </fieldset>
99
                    </fieldset>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step3.tt (-65 / +83 lines)
Lines 1-77 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/mainpage.pl">[% END %]
2
[% IF ( finish ) %]<meta http-equiv="refresh" content="10; url=/cgi-bin/koha/installer/onboarding.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>
6
6
7
[% IF ( selectframeworks ) %]
7
[% IF ( selectframeworks ) %]
8
    <script type="text/javascript">
8
    <script type="text/javascript">
9
    //<![CDATA[
9
//<![CDATA[
10
10
11
    var surl = unescape(window.location.pathname);
11
var surl = unescape(window.location.pathname);
12
12
13
    function doLoad()
13
function doLoad()
14
    {
14
{
15
        // the timeout value should be the same as in the "refresh" meta-tag
15
    // the timeout value should be the same as in the "refresh" meta-tag
16
        setTimeout( "refresh()", 2*1000 );
16
    setTimeout( "refresh()", 2*1000 );
17
    }
17
}
18
18
19
    function refresh(value)
19
function refresh(value)
20
    {
20
{
21
        //  The argument to the location.reload function determines
21
    //  The argument to the location.reload function determines
22
        //  if the browser should retrieve the document from the
22
    //  if the browser should retrieve the document from the
23
        //  web-server.  In our example all we need to do is cause
23
    //  web-server.  In our example all we need to do is cause
24
        //  the JavaScript block in the document body to be
24
    //  the JavaScript block in the document body to be
25
        //  re-evaluated.  If we needed to pull the document from
25
    //  re-evaluated.  If we needed to pull the document from
26
        //  the web-server again (such as where the document contents
26
    //  the web-server again (such as where the document contents
27
        //  change dynamically) we would pass the argument as 'true'.
27
    //  change dynamically) we would pass the argument as 'true'.
28
        //
28
    //
29
        surl=surl+'?step=3&op=selectframeworks&fwklanguage='+value;
29
    surl=surl+'?step=3&op=selectframeworks&fwklanguage='+value;
30
30
31
        window.location.replace( surl );
31
    window.location.replace( surl );
32
    }
32
}
33
33
34
    function selectAllFrameworks()
34
function selectAllFrameworks()
35
{
36
    //  A handy short link that selects all available checkboxes
37
    //  on the page.
38
    //
39
    var checkboxes = document.getElementsByTagName("input");
40
    for (var i = 0; i < checkboxes.length; i++)
35
    {
41
    {
36
        //  A handy short link that selects all available checkboxes
42
        if (checkboxes[i].type == 'checkbox')
37
        //  on the page.
38
        //
39
        var checkboxes = document.getElementsByTagName("input");
40
        for (var i = 0; i < checkboxes.length; i++)
41
        {
43
        {
42
            if (checkboxes[i].type == 'checkbox')
44
            checkboxes[i].checked = true;
43
            {
44
                checkboxes[i].checked = true;
45
            }
46
        }
45
        }
47
48
        //  Prevent event propergation.
49
        return false;
50
    }
46
    }
51
47
52
    function Hide(link)
48
    //  Prevent event propergation.
53
    {
49
    return false;
54
        //  Toggle the display of a given element on the page.
50
}
55
        //
56
        subfield = document.getElementById('bloc'+link);
57
        var initstyle = subfield.style.display;
58
        if (initstyle == 'block') subfield.style.display = 'none' ;
59
        if (initstyle == 'none') subfield.style.display = 'block' ;
60
    }
61
51
62
    //]]>
52
function Hide(link)
63
    </script>
53
{
54
    //  Toggle the display of a given element on the page.
55
    //
56
    subfield = document.getElementById('bloc'+link);
57
    var initstyle = subfield.style.display;
58
    if (initstyle == 'block') subfield.style.display = 'none' ;
59
    if (initstyle == 'none') subfield.style.display = 'block' ;
60
}
61
62
//]]>
63
</script>
64
[% END %]
64
[% END %]
65
66
65
[% IF ( finish ) %]
67
[% IF ( finish ) %]
66
    <h1>Congratulations, installation complete</h1>
68
    <h1>Congratulations, installation complete</h1>
67
    <p>If this page does not redirect in 5 seconds, click <a href="/">here</a>.</p>
69
    <p>If this page does not redirect in 5 seconds, click <a href="/cgi-bin/koha/installer/onboarding.pl">here</a>.</p>
68
[% END %]
70
[% END %]
71
72
69
[% IF ( choosemarc ) %]
73
[% IF ( choosemarc ) %]
70
    <h2 align="center">Select your MARC flavor</h2>
74
    <h2 align="center">Choose your setup</h2>
71
    <p>MARC stands for Machine Readable Cataloging, containing information about a bibliographic record. MARC21 is more commonly used globally, whereas UNIMARC tends to be used in Europe. </p>
75
    <p>Basic setup selects recommended settings by default.</p>
72
    <form name="frameworkselection" method="post" action="install.pl">
76
    <form name="frameworkselection" method="post" action="install.pl">
73
    <input type="hidden" name="step" value="3" />
77
    <input type="hidden" name="step" value="3" />
74
    <input type="hidden" name="op" value="selectframeworks"/>
78
    <input type="hidden" name="op" value="selectframeworks"/>
79
80
    <div>
81
        <input type="radio" name="setup" value="Basic" checked="checked">Basic<br/>
82
        <input type="radio" name="setup" value="Advanced"/>Advanced<br/>
83
    </div>
84
85
    <h2 align="center">Select your MARC flavor</h2>
86
    <p>MARC stands for Machine Readable Cataloging, containing information about a bibliographic record. MARC21 is more commonly used globally, whereas UNIMARC tends to be used in Europe. </p>
87
75
    <p>
88
    <p>
76
    [% FOREACH flavourloo IN flavourloop %]
89
    [% FOREACH flavourloo IN flavourloop %]
77
    <div>
90
    <div>
Lines 82-94 Link Here
82
            [% END %]
95
            [% END %]
83
    </div>
96
    </div>
84
    [% END %]
97
    [% END %]
85
    </p>
98
86
    <p> Click 'Next' to continue <input value="Next &gt;&gt;" type="submit" /></p>
99
   </p>
100
        <p>Click 'Next' to continue <input value="Next &gt;&gt;" type="submit" /></p>
101
87
    </form>
102
    </form>
103
88
[% END %]
104
[% END %]
89
105
106
90
[% IF ( selectframeworks ) %]
107
[% IF ( selectframeworks ) %]
108
    <h2 align= "center"> [% setup %] setup</h2>
91
    <h2 align="center">Selecting Default Settings</h2>
109
    <h2 align="center">Selecting Default Settings</h2>
110
92
    <script type="text/javascript">
111
    <script type="text/javascript">
93
        var linklabel = _("Select all options");
112
        var linklabel = _("Select all options");
94
        document.write('<p><a href="#" onclick="return selectAllFrameworks();"><button>'+linklabel+'</button></a></p>');
113
        document.write('<p><a href="#" onclick="return selectAllFrameworks();"><button>'+linklabel+'</button></a></p>');
Lines 110-124 Link Here
110
        <table style="border:1px;vertical-align:top;">
129
        <table style="border:1px;vertical-align:top;">
111
        <tr>
130
        <tr>
112
         <td style = "border:1px; vertical-align:top;">
131
         <td style = "border:1px; vertical-align:top;">
113
         [% IF (frameworksloo.label == "Default" ) %]
132
        [% IF (frameworksloo.label == "Default") && (setup=="Basic") %]
114
            <ul>
133
        <input type="hidden" name="framework" value="[%     framework.fwkfile %]" id =="[%framework.fwkname%]" />
115
            </ul>
134
        [% ELSE %]
116
         [% ELSE %]
135
             <input type="checkbox" name="framework" value="[% framework.fwkfile %]" id =="[%framework.fwkname%]" />
117
            <input type="checkbox" name="framework" value="[% framework.fwkfile %]" id =="[%framework.fwkname%]" />
118
         [% END %]
136
         [% END %]
119
        </td>
137
      </td>
120
        <td>
138
      <td>
121
        [% IF (frameworksloo.label == "Default" ) %]
139
      [% IF (frameworksloo.label == "Default") && (setup=="Basic") %]
122
        <ul>
140
        <ul>
123
            <label for="[% framework.fwkname %]">
141
            <label for="[% framework.fwkname %]">
124
               <li> [% framework.fwkdescription %]</li>
142
               <li> [% framework.fwkdescription %]</li>
Lines 152-166 Link Here
152
        <table style="border:1px;vertical-align:top;">
170
        <table style="border:1px;vertical-align:top;">
153
        <tr>
171
        <tr>
154
        <td style="vertical-align:top;">
172
        <td style="vertical-align:top;">
155
        [% IF (levelloo.label == "Default" ) %]
173
        [% IF (levelloo.label == "Default" ) && (setup=="Basic")%]
156
             <input type="hidden" name="framework" value="[% framework.fwkfile %]" id="[%framework.fwkname %]" />
174
             <input type="hidden" name="framework" value="[% framework.fwkfile %]" id="[%framework.fwkname %]" />
157
        [% ELSE %]
175
        [% ELSE %]
158
             <input type="checkbox" name="framework" value="[%framework.fwkfile %]" id=="[%framework.fwkname%]"/>
176
             <input type="checkbox" name="framework" value="[%framework.fwkfile %]" id=="[%framework.fwkname%]"/>
159
        [% END %]
177
        [% END %]
160
        </td>
178
        </td>
161
        <td>
179
        <td>
162
        [% IF (levelloo.label == "Default") %]
180
        [% IF (levelloo.label == "Default") && (setup=="Basic")%]
163
            <ul>
181
           <ul>
164
            <label for="[% framework.fwkname %]">
182
            <label for="[% framework.fwkname %]">
165
               <li> [% framework.fwkdescription %]</li>
183
               <li> [% framework.fwkdescription %]</li>
166
                <em>([% framework.fwkname %])</em>
184
                <em>([% framework.fwkname %])</em>
Lines 199-209 Link Here
199
    [% END %]
217
    [% END %]
200
    <h3>All done!</h3>
218
    <h3>All done!</h3>
201
    <p>Installation complete.<br />
219
    <p>Installation complete.<br />
202
        <p>Click on 'Finish' to complete and load the Koha Staff Interface.
220
        <p>Click on 'Continue to onboarding tool' to complete and load the Koha onboarding tool.
203
        <form name="finish">
221
        <form name="finish">
204
        <input type="hidden" name="step" value="3" />
222
        <input type="hidden" name="step" value="3" />
205
        <input type="hidden" name="op" value="finish" />
223
        <input type="hidden" name="op" value="finish" />
206
        <input type="submit" value="Finish"/>
224
        <input type="submit" value="Continue to Koha onboarding tool"/>
207
        </form>
225
        </form>
208
        </p>
226
        </p>
209
    </p>
227
    </p>
Lines 250-256 Link Here
250
        <br>
268
        <br>
251
        <br>
269
        <br>
252
            <a href="install.pl?step=3&amp;op=choosemarc" class="button"><button>Install Basic Configuration Settings</button></a>
270
            <a href="install.pl?step=3&amp;op=choosemarc" class="button"><button>Install Basic Configuration Settings</button></a>
253
        </p>
271
254
    [% END %]
272
    [% END %]
255
[% END %]
273
[% END %]
256
274
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt (-2 lines)
Lines 1-5 Link Here
1
[% USE Koha %]
2
[% SET footerjs = 1 %]
3
[% INCLUDE 'doc-head-open.inc' %]
1
[% INCLUDE 'doc-head-open.inc' %]
4
<title>Koha staff client</title>
2
<title>Koha staff client</title>
5
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/mainpage.css" />
3
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/mainpage.css" />
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep0.tt (+18 lines)
Line 0 Link Here
1
<!-- Includes for creating library-->
2
[% INCLUDE 'doc-head-open.inc' %]
3
[% INCLUDE 'installer-doc-head-close.inc' %]
4
5
<head>
6
<title>Welcome &rsaquo; to  &rsaquo; Koha</title>
7
</head>
8
9
 <!--Header for the koha onboarding tool-->
10
<div>
11
      <h1 align="center"> Welcome to Koha</h1>
12
      <h1 id="logo"><img alt="Koha" style="width:50%;margin:auto;display:block;align:center;"  src="[% interface %]/[% theme %]/img/koha.org-logo.gif"/></h1>
13
      <h2 align="center"> We're just going to set up a few more things...</h2>
14
      <form name="startkoha" method="post" action="onboarding.pl">
15
         <input type="hidden" name="step" value="1"/>
16
         <input type="submit" name="start" value="Start setting up my Koha"/>
17
      </form>
18
</div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep1.tt (+84 lines)
Line 0 Link Here
1
<!--Includes for creating library-->
2
[% INCLUDE 'doc-head-open.inc' %]
3
[% INCLUDE 'installer-doc-head-close.inc' %]
4
5
<head>
6
<title>Welcome &rsaquo; to  &rsaquo; Koha</title>
7
</head>
8
9
<!--Header for the koha onboarding tool-->
10
<div>
11
    <h1 align="center"> Welcome to Koha</h1>
12
    <h1 id="logo"><img alt="Koha" style="width:50%;margin:auto;display:block;align:center;"  src="[% interface %]/[% theme %]/img/koha.org-logo.gif"/></h1>
13
</div>
14
 [% IF libraries.count > 0 %]
15
 <br>
16
    <h3 align="left">You do not need to create a library as you have already installed the sample library data previously</h3>
17
    <form name="skiplibrary" method="post" action="onboarding.pl">
18
        <input type="hidden" name="step" value="2"/>
19
        <div>
20
            <input type="submit" name="start" value="Add a patron category"/>
21
        </div>
22
    </form>
23
24
    <!--Create a library screen 2-->
25
[% ELSIF (createlibrary) %]
26
        <!--New Library created-->
27
       [% IF message == "success_on_insert" %]
28
            <form name="createlibrary" method="post" action="onboarding.pl">
29
                <input type="hidden" name="step" value="2"/>
30
                <h1 align="left"> New Library</h1>
31
                <div>
32
                    <p> Success: Library created!
33
                    </p>
34
                    <p> To add another library and for more settings, <br>
35
                    go to:<br><br>
36
                    More->Administration->Libraries and groups<br>
37
                    OR<br>
38
                    Administration->Libraries and groups
39
                    </p>
40
                </div>
41
                Next up:
42
                <input type="submit" name="start" value="Add a patron category"/>
43
            </form>
44
45
        [%ELSE %]
46
            <!--Implement if statement to determine if library was succesfully created here....-->
47
            <form name="retrylibrary" method="post" action="onboarding.pl">
48
                <input type="hidden" name="step" value="1"/>
49
                <h1 align="left">Failed </h1>
50
                <div>
51
                    <p> Library was not successfully created</br>
52
                    Please try again or contact your system administrator. </p>
53
                </div>
54
                <input type="submit" value="Try again"/>
55
            </form>
56
        [%END%]
57
58
[% ELSE %]
59
<!--Create a library screen 1-->
60
        <h2>Create a Library</h2>
61
        <form name="LibraryCreation" method="post" action="onboarding.pl">
62
            <fieldset class="rows">
63
                 <input type="hidden" name="step" value="1"/>
64
                 <input type="hidden" name="createlibrary" value="createlibrary"/>
65
                 <ol>
66
                     <li>
67
                        <label for="branchcode" class="required">Library code: </label>
68
                        <input type="text"  pattern="^[A-Za-z]{0,10}$" title="Please enter 3 capital letters" 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" pattern="[a-zA-Z ]+" title="Please enter a sentence of letters only" name="branchname" id="branchname" size="42" value="[% library.branchname |html %]" class="    required" required="required" style="width:200px;">
74
                        <span class="required">Required</span>
75
                    </li>
76
                 </ol>
77
             </fieldset>
78
             <br>
79
             <input type="submit" class="action" value="Submit"/>
80
     </form>
81
[% END %]
82
83
84
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep2.tt (+410 lines)
Line 0 Link Here
1
<!--Pragmas for using and including packages for create patron category-->
2
[% USE Koha %]
3
[% USE KohaDates %]
4
[% USE Price %]
5
[% INCLUDE 'doc-head-open.inc' %]
6
<title> Add a patron category</title>
7
[% INCLUDE 'installer-doc-head-close.inc' %]
8
[% INCLUDE 'calendar.inc' %]
9
10
<script type="text/javascript">
11
//<![CDATA[
12
13
var debug    = "";
14
var dformat  = "us";
15
var sentmsg = 0;
16
if (debug > 1) {alert("dateformat: " + dformat + "\ndebug is on (level " + debug + ")");}
17
var MSG_PLEASE_ENTER_A_VALID_DATE = (_("Please enter a valid date (should match %s)."));
18
19
function is_valid_date(date) {
20
        // An empty string is considered as a valid date for convenient reasons.
21
        if ( date === '' ) return 1;
22
        var dateformat = dateformat_str = 'us';
23
        if ( dateformat == 'us' ) {
24
           if ( date.search(/^\d{2}\/\d{2}\/\d{4}($|\s)/) == -1 ) return 0;
25
                  dateformat = 'mm/dd/yy';
26
           } else if ( dateformat == 'metric' ) {
27
                  if ( date.search(/^\d{2}\/\d{2}\/\d{4}($|\s)/) == -1 ) return 0;
28
                  dateformat = 'dd/mm/yy';
29
           } else if (dateformat == 'iso' ) {
30
                  if ( date.search(/^\d{4}-\d{2}-\d{2}($|\s)/) == -1 ) return 0;
31
                  dateformat = 'yy-mm-dd';
32
           } else if ( dateformat == 'dmydot' ) {
33
                  if ( date.search(/^\d{2}\.\d{2}\.\d{4}($|\s)/) == -1 ) return 0;
34
                  dateformat = 'dd.mm.yy';
35
           }
36
           try {
37
               $.datepicker.parseDate(dateformat, date);
38
           } catch (e) {
39
               return 0;
40
           };
41
               return 1;
42
}function get_dateformat_str(dateformat) {
43
           var dateformat_str;
44
           if ( dateformat == 'us' ) {
45
                dateformat_str = 'mm/dd/yyyy';
46
           } else if ( dateformat == 'metric' ) {
47
                dateformat_str = 'dd/mm/yyyy';
48
           } else if (dateformat == 'iso' ) {
49
                dateformat_str = 'yyyy-mm-dd';
50
           } else if ( dateformat == 'dmydot' ) {
51
                dateformat_str = 'dd.mm.yyyy';
52
           }
53
           return dateformat_str;
54
}
55
56
function validate_date (dateText, inst) {
57
           if ( !is_valid_date(dateText) ) {
58
               var dateformat_str = get_dateformat_str( 'us' );
59
               alert(MSG_PLEASE_ENTER_A_VALID_DATE.format(dateformat_str));
60
               $('#'+inst.id).val('');
61
           }
62
}
63
function Date_from_syspref(dstring) {
64
            var dateX = dstring.split(/[-/.]/);
65
            if (debug > 1 && sentmsg < 1) {sentmsg++; alert("Date_from_syspref(" + dstring + ") splits to:\n" + dateX.join("\n"));}
66
            if (dformat === "iso") {
67
                return new Date(dateX[0], (dateX[1] - 1), dateX[2]);  // YYYY-MM-DD to (YYYY,m(0-11),d)
68
            } else if (dformat === "us") {
69
                return new Date(dateX[2], (dateX[0] - 1), dateX[1]);  // MM/DD/YYYY to (YYYY,m(0-11),d)
70
            } else if (dformat === "metric") {
71
                return new Date(dateX[2], (dateX[1] - 1), dateX[0]);  // DD/MM/YYYY to (YYYY,m(0-11),d)
72
            } else if (dformat === "dmydot") {
73
                return new Date(dateX[2], (dateX[1] - 1), dateX[0]);  // DD.MM.YYYY to (YYYY,m(0-11),d)
74
            } else {
75
                if (debug > 0) {alert("KOHA ERROR - Unrecognized date format: " +dformat);}
76
                return 0;
77
            }
78
}
79
80
function DateTime_from_syspref(date_time) {
81
           var parts = date_time.split(" ");
82
           var date = parts[0];
83
           var time = parts[1];
84
           parts = time.split(":");
85
           var hour = parts[0];
86
           var minute = parts[1];
87
           if ( hour < 0 || hour > 23 ) {
88
                   return 0;
89
           }
90
           if ( minute < 0 || minute > 59 ) {
91
                   return 0;
92
           }
93
           var datetime = Date_from_syspref( date );
94
           if ( isNaN( datetime.getTime() ) ) {
95
                   return 0;
96
           }
97
           datetime.setHours( hour );
98
           datetime.setMinutes( minute );
99
           return datetime;
100
}
101
102
/* Instead of including multiple localization files as you would normally see with
103
      jQueryUI we expose the localization strings in the default configuration */
104
jQuery(function($){
105
          $.datepicker.regional[''] = {
106
              closeText: _("Done"),
107
              prevText: _("Prev"),
108
              nextText: _("Next"),
109
              currentText: _("Today"),
110
              monthNames: [_("January"),_("February"),_("March"),_("April"),_("May"),_("June"),
111
                           _("July"),_("August"),_("September"),_("October"),_("November"),_("December")],
112
              monthNamesShort: [_("Jan"), _("Feb"), _("Mar"), _("Apr"), _("May"), _("Jun"),
113
                                _("Jul"), _("Aug"), _("Sep"), _("Oct"), _("Nov"), _("Dec")],
114
              dayNames: [_("Sunday"), _("Monday"), _("Tuesday"), _("Wednesday"), _("Thursday"), _("Friday"), _("Saturday")],
115
              dayNamesShort: [_("Sun"), _("Mon"), _("Tue"), _("Wed"), _("Thu"), _("Fri"), _("Sat")],
116
              dayNamesMin: [_("Su"),_("Mo"),_("Tu"),_("We"),_("Th"),_("Fr"),_("Sa")],
117
              weekHeader: _("Wk"),
118
              dateFormat: "mm/dd/yy",
119
              firstDay: 0,
120
              isRTL: false,
121
              showMonthAfterYear: false,
122
              yearSuffix: ''};
123
              $.datepicker.setDefaults($.datepicker.regional['']);
124
                                                                                                                                               });
125
126
$(document).ready(function(){
127
        $.datepicker.setDefaults({
128
             showOn: "both",
129
             changeMonth: true,
130
             changeYear: true,
131
             buttonImage: '/intranet-tmpl/prog/img/famfamfam/silk/calendar.png',
132
             buttonImageOnly: true,
133
             showButtonPanel: true,
134
             showOtherMonths: true,
135
             selectOtherMonths: true
136
        });
137
        $( ".datepicker" ).datepicker({
138
             onClose: function(dateText, inst) {
139
             validate_date(dateText, inst);
140
             },
141
        }).on("change", function(e, value) {
142
        if ( ! is_valid_date( $(this).val() ) ) {$(this).val("");}
143
        });
144
       // http://jqueryui.com/demos/datepicker/#date-range
145
            var dates = $( ".datepickerfrom, .datepickerto" ).datepicker({
146
            changeMonth: true,
147
            numberOfMonths: 1,
148
            onSelect: function( selectedDate ) {
149
            var option = this.id == "from" ? "minDate" : "maxDate",
150
            instance = $( this ).data( "datepicker" );
151
            date = $.datepicker.parseDate(
152
                   instance.settings.dateFormat ||
153
                   $.datepicker._defaults.dateFormat,
154
                   selectedDate, instance.settings );
155
                   dates.not( this ).datepicker( "option", option, date );
156
            },
157
            onClose: function(dateText, inst) {
158
                 validate_date(dateText, inst);
159
            },
160
            }).on("change", function(e, value) {
161
            if ( ! is_valid_date( $(this).val() ) ) {$(this).val("");}
162
            });
163
});
164
//]]>
165
</script>
166
167
168
<script type="text/javascript">
169
var MSG_CATEGORYCODE_CHARS=(_("Please only enter letters into this field."));
170
var MSG_ONE_ENROLLMENTPERIOD =(_("Please choose an enrollment period in months OR by date."));
171
var MSG_ONLY_ONE_ENROLLMENTPERIOD=(_("Please only choose one enrolment period."));
172
var MSG_DESCRIPTION_LETTERS_ONLY=(_("Please only enter letters."));
173
</script>
174
175
<script type="text/javascript">
176
jQuery.validator.addMethod( "category_code_check", function(value,element){
177
     var patt = /^[A-Za-z]{0,10}$/g;
178
     if (patt.test(element.value)) {
179
              return true;
180
     } else {
181
              return false;
182
     }
183
}, MSG_CATEGORYCODE_CHARS
184
);
185
jQuery.validator.addMethod( "letters_only", function(value,element){
186
        var patt =/^[A-Za-z ]{0,30}$/g;
187
        if (patt.test(element.value)){
188
            return true;
189
        } else {
190
            return false;
191
        }
192
    }, MSG_DESCRIPTION_LETTERS_ONLY
193
);
194
195
jQuery.validator.addMethod( "enrollment_period", function(){
196
      enrolmentperiod = $("#enrolmentperiod").val();
197
      enrolmentperioddate = $("#enrolmentperioddate").val();
198
      if (( $("#enrolmentperiod").val() == "" && $("#enrolmentperioddate").val() == "") || ($("#enrolmentperiod").val() !== "" && $("#enrolmentperioddate").val() !== "")) {
199
             return false;
200
      } else {
201
             return true;
202
      }
203
    }, MSG_ONLY_ONE_ENROLLMENTPERIOD
204
);
205
206
$(document).ready(function() {
207
      $("#enrolmentperioddate").datepicker({
208
            minDate: 1
209
      }); // Require that "until date" be in the future
210
      if ($("#branches option:selected").length < 1) {
211
          $("#branches option:first").attr("selected", "selected");
212
      }
213
      $("#categorycode").on("blur",function(){
214
           toUC(this);
215
      });
216
      $("#category_form").validate({
217
                rules: {
218
                     categorycode: {
219
                            required: true,
220
                            category_code_check: true
221
                     },
222
                     description: {
223
                            required:true,
224
                            letters_only: true
225
                     },
226
                     enrolmentperiod: {
227
                           required: function(element){
228
                                 return $("#enrolmentperioddate").val() === "";
229
                           },
230
                           digits: true,
231
                           enrollment_period: true,
232
                    },
233
                     enrolmentperioddate: {
234
                            required: function(element){
235
                               return $("#enrolmentperiod").val() === "";
236
                            },
237
                            enrollment_period: true,
238
                           // is_valid_date ($(#"enrolementperioddate").val());
239
                    },
240
                     dateofbirthrequired: {
241
                             digits: true
242
                     },
243
                     upperagelimit: {
244
                             digits: true
245
                     },
246
                     enrolmentfee: {
247
                             number: true
248
                     },
249
                     reservefee: {
250
                             number: true
251
                     },
252
                     category_type: {
253
                             required: true
254
                    }
255
                },
256
                messages: {
257
                      enrolmentperiod: {
258
                             required: MSG_ONE_ENROLLMENTPERIOD
259
                      },
260
                      enrolmentperioddate: {
261
                             required: MSG_ONE_ENROLLMENTPERIOD
262
                      }
263
                }
264
       });
265
});
266
267
</script>
268
</head>
269
270
<div> <!-- Header that appears at the top of every screen in the koha onboarding tool-->
271
    <h1 align="center"> Welcome to Koha</h1>
272
    <h1 id="logo"><img alt="Koha" style="width:50%;margin:auto;display:block;align:center;"  src="[% interface %]/[% theme %]/img/koha.org-logo.gif"/></h1>
273
</div>
274
275
276
[% IF categories.count > 0 %] <!--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-->
277
<br>
278
     <h3 align="left">You do not need to create a patron category as you have already installed the sample patron categories data previously</h3>
279
     <form name="skippatroncategory" method="post" action="onboarding.pl">
280
          <input type="hidden" name="step" value="3"/>
281
          <div>
282
            <input type="submit" name="start" value="Add a patron"/>
283
          </div>
284
     </form>
285
286
<!--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-->
287
[% ELSIF createcat %]
288
    [% IF message != "error_on_insert" %]
289
     <form name="createcat" method="post" action="onboarding.pl">
290
            <input type="hidden" name="step" value="3"/>
291
             <h1 align="left">  New patron category</h1>
292
             <div>
293
                 <p> Success: Patron category created! </p>
294
                 <p> To add another patron category and for more settings<br>
295
                 go to:<br>
296
                 More->Administration->Patron categories<br>
297
                 OR<br>
298
                 Administration->Patron categories</p>
299
             </div>
300
             Next up:<br>
301
             <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-->
302
     </form>
303
     [% ELSE %]
304
        <form name="retrypatcat" method="post" action="onboarding.pl">
305
        Message is [% message %]
306
        <input type="hidden" name="step" value="2"/>
307
            <h1 align="left">Failed</h1>
308
            <div>Patron Category was not successfully created.</br>
309
            Please try again or contact your system administrator.</p>
310
            </div>
311
            <input type="submit" value="Try again"/>
312
        </form>
313
    [% END %]
314
315
316
[% ELSE %] <!--Else display create patron category screen 1 where the user can input values to create their first patron category-->
317
    <h1 align="left"> Create a new Patron Category</h1>
318
       <form id="category_form" method="post" action="onboarding.pl">
319
       <fieldset class="rows">
320
            <input type="hidden" name="step" value="2"/>
321
            <input type="hidden" name="createcat" value="createcat" />
322
                <ol>
323
                    <li>
324
                        <label for="categorycode" class="required">Category code: </label>
325
                        <input type="text" pattern="^[A-Za-z]{0,10}$" title="Please enter 1 or 2 capital letters" id="categorycode" name="categorycode" value="[% category.categorycode |html %]" size="10" maxlength="10" class="required" required="required" />
326
                        <span class="required">Required</span>
327
                    </li>
328
329
                    <li>
330
                        <label for="description" class="required">Description: </label>
331
                        <input type="text"  pattern="[a-zA-Z ]+" title="Please enter a description sentence of letters only" name="description" size="40" maxlength="80" class="required" required="required" value="[% category.description |html %]" />
332
                        <span class="required">Required</span>
333
                    </li>
334
335
                    <li>
336
                        <label for="overduenoticerequired">Overdue notice required: </label>
337
                        <select name="overduenoticerequired" value="overduenoticerequired">
338
                            [% IF category.overduenoticerequired %]
339
                                <option value="0">No</option>
340
                                <option value="1" selected="selected">Yes</option>
341
                            [% ELSE %]
342
                                <option value="0" selected="selected">No</option>
343
                                <option value="1">Yes</option>
344
                            [% END %]
345
                        </select>
346
                    </li>
347
348
                    <li>
349
                        <label for="category_type" class="required">Category type: </label>
350
                        <select name="category_type" value="category_type" class='required' required='required'>
351
                            [% IF category and category.category_type == 'S' %]
352
                                <option value="S" selected="selected">Staff</option>
353
                            [% ELSE %]
354
                                <option value="S">Staff</option>
355
                            [% END %]
356
                        </select>
357
                        <span class="required">Required</span>
358
                    </li>
359
360
                    <li>
361
                        <label for="default_privacy">Default privacy: </label>
362
                        <select value="default_privacy" name="default_privacy" required="required">
363
                            [% SET default_privacy = 'default' %]
364
365
                            [% IF category %]
366
                            [% SET default_privacy = category.default_privacy %]
367
                            [% END %]
368
369
                            [% SWITCH default_privacy %]
370
                            [% CASE 'forever' %]
371
                                <option value="default">Default</option>
372
                                <option value="never">Never</option>
373
                                <option value="forever" selected="selected">Forever</option>
374
                            [% CASE 'never' %]
375
                                <option value="default">Default</option>
376
                                <option value="never" selected="selected">Never</option>
377
                                <option value="forever">Forever</option>
378
                            [% CASE %]
379
                                <option value="default" selected="selected">Default</option>
380
                                <option value="never">Never</option>
381
                                <option value="forever">Forever</option>
382
                            [% END %]
383
                        </select>
384
                        <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>
385
                    </li>
386
387
            <span class="label">Enrolment period: </span>
388
            </br>
389
                    <fieldset>
390
                    <legend>Choose one</legend>
391
                            <ol>
392
                                <li>
393
                                    <label for="enrolmentperiod" style="width:6em;">In months: </label>
394
                                    <input type="number" min="0" class="enrolmentperiod" name="enrolmentperiod" id="enrolmentperiod" size="3" maxlength="3" value="[% IF category.enrolmentperiod %][% category.enrolmentperiod %][% END %]" /> months
395
                                </li>
396
                                <li>
397
                                    <label for="enrolmentperioddate" style="width:6em;">Until date: </label>
398
                                    <input type="text" class="enrolmentperioddate datepicker" name="enrolmentperioddate" id="enrolmentperioddate" value="[% category.enrolmentperioddate | $KohaDates %]" />
399
                                </li>
400
                            </ol>
401
                     </fieldset>
402
                    <br>
403
                    <input type="submit" class="action" value="Submit" />
404
    </form>
405
[% END %]
406
407
[% INCLUDE 'intranet-bottom.inc' %]
408
409
410
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep3.tt (+206 lines)
Line 0 Link Here
1
<!--Includes for creating patron-->
2
[% USE Koha %]
3
[% USE KohaDates %]
4
[% USE Price %]
5
<!--[% USE Branches %]-->
6
[% INCLUDE 'doc-head-open.inc' %]
7
[% IF ( finish ) %]<meta http-equiv="refresh" content="10; url=/cgi-bin/koha/mainpage.pl">[% END%]
8
[% INCLUDE 'installer-doc-head-close.inc' %]
9
[% INCLUDE 'calendar.inc' %]
10
[% INCLUDE 'datatables.inc' %]
11
12
13
<head>
14
<title>Create Patron</title>
15
16
<!--jQuery scripts for creating patron-->
17
<script type-"text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.fixFloat.js"></script>
18
<script type="text/javascipt">
19
        var MSG_DUPLICATE_PATRON = _("Warning: Duplicate patron");
20
        var MSG_PASSWORD_MISMATCH = _("The passwords entered do not match");
21
        var MSG_PASSWORD_CONTAINS_TRAILING_SPACES = _("Password contains leading and/or trailing spaces.");
22
function check_password(password){
23
    if(password.match(/^\s/) || password.match(/\s$/)){
24
        return false;
25
    }return true;
26
}
27
28
$(document).ready(function(){
29
     $("#createpatron").validate({
30
         rules: {
31
            borrowernumber: {
32
                 required: true,
33
                 digits: true
34
             },
35
            surname:{
36
                required: true,
37
                letters: true
38
            },
39
            firstname:{
40
                required:true,
41
                letters:true
42
            },
43
            userid: {
44
                required: true;
45
                letters_numbers: true
46
            },
47
            password: {
48
                 letters_numbers: true
49
            },
50
         },
51
         messages: {
52
             password: {
53
                 required: MSG_PASSWORD_MISMATCH
54
             },
55
             userid: {
56
                 required: MSG_DUPLICATE_PATRON
57
             }
58
         }
59
60
     });
61
62
})
63
</script>
64
<script type="text/javascript" src="[% interface %]/[% theme %]/js/members.js"></script>
65
</head>
66
67
<div>
68
    <h1 align="center"> Welcome to Koha</h1>
69
    <h1 id="logo"><img alt="Koha" style="width:50%;margin:auto;display:block;align:center;"  src="[% interface %]/[% theme %]/img/koha.org-logo.gif"/></h1>
70
</div>
71
72
73
[%  IF (nok) %]
74
        <form name="errors" method="post" action="onboarding.pl">
75
            <input type="hidden" name="step" value="3"/>
76
            <h1 align="left">There was an error</h1>
77
            <p>Try again </p>
78
            <div>
79
            <ul>
80
            [% IF errorloginexists %]
81
                <li id="ERROR_login_exist">Username/password already exists.</li>
82
            [% END %]
83
            [% IF errorcardnumberexists %]
84
                <li id="ERROR_cardnumber">Cardnumber already in use.</li>
85
            [% END %]
86
            [% IF errorcardnumberlength %]
87
                <li id="ERROR_cardnumber">Cardnumber length is incorrect</li>
88
            [% END %]
89
            [% IF errorshortpassword %]
90
                <li id="ERROR_short_password">Password length is incorrect, must be at least [% minPasswordLength %] characters long.</li>
91
            [% END %]
92
            [% IF errorpasswordmismatch %]
93
                <li id="ERROR_password_mismatch">Passwords do not match.</li>
94
            [% END %]
95
            </ul>
96
97
            </div>
98
            <input type="submit" name="step" value="Try again"/>
99
        </form>
100
101
102
<!--Create a patron screen 2-->
103
[% ELSIF op == 'add_validate' %]
104
          <!--New patron created-->
105
        <form name="patrondone" method="post" action="onboarding.pl">
106
            <input type="hidden" name="step" value="4"/>
107
            <h1 align="left"> New Patron </h1>
108
            <div>
109
                 <p> Success: New patron created!</p>
110
                 <p> To create another patron, go to Patrons > New Patron. <br>
111
                More > Set Permissions in a user page to gain superlibrarian permissions.
112
            </div>
113
            Next up:
114
            <input type="submit" name="start" value="Add an item type"/>
115
        </form>
116
[% ELSE %]
117
<!--Create a patron screen 1-->
118
       <h1 align="left"> Create a new Patron</h1>
119
       <legend id="library_management_lgd">Library Management</legend>
120
        <p>
121
        Now we will create a patron with superlibrarian permissions. Login with this to access Koha as a staff member will all permissions.
122
        </p>
123
        <form name="createpatron" method="post" action="onboarding.pl">
124
            <fieldset class="rows">
125
                 <input type="hidden" name="step" value="3"/>
126
                 <input type="hidden" name="op" value="add_validate" />
127
                     <legend id="library_management_lgd">Library Management</legend>
128
                     <p>
129
                        Now we will create a patron with superlibrarian permissions. Login with this to access Koha as a staff member will all permissions.
130
                     </p>
131
132
                     <ol>
133
                    <h3>Patron Identity</h3>
134
                        <li>
135
                            <label for="surname" class="required">Surname: </label>
136
137
                            <input type="text"  pattern="[a-zA-Z- ]+" title="Please only enter letters in the surname field" id="surname" name="surname"  value="[% surname %]" class="required" required="required" />
138
                            <span class="required">Required</span>
139
                        </li>
140
                        <li>
141
                            <label for="firstname" class="required">First Name: </label>
142
                            <input  type="text"  pattern="[a-zA-Z ]+" title="Please only enter letters in the firstname field" name="firstname" id="firstname" size="20" value="[% firstname |html %]" class="required" required="required">
143
                            <span class="required">Required</span>
144
                        </li>
145
                    </ol>
146
147
                    <ol>
148
                        <li>
149
                            <label for="cardnumber" class="required">Card Number: </label>
150
                            <input type="number" min="[% newcardnumber %]" pattern="[1-9]+" title="Please only enter numbers into the card number field" id="cardnumber" class="noEnterSubmit valid" name="cardnumber" maxlength="[%maxlength_cardnumber%]" minlength="[%minlength_cardnumber%]" value="[% newcardnumber %]" class="required" required="required">
151
                            <span class="required">Required</span>
152
                        </li>
153
                        <li>
154
                       <!--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-->
155
                            <label for="libraries" class="required"> Library: </label>
156
                            <select name="libraries" size="1" id="libraries">
157
158
                             [% FOREACH library IN libraries %]
159
                                  <option name="libraries" value="[% library.branchcode %]"> [% library.branchname %]
160
                             [% END %]
161
162
                                </select>
163
                            <span class="required"> Required</span>
164
                        </li>
165
                        <li>
166
                            <label for="categorycode_entry" class="required"> Patron Category</label>
167
                            <select id="categorycode_entry" name="categorycode_entry" onchange="update_category_code(this);">
168
                            [% FOREACH category IN categories %]
169
                                <option name="categorycode_entry" value = "[% category.categorycode %]">[%category.description %]</option>
170
                            [% END %]
171
                            </select>
172
                            <span class="required">Required</span><br><br>
173
                            <b>Note:</b> If you installed sample patron categories please select the "Staff" option in the Patron Categories dropdown box.
174
                        </li>
175
                    </ol>
176
177
                    <ol>
178
                            <h3> Patron permissions</h3>
179
                            <input type="hidden" name="newflags" value="1"/>
180
                            <li>
181
                                <input type="hidden" class="flag parent" id="flag-0" name="flag" value="superlibrarian"/>
182
                                <label name="permissioncode" for="flag-0"> superlibrarian</label>
183
                            </li>
184
                    </ol>
185
                    <ol>
186
                    <h3>OPAC/Staff Login</h3> 
187
                        <li>
188
                            <label for="userid" class="required">Username: </label>
189
                            <input type="text" name="userid" id ="userid" pattern="[A-Za-z1-9 ]+" title="Please only enter letters or numbers into this username field" size="20" value="[% userid %]" class="required" required="required" />
190
                            <span class="required">Required</span>
191
                        </li>
192
                        <li>
193
                            <label for="passwordlabel" class="required">Password: </label>
194
                            <input type="password" name="password" pattern="[A-Za-z1-9 ]+" title="Please only enter letters or numbers into this password field" id="password" size="20" value="[% member.password |html %]" class="required" required="required">
195
                            <span class="required">Required</span>
196
                        </li>
197
                        <li>
198
                            <label for="password2" class="required">Confirm password: </label>
199
                            <input type="password" id="password2" pattern="[A-Za-z1-9 ]+" title="Please only enter letters or numbers into this password field" name="password2" size="20" value="" class="required" required="required">
200
                            <span class="required">Required</span>
201
                        </li>
202
                    </ol>
203
             </fieldset><br>
204
                <input type="submit" class="action" value="Submit"/>
205
     </form>
206
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep4.tt (+82 lines)
Line 0 Link Here
1
<!--Includes for creating item type-->
2
[% INCLUDE 'doc-head-open.inc' %]
3
4
[% IF ( finish ) %]<meta http-equiv="refresh" content="10; url=/cgi-bin/koha/mainpage.pl">[% END %]
5
[% INCLUDE 'installer-doc-head-close.inc' %]
6
7
<head>
8
<title>Create item type</title>
9
10
<!--jQuery scripts for creating item type-->
11
12
13
14
</head>
15
16
<div>
17
    <h1 align="center"> Welcome to Koha</h1>
18
    <h1 id="logo"><img alt="Koha" style="width:50%;margin:auto;display:block;align:center;"  src="[% interface %]/[% theme %]/img/koha.org-logo.gif"/></h1>
19
</div>
20
21
[% IF itemtypes.count > 0 %]
22
    <br>
23
        <h3 align="left">You do not need to create a item type as you have already installed the sample item type data previously</h3>
24
     <form name="skipitemtype" method="post" action="onboarding.pl">
25
          <input type="hidden" name="step" value="5"/>
26
          <div>
27
            <input type="submit" name="start" value="Add a circulation rule"/>
28
          </div>
29
      </form>
30
31
32
<!--Create a item type screen 2-->
33
[% ELSIF op == "add_validate" %]
34
        <!--New item type created-->
35
        [% IF message != "error_on_insert" %]
36
            <form name="createitemtype" method="post" action="onboarding.pl">
37
                <input type="hidden" name="step" value="5"/>
38
                <h1 align="left"> New Item type </h1>
39
40
                <div>
41
                    <p> Success: New item type created!</p>
42
                    <p> To create another item type later and for more setttings <br>
43
                    go to More->Administration->Item types
44
                </div>
45
                     Next up:
46
                    <input type="submit" value="Add a circulation rule"/>
47
            </form>
48
        [% ELSE %]
49
            <form name="retryitem" method="post" action="onboarding.pl">
50
                <input type="hidden" name="step" value="4"/>
51
                <h1 align="left">Failed </h1>
52
                <div>
53
                    <p>Item type was not successfully created. </br>
54
                    Please try again or contact your system administrator. </p>
55
                    </div>
56
            </form>
57
          <!--Implement a if statement to check if the item type was successfully created or not
58
-->     [% END %]
59
[% ELSE %]    
60
<!--Create a item type screen 1-->
61
       <h1 align="left"> Create a new Item type </h2>
62
        <form name="createitemform" method="post" action="onboarding.pl">
63
            <fieldset class="rows">
64
                 <input type="hidden" name="step" value="4"/>
65
                 <input type="hidden" name="op" value="add_validate" />
66
                    <ol>
67
                        <li>
68
                            <label for="itemtype" class="required">Item type code: </label>
69
                            <input type="text" name="itemtype" pattern="^[A-Za-z]{0,10}$" title="Please enter either 2 or 3 capital letters as the item type" id="itemtype" size="10" maxlength="10"  class="required" required="required" />
70
                            <span class="required">Required</span>
71
                        </li>
72
                        <li>
73
                            <label for="description" class="required">Description: </label>
74
                            <input type="text" name="description" pattern="[A-Za-z1-9 ]+" title="Please only enter letters or numbers into this item type description" id="description" size="42" value="[% itemtype.description |html %]" class="required" required="required">
75
                            <span class="required">Required</span>
76
                        </li>
77
                    </ol>
78
            </fieldset><br>
79
                <input type="submit" class="action" value="Submit"/>
80
     </form>
81
[% END %]
82
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep5.tt (+126 lines)
Line 0 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
</head>
7
<div>
8
    <h1 align="center"> Welcome to Koha</h1>
9
    <h1 id="logo"><img alt="Koha" style="width:50%;margin:auto;display:block;align:center;"  src="[% interface %]/[% theme %]/img/koha.org-logo.gif"/></h1>
10
</div>
11
12
[% IF (finish) %]
13
<h1>Congratulations you have finished and ready to use Koha</h1>
14
<a href="/cgi-bin/koha/mainpage.pl">Start using Koha</a>
15
16
[% END %]
17
18
<!--Create a circulation rule screen 2-->
19
[% IF op == "add_validate" %]
20
        <!--New circulation rule created-->
21
        <form name="finish" method="post" action="onboarding.pl">
22
            <input type="hidden" name="op" value="finish" />
23
            <h1 align="left"> New Circulation rule </h1>
24
            <div>
25
                 <p> Success: New circulation rule created!</p>
26
                 <p> To create circulation rule, go to <br>
27
                 More->Administration->Circulation and Fine Rules
28
            </div>
29
                 Next up:
30
                 <input type="submit" name="op" value="Finish"/>
31
        </form>
32
[% ELSE %]    
33
<!--Create a circulation rule screen 1-->
34
       <h1 align="left"> Create a new Circulation rule </h1>
35
       <form name="createcirculationrule" method="post" action="onboarding.pl">
36
            <fieldset class="rows">
37
                 <input type="hidden" name="step" value="5"/>
38
                 <input type="hidden" name="op" value="add_validate" />
39
                    <ol>
40
                    <li>
41
                        <label for="branch" class="required"> Library branch</label>
42
                        <select name="branch" id="branch" required="required">
43
                        <option value="*">All</option>
44
                        [% FOREACH library IN libraries %]
45
                            <option name="branch" value="[% library.branchcode %]"> [% library.branchname %]</option>
46
                        [% END %]
47
                        </select>
48
                        <span class="required">Required</span>
49
                    </li>
50
                    <li>
51
                        <label for="categorycode" class="required">Patron Category: </label>
52
                        <select name="categorycode" id="categorycode" required="required" onchange = "update_categorycode(this);">
53
                               <!-- <option name="categorycode" value="All">All-->
54
                               <option value="*">All</option>
55
                             [% FOREACH category IN categories %]
56
                                <option name="categorycode" value = "[% category.categorycode %]"> [%category.description %]</option> 
57
                             [%END%]
58
                             </select>
59
                        <span class="required">Required</span>
60
                    </li>
61
62
                    <li>
63
                        <label for="itemtype"> Item type: </label>
64
                        <select id="itemtype" name="itemtype" required="required">
65
                            <option value="*">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" pattern="[1-9]+" title="Please only enter numbers" id="maxissueqty" size="10" maxlength="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" pattern="[1-9]+" title="Please only enter numbers" id="issuelength" size="10" maxlength="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
                        [% SET units = 'days' %]
87
                        [% IF category %]
88
                            [% SET default_privacy = category.default_privacy %]
89
                        [% END %]
90
91
                        [% SWITCH units %]
92
                             [% CASE 'days' %]
93
                                   <option value="days" selected="selected">Days</option>
94
                                   <option value="hours">Hours</option>
95
                             [% CASE 'hours' %]
96
                                   <option value="days">Days</option>
97
                                   <option value="hours" selected="selected">Hours</option>
98
                        [% END %]
99
                        </select>
100
                     </li>
101
                     <li>
102
                        <label for="renewalsallowed" class="required">Renewals Allowed: </label>
103
                        <input type="number"min="0" name="renewalsallowed" pattern="[1-9]+" title="Please only enter numbers" id="renewalsallowed" size="10" maxlength="10" value="" class="required" required="required" />
104
                        <span class="required">Required</span>
105
                     </li>
106
107
                     <li>
108
                        <label for="renewalperiod" class="required">Renewals Period: </label>
109
                        <input type="number" min="0"name="renewalperiod" pattern="[1-9]+" title="Please only enter numbers" id="renewalperiod" size="10" maxlength="10" value="" class="required" required="required" />
110
                        <span class="required">Required</span>
111
                     </li>
112
113
                     <li>
114
                        <label for="onshelfholds">On shelf holds allowed: </label>
115
                        <select name="onshelfholds" id="onshelfholds" required="required">
116
                              <option value="yes" selected="selected">Yes</option>
117
                              <option value="anyunavailable">If any unavailable</option>
118
                              <option value="allunavailable">If all unavailable</option>
119
                        </select>
120
                     </li>
121
                  </ol>
122
            </fieldset><br>
123
                <input type="submit" class="action" value="Submit"/>
124
     </form>
125
[% END %]
126
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/summary.tt (+41 lines)
Line 0 Link Here
1
[% USE Koha %]
2
[% INCLUDE 'doc-head-open.inc' %]
3
<title>Koha Tutorial Summary</title>
4
[% INCLUDE 'doc-head-close.inc' %]
5
</head>
6
<body id="admin_admin-home" class="admin">
7
[% INCLUDE 'header.inc' %]
8
[% INCLUDE 'cat-search.inc' %]
9
10
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; Summary</div>
11
12
<div id="doc" class="yui-t7">
13
    <div id="bd">
14
        <div id="yui-main" class="sysprefs">
15
            <div class="yui-g"><h1>Tutorial Summary Page</h1></div>
16
            <fieldset style="font-size:120%">
17
            <h2>Library</h2>
18
            <p> To add another library and for more settings, go to </br>
19
            More > Administration > Libraries and Groups </p>
20
21
            <h2>Patron Category</h2>
22
            <p>To add another patron category and for more settings, go to</br>
23
            More > Administration > Patrons and Circulation > Patron Categories</p>
24
25
            <h2>Patron</h2>
26
            <p>To create another patron, go to Patrons > New Patron. To set the </br>
27
            permissions of the patron, go to the patron's page and More > Set Permissions</p>
28
29
            <h2>Item Type</h2>
30
            <p>To create another item type and for more settings, go to</br>
31
            More > Administration > Item types </p>
32
33
            <h2>Circulation Rule</h2>
34
            <p>To create another circulation rule, go to </br>
35
            More > Administration > Circulation and Fine Rules</p<
36
            </fieldset>
37
38
        </div>
39
    </div>
40
</div>
41
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/summary.pl (-1 / +58 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/perl
2
3
# Copyright Pat Eyler 2003
4
# Copyright Biblibre 2006
5
# Parts Copyright Liblime 2008
6
# Parts Copyright Chris Nighswonger 2010
7
#
8
# This file is part of Koha.
9
#
10
# Koha is free software; you can redistribute it and/or modify it
11
# under the terms of the GNU General Public License as published by
12
# the Free Software Foundation; either version 3 of the License, or
13
# (at your option) any later version.
14
#
15
# Koha is distributed in the hope that it will be useful, but
16
# WITHOUT ANY WARRANTY; without even the implied warranty of
17
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
# GNU General Public License for more details.
19
#
20
# You should have received a copy of the GNU General Public License
21
# along with Koha; if not, see <http://www.gnu.org/licenses>.
22
23
use Modern::Perl;
24
25
use CGI qw ( -utf8 );
26
use List::MoreUtils qw/ any /;
27
use LWP::Simple;
28
use XML::Simple;
29
use Config;
30
31
use C4::Output;
32
use C4::Auth;
33
use C4::Context;
34
use C4::Installer;
35
36
use Koha;
37
use Koha::Acquisition::Currencies;
38
use Koha::Patrons;
39
use Koha::Caches;
40
use Koha::Config::SysPrefs;
41
use C4::Members::Statistics;
42
43
#use Smart::Comments '####';
44
45
my $query = new CGI;
46
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
47
    {
48
        template_name   => "summary.tt",
49
        query           => $query,
50
        type            => "intranet",
51
        authnotrequired => 0,
52
        flagsrequired   => { catalogue => 1 },
53
        debug           => 1,
54
    }
55
);
56
57
58
output_html_with_http_headers $query, $cookie, $template->output;

Return to bug 17855