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

(-)a/C4/Members.pm (-1 / +1 lines)
Lines 498-504 sub AddMember { Link Here
498
    }
498
    }
499
499
500
    my $patron_category = $schema->resultset('Category')->find( $data{'categorycode'} );
500
    my $patron_category = $schema->resultset('Category')->find( $data{'categorycode'} );
501
    $data{'privacy'} =
501
    $data{'privacy'} = 
502
        $patron_category->default_privacy() eq 'default' ? 1
502
        $patron_category->default_privacy() eq 'default' ? 1
503
      : $patron_category->default_privacy() eq 'never'   ? 2
503
      : $patron_category->default_privacy() eq 'never'   ? 2
504
      : $patron_category->default_privacy() eq 'forever' ? 0
504
      : $patron_category->default_privacy() eq 'forever' ? 0
(-)a/installer/install.pl (+6 lines)
Lines 199-204 elsif ( $step && $step == 3 ) { Link Here
199
        # The installer will have to relogin since we do not pass cookie to redirection.
199
        # The installer will have to relogin since we do not pass cookie to redirection.
200
        $template->param( "$op" => 1 );
200
        $template->param( "$op" => 1 );
201
    }
201
    }
202
202
    elsif ( $op && $op eq 'addframeworks' ) {
203
    elsif ( $op && $op eq 'addframeworks' ) {
203
    #
204
    #
204
    # 1ST install, 3rd sub-step : insert the SQL files the user has selected
205
    # 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);
251
        $template->param( "en_sample_data" => $sample_defaulted_to_en);
251
        $template->param( "levelloop" => $levellist );
252
        $template->param( "levelloop" => $levellist );
252
        $template->param( "$op"       => 1 );
253
        $template->param( "$op"       => 1 );
254
     
255
        my $setup = $query->param('setup');
256
        $template->param( "setup"=> $setup );
257
   
253
    }
258
    }
254
    elsif ( $op && $op eq 'choosemarc' ) {
259
    elsif ( $op && $op eq 'choosemarc' ) {
255
        #
260
        #
Lines 270-275 elsif ( $step && $step == 3 ) { Link Here
270
        # But could also be useful to have some Authorised values data set prepared here.
275
        # But could also be useful to have some Authorised values data set prepared here.
271
        # Marcflavour Selection is achieved through radiobuttons.
276
        # Marcflavour Selection is achieved through radiobuttons.
272
        my $langchoice = $query->param('fwklanguage');
277
        my $langchoice = $query->param('fwklanguage');
278
273
        $langchoice = $query->cookie('KohaOpacLanguage') unless ($langchoice);
279
        $langchoice = $query->cookie('KohaOpacLanguage') unless ($langchoice);
274
	$langchoice =~ s/[^a-zA-Z_-]*//g;
280
	$langchoice =~ s/[^a-zA-Z_-]*//g;
275
        my $dir =
281
        my $dir =
(-)a/installer/onboarding.pl (+446 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
#Recommended pragmas
3
use strict;
4
use warnings;
5
use diagnostics;
6
7
8
use Modern::Perl;
9
10
#External modules
11
use CGI qw ( -utf8 );
12
use List::MoreUtils qw/uniq/;
13
use Digest::MD5 qw(md5_base64);
14
use Encode qw( encode );
15
16
#Internal modules 
17
use C4::Koha;
18
use C4::Auth;
19
use C4::Context;
20
use C4::Output;
21
use C4::Members;
22
use C4::Members::Attributes;
23
use C4::Members::AttributeTypes;
24
use C4::Log;
25
use C4::Letters;
26
use C4::Form::MessagingPreferences; 
27
use Koha::AuthorisedValues;
28
use Koha::Patron::Debarments;
29
use Koha::Cities;
30
use Koha::Patrons;
31
use Koha::Items;
32
use Koha::Libraries;
33
use Koha::LibraryCategories;
34
use Koha::Database;
35
use Koha::DateUtils;
36
use Koha::Patron::Categories;
37
use Koha::ItemTypes;
38
use Koha::Patron::HouseboundRole;
39
use Koha::Patron::HouseboundRoles;
40
use Koha::Token;
41
use Email::Valid;
42
use Module::Load;
43
44
#Setting variables
45
my $input    = new CGI;
46
my $query    = new CGI;
47
my $step     = $query->param('step');
48
49
#Getting the appropriate template to display to the user-->
50
my ( $template, $loggedinuser, $cookie) = get_template_and_user(
51
     {
52
        template_name => "/onboarding/onboardingstep" . ( $step ? $step : 0 ) . ".tt",
53
        query         => $query,
54
        type          => "intranet",
55
        authnotrequired => 0,
56
        debug           => 1,
57
    }
58
);
59
60
#Check database connection
61
my %info;
62
$info{'dbname'} = C4::Context->config("database");
63
$info{'dbms'} =
64
(   C4::Context->config("db_scheme")
65
    ? C4::Context->config("db_scheme")
66
     : "mysql" );
67
68
$info{'hostname'} = C4::Context->config("hostname");
69
$info{'port'}     = C4::Context->config("port");
70
$info{'user'}     = C4::Context->config("user");
71
$info{'password'} = C4::Context->config("pass");
72
my $dbh = DBI->connect(
73
         "DBI:$info{dbms}:dbname=$info{dbname};host=$info{hostname}"
74
          . ( $info{port} ? ";port=$info{port}" : "" ),
75
           $info{'user'}, $info{'password'}
76
);
77
78
79
#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.
80
my $op = $query->param('op');
81
$template->param('op'=>$op);
82
if ( $op && $op eq 'finish' ) { #If the value of $op equals 'finish' then redirect user to /cgi-bin/koha/mainpage.pl
83
    print $query->redirect("/cgi-bin/koha/mainpage.pl");
84
    exit;
85
}
86
87
88
#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 starting the onboarding tool process
89
my $start = $query->param('start');
90
$template->param('start'=>$start); #Hand the start variable back to the template
91
if ( $start && $start eq 'Start setting up my Koha' ){ 
92
    my $libraries = Koha::Libraries->search( {}, { order_by => ['branchcode'] }, );
93
    $template->param(libraries   => $libraries,
94
              group_types => [
95
                {   categorytype => 'searchdomain',
96
                    categories   => [ Koha::LibraryCategories->search( { categorytype => 'searchdomain' } ) ],
97
                },
98
                {   categorytype => 'properties',
99
                         categories   => [ Koha::LibraryCategories->search( { categorytype => 'properties' } ) ],
100
                },
101
              ]
102
    );
103
104
105
#Select any library records from the database and hand them back to the template in the libraries variable. 
106
}elsif (  $start && $start eq 'Add a patron category' ){
107
108
#Select all the patron category records in the categories database table and store them in the newly declared variable $categories
109
    my $categories = Koha::Patron::Categories->search(); 
110
    $template->param(
111
        categories => $categories,
112
    ); #Hand the variable categories back to the template
113
114
}elsif ( $start && $start eq 'Add an item type' ){
115
     my $itemtypes = Koha::ItemTypes->search();
116
     $template->param(
117
             itemtypes => $itemtypes,
118
    );
119
120
#Check if the $step variable equals 1 i.e. the user has clicked to create a library in the create library screen 1 
121
}elsif ( $step && $step == 1 ) {
122
123
    my $createlibrary = $query->param('createlibrary'); #Store the inputted library branch code and name in $createlibrary
124
    $template->param('createlibrary'=>$createlibrary); # Hand the library values back to the template in the createlibrary variable
125
126
    #store inputted parameters in variables
127
    my $branchcode       = $input->param('branchcode');
128
    my $categorycode     = $input->param('categorycode');
129
    my $op               = $input->param('op') || 'list';
130
    my $message;
131
    my $library;
132
#my @messages;
133
134
    #Take the text 'branchname' and store it in the @fields array
135
    my @fields = qw(
136
        branchname
137
    ); 
138
139
140
#test
141
    $template->param('branchcode'=>$branchcode); 
142
143
    $branchcode =~ s|\s||g; # Use a regular expression to check the value of the inputted branchcode 
144
145
    #Create a new library object and store the branchcode and @fields array values in this new library object
146
    $library = Koha::Library->new(
147
        {   branchcode => $branchcode, 
148
            ( map { $_ => scalar $input->param($_) || undef } @fields )
149
        }
150
    );
151
152
    eval { $library->store; }; #Use the eval{} function to store the library object
153
154
    if($library){
155
       $message = 'success_on_insert';
156
   }else{
157
       $message = 'error_on_insert';
158
   }
159
160
   $template->param('message' => $message); 
161
162
163
#Check if the $step vairable equals 2 i.e. the user has clicked to create a patron category in the create patron category screen 1
164
}elsif ( $step && $step == 2 ){
165
    my $createcat = $query->param('createcat'); #Store the inputted library branch code and name in $createlibrary
166
    $template->param('createcat'=>$createcat); # Hand the library values back to the template in the createlibrary variable
167
168
169
    #Initialising values
170
    my $input         = new CGI;
171
    my $searchfield   = $input->param('description') // q||;
172
    my $categorycode  = $input->param('categorycode');
173
    my $op            = $input->param('op') // 'list';
174
    my $message;
175
    my $category;
176
177
    my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
178
    {
179
        template_name   => "/onboarding/onboardingstep2.tt",
180
        query           => $input,
181
        type            => "intranet",
182
        authnotrequired => 0,
183
        flagsrequired   => { parameters => 'parameters_remaining_permissions' },
184
        debug           => 1,
185
    }
186
    );
187
        my $categorycode = $input->param('categorycode');
188
        my $description = $input->param('description');
189
        my $overduenoticerequired = $input->param('overduenoticerequired');
190
        my $category_type = $input->param('category_type');
191
        my $default_privacy = $input->param('default_privacy');
192
        my $enrolmentperiod = $input->param('enrolmentperiod');
193
        my $enrolmentperioddate = $input->param('enrolmentperioddate') || undef;
194
195
        #Converts the string into a date format
196
        if ( $enrolmentperioddate) {
197
            $enrolmentperioddate = output_pref(
198
                    {
199
                        dt         => dt_from_string($enrolmentperioddate),
200
                        dateformat => 'iso',
201
                        dateonly   => 1,
202
                    }
203
            );
204
        }
205
        #Adds to the database
206
        $category = Koha::Patron::Category->new({
207
                categorycode=> $categorycode,
208
                description => $description,
209
                overduenoticerequired => $overduenoticerequired,
210
                category_type=> $category_type,
211
                default_privacy => $default_privacy,
212
                enrolmentperiod => $enrolmentperiod,
213
                enrolmentperioddate => $enrolmentperioddate,
214
        });
215
        eval {
216
            $category->store;
217
        };
218
219
        #Error messages
220
        if($category){
221
            $message = 'success_on_insert';
222
        }else{
223
            $message = 'error_on_insert';
224
        }
225
226
        $template->param('message' => $message); 
227
    
228
    }
229
230
#Create a patron
231
}elsif ( $step && $step == 3 ){
232
    my $libraries = Koha::Libraries->search( {}, { order_by => ['branchcode'] }, );
233
    $template->param(libraries   => $libraries,
234
              group_types => [
235
                {   categorytype => 'searchdomain',
236
                    categories   => [ Koha::LibraryCategories->search( { categorytype => 'searchdomain' } ) ],
237
                },
238
                {   categorytype => 'properties',
239
                         categories   => [ Koha::LibraryCategories->search( { categorytype => 'properties' } ) ],
240
                },
241
              ]
242
    );
243
244
    my $categories;
245
    $categories= Koha::Patron::Categories->search();
246
    $template->param(
247
            categories => $categories,
248
    );
249
250
    my $input = new CGI;
251
    my $op = $input->param('op') // 'list';
252
253
    my @messages;
254
    my @errors;
255
256
    my ($template, $loggedinuser, $cookie)= get_template_and_user({
257
                template_name => "/onboarding/onboardingstep3.tt",
258
                query => $input,
259
                type => "intranet",
260
                authnotrequired => 0,
261
                flagsrequired => {borrowers => 1},
262
                debug => 1,
263
    });
264
265
266
    if($op eq 'add_validate'){
267
        my %newdata;
268
269
#Store the template form values in the newdata hash      
270
         $newdata{borrowernumber} = $input->param('borrowernumber');       
271
         $newdata{surname}  = $input->param('surname');
272
         $newdata{firstname}  = $input->param('firstname');
273
         $newdata{cardnumber} = $input->param('cardnumber');
274
         $newdata{branchcode} = $input->param('libraries');
275
         $newdata{categorycode} = $input->param('categorycode_entry');
276
         $newdata{userid} = $input->param('userid');
277
         $newdata{password} = $input->param('password');
278
         $newdata{password2} = $input->param('password2');
279
         $newdata{dateexpiry} = '12/10/2016';
280
         $newdata{privacy} = "default";
281
282
        if(my $error_code = checkcardnumber($newdata{cardnumber},$newdata{borrowernumber})){
283
            push @errors, $error_code == 1
284
                ? 'ERROR_cardnumber_already_exists'
285
                :$error_code == 2 
286
                    ? 'ERROR_cardnumber_length'
287
                    :()
288
        }
289
290
291
292
#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
293
        my $borrowernumber = &AddMember(%newdata);
294
#Create a hash named member2 and fillit with the borrowernumber of the borrower that has just been created 
295
        my %member2;
296
        $member2{'borrowernumber'}=$borrowernumber;
297
        
298
299
        my $flag = $input->param('flag');
300
     
301
        if ($input->param('newflags')) {
302
             my $dbh=C4::Context->dbh();
303
             my @perms = $input->multi_param('flag');
304
             my %all_module_perms = ();
305
             my %sub_perms = ();
306
             foreach my $perm (@perms) {
307
                  if ($perm !~ /:/) {
308
                       $all_module_perms{$perm} = 1;
309
                   } else {
310
                        my ($module, $sub_perm) = split /:/, $perm, 2;
311
                        push @{ $sub_perms{$module} }, $sub_perm;
312
                   }
313
             }
314
315
316
        # construct flags
317
          my $module_flags = 0;
318
          my $sth=$dbh->prepare("SELECT bit,flag FROM userflags ORDER BY bit");
319
          $sth->execute(); 
320
          while (my ($bit, $flag) = $sth->fetchrow_array) {
321
              if (exists $all_module_perms{$flag}) {
322
                   $module_flags += 2**$bit;
323
              }
324
          }
325
326
           $sth = $dbh->prepare("UPDATE borrowers SET flags=? WHERE borrowernumber=?");
327
           $sth->execute($module_flags, $borrowernumber);
328
329
330
#Error handling checking if the patron was created successfully
331
        if(!$borrowernumber){
332
            push @messages, {type=> 'error', code => 'error_on_insert'};
333
        }else{
334
            push @messages, {type=> 'message', code => 'success_on_insert'};
335
        }
336
 
337
  }
338
  }
339
340
    }
341
}elsif ( $step && $step == 4){
342
    my $createitemtype = $input->param('createitemtype');
343
    $template->param('createitemtype'=> $createitemtype );
344
    
345
    my $input = new CGI;
346
    my $itemtype_code = $input->param('itemtype');
347
    my $op = $input->param('op') // 'list';
348
    my $message;
349
350
    my( $template, $borrowernumber, $cookie) = get_template_and_user(
351
            {   template_name   => "/onboarding/onboardingstep4.tt",
352
                query           => $input,
353
                type            => "intranet",
354
                authnotrequired => 0,
355
                flagsrequired   => { parameters => 'parameters_remaining_permissions'},
356
                debug           => 1,
357
            }
358
    );
359
   
360
    if($op eq 'add_form'){
361
        my $itemtype = Koha::ItemTypes->find($itemtype_code);
362
        $template->param(itemtype=> $itemtype,);
363
    }elsif($op eq 'add_validate'){
364
        my $itemtype = Koha::ItemTypes->find($itemtype_code);
365
        my $description = $input->param('description');
366
367
        #store the input from the form - only 2 fields 
368
        my $thisitemtype= Koha::ItemType->new(
369
            { itemtype    => $itemtype_code,
370
              description => $description,
371
            }
372
        );
373
        eval{ $thisitemtype->store; };
374
        #Error messages
375
        if($thisitemtype){
376
            $message = 'success_on_insert';
377
        }else{
378
            $message = 'error_on_insert';
379
        }
380
381
        $template->param('message' => $message); 
382
    }
383
}elsif ( $step && $step == 5){
384
    my $test="a";
385
    warn $test;
386
    
387
    #Fetching all the existing categories to display in a drop down box
388
    my $categories;
389
    $categories= Koha::Patron::Categories->search();
390
    $template->param(
391
        categories => $categories,
392
    );
393
    
394
    my $itemtypes;
395
    $itemtypes= Koha::ItemTypes->search();
396
    $template->param(
397
        itemtypes => $itemtypes,
398
    );
399
    
400
    my $input = CGI->new;
401
    my($template, $loggedinuser, $cookie)  =get_template_and_user({
402
            template_name => "/onboarding/onboardingstep5.tt",
403
            query => $input,
404
            type => "intranet",
405
            authnotrequired=>0,
406
            flagsrequired=> {parameters => 'manage_circ_rules'},
407
            debug =>1,
408
    });
409
    my $type = $input->param('type');
410
    my $branch = $input->param('branch');
411
    if($op eq 'add_form'){
412
    }
413
        
414
    elsif($op eq 'add_validate'){
415
        my $bor = $input->param('categorycode');
416
        my $itemtype = $input->param('itemtype');
417
        my $maxissueqty = $input->param('maxissueqty');
418
        my $issuelength = $input->param('issuelength');
419
        #$issuelength = $issuelength eq q{} ? undef : $issuelength;
420
        my $lengthunit = $input->param('lengthunit');
421
        my $renewalsallowed = $input->param('renewalsallowed');
422
        my $renewalperiod = $input->param('renewalperiod');
423
        my $onshelfholds = $input->param('onshelfholds');
424
425
        my $params ={
426
            categorycode    => $bor,
427
            itemtype        => $itemtype,
428
            maxissueqty     => $maxissueqty,
429
            renewalsallowed => $renewalsallowed,
430
            renewalperiod   => $renewalperiod,
431
            lengthunit      => $lengthunit,
432
            onshelfholds    => $onshelfholds,
433
        };
434
        my $issuingrule = Koha::IssuingRules->find({categorycode => $bor, itemtype => $itemtype});
435
        if($issuingrule){
436
            $issuingrule->set($params)->store();
437
        }else{
438
            Koha::IssuingRule->new()->set($params)->store(); 
439
        }
440
    }
441
 }
442
443
444
445
output_html_with_http_headers $input, $cookie, $template->output;
446
(-)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/installer/step3.tt (-90 / +111 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
31
        window.location.replace( surl );
32
    }
33
30
34
    function selectAllFrameworks()
31
    window.location.replace( surl );
32
}
33
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 97-147 Link Here
97
    <input type="hidden" name="step" value="3" />
116
    <input type="hidden" name="step" value="3" />
98
    <input type="hidden" name="op" value="addframeworks" />
117
    <input type="hidden" name="op" value="addframeworks" />
99
118
100
      [% IF ( frameworksloop ) %]
119
    [% IF ( frameworksloop ) %]
101
      <h2>MARC frameworks: [% marcflavour %]</h2>
120
    <h2>MARC frameworks: [% marcflavour %]</h2>
102
      [% IF ( en_marc_frameworks ) %]
121
    [% IF ( en_marc_frameworks ) %]
103
      <h4><span class="error">No MARC frameworks are available for your language.                 Defaulting to the frameworks supplied for English (en)<span></h4>
122
        <h4><span class="error">No MARC frameworks are available for your language.
104
      [% END %]
123
                Defaulting to the frameworks supplied for English (en)<span></h4>
105
      [% FOREACH frameworksloo IN frameworksloop %]
124
    [% END %]
106
      <div>
125
    [% FOREACH frameworksloo IN frameworksloop %]
107
      <h3>[% frameworksloo.label %]</h3>
126
    <div>
108
      [% FOREACH framework IN frameworksloo.frameworks %]         <table style="border:1px;vertical-align:top;">
127
    <h3>[% frameworksloo.label %]</h3>
109
      <tr>
128
    [% FOREACH framework IN frameworksloo.frameworks %]
129
        <table style="border:1px;vertical-align:top;">
130
        <tr>
110
         <td style = "border:1px; vertical-align:top;">
131
         <td style = "border:1px; vertical-align:top;">
111
        [% IF (frameworksloo.label == "Default" ) %]   
132
        [% IF (frameworksloo.label == "Default") && (setup=="Basic") %]   
112
        <input type="hidden" name="framework" value="[%     framework.fwkfile %]" id =="[%framework.fwkname%]" />
133
        <input type="hidden" name="framework" value="[%     framework.fwkfile %]" id =="[%framework.fwkname%]" />
113
        [% ELSE %]
134
        [% ELSE %]
114
             <input type="checkbox" name="framework" value="[% framework.fwkfile %]" id =="[%framework.fwkname%]" />
135
             <input type="checkbox" name="framework" value="[% framework.fwkfile %]" id =="[%framework.fwkname%]" />
115
         [% END %]
136
         [% END %]
116
      </td>
137
      </td>
117
      <td>
138
      <td>
118
      [% IF (frameworksloo.label == "Default" ) %]
139
      [% IF (frameworksloo.label == "Default") && (setup=="Basic") %]
119
        <ul>
140
        <ul>
120
        <label for="[% framework.fwkname %]">
141
            <label for="[% framework.fwkname %]">
121
            <li>[% framework.fwkdescription %]</li>
142
               <li> [% framework.fwkdescription %]</li>
122
            <em>([% framework.fwkname %])</em>
143
                 <em>([% framework.fwkname %])</em>   
123
        </label>
144
            </label>
124
        </ul>
145
            </ul>
125
      </td>
146
         </td>
126
      [% ELSE %]
147
        [% ELSE %]
127
      <td>
148
        <td>
128
         <label for= "[% framework.fwkname %]">
149
            <label for= "[% framework.fwkname %]">
129
            [% framework.fwkdescription %]
150
                [% framework.fwkdescription %]
130
            <em>([% framework.fwkname %])</em>
151
                <em>([% framework.fwkname %])</em>
131
         </label>
152
            </label>
132
      </td>
153
        </td>
133
      [% END %]
154
        [% END %]
134
      </tr>
155
        </tr>
135
        </table>
156
        </table>
136
      [% END %]
157
    [% END %]
137
      </div>
158
    </div>
138
      [% END %]
159
    [% END %]
139
    <h2>Other data</h2>
160
    <h2>Other data</h2>
140
                  [% END %]
161
    [% END %]
141
                  [% IF ( en_sample_data ) %]
162
    [% IF ( en_sample_data ) %]
142
                      <h4><span class="error">No sample data and settings ar    e available for your language.
163
        <h4><span class="error">No sample data and settings are available for your language.
143
             132                 Defaulting to the samples supplied for English     (en)<span></h4>
164
                Defaulting to the samples supplied for English (en)<span></h4>
144
                 [% END %]
165
    [% END %]
145
    [% FOREACH levelloo IN levelloop %]
166
    [% FOREACH levelloo IN levelloop %]
146
    <div>
167
    <div>
147
    <h3>[% levelloo.label %]</h3>
168
    <h3>[% levelloo.label %]</h3>
Lines 149-168 Link Here
149
        <table style="border:1px;vertical-align:top;">
170
        <table style="border:1px;vertical-align:top;">
150
        <tr>
171
        <tr>
151
        <td style="vertical-align:top;">
172
        <td style="vertical-align:top;">
152
        [% IF (levelloo.label == "Default" ) %]
173
        [% IF (levelloo.label == "Default" ) && (setup=="Basic")%]
153
             <input type="hidden" name="framework" value="[% framework.fwkfile %]" id="[%framework.fwkname %]" />
174
             <input type="hidden" name="framework" value="[% framework.fwkfile %]" id="[%framework.fwkname %]" />
154
        [% ELSE %]
175
        [% ELSE %]
155
             <input type="checkbox" name="framework" value="[%framework.fwkfile %]" id=="[%framework.fwkname%]"/> 
176
             <input type="checkbox" name="framework" value="[%framework.fwkfile %]" id=="[%framework.fwkname%]"/> 
156
        [% END %]
177
        [% END %]
157
        </td>
178
        </td>
158
        <td>
179
        <td>
159
        [% IF (levelloo.label == "Default") %]
180
        [% IF (levelloo.label == "Default") && (setup=="Basic")%]
160
           <ul>
181
           <ul>
161
            <label for="[% framework.fwkname %]">
182
            <label for="[% framework.fwkname %]">
162
               <li> [% framework.fwkdescription %]</li>
183
               <li> [% framework.fwkdescription %]</li>
163
                <em>([% framework.fwkname %])</em>
184
                <em>([% framework.fwkname %])</em>
164
            </label>
185
            </label>
165
           </ul>
186
            </ul>
166
        </td>
187
        </td>
167
        [% ELSE %]
188
        [% ELSE %]
168
        <td>
189
        <td>
Lines 247-253 Link Here
247
        <br>
268
        <br>
248
        <br>
269
        <br>
249
            <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>
250
        </p>
271
251
    [% END %]
272
    [% END %]
252
[% END %]
273
[% END %]
253
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 (+54 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
6
<head>
7
<title>Welcome &rsaquo; to  &rsaquo; Koha</title>
8
9
<!--jQuery code for create library-->
10
<script type="text/javascript" src="[% interface %]/lib/tiny_mce/tiny_mce.js"></script>
11
<script type="text/javascript">
12
     //<![CDATA[
13
             $(document).ready(function() {
14
                      $("#branchest").dataTable($.extend(true, {}, dataTablesDefaults, {
15
                             "aoColumnDefs": [
16
                                 { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
17
                              ],
18
                              "iDisplayLength": 10,
19
                              "sPaginationType": "four_button"
20
                       }));
21
22
                       [% UNLESS library %]
23
                             $("#Aform").on("submit", function( event ) {
24
                                      if ( $("#branchcode").val().match(/\s/) ) {
25
                                         event.preventDefault();
26
                                         alert(_("The library code entered contains whitespace characters. Please remove any whitespace characters from the library code"));
27
                                          return false;
28
                                       } else {
29
                                          return true;
30
                                       }
31
                             });
32
                        [% END %]..
33
              });
34
    //]]>
35
 </script>
36
 </head>
37
38
 <!--Header for the koha onboarding tool-->
39
<div>
40
      <h1 align="center"> Welcome to Koha</h1>
41
      <h1 id="logo"><img alt="Koha" style="width:50%;margin:auto;display:block;align:center;"  src="[% interface %]/[% theme %]/img/koha.org-logo.gif"/></h1>
42
      <h2 align="center"> We're just going to set up a few things......</h2>
43
      <form name="startkoha" method="post" action="onboarding.pl">
44
         <input type="hidden" name="step" value="1"/>
45
         <input type="submit" name="start" value="Start setting up my Koha"/>
46
      </form>
47
</div>
48
49
50
51
52
53
54
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep1.tt (+118 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
8
<!--jQuery code for create library-->
9
<script type="text/javascript" src="[% interface %]/lib/tiny_mce/tiny_mce.js"></script>
10
<script type="text/javascript">
11
    //<![CDATA[
12
          $(document).ready(function() {
13
                  $("#branchest").dataTable($.extend(true, {}, dataTablesDefaults, {
14
                     "aoColumnDefs": [
15
                         { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
16
                     ],
17
                     "iDisplayLength": 10,
18
                     "sPaginationType": "four_button"
19
                  }));
20
21
                  [% UNLESS library %]
22
                      $("#Aform").on("submit", function( event ) {
23
                               if ( $("#branchcode").val().match(/\s/) ) {
24
                                 event.preventDefault();
25
                                 alert(_("The library code entered contains whitespace characters. Please remove any whitespace     characters from the library code"));
26
                                 return false;
27
                                } else {
28
                                 return true;
29
                                }
30
                       });
31
                 [% END %]..
32
     });
33
//]]>
34
</script>
35
</head>
36
37
<!--Header for the koha onboarding tool-->
38
<div>
39
    <h1 align="center"> Welcome to Koha</h1>
40
    <h1 id="logo"><img alt="Koha" style="width:50%;margin:auto;display:block;align:center;"  src="[% interface %]/[% theme %]/img/koha.org-logo.gif"/></h1>
41
</div>
42
 [% IF libraries.count > 0 %]
43
 <br>
44
    <h3 align="left">You do not need to create a library as you have already installed the sample library data previously</h3>
45
    <form name="skiplibrary" method="post" action="onboarding.pl">
46
        <input type="hidden" name="step" value="2"/>
47
        <div>
48
            <input type="submit" name="start" value="Add a patron category"/>
49
        </div>
50
    </form>
51
52
    <!--Create a library screen 2-->
53
[% ELSIF (createlibrary) %]
54
        <!--New Library created-->
55
       [% IF message == "success_on_insert" %] 
56
            <form name="createlibrary" method="post" action="onboarding.pl">
57
                <input type="hidden" name="step" value="2"/>
58
                <h1 align="left"> New Library</h1>
59
                <div>
60
                    <p> Success: Library created! Your branchcode is [% branchcode %]
61
</p>
62
                    <p> To add another library and for more settings, <br>
63
                    go to Tools->Administration->Libraries and Groups
64
                </div>
65
                Next up:
66
                <input type="submit" name="start" value="Add a patron category"/>
67
            </form>
68
69
        [%ELSE %]
70
            <!--Implement if statement to determine if library was succesfully created here....-->
71
            <form name="retrylibrary" method="post" action="onboarding.pl">
72
                <input type="hidden" name="step" value="1"/>
73
                <h1 align="left">Failed </h1>
74
                <div>
75
                    <p> Library was not successfully created</br>
76
                    Please try again or contact your system administrator. </p>
77
                </div>
78
                <input type="submit" value="Try again"/>
79
            </form>
80
        [%END%]
81
        
82
[% ELSE %]
83
<!--Create a library screen 1-->
84
        <h2>Create a Library</h2> 
85
        <form name="LibraryCreation" method="post" action="onboarding.pl">
86
            <fieldset class="rows">
87
                 <input type="hidden" name="step" value="1"/>
88
                 <input type="hidden" name="createlibrary" value="createlibrary"/>
89
                 <ol>
90
                     <li>
91
                        <label for="branchcode" class="required">Library code: </label>
92
                        <input type="text" style="text-transform: uppercase;"name="branchcode" id="branchcode" size="10" maxlength="10" value="[% library.branchcode |html %]" class="required" required="required" />
93
                        <span class="required">Required</span>
94
                    </li>
95
                    <li>
96
                        <label for="branchname" class="required">Name: </label>
97
                        <input type="text" style="text-transform:capitalize;" name="branchname" id="branchname" size="80" value="[% library.branchname |html %]" class="    required" required="required" style="width:200px;">
98
                        <span class="required">Required</span>
99
                    </li>
100
                 </ol>
101
             </fieldset>
102
             <br>
103
             <input type="submit" class="action" value="Submit"/>
104
     </form>
105
[% END %]  
106
    
107
108
109
110
111
112
113
114
115
116
117
118
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep2.tt (+235 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
<script type="text/javascript">
10
     var MSG_CATEGORYCODE_CHARS = (_("Category code can only contain the following characters: letters, numbers, - and _."));
11
     var MSG_ONE_ENROLLMENTPERIOD =(_("Please choose an enrollment period in months OR by date."));
12
</script>
13
<script type="text/javascript">
14
jQuery.validator.addMethod( "letters_numbers", function(value,element){
15
    var patt = /^[a-zA-Z0-9\-_]+$/g;
16
    if (patt.test(element.value)) {
17
        return true;
18
    } else {
19
        return false;
20
    }
21
}, MSG_CATEGORYCODE_CHARS);
22
23
jQuery.validator.addMethod( "enrollment_period", function(){
24
    enrolmentperiod = $("#enrolmentperiod").val();
25
    enrolmentperioddate = $("#enrolmentperioddate").val();
26
    if ( $("#enrolmentperiod").val() !== "" && $("#enrolmentperioddate").val() !== "" ) {
27
        return false;
28
    } else {
29
        return true;
30
    }
31
}, MSG_ONE_ENROLLMENTPERIOD);
32
33
$(document).ready(function(){
34
     $("#category_form").validate({
35
         rules: {
36
             categorycode: {
37
                 required: true,
38
                 letters_numbers: true
39
             },
40
             description: "required",
41
             enrolmentperiod: {
42
                 required: function(element){
43
                    return $("#enrolmentperioddate").val() === "";
44
             },
45
                 digits: true,
46
                 enrollment_period: true
47
             },
48
             enrolmentperioddate: {
49
                 required: function(element){
50
                   return $("#enrolmentperiod").val() === "";
51
                 },
52
                 enrollment_period: true
53
             },
54
             dateofbirthrequired: {
55
                digits: true
56
             },
57
             upperagelimit: {
58
                 digits: true
59
             },
60
             enrolmentfee: {
61
                 number: true
62
             },
63
             reservefee: {
64
                 number: true
65
             },
66
             category_type: {
67
                 required: true
68
             }
69
         },
70
         messages: {
71
             enrolmentperiod: {
72
                 required: MSG_ONE_ENROLLMENTPERIOD
73
             },
74
             enrolmentperioddate: {
75
                 required: MSG_ONE_ENROLLMENTPERIOD
76
             }
77
         }
78
 
79
     });
80
81
})
82
</script>
83
84
</head>
85
86
<div> <!-- Header that appears at the top of every screen in the koha onboarding tool-->
87
    <h1 align="center"> Welcome to Koha</h1>
88
    <h1 id="logo"><img alt="Koha" style="width:50%;margin:auto;display:block;align:center;"  src="[% interface %]/[% theme %]/img/koha.org-logo.gif"/></h1>
89
</div>
90
91
92
[% 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-->
93
<br>
94
     <h3 align="left">You do not need to create a patron category as you have already installed the sample patron categories data previously</h3>
95
     <form name="skippatroncategory" method="post" action="onboarding.pl">
96
          <input type="hidden" name="step" value="3"/>
97
          <div>
98
            <input type="submit" name="start" value="Add a patron"/>
99
          </div>
100
     </form>
101
102
<!--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-->
103
[% ELSIF op == "add_validate" %]
104
    [% IF message != "error_on_insert" %]
105
     <form name="createcat" method="post" action="onboarding.pl">
106
            <input type="hidden" name="step" value="3"/>
107
             <h1 align="left">  New patron category</h1>
108
             <div>
109
                 <p> Success: Patron category created! Your patron category code is [% category.categorycode %] </p>
110
                 <p> To add another patron category and for more settings<br>
111
                 go to More->Administration->Patrons & Circulation->Patron Categories</p>
112
             </div>
113
             Next up:<br>
114
             <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-->
115
     </form>
116
     [% ELSE %]
117
        <form name="retrypatcat" method="post" action="onboarding.pl">
118
        Message is [% message %]    
119
        <input type="hidden" name="step" value="2"/>
120
            <h1 align="left">Failed</h1>
121
            <div>Patron Category was not successfully created.</br>
122
            Please try again or contact your system administrator.</p>
123
            </div>
124
            <input type="submit" value="Try again"/>
125
        </form>
126
    [% END %] 
127
        
128
129
[% ELSE %] <!--Else display create patron category screen 1 where the user can input values to create their first patron category-->
130
    <h1 align="left"> Create a new Patron Category</h1>
131
       <form id="category_form" method="post" action="onboarding.pl">  
132
       <fieldset class="rows">
133
            <input type="hidden" name="step" value="2"/>
134
            <input type="hidden" name="op" value="add_validate" />
135
                <ol>
136
                    <li>
137
                        <label for="categorycode" class="required">Category code: </label>
138
                        <input type="text" style="text-transform: uppercase;" name="categorycode" value="[% category.categorycode |html %]" size="10" maxlength="10" class="required" required="required" />
139
                        <span class="required">Required</span>
140
                    </li>
141
142
                    <li>
143
                        <label for="description" class="required">Description: </label>
144
                        <input type="text" style="text-transform:capitalize;" name="description" size="40" maxlength="80" class="required" required="required" value="[% category.description |html %]" />
145
                        <span class="required">Required</span>
146
                    </li>
147
148
                    <li>
149
                        <label for="overduenoticerequired">Overdue notice required: </label>
150
                        <select name="overduenoticerequired" value="overduenoticerequired">
151
                            [% IF category.overduenoticerequired %]
152
                                <option value="0">No</option>
153
                                <option value="1" selected="selected">Yes</option>
154
                            [% ELSE %]
155
                                <option value="0" selected="selected">No</option>
156
                                <option value="1">Yes</option>
157
                            [% END %]
158
                        </select>
159
                    </li>
160
161
                    <li>
162
                        <label for="category_type" class="required">Category type: </label>
163
                        <select name="category_type" value="category_type" class='required' required='required'>
164
                            [% IF category and category.category_type == 'S' %]
165
                                <option value="S" selected="selected">Staff</option>
166
                            [% ELSE %]
167
                                <option value="S">Staff</option>
168
                            [% END %]
169
                        </select>
170
                        <span class="required">Required</span>
171
                    </li>
172
173
                    <li>
174
                        <label for="default_privacy">Default privacy: </label>
175
                        <select value="default_privacy" name="default_privacy" required="required">
176
                            [% SET default_privacy = 'default' %]
177
178
                            [% IF category %]
179
                            [% SET default_privacy = category.default_privacy %]
180
                            [% END %]
181
182
                            [% SWITCH default_privacy %]
183
                            [% CASE 'forever' %]
184
                                <option value="default">Default</option>
185
                                <option value="never">Never</option>
186
                                <option value="forever" selected="selected">Forever</option>
187
                            [% CASE 'never' %]
188
                                <option value="default">Default</option>
189
                                <option value="never" selected="selected">Never</option>
190
                                <option value="forever">Forever</option>
191
                            [% CASE %]
192
                                <option value="default" selected="selected">Default</option>
193
                                <option value="never">Never</option>
194
                                <option value="forever">Forever</option>
195
                            [% END %]
196
                        </select>
197
                        <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>
198
                    </li>
199
200
            <span class="label">Enrolment period: </span>
201
            </br>
202
                    <fieldset>
203
                    <legend>Choose one</legend>
204
                            <ol>
205
                                <li>
206
                                    <label for="enrolmentperiod" style="width:6em;">In months: </label>
207
                                    <input type="number" min="0" class="enrollmentperiod" name="enrolmentperiod" size="3" maxlength="3" value="[% IF category.enrolmentperiod %][% category.enrolmentperiod %][% END %]" /> months 
208
                                </li>
209
                                <li>
210
                                    <label for="enrolmentperioddate" style="width:6em;">Until date: </label>
211
                                    <input type="text" class="enrollmentperiod" name="enrolmentperioddate" id="enrolmentperioddate" value="[% category.enrolmentperioddate | $KohaDates %]" />
212
                                </li>
213
                            </ol>
214
                     </fieldset>
215
                    <br>
216
                    <input type="submit" class="action" value="Submit" />
217
    </form>
218
[% END %]
219
220
[% INCLUDE 'intranet-bottom.inc' %]
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep3.tt (+127 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
9
10
[% INCLUDE 'installer-doc-head-close.inc' %]
11
[% INCLUDE 'calendar.inc' %]
12
[% INCLUDE 'datatables.inc' %]
13
14
15
<head>
16
<title>Create Patron</title>
17
18
<!--jQuery scripts for creating patron-->
19
<!--<script type="text/javascript" src="[% interface %]/[% theme %]/js/members.js"></script>
20
-->
21
</head>
22
23
<div>
24
    <h1 align="center"> Welcome to Koha</h1>
25
    <h1 id="logo"><img alt="Koha" style="width:50%;margin:auto;display:block;align:center;"  src="[% interface %]/[% theme %]/img/koha.org-logo.gif"/></h1>
26
</div>
27
<!--Create a patron screen 2-->
28
[% IF op == 'add_validate' %]
29
        <!--New patron created-->
30
        <form name="patrondone" method="post" action="onboarding.pl">
31
            <input type="hidden" name="step" value="4"/>
32
            <h1 align="left"> New Patron </h1>
33
            <div>   
34
                 <p> Success: New patron created!</p>
35
                 <p> To create another patron, go to Patrons > New Patron. <br>
36
                More > Set Permissions in a user page to gain superlibrarian permissions.
37
                </div>
38
                 Next up:
39
                 <input type="submit" name="start" value="Add an item type"/>
40
        </form>
41
       <!--Implement a if statement to check if the patron was successfully created
42
                <div>
43
                    <p> Oh no! Patron was not created</p>
44
                </div>-->
45
[% ELSE %]    
46
<!--Create a patron screen 1-->
47
       <h1 align="left"> Create a new Patron </h2>
48
        <form name="createpatron" method="post" action="onboarding.pl">
49
            <fieldset class="rows">
50
                 <input type="hidden" name="step" value="3"/>
51
                 <input type="hidden" name="op" value="add_validate" />
52
                    <ol>
53
                    <h3>Patron Identity</h3> 
54
                        <li>
55
                            <label for="surname" class="required">Surname: </label>
56
57
                            <input type="text" style="text-transform:capitalize" id="surname" name="surname"  value="[% surname %]" class="required" required="required" />
58
                            <span class="required">Required</span>
59
                        </li>
60
                        <li>
61
                            <label for="firstname" class="required">First Name: </label>
62
                            <input style= "text-transform:capitalize;" type="text" name="firstname" id="firstname" size="20" value="[% firstname |html %]" class="required" required="required">
63
                            <span class="required">Required</span>
64
                        </li>
65
                    </ol>
66
                    
67
                    <legend id="library_management_lgd">Library Management</legend>
68
                    <ol>
69
                        <li>
70
                            <label for="cardnumber" class="required">Card Number: </label>
71
                            <input type="number" min="1" id="cardnumber" name="cardnumber" maxlength="20" value="[% borrower.cardnumber | html %]" class="required">
72
                            <span class="required">Required</span>
73
                        </li>
74
                        <li>
75
                       <!--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-->
76
                            <label for="libraries" class="required"> Library: </label>
77
                            <select name="libraries" size="1" id="libraries">
78
79
                             [% FOREACH library IN libraries %]
80
                                  <option name="libraries" value="[% library.branchcode %]"> [% library.branchname %]
81
                             [% END %]
82
                                    
83
                                </select>
84
                            <span class="required"> Required</span>
85
                        </li>
86
                        <li>
87
                            <label for="categorycode_entry" class="required"> Patron Category</label>
88
                            <select id="categorycode_entry" name="categorycode_entry" onchange="update_category_code(this);">
89
                           [% FOREACH category IN categories %] 
90
                                <option name="categorycode_entry" value = "[% category.categorycode %]"> [%category.description %]</option>
91
                           [% END %]
92
                            </select>
93
                            <span class="required">Required</span>
94
                        </li> 
95
                    </ol>
96
                    
97
                    <ol>
98
                    
99
                            <h3> Patron permissions</h3>
100
                            <input type="hidden" name="newflags" value="1"/>
101
                            <li>
102
                                <input type="hidden" class="flag parent" id="flag-0" name="flag" value="superlibrarian"/>
103
                                <label name="permissioncode" for="flag-0"> superlibrarian</label>
104
                            </li>                    
105
                    </ol>
106
                    <ol>
107
                    <h3>OPAC/Staff Login</h3> 
108
                        <li>
109
                            <label for="userid" class="required">Username: </label>
110
                            <input type="text" name="userid" id ="userid" size="20" value="[% userid %]" class="required" required="required" />
111
                            <span class="required">Required</span>
112
                        </li>
113
                        <li>
114
                            <label for="passwordlabel" class="required">Password: </label>
115
                            <input type="password" name="password" id="password" size="20" value="[% member.password |html %]" class="required" required="required">
116
                            <span class="required">Required</span>
117
                        </li>
118
                        <li>
119
                            <label for="password2" class="required">Confirm password: </label>
120
                            <input type="password" id="password2" name="password2" size="20" value="" class="required" required="required">
121
                            <span class="required">Required</span>
122
                        </li>
123
                    </ol>
124
             </fieldset><br>
125
                <input type="submit" class="action" value="Submit"/>
126
     </form>
127
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep4.tt (+94 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
    h no! Patron was not created</p>
24
25
        <h3 align="left">You do not need to create a item type as you have already installed the sample item type data previously</h3>
26
     <form name="skipitemtype" method="post" action="onboarding.pl">
27
          <input type="hidden" name="step" value="5"/>
28
          <div>
29
            <input type="submit" name="start" value="Add a circulation rule"/>
30
          </div>
31
      </form>
32
      
33
34
<!--Create a item type screen 2-->
35
[% ELSIF op == "add_validate" %]
36
        <!--New item type created-->
37
        [% IF message != "error_on_insert" %]
38
            <form name="createitemtype" method="post" action="onboarding.pl">
39
                <input type="hidden" name="step" value="5"/>
40
                <h1 align="left"> New Item type </h1>
41
42
                <div>   
43
                    <p> Success: New item type created!</p>
44
                    <p> To create another item type later and for more setttings <br>
45
                    go to More->Administration->Item types 
46
                </div>
47
                     Next up:
48
                    <input type="submit" value="Add a circulation rule"/>
49
            </form>
50
        [% ELSE %]
51
            <form name="retryitem" method="post" action="onboarding.pl">
52
                <input type="hidden" name="step" value="4"/>
53
                <h1 align="left">Failed </h1>
54
                <div>
55
                    <p>Item type was not successfully created. </br>
56
                    Please try again or contact your system administrator. </p>
57
                    </div>
58
            </form> 
59
          <!--Implement a if statement to check if the item type was successfully created or not
60
-->     [% END %]
61
[% ELSE %]    
62
<!--Create a item type screen 1-->
63
       <h1 align="left"> Create a new Item type </h2>
64
        <form name="createitemform" method="post" action="onboarding.pl">
65
            <fieldset class="rows">
66
                 <input type="hidden" name="step" value="4"/>
67
                 <input type="hidden" name="op" value="add_validate" />
68
                    <ol>
69
                        <li>
70
                            <label for="itemtype" class="required">Item type code: </label>
71
                            <input type="text" style="text-transform:uppercase;" name="itemtype" id="itemtype" size="10" maxlength="10"  class="required" required="required" />
72
                            <span class="required">Required</span>
73
                        </li>
74
                        <li>
75
                            <label for="description" class="required">Description: </label>
76
                            <input type="text" style="text-transform:capitalize;" name="description" id="description" size="42" value="[% itemtype.description |html %]" class="required" required="required">
77
                            <span class="required">Required</span>
78
                        </li>
79
                    </ol>
80
            </fieldset><br>
81
                <input type="submit" class="action" value="Submit"/>
82
     </form>
83
[% END %]        
84
85
86
87
88
89
90
91
92
93
94
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep5.tt (+145 lines)
Line 0 Link Here
1
<!--Includes for creating circulation rule--> 
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 Circulation rule</title>
9
10
<!--jQuery scripts for creating circulation rule-->
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 (finish) %]
22
<h1>Congratulations you have finished and ready to use Koha</h1>
23
<a href="/cgi-bin/koha/mainpage.pl">Start using Koha</a>
24
25
[% END %]
26
27
<!--Create a circulation rule screen 2-->
28
[% IF op == "add_validate" %]
29
        <!--New circulation rule created-->
30
        <form name="finish" method="post" action="onboarding.pl">
31
              <input type="hidden" name="op" value="finish" />
32
33
            <h1 align="left"> New Circulation rule </h1>
34
35
            <div>   
36
                 <p> Success: New circulation rule created!</p>
37
                 <p> To create circulation rule, go to <br>
38
                 More->Administration->Circulation and Fine Rules 
39
            </div>
40
                 Next up:
41
                 <input type="submit" name="op" value="Finish"/>
42
        </form>
43
           <!-- <div>
44
                  <p> Oh no! Circulation Rule was not created</p>
45
            </div> -->
46
47
48
[% ELSE %]    
49
<!--Create a circulation rule screen 1-->
50
       <h1 align="left"> Create a new Circulation rule </h2>
51
  
52
       <form name="createcirculationrule" method="post" action="onboarding.pl">
53
            <fieldset class="rows">
54
                 <input type="hidden" name="step" value="5"/>
55
                 <input type="hidden" name="op" value="add_validate" />
56
                    <ol>
57
                    <li>
58
                             <label for="categorycode" class="required">Patron Category: </label>
59
                             <select name="categorycode" id="categorycode" required="required" onchange = "update_categorycode(this);">
60
                               <!-- <option name="categorycode" value="All">All-->
61
                             [% FOREACH category IN categories %]
62
                                <option name="categorycode" value = "[% category.categorycode %]"> [%category.description %]</option> 
63
                            [%END%]
64
                             </select>
65
                        <span class="required">Required</span>
66
                    </li>
67
68
                    <li>
69
                        <label for="itemtype"> Item type: </label>
70
                        <select id="itemtype" name="itemtype" required="required">
71
                            [% FOREACH item IN itemtypes %]
72
                                <option name="itemtype" value = "[% item.itemtype %]"> [% item.itemtype %]
73
                            [%END%]
74
                            </select>
75
                            <span class="required"> Required</span>
76
                        </li>
77
78
                        <li>
79
                            <label for="maxissueqty" class="required">Current checkouts allowed: </label>
80
                            <input type="number" min="0" name="maxissueqty" id="maxissueqty" size="10" maxlength="10" value="" class="required" required="required" />
81
                            <span class="required">Required</span>
82
                        </li>
83
                        
84
                        <li>
85
                             <label for="issuelength" class="required">Loan Period: </label>
86
                             <input type="number" min="0" name="issuelength" id="issuelength" size="10" maxlength="10" value="" class="required" required="required" />
87
                              <span class="required">Required</span>
88
                        </li>
89
90
                        <li>
91
                            <label for="lengthunit">Units: </label>
92
                            <select name="lengthunit" id="lengthunit" required="required">
93
                                   [% SET units = 'days' %]
94
95
                                   [% IF category %] <!--Check  if category is the correct value name in the context of units of days that a loan period is for in the item borrowing script-->
96
                                   [% SET default_privacy = category.default_privacy %]
97
                                   [% END %]
98
99
                                   [% SWITCH units %]
100
                                   [% CASE 'days' %]
101
                                     <option value="days" selected="selected">Days</option>
102
                                     <option value="hours">Hours</option>
103
                                   [% CASE 'hours' %]
104
                                     <option value="days">Days</option>
105
                                     <option value="hours" selected="selected">Hours</option>
106
                                   [% END %]
107
                            </select>
108
                        </li>
109
110
                        <li>
111
                             <label for="renewalsallowed" class="required">Renewals Allowed: </label>
112
                             <input type="number"min="0" name="renewalsallowed" id="renewalsallowed" size="10" maxlength="10" value="" class="required" required="required" />
113
                              <span class="required">Required</span>
114
                        </li>
115
116
                         <li>
117
                             <label for="renewalperiod" class="required">Renewals Period: </label>
118
                             <input type="number" min="0"name="renewalperiod" id="renewalperiod" size="10" maxlength="10" value="" class="required" required="required" />
119
                              <span class="required">Required</span>
120
                        </li>
121
122
                         <li>
123
                            <label for="onshelfholds">On shelf holds allowed: </label>
124
                            <select name="onshelfholds" id="onshelfholds" required="required">
125
                                     <option value="yes" selected="selected">Yes</option>
126
                                     <option value="anyunavailable">If any unavailable</option>
127
                                    <option value="allunavailable">If all unavailable</option>
128
                            </select>
129
                        </li>
130
                    </ol>
131
            </fieldset><br>
132
                <input type="submit" class="action" value="Submit"/> 
133
     </form>
134
[% END %]        
135
136
137
138
139
140
141
142
143
144
145
(-)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