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

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

Return to bug 17855