Bugzilla – Attachment 58785 Details for
Bug 17855
New onboarding tool feature to guide users through setting up Koha, and minor web installer UI improvements
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17855 - Finished updated web installer and onboarding tool
Bug-17855---Finished-updated-web-installer-and-onb.patch (text/plain), 78.92 KB, created by
Alex Buckley
on 2017-01-10 21:50:05 UTC
(
hide
)
Description:
Bug 17855 - Finished updated web installer and onboarding tool
Filename:
MIME Type:
Creator:
Alex Buckley
Created:
2017-01-10 21:50:05 UTC
Size:
78.92 KB
patch
obsolete
>From eb47932daf22bcba219cb53ddd43a2cbbcbb7aa4 Mon Sep 17 00:00:00 2001 >From: Alex Buckley <alexbuckley@catalyst.net.nz> >Date: Wed, 21 Dec 2016 00:37:02 +0000 >Subject: [PATCH] Bug 17855 - Finished updated web installer and onboarding > tool > >Test plan: >1. Go through the web installer and onboarding tool as outlined in this >guide: >https://koha-community.org/manual/installation/html/ > >This is a combination of 6 commits. >--- > installer/install.pl | 17 + > installer/onboarding.pl | 427 ++++++++++++++------- > .../prog/en/modules/admin/categories.tt | 2 +- > .../prog/en/modules/installer/step3.tt | 4 +- > .../prog/en/modules/onboarding/onboardingstep0.tt | 33 +- > .../prog/en/modules/onboarding/onboardingstep1.tt | 42 +- > .../prog/en/modules/onboarding/onboardingstep2.tt | 345 +++++++++++++---- > .../prog/en/modules/onboarding/onboardingstep3.tt | 142 +++++-- > .../prog/en/modules/onboarding/onboardingstep4.tt | 6 +- > .../prog/en/modules/onboarding/onboardingstep5.tt | 151 ++++---- > 10 files changed, 766 insertions(+), 403 deletions(-) > >diff --git a/installer/install.pl b/installer/install.pl >index 17d01e9..a71a5c0 100755 >--- a/installer/install.pl >+++ b/installer/install.pl >@@ -1,5 +1,22 @@ > #!/usr/bin/perl > >+# This file is part of Koha. >+# # >+# # Copyright (C) YEAR YOURNAME-OR-YOUREMPLOYER >+# # >+# # Koha is free software; you can redistribute it and/or modify it >+# # under the terms of the GNU General Public License as published by >+# # the Free Software Foundation; either version 3 of the License, or >+# # (at your option) any later version. >+# # >+# # Koha is distributed in the hope that it will be useful, but >+# # WITHOUT ANY WARRANTY; without even the implied warranty of >+# # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# # GNU General Public License for more details. >+# # >+# # You should have received a copy of the GNU General Public License >+# # along with Koha; if not, see <http://www.gnu.org/licenses>. >+ > use strict; > use warnings; > use diagnostics; >diff --git a/installer/onboarding.pl b/installer/onboarding.pl >index f660c3f..d24eb78 100755 >--- a/installer/onboarding.pl >+++ b/installer/onboarding.pl >@@ -1,19 +1,33 @@ > #!/usr/bin/perl > #Recommended pragmas >+ >+# This file is part of Koha. >+# # >+# # Copyright (C) YEAR YOURNAME-OR-YOUREMPLOYER >+# # >+# # Koha is free software; you can redistribute it and/or modify it >+# # under the terms of the GNU General Public License as published by >+# # the Free Software Foundation; either version 3 of the License, or >+# # (at your option) any later version. >+# # >+# # Koha is distributed in the hope that it will be useful, but >+# # WITHOUT ANY WARRANTY; without even the implied warranty of >+# # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# # GNU General Public License for more details. >+# # >+# # You should have received a copy of the GNU General Public License >+# # along with Koha; if not, see <http://www.gnu.org/licenses>. >+ > use strict; > use warnings; > use diagnostics; > >- > use Modern::Perl; >- >-#External modules >+use C4::InstallAuth; > use CGI qw ( -utf8 ); > use List::MoreUtils qw/uniq/; > use Digest::MD5 qw(md5_base64); > use Encode qw( encode ); >- >-#Internal modules > use C4::Koha; > use C4::Auth; > use C4::Context; >@@ -40,14 +54,16 @@ use Koha::Patron::HouseboundRoles; > use Koha::Token; > use Email::Valid; > use Module::Load; >+use Koha::IssuingRule; >+use Koha::IssuingRules; > > #Setting variables > my $input = new CGI; > my $query = new CGI; > my $step = $query->param('step'); > >-#Getting the appropriate template to display to the user--> >-my ( $template, $loggedinuser, $cookie) = get_template_and_user( >+#Getting the appropriate template to display to the user >+my ( $template, $loggedinuser, $cookie) = C4::InstallAuth::get_template_and_user( > { > template_name => "/onboarding/onboardingstep" . ( $step ? $step : 0 ) . ".tt", > query => $query, >@@ -85,10 +101,11 @@ if ( $op && $op eq 'finish' ) { #If the value of $op equals 'finish' then redire > } > > >-#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 >+#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 > my $start = $query->param('start'); >-$template->param('start'=>$start); #Hand the start variable back to the template >-if ( $start && $start eq 'Start setting up my Koha' ){ >+$template->param('start'=>$start); >+ >+if ( $start && $start eq 'Start setting up my Koha' ){ > my $libraries = Koha::Libraries->search( {}, { order_by => ['branchcode'] }, ); > $template->param(libraries => $libraries, > group_types => [ >@@ -102,47 +119,36 @@ if ( $start && $start eq 'Start setting up my Koha' ){ > ); > > >-#Select any library records from the database and hand them back to the template in the libraries variable. >-}elsif ( $start && $start eq 'Add a patron category' ){ >- >-#Select all the patron category records in the categories database table and store them in the newly declared variable $categories >+}elsif ( $start && $start eq 'Add a patron category' ){ >+#Select all the patron category records in the categories database table and give them to the template > my $categories = Koha::Patron::Categories->search(); > $template->param( > categories => $categories, >- ); #Hand the variable categories back to the template >- >-}elsif ( $start && $start eq 'Add an item type' ){ >- my $itemtypes = Koha::ItemTypes->search(); >- $template->param( >- itemtypes => $itemtypes, > ); > >+ > #Check if the $step variable equals 1 i.e. the user has clicked to create a library in the create library screen 1 > }elsif ( $step && $step == 1 ) { >- >- my $createlibrary = $query->param('createlibrary'); #Store the inputted library branch code and name in $createlibrary >+ my $createlibrary = $query->param('createlibrary'); #Store the inputted library branch code and name in $createlibrary variable > $template->param('createlibrary'=>$createlibrary); # Hand the library values back to the template in the createlibrary variable > > #store inputted parameters in variables > my $branchcode = $input->param('branchcode'); >+ $branchcode = uc($branchcode); > my $categorycode = $input->param('categorycode'); > my $op = $input->param('op') || 'list'; > my $message; > my $library; >-#my @messages; > > #Take the text 'branchname' and store it in the @fields array > my @fields = qw( > branchname > ); > >- >-#test > $template->param('branchcode'=>$branchcode); >- > $branchcode =~ s|\s||g; # Use a regular expression to check the value of the inputted branchcode > >- #Create a new library object and store the branchcode and @fields array values in this new library object >+ #Create a new library object and store the branchcode and @fields array values in this new library object > $library = Koha::Library->new( > { branchcode => $branchcode, > ( map { $_ => scalar $input->param($_) || undef } @fields ) >@@ -150,41 +156,44 @@ if ( $start && $start eq 'Start setting up my Koha' ){ > ); > > eval { $library->store; }; #Use the eval{} function to store the library object >- > if($library){ > $message = 'success_on_insert'; >- }else{ >+ }else{ > $message = 'error_on_insert'; >- } >+ } > >- $template->param('message' => $message); >+ $template->param('message' => $message); > > >-#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 >+#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 > }elsif ( $step && $step == 2 ){ >- my $createcat = $query->param('createcat'); #Store the inputted library branch code and name in $createlibrary >- $template->param('createcat'=>$createcat); # Hand the library values back to the template in the createlibrary variable >- >- >- #Initialising values >- my $input = new CGI; >- my $searchfield = $input->param('description') // q||; >- my $categorycode = $input->param('categorycode'); >- my $op = $input->param('op') // 'list'; >- my $message; >- my $category; >- >- my ( $template, $loggedinuser, $cookie ) = get_template_and_user( >- { >+ my $createcat = $query->param('createcat'); #Store the inputted category code and name in $createcat >+ $template->param('createcat'=>$createcat); >+ >+ #Initialising values >+ my $searchfield = $input->param('description') // q||; >+ my $categorycode = $input->param('categorycode'); >+ my $op = $input->param('op') // 'list'; >+ my $message; >+ my $category; >+ $template->param('categorycode' =>$categorycode); >+ >+ my ( $template, $loggedinuser, $cookie ) = C4::InstallAuth::get_template_and_user( >+ { > template_name => "/onboarding/onboardingstep2.tt", > query => $input, > type => "intranet", > authnotrequired => 0, > flagsrequired => { parameters => 'parameters_remaining_permissions' }, > debug => 1, >- } >+ } > ); >- my $categorycode = $input->param('categorycode'); >+ >+#Once the user submits the page, this code validates the input and adds it >+#to the database as a new patron category >+ >+ $categorycode = $input->param('categorycode'); >+ $categorycode = uc($categorycode); > my $description = $input->param('description'); > my $overduenoticerequired = $input->param('overduenoticerequired'); > my $category_type = $input->param('category_type'); >@@ -192,17 +201,18 @@ if ( $start && $start eq 'Start setting up my Koha' ){ > my $enrolmentperiod = $input->param('enrolmentperiod'); > my $enrolmentperioddate = $input->param('enrolmentperioddate') || undef; > >- #Converts the string into a date format >+#Converts the string into a date format > if ( $enrolmentperioddate) { > $enrolmentperioddate = output_pref( > { >- dt => dt_from_string($enrolmentperioddate), >- dateformat => 'iso', >- dateonly => 1, >+ dt => dt_from_string($enrolmentperioddate), >+ dateformat => 'iso', >+ dateonly => 1, > } > ); > } >- #Adds to the database >+ >+#Adds a new patron category to the database > $category = Koha::Patron::Category->new({ > categorycode=> $categorycode, > description => $description, >@@ -212,11 +222,12 @@ if ( $start && $start eq 'Start setting up my Koha' ){ > enrolmentperiod => $enrolmentperiod, > enrolmentperioddate => $enrolmentperioddate, > }); >+ > eval { > $category->store; > }; > >- #Error messages >+#Error messages > if($category){ > $message = 'success_on_insert'; > }else{ >@@ -224,11 +235,13 @@ if ( $start && $start eq 'Start setting up my Koha' ){ > } > > $template->param('message' => $message); >- >- } > > #Create a patron > }elsif ( $step && $step == 3 ){ >+ my $firstpassword = $input->param('password'); >+ my $secondpassword = $input->param('password2'); >+ >+#Find all library records in the database and hand them to the template to display in the library dropdown box > my $libraries = Koha::Libraries->search( {}, { order_by => ['branchcode'] }, ); > $template->param(libraries => $libraries, > group_types => [ >@@ -241,19 +254,73 @@ if ( $start && $start eq 'Start setting up my Koha' ){ > ] > ); > >- my $categories; >- $categories= Koha::Patron::Categories->search(); >+ my $categories= Koha::Patron::Categories->search(); > $template->param( > categories => $categories, > ); > >- my $input = new CGI; >+#Incrementing the highest existing patron cardnumber to prevent duplicate cardnumber entry >+ my $exisiting_cardnumber = my $sth_search = $dbh->prepare("SELECT MAX(cardnumber) FROM borrowers"); >+ my $new_cardnumber = $exisiting_cardnumber + 1; >+ warn $new_cardnumber; >+ $template->param("newcardnumber" => $new_cardnumber); >+ >+ >+ > my $op = $input->param('op') // 'list'; >+ my $minpw = C4::Context->preference("minPasswordLength"); >+ $template->param("minPasswordLength" => $minpw); > > my @messages; > my @errors; >+ my $nok = $input->param('nok'); >+ my $firstpassword = $input->param('password'); >+ my $secondpassword = $input->param('password2'); >+ my $cardnumber= $input->param('cardnumber'); >+ my $borrowernumber= $input->param('borrowernumber'); >+ my $userid=$input->param('userid'); >+ >+#If the entered cardnumber causes an error hand this error to the @errors array >+ if(my $error_code = checkcardnumber($cardnumber, $borrowernumber)){ >+ push @errors, $error_code == 1 >+ ? 'ERROR_cardnumber_already_exists' >+ :$error_code == 2 >+ ? 'ERROR_cardnumber_length' >+ :() >+ } > >- my ($template, $loggedinuser, $cookie)= get_template_and_user({ >+#If the entered password causes an error hand this error to the @errors array >+ push @errors, "ERROR_password_mismatch" if $firstpassword ne $secondpassword; >+ push @errors, "ERROR_short_password" if ($firstpassword && $minpw && $firstpassword ne '****' && (length($firstpassword) < $minpw)); >+ >+ >+#Passing errors to template >+ $nok = $nok || scalar(@errors); >+ >+#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 >+ if($nok){ >+ foreach my $error (@errors){ >+ if ($error eq 'ERROR_password_mismatch'){ >+ $template->param(errorpasswordmismatch => 1); >+ } >+ if ($error eq 'ERROR_login_exist'){ >+ $template->param(errorloginexists =>1); >+ } >+ if ($error eq 'ERROR_cardnumber_already_exists'){ >+ $template->param(errorcardnumberexists => 1); >+ } >+ if ($error eq 'ERROR_cardnumber_length'){ >+ $template->param(errorcardnumberlength => 1); >+ } >+ if ($error eq 'ERROR_short_password'){ >+ $template->param(errorshortpassword => 1); >+ } >+ } >+ $template->param('nok' => 1); >+ >+#Else if no errors have been caused by the users inputted card number or password then insert the patron into the borrowers table >+ }else{ >+ my ($template, $loggedinuser, $cookie)= C4::InstallAuth::get_template_and_user({ > template_name => "/onboarding/onboardingstep3.tt", > query => $input, > type => "intranet", >@@ -262,9 +329,8 @@ if ( $start && $start eq 'Start setting up my Koha' ){ > debug => 1, > }); > >- > if($op eq 'add_validate'){ >- my %newdata; >+ my %newdata; > > #Store the template form values in the newdata hash > $newdata{borrowernumber} = $input->param('borrowernumber'); >@@ -279,25 +345,15 @@ if ( $start && $start eq 'Start setting up my Koha' ){ > $newdata{dateexpiry} = '12/10/2016'; > $newdata{privacy} = "default"; > >- if(my $error_code = checkcardnumber($newdata{cardnumber},$newdata{borrowernumber})){ >- push @errors, $error_code == 1 >- ? 'ERROR_cardnumber_already_exists' >- :$error_code == 2 >- ? 'ERROR_cardnumber_length' >- :() >- } >- >- >- > #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 > my $borrowernumber = &AddMember(%newdata); >-#Create a hash named member2 and fillit with the borrowernumber of the borrower that has just been created >+ >+#Create a hash named member2 and fill it with the borrowernumber of the borrower that has just been created > my %member2; > $member2{'borrowernumber'}=$borrowernumber; >- > >+#Perform data validation on the flag that has been handed to onboarding.pl by the template > my $flag = $input->param('flag'); >- > if ($input->param('newflags')) { > my $dbh=C4::Context->dbh(); > my @perms = $input->multi_param('flag'); >@@ -312,42 +368,37 @@ if ( $start && $start eq 'Start setting up my Koha' ){ > } > } > >+ # construct flags >+ my $module_flags = 0; >+ my $sth=$dbh->prepare("SELECT bit,flag FROM userflags ORDER BY bit"); >+ $sth->execute(); >+ while (my ($bit, $flag) = $sth->fetchrow_array) { >+ if (exists $all_module_perms{$flag}) { >+ $module_flags += 2**$bit; >+ } >+ } > >- # construct flags >- my $module_flags = 0; >- my $sth=$dbh->prepare("SELECT bit,flag FROM userflags ORDER BY bit"); >- $sth->execute(); >- while (my ($bit, $flag) = $sth->fetchrow_array) { >- if (exists $all_module_perms{$flag}) { >- $module_flags += 2**$bit; >- } >- } >- >- $sth = $dbh->prepare("UPDATE borrowers SET flags=? WHERE borrowernumber=?"); >- $sth->execute($module_flags, $borrowernumber); >+#Set the superlibrarian permission of the newly created patron to superlibrarian >+ $sth = $dbh->prepare("UPDATE borrowers SET flags=? WHERE borrowernumber=?"); >+ $sth->execute($module_flags, $borrowernumber); > > >-#Error handling checking if the patron was created successfully >- if(!$borrowernumber){ >- push @messages, {type=> 'error', code => 'error_on_insert'}; >- }else{ >- push @messages, {type=> 'message', code => 'success_on_insert'}; >+ #Error handling checking if the patron was created successfully >+ if(!$borrowernumber){ >+ push @messages, {type=> 'error', code => 'error_on_insert'}; >+ }else{ >+ push @messages, {type=> 'message', code => 'success_on_insert'}; >+ } >+ } > } >- >- } >- } >- > } >-}elsif ( $step && $step == 4){ >+ >+ }elsif ( $step && $step == 4){ > my $createitemtype = $input->param('createitemtype'); > $template->param('createitemtype'=> $createitemtype ); >- >- my $input = new CGI; >- my $itemtype_code = $input->param('itemtype'); >- my $op = $input->param('op') // 'list'; >- my $message; > >- my( $template, $borrowernumber, $cookie) = get_template_and_user( >+ >+ my( $template, $borrowernumber, $cookie) = C4::InstallAuth::get_template_and_user( > { template_name => "/onboarding/onboardingstep4.tt", > query => $input, > type => "intranet", >@@ -356,23 +407,24 @@ if ( $start && $start eq 'Start setting up my Koha' ){ > debug => 1, > } > ); >- >- if($op eq 'add_form'){ >- my $itemtype = Koha::ItemTypes->find($itemtype_code); >- $template->param(itemtype=> $itemtype,); >- }elsif($op eq 'add_validate'){ >- my $itemtype = Koha::ItemTypes->find($itemtype_code); >- my $description = $input->param('description'); > >- #store the input from the form - only 2 fields >- my $thisitemtype= Koha::ItemType->new( >+ if($op eq 'add_validate'){ >+ my $description = $input->param('description'); >+ my $itemtype_code = $input->param('itemtype'); >+ $itemtype_code = uc($itemtype_code); >+ #Create a new itemtype object using the user inputted itemtype and description >+ my $itemtype= Koha::ItemType->new( > { itemtype => $itemtype_code, > description => $description, > } > ); >- eval{ $thisitemtype->store; }; >- #Error messages >- if($thisitemtype){ >+ >+ eval{ $itemtype->store; }; >+ >+ my $message; >+ >+#Fill the $message variable with an error if the item type object was not successfully created and inserted into the itemtypes table >+ if($itemtype){ > $message = 'success_on_insert'; > }else{ > $message = 'error_on_insert'; >@@ -381,66 +433,161 @@ if ( $start && $start eq 'Start setting up my Koha' ){ > $template->param('message' => $message); > } > }elsif ( $step && $step == 5){ >- my $test="a"; >- warn $test; >- >- #Fetching all the existing categories to display in a drop down box >+ >+ #Find all the existing categories to display in a dropdown box in the template > my $categories; > $categories= Koha::Patron::Categories->search(); > $template->param( > categories => $categories, > ); >- >+ >+ #Find all the exisiting item types to display in a dropdown box in the template > my $itemtypes; > $itemtypes= Koha::ItemTypes->search(); > $template->param( > itemtypes => $itemtypes, > ); >- >+ >+ #Find all the exisiting libraries to display in a dropdown box in the template >+ my $libraries = Koha::Libraries->search( {}, { order_by => ['branchcode'] }, ); >+ $template->param(libraries => $libraries, >+ group_types => [ >+ { categorytype => 'searchdomain', >+ categories => [ Koha::LibraryCategories->search( { categorytype => 'searchdomain' } ) ], >+ }, >+ { categorytype => 'properties', >+ categories => [ Koha::LibraryCategories->search( { categorytype => 'properties' } ) ], >+ }, >+ ] >+ ); >+ > my $input = CGI->new; >- my($template, $loggedinuser, $cookie) =get_template_and_user({ >- template_name => "/onboarding/onboardingstep5.tt", >- query => $input, >- type => "intranet", >- authnotrequired=>0, >- flagsrequired=> {parameters => 'manage_circ_rules'}, >- debug =>1, >+ my $dbh = C4::Context->dbh; >+ >+ my ($template, $loggedinuser, $cookie) = C4::InstallAuth::get_template_and_user({template_name => "/onboarding/onboardingstep5.tt", >+ query => $input, >+ type => "intranet", >+ authnotrequired => 0, >+ flagsrequired => {parameters => 'manage_circ_rules'}, >+ debug => 1, > }); >- my $type = $input->param('type'); >+ >+#If no libraries exist then set the $branch value to * > my $branch = $input->param('branch'); >- if($op eq 'add_form'){ >+ unless ( $branch ) { >+ if ( C4::Context->preference('DefaultToLoggedInLibraryCircRules') ) { >+ $branch = Koha::Libraries->search->count() == 1 ? undef : C4::Context::mybranch(); >+ } >+ else { >+ $branch = C4::Context::only_my_library() ? ( C4::Context::mybranch() || '*' ) : '*'; >+ } > } >- >- elsif($op eq 'add_validate'){ >+ $branch = '*' if $branch eq 'NO_LIBRARY_SET'; >+ my $op = $input->param('op') || q{}; >+ >+ if($op eq 'add_validate'){ >+ my $type = $input->param('type'); >+ my $br = $input->param('branch'); > my $bor = $input->param('categorycode'); > my $itemtype = $input->param('itemtype'); > my $maxissueqty = $input->param('maxissueqty'); > my $issuelength = $input->param('issuelength'); >- #$issuelength = $issuelength eq q{} ? undef : $issuelength; > my $lengthunit = $input->param('lengthunit'); > my $renewalsallowed = $input->param('renewalsallowed'); > my $renewalperiod = $input->param('renewalperiod'); >- my $onshelfholds = $input->param('onshelfholds'); >+ my $onshelfholds = $input->param('onshelfholds') || 0; >+ $maxissueqty =~ s/\s//g; >+ $maxissueqty = undef if $maxissueqty !~ /^\d+/; >+ $issuelength = $issuelength eq q{} ? undef : $issuelength; > > my $params ={ >+ branchcode => $br, > categorycode => $bor, > itemtype => $itemtype, > maxissueqty => $maxissueqty, > renewalsallowed => $renewalsallowed, > renewalperiod => $renewalperiod, >+ issuelength => $issuelength, > lengthunit => $lengthunit, > onshelfholds => $onshelfholds, > }; >- my $issuingrule = Koha::IssuingRules->find({categorycode => $bor, itemtype => $itemtype}); >- if($issuingrule){ >- $issuingrule->set($params)->store(); >- }else{ >- Koha::IssuingRule->new()->set($params)->store(); >+ >+ my @messages; >+ >+#New code from smart-rules.tt starts here. Needs to be added to library >+#Allows for the 'All' option to work when selecting all libraries for a circulation rule to apply to. >+ if ($branch eq "*") { >+ my $sth_search = $dbh->prepare("SELECT count(*) AS total >+ FROM default_circ_rules"); >+ my $sth_insert = $dbh->prepare("INSERT INTO default_circ_rules >+ (maxissueqty, onshelfholds) >+ VALUES (?, ?)"); >+ my $sth_update = $dbh->prepare("UPDATE default_circ_rules >+ SET maxissueqty = ?, onshelfholds = ?"); >+ >+ $sth_search->execute(); >+ my $res = $sth_search->fetchrow_hashref(); >+ if ($res->{total}) { >+ $sth_update->execute($maxissueqty, $onshelfholds); >+ } else { >+ $sth_insert->execute($maxissueqty, $onshelfholds); > } > } >- } > > >+#Allows for the 'All' option to work when selecting all patron categories for a circulation rule to apply to. >+ if ($bor eq "*") { >+ my $sth_search = $dbh->prepare("SELECT count(*) AS total >+ FROM default_circ_rules"); >+ my $sth_insert = $dbh->prepare(q| >+ INSERT INTO default_circ_rules >+ (maxissueqty) >+ VALUES (?) >+ |); >+ my $sth_update = $dbh->prepare(q| >+ UPDATE default_circ_rules >+ SET maxissueqty = ? >+ |); >+ >+ $sth_search->execute(); >+ my $res = $sth_search->fetchrow_hashref(); >+ if ($res->{total}) { >+ $sth_update->execute($maxissueqty); >+ } else { >+ $sth_insert->execute($maxissueqty); >+ } >+ } >+#Allows for the 'All' option to work when selecting all itemtypes for a circulation rule to apply to >+ if ($itemtype eq "*") { >+ my $sth_search = $dbh->prepare("SELECT count(*) AS total >+ FROM default_branch_circ_rules >+ WHERE branchcode = ?"); >+ my $sth_insert = $dbh->prepare("INSERT INTO default_branch_circ_rules >+ (branchcode, onshelfholds) >+ VALUES (?, ?)"); >+ my $sth_update = $dbh->prepare("UPDATE default_branch_circ_rules >+ SET onshelfholds = ? >+ WHERE branchcode = ?"); >+ $sth_search->execute($branch); >+ my $res = $sth_search->fetchrow_hashref(); >+ if ($res->{total}) { >+ $sth_update->execute($onshelfholds, $branch); >+ } else { >+ $sth_insert->execute($branch, $onshelfholds); >+ } >+ } >+#End new code >+ >+ my $issuingrule = Koha::IssuingRules->find({categorycode => $bor, itemtype => $itemtype, branchcode => $br }); >+ if($issuingrule){ >+ $issuingrule->set($params)->store(); >+ 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. >+ >+ }else{ >+ Koha::IssuingRule->new()->set($params)->store(); >+ } >+ } >+} > > output_html_with_http_headers $input, $cookie, $template->output; > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt >index 7f1fb53..4f3f119 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt >@@ -93,7 +93,7 @@ > </li> > <li> > <label for="enrolmentperioddate" style="width:6em;">Until date: </label> >- <input type="text" class="enrollmentperiod" name="enrolmentperioddate" id="enrolmentperioddate" value="[% category.enrolmentperioddate | $KohaDates %]" /> >+ <input type="text" class="enrollmentperiod datepicker" name="enrolmentperioddate" id="enrolmentperioddate" value="[% category.enrolmentperioddate | $KohaDates %]" /> > </li> > </ol> > </fieldset> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step3.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step3.tt >index 5daf7fa..058e1d6 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step3.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step3.tt >@@ -217,11 +217,11 @@ function Hide(link) > [% END %] > <h3>All done!</h3> > <p>Installation complete.<br /> >- <p>Click on 'Finish' to complete and load the Koha Staff Interface. >+ <p>Click on 'Continue to onboarding tool' to complete and load the Koha onboarding tool. > <form name="finish"> > <input type="hidden" name="step" value="3" /> > <input type="hidden" name="op" value="finish" /> >- <input type="submit" value="Finish"/> >+ <input type="submit" value="Continue to Koha onboarding tool"/> > </form> > </p> > </p> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep0.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep0.tt >index 8eed408..e4fc3ee 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep0.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep0.tt >@@ -2,44 +2,15 @@ > [% INCLUDE 'doc-head-open.inc' %] > [% INCLUDE 'installer-doc-head-close.inc' %] > >- > <head> > <title>Welcome › to › Koha</title> >- >-<!--jQuery code for create library--> >-<script type="text/javascript" src="[% interface %]/lib/tiny_mce/tiny_mce.js"></script> >-<script type="text/javascript"> >- //<![CDATA[ >- $(document).ready(function() { >- $("#branchest").dataTable($.extend(true, {}, dataTablesDefaults, { >- "aoColumnDefs": [ >- { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false }, >- ], >- "iDisplayLength": 10, >- "sPaginationType": "four_button" >- })); >- >- [% UNLESS library %] >- $("#Aform").on("submit", function( event ) { >- if ( $("#branchcode").val().match(/\s/) ) { >- event.preventDefault(); >- alert(_("The library code entered contains whitespace characters. Please remove any whitespace characters from the library code")); >- return false; >- } else { >- return true; >- } >- }); >- [% END %].. >- }); >- //]]> >- </script> >- </head> >+</head> > > <!--Header for the koha onboarding tool--> > <div> > <h1 align="center"> Welcome to Koha</h1> > <h1 id="logo"><img alt="Koha" style="width:50%;margin:auto;display:block;align:center;" src="[% interface %]/[% theme %]/img/koha.org-logo.gif"/></h1> >- <h2 align="center"> We're just going to set up a few things......</h2> >+ <h2 align="center"> We're just going to set up a few more things...</h2> > <form name="startkoha" method="post" action="onboarding.pl"> > <input type="hidden" name="step" value="1"/> > <input type="submit" name="start" value="Start setting up my Koha"/> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep1.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep1.tt >index f783202..55d053b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep1.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep1.tt >@@ -4,34 +4,6 @@ > > <head> > <title>Welcome › to › Koha</title> >- >-<!--jQuery code for create library--> >-<script type="text/javascript" src="[% interface %]/lib/tiny_mce/tiny_mce.js"></script> >-<script type="text/javascript"> >- //<![CDATA[ >- $(document).ready(function() { >- $("#branchest").dataTable($.extend(true, {}, dataTablesDefaults, { >- "aoColumnDefs": [ >- { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false }, >- ], >- "iDisplayLength": 10, >- "sPaginationType": "four_button" >- })); >- >- [% UNLESS library %] >- $("#Aform").on("submit", function( event ) { >- if ( $("#branchcode").val().match(/\s/) ) { >- event.preventDefault(); >- alert(_("The library code entered contains whitespace characters. Please remove any whitespace characters from the library code")); >- return false; >- } else { >- return true; >- } >- }); >- [% END %].. >- }); >-//]]> >-</script> > </head> > > <!--Header for the koha onboarding tool--> >@@ -57,10 +29,14 @@ > <input type="hidden" name="step" value="2"/> > <h1 align="left"> New Library</h1> > <div> >- <p> Success: Library created! Your branchcode is [% branchcode %] >-</p> >+ <p> Success: Library created! >+ </p> > <p> To add another library and for more settings, <br> >- go to Tools->Administration->Libraries and Groups >+ go to:<br><br> >+ More->Administration->Libraries and groups<br> >+ OR<br> >+ Administration->Libraries and groups >+ </p> > </div> > Next up: > <input type="submit" name="start" value="Add a patron category"/> >@@ -89,12 +65,12 @@ > <ol> > <li> > <label for="branchcode" class="required">Library code: </label> >- <input type="text" style="text-transform: uppercase;"name="branchcode" id="branchcode" size="10" maxlength="10" value="[% library.branchcode |html %]" class="required" required="required" /> >+ <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" /> > <span class="required">Required</span> > </li> > <li> > <label for="branchname" class="required">Name: </label> >- <input type="text" style="text-transform:capitalize;" name="branchname" id="branchname" size="80" value="[% library.branchname |html %]" class=" required" required="required" style="width:200px;"> >+ <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;"> > <span class="required">Required</span> > </li> > </ol> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep2.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep2.tt >index 1635c68..4687d62 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep2.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep2.tt >@@ -6,81 +6,265 @@ > <title> Add a patron category</title> > [% INCLUDE 'installer-doc-head-close.inc' %] > [% INCLUDE 'calendar.inc' %] >+ > <script type="text/javascript"> >- var MSG_CATEGORYCODE_CHARS = (_("Category code can only contain the following characters: letters, numbers, - and _.")); >- var MSG_ONE_ENROLLMENTPERIOD =(_("Please choose an enrollment period in months OR by date.")); >+//<![CDATA[ >+ >+var debug = ""; >+var dformat = "us"; >+var sentmsg = 0; >+if (debug > 1) {alert("dateformat: " + dformat + "\ndebug is on (level " + debug + ")");} >+var MSG_PLEASE_ENTER_A_VALID_DATE = (_("Please enter a valid date (should match %s).")); >+ >+function is_valid_date(date) { >+ // An empty string is considered as a valid date for convenient reasons. >+ if ( date === '' ) return 1; >+ var dateformat = dateformat_str = 'us'; >+ if ( dateformat == 'us' ) { >+ if ( date.search(/^\d{2}\/\d{2}\/\d{4}($|\s)/) == -1 ) return 0; >+ dateformat = 'mm/dd/yy'; >+ } else if ( dateformat == 'metric' ) { >+ if ( date.search(/^\d{2}\/\d{2}\/\d{4}($|\s)/) == -1 ) return 0; >+ dateformat = 'dd/mm/yy'; >+ } else if (dateformat == 'iso' ) { >+ if ( date.search(/^\d{4}-\d{2}-\d{2}($|\s)/) == -1 ) return 0; >+ dateformat = 'yy-mm-dd'; >+ } else if ( dateformat == 'dmydot' ) { >+ if ( date.search(/^\d{2}\.\d{2}\.\d{4}($|\s)/) == -1 ) return 0; >+ dateformat = 'dd.mm.yy'; >+ } >+ try { >+ $.datepicker.parseDate(dateformat, date); >+ } catch (e) { >+ return 0; >+ }; >+ return 1; >+}function get_dateformat_str(dateformat) { >+ var dateformat_str; >+ if ( dateformat == 'us' ) { >+ dateformat_str = 'mm/dd/yyyy'; >+ } else if ( dateformat == 'metric' ) { >+ dateformat_str = 'dd/mm/yyyy'; >+ } else if (dateformat == 'iso' ) { >+ dateformat_str = 'yyyy-mm-dd'; >+ } else if ( dateformat == 'dmydot' ) { >+ dateformat_str = 'dd.mm.yyyy'; >+ } >+ return dateformat_str; >+} >+ >+function validate_date (dateText, inst) { >+ if ( !is_valid_date(dateText) ) { >+ var dateformat_str = get_dateformat_str( 'us' ); >+ alert(MSG_PLEASE_ENTER_A_VALID_DATE.format(dateformat_str)); >+ $('#'+inst.id).val(''); >+ } >+} >+function Date_from_syspref(dstring) { >+ var dateX = dstring.split(/[-/.]/); >+ if (debug > 1 && sentmsg < 1) {sentmsg++; alert("Date_from_syspref(" + dstring + ") splits to:\n" + dateX.join("\n"));} >+ if (dformat === "iso") { >+ return new Date(dateX[0], (dateX[1] - 1), dateX[2]); // YYYY-MM-DD to (YYYY,m(0-11),d) >+ } else if (dformat === "us") { >+ return new Date(dateX[2], (dateX[0] - 1), dateX[1]); // MM/DD/YYYY to (YYYY,m(0-11),d) >+ } else if (dformat === "metric") { >+ return new Date(dateX[2], (dateX[1] - 1), dateX[0]); // DD/MM/YYYY to (YYYY,m(0-11),d) >+ } else if (dformat === "dmydot") { >+ return new Date(dateX[2], (dateX[1] - 1), dateX[0]); // DD.MM.YYYY to (YYYY,m(0-11),d) >+ } else { >+ if (debug > 0) {alert("KOHA ERROR - Unrecognized date format: " +dformat);} >+ return 0; >+ } >+} >+ >+function DateTime_from_syspref(date_time) { >+ var parts = date_time.split(" "); >+ var date = parts[0]; >+ var time = parts[1]; >+ parts = time.split(":"); >+ var hour = parts[0]; >+ var minute = parts[1]; >+ if ( hour < 0 || hour > 23 ) { >+ return 0; >+ } >+ if ( minute < 0 || minute > 59 ) { >+ return 0; >+ } >+ var datetime = Date_from_syspref( date ); >+ if ( isNaN( datetime.getTime() ) ) { >+ return 0; >+ } >+ datetime.setHours( hour ); >+ datetime.setMinutes( minute ); >+ return datetime; >+} >+ >+/* Instead of including multiple localization files as you would normally see with >+ jQueryUI we expose the localization strings in the default configuration */ >+jQuery(function($){ >+ $.datepicker.regional[''] = { >+ closeText: _("Done"), >+ prevText: _("Prev"), >+ nextText: _("Next"), >+ currentText: _("Today"), >+ monthNames: [_("January"),_("February"),_("March"),_("April"),_("May"),_("June"), >+ _("July"),_("August"),_("September"),_("October"),_("November"),_("December")], >+ monthNamesShort: [_("Jan"), _("Feb"), _("Mar"), _("Apr"), _("May"), _("Jun"), >+ _("Jul"), _("Aug"), _("Sep"), _("Oct"), _("Nov"), _("Dec")], >+ dayNames: [_("Sunday"), _("Monday"), _("Tuesday"), _("Wednesday"), _("Thursday"), _("Friday"), _("Saturday")], >+ dayNamesShort: [_("Sun"), _("Mon"), _("Tue"), _("Wed"), _("Thu"), _("Fri"), _("Sat")], >+ dayNamesMin: [_("Su"),_("Mo"),_("Tu"),_("We"),_("Th"),_("Fr"),_("Sa")], >+ weekHeader: _("Wk"), >+ dateFormat: "mm/dd/yy", >+ firstDay: 0, >+ isRTL: false, >+ showMonthAfterYear: false, >+ yearSuffix: ''}; >+ $.datepicker.setDefaults($.datepicker.regional['']); >+ }); >+ >+$(document).ready(function(){ >+ $.datepicker.setDefaults({ >+ showOn: "both", >+ changeMonth: true, >+ changeYear: true, >+ buttonImage: '/intranet-tmpl/prog/img/famfamfam/silk/calendar.png', >+ buttonImageOnly: true, >+ showButtonPanel: true, >+ showOtherMonths: true, >+ selectOtherMonths: true >+ }); >+ $( ".datepicker" ).datepicker({ >+ onClose: function(dateText, inst) { >+ validate_date(dateText, inst); >+ }, >+ }).on("change", function(e, value) { >+ if ( ! is_valid_date( $(this).val() ) ) {$(this).val("");} >+ }); >+ // http://jqueryui.com/demos/datepicker/#date-range >+ var dates = $( ".datepickerfrom, .datepickerto" ).datepicker({ >+ changeMonth: true, >+ numberOfMonths: 1, >+ onSelect: function( selectedDate ) { >+ var option = this.id == "from" ? "minDate" : "maxDate", >+ instance = $( this ).data( "datepicker" ); >+ date = $.datepicker.parseDate( >+ instance.settings.dateFormat || >+ $.datepicker._defaults.dateFormat, >+ selectedDate, instance.settings ); >+ dates.not( this ).datepicker( "option", option, date ); >+ }, >+ onClose: function(dateText, inst) { >+ validate_date(dateText, inst); >+ }, >+ }).on("change", function(e, value) { >+ if ( ! is_valid_date( $(this).val() ) ) {$(this).val("");} >+ }); >+}); >+//]]> > </script> >+ >+ > <script type="text/javascript"> >-jQuery.validator.addMethod( "letters_numbers", function(value,element){ >- var patt = /^[a-zA-Z0-9\-_]+$/g; >- if (patt.test(element.value)) { >- return true; >- } else { >- return false; >- } >-}, MSG_CATEGORYCODE_CHARS); >+var MSG_CATEGORYCODE_CHARS=(_("Please only enter letters into this field.")); >+var MSG_ONE_ENROLLMENTPERIOD =(_("Please choose an enrollment period in months OR by date.")); >+var MSG_ONLY_ONE_ENROLLMENTPERIOD=(_("Please only choose one enrolment period.")); >+var MSG_DESCRIPTION_LETTERS_ONLY=(_("Please only enter letters.")); >+</script> >+ >+<script type="text/javascript"> >+jQuery.validator.addMethod( "category_code_check", function(value,element){ >+ var patt = /^[A-Za-z]{0,10}$/g; >+ if (patt.test(element.value)) { >+ return true; >+ } else { >+ return false; >+ } >+}, MSG_CATEGORYCODE_CHARS >+); >+jQuery.validator.addMethod( "letters_only", function(value,element){ >+ var patt =/^[A-Za-z ]{0,30}$/g; >+ if (patt.test(element.value)){ >+ return true; >+ } else { >+ return false; >+ } >+ }, MSG_DESCRIPTION_LETTERS_ONLY >+); > > jQuery.validator.addMethod( "enrollment_period", function(){ >- enrolmentperiod = $("#enrolmentperiod").val(); >- enrolmentperioddate = $("#enrolmentperioddate").val(); >- if ( $("#enrolmentperiod").val() !== "" && $("#enrolmentperioddate").val() !== "" ) { >- return false; >- } else { >- return true; >- } >-}, MSG_ONE_ENROLLMENTPERIOD); >+ enrolmentperiod = $("#enrolmentperiod").val(); >+ enrolmentperioddate = $("#enrolmentperioddate").val(); >+ if (( $("#enrolmentperiod").val() == "" && $("#enrolmentperioddate").val() == "") || ($("#enrolmentperiod").val() !== "" && $("#enrolmentperioddate").val() !== "")) { >+ return false; >+ } else { >+ return true; >+ } >+ }, MSG_ONLY_ONE_ENROLLMENTPERIOD >+); >+ >+$(document).ready(function() { >+ $("#enrolmentperioddate").datepicker({ >+ minDate: 1 >+ }); // Require that "until date" be in the future >+ if ($("#branches option:selected").length < 1) { >+ $("#branches option:first").attr("selected", "selected"); >+ } >+ $("#categorycode").on("blur",function(){ >+ toUC(this); >+ }); >+ $("#category_form").validate({ >+ rules: { >+ categorycode: { >+ required: true, >+ category_code_check: true >+ }, >+ description: { >+ required:true, >+ letters_only: true >+ }, >+ enrolmentperiod: { >+ required: function(element){ >+ return $("#enrolmentperioddate").val() === ""; >+ }, >+ digits: true, >+ enrollment_period: true, >+ }, >+ enrolmentperioddate: { >+ required: function(element){ >+ return $("#enrolmentperiod").val() === ""; >+ }, >+ enrollment_period: true, >+ // is_valid_date ($(#"enrolementperioddate").val()); >+ }, >+ dateofbirthrequired: { >+ digits: true >+ }, >+ upperagelimit: { >+ digits: true >+ }, >+ enrolmentfee: { >+ number: true >+ }, >+ reservefee: { >+ number: true >+ }, >+ category_type: { >+ required: true >+ } >+ }, >+ messages: { >+ enrolmentperiod: { >+ required: MSG_ONE_ENROLLMENTPERIOD >+ }, >+ enrolmentperioddate: { >+ required: MSG_ONE_ENROLLMENTPERIOD >+ } >+ } >+ }); >+}); > >-$(document).ready(function(){ >- $("#category_form").validate({ >- rules: { >- categorycode: { >- required: true, >- letters_numbers: true >- }, >- description: "required", >- enrolmentperiod: { >- required: function(element){ >- return $("#enrolmentperioddate").val() === ""; >- }, >- digits: true, >- enrollment_period: true >- }, >- enrolmentperioddate: { >- required: function(element){ >- return $("#enrolmentperiod").val() === ""; >- }, >- enrollment_period: true >- }, >- dateofbirthrequired: { >- digits: true >- }, >- upperagelimit: { >- digits: true >- }, >- enrolmentfee: { >- number: true >- }, >- reservefee: { >- number: true >- }, >- category_type: { >- required: true >- } >- }, >- messages: { >- enrolmentperiod: { >- required: MSG_ONE_ENROLLMENTPERIOD >- }, >- enrolmentperioddate: { >- required: MSG_ONE_ENROLLMENTPERIOD >- } >- } >- >- }); >- >-}) > </script> >- > </head> > > <div> <!-- Header that appears at the top of every screen in the koha onboarding tool--> >@@ -100,15 +284,18 @@ $(document).ready(function(){ > </form> > > <!--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--> >-[% ELSIF op == "add_validate" %] >+[% ELSIF createcat %] > [% IF message != "error_on_insert" %] > <form name="createcat" method="post" action="onboarding.pl"> > <input type="hidden" name="step" value="3"/> > <h1 align="left"> New patron category</h1> > <div> >- <p> Success: Patron category created! Your patron category code is [% category.categorycode %] </p> >+ <p> Success: Patron category created! </p> > <p> To add another patron category and for more settings<br> >- go to More->Administration->Patrons & Circulation->Patron Categories</p> >+ go to:<br> >+ More->Administration->Patron categories<br> >+ OR<br> >+ Administration->Patron categories</p> > </div> > Next up:<br> > <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--> >@@ -123,25 +310,25 @@ $(document).ready(function(){ > </div> > <input type="submit" value="Try again"/> > </form> >- [% END %] >- >+ [% END %] >+ > > [% ELSE %] <!--Else display create patron category screen 1 where the user can input values to create their first patron category--> > <h1 align="left"> Create a new Patron Category</h1> >- <form id="category_form" method="post" action="onboarding.pl"> >+ <form id="category_form" method="post" action="onboarding.pl"> > <fieldset class="rows"> > <input type="hidden" name="step" value="2"/> >- <input type="hidden" name="op" value="add_validate" /> >+ <input type="hidden" name="createcat" value="createcat" /> > <ol> > <li> > <label for="categorycode" class="required">Category code: </label> >- <input type="text" style="text-transform: uppercase;" name="categorycode" value="[% category.categorycode |html %]" size="10" maxlength="10" class="required" required="required" /> >+ <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" /> > <span class="required">Required</span> > </li> > > <li> > <label for="description" class="required">Description: </label> >- <input type="text" style="text-transform:capitalize;" name="description" size="40" maxlength="80" class="required" required="required" value="[% category.description |html %]" /> >+ <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 %]" /> > <span class="required">Required</span> > </li> > >@@ -204,11 +391,11 @@ $(document).ready(function(){ > <ol> > <li> > <label for="enrolmentperiod" style="width:6em;">In months: </label> >- <input type="number" min="0" class="enrollmentperiod" name="enrolmentperiod" size="3" maxlength="3" value="[% IF category.enrolmentperiod %][% category.enrolmentperiod %][% END %]" /> months >+ <input type="number" min="0" class="enrolmentperiod" name="enrolmentperiod" id="enrolmentperiod" size="3" maxlength="3" value="[% IF category.enrolmentperiod %][% category.enrolmentperiod %][% END %]" /> months > </li> > <li> > <label for="enrolmentperioddate" style="width:6em;">Until date: </label> >- <input type="text" class="enrollmentperiod" name="enrolmentperioddate" id="enrolmentperioddate" value="[% category.enrolmentperioddate | $KohaDates %]" /> >+ <input type="text" class="enrolmentperioddate datepicker" name="enrolmentperioddate" id="enrolmentperioddate" value="[% category.enrolmentperioddate | $KohaDates %]" /> > </li> > </ol> > </fieldset> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep3.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep3.tt >index 83667cb..45cb584 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep3.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep3.tt >@@ -4,9 +4,7 @@ > [% USE Price %] > <!--[% USE Branches %]--> > [% INCLUDE 'doc-head-open.inc' %] >-[% IF ( finish ) %]<meta http-equiv="refresh" content="10; url=/cgi-bin/koha/mainpage.pl">[% END %] >- >- >+[% IF ( finish ) %]<meta http-equiv="refresh" content="10; url=/cgi-bin/koha/mainpage.pl">[% END%] > [% INCLUDE 'installer-doc-head-close.inc' %] > [% INCLUDE 'calendar.inc' %] > [% INCLUDE 'datatables.inc' %] >@@ -16,35 +14,114 @@ > <title>Create Patron</title> > > <!--jQuery scripts for creating patron--> >-<!--<script type="text/javascript" src="[% interface %]/[% theme %]/js/members.js"></script> >---> >+<script type-"text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.fixFloat.js"></script> >+<script type="text/javascipt"> >+ var MSG_DUPLICATE_PATRON = _("Warning: Duplicate patron"); >+ var MSG_PASSWORD_MISMATCH = _("The passwords entered do not match"); >+ var MSG_PASSWORD_CONTAINS_TRAILING_SPACES = _("Password contains leading and/or trailing spaces."); >+function check_password(password){ >+ if(password.match(/^\s/) || password.match(/\s$/)){ >+ return false; >+ }return true; >+} >+ >+$(document).ready(function(){ >+ $("#createpatron").validate({ >+ rules: { >+ borrowernumber: { >+ required: true, >+ digits: true >+ }, >+ surname:{ >+ required: true, >+ letters: true >+ }, >+ firstname:{ >+ required:true, >+ letters:true >+ }, >+ userid: { >+ required: true; >+ letters_numbers: true >+ }, >+ password: { >+ letters_numbers: true >+ }, >+ }, >+ messages: { >+ password: { >+ required: MSG_PASSWORD_MISMATCH >+ }, >+ userid: { >+ required: MSG_DUPLICATE_PATRON >+ } >+ } >+ >+ }); >+ >+}) >+</script> >+<script type="text/javascript" src="[% interface %]/[% theme %]/js/members.js"></script> > </head> > > <div> > <h1 align="center"> Welcome to Koha</h1> > <h1 id="logo"><img alt="Koha" style="width:50%;margin:auto;display:block;align:center;" src="[% interface %]/[% theme %]/img/koha.org-logo.gif"/></h1> > </div> >+ >+ >+[% IF (nok) %] >+ <form name="errors" method="post" action="onboarding.pl"> >+ <input type="hidden" name="step" value="3"/> >+ <h1 align="left">There was an error</h1> >+ <p>Try again </p> >+ <div> >+ <ul> >+ [% IF errorloginexists %] >+ <li id="ERROR_login_exist">Username/password already exists.</li> >+ [% END %] >+ [% IF errorcardnumberexists %] >+ <li id="ERROR_cardnumber">Cardnumber already in use.</li> >+ [% END %] >+ [% IF errorcardnumberlength %] >+ <li id="ERROR_cardnumber">Cardnumber length is incorrect</li> >+ [% END %] >+ [% IF errorshortpassword %] >+ <li id="ERROR_short_password">Password length is incorrect, must be at least [% minPasswordLength %] characters long.</li> >+ [% END %] >+ [% IF errorpasswordmismatch %] >+ <li id="ERROR_password_mismatch">Passwords do not match.</li> >+ [% END %] >+ </ul> >+ >+ </div> >+ <input type="submit" name="step" value="Try again"/> >+ </form> >+ >+ > <!--Create a patron screen 2--> >-[% IF op == 'add_validate' %] >- <!--New patron created--> >+[% ELSIF op == 'add_validate' %] >+ <!--New patron created--> > <form name="patrondone" method="post" action="onboarding.pl"> > <input type="hidden" name="step" value="4"/> > <h1 align="left"> New Patron </h1> >- <div> >+ <div> > <p> Success: New patron created!</p> > <p> To create another patron, go to Patrons > New Patron. <br> > More > Set Permissions in a user page to gain superlibrarian permissions. >- </div> >- Next up: >- <input type="submit" name="start" value="Add an item type"/> >+ </div> >+ Next up: >+ <input type="submit" name="start" value="Add an item type"/> > </form> >- <!--Implement a if statement to check if the patron was successfully created >- <div> >- <p> Oh no! Patron was not created</p> >- </div>--> > [% ELSE %] > <!--Create a patron screen 1--> >- <h1 align="left"> Create a new Patron </h2> >+ <h1 align="left"> Create a new Patron</h1> >+ <legend id="library_management_lgd">Library Management</legend> >+ <p> >+ Now we will create a patron with superlibrarian permissions. Login with this to access Koha as a staff member will all permissions. >+ </p> >+ >+ > <form name="createpatron" method="post" action="onboarding.pl"> > <fieldset class="rows"> > <input type="hidden" name="step" value="3"/> >@@ -54,21 +131,20 @@ > <li> > <label for="surname" class="required">Surname: </label> > >- <input type="text" style="text-transform:capitalize" id="surname" name="surname" value="[% surname %]" class="required" required="required" /> >+ <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" /> > <span class="required">Required</span> > </li> > <li> > <label for="firstname" class="required">First Name: </label> >- <input style= "text-transform:capitalize;" type="text" name="firstname" id="firstname" size="20" value="[% firstname |html %]" class="required" required="required"> >+ <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"> > <span class="required">Required</span> > </li> > </ol> >- >- <legend id="library_management_lgd">Library Management</legend> >+ > <ol> > <li> > <label for="cardnumber" class="required">Card Number: </label> >- <input type="number" min="1" id="cardnumber" name="cardnumber" maxlength="20" value="[% borrower.cardnumber | html %]" class="required"> >+ <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"> > <span class="required">Required</span> > </li> > <li> >@@ -79,45 +155,45 @@ > [% FOREACH library IN libraries %] > <option name="libraries" value="[% library.branchcode %]"> [% library.branchname %] > [% END %] >- >+ > </select> > <span class="required"> Required</span> > </li> > <li> > <label for="categorycode_entry" class="required"> Patron Category</label> > <select id="categorycode_entry" name="categorycode_entry" onchange="update_category_code(this);"> >- [% FOREACH category IN categories %] >- <option name="categorycode_entry" value = "[% category.categorycode %]"> [%category.description %]</option> >- [% END %] >+ [% FOREACH category IN categories %] >+ <option name="categorycode_entry" value = "[% category.categorycode %]">[%category.description %]</option> >+ [% END %] > </select> >- <span class="required">Required</span> >- </li> >+ <span class="required">Required</span><br><br> >+ <b>Note:</b> If you installed sample patron categories please select the "Staff" option in the Patron Categories dropdown box. >+ </li> > </ol> >- >+ > <ol> >- > <h3> Patron permissions</h3> > <input type="hidden" name="newflags" value="1"/> > <li> > <input type="hidden" class="flag parent" id="flag-0" name="flag" value="superlibrarian"/> > <label name="permissioncode" for="flag-0"> superlibrarian</label> >- </li> >+ </li> > </ol> > <ol> > <h3>OPAC/Staff Login</h3> > <li> > <label for="userid" class="required">Username: </label> >- <input type="text" name="userid" id ="userid" size="20" value="[% userid %]" class="required" required="required" /> >+ <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" /> > <span class="required">Required</span> > </li> > <li> > <label for="passwordlabel" class="required">Password: </label> >- <input type="password" name="password" id="password" size="20" value="[% member.password |html %]" class="required" required="required"> >+ <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"> > <span class="required">Required</span> > </li> > <li> > <label for="password2" class="required">Confirm password: </label> >- <input type="password" id="password2" name="password2" size="20" value="" class="required" required="required"> >+ <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"> > <span class="required">Required</span> > </li> > </ol> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep4.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep4.tt >index 73400ff..87be779 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep4.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep4.tt >@@ -20,8 +20,6 @@ > > [% IF itemtypes.count > 0 %] > <br> >- h no! Patron was not created</p> >- > <h3 align="left">You do not need to create a item type as you have already installed the sample item type data previously</h3> > <form name="skipitemtype" method="post" action="onboarding.pl"> > <input type="hidden" name="step" value="5"/> >@@ -68,12 +66,12 @@ > <ol> > <li> > <label for="itemtype" class="required">Item type code: </label> >- <input type="text" style="text-transform:uppercase;" name="itemtype" id="itemtype" size="10" maxlength="10" class="required" required="required" /> >+ <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" /> > <span class="required">Required</span> > </li> > <li> > <label for="description" class="required">Description: </label> >- <input type="text" style="text-transform:capitalize;" name="description" id="description" size="42" value="[% itemtype.description |html %]" class="required" required="required"> >+ <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"> > <span class="required">Required</span> > </li> > </ol> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep5.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep5.tt >index f2a7ac8..cca7820 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep5.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep5.tt >@@ -1,18 +1,9 @@ >-<!--Includes for creating circulation rule--> > [% INCLUDE 'doc-head-open.inc' %] >- >+<title>Create Circulation rule</title> > [% IF ( finish ) %]<meta http-equiv="refresh" content="10; url=/cgi-bin/koha/mainpage.pl">[% END %] > [% INCLUDE 'installer-doc-head-close.inc' %] > >-<head> >-<title>Create Circulation rule</title> >- >-<!--jQuery scripts for creating circulation rule--> >- >- >- > </head> >- > <div> > <h1 align="center"> Welcome to Koha</h1> > <h1 id="logo"><img alt="Koha" style="width:50%;margin:auto;display:block;align:center;" src="[% interface %]/[% theme %]/img/koha.org-logo.gif"/></h1> >@@ -28,10 +19,8 @@ > [% IF op == "add_validate" %] > <!--New circulation rule created--> > <form name="finish" method="post" action="onboarding.pl"> >- <input type="hidden" name="op" value="finish" /> >- >+ <input type="hidden" name="op" value="finish" /> > <h1 align="left"> New Circulation rule </h1> >- > <div> > <p> Success: New circulation rule created!</p> > <p> To create circulation rule, go to <br> >@@ -40,27 +29,32 @@ > Next up: > <input type="submit" name="op" value="Finish"/> > </form> >- <!-- <div> >- <p> Oh no! Circulation Rule was not created</p> >- </div> --> >- >- > [% ELSE %] > <!--Create a circulation rule screen 1--> >- <h1 align="left"> Create a new Circulation rule </h2> >- >+ <h1 align="left"> Create a new Circulation rule </h1> > <form name="createcirculationrule" method="post" action="onboarding.pl"> > <fieldset class="rows"> > <input type="hidden" name="step" value="5"/> > <input type="hidden" name="op" value="add_validate" /> > <ol> > <li> >- <label for="categorycode" class="required">Patron Category: </label> >- <select name="categorycode" id="categorycode" required="required" onchange = "update_categorycode(this);"> >+ <label for="branch" class="required"> Library branch</label> >+ <select name="branch" id="branch" required="required"> >+ <option value="*">All</option> >+ [% FOREACH library IN libraries %] >+ <option name="branch" value="[% library.branchcode %]"> [% library.branchname %]</option> >+ [% END %] >+ </select> >+ <span class="required">Required</span> >+ </li> >+ <li> >+ <label for="categorycode" class="required">Patron Category: </label> >+ <select name="categorycode" id="categorycode" required="required" onchange = "update_categorycode(this);"> > <!-- <option name="categorycode" value="All">All--> >+ <option value="*">All</option> > [% FOREACH category IN categories %] > <option name="categorycode" value = "[% category.categorycode %]"> [%category.description %]</option> >- [%END%] >+ [%END%] > </select> > <span class="required">Required</span> > </li> >@@ -68,66 +62,63 @@ > <li> > <label for="itemtype"> Item type: </label> > <select id="itemtype" name="itemtype" required="required"> >+ <option value="*">All</option> > [% FOREACH item IN itemtypes %] > <option name="itemtype" value = "[% item.itemtype %]"> [% item.itemtype %] > [%END%] >- </select> >- <span class="required"> Required</span> >- </li> >- >- <li> >- <label for="maxissueqty" class="required">Current checkouts allowed: </label> >- <input type="number" min="0" name="maxissueqty" id="maxissueqty" size="10" maxlength="10" value="" class="required" required="required" /> >- <span class="required">Required</span> >- </li> >- >- <li> >- <label for="issuelength" class="required">Loan Period: </label> >- <input type="number" min="0" name="issuelength" id="issuelength" size="10" maxlength="10" value="" class="required" required="required" /> >- <span class="required">Required</span> >- </li> >- >- <li> >- <label for="lengthunit">Units: </label> >- <select name="lengthunit" id="lengthunit" required="required"> >- [% SET units = 'days' %] >- >- [% 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--> >- [% SET default_privacy = category.default_privacy %] >- [% END %] >- >- [% SWITCH units %] >- [% CASE 'days' %] >- <option value="days" selected="selected">Days</option> >- <option value="hours">Hours</option> >- [% CASE 'hours' %] >- <option value="days">Days</option> >- <option value="hours" selected="selected">Hours</option> >- [% END %] >- </select> >- </li> >- >- <li> >- <label for="renewalsallowed" class="required">Renewals Allowed: </label> >- <input type="number"min="0" name="renewalsallowed" id="renewalsallowed" size="10" maxlength="10" value="" class="required" required="required" /> >- <span class="required">Required</span> >- </li> >- >- <li> >- <label for="renewalperiod" class="required">Renewals Period: </label> >- <input type="number" min="0"name="renewalperiod" id="renewalperiod" size="10" maxlength="10" value="" class="required" required="required" /> >- <span class="required">Required</span> >- </li> >- >- <li> >- <label for="onshelfholds">On shelf holds allowed: </label> >- <select name="onshelfholds" id="onshelfholds" required="required"> >- <option value="yes" selected="selected">Yes</option> >- <option value="anyunavailable">If any unavailable</option> >- <option value="allunavailable">If all unavailable</option> >- </select> >- </li> >- </ol> >+ </select> >+ <span class="required"> Required</span> >+ </li> >+ <li> >+ <label for="maxissueqty" class="required">Current checkouts allowed: </label> >+ <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" /> >+ <span class="required">Required</span> >+ </li> >+ >+ <li> >+ <label for="issuelength" class="required">Loan Period: </label> >+ <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" /> >+ <span class="required">Required</span> >+ </li> >+ <li> >+ <label for="lengthunit">Units: </label> >+ <select name="lengthunit" id="lengthunit" required="required"> >+ [% SET units = 'days' %] >+ [% IF category %] >+ [% SET default_privacy = category.default_privacy %] >+ [% END %] >+ >+ [% SWITCH units %] >+ [% CASE 'days' %] >+ <option value="days" selected="selected">Days</option> >+ <option value="hours">Hours</option> >+ [% CASE 'hours' %] >+ <option value="days">Days</option> >+ <option value="hours" selected="selected">Hours</option> >+ [% END %] >+ </select> >+ </li> >+ <li> >+ <label for="renewalsallowed" class="required">Renewals Allowed: </label> >+ <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" /> >+ <span class="required">Required</span> >+ </li> >+ >+ <li> >+ <label for="renewalperiod" class="required">Renewals Period: </label> >+ <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" /> >+ <span class="required">Required</span> >+ </li> >+ >+ <li> >+ <label for="onshelfholds">On shelf holds allowed: </label> >+ <select name="onshelfholds" id="onshelfholds" required="required"> >+ <option value="yes" selected="selected">Yes</option> >+ <option value="anyunavailable">If any unavailable</option> >+ <option value="allunavailable">If all unavailable</option> >+ </select> >+ </li> >+ </ol> > </fieldset><br> > <input type="submit" class="action" value="Submit"/> > </form> >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 17855
:
58657
|
58658
|
58659
|
58660
|
58661
|
58662
|
58663
|
58664
|
58665
|
58666
|
58667
|
58668
|
58669
|
58781
|
58782
|
58783
|
58784
|
58785
|
58792
|
58793
|
58794
|
58846
|
58860
|
58861
|
58862
|
58886
|
58892
|
58893
|
58894
|
58895
|
58896
|
58897
|
58898
|
58899
|
58900
|
58901
|
58902
|
58903
|
58904
|
58905
|
58906
|
58907
|
59037
|
59051
|
59140
|
59141
|
59174
|
59188
|
59277
|
59279
|
59280
|
59281
|
59628
|
59703
|
59705
|
59706
|
59707
|
59708
|
59709
|
59710
|
59711
|
59712
|
59742
|
59826
|
59830
|
59840
|
59841
|
59842
|
59856
|
59857
|
60092
|
61667
|
61668
|
61986
|
62186
|
62191
|
62192
|
62193
|
62220
|
62221
|
62222
|
62223
|
62231
|
62233
|
62234
|
62235
|
62236
|
62237
|
62238
|
62239
|
62240
|
62241
|
62242
|
62243
|
62251
|
62252
|
62253
|
62254
|
62255
|
62256
|
62257
|
62258
|
62259
|
62260
|
62261
|
62262
|
62263
|
62281
|
62282
|
62283
|
62284
|
62285
|
62286
|
62287
|
62288
|
62668
|
62669
|
62670
|
62671
|
62672
|
62673
|
62674
|
62675