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 (-80 / +109 lines)
Lines 1-5 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;
Lines 100-105 if ( $start && $start eq 'Start setting up my Koha' ){ Link Here
100
              ]
118
              ]
101
    );
119
    );
102
120
121
122
}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
124
    my $categories = Koha::Patron::Categories->search(); 
125
    $template->param(
126
        categories => $categories,
127
    );
128
129
103
#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 
104
}elsif ( $step && $step == 1 ) {
131
}elsif ( $step && $step == 1 ) {
105
    my $createlibrary = $query->param('createlibrary'); #Store the inputted library branch code and name in $createlibrary variable
132
    my $createlibrary = $query->param('createlibrary'); #Store the inputted library branch code and name in $createlibrary variable
Lines 107-112 if ( $start && $start eq 'Start setting up my Koha' ){ Link Here
107
134
108
    #store inputted parameters in variables
135
    #store inputted parameters in variables
109
    my $branchcode       = $input->param('branchcode');
136
    my $branchcode       = $input->param('branchcode');
137
    $branchcode = uc($branchcode);
110
    my $categorycode     = $input->param('categorycode');
138
    my $categorycode     = $input->param('categorycode');
111
    my $op               = $input->param('op') || 'list';
139
    my $op               = $input->param('op') || 'list';
112
    my $message;
140
    my $message;
Lines 134-230 if ( $start && $start eq 'Start setting up my Koha' ){ Link Here
134
       $message = 'error_on_insert';
162
       $message = 'error_on_insert';
135
    }
163
    }
136
164
137
    $template->param('message' => $message); 
165
    $template->param('message' => $message);
138
166
139
167
140
#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
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
141
}elsif ( $step && $step == 2 ){
169
}elsif ( $step && $step == 2 ){
142
    my $createcat = $query->param('createcat'); #Store the inputted category code and name in $createcat
170
      my $createcat = $query->param('createcat'); #Store the inputted category code and name in $createcat
143
    $template->param('createcat'=>$createcat);
171
      $template->param('createcat'=>$createcat);
144
172
145
#Select all the patron category records in the categories database table and give them to the template
173
     #Initialising values
146
    my $categories = Koha::Patron::Categories->search(); 
174
     my $searchfield   = $input->param('description') // q||;
147
    $template->param(
175
     my $categorycode  = $input->param('categorycode');
148
        categories => $categories,
176
     my $op            = $input->param('op') // 'list';
149
    );
177
     my $message;
150
178
     my $category;
151
    #Initialising values
179
     $template->param('categorycode' =>$categorycode);
152
    my $searchfield   = $input->param('description') // q||;
180
153
    my $categorycode  = $input->param('categorycode');
181
     my ( $template, $loggedinuser, $cookie ) =  C4::InstallAuth::get_template_and_user(
154
    my $op            = $input->param('op') // 'list';
182
     {
155
    my $message;
156
    my $category;
157
    $template->param('categorycode' =>$categorycode);
158
159
    my ( $template, $loggedinuser, $cookie ) =  C4::InstallAuth::get_template_and_user(
160
    {
161
        template_name   => "/onboarding/onboardingstep2.tt",
183
        template_name   => "/onboarding/onboardingstep2.tt",
162
        query           => $input,
184
        query           => $input,
163
        type            => "intranet",
185
        type            => "intranet",
164
        authnotrequired => 0,
186
        authnotrequired => 0,
165
        flagsrequired   => { parameters => 'parameters_remaining_permissions' },
187
        flagsrequired   => { parameters => 'parameters_remaining_permissions' },
166
        debug           => 1,
188
        debug           => 1,
167
    }
189
        }
168
    );
190
    );
169
191
170
    #Once the user submits the page, this code validates the input and adds it
192
#Once the user submits the page, this code validates the input and adds it
171
    #to the database as a new patron category 
193
#to the database as a new patron category
172
    $categorycode = $input->param('categorycode');
194
173
    my $description = $input->param('description');
195
        $categorycode = $input->param('categorycode');
174
    my $overduenoticerequired = $input->param('overduenoticerequired');
196
        $categorycode = uc($categorycode);
175
    my $category_type = $input->param('category_type');
197
        my $description = $input->param('description');
176
    my $default_privacy = $input->param('default_privacy');
198
        my $overduenoticerequired = $input->param('overduenoticerequired');
177
    my $enrolmentperiod = $input->param('enrolmentperiod');
199
        my $category_type = $input->param('category_type');
178
    my $enrolmentperioddate = $input->param('enrolmentperioddate') || undef;
200
        my $default_privacy = $input->param('default_privacy');
179
201
        my $enrolmentperiod = $input->param('enrolmentperiod');
180
    #Converts the string into a date format
202
        my $enrolmentperioddate = $input->param('enrolmentperioddate') || undef;
181
    if ( $enrolmentperioddate) {
203
182
         $enrolmentperioddate = output_pref(
204
#Converts the string into a date format
205
        if ( $enrolmentperioddate) {
206
            $enrolmentperioddate = output_pref(
183
                    {
207
                    {
184
                        dt         => dt_from_string($enrolmentperioddate),
208
                    dt         => dt_from_string($enrolmentperioddate),
185
                        dateformat => 'iso',
209
                    dateformat => 'iso',
186
                        dateonly   => 1,
210
                    dateonly   => 1,
187
                    }
211
                    }
188
            );
212
            );
189
    }
213
        }
190
191
    #Adds a new patron category to the database
192
    $category = Koha::Patron::Category->new({
193
             categorycode=> $categorycode,
194
             description => $description,
195
             overduenoticerequired => $overduenoticerequired,
196
             category_type=> $category_type,
197
             default_privacy => $default_privacy,
198
             enrolmentperiod => $enrolmentperiod,
199
             enrolmentperioddate => $enrolmentperioddate,
200
    });
201
214
202
    eval {
215
#Adds a new patron category to the database
203
         $category->store;
216
        $category = Koha::Patron::Category->new({
204
    };
217
                categorycode=> $categorycode,
218
                description => $description,
219
                overduenoticerequired => $overduenoticerequired,
220
                category_type=> $category_type,
221
                default_privacy => $default_privacy,
222
                enrolmentperiod => $enrolmentperiod,
223
                enrolmentperioddate => $enrolmentperioddate,
224
        });
225
226
        eval {
227
            $category->store;
228
        };
205
229
206
    #Error messages
230
#Error messages
207
    if($category){
231
        if($category){
208
         $message = 'success_on_insert';
232
            $message = 'success_on_insert';
209
    }else{
233
        }else{
210
         $message = 'error_on_insert';
234
            $message = 'error_on_insert';
211
    }
235
        }
212
236
213
    $template->param('message' => $message); 
237
        $template->param('message' => $message); 
214
238
215
#Create a patron
239
#Create a patron
216
}elsif ( $step && $step == 3 ){
240
}elsif ( $step && $step == 3 ){
217
    my $firstpassword = $input->param('password');
241
    my $firstpassword = $input->param('password');
218
    my $secondpassword = $input->param('password2');
242
    my $secondpassword = $input->param('password2');
219
243
220
221
    if ($firstpassword ne $secondpassword){
222
            my $DisplayError='Please rewrite the password';
223
            warn $DisplayError;
224
            $template->param(DisplayError=>$DisplayError,
225
            );
226
    }
227
228
#Find all library records in the database and hand them to the template to display in the library dropdown box
244
#Find all library records in the database and hand them to the template to display in the library dropdown box
229
    my $libraries = Koha::Libraries->search( {}, { order_by => ['branchcode'] }, );
245
    my $libraries = Koha::Libraries->search( {}, { order_by => ['branchcode'] }, );
230
    $template->param(libraries   => $libraries,
246
    $template->param(libraries   => $libraries,
Lines 244-249 if ( $start && $start eq 'Start setting up my Koha' ){ Link Here
244
            categories => $categories,
260
            categories => $categories,
245
    );
261
    );
246
262
263
#Incrementing the highest existing patron cardnumber to prevent duplicate cardnumber entry
264
    my $exisiting_cardnumber = my $sth_search = $dbh->prepare("SELECT MAX(cardnumber) FROM borrowers");
265
    my $new_cardnumber = $exisiting_cardnumber + 1;
266
    warn $new_cardnumber;
267
    $template->param("newcardnumber" => $new_cardnumber);
268
269
270
247
    my $op = $input->param('op') // 'list';
271
    my $op = $input->param('op') // 'list';
248
    my $minpw = C4::Context->preference("minPasswordLength");
272
    my $minpw = C4::Context->preference("minPasswordLength");
249
    $template->param("minPasswordLength" => $minpw);
273
    $template->param("minPasswordLength" => $minpw);
Lines 251-263 if ( $start && $start eq 'Start setting up my Koha' ){ Link Here
251
    my @messages;
275
    my @messages;
252
    my @errors;
276
    my @errors;
253
    my $nok = $input->param('nok');
277
    my $nok = $input->param('nok');
254
255
    my $firstpassword = $input->param('password');
278
    my $firstpassword = $input->param('password');
256
    my $secondpassword = $input->param('password2');
279
    my $secondpassword = $input->param('password2');
257
    my $cardnumber= $input->param('cardnumber');
280
    my $cardnumber= $input->param('cardnumber');
258
    my $borrowernumber= $input->param('borrowernumber');
281
    my $borrowernumber= $input->param('borrowernumber');
259
    my $userid=$input->param('userid');
282
    my $userid=$input->param('userid');
260
283
284
#If the entered cardnumber causes an error hand this error to the @errors array
261
    if(my $error_code = checkcardnumber($cardnumber, $borrowernumber)){
285
    if(my $error_code = checkcardnumber($cardnumber, $borrowernumber)){
262
            push @errors, $error_code == 1
286
            push @errors, $error_code == 1
263
                ? 'ERROR_cardnumber_already_exists'
287
                ? 'ERROR_cardnumber_already_exists'
Lines 266-271 if ( $start && $start eq 'Start setting up my Koha' ){ Link Here
266
                    :()
290
                    :()
267
    }
291
    }
268
292
293
#If the entered password causes an error hand this error to the @errors array
269
  push @errors, "ERROR_password_mismatch" if $firstpassword ne $secondpassword;
294
  push @errors, "ERROR_password_mismatch" if $firstpassword ne $secondpassword;
270
  push @errors, "ERROR_short_password" if ($firstpassword && $minpw && $firstpassword ne '****' && (length($firstpassword) < $minpw));
295
  push @errors, "ERROR_short_password" if ($firstpassword && $minpw && $firstpassword ne '****' && (length($firstpassword) < $minpw));
271
296
Lines 273-280 if ( $start && $start eq 'Start setting up my Koha' ){ Link Here
273
#Passing errors to template
298
#Passing errors to template
274
   $nok = $nok || scalar(@errors);
299
   $nok = $nok || scalar(@errors);
275
300
301
#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
276
   if($nok){
302
   if($nok){
277
278
      foreach my $error (@errors){
303
      foreach my $error (@errors){
279
          if ($error eq 'ERROR_password_mismatch'){
304
          if ($error eq 'ERROR_password_mismatch'){
280
              $template->param(errorpasswordmismatch => 1);
305
              $template->param(errorpasswordmismatch => 1);
Lines 293-300 if ( $start && $start eq 'Start setting up my Koha' ){ Link Here
293
           }
318
           }
294
       }
319
       }
295
        $template->param('nok' => 1);
320
        $template->param('nok' => 1);
296
        warn $nok;
321
   
297
    }else{
322
#Else if no errors have been caused by the users inputted card number or password then insert the patron into the borrowers table
323
   }else{
298
    my ($template, $loggedinuser, $cookie)= C4::InstallAuth::get_template_and_user({
324
    my ($template, $loggedinuser, $cookie)= C4::InstallAuth::get_template_and_user({
299
                template_name => "/onboarding/onboardingstep3.tt",
325
                template_name => "/onboarding/onboardingstep3.tt",
300
                query => $input,
326
                query => $input,
Lines 370-378 if ( $start && $start eq 'Start setting up my Koha' ){ Link Here
370
    my $createitemtype = $input->param('createitemtype');
396
    my $createitemtype = $input->param('createitemtype');
371
    $template->param('createitemtype'=> $createitemtype );
397
    $template->param('createitemtype'=> $createitemtype );
372
398
373
    my $itemtype_code = $input->param('itemtype');
374
    my $op = $input->param('op') // 'list';
375
    my $message;
376
399
377
    my( $template, $borrowernumber, $cookie) = C4::InstallAuth::get_template_and_user(
400
    my( $template, $borrowernumber, $cookie) = C4::InstallAuth::get_template_and_user(
378
            {   template_name   => "/onboarding/onboardingstep4.tt",
401
            {   template_name   => "/onboarding/onboardingstep4.tt",
Lines 386-400 if ( $start && $start eq 'Start setting up my Koha' ){ Link Here
386
409
387
    if($op eq 'add_validate'){
410
    if($op eq 'add_validate'){
388
        my $description = $input->param('description');
411
        my $description = $input->param('description');
389
412
        my $itemtype_code = $input->param('itemtype');
390
        #store the input from the form - only 2 fields 
413
        $itemtype_code = uc($itemtype_code);
414
        #Create a new itemtype object using the user inputted itemtype and description
391
        my $itemtype= Koha::ItemType->new(
415
        my $itemtype= Koha::ItemType->new(
392
            { itemtype    => $itemtype_code,
416
            { itemtype    => $itemtype_code,
393
              description => $description,
417
              description => $description,
394
            }
418
            }
395
        );
419
        );
420
396
        eval{ $itemtype->store; };
421
        eval{ $itemtype->store; };
397
        #Error messages
422
423
        my $message;
424
425
#Fill the $message variable with an error if the item type object was not successfully created and inserted into the itemtypes table
398
        if($itemtype){
426
        if($itemtype){
399
            $message = 'success_on_insert';
427
            $message = 'success_on_insert';
400
        }else{
428
        }else{
Lines 442-449 if ( $start && $start eq 'Start setting up my Koha' ){ Link Here
442
                debug => 1,
470
                debug => 1,
443
    });
471
    });
444
472
473
#If no libraries exist then set the $branch value to *
445
    my $branch = $input->param('branch');
474
    my $branch = $input->param('branch');
446
 unless ( $branch ) {
475
    unless ( $branch ) {
447
          if ( C4::Context->preference('DefaultToLoggedInLibraryCircRules') ) {
476
          if ( C4::Context->preference('DefaultToLoggedInLibraryCircRules') ) {
448
                $branch = Koha::Libraries->search->count() == 1 ? undef : C4::Context::mybranch();
477
                $branch = Koha::Libraries->search->count() == 1 ? undef : C4::Context::mybranch();
449
           }
478
           }
Lines 456-462 if ( $start && $start eq 'Start setting up my Koha' ){ Link Here
456
485
457
    if($op eq 'add_validate'){
486
    if($op eq 'add_validate'){
458
        my $type = $input->param('type');
487
        my $type = $input->param('type');
459
        my $br = $branch;
488
        my $br = $input->param('branch');
460
        my $bor = $input->param('categorycode');
489
        my $bor = $input->param('categorycode');
461
        my $itemtype = $input->param('itemtype');
490
        my $itemtype = $input->param('itemtype');
462
        my $maxissueqty = $input->param('maxissueqty');
491
        my $maxissueqty = $input->param('maxissueqty');
Lines 541-547 if ( $start && $start eq 'Start setting up my Koha' ){ Link Here
541
            if ($res->{total}) {
570
            if ($res->{total}) {
542
                $sth_update->execute($onshelfholds, $branch);
571
                $sth_update->execute($onshelfholds, $branch);
543
            } else {
572
            } else {
544
            $sth_insert->execute($branch, $onshelfholds);
573
                 $sth_insert->execute($branch, $onshelfholds);
545
            }
574
            }
546
        }
575
        }
547
576
(-)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/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"> You haven't installed some sample data, so we're just going to set up a few more 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 (-34 / +10 lines)
Lines 4-42 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-->
38
<div>
10
<div>
39
    <h1 align="center"> Welcome to Koha test if in correct repo</h1>
11
    <h1 align="center"> Welcome to Koha</h1>
40
    <h1 id="logo"><img alt="Koha" style="width:50%;margin:auto;display:block;align:center;"  src="[% interface %]/[% theme %]/img/koha.org-logo.gif"/></h1>
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>
41
</div>
13
</div>
42
 [% IF libraries.count > 0 %]
14
 [% IF libraries.count > 0 %]
Lines 59-65 Link Here
59
                <div>
31
                <div>
60
                    <p> Success: Library created!</p>
32
                    <p> Success: Library created!</p>
61
                    <p> To add another library and for more settings, <br>
33
                    <p> To add another library and for more settings, <br>
62
                    go to Tools->Administration->Libraries and Groups
34
                    go to:<br><br>
35
                    More->Administration->Libraries and groups<br>
36
                    OR<br>
37
                    Administration->Libraries and groups
38
                    </p>
63
                </div>
39
                </div>
64
                Next up:
40
                Next up:
65
                <input type="submit" name="start" value="Add a patron category"/>
41
                <input type="submit" name="start" value="Add a patron category"/>
Lines 87-98 Link Here
87
                 <ol>
63
                 <ol>
88
                     <li>
64
                     <li>
89
                        <label for="branchcode" class="required">Library code: </label>
65
                        <label for="branchcode" class="required">Library code: </label>
90
                        <input type="text"  pattern="[A-Z]{3}" title="Please enter 3 capital letters" name="branchcode" id="branchcode" size="10" maxlength="10" value="[% library.branchcode |html %]" class="required" required="required" />
66
                        <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" />
91
                        <span class="required">Required</span>
67
                        <span class="required">Required</span>
92
                    </li>
68
                    </li>
93
                    <li>
69
                    <li>
94
                        <label for="branchname" class="required">Name: </label>
70
                        <label for="branchname" class="required">Name: </label>
95
                        <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;">
71
                        <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;">
96
                        <span class="required">Required</span>
72
                        <span class="required">Required</span>
97
                    </li>
73
                    </li>
98
                 </ol>
74
                 </ol>
Lines 100-107 Link Here
100
             <br>
76
             <br>
101
             <input type="submit" class="action" value="Submit"/>
77
             <input type="submit" class="action" value="Submit"/>
102
     </form>
78
     </form>
103
[% END %]  
79
[% END %]
104
    
80
105
81
106
82
107
83
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep2.tt (-214 / +240 lines)
Lines 6-34 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
<script type="text/javascript">
10
     var MSG_CATEGORYCODE_CHARS = (_("Category code can only contain the following characters: letters, numbers, - and _."));
11
     var MSG_ONE_ENROLLMENTPERIOD =(_("Please choose an enrollment period in months OR by date."));
12
</script>
13
<script type="text/javascript">
14
jQuery.validator.addMethod( "letters_numbers", function(value,element){
15
    var patt = /^[a-zA-Z0-9\-_]+$/g;
16
    if (patt.test(element.value)) {
17
        return true;
18
    } else {
19
        return false;
20
    }
21
}, MSG_CATEGORYCODE_CHARS);
22
9
23
jQuery.validator.addMethod( "enrollment_period", function(){
10
<script type="text/javascript">
24
    enrolmentperiod = $("#enrolmentperiod").val();
11
//<![CDATA[
25
    enrolmentperioddate = $("#enrolmentperioddate").val();
26
    if ( $("#enrolmentperiod").val() !== "" && $("#enrolmentperioddate").val() !== "" ) {
27
        return false;
28
    } else {
29
        return true;
30
    }
31
}, MSG_ONE_ENROLLMENTPERIOD);
32
12
33
var debug    = "";
13
var debug    = "";
34
var dformat  = "us";
14
var dformat  = "us";
Lines 37-243 if (debug > 1) {alert("dateformat: " + dformat + "\ndebug is on (level " + debug Link Here
37
var MSG_PLEASE_ENTER_A_VALID_DATE = (_("Please enter a valid date (should match %s)."));
17
var MSG_PLEASE_ENTER_A_VALID_DATE = (_("Please enter a valid date (should match %s)."));
38
18
39
function is_valid_date(date) {
19
function is_valid_date(date) {
40
  // An empty string is considered as a valid date for convenient reasons.
20
        // An empty string is considered as a valid date for convenient reasons.
41
  if ( date === '' ) return 1;
21
        if ( date === '' ) return 1;
42
    var dateformat = dateformat_str = 'us';
22
        var dateformat = dateformat_str = 'us';
43
    if ( dateformat == 'us' ) {
23
        if ( dateformat == 'us' ) {
44
        if ( date.search(/^\d{2}\/\d{2}\/\d{4}($|\s)/) == -1 ) return 0;
24
           if ( date.search(/^\d{2}\/\d{2}\/\d{4}($|\s)/) == -1 ) return 0;
45
        dateformat = 'mm/dd/yy';
25
                  dateformat = 'mm/dd/yy';
46
    } else if ( dateformat == 'metric' ) {
26
           } else if ( dateformat == 'metric' ) {
47
        if ( date.search(/^\d{2}\/\d{2}\/\d{4}($|\s)/) == -1 ) return 0;
27
                  if ( date.search(/^\d{2}\/\d{2}\/\d{4}($|\s)/) == -1 ) return 0;
48
        dateformat = 'dd/mm/yy';
28
                  dateformat = 'dd/mm/yy';
49
    } else if (dateformat == 'iso' ) {
29
           } else if (dateformat == 'iso' ) {
50
        if ( date.search(/^\d{4}-\d{2}-\d{2}($|\s)/) == -1 ) return 0;
30
                  if ( date.search(/^\d{4}-\d{2}-\d{2}($|\s)/) == -1 ) return 0;
51
        dateformat = 'yy-mm-dd';
31
                  dateformat = 'yy-mm-dd';
52
    } else if ( dateformat == 'dmydot' ) {
32
           } else if ( dateformat == 'dmydot' ) {
53
        if ( date.search(/^\d{2}\.\d{2}\.\d{4}($|\s)/) == -1 ) return 0;
33
                  if ( date.search(/^\d{2}\.\d{2}\.\d{4}($|\s)/) == -1 ) return 0;
54
        dateformat = 'dd.mm.yy';
34
                  dateformat = 'dd.mm.yy';
55
    }
35
           }
56
    try {
36
           try {
57
        $.datepicker.parseDate(dateformat, date);
37
               $.datepicker.parseDate(dateformat, date);
58
    } catch (e) {
38
           } catch (e) {
59
        return 0;
39
               return 0;
60
    };
40
           };
61
        return 1;
41
               return 1;
62
}
42
}function get_dateformat_str(dateformat) {
63
43
           var dateformat_str;
64
function get_dateformat_str(dateformat) {
44
           if ( dateformat == 'us' ) {
65
    var dateformat_str;
45
                dateformat_str = 'mm/dd/yyyy';
66
    if ( dateformat == 'us' ) {
46
           } else if ( dateformat == 'metric' ) {
67
         dateformat_str = 'mm/dd/yyyy';
47
                dateformat_str = 'dd/mm/yyyy';
68
    } else if ( dateformat == 'metric' ) {
48
           } else if (dateformat == 'iso' ) {
69
         dateformat_str = 'dd/mm/yyyy';
49
                dateformat_str = 'yyyy-mm-dd';
70
    } else if (dateformat == 'iso' ) {
50
           } else if ( dateformat == 'dmydot' ) {
71
         dateformat_str = 'yyyy-mm-dd';
51
                dateformat_str = 'dd.mm.yyyy';
72
    } else if ( dateformat == 'dmydot' ) {
52
           }
73
         dateformat_str = 'dd.mm.yyyy';
53
           return dateformat_str;
74
    }
75
    return dateformat_str;
76
}
54
}
77
55
78
function validate_date (dateText, inst) {
56
function validate_date (dateText, inst) {
79
    if ( !is_valid_date(dateText) ) {
57
           if ( !is_valid_date(dateText) ) {
80
         var dateformat_str = get_dateformat_str( 'us' );
58
               var dateformat_str = get_dateformat_str( 'us' );
81
         alert(MSG_PLEASE_ENTER_A_VALID_DATE.format(dateformat_str));
59
               alert(MSG_PLEASE_ENTER_A_VALID_DATE.format(dateformat_str));
82
         $('#'+inst.id).val('');
60
               $('#'+inst.id).val('');
83
    }
61
           }
84
}
62
}
85
86
function Date_from_syspref(dstring) {
63
function Date_from_syspref(dstring) {
87
    var dateX = dstring.split(/[-/.]/);
64
            var dateX = dstring.split(/[-/.]/);
88
    if (debug > 1 && sentmsg < 1) {sentmsg++; alert("Date_from_syspref(" + dstring + ") splits to:\n" + dateX.join("\n"));}
65
            if (debug > 1 && sentmsg < 1) {sentmsg++; alert("Date_from_syspref(" + dstring + ") splits to:\n" + dateX.join("\n"));}
89
    if (dformat === "iso") {
66
            if (dformat === "iso") {
90
        return new Date(dateX[0], (dateX[1] - 1), dateX[2]);  // YYYY-MM-DD to (YYYY,m(0-11),d)
67
                return new Date(dateX[0], (dateX[1] - 1), dateX[2]);  // YYYY-MM-DD to (YYYY,m(0-11),d)
91
    } else if (dformat === "us") {
68
            } else if (dformat === "us") {
92
        return new Date(dateX[2], (dateX[0] - 1), dateX[1]);  // MM/DD/YYYY to (YYYY,m(0-11),d)
69
                return new Date(dateX[2], (dateX[0] - 1), dateX[1]);  // MM/DD/YYYY to (YYYY,m(0-11),d)
93
    } else if (dformat === "metric") {
70
            } else if (dformat === "metric") {
94
        return new Date(dateX[2], (dateX[1] - 1), dateX[0]);  // DD/MM/YYYY to (YYYY,m(0-11),d)
71
                return new Date(dateX[2], (dateX[1] - 1), dateX[0]);  // DD/MM/YYYY to (YYYY,m(0-11),d)
95
    } else if (dformat === "dmydot") {
72
            } else if (dformat === "dmydot") {
96
        return new Date(dateX[2], (dateX[1] - 1), dateX[0]);  // DD.MM.YYYY to (YYYY,m(0-11),d)
73
                return new Date(dateX[2], (dateX[1] - 1), dateX[0]);  // DD.MM.YYYY to (YYYY,m(0-11),d)
97
    } else {
74
            } else {
98
        if (debug > 0) {alert("KOHA ERROR - Unrecognized date format: " +dformat);}
75
                if (debug > 0) {alert("KOHA ERROR - Unrecognized date format: " +dformat);}
99
        return 0;
76
                return 0;
100
    }
77
            }
101
}
78
}
102
79
103
function DateTime_from_syspref(date_time) {
80
function DateTime_from_syspref(date_time) {
104
    var parts = date_time.split(" ");
81
           var parts = date_time.split(" ");
105
    var date = parts[0];
82
           var date = parts[0];
106
    var time = parts[1];
83
           var time = parts[1];
107
    parts = time.split(":");
84
           parts = time.split(":");
108
    var hour = parts[0];
85
           var hour = parts[0];
109
    var minute = parts[1];
86
           var minute = parts[1];
110
    if ( hour < 0 || hour > 23 ) {
87
           if ( hour < 0 || hour > 23 ) {
111
         return 0;
88
                   return 0;
112
    }
89
           }
113
    if ( minute < 0 || minute > 59 ) {
90
           if ( minute < 0 || minute > 59 ) {
114
         return 0;
91
                   return 0;
115
    }
92
           }
116
    var datetime = Date_from_syspref( date );
93
           var datetime = Date_from_syspref( date );
117
    if ( isNaN( datetime.getTime() ) ) {
94
           if ( isNaN( datetime.getTime() ) ) {
118
         return 0;
95
                   return 0;
119
    }
96
           }
120
    datetime.setHours( hour );
97
           datetime.setHours( hour );
121
    datetime.setMinutes( minute );
98
           datetime.setMinutes( minute );
122
    return datetime;
99
           return datetime;
123
}
100
}
124
101
125
126
/* Instead of including multiple localization files as you would normally see with
102
/* Instead of including multiple localization files as you would normally see with
127
      jQueryUI we expose the localization strings in the default configuration */
103
      jQueryUI we expose the localization strings in the default configuration */
128
jQuery(function($){
104
jQuery(function($){
129
   $.datepicker.regional[''] = {
105
          $.datepicker.regional[''] = {
130
   closeText: _("Done"),
106
              closeText: _("Done"),
131
   prevText: _("Prev"),
107
              prevText: _("Prev"),
132
   nextText: _("Next"),
108
              nextText: _("Next"),
133
   currentText: _("Today"),
109
              currentText: _("Today"),
134
   monthNames: [_("January"),_("February"),_("March"),_("April"),_("May"),_("June"),
110
              monthNames: [_("January"),_("February"),_("March"),_("April"),_("May"),_("June"),
135
   _("July"),_("August"),_("September"),_("October"),_("November"),_("December")],
111
                           _("July"),_("August"),_("September"),_("October"),_("November"),_("December")],
136
   monthNamesShort: [_("Jan"), _("Feb"), _("Mar"), _("Apr"), _("May"), _("Jun"),
112
              monthNamesShort: [_("Jan"), _("Feb"), _("Mar"), _("Apr"), _("May"), _("Jun"),
137
   _("Jul"), _("Aug"), _("Sep"), _("Oct"), _("Nov"), _("Dec")],
113
                                _("Jul"), _("Aug"), _("Sep"), _("Oct"), _("Nov"), _("Dec")],
138
   dayNames: [_("Sunday"), _("Monday"), _("Tuesday"), _("Wednesday"), _("Thursday"), _("Friday"), _("Saturday")],
114
              dayNames: [_("Sunday"), _("Monday"), _("Tuesday"), _("Wednesday"), _("Thursday"), _("Friday"), _("Saturday")],
139
   dayNamesShort: [_("Sun"), _("Mon"), _("Tue"), _("Wed"), _("Thu"), _("Fri"), _("Sat")],
115
              dayNamesShort: [_("Sun"), _("Mon"), _("Tue"), _("Wed"), _("Thu"), _("Fri"), _("Sat")],
140
   dayNamesMin: [_("Su"),_("Mo"),_("Tu"),_("We"),_("Th"),_("Fr"),_("Sa")],
116
              dayNamesMin: [_("Su"),_("Mo"),_("Tu"),_("We"),_("Th"),_("Fr"),_("Sa")],
141
   weekHeader: _("Wk"),
117
              weekHeader: _("Wk"),
142
   dateFormat: "mm/dd/yy",
118
              dateFormat: "mm/dd/yy",
143
   firstDay: 0,
119
              firstDay: 0,
144
   isRTL: false,
120
              isRTL: false,
145
   showMonthAfterYear: false,
121
              showMonthAfterYear: false,
146
   yearSuffix: ''};
122
              yearSuffix: ''};
147
   $.datepicker.setDefaults($.datepicker.regional['']);
123
              $.datepicker.setDefaults($.datepicker.regional['']);
148
});
124
                                                                                                                                               });
149
125
150
$(document).ready(function(){
126
$(document).ready(function(){
151
127
        $.datepicker.setDefaults({
152
   $.datepicker.setDefaults({
128
             showOn: "both",
153
        showOn: "both",
129
             changeMonth: true,
154
        changeMonth: true,
130
             changeYear: true,
155
        changeYear: true,
131
             buttonImage: '/intranet-tmpl/prog/img/famfamfam/silk/calendar.png',
156
        buttonImage: '/intranet-tmpl/prog/img/famfamfam/silk/calendar.png',
132
             buttonImageOnly: true,
157
        buttonImageOnly: true,
133
             showButtonPanel: true,
158
        showButtonPanel: true,
134
             showOtherMonths: true,
159
        showOtherMonths: true,
135
             selectOtherMonths: true
160
        selectOtherMonths: true
136
        });
161
   });
137
        $( ".datepicker" ).datepicker({
162
   $( ".datepicker" ).datepicker({
163
        onClose: function(dateText, inst) {
164
        validate_date(dateText, inst);
165
   },
166
   }).on("change", function(e, value) {
167
        if ( ! is_valid_date( $(this).val() ) ) {$(this).val("");}
168
   });
169
  // http://jqueryui.com/demos/datepicker/#date-range
170
   var dates = $( ".datepickerfrom, .datepickerto" ).datepicker({
171
        changeMonth: true,
172
        numberOfMonths: 1,
173
        onSelect: function( selectedDate ) {
174
             var option = this.id == "from" ? "minDate" : "maxDate",
175
             instance = $( this ).data( "datepicker" );
176
             date = $.datepicker.parseDate(
177
                  instance.settings.dateFormat ||
178
                  $.datepicker._defaults.dateFormat,
179
                  selectedDate, instance.settings );
180
             dates.not( this ).datepicker( "option", option, date );
181
             },
182
             onClose: function(dateText, inst) {
138
             onClose: function(dateText, inst) {
183
                  validate_date(dateText, inst);
139
             validate_date(dateText, inst);
184
             },
140
             },
185
    }).on("change", function(e, value) {
141
        }).on("change", function(e, value) {
186
    if ( ! is_valid_date( $(this).val() ) ) {$(this).val("");}
142
        if ( ! is_valid_date( $(this).val() ) ) {$(this).val("");}
187
    });
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
            });
188
});
163
});
164
//]]>
165
</script>
189
166
190
$(document).ready(function(){
167
191
     $("#category_form").validate({
168
<script type="text/javascript">
192
         rules: {
169
var MSG_CATEGORYCODE_CHARS=(_("Please only enter letters into this field."));
193
             categorycode: {
170
var MSG_ONE_ENROLLMENTPERIOD =(_("Please choose an enrollment period in months OR by date."));
194
                 required: true,
171
var MSG_ONLY_ONE_ENROLLMENTPERIOD=(_("Please only choose one enrolment period."));
195
                 letters_numbers: true
172
var MSG_DESCRIPTION_LETTERS_ONLY=(_("Please only enter letters."));
196
             },
197
             description: "required",
198
             enrolmentperiod: {
199
                 required: function(element){
200
                    return $("#enrolmentperioddate").val() === "";
201
             },
202
                 digits: true,
203
                 enrollment_period: true
204
             },
205
             enrolmentperioddate: {
206
                 required: function(element){
207
                   return $("#enrolmentperiod").val() === "";
208
                 },
209
                 enrollment_period: true
210
             },
211
             dateofbirthrequired: {
212
                digits: true
213
             },
214
             upperagelimit: {
215
                 digits: true
216
             },
217
             enrolmentfee: {
218
                 number: true
219
             },
220
             reservefee: {
221
                 number: true
222
             },
223
             category_type: {
224
                 required: true
225
             }
226
         },
227
         messages: {
228
             enrolmentperiod: {
229
                 required: MSG_ONE_ENROLLMENTPERIOD
230
             },
231
             enrolmentperioddate: {
232
                 required: MSG_ONE_ENROLLMENTPERIOD
233
             }
234
         }
235
 
236
     });
237
238
})
239
</script>
173
</script>
240
174
175
<script type="text/javascript">
176
jQuery.validator.addMethod( "category_code_check", function(value,element){
177
     var patt = /^[A-Za-z]{0,10}$/g;
178
     if (patt.test(element.value)) {
179
              return true;
180
     } else {
181
              return false;
182
     }
183
}, MSG_CATEGORYCODE_CHARS
184
);
185
jQuery.validator.addMethod( "letters_only", function(value,element){
186
        var patt =/^[A-Za-z ]{0,30}$/g;
187
        if (patt.test(element.value)){
188
            return true;
189
        } else {
190
            return false;
191
        }
192
    }, MSG_DESCRIPTION_LETTERS_ONLY
193
);
194
195
jQuery.validator.addMethod( "enrollment_period", function(){
196
      enrolmentperiod = $("#enrolmentperiod").val();
197
      enrolmentperioddate = $("#enrolmentperioddate").val();
198
      if (( $("#enrolmentperiod").val() == "" && $("#enrolmentperioddate").val() == "") || ($("#enrolmentperiod").val() !== "" && $("#enrolmentperioddate").val() !== "")) {
199
             return false;
200
      } else {
201
             return true;
202
      }
203
    }, MSG_ONLY_ONE_ENROLLMENTPERIOD
204
);
205
206
$(document).ready(function() {
207
      $("#enrolmentperioddate").datepicker({
208
            minDate: 1
209
      }); // Require that "until date" be in the future
210
      if ($("#branches option:selected").length < 1) {
211
          $("#branches option:first").attr("selected", "selected");
212
      }
213
      $("#categorycode").on("blur",function(){
214
           toUC(this);
215
      });
216
      $("#category_form").validate({
217
                rules: {
218
                     categorycode: {
219
                            required: true,
220
                            category_code_check: true
221
                     },
222
                     description: {
223
                            required:true,
224
                            letters_only: true
225
                     },
226
                     enrolmentperiod: {
227
                           required: function(element){
228
                                 return $("#enrolmentperioddate").val() === "";
229
                           },
230
                           digits: true,
231
                           enrollment_period: true,
232
                    },
233
                     enrolmentperioddate: {
234
                            required: function(element){
235
                               return $("#enrolmentperiod").val() === "";
236
                            },
237
                            enrollment_period: true,
238
                           // is_valid_date ($(#"enrolementperioddate").val());
239
                    },
240
                     dateofbirthrequired: {
241
                             digits: true
242
                     },
243
                     upperagelimit: {
244
                             digits: true
245
                     },
246
                     enrolmentfee: {
247
                             number: true
248
                     },
249
                     reservefee: {
250
                             number: true
251
                     },
252
                     category_type: {
253
                             required: true
254
                    }
255
                },
256
                messages: {
257
                      enrolmentperiod: {
258
                             required: MSG_ONE_ENROLLMENTPERIOD
259
                      },
260
                      enrolmentperioddate: {
261
                             required: MSG_ONE_ENROLLMENTPERIOD
262
                      }
263
                }
264
       });
265
});
266
267
</script>
241
</head>
268
</head>
242
269
243
<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 265-271 $(document).ready(function(){ Link Here
265
             <div>
292
             <div>
266
                 <p> Success: Patron category created! </p>
293
                 <p> Success: Patron category created! </p>
267
                 <p> To add another patron category and for more settings<br>
294
                 <p> To add another patron category and for more settings<br>
268
                 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>
269
             </div>
299
             </div>
270
             Next up:<br>
300
             Next up:<br>
271
             <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 280-298 $(document).ready(function(){ Link Here
280
            </div>
310
            </div>
281
            <input type="submit" value="Try again"/>
311
            <input type="submit" value="Try again"/>
282
        </form>
312
        </form>
283
    [% END %] 
313
    [% END %]
284
        
314
285
315
286
[% 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-->
287
    <h1 align="left"> Create a new Patron Category testing rwq</h1>
317
    <h1 align="left"> Create a new Patron Category</h1>
288
       <form id="category_form" method="post" action="onboarding.pl">  
318
       <form id="category_form" method="post" action="onboarding.pl">
289
       <fieldset class="rows">
319
       <fieldset class="rows">
290
            <input type="hidden" name="step" value="2"/>
320
            <input type="hidden" name="step" value="2"/>
291
            <input type="hidden" name="createcat" value="createcat" />
321
            <input type="hidden" name="createcat" value="createcat" />
292
                <ol>
322
                <ol>
293
                    <li>
323
                    <li>
294
                        <label for="categorycode" class="required">Category code: </label>
324
                        <label for="categorycode" class="required">Category code: </label>
295
                        <input type="text" pattern="^[A-Z]{1,2}" title="Please enter 1 or 2 capital letters" 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" />
296
                        <span class="required">Required</span>
326
                        <span class="required">Required</span>
297
                    </li>
327
                    </li>
298
328
Lines 361-375 $(document).ready(function(){ Link Here
361
                            <ol>
391
                            <ol>
362
                                <li>
392
                                <li>
363
                                    <label for="enrolmentperiod" style="width:6em;">In months: </label>
393
                                    <label for="enrolmentperiod" style="width:6em;">In months: </label>
364
                                    <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 
365
                                </li>
395
                                </li>
366
                                <li>
396
                                <li>
367
                                    <label for="enrolmentperioddate" style="width:6em;">Until date: </label>
397
                                    <label for="enrolmentperioddate" style="width:6em;">Until date: </label>
368
                                    <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 %]" />
369
                                    <img class="ui-datepicker-trigger" src="/intranet-tmpl/prog/img/famfamfam/silk/calendar.png" alt="..." title="...">
370
371
372
373
                                </li>
399
                                </li>
374
                            </ol>
400
                            </ol>
375
                     </fieldset>
401
                     </fieldset>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep3.tt (-10 / +10 lines)
Lines 114-120 $(document).ready(function(){ Link Here
114
        </form>
114
        </form>
115
[% ELSE %]
115
[% ELSE %]
116
<!--Create a patron screen 1-->
116
<!--Create a patron screen 1-->
117
       <h1 align="left"> Create a new Patron </h1>
117
       <h1 align="left"> Create a new Patron</h1>
118
       <legend id="library_management_lgd">Library Management</legend>
118
       <legend id="library_management_lgd">Library Management</legend>
119
        <p>
119
        <p>
120
        Now we will create a patron with superlibrarian permissions. Login with this to access Koha as a staff member will all permissions. 
120
        Now we will create a patron with superlibrarian permissions. Login with this to access Koha as a staff member will all permissions. 
Lines 129-140 $(document).ready(function(){ Link Here
129
                        <li>
129
                        <li>
130
                            <label for="surname" class="required">Surname: </label>
130
                            <label for="surname" class="required">Surname: </label>
131
131
132
                            <input type="text" style="text-transform:capitalize" id="surname" name="surname"  value="[% surname %]" class="required" required="required" />
132
                            <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" />
133
                            <span class="required">Required</span>
133
                            <span class="required">Required</span>
134
                        </li>
134
                        </li>
135
                        <li>
135
                        <li>
136
                            <label for="firstname" class="required">First Name: </label>
136
                            <label for="firstname" class="required">First Name: </label>
137
                            <input style= "text-transform:capitalize;" type="text" name="firstname" id="firstname" size="20" value="[% firstname |html %]" class="required" required="required">
137
                            <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">
138
                            <span class="required">Required</span>
138
                            <span class="required">Required</span>
139
                        </li>
139
                        </li>
140
                </ol>
140
                </ol>
Lines 142-148 $(document).ready(function(){ Link Here
142
                <ol>
142
                <ol>
143
                        <li>
143
                        <li>
144
                            <label for="cardnumber" class="required">Card Number: </label>
144
                            <label for="cardnumber" class="required">Card Number: </label>
145
                            <input type="number" min="1" id="cardnumber" class="noEnterSubmit valid" name="cardnumber" maxlength="[%maxlength_cardnumber%]" minlength="[%minlength_cardnumber%]" value="[% cardnumber | html %]" class="required" required="required">
145
                            <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">
146
                            <span class="required">Required</span>
146
                            <span class="required">Required</span>
147
                        </li>
147
                        </li>
148
                        <li>
148
                        <li>
Lines 160-168 $(document).ready(function(){ Link Here
160
                        <li>
160
                        <li>
161
                            <label for="categorycode_entry" class="required"> Patron Category</label>
161
                            <label for="categorycode_entry" class="required"> Patron Category</label>
162
                            <select id="categorycode_entry" name="categorycode_entry" onchange="update_category_code(this);">
162
                            <select id="categorycode_entry" name="categorycode_entry" onchange="update_category_code(this);">
163
                           [% FOREACH category IN categories %] 
163
                            [% FOREACH category IN categories %]
164
                                <option name="categorycode_entry" value = "[% category.categorycode %]"> [%category.description %]</option>
164
                                <option name="categorycode_entry" value = "[% category.categorycode %]">[%category.description %]</option>
165
                           [% END %]
165
                            [% END %]
166
                            </select>
166
                            </select>
167
                            <span class="required">Required</span>
167
                            <span class="required">Required</span>
168
                        </li> 
168
                        </li> 
Lines 180-196 $(document).ready(function(){ Link Here
180
                    <h3>OPAC/Staff Login</h3> 
180
                    <h3>OPAC/Staff Login</h3> 
181
                        <li>
181
                        <li>
182
                            <label for="userid" class="required">Username: </label>
182
                            <label for="userid" class="required">Username: </label>
183
                            <input type="text" name="userid" id ="userid" size="20" value="[% userid %]" class="required" required="required" />
183
                            <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" />
184
                            <span class="required">Required</span>
184
                            <span class="required">Required</span>
185
                        </li>
185
                        </li>
186
                        <li>
186
                        <li>
187
                            <label for="passwordlabel" class="required">Password: </label>
187
                            <label for="passwordlabel" class="required">Password: </label>
188
                            <input type="password" name="password" id="password" size="20" value="[% member.password |html %]" class="required" required="required">
188
                            <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">
189
                            <span class="required">Required</span>
189
                            <span class="required">Required</span>
190
                        </li>
190
                        </li>
191
                        <li>
191
                        <li>
192
                            <label for="password2" class="required">Confirm password: </label>
192
                            <label for="password2" class="required">Confirm password: </label>
193
                            <input type="password" id="password2" name="password2" size="20" value="" class="required" required="required">
193
                            <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">
194
                            <span class="required">Required</span>
194
                            <span class="required">Required</span>
195
                        </li>
195
                        </li>
196
                </ol>
196
                </ol>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep4.tt (-2 / +2 lines)
Lines 66-77 Link Here
66
                    <ol>
66
                    <ol>
67
                        <li>
67
                        <li>
68
                            <label for="itemtype" class="required">Item type code: </label>
68
                            <label for="itemtype" class="required">Item type code: </label>
69
                            <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" />
70
                            <span class="required">Required</span>
70
                            <span class="required">Required</span>
71
                        </li>
71
                        </li>
72
                        <li>
72
                        <li>
73
                            <label for="description" class="required">Description: </label>
73
                            <label for="description" class="required">Description: </label>
74
                            <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">
75
                            <span class="required">Required</span>
75
                            <span class="required">Required</span>
76
                        </li>
76
                        </li>
77
                    </ol>
77
                    </ol>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep5.tt (-9 / +8 lines)
Lines 53-59 Link Here
53
                               <option value="*">All</option> 
53
                               <option value="*">All</option> 
54
                             [% FOREACH category IN categories %]
54
                             [% FOREACH category IN categories %]
55
                                <option name="categorycode" value = "[% category.categorycode %]"> [%category.description %]</option> 
55
                                <option name="categorycode" value = "[% category.categorycode %]"> [%category.description %]</option> 
56
                            [%END%]
56
                             [%END%]
57
                             </select>
57
                             </select>
58
                        <span class="required">Required</span>
58
                        <span class="required">Required</span>
59
                    </li>
59
                    </li>
Lines 70-89 Link Here
70
                    </li>
70
                    </li>
71
                    <li>
71
                    <li>
72
                        <label for="maxissueqty" class="required">Current checkouts allowed: </label>
72
                        <label for="maxissueqty" class="required">Current checkouts allowed: </label>
73
                        <input type="number" min="0" name="maxissueqty" id="maxissueqty" size="10" maxlength="10" value="" class="required" required="required" />
73
                        <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" />
74
                        <span class="required">Required</span>
74
                        <span class="required">Required</span>
75
                    </li>
75
                    </li>
76
76
77
                    <li>
77
                    <li>
78
                        <label for="issuelength" class="required">Loan Period: </label>
78
                        <label for="issuelength" class="required">Loan Period: </label>
79
                        <input type="number" min="0" name="issuelength" id="issuelength" size="10" maxlength="10" value="" class="required" required="required" />
79
                        <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" />
80
                        <span class="required">Required</span>
80
                        <span class="required">Required</span>
81
                   </li>
81
                   </li>
82
                   <li>
82
                   <li>
83
                        <label for="lengthunit">Units: </label>
83
                        <label for="lengthunit">Units: </label>
84
                        <select name="lengthunit" id="lengthunit" required="required">
84
                        <select name="lengthunit" id="lengthunit" required="required">
85
                        [% SET units = 'days' %]
85
                        [% SET units = 'days' %]
86
                        [% 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-->
86
                        [% IF category %]
87
                            [% SET default_privacy = category.default_privacy %]
87
                            [% SET default_privacy = category.default_privacy %]
88
                        [% END %]
88
                        [% END %]
89
89
Lines 94-111 Link Here
94
                             [% CASE 'hours' %]
94
                             [% CASE 'hours' %]
95
                                   <option value="days">Days</option>
95
                                   <option value="days">Days</option>
96
                                   <option value="hours" selected="selected">Hours</option>
96
                                   <option value="hours" selected="selected">Hours</option>
97
                             [% END %]
97
                        [% END %]
98
                            </select>
98
                        </select>
99
                     </li>
99
                     </li>
100
                     <li>
100
                     <li>
101
                        <label for="renewalsallowed" class="required">Renewals Allowed: </label>
101
                        <label for="renewalsallowed" class="required">Renewals Allowed: </label>
102
                        <input type="number"min="0" name="renewalsallowed" id="renewalsallowed" size="10" maxlength="10" value="" class="required" required="required" />
102
                        <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" />
103
                        <span class="required">Required</span>
103
                        <span class="required">Required</span>
104
                     </li>
104
                     </li>
105
105
106
                     <li>
106
                     <li>
107
                        <label for="renewalperiod" class="required">Renewals Period: </label>
107
                        <label for="renewalperiod" class="required">Renewals Period: </label>
108
                        <input type="number" min="0"name="renewalperiod" id="renewalperiod" size="10" maxlength="10" value="" class="required" required="required" />
108
                        <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" />
109
                        <span class="required">Required</span>
109
                        <span class="required">Required</span>
110
                     </li>
110
                     </li>
111
111
112
- 

Return to bug 17855