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

(-)a/installer/install.pl (-12 / +5 lines)
Lines 296-304 elsif ( $step && $step == 3 ) { Link Here
296
        $template->param( "levelloop"      => $levellist );
296
        $template->param( "levelloop"      => $levellist );
297
        $template->param( "$op"            => 1 );
297
        $template->param( "$op"            => 1 );
298
298
299
        my $setup = $query->param('setup');
300
        $template->param( "setup" => $setup );
301
302
    }
299
    }
303
    elsif ( $op && $op eq 'choosemarc' ) {
300
    elsif ( $op && $op eq 'choosemarc' ) {
304
        #
301
        #
Lines 343-358 elsif ( $step && $step == 3 ) { Link Here
343
        my $marcflavour = C4::Context->preference("marcflavour");
340
        my $marcflavour = C4::Context->preference("marcflavour");
344
        my @flavourlist;
341
        my @flavourlist;
345
        foreach my $marc (@listdir) {
342
        foreach my $marc (@listdir) {
346
            my %cell = (
343
             my %cell=(
347
                "label"   => ucfirst($marc),
344
                 "label"=> ucfirst($marc),
348
                "code"    => uc($marc),
345
                  "code"=>uc($marc),
349
                "checked" => defined($marcflavour)
346
               "checked"=> defined($marcflavour) ? uc($marc) eq $marcflavour : 0);
350
                ? uc($marc) eq $marcflavour
351
                : 0
352
            );
353
354
#             $cell{"description"}= do { local $/ = undef; open INPUT "<$dir/$marc.txt"||"";<INPUT> };
347
#             $cell{"description"}= do { local $/ = undef; open INPUT "<$dir/$marc.txt"||"";<INPUT> };
355
            push @flavourlist, \%cell;
348
             push @flavourlist, \%cell;
356
        }
349
        }
357
        $template->param( "flavourloop" => \@flavourlist );
350
        $template->param( "flavourloop" => \@flavourlist );
358
        $template->param( "$op"         => 1 );
351
        $template->param( "$op"         => 1 );
(-)a/installer/onboarding.pl (-456 / +182 lines)
Lines 17-25 Link Here
17
# You should have received a copy of the GNU General Public License
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>.
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
19
20
#Recommended pragmas
21
use Modern::Perl;
20
use Modern::Perl;
22
use diagnostics;
21
use C4::Context;
23
use C4::InstallAuth;
22
use C4::InstallAuth;
24
use CGI qw ( -utf8 );
23
use CGI qw ( -utf8 );
25
use C4::Output;
24
use C4::Output;
Lines 36-195 use Koha::IssuingRules; Link Here
36
35
37
#Setting variables
36
#Setting variables
38
my $input = new CGI;
37
my $input = new CGI;
39
my $step  = $input->param('step');
40
38
41
#Getting the appropriate template to display to the user
39
unless ( C4::Context->preference('Version') ) {
42
my ( $template, $loggedinuser, $cookie ) =
40
    print $input->redirect("/cgi-bin/koha/installer/install.pl");
43
  C4::InstallAuth::get_template_and_user(
41
    exit;
44
    {
42
}
45
        template_name => "/onboarding/onboardingstep"
46
          . ( $step ? $step : 1 ) . ".tt",
47
        query           => $input,
48
        type            => "intranet",
49
        authnotrequired => 0,
50
        debug           => 1,
51
    }
52
  );
53
54
#Check database connection
55
my %info;
56
$info{'dbname'} = C4::Context->config("database");
57
$info{'dbms'}   = (
58
      C4::Context->config("db_scheme")
59
    ? C4::Context->config("db_scheme")
60
    : "mysql"
61
);
62
43
63
$info{'hostname'} = C4::Context->config("hostname");
44
my ( $user, $cookie, $sessionID, $flags ) =
64
$info{'port'}     = C4::Context->config("port");
45
  C4::InstallAuth::checkauth( $input, 0, undef, 'intranet' );
65
$info{'user'}     = C4::Context->config("user");
46
die "Not logged in"
66
$info{'password'} = C4::Context->config("pass");
47
  unless $user
67
my $dbh = DBI->connect(
48
  ; # Should not happen, we should be redirect if the user is not logged in. But do not trust authentication...
68
    "DBI:$info{dbms}:dbname=$info{dbname};host=$info{hostname}"
69
      . ( $info{port} ? ";port=$info{port}" : "" ),
70
    $info{'user'}, $info{'password'}
71
);
72
49
73
#Store the value of the template input name='op' in the variable $op so we can check if the user has pressed the button with the name="op" and value="finish" meaning the user has finished the onboarding tool.
50
my $step = $input->param('step') || 1;
74
my $op = $input->param('op') || '';
51
my $op   = $input->param('op')   || '';
75
$template->param( 'op' => $op );
52
53
my $template_params = {};
54
$template_params->{op} = $op;
76
55
77
my $schema = Koha::Database->new()->schema();
56
my $schema = Koha::Database->new()->schema();
78
57
79
if ( $op && $op eq 'finish' )
58
my @messages;
80
{ #If the value of $op equals 'finish' then redirect user to /cgi-bin/koha/mainpage.pl
81
    print $input->redirect("/cgi-bin/koha/mainpage.pl");
82
    exit;
83
}
84
59
85
my $libraries = Koha::Libraries->search( {}, { order_by => ['branchcode'] }, );
60
if ( $step == 1 ) {
86
$template->param(
87
     libraries   => $libraries,
88
     group_types => [
89
     {
90
            categorytype => 'searchdomain',
91
            categories   => [
92
               Koha::LibraryCategories->search(
93
                   { categorytype => 'searchdomain' }
94
               )
95
            ],
96
     },
97
     {
98
            categorytype => 'properties',
99
            categories   => [
100
               Koha::LibraryCategories->search(
101
                   { categorytype => 'properties' }
102
               )
103
            ],
104
     },
105
     ]
106
);
107
61
62
    if ( $op eq 'add_validate_library' ) {
108
63
109
#Select all the patron category records in the categories database table and give them to the template
64
        my $branchcode = $input->param('branchcode');
110
    my $categories = Koha::Patron::Categories->search();
65
        $branchcode = uc($branchcode);
111
    $template->param( 'categories' => $categories, );
112
113
#Check if the $step variable equals 1 i.e. the user has clicked to create a library in the create library screen 1
114
    my $itemtypes = Koha::ItemTypes->search();
115
    $template->param( 'itemtypes' => $itemtypes, );
116
117
if ( $step && $step == 1 ) {
118
    #store inputted parameters in variables
119
    my $branchcode = $input->param('branchcode');
120
    $branchcode = uc($branchcode);
121
    my $categorycode = $input->param('categorycode');
122
    my $op = $input->param('op') || 'list';
123
    my $message;
124
    my $library;
125
126
    #Take the text 'branchname' and store it in the @fields array
127
    my @fields = qw(
128
      branchname
129
    );
130
131
    $template->param( 'branchcode' => $branchcode );
132
    $branchcode =~ s|\s||g
133
      ; # Use a regular expression to check the value of the inputted branchcode
134
135
#Create a new library object and store the branchcode and @fields array values in this new library object
136
    $library = Koha::Library->new(
137
        {
138
            branchcode => $branchcode,
139
            ( map { $_ => scalar $input->param($_) || undef } @fields )
140
        }
141
    );
142
66
143
    eval { $library->store; }; #Use the eval{} function to store the library object
67
        $branchcode =~ s|\s||g
144
    if ($library) {
68
          ; # Use a regular expression to check the value of the inputted branchcode
145
        $message = 'success_on_insert';
69
146
    }
70
        my $library = Koha::Library->new(
147
    else {
71
            {
148
        $message = 'error_on_insert';
72
                branchcode => $branchcode,
73
                branchname => scalar $input->param('branchname'),
74
            }
75
        );
76
77
        eval { $library->store; };
78
        unless ($@) {
79
            push @messages,
80
              { type => 'message', code => 'success_on_insert_library' };
81
        }
82
        else {
83
            push @messages,
84
              { type => 'message', code => 'error_on_insert_library' };
85
        }
149
    }
86
    }
150
    $template->param( 'message' => $message );
151
87
152
#Check if the $step variable equals 2 i.e. the user has clicked to create a patron category in the create patron category screen 1
88
    $step++ if Koha::Libraries->count;
153
}
89
}
154
elsif ( $step && $step == 2 ) {
90
if ( $step == 2 ) {
155
    if ($op eq "add_validate_category"){
91
    if ( $op eq "add_validate_category" ) {
156
        #Initialising values
92
157
        my $searchfield  = $input->param('description') // q||;
93
        my $searchfield = $input->param('description') // q||;
158
        my $categorycode = $input->param('categorycode');
94
        my $categorycode = $input->param('categorycode');
159
        my $op           = $input->param('op') // 'list';
160
        my $message;
161
        my $category;
95
        my $category;
162
        $template->param( 'categorycode' => $categorycode );
96
        $template_params->{categorycode} = $categorycode;
163
97
164
        my ( $template, $loggedinuser, $cookie ) =
165
            C4::InstallAuth::get_template_and_user(
166
            {
167
                template_name   => "/onboarding/onboardingstep2.tt",
168
                query           => $input,
169
                type            => "intranet",
170
                authnotrequired => 0,
171
                flagsrequired =>
172
                { parameters => 'parameters_remaining_permissions' },
173
                debug => 1,
174
            }
175
            );
176
177
        #Once the user submits the page, this code validates the input and adds it
178
        #to the database as a new patron category
179
        $categorycode = $input->param('categorycode');
98
        $categorycode = $input->param('categorycode');
180
        my $description           = $input->param('description');
99
        my $description           = $input->param('description');
181
        my $overduenoticerequired = $input->param('overduenoticerequired');
100
        my $overduenoticerequired = $input->param('overduenoticerequired');
182
        my $category_type         = $input->param('category_type');
101
        my $category_type         = $input->param('category_type');
183
        my $default_privacy       = $input->param('default_privacy');
102
        my $default_privacy       = $input->param('default_privacy');
184
        my $enrolmentperiod       = $input->param('enrolmentperiod');
103
        my $enrolmentperiod       = $input->param('enrolmentperiod');
185
        my $enrolmentperioddate   = $input->param('enrolmentperioddate') || undef;
104
        my $enrolmentperioddate = $input->param('enrolmentperioddate') || undef;
186
105
187
        #Converts the string into a date format
106
        #Converts the string into a date format
188
        if ($enrolmentperioddate) {
107
        if ($enrolmentperioddate) {
189
            $enrolmentperioddate = output_pref(
108
            $enrolmentperioddate = output_pref(
190
                {
109
                {
191
                    dt         => dt_from_string($enrolmentperioddate),
110
                    dt         => dt_from_string($enrolmentperioddate),
192
                    dateformat => 'iso',
111
                    dateformat => 'DateTime',
193
                    dateonly   => 1,
112
                    dateonly   => 1,
194
                }
113
                }
195
            );
114
            );
Lines 204-439 elsif ( $step && $step == 2 ) { Link Here
204
                category_type         => $category_type,
123
                category_type         => $category_type,
205
                default_privacy       => $default_privacy,
124
                default_privacy       => $default_privacy,
206
                enrolmentperiod       => $enrolmentperiod,
125
                enrolmentperiod       => $enrolmentperiod,
207
                enrolmentperioddate   => $enrolmentperioddate,
126
                enrolmentperioddate   => $enrolmentperioddate
208
            }
127
            }
209
        );
128
        );
210
129
211
        eval { $category->store; };
130
        eval { $category->store; };
212
131
213
        #Error messages
132
        unless ($@) {
214
        if ($category) {
133
            push @messages,
215
            $message = 'success_on_insert';
134
              { type => 'message', code => 'success_on_insert_category' };
216
        }
135
        }
217
        else {
136
        else {
218
            $message = 'error_on_insert';
137
            push @messages,
138
              { type => 'message', code => 'error_on_insert_category' };
219
        }
139
        }
220
221
        $template->param( 'message' => $message );
222
    }
140
    }
223
    #Create a patron
224
}
225
elsif ( $step && $step == 3 ) {
226
    my $firstpassword  = $input->param('password') || '';
227
    my $secondpassword = $input->param('password2') || '';
228
229
141
230
    #Find all patron records in the database and hand them to the template
142
    $step++ if Koha::Patron::Categories->count;
231
    my %currentpatrons = Koha::Patrons->search();
143
}
232
    my $currentpatrons = values %currentpatrons;
144
if ( $step == 3 ) {
233
    $template->param( 'patrons' =>$currentpatrons);
145
    if ( $op eq 'add_validate_patron' ) {
234
146
235
147
        #Create a patron
236
#Find all library records in the database and hand them to the template to display in the library dropdown box
148
        my $firstpassword  = $input->param('password')  || '';
237
    my $libraries =
149
        my $secondpassword = $input->param('password2') || '';
238
      Koha::Libraries->search( {}, { order_by => ['branchcode'] }, );
150
        my $cardnumber     = $input->param('cardnumber');
239
    $template->param(
151
        my $userid         = $input->param('userid');
240
        libraries   => $libraries,
152
241
        group_types => [
153
        if ( my $error_code = checkcardnumber($cardnumber) ) {
242
            {
154
            if ( $error_code == 1 ) {
243
                categorytype => 'searchdomain',
155
                push @messages,
244
                categories   => [
156
                  {
245
                    Koha::LibraryCategories->search(
157
                    type => 'alert',
246
                        { categorytype => 'searchdomain' }
158
                    code => 'ERROR_cardnumber_already_exists'
247
                    )
159
                  };
248
                ],
249
            },
250
            {
251
                categorytype => 'properties',
252
                categories   => [
253
                    Koha::LibraryCategories->search(
254
                        { categorytype => 'properties' }
255
                    )
256
                ],
257
            },
258
        ]
259
    );
260
261
#Find all patron categories in the database and hand them to the template to display in the patron category dropdown box
262
    my $categories = Koha::Patron::Categories->search();
263
    $template->param( 'categories' => $categories, );
264
265
#Incrementing the highest existing patron cardnumber to prevent duplicate cardnumber entry
266
267
    my $existing_cardnumber = $schema->resultset('Borrower')->get_column('cardnumber')->max() // 0;
268
269
    my $new_cardnumber = $existing_cardnumber + 1;
270
    $template->param( "newcardnumber" => $new_cardnumber );
271
272
    my $op = $input->param('op') // 'list';
273
    my $minpw = C4::Context->preference("minPasswordLength");
274
    $template->param( "minPasswordLength" => $minpw );
275
    my @messages;
276
    my @errors;
277
    my $nok            = $input->param('nok');
278
    my $cardnumber     = $input->param('cardnumber');
279
    my $borrowernumber = $input->param('borrowernumber');
280
    my $userid         = $input->param('userid');
281
282
    # function to designate mandatory fields (visually with css)
283
    my $check_BorrowerMandatoryField =
284
      C4::Context->preference("BorrowerMandatoryField");
285
    my @field_check = split( /\|/, $check_BorrowerMandatoryField );
286
    foreach (@field_check) {
287
        $template->param( "mandatory$_" => 1 );
288
        $template->param(
289
            BorrowerMandatoryField =>
290
              C4::Context->preference("BorrowerMandatoryField")
291
            ,    #field to test with javascript
292
        );
293
    }
294
295
 #If the entered cardnumber causes an error hand this error to the @errors array
296
    if ( my $error_code = checkcardnumber( $cardnumber, $borrowernumber ) ) {
297
        push @errors,
298
            $error_code == 1 ? 'ERROR_cardnumber_already_exists'
299
          : $error_code == 2 ? 'ERROR_cardnumber_length'
300
          :                    ();
301
    }
302
303
   #If the entered password causes an error hand this error to the @errors array
304
    push @errors, "ERROR_password_mismatch"
305
      if $firstpassword ne $secondpassword;
306
    push @errors, "ERROR_short_password"
307
      if ( $firstpassword
308
        && $minpw
309
        && $firstpassword ne '****'
310
        && ( length($firstpassword) < $minpw ) );
311
312
    #Passing errors to template
313
    $nok = $nok || scalar(@errors);
314
315
#If errors have been generated from the users inputted cardnumber or password then display the error and do not insert the patron into the borrowers table
316
    if ($nok) {
317
        foreach my $error (@errors) {
318
            if ( $error eq 'ERROR_password_mismatch' ) {
319
                $template->param( errorpasswordmismatch => 1 );
320
            }
321
            if ( $error eq 'ERROR_login_exist' ) {
322
                $template->param( errorloginexists => 1 );
323
            }
324
            if ( $error eq 'ERROR_cardnumber_already_exists' ) {
325
                $template->param( errorcardnumberexists => 1 );
326
            }
327
            if ( $error eq 'ERROR_cardnumber_length' ) {
328
                $template->param( errorcardnumberlength => 1 );
329
            }
160
            }
330
            if ( $error eq 'ERROR_short_password' ) {
161
            elsif ( $error_code == 2 ) {
331
                $template->param( errorshortpassword => 1 );
162
                push @messages,
163
                  { type => 'alert', code => 'ERROR_cardnumber_length' };
332
            }
164
            }
333
        }
165
        }
334
        $template->param( 'nok' => 1 );
166
        elsif ( $firstpassword ne $secondpassword ) {
335
167
336
#Else if no errors have been caused by the users inputted card number or password then insert the patron into the borrowers table
168
            push @messages,
337
    }
169
              { type => 'alert', code => 'ERROR_password_mismatch' };
338
    else {
170
        }
339
        my ( $template, $loggedinuser, $cookie ) =
171
        else {
340
          C4::InstallAuth::get_template_and_user(
341
            {
342
                template_name   => "/onboarding/onboardingstep3.tt",
343
                query           => $input,
344
                type            => "intranet",
345
                authnotrequired => 0,
346
                flagsrequired   => { borrowers => 1 },
347
                debug           => 1,
348
            }
349
          );
350
351
        if ( $op eq 'add_validate' ) {
352
            my %newdata;
353
354
            #Store the template form values in the newdata hash
355
            $newdata{borrowernumber} = $input->param('borrowernumber');
356
            $newdata{surname}        = $input->param('surname');
357
            $newdata{firstname}      = $input->param('firstname');
358
            $newdata{cardnumber}     = $input->param('cardnumber');
359
            $newdata{branchcode}     = $input->param('libraries');
360
            $newdata{categorycode}   = $input->param('categorycode_entry');
361
            $newdata{userid}         = $input->param('userid');
362
            $newdata{password}       = $input->param('password');
363
            $newdata{password2}      = $input->param('password2');
364
            $newdata{privacy}        = "default";
365
            $newdata{address}        = "";
366
            $newdata{city}           = "";
367
368
#Hand tne the dateexpiry of the patron based on the patron category it is created from
369
            my $patron_category = Koha::Patron::Categories->find( $newdata{categorycode} );
370
            $newdata{dateexpiry} = $patron_category->get_expiry_date( $newdata{dateenrolled} );
371
372
#Hand the newdata hash to the AddMember subroutine in the C4::Members module and it creates a patron and hands back a borrowernumber which is being stored
373
            my $borrowernumber = &AddMember(%newdata);
374
375
#Create a hash named member2 and fill it with the borrowernumber of the borrower that has just been created
376
            my %member2;
377
            $member2{'borrowernumber'} = $borrowernumber;
378
379
#Perform data validation on the flag that has been handed to onboarding.pl by the template
380
            my $flag = $input->param('flag');
381
            if ( $input->param('newflags') ) {
382
                my $dbh              = C4::Context->dbh();
383
                my @perms            = $input->multi_param('flag');
384
                my %all_module_perms = ();
385
                my %sub_perms        = ();
386
                foreach my $perm (@perms) {
387
                    if ( $perm !~ /:/ ) {
388
                        $all_module_perms{$perm} = 1;
389
                    }
390
                    else {
391
                        my ( $module, $sub_perm ) = split /:/, $perm, 2;
392
                        push @{ $sub_perms{$module} }, $sub_perm;
393
                    }
394
                }
395
396
                # construct flags
397
                my @userflags = $schema->resultset('Userflag')->search({},{
398
                        order_by => { -asc =>'bit'},
399
                        }
400
                );
401
402
#Setting superlibrarian permissions for new patron
403
                my $flags = Koha::Patrons->find($borrowernumber)->set({flags=>1})->store;
404
172
405
                #Error handling checking if the patron was created successfully
173
            my $patron_data = {
406
                if ( !$borrowernumber ) {
174
                surname      => scalar $input->param('surname'),
407
                    push @messages,
175
                firstname    => scalar $input->param('firstname'),
408
                      { type => 'error', code => 'error_on_insert' };
176
                cardnumber   => scalar $input->param('cardnumber'),
409
                }
177
                branchcode   => scalar $input->param('libraries'),
410
                else {
178
                categorycode => scalar $input->param('categorycode_entry'),
411
                    push @messages,
179
                userid       => scalar $input->param('userid'),
412
                      { type => 'message', code => 'success_on_insert' };
180
                password     => scalar $input->param('password'),
413
                }
181
                password2    => scalar $input->param('password2'),
182
                privacy      => "default",
183
                address      => "",
184
                city         => "",
185
                flags => 1,    # Will be superlibrarian
186
            };
187
188
            my $patron_category =
189
              Koha::Patron::Categories->find( $patron_data->{categorycode} );
190
            $patron_data->{dateexpiry} =
191
              $patron_category->get_expiry_date( $patron_data->{dateenrolled} );
192
193
            my $borrowernumber = C4::Members::AddMember(%$patron_data);
194
195
            #Error handling checking if the patron was created successfully
196
            if ($borrowernumber) {
197
                push @messages,
198
                  { type => 'message', code => 'success_on_insert_patron' };
199
            }
200
            else {
201
                push @messages,
202
                  { type => 'error', code => 'error_on_insert_patron' };
414
            }
203
            }
415
        }
204
        }
416
    }
205
    }
206
207
    $step++ if Koha::Patrons->search( { flags => 1 } )->count;
417
}
208
}
418
elsif ( $step && $step == 4 ) {
209
if ( $step == 4 ) {
419
    my ( $template, $borrowernumber, $cookie ) =
210
    if ( $op eq 'add_validate_itemtype' ) {
420
      C4::InstallAuth::get_template_and_user(
421
        {
422
            template_name   => "/onboarding/onboardingstep4.tt",
423
            query           => $input,
424
            type            => "intranet",
425
            authnotrequired => 0,
426
            flagsrequired =>
427
              { parameters => 'parameters_remaining_permissions' },
428
            debug => 1,
429
        }
430
    );
431
  if ($op eq "add_validate"){
432
        my $description   = $input->param('description');
211
        my $description   = $input->param('description');
433
        my $itemtype_code = $input->param('itemtype');
212
        my $itemtype_code = $input->param('itemtype');
434
        $itemtype_code = uc($itemtype_code);
213
        $itemtype_code = uc($itemtype_code);
435
214
436
  #Create a new itemtype object using the user inputted itemtype and description
437
        my $itemtype = Koha::ItemType->new(
215
        my $itemtype = Koha::ItemType->new(
438
            {
216
            {
439
                itemtype    => $itemtype_code,
217
                itemtype    => $itemtype_code,
Lines 441-533 elsif ( $step && $step == 4 ) { Link Here
441
            }
219
            }
442
        );
220
        );
443
        eval { $itemtype->store; };
221
        eval { $itemtype->store; };
444
        my $message;
445
222
446
#Fill the $message variable with an error if the item type object was not successfully created and inserted into the itemtypes table
223
        unless ($@) {
447
        if ($itemtype) {
224
            push @messages,
448
            $message = 'success_on_insert';
225
              { type => 'message', code => 'success_on_insert_itemtype' };
449
        }
226
        }
450
        else {
227
        else {
451
            $message = 'error_on_insert';
228
            push @messages,
229
              { type => 'message', code => 'error_on_insert_itemtype' };
452
        }
230
        }
453
        $template->param( 'message' => $message );
454
    }
231
    }
232
233
    $step++ if Koha::ItemTypes->count;
455
}
234
}
456
elsif ( $step && $step == 5 ) {
235
if ( $step == 5 ) {
457
236
458
  #Find all the existing categories to display in a dropdown box in the template
237
    if ( $op eq 'add_validate_circ_rule' ) {
459
    my $categories;
238
460
    $categories = Koha::Patron::Categories->search();
239
        #If no libraries exist then set the $branch value to *
461
    $template->param( categories => $categories, );
240
        my $branch = $input->param('branch') || '*';
462
463
 #Find all the exisiting item types to display in a dropdown box in the template
464
    my $itemtypes;
465
    $itemtypes = Koha::ItemTypes->search();
466
    $template->param( itemtypes => $itemtypes, );
467
468
  #Find all the exisiting libraries to display in a dropdown box in the template
469
    my $libraries =
470
      Koha::Libraries->search( {}, { order_by => ['branchcode'] }, );
471
    $template->param(
472
        libraries   => $libraries,
473
        group_types => [
474
            {
475
                categorytype => 'searchdomain',
476
                categories   => [
477
                    Koha::LibraryCategories->search(
478
                        { categorytype => 'searchdomain' }
479
                    )
480
                ],
481
            },
482
            {
483
                categorytype => 'properties',
484
                categories   => [
485
                    Koha::LibraryCategories->search(
486
                        { categorytype => 'properties' }
487
                    )
488
                ],
489
            },
490
        ]
491
    );
492
493
    my $input = CGI->new;
494
    my $dbh   = C4::Context->dbh;
495
496
    my ( $template, $loggedinuser, $cookie ) =
497
      C4::InstallAuth::get_template_and_user(
498
        {
499
            template_name   => "/onboarding/onboardingstep5.tt",
500
            query           => $input,
501
            type            => "intranet",
502
            authnotrequired => 0,
503
            flagsrequired   => { parameters => 'manage_circ_rules' },
504
            debug           => 1,
505
        }
506
      );
507
508
    #If no libraries exist then set the $branch value to *
509
    my $branch = $input->param('branch');
510
    unless ($branch) {
511
        if ( C4::Context->preference('DefaultToLoggedInLibraryCircRules') ) {
512
            $branch =
513
              Koha::Libraries->search->count() == 1
514
              ? undef
515
              : C4::Context::mybranch();
516
        }
517
        else {
518
            $branch =
519
              C4::Context::only_my_library()
520
              ? ( C4::Context::mybranch() || '*' )
521
              : '*';
522
        }
523
    }
524
    $branch = '*' if $branch eq 'NO_LIBRARY_SET';
525
    my $op = $input->param('op') || q{};
526
241
527
    if ( $op eq 'add_validate' ) {
528
        my $type            = $input->param('type');
242
        my $type            = $input->param('type');
529
        my $br              = $input->param('branch');
243
        my $branchcode      = $input->param('branch');
530
        my $bor             = $input->param('categorycode');
244
        my $categorycode    = $input->param('categorycode');
531
        my $itemtype        = $input->param('itemtype');
245
        my $itemtype        = $input->param('itemtype');
532
        my $maxissueqty     = $input->param('maxissueqty');
246
        my $maxissueqty     = $input->param('maxissueqty');
533
        my $issuelength     = $input->param('issuelength');
247
        my $issuelength     = $input->param('issuelength');
Lines 540-547 elsif ( $step && $step == 5 ) { Link Here
540
        $issuelength = $issuelength eq q{} ? undef : $issuelength;
254
        $issuelength = $issuelength eq q{} ? undef : $issuelength;
541
255
542
        my $params = {
256
        my $params = {
543
            branchcode      => $br,
257
            branchcode      => $branchcode,
544
            categorycode    => $bor,
258
            categorycode    => $categorycode,
545
            itemtype        => $itemtype,
259
            itemtype        => $itemtype,
546
            maxissueqty     => $maxissueqty,
260
            maxissueqty     => $maxissueqty,
547
            renewalsallowed => $renewalsallowed,
261
            renewalsallowed => $renewalsallowed,
Lines 551-603 elsif ( $step && $step == 5 ) { Link Here
551
            onshelfholds    => $onshelfholds,
265
            onshelfholds    => $onshelfholds,
552
        };
266
        };
553
267
554
        my @messages;
268
        my $issuingrule = Koha::IssuingRule->new($params);
269
        eval { $issuingrule->store; };
555
270
556
#Allows for the 'All' option to work when selecting all libraries for a circulation rule to apply to.
271
        unless ($@) {
557
        if ( $branch eq "*" ) {
272
            push @messages,
558
            my $search_default_rules = $schema->resultset('DefaultCircRule')->count();
273
              { type => 'message', code => 'success_on_insert_circ_rule' };
559
            my $insert_default_rules = $schema->resultset('Issuingrule')->new(
560
                    { maxissueqty => $maxissueqty, onshelfholds => $onshelfholds }
561
                );
562
        }
274
        }
563
#Allows for the 'All' option to work when selecting all patron categories for a circulation rule to apply to.
275
        else {
564
        elsif ( $bor eq "*" ) {
276
            push @messages,
565
277
              { type => 'message', code => 'error_on_insert_circ_rule' };
566
            my $search_default_rules = $schema->resultset('DefaultCircRule')->count();
567
            my $insert_default_rules = $schema->resultset('Issuingrule')->new(
568
                        { maxissueqty => $maxissueqty}
569
            );
570
        }
278
        }
279
    }
571
280
572
#Allows for the 'All' option to work when selecting all itemtypes for a circulation rule to apply to
281
    $step++ if Koha::IssuingRules->count;
573
        elsif ( $itemtype eq "*" ) {
282
}
574
            my $search_default_rules = $schema->resultset('DefaultCircRule')->search({},{
575
                    branchcode => $branch
576
                    }
577
283
578
            );
284
my $libraries = Koha::Libraries->search( {}, { order_by => ['branchcode'] }, );
285
$template_params->{libraries}   = $libraries;
286
$template_params->{group_types} = [
287
    {
288
        categorytype => 'searchdomain',
289
        categories   => [
290
            Koha::LibraryCategories->search(
291
                { categorytype => 'searchdomain' }
292
            )
293
        ],
294
    },
295
    {
296
        categorytype => 'properties',
297
        categories   => [
298
            Koha::LibraryCategories->search( { categorytype => 'properties' } )
299
        ],
300
    },
301
];
302
303
if ( $step > 5 ) {
304
    $template_params->{all_done} = 1;    # If step 5 is complete, we are done!
305
    $step = 5;
306
}
579
307
580
            my $insert_default_rules = $schema->resultset('Issuingrule')->new(
308
#Getting the appropriate template to display to the user
581
                           { branchcode => $branch, onshelfholds => $onshelfholds }
309
my ( $template, $loggedinuser );
582
            );
310
( $template, $loggedinuser, $cookie ) = C4::InstallAuth::get_template_and_user(
583
        }
311
    {
312
        template_name   => "onboarding/onboardingstep${step}.tt",
313
        query           => $input,
314
        type            => "intranet",
315
        authnotrequired => 0,
316
        debug           => 1,
317
    }
318
);
584
319
585
        my $issuingrule = Koha::IssuingRules->find(
320
$template_params->{messages} = \@messages;
586
            { categorycode => $bor, itemtype => $itemtype, branchcode => $br }
321
my $categories = Koha::Patron::Categories->search();
587
        );
322
$template_params->{categories} = $categories;
588
        if ($issuingrule) {
589
            $issuingrule->set($params)->store();
590
            push @messages,
591
              {
592
                type => 'error',
593
                code => 'error_on_insert'
594
              }; #Stops crash of the onboarding tool if someone makes a circulation rule with the same item type, library and patron categroy as an exisiting circulation rule.
595
323
596
        }
324
my $itemtypes = Koha::ItemTypes->search();
597
        else {
325
$template_params->{itemtypes} = $itemtypes;
598
            Koha::IssuingRule->new()->set($params)->store();
326
599
        }
327
$template->param(%$template_params);
600
    }
601
}
602
328
603
output_html_with_http_headers $input, $cookie, $template->output;
329
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/koha-tmpl/intranet-tmpl/prog/css/installer.css (+229 lines)
Line 0 Link Here
1
body {
2
    background-color: #EEE;
3
    text-align: left;
4
    font-family: arial, verdana, helvetica, sans-serif;
5
}
6
7
h1 {
8
    font-size: 161.6%;
9
    font-weight: bold;
10
}
11
12
h2 {
13
    background-color: #eee;
14
    border-radius: 4px;
15
    font-size: 146.5%;
16
    font-weight: bold;
17
    text-shadow: 1px 1px 0px #FFF;
18
    padding: .5em;
19
}
20
21
h3 {
22
    color: #003366;
23
    font-size: 131%;
24
    font-weight: bold;
25
}
26
27
hr {
28
    margin-top: .5em;
29
    margin-bottom: .5em;
30
}
31
32
.installer-main {
33
    background-color: #FFF;
34
    border-radius: 5px;
35
    margin-top: 3%;
36
    margin-bottom: 3%;
37
    padding: 1em;
38
    -webkit-box-shadow: 0px 2px 2px 0px rgba(50, 50, 50, 0.5);
39
    -moz-box-shadow:    0px 2px 2px 0px rgba(50, 50, 50, 0.5);
40
    box-shadow:         0px 2px 2px 0px rgba(50, 50, 50, 0.5);
41
}
42
43
ul, ol { padding: 5px 5px 5px 20px; }
44
45
#logo {
46
    background: url(../img/koha-logo.gif) no-repeat top center;
47
    margin-top: 0;
48
    margin-bottom: .5em;
49
}
50
51
#logo a {
52
    display: block;
53
    text-indent: -1000px;
54
    height: 74px;
55
    border-bottom: none;
56
}
57
58
.bg-danger {
59
    padding: .2em .4em;
60
}
61
62
.step a, .step input { font-size: 2em; }
63
64
td input { font-size: 1.5em; }
65
66
.step, th { text-align: right; }
67
68
#bloc25, .bloc25 {
69
        float:left;
70
        border:1px solid #000000;
71
        margin:0px;
72
        padding:0px;
73
74
}
75
76
#footer {
77
        text-align: center;
78
        border-top: 1px solid #ccc;
79
        padding-top: 1em;
80
        font-style: italic;
81
}
82
83
.update_error {
84
        color: red;
85
        font-weight: bold;
86
}
87
88
.checkbox {
89
    margin-bottom: 1em;
90
}
91
92
fieldset.rows {
93
    border-width: 0;
94
    float: left;
95
    font-size: 90%;
96
    clear: left;
97
    margin: .9em 0 0 0;
98
    padding: 0;
99
    width: 100%;
100
}
101
102
fieldset.rows legend {
103
    border: 0;
104
    margin-left: 1em;
105
    font-weight: bold;
106
    font-size: 110%;
107
    margin-bottom: 0;
108
}
109
110
fieldset.rows label,
111
fieldset.rows span.label {
112
    float: left;
113
    font-weight: bold;
114
    width: 9em;
115
    margin-right: 1em;
116
    text-align: right;
117
}
118
119
fieldset.rows span.label {
120
    display: inline;
121
    padding: .2em .6em .3em;
122
    font-size: inherit;
123
    font-weight: bold;
124
    line-height: 1;
125
    color: inherit;
126
    text-align: right;
127
    white-space: normal;
128
    vertical-align: baseline;
129
    border-radius: 0;
130
}
131
132
fieldset.rows fieldset {
133
    background-color: transparent;
134
    border-width: 1px;
135
    margin: 1em;
136
    padding: .3em;
137
}
138
139
fieldset.rows ol {
140
    padding: 1em 1em 0 1em;
141
    list-style-type: none;
142
}
143
144
fieldset.rows li {
145
    float: left;
146
    clear: left;
147
    padding-bottom: 1em;
148
    list-style-type: none;
149
    width: 100%;
150
}
151
152
fieldset.rows .hint {
153
    margin-left: 10.5em;
154
    margin-right: 4em;
155
    margin-top: .5em;
156
    font-size: 96%;
157
    color: #666;
158
}
159
160
fieldset.rows label.error {
161
    color: #cc0000;
162
    float: none;
163
    margin-left: 1em;
164
    width: auto;
165
}
166
167
fieldset.rows ol {
168
    padding: 0 1em 0 1em;
169
}
170
171
172
label.required,
173
span.required {
174
    color : #C00;
175
}
176
177
span.required {
178
    font-style : italic;
179
    margin-left : .5em;
180
}
181
182
.breadcrumbs {
183
    background-color: #e6f0f2;
184
    margin: 1em 0;
185
    padding: .4em 2em;
186
}
187
188
/* Override core jQueryUI widgets */
189
.ui-widget-content { border: 1px solid #B9D8D9; background: #ffffff none; color: #222222; }
190
.ui-widget-header { border: 1px solid #B9D8D9; background: #E6F0F2 none; color: #222222; font-weight: bold; }
191
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #B9D8D9; background: #F4F8F9 none; font-weight: normal; color: #555555; }
192
.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #B9D8D9; background: #E6F0F2 none; font-weight: normal; color: #212121; }
193
.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa; background: #ffffff none; font-weight: normal; color: #212121; }
194
.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight  {border: 1px solid #FED22F; background: #FFF4C6; color: #363636; }
195
.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec; color: #cd0a0a; }
196
197
.ui-widget,
198
.ui-widget input,
199
.ui-widget select,
200
.ui-widget textarea,
201
.ui-widget button {
202
    font-family : inherit;
203
    font-size : inherit;
204
}
205
206
/* jQuery UI Datepicker */
207
.ui-datepicker table {
208
    width: 100%;
209
    font-size: .9em;
210
    border : 0;
211
    border-collapse: collapse;
212
    margin:0 0 .4em;
213
}
214
215
.ui-datepicker th {
216
    background : transparent none;
217
    padding: .7em .3em;
218
    text-align: center;
219
    font-weight: bold;
220
    border: 0;
221
}
222
223
.ui-datepicker-trigger {
224
    vertical-align: middle;
225
    margin : 0 3px;
226
}
227
.ui-datepicker {
228
    box-shadow: 1px 1px 3px 0 #666;
229
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/installer-doc-head-close.inc (-78 / +14 lines)
Lines 2-93 Link Here
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" />
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" />
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" />
5
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/installer.css" />
6
<link rel="stylesheet" type="text/css" media="print" href="[% interface %]/[% theme %]/css/print.css" />
7
<style type="text/css" media="screen">
8
9
[% IF ( login ) %]
10
    @import url([% interface %]/[% theme %]/css/login.css);
11
[% END %]
12
13
html { background: #eee; }
14
15
body {
16
        background: #fff;
17
        color: #000;
18
        font-family: Georgia, "Times New Roman", Times, serif;
19
        margin-left: 20%;
20
        margin-right: 20%;
21
        padding: .2em 2em;
22
}
23
24
h1 {
25
        color: #006;
26
        font-size: 2em;
27
        font-weight: normal;
28
        vertical-align:middle;
29
}
30
31
h2 { font-size: 1.75em; }
32
33
h3 {
34
        color: #006;
35
        font-size: 1.5em;
36
        font-weight: lighter;
37
}
38
39
p, li, dt {
40
        line-height: 140%;
41
        padding-bottom: 2px;
42
}
43
44
ul, ol { padding: 5px 5px 5px 20px; }
45
46
#logo { margin-bottom: 2em; }
47
48
.step a, .step input { font-size: 2em; }
49
50
td input { font-size: 1.5em; }
51
52
.step, th { text-align: right; }
53
54
#bloc25, .bloc25 {
55
        float:left;
56
        border:1px solid #000000;
57
        margin:0px;
58
        padding:0px;
59
60
}
61
62
#footer {
63
        text-align: center;
64
        border-top: 1px solid #ccc;
65
        padding-top: 1em;
66
        font-style: italic;
67
}
68
69
.update_error {
70
        color: red;
71
        font-weight: bold;
72
}
73
74
</style>
75
6
76
<script type="text/javascript" src="[% interface %]/lib/jquery/jquery-2.2.3.min.js"></script>
7
<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>
8
<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>
9
<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>
10
<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>
11
<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
87
<script type="text/javascript">
12
<script type="text/javascript">
88
    //<![CDATA[
13
    //<![CDATA[
89
        function _(s) { return s } // dummy function for gettext
14
        function _(s) { return s } // dummy function for gettext
90
    //]]>
15
    //]]>
91
</script>
16
</script>
92
</head>
17
93
<body id="installer" class="installer">
18
[%# Prevent XFS attacks -%]
19
<script type="text/javascript">
20
$(document).ready(function() {
21
   if (self === top) {
22
       var antiClickjack = document.getElementById("antiClickjack");
23
       antiClickjack.parentNode.removeChild(antiClickjack);
24
   } else {
25
       top.location = self.location;
26
   }
27
});
28
</script>
29
<style id="antiClickjack">body{display:none !important;}</style>
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/installer-strings.inc (+7 lines)
Line 0 Link Here
1
<script type="text/javascript">
2
    var MSG_LETTERS_ONLY=(_("Please only enter letters."));
3
    var MSG_PASSWORD_MISMATCH=(_("The entered passwords do not match"));
4
    var MSG_ONE_ENROLLMENTPERIOD =(_("Please choose an enrollment period in months OR by date."));
5
    var MSG_ONLY_ONE_ENROLLMENTPERIOD=(_("Please only choose one enrollment period."));
6
    var MSG_LETTERS_NUMBERS_ONLY=(_("Please only enter letters or numbers."));
7
</script>
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/onboarding_messages.inc (+20 lines)
Line 0 Link Here
1
[% FOR m IN messages %]
2
    <div class="dialog [% m.type %]">
3
        [% SWITCH m.code %]
4
        [% CASE 'success_on_insert_library' %]<span>Library created!</span>
5
        [% CASE 'error_on_insert_library' %]<span>Library already exists and cannot be modified!</span>
6
        [% CASE 'success_on_insert_category' %]<span>Patron category created!</span>
7
        [% CASE 'error_on_insert_category' %]<span>Patron category already exists and cannot be modified!</span>
8
        [% CASE 'success_on_insert_patron' %]<span>Administrator Patron created!</span>
9
        [% CASE 'error_on_insert_patron' %]<span>The patron has not been created! Cardnumber or Userid may already exist.</span>
10
        [% CASE 'ERROR_cardnumber_already_exists' %]<span>Cardnumber already in use.</span>
11
        [% CASE 'ERROR_cardnumber_length' %]<span>Cardnumber length is incorrect.</span>
12
        [% CASE 'ERROR_password_mismatch' %]<span>Passwords do not match.</span>
13
        [% CASE 'success_on_insert_itemtype' %]<span>New item type created!</span>
14
        [% CASE 'error_on_insert_itemtype' %]<span>Item type already exists!</span>
15
        [% CASE 'success_on_insert_circ_rule' %]<span>Circulation rule created!</span>
16
        [% CASE 'error_on_insert_circ_rule' %]<span>Circulation rule not created!</span>
17
        [% CASE %][% message %]
18
        [% END %]
19
    </div>
20
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/installer/auth.tt (-41 / +52 lines)
Lines 1-52 Link Here
1
[% USE Koha %]
1
[% USE Koha %]
2
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
3
<title>Koha &rsaquo; 
3
<title>Koha &rsaquo;
4
    [% IF ( nopermission ) %]Access denied[% END %]
4
    [% IF ( nopermission ) %]Access denied[% END %]
5
    [% IF ( timed_out ) %]Session timed out[% END %]
5
    [% IF ( timed_out ) %]Session timed out[% END %]
6
    [% IF ( different_ip ) %]IP address change[% END %]
6
    [% IF ( different_ip ) %]IP address change[% END %]
7
    [% IF ( invalid_username_or_password ) %]Invalid username or password[% END %]
7
    [% IF ( invalid_username_or_password ) %]Invalid username or password[% END %]
8
    [% IF ( loginprompt ) %]Log in to Koha[% END %]
8
    [% IF ( loginprompt ) %]Log in to the Koha web installer[% END %]
9
</title>
9
</title>
10
10
11
[% INCLUDE 'installer-doc-head-close.inc' %]
11
[% INCLUDE 'installer-doc-head-close.inc' %]
12
<div id="login">
13
<h1><a>Koha [%- Koha.Version.release -%] installer</a></h1>
14
[% IF ( nopermission ) %]
15
<div id="login_error"><strong>Error: </strong>Unauthorized user <a href="/cgi-bin/koha/mainpage.pl?logout.x=1">click to log out</a></div>
16
[% END %]
17
18
[% IF ( timed_out ) %]
19
<div id="login_error"><strong>Error: </strong>Session timed out, please log in again</div>
20
[% END %]
21
22
[% IF ( different_ip ) %]
23
<div id="login_error"><strong>Error: </strong>IP address has changed, please log in again </div>
24
[% END %]
25
26
[% IF ( invalid_username_or_password ) %]
27
<div id="login_error"><strong>Error: </strong>Invalid username or password</div>
28
[% END %]
29
30
[% IF ( loginprompt ) %]
31
<!-- login prompt time-->
32
<form action="/cgi-bin/koha/installer/install.pl" method="post" name="mainform" id="mainform">
33
[% FOREACH INPUT IN INPUTS %]
34
    <input type="hidden" name="[% INPUT.name |html %]" value="[% INPUT.value |html %]" />
35
[% END %]
36
<h3>Welcome to the Koha web installer</h3>
37
<p>Before we begin, please verify you have the correct credentials to continue. Please log in
38
with the username and password given to you by your systems administrator and located in your
39
<code>koha-conf.xml</code> configuration file.</p>
40
<p>Please enter your username and password:</p>
41
<p><label>Username:<br />
42
<input type="text" name="userid" id="userid" class="input" value="[% userid %]" size="20" tabindex="1" /></label>
43
</p>
44
<p><label>Password:<br />
45
<input type="password" name="password" id="password" class="input" value="" size="20" tabindex="2" /></label>
46
</p>
47
<p class="submit"><input id="submit" type="submit" value="Login" tabindex="4" /></p>
48
</form>
49
50
[% END %]
51
12
13
<div class="container-fluid">
14
    <div class="row">
15
        <div id="installer-login" class="installer-main col-sm-6 col-sm-offset-3 col-md-6 col-md-offset-3">
16
17
            <h1 id="logo"><a href="#">Koha</a></h1>
18
19
            [% IF ( nopermission ) %]
20
                <div id="login_error"><strong>Error: </strong>Unauthorized user <a href="/cgi-bin/koha/mainpage.pl?logout.x=1">click to log out</a></div>
21
            [% END %]
22
23
            [% IF ( timed_out ) %]
24
            <div id="login_error"><strong>Error: </strong>Session timed out, please log in again</div>
25
            [% END %]
26
27
            [% IF ( different_ip ) %]
28
            <div id="login_error"><strong>Error: </strong>IP address has changed, please log in again </div>
29
            [% END %]
30
31
            [% IF ( invalid_username_or_password ) %]
32
            <div id="login_error"><strong>Error: </strong>Invalid username or password</div>
33
            [% END %]
34
35
            [% IF ( loginprompt ) %]
36
                <h2>Welcome to the Koha [%- Koha.Version.release -%] web installer</h2>
37
38
                <p>Before we begin, please verify you have the correct credentials to continue. Please log in with the username and password given to you by your systems administrator and located in your <code>koha-conf.xml</code> configuration file.</p>
39
40
                <form action="[% url %]" method="post" role="form" id="mainform">
41
                    [% FOREACH INPUT IN INPUTS %]
42
                        <input type="hidden" name="[% INPUT.name |html %]" value="[% INPUT.value |html %]" />
43
                    [% END %]
44
45
                    <fieldset>
46
                        <legend>Please enter your username and password</legend>
47
48
                        <div class="form-group">
49
                            <label>Username:</label>
50
                            <input type="text" class="form-control" name="userid" id="userid" value="[% userid %]" size="20" tabindex="1" />
51
                        </div>
52
                        <div class="form-group">
53
                            <label>Password:</label>
54
                            <input type="password" class="form-control" name="password" id="password" value="" size="20" tabindex="2" />
55
                        </div>
56
                        <input id="submit" type="submit" class="btn btn-primary" value="Log in" tabindex="3" /></p>
57
                    </fieldset>
58
                </form>
59
            [% END %]
60
        </div>
61
    </div>
62
</div>
52
[% INCLUDE 'intranet-bottom.inc' %]
63
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step1.tt (-76 / +92 lines)
Lines 1-82 Link Here
1
[% INCLUDE 'doc-head-open.inc' %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Web installer &rsaquo; Step 1</title>
2
<title>Koha &rsaquo; Web installer &rsaquo;
3
[% INCLUDE 'installer-doc-head-close.inc' %]
3
    [% UNLESS ( language ) %] Choose your language [% END %]
4
<div>
4
    [% IF ( language ) %]
5
<h1 id="logo"><img alt="Koha" src="[% interface %]/[% theme %]/img/koha.org-logo.gif" /> Web installer &rsaquo; Step 1</h1>
5
        [% UNLESS ( checkmodule ) %]
6
[% UNLESS ( language ) %]
6
            [% IF ( missing_modules ) %]
7
<p>You are about to install Koha.</p>
7
                Perl modules missing
8
9
<p>Please pick your language from the following list. If your language is not
10
listed, please inform your systems administrator.</p>
11
<form name="language" method="post">
12
<select name="language">
13
[% IF ( installer_languages_loop ) %]
14
        [% FOREACH installer_languages_loo IN installer_languages_loop %]
15
            [% IF ( installer_languages_loo.plural ) %]
16
            <optgroup label="[% installer_languages_loo.language %]">
17
            [% FOREACH sublanguages_loo IN installer_languages_loo.sublanguages_loop %]
18
                <option value="[% sublanguages_loo.rfc4646_subtag %]">[% IF ( sublanguages_loo.native_description ) %][% sublanguages_loo.native_description %][% ELSE %][% sublanguages_loo.rfc4646_subtag %][% END %]</option>
19
            [% END %]
8
            [% END %]
20
            </optgroup>
9
            [% IF ( problems ) %]
21
            [% ELSE %]
10
                Perl version obsolete
22
		<option value="[% installer_languages_loo.rfc4646_subtag %]">[% IF ( installer_languages_loo.native_description ) %][% installer_languages_loo.native_description %][% ELSE %][% installer_languages_loo.rfc4646_subtag %][% END %]</option>
23
            [% END %]
11
            [% END %]
24
        [% END %]
12
        [% END %]
25
[% END %]
13
        Check Perl dependencies
26
</select>
27
</p>
28
29
<p> Click 'Next' to continue <input value="Next &gt;&gt;" type="submit" /></p>
30
</form>
31
[% END %]
32
[% IF ( language ) %]
33
  [% IF ( checkmodule ) %]
34
  <p>All required Perl modules appear to be installed.<br />
35
  [% ELSE %]
36
  [% IF ( missing_modules ) %]
37
  <p><b>Warning: </b>Some Perl modules are missing.<br />Modules in red must be installed before you may continue.<br />
38
  <ul>
39
  [% FOREACH missing_module IN missing_modules %]
40
    [% IF ( missing_module.require ) %]
41
    <li style="color:#FF0000;font-weight:bold;">[% missing_module.name %]
42
    [% ELSE %]
43
    <li>[% missing_module.name %]
44
    [% END %]
14
    [% END %]
45
      <br /> Version: [% missing_module.version %]
15
</title>
46
      <br /> Usage: [% missing_module.usage %]
16
[% INCLUDE 'installer-doc-head-close.inc' %]
47
    </li>
17
48
  [% END %]
18
<div class="container-fluid">
49
  [% END %]
19
    <div class="row">
50
  [% IF ( problems ) %]
20
        <div id="installer-step1" class="installer-main col-sm-8 col-sm-offset-2 col-md-8 col-md-offset-2">
51
  <p>I encountered some problems.</p>
21
52
   <ul>
22
            <h1 id="logo"><a href="#">Koha</a></h1>
53
    [% IF ( perlversion ) %]
23
54
    <li>Your Perl version seems to be obsolete.
24
            [% UNLESS ( language ) %]
55
      Please upgrade to a newer version of Perl (at least Version 5.10).</li>
25
                <h2>Web installer &rsaquo; Choose your language</h2>
56
    [% END %]
26
                <p>You are about to install Koha.</p>
57
   </ul>
27
58
  [% END %]
28
                <p>Please pick your language from the following list. If your language is not listed, please inform your system administrator.</p>
59
  [% END %]
29
60
<form name="checkmodules" action="install.pl">
30
                <form name="language" role="form" method="post" action="install.pl">
61
[% IF ( checkmodule ) %]
31
                    <div class="form-group">
62
[% IF (op == 'noop') %]
32
                        <label for="language">Select a language: </label>
63
<input type="hidden" name="step" value="2" />
33
                        <select id="language" name="language">
64
[% ELSE %]
34
                            [% IF ( installer_languages_loop ) %]
65
<input type="hidden" name="step" value="3" />
35
                                [% FOREACH installer_languages_loo IN installer_languages_loop %]
66
<input type="hidden" name="op" value="[% op %]" />
36
                                    [% IF ( installer_languages_loo.plural ) %]
67
<input type="hidden" name="checkmodule" value="[% checkmodule %]"/>
37
                                        <optgroup label="[% installer_languages_loo.language %]">
68
[% END %]
38
                                            [% FOREACH sublanguages_loo IN installer_languages_loo.sublanguages_loop %]
69
<p> All dependencies installed.</p>
39
                                                <option value="[% sublanguages_loo.rfc4646_subtag %]">[% IF ( sublanguages_loo.native_description ) %][% sublanguages_loo.native_description %][% ELSE %][% sublanguages_loo.rfc4646_subtag %][% END %]</option>
70
<p>Please click 'Next' to continue <input value="Next &gt;&gt;" type="submit" /></p>
40
                                            [% END %]
71
[% ELSE %]
41
                                        </optgroup>
72
[% IF (op == 'noop') %]
42
                                    [% ELSE %]
73
<input type="hidden" name="step" value="1" />
43
                                        <option value="[% installer_languages_loo.rfc4646_subtag %]">[% IF ( installer_languages_loo.native_description ) %][% installer_languages_loo.native_description %][% ELSE %][% installer_languages_loo.rfc4646_subtag %][% END %]</option>
74
[% ELSE %]
44
                                    [% END %]
75
<input type="hidden" name="step" value="1" />
45
                                [% END %]
76
<input type="hidden" name="op" value="[% op %]" />
46
                            [% END %]
77
[% END %]
47
                        </select>
78
<p>Click to recheck dependencies <input value="Recheck" type="submit" /></p>
48
                    </div>
79
[% END %]
49
80
</form>
50
                    <p><input value="Continue to the next step" class="btn btn-primary" type="submit" /></p>
81
[% END %]
51
                </form>
52
            [% END %]
53
54
            [% IF ( language ) %]
55
                [% UNLESS ( checkmodule ) %]
56
                    [% IF ( missing_modules ) %]
57
                        <h2>Web installer &rsaquo; Perl modules missing</h2>
58
                        <p>Some Perl modules are missing. <span class="label label-danger">Required</span> modules <b>must</b> be installed before you may continue.<br />
59
                        <ul>
60
                            [% FOREACH missing_module IN missing_modules %]
61
                                <li><strong>[% missing_module.name %]</strong> [% IF ( missing_module.require ) %]<span class="label label-danger">Required</span>[% END %]
62
                                    <br /> Version: [% missing_module.version %]
63
                                    <br /> Usage: [% missing_module.usage %]
64
                                </li>
65
                            [% END %]
66
                        </ul>
67
                    [% END %]
68
69
                    [% IF ( problems ) %]
70
                        <h2>Web installer &rsaquo; Perl version too old</h2>
71
                        <p>I encountered some problems.</p>
72
                        <ul>
73
                            [% IF ( perlversion ) %]
74
                                <li>Your Perl version is out of date. Please upgrade to a newer version of Perl (at least version 5.10).</li>
75
                            [% END %]
76
                        </ul>
77
                    [% END %]
78
79
                    <form name="checkmodules" role="form" action="install.pl">
80
                        <input type="hidden" name="step" value="1" />
81
                        <p> <input value="Recheck dependencies" class="btn btn-primary" type="submit" /></p>
82
                    </form>
83
84
                [% ELSE # IF checkmodule %]
85
                    <h2>Web installer &rsaquo; Check Perl dependencies</h2>
86
                    <p>All required Perl modules appear to be installed.</p>
87
                    <p> All dependencies installed.</p>
88
89
                    <form name="checkmodules" role="form" action="install.pl">
90
                        <input type="hidden" name="step" value="2" />
91
                        <p> <input value="Continue to the next step" class="btn btn-primary" type="submit" /> </p>
92
                    </form>
93
                [% END # IF checkmodule%]
94
            [% END # IF language %]
95
        </div>
96
    </div>
97
82
[% INCLUDE 'intranet-bottom.inc' %]
98
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step2.tt (-61 / +68 lines)
Lines 1-63 Link Here
1
[% INCLUDE 'doc-head-open.inc' %]<title>Koha &rsaquo; Web installer &rsaquo; Step 2</title>
1
[% INCLUDE 'doc-head-open.inc' %]<title>Koha &rsaquo; Web installer &rsaquo; Database settings</title>
2
[% INCLUDE 'installer-doc-head-close.inc' %]
2
[% INCLUDE 'installer-doc-head-close.inc' %]
3
<div>
3
4
<h1 id="logo"><img alt="Koha" src="[% interface %]/[% theme %]/img/koha.org-logo.gif" /> Web installer &rsaquo; Step 2</h1>
4
<div class="container-fluid">
5
<h2 align="center">Database settings:</h2>
5
    <div class="row">
6
<ul>
6
        <div id="installer-step2" class="installer-main col-sm-8 col-sm-offset-2 col-md-8 col-md-offset-2">
7
<li><em>database type : </em>[% dbms %]</li>
7
8
<li><em>database name : </em>[% dbname %]</li>
8
            <h1 id="logo"><a href="#">Koha</a></h1>
9
<li><em>database host : </em>[% hostname %]</li>
9
            <h2>Web installer &rsaquo; Database settings</h2>
10
<li><em>database port : </em>[% port %] (probably OK if blank)</li>
10
            <h3>Database settings:</h3>
11
<li><em>database user : </em>[% user %]</li>
11
            <ul>
12
</ul>
12
                <li><em>Database type : </em> <code>[% dbms %]</code></li>
13
<div>
13
                <li><em>Database name : </em> <code>[% dbname %]</code></li>
14
[% IF ( dbconnection ) %]
14
                <li><em>Database host : </em> <code>[% hostname %]</code></li>
15
<form name="checkdbparameters" type="post" action="install.pl">
15
                <li><em>Database port : </em> <code>[% port %]</code> (probably okay if blank)</li>
16
  [% IF ( checkdatabaseaccess ) %]
16
                <li><em>Database user : </em> <code>[% user %]</code></li>
17
  <p>Connection established.</p>
17
            </ul>
18
     [% IF ( checkdatabasecreated ) %]
18
19
  <p>Database <code>[% dbname %]</code> exists.</p>
19
            [% IF ( dbconnection ) %]
20
        [% IF ( checkgrantaccess ) %]
20
                <form name="checkdbparameters" role="form" type="post" action="install.pl">
21
  <p>User <code>[% user %]</code> has all required privileges on database <code>[% dbname %]</code>.</p>
21
                    [% IF ( checkdatabaseaccess ) %]
22
        [% ELSE %]
22
                        <div class="alert alert-success" role="alert"><p>Connection established.</p></div>
23
  <p class="error">user <code>[% user %]</code> doesn't have enough privilege on database <code>[% dbname %]</code></p>
23
                        [% IF ( checkdatabasecreated ) %]
24
  <p class="tip">Ask for or make a change in the user's privileges. Need help? See
24
                            <ul>
25
    [% IF dbms == 'mysql' %]<a href="https://dev.mysql.com/doc/refman/5.5/en/grant.html">
25
                                <li>Database <code>[% dbname %]</code> exists.</li>
26
    [% ELSE %]<a href="http://www.postgresql.org/docs/8.2/interactive/sql-createrole.html">
26
                            [% IF ( checkgrantaccess ) %]
27
    [% END %]this page</a>.
27
                                <li>User <code>[% user %]</code> has all required privileges on database <code>[% dbname %]</code>.</li>
28
  </p>
28
                                </ul>
29
  <p class="tip">
29
                            [% ELSE %]
30
    User <code>[% user %]</code> must have USAGE, INSERT, UPDATE, DELETE, DROP and CREATE privileges on <code>[% dbname %]</code>
30
                                </ul>
31
  </p>
31
                                <p class="error">user <code>[% user %]</code> doesn't have enough privilege on database <code>[% dbname %]</code> </p>
32
        [% END %]
32
                                <p class="tip"> Ask for or make a change in the user's privileges. Need help? See [% IF ( mysql ) %]
33
      [% ELSE %]
33
                                        <a href="http://dev.mysql.com/doc/refman/4.1/en/grant.html">
34
  <p class="error">No database named <code>[% dbname %]</code> detected.</p>
34
                                    [% ELSE %]
35
  <p class="tip">Please create the database before continuing.</p>
35
                                        <a href="http://www.postgresql.org/docs/8.2/interactive/sql-createrole.html">
36
      [% END %]
36
                                    [% END %]
37
   [% ELSE %]
37
                                    this page</a>. User <code>[% user %]</code> must have USAGE, INSERT, UPDATE, DELETE, DROP and CREATE privileges on <code>[% dbname %]</code>
38
    <div class="error">[% error %] : [% message %]
38
                                </p>
39
                            [% END %]
40
                        [% ELSE %]
41
                            <div class="alert alert-danger" role="alert"><p>No database named <code>[% dbname %]</code> detected.</p></div>
42
                            <p>Please create the database before continuing.</p>
43
                        [% END %]
44
                    [% ELSE %]
45
                        <div class="alert alert-warning" role="alert">[% error %] : [% message %]</div>
46
                        <div class="tip">
47
                            <ul>
48
                                <li>Check that your database is running.</li>
49
                                <li>Check your database settings in <code>koha-conf.xml</code>. </li>
50
                                <li>Check the hostname setting in <code>koha-conf.xml</code>.
51
                                Some database servers require <code>127.0.0.1</code> rather than <code>localhost</code>.</li>
52
                            </ul>
53
                        </div>
54
                        <p>Please correct these errors and <a href="/cgi-bin/koha/installer/install.pl">start the installer</a> again.
55
                    [% END %]
56
                    [% UNLESS ( error ) %]
57
                        <input type="hidden" name="step" value="3" />
58
                        <p> <input value="Continue to the next step" class="btn btn-primary" type="submit" /> </p>
59
                    [% END %]
60
                </form>
61
            [% ELSE %]
62
                <form name="checkinformation" role="form" type="post" action="install.pl">
63
                    <input type="hidden" name="step" value="2" />
64
                    <input type="hidden" name="checkdb" value="1" />
65
                    <p> <input value="Continue to the next step" class="btn btn-primary" type="submit" /> </p>
66
                </form>
67
            [% END %]
68
        </div>
39
    </div>
69
    </div>
40
    <div class="tip">
70
[% INCLUDE 'intranet-bottom.inc' %]
41
      <ul>
42
      <li>Check that your database is running.</li>
43
      <li>Check your database settings in <code>koha-conf.xml</code>. </li>
44
      <li>Check the hostname setting in <code>koha-conf.xml</code>. 
45
      Some database servers require <code>127.0.0.1</code> rather than <code>localhost</code>.</li>
46
    </div>
47
    <p>Please correct these errors and <a href="/cgi-bin/koha/installer/install.pl">start the installer</a> again.
48
  [% END %]
49
  [% IF ( error ) %][% ELSE %]
50
<input type="hidden" name="step" value="3" />
51
<p> Click 'Next' to continue <input value="Next &gt;&gt;" type="submit" /></p>
52
[% END %]
53
</form>
54
[% ELSE %]
55
<form name="checkinformation" type="post" action="install.pl">
56
<input type="hidden" name="step" value="2" />
57
<input type="hidden" name="checkdb" value="1" />
58
<p> Please click 'Next' to continue if this information is correct <input value="Next &gt;&gt;" type="submit" /></p>
59
</form>
60
[% END %]
61
</div>
62
</body>
63
</html>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step3.tt (-231 / +200 lines)
Lines 1-218 Link Here
1
[% INCLUDE 'doc-head-open.inc' %]<title>Koha &rsaquo; Web installer &rsaquo; Step 3</title>
1
[% INCLUDE 'doc-head-open.inc' %]
2
[% IF ( finish ) %]<meta http-equiv="refresh" content="10; url=/cgi-bin/koha/installer/onboarding.pl">[% END %]
2
<title>Koha &rsaquo; Web installer &rsaquo;
3
    [% IF ( proposeimport ) %]
4
        Set up database
5
    [% END %]
6
    [% IF ( importdatastructure ) %]
7
        [% IF ( error ) %]
8
            Error creating database tables
9
        [% ELSE %]
10
            Database tables created
11
        [% END %]
12
    [% END %]
13
    [% IF ( default ) %]
14
        [% IF ( upgrading ) %]
15
            Update database
16
        [% ELSE %]
17
            Install basic configuration settings
18
        [% END %]
19
    [% END %]
20
    [% IF ( choosemarc ) %]
21
        Select your MARC flavor
22
    [% END %]
23
    [% IF ( selectframeworks ) %]
24
        Selecting default settings
25
    [% END %]
26
</title>
27
[% IF ( finish ) %]<meta http-equiv="refresh" content="5; url=/cgi-bin/koha/installer/onboarding.pl">[% END %]
3
[% INCLUDE 'installer-doc-head-close.inc' %]
28
[% INCLUDE 'installer-doc-head-close.inc' %]
4
<div>
5
<h1 id="logo"><img alt="Koha" src="[% interface %]/[% theme %]/img/koha.org-logo.gif" /> Koha web  installer &rsaquo; Step 3</h1>
6
7
[% IF ( selectframeworks ) %]
8
    <script type="text/javascript">
9
//<![CDATA[
10
11
var surl = unescape(window.location.pathname);
12
29
13
function doLoad()
30
<div class="container-fluid">
14
{
31
    <div class="row">
15
    // the timeout value should be the same as in the "refresh" meta-tag
32
        <div id="installer-step3" class="installer-main col-sm-8 col-sm-offset-2 col-md-8 col-md-offset-2">
16
    setTimeout( "refresh()", 2*1000 );
17
}
18
33
19
function refresh(value)
34
            <h1 id="logo"><a href="#">Koha</a></h1>
20
{
21
    //  The argument to the location.reload function determines
22
    //  if the browser should retrieve the document from the
23
    //  web-server.  In our example all we need to do is cause
24
    //  the JavaScript block in the document body to be
25
    //  re-evaluated.  If we needed to pull the document from
26
    //  the web-server again (such as where the document contents
27
    //  change dynamically) we would pass the argument as 'true'.
28
    //
29
    surl=surl+'?step=3&op=selectframeworks&fwklanguage='+value;
30
35
31
    window.location.replace( surl );
36
            [% IF ( finish ) %]
32
}
37
                <h2>Web installer &rsaquo; Installation complete</h2>
33
38
                <h3>Congratulations, installation complete</h3>
34
function selectAllFrameworks()
39
                <p>
35
{
40
                    If this page does not redirect in 5 seconds, <a href="/cgi-bin/koha/installer/onboarding.pl">Start onboarding process</a>.
36
    //  A handy short link that selects all available checkboxes
41
                </p>
37
    //  on the page.
42
            [% END %]
38
    //
39
    var checkboxes = document.getElementsByTagName("input");
40
    for (var i = 0; i < checkboxes.length; i++)
41
    {
42
        if (checkboxes[i].type == 'checkbox')
43
        {
44
            checkboxes[i].checked = true;
45
        }
46
    }
47
43
48
    //  Prevent event propergation.
49
    return false;
50
}
51
44
52
function Hide(link)
45
            [% IF ( choosemarc ) %]
53
{
46
                <h2>Choose your setup</h2>
54
    //  Toggle the display of a given element on the page.
47
                <p>Basic setup selects recommended settings by default.</p>
55
    //
48
                <form name="frameworkselection" method="post" action="install.pl">
56
    subfield = document.getElementById('bloc'+link);
49
                    <input type="hidden" name="step" value="3" />
57
    var initstyle = subfield.style.display;
50
                    <input type="hidden" name="op" value="selectframeworks"/>
58
    if (initstyle == 'block') subfield.style.display = 'none' ;
51
59
    if (initstyle == 'none') subfield.style.display = 'block' ;
52
                    <p>
60
}
53
                        <label><input type="radio" name="setup" value="Basic" checked="checked" /> Basic</label>
54
                    </p>
55
                    <p>
56
                        <label><input type="radio" name="setup" value="Advanced"/> Advanced</label>
57
                    </p>
58
59
                    <h2>Select your MARC flavor</h2>
60
                    <p>MARC stands for Machine Readable Cataloging, containing information about a bibliographic record. MARC21 is used globally, whereas UNIMARC tends to be used in Europe. </p>
61
62
                    [% FOREACH flavourloo IN flavourloop %]
63
                        [% IF ( flavourloo.label == "Unimarc") %]
64
                             <p>
65
                                 <label><input type="radio" name="marcflavour" value="[% flavourloo.code %]" /> [% flavourloo.label %]</label>
66
                             </p>
67
                        [% ELSE %]
68
                             <p>
69
                                 <label><input type="radio" name="marcflavour" value="[% flavourloo.code %]" checked="checked" /> [% flavourloo.label %]</label>
70
                             </p>
71
                        [% END %]
72
                    [% END %]
73
                    <p><input value="Continue to the next step" class="btn btn-primary" type="submit" /> </p>
74
                </form>
75
            [% END # / IF choosemarc %]
61
76
62
//]]>
77
            [% IF ( selectframeworks ) %]
63
</script>
78
                <h2>Web installer &rsaquo; [% setup %] setup &rsaquo; Selecting default settings</h2>
64
[% END %]
65
79
80
                [% IF setup == "Advanced" %]
81
                    <p id="selectall"><a href="#">Select all sample data</a></p>
82
                [% END %]
66
83
67
[% IF ( finish ) %]
84
[% IF ( choosemarc ) %]
68
    <h1>Congratulations, installation complete</h1>
85
   <h2 align="center">Select your MARC flavor</h2>
69
    <p>If this page does not redirect in 10 seconds, click <a href="/cgi-bin/koha/installer/onboarding.pl">Start onboarding process</a>.</p>
86
       <form name="frameworkselection" method="post" action="install.pl">
87
           <input type="hidden" name="step" value="3" />
88
           <input type="hidden" name="op" value="selectframeworks" />
89
           <p>
90
           [% FOREACH flavourloo IN flavourloop %]
91
           <div>
92
              [% IF ( flavourloo.checked ) %]
93
                  <input type="radio" name="marcflavour" value="[% flavourloo.code %]" checked /> [% flavourloo.label %] <br/>
94
              [% ELSE %]
95
                  <input type="radio" name="marcflavour" value="[% flavourloo.code %]" /> [% flavourloo.label %] <br/>
96
              [% END %]
97
           </div>
98
           [% END %]
99
           </p>
100
           <p> Click 'Next' to continue <input value="Next &gt;&gt;" type="submit" /></p>
101
           </form>
70
[% END %]
102
[% END %]
71
103
72
104
[% IF ( selectframeworks ) %]
73
[% IF ( choosemarc ) %]
105
<h2 align="center">Selecting Default Settings</h2>
74
    <h2 align="center">Choose your setup</h2>
106
    <script type="text/javascript">
75
    <p>Basic setup selects recommended settings by default.</p>
107
       var linklabel = _("Select all sample data");
108
       document.write('<p><a href="#" onclick="return selectAllFrameworks();">'+linklabel+'</a></p>');
109
    </script>
76
    <form name="frameworkselection" method="post" action="install.pl">
110
    <form name="frameworkselection" method="post" action="install.pl">
77
    <input type="hidden" name="step" value="3" />
111
    <input type="hidden" name="step" value="3" />
78
    <input type="hidden" name="op" value="selectframeworks"/>
112
    <input type="hidden" name="op" value="addframeworks" />
79
113
114
    [% IF ( frameworksloop ) %]
115
    <h2>MARC frameworks: [% marcflavour %]</h2>
116
    [% IF ( en_marc_frameworks ) %]
117
         <h4><span class="error">No MARC frameworks are available for your language.
118
                Defaulting to the frameworks supplied for English (en)<span></h4>
119
    [% END %]
120
    [% FOREACH frameworksloo IN frameworksloop %]
80
    <div>
121
    <div>
81
        <input type="radio" name="setup" value="Basic" checked="checked">Basic<br/>
122
    <h3>[% frameworksloo.label %]</h3>
82
        <input type="radio" name="setup" value="Advanced"/>Advanced<br/>
123
    [% FOREACH framework IN frameworksloo.frameworks %]
83
    </div>
124
       <table style="border:1px;vertical-align:top;">
84
125
       <tr>
85
    <h2 align="center">Select your MARC flavor</h2>
126
       <td style="vertical-align:top;">
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>
127
          [% IF ( framework.checked ) %]
87
128
               <input type="checkbox" name="framework" value="[% framework.fwkfile %]" checked="checked" id="[% framework.fwkname %]" />
88
    [% FOREACH flavourloo IN flavourloop %]
129
          [% ELSE %]
89
    <div>
130
               <input type="checkbox" name="framework" value="[% framework.fwkfile %]" id="[% framework.fwkname %]" />
90
            [% IF ( flavourloo.label == "Unimarc") %]
131
          [% END %]
91
                 <input type="radio" name="marcflavour" value="[% flavourloo.code %]" /> [% flavourloo.label %]<br/>
132
       </td>
133
       <td>
134
          <label for="[% framework.fwkname %]">
135
               [% framework.fwkdescription %]
136
               <em>([% framework.fwkname %])</em>
137
           </label>
138
       </td>
139
       </table>
140
     [% END %]
141
     </div>
142
     [% END %]
143
     <h2>Other data</h2>
144
     [% END %]
145
     [% IF ( en_sample_data ) %]
146
         <h4><span class="error">No sample data and settings are available for your language.
147
                 Defaulting to the samples supplied for English (en)<span></h4>
148
     [% END %]
149
     [% FOREACH levelloo IN levelloop %]
150
     <div>
151
     <h3>[% levelloo.label %]</h3>
152
     [% FOREACH framework IN levelloo.frameworks %]
153
        <table style="border:1px;vertical-align:top;">
154
        <tr>
155
        <td style="vertical-align:top;">
156
            [% IF ( framework.checked ) %]
157
                <input type="checkbox" name="framework" value="[% framework.fwkfile %]" checked="checked" id="[% framework.fwkname %]" />
92
            [% ELSE %]
158
            [% ELSE %]
93
                 <input type="radio" name="marcflavour" value="[% flavourloo.code %]" checked="checked" /> [% flavourloo.label %] <br/>
159
                <input type="checkbox" name="framework" value="[% framework.fwkfile %]" id="[% framework.fwkname %]" />
94
            [% END %]
160
            [% END %]
95
    </div>
161
        </td>
96
    [% END %]
162
        <td>
97
163
                <label for="[% framework.fwkname %]">
98
        <p>Click 'Next' to continue <input value="Next &gt;&gt;" type="submit" /></p>
164
                    [% framework.fwkdescription %]
99
165
                    <em>([% framework.fwkname %])</em>
100
    </form>
166
                </label>
101
167
        </td>
102
[% END %]
168
        </table>
103
169
     [% END %]
104
[% IF ( selectframeworks ) %]
170
     </div>
105
        <h2 align= "center"> [% setup %] setup</h2>
171
     [% END %]
106
        <h2 align="center">Selecting Default Settings</h2>
172
     <p>When you've made your selections, please click 'Import' below to begin the process. It may take a while to complete,
107
173
     please be patient.</p>
108
        [% IF setup == "Advanced" %]
174
     <p><input type="submit" value="Import &gt;&gt;" />
109
            <script type="text/javascript">
175
     </p>
110
                var linklabel = _("Select all options");
176
     </form>
111
                document.write('<p><a href="#" onclick="return selectAllFrameworks();"><button>'+linklabel+'</button></a></p>');
112
            </script>
113
        [% END %]
114
        <form name="frameworkselection" method="post" action="install.pl">
115
            <input type="hidden" name="step" value="3" />
116
            <input type="hidden" name="op" value="addframeworks" />
117
    [% IF ( frameworksloop ) %]
118
        <h2>MARC frameworks: [% marcflavour %]</h2>
119
        [% IF ( en_marc_frameworks ) %]
120
            <h4><span class="error">No MARC frameworks are available for your language.
121
                    Defaulting to the frameworks supplied for English (en)<span></h4>
122
        [% END %]
123
        [% FOREACH frameworksloo IN frameworksloop %]
124
           <div>
125
           <h3>[% frameworksloo.label %]</h3>
126
           [% FOREACH framework IN frameworksloo.frameworks %]
127
                <table style="border:1px;vertical-align:top;">
128
                <tr>
129
                    <td style = "border:1px; vertical-align:top;">
130
                        [% IF (frameworksloo.label == "Default") && (setup=="Basic") %]
131
                            <input type="hidden" name="framework" value="[% framework.fwkfile %]" id ="[%framework.fwkname%]" />
132
                        [% ELSE %]
133
                            <input type="checkbox" name="framework" value="[% framework.fwkfile %]" id ="[%framework.fwkname%]" />
134
                        [% END %]
135
                    </td>
136
                    <td>
137
                    [% IF (frameworksloo.label == "Default") && (setup=="Basic") %]
138
                        <ul>
139
                            <li>
140
                                <label for="[% framework.fwkname %]">
141
                                    [% framework.fwkdescription %]
142
                                    <em>([% framework.fwkname %])</em>
143
                                </label>
144
                            </li>
145
                        </ul>
146
                    </td>
147
                    [% ELSE %]
148
                    <td>
149
                        <label for= "[% framework.fwkname %]">
150
                            [% framework.fwkdescription %]
151
                            <em>([% framework.fwkname %])</em>
152
                        </label>
153
                    </td>
154
                    [% END %]
155
                </tr>
156
                </table>
157
           [% END %]
158
           </div>
159
        [% END %]
160
    <h2>Other data</h2>
161
    [% END %]
162
    [% IF ( en_sample_data ) %]
163
        <h4><span class="error">No sample data and settings are available for your language.
164
                Defaulting to the samples supplied for English (en)<span></h4>
165
    [% END %]
166
    [% FOREACH levelloo IN levelloop %]
167
        <div>
168
        <h3>[% levelloo.label %]</h3>
169
170
        [% IF (setup == "Basic" && levelloo.label == "Optional") %]
171
            <script type="text/javascript">
172
                var linklabel = _("Select all options");
173
                document.write('<p><a href="#" onclick="return selectAllFrameworks();"><button>'+linklabel+'</button></a></p>');
174
            </script>
175
        [% END %]
176
177
        [% FOREACH framework IN levelloo.frameworks %]
178
            <table style="border:1px;vertical-align:top;">
179
            <tr>
180
                <td style="vertical-align:top;">
181
                [% IF (levelloo.label == "Default" ) && (setup=="Basic")%]
182
                     <input type="hidden" name="framework" value="[% framework.fwkfile %]" id="[%framework.fwkname %]" />
183
                [% ELSE %]
184
                     <input type="checkbox" name="framework" value="[%framework.fwkfile %]" id="[%framework.fwkname%]"/>
185
                [% END %]
186
                </td>
187
                <td>
188
                [% IF (levelloo.label == "Default") && (setup=="Basic")%]
189
                <ul>
190
                    <li>
191
                        <label for="[% framework.fwkname %]">
192
                            [% framework.fwkdescription %]
193
                            <em>([% framework.fwkname %])</em>
194
                        </label>
195
                    </li>
196
                </ul>
197
                </td>
198
                [% ELSE %]
199
                <td>
200
                    <label for= "[% framework.fwkname %]">
201
                        [% framework.fwkdescription %]
202
                        <em>([% framework.fwkname %])</em>
203
                    </label>
204
                </td>
205
                [% END %]
206
            </tr>
207
            </table>
208
        [% END %]
209
        </div>
210
    [% END %]
211
    <p>When you've made your selections, please click 'Import' below to begin the process. It may take a while to complete,
212
    please be patient.</p>
213
    <p><input type="submit" value="Import &gt;&gt;" />
214
    </p>
215
    </form>
216
[% END %]
177
[% END %]
217
178
218
179
Lines 241-289 function Hide(link) Link Here
241
    </p>
202
    </p>
242
[% END %]
203
[% END %]
243
204
205
            [% IF ( proposeimport ) %]
206
                <h2>Web installer &rsaquo; Set up database</h2>
207
                <p>Now we're ready to create the database tables and fill them with some default data.</p>
208
                <form action="install.pl" method="post">
209
                    <input type="hidden" name="step" value="3" />
210
                    <input type="hidden" name="op" value="importdatastructure" />
211
                    <p><input value="Continue to the next step" class="btn btn-primary" type="submit" /></p>
212
                </form>
213
            [% END %]
244
214
245
[% IF ( importdatastructure ) %]
215
            [% IF ( default ) %]
246
    [% IF ( error ) %]
216
                [% IF ( upgrading ) %]
247
        <p>The following error occurred while importing the database structure:</p>
217
                    <h2>Web installer &rsaquo; Update database</h2>
248
        <p class="error">[% error %] </p>
218
                    <p>We are upgrading from Koha [% dbversion %] to [% kohaversion %]</p>
249
        <p>Please contact your system administrator</p>
219
                    <p><a href="install.pl?step=3&amp;op=updatestructure" class="btn btn-primary">Update your database</a></p>
250
    [% ELSE %]
220
                [% ELSE %]
251
        <h2 align="center">Success</h2>
221
                    <h2>Web installer &rsaquo; Install basic configuration settings</h2>
252
        <ul>
222
                    <p>We are ready to do some basic configuration.</p>
253
        <li>Database tables created</li>
223
                    <p> <a href="install.pl?step=3&amp;op=choosemarc" class="btn btn-primary">Continue to the next step</a> </p>
254
        </ul>
224
                [% END %]
255
        <form action="install.pl">
225
            [% END %]
256
        <input type="hidden" name="step" value="3" />
257
            <p> Click 'Next' to continue <input value="Next &gt;&gt;" type="submit" /></p>
258
        </form>
259
    [% END %]
260
[% END %]
261
262
226
263
[% IF ( proposeimport ) %]
227
            [% IF ( updatestructure ) %]
264
    <p>Now we're ready to create the database tables and fill them with some default data.</p>
228
                <h2>Updating database structure</h2>
265
    <form action="install.pl">
229
                [% IF ( has_update_succeeds ) %]
266
    <input type="hidden" name="step" value="3" />
230
                    <p>Update report :</p>
267
    <input type="hidden" name="op" value="importdatastructure" />
231
                    <ul>
268
    <p> Click 'Next' to continue <input value="Next &gt;&gt;" type="submit" /></p>
232
                        [% FOREACH update_repor IN update_report %]
269
    </form>
233
                            <li>[% update_repor.line |html %]</li>
270
[% END %]
234
                        [% END %]
235
                    </ul>
236
                [% END %]
271
237
272
[% IF ( default ) %]
238
[% IF ( default ) %]
273
    [% IF ( upgrading ) %]
239
    [% IF ( upgrading ) %]
274
        <p>
240
        <p>
275
            We are upgrading from Koha [% dbversion %] to [% kohaversion %], you must update your database.
241
            We are upgrading from Koha [% dbversion %] to [% kohaversion %], you must update your database.
276
        <br>
242
        <br>
277
        <a href="install.pl?step=3&amp;op=updatestructure" class="button"><button>Update Database</button></a>
243
        <a href="install.pl?step=3&amp;op=updatestructure" class="button">Update your database</a>
278
        </p>
244
        </p>
279
    [% ELSE %]
245
    [% ELSE %]
280
        <p>We are ready to do some basic configuration. Please install some basic configuration settings to continue the installation:
246
        <p>We are ready to do some basic configuration. Please install some basic configuration settings to continue the installation:
281
        <br>
247
        <br>
282
        <br>
248
        <br>
283
            <a href="install.pl?step=3&amp;op=choosemarc" class="button"><button>Install Basic Configuration Settings</button></a>
249
            <a href="install.pl?step=3&amp;op=choosemarc" class="button">Install basic configuration settings</a>
284
250
285
    [% END %]
251
                [% UNLESS ( has_update_errors ) %]
286
[% END %]
252
                    <p>Everything went okay. Update done.</p>
253
                [% END %]
254
                <p><a href="install.pl?step=3&amp;op=finished" class="btn btn-primary">Continue to log in to Koha</a></p>
255
           [% END # / IF updatestructure %]
256
    </div>
257
</div>
287
258
288
[% IF ( updatestructure ) %]
259
[% IF ( updatestructure ) %]
289
  <div><h2 align="center">Updating database structure</h2>
260
  <div><h2 align="center">Updating database structure</h2>
Lines 306-315 function Hide(link) Link Here
306
 [% UNLESS ( has_update_errors ) %]
277
 [% UNLESS ( has_update_errors ) %]
307
    <p>Everything went OK, update done.</p>
278
    <p>Everything went OK, update done.</p>
308
  [% END %]
279
  [% END %]
309
<a href="install.pl?step=3&amp;op=choosemarc" class="button"><button>Back to Installation</button></a>
280
<a href="install.pl?step=3&amp;op=finished" class="button">Continue to log in to Koha</a>
310
  </div>
281
  </div>
311
[% END %]
282
[% END %]
312
283
313
</div>
284
[% INCLUDE 'intranet-bottom.inc' %]
314
</body>
315
</html>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep1.tt (-76 / +33 lines)
Lines 1-81 Link Here
1
<!--Includes for creating library-->
2
[% INCLUDE 'doc-head-open.inc' %]
1
[% INCLUDE 'doc-head-open.inc' %]
3
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
2
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
4
[% INCLUDE 'installer-doc-head-close.inc' %]
3
[% INCLUDE 'installer-doc-head-close.inc' %]
5
[% INCLUDE 'datatables.inc' %]
4
[% INCLUDE 'datatables.inc' %]
6
5
7
[% IF (libraries && libraries.count > 1) %]
6
<head><title>Welcome &rsaquo; to  &rsaquo; Koha</title></head>
8
    <meta http-equiv="refresh" content="0; url=/cgi-bin/koha/installer/onboarding.pl?step=2">
7
9
8
<div>
10
[% ELSIF (op == "add_validate_library") %]
9
    <h1 id="logo"><img alt="Koha" src="[% interface %]/[% theme %]/img/koha.org-logo.gif"/> Welcome to Koha</h1>
11
    <head>
10
</div>
12
        <title>Welcome &rsaquo; to  &rsaquo; Koha</title>
11
13
    </head>
12
[% INCLUDE 'onboarding_messages.inc' %]
14
13
15
    <!--Header for the koha onboarding tool-->
14
<form name="LibraryCreation" method="post" action="onboarding.pl">
16
    <div>
15
    <fieldset class="rows" >
17
        <h1 id="logo"><img alt="Koha" src="[% interface %]/[% theme %]/img/koha.org-logo.gif"/> Welcome to Koha</h1>
16
         <h2>Create a library</h2>
18
    </div>
17
         <input type="hidden" name="step" value="1"/>
19
18
         <input type="hidden" name="op" value="add_validate_library"/>
20
<!--New Library created-->
19
         <ol>
21
       [% IF message == "success_on_insert" %]
20
             <li>
22
            <form name="createlibrary" method="post" action="onboarding.pl" >
21
                <label for="branchcode" class="required">Library code: </label>
23
                <input type="hidden" name="step" value="2"/>
22
                <input type="text"  pattern="[0-9A-Za-z]{1,10}" title="Please enter up to 10 letters and/or numbers" name="branchcode" id="branchcode" size="10" maxlength="10" value="" class="required" required="required" />
24
                <h1 align="left"> New library</h1>
23
                <span class="required">Required</span>
25
                <div>
24
            </li>
26
                    <p> Success: library created!
25
            <li>
27
                    </p>
26
                <label for="branchname" class="required">Name: </label>
28
                    <p> To add another library and for more settings, <br>
27
                <input type="text" name="branchname" id="branchname" title="Please enter the name of your institution" size="42" value="" class="required" required="required" style="width:200px;">
29
                    go to:<br>
28
                <span class="required">Required</span>
30
                    More -> Administration -> Libraries and groups<br>
29
            </li>
31
                    </p>
30
         </ol>
32
                </div>
31
         <p>
33
                Next up:
32
            To add another library and for more settings, <br>
34
                <input type="submit" name="start" value="Minimal patron category setup"/>
33
            go to:<br>
35
            </form>
34
            More -> Administration -> Libraries and groups<br>
36
35
         </p>
37
        [%ELSE %]
36
         <input type="submit" class="action" value="Submit"/>
38
            <form name="retrylibrary" method="post" action="onboarding.pl">
37
    </fieldset>
39
                <input type="hidden" name="step" value="1"/>
38
</form>
40
                <h1 align="left">Failed </h1>
41
                <div>
42
                    <p> Library was not successfully created</br>
43
                    Please try again or contact your system administrator. </p>
44
                </div>
45
                <input type="submit" value="Try again"/>
46
            </form>
47
        [%END%]
48
49
[% ELSE %]
50
    <head>
51
        <title>Welcome &rsaquo; to  &rsaquo; Koha</title>
52
    </head>
53
54
    <!--Header for the koha onboarding tool-->
55
    <div>
56
        <h1 id="logo"><img alt="Koha" src="[% interface %]/[% theme %]/img/koha.org-logo.gif"/> Welcome to Koha</h1>
57
    </div>
58
59
<!--Create a library screen 1-->
60
        <form name="LibraryCreation" method="post" action="onboarding.pl">
61
            <fieldset class="rows" >
62
                 <h2>Create a library</h2>
63
                 <input type="hidden" name="step" value="1"/>
64
                 <input type="hidden" name="op" value="add_validate_library"/>
65
                 <ol>
66
                     <li>
67
                        <label for="branchcode" class="required">Library code: </label>
68
                        <input type="text"  pattern="[0-9A-Za-z]{1,10}" title="Please enter up to 10 letters and/or numbers" name="branchcode" id="branchcode" size="10" maxlength="10" value="[% library.branchcode |html %]" class="required" required="required" />
69
                        <span class="required">Required</span>
70
                    </li>
71
                    <li>
72
                        <label for="branchname" class="required">Name: </label>
73
                        <input type="text" name="branchname" id="branchname" title="Please enter the name of your institution" size="42" value="[% library.branchname |html %]" class="    required" required="required" style="width:200px;">
74
                        <span class="required">Required</span>
75
                    </li>
76
                 </ol>
77
             <br>
78
             <input type="submit" class="action" value="Submit"/>
79
            </fieldset>
80
     </form>
81
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep2.tt (-152 / +102 lines)
Lines 2-164 Link Here
2
[% USE KohaDates %]
2
[% USE KohaDates %]
3
[% USE Price %]
3
[% USE Price %]
4
[% INCLUDE 'doc-head-open.inc' %]
4
[% INCLUDE 'doc-head-open.inc' %]
5
<title> Add a patron category</title>
5
<title>Koha &rsaquo; Web installer &rsaquo; Add a patron category</title>
6
[% IF (categories && categories.count > 1 )
7
    # This if statement checks if the categories variable handed to this template
8
    # by onboarding.pl has data in it. If the categories variable does have data
9
    # in it this means that the user has previously imported sample patron category
10
    # data and so we do not need to show them the create patron category screen 1,
11
    #instead we can display a screen with ubtton redirecting the user to step 3 %]
12
     <meta http-equiv="refresh" content="0; url=/cgi-bin/koha/installer/onboarding.pl?step=3">
13
[% END %]
6
[% INCLUDE 'installer-doc-head-close.inc' %]
14
[% INCLUDE 'installer-doc-head-close.inc' %]
7
[% INCLUDE 'calendar.inc' %]
8
[% INCLUDE 'js_includes.inc' %]
15
[% INCLUDE 'js_includes.inc' %]
9
[% INCLUDE 'datatables.inc' %]
16
[% INCLUDE 'validator-strings.inc' %]
10
<script type="text/javascript">
17
[% INCLUDE 'installer-strings.inc' %]
11
    var MSG_CATEGORYCODE_CHARS=(_("Please only enter letters into this field."));
18
<script type="text/javascript" src="[% interface %]/[% theme %]/js/onboarding.js"></script>
12
    var MSG_ONE_ENROLLMENTPERIOD =(_("Please choose an enrollment period in months OR by date."));
13
    var MSG_ONLY_ONE_ENROLLMENTPERIOD=(_("Please only choose one enrolment period."));
14
15
jQuery.validator.addMethod( "enrollment_period", function(){
16
      enrolmentperiod = $("#enrolmentperiod").val();
17
      enrolmentperioddate = $("#enrolmentperioddate").val();
18
      if (( $("#enrolmentperiod").val() == "" && $("#enrolmentperioddate").val() == "") || ($("#enrolmentperiod").val() !== "" && $("#enrolmentperioddate").val() !== "")) {
19
             return false;
20
      } else {
21
             return true;
22
      }
23
    }, MSG_ONE_ENROLLMENTPERIOD
24
);
25
</script>
26
<script type="text/javascript" src="[% themelang %]/js/categories.js"></script>
27
</head>
19
</head>
28
20
29
[% IF (categories && categories.count > 1 ) %] <!--This if statement checks if the categories variable handed to this template by onboarding.pl has data in it. If the categories variable does have data in it this means that the user has previously imported sample patron category data and so we do not need to show them the create patron category screen 1, instead we can display a screen with ubtton redirecting the user to step 3-->
21
<div>
22
    <h1 id="logo"><img alt="Koha" src="[% interface %]/[% theme %]/img/koha.org-logo.gif"/> Welcome to Koha</h1>
23
</div>
30
24
31
25
[% INCLUDE 'onboarding_messages.inc' %]
32
     <meta http-equiv="refresh" content="0; url=/cgi-bin/koha/installer/onboarding.pl?step=3">
26
<h1 align="left"> Create a new patron category</h1>
33
27
<p> The patron category you create in this form is going to be the one which the new administrator patron account will have.</p>
34
[% ELSIF (op == "add_validate_category") %]
28
   <form id="category_form" method="post" action="onboarding.pl">
35
<!--else if the user has not previously imported sample patron categories check if the user has pressed the button name="add_validate" in the create patron category screen 1, and if they have pressed that button then display the below screen with a button to redirect the user to step 3-->
29
   <fieldset class="rows">
36
37
    <div> <!-- Header that appears at the top of every screen in the koha onboarding tool-->
38
        <h1 id="logo"><img alt="Koha" src="[% interface %]/[% theme %]/img/koha.org-logo.gif"/> Welcome to Koha</h1>
39
    </div>
40
41
    [% IF message != "error_on_insert" %]
42
     <form name="createcat" method="post" action="onboarding.pl">
43
            <input type="hidden" name="step" value="3"/>
44
             <h1 align="left">  New patron category</h1>
45
             <div>
46
                 <p> Success: patron category created! </p>
47
                 <p> To add another patron category and for more settings<br>
48
                 go to:<br>
49
                 More -> Administration -> Patron categories<br>
50
             </div>
51
             Next up:<br>
52
             <input type="submit" name="start" value="Add a patron"><!-- When the user clicks on this button then redirect them to step 3 of the onboarding tool-->
53
     </form>
54
     [% ELSE %]
55
        <form name="retrypatcat" method="post" action="onboarding.pl">
56
        Message is [% message %]
57
        <input type="hidden" name="step" value="2"/>
30
        <input type="hidden" name="step" value="2"/>
58
            <h1 align="left">Failed</h1>
31
        <input type="hidden" name="op" value="add_validate_category" />
59
            <div>Patron category was not successfully created.</br>
32
            <ol>
60
            Please try again or contact your system administrator.</p>
33
                <li>
61
            </div>
34
                    <label for="categorycode" class="required">Category code: </label>
62
            <input type="submit" value="Try again"/>
35
                    <input type="text" pattern="[0-9A-Za-z]{1,10}" title="Please enter up to 10 letters and/or numbers" id="categorycode" name="categorycode" value="[% category.categorycode |html %]" size="10" maxlength="10" class="required" required="required" />
63
        </form>
36
                    <span class="required">Required</span>
64
    [% END %]
37
                </li>
65
38
66
39
                <li>
67
[% ELSE %] <!--Else display create patron category screen 1 where the user can input values to create their first patron category-->
40
                    <label for="description" class="required">Description: </label>
68
    <div> <!-- Header that appears at the top of every screen in the koha onboarding tool-->
41
                    <input type="text" name="description" title="Please enter a description of the category" size="40" maxlength="80" class="required" required="required" value="[% category.description |html%]" />
69
        <h1 id="logo"><img alt="Koha" src="[% interface %]/[% theme %]/img/koha.org-logo.gif"/> Welcome to Koha</h1>
42
                    <span class="required">Required</span>
70
    </div>
43
                </li>
71
44
72
    <h1 align="left"> Create a new patron category</h1>
45
                <li>
73
    <p> The patron category you create in this form is going to be the one which the new administrator patron account will have.</p>
46
                    <label for="overduenoticerequired">Overdue notice required: </label>
74
       <form id="category_form" method="post" action="onboarding.pl">
47
                    <select name="overduenoticerequired" value="overduenoticerequired">
75
       <fieldset class="rows">
48
                        [% IF category.overduenoticerequired %]
76
            <input type="hidden" name="step" value="2"/>
49
                            <option value="0">No</option>
77
            <input type="hidden" name="op" value="add_validate_category" />
50
                            <option value="1" selected="selected">Yes</option>
78
                <ol>
51
                        [% ELSE %]
79
                    <li>
52
                            <option value="0" selected="selected">No</option>
80
                        <label for="categorycode" class="required">Category code: </label>
53
                            <option value="1">Yes</option>
81
                        <input type="text" pattern="[0-9A-Za-z]{1,10}" title="Please enter up to 10 letters and/or numbers" id="categorycode" name="categorycode" value="[% category.categorycode |html %]" size="10" maxlength="10" class="required" required="required" />
54
                        [% END %]
82
                        <span class="required">Required</span>
55
                    </select>
83
                    </li>
56
                </li>
84
57
85
                    <li>
58
                <li>
86
                        <label for="description" class="required">Description: </label>
59
                    <label for="category_type" class="required">Category type: </label>
87
                        <input type="text" name="description" title="Please enter a description of the category" size="40" maxlength="80" class="required" required="required" value="[% category.description |html%]" />
60
                    Staff
88
                        <span class="required">Required</span>
61
                </li>
89
                    </li>
62
90
63
                <li>
91
                    <li>
64
                    <label for="default_privacy">Default privacy: </label>
92
                        <label for="overduenoticerequired">Overdue notice required: </label>
65
                    <select value="default_privacy" name="default_privacy" required="required">
93
                        <select name="overduenoticerequired" value="overduenoticerequired">
66
                        [% SET default_privacy = 'default' %]
94
                            [% IF category.overduenoticerequired %]
67
95
                                <option value="0">No</option>
68
                        [% IF category %]
96
                                <option value="1" selected="selected">Yes</option>
69
                           [% SET default_privacy = category.default_privacy %]
97
                            [% ELSE %]
70
                        [% END %]
98
                                <option value="0" selected="selected">No</option>
71
99
                                <option value="1">Yes</option>
72
                        [% SWITCH default_privacy %]
100
                            [% END %]
73
                        [% CASE 'forever' %]
101
                        </select>
74
                            <option value="default">Default</option>
102
                    </li>
75
                            <option value="never">Never</option>
103
76
                            <option value="forever" selected="selected">Forever</option>
104
                    <li>
77
                        [% CASE 'never' %]
105
                        <label for="category_type" class="required">Category type: </label>
78
                            <option value="default">Default</option>
106
                        <select name="category_type" value="category_type" class='required' required='required'>
79
                            <option value="never" selected="selected">Never</option>
107
                            [% IF category and category.category_type == 'S' %]
80
                            <option value="forever">Forever</option>
108
                                <option value="S" selected="selected">Staff</option>
81
                        [% CASE %]
109
                            [% ELSE %]
82
                            <option value="default" selected="selected">Default</option>
110
                                <option value="S">Staff</option>
83
                            <option value="never">Never</option>
111
                            [% END %]
84
                            <option value="forever">Forever</option>
112
                        </select>
85
                        [% END %]
113
                        <span class="required">Required</span>
86
                    </select>
114
                    </li>
87
                    <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>
115
88
                </li>
116
                    <li>
89
        </ol>
117
                        <label for="default_privacy">Default privacy: </label>
90
        <span class="label">Enrolment period: </span>
118
                        <select value="default_privacy" name="default_privacy" required="required">
91
        </br>
119
                            [% SET default_privacy = 'default' %]
92
                <fieldset>
120
93
                <legend>Choose one</legend>
121
                            [% IF category %]
94
                        <ol>
122
                               [% SET default_privacy = category.default_privacy %]
95
                            <li>
123
                            [% END %]
96
                                <label for="enrolmentperiod" style="width:6em;">In months: </label>
124
97
                                <input type="number" class="enrolmentperiod" name="enrolmentperiod" id="enrolmentperiod" min="0" size="3" maxlength="3" value="[% IF category.enrolmentperiod %][% category.enrolmentperiod %][% END %]" /> months
125
                            [% SWITCH default_privacy %]
98
                            </li>
126
                            [% CASE 'forever' %]
99
                            <li>
127
                                <option value="default">Default</option>
100
                                <label for="enrolmentperioddate" style="width:6em;">Until date: </label>
128
                                <option value="never">Never</option>
101
                                <input type="text" class="enrolmentperioddate datepicker" name="enrolmentperioddate" id="enrolmentperioddate" value="[% category.enrolmentperioddate | $KohaDates %]" />
129
                                <option value="forever" selected="selected">Forever</option>
102
                            </li>
130
                            [% CASE 'never' %]
103
                        </ol>
131
                                <option value="default">Default</option>
104
                 </fieldset>
132
                                <option value="never" selected="selected">Never</option>
105
             <p> Success: patron category created! </p>
133
                                <option value="forever">Forever</option>
106
             <p> To add another patron category and for more settings<br>
134
                            [% CASE %]
107
             go to:<br>
135
                                <option value="default" selected="selected">Default</option>
108
             More -> Administration -> Patron categories<br>
136
                                <option value="never">Never</option>
109
137
                                <option value="forever">Forever</option>
110
                <input type="submit" class="action" value="Submit" />
138
                            [% END %]
111
</fieldset>
139
                        </select>
112
</form>
140
                        <p>Controls how long a patrons checkout history is kept for new patrons of this category. "Never"     anonymizes checkouts on return, and "Forever" keeps a patron's checkout history indefinitely. When set to "Default", the amount of history kept is controlled by the cronjob <i>batch_anonymise.pl</i> which should be set up by your system administrator.</p>
141
                    </li>
142
            </ol>
143
            <span class="label">Enrolment period: </span>
144
            </br>
145
                    <fieldset>
146
                    <legend>Choose one</legend>
147
                            <ol>
148
                                <li>
149
                                    <label for="enrolmentperiod" style="width:6em;">In months: </label>
150
                                    <input type="number" class="enrolmentperiod" name="enrolmentperiod" id="enrolmentperiod" size="3" maxlength="3" value="[% IF category.enrolmentperiod %][% category.enrolmentperiod %][% END %]" /> months
151
                                </li>
152
                                <li>
153
                                    <label for="enrolmentperioddate" style="width:6em;">Until date: </label>
154
                                    <input type="text" class="enrolmentperioddate datepicker" name="enrolmentperioddate" id="enrolmentperioddate" value="[% category.enrolmentperioddate | $KohaDates %]" />
155
                                </li>
156
                            </ol>
157
                     </fieldset>
158
                    <br>
159
                    <input type="submit" class="action" value="Submit" />
160
    </fieldset>
161
    </form>
162
[% END %]
163
113
164
[% INCLUDE 'intranet-bottom.inc' %]
114
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep3.tt (-182 / +88 lines)
Lines 1-196 Link Here
1
<!--Includes for creating patron-->
1
<!--Includes for creating patron-->
2
[% USE Koha %]
3
[% USE KohaDates %]
4
[% USE Price %]
5
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
6
[% IF ( finish ) %]<meta http-equiv="refresh" content="10; url=/cgi-bin/koha/mainpage.pl">[% END%]
7
[% INCLUDE 'installer-doc-head-close.inc' %]
3
[% INCLUDE 'installer-doc-head-close.inc' %]
8
[% INCLUDE 'calendar.inc' %]
9
[% INCLUDE 'datatables.inc' %]
10
[% INCLUDE 'js_includes.inc' %]
4
[% INCLUDE 'js_includes.inc' %]
5
[% INCLUDE 'validator-strings.inc' %]
6
[% INCLUDE 'installer-strings.inc' %]
11
7
12
<head>
13
<title>Create Koha administrator patron</title>
14
<!--jQuery scripts for creating patron-->
15
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.fixFloat.js"></script>
16
<script type="text/javascript">
17
     var MSG_PASSWORD_MISMATCH=(_("The entered passwords do not match, please rewrite them"));
18
     jQuery.validator.addMethod( "password_match", function(value,element){
19
        var password = document.getElementById('password').value
20
        var confirmpassword = document.getElementById('password2').value
21
        if ( password != confirmpassword ){
22
                return false;
23
        }
24
        else{
25
                return true
26
        }
27
     },  MSG_PASSWORD_MISMATCH
28
);
29
30
$(document).ready(function(){
31
   $("#Submit").click(function(){
32
      $("#createpatron").validate({
33
        rules: {
34
            surname: {
35
                required: true,
36
            },
37
            firstname: {
38
                required: true,
39
            },
40
            cardnumber: {
41
                required: true,
42
            },
43
            password: {
44
                 password_match:true
45
            }
46
        },
47
        messages: {
48
           password: {
49
                 required: MSG_PASSWORD_MISMATCH
50
           },
51
        }
52
      });
53
   });
54
});
55
</script>
56
</head>
8
</head>
57
9
58
<div>
10
<body id="installer" class="installer">
59
    <h1 id="logo"><img alt="Koha" src="[% interface %]/[% theme %]/img/koha.org-logo.gif"/> Welcome to Koha</h1>
11
[% INCLUDE 'onboarding_messages.inc' %]
60
</div>
12
13
<h1 align="left"> Create koha administrator patron</h1>
14
<p>
15
Now we will create a patron with superlibrarian permissions. Login with this to access Koha as a staff member will all permissions.
16
</p>
17
<form name="createpatron" id="createpatron" method="post" action="onboarding.pl">
18
    <fieldset class="rows">
19
         <input type="hidden" name="step" value="3"/>
20
         <input type="hidden" name="op" value="add_validate_patron" />
21
            <legend id="library_management_lgd">Library management</legend>
22
            <ol>
23
            <h3>Patron identity</h3>
24
                <li>
25
                    <label for="surname" class="required">Surname: </label>
26
                    <input type="text" id="surname" name="surname" title="Please only enter letters in the surname field" value="[% surname |html %]" class="required" required="required" />
27
                    <span class="required">Required</span>
28
                </li>
29
                <li>
30
                    <label for="firstname" class="required">First name: </label>
31
                    <input  type="text" name="firstname" title="Please only enter letters in the first name field" id="firstname" size="20" value="[% firstname |html %]" class="required" required="required">
32
                    <span class="required">Required</span>
33
                </li>
34
            </ol>
61
35
36
            <ol>
37
                <li>
38
                    <label for="cardnumber" class="required">Card number: </label>
39
                    [% IF patrons && patrons > 1 %]
40
                        <input type="text" id="cardnumber" title="Please enter a cardnumber" class="noEnterSubmit valid" name="cardnumber" value="[% newcardnumber | html %]" class="required" required="required">
41
                    [% ELSE %]
42
                        <input type="text" id="cardnumber" title="Please enter a cardnumber" name="cardnumber" value="[% cardnumber | html %]" class="required" required="required">
43
                    [% END %]
44
                    <span class="required">Required</span>
45
                </li>
46
                <li>
62
47
63
[%  IF (nok) %]
48
                <!--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-->
64
        <form name="errors" method="post" action="onboarding.pl">
49
                    <label for="libraries" class="required"> Library: </label>
65
            <input type="hidden" name="step" value="3"/>
50
                    <select name="libraries" size="1" id="libraries">
66
            <h1 align="left">There was an error</h1>
67
            <p>Try again </p>
68
            <div>
69
            <ul>
70
            [% IF errorloginexists %]
71
                <li id="ERROR_login_exist">Username/password already exists.</li>
72
            [% END %]
73
            [% IF errorcardnumberexists %]
74
                <li id="ERROR_cardnumber">Cardnumber already in use.</li>
75
            [% END %]
76
            [% IF errorcardnumberlength %]
77
                <li id="ERROR_cardnumber">Cardnumber length is incorrect</li>
78
            [% END %]
79
            [% IF errorshortpassword %]
80
                <li id="ERROR_short_password">Password length is incorrect, must be at least [% minPasswordLength %] characters long.</li>
81
            [% END %]
82
            [% IF errorpasswordmismatch %]
83
                <li id="ERROR_password_mismatch">Passwords do not match.</li>
84
            [% END %]
85
            </ul>
86
51
87
            </div>
52
                     [% FOREACH library IN libraries %]
88
            <input type="submit" name="step" value="Try again"/>
53
                          <option name="libraries" value="[% library.branchcode %]"> [% library.branchname %]
89
        </form>
54
                     [% END %]
90
55
56
                        </select>
57
                    <span class="required"> Required</span>
58
                </li>
59
                <li>
60
                    <label for="categorycode_entry" class="required"> Patron category</label>
61
                    <select id="categorycode_entry" name="categorycode_entry" onchange="update_category_code(this);">
62
                    [% FOREACH category IN categories %]
63
                        <option name="categorycode_entry" value = "[% category.categorycode %]">[%category.description %]</option>
64
                    [% END %]
65
                    </select>
66
                    <span class="required">Required</span><br><br>
67
                    <b>Note:</b> If you installed sample patron categories please select the "Staff" option in the patron categories dropdown box.
68
                </li>
69
            </ol>
91
70
92
<!--Create a patron screen 2-->
71
            <ol>
93
[% ELSIF op == 'add_validate' %]
72
                    <h3> Koha administrator patron permissions</h3>
94
          <!--New patron created-->
73
                    <li>
95
        <form name="patrondone" method="post" action="onboarding.pl">
74
                        <label> superlibrarian</label>
96
            <input type="hidden" name="step" value="4"/>
75
                    </li>
97
            <h1 align="left"> Koha administrator patron </h1>
76
            </ol>
98
            <div>
77
            <ol>
99
                 <p> Success: administrator patron created!</p>
78
            <h3>OPAC/Staff Login</h3>
100
                 <p> To create another patron, go to Patrons -> New Patron. <br>
79
                <li>
101
                More -> Set Permissions in a user page to gain superlibrarian permissions.
80
                    <label for="userid" class="required">Username: </label>
102
            </div>
81
                    <input type="text" name="userid" id ="userid" size="20" title="Please only enter a username of letters and numbers" value="[% userid |html %]" class="required" required="required" />
103
            Next up:
82
                    <span class="required">Required</span>
104
            <input type="submit" name="start" value="Minimal item type setup"/>
83
                </li>
105
        </form>
84
                <li>
106
[% ELSE %]
85
                    <label for="passwordlabel" class="required">Password: </label>
107
<!--Create a patron screen 1-->
86
                    <input type="password" name="password" id="password" size="20" value="[% member.password |html %]" class="required" required="required">
108
       <h1 align="left"> Create koha administrator patron</h1>
87
                    <span class="required">Required</span>
88
                </li>
89
                <li>
90
                    <label for="password2" class="required">Confirm password: </label>
91
                    <input type="password" id="password2" name="password2" size="20" value="" class="required" required="required">
92
                    <span class="required">Required</span>
93
                </li>
94
            </ol>
109
        <p>
95
        <p>
110
        Now we will create a patron with superlibrarian permissions. Login with this to access Koha as a staff member will all permissions.
96
            To create another patron, go to Patrons -> New Patron. <br>
97
            More -> Set Permissions in a user page to gain superlibrarian permissions.
111
        </p>
98
        </p>
112
        <form name="createpatron" id="createpatron" method="post" action="onboarding.pl">
99
    </fieldset>
113
            <fieldset class="rows">
100
    <br>
114
                 <input type="hidden" name="step" value="3"/>
101
    <input type="submit" id="Submit" class="action" value="Submit"/>
115
                 <input type="hidden" name="op" value="add_validate" />
102
</form>
116
                    <legend id="library_management_lgd">Library management</legend>
117
                    <ol>
118
                    <h3>Patron identity</h3>
119
                        <li>
120
                            <label for="surname" class="required">Surname: </label>
121
                            <input type="text" id="surname" name="surname" title="Please only enter letters in the surname field" value="[% surname |html %]" class="required" required="required" />
122
                            <span class="required">Required</span>
123
                        </li>
124
                        <li>
125
                            <label for="firstname" class="required">First name: </label>
126
                            <input  type="text" name="firstname" title="Please only enter letters in the first name field" id="firstname" size="20" value="[% firstname |html %]" class="required" required="required">
127
                            <span class="required">Required</span>
128
                        </li>
129
                    </ol>
130
131
                    <ol>
132
                        <li>
133
                            <label for="cardnumber" class="required">Card number: </label>
134
                            [% IF patrons && patrons > 1 %]
135
                                <input type="text" id="cardnumber" title="Please enter a cardnumber" class="noEnterSubmit valid" name="cardnumber" value="[% newcardnumber | html %]" class="required" required="required">
136
                            [% ELSE %]
137
                                <input type="text" id="cardnumber" title="Please enter a cardnumber" name="cardnumber" value="[% cardnumber | html %]" class="required" required="required">
138
                            [% END %]
139
                            <span class="required">Required</span>
140
                        </li>
141
                        <li>
142
143
                        <!--require a foreach loop to get all the values for the library that the user has either imported (in web installer) or created in the first step of this onboarding tool-->
144
                            <label for="libraries" class="required"> Library: </label>
145
                            <select name="libraries" size="1" id="libraries">
146
147
                             [% FOREACH library IN libraries %]
148
                                  <option name="libraries" value="[% library.branchcode %]"> [% library.branchname %]
149
                             [% END %]
150
151
                                </select>
152
                            <span class="required"> Required</span>
153
                        </li>
154
                        <li>
155
                            <label for="categorycode_entry" class="required"> Patron category</label>
156
                            <select id="categorycode_entry" name="categorycode_entry" onchange="update_category_code(this);">
157
                            [% FOREACH category IN categories %]
158
                                <option name="categorycode_entry" value = "[% category.categorycode %]">[%category.description %]</option>
159
                            [% END %]
160
                            </select>
161
                            <span class="required">Required</span><br><br>
162
                            <b>Note:</b> If you installed sample patron categories please select the "Staff" option in the patron categories dropdown box.
163
                        </li>
164
                    </ol>
165
166
                    <ol>
167
                            <h3> Koha administrator patron permissions</h3>
168
                            <input type="hidden" name="newflags" value="1"/>
169
                            <li>
170
                                <input type="hidden" class="flag parent" id="flag-0" name="flag" value="superlibrarian"/>
171
                                <label name="permissioncode" for="flag-0"> superlibrarian</label>
172
                            </li>
173
                    </ol>
174
                    <ol>
175
                    <h3>OPAC/Staff Login</h3>
176
                        <li>
177
                            <input type="hidden" name="BorrowerMandatoryField" value = "[% BorrowerMandatoryField %]" />
178
                            <label for="userid" class="required">Username: </label>
179
                            <input type="text" name="userid" id ="userid" size="20" title="Please only enter a username of letters and numbers" value="[% userid |html %]" class="required" required="required" />
180
                            <span class="required">Required</span>
181
                        </li>
182
                        <li>
183
                            <label for="passwordlabel" class="required">Password: </label>
184
                            <input type="password" name="password" id="password" size="20" value="[% member.password |html %]" class="required" required="required">
185
                            <span class="required">Required</span>
186
                        </li>
187
                        <li>
188
                            <label for="password2" class="required">Confirm password: </label>
189
                            <input type="password" id="password2" name="password2" size="20" value="" class="required" required="required">
190
                            <span class="required">Required</span>
191
                        </li>
192
                    </ol>
193
             </fieldset><br>
194
                <input type="submit" id="Submit" class="action" value="Submit"/>
195
     </form>
196
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep4.tt (-59 / +31 lines)
Lines 1-67 Link Here
1
<!-- includes for creating item type-->
1
<!-- includes for creating item type-->
2
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
3
[% IF ( finish ) %]<meta http-equiv="refresh" content="10; url=/cgi-bin/koha/mainpage.pl">[% END%]
4
[% INCLUDE 'installer-doc-head-close.inc' %]
3
[% INCLUDE 'installer-doc-head-close.inc' %]
5
<head>
4
[% INCLUDE 'validator-strings.inc' %]
6
    <title>Create item type</title>
5
[% INCLUDE 'installer-strings.inc' %]
6
<script type="text/javascript" src="[% interface %]/[% theme %]/js/onboarding.js"></script>
7
</head>
7
</head>
8
<div>
9
    <h1 id="logo"><img alt="Koha" src="[% interface %]/[% theme %]/img/koha.org-logo.gif"/> Welcome to Koha</h1>
10
</div>
11
8
12
[% IF (itemtypes && itemtypes.count >1) %]
9
[% INCLUDE 'onboarding_messages.inc' %]
13
10
14
     <meta http-equiv="refresh" content="0; url=/cgi-bin/koha/installer/onboarding.pl?step=5">
11
<!--Create a item type screen 1-->
12
<h1 align="center"> Create a new Item type </h1>
13
<p> Item types are used to group related items. Examples of item types are books, cds, and DVDs. <br><br> When adding to your institutions catalogue you will create an item of a particular item type. <br><br> Importantly item types are what you apply     circulation rules to. Circulation rules govern how your institution will lend its items, for example a circulation rule applied to the DVD item type may enforce a payment of $1.00 for borrowing any DVD.</p>
14
<form name="createitemform" method="post" action="onboarding.pl">
15
    <fieldset class="rows">
16
        <input type="hidden" name="step" value="4"/>
17
        <input type="hidden" name="op" value="add_validate_itemtype" />
18
        <ol>
19
            <li>
20
                <label for="itemtype" class="required">Item type code: </label>
21
                <input type="text" name="itemtype" pattern="[0-9A-Za-z]{1,10}" title="Please enter up to 10 letters and/or numbers" id="itemtype" size="10" maxlength="10"  class="required" required="required" value="[% itemtype.itemtype |html %]" />
22
                <span class="required">Required</span>
23
            </li>
15
24
16
[% ELSIF op == "add_validate" %]
25
            <li>
17
        [% IF message != "error_on_insert" %]
26
                <label for="description" class="required">Description: </label>
18
            <form name="createitemtype" method="post" action="onboarding.pl">
27
                <input type="text" name="description" id="description" title="Please only enter letters and/or numbers into this item type description" size="42" value="[% itemtype.description |html %]" class="required" required="required">
19
                <input type="hidden" name="step" value="5"/>
28
                <span class="required">Required</span>
20
                <h1 align="left"> New Item type </h1>
29
            </li>
21
                <div>
30
        </ol>
22
                    <p> Success: New item type created!</p>
31
    <br>
23
                    <p> To create another item type later and for more settings <br>
32
    <p> To create another item type later and for more settings <br>
24
                    go to: <br>
33
            go to: <br>
25
                    More -> Administration -> Item types <br>
34
            More -> Administration -> Item types <br>
26
                </div>
35
    </p>
27
                Next up:
28
                <input type="submit" value="Add a circulation rule"/>
29
            </form>
30
        [% ELSE %]
31
        <form name="retryitem" method="post" action="onboarding.pl">
32
            <input type="hidden" name="step" value="4"/>
33
            <h1 align="left">Failed </h1>
34
            <div>
35
                <p>Item type was not successfully created. </br>
36
                Please try again or contact your system administrator.
37
                </p>
38
            </div>
39
        </form>
40
        <!--Implement a if statement to check if the item type was successfully created or not -->
41
        [% END %]
42
[% ELSE %]
43
    <!--Create a item type screen 1-->
44
        <h1 align="center"> Create a new Item type </h1>
45
        <p> Item types are used to group related items. Examples of item types are books, cds, and DVDs. <br><br> When adding to your institutions catalogue you will create an item of a particular item type. <br><br> Importantly item types are what you apply     circulation rules to. Circulation rules govern how your institution will lend its items, for example a circulation rule applied to the DVD item type may enforce a payment of $1.00 for borrowing any DVD.</p>
46
        <form name="createitemform" method="post" action="onboarding.pl">
47
            <fieldset class="rows">
48
                <input type="hidden" name="step" value="4"/>
49
                <input type="hidden" name="op" value="add_validate" />
50
                <ol>
51
                    <li>
52
                        <label for="itemtype" class="required">Item type code: </label>
53
                        <input type="text" name="itemtype" pattern="[0-9A-Za-z]{1,10}" title="Please enter up to 10 letters and/or numbers" id="itemtype" size="10" maxlength="10"  class="required" required="required" value="[% itemtype.itemtype |html %]" />
54
                        <span class="required">Required</span>
55
                    </li>
56
36
57
                    <li>
37
    <input type="submit" class="action" value="Submit"/>
58
                        <label for="description" class="required">Description: </label>
38
</fieldset>
59
                        <input type="text" name="description" id="description" title="Please only enter letters and/or numbers into this item type description" size="42" value="[% itemtype.description |html %]" class="required" required="required">
39
</form>
60
                        <span class="required">Required</span>
61
                    </li>
62
                </ol>
63
            <br>
64
            <input type="submit" class="action" value="Submit"/>
65
        </fieldset>
66
        </form>
67
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep5.tt (-113 / +102 lines)
Lines 1-127 Link Here
1
[% INCLUDE 'doc-head-open.inc' %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Create Circulation rule</title>
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' %]
3
[% INCLUDE 'installer-doc-head-close.inc' %]
4
[% INCLUDE 'validator-strings.inc' %]
5
[% INCLUDE 'installer-strings.inc' %]
6
<script type="text/javascript" src="[% interface %]/[% theme %]/js/onboarding.js"></script>
7
</head>
5
8
6
<div>
9
<body id="installer" class="installer">
7
    <h1 id="logo"><img alt="Koha" src="[% interface %]/[% theme %]/img/koha.org-logo.gif"/> Welcome to Koha</h1>
8
</div>
9
10
10
[% IF (finish) %]
11
[% INCLUDE 'onboarding_messages.inc' %]
12
13
[% IF all_done %]
11
<h1>Congratulations you have finished and ready to use Koha</h1>
14
<h1>Congratulations you have finished and ready to use Koha</h1>
12
<a href="/cgi-bin/koha/mainpage.pl">Start using Koha</a>
15
<a href="/cgi-bin/koha/mainpage.pl">Start using Koha</a>
13
14
[% END %]
15
16
<!--Create a circulation rule screen 2-->
17
[% IF op == "add_validate" %]
18
        <!--New circulation rule created-->
19
        <form name="finish" method="post" action="onboarding.pl">
20
            <input type="hidden" name="op" value="finish" />
21
            <h1 align="left"> New circulation rule </h1>
22
            <div>
23
                 <p> Success: circulation rule created!</p>
24
                 <p> To create circulation rule, go to <br>
25
                 More -> Administration -> Circulation and Fine Rules
26
            </div>
27
                 Next up:
28
                 <input type="submit" name="op" value="Finish"/>
29
        </form>
30
[% ELSE %]
16
[% ELSE %]
31
<!--Create a circulation rule screen 1-->
17
    <h1 align="left"> Create a new circulation rule </h1>
32
       <h1 align="left"> Create a new circulation rule </h1>
18
    <form name="createcirculationrule" method="post" action="onboarding.pl">
33
       <form name="createcirculationrule" method="post" action="onboarding.pl">
19
        <fieldset class="rows">
34
            <fieldset class="rows">
20
           <input type="hidden" name="step" value="5"/>
35
                 <input type="hidden" name="step" value="5"/>
21
           <input type="hidden" name="op" value="add_validate_circ_rule" />
36
                 <input type="hidden" name="op" value="add_validate" />
22
              <ol>
37
                    <ol>
23
              <li>
38
                    <li>
24
                  <label for="branch" class="required"> Library branch</label>
39
                        <label for="branch" class="required"> Library branch</label>
25
                  <select name="branch" id="branchname" required="required">
40
                        <select name="branch" id="branchname" required="required">
26
                  <option value""> Choose</option>
41
                        <option value""> Choose</option>
27
                  <option value="*" selected="selected">All</option>
42
                        <option value="*" selected="selected">All</option>
28
                  [% FOREACH library IN libraries %]
43
                        [% FOREACH library IN libraries %]
29
                      <option id="branch" value="[% library.branchcode %]"> [% library.branchname %]</option>
44
                            <option id="branch" value="[% library.branchcode %]"> [% library.branchname %]</option>
30
                  [% END %]
45
                        [% END %]
31
                  </select>
46
                        </select>
32
                  <span class="required">Required</span>
47
                        <span class="required">Required</span>
33
              </li>
48
                    </li>
34
              <li>
49
                    <li>
35
                  <label for="categorycode" class="required">Patron category: </label>
50
                        <label for="categorycode" class="required">Patron category: </label>
36
                  <select name="categorycode" id="categorycodeselection" required="required" onchange = "update_categorycode(this);">
51
                        <select name="categorycode" id="categorycodeselection" required="required" onchange = "update_categorycode(this);">
37
                      <option value=""> Choose</option>
52
                            <option value=""> Choose</option>
38
                      <option value="*" selected="selected">All</option>
53
                            <option value="*" selected="selected">All</option>
39
                      [% FOREACH category IN categories %]
54
                            [% FOREACH category IN categories %]
40
                          <option id="categorycode" value = "[% category.categorycode %]"> [%category.description %]</option>
55
                                <option id="categorycode" value = "[% category.categorycode %]"> [%category.description %]</option>
41
                      [%END%]
56
                            [%END%]
42
                  </select>
57
                        </select>
43
                  <span class="required">Required</span>
58
                        <span class="required">Required</span>
44
              </li>
59
                    </li>
45
46
              <li>
47
                  <label for="itemtype"> Item type: </label>
48
                  <select id="itemtype" name="itemtype" required="required">
49
                  <option value""> Choose </option>
50
                  <option value="*" selected="selected">All</option>
51
                      [% FOREACH item IN itemtypes %]
52
                          <option name="itemtype" value = "[% item.itemtype %]"> [% item.itemtype %]
53
                      [%END%]
54
                  </select>
55
                  <span class="required"> Required</span>
56
              </li>
57
              <li>
58
                  <label for="maxissueqty" class="required">Current checkouts allowed: </label>
59
                  <input type="number" min="0" name="maxissueqty" title="Please only enter numbers" id="maxissueqty" size="10" value="50" class="required" required="required" />
60
                  <span class="required">Required</span>
61
              </li>
60
62
61
                    <li>
63
              <li>
62
                        <label for="itemtype"> Item type: </label>
64
                  <label for="issuelength" class="required">Loan period: </label>
63
                        <select id="itemtype" name="itemtype" required="required">
65
                  <input type="number" min="0" name="issuelength" title="Please only enter numbers" id="issuelength" size="10" value="14" class="required" required="required" />
64
                        <option value""> Choose </option>
66
                  <span class="required">Required</span>
65
                        <option value="*" selected="selected">All</option>
67
             </li>
66
                            [% FOREACH item IN itemtypes %]
68
             <li>
67
                                <option name="itemtype" value = "[% item.itemtype %]"> [% item.itemtype %]
69
                  <label for="lengthunit">Units: </label>
68
                            [%END%]
70
                  <select name="lengthunit" id="lengthunit" required="required">
69
                        </select>
71
                  <option value=""> Choose </option>
70
                        <span class="required"> Required</span>
72
                  [% SET units = 'days' %]
71
                    </li>
73
                  [% IF category %]
72
                    <li>
74
                      [% SET default_privacy = category.default_privacy %]
73
                        <label for="maxissueqty" class="required">Current checkouts allowed: </label>
75
                  [% END %]
74
                        <input type="number" min="0" name="maxissueqty" title="Please only enter numbers" id="maxissueqty" size="10" max="10" value="" class="required" required="required" />
75
                        <span class="required">Required</span>
76
                    </li>
77
76
78
                    <li>
77
                  [% SWITCH units %]
79
                        <label for="issuelength" class="required">Loan period: </label>
78
                       [% CASE 'days' %]
80
                        <input type="number" min="0" name="issuelength" title="Please only enter numbers" id="issuelength" size="10" max="10" value="" class="required" required="required" />
79
                             <option value="days" selected="selected">Days</option>
81
                        <span class="required">Required</span>
80
                             <option value="hours">Hours</option>
82
                   </li>
81
                       [% CASE 'hours' %]
83
                   <li>
82
                             <option value="days">Days</option>
84
                        <label for="lengthunit">Units: </label>
83
                             <option value="hours" selected="selected">Hours</option>
85
                        <select name="lengthunit" id="lengthunit" required="required">
84
                  [% END %]
86
                        <option value=""> Choose </option>
85
                  </select>
87
                        [% SET units = 'days' %]
86
               </li>
88
                        [% IF category %]
87
               <li>
89
                            [% SET default_privacy = category.default_privacy %]
88
                  <label for="renewalsallowed" class="required">Renewals allowed: </label>
90
                        [% END %]
89
                  <input type="number" min="0" name="renewalsallowed" title="Please only enter numbers" id="renewalsallowed" size="10" max="10" value="10" class="required" required="required" />
90
                  <span class="required">Required</span>
91
               </li>
91
92
92
                        [% SWITCH units %]
93
               <li>
93
                             [% CASE 'days' %]
94
                  <label for="renewalperiod" class="required">Renewals period: </label>
94
                                   <option value="days" selected="selected">Days</option>
95
                  <input type="number" min="0" name="renewalperiod" title="Please only enter numbers" id="renewalperiod" size="10" value="14" class="required" required="required" />
95
                                   <option value="hours">Hours</option>
96
                  <span class="required">Required</span>
96
                             [% CASE 'hours' %]
97
               </li>
97
                                   <option value="days">Days</option>
98
                                   <option value="hours" selected="selected">Hours</option>
99
                        [% END %]
100
                        </select>
101
                     </li>
102
                     <li>
103
                        <label for="renewalsallowed" class="required">Renewals allowed: </label>
104
                        <input type="number" min="0" name="renewalsallowed" title="Please only enter numbers" id="renewalsallowed" size="10" max="10" value="" class="required" required="required" />
105
                        <span class="required">Required</span>
106
                     </li>
107
98
108
                     <li>
99
               <li>
109
                        <label for="renewalperiod" class="required">Renewals period: </label>
100
                  <label for="onshelfholds">On shelf holds allowed: </label>
110
                        <input type="number" min="0" name="renewalperiod" title="Please only enter numbers" id="renewalperiod" size="10" max="10" value="" class="required" required="required" />
101
                  <select name="onshelfholds" id="onshelfholds" required="required">
111
                        <span class="required">Required</span>
102
                        <option value="">Choose</option>
112
                     </li>
103
                        <option value="1" selected="selected">Yes</option>
104
                        <option value="0">If any unavailable</option>
105
                        <option value="2">If all unavailable</option>
106
                  </select>
107
               </li>
108
            </ol>
109
            <p> To create circulation rule, go to <br>
110
            More -> Administration -> Circulation and Fine Rules
111
            </p>
113
112
114
                     <li>
113
        </fieldset><br>
115
                        <label for="onshelfholds">On shelf holds allowed: </label>
114
        <input type="submit" class="action" value="Submit"/>
116
                        <select name="onshelfholds" id="onshelfholds" required="required">
115
    </form>
117
                              <option value="">Choose</option>
118
                              <option value="1" selected="selected">Yes</option>
119
                              <option value="0">If any unavailable</option>
120
                              <option value="2">If all unavailable</option>
121
                        </select>
122
                     </li>
123
                  </ol>
124
            </fieldset><br>
125
                <input type="submit" class="action" value="Submit"/>
126
     </form>
127
[% END %]
116
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/js/onboarding.js (-1 / +150 lines)
Line 0 Link Here
0
- 
1
function _(s) { return s; } // dummy function for gettext
2
3
jQuery.validator.addMethod( "category_code_check", function(value,element){
4
    var patt = /^[A-Za-z]{0,10}$/g;
5
    if (patt.test(element.value)) {
6
        return true;
7
    } else {
8
        return false;
9
    }
10
    }, MSG_LETTERS_ONLY
11
);
12
13
jQuery.validator.addMethod( "letters_only", function(value,element){
14
        var patt =/^[A-Za-z ]{0,30}$/g;
15
        if (patt.test(element.value)){
16
            return true;
17
        } else {
18
            return false;
19
        }
20
    }, MSG_LETTERS_ONLY
21
);
22
23
jQuery.validator.addMethod( "enrollment_period", function(){
24
      enrolmentperiod = $("#enrolmentperiod").val();
25
      enrolmentperioddate = $("#enrolmentperioddate").val();
26
      if (( $("#enrolmentperiod").val() === "" && $("#enrolmentperioddate").val() === "") || ($("#enrolmentperiod").val() !== "" && $("#enrolmentperioddate").val() !== "")) {
27
             return false;
28
      } else {
29
             return true;
30
      }
31
    }, MSG_ONLY_ONE_ENROLLMENTPERIOD
32
);
33
34
jQuery.validator.addMethod( "password_match", function(value,element){
35
        var MSG_PASSWORD_MISMATCH = ( MSG_PASSWORD_MISMATCH );
36
        var password = document.getElementById('password').value;
37
        var confirmpassword = document.getElementById('password2').value;
38
39
        if ( password != confirmpassword ){
40
               return false;
41
          }
42
          else{
43
               return true;
44
          }
45
    },  MSG_PASSWORD_MISMATCH
46
);
47
48
jQuery.validator.addMethod( "cardnumber_check", function(value,element){
49
          var patt =/[A-Za-z1-9 ]+$/g;
50
          if (patt.test(element.value)){
51
              return true;
52
          } else {
53
              return false;
54
          }
55
     }, MSG_LETTERS_NUMBERS_ONLY
56
);
57
58
function toUC(f) {
59
    var x=f.value.toUpperCase();
60
    f.value=x;
61
    return true;
62
}
63
64
$(document).ready(function() {
65
    if ($("#branches option:selected").length < 1) {
66
        $("#branches option:first").attr("selected", "selected");
67
    }
68
    $("#categorycode").on("blur",function(){
69
         toUC(this);
70
    });
71
72
    $("#enrolmentperioddate").datepicker({
73
        minDate: 1
74
    }); // Require that "until date" be in the future
75
76
    $("#category_form").validate({
77
        rules: {
78
            categorycode: {
79
                    required: true,
80
                    category_code_check: true
81
            },
82
            description: {
83
                    required:true
84
            },
85
            enrolmentperiod: {
86
                   required: function(element){
87
                         return $("#enrolmentperioddate").val() === "";
88
                   },
89
                   digits: true,
90
                   enrollment_period: true,
91
            },
92
            enrolmentperioddate: {
93
                    required: function(element){
94
                        return $("#enrolmentperiod").val() === "";
95
                    },
96
                    enrollment_period: true,
97
                    // is_valid_date ($(#"enrolementperioddate").val());
98
            },
99
            dateofbirthrequired: {
100
                    digits: true
101
            },
102
            upperagelimit: {
103
                    digits: true
104
            },
105
            enrolmentfee: {
106
                    number: true
107
            },
108
            reservefee: {
109
                    number: true
110
            },
111
            category_type: {
112
                    required: true
113
            }
114
        },
115
        messages: {
116
            enrolmentperiod: {
117
                    required: MSG_ONE_ENROLLMENTPERIOD
118
            },
119
            enrolmentperioddate: {
120
                    required: MSG_ONE_ENROLLMENTPERIOD
121
            }
122
        }
123
    });
124
125
    $("#createpatron").validate({
126
        rules: {
127
            surname: {
128
                required: true
129
            },
130
            firstname: {
131
                required: true
132
            },
133
            cardnumber: {
134
                required: true
135
            },
136
            password: {
137
                password_match: true
138
            }
139
        },
140
        messages: {
141
            password: {
142
                required: MSG_PASSWORD_MISMATCH
143
            },
144
        }
145
146
    });
147
148
    $("#createitemform").validate();
149
    $("#createcirculationrule").validate();
150
});

Return to bug 18462